@noya-app/noya-designsystem 0.1.81 → 0.1.83
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 +37 -38
- package/.turbo/turbo-lint.log +1 -15
- package/CHANGELOG.md +15 -0
- package/dist/index.css +1 -1
- package/dist/index.d.mts +43 -13
- package/dist/index.d.ts +43 -13
- package/dist/index.js +682 -469
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +608 -389
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -5
- package/src/components/Drawer.tsx +8 -5
- package/src/components/EmojiPicker.tsx +13 -1
- package/src/components/Popover.tsx +8 -6
- package/src/components/SegmentedControl.tsx +237 -42
- package/src/components/SelectionToolbar.tsx +88 -71
- package/src/components/resizablePanels/Panel.tsx +22 -2
- package/src/components/resizablePanels/PanelGroup.tsx +15 -8
- package/src/components/workspace/DrawerWorkspaceLayout.tsx +131 -152
- package/src/components/workspace/HorizontalTabBar.tsx +43 -0
- package/src/components/workspace/PanelWorkspaceLayout.tsx +112 -54
- package/src/components/workspace/WorkspaceLayout.tsx +19 -5
- package/src/components/workspace/types.ts +17 -5
- package/src/index.css +12 -2
- package/src/utils/mergeProps.ts +38 -0
- package/dist/chunk-D57E6H3M.mjs +0 -36
- package/dist/chunk-D57E6H3M.mjs.map +0 -1
- package/dist/chunk-FJ6ZGZIA.mjs +0 -43
- package/dist/chunk-FJ6ZGZIA.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -15,12 +15,12 @@ var require_use_sync_external_store_shim_production = __commonJS({
|
|
|
15
15
|
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
16
16
|
}
|
|
17
17
|
var objectIs = "function" === typeof Object.is ? Object.is : is;
|
|
18
|
-
var
|
|
19
|
-
var
|
|
18
|
+
var useState80 = React321.useState;
|
|
19
|
+
var useEffect61 = React321.useEffect;
|
|
20
20
|
var useLayoutEffect12 = React321.useLayoutEffect;
|
|
21
21
|
var useDebugValue2 = React321.useDebugValue;
|
|
22
22
|
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
23
|
-
var value = getSnapshot(), _useState =
|
|
23
|
+
var value = getSnapshot(), _useState = useState80({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
24
24
|
useLayoutEffect12(
|
|
25
25
|
function() {
|
|
26
26
|
inst.value = value;
|
|
@@ -29,7 +29,7 @@ var require_use_sync_external_store_shim_production = __commonJS({
|
|
|
29
29
|
},
|
|
30
30
|
[subscribe, value, getSnapshot]
|
|
31
31
|
);
|
|
32
|
-
|
|
32
|
+
useEffect61(
|
|
33
33
|
function() {
|
|
34
34
|
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
35
35
|
return subscribe(function() {
|
|
@@ -78,7 +78,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
78
78
|
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
79
79
|
), didWarnUncachedGetSnapshot = true);
|
|
80
80
|
}
|
|
81
|
-
cachedValue =
|
|
81
|
+
cachedValue = useState80({
|
|
82
82
|
inst: { value, getSnapshot }
|
|
83
83
|
});
|
|
84
84
|
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
@@ -90,7 +90,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
90
90
|
},
|
|
91
91
|
[subscribe, value, getSnapshot]
|
|
92
92
|
);
|
|
93
|
-
|
|
93
|
+
useEffect61(
|
|
94
94
|
function() {
|
|
95
95
|
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
96
96
|
return subscribe(function() {
|
|
@@ -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 React321 = __require("react"), objectIs = "function" === typeof Object.is ? Object.is : is,
|
|
119
|
+
var React321 = __require("react"), objectIs = "function" === typeof Object.is ? Object.is : is, useState80 = React321.useState, useEffect61 = React321.useEffect, useLayoutEffect12 = React321.useLayoutEffect, useDebugValue2 = React321.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 !== React321.useSyncExternalStore ? React321.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,17 +146,17 @@ 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
|
|
150
|
-
var
|
|
151
|
-
var
|
|
149
|
+
var useRef94 = React321.useRef;
|
|
150
|
+
var useEffect61 = React321.useEffect;
|
|
151
|
+
var useMemo156 = React321.useMemo;
|
|
152
152
|
var useDebugValue2 = React321.useDebugValue;
|
|
153
153
|
exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
154
|
-
var instRef =
|
|
154
|
+
var instRef = useRef94(null);
|
|
155
155
|
if (null === instRef.current) {
|
|
156
156
|
var inst = { hasValue: false, value: null };
|
|
157
157
|
instRef.current = inst;
|
|
158
158
|
} else inst = instRef.current;
|
|
159
|
-
instRef =
|
|
159
|
+
instRef = useMemo156(
|
|
160
160
|
function() {
|
|
161
161
|
function memoizedSelector(nextSnapshot) {
|
|
162
162
|
if (!hasMemo) {
|
|
@@ -191,7 +191,7 @@ var require_with_selector_production = __commonJS({
|
|
|
191
191
|
[getSnapshot, getServerSnapshot, selector, isEqual]
|
|
192
192
|
);
|
|
193
193
|
var value = useSyncExternalStore3(subscribe, instRef[0], instRef[1]);
|
|
194
|
-
|
|
194
|
+
useEffect61(
|
|
195
195
|
function() {
|
|
196
196
|
inst.hasValue = true;
|
|
197
197
|
inst.value = value;
|
|
@@ -213,14 +213,14 @@ 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 React321 = __require("react"), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore,
|
|
216
|
+
var React321 = __require("react"), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore, useRef94 = React321.useRef, useEffect61 = React321.useEffect, useMemo156 = React321.useMemo, useDebugValue2 = React321.useDebugValue;
|
|
217
217
|
exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
218
|
-
var instRef =
|
|
218
|
+
var instRef = useRef94(null);
|
|
219
219
|
if (null === instRef.current) {
|
|
220
220
|
var inst = { hasValue: false, value: null };
|
|
221
221
|
instRef.current = inst;
|
|
222
222
|
} else inst = instRef.current;
|
|
223
|
-
instRef =
|
|
223
|
+
instRef = useMemo156(
|
|
224
224
|
function() {
|
|
225
225
|
function memoizedSelector(nextSnapshot) {
|
|
226
226
|
if (!hasMemo) {
|
|
@@ -256,7 +256,7 @@ var require_with_selector_development = __commonJS({
|
|
|
256
256
|
[getSnapshot, getServerSnapshot, selector, isEqual]
|
|
257
257
|
);
|
|
258
258
|
var value = useSyncExternalStore3(subscribe, instRef[0], instRef[1]);
|
|
259
|
-
|
|
259
|
+
useEffect61(
|
|
260
260
|
function() {
|
|
261
261
|
inst.hasValue = true;
|
|
262
262
|
inst.value = value;
|
|
@@ -3819,6 +3819,15 @@ var ClientStorage = class {
|
|
|
3819
3819
|
};
|
|
3820
3820
|
var clientStorage = new ClientStorage();
|
|
3821
3821
|
|
|
3822
|
+
// ../noya-react-utils/src/utils/composeRefs.ts
|
|
3823
|
+
function composeRefs(...refs) {
|
|
3824
|
+
return (value) => {
|
|
3825
|
+
for (const ref of refs) {
|
|
3826
|
+
assignRef(ref, value);
|
|
3827
|
+
}
|
|
3828
|
+
};
|
|
3829
|
+
}
|
|
3830
|
+
|
|
3822
3831
|
// src/components/ActionMenu.tsx
|
|
3823
3832
|
import React166, { useMemo as useMemo87 } from "react";
|
|
3824
3833
|
|
|
@@ -6290,11 +6299,11 @@ function getGridNavigatedIndex(listRef, {
|
|
|
6290
6299
|
if (loopFocus && (prevIndex - cols < minIndex || nextIndex < 0)) {
|
|
6291
6300
|
const col = prevIndex % cols;
|
|
6292
6301
|
const maxCol = maxIndex % cols;
|
|
6293
|
-
const
|
|
6302
|
+
const offset5 = maxIndex - (maxCol - col);
|
|
6294
6303
|
if (maxCol === col) {
|
|
6295
6304
|
nextIndex = maxIndex;
|
|
6296
6305
|
} else {
|
|
6297
|
-
nextIndex = maxCol > col ?
|
|
6306
|
+
nextIndex = maxCol > col ? offset5 : offset5 - cols;
|
|
6298
6307
|
}
|
|
6299
6308
|
}
|
|
6300
6309
|
}
|
|
@@ -8787,7 +8796,7 @@ var limitShift = function(options) {
|
|
|
8787
8796
|
middlewareData
|
|
8788
8797
|
} = state;
|
|
8789
8798
|
const {
|
|
8790
|
-
offset:
|
|
8799
|
+
offset: offset5 = 0,
|
|
8791
8800
|
mainAxis: checkMainAxis = true,
|
|
8792
8801
|
crossAxis: checkCrossAxis = true
|
|
8793
8802
|
} = evaluate(options, state);
|
|
@@ -8799,7 +8808,7 @@ var limitShift = function(options) {
|
|
|
8799
8808
|
const mainAxis = getOppositeAxis(crossAxis);
|
|
8800
8809
|
let mainAxisCoord = coords[mainAxis];
|
|
8801
8810
|
let crossAxisCoord = coords[crossAxis];
|
|
8802
|
-
const rawOffset = evaluate(
|
|
8811
|
+
const rawOffset = evaluate(offset5, state);
|
|
8803
8812
|
const computedOffset = typeof rawOffset === "number" ? {
|
|
8804
8813
|
mainAxis: rawOffset,
|
|
8805
8814
|
crossAxis: 0
|
|
@@ -13375,14 +13384,14 @@ var baseArrow = (options) => ({
|
|
|
13375
13384
|
const min2 = minPadding;
|
|
13376
13385
|
const max2 = clientSize - arrowDimensions[length] - maxPadding;
|
|
13377
13386
|
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
13378
|
-
const
|
|
13379
|
-
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !==
|
|
13387
|
+
const offset5 = clamp(min2, center, max2);
|
|
13388
|
+
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset5 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
13380
13389
|
const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0;
|
|
13381
13390
|
return {
|
|
13382
13391
|
[axis]: coords[axis] + alignmentOffset,
|
|
13383
13392
|
data: {
|
|
13384
|
-
[axis]:
|
|
13385
|
-
centerOffset: center -
|
|
13393
|
+
[axis]: offset5,
|
|
13394
|
+
centerOffset: center - offset5 - alignmentOffset,
|
|
13386
13395
|
...shouldAddOffset && {
|
|
13387
13396
|
alignmentOffset
|
|
13388
13397
|
}
|
|
@@ -16835,8 +16844,8 @@ var TooltipViewport = /* @__PURE__ */ React102.forwardRef(function TooltipViewpo
|
|
|
16835
16844
|
if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) {
|
|
16836
16845
|
setPreviousContentNode(capturedNodeRef.current);
|
|
16837
16846
|
setShowStartingStyleAttribute(true);
|
|
16838
|
-
const
|
|
16839
|
-
setNewTriggerOffset(
|
|
16847
|
+
const offset5 = calculateRelativePosition(previousActiveTrigger, activeTrigger);
|
|
16848
|
+
setNewTriggerOffset(offset5);
|
|
16840
16849
|
cleanupFrame.request(() => {
|
|
16841
16850
|
cleanupFrame.request(() => {
|
|
16842
16851
|
setShowStartingStyleAttribute(false);
|
|
@@ -16913,11 +16922,11 @@ var TooltipViewport = /* @__PURE__ */ React102.forwardRef(function TooltipViewpo
|
|
|
16913
16922
|
});
|
|
16914
16923
|
});
|
|
16915
16924
|
if (process.env.NODE_ENV !== "production") TooltipViewport.displayName = "TooltipViewport";
|
|
16916
|
-
function getActivationDirection(
|
|
16917
|
-
if (!
|
|
16925
|
+
function getActivationDirection(offset5) {
|
|
16926
|
+
if (!offset5) {
|
|
16918
16927
|
return void 0;
|
|
16919
16928
|
}
|
|
16920
|
-
return `${getValueWithTolerance(
|
|
16929
|
+
return `${getValueWithTolerance(offset5.horizontal, 5, "right", "left")} ${getValueWithTolerance(offset5.vertical, 5, "down", "up")}`;
|
|
16921
16930
|
}
|
|
16922
16931
|
function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) {
|
|
16923
16932
|
if (value > tolerance) {
|
|
@@ -17003,6 +17012,29 @@ function mergePropsWithEventComposition(triggerProps, childProps) {
|
|
|
17003
17012
|
};
|
|
17004
17013
|
}
|
|
17005
17014
|
}
|
|
17015
|
+
if (triggerProps.ref || childProps.ref) {
|
|
17016
|
+
const triggerRef = triggerProps.ref;
|
|
17017
|
+
const childRef = childProps.ref;
|
|
17018
|
+
if (triggerRef && childRef) {
|
|
17019
|
+
mergedProps.ref = (value) => {
|
|
17020
|
+
assignRef(triggerRef, value);
|
|
17021
|
+
assignRef(childRef, value);
|
|
17022
|
+
};
|
|
17023
|
+
} else if (childRef) {
|
|
17024
|
+
mergedProps.ref = childRef;
|
|
17025
|
+
}
|
|
17026
|
+
}
|
|
17027
|
+
if (typeof triggerProps.style === "object" && triggerProps.style !== null && typeof childProps.style === "object" && childProps.style !== null) {
|
|
17028
|
+
mergedProps.style = { ...triggerProps.style, ...childProps.style };
|
|
17029
|
+
} else if (childProps.style !== void 0) {
|
|
17030
|
+
mergedProps.style = childProps.style;
|
|
17031
|
+
}
|
|
17032
|
+
if (triggerProps.className || childProps.className) {
|
|
17033
|
+
const classes = [triggerProps.className, childProps.className].filter(Boolean).join(" ");
|
|
17034
|
+
if (classes) {
|
|
17035
|
+
mergedProps.className = classes;
|
|
17036
|
+
}
|
|
17037
|
+
}
|
|
17006
17038
|
return mergedProps;
|
|
17007
17039
|
}
|
|
17008
17040
|
function cloneElementWithMergedProps(element, triggerProps) {
|
|
@@ -19844,7 +19876,7 @@ var getInsetEndStyles = (size4 = "medium") => {
|
|
|
19844
19876
|
var startBaseStyles = "n-absolute n-left-1.5 n-inset-y-0 n-flex n-items-center";
|
|
19845
19877
|
|
|
19846
19878
|
// src/components/internal/TextInput.tsx
|
|
19847
|
-
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
19879
|
+
import { composeRefs as composeRefs2 } from "@radix-ui/react-compose-refs";
|
|
19848
19880
|
import React140, {
|
|
19849
19881
|
forwardRef as forwardRef50,
|
|
19850
19882
|
useCallback as useCallback34,
|
|
@@ -20053,7 +20085,7 @@ var SubmittableTextInput = forwardRef50(function SubmittableTextInput2({
|
|
|
20053
20085
|
return /* @__PURE__ */ React140.createElement(
|
|
20054
20086
|
"input",
|
|
20055
20087
|
{
|
|
20056
|
-
ref:
|
|
20088
|
+
ref: composeRefs2(ref, forwardedRef),
|
|
20057
20089
|
...rest,
|
|
20058
20090
|
value: internalValue,
|
|
20059
20091
|
onKeyDown: handleKeyDown,
|
|
@@ -21072,8 +21104,8 @@ var PopoverViewport = /* @__PURE__ */ React156.forwardRef(function PopoverViewpo
|
|
|
21072
21104
|
if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) {
|
|
21073
21105
|
setPreviousContentNode(capturedNodeRef.current);
|
|
21074
21106
|
setShowStartingStyleAttribute(true);
|
|
21075
|
-
const
|
|
21076
|
-
setNewTriggerOffset(
|
|
21107
|
+
const offset5 = calculateRelativePosition2(previousActiveTrigger, activeTrigger);
|
|
21108
|
+
setNewTriggerOffset(offset5);
|
|
21077
21109
|
cleanupFrame.request(() => {
|
|
21078
21110
|
cleanupFrame.request(() => {
|
|
21079
21111
|
setShowStartingStyleAttribute(false);
|
|
@@ -21138,11 +21170,11 @@ var PopoverViewport = /* @__PURE__ */ React156.forwardRef(function PopoverViewpo
|
|
|
21138
21170
|
});
|
|
21139
21171
|
});
|
|
21140
21172
|
if (process.env.NODE_ENV !== "production") PopoverViewport.displayName = "PopoverViewport";
|
|
21141
|
-
function getActivationDirection2(
|
|
21142
|
-
if (!
|
|
21173
|
+
function getActivationDirection2(offset5) {
|
|
21174
|
+
if (!offset5) {
|
|
21143
21175
|
return void 0;
|
|
21144
21176
|
}
|
|
21145
|
-
return `${getValueWithTolerance2(
|
|
21177
|
+
return `${getValueWithTolerance2(offset5.horizontal, 5, "right", "left")} ${getValueWithTolerance2(offset5.vertical, 5, "down", "up")}`;
|
|
21146
21178
|
}
|
|
21147
21179
|
function getValueWithTolerance2(value, tolerance, positiveLabel, negativeLabel) {
|
|
21148
21180
|
if (value > tolerance) {
|
|
@@ -21350,9 +21382,12 @@ function Popover({
|
|
|
21350
21382
|
triggerProps,
|
|
21351
21383
|
childProps
|
|
21352
21384
|
);
|
|
21353
|
-
mergedProps.ref = (
|
|
21354
|
-
|
|
21355
|
-
|
|
21385
|
+
mergedProps.ref = composeRefs(
|
|
21386
|
+
mergedProps.ref,
|
|
21387
|
+
(node) => {
|
|
21388
|
+
if (node) setAnchorElement(node);
|
|
21389
|
+
}
|
|
21390
|
+
);
|
|
21356
21391
|
return React158.cloneElement(
|
|
21357
21392
|
element,
|
|
21358
21393
|
mergedProps
|
|
@@ -26530,18 +26565,18 @@ function buildMeasurements({
|
|
|
26530
26565
|
gap
|
|
26531
26566
|
}) {
|
|
26532
26567
|
const measurements = [];
|
|
26533
|
-
let
|
|
26568
|
+
let offset5 = paddingTop;
|
|
26534
26569
|
for (let index2 = 0; index2 < itemCount; index2 += 1) {
|
|
26535
26570
|
const size4 = Math.max(0, getItemHeight(index2));
|
|
26536
|
-
const start =
|
|
26571
|
+
const start = offset5;
|
|
26537
26572
|
const end = start + size4;
|
|
26538
26573
|
measurements.push({ index: index2, size: size4, start, end });
|
|
26539
|
-
|
|
26574
|
+
offset5 = end + gap;
|
|
26540
26575
|
}
|
|
26541
26576
|
const totalHeight = measurements.length ? measurements[measurements.length - 1].end + paddingBottom : paddingTop + paddingBottom;
|
|
26542
26577
|
return { measurements, totalHeight };
|
|
26543
26578
|
}
|
|
26544
|
-
function findFirstVisibleIndex(measurements,
|
|
26579
|
+
function findFirstVisibleIndex(measurements, offset5) {
|
|
26545
26580
|
if (!measurements.length) return 0;
|
|
26546
26581
|
let low = 0;
|
|
26547
26582
|
let high = measurements.length - 1;
|
|
@@ -26549,7 +26584,7 @@ function findFirstVisibleIndex(measurements, offset4) {
|
|
|
26549
26584
|
while (low <= high) {
|
|
26550
26585
|
const middle = Math.floor((low + high) / 2);
|
|
26551
26586
|
const measurement = measurements[middle];
|
|
26552
|
-
if (measurement.end >
|
|
26587
|
+
if (measurement.end > offset5) {
|
|
26553
26588
|
match = middle;
|
|
26554
26589
|
high = middle - 1;
|
|
26555
26590
|
} else {
|
|
@@ -26766,8 +26801,8 @@ var VirtualizedInner = React204.forwardRef(function Virtualized({
|
|
|
26766
26801
|
},
|
|
26767
26802
|
visibleRange.end >= visibleRange.start && Array.from(
|
|
26768
26803
|
{ length: visibleRange.end - visibleRange.start + 1 },
|
|
26769
|
-
(_,
|
|
26770
|
-
const index2 = visibleRange.start +
|
|
26804
|
+
(_, offset5) => {
|
|
26805
|
+
const index2 = visibleRange.start + offset5;
|
|
26771
26806
|
const measurement = measurements[index2];
|
|
26772
26807
|
const key = itemKey ? itemKey(index2) : index2;
|
|
26773
26808
|
return /* @__PURE__ */ React204.createElement(
|
|
@@ -27867,7 +27902,7 @@ var ListViewRoot = memoGeneric(
|
|
|
27867
27902
|
);
|
|
27868
27903
|
|
|
27869
27904
|
// src/components/listView/ListViewRow.tsx
|
|
27870
|
-
import { composeRefs as
|
|
27905
|
+
import { composeRefs as composeRefs3 } from "@radix-ui/react-compose-refs";
|
|
27871
27906
|
import React210, {
|
|
27872
27907
|
forwardRef as forwardRef84,
|
|
27873
27908
|
useCallback as useCallback51,
|
|
@@ -28182,7 +28217,7 @@ var ListViewRow = memoGeneric(
|
|
|
28182
28217
|
},
|
|
28183
28218
|
({ ref: sortableRef, ...sortableProps }, { relativeDropPosition }) => renderContent(
|
|
28184
28219
|
sortableProps,
|
|
28185
|
-
|
|
28220
|
+
composeRefs3(sortableRef, forwardedRef),
|
|
28186
28221
|
relativeDropPosition
|
|
28187
28222
|
)
|
|
28188
28223
|
);
|
|
@@ -30797,9 +30832,12 @@ var Drawer = React229.memo(
|
|
|
30797
30832
|
triggerProps,
|
|
30798
30833
|
childProps
|
|
30799
30834
|
);
|
|
30800
|
-
mergedProps.ref = (
|
|
30801
|
-
|
|
30802
|
-
|
|
30835
|
+
mergedProps.ref = composeRefs(
|
|
30836
|
+
mergedProps.ref,
|
|
30837
|
+
(node) => {
|
|
30838
|
+
if (node) setAnchorElement(node);
|
|
30839
|
+
}
|
|
30840
|
+
);
|
|
30803
30841
|
return React229.cloneElement(
|
|
30804
30842
|
element,
|
|
30805
30843
|
mergedProps
|
|
@@ -30911,6 +30949,12 @@ import React230, {
|
|
|
30911
30949
|
useRef as useRef71,
|
|
30912
30950
|
useState as useState61
|
|
30913
30951
|
} from "react";
|
|
30952
|
+
var CONTAINER_PADDING_X = "n-px-0.5";
|
|
30953
|
+
var CONTAINER_PADDING_X_PX = 4;
|
|
30954
|
+
var ITEM_PADDING = "n-px-input-padding-x";
|
|
30955
|
+
var ITEM_PADDING_PX = 16;
|
|
30956
|
+
var EXPANSION_THRESHOLD_PX = 20;
|
|
30957
|
+
var RESIZE_SETTLE_MS = 150;
|
|
30914
30958
|
var SegmentedControlContext = createContext49({
|
|
30915
30959
|
colorScheme: "primary"
|
|
30916
30960
|
});
|
|
@@ -30924,7 +30968,14 @@ var SegmentedControlItem = forwardRef90(function SegmentedControlItem2({
|
|
|
30924
30968
|
variant = "default",
|
|
30925
30969
|
...props
|
|
30926
30970
|
}, forwardedRef) {
|
|
30927
|
-
const {
|
|
30971
|
+
const {
|
|
30972
|
+
colorScheme,
|
|
30973
|
+
onSelect,
|
|
30974
|
+
itemWidth = "auto",
|
|
30975
|
+
isCompact
|
|
30976
|
+
} = useContext51(SegmentedControlContext);
|
|
30977
|
+
const showTitle = !(isCompact && icon);
|
|
30978
|
+
const effectiveTooltip = !showTitle && !tooltip ? title : tooltip;
|
|
30928
30979
|
const handlePointerDown = useCallback57(
|
|
30929
30980
|
(event2) => {
|
|
30930
30981
|
if (disabled2) return;
|
|
@@ -30955,7 +31006,7 @@ var SegmentedControlItem = forwardRef90(function SegmentedControlItem2({
|
|
|
30955
31006
|
// checked
|
|
30956
31007
|
variant === "tabs" ? "data-[pressed]:n-text-primary" : variant === "buttons" ? "active:n-text-button-text-active active:n-bg-button-background-active data-[pressed]:n-text-button-text-active data-[pressed]:n-bg-button-background-active" : variant === "default" ? (
|
|
30957
31008
|
// default variant: only text color, background handled by sliding indicator
|
|
30958
|
-
colorScheme === "secondary"
|
|
31009
|
+
colorScheme === "secondary" || colorScheme === "primary" ? "data-[pressed]:n-text-white" : "data-[pressed]:n-text-segmented-control-item-active-text"
|
|
30959
31010
|
) : colorScheme === "secondary" ? "data-[pressed]:n-bg-secondary data-[pressed]:n-text-white" : colorScheme === "primary" ? "data-[pressed]:n-bg-primary data-[pressed]:n-text-white" : "data-[pressed]:n-bg-segmented-control-item-active-background data-[pressed]:n-text-segmented-control-item-active-text",
|
|
30960
31011
|
"focus-visible:n-z-interactable",
|
|
30961
31012
|
// checked default (all colorSchemes) - hide separators near selected
|
|
@@ -30963,10 +31014,12 @@ var SegmentedControlItem = forwardRef90(function SegmentedControlItem2({
|
|
|
30963
31014
|
// hover
|
|
30964
31015
|
variant === "buttons" && "hover:n-bg-button-background-hover",
|
|
30965
31016
|
// spacing and borders
|
|
30966
|
-
|
|
31017
|
+
ITEM_PADDING,
|
|
30967
31018
|
variant === "default" ? "n-rounded after:n-content-[''] after:n-absolute after:n-right-0 after:n-top-0.5 after:n-bottom-0.5 after:n-w-px after:n-bg-divider last:after:n-hidden" : variant === "buttons" ? "n-rounded-sm n-max-w-fit" : "n-border-y-2 n-border-y-transparent data-[pressed]:n-border-b-primary",
|
|
30968
|
-
// icon only buttons
|
|
31019
|
+
// icon only buttons (explicit or due to compact mode)
|
|
30969
31020
|
variant === "buttons" && title === "" && icon && "n-min-w-input-height",
|
|
31021
|
+
// icon only in compact mode
|
|
31022
|
+
isCompact && icon && "n-min-w-input-height",
|
|
30970
31023
|
className
|
|
30971
31024
|
),
|
|
30972
31025
|
...props
|
|
@@ -30980,33 +31033,24 @@ var SegmentedControlItem = forwardRef90(function SegmentedControlItem2({
|
|
|
30980
31033
|
)
|
|
30981
31034
|
},
|
|
30982
31035
|
icon && renderIcon(icon),
|
|
30983
|
-
title
|
|
31036
|
+
showTitle && title
|
|
30984
31037
|
)
|
|
30985
31038
|
);
|
|
30986
|
-
return
|
|
31039
|
+
return effectiveTooltip ? /* @__PURE__ */ React230.createElement(Tooltip, { content: effectiveTooltip }, itemElement) : itemElement;
|
|
30987
31040
|
});
|
|
30988
|
-
|
|
30989
|
-
|
|
30990
|
-
|
|
30991
|
-
|
|
30992
|
-
|
|
30993
|
-
|
|
30994
|
-
|
|
30995
|
-
variant = "default",
|
|
30996
|
-
className,
|
|
30997
|
-
style: style2,
|
|
30998
|
-
itemWidth = "auto"
|
|
31041
|
+
function useIndicatorPosition({
|
|
31042
|
+
containerRef,
|
|
31043
|
+
itemRefs,
|
|
31044
|
+
selectedIndex,
|
|
31045
|
+
variant,
|
|
31046
|
+
itemCount,
|
|
31047
|
+
isCompact
|
|
30999
31048
|
}) {
|
|
31000
|
-
const { fieldId: id } = useLabel({ fieldId: idProp });
|
|
31001
31049
|
const hasInitialized = useRef71(false);
|
|
31002
|
-
const
|
|
31003
|
-
const
|
|
31050
|
+
const isResizingRef = useRef71(false);
|
|
31051
|
+
const resizeTimeoutRef = useRef71(void 0);
|
|
31004
31052
|
const [indicatorStyle, setIndicatorStyle] = useState61(null);
|
|
31005
|
-
const
|
|
31006
|
-
if (!value) return -1;
|
|
31007
|
-
return items.findIndex((item) => item.value === value);
|
|
31008
|
-
}, [value, items]);
|
|
31009
|
-
useLayoutEffect10(() => {
|
|
31053
|
+
const measureIndicator = useCallback57(() => {
|
|
31010
31054
|
if (variant !== "default" || selectedIndex < 0) {
|
|
31011
31055
|
setIndicatorStyle(null);
|
|
31012
31056
|
return;
|
|
@@ -31024,7 +31068,134 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
31024
31068
|
width: itemRect.width
|
|
31025
31069
|
});
|
|
31026
31070
|
hasInitialized.current = true;
|
|
31027
|
-
}, [selectedIndex, variant,
|
|
31071
|
+
}, [containerRef, itemRefs, selectedIndex, variant, itemCount, isCompact]);
|
|
31072
|
+
useLayoutEffect10(measureIndicator, [measureIndicator]);
|
|
31073
|
+
useLayoutEffect10(() => {
|
|
31074
|
+
const container = containerRef.current;
|
|
31075
|
+
if (!container || variant !== "default") return;
|
|
31076
|
+
const observer = new ResizeObserver(() => {
|
|
31077
|
+
isResizingRef.current = true;
|
|
31078
|
+
clearTimeout(resizeTimeoutRef.current);
|
|
31079
|
+
resizeTimeoutRef.current = setTimeout(() => {
|
|
31080
|
+
isResizingRef.current = false;
|
|
31081
|
+
}, RESIZE_SETTLE_MS);
|
|
31082
|
+
measureIndicator();
|
|
31083
|
+
});
|
|
31084
|
+
observer.observe(container);
|
|
31085
|
+
return () => {
|
|
31086
|
+
observer.disconnect();
|
|
31087
|
+
clearTimeout(resizeTimeoutRef.current);
|
|
31088
|
+
};
|
|
31089
|
+
}, [containerRef, variant, measureIndicator]);
|
|
31090
|
+
return { indicatorStyle, hasInitialized, isResizingRef };
|
|
31091
|
+
}
|
|
31092
|
+
function useCompactMode({
|
|
31093
|
+
containerRef,
|
|
31094
|
+
itemRefs,
|
|
31095
|
+
variant,
|
|
31096
|
+
items,
|
|
31097
|
+
enabled
|
|
31098
|
+
}) {
|
|
31099
|
+
const containerSize = useSize(containerRef, "width");
|
|
31100
|
+
const expandedWidthRef = useRef71(null);
|
|
31101
|
+
const isCompactRef = useRef71(false);
|
|
31102
|
+
const [isCompact, setIsCompact] = useState61(false);
|
|
31103
|
+
const allItemsHaveIcons = useMemo117(
|
|
31104
|
+
() => items.every((item) => item.icon),
|
|
31105
|
+
[items]
|
|
31106
|
+
);
|
|
31107
|
+
const itemsKey = useMemo117(
|
|
31108
|
+
() => items.map((item) => `${item.value}-${item.icon}-${item.title}`).join("|"),
|
|
31109
|
+
[items]
|
|
31110
|
+
);
|
|
31111
|
+
useLayoutEffect10(() => {
|
|
31112
|
+
expandedWidthRef.current = null;
|
|
31113
|
+
isCompactRef.current = false;
|
|
31114
|
+
setIsCompact(false);
|
|
31115
|
+
}, [itemsKey]);
|
|
31116
|
+
useLayoutEffect10(() => {
|
|
31117
|
+
if (!enabled) return;
|
|
31118
|
+
const container = containerRef.current;
|
|
31119
|
+
if (!container || variant !== "default" || !allItemsHaveIcons) {
|
|
31120
|
+
return;
|
|
31121
|
+
}
|
|
31122
|
+
const validItems = itemRefs.current.filter(Boolean);
|
|
31123
|
+
if (validItems.length !== items.length) return;
|
|
31124
|
+
const availableWidth = (containerSize?.width ?? container.clientWidth) - CONTAINER_PADDING_X_PX;
|
|
31125
|
+
if (!isCompactRef.current) {
|
|
31126
|
+
const isOverflowing = validItems.some((item) => {
|
|
31127
|
+
const span = item.querySelector("span");
|
|
31128
|
+
if (!span) return false;
|
|
31129
|
+
const contentWidth = span.scrollWidth;
|
|
31130
|
+
const availableInButton = item.clientWidth - ITEM_PADDING_PX;
|
|
31131
|
+
return contentWidth >= availableInButton - 1;
|
|
31132
|
+
});
|
|
31133
|
+
if (isOverflowing) {
|
|
31134
|
+
const totalItemsWidth = validItems.reduce((sum, item) => {
|
|
31135
|
+
const span = item.querySelector("span");
|
|
31136
|
+
const contentWidth = span ? span.scrollWidth : 0;
|
|
31137
|
+
return sum + contentWidth + ITEM_PADDING_PX;
|
|
31138
|
+
}, 0);
|
|
31139
|
+
expandedWidthRef.current = totalItemsWidth;
|
|
31140
|
+
isCompactRef.current = true;
|
|
31141
|
+
setIsCompact(true);
|
|
31142
|
+
}
|
|
31143
|
+
} else {
|
|
31144
|
+
const expandedWidth = expandedWidthRef.current;
|
|
31145
|
+
if (!expandedWidth) return;
|
|
31146
|
+
if (availableWidth >= expandedWidth + EXPANSION_THRESHOLD_PX) {
|
|
31147
|
+
isCompactRef.current = false;
|
|
31148
|
+
expandedWidthRef.current = null;
|
|
31149
|
+
setIsCompact(false);
|
|
31150
|
+
}
|
|
31151
|
+
}
|
|
31152
|
+
}, [
|
|
31153
|
+
enabled,
|
|
31154
|
+
containerRef,
|
|
31155
|
+
itemRefs,
|
|
31156
|
+
variant,
|
|
31157
|
+
allItemsHaveIcons,
|
|
31158
|
+
containerSize?.width,
|
|
31159
|
+
itemsKey,
|
|
31160
|
+
items.length
|
|
31161
|
+
]);
|
|
31162
|
+
return isCompact;
|
|
31163
|
+
}
|
|
31164
|
+
var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
31165
|
+
id: idProp,
|
|
31166
|
+
value,
|
|
31167
|
+
onValueChange,
|
|
31168
|
+
colorScheme,
|
|
31169
|
+
allowEmpty,
|
|
31170
|
+
items,
|
|
31171
|
+
variant = "default",
|
|
31172
|
+
className,
|
|
31173
|
+
style: style2,
|
|
31174
|
+
itemWidth = "auto",
|
|
31175
|
+
enableCompactMode = false
|
|
31176
|
+
}) {
|
|
31177
|
+
const { fieldId: id } = useLabel({ fieldId: idProp });
|
|
31178
|
+
const containerRef = useRef71(null);
|
|
31179
|
+
const itemRefs = useRef71([]);
|
|
31180
|
+
const selectedIndex = useMemo117(() => {
|
|
31181
|
+
if (!value) return -1;
|
|
31182
|
+
return items.findIndex((item) => item.value === value);
|
|
31183
|
+
}, [value, items]);
|
|
31184
|
+
const isCompact = useCompactMode({
|
|
31185
|
+
containerRef,
|
|
31186
|
+
itemRefs,
|
|
31187
|
+
variant,
|
|
31188
|
+
items,
|
|
31189
|
+
enabled: enableCompactMode
|
|
31190
|
+
});
|
|
31191
|
+
const { indicatorStyle, hasInitialized, isResizingRef } = useIndicatorPosition({
|
|
31192
|
+
containerRef,
|
|
31193
|
+
itemRefs,
|
|
31194
|
+
selectedIndex,
|
|
31195
|
+
variant,
|
|
31196
|
+
itemCount: items.length,
|
|
31197
|
+
isCompact
|
|
31198
|
+
});
|
|
31028
31199
|
const handleSelect = useCallback57(
|
|
31029
31200
|
(newValue) => {
|
|
31030
31201
|
if (!allowEmpty && !newValue) return;
|
|
@@ -31037,8 +31208,8 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
31037
31208
|
[handleSelect]
|
|
31038
31209
|
);
|
|
31039
31210
|
const contextValue = useMemo117(
|
|
31040
|
-
() => ({ colorScheme, onSelect: handleSelect, itemWidth }),
|
|
31041
|
-
[colorScheme, handleSelect, itemWidth]
|
|
31211
|
+
() => ({ colorScheme, onSelect: handleSelect, itemWidth, isCompact }),
|
|
31212
|
+
[colorScheme, handleSelect, itemWidth, isCompact]
|
|
31042
31213
|
);
|
|
31043
31214
|
const indicatorBgClass = colorScheme === "secondary" ? "n-bg-secondary" : colorScheme === "primary" ? "n-bg-primary" : "n-bg-segmented-control-item-active-background";
|
|
31044
31215
|
return /* @__PURE__ */ React230.createElement(SegmentedControlContext.Provider, { value: contextValue }, /* @__PURE__ */ React230.createElement(
|
|
@@ -31051,7 +31222,7 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
31051
31222
|
className: cx(
|
|
31052
31223
|
"n-appearance-none n-relative n-outline-none",
|
|
31053
31224
|
variant === "default" && (itemWidth === "fit" ? "n-flex n-w-fit" : "n-grid"),
|
|
31054
|
-
variant === "default" &&
|
|
31225
|
+
variant === "default" && `n-min-h-input-height n-bg-input-background n-rounded n-py-0.5 ${CONTAINER_PADDING_X}`,
|
|
31055
31226
|
variant !== "default" && "n-flex",
|
|
31056
31227
|
variant === "tabs" && "n-gap-1.5 n-min-h-[33px]",
|
|
31057
31228
|
variant === "buttons" && "n-gap-1.5 n-min-h-input-height",
|
|
@@ -31070,7 +31241,7 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
31070
31241
|
className: cx(
|
|
31071
31242
|
"n-absolute n-top-0.5 n-bottom-0.5 n-rounded n-shadow-segment n-pointer-events-none",
|
|
31072
31243
|
indicatorBgClass,
|
|
31073
|
-
hasInitialized.current && "n-transition-[left,width] n-duration-200 n-ease-out"
|
|
31244
|
+
hasInitialized.current && !isResizingRef.current && "n-transition-[left,width] n-duration-200 n-ease-out"
|
|
31074
31245
|
),
|
|
31075
31246
|
style: {
|
|
31076
31247
|
left: indicatorStyle.left,
|
|
@@ -31131,6 +31302,7 @@ var SECTION_HEADER_HEIGHT = 24;
|
|
|
31131
31302
|
var HEADER_HEIGHT = 80;
|
|
31132
31303
|
var FOOTER_HEIGHT = 40;
|
|
31133
31304
|
var HORIZONTAL_PADDING = 8;
|
|
31305
|
+
var SEGMENTED_CONTROL_ITEM_WIDTH = 31;
|
|
31134
31306
|
var categoryIcons = {
|
|
31135
31307
|
search: /* @__PURE__ */ React231.createElement(MagnifyingGlassIcon, null),
|
|
31136
31308
|
frequent: /* @__PURE__ */ React231.createElement(ClockIcon, null),
|
|
@@ -31472,6 +31644,14 @@ var EmojiPicker = memo25(function EmojiPicker2({
|
|
|
31472
31644
|
],
|
|
31473
31645
|
[frequentlyUsed.length]
|
|
31474
31646
|
);
|
|
31647
|
+
const segmentedControlGap = useMemo118(() => {
|
|
31648
|
+
const numItems = categoryItems.length;
|
|
31649
|
+
const availableWidth = size4.width - HORIZONTAL_PADDING * 2;
|
|
31650
|
+
const totalItemsWidth = numItems * SEGMENTED_CONTROL_ITEM_WIDTH;
|
|
31651
|
+
const remainingSpace = availableWidth - totalItemsWidth;
|
|
31652
|
+
const numGaps = numItems - 1;
|
|
31653
|
+
return numGaps > 0 ? Math.max(0, remainingSpace / numGaps) : 0;
|
|
31654
|
+
}, [categoryItems.length, size4.width]);
|
|
31475
31655
|
const displayEmoji = hoveredEmoji ?? selectedEmoji;
|
|
31476
31656
|
const footerText = displayEmoji ? `:${displayEmoji.names[0]}:${displayEmoji.names.length > 1 ? ` :${displayEmoji.names[1]}:` : ""}` : "";
|
|
31477
31657
|
const skinToneMenuItems = useMemo118(
|
|
@@ -31496,7 +31676,8 @@ var EmojiPicker = memo25(function EmojiPicker2({
|
|
|
31496
31676
|
value: activeCategory ?? "search",
|
|
31497
31677
|
onValueChange: handleCategoryChange,
|
|
31498
31678
|
allowEmpty: true,
|
|
31499
|
-
className: "n-flex-nowrap n-px-2"
|
|
31679
|
+
className: "n-flex-nowrap n-px-2",
|
|
31680
|
+
style: { gap: segmentedControlGap }
|
|
31500
31681
|
}
|
|
31501
31682
|
),
|
|
31502
31683
|
/* @__PURE__ */ React231.createElement(Divider, null),
|
|
@@ -36347,27 +36528,24 @@ var Section = memo31(function InspectorSection({
|
|
|
36347
36528
|
});
|
|
36348
36529
|
|
|
36349
36530
|
// src/components/SelectionToolbar.tsx
|
|
36350
|
-
import
|
|
36351
|
-
|
|
36352
|
-
|
|
36353
|
-
|
|
36354
|
-
|
|
36355
|
-
|
|
36356
|
-
|
|
36357
|
-
|
|
36358
|
-
|
|
36359
|
-
|
|
36360
|
-
|
|
36361
|
-
|
|
36362
|
-
|
|
36363
|
-
|
|
36364
|
-
})
|
|
36365
|
-
});
|
|
36531
|
+
import {
|
|
36532
|
+
useFloating as useFloating3,
|
|
36533
|
+
offset as offset4,
|
|
36534
|
+
flip as flip4,
|
|
36535
|
+
shift as shift4,
|
|
36536
|
+
FloatingPortal as FloatingPortal3
|
|
36537
|
+
} from "@floating-ui/react";
|
|
36538
|
+
import React261, { memo as memo32, useCallback as useCallback64, useEffect as useEffect54, useMemo as useMemo129, useState as useState68 } from "react";
|
|
36539
|
+
function getPlacement(side, align) {
|
|
36540
|
+
if (align === "center") {
|
|
36541
|
+
return side;
|
|
36542
|
+
}
|
|
36543
|
+
return `${side}-${align}`;
|
|
36544
|
+
}
|
|
36366
36545
|
var SelectionToolbarContainer = memo32(
|
|
36367
36546
|
function SelectionToolbarContainer2({
|
|
36368
36547
|
rect,
|
|
36369
36548
|
children,
|
|
36370
|
-
portalContainer,
|
|
36371
36549
|
side = "top",
|
|
36372
36550
|
sideOffset = 10,
|
|
36373
36551
|
align = "center",
|
|
@@ -36377,31 +36555,52 @@ var SelectionToolbarContainer = memo32(
|
|
|
36377
36555
|
transitionDuration = 0.2
|
|
36378
36556
|
}) {
|
|
36379
36557
|
const portalScopeId = usePortalScopeId();
|
|
36380
|
-
const
|
|
36381
|
-
const
|
|
36382
|
-
|
|
36558
|
+
const [containerElement, setContainerElement] = useState68(null);
|
|
36559
|
+
const containerRef = useCallback64((el) => {
|
|
36560
|
+
setContainerElement(el);
|
|
36561
|
+
}, []);
|
|
36562
|
+
const containerRefObject = useMemo129(
|
|
36563
|
+
() => ({ current: containerElement }),
|
|
36564
|
+
[containerElement]
|
|
36565
|
+
);
|
|
36566
|
+
const size4 = useSize(containerRefObject, "width");
|
|
36567
|
+
const virtualElement = useMemo129(
|
|
36383
36568
|
() => ({
|
|
36384
|
-
|
|
36569
|
+
getBoundingClientRect: () => ({
|
|
36570
|
+
width: rect.width,
|
|
36571
|
+
height: rect.height,
|
|
36572
|
+
x: rect.x,
|
|
36573
|
+
y: rect.y,
|
|
36574
|
+
top: rect.y,
|
|
36575
|
+
right: rect.x + rect.width,
|
|
36576
|
+
bottom: rect.y + rect.height,
|
|
36577
|
+
left: rect.x
|
|
36578
|
+
})
|
|
36385
36579
|
}),
|
|
36386
36580
|
[rect]
|
|
36387
36581
|
);
|
|
36388
|
-
const
|
|
36389
|
-
|
|
36582
|
+
const placement = getPlacement(side, align);
|
|
36583
|
+
const { refs, floatingStyles } = useFloating3({
|
|
36584
|
+
placement,
|
|
36585
|
+
middleware: avoidCollisions ? [offset4(sideOffset), flip4(), shift4({ padding: 10 })] : [offset4(sideOffset)]
|
|
36586
|
+
});
|
|
36587
|
+
useEffect54(() => {
|
|
36588
|
+
refs.setPositionReference(virtualElement);
|
|
36589
|
+
}, [refs, virtualElement]);
|
|
36590
|
+
return /* @__PURE__ */ React261.createElement(FloatingPortal3, null, /* @__PURE__ */ React261.createElement(
|
|
36591
|
+
"div",
|
|
36390
36592
|
{
|
|
36593
|
+
ref: refs.setFloating,
|
|
36391
36594
|
...portalScopeProps(portalScopeId),
|
|
36392
|
-
side,
|
|
36393
|
-
sideOffset,
|
|
36394
|
-
align,
|
|
36395
|
-
avoidCollisions,
|
|
36396
|
-
collisionPadding: 10,
|
|
36397
36595
|
contentEditable: false,
|
|
36398
36596
|
style: {
|
|
36399
|
-
|
|
36597
|
+
...floatingStyles,
|
|
36400
36598
|
opacity: size4 ? 1 : 0,
|
|
36401
36599
|
transition: `opacity ${transitionDuration}s ease-in-out`,
|
|
36402
36600
|
[cssVarNames.colors.inputBackground]: "transparent",
|
|
36403
36601
|
[cssVarNames.colors.buttonBackground]: "transparent"
|
|
36404
|
-
}
|
|
36602
|
+
},
|
|
36603
|
+
className: "n-z-menu"
|
|
36405
36604
|
},
|
|
36406
36605
|
/* @__PURE__ */ React261.createElement(
|
|
36407
36606
|
"div",
|
|
@@ -36419,8 +36618,7 @@ var SelectionToolbarContainer = memo32(
|
|
|
36419
36618
|
},
|
|
36420
36619
|
children
|
|
36421
36620
|
)
|
|
36422
|
-
);
|
|
36423
|
-
return /* @__PURE__ */ React261.createElement(PopperPrimitive.Root, null, /* @__PURE__ */ React261.createElement(PopperPrimitive.Anchor, { virtualRef }), portalContainer ? createPortal5(popperContent, portalContainer) : popperContent);
|
|
36621
|
+
));
|
|
36424
36622
|
}
|
|
36425
36623
|
);
|
|
36426
36624
|
|
|
@@ -38797,9 +38995,9 @@ if (process.env.NODE_ENV !== "production") SelectGroupLabel.displayName = "Selec
|
|
|
38797
38995
|
|
|
38798
38996
|
// src/components/SelectMenu.tsx
|
|
38799
38997
|
import React290, {
|
|
38800
|
-
useCallback as
|
|
38998
|
+
useCallback as useCallback66,
|
|
38801
38999
|
useMemo as useMemo142,
|
|
38802
|
-
useState as
|
|
39000
|
+
useState as useState71
|
|
38803
39001
|
} from "react";
|
|
38804
39002
|
var readOnlyStyle = {
|
|
38805
39003
|
justifyContent: "flex-start",
|
|
@@ -38907,20 +39105,20 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
38907
39105
|
(item) => isSelectableMenuItem(item) && item.value === value
|
|
38908
39106
|
);
|
|
38909
39107
|
const icon = selectedItem?.icon;
|
|
38910
|
-
const [internalOpen, setInternalOpen] =
|
|
39108
|
+
const [internalOpen, setInternalOpen] = useState71(open2 ?? false);
|
|
38911
39109
|
const { label, fieldId: id } = useLabel({
|
|
38912
39110
|
label: props.label,
|
|
38913
39111
|
fieldId: props.id
|
|
38914
39112
|
});
|
|
38915
39113
|
const labelType = useLabelType();
|
|
38916
|
-
const handleOpenChange =
|
|
39114
|
+
const handleOpenChange = useCallback66(
|
|
38917
39115
|
(newOpen) => {
|
|
38918
39116
|
onOpenChange?.(newOpen);
|
|
38919
39117
|
setInternalOpen(newOpen);
|
|
38920
39118
|
},
|
|
38921
39119
|
[onOpenChange]
|
|
38922
39120
|
);
|
|
38923
|
-
const handleValueChange =
|
|
39121
|
+
const handleValueChange = useCallback66(
|
|
38924
39122
|
(newValue) => {
|
|
38925
39123
|
if (newValue !== null) {
|
|
38926
39124
|
onSelect?.(newValue);
|
|
@@ -40311,8 +40509,8 @@ var SliderThumb = /* @__PURE__ */ React296.forwardRef(function SliderThumb2(comp
|
|
|
40311
40509
|
if (thumbRef.current != null) {
|
|
40312
40510
|
const axis = orientation === "horizontal" ? "x" : "y";
|
|
40313
40511
|
const midpoint = getMidpoint(thumbRef.current);
|
|
40314
|
-
const
|
|
40315
|
-
pressedThumbCenterOffsetRef.current =
|
|
40512
|
+
const offset5 = (orientation === "horizontal" ? event2.clientX : event2.clientY) - midpoint[axis];
|
|
40513
|
+
pressedThumbCenterOffsetRef.current = offset5;
|
|
40316
40514
|
}
|
|
40317
40515
|
if (inputRef.current != null && pressedInputRef.current !== inputRef.current) {
|
|
40318
40516
|
pressedInputRef.current = inputRef.current;
|
|
@@ -40405,7 +40603,7 @@ var SliderIndicator = /* @__PURE__ */ React297.forwardRef(function SliderIndicat
|
|
|
40405
40603
|
if (process.env.NODE_ENV !== "production") SliderIndicator.displayName = "SliderIndicator";
|
|
40406
40604
|
|
|
40407
40605
|
// src/components/Slider.tsx
|
|
40408
|
-
import React298, { memo as memo36, useCallback as
|
|
40606
|
+
import React298, { memo as memo36, useCallback as useCallback68 } from "react";
|
|
40409
40607
|
var THUMB_WIDTH = 8;
|
|
40410
40608
|
var thumbStyle = {
|
|
40411
40609
|
width: THUMB_WIDTH
|
|
@@ -40428,7 +40626,7 @@ var Slider = memo36(function Slider2({
|
|
|
40428
40626
|
const { fieldId: id } = useLabel({
|
|
40429
40627
|
fieldId: props.id
|
|
40430
40628
|
});
|
|
40431
|
-
const handleValueChange =
|
|
40629
|
+
const handleValueChange = useCallback68(
|
|
40432
40630
|
(newValue) => {
|
|
40433
40631
|
onValueChange(newValue);
|
|
40434
40632
|
},
|
|
@@ -40512,7 +40710,7 @@ function createSharedDrag() {
|
|
|
40512
40710
|
|
|
40513
40711
|
// src/components/Stepper.tsx
|
|
40514
40712
|
import { clamp as clamp9 } from "@noya-app/noya-utils";
|
|
40515
|
-
import React300, { memo as memo37, useCallback as
|
|
40713
|
+
import React300, { memo as memo37, useCallback as useCallback69, useMemo as useMemo146 } from "react";
|
|
40516
40714
|
var Stepper = memo37(function Stepper2({
|
|
40517
40715
|
style: style2,
|
|
40518
40716
|
className,
|
|
@@ -40533,7 +40731,7 @@ var Stepper = memo37(function Stepper2({
|
|
|
40533
40731
|
const value = useMemo146(() => {
|
|
40534
40732
|
return clamp9(valueProp, min2, max2);
|
|
40535
40733
|
}, [valueProp, min2, max2]);
|
|
40536
|
-
const handleValueChange =
|
|
40734
|
+
const handleValueChange = useCallback69(
|
|
40537
40735
|
(value2) => {
|
|
40538
40736
|
const newValue = clamp9(value2, min2, max2);
|
|
40539
40737
|
onValueChange(newValue);
|
|
@@ -40914,7 +41112,7 @@ function Tabs({
|
|
|
40914
41112
|
}
|
|
40915
41113
|
|
|
40916
41114
|
// src/components/UserPicker.tsx
|
|
40917
|
-
import React306, { useCallback as
|
|
41115
|
+
import React306, { useCallback as useCallback70, useMemo as useMemo148, useState as useState75 } from "react";
|
|
40918
41116
|
function UserPicker({
|
|
40919
41117
|
users,
|
|
40920
41118
|
value,
|
|
@@ -40938,13 +41136,13 @@ function UserPicker({
|
|
|
40938
41136
|
return sortedUsers.map(createUserMenuItem);
|
|
40939
41137
|
}, [sortedUsers]);
|
|
40940
41138
|
const isControlled = value !== void 0;
|
|
40941
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
41139
|
+
const [uncontrolledValue, setUncontrolledValue] = useState75(defaultValue2);
|
|
40942
41140
|
const selectedUserId = isControlled ? value : uncontrolledValue;
|
|
40943
41141
|
const selectedItem = useMemo148(() => {
|
|
40944
41142
|
if (!selectedUserId) return void 0;
|
|
40945
41143
|
return items.find((item) => item.value === selectedUserId);
|
|
40946
41144
|
}, [items, selectedUserId]);
|
|
40947
|
-
const updateSelectedUserId =
|
|
41145
|
+
const updateSelectedUserId = useCallback70(
|
|
40948
41146
|
(userId) => {
|
|
40949
41147
|
if (!isControlled) {
|
|
40950
41148
|
setUncontrolledValue(userId);
|
|
@@ -40953,7 +41151,7 @@ function UserPicker({
|
|
|
40953
41151
|
},
|
|
40954
41152
|
[isControlled, onChangeUserId]
|
|
40955
41153
|
);
|
|
40956
|
-
const handleSelectItem =
|
|
41154
|
+
const handleSelectItem = useCallback70(
|
|
40957
41155
|
(item) => {
|
|
40958
41156
|
updateSelectedUserId(item.value);
|
|
40959
41157
|
onSelectUser?.(usersById.get(item.value));
|
|
@@ -41154,10 +41352,10 @@ var UserPointer = memo38(function UserPointer2({
|
|
|
41154
41352
|
import { useKeyboardShortcuts as useKeyboardShortcuts4 } from "@noya-app/noya-keymap";
|
|
41155
41353
|
import React317, {
|
|
41156
41354
|
memo as memo40,
|
|
41157
|
-
useCallback as
|
|
41355
|
+
useCallback as useCallback74,
|
|
41158
41356
|
useImperativeHandle as useImperativeHandle18,
|
|
41159
|
-
useMemo as
|
|
41160
|
-
useRef as
|
|
41357
|
+
useMemo as useMemo154,
|
|
41358
|
+
useRef as useRef93
|
|
41161
41359
|
} from "react";
|
|
41162
41360
|
|
|
41163
41361
|
// src/components/OverlayToolbar.tsx
|
|
@@ -41229,16 +41427,7 @@ function OverlayToolbar({
|
|
|
41229
41427
|
}
|
|
41230
41428
|
|
|
41231
41429
|
// src/components/workspace/DrawerWorkspaceLayout.tsx
|
|
41232
|
-
import
|
|
41233
|
-
|
|
41234
|
-
// src/components/workspace/constants.ts
|
|
41235
|
-
var EDITOR_PANEL_GROUP_ID = "editor-panel-group";
|
|
41236
|
-
var LEFT_SIDEBAR_ID = "editor-1-left-sidebar";
|
|
41237
|
-
var RIGHT_SIDEBAR_ID = "editor-3-right-sidebar";
|
|
41238
|
-
var CONTENT_AREA_ID = "editor-2-content-area";
|
|
41239
|
-
|
|
41240
|
-
// src/components/workspace/VerticalTabMenu.tsx
|
|
41241
|
-
import React311, { useMemo as useMemo151 } from "react";
|
|
41430
|
+
import React311, { useMemo as useMemo151, useState as useState76 } from "react";
|
|
41242
41431
|
|
|
41243
41432
|
// src/components/Toolbar.tsx
|
|
41244
41433
|
import { useKeyboardShortcuts as useKeyboardShortcuts3 } from "@noya-app/noya-keymap";
|
|
@@ -41553,38 +41742,11 @@ function Toolbar({
|
|
|
41553
41742
|
);
|
|
41554
41743
|
}
|
|
41555
41744
|
|
|
41556
|
-
// src/components/workspace/
|
|
41557
|
-
var
|
|
41558
|
-
|
|
41559
|
-
|
|
41560
|
-
|
|
41561
|
-
onChange,
|
|
41562
|
-
tooltipSide
|
|
41563
|
-
}) {
|
|
41564
|
-
const style2 = useMemo151(() => {
|
|
41565
|
-
return {
|
|
41566
|
-
[cssVarNames.colors.inputBackground]: "transparent",
|
|
41567
|
-
[cssVarNames.colors.buttonBackground]: "transparent"
|
|
41568
|
-
};
|
|
41569
|
-
}, []);
|
|
41570
|
-
return /* @__PURE__ */ React311.createElement(
|
|
41571
|
-
"div",
|
|
41572
|
-
{
|
|
41573
|
-
className: "n-w-[calc(var(--n-toolbar-height)+1px)] n-h-full n-bg-sidebar-background n-flex n-flex-col n-items-center n-py-3 n-gap-3",
|
|
41574
|
-
style: style2
|
|
41575
|
-
},
|
|
41576
|
-
/* @__PURE__ */ React311.createElement(
|
|
41577
|
-
ToolbarMenu,
|
|
41578
|
-
{
|
|
41579
|
-
items,
|
|
41580
|
-
activeValue: isSidebarCollapsed ? void 0 : activeValue,
|
|
41581
|
-
onSelectMenuItem: onChange,
|
|
41582
|
-
tooltipSide,
|
|
41583
|
-
displayFilter: "iconOnly"
|
|
41584
|
-
}
|
|
41585
|
-
)
|
|
41586
|
-
);
|
|
41587
|
-
});
|
|
41745
|
+
// src/components/workspace/constants.ts
|
|
41746
|
+
var EDITOR_PANEL_GROUP_ID = "editor-panel-group";
|
|
41747
|
+
var LEFT_SIDEBAR_ID = "editor-1-left-sidebar";
|
|
41748
|
+
var RIGHT_SIDEBAR_ID = "editor-3-right-sidebar";
|
|
41749
|
+
var CONTENT_AREA_ID = "editor-2-content-area";
|
|
41588
41750
|
|
|
41589
41751
|
// src/components/workspace/DrawerWorkspaceLayout.tsx
|
|
41590
41752
|
var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
@@ -41598,168 +41760,140 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
|
41598
41760
|
rightTabItems,
|
|
41599
41761
|
rightTabValue,
|
|
41600
41762
|
onChangeRightTab,
|
|
41601
|
-
onChangeLeftTab
|
|
41602
|
-
compactDrawerMenu
|
|
41763
|
+
onChangeLeftTab
|
|
41603
41764
|
}) {
|
|
41604
|
-
const
|
|
41605
|
-
const [{ leftSidebarCollapsed, rightSidebarCollapsed }, setLayoutState] = useState75({
|
|
41765
|
+
const [{ leftSidebarCollapsed, rightSidebarCollapsed }, setLayoutState] = useState76({
|
|
41606
41766
|
leftSidebarCollapsed: true,
|
|
41607
41767
|
rightSidebarCollapsed: true
|
|
41608
41768
|
});
|
|
41609
|
-
|
|
41769
|
+
React311.useImperativeHandle(
|
|
41770
|
+
leftSidebarRef,
|
|
41771
|
+
() => ({
|
|
41772
|
+
expand: () => setLayoutState((prev) => ({
|
|
41773
|
+
...prev,
|
|
41774
|
+
leftSidebarCollapsed: false,
|
|
41775
|
+
rightSidebarCollapsed: true
|
|
41776
|
+
})),
|
|
41777
|
+
collapse: () => setLayoutState((prev) => ({ ...prev, leftSidebarCollapsed: true })),
|
|
41778
|
+
isExpanded: () => !leftSidebarCollapsed
|
|
41779
|
+
}),
|
|
41780
|
+
[leftSidebarCollapsed]
|
|
41781
|
+
);
|
|
41782
|
+
React311.useImperativeHandle(
|
|
41783
|
+
rightSidebarRef,
|
|
41784
|
+
() => ({
|
|
41785
|
+
expand: () => setLayoutState((prev) => ({
|
|
41786
|
+
...prev,
|
|
41787
|
+
rightSidebarCollapsed: false,
|
|
41788
|
+
leftSidebarCollapsed: true
|
|
41789
|
+
})),
|
|
41790
|
+
collapse: () => setLayoutState((prev) => ({ ...prev, rightSidebarCollapsed: true })),
|
|
41791
|
+
isExpanded: () => !rightSidebarCollapsed
|
|
41792
|
+
}),
|
|
41793
|
+
[rightSidebarCollapsed]
|
|
41794
|
+
);
|
|
41795
|
+
const allTabItems = useMemo151(
|
|
41610
41796
|
() => [
|
|
41611
41797
|
...leftPanel ? leftTabItems ?? [] : [],
|
|
41612
41798
|
...rightPanel ? rightTabItems ?? [] : []
|
|
41613
41799
|
],
|
|
41614
41800
|
[leftTabItems, rightTabItems, leftPanel, rightPanel]
|
|
41615
41801
|
);
|
|
41616
|
-
const
|
|
41617
|
-
const allSelectableTabItems = useMemo152(
|
|
41802
|
+
const allSelectableTabItems = useMemo151(
|
|
41618
41803
|
() => allTabItems.filter(isSelectableMenuItem),
|
|
41619
41804
|
[allTabItems]
|
|
41620
41805
|
);
|
|
41621
|
-
const
|
|
41622
|
-
const leftSelectableTabItems =
|
|
41806
|
+
const hasTabs = allSelectableTabItems.length > 0;
|
|
41807
|
+
const leftSelectableTabItems = useMemo151(
|
|
41623
41808
|
() => (leftTabItems ?? []).filter(isSelectableMenuItem),
|
|
41624
41809
|
[leftTabItems]
|
|
41625
41810
|
);
|
|
41626
|
-
const rightSelectableTabItems =
|
|
41811
|
+
const rightSelectableTabItems = useMemo151(
|
|
41627
41812
|
() => (rightTabItems ?? []).filter(isSelectableMenuItem),
|
|
41628
41813
|
[rightTabItems]
|
|
41629
41814
|
);
|
|
41630
|
-
const toggleSidebar = (ref) => {
|
|
41631
|
-
if (ref.current?.isExpanded()) {
|
|
41632
|
-
ref.current?.collapse();
|
|
41633
|
-
} else {
|
|
41634
|
-
ref.current?.expand();
|
|
41635
|
-
}
|
|
41636
|
-
};
|
|
41637
|
-
const ensureExpanded = (ref) => {
|
|
41638
|
-
if (!ref.current?.isExpanded()) {
|
|
41639
|
-
ref.current?.expand();
|
|
41640
|
-
}
|
|
41641
|
-
};
|
|
41642
41815
|
const handleSelectTab = (value) => {
|
|
41643
|
-
|
|
41644
|
-
|
|
41645
|
-
|
|
41816
|
+
const isLeftItem = leftSelectableTabItems.some(
|
|
41817
|
+
(item) => item.value === value
|
|
41818
|
+
);
|
|
41819
|
+
const isRightItem = rightSelectableTabItems.some(
|
|
41820
|
+
(item) => item.value === value
|
|
41821
|
+
);
|
|
41822
|
+
if (isLeftItem) {
|
|
41823
|
+
if (value === leftTabValue && !leftSidebarCollapsed) {
|
|
41824
|
+
setLayoutState((prev) => ({ ...prev, leftSidebarCollapsed: true }));
|
|
41646
41825
|
} else {
|
|
41647
|
-
|
|
41826
|
+
setLayoutState({
|
|
41827
|
+
leftSidebarCollapsed: false,
|
|
41828
|
+
rightSidebarCollapsed: true
|
|
41829
|
+
});
|
|
41648
41830
|
onChangeLeftTab?.(value);
|
|
41649
41831
|
}
|
|
41650
|
-
} else if (
|
|
41651
|
-
if (value === rightTabValue) {
|
|
41652
|
-
|
|
41832
|
+
} else if (isRightItem) {
|
|
41833
|
+
if (value === rightTabValue && !rightSidebarCollapsed) {
|
|
41834
|
+
setLayoutState((prev) => ({ ...prev, rightSidebarCollapsed: true }));
|
|
41653
41835
|
} else {
|
|
41654
|
-
|
|
41836
|
+
setLayoutState({
|
|
41837
|
+
leftSidebarCollapsed: true,
|
|
41838
|
+
rightSidebarCollapsed: false
|
|
41839
|
+
});
|
|
41655
41840
|
onChangeRightTab?.(value);
|
|
41656
41841
|
}
|
|
41657
41842
|
}
|
|
41658
41843
|
};
|
|
41659
|
-
const
|
|
41660
|
-
|
|
41661
|
-
|
|
41662
|
-
|
|
41663
|
-
|
|
41844
|
+
const activeDrawerPanel = !leftSidebarCollapsed ? leftPanel : !rightSidebarCollapsed ? rightPanel : null;
|
|
41845
|
+
const isDrawerOpen = activeDrawerPanel !== null;
|
|
41846
|
+
const activeTabValue = !leftSidebarCollapsed ? leftTabValue : !rightSidebarCollapsed ? rightTabValue : void 0;
|
|
41847
|
+
const toolbarMenuItems = useMemo151(
|
|
41848
|
+
() => allSelectableTabItems.map((item) => ({
|
|
41849
|
+
...item,
|
|
41850
|
+
checked: activeTabValue === item.value
|
|
41851
|
+
})),
|
|
41852
|
+
[allSelectableTabItems, activeTabValue]
|
|
41853
|
+
);
|
|
41854
|
+
return /* @__PURE__ */ React311.createElement(
|
|
41664
41855
|
"div",
|
|
41665
41856
|
{
|
|
41666
|
-
ref: portalContainer,
|
|
41667
41857
|
id: EDITOR_PANEL_GROUP_ID,
|
|
41668
|
-
className: "n-flex n-flex-1 n-relative focus:n-outline-none"
|
|
41858
|
+
className: "n-flex n-flex-col n-flex-1 n-relative focus:n-outline-none"
|
|
41669
41859
|
},
|
|
41670
|
-
hasTabs &&
|
|
41671
|
-
|
|
41672
|
-
{
|
|
41673
|
-
tooltipSide: "right",
|
|
41674
|
-
items: allTabItems,
|
|
41675
|
-
activeValue,
|
|
41676
|
-
isSidebarCollapsed,
|
|
41677
|
-
onChange: (value) => handleSelectTab(value)
|
|
41678
|
-
}
|
|
41679
|
-
), /* @__PURE__ */ React312.createElement(DividerVertical, { className: "n-h-full" })),
|
|
41680
|
-
useCompactInToolbar && /* @__PURE__ */ React312.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-r n-border-b n-border-divider-strong n-z-10 n-flex n-items-center n-justify-center" }, allSelectableTabItems[0] && /* @__PURE__ */ React312.createElement(
|
|
41681
|
-
Button,
|
|
41860
|
+
hasTabs && /* @__PURE__ */ React311.createElement(React311.Fragment, null, /* @__PURE__ */ React311.createElement(
|
|
41861
|
+
"div",
|
|
41682
41862
|
{
|
|
41683
|
-
|
|
41684
|
-
className: "n-rounded",
|
|
41863
|
+
className: "n-flex n-flex-row n-items-center n-gap-1 n-px-2 n-py-1.5 n-bg-sidebar-background n-flex-none",
|
|
41685
41864
|
style: {
|
|
41686
|
-
|
|
41687
|
-
|
|
41688
|
-
},
|
|
41689
|
-
icon: allSelectableTabItems[0].icon,
|
|
41690
|
-
tooltip: allSelectableTabItems[0].tooltip ?? allSelectableTabItems[0].title,
|
|
41691
|
-
active: (() => {
|
|
41692
|
-
const value = allSelectableTabItems[0].value;
|
|
41693
|
-
const isLeftItem = leftSelectableTabItems.some(
|
|
41694
|
-
(i) => i.value === value
|
|
41695
|
-
);
|
|
41696
|
-
const isRightItem = rightSelectableTabItems.some(
|
|
41697
|
-
(i) => i.value === value
|
|
41698
|
-
);
|
|
41699
|
-
return isLeftItem ? !leftSidebarCollapsed : isRightItem ? !rightSidebarCollapsed : false;
|
|
41700
|
-
})(),
|
|
41701
|
-
onClick: () => {
|
|
41702
|
-
const value = allSelectableTabItems[0].value;
|
|
41703
|
-
handleSelectTab(value);
|
|
41704
|
-
}
|
|
41705
|
-
}
|
|
41706
|
-
)),
|
|
41707
|
-
/* @__PURE__ */ React312.createElement("div", { className: "n-flex-1 n-flex n-relative" }, centerPanel),
|
|
41708
|
-
leftPanel && /* @__PURE__ */ React312.createElement(
|
|
41709
|
-
Drawer,
|
|
41710
|
-
{
|
|
41711
|
-
modal: false,
|
|
41712
|
-
ref: leftSidebarRef,
|
|
41713
|
-
className: "n-flex-1",
|
|
41714
|
-
style: useCompactInToolbar ? void 0 : { left: 48, maxWidth: "calc(100% - 48px)" },
|
|
41715
|
-
overlayStyle: useCompactInToolbar ? void 0 : { left: 48 },
|
|
41716
|
-
open: !leftSidebarCollapsed,
|
|
41717
|
-
positioning: "absolute",
|
|
41718
|
-
side: "left",
|
|
41719
|
-
trigger: null,
|
|
41720
|
-
portalContainer: portalContainer.current,
|
|
41721
|
-
onOpenChange: (open2) => {
|
|
41722
|
-
setLayoutState({
|
|
41723
|
-
leftSidebarCollapsed: !open2,
|
|
41724
|
-
rightSidebarCollapsed
|
|
41725
|
-
});
|
|
41865
|
+
[cssVarNames.colors.inputBackground]: "transparent",
|
|
41866
|
+
[cssVarNames.colors.buttonBackground]: "transparent"
|
|
41726
41867
|
}
|
|
41727
41868
|
},
|
|
41728
|
-
|
|
41729
|
-
|
|
41730
|
-
|
|
41731
|
-
|
|
41732
|
-
|
|
41733
|
-
id: RIGHT_SIDEBAR_ID,
|
|
41734
|
-
modal: false,
|
|
41735
|
-
ref: rightSidebarRef,
|
|
41736
|
-
className: "n-flex-1",
|
|
41737
|
-
style: useCompactInToolbar ? void 0 : { left: 48, maxWidth: "calc(100% - 48px)" },
|
|
41738
|
-
overlayStyle: useCompactInToolbar ? void 0 : { left: 48 },
|
|
41739
|
-
open: !rightSidebarCollapsed,
|
|
41740
|
-
positioning: "absolute",
|
|
41741
|
-
side: "left",
|
|
41742
|
-
trigger: null,
|
|
41743
|
-
portalContainer: portalContainer.current,
|
|
41744
|
-
onOpenChange: (open2) => {
|
|
41745
|
-
setLayoutState({
|
|
41746
|
-
leftSidebarCollapsed,
|
|
41747
|
-
rightSidebarCollapsed: !open2
|
|
41748
|
-
});
|
|
41869
|
+
/* @__PURE__ */ React311.createElement(
|
|
41870
|
+
ToolbarMenu,
|
|
41871
|
+
{
|
|
41872
|
+
items: toolbarMenuItems,
|
|
41873
|
+
onSelectMenuItem: handleSelectTab
|
|
41749
41874
|
}
|
|
41750
|
-
|
|
41751
|
-
|
|
41752
|
-
)
|
|
41875
|
+
)
|
|
41876
|
+
), /* @__PURE__ */ React311.createElement(Divider, null)),
|
|
41877
|
+
/* @__PURE__ */ React311.createElement("div", { className: "n-flex-1 n-flex n-flex-col n-relative n-min-h-0" }, isDrawerOpen && /* @__PURE__ */ React311.createElement("div", { className: "n-absolute n-inset-0 n-z-20 n-flex n-flex-col" }, /* @__PURE__ */ React311.createElement("div", { className: "n-flex-none n-max-h-[50vh] n-overflow-auto n-bg-sidebar-background n-border-b n-border-divider-strong n-shadow-lg" }, activeDrawerPanel), /* @__PURE__ */ React311.createElement(
|
|
41878
|
+
"div",
|
|
41879
|
+
{
|
|
41880
|
+
className: "n-flex-1 n-bg-black/30",
|
|
41881
|
+
onClick: () => setLayoutState({
|
|
41882
|
+
leftSidebarCollapsed: true,
|
|
41883
|
+
rightSidebarCollapsed: true
|
|
41884
|
+
})
|
|
41885
|
+
}
|
|
41886
|
+
)), /* @__PURE__ */ React311.createElement("div", { className: "n-flex-1 n-flex n-relative n-min-h-0" }, centerPanel))
|
|
41753
41887
|
);
|
|
41754
41888
|
});
|
|
41755
41889
|
|
|
41756
41890
|
// src/components/workspace/PanelWorkspaceLayout.tsx
|
|
41757
|
-
import React316, { useCallback as
|
|
41891
|
+
import React316, { useCallback as useCallback73, useMemo as useMemo153, useRef as useRef92, useState as useState78 } from "react";
|
|
41758
41892
|
|
|
41759
41893
|
// src/components/resizablePanels/Panel.tsx
|
|
41760
|
-
import
|
|
41894
|
+
import React312, {
|
|
41761
41895
|
forwardRef as forwardRef124,
|
|
41762
|
-
useEffect as
|
|
41896
|
+
useEffect as useEffect58,
|
|
41763
41897
|
useId as useId5,
|
|
41764
41898
|
useImperativeHandle as useImperativeHandle16
|
|
41765
41899
|
} from "react";
|
|
@@ -41779,7 +41913,17 @@ function usePanelGroupContext() {
|
|
|
41779
41913
|
|
|
41780
41914
|
// src/components/resizablePanels/Panel.tsx
|
|
41781
41915
|
var Panel = forwardRef124(
|
|
41782
|
-
function Panel2({
|
|
41916
|
+
function Panel2({
|
|
41917
|
+
id: propId,
|
|
41918
|
+
order,
|
|
41919
|
+
className,
|
|
41920
|
+
defaultSize,
|
|
41921
|
+
minSize,
|
|
41922
|
+
maxSize,
|
|
41923
|
+
collapsible,
|
|
41924
|
+
defaultCollapsed,
|
|
41925
|
+
children
|
|
41926
|
+
}, ref) {
|
|
41783
41927
|
const generatedId = useId5();
|
|
41784
41928
|
const id = propId ?? generatedId;
|
|
41785
41929
|
const context = usePanelGroupContext();
|
|
@@ -41791,7 +41935,7 @@ var Panel = forwardRef124(
|
|
|
41791
41935
|
collapsePanel,
|
|
41792
41936
|
isPanelExpanded
|
|
41793
41937
|
} = context;
|
|
41794
|
-
|
|
41938
|
+
useEffect58(() => {
|
|
41795
41939
|
registerPanel({
|
|
41796
41940
|
id,
|
|
41797
41941
|
order,
|
|
@@ -41804,7 +41948,17 @@ var Panel = forwardRef124(
|
|
|
41804
41948
|
return () => {
|
|
41805
41949
|
unregisterPanel(id);
|
|
41806
41950
|
};
|
|
41807
|
-
}, [
|
|
41951
|
+
}, [
|
|
41952
|
+
id,
|
|
41953
|
+
order,
|
|
41954
|
+
defaultSize,
|
|
41955
|
+
minSize,
|
|
41956
|
+
maxSize,
|
|
41957
|
+
collapsible,
|
|
41958
|
+
defaultCollapsed,
|
|
41959
|
+
registerPanel,
|
|
41960
|
+
unregisterPanel
|
|
41961
|
+
]);
|
|
41808
41962
|
const size4 = getPanelSize(id);
|
|
41809
41963
|
const isFlexPanel = defaultSize === void 0;
|
|
41810
41964
|
useImperativeHandle16(
|
|
@@ -41820,7 +41974,7 @@ var Panel = forwardRef124(
|
|
|
41820
41974
|
if (size4 === 0 && !isFlexPanel) {
|
|
41821
41975
|
return null;
|
|
41822
41976
|
}
|
|
41823
|
-
return /* @__PURE__ */
|
|
41977
|
+
return /* @__PURE__ */ React312.createElement(
|
|
41824
41978
|
"div",
|
|
41825
41979
|
{
|
|
41826
41980
|
"data-panel-id": id,
|
|
@@ -41835,14 +41989,14 @@ var Panel = forwardRef124(
|
|
|
41835
41989
|
);
|
|
41836
41990
|
|
|
41837
41991
|
// src/components/resizablePanels/PanelGroup.tsx
|
|
41838
|
-
import
|
|
41992
|
+
import React313, {
|
|
41839
41993
|
forwardRef as forwardRef125,
|
|
41840
|
-
useCallback as
|
|
41841
|
-
useEffect as
|
|
41994
|
+
useCallback as useCallback71,
|
|
41995
|
+
useEffect as useEffect59,
|
|
41842
41996
|
useImperativeHandle as useImperativeHandle17,
|
|
41843
|
-
useMemo as
|
|
41844
|
-
useRef as
|
|
41845
|
-
useState as
|
|
41997
|
+
useMemo as useMemo152,
|
|
41998
|
+
useRef as useRef90,
|
|
41999
|
+
useState as useState77
|
|
41846
42000
|
} from "react";
|
|
41847
42001
|
function getStorageKey(autoSaveId) {
|
|
41848
42002
|
return `noya-panels:${autoSaveId}`;
|
|
@@ -41863,17 +42017,17 @@ function saveSizes(autoSaveId, sizes) {
|
|
|
41863
42017
|
}
|
|
41864
42018
|
var PanelGroup = forwardRef125(
|
|
41865
42019
|
function PanelGroup2({ id, className, direction, autoSaveId, onLayout, children }, ref) {
|
|
41866
|
-
const containerRef =
|
|
42020
|
+
const containerRef = useRef90(null);
|
|
41867
42021
|
const containerSize = useSize(containerRef);
|
|
41868
42022
|
const containerWidth = containerSize?.width ?? 0;
|
|
41869
|
-
const [panels, setPanels] =
|
|
41870
|
-
const panelsRef =
|
|
42023
|
+
const [panels, setPanels] = useState77(/* @__PURE__ */ new Map());
|
|
42024
|
+
const panelsRef = useRef90(panels);
|
|
41871
42025
|
panelsRef.current = panels;
|
|
41872
|
-
const [resizing, setResizing] =
|
|
41873
|
-
const sortedPanels =
|
|
42026
|
+
const [resizing, setResizing] = useState77(null);
|
|
42027
|
+
const sortedPanels = useMemo152(() => {
|
|
41874
42028
|
return Array.from(panels.values()).sort((a, b) => a.order - b.order);
|
|
41875
42029
|
}, [panels]);
|
|
41876
|
-
const flexPanelId =
|
|
42030
|
+
const flexPanelId = useMemo152(() => {
|
|
41877
42031
|
for (const panel of sortedPanels) {
|
|
41878
42032
|
if (panel.defaultSize === void 0) {
|
|
41879
42033
|
return panel.id;
|
|
@@ -41881,7 +42035,7 @@ var PanelGroup = forwardRef125(
|
|
|
41881
42035
|
}
|
|
41882
42036
|
return null;
|
|
41883
42037
|
}, [sortedPanels]);
|
|
41884
|
-
const calculateLayout =
|
|
42038
|
+
const calculateLayout = useCallback71(
|
|
41885
42039
|
(panelStates, width) => {
|
|
41886
42040
|
if (width === 0) return panelStates;
|
|
41887
42041
|
const sorted = Array.from(panelStates.values()).sort(
|
|
@@ -41906,25 +42060,30 @@ var PanelGroup = forwardRef125(
|
|
|
41906
42060
|
},
|
|
41907
42061
|
[]
|
|
41908
42062
|
);
|
|
41909
|
-
|
|
42063
|
+
useEffect59(() => {
|
|
41910
42064
|
if (containerWidth > 0 && panels.size > 0) {
|
|
41911
42065
|
setPanels((prev) => calculateLayout(prev, containerWidth));
|
|
41912
42066
|
}
|
|
41913
42067
|
}, [containerWidth, calculateLayout, panels.size]);
|
|
41914
|
-
|
|
42068
|
+
useEffect59(() => {
|
|
41915
42069
|
if (onLayout && sortedPanels.length > 0) {
|
|
41916
42070
|
const sizes = sortedPanels.map((p) => p.collapsed ? 0 : p.size);
|
|
41917
42071
|
onLayout(sizes);
|
|
41918
42072
|
}
|
|
41919
42073
|
}, [onLayout, sortedPanels]);
|
|
41920
|
-
const registerPanel =
|
|
42074
|
+
const registerPanel = useCallback71(
|
|
41921
42075
|
(panel) => {
|
|
41922
42076
|
setPanels((prev) => {
|
|
41923
42077
|
const savedSizes = loadSavedSizes(autoSaveId);
|
|
41924
42078
|
const savedSize = savedSizes?.[panel.id];
|
|
41925
42079
|
const hasSavedSize = savedSize !== void 0;
|
|
41926
|
-
|
|
41927
|
-
|
|
42080
|
+
let collapsed;
|
|
42081
|
+
if (hasSavedSize) {
|
|
42082
|
+
collapsed = savedSize === 0 && !!panel.collapsible;
|
|
42083
|
+
} else {
|
|
42084
|
+
collapsed = !!panel.defaultCollapsed && !!panel.collapsible;
|
|
42085
|
+
}
|
|
42086
|
+
const initialSize = collapsed ? 0 : hasSavedSize ? savedSize : panel.defaultSize ?? 0;
|
|
41928
42087
|
const newPanels = new Map(prev);
|
|
41929
42088
|
newPanels.set(panel.id, {
|
|
41930
42089
|
...panel,
|
|
@@ -41937,26 +42096,26 @@ var PanelGroup = forwardRef125(
|
|
|
41937
42096
|
},
|
|
41938
42097
|
[autoSaveId, calculateLayout, containerWidth]
|
|
41939
42098
|
);
|
|
41940
|
-
const unregisterPanel =
|
|
42099
|
+
const unregisterPanel = useCallback71((panelId) => {
|
|
41941
42100
|
setPanels((prev) => {
|
|
41942
42101
|
const newPanels = new Map(prev);
|
|
41943
42102
|
newPanels.delete(panelId);
|
|
41944
42103
|
return newPanels;
|
|
41945
42104
|
});
|
|
41946
42105
|
}, []);
|
|
41947
|
-
const getPanelSize =
|
|
42106
|
+
const getPanelSize = useCallback71(
|
|
41948
42107
|
(panelId) => {
|
|
41949
42108
|
return panels.get(panelId)?.size ?? 0;
|
|
41950
42109
|
},
|
|
41951
42110
|
[panels]
|
|
41952
42111
|
);
|
|
41953
|
-
const getPanelIndex =
|
|
42112
|
+
const getPanelIndex = useCallback71(
|
|
41954
42113
|
(panelId) => {
|
|
41955
42114
|
return sortedPanels.findIndex((p) => p.id === panelId);
|
|
41956
42115
|
},
|
|
41957
42116
|
[sortedPanels]
|
|
41958
42117
|
);
|
|
41959
|
-
const setPanelSize =
|
|
42118
|
+
const setPanelSize = useCallback71(
|
|
41960
42119
|
(panelId, size4) => {
|
|
41961
42120
|
setPanels((prev) => {
|
|
41962
42121
|
const panel = prev.get(panelId);
|
|
@@ -41984,7 +42143,7 @@ var PanelGroup = forwardRef125(
|
|
|
41984
42143
|
},
|
|
41985
42144
|
[autoSaveId, calculateLayout, containerWidth]
|
|
41986
42145
|
);
|
|
41987
|
-
const expandPanel =
|
|
42146
|
+
const expandPanel = useCallback71(
|
|
41988
42147
|
(panelId) => {
|
|
41989
42148
|
setPanels((prev) => {
|
|
41990
42149
|
const panel = prev.get(panelId);
|
|
@@ -42009,7 +42168,7 @@ var PanelGroup = forwardRef125(
|
|
|
42009
42168
|
},
|
|
42010
42169
|
[autoSaveId, calculateLayout, containerWidth]
|
|
42011
42170
|
);
|
|
42012
|
-
const collapsePanel =
|
|
42171
|
+
const collapsePanel = useCallback71(
|
|
42013
42172
|
(panelId) => {
|
|
42014
42173
|
setPanels((prev) => {
|
|
42015
42174
|
const panel = prev.get(panelId);
|
|
@@ -42033,14 +42192,14 @@ var PanelGroup = forwardRef125(
|
|
|
42033
42192
|
},
|
|
42034
42193
|
[autoSaveId, calculateLayout, containerWidth]
|
|
42035
42194
|
);
|
|
42036
|
-
const isPanelExpanded =
|
|
42195
|
+
const isPanelExpanded = useCallback71(
|
|
42037
42196
|
(panelId) => {
|
|
42038
42197
|
const panel = panels.get(panelId);
|
|
42039
42198
|
return panel ? !panel.collapsed : false;
|
|
42040
42199
|
},
|
|
42041
42200
|
[panels]
|
|
42042
42201
|
);
|
|
42043
|
-
const startResize =
|
|
42202
|
+
const startResize = useCallback71(
|
|
42044
42203
|
(handleIndex, startX) => {
|
|
42045
42204
|
const startSizes = sortedPanels.map((p) => p.size);
|
|
42046
42205
|
setResizing({
|
|
@@ -42051,7 +42210,7 @@ var PanelGroup = forwardRef125(
|
|
|
42051
42210
|
},
|
|
42052
42211
|
[sortedPanels]
|
|
42053
42212
|
);
|
|
42054
|
-
|
|
42213
|
+
useEffect59(() => {
|
|
42055
42214
|
if (!resizing) return;
|
|
42056
42215
|
const handleMouseMove = (e) => {
|
|
42057
42216
|
const delta = e.clientX - resizing.startX;
|
|
@@ -42158,7 +42317,7 @@ var PanelGroup = forwardRef125(
|
|
|
42158
42317
|
});
|
|
42159
42318
|
}
|
|
42160
42319
|
}));
|
|
42161
|
-
const contextValue =
|
|
42320
|
+
const contextValue = useMemo152(
|
|
42162
42321
|
() => ({
|
|
42163
42322
|
registerPanel,
|
|
42164
42323
|
unregisterPanel,
|
|
@@ -42184,7 +42343,7 @@ var PanelGroup = forwardRef125(
|
|
|
42184
42343
|
containerWidth
|
|
42185
42344
|
]
|
|
42186
42345
|
);
|
|
42187
|
-
return /* @__PURE__ */
|
|
42346
|
+
return /* @__PURE__ */ React313.createElement(PanelGroupContext.Provider, { value: contextValue }, /* @__PURE__ */ React313.createElement(
|
|
42188
42347
|
"div",
|
|
42189
42348
|
{
|
|
42190
42349
|
ref: containerRef,
|
|
@@ -42202,15 +42361,15 @@ var PanelGroup = forwardRef125(
|
|
|
42202
42361
|
);
|
|
42203
42362
|
|
|
42204
42363
|
// src/components/resizablePanels/PanelResizeHandle.tsx
|
|
42205
|
-
import
|
|
42364
|
+
import React314, { useCallback as useCallback72, useContext as useContext65, useRef as useRef91 } from "react";
|
|
42206
42365
|
function PanelResizeHandle({
|
|
42207
42366
|
className,
|
|
42208
42367
|
disabled: disabled2,
|
|
42209
42368
|
index: index2
|
|
42210
42369
|
}) {
|
|
42211
42370
|
const context = useContext65(PanelGroupContext);
|
|
42212
|
-
const handleRef =
|
|
42213
|
-
const handleMouseDown =
|
|
42371
|
+
const handleRef = useRef91(null);
|
|
42372
|
+
const handleMouseDown = useCallback72(
|
|
42214
42373
|
(e) => {
|
|
42215
42374
|
if (disabled2 || !context) return;
|
|
42216
42375
|
e.preventDefault();
|
|
@@ -42221,7 +42380,7 @@ function PanelResizeHandle({
|
|
|
42221
42380
|
if (!context) {
|
|
42222
42381
|
return null;
|
|
42223
42382
|
}
|
|
42224
|
-
return /* @__PURE__ */
|
|
42383
|
+
return /* @__PURE__ */ React314.createElement(
|
|
42225
42384
|
"div",
|
|
42226
42385
|
{
|
|
42227
42386
|
ref: handleRef,
|
|
@@ -42234,7 +42393,7 @@ function PanelResizeHandle({
|
|
|
42234
42393
|
zIndex: 10
|
|
42235
42394
|
}
|
|
42236
42395
|
},
|
|
42237
|
-
/* @__PURE__ */
|
|
42396
|
+
/* @__PURE__ */ React314.createElement(
|
|
42238
42397
|
"div",
|
|
42239
42398
|
{
|
|
42240
42399
|
style: {
|
|
@@ -42250,6 +42409,32 @@ function PanelResizeHandle({
|
|
|
42250
42409
|
);
|
|
42251
42410
|
}
|
|
42252
42411
|
|
|
42412
|
+
// src/components/workspace/HorizontalTabBar.tsx
|
|
42413
|
+
import React315 from "react";
|
|
42414
|
+
var HorizontalTabBar = memoGeneric(function HorizontalTabBar2({ items, activeValue, onChange }) {
|
|
42415
|
+
const selectableItems = items.filter(isSelectableMenuItem);
|
|
42416
|
+
if (selectableItems.length <= 1) {
|
|
42417
|
+
return null;
|
|
42418
|
+
}
|
|
42419
|
+
return /* @__PURE__ */ React315.createElement("div", { className: "n-flex n-flex-col n-bg-sidebar-background n-flex-none" }, /* @__PURE__ */ React315.createElement("div", { className: "n-flex n-flex-row n-px-3 n-py-3" }, /* @__PURE__ */ React315.createElement(
|
|
42420
|
+
SegmentedControl,
|
|
42421
|
+
{
|
|
42422
|
+
enableCompactMode: true,
|
|
42423
|
+
className: "n-flex-1",
|
|
42424
|
+
value: activeValue,
|
|
42425
|
+
onValueChange: onChange,
|
|
42426
|
+
variant: "default",
|
|
42427
|
+
items: selectableItems.map((item) => ({
|
|
42428
|
+
value: item.value,
|
|
42429
|
+
title: item.title,
|
|
42430
|
+
icon: item.icon,
|
|
42431
|
+
tooltip: item.tooltip,
|
|
42432
|
+
disabled: item.disabled
|
|
42433
|
+
}))
|
|
42434
|
+
}
|
|
42435
|
+
)));
|
|
42436
|
+
});
|
|
42437
|
+
|
|
42253
42438
|
// src/components/workspace/PanelWorkspaceLayout.tsx
|
|
42254
42439
|
var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
42255
42440
|
leftPanel,
|
|
@@ -42266,32 +42451,56 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42266
42451
|
rightTabValue,
|
|
42267
42452
|
onChangeLeftTab,
|
|
42268
42453
|
onChangeRightTab,
|
|
42269
|
-
|
|
42454
|
+
onLeftSidebarStateChange,
|
|
42455
|
+
onRightSidebarStateChange,
|
|
42456
|
+
shouldAutoSave = true
|
|
42270
42457
|
}) {
|
|
42271
|
-
const panelGroupRef =
|
|
42272
|
-
const
|
|
42273
|
-
|
|
42274
|
-
|
|
42275
|
-
|
|
42458
|
+
const panelGroupRef = useRef92(null);
|
|
42459
|
+
const containerRef = useRef92(null);
|
|
42460
|
+
const autoSaveId = useMemo153(() => {
|
|
42461
|
+
if (!shouldAutoSave) return void 0;
|
|
42462
|
+
return autoSavePrefix ? `${autoSavePrefix}--v5--${EDITOR_PANEL_GROUP_ID}` : Math.random().toString(36).substring(2, 15);
|
|
42463
|
+
}, [autoSavePrefix, shouldAutoSave]);
|
|
42464
|
+
const [leftSidebarCollapsed, setLeftSidebarCollapsed] = useState78(
|
|
42276
42465
|
leftSidebarOptions.defaultCollapsed ?? false
|
|
42277
42466
|
);
|
|
42278
|
-
const [rightSidebarCollapsed, setRightSidebarCollapsed] =
|
|
42467
|
+
const [rightSidebarCollapsed, setRightSidebarCollapsed] = useState78(
|
|
42279
42468
|
rightSidebarOptions.defaultCollapsed ?? false
|
|
42280
42469
|
);
|
|
42281
|
-
const
|
|
42470
|
+
const prevLeftSidebarState = useRef92(null);
|
|
42471
|
+
const prevRightSidebarState = useRef92(null);
|
|
42472
|
+
const handleLayoutChange = useCallback73(
|
|
42282
42473
|
(sizes) => {
|
|
42283
42474
|
const leftIndex = leftPanel ? 0 : -1;
|
|
42284
42475
|
const rightIndex = rightPanel ? leftPanel ? 2 : 1 : -1;
|
|
42476
|
+
const containerWidth = containerRef.current?.clientWidth ?? 0;
|
|
42477
|
+
const sizesSum = sizes.reduce((a, b) => a + b, 0);
|
|
42478
|
+
if (containerWidth > 0 && sizesSum < containerWidth * 0.5 && sizesSum > 100) {
|
|
42479
|
+
return;
|
|
42480
|
+
}
|
|
42481
|
+
const isPixels = containerWidth > 0 && Math.abs(sizesSum - containerWidth) < Math.abs(sizesSum - 100);
|
|
42285
42482
|
if (leftIndex >= 0) {
|
|
42286
|
-
|
|
42483
|
+
const collapsed = sizes[leftIndex] === 0;
|
|
42484
|
+
setLeftSidebarCollapsed(collapsed);
|
|
42485
|
+
const widthPixels = isPixels ? Math.round(sizes[leftIndex]) : containerWidth > 0 ? Math.round(sizes[leftIndex] / 100 * containerWidth) : 0;
|
|
42486
|
+
if (prevLeftSidebarState.current?.width !== widthPixels || prevLeftSidebarState.current?.collapsed !== collapsed) {
|
|
42487
|
+
prevLeftSidebarState.current = { width: widthPixels, collapsed };
|
|
42488
|
+
onLeftSidebarStateChange?.({ width: widthPixels, collapsed });
|
|
42489
|
+
}
|
|
42287
42490
|
}
|
|
42288
42491
|
if (rightIndex >= 0) {
|
|
42289
|
-
|
|
42492
|
+
const collapsed = sizes[rightIndex] === 0;
|
|
42493
|
+
setRightSidebarCollapsed(collapsed);
|
|
42494
|
+
const widthPixels = isPixels ? Math.round(sizes[rightIndex]) : containerWidth > 0 ? Math.round(sizes[rightIndex] / 100 * containerWidth) : 0;
|
|
42495
|
+
if (prevRightSidebarState.current?.width !== widthPixels || prevRightSidebarState.current?.collapsed !== collapsed) {
|
|
42496
|
+
prevRightSidebarState.current = { width: widthPixels, collapsed };
|
|
42497
|
+
onRightSidebarStateChange?.({ width: widthPixels, collapsed });
|
|
42498
|
+
}
|
|
42290
42499
|
}
|
|
42291
42500
|
},
|
|
42292
|
-
[leftPanel, rightPanel]
|
|
42501
|
+
[leftPanel, rightPanel, onLeftSidebarStateChange, onRightSidebarStateChange]
|
|
42293
42502
|
);
|
|
42294
|
-
const handleLeftTabChange =
|
|
42503
|
+
const handleLeftTabChange = useCallback73(
|
|
42295
42504
|
(value) => {
|
|
42296
42505
|
if (value === leftTabValue) {
|
|
42297
42506
|
if (leftSidebarRef.current?.isExpanded()) {
|
|
@@ -42308,7 +42517,7 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42308
42517
|
},
|
|
42309
42518
|
[leftSidebarRef, leftTabValue, onChangeLeftTab]
|
|
42310
42519
|
);
|
|
42311
|
-
const handleRightTabChange =
|
|
42520
|
+
const handleRightTabChange = useCallback73(
|
|
42312
42521
|
(value) => {
|
|
42313
42522
|
if (value === rightTabValue) {
|
|
42314
42523
|
if (rightSidebarRef.current?.isExpanded()) {
|
|
@@ -42325,10 +42534,8 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42325
42534
|
},
|
|
42326
42535
|
[onChangeRightTab, rightSidebarRef, rightTabValue]
|
|
42327
42536
|
);
|
|
42328
|
-
const showLeftTabs = !!leftSidebarOptions.showTabs && !!leftTabItems
|
|
42329
|
-
|
|
42330
|
-
(!compactDrawerMenu || leftSidebarCollapsed);
|
|
42331
|
-
return /* @__PURE__ */ React316.createElement(
|
|
42537
|
+
const showLeftTabs = !!leftSidebarOptions.showTabs && !!leftTabItems;
|
|
42538
|
+
return /* @__PURE__ */ React316.createElement("div", { ref: containerRef, className: "n-flex n-flex-1" }, /* @__PURE__ */ React316.createElement(
|
|
42332
42539
|
PanelGroup,
|
|
42333
42540
|
{
|
|
42334
42541
|
ref: panelGroupRef,
|
|
@@ -42338,20 +42545,11 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42338
42545
|
autoSaveId,
|
|
42339
42546
|
onLayout: handleLayoutChange
|
|
42340
42547
|
},
|
|
42341
|
-
leftPanel && /* @__PURE__ */ React316.createElement(React316.Fragment, null,
|
|
42342
|
-
VerticalTabMenu,
|
|
42343
|
-
{
|
|
42344
|
-
tooltipSide: "right",
|
|
42345
|
-
items: leftTabItems,
|
|
42346
|
-
activeValue: leftTabValue,
|
|
42347
|
-
isSidebarCollapsed: leftSidebarCollapsed,
|
|
42348
|
-
onChange: handleLeftTabChange
|
|
42349
|
-
}
|
|
42350
|
-
), showLeftTabs && !leftSidebarCollapsed && /* @__PURE__ */ React316.createElement(DividerVertical, { className: "n-h-full" }), /* @__PURE__ */ React316.createElement(
|
|
42548
|
+
leftPanel && /* @__PURE__ */ React316.createElement(React316.Fragment, null, /* @__PURE__ */ React316.createElement(
|
|
42351
42549
|
Panel,
|
|
42352
42550
|
{
|
|
42353
42551
|
id: LEFT_SIDEBAR_ID,
|
|
42354
|
-
className: "n-relative",
|
|
42552
|
+
className: "n-relative n-workspace-sidebar",
|
|
42355
42553
|
order: 1,
|
|
42356
42554
|
ref: leftSidebarRef,
|
|
42357
42555
|
defaultSize: leftSidebarOptions.initialSize,
|
|
@@ -42360,8 +42558,21 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42360
42558
|
collapsible: true,
|
|
42361
42559
|
defaultCollapsed: leftSidebarOptions.defaultCollapsed
|
|
42362
42560
|
},
|
|
42363
|
-
leftSidebarCollapsed ? null :
|
|
42364
|
-
|
|
42561
|
+
leftSidebarCollapsed ? null : /* @__PURE__ */ React316.createElement("div", { className: "n-flex n-flex-col n-h-full" }, showLeftTabs && /* @__PURE__ */ React316.createElement(
|
|
42562
|
+
HorizontalTabBar,
|
|
42563
|
+
{
|
|
42564
|
+
items: leftTabItems,
|
|
42565
|
+
activeValue: leftTabValue,
|
|
42566
|
+
onChange: handleLeftTabChange
|
|
42567
|
+
}
|
|
42568
|
+
), /* @__PURE__ */ React316.createElement("div", { className: "n-flex-1 n-relative n-min-h-0" }, leftPanel))
|
|
42569
|
+
), /* @__PURE__ */ React316.createElement(
|
|
42570
|
+
PanelResizeHandle,
|
|
42571
|
+
{
|
|
42572
|
+
index: 0,
|
|
42573
|
+
className: `n-cursor-col-resize n-w-px n-h-full ${leftSidebarCollapsed ? "" : "n-bg-divider"}`
|
|
42574
|
+
}
|
|
42575
|
+
)),
|
|
42365
42576
|
/* @__PURE__ */ React316.createElement(
|
|
42366
42577
|
Panel,
|
|
42367
42578
|
{
|
|
@@ -42371,11 +42582,17 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42371
42582
|
},
|
|
42372
42583
|
centerPanel
|
|
42373
42584
|
),
|
|
42374
|
-
rightPanel && /* @__PURE__ */ React316.createElement(React316.Fragment, null, /* @__PURE__ */ React316.createElement(
|
|
42585
|
+
rightPanel && /* @__PURE__ */ React316.createElement(React316.Fragment, null, /* @__PURE__ */ React316.createElement(
|
|
42586
|
+
PanelResizeHandle,
|
|
42587
|
+
{
|
|
42588
|
+
index: 1,
|
|
42589
|
+
className: `n-cursor-col-resize n-w-px n-h-full ${rightSidebarCollapsed ? "" : "n-bg-divider"}`
|
|
42590
|
+
}
|
|
42591
|
+
), /* @__PURE__ */ React316.createElement(
|
|
42375
42592
|
Panel,
|
|
42376
42593
|
{
|
|
42377
42594
|
id: RIGHT_SIDEBAR_ID,
|
|
42378
|
-
className: "n-relative",
|
|
42595
|
+
className: "n-relative n-workspace-sidebar",
|
|
42379
42596
|
order: 3,
|
|
42380
42597
|
ref: rightSidebarRef,
|
|
42381
42598
|
minSize: rightSidebarOptions.minSize,
|
|
@@ -42384,18 +42601,16 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42384
42601
|
collapsible: true,
|
|
42385
42602
|
defaultCollapsed: rightSidebarOptions.defaultCollapsed
|
|
42386
42603
|
},
|
|
42387
|
-
rightSidebarCollapsed ? null :
|
|
42388
|
-
|
|
42389
|
-
|
|
42390
|
-
|
|
42391
|
-
|
|
42392
|
-
|
|
42393
|
-
|
|
42394
|
-
|
|
42395
|
-
onChange: handleRightTabChange
|
|
42396
|
-
}
|
|
42604
|
+
rightSidebarCollapsed ? null : /* @__PURE__ */ React316.createElement("div", { className: "n-flex n-flex-col n-h-full" }, rightSidebarOptions.showTabs && rightTabItems && /* @__PURE__ */ React316.createElement(
|
|
42605
|
+
HorizontalTabBar,
|
|
42606
|
+
{
|
|
42607
|
+
items: rightTabItems,
|
|
42608
|
+
activeValue: rightTabValue,
|
|
42609
|
+
onChange: handleRightTabChange
|
|
42610
|
+
}
|
|
42611
|
+
), /* @__PURE__ */ React316.createElement("div", { className: "n-flex-1 n-relative n-min-h-0" }, rightPanel))
|
|
42397
42612
|
))
|
|
42398
|
-
);
|
|
42613
|
+
));
|
|
42399
42614
|
});
|
|
42400
42615
|
|
|
42401
42616
|
// src/components/workspace/renderPanelChildren.tsx
|
|
@@ -42476,7 +42691,9 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42476
42691
|
showTabs: rightShowTabs = true
|
|
42477
42692
|
} = {},
|
|
42478
42693
|
theme,
|
|
42479
|
-
|
|
42694
|
+
onLeftSidebarStateChange,
|
|
42695
|
+
onRightSidebarStateChange,
|
|
42696
|
+
shouldAutoSave
|
|
42480
42697
|
}, forwardedRef) {
|
|
42481
42698
|
const containerRef = React317.useRef(null);
|
|
42482
42699
|
const containerSize = useSize(containerRef);
|
|
@@ -42494,8 +42711,8 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42494
42711
|
const rightSidebarMinPixels = toPixels(rightMinSize);
|
|
42495
42712
|
const rightSidebarMaxPixels = toPixels(rightMaxSize);
|
|
42496
42713
|
const rightSidebarInitialPixels = toPixels(rightInitialSize) ?? 280;
|
|
42497
|
-
const leftSidebarRef =
|
|
42498
|
-
const rightSidebarRef =
|
|
42714
|
+
const leftSidebarRef = useRef93(null);
|
|
42715
|
+
const rightSidebarRef = useRef93(null);
|
|
42499
42716
|
const [leftTabValue, setLeftTabValue] = useControlledOrUncontrolled({
|
|
42500
42717
|
value: leftTabValueProp,
|
|
42501
42718
|
onChange: onChangeLeftTab,
|
|
@@ -42563,34 +42780,34 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42563
42780
|
}
|
|
42564
42781
|
});
|
|
42565
42782
|
const isDrawerActive = sideType === "drawer" || sideType === "auto" && parentSize.width <= sideTypeBreakpoint;
|
|
42566
|
-
const closeLeftSidebar =
|
|
42783
|
+
const closeLeftSidebar = useCallback74(() => {
|
|
42567
42784
|
if (isDrawerActive) {
|
|
42568
42785
|
leftSidebarRef.current?.collapse();
|
|
42569
42786
|
}
|
|
42570
42787
|
}, [isDrawerActive]);
|
|
42571
|
-
const closeRightSidebar =
|
|
42788
|
+
const closeRightSidebar = useCallback74(() => {
|
|
42572
42789
|
if (isDrawerActive) {
|
|
42573
42790
|
rightSidebarRef.current?.collapse();
|
|
42574
42791
|
}
|
|
42575
42792
|
}, [isDrawerActive]);
|
|
42576
|
-
const leftChildrenProps =
|
|
42793
|
+
const leftChildrenProps = useMemo154(() => {
|
|
42577
42794
|
return {
|
|
42578
42795
|
activeTabValue: leftTabValue,
|
|
42579
42796
|
closeSidebar: closeLeftSidebar
|
|
42580
42797
|
};
|
|
42581
42798
|
}, [leftTabValue, closeLeftSidebar]);
|
|
42582
|
-
const rightChildrenProps =
|
|
42799
|
+
const rightChildrenProps = useMemo154(() => {
|
|
42583
42800
|
return {
|
|
42584
42801
|
activeTabValue: rightTabValue,
|
|
42585
42802
|
closeSidebar: closeRightSidebar
|
|
42586
42803
|
};
|
|
42587
42804
|
}, [rightTabValue, closeRightSidebar]);
|
|
42588
|
-
const leftSidebarProviderValue =
|
|
42805
|
+
const leftSidebarProviderValue = useMemo154(() => {
|
|
42589
42806
|
return {
|
|
42590
42807
|
closeSidebar: closeLeftSidebar
|
|
42591
42808
|
};
|
|
42592
42809
|
}, [closeLeftSidebar]);
|
|
42593
|
-
const rightSidebarProviderValue =
|
|
42810
|
+
const rightSidebarProviderValue = useMemo154(() => {
|
|
42594
42811
|
return {
|
|
42595
42812
|
closeSidebar: closeRightSidebar
|
|
42596
42813
|
};
|
|
@@ -42612,7 +42829,7 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42612
42829
|
/* @__PURE__ */ React317.createElement(WorkspaceSideProvider, { value: rightSidebarProviderValue }, rightTabValue ? renderPanelChildren(right, rightChildrenProps) : null)
|
|
42613
42830
|
) : null;
|
|
42614
42831
|
const centerPanel = /* @__PURE__ */ React317.createElement(PanelInner, { className: "n-bg-canvas-background" }, children);
|
|
42615
|
-
const leftSidebarOptions =
|
|
42832
|
+
const leftSidebarOptions = useMemo154(
|
|
42616
42833
|
() => ({
|
|
42617
42834
|
minSize: leftSidebarMinPixels,
|
|
42618
42835
|
maxSize: leftSidebarMaxPixels,
|
|
@@ -42630,7 +42847,7 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42630
42847
|
leftShowTabs
|
|
42631
42848
|
]
|
|
42632
42849
|
);
|
|
42633
|
-
const rightSidebarOptions =
|
|
42850
|
+
const rightSidebarOptions = useMemo154(
|
|
42634
42851
|
() => ({
|
|
42635
42852
|
minSize: rightSidebarMinPixels,
|
|
42636
42853
|
maxSize: rightSidebarMaxPixels,
|
|
@@ -42681,7 +42898,9 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42681
42898
|
autoSavePrefix,
|
|
42682
42899
|
leftSidebarRef,
|
|
42683
42900
|
rightSidebarRef,
|
|
42684
|
-
|
|
42901
|
+
onLeftSidebarStateChange,
|
|
42902
|
+
onRightSidebarStateChange,
|
|
42903
|
+
shouldAutoSave
|
|
42685
42904
|
}
|
|
42686
42905
|
), isOverlay && /* @__PURE__ */ React317.createElement(
|
|
42687
42906
|
OverlayToolbar,
|
|
@@ -42745,9 +42964,9 @@ function usePlatformModKey() {
|
|
|
42745
42964
|
}
|
|
42746
42965
|
|
|
42747
42966
|
// src/hooks/useTheme.ts
|
|
42748
|
-
import { useEffect as
|
|
42967
|
+
import { useEffect as useEffect60, useState as useState79 } from "react";
|
|
42749
42968
|
function useTheme() {
|
|
42750
|
-
const [theme, setTheme] =
|
|
42969
|
+
const [theme, setTheme] = useState79("light");
|
|
42751
42970
|
const checkTheme = () => {
|
|
42752
42971
|
const currentTheme = document.body.getAttribute("data-theme");
|
|
42753
42972
|
switch (currentTheme) {
|
|
@@ -42759,7 +42978,7 @@ function useTheme() {
|
|
|
42759
42978
|
break;
|
|
42760
42979
|
}
|
|
42761
42980
|
};
|
|
42762
|
-
|
|
42981
|
+
useEffect60(() => {
|
|
42763
42982
|
checkTheme();
|
|
42764
42983
|
const observer = new MutationObserver((mutations) => {
|
|
42765
42984
|
mutations.forEach((mutation) => {
|