xmlui 0.9.79 → 0.9.80

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.
Files changed (30) hide show
  1. package/dist/lib/{index-Tct7bB50.mjs → index-DO8H2Odv.mjs} +19057 -14093
  2. package/dist/lib/index.css +1 -1
  3. package/dist/lib/{initMock-CXDXFOVS.mjs → initMock-CYAkCVnp.mjs} +1 -1
  4. package/dist/lib/xmlui.d.ts +11 -9
  5. package/dist/lib/xmlui.mjs +1 -1
  6. package/dist/metadata/{collectedComponentMetadata-CJAnOboV.mjs → collectedComponentMetadata-uE4L7cM3.mjs} +23618 -18663
  7. package/dist/metadata/{initMock-D7yOIx8z.mjs → initMock-CqvnqrIU.mjs} +1 -1
  8. package/dist/metadata/style.css +1 -1
  9. package/dist/metadata/xmlui-metadata.mjs +1 -1
  10. package/dist/metadata/xmlui-metadata.umd.js +135 -123
  11. package/dist/scripts/package.json +1 -1
  12. package/dist/scripts/src/components/FormItem/FormItem.js +21 -2
  13. package/dist/scripts/src/components/FormItem/FormItemNative.js +2 -2
  14. package/dist/scripts/src/components/Markdown/MarkdownNative.js +4 -3
  15. package/dist/scripts/src/components/NestedApp/AppWithCodeViewNative.js +7 -6
  16. package/dist/scripts/src/components/NumberBox/NumberBox.js +6 -1
  17. package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +1 -0
  18. package/dist/scripts/src/components-core/ComponentViewer.js +66 -0
  19. package/dist/scripts/src/components-core/InspectorContext.js +0 -15
  20. package/dist/scripts/src/components-core/abstractions/standalone.js +2 -0
  21. package/dist/scripts/src/components-core/devtools/InspectorDialog.js +135 -0
  22. package/dist/scripts/src/components-core/rendering/AppWrapper.js +5 -2
  23. package/dist/scripts/src/language-server/services/common/metadata-utils.js +157 -0
  24. package/dist/scripts/src/parsers/xmlui-parser/index.js +29 -0
  25. package/dist/scripts/src/parsers/xmlui-parser/lint.js +165 -0
  26. package/dist/scripts/src/parsers/xmlui-parser/xmlui-serializer.js +582 -0
  27. package/dist/scripts/src/parsers/xmlui-parser/xmlui-tree.js +2 -0
  28. package/dist/standalone/xmlui-standalone.es.d.ts +11 -9
  29. package/dist/standalone/xmlui-standalone.umd.js +277 -265
  30. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmlui",
3
- "version": "0.9.79",
3
+ "version": "0.9.80",
4
4
  "sideEffects": false,
