xmlui 0.9.73 → 0.9.75

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 (28) hide show
  1. package/dist/lib/{apiInterceptorWorker-VgjaTiLV.mjs → apiInterceptorWorker-DatXAMCS.mjs} +149 -149
  2. package/dist/lib/{index-By3AkYm2.mjs → index-BSiZQHKG.mjs} +7599 -7529
  3. package/dist/lib/index.css +1 -1
  4. package/dist/lib/language-server-web-worker.mjs +1 -1
  5. package/dist/lib/language-server.mjs +1 -1
  6. package/dist/lib/{server-common-CfdMYx46.mjs → server-common-LUcdzTQs.mjs} +4433 -4463
  7. package/dist/lib/xmlui-parser.d.ts +3 -0
  8. package/dist/lib/xmlui.d.ts +7 -2
  9. package/dist/lib/xmlui.mjs +1 -1
  10. package/dist/metadata/{apiInterceptorWorker-BGM0pNVK.mjs → apiInterceptorWorker-iGWqhoNo.mjs} +134 -134
  11. package/dist/metadata/{collectedComponentMetadata-CduyISDB.mjs → collectedComponentMetadata-DPDQ1hHG.mjs} +7737 -7668
  12. package/dist/metadata/style.css +1 -1
  13. package/dist/metadata/xmlui-metadata.mjs +1 -1
  14. package/dist/metadata/xmlui-metadata.umd.js +102 -102
  15. package/dist/scripts/package.json +1 -1
  16. package/dist/scripts/src/components/Markdown/MarkdownNative.js +1 -1
  17. package/dist/scripts/src/components/Markdown/utils.js +15 -5
  18. package/dist/scripts/src/components/NestedApp/AppWithCodeViewNative.js +3 -3
  19. package/dist/scripts/src/components/NestedApp/NestedAppNative.js +45 -18
  20. package/dist/scripts/src/components/TreeDisplay/TreeDisplay.js +1 -1
  21. package/dist/scripts/src/components-core/interception/ApiInterceptor.js +6 -1
  22. package/dist/scripts/src/components-core/rendering/AppContent.js +4 -1
  23. package/dist/scripts/src/components-core/rendering/AppRoot.js +2 -2
  24. package/dist/scripts/src/components-core/rendering/AppWrapper.js +2 -2
  25. package/dist/scripts/src/components-core/theming/transformThemeVars.js +1 -1
  26. package/dist/standalone/xmlui-standalone.es.d.ts +7 -2
  27. package/dist/standalone/xmlui-standalone.umd.js +247 -247
  28. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmlui",
3
- "version": "0.9.73",
3
+ "version": "0.9.75",
4
4
  "sideEffects": false,
5
5
  "scripts": {
6
6
  "start-test-bed": "cd src/testing/infrastructure && xmlui start",
@@ -244,7 +244,7 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = exports
244
244
  const dataContentBase64 = props === null || props === void 0 ? void 0 : props["data-pg-content"];
245
245
  const jsonContent = atob(dataContentBase64);
246
246
  const appProps = JSON.parse(jsonContent);
247
- return ((0, jsx_runtime_1.jsx)(AppWithCodeViewNative_1.default, { markdown: markdownContent, app: appProps.app, config: appProps.config, components: appProps.components, api: appProps.api, activeTheme: appProps.activeTheme, activeTone: appProps.activeTone, title: appProps.name, height: appProps.height, allowPlaygroundPopup: !appProps.noPopup, withFrame: appProps.noFrame ? false : true, noHeader: (_b = appProps.noHeader) !== null && _b !== void 0 ? _b : false, splitView: (_c = appProps.splitView) !== null && _c !== void 0 ? _c : false, initiallyShowCode: (_d = appProps.initiallyShowCode) !== null && _d !== void 0 ? _d : false, popOutUrl: appProps.popOutUrl }));
247
+ return ((0, jsx_runtime_1.jsx)(AppWithCodeViewNative_1.default, { markdown: markdownContent, app: appProps.app, config: appProps.config, components: appProps.components, api: appProps.api, activeTheme: appProps.activeTheme, activeTone: appProps.activeTone, title: appProps.name, height: appProps.height, allowPlaygroundPopup: !appProps.noPopup, withFrame: appProps.noFrame ? false : true, noHeader: (_b = appProps.noHeader) !== null && _b !== void 0 ? _b : false, splitView: (_c = appProps.splitView) !== null && _c !== void 0 ? _c : false, initiallyShowCode: (_d = appProps.initiallyShowCode) !== null && _d !== void 0 ? _d : false, popOutUrl: appProps.popOutUrl, immediate: appProps.immediate, withSplashScreen: appProps.withSplashScreen }));
248
248
  },
