@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.
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkVCHXMPZL_cjs = require('./chunk-VCHXMPZL.cjs');
4
- var chunkH2SWIUMU_cjs = require('./chunk-H2SWIUMU.cjs');
5
- var chunkZPHNXJRY_cjs = require('./chunk-ZPHNXJRY.cjs');
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 ? "{}" : chunkVCHXMPZL_cjs.jcs(source.identity);
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 = chunkVCHXMPZL_cjs.getLinkedAppData(linked);
127
+ const data = chunk7ZRMSFWZ_cjs.getLinkedAppData(linked);
128
128
  if (data === void 0)
129
- return chunkVCHXMPZL_cjs.failed([chunkVCHXMPZL_cjs.diagnostic("WW_SCHEMA", "app.untrusted-linked-model", void 0, {}, "compile")]);
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 chunkVCHXMPZL_cjs.failed([
133
- chunkVCHXMPZL_cjs.diagnostic("WW_EXPORT_PROFILE", "export.invalid-svg-profile", void 0, {}, "compile")
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 chunkVCHXMPZL_cjs.failed([
143
- chunkVCHXMPZL_cjs.diagnostic("WW_EXPORT_BOARD", "export.board-not-found", void 0, {}, "compile")
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: chunkH2SWIUMU_cjs.digestV4(chunkVCHXMPZL_cjs.jcs(valid)),
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(chunkVCHXMPZL_cjs.jcs(manifest))}</metadata>${boardMarkup}</svg>`;
199
- const artifact = chunkVCHXMPZL_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(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: chunkH2SWIUMU_cjs.digestV4(svg),
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 } = chunkZPHNXJRY_cjs.resolvePageDimensions(page);
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" ? chunkZPHNXJRY_cjs.darkTheme : chunkZPHNXJRY_cjs.defaultTheme;
241
- const css = includeStyles ? chunkZPHNXJRY_cjs.generateStyles(theme, prefix, options.annotationStyle) : "";
242
- const pages = chunkZPHNXJRY_cjs.documentPages(doc);
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 chunkZPHNXJRY_cjs.HtmlRenderer({ ...options, includeStyles: false }, pageIndex);
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 = chunkVCHXMPZL_cjs.expandVariants(document);
283
- const isMultiPage = chunkZPHNXJRY_cjs.documentPages(document).length > 1;
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 = chunkZPHNXJRY_cjs.createHtmlRenderer(options);
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 = chunkVCHXMPZL_cjs.expandVariants(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 = chunkZPHNXJRY_cjs.documentPages(document).length > 1;
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 = chunkVCHXMPZL_cjs.expandVariants(document);
338
+ document = chunk7ZRMSFWZ_cjs.expandVariants(document);
339
339
  const legacyOptions = options;
340
- const isMultiPage = chunkZPHNXJRY_cjs.documentPages(document).length > 1;
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 = chunkZPHNXJRY_cjs.documentPages(document)[0];
356
+ const firstPage = chunkCGTYVLPA_cjs.documentPages(document)[0];
357
357
  if (firstPage && legacyOptions.width === void 0 && legacyOptions.height === void 0) {
358
- const dims = chunkZPHNXJRY_cjs.resolvePageDimensions(firstPage);
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",