5
5
  "scripts": {
6
6
  "start-test-bed": "cd src/testing/infrastructure && xmlui start",
@@ -19,6 +19,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
19
19
  const FormItem_module_scss_1 = __importDefault(require("./FormItem.module.scss"));
20
20
  const renderers_1 = require("../../components-core/renderers");
21
21
  const themeVars_1 = require("../../components-core/theming/themeVars");
22
+ const react_1 = require("react");
22
23
  const FormContext_1 = require("../Form/FormContext");
23
24
  const metadata_helpers_1 = require("../metadata-helpers");
24
25
  const Validations_1 = require("./Validations");
@@ -193,7 +194,7 @@ exports.formItemComponentRenderer = (0, renderers_1.createComponentRenderer)(COM
193
194
  var _a;
194
195
  const _b = node.props, { bindTo, autoFocus, label, labelPosition, labelWidth, labelBreak, enabled, required, type, requiredInvalidMessage, minLength, maxLength, lengthInvalidMessage, lengthInvalidSeverity, minValue, maxValue, rangeInvalidMessage, rangeInvalidSeverity, pattern, patternInvalidMessage, patternInvalidSeverity, regex, regexInvalidMessage, regexInvalidSeverity, customValidationsDebounce, validationMode, maxTextLength, gap } = _b, rest = __rest(_b, ["bindTo", "autoFocus", "label", "labelPosition", "labelWidth", "labelBreak", "enabled", "required", "type", "requiredInvalidMessage", "minLength", "maxLength", "lengthInvalidMessage", "lengthInvalidSeverity", "minValue", "maxValue", "rangeInvalidMessage", "rangeInvalidSeverity", "pattern", "patternInvalidMessage", "patternInvalidSeverity", "regex", "regexInvalidMessage", "regexInvalidSeverity", "customValidationsDebounce", "validationMode", "maxTextLength", "gap"]);
195
196
  //extractValue works as a memoization mechanism too (if there's nothing to resolve, it won't produce a new object every time)
196
- const resolvedValidationPropsAndEvents = {
197
+ const resolvedValidationPropsAndEvents = (0, react_1.useMemo)(() => ({
197
198
  required: extractValue.asOptionalBoolean(required),
198
199
  requiredInvalidMessage: extractValue.asOptionalString(requiredInvalidMessage),
199
200
  minLength: extractValue.asOptionalNumber(minLength),
@@ -210,7 +211,25 @@ exports.formItemComponentRenderer = (0, renderers_1.createComponentRenderer)(COM
210
211
  regex: extractValue.asOptionalString(regex),
211
212
  regexInvalidMessage: extractValue.asOptionalString(regexInvalidMessage),
212
213
  regexInvalidSeverity: (0, Validations_1.parseSeverity)(extractValue.asOptionalString(regexInvalidSeverity)),
213
- };
214
+ }), [
215
+ required,
216
+ requiredInvalidMessage,
217
+ minLength,
218
+ maxLength,
219
+ lengthInvalidMessage,
220
+ lengthInvalidSeverity,
221
+ minValue,
222
+ maxValue,
223
+ rangeInvalidMessage,
224
+ rangeInvalidSeverity,
225
+ pattern,
226
+ patternInvalidMessage,
227
+ patternInvalidSeverity,
228
+ regex,
229
+ regexInvalidMessage,
230
+ regexInvalidSeverity,
231
+ extractValue,
232
+ ]);
214
233
  const nonLayoutCssProps = !layoutCss
215
234
  ? rest
216
235
  : Object.fromEntries(Object.entries(rest).filter(([key, _]) => {
@@ -142,7 +142,7 @@ exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
142
142
  }
143
143
  case "number":
144
144
  case "integer": {
145
- formControl = ((0, jsx_runtime_1.jsx)(NumberBoxNative_1.NumberBox, Object.assign({}, rest, { value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, integersOnly: type === "integer", validationStatus: validationStatus, min: validations.minValue, max: validations.maxValue, maxLength: maxTextLength !== null && maxTextLength !== void 0 ? maxTextLength : validations === null || validations === void 0 ? void 0 : validations.maxLength, gap: gap })));
145
+ formControl = ((0, jsx_runtime_1.jsx)(NumberBoxNative_1.NumberBox, Object.assign({}, rest, { initialValue: initialValue, value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, integersOnly: type === "integer", validationStatus: validationStatus, min: validations.minValue, max: validations.maxValue, maxLength: maxTextLength !== null && maxTextLength !== void 0 ? maxTextLength : validations === null || validations === void 0 ? void 0 : validations.maxLength, gap: gap })));
146
146
  break;
147
147
  }
148
148
  // NOTE: This is a prototype for the new number field
@@ -150,7 +150,7 @@ exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
150
150
  // in production.
151
151
  case "integer2":
152
152
  case "number2": {
153
- formControl = ((0, jsx_runtime_1.jsx)(NumberBox2Native_1.NumberBox2, Object.assign({}, rest, { value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, min: validations.minValue, max: validations.maxValue, integersOnly: type === "integer2" })));
153
+ formControl = ((0, jsx_runtime_1.jsx)(NumberBox2Native_1.NumberBox2, Object.assign({}, rest, { initialValue: initialValue, value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, min: validations.minValue, max: validations.maxValue, integersOnly: type === "integer2" })));
154
154
  break;
155
155
  }
156
156
  case "switch":
@@ -74,16 +74,17 @@ exports.defaultProps = {
74
74
  removeIndents: true,
75
75
  };
76
76
  function PreTagComponent({ id, children, codeHighlighter }) {
77
+ var _a, _b;
77
78
  // TEMP: After ironing out theming for syntax highlighting, this should be removed
78
79
  const { activeThemeTone } = (0, ThemeContext_1.useTheme)();
79
- const { appGlobals } = (0, AppContext_1.useAppContext)();
80
+ const appContext = (0, AppContext_1.useAppContext)();
80
81
  let _codeHighlighter = null;
81
82
  if (codeHighlighter) {
82
83
  _codeHighlighter = codeHighlighter;
83
84
  }
84
85
  else {
85
- _codeHighlighter = (0, highlight_code_1.isCodeHighlighter)(appGlobals.codeHighlighter)
86
- ? appGlobals.codeHighlighter
86
+ _codeHighlighter = (0, highlight_code_1.isCodeHighlighter)((_a = appContext === null || appContext === void 0 ? void 0 : appContext.appGlobals) === null || _a === void 0 ? void 0 : _a.codeHighlighter)
87
+ ? (_b = appContext === null || appContext === void 0 ? void 0 : appContext.appGlobals) === null || _b === void 0 ? void 0 : _b.codeHighlighter
87
88
  : null;
88
89
  }
89
90
  const defaultCodefence = ((0, jsx_runtime_1.jsx)(CodeBlockNative_1.CodeBlock, { children: (0, jsx_runtime_1.jsx)(TextNative_1.Text, { uid: id, variant: "codefence", children: children }) }));
@@ -29,11 +29,12 @@ const logo_svg_react_1 = __importDefault(require("./logo.svg?react"));
29
29
  /**
30
30
  * A component that displays markdown content on the left and a NestedApp on the right
31
31
  */
32
- function AppWithCodeViewNative({ markdown, splitView, withFrame = true, noHeader = false, initiallyShowCode = false, popOutUrl, app, api, components = [], config, activeTone, activeTheme, title, height, allowPlaygroundPopup, withSplashScreen, immediate }) {
32
+ function AppWithCodeViewNative({ markdown, splitView, withFrame = true, noHeader = false, initiallyShowCode = false, popOutUrl, app, api, components = [], config, activeTone, activeTheme, title, height, allowPlaygroundPopup, withSplashScreen, immediate, closeButton = null, controlsWidth, }) {
33
+ var _a;
33
34
  const [showCode, setShowCode] = (0, react_1.useState)(initiallyShowCode);
34
- const { appGlobals } = (0, AppContext_1.useAppContext)();
35
+ const appContext = (0, AppContext_1.useAppContext)();
35
36
  const [refreshVersion, setRefreshVersion] = (0, react_1.useState)(0);
36
- const safePopOutUrl = (0, utils_1.withoutTrailingSlash)(popOutUrl || (appGlobals === null || appGlobals === void 0 ? void 0 : appGlobals.popOutUrl) || "https://docs.xmlui.com/#/playground");
37
+ const safePopOutUrl = (0, utils_1.withoutTrailingSlash)(popOutUrl || ((_a = appContext === null || appContext === void 0 ? void 0 : appContext.appGlobals) === null || _a === void 0 ? void 0 : _a.popOutUrl) || "https://docs.xmlui.com/#/playground");
37
38
  const openPlayground = (0, react_1.useCallback)(() => __awaiter(this, void 0, void 0, function* () {
38
39
  const data = {
39
40
  standalone: {
@@ -60,18 +61,18 @@ function AppWithCodeViewNative({ markdown, splitView, withFrame = true, noHeader
60
61
  window.open(`${safePopOutUrl}/#${appQueryString}`, "_blank");
61
62
  }), [app, components, title, activeTheme, api, activeTone, safePopOutUrl]);
62
63
  if (withFrame) {
63
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!!markdown && !splitView && (0, jsx_runtime_1.jsx)(Markdown_1.Markdown, { children: markdown }), (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.nestedAppContainer, style: { height }, children: [!noHeader && ((0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.header, children: [!splitView && (0, jsx_runtime_1.jsx)("span", { className: NestedApp_module_scss_1.default.headerText, children: title }), splitView && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: NestedApp_module_scss_1.default.wrapper, children: (0, jsx_runtime_1.jsx)(logo_svg_react_1.default, { className: NestedApp_module_scss_1.default.logo }) }), (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.viewControls, children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: () => setShowCode(true), className: (0, classnames_1.default)(NestedApp_module_scss_1.default.splitViewButton, {
64
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!!markdown && !splitView && (0, jsx_runtime_1.jsx)(Markdown_1.Markdown, { children: markdown }), (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.nestedAppContainer, style: { height }, children: [!noHeader && ((0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.header, children: [!splitView && (0, jsx_runtime_1.jsx)("span", { className: NestedApp_module_scss_1.default.headerText, children: title }), splitView && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: NestedApp_module_scss_1.default.wrapper, style: { width: controlsWidth }, children: (0, jsx_runtime_1.jsx)(logo_svg_react_1.default, { className: NestedApp_module_scss_1.default.logo }) }), (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.viewControls, children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: () => setShowCode(true), className: (0, classnames_1.default)(NestedApp_module_scss_1.default.splitViewButton, {
64
65
  [NestedApp_module_scss_1.default.show]: showCode,
65
66
  [NestedApp_module_scss_1.default.hide]: !showCode,
66
67
  }), children: "XML" }), (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: () => setShowCode(false), className: (0, classnames_1.default)(NestedApp_module_scss_1.default.splitViewButton, {
67
68
  [NestedApp_module_scss_1.default.show]: !showCode,
68
69
  [NestedApp_module_scss_1.default.hide]: showCode,
69
- }), children: "UI" })] })] })), (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.wrapper, children: [allowPlaygroundPopup && ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
70
+ }), children: "UI" })] })] })), (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.wrapper, style: { width: controlsWidth }, children: [allowPlaygroundPopup && ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
70
71
  openPlayground();
71
72
  }, children: (0, jsx_runtime_1.jsx)(rx_1.RxOpenInNewWindow, {}) }), label: "View and edit in new full-width window" })), (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
72
73
  setShowCode(false);
73
74
  setRefreshVersion(refreshVersion + 1);
74
- }, children: (0, jsx_runtime_1.jsx)(lia_1.LiaUndoAltSolid, {}) }), label: "Reset the app" })] })] })), (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.contentContainer, children: [(0, jsx_runtime_1.jsx)(Markdown_1.Markdown, { className: (0, classnames_1.default)(NestedApp_module_scss_1.default.splitViewMarkdown, { [NestedApp_module_scss_1.default.hidden]: !showCode }), children: markdown }), (0, jsx_runtime_1.jsx)(NestedAppNative_1.IndexAwareNestedApp, { className: (0, classnames_1.default)({ [NestedApp_module_scss_1.default.hidden]: showCode }), height: "100%", app: app, api: api, components: components, config: config, activeTone: activeTone, activeTheme: activeTheme, refreshVersion: refreshVersion, withSplashScreen: withSplashScreen, immediate: immediate })] })] })] }));
75
+ }, children: (0, jsx_runtime_1.jsx)(lia_1.LiaUndoAltSolid, {}) }), label: "Reset the app" }), closeButton] })] })), (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.contentContainer, children: [(0, jsx_runtime_1.jsx)(Markdown_1.Markdown, { className: (0, classnames_1.default)(NestedApp_module_scss_1.default.splitViewMarkdown, { [NestedApp_module_scss_1.default.hidden]: !showCode }), children: markdown }), (0, jsx_runtime_1.jsx)(NestedAppNative_1.IndexAwareNestedApp, { className: (0, classnames_1.default)({ [NestedApp_module_scss_1.default.hidden]: showCode }), height: "100%", app: app, api: api, components: components, config: config, activeTone: activeTone, activeTheme: activeTheme, refreshVersion: refreshVersion, withSplashScreen: withSplashScreen, immediate: immediate })] })] })] }));
75
76
  }