249
249
  section(_a) {
250
250
  var { children } = _a, props = __rest(_a, ["children"]);
@@ -54,6 +54,14 @@ function parseSegmentProps(input) {
54
54
  if (/\bnoFrame\b/.test(input)) {
55
55
  segment.noFrame = true;
56
56
  }
57
+ // --- Match the "immediate" flag
58
+ if (/\bimmediate\b/.test(input)) {
59
+ segment.immediate = true;
60
+ }
61
+ // --- Match the "withSplashScreen" flag
62
+ if (/\bwithSplashScreen\b/.test(input)) {
63
+ segment.withSplashScreen = true;
64
+ }
57
65
  // --- Match the "noHeader" flag
58
66
  if (/\bnoHeader\b/.test(input)) {
59
67
  segment.noHeader = true;
@@ -200,7 +208,7 @@ function parsePlaygroundPattern(content) {
200
208
  }
201
209
  }
202
210
  function convertPlaygroundPatternToMarkdown(content) {
203
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
211
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
204
212
  const pattern = parsePlaygroundPattern(content);
205
213
  // --- Determine max order for segments
206
214
  let maxOrder = 0;
@@ -236,6 +244,8 @@ function convertPlaygroundPatternToMarkdown(content) {
236
244
  splitView: (_g = pattern.default) === null || _g === void 0 ? void 0 : _g.splitView,
237
245
  initiallyShowCode: (_h = pattern.default) === null || _h === void 0 ? void 0 : _h.initiallyShowCode,
238
246
  popOutUrl: (_j = pattern.default) === null || _j === void 0 ? void 0 : _j.popOutUrl,
247
+ immediate: (_k = pattern.default) === null || _k === void 0 ? void 0 : _k.immediate,
248
+ withSplashScreen: (_l = pattern.default) === null || _l === void 0 ? void 0 : _l.withSplashScreen,
239
249
  };
240
250
  // --- Extract optional playground attributes
241
251
  if (pattern.default.height) {
@@ -251,15 +261,15 @@ function convertPlaygroundPatternToMarkdown(content) {
251
261
  for (let i = 0; i <= maxOrder; i++) {
252
262
  let segment;
253
263
  let type = "";
254
- if (((_k = pattern.app) === null || _k === void 0 ? void 0 : _k.order) === i) {
264
+ if (((_m = pattern.app) === null || _m === void 0 ? void 0 : _m.order) === i) {
255
265
  segment = pattern.app;
256
266
  type = "app";
257
267
  }
258
- else if (((_l = pattern.config) === null || _l === void 0 ? void 0 : _l.order) === i) {
268
+ else if (((_o = pattern.config) === null || _o === void 0 ? void 0 : _o.order) === i) {
259
269
  segment = pattern.config;
260
270
  type = "config";
261
271
  }
262
- else if (((_m = pattern.api) === null || _m === void 0 ? void 0 : _m.order) === i) {
272
+ else if (((_p = pattern.api) === null || _p === void 0 ? void 0 : _p.order) === i) {
263
273
  segment = pattern.api;
264
274
  type = "api";
265
275
  }
@@ -320,7 +330,7 @@ function convertPlaygroundPatternToMarkdown(content) {
320
330
  if (segment.display) {
321
331
  markdownContent += "```xmlui " + segmentAttrs + "\n" + segment.content + "```\n\n";
322
332
  }
323
- (_o = pgContent.components) !== null && _o !== void 0 ? _o : (pgContent.components = []);
333
+ (_q = pgContent.components) !== null && _q !== void 0 ? _q : (pgContent.components = []);
324
334
  pgContent.components.push(segment.content);
325
335
  break;
326
336
  case "desc":
@@ -29,7 +29,7 @@ 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, }) {
32
+ function AppWithCodeViewNative({ markdown, splitView, withFrame = true, noHeader = false, initiallyShowCode = false, popOutUrl, app, api, components = [], config, activeTone, activeTheme, title, height, allowPlaygroundPopup, withSplashScreen, immediate }) {
33
33
  const [showCode, setShowCode] = (0, react_1.useState)(initiallyShowCode);
34
34
  const { appGlobals } = (0, AppContext_1.useAppContext)();
35
35
  const [refreshVersion, setRefreshVersion] = (0, react_1.useState)(0);
@@ -71,9 +71,9 @@ function AppWithCodeViewNative({ markdown, splitView, withFrame = true, noHeader
71
71
  }, 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
72
  setShowCode(false);
73
73
  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: [showCode && ((0, jsx_runtime_1.jsx)(Markdown_1.Markdown, { style: { height: "100%" }, className: NestedApp_module_scss_1.default.splitViewMarkdown, children: markdown })), !showCode && ((0, jsx_runtime_1.jsx)(NestedAppNative_1.IndexAwareNestedApp, { height: "100%", app: app, api: api, components: components, config: config, activeTone: activeTone, activeTheme: activeTheme, refreshVersion: refreshVersion }))] })] })] }));
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
75
  }
76
- 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 })] }));
76
+ 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
77
  }
