@wireweave/core 3.1.0-beta.0 → 3.1.0-beta.1

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,4 +1,4 @@
1
- import { aZ as WireframeDocument, h as AnyNode, aj as PageNode } from './types-C1kQ4VAF.cjs';
1
+ import { aZ as WireframeDocument, h as AnyNode, aj as PageNode } from './types-BDbXDhTp.cjs';
2
2
 
3
3
  /**
4
4
  * Renderer type definitions for wireweave
@@ -18,6 +18,12 @@ interface RenderOptions {
18
18
  classPrefix?: string;
19
19
  /** Background color (e.g., '#ffffff', 'transparent') */
20
20
  background?: string;
21
+ /**
22
+ * Emit source-anchor attributes (`data-wf-path` / `data-wf-loc`) on each
23
+ * rendered component element, enabling DOM ↔ AST ↔ source mapping. Default
24
+ * `false` — output is byte-identical to non-anchored rendering when off.
25
+ */
26
+ sourceAnchors?: boolean;
21
27
  }
22
28
  interface RenderResult {
23
29
  /** Rendered HTML content */
@@ -213,7 +219,23 @@ declare class HtmlRenderer extends BaseRenderer {
213
219
  * Node type to renderer method mapping
214
220
  */
215
221
  private readonly nodeRenderers;
216
- constructor(options?: RenderOptions);
222
+ /**
223
+ * Node → anchor-path map for the document currently being rendered. Non-null
224
+ * only while rendering with `sourceAnchors` enabled.
225
+ */
226
+ private pathMap;
227
+ /**
228
+ * Base index added to page anchor paths. Non-zero when a page is rendered in
229
+ * isolation (canvas per-page composition) but must keep its true document
230
+ * index in the anchor scheme.
231
+ */
232
+ private readonly pageIndexBase;
233
+ constructor(options?: RenderOptions, pageIndexBase?: number);
234
+ /**
235
+ * Render a document, building the anchor-path map first when anchors are
236
+ * enabled so `renderNode` / `renderPage` can inject each node's path.
237
+ */
238
+ render(document: WireframeDocument): RenderResult;
217
239
  /**
218
240
  * Get render context for external renderer functions
219
241
  */
@@ -483,6 +505,14 @@ declare function getIconData(name: string): IconData | undefined;
483
505
  */
484
506
  declare function renderIconSvg(data: IconData, _size?: number, // size is now controlled by CSS, this param is kept for API compatibility
485
507
  strokeWidth?: number, className?: string, styleAttr?: string): string;
508
+ /**
509
+ * Render the canonical "unknown icon" placeholder SVG — a dashed circle with a
510
+ * `?` glyph. Shared by every renderer (icon node, button, input) so an
511
+ * unresolved icon name always produces the SAME visual placeholder and never
512
+ * leaks the raw DSL name as literal text. Callers add a
513
+ * `title="Unknown icon: <name>"` on the wrapping element for hover context.
514
+ */
515
+ declare function renderUnknownIconSvg(className?: string, size?: number, styleAttr?: string): string;
486
516
 
487
517
  /**
488
518
  * Renderer module for wireweave
@@ -528,4 +558,4 @@ declare function renderToHtml(document: WireframeDocument, options?: RenderOptio
528
558
  */
529
559
  declare function renderToSvg(document: WireframeDocument, options?: SvgRenderOptions): SvgRenderResult;
530
560
 
531
- export { type CanvasOptions, type CanvasRenderResult, HtmlRenderer, type IconData, type IconElement, type PageRenderResult, type PlacedPage, type RenderContext, type RenderOptions, type RenderResult, type SvgRenderOptions, type SvgRenderResult, type ThemeColors, type ThemeConfig, createHtmlRenderer, darkTheme, defaultTheme, generateComponentStyles, generateStyles, getIconData, getTheme, layoutCanvas, lucideIcons, render, renderCanvas, renderIconSvg, renderPage, renderToHtml, renderToSvg, resolvePageDimensions };
561
+ export { type CanvasOptions, type CanvasRenderResult, HtmlRenderer, type IconData, type IconElement, type PageRenderResult, type PlacedPage, type RenderContext, type RenderOptions, type RenderResult, type SvgRenderOptions, type SvgRenderResult, type ThemeColors, type ThemeConfig, createHtmlRenderer, darkTheme, defaultTheme, generateComponentStyles, generateStyles, getIconData, getTheme, layoutCanvas, lucideIcons, render, renderCanvas, renderIconSvg, renderPage, renderToHtml, renderToSvg, renderUnknownIconSvg, resolvePageDimensions };
@@ -1,4 +1,4 @@
1
- import { aZ as WireframeDocument, h as AnyNode, aj as PageNode } from './types-C1kQ4VAF.js';
1
+ import { aZ as WireframeDocument, h as AnyNode, aj as PageNode } from './types-BDbXDhTp.js';
2
2
 
3
3
  /**
4
4
  * Renderer type definitions for wireweave
@@ -18,6 +18,12 @@ interface RenderOptions {
18
18
  classPrefix?: string;
19
19
  /** Background color (e.g., '#ffffff', 'transparent') */
20
20
  background?: string;
21
+ /**
22
+ * Emit source-anchor attributes (`data-wf-path` / `data-wf-loc`) on each
23
+ * rendered component element, enabling DOM ↔ AST ↔ source mapping. Default
24
+ * `false` — output is byte-identical to non-anchored rendering when off.
25
+ */
26
+ sourceAnchors?: boolean;
21
27
  }
22
28
  interface RenderResult {
23
29
  /** Rendered HTML content */
@@ -213,7 +219,23 @@ declare class HtmlRenderer extends BaseRenderer {
213
219
  * Node type to renderer method mapping
214
220
  */
215
221
  private readonly nodeRenderers;
216
- constructor(options?: RenderOptions);
222
+ /**
223
+ * Node → anchor-path map for the document currently being rendered. Non-null
224
+ * only while rendering with `sourceAnchors` enabled.
225
+ */
226
+ private pathMap;
227
+ /**
228
+ * Base index added to page anchor paths. Non-zero when a page is rendered in
229
+ * isolation (canvas per-page composition) but must keep its true document
230
+ * index in the anchor scheme.
231
+ */
232
+ private readonly pageIndexBase;
233
+ constructor(options?: RenderOptions, pageIndexBase?: number);
234
+ /**
235
+ * Render a document, building the anchor-path map first when anchors are
236
+ * enabled so `renderNode` / `renderPage` can inject each node's path.
237
+ */
238
+ render(document: WireframeDocument): RenderResult;
217
239
  /**
218
240
  * Get render context for external renderer functions
219
241
  */
@@ -483,6 +505,14 @@ declare function getIconData(name: string): IconData | undefined;
483
505
  */
484
506
  declare function renderIconSvg(data: IconData, _size?: number, // size is now controlled by CSS, this param is kept for API compatibility
485
507
  strokeWidth?: number, className?: string, styleAttr?: string): string;
508
+ /**
509
+ * Render the canonical "unknown icon" placeholder SVG — a dashed circle with a
510
+ * `?` glyph. Shared by every renderer (icon node, button, input) so an
511
+ * unresolved icon name always produces the SAME visual placeholder and never
512
+ * leaks the raw DSL name as literal text. Callers add a
513
+ * `title="Unknown icon: <name>"` on the wrapping element for hover context.
514
+ */
515
+ declare function renderUnknownIconSvg(className?: string, size?: number, styleAttr?: string): string;
486
516
 
487
517
  /**
488
518
  * Renderer module for wireweave
@@ -528,4 +558,4 @@ declare function renderToHtml(document: WireframeDocument, options?: RenderOptio
528
558
  */
529
559
  declare function renderToSvg(document: WireframeDocument, options?: SvgRenderOptions): SvgRenderResult;
530
560
 
531
- export { type CanvasOptions, type CanvasRenderResult, HtmlRenderer, type IconData, type IconElement, type PageRenderResult, type PlacedPage, type RenderContext, type RenderOptions, type RenderResult, type SvgRenderOptions, type SvgRenderResult, type ThemeColors, type ThemeConfig, createHtmlRenderer, darkTheme, defaultTheme, generateComponentStyles, generateStyles, getIconData, getTheme, layoutCanvas, lucideIcons, render, renderCanvas, renderIconSvg, renderPage, renderToHtml, renderToSvg, resolvePageDimensions };
561
+ export { type CanvasOptions, type CanvasRenderResult, HtmlRenderer, type IconData, type IconElement, type PageRenderResult, type PlacedPage, type RenderContext, type RenderOptions, type RenderResult, type SvgRenderOptions, type SvgRenderResult, type ThemeColors, type ThemeConfig, createHtmlRenderer, darkTheme, defaultTheme, generateComponentStyles, generateStyles, getIconData, getTheme, layoutCanvas, lucideIcons, render, renderCanvas, renderIconSvg, renderPage, renderToHtml, renderToSvg, renderUnknownIconSvg, resolvePageDimensions };
package/dist/renderer.js CHANGED
@@ -115,8 +115,14 @@ function generateContainerStyles(prefix) {
115
115
  font-weight: 600;
116
116
  }
117
117
 
118
+ /* Board-scoped: absolute (not fixed) so the drawer pins to its own page /
119
+ canvas board \u2014 the nearest positioned ancestor (.wf-page is position:relative,
120
+ .wf-canvas-board is position:absolute) \u2014 instead of the browser viewport.
121
+ Matches the modal backdrop's scoping and keeps the fixed-layout invariant:
122
+ with position:fixed a drawer in a multi-page canvas escapes to the viewport
123
+ top-left, overlapping other boards (see no-responsive.md). */
118
124
  .${prefix}-drawer {
119
- position: fixed;
125
+ position: absolute;
120
126
  background: var(--${prefix}-bg);
121
127
  border: 1px solid var(--${prefix}-border);
122
128
  box-shadow: var(--${prefix}-shadow-xl);
@@ -1945,7 +1951,8 @@ var DEFAULT_OPTIONS = {
1945
1951
  scale: 1,
1946
1952
  includeStyles: true,
1947
1953
  minify: false,
1948
- classPrefix: "wf"
1954
+ classPrefix: "wf",
1955
+ sourceAnchors: false
1949
1956
  };
1950
1957
  var BaseRenderer = class {
1951
1958
  context;
@@ -2116,6 +2123,52 @@ function resolveViewport(viewport, device) {
2116
2123
  return DEFAULT_VIEWPORT;
2117
2124
  }
2118
2125
 
2126
+ // src/ast/anchor-path.ts
2127
+ var ANCHOR_PATH_ATTR = "data-wf-path";
2128
+ var ANCHOR_LOC_ATTR = "data-wf-loc";
2129
+ var ANCHOR_CONTAINER_TYPES = /* @__PURE__ */ new Set([
2130
+ "Page",
2131
+ "Header",
2132
+ "Main",
2133
+ "Footer",
2134
+ "Sidebar",
2135
+ "Section",
2136
+ "Row",
2137
+ "Col",
2138
+ "Stack",
2139
+ "Relative",
2140
+ "Card",
2141
+ "Modal",
2142
+ "Drawer",
2143
+ "Accordion",
2144
+ "Tooltip",
2145
+ "Popover"
2146
+ ]);
2147
+ function anchorChildNodes(node) {
2148
+ if (!ANCHOR_CONTAINER_TYPES.has(node.type)) return [];
2149
+ const children = node.children;
2150
+ return Array.isArray(children) ? children : [];
2151
+ }
2152
+ function formatAnchorLoc(loc) {
2153
+ return `${loc.start.offset}-${loc.end.offset}`;
2154
+ }
2155
+ function walkAnchorPaths(doc, visit, pageIndexBase = 0) {
2156
+ doc.children.forEach((page, i) => {
2157
+ visitAnchorNode(page, String(pageIndexBase + i), visit);
2158
+ });
2159
+ }
2160
+ function visitAnchorNode(node, path, visit) {
2161
+ visit(node, path);
2162
+ anchorChildNodes(node).forEach((child, i) => {
2163
+ visitAnchorNode(child, `${path}.${i}`, visit);
2164
+ });
2165
+ }
2166
+ function buildAnchorPathMap(doc, pageIndexBase = 0) {
2167
+ const map = /* @__PURE__ */ new Map();
2168
+ walkAnchorPaths(doc, (node, path) => map.set(node, path), pageIndexBase);
2169
+ return map;
2170
+ }
2171
+
2119
2172
  // src/renderer/html/components.ts
2120
2173
  function buildClassString(classes) {
2121
2174
  return classes.filter(Boolean).join(" ");
@@ -48822,8 +48875,13 @@ var iconAliases = {
48822
48875
  close: "x",
48823
48876
  menu: "menu",
48824
48877
  hamburger: "menu",
48825
- dots: "more-horizontal",
48826
- "dots-vertical": "more-vertical",
48878
+ // Lucide renamed the overflow/kebab-menu glyphs to `ellipsis` /
48879
+ // `ellipsis-vertical`; map the legacy `more-*` names (and the `dots-*`
48880
+ // shorthands) onto the real keys so none of them dead-end.
48881
+ "more-horizontal": "ellipsis",
48882
+ "more-vertical": "ellipsis-vertical",
48883
+ dots: "ellipsis",
48884
+ "dots-vertical": "ellipsis-vertical",
48827
48885
  cog: "settings",
48828
48886
  gear: "settings"
48829
48887
  };
@@ -48850,6 +48908,12 @@ function renderIconSvg(data, _size = 24, strokeWidth = 2, className = "", styleA
48850
48908
  }).join("");
48851
48909
  return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${strokeWidth}" stroke-linecap="round" stroke-linejoin="round" class="${className}"${styleAttr}>${elements}</svg>`;
48852
48910
  }
48911
+ function renderUnknownIconSvg(className = "", size = 24, styleAttr = "") {
48912
+ return `<svg class="${className}" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"${styleAttr}>
48913
+ <circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" stroke-dasharray="4 2" fill="none" opacity="0.5"/>
48914
+ <text x="12" y="16" text-anchor="middle" font-size="10" fill="currentColor" opacity="0.7">?</text>
48915
+ </svg>`;
48916
+ }
48853
48917
 
48854
48918
  // src/renderer/html/renderers/button.ts
48855
48919
  function renderButton(node, ctx) {
@@ -48872,9 +48936,12 @@ function renderButton(node, ctx) {
48872
48936
  const sizeStyle = sizeResolved.style || "";
48873
48937
  const combinedStyles = baseStyles && sizeStyle ? `${baseStyles}; ${sizeStyle}` : baseStyles || sizeStyle;
48874
48938
  const styleAttr = combinedStyles ? ` style="${combinedStyles}"` : "";
48939
+ const accessibleName = node.aria ?? node["aria-label"];
48875
48940
  const attrs = {
48876
48941
  class: classes,
48877
48942
  disabled: node.disabled,
48943
+ "aria-label": accessibleName,
48944
+ title: node.title,
48878
48945
  // Interactive attributes
48879
48946
  "data-navigate": node.navigate,
48880
48947
  "data-opens": node.opens,
@@ -48887,7 +48954,7 @@ function renderButton(node, ctx) {
48887
48954
  if (iconData) {
48888
48955
  icon = renderIconSvg(iconData, 16, 2, `${ctx.prefix}-icon`);
48889
48956
  } else {
48890
- icon = `<span class="${ctx.prefix}-icon">[${ctx.escapeHtml(node.icon)}]</span>`;
48957
+ icon = `<span class="${ctx.prefix}-icon" title="Unknown icon: ${ctx.escapeHtml(node.icon)}">${renderUnknownIconSvg(`${ctx.prefix}-icon`, 16)}</span>`;
48891
48958
  }
48892
48959
  }
48893
48960
  const loading = node.loading ? `<span class="${ctx.prefix}-spinner ${ctx.prefix}-spinner-sm"></span>` : "";
@@ -48971,7 +49038,7 @@ function renderInput(node, ctx) {
48971
49038
  if (iconData) {
48972
49039
  iconHtml = renderIconSvg(iconData, 16, 2, `${ctx.prefix}-input-icon`);
48973
49040
  } else {
48974
- iconHtml = `<span class="${ctx.prefix}-input-icon">[${ctx.escapeHtml(node.icon)}]</span>`;
49041
+ iconHtml = `<span class="${ctx.prefix}-input-icon" title="Unknown icon: ${ctx.escapeHtml(node.icon)}">${renderUnknownIconSvg(`${ctx.prefix}-input-icon`, 16)}</span>`;
48975
49042
  }
48976
49043
  const wrapperClasses = ctx.buildClassString([`${ctx.prefix}-input-wrapper`]);
48977
49044
  const wrapper = `<div class="${wrapperClasses}"${styleAttr}>${iconHtml}${inputElement}</div>`;
@@ -49236,10 +49303,10 @@ function renderIcon(node, ctx) {
49236
49303
  }
49237
49304
  const size = sizeResolved.style?.match(/(\d+)px/)?.[1] || "24";
49238
49305
  const sizeNum = parseInt(size, 10);
49239
- const placeholderSvg = `<svg class="${ctx.prefix}-icon ${sizeResolved.className || ""}" width="${sizeNum}" height="${sizeNum}" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
49240
- <circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" stroke-dasharray="4 2" fill="none" opacity="0.5"/>
49241
- <text x="12" y="16" text-anchor="middle" font-size="10" fill="currentColor" opacity="0.7">?</text>
49242
- </svg>`;
49306
+ const placeholderSvg = renderUnknownIconSvg(
49307
+ `${ctx.prefix}-icon ${sizeResolved.className || ""}`,
49308
+ sizeNum
49309
+ );
49243
49310
  const wrapperStyleAttr = baseStyles ? ` style="${baseStyles}"` : "";
49244
49311
  return `<span class="${wrapperClasses}"${wrapperStyleAttr}${interactiveAttrStr} aria-hidden="true" title="Unknown icon: ${ctx.escapeHtml(node.name)}">${placeholderSvg}</span>`;
49245
49312
  }
@@ -49644,6 +49711,10 @@ function renderAnnotationItem(node, ctx) {
49644
49711
  }
49645
49712
 
49646
49713
  // src/renderer/html/index.ts
49714
+ function injectAnchorAttrs(html, path, loc) {
49715
+ const attrs = loc ? ` ${ANCHOR_PATH_ATTR}="${path}" ${ANCHOR_LOC_ATTR}="${formatAnchorLoc(loc)}"` : ` ${ANCHOR_PATH_ATTR}="${path}"`;
49716
+ return html.replace(/<([a-zA-Z][a-zA-Z0-9-]*)/, (match) => `${match}${attrs}`);
49717
+ }
49647
49718
  var SPACING_TOKENS = {
49648
49719
  0: "0px",
49649
49720
  1: "4px",
@@ -49686,10 +49757,36 @@ var HtmlRenderer = class extends BaseRenderer {
49686
49757
  * Node type to renderer method mapping
49687
49758
  */
49688
49759
  nodeRenderers;
49689
- constructor(options = {}) {
49760
+ /**
49761
+ * Node → anchor-path map for the document currently being rendered. Non-null
49762
+ * only while rendering with `sourceAnchors` enabled.
49763
+ */
49764
+ pathMap = null;
49765
+ /**
49766
+ * Base index added to page anchor paths. Non-zero when a page is rendered in
49767
+ * isolation (canvas per-page composition) but must keep its true document
49768
+ * index in the anchor scheme.
49769
+ */
49770
+ pageIndexBase;
49771
+ constructor(options = {}, pageIndexBase = 0) {
49690
49772
  super(options);
49773
+ this.pageIndexBase = pageIndexBase;
49691
49774
  this.nodeRenderers = this.createNodeRenderers();
49692
49775
  }
49776
+ /**
49777
+ * Render a document, building the anchor-path map first when anchors are
49778
+ * enabled so `renderNode` / `renderPage` can inject each node's path.
49779
+ */
49780
+ render(document) {
49781
+ if (this.context.options.sourceAnchors) {
49782
+ this.pathMap = buildAnchorPathMap(document, this.pageIndexBase);
49783
+ }
49784
+ try {
49785
+ return super.render(document);
49786
+ } finally {
49787
+ this.pathMap = null;
49788
+ }
49789
+ }
49693
49790
  /**
49694
49791
  * Get render context for external renderer functions
49695
49792
  */
@@ -49818,9 +49915,15 @@ var HtmlRenderer = class extends BaseRenderer {
49818
49915
  }
49819
49916
  const combinedStyle = commonStyles ? `${viewportStyle}; ${commonStyles}` : viewportStyle;
49820
49917
  const dataAttrs = `data-viewport-width="${viewport.width}" data-viewport-height="${viewport.height}" data-viewport-label="${viewport.label}"`;
49821
- const pageDiv = `<div class="${classes}" style="${combinedStyle}" ${dataAttrs}>
49918
+ let pageDiv = `<div class="${classes}" style="${combinedStyle}" ${dataAttrs}>
49822
49919
  ${title}${uiContent}
49823
49920
  </div>`;
49921
+ if (this.pathMap) {
49922
+ const path = this.pathMap.get(node);
49923
+ if (path !== void 0) {
49924
+ pageDiv = injectAnchorAttrs(pageDiv, path, node.loc);
49925
+ }
49926
+ }
49824
49927
  if (annotationChildren.length > 0) {
49825
49928
  const annotationsContent = this.renderChildren(annotationChildren);
49826
49929
  return `<div class="${this.prefix}-page-wrapper" style="width: ${viewport.width}px">
@@ -49835,10 +49938,14 @@ ${annotationsContent}
49835
49938
  */
49836
49939
  renderNode(node) {
49837
49940
  const renderer = this.nodeRenderers[node.type];
49838
- if (renderer) {
49839
- return renderer(node);
49941
+ const html = renderer ? renderer(node) : `<!-- Unknown node type: ${node.type} -->`;
49942
+ if (this.pathMap && node.type !== "Page") {
49943
+ const path = this.pathMap.get(node);
49944
+ if (path !== void 0) {
49945
+ return injectAnchorAttrs(html, path, node.loc);
49946
+ }
49840
49947
  }
49841
- return `<!-- Unknown node type: ${node.type} -->`;
49948
+ return html;
49842
49949
  }
49843
49950
  /**
49844
49951
  * Render children nodes
@@ -50289,8 +50396,8 @@ function renderCanvas(doc, options = {}) {
50289
50396
  };
50290
50397
  }
50291
50398
  const { placed, width, height } = layoutCanvas(doc.children, gap);
50292
- const pageRenderer = new HtmlRenderer({ ...options, includeStyles: false });
50293
- const boards = placed.map((p) => {
50399
+ const boards = placed.map((p, pageIndex) => {
50400
+ const pageRenderer = new HtmlRenderer({ ...options, includeStyles: false }, pageIndex);
50294
50401
  const { html: pageHtml } = pageRenderer.render({
50295
50402
  type: "Document",
50296
50403
  children: [p.page]
@@ -50328,6 +50435,7 @@ function render(document, options = {}) {
50328
50435
  }
50329
50436
  function renderToHtml(document, options = {}) {
50330
50437
  const { html, css } = render(document, options);
50438
+ const prefix = options.classPrefix ?? "wf";
50331
50439
  const isMultiPage = document.children.length > 1;
50332
50440
  const bodyAlign = isMultiPage ? "justify-content: flex-start;\n align-items: flex-start;" : "justify-content: center;\n align-items: center;";
50333
50441
  return `<!DOCTYPE html>
@@ -50350,6 +50458,14 @@ body {
50350
50458
  padding: 24px;
50351
50459
  box-sizing: border-box;
50352
50460
  }
50461
+ /* Fixed-layout invariant: the multi-page canvas is a flex item of <body> and
50462
+ must keep its intrinsic size when the viewport is narrower than the canvas.
50463
+ Without flex-shrink:0 the flex item shrinks and the boards reflow \u2014 the same
50464
+ defect class as .wf-page (see no-responsive.md). Single pages already carry
50465
+ flex-shrink:0 via generateStyles; the canvas wrapper needs it here. */
50466
+ .${prefix}-canvas {
50467
+ flex-shrink: 0;
50468
+ }
50353
50469
  ${css}
50354
50470
  </style>
50355
50471
  </head>
@@ -50426,6 +50542,7 @@ export {
50426
50542
  renderPage,
50427
50543
  renderToHtml,
50428
50544
  renderToSvg,
50545
+ renderUnknownIconSvg,
50429
50546
  resolvePageDimensions
50430
50547
  };
50431
50548
  /**
@@ -354,6 +354,19 @@ interface ButtonNode extends BaseNode, CommonProps, InteractiveProps {
354
354
  icon?: string;
355
355
  disabled?: boolean;
356
356
  loading?: boolean;
357
+ /**
358
+ * Accessible name, rendered as `aria-label`. Use this to give an icon-only
359
+ * button (`button "" icon="x" aria="Close"`) a real accessible name for
360
+ * screen-reader users (WCAG 4.1.2 / 1.1.1) without showing visible text.
361
+ * `aria-label` is accepted as a synonym.
362
+ */
363
+ aria?: string;
364
+ 'aria-label'?: string;
365
+ /**
366
+ * Tooltip text, rendered as the `title` attribute. Also contributes an
367
+ * accessible name (lower priority than `aria-label`/text content).
368
+ */
369
+ title?: string;
357
370
  }
358
371
  interface ImageNode extends BaseNode, CommonProps, InteractiveProps {
359
372
  type: 'Image';
@@ -354,6 +354,19 @@ interface ButtonNode extends BaseNode, CommonProps, InteractiveProps {
354
354
  icon?: string;
355
355
  disabled?: boolean;
356
356
  loading?: boolean;
357
+ /**
358
+ * Accessible name, rendered as `aria-label`. Use this to give an icon-only
359
+ * button (`button "" icon="x" aria="Close"`) a real accessible name for
360
+ * screen-reader users (WCAG 4.1.2 / 1.1.1) without showing visible text.
361
+ * `aria-label` is accepted as a synonym.
362
+ */
363
+ aria?: string;
364
+ 'aria-label'?: string;
365
+ /**
366
+ * Tooltip text, rendered as the `title` attribute. Also contributes an
367
+ * accessible name (lower priority than `aria-label`/text content).
368
+ */
369
+ title?: string;
357
370
  }
358
371
  interface ImageNode extends BaseNode, CommonProps, InteractiveProps {
359
372
  type: 'Image';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireweave/core",
3
- "version": "3.1.0-beta.0",
3
+ "version": "3.1.0-beta.1",
4
4
  "description": "Core parser and renderer for wireweave",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",