@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.
- package/dist/index.cjs +169 -72
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +168 -72
- package/dist/parser.d.cts +1 -1
- package/dist/parser.d.ts +1 -1
- package/dist/renderer.cjs +135 -17
- package/dist/renderer.d.cts +33 -3
- package/dist/renderer.d.ts +33 -3
- package/dist/renderer.js +134 -17
- package/dist/{types-C1kQ4VAF.d.cts → types-BDbXDhTp.d.cts} +13 -0
- package/dist/{types-C1kQ4VAF.d.ts → types-BDbXDhTp.d.ts} +13 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -142,6 +142,7 @@ __export(src_exports, {
|
|
|
142
142
|
renderPage: () => renderPage,
|
|
143
143
|
renderToHtml: () => renderToHtml,
|
|
144
144
|
renderToSvg: () => renderToSvg,
|
|
145
|
+
renderUnknownIconSvg: () => renderUnknownIconSvg,
|
|
145
146
|
resetFigmaIdCounter: () => resetFigmaIdCounter,
|
|
146
147
|
resolveAnchor: () => resolveAnchor,
|
|
147
148
|
resolvePageDimensions: () => resolvePageDimensions,
|
|
@@ -7626,8 +7627,14 @@ function generateContainerStyles(prefix) {
|
|
|
7626
7627
|
font-weight: 600;
|
|
7627
7628
|
}
|
|
7628
7629
|
|
|
7630
|
+
/* Board-scoped: absolute (not fixed) so the drawer pins to its own page /
|
|
7631
|
+
canvas board \u2014 the nearest positioned ancestor (.wf-page is position:relative,
|
|
7632
|
+
.wf-canvas-board is position:absolute) \u2014 instead of the browser viewport.
|
|
7633
|
+
Matches the modal backdrop's scoping and keeps the fixed-layout invariant:
|
|
7634
|
+
with position:fixed a drawer in a multi-page canvas escapes to the viewport
|
|
7635
|
+
top-left, overlapping other boards (see no-responsive.md). */
|
|
7629
7636
|
.${prefix}-drawer {
|
|
7630
|
-
position:
|
|
7637
|
+
position: absolute;
|
|
7631
7638
|
background: var(--${prefix}-bg);
|
|
7632
7639
|
border: 1px solid var(--${prefix}-border);
|
|
7633
7640
|
box-shadow: var(--${prefix}-shadow-xl);
|
|
@@ -9456,7 +9463,8 @@ var DEFAULT_OPTIONS = {
|
|
|
9456
9463
|
scale: 1,
|
|
9457
9464
|
includeStyles: true,
|
|
9458
9465
|
minify: false,
|
|
9459
|
-
classPrefix: "wf"
|
|
9466
|
+
classPrefix: "wf",
|
|
9467
|
+
sourceAnchors: false
|
|
9460
9468
|
};
|
|
9461
9469
|
var BaseRenderer = class {
|
|
9462
9470
|
context;
|
|
@@ -9656,6 +9664,68 @@ ${html}
|
|
|
9656
9664
|
</div>`;
|
|
9657
9665
|
}
|
|
9658
9666
|
|
|
9667
|
+
// src/ast/anchor-path.ts
|
|
9668
|
+
var ANCHOR_PATH_ATTR = "data-wf-path";
|
|
9669
|
+
var ANCHOR_LOC_ATTR = "data-wf-loc";
|
|
9670
|
+
var ANCHOR_CONTAINER_TYPES = /* @__PURE__ */ new Set([
|
|
9671
|
+
"Page",
|
|
9672
|
+
"Header",
|
|
9673
|
+
"Main",
|
|
9674
|
+
"Footer",
|
|
9675
|
+
"Sidebar",
|
|
9676
|
+
"Section",
|
|
9677
|
+
"Row",
|
|
9678
|
+
"Col",
|
|
9679
|
+
"Stack",
|
|
9680
|
+
"Relative",
|
|
9681
|
+
"Card",
|
|
9682
|
+
"Modal",
|
|
9683
|
+
"Drawer",
|
|
9684
|
+
"Accordion",
|
|
9685
|
+
"Tooltip",
|
|
9686
|
+
"Popover"
|
|
9687
|
+
]);
|
|
9688
|
+
function anchorChildNodes(node) {
|
|
9689
|
+
if (!ANCHOR_CONTAINER_TYPES.has(node.type)) return [];
|
|
9690
|
+
const children = node.children;
|
|
9691
|
+
return Array.isArray(children) ? children : [];
|
|
9692
|
+
}
|
|
9693
|
+
function formatAnchorLoc(loc) {
|
|
9694
|
+
return `${loc.start.offset}-${loc.end.offset}`;
|
|
9695
|
+
}
|
|
9696
|
+
function walkAnchorPaths(doc, visit, pageIndexBase = 0) {
|
|
9697
|
+
doc.children.forEach((page, i) => {
|
|
9698
|
+
visitAnchorNode(page, String(pageIndexBase + i), visit);
|
|
9699
|
+
});
|
|
9700
|
+
}
|
|
9701
|
+
function visitAnchorNode(node, path, visit) {
|
|
9702
|
+
visit(node, path);
|
|
9703
|
+
anchorChildNodes(node).forEach((child, i) => {
|
|
9704
|
+
visitAnchorNode(child, `${path}.${i}`, visit);
|
|
9705
|
+
});
|
|
9706
|
+
}
|
|
9707
|
+
function buildAnchorPathMap(doc, pageIndexBase = 0) {
|
|
9708
|
+
const map = /* @__PURE__ */ new Map();
|
|
9709
|
+
walkAnchorPaths(doc, (node, path) => map.set(node, path), pageIndexBase);
|
|
9710
|
+
return map;
|
|
9711
|
+
}
|
|
9712
|
+
function resolveAnchorPath(doc, path, pageIndexBase = 0) {
|
|
9713
|
+
if (!path) return void 0;
|
|
9714
|
+
const segments = path.split(".");
|
|
9715
|
+
const indices = [];
|
|
9716
|
+
for (const segment of segments) {
|
|
9717
|
+
if (!/^\d+$/.test(segment)) return void 0;
|
|
9718
|
+
indices.push(Number(segment));
|
|
9719
|
+
}
|
|
9720
|
+
const [pageSegment, ...childSegments] = indices;
|
|
9721
|
+
let node = doc.children[pageSegment - pageIndexBase];
|
|
9722
|
+
for (const childIndex of childSegments) {
|
|
9723
|
+
if (!node) return void 0;
|
|
9724
|
+
node = anchorChildNodes(node)[childIndex];
|
|
9725
|
+
}
|
|
9726
|
+
return node;
|
|
9727
|
+
}
|
|
9728
|
+
|
|
9659
9729
|
// src/renderer/html/components.ts
|
|
9660
9730
|
function buildClassString(classes) {
|
|
9661
9731
|
return classes.filter(Boolean).join(" ");
|
|
@@ -56362,8 +56432,13 @@ var iconAliases = {
|
|
|
56362
56432
|
close: "x",
|
|
56363
56433
|
menu: "menu",
|
|
56364
56434
|
hamburger: "menu",
|
|
56365
|
-
|
|
56366
|
-
|
|
56435
|
+
// Lucide renamed the overflow/kebab-menu glyphs to `ellipsis` /
|
|
56436
|
+
// `ellipsis-vertical`; map the legacy `more-*` names (and the `dots-*`
|
|
56437
|
+
// shorthands) onto the real keys so none of them dead-end.
|
|
56438
|
+
"more-horizontal": "ellipsis",
|
|
56439
|
+
"more-vertical": "ellipsis-vertical",
|
|
56440
|
+
dots: "ellipsis",
|
|
56441
|
+
"dots-vertical": "ellipsis-vertical",
|
|
56367
56442
|
cog: "settings",
|
|
56368
56443
|
gear: "settings"
|
|
56369
56444
|
};
|
|
@@ -56390,6 +56465,12 @@ function renderIconSvg(data, _size = 24, strokeWidth = 2, className = "", styleA
|
|
|
56390
56465
|
}).join("");
|
|
56391
56466
|
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>`;
|
|
56392
56467
|
}
|
|
56468
|
+
function renderUnknownIconSvg(className = "", size = 24, styleAttr = "") {
|
|
56469
|
+
return `<svg class="${className}" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"${styleAttr}>
|
|
56470
|
+
<circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" stroke-dasharray="4 2" fill="none" opacity="0.5"/>
|
|
56471
|
+
<text x="12" y="16" text-anchor="middle" font-size="10" fill="currentColor" opacity="0.7">?</text>
|
|
56472
|
+
</svg>`;
|
|
56473
|
+
}
|
|
56393
56474
|
|
|
56394
56475
|
// src/renderer/html/renderers/button.ts
|
|
56395
56476
|
function renderButton(node, ctx) {
|
|
@@ -56412,9 +56493,12 @@ function renderButton(node, ctx) {
|
|
|
56412
56493
|
const sizeStyle = sizeResolved.style || "";
|
|
56413
56494
|
const combinedStyles = baseStyles && sizeStyle ? `${baseStyles}; ${sizeStyle}` : baseStyles || sizeStyle;
|
|
56414
56495
|
const styleAttr = combinedStyles ? ` style="${combinedStyles}"` : "";
|
|
56496
|
+
const accessibleName = node.aria ?? node["aria-label"];
|
|
56415
56497
|
const attrs = {
|
|
56416
56498
|
class: classes,
|
|
56417
56499
|
disabled: node.disabled,
|
|
56500
|
+
"aria-label": accessibleName,
|
|
56501
|
+
title: node.title,
|
|
56418
56502
|
// Interactive attributes
|
|
56419
56503
|
"data-navigate": node.navigate,
|
|
56420
56504
|
"data-opens": node.opens,
|
|
@@ -56427,7 +56511,7 @@ function renderButton(node, ctx) {
|
|
|
56427
56511
|
if (iconData) {
|
|
56428
56512
|
icon = renderIconSvg(iconData, 16, 2, `${ctx.prefix}-icon`);
|
|
56429
56513
|
} else {
|
|
56430
|
-
icon = `<span class="${ctx.prefix}-icon"
|
|
56514
|
+
icon = `<span class="${ctx.prefix}-icon" title="Unknown icon: ${ctx.escapeHtml(node.icon)}">${renderUnknownIconSvg(`${ctx.prefix}-icon`, 16)}</span>`;
|
|
56431
56515
|
}
|
|
56432
56516
|
}
|
|
56433
56517
|
const loading = node.loading ? `<span class="${ctx.prefix}-spinner ${ctx.prefix}-spinner-sm"></span>` : "";
|
|
@@ -56511,7 +56595,7 @@ function renderInput(node, ctx) {
|
|
|
56511
56595
|
if (iconData) {
|
|
56512
56596
|
iconHtml = renderIconSvg(iconData, 16, 2, `${ctx.prefix}-input-icon`);
|
|
56513
56597
|
} else {
|
|
56514
|
-
iconHtml = `<span class="${ctx.prefix}-input-icon"
|
|
56598
|
+
iconHtml = `<span class="${ctx.prefix}-input-icon" title="Unknown icon: ${ctx.escapeHtml(node.icon)}">${renderUnknownIconSvg(`${ctx.prefix}-input-icon`, 16)}</span>`;
|
|
56515
56599
|
}
|
|
56516
56600
|
const wrapperClasses = ctx.buildClassString([`${ctx.prefix}-input-wrapper`]);
|
|
56517
56601
|
const wrapper = `<div class="${wrapperClasses}"${styleAttr}>${iconHtml}${inputElement}</div>`;
|
|
@@ -56776,10 +56860,10 @@ function renderIcon(node, ctx) {
|
|
|
56776
56860
|
}
|
|
56777
56861
|
const size = sizeResolved.style?.match(/(\d+)px/)?.[1] || "24";
|
|
56778
56862
|
const sizeNum = parseInt(size, 10);
|
|
56779
|
-
const placeholderSvg =
|
|
56780
|
-
|
|
56781
|
-
|
|
56782
|
-
|
|
56863
|
+
const placeholderSvg = renderUnknownIconSvg(
|
|
56864
|
+
`${ctx.prefix}-icon ${sizeResolved.className || ""}`,
|
|
56865
|
+
sizeNum
|
|
56866
|
+
);
|
|
56783
56867
|
const wrapperStyleAttr = baseStyles ? ` style="${baseStyles}"` : "";
|
|
56784
56868
|
return `<span class="${wrapperClasses}"${wrapperStyleAttr}${interactiveAttrStr} aria-hidden="true" title="Unknown icon: ${ctx.escapeHtml(node.name)}">${placeholderSvg}</span>`;
|
|
56785
56869
|
}
|
|
@@ -57184,6 +57268,10 @@ function renderAnnotationItem(node, ctx) {
|
|
|
57184
57268
|
}
|
|
57185
57269
|
|
|
57186
57270
|
// src/renderer/html/index.ts
|
|
57271
|
+
function injectAnchorAttrs(html, path, loc) {
|
|
57272
|
+
const attrs = loc ? ` ${ANCHOR_PATH_ATTR}="${path}" ${ANCHOR_LOC_ATTR}="${formatAnchorLoc(loc)}"` : ` ${ANCHOR_PATH_ATTR}="${path}"`;
|
|
57273
|
+
return html.replace(/<([a-zA-Z][a-zA-Z0-9-]*)/, (match) => `${match}${attrs}`);
|
|
57274
|
+
}
|
|
57187
57275
|
var SPACING_TOKENS = {
|
|
57188
57276
|
0: "0px",
|
|
57189
57277
|
1: "4px",
|
|
@@ -57226,10 +57314,36 @@ var HtmlRenderer = class extends BaseRenderer {
|
|
|
57226
57314
|
* Node type to renderer method mapping
|
|
57227
57315
|
*/
|
|
57228
57316
|
nodeRenderers;
|
|
57229
|
-
|
|
57317
|
+
/**
|
|
57318
|
+
* Node → anchor-path map for the document currently being rendered. Non-null
|
|
57319
|
+
* only while rendering with `sourceAnchors` enabled.
|
|
57320
|
+
*/
|
|
57321
|
+
pathMap = null;
|
|
57322
|
+
/**
|
|
57323
|
+
* Base index added to page anchor paths. Non-zero when a page is rendered in
|
|
57324
|
+
* isolation (canvas per-page composition) but must keep its true document
|
|
57325
|
+
* index in the anchor scheme.
|
|
57326
|
+
*/
|
|
57327
|
+
pageIndexBase;
|
|
57328
|
+
constructor(options = {}, pageIndexBase = 0) {
|
|
57230
57329
|
super(options);
|
|
57330
|
+
this.pageIndexBase = pageIndexBase;
|
|
57231
57331
|
this.nodeRenderers = this.createNodeRenderers();
|
|
57232
57332
|
}
|
|
57333
|
+
/**
|
|
57334
|
+
* Render a document, building the anchor-path map first when anchors are
|
|
57335
|
+
* enabled so `renderNode` / `renderPage` can inject each node's path.
|
|
57336
|
+
*/
|
|
57337
|
+
render(document) {
|
|
57338
|
+
if (this.context.options.sourceAnchors) {
|
|
57339
|
+
this.pathMap = buildAnchorPathMap(document, this.pageIndexBase);
|
|
57340
|
+
}
|
|
57341
|
+
try {
|
|
57342
|
+
return super.render(document);
|
|
57343
|
+
} finally {
|
|
57344
|
+
this.pathMap = null;
|
|
57345
|
+
}
|
|
57346
|
+
}
|
|
57233
57347
|
/**
|
|
57234
57348
|
* Get render context for external renderer functions
|
|
57235
57349
|
*/
|
|
@@ -57358,9 +57472,15 @@ var HtmlRenderer = class extends BaseRenderer {
|
|
|
57358
57472
|
}
|
|
57359
57473
|
const combinedStyle = commonStyles ? `${viewportStyle}; ${commonStyles}` : viewportStyle;
|
|
57360
57474
|
const dataAttrs = `data-viewport-width="${viewport.width}" data-viewport-height="${viewport.height}" data-viewport-label="${viewport.label}"`;
|
|
57361
|
-
|
|
57475
|
+
let pageDiv = `<div class="${classes}" style="${combinedStyle}" ${dataAttrs}>
|
|
57362
57476
|
${title}${uiContent}
|
|
57363
57477
|
</div>`;
|
|
57478
|
+
if (this.pathMap) {
|
|
57479
|
+
const path = this.pathMap.get(node);
|
|
57480
|
+
if (path !== void 0) {
|
|
57481
|
+
pageDiv = injectAnchorAttrs(pageDiv, path, node.loc);
|
|
57482
|
+
}
|
|
57483
|
+
}
|
|
57364
57484
|
if (annotationChildren.length > 0) {
|
|
57365
57485
|
const annotationsContent = this.renderChildren(annotationChildren);
|
|
57366
57486
|
return `<div class="${this.prefix}-page-wrapper" style="width: ${viewport.width}px">
|
|
@@ -57375,10 +57495,14 @@ ${annotationsContent}
|
|
|
57375
57495
|
*/
|
|
57376
57496
|
renderNode(node) {
|
|
57377
57497
|
const renderer = this.nodeRenderers[node.type];
|
|
57378
|
-
|
|
57379
|
-
|
|
57498
|
+
const html = renderer ? renderer(node) : `<!-- Unknown node type: ${node.type} -->`;
|
|
57499
|
+
if (this.pathMap && node.type !== "Page") {
|
|
57500
|
+
const path = this.pathMap.get(node);
|
|
57501
|
+
if (path !== void 0) {
|
|
57502
|
+
return injectAnchorAttrs(html, path, node.loc);
|
|
57503
|
+
}
|
|
57380
57504
|
}
|
|
57381
|
-
return
|
|
57505
|
+
return html;
|
|
57382
57506
|
}
|
|
57383
57507
|
/**
|
|
57384
57508
|
* Render children nodes
|
|
@@ -57829,8 +57953,8 @@ function renderCanvas(doc, options = {}) {
|
|
|
57829
57953
|
};
|
|
57830
57954
|
}
|
|
57831
57955
|
const { placed, width, height } = layoutCanvas(doc.children, gap);
|
|
57832
|
-
const
|
|
57833
|
-
|
|
57956
|
+
const boards = placed.map((p, pageIndex) => {
|
|
57957
|
+
const pageRenderer = new HtmlRenderer({ ...options, includeStyles: false }, pageIndex);
|
|
57834
57958
|
const { html: pageHtml } = pageRenderer.render({
|
|
57835
57959
|
type: "Document",
|
|
57836
57960
|
children: [p.page]
|
|
@@ -57868,6 +57992,7 @@ function render(document, options = {}) {
|
|
|
57868
57992
|
}
|
|
57869
57993
|
function renderToHtml(document, options = {}) {
|
|
57870
57994
|
const { html, css } = render(document, options);
|
|
57995
|
+
const prefix = options.classPrefix ?? "wf";
|
|
57871
57996
|
const isMultiPage = document.children.length > 1;
|
|
57872
57997
|
const bodyAlign = isMultiPage ? "justify-content: flex-start;\n align-items: flex-start;" : "justify-content: center;\n align-items: center;";
|
|
57873
57998
|
return `<!DOCTYPE html>
|
|
@@ -57890,6 +58015,14 @@ body {
|
|
|
57890
58015
|
padding: 24px;
|
|
57891
58016
|
box-sizing: border-box;
|
|
57892
58017
|
}
|
|
58018
|
+
/* Fixed-layout invariant: the multi-page canvas is a flex item of <body> and
|
|
58019
|
+
must keep its intrinsic size when the viewport is narrower than the canvas.
|
|
58020
|
+
Without flex-shrink:0 the flex item shrinks and the boards reflow \u2014 the same
|
|
58021
|
+
defect class as .wf-page (see no-responsive.md). Single pages already carry
|
|
58022
|
+
flex-shrink:0 via generateStyles; the canvas wrapper needs it here. */
|
|
58023
|
+
.${prefix}-canvas {
|
|
58024
|
+
flex-shrink: 0;
|
|
58025
|
+
}
|
|
57893
58026
|
${css}
|
|
57894
58027
|
</style>
|
|
57895
58028
|
</head>
|
|
@@ -58116,6 +58249,19 @@ var ATTRIBUTE_SPECS = [
|
|
|
58116
58249
|
{ name: "icon", type: "string", description: "Icon name" },
|
|
58117
58250
|
{ name: "external", type: "boolean", description: "External link" },
|
|
58118
58251
|
// ============================================
|
|
58252
|
+
// Accessibility Attributes
|
|
58253
|
+
// ============================================
|
|
58254
|
+
{
|
|
58255
|
+
name: "aria",
|
|
58256
|
+
type: "string",
|
|
58257
|
+
description: "Accessible name, rendered as aria-label (e.g. icon-only button)"
|
|
58258
|
+
},
|
|
58259
|
+
{
|
|
58260
|
+
name: "aria-label",
|
|
58261
|
+
type: "string",
|
|
58262
|
+
description: "Accessible name (synonym for aria), rendered as aria-label"
|
|
58263
|
+
},
|
|
58264
|
+
// ============================================
|
|
58119
58265
|
// State Attributes
|
|
58120
58266
|
// ============================================
|
|
58121
58267
|
{ name: "active", type: "number", description: "Active index" },
|
|
@@ -58437,7 +58583,11 @@ var COMPONENT_SPECS = [
|
|
|
58437
58583
|
"size",
|
|
58438
58584
|
"icon",
|
|
58439
58585
|
"disabled",
|
|
58440
|
-
"loading"
|
|
58586
|
+
"loading",
|
|
58587
|
+
// Accessibility: give icon-only buttons an accessible name / tooltip
|
|
58588
|
+
"aria",
|
|
58589
|
+
"aria-label",
|
|
58590
|
+
"title"
|
|
58441
58591
|
],
|
|
58442
58592
|
hasChildren: false,
|
|
58443
58593
|
description: "Clickable button"
|
|
@@ -60121,60 +60271,6 @@ function toDescriptor(pageIndex, page) {
|
|
|
60121
60271
|
return page?.title != null ? { pageIndex, title: page.title } : { pageIndex };
|
|
60122
60272
|
}
|
|
60123
60273
|
|
|
60124
|
-
// src/ast/anchor-path.ts
|
|
60125
|
-
var ANCHOR_PATH_ATTR = "data-wf-path";
|
|
60126
|
-
var ANCHOR_LOC_ATTR = "data-wf-loc";
|
|
60127
|
-
var ANCHOR_CONTAINER_TYPES = /* @__PURE__ */ new Set([
|
|
60128
|
-
"Page",
|
|
60129
|
-
"Header",
|
|
60130
|
-
"Main",
|
|
60131
|
-
"Footer",
|
|
60132
|
-
"Sidebar",
|
|
60133
|
-
"Section",
|
|
60134
|
-
"Row",
|
|
60135
|
-
"Col",
|
|
60136
|
-
"Stack",
|
|
60137
|
-
"Relative",
|
|
60138
|
-
"Card",
|
|
60139
|
-
"Modal",
|
|
60140
|
-
"Drawer",
|
|
60141
|
-
"Accordion",
|
|
60142
|
-
"Tooltip",
|
|
60143
|
-
"Popover"
|
|
60144
|
-
]);
|
|
60145
|
-
function anchorChildNodes(node) {
|
|
60146
|
-
if (!ANCHOR_CONTAINER_TYPES.has(node.type)) return [];
|
|
60147
|
-
const children = node.children;
|
|
60148
|
-
return Array.isArray(children) ? children : [];
|
|
60149
|
-
}
|
|
60150
|
-
function walkAnchorPaths(doc, visit, pageIndexBase = 0) {
|
|
60151
|
-
doc.children.forEach((page, i) => {
|
|
60152
|
-
visitAnchorNode(page, String(pageIndexBase + i), visit);
|
|
60153
|
-
});
|
|
60154
|
-
}
|
|
60155
|
-
function visitAnchorNode(node, path, visit) {
|
|
60156
|
-
visit(node, path);
|
|
60157
|
-
anchorChildNodes(node).forEach((child, i) => {
|
|
60158
|
-
visitAnchorNode(child, `${path}.${i}`, visit);
|
|
60159
|
-
});
|
|
60160
|
-
}
|
|
60161
|
-
function resolveAnchorPath(doc, path, pageIndexBase = 0) {
|
|
60162
|
-
if (!path) return void 0;
|
|
60163
|
-
const segments = path.split(".");
|
|
60164
|
-
const indices = [];
|
|
60165
|
-
for (const segment of segments) {
|
|
60166
|
-
if (!/^\d+$/.test(segment)) return void 0;
|
|
60167
|
-
indices.push(Number(segment));
|
|
60168
|
-
}
|
|
60169
|
-
const [pageSegment, ...childSegments] = indices;
|
|
60170
|
-
let node = doc.children[pageSegment - pageIndexBase];
|
|
60171
|
-
for (const childIndex of childSegments) {
|
|
60172
|
-
if (!node) return void 0;
|
|
60173
|
-
node = anchorChildNodes(node)[childIndex];
|
|
60174
|
-
}
|
|
60175
|
-
return node;
|
|
60176
|
-
}
|
|
60177
|
-
|
|
60178
60274
|
// src/extract/dom-map.ts
|
|
60179
60275
|
function buildAnchorIndex(doc, pageIndexBase = 0) {
|
|
60180
60276
|
const index = /* @__PURE__ */ new Map();
|
|
@@ -60345,6 +60441,7 @@ function buildDomTreeNode(node, path) {
|
|
|
60345
60441
|
renderPage,
|
|
60346
60442
|
renderToHtml,
|
|
60347
60443
|
renderToSvg,
|
|
60444
|
+
renderUnknownIconSvg,
|
|
60348
60445
|
resetFigmaIdCounter,
|
|
60349
60446
|
resolveAnchor,
|
|
60350
60447
|
resolvePageDimensions,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { h as AnyNode, A as AccordionNode, a as AlertNode, j as AvatarNode, B as BadgeNode, r as BreadcrumbNode, s as ButtonNode, C as CardNode, w as CheckboxNode, x as ColNode, z as ContainerComponentNode, D as ContainerNode, E as DataNode, G as DisplayNode, H as DividerComponentNode, J as DrawerNode, M as DropdownNode, N as FeedbackNode, P as FooterNode, Q as GridNode, S as HeaderNode, U as IconNode, X as ImageNode, Y as InputComponentNode, Z as InputNode, a1 as LayoutNode, a2 as LeafNode, a3 as LinkNode, a5 as ListNode, a6 as MainNode, a9 as ModalNode, af as NavNode, ag as NavigationNode, ah as NodeType, ai as OverlayNode, aj as PageNode, ak as PlaceholderNode, al as PopoverNode, ao as ProgressNode, ap as RadioNode, ar as RowNode, as as SectionNode, at as SelectNode, aw as SidebarNode, ay as SliderNode, aC as SpinnerNode, aG as SwitchNode, aI as TableNode, aJ as TabsNode, aL as TextContentNode, aM as TextNode, aQ as TextareaNode, aS as TitleNode, aT as ToastNode, aV as TooltipNode, aZ as WireframeDocument, az as SourceLocation, _ as InputType } from './types-
|
|
2
|
-
export { b as AlertVariant, c as AlignValue, d as AnchorPosition, e as AnnotationItemNode, f as AnnotationNode, g as AnnotationsNode, i as AppearanceProps, k as AvatarSize, l as AvatarSizeToken, m as BadgeSize, n as BadgeSizeToken, o as BadgeVariant, p as BaseNode, q as BreadcrumbItem, t as ButtonSize, u as ButtonSizeToken, v as ButtonVariant, y as CommonProps, F as DirectionValue, I as DividerNode, K as DrawerPosition, L as DropdownItemNode, O as FlexProps, R as GridProps, T as HeightValue, V as IconSize, W as IconSizeToken, $ as InteractiveProps, a0 as JustifyValue, a4 as ListItemNode, a7 as MarkerColor, a8 as MarkerNode, aa as NavBlockItem, ab as NavChild, ac as NavDivider, ad as NavGroupNode, ae as NavItem, am as Position, an as PositionProps, aq as RelativeNode, au as SelectOption, av as ShadowValue, ax as SizeProps, aA as SpacingProps, aB as SpacingValue, aD as SpinnerSize, aE as SpinnerSizeToken, aF as StackNode, aH as TabNode, aK as TextAlign, aN as TextSize, aO as TextSizeToken, aP as TextWeight, aR as TitleLevel, aU as ToastPosition, aW as TooltipPosition, aX as ValueWithUnit, aY as WidthValue } from './types-
|
|
1
|
+
import { h as AnyNode, A as AccordionNode, a as AlertNode, j as AvatarNode, B as BadgeNode, r as BreadcrumbNode, s as ButtonNode, C as CardNode, w as CheckboxNode, x as ColNode, z as ContainerComponentNode, D as ContainerNode, E as DataNode, G as DisplayNode, H as DividerComponentNode, J as DrawerNode, M as DropdownNode, N as FeedbackNode, P as FooterNode, Q as GridNode, S as HeaderNode, U as IconNode, X as ImageNode, Y as InputComponentNode, Z as InputNode, a1 as LayoutNode, a2 as LeafNode, a3 as LinkNode, a5 as ListNode, a6 as MainNode, a9 as ModalNode, af as NavNode, ag as NavigationNode, ah as NodeType, ai as OverlayNode, aj as PageNode, ak as PlaceholderNode, al as PopoverNode, ao as ProgressNode, ap as RadioNode, ar as RowNode, as as SectionNode, at as SelectNode, aw as SidebarNode, ay as SliderNode, aC as SpinnerNode, aG as SwitchNode, aI as TableNode, aJ as TabsNode, aL as TextContentNode, aM as TextNode, aQ as TextareaNode, aS as TitleNode, aT as ToastNode, aV as TooltipNode, aZ as WireframeDocument, az as SourceLocation, _ as InputType } from './types-BDbXDhTp.cjs';
|
|
2
|
+
export { b as AlertVariant, c as AlignValue, d as AnchorPosition, e as AnnotationItemNode, f as AnnotationNode, g as AnnotationsNode, i as AppearanceProps, k as AvatarSize, l as AvatarSizeToken, m as BadgeSize, n as BadgeSizeToken, o as BadgeVariant, p as BaseNode, q as BreadcrumbItem, t as ButtonSize, u as ButtonSizeToken, v as ButtonVariant, y as CommonProps, F as DirectionValue, I as DividerNode, K as DrawerPosition, L as DropdownItemNode, O as FlexProps, R as GridProps, T as HeightValue, V as IconSize, W as IconSizeToken, $ as InteractiveProps, a0 as JustifyValue, a4 as ListItemNode, a7 as MarkerColor, a8 as MarkerNode, aa as NavBlockItem, ab as NavChild, ac as NavDivider, ad as NavGroupNode, ae as NavItem, am as Position, an as PositionProps, aq as RelativeNode, au as SelectOption, av as ShadowValue, ax as SizeProps, aA as SpacingProps, aB as SpacingValue, aD as SpinnerSize, aE as SpinnerSizeToken, aF as StackNode, aH as TabNode, aK as TextAlign, aN as TextSize, aO as TextSizeToken, aP as TextWeight, aR as TitleLevel, aU as ToastPosition, aW as TooltipPosition, aX as ValueWithUnit, aY as WidthValue } from './types-BDbXDhTp.cjs';
|
|
3
3
|
export { ExpectedToken, ParseError, ParseErrorInfo, ParseOptions, ParseResult, getErrors, isValid, parse, tryParse } from './parser.cjs';
|
|
4
|
-
export { CanvasOptions, CanvasRenderResult, HtmlRenderer, IconData, IconElement, PageRenderResult, PlacedPage, RenderContext, RenderOptions, RenderResult, SvgRenderOptions, SvgRenderResult, ThemeColors, ThemeConfig, createHtmlRenderer, darkTheme, defaultTheme, generateComponentStyles, generateStyles, getIconData, getTheme, layoutCanvas, lucideIcons, render, renderCanvas, renderIconSvg, renderPage, renderToHtml, renderToSvg, resolvePageDimensions } from './renderer.cjs';
|
|
4
|
+
export { CanvasOptions, CanvasRenderResult, HtmlRenderer, IconData, IconElement, PageRenderResult, PlacedPage, RenderContext, RenderOptions, RenderResult, SvgRenderOptions, SvgRenderResult, ThemeColors, ThemeConfig, createHtmlRenderer, darkTheme, defaultTheme, generateComponentStyles, generateStyles, getIconData, getTheme, layoutCanvas, lucideIcons, render, renderCanvas, renderIconSvg, renderPage, renderToHtml, renderToSvg, renderUnknownIconSvg, resolvePageDimensions } from './renderer.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Type guards for wireweave AST
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { h as AnyNode, A as AccordionNode, a as AlertNode, j as AvatarNode, B as BadgeNode, r as BreadcrumbNode, s as ButtonNode, C as CardNode, w as CheckboxNode, x as ColNode, z as ContainerComponentNode, D as ContainerNode, E as DataNode, G as DisplayNode, H as DividerComponentNode, J as DrawerNode, M as DropdownNode, N as FeedbackNode, P as FooterNode, Q as GridNode, S as HeaderNode, U as IconNode, X as ImageNode, Y as InputComponentNode, Z as InputNode, a1 as LayoutNode, a2 as LeafNode, a3 as LinkNode, a5 as ListNode, a6 as MainNode, a9 as ModalNode, af as NavNode, ag as NavigationNode, ah as NodeType, ai as OverlayNode, aj as PageNode, ak as PlaceholderNode, al as PopoverNode, ao as ProgressNode, ap as RadioNode, ar as RowNode, as as SectionNode, at as SelectNode, aw as SidebarNode, ay as SliderNode, aC as SpinnerNode, aG as SwitchNode, aI as TableNode, aJ as TabsNode, aL as TextContentNode, aM as TextNode, aQ as TextareaNode, aS as TitleNode, aT as ToastNode, aV as TooltipNode, aZ as WireframeDocument, az as SourceLocation, _ as InputType } from './types-
|
|
2
|
-
export { b as AlertVariant, c as AlignValue, d as AnchorPosition, e as AnnotationItemNode, f as AnnotationNode, g as AnnotationsNode, i as AppearanceProps, k as AvatarSize, l as AvatarSizeToken, m as BadgeSize, n as BadgeSizeToken, o as BadgeVariant, p as BaseNode, q as BreadcrumbItem, t as ButtonSize, u as ButtonSizeToken, v as ButtonVariant, y as CommonProps, F as DirectionValue, I as DividerNode, K as DrawerPosition, L as DropdownItemNode, O as FlexProps, R as GridProps, T as HeightValue, V as IconSize, W as IconSizeToken, $ as InteractiveProps, a0 as JustifyValue, a4 as ListItemNode, a7 as MarkerColor, a8 as MarkerNode, aa as NavBlockItem, ab as NavChild, ac as NavDivider, ad as NavGroupNode, ae as NavItem, am as Position, an as PositionProps, aq as RelativeNode, au as SelectOption, av as ShadowValue, ax as SizeProps, aA as SpacingProps, aB as SpacingValue, aD as SpinnerSize, aE as SpinnerSizeToken, aF as StackNode, aH as TabNode, aK as TextAlign, aN as TextSize, aO as TextSizeToken, aP as TextWeight, aR as TitleLevel, aU as ToastPosition, aW as TooltipPosition, aX as ValueWithUnit, aY as WidthValue } from './types-
|
|
1
|
+
import { h as AnyNode, A as AccordionNode, a as AlertNode, j as AvatarNode, B as BadgeNode, r as BreadcrumbNode, s as ButtonNode, C as CardNode, w as CheckboxNode, x as ColNode, z as ContainerComponentNode, D as ContainerNode, E as DataNode, G as DisplayNode, H as DividerComponentNode, J as DrawerNode, M as DropdownNode, N as FeedbackNode, P as FooterNode, Q as GridNode, S as HeaderNode, U as IconNode, X as ImageNode, Y as InputComponentNode, Z as InputNode, a1 as LayoutNode, a2 as LeafNode, a3 as LinkNode, a5 as ListNode, a6 as MainNode, a9 as ModalNode, af as NavNode, ag as NavigationNode, ah as NodeType, ai as OverlayNode, aj as PageNode, ak as PlaceholderNode, al as PopoverNode, ao as ProgressNode, ap as RadioNode, ar as RowNode, as as SectionNode, at as SelectNode, aw as SidebarNode, ay as SliderNode, aC as SpinnerNode, aG as SwitchNode, aI as TableNode, aJ as TabsNode, aL as TextContentNode, aM as TextNode, aQ as TextareaNode, aS as TitleNode, aT as ToastNode, aV as TooltipNode, aZ as WireframeDocument, az as SourceLocation, _ as InputType } from './types-BDbXDhTp.js';
|
|
2
|
+
export { b as AlertVariant, c as AlignValue, d as AnchorPosition, e as AnnotationItemNode, f as AnnotationNode, g as AnnotationsNode, i as AppearanceProps, k as AvatarSize, l as AvatarSizeToken, m as BadgeSize, n as BadgeSizeToken, o as BadgeVariant, p as BaseNode, q as BreadcrumbItem, t as ButtonSize, u as ButtonSizeToken, v as ButtonVariant, y as CommonProps, F as DirectionValue, I as DividerNode, K as DrawerPosition, L as DropdownItemNode, O as FlexProps, R as GridProps, T as HeightValue, V as IconSize, W as IconSizeToken, $ as InteractiveProps, a0 as JustifyValue, a4 as ListItemNode, a7 as MarkerColor, a8 as MarkerNode, aa as NavBlockItem, ab as NavChild, ac as NavDivider, ad as NavGroupNode, ae as NavItem, am as Position, an as PositionProps, aq as RelativeNode, au as SelectOption, av as ShadowValue, ax as SizeProps, aA as SpacingProps, aB as SpacingValue, aD as SpinnerSize, aE as SpinnerSizeToken, aF as StackNode, aH as TabNode, aK as TextAlign, aN as TextSize, aO as TextSizeToken, aP as TextWeight, aR as TitleLevel, aU as ToastPosition, aW as TooltipPosition, aX as ValueWithUnit, aY as WidthValue } from './types-BDbXDhTp.js';
|
|
3
3
|
export { ExpectedToken, ParseError, ParseErrorInfo, ParseOptions, ParseResult, getErrors, isValid, parse, tryParse } from './parser.js';
|
|
4
|
-
export { CanvasOptions, CanvasRenderResult, HtmlRenderer, IconData, IconElement, PageRenderResult, PlacedPage, RenderContext, RenderOptions, RenderResult, SvgRenderOptions, SvgRenderResult, ThemeColors, ThemeConfig, createHtmlRenderer, darkTheme, defaultTheme, generateComponentStyles, generateStyles, getIconData, getTheme, layoutCanvas, lucideIcons, render, renderCanvas, renderIconSvg, renderPage, renderToHtml, renderToSvg, resolvePageDimensions } from './renderer.js';
|
|
4
|
+
export { CanvasOptions, CanvasRenderResult, HtmlRenderer, IconData, IconElement, PageRenderResult, PlacedPage, RenderContext, RenderOptions, RenderResult, SvgRenderOptions, SvgRenderResult, ThemeColors, ThemeConfig, createHtmlRenderer, darkTheme, defaultTheme, generateComponentStyles, generateStyles, getIconData, getTheme, layoutCanvas, lucideIcons, render, renderCanvas, renderIconSvg, renderPage, renderToHtml, renderToSvg, renderUnknownIconSvg, resolvePageDimensions } from './renderer.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Type guards for wireweave AST
|