@wireweave/core 2.3.1 → 2.5.0-beta.0

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/renderer.cjs CHANGED
@@ -1322,6 +1322,106 @@ function generateAccessibilityStyles(prefix) {
1322
1322
  }`;
1323
1323
  }
1324
1324
 
1325
+ // src/renderer/styles/annotation.ts
1326
+ function generateAnnotationStyles(_theme, prefix) {
1327
+ return `/* Annotation Components */
1328
+
1329
+ /* Marker - Number marker for referencing */
1330
+ .${prefix}-marker {
1331
+ display: inline-flex;
1332
+ align-items: center;
1333
+ justify-content: center;
1334
+ width: 20px;
1335
+ height: 20px;
1336
+ border-radius: 50%;
1337
+ background: #3b82f6;
1338
+ border: 2px solid #2563eb;
1339
+ color: white;
1340
+ font-size: 11px;
1341
+ font-weight: 600;
1342
+ line-height: 1;
1343
+ z-index: 10;
1344
+ }
1345
+
1346
+ /* Annotations Panel - Documentation container */
1347
+ .${prefix}-annotations {
1348
+ background: #fafafa;
1349
+ border: 2px dashed #d1d5db;
1350
+ border-radius: 8px;
1351
+ padding: 16px;
1352
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
1353
+ }
1354
+
1355
+ .${prefix}-annotations-header {
1356
+ display: flex;
1357
+ align-items: center;
1358
+ gap: 8px;
1359
+ font-weight: 600;
1360
+ font-size: 14px;
1361
+ color: #6b7280;
1362
+ margin-bottom: 16px;
1363
+ padding-bottom: 8px;
1364
+ border-bottom: 1px solid #e5e7eb;
1365
+ }
1366
+
1367
+ .${prefix}-annotations-icon {
1368
+ font-size: 16px;
1369
+ }
1370
+
1371
+ .${prefix}-annotations-content {
1372
+ display: flex;
1373
+ flex-direction: column;
1374
+ gap: 12px;
1375
+ }
1376
+
1377
+ /* Annotation Item - Individual entry */
1378
+ .${prefix}-annotation-item {
1379
+ display: flex;
1380
+ flex-direction: column;
1381
+ gap: 4px;
1382
+ }
1383
+
1384
+ .${prefix}-annotation-item-header {
1385
+ display: flex;
1386
+ align-items: center;
1387
+ gap: 8px;
1388
+ }
1389
+
1390
+ .${prefix}-annotation-marker {
1391
+ display: inline-flex;
1392
+ align-items: center;
1393
+ justify-content: center;
1394
+ width: 18px;
1395
+ height: 18px;
1396
+ border-radius: 50%;
1397
+ background: #3b82f6;
1398
+ color: white;
1399
+ font-size: 10px;
1400
+ font-weight: 600;
1401
+ flex-shrink: 0;
1402
+ }
1403
+
1404
+ .${prefix}-annotation-item-title {
1405
+ font-weight: 500;
1406
+ font-size: 13px;
1407
+ color: #374151;
1408
+ }
1409
+
1410
+ .${prefix}-annotation-item-content {
1411
+ padding-left: 26px;
1412
+ font-size: 12px;
1413
+ color: #6b7280;
1414
+ line-height: 1.5;
1415
+ }
1416
+
1417
+ .${prefix}-annotation-item-content p,
1418
+ .${prefix}-annotation-item-content .${prefix}-text {
1419
+ margin: 0;
1420
+ font-size: 12px;
1421
+ color: #6b7280;
1422
+ }`;
1423
+ }
1424
+
1325
1425
  // src/renderer/styles-components.ts
1326
1426
  function generateComponentStyles(_theme, prefix = "wf") {
1327
1427
  const parts = [
@@ -1335,7 +1435,8 @@ function generateComponentStyles(_theme, prefix = "wf") {
1335
1435
  generateOverlayStyles(_theme, prefix),
1336
1436
  generateNavigationStyles(_theme, prefix),
1337
1437
  generateSemanticMarkerStyles(_theme, prefix),
1338
- generateAccessibilityStyles(prefix)
1438
+ generateAccessibilityStyles(prefix),
1439
+ generateAnnotationStyles(_theme, prefix)
1339
1440
  ];
1340
1441
  return parts.join("\n\n");
1341
1442
  }
@@ -1446,11 +1547,36 @@ function generateGridClasses(_theme, prefix) {
1446
1547
  }
1447
1548
 
1448
1549
  /* When explicit width is set, don't flex-grow */
1449
- .${prefix}-row[style*="width:"],
1450
- .${prefix}-col[style*="width:"] {
1550
+ .${prefix}-row[style*="width"],
1551
+ .${prefix}-col[style*="width"] {
1552
+ flex: 0 0 auto;
1553
+ }
1554
+
1555
+ /* Stack - vertical content grouping (does not fill available space) */
1556
+ .${prefix}-stack {
1557
+ display: flex;
1558
+ flex-direction: column;
1451
1559
  flex: 0 0 auto;
1560
+ box-sizing: border-box;
1561
+ }
1562
+
1563
+ /* Relative - container for absolute positioning children */
1564
+ .${prefix}-relative {
1565
+ position: relative;
1566
+ display: inline-flex;
1452
1567
  }
1453
1568
 
1569
+ /* Anchor positioning for relative container children */
1570
+ .${prefix}-anchor-top-left { position: absolute; top: -4px; left: -4px; }
1571
+ .${prefix}-anchor-top-center { position: absolute; top: -4px; left: 50%; transform: translateX(-50%); }
1572
+ .${prefix}-anchor-top-right { position: absolute; top: -4px; right: -4px; }
1573
+ .${prefix}-anchor-center-left { position: absolute; top: 50%; left: -4px; transform: translateY(-50%); }
1574
+ .${prefix}-anchor-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
1575
+ .${prefix}-anchor-center-right { position: absolute; top: 50%; right: -4px; transform: translateY(-50%); }
1576
+ .${prefix}-anchor-bottom-left { position: absolute; bottom: -4px; left: -4px; }
1577
+ .${prefix}-anchor-bottom-center { position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); }
1578
+ .${prefix}-anchor-bottom-right { position: absolute; bottom: -4px; right: -4px; }
1579
+
1454
1580
  `;
