@vuu-ui/vuu-layout 0.8.22-debug → 0.8.23-debug
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/cjs/index.js +354 -1803
- package/cjs/index.js.map +4 -4
- package/esm/index.js +81 -1568
- package/esm/index.js.map +4 -4
- package/index.css +0 -151
- package/index.css.map +3 -3
- package/package.json +8 -8
- package/types/index.d.ts +0 -3
- package/types/utils/index.d.ts +0 -1
- package/types/utils/typeOf.d.ts +2 -1
- package/types/measured-container/MeasuredContainer.d.ts +0 -15
- package/types/measured-container/index.d.ts +0 -2
- package/types/measured-container/useMeasuredContainer.d.ts +0 -22
- package/types/measured-container/useResizeObserver.d.ts +0 -15
- package/types/overflow-container/OverflowContainer.d.ts +0 -17
- package/types/overflow-container/index.d.ts +0 -2
- package/types/overflow-container/overflow-utils.d.ts +0 -49
- package/types/overflow-container/useOverflowContainer.d.ts +0 -20
- package/types/toolbar/Toolbar.d.ts +0 -21
- package/types/toolbar/index.d.ts +0 -1
- package/types/toolbar/toolbar-dom-utils.d.ts +0 -3
- package/types/toolbar/useKeyboardNavigation.d.ts +0 -32
- package/types/toolbar/useSelection.d.ts +0 -22
- package/types/toolbar/useToolbar.d.ts +0 -28
- package/types/utils/react-utils.d.ts +0 -2
package/cjs/index.js
CHANGED
|
@@ -54,16 +54,12 @@ __export(src_exports, {
|
|
|
54
54
|
LayoutProviderVersion: () => LayoutProviderVersion,
|
|
55
55
|
LayoutTreeViewer: () => LayoutTreeViewer,
|
|
56
56
|
MARGIN_STYLES: () => MARGIN_STYLES,
|
|
57
|
-
MeasuredContainer: () => MeasuredContainer,
|
|
58
|
-
NO_WRAPPED_ITEMS: () => NO_WRAPPED_ITEMS,
|
|
59
|
-
OverflowContainer: () => OverflowContainer,
|
|
60
57
|
PADDING_STYLES: () => PADDING_STYLES,
|
|
61
58
|
Palette: () => Palette,
|
|
62
59
|
PaletteItem: () => PaletteItem,
|
|
63
60
|
Placeholder: () => Placeholder,
|
|
64
61
|
Stack: () => Stack,
|
|
65
62
|
StackLayout: () => StackLayout,
|
|
66
|
-
Toolbar: () => Toolbar,
|
|
67
63
|
View: () => MemoView,
|
|
68
64
|
ViewContext: () => ViewContext,
|
|
69
65
|
WidthHeight: () => WidthHeight,
|
|
@@ -71,13 +67,9 @@ __export(src_exports, {
|
|
|
71
67
|
XXXnormalizeStyles: () => XXXnormalizeStyles,
|
|
72
68
|
applyLayout: () => applyLayout,
|
|
73
69
|
applyLayoutProps: () => applyLayoutProps,
|
|
74
|
-
applyOverflowClassToWrappedItems: () => applyOverflowClassToWrappedItems,
|
|
75
|
-
asReactElements: () => asReactElements,
|
|
76
70
|
componentToJson: () => componentToJson,
|
|
77
71
|
computeMenuPosition: () => computeMenuPosition,
|
|
78
72
|
containerOf: () => containerOf,
|
|
79
|
-
correctForWrappedHighPriorityItems: () => correctForWrappedHighPriorityItems,
|
|
80
|
-
correctForWrappedOverflowIndicator: () => correctForWrappedOverflowIndicator,
|
|
81
73
|
createFlexbox: () => createFlexbox,
|
|
82
74
|
createPlaceHolder: () => createPlaceHolder,
|
|
83
75
|
expandFlex: () => expandFlex,
|
|
@@ -89,25 +81,22 @@ __export(src_exports, {
|
|
|
89
81
|
getChild: () => getChild,
|
|
90
82
|
getChildProp: () => getChildProp,
|
|
91
83
|
getDefaultTabLabel: () => getDefaultTabLabel,
|
|
92
|
-
getElementsMarkedAsWrapped: () => getElementsMarkedAsWrapped,
|
|
93
84
|
getFlexDimensions: () => getFlexDimensions,
|
|
94
85
|
getFlexOrIntrinsicStyle: () => getFlexOrIntrinsicStyle,
|
|
95
86
|
getFlexStyle: () => getFlexStyle,
|
|
96
87
|
getIntrinsicSize: () => getIntrinsicSize,
|
|
97
88
|
getManagedDimension: () => getManagedDimension,
|
|
98
|
-
getNonWrappedAndWrappedItems: () => getNonWrappedAndWrappedItems,
|
|
99
89
|
getPersistentState: () => getPersistentState,
|
|
100
90
|
getProp: () => getProp,
|
|
101
91
|
getProps: () => getProps,
|
|
102
92
|
hasPersistentState: () => hasPersistentState,
|
|
103
93
|
hasUnboundedFlexStyle: () => hasUnboundedFlexStyle,
|
|
104
|
-
highPriorityItemsHaveWrappedButShouldNotHave: () => highPriorityItemsHaveWrappedButShouldNotHave,
|
|
105
94
|
identifyDropTarget: () => identifyDropTarget,
|
|
106
95
|
isApplicationLevelChange: () => isApplicationLevelChange,
|
|
107
96
|
isContainer: () => isContainer,
|
|
108
97
|
isLayoutComponent: () => isLayoutComponent,
|
|
98
|
+
isLayoutJSON: () => isLayoutJSON,
|
|
109
99
|
isLayoutLevelChange: () => isLayoutLevelChange,
|
|
110
|
-
isOverflowElement: () => isOverflowElement,
|
|
111
100
|
isResponsiveAttribute: () => isResponsiveAttribute,
|
|
112
101
|
isTabstrip: () => isTabstrip,
|
|
113
102
|
isTypeOf: () => isTypeOf,
|
|
@@ -116,14 +105,11 @@ __export(src_exports, {
|
|
|
116
105
|
layoutQuery: () => layoutQuery,
|
|
117
106
|
layoutReducer: () => layoutReducer,
|
|
118
107
|
layoutToJSON: () => layoutToJSON,
|
|
119
|
-
markElementAsWrapped: () => markElementAsWrapped,
|
|
120
108
|
nextLeaf: () => nextLeaf,
|
|
121
109
|
nextStep: () => nextStep,
|
|
122
|
-
overflowIndicatorHasWrappedButShouldNotHave: () => overflowIndicatorHasWrappedButShouldNotHave,
|
|
123
110
|
previousLeaf: () => previousLeaf,
|
|
124
111
|
processLayoutElement: () => processLayoutElement,
|
|
125
112
|
registerComponent: () => registerComponent,
|
|
126
|
-
removeOverflowIndicatorIfNoLongerNeeded: () => removeOverflowIndicatorIfNoLongerNeeded,
|
|
127
113
|
resetPath: () => resetPath,
|
|
128
114
|
resizeObserver: () => resizeObserver,
|
|
129
115
|
resolveJSONPath: () => resolveJSONPath,
|
|
@@ -131,15 +117,11 @@ __export(src_exports, {
|
|
|
131
117
|
serializeProps: () => serializeProps,
|
|
132
118
|
setPersistentState: () => setPersistentState,
|
|
133
119
|
setRef: () => setRef,
|
|
134
|
-
sortByScreenOrder: () => sortByScreenOrder,
|
|
135
|
-
switchWrappedItemIntoView: () => switchWrappedItemIntoView,
|
|
136
120
|
typeOf: () => typeOf,
|
|
137
|
-
unmarkItemsWhichAreNoLongerWrapped: () => unmarkItemsWhichAreNoLongerWrapped,
|
|
138
121
|
useBreakpoints: () => useBreakpoints,
|
|
139
122
|
useLayoutCreateNewChild: () => useLayoutCreateNewChild,
|
|
140
123
|
useLayoutProviderDispatch: () => useLayoutProviderDispatch,
|
|
141
124
|
useLayoutProviderVersion: () => useLayoutProviderVersion,
|
|
142
|
-
useMeasuredContainer: () => useMeasuredContainer,
|
|
143
125
|
usePersistentState: () => usePersistentState,
|
|
144
126
|
useResizeObserver: () => useResizeObserver,
|
|
145
127
|
useViewActionDispatcher: () => useViewActionDispatcher,
|
|
@@ -263,14 +245,14 @@ var isDrawer = (component) => component.type === Drawer_default;
|
|
|
263
245
|
var isVertical = ({ props: { position = "left" } }) => position.match(/top|bottom/);
|
|
264
246
|
var DockLayout = (props) => {
|
|
265
247
|
const { children, className: classNameProp, id, style } = props;
|
|
266
|
-
const
|
|
248
|
+
const classBase11 = "vuuDockLayout";
|
|
267
249
|
const [drawers, content] = (0, import_vuu_utils.partition)(children, isDrawer);
|
|
268
250
|
const [verticalDrawers, horizontalDrawers] = (0, import_vuu_utils.partition)(drawers, isVertical);
|
|
269
251
|
const orientation = verticalDrawers.length === 0 ? "horizontal" : horizontalDrawers.length === 0 ? "vertical" : "both";
|
|
270
|
-
const className = (0, import_clsx2.default)(
|
|
252
|
+
const className = (0, import_clsx2.default)(classBase11, classNameProp, `${classBase11}-${orientation}`);
|
|
271
253
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className, id, style, children: [
|
|
272
254
|
drawers,
|
|
273
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: `${
|
|
255
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: `${classBase11}-content`, children: content })
|
|
274
256
|
] });
|
|
275
257
|
};
|
|
276
258
|
DockLayout.displayName = "DockLayout";
|
|
@@ -334,6 +316,7 @@ function typeOf(element) {
|
|
|
334
316
|
}
|
|
335
317
|
}
|
|
336
318
|
var isTypeOf = (element, type) => typeOf(element) === type;
|
|
319
|
+
var isLayoutJSON = (layout) => layout !== void 0 && "type" in layout;
|
|
337
320
|
|
|
338
321
|
// src/utils/pathUtils.ts
|
|
339
322
|
var removeFinalPathSegment = (path) => {
|
|
@@ -618,23 +601,6 @@ function setRef(ref, value) {
|
|
|
618
601
|
}
|
|
619
602
|
}
|
|
620
603
|
|
|
621
|
-
// src/utils/react-utils.ts
|
|
622
|
-
var import_react4 = require("react");
|
|
623
|
-
var EMPTY_ARRAY = [];
|
|
624
|
-
var asReactElements = (children) => {
|
|
625
|
-
const isArray = Array.isArray(children);
|
|
626
|
-
const count = isArray ? children.length : import_react4.Children.count(children);
|
|
627
|
-
if (isArray && children.every(import_react4.isValidElement)) {
|
|
628
|
-
return children;
|
|
629
|
-
} else if (count === 1 && !isArray && (0, import_react4.isValidElement)(children)) {
|
|
630
|
-
return [children];
|
|
631
|
-
} else if (count > 1) {
|
|
632
|
-
return children;
|
|
633
|
-
} else {
|
|
634
|
-
return EMPTY_ARRAY;
|
|
635
|
-
}
|
|
636
|
-
};
|
|
637
|
-
|
|
638
604
|
// src/utils/styleUtils.ts
|
|
639
605
|
var expandFlex = (flex) => {
|
|
640
606
|
if (typeof flex !== "number") {
|
|
@@ -1912,9 +1878,9 @@ function onDragEnd() {
|
|
|
1912
1878
|
|
|
1913
1879
|
// src/DraggableLayout.tsx
|
|
1914
1880
|
var import_clsx4 = __toESM(require("clsx"));
|
|
1915
|
-
var
|
|
1881
|
+
var import_react4 = require("react");
|
|
1916
1882
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1917
|
-
var DraggableLayout = (0,
|
|
1883
|
+
var DraggableLayout = (0, import_react4.forwardRef)(function DraggableLayout2({
|
|
1918
1884
|
children,
|
|
1919
1885
|
className: classNameProp,
|
|
1920
1886
|
dropTarget,
|
|
@@ -1932,28 +1898,28 @@ registerComponent(componentName, DraggableLayout, "container");
|
|
|
1932
1898
|
// src/flexbox/Flexbox.tsx
|
|
1933
1899
|
var import_core5 = require("@salt-ds/core");
|
|
1934
1900
|
var import_clsx9 = __toESM(require("clsx"));
|
|
1935
|
-
var
|
|
1901
|
+
var import_react29 = require("react");
|
|
1936
1902
|
|
|
1937
1903
|
// src/flexbox/useSplitterResizing.ts
|
|
1938
1904
|
var import_vuu_utils8 = require("@vuu-ui/vuu-utils");
|
|
1939
|
-
var
|
|
1905
|
+
var import_react28 = __toESM(require("react"));
|
|
1940
1906
|
|
|
1941
1907
|
// src/placeholder/Placeholder.tsx
|
|
1942
1908
|
var import_clsx7 = __toESM(require("clsx"));
|
|
1943
1909
|
|
|
1944
1910
|
// src/placeholder/LayoutStartPanel.tsx
|
|
1945
1911
|
var import_core4 = require("@salt-ds/core");
|
|
1946
|
-
var
|
|
1912
|
+
var import_react26 = require("react");
|
|
1947
1913
|
|
|
1948
1914
|
// src/layout-view/useViewActionDispatcher.ts
|
|
1949
|
-
var
|
|
1915
|
+
var import_react18 = require("react");
|
|
1950
1916
|
|
|
1951
1917
|
// src/layout-provider/LayoutProvider.tsx
|
|
1952
|
-
var
|
|
1918
|
+
var import_react17 = require("react");
|
|
1953
1919
|
|
|
1954
1920
|
// src/layout-reducer/flexUtils.ts
|
|
1955
1921
|
var import_vuu_utils3 = require("@vuu-ui/vuu-utils");
|
|
1956
|
-
var
|
|
1922
|
+
var import_react5 = __toESM(require("react"));
|
|
1957
1923
|
var placeHolderProps = { "data-placeholder": true, "data-resizeable": true };
|
|
1958
1924
|
var NO_STYLE = {};
|
|
1959
1925
|
var auto = "auto";
|
|
@@ -2124,7 +2090,7 @@ function createFlexbox(flexDirection3, props, children, path) {
|
|
|
2124
2090
|
const { flexFill, style, resizeable = true } = props;
|
|
2125
2091
|
const { flexBasis = flexFill ? void 0 : "auto" } = style;
|
|
2126
2092
|
const flex = getFlexValue(flexBasis, flexFill);
|
|
2127
|
-
return
|
|
2093
|
+
return import_react5.default.createElement(
|
|
2128
2094
|
ComponentRegistry.Flexbox,
|
|
2129
2095
|
{
|
|
2130
2096
|
id,
|
|
@@ -2146,7 +2112,7 @@ function createFlexbox(flexDirection3, props, children, path) {
|
|
|
2146
2112
|
var baseStyle = { flexGrow: 1, flexShrink: 1 };
|
|
2147
2113
|
function createPlaceHolder(path, size, style, props) {
|
|
2148
2114
|
const id = (0, import_vuu_utils3.uuid)();
|
|
2149
|
-
return
|
|
2115
|
+
return import_react5.default.createElement("div", {
|
|
2150
2116
|
...placeHolderProps,
|
|
2151
2117
|
...props,
|
|
2152
2118
|
"data-path": path,
|
|
@@ -2157,25 +2123,25 @@ function createPlaceHolder(path, size, style, props) {
|
|
|
2157
2123
|
}
|
|
2158
2124
|
|
|
2159
2125
|
// src/layout-reducer/layout-reducer.ts
|
|
2160
|
-
var
|
|
2126
|
+
var import_react14 = __toESM(require("react"));
|
|
2161
2127
|
|
|
2162
2128
|
// src/layout-reducer/insert-layout-element.ts
|
|
2163
2129
|
var import_vuu_utils5 = require("@vuu-ui/vuu-utils");
|
|
2164
|
-
var
|
|
2130
|
+
var import_react8 = __toESM(require("react"));
|
|
2165
2131
|
|
|
2166
2132
|
// src/layout-reducer/layoutUtils.ts
|
|
2167
2133
|
var import_vuu_utils4 = require("@vuu-ui/vuu-utils");
|
|
2168
|
-
var
|
|
2134
|
+
var import_react7 = __toESM(require("react"));
|
|
2169
2135
|
|
|
2170
2136
|
// src/use-persistent-state.ts
|
|
2171
|
-
var
|
|
2137
|
+
var import_react6 = require("react");
|
|
2172
2138
|
var persistentState = /* @__PURE__ */ new Map();
|
|
2173
2139
|
var sessionState = /* @__PURE__ */ new Map();
|
|
2174
2140
|
var getPersistentState = (id) => persistentState.get(id);
|
|
2175
2141
|
var hasPersistentState = (id) => persistentState.has(id);
|
|
2176
2142
|
var setPersistentState = (id, value) => persistentState.set(id, value);
|
|
2177
2143
|
var usePersistentState = () => {
|
|
2178
|
-
const loadSessionState = (0,
|
|
2144
|
+
const loadSessionState = (0, import_react6.useCallback)((id, key) => {
|
|
2179
2145
|
const state = sessionState.get(id);
|
|
2180
2146
|
if (state) {
|
|
2181
2147
|
if (key !== void 0 && state[key] !== void 0) {
|
|
@@ -2187,7 +2153,7 @@ var usePersistentState = () => {
|
|
|
2187
2153
|
return state;
|
|
2188
2154
|
}
|
|
2189
2155
|
}, []);
|
|
2190
|
-
const saveSessionState = (0,
|
|
2156
|
+
const saveSessionState = (0, import_react6.useCallback)((id, key, data) => {
|
|
2191
2157
|
if (key === void 0) {
|
|
2192
2158
|
sessionState.set(id, data);
|
|
2193
2159
|
} else if (sessionState.has(id)) {
|
|
@@ -2200,7 +2166,7 @@ var usePersistentState = () => {
|
|
|
2200
2166
|
sessionState.set(id, { [key]: data });
|
|
2201
2167
|
}
|
|
2202
2168
|
}, []);
|
|
2203
|
-
const purgeSessionState = (0,
|
|
2169
|
+
const purgeSessionState = (0, import_react6.useCallback)((id, key) => {
|
|
2204
2170
|
if (sessionState.has(id)) {
|
|
2205
2171
|
if (key === void 0) {
|
|
2206
2172
|
sessionState.delete(id);
|
|
@@ -2217,7 +2183,7 @@ var usePersistentState = () => {
|
|
|
2217
2183
|
}
|
|
2218
2184
|
}
|
|
2219
2185
|
}, []);
|
|
2220
|
-
const loadState = (0,
|
|
2186
|
+
const loadState = (0, import_react6.useCallback)((id, key) => {
|
|
2221
2187
|
const state = persistentState.get(id);
|
|
2222
2188
|
if (state) {
|
|
2223
2189
|
if (key !== void 0) {
|
|
@@ -2226,7 +2192,7 @@ var usePersistentState = () => {
|
|
|
2226
2192
|
return state;
|
|
2227
2193
|
}
|
|
2228
2194
|
}, []);
|
|
2229
|
-
const saveState = (0,
|
|
2195
|
+
const saveState = (0, import_react6.useCallback)(
|
|
2230
2196
|
(id, key, data) => {
|
|
2231
2197
|
if (key === void 0) {
|
|
2232
2198
|
persistentState.set(id, data);
|
|
@@ -2242,7 +2208,7 @@ var usePersistentState = () => {
|
|
|
2242
2208
|
},
|
|
2243
2209
|
[]
|
|
2244
2210
|
);
|
|
2245
|
-
const purgeState = (0,
|
|
2211
|
+
const purgeState = (0, import_react6.useCallback)((id, key) => {
|
|
2246
2212
|
if (persistentState.has(id)) {
|
|
2247
2213
|
if (key === void 0) {
|
|
2248
2214
|
persistentState.delete(id);
|
|
@@ -2278,7 +2244,7 @@ var applyLayoutProps = (component, path = "0") => {
|
|
|
2278
2244
|
component.props,
|
|
2279
2245
|
path
|
|
2280
2246
|
);
|
|
2281
|
-
return
|
|
2247
|
+
return import_react7.default.cloneElement(component, layoutProps, children);
|
|
2282
2248
|
};
|
|
2283
2249
|
var processLayoutElement = (layoutElement, previousLayout) => {
|
|
2284
2250
|
const type = typeOf(layoutElement);
|
|
@@ -2289,7 +2255,7 @@ var processLayoutElement = (layoutElement, previousLayout) => {
|
|
|
2289
2255
|
void 0,
|
|
2290
2256
|
previousLayout
|
|
2291
2257
|
);
|
|
2292
|
-
return (0,
|
|
2258
|
+
return (0, import_react7.cloneElement)(layoutElement, layoutProps, children);
|
|
2293
2259
|
};
|
|
2294
2260
|
var applyLayout = (type, props, previousLayout) => {
|
|
2295
2261
|
const [layoutProps, children] = getChildLayoutProps(
|
|
@@ -2340,7 +2306,7 @@ function getChildLayoutProps(type, props, path, parentType = null, previousLayou
|
|
|
2340
2306
|
return [layoutProps, children];
|
|
2341
2307
|
}
|
|
2342
2308
|
function getLayoutChildren(type, children, path = "0", previousChildren) {
|
|
2343
|
-
const kids = Array.isArray(children) ? children :
|
|
2309
|
+
const kids = Array.isArray(children) ? children : import_react7.default.isValidElement(children) ? [children] : [];
|
|
2344
2310
|
return isContainer(type) ? kids.map((child, i) => {
|
|
2345
2311
|
const childType = typeOf(child);
|
|
2346
2312
|
const previousType = typeOf(previousChildren == null ? void 0 : previousChildren[i]);
|
|
@@ -2352,7 +2318,7 @@ function getLayoutChildren(type, children, path = "0", previousChildren) {
|
|
|
2352
2318
|
type,
|
|
2353
2319
|
previousChildren == null ? void 0 : previousChildren[i]
|
|
2354
2320
|
);
|
|
2355
|
-
return
|
|
2321
|
+
return import_react7.default.cloneElement(child, layoutProps, children2);
|
|
2356
2322
|
}
|
|
2357
2323
|
return previousChildren == null ? void 0 : previousChildren[i];
|
|
2358
2324
|
}) : children;
|
|
@@ -2397,7 +2363,7 @@ function layoutFromJson({ id = (0, import_vuu_utils4.uuid)(), type, children, pr
|
|
|
2397
2363
|
if (state) {
|
|
2398
2364
|
setPersistentState(id, state);
|
|
2399
2365
|
}
|
|
2400
|
-
return
|
|
2366
|
+
return import_react7.default.createElement(
|
|
2401
2367
|
componentType,
|
|
2402
2368
|
{
|
|
2403
2369
|
id,
|
|
@@ -2420,7 +2386,7 @@ function componentToJson(component) {
|
|
|
2420
2386
|
type,
|
|
2421
2387
|
props: serializeProps(props),
|
|
2422
2388
|
state,
|
|
2423
|
-
children:
|
|
2389
|
+
children: import_react7.default.Children.map(children, componentToJson)
|
|
2424
2390
|
};
|
|
2425
2391
|
}
|
|
2426
2392
|
function serializeProps(props) {
|
|
@@ -2509,7 +2475,7 @@ function insertIntoContainer(container, targetContainer, newComponent) {
|
|
|
2509
2475
|
)
|
|
2510
2476
|
];
|
|
2511
2477
|
const active = typeOf(container) === "Stack" ? Array.isArray(insertedIdx) ? insertedIdx[0] : insertedIdx : containerActive;
|
|
2512
|
-
return
|
|
2478
|
+
return import_react8.default.cloneElement(container, { active }, children);
|
|
2513
2479
|
}
|
|
2514
2480
|
var getDefaultTitle = (containerType, component, index, existingLabels) => containerType === "Stack" ? getDefaultTabLabel(component, index, existingLabels) : void 0;
|
|
2515
2481
|
var getChildrenTitles = (children) => children.map((child) => child.props.title);
|
|
@@ -2573,7 +2539,7 @@ function insertBesideChild(container, existingComponent, newComponent, insertion
|
|
|
2573
2539
|
)
|
|
2574
2540
|
];
|
|
2575
2541
|
const active = typeOf(container) === "Stack" ? insertedIdx : containerActive;
|
|
2576
|
-
return
|
|
2542
|
+
return import_react8.default.cloneElement(container, { active }, children);
|
|
2577
2543
|
}
|
|
2578
2544
|
function updateChildren(container, containerChildren, idx, newComponent, insertionPosition, pos, clientRect, dropRect) {
|
|
2579
2545
|
const intrinsicSize = getIntrinsicSize(newComponent);
|
|
@@ -2710,10 +2676,10 @@ function getStyledComponents(container, existingComponent, newComponent, targetR
|
|
|
2710
2676
|
);
|
|
2711
2677
|
const newComponentStyle = getFlexOrIntrinsicStyle(newComponent, dim, size);
|
|
2712
2678
|
return [
|
|
2713
|
-
|
|
2679
|
+
import_react8.default.cloneElement(existingComponent, {
|
|
2714
2680
|
style: existingComponentStyle
|
|
2715
2681
|
}),
|
|
2716
|
-
|
|
2682
|
+
import_react8.default.cloneElement(newComponent, {
|
|
2717
2683
|
id,
|
|
2718
2684
|
version,
|
|
2719
2685
|
style: newComponentStyle
|
|
@@ -2729,7 +2695,7 @@ function getStyledComponents(container, existingComponent, newComponent, targetR
|
|
|
2729
2695
|
} = getProps(newComponent);
|
|
2730
2696
|
return [
|
|
2731
2697
|
existingComponent,
|
|
2732
|
-
|
|
2698
|
+
import_react8.default.cloneElement(newComponent, {
|
|
2733
2699
|
id,
|
|
2734
2700
|
version,
|
|
2735
2701
|
style: { ...style, flex: "1 1 0px" }
|
|
@@ -2739,10 +2705,10 @@ function getStyledComponents(container, existingComponent, newComponent, targetR
|
|
|
2739
2705
|
}
|
|
2740
2706
|
|
|
2741
2707
|
// src/layout-reducer/move-layout-element.ts
|
|
2742
|
-
var
|
|
2708
|
+
var import_react10 = require("react");
|
|
2743
2709
|
|
|
2744
2710
|
// src/layout-reducer/replace-layout-element.ts
|
|
2745
|
-
var
|
|
2711
|
+
var import_react9 = __toESM(require("react"));
|
|
2746
2712
|
|
|
2747
2713
|
// src/layout-action.ts
|
|
2748
2714
|
var Action = {
|
|
@@ -2777,7 +2743,7 @@ function _replaceChild(model, child, replacement) {
|
|
|
2777
2743
|
const resizeable = getProp(child, "resizeable");
|
|
2778
2744
|
const { style } = getProps(child);
|
|
2779
2745
|
const newChild = applyLayoutProps(
|
|
2780
|
-
|
|
2746
|
+
import_react9.default.cloneElement(replacement, {
|
|
2781
2747
|
resizeable,
|
|
2782
2748
|
style: {
|
|
2783
2749
|
...style,
|
|
@@ -2805,7 +2771,7 @@ function swapChild(model, child, replacement, op) {
|
|
|
2805
2771
|
} else {
|
|
2806
2772
|
children[idx] = swapChild(children[idx], child, replacement, op);
|
|
2807
2773
|
}
|
|
2808
|
-
return
|
|
2774
|
+
return import_react9.default.cloneElement(model, void 0, children);
|
|
2809
2775
|
}
|
|
2810
2776
|
function minimize(parent, child) {
|
|
2811
2777
|
const { style: parentStyle } = getProps(parent);
|
|
@@ -2826,7 +2792,7 @@ function minimize(parent, child) {
|
|
|
2826
2792
|
};
|
|
2827
2793
|
const collapsed = parentStyle.flexDirection === "row" ? "vertical" : parentStyle.flexDirection === "column" ? "horizontal" : false;
|
|
2828
2794
|
if (collapsed) {
|
|
2829
|
-
return
|
|
2795
|
+
return import_react9.default.cloneElement(child, {
|
|
2830
2796
|
collapsed,
|
|
2831
2797
|
restoreStyle,
|
|
2832
2798
|
style
|
|
@@ -2841,7 +2807,7 @@ function restore(child) {
|
|
|
2841
2807
|
...rest,
|
|
2842
2808
|
...restoreStyle
|
|
2843
2809
|
};
|
|
2844
|
-
return
|
|
2810
|
+
return import_react9.default.cloneElement(child, {
|
|
2845
2811
|
collapsed: false,
|
|
2846
2812
|
style,
|
|
2847
2813
|
restoreStyle: void 0
|
|
@@ -2857,7 +2823,7 @@ function moveChild(layoutRoot, { fromIndex, path, toIndex }) {
|
|
|
2857
2823
|
fromIndex,
|
|
2858
2824
|
toIndex
|
|
2859
2825
|
);
|
|
2860
|
-
const replacement = (0,
|
|
2826
|
+
const replacement = (0, import_react10.cloneElement)(target, void 0, replacementChildren);
|
|
2861
2827
|
return swapChild(layoutRoot, target, replacement);
|
|
2862
2828
|
}
|
|
2863
2829
|
function moveChildWithinChildren(children, fromIndex, toIndex) {
|
|
@@ -2908,7 +2874,7 @@ var isLayoutLevelChange = (layoutChangeReason) => [
|
|
|
2908
2874
|
].includes(layoutChangeReason);
|
|
2909
2875
|
|
|
2910
2876
|
// src/layout-reducer/remove-layout-element.ts
|
|
2911
|
-
var
|
|
2877
|
+
var import_react11 = __toESM(require("react"));
|
|
2912
2878
|
function removeChild(layoutRoot, { path }) {
|
|
2913
2879
|
const target = followPath(layoutRoot, path);
|
|
2914
2880
|
let targetParent = followPathToParent(layoutRoot, path);
|
|
@@ -2995,7 +2961,7 @@ function _removeChild(container, child) {
|
|
|
2995
2961
|
children[idx] = _removeChild(children[idx], child);
|
|
2996
2962
|
}
|
|
2997
2963
|
children = children.map((child2, i) => resetPath(child2, `${path}.${i}`));
|
|
2998
|
-
return
|
|
2964
|
+
return import_react11.default.cloneElement(container, { active }, children);
|
|
2999
2965
|
}
|
|
3000
2966
|
function unwrap(container, child) {
|
|
3001
2967
|
const type = typeOf(container);
|
|
@@ -3005,7 +2971,7 @@ function unwrap(container, child) {
|
|
|
3005
2971
|
} = getProps(container);
|
|
3006
2972
|
let unwrappedChild = resetPath(child, path);
|
|
3007
2973
|
if (path === "0") {
|
|
3008
|
-
unwrappedChild =
|
|
2974
|
+
unwrappedChild = import_react11.default.cloneElement(unwrappedChild, {
|
|
3009
2975
|
style: {
|
|
3010
2976
|
...child.props.style,
|
|
3011
2977
|
width,
|
|
@@ -3017,7 +2983,7 @@ function unwrap(container, child) {
|
|
|
3017
2983
|
const {
|
|
3018
2984
|
style: { [dim]: size, ...style }
|
|
3019
2985
|
} = unwrappedChild.props;
|
|
3020
|
-
unwrappedChild =
|
|
2986
|
+
unwrappedChild = import_react11.default.cloneElement(unwrappedChild, {
|
|
3021
2987
|
flexFill: void 0,
|
|
3022
2988
|
style: {
|
|
3023
2989
|
...style,
|
|
@@ -3040,7 +3006,7 @@ var canBeMadeFlexible = (element) => {
|
|
|
3040
3006
|
};
|
|
3041
3007
|
var makeFlexible = (children) => {
|
|
3042
3008
|
return children.map(
|
|
3043
|
-
(child) => canBeMadeFlexible(child) ?
|
|
3009
|
+
(child) => canBeMadeFlexible(child) ? import_react11.default.cloneElement(child, {
|
|
3044
3010
|
style: {
|
|
3045
3011
|
...child.props.style,
|
|
3046
3012
|
flexGrow: 1
|
|
@@ -3071,7 +3037,7 @@ var collapsePlaceholders = (container, target) => {
|
|
|
3071
3037
|
children[idx] = collapsePlaceholders(children[idx], target);
|
|
3072
3038
|
}
|
|
3073
3039
|
children = children.map((child, i) => resetPath(child, `${path}.${i}`));
|
|
3074
|
-
return
|
|
3040
|
+
return import_react11.default.cloneElement(container, void 0, children);
|
|
3075
3041
|
};
|
|
3076
3042
|
var _collapsePlaceHolders = (container) => {
|
|
3077
3043
|
const { children } = getProps(container);
|
|
@@ -3096,7 +3062,7 @@ var _collapsePlaceHolders = (container) => {
|
|
|
3096
3062
|
newChildren.push(mergePlaceholders(placeholders));
|
|
3097
3063
|
}
|
|
3098
3064
|
const containerPath = getProp(container, "path");
|
|
3099
|
-
return
|
|
3065
|
+
return import_react11.default.cloneElement(
|
|
3100
3066
|
container,
|
|
3101
3067
|
void 0,
|
|
3102
3068
|
newChildren.map((child, i) => resetPath(child, `${containerPath}.${i}`))
|
|
@@ -3112,7 +3078,7 @@ var mergePlaceholders = ([placeholder, ...placeholders]) => {
|
|
|
3112
3078
|
flexGrow = Math.max(flexGrow, style.flexGrow);
|
|
3113
3079
|
flexShrink = Math.max(flexShrink, style.flexShrink);
|
|
3114
3080
|
}
|
|
3115
|
-
return
|
|
3081
|
+
return import_react11.default.cloneElement(placeholder, {
|
|
3116
3082
|
style: { ...targetStyle, flexBasis, flexGrow, flexShrink }
|
|
3117
3083
|
});
|
|
3118
3084
|
};
|
|
@@ -3121,7 +3087,7 @@ var allOtherChildrenArePlaceholders = (children, path) => children.every(
|
|
|
3121
3087
|
);
|
|
3122
3088
|
|
|
3123
3089
|
// src/layout-reducer/resize-flex-children.ts
|
|
3124
|
-
var
|
|
3090
|
+
var import_react12 = __toESM(require("react"));
|
|
3125
3091
|
function resizeFlexChild(layoutRoot, { path, size }) {
|
|
3126
3092
|
const target = followPath(layoutRoot, path, true);
|
|
3127
3093
|
const { style } = getProps(target);
|
|
@@ -3129,7 +3095,7 @@ function resizeFlexChild(layoutRoot, { path, size }) {
|
|
|
3129
3095
|
...style,
|
|
3130
3096
|
width: size
|
|
3131
3097
|
};
|
|
3132
|
-
const replacement =
|
|
3098
|
+
const replacement = import_react12.default.cloneElement(target, { style: newStyle });
|
|
3133
3099
|
return swapChild(layoutRoot, target, replacement);
|
|
3134
3100
|
}
|
|
3135
3101
|
function resizeFlexChildren(layoutRoot, { path, sizes }) {
|
|
@@ -3137,7 +3103,7 @@ function resizeFlexChildren(layoutRoot, { path, sizes }) {
|
|
|
3137
3103
|
const { children, style } = getProps(target);
|
|
3138
3104
|
const dimension3 = style.flexDirection === "column" ? "height" : "width";
|
|
3139
3105
|
const replacementChildren = applySizesToChildren(children, sizes, dimension3);
|
|
3140
|
-
const replacement =
|
|
3106
|
+
const replacement = import_react12.default.cloneElement(
|
|
3141
3107
|
target,
|
|
3142
3108
|
void 0,
|
|
3143
3109
|
replacementChildren
|
|
@@ -3156,7 +3122,7 @@ function applySizesToChildren(children, sizes, dimension3) {
|
|
|
3156
3122
|
if (newSize === void 0 || size === newSize || actualFlexBasis === newSize) {
|
|
3157
3123
|
return child;
|
|
3158
3124
|
}
|
|
3159
|
-
return
|
|
3125
|
+
return import_react12.default.cloneElement(child, {
|
|
3160
3126
|
style: applySizeToChild(child.props.style, dimension3, newSize)
|
|
3161
3127
|
});
|
|
3162
3128
|
});
|
|
@@ -3175,7 +3141,7 @@ function applySizeToChild(style, dimension3, newSize) {
|
|
|
3175
3141
|
|
|
3176
3142
|
// src/layout-reducer/wrap-layout-element.ts
|
|
3177
3143
|
var import_vuu_utils6 = require("@vuu-ui/vuu-utils");
|
|
3178
|
-
var
|
|
3144
|
+
var import_react13 = __toESM(require("react"));
|
|
3179
3145
|
var isHtmlElement = (component) => {
|
|
3180
3146
|
const [firstLetter] = typeOf(component);
|
|
3181
3147
|
return firstLetter === firstLetter.toLowerCase();
|
|
@@ -3202,7 +3168,7 @@ function wrap(container, existingComponent, newComponent, pos, clientRect, dropR
|
|
|
3202
3168
|
dropRect
|
|
3203
3169
|
) : child
|
|
3204
3170
|
);
|
|
3205
|
-
return
|
|
3171
|
+
return import_react13.default.cloneElement(container, void 0, children);
|
|
3206
3172
|
}
|
|
3207
3173
|
function updateChildren2(container, containerChildren, existingComponent, newComponent, pos, clientRect, dropRect) {
|
|
3208
3174
|
const intrinsicSize = getIntrinsicSize(newComponent);
|
|
@@ -3262,7 +3228,7 @@ function wrapFlexComponent(container, containerChildren, existingComponent, newC
|
|
|
3262
3228
|
splitterSize: (_a = typeOf(container) === "Flexbox" && container.props.splitterSize) != null ? _a : void 0
|
|
3263
3229
|
} : void 0;
|
|
3264
3230
|
const id = (0, import_vuu_utils6.uuid)();
|
|
3265
|
-
const wrapper =
|
|
3231
|
+
const wrapper = import_react13.default.createElement(
|
|
3266
3232
|
ComponentRegistry[type],
|
|
3267
3233
|
{
|
|
3268
3234
|
active,
|
|
@@ -3283,12 +3249,12 @@ function wrapFlexComponent(container, containerChildren, existingComponent, newC
|
|
|
3283
3249
|
existingComponentProps
|
|
3284
3250
|
),
|
|
3285
3251
|
applyLayoutProps(
|
|
3286
|
-
|
|
3252
|
+
import_react13.default.cloneElement(newComponent, newComponentProps),
|
|
3287
3253
|
`${existingComponentPath}.1`
|
|
3288
3254
|
)
|
|
3289
3255
|
] : [
|
|
3290
3256
|
applyLayoutProps(
|
|
3291
|
-
|
|
3257
|
+
import_react13.default.cloneElement(newComponent, newComponentProps),
|
|
3292
3258
|
`${existingComponentPath}.0`
|
|
3293
3259
|
),
|
|
3294
3260
|
resetPath(
|
|
@@ -3417,21 +3383,21 @@ var layoutReducer = (state, action) => {
|
|
|
3417
3383
|
};
|
|
3418
3384
|
var switchTab = (state, { path, nextIdx }) => {
|
|
3419
3385
|
const target = followPath(state, path, true);
|
|
3420
|
-
const replacement =
|
|
3386
|
+
const replacement = import_react14.default.cloneElement(target, {
|
|
3421
3387
|
active: nextIdx
|
|
3422
3388
|
});
|
|
3423
3389
|
return swapChild(state, target, replacement);
|
|
3424
3390
|
};
|
|
3425
3391
|
var setProp = (state, { path, propName, propValue }) => {
|
|
3426
3392
|
const target = followPath(state, path, true);
|
|
3427
|
-
const replacement =
|
|
3393
|
+
const replacement = import_react14.default.cloneElement(target, {
|
|
3428
3394
|
[propName]: propValue
|
|
3429
3395
|
});
|
|
3430
3396
|
return swapChild(state, target, replacement);
|
|
3431
3397
|
};
|
|
3432
3398
|
var setProps = (state, { path, props }) => {
|
|
3433
3399
|
const target = followPath(state, path, true);
|
|
3434
|
-
const replacement =
|
|
3400
|
+
const replacement = import_react14.default.cloneElement(target, props);
|
|
3435
3401
|
return swapChild(state, target, replacement);
|
|
3436
3402
|
};
|
|
3437
3403
|
var setChildProps = (state, { path, type }) => {
|
|
@@ -3562,17 +3528,17 @@ var isTerrace = (container) => {
|
|
|
3562
3528
|
};
|
|
3563
3529
|
|
|
3564
3530
|
// src/layout-provider/LayoutProviderContext.ts
|
|
3565
|
-
var
|
|
3531
|
+
var import_react15 = require("react");
|
|
3566
3532
|
var unconfiguredLayoutProviderDispatch = (action) => console.log(
|
|
3567
3533
|
`dispatch ${action.type}, have you forgotten to provide a LayoutProvider ?`
|
|
3568
3534
|
);
|
|
3569
|
-
var LayoutProviderContext = (0,
|
|
3535
|
+
var LayoutProviderContext = (0, import_react15.createContext)({
|
|
3570
3536
|
dispatchLayoutProvider: unconfiguredLayoutProviderDispatch,
|
|
3571
3537
|
version: -1
|
|
3572
3538
|
});
|
|
3573
3539
|
|
|
3574
3540
|
// src/layout-provider/useLayoutDragDrop.ts
|
|
3575
|
-
var
|
|
3541
|
+
var import_react16 = require("react");
|
|
3576
3542
|
var NO_INSTRUCTIONS = {};
|
|
3577
3543
|
var NO_OFFSETS = [0, 0];
|
|
3578
3544
|
var getDragElement = (rect2, id, dragElement) => {
|
|
@@ -3601,10 +3567,10 @@ var determineDragOffsets = (draggedElement) => {
|
|
|
3601
3567
|
}
|
|
3602
3568
|
};
|
|
3603
3569
|
var useLayoutDragDrop = (rootLayoutRef, dispatch, pathToDropTarget) => {
|
|
3604
|
-
const dragActionRef = (0,
|
|
3605
|
-
const dragOperationRef = (0,
|
|
3606
|
-
const draggableHTMLElementRef = (0,
|
|
3607
|
-
const handleDrag = (0,
|
|
3570
|
+
const dragActionRef = (0, import_react16.useRef)();
|
|
3571
|
+
const dragOperationRef = (0, import_react16.useRef)();
|
|
3572
|
+
const draggableHTMLElementRef = (0, import_react16.useRef)();
|
|
3573
|
+
const handleDrag = (0, import_react16.useCallback)((x, y) => {
|
|
3608
3574
|
if (dragOperationRef.current && draggableHTMLElementRef.current) {
|
|
3609
3575
|
const {
|
|
3610
3576
|
dragOffsets: [offsetX, offsetY],
|
|
@@ -3620,7 +3586,7 @@ var useLayoutDragDrop = (rootLayoutRef, dispatch, pathToDropTarget) => {
|
|
|
3620
3586
|
}
|
|
3621
3587
|
}
|
|
3622
3588
|
}, []);
|
|
3623
|
-
const handleDrop = (0,
|
|
3589
|
+
const handleDrop = (0, import_react16.useCallback)(
|
|
3624
3590
|
(dropTarget) => {
|
|
3625
3591
|
if (dragOperationRef.current) {
|
|
3626
3592
|
const {
|
|
@@ -3654,7 +3620,7 @@ var useLayoutDragDrop = (rootLayoutRef, dispatch, pathToDropTarget) => {
|
|
|
3654
3620
|
},
|
|
3655
3621
|
[dispatch]
|
|
3656
3622
|
);
|
|
3657
|
-
const handleDragStart = (0,
|
|
3623
|
+
const handleDragStart = (0, import_react16.useCallback)(
|
|
3658
3624
|
(evt) => {
|
|
3659
3625
|
if (dragActionRef.current) {
|
|
3660
3626
|
const {
|
|
@@ -3717,7 +3683,7 @@ var useLayoutDragDrop = (rootLayoutRef, dispatch, pathToDropTarget) => {
|
|
|
3717
3683
|
},
|
|
3718
3684
|
[handleDrag, handleDrop, rootLayoutRef]
|
|
3719
3685
|
);
|
|
3720
|
-
const prepareToDrag = (0,
|
|
3686
|
+
const prepareToDrag = (0, import_react16.useCallback)(
|
|
3721
3687
|
(action) => {
|
|
3722
3688
|
const { evt, ...options } = action;
|
|
3723
3689
|
dragActionRef.current = {
|
|
@@ -3769,10 +3735,10 @@ var LayoutProviderVersion = () => {
|
|
|
3769
3735
|
};
|
|
3770
3736
|
var LayoutProvider = (props) => {
|
|
3771
3737
|
const { children, createNewChild, pathToDropTarget, layout, onLayoutChange } = props;
|
|
3772
|
-
const state = (0,
|
|
3773
|
-
const childrenRef = (0,
|
|
3774
|
-
const [, forceRefresh] = (0,
|
|
3775
|
-
const serializeState = (0,
|
|
3738
|
+
const state = (0, import_react17.useRef)(void 0);
|
|
3739
|
+
const childrenRef = (0, import_react17.useRef)(children);
|
|
3740
|
+
const [, forceRefresh] = (0, import_react17.useState)(null);
|
|
3741
|
+
const serializeState = (0, import_react17.useCallback)(
|
|
3776
3742
|
(source, layoutChangeReason) => {
|
|
3777
3743
|
if (onLayoutChange) {
|
|
3778
3744
|
const targetContainer = findTarget(source, withDropTarget) || state.current;
|
|
@@ -3784,7 +3750,7 @@ var LayoutProvider = (props) => {
|
|
|
3784
3750
|
},
|
|
3785
3751
|
[onLayoutChange]
|
|
3786
3752
|
);
|
|
3787
|
-
const dispatchLayoutAction = (0,
|
|
3753
|
+
const dispatchLayoutAction = (0, import_react17.useCallback)(
|
|
3788
3754
|
(action, suppressSave = false) => {
|
|
3789
3755
|
const nextState = layoutReducer(state.current, action);
|
|
3790
3756
|
if (nextState !== state.current) {
|
|
@@ -3797,7 +3763,7 @@ var LayoutProvider = (props) => {
|
|
|
3797
3763
|
},
|
|
3798
3764
|
[forceRefresh, serializeState]
|
|
3799
3765
|
);
|
|
3800
|
-
const layoutActionDispatcher = (0,
|
|
3766
|
+
const layoutActionDispatcher = (0, import_react17.useCallback)(
|
|
3801
3767
|
(action) => {
|
|
3802
3768
|
switch (action.type) {
|
|
3803
3769
|
case "drag-start": {
|
|
@@ -3827,7 +3793,7 @@ var LayoutProvider = (props) => {
|
|
|
3827
3793
|
layoutActionDispatcher,
|
|
3828
3794
|
pathToDropTarget
|
|
3829
3795
|
);
|
|
3830
|
-
(0,
|
|
3796
|
+
(0, import_react17.useEffect)(() => {
|
|
3831
3797
|
if (layout) {
|
|
3832
3798
|
const targetContainer = findTarget(
|
|
3833
3799
|
state.current,
|
|
@@ -3879,15 +3845,15 @@ var LayoutProvider = (props) => {
|
|
|
3879
3845
|
);
|
|
3880
3846
|
};
|
|
3881
3847
|
var useLayoutProviderDispatch = () => {
|
|
3882
|
-
const { dispatchLayoutProvider } = (0,
|
|
3848
|
+
const { dispatchLayoutProvider } = (0, import_react17.useContext)(LayoutProviderContext);
|
|
3883
3849
|
return dispatchLayoutProvider;
|
|
3884
3850
|
};
|
|
3885
3851
|
var useLayoutCreateNewChild = () => {
|
|
3886
|
-
const { createNewChild } = (0,
|
|
3852
|
+
const { createNewChild } = (0, import_react17.useContext)(LayoutProviderContext);
|
|
3887
3853
|
return createNewChild;
|
|
3888
3854
|
};
|
|
3889
3855
|
var useLayoutProviderVersion = () => {
|
|
3890
|
-
const { version } = (0,
|
|
3856
|
+
const { version } = (0, import_react17.useContext)(LayoutProviderContext);
|
|
3891
3857
|
return version;
|
|
3892
3858
|
};
|
|
3893
3859
|
|
|
@@ -3895,11 +3861,11 @@ var useLayoutProviderVersion = () => {
|
|
|
3895
3861
|
var useViewActionDispatcher = (id, root, viewPath, dropTargets) => {
|
|
3896
3862
|
var _a;
|
|
3897
3863
|
const { loadSessionState, purgeSessionState, purgeState, saveSessionState } = usePersistentState();
|
|
3898
|
-
const [contributions, setContributions] = (0,
|
|
3864
|
+
const [contributions, setContributions] = (0, import_react18.useState)(
|
|
3899
3865
|
(_a = loadSessionState(id, "contributions")) != null ? _a : []
|
|
3900
3866
|
);
|
|
3901
3867
|
const dispatchLayoutAction = useLayoutProviderDispatch();
|
|
3902
|
-
const updateContributions = (0,
|
|
3868
|
+
const updateContributions = (0, import_react18.useCallback)(
|
|
3903
3869
|
(location, content) => {
|
|
3904
3870
|
const updatedContributions = contributions.concat([
|
|
3905
3871
|
{ location, content }
|
|
@@ -3909,11 +3875,11 @@ var useViewActionDispatcher = (id, root, viewPath, dropTargets) => {
|
|
|
3909
3875
|
},
|
|
3910
3876
|
[contributions, id, saveSessionState]
|
|
3911
3877
|
);
|
|
3912
|
-
const clearContributions = (0,
|
|
3878
|
+
const clearContributions = (0, import_react18.useCallback)(() => {
|
|
3913
3879
|
purgeSessionState(id, "contributions");
|
|
3914
3880
|
setContributions([]);
|
|
3915
3881
|
}, [id, purgeSessionState]);
|
|
3916
|
-
const handleRemove = (0,
|
|
3882
|
+
const handleRemove = (0, import_react18.useCallback)(() => {
|
|
3917
3883
|
const ds = loadSessionState(id, "data-source");
|
|
3918
3884
|
if (ds) {
|
|
3919
3885
|
ds.unsubscribe();
|
|
@@ -3929,7 +3895,7 @@ var useViewActionDispatcher = (id, root, viewPath, dropTargets) => {
|
|
|
3929
3895
|
purgeState,
|
|
3930
3896
|
viewPath
|
|
3931
3897
|
]);
|
|
3932
|
-
const handleMouseDown = (0,
|
|
3898
|
+
const handleMouseDown = (0, import_react18.useCallback)(
|
|
3933
3899
|
async (evt, index, preDragActivity) => {
|
|
3934
3900
|
var _a2;
|
|
3935
3901
|
evt.stopPropagation();
|
|
@@ -3949,7 +3915,7 @@ var useViewActionDispatcher = (id, root, viewPath, dropTargets) => {
|
|
|
3949
3915
|
},
|
|
3950
3916
|
[root, dispatchLayoutAction, viewPath, dropTargets]
|
|
3951
3917
|
);
|
|
3952
|
-
const dispatchAction = (0,
|
|
3918
|
+
const dispatchAction = (0, import_react18.useCallback)(
|
|
3953
3919
|
async (action, evt) => {
|
|
3954
3920
|
var _a2;
|
|
3955
3921
|
const { type } = action;
|
|
@@ -3994,13 +3960,13 @@ var useViewActionDispatcher = (id, root, viewPath, dropTargets) => {
|
|
|
3994
3960
|
var import_vuu_utils7 = require("@vuu-ui/vuu-utils");
|
|
3995
3961
|
var import_core3 = require("@salt-ds/core");
|
|
3996
3962
|
var import_clsx6 = __toESM(require("clsx"));
|
|
3997
|
-
var
|
|
3963
|
+
var import_react25 = __toESM(require("react"));
|
|
3998
3964
|
|
|
3999
3965
|
// src/layout-header/Header.tsx
|
|
4000
3966
|
var import_vuu_ui_controls = require("@vuu-ui/vuu-ui-controls");
|
|
4001
3967
|
var import_core2 = require("@salt-ds/core");
|
|
4002
3968
|
var import_clsx5 = __toESM(require("clsx"));
|
|
4003
|
-
var
|
|
3969
|
+
var import_react19 = require("react");
|
|
4004
3970
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
4005
3971
|
var classBase3 = "vuuHeader";
|
|
4006
3972
|
var Header = ({
|
|
@@ -4013,9 +3979,9 @@ var Header = ({
|
|
|
4013
3979
|
style,
|
|
4014
3980
|
title = "Untitled"
|
|
4015
3981
|
}) => {
|
|
4016
|
-
const labelFieldRef = (0,
|
|
4017
|
-
const [value, setValue] = (0,
|
|
4018
|
-
const [editing, setEditing] = (0,
|
|
3982
|
+
const labelFieldRef = (0, import_react19.useRef)(null);
|
|
3983
|
+
const [value, setValue] = (0, import_react19.useState)(title);
|
|
3984
|
+
const [editing, setEditing] = (0, import_react19.useState)(false);
|
|
4019
3985
|
const viewDispatch = useViewDispatch();
|
|
4020
3986
|
const handleClose = (evt) => viewDispatch == null ? void 0 : viewDispatch({ type: "remove" }, evt);
|
|
4021
3987
|
const handleTitleMouseDown = () => {
|
|
@@ -4061,11 +4027,11 @@ var Header = ({
|
|
|
4061
4027
|
contributions == null ? void 0 : contributions.forEach((contribution, i) => {
|
|
4062
4028
|
switch (contribution.location) {
|
|
4063
4029
|
case "pre-title":
|
|
4064
|
-
toolbarItems.push((0,
|
|
4030
|
+
toolbarItems.push((0, import_react19.cloneElement)(contribution.content, { key: i }));
|
|
4065
4031
|
break;
|
|
4066
4032
|
default:
|
|
4067
4033
|
postTitleContributedItems.push(
|
|
4068
|
-
(0,
|
|
4034
|
+
(0, import_react19.cloneElement)(contribution.content, { key: i })
|
|
4069
4035
|
);
|
|
4070
4036
|
}
|
|
4071
4037
|
});
|
|
@@ -4117,7 +4083,7 @@ var Header = ({
|
|
|
4117
4083
|
};
|
|
4118
4084
|
|
|
4119
4085
|
// src/layout-view/useView.tsx
|
|
4120
|
-
var
|
|
4086
|
+
var import_react20 = require("react");
|
|
4121
4087
|
var useView = ({
|
|
4122
4088
|
id,
|
|
4123
4089
|
rootRef,
|
|
@@ -4139,14 +4105,14 @@ var useView = ({
|
|
|
4139
4105
|
path,
|
|
4140
4106
|
dropTargets
|
|
4141
4107
|
);
|
|
4142
|
-
const title = (0,
|
|
4108
|
+
const title = (0, import_react20.useMemo)(
|
|
4143
4109
|
() => {
|
|
4144
4110
|
var _a;
|
|
4145
4111
|
return (_a = loadState("view-title")) != null ? _a : titleProp;
|
|
4146
4112
|
},
|
|
4147
4113
|
[loadState, titleProp]
|
|
4148
4114
|
);
|
|
4149
|
-
const onEditTitle = (0,
|
|
4115
|
+
const onEditTitle = (0, import_react20.useCallback)(
|
|
4150
4116
|
(title2) => {
|
|
4151
4117
|
if (path) {
|
|
4152
4118
|
layoutDispatch({ type: "set-title", path, title: title2 });
|
|
@@ -4154,34 +4120,34 @@ var useView = ({
|
|
|
4154
4120
|
},
|
|
4155
4121
|
[layoutDispatch, path]
|
|
4156
4122
|
);
|
|
4157
|
-
const restoredState = (0,
|
|
4158
|
-
const load = (0,
|
|
4123
|
+
const restoredState = (0, import_react20.useMemo)(() => loadState(id), [id, loadState]);
|
|
4124
|
+
const load = (0, import_react20.useCallback)(
|
|
4159
4125
|
(key) => loadState(id, key),
|
|
4160
4126
|
[id, loadState]
|
|
4161
4127
|
);
|
|
4162
|
-
const purge = (0,
|
|
4128
|
+
const purge = (0, import_react20.useCallback)(
|
|
4163
4129
|
(key) => {
|
|
4164
4130
|
purgeState(id, key);
|
|
4165
4131
|
layoutDispatch({ type: "save" });
|
|
4166
4132
|
},
|
|
4167
4133
|
[id, layoutDispatch, purgeState]
|
|
4168
4134
|
);
|
|
4169
|
-
const save = (0,
|
|
4135
|
+
const save = (0, import_react20.useCallback)(
|
|
4170
4136
|
(state, key) => {
|
|
4171
4137
|
saveState(id, key, state);
|
|
4172
4138
|
layoutDispatch({ type: "save" });
|
|
4173
4139
|
},
|
|
4174
4140
|
[id, layoutDispatch, saveState]
|
|
4175
4141
|
);
|
|
4176
|
-
const loadSession = (0,
|
|
4142
|
+
const loadSession = (0, import_react20.useCallback)(
|
|
4177
4143
|
(key) => loadSessionState(id, key),
|
|
4178
4144
|
[id, loadSessionState]
|
|
4179
4145
|
);
|
|
4180
|
-
const saveSession = (0,
|
|
4146
|
+
const saveSession = (0, import_react20.useCallback)(
|
|
4181
4147
|
(state, key) => saveSessionState(id, key, state),
|
|
4182
4148
|
[id, saveSessionState]
|
|
4183
4149
|
);
|
|
4184
|
-
const onConfigChange = (0,
|
|
4150
|
+
const onConfigChange = (0, import_react20.useCallback)(
|
|
4185
4151
|
({ type: key, ...config }) => {
|
|
4186
4152
|
const { [key]: data } = config;
|
|
4187
4153
|
save(data, key);
|
|
@@ -4204,10 +4170,10 @@ var useView = ({
|
|
|
4204
4170
|
};
|
|
4205
4171
|
|
|
4206
4172
|
// src/responsive/use-breakpoints.ts
|
|
4207
|
-
var
|
|
4173
|
+
var import_react22 = require("react");
|
|
4208
4174
|
|
|
4209
4175
|
// src/responsive/useResizeObserver.ts
|
|
4210
|
-
var
|
|
4176
|
+
var import_react21 = require("react");
|
|
4211
4177
|
var WidthHeight = ["height", "width"];
|
|
4212
4178
|
var HeightOnly = ["height"];
|
|
4213
4179
|
var WidthOnly = ["width"];
|
|
@@ -4253,8 +4219,8 @@ var resizeObserver = new ResizeObserver(
|
|
|
4253
4219
|
}
|
|
4254
4220
|
);
|
|
4255
4221
|
function useResizeObserver(ref, dimensions, onResize, reportInitialSize = false) {
|
|
4256
|
-
const dimensionsRef = (0,
|
|
4257
|
-
const measure = (0,
|
|
4222
|
+
const dimensionsRef = (0, import_react21.useRef)(dimensions);
|
|
4223
|
+
const measure = (0, import_react21.useCallback)((target) => {
|
|
4258
4224
|
const rect2 = target.getBoundingClientRect();
|
|
4259
4225
|
return dimensionsRef.current.reduce(
|
|
4260
4226
|
(map, dim) => {
|
|
@@ -4264,7 +4230,7 @@ function useResizeObserver(ref, dimensions, onResize, reportInitialSize = false)
|
|
|
4264
4230
|
{}
|
|
4265
4231
|
);
|
|
4266
4232
|
}, []);
|
|
4267
|
-
(0,
|
|
4233
|
+
(0, import_react21.useLayoutEffect)(() => {
|
|
4268
4234
|
const target = ref.current;
|
|
4269
4235
|
let cleanedUp = false;
|
|
4270
4236
|
async function registerObserver() {
|
|
@@ -4302,7 +4268,7 @@ function useResizeObserver(ref, dimensions, onResize, reportInitialSize = false)
|
|
|
4302
4268
|
}
|
|
4303
4269
|
};
|
|
4304
4270
|
}, [ref, measure, reportInitialSize, onResize]);
|
|
4305
|
-
(0,
|
|
4271
|
+
(0, import_react21.useLayoutEffect)(() => {
|
|
4306
4272
|
const target = ref.current;
|
|
4307
4273
|
const record = observedMap.get(target);
|
|
4308
4274
|
if (record) {
|
|
@@ -4349,17 +4315,17 @@ var getBreakPoints = (themeName) => {
|
|
|
4349
4315
|
};
|
|
4350
4316
|
|
|
4351
4317
|
// src/responsive/use-breakpoints.ts
|
|
4352
|
-
var
|
|
4318
|
+
var EMPTY_ARRAY = [];
|
|
4353
4319
|
var useBreakpoints = ({ breakPoints: breakPointsProp, smallerThan }, ref) => {
|
|
4354
|
-
const [breakpointMatch, setBreakpointmatch] = (0,
|
|
4320
|
+
const [breakpointMatch, setBreakpointmatch] = (0, import_react22.useState)(
|
|
4355
4321
|
smallerThan ? false : "lg"
|
|
4356
4322
|
);
|
|
4357
|
-
const bodyRef = (0,
|
|
4358
|
-
const breakPointsRef = (0,
|
|
4323
|
+
const bodyRef = (0, import_react22.useRef)(document.body);
|
|
4324
|
+
const breakPointsRef = (0, import_react22.useRef)(
|
|
4359
4325
|
breakPointsProp ? breakpointRamp(breakPointsProp) : getBreakPoints()
|
|
4360
4326
|
);
|
|
4361
|
-
const sizeRef = (0,
|
|
4362
|
-
const stopFromMinWidth = (0,
|
|
4327
|
+
const sizeRef = (0, import_react22.useRef)("lg");
|
|
4328
|
+
const stopFromMinWidth = (0, import_react22.useCallback)(
|
|
4363
4329
|
(w) => {
|
|
4364
4330
|
if (breakPointsRef.current) {
|
|
4365
4331
|
for (const [name, size] of breakPointsRef.current) {
|
|
@@ -4371,7 +4337,7 @@ var useBreakpoints = ({ breakPoints: breakPointsProp, smallerThan }, ref) => {
|
|
|
4371
4337
|
},
|
|
4372
4338
|
[breakPointsRef]
|
|
4373
4339
|
);
|
|
4374
|
-
const matchSizeAgainstBreakpoints = (0,
|
|
4340
|
+
const matchSizeAgainstBreakpoints = (0, import_react22.useCallback)(
|
|
4375
4341
|
(width) => {
|
|
4376
4342
|
if (smallerThan) {
|
|
4377
4343
|
const breakPointRamp = breakPointsRef.current.find(
|
|
@@ -4390,7 +4356,7 @@ var useBreakpoints = ({ breakPoints: breakPointsProp, smallerThan }, ref) => {
|
|
|
4390
4356
|
);
|
|
4391
4357
|
useResizeObserver(
|
|
4392
4358
|
ref || bodyRef,
|
|
4393
|
-
breakPointsRef.current ? ["width"] :
|
|
4359
|
+
breakPointsRef.current ? ["width"] : EMPTY_ARRAY,
|
|
4394
4360
|
({ width: measuredWidth }) => {
|
|
4395
4361
|
const result = matchSizeAgainstBreakpoints(measuredWidth);
|
|
4396
4362
|
if (result !== sizeRef.current) {
|
|
@@ -4400,7 +4366,7 @@ var useBreakpoints = ({ breakPoints: breakPointsProp, smallerThan }, ref) => {
|
|
|
4400
4366
|
},
|
|
4401
4367
|
true
|
|
4402
4368
|
);
|
|
4403
|
-
(0,
|
|
4369
|
+
(0, import_react22.useEffect)(() => {
|
|
4404
4370
|
const target = ref || bodyRef;
|
|
4405
4371
|
if (target.current) {
|
|
4406
4372
|
const prevSize = sizeRef.current;
|
|
@@ -4454,7 +4420,7 @@ var extractResponsiveProps = (props) => {
|
|
|
4454
4420
|
};
|
|
4455
4421
|
|
|
4456
4422
|
// src/layout-view/useViewResize.ts
|
|
4457
|
-
var
|
|
4423
|
+
var import_react23 = require("react");
|
|
4458
4424
|
var NO_MEASUREMENT = [];
|
|
4459
4425
|
var useViewResize = ({
|
|
4460
4426
|
mainRef,
|
|
@@ -4462,16 +4428,16 @@ var useViewResize = ({
|
|
|
4462
4428
|
rootRef
|
|
4463
4429
|
}) => {
|
|
4464
4430
|
const deferResize = resize === "defer";
|
|
4465
|
-
const mainSize = (0,
|
|
4466
|
-
const resizeHandle = (0,
|
|
4467
|
-
const setMainSize = (0,
|
|
4431
|
+
const mainSize = (0, import_react23.useRef)({});
|
|
4432
|
+
const resizeHandle = (0, import_react23.useRef)();
|
|
4433
|
+
const setMainSize = (0, import_react23.useCallback)(() => {
|
|
4468
4434
|
if (mainRef.current) {
|
|
4469
4435
|
mainRef.current.style.height = mainSize.current.height + "px";
|
|
4470
4436
|
mainRef.current.style.width = mainSize.current.width + "px";
|
|
4471
4437
|
}
|
|
4472
4438
|
resizeHandle.current = void 0;
|
|
4473
4439
|
}, [mainRef]);
|
|
4474
|
-
const onResize = (0,
|
|
4440
|
+
const onResize = (0, import_react23.useCallback)(
|
|
4475
4441
|
({ height, width }) => {
|
|
4476
4442
|
mainSize.current.height = height;
|
|
4477
4443
|
mainSize.current.width = width;
|
|
@@ -4491,15 +4457,15 @@ var useViewResize = ({
|
|
|
4491
4457
|
};
|
|
4492
4458
|
|
|
4493
4459
|
// src/layout-view/ViewContext.ts
|
|
4494
|
-
var
|
|
4460
|
+
var import_react24 = __toESM(require("react"));
|
|
4495
4461
|
var NO_CONTEXT = { dispatch: null };
|
|
4496
|
-
var ViewContext =
|
|
4462
|
+
var ViewContext = import_react24.default.createContext(NO_CONTEXT);
|
|
4497
4463
|
var useViewDispatch = () => {
|
|
4498
4464
|
var _a;
|
|
4499
|
-
const context = (0,
|
|
4465
|
+
const context = (0, import_react24.useContext)(ViewContext);
|
|
4500
4466
|
return (_a = context == null ? void 0 : context.dispatch) != null ? _a : null;
|
|
4501
4467
|
};
|
|
4502
|
-
var useViewContext = () => (0,
|
|
4468
|
+
var useViewContext = () => (0, import_react24.useContext)(ViewContext);
|
|
4503
4469
|
|
|
4504
4470
|
// src/layout-view/View.tsx
|
|
4505
4471
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
@@ -4513,7 +4479,7 @@ var getProps2 = (state, props) => {
|
|
|
4513
4479
|
} else
|
|
4514
4480
|
return state || props;
|
|
4515
4481
|
};
|
|
4516
|
-
var View = (0,
|
|
4482
|
+
var View = (0, import_react25.forwardRef)(function View2(props, forwardedRef) {
|
|
4517
4483
|
const {
|
|
4518
4484
|
Header: Header2 = Header,
|
|
4519
4485
|
children,
|
|
@@ -4537,9 +4503,9 @@ var View = (0, import_react26.forwardRef)(function View2(props, forwardedRef) {
|
|
|
4537
4503
|
...restProps
|
|
4538
4504
|
} = props;
|
|
4539
4505
|
const id = (0, import_vuu_utils7.useId)(idProp);
|
|
4540
|
-
const rootRef = (0,
|
|
4541
|
-
const mainRef = (0,
|
|
4542
|
-
const [componentProps, _setComponentProps] = (0,
|
|
4506
|
+
const rootRef = (0, import_react25.useRef)(null);
|
|
4507
|
+
const mainRef = (0, import_react25.useRef)(null);
|
|
4508
|
+
const [componentProps, _setComponentProps] = (0, import_react25.useState)();
|
|
4543
4509
|
const {
|
|
4544
4510
|
contributions,
|
|
4545
4511
|
dispatchViewAction,
|
|
@@ -4560,19 +4526,19 @@ var View = (0, import_react26.forwardRef)(function View2(props, forwardedRef) {
|
|
|
4560
4526
|
title: titleProp
|
|
4561
4527
|
});
|
|
4562
4528
|
useViewResize({ mainRef, resize, rootRef });
|
|
4563
|
-
const setComponentProps = (0,
|
|
4529
|
+
const setComponentProps = (0, import_react25.useCallback)((props2) => {
|
|
4564
4530
|
_setComponentProps(props2);
|
|
4565
4531
|
}, []);
|
|
4566
4532
|
const getContent = () => {
|
|
4567
|
-
if (
|
|
4568
|
-
return
|
|
4533
|
+
if (import_react25.default.isValidElement(children) && (restoredState || componentProps)) {
|
|
4534
|
+
return import_react25.default.cloneElement(
|
|
4569
4535
|
children,
|
|
4570
4536
|
getProps2(restoredState, componentProps)
|
|
4571
4537
|
);
|
|
4572
4538
|
}
|
|
4573
4539
|
return children;
|
|
4574
4540
|
};
|
|
4575
|
-
const viewContextValue = (0,
|
|
4541
|
+
const viewContextValue = (0, import_react25.useMemo)(
|
|
4576
4542
|
() => ({
|
|
4577
4543
|
dispatch: dispatchViewAction,
|
|
4578
4544
|
id,
|
|
@@ -4636,7 +4602,7 @@ var View = (0, import_react26.forwardRef)(function View2(props, forwardedRef) {
|
|
|
4636
4602
|
);
|
|
4637
4603
|
});
|
|
4638
4604
|
View.displayName = "View";
|
|
4639
|
-
var MemoView =
|
|
4605
|
+
var MemoView = import_react25.default.memo(View);
|
|
4640
4606
|
MemoView.displayName = "View";
|
|
4641
4607
|
registerComponent("View", MemoView, "view");
|
|
4642
4608
|
|
|
@@ -4645,8 +4611,8 @@ var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
|
4645
4611
|
var classBase5 = "vuuLayoutStartPanel";
|
|
4646
4612
|
var LayoutStartPanel = (htmlAttributes) => {
|
|
4647
4613
|
const { dispatch, path } = useViewContext();
|
|
4648
|
-
const [displayState, setDisplayState] = (0,
|
|
4649
|
-
(0,
|
|
4614
|
+
const [displayState, setDisplayState] = (0, import_react26.useState)();
|
|
4615
|
+
(0, import_react26.useMemo)(() => {
|
|
4650
4616
|
dispatch == null ? void 0 : dispatch({
|
|
4651
4617
|
type: "query",
|
|
4652
4618
|
path,
|
|
@@ -4698,10 +4664,10 @@ registerComponent("Placeholder", Placeholder);
|
|
|
4698
4664
|
|
|
4699
4665
|
// src/flexbox/Splitter.tsx
|
|
4700
4666
|
var import_clsx8 = __toESM(require("clsx"));
|
|
4701
|
-
var
|
|
4667
|
+
var import_react27 = __toESM(require("react"));
|
|
4702
4668
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
4703
4669
|
var classBase7 = "vuuSplitter";
|
|
4704
|
-
var Splitter =
|
|
4670
|
+
var Splitter = import_react27.default.memo(function Splitter2({
|
|
4705
4671
|
column,
|
|
4706
4672
|
index,
|
|
4707
4673
|
onDrag,
|
|
@@ -4709,11 +4675,11 @@ var Splitter = import_react28.default.memo(function Splitter2({
|
|
|
4709
4675
|
onDragStart,
|
|
4710
4676
|
style
|
|
4711
4677
|
}) {
|
|
4712
|
-
const ignoreClick = (0,
|
|
4713
|
-
const rootRef = (0,
|
|
4714
|
-
const lastPos = (0,
|
|
4715
|
-
const [active, setActive] = (0,
|
|
4716
|
-
const handleKeyDownDrag = (0,
|
|
4678
|
+
const ignoreClick = (0, import_react27.useRef)();
|
|
4679
|
+
const rootRef = (0, import_react27.useRef)(null);
|
|
4680
|
+
const lastPos = (0, import_react27.useRef)(0);
|
|
4681
|
+
const [active, setActive] = (0, import_react27.useState)(false);
|
|
4682
|
+
const handleKeyDownDrag = (0, import_react27.useCallback)(
|
|
4717
4683
|
({ key, shiftKey }) => {
|
|
4718
4684
|
const distance = shiftKey ? 10 : 1;
|
|
4719
4685
|
if (column && key === "ArrowDown") {
|
|
@@ -4728,7 +4694,7 @@ var Splitter = import_react28.default.memo(function Splitter2({
|
|
|
4728
4694
|
},
|
|
4729
4695
|
[column, index, onDrag]
|
|
4730
4696
|
);
|
|
4731
|
-
const handleKeyDownInitDrag = (0,
|
|
4697
|
+
const handleKeyDownInitDrag = (0, import_react27.useCallback)(
|
|
4732
4698
|
(evt) => {
|
|
4733
4699
|
const { key } = evt;
|
|
4734
4700
|
const horizontalMove = key === "ArrowLeft" || key === "ArrowRight";
|
|
@@ -4741,9 +4707,9 @@ var Splitter = import_react28.default.memo(function Splitter2({
|
|
|
4741
4707
|
},
|
|
4742
4708
|
[column, handleKeyDownDrag, index, onDragStart]
|
|
4743
4709
|
);
|
|
4744
|
-
const keyDownHandlerRef = (0,
|
|
4710
|
+
const keyDownHandlerRef = (0, import_react27.useRef)(handleKeyDownInitDrag);
|
|
4745
4711
|
const handleKeyDown = (evt) => keyDownHandlerRef.current(evt);
|
|
4746
|
-
const handleMouseMove = (0,
|
|
4712
|
+
const handleMouseMove = (0, import_react27.useCallback)(
|
|
4747
4713
|
(e) => {
|
|
4748
4714
|
ignoreClick.current = true;
|
|
4749
4715
|
const pos = e[column ? "clientY" : "clientX"];
|
|
@@ -4755,7 +4721,7 @@ var Splitter = import_react28.default.memo(function Splitter2({
|
|
|
4755
4721
|
},
|
|
4756
4722
|
[column, index, onDrag]
|
|
4757
4723
|
);
|
|
4758
|
-
const handleMouseUp = (0,
|
|
4724
|
+
const handleMouseUp = (0, import_react27.useCallback)(() => {
|
|
4759
4725
|
var _a;
|
|
4760
4726
|
window.removeEventListener("mousemove", handleMouseMove, false);
|
|
4761
4727
|
window.removeEventListener("mouseup", handleMouseUp, false);
|
|
@@ -4763,7 +4729,7 @@ var Splitter = import_react28.default.memo(function Splitter2({
|
|
|
4763
4729
|
setActive(false);
|
|
4764
4730
|
(_a = rootRef.current) == null ? void 0 : _a.focus();
|
|
4765
4731
|
}, [handleMouseMove, onDragEnd2, setActive]);
|
|
4766
|
-
const handleMouseDown = (0,
|
|
4732
|
+
const handleMouseDown = (0, import_react27.useCallback)(
|
|
4767
4733
|
(e) => {
|
|
4768
4734
|
lastPos.current = column ? e.clientY : e.clientX;
|
|
4769
4735
|
onDragStart(index);
|
|
@@ -4913,22 +4879,22 @@ var useSplitterResizing = ({
|
|
|
4913
4879
|
onSplitterMoved,
|
|
4914
4880
|
style
|
|
4915
4881
|
}) => {
|
|
4916
|
-
const rootRef = (0,
|
|
4917
|
-
const metaRef = (0,
|
|
4918
|
-
const contentRef = (0,
|
|
4919
|
-
const assignedKeys = (0,
|
|
4920
|
-
const [, forceUpdate] = (0,
|
|
4882
|
+
const rootRef = (0, import_react28.useRef)(null);
|
|
4883
|
+
const metaRef = (0, import_react28.useRef)();
|
|
4884
|
+
const contentRef = (0, import_react28.useRef)();
|
|
4885
|
+
const assignedKeys = (0, import_react28.useRef)([]);
|
|
4886
|
+
const [, forceUpdate] = (0, import_react28.useState)({});
|
|
4921
4887
|
const setContent = (content) => {
|
|
4922
4888
|
contentRef.current = content;
|
|
4923
4889
|
forceUpdate({});
|
|
4924
4890
|
};
|
|
4925
4891
|
const isColumn = (style == null ? void 0 : style.flexDirection) === "column";
|
|
4926
4892
|
const dimension3 = isColumn ? "height" : "width";
|
|
4927
|
-
const children = (0,
|
|
4928
|
-
() => Array.isArray(childrenProp) ? childrenProp :
|
|
4893
|
+
const children = (0, import_react28.useMemo)(
|
|
4894
|
+
() => Array.isArray(childrenProp) ? childrenProp : import_react28.default.isValidElement(childrenProp) ? [childrenProp] : [],
|
|
4929
4895
|
[childrenProp]
|
|
4930
4896
|
);
|
|
4931
|
-
const handleDragStart = (0,
|
|
4897
|
+
const handleDragStart = (0, import_react28.useCallback)(
|
|
4932
4898
|
(index) => {
|
|
4933
4899
|
const { current: contentMeta } = metaRef;
|
|
4934
4900
|
if (contentMeta) {
|
|
@@ -4961,7 +4927,7 @@ var useSplitterResizing = ({
|
|
|
4961
4927
|
},
|
|
4962
4928
|
[dimension3]
|
|
4963
4929
|
);
|
|
4964
|
-
const handleDrag = (0,
|
|
4930
|
+
const handleDrag = (0, import_react28.useCallback)(
|
|
4965
4931
|
(idx, distance) => {
|
|
4966
4932
|
if (contentRef.current && metaRef.current) {
|
|
4967
4933
|
setContent(
|
|
@@ -4976,7 +4942,7 @@ var useSplitterResizing = ({
|
|
|
4976
4942
|
},
|
|
4977
4943
|
[dimension3]
|
|
4978
4944
|
);
|
|
4979
|
-
const handleDragEnd = (0,
|
|
4945
|
+
const handleDragEnd = (0, import_react28.useCallback)(() => {
|
|
4980
4946
|
const contentMeta = metaRef.current;
|
|
4981
4947
|
if (contentMeta) {
|
|
4982
4948
|
onSplitterMoved == null ? void 0 : onSplitterMoved(contentMeta.filter(originalContentOnly));
|
|
@@ -4987,9 +4953,9 @@ var useSplitterResizing = ({
|
|
|
4987
4953
|
meta.flexOpen = false;
|
|
4988
4954
|
});
|
|
4989
4955
|
}, [onSplitterMoved]);
|
|
4990
|
-
const createSplitter = (0,
|
|
4956
|
+
const createSplitter = (0, import_react28.useCallback)(
|
|
4991
4957
|
(i) => {
|
|
4992
|
-
return
|
|
4958
|
+
return import_react28.default.createElement(Splitter, {
|
|
4993
4959
|
column: isColumn,
|
|
4994
4960
|
index: i,
|
|
4995
4961
|
key: `splitter-${i}`,
|
|
@@ -5000,7 +4966,7 @@ var useSplitterResizing = ({
|
|
|
5000
4966
|
},
|
|
5001
4967
|
[handleDrag, handleDragEnd, handleDragStart, isColumn]
|
|
5002
4968
|
);
|
|
5003
|
-
(0,
|
|
4969
|
+
(0, import_react28.useMemo)(() => {
|
|
5004
4970
|
const [content, meta] = buildContent(
|
|
5005
4971
|
children,
|
|
5006
4972
|
dimension3,
|
|
@@ -5028,7 +4994,7 @@ function buildContent(children, dimension3, createSplitter, keys) {
|
|
|
5028
4994
|
}
|
|
5029
4995
|
if (child.key == null) {
|
|
5030
4996
|
const key = keys[i] || (keys[i] = (0, import_vuu_utils8.getUniqueId)());
|
|
5031
|
-
content.push(
|
|
4997
|
+
content.push(import_react28.default.cloneElement(child, { key }));
|
|
5032
4998
|
} else {
|
|
5033
4999
|
content.push(child);
|
|
5034
5000
|
}
|
|
@@ -5056,7 +5022,7 @@ function resizeContent(content, contentMeta, distance, dimension3) {
|
|
|
5056
5022
|
const { flexBasis: actualFlexBasis } = child.props.style || {};
|
|
5057
5023
|
const size = hasCurrentSize ? meta.currentSize : flexBasis;
|
|
5058
5024
|
if (size !== actualFlexBasis) {
|
|
5059
|
-
return
|
|
5025
|
+
return import_react28.default.cloneElement(child, {
|
|
5060
5026
|
style: {
|
|
5061
5027
|
...child.props.style,
|
|
5062
5028
|
flexBasis: size,
|
|
@@ -5095,7 +5061,7 @@ function updateMeta(contentMeta, distance) {
|
|
|
5095
5061
|
return true;
|
|
5096
5062
|
}
|
|
5097
5063
|
function createPlaceholder(index) {
|
|
5098
|
-
return
|
|
5064
|
+
return import_react28.default.createElement(Placeholder, {
|
|
5099
5065
|
shim: index === 0,
|
|
5100
5066
|
key: `placeholder-${index}`
|
|
5101
5067
|
});
|
|
@@ -5111,7 +5077,7 @@ function measureElement(el, dimension3) {
|
|
|
5111
5077
|
// src/flexbox/Flexbox.tsx
|
|
5112
5078
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
5113
5079
|
var classBase8 = "hwFlexbox";
|
|
5114
|
-
var Flexbox = (0,
|
|
5080
|
+
var Flexbox = (0, import_react29.forwardRef)(function Flexbox2(props, ref) {
|
|
5115
5081
|
const {
|
|
5116
5082
|
breakPoints: breakPoints2,
|
|
5117
5083
|
children,
|
|
@@ -5163,12 +5129,12 @@ Flexbox.displayName = "Flexbox";
|
|
|
5163
5129
|
var Flexbox_default = Flexbox;
|
|
5164
5130
|
|
|
5165
5131
|
// src/flexbox/FlexboxLayout.tsx
|
|
5166
|
-
var
|
|
5132
|
+
var import_react30 = require("react");
|
|
5167
5133
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
5168
5134
|
var FlexboxLayout = function FlexboxLayout2(props) {
|
|
5169
5135
|
const { path } = props;
|
|
5170
5136
|
const dispatch = useLayoutProviderDispatch();
|
|
5171
|
-
const handleSplitterMoved = (0,
|
|
5137
|
+
const handleSplitterMoved = (0, import_react30.useCallback)(
|
|
5172
5138
|
(sizes) => {
|
|
5173
5139
|
dispatch({
|
|
5174
5140
|
type: Action.SPLITTER_RESIZE,
|
|
@@ -5184,13 +5150,14 @@ FlexboxLayout.displayName = "Flexbox";
|
|
|
5184
5150
|
registerComponent("Flexbox", FlexboxLayout, "container");
|
|
5185
5151
|
|
|
5186
5152
|
// src/flexbox/FluidGrid.tsx
|
|
5153
|
+
var import_vuu_utils10 = require("@vuu-ui/vuu-utils");
|
|
5187
5154
|
var import_core6 = require("@salt-ds/core");
|
|
5188
5155
|
var import_clsx10 = __toESM(require("clsx"));
|
|
5189
|
-
var
|
|
5156
|
+
var import_react32 = require("react");
|
|
5190
5157
|
|
|
5191
5158
|
// src/flexbox/useResponsiveSizing.ts
|
|
5192
5159
|
var import_vuu_utils9 = require("@vuu-ui/vuu-utils");
|
|
5193
|
-
var
|
|
5160
|
+
var import_react31 = require("react");
|
|
5194
5161
|
var breakPoints = ["xs", "sm", "md", "lg", "xl"];
|
|
5195
5162
|
var DEFAULT_COLS = 12;
|
|
5196
5163
|
var useResponsiveSizing = ({
|
|
@@ -5198,17 +5165,17 @@ var useResponsiveSizing = ({
|
|
|
5198
5165
|
cols: colsProp,
|
|
5199
5166
|
style
|
|
5200
5167
|
}) => {
|
|
5201
|
-
const rootRef = (0,
|
|
5202
|
-
const metaRef = (0,
|
|
5203
|
-
const contentRef = (0,
|
|
5168
|
+
const rootRef = (0, import_react31.useRef)(null);
|
|
5169
|
+
const metaRef = (0, import_react31.useRef)(null);
|
|
5170
|
+
const contentRef = (0, import_react31.useRef)();
|
|
5204
5171
|
const cols = colsProp != null ? colsProp : DEFAULT_COLS;
|
|
5205
5172
|
const isColumn = (style == null ? void 0 : style.flexDirection) === "column";
|
|
5206
5173
|
const dimension3 = isColumn ? "height" : "width";
|
|
5207
|
-
const children = (0,
|
|
5208
|
-
() => Array.isArray(childrenProp) ? childrenProp : (0,
|
|
5174
|
+
const children = (0, import_react31.useMemo)(
|
|
5175
|
+
() => Array.isArray(childrenProp) ? childrenProp : (0, import_react31.isValidElement)(childrenProp) ? [childrenProp] : [],
|
|
5209
5176
|
[childrenProp]
|
|
5210
5177
|
);
|
|
5211
|
-
const buildContent2 = (0,
|
|
5178
|
+
const buildContent2 = (0, import_react31.useCallback)(
|
|
5212
5179
|
(children2, dimension4) => {
|
|
5213
5180
|
const childMeta = gatherChildMeta(children2, dimension4, breakPoints);
|
|
5214
5181
|
const content = [];
|
|
@@ -5219,7 +5186,7 @@ var useResponsiveSizing = ({
|
|
|
5219
5186
|
style: { flex, ...rest }
|
|
5220
5187
|
} = child.props;
|
|
5221
5188
|
content.push(
|
|
5222
|
-
(0,
|
|
5189
|
+
(0, import_react31.cloneElement)(child, {
|
|
5223
5190
|
key: (0, import_vuu_utils9.getUniqueId)(),
|
|
5224
5191
|
style: {
|
|
5225
5192
|
...rest,
|
|
@@ -5233,7 +5200,7 @@ var useResponsiveSizing = ({
|
|
|
5233
5200
|
},
|
|
5234
5201
|
[cols]
|
|
5235
5202
|
);
|
|
5236
|
-
(0,
|
|
5203
|
+
(0, import_react31.useMemo)(() => {
|
|
5237
5204
|
const [content, meta] = buildContent2(children, dimension3);
|
|
5238
5205
|
metaRef.current = meta;
|
|
5239
5206
|
contentRef.current = content;
|
|
@@ -5248,7 +5215,7 @@ var useResponsiveSizing = ({
|
|
|
5248
5215
|
// src/flexbox/FluidGrid.tsx
|
|
5249
5216
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
5250
5217
|
var classBase9 = "hwFluidGrid";
|
|
5251
|
-
var FluidGrid = (0,
|
|
5218
|
+
var FluidGrid = (0, import_react32.forwardRef)(function FluidGrid2(props, ref) {
|
|
5252
5219
|
const {
|
|
5253
5220
|
breakPoints: breakPoints2,
|
|
5254
5221
|
children: childrenProp,
|
|
@@ -5268,8 +5235,8 @@ var FluidGrid = (0, import_react33.forwardRef)(function FluidGrid2(props, ref) {
|
|
|
5268
5235
|
style: styleProp,
|
|
5269
5236
|
...rest
|
|
5270
5237
|
} = props;
|
|
5271
|
-
const children = (0,
|
|
5272
|
-
return asReactElements(childrenProp);
|
|
5238
|
+
const children = (0, import_react32.useMemo)(() => {
|
|
5239
|
+
return (0, import_vuu_utils10.asReactElements)(childrenProp);
|
|
5273
5240
|
}, [childrenProp]);
|
|
5274
5241
|
const { cols, content, rootRef } = useResponsiveSizing({
|
|
5275
5242
|
children,
|
|
@@ -5320,960 +5287,128 @@ var FluidGridLayout = function FluidGridLayout2(props) {
|
|
|
5320
5287
|
FluidGridLayout.displayName = "FluidGrid";
|
|
5321
5288
|
registerComponent("FluidGrid", FluidGridLayout, "container");
|
|
5322
5289
|
|
|
5323
|
-
// src/
|
|
5324
|
-
var
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
var
|
|
5328
|
-
var
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
switch (dimension3) {
|
|
5335
|
-
case "height":
|
|
5336
|
-
return size.height;
|
|
5337
|
-
case "clientHeight":
|
|
5338
|
-
return Math.floor(element.clientHeight);
|
|
5339
|
-
case "clientWidth":
|
|
5340
|
-
return Math.floor(element.clientWidth);
|
|
5341
|
-
case "contentHeight":
|
|
5342
|
-
return size.contentHeight;
|
|
5343
|
-
case "contentWidth":
|
|
5344
|
-
return size.contentWidth;
|
|
5345
|
-
case "scrollHeight":
|
|
5346
|
-
return Math.ceil(Math.floor(element.scrollHeight));
|
|
5347
|
-
case "scrollWidth":
|
|
5348
|
-
return Math.ceil(Math.floor(element.scrollWidth));
|
|
5349
|
-
case "width":
|
|
5350
|
-
return size.width;
|
|
5351
|
-
default:
|
|
5352
|
-
return 0;
|
|
5353
|
-
}
|
|
5290
|
+
// src/palette/Palette.tsx
|
|
5291
|
+
var import_vuu_utils11 = require("@vuu-ui/vuu-utils");
|
|
5292
|
+
var import_vuu_ui_controls2 = require("@vuu-ui/vuu-ui-controls");
|
|
5293
|
+
var import_clsx11 = __toESM(require("clsx"));
|
|
5294
|
+
var import_react33 = require("react");
|
|
5295
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
5296
|
+
var clonePaletteItem = (paletteItem) => {
|
|
5297
|
+
const dolly = paletteItem.cloneNode(true);
|
|
5298
|
+
dolly.id = "";
|
|
5299
|
+
delete dolly.dataset.idx;
|
|
5300
|
+
return dolly;
|
|
5354
5301
|
};
|
|
5355
|
-
var
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
measurements[dimension3] = newSize;
|
|
5373
|
-
}
|
|
5374
|
-
}
|
|
5375
|
-
if (sizeChanged) {
|
|
5376
|
-
onResize && onResize(measurements);
|
|
5302
|
+
var PaletteItem = (0, import_react33.memo)(
|
|
5303
|
+
({
|
|
5304
|
+
className,
|
|
5305
|
+
children: component,
|
|
5306
|
+
idx,
|
|
5307
|
+
resizeable,
|
|
5308
|
+
header,
|
|
5309
|
+
closeable,
|
|
5310
|
+
...props
|
|
5311
|
+
}) => {
|
|
5312
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5313
|
+
import_vuu_ui_controls2.ListItem,
|
|
5314
|
+
{
|
|
5315
|
+
className: (0, import_clsx11.default)("vuuPaletteItem", className),
|
|
5316
|
+
"data-draggable": true,
|
|
5317
|
+
"data-icon": "draggable",
|
|
5318
|
+
...props
|
|
5377
5319
|
}
|
|
5378
|
-
}
|
|
5379
|
-
}
|
|
5380
|
-
});
|
|
5381
|
-
function useResizeObserver2(ref, dimensions, onResize, reportInitialSize = false) {
|
|
5382
|
-
const dimensionsRef = (0, import_react34.useRef)(dimensions);
|
|
5383
|
-
const measure = (0, import_react34.useCallback)((target) => {
|
|
5384
|
-
const { width, height } = target.getBoundingClientRect();
|
|
5385
|
-
const { clientWidth: contentWidth, clientHeight: contentHeight } = target;
|
|
5386
|
-
const flooredHeight = Math.floor(height);
|
|
5387
|
-
const flooredWidth = Math.floor(width);
|
|
5388
|
-
return dimensionsRef.current.reduce(
|
|
5389
|
-
(map, dim) => {
|
|
5390
|
-
map[dim] = getTargetSize2(
|
|
5391
|
-
target,
|
|
5392
|
-
{
|
|
5393
|
-
width: flooredWidth,
|
|
5394
|
-
height: flooredHeight,
|
|
5395
|
-
contentHeight,
|
|
5396
|
-
contentWidth
|
|
5397
|
-
},
|
|
5398
|
-
dim
|
|
5399
|
-
);
|
|
5400
|
-
return map;
|
|
5401
|
-
},
|
|
5402
|
-
{}
|
|
5403
5320
|
);
|
|
5404
|
-
}, []);
|
|
5405
|
-
(0, import_react34.useEffect)(() => {
|
|
5406
|
-
const target = ref.current;
|
|
5407
|
-
async function registerObserver() {
|
|
5408
|
-
observedMap2.set(target, { measurements: {} });
|
|
5409
|
-
const observedTarget = observedMap2.get(target);
|
|
5410
|
-
if (observedTarget) {
|
|
5411
|
-
const measurements = measure(target);
|
|
5412
|
-
observedTarget.measurements = measurements;
|
|
5413
|
-
resizeObserver2.observe(target);
|
|
5414
|
-
if (reportInitialSize) {
|
|
5415
|
-
onResize(measurements);
|
|
5416
|
-
}
|
|
5417
|
-
} else {
|
|
5418
|
-
console.log(
|
|
5419
|
-
`%cuseResizeObserver an target expected to be under observation wa snot found. This warrants investigation`,
|
|
5420
|
-
"font-weight:bold; color:red;"
|
|
5421
|
-
);
|
|
5422
|
-
}
|
|
5423
|
-
}
|
|
5424
|
-
if (target) {
|
|
5425
|
-
if (observedMap2.has(target)) {
|
|
5426
|
-
console.log(
|
|
5427
|
-
`useResizeObserver attemping to observe same element twice`,
|
|
5428
|
-
{
|
|
5429
|
-
target
|
|
5430
|
-
}
|
|
5431
|
-
);
|
|
5432
|
-
}
|
|
5433
|
-
registerObserver();
|
|
5434
|
-
}
|
|
5435
|
-
return () => {
|
|
5436
|
-
if (target && observedMap2.has(target)) {
|
|
5437
|
-
resizeObserver2.unobserve(target);
|
|
5438
|
-
observedMap2.delete(target);
|
|
5439
|
-
}
|
|
5440
|
-
};
|
|
5441
|
-
}, [measure, ref]);
|
|
5442
|
-
(0, import_react34.useEffect)(() => {
|
|
5443
|
-
const target = ref.current;
|
|
5444
|
-
const record = observedMap2.get(target);
|
|
5445
|
-
if (record) {
|
|
5446
|
-
if (dimensionsRef.current !== dimensions) {
|
|
5447
|
-
dimensionsRef.current = dimensions;
|
|
5448
|
-
const measurements = measure(target);
|
|
5449
|
-
record.measurements = measurements;
|
|
5450
|
-
}
|
|
5451
|
-
record.onResize = onResize;
|
|
5452
|
-
}
|
|
5453
|
-
}, [dimensions, measure, ref, onResize]);
|
|
5454
|
-
}
|
|
5455
|
-
|
|
5456
|
-
// src/measured-container/useMeasuredContainer.ts
|
|
5457
|
-
var ClientWidthHeight = ["clientHeight", "clientWidth"];
|
|
5458
|
-
var WidthOnly2 = ["clientWidth"];
|
|
5459
|
-
var HeightOnly2 = ["clientHeight"];
|
|
5460
|
-
var NO_MEASUREMENT2 = [];
|
|
5461
|
-
var isNumber = (val) => Number.isFinite(val);
|
|
5462
|
-
var FULL_SIZE = { height: "100%", width: "auto" };
|
|
5463
|
-
var getInitialCssSize = (height, width) => {
|
|
5464
|
-
if ((0, import_vuu_utils10.isValidNumber)(height) && (0, import_vuu_utils10.isValidNumber)(width)) {
|
|
5465
|
-
return {
|
|
5466
|
-
height: `${height}px`,
|
|
5467
|
-
width: `${width}px`
|
|
5468
|
-
};
|
|
5469
|
-
} else if (typeof height === "string" || typeof width === "string") {
|
|
5470
|
-
return {
|
|
5471
|
-
height: height != null ? height : "100%",
|
|
5472
|
-
width: width != null ? width : "auto"
|
|
5473
|
-
};
|
|
5474
|
-
} else {
|
|
5475
|
-
return FULL_SIZE;
|
|
5476
|
-
}
|
|
5477
|
-
};
|
|
5478
|
-
var getInitialInnerSize = (height, width) => {
|
|
5479
|
-
if ((0, import_vuu_utils10.isValidNumber)(height) && (0, import_vuu_utils10.isValidNumber)(width)) {
|
|
5480
|
-
return {
|
|
5481
|
-
height,
|
|
5482
|
-
width
|
|
5483
|
-
};
|
|
5484
5321
|
}
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5322
|
+
);
|
|
5323
|
+
PaletteItem.displayName = "PaletteItem";
|
|
5324
|
+
var Palette = ({
|
|
5325
|
+
ListProps: ListProps2,
|
|
5326
|
+
ViewProps: ViewProps3,
|
|
5327
|
+
children,
|
|
5328
|
+
className,
|
|
5329
|
+
itemHeight = 41,
|
|
5330
|
+
orientation = "horizontal",
|
|
5331
|
+
...props
|
|
5492
5332
|
}) => {
|
|
5493
|
-
const
|
|
5494
|
-
const
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
outer: { height, width },
|
|
5517
|
-
inner: { height: height - heightDiff, width: width - widthDiff }
|
|
5518
|
-
};
|
|
5519
|
-
}
|
|
5333
|
+
const dispatch = useLayoutProviderDispatch();
|
|
5334
|
+
const classBase11 = "vuuPalette";
|
|
5335
|
+
function handleMouseDown(evt) {
|
|
5336
|
+
var _a, _b;
|
|
5337
|
+
const target = evt.target;
|
|
5338
|
+
const listItemElement = target.closest(".vuuPaletteItem");
|
|
5339
|
+
const idx = parseInt((_b = (_a = listItemElement.dataset) == null ? void 0 : _a.index) != null ? _b : "-1");
|
|
5340
|
+
const {
|
|
5341
|
+
props: { caption, children: payload, template, ...props2 }
|
|
5342
|
+
} = children[idx];
|
|
5343
|
+
const { ViewProps: componentViewProps } = payload.props;
|
|
5344
|
+
const { height, left, top, width } = listItemElement.getBoundingClientRect();
|
|
5345
|
+
const id = (0, import_vuu_utils11.uuid)();
|
|
5346
|
+
const identifiers = { id, key: id };
|
|
5347
|
+
const component = template ? payload : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5348
|
+
MemoView,
|
|
5349
|
+
{
|
|
5350
|
+
...ViewProps3,
|
|
5351
|
+
...identifiers,
|
|
5352
|
+
...props2,
|
|
5353
|
+
...componentViewProps,
|
|
5354
|
+
title: props2.label,
|
|
5355
|
+
children: payload
|
|
5520
5356
|
}
|
|
5521
|
-
|
|
5357
|
+
);
|
|
5358
|
+
dispatch({
|
|
5359
|
+
dragRect: {
|
|
5360
|
+
left,
|
|
5361
|
+
top,
|
|
5362
|
+
right: left + width,
|
|
5363
|
+
bottom: top + 150,
|
|
5364
|
+
width,
|
|
5365
|
+
height
|
|
5366
|
+
},
|
|
5367
|
+
dragElement: clonePaletteItem(listItemElement),
|
|
5368
|
+
evt: evt.nativeEvent,
|
|
5369
|
+
instructions: {
|
|
5370
|
+
DoNotRemove: true,
|
|
5371
|
+
DoNotTransform: true,
|
|
5372
|
+
DriftHomeIfNoDropTarget: true,
|
|
5373
|
+
RemoveDraggableOnDragEnd: true,
|
|
5374
|
+
dragThreshold: 10
|
|
5375
|
+
},
|
|
5376
|
+
path: "*",
|
|
5377
|
+
payload: component,
|
|
5378
|
+
type: "drag-start"
|
|
5522
5379
|
});
|
|
5523
|
-
}
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
const { css, inner, outer } = size;
|
|
5527
|
-
let newState = size;
|
|
5528
|
-
if (fixedHeight && isNumber(clientWidth) && Math.floor(clientWidth) !== (inner == null ? void 0 : inner.width)) {
|
|
5529
|
-
newState = {
|
|
5530
|
-
css,
|
|
5531
|
-
outer,
|
|
5532
|
-
inner: {
|
|
5533
|
-
width: Math.floor(clientWidth) || defaultWidth,
|
|
5534
|
-
height
|
|
5535
|
-
}
|
|
5536
|
-
};
|
|
5537
|
-
} else if (fixedWidth && isNumber(clientHeight) && Math.floor(clientHeight) !== (inner == null ? void 0 : inner.height)) {
|
|
5538
|
-
newState = {
|
|
5539
|
-
css,
|
|
5540
|
-
outer,
|
|
5541
|
-
inner: {
|
|
5542
|
-
height: Math.floor(clientHeight) || defaultHeight,
|
|
5543
|
-
width
|
|
5544
|
-
}
|
|
5545
|
-
};
|
|
5546
|
-
} else if (isNumber(clientHeight) && isNumber(clientWidth) && (clientWidth !== (inner == null ? void 0 : inner.width) || clientHeight !== (inner == null ? void 0 : inner.height))) {
|
|
5547
|
-
newState = {
|
|
5548
|
-
css,
|
|
5549
|
-
outer,
|
|
5550
|
-
inner: {
|
|
5551
|
-
width: Math.floor(clientWidth) || defaultWidth,
|
|
5552
|
-
height: Math.floor(clientHeight) || defaultHeight
|
|
5553
|
-
}
|
|
5554
|
-
};
|
|
5555
|
-
}
|
|
5556
|
-
if (newState !== size) {
|
|
5557
|
-
setSize(newState);
|
|
5558
|
-
}
|
|
5559
|
-
},
|
|
5560
|
-
[defaultHeight, defaultWidth, fixedHeight, fixedWidth, height, size, width]
|
|
5561
|
-
);
|
|
5562
|
-
(0, import_react35.useEffect)(() => {
|
|
5563
|
-
if (size.inner) {
|
|
5564
|
-
onResizeProp == null ? void 0 : onResizeProp(size.inner);
|
|
5565
|
-
}
|
|
5566
|
-
}, [onResizeProp, size.inner]);
|
|
5567
|
-
useResizeObserver2(containerRef, dimensions, onResize, true);
|
|
5568
|
-
return {
|
|
5569
|
-
containerRef,
|
|
5570
|
-
cssSize: size.css,
|
|
5571
|
-
outerSize: size.outer,
|
|
5572
|
-
innerSize: size.inner
|
|
5573
|
-
};
|
|
5574
|
-
};
|
|
5575
|
-
|
|
5576
|
-
// src/measured-container/MeasuredContainer.tsx
|
|
5577
|
-
var import_core7 = require("@salt-ds/core");
|
|
5578
|
-
var import_clsx11 = __toESM(require("clsx"));
|
|
5579
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
5580
|
-
var baseClass = "vuuMeasuredContainer";
|
|
5581
|
-
var MeasuredContainer = (0, import_react36.forwardRef)(function MeasuredContainer2({
|
|
5582
|
-
children,
|
|
5583
|
-
className,
|
|
5584
|
-
height,
|
|
5585
|
-
onResize,
|
|
5586
|
-
style,
|
|
5587
|
-
width,
|
|
5588
|
-
...htmlAttributes
|
|
5589
|
-
}, forwardedRef) {
|
|
5590
|
-
const { containerRef, ...containerMeasurements } = useMeasuredContainer({
|
|
5591
|
-
height,
|
|
5592
|
-
onResize,
|
|
5593
|
-
width
|
|
5594
|
-
});
|
|
5595
|
-
const { cssSize, innerSize } = containerMeasurements;
|
|
5596
|
-
const unmeasured = innerSize === void 0;
|
|
5597
|
-
const getStyle3 = () => {
|
|
5598
|
-
return unmeasured ? {
|
|
5599
|
-
"--measured-css-height": `${cssSize.height}`,
|
|
5600
|
-
"--measured-css-width": `${cssSize.width}`
|
|
5601
|
-
} : {
|
|
5602
|
-
...style,
|
|
5603
|
-
"--measured-css-height": `${cssSize.height}`,
|
|
5604
|
-
"--measured-css-width": `${cssSize.width}`,
|
|
5605
|
-
"--measured-px-height": `${innerSize == null ? void 0 : innerSize.height}px`,
|
|
5606
|
-
"--measured-px-width": `${innerSize == null ? void 0 : innerSize.width}px`
|
|
5607
|
-
};
|
|
5608
|
-
};
|
|
5609
|
-
const forkedRef = (0, import_core7.useForkRef)(containerRef, forwardedRef);
|
|
5610
|
-
return unmeasured ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5611
|
-
"div",
|
|
5612
|
-
{
|
|
5613
|
-
...htmlAttributes,
|
|
5614
|
-
className: (0, import_clsx11.default)(baseClass, `${baseClass}-ummeasured`),
|
|
5615
|
-
style: getStyle3(),
|
|
5616
|
-
ref: containerRef
|
|
5617
|
-
}
|
|
5618
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5619
|
-
"div",
|
|
5380
|
+
}
|
|
5381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5382
|
+
import_vuu_ui_controls2.List,
|
|
5620
5383
|
{
|
|
5621
|
-
...
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5384
|
+
...ListProps2,
|
|
5385
|
+
...props,
|
|
5386
|
+
className: (0, import_clsx11.default)(classBase11, className, `${classBase11}-${orientation}`),
|
|
5387
|
+
itemHeight,
|
|
5388
|
+
selected: null,
|
|
5389
|
+
children: children.map(
|
|
5390
|
+
(child, idx) => child.type === PaletteItem ? (0, import_react33.cloneElement)(child, {
|
|
5391
|
+
key: idx,
|
|
5392
|
+
onMouseDown: handleMouseDown
|
|
5393
|
+
}) : child
|
|
5394
|
+
)
|
|
5626
5395
|
}
|
|
5627
5396
|
);
|
|
5628
|
-
}
|
|
5629
|
-
|
|
5630
|
-
// src/overflow-container/OverflowContainer.tsx
|
|
5631
|
-
var import_vuu_popups2 = require("@vuu-ui/vuu-popups");
|
|
5632
|
-
var import_vuu_utils13 = require("@vuu-ui/vuu-utils");
|
|
5633
|
-
var import_clsx12 = __toESM(require("clsx"));
|
|
5634
|
-
var import_react38 = __toESM(require("react"));
|
|
5397
|
+
};
|
|
5398
|
+
registerComponent("Palette", Palette, "view");
|
|
5635
5399
|
|
|
5636
|
-
// src/
|
|
5637
|
-
var
|
|
5400
|
+
// src/stack/Stack.tsx
|
|
5401
|
+
var import_vuu_ui_controls3 = require("@vuu-ui/vuu-ui-controls");
|
|
5638
5402
|
var import_vuu_utils12 = require("@vuu-ui/vuu-utils");
|
|
5639
|
-
var
|
|
5640
|
-
|
|
5641
|
-
// src/overflow-container/overflow-utils.ts
|
|
5642
|
-
var import_vuu_utils11 = require("@vuu-ui/vuu-utils");
|
|
5643
|
-
var NON_WRAPPED_ITEM = ".vuuOverflowContainer-item:not(.wrapped)";
|
|
5644
|
-
var isOverflowElement = (element) => element !== null && element.dataset.index === "overflow" && element.parentElement !== null && element.parentElement.classList.contains(
|
|
5645
|
-
"vuuOverflowContainer-wrapContainer-overflowed"
|
|
5646
|
-
);
|
|
5647
|
-
var sortByScreenOrder = (elements) => elements.sort((e1, e2) => {
|
|
5648
|
-
const {
|
|
5649
|
-
dataset: { index: idx1 = "?" }
|
|
5650
|
-
} = e1;
|
|
5651
|
-
const {
|
|
5652
|
-
dataset: { index: idx2 = "?" }
|
|
5653
|
-
} = e2;
|
|
5654
|
-
const isOverflowed1 = e1.classList.contains("wrapped");
|
|
5655
|
-
const isOverflowed2 = e2.classList.contains("wrapped");
|
|
5656
|
-
const isOverflowedIndicator1 = idx1 === "overflow";
|
|
5657
|
-
const isOverflowedIndicator2 = idx2 === "overflow";
|
|
5658
|
-
if (isOverflowed1 && !isOverflowed2) {
|
|
5659
|
-
return 1;
|
|
5660
|
-
} else if (!isOverflowed1 && isOverflowed2) {
|
|
5661
|
-
return -1;
|
|
5662
|
-
}
|
|
5663
|
-
if (isOverflowedIndicator1) {
|
|
5664
|
-
return 1;
|
|
5665
|
-
} else if (isOverflowedIndicator2) {
|
|
5666
|
-
return -1;
|
|
5667
|
-
}
|
|
5668
|
-
return parseInt(idx1) > parseInt(idx2) ? 1 : -1;
|
|
5669
|
-
});
|
|
5670
|
-
var NO_WRAPPED_ITEMS = [];
|
|
5671
|
-
var getNonWrappedAndWrappedItems = (container, orientation = "horizontal") => {
|
|
5672
|
-
const nonWrappedItems = [];
|
|
5673
|
-
const wrappedItems = [];
|
|
5674
|
-
let currentPosition = -1;
|
|
5675
|
-
let overflowed = false;
|
|
5676
|
-
const sortedChildren = sortByScreenOrder(
|
|
5677
|
-
Array.from(container.children)
|
|
5678
|
-
);
|
|
5679
|
-
const positionAttribute = orientation === "vertical" ? "top" : "left";
|
|
5680
|
-
for (const child of sortedChildren) {
|
|
5681
|
-
const element = child;
|
|
5682
|
-
const {
|
|
5683
|
-
dataset: { index = "?", label = "?", overflowPriority = "0" }
|
|
5684
|
-
} = element;
|
|
5685
|
-
const { [positionAttribute]: position } = element.getBoundingClientRect();
|
|
5686
|
-
if (position <= currentPosition) {
|
|
5687
|
-
if (index === "overflow") {
|
|
5688
|
-
wrappedItems.push(nonWrappedItems.pop());
|
|
5689
|
-
} else {
|
|
5690
|
-
wrappedItems.push({ index, label, overflowPriority });
|
|
5691
|
-
}
|
|
5692
|
-
overflowed = true;
|
|
5693
|
-
} else if (overflowed) {
|
|
5694
|
-
wrappedItems.push({ index, label, overflowPriority });
|
|
5695
|
-
} else {
|
|
5696
|
-
nonWrappedItems.push({ index, label, overflowPriority });
|
|
5697
|
-
}
|
|
5698
|
-
currentPosition = position;
|
|
5699
|
-
}
|
|
5700
|
-
return [nonWrappedItems, wrappedItems];
|
|
5701
|
-
};
|
|
5702
|
-
var applyOverflowClassToWrappedItems = (container, overflowedItems, classBase13) => {
|
|
5703
|
-
let ignoreOverflow = false;
|
|
5704
|
-
const className = classBase13 ? `${classBase13}-overflowed` : "overflow";
|
|
5705
|
-
if (overflowedItems.find(({ index }) => index === "overflow")) {
|
|
5706
|
-
if (overflowedItems.length === 1) {
|
|
5707
|
-
ignoreOverflow = true;
|
|
5708
|
-
}
|
|
5709
|
-
}
|
|
5710
|
-
for (const element of container.children) {
|
|
5711
|
-
const {
|
|
5712
|
-
dataset: { index = "?" }
|
|
5713
|
-
} = element;
|
|
5714
|
-
if (overflowedItems.length === 0 || ignoreOverflow) {
|
|
5715
|
-
container.classList.remove(className);
|
|
5716
|
-
} else {
|
|
5717
|
-
container.classList.add(className);
|
|
5718
|
-
}
|
|
5719
|
-
if (index !== "overflow" && overflowedItems.find((item) => item.index === index)) {
|
|
5720
|
-
element.classList.add("wrapped");
|
|
5721
|
-
} else {
|
|
5722
|
-
element.classList.remove("wrapped");
|
|
5723
|
-
}
|
|
5724
|
-
}
|
|
5725
|
-
};
|
|
5726
|
-
var maxPriority = (priority, { overflowPriority }) => Math.max(priority, parseInt(overflowPriority));
|
|
5727
|
-
var minPriority = (priority, { overflowPriority }) => Math.min(priority, parseInt(overflowPriority));
|
|
5728
|
-
var overflowIndicatorHasWrappedButShouldNotHave = (wrappedItems) => {
|
|
5729
|
-
var _a;
|
|
5730
|
-
return wrappedItems.length > 1 && ((_a = wrappedItems.at(-1)) == null ? void 0 : _a.index) === "overflow";
|
|
5731
|
-
};
|
|
5732
|
-
var getHighestPriorityItem = (overflowItems) => {
|
|
5733
|
-
let [highestPriorityItem] = overflowItems;
|
|
5734
|
-
for (let i = 1; i < overflowItems.length; i++) {
|
|
5735
|
-
const item = overflowItems[i];
|
|
5736
|
-
if (parseInt(item.overflowPriority) > parseInt(highestPriorityItem.overflowPriority)) {
|
|
5737
|
-
highestPriorityItem = item;
|
|
5738
|
-
}
|
|
5739
|
-
}
|
|
5740
|
-
return highestPriorityItem;
|
|
5741
|
-
};
|
|
5742
|
-
var highPriorityItemsHaveWrappedButShouldNotHave = (nonWrappedItems, wrappedItems) => {
|
|
5743
|
-
var _a;
|
|
5744
|
-
const minNonwrappedPriority = nonWrappedItems.reduce(
|
|
5745
|
-
minPriority,
|
|
5746
|
-
Number.MAX_SAFE_INTEGER
|
|
5747
|
-
);
|
|
5748
|
-
const maxwrappedPriority = wrappedItems.reduce(maxPriority, 0);
|
|
5749
|
-
if (maxwrappedPriority > minNonwrappedPriority) {
|
|
5750
|
-
return true;
|
|
5751
|
-
} else {
|
|
5752
|
-
return wrappedItems.length > 1 && ((_a = wrappedItems.at(-1)) == null ? void 0 : _a.index) === "overflow";
|
|
5753
|
-
}
|
|
5754
|
-
};
|
|
5755
|
-
var correctForWrappedOverflowIndicator = (container, overflowedItems) => new Promise((resolve) => {
|
|
5756
|
-
requestAnimationFrame(() => {
|
|
5757
|
-
const [, o2] = getNonWrappedAndWrappedItems(container);
|
|
5758
|
-
const newlyOverflowed = getNewItems(overflowedItems, o2);
|
|
5759
|
-
newlyOverflowed.forEach((item) => markElementAsWrapped(container, item));
|
|
5760
|
-
resolve(o2);
|
|
5761
|
-
});
|
|
5762
|
-
});
|
|
5763
|
-
var correctForWrappedHighPriorityItems = (container, nonWrapped, wrapped) => new Promise((resolve) => {
|
|
5764
|
-
requestAnimationFrame(() => {
|
|
5765
|
-
const [, o2] = getNonWrappedAndWrappedItems(container);
|
|
5766
|
-
const highPriorityWrappedItem = getHighestPriorityItem(o2);
|
|
5767
|
-
if (highPriorityWrappedItem) {
|
|
5768
|
-
const [nonWrappedItems, wrappedItems] = switchWrappedItemIntoView(
|
|
5769
|
-
container,
|
|
5770
|
-
highPriorityWrappedItem
|
|
5771
|
-
);
|
|
5772
|
-
resolve([nonWrappedItems, wrappedItems]);
|
|
5773
|
-
} else {
|
|
5774
|
-
resolve([nonWrapped, wrapped]);
|
|
5775
|
-
}
|
|
5776
|
-
});
|
|
5777
|
-
});
|
|
5778
|
-
var markElementAsWrapped = (container, item) => {
|
|
5779
|
-
const el = (0, import_vuu_utils11.getElementByDataIndex)(container, item.index);
|
|
5780
|
-
if (el) {
|
|
5781
|
-
el.classList.add("wrapped");
|
|
5782
|
-
} else {
|
|
5783
|
-
throw Error(
|
|
5784
|
-
`markElementAsWrapped element item with index ${item.index} not found`
|
|
5785
|
-
);
|
|
5786
|
-
}
|
|
5787
|
-
};
|
|
5788
|
-
var getElementsMarkedAsWrapped = (container) => Array.from(container.querySelectorAll(".wrapped"));
|
|
5789
|
-
var getNewItems = (items1, items2) => {
|
|
5790
|
-
const newItems = [];
|
|
5791
|
-
for (const item of items2) {
|
|
5792
|
-
if (!items1.find(({ index }) => index === item.index)) {
|
|
5793
|
-
newItems.push(item);
|
|
5794
|
-
}
|
|
5795
|
-
}
|
|
5796
|
-
return newItems;
|
|
5797
|
-
};
|
|
5798
|
-
var unmarkItemsWhichAreNoLongerWrapped = (container, wrappedItems) => {
|
|
5799
|
-
const elementssMarkedAsWrapped = getElementsMarkedAsWrapped(container);
|
|
5800
|
-
elementssMarkedAsWrapped.forEach((el) => {
|
|
5801
|
-
const {
|
|
5802
|
-
dataset: { index = "?" }
|
|
5803
|
-
} = el;
|
|
5804
|
-
if (!wrappedItems.find((i) => i.index === index)) {
|
|
5805
|
-
el.classList.remove("wrapped");
|
|
5806
|
-
}
|
|
5807
|
-
});
|
|
5808
|
-
};
|
|
5809
|
-
var getOverflowIndicator = (container) => container.querySelector('[data-index="overflow"]');
|
|
5810
|
-
var getOverflowedItem = (container) => container.querySelector(".wrapped");
|
|
5811
|
-
var getElementWidth = (el) => parseInt(getComputedStyle(el).getPropertyValue("width"));
|
|
5812
|
-
var getAvailableSpace = (container, overflowIndicator) => {
|
|
5813
|
-
const { right: containerRight } = container.getBoundingClientRect();
|
|
5814
|
-
const paddingRight = parseInt(
|
|
5815
|
-
getComputedStyle(container).getPropertyValue("padding-right")
|
|
5816
|
-
);
|
|
5817
|
-
const { right: indicatorRight } = overflowIndicator.getBoundingClientRect();
|
|
5818
|
-
return containerRight - paddingRight - indicatorRight;
|
|
5819
|
-
};
|
|
5820
|
-
var removeOverflowIndicatorIfNoLongerNeeded = (container) => {
|
|
5821
|
-
const overflowIndicator = getOverflowIndicator(container);
|
|
5822
|
-
const availableSpace = getAvailableSpace(container, overflowIndicator);
|
|
5823
|
-
const indicatorWidth = getElementWidth(overflowIndicator);
|
|
5824
|
-
const overflowedItem = getOverflowedItem(container);
|
|
5825
|
-
const overflowWidth = getElementWidth(overflowedItem);
|
|
5826
|
-
if (overflowWidth <= availableSpace + indicatorWidth) {
|
|
5827
|
-
container.classList.remove("overflowed");
|
|
5828
|
-
overflowedItem.classList.remove("wrapped");
|
|
5829
|
-
return true;
|
|
5830
|
-
}
|
|
5831
|
-
return false;
|
|
5832
|
-
};
|
|
5833
|
-
var byPriorityDescending = (h1, h2) => {
|
|
5834
|
-
const {
|
|
5835
|
-
dataset: { index: i1 = "0", overflowPriority: p1 = "0" }
|
|
5836
|
-
} = h1;
|
|
5837
|
-
const {
|
|
5838
|
-
dataset: { index: i2 = "0", overflowPriority: p2 = "0" }
|
|
5839
|
-
} = h2;
|
|
5840
|
-
if (p1 > p2) {
|
|
5841
|
-
return -1;
|
|
5842
|
-
} else if (p1 < p2) {
|
|
5843
|
-
return 1;
|
|
5844
|
-
} else {
|
|
5845
|
-
return parseInt(i1) - parseInt(i2);
|
|
5846
|
-
}
|
|
5847
|
-
};
|
|
5848
|
-
var getNonwrappedItemsByPriority = (container) => Array.from(container.querySelectorAll(NON_WRAPPED_ITEM)).sort(
|
|
5849
|
-
byPriorityDescending
|
|
5850
|
-
);
|
|
5851
|
-
var switchWrappedItemIntoView = (container, overflowItem) => {
|
|
5852
|
-
const unwrappedItems = getNonwrappedItemsByPriority(container);
|
|
5853
|
-
const targetElement = (0, import_vuu_utils11.getElementByDataIndex)(
|
|
5854
|
-
container,
|
|
5855
|
-
overflowItem.index,
|
|
5856
|
-
true
|
|
5857
|
-
);
|
|
5858
|
-
let pos = -1;
|
|
5859
|
-
let unwrappedItem = unwrappedItems.at(pos);
|
|
5860
|
-
const itemWidth = getElementWidth(unwrappedItem);
|
|
5861
|
-
const targetWidth = getElementWidth(targetElement);
|
|
5862
|
-
const overflowIndicator = getOverflowIndicator(container);
|
|
5863
|
-
let availableSpace = getAvailableSpace(container, overflowIndicator) + itemWidth;
|
|
5864
|
-
if (availableSpace >= targetWidth) {
|
|
5865
|
-
switchWrapOnElements(targetElement, unwrappedItem);
|
|
5866
|
-
} else {
|
|
5867
|
-
const { left: lastLeft } = unwrappedItem.getBoundingClientRect();
|
|
5868
|
-
const baseAvailableSpace = availableSpace;
|
|
5869
|
-
const wrapTargets = [unwrappedItem];
|
|
5870
|
-
while (availableSpace < targetWidth) {
|
|
5871
|
-
pos -= 1;
|
|
5872
|
-
unwrappedItem = unwrappedItems.at(pos);
|
|
5873
|
-
wrapTargets.push(unwrappedItem);
|
|
5874
|
-
const { left: nextLeft } = unwrappedItem.getBoundingClientRect();
|
|
5875
|
-
const extraSpace = lastLeft - nextLeft;
|
|
5876
|
-
availableSpace = baseAvailableSpace + extraSpace;
|
|
5877
|
-
}
|
|
5878
|
-
targetElement == null ? void 0 : targetElement.classList.remove("wrapped");
|
|
5879
|
-
wrapTargets.forEach((item) => {
|
|
5880
|
-
item.classList.add("wrapped");
|
|
5881
|
-
});
|
|
5882
|
-
}
|
|
5883
|
-
const [nonWrappedItems, wrappedItems] = getNonWrappedAndWrappedItems(container);
|
|
5884
|
-
unmarkItemsWhichAreNoLongerWrapped(container, wrappedItems);
|
|
5885
|
-
return [nonWrappedItems, wrappedItems];
|
|
5886
|
-
};
|
|
5887
|
-
var switchWrapOnElements = (wrappedElement, nonWrappedElement) => {
|
|
5888
|
-
if (!wrappedElement || !nonWrappedElement) {
|
|
5889
|
-
throw Error("switchWrapOnElements, element undefined");
|
|
5890
|
-
}
|
|
5891
|
-
wrappedElement.classList.remove("wrapped");
|
|
5892
|
-
nonWrappedElement.classList.add("wrapped");
|
|
5893
|
-
};
|
|
5894
|
-
|
|
5895
|
-
// src/overflow-container/useOverflowContainer.ts
|
|
5896
|
-
var useOverflowContainer = ({
|
|
5897
|
-
allowDragDrop = false,
|
|
5898
|
-
itemCount,
|
|
5899
|
-
onMoveItem,
|
|
5900
|
-
onSwitchWrappedItemIntoView,
|
|
5901
|
-
orientation = "horizontal"
|
|
5902
|
-
}) => {
|
|
5903
|
-
const [container, setContainer] = (0, import_react37.useState)(null);
|
|
5904
|
-
const wrappedItemsRef = (0, import_react37.useRef)(NO_WRAPPED_ITEMS);
|
|
5905
|
-
const containerRef = (0, import_react37.useRef)(null);
|
|
5906
|
-
const setOverflowTabIndex = (0, import_react37.useCallback)((tabIndex) => {
|
|
5907
|
-
var _a;
|
|
5908
|
-
if (containerRef.current) {
|
|
5909
|
-
(_a = containerRef.current.querySelector(".vuuOverflowContainer-OverflowIndicator button")) == null ? void 0 : _a.setAttribute("tabindex", tabIndex);
|
|
5910
|
-
}
|
|
5911
|
-
}, []);
|
|
5912
|
-
const handleResize = (0, import_react37.useCallback)(async () => {
|
|
5913
|
-
if (container) {
|
|
5914
|
-
let [nonWrapped, wrapped] = getNonWrappedAndWrappedItems(
|
|
5915
|
-
container,
|
|
5916
|
-
orientation
|
|
5917
|
-
);
|
|
5918
|
-
applyOverflowClassToWrappedItems(
|
|
5919
|
-
container,
|
|
5920
|
-
wrapped,
|
|
5921
|
-
"vuuOverflowContainer-wrapContainer"
|
|
5922
|
-
);
|
|
5923
|
-
if (overflowIndicatorHasWrappedButShouldNotHave(wrapped)) {
|
|
5924
|
-
wrapped = await correctForWrappedOverflowIndicator(container, wrapped);
|
|
5925
|
-
}
|
|
5926
|
-
while (highPriorityItemsHaveWrappedButShouldNotHave(nonWrapped, wrapped)) {
|
|
5927
|
-
[nonWrapped, wrapped] = await correctForWrappedHighPriorityItems(
|
|
5928
|
-
container,
|
|
5929
|
-
nonWrapped,
|
|
5930
|
-
wrapped
|
|
5931
|
-
);
|
|
5932
|
-
}
|
|
5933
|
-
if (wrapped.length === 1) {
|
|
5934
|
-
if (removeOverflowIndicatorIfNoLongerNeeded(container)) {
|
|
5935
|
-
wrapped = NO_WRAPPED_ITEMS;
|
|
5936
|
-
}
|
|
5937
|
-
}
|
|
5938
|
-
if (wrappedItemsRef.current.length === 0 && wrapped.length > 0) {
|
|
5939
|
-
setOverflowTabIndex("0");
|
|
5940
|
-
} else if (wrappedItemsRef.current.length > 0 && wrapped.length === 0) {
|
|
5941
|
-
setOverflowTabIndex("-1");
|
|
5942
|
-
}
|
|
5943
|
-
wrappedItemsRef.current = wrapped;
|
|
5944
|
-
}
|
|
5945
|
-
}, [container, orientation, setOverflowTabIndex]);
|
|
5946
|
-
const hasOverflowItem = (opt) => typeof opt === "object" && opt !== null && "overflowItem" in opt;
|
|
5947
|
-
const [menuBuilder, menuActionHandler] = (0, import_react37.useMemo)(() => {
|
|
5948
|
-
return [
|
|
5949
|
-
() => {
|
|
5950
|
-
const { current: menuItems } = wrappedItemsRef;
|
|
5951
|
-
return menuItems.map((item) => {
|
|
5952
|
-
return {
|
|
5953
|
-
label: item.label,
|
|
5954
|
-
action: `activate-item-${item.index}`,
|
|
5955
|
-
options: { overflowItem: item }
|
|
5956
|
-
};
|
|
5957
|
-
});
|
|
5958
|
-
},
|
|
5959
|
-
// The menu items are our overflowed items, selecting one by default
|
|
5960
|
-
// brings it back onto the toolbar - TODO is this right ?
|
|
5961
|
-
({ options }) => {
|
|
5962
|
-
if (container && hasOverflowItem(options)) {
|
|
5963
|
-
const [, wrappedItems] = switchWrappedItemIntoView(
|
|
5964
|
-
container,
|
|
5965
|
-
options.overflowItem
|
|
5966
|
-
);
|
|
5967
|
-
wrappedItemsRef.current = wrappedItems;
|
|
5968
|
-
onSwitchWrappedItemIntoView == null ? void 0 : onSwitchWrappedItemIntoView(options.overflowItem);
|
|
5969
|
-
}
|
|
5970
|
-
return true;
|
|
5971
|
-
}
|
|
5972
|
-
];
|
|
5973
|
-
}, [container, onSwitchWrappedItemIntoView]);
|
|
5974
|
-
const resizeObserver3 = (0, import_react37.useMemo)(() => {
|
|
5975
|
-
const { sizeProp } = import_vuu_utils12.MEASURES[orientation];
|
|
5976
|
-
let currentSize = 0;
|
|
5977
|
-
return new ResizeObserver((entries) => {
|
|
5978
|
-
for (const entry of entries) {
|
|
5979
|
-
const { [sizeProp]: actualSize } = entry.contentRect;
|
|
5980
|
-
const size = Math.round(actualSize);
|
|
5981
|
-
if ((0, import_vuu_utils12.isValidNumber)(size) && currentSize !== size) {
|
|
5982
|
-
currentSize = size;
|
|
5983
|
-
handleResize();
|
|
5984
|
-
}
|
|
5985
|
-
}
|
|
5986
|
-
});
|
|
5987
|
-
}, [handleResize, orientation]);
|
|
5988
|
-
(0, import_vuu_utils12.useLayoutEffectSkipFirst)(() => {
|
|
5989
|
-
handleResize();
|
|
5990
|
-
}, [handleResize, itemCount]);
|
|
5991
|
-
(0, import_react37.useMemo)(() => {
|
|
5992
|
-
if (container) {
|
|
5993
|
-
resizeObserver3.observe(container);
|
|
5994
|
-
}
|
|
5995
|
-
}, [container, resizeObserver3]);
|
|
5996
|
-
const callbackRef = (0, import_react37.useCallback)((el) => {
|
|
5997
|
-
setContainer(containerRef.current = el);
|
|
5998
|
-
}, []);
|
|
5999
|
-
const handleDrop = (0, import_react37.useCallback)(
|
|
6000
|
-
(fromIndex, toIndex) => {
|
|
6001
|
-
onMoveItem == null ? void 0 : onMoveItem(fromIndex, toIndex);
|
|
6002
|
-
},
|
|
6003
|
-
[onMoveItem]
|
|
6004
|
-
);
|
|
6005
|
-
const { onMouseDown: dragDropHookHandleMouseDown, ...dragDropHook } = (0, import_vuu_ui_controls2.useDragDrop)({
|
|
6006
|
-
allowDragDrop,
|
|
6007
|
-
containerRef,
|
|
6008
|
-
// this is for useDragDropNext
|
|
6009
|
-
draggableClassName: `vuuOverflowContainer`,
|
|
6010
|
-
// extendedDropZone: overflowedItems.length > 0,
|
|
6011
|
-
onDrop: handleDrop,
|
|
6012
|
-
orientation: "horizontal",
|
|
6013
|
-
itemQuery: ".vuuOverflowContainer-item"
|
|
6014
|
-
});
|
|
6015
|
-
return {
|
|
6016
|
-
menuActionHandler,
|
|
6017
|
-
menuBuilder,
|
|
6018
|
-
onItemMouseDown: dragDropHookHandleMouseDown,
|
|
6019
|
-
rootRef: callbackRef,
|
|
6020
|
-
...dragDropHook
|
|
6021
|
-
};
|
|
6022
|
-
};
|
|
6023
|
-
|
|
6024
|
-
// src/overflow-container/OverflowContainer.tsx
|
|
5403
|
+
var import_clsx12 = __toESM(require("clsx"));
|
|
5404
|
+
var import_react34 = __toESM(require("react"));
|
|
6025
5405
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
6026
|
-
var classBase10 = "
|
|
6027
|
-
var WrapContainer = import_react38.default.memo(
|
|
6028
|
-
({
|
|
6029
|
-
PopupMenuProps: PopupMenuProps2,
|
|
6030
|
-
allowDragDrop,
|
|
6031
|
-
children,
|
|
6032
|
-
className: classNameProp,
|
|
6033
|
-
height: heightProp,
|
|
6034
|
-
id,
|
|
6035
|
-
onMoveItem,
|
|
6036
|
-
onSwitchWrappedItemIntoView,
|
|
6037
|
-
orientation = "horizontal",
|
|
6038
|
-
overflowIcon,
|
|
6039
|
-
overflowPosition = "end"
|
|
6040
|
-
}) => {
|
|
6041
|
-
const childElements = asReactElements(children);
|
|
6042
|
-
const {
|
|
6043
|
-
draggable,
|
|
6044
|
-
draggedItemIndex,
|
|
6045
|
-
menuActionHandler,
|
|
6046
|
-
menuBuilder,
|
|
6047
|
-
onItemMouseDown,
|
|
6048
|
-
rootRef
|
|
6049
|
-
} = useOverflowContainer({
|
|
6050
|
-
allowDragDrop,
|
|
6051
|
-
itemCount: childElements.length,
|
|
6052
|
-
onMoveItem,
|
|
6053
|
-
onSwitchWrappedItemIntoView,
|
|
6054
|
-
orientation
|
|
6055
|
-
});
|
|
6056
|
-
const height = orientation === "vertical" ? "100%" : `${heightProp}px`;
|
|
6057
|
-
const style = {
|
|
6058
|
-
"--overflow-container-height": `${height}`
|
|
6059
|
-
};
|
|
6060
|
-
const className = (0, import_clsx12.default)(`${classBase10}-wrapContainer`, classNameProp, {
|
|
6061
|
-
[`${classBase10}-horizontal`]: orientation === "horizontal",
|
|
6062
|
-
[`${classBase10}-vertical`]: orientation === "vertical"
|
|
6063
|
-
});
|
|
6064
|
-
const content = childElements.map((childEl, i) => {
|
|
6065
|
-
const {
|
|
6066
|
-
"data-align": align,
|
|
6067
|
-
"data-overflow-priority": overflowPriority = "0",
|
|
6068
|
-
id: itemId = `${id}-${i}`,
|
|
6069
|
-
label = `Item ${i + 1}`
|
|
6070
|
-
} = childEl.props;
|
|
6071
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6072
|
-
"div",
|
|
6073
|
-
{
|
|
6074
|
-
className: (0, import_clsx12.default)(`${classBase10}-item`, {
|
|
6075
|
-
"vuuDraggable-dragAway": draggedItemIndex === i
|
|
6076
|
-
}),
|
|
6077
|
-
"data-index": i,
|
|
6078
|
-
"data-align": align,
|
|
6079
|
-
"data-label": label,
|
|
6080
|
-
"data-overflow-priority": overflowPriority,
|
|
6081
|
-
id: `${itemId}-wrapper`,
|
|
6082
|
-
onMouseDown: onItemMouseDown,
|
|
6083
|
-
children: childEl
|
|
6084
|
-
},
|
|
6085
|
-
i
|
|
6086
|
-
);
|
|
6087
|
-
});
|
|
6088
|
-
const overflowIndicator = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6089
|
-
"div",
|
|
6090
|
-
{
|
|
6091
|
-
className: `${classBase10}-OverflowIndicator`,
|
|
6092
|
-
"data-index": "overflow",
|
|
6093
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6094
|
-
import_vuu_popups2.PopupMenu,
|
|
6095
|
-
{
|
|
6096
|
-
...PopupMenuProps2,
|
|
6097
|
-
icon: overflowIcon,
|
|
6098
|
-
menuBuilder,
|
|
6099
|
-
menuActionHandler,
|
|
6100
|
-
tabIndex: -1
|
|
6101
|
-
}
|
|
6102
|
-
)
|
|
6103
|
-
},
|
|
6104
|
-
"overflow"
|
|
6105
|
-
);
|
|
6106
|
-
content.push(overflowIndicator);
|
|
6107
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className, ref: rootRef, style, children: [
|
|
6108
|
-
content,
|
|
6109
|
-
draggable
|
|
6110
|
-
] });
|
|
6111
|
-
}
|
|
6112
|
-
);
|
|
6113
|
-
WrapContainer.displayName = "OverflowContainer.InnerContainer";
|
|
6114
|
-
var OverflowContainer = (0, import_react38.forwardRef)(function OverflowContainer2({
|
|
6115
|
-
PopupMenuProps: PopupMenuProps2,
|
|
6116
|
-
allowDragDrop = false,
|
|
6117
|
-
children,
|
|
6118
|
-
className,
|
|
6119
|
-
height = 44,
|
|
6120
|
-
id: idProp,
|
|
6121
|
-
onMoveItem,
|
|
6122
|
-
onSwitchWrappedItemIntoView,
|
|
6123
|
-
orientation,
|
|
6124
|
-
overflowIcon,
|
|
6125
|
-
overflowPosition,
|
|
6126
|
-
...htmlAttributes
|
|
6127
|
-
}, forwardedRef) {
|
|
6128
|
-
const id = (0, import_vuu_utils13.useId)(idProp);
|
|
6129
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6130
|
-
"div",
|
|
6131
|
-
{
|
|
6132
|
-
...htmlAttributes,
|
|
6133
|
-
className: (0, import_clsx12.default)((0, import_clsx12.default)(className, classBase10)),
|
|
6134
|
-
id,
|
|
6135
|
-
ref: forwardedRef,
|
|
6136
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6137
|
-
WrapContainer,
|
|
6138
|
-
{
|
|
6139
|
-
PopupMenuProps: PopupMenuProps2,
|
|
6140
|
-
allowDragDrop,
|
|
6141
|
-
height,
|
|
6142
|
-
id,
|
|
6143
|
-
orientation,
|
|
6144
|
-
overflowIcon,
|
|
6145
|
-
overflowPosition,
|
|
6146
|
-
onMoveItem,
|
|
6147
|
-
onSwitchWrappedItemIntoView,
|
|
6148
|
-
children
|
|
6149
|
-
}
|
|
6150
|
-
)
|
|
6151
|
-
}
|
|
6152
|
-
);
|
|
6153
|
-
});
|
|
6154
|
-
|
|
6155
|
-
// src/palette/Palette.tsx
|
|
6156
|
-
var import_vuu_utils14 = require("@vuu-ui/vuu-utils");
|
|
6157
|
-
var import_vuu_ui_controls3 = require("@vuu-ui/vuu-ui-controls");
|
|
6158
|
-
var import_clsx13 = __toESM(require("clsx"));
|
|
6159
|
-
var import_react39 = require("react");
|
|
6160
|
-
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
6161
|
-
var clonePaletteItem = (paletteItem) => {
|
|
6162
|
-
const dolly = paletteItem.cloneNode(true);
|
|
6163
|
-
dolly.id = "";
|
|
6164
|
-
delete dolly.dataset.idx;
|
|
6165
|
-
return dolly;
|
|
6166
|
-
};
|
|
6167
|
-
var PaletteItem = (0, import_react39.memo)(
|
|
6168
|
-
({
|
|
6169
|
-
className,
|
|
6170
|
-
children: component,
|
|
6171
|
-
idx,
|
|
6172
|
-
resizeable,
|
|
6173
|
-
header,
|
|
6174
|
-
closeable,
|
|
6175
|
-
...props
|
|
6176
|
-
}) => {
|
|
6177
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6178
|
-
import_vuu_ui_controls3.ListItem,
|
|
6179
|
-
{
|
|
6180
|
-
className: (0, import_clsx13.default)("vuuPaletteItem", className),
|
|
6181
|
-
"data-draggable": true,
|
|
6182
|
-
"data-icon": "draggable",
|
|
6183
|
-
...props
|
|
6184
|
-
}
|
|
6185
|
-
);
|
|
6186
|
-
}
|
|
6187
|
-
);
|
|
6188
|
-
PaletteItem.displayName = "PaletteItem";
|
|
6189
|
-
var Palette = ({
|
|
6190
|
-
ListProps: ListProps2,
|
|
6191
|
-
ViewProps: ViewProps3,
|
|
6192
|
-
children,
|
|
6193
|
-
className,
|
|
6194
|
-
itemHeight = 41,
|
|
6195
|
-
orientation = "horizontal",
|
|
6196
|
-
...props
|
|
6197
|
-
}) => {
|
|
6198
|
-
const dispatch = useLayoutProviderDispatch();
|
|
6199
|
-
const classBase13 = "vuuPalette";
|
|
6200
|
-
function handleMouseDown(evt) {
|
|
6201
|
-
var _a, _b;
|
|
6202
|
-
const target = evt.target;
|
|
6203
|
-
const listItemElement = target.closest(".vuuPaletteItem");
|
|
6204
|
-
const idx = parseInt((_b = (_a = listItemElement.dataset) == null ? void 0 : _a.index) != null ? _b : "-1");
|
|
6205
|
-
const {
|
|
6206
|
-
props: { caption, children: payload, template, ...props2 }
|
|
6207
|
-
} = children[idx];
|
|
6208
|
-
const { ViewProps: componentViewProps } = payload.props;
|
|
6209
|
-
const { height, left, top, width } = listItemElement.getBoundingClientRect();
|
|
6210
|
-
const id = (0, import_vuu_utils14.uuid)();
|
|
6211
|
-
const identifiers = { id, key: id };
|
|
6212
|
-
const component = template ? payload : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6213
|
-
MemoView,
|
|
6214
|
-
{
|
|
6215
|
-
...ViewProps3,
|
|
6216
|
-
...identifiers,
|
|
6217
|
-
...props2,
|
|
6218
|
-
...componentViewProps,
|
|
6219
|
-
title: props2.label,
|
|
6220
|
-
children: payload
|
|
6221
|
-
}
|
|
6222
|
-
);
|
|
6223
|
-
dispatch({
|
|
6224
|
-
dragRect: {
|
|
6225
|
-
left,
|
|
6226
|
-
top,
|
|
6227
|
-
right: left + width,
|
|
6228
|
-
bottom: top + 150,
|
|
6229
|
-
width,
|
|
6230
|
-
height
|
|
6231
|
-
},
|
|
6232
|
-
dragElement: clonePaletteItem(listItemElement),
|
|
6233
|
-
evt: evt.nativeEvent,
|
|
6234
|
-
instructions: {
|
|
6235
|
-
DoNotRemove: true,
|
|
6236
|
-
DoNotTransform: true,
|
|
6237
|
-
DriftHomeIfNoDropTarget: true,
|
|
6238
|
-
RemoveDraggableOnDragEnd: true,
|
|
6239
|
-
dragThreshold: 10
|
|
6240
|
-
},
|
|
6241
|
-
path: "*",
|
|
6242
|
-
payload: component,
|
|
6243
|
-
type: "drag-start"
|
|
6244
|
-
});
|
|
6245
|
-
}
|
|
6246
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6247
|
-
import_vuu_ui_controls3.List,
|
|
6248
|
-
{
|
|
6249
|
-
...ListProps2,
|
|
6250
|
-
...props,
|
|
6251
|
-
className: (0, import_clsx13.default)(classBase13, className, `${classBase13}-${orientation}`),
|
|
6252
|
-
itemHeight,
|
|
6253
|
-
selected: null,
|
|
6254
|
-
children: children.map(
|
|
6255
|
-
(child, idx) => child.type === PaletteItem ? (0, import_react39.cloneElement)(child, {
|
|
6256
|
-
key: idx,
|
|
6257
|
-
onMouseDown: handleMouseDown
|
|
6258
|
-
}) : child
|
|
6259
|
-
)
|
|
6260
|
-
}
|
|
6261
|
-
);
|
|
6262
|
-
};
|
|
6263
|
-
registerComponent("Palette", Palette, "view");
|
|
6264
|
-
|
|
6265
|
-
// src/stack/Stack.tsx
|
|
6266
|
-
var import_vuu_ui_controls4 = require("@vuu-ui/vuu-ui-controls");
|
|
6267
|
-
var import_vuu_utils15 = require("@vuu-ui/vuu-utils");
|
|
6268
|
-
var import_clsx14 = __toESM(require("clsx"));
|
|
6269
|
-
var import_react40 = __toESM(require("react"));
|
|
6270
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
6271
|
-
var classBase11 = "vuuTabs";
|
|
5406
|
+
var classBase10 = "vuuTabs";
|
|
6272
5407
|
var getDefaultTabIcon = () => void 0;
|
|
6273
5408
|
var getChildElements = (children) => {
|
|
6274
5409
|
const elements = [];
|
|
6275
|
-
|
|
6276
|
-
if (
|
|
5410
|
+
import_react34.default.Children.forEach(children, (child) => {
|
|
5411
|
+
if (import_react34.default.isValidElement(child)) {
|
|
6277
5412
|
elements.push(child);
|
|
6278
5413
|
} else {
|
|
6279
5414
|
console.warn(`Stack has unexpected child element type`);
|
|
@@ -6286,7 +5421,7 @@ var DefaultTabstripProps = {
|
|
|
6286
5421
|
allowCloseTab: false,
|
|
6287
5422
|
allowRenameTab: false
|
|
6288
5423
|
};
|
|
6289
|
-
var Stack = (0,
|
|
5424
|
+
var Stack = (0, import_react34.forwardRef)(function Stack2({
|
|
6290
5425
|
TabstripProps: TabstripProps2 = DefaultTabstripProps,
|
|
6291
5426
|
active = 0,
|
|
6292
5427
|
children,
|
|
@@ -6305,14 +5440,14 @@ var Stack = (0, import_react40.forwardRef)(function Stack2({
|
|
|
6305
5440
|
style
|
|
6306
5441
|
}, ref) {
|
|
6307
5442
|
var _a;
|
|
6308
|
-
const id = (0,
|
|
6309
|
-
const tabLabels = (0,
|
|
5443
|
+
const id = (0, import_vuu_utils12.useId)(idProp);
|
|
5444
|
+
const tabLabels = (0, import_react34.useRef)([]);
|
|
6310
5445
|
const {
|
|
6311
5446
|
allowCloseTab,
|
|
6312
5447
|
allowRenameTab,
|
|
6313
5448
|
className: tabstripClassName
|
|
6314
5449
|
} = TabstripProps2;
|
|
6315
|
-
const handleExitEditMode = (0,
|
|
5450
|
+
const handleExitEditMode = (0, import_react34.useCallback)(
|
|
6316
5451
|
(_oldText, newText, _allowDeactivation, tabIndex) => {
|
|
6317
5452
|
onTabEdit == null ? void 0 : onTabEdit(tabIndex, newText);
|
|
6318
5453
|
},
|
|
@@ -6320,7 +5455,7 @@ var Stack = (0, import_react40.forwardRef)(function Stack2({
|
|
|
6320
5455
|
);
|
|
6321
5456
|
const activeChild = () => {
|
|
6322
5457
|
var _a2;
|
|
6323
|
-
if (
|
|
5458
|
+
if (import_react34.default.isValidElement(children)) {
|
|
6324
5459
|
return children;
|
|
6325
5460
|
}
|
|
6326
5461
|
if (Array.isArray(children)) {
|
|
@@ -6336,8 +5471,8 @@ var Stack = (0, import_react40.forwardRef)(function Stack2({
|
|
|
6336
5471
|
} = child2.props;
|
|
6337
5472
|
const label = getTabLabel(child2, idx, tabLabels.current);
|
|
6338
5473
|
tabLabels.current.push(label);
|
|
6339
|
-
return /* @__PURE__ */ (0,
|
|
6340
|
-
|
|
5474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5475
|
+
import_vuu_ui_controls3.Tab,
|
|
6341
5476
|
{
|
|
6342
5477
|
ariaControls: childId,
|
|
6343
5478
|
"data-icon": getTabIcon(child2, idx),
|
|
@@ -6354,24 +5489,24 @@ var Stack = (0, import_react40.forwardRef)(function Stack2({
|
|
|
6354
5489
|
const child = activeChild();
|
|
6355
5490
|
const isHorizontal = showTabs === "left" || showTabs === "right";
|
|
6356
5491
|
const tabstripOrientation = isHorizontal ? "vertical" : "horizontal";
|
|
6357
|
-
return /* @__PURE__ */ (0,
|
|
5492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
6358
5493
|
"div",
|
|
6359
5494
|
{
|
|
6360
|
-
className: (0,
|
|
6361
|
-
[`${
|
|
5495
|
+
className: (0, import_clsx12.default)(classBase10, classNameProp, {
|
|
5496
|
+
[`${classBase10}-horizontal`]: isHorizontal
|
|
6362
5497
|
}),
|
|
6363
5498
|
style,
|
|
6364
5499
|
id,
|
|
6365
5500
|
ref,
|
|
6366
5501
|
children: [
|
|
6367
|
-
showTabs ? /* @__PURE__ */ (0,
|
|
6368
|
-
|
|
5502
|
+
showTabs ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5503
|
+
import_vuu_ui_controls3.Tabstrip,
|
|
6369
5504
|
{
|
|
6370
5505
|
...TabstripProps2,
|
|
6371
5506
|
activeTabIndex: (_a = TabstripProps2 == null ? void 0 : TabstripProps2.activeTabIndex) != null ? _a : child === null ? -1 : active,
|
|
6372
5507
|
allowDragDrop: TabstripProps2.allowDragDrop !== false,
|
|
6373
5508
|
animateSelectionThumb: true,
|
|
6374
|
-
className: (0,
|
|
5509
|
+
className: (0, import_clsx12.default)("vuuTabHeader", tabstripClassName),
|
|
6375
5510
|
"aria-label": "data tabs",
|
|
6376
5511
|
keyBoardActivation,
|
|
6377
5512
|
onActiveChange: onTabSelectionChanged,
|
|
@@ -6383,11 +5518,11 @@ var Stack = (0, import_react40.forwardRef)(function Stack2({
|
|
|
6383
5518
|
children: renderTabs()
|
|
6384
5519
|
}
|
|
6385
5520
|
) : null,
|
|
6386
|
-
/* @__PURE__ */ (0,
|
|
5521
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6387
5522
|
"div",
|
|
6388
5523
|
{
|
|
6389
5524
|
"aria-labelledby": `${id}-${active}`,
|
|
6390
|
-
className: `${
|
|
5525
|
+
className: `${classBase10}-tabPanel`,
|
|
6391
5526
|
role: "tabpanel",
|
|
6392
5527
|
children: child
|
|
6393
5528
|
}
|
|
@@ -6399,10 +5534,10 @@ var Stack = (0, import_react40.forwardRef)(function Stack2({
|
|
|
6399
5534
|
Stack.displayName = "Stack";
|
|
6400
5535
|
|
|
6401
5536
|
// src/stack/StackLayout.tsx
|
|
6402
|
-
var
|
|
6403
|
-
var
|
|
6404
|
-
var
|
|
6405
|
-
var defaultCreateNewChild = () => /* @__PURE__ */ (0,
|
|
5537
|
+
var import_vuu_utils13 = require("@vuu-ui/vuu-utils");
|
|
5538
|
+
var import_react35 = __toESM(require("react"));
|
|
5539
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
5540
|
+
var defaultCreateNewChild = () => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6406
5541
|
Placeholder,
|
|
6407
5542
|
{
|
|
6408
5543
|
resizeable: true,
|
|
@@ -6411,7 +5546,7 @@ var defaultCreateNewChild = () => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
|
6411
5546
|
);
|
|
6412
5547
|
var StackLayout = (props) => {
|
|
6413
5548
|
var _a;
|
|
6414
|
-
const ref = (0,
|
|
5549
|
+
const ref = (0, import_react35.useRef)(null);
|
|
6415
5550
|
const dispatch = useLayoutProviderDispatch();
|
|
6416
5551
|
const { loadState } = usePersistentState();
|
|
6417
5552
|
const {
|
|
@@ -6422,7 +5557,7 @@ var StackLayout = (props) => {
|
|
|
6422
5557
|
...restProps
|
|
6423
5558
|
} = props;
|
|
6424
5559
|
const { children } = props;
|
|
6425
|
-
const id = (0,
|
|
5560
|
+
const id = (0, import_vuu_utils13.useId)(idProp);
|
|
6426
5561
|
const [dispatchViewAction] = useViewActionDispatcher(id, ref, path);
|
|
6427
5562
|
const createNewChildFromContext = useLayoutCreateNewChild();
|
|
6428
5563
|
const createNewChild = (_a = createNewChildProp != null ? createNewChildProp : createNewChildFromContext) != null ? _a : defaultCreateNewChild;
|
|
@@ -6432,7 +5567,7 @@ var StackLayout = (props) => {
|
|
|
6432
5567
|
onTabSelectionChanged == null ? void 0 : onTabSelectionChanged(nextIdx);
|
|
6433
5568
|
}
|
|
6434
5569
|
};
|
|
6435
|
-
const handleTabClose = (0,
|
|
5570
|
+
const handleTabClose = (0, import_react35.useCallback)(
|
|
6436
5571
|
(tabIndex) => {
|
|
6437
5572
|
if (Array.isArray(children)) {
|
|
6438
5573
|
const {
|
|
@@ -6443,9 +5578,9 @@ var StackLayout = (props) => {
|
|
|
6443
5578
|
},
|
|
6444
5579
|
[children, dispatch]
|
|
6445
5580
|
);
|
|
6446
|
-
const handleTabAdd = (0,
|
|
5581
|
+
const handleTabAdd = (0, import_react35.useCallback)(() => {
|
|
6447
5582
|
if (path) {
|
|
6448
|
-
const tabIndex =
|
|
5583
|
+
const tabIndex = import_react35.default.Children.count(children);
|
|
6449
5584
|
const component = createNewChild(tabIndex);
|
|
6450
5585
|
dispatch({
|
|
6451
5586
|
type: "add",
|
|
@@ -6454,7 +5589,7 @@ var StackLayout = (props) => {
|
|
|
6454
5589
|
});
|
|
6455
5590
|
}
|
|
6456
5591
|
}, [children, createNewChild, dispatch, path]);
|
|
6457
|
-
const handleMoveTab = (0,
|
|
5592
|
+
const handleMoveTab = (0, import_react35.useCallback)(
|
|
6458
5593
|
(fromIndex, toIndex) => {
|
|
6459
5594
|
if (path) {
|
|
6460
5595
|
dispatch({
|
|
@@ -6489,7 +5624,7 @@ var StackLayout = (props) => {
|
|
|
6489
5624
|
return loadState(id2, "view-title") || title || // This will normally never be called as title is always assigned in layout model
|
|
6490
5625
|
getDefaultTabLabel(component, idx, existingLabels);
|
|
6491
5626
|
};
|
|
6492
|
-
return /* @__PURE__ */ (0,
|
|
5627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6493
5628
|
Stack,
|
|
6494
5629
|
{
|
|
6495
5630
|
...restProps,
|
|
@@ -6508,617 +5643,33 @@ var StackLayout = (props) => {
|
|
|
6508
5643
|
StackLayout.displayName = "Stack";
|
|
6509
5644
|
registerComponent("Stack", StackLayout, "container");
|
|
6510
5645
|
|
|
6511
|
-
// src/toolbar/Toolbar.tsx
|
|
6512
|
-
var import_vuu_ui_controls6 = require("@vuu-ui/vuu-ui-controls");
|
|
6513
|
-
var import_vuu_utils22 = require("@vuu-ui/vuu-utils");
|
|
6514
|
-
var import_clsx15 = __toESM(require("clsx"));
|
|
6515
|
-
var import_react45 = __toESM(require("react"));
|
|
6516
|
-
|
|
6517
|
-
// src/toolbar/useToolbar.ts
|
|
6518
|
-
var import_vuu_utils21 = require("@vuu-ui/vuu-utils");
|
|
6519
|
-
var import_react44 = require("react");
|
|
6520
|
-
|
|
6521
|
-
// src/toolbar/useKeyboardNavigation.ts
|
|
6522
|
-
var import_core8 = require("@salt-ds/core");
|
|
6523
|
-
var import_vuu_utils18 = require("@vuu-ui/vuu-utils");
|
|
6524
|
-
var import_react42 = require("react");
|
|
6525
|
-
var import_vuu_utils19 = require("@vuu-ui/vuu-utils");
|
|
6526
|
-
|
|
6527
|
-
// src/toolbar/toolbar-dom-utils.ts
|
|
6528
|
-
var import_vuu_utils17 = require("@vuu-ui/vuu-utils");
|
|
6529
|
-
var getIndexOfItem = (container, query) => {
|
|
6530
|
-
if (container) {
|
|
6531
|
-
const targetTab = container.querySelector(
|
|
6532
|
-
`[data-index]:has(${query})`
|
|
6533
|
-
);
|
|
6534
|
-
return (0, import_vuu_utils17.getElementDataIndex)(targetTab);
|
|
6535
|
-
}
|
|
6536
|
-
return -1;
|
|
6537
|
-
};
|
|
6538
|
-
var getIndexOfEditedItem = (container) => getIndexOfItem(container, ".vuuEditableLabel-editing");
|
|
6539
|
-
|
|
6540
|
-
// src/toolbar/useKeyboardNavigation.ts
|
|
6541
|
-
var navigation = {
|
|
6542
|
-
horizontal: {
|
|
6543
|
-
[import_vuu_utils19.Home]: "start",
|
|
6544
|
-
[import_vuu_utils19.End]: "end",
|
|
6545
|
-
[import_vuu_utils19.ArrowLeft]: "bwd",
|
|
6546
|
-
[import_vuu_utils19.ArrowRight]: "fwd"
|
|
6547
|
-
},
|
|
6548
|
-
vertical: {
|
|
6549
|
-
[import_vuu_utils19.Home]: "start",
|
|
6550
|
-
[import_vuu_utils19.End]: "end",
|
|
6551
|
-
[import_vuu_utils19.ArrowUp]: "bwd",
|
|
6552
|
-
[import_vuu_utils19.ArrowDown]: "fwd"
|
|
6553
|
-
}
|
|
6554
|
-
};
|
|
6555
|
-
var isOverflowIndicator = (el) => el !== null && el.dataset.index === "overflow";
|
|
6556
|
-
var itemIsNotFocusable = (container, direction, indexCount, nextIdx, hasOverflowedItem) => {
|
|
6557
|
-
if (container) {
|
|
6558
|
-
const withinRangeBwd = direction === "bwd" && nextIdx > 0;
|
|
6559
|
-
const withinRangeFwd = direction === "fwd" && nextIdx < indexCount;
|
|
6560
|
-
const withinRange = withinRangeBwd || withinRangeFwd;
|
|
6561
|
-
const nextElement = getElementByPosition(container, nextIdx, true);
|
|
6562
|
-
const isOverflowedItem = hasOverflowedItem && !isNonWrappedElement(nextElement);
|
|
6563
|
-
const isHiddenOverflowIndicator = !hasOverflowedItem && isOverflowIndicator(nextElement);
|
|
6564
|
-
hasOverflowedItem && !isNonWrappedElement(nextElement);
|
|
6565
|
-
return withinRange && (isOverflowedItem || isHiddenOverflowIndicator);
|
|
6566
|
-
} else {
|
|
6567
|
-
return false;
|
|
6568
|
-
}
|
|
6569
|
-
};
|
|
6570
|
-
var isNavigationKey = (key, orientation = "horizontal") => navigation[orientation][key] !== void 0;
|
|
6571
|
-
var isMenuActivationKey = (key) => key === import_vuu_utils19.ArrowDown;
|
|
6572
|
-
function nextItemIdx(count, direction, idx) {
|
|
6573
|
-
if (direction === "start") {
|
|
6574
|
-
return 0;
|
|
6575
|
-
} else if (direction === "end") {
|
|
6576
|
-
return count - 1;
|
|
6577
|
-
} else if (direction === "bwd") {
|
|
6578
|
-
if (idx > 0) {
|
|
6579
|
-
return idx - 1;
|
|
6580
|
-
} else {
|
|
6581
|
-
return idx;
|
|
6582
|
-
}
|
|
6583
|
-
} else {
|
|
6584
|
-
if (idx === null) {
|
|
6585
|
-
return 0;
|
|
6586
|
-
} else if (idx === count - 1) {
|
|
6587
|
-
return idx;
|
|
6588
|
-
} else {
|
|
6589
|
-
return idx + 1;
|
|
6590
|
-
}
|
|
6591
|
-
}
|
|
6592
|
-
}
|
|
6593
|
-
var isNonWrappedElement = (element) => element !== null && !element.classList.contains("wrapped");
|
|
6594
|
-
var getToolbarItems = (container) => Array.from(container.querySelectorAll("[data-index]"));
|
|
6595
|
-
var getIndexOfOverflowItem = (container) => {
|
|
6596
|
-
if (container === null) {
|
|
6597
|
-
return -1;
|
|
6598
|
-
} else {
|
|
6599
|
-
const targets = getToolbarItems(container);
|
|
6600
|
-
const indexValues = targets.map((el) => el.dataset.index);
|
|
6601
|
-
return indexValues.indexOf("overflow");
|
|
6602
|
-
}
|
|
6603
|
-
};
|
|
6604
|
-
var getElementByPosition = (container, index, includeOverflowInd = false) => {
|
|
6605
|
-
if (container !== null) {
|
|
6606
|
-
const targets = getToolbarItems(container);
|
|
6607
|
-
const target = targets[index];
|
|
6608
|
-
if (!includeOverflowInd && isOverflowIndicator(target)) {
|
|
6609
|
-
return null;
|
|
6610
|
-
} else {
|
|
6611
|
-
return target;
|
|
6612
|
-
}
|
|
6613
|
-
}
|
|
6614
|
-
return null;
|
|
6615
|
-
};
|
|
6616
|
-
var useKeyboardNavigation = ({
|
|
6617
|
-
containerRef,
|
|
6618
|
-
defaultHighlightedIdx = -1,
|
|
6619
|
-
highlightedIdx: highlightedIdxProp,
|
|
6620
|
-
onNavigateOutOfBounds,
|
|
6621
|
-
orientation
|
|
6622
|
-
}) => {
|
|
6623
|
-
const mouseClickPending = (0, import_react42.useRef)(false);
|
|
6624
|
-
const focusedRef = (0, import_react42.useRef)(-1);
|
|
6625
|
-
const [hasFocus, setHasFocus] = (0, import_react42.useState)(false);
|
|
6626
|
-
const [highlightedIdx, _setHighlightedIdx] = (0, import_core8.useControlled)({
|
|
6627
|
-
controlled: highlightedIdxProp,
|
|
6628
|
-
default: defaultHighlightedIdx,
|
|
6629
|
-
name: "UseKeyboardNavigation"
|
|
6630
|
-
});
|
|
6631
|
-
const setHighlightedIdx = (0, import_react42.useCallback)(
|
|
6632
|
-
(value) => {
|
|
6633
|
-
_setHighlightedIdx(focusedRef.current = value);
|
|
6634
|
-
},
|
|
6635
|
-
[_setHighlightedIdx]
|
|
6636
|
-
);
|
|
6637
|
-
const keyboardNavigation = (0, import_react42.useRef)(false);
|
|
6638
|
-
const focusItem = (0, import_react42.useCallback)(
|
|
6639
|
-
(itemIndex, immediateFocus = false, withKeyboard, delay = 70) => {
|
|
6640
|
-
console.log(`focus item ${itemIndex}`);
|
|
6641
|
-
setHighlightedIdx(itemIndex);
|
|
6642
|
-
if (withKeyboard === true && !keyboardNavigation.current) {
|
|
6643
|
-
keyboardNavigation.current = true;
|
|
6644
|
-
}
|
|
6645
|
-
const setFocus = () => {
|
|
6646
|
-
const element = getElementByPosition(
|
|
6647
|
-
containerRef.current,
|
|
6648
|
-
itemIndex,
|
|
6649
|
-
true
|
|
6650
|
-
);
|
|
6651
|
-
if (element) {
|
|
6652
|
-
const focussableElement = (0, import_vuu_utils18.getFocusableElement)(element);
|
|
6653
|
-
focussableElement == null ? void 0 : focussableElement.focus();
|
|
6654
|
-
}
|
|
6655
|
-
};
|
|
6656
|
-
if (immediateFocus) {
|
|
6657
|
-
setFocus();
|
|
6658
|
-
} else {
|
|
6659
|
-
setTimeout(setFocus, delay);
|
|
6660
|
-
}
|
|
6661
|
-
},
|
|
6662
|
-
[containerRef, setHighlightedIdx]
|
|
6663
|
-
);
|
|
6664
|
-
const onFocus = (e) => {
|
|
6665
|
-
if (focusedRef.current === -1) {
|
|
6666
|
-
if (e.target.tabIndex === 0) {
|
|
6667
|
-
const index = (0, import_vuu_utils18.getElementDataIndex)((0, import_vuu_utils18.getClosest)(e.target, "index"));
|
|
6668
|
-
setHighlightedIdx(index);
|
|
6669
|
-
} else if (e.target.tabIndex === -1) {
|
|
6670
|
-
} else {
|
|
6671
|
-
const index = getIndexOfEditedItem(containerRef.current);
|
|
6672
|
-
if (index !== -1) {
|
|
6673
|
-
requestAnimationFrame(() => {
|
|
6674
|
-
setHighlightedIdx(index);
|
|
6675
|
-
});
|
|
6676
|
-
}
|
|
6677
|
-
}
|
|
6678
|
-
}
|
|
6679
|
-
};
|
|
6680
|
-
const getIndexCount = (0, import_react42.useCallback)(
|
|
6681
|
-
() => {
|
|
6682
|
-
var _a, _b;
|
|
6683
|
-
return (_b = (_a = containerRef.current) == null ? void 0 : _a.querySelectorAll(`[data-index]`).length) != null ? _b : 0;
|
|
6684
|
-
},
|
|
6685
|
-
[containerRef]
|
|
6686
|
-
);
|
|
6687
|
-
const nextFocusableItemIdx = (0, import_react42.useCallback)(
|
|
6688
|
-
(direction = "fwd", idx) => {
|
|
6689
|
-
var _a;
|
|
6690
|
-
const indexCount = getIndexCount();
|
|
6691
|
-
const index = typeof idx === "number" ? idx : indexCount;
|
|
6692
|
-
let nextIdx = nextItemIdx(indexCount, direction, index);
|
|
6693
|
-
const nextDirection = direction === "start" ? "fwd" : direction === "end" ? "bwd" : direction;
|
|
6694
|
-
const hasOverflowedItem = ((_a = containerRef.current) == null ? void 0 : _a.querySelector(
|
|
6695
|
-
".vuuOverflowContainer-wrapContainer-overflowed"
|
|
6696
|
-
)) != null;
|
|
6697
|
-
while (itemIsNotFocusable(
|
|
6698
|
-
containerRef.current,
|
|
6699
|
-
nextDirection,
|
|
6700
|
-
indexCount,
|
|
6701
|
-
nextIdx,
|
|
6702
|
-
hasOverflowedItem
|
|
6703
|
-
)) {
|
|
6704
|
-
const newIdx = nextItemIdx(indexCount, nextDirection, nextIdx);
|
|
6705
|
-
if (newIdx === nextIdx) {
|
|
6706
|
-
return index;
|
|
6707
|
-
} else {
|
|
6708
|
-
nextIdx = newIdx;
|
|
6709
|
-
}
|
|
6710
|
-
}
|
|
6711
|
-
return nextIdx;
|
|
6712
|
-
},
|
|
6713
|
-
[containerRef, getIndexCount]
|
|
6714
|
-
);
|
|
6715
|
-
const navigateChildItems = (0, import_react42.useCallback)(
|
|
6716
|
-
(e) => {
|
|
6717
|
-
const direction = navigation[orientation][e.key];
|
|
6718
|
-
const nextIdx = nextFocusableItemIdx(direction, highlightedIdx);
|
|
6719
|
-
console.log(`highlightedIdx = ${highlightedIdx}, nextIdx = ${nextIdx} `);
|
|
6720
|
-
if (nextIdx !== highlightedIdx) {
|
|
6721
|
-
const immediateFocus = true;
|
|
6722
|
-
focusItem(nextIdx, immediateFocus);
|
|
6723
|
-
} else {
|
|
6724
|
-
onNavigateOutOfBounds == null ? void 0 : onNavigateOutOfBounds(direction === "bwd" ? "start" : "end");
|
|
6725
|
-
}
|
|
6726
|
-
},
|
|
6727
|
-
[
|
|
6728
|
-
orientation,
|
|
6729
|
-
nextFocusableItemIdx,
|
|
6730
|
-
highlightedIdx,
|
|
6731
|
-
focusItem,
|
|
6732
|
-
onNavigateOutOfBounds
|
|
6733
|
-
]
|
|
6734
|
-
);
|
|
6735
|
-
const highlightedItemHasMenu = (0, import_react42.useCallback)(() => {
|
|
6736
|
-
const el = getElementByPosition(containerRef.current, highlightedIdx);
|
|
6737
|
-
if (el) {
|
|
6738
|
-
return el.querySelector(".vuuPopupMenu") != null;
|
|
6739
|
-
}
|
|
6740
|
-
return false;
|
|
6741
|
-
}, [containerRef, highlightedIdx]);
|
|
6742
|
-
const highlightedItemInEditState = (0, import_react42.useCallback)(() => {
|
|
6743
|
-
const el = getElementByPosition(containerRef.current, highlightedIdx);
|
|
6744
|
-
if (el) {
|
|
6745
|
-
return el.querySelector(".vuuEditableLabel-input") != null;
|
|
6746
|
-
}
|
|
6747
|
-
return false;
|
|
6748
|
-
}, [containerRef, highlightedIdx]);
|
|
6749
|
-
const activateItemMenu = (0, import_react42.useCallback)(() => {
|
|
6750
|
-
const el = getElementByPosition(containerRef.current, highlightedIdx);
|
|
6751
|
-
const menuEl = el == null ? void 0 : el.querySelector(".vuuPopupMenu");
|
|
6752
|
-
if (menuEl) {
|
|
6753
|
-
(0, import_vuu_utils18.dispatchMouseEvent)(menuEl, "click");
|
|
6754
|
-
}
|
|
6755
|
-
return false;
|
|
6756
|
-
}, [containerRef, highlightedIdx]);
|
|
6757
|
-
const handleKeyDown = (0, import_react42.useCallback)(
|
|
6758
|
-
(e) => {
|
|
6759
|
-
if (getIndexCount() > 0 && isNavigationKey(e.key, orientation)) {
|
|
6760
|
-
e.preventDefault();
|
|
6761
|
-
if (keyboardNavigation.current) {
|
|
6762
|
-
navigateChildItems(e);
|
|
6763
|
-
} else {
|
|
6764
|
-
keyboardNavigation.current = true;
|
|
6765
|
-
navigateChildItems(e);
|
|
6766
|
-
}
|
|
6767
|
-
} else if (isMenuActivationKey(e.key) && highlightedItemHasMenu() && !highlightedItemInEditState()) {
|
|
6768
|
-
activateItemMenu();
|
|
6769
|
-
}
|
|
6770
|
-
},
|
|
6771
|
-
[
|
|
6772
|
-
activateItemMenu,
|
|
6773
|
-
getIndexCount,
|
|
6774
|
-
highlightedItemHasMenu,
|
|
6775
|
-
highlightedItemInEditState,
|
|
6776
|
-
navigateChildItems,
|
|
6777
|
-
orientation
|
|
6778
|
-
]
|
|
6779
|
-
);
|
|
6780
|
-
const handleItemClick = (_, itemIndex) => {
|
|
6781
|
-
setHighlightedIdx(itemIndex);
|
|
6782
|
-
};
|
|
6783
|
-
const handleFocus = (0, import_react42.useCallback)(() => {
|
|
6784
|
-
if (!hasFocus) {
|
|
6785
|
-
setHasFocus(true);
|
|
6786
|
-
if (!mouseClickPending.current) {
|
|
6787
|
-
keyboardNavigation.current = true;
|
|
6788
|
-
} else {
|
|
6789
|
-
mouseClickPending.current = false;
|
|
6790
|
-
}
|
|
6791
|
-
}
|
|
6792
|
-
}, [hasFocus]);
|
|
6793
|
-
const handleContainerMouseDown = (0, import_react42.useCallback)(() => {
|
|
6794
|
-
if (!hasFocus) {
|
|
6795
|
-
mouseClickPending.current = true;
|
|
6796
|
-
}
|
|
6797
|
-
keyboardNavigation.current = false;
|
|
6798
|
-
}, [hasFocus]);
|
|
6799
|
-
const handleOverflowMenuClose = (0, import_react42.useCallback)(
|
|
6800
|
-
(closeReason) => {
|
|
6801
|
-
if ((closeReason == null ? void 0 : closeReason.type) === "escape") {
|
|
6802
|
-
const index = getIndexOfOverflowItem(containerRef.current);
|
|
6803
|
-
if (index !== -1) {
|
|
6804
|
-
focusItem(index);
|
|
6805
|
-
}
|
|
6806
|
-
}
|
|
6807
|
-
},
|
|
6808
|
-
[containerRef, focusItem]
|
|
6809
|
-
);
|
|
6810
|
-
const containerProps = {
|
|
6811
|
-
onBlur: (e) => {
|
|
6812
|
-
const sourceTarget = e.target.closest(".vuuToolbar");
|
|
6813
|
-
const destTarget = e.relatedTarget;
|
|
6814
|
-
if (sourceTarget && !(sourceTarget == null ? void 0 : sourceTarget.contains(destTarget))) {
|
|
6815
|
-
setHighlightedIdx(-1);
|
|
6816
|
-
setHasFocus(false);
|
|
6817
|
-
}
|
|
6818
|
-
},
|
|
6819
|
-
onMouseDownCapture: handleContainerMouseDown,
|
|
6820
|
-
onFocus: handleFocus,
|
|
6821
|
-
onMouseLeave: () => {
|
|
6822
|
-
keyboardNavigation.current = true;
|
|
6823
|
-
setHighlightedIdx(-1);
|
|
6824
|
-
mouseClickPending.current = false;
|
|
6825
|
-
}
|
|
6826
|
-
};
|
|
6827
|
-
return {
|
|
6828
|
-
containerProps,
|
|
6829
|
-
focusVisible: keyboardNavigation.current ? highlightedIdx : -1,
|
|
6830
|
-
focusIsWithinComponent: hasFocus,
|
|
6831
|
-
highlightedIdx,
|
|
6832
|
-
focusableIdx: 0,
|
|
6833
|
-
focusItem,
|
|
6834
|
-
onClick: handleItemClick,
|
|
6835
|
-
onFocus,
|
|
6836
|
-
onKeyDown: handleKeyDown,
|
|
6837
|
-
onOverflowMenuClose: handleOverflowMenuClose,
|
|
6838
|
-
setHighlightedIdx
|
|
6839
|
-
};
|
|
6840
|
-
};
|
|
6841
|
-
|
|
6842
|
-
// src/toolbar/useSelection.ts
|
|
6843
|
-
var import_vuu_utils20 = require("@vuu-ui/vuu-utils");
|
|
6844
|
-
var import_vuu_ui_controls5 = require("@vuu-ui/vuu-ui-controls");
|
|
6845
|
-
var import_react43 = require("react");
|
|
6846
|
-
var defaultSelectionKeys = ["Enter", " "];
|
|
6847
|
-
var NO_SELECTION_HANDLERS = {};
|
|
6848
|
-
var useSelection = ({
|
|
6849
|
-
containerRef,
|
|
6850
|
-
defaultSelected,
|
|
6851
|
-
highlightedIdx,
|
|
6852
|
-
itemQuery,
|
|
6853
|
-
onSelectionChange,
|
|
6854
|
-
selected: selectedProp,
|
|
6855
|
-
selectionStrategy
|
|
6856
|
-
}) => {
|
|
6857
|
-
const [selected, setSelected, isControlled] = (0, import_vuu_ui_controls5.useControlled)({
|
|
6858
|
-
controlled: selectedProp,
|
|
6859
|
-
default: defaultSelected != null ? defaultSelected : [],
|
|
6860
|
-
name: "useSelection",
|
|
6861
|
-
state: "selected"
|
|
6862
|
-
});
|
|
6863
|
-
const isSelectionEvent = (0, import_react43.useCallback)(
|
|
6864
|
-
(evt) => defaultSelectionKeys.includes(evt.key),
|
|
6865
|
-
[]
|
|
6866
|
-
);
|
|
6867
|
-
const selectItem = (0, import_react43.useCallback)(
|
|
6868
|
-
(itemIndex, specialKey = false) => {
|
|
6869
|
-
const newSelected = (0, import_vuu_ui_controls5.allowMultipleSelection)(selectionStrategy, specialKey) ? selected.concat(itemIndex) : [itemIndex];
|
|
6870
|
-
setSelected(newSelected);
|
|
6871
|
-
onSelectionChange == null ? void 0 : onSelectionChange(newSelected);
|
|
6872
|
-
},
|
|
6873
|
-
[onSelectionChange, selected, selectionStrategy, setSelected]
|
|
6874
|
-
);
|
|
6875
|
-
const deselectItem = (0, import_react43.useCallback)(
|
|
6876
|
-
(itemIndex, specialKey = false) => {
|
|
6877
|
-
const newSelected = selectionStrategy === "deselectable" || selectionStrategy === "multiple-special-key" && !specialKey ? [] : selected.filter((index) => index !== itemIndex);
|
|
6878
|
-
setSelected(newSelected);
|
|
6879
|
-
onSelectionChange == null ? void 0 : onSelectionChange(newSelected);
|
|
6880
|
-
},
|
|
6881
|
-
[onSelectionChange, selected, selectionStrategy, setSelected]
|
|
6882
|
-
);
|
|
6883
|
-
const handleKeyDown = (0, import_react43.useCallback)(
|
|
6884
|
-
(e) => {
|
|
6885
|
-
if (isSelectionEvent(e) && (0, import_vuu_utils20.isSelectableElement)(e.target)) {
|
|
6886
|
-
if (!selected.includes(highlightedIdx)) {
|
|
6887
|
-
e.stopPropagation();
|
|
6888
|
-
e.preventDefault();
|
|
6889
|
-
selectItem(highlightedIdx, e.shiftKey);
|
|
6890
|
-
} else if ((0, import_vuu_ui_controls5.deselectionIsAllowed)(selectionStrategy)) {
|
|
6891
|
-
e.stopPropagation();
|
|
6892
|
-
e.preventDefault();
|
|
6893
|
-
deselectItem(highlightedIdx, e.shiftKey);
|
|
6894
|
-
}
|
|
6895
|
-
}
|
|
6896
|
-
},
|
|
6897
|
-
[
|
|
6898
|
-
isSelectionEvent,
|
|
6899
|
-
selected,
|
|
6900
|
-
highlightedIdx,
|
|
6901
|
-
selectionStrategy,
|
|
6902
|
-
selectItem,
|
|
6903
|
-
deselectItem
|
|
6904
|
-
]
|
|
6905
|
-
);
|
|
6906
|
-
const handleClick = (0, import_react43.useCallback)(
|
|
6907
|
-
(e, itemIndex) => {
|
|
6908
|
-
const element = (0, import_vuu_utils20.getClosestIndexItem)(e.target);
|
|
6909
|
-
if ((0, import_vuu_utils20.isSelectableElement)(element)) {
|
|
6910
|
-
if (!selected.includes(itemIndex)) {
|
|
6911
|
-
selectItem(itemIndex, e.shiftKey);
|
|
6912
|
-
} else if ((0, import_vuu_ui_controls5.deselectionIsAllowed)(selectionStrategy)) {
|
|
6913
|
-
deselectItem(itemIndex, e.shiftKey);
|
|
6914
|
-
}
|
|
6915
|
-
}
|
|
6916
|
-
},
|
|
6917
|
-
[deselectItem, selectItem, selected, selectionStrategy]
|
|
6918
|
-
);
|
|
6919
|
-
const itemHandlers = (0, import_vuu_ui_controls5.selectionIsDisallowed)(selectionStrategy) ? NO_SELECTION_HANDLERS : {
|
|
6920
|
-
onClick: handleClick,
|
|
6921
|
-
onKeyDown: handleKeyDown
|
|
6922
|
-
};
|
|
6923
|
-
return {
|
|
6924
|
-
activateItem: selectItem,
|
|
6925
|
-
itemHandlers,
|
|
6926
|
-
isControlled,
|
|
6927
|
-
selected
|
|
6928
|
-
};
|
|
6929
|
-
};
|
|
6930
|
-
|
|
6931
|
-
// src/toolbar/useToolbar.ts
|
|
6932
|
-
var useToolbar = ({
|
|
6933
|
-
activeItemIndex: activeItemIndexProp,
|
|
6934
|
-
defaultActiveItemIndex,
|
|
6935
|
-
containerRef,
|
|
6936
|
-
itemQuery = "vuuToolbarItem",
|
|
6937
|
-
onActiveChange,
|
|
6938
|
-
onNavigateOutOfBounds,
|
|
6939
|
-
orientation,
|
|
6940
|
-
selectionStrategy
|
|
6941
|
-
}) => {
|
|
6942
|
-
const lastSelection = (0, import_react44.useRef)(activeItemIndexProp);
|
|
6943
|
-
const {
|
|
6944
|
-
focusItem: keyboardHookFocusItem,
|
|
6945
|
-
highlightedIdx,
|
|
6946
|
-
onClick: keyboardHookHandleClick,
|
|
6947
|
-
onKeyDown: keyboardHookHandleKeyDown,
|
|
6948
|
-
setHighlightedIdx: keyboardHookSetHighlightedIndex,
|
|
6949
|
-
...keyboardHook
|
|
6950
|
-
} = useKeyboardNavigation({
|
|
6951
|
-
containerRef,
|
|
6952
|
-
onNavigateOutOfBounds,
|
|
6953
|
-
orientation
|
|
6954
|
-
});
|
|
6955
|
-
const {
|
|
6956
|
-
activateItem: selectionHookActivateItem,
|
|
6957
|
-
itemHandlers: { onClick, onKeyDown },
|
|
6958
|
-
selected: selectionHookSelected
|
|
6959
|
-
} = useSelection({
|
|
6960
|
-
containerRef,
|
|
6961
|
-
defaultSelected: defaultActiveItemIndex,
|
|
6962
|
-
highlightedIdx,
|
|
6963
|
-
itemQuery,
|
|
6964
|
-
onSelectionChange: onActiveChange,
|
|
6965
|
-
selected: activeItemIndexProp,
|
|
6966
|
-
selectionStrategy
|
|
6967
|
-
});
|
|
6968
|
-
lastSelection.current = selectionHookSelected;
|
|
6969
|
-
const handleClick = (0, import_react44.useCallback)(
|
|
6970
|
-
(evt) => {
|
|
6971
|
-
var _a;
|
|
6972
|
-
const target = evt.target;
|
|
6973
|
-
const toolbarItem = target.closest("[data-index]");
|
|
6974
|
-
if (toolbarItem) {
|
|
6975
|
-
const index = parseInt((_a = toolbarItem.dataset.index) != null ? _a : "-1");
|
|
6976
|
-
if (index !== -1 && (0, import_vuu_utils21.isValidNumber)(index)) {
|
|
6977
|
-
keyboardHookHandleClick(evt, index);
|
|
6978
|
-
onClick == null ? void 0 : onClick(evt, index);
|
|
6979
|
-
}
|
|
6980
|
-
}
|
|
6981
|
-
},
|
|
6982
|
-
[keyboardHookHandleClick, onClick]
|
|
6983
|
-
);
|
|
6984
|
-
const handleKeyDown = (0, import_react44.useCallback)(
|
|
6985
|
-
(evt) => {
|
|
6986
|
-
keyboardHookHandleKeyDown(evt);
|
|
6987
|
-
if (!evt.defaultPrevented) {
|
|
6988
|
-
onKeyDown == null ? void 0 : onKeyDown(evt);
|
|
6989
|
-
}
|
|
6990
|
-
},
|
|
6991
|
-
[keyboardHookHandleKeyDown, onKeyDown]
|
|
6992
|
-
);
|
|
6993
|
-
const onSwitchWrappedItemIntoView = (0, import_react44.useCallback)(
|
|
6994
|
-
(item) => {
|
|
6995
|
-
const index = parseInt(item.index);
|
|
6996
|
-
if (!isNaN(index)) {
|
|
6997
|
-
selectionHookActivateItem(index);
|
|
6998
|
-
keyboardHookFocusItem(index);
|
|
6999
|
-
}
|
|
7000
|
-
},
|
|
7001
|
-
[keyboardHookFocusItem, selectionHookActivateItem]
|
|
7002
|
-
);
|
|
7003
|
-
const itemProps = {
|
|
7004
|
-
onClick: handleClick,
|
|
7005
|
-
onFocus: keyboardHook.onFocus,
|
|
7006
|
-
onKeyDown: handleKeyDown
|
|
7007
|
-
};
|
|
7008
|
-
return {
|
|
7009
|
-
activeItemIndex: selectionHookSelected,
|
|
7010
|
-
focusableIdx: keyboardHook.focusableIdx,
|
|
7011
|
-
focusVisible: keyboardHook.focusVisible,
|
|
7012
|
-
containerProps: {
|
|
7013
|
-
PopupMenuProps: {
|
|
7014
|
-
onKeyDown: handleKeyDown,
|
|
7015
|
-
onMenuClose: keyboardHook.onOverflowMenuClose
|
|
7016
|
-
},
|
|
7017
|
-
...keyboardHook.containerProps,
|
|
7018
|
-
onSwitchWrappedItemIntoView
|
|
7019
|
-
},
|
|
7020
|
-
itemProps
|
|
7021
|
-
};
|
|
7022
|
-
};
|
|
7023
|
-
|
|
7024
|
-
// src/toolbar/Toolbar.tsx
|
|
7025
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
7026
|
-
var classBase12 = "vuuToolbar";
|
|
7027
|
-
var Toolbar = ({
|
|
7028
|
-
activeItemIndex: activeItemIndexProp,
|
|
7029
|
-
alignItems = "start",
|
|
7030
|
-
defaultActiveItemIndex,
|
|
7031
|
-
children,
|
|
7032
|
-
className,
|
|
7033
|
-
id: idProp,
|
|
7034
|
-
onActiveChange,
|
|
7035
|
-
onNavigateOutOfBounds,
|
|
7036
|
-
orientation = "horizontal",
|
|
7037
|
-
selectionStrategy = "none",
|
|
7038
|
-
showSeparators = false,
|
|
7039
|
-
...props
|
|
7040
|
-
}) => {
|
|
7041
|
-
const rootRef = (0, import_react45.useRef)(null);
|
|
7042
|
-
const {
|
|
7043
|
-
activeItemIndex,
|
|
7044
|
-
focusableIdx,
|
|
7045
|
-
focusVisible,
|
|
7046
|
-
itemProps,
|
|
7047
|
-
...toolbarHook
|
|
7048
|
-
} = useToolbar({
|
|
7049
|
-
activeItemIndex: activeItemIndexProp,
|
|
7050
|
-
defaultActiveItemIndex,
|
|
7051
|
-
containerRef: rootRef,
|
|
7052
|
-
onActiveChange,
|
|
7053
|
-
onNavigateOutOfBounds,
|
|
7054
|
-
orientation,
|
|
7055
|
-
selectionStrategy
|
|
7056
|
-
});
|
|
7057
|
-
const id = (0, import_vuu_utils22.useId)(idProp);
|
|
7058
|
-
const items = (0, import_react45.useMemo)(
|
|
7059
|
-
() => asReactElements(children).map((child, index) => {
|
|
7060
|
-
const {
|
|
7061
|
-
id: itemId = `${id}-tab-${index}`,
|
|
7062
|
-
className: itemClassName,
|
|
7063
|
-
...ownProps
|
|
7064
|
-
} = child.props;
|
|
7065
|
-
const selected = activeItemIndex.includes(index);
|
|
7066
|
-
return import_react45.default.cloneElement(child, {
|
|
7067
|
-
...(0, import_vuu_ui_controls6.forwardCallbackProps)(ownProps, itemProps),
|
|
7068
|
-
className: (0, import_clsx15.default)("vuuToolbarItem", itemClassName),
|
|
7069
|
-
"data-overflow-priority": selected ? "1" : void 0,
|
|
7070
|
-
id: itemId,
|
|
7071
|
-
key: index,
|
|
7072
|
-
"aria-selected": selected,
|
|
7073
|
-
tabIndex: focusableIdx === index ? 0 : -1
|
|
7074
|
-
});
|
|
7075
|
-
}),
|
|
7076
|
-
[activeItemIndex, children, focusableIdx, id, itemProps]
|
|
7077
|
-
);
|
|
7078
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7079
|
-
OverflowContainer,
|
|
7080
|
-
{
|
|
7081
|
-
...props,
|
|
7082
|
-
...toolbarHook.containerProps,
|
|
7083
|
-
className: (0, import_clsx15.default)(className, classBase12, `${classBase12}-${orientation}`, {
|
|
7084
|
-
[`${classBase12}-alignCenter`]: alignItems === "center",
|
|
7085
|
-
[`${classBase12}-alignEnd`]: alignItems === "end",
|
|
7086
|
-
[`${classBase12}-withSeparators`]: showSeparators
|
|
7087
|
-
}),
|
|
7088
|
-
...props,
|
|
7089
|
-
ref: rootRef,
|
|
7090
|
-
children: items
|
|
7091
|
-
}
|
|
7092
|
-
);
|
|
7093
|
-
};
|
|
7094
|
-
|
|
7095
5646
|
// src/tools/config-wrapper/ConfigWrapper.tsx
|
|
7096
|
-
var
|
|
7097
|
-
var
|
|
5647
|
+
var import_react36 = __toESM(require("react"));
|
|
5648
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
7098
5649
|
var ConfigWrapper = ({ children }) => {
|
|
7099
5650
|
const designMode = false;
|
|
7100
|
-
const [layout, setLayout] = (0,
|
|
7101
|
-
const [selectedComponent, setSelectedComponent] = (0,
|
|
5651
|
+
const [layout, setLayout] = (0, import_react36.useState)(children);
|
|
5652
|
+
const [selectedComponent, setSelectedComponent] = (0, import_react36.useState)(children);
|
|
7102
5653
|
const handleSelection = (selectedPath) => {
|
|
7103
5654
|
const targetComponent = followPathToComponent(layout, selectedPath);
|
|
7104
5655
|
setSelectedComponent(targetComponent);
|
|
7105
5656
|
};
|
|
7106
5657
|
const handleChange = (property, value) => {
|
|
7107
5658
|
console.log(`change ${property} -> ${value}`);
|
|
7108
|
-
const newComponent =
|
|
5659
|
+
const newComponent = import_react36.default.cloneElement(selectedComponent, {
|
|
7109
5660
|
style: {
|
|
7110
5661
|
...selectedComponent.props.style,
|
|
7111
5662
|
[property]: value
|
|
7112
5663
|
}
|
|
7113
5664
|
});
|
|
7114
5665
|
setSelectedComponent(newComponent);
|
|
7115
|
-
setLayout(
|
|
5666
|
+
setLayout(import_react36.default.cloneElement(layout, {}, newComponent));
|
|
7116
5667
|
};
|
|
7117
|
-
return /* @__PURE__ */ (0,
|
|
5668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { "data-design-mode": `${designMode}`, children: [
|
|
7118
5669
|
layout,
|
|
7119
|
-
/* @__PURE__ */ (0,
|
|
7120
|
-
/* @__PURE__ */ (0,
|
|
7121
|
-
/* @__PURE__ */ (0,
|
|
5670
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("br", {}),
|
|
5671
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { display: "flex" }, children: [
|
|
5672
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7122
5673
|
LayoutConfigurator,
|
|
7123
5674
|
{
|
|
7124
5675
|
height: 300,
|
|
@@ -7128,7 +5679,7 @@ var ConfigWrapper = ({ children }) => {
|
|
|
7128
5679
|
style: void 0
|
|
7129
5680
|
}
|
|
7130
5681
|
),
|
|
7131
|
-
/* @__PURE__ */ (0,
|
|
5682
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7132
5683
|
LayoutTreeViewer,
|
|
7133
5684
|
{
|
|
7134
5685
|
layout,
|
|
@@ -7141,8 +5692,8 @@ var ConfigWrapper = ({ children }) => {
|
|
|
7141
5692
|
};
|
|
7142
5693
|
|
|
7143
5694
|
// src/tools/devtools-box/layout-configurator.jsx
|
|
7144
|
-
var
|
|
7145
|
-
var
|
|
5695
|
+
var import_core7 = require("@salt-ds/core");
|
|
5696
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
7146
5697
|
var NO_STYLE2 = {};
|
|
7147
5698
|
var DIMENSIONS = {
|
|
7148
5699
|
margin: {
|
|
@@ -7165,36 +5716,36 @@ var DIMENSIONS = {
|
|
|
7165
5716
|
}
|
|
7166
5717
|
};
|
|
7167
5718
|
var LayoutBox = ({ feature, children, style, onChange }) => {
|
|
7168
|
-
return /* @__PURE__ */ (0,
|
|
7169
|
-
/* @__PURE__ */ (0,
|
|
7170
|
-
/* @__PURE__ */ (0,
|
|
7171
|
-
/* @__PURE__ */ (0,
|
|
7172
|
-
|
|
5719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `LayoutBox layout-${feature} layout-outer`, children: [
|
|
5720
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `layout-top`, children: [
|
|
5721
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "layout-title", children: feature }),
|
|
5722
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_core7.FormField, { className: "layout-input", style: { width: 30 }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
5723
|
+
import_core7.Input,
|
|
7173
5724
|
{
|
|
7174
5725
|
value: style.top,
|
|
7175
5726
|
onChange: (evt, value) => onChange(feature, "top", value)
|
|
7176
5727
|
}
|
|
7177
5728
|
) })
|
|
7178
5729
|
] }),
|
|
7179
|
-
/* @__PURE__ */ (0,
|
|
7180
|
-
/* @__PURE__ */ (0,
|
|
7181
|
-
|
|
5730
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `layout-inner`, children: [
|
|
5731
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `layout-left`, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_core7.FormField, { className: "layout-input", style: { width: 30 }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
5732
|
+
import_core7.Input,
|
|
7182
5733
|
{
|
|
7183
5734
|
value: style.left,
|
|
7184
5735
|
onChange: (evt, value) => onChange(feature, "left", value)
|
|
7185
5736
|
}
|
|
7186
5737
|
) }) }),
|
|
7187
5738
|
children,
|
|
7188
|
-
/* @__PURE__ */ (0,
|
|
7189
|
-
|
|
5739
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `layout-right`, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_core7.FormField, { className: "layout-input", style: { width: 30 }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
5740
|
+
import_core7.Input,
|
|
7190
5741
|
{
|
|
7191
5742
|
value: style.right,
|
|
7192
5743
|
onChange: (evt, value) => onChange(feature, "right", value)
|
|
7193
5744
|
}
|
|
7194
5745
|
) }) })
|
|
7195
5746
|
] }),
|
|
7196
|
-
/* @__PURE__ */ (0,
|
|
7197
|
-
|
|
5747
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `layout-bottom`, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_core7.FormField, { className: "layout-input", style: { width: 30 }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
5748
|
+
import_core7.Input,
|
|
7198
5749
|
{
|
|
7199
5750
|
value: style.bottom,
|
|
7200
5751
|
onChange: (evt, value) => onChange(feature, "bottom", value)
|
|
@@ -7260,25 +5811,25 @@ var LayoutConfigurator = ({
|
|
|
7260
5811
|
paddingBottom: pb = 0,
|
|
7261
5812
|
paddingLeft: pl = 0
|
|
7262
5813
|
} = state;
|
|
7263
|
-
return /* @__PURE__ */ (0,
|
|
5814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "LayoutConfigurator", style: { width, height, ...style }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7264
5815
|
LayoutBox,
|
|
7265
5816
|
{
|
|
7266
5817
|
feature: "margin",
|
|
7267
5818
|
style: { top: mt, right: mr, bottom: mb, left: ml },
|
|
7268
5819
|
onChange: handleChange,
|
|
7269
|
-
children: /* @__PURE__ */ (0,
|
|
5820
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7270
5821
|
LayoutBox,
|
|
7271
5822
|
{
|
|
7272
5823
|
feature: "border",
|
|
7273
5824
|
style: { top: bt, right: br, bottom: bb, left: bl },
|
|
7274
5825
|
onChange: handleChange,
|
|
7275
|
-
children: /* @__PURE__ */ (0,
|
|
5826
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7276
5827
|
LayoutBox,
|
|
7277
5828
|
{
|
|
7278
5829
|
feature: "padding",
|
|
7279
5830
|
style: { top: pt, right: pr, bottom: pb, left: pl },
|
|
7280
5831
|
onChange: handleChange,
|
|
7281
|
-
children: /* @__PURE__ */ (0,
|
|
5832
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "layout-content" })
|
|
7282
5833
|
}
|
|
7283
5834
|
)
|
|
7284
5835
|
}
|
|
@@ -7446,16 +5997,16 @@ function normalizeStyle(managedStyle = NO_STYLE2) {
|
|
|
7446
5997
|
}
|
|
7447
5998
|
|
|
7448
5999
|
// src/tools/devtools-tree/layout-tree-viewer.jsx
|
|
7449
|
-
var
|
|
7450
|
-
var
|
|
7451
|
-
var
|
|
7452
|
-
var
|
|
6000
|
+
var import_react37 = __toESM(require("react"));
|
|
6001
|
+
var import_clsx13 = __toESM(require("clsx"));
|
|
6002
|
+
var import_vuu_ui_controls4 = require("@vuu-ui/vuu-ui-controls");
|
|
6003
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
7453
6004
|
var classBaseTree = "hwLayoutTreeViewer";
|
|
7454
6005
|
var toTreeJson = (component, path = "0") => {
|
|
7455
6006
|
return {
|
|
7456
6007
|
label: typeOf(component),
|
|
7457
6008
|
path,
|
|
7458
|
-
childNodes:
|
|
6009
|
+
childNodes: import_react37.default.Children.map(
|
|
7459
6010
|
component.props.children,
|
|
7460
6011
|
(child, i) => toTreeJson(child, path ? `${path}.${i}` : `${i}`)
|
|
7461
6012
|
)
|
|
@@ -7466,8 +6017,8 @@ var LayoutTreeViewer = ({ layout, onSelect, style }) => {
|
|
|
7466
6017
|
const handleSelection = (evt, [{ path }]) => {
|
|
7467
6018
|
onSelect(path);
|
|
7468
6019
|
};
|
|
7469
|
-
return /* @__PURE__ */ (0,
|
|
7470
|
-
|
|
6020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: (0, import_clsx13.default)(classBaseTree), style, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
6021
|
+
import_vuu_ui_controls4.Tree,
|
|
7471
6022
|
{
|
|
7472
6023
|
source: treeJson,
|
|
7473
6024
|
groupSelection: "single",
|