ssovee-os-web-ui 0.1.106 → 0.1.108
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/dist/index.cjs +149 -96
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +6 -4
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +77 -26
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React24 = require('react');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var react = require('@phosphor-icons/react');
|
|
6
6
|
var Editor = require('@monaco-editor/react');
|
|
7
7
|
var react$1 = require('@tiptap/react');
|
|
8
8
|
var StarterKit = require('@tiptap/starter-kit');
|
|
9
9
|
var uaParserJs = require('ua-parser-js');
|
|
10
|
+
var reactPdf = require('react-pdf');
|
|
11
|
+
require('react-pdf/dist/Page/TextLayer.css');
|
|
12
|
+
require('react-pdf/dist/Page/AnnotationLayer.css');
|
|
10
13
|
|
|
14
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
11
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
16
|
|
|
13
17
|
function _interopNamespace(e) {
|
|
@@ -28,7 +32,7 @@ function _interopNamespace(e) {
|
|
|
28
32
|
return Object.freeze(n);
|
|
29
33
|
}
|
|
30
34
|
|
|
31
|
-
var
|
|
35
|
+
var React24__namespace = /*#__PURE__*/_interopNamespace(React24);
|
|
32
36
|
var Editor__default = /*#__PURE__*/_interopDefault(Editor);
|
|
33
37
|
var StarterKit__default = /*#__PURE__*/_interopDefault(StarterKit);
|
|
34
38
|
|
|
@@ -38,7 +42,7 @@ var StarterKit__default = /*#__PURE__*/_interopDefault(StarterKit);
|
|
|
38
42
|
function cn(...inputs) {
|
|
39
43
|
return inputs.filter(Boolean).join(" ");
|
|
40
44
|
}
|
|
41
|
-
var Button =
|
|
45
|
+
var Button = React24__namespace.default.forwardRef(
|
|
42
46
|
({
|
|
43
47
|
className,
|
|
44
48
|
variant = "primary",
|
|
@@ -174,7 +178,7 @@ var Typography = ({
|
|
|
174
178
|
return /* @__PURE__ */ jsxRuntime.jsx(Component, { className: classes, children });
|
|
175
179
|
};
|
|
176
180
|
var Typography_default = Typography;
|
|
177
|
-
var Input =
|
|
181
|
+
var Input = React24__namespace.default.forwardRef(
|
|
178
182
|
({
|
|
179
183
|
className,
|
|
180
184
|
variant = "default",
|
|
@@ -252,7 +256,7 @@ var Input = React23__namespace.default.forwardRef(
|
|
|
252
256
|
);
|
|
253
257
|
Input.displayName = "Input";
|
|
254
258
|
var Input_default = Input;
|
|
255
|
-
var TextArea =
|
|
259
|
+
var TextArea = React24__namespace.default.forwardRef(
|
|
256
260
|
({
|
|
257
261
|
className,
|
|
258
262
|
variant = "default",
|
|
@@ -318,7 +322,7 @@ var CodeEditor = ({
|
|
|
318
322
|
className,
|
|
319
323
|
isDarkTheme
|
|
320
324
|
}) => {
|
|
321
|
-
const editorTheme =
|
|
325
|
+
const editorTheme = React24.useMemo(() => {
|
|
322
326
|
if (typeof isDarkTheme === "undefined") return "light";
|
|
323
327
|
const isDark = Boolean(isDarkTheme);
|
|
324
328
|
return isDark ? "vs-dark" : "light";
|
|
@@ -337,7 +341,7 @@ var CodeEditor = ({
|
|
|
337
341
|
};
|
|
338
342
|
var CodeEditor_default = CodeEditor;
|
|
339
343
|
var RichEditor = ({ content, onChange, isDarkTheme }) => {
|
|
340
|
-
const onChangeRef =
|
|
344
|
+
const onChangeRef = React24.useRef(onChange);
|
|
341
345
|
onChangeRef.current = onChange;
|
|
342
346
|
const editorTheme = isDarkTheme ? "vs-dark" : "light";
|
|
343
347
|
const editor = react$1.useEditor({
|
|
@@ -348,7 +352,7 @@ var RichEditor = ({ content, onChange, isDarkTheme }) => {
|
|
|
348
352
|
onChangeRef.current(updatedEditor.getHTML());
|
|
349
353
|
}
|
|
350
354
|
}, []);
|
|
351
|
-
|
|
355
|
+
React24.useEffect(() => {
|
|
352
356
|
if (editor && content !== editor.getHTML()) {
|
|
353
357
|
editor.commands.setContent(content, { emitUpdate: false });
|
|
354
358
|
}
|
|
@@ -391,7 +395,7 @@ var RichEditor = ({ content, onChange, isDarkTheme }) => {
|
|
|
391
395
|
] });
|
|
392
396
|
};
|
|
393
397
|
var RichEditor_default = RichEditor;
|
|
394
|
-
var Select =
|
|
398
|
+
var Select = React24__namespace.default.forwardRef(
|
|
395
399
|
({
|
|
396
400
|
className,
|
|
397
401
|
options,
|
|
@@ -471,7 +475,7 @@ var Select = React23__namespace.default.forwardRef(
|
|
|
471
475
|
);
|
|
472
476
|
Select.displayName = "Select";
|
|
473
477
|
var Select_default = Select;
|
|
474
|
-
var Checkbox =
|
|
478
|
+
var Checkbox = React24__namespace.default.forwardRef(
|
|
475
479
|
({
|
|
476
480
|
className,
|
|
477
481
|
variant = "default",
|
|
@@ -546,7 +550,7 @@ var Checkbox = React23__namespace.default.forwardRef(
|
|
|
546
550
|
);
|
|
547
551
|
Checkbox.displayName = "Checkbox";
|
|
548
552
|
var Checkbox_default = Checkbox;
|
|
549
|
-
var Toggle =
|
|
553
|
+
var Toggle = React24__namespace.default.forwardRef(
|
|
550
554
|
({
|
|
551
555
|
checked,
|
|
552
556
|
onChange,
|
|
@@ -652,10 +656,10 @@ var Dropdown = ({
|
|
|
652
656
|
className,
|
|
653
657
|
trigger
|
|
654
658
|
}) => {
|
|
655
|
-
const [isOpen, setIsOpen] =
|
|
656
|
-
const dropdownRef =
|
|
659
|
+
const [isOpen, setIsOpen] = React24.useState(false);
|
|
660
|
+
const dropdownRef = React24.useRef(null);
|
|
657
661
|
const selectedOption = options.find((option) => option.value === value);
|
|
658
|
-
|
|
662
|
+
React24.useEffect(() => {
|
|
659
663
|
const handleClickOutside = (event) => {
|
|
660
664
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
661
665
|
setIsOpen(false);
|
|
@@ -782,9 +786,9 @@ var ImageWithPlaceholder = ({
|
|
|
782
786
|
};
|
|
783
787
|
const resolvedSrc = resolveSrc(src);
|
|
784
788
|
const initialSrc = isValidSrc(resolvedSrc) ? resolvedSrc : fallbackSrc;
|
|
785
|
-
const [imgSrc, setImgSrc] =
|
|
786
|
-
const [hasError, setHasError] =
|
|
787
|
-
|
|
789
|
+
const [imgSrc, setImgSrc] = React24.useState(initialSrc);
|
|
790
|
+
const [hasError, setHasError] = React24.useState(!isValidSrc(resolvedSrc));
|
|
791
|
+
React24.useEffect(() => {
|
|
788
792
|
const nextResolvedSrc = resolveSrc(src);
|
|
789
793
|
if (isValidSrc(nextResolvedSrc)) {
|
|
790
794
|
setImgSrc(nextResolvedSrc);
|
|
@@ -993,8 +997,8 @@ var Toast = ({
|
|
|
993
997
|
showCloseButton = true,
|
|
994
998
|
className
|
|
995
999
|
}) => {
|
|
996
|
-
const [isShowing, setIsShowing] =
|
|
997
|
-
|
|
1000
|
+
const [isShowing, setIsShowing] = React24.useState(false);
|
|
1001
|
+
React24.useEffect(() => {
|
|
998
1002
|
if (isVisible) {
|
|
999
1003
|
setIsShowing(true);
|
|
1000
1004
|
let timer = null;
|
|
@@ -1218,7 +1222,7 @@ var Modal = ({
|
|
|
1218
1222
|
closeOnEscape = true,
|
|
1219
1223
|
className
|
|
1220
1224
|
}) => {
|
|
1221
|
-
|
|
1225
|
+
React24.useEffect(() => {
|
|
1222
1226
|
if (!isOpen) return;
|
|
1223
1227
|
const handleEscape = (e) => {
|
|
1224
1228
|
if (e.key === "Escape" && closeOnEscape) {
|
|
@@ -1285,7 +1289,7 @@ var Modal = ({
|
|
|
1285
1289
|
);
|
|
1286
1290
|
};
|
|
1287
1291
|
var Modal_default = Modal;
|
|
1288
|
-
var Card =
|
|
1292
|
+
var Card = React24__namespace.default.forwardRef(
|
|
1289
1293
|
({
|
|
1290
1294
|
className,
|
|
1291
1295
|
variant = "default",
|
|
@@ -1323,7 +1327,7 @@ var Card = React23__namespace.default.forwardRef(
|
|
|
1323
1327
|
);
|
|
1324
1328
|
Card.displayName = "Card";
|
|
1325
1329
|
var Card_default = Card;
|
|
1326
|
-
var Badge =
|
|
1330
|
+
var Badge = React24__namespace.default.forwardRef(
|
|
1327
1331
|
({
|
|
1328
1332
|
className,
|
|
1329
1333
|
variant = "default",
|
|
@@ -1378,7 +1382,7 @@ var Avatar = ({
|
|
|
1378
1382
|
className,
|
|
1379
1383
|
onClick
|
|
1380
1384
|
}) => {
|
|
1381
|
-
const [imgError, setImgError] =
|
|
1385
|
+
const [imgError, setImgError] = React24.useState(false);
|
|
1382
1386
|
const sizeClasses = {
|
|
1383
1387
|
sm: "w-8 h-8 text-xs",
|
|
1384
1388
|
md: "w-10 h-10 text-sm",
|
|
@@ -1401,7 +1405,7 @@ var Avatar = ({
|
|
|
1401
1405
|
}
|
|
1402
1406
|
) }) });
|
|
1403
1407
|
};
|
|
1404
|
-
const handleImgError =
|
|
1408
|
+
const handleImgError = React24.useCallback(() => {
|
|
1405
1409
|
setImgError(true);
|
|
1406
1410
|
}, []);
|
|
1407
1411
|
const isSrcAvailable = typeof src === "string" && src.trim() !== "";
|
|
@@ -1473,8 +1477,8 @@ var Tooltip = ({
|
|
|
1473
1477
|
delay = 200,
|
|
1474
1478
|
className
|
|
1475
1479
|
}) => {
|
|
1476
|
-
const [isVisible, setIsVisible] =
|
|
1477
|
-
const [timeoutId, setTimeoutId] =
|
|
1480
|
+
const [isVisible, setIsVisible] = React24.useState(false);
|
|
1481
|
+
const [timeoutId, setTimeoutId] = React24.useState(null);
|
|
1478
1482
|
const showTooltip = () => {
|
|
1479
1483
|
const id = setTimeout(() => setIsVisible(true), delay);
|
|
1480
1484
|
setTimeoutId(id);
|
|
@@ -1604,14 +1608,14 @@ var matchShortcut = (event, shortcut, os) => {
|
|
|
1604
1608
|
var useShortcutFormatter = ({
|
|
1605
1609
|
globalKeyboardShortcuts: globalKeyboardShortcuts2 = []
|
|
1606
1610
|
} = {}) => {
|
|
1607
|
-
const [os, setOS] =
|
|
1608
|
-
const listenersRef =
|
|
1611
|
+
const [os, setOS] = React24.useState("windows");
|
|
1612
|
+
const listenersRef = React24.useRef(
|
|
1609
1613
|
/* @__PURE__ */ new Map()
|
|
1610
1614
|
);
|
|
1611
|
-
|
|
1615
|
+
React24.useEffect(() => {
|
|
1612
1616
|
setOS(detectOS());
|
|
1613
1617
|
}, []);
|
|
1614
|
-
|
|
1618
|
+
React24.useEffect(() => {
|
|
1615
1619
|
if (!globalKeyboardShortcuts2.length) return;
|
|
1616
1620
|
const handleKeyDown = (event) => {
|
|
1617
1621
|
for (const shortcut of globalKeyboardShortcuts2) {
|
|
@@ -1629,21 +1633,21 @@ var useShortcutFormatter = ({
|
|
|
1629
1633
|
window.removeEventListener("keydown", handleKeyDown);
|
|
1630
1634
|
};
|
|
1631
1635
|
}, [os, globalKeyboardShortcuts2]);
|
|
1632
|
-
const formatKeys =
|
|
1636
|
+
const formatKeys = React24.useCallback(
|
|
1633
1637
|
(keys = []) => {
|
|
1634
1638
|
const separator = os === "mac" ? "" : " + ";
|
|
1635
1639
|
return keys.map((key) => keyMap[os][key.toLowerCase()] || key.toUpperCase()).join(separator);
|
|
1636
1640
|
},
|
|
1637
1641
|
[os]
|
|
1638
1642
|
);
|
|
1639
|
-
const getShortcutByCommand =
|
|
1643
|
+
const getShortcutByCommand = React24.useCallback(
|
|
1640
1644
|
(command) => {
|
|
1641
1645
|
const found = globalKeyboardShortcuts2.find((s) => s.command === command);
|
|
1642
1646
|
return found ? found.shortcut : [];
|
|
1643
1647
|
},
|
|
1644
1648
|
[globalKeyboardShortcuts2]
|
|
1645
1649
|
);
|
|
1646
|
-
const addShortcutListener =
|
|
1650
|
+
const addShortcutListener = React24.useCallback(
|
|
1647
1651
|
(command, listener) => {
|
|
1648
1652
|
if (!listenersRef.current.has(command)) {
|
|
1649
1653
|
listenersRef.current.set(command, /* @__PURE__ */ new Set());
|
|
@@ -1652,7 +1656,7 @@ var useShortcutFormatter = ({
|
|
|
1652
1656
|
},
|
|
1653
1657
|
[]
|
|
1654
1658
|
);
|
|
1655
|
-
const removeShortcutListener =
|
|
1659
|
+
const removeShortcutListener = React24.useCallback(
|
|
1656
1660
|
(command, listener) => {
|
|
1657
1661
|
if (listenersRef.current.has(command)) {
|
|
1658
1662
|
listenersRef.current.get(command).delete(listener);
|
|
@@ -1692,7 +1696,7 @@ var globalKeyboardShortcuts = [
|
|
|
1692
1696
|
usage: "Focus on current app search"
|
|
1693
1697
|
}
|
|
1694
1698
|
];
|
|
1695
|
-
var SearchInput =
|
|
1699
|
+
var SearchInput = React24__namespace.default.forwardRef(
|
|
1696
1700
|
({
|
|
1697
1701
|
onSearch,
|
|
1698
1702
|
placeholder = "Search...",
|
|
@@ -1707,16 +1711,16 @@ var SearchInput = React23__namespace.default.forwardRef(
|
|
|
1707
1711
|
isActive = true,
|
|
1708
1712
|
...props
|
|
1709
1713
|
}, ref) => {
|
|
1710
|
-
const [searchValue, setSearchValue] =
|
|
1711
|
-
const inputRef =
|
|
1712
|
-
|
|
1714
|
+
const [searchValue, setSearchValue] = React24__namespace.default.useState(value || "");
|
|
1715
|
+
const inputRef = React24.useRef(null);
|
|
1716
|
+
React24.useImperativeHandle(ref, () => inputRef.current);
|
|
1713
1717
|
const {
|
|
1714
1718
|
addShortcutListener,
|
|
1715
1719
|
removeShortcutListener,
|
|
1716
1720
|
formatKeys,
|
|
1717
1721
|
getShortcutByCommand
|
|
1718
1722
|
} = useShortcutFormatter_default({ globalKeyboardShortcuts });
|
|
1719
|
-
|
|
1723
|
+
React24.useEffect(() => {
|
|
1720
1724
|
setSearchValue(value ?? "");
|
|
1721
1725
|
}, [value]);
|
|
1722
1726
|
const handleChange = (e) => {
|
|
@@ -1725,7 +1729,7 @@ var SearchInput = React23__namespace.default.forwardRef(
|
|
|
1725
1729
|
onChange?.(e);
|
|
1726
1730
|
onSearch?.(newValue);
|
|
1727
1731
|
};
|
|
1728
|
-
const handleClear =
|
|
1732
|
+
const handleClear = React24.useCallback(() => {
|
|
1729
1733
|
setSearchValue("");
|
|
1730
1734
|
onSearch?.("");
|
|
1731
1735
|
const syntheticEvent = {
|
|
@@ -1733,7 +1737,7 @@ var SearchInput = React23__namespace.default.forwardRef(
|
|
|
1733
1737
|
};
|
|
1734
1738
|
onChange?.(syntheticEvent);
|
|
1735
1739
|
}, [onChange, onSearch]);
|
|
1736
|
-
|
|
1740
|
+
React24.useEffect(() => {
|
|
1737
1741
|
if (!enableKeyboardShortcuts || !isActive) return;
|
|
1738
1742
|
const handleFocusSearch = (e) => {
|
|
1739
1743
|
e?.preventDefault();
|
|
@@ -1886,8 +1890,8 @@ var FileUpload = ({
|
|
|
1886
1890
|
children,
|
|
1887
1891
|
dragAndDrop = false
|
|
1888
1892
|
}) => {
|
|
1889
|
-
const fileInputRef =
|
|
1890
|
-
const [isDragOver, setIsDragOver] =
|
|
1893
|
+
const fileInputRef = React24.useRef(null);
|
|
1894
|
+
const [isDragOver, setIsDragOver] = React24__namespace.default.useState(false);
|
|
1891
1895
|
const handleFileSelect = (files) => {
|
|
1892
1896
|
if (!files) return;
|
|
1893
1897
|
const fileArray = Array.from(files);
|
|
@@ -2185,7 +2189,7 @@ var Pagination = ({
|
|
|
2185
2189
|
] });
|
|
2186
2190
|
};
|
|
2187
2191
|
var Pagination_default = Pagination;
|
|
2188
|
-
var Radio =
|
|
2192
|
+
var Radio = React24__namespace.default.forwardRef(
|
|
2189
2193
|
({
|
|
2190
2194
|
className,
|
|
2191
2195
|
label,
|
|
@@ -2250,7 +2254,7 @@ var Radio = React23__namespace.default.forwardRef(
|
|
|
2250
2254
|
Radio.displayName = "Radio";
|
|
2251
2255
|
var Radio_default = Radio;
|
|
2252
2256
|
var Accordion = ({ items, active = -1 }) => {
|
|
2253
|
-
const [activeIndex, setActiveIndex] =
|
|
2257
|
+
const [activeIndex, setActiveIndex] = React24.useState(active);
|
|
2254
2258
|
const toggleAccordion = (index) => {
|
|
2255
2259
|
setActiveIndex(activeIndex === index ? null : index);
|
|
2256
2260
|
};
|
|
@@ -2291,8 +2295,8 @@ var Tabs = ({
|
|
|
2291
2295
|
buttonClassName = "flex items-center gap-1 px-[8px] py-[2px] text-[13px] cursor-pointer transition-all duration-300 text-neutral-300 rounded-[6px] m-[8px]",
|
|
2292
2296
|
activeButtonClassName = "bg-surface-3 text-neutral-400"
|
|
2293
2297
|
}) => {
|
|
2294
|
-
const [activeTab, setActiveTab] =
|
|
2295
|
-
|
|
2298
|
+
const [activeTab, setActiveTab] = React24.useState(defaultActiveTab);
|
|
2299
|
+
React24.useEffect(() => {
|
|
2296
2300
|
setActiveTab(defaultActiveTab);
|
|
2297
2301
|
}, [defaultActiveTab]);
|
|
2298
2302
|
const handleTabClick = (index) => {
|
|
@@ -2318,6 +2322,54 @@ var Tabs = ({
|
|
|
2318
2322
|
] });
|
|
2319
2323
|
};
|
|
2320
2324
|
var Tabs_default = Tabs;
|
|
2325
|
+
reactPdf.pdfjs.GlobalWorkerOptions.workerSrc = new URL(
|
|
2326
|
+
"pdfjs-dist/build/pdf.worker.min.mjs",
|
|
2327
|
+
(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))
|
|
2328
|
+
).toString();
|
|
2329
|
+
var base64ToUint8Array = (base64) => {
|
|
2330
|
+
const value = base64.includes(",") ? base64.slice(base64.indexOf(",") + 1) : base64;
|
|
2331
|
+
const binary = atob(value);
|
|
2332
|
+
const bytes = new Uint8Array(binary.length);
|
|
2333
|
+
for (let index = 0; index < binary.length; index += 1) {
|
|
2334
|
+
bytes[index] = binary.charCodeAt(index);
|
|
2335
|
+
}
|
|
2336
|
+
return bytes;
|
|
2337
|
+
};
|
|
2338
|
+
var PdfPreview = ({ base64, fileName, className }) => {
|
|
2339
|
+
const [numPages, setNumPages] = React24.useState(0);
|
|
2340
|
+
const [error, setError] = React24.useState();
|
|
2341
|
+
const [pageWidth, setPageWidth] = React24.useState(900);
|
|
2342
|
+
React24.useEffect(() => {
|
|
2343
|
+
const updatePageWidth = () => setPageWidth(Math.min(900, Math.max(320, window.innerWidth - 48)));
|
|
2344
|
+
updatePageWidth();
|
|
2345
|
+
window.addEventListener("resize", updatePageWidth);
|
|
2346
|
+
return () => window.removeEventListener("resize", updatePageWidth);
|
|
2347
|
+
}, []);
|
|
2348
|
+
let pdfData;
|
|
2349
|
+
try {
|
|
2350
|
+
pdfData = base64ToUint8Array(base64);
|
|
2351
|
+
} catch {
|
|
2352
|
+
pdfData = new Uint8Array();
|
|
2353
|
+
}
|
|
2354
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("h-full min-h-96 w-full overflow-auto bg-muted/30", className), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2355
|
+
reactPdf.Document,
|
|
2356
|
+
{
|
|
2357
|
+
file: { data: pdfData },
|
|
2358
|
+
onLoadSuccess: ({ numPages: loadedPages }) => {
|
|
2359
|
+
setNumPages(loadedPages);
|
|
2360
|
+
setError(void 0);
|
|
2361
|
+
},
|
|
2362
|
+
onLoadError: (loadError) => {
|
|
2363
|
+
console.error("PDF preview error:", loadError);
|
|
2364
|
+
setError(`Unable to preview ${fileName}`);
|
|
2365
|
+
},
|
|
2366
|
+
loading: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-h-96 items-center justify-center", children: "Loading PDF..." }),
|
|
2367
|
+
error: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-h-96 items-center justify-center", children: error ?? "Unable to preview this PDF." }),
|
|
2368
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-center gap-4 p-4", children: Array.from({ length: numPages }, (_, index) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-lg bg-white shadow-sm", children: /* @__PURE__ */ jsxRuntime.jsx(reactPdf.Page, { pageNumber: index + 1, renderTextLayer: true, renderAnnotationLayer: true, width: pageWidth }) }, `page_${index + 1}`)) })
|
|
2369
|
+
}
|
|
2370
|
+
) });
|
|
2371
|
+
};
|
|
2372
|
+
var PdfPreview_default = PdfPreview;
|
|
2321
2373
|
var imageExtensions = /\.(avif|bmp|gif|heic|jpe?g|png|svg|tiff?|webp)$/i;
|
|
2322
2374
|
var textExtensions = /\.(c|cc|conf|cpp|css|csv|env|h|hpp|html?|ini|java|js|jsx|log|md|mjs|php|py|rb|rs|sh|sql|swift|ts|tsx|txt|xml|yaml|yml)$/i;
|
|
2323
2375
|
var audioExtensions = /\.(aac|flac|m4a|mp3|ogg|wav|weba)$/i;
|
|
@@ -2390,7 +2442,7 @@ var PreviewComponent = ({ fileName, base64, className }) => {
|
|
|
2390
2442
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex h-full min-h-48 w-full items-center justify-center overflow-auto", className), children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: dataUrl, alt: fileName, className: "max-h-full max-w-full object-contain" }) });
|
|
2391
2443
|
}
|
|
2392
2444
|
if (previewType === "pdf") {
|
|
2393
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2445
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PdfPreview_default, { base64, fileName, className });
|
|
2394
2446
|
}
|
|
2395
2447
|
if (previewType === "audio") {
|
|
2396
2448
|
return /* @__PURE__ */ jsxRuntime.jsx("audio", { controls: true, src: dataUrl, className: cn("w-full", className) });
|
|
@@ -2430,11 +2482,11 @@ function renderPluginChild(child, app, api, reloadKey) {
|
|
|
2430
2482
|
const renderFn = child;
|
|
2431
2483
|
return renderFn({ app, api });
|
|
2432
2484
|
}
|
|
2433
|
-
return
|
|
2434
|
-
if (!
|
|
2485
|
+
return React24.Children.map(child, (node, index) => {
|
|
2486
|
+
if (!React24.isValidElement(node)) {
|
|
2435
2487
|
return node;
|
|
2436
2488
|
}
|
|
2437
|
-
return
|
|
2489
|
+
return React24.cloneElement(
|
|
2438
2490
|
node,
|
|
2439
2491
|
{
|
|
2440
2492
|
key: `${reloadKey}-${index}`,
|
|
@@ -2464,13 +2516,13 @@ function PluginPlayground({
|
|
|
2464
2516
|
metadata,
|
|
2465
2517
|
backgroundImage
|
|
2466
2518
|
}) {
|
|
2467
|
-
const [mockUser] =
|
|
2468
|
-
const [mockToken] =
|
|
2469
|
-
const [isMinimized, setIsMinimized] =
|
|
2470
|
-
const [isClosed, setIsClosed] =
|
|
2471
|
-
const [isActive, setIsActive] =
|
|
2472
|
-
const [isNightMode, setIsNightMode] =
|
|
2473
|
-
|
|
2519
|
+
const [mockUser] = React24.useState(DEFAULT_MOCK_USER);
|
|
2520
|
+
const [mockToken] = React24.useState(DEFAULT_TOKEN);
|
|
2521
|
+
const [isMinimized, setIsMinimized] = React24.useState(false);
|
|
2522
|
+
const [isClosed, setIsClosed] = React24.useState(false);
|
|
2523
|
+
const [isActive, setIsActive] = React24.useState(true);
|
|
2524
|
+
const [isNightMode, setIsNightMode] = React24.useState(true);
|
|
2525
|
+
React24.useEffect(() => {
|
|
2474
2526
|
if (typeof window === "undefined") return;
|
|
2475
2527
|
const storedTheme = window.localStorage.getItem("plugin-playground-theme");
|
|
2476
2528
|
const prefersDark = window.matchMedia(
|
|
@@ -2479,7 +2531,7 @@ function PluginPlayground({
|
|
|
2479
2531
|
const shouldUseDark = storedTheme ? storedTheme === "dark" : prefersDark;
|
|
2480
2532
|
setIsNightMode(shouldUseDark);
|
|
2481
2533
|
}, []);
|
|
2482
|
-
|
|
2534
|
+
React24.useEffect(() => {
|
|
2483
2535
|
if (typeof document === "undefined") return;
|
|
2484
2536
|
document.documentElement.classList.toggle("dark", isNightMode);
|
|
2485
2537
|
window.localStorage.setItem(
|
|
@@ -2489,25 +2541,25 @@ function PluginPlayground({
|
|
|
2489
2541
|
}, [isNightMode]);
|
|
2490
2542
|
const title = metadata.title ?? metadata.name ?? "Plugin Playground";
|
|
2491
2543
|
const slug = metadata.slug ?? "local-plugin";
|
|
2492
|
-
const defaultSize =
|
|
2544
|
+
const defaultSize = React24.useMemo(() => getDefaultSize(metadata), [metadata]);
|
|
2493
2545
|
const canvasBackground = backgroundImage ?? metadata.backgroundImage ?? DEFAULT_BACKGROUND;
|
|
2494
2546
|
const isWindowResizable = metadata.windowSize?.isAppWindowResizing ?? metadata.isResizing ?? true;
|
|
2495
|
-
const minimizeWindow =
|
|
2547
|
+
const minimizeWindow = React24.useCallback(() => {
|
|
2496
2548
|
setIsActive(false);
|
|
2497
2549
|
setIsMinimized(true);
|
|
2498
2550
|
setIsClosed(false);
|
|
2499
2551
|
}, []);
|
|
2500
|
-
const closeWindow =
|
|
2552
|
+
const closeWindow = React24.useCallback(() => {
|
|
2501
2553
|
setIsActive(false);
|
|
2502
2554
|
setIsClosed(true);
|
|
2503
2555
|
setIsMinimized(false);
|
|
2504
2556
|
}, []);
|
|
2505
|
-
const restoreWindow =
|
|
2557
|
+
const restoreWindow = React24.useCallback(() => {
|
|
2506
2558
|
setIsActive(true);
|
|
2507
2559
|
setIsClosed(false);
|
|
2508
2560
|
setIsMinimized(false);
|
|
2509
2561
|
}, []);
|
|
2510
|
-
const mockApi =
|
|
2562
|
+
const mockApi = React24.useMemo(() => {
|
|
2511
2563
|
return {
|
|
2512
2564
|
showToast: (message, type) => {
|
|
2513
2565
|
console.info(`[playground:${type}] ${message}`);
|
|
@@ -2524,7 +2576,7 @@ function PluginPlayground({
|
|
|
2524
2576
|
isDarkTheme: isNightMode
|
|
2525
2577
|
};
|
|
2526
2578
|
}, [mockToken, mockUser, isNightMode]);
|
|
2527
|
-
const appProps =
|
|
2579
|
+
const appProps = React24.useMemo(
|
|
2528
2580
|
() => ({
|
|
2529
2581
|
name: title,
|
|
2530
2582
|
slug,
|
|
@@ -2694,13 +2746,13 @@ var WindowWithSideMenu = ({
|
|
|
2694
2746
|
removeShortcutListener,
|
|
2695
2747
|
getShortcutByCommand
|
|
2696
2748
|
} = useShortcutFormatter_default({ globalKeyboardShortcuts });
|
|
2697
|
-
const [state, dispatch] =
|
|
2749
|
+
const [state, dispatch] = React24.useReducer(reducer, {
|
|
2698
2750
|
...initialState,
|
|
2699
2751
|
windowSize: app.windowSize.windowSize ?? defaultSize,
|
|
2700
2752
|
defaultSize: app.windowSize.windowSize ?? defaultSize
|
|
2701
2753
|
});
|
|
2702
|
-
const windowRef =
|
|
2703
|
-
|
|
2754
|
+
const windowRef = React24.useRef(null);
|
|
2755
|
+
React24.useEffect(() => {
|
|
2704
2756
|
if (app.isMinimize !== state.isMinimized) {
|
|
2705
2757
|
dispatch({ type: "SYNC_MINIMIZE_STATE", payload: app.isMinimize });
|
|
2706
2758
|
}
|
|
@@ -2761,7 +2813,7 @@ var WindowWithSideMenu = ({
|
|
|
2761
2813
|
document.body.style.userSelect = "none";
|
|
2762
2814
|
dispatch({ type: "START_RESIZE", payload: { x: e.clientX, y: e.clientY } });
|
|
2763
2815
|
};
|
|
2764
|
-
|
|
2816
|
+
React24.useEffect(() => {
|
|
2765
2817
|
if (state.isDragging || state.resizeStart) {
|
|
2766
2818
|
window.addEventListener("mousemove", handleMouseMove);
|
|
2767
2819
|
window.addEventListener("mouseup", handleMouseUp);
|
|
@@ -2772,7 +2824,7 @@ var WindowWithSideMenu = ({
|
|
|
2772
2824
|
document.body.style.userSelect = "";
|
|
2773
2825
|
};
|
|
2774
2826
|
}, [state.isDragging, state.resizeStart]);
|
|
2775
|
-
|
|
2827
|
+
React24.useEffect(() => {
|
|
2776
2828
|
if (windowRef.current) {
|
|
2777
2829
|
windowRef.current.addEventListener("click", () => {
|
|
2778
2830
|
if (app?.callback) {
|
|
@@ -2781,7 +2833,7 @@ var WindowWithSideMenu = ({
|
|
|
2781
2833
|
});
|
|
2782
2834
|
}
|
|
2783
2835
|
}, [app?.slug, windowRef]);
|
|
2784
|
-
|
|
2836
|
+
React24.useEffect(() => {
|
|
2785
2837
|
const handleExitApp = () => {
|
|
2786
2838
|
if (app?.callback) {
|
|
2787
2839
|
app?.callback("CLOSE_APP");
|
|
@@ -2792,7 +2844,7 @@ var WindowWithSideMenu = ({
|
|
|
2792
2844
|
removeShortcutListener("exit_app", handleExitApp);
|
|
2793
2845
|
};
|
|
2794
2846
|
}, [app?.slug, app.isActive]);
|
|
2795
|
-
|
|
2847
|
+
React24.useEffect(() => {
|
|
2796
2848
|
const handleMinimize = () => {
|
|
2797
2849
|
if (app?.slug && app.isActive) {
|
|
2798
2850
|
dispatch({
|
|
@@ -2809,7 +2861,7 @@ var WindowWithSideMenu = ({
|
|
|
2809
2861
|
removeShortcutListener("minimize_app", handleMinimize);
|
|
2810
2862
|
};
|
|
2811
2863
|
}, [app?.slug, app.isActive, state.isMinimized, state.windowSize]);
|
|
2812
|
-
|
|
2864
|
+
React24.useEffect(() => {
|
|
2813
2865
|
const handleMaximize = () => {
|
|
2814
2866
|
if (app?.slug && app.isActive) {
|
|
2815
2867
|
dispatch({
|
|
@@ -2980,7 +3032,7 @@ var WindowWithSideMenu = ({
|
|
|
2980
3032
|
style: {
|
|
2981
3033
|
maxHeight: `${state.windowSize.height - 37}px`
|
|
2982
3034
|
},
|
|
2983
|
-
children:
|
|
3035
|
+
children: React24.isValidElement(children) && typeof children.type !== "string" ? React24__namespace.default.cloneElement(children, {
|
|
2984
3036
|
windowSize: state.windowSize,
|
|
2985
3037
|
isAppWindowResizing: state.resizeStart !== null
|
|
2986
3038
|
}) : children
|
|
@@ -3086,13 +3138,13 @@ var WindowWithoutSideMenu = ({
|
|
|
3086
3138
|
removeShortcutListener,
|
|
3087
3139
|
getShortcutByCommand
|
|
3088
3140
|
} = useShortcutFormatter_default({ globalKeyboardShortcuts });
|
|
3089
|
-
const [state, dispatch] =
|
|
3141
|
+
const [state, dispatch] = React24.useReducer(reducer2, {
|
|
3090
3142
|
...initialState2,
|
|
3091
3143
|
windowSize: app.windowSize.windowSize ?? defaultSize,
|
|
3092
3144
|
defaultSize: app.windowSize.windowSize ?? defaultSize
|
|
3093
3145
|
});
|
|
3094
|
-
const windowRef =
|
|
3095
|
-
|
|
3146
|
+
const windowRef = React24.useRef(null);
|
|
3147
|
+
React24.useEffect(() => {
|
|
3096
3148
|
if (app.isMinimize !== state.isMinimized) {
|
|
3097
3149
|
dispatch({ type: "SYNC_MINIMIZE_STATE", payload: app.isMinimize });
|
|
3098
3150
|
}
|
|
@@ -3149,7 +3201,7 @@ var WindowWithoutSideMenu = ({
|
|
|
3149
3201
|
document.body.style.userSelect = "none";
|
|
3150
3202
|
dispatch({ type: "START_RESIZE", payload: { x: e.clientX, y: e.clientY } });
|
|
3151
3203
|
};
|
|
3152
|
-
|
|
3204
|
+
React24.useEffect(() => {
|
|
3153
3205
|
if (state.isDragging || state.resizeStart) {
|
|
3154
3206
|
window.addEventListener("mousemove", handleMouseMove);
|
|
3155
3207
|
window.addEventListener("mouseup", handleMouseUp);
|
|
@@ -3160,7 +3212,7 @@ var WindowWithoutSideMenu = ({
|
|
|
3160
3212
|
document.body.style.userSelect = "";
|
|
3161
3213
|
};
|
|
3162
3214
|
}, [state.isDragging, state.resizeStart]);
|
|
3163
|
-
|
|
3215
|
+
React24.useEffect(() => {
|
|
3164
3216
|
if (windowRef.current) {
|
|
3165
3217
|
windowRef.current.addEventListener("click", () => {
|
|
3166
3218
|
if (app?.callback) {
|
|
@@ -3169,7 +3221,7 @@ var WindowWithoutSideMenu = ({
|
|
|
3169
3221
|
});
|
|
3170
3222
|
}
|
|
3171
3223
|
}, [app?.slug, windowRef]);
|
|
3172
|
-
|
|
3224
|
+
React24.useEffect(() => {
|
|
3173
3225
|
const handleExitApp = () => {
|
|
3174
3226
|
if (app?.callback) {
|
|
3175
3227
|
app?.callback("CLOSE_APP");
|
|
@@ -3180,7 +3232,7 @@ var WindowWithoutSideMenu = ({
|
|
|
3180
3232
|
removeShortcutListener("exit_app", handleExitApp);
|
|
3181
3233
|
};
|
|
3182
3234
|
}, [app?.slug, app.isActive]);
|
|
3183
|
-
|
|
3235
|
+
React24.useEffect(() => {
|
|
3184
3236
|
const handleMinimize = () => {
|
|
3185
3237
|
if (app?.slug && app.isActive) {
|
|
3186
3238
|
dispatch({
|
|
@@ -3197,7 +3249,7 @@ var WindowWithoutSideMenu = ({
|
|
|
3197
3249
|
removeShortcutListener("minimize_app", handleMinimize);
|
|
3198
3250
|
};
|
|
3199
3251
|
}, [app?.slug, app.isActive, state.isMinimized, state.windowSize]);
|
|
3200
|
-
|
|
3252
|
+
React24.useEffect(() => {
|
|
3201
3253
|
const handleMaximize = () => {
|
|
3202
3254
|
if (app?.slug && app.isActive) {
|
|
3203
3255
|
dispatch({
|
|
@@ -3313,7 +3365,7 @@ var WindowWithoutSideMenu = ({
|
|
|
3313
3365
|
style: {
|
|
3314
3366
|
maxHeight: `${state.windowSize.height - 37}px`
|
|
3315
3367
|
},
|
|
3316
|
-
children:
|
|
3368
|
+
children: React24.isValidElement(children) && typeof children.type !== "string" ? React24__namespace.default.cloneElement(children, {
|
|
3317
3369
|
windowSize: state.windowSize,
|
|
3318
3370
|
isAppWindowResizing: state.resizeStart !== null
|
|
3319
3371
|
}) : children
|
|
@@ -3336,7 +3388,7 @@ var WindowWithoutSideMenu = ({
|
|
|
3336
3388
|
);
|
|
3337
3389
|
};
|
|
3338
3390
|
var WindowWithoutSideMenu_default = WindowWithoutSideMenu;
|
|
3339
|
-
var Table =
|
|
3391
|
+
var Table = React24__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3340
3392
|
"table",
|
|
3341
3393
|
{
|
|
3342
3394
|
ref,
|
|
@@ -3345,9 +3397,9 @@ var Table = React23__namespace.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
3345
3397
|
}
|
|
3346
3398
|
) }));
|
|
3347
3399
|
Table.displayName = "Table";
|
|
3348
|
-
var TableHeader =
|
|
3400
|
+
var TableHeader = React24__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: cn("[&_tr]:border-b text-neutral-400 bg-surface-2", className), ...props }));
|
|
3349
3401
|
TableHeader.displayName = "TableHeader";
|
|
3350
|
-
var TableBody =
|
|
3402
|
+
var TableBody = React24__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3351
3403
|
"tbody",
|
|
3352
3404
|
{
|
|
3353
3405
|
ref,
|
|
@@ -3356,7 +3408,7 @@ var TableBody = React23__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
3356
3408
|
}
|
|
3357
3409
|
));
|
|
3358
3410
|
TableBody.displayName = "TableBody";
|
|
3359
|
-
var TableFooter =
|
|
3411
|
+
var TableFooter = React24__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3360
3412
|
"tfoot",
|
|
3361
3413
|
{
|
|
3362
3414
|
ref,
|
|
@@ -3368,7 +3420,7 @@ var TableFooter = React23__namespace.forwardRef(({ className, ...props }, ref) =
|
|
|
3368
3420
|
}
|
|
3369
3421
|
));
|
|
3370
3422
|
TableFooter.displayName = "TableFooter";
|
|
3371
|
-
var TableRow =
|
|
3423
|
+
var TableRow = React24__namespace.forwardRef(({ className, onClick, ...props }, ref) => {
|
|
3372
3424
|
const isInteractive = typeof onClick === "function";
|
|
3373
3425
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3374
3426
|
"tr",
|
|
@@ -3385,7 +3437,7 @@ var TableRow = React23__namespace.forwardRef(({ className, onClick, ...props },
|
|
|
3385
3437
|
);
|
|
3386
3438
|
});
|
|
3387
3439
|
TableRow.displayName = "TableRow";
|
|
3388
|
-
var TableHead =
|
|
3440
|
+
var TableHead = React24__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3389
3441
|
"th",
|
|
3390
3442
|
{
|
|
3391
3443
|
ref,
|
|
@@ -3397,7 +3449,7 @@ var TableHead = React23__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
3397
3449
|
}
|
|
3398
3450
|
));
|
|
3399
3451
|
TableHead.displayName = "TableHead";
|
|
3400
|
-
var TableCell =
|
|
3452
|
+
var TableCell = React24__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3401
3453
|
"td",
|
|
3402
3454
|
{
|
|
3403
3455
|
ref,
|
|
@@ -3406,7 +3458,7 @@ var TableCell = React23__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
3406
3458
|
}
|
|
3407
3459
|
));
|
|
3408
3460
|
TableCell.displayName = "TableCell";
|
|
3409
|
-
var TableCaption =
|
|
3461
|
+
var TableCaption = React24__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3410
3462
|
"caption",
|
|
3411
3463
|
{
|
|
3412
3464
|
ref,
|
|
@@ -3416,12 +3468,12 @@ var TableCaption = React23__namespace.forwardRef(({ className, ...props }, ref)
|
|
|
3416
3468
|
));
|
|
3417
3469
|
TableCaption.displayName = "TableCaption";
|
|
3418
3470
|
var useGridClasses = (windowSize, gridRules) => {
|
|
3419
|
-
const deviceType =
|
|
3471
|
+
const deviceType = React24.useMemo(() => {
|
|
3420
3472
|
if (windowSize.width <= 640) return "mobile";
|
|
3421
3473
|
if (windowSize.width <= 1024) return "tablet";
|
|
3422
3474
|
return "desktop";
|
|
3423
3475
|
}, [windowSize]);
|
|
3424
|
-
const gridClasses =
|
|
3476
|
+
const gridClasses = React24.useMemo(() => {
|
|
3425
3477
|
const classes = {};
|
|
3426
3478
|
for (const element in gridRules) {
|
|
3427
3479
|
const classRules = gridRules[element] ?? {};
|
|
@@ -3434,8 +3486,8 @@ var useGridClasses = (windowSize, gridRules) => {
|
|
|
3434
3486
|
};
|
|
3435
3487
|
var useGridClasses_default = useGridClasses;
|
|
3436
3488
|
var useDeviceSupport = () => {
|
|
3437
|
-
const [isSupported, setIsSupported] =
|
|
3438
|
-
|
|
3489
|
+
const [isSupported, setIsSupported] = React24.useState(true);
|
|
3490
|
+
React24.useEffect(() => {
|
|
3439
3491
|
function checkSupport() {
|
|
3440
3492
|
const ua = typeof window !== "undefined" ? window.navigator.userAgent : "";
|
|
3441
3493
|
const width = typeof window !== "undefined" ? window.innerWidth : 1920;
|
|
@@ -3561,7 +3613,7 @@ var useSound = () => {
|
|
|
3561
3613
|
audio.currentTime = 0;
|
|
3562
3614
|
await audio.play();
|
|
3563
3615
|
};
|
|
3564
|
-
const playSound =
|
|
3616
|
+
const playSound = React24.useCallback((type) => {
|
|
3565
3617
|
if (typeof window === "undefined") {
|
|
3566
3618
|
return;
|
|
3567
3619
|
}
|
|
@@ -3626,6 +3678,7 @@ exports.Input = Input_default;
|
|
|
3626
3678
|
exports.Loading = Loading_default;
|
|
3627
3679
|
exports.Modal = Modal_default;
|
|
3628
3680
|
exports.Pagination = Pagination_default;
|
|
3681
|
+
exports.PdfPreview = PdfPreview_default;
|
|
3629
3682
|
exports.PluginPlayground = PluginPlayground;
|
|
3630
3683
|
exports.PreviewComponent = PreviewComponent_default;
|
|
3631
3684
|
exports.Progress = Progress_default;
|