@wireweave/core 4.0.0-beta.12 → 4.0.0-beta.14

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 (53) hide show
  1. package/dist/app.cjs +51 -31
  2. package/dist/app.d.cts +5 -145
  3. package/dist/app.d.ts +5 -145
  4. package/dist/app.js +2 -31
  5. package/dist/{chunk-QOS4IC75.js → chunk-2Y3GKARZ.js} +16 -1354
  6. package/dist/chunk-3RWGG5EC.js +296 -342
  7. package/dist/chunk-4DDV6Z2X.js +389 -0
  8. package/dist/chunk-ETV4XYOV.cjs +4 -6
  9. package/dist/chunk-IMUVIIJR.cjs +317 -354
  10. package/dist/chunk-LA5LKIEL.cjs +396 -0
  11. package/dist/chunk-MD6MNOEQ.cjs +121 -142
  12. package/dist/chunk-NV6UV5ID.cjs +2145 -0
  13. package/dist/chunk-PKBMQBKP.js +1 -3
  14. package/dist/{chunk-7VTK6LHL.cjs → chunk-SAN6CJEE.cjs} +96 -1421
  15. package/dist/chunk-TQSOLTMZ.js +2132 -0
  16. package/dist/chunk-V3HVWC7C.js +1 -32
  17. package/dist/chunk-XYACLXXF.js +4 -132
  18. package/dist/chunk-ZPHNXJRY.cjs +158 -180
  19. package/dist/index-BD_4rXH-.d.cts +1031 -0
  20. package/dist/{index-Br7pNaf3.d.cts → index-BEnsO2kE.d.ts} +144 -2
  21. package/dist/{index-G906GEtg.d.cts → index-BlNYFaZd.d.cts} +2 -2
  22. package/dist/{index-CghCKUPx.d.ts → index-Cx4-VXVS.d.ts} +2 -2
  23. package/dist/{index-Da_B3eoM.d.ts → index-YSIzfhOd.d.cts} +144 -2
  24. package/dist/index-g9yV20xb.d.ts +1031 -0
  25. package/dist/index.cjs +939 -429
  26. package/dist/index.d.cts +16 -193
  27. package/dist/index.d.ts +16 -193
  28. package/dist/index.js +210 -396
  29. package/dist/interaction.cjs +26 -17
  30. package/dist/interaction.d.cts +2 -2
  31. package/dist/interaction.d.ts +2 -2
  32. package/dist/interaction.js +1 -17
  33. package/dist/parser.cjs +38 -21
  34. package/dist/parser.d.cts +3 -3
  35. package/dist/parser.d.ts +3 -3
  36. package/dist/parser.js +1 -21
  37. package/dist/renderer.cjs +124 -68
  38. package/dist/renderer.d.cts +4 -756
  39. package/dist/renderer.d.ts +4 -756
  40. package/dist/renderer.js +3 -68
  41. package/dist/spec.cjs +94 -49
  42. package/dist/spec.js +1 -49
  43. package/dist/{types-vhPCZpAW.d.cts → types-CGRi1k2N.d.cts} +1 -1
  44. package/dist/{types-vhPCZpAW.d.ts → types-CGRi1k2N.d.ts} +1 -1
  45. package/dist/{v4-types-Baz9yqAS.d.cts → v4-types-2ORUg6To.d.cts} +1 -1
  46. package/dist/{v4-types-Baz9yqAS.d.ts → v4-types-2ORUg6To.d.ts} +1 -1
  47. package/package.json +21 -23
  48. package/dist/chunk-4TMDPWPR.cjs +0 -196
  49. package/dist/chunk-5DGRIQDU.cjs +0 -842
  50. package/dist/chunk-JJWAFHSV.js +0 -842
  51. package/dist/chunk-R5WBZWBC.js +0 -196
  52. package/dist/chunk-WV724EAW.js +0 -0
  53. package/dist/chunk-XENFKHRC.cjs +0 -1
