@wireweave/core 1.1.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 +5151 -2219
- package/dist/index.d.cts +783 -4
- package/dist/index.d.ts +783 -4
- package/dist/index.js +5120 -2216
- package/dist/parser.cjs +1017 -474
- package/dist/parser.d.cts +1 -1
- package/dist/parser.d.ts +1 -1
- package/dist/parser.js +1017 -474
- package/dist/renderer.cjs +1244 -1673
- package/dist/renderer.d.cts +42 -133
- package/dist/renderer.d.ts +42 -133
- package/dist/renderer.js +1244 -1670
- package/dist/{types-DtovIYS6.d.cts → types-lcJzPcR0.d.cts} +40 -2
- package/dist/{types-DtovIYS6.d.ts → types-lcJzPcR0.d.ts} +40 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
2
|
-
export {
|
|
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.js';
|
|
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.js';
|
|
3
3
|
export { ExpectedToken, ParseError, ParseErrorInfo, ParseOptions, ParseResult, getErrors, isValid, parse, tryParse } from './parser.js';
|
|
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.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Type guards for wireweave AST
|
|
@@ -249,4 +249,783 @@ interface PreviewWrapperOptions {
|
|
|
249
249
|
*/
|
|
250
250
|
declare function wrapInPreviewContainer(html: string, viewport: ViewportSize, options?: PreviewWrapperOptions): string;
|
|
251
251
|
|
|
252
|
-
|
|
252
|
+
/**
|
|
253
|
+
* Types for Wireweave DSL Specification
|
|
254
|
+
*/
|
|
255
|
+
/**
|
|
256
|
+
* Attribute value type
|
|
257
|
+
*/
|
|
258
|
+
type AttributeValueType = 'boolean' | 'number' | 'string' | 'string[]' | 'enum';
|
|
259
|
+
/**
|
|
260
|
+
* Attribute definition
|
|
261
|
+
*/
|
|
262
|
+
interface AttributeSpec {
|
|
263
|
+
/** Attribute name */
|
|
264
|
+
name: string;
|
|
265
|
+
/** Value type */
|
|
266
|
+
type: AttributeValueType;
|
|
267
|
+
/** Enum values (if type is 'enum') */
|
|
268
|
+
values?: readonly string[];
|
|
269
|
+
/** Description for documentation */
|
|
270
|
+
description?: string;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Component category
|
|
274
|
+
*/
|
|
275
|
+
type ComponentCategory = 'layout' | 'grid' | 'container' | 'text' | 'input' | 'display' | 'data' | 'feedback' | 'overlay' | 'navigation';
|
|
276
|
+
/**
|
|
277
|
+
* Component definition
|
|
278
|
+
*/
|
|
279
|
+
interface ComponentSpec {
|
|
280
|
+
/** Component name (lowercase, as used in DSL) */
|
|
281
|
+
name: string;
|
|
282
|
+
/** AST node type (PascalCase) */
|
|
283
|
+
nodeType: string;
|
|
284
|
+
/** Component category */
|
|
285
|
+
category: ComponentCategory;
|
|
286
|
+
/** Valid attributes for this component (names only, definitions in ATTRIBUTES) */
|
|
287
|
+
attributes: readonly string[];
|
|
288
|
+
/** Whether this component can have children */
|
|
289
|
+
hasChildren: boolean;
|
|
290
|
+
/** Description for documentation */
|
|
291
|
+
description?: string;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Wireweave DSL Component Definitions
|
|
296
|
+
*
|
|
297
|
+
* Complete list of all valid components in Wireweave DSL.
|
|
298
|
+
* Each component specifies its valid attributes.
|
|
299
|
+
*/
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* All valid components in Wireweave DSL
|
|
303
|
+
*/
|
|
304
|
+
declare const COMPONENT_SPECS: readonly ComponentSpec[];
|
|
305
|
+
/**
|
|
306
|
+
* Set of all valid component names for quick lookup
|
|
307
|
+
*/
|
|
308
|
+
declare const VALID_COMPONENT_NAMES: ReadonlySet<string>;
|
|
309
|
+
/**
|
|
310
|
+
* Map of component name to spec for quick lookup
|
|
311
|
+
*/
|
|
312
|
+
declare const COMPONENT_MAP: ReadonlyMap<string, ComponentSpec>;
|
|
313
|
+
/**
|
|
314
|
+
* Map of AST node type to spec for quick lookup
|
|
315
|
+
*/
|
|
316
|
+
declare const NODE_TYPE_MAP: ReadonlyMap<string, ComponentSpec>;
|
|
317
|
+
/**
|
|
318
|
+
* Get valid attributes for a component (by name or node type)
|
|
319
|
+
*/
|
|
320
|
+
declare function getValidAttributes(componentNameOrType: string): readonly string[] | undefined;
|
|
321
|
+
/**
|
|
322
|
+
* Check if an attribute is valid for a component
|
|
323
|
+
*/
|
|
324
|
+
declare function isValidAttribute(componentNameOrType: string, attributeName: string): boolean;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Wireweave DSL Attribute Definitions
|
|
328
|
+
*
|
|
329
|
+
* Complete list of all valid attributes in Wireweave DSL.
|
|
330
|
+
*/
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* All valid attributes in Wireweave DSL
|
|
334
|
+
*/
|
|
335
|
+
declare const ATTRIBUTE_SPECS: readonly AttributeSpec[];
|
|
336
|
+
/**
|
|
337
|
+
* Set of all valid attribute names for quick lookup
|
|
338
|
+
*/
|
|
339
|
+
declare const VALID_ATTRIBUTE_NAMES: ReadonlySet<string>;
|
|
340
|
+
/**
|
|
341
|
+
* Map of attribute name to spec for quick lookup
|
|
342
|
+
*/
|
|
343
|
+
declare const ATTRIBUTE_MAP: ReadonlyMap<string, AttributeSpec>;
|
|
344
|
+
/**
|
|
345
|
+
* Common attributes available to most components
|
|
346
|
+
*/
|
|
347
|
+
declare const COMMON_ATTRIBUTES: readonly string[];
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Wireweave DSL Validation
|
|
351
|
+
*
|
|
352
|
+
* Validates AST nodes against the DSL specification.
|
|
353
|
+
* Checks that all attributes are valid for their respective components.
|
|
354
|
+
*/
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Validation error details
|
|
358
|
+
*/
|
|
359
|
+
interface ValidationError {
|
|
360
|
+
/** Error message */
|
|
361
|
+
message: string;
|
|
362
|
+
/** Path to the invalid node (e.g., "pages[0].children[1]") */
|
|
363
|
+
path: string;
|
|
364
|
+
/** Node type where error occurred */
|
|
365
|
+
nodeType: string;
|
|
366
|
+
/** Invalid attribute name (if applicable) */
|
|
367
|
+
attribute?: string;
|
|
368
|
+
/** Source location (if available) */
|
|
369
|
+
location?: {
|
|
370
|
+
line: number;
|
|
371
|
+
column: number;
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Validation result
|
|
376
|
+
*/
|
|
377
|
+
interface ValidationResult {
|
|
378
|
+
/** Whether the AST is valid */
|
|
379
|
+
valid: boolean;
|
|
380
|
+
/** List of validation errors */
|
|
381
|
+
errors: ValidationError[];
|
|
382
|
+
/** Summary error message (if invalid) */
|
|
383
|
+
errorSummary?: string;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Validation options
|
|
387
|
+
*/
|
|
388
|
+
interface ValidationOptions {
|
|
389
|
+
/** If true, stop at first error */
|
|
390
|
+
stopOnFirstError?: boolean;
|
|
391
|
+
/** Maximum number of errors to collect */
|
|
392
|
+
maxErrors?: number;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Validate a Wireweave AST document
|
|
396
|
+
*
|
|
397
|
+
* @param ast - The parsed AST document
|
|
398
|
+
* @param options - Validation options
|
|
399
|
+
* @returns Validation result with errors if invalid
|
|
400
|
+
*/
|
|
401
|
+
declare function validate(ast: WireframeDocument, options?: ValidationOptions): ValidationResult;
|
|
402
|
+
/**
|
|
403
|
+
* Quick validation check - returns true if AST has valid attributes
|
|
404
|
+
*
|
|
405
|
+
* @param ast - The parsed AST document
|
|
406
|
+
* @returns true if all attributes are valid
|
|
407
|
+
*/
|
|
408
|
+
declare function isValidAst(ast: WireframeDocument): boolean;
|
|
409
|
+
/**
|
|
410
|
+
* Get all validation errors from an AST
|
|
411
|
+
*
|
|
412
|
+
* @param ast - The parsed AST document
|
|
413
|
+
* @returns Array of validation errors
|
|
414
|
+
*/
|
|
415
|
+
declare function getValidationErrors(ast: WireframeDocument): ValidationError[];
|
|
416
|
+
|
|
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 };
|