@wireweave/core 3.1.0-beta.1 → 3.1.0-beta.3
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/index.cjs +1795 -1018
- package/dist/index.d.cts +34 -12
- package/dist/index.d.ts +34 -12
- package/dist/index.js +1788 -1018
- package/dist/parser.cjs +1003 -845
- package/dist/parser.d.cts +1 -1
- package/dist/parser.d.ts +1 -1
- package/dist/parser.js +1003 -845
- package/dist/renderer.cjs +641 -74
- package/dist/renderer.d.cts +79 -2
- package/dist/renderer.d.ts +79 -2
- package/dist/renderer.js +638 -74
- package/dist/{types-BDbXDhTp.d.cts → types-BDaNyWMR.d.cts} +28 -6
- package/dist/{types-BDbXDhTp.d.ts → types-BDaNyWMR.d.ts} +28 -6
- package/package.json +2 -2
package/dist/renderer.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b1 as WireframeDocument, h as AnyNode, al as PageNode, a2 as LayoutDefinitionNode, a0 as InteractiveProps } from './types-BDaNyWMR.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Renderer type definitions for wireweave
|
|
@@ -24,6 +24,8 @@ interface RenderOptions {
|
|
|
24
24
|
* `false` — output is byte-identical to non-anchored rendering when off.
|
|
25
25
|
*/
|
|
26
26
|
sourceAnchors?: boolean;
|
|
27
|
+
/** Prefix authored overlay ids with a renderer-owned scope. */
|
|
28
|
+
idScope?: string;
|
|
27
29
|
}
|
|
28
30
|
interface RenderResult {
|
|
29
31
|
/** Rendered HTML content */
|
|
@@ -185,6 +187,8 @@ declare abstract class BaseRenderer {
|
|
|
185
187
|
* Escape HTML special characters
|
|
186
188
|
*/
|
|
187
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;
|
|
188
192
|
/**
|
|
189
193
|
* Build a CSS class string from an array of class names
|
|
190
194
|
*/
|
|
@@ -230,6 +234,8 @@ declare class HtmlRenderer extends BaseRenderer {
|
|
|
230
234
|
* index in the anchor scheme.
|
|
231
235
|
*/
|
|
232
236
|
private readonly pageIndexBase;
|
|
237
|
+
/** Content supplied by a site renderer for the next layout slot. */
|
|
238
|
+
private slotContent;
|
|
233
239
|
constructor(options?: RenderOptions, pageIndexBase?: number);
|
|
234
240
|
/**
|
|
235
241
|
* Render a document, building the anchor-path map first when anchors are
|
|
@@ -256,6 +262,10 @@ declare class HtmlRenderer extends BaseRenderer {
|
|
|
256
262
|
* Render any AST node
|
|
257
263
|
*/
|
|
258
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;
|
|
259
269
|
/**
|
|
260
270
|
* Render children nodes
|
|
261
271
|
*/
|
|
@@ -476,6 +486,73 @@ declare function layoutCanvas(pages: PageNode[], gap?: number): {
|
|
|
476
486
|
*/
|
|
477
487
|
declare function renderCanvas(doc: WireframeDocument, options?: CanvasOptions): CanvasRenderResult;
|
|
478
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
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Shared interaction intent emitted by HTML renderers.
|
|
528
|
+
*
|
|
529
|
+
* Anchor renderers have two destination channels (`href` and
|
|
530
|
+
* `data-navigate`), so the choice between them must have one owner. Consumers
|
|
531
|
+
* such as Studio import {@link anchorIntent} to observe the same decision as
|
|
532
|
+
* the renderer instead of reimplementing it.
|
|
533
|
+
*/
|
|
534
|
+
|
|
535
|
+
type InteractiveAttrs = {
|
|
536
|
+
'data-navigate': string | undefined;
|
|
537
|
+
'data-navigate-external': true | undefined;
|
|
538
|
+
'data-opens': string | undefined;
|
|
539
|
+
'data-toggles': string | undefined;
|
|
540
|
+
'data-action': string | undefined;
|
|
541
|
+
};
|
|
542
|
+
/**
|
|
543
|
+
* Resolve the attributes emitted for a node rendered as an anchor.
|
|
544
|
+
*
|
|
545
|
+
* An authored `href` wins. Otherwise a URL-shaped `navigate` becomes the real
|
|
546
|
+
* `href`; a page-name target remains in `data-navigate` and the anchor receives
|
|
547
|
+
* an inert `#` href. Other interaction intents are preserved in every branch.
|
|
548
|
+
*/
|
|
549
|
+
declare function anchorIntent(node: Partial<InteractiveProps> & {
|
|
550
|
+
href?: string;
|
|
551
|
+
}): {
|
|
552
|
+
href: string;
|
|
553
|
+
attrs: InteractiveAttrs;
|
|
554
|
+
};
|
|
555
|
+
|
|
479
556
|
/**
|
|
480
557
|
* Lucide Icons Data
|
|
481
558
|
*
|
|
@@ -558,4 +635,4 @@ declare function renderToHtml(document: WireframeDocument, options?: RenderOptio
|
|
|
558
635
|
*/
|
|
559
636
|
declare function renderToSvg(document: WireframeDocument, options?: SvgRenderOptions): SvgRenderResult;
|
|
560
637
|
|
|
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 };
|
|
638
|
+
export { type CanvasOptions, type CanvasRenderResult, HtmlRenderer, type IconData, type IconElement, type InteractiveAttrs, 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, anchorIntent, buildSiteModel, createHtmlRenderer, darkTheme, defaultTheme, generateComponentStyles, generateStyles, getIconData, getTheme, layoutCanvas, lucideIcons, render, renderCanvas, renderIconSvg, renderPage, renderSite, renderToHtml, renderToSvg, renderUnknownIconSvg, resolvePageDimensions };
|
package/dist/renderer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b1 as WireframeDocument, h as AnyNode, al as PageNode, a2 as LayoutDefinitionNode, a0 as InteractiveProps } from './types-BDaNyWMR.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Renderer type definitions for wireweave
|
|
@@ -24,6 +24,8 @@ interface RenderOptions {
|
|
|
24
24
|
* `false` — output is byte-identical to non-anchored rendering when off.
|
|
25
25
|
*/
|
|
26
26
|
sourceAnchors?: boolean;
|
|
27
|
+
/** Prefix authored overlay ids with a renderer-owned scope. */
|
|
28
|
+
idScope?: string;
|
|
27
29
|
}
|
|
28
30
|
interface RenderResult {
|
|
29
31
|
/** Rendered HTML content */
|
|
@@ -185,6 +187,8 @@ declare abstract class BaseRenderer {
|
|
|
185
187
|
* Escape HTML special characters
|
|
186
188
|
*/
|
|
187
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;
|
|
188
192
|
/**
|
|
189
193
|
* Build a CSS class string from an array of class names
|
|
190
194
|
*/
|
|
@@ -230,6 +234,8 @@ declare class HtmlRenderer extends BaseRenderer {
|
|
|
230
234
|
* index in the anchor scheme.
|
|
231
235
|
*/
|
|
232
236
|
private readonly pageIndexBase;
|
|
237
|
+
/** Content supplied by a site renderer for the next layout slot. */
|
|
238
|
+
private slotContent;
|
|
233
239
|
constructor(options?: RenderOptions, pageIndexBase?: number);
|
|
234
240
|
/**
|
|
235
241
|
* Render a document, building the anchor-path map first when anchors are
|
|
@@ -256,6 +262,10 @@ declare class HtmlRenderer extends BaseRenderer {
|
|
|
256
262
|
* Render any AST node
|
|
257
263
|
*/
|
|
258
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;
|
|
259
269
|
/**
|
|
260
270
|
* Render children nodes
|
|
261
271
|
*/
|
|
@@ -476,6 +486,73 @@ declare function layoutCanvas(pages: PageNode[], gap?: number): {
|
|
|
476
486
|
*/
|
|
477
487
|
declare function renderCanvas(doc: WireframeDocument, options?: CanvasOptions): CanvasRenderResult;
|
|
478
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
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Shared interaction intent emitted by HTML renderers.
|
|
528
|
+
*
|
|
529
|
+
* Anchor renderers have two destination channels (`href` and
|
|
530
|
+
* `data-navigate`), so the choice between them must have one owner. Consumers
|
|
531
|
+
* such as Studio import {@link anchorIntent} to observe the same decision as
|
|
532
|
+
* the renderer instead of reimplementing it.
|
|
533
|
+
*/
|
|
534
|
+
|
|
535
|
+
type InteractiveAttrs = {
|
|
536
|
+
'data-navigate': string | undefined;
|
|
537
|
+
'data-navigate-external': true | undefined;
|
|
538
|
+
'data-opens': string | undefined;
|
|
539
|
+
'data-toggles': string | undefined;
|
|
540
|
+
'data-action': string | undefined;
|
|
541
|
+
};
|
|
542
|
+
/**
|
|
543
|
+
* Resolve the attributes emitted for a node rendered as an anchor.
|
|
544
|
+
*
|
|
545
|
+
* An authored `href` wins. Otherwise a URL-shaped `navigate` becomes the real
|
|
546
|
+
* `href`; a page-name target remains in `data-navigate` and the anchor receives
|
|
547
|
+
* an inert `#` href. Other interaction intents are preserved in every branch.
|
|
548
|
+
*/
|
|
549
|
+
declare function anchorIntent(node: Partial<InteractiveProps> & {
|
|
550
|
+
href?: string;
|
|
551
|
+
}): {
|
|
552
|
+
href: string;
|
|
553
|
+
attrs: InteractiveAttrs;
|
|
554
|
+
};
|
|
555
|
+
|
|
479
556
|
/**
|
|
480
557
|
* Lucide Icons Data
|
|
481
558
|
*
|
|
@@ -558,4 +635,4 @@ declare function renderToHtml(document: WireframeDocument, options?: RenderOptio
|
|
|
558
635
|
*/
|
|
559
636
|
declare function renderToSvg(document: WireframeDocument, options?: SvgRenderOptions): SvgRenderResult;
|
|
560
637
|
|
|
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 };
|
|
638
|
+
export { type CanvasOptions, type CanvasRenderResult, HtmlRenderer, type IconData, type IconElement, type InteractiveAttrs, 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, anchorIntent, buildSiteModel, createHtmlRenderer, darkTheme, defaultTheme, generateComponentStyles, generateStyles, getIconData, getTheme, layoutCanvas, lucideIcons, render, renderCanvas, renderIconSvg, renderPage, renderSite, renderToHtml, renderToSvg, renderUnknownIconSvg, resolvePageDimensions };
|