@wireweave/core 1.1.0-beta.0 → 1.2.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 +3966 -3278
- package/dist/index.d.cts +616 -2
- package/dist/index.d.ts +616 -2
- package/dist/index.js +3948 -3275
- package/dist/parser.cjs +675 -476
- package/dist/parser.js +675 -476
- package/dist/renderer.cjs +1099 -2759
- package/dist/renderer.d.cts +37 -175
- package/dist/renderer.d.ts +37 -175
- package/dist/renderer.js +1099 -2756
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { A as AnyNode, C as ContainerNode, L as LeafNode, a as LayoutNode, P as PageNode, H as HeaderNode, M as MainNode, F as FooterNode, S as SidebarNode, b as SectionNode, G as GridNode, R as RowNode, c as ColNode, d as ContainerComponentNode, e as CardNode, f as ModalNode, D as DrawerNode, g as AccordionNode, T as TextContentNode, h as TextNode, i as TitleNode, j as LinkNode, I as InputComponentNode, k as InputNode, l as TextareaNode, m as SelectNode, n as CheckboxNode, o as RadioNode, p as SwitchNode, q as SliderNode, B as ButtonNode, r as DisplayNode, s as ImageNode, t as PlaceholderNode, u as AvatarNode, v as BadgeNode, w as IconNode, x as DataNode, y as TableNode, z as ListNode, E as FeedbackNode, J as AlertNode, K as ToastNode, N as ProgressNode, O as SpinnerNode, Q as OverlayNode, U as TooltipNode, V as PopoverNode, W as DropdownNode, X as NavigationNode, Y as NavNode, Z as TabsNode, _ as BreadcrumbNode, $ as DividerComponentNode, a0 as NodeType, a1 as WireframeDocument } from './types-lcJzPcR0.cjs';
|
|
2
2
|
export { ay as AlertVariant, ac as AlignValue, at as AvatarSize, av as BadgeSize, au as BadgeVariant, a4 as BaseNode, aK as BreadcrumbItem, as as ButtonSize, ar as ButtonVariant, ah as CommonProps, ad as DirectionValue, aD as DividerNode, aj as DrawerPosition, aC as DropdownItemNode, ae as FlexProps, af as GridProps, a9 as HeightValue, aw as IconSize, ap as InputType, ab as JustifyValue, ax as ListItemNode, aF as NavBlockItem, aI as NavChild, aH as NavDivider, aG as NavGroupNode, aE as NavItem, a2 as Position, ag as PositionProps, aq as SelectOption, ai as ShadowValue, aa as SizeProps, a3 as SourceLocation, a7 as SpacingProps, a6 as SpacingValue, aA as SpinnerSize, aJ as TabNode, an as TextAlign, al as TextSize, ak as TextSizeToken, am as TextWeight, ao as TitleLevel, az as ToastPosition, aB as TooltipPosition, a5 as ValueWithUnit, a8 as WidthValue } from './types-lcJzPcR0.cjs';
|
|
3
3
|
export { ExpectedToken, ParseError, ParseErrorInfo, ParseOptions, ParseResult, getErrors, isValid, parse, tryParse } from './parser.cjs';
|
|
4
|
-
export { HtmlRenderer, IconData, IconElement, RenderContext, RenderOptions, RenderResult, SvgRenderOptions, SvgRenderResult,
|
|
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
|
|
|
6
6
|
/**
|
|
7
7
|
* Type guards for wireweave AST
|
|
@@ -414,4 +414,618 @@ declare function isValidAst(ast: WireframeDocument): boolean;
|
|
|
414
414
|
*/
|
|
415
415
|
declare function getValidationErrors(ast: WireframeDocument): ValidationError[];
|
|
416
416
|
|
|
417
|
-
|
|
417
|
+
/**
|
|
418
|
+
* UX Rules Type Definitions
|
|
419
|
+
*
|
|
420
|
+
* Types for UX validation rules engine.
|
|
421
|
+
*/
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Severity level of UX issues
|
|
425
|
+
*/
|
|
426
|
+
type UXIssueSeverity = 'error' | 'warning' | 'info';
|
|
427
|
+
/**
|
|
428
|
+
* Category of UX rule
|
|
429
|
+
*/
|
|
430
|
+
type UXRuleCategory = 'accessibility' | 'usability' | 'consistency' | 'touch-target' | 'contrast' | 'navigation' | 'form' | 'feedback';
|
|
431
|
+
/**
|
|
432
|
+
* UX validation issue
|
|
433
|
+
*/
|
|
434
|
+
interface UXIssue {
|
|
435
|
+
/** Unique rule ID */
|
|
436
|
+
ruleId: string;
|
|
437
|
+
/** Rule category */
|
|
438
|
+
category: UXRuleCategory;
|
|
439
|
+
/** Issue severity */
|
|
440
|
+
severity: UXIssueSeverity;
|
|
441
|
+
/** Human-readable message */
|
|
442
|
+
message: string;
|
|
443
|
+
/** Detailed description of the issue */
|
|
444
|
+
description: string;
|
|
445
|
+
/** How to fix the issue */
|
|
446
|
+
suggestion: string;
|
|
447
|
+
/** Path to the problematic node */
|
|
448
|
+
path: string;
|
|
449
|
+
/** Node type where issue occurred */
|
|
450
|
+
nodeType: string;
|
|
451
|
+
/** Source location (if available) */
|
|
452
|
+
location?: {
|
|
453
|
+
line: number;
|
|
454
|
+
column: number;
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* UX validation result
|
|
459
|
+
*/
|
|
460
|
+
interface UXValidationResult {
|
|
461
|
+
/** Whether all checks passed (no errors) */
|
|
462
|
+
valid: boolean;
|
|
463
|
+
/** Total score (0-100) */
|
|
464
|
+
score: number;
|
|
465
|
+
/** Issues found */
|
|
466
|
+
issues: UXIssue[];
|
|
467
|
+
/** Summary by category */
|
|
468
|
+
summary: {
|
|
469
|
+
category: UXRuleCategory;
|
|
470
|
+
passed: number;
|
|
471
|
+
failed: number;
|
|
472
|
+
warnings: number;
|
|
473
|
+
}[];
|
|
474
|
+
/** Summary by severity */
|
|
475
|
+
severityCounts: {
|
|
476
|
+
errors: number;
|
|
477
|
+
warnings: number;
|
|
478
|
+
info: number;
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* UX rule definition
|
|
483
|
+
*/
|
|
484
|
+
interface UXRule {
|
|
485
|
+
/** Unique rule ID */
|
|
486
|
+
id: string;
|
|
487
|
+
/** Rule category */
|
|
488
|
+
category: UXRuleCategory;
|
|
489
|
+
/** Default severity */
|
|
490
|
+
severity: UXIssueSeverity;
|
|
491
|
+
/** Rule name */
|
|
492
|
+
name: string;
|
|
493
|
+
/** Rule description */
|
|
494
|
+
description: string;
|
|
495
|
+
/** Component types this rule applies to (empty = all) */
|
|
496
|
+
appliesTo: string[];
|
|
497
|
+
/** Check function */
|
|
498
|
+
check: (node: AnyNode, context: UXRuleContext) => UXIssue | UXIssue[] | null;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Context provided to rule check functions
|
|
502
|
+
*/
|
|
503
|
+
interface UXRuleContext {
|
|
504
|
+
/** Path to current node */
|
|
505
|
+
path: string;
|
|
506
|
+
/** Parent node (if any) */
|
|
507
|
+
parent: AnyNode | null;
|
|
508
|
+
/** Root document */
|
|
509
|
+
root: AnyNode;
|
|
510
|
+
/** All siblings of current node */
|
|
511
|
+
siblings: AnyNode[];
|
|
512
|
+
/** Index in parent's children */
|
|
513
|
+
index: number;
|
|
514
|
+
/** Depth in tree */
|
|
515
|
+
depth: number;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* UX validation options
|
|
519
|
+
*/
|
|
520
|
+
interface UXValidationOptions {
|
|
521
|
+
/** Categories to check (empty = all) */
|
|
522
|
+
categories?: UXRuleCategory[];
|
|
523
|
+
/** Minimum severity to report */
|
|
524
|
+
minSeverity?: UXIssueSeverity;
|
|
525
|
+
/** Maximum issues to collect */
|
|
526
|
+
maxIssues?: number;
|
|
527
|
+
/** Custom rules to add */
|
|
528
|
+
customRules?: UXRule[];
|
|
529
|
+
/** Rules to disable by ID */
|
|
530
|
+
disabledRules?: string[];
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* UX Rules Index
|
|
535
|
+
*
|
|
536
|
+
* Exports all UX rules organized by category.
|
|
537
|
+
*/
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* All built-in UX rules
|
|
541
|
+
*/
|
|
542
|
+
declare const allRules: UXRule[];
|
|
543
|
+
/**
|
|
544
|
+
* Rules organized by category
|
|
545
|
+
*/
|
|
546
|
+
declare const rulesByCategory: {
|
|
547
|
+
accessibility: UXRule[];
|
|
548
|
+
form: UXRule[];
|
|
549
|
+
'touch-target': UXRule[];
|
|
550
|
+
consistency: UXRule[];
|
|
551
|
+
usability: UXRule[];
|
|
552
|
+
navigation: UXRule[];
|
|
553
|
+
};
|
|
554
|
+
/**
|
|
555
|
+
* Get rules for specific categories
|
|
556
|
+
*/
|
|
557
|
+
declare function getRulesForCategories(categories: string[]): UXRule[];
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* UX Rules Validation Engine
|
|
561
|
+
*
|
|
562
|
+
* Validates wireframe AST against UX best practices.
|
|
563
|
+
* Provides actionable feedback for improving user experience.
|
|
564
|
+
*/
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Validate a wireframe document against UX rules
|
|
568
|
+
*
|
|
569
|
+
* @param ast - The parsed AST document
|
|
570
|
+
* @param options - Validation options
|
|
571
|
+
* @returns Validation result with issues and score
|
|
572
|
+
*/
|
|
573
|
+
declare function validateUX(ast: WireframeDocument, options?: UXValidationOptions): UXValidationResult;
|
|
574
|
+
/**
|
|
575
|
+
* Quick UX validation - returns true if no errors
|
|
576
|
+
*
|
|
577
|
+
* @param ast - The parsed AST document
|
|
578
|
+
* @returns true if no UX errors found
|
|
579
|
+
*/
|
|
580
|
+
declare function isUXValid(ast: WireframeDocument): boolean;
|
|
581
|
+
/**
|
|
582
|
+
* Get UX issues from an AST
|
|
583
|
+
*
|
|
584
|
+
* @param ast - The parsed AST document
|
|
585
|
+
* @param options - Validation options
|
|
586
|
+
* @returns Array of UX issues
|
|
587
|
+
*/
|
|
588
|
+
declare function getUXIssues(ast: WireframeDocument, options?: UXValidationOptions): UXIssue[];
|
|
589
|
+
/**
|
|
590
|
+
* Get UX score for a wireframe (0-100)
|
|
591
|
+
*
|
|
592
|
+
* @param ast - The parsed AST document
|
|
593
|
+
* @returns UX score from 0 to 100
|
|
594
|
+
*/
|
|
595
|
+
declare function getUXScore(ast: WireframeDocument): number;
|
|
596
|
+
/**
|
|
597
|
+
* Format UX validation result as human-readable string
|
|
598
|
+
*/
|
|
599
|
+
declare function formatUXResult(result: UXValidationResult): string;
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Diff Types
|
|
603
|
+
*
|
|
604
|
+
* Types for comparing two wireframe ASTs.
|
|
605
|
+
*/
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Type of change
|
|
609
|
+
*/
|
|
610
|
+
type DiffChangeType = 'added' | 'removed' | 'changed' | 'moved' | 'unchanged';
|
|
611
|
+
/**
|
|
612
|
+
* Change to a specific attribute
|
|
613
|
+
*/
|
|
614
|
+
interface AttributeChange {
|
|
615
|
+
name: string;
|
|
616
|
+
oldValue: unknown;
|
|
617
|
+
newValue: unknown;
|
|
618
|
+
type: 'added' | 'removed' | 'changed';
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* Change to a node
|
|
622
|
+
*/
|
|
623
|
+
interface NodeChange {
|
|
624
|
+
/** Type of change */
|
|
625
|
+
type: DiffChangeType;
|
|
626
|
+
/** Path in the old tree */
|
|
627
|
+
oldPath?: string;
|
|
628
|
+
/** Path in the new tree */
|
|
629
|
+
newPath?: string;
|
|
630
|
+
/** Node type */
|
|
631
|
+
nodeType: string;
|
|
632
|
+
/** Content/label of the node (for identification) */
|
|
633
|
+
label?: string;
|
|
634
|
+
/** Changed attributes (if type is 'changed') */
|
|
635
|
+
attributeChanges?: AttributeChange[];
|
|
636
|
+
/** Child changes (nested) */
|
|
637
|
+
childChanges?: NodeChange[];
|
|
638
|
+
/** Old node (if removed or changed) */
|
|
639
|
+
oldNode?: AnyNode;
|
|
640
|
+
/** New node (if added or changed) */
|
|
641
|
+
newNode?: AnyNode;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Diff result summary
|
|
645
|
+
*/
|
|
646
|
+
interface DiffSummary {
|
|
647
|
+
/** Total nodes in old tree */
|
|
648
|
+
oldNodeCount: number;
|
|
649
|
+
/** Total nodes in new tree */
|
|
650
|
+
newNodeCount: number;
|
|
651
|
+
/** Number of added nodes */
|
|
652
|
+
addedCount: number;
|
|
653
|
+
/** Number of removed nodes */
|
|
654
|
+
removedCount: number;
|
|
655
|
+
/** Number of changed nodes */
|
|
656
|
+
changedCount: number;
|
|
657
|
+
/** Number of moved nodes */
|
|
658
|
+
movedCount: number;
|
|
659
|
+
/** Number of unchanged nodes */
|
|
660
|
+
unchangedCount: number;
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Complete diff result
|
|
664
|
+
*/
|
|
665
|
+
interface DiffResult {
|
|
666
|
+
/** Whether the trees are identical */
|
|
667
|
+
identical: boolean;
|
|
668
|
+
/** Summary statistics */
|
|
669
|
+
summary: DiffSummary;
|
|
670
|
+
/** List of all changes */
|
|
671
|
+
changes: NodeChange[];
|
|
672
|
+
/** Human-readable description of changes */
|
|
673
|
+
description: string;
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Diff options
|
|
677
|
+
*/
|
|
678
|
+
interface DiffOptions {
|
|
679
|
+
/** Ignore attribute changes */
|
|
680
|
+
ignoreAttributes?: boolean;
|
|
681
|
+
/** Specific attributes to ignore */
|
|
682
|
+
ignoreAttributeNames?: string[];
|
|
683
|
+
/** Ignore node order changes */
|
|
684
|
+
ignoreOrder?: boolean;
|
|
685
|
+
/** Maximum depth to compare */
|
|
686
|
+
maxDepth?: number;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Wireframe Diff Engine
|
|
691
|
+
*
|
|
692
|
+
* Compares two wireframe ASTs and identifies differences.
|
|
693
|
+
*/
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Compare two wireframe documents
|
|
697
|
+
*
|
|
698
|
+
* @param oldDoc - The original document
|
|
699
|
+
* @param newDoc - The modified document
|
|
700
|
+
* @param options - Comparison options
|
|
701
|
+
* @returns Diff result with all changes
|
|
702
|
+
*/
|
|
703
|
+
declare function diff(oldDoc: WireframeDocument, newDoc: WireframeDocument, options?: DiffOptions): DiffResult;
|
|
704
|
+
/**
|
|
705
|
+
* Quick check if two documents are identical
|
|
706
|
+
*/
|
|
707
|
+
declare function areIdentical(oldDoc: WireframeDocument, newDoc: WireframeDocument): boolean;
|
|
708
|
+
/**
|
|
709
|
+
* Get a simple change summary string
|
|
710
|
+
*/
|
|
711
|
+
declare function getChangeSummary(oldDoc: WireframeDocument, newDoc: WireframeDocument): string;
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Export Types
|
|
715
|
+
*
|
|
716
|
+
* Types for exporting wireframes to various formats.
|
|
717
|
+
*/
|
|
718
|
+
/**
|
|
719
|
+
* Simplified JSON node structure
|
|
720
|
+
*/
|
|
721
|
+
interface JsonNode {
|
|
722
|
+
/** Node type (e.g., 'page', 'button', 'input') */
|
|
723
|
+
type: string;
|
|
724
|
+
/** Node content or label */
|
|
725
|
+
content?: string;
|
|
726
|
+
/** Node attributes */
|
|
727
|
+
attributes: Record<string, unknown>;
|
|
728
|
+
/** Child nodes */
|
|
729
|
+
children: JsonNode[];
|
|
730
|
+
/** Source location (optional) */
|
|
731
|
+
location?: {
|
|
732
|
+
line: number;
|
|
733
|
+
column: number;
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* JSON export result
|
|
738
|
+
*/
|
|
739
|
+
interface JsonExportResult {
|
|
740
|
+
/** Export format version */
|
|
741
|
+
version: string;
|
|
742
|
+
/** Export format */
|
|
743
|
+
format: 'json';
|
|
744
|
+
/** Exported pages */
|
|
745
|
+
pages: JsonNode[];
|
|
746
|
+
/** Metadata */
|
|
747
|
+
metadata: {
|
|
748
|
+
exportedAt: string;
|
|
749
|
+
sourceFormat: 'wireweave';
|
|
750
|
+
nodeCount: number;
|
|
751
|
+
componentTypes: string[];
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* Figma-compatible node structure
|
|
756
|
+
* Based on Figma's REST API structure
|
|
757
|
+
*/
|
|
758
|
+
interface FigmaNode {
|
|
759
|
+
/** Unique identifier */
|
|
760
|
+
id: string;
|
|
761
|
+
/** Node name */
|
|
762
|
+
name: string;
|
|
763
|
+
/** Node type */
|
|
764
|
+
type: FigmaNodeType;
|
|
765
|
+
/** Visibility */
|
|
766
|
+
visible: boolean;
|
|
767
|
+
/** Node-specific properties */
|
|
768
|
+
[key: string]: unknown;
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Figma node types that we can map to
|
|
772
|
+
*/
|
|
773
|
+
type FigmaNodeType = 'DOCUMENT' | 'CANVAS' | 'FRAME' | 'GROUP' | 'TEXT' | 'RECTANGLE' | 'INSTANCE' | 'COMPONENT';
|
|
774
|
+
/**
|
|
775
|
+
* Figma export result
|
|
776
|
+
*/
|
|
777
|
+
interface FigmaExportResult {
|
|
778
|
+
/** Export format version */
|
|
779
|
+
version: string;
|
|
780
|
+
/** Export format */
|
|
781
|
+
format: 'figma';
|
|
782
|
+
/** Document structure */
|
|
783
|
+
document: FigmaNode;
|
|
784
|
+
/** Component mappings for reference */
|
|
785
|
+
componentMappings: Record<string, string>;
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* Export options
|
|
789
|
+
*/
|
|
790
|
+
interface ExportOptions {
|
|
791
|
+
/** Include source locations */
|
|
792
|
+
includeLocations?: boolean;
|
|
793
|
+
/** Pretty print JSON (with indentation) */
|
|
794
|
+
prettyPrint?: boolean;
|
|
795
|
+
/** Include empty attributes */
|
|
796
|
+
includeEmptyAttributes?: boolean;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* JSON export functionality
|
|
801
|
+
*/
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* Export wireframe to JSON format
|
|
805
|
+
*
|
|
806
|
+
* @param doc - The parsed wireframe document
|
|
807
|
+
* @param options - Export options
|
|
808
|
+
* @returns JSON export result
|
|
809
|
+
*/
|
|
810
|
+
declare function exportToJson(doc: WireframeDocument, options?: ExportOptions): JsonExportResult;
|
|
811
|
+
/**
|
|
812
|
+
* Export wireframe to JSON string
|
|
813
|
+
*
|
|
814
|
+
* @param doc - The parsed wireframe document
|
|
815
|
+
* @param options - Export options
|
|
816
|
+
* @returns JSON string
|
|
817
|
+
*/
|
|
818
|
+
declare function exportToJsonString(doc: WireframeDocument, options?: ExportOptions): string;
|
|
819
|
+
/**
|
|
820
|
+
* Import from JSON format back to simplified structure
|
|
821
|
+
*
|
|
822
|
+
* @param json - JSON export result
|
|
823
|
+
* @returns Simplified page array
|
|
824
|
+
*/
|
|
825
|
+
declare function importFromJson(json: JsonExportResult): JsonNode[];
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* Figma export functionality
|
|
829
|
+
*/
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* Reset Figma ID counter
|
|
833
|
+
*/
|
|
834
|
+
declare function resetFigmaIdCounter(): void;
|
|
835
|
+
/**
|
|
836
|
+
* Export wireframe to Figma-compatible format
|
|
837
|
+
*
|
|
838
|
+
* Note: This creates a structure inspired by Figma's format,
|
|
839
|
+
* but is not directly importable to Figma. It's designed to be
|
|
840
|
+
* used with Figma plugins or as a reference for manual recreation.
|
|
841
|
+
*
|
|
842
|
+
* @param doc - The parsed wireframe document
|
|
843
|
+
* @returns Figma export result
|
|
844
|
+
*/
|
|
845
|
+
declare function exportToFigma(doc: WireframeDocument): FigmaExportResult;
|
|
846
|
+
/**
|
|
847
|
+
* Export wireframe to Figma-compatible JSON string
|
|
848
|
+
*
|
|
849
|
+
* @param doc - The parsed wireframe document
|
|
850
|
+
* @param prettyPrint - Whether to pretty print the output
|
|
851
|
+
* @returns JSON string
|
|
852
|
+
*/
|
|
853
|
+
declare function exportToFigmaString(doc: WireframeDocument, prettyPrint?: boolean): string;
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* Analysis Types for wireweave
|
|
857
|
+
*
|
|
858
|
+
* Type definitions for wireframe analysis and statistics
|
|
859
|
+
*/
|
|
860
|
+
/**
|
|
861
|
+
* Component usage statistics
|
|
862
|
+
*/
|
|
863
|
+
interface ComponentStats {
|
|
864
|
+
/** Component type name */
|
|
865
|
+
type: string;
|
|
866
|
+
/** Number of occurrences */
|
|
867
|
+
count: number;
|
|
868
|
+
/** Percentage of total components */
|
|
869
|
+
percentage: number;
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Tree structure metrics
|
|
873
|
+
*/
|
|
874
|
+
interface TreeMetrics {
|
|
875
|
+
/** Total number of nodes */
|
|
876
|
+
totalNodes: number;
|
|
877
|
+
/** Maximum nesting depth */
|
|
878
|
+
maxDepth: number;
|
|
879
|
+
/** Average nesting depth */
|
|
880
|
+
avgDepth: number;
|
|
881
|
+
/** Number of leaf nodes (no children) */
|
|
882
|
+
leafNodes: number;
|
|
883
|
+
/** Number of container nodes (have children) */
|
|
884
|
+
containerNodes: number;
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* Accessibility metrics
|
|
888
|
+
*/
|
|
889
|
+
interface AccessibilityMetrics {
|
|
890
|
+
/** Overall accessibility score (0-100) */
|
|
891
|
+
score: number;
|
|
892
|
+
/** Number of images with alt text */
|
|
893
|
+
imagesWithAlt: number;
|
|
894
|
+
/** Total number of images */
|
|
895
|
+
totalImages: number;
|
|
896
|
+
/** Number of form inputs with labels */
|
|
897
|
+
inputsWithLabels: number;
|
|
898
|
+
/** Total number of form inputs */
|
|
899
|
+
totalInputs: number;
|
|
900
|
+
/** Number of buttons with accessible text */
|
|
901
|
+
buttonsWithText: number;
|
|
902
|
+
/** Total number of buttons */
|
|
903
|
+
totalButtons: number;
|
|
904
|
+
/** Has proper heading hierarchy */
|
|
905
|
+
hasProperHeadingHierarchy: boolean;
|
|
906
|
+
/** List of accessibility issues found */
|
|
907
|
+
issues: string[];
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Complexity metrics
|
|
911
|
+
*/
|
|
912
|
+
interface ComplexityMetrics {
|
|
913
|
+
/** Overall complexity score (1-10, higher = more complex) */
|
|
914
|
+
score: number;
|
|
915
|
+
/** Complexity level description */
|
|
916
|
+
level: 'simple' | 'moderate' | 'complex' | 'very-complex';
|
|
917
|
+
/** Number of interactive elements */
|
|
918
|
+
interactiveElements: number;
|
|
919
|
+
/** Number of form elements */
|
|
920
|
+
formElements: number;
|
|
921
|
+
/** Number of navigation elements */
|
|
922
|
+
navigationElements: number;
|
|
923
|
+
/** Number of data display elements (tables, lists) */
|
|
924
|
+
dataDisplayElements: number;
|
|
925
|
+
/** Number of feedback elements (alerts, toasts, progress) */
|
|
926
|
+
feedbackElements: number;
|
|
927
|
+
/** Number of layout containers */
|
|
928
|
+
layoutContainers: number;
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Layout analysis
|
|
932
|
+
*/
|
|
933
|
+
interface LayoutAnalysis {
|
|
934
|
+
/** Has header */
|
|
935
|
+
hasHeader: boolean;
|
|
936
|
+
/** Has footer */
|
|
937
|
+
hasFooter: boolean;
|
|
938
|
+
/** Has sidebar */
|
|
939
|
+
hasSidebar: boolean;
|
|
940
|
+
/** Has main content area */
|
|
941
|
+
hasMain: boolean;
|
|
942
|
+
/** Has navigation */
|
|
943
|
+
hasNavigation: boolean;
|
|
944
|
+
/** Number of pages */
|
|
945
|
+
pageCount: number;
|
|
946
|
+
/** Number of modals */
|
|
947
|
+
modalCount: number;
|
|
948
|
+
/** Number of sections */
|
|
949
|
+
sectionCount: number;
|
|
950
|
+
/** Layout pattern detected */
|
|
951
|
+
layoutPattern: string;
|
|
952
|
+
}
|
|
953
|
+
/**
|
|
954
|
+
* Content analysis
|
|
955
|
+
*/
|
|
956
|
+
interface ContentAnalysis {
|
|
957
|
+
/** Total text elements */
|
|
958
|
+
textElements: number;
|
|
959
|
+
/** Total title elements */
|
|
960
|
+
titleElements: number;
|
|
961
|
+
/** Total link elements */
|
|
962
|
+
linkElements: number;
|
|
963
|
+
/** Total image elements */
|
|
964
|
+
imageElements: number;
|
|
965
|
+
/** Has placeholder content */
|
|
966
|
+
hasPlaceholders: boolean;
|
|
967
|
+
/** Number of placeholder elements */
|
|
968
|
+
placeholderCount: number;
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Complete analysis result
|
|
972
|
+
*/
|
|
973
|
+
interface AnalysisResult {
|
|
974
|
+
/** Whether analysis was successful */
|
|
975
|
+
success: boolean;
|
|
976
|
+
/** Error message if failed */
|
|
977
|
+
error?: string;
|
|
978
|
+
/** Summary statistics */
|
|
979
|
+
summary: {
|
|
980
|
+
/** Total component count */
|
|
981
|
+
totalComponents: number;
|
|
982
|
+
/** Number of unique component types */
|
|
983
|
+
uniqueTypes: number;
|
|
984
|
+
/** Most used component type */
|
|
985
|
+
mostUsedType: string;
|
|
986
|
+
/** Complexity level */
|
|
987
|
+
complexityLevel: string;
|
|
988
|
+
/** Accessibility score */
|
|
989
|
+
accessibilityScore: number;
|
|
990
|
+
};
|
|
991
|
+
/** Component usage breakdown */
|
|
992
|
+
components: ComponentStats[];
|
|
993
|
+
/** Tree structure metrics */
|
|
994
|
+
tree: TreeMetrics;
|
|
995
|
+
/** Accessibility metrics */
|
|
996
|
+
accessibility: AccessibilityMetrics;
|
|
997
|
+
/** Complexity metrics */
|
|
998
|
+
complexity: ComplexityMetrics;
|
|
999
|
+
/** Layout analysis */
|
|
1000
|
+
layout: LayoutAnalysis;
|
|
1001
|
+
/** Content analysis */
|
|
1002
|
+
content: ContentAnalysis;
|
|
1003
|
+
}
|
|
1004
|
+
/**
|
|
1005
|
+
* Analysis options
|
|
1006
|
+
*/
|
|
1007
|
+
interface AnalysisOptions {
|
|
1008
|
+
/** Include detailed component breakdown */
|
|
1009
|
+
includeComponentBreakdown?: boolean;
|
|
1010
|
+
/** Include accessibility analysis */
|
|
1011
|
+
includeAccessibility?: boolean;
|
|
1012
|
+
/** Include complexity analysis */
|
|
1013
|
+
includeComplexity?: boolean;
|
|
1014
|
+
/** Include layout analysis */
|
|
1015
|
+
includeLayout?: boolean;
|
|
1016
|
+
/** Include content analysis */
|
|
1017
|
+
includeContent?: boolean;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* Analysis Engine for wireweave
|
|
1022
|
+
*
|
|
1023
|
+
* Provides comprehensive analysis and statistics for wireframe documents
|
|
1024
|
+
*/
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Analyze a wireframe document
|
|
1028
|
+
*/
|
|
1029
|
+
declare function analyze(doc: WireframeDocument, options?: AnalysisOptions): AnalysisResult;
|
|
1030
|
+
|
|
1031
|
+
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, type UXIssue, type UXIssueSeverity, type UXRule, type UXRuleCategory, type UXRuleContext, type UXValidationOptions, type UXValidationResult, VALID_ATTRIBUTE_NAMES, VALID_COMPONENT_NAMES, type ValidationError, type ValidationOptions, type ValidationResult, type ViewportSize, type WalkCallback, WireframeDocument, allRules, analyze, areIdentical, calculateViewportScale, cloneNode, contains, countNodes, diff, exportToFigma, exportToFigmaString, exportToJson, exportToJsonString, find, findAll, findByType, formatUXResult, getAncestors, getChangeSummary, getDevicePresets, getMaxDepth, getNodeTypes, getRulesForCategories, getUXIssues, getUXScore, 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, isUXValid, isValidAst, isValidAttribute, isValidDevicePreset, mapNodes, parseViewportString, resetFigmaIdCounter, resolveViewport, rulesByCategory, validate, validateUX, walk, walkDocument, wrapInPreviewContainer };
|