78
78
  /**
79
79
  * Export a named default for easier imports
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
11
22
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
24
  };
@@ -27,17 +38,26 @@ const ComponentRegistryContext_1 = require("../ComponentRegistryContext");
27
38
  const IndexerContext_1 = require("../App/IndexerContext");
28
39
  const useApiInterceptorContext_1 = require("../../components-core/interception/useApiInterceptorContext");
29
40
  const constants_1 = require("../../components-core/constants");
30
- function LazyNestedApp(props) {
31
- const [shouldRender, setShouldRender] = (0, react_1.useState)(false);
41
+ const hooks_1 = require("../../components-core/utils/hooks");
42
+ const NestedApp_module_scss_1 = __importDefault(require("./NestedApp.module.scss"));
43
+ const classnames_1 = __importDefault(require("classnames"));
44
+ function AnimatedLogo() {
45
+ return ((0, jsx_runtime_1.jsx)("div", { className: NestedApp_module_scss_1.default.logoWrapper, children: (0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 26 26", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("path", { d: "M9.04674 19.3954C8.2739 19.3954 7.60226 19.2265 7.03199 18.8887C6.47443 18.5384 6.0435 18.0505 5.73938 17.425C5.43526 16.7869 5.2832 16.0362 5.2832 15.173V9.89961C5.2832 9.7745 5.32771 9.66815 5.41637 9.58059C5.50502 9.493 5.61275 9.44922 5.73938 9.44922H7.41222C7.55157 9.44922 7.6593 9.493 7.73524 9.58059C7.8239 9.66815 7.86841 9.7745 7.86841 9.89961V15.0604C7.86841 16.6117 8.55895 17.3874 9.94021 17.3874C10.5991 17.3874 11.1187 17.181 11.4988 16.7681C11.8917 16.3553 12.0881 15.786 12.0881 15.0604V9.89961C12.0881 9.7745 12.1325 9.66815 12.2211 9.58059C12.3098 9.493 12.4175 9.44922 12.5443 9.44922H14.217C14.3436 9.44922 14.4513 9.493 14.54 9.58059C14.6288 9.66815 14.6732 9.7745 14.6732 9.89961V18.7574C14.6732 18.8825 14.6288 18.9888 14.54 19.0764C14.4513 19.164 14.3436 19.2078 14.217 19.2078H12.6773C12.538 19.2078 12.4239 19.164 12.3352 19.0764C12.2591 18.9888 12.2211 18.8825 12.2211 18.7574V17.988C11.879 18.4258 11.4545 18.7699 10.9476 19.0201C10.4407 19.2703 9.80704 19.3954 9.04674 19.3954Z", fill: "#3367CC" }), (0, jsx_runtime_1.jsx)("path", { d: "M17.6397 19.2104C17.5129 19.2104 17.4052 19.1666 17.3165 19.079C17.2279 18.9914 17.1835 18.8851 17.1835 18.76V9.90221C17.1835 9.7771 17.2279 9.67075 17.3165 9.58319C17.4052 9.4956 17.5129 9.45182 17.6397 9.45182H19.2174C19.3567 9.45182 19.4644 9.4956 19.5404 9.58319C19.6292 9.67075 19.6736 9.7771 19.6736 9.90221V18.76C19.6736 18.8851 19.6292 18.9914 19.5404 19.079C19.4644 19.1666 19.3567 19.2104 19.2174 19.2104H17.6397ZM17.5636 7.8379C17.4243 7.8379 17.3102 7.80038 17.2215 7.72531C17.1454 7.63773 17.1074 7.52514 17.1074 7.38751V6.03633C17.1074 5.91122 17.1454 5.80487 17.2215 5.71731C17.3102 5.62972 17.4243 5.58594 17.5636 5.58594H19.2933C19.4327 5.58594 19.5467 5.62972 19.6354 5.71731C19.7242 5.80487 19.7686 5.91122 19.7686 6.03633V7.38751C19.7686 7.52514 19.7242 7.63773 19.6354 7.72531C19.5467 7.80038 19.4327 7.8379 19.2933 7.8379H17.5636Z", fill: "#3367CC" }), (0, jsx_runtime_1.jsx)("path", { className: NestedApp_module_scss_1.default.animatedLogoPath, d: "M23.0215 2.81748H2.53486V23.044H23.0215V2.81748Z", fill: "none", stroke: "#3367CC", strokeWidth: "0.75" })] }) }));
46
+ }
47
+ function LazyNestedApp(_a) {
48
+ var { immediate } = _a, restProps = __rest(_a, ["immediate"]);
49
+ const [shouldRender, setShouldRender] = (0, react_1.useState)(immediate || false);
32
50
  (0, react_1.useEffect)(() => {
33
- (0, react_1.startTransition)(() => {
34
- setShouldRender(true);
35
- });
36
- }, []);
51
+ if (!immediate) {
52
+ (0, react_1.startTransition)(() => {
53
+ setShouldRender(true);
54
+ });
55
+ }
56
+ }, [immediate]);
37
57
  if (!shouldRender) {
38
58
  return null;
39
59
  }
40
- return (0, jsx_runtime_1.jsx)(NestedApp, Object.assign({}, props));
60
+ return (0, jsx_runtime_1.jsx)(NestedApp, Object.assign({}, restProps));
41
61
  }
42
62
  function IndexAwareNestedApp(props) {
43
63
  const { indexing } = (0, IndexerContext_1.useIndexerContext)();
@@ -46,7 +66,7 @@ function IndexAwareNestedApp(props) {
46
66
  }
47
67
  return (0, jsx_runtime_1.jsx)(LazyNestedApp, Object.assign({}, props));
48
68
  }
49
- function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, activeTheme, activeTone, height, style, refreshVersion }) {
69
+ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, activeTheme, activeTone, height, style, refreshVersion, withSplashScreen = false, className, }) {
50
70
  const rootRef = (0, react_1.useRef)(null);
51
71
  const shadowRef = (0, react_1.useRef)(null);
52
72
  const contentRootRef = (0, react_1.useRef)(null);
@@ -54,6 +74,8 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
54
74
  const toneToApply = activeTone || (config === null || config === void 0 ? void 0 : config.defaultTone) || (theme === null || theme === void 0 ? void 0 : theme.activeThemeTone);
55
75
  const componentRegistry = (0, ComponentRegistryContext_1.useComponentRegistry)();
56
76
  const parentInterceptorContext = (0, useApiInterceptorContext_1.useApiInterceptorContext)();
77
+ const [initialized, setInitialized] = (0, react_1.useState)(!withSplashScreen);
78
+ const [revealAnimationFinished, setRevealAnimationFinished] = (0, react_1.useState)(false);
57
79
  //TODO illesg: we should come up with something to make sure that nestedApps don't overwrite each other's mocked api endpoints
58
80
  // disabled for now, as it messes up the paths of not mocked APIs (e.g. resources/{staticJsonfiles})
59
81
  //const safeId = playgroundId || nestedAppId;
@@ -75,7 +97,7 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
75
97
  }
76
98
  return Object.assign(Object.assign({}, apiObject), { type: "in-memory" });
77
99
  }, [api]);
78
- (0, react_1.useLayoutEffect)(() => {
100
+ (0, hooks_1.useIsomorphicLayoutEffect)(() => {
79
101
  if (!shadowRef.current && rootRef.current) {
80
102
  // Clone existing style and link tags
81
103
  shadowRef.current = rootRef.current.attachShadow({ mode: "open" });
@@ -120,6 +142,9 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
120
142
  contentRootRef.current = client_1.default.createRoot(shadowRef.current);
121
143
  }
122
144
  }, []);
145
+ const onInit = (0, react_1.useCallback)(() => {
146
+ setInitialized(true);
147
+ }, []);
123
148
  (0, react_1.useEffect)(() => {
124
149
  var _a;
125
150
  let { errors, component, erroneousCompoundComponentName } = (0, xmlui_parser_1.xmlUiMarkupToComponent)(app);
@@ -143,11 +168,12 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
143
168
  Object.keys(theme.themeStyles).forEach((key) => {
144
169
  themeVarReset[key] = "initial";
145
170
  });
146
- (_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, { parentInterceptorContext: parentInterceptorContext, interceptor: mock, waitForApiInterceptor: true, children: (0, jsx_runtime_1.jsx)("div", { style: Object.assign(Object.assign({ height }, style), themeVarReset), children: (0, jsx_runtime_1.jsx)(AppRoot_1.AppRoot, { isNested: true, 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: {
171
+ (_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, { parentInterceptorContext: parentInterceptorContext, interceptor: mock, waitForApiInterceptor: true, children: (0, jsx_runtime_1.jsx)("div", { style: Object.assign(Object.assign({ height }, style), themeVarReset), children: (0, jsx_runtime_1.jsx)(AppRoot_1.AppRoot, { onInit: onInit, isNested: true, 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: {
147
172
  compoundComponents,
148
173
  themes: config === null || config === void 0 ? void 0 : config.themes,
149
174
  }, resources: config === null || config === void 0 ? void 0 : config.resources, extensionManager: componentRegistry.getExtensionManager() }) }) }, `app-${refreshVersion}`) }));
150
175
  }, [
176
+ onInit,
151
177
  activeTheme,
152
178
  app,
153
179
  componentRegistry,
@@ -163,7 +189,7 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
163
189
  style,
164
190
  theme.themeStyles,
165
191
  toneToApply,
166
- refreshVersion
192
+ refreshVersion,
167
193
  ]);
168
194
  const mountedRef = (0, react_1.useRef)(false);
169
195
  (0, react_1.useEffect)(() => {
@@ -180,11 +206,12 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
180
206
  }, 0);
181
207
  };
182
208
  }, []);
183
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { ref: rootRef, style: {
184
- width: "100%",
185
- height: "100%",
186
- overflow: "auto",
187
- position: "relative",
188
- isolation: "isolate",
189
- } }) }));
209
+ const animationFinished = (0, react_1.useCallback)(() => {
210
+ setRevealAnimationFinished(true);
211
+ }, []);
212
+ const shouldAnimate = withSplashScreen && !revealAnimationFinished;
213
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(NestedApp_module_scss_1.default.nestedAppPlaceholder, className), children: [shouldAnimate && (0, jsx_runtime_1.jsx)(AnimatedLogo, {}), (0, jsx_runtime_1.jsx)("div", { ref: rootRef, onTransitionEnd: animationFinished, className: (0, classnames_1.default)(NestedApp_module_scss_1.default.nestedAppRoot, {
214
+ [NestedApp_module_scss_1.default.shouldAnimate]: shouldAnimate,
215
+ [NestedApp_module_scss_1.default.initialized]: initialized,
216
+ }) })] }));
190
217
  }
@@ -31,7 +31,7 @@ exports.TreeDisplayMd = (0, metadata_helpers_1.createMetadata)({
31
31
  },
32
32
  themeVars: (0, themeVars_1.parseScssVar)(TreeDisplay_module_scss_1.default.themeVars),
33
33
  defaultThemeVars: {
34
- [`backgroundColor-${COMP}`]: "$color-primary-50",
34
+ [`backgroundColor-${COMP}`]: "$backgroundColor-CodeBlock",
35
35
  [`borderRadius-${COMP}`]: "8px",
36
36
  [`padding-${COMP}`]: "$space-4",
37
37
  [`paddingLeft-${COMP}`]: "$space-2",
@@ -147,7 +147,12 @@ class ApiInterceptor {
147
147
  requestHeaders: Object.fromEntries(req.headers.entries()) || {},
148
148
  }, operation);
149
149
  //artificial delay for http requests
150
- yield (0, msw_1.delay)();
150
+ if (this.apiDef.artificialDelay === undefined) {
151
+ yield (0, msw_1.delay)("real");
152
+ }
153
+ else if (this.apiDef.artificialDelay !== 0) {
154
+ yield (0, msw_1.delay)(this.apiDef.artificialDelay);
155
+ }
151
156
  const cookieService = new Backend_1.CookieService();
152
157
  const headerService = new Backend_1.HeaderService();
153
158
  try {
@@ -39,7 +39,7 @@ function safeGetComputedStyle(root) {
39
39
  * - Providing xmlui-defined methods and properties for apps, such as
40
40
  * `activeThemeId`, `navigate`, `toast`, and many others.
41
41
  */
