@noya-app/noya-designsystem 0.1.89 → 0.1.91
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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +16 -0
- package/dist/index.css +1 -1
- package/dist/index.d.mts +18 -3
- package/dist/index.d.ts +18 -3
- package/dist/index.js +119 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +151 -73
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/components/BaseToolbar.tsx +3 -1
- package/src/components/Dialog.tsx +4 -1
- package/src/components/OverlayToolbar.tsx +87 -1
- package/src/components/__tests__/BaseToolbar.test.tsx +22 -0
- package/src/components/__tests__/DialogNavigator.test.tsx +13 -0
- package/src/components/__tests__/OverlayToolbar.test.tsx +63 -0
- package/src/components/workspace/DrawerWorkspaceLayout.tsx +1 -1
- package/src/components/workspace/WorkspaceLayout.tsx +19 -2
- package/src/components/workspace/__tests__/DrawerWorkspaceLayout.test.tsx +6 -1
- package/src/components/workspace/__tests__/WorkspaceLayout.test.tsx +41 -0
package/dist/index.mjs
CHANGED
|
@@ -17,11 +17,11 @@ var require_use_sync_external_store_shim_production = __commonJS({
|
|
|
17
17
|
var objectIs = "function" === typeof Object.is ? Object.is : is;
|
|
18
18
|
var useState80 = React325.useState;
|
|
19
19
|
var useEffect61 = React325.useEffect;
|
|
20
|
-
var
|
|
20
|
+
var useLayoutEffect13 = React325.useLayoutEffect;
|
|
21
21
|
var useDebugValue2 = React325.useDebugValue;
|
|
22
22
|
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
23
23
|
var value = getSnapshot(), _useState = useState80({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
24
|
-
|
|
24
|
+
useLayoutEffect13(
|
|
25
25
|
function() {
|
|
26
26
|
inst.value = value;
|
|
27
27
|
inst.getSnapshot = getSnapshot;
|
|
@@ -82,7 +82,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
82
82
|
inst: { value, getSnapshot }
|
|
83
83
|
});
|
|
84
84
|
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
85
|
-
|
|
85
|
+
useLayoutEffect13(
|
|
86
86
|
function() {
|
|
87
87
|
inst.value = value;
|
|
88
88
|
inst.getSnapshot = getSnapshot;
|
|
@@ -116,7 +116,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
116
116
|
return getSnapshot();
|
|
117
117
|
}
|
|
118
118
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
119
|
-
var React325 = __require("react"), objectIs = "function" === typeof Object.is ? Object.is : is, useState80 = React325.useState, useEffect61 = React325.useEffect,
|
|
119
|
+
var React325 = __require("react"), objectIs = "function" === typeof Object.is ? Object.is : is, useState80 = React325.useState, useEffect61 = React325.useEffect, useLayoutEffect13 = React325.useLayoutEffect, useDebugValue2 = React325.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
120
120
|
exports.useSyncExternalStore = void 0 !== React325.useSyncExternalStore ? React325.useSyncExternalStore : shim;
|
|
121
121
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
122
122
|
}();
|
|
@@ -146,12 +146,12 @@ var require_with_selector_production = __commonJS({
|
|
|
146
146
|
}
|
|
147
147
|
var objectIs = "function" === typeof Object.is ? Object.is : is;
|
|
148
148
|
var useSyncExternalStore3 = shim.useSyncExternalStore;
|
|
149
|
-
var
|
|
149
|
+
var useRef95 = React325.useRef;
|
|
150
150
|
var useEffect61 = React325.useEffect;
|
|
151
151
|
var useMemo156 = React325.useMemo;
|
|
152
152
|
var useDebugValue2 = React325.useDebugValue;
|
|
153
153
|
exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
154
|
-
var instRef =
|
|
154
|
+
var instRef = useRef95(null);
|
|
155
155
|
if (null === instRef.current) {
|
|
156
156
|
var inst = { hasValue: false, value: null };
|
|
157
157
|
instRef.current = inst;
|
|
@@ -213,9 +213,9 @@ var require_with_selector_development = __commonJS({
|
|
|
213
213
|
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
214
214
|
}
|
|
215
215
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
216
|
-
var React325 = __require("react"), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore,
|
|
216
|
+
var React325 = __require("react"), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore, useRef95 = React325.useRef, useEffect61 = React325.useEffect, useMemo156 = React325.useMemo, useDebugValue2 = React325.useDebugValue;
|
|
217
217
|
exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
218
|
-
var instRef =
|
|
218
|
+
var instRef = useRef95(null);
|
|
219
219
|
if (null === instRef.current) {
|
|
220
220
|
var inst = { hasValue: false, value: null };
|
|
221
221
|
instRef.current = inst;
|
|
@@ -19692,7 +19692,10 @@ var StyledBackdrop = forwardRef49(({ className, ...props }, ref) => /* @__PURE__
|
|
|
19692
19692
|
index_parts_exports4.Backdrop,
|
|
19693
19693
|
{
|
|
19694
19694
|
ref,
|
|
19695
|
-
className: cx(
|
|
19695
|
+
className: cx(
|
|
19696
|
+
`n-fixed n-inset-0 n-z-[999] n-bg-[rgba(0,0,0,0.5)]`,
|
|
19697
|
+
className
|
|
19698
|
+
),
|
|
19696
19699
|
...props
|
|
19697
19700
|
}
|
|
19698
19701
|
));
|
|
@@ -30729,6 +30732,7 @@ function BaseToolbar({
|
|
|
30729
30732
|
left,
|
|
30730
30733
|
right,
|
|
30731
30734
|
logo,
|
|
30735
|
+
showLogoDivider = true,
|
|
30732
30736
|
showDivider = true,
|
|
30733
30737
|
className,
|
|
30734
30738
|
innerClassName,
|
|
@@ -30749,7 +30753,7 @@ function BaseToolbar({
|
|
|
30749
30753
|
innerClassName,
|
|
30750
30754
|
enableAbsoluteBreakpoint
|
|
30751
30755
|
},
|
|
30752
|
-
logo && /* @__PURE__ */ React229.createElement(React229.Fragment, null, logo, /* @__PURE__ */ React229.createElement(DividerVertical, null)),
|
|
30756
|
+
logo && /* @__PURE__ */ React229.createElement(React229.Fragment, null, logo, showLogoDivider && /* @__PURE__ */ React229.createElement(DividerVertical, null)),
|
|
30753
30757
|
/* @__PURE__ */ React229.createElement(Spacer.Horizontal, { size: 10 }),
|
|
30754
30758
|
leftElement && !enableContainerQuery && /* @__PURE__ */ React229.createElement(React229.Fragment, null, leftElement, childrenElement && /* @__PURE__ */ React229.createElement(Spacer.Horizontal, { size: 10 })),
|
|
30755
30759
|
childrenElement,
|
|
@@ -41580,23 +41584,28 @@ var UserPointer = memo38(function UserPointer2({
|
|
|
41580
41584
|
import { useKeyboardShortcuts as useKeyboardShortcuts4 } from "@noya-app/noya-keymap";
|
|
41581
41585
|
import React321, {
|
|
41582
41586
|
memo as memo40,
|
|
41583
|
-
useCallback as
|
|
41587
|
+
useCallback as useCallback75,
|
|
41584
41588
|
useImperativeHandle as useImperativeHandle18,
|
|
41585
41589
|
useMemo as useMemo154,
|
|
41586
|
-
useRef as
|
|
41590
|
+
useRef as useRef94
|
|
41587
41591
|
} from "react";
|
|
41588
41592
|
|
|
41589
41593
|
// src/components/OverlayToolbar.tsx
|
|
41590
|
-
import React312, { useMemo as useMemo150 } from "react";
|
|
41594
|
+
import React312, { useCallback as useCallback71, useLayoutEffect as useLayoutEffect12, useMemo as useMemo150, useRef as useRef90 } from "react";
|
|
41591
41595
|
var panelClassName = "n-pointer-events-auto n-inline-flex n-items-center n-gap-toolbar-separator n-rounded-3xl n-border n-border-divider n-bg-sidebar-background n-px-3 n-py-2.5 n-shadow-2xl";
|
|
41592
41596
|
function OverlayToolbar({
|
|
41593
41597
|
left,
|
|
41594
41598
|
right,
|
|
41595
41599
|
overlayLayout = "bottomCenterTopRight",
|
|
41596
41600
|
className,
|
|
41597
|
-
style: style2
|
|
41601
|
+
style: style2,
|
|
41602
|
+
onRectsChange
|
|
41598
41603
|
}) {
|
|
41599
41604
|
const resolvedLayout = overlayLayout === "topLeftTopRight" ? "topLeftTopRight" : "bottomCenterTopRight";
|
|
41605
|
+
const leftPanelRef = useRef90(null);
|
|
41606
|
+
const rightPanelRef = useRef90(null);
|
|
41607
|
+
const hasLeft = Boolean(left);
|
|
41608
|
+
const hasRight = Boolean(right);
|
|
41600
41609
|
const panelStyle = useMemo150(
|
|
41601
41610
|
() => ({
|
|
41602
41611
|
...toolbarTransparentStyle,
|
|
@@ -41604,11 +41613,68 @@ function OverlayToolbar({
|
|
|
41604
41613
|
}),
|
|
41605
41614
|
[style2]
|
|
41606
41615
|
);
|
|
41616
|
+
const emitRects = useCallback71(() => {
|
|
41617
|
+
if (!onRectsChange) return;
|
|
41618
|
+
const panels = [
|
|
41619
|
+
{
|
|
41620
|
+
id: resolvedLayout === "topLeftTopRight" ? "noya-toolbar-top-left" : "noya-toolbar-bottom-center",
|
|
41621
|
+
element: leftPanelRef.current
|
|
41622
|
+
},
|
|
41623
|
+
{
|
|
41624
|
+
id: "noya-toolbar-top-right",
|
|
41625
|
+
element: rightPanelRef.current
|
|
41626
|
+
}
|
|
41627
|
+
];
|
|
41628
|
+
onRectsChange(
|
|
41629
|
+
panels.flatMap(({ id, element }) => {
|
|
41630
|
+
if (!element) return [];
|
|
41631
|
+
const rect = element.getBoundingClientRect();
|
|
41632
|
+
const containerRect = element.closest("[data-workspace-content]")?.getBoundingClientRect();
|
|
41633
|
+
return [
|
|
41634
|
+
{
|
|
41635
|
+
id,
|
|
41636
|
+
rect: {
|
|
41637
|
+
x: rect.x - (containerRect?.x ?? 0),
|
|
41638
|
+
y: rect.y - (containerRect?.y ?? 0),
|
|
41639
|
+
width: rect.width,
|
|
41640
|
+
height: rect.height
|
|
41641
|
+
}
|
|
41642
|
+
}
|
|
41643
|
+
];
|
|
41644
|
+
})
|
|
41645
|
+
);
|
|
41646
|
+
}, [onRectsChange, resolvedLayout]);
|
|
41647
|
+
useLayoutEffect12(() => {
|
|
41648
|
+
if (!onRectsChange) return;
|
|
41649
|
+
let animationFrame;
|
|
41650
|
+
const scheduleEmit = () => {
|
|
41651
|
+
if (animationFrame !== void 0) {
|
|
41652
|
+
cancelAnimationFrame(animationFrame);
|
|
41653
|
+
}
|
|
41654
|
+
animationFrame = requestAnimationFrame(emitRects);
|
|
41655
|
+
};
|
|
41656
|
+
emitRects();
|
|
41657
|
+
const resizeObserver = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(scheduleEmit);
|
|
41658
|
+
const panels = [leftPanelRef.current, rightPanelRef.current];
|
|
41659
|
+
panels.forEach((panel) => panel && resizeObserver?.observe(panel));
|
|
41660
|
+
window.addEventListener("resize", scheduleEmit);
|
|
41661
|
+
window.addEventListener("scroll", scheduleEmit, true);
|
|
41662
|
+
return () => {
|
|
41663
|
+
if (animationFrame !== void 0) {
|
|
41664
|
+
cancelAnimationFrame(animationFrame);
|
|
41665
|
+
}
|
|
41666
|
+
resizeObserver?.disconnect();
|
|
41667
|
+
window.removeEventListener("resize", scheduleEmit);
|
|
41668
|
+
window.removeEventListener("scroll", scheduleEmit, true);
|
|
41669
|
+
onRectsChange([]);
|
|
41670
|
+
};
|
|
41671
|
+
}, [emitRects, hasLeft, hasRight, onRectsChange]);
|
|
41607
41672
|
const renderLeftPanel = (overlayId) => {
|
|
41608
41673
|
if (!left) return null;
|
|
41609
41674
|
return /* @__PURE__ */ React312.createElement(
|
|
41610
41675
|
"div",
|
|
41611
41676
|
{
|
|
41677
|
+
ref: leftPanelRef,
|
|
41612
41678
|
className: panelClassName,
|
|
41613
41679
|
"data-embedded-overlay-id": overlayId,
|
|
41614
41680
|
style: panelStyle
|
|
@@ -41645,6 +41711,7 @@ function OverlayToolbar({
|
|
|
41645
41711
|
/* @__PURE__ */ React312.createElement(
|
|
41646
41712
|
"div",
|
|
41647
41713
|
{
|
|
41714
|
+
ref: rightPanelRef,
|
|
41648
41715
|
className: panelClassName,
|
|
41649
41716
|
"data-embedded-overlay-id": "noya-toolbar-top-right",
|
|
41650
41717
|
style: panelStyle
|
|
@@ -42103,7 +42170,7 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
|
42103
42170
|
}
|
|
42104
42171
|
)
|
|
42105
42172
|
), /* @__PURE__ */ React315.createElement(Divider, null)),
|
|
42106
|
-
compactTabItem && /* @__PURE__ */ React315.createElement("div", { className: "n-absolute n-top-0 n-left-0 n-h-[calc(var(--n-toolbar-height)+1px)] n-w-[calc(var(--n-toolbar-height)+1px)] n-bg-sidebar-background n-border-
|
|
42173
|
+
compactTabItem && /* @__PURE__ */ React315.createElement("div", { className: "n-absolute n-top-0 n-left-0 n-h-[calc(var(--n-toolbar-height)+1px)] n-w-[calc(var(--n-toolbar-height)+1px)] n-bg-sidebar-background n-border-b n-border-divider-strong n-z-10 n-flex n-items-center n-justify-center" }, /* @__PURE__ */ React315.createElement(
|
|
42107
42174
|
Button,
|
|
42108
42175
|
{
|
|
42109
42176
|
"aria-label": typeof compactTabItem.title === "string" ? compactTabItem.title : "Toggle sidebar",
|
|
@@ -42124,7 +42191,7 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
|
42124
42191
|
});
|
|
42125
42192
|
|
|
42126
42193
|
// src/components/workspace/PanelWorkspaceLayout.tsx
|
|
42127
|
-
import React320, { useCallback as
|
|
42194
|
+
import React320, { useCallback as useCallback74, useMemo as useMemo153, useRef as useRef93, useState as useState78 } from "react";
|
|
42128
42195
|
|
|
42129
42196
|
// src/components/resizablePanels/Panel.tsx
|
|
42130
42197
|
import React316, {
|
|
@@ -42227,11 +42294,11 @@ var Panel = forwardRef127(
|
|
|
42227
42294
|
// src/components/resizablePanels/PanelGroup.tsx
|
|
42228
42295
|
import React317, {
|
|
42229
42296
|
forwardRef as forwardRef128,
|
|
42230
|
-
useCallback as
|
|
42297
|
+
useCallback as useCallback72,
|
|
42231
42298
|
useEffect as useEffect59,
|
|
42232
42299
|
useImperativeHandle as useImperativeHandle17,
|
|
42233
42300
|
useMemo as useMemo152,
|
|
42234
|
-
useRef as
|
|
42301
|
+
useRef as useRef91,
|
|
42235
42302
|
useState as useState77
|
|
42236
42303
|
} from "react";
|
|
42237
42304
|
function getStorageKey(autoSaveId) {
|
|
@@ -42253,11 +42320,11 @@ function saveSizes(autoSaveId, sizes) {
|
|
|
42253
42320
|
}
|
|
42254
42321
|
var PanelGroup = forwardRef128(
|
|
42255
42322
|
function PanelGroup2({ id, className, direction, autoSaveId, onLayout, children }, ref) {
|
|
42256
|
-
const containerRef =
|
|
42323
|
+
const containerRef = useRef91(null);
|
|
42257
42324
|
const containerSize = useSize(containerRef);
|
|
42258
42325
|
const containerWidth = containerSize?.width ?? 0;
|
|
42259
42326
|
const [panels, setPanels] = useState77(/* @__PURE__ */ new Map());
|
|
42260
|
-
const panelsRef =
|
|
42327
|
+
const panelsRef = useRef91(panels);
|
|
42261
42328
|
panelsRef.current = panels;
|
|
42262
42329
|
const [resizing, setResizing] = useState77(null);
|
|
42263
42330
|
const sortedPanels = useMemo152(() => {
|
|
@@ -42271,7 +42338,7 @@ var PanelGroup = forwardRef128(
|
|
|
42271
42338
|
}
|
|
42272
42339
|
return null;
|
|
42273
42340
|
}, [sortedPanels]);
|
|
42274
|
-
const calculateLayout =
|
|
42341
|
+
const calculateLayout = useCallback72(
|
|
42275
42342
|
(panelStates, width) => {
|
|
42276
42343
|
if (width === 0) return panelStates;
|
|
42277
42344
|
const sorted = Array.from(panelStates.values()).sort(
|
|
@@ -42307,7 +42374,7 @@ var PanelGroup = forwardRef128(
|
|
|
42307
42374
|
onLayout(sizes);
|
|
42308
42375
|
}
|
|
42309
42376
|
}, [onLayout, sortedPanels]);
|
|
42310
|
-
const registerPanel =
|
|
42377
|
+
const registerPanel = useCallback72(
|
|
42311
42378
|
(panel) => {
|
|
42312
42379
|
setPanels((prev) => {
|
|
42313
42380
|
const savedSizes = loadSavedSizes(autoSaveId);
|
|
@@ -42332,26 +42399,26 @@ var PanelGroup = forwardRef128(
|
|
|
42332
42399
|
},
|
|
42333
42400
|
[autoSaveId, calculateLayout, containerWidth]
|
|
42334
42401
|
);
|
|
42335
|
-
const unregisterPanel =
|
|
42402
|
+
const unregisterPanel = useCallback72((panelId) => {
|
|
42336
42403
|
setPanels((prev) => {
|
|
42337
42404
|
const newPanels = new Map(prev);
|
|
42338
42405
|
newPanels.delete(panelId);
|
|
42339
42406
|
return newPanels;
|
|
42340
42407
|
});
|
|
42341
42408
|
}, []);
|
|
42342
|
-
const getPanelSize =
|
|
42409
|
+
const getPanelSize = useCallback72(
|
|
42343
42410
|
(panelId) => {
|
|
42344
42411
|
return panels.get(panelId)?.size ?? 0;
|
|
42345
42412
|
},
|
|
42346
42413
|
[panels]
|
|
42347
42414
|
);
|
|
42348
|
-
const getPanelIndex =
|
|
42415
|
+
const getPanelIndex = useCallback72(
|
|
42349
42416
|
(panelId) => {
|
|
42350
42417
|
return sortedPanels.findIndex((p) => p.id === panelId);
|
|
42351
42418
|
},
|
|
42352
42419
|
[sortedPanels]
|
|
42353
42420
|
);
|
|
42354
|
-
const setPanelSize =
|
|
42421
|
+
const setPanelSize = useCallback72(
|
|
42355
42422
|
(panelId, size4) => {
|
|
42356
42423
|
setPanels((prev) => {
|
|
42357
42424
|
const panel = prev.get(panelId);
|
|
@@ -42379,7 +42446,7 @@ var PanelGroup = forwardRef128(
|
|
|
42379
42446
|
},
|
|
42380
42447
|
[autoSaveId, calculateLayout, containerWidth]
|
|
42381
42448
|
);
|
|
42382
|
-
const expandPanel =
|
|
42449
|
+
const expandPanel = useCallback72(
|
|
42383
42450
|
(panelId) => {
|
|
42384
42451
|
setPanels((prev) => {
|
|
42385
42452
|
const panel = prev.get(panelId);
|
|
@@ -42404,7 +42471,7 @@ var PanelGroup = forwardRef128(
|
|
|
42404
42471
|
},
|
|
42405
42472
|
[autoSaveId, calculateLayout, containerWidth]
|
|
42406
42473
|
);
|
|
42407
|
-
const collapsePanel =
|
|
42474
|
+
const collapsePanel = useCallback72(
|
|
42408
42475
|
(panelId) => {
|
|
42409
42476
|
setPanels((prev) => {
|
|
42410
42477
|
const panel = prev.get(panelId);
|
|
@@ -42428,14 +42495,14 @@ var PanelGroup = forwardRef128(
|
|
|
42428
42495
|
},
|
|
42429
42496
|
[autoSaveId, calculateLayout, containerWidth]
|
|
42430
42497
|
);
|
|
42431
|
-
const isPanelExpanded =
|
|
42498
|
+
const isPanelExpanded = useCallback72(
|
|
42432
42499
|
(panelId) => {
|
|
42433
42500
|
const panel = panels.get(panelId);
|
|
42434
42501
|
return panel ? !panel.collapsed : false;
|
|
42435
42502
|
},
|
|
42436
42503
|
[panels]
|
|
42437
42504
|
);
|
|
42438
|
-
const startResize =
|
|
42505
|
+
const startResize = useCallback72(
|
|
42439
42506
|
(handleIndex, startX) => {
|
|
42440
42507
|
const startSizes = sortedPanels.map((p) => p.size);
|
|
42441
42508
|
setResizing({
|
|
@@ -42597,15 +42664,15 @@ var PanelGroup = forwardRef128(
|
|
|
42597
42664
|
);
|
|
42598
42665
|
|
|
42599
42666
|
// src/components/resizablePanels/PanelResizeHandle.tsx
|
|
42600
|
-
import React318, { useCallback as
|
|
42667
|
+
import React318, { useCallback as useCallback73, useContext as useContext65, useRef as useRef92 } from "react";
|
|
42601
42668
|
function PanelResizeHandle({
|
|
42602
42669
|
className,
|
|
42603
42670
|
disabled: disabled2,
|
|
42604
42671
|
index: index2
|
|
42605
42672
|
}) {
|
|
42606
42673
|
const context = useContext65(PanelGroupContext);
|
|
42607
|
-
const handleRef =
|
|
42608
|
-
const handleMouseDown =
|
|
42674
|
+
const handleRef = useRef92(null);
|
|
42675
|
+
const handleMouseDown = useCallback73(
|
|
42609
42676
|
(e) => {
|
|
42610
42677
|
if (disabled2 || !context) return;
|
|
42611
42678
|
e.preventDefault();
|
|
@@ -42691,8 +42758,8 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42691
42758
|
onRightSidebarStateChange,
|
|
42692
42759
|
shouldAutoSave = true
|
|
42693
42760
|
}) {
|
|
42694
|
-
const panelGroupRef =
|
|
42695
|
-
const containerRef =
|
|
42761
|
+
const panelGroupRef = useRef93(null);
|
|
42762
|
+
const containerRef = useRef93(null);
|
|
42696
42763
|
const autoSaveId = useMemo153(() => {
|
|
42697
42764
|
if (!shouldAutoSave) return void 0;
|
|
42698
42765
|
return autoSavePrefix ? `${autoSavePrefix}--v5--${EDITOR_PANEL_GROUP_ID}` : Math.random().toString(36).substring(2, 15);
|
|
@@ -42703,9 +42770,9 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42703
42770
|
const [rightSidebarCollapsed, setRightSidebarCollapsed] = useState78(
|
|
42704
42771
|
rightSidebarOptions.defaultCollapsed ?? false
|
|
42705
42772
|
);
|
|
42706
|
-
const prevLeftSidebarState =
|
|
42707
|
-
const prevRightSidebarState =
|
|
42708
|
-
const handleLayoutChange =
|
|
42773
|
+
const prevLeftSidebarState = useRef93(null);
|
|
42774
|
+
const prevRightSidebarState = useRef93(null);
|
|
42775
|
+
const handleLayoutChange = useCallback74(
|
|
42709
42776
|
(sizes) => {
|
|
42710
42777
|
const leftIndex = leftPanel ? 0 : -1;
|
|
42711
42778
|
const rightIndex = rightPanel ? leftPanel ? 2 : 1 : -1;
|
|
@@ -42736,7 +42803,7 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42736
42803
|
},
|
|
42737
42804
|
[leftPanel, rightPanel, onLeftSidebarStateChange, onRightSidebarStateChange]
|
|
42738
42805
|
);
|
|
42739
|
-
const handleLeftTabChange =
|
|
42806
|
+
const handleLeftTabChange = useCallback74(
|
|
42740
42807
|
(value) => {
|
|
42741
42808
|
if (value === leftTabValue) {
|
|
42742
42809
|
if (leftSidebarRef.current?.isExpanded()) {
|
|
@@ -42753,7 +42820,7 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42753
42820
|
},
|
|
42754
42821
|
[leftSidebarRef, leftTabValue, onChangeLeftTab]
|
|
42755
42822
|
);
|
|
42756
|
-
const handleRightTabChange =
|
|
42823
|
+
const handleRightTabChange = useCallback74(
|
|
42757
42824
|
(value) => {
|
|
42758
42825
|
if (value === rightTabValue) {
|
|
42759
42826
|
if (rightSidebarRef.current?.isExpanded()) {
|
|
@@ -42900,6 +42967,8 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42900
42967
|
overlayToolbarLeft,
|
|
42901
42968
|
overlayToolbarRight,
|
|
42902
42969
|
overlayLayout,
|
|
42970
|
+
contentTopInset = 0,
|
|
42971
|
+
onOverlayToolbarRectsChange,
|
|
42903
42972
|
children,
|
|
42904
42973
|
sideType = "auto",
|
|
42905
42974
|
sideTypeBreakpoint = 800,
|
|
@@ -42948,8 +43017,8 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42948
43017
|
const rightSidebarMinPixels = toPixels(rightMinSize);
|
|
42949
43018
|
const rightSidebarMaxPixels = toPixels(rightMaxSize);
|
|
42950
43019
|
const rightSidebarInitialPixels = toPixels(rightInitialSize) ?? 280;
|
|
42951
|
-
const leftSidebarRef =
|
|
42952
|
-
const rightSidebarRef =
|
|
43020
|
+
const leftSidebarRef = useRef94(null);
|
|
43021
|
+
const rightSidebarRef = useRef94(null);
|
|
42953
43022
|
const [leftTabValue, setLeftTabValue] = useControlledOrUncontrolled({
|
|
42954
43023
|
value: leftTabValueProp,
|
|
42955
43024
|
onChange: onChangeLeftTab,
|
|
@@ -43017,12 +43086,12 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
43017
43086
|
}
|
|
43018
43087
|
});
|
|
43019
43088
|
const isDrawerActive = sideType === "drawer" || sideType === "auto" && parentSize.width <= sideTypeBreakpoint;
|
|
43020
|
-
const closeLeftSidebar =
|
|
43089
|
+
const closeLeftSidebar = useCallback75(() => {
|
|
43021
43090
|
if (isDrawerActive) {
|
|
43022
43091
|
leftSidebarRef.current?.collapse();
|
|
43023
43092
|
}
|
|
43024
43093
|
}, [isDrawerActive]);
|
|
43025
|
-
const closeRightSidebar =
|
|
43094
|
+
const closeRightSidebar = useCallback75(() => {
|
|
43026
43095
|
if (isDrawerActive) {
|
|
43027
43096
|
rightSidebarRef.current?.collapse();
|
|
43028
43097
|
}
|
|
@@ -43118,36 +43187,45 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
43118
43187
|
"data-theme": theme
|
|
43119
43188
|
},
|
|
43120
43189
|
!isOverlay && toolbar,
|
|
43121
|
-
/* @__PURE__ */ React321.createElement(
|
|
43122
|
-
|
|
43123
|
-
{
|
|
43124
|
-
leftPanel,
|
|
43125
|
-
rightPanel,
|
|
43126
|
-
centerPanel,
|
|
43127
|
-
leftTabItems,
|
|
43128
|
-
leftTabValue,
|
|
43129
|
-
onChangeLeftTab: setLeftTabValue,
|
|
43130
|
-
rightTabItems,
|
|
43131
|
-
rightTabValue,
|
|
43132
|
-
onChangeRightTab: setRightTabValue,
|
|
43133
|
-
leftSidebarOptions,
|
|
43134
|
-
rightSidebarOptions,
|
|
43135
|
-
autoSavePrefix,
|
|
43136
|
-
leftSidebarRef,
|
|
43137
|
-
rightSidebarRef,
|
|
43138
|
-
compactDrawerMenu,
|
|
43139
|
-
onLeftSidebarStateChange,
|
|
43140
|
-
onRightSidebarStateChange,
|
|
43141
|
-
shouldAutoSave
|
|
43142
|
-
}
|
|
43143
|
-
), isOverlay && /* @__PURE__ */ React321.createElement(
|
|
43144
|
-
OverlayToolbar,
|
|
43190
|
+
/* @__PURE__ */ React321.createElement(
|
|
43191
|
+
"div",
|
|
43145
43192
|
{
|
|
43146
|
-
|
|
43147
|
-
|
|
43148
|
-
|
|
43149
|
-
}
|
|
43150
|
-
|
|
43193
|
+
className: "n-flex n-flex-row n-flex-1 n-min-h-0 n-relative",
|
|
43194
|
+
"data-workspace-content": true,
|
|
43195
|
+
style: contentTopInset > 0 ? { paddingTop: contentTopInset } : void 0
|
|
43196
|
+
},
|
|
43197
|
+
readyToRender && /* @__PURE__ */ React321.createElement(React321.Fragment, null, /* @__PURE__ */ React321.createElement(
|
|
43198
|
+
LayoutComponent,
|
|
43199
|
+
{
|
|
43200
|
+
leftPanel,
|
|
43201
|
+
rightPanel,
|
|
43202
|
+
centerPanel,
|
|
43203
|
+
leftTabItems,
|
|
43204
|
+
leftTabValue,
|
|
43205
|
+
onChangeLeftTab: setLeftTabValue,
|
|
43206
|
+
rightTabItems,
|
|
43207
|
+
rightTabValue,
|
|
43208
|
+
onChangeRightTab: setRightTabValue,
|
|
43209
|
+
leftSidebarOptions,
|
|
43210
|
+
rightSidebarOptions,
|
|
43211
|
+
autoSavePrefix,
|
|
43212
|
+
leftSidebarRef,
|
|
43213
|
+
rightSidebarRef,
|
|
43214
|
+
compactDrawerMenu,
|
|
43215
|
+
onLeftSidebarStateChange,
|
|
43216
|
+
onRightSidebarStateChange,
|
|
43217
|
+
shouldAutoSave
|
|
43218
|
+
}
|
|
43219
|
+
), isOverlay && /* @__PURE__ */ React321.createElement(
|
|
43220
|
+
OverlayToolbar,
|
|
43221
|
+
{
|
|
43222
|
+
left: overlayToolbarLeft,
|
|
43223
|
+
right: overlayToolbarRight,
|
|
43224
|
+
overlayLayout,
|
|
43225
|
+
onRectsChange: onOverlayToolbarRectsChange
|
|
43226
|
+
}
|
|
43227
|
+
))
|
|
43228
|
+
)
|
|
43151
43229
|
);
|
|
43152
43230
|
});
|
|
43153
43231
|
var PanelInner = memo40(function PanelInner2({
|