76
77
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!!markdown && (0, jsx_runtime_1.jsx)(Markdown_1.Markdown, { children: markdown }), (0, jsx_runtime_1.jsx)(NestedAppNative_1.IndexAwareNestedApp, { height: height, app: app, api: api, components: components, config: config, activeTone: activeTone, activeTheme: activeTheme, refreshVersion: refreshVersion, withSplashScreen: withSplashScreen, immediate: immediate })] }));
77
78
  }
@@ -85,5 +85,10 @@ exports.NumberBoxMd = (0, metadata_helpers_1.createMetadata)({
85
85
  themeVars: (0, themeVars_1.parseScssVar)(NumberBox_module_scss_1.default.themeVars),
86
86
  });
87
87
  exports.numberBoxComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.NumberBoxMd, ({ node, state, updateState, lookupEventHandler, extractValue, layoutCss, registerComponentApi, }) => {
88
- return ((0, jsx_runtime_1.jsx)(NumberBoxNative_1.NumberBox, { style: layoutCss, value: state === null || state === void 0 ? void 0 : state.value, initialValue: extractValue.asOptionalString(node.props.initialValue), step: extractValue(node.props.step), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, hasSpinBox: extractValue.asOptionalBoolean(node.props.hasSpinBox), integersOnly: extractValue.asOptionalBoolean(node.props.integersOnly), zeroOrPositive: extractValue.asOptionalBoolean(node.props.zeroOrPositive), min: extractValue.asOptionalNumber(node.props.minValue), max: extractValue.asOptionalNumber(node.props.maxValue), startText: extractValue.asOptionalString(node.props.startText), startIcon: extractValue.asOptionalString(node.props.startIcon), endText: extractValue.asOptionalString(node.props.endText), gap: extractValue.asOptionalString(node.props.gap), endIcon: extractValue.asOptionalString(node.props.endIcon), spinnerUpIcon: extractValue.asOptionalString(node.props.spinnerUpIcon), spinnerDownIcon: extractValue.asOptionalString(node.props.spinnerDownIcon), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), maxLength: extractValue(node.props.maxLength), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required) }));
88
+ // --- Handle initial value as a number
89
+ let extractedInitialValue = extractValue(node.props.initialValue);
90
+ if (typeof extractedInitialValue === "string" && !isNaN(parseFloat(extractedInitialValue))) {
91
+ extractedInitialValue = Number(extractedInitialValue);
92
+ }
93
+ return ((0, jsx_runtime_1.jsx)(NumberBoxNative_1.NumberBox, { style: layoutCss, value: state === null || state === void 0 ? void 0 : state.value, initialValue: extractedInitialValue, step: extractValue(node.props.step), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, hasSpinBox: extractValue.asOptionalBoolean(node.props.hasSpinBox), integersOnly: extractValue.asOptionalBoolean(node.props.integersOnly), zeroOrPositive: extractValue.asOptionalBoolean(node.props.zeroOrPositive), min: extractValue.asOptionalNumber(node.props.minValue), max: extractValue.asOptionalNumber(node.props.maxValue), startText: extractValue.asOptionalString(node.props.startText), startIcon: extractValue.asOptionalString(node.props.startIcon), endText: extractValue.asOptionalString(node.props.endText), gap: extractValue.asOptionalString(node.props.gap), endIcon: extractValue.asOptionalString(node.props.endIcon), spinnerUpIcon: extractValue.asOptionalString(node.props.spinnerUpIcon), spinnerDownIcon: extractValue.asOptionalString(node.props.spinnerDownIcon), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), maxLength: extractValue(node.props.maxLength), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required) }));
89
94
  });
