xmlui 0.9.44 → 0.9.45

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 (37) hide show
  1. package/dist/lib/{index-ODN_c1bh.mjs → apiInterceptorWorker-DzZYVTsV.mjs} +1920 -1362
  2. package/dist/lib/{index-Cc1nHN3N.mjs → index-erPY1EdW.mjs} +7175 -7056
  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/{metadata-utils-DI1nTN3y.mjs → metadata-utils-Cf8v_9Lr.mjs} +7 -7
  7. package/dist/lib/{server-common-C3t9MFME.mjs → server-common-kMTAr-QU.mjs} +210 -178
  8. package/dist/lib/{transform-BV--wKhF.mjs → transform-DU7v4c9h.mjs} +1193 -1158
  9. package/dist/lib/xmlui-parser.d.ts +10 -3
  10. package/dist/lib/xmlui-parser.mjs +31 -30
  11. package/dist/lib/{xmlui-serializer-D5UV-ftG.mjs → xmlui-serializer-B3OkRzrr.mjs} +9 -9
  12. package/dist/lib/xmlui.d.ts +10 -1
  13. package/dist/lib/xmlui.mjs +12 -11
  14. package/dist/metadata/style.css +1 -1
  15. package/dist/metadata/xmlui-metadata.mjs +4070 -4040
  16. package/dist/metadata/xmlui-metadata.umd.js +10 -10
  17. package/dist/scripts/package.json +2 -1
  18. package/dist/scripts/src/components/App/App.js +140 -27
  19. package/dist/scripts/src/components/App/AppNative.js +2 -1
  20. package/dist/scripts/src/components/App/IndexerContext.js +44 -0
  21. package/dist/scripts/src/components/App/SearchContext.js +35 -0
  22. package/dist/scripts/src/components/CodeBlock/CodeBlockNative.js +41 -44
  23. package/dist/scripts/src/components/CodeBlock/highlight-code.js +4 -1
  24. package/dist/scripts/src/components/Markdown/MarkdownNative.js +63 -27
  25. package/dist/scripts/src/components/NestedApp/NestedApp.js +4 -3
  26. package/dist/scripts/src/components/NestedApp/NestedAppNative.js +61 -66
  27. package/dist/scripts/src/components/TableOfContents/TableOfContents.js +9 -1
  28. package/dist/scripts/src/components/Text/Text.js +1 -1
  29. package/dist/scripts/src/components/Theme/ThemeNative.js +5 -0
  30. package/dist/scripts/src/components-core/loader/DataLoader.js +9 -1
  31. package/dist/scripts/src/components-core/rendering/Container.js +7 -0
  32. package/dist/scripts/src/parsers/xmlui-parser/diagnostics.js +10 -4
  33. package/dist/scripts/src/parsers/xmlui-parser/parser.js +74 -30
  34. package/dist/standalone/xmlui-standalone.es.d.ts +17 -2
  35. package/dist/standalone/xmlui-standalone.umd.js +197 -197
  36. package/package.json +2 -1
  37. package/dist/lib/apiInterceptorWorker-B62b9K2p.mjs +0 -563
@@ -1,4 +1,37 @@
1
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
+ })();
2
35
  var __rest = (this && this.__rest) || function (s, e) {
3
36
  var t = {};
4
37
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -16,8 +49,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
16
49
  Object.defineProperty(exports, "__esModule", { value: true });
17
50
  exports.Markdown = void 0;
18
51
  const jsx_runtime_1 = require("react/jsx-runtime");
19
- const react_1 = require("react");
20
- const react_2 = __importDefault(require("react"));
52
+ const react_1 = __importStar(require("react"));
21
53
  const react_markdown_1 = __importDefault(require("react-markdown"));
22
54
  const remark_gfm_1 = __importDefault(require("remark-gfm"));
23
55
  const rehype_raw_1 = __importDefault(require("rehype-raw"));
@@ -62,7 +94,7 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = true, c
62
94
  return null;
63
95
  }
64
96
  children = removeIndents ? removeTextIndents(children) : children;
