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

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.
Files changed (53) hide show
  1. package/dist/app.cjs +51 -31
  2. package/dist/app.d.cts +5 -145
  3. package/dist/app.d.ts +5 -145
  4. package/dist/app.js +2 -31
  5. package/dist/{chunk-QOS4IC75.js → chunk-2Y3GKARZ.js} +16 -1354
  6. package/dist/chunk-3RWGG5EC.js +296 -342
  7. package/dist/chunk-4DDV6Z2X.js +389 -0
  8. package/dist/chunk-ETV4XYOV.cjs +4 -6
  9. package/dist/chunk-IMUVIIJR.cjs +317 -354
  10. package/dist/chunk-LA5LKIEL.cjs +396 -0
  11. package/dist/chunk-MD6MNOEQ.cjs +121 -142
  12. package/dist/chunk-NV6UV5ID.cjs +2145 -0
  13. package/dist/chunk-PKBMQBKP.js +1 -3
  14. package/dist/{chunk-7VTK6LHL.cjs → chunk-SAN6CJEE.cjs} +96 -1421
  15. package/dist/chunk-TQSOLTMZ.js +2132 -0
  16. package/dist/chunk-V3HVWC7C.js +1 -32
  17. package/dist/chunk-XYACLXXF.js +4 -132
  18. package/dist/chunk-ZPHNXJRY.cjs +158 -180
  19. package/dist/index-BD_4rXH-.d.cts +1031 -0
  20. package/dist/{index-Br7pNaf3.d.cts → index-BEnsO2kE.d.ts} +144 -2
  21. package/dist/{index-G906GEtg.d.cts → index-BlNYFaZd.d.cts} +2 -2
  22. package/dist/{index-CghCKUPx.d.ts → index-Cx4-VXVS.d.ts} +2 -2
  23. package/dist/{index-Da_B3eoM.d.ts → index-YSIzfhOd.d.cts} +144 -2
  24. package/dist/index-g9yV20xb.d.ts +1031 -0
  25. package/dist/index.cjs +939 -429
  26. package/dist/index.d.cts +16 -193
  27. package/dist/index.d.ts +16 -193
  28. package/dist/index.js +210 -396
  29. package/dist/interaction.cjs +26 -17
  30. package/dist/interaction.d.cts +2 -2
  31. package/dist/interaction.d.ts +2 -2
  32. package/dist/interaction.js +1 -17
  33. package/dist/parser.cjs +38 -21
  34. package/dist/parser.d.cts +3 -3
  35. package/dist/parser.d.ts +3 -3
  36. package/dist/parser.js +1 -21
  37. package/dist/renderer.cjs +124 -68
  38. package/dist/renderer.d.cts +4 -756
  39. package/dist/renderer.d.ts +4 -756
  40. package/dist/renderer.js +3 -68
  41. package/dist/spec.cjs +94 -49
  42. package/dist/spec.js +1 -49
  43. package/dist/{types-vhPCZpAW.d.cts → types-CGRi1k2N.d.cts} +1 -1
  44. package/dist/{types-vhPCZpAW.d.ts → types-CGRi1k2N.d.ts} +1 -1
  45. package/dist/{v4-types-Baz9yqAS.d.cts → v4-types-2ORUg6To.d.cts} +1 -1
  46. package/dist/{v4-types-Baz9yqAS.d.ts → v4-types-2ORUg6To.d.ts} +1 -1
  47. package/package.json +21 -23
  48. package/dist/chunk-4TMDPWPR.cjs +0 -196
  49. package/dist/chunk-5DGRIQDU.cjs +0 -842
  50. package/dist/chunk-JJWAFHSV.js +0 -842
  51. package/dist/chunk-R5WBZWBC.js +0 -196
  52. package/dist/chunk-WV724EAW.js +0 -0
  53. package/dist/chunk-XENFKHRC.cjs +0 -1