@@ -0,0 +1,396 @@
1
+ 'use strict';
2
+
3
+ var chunkNV6UV5ID_cjs = require('./chunk-NV6UV5ID.cjs');
4
+ var chunkIMUVIIJR_cjs = require('./chunk-IMUVIIJR.cjs');
5
+ var chunkZPHNXJRY_cjs = require('./chunk-ZPHNXJRY.cjs');
6
+
7
+ // src/export/v4-svg.ts
8
+ var MAX_DIMENSION = 16384;
9
+ var DEFAULT_WIDTH = 1440;
10
+ var DEFAULT_HEIGHT = 900;
11
+ var DEFAULT_GAP = 64;
12
+ function escapeXml(value) {
13
+ return String(value).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
14
+ }
15
+ function scalar(value) {
16
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean")
17
+ return String(value);
18
+ return "";
19
+ }
20
+ function label(node) {
21
+ var _a, _b, _c;
22
+ const attrs = node.node.attributes;
23
+ return scalar((_c = (_b = (_a = node.node.label) != null ? _a : attrs.label) != null ? _b : attrs.aria) != null ? _c : "");
24
+ }
25
+ function estimateHeight(node) {
26
+ const children = node.children.reduce((sum, child) => sum + estimateHeight(child), 0);
27
+ return Math.max(42, 34 + children + (children > 0 ? 12 : 0));
28
+ }
29
+ function fillFor(kind) {
30
+ if (kind === "page") return "#ffffff";
31
+ if (["title", "text"].includes(kind)) return "#fafafa";
32
+ if (["button", "link", "nav-item", "dropdown-item"].includes(kind)) return "#e5e7eb";
33
+ if (["input", "textarea", "select", "checkbox", "radio", "switch", "slider"].includes(kind))
34
+ return "#f3f4f6";
35
+ if (["alert", "toast", "annotation-item"].includes(kind)) return "#fef3c7";
36
+ return "#ffffff";
37
+ }
38
+ function isObject(value) {
39
+ return value !== null && typeof value === "object" && !Array.isArray(value);
40
+ }
41
+ function operationLosses(node, source) {
42
+ const handlers = Array.isArray(node.node.attributes.on) ? node.node.attributes.on : [];
43
+ const losses = [];
44
+ for (const handler of handlers) {
45
+ if (!isObject(handler) || !Array.isArray(handler.operations)) continue;
46
+ for (const operation of handler.operations) {
47
+ if (!isObject(operation)) continue;
48
+ const operationId = scalar(operation.id);
49
+ if (!operationId) continue;
50
+ losses.push({
51
+ code: "WW_EXPORT_STATIC_INTERACTION",
52
+ kind: "interaction",
53
+ message: "Stateful interaction semantics require the executable app runtime.",
54
+ renderedId: node.renderedId,
55
+ operationId,
56
+ source,
57
+ details: { executionClass: scalar(operation.executionClass) }
58
+ });
59
+ }
60
+ }
61
+ return losses;
62
+ }
63
+ function validateProfile(profile, data) {
64
+ var _a, _b;
65
+ if (profile === null || typeof profile !== "object") return null;
66
+ const value = profile;
67
+ if (value.id !== "wireweave-static-svg-v1") return null;
68
+ const fallbackWidth = Number((_a = data == null ? void 0 : data.bundle.profile.width) != null ? _a : DEFAULT_WIDTH);
69
+ const fallbackHeight = Number((_b = data == null ? void 0 : data.bundle.profile.height) != null ? _b : DEFAULT_HEIGHT);
70
+ const width = value.width === void 0 ? fallbackWidth : value.width;
71
+ const height = value.height === void 0 ? fallbackHeight : value.height;
72
+ const gap = value.gap === void 0 ? DEFAULT_GAP : value.gap;
73
+ const background = value.background === void 0 ? "#ffffff" : value.background;
74
+ if (typeof width !== "number" || typeof height !== "number" || typeof gap !== "number" || typeof background !== "string" || !Number.isFinite(width) || !Number.isFinite(height) || !Number.isFinite(gap) || width <= 0 || height <= 0 || gap < 0 || width > MAX_DIMENSION || height > MAX_DIMENSION || gap > MAX_DIMENSION || background.length === 0 || background.length > 128)
75
+ return null;
76
+ const screens = value.screens === void 0 ? "selected" : value.screens;
77
+ if (screens !== "selected" && screens !== "all") return null;
78
+ const board = value.board;
79
+ if (board !== void 0 && (board === null || typeof board !== "object" || typeof board.namespace !== "string" || typeof board.id !== "string" || board.variant !== void 0 && typeof board.variant !== "string"))
80
+ return null;
81
+ return {
82
+ id: "wireweave-static-svg-v1",
83
+ ...board === void 0 ? {} : { board },
84
+ width,
85
+ height,
86
+ gap,
87
+ background,
88
+ screens
89
+ };
90
+ }
91
+ function routeKey(route) {
92
+ var _a;
93
+ return `${route.namespace}/${route.id}/${(_a = route.variant) != null ? _a : ""}`;
94
+ }
95
+ function routeHref(route) {
96
+ return `#wf/${encodeURIComponent(route.namespace)}/${encodeURIComponent(route.id)}${route.variant === void 0 ? "" : `?variant=${encodeURIComponent(route.variant)}`}`;
97
+ }
98
+ function renderNode(node, x, y, width, sourceMap) {
99
+ const height = estimateHeight(node);
100
+ const kind = node.node.kind;
101
+ const text = label(node);
102
+ const source = sourceMap.get(node.renderedId);
103
+ const identity = source === void 0 ? "{}" : chunkNV6UV5ID_cjs.jcs(source.identity);
104
+ const attrs = node.node.attributes;
105
+ const interactionIds = Array.isArray(attrs.on) ? attrs.on.filter(isObject).flatMap(
106
+ (handler) => Array.isArray(handler.operations) ? handler.operations.filter(isObject).map((operation) => scalar(operation.id)) : []
107
+ ).filter(Boolean).join(",") : "";
108
+ const metadata = ` id="${escapeXml(node.renderedId)}" data-wf-kind="${escapeXml(kind)}" data-wf-source="${escapeXml(node.source.sourceId)}:${node.source.start}-${node.source.end}" data-wf-identity="${escapeXml(identity)}"` + (interactionIds ? ` data-wf-operation-ids="${escapeXml(interactionIds)}"` : "");
109
+ const rect = `<rect x="${x}" y="${y}" width="${Math.max(1, width)}" height="${height}" rx="4" fill="${escapeXml(fillFor(kind))}" stroke="#52525b" stroke-width="1"/>`;
110
+ const title = text ? `<text x="${x + 10}" y="${y + 23}" font-family="system-ui,sans-serif" font-size="14" fill="#18181b">${escapeXml(text)}</text>` : `<text x="${x + 10}" y="${y + 23}" font-family="system-ui,sans-serif" font-size="11" fill="#71717a">${escapeXml(kind)}</text>`;
111
+ let childY = y + 34;
112
+ const children = node.children.map((child) => {
113
+ const rendered = renderNode(child, x + 16, childY, Math.max(32, width - 32), sourceMap);
114
+ childY += rendered.height;
115
+ return rendered.markup;
116
+ }).join("");
117
+ let group = `<g${metadata}>${rect}${title}${children}</g>`;
118
+ if (node.route !== void 0) group = `<a href="${escapeXml(routeHref(node.route))}">${group}</a>`;
119
+ return { markup: group, height };
120
+ }
121
+ function screenRoots(data, screen) {
122
+ var _a;
123
+ const shell = screen.shell === void 0 ? void 0 : data.shells.find((entry) => entry.owner.key === screen.shell);
124
+ return [...(_a = shell == null ? void 0 : shell.children) != null ? _a : [], ...screen.children];
125
+ }
126
+ function exportLinkedAppToSvg(linked, profile) {
127
+ const data = chunkNV6UV5ID_cjs.getLinkedAppData(linked);
128
+ if (data === void 0)
129
+ return chunkNV6UV5ID_cjs.failed([chunkNV6UV5ID_cjs.diagnostic("WW_SCHEMA", "app.untrusted-linked-model", void 0, {}, "compile")]);
130
+ const valid = validateProfile(profile, data);
131
+ if (valid === null)
132
+ return chunkNV6UV5ID_cjs.failed([
133
+ chunkNV6UV5ID_cjs.diagnostic("WW_EXPORT_PROFILE", "export.invalid-svg-profile", void 0, {}, "compile")
134
+ ]);
135
+ const screens = data.screens.slice().sort((a, b) => routeKey(a.route).localeCompare(routeKey(b.route)));
136
+ const selected = valid.screens === "all" ? screens : screens.filter((screen) => {
137
+ var _a;
138
+ const target = (_a = valid.board) != null ? _a : data.bundle.entry;
139
+ return routeKey(screen.route) === routeKey(target);
140
+ });
141
+ if (selected.length === 0)
142
+ return chunkNV6UV5ID_cjs.failed([
143
+ chunkNV6UV5ID_cjs.diagnostic("WW_EXPORT_BOARD", "export.board-not-found", void 0, {}, "compile")
144
+ ]);
145
+ const boards = selected.map((screen, index) => ({
146
+ route: screen.route,
147
+ children: screenRoots(data, screen),
148
+ x: index * (valid.width + valid.gap)
149
+ }));
150
+ const renderedNodes = boards.flatMap((board) => {
151
+ const pending = [...board.children];
152
+ const result = [];
153
+ while (pending.length > 0) {
154
+ const node = pending.shift();
155
+ result.push(node);
156
+ pending.unshift(...node.children);
157
+ }
158
+ return result;
159
+ });
160
+ const sourceMap = new Map(
161
+ data.sourceMap.filter((entry) => renderedNodes.some((node) => node.renderedId === entry.renderedId)).sort((a, b) => a.renderedId.localeCompare(b.renderedId)).map((entry) => [entry.renderedId, entry])
162
+ );
163
+ const lossReport = renderedNodes.flatMap((node) => {
164
+ const source = sourceMap.get(node.renderedId);
165
+ return source === void 0 ? [] : operationLosses(node, source);
166
+ });
167
+ const diagnostics = lossReport.length ? [
168
+ {
169
+ severity: "warning",
170
+ code: "WW_EXPORT_STATIC_INTERACTION",
171
+ message: "The SVG is static; operation semantics are recorded in lossReport.",
172
+ details: { count: lossReport.length }
173
+ }
174
+ ] : [];
175
+ const boardMarkup = boards.map((board) => {
176
+ const route = escapeXml(routeKey(board.route));
177
+ let rootY = 44;
178
+ const roots = board.children.map((node) => {
179
+ const rendered = renderNode(node, board.x + 16, rootY, valid.width - 32, sourceMap);
180
+ rootY += rendered.height;
181
+ return rendered.markup;
182
+ }).join("");
183
+ return `<g data-wf-board="${route}"><rect x="${board.x}" y="0" width="${valid.width}" height="${valid.height}" fill="${escapeXml(valid.background)}" stroke="#27272a" stroke-width="2"/><text x="${board.x + 16}" y="26" font-family="system-ui,sans-serif" font-size="16" font-weight="600" fill="#18181b">${escapeXml(route)}</text>${roots}</g>`;
184
+ }).join("");
185
+ const width = valid.screens === "all" ? valid.width * boards.length + valid.gap * (boards.length - 1) : valid.width;
186
+ const height = valid.height;
187
+ const manifest = {
188
+ schemaVersion: "1.0.0",
189
+ exporter: "wireweave-static-svg-v1",
190
+ appId: data.bundle.id,
191
+ linkedDigest: linked.digest,
192
+ profileDigest: chunkIMUVIIJR_cjs.digestV4(chunkNV6UV5ID_cjs.jcs(valid)),
193
+ boardRoutes: boards.map(({ route }) => route),
194
+ sourceMap: [...sourceMap.values()],
195
+ lossReport
196
+ };
197
+ const svg = `<?xml version="1.0" encoding="UTF-8"?>
198
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${width} ${height}" width="${width}" height="${height}" data-wireweave-export="${manifest.exporter}"><title>${escapeXml(data.bundle.id)}</title><desc>Wireweave static projection for ${escapeXml(manifest.boardRoutes.map(routeKey).join(", "))}</desc><metadata>${escapeXml(chunkNV6UV5ID_cjs.jcs(manifest))}</metadata>${boardMarkup}</svg>`;
199
+ const artifact = chunkNV6UV5ID_cjs.freeze({
200
+ kind: "V4SvgArtifact",
201
+ mediaType: "image/svg+xml",
202
+ svg,
203
+ width,
204
+ height,
205
+ digest: chunkIMUVIIJR_cjs.digestV4(svg),
206
+ manifest,
207
+ diagnostics
208
+ });
209
+ return { ok: true, value: artifact, diagnostics: [] };
210
+ }
211
+
212
+ // src/renderer/canvas-renderer.ts
213
+ var DEFAULT_GAP2 = 64;
214
+ var DEFAULT_PREFIX = "wf";
215
+ function layoutCanvas(pages, gap = DEFAULT_GAP2) {
216
+ const placed = [];
217
+ let cursorX = 0;
218
+ let maxRight = 0;
219
+ let maxBottom = 0;
220
+ for (const page of pages) {
221
+ const { width, height } = chunkZPHNXJRY_cjs.resolvePageDimensions(page);
222
+ const explicitX = typeof page.x === "number" ? page.x : void 0;
223
+ const explicitY = typeof page.y === "number" ? page.y : void 0;
224
+ const x = explicitX != null ? explicitX : cursorX;
225
+ const y = explicitY != null ? explicitY : 0;
226
+ placed.push({ page, x, y, w: width, h: height });
227
+ if (explicitX === void 0) {
228
+ cursorX = x + width + gap;
229
+ }
230
+ maxRight = Math.max(maxRight, x + width);
231
+ maxBottom = Math.max(maxBottom, y + height);
232
+ }
233
+ return { placed, width: maxRight, height: maxBottom };
234
+ }
235
+ function renderCanvas(doc, options = {}) {
236
+ var _a, _b;
237
+ const gap = (_a = options.gap) != null ? _a : DEFAULT_GAP2;
238
+ const prefix = (_b = options.classPrefix) != null ? _b : DEFAULT_PREFIX;
239
+ const includeStyles = options.includeStyles !== false;
240
+ const theme = options.theme === "dark" ? chunkZPHNXJRY_cjs.darkTheme : chunkZPHNXJRY_cjs.defaultTheme;
241
+ const css = includeStyles ? chunkZPHNXJRY_cjs.generateStyles(theme, prefix, options.annotationStyle) : "";
242
+ const pages = chunkZPHNXJRY_cjs.documentPages(doc);
243
+ if (pages.length === 0) {
244
+ return {
245
+ html: `<div class="${prefix}-canvas" data-empty="true"></div>`,
246
+ css,
247
+ width: 0,
248
+ height: 0
249
+ };
250
+ }
251
+ const { placed, width, height } = layoutCanvas(pages, gap);
252
+ const boards = placed.map((p, pageIndex) => {
253
+ const pageRenderer = new chunkZPHNXJRY_cjs.HtmlRenderer({ ...options, includeStyles: false }, pageIndex);
254
+ const { html: pageHtml } = pageRenderer.render({
255
+ type: "Document",
256
+ children: [p.page]
257
+ });
258
+ return wrapBoard(pageHtml, p, prefix);
259
+ }).join("\n");
260
+ const canvasStyle = `position: relative; width: ${width}px; height: ${height}px;`;
261
+ const html = `<div class="${prefix}-canvas" style="${canvasStyle}" data-page-count="${placed.length}">
262
+ ${boards}
263
+ </div>`;
264
+ return { html, css, width, height };
265
+ }
266
+ function wrapBoard(pageHtml, placed, prefix) {
267
+ const { x, y, w, h, page } = placed;
268
+ const positionStyle = `position: absolute; left: ${x}px; top: ${y}px; width: ${w}px; height: ${h}px;`;
269
+ const titleAttr = page.title ? ` data-page-title="${escapeAttr(page.title)}"` : "";
270
+ const variantAttr = page.variant ? ` data-wf-variant="${escapeAttr(page.variant)}"` : "";
271
+ const dataAttrs = ` data-page-x="${x}" data-page-y="${y}" data-page-w="${w}" data-page-h="${h}"${titleAttr}${variantAttr}`;
272
+ return `<div class="${prefix}-canvas-board" style="${positionStyle}"${dataAttrs}>
273
+ ${pageHtml}
274
+ </div>`;
275
+ }
276
+ function escapeAttr(s) {
277
+ return s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
278
+ }
279
+
280
+ // src/renderer/index.ts
281
+ function render(document, options = {}) {
282
+ document = chunkNV6UV5ID_cjs.expandVariants(document);
283
+ const isMultiPage = chunkZPHNXJRY_cjs.documentPages(document).length > 1;
284
+ if (isMultiPage) {
285
+ const result = renderCanvas(document, options);
286
+ return { html: result.html, css: result.css };
287
+ }
288
+ const renderer = chunkZPHNXJRY_cjs.createHtmlRenderer(options);
289
+ return renderer.render(document);
290
+ }
291
+ function renderToHtml(document, options = {}) {
292
+ var _a;
293
+ document = chunkNV6UV5ID_cjs.expandVariants(document);
294
+ const { html, css } = render(document, options);
295
+ const prefix = (_a = options.classPrefix) != null ? _a : "wf";
296
+ const isMultiPage = chunkZPHNXJRY_cjs.documentPages(document).length > 1;
297
+ const bodyAlign = isMultiPage ? "justify-content: flex-start;\n align-items: flex-start;" : "justify-content: center;\n align-items: center;";
298
+ return `<!DOCTYPE html>
299
+ <html lang="en">
300
+ <head>
301
+ <meta charset="UTF-8">
302
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
303
+ <title>Wireframe</title>
304
+ <style>
305
+ /* Viewport framing: center a single page, anchor a multi-page canvas top-left */
306
+ html, body {
307
+ margin: 0;
308
+ padding: 0;
309
+ min-height: 100vh;
310
+ background: #f4f4f5;
311
+ }
312
+ body {
313
+ display: flex;
314
+ ${bodyAlign}
315
+ padding: 24px;
316
+ box-sizing: border-box;
317
+ }
318
+ /* Fixed-layout invariant: the multi-page canvas is a flex item of <body> and
319
+ must keep its intrinsic size when the viewport is narrower than the canvas.
320
+ Without flex-shrink:0 the flex item shrinks and the boards reflow \u2014 the same
321
+ defect class as .wf-page (see no-responsive.md). Single pages already carry
322
+ flex-shrink:0 via generateStyles; the canvas wrapper needs it here. */
323
+ .${prefix}-canvas {
324
+ flex-shrink: 0;
325
+ }
326
+ ${css}
327
+ </style>
328
+ </head>
329
+ <body>
330
+ ${html}
331
+ </body>
332
+ </html>`;
333
+ }
334
+ function renderToSvg(document, options = {}) {
335
+ var _a, _b, _c, _d, _e;
336
+ if ("kind" in document && document.kind === "LinkedApp")
337
+ return exportLinkedAppToSvg(document, options);
338
+ document = chunkNV6UV5ID_cjs.expandVariants(document);
339
+ const legacyOptions = options;
340
+ const isMultiPage = chunkZPHNXJRY_cjs.documentPages(document).length > 1;
341
+ let width = (_a = legacyOptions.width) != null ? _a : 800;
342
+ let height = (_b = legacyOptions.height) != null ? _b : 600;
343
+ let html;
344
+ let css;
345
+ if (isMultiPage) {
346
+ const canvas = renderCanvas(document, {
347
+ theme: (_c = legacyOptions.theme) != null ? _c : "light"
348
+ });
349
+ if (legacyOptions.width === void 0 && legacyOptions.height === void 0) {
350
+ width = canvas.width;
351
+ height = canvas.height;
352
+ }
353
+ html = canvas.html;
354
+ css = canvas.css;
355
+ } else {
356
+ const firstPage = chunkZPHNXJRY_cjs.documentPages(document)[0];
357
+ if (firstPage && legacyOptions.width === void 0 && legacyOptions.height === void 0) {
358
+ const dims = chunkZPHNXJRY_cjs.resolvePageDimensions(firstPage);
359
+ width = dims.width;
360
+ height = dims.height;
361
+ }
362
+ const result = render(document, { theme: (_d = legacyOptions.theme) != null ? _d : "light" });
363
+ html = result.html;
364
+ css = result.css;
365
+ }
366
+ const background = (_e = legacyOptions.background) != null ? _e : "#ffffff";
367
+ const svg = `<?xml version="1.0" encoding="UTF-8"?>
368
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
369
+ viewBox="0 0 ${width} ${height}" width="${width}" height="${height}">
370
+ <rect width="100%" height="100%" fill="${background}"/>
371
+ <foreignObject x="0" y="0" width="${width}" height="${height}">
372
+ <div xmlns="http://www.w3.org/1999/xhtml" style="
373
+ width: ${width}px;
374
+ height: ${height}px;
375
+ overflow: hidden;
376
+ display: flex;
377
+ justify-content: center;
378
+ align-items: center;
379
+ box-sizing: border-box;
380
+ ">
381
+ <style type="text/css">
382
+ ${css}
383
+ </style>
384
+ ${html}
385
+ </div>
386
+ </foreignObject>
387
+ </svg>`;
388
+ return { svg, width, height };
389
+ }
390
+
391
+ exports.exportLinkedAppToSvg = exportLinkedAppToSvg;
392
+ exports.layoutCanvas = layoutCanvas;
393
+ exports.render = render;
394
+ exports.renderCanvas = renderCanvas;
395
+ exports.renderToHtml = renderToHtml;
396
+ exports.renderToSvg = renderToSvg;