efficient-shell 4.180.0 → 4.181.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 +12 -0
- package/dist/Browser-QYHW6I6J.js +43 -0
- package/dist/Calculator-4K53PFBL.js +29 -0
- package/dist/ConfirmDialog-X2DPOYWO.js +1 -0
- package/dist/{CurrencyConverter-AMXUOQR2.js → CurrencyConverter-QEG6RFAS.js} +9 -9
- package/dist/Documents-SFNMDRYU.js +52 -0
- package/dist/Files-OX2UBSQQ.js +87 -0
- package/dist/Notepad-CNZEWFCR.js +25 -0
- package/dist/PdfViewer-UZGDE4HD.js +1 -0
- package/dist/PomodoroTimer-T6YAQFIE.js +91 -0
- package/dist/Preview-OOVIIQQG.js +182 -0
- package/dist/Sidebar-3NZRIL7F.js +44 -0
- package/dist/Spreadsheet-7NUDGOSX.js +37 -0
- package/dist/{Stock-GWVG2INU.js → Stock-BZFC2ROU.js} +6 -6
- package/dist/{Weather-APBCG4TO.js → Weather-S3N5OWYF.js} +17 -17
- package/dist/{WorldClock-2LMZYKWR.js → WorldClock-ACC3S6OA.js} +4 -4
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/{chunk-FORN7LG7.js → chunk-2DX65GOO.js} +1 -1
- package/dist/{chunk-6CFBF543.js → chunk-5IWSOLLY.js} +2 -2
- package/dist/chunk-FOEVG7RT.js +21 -0
- package/dist/chunk-GMMTTWHB.js +3 -0
- package/dist/chunk-LMIQV3NB.js +13 -0
- package/dist/{chunk-SVO3ES2E.js → chunk-MIAJQGWE.js} +1 -1
- package/dist/chunk-MSIN5HKX.js +9 -0
- package/dist/chunk-OD5KLVU5.js +1 -0
- package/dist/{chunk-ILTSTULF.js → chunk-P4SGJTK3.js} +1 -1
- package/dist/chunk-PQLVWCUI.js +11 -0
- package/dist/chunk-QRV7RNQX.js +24 -0
- package/dist/chunk-R3PCJLQF.js +993 -0
- package/dist/chunk-SBDIHKLU.js +108 -0
- package/dist/chunk-VJP3R52B.js +6 -0
- package/dist/chunk-XUF7VW4U.js +136 -0
- package/dist/chunk-ZDF5AR5W.js +10 -0
- package/dist/chunk-ZZKIKW62.js +29 -0
- package/dist/index.js +639 -656
- package/dist/map/index.js +22 -22
- package/dist/markdown/index.js +6 -6
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
- package/dist/Browser-RZFOKBSF.js +0 -43
- package/dist/Calculator-R5OEHQ67.js +0 -29
- package/dist/ConfirmDialog-CMNQZQA3.js +0 -1
- package/dist/Documents-VD32HWDQ.js +0 -52
- package/dist/Files-NAY3WK6O.js +0 -89
- package/dist/Notepad-AHRPMF57.js +0 -25
- package/dist/PdfViewer-3SC3LE4U.js +0 -1
- package/dist/PomodoroTimer-LE6J2KUU.js +0 -99
- package/dist/Preview-OKR5QRQP.js +0 -188
- package/dist/Sidebar-BQ4P5LBI.js +0 -44
- package/dist/Spreadsheet-RME4IQ43.js +0 -37
- package/dist/chunk-4VTHXNGZ.js +0 -1003
- package/dist/chunk-5ZDM6WIC.js +0 -24
- package/dist/chunk-7WZEFHPS.js +0 -6
- package/dist/chunk-AA4TMQOS.js +0 -10
- package/dist/chunk-BSJIBRWC.js +0 -1
- package/dist/chunk-C2A4PIGZ.js +0 -13
- package/dist/chunk-CIXQKCFA.js +0 -11
- package/dist/chunk-KVOFUFPP.js +0 -3
- package/dist/chunk-N6STBYXR.js +0 -112
- package/dist/chunk-RQOP5JAJ.js +0 -9
- package/dist/chunk-UAIVAA5X.js +0 -21
- package/dist/chunk-ZAE6ROV7.js +0 -29
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{fetchCityWeather as e,getCondition as t,AVAILABLE_CITIES as a,toFahrenheit as r}from"./chunk-FBDZGO3V.js";import{loadAppearance as n,WidgetSettingsModal as i}from"./chunk-
|
|
1
|
+
import{fetchCityWeather as e,getCondition as t,AVAILABLE_CITIES as a,toFahrenheit as r}from"./chunk-FBDZGO3V.js";import{loadAppearance as n,WidgetSettingsModal as i}from"./chunk-MIAJQGWE.js";import{useWidgetSettings as s}from"./chunk-SBDIHKLU.js";import"./chunk-DSSLOQDW.js";import"./chunk-GMMTTWHB.js";import{useShellPrefs as o}from"./chunk-PQLVWCUI.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-ZZKIKW62.js";import"./chunk-ZDF5AR5W.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import"./chunk-XUF7VW4U.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import"./chunk-YKZHOXI4.js";import{useState as l,useEffect as c,useCallback as d}from"react";import{jsx as m,jsxs as p,Fragment as h}from"react/jsx-runtime";var u="weather_city",f="weather_appearance",y={useFahrenheit:!1,showLocalTime:!0,use24Hour:!1};function g(){const e="undefined"!=typeof localStorage?localStorage.getItem(u):null;if(e&&a[e])return e;try{const e=JSON.parse(localStorage.getItem("weather_cities")||"");if(Array.isArray(e)&&e[0]&&a[e[0]])return localStorage.setItem(u,e[0]),e[0]}catch{}return function(){try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;for(const[t,r]of Object.entries(a))if(r.tz===e)return t}catch{}return"London"}()}var x=r;function b(e,t=!1){try{if(t){const t=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",hour12:!1}).formatToParts(/* @__PURE__ */new Date),a=parseInt(t.find(e=>"hour"===e.type)?.value||"0"),r=parseInt(t.find(e=>"minute"===e.type)?.value||"0");return`${String(a).padStart(2,"0")}:${String(r).padStart(2,"0")}`}const a=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",hour12:!0}).formatToParts(/* @__PURE__ */new Date),r=parseInt(a.find(e=>"hour"===e.type)?.value||"12"),n=parseInt(a.find(e=>"minute"===e.type)?.value||"0"),i=a.find(e=>"dayPeriod"===e.type)?.value||"";return`${r}:${String(n).padStart(2,"0")} ${i}`}catch{return""}}function w(){/* @__PURE__ */
|
|
2
2
|
return p("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[
|
|
3
3
|
/* @__PURE__ */m("div",{className:"absolute -top-5 -right-5 w-24 h-24",style:{animation:"wx-sun-rays 70s linear infinite"},children:/* @__PURE__ */m("svg",{viewBox:"0 0 100 100",className:"w-full h-full",children:Array.from({length:12}).map((e,t)=>/* @__PURE__ */m("rect",{x:49,y:3,width:2,height:14,rx:1,fill:"rgba(255, 232, 130, 0.55)",transform:`rotate(${30*t} 50 50)`},t))})}),
|
|
4
4
|
/* @__PURE__ */m("div",{className:"absolute top-1 right-1 w-10 h-10 rounded-full",style:{background:"radial-gradient(circle at 35% 35%, #fff8cc 0%, #ffd84a 55%, #ff9e2a 100%)",boxShadow:"0 0 18px 5px rgba(255, 200, 80, 0.55)",animation:"wx-sun-pulse 4.5s ease-in-out infinite"}})]})}function v(){const e=Array.from({length:16}).map((e,t)=>({left:(53*t+11)%95+"%",top:(37*t+9)%78+"%",size:1+13*t%3,delay:.41*t%4+"s",duration:2.5+7*t%5*.6+"s"}));/* @__PURE__ */
|
|
@@ -18,43 +18,43 @@ return p("div",{className:"absolute inset-0 overflow-hidden pointer-events-none"
|
|
|
18
18
|
/* @__PURE__ */m("div",{className:"absolute",style:{top:"8%",animation:"wx-drift-cloud 42s linear infinite"},children:/* @__PURE__ */m(a,{scale:.9})}),
|
|
19
19
|
/* @__PURE__ */m("div",{className:"absolute",style:{top:"40%",animation:"wx-drift-cloud 60s linear -22s infinite",opacity:.85},children:/* @__PURE__ */m(a,{scale:1.25})}),
|
|
20
20
|
/* @__PURE__ */m("div",{className:"absolute",style:{top:"68%",animation:"wx-drift-cloud 78s linear -45s infinite",opacity:.7},children:/* @__PURE__ */m(a,{scale:.75})})]})}function N({heavy:e=!1}){const t=e?26:16,a=["wx-rain-a","wx-rain-b","wx-rain-c"],r=Array.from({length:t}).map((e,r)=>({left:(100*r/t+11*r%7)%100+"%",delay:.087*r%1.3+"s",height:12+r%4*5+"px",duration:.7+r%3*.18+"s",variant:a[r%a.length]}));/* @__PURE__ */
|
|
21
|
-
return m("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:r.map((e,t)=>/* @__PURE__ */m("div",{className:"absolute",style:{left:e.left,top:"-20px",width:"1px",height:e.height,background:"linear-gradient(180deg, rgba(180,210,255,0) 0%, rgba(220,235,255,0.85) 90%, rgba(255,255,255,0.95) 100%)",transform:"rotate(8deg)",animation:`${e.variant} ${e.duration} linear ${e.delay} infinite`,transformOrigin:"top"}},t))})}function
|
|
22
|
-
return m("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:t.map((e,t)=>/* @__PURE__ */m("div",{className:"absolute rounded-full bg-white",style:{left:e.left,top:"-12px",width:e.size,height:e.size,opacity:e.opacity,boxShadow:"0 0 4px rgba(255,255,255,0.65)",animation:`${e.variant} ${e.duration} linear ${e.delay} infinite`}},t))})}function
|
|
21
|
+
return m("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:r.map((e,t)=>/* @__PURE__ */m("div",{className:"absolute",style:{left:e.left,top:"-20px",width:"1px",height:e.height,background:"linear-gradient(180deg, rgba(180,210,255,0) 0%, rgba(220,235,255,0.85) 90%, rgba(255,255,255,0.95) 100%)",transform:"rotate(8deg)",animation:`${e.variant} ${e.duration} linear ${e.delay} infinite`,transformOrigin:"top"}},t))})}function j(){const e=["wx-snow-a","wx-snow-b","wx-snow-c"],t=Array.from({length:16}).map((t,a)=>({left:(100*a/16+13*a%5)%100+"%",delay:.43*a%5+"s",duration:4.5+a%5+"s",size:3+a%4*1.4,opacity:.65+7*a%4*.08,variant:e[a%e.length]}));/* @__PURE__ */
|
|
22
|
+
return m("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:t.map((e,t)=>/* @__PURE__ */m("div",{className:"absolute rounded-full bg-white",style:{left:e.left,top:"-12px",width:e.size,height:e.size,opacity:e.opacity,boxShadow:"0 0 4px rgba(255,255,255,0.65)",animation:`${e.variant} ${e.duration} linear ${e.delay} infinite`}},t))})}function S(){/* @__PURE__ */
|
|
23
23
|
return p("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[
|
|
24
24
|
/* @__PURE__ */m(N,{heavy:!0}),
|
|
25
25
|
/* @__PURE__ */m("div",{className:"absolute inset-0 bg-white",style:{animation:"wx-flash 6s ease-out infinite"}}),
|
|
26
|
-
/* @__PURE__ */m("div",{className:"absolute inset-y-0 right-1/3 flex items-center justify-center pointer-events-none",style:{animation:"wx-bolt 6s ease-out infinite"},children:/* @__PURE__ */m("svg",{viewBox:"0 0 18 60",className:"h-4/5",style:{filter:"drop-shadow(0 0 6px rgba(255, 240, 150, 0.95)) drop-shadow(0 0 14px rgba(255, 220, 90, 0.7))"},children:/* @__PURE__ */m("path",{d:"M11 0 L2 28 L8 30 L4 60 L16 24 L9 22 Z",fill:"rgba(255, 250, 200, 0.98)",stroke:"rgba(255, 255, 255, 0.9)",strokeWidth:.3})})})]})}function
|
|
27
|
-
return m("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:Array.from({length:4}).map((e,t)=>/* @__PURE__ */m("div",{className:"absolute left-0 right-0",style:{top:10+22*t+"%",height:"14px",background:"linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.55) 50%, rgba(255,255,255,0) 100%)",filter:"blur(2px)",animation:`wx-fog-drift ${10+3*t}s ease-in-out ${.7*t}s infinite alternate`}},t))})}function
|
|
28
|
-
/* @__PURE__ */m(k,{tone:t?"light":"dark"})]}):3===e?/* @__PURE__ */m(k,{tone:t?"light":"dark"}):45===e||48===e?/* @__PURE__ */m(
|
|
26
|
+
/* @__PURE__ */m("div",{className:"absolute inset-y-0 right-1/3 flex items-center justify-center pointer-events-none",style:{animation:"wx-bolt 6s ease-out infinite"},children:/* @__PURE__ */m("svg",{viewBox:"0 0 18 60",className:"h-4/5",style:{filter:"drop-shadow(0 0 6px rgba(255, 240, 150, 0.95)) drop-shadow(0 0 14px rgba(255, 220, 90, 0.7))"},children:/* @__PURE__ */m("path",{d:"M11 0 L2 28 L8 30 L4 60 L16 24 L9 22 Z",fill:"rgba(255, 250, 200, 0.98)",stroke:"rgba(255, 255, 255, 0.9)",strokeWidth:.3})})})]})}function I(){/* @__PURE__ */
|
|
27
|
+
return m("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:Array.from({length:4}).map((e,t)=>/* @__PURE__ */m("div",{className:"absolute left-0 right-0",style:{top:10+22*t+"%",height:"14px",background:"linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.55) 50%, rgba(255,255,255,0) 100%)",filter:"blur(2px)",animation:`wx-fog-drift ${10+3*t}s ease-in-out ${.7*t}s infinite alternate`}},t))})}function $({code:e,isDay:t}){return 0===e||1===e?/* @__PURE__ */m(t?w:v,{}):2===e?/* @__PURE__ */p(h,{children:[/* @__PURE__ */m(t?w:v,{}),
|
|
28
|
+
/* @__PURE__ */m(k,{tone:t?"light":"dark"})]}):3===e?/* @__PURE__ */m(k,{tone:t?"light":"dark"}):45===e||48===e?/* @__PURE__ */m(I,{}):[51,53,61,80,81].includes(e)?/* @__PURE__ */m(N,{}):[55,63,65,82].includes(e)?/* @__PURE__ */m(N,{heavy:!0}):[71,73,75].includes(e)?/* @__PURE__ */m(j,{}):[95,96,99].includes(e)?/* @__PURE__ */m(S,{}):null}function F(){const[r,w]=l(g),[v,k]=l(()=>n(f)),[N,j]=l(null),[S,I]=l(!0),[,F]=l(0);c(()=>{const e=setInterval(()=>F(e=>e+1),6e4);return()=>clearInterval(e)},[]);const[H,D]=l(!1),[L,T]=l(r),[A,C]=l(v),{prefs:O,save:Z}=o(),W={...y,...O.weather_prefs??{}},[z,X]=l(W);s(d(()=>{T(r),C({...v}),X({...W}),D(!0)},[r,v,W])),c(()=>{let t=!1;return I(!0),e(r).then(e=>{t||(j(e),I(!1))}),()=>{t=!0}},[r]);const B=e=>W.useFahrenheit?`${x(e)}°F`:`${e}°`;if(S&&!N)/* @__PURE__ */
|
|
29
29
|
return m("div",{className:"flex items-center justify-center h-full bg-gradient-to-b from-sky-400 to-blue-500 rounded-lg text-white/80 text-xs",style:{minHeight:110},children:"Loading…"});if(!N)/* @__PURE__ */
|
|
30
|
-
return m("div",{className:"flex items-center justify-center h-full bg-slate-700 rounded-lg text-white/80 text-xs",style:{minHeight:110},children:"Couldn't load weather"});const[J,M,
|
|
30
|
+
return m("div",{className:"flex items-center justify-center h-full bg-slate-700 rounded-lg text-white/80 text-xs",style:{minHeight:110},children:"Couldn't load weather"});const[J,M,P]=t(N.code,N.isDay);/* @__PURE__ */
|
|
31
31
|
return p(h,{children:[
|
|
32
32
|
/* @__PURE__ */m("style",{children:"\n@keyframes wx-rain-a { 0% { transform: translate(0,-20px); opacity: 0; } 10% { opacity: 0.95; } 100% { transform: translate(8px,140px); opacity: 0; } }\n@keyframes wx-rain-b { 0% { transform: translate(0,-20px); opacity: 0; } 12% { opacity: 0.85; } 100% { transform: translate(12px,140px); opacity: 0; } }\n@keyframes wx-rain-c { 0% { transform: translate(0,-20px); opacity: 0; } 10% { opacity: 1; } 100% { transform: translate(5px,140px); opacity: 0; } }\n@keyframes wx-snow-a { 0% { transform: translate(0,-12px) rotate(0deg); opacity: 0; } 10% { opacity: 0.9; } 50% { transform: translate(10px,55px) rotate(180deg); } 100% { transform: translate(-4px,140px) rotate(360deg); opacity: 0; } }\n@keyframes wx-snow-b { 0% { transform: translate(0,-12px) rotate(0deg); opacity: 0; } 10% { opacity: 0.85; } 50% { transform: translate(-12px,55px) rotate(-180deg); } 100% { transform: translate(6px,140px) rotate(-360deg); opacity: 0; } }\n@keyframes wx-snow-c { 0% { transform: translate(0,-12px); opacity: 0; } 10% { opacity: 0.7; } 100% { transform: translate(2px,140px); opacity: 0; } }\n@keyframes wx-drift-cloud { 0% { transform: translateX(-40%); } 100% { transform: translateX(140%); } }\n@keyframes wx-twinkle { 0%, 100% { opacity: 0.25; transform: scale(1); } 50% { opacity: 1; transform: scale(1.6); } }\n@keyframes wx-flash { 0%, 86%, 100% { opacity: 0; } 87% { opacity: 0.95; } 88% { opacity: 0.15; } 89% { opacity: 0.85; } 90% { opacity: 0; } }\n@keyframes wx-bolt { 0%, 86%, 90%, 100% { opacity: 0; } 87% { opacity: 1; } 89% { opacity: 0.85; } }\n@keyframes wx-sun-pulse { 0%, 100% { transform: scale(1); opacity: 0.65; } 50% { transform: scale(1.12); opacity: 0.95; } }\n@keyframes wx-sun-rays { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }\n@keyframes wx-fog-drift { 0% { transform: translateX(-25%); opacity: 0.3; } 50% { opacity: 0.65; } 100% { transform: translateX(25%); opacity: 0.3; } }\n@keyframes wx-shooting-star { 0%, 95% { opacity: 0; transform: translate(0,0) scale(0); } 96% { opacity: 1; transform: translate(0,0) scale(1); } 100% { opacity: 0; transform: translate(40px,30px) scale(1); } }\n"}),
|
|
33
|
-
/* @__PURE__ */m("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:`rgba(15, 23, 42, ${v.activeOpacity/100})`,backdropFilter:v.activeBlur>0?`blur(${v.activeBlur}px)`:void 0},children:/* @__PURE__ */p("div",{className:`relative rounded-lg overflow-hidden text-white bg-gradient-to-br ${
|
|
34
|
-
/* @__PURE__ */m(
|
|
33
|
+
/* @__PURE__ */m("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:`rgba(15, 23, 42, ${v.activeOpacity/100})`,backdropFilter:v.activeBlur>0?`blur(${v.activeBlur}px)`:void 0},children:/* @__PURE__ */p("div",{className:`relative rounded-lg overflow-hidden text-white bg-gradient-to-br ${P}`,style:{height:110},children:[
|
|
34
|
+
/* @__PURE__ */m($,{code:N.code,isDay:N.isDay}),
|
|
35
35
|
/* @__PURE__ */p("div",{className:"relative z-10 px-3 py-2.5 flex flex-col h-full justify-between",children:[
|
|
36
36
|
/* @__PURE__ */p("div",{className:"flex items-start justify-between gap-2",children:[
|
|
37
37
|
/* @__PURE__ */p("div",{className:"min-w-0 flex-1",children:[
|
|
38
|
-
/* @__PURE__ */m("div",{className:"text-base font-semibold leading-tight truncate drop-shadow-sm",children:N.city}),
|
|
39
|
-
/* @__PURE__ */m("div",{className:"text-3xl font-extralight leading-none tracking-tight tabular-nums shrink-0 drop-shadow-sm",children:
|
|
38
|
+
/* @__PURE__ */m("div",{className:"text-base font-semibold leading-tight truncate drop-shadow-sm",children:N.city}),W.showLocalTime&&/* @__PURE__ */m("div",{className:"text-[10px] opacity-90 leading-tight tabular-nums drop-shadow-sm",children:b(N.timezone,W.use24Hour)})]}),
|
|
39
|
+
/* @__PURE__ */m("div",{className:"text-3xl font-extralight leading-none tracking-tight tabular-nums shrink-0 drop-shadow-sm",children:B(N.temp)})]}),
|
|
40
40
|
/* @__PURE__ */p("div",{className:"flex items-end justify-between gap-2",children:[
|
|
41
41
|
/* @__PURE__ */p("div",{className:"flex items-center gap-1.5 min-w-0",children:[
|
|
42
42
|
/* @__PURE__ */m("span",{className:"text-lg leading-none drop-shadow-sm",children:M}),
|
|
43
43
|
/* @__PURE__ */m("span",{className:"text-[11px] font-medium drop-shadow-sm truncate",children:J})]}),
|
|
44
|
-
/* @__PURE__ */p("span",{className:"text-[10px] opacity-90 tabular-nums drop-shadow-sm shrink-0",children:["H:",
|
|
45
|
-
/* @__PURE__ */p(i,{open:
|
|
44
|
+
/* @__PURE__ */p("span",{className:"text-[10px] opacity-90 tabular-nums drop-shadow-sm shrink-0",children:["H:",B(N.high)," L:",B(N.low)]})]})]})]})}),
|
|
45
|
+
/* @__PURE__ */p(i,{open:H,onClose:()=>D(!1),title:"Weather Settings",appearance:A,onAppearanceChange:C,onSave:()=>{w(L),k(A),Z({weather_prefs:z}),localStorage.setItem(u,L),localStorage.setItem(f,JSON.stringify(A)),D(!1)},children:[
|
|
46
46
|
/* @__PURE__ */m("div",{className:"space-y-3",children:/* @__PURE__ */p("div",{children:[
|
|
47
47
|
/* @__PURE__ */m("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Display"}),
|
|
48
48
|
/* @__PURE__ */p("div",{className:"flex items-center gap-3 mb-2",children:[
|
|
49
49
|
/* @__PURE__ */m("span",{className:"text-sm text-gray-600 w-24",children:"Temperature"}),
|
|
50
|
-
/* @__PURE__ */m("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */m("button",{onClick:()=>
|
|
50
|
+
/* @__PURE__ */m("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */m("button",{onClick:()=>X(t=>({...t,useFahrenheit:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(z.useFahrenheit===e.key?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-700 border-gray-300 hover:bg-gray-50"),children:e.label},String(e.key)))})]}),
|
|
51
51
|
/* @__PURE__ */p("div",{className:"flex items-center gap-3 mb-2",children:[
|
|
52
52
|
/* @__PURE__ */m("span",{className:"text-sm text-gray-600 w-24",children:"Time Format"}),
|
|
53
|
-
/* @__PURE__ */m("div",{className:"flex gap-1",children:[{key:!1,label:"AM/PM"},{key:!0,label:"24H"}].map(e=>/* @__PURE__ */m("button",{onClick:()=>
|
|
53
|
+
/* @__PURE__ */m("div",{className:"flex gap-1",children:[{key:!1,label:"AM/PM"},{key:!0,label:"24H"}].map(e=>/* @__PURE__ */m("button",{onClick:()=>X(t=>({...t,use24Hour:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(z.use24Hour===e.key?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-700 border-gray-300 hover:bg-gray-50"),children:e.label},String(e.key)))})]}),
|
|
54
54
|
/* @__PURE__ */p("label",{className:"flex items-center gap-2 cursor-pointer",children:[
|
|
55
|
-
/* @__PURE__ */m("input",{type:"checkbox",checked:
|
|
55
|
+
/* @__PURE__ */m("input",{type:"checkbox",checked:z.showLocalTime,onChange:e=>X(t=>({...t,showLocalTime:e.target.checked})),className:"rounded border-gray-300 text-blue-600 h-3.5 w-3.5"}),
|
|
56
56
|
/* @__PURE__ */m("span",{className:"text-sm text-gray-600",children:"Show local time"})]})]})}),
|
|
57
57
|
/* @__PURE__ */p("div",{children:[
|
|
58
58
|
/* @__PURE__ */m("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"City"}),
|
|
59
|
-
/* @__PURE__ */m("select",{value:
|
|
59
|
+
/* @__PURE__ */m("select",{value:L,onChange:e=>T(e.target.value),className:"w-full bg-gray-50 border border-gray-200 rounded px-2 py-1.5 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:Object.keys(a).map(e=>/* @__PURE__ */m("option",{value:e,children:e},e))}),
|
|
60
60
|
/* @__PURE__ */m("p",{className:"mt-1 text-[10px] text-gray-400",children:"Auto-detected from your timezone; change if needed."})]})]})]})}export{F as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{AVAILABLE_CITIES as e,fetchCityWeather as t,getCondition as r,toFahrenheit as a}from"./chunk-FBDZGO3V.js";import{loadAppearance as n,WidgetSettingsModal as i}from"./chunk-
|
|
1
|
+
import{AVAILABLE_CITIES as e,fetchCityWeather as t,getCondition as r,toFahrenheit as a}from"./chunk-FBDZGO3V.js";import{loadAppearance as n,WidgetSettingsModal as i}from"./chunk-MIAJQGWE.js";import{useWidgetSettings as s}from"./chunk-SBDIHKLU.js";import"./chunk-DSSLOQDW.js";import"./chunk-GMMTTWHB.js";import{useShellPrefs as c}from"./chunk-PQLVWCUI.js";import"./chunk-5A7MWTXX.js";import"./chunk-OGXU7QFW.js";import"./chunk-ZZKIKW62.js";import"./chunk-ZDF5AR5W.js";import"./chunk-AFYQTVZO.js";import"./chunk-HZZNJHRH.js";import"./chunk-X4FJ54PP.js";import"./chunk-D65T4H6J.js";import"./chunk-XUF7VW4U.js";import"./chunk-J3LIIIHJ.js";import"./chunk-C3QOHMR6.js";import"./chunk-YKZHOXI4.js";import{useState as l,useEffect as o,useCallback as m}from"react";import{jsxs as h,Fragment as d,jsx as p}from"react/jsx-runtime";var u="world_clock_appearance",g=["London","Shanghai","New York"];function x(){const{prefs:x,save:y}=c(),[b,f]=l(()=>n(u)),[k,v]=l(!1),[N,j]=l([]),[w,F]=l(b),C={useFahrenheit:!!x.weather_prefs?.useFahrenheit},[I,D]=l(C),[O,S]=l(()=>/* @__PURE__ */new Date);o(()=>{const e=setInterval(()=>S(/* @__PURE__ */new Date),3e4);return()=>clearInterval(e)},[]);const W=Object.fromEntries(Object.entries(e).map(([e,t])=>[t.tz,e])),H=x.world_clocks,T=(()=>{if(!Array.isArray(H)||0===H.length)return g;const t=[];for(const r of H){const a=e[r]?r:W[r];a&&!t.includes(a)&&t.push(a)}return t.length?t:g})(),[Z,L]=l({}),[U,A]=l(!0);o(()=>{let e=!1;return A(!0),(async()=>{const r={};await Promise.all(T.map(async e=>{const a=await t(e);a&&(r[e]=a)})),e||(L(r),A(!1))})(),()=>{e=!0}},[T.join(",")]),s(m(()=>{j([...T]),F({...b}),D({...C}),v(!0)},[T.join(","),b,C.useFahrenheit]));const J=e=>C.useFahrenheit?`${a(e)}°`:`${e}°`;/* @__PURE__ */
|
|
2
2
|
return h(d,{children:[
|
|
3
|
-
/* @__PURE__ */p("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${b.activeOpacity/100})`,backdropFilter:b.activeBlur>0?`blur(${b.activeBlur}px)`:void 0},children:/* @__PURE__ */h("div",{className:"divide-y divide-gray-200",children:[
|
|
3
|
+
/* @__PURE__ */p("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${b.activeOpacity/100})`,backdropFilter:b.activeBlur>0?`blur(${b.activeBlur}px)`:void 0},children:/* @__PURE__ */h("div",{className:"divide-y divide-gray-200",children:[U&&T.every(e=>!Z[e])&&/* @__PURE__ */p("div",{className:"px-3 py-6 text-center text-xs text-gray-500",children:"Loading…"}),T.map(t=>{const a=Z[t],n=e[t]?.tz??"UTC",{time:i,ampm:s}=function(e,t){try{const r=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",hour12:!0}).formatToParts(t),a=r.find(e=>"hour"===e.type)?.value||"12";return{time:`${a}:${r.find(e=>"minute"===e.type)?.value||"00"}`,ampm:(r.find(e=>"dayPeriod"===e.type)?.value||"").toUpperCase()}}catch{return{time:"",ampm:""}}}(n,O);if(!a)/* @__PURE__ */
|
|
4
4
|
return h("div",{className:"px-4 py-3",children:[
|
|
5
5
|
/* @__PURE__ */h("div",{className:"flex items-baseline justify-between gap-2",children:[
|
|
6
6
|
/* @__PURE__ */p("span",{className:"text-[15px] font-semibold tracking-tight text-gray-900 truncate",children:t}),
|
|
@@ -19,12 +19,12 @@ return h("div",{className:"px-4 py-3",children:[
|
|
|
19
19
|
/* @__PURE__ */p("span",{className:"text-gray-300 shrink-0",children:"·"}),
|
|
20
20
|
/* @__PURE__ */p("span",{className:"truncate",children:c})]}),
|
|
21
21
|
/* @__PURE__ */h("span",{className:"tabular-nums text-gray-500 shrink-0",children:["H:",J(a.high)," L:",J(a.low)]})]})]},t)})]})}),
|
|
22
|
-
/* @__PURE__ */h(i,{open:k,onClose:()=>v(!1),title:"World Clock Settings",appearance:w,onAppearanceChange:F,onSave:()=>{0!==N.length&&(y({world_clocks:N,weather_prefs:{...x.weather_prefs??{},useFahrenheit:
|
|
22
|
+
/* @__PURE__ */h(i,{open:k,onClose:()=>v(!1),title:"World Clock Settings",appearance:w,onAppearanceChange:F,onSave:()=>{0!==N.length&&(y({world_clocks:N,weather_prefs:{...x.weather_prefs??{},useFahrenheit:I.useFahrenheit}}),f(w),localStorage.setItem(u,JSON.stringify(w)),v(!1))},children:[
|
|
23
23
|
/* @__PURE__ */h("div",{children:[
|
|
24
24
|
/* @__PURE__ */p("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Display"}),
|
|
25
25
|
/* @__PURE__ */h("div",{className:"flex items-center gap-3 mb-2",children:[
|
|
26
26
|
/* @__PURE__ */p("span",{className:"text-sm text-gray-600 w-24",children:"Temperature"}),
|
|
27
|
-
/* @__PURE__ */p("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */p("button",{onClick:()=>
|
|
27
|
+
/* @__PURE__ */p("div",{className:"flex gap-1",children:[{key:!1,label:"°C"},{key:!0,label:"°F"}].map(e=>/* @__PURE__ */p("button",{onClick:()=>D(t=>({...t,useFahrenheit:e.key})),className:"px-3 py-1 text-xs font-medium rounded-lg border transition-colors "+(I.useFahrenheit===e.key?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-700 border-gray-300 hover:bg-gray-50"),children:e.label},String(e.key)))})]}),
|
|
28
28
|
/* @__PURE__ */p("p",{className:"text-[10px] text-gray-400 mt-1",children:"Shared with the Weather widget."})]}),
|
|
29
29
|
/* @__PURE__ */h("div",{children:[
|
|
30
30
|
/* @__PURE__ */p("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Cities"}),
|
package/dist/apps/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export{openFilesInTrashMode,setFilesDemoTree}from"../chunk-
|
|
2
|
+
export{openFilesInTrashMode,setFilesDemoTree}from"../chunk-P4SGJTK3.js";export{setBrowserStartUrl}from"../chunk-LWLCNQY7.js";export{BUILTIN_APP_INFO}from"../chunk-MSIN5HKX.js";import"../chunk-LMIQV3NB.js";import{setPdfPreview as e}from"../chunk-ESL5TDNA.js";export{setPdfPreview}from"../chunk-ESL5TDNA.js";import{setSpreadsheetPreview as t}from"../chunk-VTVSMRFX.js";export{setSpreadsheetPreview}from"../chunk-VTVSMRFX.js";import"../chunk-SBDIHKLU.js";import"../chunk-DSSLOQDW.js";import"../chunk-GMMTTWHB.js";import"../chunk-OD5KLVU5.js";import{toast_default as o}from"../chunk-3DGTIWZP.js";import"../chunk-PQLVWCUI.js";import"../chunk-5A7MWTXX.js";import"../chunk-OGXU7QFW.js";import"../chunk-ZZKIKW62.js";import"../chunk-ZDF5AR5W.js";import"../chunk-AFYQTVZO.js";import"../chunk-HZZNJHRH.js";import"../chunk-X4FJ54PP.js";import"../chunk-D65T4H6J.js";import"../chunk-XUF7VW4U.js";import{currentShellStrings as r}from"../chunk-J3LIIIHJ.js";import"../chunk-C3QOHMR6.js";import"../chunk-YKZHOXI4.js";import{lazy as n}from"react";function i(e){const t=/\.([a-z0-9]+)(?:[?#].*)?$/i.exec((e||"").trim());return t?t[1].toLowerCase():""}var s=/* @__PURE__ */new Set(["csv","tsv"]),c=/* @__PURE__ */new Set(["xlsx","xls","xlsm","ods"]),l=/* @__PURE__ */new Set(["png","jpg","jpeg","gif","webp","bmp","svg","avif"]),a=/* @__PURE__ */new Set(["step","stp","stl","obj","gltf","glb","3mf","iges","igs"]);function m(e){const t=i(e);return"pdf"===t?"pdf":"dxf"===t?"dxf":s.has(t)?"csv":l.has(t)?"image":a.has(t)?"3d":null}function p(e){window.open(e,"_blank","noopener,noreferrer")}async function u(e,t,o){if(t.fetchBlob)return(await t.fetchBlob(o)).text();const r=await fetch(e);if(!r.ok)throw new Error(`fetch failed: ${r.status}`);return r.text()}function d(e,t){return(e instanceof Error?e.message:"")||t}async function h(n,s,l={}){const a=r().attachment,h=n?.url||"",f=n?.filename||a.fallbackName;if(!h&&!l.fetchBlob)return void o.error(a.noLink);const j=m(f)??m(h);if("csv"===j){try{t({csv:await u(h,l,n),filename:f}),s("/spreadsheet")}catch{o.error(a.spreadsheetFailed),h&&p(h)}return}if(c.has(i(f)||i(h)))return o.error(a.workbookUnavailable),void(h&&p(h));if(!j)return h?(o.info(a.noViewer),void p(h)):void o.error(a.noLink);if(!l.fetchBlob)return e({url:h,filename:f,kind:j}),void s("/preview");const k=e({filename:f,kind:j,converting:!0,convertingMessage:l.loadingMessage||a.loading});s("/preview");try{const e=await l.fetchBlob(n);k.update({url:URL.createObjectURL(e),filename:f,kind:j})}catch(e){k.update({filename:f,kind:j,converting:!1,convertingMessage:d(e,a.loadFailed)})}}var f=n(()=>import("../Calculator-4K53PFBL.js")),j=n(()=>import("../Spreadsheet-7NUDGOSX.js")),k=n(()=>import("../Weather-S3N5OWYF.js")),w=n(()=>import("../CurrencyConverter-QEG6RFAS.js")),g=n(()=>import("../PomodoroTimer-T6YAQFIE.js")),S=n(()=>import("../Notepad-CNZEWFCR.js")),v=n(()=>import("../WorldClock-ACC3S6OA.js")),b=n(()=>import("../Stock-BZFC2ROU.js")),I=n(()=>import("../Preview-OOVIIQQG.js")),F=n(()=>import("../PdfViewer-UZGDE4HD.js")),x=n(()=>import("../Documents-SFNMDRYU.js")),y=n(()=>import("../Files-OX2UBSQQ.js")),T=n(()=>import("../Browser-QYHW6I6J.js")),P={"/calculator":{component:f,label:"Calculator",size:"sm",allowPinOnTop:!0,utility:!0,widget:!0,dimensions:[280,420]},"/spreadsheet":{component:j,label:"Spreadsheets",size:"2xl",appStyle:!0,multiInstance:!0},"/notepad":{component:S,label:"Notepad",size:"lg",allowPinOnTop:!0,flushBody:!0},"/weather":{component:k,label:"Weather",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,400]},"/currency":{component:w,label:"Currency Converter",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,480]},"/pomodoro":{component:g,label:"Pomodoro Timer",size:"sm",utility:!0,widget:!0,dimensions:[320,600]},"/world-clock":{component:v,label:"World Clock",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,480]},"/stock":{component:b,label:"Stocks",size:"sm",utility:!0,widget:!0,autoHeight:!0,dimensions:[320,360]}},C={"/preview":{component:I,label:"Preview",size:"2xl",appStyle:!0,multiInstance:!0},"/documents":{component:x,label:"Documents",size:"xl",appStyle:!0,multiInstance:!0},"/files":{component:y,label:"Files",size:"xl",appStyle:!0}},L={"/browser":{component:T,label:"Browser",size:"2xl",appStyle:!0,multiInstance:!0}},O={...P,...C,...L};export{T as Browser,f as Calculator,w as CurrencyConverter,x as Documents,y as Files,S as Notepad,F as PdfViewer,g as PomodoroTimer,I as Preview,j as Spreadsheet,b as Stock,k as Weather,v as WorldClock,m as attachmentKind,O as bundledApps,C as documentApps,h as openAttachment,P as utilityApps,L as webApps};
|
package/dist/bin/ui-check.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{execFileSync as e}from"child_process";import{createRequire as t}from"module";import{join as n}from"path";import{existsSync as i,readFileSync as o,writeFileSync as s,readdirSync as r}from"fs";var a=["button","input","range","textarea","select","dialog","title","portal","native","dark","hex","radius","kit","icon","kit-dep"],l=e=>"string"==typeof e&&a.includes(e),c={button:{counts:"a raw <button>",instead:"Button or IconButton from efficient-shell/ui"},input:{counts:"a raw <input> (not hidden, not a range)",instead:"Input, InputNumber, Checkbox, Radio or Switch from efficient-shell/ui"},range:{counts:'a raw <input type="range">',instead:"Slider from efficient-shell/ui"},textarea:{counts:"a raw <textarea>",instead:"Textarea from efficient-shell/ui"},select:{counts:"a raw <select>",instead:"Select or SearchableSelect from efficient-shell/ui"},dialog:{counts:'a raw <dialog>, or role="dialog" / role="alertdialog" on a raw element',instead:"Dialog or Modal from efficient-shell"},title:{counts:"a title= on a raw element (the browser's own tooltip)",instead:"Tooltip from efficient-shell/ui (harness UI-17)"},portal:{counts:"a createPortal(…) call (a layer the file floats itself)",instead:"Popover, PopupMenu, DropdownMenu, Tooltip or Dialog from efficient-shell/ui"},native:{counts:"window.confirm / alert / prompt, or a bare call that resolves to one",instead:"confirm, confirmDestructive, prompt or toast from efficient-shell (harness UI-20)"},dark:{counts:"a dark: variant in a class string",instead:"the light Tailwind class alone; the shell remaps it in dark mode (harness UI-7)"},hex:{counts:"a hex colour literal in a .tsx string",instead:"a shell token or a Tailwind palette class (harness FT-1)"},radius:{counts:"a literal corner radius (an arbitrary-value radius class, or an inline borderRadius)",instead:"a radius utility from the scale or a role token such as rounded-(--radius-control); the theme sets how round they are (harness UI-7)"},kit:{counts:"an import of a second UI kit",instead:"the component from efficient-shell/ui, or fold it into the shell (harness FT-3)"},icon:{counts:"an import of an icon package",instead:"<Icon name> from efficient-shell/icons, drawn by the set the theme chose (harness UI-24)"},"kit-dep":{counts:"a UI kit or icon package declared in package.json (not one the shell entries imported here need)",instead:"remove the dependency once nothing imports it (harness FT-3)"}},d=["@headlessui/","@radix-ui/","@mui/","@chakra-ui/","@mantine/","@floating-ui/","antd","react-aria","react-aria-","react-bootstrap","react-select","react-colorful","react-tooltip","react-hot-toast","react-toastify","sonner"],u=["@heroicons/","@tabler/icons","@tabler/icons-","@phosphor-icons/","@fortawesome/","@iconify/","@radix-ui/react-icons","@mui/icons-material","lucide","lucide-react","simple-icons","react-icons","react-feather"],f={"efficient-shell":["@headlessui/react","@heroicons/react"],"efficient-shell/apps":["@heroicons/react"],"efficient-shell/icons/heroicons":["@heroicons/react"],"efficient-shell/icons/lucide":["lucide-react"]};function h(e,t){return t.some(t=>t.endsWith("/")||t.endsWith("-")?e.startsWith(t):e===t||e.startsWith(`${t}/`))}function p(e){return h(e,u)?"icon":h(e,d)?"kit":null}var m=/[.+^$()|[\]\\]/g;function g(e){let t="",n=0;for(let i=0;i<e.length;i++){const o=e[i];"*"===o?"*"===e[i+1]?"/"===e[i+2]?(t+="(?:[^/]+/)*",i+=2):(t+=".*",i+=1):t+="[^/]*":"?"===o?t+="[^/]":"{"===o?(t+="(?:",n+=1):"}"===o&&n>0?(t+=")",n-=1):t+=","===o&&n>0?"|":o.replace(m,"\\$&")}if(0!==n)throw new Error(`unbalanced { in glob "${e}"`);return new RegExp(`^${t}$`)}function k(e){const t=e.map(g);return e=>t.some(t=>t.test(e))}var $=new Set(["node_modules",".git"]),w=new Set(["dist","coverage",".next",".turbo"]);function b(e){const t=e.search(/[*?{]/),n=-1===t?e:e.slice(0,t),i=n.lastIndexOf("/");return-1===i?"":n.slice(0,i)}function y(e,t){const i=k(t),o=[...new Set(t.map(b))].sort(),s=o.filter(e=>!o.some(t=>t!==e&&(""===t||e.startsWith(`${t}/`)))),a=new Set,l=t=>{let o;try{o=r(n(e,t),{withFileTypes:!0})}catch{return}for(const e of o){const n=t?`${t}/${e.name}`:e.name;e.isDirectory()?$.has(e.name)||""===t&&w.has(e.name)||l(n):e.isFile()&&i(n)&&a.add(n)}};for(const e of s)l(e);return[...a].sort(x)}var x=(e,t)=>e<t?-1:e>t?1:0,v=class extends Error{},S=(e,t)=>`${e}:${t}`;function j(e){const t=e.lastIndexOf(":");return{file:e.slice(0,t),kind:e.slice(t+1)}}var I=e=>a.indexOf(e);function T(e,t){const n=j(e),i=j(t);return x(n.file,i.file)||I(n.kind)-I(i.kind)}function A(e,t="ui-kit.baseline.json"){let n;try{n=JSON.parse(e)}catch(e){throw new v(`${t} is not valid JSON: ${e.message}`)}const i=e=>{throw new v(`${t}: ${e}. The tool writes this file; do not edit it by hand.`)};if("object"!=typeof n||null===n||Array.isArray(n))return i("must be a JSON object");const o=n;if(1!==o.schema)return i("number"==typeof o.schema&&o.schema>1?`"schema": ${o.schema} is newer than this efficient-shell reads (1); upgrade efficient-shell`:'"schema" must be 1');if(!Array.isArray(o.kinds)||o.kinds.some(e=>"string"!=typeof e))return i('"kinds" must be a list');const s=o.kinds.filter(l);if("object"!=typeof o.counts||null===o.counts||Array.isArray(o.counts))return i('"counts" must be an object');const r=new Map;for(const[e,t]of Object.entries(o.counts)){const{file:n,kind:o}=j(e);if(!n||!o)return i(`"${e}" is not "<file>:<kind>"`);if("number"!=typeof t||!Number.isInteger(t)||t<1)return i(`"${e}" must be a whole number, 1 or more (a line that reaches 0 is deleted)`);l(o)&&r.set(e,t)}return{kinds:s,counts:r}}function E(e){const t=a.filter(t=>e.kinds.includes(t)),n=[...e.counts.keys()].filter(t=>(e.counts.get(t)??0)>0).sort(T).map(t=>` ${JSON.stringify(t)}: ${e.counts.get(t)}`);return["{",' "schema": 1,',` "kinds": [${t.map(e=>JSON.stringify(e)).join(", ")}],`,n.length?` "counts": {\n${n.join(",\n")}\n }`:' "counts": {}',"}",""].join("\n")}function M(e){const t={};for(const[n,i]of e){const{kind:e}=j(n);l(e)&&(t[e]=(t[e]??0)+i)}return t}var O=class extends Error{},D=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),N=new Set(["$schema","schema","kinds","include","exclude","includeImporting","output","allow"]);var R="package.json",L=new Set(["iframe","frame","object","embed"]),F=new Set(["href","xlinkHref","to","id","key","htmlFor"]),J=/(?<![&\w])(?<!url\()#(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{6}|[0-9a-fA-F]{3,4})(?![\w-])/g,P=/(?<![\w-])rounded(?:-(?:[trblse]|tl|tr|br|bl|ss|se|ee|es))?-\[([^\]]*)\]/g,U=/^border(?:(?:Top|Bottom)(?:Left|Right)|(?:Start|End)(?:Start|End))?Radius$/,B=/^(?:inherit|initial|unset|revert)$|var\(|^(?:50|100)%$|^(?:999|9999)(?:px)?$/,W=/(?<![\w-])dark:(?=[\w[\-!@*(])/g,C=new Set(["confirm","alert","prompt"]),q=new Set(["window","globalThis","self"]);function z(e,t,n,i,o){const s=new Set(i),r=e.createSourceFile(t,n,e.ScriptTarget.Latest,!0,function(e,t){return t.endsWith(".tsx")?e.ScriptKind.TSX:t.endsWith(".jsx")?e.ScriptKind.JSX:/\.[cm]?js$/.test(t)?e.ScriptKind.JS:e.ScriptKind.TS}(e,t)),a={},l=/\.[jt]sx$/.test(t),c=(e,t)=>{var n;s.has(e)&&(a[e]??=[]).push((n=t.getStart(r),r.getLineAndCharacterOfPosition(n).line+1))},d=(t,n)=>t.attributes.properties.find(t=>e.isJsxAttribute(t)&&t.name.getText(r)===n),u=t=>{const n=t?.initializer;if(n)return e.isStringLiteral(n)?n.text:e.isJsxExpression(n)&&n.expression&&e.isStringLiteralLike(n.expression)?n.expression.text:void 0},f=new Set;if(s.has("native")){const t=n=>{if(n)if(e.isIdentifier(n))C.has(n.text)&&f.add(n.text);else if(e.isObjectBindingPattern(n)||e.isArrayBindingPattern(n))for(const i of n.elements)e.isBindingElement(i)&&t(i.name)},n=i=>{(e.isImportClause(i)||e.isImportSpecifier(i)||e.isNamespaceImport(i)||e.isVariableDeclaration(i)||e.isParameter(i)||e.isFunctionDeclaration(i))&&t(i.name),e.forEachChild(i,n)};n(r)}const h=t=>t&&e.isStringLiteralLike(t)?t.text:void 0,m=(e,t)=>{e&&("efficient-shell"===e||e.startsWith("efficient-shell/"))&&o?.add(e);const n=e?p(e):null;n&&c(n,t)},g=(e,t,n)=>{if(s.has("dark"))for(const n of e.matchAll(W))c("dark",t);if(s.has("radius"))for(const n of e.matchAll(P))B.test(n[1].trim())||c("radius",t);if(n&&l&&s.has("hex"))for(const n of e.matchAll(J))c("hex",t)},k=(t,n)=>{if(e.isJsxOpeningElement(t)||e.isJsxSelfClosingElement(t)){const e=t.tagName.getText(r);if(/^[a-z]/.test(e)){const n=u(d(t,"type"));"button"===e?c("button",t):"select"===e?c("select",t):"textarea"===e?c("textarea",t):"input"===e&&("range"===n?c("range",t):"hidden"!==n&&c("input",t));const i=u(d(t,"role"));"dialog"!==e&&"dialog"!==i&&"alertdialog"!==i||c("dialog",t),!L.has(e)&&d(t,"title")&&c("title",t)}}else if(e.isCallExpression(t)){const n=t.expression;e.isIdentifier(n)?"createPortal"===n.text?c("portal",t):C.has(n.text)&&!f.has(n.text)?c("native",t):"require"===n.text&&m(h(t.arguments[0]),t):e.isPropertyAccessExpression(n)?"createPortal"===n.name.text?c("portal",t):C.has(n.name.text)&&e.isIdentifier(n.expression)&&q.has(n.expression.text)&&c("native",t):n.kind===e.SyntaxKind.ImportKeyword&&m(h(t.arguments[0]),t)}else{if(e.isImportDeclaration(t)||e.isExportDeclaration(t))return void m(h(t.moduleSpecifier),t);if(e.isPropertyAssignment(t)&&s.has("radius")){const n=e.isIdentifier(t.name)||e.isStringLiteralLike(t.name)?t.name.text:"",i=t.initializer;U.test(n)&&(e.isNumericLiteral(i)?B.test(i.text)||c("radius",t):e.isStringLiteralLike(i)&&!B.test(i.text.trim())&&c("radius",t))}else if(e.isStringLiteralLike(t))g(t.text,t,n);else if(e.isTemplateExpression(t)){g(t.head.text,t.head,n);for(const e of t.templateSpans)g(e.literal.text,e.literal,n)}}e.isJsxAttribute(t)&&F.has(t.name.getText(r))?e.forEachChild(t,e=>k(e,!1)):e.forEachChild(t,e=>k(e,n))};return k(r,!0),a}function K(e){const t={};for(const[n,i]of Object.entries(e))i.length&&(t[n]=i.length);return t}function G(e,t,n){const i=e.createSourceFile(t,n,e.ScriptTarget.Latest,!1),o=[];for(const t of i.statements)(e.isImportDeclaration(t)||e.isExportDeclaration(t))&&t.moduleSpecifier&&e.isStringLiteralLike(t.moduleSpecifier)&&o.push(t.moduleSpecifier.text);return o}var _=(e,t)=>e.some(e=>t.some(t=>t.endsWith("/*")?e.startsWith(t.slice(0,-1)):e===t));var H=e=>new Map(e.allow.map(e=>[S(e.file,e.kind),e.count]));function X(e,t){return e.kinds.filter(e=>t.kinds.includes(e))}var V=(e,t,n)=>{if("kit-dep"===n)return` (${e.kitDeps.join(", ")})`;const i=e.hits.get(t)?.[n]??[];if(0===i.length)return"";const o=i.slice(0,12).join(", ");return` (line${1===i.length?"":"s"} ${o}${i.length>12?", …":""})`};function Q(e,t,n){const i=H(e),o=new Map;for(const[e,s]of t.counts){const{kind:t}=j(e);if(!l(t)||!n.includes(t))continue;const r=s-(i.get(e)??0);r>0&&o.set(e,r)}return{kinds:a.filter(e=>n.includes(e)),counts:o}}function Y(e,t){let n=0;for(const i of new Set([...e.keys(),...t.keys()]))(e.get(i)??0)!==(t.get(i)??0)&&(n+=1);return n}var Z="\n// <button> in a comment is not a button\n/* nor is <input title=\"x\"> in this one, or dark:bg-black, or #fff */\nimport { createPortal } from 'react-dom';\nimport { Dialog } from '@headlessui/react';\nimport { TrashIcon } from '@heroicons/react/24/outline';\nimport type { Icon } from 'lucide-react';\nimport { Button, confirm } from 'efficient-shell';\nexport { Slot } from '@radix-ui/react-slot';\nexport { CheckIcon } from '@radix-ui/react-icons';\n\nconst a = <button title=\"Says what it does\">x</button>;\nconst b = <input type=\"range\" />;\nconst c = <input type=\"text\" />;\nconst c2 = <input type={\"hidden\"} name=\"csrf\" />;\nconst c3 = <input type=\"hidden\" />;\nconst c4 = <input type={kind} />;\nconst d = <select />;\nconst d2 = <textarea />;\nconst e = <div role=\"dialog\" />;\nconst e2 = <dialog open />;\nconst e3 = <section role={'alertdialog'} />;\nconst f = <iframe title=\"Preview\" />;\nconst f2 = <object title=\"Chart\" />;\nconst g = <Button title=\"a prop, not a tooltip\" role=\"dialog\" />;\nconst g2 = (\n <button\n type=\"button\"\n title={hint}\n >\n y\n </button>\n);\nconst h = ReactDOM.createPortal(a, document.body);\nconst i = createPortal(a, document.body);\n\nasync function leave() {\n if (window.confirm('Sure?')) return;\n globalThis.alert('No');\n alert('native: nothing binds the name');\n prompt('native too');\n await confirm('the shell: the import binds it');\n record.confirm('a method, not the popup');\n}\n\nconst j = <div className=\"bg-white dark:bg-black dark:hover:text-white is-dark:no\" />;\nconst k = clsx('text-gray-900', on && 'dark:text-gray-100');\nconst l = <span style={{ color: '#fff', background: \"#12ab34\" }} className={`border-[#0a0b0c80] ${x}`} />;\nconst m = <a href=\"#faded\" id=\"#bad\" key=\"#abc\" to=\"#face\">skip</a>;\nconst n = <label htmlFor={'#dead'}>skip</label>;\nconst o = <span>Ӓ and BG#00340 and #12345 and #added are not colours</span>;\nconst p = 'entity  ref BG#00340';\nconst q = <use xlinkHref=\"#abc\" fill=\"url(#fed)\" />;\nconst t = <div className=\"rounded-[4px] rounded-t-[0.5rem] hover:rounded-[2px] rounded-lg rounded-(--radius-card) rounded-[inherit] rounded-[var(--r)]\" />;\nconst u = <div style={{ borderRadius: 6, borderTopLeftRadius: '3px', borderBottomRightRadius: '50%', borderEndEndRadius: 'var(--radius-card)' }} />;\nconst v = <i style={{ borderRadius: 9999 }} />;\nconst r = lazy(() => import('@mui/material'));\nconst s = require('react-select');\n",ee={button:2,input:2,range:1,textarea:1,select:1,dialog:3,title:2,portal:2,native:4,dark:3,hex:3,radius:5,kit:4,icon:3},te={kit:1,dark:1,portal:1,radius:2},ne=e=>a.filter(t=>e[t]).map(t=>`${t} ${e[t]}`).join(", ")||"nothing";var ie="ui-kit.config.json",oe="ui-kit.baseline.json",se="efficient-shell-ui-check",re=`${se}: every surface a person operates takes its UI from efficient-shell (harness UI-24).\n\n ${se} check this repository against ${oe}\n ${se} --print print today's counts as a baseline, and change nothing\n ${se} --summary print totals per kind and per folder, as Markdown\n ${se} --json print the result as JSON\n ${se} --update lower the lines whose counts fell, and delete the ones at zero\n ${se} --update --allow-move also follow a renamed or split file (no total may rise)\n ${se} --init write the first ${oe}\n ${se} --init --kind <kind> take the baseline for a kind just added to "kinds"\n ${se} --no-base do not compare with the pull request's base branch\n\nKinds: ${a.join(", ")}\nReads ${ie} in the current directory.`;var ae=(e,t)=>`${e} ${t}${1===e?"":"s"}`,le=(e,t)=>{const n=M(e);return t.map(e=>`${e} ${n[e]??0}`).join(" · ")};process.exitCode=function(e,t){const r=function(e){const t={print:!1,summary:!1,json:!1,update:!1,allowMove:!1,init:!1,noBase:!1,help:!1,version:!1,kinds:[]};for(let n=0;n<e.length;n++){const i=e[n];if("--print"===i)t.print=!0;else if("--summary"===i)t.summary=!0;else if("--json"===i)t.json=!0;else if("--update"===i)t.update=!0;else if("--allow-move"===i)t.allowMove=!0;else if("--init"===i)t.init=!0;else if("--no-base"===i)t.noBase=!0;else if("--help"===i||"-h"===i)t.help=!0;else if("--version"===i||"-v"===i)t.version=!0;else if("--kind"===i){const i=e[++n];if(!i)return"--kind needs a kind after it";t.kinds.push(...i.split(","))}else{if(!i.startsWith("--kind="))return`unknown argument "${i}"`;t.kinds.push(...i.slice(7).split(","))}}return t.allowMove&&!t.update?"--allow-move goes with --update":t.kinds.length&&!t.init?"--kind goes with --init":[t.print,t.summary,t.update,t.init].filter(Boolean).length>1?"choose one of --print, --summary, --update and --init":t}(e);if("string"==typeof r)return t.err(`${se}: ${r}\n\n${re}`),2;if(r.help)return t.out(re),0;if(r.version)return t.out(t.version),0;const d=e=>(r.json?t.out(JSON.stringify({tool:se,version:t.version,ok:!1,failures:[e]},null,2)):t.err(`${se}: ${e}`),1),u=n(t.cwd,ie);if(!i(u))return d(`no ${ie} in ${t.cwd}. Run it from the repository root; the harness has the template.`);let h,m;try{h=function(e,t="ui-kit.config.json"){const n=[],i=e=>{n.push(e)},o=(e,t,{required:n=!1}={})=>{if(void 0===e&&!n)return[];if(!Array.isArray(e)||e.some(e=>"string"!=typeof e||""===e))return i(`${t} must be a list of non-empty strings`),[];n&&0===e.length&&i(`${t} must name at least one entry`);for(const n of e)(n.startsWith("/")||n.startsWith("./")||n.includes("\\")||n.split("/").includes(".."))&&i(`${t}: "${n}" must be a path from the repository root, written with / (no ./, .. or \\)`);return e},s=(e,t)=>"string"!=typeof e||e.trim().length<10?(i(`${t} needs a "reason" a reviewer can read (a sentence, not a word)`),""):e,r=(e,t)=>void 0===e?[]:!Array.isArray(e)||e.some(e=>!D(e))?(i(`${t} must be a list of objects`),[]):e;if(!D(e))throw new O(`${t}: must be a JSON object`);for(const t of Object.keys(e))N.has(t)||i(`unknown key "${t}"`);1!==e.schema&&i("number"==typeof e.schema&&e.schema>1?`"schema": ${e.schema} is newer than this efficient-shell reads (1); upgrade efficient-shell`:'"schema" must be 1');const c=[];if(Array.isArray(e.kinds)&&0!==e.kinds.length)for(const t of e.kinds)l(t)?c.includes(t)?i(`"kinds": "${t}" is listed twice`):c.push(t):i(`"kinds": unknown kind ${JSON.stringify(t)} (this efficient-shell knows: ${a.join(", ")})`);else i(`"kinds" must list the kinds this repository checks, from: ${a.join(", ")}`);const d=o(e.include,'"include"'),u=o(e.exclude,'"exclude"'),f=r(e.includeImporting,'"includeImporting"').map((e,t)=>({files:o(e.files,`"includeImporting"[${t}].files`,{required:!0}),modules:o(e.modules,`"includeImporting"[${t}].modules`,{required:!0}),reason:s(e.reason,`"includeImporting"[${t}]`)}));0===d.length&&0===f.length&&i('"include" must name the files that are operator UI (for example ["src/**/*.tsx"])');const h=r(e.output,'"output"').map((e,t)=>({files:o(e.files,`"output"[${t}].files`,{required:!0}),reason:s(e.reason,`"output"[${t}]`)})),p=[],m=new Set;if(r(e.allow,'"allow"').forEach((e,t)=>{const n=`"allow"[${t}]`,[r]=o([e.file],`${n}.file`),d=s(e.reason,n);if(!l(e.kind))return void i(`${n}.kind must be one of: ${a.join(", ")}`);if(c.includes(e.kind)||i(`${n}: kind "${e.kind}" is not in "kinds"`),"number"!=typeof e.count||!Number.isInteger(e.count)||e.count<1)return void i(`${n}.count must be a whole number, 1 or more`);if(!r)return;const u=`${r}:${e.kind}`;m.has(u)&&i(`${n}: ${r} already has an allow entry for "${e.kind}"`),m.add(u),p.push({file:r,kind:e.kind,count:e.count,reason:d})}),n.length)throw new O(`${t}:\n - ${n.join("\n - ")}`);return{schema:1,kinds:a.filter(e=>c.includes(e)),include:d,exclude:u,includeImporting:f,output:h,allow:p}}(JSON.parse(o(u,"utf8")),ie)}catch(e){return d(e instanceof O?e.message:`${ie} is not valid JSON: ${e.message}`)}try{m=t.loadTypeScript()}catch{return d('this check reads the TypeScript AST and found no "typescript" package here. Install it as a devDependency.')}const g=function(e){const t=[],n=a.filter(e=>"kit-dep"!==e),i=[["fixture.tsx",Z,ee],["fixture.ts","\nimport { toast } from 'sonner';\nexport const tone = { warn: '#f59e0b' };\nexport const cls = 'ring-1 dark:ring-white rounded-[3px]';\nexport const box = { borderRadius: '0.25rem', radius: 4 };\nexport function ask(confirm: (message: string) => boolean) {\n return confirm('a parameter binds the name');\n}\nexport const mount = (node: unknown) => ReactDOM.createPortal(node, document.body);\n",te]];for(const[o,s,r]of i){const i=K(z(e,o,s,n));n.some(e=>(i[e]??0)!==(r[e]??0))&&t.push(`${o}: read ${ne(i)}; it holds ${ne(r)}`)}const o=K(z(e,"fixture.tsx",Z,["button"]));return"button"!==Object.keys(o).join()&&t.push(`asked for button alone, the reader reported ${ne(o)}`),t}(m);if(g.length)return d(`the reader misread its own fixtures with typescript ${m.version}, so nothing it says about this repository can be trusted:\n - `+g.join("\n - "));const $=function(e,t,s){const r=[],a=k(s.exclude),l=k(s.output.flatMap(e=>e.files)),c=new Map,d=e=>{let i=c.get(e);return void 0===i&&c.set(e,i=o(n(t,e),"utf8")),i},u=(e,n)=>{for(const i of e)0===y(t,[i]).length&&r.push(`${n}: "${i}" matches no file. Delete the line, or fix the path.`)};u(s.include,'"include"'),s.output.forEach((e,t)=>u(e.files,`"output"[${t}]`)),s.includeImporting.forEach((e,t)=>u(e.files,`"includeImporting"[${t}]`));const h=new Set,m=e=>(e=>/\.(?:[cm]?[jt]s|[jt]sx)$/.test(e)&&!e.endsWith(".d.ts"))(e)&&!a(e)&&!l(e);for(const e of y(t,s.include))m(e)&&h.add(e);for(const n of s.includeImporting)for(const i of y(t,n.files))m(i)&&!h.has(i)&&_(G(e,i,d(i)),n.modules)&&h.add(i);const g=[...h].sort(),$=s.kinds.filter(e=>"kit-dep"!==e),w=new Map,b=new Map,x=new Set;for(const t of g){const n=z(e,t,d(t),$,x);let i=!1;for(const e of $){const o=n[e]?.length??0;o&&(b.set(S(t,e),o),i=!0)}i&&w.set(t,n)}let v=[],j=[];if(s.kinds.includes("kit-dep")){const e=n(t,R);if(i(e)){const t=JSON.parse(o(e,"utf8")),n=["dependencies","peerDependencies","optionalDependencies"].flatMap(e=>Object.keys(t[e]??{})),i=new Set([...x].flatMap(e=>f[e]??[])),s=[...new Set(n)].filter(e=>null!==p(e)).sort();v=s.filter(e=>!i.has(e)),j=s.filter(e=>i.has(e)),v.length&&b.set(S(R,"kit-dep"),v.length)}else r.push(`"kinds" includes "kit-dep", and there is no ${R} here to read.`)}for(const e of s.allow)("kit-dep"===e.kind?e.file===R:h.has(e.file))||r.push(`"allow": ${e.file} (${e.kind}) is not a file this check reads. Delete the entry, or fix the path.`);return{files:g,hits:w,counts:b,kitDeps:v,shellPeers:j,problems:r}}(m,t.cwd,h);if(0===$.files.length)return d(`read no files. "include" in ${ie} matches nothing, so a pass would mean nothing.`);const w=n(t.cwd,oe),b=r.json,x=e=>{b||t.out(e)};if(r.print)return t.out(E(Q(h,$,h.kinds)).trimEnd()),0;if(r.summary){for(const e of function(e,t){const n=new Map,i=new Map;for(const[e,o]of t.counts){const{file:t,kind:s}=j(e);if(!l(s))continue;const r=n.get(s)??{count:0,files:new Set};r.count+=o,r.files.add(t),n.set(s,r);const a=t.split("/"),c=a.length>2?a.slice(0,2).join("/"):2===a.length?a[0]:".",d=i.get(c)??{};d[s]=(d[s]??0)+o,i.set(c,d)}const o=e.kinds.filter(e=>n.has(e)),s=[`**UI kit check (harness UI-24):** ${new Set([...t.counts.keys()].map(e=>j(e).file)).size} of ${ae(t.files.length,"file")} still draw UI of their own.`,"","| Kind | Count | Files | The shell has |","|---|---:|---:|---|",...e.kinds.map(e=>{const t=n.get(e);return`| \`${e}\` | ${t?.count??0} | ${t?.files.size??0} | ${c[e].instead} |`})];if(o.length&&i.size){const e=e=>o.reduce((t,n)=>t+(e[n]??0),0),t=[...i].sort((t,n)=>e(n[1])-e(t[1])||(t[0]<n[0]?-1:1));s.push("",`| Folder | ${o.map(e=>`\`${e}\``).join(" | ")} | Total |`,`|---|${o.map(()=>"---:").join("|")}|---:|`,...t.map(([t,n])=>`| \`${t}\` | ${o.map(e=>n[e]??0).join(" | ")} | ${e(n)} |`))}return s}(h,$))t.out(e);return 0}let I=null;if(i(w))try{I=A(o(w,"utf8"),oe)}catch(e){return d(e instanceof v?e.message:String(e))}if(r.init){const e=r.kinds.filter(e=>!l(e)||!h.kinds.includes(e));if(e.length)return d(`--kind ${e.join(", ")}: not in "kinds" in ${ie}. Add it there first.`);const t=r.kinds;if(I){if(0===t.length)return d(`${oe} already exists, and --init would overwrite what it holds. It is for the adoption pull request only. To start checking a kind, add it to "kinds" and run --init --kind <kind>.`);const e=t.filter(e=>I.kinds.includes(e));if(e.length)return d(`the baseline was already taken for ${e.join(", ")}. Its lines only go down; use --update.`);const n=Q(h,$,t);I={kinds:[...I.kinds,...t],counts:new Map([...I.counts,...n.counts])}}else{if(t.length)return d(`there is no ${oe} yet. Run --init on its own first.`);I=Q(h,$,h.kinds)}s(w,E(I)),x(`${se}: wrote ${oe} (${ae(I.counts.size,"line")}: ${le(I.counts,I.kinds)})`)}if(!I)return d(`no ${oe}. This repository has not adopted the check yet: run ${se} --init, and commit the file.`);if(r.update){const e=function(e,t,n,{allowMove:i=!1}={}){const o=X(e,t),s=Q(e,n,o),r=new Map([...t.counts].filter(([e])=>o.includes(j(e).kind)));if(i){const e=M(r),n=M(s.counts),i=o.filter(t=>(n[t]??0)>(e[t]??0)).map(t=>`${t}: ${n[t]??0} across the repository, and the baseline holds ${e[t]??0}`);return i.length?{baseline:t,lowered:0,refused:i}:{baseline:s,lowered:Y(r,s.counts),refused:[]}}const a=new Map;for(const[e,t]of r){const n=Math.min(t,s.counts.get(e)??0);n>0&&a.set(e,n)}return{baseline:{kinds:o,counts:a},lowered:Y(r,a),refused:[]}}(h,I,$,{allowMove:r.allowMove});if(e.refused.length)return d(`--allow-move follows code that moved, and this is more of it than before:\n - ${e.refused.join("\n - ")}\nNothing was written.`);I=e.baseline,s(w,E(I)),x(`${se}: ${e.lowered?`changed ${ae(e.lowered,"line")} in`:"nothing to change in"} ${oe}`)}const L=function(e,t,n){const i=[],o=[],s=[...n.problems],r=H(e),a=new Set(X(e,t)),d=e.kinds.filter(e=>!t.kinds.includes(e));d.length&&s.push(`"kinds" names ${d.map(e=>`"${e}"`).join(", ")}, and the baseline was never taken for ${1===d.length?"it":"them"}. Run: efficient-shell-ui-check --init ${d.map(e=>`--kind ${e}`).join(" ")}`);const u=t.kinds.filter(t=>!e.kinds.includes(t));u.length&&o.push(`the baseline still carries ${u.map(e=>`"${e}"`).join(", ")}, which "kinds" no longer names`);const f=new Set([...n.counts.keys(),...t.counts.keys(),...r.keys()]);for(const e of[...f].sort(T)){const{file:d,kind:u}=j(e);if(!l(u)||!a.has(u))continue;const f=n.counts.get(e)??0,h=r.get(e)??0,p=t.counts.get(e)??0;f>h+p?i.push(`${d}: ${u} ${f}, and its line allows ${h+p}${V(n,d,u)}. ${c[u].counts} is counted; use ${c[u].instead}.`):f<h?s.push(`${d}: ${u} ${f}, and "allow" in ui-kit.config.json says ${h}. ${0===f?"Delete the entry":`Lower its count to ${f}`}: an exception does not outlive what it excused.`):f<h+p&&o.push(`${d}: ${u} ${f}, and its line says ${h+p}`)}return{grown:i,shrunk:o,other:s,updateFixes:0===i.length&&0===s.length&&o.length>0}}(h,I,$),F=r.noBase?{problems:[],note:""}:function(e,t,n){const i=e.env.GITHUB_BASE_REF;if(!i)return{problems:[],note:""};const o=e.git(["rev-parse","--show-prefix"]);if(null===o)return{problems:[],note:"not a git checkout; the base branch was not compared"};const s=`origin/${i}`;if(null===e.git(["rev-parse","--verify","--quiet",`${s}^{commit}`])&&(e.git(["fetch","--no-tags","--depth=1","origin",`+refs/heads/${i}:refs/remotes/origin/${i}`]),null===e.git(["rev-parse","--verify","--quiet",`${s}^{commit}`])))return{problems:[],note:`${s} could not be fetched; the base branch was not compared`};const r=e.git(["show",`${s}:${o.trim()}${oe}`]);if(null===r)return{problems:[],note:`${s} has no ${oe} yet (adoption)`};let a;try{a=A(r,`${s}:${oe}`)}catch{return{problems:[],note:`${s}'s ${oe} could not be read; the base branch was not compared`}}const l=M(a.counts),d=M(t.counts);return{problems:n.filter(e=>a.kinds.includes(e)&&(d[e]??0)>(l[e]??0)).map(e=>`${oe} holds ${d[e]??0} of "${e}", and ${s} holds ${l[e]??0}. The baseline only goes down: use ${c[e].instead}. A count that is meant to stay goes in "allow" in ${ie}, with its reason.`),note:`compared with ${s}`}}(t,I,h.kinds),J=h.kinds.filter(e=>I.kinds.includes(e)),P=`${se} --update`,U=[...L.other,...L.grown,...L.shrunk.map(e=>`${e}. Run: ${P}`),...F.problems],B=0===U.length;if(r.json){const e=new Map(h.allow.map(e=>[`${e.file}:${e.kind}`,e.count]));return t.out(JSON.stringify({tool:se,version:t.version,ok:B,schema:h.schema,kinds:h.kinds,files:$.files.length,counts:M($.counts),baseline:M(I.counts),allowed:M(e),kitDeps:$.kitDeps,shellPeers:$.shellPeers,failures:U},null,2)),B?0:1}t.out(`UI kit check (harness UI-24), efficient-shell ${t.version}\n`);const W=(e,n,i="")=>{if(0===n.length)return t.out(` ok ${e}`);t.err(` FAIL ${e}`);for(const e of n)t.err(` ${e}`);i&&t.err(` ${i}`)};t.out(` ok the reader reads its own fixtures (typescript ${m.version})`),t.out(` ok read ${ae($.files.length,"file")}`),W(`${ie} and ${oe} describe this repository`,L.other),W("no file draws more of its own UI than its line allows",L.grown),W("every line is exact: a count that fell is a line to lower",L.shrunk,`Run: ${P}${L.updateFixes?"":" (after the failures above are fixed)"}`),F.note&&W(`the baseline is no higher than the base branch (${F.note})`,F.problems);const C=new Set([...$.counts.keys()].map(e=>j(e).file));return t.out(` ok PROGRESS: ${C.size} of ${ae($.files.length,"file")} still draw UI of their own: `+le($.counts,J)),t.out(""),B?t.out("UI kit check: ok"):t.err(`UI kit check: FAILED (${ae(U.length,"problem")})`),B?0:1}(process.argv.slice(2),{cwd:process.cwd(),env:process.env,out:e=>console.log(e),err:e=>console.error(e),loadTypeScript:function(){for(const e of[n(process.cwd(),"package.json"),import.meta.url])try{return t(e)("typescript")}catch{}throw new Error("typescript is not installed")},git:function(t){try{return e("git",t,{cwd:process.cwd(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:6e4,maxBuffer:67108864})}catch{return null}},version:"4.180.0"});
|
|
2
|
+
import{execFileSync as e}from"child_process";import{createRequire as t}from"module";import{join as n}from"path";import{existsSync as i,readFileSync as o,writeFileSync as s,readdirSync as r}from"fs";var a=["button","input","range","textarea","select","dialog","title","portal","native","dark","hex","radius","kit","icon","kit-dep"],l=e=>"string"==typeof e&&a.includes(e),c={button:{counts:"a raw <button>",instead:"Button or IconButton from efficient-shell/ui"},input:{counts:"a raw <input> (not hidden, not a range)",instead:"Input, InputNumber, Checkbox, Radio or Switch from efficient-shell/ui"},range:{counts:'a raw <input type="range">',instead:"Slider from efficient-shell/ui"},textarea:{counts:"a raw <textarea>",instead:"Textarea from efficient-shell/ui"},select:{counts:"a raw <select>",instead:"Select or SearchableSelect from efficient-shell/ui"},dialog:{counts:'a raw <dialog>, or role="dialog" / role="alertdialog" on a raw element',instead:"Dialog or Modal from efficient-shell"},title:{counts:"a title= on a raw element (the browser's own tooltip)",instead:"Tooltip from efficient-shell/ui (harness UI-17)"},portal:{counts:"a createPortal(…) call (a layer the file floats itself)",instead:"Popover, PopupMenu, DropdownMenu, Tooltip or Dialog from efficient-shell/ui"},native:{counts:"window.confirm / alert / prompt, or a bare call that resolves to one",instead:"confirm, confirmDestructive, prompt or toast from efficient-shell (harness UI-20)"},dark:{counts:"a dark: variant in a class string",instead:"the light Tailwind class alone; the shell remaps it in dark mode (harness UI-7)"},hex:{counts:"a hex colour literal in a .tsx string",instead:"a shell token or a Tailwind palette class (harness FT-1)"},radius:{counts:"a literal corner radius (an arbitrary-value radius class, or an inline borderRadius)",instead:"a radius utility from the scale or a role token such as rounded-(--radius-control); the theme sets how round they are (harness UI-7)"},kit:{counts:"an import of a second UI kit",instead:"the component from efficient-shell/ui, or fold it into the shell (harness FT-3)"},icon:{counts:"an import of an icon package",instead:"<Icon name> from efficient-shell/icons, drawn by the set the theme chose (harness UI-24)"},"kit-dep":{counts:"a UI kit or icon package declared in package.json (not one the shell entries imported here need)",instead:"remove the dependency once nothing imports it (harness FT-3)"}},d=["@headlessui/","@radix-ui/","@mui/","@chakra-ui/","@mantine/","@floating-ui/","antd","react-aria","react-aria-","react-bootstrap","react-select","react-colorful","react-tooltip","react-hot-toast","react-toastify","sonner"],u=["@heroicons/","@tabler/icons","@tabler/icons-","@phosphor-icons/","@fortawesome/","@iconify/","@radix-ui/react-icons","@mui/icons-material","lucide","lucide-react","simple-icons","react-icons","react-feather"],f={"efficient-shell":["@headlessui/react","@heroicons/react"],"efficient-shell/apps":["@heroicons/react"],"efficient-shell/icons/heroicons":["@heroicons/react"],"efficient-shell/icons/lucide":["lucide-react"]};function h(e,t){return t.some(t=>t.endsWith("/")||t.endsWith("-")?e.startsWith(t):e===t||e.startsWith(`${t}/`))}function p(e){return h(e,u)?"icon":h(e,d)?"kit":null}var m=/[.+^$()|[\]\\]/g;function g(e){let t="",n=0;for(let i=0;i<e.length;i++){const o=e[i];"*"===o?"*"===e[i+1]?"/"===e[i+2]?(t+="(?:[^/]+/)*",i+=2):(t+=".*",i+=1):t+="[^/]*":"?"===o?t+="[^/]":"{"===o?(t+="(?:",n+=1):"}"===o&&n>0?(t+=")",n-=1):t+=","===o&&n>0?"|":o.replace(m,"\\$&")}if(0!==n)throw new Error(`unbalanced { in glob "${e}"`);return new RegExp(`^${t}$`)}function k(e){const t=e.map(g);return e=>t.some(t=>t.test(e))}var $=new Set(["node_modules",".git"]),w=new Set(["dist","coverage",".next",".turbo"]);function b(e){const t=e.search(/[*?{]/),n=-1===t?e:e.slice(0,t),i=n.lastIndexOf("/");return-1===i?"":n.slice(0,i)}function y(e,t){const i=k(t),o=[...new Set(t.map(b))].sort(),s=o.filter(e=>!o.some(t=>t!==e&&(""===t||e.startsWith(`${t}/`)))),a=new Set,l=t=>{let o;try{o=r(n(e,t),{withFileTypes:!0})}catch{return}for(const e of o){const n=t?`${t}/${e.name}`:e.name;e.isDirectory()?$.has(e.name)||""===t&&w.has(e.name)||l(n):e.isFile()&&i(n)&&a.add(n)}};for(const e of s)l(e);return[...a].sort(x)}var x=(e,t)=>e<t?-1:e>t?1:0,v=class extends Error{},S=(e,t)=>`${e}:${t}`;function j(e){const t=e.lastIndexOf(":");return{file:e.slice(0,t),kind:e.slice(t+1)}}var I=e=>a.indexOf(e);function T(e,t){const n=j(e),i=j(t);return x(n.file,i.file)||I(n.kind)-I(i.kind)}function A(e,t="ui-kit.baseline.json"){let n;try{n=JSON.parse(e)}catch(e){throw new v(`${t} is not valid JSON: ${e.message}`)}const i=e=>{throw new v(`${t}: ${e}. The tool writes this file; do not edit it by hand.`)};if("object"!=typeof n||null===n||Array.isArray(n))return i("must be a JSON object");const o=n;if(1!==o.schema)return i("number"==typeof o.schema&&o.schema>1?`"schema": ${o.schema} is newer than this efficient-shell reads (1); upgrade efficient-shell`:'"schema" must be 1');if(!Array.isArray(o.kinds)||o.kinds.some(e=>"string"!=typeof e))return i('"kinds" must be a list');const s=o.kinds.filter(l);if("object"!=typeof o.counts||null===o.counts||Array.isArray(o.counts))return i('"counts" must be an object');const r=new Map;for(const[e,t]of Object.entries(o.counts)){const{file:n,kind:o}=j(e);if(!n||!o)return i(`"${e}" is not "<file>:<kind>"`);if("number"!=typeof t||!Number.isInteger(t)||t<1)return i(`"${e}" must be a whole number, 1 or more (a line that reaches 0 is deleted)`);l(o)&&r.set(e,t)}return{kinds:s,counts:r}}function E(e){const t=a.filter(t=>e.kinds.includes(t)),n=[...e.counts.keys()].filter(t=>(e.counts.get(t)??0)>0).sort(T).map(t=>` ${JSON.stringify(t)}: ${e.counts.get(t)}`);return["{",' "schema": 1,',` "kinds": [${t.map(e=>JSON.stringify(e)).join(", ")}],`,n.length?` "counts": {\n${n.join(",\n")}\n }`:' "counts": {}',"}",""].join("\n")}function M(e){const t={};for(const[n,i]of e){const{kind:e}=j(n);l(e)&&(t[e]=(t[e]??0)+i)}return t}var O=class extends Error{},D=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),N=new Set(["$schema","schema","kinds","include","exclude","includeImporting","output","allow"]);var R="package.json",L=new Set(["iframe","frame","object","embed"]),F=new Set(["href","xlinkHref","to","id","key","htmlFor"]),J=/(?<![&\w])(?<!url\()#(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{6}|[0-9a-fA-F]{3,4})(?![\w-])/g,P=/(?<![\w-])rounded(?:-(?:[trblse]|tl|tr|br|bl|ss|se|ee|es))?-\[([^\]]*)\]/g,U=/^border(?:(?:Top|Bottom)(?:Left|Right)|(?:Start|End)(?:Start|End))?Radius$/,B=/^(?:inherit|initial|unset|revert)$|var\(|^(?:50|100)%$|^(?:999|9999)(?:px)?$/,W=/(?<![\w-])dark:(?=[\w[\-!@*(])/g,C=new Set(["confirm","alert","prompt"]),q=new Set(["window","globalThis","self"]);function z(e,t,n,i,o){const s=new Set(i),r=e.createSourceFile(t,n,e.ScriptTarget.Latest,!0,function(e,t){return t.endsWith(".tsx")?e.ScriptKind.TSX:t.endsWith(".jsx")?e.ScriptKind.JSX:/\.[cm]?js$/.test(t)?e.ScriptKind.JS:e.ScriptKind.TS}(e,t)),a={},l=/\.[jt]sx$/.test(t),c=(e,t)=>{var n;s.has(e)&&(a[e]??=[]).push((n=t.getStart(r),r.getLineAndCharacterOfPosition(n).line+1))},d=(t,n)=>t.attributes.properties.find(t=>e.isJsxAttribute(t)&&t.name.getText(r)===n),u=t=>{const n=t?.initializer;if(n)return e.isStringLiteral(n)?n.text:e.isJsxExpression(n)&&n.expression&&e.isStringLiteralLike(n.expression)?n.expression.text:void 0},f=new Set;if(s.has("native")){const t=n=>{if(n)if(e.isIdentifier(n))C.has(n.text)&&f.add(n.text);else if(e.isObjectBindingPattern(n)||e.isArrayBindingPattern(n))for(const i of n.elements)e.isBindingElement(i)&&t(i.name)},n=i=>{(e.isImportClause(i)||e.isImportSpecifier(i)||e.isNamespaceImport(i)||e.isVariableDeclaration(i)||e.isParameter(i)||e.isFunctionDeclaration(i))&&t(i.name),e.forEachChild(i,n)};n(r)}const h=t=>t&&e.isStringLiteralLike(t)?t.text:void 0,m=(e,t)=>{e&&("efficient-shell"===e||e.startsWith("efficient-shell/"))&&o?.add(e);const n=e?p(e):null;n&&c(n,t)},g=(e,t,n)=>{if(s.has("dark"))for(const n of e.matchAll(W))c("dark",t);if(s.has("radius"))for(const n of e.matchAll(P))B.test(n[1].trim())||c("radius",t);if(n&&l&&s.has("hex"))for(const n of e.matchAll(J))c("hex",t)},k=(t,n)=>{if(e.isJsxOpeningElement(t)||e.isJsxSelfClosingElement(t)){const e=t.tagName.getText(r);if(/^[a-z]/.test(e)){const n=u(d(t,"type"));"button"===e?c("button",t):"select"===e?c("select",t):"textarea"===e?c("textarea",t):"input"===e&&("range"===n?c("range",t):"hidden"!==n&&c("input",t));const i=u(d(t,"role"));"dialog"!==e&&"dialog"!==i&&"alertdialog"!==i||c("dialog",t),!L.has(e)&&d(t,"title")&&c("title",t)}}else if(e.isCallExpression(t)){const n=t.expression;e.isIdentifier(n)?"createPortal"===n.text?c("portal",t):C.has(n.text)&&!f.has(n.text)?c("native",t):"require"===n.text&&m(h(t.arguments[0]),t):e.isPropertyAccessExpression(n)?"createPortal"===n.name.text?c("portal",t):C.has(n.name.text)&&e.isIdentifier(n.expression)&&q.has(n.expression.text)&&c("native",t):n.kind===e.SyntaxKind.ImportKeyword&&m(h(t.arguments[0]),t)}else{if(e.isImportDeclaration(t)||e.isExportDeclaration(t))return void m(h(t.moduleSpecifier),t);if(e.isPropertyAssignment(t)&&s.has("radius")){const n=e.isIdentifier(t.name)||e.isStringLiteralLike(t.name)?t.name.text:"",i=t.initializer;U.test(n)&&(e.isNumericLiteral(i)?B.test(i.text)||c("radius",t):e.isStringLiteralLike(i)&&!B.test(i.text.trim())&&c("radius",t))}else if(e.isStringLiteralLike(t))g(t.text,t,n);else if(e.isTemplateExpression(t)){g(t.head.text,t.head,n);for(const e of t.templateSpans)g(e.literal.text,e.literal,n)}}e.isJsxAttribute(t)&&F.has(t.name.getText(r))?e.forEachChild(t,e=>k(e,!1)):e.forEachChild(t,e=>k(e,n))};return k(r,!0),a}function K(e){const t={};for(const[n,i]of Object.entries(e))i.length&&(t[n]=i.length);return t}function G(e,t,n){const i=e.createSourceFile(t,n,e.ScriptTarget.Latest,!1),o=[];for(const t of i.statements)(e.isImportDeclaration(t)||e.isExportDeclaration(t))&&t.moduleSpecifier&&e.isStringLiteralLike(t.moduleSpecifier)&&o.push(t.moduleSpecifier.text);return o}var _=(e,t)=>e.some(e=>t.some(t=>t.endsWith("/*")?e.startsWith(t.slice(0,-1)):e===t));var H=e=>new Map(e.allow.map(e=>[S(e.file,e.kind),e.count]));function X(e,t){return e.kinds.filter(e=>t.kinds.includes(e))}var V=(e,t,n)=>{if("kit-dep"===n)return` (${e.kitDeps.join(", ")})`;const i=e.hits.get(t)?.[n]??[];if(0===i.length)return"";const o=i.slice(0,12).join(", ");return` (line${1===i.length?"":"s"} ${o}${i.length>12?", …":""})`};function Q(e,t,n){const i=H(e),o=new Map;for(const[e,s]of t.counts){const{kind:t}=j(e);if(!l(t)||!n.includes(t))continue;const r=s-(i.get(e)??0);r>0&&o.set(e,r)}return{kinds:a.filter(e=>n.includes(e)),counts:o}}function Y(e,t){let n=0;for(const i of new Set([...e.keys(),...t.keys()]))(e.get(i)??0)!==(t.get(i)??0)&&(n+=1);return n}var Z="\n// <button> in a comment is not a button\n/* nor is <input title=\"x\"> in this one, or dark:bg-black, or #fff */\nimport { createPortal } from 'react-dom';\nimport { Dialog } from '@headlessui/react';\nimport { TrashIcon } from '@heroicons/react/24/outline';\nimport type { Icon } from 'lucide-react';\nimport { Button, confirm } from 'efficient-shell';\nexport { Slot } from '@radix-ui/react-slot';\nexport { CheckIcon } from '@radix-ui/react-icons';\n\nconst a = <button title=\"Says what it does\">x</button>;\nconst b = <input type=\"range\" />;\nconst c = <input type=\"text\" />;\nconst c2 = <input type={\"hidden\"} name=\"csrf\" />;\nconst c3 = <input type=\"hidden\" />;\nconst c4 = <input type={kind} />;\nconst d = <select />;\nconst d2 = <textarea />;\nconst e = <div role=\"dialog\" />;\nconst e2 = <dialog open />;\nconst e3 = <section role={'alertdialog'} />;\nconst f = <iframe title=\"Preview\" />;\nconst f2 = <object title=\"Chart\" />;\nconst g = <Button title=\"a prop, not a tooltip\" role=\"dialog\" />;\nconst g2 = (\n <button\n type=\"button\"\n title={hint}\n >\n y\n </button>\n);\nconst h = ReactDOM.createPortal(a, document.body);\nconst i = createPortal(a, document.body);\n\nasync function leave() {\n if (window.confirm('Sure?')) return;\n globalThis.alert('No');\n alert('native: nothing binds the name');\n prompt('native too');\n await confirm('the shell: the import binds it');\n record.confirm('a method, not the popup');\n}\n\nconst j = <div className=\"bg-white dark:bg-black dark:hover:text-white is-dark:no\" />;\nconst k = clsx('text-gray-900', on && 'dark:text-gray-100');\nconst l = <span style={{ color: '#fff', background: \"#12ab34\" }} className={`border-[#0a0b0c80] ${x}`} />;\nconst m = <a href=\"#faded\" id=\"#bad\" key=\"#abc\" to=\"#face\">skip</a>;\nconst n = <label htmlFor={'#dead'}>skip</label>;\nconst o = <span>Ӓ and BG#00340 and #12345 and #added are not colours</span>;\nconst p = 'entity  ref BG#00340';\nconst q = <use xlinkHref=\"#abc\" fill=\"url(#fed)\" />;\nconst t = <div className=\"rounded-[4px] rounded-t-[0.5rem] hover:rounded-[2px] rounded-lg rounded-(--radius-card) rounded-[inherit] rounded-[var(--r)]\" />;\nconst u = <div style={{ borderRadius: 6, borderTopLeftRadius: '3px', borderBottomRightRadius: '50%', borderEndEndRadius: 'var(--radius-card)' }} />;\nconst v = <i style={{ borderRadius: 9999 }} />;\nconst r = lazy(() => import('@mui/material'));\nconst s = require('react-select');\n",ee={button:2,input:2,range:1,textarea:1,select:1,dialog:3,title:2,portal:2,native:4,dark:3,hex:3,radius:5,kit:4,icon:3},te={kit:1,dark:1,portal:1,radius:2},ne=e=>a.filter(t=>e[t]).map(t=>`${t} ${e[t]}`).join(", ")||"nothing";var ie="ui-kit.config.json",oe="ui-kit.baseline.json",se="efficient-shell-ui-check",re=`${se}: every surface a person operates takes its UI from efficient-shell (harness UI-24).\n\n ${se} check this repository against ${oe}\n ${se} --print print today's counts as a baseline, and change nothing\n ${se} --summary print totals per kind and per folder, as Markdown\n ${se} --json print the result as JSON\n ${se} --update lower the lines whose counts fell, and delete the ones at zero\n ${se} --update --allow-move also follow a renamed or split file (no total may rise)\n ${se} --init write the first ${oe}\n ${se} --init --kind <kind> take the baseline for a kind just added to "kinds"\n ${se} --no-base do not compare with the pull request's base branch\n\nKinds: ${a.join(", ")}\nReads ${ie} in the current directory.`;var ae=(e,t)=>`${e} ${t}${1===e?"":"s"}`,le=(e,t)=>{const n=M(e);return t.map(e=>`${e} ${n[e]??0}`).join(" · ")};process.exitCode=function(e,t){const r=function(e){const t={print:!1,summary:!1,json:!1,update:!1,allowMove:!1,init:!1,noBase:!1,help:!1,version:!1,kinds:[]};for(let n=0;n<e.length;n++){const i=e[n];if("--print"===i)t.print=!0;else if("--summary"===i)t.summary=!0;else if("--json"===i)t.json=!0;else if("--update"===i)t.update=!0;else if("--allow-move"===i)t.allowMove=!0;else if("--init"===i)t.init=!0;else if("--no-base"===i)t.noBase=!0;else if("--help"===i||"-h"===i)t.help=!0;else if("--version"===i||"-v"===i)t.version=!0;else if("--kind"===i){const i=e[++n];if(!i)return"--kind needs a kind after it";t.kinds.push(...i.split(","))}else{if(!i.startsWith("--kind="))return`unknown argument "${i}"`;t.kinds.push(...i.slice(7).split(","))}}return t.allowMove&&!t.update?"--allow-move goes with --update":t.kinds.length&&!t.init?"--kind goes with --init":[t.print,t.summary,t.update,t.init].filter(Boolean).length>1?"choose one of --print, --summary, --update and --init":t}(e);if("string"==typeof r)return t.err(`${se}: ${r}\n\n${re}`),2;if(r.help)return t.out(re),0;if(r.version)return t.out(t.version),0;const d=e=>(r.json?t.out(JSON.stringify({tool:se,version:t.version,ok:!1,failures:[e]},null,2)):t.err(`${se}: ${e}`),1),u=n(t.cwd,ie);if(!i(u))return d(`no ${ie} in ${t.cwd}. Run it from the repository root; the harness has the template.`);let h,m;try{h=function(e,t="ui-kit.config.json"){const n=[],i=e=>{n.push(e)},o=(e,t,{required:n=!1}={})=>{if(void 0===e&&!n)return[];if(!Array.isArray(e)||e.some(e=>"string"!=typeof e||""===e))return i(`${t} must be a list of non-empty strings`),[];n&&0===e.length&&i(`${t} must name at least one entry`);for(const n of e)(n.startsWith("/")||n.startsWith("./")||n.includes("\\")||n.split("/").includes(".."))&&i(`${t}: "${n}" must be a path from the repository root, written with / (no ./, .. or \\)`);return e},s=(e,t)=>"string"!=typeof e||e.trim().length<10?(i(`${t} needs a "reason" a reviewer can read (a sentence, not a word)`),""):e,r=(e,t)=>void 0===e?[]:!Array.isArray(e)||e.some(e=>!D(e))?(i(`${t} must be a list of objects`),[]):e;if(!D(e))throw new O(`${t}: must be a JSON object`);for(const t of Object.keys(e))N.has(t)||i(`unknown key "${t}"`);1!==e.schema&&i("number"==typeof e.schema&&e.schema>1?`"schema": ${e.schema} is newer than this efficient-shell reads (1); upgrade efficient-shell`:'"schema" must be 1');const c=[];if(Array.isArray(e.kinds)&&0!==e.kinds.length)for(const t of e.kinds)l(t)?c.includes(t)?i(`"kinds": "${t}" is listed twice`):c.push(t):i(`"kinds": unknown kind ${JSON.stringify(t)} (this efficient-shell knows: ${a.join(", ")})`);else i(`"kinds" must list the kinds this repository checks, from: ${a.join(", ")}`);const d=o(e.include,'"include"'),u=o(e.exclude,'"exclude"'),f=r(e.includeImporting,'"includeImporting"').map((e,t)=>({files:o(e.files,`"includeImporting"[${t}].files`,{required:!0}),modules:o(e.modules,`"includeImporting"[${t}].modules`,{required:!0}),reason:s(e.reason,`"includeImporting"[${t}]`)}));0===d.length&&0===f.length&&i('"include" must name the files that are operator UI (for example ["src/**/*.tsx"])');const h=r(e.output,'"output"').map((e,t)=>({files:o(e.files,`"output"[${t}].files`,{required:!0}),reason:s(e.reason,`"output"[${t}]`)})),p=[],m=new Set;if(r(e.allow,'"allow"').forEach((e,t)=>{const n=`"allow"[${t}]`,[r]=o([e.file],`${n}.file`),d=s(e.reason,n);if(!l(e.kind))return void i(`${n}.kind must be one of: ${a.join(", ")}`);if(c.includes(e.kind)||i(`${n}: kind "${e.kind}" is not in "kinds"`),"number"!=typeof e.count||!Number.isInteger(e.count)||e.count<1)return void i(`${n}.count must be a whole number, 1 or more`);if(!r)return;const u=`${r}:${e.kind}`;m.has(u)&&i(`${n}: ${r} already has an allow entry for "${e.kind}"`),m.add(u),p.push({file:r,kind:e.kind,count:e.count,reason:d})}),n.length)throw new O(`${t}:\n - ${n.join("\n - ")}`);return{schema:1,kinds:a.filter(e=>c.includes(e)),include:d,exclude:u,includeImporting:f,output:h,allow:p}}(JSON.parse(o(u,"utf8")),ie)}catch(e){return d(e instanceof O?e.message:`${ie} is not valid JSON: ${e.message}`)}try{m=t.loadTypeScript()}catch{return d('this check reads the TypeScript AST and found no "typescript" package here. Install it as a devDependency.')}const g=function(e){const t=[],n=a.filter(e=>"kit-dep"!==e),i=[["fixture.tsx",Z,ee],["fixture.ts","\nimport { toast } from 'sonner';\nexport const tone = { warn: '#f59e0b' };\nexport const cls = 'ring-1 dark:ring-white rounded-[3px]';\nexport const box = { borderRadius: '0.25rem', radius: 4 };\nexport function ask(confirm: (message: string) => boolean) {\n return confirm('a parameter binds the name');\n}\nexport const mount = (node: unknown) => ReactDOM.createPortal(node, document.body);\n",te]];for(const[o,s,r]of i){const i=K(z(e,o,s,n));n.some(e=>(i[e]??0)!==(r[e]??0))&&t.push(`${o}: read ${ne(i)}; it holds ${ne(r)}`)}const o=K(z(e,"fixture.tsx",Z,["button"]));return"button"!==Object.keys(o).join()&&t.push(`asked for button alone, the reader reported ${ne(o)}`),t}(m);if(g.length)return d(`the reader misread its own fixtures with typescript ${m.version}, so nothing it says about this repository can be trusted:\n - `+g.join("\n - "));const $=function(e,t,s){const r=[],a=k(s.exclude),l=k(s.output.flatMap(e=>e.files)),c=new Map,d=e=>{let i=c.get(e);return void 0===i&&c.set(e,i=o(n(t,e),"utf8")),i},u=(e,n)=>{for(const i of e)0===y(t,[i]).length&&r.push(`${n}: "${i}" matches no file. Delete the line, or fix the path.`)};u(s.include,'"include"'),s.output.forEach((e,t)=>u(e.files,`"output"[${t}]`)),s.includeImporting.forEach((e,t)=>u(e.files,`"includeImporting"[${t}]`));const h=new Set,m=e=>(e=>/\.(?:[cm]?[jt]s|[jt]sx)$/.test(e)&&!e.endsWith(".d.ts"))(e)&&!a(e)&&!l(e);for(const e of y(t,s.include))m(e)&&h.add(e);for(const n of s.includeImporting)for(const i of y(t,n.files))m(i)&&!h.has(i)&&_(G(e,i,d(i)),n.modules)&&h.add(i);const g=[...h].sort(),$=s.kinds.filter(e=>"kit-dep"!==e),w=new Map,b=new Map,x=new Set;for(const t of g){const n=z(e,t,d(t),$,x);let i=!1;for(const e of $){const o=n[e]?.length??0;o&&(b.set(S(t,e),o),i=!0)}i&&w.set(t,n)}let v=[],j=[];if(s.kinds.includes("kit-dep")){const e=n(t,R);if(i(e)){const t=JSON.parse(o(e,"utf8")),n=["dependencies","peerDependencies","optionalDependencies"].flatMap(e=>Object.keys(t[e]??{})),i=new Set([...x].flatMap(e=>f[e]??[])),s=[...new Set(n)].filter(e=>null!==p(e)).sort();v=s.filter(e=>!i.has(e)),j=s.filter(e=>i.has(e)),v.length&&b.set(S(R,"kit-dep"),v.length)}else r.push(`"kinds" includes "kit-dep", and there is no ${R} here to read.`)}for(const e of s.allow)("kit-dep"===e.kind?e.file===R:h.has(e.file))||r.push(`"allow": ${e.file} (${e.kind}) is not a file this check reads. Delete the entry, or fix the path.`);return{files:g,hits:w,counts:b,kitDeps:v,shellPeers:j,problems:r}}(m,t.cwd,h);if(0===$.files.length)return d(`read no files. "include" in ${ie} matches nothing, so a pass would mean nothing.`);const w=n(t.cwd,oe),b=r.json,x=e=>{b||t.out(e)};if(r.print)return t.out(E(Q(h,$,h.kinds)).trimEnd()),0;if(r.summary){for(const e of function(e,t){const n=new Map,i=new Map;for(const[e,o]of t.counts){const{file:t,kind:s}=j(e);if(!l(s))continue;const r=n.get(s)??{count:0,files:new Set};r.count+=o,r.files.add(t),n.set(s,r);const a=t.split("/"),c=a.length>2?a.slice(0,2).join("/"):2===a.length?a[0]:".",d=i.get(c)??{};d[s]=(d[s]??0)+o,i.set(c,d)}const o=e.kinds.filter(e=>n.has(e)),s=[`**UI kit check (harness UI-24):** ${new Set([...t.counts.keys()].map(e=>j(e).file)).size} of ${ae(t.files.length,"file")} still draw UI of their own.`,"","| Kind | Count | Files | The shell has |","|---|---:|---:|---|",...e.kinds.map(e=>{const t=n.get(e);return`| \`${e}\` | ${t?.count??0} | ${t?.files.size??0} | ${c[e].instead} |`})];if(o.length&&i.size){const e=e=>o.reduce((t,n)=>t+(e[n]??0),0),t=[...i].sort((t,n)=>e(n[1])-e(t[1])||(t[0]<n[0]?-1:1));s.push("",`| Folder | ${o.map(e=>`\`${e}\``).join(" | ")} | Total |`,`|---|${o.map(()=>"---:").join("|")}|---:|`,...t.map(([t,n])=>`| \`${t}\` | ${o.map(e=>n[e]??0).join(" | ")} | ${e(n)} |`))}return s}(h,$))t.out(e);return 0}let I=null;if(i(w))try{I=A(o(w,"utf8"),oe)}catch(e){return d(e instanceof v?e.message:String(e))}if(r.init){const e=r.kinds.filter(e=>!l(e)||!h.kinds.includes(e));if(e.length)return d(`--kind ${e.join(", ")}: not in "kinds" in ${ie}. Add it there first.`);const t=r.kinds;if(I){if(0===t.length)return d(`${oe} already exists, and --init would overwrite what it holds. It is for the adoption pull request only. To start checking a kind, add it to "kinds" and run --init --kind <kind>.`);const e=t.filter(e=>I.kinds.includes(e));if(e.length)return d(`the baseline was already taken for ${e.join(", ")}. Its lines only go down; use --update.`);const n=Q(h,$,t);I={kinds:[...I.kinds,...t],counts:new Map([...I.counts,...n.counts])}}else{if(t.length)return d(`there is no ${oe} yet. Run --init on its own first.`);I=Q(h,$,h.kinds)}s(w,E(I)),x(`${se}: wrote ${oe} (${ae(I.counts.size,"line")}: ${le(I.counts,I.kinds)})`)}if(!I)return d(`no ${oe}. This repository has not adopted the check yet: run ${se} --init, and commit the file.`);if(r.update){const e=function(e,t,n,{allowMove:i=!1}={}){const o=X(e,t),s=Q(e,n,o),r=new Map([...t.counts].filter(([e])=>o.includes(j(e).kind)));if(i){const e=M(r),n=M(s.counts),i=o.filter(t=>(n[t]??0)>(e[t]??0)).map(t=>`${t}: ${n[t]??0} across the repository, and the baseline holds ${e[t]??0}`);return i.length?{baseline:t,lowered:0,refused:i}:{baseline:s,lowered:Y(r,s.counts),refused:[]}}const a=new Map;for(const[e,t]of r){const n=Math.min(t,s.counts.get(e)??0);n>0&&a.set(e,n)}return{baseline:{kinds:o,counts:a},lowered:Y(r,a),refused:[]}}(h,I,$,{allowMove:r.allowMove});if(e.refused.length)return d(`--allow-move follows code that moved, and this is more of it than before:\n - ${e.refused.join("\n - ")}\nNothing was written.`);I=e.baseline,s(w,E(I)),x(`${se}: ${e.lowered?`changed ${ae(e.lowered,"line")} in`:"nothing to change in"} ${oe}`)}const L=function(e,t,n){const i=[],o=[],s=[...n.problems],r=H(e),a=new Set(X(e,t)),d=e.kinds.filter(e=>!t.kinds.includes(e));d.length&&s.push(`"kinds" names ${d.map(e=>`"${e}"`).join(", ")}, and the baseline was never taken for ${1===d.length?"it":"them"}. Run: efficient-shell-ui-check --init ${d.map(e=>`--kind ${e}`).join(" ")}`);const u=t.kinds.filter(t=>!e.kinds.includes(t));u.length&&o.push(`the baseline still carries ${u.map(e=>`"${e}"`).join(", ")}, which "kinds" no longer names`);const f=new Set([...n.counts.keys(),...t.counts.keys(),...r.keys()]);for(const e of[...f].sort(T)){const{file:d,kind:u}=j(e);if(!l(u)||!a.has(u))continue;const f=n.counts.get(e)??0,h=r.get(e)??0,p=t.counts.get(e)??0;f>h+p?i.push(`${d}: ${u} ${f}, and its line allows ${h+p}${V(n,d,u)}. ${c[u].counts} is counted; use ${c[u].instead}.`):f<h?s.push(`${d}: ${u} ${f}, and "allow" in ui-kit.config.json says ${h}. ${0===f?"Delete the entry":`Lower its count to ${f}`}: an exception does not outlive what it excused.`):f<h+p&&o.push(`${d}: ${u} ${f}, and its line says ${h+p}`)}return{grown:i,shrunk:o,other:s,updateFixes:0===i.length&&0===s.length&&o.length>0}}(h,I,$),F=r.noBase?{problems:[],note:""}:function(e,t,n){const i=e.env.GITHUB_BASE_REF;if(!i)return{problems:[],note:""};const o=e.git(["rev-parse","--show-prefix"]);if(null===o)return{problems:[],note:"not a git checkout; the base branch was not compared"};const s=`origin/${i}`;if(null===e.git(["rev-parse","--verify","--quiet",`${s}^{commit}`])&&(e.git(["fetch","--no-tags","--depth=1","origin",`+refs/heads/${i}:refs/remotes/origin/${i}`]),null===e.git(["rev-parse","--verify","--quiet",`${s}^{commit}`])))return{problems:[],note:`${s} could not be fetched; the base branch was not compared`};const r=e.git(["show",`${s}:${o.trim()}${oe}`]);if(null===r)return{problems:[],note:`${s} has no ${oe} yet (adoption)`};let a;try{a=A(r,`${s}:${oe}`)}catch{return{problems:[],note:`${s}'s ${oe} could not be read; the base branch was not compared`}}const l=M(a.counts),d=M(t.counts);return{problems:n.filter(e=>a.kinds.includes(e)&&(d[e]??0)>(l[e]??0)).map(e=>`${oe} holds ${d[e]??0} of "${e}", and ${s} holds ${l[e]??0}. The baseline only goes down: use ${c[e].instead}. A count that is meant to stay goes in "allow" in ${ie}, with its reason.`),note:`compared with ${s}`}}(t,I,h.kinds),J=h.kinds.filter(e=>I.kinds.includes(e)),P=`${se} --update`,U=[...L.other,...L.grown,...L.shrunk.map(e=>`${e}. Run: ${P}`),...F.problems],B=0===U.length;if(r.json){const e=new Map(h.allow.map(e=>[`${e.file}:${e.kind}`,e.count]));return t.out(JSON.stringify({tool:se,version:t.version,ok:B,schema:h.schema,kinds:h.kinds,files:$.files.length,counts:M($.counts),baseline:M(I.counts),allowed:M(e),kitDeps:$.kitDeps,shellPeers:$.shellPeers,failures:U},null,2)),B?0:1}t.out(`UI kit check (harness UI-24), efficient-shell ${t.version}\n`);const W=(e,n,i="")=>{if(0===n.length)return t.out(` ok ${e}`);t.err(` FAIL ${e}`);for(const e of n)t.err(` ${e}`);i&&t.err(` ${i}`)};t.out(` ok the reader reads its own fixtures (typescript ${m.version})`),t.out(` ok read ${ae($.files.length,"file")}`),W(`${ie} and ${oe} describe this repository`,L.other),W("no file draws more of its own UI than its line allows",L.grown),W("every line is exact: a count that fell is a line to lower",L.shrunk,`Run: ${P}${L.updateFixes?"":" (after the failures above are fixed)"}`),F.note&&W(`the baseline is no higher than the base branch (${F.note})`,F.problems);const C=new Set([...$.counts.keys()].map(e=>j(e).file));return t.out(` ok PROGRESS: ${C.size} of ${ae($.files.length,"file")} still draw UI of their own: `+le($.counts,J)),t.out(""),B?t.out("UI kit check: ok"):t.err(`UI kit check: FAILED (${ae(U.length,"problem")})`),B?0:1}(process.argv.slice(2),{cwd:process.cwd(),env:process.env,out:e=>console.log(e),err:e=>console.error(e),loadTypeScript:function(){for(const e of[n(process.cwd(),"package.json"),import.meta.url])try{return t(e)("typescript")}catch{}throw new Error("typescript is not installed")},git:function(t){try{return e("git",t,{cwd:process.cwd(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:6e4,maxBuffer:67108864})}catch{return null}},version:"4.181.0"});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{client_default as a}from"./chunk-
|
|
1
|
+
import{client_default as a}from"./chunk-SBDIHKLU.js";var e=()=>a.get("/auth/numbering-configs/").then(a=>a.data?.results??a.data??[]),t="uploaded:wallpaper";function r(a,e){return"string"!=typeof a||!a||"none"===a||a.startsWith("#")?"":a===t?e||"":a}var p=()=>a.get("/auth/me/wallpaper/").then(a=>a.data),n=e=>{const t=new FormData;return t.append("wallpaper",e),a.post("/auth/me/wallpaper/",t).then(a=>a.data)},l=()=>a.delete("/auth/me/wallpaper/").then(a=>a.data);function s(a){const e=a?.response?.status,t=a?.response?.data,r=Array.isArray(t?.wallpaper)?t.wallpaper[0]:void 0;return r||(413===e?"That picture is too large to use as a wallpaper.":415===e?"That file is not a picture this can use as a wallpaper.":"The wallpaper could not be saved. Please try again.")}export{t as WALLPAPER_PREF_TOKEN,l as deleteWallpaper,e as getNumberingConfigs,p as getWallpaper,n as uploadWallpaper,r as wallpaperSrc,s as wallpaperUploadError};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{toast_default as t}from"./chunk-3DGTIWZP.js";import{useShellPrefs as e}from"./chunk-
|
|
2
|
-
return(new Date).toISOString()}var
|
|
1
|
+
import{toast_default as t}from"./chunk-3DGTIWZP.js";import{useShellPrefs as e}from"./chunk-PQLVWCUI.js";import{useSyncExternalStore as n,useCallback as o,useMemo as a}from"react";var r=[{id:"bell",label:"Bell",description:"Soft bell with one harmonic"},{id:"chime",label:"Chime",description:"Two-note ascending chime"},{id:"bowl",label:"Singing Bowl",description:"Long-decay meditation tone"},{id:"wind-chimes",label:"Wind Chimes",description:"Four soft tones in succession"},{id:"off",label:"Off (silent)",description:"No sound — only desktop notification"}],i=[{id:"none",label:"None"},{id:"tick-fast",label:"Ticking Fast"},{id:"tick-slow",label:"Ticking Slow"},{id:"rain",label:"Rain"},{id:"fireplace",label:"Fireplace"},{id:"white",label:"White Noise"},{id:"pink",label:"Pink Noise"},{id:"brown",label:"Brown Noise"}],c=()=>`pomodoro-${/* @__PURE__ */(new Date).toISOString().slice(0,10)}`,l={focus:1500,short:300,long:900},s="bell",u=100,d=1,f="none",m=50,h={autoStartBreaks:!1,autoStartPomodoros:!1,longBreakInterval:4},g={running:!1,remaining:l.focus,mode:"focus",total:l.focus,streak:0,count:"undefined"!=typeof localStorage?(()=>{try{return parseInt(localStorage.getItem(c())||"0",10)||0}catch{return 0}})():0},p=null,k=/* @__PURE__ */new Set,w=t=>{g={...g,...t},k.forEach(t=>t())};function M(){return g}function S(t){return k.add(t),()=>{k.delete(t)}}function b(t){l=t,g.running||g.remaining!==g.total||w({remaining:t[g.mode],total:t[g.mode]})}function y(t){s=t}function v(t,e){u=Math.max(0,Math.min(100,Math.round(t))),d=Math.max(1,Math.min(5,Math.round(e)))}function T(t){h={autoStartBreaks:!!t.autoStartBreaks,autoStartPomodoros:!!t.autoStartPomodoros,longBreakInterval:Math.max(1,Math.min(20,Math.round(t.longBreakInterval||4)))}}function A(t,e){f=t,m=Math.max(0,Math.min(100,Math.round(e))),g.running&&"focus"===g.mode?(R(),G()):"none"!==t&&0!==m||R()}function I(){g.running||(w({running:!0}),p=setInterval(P,1e3),"focus"===g.mode&&G())}function x(){(g.running||null!==p)&&(null!==p&&(clearInterval(p),p=null),w({running:!1}),R())}function B(t){x(),w({mode:t,remaining:l[t],total:l[t]})}function P(){g.remaining<=1?function(){null!==p&&(clearInterval(p),p=null);R(),C(s,{volume:u,repeat:d});const e="focus"===g.mode?"Pomodoro complete — time for a break! 🍅":"Break's over — back to work!";if("undefined"!=typeof Notification&&"granted"===Notification.permission)try{new Notification(e)}catch{}try{t.info(e)}catch{}if("focus"===g.mode){const t=g.streak+1,e=g.count+1;(t=>{try{localStorage.setItem(c(),String(t))}catch{}})(e);const n=t%h.longBreakInterval===0?"long":"short";w({running:!1,streak:t,count:e,mode:n,remaining:l[n],total:l[n]}),h.autoStartBreaks&&setTimeout(()=>I(),50)}else w({running:!1,mode:"focus",remaining:l.focus,total:l.focus}),h.autoStartPomodoros&&setTimeout(()=>I(),50)}():w({remaining:g.remaining-1})}function C(t=s,e={}){if("off"===t)return;const n=Math.max(0,Math.min(100,e.volume??100))/100;if(0===n)return;const o=Math.max(1,Math.min(5,e.repeat??1));for(let e=0;e<o;e++)setTimeout(()=>N(t,n),2500*e)}function N(t,e){try{const n=window.AudioContext||window.webkitAudioContext;if(!n)return;const o=new n,a=(t,n,a,r=.22,i="sine")=>{const c=o.createOscillator(),l=o.createGain();c.connect(l),l.connect(o.destination),c.type=i,c.frequency.value=t;const s=o.currentTime+n;l.gain.setValueAtTime(0,s),l.gain.linearRampToValueAtTime(r*e,s+.03),l.gain.exponentialRampToValueAtTime(1e-4,s+a),c.start(s),c.stop(s+a)};let r=2;"bell"===t?(a(880,0,1.8),a(1320,0,1.4,.1),r=2):"chime"===t?(a(659.25,0,.7),a(880,.2,1.3),r=2):"bowl"===t?(a(440,0,3.4,.22),a(660,0,3,.08),a(880,.05,2.8,.05),r=4):"wind-chimes"===t&&(a(1175,0,1.1,.16),a(880,.15,1.3,.16),a(1318,.3,1.5,.16),a(1047,.5,1.7,.13),r=3),setTimeout(()=>{try{o.close()}catch{}},1e3*r+500)}catch{}}var D=null,_={none:0,white:.3,pink:.3,brown:.3,"tick-fast":.6,"tick-slow":.6,rain:.4,fireplace:.5};function O(t,e){if("none"===e)return null;const n=t.sampleRate,o="white"===e||"pink"===e||"brown"===e?2:4,a=n*o,r=t.createBuffer(1,a,n),i=r.getChannelData(0);if("white"===e)for(let t=0;t<a;t++)i[t]=.5*(2*Math.random()-1);else if("pink"===e){let t=0,e=0,n=0,o=0,r=0,c=0,l=0;for(let s=0;s<a;s++){const a=2*Math.random()-1;t=.99886*t+.0555179*a,e=.99332*e+.0750759*a,n=.969*n+.153852*a,o=.8665*o+.3104856*a,r=.55*r+.5329522*a,c=-.7616*c-.016898*a,i[s]=.11*(t+e+n+o+r+c+l+.5362*a)*.55,l=.115926*a}}else if("brown"===e){let t=0;for(let e=0;e<a;e++){t=(t+.02*(2*Math.random()-1))/1.02,i[e]=3.5*t*.5}}else if("tick-fast"===e||"tick-slow"===e){const t="tick-fast"===e?.5:1,r=Math.floor(.045*n);for(let e=0;e<o;e+=t){const t=Math.floor(e*n);for(let e=0;e<r&&t+e<a;e++){const o=Math.exp(-e/n*180),a=2*Math.random()-1,r=Math.sin(2*Math.PI*1100*(e/n));i[t+e]+=(.7*a+.25*r)*o*.55}}}else if("rain"===e){let t=0;for(let e=0;e<a;e++){const o=2*Math.random()-1,a=o-.93*t;t=o;const r=.7+.3*Math.sin(e/n*2*Math.PI*.25);i[e]=a*r*.4}}else if("fireplace"===e){let t=0;for(let e=0;e<a;e++){t=(t+.02*(2*Math.random()-1))/1.02,i[e]=1.6*t}let e=.4*Math.random()*n;for(;e<a;){const t=Math.floor((.012+.05*Math.random())*n),o=.35+.45*Math.random(),r=Math.floor(e);for(let e=0;e<t&&r+e<a;e++){const t=Math.exp(-e/n*90);i[r+e]+=(2*Math.random()-1)*t*o}e+=(.08+.62*Math.random())*n}}return r}function G(){if(!D&&"none"!==f&&0!==m)try{const t=window.AudioContext||window.webkitAudioContext;if(!t)return;const e=new t,n=O(e,f);if(!n){try{e.close()}catch{}return}const o=e.createBufferSource();o.buffer=n,o.loop=!0;const a=e.createGain();a.gain.value=m/100*_[f],o.connect(a).connect(e.destination),o.start(),D={ctx:e,src:o,gain:a}}catch{}}function R(){if(D){try{D.src.stop()}catch{}try{D.ctx.close()}catch{}D=null}}function V(t,e){if("none"!==t&&0!==e)try{const n=window.AudioContext||window.webkitAudioContext;if(!n)return;const o=new n,a=O(o,t);if(!a){try{o.close()}catch{}return}const r=o.createBufferSource();r.buffer=a,r.loop=!0;const i=o.createGain();i.gain.value=e/100*_[t],r.connect(i).connect(o.destination),r.start(),setTimeout(()=>{try{r.stop()}catch{}try{o.close()}catch{}},3e3)}catch{}}var W="pomodoro_tasks",F="pomodoro_tasks_migrated";function j(){return Math.random().toString(36).slice(2,11)}function L(){/* @__PURE__ */
|
|
2
|
+
return(new Date).toISOString()}var q=null,E=[],J=!1,Q=null,U=/* @__PURE__ */new Set;function Z(){for(const t of U)t()}function $(t){E=t,Z()}function z(){const t=q;return t?Q=t.list().then(e=>{q===t&&(E=e,J=!0,Z())}).catch(()=>{q===t&&(J=!0,Z())}).finally(()=>{Q=null}):(E=[],J=!0,Z(),Promise.resolve())}function H(t){q=t,E=[],J=!1,t?z():Z()}function K(t){return U.add(t),!q||J||Q||z(),()=>{U.delete(t)}}function X(){return E}function Y(){const t=function(){const{prefs:t,save:n}=e(),r=a(()=>{const e=t.todo_tasks;return Array.isArray(e)?e:[]},[t.todo_tasks]),i=o(t=>{n({todo_tasks:t})},[n]),c=o(t=>{const e=j(),n=L(),o={done:!1,...t,name:t.name.trim(),id:e,createdAt:n,updatedAt:n};return i([...r,o]),e},[r,i]),l=o((t,e)=>{i(r.map(n=>n.id===t?{...n,...e,id:n.id,updatedAt:L()}:n))},[r,i]),s=o(t=>{i(r.filter(e=>e.id!==t))},[r,i]),u=o(t=>{const e=r.find(e=>e.id===t);e&&l(t,{done:!e.done})},[r,l]);return{tasks:r,addTask:c,updateTask:l,removeTask:s,toggleDone:u,setAllTasks:i}}(),r=n(K,X,X),i=o(e=>{const n=q;if(!n)return t.addTask(e);const o="tmp-"+j(),a=L(),r={done:!1,...e,name:e.name.trim(),id:o,createdAt:a,updatedAt:a};return $([...E,r]),n.create({...e,name:e.name.trim()}).then(t=>$(E.map(e=>e.id===o?{...r,...t}:e))).catch(()=>$(E.filter(t=>t.id!==o))),o},[t]),c=o((e,n)=>{const o=q;if(!o)return t.updateTask(e,n);$(E.map(t=>t.id===e?{...t,...n,id:e,updatedAt:L()}:t)),o.update(e,n).catch(()=>{z()})},[t]),l=o(e=>{const n=q;if(!n)return t.removeTask(e);const o=E;$(E.filter(t=>t.id!==e)),n.remove(e).catch(()=>$(o))},[t]),s=o(e=>{if(!q)return t.toggleDone(e);const n=E.find(t=>t.id===e);n&&c(e,{done:!n.done})},[t,c]),u=o(e=>{q||t.setAllTasks(e)},[t]);return null===q?t:{tasks:r,addTask:i,updateTask:c,removeTask:l,toggleDone:s,setAllTasks:u}}function tt(t,e){try{if(localStorage.getItem(F))return;const n=localStorage.getItem(W);if(!n)return void localStorage.setItem(F,"1");const o=JSON.parse(n);if(!Array.isArray(o)||0===o.length)return localStorage.removeItem(W),void localStorage.setItem(F,"1");const a=L(),r=o.filter(t=>"string"==typeof t?.name).map(t=>({id:t.id||j(),name:String(t.name),done:!!t.done,estimated:"number"==typeof t.estimated?t.estimated:void 0,completed:"number"==typeof t.completed?t.completed:void 0,createdAt:a,updatedAt:a})),i=new Set(t.map(t=>t.id));e([...r.filter(t=>!i.has(t.id)),...t]),localStorage.removeItem(W),localStorage.setItem(F,"1")}catch{try{localStorage.setItem(F,"1")}catch{}}}export{r as ALARM_OPTIONS,i as FOCUS_SOUND_OPTIONS,M as getPomoSnapshot,tt as migratePomodoroTasksOnce,C as playAlarm,x as pomoPause,I as pomoStart,B as pomoSwitchMode,V as previewFocusSound,y as setPomoAlarm,v as setPomoAlarmConfig,T as setPomoBehaviour,b as setPomoDurations,A as setPomoFocusSound,H as setShellTodoProvider,S as subscribePomo,Y as useTodoTasks};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{useCopyText as e,CopyGlyph as t}from"./chunk-GMMTTWHB.js";import{PopupMenu as n,PopupMenuItem as r,PopupMenuDivider as l}from"./chunk-ZDF5AR5W.js";import{CloseFallbackC as i}from"./chunk-XUF7VW4U.js";import{useShellStrings as a}from"./chunk-J3LIIIHJ.js";import{Icon as o}from"./chunk-YKZHOXI4.js";import{useState as s,useEffect as c,Fragment as d}from"react";import{jsxs as m,jsx as u,Fragment as p}from"react/jsx-runtime";var y="outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-500";function h(){/* @__PURE__ */
|
|
2
|
+
return u(o,{name:"close",fallback:i,"aria-hidden":"true",className:"size-3.5"})}function b({text:n,label:r,copiedLabel:l}){const{copied:i,copy:a}=e(n);/* @__PURE__ */
|
|
3
|
+
return u("button",{type:"button",tabIndex:-1,"aria-label":i?l:r,title:i?l:r,onClick:a,className:"flex size-5 shrink-0 items-center justify-center rounded text-gray-400 hover:bg-gray-200 hover:text-gray-700 @max-[10rem]:hidden",children:/* @__PURE__ */u(t,{copied:i,className:"size-3.5"})})}function f({tabs:e,activeKey:t,idFor:i,panelMounted:o,onActivate:f,onClose:g,onCloseMany:x,label:k,className:v,activeClassName:w,end:N,onIconMenu:C,menuItems:I}){const j=a().pageTabs,[$,z]=s(null),M=e.length;c(()=>{if(!t)return;const e=document.getElementById(i(t,"tab"));e?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[i,t,M]);const D=e.some(e=>e.key===t)?t:e[0]?.key,A=t=>{const n=e[(t+e.length)%e.length];n&&document.getElementById(i(n.key,"tab"))?.focus()},_=$?e.find(e=>e.key===$.key):void 0,B=_&&I?I(_.key):[],T=_?e.indexOf(_):-1,E=e=>e.some(e=>!e.pinned),F=e=>()=>{z(null),e()};/* @__PURE__ */
|
|
4
|
+
return m("div",{className:v??"relative flex h-10 shrink-0 items-end gap-3 bg-gray-100 px-3",children:[
|
|
5
|
+
/* @__PURE__ */u("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 bottom-0 h-px bg-gray-200"}),
|
|
6
|
+
/* @__PURE__ */u("div",{role:"tablist","aria-label":k,onKeyDown:t=>{const n=e.findIndex(e=>document.getElementById(i(e.key,"tab"))===t.target);if(!(n<0)){if("ArrowRight"===t.key)A(n+1);else if("ArrowLeft"===t.key)A(n-1);else if("Home"===t.key)A(0);else if("End"===t.key)A(e.length-1);else{if("Delete"!==t.key||e[n].pinned)return;g(e[n].key)}t.preventDefault()}},className:"flex min-w-0 flex-1 items-end overflow-x-auto overflow-y-hidden [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:e.map((n,r)=>{const l=n.key===t,a=!!n.dirty,s=n.icon,c=l?w??"z-[1] border-gray-200 bg-gray-50 text-gray-900":"border-transparent text-gray-600 hover:bg-gray-200/70 hover:text-gray-900",p=r>0&&!l&&e[r-1].key!==t,x={type:"button",role:"tab",id:i(n.key,"tab"),"aria-selected":l,"aria-controls":o?.(n.key)?i(n.key,"panel"):void 0,tabIndex:n.key===D?0:-1,title:n.title,onClick:()=>f(n.key)},k={onContextMenu:e=>((e,t)=>{e.preventDefault(),z({x:e.clientX,y:e.clientY,key:t.key})})(e,n),onAuxClick:e=>((e,t)=>{1!==e.button||t.pinned||(e.preventDefault(),g(t.key))})(e,n),onMouseDown:e=>{1===e.button&&e.preventDefault()}},v=s&&
|
|
7
|
+
/* @__PURE__ */m("span",{className:"relative flex size-4 shrink-0 items-center justify-center text-gray-500 [&>svg]:size-4","aria-hidden":"true",children:[s,a&&!l&&!n.pinned&&
|
|
8
|
+
/* @__PURE__ */u("span",{className:"absolute -right-1 -top-1 hidden size-2 rounded-full bg-gray-500 ring-2 ring-gray-100 @max-[6.5rem]:block @max-[6.5rem]:group-hover:hidden"})]}),N=l&&!!C&&!!s;return n.pinned?/* @__PURE__ */u("div",{role:"presentation",className:`group relative flex h-9 flex-none items-center justify-center rounded-t-md border border-b-0 transition-colors ${s?"w-10":""} ${c}`,...k,children:/* @__PURE__ */m("button",{...x,className:`flex h-full items-center justify-center rounded-t-md ${s?"w-full":"px-3"} ${y}`,children:[v,
|
|
9
|
+
/* @__PURE__ */u("span",{className:s?"sr-only":"whitespace-nowrap text-[13px]",children:n.title})]})},n.key):/* @__PURE__ */m(d,{children:[p&&/* @__PURE__ */u("span",{"aria-hidden":"true",className:"mb-2.5 h-4 w-px shrink-0 self-end border-l border-gray-300"}),
|
|
10
|
+
/* @__PURE__ */m("div",{role:"presentation",className:`group @container relative flex h-9 items-center rounded-t-md border border-b-0 text-[13px] transition-colors ${l&&(n.copy||N)?"flex-[0_1_20rem]":"flex-[0_1_15rem]"} ${l?"min-w-[4.25rem]":"min-w-[2.75rem]"} ${c}`,...k,children:[N&&
|
|
11
|
+
/* @__PURE__ */u("button",{type:"button",tabIndex:-1,"aria-haspopup":"menu","aria-label":j.tabMenu,title:j.tabMenu,onClick:e=>{const t=e.currentTarget.getBoundingClientRect();C?.(n.key,t.left,t.bottom+4)},className:`ml-2 flex size-6 shrink-0 items-center justify-center rounded hover:bg-gray-200 @max-[5rem]:ml-1.5 ${y}`,children:v}),
|
|
12
|
+
/* @__PURE__ */m("button",{...x,className:`flex h-full min-w-0 flex-1 items-center gap-2 rounded-t-md pr-1 text-left ${N?"pl-1.5":"pl-3"} ${y} ${l?N?"":"@max-[5rem]:pl-2.5":"@max-[6.5rem]:pr-3 @max-[6.5rem]:group-hover:pr-1 @max-[4.5rem]:justify-center @max-[4.5rem]:px-0 @max-[4.5rem]:group-hover:pl-1.5"}`,children:[!N&&v,
|
|
13
|
+
/* @__PURE__ */u("span",{className:"min-w-0 flex-1 overflow-hidden whitespace-nowrap [mask-image:linear-gradient(to_right,#000_calc(100%-1rem),transparent)] "+(s?l?"@max-[5rem]:sr-only":"@max-[4.5rem]:sr-only":""),children:n.title})]}),l&&n.copy&&/* @__PURE__ */u(b,{text:n.copy,label:j.copy(n.copy),copiedLabel:j.copied}),
|
|
14
|
+
/* @__PURE__ */m("span",{className:"mr-1.5 flex size-5 shrink-0 items-center justify-center "+(l?"":"@max-[6.5rem]:hidden @max-[6.5rem]:group-hover:flex"),children:[a&&/* @__PURE__ */u("span",{role:"img","aria-label":j.unsaved,className:"size-2 rounded-full bg-gray-500 group-hover:hidden"}),
|
|
15
|
+
/* @__PURE__ */u("button",{type:"button",tabIndex:-1,"aria-label":j.closeTab?.(n.title)??`${j.close} ${n.title}`,onClick:()=>g(n.key),className:"size-5 items-center justify-center rounded text-gray-400 hover:bg-gray-200 hover:text-gray-700 "+(a?"hidden group-hover:flex":l?"flex":"flex opacity-0 group-hover:opacity-100 focus-visible:opacity-100"),children:/* @__PURE__ */u(h,{})})]})]})]},n.key)})}),N&&/* @__PURE__ */u("div",{className:"flex shrink-0 items-center gap-2 self-center",children:N}),$&&_&&/* @__PURE__ */m(n,{portal:!0,style:{left:$.x,top:$.y},onClose:()=>z(null),children:[B.length>0&&/* @__PURE__ */m(p,{children:[B.map((e,t)=>/* @__PURE__ */m(r,{onClick:F(e.onSelect),children:[e.icon,e.label]},t)),
|
|
16
|
+
/* @__PURE__ */u(l,{})]}),
|
|
17
|
+
/* @__PURE__ */u(r,{disabled:_.pinned,onClick:F(()=>g(_.key)),children:j.close}),
|
|
18
|
+
/* @__PURE__ */u(l,{}),
|
|
19
|
+
/* @__PURE__ */u(r,{disabled:!E(e.filter(e=>e.key!==_.key)),onClick:F(()=>x("others",_.key)),children:j.closeOthers}),
|
|
20
|
+
/* @__PURE__ */u(r,{disabled:!E(e.slice(T+1)),onClick:F(()=>x("right",_.key)),children:j.closeRight}),
|
|
21
|
+
/* @__PURE__ */u(r,{disabled:!E(e),onClick:F(()=>x("all",null)),children:j.closeAll})]})]})}export{f as TabStrip};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{CheckFallbackC as e,CopyFallback as t}from"./chunk-XUF7VW4U.js";import{useShellStrings as r}from"./chunk-J3LIIIHJ.js";import{Icon as o}from"./chunk-YKZHOXI4.js";import{useState as c,useRef as a,useEffect as i,useCallback as n}from"react";import{jsx as u}from"react/jsx-runtime";function m(e){const[t,r]=c(!1),o=a(void 0);i(()=>()=>clearTimeout(o.current),[]);return{copied:t,copy:n(t=>{t?.stopPropagation(),navigator.clipboard?.writeText(e).then(()=>{r(!0),clearTimeout(o.current),o.current=setTimeout(()=>r(!1),1500)},()=>{})},[e])}}function p({copied:r,className:c="w-4 h-4"}){/* @__PURE__ */
|
|
2
|
+
return u(o,r?{name:"check",fallback:e,className:`${c} text-green-600`,"aria-hidden":"true"}:{name:"copy",fallback:t,className:c,"aria-hidden":"true"})}function s({text:e}){const{copied:t,copy:o}=m(e),c=r().copy;/* @__PURE__ */
|
|
3
|
+
return u("button",{onClick:o,title:t?c.copiedValue:c.copyValue(e),className:"shrink-0 text-gray-400 hover:text-gray-600 transition-colors",children:/* @__PURE__ */u(p,{copied:t})})}export{s as CopyButton,p as CopyGlyph,m as useCopyText};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{navIcons as e}from"./chunk-DSSLOQDW.js";import{FolderFallback as t,PageFallback as r}from"./chunk-XUF7VW4U.js";import{Icon as n}from"./chunk-YKZHOXI4.js";import{isValidElement as o,cloneElement as i}from"react";import{jsx as l,jsxs as a}from"react/jsx-runtime";var d=["from-blue-500 to-blue-700","from-indigo-500 to-purple-600","from-purple-500 to-pink-600","from-pink-500 to-rose-600","from-red-500 to-rose-600","from-orange-500 to-red-600","from-amber-500 to-orange-600","from-yellow-500 to-amber-500","from-lime-500 to-green-600","from-green-500 to-emerald-600","from-emerald-500 to-teal-600","from-teal-500 to-cyan-600","from-cyan-500 to-sky-600","from-sky-500 to-blue-600","from-violet-500 to-fuchsia-600"];function s(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r);return d[Math.abs(t)%d.length]}var c={order:"text-blue-600",purchase_order:"text-purple-600",invoice:"text-green-600",client:"text-indigo-600",manufacturer:"text-orange-600",shipment:"text-teal-600",part_number:"text-gray-600",project:"text-pink-600",mould:"text-red-600",design:"text-cyan-600",brand:"text-amber-600",price_sheet:"text-emerald-600",folder:"text-yellow-600",page:"text-blue-500"},f={order:"SO",purchase_order:"PO",invoice:"INV",client:"CLI",manufacturer:"MFR",shipment:"DN",part_number:"PN",project:"PRJ",mould:"MLD",design:"DSN",brand:"BRD",price_sheet:"PS",vendor_invoice:"VI",vendor_payment:"VP",warranty_claim:"WC",qc_report:"QC",vendor_shipment:"GRN",bank_account:"BA",wheel_finish:"WF",weight_log:"WL",production_progress:"PP",vendor_price_sheet:"VPS",proposal:"PR",folder:"FLD"},p={pdf:"PDF",dxf:"DXF","3d":"STP",image:"IMG",csv:"CSV"},u={pdf:"text-red-600",dxf:"text-blue-600","3d":"text-purple-600",image:"text-emerald-600",csv:"text-green-600"};function m({className:e}){/* @__PURE__ */
|
|
2
|
+
return l(n,{name:"folder",fallback:t,className:e})}function h(t,r){return r&&e[r]||(t?e[t]:void 0)}var w=/* @__PURE__ */l("svg",{className:"h-7 w-7",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6z"})});function g({entityType:e,isSelected:t,entityId:r,label:n,fileKind:d}){const g="preview-file"===e&&d,y=g?u[d]:null,x=g?p[d]:null;if("folder"===e)/* @__PURE__ */
|
|
3
|
+
return l("div",{className:"w-12 h-12 flex items-center justify-center "+(t?"rounded-lg bg-blue-400/30 ring-2 ring-blue-500":""),children:/* @__PURE__ */l(m,{className:"h-12 w-12 text-amber-500 drop-shadow-[0_2px_3px_rgba(0,0,0,0.3)]"})});if("page"===e){const e=h(r,n),a=s(r||n||"page");/* @__PURE__ */
|
|
4
|
+
return l("div",{className:"w-12 h-12 flex items-center justify-center "+(t?"rounded-lg bg-blue-400/30 ring-2 ring-blue-500":""),children:/* @__PURE__ */l("span",{className:`h-11 w-11 rounded-xl bg-gradient-to-br ${a} flex items-center justify-center text-white border border-white/30 drop-shadow-[0_2px_3px_rgba(0,0,0,0.3)]`,children:e&&o(e)?i(e,{className:"h-7 w-7 text-white"}):w})})}/* @__PURE__ */
|
|
5
|
+
return a("div",{className:"w-12 h-12 relative flex items-center justify-center "+(t?"rounded-lg bg-blue-400/30 ring-2 ring-blue-500":""),children:[
|
|
6
|
+
/* @__PURE__ */a("svg",{className:`w-10 h-12 drop-shadow-[0_2px_3px_rgba(0,0,0,0.3)] ${y??c[e]??"text-gray-500"}`,viewBox:"0 0 40 48",fill:"none",children:[
|
|
7
|
+
/* @__PURE__ */l("path",{d:"M4 0h22l10 10v34a4 4 0 01-4 4H4a4 4 0 01-4-4V4a4 4 0 014-4z",fill:"white",fillOpacity:"0.92"}),
|
|
8
|
+
/* @__PURE__ */l("path",{d:"M26 0l10 10H30a4 4 0 01-4-4V0z",fill:"currentColor",fillOpacity:"0.2"}),
|
|
9
|
+
/* @__PURE__ */l("path",{d:"M4 0h22l10 10v34a4 4 0 01-4 4H4a4 4 0 01-4-4V4a4 4 0 014-4z",stroke:"currentColor",strokeWidth:"1.5",strokeOpacity:"0.5"})]}),
|
|
10
|
+
/* @__PURE__ */l("span",{className:`absolute inset-0 flex items-center justify-center text-[9px] font-bold pt-2 ${y??c[e]??"text-gray-600"}`,children:x??f[e]??e.slice(0,3).toUpperCase()})]})}function y({item:e}){if("folder"===e.entityType)/* @__PURE__ */
|
|
11
|
+
return l(m,{className:"h-4 w-4 shrink-0 text-amber-500"});if("page"===e.entityType){const t=h(e.entityId,e.label);/* @__PURE__ */
|
|
12
|
+
return l("span",{className:`h-4 w-4 rounded bg-gradient-to-br ${s(e.entityId||e.label||"page")} flex items-center justify-center text-white shrink-0`,children:t&&o(t)?i(t,{className:"h-3 w-3 text-white"}):/* @__PURE__ */l("span",{className:"h-1.5 w-1.5 rounded-[2px] border border-white/80"})})}const t=("preview-file"===e.entityType&&e.fileKind?u[e.fileKind]:c[e.entityType])??"text-gray-400";/* @__PURE__ */
|
|
13
|
+
return l(n,{name:"page",fallback:r,className:`h-4 w-4 shrink-0 ${t}`,strokeWidth:1.5})}function x(e){return"preview-file"===e.entityType&&e.fileKind?p[e.fileKind]:"page"===e.entityType?"App":"folder"===e.entityType?"Folder":f[e.entityType]??e.entityType.slice(0,3).toUpperCase()}var b=null,v=/* @__PURE__ */new Set;function _(e){b=e,v.forEach(e=>e())}function k(e){return v.add(e),()=>{v.delete(e)}}function N(){return b}var j="__REACT_OS_SHELL_FILES_VIEW__",C="react-os-shell:files-show-trash",I="react-os-shell:files-open-desktop-folder";function S(){"undefined"!=typeof window&&(window[j]="trash",window.dispatchEvent(new CustomEvent(C)))}function T(e){"undefined"!=typeof window&&(window[j]={view:"desktop-folder",folderId:e},window.dispatchEvent(new CustomEvent(I,{detail:{folderId:e}})))}function P(){if("undefined"==typeof window)return null;const e=window[j];return"trash"===e?"trash":e&&"object"==typeof e&&"desktop-folder"===e.view&&"string"==typeof e.folderId?e:null}function V(){const e=P();return"undefined"!=typeof window&&(window[j]=null),e}export{y as DesktopItemMiniIcon,I as FILES_OPEN_DESKTOP_FOLDER_EVENT,C as FILES_SHOW_TRASH_EVENT,g as FileIconTile,m as FolderGlyph,V as consumeFilesViewRequest,x as desktopItemTypeLabel,N as getDesktopFoldersSnapshot,P as peekFilesViewRequest,_ as publishDesktopFolders,T as requestFilesDesktopFolderView,S as requestFilesTrashView,k as subscribeDesktopFolders};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Modal as e}from"./chunk-
|
|
1
|
+
import{Modal as e}from"./chunk-SBDIHKLU.js";import{keepsNativeMenu as a}from"./chunk-ZDF5AR5W.js";import{jsx as i,jsxs as n}from"react/jsx-runtime";var t={activeOpacity:70,inactiveOpacity:50,activeBlur:0,inactiveBlur:0};function r(e){try{const a=JSON.parse(localStorage.getItem(e)||"");return null!=a.blur&&null==a.activeBlur&&(a.activeBlur=a.blur,a.inactiveBlur=a.blur,delete a.blur),{...t,...a}}catch{return t}}function l({open:t,onClose:r,title:l,appearance:c,onAppearanceChange:s,onSave:d,children:o}){if(!t)return null;const u="w-full h-1.5 rounded-full appearance-none bg-gray-200 cursor-pointer accent-blue-500",p="flex items-center justify-between text-xs text-gray-500";/* @__PURE__ */
|
|
2
2
|
return i("div",{onPointerDown:e=>e.stopPropagation(),onContextMenu:e=>{e.stopPropagation(),a(e.target)||e.preventDefault()},children:/* @__PURE__ */i(e,{open:t,onClose:r,title:l,size:"sm",children:/* @__PURE__ */n("div",{className:"space-y-4",children:[o,
|
|
3
3
|
/* @__PURE__ */n("div",{children:[
|
|
4
4
|
/* @__PURE__ */i("h3",{className:"text-sm font-semibold text-gray-700 mb-3",children:"Appearance"}),
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{useWindowMenuItem as e,Modal as t}from"./chunk-SBDIHKLU.js";import{navIcons as r}from"./chunk-DSSLOQDW.js";import{VERSION as s}from"./chunk-OD5KLVU5.js";import{InfoFallback as o,WindowFallback as n}from"./chunk-XUF7VW4U.js";import{DEFAULT_SHELL_STRINGS as i,useShellStrings as a,splitAround as m}from"./chunk-J3LIIIHJ.js";import{Icon as c}from"./chunk-YKZHOXI4.js";import{useState as l,useCallback as p,isValidElement as d,cloneElement as h}from"react";import{jsx as u,jsxs as f}from"react/jsx-runtime";var x=i.aboutApp,v={spreadsheet:{name:"Spreadsheets",version:"1.1.3",route:"/spreadsheet",description:x.spreadsheet},notepad:{name:"Notepad",version:"1.0.1",route:"/notepad",description:x.notepad},documents:{name:"Documents",version:"1.1.0",route:"/documents",description:x.documents},preview:{name:"Preview",version:"1.4.2",route:"/preview",description:x.preview},files:{name:"Files",version:"1.1.1",route:"/files",description:x.files},browser:{name:"Browser",version:"1.0.1",route:"/browser",description:x.browser}},w=/* @__PURE__ */u(c,{name:"info",fallback:o,className:"h-4 w-4 text-gray-400",strokeWidth:1.5}),g=/* @__PURE__ */u(c,{name:"window",fallback:n,className:"h-9 w-9",strokeWidth:1.5});function b({app:o}){const n=v[o],[i,c]=l(!1),x=p(()=>c(!0),[]),b=a().aboutApp,N=b.title(n.name);if(e(N,x,w),!i)return null;const y=r[n.route],k=d(y)?h(y,{className:"h-9 w-9"}):g,[j,D]=m(b.partOf);/* @__PURE__ */
|
|
2
|
+
return u(t,{open:!0,onClose:()=>c(!1),title:N,size:"sm",compact:!0,bodyScroll:!1,autoHeight:!0,dimensions:[320,320],children:/* @__PURE__ */f("div",{className:"flex flex-col items-center text-center px-5 pt-5 pb-4",children:[
|
|
3
|
+
/* @__PURE__ */u("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-gray-100 text-gray-600 shrink-0",children:k}),
|
|
4
|
+
/* @__PURE__ */u("h2",{className:"mt-3 text-lg font-bold text-gray-900",children:n.name}),
|
|
5
|
+
/* @__PURE__ */u("p",{className:"text-[11px] font-mono text-gray-400",children:b.version(n.version)}),
|
|
6
|
+
/* @__PURE__ */u("p",{className:"mt-2 text-xs text-gray-500 leading-relaxed",children:b[o]}),
|
|
7
|
+
/* @__PURE__ */f("div",{className:"mt-4 pt-3 border-t border-gray-200 w-full",children:[
|
|
8
|
+
/* @__PURE__ */f("p",{className:"text-[11px] text-gray-500",children:[j,
|
|
9
|
+
/* @__PURE__ */u("span",{className:"font-medium text-gray-700",children:"efficient-shell"}),D]}),s&&/* @__PURE__ */u("p",{className:"mt-0.5 text-[10px] font-mono text-gray-400",children:b.shellVersion(s)})]})]})})}export{b as AboutApp,v as BUILTIN_APP_INFO};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r="4.181.0",a=r;export{a as APP_VERSION,r as VERSION};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{requestFilesTrashView as n}from"./chunk-
|
|
1
|
+
import{requestFilesTrashView as n}from"./chunk-LMIQV3NB.js";var o=null;function r(n){o=n}function t(){return o}function u(){n()}export{t as getFilesDemoTree,u as openFilesInTrashMode,r as setFilesDemoTree};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{useHydrated as e,useBrowserState as t}from"./chunk-D65T4H6J.js";import{InfoFallback as r,ErrorFallback as n,CloseFallback as o,CheckFallback as i}from"./chunk-XUF7VW4U.js";import{useShellStrings as a}from"./chunk-J3LIIIHJ.js";import{Icon as s}from"./chunk-YKZHOXI4.js";import{createContext as c,useSyncExternalStore as l,useCallback as u,useContext as d,useMemo as f}from"react";import{jsxs as m,jsx as h}from"react/jsx-runtime";var w="(max-width: 767px), (pointer: coarse)";function p(){return!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia(w).matches}function g(){return!1}function y(e){if("undefined"==typeof window||!window.matchMedia)return()=>{};const t=window.matchMedia(w);return t.addEventListener?(t.addEventListener("change",e),()=>t.removeEventListener("change",e)):(t.addListener(e),()=>t.removeListener(e))}function v(){return l(y,p,g)}var x={success:"success",error:"error",warning:"warning",info:"info",404:"info",403:"warning",500:"error"},b={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"},_={404:e=>e.notFound,403:e=>e.noAccess,500:e=>e.serverError};function N({tone:e}){const t={className:"h-6 w-6",strokeWidth:1.5,"aria-hidden":!0};switch(e){case"success":/* @__PURE__ */
|
|
2
|
+
return h(s,{name:"check",fallback:i,...t});case"error":/* @__PURE__ */
|
|
3
|
+
return h(s,{name:"close",fallback:o,...t});case"warning":/* @__PURE__ */
|
|
4
|
+
return h(s,{name:"error",fallback:n,...t});default:/* @__PURE__ */
|
|
5
|
+
return h(s,{name:"info",fallback:r,...t})}}function S({status:e="info",title:t,subTitle:r,extra:n,icon:o,children:i,className:s=""}){const c=x[e],l=a().errors;/* @__PURE__ */
|
|
6
|
+
return m("div",{role:"error"===c?"alert":void 0,className:`flex flex-col items-center justify-center px-6 py-12 text-center ${s}`.trim(),children:[
|
|
7
|
+
/* @__PURE__ */h("div",{className:`flex h-14 w-14 items-center justify-center rounded-full ${b[c]}`,children:o??/* @__PURE__ */h(N,{tone:c})}),
|
|
8
|
+
/* @__PURE__ */h("h2",{className:"mt-4 text-lg font-semibold text-gray-900",children:t??_[e]?.(l)??""}),r&&/* @__PURE__ */h("p",{className:"mt-1 max-w-md text-sm text-gray-500",children:r}),i&&/* @__PURE__ */h("div",{className:"mt-4 w-full max-w-md text-left",children:i}),n&&/* @__PURE__ */h("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:n})]})}function C({size:e="md",padding:t="py-12",label:r,className:n=""}){const o=/* @__PURE__ */h("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__ */h("div",{className:`flex items-center justify-center ${t} ${n}`,children:o}):/* @__PURE__ */m("div",{role:"status",className:`flex flex-col items-center justify-center gap-3 ${t} ${n}`,children:[o,
|
|
9
|
+
/* @__PURE__ */h("p",{className:"text-sm text-gray-500",children:r})]})}var D="undefined"!=typeof window&&"undefined"!=typeof navigator&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),E={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=D?0:1,M=E.MOD[L],T=E.ALT[L],k="⇧",A="⏎",I=E.CMD_ENTER[L],H=E.CMD_S[L],j=E.CMD_K[L],F=E.CMD_DOT[L],Z=E.CMD_A[L],O=E.CMD_Z[L],P=E.CMD_SHIFT_Z[L],$=E.ALT_SHIFT_D[L],J=E.ALT_SHIFT_E[L],K=E.ALT_SHIFT_N[L],U=new Map(D?Object.values(E).map(([e,t])=>[e,t]):[]);function z(t){return e()?t:U.get(t)??t}var R="inline-flex items-center justify-center rounded border border-gray-200 bg-gray-50 font-medium text-gray-500",W={sm:"px-1 py-0.5 text-[10px]",md:"px-1.5 py-0.5 text-[11px]"};function X({keys:e,size:t="md",className:r=""}){const n=z(e);/* @__PURE__ */
|
|
10
|
+
return h("kbd",{className:[R,W[t],r].filter(Boolean).join(" "),children:n})}var B=c(null);function V({value:e,children:t}){/* @__PURE__ */
|
|
11
|
+
return h(B.Provider,{value:e,children:t})}function Y(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:u(t=>{o(r=>{const n={...r,...t};try{localStorage.setItem(e,JSON.stringify(n))}catch{}return n})},[e])}}var q={prefs:{},save:()=>{}};function G(){return d(B)??q}function Q(){const{prefs:e,save:t}=G(),r=u(e=>{const r=t(e);return r&&"function"==typeof r.then?r.catch(()=>{}):r},[t]);return f(()=>({prefs:e,save:r}),[e,r])}var ee="react-os-shell:stale-chunk-reload-at",te=3e4,re="vite:preloadError",ne="/_next/static/",oe=/Failed to fetch dynamically imported module|error loading dynamically imported module|Importing a module script failed|Unable to preload CSS/i;function ie(e){if(e instanceof Error&&"ChunkLoadError"===e.name)return!0;const t=e instanceof Error?e.message:"string"==typeof e?e:"";return oe.test(t)}function ae(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(ee),e}catch{return null}}():e.storage,i=void 0===e.chunkPathPrefix?ne:e.chunkPathPrefix,a=e=>{const r=n(),i=function(e){if(!e)return null;try{const t=e.getItem(ee),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(ee,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;ie(t)&&a(t)&&(e.preventDefault(),r())};let c=!0,l=!1;const u=/* @__PURE__ */new Set,d=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||l||u.has(t)||(u.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=>{u.delete(t),e&&c&&!l&&a(t)&&(l=!0,r())}))};return window.addEventListener(re,s),d&&window.addEventListener("error",d,!0),()=>{c=!1,window.removeEventListener(re,s),d&&window.removeEventListener("error",d,!0)}}export{T as ALT,$ as ALT_SHIFT_D,J as ALT_SHIFT_E,K as ALT_SHIFT_N,Z as CMD_A,F as CMD_DOT,I as CMD_ENTER,j as CMD_K,H as CMD_S,P as CMD_SHIFT_Z,O as CMD_Z,A as ENTER,X as Kbd,C as LoadingSpinner,M as MOD,ne as NEXT_CHUNK_PATH_PREFIX,S as Result,k as SHIFT,te as STALE_CHUNK_RELOAD_COOLDOWN_MS,ee as STALE_CHUNK_RELOAD_KEY,V as ShellPrefsProvider,re as VITE_PRELOAD_ERROR_EVENT,ae as installStaleChunkReload,D as isMac,ie as isStaleChunkError,v as useIsMobile,Y as useLocalStoragePrefs,Q as useShellPrefs,G as useShellPrefsAdapter,z as useShortcutLabel};
|