65
- return ((0, jsx_runtime_1.jsx)("div", { className: Markdown_module_scss_1.default.markdownContent, style: Object.assign({}, style), children: (0, jsx_runtime_1.jsx)(react_markdown_1.default, { remarkPlugins: [remark_gfm_1.default, CodeBlockNative_1.markdownCodeBlockParser], rehypePlugins: [rehype_raw_1.default], components: {
97
+ return ((0, jsx_runtime_1.jsx)("div", { className: Markdown_module_scss_1.default.markdownContent, style: style, children: (0, jsx_runtime_1.jsx)(react_markdown_1.default, { remarkPlugins: [remark_gfm_1.default, CodeBlockNative_1.markdownCodeBlockParser], rehypePlugins: [rehype_raw_1.default], components: {
66
98
  details(_a) {
67
99
  var { children, node } = _a, props = __rest(_a, ["children", "node"]);
68
100
  return ((0, jsx_runtime_1.jsx)("details", Object.assign({ className: HtmlTags_module_scss_1.default.htmlDetails }, props, { children: children })));
@@ -81,7 +113,7 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = true, c
81
113
  if (node) {
82
114
  const nodeData = node;
83
115
  // --- Case 1: Image is part of a larger paragraph with other content
84
- if (nodeData.parent && nodeData.parent.type === 'paragraph') {
116
+ if (nodeData.parent && nodeData.parent.type === "paragraph") {
85
117
  if (nodeData.parent.children && nodeData.parent.children.length > 1) {
86
118
  // There are siblings in this paragraph - definitely inline
87
119
  isInline = true;
@@ -92,7 +124,8 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = true, c
92
124
  const paragraphParent = nodeData.parent.parent;
93
125
  if (paragraphParent && paragraphParent.children) {
94
126
  const paragraphIndex = paragraphParent.children.indexOf(nodeData.parent);
95
- if (paragraphIndex > 0 || paragraphIndex < paragraphParent.children.length - 1) {
127
+ if (paragraphIndex > 0 ||
128
+ paragraphIndex < paragraphParent.children.length - 1) {
96
129
  // --- There are siblings before/after this paragraph, likely inline
97
130
  isInline = true;
98
131
  }
@@ -100,17 +133,19 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = true, c
100
133
  }
101
134
  }
102
135
  // --- Case 2: Image is inside a blockquote or other container with text
103
- if (!isInline && nodeData.parent &&
104
- (nodeData.parent.type === 'paragraph' ||
105
- nodeData.parent.type === 'blockquote' ||
106
- nodeData.parent.type === 'emphasis' ||
107
- nodeData.parent.type === 'strong')) {
136
+ if (!isInline &&
137
+ nodeData.parent &&
138
+ (nodeData.parent.type === "paragraph" ||
139
+ nodeData.parent.type === "blockquote" ||
140
+ nodeData.parent.type === "emphasis" ||
141
+ nodeData.parent.type === "strong")) {
108
142
  // --- Look for any parent nodes with other text content
109
143
  let currentParent = nodeData.parent;
110
144
  while (currentParent) {
111
- if (currentParent.children && currentParent.children.some((child) => child !== nodeData &&
112
- ((child.type === 'text' && child.value && child.value.trim().length > 0) ||
113
- child.type !== 'text'))) {
145
+ if (currentParent.children &&
146
+ currentParent.children.some((child) => child !== nodeData &&
147
+ ((child.type === "text" && child.value && child.value.trim().length > 0) ||
148
+ child.type !== "text"))) {
114
149
  isInline = true;
115
150
  break;
116
151
  }
@@ -125,17 +160,18 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = true, c
125
160
  const imgSize = (props === null || props === void 0 ? void 0 : props.width) || (props === null || props === void 0 ? void 0 : props.height);
126
161
  isInline = imgSize === undefined ? true : parseInt(imgSize.toString()) < 512;
127
162
  // Images with icon-like filenames
128
- if (src && (src.includes('icon') ||
129
- src.endsWith('.svg') ||
130
- src.endsWith('.ico') ||
131
- src.includes('badge') ||
132
- src.includes('logo'))) {
163
+ if (src &&
164
+ (src.includes("icon") ||
165
+ src.endsWith(".svg") ||
166
+ src.endsWith(".ico") ||
167
+ src.includes("badge") ||
168
+ src.includes("logo"))) {
133
169
  isInline = true;
134
170
  }
135
171
  }
136
172
  }
137
173
  // Apply styling based on whether image should be inline or block
138
- const imgStyle = Object.assign(Object.assign({}, (props.style || {})), { display: isInline ? 'inline' : 'block' });
174
+ const imgStyle = Object.assign(Object.assign({}, (props.style || {})), { display: isInline ? "inline" : "block" });
139
175
  if (popOut) {
140
176
  return ((0, jsx_runtime_1.jsx)("a", { href: src, target: "_blank", rel: "noreferrer", children: (0, jsx_runtime_1.jsx)("img", Object.assign({ src: src, alt: alt, className: HtmlTags_module_scss_1.default.htmlImage, style: imgStyle }, props, { children: children })) }));
141
177
  }
@@ -243,9 +279,9 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = true, c
243
279
  if (dataContentBase64 !== undefined) {
244
280
  const jsonContent = atob(dataContentBase64);
245
281
  const appProps = JSON.parse(jsonContent);
246
- return ((0, jsx_runtime_1.jsx)(NestedAppNative_1.NestedApp, { 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 }));
282
+ return ((0, jsx_runtime_1.jsx)(NestedAppNative_1.IndexAwareNestedApp, { 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 }));
247
283
  }
248
- return ((0, jsx_runtime_1.jsx)(NestedAppNative_1.NestedApp, { app: nestedProps.app, config: nestedProps.config, components: nestedProps.components, api: nestedProps.api, activeTheme: nestedProps.activeTheme, activeTone: nestedProps.activeTone, title: nestedProps.title, height: nestedProps.height, allowPlaygroundPopup: true }));
284
+ return ((0, jsx_runtime_1.jsx)(NestedAppNative_1.IndexAwareNestedApp, { app: nestedProps.app, config: nestedProps.config, components: nestedProps.components, api: nestedProps.api, activeTheme: nestedProps.activeTheme, activeTone: nestedProps.activeTone, title: nestedProps.title, height: nestedProps.height, allowPlaygroundPopup: true }));
249
285
  },
250
286
  }, children: children }) }));
251
287
  });
@@ -258,7 +294,7 @@ const Blockquote = ({ children, style }) => {
258
294
  if (typeof node === "string") {
259
295
  return node;
260
296
  }
261
- if (react_2.default.isValidElement(node) && node.props && node.props.children) {
297
+ if (react_1.default.isValidElement(node) && node.props && node.props.children) {
262
298
  if (Array.isArray(node.props.children)) {
263
299
  return node.props.children.map(extractTextContent).join("");
264
300
  }
@@ -267,7 +303,7 @@ const Blockquote = ({ children, style }) => {
267
303
  return "";
268
304
  };
269
305
  // Extract all text content
270
- const allText = react_2.default.Children.toArray(children).map(extractTextContent).join("");
306
+ const allText = react_1.default.Children.toArray(children).map(extractTextContent).join("");
271
307
  // Check for admonition pattern
272
308
  const match = allText.match(/\[!([A-Z]+)\]/);
273
309
  const isAdmonition = !!match;
@@ -285,7 +321,7 @@ const Blockquote = ({ children, style }) => {
285
321
  if (typeof node === "string") {
286
322
  return node.replace(/\[!([A-Z]+)\]\s*/, "");
287
323
  }
288
- if (react_2.default.isValidElement(node)) {
324
+ if (react_1.default.isValidElement(node)) {
289
325
  // Handle React elements with children
290
326
  if (node.props && node.props.children) {
291
327
  let newChildren;
@@ -295,7 +331,7 @@ const Blockquote = ({ children, style }) => {
295
331
  else {
296
332
  newChildren = processNode(node.props.children);
297
333
  }
298
- return react_2.default.cloneElement(node, node.props, newChildren);
334
+ return react_1.default.cloneElement(node, node.props, newChildren);
299
335
  }
300
336
  // Element without children, return as is
301
337
  return node;
@@ -303,7 +339,7 @@ const Blockquote = ({ children, style }) => {
303
339
  // Other node types (null, undefined, etc.)
304
340
  return node;
305
341
  };
306
- const processedChildren = react_2.default.Children.map(children, processNode);
342
+ const processedChildren = react_1.default.Children.map(children, processNode);
307
343
  // Render admonition blockquote with the updated structure
308
344
  return ((0, jsx_runtime_1.jsx)("blockquote", { className: (0, classnames_1.default)(Markdown_module_scss_1.default.admonitionBlockquote, {
309
345
  [Markdown_module_scss_1.default.info]: type === "info",
@@ -413,7 +449,7 @@ function headingToAnchorLink(rawStr) {
413
449
  function extractTextNodes(node) {
414
450
  if (typeof node === "string" || typeof node === "number")
415
451
  return node.toString();
416
- if (react_2.default.isValidElement(node) && node.props && node.props.children) {
452
+ if (react_1.default.isValidElement(node) && node.props && node.props.children) {
417
453
  if (Array.isArray(node.props.children)) {
418
454
  return node.props.children.map(extractTextNodes).join("");
419
455
  }
@@ -48,14 +48,15 @@ exports.NestedAppMd = (0, ComponentDefs_1.createMetadata)({
48
48
  [`marginTop-${COMP}`]: "$space-3",
49
49
  [`marginBottom-${COMP}`]: "$space-3",
50
50
  [`padding-${COMP}`]: "$space-4",
51
- [`paddingTop-${COMP}`]: "$space-3",
51
+ [`paddingTop-${COMP}`]: "$space-2",
52
52
  [`borderRadius-${COMP}`]: "$space-4",
53
- [`backgroundColor-frame-${COMP}`]: "$color-primary-100",
53
+ [`backgroundColor-frame-${COMP}`]: "$color-primary-50",
54
54
  [`gap-frame-${COMP}`]: "$space-4",
55
55
  [`fontWeight-header-${COMP}`]: "$fontWeight-bold",
56
+ [`boxShadow-${COMP}`]: "$boxShadow-md",
56
57
  },
57
58
  });
58
59
  exports.nestedAppComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.NestedAppMd, ({ node, extractValue }) => {
59
60
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
60
- return ((0, jsx_runtime_1.jsx)(NestedAppNative_1.NestedApp, { app: (_a = node.props) === null || _a === void 0 ? void 0 : _a.app, api: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.api), components: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.components), config: extractValue((_d = node.props) === null || _d === void 0 ? void 0 : _d.config), activeTheme: extractValue((_e = node.props) === null || _e === void 0 ? void 0 : _e.activeTheme), activeTone: extractValue((_f = node.props) === null || _f === void 0 ? void 0 : _f.activeTone), title: extractValue((_g = node.props) === null || _g === void 0 ? void 0 : _g.title), height: extractValue((_h = node.props) === null || _h === void 0 ? void 0 : _h.height), allowPlaygroundPopup: extractValue.asOptionalBoolean((_j = node.props) === null || _j === void 0 ? void 0 : _j.allowPlaygroundPopup) }));
61
+ return ((0, jsx_runtime_1.jsx)(NestedAppNative_1.IndexAwareNestedApp, { app: (_a = node.props) === null || _a === void 0 ? void 0 : _a.app, api: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.api), components: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.components), config: extractValue((_d = node.props) === null || _d === void 0 ? void 0 : _d.config), activeTheme: extractValue((_e = node.props) === null || _e === void 0 ? void 0 : _e.activeTheme), activeTone: extractValue((_f = node.props) === null || _f === void 0 ? void 0 : _f.activeTone), title: extractValue((_g = node.props) === null || _g === void 0 ? void 0 : _g.title), height: extractValue((_h = node.props) === null || _h === void 0 ? void 0 : _h.height), allowPlaygroundPopup: extractValue.asOptionalBoolean((_j = node.props) === null || _j === void 0 ? void 0 : _j.allowPlaygroundPopup) }));
61
62
  });
@@ -1,37 +1,4 @@
1
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
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -45,6 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
45
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
46
13
  };
47
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.LazyNestedApp = LazyNestedApp;
16
+ exports.IndexAwareNestedApp = IndexAwareNestedApp;
48
17
  exports.NestedApp = NestedApp;
49
18
  const jsx_runtime_1 = require("react/jsx-runtime");
50
19
  const react_1 = require("react");
@@ -54,7 +23,6 @@ const AppRoot_1 = require("../../components-core/rendering/AppRoot");
54
23
  const lia_1 = require("react-icons/lia");
55
24
  const rx_1 = require("react-icons/rx");
56
25
  const xmlui_parser_1 = require("../../components-core/xmlui-parser");
57
- const ApiInterceptorProvider_1 = require("../../components-core/interception/ApiInterceptorProvider");
58
26
  const ErrorBoundary_1 = require("../../components-core/rendering/ErrorBoundary");
59
27
  const Tooltip_1 = require("./Tooltip");
60
28
  const ThemeContext_1 = require("../../components-core/theming/ThemeContext");
@@ -62,6 +30,26 @@ const constants_1 = require("../../components-core/constants");
62
30
  const utils_1 = require("./utils");
63
31
  const AppContext_1 = require("../../components-core/AppContext");
64
32
  const ComponentRegistryContext_1 = require("../ComponentRegistryContext");
33
+ const IndexerContext_1 = require("../App/IndexerContext");
34
+ function LazyNestedApp(props) {
35
+ const [shouldRender, setShouldRender] = (0, react_1.useState)(false);
36
+ (0, react_1.useEffect)(() => {
37
+ (0, react_1.startTransition)(() => {
38
+ setShouldRender(true);
39
+ });
40
+ }, []);
41
+ if (!shouldRender) {
42
+ return null;
43
+ }
44
+ return (0, jsx_runtime_1.jsx)(NestedApp, Object.assign({}, props));
45
+ }
46
+ function IndexAwareNestedApp(props) {
47
+ const { indexing } = (0, IndexerContext_1.useIndexerContext)();
48
+ if (indexing) {
49
+ return null;
50
+ }
51
+ return (0, jsx_runtime_1.jsx)(LazyNestedApp, Object.assign({}, props));
52
+ }
65
53
  function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, activeTheme, activeTone, title, height, allowPlaygroundPopup = true, withFrame = true, }) {
66
54
  const rootRef = (0, react_1.useRef)(null);
67
55
  const shadowRef = (0, react_1.useRef)(null);
@@ -72,27 +60,30 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
72
60
  const toneToApply = activeTone || (config === null || config === void 0 ? void 0 : config.defaultTone) || (theme === null || theme === void 0 ? void 0 : theme.activeThemeTone);
73
61
  const { appGlobals } = (0, AppContext_1.useAppContext)();
74
62
  const componentRegistry = (0, ComponentRegistryContext_1.useComponentRegistry)();
75
- const [apiWorker, setApiWorker] = (0, react_1.useState)(undefined);
76
- (0, react_1.useEffect)(() => {
77
- let worker;
78
- (function () {
79
- return __awaiter(this, void 0, void 0, function* () {
80
- const { setupWorker } = yield Promise.resolve().then(() => __importStar(require("msw/browser")));
81
- worker = setupWorker();
82
- worker.start({
83
- onUnhandledRequest: "bypass",
84
- quiet: true,
85
- });
86
- setApiWorker(worker);
87
- });
88
- })();
89
- return () => worker === null || worker === void 0 ? void 0 : worker.stop();
90
- }, []);
63
+ // const [apiWorker, setApiWorker] = useState(undefined);
64
+ // useEffect(() => {
65
+ // let worker;
66
+ // (async function () {
67
+ // const { setupWorker } = await import("msw/browser");
68
+ // worker = setupWorker();
69
+ // worker.start({
70
+ // onUnhandledRequest: "bypass",
71
+ // quiet: true,
72
+ // });
73
+ // setApiWorker(worker);
74
+ // })();
75
+ // return () => worker?.stop();
76
+ // }, []);
91
77
  // console.log("apiWorker", apiWorker);
92
- const mock = (0, react_1.useMemo)(() => {
93
- return api
94
- ? Object.assign(Object.assign({ type: "in-memory" }, api), { apiUrl: "/api" }) : undefined;
95
- }, [api]);
78
+ // const mock = useMemo(() => {
79
+ // return api
80
+ // ? {
81
+ // type: "in-memory",
82
+ // ...api,
83
+ // apiUrl: "/api",
84
+ // }
85
+ // : undefined;
86
+ // }, [api]);
96
87
  //console.log("mock", mock);
97
88
  const useHashBasedRouting = (appGlobals === null || appGlobals === void 0 ? void 0 : appGlobals.useHashBasedRouting) || true;
98
89
  const openPlayground = (0, react_1.useCallback)(() => __awaiter(this, void 0, void 0, function* () {
@@ -120,6 +111,7 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
120
111
  window.open(useHashBasedRouting ? `/#/playground#${appQueryString}` : `/playground#${appQueryString}`, "_blank");
121
112
  }), [app, components, title, activeTheme, activeTone, useHashBasedRouting]);
122
113
  (0, react_1.useEffect)(() => {
114
+ var _a;
123
115
  if (!shadowRef.current && rootRef.current) {
124
116
  // Clone existing style and link tags
125
117
  shadowRef.current = rootRef.current.attachShadow({ mode: "open" });
@@ -159,18 +151,15 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
159
151
  compoundComponents,
160
152
  themes: config === null || config === void 0 ? void 0 : config.themes,
161
153
  }, resources: config === null || config === void 0 ? void 0 : config.resources, extensionManager: componentRegistry.getExtensionManager() }, `app-${nestedAppId}-${refreshVersion}`) }));
162
- (0, react_1.startTransition)(() => {
163
- var _a;
164
- (_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: () => {
165
- openPlayground();
166
- }, 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: () => {
167
- setRefreshVersion(refreshVersion + 1);
168
- }, children: (0, jsx_runtime_1.jsx)(lia_1.LiaUndoAltSolid, {}) }), label: "Reset the app" })] }), nestedAppRoot] })) : (nestedAppRoot) }) }));
169
- });
154
+ (_a = contentRootRef.current) === null || _a === void 0 ? void 0 : _a.render((0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { node: component, 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: () => {
155
+ openPlayground();
156
+ }, 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: () => {
157
+ setRefreshVersion(refreshVersion + 1);
158
+ }, children: (0, jsx_runtime_1.jsx)(lia_1.LiaUndoAltSolid, {}) }), label: "Reset the app" })] }), nestedAppRoot] })) : (nestedAppRoot) }));
170
159
  }, [
171
160
  activeTheme,
172
161
  allowPlaygroundPopup,
173
- apiWorker,
162
+ // apiWorker,
174
163
  app,
175
164
  componentRegistry,
176
165
  components,
@@ -180,7 +169,7 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
180
169
  config === null || config === void 0 ? void 0 : config.resources,
181
170
  config === null || config === void 0 ? void 0 : config.themes,
182
171
  height,
183
- mock,
172
+ // mock,
184
173
  nestedAppId,
185
174
  openPlayground,
186
175
  refreshVersion,
@@ -189,12 +178,18 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
189
178
  toneToApply,
190
179
  withFrame,
191
180
  ]);
