ssovee-os-web-ui 0.1.85 → 0.1.88
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 +0 -2
- package/dist/index.cjs +109 -106
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +41 -38
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -181,8 +181,6 @@ export function PluginPreview() {
|
|
|
181
181
|
return (
|
|
182
182
|
<PluginPlayground
|
|
183
183
|
metadata={pluginMetadata}
|
|
184
|
-
onClose={() => console.log("Playground closed")}
|
|
185
|
-
onMinimize={(isMinimized) => console.log("Minimized:", isMinimized)}
|
|
186
184
|
>
|
|
187
185
|
<div>
|
|
188
186
|
<Typography variant="h6">Plugin Content</Typography>
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React23 = 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');
|
|
@@ -26,7 +26,7 @@ function _interopNamespace(e) {
|
|
|
26
26
|
return Object.freeze(n);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
var
|
|
29
|
+
var React23__namespace = /*#__PURE__*/_interopNamespace(React23);
|
|
30
30
|
var Editor__default = /*#__PURE__*/_interopDefault(Editor);
|
|
31
31
|
|
|
32
32
|
// src/components/Button.tsx
|
|
@@ -35,7 +35,7 @@ var Editor__default = /*#__PURE__*/_interopDefault(Editor);
|
|
|
35
35
|
function cn(...inputs) {
|
|
36
36
|
return inputs.filter(Boolean).join(" ");
|
|
37
37
|
}
|
|
38
|
-
var Button =
|
|
38
|
+
var Button = React23__namespace.default.forwardRef(
|
|
39
39
|
({
|
|
40
40
|
className,
|
|
41
41
|
variant = "primary",
|
|
@@ -171,7 +171,7 @@ var Typography = ({
|
|
|
171
171
|
return /* @__PURE__ */ jsxRuntime.jsx(Component, { className: classes, children });
|
|
172
172
|
};
|
|
173
173
|
var Typography_default = Typography;
|
|
174
|
-
var Input =
|
|
174
|
+
var Input = React23__namespace.default.forwardRef(
|
|
175
175
|
({
|
|
176
176
|
className,
|
|
177
177
|
variant = "default",
|
|
@@ -249,7 +249,7 @@ var Input = React22__namespace.default.forwardRef(
|
|
|
249
249
|
);
|
|
250
250
|
Input.displayName = "Input";
|
|
251
251
|
var Input_default = Input;
|
|
252
|
-
var TextArea =
|
|
252
|
+
var TextArea = React23__namespace.default.forwardRef(
|
|
253
253
|
({
|
|
254
254
|
className,
|
|
255
255
|
variant = "default",
|
|
@@ -310,17 +310,22 @@ var CodeEditor = ({
|
|
|
310
310
|
value,
|
|
311
311
|
onChange,
|
|
312
312
|
language = "json",
|
|
313
|
-
theme = "light",
|
|
314
313
|
height = "100%",
|
|
315
314
|
options,
|
|
316
|
-
className
|
|
315
|
+
className,
|
|
316
|
+
isDarkTheme
|
|
317
317
|
}) => {
|
|
318
|
+
const editorTheme = React23.useMemo(() => {
|
|
319
|
+
if (typeof isDarkTheme === "undefined") return "light";
|
|
320
|
+
const isDark = Boolean(isDarkTheme);
|
|
321
|
+
return isDark ? "vs-dark" : "light";
|
|
322
|
+
}, [isDarkTheme]);
|
|
318
323
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, style: { height }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
319
324
|
Editor__default.default,
|
|
320
325
|
{
|
|
321
326
|
height: "100%",
|
|
322
327
|
language,
|
|
323
|
-
theme,
|
|
328
|
+
theme: editorTheme,
|
|
324
329
|
value,
|
|
325
330
|
onChange: (nextValue) => onChange(nextValue ?? ""),
|
|
326
331
|
options
|
|
@@ -328,7 +333,7 @@ var CodeEditor = ({
|
|
|
328
333
|
) });
|
|
329
334
|
};
|
|
330
335
|
var CodeEditor_default = CodeEditor;
|
|
331
|
-
var Select =
|
|
336
|
+
var Select = React23__namespace.default.forwardRef(
|
|
332
337
|
({
|
|
333
338
|
className,
|
|
334
339
|
options,
|
|
@@ -408,7 +413,7 @@ var Select = React22__namespace.default.forwardRef(
|
|
|
408
413
|
);
|
|
409
414
|
Select.displayName = "Select";
|
|
410
415
|
var Select_default = Select;
|
|
411
|
-
var Checkbox =
|
|
416
|
+
var Checkbox = React23__namespace.default.forwardRef(
|
|
412
417
|
({
|
|
413
418
|
className,
|
|
414
419
|
variant = "default",
|
|
@@ -483,7 +488,7 @@ var Checkbox = React22__namespace.default.forwardRef(
|
|
|
483
488
|
);
|
|
484
489
|
Checkbox.displayName = "Checkbox";
|
|
485
490
|
var Checkbox_default = Checkbox;
|
|
486
|
-
var Toggle =
|
|
491
|
+
var Toggle = React23__namespace.default.forwardRef(
|
|
487
492
|
({
|
|
488
493
|
checked,
|
|
489
494
|
onChange,
|
|
@@ -589,10 +594,10 @@ var Dropdown = ({
|
|
|
589
594
|
className,
|
|
590
595
|
trigger
|
|
591
596
|
}) => {
|
|
592
|
-
const [isOpen, setIsOpen] =
|
|
593
|
-
const dropdownRef =
|
|
597
|
+
const [isOpen, setIsOpen] = React23.useState(false);
|
|
598
|
+
const dropdownRef = React23.useRef(null);
|
|
594
599
|
const selectedOption = options.find((option) => option.value === value);
|
|
595
|
-
|
|
600
|
+
React23.useEffect(() => {
|
|
596
601
|
const handleClickOutside = (event) => {
|
|
597
602
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
598
603
|
setIsOpen(false);
|
|
@@ -719,9 +724,9 @@ var ImageWithPlaceholder = ({
|
|
|
719
724
|
};
|
|
720
725
|
const resolvedSrc = resolveSrc(src);
|
|
721
726
|
const initialSrc = isValidSrc(resolvedSrc) ? resolvedSrc : fallbackSrc;
|
|
722
|
-
const [imgSrc, setImgSrc] =
|
|
723
|
-
const [hasError, setHasError] =
|
|
724
|
-
|
|
727
|
+
const [imgSrc, setImgSrc] = React23.useState(initialSrc);
|
|
728
|
+
const [hasError, setHasError] = React23.useState(!isValidSrc(resolvedSrc));
|
|
729
|
+
React23.useEffect(() => {
|
|
725
730
|
const nextResolvedSrc = resolveSrc(src);
|
|
726
731
|
if (isValidSrc(nextResolvedSrc)) {
|
|
727
732
|
setImgSrc(nextResolvedSrc);
|
|
@@ -930,8 +935,8 @@ var Toast = ({
|
|
|
930
935
|
showCloseButton = true,
|
|
931
936
|
className
|
|
932
937
|
}) => {
|
|
933
|
-
const [isShowing, setIsShowing] =
|
|
934
|
-
|
|
938
|
+
const [isShowing, setIsShowing] = React23.useState(false);
|
|
939
|
+
React23.useEffect(() => {
|
|
935
940
|
if (isVisible) {
|
|
936
941
|
setIsShowing(true);
|
|
937
942
|
let timer = null;
|
|
@@ -1155,7 +1160,7 @@ var Modal = ({
|
|
|
1155
1160
|
closeOnEscape = true,
|
|
1156
1161
|
className
|
|
1157
1162
|
}) => {
|
|
1158
|
-
|
|
1163
|
+
React23.useEffect(() => {
|
|
1159
1164
|
if (!isOpen) return;
|
|
1160
1165
|
const handleEscape = (e) => {
|
|
1161
1166
|
if (e.key === "Escape" && closeOnEscape) {
|
|
@@ -1222,7 +1227,7 @@ var Modal = ({
|
|
|
1222
1227
|
);
|
|
1223
1228
|
};
|
|
1224
1229
|
var Modal_default = Modal;
|
|
1225
|
-
var Card =
|
|
1230
|
+
var Card = React23__namespace.default.forwardRef(
|
|
1226
1231
|
({
|
|
1227
1232
|
className,
|
|
1228
1233
|
variant = "default",
|
|
@@ -1260,7 +1265,7 @@ var Card = React22__namespace.default.forwardRef(
|
|
|
1260
1265
|
);
|
|
1261
1266
|
Card.displayName = "Card";
|
|
1262
1267
|
var Card_default = Card;
|
|
1263
|
-
var Badge =
|
|
1268
|
+
var Badge = React23__namespace.default.forwardRef(
|
|
1264
1269
|
({
|
|
1265
1270
|
className,
|
|
1266
1271
|
variant = "default",
|
|
@@ -1315,7 +1320,7 @@ var Avatar = ({
|
|
|
1315
1320
|
className,
|
|
1316
1321
|
onClick
|
|
1317
1322
|
}) => {
|
|
1318
|
-
const [imgError, setImgError] =
|
|
1323
|
+
const [imgError, setImgError] = React23.useState(false);
|
|
1319
1324
|
const sizeClasses = {
|
|
1320
1325
|
sm: "w-8 h-8 text-xs",
|
|
1321
1326
|
md: "w-10 h-10 text-sm",
|
|
@@ -1338,7 +1343,7 @@ var Avatar = ({
|
|
|
1338
1343
|
}
|
|
1339
1344
|
) }) });
|
|
1340
1345
|
};
|
|
1341
|
-
const handleImgError =
|
|
1346
|
+
const handleImgError = React23.useCallback(() => {
|
|
1342
1347
|
setImgError(true);
|
|
1343
1348
|
}, []);
|
|
1344
1349
|
const isSrcAvailable = typeof src === "string" && src.trim() !== "";
|
|
@@ -1410,8 +1415,8 @@ var Tooltip = ({
|
|
|
1410
1415
|
delay = 200,
|
|
1411
1416
|
className
|
|
1412
1417
|
}) => {
|
|
1413
|
-
const [isVisible, setIsVisible] =
|
|
1414
|
-
const [timeoutId, setTimeoutId] =
|
|
1418
|
+
const [isVisible, setIsVisible] = React23.useState(false);
|
|
1419
|
+
const [timeoutId, setTimeoutId] = React23.useState(null);
|
|
1415
1420
|
const showTooltip = () => {
|
|
1416
1421
|
const id = setTimeout(() => setIsVisible(true), delay);
|
|
1417
1422
|
setTimeoutId(id);
|
|
@@ -1541,14 +1546,14 @@ var matchShortcut = (event, shortcut, os) => {
|
|
|
1541
1546
|
var useShortcutFormatter = ({
|
|
1542
1547
|
globalKeyboardShortcuts: globalKeyboardShortcuts2 = []
|
|
1543
1548
|
} = {}) => {
|
|
1544
|
-
const [os, setOS] =
|
|
1545
|
-
const listenersRef =
|
|
1549
|
+
const [os, setOS] = React23.useState("windows");
|
|
1550
|
+
const listenersRef = React23.useRef(
|
|
1546
1551
|
/* @__PURE__ */ new Map()
|
|
1547
1552
|
);
|
|
1548
|
-
|
|
1553
|
+
React23.useEffect(() => {
|
|
1549
1554
|
setOS(detectOS());
|
|
1550
1555
|
}, []);
|
|
1551
|
-
|
|
1556
|
+
React23.useEffect(() => {
|
|
1552
1557
|
if (!globalKeyboardShortcuts2.length) return;
|
|
1553
1558
|
const handleKeyDown = (event) => {
|
|
1554
1559
|
for (const shortcut of globalKeyboardShortcuts2) {
|
|
@@ -1566,21 +1571,21 @@ var useShortcutFormatter = ({
|
|
|
1566
1571
|
window.removeEventListener("keydown", handleKeyDown);
|
|
1567
1572
|
};
|
|
1568
1573
|
}, [os, globalKeyboardShortcuts2]);
|
|
1569
|
-
const formatKeys =
|
|
1574
|
+
const formatKeys = React23.useCallback(
|
|
1570
1575
|
(keys = []) => {
|
|
1571
1576
|
const separator = os === "mac" ? "" : " + ";
|
|
1572
1577
|
return keys.map((key) => keyMap[os][key.toLowerCase()] || key.toUpperCase()).join(separator);
|
|
1573
1578
|
},
|
|
1574
1579
|
[os]
|
|
1575
1580
|
);
|
|
1576
|
-
const getShortcutByCommand =
|
|
1581
|
+
const getShortcutByCommand = React23.useCallback(
|
|
1577
1582
|
(command) => {
|
|
1578
1583
|
const found = globalKeyboardShortcuts2.find((s) => s.command === command);
|
|
1579
1584
|
return found ? found.shortcut : [];
|
|
1580
1585
|
},
|
|
1581
1586
|
[globalKeyboardShortcuts2]
|
|
1582
1587
|
);
|
|
1583
|
-
const addShortcutListener =
|
|
1588
|
+
const addShortcutListener = React23.useCallback(
|
|
1584
1589
|
(command, listener) => {
|
|
1585
1590
|
if (!listenersRef.current.has(command)) {
|
|
1586
1591
|
listenersRef.current.set(command, /* @__PURE__ */ new Set());
|
|
@@ -1589,7 +1594,7 @@ var useShortcutFormatter = ({
|
|
|
1589
1594
|
},
|
|
1590
1595
|
[]
|
|
1591
1596
|
);
|
|
1592
|
-
const removeShortcutListener =
|
|
1597
|
+
const removeShortcutListener = React23.useCallback(
|
|
1593
1598
|
(command, listener) => {
|
|
1594
1599
|
if (listenersRef.current.has(command)) {
|
|
1595
1600
|
listenersRef.current.get(command).delete(listener);
|
|
@@ -1629,7 +1634,7 @@ var globalKeyboardShortcuts = [
|
|
|
1629
1634
|
usage: "Focus search"
|
|
1630
1635
|
}
|
|
1631
1636
|
];
|
|
1632
|
-
var SearchInput =
|
|
1637
|
+
var SearchInput = React23__namespace.default.forwardRef(
|
|
1633
1638
|
({
|
|
1634
1639
|
onSearch,
|
|
1635
1640
|
placeholder = "Search...",
|
|
@@ -1644,16 +1649,16 @@ var SearchInput = React22__namespace.default.forwardRef(
|
|
|
1644
1649
|
isActive = true,
|
|
1645
1650
|
...props
|
|
1646
1651
|
}, ref) => {
|
|
1647
|
-
const [searchValue, setSearchValue] =
|
|
1648
|
-
const inputRef =
|
|
1649
|
-
|
|
1652
|
+
const [searchValue, setSearchValue] = React23__namespace.default.useState(value || "");
|
|
1653
|
+
const inputRef = React23.useRef(null);
|
|
1654
|
+
React23.useImperativeHandle(ref, () => inputRef.current);
|
|
1650
1655
|
const {
|
|
1651
1656
|
addShortcutListener,
|
|
1652
1657
|
removeShortcutListener,
|
|
1653
1658
|
formatKeys,
|
|
1654
1659
|
getShortcutByCommand
|
|
1655
1660
|
} = useShortcutFormatter_default({ globalKeyboardShortcuts });
|
|
1656
|
-
|
|
1661
|
+
React23.useEffect(() => {
|
|
1657
1662
|
setSearchValue(value ?? "");
|
|
1658
1663
|
}, [value]);
|
|
1659
1664
|
const handleChange = (e) => {
|
|
@@ -1662,7 +1667,7 @@ var SearchInput = React22__namespace.default.forwardRef(
|
|
|
1662
1667
|
onChange?.(e);
|
|
1663
1668
|
onSearch?.(newValue);
|
|
1664
1669
|
};
|
|
1665
|
-
const handleClear =
|
|
1670
|
+
const handleClear = React23.useCallback(() => {
|
|
1666
1671
|
setSearchValue("");
|
|
1667
1672
|
onSearch?.("");
|
|
1668
1673
|
const syntheticEvent = {
|
|
@@ -1670,7 +1675,7 @@ var SearchInput = React22__namespace.default.forwardRef(
|
|
|
1670
1675
|
};
|
|
1671
1676
|
onChange?.(syntheticEvent);
|
|
1672
1677
|
}, [onChange, onSearch]);
|
|
1673
|
-
|
|
1678
|
+
React23.useEffect(() => {
|
|
1674
1679
|
if (!enableKeyboardShortcuts || !isActive) return;
|
|
1675
1680
|
const handleFocusSearch = (e) => {
|
|
1676
1681
|
e?.preventDefault();
|
|
@@ -1823,8 +1828,8 @@ var FileUpload = ({
|
|
|
1823
1828
|
children,
|
|
1824
1829
|
dragAndDrop = false
|
|
1825
1830
|
}) => {
|
|
1826
|
-
const fileInputRef =
|
|
1827
|
-
const [isDragOver, setIsDragOver] =
|
|
1831
|
+
const fileInputRef = React23.useRef(null);
|
|
1832
|
+
const [isDragOver, setIsDragOver] = React23__namespace.default.useState(false);
|
|
1828
1833
|
const handleFileSelect = (files) => {
|
|
1829
1834
|
if (!files) return;
|
|
1830
1835
|
const fileArray = Array.from(files);
|
|
@@ -2122,7 +2127,7 @@ var Pagination = ({
|
|
|
2122
2127
|
] });
|
|
2123
2128
|
};
|
|
2124
2129
|
var Pagination_default = Pagination;
|
|
2125
|
-
var Radio =
|
|
2130
|
+
var Radio = React23__namespace.default.forwardRef(
|
|
2126
2131
|
({
|
|
2127
2132
|
className,
|
|
2128
2133
|
label,
|
|
@@ -2187,7 +2192,7 @@ var Radio = React22__namespace.default.forwardRef(
|
|
|
2187
2192
|
Radio.displayName = "Radio";
|
|
2188
2193
|
var Radio_default = Radio;
|
|
2189
2194
|
var Accordion = ({ items, active = -1 }) => {
|
|
2190
|
-
const [activeIndex, setActiveIndex] =
|
|
2195
|
+
const [activeIndex, setActiveIndex] = React23.useState(active);
|
|
2191
2196
|
const toggleAccordion = (index) => {
|
|
2192
2197
|
setActiveIndex(activeIndex === index ? null : index);
|
|
2193
2198
|
};
|
|
@@ -2228,8 +2233,8 @@ var Tabs = ({
|
|
|
2228
2233
|
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]",
|
|
2229
2234
|
activeButtonClassName = "bg-surface-3 text-neutral-400"
|
|
2230
2235
|
}) => {
|
|
2231
|
-
const [activeTab, setActiveTab] =
|
|
2232
|
-
|
|
2236
|
+
const [activeTab, setActiveTab] = React23.useState(defaultActiveTab);
|
|
2237
|
+
React23.useEffect(() => {
|
|
2233
2238
|
setActiveTab(defaultActiveTab);
|
|
2234
2239
|
}, [defaultActiveTab]);
|
|
2235
2240
|
const handleTabClick = (index) => {
|
|
@@ -2268,11 +2273,11 @@ function renderPluginChild(child, app, api, reloadKey) {
|
|
|
2268
2273
|
const renderFn = child;
|
|
2269
2274
|
return renderFn({ app, api });
|
|
2270
2275
|
}
|
|
2271
|
-
return
|
|
2272
|
-
if (!
|
|
2276
|
+
return React23.Children.map(child, (node, index) => {
|
|
2277
|
+
if (!React23.isValidElement(node)) {
|
|
2273
2278
|
return node;
|
|
2274
2279
|
}
|
|
2275
|
-
return
|
|
2280
|
+
return React23.cloneElement(
|
|
2276
2281
|
node,
|
|
2277
2282
|
{
|
|
2278
2283
|
key: `${reloadKey}-${index}`,
|
|
@@ -2301,23 +2306,24 @@ function PluginPlayground({
|
|
|
2301
2306
|
children,
|
|
2302
2307
|
metadata,
|
|
2303
2308
|
backgroundImage,
|
|
2304
|
-
|
|
2305
|
-
onMinimize
|
|
2309
|
+
api
|
|
2306
2310
|
}) {
|
|
2307
|
-
const [mockUser] =
|
|
2308
|
-
const [mockToken] =
|
|
2309
|
-
const [isMinimized, setIsMinimized] =
|
|
2310
|
-
const [isClosed, setIsClosed] =
|
|
2311
|
-
const [isActive, setIsActive] =
|
|
2312
|
-
const [isNightMode, setIsNightMode] =
|
|
2313
|
-
|
|
2311
|
+
const [mockUser] = React23.useState(DEFAULT_MOCK_USER);
|
|
2312
|
+
const [mockToken] = React23.useState(DEFAULT_TOKEN);
|
|
2313
|
+
const [isMinimized, setIsMinimized] = React23.useState(false);
|
|
2314
|
+
const [isClosed, setIsClosed] = React23.useState(false);
|
|
2315
|
+
const [isActive, setIsActive] = React23.useState(true);
|
|
2316
|
+
const [isNightMode, setIsNightMode] = React23.useState(true);
|
|
2317
|
+
React23.useEffect(() => {
|
|
2314
2318
|
if (typeof window === "undefined") return;
|
|
2315
2319
|
const storedTheme = window.localStorage.getItem("plugin-playground-theme");
|
|
2316
|
-
const prefersDark = window.matchMedia(
|
|
2320
|
+
const prefersDark = window.matchMedia(
|
|
2321
|
+
"(prefers-color-scheme: dark)"
|
|
2322
|
+
).matches;
|
|
2317
2323
|
const shouldUseDark = storedTheme ? storedTheme === "dark" : prefersDark;
|
|
2318
2324
|
setIsNightMode(shouldUseDark);
|
|
2319
2325
|
}, []);
|
|
2320
|
-
|
|
2326
|
+
React23.useEffect(() => {
|
|
2321
2327
|
if (typeof document === "undefined") return;
|
|
2322
2328
|
document.documentElement.classList.toggle("dark", isNightMode);
|
|
2323
2329
|
window.localStorage.setItem(
|
|
@@ -2327,29 +2333,26 @@ function PluginPlayground({
|
|
|
2327
2333
|
}, [isNightMode]);
|
|
2328
2334
|
const title = metadata.title ?? metadata.name ?? "Plugin Playground";
|
|
2329
2335
|
const slug = metadata.slug ?? "local-plugin";
|
|
2330
|
-
const defaultSize =
|
|
2336
|
+
const defaultSize = React23.useMemo(() => getDefaultSize(metadata), [metadata]);
|
|
2331
2337
|
const canvasBackground = backgroundImage ?? metadata.backgroundImage ?? DEFAULT_BACKGROUND;
|
|
2332
2338
|
const isWindowResizable = metadata.windowSize?.isAppWindowResizing ?? metadata.isResizing ?? true;
|
|
2333
|
-
const minimizeWindow =
|
|
2339
|
+
const minimizeWindow = React23.useCallback(() => {
|
|
2334
2340
|
setIsActive(false);
|
|
2335
2341
|
setIsMinimized(true);
|
|
2336
2342
|
setIsClosed(false);
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
const closeWindow = React22.useCallback(() => {
|
|
2343
|
+
}, []);
|
|
2344
|
+
const closeWindow = React23.useCallback(() => {
|
|
2340
2345
|
setIsActive(false);
|
|
2341
2346
|
setIsClosed(true);
|
|
2342
2347
|
setIsMinimized(false);
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
const restoreWindow = React22.useCallback(() => {
|
|
2348
|
+
}, []);
|
|
2349
|
+
const restoreWindow = React23.useCallback(() => {
|
|
2346
2350
|
setIsActive(true);
|
|
2347
2351
|
setIsClosed(false);
|
|
2348
2352
|
setIsMinimized(false);
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
() => ({
|
|
2353
|
+
}, []);
|
|
2354
|
+
const mockApi = React23.useMemo(
|
|
2355
|
+
() => api ? api : {
|
|
2353
2356
|
showToast: (message, type) => {
|
|
2354
2357
|
console.info(`[playground:${type}] ${message}`);
|
|
2355
2358
|
},
|
|
@@ -2363,10 +2366,10 @@ function PluginPlayground({
|
|
|
2363
2366
|
return mockToken;
|
|
2364
2367
|
},
|
|
2365
2368
|
isDarkTheme: true
|
|
2366
|
-
}
|
|
2369
|
+
},
|
|
2367
2370
|
[mockToken, mockUser]
|
|
2368
2371
|
);
|
|
2369
|
-
const appProps =
|
|
2372
|
+
const appProps = React23.useMemo(
|
|
2370
2373
|
() => ({
|
|
2371
2374
|
name: title,
|
|
2372
2375
|
slug,
|
|
@@ -2536,13 +2539,13 @@ var WindowWithSideMenu = ({
|
|
|
2536
2539
|
removeShortcutListener,
|
|
2537
2540
|
getShortcutByCommand
|
|
2538
2541
|
} = useShortcutFormatter_default({ globalKeyboardShortcuts });
|
|
2539
|
-
const [state, dispatch] =
|
|
2542
|
+
const [state, dispatch] = React23.useReducer(reducer, {
|
|
2540
2543
|
...initialState,
|
|
2541
2544
|
windowSize: app.windowSize.windowSize ?? defaultSize,
|
|
2542
2545
|
defaultSize: app.windowSize.windowSize ?? defaultSize
|
|
2543
2546
|
});
|
|
2544
|
-
const windowRef =
|
|
2545
|
-
|
|
2547
|
+
const windowRef = React23.useRef(null);
|
|
2548
|
+
React23.useEffect(() => {
|
|
2546
2549
|
if (app.isMinimize !== state.isMinimized) {
|
|
2547
2550
|
dispatch({ type: "SYNC_MINIMIZE_STATE", payload: app.isMinimize });
|
|
2548
2551
|
}
|
|
@@ -2603,7 +2606,7 @@ var WindowWithSideMenu = ({
|
|
|
2603
2606
|
document.body.style.userSelect = "none";
|
|
2604
2607
|
dispatch({ type: "START_RESIZE", payload: { x: e.clientX, y: e.clientY } });
|
|
2605
2608
|
};
|
|
2606
|
-
|
|
2609
|
+
React23.useEffect(() => {
|
|
2607
2610
|
if (state.isDragging || state.resizeStart) {
|
|
2608
2611
|
window.addEventListener("mousemove", handleMouseMove);
|
|
2609
2612
|
window.addEventListener("mouseup", handleMouseUp);
|
|
@@ -2614,7 +2617,7 @@ var WindowWithSideMenu = ({
|
|
|
2614
2617
|
document.body.style.userSelect = "";
|
|
2615
2618
|
};
|
|
2616
2619
|
}, [state.isDragging, state.resizeStart]);
|
|
2617
|
-
|
|
2620
|
+
React23.useEffect(() => {
|
|
2618
2621
|
if (windowRef.current) {
|
|
2619
2622
|
windowRef.current.addEventListener("click", () => {
|
|
2620
2623
|
if (app?.callback) {
|
|
@@ -2623,7 +2626,7 @@ var WindowWithSideMenu = ({
|
|
|
2623
2626
|
});
|
|
2624
2627
|
}
|
|
2625
2628
|
}, [app?.slug, windowRef]);
|
|
2626
|
-
|
|
2629
|
+
React23.useEffect(() => {
|
|
2627
2630
|
const handleExitApp = () => {
|
|
2628
2631
|
if (app?.callback) {
|
|
2629
2632
|
app?.callback("CLOSE_APP");
|
|
@@ -2634,7 +2637,7 @@ var WindowWithSideMenu = ({
|
|
|
2634
2637
|
removeShortcutListener("exit_app", handleExitApp);
|
|
2635
2638
|
};
|
|
2636
2639
|
}, [app?.slug, app.isActive]);
|
|
2637
|
-
|
|
2640
|
+
React23.useEffect(() => {
|
|
2638
2641
|
const handleMinimize = () => {
|
|
2639
2642
|
if (app?.slug && app.isActive) {
|
|
2640
2643
|
dispatch({
|
|
@@ -2651,7 +2654,7 @@ var WindowWithSideMenu = ({
|
|
|
2651
2654
|
removeShortcutListener("minimize_app", handleMinimize);
|
|
2652
2655
|
};
|
|
2653
2656
|
}, [app?.slug, app.isActive, state.isMinimized, state.windowSize]);
|
|
2654
|
-
|
|
2657
|
+
React23.useEffect(() => {
|
|
2655
2658
|
const handleMaximize = () => {
|
|
2656
2659
|
if (app?.slug && app.isActive) {
|
|
2657
2660
|
dispatch({
|
|
@@ -2822,7 +2825,7 @@ var WindowWithSideMenu = ({
|
|
|
2822
2825
|
style: {
|
|
2823
2826
|
maxHeight: `${state.windowSize.height - 37}px`
|
|
2824
2827
|
},
|
|
2825
|
-
children:
|
|
2828
|
+
children: React23.isValidElement(children) && typeof children.type !== "string" ? React23__namespace.default.cloneElement(children, {
|
|
2826
2829
|
windowSize: state.windowSize,
|
|
2827
2830
|
isAppWindowResizing: state.resizeStart !== null
|
|
2828
2831
|
}) : children
|
|
@@ -2928,13 +2931,13 @@ var WindowWithoutSideMenu = ({
|
|
|
2928
2931
|
removeShortcutListener,
|
|
2929
2932
|
getShortcutByCommand
|
|
2930
2933
|
} = useShortcutFormatter_default({ globalKeyboardShortcuts });
|
|
2931
|
-
const [state, dispatch] =
|
|
2934
|
+
const [state, dispatch] = React23.useReducer(reducer2, {
|
|
2932
2935
|
...initialState2,
|
|
2933
2936
|
windowSize: app.windowSize.windowSize ?? defaultSize,
|
|
2934
2937
|
defaultSize: app.windowSize.windowSize ?? defaultSize
|
|
2935
2938
|
});
|
|
2936
|
-
const windowRef =
|
|
2937
|
-
|
|
2939
|
+
const windowRef = React23.useRef(null);
|
|
2940
|
+
React23.useEffect(() => {
|
|
2938
2941
|
if (app.isMinimize !== state.isMinimized) {
|
|
2939
2942
|
dispatch({ type: "SYNC_MINIMIZE_STATE", payload: app.isMinimize });
|
|
2940
2943
|
}
|
|
@@ -2991,7 +2994,7 @@ var WindowWithoutSideMenu = ({
|
|
|
2991
2994
|
document.body.style.userSelect = "none";
|
|
2992
2995
|
dispatch({ type: "START_RESIZE", payload: { x: e.clientX, y: e.clientY } });
|
|
2993
2996
|
};
|
|
2994
|
-
|
|
2997
|
+
React23.useEffect(() => {
|
|
2995
2998
|
if (state.isDragging || state.resizeStart) {
|
|
2996
2999
|
window.addEventListener("mousemove", handleMouseMove);
|
|
2997
3000
|
window.addEventListener("mouseup", handleMouseUp);
|
|
@@ -3002,7 +3005,7 @@ var WindowWithoutSideMenu = ({
|
|
|
3002
3005
|
document.body.style.userSelect = "";
|
|
3003
3006
|
};
|
|
3004
3007
|
}, [state.isDragging, state.resizeStart]);
|
|
3005
|
-
|
|
3008
|
+
React23.useEffect(() => {
|
|
3006
3009
|
if (windowRef.current) {
|
|
3007
3010
|
windowRef.current.addEventListener("click", () => {
|
|
3008
3011
|
if (app?.callback) {
|
|
@@ -3011,7 +3014,7 @@ var WindowWithoutSideMenu = ({
|
|
|
3011
3014
|
});
|
|
3012
3015
|
}
|
|
3013
3016
|
}, [app?.slug, windowRef]);
|
|
3014
|
-
|
|
3017
|
+
React23.useEffect(() => {
|
|
3015
3018
|
const handleExitApp = () => {
|
|
3016
3019
|
if (app?.callback) {
|
|
3017
3020
|
app?.callback("CLOSE_APP");
|
|
@@ -3022,7 +3025,7 @@ var WindowWithoutSideMenu = ({
|
|
|
3022
3025
|
removeShortcutListener("exit_app", handleExitApp);
|
|
3023
3026
|
};
|
|
3024
3027
|
}, [app?.slug, app.isActive]);
|
|
3025
|
-
|
|
3028
|
+
React23.useEffect(() => {
|
|
3026
3029
|
const handleMinimize = () => {
|
|
3027
3030
|
if (app?.slug && app.isActive) {
|
|
3028
3031
|
dispatch({
|
|
@@ -3039,7 +3042,7 @@ var WindowWithoutSideMenu = ({
|
|
|
3039
3042
|
removeShortcutListener("minimize_app", handleMinimize);
|
|
3040
3043
|
};
|
|
3041
3044
|
}, [app?.slug, app.isActive, state.isMinimized, state.windowSize]);
|
|
3042
|
-
|
|
3045
|
+
React23.useEffect(() => {
|
|
3043
3046
|
const handleMaximize = () => {
|
|
3044
3047
|
if (app?.slug && app.isActive) {
|
|
3045
3048
|
dispatch({
|
|
@@ -3155,7 +3158,7 @@ var WindowWithoutSideMenu = ({
|
|
|
3155
3158
|
style: {
|
|
3156
3159
|
maxHeight: `${state.windowSize.height - 37}px`
|
|
3157
3160
|
},
|
|
3158
|
-
children:
|
|
3161
|
+
children: React23.isValidElement(children) && typeof children.type !== "string" ? React23__namespace.default.cloneElement(children, {
|
|
3159
3162
|
windowSize: state.windowSize,
|
|
3160
3163
|
isAppWindowResizing: state.resizeStart !== null
|
|
3161
3164
|
}) : children
|
|
@@ -3178,7 +3181,7 @@ var WindowWithoutSideMenu = ({
|
|
|
3178
3181
|
);
|
|
3179
3182
|
};
|
|
3180
3183
|
var WindowWithoutSideMenu_default = WindowWithoutSideMenu;
|
|
3181
|
-
var Table =
|
|
3184
|
+
var Table = React23__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3182
3185
|
"table",
|
|
3183
3186
|
{
|
|
3184
3187
|
ref,
|
|
@@ -3187,9 +3190,9 @@ var Table = React22__namespace.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
3187
3190
|
}
|
|
3188
3191
|
) }));
|
|
3189
3192
|
Table.displayName = "Table";
|
|
3190
|
-
var TableHeader =
|
|
3193
|
+
var TableHeader = React23__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: cn("[&_tr]:border-b text-neutral-400 bg-surface-2", className), ...props }));
|
|
3191
3194
|
TableHeader.displayName = "TableHeader";
|
|
3192
|
-
var TableBody =
|
|
3195
|
+
var TableBody = React23__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3193
3196
|
"tbody",
|
|
3194
3197
|
{
|
|
3195
3198
|
ref,
|
|
@@ -3198,7 +3201,7 @@ var TableBody = React22__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
3198
3201
|
}
|
|
3199
3202
|
));
|
|
3200
3203
|
TableBody.displayName = "TableBody";
|
|
3201
|
-
var TableFooter =
|
|
3204
|
+
var TableFooter = React23__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3202
3205
|
"tfoot",
|
|
3203
3206
|
{
|
|
3204
3207
|
ref,
|
|
@@ -3210,7 +3213,7 @@ var TableFooter = React22__namespace.forwardRef(({ className, ...props }, ref) =
|
|
|
3210
3213
|
}
|
|
3211
3214
|
));
|
|
3212
3215
|
TableFooter.displayName = "TableFooter";
|
|
3213
|
-
var TableRow =
|
|
3216
|
+
var TableRow = React23__namespace.forwardRef(({ className, onClick, ...props }, ref) => {
|
|
3214
3217
|
const isInteractive = typeof onClick === "function";
|
|
3215
3218
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3216
3219
|
"tr",
|
|
@@ -3227,7 +3230,7 @@ var TableRow = React22__namespace.forwardRef(({ className, onClick, ...props },
|
|
|
3227
3230
|
);
|
|
3228
3231
|
});
|
|
3229
3232
|
TableRow.displayName = "TableRow";
|
|
3230
|
-
var TableHead =
|
|
3233
|
+
var TableHead = React23__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3231
3234
|
"th",
|
|
3232
3235
|
{
|
|
3233
3236
|
ref,
|
|
@@ -3239,7 +3242,7 @@ var TableHead = React22__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
3239
3242
|
}
|
|
3240
3243
|
));
|
|
3241
3244
|
TableHead.displayName = "TableHead";
|
|
3242
|
-
var TableCell =
|
|
3245
|
+
var TableCell = React23__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3243
3246
|
"td",
|
|
3244
3247
|
{
|
|
3245
3248
|
ref,
|
|
@@ -3248,7 +3251,7 @@ var TableCell = React22__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
3248
3251
|
}
|
|
3249
3252
|
));
|
|
3250
3253
|
TableCell.displayName = "TableCell";
|
|
3251
|
-
var TableCaption =
|
|
3254
|
+
var TableCaption = React23__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3252
3255
|
"caption",
|
|
3253
3256
|
{
|
|
3254
3257
|
ref,
|
|
@@ -3258,12 +3261,12 @@ var TableCaption = React22__namespace.forwardRef(({ className, ...props }, ref)
|
|
|
3258
3261
|
));
|
|
3259
3262
|
TableCaption.displayName = "TableCaption";
|
|
3260
3263
|
var useGridClasses = (windowSize, gridRules) => {
|
|
3261
|
-
const deviceType =
|
|
3264
|
+
const deviceType = React23.useMemo(() => {
|
|
3262
3265
|
if (windowSize.width <= 640) return "mobile";
|
|
3263
3266
|
if (windowSize.width <= 1024) return "tablet";
|
|
3264
3267
|
return "desktop";
|
|
3265
3268
|
}, [windowSize]);
|
|
3266
|
-
const gridClasses =
|
|
3269
|
+
const gridClasses = React23.useMemo(() => {
|
|
3267
3270
|
const classes = {};
|
|
3268
3271
|
for (const element in gridRules) {
|
|
3269
3272
|
const classRules = gridRules[element] ?? {};
|
|
@@ -3276,8 +3279,8 @@ var useGridClasses = (windowSize, gridRules) => {
|
|
|
3276
3279
|
};
|
|
3277
3280
|
var useGridClasses_default = useGridClasses;
|
|
3278
3281
|
var useDeviceSupport = () => {
|
|
3279
|
-
const [isSupported, setIsSupported] =
|
|
3280
|
-
|
|
3282
|
+
const [isSupported, setIsSupported] = React23.useState(true);
|
|
3283
|
+
React23.useEffect(() => {
|
|
3281
3284
|
function checkSupport() {
|
|
3282
3285
|
const ua = typeof window !== "undefined" ? window.navigator.userAgent : "";
|
|
3283
3286
|
const width = typeof window !== "undefined" ? window.innerWidth : 1920;
|
|
@@ -3403,7 +3406,7 @@ var useSound = () => {
|
|
|
3403
3406
|
audio.currentTime = 0;
|
|
3404
3407
|
await audio.play();
|
|
3405
3408
|
};
|
|
3406
|
-
const playSound =
|
|
3409
|
+
const playSound = React23.useCallback((type) => {
|
|
3407
3410
|
if (typeof window === "undefined") {
|
|
3408
3411
|
return;
|
|
3409
3412
|
}
|