efficient-shell 4.173.0 → 4.177.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -2
- package/dist/{Browser-X7UTQJOX.js → Browser-MFFTBGEB.js} +14 -14
- package/dist/Calculator-AGQQYMMZ.js +29 -0
- package/dist/ConfirmDialog-6PVUVYXZ.js +1 -0
- package/dist/{CurrencyConverter-RODHLQMG.js → CurrencyConverter-KZPE7ZCC.js} +5 -5
- package/dist/{Documents-BJFZHHBZ.js → Documents-ZD227WZC.js} +14 -14
- package/dist/{Files-PL5NE4PQ.js → Files-BLGT4RLF.js} +24 -24
- package/dist/{Notepad-52LDWEK2.js → Notepad-LUK2IFHD.js} +8 -8
- package/dist/PdfViewer-RKRGO7Q2.js +1 -0
- package/dist/{PomodoroTimer-C3KCTCMB.js → PomodoroTimer-LHPV6QXG.js} +24 -24
- package/dist/{Preview-O3N26GG6.js → Preview-5CALO6PW.js} +18 -18
- package/dist/{Sidebar-QNGQA6J5.js → Sidebar-4GIZSTD5.js} +23 -23
- package/dist/{Spreadsheet-HVKVNQN6.js → Spreadsheet-F3VBCPHF.js} +14 -14
- package/dist/{Stock-YOGVYL6F.js → Stock-XSDFN7U2.js} +4 -4
- package/dist/{Weather-4OQOBM4C.js → Weather-7YDUDMCO.js} +17 -17
- package/dist/{WorldClock-K5KLOOD7.js → WorldClock-Q2JHBKLS.js} +4 -4
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/{chunk-S5QF4VFG.js → chunk-3YTHR7IC.js} +1 -1
- package/dist/{chunk-XHWT4DH2.js → chunk-4PCIZFDR.js} +1 -1
- package/dist/{chunk-TLYGAHZN.js → chunk-54OP3M3K.js} +1 -1
- package/dist/chunk-7H6Q5TNN.js +27 -0
- package/dist/{chunk-PGVUO7GB.js → chunk-AA4TMQOS.js} +3 -3
- package/dist/{chunk-MVUYJAZT.js → chunk-AI6HQ55O.js} +1 -1
- package/dist/chunk-AZO5NPB4.js +1003 -0
- package/dist/{chunk-MYNLN25H.js → chunk-E2D54MVV.js} +2 -2
- package/dist/chunk-KDHXRJIX.js +2 -0
- package/dist/{chunk-UOZMVS4Y.js → chunk-KS7OSQ3Y.js} +9 -9
- package/dist/{chunk-OZMDKNVR.js → chunk-L3U2R7DH.js} +1 -1
- package/dist/{chunk-U6IUYOYS.js → chunk-LCTSBQBJ.js} +1 -1
- package/dist/chunk-MFXG5BWL.js +1 -0
- package/dist/{chunk-MFR4GZSB.js → chunk-N6BJG6AL.js} +8 -8
- package/dist/{chunk-EXXHI5DO.js → chunk-OGXU7QFW.js} +2 -2
- package/dist/{chunk-Z3JO7MDE.js → chunk-PE6MTNFO.js} +4 -4
- package/dist/{chunk-U2SEGSNG.js → chunk-Q7UGGJ5X.js} +1 -1
- package/dist/{chunk-SXRJYJ7M.js → chunk-REXHKIIJ.js} +1 -1
- package/dist/{chunk-ZDCOC4IH.js → chunk-RKR5V4QR.js} +8 -8
- package/dist/{chunk-X5LH3UOJ.js → chunk-TZ2BPFCT.js} +111 -111
- package/dist/{chunk-AYZ4LP2A.js → chunk-VIIBZ6DE.js} +3 -3
- package/dist/{chunk-FIGVDYJR.js → chunk-XJYXKO7K.js} +15 -15
- package/dist/{chunk-CQN5CFKA.js → chunk-YJRC6IKD.js} +4 -4
- package/dist/{chunk-6TDPY7WG.js → chunk-ZOPYAOUP.js} +1 -1
- package/dist/file-intake/index.js +1 -1
- package/dist/i18n/index.d.ts +78 -0
- package/dist/i18n/index.js +2 -0
- package/dist/{index-Dod08dsC.d.ts → index-BS_HzJCc.d.ts} +42 -915
- package/dist/index.d.ts +3 -2
- package/dist/index.js +656 -650
- package/dist/map/index.js +3 -3
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/strings-C3kt6WTH.d.ts +924 -0
- package/dist/ui/index.d.ts +2 -1
- package/dist/ui/index.js +1 -1
- package/package.json +16 -1
- package/dist/Calculator-IAJLLX67.js +0 -29
- package/dist/ConfirmDialog-EBZ5LHVS.js +0 -1
- package/dist/PdfViewer-IIXXT7SF.js +0 -1
- package/dist/chunk-A6ZY4XSQ.js +0 -27
- package/dist/chunk-RN5V7MDO.js +0 -995
- package/dist/chunk-XJX3NA37.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{toast_default as e}from"./chunk-
|
|
1
|
+
import{toast_default as e}from"./chunk-L3U2R7DH.js";import{forwardRef as t,useRef as r,useState as n,useMemo as o,useEffect as i,useImperativeHandle as a}from"react";import{jsx as l,jsxs as s,Fragment as c}from"react/jsx-runtime";var d=["#ef4444","#f97316","#eab308","#22c55e","#3b82f6","#8b5cf6","#000000","#ffffff"],h=[{id:"system",label:"System",css:"-apple-system, system-ui, sans-serif"},{id:"serif",label:"Serif",css:'Georgia, "Times New Roman", serif'},{id:"mono",label:"Mono",css:'ui-monospace, "SF Mono", Menlo, monospace'},{id:"cursive",label:"Cursive",css:'"Brush Script MT", "Comic Sans MS", cursive'}],u=()=>Math.random().toString(36).slice(2,9),p=t(function({src:t,filename:p,onApply:x,onCancel:m},M){const N=r(null),L=r(null),D=r(null),z=r(null),[P,E]=n("select"),[$,I]=n(d[0]),[W,B]=n(4),[R,S]=n(24),[j,A]=n(h[0].id),[T,U]=n(!0),[F,H]=n(!1),[O,Z]=n(!1),[K,V]=n(null),[X,q]=n(null),[G,Y]=n(6),[_,J]=n(12),[Q,ee]=n([]),[te,re]=n(null),[ne,oe]=n(null),[ie,ae]=n(null),[le,se]=n(1),[ce,de]=n(null),[he,ue]=n(null),[pe,ye]=n(null),xe=r(null),[me,ge]=n(!1),we=o(()=>ie?{w:ie.w*le,h:ie.h*le}:null,[ie,le]),fe=we&&ne?we.w/ne.w:1,be=o(()=>Q.find(e=>e.id===te)??null,[Q,te]);i(()=>{"select"===P&&be&&("color"in be&&I(be.color),"stroke"in be&&B(be.stroke),"rect"===be.type&&J(be.radius),"text"===be.type&&(S(be.size),A(be.font),U(be.bold),H(be.italic),Z(be.underline),V(be.borderColor),q(be.background),Y(be.padding)))},[te]),i(()=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>{z.current=r,oe({w:r.naturalWidth,h:r.naturalHeight}),ee([]),re(null)},r.onerror=()=>e.error("Failed to load image"),r.src=t},[t]),i(()=>{if(!ne)return;const e=()=>{const e=N.current;if(!e)return;const t=e.getBoundingClientRect(),r=Math.max(0,t.width-32),n=Math.max(0,t.height-32);if(0===r||0===n)return;const o=ne.w/ne.h;let i=ne.w,a=ne.h;i>r&&(i=r,a=i/o),a>n&&(a=n,i=a*o),ae({w:i,h:a})};e();const t=new ResizeObserver(e);return N.current&&t.observe(N.current),()=>t.disconnect()},[ne]);const ve=o(()=>Q.filter(e=>"mosaic"===e.type),[Q]);i(()=>{const e=z.current,t=L.current;if(!e||!t||!ne)return;t.width=ne.w,t.height=ne.h;const r=t.getContext("2d");r.drawImage(e,0,0);for(const e of ve)C(r,e)},[ne,ve,ie]);const ke=e=>{const t=D.current;if(!t)return{x:0,y:0};const r=t.createSVGPoint();r.x=e.clientX,r.y=e.clientY;const n=t.getScreenCTM();if(!n)return{x:0,y:0};const o=r.matrixTransform(n.inverse());return{x:o.x,y:o.y}},Me=e=>{xe.current=e,ge(!0)};i(()=>{if(!me)return;const e=e=>{const t=xe.current;if(!t)return;const r=ke(e);if("draw"===t.kind)de(f(P,t.start,r,$,W,_));else if("pen"===t.kind){const e=t.points[t.points.length-1];(Math.abs(r.x-e.x)>1||Math.abs(r.y-e.y)>1)&&(t.points.push(r),de({id:"",type:"draw",points:t.points.slice(),color:$,stroke:W}))}else if("crop"===t.kind)ye(k(t.start,r));else if("move"===t.kind){const e=r.x-t.start.x,n=r.y-t.start.y;ee(r=>r.map(r=>r.id===t.id?b(t.original,e,n):r))}else"resize"===t.kind&&ee(e=>e.map(e=>e.id===t.id?function(e,t,r){if("arrow"===e.type)return"start"===t?{...e,x1:r.x,y1:r.y}:"end"===t?{...e,x2:r.x,y2:r.y}:e;if("text"===e.type||"draw"===e.type)return e;const n=e.x,o=e.x+e.w,i=e.y,a=e.y+e.h;let l=n,s=i,c=o,d=a;"nw"===t&&(l=r.x,s=r.y);"ne"===t&&(c=r.x,s=r.y);"se"===t&&(c=r.x,d=r.y);"sw"===t&&(l=r.x,d=r.y);const h=k({x:l,y:s},{x:c,y:d});return{...e,x:h.x,y:h.y,w:h.w,h:h.h}}(t.original,t.corner,r):e))},t=()=>{const e=xe.current;if(xe.current=null,ge(!1),"draw"===e?.kind)de(e=>{if(!e||("arrow"===(t=e).type?Math.abs(t.x2-t.x1)<4&&Math.abs(t.y2-t.y1)<4:"draw"===t.type?t.points.length<2:"w"in t&&"h"in t&&(t.w<4||t.h<4)))return null;var t;const r={...e,id:u()};return ee(e=>[...e,r]),re(r.id),E("select"),null});else if("pen"===e?.kind){if(e.points.length<2)return void de(null);const t={id:u(),type:"draw",points:e.points,color:$,stroke:W};ee(e=>[...e,t]),re(t.id),E("select"),de(null)}};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[me,P,$,W,_]);i(()=>{const e=e=>{if(!document.activeElement||!/^(INPUT|TEXTAREA)$/.test(document.activeElement.tagName))return!e.metaKey&&!e.ctrlKey||"z"!==e.key&&"Z"!==e.key||e.shiftKey?void(te&&("Delete"===e.key||"Backspace"===e.key?(e.preventDefault(),ee(e=>e.filter(e=>e.id!==te)),re(null)):"Escape"===e.key&&re(null))):(e.preventDefault(),ee(e=>e.slice(0,-1)),void re(null))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[te]);const Ce=e=>{const t=!{bold:T,italic:F,underline:O}[e];"bold"===e&&U(t),"italic"===e&&H(t),"underline"===e&&Z(t),te&&ee(r=>r.map(r=>r.id===te&&"text"===r.type?{...r,[e]:t}:r))},Ne=e=>{V(e),te&&ee(t=>t.map(t=>t.id===te&&"text"===t.type?{...t,borderColor:e}:t))},Le=e=>{q(e),te&&ee(t=>t.map(t=>t.id===te&&"text"===t.type?{...t,background:e}:t))},De=e=>{if(!he)return;const t=e??he.value;if(!t.trim())return he.editingId&&ee(e=>e.filter(e=>e.id!==he.editingId)),void ue(null);if(he.editingId)ee(e=>e.map(e=>e.id===he.editingId&&"text"===e.type?{...e,text:t}:e));else{const e={id:u(),type:"text",x:he.x,y:he.y,text:t,color:$,size:R,font:j,bold:T,italic:F,underline:O,borderColor:K,background:X,padding:G};ee(t=>[...t,e]),re(e.id),E("select")}ue(null)},ze=async()=>{const e=L.current,t=D.current;if(!e||!t||!ne)return null;const r=document.createElement("canvas");r.width=ne.w,r.height=ne.h;const n=r.getContext("2d");n.drawImage(e,0,0);const o=t.cloneNode(!0);o.querySelectorAll("[data-chrome]").forEach(e=>e.remove());const i=(new XMLSerializer).serializeToString(o),a=new Blob([i],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(a),s=new Image;return await new Promise(e=>{s.onload=()=>e(),s.onerror=()=>e(),s.src=l}),n.drawImage(s,0,0,ne.w,ne.h),URL.revokeObjectURL(l),r};a(M,()=>({save:async()=>{const t=await ze();t&&t.toBlob(t=>{if(!t)return void e.error("Failed to export");const r=URL.createObjectURL(t),n=document.createElement("a");n.href=r;const o=p.replace(/\.[^.]+$/,"");n.download=`${o}-annotated.png`,n.click(),URL.revokeObjectURL(r)},"image/png")},copy:async()=>{if(!("clipboard"in navigator)||"undefined"==typeof ClipboardItem)return void e.error("Clipboard images not supported in this browser");const t=await ze();t&&t.toBlob(async t=>{if(t)try{await navigator.clipboard.write([new ClipboardItem({"image/png":t})]),e.success("Copied to clipboard")}catch{e.error("Copy failed (clipboard permission?)")}else e.error("Failed to copy")},"image/png")}}),[ne,p]);const Pe=o(()=>[{id:"select",label:"Select / Move",icon:/* @__PURE__ */l("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l7 17 2-7 7-2L5 3z"})})},{id:"draw",label:"Pen / Draw",icon:/* @__PURE__ */l("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L6.832 19.82a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.863 4.487z"})})},{id:"rect",label:"Rectangle",icon:/* @__PURE__ */l("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */l("rect",{x:"4",y:"6",width:"16",height:"12",rx:"3"})})},{id:"circle",label:"Ellipse",icon:/* @__PURE__ */l("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */l("ellipse",{cx:"12",cy:"12",rx:"8",ry:"6"})})},{id:"arrow",label:"Arrow",icon:/* @__PURE__ */l("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 19L19 5m0 0h-7m7 0v7"})})},{id:"mosaic",label:"Mosaic",icon:/* @__PURE__ */l("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z"})})},{id:"text",label:"Text",icon:/* @__PURE__ */l("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M12 6v14M9 20h6"})})},{id:"crop",label:"Crop",icon:/* @__PURE__ */l("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 2v15a1 1 0 001 1h15M2 6h15a1 1 0 011 1v15"})})}],[]),Ee=e=>"p-1.5 rounded transition-colors "+(e?"bg-blue-500 text-white":"text-gray-700 hover:bg-gray-200"),$e=be?.type??("select"===P?null:P),Ie="rect"===$e||"circle"===$e||"arrow"===$e||"draw"===$e,We="rect"===$e,Be="text"===$e;/* @__PURE__ */
|
|
2
2
|
return s("div",{className:"flex flex-col h-full bg-gray-100",children:[
|
|
3
3
|
/* @__PURE__ */s("div",{className:"flex items-center gap-1.5 px-3 py-2 border-b border-gray-200 bg-white shrink-0 flex-wrap text-[12px]",children:[Pe.map(e=>/* @__PURE__ */l("button",{onClick:()=>{E(e.id),re(null)},title:e.label,className:Ee(P===e.id),children:e.icon},e.id)),
|
|
4
4
|
/* @__PURE__ */l("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
|
|
@@ -16,7 +16,7 @@ return s("div",{className:"flex flex-col h-full bg-gray-100",children:[
|
|
|
16
16
|
/* @__PURE__ */l("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
|
|
17
17
|
/* @__PURE__ */l("select",{value:j,onChange:e=>{return t=e.target.value,A(t),void(te&&ee(e=>e.map(e=>e.id===te&&"text"===e.type?{...e,font:t}:e)));var t},className:"text-xs border border-gray-300 rounded px-1 py-0.5 bg-white",children:h.map(e=>/* @__PURE__ */l("option",{value:e.id,children:e.label},e.id))}),
|
|
18
18
|
/* @__PURE__ */l("button",{onClick:()=>Ce("bold"),className:Ee(T),title:"Bold",children:/* @__PURE__ */l("span",{className:"font-bold",children:"B"})}),
|
|
19
|
-
/* @__PURE__ */l("button",{onClick:()=>Ce("italic"),className:Ee(
|
|
19
|
+
/* @__PURE__ */l("button",{onClick:()=>Ce("italic"),className:Ee(F),title:"Italic",children:/* @__PURE__ */l("span",{className:"italic",children:"I"})}),
|
|
20
20
|
/* @__PURE__ */l("button",{onClick:()=>Ce("underline"),className:Ee(O),title:"Underline",children:/* @__PURE__ */l("span",{className:"underline",children:"U"})}),
|
|
21
21
|
/* @__PURE__ */s("label",{className:"flex items-center gap-1.5 text-gray-600",children:[
|
|
22
22
|
/* @__PURE__ */l("span",{children:"Size"}),
|
|
@@ -47,7 +47,7 @@ return s("div",{className:"flex flex-col h-full bg-gray-100",children:[
|
|
|
47
47
|
/* @__PURE__ */l("button",{onClick:async()=>{const t=await ze();t?t.toBlob(t=>{t?x(t):e.error("Failed to export")},"image/png"):e.error("Failed to export")},className:"px-3 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 text-xs font-medium",children:"Apply"})]})]})]}),
|
|
48
48
|
/* @__PURE__ */l("div",{ref:N,className:"flex-1 overflow-auto bg-gray-200 flex items-center justify-center p-4 relative",children:we&&ne&&/* @__PURE__ */s("div",{className:"relative shadow-lg rounded overflow-hidden bg-white shrink-0",style:{width:we.w,height:we.h},children:[
|
|
49
49
|
/* @__PURE__ */l("canvas",{ref:L,style:{position:"absolute",inset:0,width:"100%",height:"100%",display:"block"}}),
|
|
50
|
-
/* @__PURE__ */s("svg",{ref:D,viewBox:`0 0 ${ne.w} ${ne.h}`,preserveAspectRatio:"none",style:{position:"absolute",inset:0,width:"100%",height:"100%",touchAction:"none",cursor:"select"===P?"default":"text"===P?"text":"crosshair"},onPointerDown:e=>{if("select"===P)return void re(null);if("text"===P){if(he)return void De();const t=ke(e);return void ue({x:t.x,y:t.y,value:""})}const t=ke(e);if("crop"!==P){if("draw"===P)return Me({kind:"pen",points:[t]}),void de({id:"",type:"draw",points:[t],color:$,stroke:W});de(f(P,t,t,$,W,_)),Me({kind:"draw",start:t})}else Me({kind:"crop",start:t})},children:[Q.map(e=>/* @__PURE__ */l(y,{anno:e,selected:te===e.id,zoom:le,onPointerDown:t=>((e,t)=>{"select"===P&&(e.stopPropagation(),re(t.id),Me({kind:"move",id:t.id,start:ke(e),original:t}))})(t,e),onDoubleClick:()=>{var t;"text"===(t=e).type&&ue({x:t.x,y:t.y,value:t.text,editingId:t.id})},onHandlePointerDown:(t,r)=>((e,t,r)=>{e.stopPropagation(),Me({kind:"resize",id:t.id,corner:r,start:ke(e),original:t})})(t,e,r)},e.id)),ce&&/* @__PURE__ */l(y,{anno:{...ce,id:"__preview"},preview:!0}),pe&&/* @__PURE__ */l(g,{rect:pe,imageSize:ne})]}),he&&/* @__PURE__ */l(w,{pendingText:he,color:$,size:R,font:h.find(e=>e.id===j)?.css??h[0].css,bold:T,italic:
|
|
50
|
+
/* @__PURE__ */s("svg",{ref:D,viewBox:`0 0 ${ne.w} ${ne.h}`,preserveAspectRatio:"none",style:{position:"absolute",inset:0,width:"100%",height:"100%",touchAction:"none",cursor:"select"===P?"default":"text"===P?"text":"crosshair"},onPointerDown:e=>{if("select"===P)return void re(null);if("text"===P){if(he)return void De();const t=ke(e);return void ue({x:t.x,y:t.y,value:""})}const t=ke(e);if("crop"!==P){if("draw"===P)return Me({kind:"pen",points:[t]}),void de({id:"",type:"draw",points:[t],color:$,stroke:W});de(f(P,t,t,$,W,_)),Me({kind:"draw",start:t})}else Me({kind:"crop",start:t})},children:[Q.map(e=>/* @__PURE__ */l(y,{anno:e,selected:te===e.id,zoom:le,onPointerDown:t=>((e,t)=>{"select"===P&&(e.stopPropagation(),re(t.id),Me({kind:"move",id:t.id,start:ke(e),original:t}))})(t,e),onDoubleClick:()=>{var t;"text"===(t=e).type&&ue({x:t.x,y:t.y,value:t.text,editingId:t.id})},onHandlePointerDown:(t,r)=>((e,t,r)=>{e.stopPropagation(),Me({kind:"resize",id:t.id,corner:r,start:ke(e),original:t})})(t,e,r)},e.id)),ce&&/* @__PURE__ */l(y,{anno:{...ce,id:"__preview"},preview:!0}),pe&&/* @__PURE__ */l(g,{rect:pe,imageSize:ne})]}),he&&/* @__PURE__ */l(w,{pendingText:he,color:$,size:R,font:h.find(e=>e.id===j)?.css??h[0].css,bold:T,italic:F,underline:O,borderColor:K,background:X,padding:G,scale:fe,onChange:e=>ue({...he,value:e}),onCommit:De,onCancel:()=>ue(null)})]})}),
|
|
51
51
|
/* @__PURE__ */l("div",{className:"px-3 py-1.5 border-t border-gray-200 bg-white text-[11px] text-gray-500 shrink-0",children:"select"===P?te?"Drag to move. Drag a corner to resize. Delete / Backspace removes. Click outside to deselect.":"Tap a shape to select. Double-click text to edit.":"text"===P?"Click to drop a text label.":"crop"===P?"Drag a rectangle to set the crop region.":"draw"===P?"Drag to draw freehand.":"Drag on the image to draw."})]})});function y({anno:e,selected:t,preview:r,zoom:n=1,onPointerDown:o,onDoubleClick:i,onHandlePointerDown:a}){const d=v(e),u=o?{onPointerDown:o,pointerEvents:"all",style:{cursor:"move"}}:{},p=i?{onDoubleClick:i}:{};let y;if("rect"===e.type)y=/* @__PURE__ */l("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:e.radius,ry:e.radius,fill:"none",stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round",strokeLinejoin:"round",...u});else if("circle"===e.type)y=/* @__PURE__ */l("ellipse",{cx:e.x+e.w/2,cy:e.y+e.h/2,rx:e.w/2,ry:e.h/2,fill:"none",stroke:e.color,strokeWidth:e.stroke,...u});else if("arrow"===e.type)y=/* @__PURE__ */l(m,{anno:e,interactive:u});else if("draw"===e.type)y=/* @__PURE__ */l("path",{d:M(e.points),fill:"none",stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round",strokeLinejoin:"round",...u});else if("mosaic"===e.type)y=/* @__PURE__ */l("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:"rgba(0,0,0,0.001)",stroke:t?"#3b82f6":"none",strokeWidth:t?2:0,strokeDasharray:t?"6,4":void 0,...u});else{const t=h.find(t=>t.id===e.font)?.css??h[0].css,r=e.padding??0,n=!!e.borderColor||!!e.background,o=v(e),i=e.borderColor?Math.max(1,Math.round(e.size/12)):0;y=/* @__PURE__ */s("g",{...u,...p,children:[n&&/* @__PURE__ */l("rect",{x:o.x-r,y:o.y-r,width:Math.max(0,o.w)+2*r,height:Math.max(0,o.h)+2*r,rx:Math.min(8,r),ry:Math.min(8,r),fill:e.background??"none",stroke:e.borderColor??"none",strokeWidth:i}),
|
|
52
52
|
/* @__PURE__ */l("text",{x:e.x,y:e.y+e.size,fill:e.color,fontSize:e.size,fontWeight:e.bold?700:400,fontStyle:e.italic?"italic":"normal",textDecoration:e.underline?"underline":void 0,fontFamily:t,style:{userSelect:"none"},children:e.text.split("\n").map((t,r)=>/* @__PURE__ */l("tspan",{x:e.x,dy:0===r?0:1.2*e.size,children:t},r))})]})}/* @__PURE__ */
|
|
53
53
|
return s("g",{children:[y,t&&!r&&/* @__PURE__ */s(c,{children:[
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import{useDismissPopupsOnOpen as e}from"./chunk-AFYQTVZO.js";import{registerModalEscapeInterceptor as t,Z_LAYERS as n}from"./chunk-X4FJ54PP.js";import{useShellStrings as r,splitAround as o}from"./chunk-
|
|
1
|
+
import{useDismissPopupsOnOpen as e}from"./chunk-AFYQTVZO.js";import{registerModalEscapeInterceptor as t,Z_LAYERS as n}from"./chunk-X4FJ54PP.js";import{useShellStrings as r,splitAround as o}from"./chunk-3YTHR7IC.js";import{createContext as l,useEffect as i,useRef as a,useId as s,useContext as c,useState as d,useCallback as u}from"react";import{jsxs as m,jsx as f,Fragment as h}from"react/jsx-runtime";var b=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function g(e){return Array.from(e.querySelectorAll(b)).filter(e=>null!==e.offsetParent||e===document.activeElement)}var p=[];function v(e){const t=p.findIndex(t=>t!==e&&e.contains(t));-1===t?p.push(e):p.splice(t,0,e)}function x(e){const t=p.lastIndexOf(e);-1!==t&&p.splice(t,1)}var y=/* @__PURE__ */new WeakSet;function w(e){return g(e)}function N(e,t){i(()=>{if(!t)return;const n=e.current;return n?(y.add(n),v(n),()=>{x(n),y.delete(n)}):void 0},[e,t])}function k(e,t){const n=p.lastIndexOf(t),r=n>0?p[n-1]:-1===n?p[p.length-1]??null:null,o=g(r??e.ownerDocument.body).filter(n=>!t.contains(n)&&!e.contains(n)),l=o.find(t=>0!==(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING));return l||(r&&!y.has(r)?o[0]??null:null)}function C(e,t,n){i(()=>{if(!t)return;const r=e.current;if(!r)return;const o=document.activeElement,l=n?.current??g(r)[0]??r;l!==r||r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),l.focus();const i=e=>{if("Tab"!==e.key)return;if(p[p.length-1]!==r)return;const t=g(r);if(0===t.length)return void e.preventDefault();const n=t[0],o=t[t.length-1],l=document.activeElement;!e.shiftKey||l!==n&&r.contains(l)?e.shiftKey||l!==o&&r.contains(l)||(e.preventDefault(),n.focus()):(e.preventDefault(),o.focus())};return v(r),document.addEventListener("keydown",i,!0),()=>{x(r),document.removeEventListener("keydown",i,!0),(r.contains(document.activeElement)||document.activeElement===document.body)&&o?.focus?.()}},[e,t,n])}var L=0,E=null;function P(e){i(()=>{if(!e)return;const t=document.body;if(0===L){E={overflow:t.style.overflow,paddingRight:t.style.paddingRight};const e=window.innerWidth-document.documentElement.clientWidth;t.style.overflow="hidden",e>0&&(t.style.paddingRight=`${e}px`)}return L+=1,()=>{0===(L-=1)&&E&&(t.style.overflow=E.overflow,t.style.paddingRight=E.paddingRight,E=null)}},[e])}var j={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-4xl"};function T({open:o,onClose:l,title:c,description:d,role:u="dialog",children:h,footer:b,blocking:g=!1,size:p="md",initialFocus:v,"aria-label":x,"aria-labelledby":y,"aria-describedby":w,className:N=""}){const k=a(null),L=s(),E=s(),T=!g&&!b,F=s(),D=r().dialog;return e(o),C(k,o,v),P(o),i(()=>{if(o)return t(()=>(g||l(),!0),()=>k.current)},[o,g,l]),o?/* @__PURE__ */m("div",{className:"fixed inset-0",style:{zIndex:n.overlay},role:"presentation",children:[
|
|
2
2
|
/* @__PURE__ */f("div",{className:"fixed inset-0 bg-black/30","aria-hidden":"true"}),
|
|
3
|
-
/* @__PURE__ */f("div",{className:"fixed inset-0 flex items-center justify-center p-4",onClick:g?void 0:e=>{e.target===e.currentTarget&&l()},children:/* @__PURE__ */m("div",{ref:k,role:u,"aria-modal":"true","aria-labelledby":c?
|
|
4
|
-
return f("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:/* @__PURE__ */f("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})})}function
|
|
5
|
-
return f("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:/* @__PURE__ */f("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}function
|
|
6
|
-
return m(
|
|
7
|
-
/* @__PURE__ */f(
|
|
3
|
+
/* @__PURE__ */f("div",{className:"fixed inset-0 flex items-center justify-center p-4",onClick:g?void 0:e=>{e.target===e.currentTarget&&l()},children:/* @__PURE__ */m("div",{ref:k,role:u,"aria-modal":"true","aria-labelledby":c?F:y,"aria-label":c||y?void 0:x,"aria-describedby":w??(d?E:h?L:void 0),className:`relative max-h-full w-full ${j[p]} overflow-y-auto overscroll-contain rounded-(--radius-card) bg-white p-6 shadow-xl ${N}`.trim(),children:[c&&/* @__PURE__ */f("h2",{id:F,className:(T?"pr-8 ":"")+"text-base font-semibold text-gray-900",children:c}),d&&/* @__PURE__ */f("p",{id:E,className:((c?"mt-1":T?"pr-8":"")+" text-sm text-gray-500").trim(),children:d}),h&&/* @__PURE__ */f("div",{id:L,className:"mt-2 text-sm text-gray-600",children:h}),b&&/* @__PURE__ */f("div",{className:"mt-6 flex flex-wrap justify-end gap-3",children:b}),T&&/* @__PURE__ */f("button",{type:"button",onClick:l,"aria-label":D.close,className:"absolute right-3 top-3 rounded-(--radius-control) p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */f("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:/* @__PURE__ */f("path",{d:"M6 6l8 8M14 6l-8 8"})})})]})})]}):null}var F=l(()=>Promise.resolve(!1)),D=()=>c(F),I=()=>Promise.resolve(!1),O=e=>I(e),W=()=>Promise.resolve(!1),M=e=>W(e),$=()=>Promise.resolve(null),R=e=>$(e),A={danger:{icon:"text-red-600 bg-red-100",button:"bg-red-600 hover:bg-red-700 text-white"},warning:{icon:"text-yellow-600 bg-yellow-100",button:"bg-yellow-600 hover:bg-yellow-700 text-white"},info:{icon:"text-blue-600 bg-blue-100",button:"bg-blue-600 hover:bg-blue-700 text-white"}},z="bg-white text-gray-700 border border-gray-300 px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-50";function K(){/* @__PURE__ */
|
|
4
|
+
return f("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:/* @__PURE__ */f("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})})}function B(){/* @__PURE__ */
|
|
5
|
+
return f("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:/* @__PURE__ */f("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}function S({children:e}){const[t,n]=d(!1),[l,s]=d({message:""}),[c,b]=d(0),g=a(),p=a(null),v=a(0),x=a([]),y=a(null),w=a(null),N=u(e=>{p.current=e.id,g.current=e.resolve,b(e.id),s(e.options),n(!0)},[]),k=u(e=>{const t="string"==typeof e?{message:e}:e;return new Promise(e=>{const n={id:++v.current,options:t,resolve:e};null===p.current?N(n):x.current.push(n)})},[N]),[C,L]=d(!1),[E,P]=d({message:""}),[j,D]=d(""),O=a(),M=u(e=>(P(e),D(""),L(!0),new Promise(e=>{O.current=e})),[]),[R,S]=d(!1),[H,V]=d({}),[Y,_]=d(""),q=a(),G=u(e=>{const t="string"==typeof e?{message:e}:e;return V(t),_(t.defaultValue??""),S(!0),new Promise(e=>{q.current=e})},[]);i(()=>{I=k,W=M,$=G},[k,M,G]);const J=(e,t)=>{if(p.current!==e)return;const r=g.current,o=x.current.shift();o?N(o):(p.current=null,g.current=void 0,n(!1)),r?.(t)},Q=e=>{L(!1),D(""),O.current?.(e)},U=e=>{if(e){const e=Y.trim();if(!e&&!H.allowEmpty)return S(!1),void q.current?.(null);S(!1),q.current?.(e)}else S(!1),q.current?.(null)},X=l.variant||(l.confirmLabel?.toLowerCase().includes("delete")||l.message.toLowerCase().includes("delete")?"danger":"info"),Z=A[X],ee=A["warning"===E.variant?"warning":"danger"],te=E.confirmWord,ne=null==te||j===te,re=r().dialog,[oe,le]=o(re.typeToConfirm);/* @__PURE__ */
|
|
6
|
+
return m(F.Provider,{value:k,children:[e,
|
|
7
|
+
/* @__PURE__ */f(T,{open:t,onClose:()=>J(c,!1),initialFocus:y,footer:/* @__PURE__ */m(h,{children:[
|
|
8
8
|
/* @__PURE__ */f("button",{ref:y,type:"button",onClick:()=>J(c,!1),className:z,children:l.cancelLabel||re.cancel}),
|
|
9
9
|
/* @__PURE__ */f("button",{type:"button",onClick:()=>J(c,!0),className:`px-4 py-2 text-sm font-medium rounded-lg ${Z.button}`,children:l.confirmLabel||re.ok})]}),children:/* @__PURE__ */m("div",{className:"flex gap-4",children:[
|
|
10
10
|
/* @__PURE__ */f("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${Z.icon}`,children:/* @__PURE__ */f(K,{})}),
|
|
11
11
|
/* @__PURE__ */m("div",{className:"flex-1",children:[
|
|
12
12
|
/* @__PURE__ */f("h2",{className:"text-base font-semibold text-gray-900",children:l.title||re.confirmTitle}),
|
|
13
13
|
/* @__PURE__ */f("p",{className:"mt-2 text-sm text-gray-600",children:l.message})]})]})}),
|
|
14
|
-
/* @__PURE__ */m(
|
|
15
|
-
/* @__PURE__ */f("button",{ref:w,type:"button",onClick:()=>
|
|
16
|
-
/* @__PURE__ */f("button",{type:"button",onClick:()=>
|
|
17
|
-
/* @__PURE__ */f("button",{type:"button",onClick:()=>
|
|
14
|
+
/* @__PURE__ */m(T,{open:C,onClose:()=>Q(!1),initialFocus:null!=te?void 0:w,footer:/* @__PURE__ */m(h,{children:[
|
|
15
|
+
/* @__PURE__ */f("button",{ref:w,type:"button",onClick:()=>Q(!1),className:z,children:E.cancelLabel||re.destructiveCancel}),
|
|
16
|
+
/* @__PURE__ */f("button",{type:"button",onClick:()=>Q(!0),disabled:!ne,className:`px-4 py-2 text-sm font-medium rounded-lg disabled:opacity-40 ${ee.button}`,children:te??E.confirmLabel??re.destructiveConfirm})]}),children:[
|
|
17
|
+
/* @__PURE__ */f("button",{type:"button",onClick:()=>Q(!1),"aria-label":re.close,className:"absolute right-4 top-4 rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:/* @__PURE__ */f(B,{})}),
|
|
18
18
|
/* @__PURE__ */m("div",{className:"flex gap-4",children:[
|
|
19
19
|
/* @__PURE__ */f("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${ee.icon}`,children:/* @__PURE__ */f(K,{})}),
|
|
20
20
|
/* @__PURE__ */m("div",{className:"flex-1",children:[
|
|
@@ -22,8 +22,8 @@ return m(T.Provider,{value:k,children:[e,
|
|
|
22
22
|
/* @__PURE__ */f("p",{className:"mt-2 text-sm text-gray-600",children:E.message}),null!=te&&/* @__PURE__ */m(h,{children:[
|
|
23
23
|
/* @__PURE__ */m("p",{className:"mt-3 text-sm text-gray-700",children:[oe,
|
|
24
24
|
/* @__PURE__ */f("kbd",{className:"rounded border border-gray-300 bg-gray-50 px-1.5 py-0.5 text-xs font-bold text-red-600 font-mono",children:te}),le]}),
|
|
25
|
-
/* @__PURE__ */f("input",{autoFocus:!0,type:"text",value:j,onChange:e=>D(e.target.value),onKeyDown:e=>{"Enter"===e.key&&j===te&&
|
|
26
|
-
/* @__PURE__ */m(
|
|
27
|
-
/* @__PURE__ */f("button",{type:"button",onClick:()=>
|
|
28
|
-
/* @__PURE__ */f("button",{type:"button",onClick:()=>
|
|
29
|
-
/* @__PURE__ */f("input",{autoFocus:!0,type:"text",value:
|
|
25
|
+
/* @__PURE__ */f("input",{autoFocus:!0,type:"text",value:j,onChange:e=>D(e.target.value),onKeyDown:e=>{"Enter"===e.key&&j===te&&Q(!0)},placeholder:te,className:"mt-2 w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-red-500"})]})]})]})]}),
|
|
26
|
+
/* @__PURE__ */m(T,{open:R,onClose:()=>U(!1),title:H.title||re.promptTitle,footer:/* @__PURE__ */m(h,{children:[
|
|
27
|
+
/* @__PURE__ */f("button",{type:"button",onClick:()=>U(!1),className:z,children:H.cancelLabel||re.cancel}),
|
|
28
|
+
/* @__PURE__ */f("button",{type:"button",onClick:()=>U(!0),disabled:!H.allowEmpty&&!Y.trim(),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg disabled:opacity-40",children:H.confirmLabel||re.ok})]}),children:[H.message&&/* @__PURE__ */f("p",{className:"text-sm text-gray-600",children:H.message}),
|
|
29
|
+
/* @__PURE__ */f("input",{autoFocus:!0,type:"text",value:Y,onChange:e=>_(e.target.value),onKeyDown:e=>{"Enter"===e.key?U(!0):"Escape"===e.key&&U(!1)},onFocus:e=>e.target.select(),placeholder:H.placeholder,className:"mt-3 w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]"})]})]})}export{S as ConfirmProvider,T as Dialog,O as confirm,M as confirmDestructive,w as focusableIn,R as prompt,k as stopAfter,D as useConfirm,C as useFocusTrap,P as useScrollLock,N as useTabLayer};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useHydrated as e,useBrowserState as t}from"./chunk-D65T4H6J.js";import{useShellStrings as r}from"./chunk-
|
|
1
|
+
import{useHydrated as e,useBrowserState as t}from"./chunk-D65T4H6J.js";import{useShellStrings as r}from"./chunk-3YTHR7IC.js";import{createContext as n,useSyncExternalStore as o,useCallback as i,useContext as a,useMemo as s}from"react";import{jsxs as l,jsx as c}from"react/jsx-runtime";var d="(max-width: 767px), (pointer: coarse)";function u(){return!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia(d).matches}function f(){return!1}function m(e){if("undefined"==typeof window||!window.matchMedia)return()=>{};const t=window.matchMedia(d);return t.addEventListener?(t.addEventListener("change",e),()=>t.removeEventListener("change",e)):(t.addListener(e),()=>t.removeListener(e))}function h(){return o(m,u,f)}var w={success:"success",error:"error",warning:"warning",info:"info",404:"info",403:"warning",500:"error"},p={success:"text-green-600 bg-green-100",error:"text-red-600 bg-red-100",warning:"text-amber-600 bg-amber-100",info:"text-blue-600 bg-blue-100"},g={404:e=>e.notFound,403:e=>e.noAccess,500:e=>e.serverError};function v({tone:e}){const t={className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":!0};switch(e){case"success":/* @__PURE__ */
|
|
2
2
|
return c("svg",{...t,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});case"error":/* @__PURE__ */
|
|
3
3
|
return c("svg",{...t,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})});case"warning":/* @__PURE__ */
|
|
4
4
|
return c("svg",{...t,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"})});default:/* @__PURE__ */
|
|
@@ -6,6 +6,6 @@ return c("svg",{...t,children:/* @__PURE__ */c("path",{strokeLinecap:"round",str
|
|
|
6
6
|
return l("div",{role:"error"===d?"alert":void 0,className:`flex flex-col items-center justify-center px-6 py-12 text-center ${s}`.trim(),children:[
|
|
7
7
|
/* @__PURE__ */c("div",{className:`flex h-14 w-14 items-center justify-center rounded-full ${p[d]}`,children:i??/* @__PURE__ */c(v,{tone:d})}),
|
|
8
8
|
/* @__PURE__ */c("h2",{className:"mt-4 text-lg font-semibold text-gray-900",children:t??g[e]?.(u)??""}),n&&/* @__PURE__ */c("p",{className:"mt-1 max-w-md text-sm text-gray-500",children:n}),a&&/* @__PURE__ */c("div",{className:"mt-4 w-full max-w-md text-left",children:a}),o&&/* @__PURE__ */c("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:o})]})}function x({size:e="md",padding:t="py-12",label:r,className:n=""}){const o=/* @__PURE__ */c("div",{className:`${"sm"===e?"h-5 w-5":"lg"===e?"h-12 w-12":"h-8 w-8"} animate-spin rounded-full border-2 border-gray-200 border-t-blue-600`});return null==r?/* @__PURE__ */c("div",{className:`flex items-center justify-center ${t} ${n}`,children:o}):/* @__PURE__ */l("div",{role:"status",className:`flex flex-col items-center justify-center gap-3 ${t} ${n}`,children:[o,
|
|
9
|
-
/* @__PURE__ */c("p",{className:"text-sm text-gray-500",children:r})]})}var L="undefined"!=typeof window&&"undefined"!=typeof navigator&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),M={MOD:["⌘","Ctrl"],ALT:["⌥","Alt"],CMD_ENTER:["⌘⏎","Ctrl⏎"],CMD_S:["⌘S","Ctrl+S"],CMD_K:["⌘K","Ctrl+K"],CMD_DOT:["⌘.","Ctrl+."],CMD_A:["⌘A","Ctrl+A"],CMD_Z:["⌘Z","Ctrl+Z"],CMD_SHIFT_Z:["⌘⇧Z","Ctrl+Shift+Z"],ALT_SHIFT_D:["⌥⇧D","Alt+Shift+D"],ALT_SHIFT_E:["⌥⇧E","Alt+Shift+E"],ALT_SHIFT_N:["⌥⇧N","Alt+Shift+N"]},_=L?0:1,
|
|
10
|
-
return c("kbd",{className:[P,$[t],r].filter(Boolean).join(" "),children:n})}var
|
|
11
|
-
return c(
|
|
9
|
+
/* @__PURE__ */c("p",{className:"text-sm text-gray-500",children:r})]})}var L="undefined"!=typeof window&&"undefined"!=typeof navigator&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),M={MOD:["⌘","Ctrl"],ALT:["⌥","Alt"],CMD_ENTER:["⌘⏎","Ctrl⏎"],CMD_S:["⌘S","Ctrl+S"],CMD_K:["⌘K","Ctrl+K"],CMD_DOT:["⌘.","Ctrl+."],CMD_A:["⌘A","Ctrl+A"],CMD_Z:["⌘Z","Ctrl+Z"],CMD_SHIFT_Z:["⌘⇧Z","Ctrl+Shift+Z"],ALT_SHIFT_D:["⌥⇧D","Alt+Shift+D"],ALT_SHIFT_E:["⌥⇧E","Alt+Shift+E"],ALT_SHIFT_N:["⌥⇧N","Alt+Shift+N"]},_=L?0:1,C=M.MOD[_],b=M.ALT[_],N="⇧",S="⏎",D=M.CMD_ENTER[_],E=M.CMD_S[_],T=M.CMD_K[_],k=M.CMD_DOT[_],A=M.CMD_A[_],j=M.CMD_Z[_],H=M.CMD_SHIFT_Z[_],I=M.ALT_SHIFT_D[_],F=M.ALT_SHIFT_E[_],z=M.ALT_SHIFT_N[_],Z=new Map(L?Object.values(M).map(([e,t])=>[e,t]):[]);function O(t){return e()?t:Z.get(t)??t}var P="inline-flex items-center justify-center rounded border border-gray-200 bg-gray-50 font-medium text-gray-500",$={sm:"px-1 py-0.5 text-[10px]",md:"px-1.5 py-0.5 text-[11px]"};function R({keys:e,size:t="md",className:r=""}){const n=O(e);/* @__PURE__ */
|
|
10
|
+
return c("kbd",{className:[P,$[t],r].filter(Boolean).join(" "),children:n})}var K=n(null);function J({value:e,children:t}){/* @__PURE__ */
|
|
11
|
+
return c(K.Provider,{value:e,children:t})}function U(e="react-os-shell:prefs",r){const[n,o]=t(()=>{try{const t=JSON.parse(localStorage.getItem(e)||"{}");return{...r??{},...t}}catch{return{...r??{}}}},{...r??{}});return{prefs:n,save:i(t=>{o(r=>{const n={...r,...t};try{localStorage.setItem(e,JSON.stringify(n))}catch{}return n})},[e])}}var B={prefs:{},save:()=>{}};function W(){return a(K)??B}function V(){const{prefs:e,save:t}=W(),r=i(e=>{const r=t(e);return r&&"function"==typeof r.then?r.catch(()=>{}):r},[t]);return s(()=>({prefs:e,save:r}),[e,r])}var Y="react-os-shell:stale-chunk-reload-at",q=3e4,G="vite:preloadError",Q="/_next/static/",X=/Failed to fetch dynamically imported module|error loading dynamically imported module|Importing a module script failed|Unable to preload CSS/i;function ee(e){if(e instanceof Error&&"ChunkLoadError"===e.name)return!0;const t=e instanceof Error?e.message:"string"==typeof e?e:"";return X.test(t)}function te(e={}){if("undefined"==typeof window)return()=>{};const t=e.cooldownMs??3e4,r=e.reload??(()=>window.location.reload()),n=e.now??Date.now,o=void 0===e.storage?function(){try{const e=window.sessionStorage;return e.getItem(Y),e}catch{return null}}():e.storage,i=void 0===e.chunkPathPrefix?Q:e.chunkPathPrefix,a=e=>{const r=n(),i=function(e){if(!e)return null;try{const t=e.getItem(Y),r=null===t?NaN:Number(t);return Number.isFinite(r)?r:null}catch{return null}}(o);return null!==i&&r-i<t?(console.error("[efficient-shell] a lazy chunk is still missing after a reload; letting the failure through:",e),!1):(function(e,t){if(e)try{e.setItem(Y,String(t))}catch{}}(o,r),console.warn("[efficient-shell] a lazy chunk is no longer on the server (new deploy?); reloading onto the current build:",e),!0)},s=e=>{const t=e.payload;ee(t)&&a(t)&&(e.preventDefault(),r())};let l=!0,c=!1;const d=/* @__PURE__ */new Set,u=null===i?null:e=>{const t=function(e,t){const r=e.target;let n="";if(r instanceof window.HTMLScriptElement?n=r.src:r instanceof window.HTMLLinkElement&&function(e){const t=e.rel.toLowerCase().split(/\s+/);if(t.includes("stylesheet")||t.includes("modulepreload"))return!0;const r=(e.getAttribute("as")??"").toLowerCase();return t.includes("preload")&&("script"===r||"style"===r)}(r)?n=r.href:e instanceof window.ErrorEvent&&"SyntaxError"===e.error?.name&&(n=e.filename),!n)return null;try{const e=new URL(t,window.location.origin).href,r=new URL(n,window.location.href).href;return r.startsWith(e)?r:null}catch{return null}}(e,i);!t||c||d.has(t)||(d.add(t),async function(e){try{const t=await fetch(e,{method:"HEAD",cache:"no-store"});return 404===t.status||410===t.status||t.ok&&/\btext\/html\b/i.test(t.headers.get("content-type")??"")}catch{return!1}}(t).then(e=>{d.delete(t),e&&l&&!c&&a(t)&&(c=!0,r())}))};return window.addEventListener(G,s),u&&window.addEventListener("error",u,!0),()=>{l=!1,window.removeEventListener(G,s),u&&window.removeEventListener("error",u,!0)}}export{b as ALT,I as ALT_SHIFT_D,F as ALT_SHIFT_E,z as ALT_SHIFT_N,A as CMD_A,k as CMD_DOT,D as CMD_ENTER,T as CMD_K,E as CMD_S,H as CMD_SHIFT_Z,j as CMD_Z,S as ENTER,R as Kbd,x as LoadingSpinner,C as MOD,Q as NEXT_CHUNK_PATH_PREFIX,y as Result,N as SHIFT,q as STALE_CHUNK_RELOAD_COOLDOWN_MS,Y as STALE_CHUNK_RELOAD_KEY,J as ShellPrefsProvider,G as VITE_PRELOAD_ERROR_EVENT,te as installStaleChunkReload,L as isMac,ee as isStaleChunkError,h as useIsMobile,U as useLocalStoragePrefs,V as useShellPrefs,W as useShellPrefsAdapter,O as useShortcutLabel};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{useShellStrings as e}from"./chunk-
|
|
1
|
+
import{useShellStrings as e}from"./chunk-3YTHR7IC.js";import{useState as r,useRef as o,useEffect as t,useCallback as n}from"react";import{jsx as i}from"react/jsx-runtime";function a(e){const[i,a]=r(!1),c=o(void 0);t(()=>()=>clearTimeout(c.current),[]);return{copied:i,copy:n(r=>{r?.stopPropagation(),navigator.clipboard?.writeText(e).then(()=>{a(!0),clearTimeout(c.current),c.current=setTimeout(()=>a(!1),1500)},()=>{})},[e])}}function c({copied:e,className:r="w-4 h-4"}){/* @__PURE__ */
|
|
2
2
|
return i("svg",e?{className:`${r} text-green-600`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:/* @__PURE__ */i("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}:{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:/* @__PURE__ */i("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}function s({text:r}){const{copied:o,copy:t}=a(r),n=e().copy;/* @__PURE__ */
|
|
3
3
|
return i("button",{onClick:t,title:o?n.copiedValue:n.copyValue(r),className:"shrink-0 text-gray-400 hover:text-gray-600 transition-colors",children:/* @__PURE__ */i(c,{copied:o})})}export{s as CopyButton,c as CopyGlyph,a as useCopyText};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export{FileIntakeAlert,acceptsFile,useFileIntake}from"../chunk-
|
|
2
|
+
export{FileIntakeAlert,acceptsFile,useFileIntake}from"../chunk-REXHKIIJ.js";import"../chunk-3YTHR7IC.js";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ResourceLanguage, i18n, TFunction } from 'i18next';
|
|
2
|
+
import { S as ShellStringsOverride } from '../strings-C3kt6WTH.js';
|
|
3
|
+
import 'react/jsx-runtime';
|
|
4
|
+
import 'react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* efficient-shell/i18n — a host's own copy, in the language the shell is in.
|
|
8
|
+
*
|
|
9
|
+
* The shell's strings live in its typed catalog (`strings.tsx`) and the shell
|
|
10
|
+
* decides which language is active (`language.tsx`). Neither holds a HOST's
|
|
11
|
+
* copy: its column headings, its page titles, its toasts. That copy goes
|
|
12
|
+
* through i18next, and this entry is the one place it is set up, so every
|
|
13
|
+
* portal initialises it the same way and one language drives both halves.
|
|
14
|
+
*
|
|
15
|
+
* `i18next` and `react-i18next` are optional peers of this entry alone. A host
|
|
16
|
+
* that offers one language never installs them, and nothing reachable from
|
|
17
|
+
* `efficient-shell` or `efficient-shell/ui` imports them
|
|
18
|
+
* (`scripts/verify-dist.mjs`).
|
|
19
|
+
*
|
|
20
|
+
* ── The order a host boots in ──
|
|
21
|
+
* A language is fixed for the life of a page (see `language.tsx`), so:
|
|
22
|
+
*
|
|
23
|
+
* 1. `createShellI18n({ copy, load })` at module scope. It initialises
|
|
24
|
+
* SYNCHRONOUSLY with the source-language copy, so `t` already answers in
|
|
25
|
+
* English: a unit test that imports a column set gets English with no
|
|
26
|
+
* setup at all.
|
|
27
|
+
* 2. Before the app is imported, `await activate(resolveShellLanguage(…))`.
|
|
28
|
+
* It loads that language's copy and the shell's catalog for it together
|
|
29
|
+
* and switches `t` over.
|
|
30
|
+
* 3. Only then import the app, and hand `activation.strings` to
|
|
31
|
+
* `ShellLanguageProvider`.
|
|
32
|
+
*
|
|
33
|
+
* The order matters because a host's column sets, navigation and status
|
|
34
|
+
* buckets are module-level constants: they call `t` when they are IMPORTED and
|
|
35
|
+
* keep what it said. Copy read before step 2 stays in the source language for
|
|
36
|
+
* the life of the page, silently. `activate` says so out loud when it happens.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
interface CreateShellI18nOptions {
|
|
40
|
+
/** The source language's copy, bundled with the app: namespace → messages. */
|
|
41
|
+
copy: ResourceLanguage;
|
|
42
|
+
/** Another language's copy, in the same shape. Usually a dynamic import per
|
|
43
|
+
* language, so a reader downloads only their own. */
|
|
44
|
+
load: (language: string) => Promise<ResourceLanguage>;
|
|
45
|
+
/** The shell's own catalog for a language — `efficient-shell/locales/<tag>`.
|
|
46
|
+
* Omitted, or resolving to `undefined`, the shell's own words stay in the
|
|
47
|
+
* source language. */
|
|
48
|
+
loadShellStrings?: (language: string) => Promise<ShellStringsOverride | undefined>;
|
|
49
|
+
/** The language `copy` is written in. Defaults to `en`. */
|
|
50
|
+
source?: string;
|
|
51
|
+
/** The namespace `t('key')` reads when it names none. Defaults to `common`. */
|
|
52
|
+
defaultNamespace?: string;
|
|
53
|
+
}
|
|
54
|
+
interface ShellI18nActivation {
|
|
55
|
+
/** The language actually in force: the one asked for, or the source
|
|
56
|
+
* language when its copy could not be loaded. */
|
|
57
|
+
language: string;
|
|
58
|
+
/** The shell's catalog for it, for `ShellLanguageProvider`'s `strings`. */
|
|
59
|
+
strings?: ShellStringsOverride;
|
|
60
|
+
/** The requested language's copy could not be loaded, and the page is in the
|
|
61
|
+
* source language instead. */
|
|
62
|
+
failed: boolean;
|
|
63
|
+
}
|
|
64
|
+
interface ShellI18n {
|
|
65
|
+
/** The i18next instance, for anything this entry does not wrap. It is also
|
|
66
|
+
* the instance `react-i18next`'s `useTranslation` reads. */
|
|
67
|
+
i18n: i18n;
|
|
68
|
+
/** Read copy by key, anywhere: a module-level constant, a utility, a
|
|
69
|
+
* component. Typed by the host's `CustomTypeOptions`, like i18next's own. */
|
|
70
|
+
t: TFunction;
|
|
71
|
+
/** Load a language's copy and switch to it. Call once, before the app is
|
|
72
|
+
* imported. Never rejects: a language that cannot be loaded leaves the
|
|
73
|
+
* page in the source language, with `failed` set. */
|
|
74
|
+
activate: (language: string) => Promise<ShellI18nActivation>;
|
|
75
|
+
}
|
|
76
|
+
declare function createShellI18n({ copy, load, loadShellStrings, source, defaultNamespace, }: CreateShellI18nOptions): ShellI18n;
|
|
77
|
+
|
|
78
|
+
export { type CreateShellI18nOptions, type ShellI18n, type ShellI18nActivation, createShellI18n };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import e from"i18next";import{initReactI18next as t}from"react-i18next";function a({copy:a,load:n,loadShellStrings:o,source:r="en",defaultNamespace:i="common"}){const s=e.createInstance();s.use(t).init({lng:r,fallbackLng:r,resources:{[r]:a},ns:Object.keys(a),defaultNS:i,initAsync:!1,interpolation:{escapeValue:!1}});let l=!1,c=!1;return{i18n:s,t:(...e)=>(c||(l=!0),s.t(...e)),activate:async e=>{if(c=!0,e===r)return{language:r,failed:!1};l&&console.error(`[efficient-shell/i18n] copy was read before activate("${e}") ran, so those strings stay in "${r}" for the life of this page. Import the app only after activate() resolves.`);try{const[t,a]=await Promise.all([n(e),o?.(e)]);for(const[a,n]of Object.entries(t))s.addResourceBundle(e,a,n,!0,!0);return await s.changeLanguage(e),{language:e,strings:a,failed:!1}}catch(t){return console.error(`[efficient-shell/i18n] could not load "${e}"; staying in "${r}".`,t),{language:r,failed:!0}}}}}export{a as createShellI18n};
|