181
+ const mountedRef = (0, react_1.useRef)(false);
192
182
  (0, react_1.useEffect)(() => {
183
+ mountedRef.current = true;
193
184
  return () => {
185
+ mountedRef.current = false;
194
186
  setTimeout(() => {
195
187
  var _a;
196
- (_a = contentRootRef.current) === null || _a === void 0 ? void 0 : _a.unmount();
197
- contentRootRef.current = null;
188
+ // Unmount the content root after a delay (and only it the component is not mounted anymore, could happen in dev mode - double useEffect call)
189
+ if (!mountedRef.current) {
190
+ (_a = contentRootRef.current) === null || _a === void 0 ? void 0 : _a.unmount();
191
+ contentRootRef.current = null;
192
+ }
198
193
  });
199
194
  };
200
195
  }, []);
@@ -10,6 +10,7 @@ const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
10
10
  const renderers_1 = require("../../components-core/renderers");
11
11
  const themeVars_1 = require("../../components-core/theming/themeVars");
12
12
  const TableOfContentsNative_1 = require("./TableOfContentsNative");
13
+ const IndexerContext_1 = require("../App/IndexerContext");
13
14
  const COMP = "TableOfContents";
14
15
  const COMP_CHILD = "TableOfContentsItem";
15
16
  exports.TableOfContentsMd = (0, ComponentDefs_1.createMetadata)({
@@ -46,7 +47,14 @@ exports.TableOfContentsMd = (0, ComponentDefs_1.createMetadata)({
46
47
  [`color-${COMP_CHILD}--active`]: "$color-primary-500",
47
48
  },
48
49
  });
50
+ function IndexAwareTableOfContents(props) {
51
+ const { indexing } = (0, IndexerContext_1.useIndexerContext)();
52
+ if (indexing) {
53
+ return null;
54
+ }
55
+ return (0, jsx_runtime_1.jsx)(TableOfContentsNative_1.TableOfContents, Object.assign({}, props));
56
+ }
49
57
  exports.tableOfContentsRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.TableOfContentsMd, ({ layoutCss, node, extractValue }) => {
50
58
  var _a, _b;
51
- return ((0, jsx_runtime_1.jsx)(TableOfContentsNative_1.TableOfContents, { style: layoutCss, smoothScrolling: extractValue.asOptionalBoolean((_a = node.props) === null || _a === void 0 ? void 0 : _a.smoothScrolling), maxHeadingLevel: extractValue.asOptionalNumber((_b = node.props) === null || _b === void 0 ? void 0 : _b.maxHeadingLevel) }));
59
+ return ((0, jsx_runtime_1.jsx)(IndexAwareTableOfContents, { style: layoutCss, smoothScrolling: extractValue.asOptionalBoolean((_a = node.props) === null || _a === void 0 ? void 0 : _a.smoothScrolling), maxHeadingLevel: extractValue.asOptionalNumber((_b = node.props) === null || _b === void 0 ? void 0 : _b.maxHeadingLevel) }));
52
60
  });
