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

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.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkNV6UV5ID_cjs = require('./chunk-NV6UV5ID.cjs');
4
- var chunkIMUVIIJR_cjs = require('./chunk-IMUVIIJR.cjs');
3
+ var chunkVCHXMPZL_cjs = require('./chunk-VCHXMPZL.cjs');
4
+ var chunkH2SWIUMU_cjs = require('./chunk-H2SWIUMU.cjs');
5
5
  var chunkZPHNXJRY_cjs = require('./chunk-ZPHNXJRY.cjs');
6
6
 
7
7
  // src/export/v4-svg.ts
@@ -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 ? "{}" : chunkNV6UV5ID_cjs.jcs(source.identity);
103
+ const identity = source === void 0 ? "{}" : chunkVCHXMPZL_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 = chunkNV6UV5ID_cjs.getLinkedAppData(linked);
127
+ const data = chunkVCHXMPZL_cjs.getLinkedAppData(linked);
128
128
  if (data === void 0)
129
- return chunkNV6UV5ID_cjs.failed([chunkNV6UV5ID_cjs.diagnostic("WW_SCHEMA", "app.untrusted-linked-model", void 0, {}, "compile")]);
129
+ return chunkVCHXMPZL_cjs.failed([chunkVCHXMPZL_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 chunkNV6UV5ID_cjs.failed([
133
- chunkNV6UV5ID_cjs.diagnostic("WW_EXPORT_PROFILE", "export.invalid-svg-profile", void 0, {}, "compile")
132
+ return chunkVCHXMPZL_cjs.failed([
133
+ chunkVCHXMPZL_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 chunkNV6UV5ID_cjs.failed([
143
- chunkNV6UV5ID_cjs.diagnostic("WW_EXPORT_BOARD", "export.board-not-found", void 0, {}, "compile")
142
+ return chunkVCHXMPZL_cjs.failed([
143
+ chunkVCHXMPZL_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: chunkIMUVIIJR_cjs.digestV4(chunkNV6UV5ID_cjs.jcs(valid)),
192
+ profileDigest: chunkH2SWIUMU_cjs.digestV4(chunkVCHXMPZL_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(chunkNV6UV5ID_cjs.jcs(manifest))}</metadata>${boardMarkup}</svg>`;
199
- const artifact = chunkNV6UV5ID_cjs.freeze({
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(chunkVCHXMPZL_cjs.jcs(manifest))}</metadata>${boardMarkup}</svg>`;
199
+ const artifact = chunkVCHXMPZL_cjs.freeze({
200
200
  kind: "V4SvgArtifact",
201
201
  mediaType: "image/svg+xml",
202
202
  svg,
203
203
  width,
204
204
  height,
205
- digest: chunkIMUVIIJR_cjs.digestV4(svg),
205
+ digest: chunkH2SWIUMU_cjs.digestV4(svg),
206
206
  manifest,
207
207
  diagnostics
208
208
  });
@@ -279,7 +279,7 @@ function escapeAttr(s) {
279
279
 
280
280
  // src/renderer/index.ts
281
281
  function render(document, options = {}) {
282
- document = chunkNV6UV5ID_cjs.expandVariants(document);
282
+ document = chunkVCHXMPZL_cjs.expandVariants(document);
283
283
  const isMultiPage = chunkZPHNXJRY_cjs.documentPages(document).length > 1;
284
284
  if (isMultiPage) {
285
285
  const result = renderCanvas(document, options);
@@ -290,7 +290,7 @@ function render(document, options = {}) {
290
290
  }
291
291
  function renderToHtml(document, options = {}) {
292
292
  var _a;
293
- document = chunkNV6UV5ID_cjs.expandVariants(document);
293
+ document = chunkVCHXMPZL_cjs.expandVariants(document);
294
294
  const { html, css } = render(document, options);
295
295
  const prefix = (_a = options.classPrefix) != null ? _a : "wf";
296
296
  const isMultiPage = chunkZPHNXJRY_cjs.documentPages(document).length > 1;
@@ -335,7 +335,7 @@ 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 = chunkNV6UV5ID_cjs.expandVariants(document);
338
+ document = chunkVCHXMPZL_cjs.expandVariants(document);
339
339
  const legacyOptions = options;
340
340
  const isMultiPage = chunkZPHNXJRY_cjs.documentPages(document).length > 1;
341
341
  let width = (_a = legacyOptions.width) != null ? _a : 800;
@@ -1,5 +1,5 @@
1
- import { getLinkedAppData, failed, diagnostic, jcs, freeze, expandVariants } from './chunk-TQSOLTMZ.js';
2
- import { digestV4 } from './chunk-3RWGG5EC.js';
1
+ import { getLinkedAppData, failed, diagnostic, jcs, freeze, expandVariants } from './chunk-24W2GEKO.js';
2
+ import { digestV4 } from './chunk-UGMDBW46.js';
3
3
  import { resolvePageDimensions, darkTheme, defaultTheme, generateStyles, documentPages, HtmlRenderer, createHtmlRenderer } from './chunk-XYACLXXF.js';
4
4
 
5
5
  // src/export/v4-svg.ts
@@ -1,5 +1,5 @@
1
- import { linkAppV4, renderSite, getLinkedAppData, failed, diagnostic, freeze, jcs, asObjects, textValue, object } from './chunk-TQSOLTMZ.js';
2
- import { digestV4 } from './chunk-3RWGG5EC.js';
1
+ import { linkAppV4, renderSite, getLinkedAppData, failed, diagnostic, freeze, jcs, asObjects, textValue, validateAppAssets, object } from './chunk-24W2GEKO.js';
2
+ import { digestV4 } from './chunk-UGMDBW46.js';
3
3
  import { __publicField } from './chunk-PKBMQBKP.js';
4
4
 
5
5
  // src/ast/component-parameters.ts
@@ -658,9 +658,11 @@ var HtmlArtifact = class {
658
658
  __publicField(this, "program", program);
659
659
  __publicField(this, "unsupported", []);
660
660
  __publicField(this, "rules", []);
661
+ __publicField(this, "assets");
662
+ this.assets = validateAppAssets(data.bundle.profile).assets;
661
663
  }
662
664
  node(entry) {
663
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
665
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
664
666
  const { node, renderedId } = entry;
665
667
  const attrs = node.attributes;
666
668
  const label = (_b = node.label) != null ? _b : textValue((_a = attrs.label) != null ? _a : "");
@@ -734,12 +736,19 @@ var HtmlArtifact = class {
734
736
  return `<h${rank}${common}>${escape(label)}</h${rank}>`;
735
737
  }
736
738
  if (node.kind === "divider") return `<hr${common}>`;
737
- if (node.kind === "image")
738
- return attrs.src === void 0 ? `<div${common} role="img"${attribute("aria-label", (_g = attrs.alt) != null ? _g : "Image placeholder")}></div>` : `<img${common}${attribute("src", attrs.src)}${attribute("alt", (_h = attrs.alt) != null ? _h : "")}>`;
739
- if (node.kind === "avatar" || node.kind === "icon" || node.kind === "badge" || node.kind === "marker")
740
- return `<span${common}>${escape((_i = node.number) != null ? _i : label || attrs.name || "")}</span>`;
739
+ if (node.kind === "image") {
740
+ const asset = typeof attrs.src === "string" ? this.assets.get(attrs.src) : void 0;
741
+ return asset === void 0 ? `<div${common} role="img"${attribute("aria-label", (_g = attrs.alt) != null ? _g : "Image placeholder")}></div>` : `<img${common}${attribute("src", `data:${asset.mediaType};base64,${asset.base64}`)}${attribute("alt", (_h = attrs.alt) != null ? _h : "")}>`;
742
+ }
743
+ if (node.kind === "avatar") {
744
+ const accessibleLabel = ((_j = (_i = attrs["aria-label"]) != null ? _i : attrs.aria) != null ? _j : label) || attrs.name || "Avatar";
745
+ const asset = typeof attrs.src === "string" ? this.assets.get(attrs.src) : void 0;
746
+ return asset === void 0 ? `<span${common}${attribute("role", "img")}${attrs["aria-label"] === void 0 && attrs.aria === void 0 ? attribute("aria-label", accessibleLabel) : ""}>${escape((_k = node.number) != null ? _k : label || attrs.name || "")}</span>` : `<span${common}${attribute("role", "img")}${attrs["aria-label"] === void 0 && attrs.aria === void 0 ? attribute("aria-label", accessibleLabel) : ""}><img${attribute("src", `data:${asset.mediaType};base64,${asset.base64}`)}${attribute("alt", accessibleLabel)}></span>`;
747
+ }
748
+ if (node.kind === "icon" || node.kind === "badge" || node.kind === "marker")
749
+ return `<span${common}>${escape((_l = node.number) != null ? _l : label || attrs.name || "")}</span>`;
741
750
  if (node.kind === "progress")
742
- return `<progress${common}${attribute("value", attrs.indeterminate === true ? void 0 : value != null ? value : 0)}${attribute("max", (_j = attrs.max) != null ? _j : 100)}>${escape(label)}</progress>`;
751
+ return `<progress${common}${attribute("value", attrs.indeterminate === true ? void 0 : value != null ? value : 0)}${attribute("max", (_m = attrs.max) != null ? _m : 100)}>${escape(label)}</progress>`;
743
752
  if (node.kind === "alert" || node.kind === "toast" || node.kind === "spinner")
744
753
  return `<p${common}${attribute("role", node.kind === "alert" ? "alert" : "status")}>${escape(label)}${attrs.dismissible === true ? `<button type="button" data-wf-event-owner="${renderedId}" aria-label="Dismiss ${escape(label)}">Dismiss</button>` : ""}</p>`;
745
754
  if (node.kind === "accordion")
@@ -752,9 +761,9 @@ var HtmlArtifact = class {
752
761
  return `<div${common}>${children()}<span id="${renderedId}-tooltip" role="tooltip" hidden>${escape(label)}</span></div>`;
753
762
  if (node.kind === "table") {
754
763
  const columns = Array.isArray(attrs.columns) ? attrs.columns : [];
755
- let rows = (_k = node.items) != null ? _k : [];
764
+ let rows = (_n = node.items) != null ? _n : [];
756
765
  if (object(attrs.data)) {
757
- const initial = (_l = entry.stateBindings[textValue(attrs.data.state)]) == null ? void 0 : _l.initial;
766
+ const initial = (_o = entry.stateBindings[textValue(attrs.data.state)]) == null ? void 0 : _o.initial;
758
767
  if (Array.isArray(initial))
759
768
  rows = initial.map(
760
769
  (record) => columns.map((column) => object(record) ? record[textValue(column)] : null)
@@ -775,7 +784,7 @@ var HtmlArtifact = class {
775
784
  }
776
785
  if (node.kind === "tab")
777
786
  return `<section${common} role="tabpanel" aria-labelledby="${renderedId}-tab" tabindex="0">${children()}</section>`;
778
- const tag = (_m = {
787
+ const tag = (_p = {
779
788
  header: "header",
780
789
  main: "main",
781
790
  footer: "footer",
@@ -785,7 +794,7 @@ var HtmlArtifact = class {
785
794
  section: "section",
786
795
  page: "section",
787
796
  "annotation-item": "section"
788
- }[node.kind]) != null ? _m : "div";
797
+ }[node.kind]) != null ? _p : "div";
789
798
  if (node.kind === "page") common += ' tabindex="-1"';
790
799
  return `<${tag}${common}>${label ? `<span class="wf-label">${escape(label)}</span>` : ""}${children()}</${tag}>`;
791
800
  }
@@ -907,7 +916,10 @@ var HtmlArtifact = class {
907
916
  return `<section data-wf-requirement="${escape(entry.id)}"><h3>${escape(entry.title)}</h3><p>${escape((_b = (_a = entry.behavior) != null ? _a : entry.trigger) != null ? _b : "")}</p></section>`;
908
917
  }
909
918
  ).join("");
910
- const css = `#wireweave-app{font:16px/1.5 system-ui,sans-serif;color:#18181b;background:white}#wireweave-app [hidden]{display:none!important}#wireweave-app *{box-sizing:border-box}#wireweave-app :focus-visible{outline:2px solid #18181b;outline-offset:2px}#wireweave-app button,#wireweave-app input,#wireweave-app select{min-height:24px;font:inherit}#wireweave-app .wf-row{display:flex;gap:0}#wireweave-app .wf-col{flex:1}#wireweave-app .wf-stack,#wireweave-app .wf-field{display:flex;flex-direction:column;gap:8px}#wireweave-app .wf-page,#wireweave-app [data-wf-shell]{width:${textValue(bundle.profile.width)}px;height:${textValue(bundle.profile.height)}px;overflow:auto}#wireweave-app .wf-card,#wireweave-app th,#wireweave-app td{border:1px solid #71717a;padding:8px}#wireweave-app .wf-relative{position:relative}#wireweave-app [data-wf-slot]{display:contents}${this.rules.join("")}#wireweave-app[data-wf-view=accessible] .wf-node,#wireweave-app[data-wf-view=accessible] [data-wf-shell]{position:static!important;transform:none!important;width:auto!important;height:auto!important;min-width:0!important;max-width:100%!important;min-height:0!important;overflow-wrap:anywhere;order:0!important}#wireweave-app[data-wf-view=accessible] .wf-row{flex-direction:column!important;flex-wrap:wrap!important}#wireweave-app[data-wf-view=accessible] .wf-col{flex-basis:auto!important}#wireweave-app .wf-field{min-width:0}#wireweave-app .wf-field input,#wireweave-app .wf-field textarea,#wireweave-app .wf-field select{max-width:100%}#wireweave-app [data-wf-field][hidden]{display:none!important}#wireweave-app [role=tablist]{display:flex;flex-wrap:wrap}#wireweave-app [role=tooltip]{background:#f4f4f5;border:1px solid #71717a}#wireweave-app dialog{color:#18181b;background:white;max-width:100%;max-height:100%;overflow:auto}`;
919
+ const font = typeof bundle.profile.fontAssetId === "string" ? this.assets.get(bundle.profile.fontAssetId) : void 0;
920
+ const fontFace = font === void 0 ? "" : `@font-face{font-family:WireweaveProfile;src:url(data:${font.mediaType};base64,${font.base64}) format("woff2");font-display:swap}`;
921
+ const fontFamily = font === void 0 ? "system-ui,sans-serif" : "WireweaveProfile,system-ui,sans-serif";
922
+ const css = `${fontFace}#wireweave-app{font:16px/1.5 ${fontFamily};color:#18181b;background:white}#wireweave-app [hidden]{display:none!important}#wireweave-app *{box-sizing:border-box}#wireweave-app :focus-visible{outline:2px solid #18181b;outline-offset:2px}#wireweave-app button,#wireweave-app input,#wireweave-app select{min-height:24px;font:inherit}#wireweave-app .wf-row{display:flex;gap:0}#wireweave-app .wf-col{flex:1}#wireweave-app .wf-stack,#wireweave-app .wf-field{display:flex;flex-direction:column;gap:8px}#wireweave-app .wf-page,#wireweave-app [data-wf-shell]{width:${textValue(bundle.profile.width)}px;height:${textValue(bundle.profile.height)}px;overflow:auto}#wireweave-app .wf-card,#wireweave-app th,#wireweave-app td{border:1px solid #71717a;padding:8px}#wireweave-app .wf-relative{position:relative}#wireweave-app [data-wf-slot]{display:contents}${this.rules.join("")}#wireweave-app[data-wf-view=accessible] .wf-node,#wireweave-app[data-wf-view=accessible] [data-wf-shell]{position:static!important;transform:none!important;width:auto!important;height:auto!important;min-width:0!important;max-width:100%!important;min-height:0!important;overflow-wrap:anywhere;order:0!important}#wireweave-app[data-wf-view=accessible] .wf-row{flex-direction:column!important;flex-wrap:wrap!important}#wireweave-app[data-wf-view=accessible] .wf-col{flex-basis:auto!important}#wireweave-app .wf-field{min-width:0}#wireweave-app .wf-field input,#wireweave-app .wf-field textarea,#wireweave-app .wf-field select{max-width:100%}#wireweave-app [data-wf-field][hidden]{display:none!important}#wireweave-app [role=tablist]{display:flex;flex-wrap:wrap}#wireweave-app [role=tooltip]{background:#f4f4f5;border:1px solid #71717a}#wireweave-app dialog{color:#18181b;background:white;max-width:100%;max-height:100%;overflow:auto}`;
911
923
  const runtimeData = this.program;
912
924
  const csp = `default-src 'none'; script-src 'sha256-${hashBase64(NATIVE_RUNTIME)}'; style-src 'sha256-${hashBase64(css)}'; img-src data:; font-src data:; connect-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'; frame-src 'none'`;
913
925
  return `<!DOCTYPE html>
@@ -2291,6 +2303,7 @@ function runtimeEngine(program) {
2291
2303
  append(state, null, null, null, { type: input.kind }, "busy", "history-compensation");
2292
2304
  return state;
2293
2305
  }
2306
+ state.diagnostic = null;
2294
2307
  if (input.kind === "reset") {
2295
2308
  reset(state);
2296
2309
  drain(state);
@@ -2374,6 +2387,12 @@ function runtimeEngine(program) {
2374
2387
  if (!node) throw Error("unknown-source");
2375
2388
  if (!["click", "input", "change", "submit", "keydown", "focus", "blur"].includes(input.event))
2376
2389
  throw Error("event-type");
2390
+ if ("value" in input) {
2391
+ if (input.value === void 0) throw Error("event-payload");
2392
+ bounded(input.value);
2393
+ }
2394
+ if ("checked" in input && typeof input.checked !== "boolean") throw Error("event-payload");
2395
+ if ("key" in input && typeof input.key !== "string") throw Error("event-payload");
2377
2396
  if (input.event === "keydown" && (typeof input.key !== "string" || "value" in input || "checked" in input))
2378
2397
  throw Error("event-payload");
2379
2398
  if (!["input", "change", "keydown"].includes(input.event) && ("value" in input || "checked" in input || "key" in input))
@@ -2382,10 +2401,15 @@ function runtimeEngine(program) {
2382
2401
  node.kind
2383
2402
  ))
2384
2403
  throw Error("event-owner");
2404
+ if (["input", "change"].includes(input.event)) {
2405
+ const booleanControl = ["checkbox", "radio", "switch"].includes(node.kind);
2406
+ if ("key" in input) throw Error("event-payload");
2407
+ if (booleanControl && "value" in input) throw Error("event-payload");
2408
+ if (!booleanControl && "checked" in input) throw Error("event-payload");
2409
+ }
2385
2410
  if (input.event === "submit" && node.kind !== "form") throw Error("event-owner");
2386
2411
  const event = { type: input.event };
2387
2412
  if (input.value !== void 0) {
2388
- bounded(input.value);
2389
2413
  event.value = input.value;
2390
2414
  }
2391
2415
  if (input.checked !== void 0) event.checked = input.checked;
@@ -2512,11 +2536,16 @@ function runtimeProgram(linked) {
2512
2536
  form: (_e = (_d = entry.formTarget) != null ? _d : form == null ? void 0 : form.renderedId) != null ? _e : null
2513
2537
  };
2514
2538
  });
2539
+ const runtimeProfile = Object.fromEntries(
2540
+ Object.entries(data.bundle.profile).filter(
2541
+ ([key]) => key !== "assets" && key !== "fontAssetId"
2542
+ )
2543
+ );
2515
2544
  const program = freeze({
2516
2545
  appId: data.bundle.id,
2517
2546
  modelDigest: linked.digest,
2518
2547
  profileDigest: digestV4(jcs(data.bundle.profile)),
2519
- profile: data.bundle.profile,
2548
+ profile: runtimeProfile,
2520
2549
  entry: data.bundle.entry,
2521
2550
  nodes: runtimeNodes,
2522
2551
  states,
@@ -2586,6 +2615,16 @@ function browserAdapter(engine, program) {
2586
2615
  if ((node == null ? void 0 : node.kind) === "dropdown") return document.getElementById(id + "-trigger");
2587
2616
  return element(id);
2588
2617
  }
2618
+ function pendingFor(id) {
2619
+ for (const request of Object.values(state.requests)) {
2620
+ let owner2 = nodes.get(request.owner);
2621
+ while (owner2) {
2622
+ if (owner2.id === id) return true;
2623
+ owner2 = owner2.parent ? nodes.get(owner2.parent) : void 0;
2624
+ }
2625
+ }
2626
+ return false;
2627
+ }
2589
2628
  function metadata(sequence) {
2590
2629
  return { wireweave: { modelDigest: program.modelDigest, sequence } };
2591
2630
  }
@@ -2647,11 +2686,23 @@ function browserAdapter(engine, program) {
2647
2686
  root.querySelector("[data-wf-invalid-address]").textContent = state.address;
2648
2687
  root.setAttribute("data-wf-route", state.route ? state.address : "error");
2649
2688
  root.setAttribute("data-wf-view", state.viewMode);
2650
- root.setAttribute("aria-busy", String(state.suspended));
2689
+ root.setAttribute(
2690
+ "aria-busy",
2691
+ String(state.suspended || Object.keys(state.requests).length > 0)
2692
+ );
2651
2693
  for (const node of program.nodes) {
2652
2694
  const el = element(node.id);
2653
2695
  if (!el) continue;
2654
2696
  el.hidden = view.visible[node.id] !== true;
2697
+ const pending = pendingFor(node.id);
2698
+ if (pending || node.attributes.loading === true) {
2699
+ el.setAttribute("aria-busy", "true");
2700
+ if (pending) el.setAttribute("data-wf-pending", "true");
2701
+ else el.removeAttribute("data-wf-pending");
2702
+ } else {
2703
+ el.removeAttribute("aria-busy");
2704
+ el.removeAttribute("data-wf-pending");
2705
+ }
2655
2706
  const field = el.closest("[data-wf-field]");
2656
2707
  if (field) field.hidden = el.hidden;
2657
2708
  if (node.kind === "tab") {
@@ -2696,10 +2747,7 @@ function browserAdapter(engine, program) {
2696
2747
  error.textContent = state.invalid[node.id] ? "Check the required input values." : "";
2697
2748
  error.hidden = !state.invalid[node.id];
2698
2749
  }
2699
- el.setAttribute(
2700
- "aria-busy",
2701
- String(Object.values(state.requests).some((request) => request.owner === node.id))
2702
- );
2750
+ el.setAttribute("aria-busy", String(pending || node.attributes.loading === true));
2703
2751
  }
2704
2752
  if (node.kind === "accordion")
2705
2753
  el.open = state.expanded[node.id] === true;
@@ -3022,6 +3070,12 @@ function compileAppV4(linked) {
3022
3070
  htmlDigest: digestV4(html),
3023
3071
  runtimeDigest: digestV4(NATIVE_RUNTIME),
3024
3072
  executionScope: "standard-1",
3073
+ assets: [...renderer.assets.values()].map(({ id, mediaType, digest, byteLength }) => ({
3074
+ id,
3075
+ mediaType,
3076
+ digest,
3077
+ byteLength
3078
+ })),
3025
3079
  unsupportedOperations: renderer.unsupported
3026
3080
  }
3027
3081
  });
@@ -5494,6 +5494,7 @@ var schema_default = {
5494
5494
  },
5495
5495
  assets: {
5496
5496
  type: "array",
5497
+ 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
5498
  items: {
5498
5499
  type: "object",
5499
5500
  properties: {
@@ -5526,7 +5527,8 @@ var schema_default = {
5526
5527
  const: "15.1.0"
5527
5528
  },
5528
5529
  fontAssetId: {
5529
- $ref: "#/$defs/Id"
5530
+ $ref: "#/$defs/Id",
5531
+ description: "Optional asset ID that must resolve to a validated font/woff2 manifest entry."
5530
5532
  }
5531
5533
  },
5532
5534
  required: [
@@ -6005,6 +6007,7 @@ var schema_default = {
6005
6007
  additionalProperties: false
6006
6008
  },
6007
6009
  RuntimeInput: {
6010
+ 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
6011
  oneOf: [
6009
6012
  {
6010
6013
  type: "object",
@@ -9273,9 +9276,8 @@ var SHA256_K = new Uint32Array([
9273
9276
  3204031479,
9274
9277
  3329325298
9275
9278
  ]);
9276
- function digestV4(source) {
9279
+ function digestBytesV4(bytes) {
9277
9280
  var _a2, _b2, _c, _d, _e, _f, _g;
9278
- const bytes = new TextEncoder().encode(source);
9279
9281
  const padded = new Uint8Array(Math.ceil((bytes.length + 9) / 64) * 64);
9280
9282
  padded.set(bytes);
9281
9283
  padded[bytes.length] = 128;
@@ -9320,6 +9322,9 @@ function digestV4(source) {
9320
9322
  }
9321
9323
  return `sha256:${hash.map((value) => value.toString(16).padStart(8, "0")).join("")}`;
9322
9324
  }
9325
+ function digestV4(source) {
9326
+ return digestBytesV4(new TextEncoder().encode(source));
9327
+ }
9323
9328
 
9324
9329
  // src/parser/v4.ts
9325
9330
  var shapes = schema_default.$defs;
@@ -18039,4 +18044,4 @@ function getErrors(source) {
18039
18044
  return result.errors;
18040
18045
  }
18041
18046
 
18042
- export { V4ParseError, digestV4, getErrors, getV4SourceSpan, isValid, parse, parseV4, tryParse, tryParseV4 };
18047
+ export { V4ParseError, digestBytesV4, digestV4, getErrors, getV4SourceSpan, isValid, parse, parseV4, tryParse, tryParseV4 };