@noya-app/noya-designsystem 0.1.82 → 0.1.84
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 +14 -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 +428 -282
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +417 -271
- 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/contexts/DialogContext.tsx +12 -5
- package/src/contexts/__tests__/DialogContext.test.tsx +142 -0
- 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) {
|
|
@@ -22033,17 +22033,19 @@ var DialogProvider = function DialogProvider2({
|
|
|
22033
22033
|
const inputRef = useRef53(null);
|
|
22034
22034
|
const confirmButtonRef = useRef53(null);
|
|
22035
22035
|
const dialogRef = useRef53(null);
|
|
22036
|
+
const contentsType = contents?.type;
|
|
22037
|
+
const contentsInstance = contents?.resolve;
|
|
22036
22038
|
React160.useEffect(() => {
|
|
22037
|
-
if (!
|
|
22039
|
+
if (!contentsType || !contentsInstance) return;
|
|
22038
22040
|
requestAnimationFrame(() => {
|
|
22039
|
-
if (
|
|
22041
|
+
if (contentsType === "input") {
|
|
22040
22042
|
inputRef.current?.focus();
|
|
22041
22043
|
inputRef.current?.setSelectionRange(0, inputRef.current.value.length);
|
|
22042
|
-
} else if (
|
|
22044
|
+
} else if (contentsType === "confirmation") {
|
|
22043
22045
|
confirmButtonRef.current?.focus();
|
|
22044
22046
|
}
|
|
22045
22047
|
});
|
|
22046
|
-
}, [
|
|
22048
|
+
}, [contentsType, contentsInstance]);
|
|
22047
22049
|
const containsElement = useCallback41((element) => {
|
|
22048
22050
|
if (!dialogRef.current) return false;
|
|
22049
22051
|
return dialogRef.current.containsElement(element);
|
|
@@ -30949,6 +30951,12 @@ import React230, {
|
|
|
30949
30951
|
useRef as useRef71,
|
|
30950
30952
|
useState as useState61
|
|
30951
30953
|
} from "react";
|
|
30954
|
+
var CONTAINER_PADDING_X = "n-px-0.5";
|
|
30955
|
+
var CONTAINER_PADDING_X_PX = 4;
|
|
30956
|
+
var ITEM_PADDING = "n-px-input-padding-x";
|
|
30957
|
+
var ITEM_PADDING_PX = 16;
|
|
30958
|
+
var EXPANSION_THRESHOLD_PX = 20;
|
|
30959
|
+
var RESIZE_SETTLE_MS = 150;
|
|
30952
30960
|
var SegmentedControlContext = createContext49({
|
|
30953
30961
|
colorScheme: "primary"
|
|
30954
30962
|
});
|
|
@@ -30962,7 +30970,14 @@ var SegmentedControlItem = forwardRef90(function SegmentedControlItem2({
|
|
|
30962
30970
|
variant = "default",
|
|
30963
30971
|
...props
|
|
30964
30972
|
}, forwardedRef) {
|
|
30965
|
-
const {
|
|
30973
|
+
const {
|
|
30974
|
+
colorScheme,
|
|
30975
|
+
onSelect,
|
|
30976
|
+
itemWidth = "auto",
|
|
30977
|
+
isCompact
|
|
30978
|
+
} = useContext51(SegmentedControlContext);
|
|
30979
|
+
const showTitle = !(isCompact && icon);
|
|
30980
|
+
const effectiveTooltip = !showTitle && !tooltip ? title : tooltip;
|
|
30966
30981
|
const handlePointerDown = useCallback57(
|
|
30967
30982
|
(event2) => {
|
|
30968
30983
|
if (disabled2) return;
|
|
@@ -30993,7 +31008,7 @@ var SegmentedControlItem = forwardRef90(function SegmentedControlItem2({
|
|
|
30993
31008
|
// checked
|
|
30994
31009
|
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
31010
|
// default variant: only text color, background handled by sliding indicator
|
|
30996
|
-
colorScheme === "secondary"
|
|
31011
|
+
colorScheme === "secondary" || colorScheme === "primary" ? "data-[pressed]:n-text-white" : "data-[pressed]:n-text-segmented-control-item-active-text"
|
|
30997
31012
|
) : 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
31013
|
"focus-visible:n-z-interactable",
|
|
30999
31014
|
// checked default (all colorSchemes) - hide separators near selected
|
|
@@ -31001,10 +31016,12 @@ var SegmentedControlItem = forwardRef90(function SegmentedControlItem2({
|
|
|
31001
31016
|
// hover
|
|
31002
31017
|
variant === "buttons" && "hover:n-bg-button-background-hover",
|
|
31003
31018
|
// spacing and borders
|
|
31004
|
-
|
|
31019
|
+
ITEM_PADDING,
|
|
31005
31020
|
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
|
|
31021
|
+
// icon only buttons (explicit or due to compact mode)
|
|
31007
31022
|
variant === "buttons" && title === "" && icon && "n-min-w-input-height",
|
|
31023
|
+
// icon only in compact mode
|
|
31024
|
+
isCompact && icon && "n-min-w-input-height",
|
|
31008
31025
|
className
|
|
31009
31026
|
),
|
|
31010
31027
|
...props
|
|
@@ -31018,34 +31035,24 @@ var SegmentedControlItem = forwardRef90(function SegmentedControlItem2({
|
|
|
31018
31035
|
)
|
|
31019
31036
|
},
|
|
31020
31037
|
icon && renderIcon(icon),
|
|
31021
|
-
title
|
|
31038
|
+
showTitle && title
|
|
31022
31039
|
)
|
|
31023
31040
|
);
|
|
31024
|
-
return
|
|
31041
|
+
return effectiveTooltip ? /* @__PURE__ */ React230.createElement(Tooltip, { content: effectiveTooltip }, itemElement) : itemElement;
|
|
31025
31042
|
});
|
|
31026
|
-
|
|
31027
|
-
|
|
31028
|
-
|
|
31029
|
-
|
|
31030
|
-
|
|
31031
|
-
|
|
31032
|
-
|
|
31033
|
-
variant = "default",
|
|
31034
|
-
className,
|
|
31035
|
-
style: style2,
|
|
31036
|
-
itemWidth = "auto"
|
|
31043
|
+
function useIndicatorPosition({
|
|
31044
|
+
containerRef,
|
|
31045
|
+
itemRefs,
|
|
31046
|
+
selectedIndex,
|
|
31047
|
+
variant,
|
|
31048
|
+
itemCount,
|
|
31049
|
+
isCompact
|
|
31037
31050
|
}) {
|
|
31038
|
-
const { fieldId: id } = useLabel({ fieldId: idProp });
|
|
31039
31051
|
const hasInitialized = useRef71(false);
|
|
31040
|
-
const
|
|
31041
|
-
const
|
|
31052
|
+
const isResizingRef = useRef71(false);
|
|
31053
|
+
const resizeTimeoutRef = useRef71(void 0);
|
|
31042
31054
|
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(() => {
|
|
31055
|
+
const measureIndicator = useCallback57(() => {
|
|
31049
31056
|
if (variant !== "default" || selectedIndex < 0) {
|
|
31050
31057
|
setIndicatorStyle(null);
|
|
31051
31058
|
return;
|
|
@@ -31063,16 +31070,134 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
31063
31070
|
width: itemRect.width
|
|
31064
31071
|
});
|
|
31065
31072
|
hasInitialized.current = true;
|
|
31066
|
-
}, [selectedIndex, variant,
|
|
31073
|
+
}, [containerRef, itemRefs, selectedIndex, variant, itemCount, isCompact]);
|
|
31074
|
+
useLayoutEffect10(measureIndicator, [measureIndicator]);
|
|
31067
31075
|
useLayoutEffect10(() => {
|
|
31068
31076
|
const container = containerRef.current;
|
|
31069
31077
|
if (!container || variant !== "default") return;
|
|
31070
31078
|
const observer = new ResizeObserver(() => {
|
|
31071
|
-
|
|
31079
|
+
isResizingRef.current = true;
|
|
31080
|
+
clearTimeout(resizeTimeoutRef.current);
|
|
31081
|
+
resizeTimeoutRef.current = setTimeout(() => {
|
|
31082
|
+
isResizingRef.current = false;
|
|
31083
|
+
}, RESIZE_SETTLE_MS);
|
|
31084
|
+
measureIndicator();
|
|
31072
31085
|
});
|
|
31073
31086
|
observer.observe(container);
|
|
31074
|
-
return () =>
|
|
31075
|
-
|
|
31087
|
+
return () => {
|
|
31088
|
+
observer.disconnect();
|
|
31089
|
+
clearTimeout(resizeTimeoutRef.current);
|
|
31090
|
+
};
|
|
31091
|
+
}, [containerRef, variant, measureIndicator]);
|
|
31092
|
+
return { indicatorStyle, hasInitialized, isResizingRef };
|
|
31093
|
+
}
|
|
31094
|
+
function useCompactMode({
|
|
31095
|
+
containerRef,
|
|
31096
|
+
itemRefs,
|
|
31097
|
+
variant,
|
|
31098
|
+
items,
|
|
31099
|
+
enabled
|
|
31100
|
+
}) {
|
|
31101
|
+
const containerSize = useSize(containerRef, "width");
|
|
31102
|
+
const expandedWidthRef = useRef71(null);
|
|
31103
|
+
const isCompactRef = useRef71(false);
|
|
31104
|
+
const [isCompact, setIsCompact] = useState61(false);
|
|
31105
|
+
const allItemsHaveIcons = useMemo117(
|
|
31106
|
+
() => items.every((item) => item.icon),
|
|
31107
|
+
[items]
|
|
31108
|
+
);
|
|
31109
|
+
const itemsKey = useMemo117(
|
|
31110
|
+
() => items.map((item) => `${item.value}-${item.icon}-${item.title}`).join("|"),
|
|
31111
|
+
[items]
|
|
31112
|
+
);
|
|
31113
|
+
useLayoutEffect10(() => {
|
|
31114
|
+
expandedWidthRef.current = null;
|
|
31115
|
+
isCompactRef.current = false;
|
|
31116
|
+
setIsCompact(false);
|
|
31117
|
+
}, [itemsKey]);
|
|
31118
|
+
useLayoutEffect10(() => {
|
|
31119
|
+
if (!enabled) return;
|
|
31120
|
+
const container = containerRef.current;
|
|
31121
|
+
if (!container || variant !== "default" || !allItemsHaveIcons) {
|
|
31122
|
+
return;
|
|
31123
|
+
}
|
|
31124
|
+
const validItems = itemRefs.current.filter(Boolean);
|
|
31125
|
+
if (validItems.length !== items.length) return;
|
|
31126
|
+
const availableWidth = (containerSize?.width ?? container.clientWidth) - CONTAINER_PADDING_X_PX;
|
|
31127
|
+
if (!isCompactRef.current) {
|
|
31128
|
+
const isOverflowing = validItems.some((item) => {
|
|
31129
|
+
const span = item.querySelector("span");
|
|
31130
|
+
if (!span) return false;
|
|
31131
|
+
const contentWidth = span.scrollWidth;
|
|
31132
|
+
const availableInButton = item.clientWidth - ITEM_PADDING_PX;
|
|
31133
|
+
return contentWidth >= availableInButton - 1;
|
|
31134
|
+
});
|
|
31135
|
+
if (isOverflowing) {
|
|
31136
|
+
const totalItemsWidth = validItems.reduce((sum, item) => {
|
|
31137
|
+
const span = item.querySelector("span");
|
|
31138
|
+
const contentWidth = span ? span.scrollWidth : 0;
|
|
31139
|
+
return sum + contentWidth + ITEM_PADDING_PX;
|
|
31140
|
+
}, 0);
|
|
31141
|
+
expandedWidthRef.current = totalItemsWidth;
|
|
31142
|
+
isCompactRef.current = true;
|
|
31143
|
+
setIsCompact(true);
|
|
31144
|
+
}
|
|
31145
|
+
} else {
|
|
31146
|
+
const expandedWidth = expandedWidthRef.current;
|
|
31147
|
+
if (!expandedWidth) return;
|
|
31148
|
+
if (availableWidth >= expandedWidth + EXPANSION_THRESHOLD_PX) {
|
|
31149
|
+
isCompactRef.current = false;
|
|
31150
|
+
expandedWidthRef.current = null;
|
|
31151
|
+
setIsCompact(false);
|
|
31152
|
+
}
|
|
31153
|
+
}
|
|
31154
|
+
}, [
|
|
31155
|
+
enabled,
|
|
31156
|
+
containerRef,
|
|
31157
|
+
itemRefs,
|
|
31158
|
+
variant,
|
|
31159
|
+
allItemsHaveIcons,
|
|
31160
|
+
containerSize?.width,
|
|
31161
|
+
itemsKey,
|
|
31162
|
+
items.length
|
|
31163
|
+
]);
|
|
31164
|
+
return isCompact;
|
|
31165
|
+
}
|
|
31166
|
+
var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
31167
|
+
id: idProp,
|
|
31168
|
+
value,
|
|
31169
|
+
onValueChange,
|
|
31170
|
+
colorScheme,
|
|
31171
|
+
allowEmpty,
|
|
31172
|
+
items,
|
|
31173
|
+
variant = "default",
|
|
31174
|
+
className,
|
|
31175
|
+
style: style2,
|
|
31176
|
+
itemWidth = "auto",
|
|
31177
|
+
enableCompactMode = false
|
|
31178
|
+
}) {
|
|
31179
|
+
const { fieldId: id } = useLabel({ fieldId: idProp });
|
|
31180
|
+
const containerRef = useRef71(null);
|
|
31181
|
+
const itemRefs = useRef71([]);
|
|
31182
|
+
const selectedIndex = useMemo117(() => {
|
|
31183
|
+
if (!value) return -1;
|
|
31184
|
+
return items.findIndex((item) => item.value === value);
|
|
31185
|
+
}, [value, items]);
|
|
31186
|
+
const isCompact = useCompactMode({
|
|
31187
|
+
containerRef,
|
|
31188
|
+
itemRefs,
|
|
31189
|
+
variant,
|
|
31190
|
+
items,
|
|
31191
|
+
enabled: enableCompactMode
|
|
31192
|
+
});
|
|
31193
|
+
const { indicatorStyle, hasInitialized, isResizingRef } = useIndicatorPosition({
|
|
31194
|
+
containerRef,
|
|
31195
|
+
itemRefs,
|
|
31196
|
+
selectedIndex,
|
|
31197
|
+
variant,
|
|
31198
|
+
itemCount: items.length,
|
|
31199
|
+
isCompact
|
|
31200
|
+
});
|
|
31076
31201
|
const handleSelect = useCallback57(
|
|
31077
31202
|
(newValue) => {
|
|
31078
31203
|
if (!allowEmpty && !newValue) return;
|
|
@@ -31085,8 +31210,8 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
31085
31210
|
[handleSelect]
|
|
31086
31211
|
);
|
|
31087
31212
|
const contextValue = useMemo117(
|
|
31088
|
-
() => ({ colorScheme, onSelect: handleSelect, itemWidth }),
|
|
31089
|
-
[colorScheme, handleSelect, itemWidth]
|
|
31213
|
+
() => ({ colorScheme, onSelect: handleSelect, itemWidth, isCompact }),
|
|
31214
|
+
[colorScheme, handleSelect, itemWidth, isCompact]
|
|
31090
31215
|
);
|
|
31091
31216
|
const indicatorBgClass = colorScheme === "secondary" ? "n-bg-secondary" : colorScheme === "primary" ? "n-bg-primary" : "n-bg-segmented-control-item-active-background";
|
|
31092
31217
|
return /* @__PURE__ */ React230.createElement(SegmentedControlContext.Provider, { value: contextValue }, /* @__PURE__ */ React230.createElement(
|
|
@@ -31099,7 +31224,7 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
31099
31224
|
className: cx(
|
|
31100
31225
|
"n-appearance-none n-relative n-outline-none",
|
|
31101
31226
|
variant === "default" && (itemWidth === "fit" ? "n-flex n-w-fit" : "n-grid"),
|
|
31102
|
-
variant === "default" &&
|
|
31227
|
+
variant === "default" && `n-min-h-input-height n-bg-input-background n-rounded n-py-0.5 ${CONTAINER_PADDING_X}`,
|
|
31103
31228
|
variant !== "default" && "n-flex",
|
|
31104
31229
|
variant === "tabs" && "n-gap-1.5 n-min-h-[33px]",
|
|
31105
31230
|
variant === "buttons" && "n-gap-1.5 n-min-h-input-height",
|
|
@@ -31118,7 +31243,7 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
31118
31243
|
className: cx(
|
|
31119
31244
|
"n-absolute n-top-0.5 n-bottom-0.5 n-rounded n-shadow-segment n-pointer-events-none",
|
|
31120
31245
|
indicatorBgClass,
|
|
31121
|
-
hasInitialized.current && "n-transition-[left,width] n-duration-200 n-ease-out"
|
|
31246
|
+
hasInitialized.current && !isResizingRef.current && "n-transition-[left,width] n-duration-200 n-ease-out"
|
|
31122
31247
|
),
|
|
31123
31248
|
style: {
|
|
31124
31249
|
left: indicatorStyle.left,
|
|
@@ -41231,8 +41356,8 @@ import React317, {
|
|
|
41231
41356
|
memo as memo40,
|
|
41232
41357
|
useCallback as useCallback74,
|
|
41233
41358
|
useImperativeHandle as useImperativeHandle18,
|
|
41234
|
-
useMemo as
|
|
41235
|
-
useRef as
|
|
41359
|
+
useMemo as useMemo154,
|
|
41360
|
+
useRef as useRef93
|
|
41236
41361
|
} from "react";
|
|
41237
41362
|
|
|
41238
41363
|
// src/components/OverlayToolbar.tsx
|
|
@@ -41304,16 +41429,7 @@ function OverlayToolbar({
|
|
|
41304
41429
|
}
|
|
41305
41430
|
|
|
41306
41431
|
// 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";
|
|
41432
|
+
import React311, { useMemo as useMemo151, useState as useState76 } from "react";
|
|
41317
41433
|
|
|
41318
41434
|
// src/components/Toolbar.tsx
|
|
41319
41435
|
import { useKeyboardShortcuts as useKeyboardShortcuts3 } from "@noya-app/noya-keymap";
|
|
@@ -41628,38 +41744,11 @@ function Toolbar({
|
|
|
41628
41744
|
);
|
|
41629
41745
|
}
|
|
41630
41746
|
|
|
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
|
-
});
|
|
41747
|
+
// src/components/workspace/constants.ts
|
|
41748
|
+
var EDITOR_PANEL_GROUP_ID = "editor-panel-group";
|
|
41749
|
+
var LEFT_SIDEBAR_ID = "editor-1-left-sidebar";
|
|
41750
|
+
var RIGHT_SIDEBAR_ID = "editor-3-right-sidebar";
|
|
41751
|
+
var CONTENT_AREA_ID = "editor-2-content-area";
|
|
41663
41752
|
|
|
41664
41753
|
// src/components/workspace/DrawerWorkspaceLayout.tsx
|
|
41665
41754
|
var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
@@ -41673,166 +41762,138 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
|
41673
41762
|
rightTabItems,
|
|
41674
41763
|
rightTabValue,
|
|
41675
41764
|
onChangeRightTab,
|
|
41676
|
-
onChangeLeftTab
|
|
41677
|
-
compactDrawerMenu
|
|
41765
|
+
onChangeLeftTab
|
|
41678
41766
|
}) {
|
|
41679
|
-
const portalContainer = useRef90(null);
|
|
41680
41767
|
const [{ leftSidebarCollapsed, rightSidebarCollapsed }, setLayoutState] = useState76({
|
|
41681
41768
|
leftSidebarCollapsed: true,
|
|
41682
41769
|
rightSidebarCollapsed: true
|
|
41683
41770
|
});
|
|
41684
|
-
|
|
41771
|
+
React311.useImperativeHandle(
|
|
41772
|
+
leftSidebarRef,
|
|
41773
|
+
() => ({
|
|
41774
|
+
expand: () => setLayoutState((prev) => ({
|
|
41775
|
+
...prev,
|
|
41776
|
+
leftSidebarCollapsed: false,
|
|
41777
|
+
rightSidebarCollapsed: true
|
|
41778
|
+
})),
|
|
41779
|
+
collapse: () => setLayoutState((prev) => ({ ...prev, leftSidebarCollapsed: true })),
|
|
41780
|
+
isExpanded: () => !leftSidebarCollapsed
|
|
41781
|
+
}),
|
|
41782
|
+
[leftSidebarCollapsed]
|
|
41783
|
+
);
|
|
41784
|
+
React311.useImperativeHandle(
|
|
41785
|
+
rightSidebarRef,
|
|
41786
|
+
() => ({
|
|
41787
|
+
expand: () => setLayoutState((prev) => ({
|
|
41788
|
+
...prev,
|
|
41789
|
+
rightSidebarCollapsed: false,
|
|
41790
|
+
leftSidebarCollapsed: true
|
|
41791
|
+
})),
|
|
41792
|
+
collapse: () => setLayoutState((prev) => ({ ...prev, rightSidebarCollapsed: true })),
|
|
41793
|
+
isExpanded: () => !rightSidebarCollapsed
|
|
41794
|
+
}),
|
|
41795
|
+
[rightSidebarCollapsed]
|
|
41796
|
+
);
|
|
41797
|
+
const allTabItems = useMemo151(
|
|
41685
41798
|
() => [
|
|
41686
41799
|
...leftPanel ? leftTabItems ?? [] : [],
|
|
41687
41800
|
...rightPanel ? rightTabItems ?? [] : []
|
|
41688
41801
|
],
|
|
41689
41802
|
[leftTabItems, rightTabItems, leftPanel, rightPanel]
|
|
41690
41803
|
);
|
|
41691
|
-
const
|
|
41692
|
-
const allSelectableTabItems = useMemo152(
|
|
41804
|
+
const allSelectableTabItems = useMemo151(
|
|
41693
41805
|
() => allTabItems.filter(isSelectableMenuItem),
|
|
41694
41806
|
[allTabItems]
|
|
41695
41807
|
);
|
|
41696
|
-
const
|
|
41697
|
-
const leftSelectableTabItems =
|
|
41808
|
+
const hasTabs = allSelectableTabItems.length > 0;
|
|
41809
|
+
const leftSelectableTabItems = useMemo151(
|
|
41698
41810
|
() => (leftTabItems ?? []).filter(isSelectableMenuItem),
|
|
41699
41811
|
[leftTabItems]
|
|
41700
41812
|
);
|
|
41701
|
-
const rightSelectableTabItems =
|
|
41813
|
+
const rightSelectableTabItems = useMemo151(
|
|
41702
41814
|
() => (rightTabItems ?? []).filter(isSelectableMenuItem),
|
|
41703
41815
|
[rightTabItems]
|
|
41704
41816
|
);
|
|
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
41817
|
const handleSelectTab = (value) => {
|
|
41718
|
-
|
|
41719
|
-
|
|
41720
|
-
|
|
41818
|
+
const isLeftItem = leftSelectableTabItems.some(
|
|
41819
|
+
(item) => item.value === value
|
|
41820
|
+
);
|
|
41821
|
+
const isRightItem = rightSelectableTabItems.some(
|
|
41822
|
+
(item) => item.value === value
|
|
41823
|
+
);
|
|
41824
|
+
if (isLeftItem) {
|
|
41825
|
+
if (value === leftTabValue && !leftSidebarCollapsed) {
|
|
41826
|
+
setLayoutState((prev) => ({ ...prev, leftSidebarCollapsed: true }));
|
|
41721
41827
|
} else {
|
|
41722
|
-
|
|
41828
|
+
setLayoutState({
|
|
41829
|
+
leftSidebarCollapsed: false,
|
|
41830
|
+
rightSidebarCollapsed: true
|
|
41831
|
+
});
|
|
41723
41832
|
onChangeLeftTab?.(value);
|
|
41724
41833
|
}
|
|
41725
|
-
} else if (
|
|
41726
|
-
if (value === rightTabValue) {
|
|
41727
|
-
|
|
41834
|
+
} else if (isRightItem) {
|
|
41835
|
+
if (value === rightTabValue && !rightSidebarCollapsed) {
|
|
41836
|
+
setLayoutState((prev) => ({ ...prev, rightSidebarCollapsed: true }));
|
|
41728
41837
|
} else {
|
|
41729
|
-
|
|
41838
|
+
setLayoutState({
|
|
41839
|
+
leftSidebarCollapsed: true,
|
|
41840
|
+
rightSidebarCollapsed: false
|
|
41841
|
+
});
|
|
41730
41842
|
onChangeRightTab?.(value);
|
|
41731
41843
|
}
|
|
41732
41844
|
}
|
|
41733
41845
|
};
|
|
41734
|
-
const
|
|
41735
|
-
|
|
41736
|
-
|
|
41737
|
-
|
|
41738
|
-
|
|
41846
|
+
const activeDrawerPanel = !leftSidebarCollapsed ? leftPanel : !rightSidebarCollapsed ? rightPanel : null;
|
|
41847
|
+
const isDrawerOpen = activeDrawerPanel !== null;
|
|
41848
|
+
const activeTabValue = !leftSidebarCollapsed ? leftTabValue : !rightSidebarCollapsed ? rightTabValue : void 0;
|
|
41849
|
+
const toolbarMenuItems = useMemo151(
|
|
41850
|
+
() => allSelectableTabItems.map((item) => ({
|
|
41851
|
+
...item,
|
|
41852
|
+
checked: activeTabValue === item.value
|
|
41853
|
+
})),
|
|
41854
|
+
[allSelectableTabItems, activeTabValue]
|
|
41855
|
+
);
|
|
41856
|
+
return /* @__PURE__ */ React311.createElement(
|
|
41739
41857
|
"div",
|
|
41740
41858
|
{
|
|
41741
|
-
ref: portalContainer,
|
|
41742
41859
|
id: EDITOR_PANEL_GROUP_ID,
|
|
41743
|
-
className: "n-flex n-flex-1 n-relative focus:n-outline-none"
|
|
41860
|
+
className: "n-flex n-flex-col n-flex-1 n-relative focus:n-outline-none"
|
|
41744
41861
|
},
|
|
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,
|
|
41862
|
+
hasTabs && /* @__PURE__ */ React311.createElement(React311.Fragment, null, /* @__PURE__ */ React311.createElement(
|
|
41863
|
+
"div",
|
|
41757
41864
|
{
|
|
41758
|
-
|
|
41759
|
-
className: "n-rounded",
|
|
41865
|
+
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
41866
|
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
|
-
});
|
|
41867
|
+
[cssVarNames.colors.inputBackground]: "transparent",
|
|
41868
|
+
[cssVarNames.colors.buttonBackground]: "transparent"
|
|
41801
41869
|
}
|
|
41802
41870
|
},
|
|
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
|
-
});
|
|
41871
|
+
/* @__PURE__ */ React311.createElement(
|
|
41872
|
+
ToolbarMenu,
|
|
41873
|
+
{
|
|
41874
|
+
items: toolbarMenuItems,
|
|
41875
|
+
onSelectMenuItem: handleSelectTab
|
|
41824
41876
|
}
|
|
41825
|
-
|
|
41826
|
-
|
|
41827
|
-
)
|
|
41877
|
+
)
|
|
41878
|
+
), /* @__PURE__ */ React311.createElement(Divider, null)),
|
|
41879
|
+
/* @__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(
|
|
41880
|
+
"div",
|
|
41881
|
+
{
|
|
41882
|
+
className: "n-flex-1 n-bg-black/30",
|
|
41883
|
+
onClick: () => setLayoutState({
|
|
41884
|
+
leftSidebarCollapsed: true,
|
|
41885
|
+
rightSidebarCollapsed: true
|
|
41886
|
+
})
|
|
41887
|
+
}
|
|
41888
|
+
)), /* @__PURE__ */ React311.createElement("div", { className: "n-flex-1 n-flex n-relative n-min-h-0" }, centerPanel))
|
|
41828
41889
|
);
|
|
41829
41890
|
});
|
|
41830
41891
|
|
|
41831
41892
|
// src/components/workspace/PanelWorkspaceLayout.tsx
|
|
41832
|
-
import React316, { useCallback as useCallback73, useMemo as
|
|
41893
|
+
import React316, { useCallback as useCallback73, useMemo as useMemo153, useRef as useRef92, useState as useState78 } from "react";
|
|
41833
41894
|
|
|
41834
41895
|
// src/components/resizablePanels/Panel.tsx
|
|
41835
|
-
import
|
|
41896
|
+
import React312, {
|
|
41836
41897
|
forwardRef as forwardRef124,
|
|
41837
41898
|
useEffect as useEffect58,
|
|
41838
41899
|
useId as useId5,
|
|
@@ -41854,7 +41915,17 @@ function usePanelGroupContext() {
|
|
|
41854
41915
|
|
|
41855
41916
|
// src/components/resizablePanels/Panel.tsx
|
|
41856
41917
|
var Panel = forwardRef124(
|
|
41857
|
-
function Panel2({
|
|
41918
|
+
function Panel2({
|
|
41919
|
+
id: propId,
|
|
41920
|
+
order,
|
|
41921
|
+
className,
|
|
41922
|
+
defaultSize,
|
|
41923
|
+
minSize,
|
|
41924
|
+
maxSize,
|
|
41925
|
+
collapsible,
|
|
41926
|
+
defaultCollapsed,
|
|
41927
|
+
children
|
|
41928
|
+
}, ref) {
|
|
41858
41929
|
const generatedId = useId5();
|
|
41859
41930
|
const id = propId ?? generatedId;
|
|
41860
41931
|
const context = usePanelGroupContext();
|
|
@@ -41879,7 +41950,17 @@ var Panel = forwardRef124(
|
|
|
41879
41950
|
return () => {
|
|
41880
41951
|
unregisterPanel(id);
|
|
41881
41952
|
};
|
|
41882
|
-
}, [
|
|
41953
|
+
}, [
|
|
41954
|
+
id,
|
|
41955
|
+
order,
|
|
41956
|
+
defaultSize,
|
|
41957
|
+
minSize,
|
|
41958
|
+
maxSize,
|
|
41959
|
+
collapsible,
|
|
41960
|
+
defaultCollapsed,
|
|
41961
|
+
registerPanel,
|
|
41962
|
+
unregisterPanel
|
|
41963
|
+
]);
|
|
41883
41964
|
const size4 = getPanelSize(id);
|
|
41884
41965
|
const isFlexPanel = defaultSize === void 0;
|
|
41885
41966
|
useImperativeHandle16(
|
|
@@ -41895,7 +41976,7 @@ var Panel = forwardRef124(
|
|
|
41895
41976
|
if (size4 === 0 && !isFlexPanel) {
|
|
41896
41977
|
return null;
|
|
41897
41978
|
}
|
|
41898
|
-
return /* @__PURE__ */
|
|
41979
|
+
return /* @__PURE__ */ React312.createElement(
|
|
41899
41980
|
"div",
|
|
41900
41981
|
{
|
|
41901
41982
|
"data-panel-id": id,
|
|
@@ -41910,13 +41991,13 @@ var Panel = forwardRef124(
|
|
|
41910
41991
|
);
|
|
41911
41992
|
|
|
41912
41993
|
// src/components/resizablePanels/PanelGroup.tsx
|
|
41913
|
-
import
|
|
41994
|
+
import React313, {
|
|
41914
41995
|
forwardRef as forwardRef125,
|
|
41915
41996
|
useCallback as useCallback71,
|
|
41916
41997
|
useEffect as useEffect59,
|
|
41917
41998
|
useImperativeHandle as useImperativeHandle17,
|
|
41918
|
-
useMemo as
|
|
41919
|
-
useRef as
|
|
41999
|
+
useMemo as useMemo152,
|
|
42000
|
+
useRef as useRef90,
|
|
41920
42001
|
useState as useState77
|
|
41921
42002
|
} from "react";
|
|
41922
42003
|
function getStorageKey(autoSaveId) {
|
|
@@ -41938,17 +42019,17 @@ function saveSizes(autoSaveId, sizes) {
|
|
|
41938
42019
|
}
|
|
41939
42020
|
var PanelGroup = forwardRef125(
|
|
41940
42021
|
function PanelGroup2({ id, className, direction, autoSaveId, onLayout, children }, ref) {
|
|
41941
|
-
const containerRef =
|
|
42022
|
+
const containerRef = useRef90(null);
|
|
41942
42023
|
const containerSize = useSize(containerRef);
|
|
41943
42024
|
const containerWidth = containerSize?.width ?? 0;
|
|
41944
42025
|
const [panels, setPanels] = useState77(/* @__PURE__ */ new Map());
|
|
41945
|
-
const panelsRef =
|
|
42026
|
+
const panelsRef = useRef90(panels);
|
|
41946
42027
|
panelsRef.current = panels;
|
|
41947
42028
|
const [resizing, setResizing] = useState77(null);
|
|
41948
|
-
const sortedPanels =
|
|
42029
|
+
const sortedPanels = useMemo152(() => {
|
|
41949
42030
|
return Array.from(panels.values()).sort((a, b) => a.order - b.order);
|
|
41950
42031
|
}, [panels]);
|
|
41951
|
-
const flexPanelId =
|
|
42032
|
+
const flexPanelId = useMemo152(() => {
|
|
41952
42033
|
for (const panel of sortedPanels) {
|
|
41953
42034
|
if (panel.defaultSize === void 0) {
|
|
41954
42035
|
return panel.id;
|
|
@@ -41998,8 +42079,13 @@ var PanelGroup = forwardRef125(
|
|
|
41998
42079
|
const savedSizes = loadSavedSizes(autoSaveId);
|
|
41999
42080
|
const savedSize = savedSizes?.[panel.id];
|
|
42000
42081
|
const hasSavedSize = savedSize !== void 0;
|
|
42001
|
-
|
|
42002
|
-
|
|
42082
|
+
let collapsed;
|
|
42083
|
+
if (hasSavedSize) {
|
|
42084
|
+
collapsed = savedSize === 0 && !!panel.collapsible;
|
|
42085
|
+
} else {
|
|
42086
|
+
collapsed = !!panel.defaultCollapsed && !!panel.collapsible;
|
|
42087
|
+
}
|
|
42088
|
+
const initialSize = collapsed ? 0 : hasSavedSize ? savedSize : panel.defaultSize ?? 0;
|
|
42003
42089
|
const newPanels = new Map(prev);
|
|
42004
42090
|
newPanels.set(panel.id, {
|
|
42005
42091
|
...panel,
|
|
@@ -42233,7 +42319,7 @@ var PanelGroup = forwardRef125(
|
|
|
42233
42319
|
});
|
|
42234
42320
|
}
|
|
42235
42321
|
}));
|
|
42236
|
-
const contextValue =
|
|
42322
|
+
const contextValue = useMemo152(
|
|
42237
42323
|
() => ({
|
|
42238
42324
|
registerPanel,
|
|
42239
42325
|
unregisterPanel,
|
|
@@ -42259,7 +42345,7 @@ var PanelGroup = forwardRef125(
|
|
|
42259
42345
|
containerWidth
|
|
42260
42346
|
]
|
|
42261
42347
|
);
|
|
42262
|
-
return /* @__PURE__ */
|
|
42348
|
+
return /* @__PURE__ */ React313.createElement(PanelGroupContext.Provider, { value: contextValue }, /* @__PURE__ */ React313.createElement(
|
|
42263
42349
|
"div",
|
|
42264
42350
|
{
|
|
42265
42351
|
ref: containerRef,
|
|
@@ -42277,14 +42363,14 @@ var PanelGroup = forwardRef125(
|
|
|
42277
42363
|
);
|
|
42278
42364
|
|
|
42279
42365
|
// src/components/resizablePanels/PanelResizeHandle.tsx
|
|
42280
|
-
import
|
|
42366
|
+
import React314, { useCallback as useCallback72, useContext as useContext65, useRef as useRef91 } from "react";
|
|
42281
42367
|
function PanelResizeHandle({
|
|
42282
42368
|
className,
|
|
42283
42369
|
disabled: disabled2,
|
|
42284
42370
|
index: index2
|
|
42285
42371
|
}) {
|
|
42286
42372
|
const context = useContext65(PanelGroupContext);
|
|
42287
|
-
const handleRef =
|
|
42373
|
+
const handleRef = useRef91(null);
|
|
42288
42374
|
const handleMouseDown = useCallback72(
|
|
42289
42375
|
(e) => {
|
|
42290
42376
|
if (disabled2 || !context) return;
|
|
@@ -42296,7 +42382,7 @@ function PanelResizeHandle({
|
|
|
42296
42382
|
if (!context) {
|
|
42297
42383
|
return null;
|
|
42298
42384
|
}
|
|
42299
|
-
return /* @__PURE__ */
|
|
42385
|
+
return /* @__PURE__ */ React314.createElement(
|
|
42300
42386
|
"div",
|
|
42301
42387
|
{
|
|
42302
42388
|
ref: handleRef,
|
|
@@ -42309,7 +42395,7 @@ function PanelResizeHandle({
|
|
|
42309
42395
|
zIndex: 10
|
|
42310
42396
|
}
|
|
42311
42397
|
},
|
|
42312
|
-
/* @__PURE__ */
|
|
42398
|
+
/* @__PURE__ */ React314.createElement(
|
|
42313
42399
|
"div",
|
|
42314
42400
|
{
|
|
42315
42401
|
style: {
|
|
@@ -42325,6 +42411,32 @@ function PanelResizeHandle({
|
|
|
42325
42411
|
);
|
|
42326
42412
|
}
|
|
42327
42413
|
|
|
42414
|
+
// src/components/workspace/HorizontalTabBar.tsx
|
|
42415
|
+
import React315 from "react";
|
|
42416
|
+
var HorizontalTabBar = memoGeneric(function HorizontalTabBar2({ items, activeValue, onChange }) {
|
|
42417
|
+
const selectableItems = items.filter(isSelectableMenuItem);
|
|
42418
|
+
if (selectableItems.length <= 1) {
|
|
42419
|
+
return null;
|
|
42420
|
+
}
|
|
42421
|
+
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(
|
|
42422
|
+
SegmentedControl,
|
|
42423
|
+
{
|
|
42424
|
+
enableCompactMode: true,
|
|
42425
|
+
className: "n-flex-1",
|
|
42426
|
+
value: activeValue,
|
|
42427
|
+
onValueChange: onChange,
|
|
42428
|
+
variant: "default",
|
|
42429
|
+
items: selectableItems.map((item) => ({
|
|
42430
|
+
value: item.value,
|
|
42431
|
+
title: item.title,
|
|
42432
|
+
icon: item.icon,
|
|
42433
|
+
tooltip: item.tooltip,
|
|
42434
|
+
disabled: item.disabled
|
|
42435
|
+
}))
|
|
42436
|
+
}
|
|
42437
|
+
)));
|
|
42438
|
+
});
|
|
42439
|
+
|
|
42328
42440
|
// src/components/workspace/PanelWorkspaceLayout.tsx
|
|
42329
42441
|
var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
42330
42442
|
leftPanel,
|
|
@@ -42341,30 +42453,54 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42341
42453
|
rightTabValue,
|
|
42342
42454
|
onChangeLeftTab,
|
|
42343
42455
|
onChangeRightTab,
|
|
42344
|
-
|
|
42456
|
+
onLeftSidebarStateChange,
|
|
42457
|
+
onRightSidebarStateChange,
|
|
42458
|
+
shouldAutoSave = true
|
|
42345
42459
|
}) {
|
|
42346
|
-
const panelGroupRef =
|
|
42347
|
-
const
|
|
42348
|
-
|
|
42349
|
-
|
|
42460
|
+
const panelGroupRef = useRef92(null);
|
|
42461
|
+
const containerRef = useRef92(null);
|
|
42462
|
+
const autoSaveId = useMemo153(() => {
|
|
42463
|
+
if (!shouldAutoSave) return void 0;
|
|
42464
|
+
return autoSavePrefix ? `${autoSavePrefix}--v5--${EDITOR_PANEL_GROUP_ID}` : Math.random().toString(36).substring(2, 15);
|
|
42465
|
+
}, [autoSavePrefix, shouldAutoSave]);
|
|
42350
42466
|
const [leftSidebarCollapsed, setLeftSidebarCollapsed] = useState78(
|
|
42351
42467
|
leftSidebarOptions.defaultCollapsed ?? false
|
|
42352
42468
|
);
|
|
42353
42469
|
const [rightSidebarCollapsed, setRightSidebarCollapsed] = useState78(
|
|
42354
42470
|
rightSidebarOptions.defaultCollapsed ?? false
|
|
42355
42471
|
);
|
|
42472
|
+
const prevLeftSidebarState = useRef92(null);
|
|
42473
|
+
const prevRightSidebarState = useRef92(null);
|
|
42356
42474
|
const handleLayoutChange = useCallback73(
|
|
42357
42475
|
(sizes) => {
|
|
42358
42476
|
const leftIndex = leftPanel ? 0 : -1;
|
|
42359
42477
|
const rightIndex = rightPanel ? leftPanel ? 2 : 1 : -1;
|
|
42478
|
+
const containerWidth = containerRef.current?.clientWidth ?? 0;
|
|
42479
|
+
const sizesSum = sizes.reduce((a, b) => a + b, 0);
|
|
42480
|
+
if (containerWidth > 0 && sizesSum < containerWidth * 0.5 && sizesSum > 100) {
|
|
42481
|
+
return;
|
|
42482
|
+
}
|
|
42483
|
+
const isPixels = containerWidth > 0 && Math.abs(sizesSum - containerWidth) < Math.abs(sizesSum - 100);
|
|
42360
42484
|
if (leftIndex >= 0) {
|
|
42361
|
-
|
|
42485
|
+
const collapsed = sizes[leftIndex] === 0;
|
|
42486
|
+
setLeftSidebarCollapsed(collapsed);
|
|
42487
|
+
const widthPixels = isPixels ? Math.round(sizes[leftIndex]) : containerWidth > 0 ? Math.round(sizes[leftIndex] / 100 * containerWidth) : 0;
|
|
42488
|
+
if (prevLeftSidebarState.current?.width !== widthPixels || prevLeftSidebarState.current?.collapsed !== collapsed) {
|
|
42489
|
+
prevLeftSidebarState.current = { width: widthPixels, collapsed };
|
|
42490
|
+
onLeftSidebarStateChange?.({ width: widthPixels, collapsed });
|
|
42491
|
+
}
|
|
42362
42492
|
}
|
|
42363
42493
|
if (rightIndex >= 0) {
|
|
42364
|
-
|
|
42494
|
+
const collapsed = sizes[rightIndex] === 0;
|
|
42495
|
+
setRightSidebarCollapsed(collapsed);
|
|
42496
|
+
const widthPixels = isPixels ? Math.round(sizes[rightIndex]) : containerWidth > 0 ? Math.round(sizes[rightIndex] / 100 * containerWidth) : 0;
|
|
42497
|
+
if (prevRightSidebarState.current?.width !== widthPixels || prevRightSidebarState.current?.collapsed !== collapsed) {
|
|
42498
|
+
prevRightSidebarState.current = { width: widthPixels, collapsed };
|
|
42499
|
+
onRightSidebarStateChange?.({ width: widthPixels, collapsed });
|
|
42500
|
+
}
|
|
42365
42501
|
}
|
|
42366
42502
|
},
|
|
42367
|
-
[leftPanel, rightPanel]
|
|
42503
|
+
[leftPanel, rightPanel, onLeftSidebarStateChange, onRightSidebarStateChange]
|
|
42368
42504
|
);
|
|
42369
42505
|
const handleLeftTabChange = useCallback73(
|
|
42370
42506
|
(value) => {
|
|
@@ -42400,10 +42536,8 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42400
42536
|
},
|
|
42401
42537
|
[onChangeRightTab, rightSidebarRef, rightTabValue]
|
|
42402
42538
|
);
|
|
42403
|
-
const showLeftTabs = !!leftSidebarOptions.showTabs && !!leftTabItems
|
|
42404
|
-
|
|
42405
|
-
(!compactDrawerMenu || leftSidebarCollapsed);
|
|
42406
|
-
return /* @__PURE__ */ React316.createElement(
|
|
42539
|
+
const showLeftTabs = !!leftSidebarOptions.showTabs && !!leftTabItems;
|
|
42540
|
+
return /* @__PURE__ */ React316.createElement("div", { ref: containerRef, className: "n-flex n-flex-1" }, /* @__PURE__ */ React316.createElement(
|
|
42407
42541
|
PanelGroup,
|
|
42408
42542
|
{
|
|
42409
42543
|
ref: panelGroupRef,
|
|
@@ -42413,20 +42547,11 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42413
42547
|
autoSaveId,
|
|
42414
42548
|
onLayout: handleLayoutChange
|
|
42415
42549
|
},
|
|
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(
|
|
42550
|
+
leftPanel && /* @__PURE__ */ React316.createElement(React316.Fragment, null, /* @__PURE__ */ React316.createElement(
|
|
42426
42551
|
Panel,
|
|
42427
42552
|
{
|
|
42428
42553
|
id: LEFT_SIDEBAR_ID,
|
|
42429
|
-
className: "n-relative",
|
|
42554
|
+
className: "n-relative n-workspace-sidebar",
|
|
42430
42555
|
order: 1,
|
|
42431
42556
|
ref: leftSidebarRef,
|
|
42432
42557
|
defaultSize: leftSidebarOptions.initialSize,
|
|
@@ -42435,8 +42560,21 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42435
42560
|
collapsible: true,
|
|
42436
42561
|
defaultCollapsed: leftSidebarOptions.defaultCollapsed
|
|
42437
42562
|
},
|
|
42438
|
-
leftSidebarCollapsed ? null :
|
|
42439
|
-
|
|
42563
|
+
leftSidebarCollapsed ? null : /* @__PURE__ */ React316.createElement("div", { className: "n-flex n-flex-col n-h-full" }, showLeftTabs && /* @__PURE__ */ React316.createElement(
|
|
42564
|
+
HorizontalTabBar,
|
|
42565
|
+
{
|
|
42566
|
+
items: leftTabItems,
|
|
42567
|
+
activeValue: leftTabValue,
|
|
42568
|
+
onChange: handleLeftTabChange
|
|
42569
|
+
}
|
|
42570
|
+
), /* @__PURE__ */ React316.createElement("div", { className: "n-flex-1 n-relative n-min-h-0" }, leftPanel))
|
|
42571
|
+
), /* @__PURE__ */ React316.createElement(
|
|
42572
|
+
PanelResizeHandle,
|
|
42573
|
+
{
|
|
42574
|
+
index: 0,
|
|
42575
|
+
className: `n-cursor-col-resize n-w-px n-h-full ${leftSidebarCollapsed ? "" : "n-bg-divider"}`
|
|
42576
|
+
}
|
|
42577
|
+
)),
|
|
42440
42578
|
/* @__PURE__ */ React316.createElement(
|
|
42441
42579
|
Panel,
|
|
42442
42580
|
{
|
|
@@ -42446,11 +42584,17 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42446
42584
|
},
|
|
42447
42585
|
centerPanel
|
|
42448
42586
|
),
|
|
42449
|
-
rightPanel && /* @__PURE__ */ React316.createElement(React316.Fragment, null, /* @__PURE__ */ React316.createElement(
|
|
42587
|
+
rightPanel && /* @__PURE__ */ React316.createElement(React316.Fragment, null, /* @__PURE__ */ React316.createElement(
|
|
42588
|
+
PanelResizeHandle,
|
|
42589
|
+
{
|
|
42590
|
+
index: 1,
|
|
42591
|
+
className: `n-cursor-col-resize n-w-px n-h-full ${rightSidebarCollapsed ? "" : "n-bg-divider"}`
|
|
42592
|
+
}
|
|
42593
|
+
), /* @__PURE__ */ React316.createElement(
|
|
42450
42594
|
Panel,
|
|
42451
42595
|
{
|
|
42452
42596
|
id: RIGHT_SIDEBAR_ID,
|
|
42453
|
-
className: "n-relative",
|
|
42597
|
+
className: "n-relative n-workspace-sidebar",
|
|
42454
42598
|
order: 3,
|
|
42455
42599
|
ref: rightSidebarRef,
|
|
42456
42600
|
minSize: rightSidebarOptions.minSize,
|
|
@@ -42459,18 +42603,16 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42459
42603
|
collapsible: true,
|
|
42460
42604
|
defaultCollapsed: rightSidebarOptions.defaultCollapsed
|
|
42461
42605
|
},
|
|
42462
|
-
rightSidebarCollapsed ? null :
|
|
42463
|
-
|
|
42464
|
-
|
|
42465
|
-
|
|
42466
|
-
|
|
42467
|
-
|
|
42468
|
-
|
|
42469
|
-
|
|
42470
|
-
onChange: handleRightTabChange
|
|
42471
|
-
}
|
|
42606
|
+
rightSidebarCollapsed ? null : /* @__PURE__ */ React316.createElement("div", { className: "n-flex n-flex-col n-h-full" }, rightSidebarOptions.showTabs && rightTabItems && /* @__PURE__ */ React316.createElement(
|
|
42607
|
+
HorizontalTabBar,
|
|
42608
|
+
{
|
|
42609
|
+
items: rightTabItems,
|
|
42610
|
+
activeValue: rightTabValue,
|
|
42611
|
+
onChange: handleRightTabChange
|
|
42612
|
+
}
|
|
42613
|
+
), /* @__PURE__ */ React316.createElement("div", { className: "n-flex-1 n-relative n-min-h-0" }, rightPanel))
|
|
42472
42614
|
))
|
|
42473
|
-
);
|
|
42615
|
+
));
|
|
42474
42616
|
});
|
|
42475
42617
|
|
|
42476
42618
|
// src/components/workspace/renderPanelChildren.tsx
|
|
@@ -42551,7 +42693,9 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42551
42693
|
showTabs: rightShowTabs = true
|
|
42552
42694
|
} = {},
|
|
42553
42695
|
theme,
|
|
42554
|
-
|
|
42696
|
+
onLeftSidebarStateChange,
|
|
42697
|
+
onRightSidebarStateChange,
|
|
42698
|
+
shouldAutoSave
|
|
42555
42699
|
}, forwardedRef) {
|
|
42556
42700
|
const containerRef = React317.useRef(null);
|
|
42557
42701
|
const containerSize = useSize(containerRef);
|
|
@@ -42569,8 +42713,8 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42569
42713
|
const rightSidebarMinPixels = toPixels(rightMinSize);
|
|
42570
42714
|
const rightSidebarMaxPixels = toPixels(rightMaxSize);
|
|
42571
42715
|
const rightSidebarInitialPixels = toPixels(rightInitialSize) ?? 280;
|
|
42572
|
-
const leftSidebarRef =
|
|
42573
|
-
const rightSidebarRef =
|
|
42716
|
+
const leftSidebarRef = useRef93(null);
|
|
42717
|
+
const rightSidebarRef = useRef93(null);
|
|
42574
42718
|
const [leftTabValue, setLeftTabValue] = useControlledOrUncontrolled({
|
|
42575
42719
|
value: leftTabValueProp,
|
|
42576
42720
|
onChange: onChangeLeftTab,
|
|
@@ -42648,24 +42792,24 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42648
42792
|
rightSidebarRef.current?.collapse();
|
|
42649
42793
|
}
|
|
42650
42794
|
}, [isDrawerActive]);
|
|
42651
|
-
const leftChildrenProps =
|
|
42795
|
+
const leftChildrenProps = useMemo154(() => {
|
|
42652
42796
|
return {
|
|
42653
42797
|
activeTabValue: leftTabValue,
|
|
42654
42798
|
closeSidebar: closeLeftSidebar
|
|
42655
42799
|
};
|
|
42656
42800
|
}, [leftTabValue, closeLeftSidebar]);
|
|
42657
|
-
const rightChildrenProps =
|
|
42801
|
+
const rightChildrenProps = useMemo154(() => {
|
|
42658
42802
|
return {
|
|
42659
42803
|
activeTabValue: rightTabValue,
|
|
42660
42804
|
closeSidebar: closeRightSidebar
|
|
42661
42805
|
};
|
|
42662
42806
|
}, [rightTabValue, closeRightSidebar]);
|
|
42663
|
-
const leftSidebarProviderValue =
|
|
42807
|
+
const leftSidebarProviderValue = useMemo154(() => {
|
|
42664
42808
|
return {
|
|
42665
42809
|
closeSidebar: closeLeftSidebar
|
|
42666
42810
|
};
|
|
42667
42811
|
}, [closeLeftSidebar]);
|
|
42668
|
-
const rightSidebarProviderValue =
|
|
42812
|
+
const rightSidebarProviderValue = useMemo154(() => {
|
|
42669
42813
|
return {
|
|
42670
42814
|
closeSidebar: closeRightSidebar
|
|
42671
42815
|
};
|
|
@@ -42687,7 +42831,7 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42687
42831
|
/* @__PURE__ */ React317.createElement(WorkspaceSideProvider, { value: rightSidebarProviderValue }, rightTabValue ? renderPanelChildren(right, rightChildrenProps) : null)
|
|
42688
42832
|
) : null;
|
|
42689
42833
|
const centerPanel = /* @__PURE__ */ React317.createElement(PanelInner, { className: "n-bg-canvas-background" }, children);
|
|
42690
|
-
const leftSidebarOptions =
|
|
42834
|
+
const leftSidebarOptions = useMemo154(
|
|
42691
42835
|
() => ({
|
|
42692
42836
|
minSize: leftSidebarMinPixels,
|
|
42693
42837
|
maxSize: leftSidebarMaxPixels,
|
|
@@ -42705,7 +42849,7 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42705
42849
|
leftShowTabs
|
|
42706
42850
|
]
|
|
42707
42851
|
);
|
|
42708
|
-
const rightSidebarOptions =
|
|
42852
|
+
const rightSidebarOptions = useMemo154(
|
|
42709
42853
|
() => ({
|
|
42710
42854
|
minSize: rightSidebarMinPixels,
|
|
42711
42855
|
maxSize: rightSidebarMaxPixels,
|
|
@@ -42756,7 +42900,9 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42756
42900
|
autoSavePrefix,
|
|
42757
42901
|
leftSidebarRef,
|
|
42758
42902
|
rightSidebarRef,
|
|
42759
|
-
|
|
42903
|
+
onLeftSidebarStateChange,
|
|
42904
|
+
onRightSidebarStateChange,
|
|
42905
|
+
shouldAutoSave
|
|
42760
42906
|
}
|
|
42761
42907
|
), isOverlay && /* @__PURE__ */ React317.createElement(
|
|
42762
42908
|
OverlayToolbar,
|