xmlui 0.9.32 → 0.9.34

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 (29) hide show
  1. package/dist/lib/{apiInterceptorWorker-Dw62WlhP.mjs → apiInterceptorWorker-B2l5dDUx.mjs} +1 -1
  2. package/dist/lib/{index-DgDH41u4.mjs → index-BN2rPcEc.mjs} +1746 -4218
  3. package/dist/lib/index.css +65 -52
  4. package/dist/lib/language-server-web-worker.mjs +1 -1
  5. package/dist/lib/language-server.mjs +1 -1
  6. package/dist/lib/{metadata-utils-DyYovNew.mjs → metadata-utils-BzHSWB2j.mjs} +12 -39
  7. package/dist/lib/{server-common-1aXZ-B7H.mjs → server-common-B1bqw3bO.mjs} +2575 -2466
  8. package/dist/lib/xmlui-parser.mjs +1 -1
  9. package/dist/lib/{lint-B5OU130e.mjs → xmlui-serializer-CQnuXBof.mjs} +156 -156
  10. package/dist/lib/xmlui.d.ts +19 -8
  11. package/dist/lib/xmlui.mjs +10 -11
  12. package/dist/metadata/style.css +65 -52
  13. package/dist/metadata/xmlui-metadata.mjs +20 -15
  14. package/dist/metadata/xmlui-metadata.umd.js +20 -15
  15. package/dist/scripts/bin/index.js +5 -4
  16. package/dist/scripts/package.json +1 -1
  17. package/dist/scripts/src/components/App/App.js +1 -0
  18. package/dist/scripts/src/components/CodeBlock/CodeBlock.js +7 -6
  19. package/dist/scripts/src/components/ComponentProvider.js +4 -0
  20. package/dist/scripts/src/components/NavGroup/NavGroupNative.js +1 -1
  21. package/dist/scripts/src/components/NavPanel/NavPanelNative.js +3 -1
  22. package/dist/scripts/src/components/NestedApp/NestedAppNative.js +23 -16
  23. package/dist/scripts/src/components/NestedApp/utils.js +0 -485
  24. package/dist/scripts/src/components/Splitter/Splitter.js +1 -1
  25. package/dist/standalone/xmlui-standalone.es.d.ts +2418 -0
  26. package/dist/standalone/xmlui-standalone.umd.js +1465 -3992
  27. package/package.json +1 -1
  28. package/dist/scripts/src/parsers/xmlui-parser/xmlui-serializer.js +0 -582
  29. package/dist/scripts/src/parsers/xmlui-parser/xmlui-tree.js +0 -2
