@noya-app/noya-designsystem 0.1.82 → 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 +8 -0
- package/dist/index.css +1 -1
- package/dist/index.d.mts +36 -9
- package/dist/index.d.ts +36 -9
- package/dist/index.js +422 -278
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +411 -267
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/components/SegmentedControl.tsx +227 -48
- 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/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/chunk-QDV7OQMJ.mjs +0 -37
- package/dist/chunk-QDV7OQMJ.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -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
|
|
149
|
+
var useRef94 = React321.useRef;
|
|
150
150
|
var useEffect61 = React321.useEffect;
|
|
151
|
-
var
|
|
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) {
|
|
@@ -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) {
|
|
@@ -30949,6 +30949,12 @@ import React230, {
|
|
|
30949
30949
|
useRef as useRef71,
|
|
30950
30950
|
useState as useState61
|
|
30951
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;
|
|
30952
30958
|
var SegmentedControlContext = createContext49({
|
|
30953
30959
|
colorScheme: "primary"
|
|
30954
30960
|
});
|
|
@@ -30962,7 +30968,14 @@ var SegmentedControlItem = forwardRef90(function SegmentedControlItem2({
|
|
|
30962
30968
|
variant = "default",
|
|
30963
30969
|
...props
|
|
30964
30970
|
}, forwardedRef) {
|
|
30965
|
-
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;
|
|
30966
30979
|
const handlePointerDown = useCallback57(
|
|
30967
30980
|
(event2) => {
|
|
30968
30981
|
if (disabled2) return;
|
|
@@ -30993,7 +31006,7 @@ var SegmentedControlItem = forwardRef90(function SegmentedControlItem2({
|
|
|
30993
31006
|
// checked
|
|
30994
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" ? (
|
|
30995
31008
|
// default variant: only text color, background handled by sliding indicator
|
|
30996
|
-
colorScheme === "secondary"
|
|
31009
|
+
colorScheme === "secondary" || colorScheme === "primary" ? "data-[pressed]:n-text-white" : "data-[pressed]:n-text-segmented-control-item-active-text"
|
|
30997
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",
|
|
30998
31011
|
"focus-visible:n-z-interactable",
|
|
30999
31012
|
// checked default (all colorSchemes) - hide separators near selected
|
|
@@ -31001,10 +31014,12 @@ var SegmentedControlItem = forwardRef90(function SegmentedControlItem2({
|
|
|
31001
31014
|
// hover
|
|
31002
31015
|
variant === "buttons" && "hover:n-bg-button-background-hover",
|
|
31003
31016
|
// spacing and borders
|
|
31004
|
-
|
|
31017
|
+
ITEM_PADDING,
|
|
31005
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",
|
|
31006
|
-
// icon only buttons
|
|
31019
|
+
// icon only buttons (explicit or due to compact mode)
|
|
31007
31020
|
variant === "buttons" && title === "" && icon && "n-min-w-input-height",
|
|
31021
|
+
// icon only in compact mode
|
|
31022
|
+
isCompact && icon && "n-min-w-input-height",
|
|
31008
31023
|
className
|
|
31009
31024
|
),
|
|
31010
31025
|
...props
|
|
@@ -31018,34 +31033,24 @@ var SegmentedControlItem = forwardRef90(function SegmentedControlItem2({
|
|
|
31018
31033
|
)
|
|
31019
31034
|
},
|
|
31020
31035
|
icon && renderIcon(icon),
|
|
31021
|
-
title
|
|
31036
|
+
showTitle && title
|
|
31022
31037
|
)
|
|
31023
31038
|
);
|
|
31024
|
-
return
|
|
31039
|
+
return effectiveTooltip ? /* @__PURE__ */ React230.createElement(Tooltip, { content: effectiveTooltip }, itemElement) : itemElement;
|
|
31025
31040
|
});
|
|
31026
|
-
|
|
31027
|
-
|
|
31028
|
-
|
|
31029
|
-
|
|
31030
|
-
|
|
31031
|
-
|
|
31032
|
-
|
|
31033
|
-
variant = "default",
|
|
31034
|
-
className,
|
|
31035
|
-
style: style2,
|
|
31036
|
-
itemWidth = "auto"
|
|
31041
|
+
function useIndicatorPosition({
|
|
31042
|
+
containerRef,
|
|
31043
|
+
itemRefs,
|
|
31044
|
+
selectedIndex,
|
|
31045
|
+
variant,
|
|
31046
|
+
itemCount,
|
|
31047
|
+
isCompact
|
|
31037
31048
|
}) {
|
|
31038
|
-
const { fieldId: id } = useLabel({ fieldId: idProp });
|
|
31039
31049
|
const hasInitialized = useRef71(false);
|
|
31040
|
-
const
|
|
31041
|
-
const
|
|
31050
|
+
const isResizingRef = useRef71(false);
|
|
31051
|
+
const resizeTimeoutRef = useRef71(void 0);
|
|
31042
31052
|
const [indicatorStyle, setIndicatorStyle] = useState61(null);
|
|
31043
|
-
const
|
|
31044
|
-
const selectedIndex = useMemo117(() => {
|
|
31045
|
-
if (!value) return -1;
|
|
31046
|
-
return items.findIndex((item) => item.value === value);
|
|
31047
|
-
}, [value, items]);
|
|
31048
|
-
useLayoutEffect10(() => {
|
|
31053
|
+
const measureIndicator = useCallback57(() => {
|
|
31049
31054
|
if (variant !== "default" || selectedIndex < 0) {
|
|
31050
31055
|
setIndicatorStyle(null);
|
|
31051
31056
|
return;
|
|
@@ -31063,16 +31068,134 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
31063
31068
|
width: itemRect.width
|
|
31064
31069
|
});
|
|
31065
31070
|
hasInitialized.current = true;
|
|
31066
|
-
}, [selectedIndex, variant,
|
|
31071
|
+
}, [containerRef, itemRefs, selectedIndex, variant, itemCount, isCompact]);
|
|
31072
|
+
useLayoutEffect10(measureIndicator, [measureIndicator]);
|
|
31067
31073
|
useLayoutEffect10(() => {
|
|
31068
31074
|
const container = containerRef.current;
|
|
31069
31075
|
if (!container || variant !== "default") return;
|
|
31070
31076
|
const observer = new ResizeObserver(() => {
|
|
31071
|
-
|
|
31077
|
+
isResizingRef.current = true;
|
|
31078
|
+
clearTimeout(resizeTimeoutRef.current);
|
|
31079
|
+
resizeTimeoutRef.current = setTimeout(() => {
|
|
31080
|
+
isResizingRef.current = false;
|
|
31081
|
+
}, RESIZE_SETTLE_MS);
|
|
31082
|
+
measureIndicator();
|
|
31072
31083
|
});
|
|
31073
31084
|
observer.observe(container);
|
|
31074
|
-
return () =>
|
|
31075
|
-
|
|
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
|
+
});
|
|
31076
31199
|
const handleSelect = useCallback57(
|
|
31077
31200
|
(newValue) => {
|
|
31078
31201
|
if (!allowEmpty && !newValue) return;
|
|
@@ -31085,8 +31208,8 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
31085
31208
|
[handleSelect]
|
|
31086
31209
|
);
|
|
31087
31210
|
const contextValue = useMemo117(
|
|
31088
|
-
() => ({ colorScheme, onSelect: handleSelect, itemWidth }),
|
|
31089
|
-
[colorScheme, handleSelect, itemWidth]
|
|
31211
|
+
() => ({ colorScheme, onSelect: handleSelect, itemWidth, isCompact }),
|
|
31212
|
+
[colorScheme, handleSelect, itemWidth, isCompact]
|
|
31090
31213
|
);
|
|
31091
31214
|
const indicatorBgClass = colorScheme === "secondary" ? "n-bg-secondary" : colorScheme === "primary" ? "n-bg-primary" : "n-bg-segmented-control-item-active-background";
|
|
31092
31215
|
return /* @__PURE__ */ React230.createElement(SegmentedControlContext.Provider, { value: contextValue }, /* @__PURE__ */ React230.createElement(
|
|
@@ -31099,7 +31222,7 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
31099
31222
|
className: cx(
|
|
31100
31223
|
"n-appearance-none n-relative n-outline-none",
|
|
31101
31224
|
variant === "default" && (itemWidth === "fit" ? "n-flex n-w-fit" : "n-grid"),
|
|
31102
|
-
variant === "default" &&
|
|
31225
|
+
variant === "default" && `n-min-h-input-height n-bg-input-background n-rounded n-py-0.5 ${CONTAINER_PADDING_X}`,
|
|
31103
31226
|
variant !== "default" && "n-flex",
|
|
31104
31227
|
variant === "tabs" && "n-gap-1.5 n-min-h-[33px]",
|
|
31105
31228
|
variant === "buttons" && "n-gap-1.5 n-min-h-input-height",
|
|
@@ -31118,7 +31241,7 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
31118
31241
|
className: cx(
|
|
31119
31242
|
"n-absolute n-top-0.5 n-bottom-0.5 n-rounded n-shadow-segment n-pointer-events-none",
|
|
31120
31243
|
indicatorBgClass,
|
|
31121
|
-
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"
|
|
31122
31245
|
),
|
|
31123
31246
|
style: {
|
|
31124
31247
|
left: indicatorStyle.left,
|
|
@@ -41231,8 +41354,8 @@ import React317, {
|
|
|
41231
41354
|
memo as memo40,
|
|
41232
41355
|
useCallback as useCallback74,
|
|
41233
41356
|
useImperativeHandle as useImperativeHandle18,
|
|
41234
|
-
useMemo as
|
|
41235
|
-
useRef as
|
|
41357
|
+
useMemo as useMemo154,
|
|
41358
|
+
useRef as useRef93
|
|
41236
41359
|
} from "react";
|
|
41237
41360
|
|
|
41238
41361
|
// src/components/OverlayToolbar.tsx
|
|
@@ -41304,16 +41427,7 @@ function OverlayToolbar({
|
|
|
41304
41427
|
}
|
|
41305
41428
|
|
|
41306
41429
|
// src/components/workspace/DrawerWorkspaceLayout.tsx
|
|
41307
|
-
import
|
|
41308
|
-
|
|
41309
|
-
// src/components/workspace/constants.ts
|
|
41310
|
-
var EDITOR_PANEL_GROUP_ID = "editor-panel-group";
|
|
41311
|
-
var LEFT_SIDEBAR_ID = "editor-1-left-sidebar";
|
|
41312
|
-
var RIGHT_SIDEBAR_ID = "editor-3-right-sidebar";
|
|
41313
|
-
var CONTENT_AREA_ID = "editor-2-content-area";
|
|
41314
|
-
|
|
41315
|
-
// src/components/workspace/VerticalTabMenu.tsx
|
|
41316
|
-
import React311, { useMemo as useMemo151 } from "react";
|
|
41430
|
+
import React311, { useMemo as useMemo151, useState as useState76 } from "react";
|
|
41317
41431
|
|
|
41318
41432
|
// src/components/Toolbar.tsx
|
|
41319
41433
|
import { useKeyboardShortcuts as useKeyboardShortcuts3 } from "@noya-app/noya-keymap";
|
|
@@ -41628,38 +41742,11 @@ function Toolbar({
|
|
|
41628
41742
|
);
|
|
41629
41743
|
}
|
|
41630
41744
|
|
|
41631
|
-
// src/components/workspace/
|
|
41632
|
-
var
|
|
41633
|
-
|
|
41634
|
-
|
|
41635
|
-
|
|
41636
|
-
onChange,
|
|
41637
|
-
tooltipSide
|
|
41638
|
-
}) {
|
|
41639
|
-
const style2 = useMemo151(() => {
|
|
41640
|
-
return {
|
|
41641
|
-
[cssVarNames.colors.inputBackground]: "transparent",
|
|
41642
|
-
[cssVarNames.colors.buttonBackground]: "transparent"
|
|
41643
|
-
};
|
|
41644
|
-
}, []);
|
|
41645
|
-
return /* @__PURE__ */ React311.createElement(
|
|
41646
|
-
"div",
|
|
41647
|
-
{
|
|
41648
|
-
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",
|
|
41649
|
-
style: style2
|
|
41650
|
-
},
|
|
41651
|
-
/* @__PURE__ */ React311.createElement(
|
|
41652
|
-
ToolbarMenu,
|
|
41653
|
-
{
|
|
41654
|
-
items,
|
|
41655
|
-
activeValue: isSidebarCollapsed ? void 0 : activeValue,
|
|
41656
|
-
onSelectMenuItem: onChange,
|
|
41657
|
-
tooltipSide,
|
|
41658
|
-
displayFilter: "iconOnly"
|
|
41659
|
-
}
|
|
41660
|
-
)
|
|
41661
|
-
);
|
|
41662
|
-
});
|
|
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";
|
|
41663
41750
|
|
|
41664
41751
|
// src/components/workspace/DrawerWorkspaceLayout.tsx
|
|
41665
41752
|
var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
@@ -41673,166 +41760,138 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
|
41673
41760
|
rightTabItems,
|
|
41674
41761
|
rightTabValue,
|
|
41675
41762
|
onChangeRightTab,
|
|
41676
|
-
onChangeLeftTab
|
|
41677
|
-
compactDrawerMenu
|
|
41763
|
+
onChangeLeftTab
|
|
41678
41764
|
}) {
|
|
41679
|
-
const portalContainer = useRef90(null);
|
|
41680
41765
|
const [{ leftSidebarCollapsed, rightSidebarCollapsed }, setLayoutState] = useState76({
|
|
41681
41766
|
leftSidebarCollapsed: true,
|
|
41682
41767
|
rightSidebarCollapsed: true
|
|
41683
41768
|
});
|
|
41684
|
-
|
|
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(
|
|
41685
41796
|
() => [
|
|
41686
41797
|
...leftPanel ? leftTabItems ?? [] : [],
|
|
41687
41798
|
...rightPanel ? rightTabItems ?? [] : []
|
|
41688
41799
|
],
|
|
41689
41800
|
[leftTabItems, rightTabItems, leftPanel, rightPanel]
|
|
41690
41801
|
);
|
|
41691
|
-
const
|
|
41692
|
-
const allSelectableTabItems = useMemo152(
|
|
41802
|
+
const allSelectableTabItems = useMemo151(
|
|
41693
41803
|
() => allTabItems.filter(isSelectableMenuItem),
|
|
41694
41804
|
[allTabItems]
|
|
41695
41805
|
);
|
|
41696
|
-
const
|
|
41697
|
-
const leftSelectableTabItems =
|
|
41806
|
+
const hasTabs = allSelectableTabItems.length > 0;
|
|
41807
|
+
const leftSelectableTabItems = useMemo151(
|
|
41698
41808
|
() => (leftTabItems ?? []).filter(isSelectableMenuItem),
|
|
41699
41809
|
[leftTabItems]
|
|
41700
41810
|
);
|
|
41701
|
-
const rightSelectableTabItems =
|
|
41811
|
+
const rightSelectableTabItems = useMemo151(
|
|
41702
41812
|
() => (rightTabItems ?? []).filter(isSelectableMenuItem),
|
|
41703
41813
|
[rightTabItems]
|
|
41704
41814
|
);
|
|
41705
|
-
const toggleSidebar = (ref) => {
|
|
41706
|
-
if (ref.current?.isExpanded()) {
|
|
41707
|
-
ref.current?.collapse();
|
|
41708
|
-
} else {
|
|
41709
|
-
ref.current?.expand();
|
|
41710
|
-
}
|
|
41711
|
-
};
|
|
41712
|
-
const ensureExpanded = (ref) => {
|
|
41713
|
-
if (!ref.current?.isExpanded()) {
|
|
41714
|
-
ref.current?.expand();
|
|
41715
|
-
}
|
|
41716
|
-
};
|
|
41717
41815
|
const handleSelectTab = (value) => {
|
|
41718
|
-
|
|
41719
|
-
|
|
41720
|
-
|
|
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 }));
|
|
41721
41825
|
} else {
|
|
41722
|
-
|
|
41826
|
+
setLayoutState({
|
|
41827
|
+
leftSidebarCollapsed: false,
|
|
41828
|
+
rightSidebarCollapsed: true
|
|
41829
|
+
});
|
|
41723
41830
|
onChangeLeftTab?.(value);
|
|
41724
41831
|
}
|
|
41725
|
-
} else if (
|
|
41726
|
-
if (value === rightTabValue) {
|
|
41727
|
-
|
|
41832
|
+
} else if (isRightItem) {
|
|
41833
|
+
if (value === rightTabValue && !rightSidebarCollapsed) {
|
|
41834
|
+
setLayoutState((prev) => ({ ...prev, rightSidebarCollapsed: true }));
|
|
41728
41835
|
} else {
|
|
41729
|
-
|
|
41836
|
+
setLayoutState({
|
|
41837
|
+
leftSidebarCollapsed: true,
|
|
41838
|
+
rightSidebarCollapsed: false
|
|
41839
|
+
});
|
|
41730
41840
|
onChangeRightTab?.(value);
|
|
41731
41841
|
}
|
|
41732
41842
|
}
|
|
41733
41843
|
};
|
|
41734
|
-
const
|
|
41735
|
-
|
|
41736
|
-
|
|
41737
|
-
|
|
41738
|
-
|
|
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(
|
|
41739
41855
|
"div",
|
|
41740
41856
|
{
|
|
41741
|
-
ref: portalContainer,
|
|
41742
41857
|
id: EDITOR_PANEL_GROUP_ID,
|
|
41743
|
-
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"
|
|
41744
41859
|
},
|
|
41745
|
-
hasTabs &&
|
|
41746
|
-
|
|
41747
|
-
{
|
|
41748
|
-
tooltipSide: "right",
|
|
41749
|
-
items: allTabItems,
|
|
41750
|
-
activeValue,
|
|
41751
|
-
isSidebarCollapsed,
|
|
41752
|
-
onChange: (value) => handleSelectTab(value)
|
|
41753
|
-
}
|
|
41754
|
-
), /* @__PURE__ */ React312.createElement(DividerVertical, { className: "n-h-full" })),
|
|
41755
|
-
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(
|
|
41756
|
-
Button,
|
|
41860
|
+
hasTabs && /* @__PURE__ */ React311.createElement(React311.Fragment, null, /* @__PURE__ */ React311.createElement(
|
|
41861
|
+
"div",
|
|
41757
41862
|
{
|
|
41758
|
-
|
|
41759
|
-
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",
|
|
41760
41864
|
style: {
|
|
41761
|
-
|
|
41762
|
-
|
|
41763
|
-
},
|
|
41764
|
-
icon: allSelectableTabItems[0].icon,
|
|
41765
|
-
tooltip: allSelectableTabItems[0].tooltip ?? allSelectableTabItems[0].title,
|
|
41766
|
-
active: (() => {
|
|
41767
|
-
const value = allSelectableTabItems[0].value;
|
|
41768
|
-
const isLeftItem = leftSelectableTabItems.some(
|
|
41769
|
-
(i) => i.value === value
|
|
41770
|
-
);
|
|
41771
|
-
const isRightItem = rightSelectableTabItems.some(
|
|
41772
|
-
(i) => i.value === value
|
|
41773
|
-
);
|
|
41774
|
-
return isLeftItem ? !leftSidebarCollapsed : isRightItem ? !rightSidebarCollapsed : false;
|
|
41775
|
-
})(),
|
|
41776
|
-
onClick: () => {
|
|
41777
|
-
const value = allSelectableTabItems[0].value;
|
|
41778
|
-
handleSelectTab(value);
|
|
41779
|
-
}
|
|
41780
|
-
}
|
|
41781
|
-
)),
|
|
41782
|
-
/* @__PURE__ */ React312.createElement("div", { className: "n-flex-1 n-flex n-relative" }, centerPanel),
|
|
41783
|
-
leftPanel && /* @__PURE__ */ React312.createElement(
|
|
41784
|
-
Drawer,
|
|
41785
|
-
{
|
|
41786
|
-
modal: false,
|
|
41787
|
-
ref: leftSidebarRef,
|
|
41788
|
-
className: "n-flex-1",
|
|
41789
|
-
style: useCompactInToolbar ? void 0 : { left: 48, maxWidth: "calc(100% - 48px)" },
|
|
41790
|
-
overlayStyle: useCompactInToolbar ? void 0 : { left: 48 },
|
|
41791
|
-
open: !leftSidebarCollapsed,
|
|
41792
|
-
positioning: "absolute",
|
|
41793
|
-
side: "left",
|
|
41794
|
-
trigger: null,
|
|
41795
|
-
portalContainer: portalContainer.current,
|
|
41796
|
-
onOpenChange: (open2) => {
|
|
41797
|
-
setLayoutState({
|
|
41798
|
-
leftSidebarCollapsed: !open2,
|
|
41799
|
-
rightSidebarCollapsed
|
|
41800
|
-
});
|
|
41865
|
+
[cssVarNames.colors.inputBackground]: "transparent",
|
|
41866
|
+
[cssVarNames.colors.buttonBackground]: "transparent"
|
|
41801
41867
|
}
|
|
41802
41868
|
},
|
|
41803
|
-
|
|
41804
|
-
|
|
41805
|
-
|
|
41806
|
-
|
|
41807
|
-
|
|
41808
|
-
id: RIGHT_SIDEBAR_ID,
|
|
41809
|
-
modal: false,
|
|
41810
|
-
ref: rightSidebarRef,
|
|
41811
|
-
className: "n-flex-1",
|
|
41812
|
-
style: useCompactInToolbar ? void 0 : { left: 48, maxWidth: "calc(100% - 48px)" },
|
|
41813
|
-
overlayStyle: useCompactInToolbar ? void 0 : { left: 48 },
|
|
41814
|
-
open: !rightSidebarCollapsed,
|
|
41815
|
-
positioning: "absolute",
|
|
41816
|
-
side: "left",
|
|
41817
|
-
trigger: null,
|
|
41818
|
-
portalContainer: portalContainer.current,
|
|
41819
|
-
onOpenChange: (open2) => {
|
|
41820
|
-
setLayoutState({
|
|
41821
|
-
leftSidebarCollapsed,
|
|
41822
|
-
rightSidebarCollapsed: !open2
|
|
41823
|
-
});
|
|
41869
|
+
/* @__PURE__ */ React311.createElement(
|
|
41870
|
+
ToolbarMenu,
|
|
41871
|
+
{
|
|
41872
|
+
items: toolbarMenuItems,
|
|
41873
|
+
onSelectMenuItem: handleSelectTab
|
|
41824
41874
|
}
|
|
41825
|
-
|
|
41826
|
-
|
|
41827
|
-
)
|
|
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))
|
|
41828
41887
|
);
|
|
41829
41888
|
});
|
|
41830
41889
|
|
|
41831
41890
|
// src/components/workspace/PanelWorkspaceLayout.tsx
|
|
41832
|
-
import React316, { useCallback as useCallback73, useMemo as
|
|
41891
|
+
import React316, { useCallback as useCallback73, useMemo as useMemo153, useRef as useRef92, useState as useState78 } from "react";
|
|
41833
41892
|
|
|
41834
41893
|
// src/components/resizablePanels/Panel.tsx
|
|
41835
|
-
import
|
|
41894
|
+
import React312, {
|
|
41836
41895
|
forwardRef as forwardRef124,
|
|
41837
41896
|
useEffect as useEffect58,
|
|
41838
41897
|
useId as useId5,
|
|
@@ -41854,7 +41913,17 @@ function usePanelGroupContext() {
|
|
|
41854
41913
|
|
|
41855
41914
|
// src/components/resizablePanels/Panel.tsx
|
|
41856
41915
|
var Panel = forwardRef124(
|
|
41857
|
-
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) {
|
|
41858
41927
|
const generatedId = useId5();
|
|
41859
41928
|
const id = propId ?? generatedId;
|
|
41860
41929
|
const context = usePanelGroupContext();
|
|
@@ -41879,7 +41948,17 @@ var Panel = forwardRef124(
|
|
|
41879
41948
|
return () => {
|
|
41880
41949
|
unregisterPanel(id);
|
|
41881
41950
|
};
|
|
41882
|
-
}, [
|
|
41951
|
+
}, [
|
|
41952
|
+
id,
|
|
41953
|
+
order,
|
|
41954
|
+
defaultSize,
|
|
41955
|
+
minSize,
|
|
41956
|
+
maxSize,
|
|
41957
|
+
collapsible,
|
|
41958
|
+
defaultCollapsed,
|
|
41959
|
+
registerPanel,
|
|
41960
|
+
unregisterPanel
|
|
41961
|
+
]);
|
|
41883
41962
|
const size4 = getPanelSize(id);
|
|
41884
41963
|
const isFlexPanel = defaultSize === void 0;
|
|
41885
41964
|
useImperativeHandle16(
|
|
@@ -41895,7 +41974,7 @@ var Panel = forwardRef124(
|
|
|
41895
41974
|
if (size4 === 0 && !isFlexPanel) {
|
|
41896
41975
|
return null;
|
|
41897
41976
|
}
|
|
41898
|
-
return /* @__PURE__ */
|
|
41977
|
+
return /* @__PURE__ */ React312.createElement(
|
|
41899
41978
|
"div",
|
|
41900
41979
|
{
|
|
41901
41980
|
"data-panel-id": id,
|
|
@@ -41910,13 +41989,13 @@ var Panel = forwardRef124(
|
|
|
41910
41989
|
);
|
|
41911
41990
|
|
|
41912
41991
|
// src/components/resizablePanels/PanelGroup.tsx
|
|
41913
|
-
import
|
|
41992
|
+
import React313, {
|
|
41914
41993
|
forwardRef as forwardRef125,
|
|
41915
41994
|
useCallback as useCallback71,
|
|
41916
41995
|
useEffect as useEffect59,
|
|
41917
41996
|
useImperativeHandle as useImperativeHandle17,
|
|
41918
|
-
useMemo as
|
|
41919
|
-
useRef as
|
|
41997
|
+
useMemo as useMemo152,
|
|
41998
|
+
useRef as useRef90,
|
|
41920
41999
|
useState as useState77
|
|
41921
42000
|
} from "react";
|
|
41922
42001
|
function getStorageKey(autoSaveId) {
|
|
@@ -41938,17 +42017,17 @@ function saveSizes(autoSaveId, sizes) {
|
|
|
41938
42017
|
}
|
|
41939
42018
|
var PanelGroup = forwardRef125(
|
|
41940
42019
|
function PanelGroup2({ id, className, direction, autoSaveId, onLayout, children }, ref) {
|
|
41941
|
-
const containerRef =
|
|
42020
|
+
const containerRef = useRef90(null);
|
|
41942
42021
|
const containerSize = useSize(containerRef);
|
|
41943
42022
|
const containerWidth = containerSize?.width ?? 0;
|
|
41944
42023
|
const [panels, setPanels] = useState77(/* @__PURE__ */ new Map());
|
|
41945
|
-
const panelsRef =
|
|
42024
|
+
const panelsRef = useRef90(panels);
|
|
41946
42025
|
panelsRef.current = panels;
|
|
41947
42026
|
const [resizing, setResizing] = useState77(null);
|
|
41948
|
-
const sortedPanels =
|
|
42027
|
+
const sortedPanels = useMemo152(() => {
|
|
41949
42028
|
return Array.from(panels.values()).sort((a, b) => a.order - b.order);
|
|
41950
42029
|
}, [panels]);
|
|
41951
|
-
const flexPanelId =
|
|
42030
|
+
const flexPanelId = useMemo152(() => {
|
|
41952
42031
|
for (const panel of sortedPanels) {
|
|
41953
42032
|
if (panel.defaultSize === void 0) {
|
|
41954
42033
|
return panel.id;
|
|
@@ -41998,8 +42077,13 @@ var PanelGroup = forwardRef125(
|
|
|
41998
42077
|
const savedSizes = loadSavedSizes(autoSaveId);
|
|
41999
42078
|
const savedSize = savedSizes?.[panel.id];
|
|
42000
42079
|
const hasSavedSize = savedSize !== void 0;
|
|
42001
|
-
|
|
42002
|
-
|
|
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;
|
|
42003
42087
|
const newPanels = new Map(prev);
|
|
42004
42088
|
newPanels.set(panel.id, {
|
|
42005
42089
|
...panel,
|
|
@@ -42233,7 +42317,7 @@ var PanelGroup = forwardRef125(
|
|
|
42233
42317
|
});
|
|
42234
42318
|
}
|
|
42235
42319
|
}));
|
|
42236
|
-
const contextValue =
|
|
42320
|
+
const contextValue = useMemo152(
|
|
42237
42321
|
() => ({
|
|
42238
42322
|
registerPanel,
|
|
42239
42323
|
unregisterPanel,
|
|
@@ -42259,7 +42343,7 @@ var PanelGroup = forwardRef125(
|
|
|
42259
42343
|
containerWidth
|
|
42260
42344
|
]
|
|
42261
42345
|
);
|
|
42262
|
-
return /* @__PURE__ */
|
|
42346
|
+
return /* @__PURE__ */ React313.createElement(PanelGroupContext.Provider, { value: contextValue }, /* @__PURE__ */ React313.createElement(
|
|
42263
42347
|
"div",
|
|
42264
42348
|
{
|
|
42265
42349
|
ref: containerRef,
|
|
@@ -42277,14 +42361,14 @@ var PanelGroup = forwardRef125(
|
|
|
42277
42361
|
);
|
|
42278
42362
|
|
|
42279
42363
|
// src/components/resizablePanels/PanelResizeHandle.tsx
|
|
42280
|
-
import
|
|
42364
|
+
import React314, { useCallback as useCallback72, useContext as useContext65, useRef as useRef91 } from "react";
|
|
42281
42365
|
function PanelResizeHandle({
|
|
42282
42366
|
className,
|
|
42283
42367
|
disabled: disabled2,
|
|
42284
42368
|
index: index2
|
|
42285
42369
|
}) {
|
|
42286
42370
|
const context = useContext65(PanelGroupContext);
|
|
42287
|
-
const handleRef =
|
|
42371
|
+
const handleRef = useRef91(null);
|
|
42288
42372
|
const handleMouseDown = useCallback72(
|
|
42289
42373
|
(e) => {
|
|
42290
42374
|
if (disabled2 || !context) return;
|
|
@@ -42296,7 +42380,7 @@ function PanelResizeHandle({
|
|
|
42296
42380
|
if (!context) {
|
|
42297
42381
|
return null;
|
|
42298
42382
|
}
|
|
42299
|
-
return /* @__PURE__ */
|
|
42383
|
+
return /* @__PURE__ */ React314.createElement(
|
|
42300
42384
|
"div",
|
|
42301
42385
|
{
|
|
42302
42386
|
ref: handleRef,
|
|
@@ -42309,7 +42393,7 @@ function PanelResizeHandle({
|
|
|
42309
42393
|
zIndex: 10
|
|
42310
42394
|
}
|
|
42311
42395
|
},
|
|
42312
|
-
/* @__PURE__ */
|
|
42396
|
+
/* @__PURE__ */ React314.createElement(
|
|
42313
42397
|
"div",
|
|
42314
42398
|
{
|
|
42315
42399
|
style: {
|
|
@@ -42325,6 +42409,32 @@ function PanelResizeHandle({
|
|
|
42325
42409
|
);
|
|
42326
42410
|
}
|
|
42327
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
|
+
|
|
42328
42438
|
// src/components/workspace/PanelWorkspaceLayout.tsx
|
|
42329
42439
|
var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
42330
42440
|
leftPanel,
|
|
@@ -42341,30 +42451,54 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42341
42451
|
rightTabValue,
|
|
42342
42452
|
onChangeLeftTab,
|
|
42343
42453
|
onChangeRightTab,
|
|
42344
|
-
|
|
42454
|
+
onLeftSidebarStateChange,
|
|
42455
|
+
onRightSidebarStateChange,
|
|
42456
|
+
shouldAutoSave = true
|
|
42345
42457
|
}) {
|
|
42346
|
-
const panelGroupRef =
|
|
42347
|
-
const
|
|
42348
|
-
|
|
42349
|
-
|
|
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]);
|
|
42350
42464
|
const [leftSidebarCollapsed, setLeftSidebarCollapsed] = useState78(
|
|
42351
42465
|
leftSidebarOptions.defaultCollapsed ?? false
|
|
42352
42466
|
);
|
|
42353
42467
|
const [rightSidebarCollapsed, setRightSidebarCollapsed] = useState78(
|
|
42354
42468
|
rightSidebarOptions.defaultCollapsed ?? false
|
|
42355
42469
|
);
|
|
42470
|
+
const prevLeftSidebarState = useRef92(null);
|
|
42471
|
+
const prevRightSidebarState = useRef92(null);
|
|
42356
42472
|
const handleLayoutChange = useCallback73(
|
|
42357
42473
|
(sizes) => {
|
|
42358
42474
|
const leftIndex = leftPanel ? 0 : -1;
|
|
42359
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);
|
|
42360
42482
|
if (leftIndex >= 0) {
|
|
42361
|
-
|
|
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
|
+
}
|
|
42362
42490
|
}
|
|
42363
42491
|
if (rightIndex >= 0) {
|
|
42364
|
-
|
|
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
|
+
}
|
|
42365
42499
|
}
|
|
42366
42500
|
},
|
|
42367
|
-
[leftPanel, rightPanel]
|
|
42501
|
+
[leftPanel, rightPanel, onLeftSidebarStateChange, onRightSidebarStateChange]
|
|
42368
42502
|
);
|
|
42369
42503
|
const handleLeftTabChange = useCallback73(
|
|
42370
42504
|
(value) => {
|
|
@@ -42400,10 +42534,8 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42400
42534
|
},
|
|
42401
42535
|
[onChangeRightTab, rightSidebarRef, rightTabValue]
|
|
42402
42536
|
);
|
|
42403
|
-
const showLeftTabs = !!leftSidebarOptions.showTabs && !!leftTabItems
|
|
42404
|
-
|
|
42405
|
-
(!compactDrawerMenu || leftSidebarCollapsed);
|
|
42406
|
-
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(
|
|
42407
42539
|
PanelGroup,
|
|
42408
42540
|
{
|
|
42409
42541
|
ref: panelGroupRef,
|
|
@@ -42413,20 +42545,11 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42413
42545
|
autoSaveId,
|
|
42414
42546
|
onLayout: handleLayoutChange
|
|
42415
42547
|
},
|
|
42416
|
-
leftPanel && /* @__PURE__ */ React316.createElement(React316.Fragment, null,
|
|
42417
|
-
VerticalTabMenu,
|
|
42418
|
-
{
|
|
42419
|
-
tooltipSide: "right",
|
|
42420
|
-
items: leftTabItems,
|
|
42421
|
-
activeValue: leftTabValue,
|
|
42422
|
-
isSidebarCollapsed: leftSidebarCollapsed,
|
|
42423
|
-
onChange: handleLeftTabChange
|
|
42424
|
-
}
|
|
42425
|
-
), showLeftTabs && !leftSidebarCollapsed && /* @__PURE__ */ React316.createElement(DividerVertical, { className: "n-h-full" }), /* @__PURE__ */ React316.createElement(
|
|
42548
|
+
leftPanel && /* @__PURE__ */ React316.createElement(React316.Fragment, null, /* @__PURE__ */ React316.createElement(
|
|
42426
42549
|
Panel,
|
|
42427
42550
|
{
|
|
42428
42551
|
id: LEFT_SIDEBAR_ID,
|
|
42429
|
-
className: "n-relative",
|
|
42552
|
+
className: "n-relative n-workspace-sidebar",
|
|
42430
42553
|
order: 1,
|
|
42431
42554
|
ref: leftSidebarRef,
|
|
42432
42555
|
defaultSize: leftSidebarOptions.initialSize,
|
|
@@ -42435,8 +42558,21 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42435
42558
|
collapsible: true,
|
|
42436
42559
|
defaultCollapsed: leftSidebarOptions.defaultCollapsed
|
|
42437
42560
|
},
|
|
42438
|
-
leftSidebarCollapsed ? null :
|
|
42439
|
-
|
|
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
|
+
)),
|
|
42440
42576
|
/* @__PURE__ */ React316.createElement(
|
|
42441
42577
|
Panel,
|
|
42442
42578
|
{
|
|
@@ -42446,11 +42582,17 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42446
42582
|
},
|
|
42447
42583
|
centerPanel
|
|
42448
42584
|
),
|
|
42449
|
-
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(
|
|
42450
42592
|
Panel,
|
|
42451
42593
|
{
|
|
42452
42594
|
id: RIGHT_SIDEBAR_ID,
|
|
42453
|
-
className: "n-relative",
|
|
42595
|
+
className: "n-relative n-workspace-sidebar",
|
|
42454
42596
|
order: 3,
|
|
42455
42597
|
ref: rightSidebarRef,
|
|
42456
42598
|
minSize: rightSidebarOptions.minSize,
|
|
@@ -42459,18 +42601,16 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42459
42601
|
collapsible: true,
|
|
42460
42602
|
defaultCollapsed: rightSidebarOptions.defaultCollapsed
|
|
42461
42603
|
},
|
|
42462
|
-
rightSidebarCollapsed ? null :
|
|
42463
|
-
|
|
42464
|
-
|
|
42465
|
-
|
|
42466
|
-
|
|
42467
|
-
|
|
42468
|
-
|
|
42469
|
-
|
|
42470
|
-
onChange: handleRightTabChange
|
|
42471
|
-
}
|
|
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))
|
|
42472
42612
|
))
|
|
42473
|
-
);
|
|
42613
|
+
));
|
|
42474
42614
|
});
|
|
42475
42615
|
|
|
42476
42616
|
// src/components/workspace/renderPanelChildren.tsx
|
|
@@ -42551,7 +42691,9 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42551
42691
|
showTabs: rightShowTabs = true
|
|
42552
42692
|
} = {},
|
|
42553
42693
|
theme,
|
|
42554
|
-
|
|
42694
|
+
onLeftSidebarStateChange,
|
|
42695
|
+
onRightSidebarStateChange,
|
|
42696
|
+
shouldAutoSave
|
|
42555
42697
|
}, forwardedRef) {
|
|
42556
42698
|
const containerRef = React317.useRef(null);
|
|
42557
42699
|
const containerSize = useSize(containerRef);
|
|
@@ -42569,8 +42711,8 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42569
42711
|
const rightSidebarMinPixels = toPixels(rightMinSize);
|
|
42570
42712
|
const rightSidebarMaxPixels = toPixels(rightMaxSize);
|
|
42571
42713
|
const rightSidebarInitialPixels = toPixels(rightInitialSize) ?? 280;
|
|
42572
|
-
const leftSidebarRef =
|
|
42573
|
-
const rightSidebarRef =
|
|
42714
|
+
const leftSidebarRef = useRef93(null);
|
|
42715
|
+
const rightSidebarRef = useRef93(null);
|
|
42574
42716
|
const [leftTabValue, setLeftTabValue] = useControlledOrUncontrolled({
|
|
42575
42717
|
value: leftTabValueProp,
|
|
42576
42718
|
onChange: onChangeLeftTab,
|
|
@@ -42648,24 +42790,24 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42648
42790
|
rightSidebarRef.current?.collapse();
|
|
42649
42791
|
}
|
|
42650
42792
|
}, [isDrawerActive]);
|
|
42651
|
-
const leftChildrenProps =
|
|
42793
|
+
const leftChildrenProps = useMemo154(() => {
|
|
42652
42794
|
return {
|
|
42653
42795
|
activeTabValue: leftTabValue,
|
|
42654
42796
|
closeSidebar: closeLeftSidebar
|
|
42655
42797
|
};
|
|
42656
42798
|
}, [leftTabValue, closeLeftSidebar]);
|
|
42657
|
-
const rightChildrenProps =
|
|
42799
|
+
const rightChildrenProps = useMemo154(() => {
|
|
42658
42800
|
return {
|
|
42659
42801
|
activeTabValue: rightTabValue,
|
|
42660
42802
|
closeSidebar: closeRightSidebar
|
|
42661
42803
|
};
|
|
42662
42804
|
}, [rightTabValue, closeRightSidebar]);
|
|
42663
|
-
const leftSidebarProviderValue =
|
|
42805
|
+
const leftSidebarProviderValue = useMemo154(() => {
|
|
42664
42806
|
return {
|
|
42665
42807
|
closeSidebar: closeLeftSidebar
|
|
42666
42808
|
};
|
|
42667
42809
|
}, [closeLeftSidebar]);
|
|
42668
|
-
const rightSidebarProviderValue =
|
|
42810
|
+
const rightSidebarProviderValue = useMemo154(() => {
|
|
42669
42811
|
return {
|
|
42670
42812
|
closeSidebar: closeRightSidebar
|
|
42671
42813
|
};
|
|
@@ -42687,7 +42829,7 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42687
42829
|
/* @__PURE__ */ React317.createElement(WorkspaceSideProvider, { value: rightSidebarProviderValue }, rightTabValue ? renderPanelChildren(right, rightChildrenProps) : null)
|
|
42688
42830
|
) : null;
|
|
42689
42831
|
const centerPanel = /* @__PURE__ */ React317.createElement(PanelInner, { className: "n-bg-canvas-background" }, children);
|
|
42690
|
-
const leftSidebarOptions =
|
|
42832
|
+
const leftSidebarOptions = useMemo154(
|
|
42691
42833
|
() => ({
|
|
42692
42834
|
minSize: leftSidebarMinPixels,
|
|
42693
42835
|
maxSize: leftSidebarMaxPixels,
|
|
@@ -42705,7 +42847,7 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42705
42847
|
leftShowTabs
|
|
42706
42848
|
]
|
|
42707
42849
|
);
|
|
42708
|
-
const rightSidebarOptions =
|
|
42850
|
+
const rightSidebarOptions = useMemo154(
|
|
42709
42851
|
() => ({
|
|
42710
42852
|
minSize: rightSidebarMinPixels,
|
|
42711
42853
|
maxSize: rightSidebarMaxPixels,
|
|
@@ -42756,7 +42898,9 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42756
42898
|
autoSavePrefix,
|
|
42757
42899
|
leftSidebarRef,
|
|
42758
42900
|
rightSidebarRef,
|
|
42759
|
-
|
|
42901
|
+
onLeftSidebarStateChange,
|
|
42902
|
+
onRightSidebarStateChange,
|
|
42903
|
+
shouldAutoSave
|
|
42760
42904
|
}
|
|
42761
42905
|
), isOverlay && /* @__PURE__ */ React317.createElement(
|
|
42762
42906
|
OverlayToolbar,
|