PageSourceSearch

https://nuzlocke-generator.herokuapp.com/assets/EditorControls-TpWmZR2v.js

js nuzlocke-generator.herokuapp.com collected 2026-10-03 14:50:43 UTC 5,757 bytes, 93 lines download raw bytes

1import{r as d,u as S,c as z,j as r,t as w,h as E,K as a,O as I,Q as R,S as v,U as D,V as K,W as L,X as T,Y as C,Z as U,$ as j,a0 as H}from"./index-C2b_3DlN.js";import"./vendor-XDCjal2T.js";function N(o,i,s=!1){d.useEffect(()=>(window.addEventListener(o,i,s),function(){window.removeEventListener(o,i)}))}const n={panel:a`
2        position: absolute;
3        top: 100%;
4        left: 0;
5        width: 200px;
6        background: inherit;
7        border: 1px solid #ccc;
8        border-top: none;
9        max-height: 300px;
10        overflow-y: auto;
11        z-index: 100;
12        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
13        border-radius: 0 0 4px 4px;
14    `,panelDark:a`
15        border-color: #444;
16        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
17    `,list:a`
18        list-style: none;
19        margin: 0;
20        padding: 0;
21    `,item:a`
22        padding: 8px 12px;
23        cursor: pointer;
24        display: flex;
25        align-items: center;
26        gap: 8px;
27        border-bottom: 1px solid #eee;
28        font-size: 12px;
29        transition: background 0.15s ease;
30
31        &:last-child {
32            border-bottom: none;
33        }
34
35        &:hover {
36            background: rgba(0, 0, 0, 0.05);
37        }
38    `,itemDark:a`
39        border-bottom-color: #333;
40
41        &:hover {
42            background: rgba(255, 255, 255, 0.1);
43        }
44    `,current:a`
45        background: rgba(45, 114, 210, 0.15);
46        font-weight: 600;
47
48        &:hover {
49            background: rgba(45, 114, 210, 0.2);
50        }
51    `,currentDark:a`
52        background: rgba(45, 114, 210, 0.3);
53
54        &:hover {
55            background: rgba(45, 114, 210, 0.4);
56        }
57    `,pastItem:a`
58        opacity: 0.7;
59    `,futureItem:a`
60        opacity: 0.5;
61        font-style: italic;
62    `,index:a`
63        color: #888;
64        font-size: 10px;
65        min-width: 24px;
66        text-align: right;
67        font-family: monospace;
68    `,label:a`
69        flex: 1;
70        overflow: hidden;
71        text-overflow: ellipsis;
72        white-space: nowrap;
73    `,icon:a`
74        opacity: 0.6;
75    `,emptyState:a`
76        padding: 16px;
77        text-align: center;
78        color: #888;
79        font-size: 12px;
80    `,header:a`
81        padding: 8px 12px;
82        font-size: 11px;
83        font-weight: 600;
84        text-transform: uppercase;
85        letter-spacing: 0.5px;
86        color: #666;
87        background: rgba(0, 0, 0, 0.03);
88        border-bottom: 1px solid #eee;
89    `,headerDark:a`
90        background: rgba(255, 255, 255, 0.05);
91        border-bottom-color: #333;
92        color: #999;
93    `};function P({isOpen:o,onClose:i,editorDarkMode:s}){const f=S(e=>e.editorHistory),l=z(),p=d.useRef(null);if(d.useEffect(()=>{if(!o)return;const e=u=>{p.current&&!p.current.contains(u.target)&&i()},t=setTimeout(()=>{document.addEventListener("mousedown",e)},0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[o,i]),!o)return null;const{past:y,present:x,future:h}=f,b=y.length>0||h.length>0,c=[];y.forEach((e,t)=>{c.push({index:t,type:"past",label:`State ${t+1}`})}),c.push({index:y.length,type:"current",label:"Current State"}),h.forEach((e,t)=>{c.push({index:y.length+1+t,type:"future",label:`Redo ${t+1}`})});const m=(e,t)=>{if(t==="current")return;const u=I(f,e);u!=null&&(l(R(e)),l(v(u)),i())};return r.jsxs("div",{ref:p,className:w(n.panel,s&&n.panelDark),children:[r.jsx("div",{className:w(n.header,s&&n.headerDark),children:"History Timeline"}),!b&&x==null?r.jsx("div",{className:n.emptyState,children:"No history available yet"}):r.jsx("ul",{className:n.list,children:c.map(e=>r.jsxs("li",{className:w(n.item,s&&n.itemDark,e.type==="current"&&n.current,e.type==="current"&&s&&n.currentDark,e.type==="past"&&n.pastItem,e.type==="future"&&n.futureItem),onClick:()=>m(e.index,e.type),title:e.type==="current"?"Current state":`Click to jump to ${e.label}`,children:[r.jsx("span",{className:n.index,children:e.index+1}),r.jsx(E,{icon:e.type==="current"?"record":e.type==="past"?"history":"redo",size:12,className:n.icon}),r.jsx("span",{className:n.label,children:e.label}),e.type!=="current"&&r.jsx(E,{icon:"chevron-right",size:12,className:n.icon})]},e.index))})]})}const $=o=>
93(o.ctrlKey||o.metaKey)&&o.key.toLowerCase()==="z"&&!o.shiftKey,O=o=>{if(!o.ctrlKey&&!o.metaKey)return!1;const i=o.key.toLowerCase();return i==="y"||i==="z"&&o.shiftKey};function V({editorDarkMode:o,minimized:i}){const s=S(t=>t.editorHistory),f=S(t=>t.hotkeys),l=z(),[p,y]=d.useState(!1),x=s?.past?.length>0&&s?.present!=null,h=s?.future?.length>0&&s?.present!=null,b=d.useCallback(()=>{if(!x||s.present==null)return;const{past:t,present:u}=s,g=t[t.length-1],k=D(u,g);l(K()),l(v(k))},[s,x,l]),c=d.useCallback(()=>{if(!h||s.present==null)return;const{future:t,present:u}=s,g=t[0],k=L(u,g);l(T()),l(v(k))},[s,h,l]),m=d.useCallback(t=>{$(t)&&(t.preventDefault(),b())},[b]),e=d.useCallback(t=>{O(t)&&(t.preventDefault(),c())},[c]);return N("keydown",m),N("keydown",e),r.jsxs("div",{className:C.historyControls,style:{width:i?"0%":"33%",background:o?"#222":"#fff",display:i?"none":"block",position:"relative"},children:[r.jsxs(U,{fill:!0,className:C.buttonGroup,children:[r.jsx(j,{onClick:()=>y(!p),minimal:!0,fill:!0,icon:"history",active:p,title:"View History","data-testid":"history-timeline-button",children:r.jsx(H,{hotkey:f?.toggleHistoryTimeline??"h",showModifier:!1})}),r.jsx(j,{disabled:!x,onClick:b,minimal:!0,fill:!0,icon:"undo",title:"Undo",style:{fontSize:"0.6875rem"},children:r.jsx(H,{hotkey:"Z"})}),r.jsx(j,{disabled:!h,onClick:c,minimal:!0,fill:!0,icon:"redo",title:"Redo",style:{fontSize:"0.6875rem"},children:r.jsx(H,{hotkey:"Y"})})]}),r.jsx(P,{isOpen:p,onClose:()=>y(!1),editorDarkMode:o})]})}export{V as EditorControls,O as isRedoHotkey,$ as isUndoHotkey};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.