xmlui 0.9.73 → 0.9.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/{apiInterceptorWorker-VgjaTiLV.mjs → apiInterceptorWorker-DXW_XKKI.mjs} +149 -149
- package/dist/lib/{index-By3AkYm2.mjs → index-D1pmdW3I.mjs} +7600 -7530
- package/dist/lib/index.css +1 -1
- package/dist/lib/xmlui-parser.d.ts +3 -0
- package/dist/lib/xmlui.d.ts +7 -2
- package/dist/lib/xmlui.mjs +1 -1
- package/dist/metadata/{apiInterceptorWorker-BGM0pNVK.mjs → apiInterceptorWorker-BFjqjbag.mjs} +134 -134
- package/dist/metadata/{collectedComponentMetadata-CduyISDB.mjs → collectedComponentMetadata-BVLAibj_.mjs} +7738 -7669
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +102 -102
- package/dist/scripts/package.json +1 -1
- package/dist/scripts/src/components/Markdown/MarkdownNative.js +1 -1
- package/dist/scripts/src/components/Markdown/utils.js +15 -5
- package/dist/scripts/src/components/NestedApp/AppWithCodeViewNative.js +3 -3
- package/dist/scripts/src/components/NestedApp/NestedAppNative.js +46 -18
- package/dist/scripts/src/components-core/interception/ApiInterceptor.js +6 -1
- package/dist/scripts/src/components-core/rendering/AppContent.js +4 -1
- package/dist/scripts/src/components-core/rendering/AppRoot.js +2 -2
- package/dist/scripts/src/components-core/rendering/AppWrapper.js +2 -2
- package/dist/standalone/xmlui-standalone.es.d.ts +7 -2
- package/dist/standalone/xmlui-standalone.umd.js +247 -247
- package/package.json +1 -1
|
@@ -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 (((
|
|
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 (((
|
|
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 (((
|
|
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
|
-
(
|
|
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: [
|
|
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,27 @@ 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
|
-
|
|
31
|
-
|
|
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);
|
|
50
|
+
console.log("Rendering NestedApp with props:", restProps);
|
|
32
51
|
(0, react_1.useEffect)(() => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
52
|
+
if (!immediate) {
|
|
53
|
+
(0, react_1.startTransition)(() => {
|
|
54
|
+
setShouldRender(true);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}, [immediate]);
|
|
37
58
|
if (!shouldRender) {
|
|
38
59
|
return null;
|
|
39
60
|
}
|
|
40
|
-
return (0, jsx_runtime_1.jsx)(NestedApp, Object.assign({},
|
|
61
|
+
return (0, jsx_runtime_1.jsx)(NestedApp, Object.assign({}, restProps));
|
|
41
62
|
}
|
|
42
63
|
function IndexAwareNestedApp(props) {
|
|
43
64
|
const { indexing } = (0, IndexerContext_1.useIndexerContext)();
|
|
@@ -46,7 +67,7 @@ function IndexAwareNestedApp(props) {
|
|
|
46
67
|
}
|
|
47
68
|
return (0, jsx_runtime_1.jsx)(LazyNestedApp, Object.assign({}, props));
|
|
48
69
|
}
|
|
49
|
-
function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, activeTheme, activeTone, height, style, refreshVersion }) {
|
|
70
|
+
function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, activeTheme, activeTone, height, style, refreshVersion, withSplashScreen = false, className, }) {
|
|
50
71
|
const rootRef = (0, react_1.useRef)(null);
|
|
51
72
|
const shadowRef = (0, react_1.useRef)(null);
|
|
52
73
|
const contentRootRef = (0, react_1.useRef)(null);
|
|
@@ -54,6 +75,8 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
|
|
|
54
75
|
const toneToApply = activeTone || (config === null || config === void 0 ? void 0 : config.defaultTone) || (theme === null || theme === void 0 ? void 0 : theme.activeThemeTone);
|
|
55
76
|
const componentRegistry = (0, ComponentRegistryContext_1.useComponentRegistry)();
|
|
56
77
|
const parentInterceptorContext = (0, useApiInterceptorContext_1.useApiInterceptorContext)();
|
|
78
|
+
const [initialized, setInitialized] = (0, react_1.useState)(!withSplashScreen);
|
|
79
|
+
const [revealAnimationFinished, setRevealAnimationFinished] = (0, react_1.useState)(false);
|
|
57
80
|
//TODO illesg: we should come up with something to make sure that nestedApps don't overwrite each other's mocked api endpoints
|
|
58
81
|
// disabled for now, as it messes up the paths of not mocked APIs (e.g. resources/{staticJsonfiles})
|
|
59
82
|
//const safeId = playgroundId || nestedAppId;
|
|
@@ -75,7 +98,7 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
|
|
|
75
98
|
}
|
|
76
99
|
return Object.assign(Object.assign({}, apiObject), { type: "in-memory" });
|
|
77
100
|
}, [api]);
|
|
78
|
-
(0,
|
|
101
|
+
(0, hooks_1.useIsomorphicLayoutEffect)(() => {
|
|
79
102
|
if (!shadowRef.current && rootRef.current) {
|
|
80
103
|
// Clone existing style and link tags
|
|
81
104
|
shadowRef.current = rootRef.current.attachShadow({ mode: "open" });
|
|
@@ -120,6 +143,9 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
|
|
|
120
143
|
contentRootRef.current = client_1.default.createRoot(shadowRef.current);
|
|
121
144
|
}
|
|
122
145
|
}, []);
|
|
146
|
+
const onInit = (0, react_1.useCallback)(() => {
|
|
147
|
+
setInitialized(true);
|
|
148
|
+
}, []);
|
|
123
149
|
(0, react_1.useEffect)(() => {
|
|
124
150
|
var _a;
|
|
125
151
|
let { errors, component, erroneousCompoundComponentName } = (0, xmlui_parser_1.xmlUiMarkupToComponent)(app);
|
|
@@ -143,11 +169,12 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
|
|
|
143
169
|
Object.keys(theme.themeStyles).forEach((key) => {
|
|
144
170
|
themeVarReset[key] = "initial";
|
|
145
171
|
});
|
|
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: {
|
|
172
|
+
(_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
173
|
compoundComponents,
|
|
148
174
|
themes: config === null || config === void 0 ? void 0 : config.themes,
|
|
149
175
|
}, resources: config === null || config === void 0 ? void 0 : config.resources, extensionManager: componentRegistry.getExtensionManager() }) }) }, `app-${refreshVersion}`) }));
|
|
150
176
|
}, [
|
|
177
|
+
onInit,
|
|
151
178
|
activeTheme,
|
|
152
179
|
app,
|
|
153
180
|
componentRegistry,
|
|
@@ -163,7 +190,7 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
|
|
|
163
190
|
style,
|
|
164
191
|
theme.themeStyles,
|
|
165
192
|
toneToApply,
|
|
166
|
-
refreshVersion
|
|
193
|
+
refreshVersion,
|
|
167
194
|
]);
|
|
168
195
|
const mountedRef = (0, react_1.useRef)(false);
|
|
169
196
|
(0, react_1.useEffect)(() => {
|
|
@@ -180,11 +207,12 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
|
|
|
180
207
|
}, 0);
|
|
181
208
|
};
|
|
182
209
|
}, []);
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
210
|
+
const animationFinished = (0, react_1.useCallback)(() => {
|
|
211
|
+
setRevealAnimationFinished(true);
|
|
212
|
+
}, []);
|
|
213
|
+
const shouldAnimate = withSplashScreen && !revealAnimationFinished;
|
|
214
|
+
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, {
|
|
215
|
+
[NestedApp_module_scss_1.default.shouldAnimate]: shouldAnimate,
|
|
216
|
+
[NestedApp_module_scss_1.default.initialized]: initialized,
|
|
217
|
+
}) })] }));
|
|
190
218
|
}
|
|
@@ -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
|
-
|
|
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);
|
|
@@ -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;
|