@@ -1,756 +1,4 @@
1
- import { be as WireframeDocument, h as AnyNode, as as PageNode, H as ComponentUseNode, aa as LayoutDefinitionNode, a8 as InteractiveProps, Y as GuardedOutcomeProps } from './types-vhPCZpAW.js';
2
- import { R as RenderContext, b as RenderOptions, f as ThemeConfig, c as RenderResult, A as AnnotationStyle, P as PageRenderResult, C as CanvasOptions, a as CanvasRenderResult, d as SvgRenderOptions, e as SvgRenderResult } from './index-Da_B3eoM.js';
3
- export { S as SiteOptions, T as ThemeColors, g as darkTheme, h as defaultTheme, i as getTheme, r as renderSite } from './index-Da_B3eoM.js';
4
-
5
- /**
6
- * Base HTML Renderer for wireweave
7
- *
8
- * Provides abstract base class for HTML rendering with theme support
9
- */
10
-
11
- /**
12
- * Abstract base renderer class
13
- *
14
- * Provides core infrastructure for HTML rendering:
15
- * - Theme management
16
- * - Indentation and formatting
17
- * - Depth tracking for nested elements
18
- */
19
- declare abstract class BaseRenderer {
20
- protected context: RenderContext;
21
- constructor(options?: RenderOptions);
22
- /**
23
- * Build theme configuration based on options
24
- * Note: background option is NOT applied to theme.colors.background
25
- * It's only used for page background in renderPage() to avoid affecting
26
- * component colors that use var(--wf-bg)
27
- */
28
- protected buildTheme(options: RenderOptions): ThemeConfig;
29
- /**
30
- * Render a wireframe document to HTML and CSS
31
- */
32
- render(document: WireframeDocument): RenderResult;
33
- /**
34
- * Render a complete wireframe document.
35
- *
36
- * Only pages are drawn. A document's top level also holds `layout` and
37
- * `component` definitions, which are reusable fragments a page refers to —
38
- * drawing one would put a screen on the canvas that the author never wrote a
39
- * page for, and would do it the moment the reuse feature was used at all.
40
- */
41
- protected renderDocument(document: WireframeDocument): string;
42
- /**
43
- * Render a page node (to be implemented by subclasses)
44
- */
45
- protected abstract renderPage(node: AnyNode): string;
46
- /**
47
- * Render any AST node (to be implemented by subclasses)
48
- */
49
- protected abstract renderNode(node: AnyNode): string;
50
- /**
51
- * Get the CSS class prefix
52
- */
53
- protected get prefix(): string;
54
- /**
55
- * Add indentation based on current depth
56
- */
57
- protected indent(content: string): string;
58
- /**
59
- * Execute a function with increased depth
60
- */
61
- protected withDepth<T>(fn: () => T): T;
62
- /**
63
- * Escape HTML special characters
64
- */
65
- protected escapeHtml(text: string): string;
66
- /**
67
- * The DOM id an authored id becomes under this render's `idScope`.
68
- *
69
- * One function so that "what is the id in the document" has one answer. A
70
- * renderer that prefixed at some emission sites and not others would produce
71
- * a document where `#confirm` resolves for one element and `#s0-confirm` for
72
- * another, which is worse than either convention alone.
73
- *
74
- * Only identity is prefixed. The interaction attributes that point at an
75
- * overlay still carry the name their author wrote — they are spelled in one
76
- * file (`html/interactive.ts`) and read by whoever consumes them, which
77
- * composes the scope back on. See `RenderOptions.idScope`.
78
- */
79
- protected scopedId(id: string): string;
80
- /**
81
- * Build a CSS class string from an array of class names
82
- */
83
- protected buildClassString(classes: (string | undefined | false)[]): string;
84
- /**
85
- * Build HTML attributes string
86
- */
87
- protected buildAttrsString(attrs: Record<string, string | undefined | boolean>): string;
88
- /**
89
- * Simple HTML minification
90
- */
91
- private minifyHtml;
92
- /**
93
- * Simple CSS minification
94
- */
95
- private minifyCss;
96
- }
97
-
98
- /**
99
- * HTML Renderer for wireweave
100
- *
101
- * Converts AST nodes to HTML output
102
- */
103
-
104
- /**
105
- * HTML Renderer class
106
- *
107
- * Renders wireframe AST to semantic HTML with utility classes
108
- */
109
- declare class HtmlRenderer extends BaseRenderer {
110
- /**
111
- * Node type to renderer method mapping
112
- */
113
- private readonly nodeRenderers;
114
- /**
115
- * Node → anchor-path map for the document currently being rendered. Non-null
116
- * only while rendering with `sourceAnchors` enabled.
117
- */
118
- private pathMap;
119
- /**
120
- * Base index added to page anchor paths. Non-zero when a page is rendered in
121
- * isolation (canvas per-page composition) but must keep its true document
122
- * index in the anchor scheme.
123
- */
124
- private readonly pageIndexBase;
125
- /**
126
- * HTML the next `slot` renders, or `null` when there is none to place.
127
- *
128
- * Set for the duration of one `renderFragment` call and consumed by the first
129
- * slot reached, so it never leaks into an unrelated render.
130
- */
131
- private slotContent;
132
- constructor(options?: RenderOptions, pageIndexBase?: number);
133
- /**
134
- * Render a document, building the anchor-path map first when anchors are
135
- * enabled so `renderNode` / `renderPage` can inject each node's path.
136
- */
137
- render(document: WireframeDocument): RenderResult;
138
- /**
139
- * Get render context for external renderer functions
140
- */
141
- private getRenderContext;
142
- /**
143
- * Get grid render context (extends RenderContext with buildColStyles)
144
- */
145
- private getGridRenderContext;
146
- /**
147
- * Create the node renderer mapping
148
- */
149
- private createNodeRenderers;
150
- /**
151
- * Render a page node
152
- */
153
- protected renderPage(node: PageNode): string;
154
- /**
155
- * Render any AST node
156
- */
157
- protected renderNode(node: AnyNode): string;
158
- /**
159
- * Render the `slot` of a layout — the position a page's content is placed at.
160
- *
161
- * The element is always emitted, filled or not. A layout is a shell, and a
162
- * shell keeps its shape whether or not something is currently inside it;
163
- * collapsing the slot away when empty would make the frame reflow between an
164
- * isolated render of the layout and a composed one.
165
- */
166
- protected renderSlot(): string;
167
- /**
168
- * Render one linked component invocation with its stable instance marker.
169
- *
170
- * The wrapper is identified by `data-` attributes and carries no class. It
171
- * declares `display: contents`, so by construction it has no box of its own
172
- * and its children lay out as though it were not there — which is the whole
173
- * point: an invocation must not disturb the layout of what it expands to.
174
- * A class is the hook a stylesheet paints a box through, and any rule that
175
- * gave this one a box would defeat `display: contents`; there is therefore
176
- * no style it could ever legitimately carry. It emitted
177
- * `${this.prefix}-component-instance` regardless, which no rule in the
178
- * generated CSS defined and nothing read — a class the markup advertises as
179
- * styleable while the stylesheet leaves it undefined. Identity that exists
180
- * to be *queried* rather than *painted* belongs in `data-`, alongside the
181
- * `data-wf-component` / `data-wf-instance` pair already carrying it.
182
- */
183
- protected renderComponentUse(node: ComponentUseNode): string;
184
- /**
185
- * Render a list of nodes with no page frame around them.
186
- *
187
- * The frame — viewport size, background, the CSS reset every component
188
- * depends on — belongs to whatever is composing these nodes. `renderSite`
189
- * uses this twice per shell: once for the layout's own markup, where
190
- * `slotContent` is the screens that live in it, and once per screen for that
191
- * page's body.
192
- *
193
- * @param nodes - Nodes to render, in order
194
- * @param slotContent - HTML placed inside the first `slot` encountered
195
- */
196
- renderFragment(nodes: AnyNode[], slotContent?: string | null): string;
197
- /**
198
- * Render children nodes
199
- */
200
- protected renderChildren(children: AnyNode[]): string;
201
- /**
202
- * Get common CSS classes from props
203
- * Uses Omit to exclude 'align' since TextNode/TitleNode have incompatible align types
204
- *
205
- * All numeric values are handled by buildCommonStyles as inline px values.
206
- * CSS classes are only used for keyword values (full, auto, screen, fit, etc.)
207
- */
208
- private getCommonClasses;
209
- private renderHeader;
210
- private renderMain;
211
- private renderFooter;
212
- private renderSidebar;
213
- private renderSection;
214
- private renderRow;
215
- private renderCol;
216
- private renderStack;
217
- private renderRelative;
218
- /**
219
- * Build common inline styles for all values
220
- *
221
- * Position values (x, y) for absolute positioning:
222
- * - When x or y is specified, element gets position: absolute
223
- * - x → left, y → top
224
- *
225
- * Spacing values (p, m, gap) use token system:
226
- * - number: spacing token (e.g., p=4 → padding: 16px from token table)
227
- * - ValueWithUnit: direct CSS value (e.g., p=16px → padding: 16px)
228
- *
229
- * Size values (w, h, minW, maxW, minH, maxH) use direct px:
230
- * - number: direct px value (e.g., w=400 → width: 400px)
231
- * - ValueWithUnit: direct CSS value (e.g., w=50% → width: 50%)
232
- *
233
- * Token table: 0=0px, 1=4px, 2=8px, 3=12px, 4=16px, 5=20px, 6=24px, 8=32px, etc.
234
- *
235
- * Uses Omit to exclude 'align' since TextNode/TitleNode have incompatible align types
236
- */
237
- private buildCommonStyles;
238
- /**
239
- * Build position styles (absolute positioning)
240
- */
241
- private buildPositionStyles;
242
- /**
243
- * Build size styles (width, height, min/max)
244
- */
245
- private buildSizeStyles;
246
- /**
247
- * Build padding styles (p, px, py, pt, pr, pb, pl)
248
- */
249
- private buildPaddingStyles;
250
- /**
251
- * Build margin styles (m, mx, my, mt, mr, mb, ml)
252
- */
253
- private buildMarginStyles;
254
- /**
255
- * Build gap styles
256
- */
257
- private buildGapStyles;
258
- /**
259
- * Build inline styles for Col node (extends common styles with order)
260
- */
261
- private buildColStyles;
262
- private renderCard;
263
- private renderModal;
264
- private renderDrawer;
265
- private renderAccordion;
266
- private renderText;
267
- private renderTitle;
268
- private renderLink;
269
- private renderInput;
270
- private renderTextarea;
271
- private renderSelect;
272
- private renderCheckbox;
273
- private renderRadio;
274
- private renderSwitch;
275
- private renderSlider;
276
- private renderButton;
277
- private renderImage;
278
- private renderPlaceholder;
279
- private renderAvatar;
280
- private renderBadge;
281
- private renderIcon;
282
- private renderTable;
283
- private renderList;
284
- private renderAlert;
285
- private renderToast;
286
- private renderProgress;
287
- private renderSpinner;
288
- private renderTooltip;
289
- private renderPopover;
290
- private renderDropdown;
291
- private renderNav;
292
- private renderTabs;
293
- private renderBreadcrumb;
294
- private renderDivider;
295
- private renderMarker;
296
- private renderAnnotations;
297
- private renderAnnotationItem;
298
- }
299
- /**
300
- * Create a new HTML renderer instance
301
- */
302
- declare function createHtmlRenderer(options?: RenderOptions): HtmlRenderer;
303
-
304
- /**
305
- * CSS Style Generator for wireweave
306
- *
307
- * Generates CSS classes for grid, spacing, and flex utilities
308
- */
309
-
310
- /**
311
- * Generate all CSS styles for wireframe rendering
312
- *
313
- * @param theme - Theme configuration
314
- * @param prefix - CSS class prefix (default: 'wf')
315
- * @returns Complete CSS string
316
- */
317
- declare function generateStyles(theme: ThemeConfig, prefix?: string, annotationStyle?: AnnotationStyle): string;
318
-
319
- /**
320
- * Component-specific CSS styles for wireweave
321
- *
322
- * Detailed styles for all UI components with:
323
- * - Wireframe aesthetic (black/white/gray)
324
- * - Accessibility considerations
325
- * - Responsive design
326
- */
327
-
328
- /**
329
- * Generate all component-specific CSS styles
330
- */
331
- declare function generateComponentStyles(_theme: ThemeConfig, prefix?: string, annotationStyle?: AnnotationStyle): string;
332
-
333
- /**
334
- * Page renderer — single-Page primitive.
335
- *
336
- * `renderPage` is the *pure* unit of this renderer: its output depends only
337
- * on the page itself, never on sibling pages or canvas-level options. This
338
- * is what export pipelines (1 page = 1 file) consume, and it is also the
339
- * building block `renderCanvas` composes when laying multiple pages out.
340
- */
341
-
342
- /**
343
- * Render a single page to self-contained HTML + CSS.
344
- *
345
- * The page's HTML output is identical to what `render(document)` produces
346
- * for a document containing only this page — we route through `HtmlRenderer`
347
- * so the existing renderer pipeline (themes, prefix, indentation, minify)
348
- * applies uniformly.
349
- */
350
- declare function renderPage(page: PageNode, options?: RenderOptions): PageRenderResult;
351
- /**
352
- * Resolve a page's pixel dimensions from explicit `w`/`h` or viewport/device.
353
- *
354
- * Mirrors the precedence used inside `HtmlRenderer.renderPage`:
355
- * 1. Explicit numeric `w` and `h` both set → use them.
356
- * 2. Otherwise resolve via viewport string / device preset.
357
- *
358
- * Non-numeric `w`/`h` (e.g. keyword `'full'` or `ValueWithUnit`) fall through
359
- * to the viewport — those are layout-internal hints, not canvas dimensions.
360
- */
361
- declare function resolvePageDimensions(page: PageNode): {
362
- width: number;
363
- height: number;
364
- };
365
-
366
- /**
367
- * Canvas renderer — multi-page composition.
368
- *
369
- * `renderCanvas` lays out one or more pages on a single bounded canvas. The
370
- * DSL stays page-centric — coordinates come from each page's optional
371
- * `at(x, y)` attribute (resolved into `Page.x` / `Page.y` by the parser).
372
- * Pages without coordinates auto-flow horizontally with `gap` between them.
373
- *
374
- * Output is intentionally minimal: a bounded `<div class="wf-canvas">` of the
375
- * exact layout extent, containing absolutely-positioned `<div class="wf-canvas-board">`
376
- * wrappers around each page's HTML. No chrome, no decoration, no grid, no
377
- * labels. Hosts (dashboard editor, markdown plugin, VSCode preview) wrap this
378
- * output in their own viewport / grid / pan-zoom layers.
379
- *
380
- * `layoutCanvas` is exposed as a pure utility so hosts that want to compose
381
- * the canvas DOM themselves can reuse the placement math.
382
- */
383
-
384
- interface PlacedPage {
385
- page: PageNode;
386
- x: number;
387
- y: number;
388
- w: number;
389
- h: number;
390
- }
391
- /**
392
- * Compute each page's position on the canvas and the bounding canvas size.
393
- *
394
- * Per-page mode:
395
- * - `Page.x` / `Page.y` set → placed at exactly those coordinates.
396
- * - Either missing → auto-flow: continues from the running cursor in a
397
- * single horizontal row, advancing by `width + gap` after each
398
- * auto-placed page. The cursor is unaffected by explicitly-placed pages.
399
- *
400
- * Mixed documents are allowed (ux-rules will warn) but explicit pages may
401
- * overlap auto pages — that is the author's responsibility.
402
- */
403
- declare function layoutCanvas(pages: PageNode[], gap?: number): {
404
- placed: PlacedPage[];
405
- width: number;
406
- height: number;
407
- };
408
- /**
409
- * Render a multi-page document to a single bounded canvas of HTML + CSS.
410
- *
411
- * Output: `<div class="wf-canvas" style="width:Wpx; height:Hpx; position:relative">`
412
- * containing one `<div class="wf-canvas-board">` per page, absolutely
413
- * positioned at the layout coordinates.
414
- */
415
- declare function renderCanvas(doc: WireframeDocument, options?: CanvasOptions): CanvasRenderResult;
416
-
417
- /**
418
- * The screen model behind `renderSite` — which pages become screens, which
419
- * shell each one is drawn inside, and what names address it.
420
- *
421
- * Nothing here renders. It answers three questions the site renderer and its
422
- * inline runtime both need the *same* answer to, so the answer is computed once
423
- * and handed to both.
424
- *
425
- * ## Totality
426
- *
427
- * A wireframe document can name a layout that does not exist, declare two pages
428
- * with the same `id`, or use a layout with no `slot`. None of those is a parse
429
- * error (see the note on `WireframeDocument`), so none of them may stop a
430
- * render either: every function here is total. Where a document is ambiguous
431
- * the rule is always **first-wins in document order** — the same rule
432
- * `extract/transitions.ts` already applies to titles — and the loser is not
433
- * dropped silently: it is rendered with a `data-wf-*` marker naming what went
434
- * unmet, so a reader of the output can see it and `validation/` can report it
435
- * with a source location.
436
- */
437
-
438
- /** Why a page that declared `uses=` is not composed into a shell after all. */
439
- type ShellMiss =
440
- /** No `layout` in the document carries that name. */
441
- 'unknown-layout'
442
- /** The layout exists but has no `slot`, so it has nowhere to put a page. */
443
- | 'slotless-layout';
444
- /** One page, as a screen of the composed document. */
445
- interface SiteScreen {
446
- /** Position in `documentPages(doc)`. This is the screen's DOM key. */
447
- index: number;
448
- page: PageNode;
449
- /**
450
- * The variant this screen draws, when its page came from a `variants=` list.
451
- *
452
- * Read off the page rather than derived here: `expandVariants` has already
453
- * turned one variant-bearing page into one page per variant by the time a
454
- * model is built, so each of those pages is a screen like any other and this
455
- * only records which one it is.
456
- */
457
- variant?: string;
458
- /** Name of the shell this screen is composed into, when it has one. */
459
- shell?: string;
460
- /** Set when `uses=` was declared and could not be honoured. */
461
- miss?: {
462
- uses: string;
463
- reason: ShellMiss;
464
- };
465
- /**
466
- * The public name this screen *owns* — the name that resolves to it.
467
- *
468
- * Absent when the page declared no name, and also when every name it declared
469
- * is already owned by an earlier page. A screen without a name is still
470
- * reachable: its index addresses it.
471
- */
472
- name?: string;
473
- }
474
- /** One layout, emitted once, hosting every screen that uses it. */
475
- interface SiteShell {
476
- /** The `layout <name>` identifier, which `uses=` addresses. */
477
- name: string;
478
- layout: LayoutDefinitionNode;
479
- /** Screens composed into this shell, in document order. */
480
- screens: SiteScreen[];
481
- /**
482
- * Frame size of the shell, resolved from its first screen's page.
483
- *
484
- * A layout has no viewport of its own — it is the pages that declare one — so
485
- * the first page to use it fixes the frame. A later page resolving to a
486
- * different size is a conflict the author has to settle; it is marked on that
487
- * screen rather than resized, because silently stretching one page's frame to
488
- * another's is the kind of change that is invisible until a screenshot.
489
- */
490
- width: number;
491
- height: number;
492
- }
493
- interface SiteModel {
494
- screens: SiteScreen[];
495
- /** Shells in first-use order — the order pages first reference them. */
496
- shells: SiteShell[];
497
- /**
498
- * Every name that addresses a screen → that screen's index.
499
- *
500
- * Built exactly like `extract/transitions.ts` resolves `navigate`: the `id`
501
- * namespace is consulted before the `title` namespace, and within each
502
- * namespace the first page in document order wins. A `navigate` target and a
503
- * URL fragment therefore land on the same screen the transition graph says
504
- * they do — one resolution rule, two consumers.
505
- */
506
- names: Map<string, number>;
507
- /** Screen shown when no fragment selects one. `-1` for a document with no pages. */
508
- entry: number;
509
- }
510
- /**
511
- * Derive the screen model of a document.
512
- *
513
- * Pure and deterministic: same document in, same model out, whatever the
514
- * document contains.
515
- */
516
- declare function buildSiteModel(doc: WireframeDocument): SiteModel;
517
-
518
- /**
519
- * Interaction intent → HTML attributes.
520
- *
521
- * `navigate` / `opens` / `toggles` / `action` are the declared interaction
522
- * intent of a wireframe element (see {@link InteractiveProps}). They are the
523
- * only structural link between screens, so every consumer of rendered
524
- * output — the studio runtime, the transition graph, a prototype harness —
525
- * finds them by these four `data-*` names.
526
- *
527
- * This module is their single owner. The attribute names are written down
528
- * exactly once, here; renderers ask for the record and never spell the names
529
- * themselves. Before this existed the block was copy-pasted into five
530
- * renderers, and the sixth (`navigation.ts`) simply never got a copy — nav,
531
- * tab and breadcrumb items parsed their interaction intent and then dropped it
532
- * on the floor, which is the failure mode this module exists to make
533
- * impossible to repeat.
534
- *
535
- * `__tests__/renderer-interactive.test.ts` enforces the single-owner property:
536
- * it fails if any other file under `src/renderer/` spells one of these names.
537
- */
538
-
539
- /** The `data-*` attribute name carrying each interaction kind. */
540
- declare const INTERACTIVE_ATTR_NAMES: readonly ["data-navigate", "data-opens", "data-toggles", "data-action"];
541
- /** Internal: the shape of {@link InteractiveAttrs}'s keys. Consumers use that. */
542
- type InteractiveAttrName = (typeof INTERACTIVE_ATTR_NAMES)[number];
543
- /**
544
- * Marks a `data-navigate` whose target is a URL rather than a page name.
545
- *
546
- * Only elements that are not anchors ever carry it: an anchor puts a URL in its
547
- * `href` and emits no `data-navigate` at all, so there is nothing left to
548
- * qualify. A button or a current-page `<span>` has no `href` to move the target
549
- * into, so the URL travels in the data attribute — and without this marker every
550
- * consumer would have to re-derive, from the string, the thing the renderer
551
- * already worked out.
552
- *
553
- * That re-derivation is the point. {@link isUrlTarget} is a TypeScript predicate;
554
- * the site runtime is generated JavaScript. A second copy of the rule over there
555
- * is a drift surface by construction, and the two copies disagreeing means the
556
- * runtime starts hunting for a screen named `https://…`. So the judgment is made
557
- * once, here, at render time, and shipped as a fact the runtime only reads.
558
- *
559
- * The single-owner gate in `__tests__/renderer-interactive.test.ts` covers this
560
- * name for free: it contains `data-navigate`, so any other file under
561
- * `src/renderer/` that spells it is already an offender.
562
- */
563
- declare const EXTERNAL_NAVIGATE_ATTR = "data-navigate-external";
564
- /** Typed runtime markers, owned beside the legacy interaction attributes. */
565
- declare const TYPED_INTERACTION_ATTR = "data-wf-on";
566
- declare const VISIBLE_GUARD_ATTR = "data-wf-visible-when";
567
- declare const ENABLED_GUARD_ATTR = "data-wf-enabled-when";
568
- /**
569
- * The `href` an anchor gets when it has no destination of its own.
570
- *
571
- * An anchor must have an `href` to be a link — focusable, keyboard-activatable,
572
- * announced as a link — but a wireframe anchor usually has nowhere to go: its
573
- * intent, if any, travels as `data-navigate` and names a screen, not a URL.
574
- * `#` is the standard inert stand-in, and it is a *statement by the renderer*:
575
- * this element's `href` carries no destination.
576
- *
577
- * It is exported because the site runtime needs to read that statement back.
578
- * The browser's default action for `#` is a same-document navigation, and inside
579
- * the `srcdoc` frame consumers mount the wireframe in, `#` resolves against the
580
- * *embedder's* URL — so an unhandled click walks the frame out of the wireframe
581
- * and loads the host app inside it. Measured on a 20-screen demo: 44 such
582
- * anchors, frame URL `about:srcdoc` → `<host page>#`, host assets refetched.
583
- *
584
- * The runtime must therefore distinguish "inert" from "a real link the author
585
- * asked for", and re-deriving that from the string over there is the drift
586
- * surface {@link EXTERNAL_NAVIGATE_ATTR} exists to avoid. So the value is owned
587
- * here and embedded into the generated script, like the attribute names.
588
- */
589
- declare const INERT_HREF = "#";
590
- /**
591
- * Attribute record for one element; absent intents stay `undefined`.
592
- *
593
- * The marker is boolean because it carries no value of its own — it qualifies
594
- * the target next to it. `buildAttrsString` renders `true` as `name="name"`,
595
- * which is the form that survives the XML parsing of an SVG `foreignObject`.
596
- */
597
- type InteractiveAttrs = Record<InteractiveAttrName, string | undefined> & Record<typeof EXTERNAL_NAVIGATE_ATTR, true | undefined> & Record<typeof TYPED_INTERACTION_ATTR | typeof VISIBLE_GUARD_ATTR | typeof ENABLED_GUARD_ATTR, string | undefined>;
598
- /** Guard attributes accepted by ordinary nodes that do not carry events. */
599
- declare function guardedOutcomeAttrs(node: Partial<GuardedOutcomeProps>): Record<typeof VISIBLE_GUARD_ATTR | typeof ENABLED_GUARD_ATTR, string | undefined>;
600
- /**
601
- * The interaction attributes of any node carrying {@link InteractiveProps}.
602
- *
603
- * The result is spread into a renderer's attribute record, or passed straight
604
- * to `buildAttrsString` — which drops `undefined` entries, so an element with
605
- * no declared intent emits nothing at all.
606
- *
607
- * Emission order is fixed (navigate, opens, toggles, action) so that rendered
608
- * HTML stays byte-stable across runs; the marker sits next to the target it
609
- * qualifies.
610
- */
611
- declare function interactiveAttrs(node: Partial<InteractiveProps>): InteractiveAttrs;
612
- /**
613
- * The `href` and interaction attributes of an element rendered as an `<a>`.
614
- *
615
- * An anchor is the one element with two channels that can carry a destination,
616
- * so it is the one element where they can contradict each other — and it is the
617
- * only place the choice between them has to be made. Both halves of that choice
618
- * are decided here so a renderer never has to know the rule:
619
- *
620
- * - An authored `href` is the anchor and is left exactly as written.
621
- * - Otherwise a URL-shaped `navigate` (see {@link isUrlTarget}) becomes the
622
- * `href`, and no `data-navigate` goes out beside it. A URL is not a screen:
623
- * emitting both would hand a consumer two destinations for one element and
624
- * send a runtime hunting for a screen named `https://…`.
625
- * - Otherwise the `navigate` target names a page. The anchor stays inert `#` —
626
- * `href="교환소 지도"` is a broken relative link — and the intent travels as
627
- * `data-navigate` for the consumer that knows what pages are.
628
- *
629
- * When an `href` *and* a URL-shaped `navigate` are both authored, both are
630
- * emitted unchanged: the element already has its destination, and quietly
631
- * dropping the second one would hide a contradiction only the author can settle.
632
- * Naming that conflict belongs to validation, not to rendering.
633
- *
634
- * Elements that are not anchors keep {@link interactiveAttrs}: with no `href` to
635
- * move it into, a URL-shaped target has only the data attribute to travel in,
636
- * and dropping it there would discard what the author wrote. Those are the
637
- * elements {@link EXTERNAL_NAVIGATE_ATTR} exists for.
638
- */
639
- declare function anchorIntent(node: Partial<InteractiveProps> & {
640
- href?: string;
641
- }): {
642
- href: string;
643
- attrs: InteractiveAttrs;
644
- };
645
-
646
- /**
647
- * GENERATED FILE -- DO NOT EDIT.
648
- *
649
- * The icon dataset, generated from the installed `lucide` package by
650
- * `scripts/generate-icons.mjs` (`pnpm build:icons`). Names kept beyond what
651
- * lucide ships come from `scripts/icon-overrides.mjs`; add them there, never
652
- * here, or the next regeneration deletes them.
653
- *
654
- * Total icons: 1667
655
- *
656
- * The lookup, alias and rendering code that consumes this lives in
657
- * `./lucide-icons.ts` and is hand-written.
658
- *
659
- * @license ISC License
660
- *
661
- * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2023
662
- * as part of Feather (MIT). All other copyright (c) for Lucide are held
663
- * by Lucide Contributors 2025.
664
- *
665
- * Permission to use, copy, modify, and/or distribute this software for any
666
- * purpose with or without fee is hereby granted, provided that the above
667
- * copyright notice and this permission notice appear in all copies.
668
- *
669
- * @see https://lucide.dev
670
- */
671
- type IconElement = [string, Record<string, string>];
672
- type IconData = IconElement[];
673
- declare const lucideIcons: Record<string, IconData>;
674
-
675
- /**
676
- * Icon lookup and SVG rendering.
677
- *
678
- * HAND-WRITTEN. The dataset this reads is generated -- see
679
- * `./lucide-icons.generated.ts` and `scripts/generate-icons.mjs`. The two were
680
- * a single file until the split: it carried an "Auto-generated ... Do not edit
681
- * manually" header while the alias table, the alias branches in `getIconData`,
682
- * the `renderIconSvg` signature and all of `renderUnknownIconSvg` below were
683
- * added by hand, so running the generator would have destroyed working code
684
- * that four renderers import. Data and code now have one owner each.
685
- *
686
- * The dataset's exports are re-exported here so `src/index.ts` can keep
687
- * re-exporting this module and the public surface is unchanged.
688
- */
689
-
690
- /**
691
- * Get icon data by name.
692
- *
693
- * Resolution order is exact key, then alias, then camelCase folded to
694
- * kebab-case, then that folded name through the aliases. A name that survives
695
- * all four is not drawable, and the caller renders the placeholder below.
696
- */
697
- declare function getIconData(name: string): IconData | undefined;
698
- /**
699
- * Render icon data to SVG string
700
- */
701
- declare function renderIconSvg(data: IconData, _size?: number, // size is now controlled by CSS, this param is kept for API compatibility
702
- strokeWidth?: number, className?: string, styleAttr?: string): string;
703
- /**
704
- * Render the canonical "unknown icon" placeholder SVG — a dashed circle with a
705
- * `?` glyph. Shared by every renderer (icon node, button, input) so an
706
- * unresolved icon name always produces the SAME visual placeholder and never
707
- * leaks the raw DSL name as literal text. Callers add a
708
- * `title="Unknown icon: <name>"` on the wrapping element for hover context.
709
- */
710
- declare function renderUnknownIconSvg(className?: string, size?: number, styleAttr?: string): string;
711
-
712
- /**
713
- * Renderer module for wireweave
714
- *
715
- * Provides render functions to convert AST to HTML/CSS and SVG
716
- */
717
-
718
- /**
719
- * Render AST to HTML and CSS.
720
- *
721
- * Two modes, decided automatically by page count:
722
- * 1. Multiple pages → canvas mode (bounded layout, absolutely-positioned
723
- * boards). Hosts wrap this in their own viewport / grid / pan-zoom layer.
724
- * 2. Single page → legacy mode (page only, no canvas wrapper) for
725
- * backward compatibility with single-page consumers (markdown-plugin,
726
- * dashboard previews, vscode-extension).
727
- *
728
- * Use `renderPage(page)` for explicit single-page export, or
729
- * `renderCanvas(doc)` for explicit multi-page composition.
730
- */
731
- declare function render(document: WireframeDocument, options?: RenderOptions | CanvasOptions): RenderResult;
732
- /**
733
- * Render AST to standalone HTML with embedded CSS
734
- *
735
- * @param document - Parsed wireframe document
736
- * @param options - Render options
737
- * @returns Complete HTML document string
738
- */
739
- declare function renderToHtml(document: WireframeDocument, options?: RenderOptions): string;
740
- /**
741
- * Render AST to SVG using foreignObject with HTML+CSS
742
- *
743
- * This approach embeds HTML+CSS inside SVG using foreignObject,
744
- * which allows CSS flexbox/grid layouts to work properly.
745
- *
746
- * Multi-page documents are auto-rendered as a bounded canvas, with the
747
- * SVG viewBox sized to the canvas bounding box. Single-page documents
748
- * keep their legacy single-page sizing.
749
- *
750
- * @param document - Parsed wireframe document
751
- * @param options - SVG render options
752
- * @returns Object containing SVG string and dimensions
753
- */
754
- declare function renderToSvg(document: WireframeDocument, options?: SvgRenderOptions): SvgRenderResult;
755
-
756
- export { AnnotationStyle, CanvasOptions, CanvasRenderResult, ENABLED_GUARD_ATTR, EXTERNAL_NAVIGATE_ATTR, HtmlRenderer, INERT_HREF, INTERACTIVE_ATTR_NAMES, type IconData, type IconElement, type InteractiveAttrs, PageRenderResult, type PlacedPage, RenderContext, RenderOptions, RenderResult, type ShellMiss, type SiteModel, type SiteScreen, type SiteShell, SvgRenderOptions, SvgRenderResult, TYPED_INTERACTION_ATTR, ThemeConfig, VISIBLE_GUARD_ATTR, anchorIntent, buildSiteModel, createHtmlRenderer, generateComponentStyles, generateStyles, getIconData, guardedOutcomeAttrs, interactiveAttrs, layoutCanvas, lucideIcons, render, renderCanvas, renderIconSvg, renderPage, renderToHtml, renderToSvg, renderUnknownIconSvg, resolvePageDimensions };
1
+ import './types-CGRi1k2N.js';
2
+ export { e as AnnotationStyle, C as CanvasOptions, f as CanvasRenderResult, P as PageRenderResult, R as RenderContext, c as RenderOptions, d as RenderResult, i as SiteOptions, g as SvgRenderOptions, h as SvgRenderResult, j as ThemeColors, T as ThemeConfig, k as darkTheme, l as defaultTheme, m as getTheme, r as renderSite } from './index-BEnsO2kE.js';
3
+ export { e as ENABLED_GUARD_ATTR, f as EXTERNAL_NAVIGATE_ATTR, H as HtmlRenderer, I as INERT_HREF, x as INTERACTIVE_ATTR_NAMES, y as IconData, z as IconElement, A as InteractiveAttrs, P as PlacedPage, S as ShellMiss, B as SiteModel, D as SiteScreen, G as SiteShell, T as TYPED_INTERACTION_ATTR, O as VISIBLE_GUARD_ATTR, Q as anchorIntent, R as buildSiteModel, U as createHtmlRenderer, W as generateComponentStyles, X as generateStyles, Y as getIconData, Z as guardedOutcomeAttrs, _ as interactiveAttrs, $ as layoutCanvas, a0 as lucideIcons, a1 as render, a2 as renderCanvas, a3 as renderIconSvg, a4 as renderPage, a5 as renderToHtml, a6 as renderToSvg, a7 as renderUnknownIconSvg, a8 as resolvePageDimensions } from './index-g9yV20xb.js';
4
+ import './v4-types-2ORUg6To.js';