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

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 { b1 as WireframeDocument, h as AnyNode, al as PageNode, a2 as LayoutDefinitionNode } from './types-BDaNyWMR.cjs';
2
2
 
3
3
  /**
4
4
  * Renderer type definitions for wireweave
@@ -18,6 +18,14 @@ 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;
27
+ /** Prefix authored overlay ids with a renderer-owned scope. */
28
+ idScope?: string;
21
29
  }
22
30
  interface RenderResult {
23
31
  /** Rendered HTML content */
@@ -179,6 +187,8 @@ declare abstract class BaseRenderer {
179
187
  * Escape HTML special characters
180
188
  */
181
189
  protected escapeHtml(text: string): string;
190
+ /** Return the DOM id for an authored id under this renderer's scope. */
191
+ protected scopedId(id: string): string;
182
192
  /**
183
193
  * Build a CSS class string from an array of class names
184
194
  */
@@ -213,7 +223,25 @@ declare class HtmlRenderer extends BaseRenderer {
213
223
  * Node type to renderer method mapping
214
224
  */
215
225
  private readonly nodeRenderers;
216
- constructor(options?: RenderOptions);
226
+ /**
227
+ * Node → anchor-path map for the document currently being rendered. Non-null
228
+ * only while rendering with `sourceAnchors` enabled.
229
+ */
230
+ private pathMap;
231
+ /**
232
+ * Base index added to page anchor paths. Non-zero when a page is rendered in
233
+ * isolation (canvas per-page composition) but must keep its true document
234
+ * index in the anchor scheme.
235
+ */
236
+ private readonly pageIndexBase;
237
+ /** Content supplied by a site renderer for the next layout slot. */
238
+ private slotContent;
239
+ constructor(options?: RenderOptions, pageIndexBase?: number);
240
+ /**
241
+ * Render a document, building the anchor-path map first when anchors are
242
+ * enabled so `renderNode` / `renderPage` can inject each node's path.
243
+ */
244
+ render(document: WireframeDocument): RenderResult;
217
245
  /**
218
246
  * Get render context for external renderer functions
219
247
  */
@@ -234,6 +262,10 @@ declare class HtmlRenderer extends BaseRenderer {
234
262
  * Render any AST node
235
263
  */
236
264
  protected renderNode(node: AnyNode): string;
265
+ /** Render the first slot with the supplied page content, if any. */
266
+ protected renderSlot(): string;
267
+ /** Render nodes without adding a page frame, optionally filling a slot. */
268
+ renderFragment(nodes: AnyNode[], slotContent?: string | null): string;
237
269
  /**
238
270
  * Render children nodes
239
271
  */
@@ -454,6 +486,43 @@ declare function layoutCanvas(pages: PageNode[], gap?: number): {
454
486
  */
455
487
  declare function renderCanvas(doc: WireframeDocument, options?: CanvasOptions): CanvasRenderResult;
456
488
 
489
+ /** Why a page that declared `uses=` was not composed into a layout. */
490
+ type ShellMiss = 'unknown-layout' | 'slotless-layout';
491
+ interface SiteScreen {
492
+ /** Position in documentPages(document), used as the stable screen key. */
493
+ index: number;
494
+ page: PageNode;
495
+ shell?: string;
496
+ miss?: {
497
+ uses: string;
498
+ reason: ShellMiss;
499
+ };
500
+ /** The first declared id or title that resolves back to this screen. */
501
+ name?: string;
502
+ }
503
+ interface SiteShell {
504
+ name: string;
505
+ layout: LayoutDefinitionNode;
506
+ screens: SiteScreen[];
507
+ width: number;
508
+ height: number;
509
+ }
510
+ interface SiteModel {
511
+ screens: SiteScreen[];
512
+ shells: SiteShell[];
513
+ names: Map<string, number>;
514
+ entry: number;
515
+ }
516
+ /** Build the page/shell/name model shared by the site renderer and runtime. */
517
+ declare function buildSiteModel(doc: WireframeDocument): SiteModel;
518
+
519
+ interface SiteOptions extends Pick<RenderOptions, 'theme' | 'classPrefix' | 'background'> {
520
+ title?: string;
521
+ entry?: string;
522
+ }
523
+ /** Render pages and their optional named layouts as one self-contained site. */
524
+ declare function renderSite(document: WireframeDocument, options?: SiteOptions): string;
525
+
457
526
  /**
458
527
  * Lucide Icons Data
459
528
  *
@@ -483,6 +552,14 @@ declare function getIconData(name: string): IconData | undefined;
483
552
  */
484
553
  declare function renderIconSvg(data: IconData, _size?: number, // size is now controlled by CSS, this param is kept for API compatibility
485
554
  strokeWidth?: number, className?: string, styleAttr?: string): string;
555
+ /**
556
+ * Render the canonical "unknown icon" placeholder SVG — a dashed circle with a
557
+ * `?` glyph. Shared by every renderer (icon node, button, input) so an
558
+ * unresolved icon name always produces the SAME visual placeholder and never
559
+ * leaks the raw DSL name as literal text. Callers add a
560
+ * `title="Unknown icon: <name>"` on the wrapping element for hover context.
561
+ */
562
+ declare function renderUnknownIconSvg(className?: string, size?: number, styleAttr?: string): string;
486
563
 
487
564
  /**
488
565
  * Renderer module for wireweave
@@ -528,4 +605,4 @@ declare function renderToHtml(document: WireframeDocument, options?: RenderOptio
528
605
  */
529
606
  declare function renderToSvg(document: WireframeDocument, options?: SvgRenderOptions): SvgRenderResult;
530
607
 
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 };
608
+ export { type CanvasOptions, type CanvasRenderResult, HtmlRenderer, type IconData, type IconElement, type PageRenderResult, type PlacedPage, type RenderContext, type RenderOptions, type RenderResult, type ShellMiss, type SiteModel, type SiteOptions, type SiteScreen, type SiteShell, type SvgRenderOptions, type SvgRenderResult, type ThemeColors, type ThemeConfig, buildSiteModel, createHtmlRenderer, darkTheme, defaultTheme, generateComponentStyles, generateStyles, getIconData, getTheme, layoutCanvas, lucideIcons, render, renderCanvas, renderIconSvg, renderPage, renderSite, 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 { b1 as WireframeDocument, h as AnyNode, al as PageNode, a2 as LayoutDefinitionNode } from './types-BDaNyWMR.js';
2
2
 
3
3
  /**
4
4
  * Renderer type definitions for wireweave
@@ -18,6 +18,14 @@ 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;
27
+ /** Prefix authored overlay ids with a renderer-owned scope. */
28
+ idScope?: string;
21
29
  }
22
30
  interface RenderResult {
23
31
  /** Rendered HTML content */
@@ -179,6 +187,8 @@ declare abstract class BaseRenderer {
179
187
  * Escape HTML special characters
180
188
  */
181
189
  protected escapeHtml(text: string): string;
190
+ /** Return the DOM id for an authored id under this renderer's scope. */
191
+ protected scopedId(id: string): string;
182
192
  /**
183
193
  * Build a CSS class string from an array of class names
184
194
  */
@@ -213,7 +223,25 @@ declare class HtmlRenderer extends BaseRenderer {
213
223
  * Node type to renderer method mapping
214
224
  */
215
225
  private readonly nodeRenderers;
216
- constructor(options?: RenderOptions);
226
+ /**
227
+ * Node → anchor-path map for the document currently being rendered. Non-null
228
+ * only while rendering with `sourceAnchors` enabled.
229
+ */
230
+ private pathMap;
231
+ /**
232
+ * Base index added to page anchor paths. Non-zero when a page is rendered in
233
+ * isolation (canvas per-page composition) but must keep its true document
234
+ * index in the anchor scheme.
235
+ */
236
+ private readonly pageIndexBase;
237
+ /** Content supplied by a site renderer for the next layout slot. */
238
+ private slotContent;
239
+ constructor(options?: RenderOptions, pageIndexBase?: number);
240
+ /**
241
+ * Render a document, building the anchor-path map first when anchors are
242
+ * enabled so `renderNode` / `renderPage` can inject each node's path.
243
+ */
244
+ render(document: WireframeDocument): RenderResult;
217
245
  /**
218
246
  * Get render context for external renderer functions
219
247
  */
@@ -234,6 +262,10 @@ declare class HtmlRenderer extends BaseRenderer {
234
262
  * Render any AST node
235
263
  */
236
264
  protected renderNode(node: AnyNode): string;
265
+ /** Render the first slot with the supplied page content, if any. */
266
+ protected renderSlot(): string;
267
+ /** Render nodes without adding a page frame, optionally filling a slot. */
268
+ renderFragment(nodes: AnyNode[], slotContent?: string | null): string;
237
269
  /**
238
270
  * Render children nodes
239
271
  */
@@ -454,6 +486,43 @@ declare function layoutCanvas(pages: PageNode[], gap?: number): {
454
486
  */
455
487
  declare function renderCanvas(doc: WireframeDocument, options?: CanvasOptions): CanvasRenderResult;
456
488
 
489
+ /** Why a page that declared `uses=` was not composed into a layout. */
490
+ type ShellMiss = 'unknown-layout' | 'slotless-layout';
491
+ interface SiteScreen {
492
+ /** Position in documentPages(document), used as the stable screen key. */
493
+ index: number;
494
+ page: PageNode;
495
+ shell?: string;
496
+ miss?: {
497
+ uses: string;
498
+ reason: ShellMiss;
499
+ };
500
+ /** The first declared id or title that resolves back to this screen. */
501
+ name?: string;
502
+ }
503
+ interface SiteShell {
504
+ name: string;
505
+ layout: LayoutDefinitionNode;
506
+ screens: SiteScreen[];
507
+ width: number;
508
+ height: number;
509
+ }
510
+ interface SiteModel {
511
+ screens: SiteScreen[];
512
+ shells: SiteShell[];
513
+ names: Map<string, number>;
514
+ entry: number;
515
+ }
516
+ /** Build the page/shell/name model shared by the site renderer and runtime. */
517
+ declare function buildSiteModel(doc: WireframeDocument): SiteModel;
518
+
519
+ interface SiteOptions extends Pick<RenderOptions, 'theme' | 'classPrefix' | 'background'> {
520
+ title?: string;
521
+ entry?: string;
522
+ }
523
+ /** Render pages and their optional named layouts as one self-contained site. */
524
+ declare function renderSite(document: WireframeDocument, options?: SiteOptions): string;
525
+
457
526
  /**
458
527
  * Lucide Icons Data
459
528
  *
@@ -483,6 +552,14 @@ declare function getIconData(name: string): IconData | undefined;
483
552
  */
484
553
  declare function renderIconSvg(data: IconData, _size?: number, // size is now controlled by CSS, this param is kept for API compatibility
485
554
  strokeWidth?: number, className?: string, styleAttr?: string): string;
555
+ /**
556
+ * Render the canonical "unknown icon" placeholder SVG — a dashed circle with a
557
+ * `?` glyph. Shared by every renderer (icon node, button, input) so an
558
+ * unresolved icon name always produces the SAME visual placeholder and never
559
+ * leaks the raw DSL name as literal text. Callers add a
560
+ * `title="Unknown icon: <name>"` on the wrapping element for hover context.
561
+ */
562
+ declare function renderUnknownIconSvg(className?: string, size?: number, styleAttr?: string): string;
486
563
 
487
564
  /**
488
565
  * Renderer module for wireweave
@@ -528,4 +605,4 @@ declare function renderToHtml(document: WireframeDocument, options?: RenderOptio
528
605
  */
529
606
  declare function renderToSvg(document: WireframeDocument, options?: SvgRenderOptions): SvgRenderResult;
530
607
 
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 };
608
+ export { type CanvasOptions, type CanvasRenderResult, HtmlRenderer, type IconData, type IconElement, type PageRenderResult, type PlacedPage, type RenderContext, type RenderOptions, type RenderResult, type ShellMiss, type SiteModel, type SiteOptions, type SiteScreen, type SiteShell, type SvgRenderOptions, type SvgRenderResult, type ThemeColors, type ThemeConfig, buildSiteModel, createHtmlRenderer, darkTheme, defaultTheme, generateComponentStyles, generateStyles, getIconData, getTheme, layoutCanvas, lucideIcons, render, renderCanvas, renderIconSvg, renderPage, renderSite, renderToHtml, renderToSvg, renderUnknownIconSvg, resolvePageDimensions };