@wireweave/core 4.0.0-beta.12 → 4.0.0-beta.13
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 +50 -31
- package/dist/app.d.cts +3 -3
- package/dist/app.d.ts +3 -3
- package/dist/app.js +1 -31
- package/dist/chunk-3RWGG5EC.js +296 -342
- package/dist/chunk-4TMDPWPR.cjs +22 -32
- package/dist/{chunk-7VTK6LHL.cjs → chunk-4UZBGIGJ.cjs} +82 -97
- package/dist/chunk-5DGRIQDU.cjs +26 -44
- package/dist/chunk-ETV4XYOV.cjs +4 -6
- package/dist/{chunk-QOS4IC75.js → chunk-FS6A6EJ4.js} +28 -57
- package/dist/chunk-IMUVIIJR.cjs +317 -354
- package/dist/chunk-JJWAFHSV.js +2 -23
- package/dist/chunk-MD6MNOEQ.cjs +121 -142
- package/dist/chunk-PKBMQBKP.js +1 -3
- package/dist/chunk-R5WBZWBC.js +3 -19
- package/dist/chunk-V3HVWC7C.js +1 -32
- package/dist/chunk-XYACLXXF.js +4 -132
- package/dist/chunk-ZPHNXJRY.cjs +158 -180
- package/dist/{index-Da_B3eoM.d.ts → index-BGU_4N4W.d.ts} +2 -2
- package/dist/{index-G906GEtg.d.cts → index-BlNYFaZd.d.cts} +2 -2
- package/dist/{index-CghCKUPx.d.ts → index-Cx4-VXVS.d.ts} +2 -2
- package/dist/{index-Br7pNaf3.d.cts → index-DyXaMSgd.d.cts} +2 -2
- package/dist/index.cjs +738 -419
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +12 -385
- package/dist/interaction.cjs +26 -17
- package/dist/interaction.d.cts +2 -2
- package/dist/interaction.d.ts +2 -2
- package/dist/interaction.js +1 -17
- package/dist/parser.cjs +38 -21
- package/dist/parser.d.cts +3 -3
- package/dist/parser.d.ts +3 -3
- package/dist/parser.js +1 -21
- package/dist/renderer.cjs +124 -68
- package/dist/renderer.d.cts +104 -104
- package/dist/renderer.d.ts +104 -104
- package/dist/renderer.js +3 -68
- package/dist/spec.cjs +94 -49
- package/dist/spec.js +1 -49
- package/dist/{types-vhPCZpAW.d.cts → types-CGRi1k2N.d.cts} +1 -1
- package/dist/{types-vhPCZpAW.d.ts → types-CGRi1k2N.d.ts} +1 -1
- package/dist/{v4-types-Baz9yqAS.d.cts → v4-types-2ORUg6To.d.cts} +1 -1
- package/dist/{v4-types-Baz9yqAS.d.ts → v4-types-2ORUg6To.d.ts} +1 -1
- package/package.json +21 -23
- package/dist/chunk-WV724EAW.js +0 -0
- package/dist/chunk-XENFKHRC.cjs +0 -1
package/dist/chunk-4TMDPWPR.cjs
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _chunkZPHNXJRYcjs = require('./chunk-ZPHNXJRY.cjs');
|
|
3
|
+
var chunk5DGRIQDU_cjs = require('./chunk-5DGRIQDU.cjs');
|
|
4
|
+
var chunkZPHNXJRY_cjs = require('./chunk-ZPHNXJRY.cjs');
|
|
13
5
|
|
|
14
6
|
// src/renderer/canvas-renderer.ts
|
|
15
7
|
var DEFAULT_GAP = 64;
|
|
@@ -20,7 +12,7 @@ function layoutCanvas(pages, gap = DEFAULT_GAP) {
|
|
|
20
12
|
let maxRight = 0;
|
|
21
13
|
let maxBottom = 0;
|
|
22
14
|
for (const page of pages) {
|
|
23
|
-
const { width, height } =
|
|
15
|
+
const { width, height } = chunkZPHNXJRY_cjs.resolvePageDimensions(page);
|
|
24
16
|
const explicitX = typeof page.x === "number" ? page.x : void 0;
|
|
25
17
|
const explicitY = typeof page.y === "number" ? page.y : void 0;
|
|
26
18
|
const x = explicitX != null ? explicitX : cursorX;
|
|
@@ -39,9 +31,9 @@ function renderCanvas(doc, options = {}) {
|
|
|
39
31
|
const gap = (_a = options.gap) != null ? _a : DEFAULT_GAP;
|
|
40
32
|
const prefix = (_b = options.classPrefix) != null ? _b : DEFAULT_PREFIX;
|
|
41
33
|
const includeStyles = options.includeStyles !== false;
|
|
42
|
-
const theme = options.theme === "dark" ?
|
|
43
|
-
const css = includeStyles ?
|
|
44
|
-
const pages =
|
|
34
|
+
const theme = options.theme === "dark" ? chunkZPHNXJRY_cjs.darkTheme : chunkZPHNXJRY_cjs.defaultTheme;
|
|
35
|
+
const css = includeStyles ? chunkZPHNXJRY_cjs.generateStyles(theme, prefix, options.annotationStyle) : "";
|
|
36
|
+
const pages = chunkZPHNXJRY_cjs.documentPages(doc);
|
|
45
37
|
if (pages.length === 0) {
|
|
46
38
|
return {
|
|
47
39
|
html: `<div class="${prefix}-canvas" data-empty="true"></div>`,
|
|
@@ -52,7 +44,7 @@ function renderCanvas(doc, options = {}) {
|
|
|
52
44
|
}
|
|
53
45
|
const { placed, width, height } = layoutCanvas(pages, gap);
|
|
54
46
|
const boards = placed.map((p, pageIndex) => {
|
|
55
|
-
const pageRenderer = new
|
|
47
|
+
const pageRenderer = new chunkZPHNXJRY_cjs.HtmlRenderer({ ...options, includeStyles: false }, pageIndex);
|
|
56
48
|
const { html: pageHtml } = pageRenderer.render({
|
|
57
49
|
type: "Document",
|
|
58
50
|
children: [p.page]
|
|
@@ -81,21 +73,21 @@ function escapeAttr(s) {
|
|
|
81
73
|
|
|
82
74
|
// src/renderer/index.ts
|
|
83
75
|
function render(document, options = {}) {
|
|
84
|
-
document =
|
|
85
|
-
const isMultiPage =
|
|
76
|
+
document = chunk5DGRIQDU_cjs.expandVariants(document);
|
|
77
|
+
const isMultiPage = chunkZPHNXJRY_cjs.documentPages(document).length > 1;
|
|
86
78
|
if (isMultiPage) {
|
|
87
79
|
const result = renderCanvas(document, options);
|
|
88
80
|
return { html: result.html, css: result.css };
|
|
89
81
|
}
|
|
90
|
-
const renderer =
|
|
82
|
+
const renderer = chunkZPHNXJRY_cjs.createHtmlRenderer(options);
|
|
91
83
|
return renderer.render(document);
|
|
92
84
|
}
|
|
93
85
|
function renderToHtml(document, options = {}) {
|
|
94
86
|
var _a;
|
|
95
|
-
document =
|
|
87
|
+
document = chunk5DGRIQDU_cjs.expandVariants(document);
|
|
96
88
|
const { html, css } = render(document, options);
|
|
97
89
|
const prefix = (_a = options.classPrefix) != null ? _a : "wf";
|
|
98
|
-
const isMultiPage =
|
|
90
|
+
const isMultiPage = chunkZPHNXJRY_cjs.documentPages(document).length > 1;
|
|
99
91
|
const bodyAlign = isMultiPage ? "justify-content: flex-start;\n align-items: flex-start;" : "justify-content: center;\n align-items: center;";
|
|
100
92
|
return `<!DOCTYPE html>
|
|
101
93
|
<html lang="en">
|
|
@@ -135,8 +127,8 @@ ${html}
|
|
|
135
127
|
}
|
|
136
128
|
function renderToSvg(document, options = {}) {
|
|
137
129
|
var _a, _b, _c, _d, _e;
|
|
138
|
-
document =
|
|
139
|
-
const isMultiPage =
|
|
130
|
+
document = chunk5DGRIQDU_cjs.expandVariants(document);
|
|
131
|
+
const isMultiPage = chunkZPHNXJRY_cjs.documentPages(document).length > 1;
|
|
140
132
|
let width = (_a = options.width) != null ? _a : 800;
|
|
141
133
|
let height = (_b = options.height) != null ? _b : 600;
|
|
142
134
|
let html;
|
|
@@ -152,9 +144,9 @@ function renderToSvg(document, options = {}) {
|
|
|
152
144
|
html = canvas.html;
|
|
153
145
|
css = canvas.css;
|
|
154
146
|
} else {
|
|
155
|
-
const firstPage =
|
|
147
|
+
const firstPage = chunkZPHNXJRY_cjs.documentPages(document)[0];
|
|
156
148
|
if (firstPage && options.width === void 0 && options.height === void 0) {
|
|
157
|
-
const dims =
|
|
149
|
+
const dims = chunkZPHNXJRY_cjs.resolvePageDimensions(firstPage);
|
|
158
150
|
width = dims.width;
|
|
159
151
|
height = dims.height;
|
|
160
152
|
}
|
|
@@ -187,10 +179,8 @@ ${css}
|
|
|
187
179
|
return { svg, width, height };
|
|
188
180
|
}
|
|
189
181
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
exports.layoutCanvas = layoutCanvas; exports.renderCanvas = renderCanvas; exports.render = render; exports.renderToHtml = renderToHtml; exports.renderToSvg = renderToSvg;
|
|
182
|
+
exports.layoutCanvas = layoutCanvas;
|
|
183
|
+
exports.render = render;
|
|
184
|
+
exports.renderCanvas = renderCanvas;
|
|
185
|
+
exports.renderToHtml = renderToHtml;
|
|
186
|
+
exports.renderToSvg = renderToSvg;
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunkIMUVIIJRcjs = require('./chunk-IMUVIIJR.cjs');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _chunk5DGRIQDUcjs = require('./chunk-5DGRIQDU.cjs');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _chunkETV4XYOVcjs = require('./chunk-ETV4XYOV.cjs');
|
|
3
|
+
var chunkIMUVIIJR_cjs = require('./chunk-IMUVIIJR.cjs');
|
|
4
|
+
var chunk5DGRIQDU_cjs = require('./chunk-5DGRIQDU.cjs');
|
|
5
|
+
var chunkETV4XYOV_cjs = require('./chunk-ETV4XYOV.cjs');
|
|
13
6
|
|
|
14
7
|
// src/ast/component-parameters.ts
|
|
15
8
|
var PARAMETER_REFERENCE = /^\$([a-zA-Z_][a-zA-Z0-9_-]*)$/;
|
|
@@ -147,7 +140,7 @@ function sourceId(value) {
|
|
|
147
140
|
}
|
|
148
141
|
function sourceOf(value, fallback) {
|
|
149
142
|
var _a;
|
|
150
|
-
const found = (_a =
|
|
143
|
+
const found = (_a = chunkIMUVIIJR_cjs.getV4SourceSpan(value)) != null ? _a : fallback;
|
|
151
144
|
return found === void 0 ? { sourceId: "app", start: 0, end: 0, startLine: 1, startColumn: 1, endLine: 1, endColumn: 1 } : { ...found, sourceId: sourceId(found.sourceId) };
|
|
152
145
|
}
|
|
153
146
|
function createAppBundle(documents, options) {
|
|
@@ -160,7 +153,7 @@ function createAppBundle(documents, options) {
|
|
|
160
153
|
jcs(options);
|
|
161
154
|
if (!identifiers.test(options.id))
|
|
162
155
|
return failed([diagnostic("WW_SCHEMA", "app.invalid-id", void 0, {}, "schema")]);
|
|
163
|
-
const configuration =
|
|
156
|
+
const configuration = chunkIMUVIIJR_cjs.parseV4(
|
|
164
157
|
`app ${options.id} entry=${dsl(options.entry)} profile=${dsl(options.profile)} states=${dsl(options.states)} registry=${dsl(options.registry)} fixtures=${dsl(options.fixtures)} {}`,
|
|
165
158
|
{ languageVersion: "4.0.0", sourceId: "app" }
|
|
166
159
|
);
|
|
@@ -193,8 +186,8 @@ function createAppBundle(documents, options) {
|
|
|
193
186
|
);
|
|
194
187
|
continue;
|
|
195
188
|
}
|
|
196
|
-
const reparsed =
|
|
197
|
-
if (
|
|
189
|
+
const reparsed = chunkIMUVIIJR_cjs.parseV4(bytes, { languageVersion: "4.0.0", sourceId: `${module.id}.wf` });
|
|
190
|
+
if (chunkIMUVIIJR_cjs.digestV4(bytes) !== module.sourceDigest || reparsed.modules.length !== 1 || jcs(reparsed.modules[0]) !== jcs(module)) {
|
|
198
191
|
diagnostics.push(
|
|
199
192
|
diagnostic(
|
|
200
193
|
"WW_IMPORT",
|
|
@@ -248,7 +241,7 @@ function createAppBundle(documents, options) {
|
|
|
248
241
|
bundles.set(bundle, { sourceByPath });
|
|
249
242
|
return { ok: true, value: bundle, diagnostics: [] };
|
|
250
243
|
} catch (error) {
|
|
251
|
-
if (error instanceof
|
|
244
|
+
if (error instanceof chunkIMUVIIJR_cjs.V4ParseError)
|
|
252
245
|
return failed(error.diagnostics.map((item) => ({ ...item, phase: "schema" })));
|
|
253
246
|
if (error instanceof TypeError)
|
|
254
247
|
return failed([diagnostic("WW_SCHEMA", "app.invalid-json", void 0, {}, "schema")]);
|
|
@@ -257,21 +250,21 @@ function createAppBundle(documents, options) {
|
|
|
257
250
|
}
|
|
258
251
|
var Linker = class {
|
|
259
252
|
constructor(bundle, data) {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
253
|
+
chunkETV4XYOV_cjs.__publicField(this, "bundle", bundle);
|
|
254
|
+
chunkETV4XYOV_cjs.__publicField(this, "data", data);
|
|
255
|
+
chunkETV4XYOV_cjs.__publicField(this, "diagnostics", []);
|
|
256
|
+
chunkETV4XYOV_cjs.__publicField(this, "owners", /* @__PURE__ */ new Map());
|
|
257
|
+
chunkETV4XYOV_cjs.__publicField(this, "moduleById", /* @__PURE__ */ new Map());
|
|
258
|
+
chunkETV4XYOV_cjs.__publicField(this, "ownerByNode", /* @__PURE__ */ new WeakMap());
|
|
259
|
+
chunkETV4XYOV_cjs.__publicField(this, "pathByNode", /* @__PURE__ */ new WeakMap());
|
|
260
|
+
chunkETV4XYOV_cjs.__publicField(this, "expanded", []);
|
|
261
|
+
chunkETV4XYOV_cjs.__publicField(this, "screens", []);
|
|
262
|
+
chunkETV4XYOV_cjs.__publicField(this, "shells", []);
|
|
263
|
+
chunkETV4XYOV_cjs.__publicField(this, "moduleEdges", /* @__PURE__ */ new Map());
|
|
264
|
+
chunkETV4XYOV_cjs.__publicField(this, "definitionEdges", /* @__PURE__ */ new Map());
|
|
265
|
+
chunkETV4XYOV_cjs.__publicField(this, "registry", /* @__PURE__ */ new Map());
|
|
266
|
+
chunkETV4XYOV_cjs.__publicField(this, "expandedCount", 0);
|
|
267
|
+
chunkETV4XYOV_cjs.__publicField(this, "domIds", /* @__PURE__ */ new Set());
|
|
275
268
|
}
|
|
276
269
|
source(node) {
|
|
277
270
|
var _a, _b;
|
|
@@ -485,7 +478,7 @@ var Linker = class {
|
|
|
485
478
|
const right = `${textValue(b.kind)}\0${textValue(b.namespace)}\0${textValue(b.id)}`;
|
|
486
479
|
return left < right ? -1 : left > right ? 1 : 0;
|
|
487
480
|
});
|
|
488
|
-
if (jcs(entries) !== jcs(sorted) ||
|
|
481
|
+
if (jcs(entries) !== jcs(sorted) || chunkIMUVIIJR_cjs.digestV4(jcs(entries)) !== this.bundle.registry.digest)
|
|
489
482
|
this.error("WW_REGISTRY", "app.registry-digest");
|
|
490
483
|
for (const entry of entries) {
|
|
491
484
|
if (typeof entry.id !== "string" || !uuids.test(entry.id) || typeof entry.namespace !== "string" || !["Requirement", "ImplementationObligation"].includes(textValue(entry.kind))) {
|
|
@@ -677,7 +670,7 @@ var Linker = class {
|
|
|
677
670
|
kind: "shell",
|
|
678
671
|
namespace: layout.module.namespace,
|
|
679
672
|
id: layout.definition.id,
|
|
680
|
-
profileDigest:
|
|
673
|
+
profileDigest: chunkIMUVIIJR_cjs.digestV4(jcs(this.bundle.profile))
|
|
681
674
|
};
|
|
682
675
|
const children = this.expandChildren([layout.definition], {
|
|
683
676
|
owner: layout,
|
|
@@ -821,9 +814,9 @@ var Linker = class {
|
|
|
821
814
|
definitionId: context.owner.definition.id,
|
|
822
815
|
instanceRoot: context.root,
|
|
823
816
|
instancePath: context.path,
|
|
824
|
-
localId: (_e = primitive.id) != null ? _e : slot ? "_slot" : `_node_${
|
|
817
|
+
localId: (_e = primitive.id) != null ? _e : slot ? "_slot" : `_node_${chunkIMUVIIJR_cjs.digestV4((_d = this.pathByNode.get(node)) != null ? _d : textValue(source.start)).slice(7)}`
|
|
825
818
|
};
|
|
826
|
-
const renderedId = `wf-${
|
|
819
|
+
const renderedId = `wf-${chunkIMUVIIJR_cjs.digestV4(jcs({ identity, projectionId: this.bundle.profile.id })).slice(7)}`;
|
|
827
820
|
if (this.domIds.has(renderedId))
|
|
828
821
|
this.error("WW_DUPLICATE_ID", "app.rendered-identity-collision", node);
|
|
829
822
|
this.domIds.add(renderedId);
|
|
@@ -867,9 +860,9 @@ var Linker = class {
|
|
|
867
860
|
}[node.kind];
|
|
868
861
|
if (parent !== void 0) snippet = `${parent} { ${snippet} }`;
|
|
869
862
|
try {
|
|
870
|
-
|
|
863
|
+
chunkIMUVIIJR_cjs.parseV4(`page { ${snippet} }`, { languageVersion: "4.0.0" });
|
|
871
864
|
} catch (error) {
|
|
872
|
-
if (error instanceof
|
|
865
|
+
if (error instanceof chunkIMUVIIJR_cjs.V4ParseError)
|
|
873
866
|
this.error("WW_PARAMETER", "app.substituted-attribute-domain", source);
|
|
874
867
|
else throw error;
|
|
875
868
|
}
|
|
@@ -1303,7 +1296,7 @@ function safeUrl(value) {
|
|
|
1303
1296
|
try {
|
|
1304
1297
|
const url = new URL(value);
|
|
1305
1298
|
return ["https:", "http:", "mailto:", "tel:"].includes(url.protocol) && !url.username && !url.password;
|
|
1306
|
-
} catch
|
|
1299
|
+
} catch {
|
|
1307
1300
|
return false;
|
|
1308
1301
|
}
|
|
1309
1302
|
}
|
|
@@ -1322,26 +1315,24 @@ function linkAppV4(bundle) {
|
|
|
1322
1315
|
linker.expandAll();
|
|
1323
1316
|
linker.semantics();
|
|
1324
1317
|
if (linker.diagnostics.length > 0) return failed(linker.diagnostics);
|
|
1325
|
-
const sourceMap = linker.expanded.map(
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
})
|
|
1338
|
-
);
|
|
1318
|
+
const sourceMap = linker.expanded.map((entry) => ({
|
|
1319
|
+
renderedId: entry.renderedId,
|
|
1320
|
+
identity: entry.identity,
|
|
1321
|
+
moduleId: entry.owner.module.id,
|
|
1322
|
+
source: entry.source,
|
|
1323
|
+
invocationSources: entry.invocationSources,
|
|
1324
|
+
requirementRefs: stringArray(entry.node.attributes.requirementRefs),
|
|
1325
|
+
obligationRefs: stringArray(entry.node.attributes.obligationRefs),
|
|
1326
|
+
operationIds: asObjects(entry.node.attributes.on).flatMap(
|
|
1327
|
+
(handler) => asObjects(handler.operations).map((operation) => textValue(operation.id))
|
|
1328
|
+
)
|
|
1329
|
+
}));
|
|
1339
1330
|
const linked = freeze({
|
|
1340
1331
|
[linkedBrand]: true,
|
|
1341
1332
|
kind: "LinkedApp",
|
|
1342
1333
|
languageVersion: "4.0.0",
|
|
1343
1334
|
id: bundle.id,
|
|
1344
|
-
digest:
|
|
1335
|
+
digest: chunkIMUVIIJR_cjs.digestV4(jcs(bundle)),
|
|
1345
1336
|
sourceMap
|
|
1346
1337
|
});
|
|
1347
1338
|
links.set(linked, {
|
|
@@ -1402,20 +1393,18 @@ function componentUses(node) {
|
|
|
1402
1393
|
}
|
|
1403
1394
|
function referencesOf(pending) {
|
|
1404
1395
|
var _a;
|
|
1405
|
-
const inferred = componentUses(pending.input.node).map(
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
}
|
|
1418
|
-
);
|
|
1396
|
+
const inferred = componentUses(pending.input.node).map((use) => {
|
|
1397
|
+
var _a2;
|
|
1398
|
+
return {
|
|
1399
|
+
kind: "component",
|
|
1400
|
+
id: use.name,
|
|
1401
|
+
...use.namespace === void 0 ? {} : { namespace: use.namespace },
|
|
1402
|
+
source: {
|
|
1403
|
+
sourceId: pending.input.source.sourceId,
|
|
1404
|
+
location: (_a2 = use.loc) != null ? _a2 : pending.input.source.location
|
|
1405
|
+
}
|
|
1406
|
+
};
|
|
1407
|
+
});
|
|
1419
1408
|
return [...(_a = pending.input.references) != null ? _a : [], ...inferred];
|
|
1420
1409
|
}
|
|
1421
1410
|
function resolveReferences(pending, definitions, diagnostics) {
|
|
@@ -1937,7 +1926,7 @@ function compileApp(document2, options = {}) {
|
|
|
1937
1926
|
type: "Document",
|
|
1938
1927
|
children: [...document2.layouts.map(projectLayout), ...document2.screens.map(projectScreen)]
|
|
1939
1928
|
};
|
|
1940
|
-
return
|
|
1929
|
+
return chunk5DGRIQDU_cjs.renderSite(projected, { ...options, annotationStyle: "neutral" });
|
|
1941
1930
|
}
|
|
1942
1931
|
function linkAndCompileApp(input, modules, options = {}) {
|
|
1943
1932
|
if (modules === void 0) {
|
|
@@ -1962,7 +1951,7 @@ function address(route) {
|
|
|
1962
1951
|
}
|
|
1963
1952
|
function hashBase64(value) {
|
|
1964
1953
|
var _a, _b;
|
|
1965
|
-
const hex =
|
|
1954
|
+
const hex = chunkIMUVIIJR_cjs.digestV4(value).slice(7), alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1966
1955
|
const bytes = Array.from(
|
|
1967
1956
|
{ length: 32 },
|
|
1968
1957
|
(_, index) => Number.parseInt(hex.slice(index * 2, index * 2 + 2), 16)
|
|
@@ -1976,10 +1965,10 @@ function hashBase64(value) {
|
|
|
1976
1965
|
}
|
|
1977
1966
|
var HtmlArtifact = class {
|
|
1978
1967
|
constructor(data, program) {
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1968
|
+
chunkETV4XYOV_cjs.__publicField(this, "data", data);
|
|
1969
|
+
chunkETV4XYOV_cjs.__publicField(this, "program", program);
|
|
1970
|
+
chunkETV4XYOV_cjs.__publicField(this, "unsupported", []);
|
|
1971
|
+
chunkETV4XYOV_cjs.__publicField(this, "rules", []);
|
|
1983
1972
|
}
|
|
1984
1973
|
node(entry) {
|
|
1985
1974
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
@@ -2521,7 +2510,6 @@ function runtimeEngine(program) {
|
|
|
2521
2510
|
);
|
|
2522
2511
|
return screen && (result.variant === void 0 || screen.variants.includes(result.variant)) ? result : null;
|
|
2523
2512
|
} catch (error) {
|
|
2524
|
-
void error;
|
|
2525
2513
|
return null;
|
|
2526
2514
|
}
|
|
2527
2515
|
}
|
|
@@ -2713,7 +2701,6 @@ function runtimeEngine(program) {
|
|
|
2713
2701
|
const url = new URL(text);
|
|
2714
2702
|
if (!url.protocol) return "url";
|
|
2715
2703
|
} catch (error) {
|
|
2716
|
-
void error;
|
|
2717
2704
|
return "url";
|
|
2718
2705
|
}
|
|
2719
2706
|
}
|
|
@@ -3839,7 +3826,7 @@ function runtimeProgram(linked) {
|
|
|
3839
3826
|
const program = freeze({
|
|
3840
3827
|
appId: data.bundle.id,
|
|
3841
3828
|
modelDigest: linked.digest,
|
|
3842
|
-
profileDigest:
|
|
3829
|
+
profileDigest: chunkIMUVIIJR_cjs.digestV4(jcs(data.bundle.profile)),
|
|
3843
3830
|
profile: data.bundle.profile,
|
|
3844
3831
|
entry: data.bundle.entry,
|
|
3845
3832
|
nodes: runtimeNodes,
|
|
@@ -4316,10 +4303,10 @@ function compileAppV4(linked) {
|
|
|
4316
4303
|
sourceMap: data.sourceMap,
|
|
4317
4304
|
mediaType: "text/html",
|
|
4318
4305
|
byteLength: new TextEncoder().encode(html).byteLength,
|
|
4319
|
-
digest:
|
|
4306
|
+
digest: chunkIMUVIIJR_cjs.digestV4(html),
|
|
4320
4307
|
modelDigest: linked.digest,
|
|
4321
|
-
profileDigest:
|
|
4322
|
-
runtimeDigest:
|
|
4308
|
+
profileDigest: chunkIMUVIIJR_cjs.digestV4(jcs(data.bundle.profile)),
|
|
4309
|
+
runtimeDigest: chunkIMUVIIJR_cjs.digestV4(NATIVE_RUNTIME),
|
|
4323
4310
|
registryDigest: data.bundle.registry.digest,
|
|
4324
4311
|
entry: data.bundle.entry,
|
|
4325
4312
|
screenIndex: data.screens.map((screen) => ({
|
|
@@ -4341,10 +4328,10 @@ function compileAppV4(linked) {
|
|
|
4341
4328
|
manifest: {
|
|
4342
4329
|
appId: data.bundle.id,
|
|
4343
4330
|
modelDigest: linked.digest,
|
|
4344
|
-
profileDigest:
|
|
4331
|
+
profileDigest: chunkIMUVIIJR_cjs.digestV4(jcs(data.bundle.profile)),
|
|
4345
4332
|
registryDigest: data.bundle.registry.digest,
|
|
4346
|
-
htmlDigest:
|
|
4347
|
-
runtimeDigest:
|
|
4333
|
+
htmlDigest: chunkIMUVIIJR_cjs.digestV4(html),
|
|
4334
|
+
runtimeDigest: chunkIMUVIIJR_cjs.digestV4(NATIVE_RUNTIME),
|
|
4348
4335
|
executionScope: "standard-1",
|
|
4349
4336
|
unsupportedOperations: renderer.unsupported
|
|
4350
4337
|
}
|
|
@@ -4357,18 +4344,16 @@ function renderSite2(bundle) {
|
|
|
4357
4344
|
return linked.ok ? compileAppV4(linked.value) : linked;
|
|
4358
4345
|
}
|
|
4359
4346
|
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
exports.parameterReferenceName = parameterReferenceName; exports.collectParameterReferences = collectParameterReferences; exports.createAppBundle = createAppBundle; exports.createAppNodeId = createAppNodeId; exports.createAppComponentInstanceId = createAppComponentInstanceId; exports.linkApp = linkApp; exports.compileApp = compileApp; exports.linkAndCompileApp = linkAndCompileApp; exports.createRuntime = createRuntime; exports.reduceEvent = reduceEvent; exports.advanceClock = advanceClock; exports.resetRuntime = resetRuntime; exports.renderSite = renderSite2;
|
|
4347
|
+
exports.advanceClock = advanceClock;
|
|
4348
|
+
exports.collectParameterReferences = collectParameterReferences;
|
|
4349
|
+
exports.compileApp = compileApp;
|
|
4350
|
+
exports.createAppBundle = createAppBundle;
|
|
4351
|
+
exports.createAppComponentInstanceId = createAppComponentInstanceId;
|
|
4352
|
+
exports.createAppNodeId = createAppNodeId;
|
|
4353
|
+
exports.createRuntime = createRuntime;
|
|
4354
|
+
exports.linkAndCompileApp = linkAndCompileApp;
|
|
4355
|
+
exports.linkApp = linkApp;
|
|
4356
|
+
exports.parameterReferenceName = parameterReferenceName;
|
|
4357
|
+
exports.reduceEvent = reduceEvent;
|
|
4358
|
+
exports.renderSite = renderSite2;
|
|
4359
|
+
exports.resetRuntime = resetRuntime;
|
package/dist/chunk-5DGRIQDU.cjs
CHANGED
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var _chunkZPHNXJRYcjs = require('./chunk-ZPHNXJRY.cjs');
|
|
3
|
+
var chunkZPHNXJRY_cjs = require('./chunk-ZPHNXJRY.cjs');
|
|
20
4
|
|
|
21
5
|
// src/ast/expand-variants.ts
|
|
22
6
|
function cloneNode(value) {
|
|
@@ -47,14 +31,14 @@ function hasVariants(document) {
|
|
|
47
31
|
return document.children.some((child) => child.type === "Page" && variantNames(child).length > 0);
|
|
48
32
|
}
|
|
49
33
|
function expandVariants(document) {
|
|
50
|
-
if (!hasVariants(document)) return
|
|
34
|
+
if (!hasVariants(document)) return chunkZPHNXJRY_cjs.filterUnscopedPages(document);
|
|
51
35
|
return {
|
|
52
36
|
...document,
|
|
53
37
|
children: document.children.flatMap((child) => {
|
|
54
38
|
if (child.type !== "Page") return [child];
|
|
55
39
|
const names = variantNames(child);
|
|
56
40
|
if (names.length === 0) {
|
|
57
|
-
const filtered =
|
|
41
|
+
const filtered = chunkZPHNXJRY_cjs.filterVariantScope(child.children, void 0);
|
|
58
42
|
return [filtered === child.children ? child : { ...child, children: filtered }];
|
|
59
43
|
}
|
|
60
44
|
return names.map((variant, position) => {
|
|
@@ -62,7 +46,7 @@ function expandVariants(document) {
|
|
|
62
46
|
delete clone.variants;
|
|
63
47
|
clone.variant = variant;
|
|
64
48
|
if (position > 0) delete clone.states;
|
|
65
|
-
clone.children =
|
|
49
|
+
clone.children = chunkZPHNXJRY_cjs.filterVariantScope(clone.children, variant);
|
|
66
50
|
return clone;
|
|
67
51
|
});
|
|
68
52
|
})
|
|
@@ -165,7 +149,7 @@ function generateSiteStyles(prefix) {
|
|
|
165
149
|
|
|
166
150
|
// src/renderer/site/runtime.ts
|
|
167
151
|
var ID_SCOPE_ATTR = "data-id-scope";
|
|
168
|
-
var [NAVIGATE_ATTR, OPENS_ATTR, TOGGLES_ATTR, ACTION_ATTR] =
|
|
152
|
+
var [NAVIGATE_ATTR, OPENS_ATTR, TOGGLES_ATTR, ACTION_ATTR] = chunkZPHNXJRY_cjs.INTERACTIVE_ATTR_NAMES;
|
|
169
153
|
function embedJson(value) {
|
|
170
154
|
return JSON.stringify(value).replace(/</g, "\\u003C");
|
|
171
155
|
}
|
|
@@ -392,16 +376,16 @@ function siteRuntime(registry, prefix) {
|
|
|
392
376
|
}
|
|
393
377
|
|
|
394
378
|
function applyOutcomes() {
|
|
395
|
-
var visible = site.querySelectorAll('[' + ${embedJson(
|
|
379
|
+
var visible = site.querySelectorAll('[' + ${embedJson(chunkZPHNXJRY_cjs.VISIBLE_GUARD_ATTR)} + ']');
|
|
396
380
|
for (var i = 0; i < visible.length; i++) {
|
|
397
|
-
var visibleGuard = parseJson(visible[i].getAttribute(${embedJson(
|
|
381
|
+
var visibleGuard = parseJson(visible[i].getAttribute(${embedJson(chunkZPHNXJRY_cjs.VISIBLE_GUARD_ATTR)}), null);
|
|
398
382
|
if (guardPasses(visibleGuard)) visible[i].removeAttribute('hidden');
|
|
399
383
|
else visible[i].setAttribute('hidden', 'hidden');
|
|
400
384
|
}
|
|
401
385
|
|
|
402
|
-
var enabled = site.querySelectorAll('[' + ${embedJson(
|
|
386
|
+
var enabled = site.querySelectorAll('[' + ${embedJson(chunkZPHNXJRY_cjs.ENABLED_GUARD_ATTR)} + ']');
|
|
403
387
|
for (var j = 0; j < enabled.length; j++) {
|
|
404
|
-
var enabledGuard = parseJson(enabled[j].getAttribute(${embedJson(
|
|
388
|
+
var enabledGuard = parseJson(enabled[j].getAttribute(${embedJson(chunkZPHNXJRY_cjs.ENABLED_GUARD_ATTR)}), null);
|
|
405
389
|
if (guardPasses(enabledGuard)) {
|
|
406
390
|
enabled[j].removeAttribute('disabled');
|
|
407
391
|
enabled[j].removeAttribute('aria-disabled');
|
|
@@ -415,9 +399,9 @@ function siteRuntime(registry, prefix) {
|
|
|
415
399
|
function applyVariantScopes() {
|
|
416
400
|
var screen = current === null ? null : screens[current];
|
|
417
401
|
var variant = screen ? screen.getAttribute('data-wf-variant') : null;
|
|
418
|
-
var scoped = site.querySelectorAll('[' + ${embedJson(
|
|
402
|
+
var scoped = site.querySelectorAll('[' + ${embedJson(chunkZPHNXJRY_cjs.VARIANT_SCOPE_ATTR)} + ']');
|
|
419
403
|
for (var i = 0; i < scoped.length; i++) {
|
|
420
|
-
var names = parseJson(scoped[i].getAttribute(${embedJson(
|
|
404
|
+
var names = parseJson(scoped[i].getAttribute(${embedJson(chunkZPHNXJRY_cjs.VARIANT_SCOPE_ATTR)}), []);
|
|
421
405
|
var visible = variant !== null && names.indexOf(variant) >= 0;
|
|
422
406
|
if (visible) scoped[i].removeAttribute('hidden');
|
|
423
407
|
else scoped[i].setAttribute('hidden', 'hidden');
|
|
@@ -475,7 +459,7 @@ function siteRuntime(registry, prefix) {
|
|
|
475
459
|
if (!isChrome(links[j])) continue;
|
|
476
460
|
// An external target names no screen, so it can never be the current
|
|
477
461
|
// one. Same marker, same skip: the registry is not consulted.
|
|
478
|
-
if (links[j].hasAttribute(${embedJson(
|
|
462
|
+
if (links[j].hasAttribute(${embedJson(chunkZPHNXJRY_cjs.EXTERNAL_NAVIGATE_ATTR)})) continue;
|
|
479
463
|
var target = resolve(links[j].getAttribute(${embedJson(NAVIGATE_ATTR)}));
|
|
480
464
|
if (target === key) links[j].classList.add(NAV_ACTIVE);
|
|
481
465
|
else links[j].classList.remove(NAV_ACTIVE);
|
|
@@ -532,9 +516,9 @@ function siteRuntime(registry, prefix) {
|
|
|
532
516
|
}
|
|
533
517
|
|
|
534
518
|
document.addEventListener('click', function (event) {
|
|
535
|
-
var typed = event.target.closest ? event.target.closest('[' + ${embedJson(
|
|
519
|
+
var typed = event.target.closest ? event.target.closest('[' + ${embedJson(chunkZPHNXJRY_cjs.TYPED_INTERACTION_ATTR)} + ']') : null;
|
|
536
520
|
if (typed) {
|
|
537
|
-
var signatures = parseJson(typed.getAttribute(${embedJson(
|
|
521
|
+
var signatures = parseJson(typed.getAttribute(${embedJson(chunkZPHNXJRY_cjs.TYPED_INTERACTION_ATTR)}), []);
|
|
538
522
|
var matched = false;
|
|
539
523
|
for (var typedIndex = 0; typedIndex < signatures.length; typedIndex++) {
|
|
540
524
|
var normalized = interactionFor(current, typed, signatures[typedIndex]);
|
|
@@ -555,7 +539,7 @@ function siteRuntime(registry, prefix) {
|
|
|
555
539
|
// drift surface, and the two disagreeing is how a runtime ends up hunting
|
|
556
540
|
// for a screen named "https://\u2026". Marked elements skip the registry
|
|
557
541
|
// entirely: the lookup is not attempted, not merely discarded.
|
|
558
|
-
if (mover && !mover.hasAttribute(${embedJson(
|
|
542
|
+
if (mover && !mover.hasAttribute(${embedJson(chunkZPHNXJRY_cjs.EXTERNAL_NAVIGATE_ATTR)})) {
|
|
559
543
|
var navigateTarget = mover.getAttribute(${embedJson(NAVIGATE_ATTR)});
|
|
560
544
|
var key = routeAllowed(current, navigateTarget) ? resolve(navigateTarget) : null;
|
|
561
545
|
if (key !== null) {
|
|
@@ -621,7 +605,7 @@ function siteRuntime(registry, prefix) {
|
|
|
621
605
|
// authored fragment link is left alone too \u2014 the hashchange handler below is
|
|
622
606
|
// how that is supposed to work.
|
|
623
607
|
var link = event.target.closest ? event.target.closest('a[href]') : null;
|
|
624
|
-
if (link && link.getAttribute('href') === ${embedJson(
|
|
608
|
+
if (link && link.getAttribute('href') === ${embedJson(chunkZPHNXJRY_cjs.INERT_HREF)}) event.preventDefault();
|
|
625
609
|
});
|
|
626
610
|
|
|
627
611
|
document.addEventListener('keydown', function (event) {
|
|
@@ -654,7 +638,7 @@ function attrs(pairs) {
|
|
|
654
638
|
return pairs.filter((pair) => pair[1] !== void 0).map(([name, value]) => ` ${name}="${escapeAttr(value)}"`).join("");
|
|
655
639
|
}
|
|
656
640
|
function renderHostedScreen(screen, shell, make, prefix) {
|
|
657
|
-
const { width, height } =
|
|
641
|
+
const { width, height } = chunkZPHNXJRY_cjs.resolvePageDimensions(screen.page);
|
|
658
642
|
const conflict = width !== shell.width || height !== shell.height ? `${width}x${height}` : void 0;
|
|
659
643
|
const scope = screenScope(screen.index);
|
|
660
644
|
const marks = attrs([
|
|
@@ -749,10 +733,10 @@ function compactRuntimeInteractions(model, interactions) {
|
|
|
749
733
|
function renderSite(document, options = {}) {
|
|
750
734
|
var _a;
|
|
751
735
|
const prefix = (_a = options.classPrefix) != null ? _a : DEFAULT_PREFIX;
|
|
752
|
-
document =
|
|
753
|
-
const model =
|
|
754
|
-
const interactionModel =
|
|
755
|
-
const make = (idScope) => new
|
|
736
|
+
document = chunkZPHNXJRY_cjs.expandRepeats(expandVariants(document));
|
|
737
|
+
const model = chunkZPHNXJRY_cjs.buildSiteModel(document);
|
|
738
|
+
const interactionModel = chunkZPHNXJRY_cjs.collectInteractions(document);
|
|
739
|
+
const make = (idScope) => new chunkZPHNXJRY_cjs.HtmlRenderer({
|
|
756
740
|
theme: options.theme,
|
|
757
741
|
classPrefix: prefix,
|
|
758
742
|
background: options.background,
|
|
@@ -762,8 +746,8 @@ function renderSite(document, options = {}) {
|
|
|
762
746
|
});
|
|
763
747
|
const shells = model.shells.map((shell, index) => renderShell(shell, index, make, prefix)).join("\n");
|
|
764
748
|
const standalone = model.screens.filter((screen) => screen.shell === void 0).map((screen) => renderStandaloneScreen(screen, make, prefix)).join("\n");
|
|
765
|
-
const theme = options.theme === "dark" ?
|
|
766
|
-
const css =
|
|
749
|
+
const theme = options.theme === "dark" ? chunkZPHNXJRY_cjs.darkTheme : chunkZPHNXJRY_cjs.defaultTheme;
|
|
750
|
+
const css = chunkZPHNXJRY_cjs.generateStyles(theme, prefix, options.annotationStyle) + generateSiteStyles(prefix);
|
|
767
751
|
const entry = resolveEntry(model, options);
|
|
768
752
|
const fragments = model.screens.map((screen) => {
|
|
769
753
|
var _a2;
|
|
@@ -836,7 +820,5 @@ ${runtime}
|
|
|
836
820
|
</html>`;
|
|
837
821
|
}
|
|
838
822
|
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
exports.expandVariants = expandVariants; exports.renderSite = renderSite;
|
|
823
|
+
exports.expandVariants = expandVariants;
|
|
824
|
+
exports.renderSite = renderSite;
|
package/dist/chunk-ETV4XYOV.cjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
|
|
1
|
+
'use strict';
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
|
+
exports.__publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|