@wireweave/core 4.0.0-beta.15 → 4.0.0-beta.16
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/app.cjs +13 -13
- package/dist/app.js +2 -2
- package/dist/{chunk-24W2GEKO.js → chunk-6EMG345O.js} +2 -2
- package/dist/{chunk-VCHXMPZL.cjs → chunk-7ZRMSFWZ.cjs} +37 -37
- package/dist/{chunk-ZPHNXJRY.cjs → chunk-CGTYVLPA.cjs} +4 -4
- package/dist/{chunk-H2SWIUMU.cjs → chunk-EWCLLW6P.cjs} +2 -0
- package/dist/{chunk-XODYFTKU.cjs → chunk-J5WEVZIX.cjs} +89 -502
- package/dist/chunk-KEQRLZQP.js +3066 -0
- package/dist/{chunk-XYACLXXF.js → chunk-LBJTNQXU.js} +1 -1
- package/dist/{chunk-NPDSIAWT.js → chunk-MLCJ6NIB.js} +3 -3
- package/dist/{chunk-NZGEUVB4.js → chunk-NMIPMOEJ.js} +26 -439
- package/dist/chunk-WCCYK5WK.cjs +3077 -0
- package/dist/{chunk-KMZXXIM2.cjs → chunk-XZL42ZQ2.cjs} +28 -28
- package/dist/{chunk-UGMDBW46.js → chunk-YAANMWP2.js} +2 -0
- package/dist/index.cjs +238 -222
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -11
- package/dist/interaction.cjs +6 -6
- package/dist/interaction.js +1 -1
- package/dist/parser.cjs +9 -9
- package/dist/parser.js +1 -1
- package/dist/renderer.cjs +32 -32
- package/dist/renderer.js +3 -3
- package/dist/spec.cjs +39 -23
- package/dist/spec.d.cts +45 -1
- package/dist/spec.d.ts +45 -1
- package/dist/spec.js +1 -1
- package/package.json +19 -13
- package/dist/chunk-MD6MNOEQ.cjs +0 -2884
- package/dist/chunk-V3HVWC7C.js +0 -2874
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunk7ZRMSFWZ_cjs = require('./chunk-7ZRMSFWZ.cjs');
|
|
4
|
+
var chunkEWCLLW6P_cjs = require('./chunk-EWCLLW6P.cjs');
|
|
5
|
+
var chunkCGTYVLPA_cjs = require('./chunk-CGTYVLPA.cjs');
|
|
6
6
|
|
|
7
7
|
// src/export/v4-svg.ts
|
|
8
8
|
var MAX_DIMENSION = 16384;
|
|
@@ -100,7 +100,7 @@ function renderNode(node, x, y, width, sourceMap) {
|
|
|
100
100
|
const kind = node.node.kind;
|
|
101
101
|
const text = label(node);
|
|
102
102
|
const source = sourceMap.get(node.renderedId);
|
|
103
|
-
const identity = source === void 0 ? "{}" :
|
|
103
|
+
const identity = source === void 0 ? "{}" : chunk7ZRMSFWZ_cjs.jcs(source.identity);
|
|
104
104
|
const attrs = node.node.attributes;
|
|
105
105
|
const interactionIds = Array.isArray(attrs.on) ? attrs.on.filter(isObject).flatMap(
|
|
106
106
|
(handler) => Array.isArray(handler.operations) ? handler.operations.filter(isObject).map((operation) => scalar(operation.id)) : []
|
|
@@ -124,13 +124,13 @@ function screenRoots(data, screen) {
|
|
|
124
124
|
return [...(_a = shell == null ? void 0 : shell.children) != null ? _a : [], ...screen.children];
|
|
125
125
|
}
|
|
126
126
|
function exportLinkedAppToSvg(linked, profile) {
|
|
127
|
-
const data =
|
|
127
|
+
const data = chunk7ZRMSFWZ_cjs.getLinkedAppData(linked);
|
|
128
128
|
if (data === void 0)
|
|
129
|
-
return
|
|
129
|
+
return chunk7ZRMSFWZ_cjs.failed([chunk7ZRMSFWZ_cjs.diagnostic("WW_SCHEMA", "app.untrusted-linked-model", void 0, {}, "compile")]);
|
|
130
130
|
const valid = validateProfile(profile, data);
|
|
131
131
|
if (valid === null)
|
|
132
|
-
return
|
|
133
|
-
|
|
132
|
+
return chunk7ZRMSFWZ_cjs.failed([
|
|
133
|
+
chunk7ZRMSFWZ_cjs.diagnostic("WW_EXPORT_PROFILE", "export.invalid-svg-profile", void 0, {}, "compile")
|
|
134
134
|
]);
|
|
135
135
|
const screens = data.screens.slice().sort((a, b) => routeKey(a.route).localeCompare(routeKey(b.route)));
|
|
136
136
|
const selected = valid.screens === "all" ? screens : screens.filter((screen) => {
|
|
@@ -139,8 +139,8 @@ function exportLinkedAppToSvg(linked, profile) {
|
|
|
139
139
|
return routeKey(screen.route) === routeKey(target);
|
|
140
140
|
});
|
|
141
141
|
if (selected.length === 0)
|
|
142
|
-
return
|
|
143
|
-
|
|
142
|
+
return chunk7ZRMSFWZ_cjs.failed([
|
|
143
|
+
chunk7ZRMSFWZ_cjs.diagnostic("WW_EXPORT_BOARD", "export.board-not-found", void 0, {}, "compile")
|
|
144
144
|
]);
|
|
145
145
|
const boards = selected.map((screen, index) => ({
|
|
146
146
|
route: screen.route,
|
|
@@ -189,20 +189,20 @@ function exportLinkedAppToSvg(linked, profile) {
|
|
|
189
189
|
exporter: "wireweave-static-svg-v1",
|
|
190
190
|
appId: data.bundle.id,
|
|
191
191
|
linkedDigest: linked.digest,
|
|
192
|
-
profileDigest:
|
|
192
|
+
profileDigest: chunkEWCLLW6P_cjs.digestV4(chunk7ZRMSFWZ_cjs.jcs(valid)),
|
|
193
193
|
boardRoutes: boards.map(({ route }) => route),
|
|
194
194
|
sourceMap: [...sourceMap.values()],
|
|
195
195
|
lossReport
|
|
196
196
|
};
|
|
197
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(
|
|
199
|
-
const artifact =
|
|
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(chunk7ZRMSFWZ_cjs.jcs(manifest))}</metadata>${boardMarkup}</svg>`;
|
|
199
|
+
const artifact = chunk7ZRMSFWZ_cjs.freeze({
|
|
200
200
|
kind: "V4SvgArtifact",
|
|
201
201
|
mediaType: "image/svg+xml",
|
|
202
202
|
svg,
|
|
203
203
|
width,
|
|
204
204
|
height,
|
|
205
|
-
digest:
|
|
205
|
+
digest: chunkEWCLLW6P_cjs.digestV4(svg),
|
|
206
206
|
manifest,
|
|
207
207
|
diagnostics
|
|
208
208
|
});
|
|
@@ -218,7 +218,7 @@ function layoutCanvas(pages, gap = DEFAULT_GAP2) {
|
|
|
218
218
|
let maxRight = 0;
|
|
219
219
|
let maxBottom = 0;
|
|
220
220
|
for (const page of pages) {
|
|
221
|
-
const { width, height } =
|
|
221
|
+
const { width, height } = chunkCGTYVLPA_cjs.resolvePageDimensions(page);
|
|
222
222
|
const explicitX = typeof page.x === "number" ? page.x : void 0;
|
|
223
223
|
const explicitY = typeof page.y === "number" ? page.y : void 0;
|
|
224
224
|
const x = explicitX != null ? explicitX : cursorX;
|
|
@@ -237,9 +237,9 @@ function renderCanvas(doc, options = {}) {
|
|
|
237
237
|
const gap = (_a = options.gap) != null ? _a : DEFAULT_GAP2;
|
|
238
238
|
const prefix = (_b = options.classPrefix) != null ? _b : DEFAULT_PREFIX;
|
|
239
239
|
const includeStyles = options.includeStyles !== false;
|
|
240
|
-
const theme = options.theme === "dark" ?
|
|
241
|
-
const css = includeStyles ?
|
|
242
|
-
const pages =
|
|
240
|
+
const theme = options.theme === "dark" ? chunkCGTYVLPA_cjs.darkTheme : chunkCGTYVLPA_cjs.defaultTheme;
|
|
241
|
+
const css = includeStyles ? chunkCGTYVLPA_cjs.generateStyles(theme, prefix, options.annotationStyle) : "";
|
|
242
|
+
const pages = chunkCGTYVLPA_cjs.documentPages(doc);
|
|
243
243
|
if (pages.length === 0) {
|
|
244
244
|
return {
|
|
245
245
|
html: `<div class="${prefix}-canvas" data-empty="true"></div>`,
|
|
@@ -250,7 +250,7 @@ function renderCanvas(doc, options = {}) {
|
|
|
250
250
|
}
|
|
251
251
|
const { placed, width, height } = layoutCanvas(pages, gap);
|
|
252
252
|
const boards = placed.map((p, pageIndex) => {
|
|
253
|
-
const pageRenderer = new
|
|
253
|
+
const pageRenderer = new chunkCGTYVLPA_cjs.HtmlRenderer({ ...options, includeStyles: false }, pageIndex);
|
|
254
254
|
const { html: pageHtml } = pageRenderer.render({
|
|
255
255
|
type: "Document",
|
|
256
256
|
children: [p.page]
|
|
@@ -279,21 +279,21 @@ function escapeAttr(s) {
|
|
|
279
279
|
|
|
280
280
|
// src/renderer/index.ts
|
|
281
281
|
function render(document, options = {}) {
|
|
282
|
-
document =
|
|
283
|
-
const isMultiPage =
|
|
282
|
+
document = chunk7ZRMSFWZ_cjs.expandVariants(document);
|
|
283
|
+
const isMultiPage = chunkCGTYVLPA_cjs.documentPages(document).length > 1;
|
|
284
284
|
if (isMultiPage) {
|
|
285
285
|
const result = renderCanvas(document, options);
|
|
286
286
|
return { html: result.html, css: result.css };
|
|
287
287
|
}
|
|
288
|
-
const renderer =
|
|
288
|
+
const renderer = chunkCGTYVLPA_cjs.createHtmlRenderer(options);
|
|
289
289
|
return renderer.render(document);
|
|
290
290
|
}
|
|
291
291
|
function renderToHtml(document, options = {}) {
|
|
292
292
|
var _a;
|
|
293
|
-
document =
|
|
293
|
+
document = chunk7ZRMSFWZ_cjs.expandVariants(document);
|
|
294
294
|
const { html, css } = render(document, options);
|
|
295
295
|
const prefix = (_a = options.classPrefix) != null ? _a : "wf";
|
|
296
|
-
const isMultiPage =
|
|
296
|
+
const isMultiPage = chunkCGTYVLPA_cjs.documentPages(document).length > 1;
|
|
297
297
|
const bodyAlign = isMultiPage ? "justify-content: flex-start;\n align-items: flex-start;" : "justify-content: center;\n align-items: center;";
|
|
298
298
|
return `<!DOCTYPE html>
|
|
299
299
|
<html lang="en">
|
|
@@ -335,9 +335,9 @@ function renderToSvg(document, options = {}) {
|
|
|
335
335
|
var _a, _b, _c, _d, _e;
|
|
336
336
|
if ("kind" in document && document.kind === "LinkedApp")
|
|
337
337
|
return exportLinkedAppToSvg(document, options);
|
|
338
|
-
document =
|
|
338
|
+
document = chunk7ZRMSFWZ_cjs.expandVariants(document);
|
|
339
339
|
const legacyOptions = options;
|
|
340
|
-
const isMultiPage =
|
|
340
|
+
const isMultiPage = chunkCGTYVLPA_cjs.documentPages(document).length > 1;
|
|
341
341
|
let width = (_a = legacyOptions.width) != null ? _a : 800;
|
|
342
342
|
let height = (_b = legacyOptions.height) != null ? _b : 600;
|
|
343
343
|
let html;
|
|
@@ -353,9 +353,9 @@ function renderToSvg(document, options = {}) {
|
|
|
353
353
|
html = canvas.html;
|
|
354
354
|
css = canvas.css;
|
|
355
355
|
} else {
|
|
356
|
-
const firstPage =
|
|
356
|
+
const firstPage = chunkCGTYVLPA_cjs.documentPages(document)[0];
|
|
357
357
|
if (firstPage && legacyOptions.width === void 0 && legacyOptions.height === void 0) {
|
|
358
|
-
const dims =
|
|
358
|
+
const dims = chunkCGTYVLPA_cjs.resolvePageDimensions(firstPage);
|
|
359
359
|
width = dims.width;
|
|
360
360
|
height = dims.height;
|
|
361
361
|
}
|
|
@@ -2813,6 +2813,7 @@ var schema_default = {
|
|
|
2813
2813
|
"pb",
|
|
2814
2814
|
"pl",
|
|
2815
2815
|
"pr",
|
|
2816
|
+
"primary",
|
|
2816
2817
|
"pt",
|
|
2817
2818
|
"px",
|
|
2818
2819
|
"py",
|
|
@@ -7103,6 +7104,7 @@ var schema_default = {
|
|
|
7103
7104
|
"pb",
|
|
7104
7105
|
"pl",
|
|
7105
7106
|
"pr",
|
|
7107
|
+
"primary",
|
|
7106
7108
|
"pt",
|
|
7107
7109
|
"px",
|
|
7108
7110
|
"py",
|