efficient-shell 7.15.0 → 7.18.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 +31 -4
- package/dist/{Browser-TY2VZH2X.js → Browser-AYWOX66T.js} +14 -14
- package/dist/{Documents-3OCSP6EI.js → Documents-AOXBUBLH.js} +1 -1
- package/dist/{Files-2ML2ONQW.js → Files-EWRVA6X3.js} +5 -5
- package/dist/{Notepad-UPPR4LGW.js → Notepad-NAWSBQ4K.js} +10 -10
- package/dist/{Preview-YL4OOSQ7.js → Preview-NQKURFIP.js} +9 -9
- package/dist/{Spreadsheet-Z35J3CNK.js → Spreadsheet-OJ4TDOP2.js} +13 -13
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/{chunk-T6OOVACA.js → chunk-CWKX752E.js} +810 -809
- package/dist/{chunk-Q4NFFLKG.js → chunk-EJ54JN6S.js} +2 -2
- package/dist/chunk-F5XBJE54.js +1 -0
- package/dist/{chunk-OUV3RGNI.js → chunk-LUNVJKAH.js} +1 -1
- package/dist/icons/efficient.d.ts +1 -1
- package/dist/icons/efficient.js +1 -1
- package/dist/{index-Cze2KSbJ.d.ts → index-Bup5fPMO.d.ts} +4 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +65 -65
- package/dist/telemetry/index.js +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-5ZKJETD6.js +0 -1
package/README.md
CHANGED
|
@@ -615,6 +615,27 @@ writes `null`. Without `emptyLabel`, an emptied box goes back to the value.
|
|
|
615
615
|
`valueText` sets what the range announces, and `showInput={false}` draws the
|
|
616
616
|
range alone.
|
|
617
617
|
|
|
618
|
+
The typed box is as wide as what the slider can show, and no wider: the
|
|
619
|
+
widest of its `min` and `max` with the step's decimals, the number it holds
|
|
620
|
+
(a typed one may go past the range), and its `emptyLabel` or
|
|
621
|
+
`placeholderValue`, plus the unit. The width is counted in `ch` in the box's
|
|
622
|
+
own font, so it follows the font the machine has, and the box's borders and
|
|
623
|
+
padding are read from the field. A 0–1 slider gets a narrow box, 0–10000
|
|
624
|
+
still fits, and "100" never shows as "10".
|
|
625
|
+
|
|
626
|
+
`SliderGroup` lines a stack of sliders up: wrap the rows of one settings
|
|
627
|
+
group in it, and every box takes the widest width any of them needs, so
|
|
628
|
+
every range ends at the same x. Each slider still works its own width out;
|
|
629
|
+
the group gives every member the largest, as a CSS `max()` of the members'
|
|
630
|
+
widths. A slider outside a group keeps its own width.
|
|
631
|
+
|
|
632
|
+
```tsx
|
|
633
|
+
<SliderGroup>
|
|
634
|
+
<Slider label="Size" … suffix="px" size="sm" />
|
|
635
|
+
<Slider label="Letter spacing" … step={0.1} suffix="px" size="sm" />
|
|
636
|
+
</SliderGroup>
|
|
637
|
+
```
|
|
638
|
+
|
|
618
639
|
`placeholderValue` is the number a `null` value follows, such as the style's
|
|
619
640
|
16. The range rests on it, the box shows it greyed (unless `emptyLabel` names
|
|
620
641
|
the empty value), and the value may be `null`. It is never written: Escape and
|
|
@@ -726,10 +747,15 @@ section of the strings catalogue; `placeholder` sets the address box's text.
|
|
|
726
747
|
|
|
727
748
|
**`CornersInput`** is the Corners row of a settings panel: the radius in a
|
|
728
749
|
number box (`InputNumber`, an "R" before the number and px after it, compact
|
|
729
|
-
steppers), then four corner buttons
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
750
|
+
steppers), then the four corner buttons beside it as a 2×2 that mirrors the
|
|
751
|
+
box: top left and top right on the first line, bottom left and bottom right
|
|
752
|
+
on the second, whatever order the host passes them in. The buttons are 24px
|
|
753
|
+
with a 4px gap, so the grid is 52px square and the box is centred on it. The
|
|
754
|
+
grid is one tab stop, and the arrow keys move between the four in two
|
|
755
|
+
directions. The box is its natural 120px at every width (room for "R", four
|
|
756
|
+
digits, "px" and the steppers), never stretched across the row; the grid
|
|
757
|
+
sits beside it whenever the row has 180px (every panel from 220px up) and
|
|
758
|
+
wraps under it below that. The four are a SET (`role="group"` of `aria-pressed` `IconButton`s):
|
|
733
759
|
any number may be on, and a press toggles one. Each draws the `corner` glyph
|
|
734
760
|
turned to its corner (`tl` · `tr` · `br` · `bl`) and shows its name in a
|
|
735
761
|
`Tooltip`. Not the theme's `Corners` type, which is the portal-wide corner style.
|
|
@@ -3935,6 +3961,7 @@ itself where the kit has an answer:
|
|
|
3935
3961
|
| `kit-dep` | one of those packages declared in `package.json` (not `devDependencies`, and not one the shell needs from an entry the repository imports: `@headlessui/react` and `@heroicons/react` for the root entry, an icon set's own package) | remove it |
|
|
3936
3962
|
| `chart` | an import of a second chart library: `recharts`, `chart.js`, `react-chartjs-2`, `d3` and every `d3-*` module (one imported only for its maths too), `@nivo/*`, `victory` and `victory-*`, `echarts`, `echarts-for-react`, `apexcharts`, `react-apexcharts`, `@visx/*`, `highcharts`, `highcharts-react-official`, `plotly.js`, `plotly.js-dist`, `react-plotly.js`, `lightweight-charts`, `@antv/g2`, `@antv/g2plot`, `chartist`, `billboard.js`, `c3`, `uplot`. A name counts with its subpaths (`chart.js/auto`); a name that only contains one (`react-d3-tree`) does not. Read after `kit` and `icon`, so `@mui/x-charts` stays a `kit` | a chart from `efficient-shell/ui`: `ChartFrame`, `TimeSeriesChart`, `ColumnChart`, `RankedBars`, `PieChart`, `FunnelChart`, `ScatterChart`, …; the one chart system (harness FT-3) |
|
|
3937
3963
|
| `chart-dep` | one of those chart libraries declared in `package.json`, whether or not anything imports it (not `devDependencies`) | remove it |
|
|
3964
|
+
| `ellipsis-label` | a button, link or menu label that ends in `…` or `...`: the text of `button`, `a`, `option`, `Button`, `IconButton`, `Link`, `NavLink`, `PopupMenuItem`, `PopupMenuLabel`, `DropdownMenuItem`, `MenuItem`, `ContextMenuItem` (through any spans inside), a `label` or `aria-label`, and a `label:` in an object. Each branch of a `?:` is read; a call's result is not. A `…` with no word of its own in the same string is a truncation's and is not counted. Not counted yet, by name in `ELLIPSIS_EXEMPT` until the sweep that clears each: `busy` (a listed first word such as Saving, Loading, and the Chinese busy forms), `placeholder` (`placeholder`, `searchPlaceholder`, `emptyOptionLabel`, `blankLabel`) and `prompt` (an `<option value="">` or `{ value: '', label }`) | the label without the dots, saying what it does ("Extend trial"). `…` means only "the words are cut" (owner ruling 2026-10-14) |
|
|
3938
3965
|
|
|
3939
3966
|
Known gaps: `rgb()` / `hsl()` colours, colours in `.ts` maps, and
|
|
3940
3967
|
`createElement('button')` are not counted.
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-
|
|
1
|
+
import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-EJ54JN6S.js";import{WindowTitle as r}from"./chunk-IBGEW3OA.js";import"./chunk-DSSLOQDW.js";import"./chunk-SCJT2XXU.js";import"./chunk-ZRU5F2XT.js";import"./chunk-5A7MWTXX.js";import"./chunk-WYNQLAKD.js";import{confirm as a}from"./chunk-QBXX5A7U.js";import"./chunk-IQDY2YFN.js";import"./chunk-UVBK6YSR.js";import"./chunk-JTNKC4CR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-F5XBJE54.js";import"./chunk-KNUR2UEG.js";import"./chunk-QRCDQPJA.js";import"./chunk-C3QOHMR6.js";import{Icon as n}from"./chunk-ZGUQLVY4.js";import{useRef as s,useEffect as l,useState as i}from"react";import{jsxs as c,jsx as m,Fragment as d}from"react/jsx-runtime";var u="react-os-shell:browser-bookmarks",h="react-os-shell:browser-homepage",p="https://en.wikipedia.org/wiki/Main_Page",g=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],b=new Set(["ac ad ae af ag ai al am ao aq ar as at au aw ax az ba bb bd be bf bg bh bi","bj bm bn bo br bs bt bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu cv","cw cx cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga gd","ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id ie il","im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc","li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms mt mu","mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pl","pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sk sl sm sn","so sr ss st su sv sx sy sz tc td tf tg th tj tk tl tm tn to tr tt tv tw tz","ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw","com net org edu gov mil int info biz name pro app dev xyz online site tech","store shop cloud design digital agency studio media news blog live life","world today email systems solutions services software page link space host","press wiki team group works careers finance capital energy academy"].join(" ").split(" "));function f(e){let t=e.trim();return t?/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:function(e){const t=/^([\w-]+\.)+([a-z]{2,})(\/.*)?$/i.exec(e);return null!==t&&b.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var k=["duckduckgo.com","developer.mozilla.org","google.com","gmail.com","youtube.com","facebook.com","instagram.com","whatsapp.com","twitter.com","x.com","github.com","gitlab.com","linkedin.com","reddit.com","pinterest.com","amazon.com","amazon.ca","amazon.co.uk","apple.com","icloud.com","microsoft.com","outlook.com","live.com","office.com","netflix.com","spotify.com","paypal.com","stripe.com","chat.openai.com","chatgpt.com","claude.ai"];function x(){if("undefined"==typeof window)return g;try{const e=localStorage.getItem(u);if(!e)return g;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return g}function w(){return"undefined"==typeof window?p:localStorage.getItem(h)||p}function y(){const d=s(void 0);void 0===d.current&&(d.current=e()),l(()=>{null!=d.current&&t(d.current)},[]);const p=d.current?f(d.current.url):"",[g,b]=i(w),[k,y]=i(p||g),[j,C]=i(k),[z,R]=i([k]),[S,W]=i(0),[E,L]=i(0),[D,U]=i(x),[T,H]=i(!1),[I,Q]=i(null),X=s(null),A=s(null);l(()=>{try{localStorage.setItem(u,JSON.stringify(D))}catch{}},[D]);const B=e=>{const t=f(e);t&&(y(t),C(t),R(e=>{const o=e.slice(0,S+1);return o.push(t),o}),W(e=>e+1),H(!1))},J=()=>{"undefined"!=typeof window&&window.open(k,"_blank","noopener,noreferrer")},O=()=>{const e=I?.trim();e?(U(t=>[...t,{label:e,url:k}]),Q(null)):Q(null)};l(()=>{if(null===I)return;X.current?.focus(),X.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||Q(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==I]);const F=e=>{U(t=>t.filter((t,o)=>o!==e))},G=S>0,K=S<z.length-1,q=D.some(e=>e.url===k),M="p-2 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
|
|
2
2
|
return c("div",{className:"relative flex flex-col h-full bg-white",children:[
|
|
3
3
|
/* @__PURE__ */m(r,{title:`Browser - ${v(k)}`}),
|
|
4
4
|
/* @__PURE__ */m(o,{app:"browser"}),
|
|
5
5
|
/* @__PURE__ */c("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
6
|
-
/* @__PURE__ */m("button",{onClick:()=>{if(
|
|
7
|
-
/* @__PURE__ */m("button",{onClick:()=>{if(
|
|
8
|
-
/* @__PURE__ */m("button",{onClick:()=>
|
|
9
|
-
/* @__PURE__ */m("button",{onClick:()=>
|
|
10
|
-
/* @__PURE__ */m("form",{onSubmit:e=>{e.preventDefault(),
|
|
6
|
+
/* @__PURE__ */m("button",{onClick:()=>{if(S>0){const e=S-1;W(e),y(z[e]),C(z[e]),H(!1)}},disabled:!G,className:M,title:"Back",children:/* @__PURE__ */m(n,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
|
|
7
|
+
/* @__PURE__ */m("button",{onClick:()=>{if(S<z.length-1){const e=S+1;W(e),y(z[e]),C(z[e]),H(!1)}},disabled:!K,className:M,title:"Forward",children:/* @__PURE__ */m(n,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */m("button",{onClick:()=>L(e=>e+1),className:M,title:"Refresh",children:/* @__PURE__ */m(n,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
9
|
+
/* @__PURE__ */m("button",{onClick:()=>B(g),className:M,title:"Home",children:/* @__PURE__ */m(n,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
10
|
+
/* @__PURE__ */m("form",{onSubmit:e=>{e.preventDefault(),B(j)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */c("div",{className:"flex items-center w-full bg-white border border-gray-300 rounded focus-within:border-blue-400 focus-within:ring-1 focus-within:ring-blue-200",children:[
|
|
11
11
|
/* @__PURE__ */m("span",{className:"px-2 text-gray-400 text-xs",children:k.startsWith("https://")?"🔒":"⚠️"}),
|
|
12
12
|
/* @__PURE__ */m("input",{type:"text",value:j,onChange:e=>C(e.target.value),onFocus:e=>e.target.select(),className:"flex-1 px-1 py-1 text-sm bg-transparent outline-none font-mono",spellCheck:!1,placeholder:"Enter URL or search…"}),k!==j&&/* @__PURE__ */m("button",{type:"button",onClick:()=>C(k),className:"px-2 text-2xs text-gray-400 hover:text-gray-700",title:"Reset to current URL",children:"×"})]})}),
|
|
13
|
-
/* @__PURE__ */m("button",{"data-bookmark-popover":!0,onClick:()=>q?
|
|
14
|
-
/* @__PURE__ */m("button",{onClick:
|
|
15
|
-
/* @__PURE__ */m("button",{onClick:()=>
|
|
13
|
+
/* @__PURE__ */m("button",{"data-bookmark-popover":!0,onClick:()=>q?F(D.findIndex(e=>e.url===k)):void Q(v(k)),className:M+" "+(q?"text-yellow-500":""),title:q?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */m(n,{name:"star",className:"h-4 w-4",fill:q?"currentColor":"none",strokeWidth:1.5})}),
|
|
14
|
+
/* @__PURE__ */m("button",{onClick:J,className:M,title:"Open in new tab",children:/* @__PURE__ */m(n,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
|
|
15
|
+
/* @__PURE__ */m("button",{onClick:()=>H(e=>!e),className:M,title:"Embedding help",children:/* @__PURE__ */m(n,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==I&&/* @__PURE__ */c("div",{"data-bookmark-popover":!0,className:"absolute right-3 top-12 z-30 w-72 bg-white border border-gray-200 rounded-md shadow-lg p-3",children:[
|
|
16
16
|
/* @__PURE__ */m("div",{className:"text-2xs font-semibold uppercase tracking-wide text-gray-500 mb-1",children:"Bookmark this page"}),
|
|
17
17
|
/* @__PURE__ */m("div",{className:"text-2xs text-gray-400 truncate mb-2 font-mono",title:k,children:k}),
|
|
18
|
-
/* @__PURE__ */m("input",{ref:
|
|
18
|
+
/* @__PURE__ */m("input",{ref:X,type:"text",value:I,onChange:e=>Q(e.target.value),onKeyDown:e=>{"Enter"===e.key?O():"Escape"===e.key&&Q(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-gray-300 rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
|
|
19
19
|
/* @__PURE__ */c("div",{className:"flex justify-end gap-1 mt-2",children:[
|
|
20
|
-
/* @__PURE__ */m("button",{onClick:()=>
|
|
21
|
-
/* @__PURE__ */m("button",{onClick:
|
|
22
|
-
/* @__PURE__ */c("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===
|
|
20
|
+
/* @__PURE__ */m("button",{onClick:()=>Q(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
|
|
21
|
+
/* @__PURE__ */m("button",{onClick:O,disabled:!I.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
|
|
22
|
+
/* @__PURE__ */c("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===D.length&&/* @__PURE__ */m("span",{className:"text-2xs text-gray-400 italic px-2",children:"No bookmarks yet — star the address bar to add one."}),D.map((e,t)=>/* @__PURE__ */c("button",{onClick:()=>B(e.url),onContextMenu:async o=>{o.preventDefault();await a({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&F(t)},className:"flex items-center gap-2 px-2 py-0.5 rounded text-xs text-gray-700 hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
|
|
23
23
|
/* @__PURE__ */m("img",{src:`https://icons.duckduckgo.com/ip3/${new URL(e.url).hostname}.ico`,alt:"",className:"h-3.5 w-3.5",onError:e=>{e.target.style.visibility="hidden"}}),e.label]},t)),
|
|
24
24
|
/* @__PURE__ */m("div",{className:"flex-1"}),
|
|
25
25
|
/* @__PURE__ */m("button",{onClick:()=>{b(k);try{localStorage.setItem(h,k)}catch{}},className:"px-2 py-0.5 text-2xs text-gray-500 hover:text-gray-800",title:"Set current page as homepage",children:"Set as home"})]}),
|
|
26
|
-
/* @__PURE__ */m("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */m(N,{url:k,iframeKey:
|
|
26
|
+
/* @__PURE__ */m("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */m(N,{url:k,iframeKey:E,iframeRef:A,openExternal:J,showHelp:T,dismissHelp:()=>H(!1)})})]})}function v(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function N({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:a,dismissHelp:s}){const[u,h]=i(!1);l(()=>{h(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return k.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!u?/* @__PURE__ */m("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */c("div",{className:"max-w-md text-center",children:[
|
|
27
27
|
/* @__PURE__ */m(n,{name:"no-symbol",className:"h-14 w-14 mx-auto text-gray-300 mb-3",strokeWidth:1.2}),
|
|
28
28
|
/* @__PURE__ */c("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[v(e)," can't be embedded"]}),
|
|
29
29
|
/* @__PURE__ */c("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-
|
|
1
|
+
import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{AboutApp as t}from"./chunk-EJ54JN6S.js";import{WindowTitle as n}from"./chunk-IBGEW3OA.js";import"./chunk-DSSLOQDW.js";import"./chunk-SCJT2XXU.js";import{toast_default as r}from"./chunk-RUHUTZN4.js";import"./chunk-ZRU5F2XT.js";import"./chunk-5A7MWTXX.js";import"./chunk-WYNQLAKD.js";import"./chunk-QBXX5A7U.js";import{PopupMenu as o,PopupMenuLabel as l,PopupMenuItem as a,PopupMenuDivider as i}from"./chunk-IQDY2YFN.js";import"./chunk-UVBK6YSR.js";import"./chunk-JTNKC4CR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-F5XBJE54.js";import"./chunk-KNUR2UEG.js";import"./chunk-QRCDQPJA.js";import"./chunk-C3QOHMR6.js";import{Icon as s}from"./chunk-ZGUQLVY4.js";import{useState as c,useRef as d}from"react";import{jsxs as m,jsx as h}from"react/jsx-runtime";var u=/* @__PURE__ */new Set(["txt","md","markdown","csv","tsv","log","json","xml","html","htm","css","js","jsx","ts","tsx","py","rb","go","rs","java","c","h","cpp","hpp","sh","bash","yml","yaml","toml","ini","conf","env","sql"]),p=/* @__PURE__ */new Set(["docx"]),g={filename:"Untitled",kind:"docx",content:"",ext:"docx"};function x(){const[x,f]=c(g),[y,v]=c(!1),[b,k]=c(!1),[w,N]=c(!1),[C,j]=c(null),D=d(null),L=d(null),M=d(null),U=(e,t)=>{M.current?.focus(),document.execCommand(e,!1,t),N(!0)},R=e=>{for(const t of e){if(!t.type.startsWith("image/"))continue;const e=new FileReader;e.onload=()=>{M.current?.focus(),document.execCommand("insertImage",!1,String(e.result)),N(!0)},e.readAsDataURL(t)}},B=e=>{C&&(C.el.removeAttribute("width"),C.el.removeAttribute("height"),C.el.style.width=e??"",C.el.style.height=e?"auto":"",N(!0),j(null))},T=async t=>{const n=(t.name.split(".").pop()||"").toLowerCase();v(!0);try{if(u.has(n)||!p.has(n)&&t.type.startsWith("text/")){const r=await t.text(),o=e(r).replace(/\n/g,"<br>");f({filename:t.name,kind:"text",content:o,ext:n}),N(!1)}else if(p.has(n))try{const e=await(import(
|
|
2
2
|
/* @vite-ignore */
|
|
3
3
|
"mammoth")),r=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:r});f({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:n}),N(!1)}catch(e){r.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===n?r.error(".doc is the legacy Word binary format — convert to .docx first."):r.error(`Unsupported file type: .${n||"unknown"}`)}finally{v(!1)}},W=x?.filename?(A=x.filename).length>24?`${A.slice(0,23)}…`:A:"Untitled";var A;/* @__PURE__ */
|
|
4
4
|
return m("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),b||k(!0)},onDragLeave:e=>{e.currentTarget===e.target&&k(!1)},onDrop:e=>{e.preventDefault(),k(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?R(t):T(t[0]))},children:[
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{openPreviewFile as e}from"./chunk-B4PGVDB6.js";import{Breadcrumbs as t}from"./chunk-Z2TTHY7G.js";import{SidebarLayout as a}from"./chunk-VFBUDSMF.js";import{getFilesDemoTree as r}from"./chunk-7HLTPMQV.js";import{AboutApp as n}from"./chunk-
|
|
1
|
+
import{openPreviewFile as e}from"./chunk-B4PGVDB6.js";import{Breadcrumbs as t}from"./chunk-Z2TTHY7G.js";import{SidebarLayout as a}from"./chunk-VFBUDSMF.js";import{getFilesDemoTree as r}from"./chunk-7HLTPMQV.js";import{AboutApp as n}from"./chunk-EJ54JN6S.js";import{peekFilesViewRequest as s,consumeFilesViewRequest as i,FILES_SHOW_TRASH_EVENT as l,FILES_OPEN_DESKTOP_FOLDER_EVENT as o,subscribeDesktopFolders as d,getDesktopFoldersSnapshot as c,FolderGlyph as m,DesktopItemMiniIcon as h,desktopItemTypeLabel as p}from"./chunk-XN7CAWSZ.js";import"./chunk-ESL5TDNA.js";import"./chunk-VTVSMRFX.js";import{useWindowManager as u,WindowTitle as f}from"./chunk-IBGEW3OA.js";import"./chunk-DSSLOQDW.js";import"./chunk-SCJT2XXU.js";import{toast_default as x}from"./chunk-RUHUTZN4.js";import"./chunk-ZRU5F2XT.js";import"./chunk-5A7MWTXX.js";import"./chunk-WYNQLAKD.js";import{confirm as g,prompt as y}from"./chunk-QBXX5A7U.js";import"./chunk-IQDY2YFN.js";import"./chunk-UVBK6YSR.js";import"./chunk-JTNKC4CR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-F5XBJE54.js";import"./chunk-KNUR2UEG.js";import"./chunk-QRCDQPJA.js";import"./chunk-C3QOHMR6.js";import{formatBytes as b}from"./chunk-W32SKK3D.js";import{Icon as N}from"./chunk-ZGUQLVY4.js";import{useState as k,useEffect as w,useSyncExternalStore as v,useRef as j,useCallback as C}from"react";import{jsxs as $,jsx as D,Fragment as T}from"react/jsx-runtime";var L="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",E={pdf:"pdf",dxf:"dxf",csv:"csv",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",stp:"3d",step:"3d",stl:"3d",obj:"3d",gltf:"3d",glb:"3d","3mf":"3d",iges:"3d",igs:"3d",ply:"3d",fbx:"3d"};function R(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function S(e){if(!e)return"—";try{const t=new Date(e);return isNaN(t.getTime())?"—":t.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}catch{return e}}function F(){const F=L.replace(/\/$/,""),U=null!==r(),[P,W]=k("/"),[A,I]=k([]),[M,O]=k([]),[B,V]=k(null),[Q,H]=k(!0),[J,X]=k(!1),[z,K]=k(null),[_,G]=k(!1),[Y,Z]=k(()=>{const e=s();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});w(()=>{i()},[]);const[q,ee]=k([]);w(()=>{const e=()=>{i(),Z("trash")},t=e=>{i();const t=e.detail?.folderId;t&&Z({desktopFolderId:t})};return window.addEventListener(l,e),window.addEventListener(o,t),()=>{window.removeEventListener(l,e),window.removeEventListener(o,t)}},[]);const te=v(d,c,c),ae="object"==typeof Y?Y.desktopFolderId:null,re=ae?te?.folders.find(e=>e.id===ae)??null:null,ne=ae&&te?.itemsByFolder[ae]||[];w(()=>{ae&&te&&!te.folders.some(e=>e.id===ae)&&Z("files")},[ae,te]);const se=j(0),ie=j(null),{openPage:le,openEntity:oe}=u(),de=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>le(e)}):"page"===t.entityType?le(t.entityId):oe(t.entityType,t.entityId,null,t.label)},ce=C((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),me=C(async()=>{try{const e=await ce(`${F}/api/quota`);if(e.ok){const t=await e.json();K({used:t.used,limit:t.limit})}}catch{}},[ce,F]),he=C(async e=>{if(V(null),U){const t=function(e){const t=r();if(!t)return[];let a=t;for(const t of e.split("/").filter(Boolean)){const e=a.find(e=>"folder"===e.kind&&e.name===t);if(!e||!e.children)return[];a=e.children}return a.map(e=>({name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}(e);return I(t),W(e),X(!1),H(!1),void("/"===e&&O(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}H(!0);try{const t=await ce(`${F}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void x.error(e.error||`Failed to list (${t.status})`)}const a=await t.json(),r=a.entries||[];I(r),W(a.path||e),X(!1),"/"===(a.path||e)&&O(r.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){X(!0)}finally{H(!1)}me()},[ce,F,me,U]),pe=C(async()=>{if(U)return ee([]),void H(!1);H(!0),V(null);try{const e=await ce(`${F}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void x.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();ee(t.entries||[]),X(!1)}catch{X(!0)}finally{H(!1)}me()},[ce,F,me,U]);w(()=>{"files"===Y?he(P):"trash"===Y&&pe()},[P,Y]);const ue=async e=>{const t=R(P,e.name);try{const a=await ce(`${F}/api/file?path=${encodeURIComponent(t)}`);if(!a.ok)return void x.error(`Download failed (${a.status})`);const r=await a.blob(),n=URL.createObjectURL(r),s=document.createElement("a");s.href=n,s.download=e.name,s.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}catch(e){x.error(e?.message||"Download failed")}},fe=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const a=await ce(`${F}/api/upload?path=${encodeURIComponent(P)}`,{method:"POST",body:t});if(!a.ok){const t=await a.json().catch(()=>({}));if(413===a.status){const a=Math.max(0,(t.limit||0)-(t.used||0));x.error(`Quota exceeded — ${b(a)} free, ${e.name} is ${b(t.attempted||e.size)}`)}else x.error(`Upload ${e.name}: ${t.error||a.status}`)}}catch(t){x.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}he(P)},xe=()=>{se.current=0,G(!1)};if(w(()=>{const e=()=>xe();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),J)/* @__PURE__ */
|
|
2
2
|
return $("div",{className:"flex flex-col h-full bg-white",children:[
|
|
3
3
|
/* @__PURE__ */D(f,{title:"Files - offline"}),
|
|
4
4
|
/* @__PURE__ */D("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */$("div",{className:"max-w-md",children:[
|
|
@@ -7,7 +7,7 @@ return $("div",{className:"flex flex-col h-full bg-white",children:[
|
|
|
7
7
|
/* @__PURE__ */$("p",{className:"text-sm text-gray-500 mb-3",children:["No response from ",
|
|
8
8
|
/* @__PURE__ */D("span",{className:"font-mono",children:F}),". Make sure the server is running — see ",
|
|
9
9
|
/* @__PURE__ */D("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]}),
|
|
10
|
-
/* @__PURE__ */D("button",{onClick:()=>he(P),className:"px-3 h-8 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const ge="/"===P?[]:P.split("/").filter(Boolean),ye=
|
|
10
|
+
/* @__PURE__ */D("button",{onClick:()=>he(P),className:"px-3 h-8 text-sm bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})})]});const ge="/"===P?[]:P.split("/").filter(Boolean),ye=z&&z.limit>0?Math.min(100,Math.round(z.used/z.limit*100)):0,be=ye>90?"bg-red-500":ye>75?"bg-amber-500":"bg-blue-500",Ne=[{label:"My files",onClick:()=>W("/")},...ge.map((e,t)=>({label:e,onClick:()=>W("/"+ge.slice(0,t+1).join("/"))}))],ke=e=>"flex w-full items-center gap-2 rounded-md px-3 min-h-(--row-height-menu) py-2 text-left text-sm transition-colors "+(e?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),we=e=>/* @__PURE__ */D("svg",{className:"h-4 w-4 shrink-0 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.6,children:/* @__PURE__ */D("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),ve=/* @__PURE__ */$("nav",{className:"p-2",children:[
|
|
11
11
|
/* @__PURE__ */D("div",{className:"px-2 py-2 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:"Locations"}),
|
|
12
12
|
/* @__PURE__ */$("button",{onClick:()=>{Z("files"),W("/")},className:ke("files"===Y&&"/"===P),children:[we("M2.25 12l8.954-8.955a1.5 1.5 0 012.122 0L21.75 12M4.5 9.75v9.75a.75.75 0 00.75.75H9V15a.75.75 0 01.75-.75h4.5A.75.75 0 0115 15v5.25h3.75a.75.75 0 00.75-.75V9.75"),"My files"]}),M.map(e=>/* @__PURE__ */$("button",{onClick:()=>{Z("files"),W("/"+e)},className:ke("files"===Y&&P==="/"+e),children:[we("M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"),
|
|
13
13
|
/* @__PURE__ */D("span",{className:"truncate",children:e})]},e)),!U&&/* @__PURE__ */$("button",{onClick:()=>Z("trash"),className:ke("trash"===Y),children:[we("M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79"),"Trash"]}),te&&te.folders.length>0&&/* @__PURE__ */$(T,{children:[
|
|
@@ -36,11 +36,11 @@ return $("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e
|
|
|
36
36
|
/* @__PURE__ */D("button",{onClick:()=>Z("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */D(N,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
37
37
|
/* @__PURE__ */D(m,{className:"h-4 w-4 text-amber-500 ml-1"}),
|
|
38
38
|
/* @__PURE__ */D("span",{className:"flex-1 text-gray-700 font-medium px-1 truncate",children:re?.name??"Desktop folder"}),
|
|
39
|
-
/* @__PURE__ */D("span",{className:"text-2xs text-gray-400 px-2",children:"Desktop shortcuts"})]}),
|
|
39
|
+
/* @__PURE__ */D("span",{className:"text-2xs text-gray-400 px-2",children:"Desktop shortcuts"})]}),z&&/* @__PURE__ */$(T,{children:[
|
|
40
40
|
/* @__PURE__ */D("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
41
|
-
/* @__PURE__ */$("div",{className:"flex items-center gap-2",title:`${b(
|
|
41
|
+
/* @__PURE__ */$("div",{className:"flex items-center gap-2",title:`${b(z.used)} of ${b(z.limit)} used`,children:[
|
|
42
42
|
/* @__PURE__ */D("div",{className:"w-20 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */D("div",{className:`h-full ${be} transition-all`,style:{width:`${ye}%`}})}),
|
|
43
|
-
/* @__PURE__ */$("span",{className:"text-2xs text-gray-500 tabular-nums whitespace-nowrap",children:[b(
|
|
43
|
+
/* @__PURE__ */$("span",{className:"text-2xs text-gray-500 tabular-nums whitespace-nowrap",children:[b(z.used)," / ",b(z.limit)]})]})]})]}),
|
|
44
44
|
/* @__PURE__ */D("div",{className:"flex-1 overflow-auto",children:"object"==typeof Y?0===ne.length?/* @__PURE__ */D("div",{className:"p-10 text-center text-sm text-gray-400",children:"This desktop folder is empty. Drag shortcuts onto it on the desktop."}):/* @__PURE__ */$("table",{className:"w-full text-sm",children:[
|
|
45
45
|
/* @__PURE__ */D("thead",{className:"bg-gray-50 text-2xs uppercase tracking-wide text-gray-500",children:/* @__PURE__ */$("tr",{children:[
|
|
46
46
|
/* @__PURE__ */D("th",{className:"text-left font-medium px-3 h-8",children:"Name"}),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{getNumberingConfigs as e}from"./chunk-BIYMQKF3.js";import{SidebarLayout as t}from"./chunk-VFBUDSMF.js";import{AboutApp as r}from"./chunk-
|
|
2
|
-
/* @__PURE__ */g("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{
|
|
1
|
+
import{getNumberingConfigs as e}from"./chunk-BIYMQKF3.js";import{SidebarLayout as t}from"./chunk-VFBUDSMF.js";import{AboutApp as r}from"./chunk-EJ54JN6S.js";import{useWindowManager as n,client_default as o}from"./chunk-IBGEW3OA.js";import"./chunk-DSSLOQDW.js";import"./chunk-SCJT2XXU.js";import{toast_default as i}from"./chunk-RUHUTZN4.js";import{useShellPrefs as s}from"./chunk-ZRU5F2XT.js";import"./chunk-5A7MWTXX.js";import"./chunk-WYNQLAKD.js";import"./chunk-QBXX5A7U.js";import"./chunk-IQDY2YFN.js";import"./chunk-UVBK6YSR.js";import"./chunk-JTNKC4CR.js";import"./chunk-7IQ3B77H.js";import"./chunk-FIEA5CGB.js";import"./chunk-D65T4H6J.js";import"./chunk-F5XBJE54.js";import"./chunk-KNUR2UEG.js";import"./chunk-QRCDQPJA.js";import"./chunk-C3QOHMR6.js";import{timeAgo as a}from"./chunk-W32SKK3D.js";import{Icon as l}from"./chunk-ZGUQLVY4.js";import{useRef as c,useEffect as d,useState as p,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as y,jsx as g}from"react/jsx-runtime";var x=[{key:"yellow",bg:"bg-yellow-100",border:"border-yellow-300",text:"text-yellow-900",dot:"bg-yellow-400"},{key:"blue",bg:"bg-blue-100",border:"border-blue-300",text:"text-blue-900",dot:"bg-blue-400"},{key:"green",bg:"bg-green-100",border:"border-green-300",text:"text-green-900",dot:"bg-green-400"},{key:"pink",bg:"bg-pink-100",border:"border-pink-300",text:"text-pink-900",dot:"bg-pink-400"},{key:"purple",bg:"bg-purple-100",border:"border-purple-300",text:"text-purple-900",dot:"bg-purple-400"},{key:"orange",bg:"bg-orange-100",border:"border-orange-300",text:"text-orange-900",dot:"bg-orange-400"},{key:"white",bg:"bg-white",border:"border-gray-300",text:"text-gray-900",dot:"bg-gray-300"}];var b={sales_order:{entityType:"order",endpoint:"/orders/sales-orders/"},purchase_order:{entityType:"purchase_order",endpoint:"/purchase-orders/"},invoice:{entityType:"invoice",endpoint:"/invoicing/invoices/"},vendor_invoice:{entityType:"vendor_invoice",endpoint:"/invoicing/vendor-invoices/"},shipment:{entityType:"shipment",endpoint:"/shipments/delivery-notes/"},receipt:{entityType:"payment",endpoint:"/invoicing/payments/"},vendor_payment:{entityType:"vendor_payment",endpoint:"/invoicing/vendor-payments/"},vendor_price_sheet:{entityType:"vendor_price_sheet",endpoint:"/pricing/manufacturer-price-sheets/"},client_price_sheet:{entityType:"price_sheet",endpoint:"/pricing/price-sheets/"},qc_report:{entityType:"qc_report",endpoint:"/qc-reports/"},warranty_claim:{entityType:"warranty_claim",endpoint:"/warranty-claims/claims/"},vendor_shipment:{entityType:"vendor_shipment",endpoint:"/shipments/goods-receipts/"}},f=/\[([ xX]?)\]/g;function k(){const{openEntity:k}=n(),{prefs:v,save:N}=s(),{data:w}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),_=c({});d(()=>{if(!w)return;const e={};for(const t of w){const r=b[t.entity_type];if(!r)continue;const n=(t.prefix||"").replace("#","").toUpperCase();if(n&&(e[n]={...r,prefix:t.prefix}),t.alt_prefix){const n=t.alt_prefix.replace("#","").toUpperCase();n&&(e[n]={...r,prefix:t.alt_prefix})}}_.current=e},[w]);const j=v.notepad_notes||[],[T,C]=p(null),[$,S]=p(""),[X,W]=p(""),[U,D]=p("yellow"),[I,Q]=p(!1),[B,F]=p(!1),K=c(null),O=c(),R=j.find(e=>e.id===T);d(()=>{if(!T&&j.length>0){const e=j[0];C(e.id),S(e.title),W(e.content),D(e.color)}},[j.length]);const E=m(e=>{N({notepad_notes:e})},[N]),A=m(()=>{if(!T||!I)return;const e=j.map(e=>e.id===T?{...e,title:$,content:X,color:U,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);E(e),Q(!1)},[T,I,$,X,U,j,E]);d(()=>{if(I)return O.current&&clearTimeout(O.current),O.current=setTimeout(A,800),()=>{O.current&&clearTimeout(O.current)}},[I,A]),d(()=>()=>{I&&A()},[]);const J=e=>{I&&A(),C(e.id),S(e.title),W(e.content),D(e.color),Q(!1),F(!1)},q=e=>{const t=X.slice(0,e),r=X.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=X.slice(e+r[0].length);W(t+n+o),Q(!0)},Y=async(e,t)=>{const r=_.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await o.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?k(r.entityType,t.id,t,n):i.error(`${n} not found`)}catch{i.error(`Failed to look up ${n}`)}},M="Start writing...\n\nTips:\n [] Type [] for a checkbox, click to toggle\n SO#35001 Type XX#NNNNN to link entities (SO, PO, CI, VI, PL, etc.)",P=/* @__PURE__ */h(y,{children:[
|
|
2
|
+
/* @__PURE__ */g("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{I&&A();const e={id:`note-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:"",content:"",color:"yellow",sticky:!1,updated_at:/* @__PURE__ */(new Date).toISOString()},t=[e,...j];E(t),C(e.id),S(""),W(""),D("yellow"),Q(!1),F(!0),setTimeout(()=>K.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-blue-600 text-white px-3 min-h-8 py-1 text-sm font-medium hover:bg-blue-700 transition-colors",children:[
|
|
3
3
|
/* @__PURE__ */g(l,{name:"add",className:"h-4 w-4",strokeWidth:2}),"New Note"]})}),
|
|
4
|
-
/* @__PURE__ */g("div",{className:"flex-1 overflow-y-auto",children:0===
|
|
5
|
-
return h("button",{onClick:()=>
|
|
4
|
+
/* @__PURE__ */g("div",{className:"flex-1 overflow-y-auto",children:0===j.length?/* @__PURE__ */g("p",{className:"text-sm text-gray-400 text-center py-8 px-4",children:"No notes yet. Create one to get started."}):j.map(e=>{const t=(r=e.color,x.find(e=>e.key===r)||x[0]);var r;/* @__PURE__ */
|
|
5
|
+
return h("button",{onClick:()=>J(e),className:"w-full text-left px-3 py-3 border-b border-gray-100 transition-colors "+(T===e.id?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
6
6
|
/* @__PURE__ */h("div",{className:"flex items-center gap-2",children:[
|
|
7
7
|
/* @__PURE__ */g("div",{className:`w-3 h-3 rounded-full shrink-0 ${t.dot}`}),
|
|
8
8
|
/* @__PURE__ */g("span",{className:"text-sm font-medium text-gray-900 truncate flex-1",children:e.title||"Untitled"}),e.sticky&&/* @__PURE__ */g(l,{name:"bookmark",look:"solid",className:"h-3 w-3 text-amber-500 shrink-0"})]}),
|
|
@@ -10,16 +10,16 @@ return h("button",{onClick:()=>q(e),className:"w-full text-left px-3 py-3 border
|
|
|
10
10
|
/* @__PURE__ */g("p",{className:"text-2xs text-gray-300 mt-0.5 ml-5",children:a(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
|
|
11
11
|
return h("div",{className:"h-full",children:[
|
|
12
12
|
/* @__PURE__ */g(r,{app:"notepad"}),
|
|
13
|
-
/* @__PURE__ */g(t,{sidebar:
|
|
13
|
+
/* @__PURE__ */g(t,{sidebar:P,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:T?/* @__PURE__ */h("div",{className:"flex-1 flex flex-col min-w-0",children:[
|
|
14
14
|
/* @__PURE__ */h("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200",children:[
|
|
15
15
|
/* @__PURE__ */g("input",{value:$,onChange:e=>{S(e.target.value),Q(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
|
|
16
|
-
/* @__PURE__ */g("div",{className:"flex gap-1",children:x.map(e=>/* @__PURE__ */g("button",{onClick:()=>{
|
|
17
|
-
/* @__PURE__ */g("button",{onClick:()=>(e=>{const t=
|
|
18
|
-
/* @__PURE__ */g("button",{onClick:()=>(e=>{const t=
|
|
19
|
-
return g("div",{className:d?"line-through text-gray-400":"",children:n},r)})})(
|
|
16
|
+
/* @__PURE__ */g("div",{className:"flex gap-1",children:x.map(e=>/* @__PURE__ */g("button",{onClick:()=>{D(e.key),Q(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${U===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
|
|
17
|
+
/* @__PURE__ */g("button",{onClick:()=>(e=>{const t=j.map(t=>t.id===e?{...t,sticky:!t.sticky}:t);E(t);const r=t.find(t=>t.id===e);i.success(r?.sticky?"Pinned to desktop":"Removed from desktop")})(T),title:R?.sticky?"Remove from desktop":"Pin to desktop",className:"p-1 rounded transition-colors "+(R?.sticky?"text-amber-500 hover:text-amber-600":"text-gray-300 hover:text-amber-400"),children:/* @__PURE__ */g(l,{name:"bookmark",className:"h-4 w-4",fill:R?.sticky?"currentColor":"none",strokeWidth:1.5})}),
|
|
18
|
+
/* @__PURE__ */g("button",{onClick:()=>(e=>{const t=j.filter(t=>t.id!==e);if(E(t),T===e){const e=t[0];e?J(e):(C(null),S(""),W(""))}})(T),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */g(l,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),B?/* @__PURE__ */g("textarea",{ref:K,value:X,onChange:e=>{W(e.target.value),Q(!0)},onBlur:()=>{F(!1),I&&A()},placeholder:M,className:"flex-1 p-4 text-sm text-gray-700 outline-none resize-none bg-transparent leading-relaxed placeholder:text-gray-300 font-mono"}):/* @__PURE__ */g("div",{onClick:()=>{F(!0),setTimeout(()=>K.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:X?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],s=/([A-Z]{2,4})#(\d{4,6})/g;let a;for(;null!==(a=s.exec(e));){const e=a[1],t=a[2];if(_.current[e]){const n=a.index,o=a[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */g("button",{onClick:()=>Y(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}f.lastIndex=0;let c=0;for(let e=0;e<r;e++)c+=t[e].length+1;for(;null!==(a=f.exec(e));){const e="x"===a[1]||"X"===a[1],t=a.index,n=c+t;i.push({idx:t,len:a[0].length,render:()=>/* @__PURE__ */g("button",{onClick:()=>q(n),className:`inline-flex items-center justify-center w-4 h-4 rounded border ${e?"bg-blue-500 border-blue-500 text-white":"border-gray-400 bg-white hover:border-blue-400"} cursor-pointer align-text-bottom mr-0.5`,children:e&&/* @__PURE__ */g(l,{name:"check",className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */g("span",{children:e.slice(o,t.idx)},`t-${r}-${o}`)),n.push(t.render()),o=t.idx+t.len;o<e.length&&n.push(/* @__PURE__ */g("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */g("span",{children:""},`empty-${r}`));const d=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
|
|
19
|
+
return g("div",{className:d?"line-through text-gray-400":"",children:n},r)})})(X):/* @__PURE__ */g("p",{className:"text-gray-300 whitespace-pre-line",children:M})}),
|
|
20
20
|
/* @__PURE__ */h("div",{className:"px-4 min-h-8 py-1 border-t border-gray-100 flex items-center gap-4 text-2xs text-gray-400",children:[
|
|
21
21
|
/* @__PURE__ */g("span",{children:"[] checkbox"}),
|
|
22
22
|
/* @__PURE__ */g("span",{children:"SO#35001 entity link"}),
|
|
23
|
-
/* @__PURE__ */g("span",{className:"ml-auto",children:
|
|
23
|
+
/* @__PURE__ */g("span",{className:"ml-auto",children:B?"Editing":"Click to edit"})]})]}):/* @__PURE__ */g("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */h("div",{className:"text-center text-gray-400",children:[
|
|
24
24
|
/* @__PURE__ */g(l,{name:"page",className:"h-12 w-12 mx-auto mb-3 text-gray-300",strokeWidth:1}),
|
|
25
25
|
/* @__PURE__ */g("p",{className:"text-sm",children:"Select a note or create a new one"})]})})})]})}export{k as default};
|