@@ -85,6 +85,7 @@ exports.AppMd = (0, ComponentDefs_1.createMetadata)({
85
85
  },
86
86
  defaultThemeVars: {
87
87
  [`width-navPanel-${COMP}`]: "$space-64",
88
+ [`backgroundColor-navPanel-${COMP}`]: "$backgroundColor",
88
89
  [`maxWidth-content-${COMP}`]: "$maxWidth-content",
89
90
  [`boxShadow-header-${COMP}`]: "$boxShadow-spread",
90
91
  [`boxShadow-navPanel-${COMP}`]: "$boxShadow-spread",
@@ -17,17 +17,18 @@ exports.CodeBlockMd = (0, ComponentDefs_1.createMetadata)({
17
17
  props: {},
18
18
  themeVars: (0, themeVars_1.parseScssVar)(CodeBlock_module_scss_1.default.themeVars),
19
19
  defaultThemeVars: {
20
- "backgroundColor-CodeBlock": "#f2f7fc", // "$color-surface-100"
20
+ "backgroundColor-CodeBlock": "$color-primary-50",
21
21
  "backgroundColor-CodeBlock-header": "$color-primary-100",
22
22
  "marginTop-CodeBlock": "$space-5",
23
23
  "marginBottom-CodeBlock": "$space-5",
24
- "backgroundColor-CodeBlock-highlightRow": "$color-surface-200",
25
- "backgroundColor-CodeBlock-highlightString": "$color-surface-300",
24
+ "backgroundColor-CodeBlock-highlightRow": "rgba($color-primary-200-rgb, .25)",
25
+ "backgroundColor-CodeBlock-highlightString": "rgba($color-primary-200-rgb, .5)",
26
26
  "borderRadius-CodeBlock": "$space-2",
27
27
  dark: {
28
- "backgroundColor-CodeBlock-header": "$color-primary-200",
29
- "backgroundColor-CodeBlock": "#112033",
30
- "backgroundColor-CodeBlock-highlightRow": "$color-surface-100",
28
+ "backgroundColor-CodeBlock-header": "$color-surface-200",
29
+ "backgroundColor-CodeBlock": "$color-surface-50",
30
+ "backgroundColor-CodeBlock-highlightRow": "rgba($color-primary-300-rgb, .15)",
31
+ "backgroundColor-CodeBlock-highlightString": "rgba($color-primary-300-rgb, .5)",
31
32
  }
32
33
  },
33
34
  });
@@ -576,6 +576,10 @@ class ComponentRegistry {
576
576
  var _a;
577
577
  (_a = this.extensionManager) === null || _a === void 0 ? void 0 : _a.unSubscribeFromRegistrations(this.extensionRegistered);
578
578
  }
579
+ getExtensionManager() {
580
+ return this.extensionManager;
581
+ }
582
+ ;
579
583
  // --- Registers a compound component using its definition and metadata
580
584
  registerCompoundComponentRenderer({ compoundComponentDef, metadata }, ...namespaces) {
581
585
  const component = {
@@ -19,7 +19,7 @@ exports.defaultProps = {
19
19
  iconHorizontalExpanded: "chevronleft",
20
20
  iconHorizontalCollapsed: "chevronright",
21
21
  iconVerticalExpanded: "chevrondown",
22
- iconVerticalCollapsed: "chevronright",
22
+ iconVerticalCollapsed: "chevronup",
23
23
  };
24
24
  const NavGroupContext = (0, react_1.createContext)({
25
25
  level: -1,
@@ -55,13 +55,14 @@ function DrawerNavPanel({ logoContent, children, className, style, }) {
55
55
  return ((0, jsx_runtime_1.jsx)(exports.NavPanelContext.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)("div", { ref: scrollContainerRef, className: (0, classnames_1.default)(NavPanel_module_scss_1.default.wrapper, className), children: (0, jsx_runtime_1.jsxs)(ScrollContext_1.ScrollContext.Provider, { value: scrollContainerRef, children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(NavPanel_module_scss_1.default.logoWrapper, NavPanel_module_scss_1.default.inDrawer), children: logoContent || (0, jsx_runtime_1.jsx)(LogoNative_1.Logo, {}) }), (0, jsx_runtime_1.jsx)("div", { className: NavPanel_module_scss_1.default.wrapperInner, style: style, children: children })] }) }) }));
56
56
  }
57
57
  exports.NavPanel = (0, react_1.forwardRef)(function NavPanel({ children, style, logoContent, className, inDrawer, renderChild, }, forwardedRef) {
58
- var _a;
58
+ var _a, _b;
59
59
  const scrollContainerRef = (0, react_1.useRef)(null);
60
60
  const ref = forwardedRef ? (0, react_compose_refs_1.composeRefs)(scrollContainerRef, forwardedRef) : scrollContainerRef;
61
61
  const appLayoutContext = (0, AppLayoutContext_1.useAppLayoutContext)();
62
62
  const horizontal = (0, AppNative_1.getAppLayoutOrientation)(appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === "horizontal";
63
63
  const showLogo = (appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === "vertical" || (appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === "vertical-sticky";
64
64
  const isCondensed = (_a = appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === null || _a === void 0 ? void 0 : _a.startsWith("condensed");
65
+ const vertical = (_b = appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === null || _b === void 0 ? void 0 : _b.startsWith("vertical");
65
66
  const safeLogoContent = logoContent || renderChild(appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.logoContentDef);
66
67
  // console.log(appLayoutContext);
67
68
  if (inDrawer) {
@@ -69,6 +70,7 @@ exports.NavPanel = (0, react_1.forwardRef)(function NavPanel({ children, style,
69
70
  }
70
71
  return ((0, jsx_runtime_1.jsx)("div", { ref: ref, className: (0, classnames_1.default)(NavPanel_module_scss_1.default.wrapper, className, {
71
72
  [NavPanel_module_scss_1.default.horizontal]: horizontal,
73
+ [NavPanel_module_scss_1.default.vertical]: vertical,
72
74
  [NavPanel_module_scss_1.default.condensed]: isCondensed,
73
75
  }), children: (0, jsx_runtime_1.jsxs)(ScrollContext_1.ScrollContext.Provider, { value: scrollContainerRef, children: [showLogo && ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(NavPanel_module_scss_1.default.logoWrapper), children: safeLogoContent || (0, jsx_runtime_1.jsx)(LogoNative_1.Logo, {}) })), (0, jsx_runtime_1.jsx)("div", { className: NavPanel_module_scss_1.default.wrapperInner, style: style, children: children })] }) }));
74
76
  });
@@ -28,7 +28,9 @@ const Tooltip_1 = require("./Tooltip");
28
28
  const ThemeContext_1 = require("../../components-core/theming/ThemeContext");
29
29
  const constants_1 = require("../../components-core/constants");
30
30
  const utils_1 = require("./utils");
31
- function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, activeTheme, activeTone, title, height, allowPlaygroundPopup = true, }) {
31
+ const AppContext_1 = require("../../components-core/AppContext");
32
+ const ComponentRegistryContext_1 = require("../ComponentRegistryContext");
33
+ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, activeTheme, activeTone, title, height, allowPlaygroundPopup = true, withFrame = true }) {
32
34
  const rootRef = (0, react_1.useRef)(null);
33
35
  const shadowRef = (0, react_1.useRef)(null);
34
36
  const contentRootRef = (0, react_1.useRef)(null);
@@ -36,6 +38,8 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
36
38
  const [refreshVersion, setRefreshVersion] = (0, react_1.useState)(0);
37
39
  const theme = (0, ThemeContext_1.useTheme)();
38
40
  const toneToApply = activeTone || (config === null || config === void 0 ? void 0 : config.defaultTone) || (theme === null || theme === void 0 ? void 0 : theme.activeThemeTone);
41
+ const { appGlobals } = (0, AppContext_1.useAppContext)();
42
+ const componentRegistry = (0, ComponentRegistryContext_1.useComponentRegistry)();
39
43
  const apiWorker = (0, react_1.useMemo)(() => {
40
44
  if (typeof document !== "undefined") {
41
45
  return (0, browser_1.setupWorker)();
@@ -54,6 +58,7 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
54
58
  ? Object.assign(Object.assign({ type: "in-memory" }, api), { apiUrl: "/api" }) : undefined;
55
59
  }, [api]);
56
60
  //console.log("mock", mock);
61
+ const useHashBasedRouting = (appGlobals === null || appGlobals === void 0 ? void 0 : appGlobals.useHashBasedRouting) || true;
57
62
  const openPlayground = (0, react_1.useCallback)(() => __awaiter(this, void 0, void 0, function* () {
58
63
  const data = {
59
64
  standalone: {
@@ -63,7 +68,7 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
63
68
  name: title,
64
69
  themes: [],
65
70
  defaultTheme: activeTheme,
66
- }
71
+ },
67
72
  },
68
73
  options: {
69
74
  fixedTheme: false,
@@ -76,8 +81,8 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
76
81
  },
77
82
  };
78
83
  const appQueryString = yield (0, utils_1.createQueryString)(JSON.stringify(data));
79
- window.open(`/#/playground#${appQueryString}`, "_blank");
80
- }), [app, activeTheme]);
84
+ window.open(useHashBasedRouting ? `/#/playground#${appQueryString}` : `/playground#${appQueryString}`, "_blank");
85
+ }), [app, components, title, activeTheme, activeTone, useHashBasedRouting]);
81
86
  (0, react_1.useEffect)(() => {
82
87
  var _a;
83
88
  if (!shadowRef.current && rootRef.current) {
@@ -115,14 +120,15 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
115
120
  Object.keys(theme.themeStyles).forEach((key) => {
116
121
  themeVarReset[key] = "initial";
117
122
  });
118
- (_a = contentRootRef.current) === null || _a === void 0 ? void 0 : _a.render((0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { node: component, children: (0, jsx_runtime_1.jsx)(ApiInterceptorProvider_1.ApiInterceptorProvider, { interceptor: mock, apiWorker: apiWorker, children: (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.nestedAppContainer, children: [(0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.header, children: [(0, jsx_runtime_1.jsx)("span", { className: NestedApp_module_scss_1.default.headerText, children: title }), (0, jsx_runtime_1.jsx)("div", { className: NestedApp_module_scss_1.default.spacer }), allowPlaygroundPopup && ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
123
+ let nestedAppRoot = ((0, jsx_runtime_1.jsx)("div", { style: Object.assign({ height }, themeVarReset), children: (0, jsx_runtime_1.jsx)(AppRoot_1.AppRoot, { previewMode: true, standalone: true, trackContainerHeight: height ? "fixed" : "auto", node: component, globalProps: globalProps, defaultTheme: activeTheme || (config === null || config === void 0 ? void 0 : config.defaultTheme), defaultTone: toneToApply, contributes: {
124
+ compoundComponents,
125
+ themes: config === null || config === void 0 ? void 0 : config.themes,
126
+ }, resources: config === null || config === void 0 ? void 0 : config.resources, extensionManager: componentRegistry.getExtensionManager() }, `app-${nestedAppId}-${refreshVersion}`) }));
127
+ (_a = contentRootRef.current) === null || _a === void 0 ? void 0 : _a.render((0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { node: component, children: (0, jsx_runtime_1.jsx)(ApiInterceptorProvider_1.ApiInterceptorProvider, { interceptor: mock, apiWorker: apiWorker, children: withFrame ? ((0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.nestedAppContainer, children: [(0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.header, children: [(0, jsx_runtime_1.jsx)("span", { className: NestedApp_module_scss_1.default.headerText, children: title }), (0, jsx_runtime_1.jsx)("div", { className: NestedApp_module_scss_1.default.spacer }), allowPlaygroundPopup && ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
119
128
  openPlayground();
120
129
  }, children: (0, jsx_runtime_1.jsx)(rx_1.RxOpenInNewWindow, {}) }), label: "Edit code in new window" })), (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
121
130
  setRefreshVersion(refreshVersion + 1);
122
- }, children: (0, jsx_runtime_1.jsx)(lia_1.LiaUndoAltSolid, {}) }), label: "Reset the app" })] }), (0, jsx_runtime_1.jsx)("div", { style: Object.assign({ height }, themeVarReset), children: (0, jsx_runtime_1.jsx)(AppRoot_1.AppRoot, { previewMode: true, standalone: true, trackContainerHeight: height ? "fixed" : "auto", node: component, globalProps: globalProps, defaultTheme: activeTheme || (config === null || config === void 0 ? void 0 : config.defaultTheme), defaultTone: toneToApply, contributes: {
123
- compoundComponents,
124
- themes: config === null || config === void 0 ? void 0 : config.themes,
125
- }, resources: config === null || config === void 0 ? void 0 : config.resources }, `app-${nestedAppId}-${refreshVersion}`) })] }) }) }));
131
+ }, children: (0, jsx_runtime_1.jsx)(lia_1.LiaUndoAltSolid, {}) }), label: "Reset the app" })] }), nestedAppRoot] })) : (nestedAppRoot) }) }));
126
132
  }, [
127
133
  activeTheme,
128
134
  allowPlaygroundPopup,
@@ -137,6 +143,7 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
137
143
  height,
138
144
  mock,
139
145
  nestedAppId,
146
+ openPlayground,
140
147
  refreshVersion,
141
148
  theme.themeStyles,
142
149
  title,
@@ -149,11 +156,11 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
149
156
  contentRootRef.current = null;
150
157
  };
151
158
  }, []);
152
- return ((0, jsx_runtime_1.jsx)("div", { className: NestedApp_module_scss_1.default.nestedApp, children: (0, jsx_runtime_1.jsx)("div", { ref: rootRef, style: {
153
- width: "100%",
154
- height: "100%",
155
- overflow: "auto",
156
- position: "relative",
157
- isolation: "isolate",
158
- } }) }));
159
+ return ((0, jsx_runtime_1.jsx)("div", { ref: rootRef, style: {
160
+ width: "100%",
161
+ height: "100%",
162
+ overflow: "auto",
163
+ position: "relative",
164
+ isolation: "isolate",
165
+ } }));
159
166
  }