@fde-desktop/fde-core 0.3.7 → 0.4.1
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 +419 -68
- package/dist/CalendarApp-CHLUCAI7.css +744 -0
- package/dist/CalendarApp-K7ZOUZ6C.js +2 -0
- package/dist/CalendarApp-OTGEERSS.cjs +8 -0
- package/dist/CodeServerApp-5KZGO7HL.css +75 -0
- package/dist/CodeServerApp-LUZFCQBI.js +3 -0
- package/dist/CodeServerApp-P3TMJPLY.cjs +9 -0
- package/dist/CreateItemApp-NAZMXOPK.cjs +14 -0
- package/dist/CreateItemApp-PQB5GTFG.css +107 -0
- package/dist/CreateItemApp-ZHCTSPQE.js +8 -0
- package/dist/DeviceInfoApp-R6YNVIGX.cjs +11 -0
- package/dist/DeviceInfoApp-YHCYAO6N.js +5 -0
- package/dist/DeviceInfoApp-ZSMRSITP.css +7 -0
- package/dist/FilesApp-AKCVRTXR.js +8 -0
- package/dist/FilesApp-E6L5W3T2.css +1817 -0
- package/dist/FilesApp-RW3Y6ILO.cjs +14 -0
- package/dist/ImageViewerApp-5UXNSW2O.js +11 -0
- package/dist/ImageViewerApp-N2Q7E7WZ.css +215 -0
- package/dist/ImageViewerApp-RRRRKSFN.cjs +17 -0
- package/dist/ImageViewerMenuBar-I3TFKQPS.cjs +14 -0
- package/dist/ImageViewerMenuBar-TV5C6TM2.js +5 -0
- package/dist/ImageViewerMenuBar-XLK4LIHW.css +56 -0
- package/dist/MenuEditApp-HUZRFEHE.js +9 -0
- package/dist/MenuEditApp-MCUHGTKQ.cjs +15 -0
- package/dist/MenuEditApp-YA6HSAMJ.css +94 -0
- package/dist/MenuEditMenuBar-7VHMZNRM.css +56 -0
- package/dist/MenuEditMenuBar-GF6L4PGZ.cjs +15 -0
- package/dist/MenuEditMenuBar-IUXFPZE5.js +6 -0
- package/dist/NotesApp-37BV33C6.js +10 -0
- package/dist/NotesApp-4EVUQEFZ.cjs +16 -0
- package/dist/NotesApp-TQ6IHDNX.css +302 -0
- package/dist/NotesMenuBar-25LKN3SE.cjs +15 -0
- package/dist/NotesMenuBar-MXLOX7OT.css +56 -0
- package/dist/NotesMenuBar-SRV3AIAL.js +6 -0
- package/dist/PdfApp-5VBDNRMC.cjs +16 -0
- package/dist/PdfApp-BUIC5U5H.css +206 -0
- package/dist/PdfApp-RH6MZZX5.js +10 -0
- package/dist/PdfMenuBar-NLZC6JHS.js +4 -0
- package/dist/PdfMenuBar-QUM72EE4.css +56 -0
- package/dist/PdfMenuBar-WBRTKMLN.cjs +13 -0
- package/dist/SettingsApp-5LDHEHYV.cjs +20 -0
- package/dist/SettingsApp-JVOSEFH3.css +283 -0
- package/dist/SettingsApp-X6764D7T.js +14 -0
- package/dist/SettingsMenuBar-5CBSSMVM.css +56 -0
- package/dist/SettingsMenuBar-VLT6TTCM.js +6 -0
- package/dist/SettingsMenuBar-Y5QEXDEO.cjs +15 -0
- package/dist/StorybookApp-NQ244BER.css +7 -0
- package/dist/StorybookApp-NZDV4X3Y.js +1 -0
- package/dist/StorybookApp-VF3KIMU3.cjs +7 -0
- package/dist/TerminalApp-CDGWRBFJ.cjs +10 -0
- package/dist/TerminalApp-EAATMIMX.css +77 -0
- package/dist/TerminalApp-GCKJCM55.js +4 -0
- package/dist/TerminalMenuBar-3J26O26Q.css +56 -0
- package/dist/TerminalMenuBar-7BH7MGNJ.cjs +14 -0
- package/dist/TerminalMenuBar-7JAEQUZ4.js +5 -0
- package/dist/UploaderApp-2WYRCUQV.js +10 -0
- package/dist/UploaderApp-6KV3TGCT.css +1817 -0
- package/dist/UploaderApp-EYFC36PM.cjs +16 -0
- package/dist/chunk-2FO445RM.cjs +449 -0
- package/dist/chunk-2PSTHGTD.cjs +42 -0
- package/dist/chunk-2RQX7QBP.cjs +148 -0
- package/dist/chunk-3IICBLEA.js +442 -0
- package/dist/chunk-43W6UDUZ.cjs +19 -0
- package/dist/chunk-4E45FBAH.js +223 -0
- package/dist/chunk-4MCFQPKY.js +444 -0
- package/dist/chunk-4OH5RPSQ.cjs +38 -0
- package/dist/chunk-4XURSNM4.js +43 -0
- package/dist/chunk-4ZCRYHL6.js +407 -0
- package/dist/chunk-54PYEQLK.js +283 -0
- package/dist/chunk-5C6IQE42.cjs +35 -0
- package/dist/chunk-5NOHYJNH.js +84 -0
- package/dist/chunk-5PYK5ASL.js +162 -0
- package/dist/chunk-5YH6AKEO.js +146 -0
- package/dist/chunk-657BJOY5.cjs +324 -0
- package/dist/chunk-6QOUYSEE.cjs +2303 -0
- package/dist/chunk-7SAFECOJ.js +215 -0
- package/dist/chunk-7Y7HB7FB.cjs +53 -0
- package/dist/chunk-ABIAPZ6S.cjs +45 -0
- package/dist/chunk-AQL372JF.cjs +219 -0
- package/dist/chunk-AXDUVZVP.cjs +88 -0
- package/dist/chunk-AYFNYHMP.js +541 -0
- package/dist/chunk-BDO6B7MZ.cjs +451 -0
- package/dist/chunk-BKXEA2BK.cjs +286 -0
- package/dist/chunk-BLV47DX2.js +47 -0
- package/dist/chunk-BQCD5RAF.cjs +48 -0
- package/dist/chunk-BQL3YXMV.js +17429 -0
- package/dist/chunk-C6BEZNAM.cjs +45 -0
- package/dist/chunk-CFWV2JMR.js +234 -0
- package/dist/chunk-CV5PUHAE.cjs +86 -0
- package/dist/chunk-D5MVFFID.js +42 -0
- package/dist/chunk-D7R55WWT.js +1601 -0
- package/dist/chunk-DMNF4CNN.cjs +49 -0
- package/dist/chunk-DWP2SYF7.js +55 -0
- package/dist/chunk-E55VXNLK.cjs +17498 -0
- package/dist/chunk-EAELL43F.js +42 -0
- package/dist/chunk-EUQLZW6P.js +48 -0
- package/dist/chunk-EX5V2ZTU.js +40 -0
- package/dist/chunk-FH4ILMKF.js +38 -0
- package/dist/chunk-FRHBM2U7.js +33 -0
- package/dist/chunk-FX2TPX3L.cjs +45 -0
- package/dist/chunk-GCYD6T52.js +32 -0
- package/dist/chunk-GRYCUBJZ.js +9 -0
- package/dist/chunk-HWHBSAUC.js +40 -0
- package/dist/chunk-ICUE6T7J.cjs +50 -0
- package/dist/chunk-IDHP3R4I.js +31 -0
- package/dist/chunk-IUOQPOEN.js +2293 -0
- package/dist/chunk-J7L2S2GT.cjs +34 -0
- package/dist/chunk-JEBKLIMU.cjs +123 -0
- package/dist/chunk-KQHICFX3.js +121 -0
- package/dist/chunk-LMJE6V4N.cjs +42 -0
- package/dist/chunk-MVDGM5Y4.js +68 -0
- package/dist/chunk-NVEGEK3N.js +31 -0
- package/dist/chunk-NWMSWRUD.js +2236 -0
- package/dist/chunk-ODXL6BR3.js +77 -0
- package/dist/chunk-OJIDKDKF.js +68 -0
- package/dist/chunk-PKPQA5NR.js +15 -0
- package/dist/chunk-PNDBLFJW.cjs +50 -0
- package/dist/chunk-PYTKNRGM.js +280 -0
- package/dist/chunk-Q3WA72BF.cjs +70 -0
- package/dist/chunk-QB72BLCJ.cjs +237 -0
- package/dist/chunk-QHBBLML3.js +86 -0
- package/dist/chunk-RDIDAZ3S.cjs +9 -0
- package/dist/chunk-RGJPRXYY.js +48 -0
- package/dist/chunk-RQ6OZRUW.cjs +41 -0
- package/dist/chunk-SBE4SZAN.cjs +226 -0
- package/dist/chunk-SYGUWGWK.cjs +2329 -0
- package/dist/chunk-TDZ43MUX.cjs +165 -0
- package/dist/chunk-TGWMOHAO.js +17 -0
- package/dist/chunk-U4RYIS6Z.cjs +548 -0
- package/dist/chunk-UIQCTAVM.cjs +59 -0
- package/dist/chunk-XVASHRCE.cjs +70 -0
- package/dist/chunk-XYSMVQQD.cjs +1608 -0
- package/dist/chunk-YAIWI4Z5.js +7 -0
- package/dist/chunk-YP2PLNOF.cjs +34 -0
- package/dist/chunk-YSOLW4FS.cjs +11 -0
- package/dist/chunk-YY6OUR2U.js +44 -0
- package/dist/chunk-YZWS7FDT.cjs +409 -0
- package/dist/chunk-Z5YGWL65.cjs +39 -0
- package/dist/chunk-ZBGWYTCU.cjs +83 -0
- package/dist/chunk-ZHB5Q2M6.js +36 -0
- package/dist/chunk-ZHNDXNL4.js +45 -0
- package/dist/chunk-ZX3EDZ5C.cjs +17 -0
- package/dist/index.cjs +5641 -0
- package/dist/index.css +9192 -0
- package/dist/index.d.cts +2019 -0
- package/dist/index.d.ts +2019 -11
- package/dist/index.js +4794 -6598
- package/package.json +26 -14
- package/dist/apps/index.d.ts +0 -2
- package/dist/components/index.d.ts +0 -1
- package/dist/constants/index.d.ts +0 -12
- package/dist/domain/index.d.ts +0 -5
- package/dist/fc-D_a-n3yF.js +0 -20204
- package/dist/fi-DwZ_MW7F.js +0 -9993
- package/dist/hooks/index.d.ts +0 -28
- package/dist/i18n/index.d.ts +0 -2
- package/dist/iconBase-B764UN-4.js +0 -108
- package/dist/infrastructure/index.d.ts +0 -6
- package/dist/interfaces/index.d.ts +0 -11
- package/dist/stores/index.d.ts +0 -8
- package/dist/types/index.d.ts +0 -4
- package/dist/utils/index.d.ts +0 -14
- package/dist/vsc-CeA30gcb.js +0 -9574
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { useDesktopStore } from './chunk-NWMSWRUD.js';
|
|
2
|
+
import { create } from 'zustand';
|
|
3
|
+
import { useRef, useEffect, useCallback } from 'react';
|
|
4
|
+
|
|
5
|
+
var useCloseModalStore = create()((set) => ({
|
|
6
|
+
isOpen: false,
|
|
7
|
+
windowId: null,
|
|
8
|
+
onSave: null,
|
|
9
|
+
onDiscard: null,
|
|
10
|
+
openModal: (windowId, onSave, onDiscard) => set({
|
|
11
|
+
isOpen: true,
|
|
12
|
+
windowId,
|
|
13
|
+
onSave,
|
|
14
|
+
onDiscard
|
|
15
|
+
}),
|
|
16
|
+
closeModal: () => set({ isOpen: false, windowId: null, onSave: null, onDiscard: null })
|
|
17
|
+
}));
|
|
18
|
+
var closeInterceptors = /* @__PURE__ */ new Map();
|
|
19
|
+
var registerCloseInterceptor = (windowId, interceptor) => {
|
|
20
|
+
closeInterceptors.set(windowId, interceptor);
|
|
21
|
+
};
|
|
22
|
+
var unregisterCloseInterceptor = (windowId) => {
|
|
23
|
+
closeInterceptors.delete(windowId);
|
|
24
|
+
};
|
|
25
|
+
var getCloseInterceptor = (windowId) => {
|
|
26
|
+
return closeInterceptors.get(windowId);
|
|
27
|
+
};
|
|
28
|
+
function useCloseInterceptor({
|
|
29
|
+
isDirtyGetter,
|
|
30
|
+
windowId,
|
|
31
|
+
onDiscard,
|
|
32
|
+
onSave
|
|
33
|
+
}) {
|
|
34
|
+
const windows = useDesktopStore((state) => state.windows);
|
|
35
|
+
const closeWindow = useDesktopStore((state) => state.closeWindow);
|
|
36
|
+
const openModal = useCloseModalStore((state) => state.openModal);
|
|
37
|
+
const activeWindowId = windowId ?? windows.find((w) => w.isOpen)?.id;
|
|
38
|
+
const isDirtyGetterRef = useRef(isDirtyGetter);
|
|
39
|
+
const isActiveRef = useRef(false);
|
|
40
|
+
const onDiscardRef = useRef(onDiscard);
|
|
41
|
+
const onSaveRef = useRef(onSave);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
isDirtyGetterRef.current = isDirtyGetter;
|
|
44
|
+
onDiscardRef.current = onDiscard;
|
|
45
|
+
onSaveRef.current = onSave;
|
|
46
|
+
}, [isDirtyGetter, onDiscard, onSave]);
|
|
47
|
+
const handleDiscard = useCallback(() => {
|
|
48
|
+
if (!activeWindowId) return;
|
|
49
|
+
onDiscardRef.current?.();
|
|
50
|
+
closeWindow(activeWindowId);
|
|
51
|
+
}, [activeWindowId, closeWindow]);
|
|
52
|
+
const handleSave = useCallback(() => {
|
|
53
|
+
if (!activeWindowId) return;
|
|
54
|
+
onSaveRef.current?.();
|
|
55
|
+
closeWindow(activeWindowId);
|
|
56
|
+
}, [activeWindowId, closeWindow]);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (!activeWindowId) return;
|
|
59
|
+
isActiveRef.current = true;
|
|
60
|
+
const closeInterceptor = () => {
|
|
61
|
+
if (!isActiveRef.current) return true;
|
|
62
|
+
const isDirty = isDirtyGetterRef.current();
|
|
63
|
+
if (isDirty) {
|
|
64
|
+
openModal(activeWindowId, handleSave, handleDiscard);
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
};
|
|
69
|
+
registerCloseInterceptor(activeWindowId, closeInterceptor);
|
|
70
|
+
return () => {
|
|
71
|
+
isActiveRef.current = false;
|
|
72
|
+
unregisterCloseInterceptor(activeWindowId);
|
|
73
|
+
};
|
|
74
|
+
}, [activeWindowId, openModal, handleSave, handleDiscard]);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { getCloseInterceptor, registerCloseInterceptor, unregisterCloseInterceptor, useCloseInterceptor, useCloseModalStore };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { appendDirtyIndicator } from './chunk-YAIWI4Z5.js';
|
|
2
|
+
import { AppMenuBar_default } from './chunk-4E45FBAH.js';
|
|
3
|
+
import { useIsDirty } from './chunk-FH4ILMKF.js';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
var useNotesMenuBarElements = (options) => {
|
|
9
|
+
const { windowId, contentData, onExit } = options;
|
|
10
|
+
const { t } = useTranslation("common");
|
|
11
|
+
const isDirty = useIsDirty(windowId);
|
|
12
|
+
const actions = contentData?.actions;
|
|
13
|
+
const setPickerOpen = contentData?.setPickerOpen;
|
|
14
|
+
return useMemo(() => {
|
|
15
|
+
const items = [
|
|
16
|
+
{
|
|
17
|
+
type: "menu",
|
|
18
|
+
label: t("menu.file"),
|
|
19
|
+
items: [
|
|
20
|
+
{
|
|
21
|
+
type: "item",
|
|
22
|
+
label: t("actions.new"),
|
|
23
|
+
icon: "FcEditImage",
|
|
24
|
+
onClick: () => actions?.new?.()
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: "item",
|
|
28
|
+
label: t("actions.open"),
|
|
29
|
+
icon: "FcOpenedFolder",
|
|
30
|
+
onClick: () => setPickerOpen?.()
|
|
31
|
+
},
|
|
32
|
+
{ type: "divider" },
|
|
33
|
+
{
|
|
34
|
+
type: "item",
|
|
35
|
+
label: t("actions.save"),
|
|
36
|
+
icon: "FcInspection",
|
|
37
|
+
onClick: () => actions?.save?.(),
|
|
38
|
+
disabled: !isDirty
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: "item",
|
|
42
|
+
label: t("actions.saveAs"),
|
|
43
|
+
icon: "FcDeployment",
|
|
44
|
+
onClick: () => actions?.saveAs?.()
|
|
45
|
+
},
|
|
46
|
+
{ type: "divider" },
|
|
47
|
+
{
|
|
48
|
+
type: "item",
|
|
49
|
+
label: t("actions.exit"),
|
|
50
|
+
icon: "FcLeft",
|
|
51
|
+
onClick: onExit
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
];
|
|
56
|
+
return appendDirtyIndicator(items, isDirty);
|
|
57
|
+
}, [t, actions, setPickerOpen, isDirty, onExit]);
|
|
58
|
+
};
|
|
59
|
+
var NotesMenuBar = ({ windowId, contentData, onExit }) => {
|
|
60
|
+
const elements = useNotesMenuBarElements({
|
|
61
|
+
windowId,
|
|
62
|
+
contentData,
|
|
63
|
+
onExit
|
|
64
|
+
});
|
|
65
|
+
return /* @__PURE__ */ jsx(AppMenuBar_default, { elements });
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export { NotesMenuBar };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkRDIDAZ3S_cjs = require('./chunk-RDIDAZ3S.cjs');
|
|
4
|
+
var chunkSBE4SZAN_cjs = require('./chunk-SBE4SZAN.cjs');
|
|
5
|
+
var chunkYP2PLNOF_cjs = require('./chunk-YP2PLNOF.cjs');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
var reactI18next = require('react-i18next');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
|
|
10
|
+
var useSettingsMenuBarElements = (options) => {
|
|
11
|
+
const { windowId, contentData, onExit } = options;
|
|
12
|
+
const { t } = reactI18next.useTranslation("common");
|
|
13
|
+
const isDirty = chunkYP2PLNOF_cjs.useIsDirty(windowId);
|
|
14
|
+
const discard = contentData?.discard;
|
|
15
|
+
return react.useMemo(() => {
|
|
16
|
+
const items = [
|
|
17
|
+
{
|
|
18
|
+
type: "menu",
|
|
19
|
+
label: t("menu.file"),
|
|
20
|
+
items: [
|
|
21
|
+
{
|
|
22
|
+
type: "item",
|
|
23
|
+
label: t("actions.discard"),
|
|
24
|
+
icon: "FcCancel",
|
|
25
|
+
onClick: () => discard?.(),
|
|
26
|
+
disabled: !isDirty
|
|
27
|
+
},
|
|
28
|
+
{ type: "divider" },
|
|
29
|
+
{
|
|
30
|
+
type: "item",
|
|
31
|
+
label: t("actions.exit"),
|
|
32
|
+
icon: "FcLeft",
|
|
33
|
+
onClick: onExit
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
return chunkRDIDAZ3S_cjs.appendDirtyIndicator(items, isDirty);
|
|
39
|
+
}, [t, isDirty, discard, onExit]);
|
|
40
|
+
};
|
|
41
|
+
var SettingsMenuBar = ({ windowId, contentData, onExit }) => {
|
|
42
|
+
const elements = useSettingsMenuBarElements({
|
|
43
|
+
windowId,
|
|
44
|
+
contentData,
|
|
45
|
+
onExit
|
|
46
|
+
});
|
|
47
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkSBE4SZAN_cjs.AppMenuBar_default, { elements });
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
exports.SettingsMenuBar = SettingsMenuBar;
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { useAdaptiveDimensions } from './chunk-ZHB5Q2M6.js';
|
|
2
|
+
import { useDesktopStore, APPS } from './chunk-NWMSWRUD.js';
|
|
3
|
+
import { lazy, useCallback } from 'react';
|
|
4
|
+
|
|
5
|
+
// src/constants/Animations.ts
|
|
6
|
+
var ANIMATION_DURATION = 0.3;
|
|
7
|
+
var createEaseIn = (duration) => ({
|
|
8
|
+
duration,
|
|
9
|
+
ease: "easeIn"
|
|
10
|
+
});
|
|
11
|
+
var createEaseOut = (duration) => ({
|
|
12
|
+
duration,
|
|
13
|
+
ease: "easeOut"
|
|
14
|
+
});
|
|
15
|
+
var createWindowVariants = (duration) => ({
|
|
16
|
+
hidden: { opacity: 0, scale: 0.92, y: 12 },
|
|
17
|
+
visible: { opacity: 1, scale: 1, y: 0, transition: createEaseOut(duration) },
|
|
18
|
+
exit: { opacity: 0, scale: 0.92, y: 12, transition: createEaseIn(duration) }
|
|
19
|
+
});
|
|
20
|
+
var createPanelVariants = (duration) => ({
|
|
21
|
+
initial: { opacity: 0, y: 8, scale: 0.96 },
|
|
22
|
+
animate: { opacity: 1, y: 0, scale: 1, transition: createEaseOut(duration) },
|
|
23
|
+
exit: { opacity: 0, y: 8, scale: 0.96, transition: createEaseIn(duration) }
|
|
24
|
+
});
|
|
25
|
+
var createMinimizeVariant = (duration) => (deltaX, deltaY) => ({
|
|
26
|
+
opacity: 0,
|
|
27
|
+
scale: 0.1,
|
|
28
|
+
x: deltaX,
|
|
29
|
+
y: deltaY,
|
|
30
|
+
transition: { duration, ease: [0.4, 0, 1, 1] }
|
|
31
|
+
});
|
|
32
|
+
var createRestoreVariant = (duration) => (deltaX, deltaY) => ({
|
|
33
|
+
opacity: [0, 1],
|
|
34
|
+
scale: [0.1, 1],
|
|
35
|
+
x: [deltaX, 0],
|
|
36
|
+
y: [deltaY, 0],
|
|
37
|
+
transition: { duration, ease: [0, 0, 0.2, 1] }
|
|
38
|
+
});
|
|
39
|
+
var createMaximizeTransition = (duration) => ({
|
|
40
|
+
duration,
|
|
41
|
+
ease: "easeOut"
|
|
42
|
+
});
|
|
43
|
+
var EASE_IN = { duration: ANIMATION_DURATION, ease: "easeIn" };
|
|
44
|
+
var EASE_OUT = { duration: ANIMATION_DURATION, ease: "easeOut" };
|
|
45
|
+
var windowVariants = createWindowVariants(ANIMATION_DURATION);
|
|
46
|
+
var panelVariants = createPanelVariants(ANIMATION_DURATION);
|
|
47
|
+
var minimizeVariant = createMinimizeVariant(0.3);
|
|
48
|
+
var restoreVariant = createRestoreVariant(0.3);
|
|
49
|
+
var openVariants = {
|
|
50
|
+
scale: {
|
|
51
|
+
hidden: { opacity: 0, scale: 0.92, y: 12 },
|
|
52
|
+
visible: { opacity: 1, scale: 1, y: 0, transition: EASE_OUT }
|
|
53
|
+
},
|
|
54
|
+
slide: {
|
|
55
|
+
hidden: { opacity: 0, y: 40 },
|
|
56
|
+
visible: { opacity: 1, y: 0, transition: EASE_OUT }
|
|
57
|
+
},
|
|
58
|
+
fade: {
|
|
59
|
+
hidden: { opacity: 0 },
|
|
60
|
+
visible: { opacity: 1, transition: EASE_OUT }
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var maximizeTransition = { duration: 0.25, ease: "easeOut" };
|
|
64
|
+
var randomWindowPosition = () => ({
|
|
65
|
+
x: 150 + Math.random() * 200,
|
|
66
|
+
y: 80 + Math.random() * 100
|
|
67
|
+
});
|
|
68
|
+
var centerWindowPosition = (viewportWidth, viewportHeight, windowWidth, windowHeight) => ({
|
|
69
|
+
x: Math.round((viewportWidth - windowWidth) / 2),
|
|
70
|
+
y: Math.round((viewportHeight - windowHeight) / 2)
|
|
71
|
+
});
|
|
72
|
+
var FilesAppLazy = lazy(() => import('./FilesApp-AKCVRTXR.js'));
|
|
73
|
+
var NotesAppLazy = lazy(() => import('./NotesApp-37BV33C6.js'));
|
|
74
|
+
var ImageViewerAppLazy = lazy(() => import('./ImageViewerApp-5UXNSW2O.js'));
|
|
75
|
+
var PdfAppLazy = lazy(() => import('./PdfApp-RH6MZZX5.js'));
|
|
76
|
+
var MenuEditAppLazy = lazy(() => import('./MenuEditApp-HUZRFEHE.js'));
|
|
77
|
+
var UploaderAppLazy = lazy(() => import('./UploaderApp-2WYRCUQV.js'));
|
|
78
|
+
var SettingsAppLazy = lazy(() => import('./SettingsApp-X6764D7T.js'));
|
|
79
|
+
var DeviceInfoAppLazy = lazy(() => import('./DeviceInfoApp-YHCYAO6N.js'));
|
|
80
|
+
var CalendarAppLazy = lazy(() => import('./CalendarApp-K7ZOUZ6C.js'));
|
|
81
|
+
var CreateItemAppLazy = lazy(() => import('./CreateItemApp-ZHCTSPQE.js'));
|
|
82
|
+
var NotesMenuBarLazy = lazy(
|
|
83
|
+
() => import('./NotesMenuBar-SRV3AIAL.js').then((m) => ({ default: m.NotesMenuBar }))
|
|
84
|
+
);
|
|
85
|
+
var MenuEditMenuBarLazy = lazy(
|
|
86
|
+
() => import('./MenuEditMenuBar-IUXFPZE5.js').then((m) => ({ default: m.MenuEditMenuBar }))
|
|
87
|
+
);
|
|
88
|
+
var SettingsMenuBarLazy = lazy(
|
|
89
|
+
() => import('./SettingsMenuBar-VLT6TTCM.js').then((m) => ({ default: m.SettingsMenuBar }))
|
|
90
|
+
);
|
|
91
|
+
var PdfMenuBarLazy = lazy(
|
|
92
|
+
() => import('./PdfMenuBar-NLZC6JHS.js').then((m) => ({ default: m.PdfMenuBar }))
|
|
93
|
+
);
|
|
94
|
+
var ImageViewerMenuBarLazy = lazy(
|
|
95
|
+
() => import('./ImageViewerMenuBar-TV5C6TM2.js').then((m) => ({
|
|
96
|
+
default: m.ImageViewerMenuBar
|
|
97
|
+
}))
|
|
98
|
+
);
|
|
99
|
+
var TerminalAppLazy = lazy(() => import('./TerminalApp-GCKJCM55.js'));
|
|
100
|
+
var TerminalMenuBarLazy = lazy(
|
|
101
|
+
() => import('./TerminalMenuBar-7JAEQUZ4.js').then((m) => ({ default: m.TerminalMenuBar }))
|
|
102
|
+
);
|
|
103
|
+
var CodeServerAppLazy = lazy(() => import('./CodeServerApp-LUZFCQBI.js'));
|
|
104
|
+
var StorybookAppLazy = lazy(() => import('./StorybookApp-NZDV4X3Y.js'));
|
|
105
|
+
|
|
106
|
+
// src/components/Window/helperRegistry.ts
|
|
107
|
+
var _registry = null;
|
|
108
|
+
var NULL_COMPONENT = (() => null);
|
|
109
|
+
function resolveEntry(entry) {
|
|
110
|
+
return {
|
|
111
|
+
...entry,
|
|
112
|
+
component: entry.component ?? (entry.loader ? lazy(entry.loader) : void 0),
|
|
113
|
+
MenuBarComponent: entry.MenuBarComponent ?? (entry.menuBarLoader ? lazy(entry.menuBarLoader) : void 0)
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function initRegistry(registry) {
|
|
117
|
+
_registry = {};
|
|
118
|
+
for (const [key, entry] of Object.entries(registry)) {
|
|
119
|
+
_registry[key] = resolveEntry(entry);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function getAppComponent(content) {
|
|
123
|
+
if (!_registry) {
|
|
124
|
+
console.warn(`[AppRegistry] Registry not initialized, requested app: ${content}`);
|
|
125
|
+
return NULL_COMPONENT;
|
|
126
|
+
}
|
|
127
|
+
const component = _registry[content]?.component;
|
|
128
|
+
if (!component) {
|
|
129
|
+
console.warn(`[AppRegistry] App not found: ${content}`);
|
|
130
|
+
return NULL_COMPONENT;
|
|
131
|
+
}
|
|
132
|
+
return component;
|
|
133
|
+
}
|
|
134
|
+
function getMenuBarBuilder(content) {
|
|
135
|
+
return _registry?.[content]?.buildMenuBar;
|
|
136
|
+
}
|
|
137
|
+
function getMenuBarComponent(content) {
|
|
138
|
+
return _registry?.[content]?.MenuBarComponent;
|
|
139
|
+
}
|
|
140
|
+
function isLazyApp(content) {
|
|
141
|
+
return _registry?.[content]?.isLazy ?? false;
|
|
142
|
+
}
|
|
143
|
+
function getAppName(content) {
|
|
144
|
+
return _registry?.[content]?.appName;
|
|
145
|
+
}
|
|
146
|
+
function getRegistryEntry(content) {
|
|
147
|
+
return _registry?.[content];
|
|
148
|
+
}
|
|
149
|
+
function registerComponents(entries) {
|
|
150
|
+
if (!_registry) _registry = {};
|
|
151
|
+
for (const [key, entry] of Object.entries(entries)) {
|
|
152
|
+
_registry[key] = resolveEntry(entry);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
var CORE_REGISTRY = {};
|
|
156
|
+
function initCoreRegistry() {
|
|
157
|
+
const entries = {
|
|
158
|
+
files: {
|
|
159
|
+
component: FilesAppLazy,
|
|
160
|
+
appName: "Files",
|
|
161
|
+
isLazy: true
|
|
162
|
+
},
|
|
163
|
+
settings: {
|
|
164
|
+
component: SettingsAppLazy,
|
|
165
|
+
MenuBarComponent: SettingsMenuBarLazy,
|
|
166
|
+
appName: "Settings",
|
|
167
|
+
isLazy: true
|
|
168
|
+
},
|
|
169
|
+
pdf: {
|
|
170
|
+
component: PdfAppLazy,
|
|
171
|
+
MenuBarComponent: PdfMenuBarLazy,
|
|
172
|
+
appName: "PDF",
|
|
173
|
+
isLazy: true
|
|
174
|
+
},
|
|
175
|
+
"image-viewer": {
|
|
176
|
+
component: ImageViewerAppLazy,
|
|
177
|
+
MenuBarComponent: ImageViewerMenuBarLazy,
|
|
178
|
+
appName: "Image Viewer",
|
|
179
|
+
isLazy: true
|
|
180
|
+
},
|
|
181
|
+
uploader: {
|
|
182
|
+
component: UploaderAppLazy,
|
|
183
|
+
appName: "Uploader",
|
|
184
|
+
isLazy: true
|
|
185
|
+
},
|
|
186
|
+
createItem: {
|
|
187
|
+
component: CreateItemAppLazy,
|
|
188
|
+
appName: "Create Item",
|
|
189
|
+
isLazy: true
|
|
190
|
+
},
|
|
191
|
+
"device-info": {
|
|
192
|
+
component: DeviceInfoAppLazy,
|
|
193
|
+
appName: "Device Info",
|
|
194
|
+
isLazy: true
|
|
195
|
+
},
|
|
196
|
+
menuedit: {
|
|
197
|
+
component: MenuEditAppLazy,
|
|
198
|
+
MenuBarComponent: MenuEditMenuBarLazy,
|
|
199
|
+
appName: "Menu Editor",
|
|
200
|
+
isLazy: true
|
|
201
|
+
},
|
|
202
|
+
notepad: {
|
|
203
|
+
component: NotesAppLazy,
|
|
204
|
+
MenuBarComponent: NotesMenuBarLazy,
|
|
205
|
+
appName: "Notepad",
|
|
206
|
+
isLazy: true
|
|
207
|
+
},
|
|
208
|
+
calendar: {
|
|
209
|
+
component: CalendarAppLazy,
|
|
210
|
+
appName: "Calendar",
|
|
211
|
+
isLazy: true
|
|
212
|
+
},
|
|
213
|
+
terminal: {
|
|
214
|
+
component: TerminalAppLazy,
|
|
215
|
+
MenuBarComponent: TerminalMenuBarLazy,
|
|
216
|
+
appName: "Terminal",
|
|
217
|
+
isLazy: true
|
|
218
|
+
},
|
|
219
|
+
"code-server": {
|
|
220
|
+
component: CodeServerAppLazy,
|
|
221
|
+
appName: "VS Code",
|
|
222
|
+
isLazy: true
|
|
223
|
+
},
|
|
224
|
+
storybook: {
|
|
225
|
+
component: StorybookAppLazy,
|
|
226
|
+
appName: "Storybook",
|
|
227
|
+
isLazy: true
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
Object.assign(CORE_REGISTRY, entries);
|
|
231
|
+
registerComponents(entries);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// src/hooks/useOpenApp.ts
|
|
235
|
+
var useOpenApp = () => {
|
|
236
|
+
const openWindow = useDesktopStore((state) => state.openWindow);
|
|
237
|
+
const focusWindow = useDesktopStore((state) => state.focusWindow);
|
|
238
|
+
const windows = useDesktopStore((state) => state.windows);
|
|
239
|
+
const customApps = useDesktopStore((state) => state.customApps);
|
|
240
|
+
const adaptiveDimensions = useAdaptiveDimensions();
|
|
241
|
+
return useCallback(
|
|
242
|
+
(appId, { contentData, position } = {}) => {
|
|
243
|
+
const app = APPS.find((a) => a.id === appId);
|
|
244
|
+
const customApp = customApps.find((a) => a.id === appId);
|
|
245
|
+
const registryEntry = getRegistryEntry(appId);
|
|
246
|
+
const isSingleWindow = app?.singleWindow === true || customApp?.window?.singleWindow === true || registryEntry?.singleWindow === true;
|
|
247
|
+
if (isSingleWindow) {
|
|
248
|
+
const existingWindow = windows.find((w) => w.content === appId);
|
|
249
|
+
if (existingWindow) {
|
|
250
|
+
focusWindow(existingWindow.id);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
const { x, y } = position ?? randomWindowPosition();
|
|
255
|
+
openWindow({
|
|
256
|
+
title: app?.name ?? registryEntry?.appName ?? customApp?.name ?? appId.charAt(0).toUpperCase() + appId.slice(1),
|
|
257
|
+
content: appId,
|
|
258
|
+
icon: app?.icon ?? registryEntry?.icon ?? customApp?.icon,
|
|
259
|
+
fcIcon: app?.fcIcon ?? registryEntry?.fcIcon,
|
|
260
|
+
iconUrl: app?.iconUrl ?? registryEntry?.iconUrl,
|
|
261
|
+
iconColor: app?.iconColor ?? registryEntry?.iconColor,
|
|
262
|
+
canMaximize: app?.canMaximize ?? registryEntry?.canMaximize ?? customApp?.window?.canMaximize,
|
|
263
|
+
x,
|
|
264
|
+
y,
|
|
265
|
+
width: app?.defaultWidth ?? registryEntry?.defaultWidth ?? customApp?.window?.defaultWidth ?? adaptiveDimensions.defaultWidth,
|
|
266
|
+
height: app?.defaultHeight ?? registryEntry?.defaultHeight ?? customApp?.window?.defaultHeight ?? adaptiveDimensions.defaultHeight,
|
|
267
|
+
minWidth: app?.minWidth === false || registryEntry?.minWidth === false || customApp?.window?.minWidth === false ? void 0 : app?.minWidth ?? registryEntry?.minWidth ?? customApp?.window?.minWidth ?? adaptiveDimensions.minWidth,
|
|
268
|
+
minHeight: app?.minHeight === false || registryEntry?.minHeight === false || customApp?.window?.minHeight === false ? void 0 : app?.minHeight ?? registryEntry?.minHeight ?? customApp?.window?.minHeight ?? adaptiveDimensions.minHeight,
|
|
269
|
+
contentData: {
|
|
270
|
+
...contentData,
|
|
271
|
+
...app?.autoLoad ? { autoLoad: app.autoLoad } : {}
|
|
272
|
+
},
|
|
273
|
+
alwaysOnTop: app?.alwaysOnTop ?? registryEntry?.alwaysOnTop
|
|
274
|
+
});
|
|
275
|
+
},
|
|
276
|
+
[openWindow, focusWindow, windows, customApps, adaptiveDimensions]
|
|
277
|
+
);
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
export { ANIMATION_DURATION, CORE_REGISTRY, CalendarAppLazy, CreateItemAppLazy, DeviceInfoAppLazy, EASE_IN, EASE_OUT, FilesAppLazy, ImageViewerAppLazy, ImageViewerMenuBarLazy, MenuEditAppLazy, MenuEditMenuBarLazy, NotesAppLazy, NotesMenuBarLazy, PdfAppLazy, PdfMenuBarLazy, SettingsAppLazy, SettingsMenuBarLazy, UploaderAppLazy, centerWindowPosition, createEaseIn, createEaseOut, createMaximizeTransition, createMinimizeVariant, createPanelVariants, createRestoreVariant, createWindowVariants, getAppComponent, getAppName, getMenuBarBuilder, getMenuBarComponent, initCoreRegistry, initRegistry, isLazyApp, maximizeTransition, minimizeVariant, openVariants, panelVariants, randomWindowPosition, registerComponents, restoreVariant, useOpenApp, windowVariants };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkRDIDAZ3S_cjs = require('./chunk-RDIDAZ3S.cjs');
|
|
4
|
+
var chunkSBE4SZAN_cjs = require('./chunk-SBE4SZAN.cjs');
|
|
5
|
+
var chunkRQ6OZRUW_cjs = require('./chunk-RQ6OZRUW.cjs');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
var reactI18next = require('react-i18next');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
|
|
10
|
+
var useNotesMenuBarElements = (options) => {
|
|
11
|
+
const { windowId, contentData, onExit } = options;
|
|
12
|
+
const { t } = reactI18next.useTranslation("common");
|
|
13
|
+
const isDirty = chunkRQ6OZRUW_cjs.useIsDirty(windowId);
|
|
14
|
+
const actions = contentData?.actions;
|
|
15
|
+
const setPickerOpen = contentData?.setPickerOpen;
|
|
16
|
+
return react.useMemo(() => {
|
|
17
|
+
const items = [
|
|
18
|
+
{
|
|
19
|
+
type: "menu",
|
|
20
|
+
label: t("menu.file"),
|
|
21
|
+
items: [
|
|
22
|
+
{
|
|
23
|
+
type: "item",
|
|
24
|
+
label: t("actions.new"),
|
|
25
|
+
icon: "FcEditImage",
|
|
26
|
+
onClick: () => actions?.new?.()
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
type: "item",
|
|
30
|
+
label: t("actions.open"),
|
|
31
|
+
icon: "FcOpenedFolder",
|
|
32
|
+
onClick: () => setPickerOpen?.()
|
|
33
|
+
},
|
|
34
|
+
{ type: "divider" },
|
|
35
|
+
{
|
|
36
|
+
type: "item",
|
|
37
|
+
label: t("actions.save"),
|
|
38
|
+
icon: "FcInspection",
|
|
39
|
+
onClick: () => actions?.save?.(),
|
|
40
|
+
disabled: !isDirty
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: "item",
|
|
44
|
+
label: t("actions.saveAs"),
|
|
45
|
+
icon: "FcDeployment",
|
|
46
|
+
onClick: () => actions?.saveAs?.()
|
|
47
|
+
},
|
|
48
|
+
{ type: "divider" },
|
|
49
|
+
{
|
|
50
|
+
type: "item",
|
|
51
|
+
label: t("actions.exit"),
|
|
52
|
+
icon: "FcLeft",
|
|
53
|
+
onClick: onExit
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
return chunkRDIDAZ3S_cjs.appendDirtyIndicator(items, isDirty);
|
|
59
|
+
}, [t, actions, setPickerOpen, isDirty, onExit]);
|
|
60
|
+
};
|
|
61
|
+
var NotesMenuBar = ({ windowId, contentData, onExit }) => {
|
|
62
|
+
const elements = useNotesMenuBarElements({
|
|
63
|
+
windowId,
|
|
64
|
+
contentData,
|
|
65
|
+
onExit
|
|
66
|
+
});
|
|
67
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkSBE4SZAN_cjs.AppMenuBar_default, { elements });
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
exports.NotesMenuBar = NotesMenuBar;
|