efficient-shell 12.44.0 → 12.46.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 +36 -0
- package/dist/{Browser-537TLOMC.js → Browser-4ZKN4URZ.js} +14 -14
- package/dist/{Files-FMQX6DB3.js → Files-EX3DZ3VR.js} +141 -141
- package/dist/{Notepad-KVKXMJ57.js → Notepad-G45JQHOZ.js} +8 -8
- package/dist/{Preview-KZTVS7UT.js → Preview-LM2JSST6.js} +21 -21
- package/dist/apps/index.js +1 -1
- package/dist/bin/browser-check.js +2 -0
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/chunk-5NTKRMN4.js +4 -0
- package/dist/{chunk-CBXEMPZL.js → chunk-BLY6SP5Y.js} +2 -2
- package/dist/{chunk-57AUBMEX.js → chunk-EPYZL4AK.js} +1 -1
- package/dist/{chunk-QECE7MQJ.js → chunk-FI73SENC.js} +1 -1
- package/dist/chunk-OBZZLLMQ.js +2 -0
- package/dist/chunk-RE5XE7FR.js +1 -0
- package/dist/forms/BorderInput.js +1 -1
- package/dist/forms/IconPicker.d.ts +6 -2
- package/dist/forms/IconPicker.js +1 -1
- package/dist/forms/PictureTiles.js +1 -1
- package/dist/index.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/ui.css +7 -1
- package/dist/version.js +1 -1
- package/package.json +3 -2
- package/dist/chunk-D6CPF5YB.js +0 -1
- package/dist/chunk-FUNGLFQE.js +0 -4
- package/dist/chunk-WW5AXVBX.js +0 -2
package/README.md
CHANGED
|
@@ -5442,6 +5442,42 @@ hand and reviewed:
|
|
|
5442
5442
|
|
|
5443
5443
|
Wire it beside the UI kit check in the job that gates a merge.
|
|
5444
5444
|
|
|
5445
|
+
### The browser check — `efficient-shell-browser-check`
|
|
5446
|
+
|
|
5447
|
+
What jsdom cannot show (focus, scroll locking, real layout, a PDF read by
|
|
5448
|
+
pdf.js) is checked in a real browser, with the runner the shell's own
|
|
5449
|
+
`npm run test:browser` uses. A scenario is two files in one folder:
|
|
5450
|
+
|
|
5451
|
+
- `<name>.entry.tsx`, the page: bundled with esbuild and served at `/`.
|
|
5452
|
+
- `<name>.check.mjs`: `export default async (page, ctx) => {}` with Playwright's
|
|
5453
|
+
`page`, plus an optional `describe` string and `viewport`. `ctx.pageErrors`
|
|
5454
|
+
holds what the page threw, `ctx.baseUrl` is its origin and
|
|
5455
|
+
`ctx.open(search)` loads it again with a query string.
|
|
5456
|
+
|
|
5457
|
+
```bash
|
|
5458
|
+
npx efficient-shell-browser-check \
|
|
5459
|
+
--dir tests/browser \
|
|
5460
|
+
--css node_modules/.cache/browser.css \
|
|
5461
|
+
--serve /pdf.worker.min.mjs=node_modules/pdfjs-dist/build/pdf.worker.min.mjs \
|
|
5462
|
+
--define '__APP_VERSION__="browser-test"'
|
|
5463
|
+
```
|
|
5464
|
+
|
|
5465
|
+
- `--dir` is the scenario folder (default `tests/browser`).
|
|
5466
|
+
- `--css` links a BUILT stylesheet on every page, as it is (it is not
|
|
5467
|
+
compiled: build a Tailwind source first); repeat it, in the order to link.
|
|
5468
|
+
A stylesheet an entry imports is linked after them.
|
|
5469
|
+
- `--serve <urlPath>=<file>` answers a fixed path with a file. The runner does
|
|
5470
|
+
not block the network: a check that needs a remote host answers it itself
|
|
5471
|
+
with `page.route`.
|
|
5472
|
+
- `--define KEY=JSON` replaces a name in the bundle.
|
|
5473
|
+
- `BROWSER_SHARD=<i>/<n>` runs every n-th scenario from the i-th, to split the
|
|
5474
|
+
lane across CI jobs. `REACT_DIR` bundles the `react` and `react-dom` in
|
|
5475
|
+
another folder.
|
|
5476
|
+
|
|
5477
|
+
esbuild and `playwright` (the package, not only `@playwright/test`) come from
|
|
5478
|
+
the repository's own devDependencies; the package ships neither. Install Chromium once with
|
|
5479
|
+
`npx playwright install --only-shell chromium`. Exits 1 when a check fails.
|
|
5480
|
+
|
|
5445
5481
|
## Why it exists
|
|
5446
5482
|
|
|
5447
5483
|
Most "desktop UI" demos on the web are toys with hardcoded windows and no escape hatch. This one was extracted from a working ERP where every entity (sales orders, invoices, vendors, …) opens as its own window with consistent header, footer, hotkeys, depth stacking, and split-view. The shell is **fully decoupled** from any specific backend — every subsystem that needs server data (notifications, bug reports, desktop shortcuts, search, entity fetching) takes its data through callback configs supplied by the consumer. Drop-in localStorage fallbacks ship for prefs and sticky notes so the package works out of the box without a backend.
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import{InputEndActionButton as e}from"./chunk-PT4GMPUB.js";import"./chunk-3DSGJIC7.js";import"./chunk-UZFFSZFI.js";import"./chunk-SV5RRBVA.js";import"./chunk-AYZY3YNC.js";import{peekBrowserStartUrl as t,claimBrowserStartUrl as o}from"./chunk-LWLCNQY7.js";import{AboutApp as r}from"./chunk-
|
|
1
|
+
import{InputEndActionButton as e}from"./chunk-PT4GMPUB.js";import"./chunk-3DSGJIC7.js";import"./chunk-UZFFSZFI.js";import"./chunk-SV5RRBVA.js";import"./chunk-AYZY3YNC.js";import{peekBrowserStartUrl as t,claimBrowserStartUrl as o}from"./chunk-LWLCNQY7.js";import{AboutApp as r}from"./chunk-EPYZL4AK.js";import{WindowTitle as n}from"./chunk-PDOPU3KN.js";import"./chunk-4LXCCZDM.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-DASRJ26L.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-GHLXZDLU.js";import{confirm as s}from"./chunk-KV6XCHAG.js";import"./chunk-B447IHIL.js";import"./chunk-EIFNESXS.js";import"./chunk-PR6FNBKR.js";import"./chunk-RIG5FEVS.js";import"./chunk-NDWX5Z4D.js";import"./chunk-VWGWZY7A.js";import"./chunk-7QSDPSXP.js";import"./chunk-ZGIAMYTI.js";import"./chunk-5LHEPE4B.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-KC3EX26K.js";import"./chunk-RE5XE7FR.js";import"./chunk-DWGYC7OD.js";import"./chunk-JMGDGNM7.js";import"./chunk-GOAFMGUI.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-EVYD6UFQ.js";import"./chunk-M5K4AX4E.js";import{Icon as a}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-G67CJAQ2.js";import"./chunk-SOZCWT6I.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-STKJA4PV.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-DEJIH3ZQ.js";import"./chunk-C3QOHMR6.js";import{useRef as i,useEffect as c,useState as l}from"react";import{jsxs as m,jsx as u,Fragment as h}from"react/jsx-runtime";var d="react-os-shell:browser-bookmarks",p="react-os-shell:browser-homepage",k="https://en.wikipedia.org/wiki/Main_Page",b=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],g=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&&g.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var w=["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 b;try{const e=localStorage.getItem(d);if(!e)return b;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return b}function y(){return"undefined"==typeof window?k:localStorage.getItem(p)||k}function v(){const h=i(void 0);void 0===h.current&&(h.current=t()),c(()=>{null!=h.current&&o(h.current)},[]);const k=h.current?f(h.current.url):"",[b,g]=l(y),[w,v]=l(k||b),[C,R]=l(w),[D,S]=l([w]),[W,E]=l(0),[z,L]=l(0),[G,U]=l(x),[H,I]=l(!1),[M,P]=l(null),F=i(null),T=i(null);c(()=>{try{localStorage.setItem(d,JSON.stringify(G))}catch{}},[G]);const A=e=>{const t=f(e);t&&(v(t),R(t),S(e=>{const o=e.slice(0,W+1);return o.push(t),o}),E(e=>e+1),I(!1))},Z=()=>{"undefined"!=typeof window&&window.open(w,"_blank","noopener,noreferrer")},J=()=>{const e=M?.trim();e?(U(t=>[...t,{label:e,url:w}]),P(null)):P(null)};c(()=>{if(null===M)return;F.current?.focus(),F.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||P(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==M]);const K=e=>{U(t=>t.filter((t,o)=>o!==e))},O=W>0,X=W<D.length-1,Y=G.some(e=>e.url===w),B="p-2 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
|
|
2
2
|
return m("div",{className:"relative flex flex-col h-full bg-white",children:[
|
|
3
3
|
/* @__PURE__ */u(n,{title:`Browser - ${N(w)}`}),
|
|
4
4
|
/* @__PURE__ */u(r,{app:"browser"}),
|
|
5
5
|
/* @__PURE__ */m("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-line bg-surface-sunken shrink-0",children:[
|
|
6
|
-
/* @__PURE__ */u("button",{onClick:()=>{if(W>0){const e=W-1;
|
|
7
|
-
/* @__PURE__ */u("button",{onClick:()=>{if(W<
|
|
8
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
9
|
-
/* @__PURE__ */u("button",{onClick:()=>A(b),className:
|
|
6
|
+
/* @__PURE__ */u("button",{onClick:()=>{if(W>0){const e=W-1;E(e),v(D[e]),R(D[e]),I(!1)}},disabled:!O,className:B,title:"Back",children:/* @__PURE__ */u(a,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
|
|
7
|
+
/* @__PURE__ */u("button",{onClick:()=>{if(W<D.length-1){const e=W+1;E(e),v(D[e]),R(D[e]),I(!1)}},disabled:!X,className:B,title:"Forward",children:/* @__PURE__ */u(a,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */u("button",{onClick:()=>L(e=>e+1),className:B,title:"Refresh",children:/* @__PURE__ */u(a,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
9
|
+
/* @__PURE__ */u("button",{onClick:()=>A(b),className:B,title:"Home",children:/* @__PURE__ */u(a,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
10
10
|
/* @__PURE__ */u("form",{onSubmit:e=>{e.preventDefault(),A(C)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */m("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__ */u("span",{className:"px-2 text-gray-400 text-xs",children:w.startsWith("https://")?"🔒":"⚠️"}),
|
|
12
|
-
/* @__PURE__ */u("input",{type:"text",value:C,onChange:e=>
|
|
13
|
-
/* @__PURE__ */u("span",{className:"flex pr-1",children:/* @__PURE__ */u(e,{action:{label:"Reset to current URL",icon:/* @__PURE__ */u(a,{name:"close"}),onClick:()=>
|
|
14
|
-
/* @__PURE__ */u("button",{"data-bookmark-popover":!0,onClick:()=>K
|
|
15
|
-
/* @__PURE__ */u("button",{onClick:
|
|
16
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
12
|
+
/* @__PURE__ */u("input",{type:"text",value:C,onChange:e=>R(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…"}),w!==C&&
|
|
13
|
+
/* @__PURE__ */u("span",{className:"flex pr-1",children:/* @__PURE__ */u(e,{action:{label:"Reset to current URL",icon:/* @__PURE__ */u(a,{name:"close"}),onClick:()=>R(w)}})})]})}),
|
|
14
|
+
/* @__PURE__ */u("button",{"data-bookmark-popover":!0,onClick:()=>Y?K(G.findIndex(e=>e.url===w)):void P(N(w)),className:B+" "+(Y?"text-yellow-500":""),title:Y?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */u(a,{name:"star",className:"h-4 w-4",fill:Y?"currentColor":"none",strokeWidth:1.5})}),
|
|
15
|
+
/* @__PURE__ */u("button",{onClick:Z,className:B,title:"Open in new tab",children:/* @__PURE__ */u(a,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
|
|
16
|
+
/* @__PURE__ */u("button",{onClick:()=>I(e=>!e),className:B,title:"Embedding help",children:/* @__PURE__ */u(a,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==M&&/* @__PURE__ */m("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:[
|
|
17
17
|
/* @__PURE__ */u("div",{className:"text-2xs font-semibold uppercase tracking-wide text-ink-faint mb-1",children:"Bookmark this page"}),
|
|
18
18
|
/* @__PURE__ */u("div",{className:"text-2xs text-ink-faintest truncate mb-2 font-mono",title:w,children:w}),
|
|
19
|
-
/* @__PURE__ */u("input",{ref:F,type:"text",value:
|
|
19
|
+
/* @__PURE__ */u("input",{ref:F,type:"text",value:M,onChange:e=>P(e.target.value),onKeyDown:e=>{"Enter"===e.key?J():"Escape"===e.key&&P(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-line-strong rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
|
|
20
20
|
/* @__PURE__ */m("div",{className:"flex justify-end gap-1 mt-2",children:[
|
|
21
21
|
/* @__PURE__ */u("button",{onClick:()=>P(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
|
|
22
|
-
/* @__PURE__ */u("button",{onClick:
|
|
23
|
-
/* @__PURE__ */m("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===
|
|
22
|
+
/* @__PURE__ */u("button",{onClick:J,disabled:!M.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
|
|
23
|
+
/* @__PURE__ */m("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===G.length&&/* @__PURE__ */u("span",{className:"text-2xs text-ink-faintest italic px-2",children:"No bookmarks yet — star the address bar to add one."}),G.map((e,t)=>/* @__PURE__ */m("button",{onClick:()=>A(e.url),onContextMenu:async o=>{o.preventDefault();await s({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&K(t)},className:"flex items-center gap-2 px-2 py-0.5 rounded text-xs text-ink hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
|
|
24
24
|
/* @__PURE__ */u("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)),
|
|
25
25
|
/* @__PURE__ */u("div",{className:"flex-1"}),
|
|
26
26
|
/* @__PURE__ */u("button",{onClick:()=>{g(w);try{localStorage.setItem(p,w)}catch{}},className:"px-2 py-0.5 text-2xs text-ink-faint hover:text-ink-strong",title:"Set current page as homepage",children:"Set as home"})]}),
|
|
27
|
-
/* @__PURE__ */u("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */u(j,{url:w,iframeKey:
|
|
27
|
+
/* @__PURE__ */u("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */u(j,{url:w,iframeKey:z,iframeRef:T,openExternal:Z,showHelp:H,dismissHelp:()=>I(!1)})})]})}function N(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function j({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:n,dismissHelp:s}){const[i,d]=l(!1);c(()=>{d(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return w.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!i?/* @__PURE__ */u("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */m("div",{className:"max-w-md text-center",children:[
|
|
28
28
|
/* @__PURE__ */u(a,{name:"no-symbol",className:"h-14 w-14 mx-auto text-gray-300 mb-3",strokeWidth:1.2}),
|
|
29
29
|
/* @__PURE__ */m("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[N(e)," can't be embedded"]}),
|
|
30
30
|
/* @__PURE__ */m("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
|