efficient-shell 13.25.0 → 14.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -4
- package/dist/{Browser-W2WVSAEN.js → Browser-L2NP7DLM.js} +14 -14
- package/dist/Calculator-7CY2CRGB.js +29 -0
- package/dist/{CurrencyConverter-VH4UVYLO.js → CurrencyConverter-FXWM3DBQ.js} +9 -9
- package/dist/{Files-6QZFFGSH.js → Files-5S6UFGST.js} +82 -82
- package/dist/{Notepad-YU4HIJD2.js → Notepad-HC46LWV5.js} +8 -8
- package/dist/PomodoroTimer-RPGWT26T.js +91 -0
- package/dist/{Preview-H7N2MMAI.js → Preview-L6FJXBAE.js} +37 -37
- package/dist/Sidebar-2TYZENQL.js +44 -0
- package/dist/{Stock-YL732PKW.js → Stock-TUPZORQN.js} +4 -4
- package/dist/{Weather-3CBRXNNM.js → Weather-URCO6JML.js} +23 -23
- package/dist/{WorldClock-LONNWCRG.js → WorldClock-EBBUWG5L.js} +6 -6
- package/dist/ai/index.js +92 -92
- package/dist/apps/index.js +1 -1
- package/dist/bin/browser-check.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/charts/ChordChart.js +1 -1
- package/dist/charts/FlowChart.js +1 -1
- package/dist/charts/RadarChart.js +1 -1
- package/dist/charts/SankeyChart.js +1 -1
- package/dist/charts/SpecChart.js +1 -1
- package/dist/charts/SunburstChart.js +1 -1
- package/dist/charts/TreemapChart.js +1 -1
- package/dist/{chunk-XVMCSUAV.js → chunk-22SVN2ZM.js} +1 -1
- package/dist/{chunk-ZDFMYAQB.js → chunk-24BF22NF.js} +1 -1
- package/dist/{chunk-JIJZBM25.js → chunk-2RLWGWOU.js} +13 -13
- package/dist/{chunk-VP2IQJUD.js → chunk-2SOGTOUQ.js} +4 -4
- package/dist/{chunk-4VFEPP2W.js → chunk-2XDO7FZC.js} +13 -13
- package/dist/{chunk-SLEA47VA.js → chunk-3L7BEEBW.js} +1 -1
- package/dist/{chunk-GZRNOIEE.js → chunk-3ZJAQSFS.js} +3 -3
- package/dist/{chunk-BQQEQCSK.js → chunk-47BGAQWD.js} +1 -1
- package/dist/{chunk-7AVPMO4F.js → chunk-4BRVZAIW.js} +1 -1
- package/dist/chunk-4DNPUG3T.js +7 -0
- package/dist/chunk-5F3HPOBH.js +1 -0
- package/dist/{chunk-VKZC3NPM.js → chunk-5O4HMXPQ.js} +2 -2
- package/dist/{chunk-JLSXDYS4.js → chunk-5SQHRDFC.js} +2 -2
- package/dist/{chunk-LQIHBIXG.js → chunk-6AYAB5FN.js} +5 -5
- package/dist/{chunk-VGUB7LPF.js → chunk-6IP4Q3AT.js} +52 -52
- package/dist/{chunk-527WMFTR.js → chunk-6RU2PGQK.js} +1 -1
- package/dist/{chunk-UVPDEGIA.js → chunk-6X32SWQI.js} +1 -1
- package/dist/{chunk-A5FC4LR7.js → chunk-7D2QZ6JA.js} +1 -1
- package/dist/{chunk-2YHS5E27.js → chunk-7OVMWXFM.js} +1 -1
- package/dist/{chunk-LC2UF3AA.js → chunk-7WF6LFOJ.js} +1 -1
- package/dist/{chunk-IJG4UEKF.js → chunk-A3VLZZHJ.js} +8 -8
- package/dist/{chunk-LG6NDTHZ.js → chunk-AH5MLH54.js} +1 -1
- package/dist/chunk-AJPQJ7TC.js +6 -0
- package/dist/{chunk-TNALBYLY.js → chunk-ALZHFQRX.js} +1 -1
- package/dist/{chunk-S5MTTJ3F.js → chunk-AZZ4NO2D.js} +12 -12
- package/dist/{chunk-P4VOUPRF.js → chunk-CHDGSJLV.js} +6 -6
- package/dist/{chunk-VY6OQRZA.js → chunk-CJ4OEY3T.js} +1 -1
- package/dist/{chunk-Q36KB5RQ.js → chunk-CXEELIRW.js} +11 -11
- package/dist/{chunk-MZ3JADHG.js → chunk-DBBOD5QW.js} +1 -1
- package/dist/chunk-DBQNYJZ6.js +1 -0
- package/dist/{chunk-65BW43PF.js → chunk-DNPAYNNU.js} +1 -1
- package/dist/{chunk-TTRLYWP4.js → chunk-DO6P6LYU.js} +1 -1
- package/dist/chunk-DOJSWVBX.js +6 -0
- package/dist/chunk-DTFX624I.js +8 -0
- package/dist/chunk-E57C7NBA.js +2 -0
- package/dist/{chunk-D5PXRJHA.js → chunk-EBODRYXS.js} +14 -14
- package/dist/{chunk-YDJ5IZOU.js → chunk-EDRELF6L.js} +1 -1
- package/dist/{chunk-M3HTP2N6.js → chunk-EHNW3UNC.js} +6 -6
- package/dist/{chunk-AH2NEKEN.js → chunk-EHSK43WG.js} +8 -8
- package/dist/{chunk-VMAIZU5S.js → chunk-EN3GYSCE.js} +1 -1
- package/dist/{chunk-TTYTOLVV.js → chunk-EOYKUV2U.js} +1 -1
- package/dist/chunk-FFPIT2LB.js +3 -0
- package/dist/{chunk-TD3ZQD5R.js → chunk-G3TC2GIA.js} +1 -1
- package/dist/{chunk-AAJSE5HA.js → chunk-GTBOJ5Q5.js} +1 -1
- package/dist/{chunk-UQV4TSWB.js → chunk-GTZML3V3.js} +1 -1
- package/dist/{chunk-JYR4V4AG.js → chunk-GUUBFQ6L.js} +2 -2
- package/dist/{chunk-K42FXX7J.js → chunk-GVAVIYE6.js} +1 -1
- package/dist/{chunk-2Y4AH7NC.js → chunk-GY7MJTIZ.js} +1 -1
- package/dist/{chunk-XYXCZIJY.js → chunk-HAEZUUDT.js} +3 -3
- package/dist/{chunk-J5W63XNR.js → chunk-HTBACICQ.js} +6 -6
- package/dist/{chunk-5URXJCNC.js → chunk-HX5QSQ2C.js} +1 -1
- package/dist/{chunk-VLBLDSA6.js → chunk-I7WAOKU2.js} +2 -2
- package/dist/{chunk-LLDGRPLF.js → chunk-ION3XGLN.js} +1 -1
- package/dist/{chunk-EXDSYFHB.js → chunk-ISWTJBOA.js} +1 -1
- package/dist/{chunk-BUFAJJDZ.js → chunk-IVEM2BPC.js} +1 -1
- package/dist/{chunk-D4432YRW.js → chunk-IZ6D4KGR.js} +1 -1
- package/dist/{chunk-KC2EQCBE.js → chunk-JPVD3VS7.js} +6 -6
- package/dist/{chunk-C7Z3ZMJH.js → chunk-KE7P74XM.js} +13 -13
- package/dist/chunk-KEFNQEXZ.js +1 -0
- package/dist/{chunk-DUEEAP4Y.js → chunk-LPL7BWGG.js} +1 -1
- package/dist/{chunk-JVENCUUG.js → chunk-LRMDLZMM.js} +4 -4
- package/dist/chunk-M5IZ7QLQ.js +7 -0
- package/dist/{chunk-MCLVTQSF.js → chunk-MEDOESQD.js} +8 -8
- package/dist/chunk-MEP6CZJ3.js +2 -0
- package/dist/{chunk-ZYKY4Z7R.js → chunk-MKHOXO5O.js} +1 -1
- package/dist/chunk-MNZAAQLH.js +15 -0
- package/dist/{chunk-DTRJLQWO.js → chunk-MPC3CHAO.js} +1 -1
- package/dist/{chunk-7PAZO65L.js → chunk-MXRF5YVN.js} +5 -5
- package/dist/{chunk-NWS5G7FE.js → chunk-MYH5H43C.js} +1 -1
- package/dist/{chunk-5OHFBS2B.js → chunk-NC5FIFAY.js} +1 -1
- package/dist/chunk-NDCS4COQ.js +11 -0
- package/dist/{chunk-IJ4JX6WP.js → chunk-NHALP3MW.js} +4 -4
- package/dist/{chunk-R5WBDXI2.js → chunk-OYQWBJ37.js} +1 -1
- package/dist/{chunk-77N3REYY.js → chunk-P2HZ2V3U.js} +2 -2
- package/dist/{chunk-UU42O5ON.js → chunk-P3XXFQG5.js} +1 -1
- package/dist/{chunk-YBE66FBR.js → chunk-P5J7G7OV.js} +1 -1
- package/dist/{chunk-4L5YRMJ4.js → chunk-PEA5Y6DD.js} +9 -9
- package/dist/{chunk-DPFEQQQU.js → chunk-POBVGDZP.js} +1 -1
- package/dist/{chunk-RFWBNKKB.js → chunk-PPHGBEJA.js} +10 -10
- package/dist/{chunk-IMH5H47S.js → chunk-PTLVNC3V.js} +6 -6
- package/dist/chunk-PU2GJVMG.js +1 -0
- package/dist/{chunk-TJG76Y7I.js → chunk-PWERFHOU.js} +9 -9
- package/dist/{chunk-ZFWCTHR4.js → chunk-PWON7O3N.js} +6 -6
- package/dist/{chunk-6MFKKTCE.js → chunk-Q7FPGOUY.js} +24 -24
- package/dist/{chunk-M4REKOGO.js → chunk-QCLKRFL4.js} +5 -5
- package/dist/{chunk-N4LMFGRI.js → chunk-R36VZ35L.js} +6 -6
- package/dist/{chunk-CCZHSISF.js → chunk-REFPTKRD.js} +2 -2
- package/dist/{chunk-THAPVKEJ.js → chunk-RTK77DMP.js} +11 -11
- package/dist/{chunk-PWOVSR7N.js → chunk-RXCBSQA2.js} +2 -2
- package/dist/{chunk-JDLJ7DHV.js → chunk-S4RFJTGR.js} +1 -1
- package/dist/{chunk-D5HFWOW7.js → chunk-SP4S4HUJ.js} +16 -16
- package/dist/{chunk-P73ZJ6QR.js → chunk-T46I4YOI.js} +1 -1
- package/dist/{chunk-VY3UA6AR.js → chunk-TAHHZGRH.js} +1 -1
- package/dist/{chunk-FBZUEZK7.js → chunk-TTD2M6RF.js} +1 -1
- package/dist/{chunk-RB3BMRNA.js → chunk-U75MSD4F.js} +1 -1
- package/dist/{chunk-XC2GUCTG.js → chunk-UGA5NGW4.js} +1 -1
- package/dist/chunk-VUBDHFG5.js +4 -0
- package/dist/{chunk-K4KUGKWP.js → chunk-W4IH3BE3.js} +21 -21
- package/dist/{chunk-B5KX7PDG.js → chunk-W6REY3SV.js} +3 -3
- package/dist/{chunk-WZWSFYXJ.js → chunk-WBUAO7T7.js} +1 -1
- package/dist/{chunk-P6H2B635.js → chunk-WNFZYTWW.js} +9 -9
- package/dist/{chunk-HPKQYUQT.js → chunk-WYAKASF3.js} +1 -1
- package/dist/{chunk-C5OPAULN.js → chunk-XGEN76DG.js} +1 -1
- package/dist/{chunk-ZKILZFUI.js → chunk-XIX72C7K.js} +1 -1
- package/dist/{chunk-3AUN7JSM.js → chunk-XJK6VNXV.js} +1 -1
- package/dist/{chunk-26KHYLJN.js → chunk-XLPUIGMO.js} +1 -1
- package/dist/{chunk-VQBKRBBR.js → chunk-XNKNX5L3.js} +1 -1
- package/dist/chunk-Y2M5PP2C.js +28 -0
- package/dist/{chunk-66NJCU4W.js → chunk-Y5RTVKMB.js} +8 -8
- package/dist/{chunk-JXJNQHPY.js → chunk-Y5YVKUM4.js} +19 -19
- package/dist/{chunk-5CHJA4RL.js → chunk-Y6FULJWJ.js} +7 -7
- package/dist/chunk-Y7D2CZ4H.js +13 -0
- package/dist/chunk-YTLUSBDY.js +14 -0
- package/dist/{chunk-2YUAR2EH.js → chunk-YX3JD6PA.js} +5 -5
- package/dist/{chunk-3WUVYXCF.js → chunk-ZA6ANC2D.js} +5 -5
- package/dist/{chunk-5ZOYYL46.js → chunk-ZEGCKIAL.js} +3 -3
- package/dist/chunk-ZSVU44OB.js +6 -0
- package/dist/data/DataTable.js +1 -1
- package/dist/data/EntityList.js +1 -1
- package/dist/data/Gantt.js +1 -1
- package/dist/data/Kanban.js +1 -1
- package/dist/data/ListLoadError.js +1 -1
- package/dist/data/ResizableTable.js +1 -1
- package/dist/data/statusColumn.js +1 -1
- package/dist/data/useColumnConfig.js +1 -1
- package/dist/data/useSort.js +1 -1
- package/dist/format/index.js +1 -1
- package/dist/forms/AlignmentGrid.js +1 -1
- package/dist/forms/BorderInput.js +1 -1
- package/dist/forms/BrandAssetEditor.js +1 -1
- package/dist/forms/Button.js +1 -1
- package/dist/forms/Calendar.js +1 -1
- package/dist/forms/ColorPicker.js +1 -1
- package/dist/forms/ComposerAttachments.js +1 -1
- package/dist/forms/CornersInput.js +1 -1
- package/dist/forms/DatePicker.js +1 -1
- package/dist/forms/DateRangePicker.js +1 -1
- package/dist/forms/DisplayChips.js +1 -1
- package/dist/forms/FilePicker.js +1 -1
- package/dist/forms/IconButton.js +1 -1
- package/dist/forms/IconPicker.js +1 -1
- package/dist/forms/Input.js +1 -1
- package/dist/forms/InputNumber.js +1 -1
- package/dist/forms/LinkPicker.js +1 -1
- package/dist/forms/MediaLibrary.js +1 -1
- package/dist/forms/MediaUploadField.js +1 -1
- package/dist/forms/MediaUploadGrid.js +1 -1
- package/dist/forms/MediaUsedInList.js +1 -1
- package/dist/forms/NumericKeypad.js +1 -1
- package/dist/forms/PictureTiles.js +1 -1
- package/dist/forms/PositionInput.js +1 -1
- package/dist/forms/RenameField.js +1 -1
- package/dist/forms/Segmented.js +1 -1
- package/dist/forms/Select.js +1 -1
- package/dist/forms/SidesInput.js +1 -1
- package/dist/forms/Slider.js +1 -1
- package/dist/forms/Snippet.js +1 -1
- package/dist/forms/SplitButton.js +1 -1
- package/dist/forms/TagInput.js +1 -1
- package/dist/forms/TextToolbar.js +1 -1
- package/dist/forms/UnitMenu.js +1 -1
- package/dist/forms/WidthsBar.js +1 -1
- package/dist/forms/dropdownPosition.js +1 -1
- package/dist/hooks/index.d.ts +15 -14
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useTheme.d.ts +1 -1
- package/dist/hooks/useTheme.js +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +43 -2
- package/dist/index.js +125 -125
- package/dist/map/index.js +5 -5
- package/dist/markdown/index.js +1 -1
- package/dist/page-tabs/index.js +5 -5
- package/dist/routine-index.json +1 -0
- package/dist/shell/AppUpdateBanner.js +1 -1
- package/dist/shell/ColoredBadge.js +1 -1
- package/dist/shell/ConfirmDialog.js +1 -1
- package/dist/shell/ContextMenu.js +1 -1
- package/dist/shell/Dialog.js +1 -1
- package/dist/shell/Drawer.js +1 -1
- package/dist/shell/DropdownMenu.js +1 -1
- package/dist/shell/EditableGrid.js +1 -1
- package/dist/shell/FloatingBar.js +1 -1
- package/dist/shell/GlobalSearch.js +1 -1
- package/dist/shell/HelpCenter.js +1 -1
- package/dist/shell/IconRail.js +1 -1
- package/dist/shell/ImageLightbox.js +1 -1
- package/dist/shell/ItemCount.js +1 -1
- package/dist/shell/Kbd.js +1 -1
- package/dist/shell/LanguageSelect.js +1 -1
- package/dist/shell/Markdown.js +1 -1
- package/dist/shell/MilestoneTimeline.js +1 -1
- package/dist/shell/Popover.js +1 -1
- package/dist/shell/PopupMenu.js +1 -1
- package/dist/shell/ProductionTimeline.js +1 -1
- package/dist/shell/ResizeHandle.js +1 -1
- package/dist/shell/SearchableSelect.js +1 -1
- package/dist/shell/SettingReset.js +1 -1
- package/dist/shell/SettingRow.js +1 -1
- package/dist/shell/ShellPrefs.js +1 -1
- package/dist/shell/SidebarLayout.js +1 -1
- package/dist/shell/SidebarNav.js +1 -1
- package/dist/shell/SortableList.js +1 -1
- package/dist/shell/StatusBadge.js +1 -1
- package/dist/shell/Tabs.js +1 -1
- package/dist/shell/TimelineTrack.js +1 -1
- package/dist/shell/Tooltip.js +1 -1
- package/dist/shell/TopNav.js +1 -1
- package/dist/shell/TransferProgress.js +1 -1
- package/dist/shell/Tree.js +1 -1
- package/dist/shell/discardGuard.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/AuthScreen.js +1 -1
- package/dist/templates/ChatTemplate.js +1 -1
- package/dist/templates/CheckoutTemplate.js +1 -1
- package/dist/templates/DashboardTemplate.js +1 -1
- package/dist/templates/DataTablePage.js +1 -1
- package/dist/templates/EmailTemplate.js +1 -1
- package/dist/templates/ErrorBoundary.js +1 -1
- package/dist/templates/FormLayoutPage.js +1 -1
- package/dist/templates/GalleryTemplate.js +1 -1
- package/dist/tokens/colour.d.ts +2 -2
- package/dist/ui/index.js +1 -1
- package/dist/value-index.json +1 -0
- package/dist/version.js +1 -1
- package/package.json +4 -3
- package/dist/Calculator-PKAM5ERT.js +0 -29
- package/dist/PomodoroTimer-PBSAKRX5.js +0 -91
- package/dist/Sidebar-HAIHWIJD.js +0 -44
- package/dist/chunk-2AEYVQ2R.js +0 -2
- package/dist/chunk-3GJVTK4H.js +0 -11
- package/dist/chunk-3TD3GH53.js +0 -7
- package/dist/chunk-44ERJYNW.js +0 -6
- package/dist/chunk-AAFPAQXH.js +0 -13
- package/dist/chunk-EX3DARI3.js +0 -7
- package/dist/chunk-F2RAIGCG.js +0 -6
- package/dist/chunk-FLQXMCB3.js +0 -8
- package/dist/chunk-N6PMH6DU.js +0 -6
- package/dist/chunk-O5ZBRG2G.js +0 -1
- package/dist/chunk-PP3WUT2G.js +0 -15
- package/dist/chunk-PWX64YBI.js +0 -28
- package/dist/chunk-RJVIKGHJ.js +0 -4
- package/dist/chunk-SRI2D23Y.js +0 -14
- package/dist/chunk-UTISUEO4.js +0 -2
- package/dist/chunk-UVHXVSB2.js +0 -1
- package/dist/chunk-WCCS4VFE.js +0 -1
- package/dist/chunk-ZDXRSY2Y.js +0 -1
- package/dist/chunk-ZISKHQZY.js +0 -3
- /package/dist/{chunk-4BYJABCX.js → chunk-5YTZBYG4.js} +0 -0
package/README.md
CHANGED
|
@@ -4587,9 +4587,13 @@ so an app importing from both has one hook.
|
|
|
4587
4587
|
### React-only hooks — `efficient-shell/hooks`
|
|
4588
4588
|
|
|
4589
4589
|
`useBrowserLayoutEffect` (a layout effect in a browser, the plain effect on a
|
|
4590
|
-
server)
|
|
4591
|
-
|
|
4592
|
-
|
|
4590
|
+
server), for a package whose modules may import React and nothing else
|
|
4591
|
+
(efficient-easel's engine leaves) and so cannot take `efficient-shell/ui` or the
|
|
4592
|
+
root. The hook picks each time it is called, from `globalThis.document`, so
|
|
4593
|
+
importing the entry reads no browser global: a spec may make `window` and
|
|
4594
|
+
`document` throw and still import it
|
|
4595
|
+
(`tests/hooksEntryReadsNoGlobal.server.test.tsx`). `IN_BROWSER`, a module-scope
|
|
4596
|
+
read, is the root's (`import { IN_BROWSER } from 'efficient-shell'`).
|
|
4593
4597
|
|
|
4594
4598
|
```ts
|
|
4595
4599
|
import { useBrowserLayoutEffect } from 'efficient-shell/hooks';
|
|
@@ -4597,7 +4601,7 @@ import { useBrowserLayoutEffect } from 'efficient-shell/hooks';
|
|
|
4597
4601
|
|
|
4598
4602
|
**It reaches `react` and nothing else.** `tests/hooksEntryIsReactOnly.test.ts`
|
|
4599
4603
|
walks the source graph and `scripts/verify-dist.mjs` the built one, and pins the
|
|
4600
|
-
|
|
4604
|
+
one export. It is the one home of the hook: `src/hooks/layout-effect.ts`. The
|
|
4601
4605
|
root's `useBrowserLayoutEffect` is the same binding, so an app importing from
|
|
4602
4606
|
both has one hook. Never write the pick (`IN_BROWSER ? useLayoutEffect :
|
|
4603
4607
|
useEffect`) in another module (`tests/oneBeforePaint.test.ts`).
|
|
@@ -5413,6 +5417,8 @@ itself where the kit has an answer:
|
|
|
5413
5417
|
| `own-text` | text drawn with its own type: a raw `<h1>`…`<h6>`; a raw `<p>` or `<span>` with a type class (a size step `text-xs` … or an arbitrary size, a weight `font-medium` … or `font-[600]`, also through `clsx()`) or an inline `fontSize` / `fontWeight`; in a stylesheet, a rule that sets its own `font-size` or `font` (not a reset to `inherit`), once per rule, on its selector line. A pill's type is the pill's (`own-badge`) | `Title` (with `as=` for the heading level), `Paragraph`, `Text` |
|
|
5414
5418
|
| `own-badge` | a pill drawn by hand: a raw `span`, `div`, `small`, `strong`, `b`, `em`, `i`, `p`, `mark`, `label` or `li` whose classes (a string, a template, the strings of a ternary or a `clsx()`) give it a round corner, a background colour, a text colour, side padding and a pill's height (a vertical padding of 0 to 3px, or a full round with small type and no vertical padding). Not counted: a box with a box's padding, a `<button>` (the `button` kind) | `ColoredBadge` (a tone), `StatusBadge` |
|
|
5415
5419
|
| `shell-part-copy` | a component defined under the name of a shell part: a function with a body, a class, or a `const` set to an arrow, a function, or `forwardRef` / `memo` of one, named like a PascalCase value the shell exports (`Title`, `Card`, `ColoredBadge` …). The names are read when the check runs, from the installed shell's own `dist/index.js` and `dist/ui/index.js` (through `export *`), never from a hand list: a part a release adds is covered by that release. A run that cannot read them fails | import the part from `efficient-shell` (`efficient-shell/ui`) |
|
|
5420
|
+
| `copied-value` | a top-level `const` whose literal value is the same as a `const` a package exports (its copy index, below): a string of 8 or more characters with a character other than a letter (a slug, a key, an attribute), an array of 3 or more items one of which is a string of 8 or more or an object, an object of 3 or more keys. Key order and casts are no difference. Not counted: a number, a boolean, a one-word label, a hex colour (the `colour` kind), a short list of short words | the export named after each line (`` `PAGE_ORDER` from efficient-storefront-blocks/render/lib/storefront-page-order``), imported |
|
|
5421
|
+
| `copied-routine` | a function (any depth: a declaration, an arrow, a method) whose parameters and body are the same as a function a package exports, with local names, types, casts and parentheses aside and literals kept; 25 or more syntax nodes. Not counted: a function that reads module state of its own file (a top-level `let` / `var`, or a `const` made by `new` or a call: a Map, a cache), since the export reads its own module's state | the export named after each line, imported |
|
|
5416
5422
|
| `hand-motion` | a typed time, weight or length where the shell has a token: a time in a `transition` / `animation`, a `duration-150` / `delay-[40ms]` class, a numeric or bold `font-weight` / `fontWeight` / `font-[600]`, a literal border width (`border-[1px]`, `borderWidth: 1`, `border: 1px solid …`); in a stylesheet also a literal `padding`, `margin` or `gap`, and a custom property set to one literal length or time (an own token: `--rail-w: 44px`). Not counted: a token, a zero, `none` | `--motion-fast` / `--motion-base`, `--weight-*`, `--border-hairline` / `-strong` / `-accent`, `--space-*`, `--row-height-*`, `--control-height-*` |
|
|
5417
5423
|
|
|
5418
5424
|
Known gaps: `rgb()` / `hsl()` colours, colours in `.ts` maps, and
|
|
@@ -5454,6 +5460,27 @@ and reviewed:
|
|
|
5454
5460
|
again in the same change: take them out of `kinds` and run `--update` (it
|
|
5455
5461
|
drops their lines), put them back with the key, and run
|
|
5456
5462
|
`--init --kind <kind>` for each.
|
|
5463
|
+
- **The copy index.** `copied-value` and `copied-routine` read the values and
|
|
5464
|
+
routines a package exports, by fingerprint (a hash: no source ships). The
|
|
5465
|
+
shell writes one; efficient-easel, efficient-web-builder and
|
|
5466
|
+
efficient-storefront-blocks write theirs from their next release. Each
|
|
5467
|
+
package writes its own at build time, from its own source and
|
|
5468
|
+
its own `exports` map, into `dist/value-index.json` and
|
|
5469
|
+
`dist/routine-index.json`:
|
|
5470
|
+
`efficient-shell-ui-check --write-index dist [--src src] [--entry <subpath>=<file>]`.
|
|
5471
|
+
A script export with no source at `<src>/<path>.ts(x)` fails the build until
|
|
5472
|
+
`--entry` names it: a file, a pattern (`./render/*=src/sides/*.tsx`), or a
|
|
5473
|
+
folder and every module under it (`./render/*=src/render/**`). The check
|
|
5474
|
+
reads the index of each declared package installed under `node_modules` (the
|
|
5475
|
+
version the repository installs; no list of names), and the shell's beside the
|
|
5476
|
+
command only when the repository does not install the shell itself. Only a
|
|
5477
|
+
package the repository declares counts (`dependencies`, `peerDependencies`,
|
|
5478
|
+
`optionalDependencies`, and in an app, `"private": true`, `devDependencies`
|
|
5479
|
+
too): a package that does not depend on another cannot import from it, so the
|
|
5480
|
+
copy is counted where the import can be written. A package never counts its
|
|
5481
|
+
own exports. A run that reads no index at all fails. A generated file (the
|
|
5482
|
+
upload limits a repository generates from the backend's export) goes in
|
|
5483
|
+
`exclude`.
|
|
5457
5484
|
- `includeValues` (globs) does the same for the design-value kinds
|
|
5458
5485
|
(`VALUE_KINDS`: `hex`, `colour`, `radius`, `spacing`, `font-size`, `shadow`,
|
|
5459
5486
|
`hand-motion`): they also read every file these globs match, `output`
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import{InputEndActionButton as e}from"./chunk-
|
|
1
|
+
import{InputEndActionButton as e}from"./chunk-W6REY3SV.js";import"./chunk-AYZY3YNC.js";import{peekBrowserStartUrl as t,claimBrowserStartUrl as o}from"./chunk-LWLCNQY7.js";import{AboutApp as r}from"./chunk-P2HZ2V3U.js";import{WindowTitle as n}from"./chunk-6IP4Q3AT.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-YI4T5I5D.js";import"./chunk-PSVGB7KT.js";import"./chunk-TTD2M6RF.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import{confirm as s}from"./chunk-2XDO7FZC.js";import"./chunk-ZSVU44OB.js";import"./chunk-EIFNESXS.js";import"./chunk-7WF6LFOJ.js";import"./chunk-CJ4OEY3T.js";import"./chunk-AH5MLH54.js";import"./chunk-5YTZBYG4.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-6X32SWQI.js";import"./chunk-4PJFL26P.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-POBVGDZP.js";import"./chunk-AW7TOB6N.js";import"./chunk-5F3HPOBH.js";import"./chunk-M5IZ7QLQ.js";import"./chunk-XNKNX5L3.js";import"./chunk-DWGYC7OD.js";import"./chunk-MYH5H43C.js";import"./chunk-RTK77DMP.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-EDRELF6L.js";import"./chunk-MEP6CZJ3.js";import"./chunk-IVEM2BPC.js";import{Icon as a}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-G3TC2GIA.js";import"./chunk-AJPQJ7TC.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-STKJA4PV.js";import"./chunk-M6UKCZHT.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useRef as i,useEffect as c,useState as l}from"react";import{jsxs as m,jsx as u,Fragment as h}from"react/jsx-runtime";var d="react-os-shell:browser-bookmarks",p="react-os-shell:browser-homepage",k="https://en.wikipedia.org/wiki/Main_Page",b=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],g=new Set(["ac ad ae af ag ai al am ao aq ar as at au aw ax az ba bb bd be bf bg bh bi","bj bm bn bo br bs bt bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu cv","cw cx cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga gd","ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id ie il","im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc","li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms mt mu","mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pl","pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sk sl sm sn","so sr ss st su sv sx sy sz tc td tf tg th tj tk tl tm tn to tr tt tv tw tz","ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw","com net org edu gov mil int info biz name pro app dev xyz online site tech","store shop cloud design digital agency studio media news blog live life","world today email systems solutions services software page link space host","press wiki team group works careers finance capital energy academy"].join(" ").split(" "));function f(e){let t=e.trim();return t?/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:function(e){const t=/^([\w-]+\.)+([a-z]{2,})(\/.*)?$/i.exec(e);return null!==t&&g.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var w=["duckduckgo.com","developer.mozilla.org","google.com","gmail.com","youtube.com","facebook.com","instagram.com","whatsapp.com","twitter.com","x.com","github.com","gitlab.com","linkedin.com","reddit.com","pinterest.com","amazon.com","amazon.ca","amazon.co.uk","apple.com","icloud.com","microsoft.com","outlook.com","live.com","office.com","netflix.com","spotify.com","paypal.com","stripe.com","chat.openai.com","chatgpt.com","claude.ai"];function x(){if("undefined"==typeof window)return b;try{const e=localStorage.getItem(d);if(!e)return b;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return b}function y(){return"undefined"==typeof window?k:localStorage.getItem(p)||k}function v(){const h=i(void 0);void 0===h.current&&(h.current=t()),c(()=>{null!=h.current&&o(h.current)},[]);const k=h.current?f(h.current.url):"",[b,g]=l(y),[w,v]=l(k||b),[C,R]=l(w),[W,T]=l([w]),[H,z]=l(0),[P,S]=l(0),[D,E]=l(x),[L,M]=l(!1),[Z,F]=l(null),G=i(null),J=i(null);c(()=>{try{localStorage.setItem(d,JSON.stringify(D))}catch{}},[D]);const U=e=>{const t=f(e);t&&(v(t),R(t),T(e=>{const o=e.slice(0,H+1);return o.push(t),o}),z(e=>e+1),M(!1))},Y=()=>{"undefined"!=typeof window&&window.open(w,"_blank","noopener,noreferrer")},O=()=>{const e=Z?.trim();e?(E(t=>[...t,{label:e,url:w}]),F(null)):F(null)};c(()=>{if(null===Z)return;G.current?.focus(),G.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||F(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==Z]);const Q=e=>{E(t=>t.filter((t,o)=>o!==e))},B=H>0,I=H<W.length-1,A=D.some(e=>e.url===w),V="p-2 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
|
|
2
2
|
return m("div",{className:"relative flex flex-col h-full bg-white",children:[
|
|
3
3
|
/* @__PURE__ */u(n,{title:`Browser - ${j(w)}`}),
|
|
4
4
|
/* @__PURE__ */u(r,{app:"browser"}),
|
|
5
5
|
/* @__PURE__ */m("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-line bg-surface-sunken shrink-0",children:[
|
|
6
|
-
/* @__PURE__ */u("button",{onClick:()=>{if(
|
|
7
|
-
/* @__PURE__ */u("button",{onClick:()=>{if(
|
|
8
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
9
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
10
|
-
/* @__PURE__ */u("form",{onSubmit:e=>{e.preventDefault(),
|
|
6
|
+
/* @__PURE__ */u("button",{onClick:()=>{if(H>0){const e=H-1;z(e),v(W[e]),R(W[e]),M(!1)}},disabled:!B,className:V,title:"Back",children:/* @__PURE__ */u(a,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
|
|
7
|
+
/* @__PURE__ */u("button",{onClick:()=>{if(H<W.length-1){const e=H+1;z(e),v(W[e]),R(W[e]),M(!1)}},disabled:!I,className:V,title:"Forward",children:/* @__PURE__ */u(a,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */u("button",{onClick:()=>S(e=>e+1),className:V,title:"Refresh",children:/* @__PURE__ */u(a,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
9
|
+
/* @__PURE__ */u("button",{onClick:()=>U(b),className:V,title:"Home",children:/* @__PURE__ */u(a,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
10
|
+
/* @__PURE__ */u("form",{onSubmit:e=>{e.preventDefault(),U(C)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */m("div",{className:"flex items-center w-full bg-white border border-gray-300 rounded focus-within:border-blue-400 focus-within:ring-1 focus-within:ring-blue-200",children:[
|
|
11
11
|
/* @__PURE__ */u("span",{className:"px-2 text-gray-400 text-xs",children:w.startsWith("https://")?"🔒":"⚠️"}),
|
|
12
12
|
/* @__PURE__ */u("input",{type:"text",value:C,onChange:e=>R(e.target.value),onFocus:e=>e.target.select(),className:"flex-1 px-1 py-1 text-sm bg-transparent outline-none font-mono",spellCheck:!1,placeholder:"Enter URL or search…"}),w!==C&&
|
|
13
13
|
/* @__PURE__ */u("span",{className:"flex pr-1",children:/* @__PURE__ */u(e,{action:{label:"Reset to current URL",icon:/* @__PURE__ */u(a,{name:"close"}),onClick:()=>R(w)}})})]})}),
|
|
14
|
-
/* @__PURE__ */u("button",{"data-bookmark-popover":!0,onClick:()=>Q
|
|
15
|
-
/* @__PURE__ */u("button",{onClick:
|
|
16
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
14
|
+
/* @__PURE__ */u("button",{"data-bookmark-popover":!0,onClick:()=>A?Q(D.findIndex(e=>e.url===w)):void F(j(w)),className:V+" "+(A?"text-yellow-500":""),title:A?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */u(a,{name:"star",className:"h-4 w-4",fill:A?"currentColor":"none",strokeWidth:1.5})}),
|
|
15
|
+
/* @__PURE__ */u("button",{onClick:Y,className:V,title:"Open in new tab",children:/* @__PURE__ */u(a,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
|
|
16
|
+
/* @__PURE__ */u("button",{onClick:()=>M(e=>!e),className:V,title:"Embedding help",children:/* @__PURE__ */u(a,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==Z&&/* @__PURE__ */m("div",{"data-bookmark-popover":!0,className:"absolute right-3 top-12 z-30 w-72 bg-white border border-gray-200 rounded-md shadow-lg p-3",children:[
|
|
17
17
|
/* @__PURE__ */u("div",{className:"text-2xs font-semibold uppercase tracking-wide text-ink-faint mb-1",children:"Bookmark this page"}),
|
|
18
18
|
/* @__PURE__ */u("div",{className:"text-2xs text-ink-faintest truncate mb-2 font-mono",title:w,children:w}),
|
|
19
|
-
/* @__PURE__ */u("input",{ref:
|
|
19
|
+
/* @__PURE__ */u("input",{ref:G,type:"text",value:Z,onChange:e=>F(e.target.value),onKeyDown:e=>{"Enter"===e.key?O():"Escape"===e.key&&F(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-line-strong rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
|
|
20
20
|
/* @__PURE__ */m("div",{className:"flex justify-end gap-1 mt-2",children:[
|
|
21
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
22
|
-
/* @__PURE__ */u("button",{onClick:
|
|
23
|
-
/* @__PURE__ */m("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===
|
|
21
|
+
/* @__PURE__ */u("button",{onClick:()=>F(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
|
|
22
|
+
/* @__PURE__ */u("button",{onClick:O,disabled:!Z.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
|
|
23
|
+
/* @__PURE__ */m("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===D.length&&/* @__PURE__ */u("span",{className:"text-2xs text-ink-faintest italic px-2",children:"No bookmarks yet — star the address bar to add one."}),D.map((e,t)=>/* @__PURE__ */m("button",{onClick:()=>U(e.url),onContextMenu:async o=>{o.preventDefault();await s({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&Q(t)},className:"flex items-center gap-2 px-2 py-0.5 rounded text-xs text-ink hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
|
|
24
24
|
/* @__PURE__ */u("img",{src:`https://icons.duckduckgo.com/ip3/${new URL(e.url).hostname}.ico`,alt:"",className:"h-3.5 w-3.5",onError:e=>{e.target.style.visibility="hidden"}}),e.label]},t)),
|
|
25
25
|
/* @__PURE__ */u("div",{className:"flex-1"}),
|
|
26
26
|
/* @__PURE__ */u("button",{onClick:()=>{g(w);try{localStorage.setItem(p,w)}catch{}},className:"px-2 py-0.5 text-2xs text-ink-faint hover:text-ink-strong",title:"Set current page as homepage",children:"Set as home"})]}),
|
|
27
|
-
/* @__PURE__ */u("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */u(N,{url:w,iframeKey:
|
|
27
|
+
/* @__PURE__ */u("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */u(N,{url:w,iframeKey:P,iframeRef:J,openExternal:Y,showHelp:L,dismissHelp:()=>M(!1)})})]})}function j(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function N({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:n,dismissHelp:s}){const[i,d]=l(!1);c(()=>{d(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return w.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!i?/* @__PURE__ */u("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */m("div",{className:"max-w-md text-center",children:[
|
|
28
28
|
/* @__PURE__ */u(a,{name:"no-symbol",className:"h-14 w-14 mx-auto text-gray-300 mb-3",strokeWidth:1.2}),
|
|
29
29
|
/* @__PURE__ */m("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[j(e)," can't be embedded"]}),
|
|
30
30
|
/* @__PURE__ */m("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-XLPUIGMO.js";import{useWidgetSettings as n}from"./chunk-6IP4Q3AT.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-YI4T5I5D.js";import"./chunk-PSVGB7KT.js";import"./chunk-TTD2M6RF.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-2XDO7FZC.js";import"./chunk-ZSVU44OB.js";import"./chunk-EIFNESXS.js";import"./chunk-7WF6LFOJ.js";import"./chunk-CJ4OEY3T.js";import"./chunk-AH5MLH54.js";import"./chunk-5YTZBYG4.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-6X32SWQI.js";import"./chunk-4PJFL26P.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-POBVGDZP.js";import"./chunk-AW7TOB6N.js";import"./chunk-M5IZ7QLQ.js";import"./chunk-XNKNX5L3.js";import"./chunk-DWGYC7OD.js";import"./chunk-MYH5H43C.js";import"./chunk-RTK77DMP.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-EDRELF6L.js";import"./chunk-MEP6CZJ3.js";import"./chunk-IVEM2BPC.js";import{Icon as r}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-G3TC2GIA.js";import"./chunk-AJPQJ7TC.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-STKJA4PV.js";import"./chunk-M6UKCZHT.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as c,useRef as i,useCallback as o,useEffect as s}from"react";import{jsxs as l,Fragment as a,jsx as u}from"react/jsx-runtime";var h="calc_appearance";function m(){const[m,k]=c("0"),[p,d]=c(null),[j,b]=c(null),[g,N]=c(!1),[C,y]=c(""),[x,f]=c([]),[v,T]=c(!1),[$,E]=c(()=>t(h)),[M,F]=c(!1),[P,Z]=c($),D=i(null);n(o(()=>{Z({...$}),F(!0)},[$]));const J=o(t=>{y(""),k(e=>g||"0"===e?(N(!1),"."===t?"0.":t):"."===t&&e.includes(".")?e:e+t)},[g]),W=o(()=>{k("0"),d(null),b(null),N(!1)},[]),G=o((t,e,n)=>{switch(n){case"+":return t+e;case"-":return t-e;case"×":return t*e;case"÷":return 0===e?0:t/e;default:return e}},[]),S=o(t=>{const e=parseFloat(m);if(null!==p&&j&&!g){const t=G(p,e,j);k(String(t)),d(t),f(n=>[`${p} ${j} ${e} = ${t}`,...n].slice(0,20))}else d(e);b(t),N(!0)},[m,p,j,g,G]),H=o(()=>{if(null===p||!j)return;const t=parseFloat(m),e=G(p,t,j),n=`${p} ${j} ${t} =`;f(t=>[`${n} ${e}`,...t].slice(0,20)),y(n),k(String(e)),d(null),b(null),N(!0)},[m,p,j,G]),Q=o(()=>{k(t=>String(parseFloat(t)/100))},[]),R=o(()=>{k(t=>t.startsWith("-")?t.slice(1):"0"===t?t:"-"+t)},[]);s(()=>{const t=t=>{const e=t.target.tagName;"INPUT"!==e&&"TEXTAREA"!==e&&"SELECT"!==e&&(t.key>="0"&&t.key<="9"?J(t.key):"."===t.key?J("."):"+"===t.key?S("+"):"-"===t.key?S("-"):"*"===t.key?S("×"):"/"===t.key?(t.preventDefault(),S("÷")):"Enter"===t.key||"="===t.key?("Enter"===t.key&&t.target instanceof Node&&D.current?.contains(t.target)&&t.preventDefault(),H()):"Escape"===t.key?W():"Backspace"===t.key?k(t=>t.length>1?t.slice(0,-1):"0"):"%"===t.key&&Q())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[J,S,H,W,Q]);const A="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",B=`${A} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,L=`${A} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,X=`${A} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,w=`${A} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
|
|
2
|
+
return l(a,{children:[
|
|
3
|
+
/* @__PURE__ */l("div",{ref:D,className:"flex flex-col h-full",style:{opacity:$.activeOpacity/100,backdropFilter:$.activeBlur>0?`blur(${$.activeBlur}px)`:void 0},children:[
|
|
4
|
+
/* @__PURE__ */l("div",{className:"bg-slate-200 rounded-t-lg px-4 py-2 group/display relative flex flex-col justify-end min-h-[120px] border-b border-slate-300",children:[
|
|
5
|
+
/* @__PURE__ */u("div",{className:"flex flex-col justify-end flex-1 overflow-hidden",children:x.slice(0,3).reverse().map((t,e)=>/* @__PURE__ */u("div",{className:"text-2xs text-slate-400 text-right font-mono truncate",children:t},e))}),(C||j&&null!==p)&&/* @__PURE__ */u("div",{className:"text-base text-slate-600 text-right font-mono",children:C||`${p} ${j} ${g?"":m}`}),
|
|
6
|
+
/* @__PURE__ */l("div",{className:"flex items-center gap-2",children:[
|
|
7
|
+
/* @__PURE__ */u("button",{onClick:()=>{navigator.clipboard.writeText(m),T(!0),setTimeout(()=>T(!1),1200)},title:"Copy result",className:"shrink-0 text-slate-300 hover:text-slate-500 transition-colors opacity-0 group-hover/display:opacity-100",children:/* @__PURE__ */u(r,v?{name:"check",className:"h-5 w-5 text-green-500",strokeWidth:2}:{name:"copy",className:"h-5 w-5",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */u("div",{className:"text-right text-4xl font-mono font-bold text-slate-800 truncate flex-1",children:(t=>{const e=parseFloat(t);return isNaN(e)||t.endsWith(".")||t.endsWith(".0")||Math.abs(e)<1e15&&t.length<16?t:e.toExponential(6)})(m)})]})]}),
|
|
9
|
+
/* @__PURE__ */l("div",{className:"grid grid-cols-4 grid-rows-5 gap-2 flex-1 min-h-0 p-2",children:[
|
|
10
|
+
/* @__PURE__ */u("button",{onClick:W,className:X,children:"AC"}),
|
|
11
|
+
/* @__PURE__ */u("button",{onClick:R,className:X,children:"+/−"}),
|
|
12
|
+
/* @__PURE__ */u("button",{onClick:Q,className:X,children:"%"}),
|
|
13
|
+
/* @__PURE__ */u("button",{onClick:()=>S("÷"),className:`${L} ${"÷"===j?"ring-2 ring-blue-400":""}`,children:"÷"}),
|
|
14
|
+
/* @__PURE__ */u("button",{onClick:()=>J("7"),className:B,children:"7"}),
|
|
15
|
+
/* @__PURE__ */u("button",{onClick:()=>J("8"),className:B,children:"8"}),
|
|
16
|
+
/* @__PURE__ */u("button",{onClick:()=>J("9"),className:B,children:"9"}),
|
|
17
|
+
/* @__PURE__ */u("button",{onClick:()=>S("×"),className:`${L} ${"×"===j?"ring-2 ring-blue-400":""}`,children:"×"}),
|
|
18
|
+
/* @__PURE__ */u("button",{onClick:()=>J("4"),className:B,children:"4"}),
|
|
19
|
+
/* @__PURE__ */u("button",{onClick:()=>J("5"),className:B,children:"5"}),
|
|
20
|
+
/* @__PURE__ */u("button",{onClick:()=>J("6"),className:B,children:"6"}),
|
|
21
|
+
/* @__PURE__ */u("button",{onClick:()=>S("-"),className:`${L} ${"-"===j?"ring-2 ring-blue-400":""}`,children:"−"}),
|
|
22
|
+
/* @__PURE__ */u("button",{onClick:()=>J("1"),className:B,children:"1"}),
|
|
23
|
+
/* @__PURE__ */u("button",{onClick:()=>J("2"),className:B,children:"2"}),
|
|
24
|
+
/* @__PURE__ */u("button",{onClick:()=>J("3"),className:B,children:"3"}),
|
|
25
|
+
/* @__PURE__ */u("button",{onClick:()=>S("+"),className:`${L} ${"+"===j?"ring-2 ring-blue-400":""}`,children:"+"}),
|
|
26
|
+
/* @__PURE__ */u("button",{onClick:()=>J("0"),className:`${B} col-span-2`,children:"0"}),
|
|
27
|
+
/* @__PURE__ */u("button",{onClick:()=>J("."),className:B,children:"."}),
|
|
28
|
+
/* @__PURE__ */u("button",{onClick:H,className:w,children:"="})]})]}),
|
|
29
|
+
/* @__PURE__ */u(e,{open:M,onClose:()=>F(!1),title:"Calculator Settings",appearance:P,onAppearanceChange:Z,onSave:()=>{E(P),localStorage.setItem(h,JSON.stringify(P)),F(!1)}})]})}export{m as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-
|
|
1
|
+
import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-XLPUIGMO.js";import{useWidgetSettings as r}from"./chunk-6IP4Q3AT.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-YI4T5I5D.js";import"./chunk-PSVGB7KT.js";import"./chunk-TTD2M6RF.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-2XDO7FZC.js";import"./chunk-ZSVU44OB.js";import"./chunk-EIFNESXS.js";import"./chunk-7WF6LFOJ.js";import"./chunk-CJ4OEY3T.js";import"./chunk-AH5MLH54.js";import"./chunk-5YTZBYG4.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-6X32SWQI.js";import"./chunk-4PJFL26P.js";import"./chunk-F3ZOO23R.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-POBVGDZP.js";import"./chunk-AW7TOB6N.js";import"./chunk-M5IZ7QLQ.js";import"./chunk-XNKNX5L3.js";import"./chunk-DWGYC7OD.js";import"./chunk-MYH5H43C.js";import"./chunk-RTK77DMP.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-EDRELF6L.js";import"./chunk-MEP6CZJ3.js";import"./chunk-IVEM2BPC.js";import"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as n}from"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-G3TC2GIA.js";import"./chunk-AJPQJ7TC.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-STKJA4PV.js";import"./chunk-M6UKCZHT.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as s,useCallback as o,useEffect as c}from"react";import{jsxs as i,Fragment as a,jsx as m}from"react/jsx-runtime";var l=["USD","CNY","AUD","GBP","EUR","JPY","CAD","THB","NZD","SGD","HKD","CHF","KRW","INR","MXN","BRL"],u=[["USD","CNY"],["USD","AUD"],["GBP","USD"],["USD","JPY"]],p="currency_pairs",h="currency_appearance",d="currency_rates_cache";function k(t){try{const e=JSON.parse(localStorage.getItem(d)||"{}")[t];if(e&&Date.now()-e.timestamp<36e5)return e.rates}catch{}return null}function j(t,e){try{const r=JSON.parse(localStorage.getItem(d)||"{}");r[t]={rates:e,timestamp:Date.now()},localStorage.setItem(d,JSON.stringify(r))}catch{}}function g(){try{const t=JSON.parse(localStorage.getItem(p)||"");if(Array.isArray(t)&&t.length)return t.slice(0,4)}catch{}return u}var N={USD:"🇺🇸",CNY:"🇨🇳",AUD:"🇦🇺",GBP:"🇬🇧",JPY:"🇯🇵",CAD:"🇨🇦",EUR:"🇪🇺",THB:"🇹🇭",NZD:"🇳🇿",SGD:"🇸🇬",HKD:"🇭🇰",CHF:"🇨🇭",KRW:"🇰🇷",INR:"🇮🇳",MXN:"🇲🇽",BRL:"🇧🇷"};function f(){const[u,d]=s(g),[f,x]=s(()=>t(h)),[y,b]=s({}),[D,S]=s(!1),[C,v]=s(!1),[J,P]=s([]),[U,T]=s(f),[M,R]=s("USD"),[B,G]=s("CNY");r(o(()=>{P([...u]),T({...f}),v(!0)},[u,f])),c(()=>{const t=[...new Set(u.map(([t])=>t))];let e=!0;return async function(){S(!0);const r={};for(const e of t){const t=k(e);if(t)r[e]=t;else try{const t=await fetch(`https://open.er-api.com/v6/latest/${e}`),n=await t.json();n.rates&&(r[e]=n.rates,j(e,n.rates))}catch{}}e&&(b(r),S(!1))}(),()=>{e=!1}},[u]);/* @__PURE__ */
|
|
2
2
|
return i(a,{children:[
|
|
3
|
-
/* @__PURE__ */m("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${f.activeOpacity/100})`,backdropFilter:f.activeBlur>0?`blur(${f.activeBlur}px)`:void 0},children:/* @__PURE__ */i("div",{className:"px-4 py-3 space-y-1",children:[
|
|
3
|
+
/* @__PURE__ */m("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${f.activeOpacity/100})`,backdropFilter:f.activeBlur>0?`blur(${f.activeBlur}px)`:void 0},children:/* @__PURE__ */i("div",{className:"px-4 py-3 space-y-1",children:[D&&/* @__PURE__ */m(n,{size:"sm",padding:"py-4",label:"Loading rates"}),u.map(([t,e],r)=>{const n=y[t]?.[e];/* @__PURE__ */
|
|
4
4
|
return i("button",{onClick:()=>{const t=u.map((t,e)=>e===r?[t[1],t[0]]:t);d(t),localStorage.setItem(p,JSON.stringify(t))},className:"flex items-center justify-between px-2 py-2 border-b border-gray-200 last:border-0 w-full hover:bg-gray-100 rounded transition-colors cursor-pointer",children:[
|
|
5
5
|
/* @__PURE__ */i("div",{className:"flex items-center gap-2",children:[
|
|
6
6
|
/* @__PURE__ */m("span",{className:"text-base",children:N[t]||""}),
|
|
@@ -9,13 +9,13 @@ return i("button",{onClick:()=>{const t=u.map((t,e)=>e===r?[t[1],t[0]]:t);d(t),l
|
|
|
9
9
|
/* @__PURE__ */m("span",{className:"text-base",children:N[e]||""}),
|
|
10
10
|
/* @__PURE__ */m("span",{className:"text-sm font-semibold text-gray-700",children:e})]}),
|
|
11
11
|
/* @__PURE__ */m("div",{className:"text-base font-mono font-semibold text-gray-900 tabular-nums",children:null!=n?n.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:4}):"—"})]},`${t}-${e}-${r}`)})]})}),
|
|
12
|
-
/* @__PURE__ */m(e,{open:
|
|
12
|
+
/* @__PURE__ */m(e,{open:C,onClose:()=>v(!1),title:"Currency Settings",appearance:U,onAppearanceChange:T,onSave:()=>{if(0===J.length)return;const t=J.slice(0,4);d(t),x(U),localStorage.setItem(p,JSON.stringify(t)),localStorage.setItem(h,JSON.stringify(U)),v(!1)},children:/* @__PURE__ */i("div",{children:[
|
|
13
13
|
/* @__PURE__ */i("h3",{className:"text-sm font-semibold text-ink mb-2",children:["Currency Pairs ",
|
|
14
|
-
/* @__PURE__ */i("span",{className:"text-2xs font-normal text-ink-faintest",children:["(",
|
|
15
|
-
/* @__PURE__ */m("div",{className:"space-y-1 mb-2",children:
|
|
14
|
+
/* @__PURE__ */i("span",{className:"text-2xs font-normal text-ink-faintest",children:["(",J.length,"/",4,")"]})]}),
|
|
15
|
+
/* @__PURE__ */m("div",{className:"space-y-1 mb-2",children:J.map(([t,e],r)=>/* @__PURE__ */i("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
|
|
16
16
|
/* @__PURE__ */i("span",{className:"text-sm",children:[N[t]||""," ",t," → ",N[e]||""," ",e]}),
|
|
17
|
-
/* @__PURE__ */m("button",{onClick:()=>
|
|
18
|
-
/* @__PURE__ */m("select",{value:
|
|
17
|
+
/* @__PURE__ */m("button",{onClick:()=>P(t=>t.filter((t,e)=>e!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),J.length<4?/* @__PURE__ */i("div",{className:"flex items-center gap-2",children:[
|
|
18
|
+
/* @__PURE__ */m("select",{value:M,onChange:t=>R(t.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:l.map(t=>/* @__PURE__ */m("option",{children:t},t))}),
|
|
19
19
|
/* @__PURE__ */m("span",{className:"text-gray-400",children:"→"}),
|
|
20
|
-
/* @__PURE__ */m("select",{value:
|
|
21
|
-
/* @__PURE__ */m("button",{onClick:()=>{B
|
|
20
|
+
/* @__PURE__ */m("select",{value:B,onChange:t=>G(t.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:l.map(t=>/* @__PURE__ */m("option",{children:t},t))}),
|
|
21
|
+
/* @__PURE__ */m("button",{onClick:()=>{M!==B&&J.length<4&&P(t=>[...t,[M,B]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */i("p",{className:"text-2xs text-ink-faintest italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{f as default};
|