@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/index.cjs +1904 -815
- package/dist/index.d.cts +118 -17
- package/dist/index.d.ts +118 -17
- package/dist/index.js +1904 -815
- package/dist/parser.cjs +1286 -755
- package/dist/parser.d.cts +1 -1
- package/dist/parser.d.ts +1 -1
- package/dist/parser.js +1286 -755
- package/dist/renderer.cjs +328 -6
- package/dist/renderer.d.cts +6 -1
- package/dist/renderer.d.ts +6 -1
- package/dist/renderer.js +328 -6
- package/dist/{types-D0t4JRY3.d.cts → types-EbEsGNxL.d.cts} +105 -5
- package/dist/{types-D0t4JRY3.d.ts → types-EbEsGNxL.d.ts} +105 -5
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AnyNode, a as AccordionNode, b as AlertNode, c as AvatarNode, B as BadgeNode, d as BreadcrumbNode, e as ButtonNode, C as CardNode, f as CheckboxNode, g as ColNode, h as ContainerComponentNode, i as ContainerNode, D as DataNode, j as DisplayNode, k as DividerComponentNode, l as DrawerNode, m as DropdownNode, F as FeedbackNode, n as FooterNode, G as GridNode, H as HeaderNode, I as IconNode, o as ImageNode, p as InputComponentNode, q as InputNode, L as LayoutNode, r as LeafNode, s as LinkNode, t as ListNode, M as MainNode, u as ModalNode, N as NavNode, v as NavigationNode, w as NodeType, O as OverlayNode, P as PageNode, x as PlaceholderNode, y as PopoverNode, z as ProgressNode, R as RadioNode, E as RowNode, S as SectionNode, J as SelectNode, K as SidebarNode, Q as SliderNode, T as SpinnerNode, U as SwitchNode, V as TableNode, W as TabsNode, X as TextContentNode, Y as TextNode, Z as TextareaNode, _ as TitleNode, $ as ToastNode, a0 as TooltipNode, a1 as WireframeDocument } from './types-
|
|
2
|
-
export { a2 as AlertVariant, a3 as AlignValue, a4 as
|
|
1
|
+
import { A as AnyNode, a as AccordionNode, b as AlertNode, c as AvatarNode, B as BadgeNode, d as BreadcrumbNode, e as ButtonNode, C as CardNode, f as CheckboxNode, g as ColNode, h as ContainerComponentNode, i as ContainerNode, D as DataNode, j as DisplayNode, k as DividerComponentNode, l as DrawerNode, m as DropdownNode, F as FeedbackNode, n as FooterNode, G as GridNode, H as HeaderNode, I as IconNode, o as ImageNode, p as InputComponentNode, q as InputNode, L as LayoutNode, r as LeafNode, s as LinkNode, t as ListNode, M as MainNode, u as ModalNode, N as NavNode, v as NavigationNode, w as NodeType, O as OverlayNode, P as PageNode, x as PlaceholderNode, y as PopoverNode, z as ProgressNode, R as RadioNode, E as RowNode, S as SectionNode, J as SelectNode, K as SidebarNode, Q as SliderNode, T as SpinnerNode, U as SwitchNode, V as TableNode, W as TabsNode, X as TextContentNode, Y as TextNode, Z as TextareaNode, _ as TitleNode, $ as ToastNode, a0 as TooltipNode, a1 as WireframeDocument } from './types-EbEsGNxL.cjs';
|
|
2
|
+
export { a2 as AlertVariant, a3 as AlignValue, a4 as AnchorPosition, a5 as AnnotationItemNode, a6 as AnnotationNode, a7 as AnnotationsNode, a8 as AppearanceProps, a9 as AvatarSize, aa as AvatarSizeToken, ab as BadgeSize, ac as BadgeSizeToken, ad as BadgeVariant, ae as BaseNode, af as BreadcrumbItem, ag as ButtonSize, ah as ButtonSizeToken, ai as ButtonVariant, aj as CommonProps, ak as DirectionValue, al as DividerNode, am as DrawerPosition, an as DropdownItemNode, ao as FlexProps, ap as GridProps, aq as HeightValue, ar as IconSize, as as IconSizeToken, at as InputType, au as InteractiveProps, av as JustifyValue, aw as ListItemNode, ax as MarkerColor, ay as MarkerNode, az as NavBlockItem, aA as NavChild, aB as NavDivider, aC as NavGroupNode, aD as NavItem, aE as Position, aF as PositionProps, aG as RelativeNode, aH as SelectOption, aI as ShadowValue, aJ as SizeProps, aK as SourceLocation, aL as SpacingProps, aM as SpacingValue, aN as SpinnerSize, aO as SpinnerSizeToken, aP as StackNode, aQ as TabNode, aR as TextAlign, aS as TextSize, aT as TextSizeToken, aU as TextWeight, aV as TitleLevel, aW as ToastPosition, aX as TooltipPosition, aY as ValueWithUnit, aZ as WidthValue } from './types-EbEsGNxL.cjs';
|
|
3
3
|
export { ExpectedToken, ParseError, ParseErrorInfo, ParseOptions, ParseResult, getErrors, isValid, parse, tryParse } from './parser.cjs';
|
|
4
4
|
export { HtmlRenderer, IconData, IconElement, RenderContext, RenderOptions, RenderResult, SvgRenderOptions, SvgRenderResult, ThemeColors, ThemeConfig, createHtmlRenderer, darkTheme, defaultTheme, generateComponentStyles, generateStyles, getIconData, getTheme, lucideIcons, render, renderIconSvg, renderToHtml, renderToSvg } from './renderer.cjs';
|
|
5
5
|
|
|
@@ -272,7 +272,7 @@ interface AttributeSpec {
|
|
|
272
272
|
/**
|
|
273
273
|
* Component category
|
|
274
274
|
*/
|
|
275
|
-
type ComponentCategory = 'layout' | 'grid' | 'container' | 'text' | 'input' | 'display' | 'data' | 'feedback' | 'overlay' | 'navigation';
|
|
275
|
+
type ComponentCategory = 'layout' | 'grid' | 'container' | 'text' | 'input' | 'display' | 'data' | 'feedback' | 'overlay' | 'navigation' | 'annotation';
|
|
276
276
|
/**
|
|
277
277
|
* Component definition
|
|
278
278
|
*/
|
|
@@ -567,9 +567,93 @@ interface JsonExportResult {
|
|
|
567
567
|
componentTypes: string[];
|
|
568
568
|
};
|
|
569
569
|
}
|
|
570
|
+
/**
|
|
571
|
+
* Figma node types that we can map to
|
|
572
|
+
*/
|
|
573
|
+
type FigmaNodeType = 'DOCUMENT' | 'CANVAS' | 'FRAME' | 'GROUP' | 'TEXT' | 'RECTANGLE' | 'INSTANCE' | 'COMPONENT';
|
|
574
|
+
/**
|
|
575
|
+
* Figma Auto Layout mode
|
|
576
|
+
*/
|
|
577
|
+
type FigmaLayoutMode = 'NONE' | 'HORIZONTAL' | 'VERTICAL';
|
|
578
|
+
/**
|
|
579
|
+
* Figma sizing mode for Auto Layout
|
|
580
|
+
*/
|
|
581
|
+
type FigmaSizingMode = 'FIXED' | 'HUG' | 'FILL';
|
|
582
|
+
/**
|
|
583
|
+
* Figma primary axis alignment (justify)
|
|
584
|
+
*/
|
|
585
|
+
type FigmaPrimaryAxisAlign = 'MIN' | 'CENTER' | 'MAX' | 'SPACE_BETWEEN';
|
|
586
|
+
/**
|
|
587
|
+
* Figma counter axis alignment (align)
|
|
588
|
+
*/
|
|
589
|
+
type FigmaCounterAxisAlign = 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'BASELINE';
|
|
590
|
+
/**
|
|
591
|
+
* Figma text alignment
|
|
592
|
+
*/
|
|
593
|
+
type FigmaTextAlign = 'LEFT' | 'CENTER' | 'RIGHT' | 'JUSTIFIED';
|
|
594
|
+
/**
|
|
595
|
+
* Figma color (RGBA, 0-1 range)
|
|
596
|
+
*/
|
|
597
|
+
interface FigmaColor {
|
|
598
|
+
r: number;
|
|
599
|
+
g: number;
|
|
600
|
+
b: number;
|
|
601
|
+
a: number;
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Figma solid fill
|
|
605
|
+
*/
|
|
606
|
+
interface FigmaSolidFill {
|
|
607
|
+
type: 'SOLID';
|
|
608
|
+
color: FigmaColor;
|
|
609
|
+
opacity?: number;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Figma stroke
|
|
613
|
+
*/
|
|
614
|
+
interface FigmaStroke {
|
|
615
|
+
type: 'SOLID';
|
|
616
|
+
color: FigmaColor;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Figma Auto Layout properties
|
|
620
|
+
*/
|
|
621
|
+
interface FigmaAutoLayout {
|
|
622
|
+
layoutMode: FigmaLayoutMode;
|
|
623
|
+
layoutSizingHorizontal: FigmaSizingMode;
|
|
624
|
+
layoutSizingVertical: FigmaSizingMode;
|
|
625
|
+
primaryAxisAlignItems: FigmaPrimaryAxisAlign;
|
|
626
|
+
counterAxisAlignItems: FigmaCounterAxisAlign;
|
|
627
|
+
paddingTop: number;
|
|
628
|
+
paddingRight: number;
|
|
629
|
+
paddingBottom: number;
|
|
630
|
+
paddingLeft: number;
|
|
631
|
+
itemSpacing: number;
|
|
632
|
+
layoutWrap?: 'NO_WRAP' | 'WRAP';
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Figma size properties
|
|
636
|
+
*/
|
|
637
|
+
interface FigmaSize {
|
|
638
|
+
width: number;
|
|
639
|
+
height: number;
|
|
640
|
+
minWidth?: number;
|
|
641
|
+
maxWidth?: number;
|
|
642
|
+
minHeight?: number;
|
|
643
|
+
maxHeight?: number;
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Figma text properties
|
|
647
|
+
*/
|
|
648
|
+
interface FigmaTextStyle {
|
|
649
|
+
fontSize: number;
|
|
650
|
+
fontWeight: number;
|
|
651
|
+
textAlignHorizontal: FigmaTextAlign;
|
|
652
|
+
characters: string;
|
|
653
|
+
}
|
|
570
654
|
/**
|
|
571
655
|
* Figma-compatible node structure
|
|
572
|
-
* Based on Figma's
|
|
656
|
+
* Based on Figma's Plugin API structure
|
|
573
657
|
*/
|
|
574
658
|
interface FigmaNode {
|
|
575
659
|
/** Unique identifier */
|
|
@@ -580,13 +664,27 @@ interface FigmaNode {
|
|
|
580
664
|
type: FigmaNodeType;
|
|
581
665
|
/** Visibility */
|
|
582
666
|
visible: boolean;
|
|
583
|
-
/**
|
|
584
|
-
|
|
667
|
+
/** Original Wireweave type */
|
|
668
|
+
wireweaveType?: string;
|
|
669
|
+
/** Original Wireweave attributes */
|
|
670
|
+
wireweaveAttributes?: Record<string, unknown>;
|
|
671
|
+
/** Child nodes */
|
|
672
|
+
children?: FigmaNode[];
|
|
673
|
+
/** Auto Layout properties (for FRAME) */
|
|
674
|
+
autoLayout?: FigmaAutoLayout;
|
|
675
|
+
/** Size properties */
|
|
676
|
+
size?: FigmaSize;
|
|
677
|
+
/** Text properties (for TEXT) */
|
|
678
|
+
textStyle?: FigmaTextStyle;
|
|
679
|
+
/** Background fills */
|
|
680
|
+
fills?: FigmaSolidFill[];
|
|
681
|
+
/** Border strokes */
|
|
682
|
+
strokes?: FigmaStroke[];
|
|
683
|
+
/** Stroke weight */
|
|
684
|
+
strokeWeight?: number;
|
|
685
|
+
/** Corner radius */
|
|
686
|
+
cornerRadius?: number;
|
|
585
687
|
}
|
|
586
|
-
/**
|
|
587
|
-
* Figma node types that we can map to
|
|
588
|
-
*/
|
|
589
|
-
type FigmaNodeType = 'DOCUMENT' | 'CANVAS' | 'FRAME' | 'GROUP' | 'TEXT' | 'RECTANGLE' | 'INSTANCE' | 'COMPONENT';
|
|
590
688
|
/**
|
|
591
689
|
* Figma export result
|
|
592
690
|
*/
|
|
@@ -642,18 +740,21 @@ declare function importFromJson(json: JsonExportResult): JsonNode[];
|
|
|
642
740
|
|
|
643
741
|
/**
|
|
644
742
|
* Figma export functionality
|
|
743
|
+
*
|
|
744
|
+
* Converts Wireweave AST to Figma Plugin API compatible format.
|
|
745
|
+
* The output can be directly used by a Figma plugin to create nodes.
|
|
645
746
|
*/
|
|
646
747
|
|
|
647
|
-
/**
|
|
648
|
-
* Reset Figma ID counter
|
|
649
|
-
*/
|
|
650
748
|
declare function resetFigmaIdCounter(): void;
|
|
651
749
|
/**
|
|
652
750
|
* Export wireframe to Figma-compatible format
|
|
653
751
|
*
|
|
654
|
-
*
|
|
655
|
-
*
|
|
656
|
-
*
|
|
752
|
+
* The output is designed to be directly usable by a Figma plugin.
|
|
753
|
+
* Each node includes:
|
|
754
|
+
* - Auto Layout properties (layoutMode, padding, gap, alignment)
|
|
755
|
+
* - Size properties (width, height, constraints)
|
|
756
|
+
* - Text properties (fontSize, fontWeight, alignment)
|
|
757
|
+
* - Visual properties (fills, strokes, cornerRadius)
|
|
657
758
|
*
|
|
658
759
|
* @param doc - The parsed wireframe document
|
|
659
760
|
* @returns Figma export result
|
|
@@ -844,4 +945,4 @@ interface AnalysisOptions {
|
|
|
844
945
|
*/
|
|
845
946
|
declare function analyze(doc: WireframeDocument, options?: AnalysisOptions): AnalysisResult;
|
|
846
947
|
|
|
847
|
-
export { ATTRIBUTE_MAP, ATTRIBUTE_SPECS, type AccessibilityMetrics, AccordionNode, AlertNode, type AnalysisOptions, type AnalysisResult, AnyNode, type AttributeChange, type AttributeSpec, type AttributeValueType, AvatarNode, BadgeNode, BreadcrumbNode, ButtonNode, COMMON_ATTRIBUTES, COMPONENT_MAP, COMPONENT_SPECS, CardNode, CheckboxNode, ColNode, type ComplexityMetrics, type ComponentCategory, type ComponentSpec, type ComponentStats, ContainerComponentNode, ContainerNode, type ContentAnalysis, DEFAULT_VIEWPORT, DEVICE_PRESETS, DataNode, type DiffChangeType, type DiffOptions, type DiffResult, type DiffSummary, DisplayNode, DividerComponentNode, DrawerNode, DropdownNode, type ExportOptions, FeedbackNode, type FigmaExportResult, type FigmaNode, type FigmaNodeType, FooterNode, GridNode, HeaderNode, IconNode, ImageNode, InputComponentNode, InputNode, type JsonExportResult, type JsonNode, type LayoutAnalysis, LayoutNode, LeafNode, LinkNode, ListNode, MainNode, ModalNode, NODE_TYPE_MAP, NavNode, NavigationNode, type NodeChange, type NodePredicate, NodeType, OverlayNode, PageNode, PlaceholderNode, PopoverNode, type PreviewWrapperOptions, ProgressNode, RadioNode, RowNode, SectionNode, SelectNode, SidebarNode, SliderNode, SpinnerNode, SwitchNode, TableNode, TabsNode, TextContentNode, TextNode, TextareaNode, TitleNode, ToastNode, TooltipNode, type TreeMetrics, VALID_ATTRIBUTE_NAMES, VALID_COMPONENT_NAMES, type ValidationError, type ValidationOptions, type ValidationResult, type ViewportSize, type WalkCallback, WireframeDocument, analyze, areIdentical, calculateViewportScale, cloneNode, contains, countNodes, diff, exportToFigma, exportToFigmaString, exportToJson, exportToJsonString, find, findAll, findByType, getAncestors, getChangeSummary, getDevicePresets, getMaxDepth, getNodeTypes, getValidAttributes, getValidationErrors, hasChildren, importFromJson, isAccordionNode, isAlertNode, isAvatarNode, isBadgeNode, isBreadcrumbNode, isButtonNode, isCardNode, isCheckboxNode, isColNode, isContainerComponentNode, isContainerNode, isDataNode, isDisplayNode, isDividerNode, isDrawerNode, isDropdownNode, isFeedbackNode, isFooterNode, isGridNode, isHeaderNode, isIconNode, isImageNode, isInputComponentNode, isInputNode, isLayoutNode, isLeafNode, isLinkNode, isListNode, isMainNode, isModalNode, isNavNode, isNavigationNode, isNodeType, isOverlayNode, isPageNode, isPlaceholderNode, isPopoverNode, isProgressNode, isRadioNode, isRowNode, isSectionNode, isSelectNode, isSidebarNode, isSliderNode, isSpinnerNode, isSwitchNode, isTableNode, isTabsNode, isTextContentNode, isTextNode, isTextareaNode, isTitleNode, isToastNode, isTooltipNode, isValidAst, isValidAttribute, isValidDevicePreset, mapNodes, parseViewportString, resetFigmaIdCounter, resolveViewport, validate, walk, walkDocument, wrapInPreviewContainer };
|
|
948
|
+
export { ATTRIBUTE_MAP, ATTRIBUTE_SPECS, type AccessibilityMetrics, AccordionNode, AlertNode, type AnalysisOptions, type AnalysisResult, AnyNode, type AttributeChange, type AttributeSpec, type AttributeValueType, AvatarNode, BadgeNode, BreadcrumbNode, ButtonNode, COMMON_ATTRIBUTES, COMPONENT_MAP, COMPONENT_SPECS, CardNode, CheckboxNode, ColNode, type ComplexityMetrics, type ComponentCategory, type ComponentSpec, type ComponentStats, ContainerComponentNode, ContainerNode, type ContentAnalysis, DEFAULT_VIEWPORT, DEVICE_PRESETS, DataNode, type DiffChangeType, type DiffOptions, type DiffResult, type DiffSummary, DisplayNode, DividerComponentNode, DrawerNode, DropdownNode, type ExportOptions, FeedbackNode, type FigmaAutoLayout, type FigmaColor, type FigmaCounterAxisAlign, type FigmaExportResult, type FigmaLayoutMode, type FigmaNode, type FigmaNodeType, type FigmaPrimaryAxisAlign, type FigmaSize, type FigmaSizingMode, type FigmaSolidFill, type FigmaStroke, type FigmaTextAlign, type FigmaTextStyle, FooterNode, GridNode, HeaderNode, IconNode, ImageNode, InputComponentNode, InputNode, type JsonExportResult, type JsonNode, type LayoutAnalysis, LayoutNode, LeafNode, LinkNode, ListNode, MainNode, ModalNode, NODE_TYPE_MAP, NavNode, NavigationNode, type NodeChange, type NodePredicate, NodeType, OverlayNode, PageNode, PlaceholderNode, PopoverNode, type PreviewWrapperOptions, ProgressNode, RadioNode, RowNode, SectionNode, SelectNode, SidebarNode, SliderNode, SpinnerNode, SwitchNode, TableNode, TabsNode, TextContentNode, TextNode, TextareaNode, TitleNode, ToastNode, TooltipNode, type TreeMetrics, VALID_ATTRIBUTE_NAMES, VALID_COMPONENT_NAMES, type ValidationError, type ValidationOptions, type ValidationResult, type ViewportSize, type WalkCallback, WireframeDocument, analyze, areIdentical, calculateViewportScale, cloneNode, contains, countNodes, diff, exportToFigma, exportToFigmaString, exportToJson, exportToJsonString, find, findAll, findByType, getAncestors, getChangeSummary, getDevicePresets, getMaxDepth, getNodeTypes, getValidAttributes, getValidationErrors, hasChildren, importFromJson, isAccordionNode, isAlertNode, isAvatarNode, isBadgeNode, isBreadcrumbNode, isButtonNode, isCardNode, isCheckboxNode, isColNode, isContainerComponentNode, isContainerNode, isDataNode, isDisplayNode, isDividerNode, isDrawerNode, isDropdownNode, isFeedbackNode, isFooterNode, isGridNode, isHeaderNode, isIconNode, isImageNode, isInputComponentNode, isInputNode, isLayoutNode, isLeafNode, isLinkNode, isListNode, isMainNode, isModalNode, isNavNode, isNavigationNode, isNodeType, isOverlayNode, isPageNode, isPlaceholderNode, isPopoverNode, isProgressNode, isRadioNode, isRowNode, isSectionNode, isSelectNode, isSidebarNode, isSliderNode, isSpinnerNode, isSwitchNode, isTableNode, isTabsNode, isTextContentNode, isTextNode, isTextareaNode, isTitleNode, isToastNode, isTooltipNode, isValidAst, isValidAttribute, isValidDevicePreset, mapNodes, parseViewportString, resetFigmaIdCounter, resolveViewport, validate, walk, walkDocument, wrapInPreviewContainer };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AnyNode, a as AccordionNode, b as AlertNode, c as AvatarNode, B as BadgeNode, d as BreadcrumbNode, e as ButtonNode, C as CardNode, f as CheckboxNode, g as ColNode, h as ContainerComponentNode, i as ContainerNode, D as DataNode, j as DisplayNode, k as DividerComponentNode, l as DrawerNode, m as DropdownNode, F as FeedbackNode, n as FooterNode, G as GridNode, H as HeaderNode, I as IconNode, o as ImageNode, p as InputComponentNode, q as InputNode, L as LayoutNode, r as LeafNode, s as LinkNode, t as ListNode, M as MainNode, u as ModalNode, N as NavNode, v as NavigationNode, w as NodeType, O as OverlayNode, P as PageNode, x as PlaceholderNode, y as PopoverNode, z as ProgressNode, R as RadioNode, E as RowNode, S as SectionNode, J as SelectNode, K as SidebarNode, Q as SliderNode, T as SpinnerNode, U as SwitchNode, V as TableNode, W as TabsNode, X as TextContentNode, Y as TextNode, Z as TextareaNode, _ as TitleNode, $ as ToastNode, a0 as TooltipNode, a1 as WireframeDocument } from './types-
|
|
2
|
-
export { a2 as AlertVariant, a3 as AlignValue, a4 as
|
|
1
|
+
import { A as AnyNode, a as AccordionNode, b as AlertNode, c as AvatarNode, B as BadgeNode, d as BreadcrumbNode, e as ButtonNode, C as CardNode, f as CheckboxNode, g as ColNode, h as ContainerComponentNode, i as ContainerNode, D as DataNode, j as DisplayNode, k as DividerComponentNode, l as DrawerNode, m as DropdownNode, F as FeedbackNode, n as FooterNode, G as GridNode, H as HeaderNode, I as IconNode, o as ImageNode, p as InputComponentNode, q as InputNode, L as LayoutNode, r as LeafNode, s as LinkNode, t as ListNode, M as MainNode, u as ModalNode, N as NavNode, v as NavigationNode, w as NodeType, O as OverlayNode, P as PageNode, x as PlaceholderNode, y as PopoverNode, z as ProgressNode, R as RadioNode, E as RowNode, S as SectionNode, J as SelectNode, K as SidebarNode, Q as SliderNode, T as SpinnerNode, U as SwitchNode, V as TableNode, W as TabsNode, X as TextContentNode, Y as TextNode, Z as TextareaNode, _ as TitleNode, $ as ToastNode, a0 as TooltipNode, a1 as WireframeDocument } from './types-EbEsGNxL.js';
|
|
2
|
+
export { a2 as AlertVariant, a3 as AlignValue, a4 as AnchorPosition, a5 as AnnotationItemNode, a6 as AnnotationNode, a7 as AnnotationsNode, a8 as AppearanceProps, a9 as AvatarSize, aa as AvatarSizeToken, ab as BadgeSize, ac as BadgeSizeToken, ad as BadgeVariant, ae as BaseNode, af as BreadcrumbItem, ag as ButtonSize, ah as ButtonSizeToken, ai as ButtonVariant, aj as CommonProps, ak as DirectionValue, al as DividerNode, am as DrawerPosition, an as DropdownItemNode, ao as FlexProps, ap as GridProps, aq as HeightValue, ar as IconSize, as as IconSizeToken, at as InputType, au as InteractiveProps, av as JustifyValue, aw as ListItemNode, ax as MarkerColor, ay as MarkerNode, az as NavBlockItem, aA as NavChild, aB as NavDivider, aC as NavGroupNode, aD as NavItem, aE as Position, aF as PositionProps, aG as RelativeNode, aH as SelectOption, aI as ShadowValue, aJ as SizeProps, aK as SourceLocation, aL as SpacingProps, aM as SpacingValue, aN as SpinnerSize, aO as SpinnerSizeToken, aP as StackNode, aQ as TabNode, aR as TextAlign, aS as TextSize, aT as TextSizeToken, aU as TextWeight, aV as TitleLevel, aW as ToastPosition, aX as TooltipPosition, aY as ValueWithUnit, aZ as WidthValue } from './types-EbEsGNxL.js';
|
|
3
3
|
export { ExpectedToken, ParseError, ParseErrorInfo, ParseOptions, ParseResult, getErrors, isValid, parse, tryParse } from './parser.js';
|
|
4
4
|
export { HtmlRenderer, IconData, IconElement, RenderContext, RenderOptions, RenderResult, SvgRenderOptions, SvgRenderResult, ThemeColors, ThemeConfig, createHtmlRenderer, darkTheme, defaultTheme, generateComponentStyles, generateStyles, getIconData, getTheme, lucideIcons, render, renderIconSvg, renderToHtml, renderToSvg } from './renderer.js';
|
|
5
5
|
|
|
@@ -272,7 +272,7 @@ interface AttributeSpec {
|
|
|
272
272
|
/**
|
|
273
273
|
* Component category
|
|
274
274
|
*/
|
|
275
|
-
type ComponentCategory = 'layout' | 'grid' | 'container' | 'text' | 'input' | 'display' | 'data' | 'feedback' | 'overlay' | 'navigation';
|
|
275
|
+
type ComponentCategory = 'layout' | 'grid' | 'container' | 'text' | 'input' | 'display' | 'data' | 'feedback' | 'overlay' | 'navigation' | 'annotation';
|
|
276
276
|
/**
|
|
277
277
|
* Component definition
|
|
278
278
|
*/
|
|
@@ -567,9 +567,93 @@ interface JsonExportResult {
|
|
|
567
567
|
componentTypes: string[];
|
|
568
568
|
};
|
|
569
569
|
}
|
|
570
|
+
/**
|
|
571
|
+
* Figma node types that we can map to
|
|
572
|
+
*/
|
|
573
|
+
type FigmaNodeType = 'DOCUMENT' | 'CANVAS' | 'FRAME' | 'GROUP' | 'TEXT' | 'RECTANGLE' | 'INSTANCE' | 'COMPONENT';
|
|
574
|
+
/**
|
|
575
|
+
* Figma Auto Layout mode
|
|
576
|
+
*/
|
|
577
|
+
type FigmaLayoutMode = 'NONE' | 'HORIZONTAL' | 'VERTICAL';
|
|
578
|
+
/**
|
|
579
|
+
* Figma sizing mode for Auto Layout
|
|
580
|
+
*/
|
|
581
|
+
type FigmaSizingMode = 'FIXED' | 'HUG' | 'FILL';
|
|
582
|
+
/**
|
|
583
|
+
* Figma primary axis alignment (justify)
|
|
584
|
+
*/
|
|
585
|
+
type FigmaPrimaryAxisAlign = 'MIN' | 'CENTER' | 'MAX' | 'SPACE_BETWEEN';
|
|
586
|
+
/**
|
|
587
|
+
* Figma counter axis alignment (align)
|
|
588
|
+
*/
|
|
589
|
+
type FigmaCounterAxisAlign = 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'BASELINE';
|
|
590
|
+
/**
|
|
591
|
+
* Figma text alignment
|
|
592
|
+
*/
|
|
593
|
+
type FigmaTextAlign = 'LEFT' | 'CENTER' | 'RIGHT' | 'JUSTIFIED';
|
|
594
|
+
/**
|
|
595
|
+
* Figma color (RGBA, 0-1 range)
|
|
596
|
+
*/
|
|
597
|
+
interface FigmaColor {
|
|
598
|
+
r: number;
|
|
599
|
+
g: number;
|
|
600
|
+
b: number;
|
|
601
|
+
a: number;
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Figma solid fill
|
|
605
|
+
*/
|
|
606
|
+
interface FigmaSolidFill {
|
|
607
|
+
type: 'SOLID';
|
|
608
|
+
color: FigmaColor;
|
|
609
|
+
opacity?: number;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Figma stroke
|
|
613
|
+
*/
|
|
614
|
+
interface FigmaStroke {
|
|
615
|
+
type: 'SOLID';
|
|
616
|
+
color: FigmaColor;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Figma Auto Layout properties
|
|
620
|
+
*/
|
|
621
|
+
interface FigmaAutoLayout {
|
|
622
|
+
layoutMode: FigmaLayoutMode;
|
|
623
|
+
layoutSizingHorizontal: FigmaSizingMode;
|
|
624
|
+
layoutSizingVertical: FigmaSizingMode;
|
|
625
|
+
primaryAxisAlignItems: FigmaPrimaryAxisAlign;
|
|
626
|
+
counterAxisAlignItems: FigmaCounterAxisAlign;
|
|
627
|
+
paddingTop: number;
|
|
628
|
+
paddingRight: number;
|
|
629
|
+
paddingBottom: number;
|
|
630
|
+
paddingLeft: number;
|
|
631
|
+
itemSpacing: number;
|
|
632
|
+
layoutWrap?: 'NO_WRAP' | 'WRAP';
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Figma size properties
|
|
636
|
+
*/
|
|
637
|
+
interface FigmaSize {
|
|
638
|
+
width: number;
|
|
639
|
+
height: number;
|
|
640
|
+
minWidth?: number;
|
|
641
|
+
maxWidth?: number;
|
|
642
|
+
minHeight?: number;
|
|
643
|
+
maxHeight?: number;
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Figma text properties
|
|
647
|
+
*/
|
|
648
|
+
interface FigmaTextStyle {
|
|
649
|
+
fontSize: number;
|
|
650
|
+
fontWeight: number;
|
|
651
|
+
textAlignHorizontal: FigmaTextAlign;
|
|
652
|
+
characters: string;
|
|
653
|
+
}
|
|
570
654
|
/**
|
|
571
655
|
* Figma-compatible node structure
|
|
572
|
-
* Based on Figma's
|
|
656
|
+
* Based on Figma's Plugin API structure
|
|
573
657
|
*/
|
|
574
658
|
interface FigmaNode {
|
|
575
659
|
/** Unique identifier */
|
|
@@ -580,13 +664,27 @@ interface FigmaNode {
|
|
|
580
664
|
type: FigmaNodeType;
|
|
581
665
|
/** Visibility */
|
|
582
666
|
visible: boolean;
|
|
583
|
-
/**
|
|
584
|
-
|
|
667
|
+
/** Original Wireweave type */
|
|
668
|
+
wireweaveType?: string;
|
|
669
|
+
/** Original Wireweave attributes */
|
|
670
|
+
wireweaveAttributes?: Record<string, unknown>;
|
|
671
|
+
/** Child nodes */
|
|
672
|
+
children?: FigmaNode[];
|
|
673
|
+
/** Auto Layout properties (for FRAME) */
|
|
674
|
+
autoLayout?: FigmaAutoLayout;
|
|
675
|
+
/** Size properties */
|
|
676
|
+
size?: FigmaSize;
|
|
677
|
+
/** Text properties (for TEXT) */
|
|
678
|
+
textStyle?: FigmaTextStyle;
|
|
679
|
+
/** Background fills */
|
|
680
|
+
fills?: FigmaSolidFill[];
|
|
681
|
+
/** Border strokes */
|
|
682
|
+
strokes?: FigmaStroke[];
|
|
683
|
+
/** Stroke weight */
|
|
684
|
+
strokeWeight?: number;
|
|
685
|
+
/** Corner radius */
|
|
686
|
+
cornerRadius?: number;
|
|
585
687
|
}
|
|
586
|
-
/**
|
|
587
|
-
* Figma node types that we can map to
|
|
588
|
-
*/
|
|
589
|
-
type FigmaNodeType = 'DOCUMENT' | 'CANVAS' | 'FRAME' | 'GROUP' | 'TEXT' | 'RECTANGLE' | 'INSTANCE' | 'COMPONENT';
|
|
590
688
|
/**
|
|
591
689
|
* Figma export result
|
|
592
690
|
*/
|
|
@@ -642,18 +740,21 @@ declare function importFromJson(json: JsonExportResult): JsonNode[];
|
|
|
642
740
|
|
|
643
741
|
/**
|
|
644
742
|
* Figma export functionality
|
|
743
|
+
*
|
|
744
|
+
* Converts Wireweave AST to Figma Plugin API compatible format.
|
|
745
|
+
* The output can be directly used by a Figma plugin to create nodes.
|
|
645
746
|
*/
|
|
646
747
|
|
|
647
|
-
/**
|
|
648
|
-
* Reset Figma ID counter
|
|
649
|
-
*/
|
|
650
748
|
declare function resetFigmaIdCounter(): void;
|
|
651
749
|
/**
|
|
652
750
|
* Export wireframe to Figma-compatible format
|
|
653
751
|
*
|
|
654
|
-
*
|
|
655
|
-
*
|
|
656
|
-
*
|
|
752
|
+
* The output is designed to be directly usable by a Figma plugin.
|
|
753
|
+
* Each node includes:
|
|
754
|
+
* - Auto Layout properties (layoutMode, padding, gap, alignment)
|
|
755
|
+
* - Size properties (width, height, constraints)
|
|
756
|
+
* - Text properties (fontSize, fontWeight, alignment)
|
|
757
|
+
* - Visual properties (fills, strokes, cornerRadius)
|
|
657
758
|
*
|
|
658
759
|
* @param doc - The parsed wireframe document
|
|
659
760
|
* @returns Figma export result
|
|
@@ -844,4 +945,4 @@ interface AnalysisOptions {
|
|
|
844
945
|
*/
|
|
845
946
|
declare function analyze(doc: WireframeDocument, options?: AnalysisOptions): AnalysisResult;
|
|
846
947
|
|
|
847
|
-
export { ATTRIBUTE_MAP, ATTRIBUTE_SPECS, type AccessibilityMetrics, AccordionNode, AlertNode, type AnalysisOptions, type AnalysisResult, AnyNode, type AttributeChange, type AttributeSpec, type AttributeValueType, AvatarNode, BadgeNode, BreadcrumbNode, ButtonNode, COMMON_ATTRIBUTES, COMPONENT_MAP, COMPONENT_SPECS, CardNode, CheckboxNode, ColNode, type ComplexityMetrics, type ComponentCategory, type ComponentSpec, type ComponentStats, ContainerComponentNode, ContainerNode, type ContentAnalysis, DEFAULT_VIEWPORT, DEVICE_PRESETS, DataNode, type DiffChangeType, type DiffOptions, type DiffResult, type DiffSummary, DisplayNode, DividerComponentNode, DrawerNode, DropdownNode, type ExportOptions, FeedbackNode, type FigmaExportResult, type FigmaNode, type FigmaNodeType, FooterNode, GridNode, HeaderNode, IconNode, ImageNode, InputComponentNode, InputNode, type JsonExportResult, type JsonNode, type LayoutAnalysis, LayoutNode, LeafNode, LinkNode, ListNode, MainNode, ModalNode, NODE_TYPE_MAP, NavNode, NavigationNode, type NodeChange, type NodePredicate, NodeType, OverlayNode, PageNode, PlaceholderNode, PopoverNode, type PreviewWrapperOptions, ProgressNode, RadioNode, RowNode, SectionNode, SelectNode, SidebarNode, SliderNode, SpinnerNode, SwitchNode, TableNode, TabsNode, TextContentNode, TextNode, TextareaNode, TitleNode, ToastNode, TooltipNode, type TreeMetrics, VALID_ATTRIBUTE_NAMES, VALID_COMPONENT_NAMES, type ValidationError, type ValidationOptions, type ValidationResult, type ViewportSize, type WalkCallback, WireframeDocument, analyze, areIdentical, calculateViewportScale, cloneNode, contains, countNodes, diff, exportToFigma, exportToFigmaString, exportToJson, exportToJsonString, find, findAll, findByType, getAncestors, getChangeSummary, getDevicePresets, getMaxDepth, getNodeTypes, getValidAttributes, getValidationErrors, hasChildren, importFromJson, isAccordionNode, isAlertNode, isAvatarNode, isBadgeNode, isBreadcrumbNode, isButtonNode, isCardNode, isCheckboxNode, isColNode, isContainerComponentNode, isContainerNode, isDataNode, isDisplayNode, isDividerNode, isDrawerNode, isDropdownNode, isFeedbackNode, isFooterNode, isGridNode, isHeaderNode, isIconNode, isImageNode, isInputComponentNode, isInputNode, isLayoutNode, isLeafNode, isLinkNode, isListNode, isMainNode, isModalNode, isNavNode, isNavigationNode, isNodeType, isOverlayNode, isPageNode, isPlaceholderNode, isPopoverNode, isProgressNode, isRadioNode, isRowNode, isSectionNode, isSelectNode, isSidebarNode, isSliderNode, isSpinnerNode, isSwitchNode, isTableNode, isTabsNode, isTextContentNode, isTextNode, isTextareaNode, isTitleNode, isToastNode, isTooltipNode, isValidAst, isValidAttribute, isValidDevicePreset, mapNodes, parseViewportString, resetFigmaIdCounter, resolveViewport, validate, walk, walkDocument, wrapInPreviewContainer };
|
|
948
|
+
export { ATTRIBUTE_MAP, ATTRIBUTE_SPECS, type AccessibilityMetrics, AccordionNode, AlertNode, type AnalysisOptions, type AnalysisResult, AnyNode, type AttributeChange, type AttributeSpec, type AttributeValueType, AvatarNode, BadgeNode, BreadcrumbNode, ButtonNode, COMMON_ATTRIBUTES, COMPONENT_MAP, COMPONENT_SPECS, CardNode, CheckboxNode, ColNode, type ComplexityMetrics, type ComponentCategory, type ComponentSpec, type ComponentStats, ContainerComponentNode, ContainerNode, type ContentAnalysis, DEFAULT_VIEWPORT, DEVICE_PRESETS, DataNode, type DiffChangeType, type DiffOptions, type DiffResult, type DiffSummary, DisplayNode, DividerComponentNode, DrawerNode, DropdownNode, type ExportOptions, FeedbackNode, type FigmaAutoLayout, type FigmaColor, type FigmaCounterAxisAlign, type FigmaExportResult, type FigmaLayoutMode, type FigmaNode, type FigmaNodeType, type FigmaPrimaryAxisAlign, type FigmaSize, type FigmaSizingMode, type FigmaSolidFill, type FigmaStroke, type FigmaTextAlign, type FigmaTextStyle, FooterNode, GridNode, HeaderNode, IconNode, ImageNode, InputComponentNode, InputNode, type JsonExportResult, type JsonNode, type LayoutAnalysis, LayoutNode, LeafNode, LinkNode, ListNode, MainNode, ModalNode, NODE_TYPE_MAP, NavNode, NavigationNode, type NodeChange, type NodePredicate, NodeType, OverlayNode, PageNode, PlaceholderNode, PopoverNode, type PreviewWrapperOptions, ProgressNode, RadioNode, RowNode, SectionNode, SelectNode, SidebarNode, SliderNode, SpinnerNode, SwitchNode, TableNode, TabsNode, TextContentNode, TextNode, TextareaNode, TitleNode, ToastNode, TooltipNode, type TreeMetrics, VALID_ATTRIBUTE_NAMES, VALID_COMPONENT_NAMES, type ValidationError, type ValidationOptions, type ValidationResult, type ViewportSize, type WalkCallback, WireframeDocument, analyze, areIdentical, calculateViewportScale, cloneNode, contains, countNodes, diff, exportToFigma, exportToFigmaString, exportToJson, exportToJsonString, find, findAll, findByType, getAncestors, getChangeSummary, getDevicePresets, getMaxDepth, getNodeTypes, getValidAttributes, getValidationErrors, hasChildren, importFromJson, isAccordionNode, isAlertNode, isAvatarNode, isBadgeNode, isBreadcrumbNode, isButtonNode, isCardNode, isCheckboxNode, isColNode, isContainerComponentNode, isContainerNode, isDataNode, isDisplayNode, isDividerNode, isDrawerNode, isDropdownNode, isFeedbackNode, isFooterNode, isGridNode, isHeaderNode, isIconNode, isImageNode, isInputComponentNode, isInputNode, isLayoutNode, isLeafNode, isLinkNode, isListNode, isMainNode, isModalNode, isNavNode, isNavigationNode, isNodeType, isOverlayNode, isPageNode, isPlaceholderNode, isPopoverNode, isProgressNode, isRadioNode, isRowNode, isSectionNode, isSelectNode, isSidebarNode, isSliderNode, isSpinnerNode, isSwitchNode, isTableNode, isTabsNode, isTextContentNode, isTextNode, isTextareaNode, isTitleNode, isToastNode, isTooltipNode, isValidAst, isValidAttribute, isValidDevicePreset, mapNodes, parseViewportString, resetFigmaIdCounter, resolveViewport, validate, walk, walkDocument, wrapInPreviewContainer };
|