xmlui 0.7.32 → 0.7.33
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/dist/{apiInterceptorWorker-iyzFS4kP.mjs → apiInterceptorWorker-CE7NtDJI.mjs} +1 -1
- package/dist/{index-29eF52eI.mjs → index-lMqf6HyK.mjs} +6846 -6853
- package/dist/scripts/bin/language-server.js +11 -0
- package/dist/scripts/src/components/Button/ButtonNative.js +3 -2
- package/dist/scripts/src/components/ComponentProvider.js +6 -2
- package/dist/scripts/src/components/DropdownMenu/DropdownMenuNative.js +4 -5
- package/dist/scripts/src/components/Icon/Inspect.js +10 -0
- package/dist/scripts/src/components/IconProvider.js +3 -1
- package/dist/scripts/src/components/Table/Table.js +3 -3
- package/dist/scripts/src/components-core/ComponentDecorator.js +23 -19
- package/dist/scripts/src/components-core/InspectorContext.js +2 -2
- package/dist/scripts/src/components-core/abstractions/standalone.js +2 -0
- package/dist/scripts/src/components-core/interception/abstractions.js +2 -0
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +2 -2
- package/dist/scripts/src/components-core/rendering/Container.js +21 -34
- package/dist/scripts/src/language-server/metadata.js +8206 -0
- package/dist/scripts/src/language-server/server.js +135 -0
- package/dist/scripts/src/language-server/services/completion.js +100 -0
- package/dist/scripts/src/language-server/services/hover.js +170 -0
- package/dist/scripts/src/language-server/services/syntax-node-utilities.js +22 -0
- package/dist/scripts/src/parsers/xmlui-parser/index.js +29 -0
- package/dist/scripts/src/parsers/xmlui-parser/lint.js +177 -0
- package/dist/scripts/src/parsers/xmlui-parser/xmlui-serializer.js +582 -0
- package/dist/scripts/src/parsers/xmlui-parser/xmlui-tree.js +2 -0
- package/dist/xmlui-metadata.mjs +6558 -5727
- package/dist/xmlui-metadata.umd.js +11 -11
- package/dist/xmlui-standalone.umd.js +110 -110
- package/dist/xmlui.d.ts +2 -1
- package/dist/xmlui.mjs +1 -1
- package/package.json +9 -4
|
@@ -52,6 +52,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
52
52
|
const react_1 = __importStar(require("react"));
|
|
53
53
|
const classnames_1 = __importDefault(require("classnames"));
|
|
54
54
|
const Button_module_scss_1 = __importDefault(require("./Button.module.scss"));
|
|
55
|
+
const react_compose_refs_1 = require("@radix-ui/react-compose-refs");
|
|
55
56
|
exports.propDefaults = {
|
|
56
57
|
type: "button",
|
|
57
58
|
iconPosition: "start",
|
|
@@ -64,7 +65,7 @@ exports.propDefaults = {
|
|
|
64
65
|
exports.Button = react_1.default.forwardRef(function Button(_a, ref) {
|
|
65
66
|
var { id, type = exports.propDefaults.type, icon, iconPosition = exports.propDefaults.iconPosition, contentPosition = exports.propDefaults.contentPosition, orientation = exports.propDefaults.orientation, variant = exports.propDefaults.variant, themeColor = exports.propDefaults.themeColor, size = exports.propDefaults.size, disabled, children, formId, onClick, onFocus, onBlur, style, gap, className, autoFocus } = _a, rest = __rest(_a, ["id", "type", "icon", "iconPosition", "contentPosition", "orientation", "variant", "themeColor", "size", "disabled", "children", "formId", "onClick", "onFocus", "onBlur", "style", "gap", "className", "autoFocus"]);
|
|
66
67
|
const innerRef = (0, react_1.useRef)(null);
|
|
67
|
-
(0,
|
|
68
|
+
const composedRef = ref ? (0, react_compose_refs_1.composeRefs)(ref, innerRef) : innerRef;
|
|
68
69
|
(0, react_1.useEffect)(() => {
|
|
69
70
|
if (autoFocus) {
|
|
70
71
|
setTimeout(() => {
|
|
@@ -74,7 +75,7 @@ exports.Button = react_1.default.forwardRef(function Button(_a, ref) {
|
|
|
74
75
|
}
|
|
75
76
|
}, [autoFocus]);
|
|
76
77
|
const iconToLeft = iconPosition === "start";
|
|
77
|
-
return ((0, jsx_runtime_1.jsxs)("button", Object.assign({}, rest, { id: id, type: type, ref:
|
|
78
|
+
return ((0, jsx_runtime_1.jsxs)("button", Object.assign({}, rest, { id: id, type: type, ref: composedRef, className: (0, classnames_1.default)(className, Button_module_scss_1.default.button, {
|
|
78
79
|
[Button_module_scss_1.default.buttonHorizontal]: orientation === "horizontal",
|
|
79
80
|
[Button_module_scss_1.default.buttonVertical]: orientation === "vertical",
|
|
80
81
|
[Button_module_scss_1.default.xs]: size === "xs",
|
|
@@ -168,8 +168,12 @@ class ComponentRegistry {
|
|
|
168
168
|
};
|
|
169
169
|
// --- Registers a renderable component using its renderer function
|
|
170
170
|
// --- and metadata
|
|
171
|
-
this.registerComponentRenderer = ({ type, renderer, metadata }, ...namespaces) => {
|
|
172
|
-
const component = {
|
|
171
|
+
this.registerComponentRenderer = ({ type, renderer, metadata, isCompoundComponent, }, ...namespaces) => {
|
|
172
|
+
const component = {
|
|
173
|
+
renderer,
|
|
174
|
+
descriptor: metadata,
|
|
175
|
+
isCompoundComponent,
|
|
176
|
+
};
|
|
173
177
|
namespaces.forEach((ns) => {
|
|
174
178
|
this.pool.set((ns ? ns + "." : "") + type, component);
|
|
175
179
|
});
|
|
@@ -45,8 +45,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
45
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.defaultMenuItemProps = exports.DropdownMenu = exports.defaultDropdownMenuProps = void 0;
|
|
49
|
-
exports.MenuItem = MenuItem;
|
|
48
|
+
exports.MenuItem = exports.defaultMenuItemProps = exports.DropdownMenu = exports.defaultDropdownMenuProps = void 0;
|
|
50
49
|
exports.SubMenuItem = SubMenuItem;
|
|
51
50
|
exports.MenuSeparator = MenuSeparator;
|
|
52
51
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -88,15 +87,15 @@ exports.defaultMenuItemProps = {
|
|
|
88
87
|
iconPosition: "start",
|
|
89
88
|
active: false,
|
|
90
89
|
};
|
|
91
|
-
function MenuItem({ children, onClick = constants_1.noop, label, style, icon, iconPosition = exports.defaultMenuItemProps.iconPosition, active = exports.defaultMenuItemProps.active, }) {
|
|
90
|
+
exports.MenuItem = (0, react_1.forwardRef)(function MenuItem({ children, onClick = constants_1.noop, label, style, icon, iconPosition = exports.defaultMenuItemProps.iconPosition, active = exports.defaultMenuItemProps.active, }, ref) {
|
|
92
91
|
const iconToStart = iconPosition === "start";
|
|
93
92
|
return ((0, jsx_runtime_1.jsxs)(ReactDropdownMenu.Item, { style: style, className: (0, classnames_1.default)(DropdownMenu_module_scss_1.default.DropdownMenuItem, {
|
|
94
93
|
[DropdownMenu_module_scss_1.default.active]: active,
|
|
95
94
|
}), onClick: (event) => {
|
|
96
95
|
event.stopPropagation();
|
|
97
96
|
onClick(event);
|
|
98
|
-
}, children: [iconToStart && icon, (0, jsx_runtime_1.jsx)("div", { className: DropdownMenu_module_scss_1.default.wrapper, children: label !== null && label !== void 0 ? label : children }), !iconToStart && icon] }));
|
|
99
|
-
}
|
|
97
|
+
}, ref: ref, children: [iconToStart && icon, (0, jsx_runtime_1.jsx)("div", { className: DropdownMenu_module_scss_1.default.wrapper, children: label !== null && label !== void 0 ? label : children }), !iconToStart && icon] }));
|
|
98
|
+
});
|
|
100
99
|
function SubMenuItem({ children, label, triggerTemplate }) {
|
|
101
100
|
const { root } = (0, ThemeContext_1.useTheme)();
|
|
102
101
|
return ((0, jsx_runtime_1.jsxs)(ReactDropdownMenu.Sub, { children: [(0, jsx_runtime_1.jsx)(ReactDropdownMenu.SubTrigger, { className: DropdownMenu_module_scss_1.default.DropdownMenuSubTrigger, asChild: true, children: triggerTemplate ? triggerTemplate : (0, jsx_runtime_1.jsx)("div", { children: label }) }), (0, jsx_runtime_1.jsx)(ReactDropdownMenu.Portal, { container: root, children: (0, jsx_runtime_1.jsx)(ReactDropdownMenu.SubContent, { className: DropdownMenu_module_scss_1.default.DropdownMenuSubContent, children: children }) })] }));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.InspectIcon = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const inspect_svg_react_1 = __importDefault(require("./svg/inspect.svg?react"));
|
|
9
|
+
const InspectIcon = (props) => ((0, jsx_runtime_1.jsx)(inspect_svg_react_1.default, Object.assign({}, props)));
|
|
10
|
+
exports.InspectIcon = InspectIcon;
|
|
@@ -78,6 +78,7 @@ const SortAscendingIcon_1 = require("./Icon/SortAscendingIcon");
|
|
|
78
78
|
const SortDescendingIcon_1 = require("./Icon/SortDescendingIcon");
|
|
79
79
|
const NoSortIcon_1 = require("./Icon/NoSortIcon");
|
|
80
80
|
const TrendingLevelIcon_1 = require("./Icon/TrendingLevelIcon");
|
|
81
|
+
const Inspect_1 = require("./Icon/Inspect");
|
|
81
82
|
const pool = new Map();
|
|
82
83
|
function registerIconRenderer(name, renderer) {
|
|
83
84
|
if (typeof name === "object") {
|
|
@@ -135,6 +136,7 @@ registerIconRenderer("exit", (props) => (0, jsx_runtime_1.jsx)(rx_1.RxExit, Obje
|
|
|
135
136
|
registerIconRenderer("adduser", (props) => (0, jsx_runtime_1.jsx)(fi_1.FiUserPlus, Object.assign({}, props)));
|
|
136
137
|
registerIconRenderer("userminus", (props) => (0, jsx_runtime_1.jsx)(fi_1.FiUserMinus, Object.assign({}, props)));
|
|
137
138
|
registerIconRenderer("plus", (props) => (0, jsx_runtime_1.jsx)(PlusIcon_1.PlusIcon, Object.assign({}, props)));
|
|
139
|
+
registerIconRenderer("inspect", (props) => (0, jsx_runtime_1.jsx)(Inspect_1.InspectIcon, Object.assign({}, props)));
|
|
138
140
|
registerIconRenderer("plus-circle", (props) => (0, jsx_runtime_1.jsx)(ai_1.AiOutlinePlusCircle, Object.assign({}, props)));
|
|
139
141
|
registerIconRenderer("filledplus", (props) => (0, jsx_runtime_1.jsx)(FillPlusCricleIcon_1.FillPlusCircleIcon, Object.assign({}, props)));
|
|
140
142
|
registerIconRenderer("chevronright", (props) => (0, jsx_runtime_1.jsx)(ChevronRight_1.ChevronRightIcon, Object.assign({}, props)));
|
|
@@ -192,7 +194,7 @@ registerIconRenderer("duplicate", (props) => (0, jsx_runtime_1.jsx)(hi_1.HiOutli
|
|
|
192
194
|
registerIconRenderer("connect", (props) => (0, jsx_runtime_1.jsx)(rx_1.RxLightningBolt, Object.assign({}, props)));
|
|
193
195
|
registerIconRenderer("cog", (props) => (0, jsx_runtime_1.jsx)(hi_1.HiOutlineCog, Object.assign({}, props)));
|
|
194
196
|
registerIconRenderer("sun", (props) => (0, jsx_runtime_1.jsx)(hi2_1.HiSun, Object.assign({}, props)));
|
|
195
|
-
registerIconRenderer("moon", (props) => (0, jsx_runtime_1.jsx)(
|
|
197
|
+
registerIconRenderer("moon", (props) => (0, jsx_runtime_1.jsx)(fi_1.FiMoon, Object.assign({}, props)));
|
|
196
198
|
registerIconRenderer("share", (props) => (0, jsx_runtime_1.jsx)(ShareIcon_1.ShareIcon, Object.assign({}, props)));
|
|
197
199
|
registerIconRenderer("new-window", (props) => (0, jsx_runtime_1.jsx)(rx_1.RxOpenInNewWindow, Object.assign({}, props)));
|
|
198
200
|
registerIconRenderer("paint", (props) => (0, jsx_runtime_1.jsx)(hi2_1.HiOutlinePaintBrush, Object.assign({}, props)));
|
|
@@ -133,7 +133,7 @@ exports.TableMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
133
133
|
},
|
|
134
134
|
},
|
|
135
135
|
});
|
|
136
|
-
const TableWithColumns = ({ extractValue, node, renderChild, lookupEventHandler, lookupSyncCallback, layoutCss, registerComponentApi, }) => {
|
|
136
|
+
const TableWithColumns = (0, react_1.forwardRef)(({ extractValue, node, renderChild, lookupEventHandler, lookupSyncCallback, layoutCss, registerComponentApi, }, ref) => {
|
|
137
137
|
var _a, _b, _c, _d, _e, _f;
|
|
138
138
|
const data = extractValue(node.props.items) || extractValue(node.props.data);
|
|
139
139
|
const [columnIds, setColumnIds] = (0, react_1.useState)(constants_1.EMPTY_ARRAY);
|
|
@@ -181,7 +181,7 @@ const TableWithColumns = ({ extractValue, node, renderChild, lookupEventHandler,
|
|
|
181
181
|
}, []);
|
|
182
182
|
const columns = (0, react_1.useMemo)(() => columnIds.map((colId) => columnsByIds[colId]), [columnIds, columnsByIds]);
|
|
183
183
|
const selectionContext = (0, SelectionStoreNative_1.useSelectionContext)();
|
|
184
|
-
const tableContent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(TableContext_1.TableContext.Provider, { value: tableContextValue, children: renderChild(node.children) }, tableKey), (0, jsx_runtime_1.jsx)(TableContext_1.TableContext.Provider, { value: columnRefresherContextValue, children: renderChild(node.children) }), (0, jsx_runtime_1.jsx)(TableNative_1.Table, { data: data, columns: columns, pageSizes: extractValue(node.props.pageSizes), rowsSelectable: extractValue.asOptionalBoolean(node.props.rowsSelectable), registerComponentApi: registerComponentApi, noDataRenderer: node.props.noDataTemplate &&
|
|
184
|
+
const tableContent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(TableContext_1.TableContext.Provider, { value: tableContextValue, children: renderChild(node.children) }, tableKey), (0, jsx_runtime_1.jsx)(TableContext_1.TableContext.Provider, { value: columnRefresherContextValue, children: renderChild(node.children) }), (0, jsx_runtime_1.jsx)(TableNative_1.Table, { ref: ref, data: data, columns: columns, pageSizes: extractValue(node.props.pageSizes), rowsSelectable: extractValue.asOptionalBoolean(node.props.rowsSelectable), registerComponentApi: registerComponentApi, noDataRenderer: node.props.noDataTemplate &&
|
|
185
185
|
(() => {
|
|
186
186
|
return renderChild(node.props.noDataTemplate);
|
|
187
187
|
}), hideNoDataView: node.props.noDataTemplate === null || node.props.noDataTemplate === "", loading: extractValue.asOptionalBoolean(node.props.loading), isPaginated: extractValue.asOptionalBoolean((_a = node.props) === null || _a === void 0 ? void 0 : _a.isPaginated), headerHeight: extractValue.asSize(node.props.headerHeight), rowDisabledPredicate: lookupSyncCallback(node.props.rowDisabledPredicate), sortBy: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.sortBy), sortingDirection: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.sortDirection), iconSortAsc: extractValue.asOptionalString((_d = node.props) === null || _d === void 0 ? void 0 : _d.iconSortAsc), iconSortDesc: extractValue.asOptionalString((_e = node.props) === null || _e === void 0 ? void 0 : _e.iconSortDesc), iconNoSort: extractValue.asOptionalString((_f = node.props) === null || _f === void 0 ? void 0 : _f.iconNoSort), sortingDidChange: lookupEventHandler("sortingDidChange"), onSelectionDidChange: lookupEventHandler("selectionDidChange"), willSort: lookupEventHandler("willSort"), style: layoutCss, uid: node.uid, autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), hideHeader: extractValue.asOptionalBoolean(node.props.hideHeader), enableMultiRowSelection: extractValue.asOptionalBoolean(node.props.enableMultiRowSelection), alwaysShowSelectionHeader: extractValue.asOptionalBoolean(node.props.alwaysShowSelectionHeader) })] }));
|
|
@@ -189,7 +189,7 @@ const TableWithColumns = ({ extractValue, node, renderChild, lookupEventHandler,
|
|
|
189
189
|
return (0, jsx_runtime_1.jsx)(SelectionStoreNative_1.StandaloneSelectionStore, { children: tableContent });
|
|
190
190
|
}
|
|
191
191
|
return tableContent;
|
|
192
|
-
};
|
|
192
|
+
});
|
|
193
193
|
exports.tableComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.TableMd, ({ extractValue, node, renderChild, lookupEventHandler, lookupSyncCallback, layoutCss, registerComponentApi, }) => {
|
|
194
194
|
return ((0, jsx_runtime_1.jsx)(TableWithColumns, { node: node, extractValue: extractValue, lookupEventHandler: lookupEventHandler, lookupSyncCallback: lookupSyncCallback, layoutCss: layoutCss, renderChild: renderChild, registerComponentApi: registerComponentApi }));
|
|
195
195
|
});
|
|
@@ -20,35 +20,39 @@ const ComponentDecorator = (0, react_1.forwardRef)((props, forwardedRef) => {
|
|
|
20
20
|
const prevSiblingRef = (0, react_1.useRef)(null);
|
|
21
21
|
const nextSiblingRef = (0, react_1.useRef)(null);
|
|
22
22
|
const { onTargetMounted } = props;
|
|
23
|
-
const
|
|
24
|
-
const [foundNode, setFoundNode] = (0, react_1.useState)(null);
|
|
23
|
+
const foundNode = (0, react_1.useRef)(null);
|
|
25
24
|
const itemRef = (0, react_1.useRef)(null);
|
|
25
|
+
const [handlesItemRefs, setHandlesItemRefs] = (0, react_1.useState)(false);
|
|
26
26
|
const itemRefCallback = (0, react_1.useCallback)((node) => {
|
|
27
27
|
itemRef.current = node;
|
|
28
28
|
if (node !== null) {
|
|
29
29
|
onTargetMounted === null || onTargetMounted === void 0 ? void 0 : onTargetMounted();
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
setHandlesItemRefs(true);
|
|
32
32
|
}, [onTargetMounted]);
|
|
33
|
+
const [_, setForceRender] = (0, react_1.useState)(0);
|
|
33
34
|
const shallowAttrs = (0, hooks_1.useShallowCompareMemoize)(props.attr);
|
|
34
|
-
const shouldRenderHelperSpan = !props.allowOnlyRefdChild && !
|
|
35
|
+
const shouldRenderHelperSpan = !props.allowOnlyRefdChild && !handlesItemRefs;
|
|
35
36
|
// --- When the component mounts, we add the attributes to the component's DOM node
|
|
36
37
|
(0, react_1.useLayoutEffect)(() => {
|
|
37
38
|
let node;
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
node = foundNode;
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
node =
|
|
44
|
-
(prevSiblingRef.current.nextElementSibling === nextSiblingRef.current
|
|
45
|
-
? null
|
|
46
|
-
: prevSiblingRef.current.nextElementSibling) || null;
|
|
47
|
-
setFoundNode(node);
|
|
48
|
-
}
|
|
39
|
+
if (handlesItemRefs) {
|
|
40
|
+
node = itemRef.current;
|
|
49
41
|
}
|
|
50
42
|
else {
|
|
51
|
-
|
|
43
|
+
if (shouldRenderHelperSpan) {
|
|
44
|
+
if (foundNode.current) {
|
|
45
|
+
node = foundNode.current;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
node =
|
|
49
|
+
(prevSiblingRef.current.nextElementSibling === nextSiblingRef.current
|
|
50
|
+
? null
|
|
51
|
+
: prevSiblingRef.current.nextElementSibling) || null;
|
|
52
|
+
foundNode.current = node;
|
|
53
|
+
setForceRender((prev) => prev++);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
52
56
|
}
|
|
53
57
|
if (node) {
|
|
54
58
|
Object.entries(shallowAttrs).forEach(([key, value]) => {
|
|
@@ -60,9 +64,9 @@ const ComponentDecorator = (0, react_1.forwardRef)((props, forwardedRef) => {
|
|
|
60
64
|
}
|
|
61
65
|
});
|
|
62
66
|
}
|
|
63
|
-
}, [shouldRenderHelperSpan, shallowAttrs,
|
|
64
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!foundNode && shouldRenderHelperSpan && (0, jsx_runtime_1.jsx)("span", { style: HIDDEN_STYLE, ref: prevSiblingRef }), (0, react_1.cloneElement)(props.children, {
|
|
67
|
+
}, [shouldRenderHelperSpan, shallowAttrs, handlesItemRefs]);
|
|
68
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!foundNode.current && shouldRenderHelperSpan && ((0, jsx_runtime_1.jsx)("span", { style: HIDDEN_STYLE, ref: prevSiblingRef })), (0, react_1.cloneElement)(props.children, {
|
|
65
69
|
ref: forwardedRef ? (0, react_compose_refs_1.composeRefs)(itemRefCallback, forwardedRef) : itemRefCallback,
|
|
66
|
-
}), !foundNode && shouldRenderHelperSpan && (0, jsx_runtime_1.jsx)("span", { style: HIDDEN_STYLE, ref: nextSiblingRef })] }));
|
|
70
|
+
}), !foundNode.current && shouldRenderHelperSpan && ((0, jsx_runtime_1.jsx)("span", { style: HIDDEN_STYLE, ref: nextSiblingRef }))] }));
|
|
67
71
|
});
|
|
68
72
|
exports.default = ComponentDecorator;
|
|
@@ -147,7 +147,7 @@ function InspectButton({ inspectId, node }) {
|
|
|
147
147
|
}, [inspectId]);
|
|
148
148
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [visible &&
|
|
149
149
|
!!root &&
|
|
150
|
-
(0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, Object.assign({
|
|
150
|
+
(0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, Object.assign({ variant: "ghost", className: (0, classnames_1.default)(InspectorButton_module_scss_1.default.wrapper, "_debug-inspect-button"), ref: (el) => setPopperElement(el), style: Object.assign(Object.assign({}, popperStyles.popper), { padding: 0 }) }, attributes.popper, { onMouseEnter: () => {
|
|
151
151
|
hoverRef.current = true;
|
|
152
152
|
if (timeoutRef.current) {
|
|
153
153
|
clearTimeout(timeoutRef.current);
|
|
@@ -158,7 +158,7 @@ function InspectButton({ inspectId, node }) {
|
|
|
158
158
|
setVisible(false);
|
|
159
159
|
}, onClick: () => {
|
|
160
160
|
setShowCode(true);
|
|
161
|
-
} })), root), showCode && (0, jsx_runtime_1.jsx)(InspectModal, { onClose: () => setShowCode(false), node: node })] }));
|
|
161
|
+
}, children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "inspect", size: "md" }) })), root), showCode && (0, jsx_runtime_1.jsx)(InspectModal, { onClose: () => setShowCode(false), node: node })] }));
|
|
162
162
|
}
|
|
163
163
|
function useInspector(node, uid) {
|
|
164
164
|
var _a;
|
|
@@ -171,7 +171,7 @@ const ComponentAdapter = (0, react_1.forwardRef)(function ComponentAdapter(_a, r
|
|
|
171
171
|
// ...layoutContextRef?.current,
|
|
172
172
|
// mediaSize: appContext.mediaSize,
|
|
173
173
|
// });
|
|
174
|
-
}, [appContext.mediaSize, layoutContextRef, safeNode.props,
|
|
174
|
+
}, [appContext.mediaSize, layoutContextRef, safeNode.props, valueExtractor]);
|
|
175
175
|
// --- As compileLayout generates new cssProps and nonCssProps objects every time, we need to
|
|
176
176
|
// --- memoize them using shallow comparison to avoid unnecessary re-renders.
|
|
177
177
|
const stableLayoutCss = (0, hooks_1.useShallowCompareMemoize)(cssProps);
|
|
@@ -247,7 +247,7 @@ const ComponentAdapter = (0, react_1.forwardRef)(function ComponentAdapter(_a, r
|
|
|
247
247
|
if ((ref || !(0, lodash_es_1.isEmpty)(mouseEventHandlers)) && renderedNode && react_1.default.isValidElement(renderedNode)) {
|
|
248
248
|
// --- For radix UI/accessibility, read more here:
|
|
249
249
|
// --- https://www.radix-ui.com/primitives/docs/guides/composition
|
|
250
|
-
return (0, react_1.cloneElement)(renderedNode, Object.assign({ ref: ref ? (0, react_compose_refs_1.composeRefs)(ref, renderedNode.ref) :
|
|
250
|
+
return (0, react_1.cloneElement)(renderedNode, Object.assign({ ref: ref ? (0, react_compose_refs_1.composeRefs)(ref, renderedNode.ref) : renderedNode.ref }, (0, mergeProps_1.mergeProps)(Object.assign(Object.assign({}, renderedNode.props), mouseEventHandlers), rest)));
|
|
251
251
|
}
|
|
252
252
|
// --- If the rendering resulted in multiple React nodes, wrap them in a fragment.
|
|
253
253
|
return react_1.default.isValidElement(renderedNode) ? renderedNode : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: renderedNode });
|
|
@@ -392,7 +392,7 @@ exports.Container = (0, react_1.memo)((0, react_1.forwardRef)(function Container
|
|
|
392
392
|
delete fnsRef.current[uid];
|
|
393
393
|
});
|
|
394
394
|
// --- The container wraps the `renderChild` function to provide that to the child components
|
|
395
|
-
const stableRenderChild = (0, react_1.useCallback)((childNode, lc, pRenderContext, uidInfoRef) => {
|
|
395
|
+
const stableRenderChild = (0, react_1.useCallback)((childNode, lc, pRenderContext, uidInfoRef, ref) => {
|
|
396
396
|
// TODO: Check if this is a valid use case
|
|
397
397
|
if (typeof childNode === "string") {
|
|
398
398
|
throw Error("should be resolved for now");
|
|
@@ -412,7 +412,7 @@ exports.Container = (0, react_1.memo)((0, react_1.forwardRef)(function Container
|
|
|
412
412
|
return undefined;
|
|
413
413
|
}
|
|
414
414
|
// --- Invoke the jolly-joker `renderChild` function to render the child. Note that
|
|
415
|
-
// --- in
|
|
415
|
+
// --- in the context, we pass the `stableRenderChild` function, so the child can
|
|
416
416
|
// --- render its children recursively.
|
|
417
417
|
const renderedChild = (0, renderChild_1.renderChild)({
|
|
418
418
|
node: child,
|
|
@@ -474,7 +474,6 @@ exports.Container = (0, react_1.memo)((0, react_1.forwardRef)(function Container
|
|
|
474
474
|
statePartChanged,
|
|
475
475
|
memoedVarsRef,
|
|
476
476
|
cleanup,
|
|
477
|
-
ref,
|
|
478
477
|
]);
|
|
479
478
|
// --- Log the component state if you need it for debugging
|
|
480
479
|
if ((_a = node.props) === null || _a === void 0 ? void 0 : _a.debug) {
|
|
@@ -492,37 +491,25 @@ exports.Container = (0, react_1.memo)((0, react_1.forwardRef)(function Container
|
|
|
492
491
|
const debugContext = (0, DebugViewProvider_1.useDebugView)();
|
|
493
492
|
const stateViewProps = debugContext === null || debugContext === void 0 ? void 0 : debugContext.stateViewOptions;
|
|
494
493
|
const showContainer = stateViewProps && debugContext.displayStateView;
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
componentState,
|
|
515
|
-
memoedVarsRef,
|
|
516
|
-
//if it's an api bound container, we always use this container, otherwise use the parent if it's an implicit one
|
|
517
|
-
dispatch: apiBoundContainer ? containerDispatch : dispatch,
|
|
518
|
-
registerComponentApi: apiBoundContainer
|
|
519
|
-
? containerRegisterComponentApi
|
|
520
|
-
: registerComponentApi,
|
|
521
|
-
appContext,
|
|
522
|
-
lookupAction,
|
|
523
|
-
lookupSyncCallback,
|
|
524
|
-
cleanup,
|
|
525
|
-
}), stableRenderChild(node.children, layoutContextRef === null || layoutContextRef === void 0 ? void 0 : layoutContextRef.current, parentRenderContext, uidInfoRef)] }))] }, node.uid
|
|
494
|
+
const renderedChildren = stableRenderChild(node.children, layoutContextRef === null || layoutContextRef === void 0 ? void 0 : layoutContextRef.current, parentRenderContext, uidInfoRef, ref);
|
|
495
|
+
const renderedLoaders = renderLoaders({
|
|
496
|
+
uidInfo,
|
|
497
|
+
uidInfoRef,
|
|
498
|
+
loaders: node.loaders,
|
|
499
|
+
componentState,
|
|
500
|
+
memoedVarsRef,
|
|
501
|
+
//if it's an api bound container, we always use this container, otherwise use the parent if it's an implicit one
|
|
502
|
+
dispatch: apiBoundContainer ? containerDispatch : dispatch,
|
|
503
|
+
registerComponentApi: apiBoundContainer
|
|
504
|
+
? containerRegisterComponentApi
|
|
505
|
+
: registerComponentApi,
|
|
506
|
+
appContext,
|
|
507
|
+
lookupAction,
|
|
508
|
+
lookupSyncCallback,
|
|
509
|
+
cleanup,
|
|
510
|
+
});
|
|
511
|
+
const containerContent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [renderedLoaders, renderedChildren] }));
|
|
512
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [showContainer && ((0, jsx_runtime_1.jsx)(StateViewerNative_1.StateViewer, { state: componentState, showBoundary: stateViewProps === null || stateViewProps === void 0 ? void 0 : stateViewProps.showBoundary, blink: stateViewProps === null || stateViewProps === void 0 ? void 0 : stateViewProps.blink, children: containerContent })), !showContainer && containerContent] }, node.uid
|
|
526
513
|
? `${resolvedKey}>${(0, extractParam_1.extractParam)(componentState, node.uid, appContext, true)}`
|
|
527
514
|
: undefined));
|
|
528
515
|
}));
|