@fde-desktop/fde-core 0.3.8 → 0.4.2

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.
Files changed (148) hide show
  1. package/README.md +419 -68
  2. package/dist/CalendarApp-CHLUCAI7.css +744 -0
  3. package/dist/CalendarApp-K7ZOUZ6C.js +2 -0
  4. package/dist/CalendarApp-OTGEERSS.cjs +8 -0
  5. package/dist/CodeServerApp-5KZGO7HL.css +75 -0
  6. package/dist/CodeServerApp-LUZFCQBI.js +3 -0
  7. package/dist/CodeServerApp-P3TMJPLY.cjs +9 -0
  8. package/dist/CreateItemApp-NAZMXOPK.cjs +14 -0
  9. package/dist/CreateItemApp-PQB5GTFG.css +107 -0
  10. package/dist/CreateItemApp-ZHCTSPQE.js +8 -0
  11. package/dist/DeviceInfoApp-R6YNVIGX.cjs +11 -0
  12. package/dist/DeviceInfoApp-YHCYAO6N.js +5 -0
  13. package/dist/DeviceInfoApp-ZSMRSITP.css +7 -0
  14. package/dist/FilesApp-AKCVRTXR.js +8 -0
  15. package/dist/FilesApp-E6L5W3T2.css +1817 -0
  16. package/dist/FilesApp-RW3Y6ILO.cjs +14 -0
  17. package/dist/ImageViewerApp-5UXNSW2O.js +11 -0
  18. package/dist/ImageViewerApp-N2Q7E7WZ.css +215 -0
  19. package/dist/ImageViewerApp-RRRRKSFN.cjs +17 -0
  20. package/dist/ImageViewerMenuBar-I3TFKQPS.cjs +14 -0
  21. package/dist/ImageViewerMenuBar-TV5C6TM2.js +5 -0
  22. package/dist/ImageViewerMenuBar-XLK4LIHW.css +56 -0
  23. package/dist/MenuEditApp-HUZRFEHE.js +9 -0
  24. package/dist/MenuEditApp-MCUHGTKQ.cjs +15 -0
  25. package/dist/MenuEditApp-YA6HSAMJ.css +94 -0
  26. package/dist/MenuEditMenuBar-7VHMZNRM.css +56 -0
  27. package/dist/MenuEditMenuBar-GF6L4PGZ.cjs +15 -0
  28. package/dist/MenuEditMenuBar-IUXFPZE5.js +6 -0
  29. package/dist/NotesApp-37BV33C6.js +10 -0
  30. package/dist/NotesApp-4EVUQEFZ.cjs +16 -0
  31. package/dist/NotesApp-TQ6IHDNX.css +302 -0
  32. package/dist/NotesMenuBar-25LKN3SE.cjs +15 -0
  33. package/dist/NotesMenuBar-MXLOX7OT.css +56 -0
  34. package/dist/NotesMenuBar-SRV3AIAL.js +6 -0
  35. package/dist/PdfApp-5VBDNRMC.cjs +16 -0
  36. package/dist/PdfApp-BUIC5U5H.css +206 -0
  37. package/dist/PdfApp-RH6MZZX5.js +10 -0
  38. package/dist/PdfMenuBar-NLZC6JHS.js +4 -0
  39. package/dist/PdfMenuBar-QUM72EE4.css +56 -0
  40. package/dist/PdfMenuBar-WBRTKMLN.cjs +13 -0
  41. package/dist/SettingsApp-5LDHEHYV.cjs +20 -0
  42. package/dist/SettingsApp-JVOSEFH3.css +283 -0
  43. package/dist/SettingsApp-X6764D7T.js +14 -0
  44. package/dist/SettingsMenuBar-5CBSSMVM.css +56 -0
  45. package/dist/SettingsMenuBar-VLT6TTCM.js +6 -0
  46. package/dist/SettingsMenuBar-Y5QEXDEO.cjs +15 -0
  47. package/dist/StorybookApp-NQ244BER.css +7 -0
  48. package/dist/StorybookApp-NZDV4X3Y.js +1 -0
  49. package/dist/StorybookApp-VF3KIMU3.cjs +7 -0
  50. package/dist/TerminalApp-CDGWRBFJ.cjs +10 -0
  51. package/dist/TerminalApp-EAATMIMX.css +77 -0
  52. package/dist/TerminalApp-GCKJCM55.js +4 -0
  53. package/dist/TerminalMenuBar-3J26O26Q.css +56 -0
  54. package/dist/TerminalMenuBar-7BH7MGNJ.cjs +14 -0
  55. package/dist/TerminalMenuBar-7JAEQUZ4.js +5 -0
  56. package/dist/UploaderApp-2WYRCUQV.js +10 -0
  57. package/dist/UploaderApp-6KV3TGCT.css +1817 -0
  58. package/dist/UploaderApp-EYFC36PM.cjs +16 -0
  59. package/dist/chunk-2FO445RM.cjs +449 -0
  60. package/dist/chunk-2PSTHGTD.cjs +42 -0
  61. package/dist/chunk-2RQX7QBP.cjs +148 -0
  62. package/dist/chunk-3IICBLEA.js +442 -0
  63. package/dist/chunk-43W6UDUZ.cjs +19 -0
  64. package/dist/chunk-4E45FBAH.js +223 -0
  65. package/dist/chunk-4MCFQPKY.js +444 -0
  66. package/dist/chunk-4OH5RPSQ.cjs +38 -0
  67. package/dist/chunk-4XURSNM4.js +43 -0
  68. package/dist/chunk-4ZCRYHL6.js +407 -0
  69. package/dist/chunk-54PYEQLK.js +283 -0
  70. package/dist/chunk-5C6IQE42.cjs +35 -0
  71. package/dist/chunk-5NOHYJNH.js +84 -0
  72. package/dist/chunk-5PYK5ASL.js +162 -0
  73. package/dist/chunk-5YH6AKEO.js +146 -0
  74. package/dist/chunk-657BJOY5.cjs +324 -0
  75. package/dist/chunk-6QOUYSEE.cjs +2303 -0
  76. package/dist/chunk-7SAFECOJ.js +215 -0
  77. package/dist/chunk-7Y7HB7FB.cjs +53 -0
  78. package/dist/chunk-ABIAPZ6S.cjs +45 -0
  79. package/dist/chunk-AQL372JF.cjs +219 -0
  80. package/dist/chunk-AXDUVZVP.cjs +88 -0
  81. package/dist/chunk-AYFNYHMP.js +541 -0
  82. package/dist/chunk-BDO6B7MZ.cjs +451 -0
  83. package/dist/chunk-BKXEA2BK.cjs +286 -0
  84. package/dist/chunk-BLV47DX2.js +47 -0
  85. package/dist/chunk-BQCD5RAF.cjs +48 -0
  86. package/dist/chunk-BQL3YXMV.js +17429 -0
  87. package/dist/chunk-C6BEZNAM.cjs +45 -0
  88. package/dist/chunk-CFWV2JMR.js +234 -0
  89. package/dist/chunk-CV5PUHAE.cjs +86 -0
  90. package/dist/chunk-D5MVFFID.js +42 -0
  91. package/dist/chunk-D7R55WWT.js +1601 -0
  92. package/dist/chunk-DMNF4CNN.cjs +49 -0
  93. package/dist/chunk-DWP2SYF7.js +55 -0
  94. package/dist/chunk-E55VXNLK.cjs +17498 -0
  95. package/dist/chunk-EAELL43F.js +42 -0
  96. package/dist/chunk-EUQLZW6P.js +48 -0
  97. package/dist/chunk-EX5V2ZTU.js +40 -0
  98. package/dist/chunk-FH4ILMKF.js +38 -0
  99. package/dist/chunk-FRHBM2U7.js +33 -0
  100. package/dist/chunk-FX2TPX3L.cjs +45 -0
  101. package/dist/chunk-GCYD6T52.js +32 -0
  102. package/dist/chunk-GRYCUBJZ.js +9 -0
  103. package/dist/chunk-HWHBSAUC.js +40 -0
  104. package/dist/chunk-ICUE6T7J.cjs +50 -0
  105. package/dist/chunk-IDHP3R4I.js +31 -0
  106. package/dist/chunk-IUOQPOEN.js +2293 -0
  107. package/dist/chunk-J7L2S2GT.cjs +34 -0
  108. package/dist/chunk-JEBKLIMU.cjs +123 -0
  109. package/dist/chunk-KQHICFX3.js +121 -0
  110. package/dist/chunk-LMJE6V4N.cjs +42 -0
  111. package/dist/chunk-MVDGM5Y4.js +68 -0
  112. package/dist/chunk-NVEGEK3N.js +31 -0
  113. package/dist/chunk-NWMSWRUD.js +2236 -0
  114. package/dist/chunk-ODXL6BR3.js +77 -0
  115. package/dist/chunk-OJIDKDKF.js +68 -0
  116. package/dist/chunk-PKPQA5NR.js +15 -0
  117. package/dist/chunk-PNDBLFJW.cjs +50 -0
  118. package/dist/chunk-PYTKNRGM.js +280 -0
  119. package/dist/chunk-Q3WA72BF.cjs +70 -0
  120. package/dist/chunk-QB72BLCJ.cjs +237 -0
  121. package/dist/chunk-QHBBLML3.js +86 -0
  122. package/dist/chunk-RDIDAZ3S.cjs +9 -0
  123. package/dist/chunk-RGJPRXYY.js +48 -0
  124. package/dist/chunk-RQ6OZRUW.cjs +41 -0
  125. package/dist/chunk-SBE4SZAN.cjs +226 -0
  126. package/dist/chunk-SYGUWGWK.cjs +2329 -0
  127. package/dist/chunk-TDZ43MUX.cjs +165 -0
  128. package/dist/chunk-TGWMOHAO.js +17 -0
  129. package/dist/chunk-U4RYIS6Z.cjs +548 -0
  130. package/dist/chunk-UIQCTAVM.cjs +59 -0
  131. package/dist/chunk-XVASHRCE.cjs +70 -0
  132. package/dist/chunk-XYSMVQQD.cjs +1608 -0
  133. package/dist/chunk-YAIWI4Z5.js +7 -0
  134. package/dist/chunk-YP2PLNOF.cjs +34 -0
  135. package/dist/chunk-YSOLW4FS.cjs +11 -0
  136. package/dist/chunk-YY6OUR2U.js +44 -0
  137. package/dist/chunk-YZWS7FDT.cjs +409 -0
  138. package/dist/chunk-Z5YGWL65.cjs +39 -0
  139. package/dist/chunk-ZBGWYTCU.cjs +83 -0
  140. package/dist/chunk-ZHB5Q2M6.js +36 -0
  141. package/dist/chunk-ZHNDXNL4.js +45 -0
  142. package/dist/chunk-ZX3EDZ5C.cjs +17 -0
  143. package/dist/index.cjs +4405 -5156
  144. package/dist/index.css +9192 -0
  145. package/dist/index.d.cts +1324 -762
  146. package/dist/index.d.ts +1324 -762
  147. package/dist/index.js +3648 -5038
  148. package/package.json +14 -6
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ var zustand = require('zustand');
4
+
5
+ // src/components/Apps/TerminalApp/terminalStore.ts
6
+ var DEFAULT_STATE = {
7
+ scrollback: 5e3,
8
+ shell: "/bin/zsh"
9
+ };
10
+ var useTerminalStore = zustand.create((set, get) => ({
11
+ states: {},
12
+ getScrollback: (id) => get().states[id]?.scrollback ?? DEFAULT_STATE.scrollback,
13
+ getShell: (id) => get().states[id]?.shell ?? DEFAULT_STATE.shell,
14
+ setScrollback: (id, scrollback) => set((s) => ({
15
+ states: {
16
+ ...s.states,
17
+ [id]: { ...s.states[id] ?? DEFAULT_STATE, scrollback }
18
+ }
19
+ })),
20
+ setShell: (id, shell) => set((s) => ({
21
+ states: {
22
+ ...s.states,
23
+ [id]: { ...s.states[id] ?? DEFAULT_STATE, shell }
24
+ }
25
+ })),
26
+ reset: (id) => set((s) => ({
27
+ states: { ...s.states, [id]: { ...DEFAULT_STATE } }
28
+ }))
29
+ }));
30
+ var useScrollback = (windowId) => useTerminalStore((s) => s.states[windowId]?.scrollback ?? DEFAULT_STATE.scrollback);
31
+ var useShell = (windowId) => useTerminalStore((s) => s.states[windowId]?.shell ?? DEFAULT_STATE.shell);
32
+
33
+ exports.useScrollback = useScrollback;
34
+ exports.useShell = useShell;
35
+ exports.useTerminalStore = useTerminalStore;
@@ -0,0 +1,84 @@
1
+ import { AppMenuBar_default } from './chunk-4E45FBAH.js';
2
+ import { useDisplayZoom, useFitToWindow, useImageViewerStore } from './chunk-DWP2SYF7.js';
3
+ import { memo, useCallback, useMemo } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { jsx } from 'react/jsx-runtime';
6
+
7
+ var ZOOM_MARKS = [
8
+ { value: 25, label: "25%" },
9
+ { value: 50, label: "50%" },
10
+ { value: 75, label: "75%" },
11
+ { value: 100, label: "100%" },
12
+ { value: 200, label: "200%" }
13
+ ];
14
+ var useImageViewerMenuBarElements = (options) => {
15
+ const { windowId, onOpenPicker, onExit } = options;
16
+ const { t } = useTranslation("common");
17
+ const { t: tApps } = useTranslation("apps");
18
+ const displayZoom = useDisplayZoom(windowId);
19
+ const fitToWindow = useFitToWindow(windowId);
20
+ const setUserZoom = useImageViewerStore((s) => s.setUserZoom);
21
+ const setFitToWindow = useImageViewerStore((s) => s.setFitToWindow);
22
+ const handleFitChange = useCallback(
23
+ (checked) => setFitToWindow(windowId, checked),
24
+ [windowId, setFitToWindow]
25
+ );
26
+ const handleZoomChange = useCallback(
27
+ (value) => setUserZoom(windowId, value),
28
+ [windowId, setUserZoom]
29
+ );
30
+ return useMemo(() => {
31
+ const zoomLabel = `${tApps("imageViewer.zoom")}: ${displayZoom}%`;
32
+ return [
33
+ {
34
+ type: "menu",
35
+ label: t("menu.file"),
36
+ items: [
37
+ {
38
+ type: "item",
39
+ label: t("actions.open"),
40
+ icon: "FcOpenedFolder",
41
+ onClick: onOpenPicker ?? (() => {
42
+ })
43
+ },
44
+ { type: "divider" },
45
+ {
46
+ type: "item",
47
+ label: t("actions.exit"),
48
+ icon: "FcLeft",
49
+ onClick: onExit
50
+ }
51
+ ]
52
+ },
53
+ {
54
+ type: "switch",
55
+ label: tApps("imageViewer.fitToWindow"),
56
+ checked: fitToWindow,
57
+ onChange: handleFitChange
58
+ },
59
+ {
60
+ type: "slider",
61
+ label: zoomLabel,
62
+ min: 10,
63
+ max: 200,
64
+ value: displayZoom,
65
+ onChange: handleZoomChange,
66
+ marks: ZOOM_MARKS,
67
+ labelFormat: (value) => `${value}%`
68
+ }
69
+ ];
70
+ }, [t, tApps, onOpenPicker, onExit, displayZoom, fitToWindow, handleFitChange, handleZoomChange]);
71
+ };
72
+ var ImageViewerMenuBar = memo(
73
+ ({ windowId, contentData, onExit }) => {
74
+ const elements = useImageViewerMenuBarElements({
75
+ windowId,
76
+ onOpenPicker: contentData?.setPickerOpen,
77
+ onExit
78
+ });
79
+ return /* @__PURE__ */ jsx(AppMenuBar_default, { elements });
80
+ }
81
+ );
82
+ ImageViewerMenuBar.displayName = "ImageViewerMenuBar";
83
+
84
+ export { ImageViewerMenuBar };
@@ -0,0 +1,162 @@
1
+ import { useAdaptiveDimensions } from './chunk-ZHB5Q2M6.js';
2
+ import { useDesktopStore, BREAKPOINTS } from './chunk-NWMSWRUD.js';
3
+ import { isDocker, isDev } from './chunk-FRHBM2U7.js';
4
+ import { Paper, Stack, Text, Code } from './chunk-BQL3YXMV.js';
5
+ import { useState, useCallback, useEffect } from 'react';
6
+ import { jsxs, jsx } from 'react/jsx-runtime';
7
+
8
+ var getIsMobile = () => {
9
+ const width = window.innerWidth;
10
+ const isCoarsePointer = window.matchMedia("(pointer: coarse)").matches;
11
+ return width < BREAKPOINTS.MOBILE || isCoarsePointer;
12
+ };
13
+ var getIsTablet = () => {
14
+ const width = window.innerWidth;
15
+ return width >= BREAKPOINTS.MOBILE && width < BREAKPOINTS.TABLET;
16
+ };
17
+ var getIsDesktop = () => {
18
+ const width = window.innerWidth;
19
+ return width >= BREAKPOINTS.TABLET;
20
+ };
21
+ var getIsPortrait = () => {
22
+ if (screen.orientation) {
23
+ return screen.orientation.type.includes("portrait");
24
+ }
25
+ return window.innerHeight > window.innerWidth;
26
+ };
27
+ function useDeviceDetection() {
28
+ const [deviceInfo, setDeviceInfo] = useState(() => ({
29
+ isMobile: getIsMobile(),
30
+ isTablet: getIsTablet(),
31
+ isDesktop: getIsDesktop(),
32
+ isPortrait: getIsPortrait(),
33
+ shouldShowWarning: getIsMobile() && getIsPortrait(),
34
+ screenWidth: window.innerWidth,
35
+ screenHeight: window.innerHeight
36
+ }));
37
+ const updateDeviceInfo = useCallback(() => {
38
+ const isMobile = getIsMobile();
39
+ const isPortrait = getIsPortrait();
40
+ setDeviceInfo({
41
+ isMobile,
42
+ isTablet: getIsTablet(),
43
+ isDesktop: getIsDesktop(),
44
+ isPortrait,
45
+ shouldShowWarning: isMobile && isPortrait,
46
+ screenWidth: window.innerWidth,
47
+ screenHeight: window.innerHeight
48
+ });
49
+ }, []);
50
+ useEffect(() => {
51
+ window.addEventListener("resize", updateDeviceInfo);
52
+ screen.orientation?.addEventListener?.("change", updateDeviceInfo);
53
+ return () => {
54
+ window.removeEventListener("resize", updateDeviceInfo);
55
+ screen.orientation?.removeEventListener?.("change", updateDeviceInfo);
56
+ };
57
+ }, [updateDeviceInfo]);
58
+ return deviceInfo;
59
+ }
60
+
61
+ // src/components/Apps/DeviceInfoApp/DeviceInfoApp.module.css
62
+ var DeviceInfoApp_default = {};
63
+ var DeviceInfoApp = ({ window: win, notifyReady }) => {
64
+ const device = useDeviceDetection();
65
+ const dimensions = useAdaptiveDimensions();
66
+ const viewportWidth = useDesktopStore((state) => state.viewportWidth);
67
+ const viewportHeight = useDesktopStore((state) => state.viewportHeight);
68
+ const setViewportSize = useDesktopStore((state) => state.setViewportSize);
69
+ useEffect(() => {
70
+ notifyReady?.({});
71
+ }, [notifyReady]);
72
+ useEffect(() => {
73
+ const handleResize = () => {
74
+ setViewportSize(window.innerWidth, window.innerHeight);
75
+ };
76
+ handleResize();
77
+ window.addEventListener("resize", handleResize);
78
+ return () => window.removeEventListener("resize", handleResize);
79
+ }, [setViewportSize]);
80
+ return /* @__PURE__ */ jsxs("div", { className: DeviceInfoApp_default.container, "data-windowid": win?.id, children: [
81
+ /* @__PURE__ */ jsx(Paper, { p: "sm", shadow: "sm", withBorder: true, children: /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
82
+ /* @__PURE__ */ jsx(Text, { fw: "bold", size: "sm", children: "Runtime Environment" }),
83
+ /* @__PURE__ */ jsxs(Text, { size: "xs", children: [
84
+ /* @__PURE__ */ jsx(Code, { children: "isDocker:" }),
85
+ " ",
86
+ String(isDocker())
87
+ ] }),
88
+ /* @__PURE__ */ jsxs(Text, { size: "xs", children: [
89
+ /* @__PURE__ */ jsx(Code, { children: "isDev:" }),
90
+ " ",
91
+ String(isDev())
92
+ ] })
93
+ ] }) }),
94
+ /* @__PURE__ */ jsx(Paper, { p: "sm", shadow: "sm", withBorder: true, mt: "sm", children: /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
95
+ /* @__PURE__ */ jsx(Text, { fw: "bold", size: "sm", children: "Device Detection" }),
96
+ /* @__PURE__ */ jsxs(Text, { size: "xs", children: [
97
+ /* @__PURE__ */ jsx(Code, { children: "isMobile:" }),
98
+ " ",
99
+ String(device.isMobile)
100
+ ] }),
101
+ /* @__PURE__ */ jsxs(Text, { size: "xs", children: [
102
+ /* @__PURE__ */ jsx(Code, { children: "isTablet:" }),
103
+ " ",
104
+ String(device.isTablet)
105
+ ] }),
106
+ /* @__PURE__ */ jsxs(Text, { size: "xs", children: [
107
+ /* @__PURE__ */ jsx(Code, { children: "isDesktop:" }),
108
+ " ",
109
+ String(device.isDesktop)
110
+ ] }),
111
+ /* @__PURE__ */ jsxs(Text, { size: "xs", children: [
112
+ /* @__PURE__ */ jsx(Code, { children: "isPortrait:" }),
113
+ " ",
114
+ String(device.isPortrait)
115
+ ] }),
116
+ /* @__PURE__ */ jsxs(Text, { size: "xs", children: [
117
+ /* @__PURE__ */ jsx(Code, { children: "shouldShowWarning:" }),
118
+ " ",
119
+ String(device.shouldShowWarning)
120
+ ] }),
121
+ /* @__PURE__ */ jsxs(Text, { size: "xs", children: [
122
+ /* @__PURE__ */ jsx(Code, { children: "viewportWidth:" }),
123
+ " ",
124
+ viewportWidth,
125
+ "px"
126
+ ] }),
127
+ /* @__PURE__ */ jsxs(Text, { size: "xs", children: [
128
+ /* @__PURE__ */ jsx(Code, { children: "viewportHeight:" }),
129
+ " ",
130
+ viewportHeight,
131
+ "px"
132
+ ] }),
133
+ /* @__PURE__ */ jsxs(Text, { size: "xs", children: [
134
+ /* @__PURE__ */ jsx(Code, { children: "defaultWidth:" }),
135
+ " ",
136
+ dimensions.defaultWidth,
137
+ "px"
138
+ ] }),
139
+ /* @__PURE__ */ jsxs(Text, { size: "xs", children: [
140
+ /* @__PURE__ */ jsx(Code, { children: "defaultHeight:" }),
141
+ " ",
142
+ dimensions.defaultHeight,
143
+ "px"
144
+ ] }),
145
+ /* @__PURE__ */ jsxs(Text, { size: "xs", children: [
146
+ /* @__PURE__ */ jsx(Code, { children: "minWidth:" }),
147
+ " ",
148
+ dimensions.minWidth,
149
+ "px"
150
+ ] }),
151
+ /* @__PURE__ */ jsxs(Text, { size: "xs", children: [
152
+ /* @__PURE__ */ jsx(Code, { children: "minHeight:" }),
153
+ " ",
154
+ dimensions.minHeight,
155
+ "px"
156
+ ] })
157
+ ] }) })
158
+ ] });
159
+ };
160
+ var DeviceInfoApp_default2 = DeviceInfoApp;
161
+
162
+ export { DeviceInfoApp_default2 as DeviceInfoApp_default, useDeviceDetection };
@@ -0,0 +1,146 @@
1
+ import { useScrollback, useShell, useTerminalStore } from './chunk-NVEGEK3N.js';
2
+ import { AppMenuBar_default } from './chunk-4E45FBAH.js';
3
+ import { memo, useCallback, useMemo } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { jsx } from 'react/jsx-runtime';
6
+
7
+ var SHELL_OPTIONS = [
8
+ { value: "/bin/sh", label: "sh" },
9
+ { value: "/bin/zsh", label: "zsh" }
10
+ ];
11
+ function useTerminalMenuBarElements(options) {
12
+ const {
13
+ windowId,
14
+ onExit,
15
+ clear,
16
+ reset,
17
+ copy,
18
+ paste,
19
+ reconnect,
20
+ connectionStatus = "idle"
21
+ } = options;
22
+ const { t } = useTranslation("common");
23
+ const { t: tApps } = useTranslation("apps");
24
+ const scrollback = useScrollback(windowId);
25
+ const shell = useShell(windowId);
26
+ const setScrollback = useTerminalStore((s) => s.setScrollback);
27
+ const setShell = useTerminalStore((s) => s.setShell);
28
+ const handleScrollbackChange = useCallback(
29
+ (value) => setScrollback(windowId, value),
30
+ [windowId, setScrollback]
31
+ );
32
+ const handleShellChange = useCallback(
33
+ (value) => setShell(windowId, value),
34
+ [windowId, setShell]
35
+ );
36
+ const isConnected = connectionStatus === "connected";
37
+ return useMemo(() => {
38
+ const menuItems = [
39
+ {
40
+ type: "item",
41
+ label: tApps("terminal.menu.copy"),
42
+ icon: "FcCopy",
43
+ onClick: copy ?? (() => {
44
+ }),
45
+ disabled: !isConnected
46
+ },
47
+ {
48
+ type: "item",
49
+ label: tApps("terminal.menu.paste"),
50
+ icon: "FcPaste",
51
+ onClick: paste ?? (() => {
52
+ }),
53
+ disabled: !isConnected
54
+ },
55
+ { type: "divider" },
56
+ {
57
+ type: "item",
58
+ label: tApps("terminal.menu.clear"),
59
+ icon: "FcClear",
60
+ onClick: clear ?? (() => {
61
+ }),
62
+ disabled: !isConnected
63
+ },
64
+ {
65
+ type: "item",
66
+ label: tApps("terminal.menu.reset"),
67
+ icon: "FcSynchronize",
68
+ onClick: reset ?? (() => {
69
+ }),
70
+ disabled: !isConnected
71
+ }
72
+ ];
73
+ if (!isConnected && reconnect) {
74
+ menuItems.push({ type: "divider" });
75
+ menuItems.push({
76
+ type: "item",
77
+ label: tApps("terminal.menu.reconnect"),
78
+ icon: "FcSynchronize",
79
+ onClick: reconnect
80
+ });
81
+ }
82
+ menuItems.push({ type: "divider" });
83
+ menuItems.push({
84
+ type: "item",
85
+ label: t("actions.exit"),
86
+ icon: "FcLeave",
87
+ onClick: onExit
88
+ });
89
+ return [
90
+ {
91
+ type: "menu",
92
+ label: t("menu.edit"),
93
+ items: menuItems
94
+ },
95
+ {
96
+ type: "number-input",
97
+ label: tApps("terminal.scrollback"),
98
+ value: scrollback,
99
+ onChange: handleScrollbackChange,
100
+ min: 100,
101
+ max: 5e4,
102
+ step: 100,
103
+ placeholder: "5000"
104
+ },
105
+ {
106
+ type: "select",
107
+ label: tApps("terminal.shell"),
108
+ options: SHELL_OPTIONS,
109
+ value: shell,
110
+ onChange: handleShellChange
111
+ }
112
+ ];
113
+ }, [
114
+ t,
115
+ tApps,
116
+ onExit,
117
+ clear,
118
+ reset,
119
+ copy,
120
+ paste,
121
+ reconnect,
122
+ isConnected,
123
+ scrollback,
124
+ shell,
125
+ handleScrollbackChange,
126
+ handleShellChange
127
+ ]);
128
+ }
129
+ var TerminalMenuBar = memo(
130
+ ({ windowId, contentData, onExit }) => {
131
+ const elements = useTerminalMenuBarElements({
132
+ windowId,
133
+ onExit,
134
+ clear: contentData?.clear,
135
+ reset: contentData?.reset,
136
+ copy: contentData?.copy,
137
+ paste: contentData?.paste,
138
+ reconnect: contentData?.reconnect,
139
+ connectionStatus: contentData?.connectionStatus
140
+ });
141
+ return /* @__PURE__ */ jsx(AppMenuBar_default, { elements });
142
+ }
143
+ );
144
+ TerminalMenuBar.displayName = "TerminalMenuBar";
145
+
146
+ export { TerminalMenuBar };