@wireweave/core 4.0.0-beta.14 → 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.d.cts +2 -2
- package/dist/app.d.ts +2 -2
- package/dist/app.js +2 -2
- package/dist/{chunk-TQSOLTMZ.js → chunk-6EMG345O.js} +251 -41
- package/dist/{chunk-NV6UV5ID.cjs → chunk-7ZRMSFWZ.cjs} +286 -75
- package/dist/{chunk-ZPHNXJRY.cjs → chunk-CGTYVLPA.cjs} +4 -4
- package/dist/{chunk-IMUVIIJR.cjs → chunk-EWCLLW6P.cjs} +11 -3
- package/dist/{chunk-SAN6CJEE.cjs → chunk-J5WEVZIX.cjs} +134 -493
- package/dist/chunk-KEQRLZQP.js +3066 -0
- package/dist/{chunk-XYACLXXF.js → chunk-LBJTNQXU.js} +1 -1
- package/dist/{chunk-4DDV6Z2X.js → chunk-MLCJ6NIB.js} +3 -3
- package/dist/{chunk-2Y3GKARZ.js → chunk-NMIPMOEJ.js} +73 -432
- package/dist/chunk-WCCYK5WK.cjs +3077 -0
- package/dist/{chunk-LA5LKIEL.cjs → chunk-XZL42ZQ2.cjs} +28 -28
- package/dist/{chunk-3RWGG5EC.js → chunk-YAANMWP2.js} +11 -4
- package/dist/{index-BD_4rXH-.d.cts → index-CIfur9e3.d.cts} +1 -1
- package/dist/{index-YSIzfhOd.d.cts → index-DdQv4Bu5.d.cts} +7 -1
- package/dist/{index-g9yV20xb.d.ts → index-DwGsnD0n.d.ts} +1 -1
- package/dist/{index-BEnsO2kE.d.ts → index-c4FTW7XA.d.ts} +7 -1
- package/dist/index.cjs +238 -222
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- 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.d.cts +2 -2
- package/dist/renderer.d.ts +2 -2
- 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",
|
|
@@ -5494,6 +5495,7 @@ var schema_default = {
|
|
|
5494
5495
|
},
|
|
5495
5496
|
assets: {
|
|
5496
5497
|
type: "array",
|
|
5498
|
+
description: "Ordered manifest bytes. Core validates unique IDs, digest/byteLength/base64, media content and the 32 MiB aggregate limit before app compilation; the host must materialize any approved URL into these bytes.",
|
|
5497
5499
|
items: {
|
|
5498
5500
|
type: "object",
|
|
5499
5501
|
properties: {
|
|
@@ -5526,7 +5528,8 @@ var schema_default = {
|
|
|
5526
5528
|
const: "15.1.0"
|
|
5527
5529
|
},
|
|
5528
5530
|
fontAssetId: {
|
|
5529
|
-
$ref: "#/$defs/Id"
|
|
5531
|
+
$ref: "#/$defs/Id",
|
|
5532
|
+
description: "Optional asset ID that must resolve to a validated font/woff2 manifest entry."
|
|
5530
5533
|
}
|
|
5531
5534
|
},
|
|
5532
5535
|
required: [
|
|
@@ -6005,6 +6008,7 @@ var schema_default = {
|
|
|
6005
6008
|
additionalProperties: false
|
|
6006
6009
|
},
|
|
6007
6010
|
RuntimeInput: {
|
|
6011
|
+
description: "Closed conformance input union. Event value/checked/key fields are further constrained by the native event and addressed control; unknown fields are rejected.",
|
|
6008
6012
|
oneOf: [
|
|
6009
6013
|
{
|
|
6010
6014
|
type: "object",
|
|
@@ -7100,6 +7104,7 @@ var schema_default = {
|
|
|
7100
7104
|
"pb",
|
|
7101
7105
|
"pl",
|
|
7102
7106
|
"pr",
|
|
7107
|
+
"primary",
|
|
7103
7108
|
"pt",
|
|
7104
7109
|
"px",
|
|
7105
7110
|
"py",
|
|
@@ -9273,9 +9278,8 @@ var SHA256_K = new Uint32Array([
|
|
|
9273
9278
|
3204031479,
|
|
9274
9279
|
3329325298
|
|
9275
9280
|
]);
|
|
9276
|
-
function
|
|
9281
|
+
function digestBytesV4(bytes) {
|
|
9277
9282
|
var _a2, _b2, _c, _d, _e, _f, _g;
|
|
9278
|
-
const bytes = new TextEncoder().encode(source);
|
|
9279
9283
|
const padded = new Uint8Array(Math.ceil((bytes.length + 9) / 64) * 64);
|
|
9280
9284
|
padded.set(bytes);
|
|
9281
9285
|
padded[bytes.length] = 128;
|
|
@@ -9320,6 +9324,9 @@ function digestV4(source) {
|
|
|
9320
9324
|
}
|
|
9321
9325
|
return `sha256:${hash.map((value) => value.toString(16).padStart(8, "0")).join("")}`;
|
|
9322
9326
|
}
|
|
9327
|
+
function digestV4(source) {
|
|
9328
|
+
return digestBytesV4(new TextEncoder().encode(source));
|
|
9329
|
+
}
|
|
9323
9330
|
|
|
9324
9331
|
// src/parser/v4.ts
|
|
9325
9332
|
var shapes = schema_default.$defs;
|
|
@@ -18039,4 +18046,4 @@ function getErrors(source) {
|
|
|
18039
18046
|
return result.errors;
|
|
18040
18047
|
}
|
|
18041
18048
|
|
|
18042
|
-
export { V4ParseError, digestV4, getErrors, getV4SourceSpan, isValid, parse, parseV4, tryParse, tryParseV4 };
|
|
18049
|
+
export { V4ParseError, digestBytesV4, digestV4, getErrors, getV4SourceSpan, isValid, parse, parseV4, tryParse, tryParseV4 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { P as PageNode, L as LayoutDefinitionNode, W as WireframeDocument, A as AnyNode, C as ComponentUseNode, I as InteractiveProps, G as GuardedOutcomeProps } from './types-CGRi1k2N.cjs';
|
|
2
|
-
import { D as Diagnostic, S as SourceMapEntry, L as LinkedIdentity, a as ScreenReference, A as AppResult, b as LinkedApp, R as RenderContext, c as RenderOptions, T as ThemeConfig, d as RenderResult, e as AnnotationStyle, P as PageRenderResult, C as CanvasOptions, f as CanvasRenderResult, g as SvgRenderOptions, h as SvgRenderResult } from './index-
|
|
2
|
+
import { D as Diagnostic, S as SourceMapEntry, L as LinkedIdentity, a as ScreenReference, A as AppResult, b as LinkedApp, R as RenderContext, c as RenderOptions, T as ThemeConfig, d as RenderResult, e as AnnotationStyle, P as PageRenderResult, C as CanvasOptions, f as CanvasRenderResult, g as SvgRenderOptions, h as SvgRenderResult } from './index-DdQv4Bu5.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The screen model behind `renderSite` — which pages become screens, which
|
|
@@ -4,7 +4,7 @@ import { W as WireframeDocument } from './types-CGRi1k2N.cjs';
|
|
|
4
4
|
interface Diagnostic {
|
|
5
5
|
severity: 'error';
|
|
6
6
|
code: string;
|
|
7
|
-
phase: '
|
|
7
|
+
phase: 'parse' | 'schema' | 'link' | 'semantic' | 'compile' | 'runtime';
|
|
8
8
|
sourceId: string;
|
|
9
9
|
start: number;
|
|
10
10
|
end: number;
|
|
@@ -133,6 +133,12 @@ interface AppArtifact {
|
|
|
133
133
|
readonly htmlDigest: string;
|
|
134
134
|
readonly runtimeDigest: string;
|
|
135
135
|
readonly executionScope: 'standard-1';
|
|
136
|
+
readonly assets: readonly {
|
|
137
|
+
readonly id: string;
|
|
138
|
+
readonly mediaType: string;
|
|
139
|
+
readonly digest: string;
|
|
140
|
+
readonly byteLength: number;
|
|
141
|
+
}[];
|
|
136
142
|
readonly unsupportedOperations: readonly {
|
|
137
143
|
renderedId: string;
|
|
138
144
|
handlerId: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { P as PageNode, L as LayoutDefinitionNode, W as WireframeDocument, A as AnyNode, C as ComponentUseNode, I as InteractiveProps, G as GuardedOutcomeProps } from './types-CGRi1k2N.js';
|
|
2
|
-
import { D as Diagnostic, S as SourceMapEntry, L as LinkedIdentity, a as ScreenReference, A as AppResult, b as LinkedApp, R as RenderContext, c as RenderOptions, T as ThemeConfig, d as RenderResult, e as AnnotationStyle, P as PageRenderResult, C as CanvasOptions, f as CanvasRenderResult, g as SvgRenderOptions, h as SvgRenderResult } from './index-
|
|
2
|
+
import { D as Diagnostic, S as SourceMapEntry, L as LinkedIdentity, a as ScreenReference, A as AppResult, b as LinkedApp, R as RenderContext, c as RenderOptions, T as ThemeConfig, d as RenderResult, e as AnnotationStyle, P as PageRenderResult, C as CanvasOptions, f as CanvasRenderResult, g as SvgRenderOptions, h as SvgRenderResult } from './index-c4FTW7XA.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The screen model behind `renderSite` — which pages become screens, which
|
|
@@ -4,7 +4,7 @@ import { W as WireframeDocument } from './types-CGRi1k2N.js';
|
|
|
4
4
|
interface Diagnostic {
|
|
5
5
|
severity: 'error';
|
|
6
6
|
code: string;
|
|
7
|
-
phase: '
|
|
7
|
+
phase: 'parse' | 'schema' | 'link' | 'semantic' | 'compile' | 'runtime';
|
|
8
8
|
sourceId: string;
|
|
9
9
|
start: number;
|
|
10
10
|
end: number;
|
|
@@ -133,6 +133,12 @@ interface AppArtifact {
|
|
|
133
133
|
readonly htmlDigest: string;
|
|
134
134
|
readonly runtimeDigest: string;
|
|
135
135
|
readonly executionScope: 'standard-1';
|
|
136
|
+
readonly assets: readonly {
|
|
137
|
+
readonly id: string;
|
|
138
|
+
readonly mediaType: string;
|
|
139
|
+
readonly digest: string;
|
|
140
|
+
readonly byteLength: number;
|
|
141
|
+
}[];
|
|
136
142
|
readonly unsupportedOperations: readonly {
|
|
137
143
|
renderedId: string;
|
|
138
144
|
handlerId: string;
|