1455
1581
  for (let i = 1; i <= 12; i++) {
1456
1582
  css += `.${prefix}-col-${i} { flex: ${i} 0 0%; min-width: 0; }
@@ -2044,6 +2170,30 @@ function renderCol(node, ctx) {
2044
2170
  ${children}
2045
2171
  </div>`;
2046
2172
  }
2173
+ function renderStack(node, ctx) {
2174
+ const classes = ctx.buildClassString([
2175
+ `${ctx.prefix}-stack`,
2176
+ ...ctx.getCommonClasses(node)
2177
+ ]);
2178
+ const styles = ctx.buildCommonStyles(node);
2179
+ const styleAttr = styles ? ` style="${styles}"` : "";
2180
+ const children = ctx.renderChildren(node.children);
2181
+ return `<div class="${classes}"${styleAttr}>
2182
+ ${children}
2183
+ </div>`;
2184
+ }
2185
+ function renderRelative(node, ctx) {
2186
+ const classes = ctx.buildClassString([
2187
+ `${ctx.prefix}-relative`,
2188
+ ...ctx.getCommonClasses(node)
2189
+ ]);
2190
+ const styles = ctx.buildCommonStyles(node);
2191
+ const styleAttr = styles ? ` style="${styles}"` : "";
2192
+ const children = ctx.renderChildren(node.children);
2193
+ return `<div class="${classes}"${styleAttr}>
2194
+ ${children}
2195
+ </div>`;
2196
+ }
2047
2197
 
2048
2198
  // src/renderer/html/renderers/container.ts
2049
2199
  function buildInteractiveAttrs(node) {
@@ -12879,6 +13029,28 @@ var lucideIcons = {
12879
13029
  }
12880
13030
  ]
12881
13031
  ],