42
- function AppContent({ rootContainer, routerBaseName, globalProps, standalone, trackContainerHeight, decorateComponentsWithTestId, debugEnabled, children, }) {
42
+ function AppContent({ rootContainer, routerBaseName, globalProps, standalone, trackContainerHeight, decorateComponentsWithTestId, debugEnabled, children, onInit, }) {
43
43
  const [loggedInUser, setLoggedInUser] = (0, react_1.useState)(null);
44
44
  const debugView = (0, DebugViewProvider_1.useDebugView)();
45
45
  const componentRegistry = (0, ComponentRegistryContext_1.useComponentRegistry)();
@@ -167,6 +167,9 @@ function AppContent({ rootContainer, routerBaseName, globalProps, standalone, tr
167
167
  const location = (0, react_2.useLocation)();
168
168
  const lastHash = (0, react_1.useRef)("");
169
169
  const [scrollForceRefresh, setScrollForceRefresh] = (0, react_1.useState)(0);
170
+ (0, react_1.useEffect)(() => {
171
+ onInit === null || onInit === void 0 ? void 0 : onInit();
172
+ }, [onInit]);
170
173
  // useEffect(()=>{
171
174
  // if(isWindowFocused){
172
175
  // if ("serviceWorker" in navigator) {
@@ -27,7 +27,7 @@ exports.queryClient = new react_query_1.QueryClient({
27
27
  * from either code-behind files or inlined markup expressions) and executes
28
28
  * the app accordingly.
29
29
  */
30
- function AppRoot({ apiInterceptor, contributes, node, decorateComponentsWithTestId, debugEnabled, defaultTheme, defaultTone, resources, globalProps, standalone, trackContainerHeight, routerBaseName, previewMode, resourceMap, sources, extensionManager, children, projectCompilation, isNested = false, }) {
30
+ function AppRoot({ apiInterceptor, contributes, node, decorateComponentsWithTestId, debugEnabled, defaultTheme, defaultTone, resources, globalProps, standalone, trackContainerHeight, routerBaseName, previewMode, resourceMap, sources, extensionManager, children, projectCompilation, isNested = false, onInit, }) {
31
31
  // --- Make sure, the root node is wrapped in a `Theme` component. Also,
32
32
  // --- the root node must be wrapped in a `Container` component managing
33
33
  // --- the app's top-level state.
@@ -58,7 +58,7 @@ function AppRoot({ apiInterceptor, contributes, node, decorateComponentsWithTest
58
58
  const enhancedGlobalProps = (0, react_1.useMemo)(() => (Object.assign(Object.assign({}, globalProps), { isNested })), [globalProps, isNested]);
59
59
  // --- Render the app providing a component registry (in which the engine finds a
60
60
  // --- component definition by its name). Ensure the app has a context for debugging.
61
- return ((0, jsx_runtime_1.jsx)(ComponentProvider_1.ComponentProvider, { contributes: contributes, extensionManager: extensionManager, children: (0, jsx_runtime_1.jsx)(DebugViewProvider_1.DebugViewProvider, { debugConfig: globalProps === null || globalProps === void 0 ? void 0 : globalProps.debug, children: (0, jsx_runtime_1.jsx)(AppWrapper_1.AppWrapper, { projectCompilation: projectCompilation, resourceMap: resourceMap, apiInterceptor: apiInterceptor, node: rootNode, contributes: contributes, resources: resources, routerBaseName: routerBaseName, decorateComponentsWithTestId: decorateComponentsWithTestId, debugEnabled: debugEnabled, defaultTheme: defaultTheme, defaultTone: defaultTone, globalProps: enhancedGlobalProps, standalone: standalone, trackContainerHeight: trackContainerHeight, previewMode: previewMode, sources: sources, children: children }) }) }));
61
+ return ((0, jsx_runtime_1.jsx)(ComponentProvider_1.ComponentProvider, { contributes: contributes, extensionManager: extensionManager, children: (0, jsx_runtime_1.jsx)(DebugViewProvider_1.DebugViewProvider, { debugConfig: globalProps === null || globalProps === void 0 ? void 0 : globalProps.debug, children: (0, jsx_runtime_1.jsx)(AppWrapper_1.AppWrapper, { projectCompilation: projectCompilation, resourceMap: resourceMap, apiInterceptor: apiInterceptor, node: rootNode, contributes: contributes, resources: resources, routerBaseName: routerBaseName, decorateComponentsWithTestId: decorateComponentsWithTestId, debugEnabled: debugEnabled, defaultTheme: defaultTheme, defaultTone: defaultTone, globalProps: enhancedGlobalProps, standalone: standalone, trackContainerHeight: trackContainerHeight, previewMode: previewMode, sources: sources, onInit: onInit, children: children }) }) }));
62
62
  }
63
63
  /**
64
64
  *
@@ -24,7 +24,7 @@ const LoggerInitializer_1 = require("../../logging/LoggerInitializer");
24
24
  * that provide app functionality and services requiring unique interaction with
25
25
  * the browser or the React environment.
26
26
  */
27
- const AppWrapper = ({ node, previewMode = false, routerBaseName: baseName = "", contributes = constants_1.EMPTY_OBJECT, globalProps, standalone, trackContainerHeight, decorateComponentsWithTestId, debugEnabled, defaultTheme, defaultTone, resources, resourceMap, sources, children, projectCompilation, }) => {
27
+ const AppWrapper = ({ node, previewMode = false, routerBaseName: baseName = "", contributes = constants_1.EMPTY_OBJECT, globalProps, standalone, trackContainerHeight, decorateComponentsWithTestId, debugEnabled, defaultTheme, defaultTone, resources, resourceMap, sources, children, projectCompilation, onInit, }) => {
28
28
  var _a;
29
29
  if (previewMode) {
30
30
  // --- Prevent leaking the meta items to the parent document,
@@ -38,7 +38,7 @@ const AppWrapper = ({ node, previewMode = false, routerBaseName: baseName = "",
38
38
  // --- provide the app functionality and services. These components are
39
39
  // --- wrapped in other components that provide the necessary environment
40
40
  // --- 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, { rootContainer: node, routerBaseName: baseName, globalProps: globalProps, standalone: standalone, decorateComponentsWithTestId: decorateComponentsWithTestId, debugEnabled: debugEnabled, trackContainerHeight: trackContainerHeight, children: children }) }) }) }) })] })] }));
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
42
  // --- Select the router type for the app
43
43
  const Router = previewMode ? react_router_dom_1.MemoryRouter : useHashBasedRouting ? react_router_dom_1.HashRouter : react_router_dom_1.BrowserRouter;
44
44
  const shouldSkipClientRouter = previewMode ? false : (typeof window === "undefined" || process.env.VITE_REMIX);
@@ -660,7 +660,7 @@ function generateBaseTonesForColor(varName, theme, options = { distributeEven: f
660
660
  color200 = baseColor.lightness(baseL + lightStep * 3);
661
661
  color300 = baseColor.lightness(baseL + lightStep * 2);
662
662
  color400 = baseColor.lightness(baseL + lightStep * 1);
663
- color500 = baseColor;
663
+ color500 = baseColor.lightness(baseL);
664
664
  color600 = baseColor.lightness(baseL - darkStep * 1);
665
665
  color700 = baseColor.lightness(baseL - darkStep * 2);
666
666
  color800 = baseColor.lightness(baseL - darkStep * 3);
@@ -2,6 +2,7 @@ import { CSSProperties } from 'react';
2
2
  import { default as default_2 } from 'react';
3
3
  import { default as default_3 } from 'react/jsx-runtime';
4
4
  import { DefaultToastOptions } from 'react-hot-toast';
5
+ import { DelayMode } from 'msw';
5
6
  import { ErrorInfo } from 'react';
6
7
  import { ForwardedRef } from 'react';
7
8
  import { ForwardRefExoticComponent } from 'react';
@@ -38,6 +39,7 @@ declare const alignmentOptionValues: readonly ["start", "center", "end"];
38
39
  declare type ApiInterceptorDefinition = {
39
40
  type?: string;
40
41
  config?: Record<string, any>;
42
+ artificialDelay?: number | DelayMode;
41
43
  schemaDescriptor?: SchemaDescriptor;
42
44
  apiUrl?: string;
43
45
  initialData?: Record<string, any[]> | (() => Promise<Record<string, any[]>>);
@@ -140,7 +142,7 @@ declare type AppLayoutType = (typeof appLayoutNames)[number];
140
142
  * from either code-behind files or inlined markup expressions) and executes
141
143
  * the app accordingly.
142
144
  */
143
- declare function AppRoot({ apiInterceptor, contributes, node, decorateComponentsWithTestId, debugEnabled, defaultTheme, defaultTone, resources, globalProps, standalone, trackContainerHeight, routerBaseName, previewMode, resourceMap, sources, extensionManager, children, projectCompilation, isNested, }: AppWrapperProps & {
145
+ declare function AppRoot({ apiInterceptor, contributes, node, decorateComponentsWithTestId, debugEnabled, defaultTheme, defaultTone, resources, globalProps, standalone, trackContainerHeight, routerBaseName, previewMode, resourceMap, sources, extensionManager, children, projectCompilation, isNested, onInit, }: AppWrapperProps & {
144
146
  extensionManager?: StandaloneExtensionManager;
145
147
  isNested?: boolean;
146
148
  }): JSX_2.Element;
@@ -163,6 +165,7 @@ declare type AppWrapperProps = {
163
165
  sources?: Record<string, string>;
164
166
  projectCompilation?: ProjectCompilation;
165
167
  children?: ReactNode;
168
+ onInit?: () => void;
166
169
  };
167
170
 
168
171
  declare type ARRAY_DESTRUCTURE = typeof T_ARRAY_DESTRUCTURE;
@@ -917,7 +920,7 @@ declare type Message = ValueOrFunction<Renderable, Toast>;
917
920
  */
918
921
  declare type ModuleErrors = Record<string, ScriptParserErrorMessage[]>;
919
922
 
920
- declare function NestedApp({ api, app, components, config, activeTheme, activeTone, height, style, refreshVersion }: NestedAppProps): JSX_2.Element;
923
+ declare function NestedApp({ api, app, components, config, activeTheme, activeTone, height, style, refreshVersion, withSplashScreen, className, }: NestedAppProps): JSX_2.Element;
921
924
 
922
925
  declare type NestedAppProps = {
923
926
  api?: any;
@@ -929,6 +932,8 @@ declare type NestedAppProps = {
929
932
  height?: string | number;
930
933
  style?: CSSProperties;
931
934
  refreshVersion?: number;
935
+ withSplashScreen?: boolean;
936
+ className?: string;
932
937
  };
933
938
 
934
939
  declare type NO_ARG_EXPRESSION = typeof T_NO_ARG_EXPRESSION;