@vuu-ui/vuu-layout 0.6.25-debug → 0.6.26-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 +89 -64
- package/cjs/index.js.map +4 -4
- package/esm/index.js +100 -73
- package/esm/index.js.map +4 -4
- package/index.css +8 -8
- package/index.css.map +2 -2
- package/package.json +3 -3
- package/types/DraggableLayout.d.ts +1 -0
- package/types/dock-layout/DockLayout.d.ts +10 -0
- package/types/dock-layout/index.d.ts +2 -0
- package/types/flexbox/flexbox-utils.d.ts +3 -3
- package/types/index.d.ts +1 -1
- package/types/layout-reducer/layoutTypes.d.ts +3 -2
- package/types/layout-view/ViewContext.d.ts +3 -0
- package/types/layout-view/useViewActionDispatcher.d.ts +2 -1
- package/types/layout-view/viewTypes.d.ts +5 -3
- package/types/chest-of-drawers/Chest.d.ts +0 -10
- package/types/chest-of-drawers/index.d.ts +0 -2
- /package/types/{chest-of-drawers → dock-layout}/Drawer.d.ts +0 -0
package/cjs/index.js
CHANGED
|
@@ -32,10 +32,10 @@ var src_exports = {};
|
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
Action: () => Action,
|
|
34
34
|
BORDER_STYLES: () => BORDER_STYLES,
|
|
35
|
-
Chest: () => Chest_default,
|
|
36
35
|
Component: () => Component_default,
|
|
37
36
|
ComponentRegistry: () => ComponentRegistry,
|
|
38
37
|
ConfigWrapper: () => ConfigWrapper,
|
|
38
|
+
DockLayout: () => DockLayout_default,
|
|
39
39
|
Draggable: () => Draggable,
|
|
40
40
|
DraggableLayout: () => DraggableLayout,
|
|
41
41
|
Drawer: () => Drawer_default,
|
|
@@ -107,10 +107,32 @@ __export(src_exports, {
|
|
|
107
107
|
});
|
|
108
108
|
module.exports = __toCommonJS(src_exports);
|
|
109
109
|
|
|
110
|
-
// src/
|
|
110
|
+
// src/dock-layout/DockLayout.tsx
|
|
111
|
+
var import_vuu_utils = require("@vuu-ui/vuu-utils");
|
|
111
112
|
var import_classnames2 = __toESM(require("classnames"));
|
|
112
113
|
|
|
113
|
-
// src/
|
|
114
|
+
// src/registry/ComponentRegistry.ts
|
|
115
|
+
var _containers = {};
|
|
116
|
+
var _views = {};
|
|
117
|
+
var ComponentRegistry = {};
|
|
118
|
+
function isContainer(componentType) {
|
|
119
|
+
return _containers[componentType] === true;
|
|
120
|
+
}
|
|
121
|
+
function isView(componentType) {
|
|
122
|
+
return _views[componentType] === true;
|
|
123
|
+
}
|
|
124
|
+
var isLayoutComponent = (type) => isContainer(type) || isView(type);
|
|
125
|
+
var isRegistered = (className) => !!ComponentRegistry[className];
|
|
126
|
+
function registerComponent(componentName2, component, type = "component") {
|
|
127
|
+
ComponentRegistry[componentName2] = component;
|
|
128
|
+
if (type === "container") {
|
|
129
|
+
_containers[componentName2] = true;
|
|
130
|
+
} else if (type === "view") {
|
|
131
|
+
_views[componentName2] = true;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// src/dock-layout/Drawer.tsx
|
|
114
136
|
var import_core = require("@salt-ds/core");
|
|
115
137
|
var import_classnames = __toESM(require("classnames"));
|
|
116
138
|
var import_react = require("react");
|
|
@@ -163,7 +185,6 @@ var Drawer = ({
|
|
|
163
185
|
[`${classBase}-peekaboo`]: peekaboo
|
|
164
186
|
});
|
|
165
187
|
const toggleDrawer = (0, import_react.useCallback)(() => {
|
|
166
|
-
console.log("toggleDrawer");
|
|
167
188
|
setOpen(!open);
|
|
168
189
|
}, [open, setOpen]);
|
|
169
190
|
const style = getStyle(styleProp, sizeOpen, sizeClosed);
|
|
@@ -194,49 +215,25 @@ var Drawer = ({
|
|
|
194
215
|
Drawer.displayName = "Drawer";
|
|
195
216
|
var Drawer_default = Drawer;
|
|
196
217
|
|
|
197
|
-
// src/
|
|
198
|
-
var import_vuu_utils = require("@vuu-ui/vuu-utils");
|
|
199
|
-
|
|
200
|
-
// src/registry/ComponentRegistry.ts
|
|
201
|
-
var _containers = {};
|
|
202
|
-
var _views = {};
|
|
203
|
-
var ComponentRegistry = {};
|
|
204
|
-
function isContainer(componentType) {
|
|
205
|
-
return _containers[componentType] === true;
|
|
206
|
-
}
|
|
207
|
-
function isView(componentType) {
|
|
208
|
-
return _views[componentType] === true;
|
|
209
|
-
}
|
|
210
|
-
var isLayoutComponent = (type) => isContainer(type) || isView(type);
|
|
211
|
-
var isRegistered = (className) => !!ComponentRegistry[className];
|
|
212
|
-
function registerComponent(componentName2, component, type = "component") {
|
|
213
|
-
ComponentRegistry[componentName2] = component;
|
|
214
|
-
if (type === "container") {
|
|
215
|
-
_containers[componentName2] = true;
|
|
216
|
-
} else if (type === "view") {
|
|
217
|
-
_views[componentName2] = true;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// src/chest-of-drawers/Chest.tsx
|
|
218
|
+
// src/dock-layout/DockLayout.tsx
|
|
222
219
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
223
220
|
var isDrawer = (component) => component.type === Drawer_default;
|
|
224
221
|
var isVertical = ({ props: { position = "left" } }) => position.match(/top|bottom/);
|
|
225
|
-
var
|
|
222
|
+
var DockLayout = (props) => {
|
|
226
223
|
const { children, className: classNameProp, id, style } = props;
|
|
227
|
-
const
|
|
224
|
+
const classBase9 = "vuuDockLayout";
|
|
228
225
|
const [drawers, content] = (0, import_vuu_utils.partition)(children, isDrawer);
|
|
229
226
|
const [verticalDrawers, horizontalDrawers] = (0, import_vuu_utils.partition)(drawers, isVertical);
|
|
230
227
|
const orientation = verticalDrawers.length === 0 ? "horizontal" : horizontalDrawers.length === 0 ? "vertical" : "both";
|
|
231
|
-
const className = (0, import_classnames2.default)(
|
|
228
|
+
const className = (0, import_classnames2.default)(classBase9, classNameProp, `${classBase9}-${orientation}`);
|
|
232
229
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className, id, style, children: [
|
|
233
230
|
drawers,
|
|
234
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: `${
|
|
231
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: `${classBase9}-content`, children: content })
|
|
235
232
|
] });
|
|
236
233
|
};
|
|
237
|
-
|
|
238
|
-
var
|
|
239
|
-
registerComponent("
|
|
234
|
+
DockLayout.displayName = "DockLayout";
|
|
235
|
+
var DockLayout_default = DockLayout;
|
|
236
|
+
registerComponent("DockLayout", DockLayout, "container");
|
|
240
237
|
|
|
241
238
|
// src/Component.tsx
|
|
242
239
|
var import_react2 = require("react");
|
|
@@ -1788,6 +1785,8 @@ var DraggableLayout = (0, import_react4.forwardRef)(function DraggableLayout2({
|
|
|
1788
1785
|
children,
|
|
1789
1786
|
className: classNameProp,
|
|
1790
1787
|
dropTarget,
|
|
1788
|
+
resizeable: _,
|
|
1789
|
+
// ignore, its just a marker used by the layout system
|
|
1791
1790
|
...htmlAttributes
|
|
1792
1791
|
}, forwardedRef) {
|
|
1793
1792
|
const className = (0, import_classnames4.default)("DraggableLayout", classNameProp);
|
|
@@ -2233,7 +2232,7 @@ function getLeadingResizeablePos(contentMeta, idx) {
|
|
|
2233
2232
|
function getTrailingResizeablePos(contentMeta, idx) {
|
|
2234
2233
|
let pos = idx, resizeable = false;
|
|
2235
2234
|
const count = contentMeta.length;
|
|
2236
|
-
while (pos < count && !resizeable) {
|
|
2235
|
+
while (pos < count - 1 && !resizeable) {
|
|
2237
2236
|
pos = pos + 1;
|
|
2238
2237
|
resizeable = isResizeable(contentMeta, pos);
|
|
2239
2238
|
}
|
|
@@ -4664,8 +4663,19 @@ var useViewContext = () => (0, import_react28.useContext)(ViewContext);
|
|
|
4664
4663
|
|
|
4665
4664
|
// src/layout-view/View.tsx
|
|
4666
4665
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
4666
|
+
var classBase6 = "vuuView";
|
|
4667
|
+
var getProps2 = (state, props) => {
|
|
4668
|
+
if (state && props) {
|
|
4669
|
+
return {
|
|
4670
|
+
...state,
|
|
4671
|
+
...props
|
|
4672
|
+
};
|
|
4673
|
+
} else
|
|
4674
|
+
return state || props;
|
|
4675
|
+
};
|
|
4667
4676
|
var View = (0, import_react29.forwardRef)(function View2(props, forwardedRef) {
|
|
4668
4677
|
const {
|
|
4678
|
+
Header: Header2 = Header,
|
|
4669
4679
|
children,
|
|
4670
4680
|
className,
|
|
4671
4681
|
collapsed,
|
|
@@ -4688,6 +4698,7 @@ var View = (0, import_react29.forwardRef)(function View2(props, forwardedRef) {
|
|
|
4688
4698
|
const id = (0, import_core4.useIdMemo)(idProp);
|
|
4689
4699
|
const rootRef = (0, import_react29.useRef)(null);
|
|
4690
4700
|
const mainRef = (0, import_react29.useRef)(null);
|
|
4701
|
+
const [componentProps, _setComponentProps] = (0, import_react29.useState)();
|
|
4691
4702
|
const {
|
|
4692
4703
|
contributions,
|
|
4693
4704
|
dispatchViewAction,
|
|
@@ -4708,10 +4719,15 @@ var View = (0, import_react29.forwardRef)(function View2(props, forwardedRef) {
|
|
|
4708
4719
|
title: titleProp
|
|
4709
4720
|
});
|
|
4710
4721
|
useViewResize({ mainRef, resize, rootRef });
|
|
4711
|
-
const
|
|
4722
|
+
const setComponentProps = (0, import_react29.useCallback)((props2) => {
|
|
4723
|
+
_setComponentProps(props2);
|
|
4724
|
+
}, []);
|
|
4712
4725
|
const getContent = () => {
|
|
4713
|
-
if (import_react29.default.isValidElement(children) && restoredState) {
|
|
4714
|
-
return import_react29.default.cloneElement(
|
|
4726
|
+
if (import_react29.default.isValidElement(children) && (restoredState || componentProps)) {
|
|
4727
|
+
return import_react29.default.cloneElement(
|
|
4728
|
+
children,
|
|
4729
|
+
getProps2(restoredState, componentProps)
|
|
4730
|
+
);
|
|
4715
4731
|
}
|
|
4716
4732
|
return children;
|
|
4717
4733
|
};
|
|
@@ -4726,7 +4742,8 @@ var View = (0, import_react29.forwardRef)(function View2(props, forwardedRef) {
|
|
|
4726
4742
|
onConfigChange,
|
|
4727
4743
|
purge,
|
|
4728
4744
|
save,
|
|
4729
|
-
saveSession
|
|
4745
|
+
saveSession,
|
|
4746
|
+
setComponentProps
|
|
4730
4747
|
}),
|
|
4731
4748
|
[
|
|
4732
4749
|
dispatchViewAction,
|
|
@@ -4738,6 +4755,7 @@ var View = (0, import_react29.forwardRef)(function View2(props, forwardedRef) {
|
|
|
4738
4755
|
purge,
|
|
4739
4756
|
save,
|
|
4740
4757
|
saveSession,
|
|
4758
|
+
setComponentProps,
|
|
4741
4759
|
title
|
|
4742
4760
|
]
|
|
4743
4761
|
);
|
|
@@ -4746,10 +4764,10 @@ var View = (0, import_react29.forwardRef)(function View2(props, forwardedRef) {
|
|
|
4746
4764
|
"div",
|
|
4747
4765
|
{
|
|
4748
4766
|
...restProps,
|
|
4749
|
-
className: (0, import_classnames9.default)(
|
|
4750
|
-
[`${
|
|
4751
|
-
[`${
|
|
4752
|
-
[`${
|
|
4767
|
+
className: (0, import_classnames9.default)(classBase6, className, {
|
|
4768
|
+
[`${classBase6}-collapsed`]: collapsed,
|
|
4769
|
+
[`${classBase6}-expanded`]: expanded,
|
|
4770
|
+
[`${classBase6}-resize-defer`]: resize === "defer"
|
|
4753
4771
|
}),
|
|
4754
4772
|
"data-resizeable": resizeable,
|
|
4755
4773
|
id,
|
|
@@ -4758,7 +4776,7 @@ var View = (0, import_react29.forwardRef)(function View2(props, forwardedRef) {
|
|
|
4758
4776
|
tabIndex: -1,
|
|
4759
4777
|
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(ViewContext.Provider, { value: viewContextValue, children: [
|
|
4760
4778
|
header ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4761
|
-
|
|
4779
|
+
Header2,
|
|
4762
4780
|
{
|
|
4763
4781
|
...headerProps,
|
|
4764
4782
|
collapsed,
|
|
@@ -4771,7 +4789,7 @@ var View = (0, import_react29.forwardRef)(function View2(props, forwardedRef) {
|
|
|
4771
4789
|
title
|
|
4772
4790
|
}
|
|
4773
4791
|
) : null,
|
|
4774
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: `${
|
|
4792
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: `${classBase6}-main`, ref: mainRef, children: getContent() })
|
|
4775
4793
|
] })
|
|
4776
4794
|
}
|
|
4777
4795
|
);
|
|
@@ -4800,7 +4818,7 @@ var Header = ({
|
|
|
4800
4818
|
const [editing, setEditing] = (0, import_react30.useState)(false);
|
|
4801
4819
|
const viewDispatch = useViewDispatch();
|
|
4802
4820
|
const handleClose = (evt) => viewDispatch == null ? void 0 : viewDispatch({ type: "remove" }, evt);
|
|
4803
|
-
const
|
|
4821
|
+
const classBase9 = "vuuHeader";
|
|
4804
4822
|
const handleTitleMouseDown = () => {
|
|
4805
4823
|
var _a;
|
|
4806
4824
|
(_a = labelFieldRef.current) == null ? void 0 : _a.focus();
|
|
@@ -4810,9 +4828,9 @@ var Header = ({
|
|
|
4810
4828
|
};
|
|
4811
4829
|
const orientation = collapsed || orientationProp;
|
|
4812
4830
|
const className = (0, import_classnames10.default)(
|
|
4813
|
-
|
|
4831
|
+
classBase9,
|
|
4814
4832
|
classNameProp,
|
|
4815
|
-
`${
|
|
4833
|
+
`${classBase9}-${orientation}`
|
|
4816
4834
|
);
|
|
4817
4835
|
const handleEnterEditMode = () => {
|
|
4818
4836
|
setEditing(true);
|
|
@@ -4839,8 +4857,19 @@ var Header = ({
|
|
|
4839
4857
|
viewDispatch == null ? void 0 : viewDispatch({ type: "mousedown" }, e);
|
|
4840
4858
|
};
|
|
4841
4859
|
const toolbarItems = [];
|
|
4842
|
-
const
|
|
4860
|
+
const postTitleContributedItems = [];
|
|
4843
4861
|
const actionButtons = [];
|
|
4862
|
+
contributions == null ? void 0 : contributions.forEach((contribution, i) => {
|
|
4863
|
+
switch (contribution.location) {
|
|
4864
|
+
case "pre-title":
|
|
4865
|
+
toolbarItems.push(import_react30.default.cloneElement(contribution.content, { key: i }));
|
|
4866
|
+
break;
|
|
4867
|
+
default:
|
|
4868
|
+
postTitleContributedItems.push(
|
|
4869
|
+
import_react30.default.cloneElement(contribution.content, { key: i })
|
|
4870
|
+
);
|
|
4871
|
+
}
|
|
4872
|
+
});
|
|
4844
4873
|
title && toolbarItems.push(
|
|
4845
4874
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_salt_lab2.ToolbarField, { className: "vuuHeader-title", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
4846
4875
|
import_salt_lab2.EditableLabel,
|
|
@@ -4858,9 +4887,6 @@ var Header = ({
|
|
|
4858
4887
|
"title"
|
|
4859
4888
|
) }, "title")
|
|
4860
4889
|
);
|
|
4861
|
-
contributions == null ? void 0 : contributions.forEach((contribution, i) => {
|
|
4862
|
-
contributedItems.push(import_react30.default.cloneElement(contribution.content, { key: i }));
|
|
4863
|
-
});
|
|
4864
4890
|
closeable && actionButtons.push(
|
|
4865
4891
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
4866
4892
|
import_salt_lab2.ToolbarButton,
|
|
@@ -4875,8 +4901,8 @@ var Header = ({
|
|
|
4875
4901
|
"close"
|
|
4876
4902
|
)
|
|
4877
4903
|
);
|
|
4878
|
-
|
|
4879
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_salt_lab2.Tooltray, { "data-align-end": true, children:
|
|
4904
|
+
postTitleContributedItems.length > 0 && toolbarItems.push(
|
|
4905
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_salt_lab2.Tooltray, { "data-align-end": true, children: postTitleContributedItems }, "contributions")
|
|
4880
4906
|
);
|
|
4881
4907
|
actionButtons.length > 0 && toolbarItems.push(
|
|
4882
4908
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_salt_lab2.Tooltray, { "data-align-end": true, children: actionButtons }, "actions")
|
|
@@ -4885,7 +4911,6 @@ var Header = ({
|
|
|
4885
4911
|
import_salt_lab2.Toolbar,
|
|
4886
4912
|
{
|
|
4887
4913
|
className,
|
|
4888
|
-
id: "stevo",
|
|
4889
4914
|
orientation: orientationProp,
|
|
4890
4915
|
style,
|
|
4891
4916
|
onMouseDown: handleMouseDown,
|
|
@@ -4934,7 +4959,7 @@ var Palette = ({
|
|
|
4934
4959
|
...props
|
|
4935
4960
|
}) => {
|
|
4936
4961
|
const dispatch = useLayoutProviderDispatch();
|
|
4937
|
-
const
|
|
4962
|
+
const classBase9 = "vuuPalette";
|
|
4938
4963
|
function handleMouseDown(evt) {
|
|
4939
4964
|
var _a;
|
|
4940
4965
|
const target = evt.target;
|
|
@@ -4981,7 +5006,7 @@ var Palette = ({
|
|
|
4981
5006
|
{
|
|
4982
5007
|
...props,
|
|
4983
5008
|
borderless: true,
|
|
4984
|
-
className: (0, import_classnames11.default)(
|
|
5009
|
+
className: (0, import_classnames11.default)(classBase9, className, `${classBase9}-${orientation}`),
|
|
4985
5010
|
maxHeight: 800,
|
|
4986
5011
|
selected: null,
|
|
4987
5012
|
children: children.map(
|
|
@@ -5000,7 +5025,7 @@ var import_vuu_utils9 = require("@vuu-ui/vuu-utils");
|
|
|
5000
5025
|
var import_salt_lab4 = require("@heswell/salt-lab");
|
|
5001
5026
|
var import_classnames12 = __toESM(require("classnames"));
|
|
5002
5027
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
5003
|
-
var
|
|
5028
|
+
var classBase7 = "vuuPalette";
|
|
5004
5029
|
var PaletteListItem = (props) => {
|
|
5005
5030
|
const { children, ViewProps, label, onMouseDown, template, ...restProps } = props;
|
|
5006
5031
|
const dispatch = useLayoutProviderDispatch();
|
|
@@ -5037,7 +5062,7 @@ var PaletteSalt = ({ className, ...props }) => {
|
|
|
5037
5062
|
import_salt_lab4.List,
|
|
5038
5063
|
{
|
|
5039
5064
|
...props,
|
|
5040
|
-
className: (0, import_classnames12.default)(
|
|
5065
|
+
className: (0, import_classnames12.default)(classBase7, className),
|
|
5041
5066
|
height: "100%",
|
|
5042
5067
|
selectionStrategy: "none"
|
|
5043
5068
|
}
|
|
@@ -5051,7 +5076,7 @@ var import_core5 = require("@salt-ds/core");
|
|
|
5051
5076
|
var import_classnames13 = __toESM(require("classnames"));
|
|
5052
5077
|
var import_react32 = __toESM(require("react"));
|
|
5053
5078
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
5054
|
-
var
|
|
5079
|
+
var classBase8 = "Tabs";
|
|
5055
5080
|
var getDefaultTabIcon = () => void 0;
|
|
5056
5081
|
var getDefaultTabLabel = (component, tabIndex) => {
|
|
5057
5082
|
var _a, _b;
|
|
@@ -5148,8 +5173,8 @@ var Stack = (0, import_react32.forwardRef)(function Stack2({
|
|
|
5148
5173
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
5149
5174
|
"div",
|
|
5150
5175
|
{
|
|
5151
|
-
className: (0, import_classnames13.default)(
|
|
5152
|
-
[`${
|
|
5176
|
+
className: (0, import_classnames13.default)(classBase8, classNameProp, {
|
|
5177
|
+
[`${classBase8}-horizontal`]: (TabstripProps == null ? void 0 : TabstripProps.orientation) === "vertical"
|
|
5153
5178
|
}),
|
|
5154
5179
|
style,
|
|
5155
5180
|
id,
|