efficient-shell 9.12.0 → 9.14.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 +11 -1
- package/dist/{Browser-G7AXZ4OT.js → Browser-42NYVAPR.js} +13 -13
- package/dist/Calculator-PCTFUS5O.js +29 -0
- package/dist/{CurrencyConverter-EDEJOKHC.js → CurrencyConverter-OIXAMDP7.js} +8 -8
- package/dist/{Documents-7AVOO2DA.js → Documents-V2OKP6JZ.js} +26 -26
- package/dist/{Files-MT6PMAHO.js → Files-OAMTKHYK.js} +18 -18
- package/dist/{Notepad-KBRNR5BU.js → Notepad-3LG227K2.js} +10 -10
- package/dist/{PdfViewer-FFQOKKFW.js → PdfViewer-DFBPEUY5.js} +1 -1
- package/dist/{PomodoroTimer-HCLT2JVD.js → PomodoroTimer-AYGPGA6Q.js} +11 -11
- package/dist/{Preview-4SOGNXHL.js → Preview-BBQWQ4DG.js} +28 -28
- package/dist/Sidebar-RHGWTAPS.js +44 -0
- package/dist/{Spreadsheet-W2AGKEWT.js → Spreadsheet-MS5FU7ET.js} +14 -14
- package/dist/{Stock-3IBS63UR.js → Stock-GSQNTV7E.js} +3 -3
- package/dist/{Weather-EFIIVKFE.js → Weather-5XLO2GLO.js} +15 -15
- package/dist/{WorldClock-ERQQ4VWP.js → WorldClock-CG3NF4GA.js} +6 -6
- package/dist/ai/index.js +51 -51
- package/dist/apps/index.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/charts/BoxPlotChart.js +1 -1
- package/dist/charts/CandlestickChart.js +1 -1
- package/dist/charts/CartesianPlot.js +1 -1
- package/dist/charts/ChartBrush.js +1 -1
- package/dist/charts/ChartFrame.js +1 -1
- package/dist/charts/ChartSkeleton.js +1 -1
- package/dist/charts/ChordChart.js +1 -1
- package/dist/charts/ColumnChart.js +1 -1
- package/dist/charts/FunnelChart.js +1 -1
- package/dist/charts/HeatmapChart.js +1 -1
- package/dist/charts/HistogramChart.js +1 -1
- package/dist/charts/Meter.js +1 -1
- package/dist/charts/PieChart.js +1 -1
- package/dist/charts/RadarChart.js +1 -1
- package/dist/charts/RadialBarChart.js +1 -1
- package/dist/charts/RangeChart.js +1 -1
- package/dist/charts/RankedBars.js +1 -1
- package/dist/charts/SankeyChart.js +1 -1
- package/dist/charts/ScatterChart.js +1 -1
- package/dist/charts/SpecChart.js +1 -1
- package/dist/charts/StatTile.js +1 -1
- package/dist/charts/SunburstChart.js +1 -1
- package/dist/charts/TimeSeriesChart.js +1 -1
- package/dist/charts/TreemapChart.js +1 -1
- package/dist/charts/WaterfallChart.js +1 -1
- package/dist/chunk-25STFYV3.js +8 -0
- package/dist/{chunk-BNKULSCG.js → chunk-2OE5VVBE.js} +1 -1
- package/dist/{chunk-FVDX6ZSZ.js → chunk-2TQ6BLSN.js} +6 -6
- package/dist/{chunk-VZV7Q5V2.js → chunk-3AZBI76O.js} +1 -1
- package/dist/{chunk-NRGBXEBU.js → chunk-43T5JGFB.js} +1 -1
- package/dist/{chunk-QLYOGT3U.js → chunk-4E4GWE4L.js} +17 -17
- package/dist/{chunk-E6EUGQGA.js → chunk-4WZRNPIG.js} +1 -1
- package/dist/{chunk-5CVQN2BR.js → chunk-53KQSCMG.js} +7 -7
- package/dist/{chunk-65DYHG73.js → chunk-5VTRKWKO.js} +1 -1
- package/dist/{chunk-7WLFHDWA.js → chunk-66JYKX4T.js} +1 -1
- package/dist/{chunk-M5MAIJQQ.js → chunk-6L2UAAGT.js} +1 -1
- package/dist/{chunk-JENEVLJU.js → chunk-6TCJOVFX.js} +2 -2
- package/dist/{chunk-HRAK46H7.js → chunk-6YQPLI5M.js} +12 -12
- package/dist/{chunk-3MHBALGV.js → chunk-76IDLFXI.js} +1 -1
- package/dist/{chunk-D4KZOYXQ.js → chunk-7BDZZANS.js} +1 -1
- package/dist/{chunk-CJI3POCE.js → chunk-7KDGW6BR.js} +1 -1
- package/dist/{chunk-QCFN3ET4.js → chunk-7VCAMNCH.js} +1 -1
- package/dist/{chunk-VBNA237H.js → chunk-A4HA7EXR.js} +1 -1
- package/dist/{chunk-SGR4V5YI.js → chunk-A7CCSRPB.js} +1 -1
- package/dist/chunk-AEJNFA2K.js +6 -0
- package/dist/{chunk-CBMXYXBH.js → chunk-AG2OLB3E.js} +9 -9
- package/dist/{chunk-ZPW3KQ27.js → chunk-APXQMZSV.js} +28 -28
- package/dist/{chunk-IK332TWA.js → chunk-B4DR72FR.js} +1 -1
- package/dist/{chunk-WZQCRTXF.js → chunk-B7AHMB3U.js} +1 -1
- package/dist/{chunk-TQH6E5V2.js → chunk-BDAKGS7O.js} +1 -1
- package/dist/chunk-BGNJQMAZ.js +1 -0
- package/dist/{chunk-MCMUJDEP.js → chunk-BMQCUHSD.js} +1 -1
- package/dist/{chunk-GVAWCTJN.js → chunk-C45OKLRM.js} +7 -7
- package/dist/{chunk-JECMVR4S.js → chunk-C6MV6IAX.js} +8 -8
- package/dist/{chunk-5RAOFJYT.js → chunk-CBGKLHPB.js} +6 -6
- package/dist/{chunk-KTRNAMHY.js → chunk-CL7SBEBQ.js} +1 -1
- package/dist/{chunk-R6R57BWQ.js → chunk-D46AP6U5.js} +1 -1
- package/dist/{chunk-E72USUUR.js → chunk-D7X2HMMA.js} +9 -9
- package/dist/{chunk-GP5UNEKY.js → chunk-DKQWFQAV.js} +1 -1
- package/dist/{chunk-IBIUI2D3.js → chunk-DL6QIWVR.js} +1 -1
- package/dist/{chunk-7JJUI52C.js → chunk-DPDRFLBY.js} +3 -3
- package/dist/{chunk-H2XCQJRG.js → chunk-DXHLUB36.js} +1 -1
- package/dist/{chunk-YBU7NOD7.js → chunk-E7WY4GZ3.js} +1 -1
- package/dist/{chunk-RLLONZJJ.js → chunk-EGEWU776.js} +1 -1
- package/dist/{chunk-46YVA2BF.js → chunk-ELUTQZGP.js} +1 -1
- package/dist/{chunk-BJONHLET.js → chunk-EQN65XOO.js} +1 -1
- package/dist/chunk-EXJZUNNW.js +29 -0
- package/dist/{chunk-EWJELWIT.js → chunk-F24QTMTY.js} +3 -3
- package/dist/{chunk-QSUQC4AN.js → chunk-FTWWJHFX.js} +1 -1
- package/dist/{chunk-KAHYUBXM.js → chunk-GKK7DR2H.js} +8 -8
- package/dist/{chunk-NGQHXTUK.js → chunk-GKZUAT3K.js} +1 -1
- package/dist/{chunk-DRNB7KDC.js → chunk-GMRZX2ET.js} +1 -1
- package/dist/{chunk-UEIJSV45.js → chunk-GNU3U2TP.js} +1 -1
- package/dist/{chunk-FKA6ZVQO.js → chunk-GQK3U2IO.js} +9 -9
- package/dist/{chunk-UL4G6JY2.js → chunk-GRBBQ3VF.js} +1 -1
- package/dist/{chunk-AOSLOKAL.js → chunk-GXGBBMGV.js} +1 -1
- package/dist/{chunk-6O2W4X2V.js → chunk-HI6IE5HI.js} +1 -1
- package/dist/chunk-HJPCHES5.js +8 -0
- package/dist/{chunk-ZC3CCRPG.js → chunk-IGEFUHYE.js} +5 -5
- package/dist/{chunk-RISKWWMD.js → chunk-IKQVK3I3.js} +2 -2
- package/dist/{chunk-2GPHHW7C.js → chunk-IWEL2ZCV.js} +1 -1
- package/dist/{chunk-P65C5TUU.js → chunk-IWJRSC7M.js} +1 -1
- package/dist/{chunk-KECOZKJU.js → chunk-J53OQCKC.js} +7 -7
- package/dist/{chunk-BF7PZFKT.js → chunk-JB3WKDD7.js} +1 -1
- package/dist/{chunk-IENPHB5B.js → chunk-JJP54OT4.js} +1 -1
- package/dist/{chunk-MUHWI4GK.js → chunk-JKZJVQIB.js} +5 -5
- package/dist/chunk-KAVFW5CU.js +7 -0
- package/dist/{chunk-VANJPZ3H.js → chunk-KCV7BFKJ.js} +1 -1
- package/dist/chunk-KE5U4KKG.js +4 -0
- package/dist/{chunk-2AHLONPR.js → chunk-KJXF5WAJ.js} +1 -1
- package/dist/{chunk-B74Y4QR2.js → chunk-KTKMM2XW.js} +1 -1
- package/dist/chunk-LKW3YAZN.js +11 -0
- package/dist/chunk-LPUGK2MC.js +2 -0
- package/dist/{chunk-HMG5TW2R.js → chunk-M33225G6.js} +1 -1
- package/dist/{chunk-2J2OU65F.js → chunk-M5YG57UP.js} +2 -2
- package/dist/{chunk-6FI3HVUR.js → chunk-M7H3OCIL.js} +50 -50
- package/dist/{chunk-Z3CYLDHB.js → chunk-ME4VRJMK.js} +11 -11
- package/dist/{chunk-JGDLTIOX.js → chunk-MNIULUQY.js} +10 -10
- package/dist/{chunk-AG63JVX7.js → chunk-MPALY3CL.js} +5 -5
- package/dist/{chunk-KJHXCVNI.js → chunk-MRUJRFIX.js} +1 -1
- package/dist/{chunk-64R3IYAM.js → chunk-MVQMAIZM.js} +1 -1
- package/dist/{chunk-5Q3PFKB5.js → chunk-MZ26SYFY.js} +1 -1
- package/dist/{chunk-BYHKYYL6.js → chunk-NDEIZUMG.js} +1 -1
- package/dist/{chunk-2LDOLQ7F.js → chunk-NDKQDIWN.js} +5 -5
- package/dist/{chunk-O56CY36U.js → chunk-NFJDLIRM.js} +5 -5
- package/dist/{chunk-4XZXY2AF.js → chunk-OQW42DOR.js} +1 -1
- package/dist/{chunk-3FBYM6O5.js → chunk-OUKDGO4N.js} +8 -8
- package/dist/{chunk-LYX55RI3.js → chunk-P6LB3I3D.js} +1 -1
- package/dist/{chunk-5ZGL2BRZ.js → chunk-PF5CKD4C.js} +2 -2
- package/dist/{chunk-27W6BXT6.js → chunk-PKHZTFBK.js} +2 -2
- package/dist/{chunk-TBLN4MDQ.js → chunk-PKIDVVAE.js} +2 -2
- package/dist/{chunk-YWR2WRDR.js → chunk-PUCPFBYO.js} +1 -1
- package/dist/{chunk-5AWV5R6E.js → chunk-PUIQFTCO.js} +6 -6
- package/dist/{chunk-PWBLGKQ3.js → chunk-Q3MNSM7W.js} +4 -4
- package/dist/chunk-QMUAY24U.js +8 -0
- package/dist/{chunk-SAHQB2JD.js → chunk-QO35WRYA.js} +17 -17
- package/dist/{chunk-5XNN2SSR.js → chunk-QRJRGP2K.js} +8 -8
- package/dist/{chunk-6TRE326A.js → chunk-QSW3YHPK.js} +4 -4
- package/dist/{chunk-T76X2SHR.js → chunk-R2QDO7NY.js} +3 -3
- package/dist/{chunk-JQDRM6UK.js → chunk-R5EJJ6HC.js} +1 -1
- package/dist/{chunk-V5QEPNPK.js → chunk-RBIGSJ2J.js} +1 -1
- package/dist/{chunk-N52D37FS.js → chunk-RPMWF42S.js} +5 -5
- package/dist/{chunk-QMYQ4B5A.js → chunk-RQNZ2PVW.js} +4 -4
- package/dist/{chunk-TRUPMMDJ.js → chunk-RYS3URDC.js} +11 -11
- package/dist/chunk-SKETTGCJ.js +2 -0
- package/dist/{chunk-OVDHEMLK.js → chunk-SVQJZF66.js} +5 -5
- package/dist/{chunk-EOWOVR55.js → chunk-SWO4VPOB.js} +1 -1
- package/dist/chunk-TIUFFVP5.js +9 -0
- package/dist/{chunk-T7O2TNNX.js → chunk-TXMAWCR7.js} +1 -1
- package/dist/{chunk-NCRLKFXD.js → chunk-U5DMF2TX.js} +1 -1
- package/dist/{chunk-T2ITXX7R.js → chunk-UB5TLWZN.js} +7 -7
- package/dist/{chunk-ERLZDA75.js → chunk-UX5L3MOB.js} +3 -3
- package/dist/{chunk-4DBPKTVX.js → chunk-UXPZQID4.js} +15 -15
- package/dist/{chunk-H4YFANH5.js → chunk-VC42SDAC.js} +1 -1
- package/dist/{chunk-5Y6LGPZI.js → chunk-VG5NGCMQ.js} +7 -7
- package/dist/{chunk-I5XVZLDH.js → chunk-VO3ZB7C6.js} +7 -7
- package/dist/{chunk-KQSUSVMF.js → chunk-VSAI5TH7.js} +21 -21
- package/dist/{chunk-YQB5OYDC.js → chunk-VVVWVOG7.js} +1 -1
- package/dist/{chunk-O4NPQ23Q.js → chunk-VXP5L6DI.js} +1 -1
- package/dist/{chunk-D7JY2KHG.js → chunk-W244OMOU.js} +6 -6
- package/dist/{chunk-NBKQADMY.js → chunk-WFANOFHG.js} +5 -5
- package/dist/{chunk-IZQ3XTD2.js → chunk-WUMHSI4U.js} +1 -1
- package/dist/chunk-X2PZMXDP.js +1 -0
- package/dist/{chunk-X4BKHXU5.js → chunk-X6TJR6M2.js} +7 -7
- package/dist/{chunk-R7JTTKG2.js → chunk-XILZGSMX.js} +3 -3
- package/dist/chunk-XOKANFQD.js +22 -0
- package/dist/{chunk-7YZJLFAK.js → chunk-XSJJPACH.js} +10 -10
- package/dist/{chunk-XI45TSEK.js → chunk-YFUMK2E7.js} +1 -1
- package/dist/{chunk-JVYSRH6U.js → chunk-YJSX6JAC.js} +1 -1
- package/dist/{chunk-2SJDTKQA.js → chunk-YL6LLHJA.js} +21 -21
- package/dist/{chunk-N3CTLEJS.js → chunk-YVTKTWZX.js} +6 -6
- package/dist/{chunk-QLOKT22X.js → chunk-ZCV377AG.js} +1 -1
- package/dist/{chunk-UZGVIHFI.js → chunk-ZF545DXX.js} +15 -15
- package/dist/{chunk-FEPBXJUR.js → chunk-ZG2HMC7S.js} +1 -1
- package/dist/{chunk-G6LOKIFC.js → chunk-ZMVCN4OA.js} +9 -9
- package/dist/{chunk-CB6ROWOC.js → chunk-ZOBLEXIU.js} +1 -1
- package/dist/{chunk-O426Q7KC.js → chunk-ZPCADTM5.js} +1 -1
- package/dist/{chunk-5VYBPDZ2.js → chunk-ZREDCRTL.js} +1 -1
- package/dist/data/DataTable.js +1 -1
- package/dist/data/Kanban.js +1 -1
- package/dist/data/ListFooter.js +1 -1
- package/dist/data/ListLoadError.js +1 -1
- package/dist/data/Pagination.js +1 -1
- package/dist/file-intake/index.js +1 -1
- package/dist/forms/BorderInput.js +1 -1
- package/dist/forms/BrandAssetEditor.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/DateTimePicker.js +1 -1
- package/dist/forms/DisplayChips.js +1 -1
- package/dist/forms/FilePicker.js +1 -1
- package/dist/forms/FormErrorSummary.js +1 -1
- package/dist/forms/IconPicker.js +1 -1
- package/dist/forms/ImageFocusPoint.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/PositionInput.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/TagInput.js +1 -1
- package/dist/forms/TextToolbar.d.ts +8 -2
- package/dist/forms/TextToolbar.js +1 -1
- package/dist/forms/TimePicker.js +1 -1
- package/dist/forms/WidthsBar.js +1 -1
- package/dist/forms/mediaLibraryMenu.js +1 -1
- package/dist/forms/mediaMoveItems.js +1 -1
- package/dist/forms/textAlign.js +1 -1
- package/dist/forms/useFileIntake.js +1 -1
- package/dist/hooks/useTheme.d.ts +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.js +111 -111
- package/dist/locales/zh-Hans.js +1 -1
- package/dist/map/index.js +7 -7
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/shell/Accordion.js +1 -1
- package/dist/shell/AppUpdateBanner.js +1 -1
- package/dist/shell/Avatar.js +1 -1
- package/dist/shell/Banner.js +1 -1
- package/dist/shell/Breadcrumbs.js +1 -1
- package/dist/shell/BudgetBar.js +1 -1
- package/dist/shell/Card.js +1 -1
- package/dist/shell/ColoredBadge.js +1 -1
- package/dist/shell/ConfirmDialog.js +1 -1
- package/dist/shell/ContainerFillChart.js +1 -1
- package/dist/shell/CountBadge.js +1 -1
- package/dist/shell/Dialog.js +1 -1
- package/dist/shell/Drawer.js +1 -1
- package/dist/shell/EditableGrid.js +1 -1
- package/dist/shell/EmptyState.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/LanguageSelect.js +1 -1
- package/dist/shell/Markdown.js +1 -1
- package/dist/shell/MetricBar.js +1 -1
- package/dist/shell/MetricBarLegend.js +1 -1
- package/dist/shell/MilestoneTimeline.js +1 -1
- package/dist/shell/PageHeader.js +1 -1
- package/dist/shell/ProductionTimeline.js +1 -1
- package/dist/shell/ResizeHandle.js +1 -1
- package/dist/shell/Result.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/SidebarLayout.js +1 -1
- package/dist/shell/SidebarNav.js +1 -1
- package/dist/shell/SortableList.js +1 -1
- package/dist/shell/Statistic.js +1 -1
- package/dist/shell/TimeAgo.js +1 -1
- package/dist/shell/TimelineTrack.js +1 -1
- package/dist/shell/TransferProgress.js +1 -1
- package/dist/shell/Tree.js +1 -1
- package/dist/shell/language.js +1 -1
- package/dist/shell/strings.d.ts +2 -0
- package/dist/shell/strings.js +1 -1
- package/dist/shell/toast.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.d.ts +1 -1
- package/dist/templates/ErrorBoundary.js +1 -1
- package/dist/templates/ErrorPage.js +1 -1
- package/dist/templates/FormLayoutPage.js +1 -1
- package/dist/templates/GalleryTemplate.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-6NA35GFS.js +0 -29
- package/dist/Sidebar-LIP2DYTO.js +0 -44
- package/dist/chunk-3XRBVYTO.js +0 -2
- package/dist/chunk-4CPE5NBC.js +0 -8
- package/dist/chunk-4GPUKEYQ.js +0 -1
- package/dist/chunk-5R6RNUDB.js +0 -7
- package/dist/chunk-7BYBGPWU.js +0 -9
- package/dist/chunk-GCB5S2OI.js +0 -8
- package/dist/chunk-GVH3NG6G.js +0 -22
- package/dist/chunk-J7OKOVSL.js +0 -11
- package/dist/chunk-LFPJ263N.js +0 -6
- package/dist/chunk-PEM7UXQ3.js +0 -1
- package/dist/chunk-QYJQAY6C.js +0 -2
- package/dist/chunk-RSHNWBW2.js +0 -4
- package/dist/chunk-SC6HJBQA.js +0 -8
- package/dist/chunk-SYH7EPLF.js +0 -29
package/README.md
CHANGED
|
@@ -620,6 +620,16 @@ press arrives through `onMark` as `'code'` / `'quote'`, lit from `pressed`
|
|
|
620
620
|
like any mark. Quote marks a line, so it sits in row 2 after the lists. A
|
|
621
621
|
toolbar that does not offer them draws exactly what it drew before.
|
|
622
622
|
|
|
623
|
+
**Clear formatting** (Lewis 2026-10-26) is the toolbar's last button, after
|
|
624
|
+
the paragraph tools (after the word tools when there are none): pass
|
|
625
|
+
`clear={{ onClear }}` only while the range it clears wears a mark or a colour
|
|
626
|
+
(the selected words, or the whole text when none are selected, Lewis
|
|
627
|
+
2026-10-26),
|
|
628
|
+
and write the press with `clearStyle` from `efficient-shell/markup`, which
|
|
629
|
+
takes every mark and colour off and keeps a link. It wears the `revert` glyph
|
|
630
|
+
(↺, the settings rows' Reset). Being last, its coming and going moves no other
|
|
631
|
+
button; with no mark but a link and no colour offered, it is not drawn.
|
|
632
|
+
|
|
623
633
|
```tsx
|
|
624
634
|
import { TextToolbar } from 'efficient-shell/ui';
|
|
625
635
|
|
|
@@ -1695,7 +1705,7 @@ All exports are named — `import { Modal, ... } from 'efficient-shell'`.
|
|
|
1695
1705
|
| `<ShellLanguageProvider languages language strings? onChange? reload?>` | Which interface language is in force. Takes the tag `resolveShellLanguage` chose before mount and that language's shell catalog, mounts `ShellStringsProvider` with both, stamps `<html lang>`, and gives `useShellLanguage()` its `setLanguage`, which saves the choice and reloads. See [Choosing the language](#choosing-the-language--shelllanguageprovider). |
|
|
1696
1706
|
| `<ShellEntityFetcherProvider value={(endpoint, id) => …}>` | How the modal stack fetches entity data. |
|
|
1697
1707
|
| `<BugReportConfigProvider value={{ submit, list?, resolve? }}>` | Wire the bug-report flow to your backend. |
|
|
1698
|
-
| `<DesktopHostProvider value={{ stickyResolver?, saveShortcuts?, … }}>` | Sticky-note ref resolver + persistence callbacks. |
|
|
1708
|
+
| `<DesktopHostProvider value={{ stickyResolver?, saveShortcuts?, … }}>` | Sticky-note ref resolver + persistence callbacks. `onOpenWhatsNew` hands the desktop version watermark to the host's own What's New window: set, the click calls it and the shell draws no What's New dialog; unset, the built-in dialog shows `productChangelog`. |
|
|
1699
1709
|
| `<StatusBadgeProvider groups={{ status: 'success' \| ... }} labelFor?>` | Status string → semantic group. `labelFor(status)` gives every badge under it the host's words for a status (an interface in another language passes it once); a status it returns `undefined` for keeps the derived label, and a badge's own `label` still wins. `useStatusLabel()` says a status the same way outside a badge: a filter option, a search result's second line. |
|
|
1700
1710
|
| `<PortalBrandingProvider load={...} fallback={...}>` | Loads public hostname-scoped Company Profile identity before authentication, applies its favicon and optional derived document title, and exposes it through `usePortalBranding()`. |
|
|
1701
1711
|
| `setShellApiClient(axios)` | Module-level: register your axios instance once. |
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-
|
|
1
|
+
import{peekBrowserStartUrl as e,claimBrowserStartUrl as t}from"./chunk-LWLCNQY7.js";import{AboutApp as o}from"./chunk-PKHZTFBK.js";import{WindowTitle as r}from"./chunk-M7H3OCIL.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-EGEWU776.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-NDEIZUMG.js";import{confirm as n}from"./chunk-4E4GWE4L.js";import"./chunk-R2QDO7NY.js";import"./chunk-GMRZX2ET.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-DXHLUB36.js";import"./chunk-UGTRSRIW.js";import"./chunk-CDAJKLGL.js";import"./chunk-KC3EX26K.js";import"./chunk-BGNJQMAZ.js";import"./chunk-HAFB45DT.js";import"./chunk-5QFPTDQF.js";import"./chunk-URHGHXDN.js";import"./chunk-LNARMEEZ.js";import"./chunk-NHH2MXFU.js";import"./chunk-UQYNPYF4.js";import{Icon as s}from"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import"./chunk-HL6JSDN3.js";import"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import"./chunk-OZAAIE4E.js";import"./chunk-BCDG4N6L.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-X2PZMXDP.js";import"./chunk-C3QOHMR6.js";import{useRef as a,useEffect as i,useState as l}from"react";import{jsxs as c,jsx as m,Fragment as u}from"react/jsx-runtime";var d="react-os-shell:browser-bookmarks",h="react-os-shell:browser-homepage",p="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"}],k=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 g(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&&k.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var f=["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 w(){return"undefined"==typeof window?p:localStorage.getItem(h)||p}function y(){const u=a(void 0);void 0===u.current&&(u.current=e()),i(()=>{null!=u.current&&t(u.current)},[]);const p=u.current?g(u.current.url):"",[b,k]=l(w),[f,y]=l(p||b),[j,C]=l(f),[R,W]=l([f]),[z,D]=l(0),[E,H]=l(0),[L,M]=l(x),[T,U]=l(!1),[S,G]=l(null),A=a(null),J=a(null);i(()=>{try{localStorage.setItem(d,JSON.stringify(L))}catch{}},[L]);const F=e=>{const t=g(e);t&&(y(t),C(t),W(e=>{const o=e.slice(0,z+1);return o.push(t),o}),D(e=>e+1),U(!1))},P=()=>{"undefined"!=typeof window&&window.open(f,"_blank","noopener,noreferrer")},Z=()=>{const e=S?.trim();e?(M(t=>[...t,{label:e,url:f}]),G(null)):G(null)};i(()=>{if(null===S)return;A.current?.focus(),A.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||G(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==S]);const B=e=>{M(t=>t.filter((t,o)=>o!==e))},I=z>0,K=z<R.length-1,O=L.some(e=>e.url===f),X="p-2 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
|
|
2
2
|
return c("div",{className:"relative flex flex-col h-full bg-white",children:[
|
|
3
3
|
/* @__PURE__ */m(r,{title:`Browser - ${v(f)}`}),
|
|
4
4
|
/* @__PURE__ */m(o,{app:"browser"}),
|
|
5
5
|
/* @__PURE__ */c("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-line bg-surface-sunken shrink-0",children:[
|
|
6
|
-
/* @__PURE__ */m("button",{onClick:()=>{if(z>0){const e=z-1;
|
|
7
|
-
/* @__PURE__ */m("button",{onClick:()=>{if(z<R.length-1){const e=z+1;
|
|
8
|
-
/* @__PURE__ */m("button",{onClick:()=>
|
|
9
|
-
/* @__PURE__ */m("button",{onClick:()=>F(b),className:
|
|
6
|
+
/* @__PURE__ */m("button",{onClick:()=>{if(z>0){const e=z-1;D(e),y(R[e]),C(R[e]),U(!1)}},disabled:!I,className:X,title:"Back",children:/* @__PURE__ */m(s,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
|
|
7
|
+
/* @__PURE__ */m("button",{onClick:()=>{if(z<R.length-1){const e=z+1;D(e),y(R[e]),C(R[e]),U(!1)}},disabled:!K,className:X,title:"Forward",children:/* @__PURE__ */m(s,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
|
|
8
|
+
/* @__PURE__ */m("button",{onClick:()=>H(e=>e+1),className:X,title:"Refresh",children:/* @__PURE__ */m(s,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
9
|
+
/* @__PURE__ */m("button",{onClick:()=>F(b),className:X,title:"Home",children:/* @__PURE__ */m(s,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
|
|
10
10
|
/* @__PURE__ */m("form",{onSubmit:e=>{e.preventDefault(),F(j)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */c("div",{className:"flex items-center w-full bg-white border border-gray-300 rounded focus-within:border-blue-400 focus-within:ring-1 focus-within:ring-blue-200",children:[
|
|
11
11
|
/* @__PURE__ */m("span",{className:"px-2 text-gray-400 text-xs",children:f.startsWith("https://")?"🔒":"⚠️"}),
|
|
12
12
|
/* @__PURE__ */m("input",{type:"text",value:j,onChange:e=>C(e.target.value),onFocus:e=>e.target.select(),className:"flex-1 px-1 py-1 text-sm bg-transparent outline-none font-mono",spellCheck:!1,placeholder:"Enter URL or search…"}),f!==j&&/* @__PURE__ */m("button",{type:"button",onClick:()=>C(f),className:"px-2 text-2xs text-ink-faintest hover:text-ink",title:"Reset to current URL",children:"×"})]})}),
|
|
13
|
-
/* @__PURE__ */m("button",{"data-bookmark-popover":!0,onClick:()=>
|
|
14
|
-
/* @__PURE__ */m("button",{onClick:
|
|
15
|
-
/* @__PURE__ */m("button",{onClick:()=>
|
|
13
|
+
/* @__PURE__ */m("button",{"data-bookmark-popover":!0,onClick:()=>O?B(L.findIndex(e=>e.url===f)):void G(v(f)),className:X+" "+(O?"text-yellow-500":""),title:O?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */m(s,{name:"star",className:"h-4 w-4",fill:O?"currentColor":"none",strokeWidth:1.5})}),
|
|
14
|
+
/* @__PURE__ */m("button",{onClick:P,className:X,title:"Open in new tab",children:/* @__PURE__ */m(s,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
|
|
15
|
+
/* @__PURE__ */m("button",{onClick:()=>U(e=>!e),className:X,title:"Embedding help",children:/* @__PURE__ */m(s,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==S&&/* @__PURE__ */c("div",{"data-bookmark-popover":!0,className:"absolute right-3 top-12 z-30 w-72 bg-white border border-gray-200 rounded-md shadow-lg p-3",children:[
|
|
16
16
|
/* @__PURE__ */m("div",{className:"text-2xs font-semibold uppercase tracking-wide text-ink-faint mb-1",children:"Bookmark this page"}),
|
|
17
17
|
/* @__PURE__ */m("div",{className:"text-2xs text-ink-faintest truncate mb-2 font-mono",title:f,children:f}),
|
|
18
|
-
/* @__PURE__ */m("input",{ref:
|
|
18
|
+
/* @__PURE__ */m("input",{ref:A,type:"text",value:S,onChange:e=>G(e.target.value),onKeyDown:e=>{"Enter"===e.key?Z():"Escape"===e.key&&G(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"}),
|
|
19
19
|
/* @__PURE__ */c("div",{className:"flex justify-end gap-1 mt-2",children:[
|
|
20
|
-
/* @__PURE__ */m("button",{onClick:()=>
|
|
21
|
-
/* @__PURE__ */m("button",{onClick:
|
|
22
|
-
/* @__PURE__ */c("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===
|
|
20
|
+
/* @__PURE__ */m("button",{onClick:()=>G(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
|
|
21
|
+
/* @__PURE__ */m("button",{onClick:Z,disabled:!S.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
|
|
22
|
+
/* @__PURE__ */c("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===L.length&&/* @__PURE__ */m("span",{className:"text-2xs text-ink-faintest italic px-2",children:"No bookmarks yet — star the address bar to add one."}),L.map((e,t)=>/* @__PURE__ */c("button",{onClick:()=>F(e.url),onContextMenu:async o=>{o.preventDefault();await n({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&B(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:[
|
|
23
23
|
/* @__PURE__ */m("img",{src:`https://icons.duckduckgo.com/ip3/${new URL(e.url).hostname}.ico`,alt:"",className:"h-3.5 w-3.5",onError:e=>{e.target.style.visibility="hidden"}}),e.label]},t)),
|
|
24
24
|
/* @__PURE__ */m("div",{className:"flex-1"}),
|
|
25
25
|
/* @__PURE__ */m("button",{onClick:()=>{k(f);try{localStorage.setItem(h,f)}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"})]}),
|
|
26
|
-
/* @__PURE__ */m("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */m(N,{url:f,iframeKey:
|
|
26
|
+
/* @__PURE__ */m("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */m(N,{url:f,iframeKey:E,iframeRef:J,openExternal:P,showHelp:T,dismissHelp:()=>U(!1)})})]})}function v(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function N({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:n,dismissHelp:a}){const[d,h]=l(!1);i(()=>{h(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return f.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!d?/* @__PURE__ */m("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */c("div",{className:"max-w-md text-center",children:[
|
|
27
27
|
/* @__PURE__ */m(s,{name:"no-symbol",className:"h-14 w-14 mx-auto text-gray-300 mb-3",strokeWidth:1.2}),
|
|
28
28
|
/* @__PURE__ */c("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[v(e)," can't be embedded"]}),
|
|
29
29
|
/* @__PURE__ */c("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-M33225G6.js";import{useWidgetSettings as n}from"./chunk-M7H3OCIL.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-EGEWU776.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-NDEIZUMG.js";import"./chunk-4E4GWE4L.js";import"./chunk-R2QDO7NY.js";import"./chunk-GMRZX2ET.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-DXHLUB36.js";import"./chunk-UGTRSRIW.js";import"./chunk-CDAJKLGL.js";import"./chunk-KC3EX26K.js";import"./chunk-HAFB45DT.js";import"./chunk-5QFPTDQF.js";import"./chunk-URHGHXDN.js";import"./chunk-LNARMEEZ.js";import"./chunk-NHH2MXFU.js";import"./chunk-UQYNPYF4.js";import{Icon as r}from"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import"./chunk-HL6JSDN3.js";import"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import"./chunk-OZAAIE4E.js";import"./chunk-BCDG4N6L.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-X2PZMXDP.js";import"./chunk-C3QOHMR6.js";import{useState as c,useRef as i,useCallback as l,useEffect as o}from"react";import{jsxs as s,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),[b,g]=c(null),[N,j]=c(!1),[y,x]=c(""),[f,C]=c([]),[v,$]=c(!1),[E,D]=c(()=>e(h)),[T,M]=c(!1),[W,R]=c(E),w=i(null);n(l(()=>{R({...E}),M(!0)},[E]));const A=l(e=>{x(""),k(t=>N||"0"===t?(j(!1),"."===e?"0.":e):"."===e&&t.includes(".")?t:t+e)},[N]),G=l(()=>{k("0"),d(null),g(null),j(!1)},[]),H=l((e,t,n)=>{switch(n){case"+":return e+t;case"-":return e-t;case"×":return e*t;case"÷":return 0===t?0:e/t;default:return t}},[]),U=l(e=>{const t=parseFloat(m);if(null!==p&&b&&!N){const e=H(p,t,b);k(String(e)),d(e),C(n=>[`${p} ${b} ${t} = ${e}`,...n].slice(0,20))}else d(t);g(e),j(!0)},[m,p,b,N,H]),F=l(()=>{if(null===p||!b)return;const e=parseFloat(m),t=H(p,e,b),n=`${p} ${b} ${e} =`;C(e=>[`${n} ${t}`,...e].slice(0,20)),x(n),k(String(t)),d(null),g(null),j(!0)},[m,p,b,H]),L=l(()=>{k(e=>String(parseFloat(e)/100))},[]),J=l(()=>{k(e=>e.startsWith("-")?e.slice(1):"0"===e?e:"-"+e)},[]);o(()=>{const e=e=>{const t=e.target.tagName;"INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t&&(e.key>="0"&&e.key<="9"?A(e.key):"."===e.key?A("."):"+"===e.key?U("+"):"-"===e.key?U("-"):"*"===e.key?U("×"):"/"===e.key?(e.preventDefault(),U("÷")):"Enter"===e.key||"="===e.key?("Enter"===e.key&&e.target instanceof Node&&w.current?.contains(e.target)&&e.preventDefault(),F()):"Escape"===e.key?G():"Backspace"===e.key?k(e=>e.length>1?e.slice(0,-1):"0"):"%"===e.key&&L())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[A,U,F,G,L]);const S="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",X=`${S} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,Z=`${S} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,B=`${S} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,I=`${S} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
|
|
2
|
+
return s(a,{children:[
|
|
3
|
+
/* @__PURE__ */s("div",{ref:w,className:"flex flex-col h-full",style:{opacity:E.activeOpacity/100,backdropFilter:E.activeBlur>0?`blur(${E.activeBlur}px)`:void 0},children:[
|
|
4
|
+
/* @__PURE__ */s("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:f.slice(0,3).reverse().map((e,t)=>/* @__PURE__ */u("div",{className:"text-2xs text-slate-400 text-right font-mono truncate",children:e},t))}),(y||b&&null!==p)&&/* @__PURE__ */u("div",{className:"text-base text-slate-600 text-right font-mono",children:y||`${p} ${b} ${N?"":m}`}),
|
|
6
|
+
/* @__PURE__ */s("div",{className:"flex items-center gap-2",children:[
|
|
7
|
+
/* @__PURE__ */u("button",{onClick:()=>{navigator.clipboard.writeText(m),$(!0),setTimeout(()=>$(!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:(e=>{const t=parseFloat(e);return isNaN(t)||e.endsWith(".")||e.endsWith(".0")||Math.abs(t)<1e15&&e.length<16?e:t.toExponential(6)})(m)})]})]}),
|
|
9
|
+
/* @__PURE__ */s("div",{className:"grid grid-cols-4 grid-rows-5 gap-2 flex-1 min-h-0 p-2",children:[
|
|
10
|
+
/* @__PURE__ */u("button",{onClick:G,className:B,children:"AC"}),
|
|
11
|
+
/* @__PURE__ */u("button",{onClick:J,className:B,children:"+/−"}),
|
|
12
|
+
/* @__PURE__ */u("button",{onClick:L,className:B,children:"%"}),
|
|
13
|
+
/* @__PURE__ */u("button",{onClick:()=>U("÷"),className:`${Z} ${"÷"===b?"ring-2 ring-blue-400":""}`,children:"÷"}),
|
|
14
|
+
/* @__PURE__ */u("button",{onClick:()=>A("7"),className:X,children:"7"}),
|
|
15
|
+
/* @__PURE__ */u("button",{onClick:()=>A("8"),className:X,children:"8"}),
|
|
16
|
+
/* @__PURE__ */u("button",{onClick:()=>A("9"),className:X,children:"9"}),
|
|
17
|
+
/* @__PURE__ */u("button",{onClick:()=>U("×"),className:`${Z} ${"×"===b?"ring-2 ring-blue-400":""}`,children:"×"}),
|
|
18
|
+
/* @__PURE__ */u("button",{onClick:()=>A("4"),className:X,children:"4"}),
|
|
19
|
+
/* @__PURE__ */u("button",{onClick:()=>A("5"),className:X,children:"5"}),
|
|
20
|
+
/* @__PURE__ */u("button",{onClick:()=>A("6"),className:X,children:"6"}),
|
|
21
|
+
/* @__PURE__ */u("button",{onClick:()=>U("-"),className:`${Z} ${"-"===b?"ring-2 ring-blue-400":""}`,children:"−"}),
|
|
22
|
+
/* @__PURE__ */u("button",{onClick:()=>A("1"),className:X,children:"1"}),
|
|
23
|
+
/* @__PURE__ */u("button",{onClick:()=>A("2"),className:X,children:"2"}),
|
|
24
|
+
/* @__PURE__ */u("button",{onClick:()=>A("3"),className:X,children:"3"}),
|
|
25
|
+
/* @__PURE__ */u("button",{onClick:()=>U("+"),className:`${Z} ${"+"===b?"ring-2 ring-blue-400":""}`,children:"+"}),
|
|
26
|
+
/* @__PURE__ */u("button",{onClick:()=>A("0"),className:`${X} col-span-2`,children:"0"}),
|
|
27
|
+
/* @__PURE__ */u("button",{onClick:()=>A("."),className:X,children:"."}),
|
|
28
|
+
/* @__PURE__ */u("button",{onClick:F,className:I,children:"="})]})]}),
|
|
29
|
+
/* @__PURE__ */u(t,{open:T,onClose:()=>M(!1),title:"Calculator Settings",appearance:W,onAppearanceChange:R,onSave:()=>{D(W),localStorage.setItem(h,JSON.stringify(W)),M(!1)}})]})}export{m as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-
|
|
1
|
+
import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-M33225G6.js";import{useWidgetSettings as r}from"./chunk-M7H3OCIL.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-EGEWU776.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-NDEIZUMG.js";import"./chunk-4E4GWE4L.js";import"./chunk-R2QDO7NY.js";import"./chunk-GMRZX2ET.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-DXHLUB36.js";import"./chunk-UGTRSRIW.js";import"./chunk-CDAJKLGL.js";import"./chunk-KC3EX26K.js";import"./chunk-HAFB45DT.js";import"./chunk-5QFPTDQF.js";import"./chunk-URHGHXDN.js";import"./chunk-LNARMEEZ.js";import"./chunk-NHH2MXFU.js";import"./chunk-UQYNPYF4.js";import"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import"./chunk-HL6JSDN3.js";import{LoadingSpinner as n}from"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import"./chunk-OZAAIE4E.js";import"./chunk-BCDG4N6L.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-X2PZMXDP.js";import"./chunk-C3QOHMR6.js";import{useState as s,useCallback as o,useEffect as a}from"react";import{jsxs as c,Fragment as i,jsx as l}from"react/jsx-runtime";var m=["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 g(t){try{const e=JSON.parse(localStorage.getItem(d)||"{}")[t];if(e&&Date.now()-e.timestamp<36e5)return e.rates}catch{}return null}function k(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 N(){try{const t=JSON.parse(localStorage.getItem(p)||"");if(Array.isArray(t)&&t.length)return t.slice(0,4)}catch{}return u}var f={USD:"🇺🇸",CNY:"🇨🇳",AUD:"🇦🇺",GBP:"🇬🇧",JPY:"🇯🇵",CAD:"🇨🇦",EUR:"🇪🇺",THB:"🇹🇭",NZD:"🇳🇿",SGD:"🇸🇬",HKD:"🇭🇰",CHF:"🇨🇭",KRW:"🇰🇷",INR:"🇮🇳",MXN:"🇲🇽",BRL:"🇧🇷"};function j(){const[u,d]=s(N),[j,x]=s(()=>t(h)),[y,b]=s({}),[D,S]=s(!1),[v,C]=s(!1),[U,R]=s([]),[J,H]=s(j),[M,A]=s("USD"),[G,B]=s("CNY");r(o(()=>{R([...u]),H({...j}),C(!0)},[u,j])),a(()=>{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=g(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,k(e,n.rates))}catch{}}e&&(b(r),S(!1))}(),()=>{e=!1}},[u]);/* @__PURE__ */
|
|
2
2
|
return c(i,{children:[
|
|
3
3
|
/* @__PURE__ */l("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${j.activeOpacity/100})`,backdropFilter:j.activeBlur>0?`blur(${j.activeBlur}px)`:void 0},children:/* @__PURE__ */c("div",{className:"px-4 py-3 space-y-1",children:[D&&/* @__PURE__ */l(n,{size:"sm",padding:"py-4",label:"Loading rates"}),u.map(([t,e],r)=>{const n=y[t]?.[e];/* @__PURE__ */
|
|
4
4
|
return c("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:[
|
|
@@ -9,13 +9,13 @@ return c("button",{onClick:()=>{const t=u.map((t,e)=>e===r?[t[1],t[0]]:t);d(t),l
|
|
|
9
9
|
/* @__PURE__ */l("span",{className:"text-base",children:f[e]||""}),
|
|
10
10
|
/* @__PURE__ */l("span",{className:"text-sm font-semibold text-gray-700",children:e})]}),
|
|
11
11
|
/* @__PURE__ */l("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__ */l(e,{open:v,onClose:()=>C(!1),title:"Currency Settings",appearance:J,onAppearanceChange:H,onSave:()=>{if(0===
|
|
12
|
+
/* @__PURE__ */l(e,{open:v,onClose:()=>C(!1),title:"Currency Settings",appearance:J,onAppearanceChange:H,onSave:()=>{if(0===U.length)return;const t=U.slice(0,4);d(t),x(J),localStorage.setItem(p,JSON.stringify(t)),localStorage.setItem(h,JSON.stringify(J)),C(!1)},children:/* @__PURE__ */c("div",{children:[
|
|
13
13
|
/* @__PURE__ */c("h3",{className:"text-sm font-semibold text-ink mb-2",children:["Currency Pairs ",
|
|
14
|
-
/* @__PURE__ */c("span",{className:"text-2xs font-normal text-ink-faintest",children:["(",
|
|
15
|
-
/* @__PURE__ */l("div",{className:"space-y-1 mb-2",children:
|
|
14
|
+
/* @__PURE__ */c("span",{className:"text-2xs font-normal text-ink-faintest",children:["(",U.length,"/",4,")"]})]}),
|
|
15
|
+
/* @__PURE__ */l("div",{className:"space-y-1 mb-2",children:U.map(([t,e],r)=>/* @__PURE__ */c("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
|
|
16
16
|
/* @__PURE__ */c("span",{className:"text-sm",children:[f[t]||""," ",t," → ",f[e]||""," ",e]}),
|
|
17
|
-
/* @__PURE__ */l("button",{onClick:()=>
|
|
18
|
-
/* @__PURE__ */l("select",{value:
|
|
17
|
+
/* @__PURE__ */l("button",{onClick:()=>R(t=>t.filter((t,e)=>e!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),U.length<4?/* @__PURE__ */c("div",{className:"flex items-center gap-2",children:[
|
|
18
|
+
/* @__PURE__ */l("select",{value:M,onChange:t=>A(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:m.map(t=>/* @__PURE__ */l("option",{children:t},t))}),
|
|
19
19
|
/* @__PURE__ */l("span",{className:"text-gray-400",children:"→"}),
|
|
20
|
-
/* @__PURE__ */l("select",{value:
|
|
21
|
-
/* @__PURE__ */l("button",{onClick:()=>{
|
|
20
|
+
/* @__PURE__ */l("select",{value:G,onChange:t=>B(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:m.map(t=>/* @__PURE__ */l("option",{children:t},t))}),
|
|
21
|
+
/* @__PURE__ */l("button",{onClick:()=>{M!==G&&U.length<4&&R(t=>[...t,[M,G]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */c("p",{className:"text-2xs text-ink-faintest italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{j as default};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import{escapeHtml as e}from"./chunk-G6DKCCWH.js";import{AboutApp as t}from"./chunk-
|
|
1
|
+
import{escapeHtml as e}from"./chunk-G6DKCCWH.js";import{AboutApp as t}from"./chunk-PKHZTFBK.js";import{WindowTitle as n}from"./chunk-M7H3OCIL.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-EGEWU776.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-NDEIZUMG.js";import"./chunk-4E4GWE4L.js";import"./chunk-R2QDO7NY.js";import"./chunk-GMRZX2ET.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import{toast_default as r}from"./chunk-OQW42DOR.js";import"./chunk-DXHLUB36.js";import"./chunk-UGTRSRIW.js";import"./chunk-CDAJKLGL.js";import"./chunk-KC3EX26K.js";import"./chunk-BGNJQMAZ.js";import{PopupMenu as o,PopupMenuLabel as i,PopupMenuItem as l,PopupMenuDivider as a}from"./chunk-HAFB45DT.js";import"./chunk-5QFPTDQF.js";import"./chunk-URHGHXDN.js";import"./chunk-LNARMEEZ.js";import"./chunk-NHH2MXFU.js";import"./chunk-UQYNPYF4.js";import{Icon as s}from"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import"./chunk-HL6JSDN3.js";import{LoadingSpinner as c}from"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import"./chunk-OZAAIE4E.js";import"./chunk-BCDG4N6L.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-X2PZMXDP.js";import"./chunk-C3QOHMR6.js";import{useState as m,useRef as d}from"react";import{jsxs as h,jsx as u}from"react/jsx-runtime";var p=/* @__PURE__ */new Set(["txt","md","markdown","csv","tsv","log","json","xml","html","htm","css","js","jsx","ts","tsx","py","rb","go","rs","java","c","h","cpp","hpp","sh","bash","yml","yaml","toml","ini","conf","env","sql"]),g=/* @__PURE__ */new Set(["docx"]),x={filename:"Untitled",kind:"docx",content:"",ext:"docx"};function f(){const[f,y]=m(x),[k,v]=m(!1),[b,j]=m(!1),[w,N]=m(!1),[D,C]=m(null),M=d(null),L=d(null),U=d(null),R=(e,t)=>{U.current?.focus(),document.execCommand(e,!1,t),N(!0)},W=e=>{for(const t of e){if(!t.type.startsWith("image/"))continue;const e=new FileReader;e.onload=()=>{U.current?.focus(),document.execCommand("insertImage",!1,String(e.result)),N(!0)},e.readAsDataURL(t)}},T=e=>{D&&(D.el.removeAttribute("width"),D.el.removeAttribute("height"),D.el.style.width=e??"",D.el.style.height=e?"auto":"",N(!0),C(null))},A=async t=>{const n=(t.name.split(".").pop()||"").toLowerCase();v(!0);try{if(p.has(n)||!g.has(n)&&t.type.startsWith("text/")){const r=await t.text(),o=e(r).replace(/\n/g,"<br>");y({filename:t.name,kind:"text",content:o,ext:n}),N(!1)}else if(g.has(n))try{const e=await(import(
|
|
2
2
|
/* @vite-ignore */
|
|
3
|
-
"mammoth")),r=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:r});y({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:n}),N(!1)}catch(e){r.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===n?r.error(".doc is the legacy Word binary format — convert to .docx first."):r.error(`Unsupported file type: .${n||"unknown"}`)}finally{v(!1)}},B=f?.filename?(
|
|
4
|
-
return h("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),b||j(!0)},onDragLeave:e=>{e.currentTarget===e.target&&j(!1)},onDrop:e=>{e.preventDefault(),j(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?
|
|
3
|
+
"mammoth")),r=await t.arrayBuffer(),o=await e.convertToHtml({arrayBuffer:r});y({filename:t.name,kind:"docx",content:o.value||"<p><em>(empty document)</em></p>",ext:n}),N(!1)}catch(e){r.error('Install the optional "mammoth" peer dep to read .docx files.')}else"doc"===n?r.error(".doc is the legacy Word binary format — convert to .docx first."):r.error(`Unsupported file type: .${n||"unknown"}`)}finally{v(!1)}},B=f?.filename?(E=f.filename).length>24?`${E.slice(0,23)}…`:E:"Untitled";var E;/* @__PURE__ */
|
|
4
|
+
return h("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preventDefault(),b||j(!0)},onDragLeave:e=>{e.currentTarget===e.target&&j(!1)},onDrop:e=>{e.preventDefault(),j(!1);const t=Array.from(e.dataTransfer.files??[]);0!==t.length&&(t.every(e=>e.type.startsWith("image/"))?W(t):A(t[0]))},children:[
|
|
5
5
|
/* @__PURE__ */u(n,{title:`${B}${w?" •":""} - Documents`}),
|
|
6
6
|
/* @__PURE__ */u(t,{app:"documents"}),
|
|
7
7
|
/* @__PURE__ */h("div",{className:"flex items-center flex-wrap gap-x-2 gap-y-1 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
|
|
8
|
-
/* @__PURE__ */u("input",{ref:
|
|
9
|
-
/* @__PURE__ */h("button",{onClick:()=>
|
|
8
|
+
/* @__PURE__ */u("input",{ref:M,type:"file",accept:".txt,.md,.csv,.tsv,.log,.json,.xml,.html,.htm,.css,.js,.jsx,.ts,.tsx,.py,.rb,.go,.rs,.java,.c,.h,.cpp,.hpp,.sh,.bash,.yml,.yaml,.toml,.ini,.conf,.env,.sql,.docx,text/*",onChange:e=>{const t=e.target.files?.[0];t&&A(t),M.current&&(M.current.value="")},className:"hidden"}),
|
|
9
|
+
/* @__PURE__ */h("button",{onClick:()=>M.current?.click(),className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors flex items-center gap-1",children:[
|
|
10
10
|
/* @__PURE__ */u(s,{name:"folder-open",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Open"]}),
|
|
11
|
-
/* @__PURE__ */u("button",{onClick:()=>{if(!f)return;const t=
|
|
11
|
+
/* @__PURE__ */u("button",{onClick:()=>{if(!f)return;const t=U.current?.innerHTML??"";if("text"===f.kind){if(/<(b|strong|i|em|u|font|span style|ul|ol|img)|style="[^"]*text-align/i.test(t)){const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(f.filename)}</title><body style="font-family:ui-monospace,monospace;white-space:pre-wrap">${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${f.filename.replace(/\.[^.]+$/,"")}.html`,o.click(),URL.revokeObjectURL(r)}else{const e=U.current?.innerText??"",t=new Blob([e],{type:"text/plain"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=f.filename,r.click(),URL.revokeObjectURL(n)}}else{const n=new Blob([`<!doctype html><meta charset="utf-8"><title>${e(f.filename)}</title>${t}`],{type:"text/html"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${f.filename.replace(/\.docx$/i,"")}.html`,o.click(),URL.revokeObjectURL(r)}},className:"text-xs text-gray-700 hover:text-gray-900 px-2 py-1 rounded hover:bg-gray-200 transition-colors",children:"Save"}),
|
|
12
12
|
/* @__PURE__ */u("span",{className:"text-2xs text-ink-faintest ml-1",children:"TXT · DOCX · Code"}),
|
|
13
13
|
/* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
14
14
|
/* @__PURE__ */h("span",{className:"text-xs font-medium text-gray-700 truncate max-w-[200px]",title:f.filename,children:[f.filename,w?" •":""]}),
|
|
15
15
|
/* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
16
16
|
/* @__PURE__ */h("div",{className:"flex items-center gap-0.5",children:[
|
|
17
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
18
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
19
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
20
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
17
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("bold"),className:"px-2 py-1 text-xs rounded font-bold text-gray-700 hover:bg-gray-200 transition-colors",title:"Bold",children:"B"}),
|
|
18
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("italic"),className:"px-2 py-1 text-xs rounded italic text-gray-700 hover:bg-gray-200 transition-colors",title:"Italic",children:"I"}),
|
|
19
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("underline"),className:"px-2 py-1 text-xs rounded underline text-gray-700 hover:bg-gray-200 transition-colors",title:"Underline",children:"U"}),
|
|
20
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("strikeThrough"),className:"px-2 py-1 text-xs rounded line-through text-gray-700 hover:bg-gray-200 transition-colors",title:"Strikethrough",children:"S"})]}),
|
|
21
21
|
/* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
22
|
-
/* @__PURE__ */h("select",{onMouseDown:e=>e.preventDefault(),onChange:e=>{
|
|
22
|
+
/* @__PURE__ */h("select",{onMouseDown:e=>e.preventDefault(),onChange:e=>{R("fontSize",e.target.value),e.currentTarget.value=""},defaultValue:"",className:"text-xs border border-gray-300 rounded px-1 py-0.5 bg-white",children:[
|
|
23
23
|
/* @__PURE__ */u("option",{value:"",disabled:!0,children:"Size"}),
|
|
24
24
|
/* @__PURE__ */u("option",{value:"1",children:"XS"}),
|
|
25
25
|
/* @__PURE__ */u("option",{value:"2",children:"S"}),
|
|
@@ -27,26 +27,26 @@ return h("div",{className:"relative flex flex-col h-full",onDragOver:e=>{e.preve
|
|
|
27
27
|
/* @__PURE__ */u("option",{value:"4",children:"L"}),
|
|
28
28
|
/* @__PURE__ */u("option",{value:"5",children:"XL"}),
|
|
29
29
|
/* @__PURE__ */u("option",{value:"6",children:"2XL"})]}),
|
|
30
|
-
/* @__PURE__ */u("input",{type:"color",defaultValue:"#000000",onChange:e=>
|
|
30
|
+
/* @__PURE__ */u("input",{type:"color",defaultValue:"#000000",onChange:e=>R("foreColor",e.target.value),className:"w-7 h-6 border border-gray-300 rounded cursor-pointer",title:"Text color"}),
|
|
31
31
|
/* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
32
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
33
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
32
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("insertUnorderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Bulleted list",children:"• List"}),
|
|
33
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("insertOrderedList"),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Numbered list",children:"1."}),
|
|
34
34
|
/* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
35
35
|
/* @__PURE__ */h("div",{className:"flex items-center gap-0.5",children:[
|
|
36
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
37
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
38
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
39
|
-
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>
|
|
36
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyLeft"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align left",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h9.75M3.75 18h14.25"})})}),
|
|
37
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyCenter"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align center",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M7.125 12h9.75M4.875 18h14.25"})})}),
|
|
38
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyRight"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Align right",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M10.5 12h9.75M6 18h14.25"})})}),
|
|
39
|
+
/* @__PURE__ */u("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>R("justifyFull"),className:"px-2 py-1 rounded text-gray-700 hover:bg-gray-200 transition-colors",title:"Justify",children:/* @__PURE__ */u("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",d:"M3.75 6h16.5M3.75 12h16.5M3.75 18h16.5"})})})]}),
|
|
40
40
|
/* @__PURE__ */u("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
41
|
-
/* @__PURE__ */u("input",{ref:
|
|
42
|
-
/* @__PURE__ */h("button",{onClick:()=>
|
|
41
|
+
/* @__PURE__ */u("input",{ref:L,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&W(Array.from(e.target.files)),L.current&&(L.current.value="")}}),
|
|
42
|
+
/* @__PURE__ */h("button",{onClick:()=>L.current?.click(),className:"px-2 py-1 text-xs rounded text-gray-700 hover:bg-gray-200 transition-colors flex items-center gap-1",title:"Insert image (or paste / drop one)",children:[
|
|
43
43
|
/* @__PURE__ */u(s,{name:"image",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Image"]})]}),
|
|
44
|
-
/* @__PURE__ */u("div",{className:"flex-1 min-h-0 overflow-hidden",children:k?/* @__PURE__ */u(c,{size:"sm",padding:"",className:"h-full",label:"Loading"}):/* @__PURE__ */u("div",{className:"h-full overflow-auto "+("docx"===f.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */u("div",{ref:
|
|
44
|
+
/* @__PURE__ */u("div",{className:"flex-1 min-h-0 overflow-hidden",children:k?/* @__PURE__ */u(c,{size:"sm",padding:"",className:"h-full",label:"Loading"}):/* @__PURE__ */u("div",{className:"h-full overflow-auto "+("docx"===f.kind?"bg-gray-100 px-6 py-8":"bg-white"),children:/* @__PURE__ */u("div",{ref:U,contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,onInput:()=>N(!0),onPaste:e=>{const t=Array.from(e.clipboardData?.items??[]).filter(e=>"file"===e.kind&&e.type.startsWith("image/")).map(e=>e.getAsFile()).filter(e=>!!e);t.length&&(e.preventDefault(),W(t))},onClick:e=>{const t=e.target;"IMG"===t.tagName&&(e.preventDefault(),C({x:e.clientX,y:e.clientY,el:t}))},dangerouslySetInnerHTML:{__html:f.content},className:"docx"===f.kind?"docs-editor mx-auto w-[8.5in] min-h-[11in] bg-surface p-[1in] shadow text-sm leading-relaxed text-ink-strong outline-none focus:ring-2 focus:ring-blue-400/40":"docs-editor block w-full min-h-full p-4 font-mono text-sm leading-relaxed text-ink-strong bg-surface outline-none whitespace-pre-wrap"})})}),b&&/* @__PURE__ */u("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */u("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop a document to open · images insert into the page"})}),D&&/* @__PURE__ */h(o,{minWidth:150,style:{left:D.x,top:D.y},onClose:()=>C(null),children:[
|
|
45
45
|
/* @__PURE__ */u(i,{children:"Image width"}),
|
|
46
|
-
/* @__PURE__ */u(l,{onClick:()=>
|
|
47
|
-
/* @__PURE__ */u(l,{onClick:()=>
|
|
48
|
-
/* @__PURE__ */u(l,{onClick:()=>
|
|
49
|
-
/* @__PURE__ */u(l,{onClick:()=>
|
|
50
|
-
/* @__PURE__ */u(l,{onClick:()=>
|
|
46
|
+
/* @__PURE__ */u(l,{onClick:()=>T("25%"),children:"25%"}),
|
|
47
|
+
/* @__PURE__ */u(l,{onClick:()=>T("50%"),children:"50%"}),
|
|
48
|
+
/* @__PURE__ */u(l,{onClick:()=>T("75%"),children:"75%"}),
|
|
49
|
+
/* @__PURE__ */u(l,{onClick:()=>T("100%"),children:"100%"}),
|
|
50
|
+
/* @__PURE__ */u(l,{onClick:()=>T(null),children:"Original size"}),
|
|
51
51
|
/* @__PURE__ */u(a,{}),
|
|
52
52
|
/* @__PURE__ */u(l,{danger:!0,onClick:()=>{D?.el.remove(),N(!0),C(null)},children:"Remove image"})]})]})}export{f as default};
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import{openPreviewFile as e}from"./chunk-
|
|
1
|
+
import{openPreviewFile as e}from"./chunk-KCV7BFKJ.js";import{SidebarLayout as t}from"./chunk-PUIQFTCO.js";import"./chunk-QWK6DRSN.js";import"./chunk-RBIGSJ2J.js";import{Breadcrumbs as a}from"./chunk-GKZUAT3K.js";import{formatBytes as n}from"./chunk-X2S2XDZI.js";import"./chunk-5OTS2G3M.js";import"./chunk-36BRD5J3.js";import{getFilesDemoTree as r}from"./chunk-TGLHJS3M.js";import{AboutApp as i}from"./chunk-PKHZTFBK.js";import{peekFilesViewRequest as s,consumeFilesViewRequest as o,FILES_SHOW_TRASH_EVENT as l,FILES_OPEN_DESKTOP_FOLDER_EVENT as c,subscribeDesktopFolders as d,getDesktopFoldersSnapshot as m,FolderGlyph as h,DesktopItemMiniIcon as p,desktopItemTypeLabel as u}from"./chunk-GSBIJLTD.js";import"./chunk-ESL5TDNA.js";import"./chunk-VTVSMRFX.js";import{useWindowManager as f,WindowTitle as x}from"./chunk-M7H3OCIL.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-EGEWU776.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-NDEIZUMG.js";import{confirm as g,prompt as k}from"./chunk-4E4GWE4L.js";import"./chunk-R2QDO7NY.js";import{ItemCount as b}from"./chunk-GMRZX2ET.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import{toast_default as y}from"./chunk-OQW42DOR.js";import"./chunk-DXHLUB36.js";import"./chunk-UGTRSRIW.js";import"./chunk-CDAJKLGL.js";import"./chunk-KC3EX26K.js";import"./chunk-BGNJQMAZ.js";import"./chunk-HAFB45DT.js";import"./chunk-5QFPTDQF.js";import"./chunk-URHGHXDN.js";import"./chunk-LNARMEEZ.js";import"./chunk-NHH2MXFU.js";import"./chunk-UQYNPYF4.js";import{Icon as N}from"./chunk-FSPFV4MI.js";import"./chunk-J75ZT2JQ.js";import"./chunk-HL6JSDN3.js";import{LoadingSpinner as w}from"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import{TH_ONE_LINE as v}from"./chunk-OZAAIE4E.js";import"./chunk-BCDG4N6L.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-X2PZMXDP.js";import"./chunk-C3QOHMR6.js";import{useState as j,useEffect as $,useSyncExternalStore as D,useRef as C,useCallback as T}from"react";import{jsxs as L,jsx as E,Fragment as R}from"react/jsx-runtime";var M="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",S={pdf:"pdf",dxf:"dxf",csv:"csv",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",stp:"3d",step:"3d",stl:"3d",obj:"3d",gltf:"3d",glb:"3d","3mf":"3d",iges:"3d",igs:"3d",ply:"3d",fbx:"3d"};function W(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function F(e){if(!e)return"—";try{const t=new Date(e);return isNaN(t.getTime())?"—":t.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}catch{return e}}function P(){const P=M.replace(/\/$/,""),U=null!==r(),[I,A]=j("/"),[O,J]=j([]),[H,B]=j([]),[G,K]=j(null),[V,Z]=j(!0),[Q,X]=j(!1),[z,_]=j(null),[Y,q]=j(!1),[ee,te]=j(()=>{const e=s();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});$(()=>{o()},[]);const[ae,ne]=j([]);$(()=>{const e=()=>{o(),te("trash")},t=e=>{o();const t=e.detail?.folderId;t&&te({desktopFolderId:t})};return window.addEventListener(l,e),window.addEventListener(c,t),()=>{window.removeEventListener(l,e),window.removeEventListener(c,t)}},[]);const re=D(d,m,m),ie="object"==typeof ee?ee.desktopFolderId:null,se=ie?re?.folders.find(e=>e.id===ie)??null:null,oe=ie&&re?.itemsByFolder[ie]||[];$(()=>{ie&&re&&!re.folders.some(e=>e.id===ie)&&te("files")},[ie,re]);const le=C(0),ce=C(null),{openPage:de,openEntity:me}=f(),he=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>de(e)}):"page"===t.entityType?de(t.entityId):me(t.entityType,t.entityId,null,t.label)},pe=T((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),ue=T(async()=>{try{const e=await pe(`${P}/api/quota`);if(e.ok){const t=await e.json();_({used:t.used,limit:t.limit})}}catch{}},[pe,P]),fe=T(async e=>{if(K(null),U){const t=function(e){const t=r();if(!t)return[];let a=t;for(const t of e.split("/").filter(Boolean)){const e=a.find(e=>"folder"===e.kind&&e.name===t);if(!e||!e.children)return[];a=e.children}return a.map(e=>({name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}(e);return J(t),A(e),X(!1),Z(!1),void("/"===e&&B(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}Z(!0);try{const t=await pe(`${P}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void y.error(e.error||`Failed to list (${t.status})`)}const a=await t.json(),n=a.entries||[];J(n),A(a.path||e),X(!1),"/"===(a.path||e)&&B(n.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){X(!0)}finally{Z(!1)}ue()},[pe,P,ue,U]),xe=T(async()=>{if(U)return ne([]),void Z(!1);Z(!0),K(null);try{const e=await pe(`${P}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void y.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();ne(t.entries||[]),X(!1)}catch{X(!0)}finally{Z(!1)}ue()},[pe,P,ue,U]);$(()=>{"files"===ee?fe(I):"trash"===ee&&xe()},[I,ee]);const ge=async e=>{const t=W(I,e.name);try{const a=await pe(`${P}/api/file?path=${encodeURIComponent(t)}`);if(!a.ok)return void y.error(`Download failed (${a.status})`);const n=await a.blob(),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=e.name,i.click(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch(e){y.error(e?.message||"Download failed")}},ke=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const a=await pe(`${P}/api/upload?path=${encodeURIComponent(I)}`,{method:"POST",body:t});if(!a.ok){const t=await a.json().catch(()=>({}));if(413===a.status){const a=Math.max(0,(t.limit||0)-(t.used||0));y.error(`Quota exceeded — ${n(a)} free, ${e.name} is ${n(t.attempted||e.size)}`)}else y.error(`Upload ${e.name}: ${t.error||a.status}`)}}catch(t){y.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}fe(I)},be=()=>{le.current=0,q(!1)};if($(()=>{const e=()=>be();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),Q)/* @__PURE__ */
|
|
2
2
|
return L("div",{className:"flex flex-col h-full bg-white",children:[
|
|
3
3
|
/* @__PURE__ */E(x,{title:"Files - offline"}),
|
|
4
4
|
/* @__PURE__ */E("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */L("div",{className:"max-w-md",children:[
|
|
5
5
|
/* @__PURE__ */E(N,{name:"close-circle",className:"h-12 w-12 mx-auto text-gray-300 mb-3",strokeWidth:1.4}),
|
|
6
6
|
/* @__PURE__ */E("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:"Can't reach the file server"}),
|
|
7
7
|
/* @__PURE__ */L("p",{className:"text-sm text-gray-500 mb-3",children:["No response from ",
|
|
8
|
-
/* @__PURE__ */E("span",{className:"font-mono",children:
|
|
8
|
+
/* @__PURE__ */E("span",{className:"font-mono",children:P}),". Make sure the server is running — see ",
|
|
9
9
|
/* @__PURE__ */E("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]}),
|
|
10
|
-
/* @__PURE__ */E("button",{onClick:()=>fe(
|
|
10
|
+
/* @__PURE__ */E("button",{onClick:()=>fe(I),className:"px-3 h-8 text-sm bg-blue-500 text-on-accent rounded hover:bg-blue-600",children:"Retry"})]})})]});const ye="/"===I?[]:I.split("/").filter(Boolean),Ne=z&&z.limit>0?Math.min(100,Math.round(z.used/z.limit*100)):0,we=Ne>90?"bg-red-500":Ne>75?"bg-amber-500":"bg-blue-500",ve=[{label:"My files",onClick:()=>A("/")},...ye.map((e,t)=>({label:e,onClick:()=>A("/"+ye.slice(0,t+1).join("/"))}))],je=e=>"flex w-full items-center gap-2 rounded-md px-3 min-h-(--row-height-menu) py-2 text-left text-sm transition-colors "+(e?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),$e=e=>/* @__PURE__ */E("svg",{className:"h-4 w-4 shrink-0 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.6,children:/* @__PURE__ */E("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),De=/* @__PURE__ */L("nav",{className:"p-2",children:[
|
|
11
11
|
/* @__PURE__ */E("div",{className:"px-2 py-2 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Locations"}),
|
|
12
|
-
/* @__PURE__ */L("button",{onClick:()=>{te("files"),
|
|
12
|
+
/* @__PURE__ */L("button",{onClick:()=>{te("files"),A("/")},className:je("files"===ee&&"/"===I),children:[$e("M2.25 12l8.954-8.955a1.5 1.5 0 012.122 0L21.75 12M4.5 9.75v9.75a.75.75 0 00.75.75H9V15a.75.75 0 01.75-.75h4.5A.75.75 0 0115 15v5.25h3.75a.75.75 0 00.75-.75V9.75"),"My files"]}),H.map(e=>/* @__PURE__ */L("button",{onClick:()=>{te("files"),A("/"+e)},className:je("files"===ee&&I==="/"+e),children:[$e("M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"),
|
|
13
13
|
/* @__PURE__ */E("span",{className:"truncate",children:e})]},e)),!U&&/* @__PURE__ */L("button",{onClick:()=>te("trash"),className:je("trash"===ee),children:[$e("M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79"),"Trash"]}),re&&re.folders.length>0&&/* @__PURE__ */L(R,{children:[
|
|
14
14
|
/* @__PURE__ */E("div",{className:"px-2 pt-3 pb-2 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Desktop"}),re.folders.map(e=>/* @__PURE__ */L("button",{onClick:()=>te({desktopFolderId:e.id}),className:je(ie===e.id),children:[
|
|
15
15
|
/* @__PURE__ */E(h,{className:"h-4 w-4 shrink-0 text-amber-500"}),
|
|
16
16
|
/* @__PURE__ */E("span",{className:"truncate",children:e.name}),
|
|
17
17
|
/* @__PURE__ */E(b,{count:e.itemCount,active:ie===e.id,className:"ml-auto"})]},e.id))]})]});/* @__PURE__ */
|
|
18
|
-
return L("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{U||"object"==typeof ee||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),le.current++,
|
|
19
|
-
/* @__PURE__ */E(x,{title:se?`Files - ${se.name}`:"Files"+("/"===
|
|
18
|
+
return L("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{U||"object"==typeof ee||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),le.current++,Y||q(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{le.current>0&&le.current--,0===le.current&&q(!1)},onDrop:e=>{e.preventDefault(),be(),U||"object"==typeof ee||e.dataTransfer.files?.length&&ke(e.dataTransfer.files)},children:[
|
|
19
|
+
/* @__PURE__ */E(x,{title:se?`Files - ${se.name}`:"Files"+("/"===I?"":" - "+I)}),
|
|
20
20
|
/* @__PURE__ */E(i,{app:"files"}),
|
|
21
21
|
/* @__PURE__ */E("input",{ref:ce,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&ke(e.target.files),ce.current&&(ce.current.value="")}}),
|
|
22
|
-
/* @__PURE__ */E("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */E(t,{sidebar:
|
|
22
|
+
/* @__PURE__ */E("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */E(t,{sidebar:De,storageKey:"files.sidebarWidth",defaultWidth:200,minWidth:150,maxWidth:320,children:/* @__PURE__ */L("div",{className:"flex h-full min-w-0 flex-col",children:[
|
|
23
23
|
/* @__PURE__ */L("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-line bg-surface-sunken shrink-0 text-xs",children:[/* @__PURE__ */L(R,"files"===ee?{children:[
|
|
24
|
-
/* @__PURE__ */E("button",{onClick:()=>
|
|
24
|
+
/* @__PURE__ */E("button",{onClick:()=>A(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),a=t.lastIndexOf("/");return a<=0?"/":t.slice(0,a)}(I)),disabled:"/"===I,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */E(N,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
25
25
|
/* @__PURE__ */E("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */E(a,{items:ve,maxItems:5})}),
|
|
26
|
-
/* @__PURE__ */E("button",{onClick:()=>fe(
|
|
26
|
+
/* @__PURE__ */E("button",{onClick:()=>fe(I),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */E(N,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),!U&&/* @__PURE__ */L(R,{children:[
|
|
27
27
|
/* @__PURE__ */L("button",{onClick:()=>te("trash"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",title:"Open trash",children:[
|
|
28
28
|
/* @__PURE__ */E(N,{name:"trash",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Trash"]}),
|
|
29
|
-
/* @__PURE__ */L("button",{onClick:async()=>{const e=await k({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void y.error("Folder names cannot contain slashes");const t=W(
|
|
29
|
+
/* @__PURE__ */L("button",{onClick:async()=>{const e=await k({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void y.error("Folder names cannot contain slashes");const t=W(I,e),a=await pe(`${P}/api/folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!a.ok){const e=await a.json().catch(()=>({}));return void y.error(e.error||`Create folder failed (${a.status})`)}fe(I)},className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",children:[
|
|
30
30
|
/* @__PURE__ */E(N,{name:"folder-plus",className:"h-3.5 w-3.5",strokeWidth:1.5}),"New Folder"]}),
|
|
31
31
|
/* @__PURE__ */L("button",{onClick:()=>ce.current?.click(),className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 flex items-center gap-1",children:[
|
|
32
32
|
/* @__PURE__ */E(N,{name:"upload",className:"h-3.5 w-3.5",strokeWidth:1.8}),"Upload"]})]})]}:"trash"===ee?{children:[
|
|
33
33
|
/* @__PURE__ */E("button",{onClick:()=>te("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */E(N,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
34
34
|
/* @__PURE__ */E("span",{className:"flex-1 text-gray-700 font-medium px-2",children:"Trash"}),
|
|
35
35
|
/* @__PURE__ */E("button",{onClick:xe,className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */E(N,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),
|
|
36
|
-
/* @__PURE__ */E("button",{onClick:async()=>{if(0===ae.length)return;if(!await g({title:"Empty trash",message:`${ae.length} item${1===ae.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"}))return;const e=await pe(`${
|
|
36
|
+
/* @__PURE__ */E("button",{onClick:async()=>{if(0===ae.length)return;if(!await g({title:"Empty trash",message:`${ae.length} item${1===ae.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"}))return;const e=await pe(`${P}/api/trash`,{method:"DELETE"});if(!e.ok){const t=await e.json().catch(()=>({}));return void y.error(t.error||`Empty trash failed (${e.status})`)}xe()},disabled:0===ae.length,className:"px-2 py-1 rounded text-red-600 hover:bg-red-50 disabled:opacity-30 flex items-center gap-1",children:"Empty trash"})]}:{children:[
|
|
37
37
|
/* @__PURE__ */E("button",{onClick:()=>te("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */E(N,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
38
38
|
/* @__PURE__ */E(h,{className:"h-4 w-4 text-amber-500 ml-1"}),
|
|
39
39
|
/* @__PURE__ */E("span",{className:"flex-1 text-gray-700 font-medium px-1 truncate",children:se?.name??"Desktop folder"}),
|
|
@@ -48,7 +48,7 @@ return L("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e
|
|
|
48
48
|
/* @__PURE__ */E("th",{className:`${v} text-left font-medium px-3 h-8 w-28`,children:"Type"}),
|
|
49
49
|
/* @__PURE__ */E("th",{className:`${v} w-56`})]})}),
|
|
50
50
|
/* @__PURE__ */E("tbody",{children:oe.map(e=>{const t=`${e.entityType}|${e.entityId}`;/* @__PURE__ */
|
|
51
|
-
return L("tr",{onClick:()=>
|
|
51
|
+
return L("tr",{onClick:()=>K(t),onDoubleClick:()=>he(e),className:"cursor-default border-b border-gray-100 "+(G===t?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
52
52
|
/* @__PURE__ */L("td",{className:"px-3 h-8 flex items-center gap-2",children:[
|
|
53
53
|
/* @__PURE__ */E(p,{item:e}),
|
|
54
54
|
/* @__PURE__ */E("span",{className:"truncate",title:e.label,children:e.label})]}),
|
|
@@ -56,7 +56,7 @@ return L("tr",{onClick:()=>G(t),onDoubleClick:()=>he(e),className:"cursor-defaul
|
|
|
56
56
|
/* @__PURE__ */L("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
|
|
57
57
|
/* @__PURE__ */E("button",{onClick:t=>{t.stopPropagation(),he(e)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-2xs",children:"Open"}),
|
|
58
58
|
/* @__PURE__ */E("button",{onClick:t=>{t.stopPropagation(),re?.moveToDesktop([e])},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-ink-faint text-2xs ml-1",children:"Move to desktop"}),
|
|
59
|
-
/* @__PURE__ */E("button",{onClick:t=>{t.stopPropagation(),re?.removeShortcuts([e])},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Remove"})]})]},t)})})]}):"trash"===ee?
|
|
59
|
+
/* @__PURE__ */E("button",{onClick:t=>{t.stopPropagation(),re?.removeShortcuts([e])},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Remove"})]})]},t)})})]}):"trash"===ee?V&&0===ae.length?/* @__PURE__ */E(w,{size:"sm",padding:"p-6",label:"Loading"}):0===ae.length?/* @__PURE__ */E("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */L("table",{className:"w-full text-sm",children:[
|
|
60
60
|
/* @__PURE__ */E("thead",{className:"bg-surface-sunken text-2xs uppercase tracking-wide text-ink-faint",children:/* @__PURE__ */L("tr",{children:[
|
|
61
61
|
/* @__PURE__ */E("th",{className:`${v} text-left font-medium px-3 h-8`,children:"Name"}),
|
|
62
62
|
/* @__PURE__ */E("th",{className:`${v} text-left font-medium px-3 h-8`,children:"Original location"}),
|
|
@@ -70,19 +70,19 @@ return L("tr",{onClick:()=>G(t),onDoubleClick:()=>he(e),className:"cursor-defaul
|
|
|
70
70
|
/* @__PURE__ */E("td",{className:"px-3 h-8 text-right tabular-nums text-ink-faint",children:n(e.size)}),
|
|
71
71
|
/* @__PURE__ */E("td",{className:"px-3 h-8 text-right text-ink-faint tabular-nums",children:e.deletedAt?F(e.deletedAt):"—"}),
|
|
72
72
|
/* @__PURE__ */L("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
|
|
73
|
-
/* @__PURE__ */E("button",{onClick:()=>(async e=>{const t=await pe(`${
|
|
74
|
-
/* @__PURE__ */E("button",{onClick:()=>(async e=>{if(!await g({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"}))return;const t=await pe(`${
|
|
73
|
+
/* @__PURE__ */E("button",{onClick:()=>(async e=>{const t=await pe(`${P}/api/trash/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e.id})});if(!t.ok){const e=await t.json().catch(()=>({}));return void y.error(e.error||`Restore failed (${t.status})`)}y.success(`Restored "${e.name}"`),xe()})(e),className:"px-2 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-2xs",children:"Restore"}),
|
|
74
|
+
/* @__PURE__ */E("button",{onClick:()=>(async e=>{if(!await g({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"}))return;const t=await pe(`${P}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void y.error(e.error||`Delete failed (${t.status})`)}xe()})(e),className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete forever"})]})]},e.id))})]}):V&&0===O.length?/* @__PURE__ */E(w,{size:"sm",padding:"p-6",label:"Loading"}):0===O.length?/* @__PURE__ */L("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!U&&/* @__PURE__ */L(R,{children:[" Drop files here or click ",
|
|
75
75
|
/* @__PURE__ */E("span",{className:"font-medium",children:"Upload"}),"."]})]}):/* @__PURE__ */L("table",{className:"w-full text-sm",children:[
|
|
76
76
|
/* @__PURE__ */E("thead",{className:"bg-surface-sunken text-2xs uppercase tracking-wide text-ink-faint",children:/* @__PURE__ */L("tr",{children:[
|
|
77
77
|
/* @__PURE__ */E("th",{className:`${v} text-left font-medium px-3 h-8`,children:"Name"}),
|
|
78
78
|
/* @__PURE__ */E("th",{className:`${v} text-right font-medium px-3 h-8 w-24`,children:"Size"}),
|
|
79
79
|
/* @__PURE__ */E("th",{className:`${v} text-right font-medium px-3 h-8 w-40`,children:"Modified"}),
|
|
80
80
|
/* @__PURE__ */E("th",{className:`${v} w-32`})]})}),
|
|
81
|
-
/* @__PURE__ */E("tbody",{children:
|
|
81
|
+
/* @__PURE__ */E("tbody",{children:O.map(t=>/* @__PURE__ */L("tr",{onClick:()=>K(t.name),onDoubleClick:()=>{"folder"===t.kind?A(W(I,t.name)):(async t=>{if(U)return;const a=W(I,t.name),n=(t.name.split(".").pop()||"").toLowerCase(),r=S[n];r?await e({filePath:a,filename:t.name,kind:r,onStaged:e=>de(e)}):ge(t)})(t)},className:"cursor-default border-b border-gray-100 "+(G===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
82
82
|
/* @__PURE__ */L("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===t.kind?/* @__PURE__ */E(N,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */E(N,{name:"page",className:"h-4 w-4 text-ink-faintest shrink-0",strokeWidth:1.5}),
|
|
83
83
|
/* @__PURE__ */E("span",{className:"truncate",title:t.name,children:t.name})]}),
|
|
84
84
|
/* @__PURE__ */E("td",{className:"px-3 h-8 text-right tabular-nums text-ink-faint",children:"folder"===t.kind?"—":n(t.size)}),
|
|
85
85
|
/* @__PURE__ */E("td",{className:"px-3 h-8 text-right text-ink-faint tabular-nums",children:F(t.modifiedAt)}),
|
|
86
86
|
/* @__PURE__ */E("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:!U&&/* @__PURE__ */L(R,{children:["file"===t.kind&&/* @__PURE__ */E("button",{onClick:e=>{e.stopPropagation(),ge(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-ink-faint text-2xs",children:"Download"}),
|
|
87
|
-
/* @__PURE__ */E("button",{onClick:e=>{e.stopPropagation(),(async e=>{const t=await k({title:`Rename ${e.kind}`,defaultValue:e.name,confirmLabel:"Rename"});if(!t||t===e.name)return;if(/[\\/]/.test(t))return void y.error("Names cannot contain slashes");const a=W(
|
|
88
|
-
/* @__PURE__ */E("button",{onClick:e=>{e.stopPropagation(),(async e=>{if(!await g({title:`Delete ${e.kind}`,message:`"${e.name}"${"folder"===e.kind?" and everything inside":""} will be permanently removed.`,confirmLabel:"Delete",variant:"danger"}))return;const t=W(
|
|
87
|
+
/* @__PURE__ */E("button",{onClick:e=>{e.stopPropagation(),(async e=>{const t=await k({title:`Rename ${e.kind}`,defaultValue:e.name,confirmLabel:"Rename"});if(!t||t===e.name)return;if(/[\\/]/.test(t))return void y.error("Names cannot contain slashes");const a=W(I,e.name),n=W(I,t),r=await pe(`${P}/api/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:a,to:n})});if(!r.ok){const e=await r.json().catch(()=>({}));return void y.error(e.error||`Rename failed (${r.status})`)}fe(I)})(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-ink-faint text-2xs ml-1",children:"Rename"}),
|
|
88
|
+
/* @__PURE__ */E("button",{onClick:e=>{e.stopPropagation(),(async e=>{if(!await g({title:`Delete ${e.kind}`,message:`"${e.name}"${"folder"===e.kind?" and everything inside":""} will be permanently removed.`,confirmLabel:"Delete",variant:"danger"}))return;const t=W(I,e.name),a=await pe(`${P}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!a.ok){const e=await a.json().catch(()=>({}));return void y.error(e.error||`Delete failed (${a.status})`)}fe(I)})(t)},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),Y&&/* @__PURE__ */E("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */E("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{P as default};
|