xmlui 0.9.21 → 0.9.25
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/apiInterceptorWorker-CFF3bC6o.mjs +818 -0
- package/dist/{index-B3CWFAxa.mjs → index-DtxDGaqF.mjs} +11942 -3291
- package/dist/index.css +1301 -564
- package/dist/language-server-web-worker.mjs +1 -1
- package/dist/language-server.mjs +1 -1
- package/dist/lint-CYAUfk0_.mjs +168 -0
- package/dist/metadata-utils-CCIMqe69.mjs +466 -0
- package/dist/scripts/package.json +252 -0
- package/dist/scripts/src/components/App/AppLayoutContext.js +0 -1
- package/dist/scripts/src/components/App/AppNative.js +21 -9
- package/dist/scripts/src/components/AppHeader/AppHeader.js +1 -1
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +5 -2
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +13 -10
- package/dist/scripts/src/components/Bookmark/BookmarkNative.js +5 -1
- package/dist/scripts/src/components/CodeBlock/CodeBlock.js +31 -0
- package/dist/scripts/src/components/CodeBlock/CodeBlockNative.js +82 -0
- package/dist/scripts/src/components/ComponentProvider.js +5 -0
- package/dist/scripts/src/components/DatePicker/DatePickerNative.js +1 -0
- package/dist/scripts/src/components/Form/FormContext.js +5 -4
- package/dist/scripts/src/components/Form/FormNative.js +41 -43
- package/dist/scripts/src/components/Form/formActions.js +1 -1
- package/dist/scripts/src/components/FormItem/FormItem.js +6 -3
- package/dist/scripts/src/components/FormItem/FormItemNative.js +56 -15
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +1 -1
- package/dist/scripts/src/components/Heading/Heading.js +13 -0
- package/dist/scripts/src/components/Heading/HeadingNative.js +1 -1
- package/dist/scripts/src/components/HtmlTags/HtmlTags.js +7 -3
- package/dist/scripts/src/components/Icon/DarkToLightIcon.js +10 -0
- package/dist/scripts/src/components/Icon/LightToDark.js +10 -0
- package/dist/scripts/src/components/IconProvider.js +4 -0
- package/dist/scripts/src/components/Image/ImageNative.js +1 -1
- package/dist/scripts/src/components/Items/ItemsNative.js +8 -6
- package/dist/scripts/src/components/Link/Link.js +5 -5
- package/dist/scripts/src/components/List/ListNative.js +1 -1
- package/dist/scripts/src/components/Markdown/Markdown.js +52 -16
- package/dist/scripts/src/components/Markdown/MarkdownNative.js +34 -73
- package/dist/scripts/src/components/Markdown/highlight-code.js +160 -0
- package/dist/scripts/src/components/Markdown/parse-binding-expr.js +60 -0
- package/dist/scripts/src/components/Markdown/utils.js +282 -0
- package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +116 -0
- package/dist/scripts/src/components/ModalDialog/Dialog.js +20 -0
- package/dist/scripts/src/components/NavGroup/NavGroupNative.js +4 -5
- package/dist/scripts/src/components/NestedApp/NestedApp.js +61 -0
- package/dist/scripts/src/components/NestedApp/NestedAppNative.js +125 -0
- package/dist/scripts/src/components/NestedApp/Tooltip.js +46 -0
- package/dist/scripts/src/components/NumberBox/NumberBox.js +4 -1
- package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +2 -2
- package/dist/scripts/src/components/Option/Option.js +3 -2
- package/dist/scripts/src/components/Select/Select.js +5 -3
- package/dist/scripts/src/components/Select/SelectNative.js +53 -40
- package/dist/scripts/src/components/SelectionStore/SelectionStore.js +1 -1
- package/dist/scripts/src/components/Spinner/Spinner.js +0 -1
- package/dist/scripts/src/components/TableOfContents/TableOfContents.js +1 -0
- package/dist/scripts/src/components/Text/Text.js +12 -1
- package/dist/scripts/src/components/Text/TextNative.js +5 -1
- package/dist/scripts/src/components/TextBox/TextBox.js +6 -1
- package/dist/scripts/src/components/TextBox/TextBoxNative.js +2 -2
- package/dist/scripts/src/components/Theme/ThemeNative.js +7 -3
- package/dist/scripts/src/components/ToneChangerButton/ToneChangerButton.js +1 -3
- package/dist/scripts/src/components-core/RestApiProxy.js +10 -7
- package/dist/scripts/src/components-core/TableOfContentsContext.js +1 -1
- package/dist/scripts/src/components-core/appContext/date-functions.js +23 -0
- package/dist/scripts/src/components-core/appContext/math-function.js +27 -0
- package/dist/scripts/src/components-core/appContext/misc-utils.js +13 -0
- package/dist/scripts/src/components-core/interception/ApiInterceptor.js +199 -0
- package/dist/scripts/src/components-core/interception/ApiInterceptorProvider.js +94 -0
- package/dist/scripts/src/components-core/interception/Backend.js +128 -0
- package/dist/scripts/src/components-core/interception/Errors.js +129 -0
- package/dist/scripts/src/components-core/interception/InMemoryDb.js +41 -0
- package/dist/scripts/src/components-core/interception/IndexedDb.js +207 -0
- package/dist/scripts/src/components-core/interception/ReadonlyCollection.js +145 -0
- package/dist/scripts/src/components-core/interception/abstractions.js +2 -0
- package/dist/scripts/src/components-core/interception/apiInterceptorWorker.js +46 -0
- package/dist/scripts/src/components-core/interception/useApiInterceptorContext.js +9 -0
- package/dist/scripts/src/components-core/rendering/AppContent.js +336 -0
- package/dist/scripts/src/components-core/rendering/AppRoot.js +84 -0
- package/dist/scripts/src/components-core/rendering/AppWrapper.js +49 -0
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +17 -7
- package/dist/scripts/src/components-core/rendering/Container.js +2 -1
- package/dist/scripts/src/components-core/theming/ThemeProvider.js +2 -7
- package/dist/scripts/src/components-core/theming/themes/root.js +1 -0
- package/dist/scripts/src/components-core/utils/date-utils.js +78 -0
- package/dist/scripts/src/components-core/utils/hooks.js +26 -0
- package/dist/scripts/src/components-core/utils/misc.js +1 -1
- package/dist/scripts/src/components-core/utils/request-params.js +70 -0
- package/dist/scripts/src/logging/LoggerContext.js +22 -0
- package/dist/scripts/src/logging/LoggerInitializer.js +14 -0
- package/dist/scripts/src/logging/LoggerService.js +60 -0
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +7 -0
- package/dist/{server-common-DW5h7Q34.mjs → server-common-9TiLMTJj.mjs} +106 -98
- package/dist/style.css +3314 -2823
- package/dist/{lint-EcgF-9Wr.mjs → transform-DC0Gy6qw.mjs} +1246 -540
- package/dist/xmlui-metadata.mjs +2850 -2665
- package/dist/xmlui-metadata.umd.js +2850 -2665
- package/dist/xmlui-parser.d.ts +49 -4
- package/dist/xmlui-parser.mjs +49 -48
- package/dist/xmlui-standalone.umd.js +34674 -31457
- package/dist/xmlui.d.ts +3 -1
- package/dist/xmlui.mjs +10 -10
- package/package.json +3 -1
- package/dist/apiInterceptorWorker-7aKQ2rBj.mjs +0 -8447
- package/dist/parser-CBXS8ft2.mjs +0 -1196
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.observePlaygroundPattern = observePlaygroundPattern;
|
|
4
|
+
exports.parseSegmentProps = parseSegmentProps;
|
|
5
|
+
exports.parsePlaygroundPattern = parsePlaygroundPattern;
|
|
6
|
+
exports.convertPlaygroundPatternToMarkdown = convertPlaygroundPatternToMarkdown;
|
|
7
|
+
function observePlaygroundPattern(content) {
|
|
8
|
+
const startPattern = "```xmlui-pg";
|
|
9
|
+
const endPattern = "```";
|
|
10
|
+
const startIndex = content.indexOf(startPattern);
|
|
11
|
+
if (startIndex === -1) {
|
|
12
|
+
return null; // No match for the start pattern
|
|
13
|
+
}
|
|
14
|
+
// Find the end of the start pattern
|
|
15
|
+
const startContentIndex = content.indexOf("\n", startIndex);
|
|
16
|
+
if (startContentIndex === -1) {
|
|
17
|
+
return null; // Malformed pattern, no newline after start
|
|
18
|
+
}
|
|
19
|
+
// Search for the end pattern after the start content
|
|
20
|
+
let endIndex = startContentIndex;
|
|
21
|
+
while (endIndex !== -1) {
|
|
22
|
+
endIndex = content.indexOf(endPattern, endIndex + 1);
|
|
23
|
+
if (endIndex !== -1) {
|
|
24
|
+
// Check if the end pattern is not part of {pg-content} (escaped with backticks)
|
|
25
|
+
const precedingChar = content[endIndex - 1];
|
|
26
|
+
if (precedingChar !== "\\") {
|
|
27
|
+
return [
|
|
28
|
+
startIndex,
|
|
29
|
+
endIndex + endPattern.length,
|
|
30
|
+
content.substring(startIndex, endIndex + endPattern.length),
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return null; // No valid end pattern found
|
|
36
|
+
}
|
|
37
|
+
function parseSegmentProps(input) {
|
|
38
|
+
const segment = {};
|
|
39
|
+
// --- Match the "display" flag
|
|
40
|
+
if (/\bdisplay\b/.test(input)) {
|
|
41
|
+
segment.display = true;
|
|
42
|
+
}
|
|
43
|
+
// --- Match the "copy" flag
|
|
44
|
+
if (/\bcopy\b/.test(input)) {
|
|
45
|
+
segment.copy = true;
|
|
46
|
+
}
|
|
47
|
+
// --- Match the "noPopup" flag
|
|
48
|
+
if (/\bnoPopup\b/.test(input)) {
|
|
49
|
+
segment.noPopup = true;
|
|
50
|
+
}
|
|
51
|
+
// Match the "highlights" pattern
|
|
52
|
+
const highlightsMatch = input.match(/\{([^\}]+)\}/);
|
|
53
|
+
if (highlightsMatch) {
|
|
54
|
+
const highlights = highlightsMatch[1].split(",").map((range) => {
|
|
55
|
+
if (range.includes("-")) {
|
|
56
|
+
const [start, end] = range.split("-").map(Number);
|
|
57
|
+
return [start, end]; // Represent ranges as [start, end]
|
|
58
|
+
}
|
|
59
|
+
return Number(range); // Represent single numbers as numbers
|
|
60
|
+
});
|
|
61
|
+
segment.highlights = highlights;
|
|
62
|
+
}
|
|
63
|
+
// Match the "filename" property
|
|
64
|
+
const filenameMatch = input.match(/\bfilename="([^"]+)"/);
|
|
65
|
+
if (filenameMatch) {
|
|
66
|
+
segment.filename = filenameMatch[1];
|
|
67
|
+
}
|
|
68
|
+
// Match the "name" property
|
|
69
|
+
const nameMatch = input.match(/\bname="([^"]+)"/);
|
|
70
|
+
if (nameMatch) {
|
|
71
|
+
segment.name = nameMatch[1];
|
|
72
|
+
}
|
|
73
|
+
// Match the "height" property
|
|
74
|
+
const heightMatch = input.match(/\bheight="([^"]+)"/);
|
|
75
|
+
if (heightMatch) {
|
|
76
|
+
segment.height = heightMatch[1];
|
|
77
|
+
}
|
|
78
|
+
return segment;
|
|
79
|
+
}
|
|
80
|
+
function parsePlaygroundPattern(content) {
|
|
81
|
+
var _a, _b, _c, _d;
|
|
82
|
+
const pattern = {};
|
|
83
|
+
const match = observePlaygroundPattern(content);
|
|
84
|
+
if (!match) {
|
|
85
|
+
return pattern;
|
|
86
|
+
}
|
|
87
|
+
// --- Extract the pattern content
|
|
88
|
+
const [_startIndex, _endIndex, patternContent] = match;
|
|
89
|
+
const lines = patternContent.split("\n");
|
|
90
|
+
pattern.default = parseSegmentProps(lines[0].trim());
|
|
91
|
+
let segmentContent = "";
|
|
92
|
+
let currentMode = "";
|
|
93
|
+
let foundSegment = false;
|
|
94
|
+
let order = 0;
|
|
95
|
+
for (let i = 1; i < lines.length - 1; i++) {
|
|
96
|
+
const line = lines[i];
|
|
97
|
+
if (line.startsWith("---app")) {
|
|
98
|
+
const appSegment = parseSegmentProps(line);
|
|
99
|
+
pattern.app = Object.assign({}, appSegment);
|
|
100
|
+
closeCurrentMode("app");
|
|
101
|
+
}
|
|
102
|
+
else if (line.startsWith("---comp")) {
|
|
103
|
+
closeCurrentMode("comp");
|
|
104
|
+
const compSegment = parseSegmentProps(line);
|
|
105
|
+
(_a = pattern.components) !== null && _a !== void 0 ? _a : (pattern.components = []);
|
|
106
|
+
pattern.components.push(compSegment);
|
|
107
|
+
}
|
|
108
|
+
else if (line.startsWith("---config")) {
|
|
109
|
+
const configSegment = parseSegmentProps(line);
|
|
110
|
+
(_b = pattern.config) !== null && _b !== void 0 ? _b : (pattern.config = Object.assign({}, configSegment));
|
|
111
|
+
closeCurrentMode("config");
|
|
112
|
+
}
|
|
113
|
+
else if (line.startsWith("---api")) {
|
|
114
|
+
const apiSegment = parseSegmentProps(line);
|
|
115
|
+
(_c = pattern.api) !== null && _c !== void 0 ? _c : (pattern.api = Object.assign({}, apiSegment));
|
|
116
|
+
closeCurrentMode("api");
|
|
117
|
+
}
|
|
118
|
+
else if (line.startsWith("---desc")) {
|
|
119
|
+
closeCurrentMode("desc");
|
|
120
|
+
const descSegment = parseSegmentProps(line);
|
|
121
|
+
(_d = pattern.descriptions) !== null && _d !== void 0 ? _d : (pattern.descriptions = []);
|
|
122
|
+
pattern.descriptions.push(descSegment);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
// Append the line to the current segment content
|
|
126
|
+
segmentContent += line + "\n";
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// --- Handle the last segment
|
|
130
|
+
if (foundSegment) {
|
|
131
|
+
closeCurrentMode("");
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
pattern.app = Object.assign(Object.assign({}, pattern.default), { content: segmentContent, order });
|
|
135
|
+
}
|
|
136
|
+
return pattern;
|
|
137
|
+
function closeCurrentMode(newMode) {
|
|
138
|
+
foundSegment = true;
|
|
139
|
+
switch (currentMode) {
|
|
140
|
+
case "app":
|
|
141
|
+
pattern.app.content = segmentContent;
|
|
142
|
+
pattern.app.order = order++;
|
|
143
|
+
break;
|
|
144
|
+
case "comp":
|
|
145
|
+
pattern.components[pattern.components.length - 1].content = segmentContent;
|
|
146
|
+
pattern.components[pattern.components.length - 1].order = order++;
|
|
147
|
+
break;
|
|
148
|
+
case "config":
|
|
149
|
+
pattern.config.content = segmentContent;
|
|
150
|
+
pattern.config.order = order++;
|
|
151
|
+
break;
|
|
152
|
+
case "api":
|
|
153
|
+
pattern.api.content = segmentContent;
|
|
154
|
+
pattern.api.order = order++;
|
|
155
|
+
break;
|
|
156
|
+
case "desc":
|
|
157
|
+
pattern.descriptions[pattern.descriptions.length - 1].content = segmentContent;
|
|
158
|
+
pattern.descriptions[pattern.descriptions.length - 1].order = order++;
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
segmentContent = "";
|
|
162
|
+
currentMode = newMode;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function convertPlaygroundPatternToMarkdown(content) {
|
|
166
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
167
|
+
const pattern = parsePlaygroundPattern(content);
|
|
168
|
+
// --- Determine max order for segments
|
|
169
|
+
let maxOrder = 0;
|
|
170
|
+
if (((_a = pattern.app) === null || _a === void 0 ? void 0 : _a.order) > maxOrder) {
|
|
171
|
+
maxOrder = pattern.app.order;
|
|
172
|
+
}
|
|
173
|
+
if (((_b = pattern.config) === null || _b === void 0 ? void 0 : _b.order) > maxOrder) {
|
|
174
|
+
maxOrder = pattern.config.order;
|
|
175
|
+
}
|
|
176
|
+
if (((_c = pattern.api) === null || _c === void 0 ? void 0 : _c.order) > maxOrder) {
|
|
177
|
+
maxOrder = pattern.api.order;
|
|
178
|
+
}
|
|
179
|
+
if (pattern.descriptions) {
|
|
180
|
+
pattern.descriptions.forEach((desc) => {
|
|
181
|
+
if (desc.order > maxOrder) {
|
|
182
|
+
maxOrder = desc.order;
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
if (pattern.components) {
|
|
187
|
+
pattern.components.forEach((comp) => {
|
|
188
|
+
if (comp.order > maxOrder) {
|
|
189
|
+
maxOrder = comp.order;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
// --- Assemble the final markdown content
|
|
194
|
+
let markdownContent = "";
|
|
195
|
+
const pgContent = { noPopup: (_d = pattern.default) === null || _d === void 0 ? void 0 : _d.noPopup };
|
|
196
|
+
// --- Extract optional playground attributes
|
|
197
|
+
if (pattern.default.height) {
|
|
198
|
+
pgContent.height = pattern.default.height;
|
|
199
|
+
}
|
|
200
|
+
if (pattern.default.name) {
|
|
201
|
+
pgContent.name = pattern.default.name;
|
|
202
|
+
}
|
|
203
|
+
// --- Iterate through segments
|
|
204
|
+
for (let i = 0; i <= maxOrder; i++) {
|
|
205
|
+
let segment;
|
|
206
|
+
let type = "";
|
|
207
|
+
if (((_e = pattern.app) === null || _e === void 0 ? void 0 : _e.order) === i) {
|
|
208
|
+
segment = pattern.app;
|
|
209
|
+
type = "app";
|
|
210
|
+
}
|
|
211
|
+
else if (((_f = pattern.config) === null || _f === void 0 ? void 0 : _f.order) === i) {
|
|
212
|
+
segment = pattern.config;
|
|
213
|
+
type = "config";
|
|
214
|
+
}
|
|
215
|
+
else if (((_g = pattern.api) === null || _g === void 0 ? void 0 : _g.order) === i) {
|
|
216
|
+
segment = pattern.api;
|
|
217
|
+
type = "api";
|
|
218
|
+
}
|
|
219
|
+
if (!segment && pattern.descriptions) {
|
|
220
|
+
const descSegment = pattern.descriptions.find((desc) => desc.order === i);
|
|
221
|
+
if (descSegment) {
|
|
222
|
+
segment = descSegment;
|
|
223
|
+
type = "desc";
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (!segment && pattern.components) {
|
|
227
|
+
const compSegment = pattern.components.find((comp) => comp.order === i);
|
|
228
|
+
if (compSegment) {
|
|
229
|
+
segment = compSegment;
|
|
230
|
+
type = "comp";
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (segment === undefined) {
|
|
234
|
+
continue; // Skip if no segment found
|
|
235
|
+
}
|
|
236
|
+
// --- Assemble the app
|
|
237
|
+
// --- Assemble segment attributes
|
|
238
|
+
let segmentAttrs = `${segment.copy ? "copy" : ""} ` +
|
|
239
|
+
`${segment.filename ? `filename="${segment.filename}"` : ""} ` +
|
|
240
|
+
`${segment.name ? `name="${segment.name}"` : ""}`;
|
|
241
|
+
if (segment.highlights && segment.highlights.length > 0) {
|
|
242
|
+
const highlights = segment.highlights
|
|
243
|
+
.map((highlight) => Array.isArray(highlight) ? `${highlight[0]}-${highlight[1]}` : highlight)
|
|
244
|
+
.join(",");
|
|
245
|
+
segmentAttrs += `{${highlights}}`;
|
|
246
|
+
}
|
|
247
|
+
segmentAttrs = segmentAttrs.trim().replace(/\s+/g, " ");
|
|
248
|
+
switch (type) {
|
|
249
|
+
case "app":
|
|
250
|
+
if (segment.display) {
|
|
251
|
+
markdownContent += "```xmlui " + segmentAttrs + "\n" + segment.content + "```\n\n";
|
|
252
|
+
}
|
|
253
|
+
pgContent.app = segment.content;
|
|
254
|
+
break;
|
|
255
|
+
case "config":
|
|
256
|
+
if (segment.display) {
|
|
257
|
+
markdownContent += "```json " + segmentAttrs + "\n" + segment.content + "```\n\n";
|
|
258
|
+
}
|
|
259
|
+
pgContent.config = segment.content;
|
|
260
|
+
break;
|
|
261
|
+
case "api":
|
|
262
|
+
// --- Never display API segments
|
|
263
|
+
pgContent.api = segment.content;
|
|
264
|
+
break;
|
|
265
|
+
case "comp":
|
|
266
|
+
if (segment.display) {
|
|
267
|
+
markdownContent += "```xmlui " + segmentAttrs + "\n" + segment.content + "```\n\n";
|
|
268
|
+
}
|
|
269
|
+
(_h = pgContent.components) !== null && _h !== void 0 ? _h : (pgContent.components = []);
|
|
270
|
+
pgContent.components.push(segment.content);
|
|
271
|
+
break;
|
|
272
|
+
case "desc":
|
|
273
|
+
markdownContent += segment.content + "\n";
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
// --- Convert the JSON representation of pgContent to a base64 string
|
|
278
|
+
const jsonString = JSON.stringify(pgContent);
|
|
279
|
+
const base64String = btoa(jsonString);
|
|
280
|
+
markdownContent += '<samp data-pg-content="' + base64String + '"></samp>\n\n';
|
|
281
|
+
return markdownContent;
|
|
282
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.ConfirmationModalContextProvider = exports.useConfirm = void 0;
|
|
46
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
47
|
+
const react_1 = __importStar(require("react"));
|
|
48
|
+
const ButtonNative_1 = require("../Button/ButtonNative");
|
|
49
|
+
const StackNative_1 = require("../Stack/StackNative");
|
|
50
|
+
const Dialog_1 = require("./Dialog");
|
|
51
|
+
const ConfirmationModalContext = react_1.default.createContext({
|
|
52
|
+
confirm: (title, message, actionLabel) => __awaiter(void 0, void 0, void 0, function* () { return false; }),
|
|
53
|
+
});
|
|
54
|
+
const useConfirm = () => (0, react_1.useContext)(ConfirmationModalContext);
|
|
55
|
+
exports.useConfirm = useConfirm;
|
|
56
|
+
const ConfirmationModalContextProvider = ({ children }) => {
|
|
57
|
+
// State
|
|
58
|
+
const [showConfirmationModal, setShowConfirmationModal] = (0, react_1.useState)(false);
|
|
59
|
+
const [title, setTitle] = (0, react_1.useState)("Are you sure?");
|
|
60
|
+
const [message, setMessage] = (0, react_1.useState)();
|
|
61
|
+
const [buttons, setButtons] = (0, react_1.useState)([]);
|
|
62
|
+
// Refs and other
|
|
63
|
+
const resolver = (0, react_1.useRef)(null);
|
|
64
|
+
const buttonsRef = (0, react_1.useRef)(null);
|
|
65
|
+
(0, react_1.useEffect)(() => {
|
|
66
|
+
if (showConfirmationModal) {
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
var _a;
|
|
69
|
+
const focusable = (_a = buttonsRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll("button");
|
|
70
|
+
if (focusable) {
|
|
71
|
+
focusable[focusable.length - 1].focus();
|
|
72
|
+
}
|
|
73
|
+
}, 0);
|
|
74
|
+
}
|
|
75
|
+
}, [showConfirmationModal]);
|
|
76
|
+
const handleShow = (0, react_1.useCallback)((title, message, actionLabel) => __awaiter(void 0, void 0, void 0, function* () {
|
|
77
|
+
if (typeof title === "string") {
|
|
78
|
+
setTitle(title);
|
|
79
|
+
setButtons([
|
|
80
|
+
{
|
|
81
|
+
label: actionLabel || "Ok",
|
|
82
|
+
value: true,
|
|
83
|
+
},
|
|
84
|
+
]);
|
|
85
|
+
setMessage(message);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
setTitle(title.title);
|
|
89
|
+
setButtons(title.buttons);
|
|
90
|
+
setMessage(title.message);
|
|
91
|
+
}
|
|
92
|
+
setShowConfirmationModal(true);
|
|
93
|
+
return new Promise(function (resolve) {
|
|
94
|
+
resolver.current = resolve;
|
|
95
|
+
});
|
|
96
|
+
}), []);
|
|
97
|
+
const handleOk = (0, react_1.useCallback)((value) => {
|
|
98
|
+
resolver.current && resolver.current(value);
|
|
99
|
+
setShowConfirmationModal(false);
|
|
100
|
+
}, []);
|
|
101
|
+
const handleCancel = (0, react_1.useCallback)(() => {
|
|
102
|
+
resolver.current && resolver.current(false);
|
|
103
|
+
setShowConfirmationModal(false);
|
|
104
|
+
}, []);
|
|
105
|
+
const contextValue = (0, react_1.useMemo)(() => {
|
|
106
|
+
return {
|
|
107
|
+
confirm: handleShow,
|
|
108
|
+
};
|
|
109
|
+
}, [handleShow]);
|
|
110
|
+
return ((0, jsx_runtime_1.jsxs)(ConfirmationModalContext.Provider, { value: contextValue, children: [children, showConfirmationModal && ((0, jsx_runtime_1.jsx)(Dialog_1.Dialog, { title: title, description: message, isOpen: true, onClose: handleCancel, buttons: (0, jsx_runtime_1.jsxs)(StackNative_1.Stack, { orientation: "horizontal", horizontalAlignment: "end", style: { width: "100%", gap: "1em" }, ref: buttonsRef, children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", themeColor: "secondary", size: "sm", onClick: handleCancel, children: "Cancel" }), buttons.length > 1 ? (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 } }) : undefined, buttons.map(({ label, value, variant = "solid", themeColor = "attention" }, index) => {
|
|
111
|
+
return ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: variant, themeColor: themeColor, size: "sm", type: "submit", onClick: () => {
|
|
112
|
+
handleOk(value);
|
|
113
|
+
}, children: label }, index));
|
|
114
|
+
})] }) }))] }));
|
|
115
|
+
};
|
|
116
|
+
exports.ConfirmationModalContextProvider = ConfirmationModalContextProvider;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Dialog = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const Dialog_module_scss_1 = __importDefault(require("./Dialog.module.scss"));
|
|
9
|
+
const TextNative_1 = require("../Text/TextNative");
|
|
10
|
+
const ModalDialogNative_1 = require("./ModalDialogNative");
|
|
11
|
+
/**
|
|
12
|
+
* Dialog component that is customizable with action buttons. The children prop accepts React elements.
|
|
13
|
+
*
|
|
14
|
+
* Note that clicking outside of the dialog or pressing Escape will call the onClose function.
|
|
15
|
+
* Thus, if you want to stop that from firing, do so in the onClose function from outside.
|
|
16
|
+
*/
|
|
17
|
+
const Dialog = ({ title, description, children, isOpen, onClose, buttons, }) => {
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)(ModalDialogNative_1.ModalDialog, { onClose: onClose, isInitiallyOpen: isOpen, title: title, children: [(0, jsx_runtime_1.jsxs)("div", { className: Dialog_module_scss_1.default.dialogContent, children: [(0, jsx_runtime_1.jsx)("div", { id: "dialogDesc", children: (0, jsx_runtime_1.jsx)(TextNative_1.Text, { children: description }) }), children] }), !!buttons && (0, jsx_runtime_1.jsx)("footer", { className: Dialog_module_scss_1.default.dialogActions, children: buttons })] }));
|
|
19
|
+
};
|
|
20
|
+
exports.Dialog = Dialog;
|
|
@@ -18,8 +18,8 @@ const NavPanelNative_1 = require("../NavPanel/NavPanelNative");
|
|
|
18
18
|
exports.defaultProps = {
|
|
19
19
|
iconHorizontalExpanded: "chevronleft",
|
|
20
20
|
iconHorizontalCollapsed: "chevronright",
|
|
21
|
-
iconVerticalExpanded: "
|
|
22
|
-
iconVerticalCollapsed: "
|
|
21
|
+
iconVerticalExpanded: "chevrondown",
|
|
22
|
+
iconVerticalCollapsed: "chevronright",
|
|
23
23
|
};
|
|
24
24
|
const NavGroupContext = (0, react_1.createContext)({
|
|
25
25
|
level: -1,
|
|
@@ -34,8 +34,7 @@ exports.NavGroup = (0, react_1.forwardRef)(function NavGroup({ node, style, labe
|
|
|
34
34
|
const navPanelContext = (0, react_1.useContext)(NavPanelNative_1.NavPanelContext);
|
|
35
35
|
let inline = (appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === "vertical" ||
|
|
36
36
|
(appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === "vertical-sticky" ||
|
|
37
|
-
(appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === "vertical-full-header"
|
|
38
|
-
(appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === "vertical-constrained-width";
|
|
37
|
+
(appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === "vertical-full-header";
|
|
39
38
|
if (navPanelContext !== null) {
|
|
40
39
|
inline = navPanelContext.inDrawer;
|
|
41
40
|
}
|
|
@@ -47,7 +46,7 @@ exports.NavGroup = (0, react_1.forwardRef)(function NavGroup({ node, style, labe
|
|
|
47
46
|
iconVerticalCollapsed: iconVerticalCollapsed !== null && iconVerticalCollapsed !== void 0 ? iconVerticalCollapsed : exports.defaultProps.iconVerticalCollapsed,
|
|
48
47
|
iconVerticalExpanded: iconVerticalExpanded !== null && iconVerticalExpanded !== void 0 ? iconVerticalExpanded : exports.defaultProps.iconVerticalExpanded,
|
|
49
48
|
};
|
|
50
|
-
}, [level]);
|
|
49
|
+
}, [iconHorizontalCollapsed, iconHorizontalExpanded, iconVerticalCollapsed, iconVerticalExpanded, level]);
|
|
51
50
|
return ((0, jsx_runtime_1.jsx)(NavGroupContext.Provider, { value: navGroupContextValue, children: inline ? ((0, jsx_runtime_1.jsx)(ExpandableNavGroup, { to: to, style: style, label: label, icon: icon, node: node, renderChild: renderChild, ref: ref, initiallyExpanded: initiallyExpanded })) : ((0, jsx_runtime_1.jsx)(DropDownNavGroup, { label: label, icon: icon, node: node, renderChild: renderChild, ref: ref, to: to })) }));
|
|
52
51
|
});
|
|
53
52
|
const ExpandableNavGroup = (0, react_1.forwardRef)(function ExpandableNavGroup({ style = constants_1.EMPTY_OBJECT, label, icon, renderChild, node, to, initiallyExpanded = false, }, ref) {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.nestedAppComponentRenderer = exports.NestedAppMd = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const NestedApp_module_scss_1 = __importDefault(require("./NestedApp.module.scss"));
|
|
9
|
+
const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
|
|
10
|
+
const renderers_1 = require("../../components-core/renderers");
|
|
11
|
+
const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
12
|
+
const NestedAppNative_1 = require("./NestedAppNative");
|
|
13
|
+
const COMP = "NestedApp";
|
|
14
|
+
exports.NestedAppMd = (0, ComponentDefs_1.createMetadata)({
|
|
15
|
+
description: `The ${COMP} component allows you to nest an entire xmlui app into another one.
|
|
16
|
+
`,
|
|
17
|
+
props: {
|
|
18
|
+
app: {
|
|
19
|
+
description: "The source markup of the app to be nested",
|
|
20
|
+
},
|
|
21
|
+
api: {
|
|
22
|
+
description: "This property defines an optional emulated API to be used with the nested app.",
|
|
23
|
+
},
|
|
24
|
+
components: {
|
|
25
|
+
description: "This property defines an optional list of components to be used with the nested app.",
|
|
26
|
+
},
|
|
27
|
+
config: {
|
|
28
|
+
description: "You can define the nested app's configuration with this property.",
|
|
29
|
+
},
|
|
30
|
+
activeTheme: {
|
|
31
|
+
description: "This property defines the active theme for the nested app.",
|
|
32
|
+
},
|
|
33
|
+
activeTone: {
|
|
34
|
+
description: "This property defines the active tone for the nested app.",
|
|
35
|
+
},
|
|
36
|
+
title: {
|
|
37
|
+
description: "The title of the nested app.",
|
|
38
|
+
},
|
|
39
|
+
height: {
|
|
40
|
+
description: "The height of the nested app.",
|
|
41
|
+
},
|
|
42
|
+
allowPlaygroundPopup: {
|
|
43
|
+
description: "This property defines whether the nested app can be opened in the xmlui playground.",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
themeVars: (0, themeVars_1.parseScssVar)(NestedApp_module_scss_1.default.themeVars),
|
|
47
|
+
defaultThemeVars: {
|
|
48
|
+
[`marginTop-${COMP}`]: "$space-3",
|
|
49
|
+
[`marginBottom-${COMP}`]: "$space-3",
|
|
50
|
+
[`padding-${COMP}`]: "$space-4",
|
|
51
|
+
[`paddingTop-${COMP}`]: "$space-3",
|
|
52
|
+
[`borderRadius-${COMP}`]: "$space-4",
|
|
53
|
+
[`backgroundColor-frame-${COMP}`]: "$color-primary-100",
|
|
54
|
+
[`gap-frame-${COMP}`]: "$space-4",
|
|
55
|
+
[`fontWeight-header-${COMP}`]: "$fontWeight-bold",
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
exports.nestedAppComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.NestedAppMd, ({ node, extractValue }) => {
|
|
59
|
+
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
|
+
});
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.NestedApp = NestedApp;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const client_1 = __importDefault(require("react-dom/client"));
|
|
10
|
+
const NestedApp_module_scss_1 = __importDefault(require("./NestedApp.module.scss"));
|
|
11
|
+
const AppRoot_1 = require("../../components-core/rendering/AppRoot");
|
|
12
|
+
const lia_1 = require("react-icons/lia");
|
|
13
|
+
const rx_1 = require("react-icons/rx");
|
|
14
|
+
const xmlui_parser_1 = require("../../components-core/xmlui-parser");
|
|
15
|
+
const ApiInterceptorProvider_1 = require("../../components-core/interception/ApiInterceptorProvider");
|
|
16
|
+
const ErrorBoundary_1 = require("../../components-core/rendering/ErrorBoundary");
|
|
17
|
+
const browser_1 = require("msw/browser");
|
|
18
|
+
const Tooltip_1 = require("./Tooltip");
|
|
19
|
+
const ThemeContext_1 = require("../../components-core/theming/ThemeContext");
|
|
20
|
+
const constants_1 = require("../../components-core/constants");
|
|
21
|
+
function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, activeTheme, activeTone, title, height, allowPlaygroundPopup = true, }) {
|
|
22
|
+
const rootRef = (0, react_1.useRef)(null);
|
|
23
|
+
const shadowRef = (0, react_1.useRef)(null);
|
|
24
|
+
const contentRootRef = (0, react_1.useRef)(null);
|
|
25
|
+
const nestedAppId = (0, react_1.useId)();
|
|
26
|
+
const [refreshVersion, setRefreshVersion] = (0, react_1.useState)(0);
|
|
27
|
+
const theme = (0, ThemeContext_1.useTheme)();
|
|
28
|
+
const toneToApply = activeTone || (config === null || config === void 0 ? void 0 : config.defaultTone) || (theme === null || theme === void 0 ? void 0 : theme.activeThemeTone);
|
|
29
|
+
const apiWorker = (0, react_1.useMemo)(() => {
|
|
30
|
+
if (typeof document !== "undefined") {
|
|
31
|
+
return (0, browser_1.setupWorker)();
|
|
32
|
+
}
|
|
33
|
+
}, []);
|
|
34
|
+
(0, react_1.useEffect)(() => {
|
|
35
|
+
apiWorker === null || apiWorker === void 0 ? void 0 : apiWorker.start({
|
|
36
|
+
onUnhandledRequest: "bypass",
|
|
37
|
+
quiet: true,
|
|
38
|
+
});
|
|
39
|
+
return () => apiWorker === null || apiWorker === void 0 ? void 0 : apiWorker.stop();
|
|
40
|
+
}, [apiWorker]);
|
|
41
|
+
// console.log("apiWorker", apiWorker);
|
|
42
|
+
const mock = (0, react_1.useMemo)(() => {
|
|
43
|
+
return api
|
|
44
|
+
? Object.assign(Object.assign({ type: "in-memory" }, api), { apiUrl: "/api" }) : undefined;
|
|
45
|
+
}, [api]);
|
|
46
|
+
//console.log("mock", mock);
|
|
47
|
+
(0, react_1.useEffect)(() => {
|
|
48
|
+
var _a;
|
|
49
|
+
if (!shadowRef.current && rootRef.current) {
|
|
50
|
+
// Clone existing style and link tags
|
|
51
|
+
shadowRef.current = rootRef.current.attachShadow({ mode: "open" });
|
|
52
|
+
const styleSheets = document.querySelectorAll('style, link[rel="stylesheet"]');
|
|
53
|
+
styleSheets.forEach((el) => {
|
|
54
|
+
if (el.hasAttribute("data-theme-root")) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
shadowRef.current.appendChild(el.cloneNode(true));
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (!contentRootRef.current && shadowRef.current) {
|
|
61
|
+
contentRootRef.current = client_1.default.createRoot(shadowRef.current);
|
|
62
|
+
}
|
|
63
|
+
let { errors, component, erroneousCompoundComponentName } = (0, xmlui_parser_1.xmlUiMarkupToComponent)(`<Fragment xmlns:XMLUIExtensions="component-ns">${app}</Fragment>`);
|
|
64
|
+
if (errors.length > 0) {
|
|
65
|
+
component = (0, xmlui_parser_1.errReportComponent)(errors, "Main.xmlui", erroneousCompoundComponentName);
|
|
66
|
+
}
|
|
67
|
+
const compoundComponents = (components !== null && components !== void 0 ? components : []).map((src) => {
|
|
68
|
+
const isErrorReportComponent = typeof src !== "string";
|
|
69
|
+
if (isErrorReportComponent) {
|
|
70
|
+
return src;
|
|
71
|
+
}
|
|
72
|
+
let { errors, component, erroneousCompoundComponentName } = (0, xmlui_parser_1.xmlUiMarkupToComponent)(src);
|
|
73
|
+
if (errors.length > 0) {
|
|
74
|
+
return (0, xmlui_parser_1.errReportComponent)(errors, `nested xmlui`, erroneousCompoundComponentName);
|
|
75
|
+
}
|
|
76
|
+
return component;
|
|
77
|
+
});
|
|
78
|
+
let globalProps = Object.assign(Object.assign({ name: config === null || config === void 0 ? void 0 : config.name }, ((config === null || config === void 0 ? void 0 : config.appGlobals) || {})), { apiUrl: "" });
|
|
79
|
+
// css variables are leaking into to shadow dom, so we reset them here
|
|
80
|
+
const themeVarReset = {};
|
|
81
|
+
Object.keys(theme.themeStyles).forEach((key) => {
|
|
82
|
+
themeVarReset[key] = "initial";
|
|
83
|
+
});
|
|
84
|
+
(_a = contentRootRef.current) === null || _a === void 0 ? void 0 : _a.render((0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { node: component, children: (0, jsx_runtime_1.jsx)(ApiInterceptorProvider_1.ApiInterceptorProvider, { interceptor: mock, apiWorker: apiWorker, children: (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.nestedAppContainer, children: [(0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.header, children: [(0, jsx_runtime_1.jsx)("span", { className: NestedApp_module_scss_1.default.headerText, children: title }), (0, jsx_runtime_1.jsx)("div", { className: NestedApp_module_scss_1.default.spacer }), allowPlaygroundPopup && ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
|
|
85
|
+
// TODO: Open the app in a new window
|
|
86
|
+
}, 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: () => {
|
|
87
|
+
setRefreshVersion(refreshVersion + 1);
|
|
88
|
+
}, children: (0, jsx_runtime_1.jsx)(lia_1.LiaUndoAltSolid, {}) }), label: "Reset the app" })] }), (0, jsx_runtime_1.jsx)("div", { style: Object.assign({ height }, themeVarReset), children: (0, jsx_runtime_1.jsx)(AppRoot_1.AppRoot, { previewMode: true, standalone: true, trackContainerHeight: height ? "fixed" : "auto", node: component, globalProps: globalProps, defaultTheme: activeTheme || (config === null || config === void 0 ? void 0 : config.defaultTheme), defaultTone: toneToApply, contributes: {
|
|
89
|
+
compoundComponents,
|
|
90
|
+
themes: config === null || config === void 0 ? void 0 : config.themes,
|
|
91
|
+
}, resources: config === null || config === void 0 ? void 0 : config.resources }, `app-${nestedAppId}-${refreshVersion}`) })] }) }) }));
|
|
92
|
+
}, [
|
|
93
|
+
activeTheme,
|
|
94
|
+
allowPlaygroundPopup,
|
|
95
|
+
apiWorker,
|
|
96
|
+
app,
|
|
97
|
+
components,
|
|
98
|
+
config === null || config === void 0 ? void 0 : config.appGlobals,
|
|
99
|
+
config === null || config === void 0 ? void 0 : config.defaultTheme,
|
|
100
|
+
config === null || config === void 0 ? void 0 : config.name,
|
|
101
|
+
config === null || config === void 0 ? void 0 : config.resources,
|
|
102
|
+
config === null || config === void 0 ? void 0 : config.themes,
|
|
103
|
+
height,
|
|
104
|
+
mock,
|
|
105
|
+
nestedAppId,
|
|
106
|
+
refreshVersion,
|
|
107
|
+
theme.themeStyles,
|
|
108
|
+
title,
|
|
109
|
+
toneToApply,
|
|
110
|
+
]);
|
|
111
|
+
(0, react_1.useEffect)(() => {
|
|
112
|
+
return () => {
|
|
113
|
+
var _a;
|
|
114
|
+
(_a = contentRootRef.current) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
115
|
+
contentRootRef.current = null;
|
|
116
|
+
};
|
|
117
|
+
}, []);
|
|
118
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: NestedApp_module_scss_1.default.nestedApp, children: (0, jsx_runtime_1.jsx)("div", { ref: rootRef, style: {
|
|
119
|
+
width: "100%",
|
|
120
|
+
height: "100%",
|
|
121
|
+
overflow: "auto",
|
|
122
|
+
position: "relative",
|
|
123
|
+
isolation: "isolate",
|
|
124
|
+
} }) }));
|
|
125
|
+
}
|