@@ -63,6 +63,7 @@ exports.defaultProps = {
63
63
  onBlur: constants_1.noop,
64
64
  };
65
65
  exports.NumberBox = (0, react_1.forwardRef)(function NumberBox({ id, value, initialValue, style, enabled = exports.defaultProps.enabled, placeholder, validationStatus = exports.defaultProps.validationStatus, hasSpinBox = exports.defaultProps.hasSpinBox, step, integersOnly = exports.defaultProps.integersOnly, zeroOrPositive = exports.defaultProps.zeroOrPositive, min = zeroOrPositive ? 0 : exports.defaultProps.min, max = exports.defaultProps.max, maxLength, updateState = exports.defaultProps.updateState, onDidChange = exports.defaultProps.onDidChange, onFocus = exports.defaultProps.onFocus, onBlur = exports.defaultProps.onBlur, registerComponentApi, startText, startIcon, endText, endIcon, gap, spinnerUpIcon, spinnerDownIcon, autoFocus, readOnly, required, label, labelPosition, labelWidth, labelBreak, }, forwardedRef) {
66
+ // --- Ensure the provided value is a number or null
66
67
  var _a;
67
68
  // Ensure the provided minimum is not smaller than the 0 if zeroOrPositive is set to true
68
69
  min = Math.max(zeroOrPositive ? 0 : -numberbox_abstractions_1.NUMBERBOX_MAX_VALUE, min);
@@ -0,0 +1,66 @@
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.ComponentViewer = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const InspectorDialog_1 = require("./devtools/InspectorDialog");
9
+ const AppWithCodeViewNative_1 = __importDefault(require("../components/NestedApp/AppWithCodeViewNative"));
10
+ const react_1 = require("react");
11
+ const InspectorContext_1 = require("./InspectorContext");
12
+ const Tooltip_1 = require("../components/NestedApp/Tooltip");
13
+ const NestedApp_module_scss_1 = __importDefault(require("../components/NestedApp/NestedApp.module.scss"));
14
+ const ai_1 = require("react-icons/ai");
15
+ const ComponentViewer = () => {
16
+ const { mockApi, setIsOpen, isOpen, inspectedNode, clickPosition, projectCompilation, sources } = (0, InspectorContext_1.useDevTools)();
17
+ const components = (0, react_1.useMemo)(() => {
18
+ if (!projectCompilation) {
19
+ return [];
20
+ }
21
+ return projectCompilation.components.map((component) => {
22
+ return component.markupSource;
23
+ });
24
+ }, [projectCompilation]);
25
+ const value = (0, react_1.useMemo)(() => {
26
+ var _a;
27
+ const compSrc = (_a = inspectedNode === null || inspectedNode === void 0 ? void 0 : inspectedNode.debug) === null || _a === void 0 ? void 0 : _a.source;
28
+ if (!compSrc) {
29
+ return "";
30
+ }
31
+ if (!sources) {
32
+ return "";
33
+ }
34
+ const { start, end, fileId } = compSrc;
35
+ const slicedSrc = sources[fileId].slice(start, end);
36
+ let dropEmptyLines = true;
37
+ const prunedLines = [];
38
+ let trimBeginCount = undefined;
39
+ slicedSrc.split("\n").forEach((line) => {
40
+ if (line.trim() === "" && dropEmptyLines) {
41
+ //drop empty lines from the beginning
42
+ return;
43
+ }
44
+ else {
45
+ dropEmptyLines = false;
46
+ prunedLines.push(line);
47
+ const startingWhiteSpaces = line.search(/\S|$/);
48
+ if (line.trim() !== "" &&
49
+ (trimBeginCount === undefined || startingWhiteSpaces < trimBeginCount)) {
50
+ trimBeginCount = startingWhiteSpaces;
51
+ }
52
+ }
53
+ });
54
+ return prunedLines
55
+ .map((line) => line.slice(trimBeginCount).replace(/inspect="true"/g, ""))
56
+ .join("\n");
57
+ }, [inspectedNode, sources]);
58
+ return process.env.VITE_USER_COMPONENTS_Inspect !== "false" &&
59
+ isOpen &&
60
+ inspectedNode !== null ? ((0, jsx_runtime_1.jsx)(InspectorDialog_1.InspectorDialog, { isOpen: isOpen, setIsOpen: setIsOpen, clickPosition: clickPosition, children: (0, jsx_runtime_1.jsx)(AppWithCodeViewNative_1.default, { height: "500px", allowPlaygroundPopup: true, splitView: true, controlsWidth: "120px", closeButton: (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
61
+ setIsOpen(false);
62
+ }, children: (0, jsx_runtime_1.jsx)(ai_1.AiOutlineClose, {}) }), label: "Close" }), markdown: `\`\`\`xmlui
63
+ ${value}
64
+ \`\`\``, api: mockApi, app: value, components: components }) })) : null;
65
+ };
66
+ exports.ComponentViewer = ComponentViewer;
@@ -16,23 +16,17 @@ const ThemeContext_1 = require("./theming/ThemeContext");
16
16
  const classnames_1 = __importDefault(require("classnames"));