13032
+ "circle-help": [
13033
+ [
13034
+ "circle",
13035
+ {
13036
+ "cx": "12",
13037
+ "cy": "12",
13038
+ "r": "10"
13039
+ }
13040
+ ],
13041
+ [
13042
+ "path",
13043
+ {
13044
+ "d": "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"
13045
+ }
13046
+ ],
13047
+ [
13048
+ "path",
13049
+ {
13050
+ "d": "M12 17h.01"
13051
+ }
13052
+ ]
13053
+ ],
12882
13054
  "circle-minus": [
12883
13055
  [
12884
13056
  "circle",
@@ -48941,10 +49113,20 @@ function renderAvatar(node, ctx) {
48941
49113
  const sizeStyle = sizeResolved.style || "";
48942
49114
  const combinedStyles = baseStyles && sizeStyle ? `${baseStyles}; ${sizeStyle}` : baseStyles || sizeStyle;
48943
49115
  const styleAttr = combinedStyles ? ` style="${combinedStyles}"` : "";
48944
- const initials = node.name ? node.name.split(" ").map((n) => n[0]).join("").toUpperCase().slice(0, 2) : "?";
49116
+ let content;
49117
+ if (node.name) {
49118
+ content = node.name.split(" ").map((n) => n[0]).join("").toUpperCase().slice(0, 2);
49119
+ } else {
49120
+ const iconData = getIconData("user");
49121
+ if (iconData) {
49122
+ content = renderIconSvg(iconData, 16, 2, `${ctx.prefix}-icon`);
49123
+ } else {
49124
+ content = "?";
49125
+ }
49126
+ }
48945
49127
  const interactiveAttrs = buildInteractiveAttrs2(node);
48946
49128
  const interactiveAttrStr = ctx.buildAttrsString(interactiveAttrs);
48947
- return `<div class="${classes}"${styleAttr}${interactiveAttrStr} role="img" aria-label="${ctx.escapeHtml(node.name || "Avatar")}">${initials}</div>`;
49129
+ return `<div class="${classes}"${styleAttr}${interactiveAttrStr} role="img" aria-label="${ctx.escapeHtml(node.name || "Avatar")}">${content}</div>`;
48948
49130
  }
48949
49131
  function renderBadge(node, ctx) {
48950
49132
  const interactiveAttrs = buildInteractiveAttrs2(node);
@@ -48956,6 +49138,7 @@ function renderBadge(node, ctx) {
48956
49138
  `${ctx.prefix}-badge-icon`,
48957
49139
  sizeResolved.className,
48958
49140
  node.variant ? `${ctx.prefix}-badge-icon-${node.variant}` : void 0,
49141
+ node.anchor ? `${ctx.prefix}-anchor-${node.anchor}` : void 0,
48959
49142
  ...ctx.getCommonClasses(node)
48960
49143
  ]);
48961
49144
  const baseStyles2 = ctx.buildCommonStyles(node);
@@ -48975,6 +49158,7 @@ function renderBadge(node, ctx) {
48975
49158
  sizeResolved.className,
48976
49159
  node.variant ? `${ctx.prefix}-badge-${node.variant}` : void 0,
48977
49160
  node.pill ? `${ctx.prefix}-badge-pill` : void 0,
49161
+ node.anchor ? `${ctx.prefix}-anchor-${node.anchor}` : void 0,
48978
49162
  ...ctx.getCommonClasses(node)
48979
49163
  ]);
48980
49164
  const baseStyles = ctx.buildCommonStyles(node);
@@ -49309,6 +49493,117 @@ function renderDivider(node, ctx) {
49309
49493
  return `<hr class="${ctx.prefix}-divider"${styleAttr} />`;
49310
49494
  }
49311
49495
 
49496
+ // src/renderer/html/renderers/annotation.ts
49497
+ var MARKER_COLORS = {
49498
+ blue: { bg: "#3b82f6", border: "#2563eb" },
49499
+ red: { bg: "#ef4444", border: "#dc2626" },
49500
+ green: { bg: "#22c55e", border: "#16a34a" },
49501
+ yellow: { bg: "#eab308", border: "#ca8a04" },
49502
+ purple: { bg: "#a855f7", border: "#9333ea" },
49503
+ orange: { bg: "#f97316", border: "#ea580c" }
49504
+ };
49505
+ function getAnchorStyles(anchor) {
49506
+ if (!anchor) return "";
49507
+ const styles = ["position: absolute"];
49508
+ switch (anchor) {
49509
+ case "top-left":
49510
+ styles.push("top: -8px", "left: -8px");
49511
+ break;
49512
+ case "top-center":
49513
+ styles.push("top: -8px", "left: 50%", "transform: translateX(-50%)");
49514
+ break;
49515
+ case "top-right":
49516
+ styles.push("top: -8px", "right: -8px");
49517
+ break;
49518
+ case "center-left":
49519
+ styles.push("top: 50%", "left: -8px", "transform: translateY(-50%)");
49520
+ break;
49521
+ case "center":
49522
+ styles.push("top: 50%", "left: 50%", "transform: translate(-50%, -50%)");
49523
+ break;
49524
+ case "center-right":
49525
+ styles.push("top: 50%", "right: -8px", "transform: translateY(-50%)");
49526
+ break;
49527
+ case "bottom-left":
49528
+ styles.push("bottom: -8px", "left: -8px");
49529
+ break;
49530
+ case "bottom-center":
49531
+ styles.push("bottom: -8px", "left: 50%", "transform: translateX(-50%)");
49532
+ break;
49533
+ case "bottom-right":
49534
+ styles.push("bottom: -8px", "right: -8px");
49535
+ break;
49536
+ }
49537
+ return styles.join("; ");
49538
+ }
49539
+ function renderMarker(node, ctx) {
49540
+ const color = node.color || "blue";
49541
+ const colorConfig = MARKER_COLORS[color] || MARKER_COLORS.blue;
49542
+ const baseStyles = [
49543
+ "display: inline-flex",
49544
+ "align-items: center",
49545
+ "justify-content: center",
49546
+ "width: 20px",
49547
+ "height: 20px",
49548
+ "border-radius: 50%",
49549
+ `background: ${colorConfig.bg}`,
49550
+ `border: 2px solid ${colorConfig.border}`,
49551
+ "color: white",
49552
+ "font-size: 11px",
49553
+ "font-weight: 600",
49554
+ "line-height: 1",
49555
+ "z-index: 10"
49556
+ ];
49557
+ const anchorStyles = getAnchorStyles(node.anchor);
49558
+ const commonStyles = ctx.buildCommonStyles(node);
49559
+ const allStyles = [
49560
+ ...baseStyles,
49561
+ ...anchorStyles ? [anchorStyles] : [],
49562
+ ...commonStyles ? [commonStyles] : []
49563
+ ].join("; ");
49564
+ return `<span class="${ctx.prefix}-marker" style="${allStyles}" aria-label="Marker ${node.number}">${node.number}</span>`;
49565
+ }
49566
+ function renderAnnotations(node, ctx) {
49567
+ const title = node.title || "\uD654\uBA74 \uC124\uBA85";
49568
+ const commonStyles = ctx.buildCommonStyles(node);
49569
+ const styleAttr = commonStyles ? ` style="${commonStyles}"` : "";
49570
+ const items = (node.children || []).map((child) => renderAnnotationItem(child, ctx)).join("\n");
49571
+ return `<aside class="${ctx.prefix}-annotations" data-role="documentation" aria-label="${ctx.escapeHtml(title)}"${styleAttr}>
49572
+ <header class="${ctx.prefix}-annotations-header">
49573
+ <span class="${ctx.prefix}-annotations-icon" aria-hidden="true">&#128203;</span>
49574
+ <span>${ctx.escapeHtml(title)}</span>
49575
+ </header>
49576
+ <div class="${ctx.prefix}-annotations-content">
49577
+ ${items}
49578
+ </div>
49579
+ </aside>`;
49580
+ }
49581
+ function renderAnnotationItem(node, ctx) {
49582
+ const color = MARKER_COLORS.blue;
49583
+ const markerStyle = [
49584
+ "display: inline-flex",
49585
+ "align-items: center",
49586
+ "justify-content: center",
49587
+ "width: 18px",
49588
+ "height: 18px",
49589
+ "border-radius: 50%",
49590
+ `background: ${color.bg}`,
49591
+ "color: white",
49592
+ "font-size: 10px",
49593
+ "font-weight: 600",
49594
+ "flex-shrink: 0"
49595
+ ].join("; ");
49596
+ const children = node.children || [];
49597
+ const content = children.length > 0 ? ctx.renderChildren(children) : "";
49598
+ return `<div class="${ctx.prefix}-annotation-item">
49599
+ <div class="${ctx.prefix}-annotation-item-header">
49600
+ <span class="${ctx.prefix}-annotation-marker" style="${markerStyle}">${node.number}</span>
49601
+ <span class="${ctx.prefix}-annotation-item-title">${ctx.escapeHtml(node.title)}</span>
49602
+ </div>
49603
+ ${content ? `<div class="${ctx.prefix}-annotation-item-content">${content}</div>` : ""}
49604
+ </div>`;
49605
+ }
49606
+
49312
49607
  // src/renderer/html/index.ts
49313
49608
  var SPACING_TOKENS = {
49314
49609
  0: "0px",
@@ -49395,6 +49690,8 @@ var HtmlRenderer = class extends BaseRenderer {
49395
49690
  // Grid nodes
49396
49691
  Row: (node) => this.renderRow(node),
49397
49692
  Col: (node) => this.renderCol(node),
49693
+ Stack: (node) => this.renderStack(node),
49694
+ Relative: (node) => this.renderRelative(node),
49398
49695
  // Container nodes
49399
49696
  Card: (node) => this.renderCard(node),
49400
49697
  Modal: (node) => this.renderModal(node),
@@ -49437,7 +49734,11 @@ var HtmlRenderer = class extends BaseRenderer {
49437
49734
  Tabs: (node) => this.renderTabs(node),
49438
49735
  Breadcrumb: (node) => this.renderBreadcrumb(node),
49439
49736
  // Other
49440
- Divider: (node) => this.renderDivider(node)
49737
+ Divider: (node) => this.renderDivider(node),
49738
+ // Annotation nodes
49739
+ Marker: (node) => this.renderMarker(node),
49740
+ Annotations: (node) => this.renderAnnotations(node),
49741
+ AnnotationItem: (node) => this.renderAnnotationItem(node)
49441
49742
  };
49442
49743
  }
49443
49744
  /**
@@ -49554,6 +49855,12 @@ ${title}${children}
49554
49855
  renderCol(node) {
49555
49856
  return renderCol(node, this.getGridRenderContext());
49556
49857
  }
49858
+ renderStack(node) {
49859
+ return renderStack(node, this.getRenderContext());
49860
+ }
49861
+ renderRelative(node) {
49862
+ return renderRelative(node, this.getRenderContext());
49863
+ }
49557
49864
  /**
49558
49865
  * Build common inline styles for all values
49559
49866
  *
@@ -49716,6 +50023,9 @@ ${title}${children}
49716
50023
  if (commonStyles) {
49717
50024
  styles.push(commonStyles);
49718
50025
  }
50026
+ if (node.w !== void 0 && node.flex === void 0) {
50027
+ styles.push("flex: none");
50028
+ }
49719
50029
  if (node.order !== void 0) {
49720
50030
  styles.push(`order: ${node.order}`);
49721
50031
  }
@@ -49850,6 +50160,18 @@ ${title}${children}
49850
50160
  renderDivider(node) {
49851
50161
  return renderDivider(node, this.getRenderContext());
49852
50162
  }
50163
+ // ===========================================
50164
+ // Annotation Renderers
50165
+ // ===========================================
50166
+ renderMarker(node) {
50167
+ return renderMarker(node, this.getRenderContext());
50168
+ }
50169
+ renderAnnotations(node) {
50170
+ return renderAnnotations(node, this.getRenderContext());
50171
+ }
50172
+ renderAnnotationItem(node) {
50173
+ return renderAnnotationItem(node, this.getRenderContext());
50174
+ }
49853
50175
  };
49854
50176
  function createHtmlRenderer(options) {
49855
50177
  return new HtmlRenderer(options);
@@ -1,4 +1,4 @@
1
- import { a1 as WireframeDocument, A as AnyNode, P as PageNode } from './types-D0t4JRY3.cjs';
1
+ import { a1 as WireframeDocument, A as AnyNode, P as PageNode } from './types-EbEsGNxL.cjs';
2
2
 
3
3
  /**
4
4
  * Renderer type definitions for wireweave
@@ -234,6 +234,8 @@ declare class HtmlRenderer extends BaseRenderer {
234
234
  private renderSection;
235
235
  private renderRow;
236
236
  private renderCol;
237
+ private renderStack;
238
+ private renderRelative;
237
239
  /**
238
240
  * Build common inline styles for all values
239
241
  *
@@ -311,6 +313,9 @@ declare class HtmlRenderer extends BaseRenderer {
311
313
  private renderTabs;
312
314
  private renderBreadcrumb;
313
315
  private renderDivider;
316
+ private renderMarker;
317
+ private renderAnnotations;
318
+ private renderAnnotationItem;
314
319
  }
315
320
  /**
316
321
  * Create a new HTML renderer instance
@@ -1,4 +1,4 @@
1
- import { a1 as WireframeDocument, A as AnyNode, P as PageNode } from './types-D0t4JRY3.js';
1
+ import { a1 as WireframeDocument, A as AnyNode, P as PageNode } from './types-EbEsGNxL.js';
2
2
 
3
3
  /**
4
4
  * Renderer type definitions for wireweave
@@ -234,6 +234,8 @@ declare class HtmlRenderer extends BaseRenderer {
234
234
  private renderSection;
235
235
  private renderRow;
236
236
  private renderCol;
237
+ private renderStack;
238
+ private renderRelative;
237
239
  /**
238
240
  * Build common inline styles for all values
239
241
  *
@@ -311,6 +313,9 @@ declare class HtmlRenderer extends BaseRenderer {
311
313
  private renderTabs;
312
314
  private renderBreadcrumb;
313
315
  private renderDivider;
316
+ private renderMarker;
317
+ private renderAnnotations;
318
+ private renderAnnotationItem;
314
319
  }
315
320
  /**
316
321
  * Create a new HTML renderer instance