@@ -109,7 +109,7 @@ exports.TextMd = (0, ComponentDefs_1.createMetadata)({
109
109
  [`marginBottom-${COMP}-markdown`]: "$space-6",
110
110
  [`fontSize-${COMP}-markdown`]: "$fontSize-normal",
111
111
  [`backgroundColor-${COMP}-code`]: "rgba($color-surface-100-rgb, .4)",
112
- [`borderColor-${COMP}-code`]: "$color-surface-300",
112
+ [`borderColor-${COMP}-code`]: "$color-surface-100",
113
113
  [`backgroundColor-${COMP}-keyboard`]: "rgba($color-surface-100-rgb, .4)",
114
114
  [`borderColor-${COMP}-keyboard`]: "$color-surface-300",
115
115
  [`backgroundColor-${COMP}-marked`]: "rgba($color-primary-200-rgb, .4)",
@@ -17,6 +17,7 @@ const constants_1 = require("../../components-core/constants");
17
17
  const ErrorBoundary_1 = require("../../components-core/rendering/ErrorBoundary");
18
18
  const NotificationToast_1 = require("./NotificationToast");
19
19
  const InspectorContext_1 = require("../../components-core/InspectorContext");
20
+ const IndexerContext_1 = require("../App/IndexerContext");
20
21
  function getClassName(css) {
21
22
  return `theme-${calculateHash(css)}`;
22
23
  }
@@ -150,6 +151,10 @@ function Theme({ id, isRoot = false, renderChild, node, tone, toastDuration = 50
150
151
  }
151
152
  : {};
152
153
  }, [devToolsEnabled, devToolsSide, devToolsSize]);
154
+ const { indexing } = (0, IndexerContext_1.useIndexerContext)();
155
+ if (indexing) {
156
+ return children;
157
+ }
153
158
  if (isRoot) {
154
159
  const faviconUrl = getResourceUrl("resource:favicon") || "/resources/favicon.ico";
155
160
  return (
@@ -26,6 +26,7 @@ const PageableLoader_1 = require("../loader/PageableLoader");
26
26
  const Loader_1 = require("../loader/Loader");
27
27
  const AppContext_1 = require("../AppContext");
28
28
  const hooks_1 = require("../utils/hooks");
29
+ const IndexerContext_1 = require("../../components/App/IndexerContext");
29
30
  function DataLoader({ loader, state, registerComponentApi, onLoaded, onError, loaderInProgressChanged, loaderIsRefetchingChanged, loaderLoaded, loaderError, transformResult, structuralSharing = true, }) {
30
31
  const appContext = (0, AppContext_1.useAppContext)();
31
32
  const url = (0, extractParam_1.extractParam)(state, loader.props.url, appContext);
@@ -317,11 +318,18 @@ exports.DataLoaderMd = (0, ComponentDefs_1.createMetadata)({
317
318
  error: (0, ComponentDefs_1.d)("This event fires when an error occurs while fetching data"),
318
319
  },
319
320
  });
321
+ function IndexAwareDataLoader(props) {
322
+ const { indexing } = (0, IndexerContext_1.useIndexerContext)();
323
+ if (indexing) {
324
+ return null;
325
+ }
326
+ return (0, jsx_runtime_1.jsx)(DataLoader, Object.assign({}, props));
327
+ }
320
328
  exports.dataLoaderRenderer = (0, renderers_1.createLoaderRenderer)("DataLoader", ({ loader, state, loaderLoaded, loaderInProgressChanged, loaderIsRefetchingChanged, loaderError, registerComponentApi, lookupAction, lookupSyncCallback, extractValue }) => {
321
329
  var _a, _b, _c;
322
330
  // --- Check for required properties
323
331
  if (!((_a = loader.props) === null || _a === void 0 ? void 0 : _a.url) || !loader.props.url.trim()) {
324
332
  throw new Error("You must specify a non-empty (not whitespace-only) 'url' property for DataSource");
325
333
  }
326
- return ((0, jsx_runtime_1.jsx)(DataLoader, { loader: loader, state: state, loaderInProgressChanged: loaderInProgressChanged, loaderIsRefetchingChanged: loaderIsRefetchingChanged, loaderLoaded: loaderLoaded, loaderError: loaderError, registerComponentApi: registerComponentApi, transformResult: lookupSyncCallback(loader.props.transformResult), onLoaded: lookupAction((_b = loader.events) === null || _b === void 0 ? void 0 : _b.loaded, { eventName: "loaded" }), onError: lookupAction((_c = loader.events) === null || _c === void 0 ? void 0 : _c.error, { eventName: "error" }), structuralSharing: extractValue.asOptionalBoolean(loader.props.structuralSharing) }));
334
+ return ((0, jsx_runtime_1.jsx)(IndexAwareDataLoader, { loader: loader, state: state, loaderInProgressChanged: loaderInProgressChanged, loaderIsRefetchingChanged: loaderIsRefetchingChanged, loaderLoaded: loaderLoaded, loaderError: loaderError, registerComponentApi: registerComponentApi, transformResult: lookupSyncCallback(loader.props.transformResult), onLoaded: lookupAction((_b = loader.events) === null || _b === void 0 ? void 0 : _b.loaded, { eventName: "loaded" }), onError: lookupAction((_c = loader.events) === null || _c === void 0 ? void 0 : _c.error, { eventName: "error" }), structuralSharing: extractValue.asOptionalBoolean(loader.props.structuralSharing) }));
327
335
  }, exports.DataLoaderMd);
@@ -325,6 +325,13 @@ exports.Container = (0, react_1.memo)((0, react_1.forwardRef)(function Container
325
325
  return runCodeAsync(src, uid, options, ...(0, lodash_es_1.cloneDeep)(eventArgs));
326
326
  };
327
327
  }
328
+ else if (src.type) {
329
+ // --- We have an arrow expression to execute
330
+ fnCacheKey = `${options === null || options === void 0 ? void 0 : options.eventName};${JSON.stringify(src)}`;
331
+ handler = (...eventArgs) => {
332
+ return runCodeAsync(src, uid, options, ...(0, lodash_es_1.cloneDeep)(eventArgs));
333
+ };
334
+ }
328
335
  else {
329
336
  // --- We have an unknown event handler
330
337
  throw new Error("Invalid event handler");
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Diag_Attr_Identifier_Expected = exports.Diag_End_Or_Close_Token_Expected = exports.Diag_OpenNodeStart_Token_Expected = exports.Diag_Eq_Token_Expected = exports.Diag_Attr_Value_Expected = exports.Diag_Tag_Identifier_Expected = exports.Diag_CloseNodeStart_Token_Expected = exports.Diag_End_Token_Expected = exports.Diag_Unterminated_Script = exports.Diag_Unterminated_CData = exports.Diag_Unterminated_Comment = exports.Diag_Unterminated_String_Literal = exports.Diag_Invalid_Character = exports.ErrCodes = exports.DiagnosticCategory = void 0;
3
+ exports.Diag_Tag_Name_Afterd_Namespace_Expected = exports.Diag_Attr_Identifier_Expected = exports.Diag_End_Or_Close_Token_Expected = exports.Diag_OpenNodeStart_Token_Expected = exports.Diag_Eq_Token_Expected = exports.Diag_Attr_Value_Expected = exports.Diag_Tag_Identifier_Expected = exports.Diag_CloseNodeStart_Token_Expected = exports.Diag_End_Token_Expected = exports.Diag_Unterminated_Script = exports.Diag_Unterminated_CData = exports.Diag_Unterminated_Comment = exports.Diag_Unterminated_String_Literal = exports.Diag_Invalid_Character = exports.ErrCodes = exports.DiagnosticCategory = void 0;
4
4
  exports.diagnosticCategoryName = diagnosticCategoryName;
5
5
  var DiagnosticCategory;
6
6
  (function (DiagnosticCategory) {
@@ -13,7 +13,7 @@ var ErrCodes;
13
13
  (function (ErrCodes) {
14
14
  ErrCodes["onlyOneElem"] = "U002";
15
15
  ErrCodes["expTagOpen"] = "U003";
16
- ErrCodes["expTagIdent"] = "U004";
16
+ ErrCodes["expTagName"] = "U004";
17
17
  ErrCodes["expCloseStart"] = "U005";
18
18
  ErrCodes["expEndOrClose"] = "U006";
19
19
  ErrCodes["tagNameMismatch"] = "U007";
@@ -23,6 +23,7 @@ var ErrCodes;
23
23
  ErrCodes["expAttrValue"] = "U011";
24
24
  ErrCodes["duplAttr"] = "U012";
25
25
  ErrCodes["uppercaseAttr"] = "U013";
26
+ ErrCodes["tagNameExpAfterNamespace"] = "U014";
26
27
  ErrCodes["invalidChar"] = "W001";
27
28
  ErrCodes["untermStr"] = "W002";
28
29
  ErrCodes["untermComment"] = "W007";
@@ -70,8 +71,8 @@ exports.Diag_CloseNodeStart_Token_Expected = {
70
71
  };
71
72
  exports.Diag_Tag_Identifier_Expected = {
72
73
  category: DiagnosticCategory.Error,
73
- code: ErrCodes.expTagIdent,
74
- message: "A tag identifier expected.",
74
+ code: ErrCodes.expTagName,
75
+ message: "A tag name expected.",
75
76
  };
76
77
  exports.Diag_Attr_Value_Expected = {
77
78
  category: DiagnosticCategory.Error,
@@ -98,3 +99,8 @@ exports.Diag_Attr_Identifier_Expected = {
98
99
  code: ErrCodes.expAttrIdent,
99
100
  message: `An attribute identifier expected.`,
100
101
  };
102
+ exports.Diag_Tag_Name_Afterd_Namespace_Expected = {
103
+ category: DiagnosticCategory.Error,
104
+ code: ErrCodes.tagNameExpAfterNamespace,
105
+ message: `A tag name expected after a namespaces.`,
106
+ };