17
17
  const ButtonNative_1 = require("../components/Button/ButtonNative");
18
18
  const InspectorButton_module_scss_1 = __importDefault(require("./InspectorButton.module.scss"));
19
- const ComponentRegistryContext_1 = require("../components/ComponentRegistryContext");
20
19
  // --- The context object that is used to store the inspector information.
21
20
  exports.InspectorContext = (0, react_1.createContext)(null);
22
21
  function InspectorProvider({ children, sources, projectCompilation, mockApi, }) {
23
- const { root } = (0, ThemeContext_1.useTheme)();
24
22
  const [inspectable, setInspectable] = (0, react_1.useState)({});
25
23
  const [inspectedNode, setInspectedNode] = (0, react_1.useState)(null);
26
24
  const [showCode, setShowCode] = (0, react_1.useState)(false);
27
- const [devToolsSize, setDevToolsSize] = (0, react_1.useState)(0);
28
- const [devToolsSide, setDevToolsSide] = (0, react_1.useState)("bottom");
29
25
  const [inspectMode, setInspectMode] = (0, react_1.useState)(false);
30
26
  const [clickPosition, setClickPosition] = (0, react_1.useState)({
31
27
  x: 0,
32
28
  y: 0,
33
29
  });
34
- const componentRegistry = (0, ComponentRegistryContext_1.useComponentRegistry)();
35
- const devToolsEntry = componentRegistry.lookupComponentRenderer("XMLUIDevtools.DevTools");
36
30
  const contextValue = (0, react_1.useMemo)(() => {
37
31
  return {
38
32
  sources,
@@ -61,10 +55,6 @@ function InspectorProvider({ children, sources, projectCompilation, mockApi, })
61
55
  inspectedNode,
62
56
  setIsOpen: setShowCode,
63
57
  isOpen: showCode,
64
- devToolsSize,
65
- setDevToolsSize,
66
- devToolsSide,
67
- setDevToolsSide,
68
58
  devToolsEnabled: showCode,
69
59
  projectCompilation: projectCompilation,
70
60
  setInspectMode,
@@ -73,8 +63,6 @@ function InspectorProvider({ children, sources, projectCompilation, mockApi, })
73
63
  clickPosition,
74
64
  };
75
65
  }, [
76
- devToolsSide,
77
- devToolsSize,
78
66
  sources,
79
67
  inspectedNode,
80
68
  showCode,
@@ -85,9 +73,6 @@ function InspectorProvider({ children, sources, projectCompilation, mockApi, })
85
73
  mockApi,
86
74
  ]);
87
75
  return ((0, jsx_runtime_1.jsxs)(exports.InspectorContext.Provider, { value: contextValue, children: [children, process.env.VITE_USER_COMPONENTS_Inspect !== "false" &&
88
- showCode &&
89
- inspectedNode !== null &&
90
- (0, react_dom_1.createPortal)(devToolsEntry === null || devToolsEntry === void 0 ? void 0 : devToolsEntry.renderer({}), root), process.env.VITE_USER_COMPONENTS_Inspect !== "false" &&
91
76
  inspectable &&
92
77
  Object.values(inspectable).map((item) => {
93
78
  return ((0, jsx_runtime_1.jsx)(InspectButton, { inspectedNode: inspectedNode, setShowCode: setShowCode, setClickPosition: setClickPosition, inspectId: item.inspectId, node: item.node, setInspectedNode: setInspectedNode, inspectMode: inspectMode }, item.inspectId + +"-" + item.key));
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.InspectorDialog = void 0;
40
+ const jsx_runtime_1 = require("react/jsx-runtime");
41
+ const react_1 = __importStar(require("react"));
42
+ const react_compose_refs_1 = require("@radix-ui/react-compose-refs");
43
+ const classnames_1 = __importDefault(require("classnames"));
44
+ const Dialog = __importStar(require("@radix-ui/react-dialog"));
45
+ const InspectorDialog_module_scss_1 = __importDefault(require("./InspectorDialog.module.scss"));
46
+ const xmlui_1 = require("xmlui");
47
+ const framer_motion_1 = require("framer-motion");
48
+ // =====================================================================================================================
49
+ // React component definition
50
+ const MotionContent = framer_motion_1.motion.create(Dialog.Content);
51
+ const overlayVariants = {
52
+ visible: { opacity: 1 },
53
+ hidden: { opacity: 0 },
54
+ };
55
+ const contentVariants = {
56
+ initial: (custom) => ({
57
+ opacity: 0,
58
+ scale: 0.2,
59
+ x: custom.x - window.innerWidth / 2,
60
+ y: custom.y - window.innerHeight / 2,
61
+ }),
62
+ animate: {
63
+ opacity: 1,
64
+ scale: 1,
65
+ x: 0,
66
+ y: 0,
67
+ },
68
+ exit: {
69
+ opacity: 0,
70
+ scale: 0.2,
71
+ transition: { duration: 0.2 },
72
+ },
73
+ };
74
+ function durationToSeconds(durationString) {
75
+ if (!durationString) {
76
+ return undefined;
77
+ }
78
+ const trimmedString = durationString.trim();
79
+ if (trimmedString.endsWith("ms")) {
80
+ const milliseconds = parseFloat(trimmedString);
81
+ return milliseconds / 1000;
82
+ }
83
+ else if (trimmedString.endsWith("s")) {
84
+ return parseFloat(trimmedString);
85
+ }
86
+ else {
87
+ return parseFloat(trimmedString);
88
+ }
89
+ }
90
+ exports.InspectorDialog = react_1.default.forwardRef(({ children, style, isOpen, setIsOpen, clickPosition }, ref) => {
91
+ const { root, getThemeVar } = (0, xmlui_1.useTheme)();
92
+ const modalRef = (0, react_1.useRef)(null);
93
+ const composedRef = ref ? (0, react_compose_refs_1.composeRefs)(ref, modalRef) : modalRef;
94
+ const [rendered, setRendered] = (0, react_1.useState)(true);
95
+ (0, react_1.useEffect)(() => {
96
+ var _a;
97
+ if (isOpen) {
98
+ (_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.focus();
99
+ }
100
+ }, [isOpen]);
101
+ // https://github.com/radix-ui/primitives/issues/2122#issuecomment-2140827998
102
+ (0, react_1.useEffect)(() => {
103
+ if (isOpen) {
104
+ // Pushing the change to the end of the call stack
105
+ const timer = setTimeout(() => {
106
+ document.body.style.pointerEvents = "";
107
+ }, 0);
108
+ return () => clearTimeout(timer);
109
+ }
110
+ else {
111
+ document.body.style.pointerEvents = "auto";
112
+ }
113
+ }, [isOpen]);
114
+ if (!root) {
115
+ return null;
116
+ }
117
+ const onExitComplete = () => {
118
+ setIsOpen(false);
119
+ };
120
+ return ((0, jsx_runtime_1.jsx)(Dialog.Root, { defaultOpen: false, open: isOpen, onOpenChange: setRendered, children: (0, jsx_runtime_1.jsx)(Dialog.Portal, { container: root, children: (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { onExitComplete: onExitComplete, children: rendered && ((0, jsx_runtime_1.jsxs)(Dialog.Overlay, { className: InspectorDialog_module_scss_1.default.overlay, forceMount: true, children: [(0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { className: InspectorDialog_module_scss_1.default.overlayBg, variants: overlayVariants, initial: "hidden", animate: "visible", exit: "hidden", transition: {
121
+ duration: 0.2,
122
+ ease: [0.16, 1, 0.3, 1],
123
+ } }, "overlay"), (0, jsx_runtime_1.jsx)(MotionContent, { forceMount: true, onPointerDownOutside: (event) => {
124
+ if (event.target instanceof Element &&
125
+ event.target.closest("._debug-inspect-button") !== null) {
126
+ //we prevent the auto modal close on clicking the inspect button
127
+ event.preventDefault();
128
+ }
129
+ }, children: (0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { ref: composedRef, className: (0, classnames_1.default)(InspectorDialog_module_scss_1.default.content, InspectorDialog_module_scss_1.default.contentWrapper), variants: contentVariants, custom: { x: clickPosition.x, y: clickPosition.y }, initial: "initial", animate: "animate", exit: "exit", transition: {
130
+ duration: durationToSeconds(getThemeVar("duration-startAnimation-ModalDialog")) ||
131
+ 0.8,
132
+ ease: [0.16, 1, 0.3, 1],
133
+ }, style: Object.assign(Object.assign({}, style), { gap: undefined }), children: children }) })] })) }) }) }));
134
+ });
135
+ exports.InspectorDialog.displayName = "InspectorDialog";
@@ -19,6 +19,7 @@ const AppContent_1 = require("./AppContent");
19
19
  const ErrorBoundary_1 = require("./ErrorBoundary");
20
20
  const LoggerContext_1 = require("../../logging/LoggerContext");
21
21
  const LoggerInitializer_1 = require("../../logging/LoggerInitializer");
22
+ const ComponentViewer_1 = require("../ComponentViewer");
22
23
  /**
23
24
  * This component wraps the application into other layers of (nested) components
24
25
  * that provide app functionality and services requiring unique interaction with
@@ -38,10 +39,12 @@ const AppWrapper = ({ node, previewMode = false, routerBaseName: baseName = "",
38
39
  // --- provide the app functionality and services. These components are
39
40
  // --- wrapped in other components that provide the necessary environment
40
41
  // --- for the app to run.
41
- const dynamicChildren = ((0, jsx_runtime_1.jsxs)(react_helmet_async_1.HelmetProvider, { children: [(0, jsx_runtime_1.jsx)(react_helmet_async_1.Helmet, { defaultTitle: siteName, titleTemplate: `%s | ${siteName}` }), (0, jsx_runtime_1.jsxs)(LoggerContext_1.LoggerProvider, { children: [(0, jsx_runtime_1.jsx)(LoggerInitializer_1.LoggerInitializer, {}), (0, jsx_runtime_1.jsx)(IconProvider_1.IconProvider, { children: (0, jsx_runtime_1.jsx)(ThemeProvider_1.default, { resourceMap: resourceMap, themes: contributes.themes, defaultTheme: defaultTheme, defaultTone: defaultTone, resources: resources, children: (0, jsx_runtime_1.jsx)(InspectorContext_1.InspectorProvider, { sources: sources, projectCompilation: projectCompilation, mockApi: globalProps === null || globalProps === void 0 ? void 0 : globalProps.demoMockApi, children: (0, jsx_runtime_1.jsx)(ConfirmationModalContextProvider_1.ConfirmationModalContextProvider, { children: (0, jsx_runtime_1.jsx)(AppContent_1.AppContent, { onInit: onInit, rootContainer: node, routerBaseName: baseName, globalProps: globalProps, standalone: standalone, decorateComponentsWithTestId: decorateComponentsWithTestId, debugEnabled: debugEnabled, trackContainerHeight: trackContainerHeight, children: children }) }) }) }) })] })] }));
42
+ const dynamicChildren = ((0, jsx_runtime_1.jsxs)(react_helmet_async_1.HelmetProvider, { children: [(0, jsx_runtime_1.jsx)(react_helmet_async_1.Helmet, { defaultTitle: siteName, titleTemplate: `%s | ${siteName}` }), (0, jsx_runtime_1.jsxs)(LoggerContext_1.LoggerProvider, { children: [(0, jsx_runtime_1.jsx)(LoggerInitializer_1.LoggerInitializer, {}), (0, jsx_runtime_1.jsx)(IconProvider_1.IconProvider, { children: (0, jsx_runtime_1.jsx)(ThemeProvider_1.default, { resourceMap: resourceMap, themes: contributes.themes, defaultTheme: defaultTheme, defaultTone: defaultTone, resources: resources, children: (0, jsx_runtime_1.jsx)(InspectorContext_1.InspectorProvider, { sources: sources, projectCompilation: projectCompilation, mockApi: globalProps === null || globalProps === void 0 ? void 0 : globalProps.demoMockApi, children: (0, jsx_runtime_1.jsx)(ConfirmationModalContextProvider_1.ConfirmationModalContextProvider, { children: (0, jsx_runtime_1.jsxs)(AppContent_1.AppContent, { onInit: onInit, rootContainer: node, routerBaseName: baseName, globalProps: globalProps, standalone: standalone, decorateComponentsWithTestId: decorateComponentsWithTestId, debugEnabled: debugEnabled, trackContainerHeight: trackContainerHeight, children: [(0, jsx_runtime_1.jsx)(ComponentViewer_1.ComponentViewer, {}), children] }) }) }) }) })] })] }));
42
43
  // --- Select the router type for the app
43
44
  const Router = previewMode ? react_router_dom_1.MemoryRouter : useHashBasedRouting ? react_router_dom_1.HashRouter : react_router_dom_1.BrowserRouter;
44
- const shouldSkipClientRouter = previewMode ? false : (typeof window === "undefined" || process.env.VITE_REMIX);
45
+ const shouldSkipClientRouter = previewMode
46
+ ? false
47
+ : typeof window === "undefined" || process.env.VITE_REMIX;
45
48
  return ((0, jsx_runtime_1.jsx)(react_1.default.StrictMode, { children: (0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { node: node, location: "root-outer", children: (0, jsx_runtime_1.jsxs)(react_query_1.QueryClientProvider, { client: AppRoot_1.queryClient, children: [!!shouldSkipClientRouter && dynamicChildren, !shouldSkipClientRouter && ((0, jsx_runtime_1.jsx)(Router, { basename: Router === react_router_dom_1.HashRouter ? undefined : baseName, children: dynamicChildren }))] }) }) }));
46
49
  };
47
50
  exports.AppWrapper = AppWrapper;
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComponentMetadataProvider = exports.MetadataProvider = void 0;
4
+ exports.addOnPrefix = addOnPrefix;
5
+ const descriptorHelper_1 = require("../../../components-core/descriptorHelper");
6
+ const xmlui_parser_1 = require("../../../parsers/xmlui-parser");
7
+ const abstractions_1 = require("../../../components/abstractions");
8
+ class MetadataProvider {
9
+ constructor(metadataCollection) {
10
+ this.metadataCollection = metadataCollection;
11
+ }
12
+ componentNames() {
13
+ return Object.keys(this.metadataCollection);
14
+ }
15
+ getComponent(componentName) {
16
+ const providerData = this.metadataCollection[componentName];
17
+ if (!providerData) {
18
+ return null;
19
+ }
20
+ return new ComponentMetadataProvider(providerData);
21
+ }
22
+ }
23
+ exports.MetadataProvider = MetadataProvider;
24
+ class ComponentMetadataProvider {
25
+ constructor(metadata) {
26
+ this.metadata = metadata;
27
+ }
28
+ /**
29
+ * Retrieves the metadata for a given property, explicit or implicit.
30
+ * @param name The name of the property.
31
+ * @returns The metadata for the property, or `undefined` if not found.
32
+ */
33
+ getProp(name) {
34
+ var _a;
35
+ return (_a = this.metadata.props[name]) !== null && _a !== void 0 ? _a : implicitPropsMetadata[name];
36
+ }
37
+ getAttr(name) {
38
+ var _a, _b, _c;
39
+ if (xmlui_parser_1.onPrefixRegex.test(name)) {
40
+ const eventName = (0, xmlui_parser_1.stripOnPrefix)(name);
41
+ const event = (_a = this.metadata.events) === null || _a === void 0 ? void 0 : _a[eventName];
42
+ if (event) {
43
+ return event;
44
+ }
45
+ }
46
+ const explicitProp = (_b = this.metadata.props) === null || _b === void 0 ? void 0 : _b[name];
47
+ if (explicitProp) {
48
+ return explicitProp;
49
+ }
50
+ const api = (_c = this.metadata.apis) === null || _c === void 0 ? void 0 : _c[name];
51
+ if (api) {
52
+ return api;
53
+ }
54
+ const layout = layoutMdForKey(name);
55
+ if (layout) {
56
+ return layout;
57
+ }
58
+ return implicitPropsMetadata[name];
59
+ }
60
+ getAttrForKind({ name, kind }) {
61
+ switch (kind) {
62
+ case "api":
63
+ return this.metadata.apis[name];
64
+ case "event":
65
+ return this.metadata.events[name];
66
+ case "prop":
67
+ return this.metadata.props[name];
68
+ case "implicit":
69
+ return implicitPropsMetadata[name];
70
+ case "layout":
71
+ return layoutMdForKey(name);
72
+ }
73
+ }
74
+ getAllAttributes() {
75
+ var _a, _b, _c;
76
+ const attrNames = [];
77
+ for (const key of Object.keys((_a = this.metadata.props) !== null && _a !== void 0 ? _a : {})) {
78
+ attrNames.push({ name: key, kind: "prop" });
79
+ }
80
+ for (const key of Object.keys((_b = this.metadata.events) !== null && _b !== void 0 ? _b : {})) {
81
+ attrNames.push({ name: key, kind: "event" });
82
+ }
83
+ for (const key of Object.keys((_c = this.metadata.apis) !== null && _c !== void 0 ? _c : {})) {
84
+ attrNames.push({ name: key, kind: "api" });
85
+ }
86
+ for (const layoutKey of descriptorHelper_1.layoutOptionKeys) {
87
+ attrNames.push({ name: layoutKey, kind: "layout" });
88
+ }
89
+ for (const implicitPropKey of Object.keys(implicitPropsMetadata)) {
90
+ attrNames.push({ name: implicitPropKey, kind: "implicit" });
91
+ }
92
+ return attrNames;
93
+ }
94
+ getEvent(name) {
95
+ var _a;
96
+ return (_a = this.metadata.events) === null || _a === void 0 ? void 0 : _a[name];
97
+ }
98
+ getApi(name) {
99
+ var _a;
100
+ return (_a = this.metadata.apis) === null || _a === void 0 ? void 0 : _a[name];
101
+ }
102
+ get events() {
103
+ return this.metadata.events;
104
+ }
105
+ get apis() {
106
+ return this.metadata.apis;
107
+ }
108
+ get contextVars() {
109
+ return this.metadata.contextVars;
110
+ }
111
+ get allowArbitraryProps() {
112
+ return this.metadata.allowArbitraryProps;
113
+ }
114
+ get shortDescription() {
115
+ return this.metadata.shortDescription;
116
+ }
117
+ getMetadata() {
118
+ return this.metadata;
119
+ }
120
+ }
121
+ exports.ComponentMetadataProvider = ComponentMetadataProvider;
122
+ function layoutMdForKey(name) {
123
+ const metadata = {
124
+ description: "Layout property. Not yet documented",
125
+ };
126
+ if (descriptorHelper_1.layoutOptionKeys.includes(name)) {
127
+ return metadata;
128
+ }
129
+ for (const size of abstractions_1.viewportSizeMd) {
130
+ const suffix = "-" + (size.value);
131
+ if (name.endsWith(suffix)) {
132
+ const nameWithoutSize = name.slice(0, -suffix.length);
133
+ if (descriptorHelper_1.layoutOptionKeys.includes(nameWithoutSize)) {
134
+ return metadata;
135
+ }
136
+ }
137
+ }
138
+ return null;
139
+ }
140
+ const implicitPropsMetadata = {
141
+ inspect: {
142
+ description: "Determines whether the component can be inspected or not",
143
+ defaultValue: false,
144
+ valueType: "boolean",
145
+ },
146
+ data: {
147
+ description: "Specifies the data source for a component. Can be a URL string (fetched automatically), a DataSource or an expression to evaluate. Changes to this property trigger UI updates once data is loaded.",
148
+ },
149
+ when: {
150
+ description: "Specifies a condition that must be met for the component to be displayed",
151
+ defaultValue: true,
152
+ valueType: "boolean",
153
+ }
154
+ };
155
+ function addOnPrefix(name) {
156
+ return "on" + name[0].toUpperCase() + name.substring(1);
157
+ }