@fragments-sdk/cli 0.7.9 → 0.7.11

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.
Files changed (106) hide show
  1. package/dist/bin.js +13 -13
  2. package/dist/bin.js.map +1 -1
  3. package/dist/{chunk-CWKQQR6C.js → chunk-57OW43NL.js} +3 -3
  4. package/dist/chunk-57OW43NL.js.map +1 -0
  5. package/dist/{chunk-AA6CAHCZ.js → chunk-7CRC46HV.js} +2 -2
  6. package/dist/chunk-7CRC46HV.js.map +1 -0
  7. package/dist/{chunk-3JPJTU25.js → chunk-CRTN6BIW.js} +5 -5
  8. package/dist/chunk-CRTN6BIW.js.map +1 -0
  9. package/dist/{chunk-LHIIBI6F.js → chunk-M42XIHPV.js} +2 -2
  10. package/dist/{chunk-2EFVPE5Q.js → chunk-TQOGBAOZ.js} +2 -2
  11. package/dist/chunk-TQOGBAOZ.js.map +1 -0
  12. package/dist/core/index.d.ts +1944 -0
  13. package/dist/{core-YAPWXDZW.js → core/index.js} +5 -5
  14. package/dist/defineFragment-C6PFzZyo.d.ts +656 -0
  15. package/dist/{generate-LEBVZCCH.js → generate-ZPERYZLF.js} +4 -4
  16. package/dist/index.d.ts +4 -159
  17. package/dist/index.js +9 -4
  18. package/dist/index.js.map +1 -1
  19. package/dist/{init-4VXL3Q6N.js → init-GID2DXB3.js} +69 -7
  20. package/dist/init-GID2DXB3.js.map +1 -0
  21. package/dist/mcp-bin.js +3 -3
  22. package/dist/{scan-3NYSRF6G.js → scan-BSMLGBX4.js} +5 -5
  23. package/dist/{service-HL6TMP3B.js → service-QACVPR37.js} +3 -3
  24. package/dist/{static-viewer-KLD24I4R.js → static-viewer-2RQD5QLR.js} +3 -3
  25. package/dist/{test-Y7YZOJLE.js → test-36UELXTE.js} +3 -3
  26. package/dist/{tokens-M4FCJKBK.js → tokens-A3BZIQPB.js} +4 -4
  27. package/dist/{viewer-ZWQQ74FV.js → viewer-CNLZQUFO.js} +156 -32
  28. package/dist/viewer-CNLZQUFO.js.map +1 -0
  29. package/package.json +8 -2
  30. package/src/commands/add.ts +1 -1
  31. package/src/commands/init.ts +84 -4
  32. package/src/core/defineFragment.ts +1 -1
  33. package/src/core/figma.ts +1 -1
  34. package/src/core/index.ts +2 -2
  35. package/src/core/loader.ts +3 -3
  36. package/src/core/schema.ts +1 -1
  37. package/src/index.ts +6 -0
  38. package/src/migrate/converter.ts +1 -1
  39. package/src/service/snippet-validation.test.ts +5 -5
  40. package/src/service/snippet-validation.ts +0 -1
  41. package/src/viewer/__tests__/viewer-integration.test.ts +16 -23
  42. package/src/viewer/components/AccessibilityPanel.tsx +1 -1
  43. package/src/viewer/components/ActionsPanel.tsx +1 -1
  44. package/src/viewer/components/App.tsx +563 -166
  45. package/src/viewer/components/BottomPanel.tsx +1 -1
  46. package/src/viewer/components/CodePanel.naming.test.tsx +1 -2
  47. package/src/viewer/components/CodePanel.tsx +1 -2
  48. package/src/viewer/components/CommandPalette.tsx +1 -1
  49. package/src/viewer/components/ComponentGraph.tsx +1 -1
  50. package/src/viewer/components/ComponentHeader.tsx +1 -1
  51. package/src/viewer/components/ContractPanel.tsx +1 -1
  52. package/src/viewer/components/ErrorBoundary.tsx +1 -1
  53. package/src/viewer/components/HealthDashboard.tsx +1 -1
  54. package/src/viewer/components/HmrStatusIndicator.tsx +1 -1
  55. package/src/viewer/components/InteractionsPanel.tsx +1 -1
  56. package/src/viewer/components/IsolatedRender.tsx +1 -1
  57. package/src/viewer/components/KeyboardShortcutsHelp.tsx +1 -1
  58. package/src/viewer/components/LandingPage.tsx +1 -1
  59. package/src/viewer/components/Layout.tsx +16 -13
  60. package/src/viewer/components/LeftSidebar.tsx +105 -18
  61. package/src/viewer/components/MultiViewportPreview.tsx +1 -1
  62. package/src/viewer/components/PreviewArea.tsx +22 -13
  63. package/src/viewer/components/PreviewFrameHost.tsx +0 -4
  64. package/src/viewer/components/PreviewToolbar.tsx +1 -1
  65. package/src/viewer/components/PropsEditor.tsx +1 -1
  66. package/src/viewer/components/PropsTable.tsx +1 -1
  67. package/src/viewer/components/RightSidebar.tsx +1 -1
  68. package/src/viewer/components/ScreenshotButton.tsx +1 -1
  69. package/src/viewer/components/SkeletonLoader.tsx +1 -1
  70. package/src/viewer/components/Toast.tsx +2 -2
  71. package/src/viewer/components/TokenStylePanel.tsx +1 -1
  72. package/src/viewer/components/VariantMatrix.tsx +1 -1
  73. package/src/viewer/components/VariantTabs.tsx +1 -1
  74. package/src/viewer/components/ViewportSelector.tsx +1 -1
  75. package/src/viewer/constants/ui.ts +14 -0
  76. package/src/viewer/entry.tsx +3 -4
  77. package/src/viewer/hooks/useKeyboardShortcuts.ts +65 -17
  78. package/src/viewer/hooks/useViewSettings.ts +1 -2
  79. package/src/viewer/index.ts +1 -1
  80. package/src/viewer/preview-frame.html +6 -9
  81. package/src/viewer/server.ts +106 -9
  82. package/src/viewer/styles/globals.css +12 -51
  83. package/src/viewer/vendor/shared/src/DocsHeaderBar.tsx +110 -0
  84. package/src/viewer/vendor/shared/src/DocsPageAsideHost.tsx +89 -0
  85. package/src/viewer/vendor/shared/src/DocsPageShell.tsx +119 -0
  86. package/src/viewer/vendor/shared/src/DocsSearchCommand.tsx +134 -0
  87. package/src/viewer/vendor/shared/src/DocsSidebarNav.tsx +66 -0
  88. package/src/viewer/vendor/shared/src/docs-layout.scss +28 -0
  89. package/src/viewer/vendor/shared/src/docs-layout.scss.d.ts +2 -0
  90. package/src/viewer/vendor/shared/src/index.ts +26 -0
  91. package/src/viewer/vendor/shared/src/types.ts +41 -0
  92. package/src/viewer/vite-plugin.ts +70 -9
  93. package/dist/chunk-2EFVPE5Q.js.map +0 -1
  94. package/dist/chunk-3JPJTU25.js.map +0 -1
  95. package/dist/chunk-AA6CAHCZ.js.map +0 -1
  96. package/dist/chunk-CWKQQR6C.js.map +0 -1
  97. package/dist/init-4VXL3Q6N.js.map +0 -1
  98. package/dist/viewer-ZWQQ74FV.js.map +0 -1
  99. /package/dist/{chunk-LHIIBI6F.js.map → chunk-M42XIHPV.js.map} +0 -0
  100. /package/dist/{core-YAPWXDZW.js.map → core/index.js.map} +0 -0
  101. /package/dist/{generate-LEBVZCCH.js.map → generate-ZPERYZLF.js.map} +0 -0
  102. /package/dist/{scan-3NYSRF6G.js.map → scan-BSMLGBX4.js.map} +0 -0
  103. /package/dist/{service-HL6TMP3B.js.map → service-QACVPR37.js.map} +0 -0
  104. /package/dist/{static-viewer-KLD24I4R.js.map → static-viewer-2RQD5QLR.js.map} +0 -0
  105. /package/dist/{test-Y7YZOJLE.js.map → test-36UELXTE.js.map} +0 -0
  106. /package/dist/{tokens-M4FCJKBK.js.map → tokens-A3BZIQPB.js.map} +0 -0
@@ -0,0 +1,1944 @@
1
+ import { b as FragmentDefinition, c as FigmaStringMapping, e as FigmaBooleanMapping, f as FigmaEnumMapping, g as FigmaInstanceMapping, h as FigmaChildrenMapping, i as FigmaTextContentMapping, R as RelationshipType } from '../defineFragment-C6PFzZyo.js';
2
+ export { A as AIMetadata, H as BaselineInfo, B as BlockDefinition, G as BoundingBox, t as CompiledRecipe, n as ComponentRelation, C as ControlType, D as DiffResult, K as FigmaPropMapping, j as FragmentComponent, u as FragmentContract, v as FragmentGenerated, k as FragmentMeta, l as FragmentUsage, q as FragmentVariant, F as FragmentsConfig, W as InferProps, M as Manifest, o as PlayFunction, p as PlayFunctionContext, m as PropDefinition, P as PropType, s as RecipeDefinition, r as RegistryOptions, z as Screenshot, w as ScreenshotConfig, E as ScreenshotMetadata, x as ServiceConfig, S as SnippetPolicyConfig, T as Theme, L as TokenConfig, V as VariantLoader, I as VerifyRequest, J as VerifyResult, y as Viewport, O as compileBlock, N as compileFragment, U as compileRecipe, a as defineBlock, d as defineFragment, Q as defineRecipe } from '../defineFragment-C6PFzZyo.js';
3
+ import { z } from 'zod';
4
+ import { ComponentType, ReactNode } from 'react';
5
+ export { ContextOptions, ContextResult, generateContext } from '@fragments-sdk/context/generate';
6
+ import { ComponentGraph } from '@fragments-sdk/context/graph';
7
+ import { CompiledFragment } from '@fragments-sdk/context/types';
8
+ export { CompiledBlock, CompiledFragment, CompiledFragmentsFile, CompiledTokenData, CompiledTokenEntry } from '@fragments-sdk/context/types';
9
+ import { toId as toId$1, storyNameFromExport as storyNameFromExport$1, isExportStory as isExportStory$1 } from '@storybook/csf';
10
+
11
+ declare const toId: typeof toId$1;
12
+ declare const storyNameFromExport: typeof storyNameFromExport$1;
13
+ declare const isExportStory: typeof isExportStory$1;
14
+
15
+ /**
16
+ * Runtime adapter for converting Storybook CSF modules to Fragment definitions.
17
+ *
18
+ * This operates on IMPORTED modules at runtime, not source code parsing.
19
+ * By leveraging Vite's module system, we get 100% accurate render functions
20
+ * without any regex or AST parsing complexity.
21
+ *
22
+ * Supports Storybook 8.x with both CSF2 (Template.bind) and CSF3 (object stories).
23
+ */
24
+
25
+ /**
26
+ * Storybook decorator function signature
27
+ */
28
+ type Decorator = (Story: () => ReactNode, context: StoryContext) => ReactNode;
29
+ /**
30
+ * Storybook loader function signature
31
+ */
32
+ type Loader = (context: StoryContext) => Promise<Record<string, unknown>>;
33
+ /**
34
+ * Storybook play function signature (internal, extends StoryContext)
35
+ */
36
+ type StorybookPlayFunction = (context: StorybookPlayFunctionContext) => Promise<void>;
37
+ /**
38
+ * Context passed to Storybook play functions (extends StoryContext for compatibility)
39
+ */
40
+ interface StorybookPlayFunctionContext extends StoryContext {
41
+ canvasElement: HTMLElement;
42
+ step: (name: string, fn: () => Promise<void>) => Promise<void>;
43
+ }
44
+ /**
45
+ * Context passed to decorators and render functions
46
+ */
47
+ interface StoryContext {
48
+ args: Record<string, unknown>;
49
+ argTypes: Record<string, StoryArgType>;
50
+ globals: Record<string, unknown>;
51
+ parameters: Record<string, unknown>;
52
+ id: string;
53
+ kind: string;
54
+ name: string;
55
+ story: string;
56
+ viewMode: "story" | "docs";
57
+ loaded: Record<string, unknown>;
58
+ abortSignal: AbortSignal;
59
+ componentId: string;
60
+ title: string;
61
+ }
62
+ /**
63
+ * Storybook Meta (default export)
64
+ */
65
+ interface StoryMeta {
66
+ title?: string;
67
+ component?: ComponentType<unknown>;
68
+ subcomponents?: Record<string, ComponentType<unknown>>;
69
+ tags?: string[];
70
+ parameters?: Record<string, unknown> & {
71
+ docs?: {
72
+ description?: {
73
+ component?: string;
74
+ };
75
+ };
76
+ };
77
+ argTypes?: Record<string, StoryArgType>;
78
+ args?: Record<string, unknown>;
79
+ decorators?: Decorator[];
80
+ loaders?: Loader[];
81
+ render?: (args: Record<string, unknown>, context?: StoryContext) => ReactNode;
82
+ includeStories?: string[] | RegExp;
83
+ excludeStories?: string[] | RegExp;
84
+ }
85
+ /**
86
+ * Storybook argType definition
87
+ */
88
+ interface StoryArgType {
89
+ control?: string | false | {
90
+ type: string;
91
+ min?: number;
92
+ max?: number;
93
+ step?: number;
94
+ presetColors?: string[];
95
+ };
96
+ options?: string[];
97
+ description?: string;
98
+ table?: {
99
+ defaultValue?: {
100
+ summary: string;
101
+ };
102
+ type?: {
103
+ summary: string;
104
+ };
105
+ category?: string;
106
+ subcategory?: string;
107
+ disable?: boolean;
108
+ };
109
+ type?: {
110
+ name: string;
111
+ required?: boolean;
112
+ };
113
+ name?: string;
114
+ defaultValue?: unknown;
115
+ if?: {
116
+ arg?: string;
117
+ exists?: boolean;
118
+ };
119
+ mapping?: Record<string, unknown>;
120
+ action?: string;
121
+ }
122
+ /**
123
+ * Storybook Story export (CSF3)
124
+ */
125
+ interface Story {
126
+ args?: Record<string, unknown>;
127
+ argTypes?: Record<string, StoryArgType>;
128
+ render?: (args: Record<string, unknown>, context?: StoryContext) => ReactNode;
129
+ decorators?: Decorator[];
130
+ loaders?: Loader[];
131
+ play?: StorybookPlayFunction;
132
+ parameters?: Record<string, unknown> & {
133
+ docs?: {
134
+ description?: {
135
+ story?: string;
136
+ };
137
+ };
138
+ };
139
+ name?: string;
140
+ storyName?: string;
141
+ tags?: string[];
142
+ }
143
+ /**
144
+ * CSF2 story function (from Template.bind({})) with args attached
145
+ */
146
+ type CSF2Story = ((args: Record<string, unknown>) => ReactNode) & {
147
+ args?: Record<string, unknown>;
148
+ argTypes?: Record<string, StoryArgType>;
149
+ decorators?: Decorator[];
150
+ loaders?: Loader[];
151
+ play?: StorybookPlayFunction;
152
+ parameters?: Record<string, unknown>;
153
+ storyName?: string;
154
+ };
155
+ /**
156
+ * A complete Storybook module with default meta and named story exports
157
+ */
158
+ interface StoryModule {
159
+ default: StoryMeta;
160
+ [exportName: string]: Story | CSF2Story | StoryMeta | unknown;
161
+ }
162
+ /**
163
+ * Global configuration from preview.tsx
164
+ */
165
+ interface PreviewConfig {
166
+ decorators?: Decorator[];
167
+ parameters?: Record<string, unknown>;
168
+ globalTypes?: Record<string, unknown>;
169
+ args?: Record<string, unknown>;
170
+ argTypes?: Record<string, StoryArgType>;
171
+ loaders?: Loader[];
172
+ }
173
+ /**
174
+ * Set the global preview configuration loaded from .storybook/preview.tsx
175
+ */
176
+ declare function setPreviewConfig(config: PreviewConfig): void;
177
+ /**
178
+ * Get the current global preview configuration
179
+ */
180
+ declare function getPreviewConfig(): PreviewConfig;
181
+ /**
182
+ * Convert a Storybook module to a Fragment definition at runtime.
183
+ *
184
+ * @param storyModule - The imported Storybook module
185
+ * @param filePath - File path for metadata extraction
186
+ * @returns A complete FragmentDefinition ready for the viewer
187
+ */
188
+ declare function storyModuleToFragment(storyModule: StoryModule, filePath: string): FragmentDefinition | null;
189
+
190
+ /**
191
+ * TypeScript types for Fragment JSON files.
192
+ * These types correspond to the JSON schemas in ./schema/
193
+ */
194
+ /**
195
+ * Figma design links and mappings
196
+ */
197
+ interface FragmentFigma {
198
+ /** Figma file URL */
199
+ file?: string;
200
+ /** Default Figma node ID for this component */
201
+ nodeId?: string;
202
+ /** Mapping of variant names to Figma node IDs */
203
+ variants?: Record<string, string>;
204
+ }
205
+ /**
206
+ * Anti-pattern with optional alternative
207
+ */
208
+ interface FragmentDoNotItem {
209
+ /** What not to do */
210
+ text: string;
211
+ /** Component name to use instead */
212
+ instead?: string;
213
+ }
214
+ /**
215
+ * Usage pattern with code example
216
+ */
217
+ interface FragmentPattern {
218
+ /** Pattern name */
219
+ name: string;
220
+ /** Code example */
221
+ code: string;
222
+ /** When to use this pattern */
223
+ description?: string;
224
+ }
225
+ /**
226
+ * Usage guidelines for AI agents and developers
227
+ */
228
+ interface FragmentUsage {
229
+ /** Scenarios when this component should be used */
230
+ when?: string[];
231
+ /** Anti-patterns and what to use instead */
232
+ doNot?: (string | FragmentDoNotItem)[];
233
+ /** Common usage patterns with code examples */
234
+ patterns?: FragmentPattern[];
235
+ }
236
+ /**
237
+ * Accessibility requirements and guidelines
238
+ */
239
+ interface FragmentAccessibility {
240
+ /** ARIA role this component implements */
241
+ role?: string;
242
+ /** Accessibility requirements */
243
+ requirements?: string[];
244
+ /** Keyboard interaction patterns (key -> description) */
245
+ keyboard?: Record<string, string>;
246
+ }
247
+ /**
248
+ * Relationships to other components
249
+ */
250
+ interface FragmentRelated {
251
+ /** Similar components that might be alternatives */
252
+ similar?: string[];
253
+ /** Components commonly used together with this one */
254
+ composedWith?: string[];
255
+ /** Parent components or patterns where this is commonly used */
256
+ usedIn?: string[];
257
+ }
258
+ /**
259
+ * Administrative metadata
260
+ */
261
+ interface FragmentMeta {
262
+ /** Team or person responsible for this component */
263
+ owner?: string;
264
+ /** Component lifecycle status */
265
+ status?: "draft" | "experimental" | "beta" | "stable" | "deprecated";
266
+ /** Version when this component was introduced */
267
+ since?: string;
268
+ /** Version when this component was deprecated */
269
+ deprecatedSince?: string;
270
+ /** Why this component was deprecated and what to use instead */
271
+ deprecatedReason?: string;
272
+ /** Tags for categorization and search */
273
+ tags?: string[];
274
+ }
275
+ /**
276
+ * Fragment JSON file structure (.fragment.json)
277
+ * Contains enrichment metadata for a component
278
+ */
279
+ interface Fragment {
280
+ /** JSON Schema reference */
281
+ $schema?: string;
282
+ /** Component name (must match the component export name) */
283
+ name: string;
284
+ /** Brief description of the component's purpose */
285
+ description?: string;
286
+ /** Figma design links and mappings */
287
+ figma?: FragmentFigma;
288
+ /** Usage guidelines for AI agents and developers */
289
+ usage?: FragmentUsage;
290
+ /** Accessibility requirements and guidelines */
291
+ accessibility?: FragmentAccessibility;
292
+ /** Relationships to other components */
293
+ related?: FragmentRelated;
294
+ /** Administrative metadata */
295
+ meta?: FragmentMeta;
296
+ }
297
+ /**
298
+ * Prop entry in the registry
299
+ */
300
+ interface RegistryPropEntry {
301
+ /** TypeScript type (e.g., 'string', 'boolean', enum values) */
302
+ type?: string;
303
+ /** Simplified type category */
304
+ typeKind?: "string" | "number" | "boolean" | "enum" | "object" | "array" | "function" | "node" | "element" | "union" | "unknown";
305
+ /** For enum types, the allowed values */
306
+ options?: string[];
307
+ /** Default value if specified */
308
+ default?: unknown;
309
+ /** Whether this prop is required */
310
+ required?: boolean;
311
+ /** Prop description from JSDoc or TypeScript */
312
+ description?: string;
313
+ }
314
+ /**
315
+ * Component entry in the registry (simplified - focuses on paths and enrichment)
316
+ */
317
+ interface RegistryComponentEntry {
318
+ /** Relative path to the component source file */
319
+ path: string;
320
+ /** Relative path to the .fragment.json file (if exists) */
321
+ fragmentPath?: string;
322
+ /** Relative path to the .stories.tsx file (if exists) */
323
+ storyPath?: string;
324
+ /** Component category (inferred from directory or fragment) */
325
+ category?: string;
326
+ /** Component lifecycle status (from fragment) */
327
+ status?: "draft" | "experimental" | "beta" | "stable" | "deprecated";
328
+ /** Component description (from fragment or JSDoc) */
329
+ description?: string;
330
+ /** Has human-authored enrichment (fragment file exists with content beyond skeleton) */
331
+ hasEnrichment?: boolean;
332
+ /** Extracted prop definitions - only included if config.registry.includeProps is true */
333
+ props?: Record<string, RegistryPropEntry>;
334
+ /** Named exports from the component file */
335
+ exports?: string[];
336
+ /** Component dependencies (other components used) */
337
+ dependencies?: string[];
338
+ /** Merged fragment enrichment data - only included if config.registry.embedFragments is true */
339
+ fragment?: Fragment;
340
+ }
341
+ /**
342
+ * Minimal component index (.fragments/index.json)
343
+ * Ultra-light name → path mapping for quick lookups
344
+ */
345
+ interface FragmentIndex {
346
+ /** Schema version */
347
+ version: string;
348
+ /** When this index was generated */
349
+ generatedAt: string;
350
+ /** Simple name → path mapping */
351
+ components: Record<string, string>;
352
+ /** Categories for grouping */
353
+ categories?: Record<string, string[]>;
354
+ }
355
+ /**
356
+ * Registry file structure (.fragments/registry.json)
357
+ * Component index with resolved paths and optional metadata
358
+ */
359
+ interface FragmentRegistry {
360
+ /** JSON Schema reference */
361
+ $schema?: string;
362
+ /** Schema version */
363
+ version: string;
364
+ /** When this registry was generated */
365
+ generatedAt: string;
366
+ /** Component count for quick reference */
367
+ componentCount: number;
368
+ /** Component index keyed by component name */
369
+ components: Record<string, RegistryComponentEntry>;
370
+ /** Components grouped by category */
371
+ categories?: Record<string, string[]>;
372
+ }
373
+ /**
374
+ * Context file options for generation
375
+ */
376
+ interface FragmentContextOptions {
377
+ /** Output format */
378
+ format?: "markdown" | "json";
379
+ /** Compact mode - minimal output for token efficiency */
380
+ compact?: boolean;
381
+ /** What to include in the output */
382
+ include?: {
383
+ /** Include prop details (default: true) */
384
+ props?: boolean;
385
+ /** Include code examples (default: false) */
386
+ code?: boolean;
387
+ /** Include related components (default: true) */
388
+ relations?: boolean;
389
+ };
390
+ }
391
+
392
+ /**
393
+ * Brand constants for easy rebranding if domain availability requires it.
394
+ * All naming throughout the codebase should reference these constants.
395
+ */
396
+ declare const BRAND: {
397
+ /** Display name (e.g., "Fragments") */
398
+ readonly name: "Fragments";
399
+ /** Lowercase name for file paths and CLI (e.g., "fragments") */
400
+ readonly nameLower: "fragments";
401
+ /** File extension for fragment definition files (e.g., ".fragment.tsx") */
402
+ readonly fileExtension: ".fragment.tsx";
403
+ /** Legacy file extension for segments (still supported for migration) */
404
+ readonly legacyFileExtension: ".segment.tsx";
405
+ /** JSON file extension for compiled output */
406
+ readonly jsonExtension: ".fragment.json";
407
+ /** Default output file name (e.g., "fragments.json") */
408
+ readonly outFile: "fragments.json";
409
+ /** Config file name (e.g., "fragments.config.ts") */
410
+ readonly configFile: "fragments.config.ts";
411
+ /** Legacy config file name (still supported for migration) */
412
+ readonly legacyConfigFile: "segments.config.ts";
413
+ /** CLI command name (e.g., "fragments") */
414
+ readonly cliCommand: "fragments";
415
+ /** Package scope (e.g., "@fragments") */
416
+ readonly packageScope: "@fragments";
417
+ /** Directory for storing fragments, registry, and cache */
418
+ readonly dataDir: ".fragments";
419
+ /** Components subdirectory within .fragments/ */
420
+ readonly componentsDir: "components";
421
+ /** Registry file name */
422
+ readonly registryFile: "registry.json";
423
+ /** Context file name (AI-ready markdown) */
424
+ readonly contextFile: "context.md";
425
+ /** Screenshots subdirectory */
426
+ readonly screenshotsDir: "screenshots";
427
+ /** Cache subdirectory (gitignored) */
428
+ readonly cacheDir: "cache";
429
+ /** Diff output subdirectory (gitignored) */
430
+ readonly diffDir: "diff";
431
+ /** Manifest filename */
432
+ readonly manifestFile: "manifest.json";
433
+ /** Prefix for localStorage keys (e.g., "fragments-") */
434
+ readonly storagePrefix: "fragments-";
435
+ /** Static viewer HTML file name */
436
+ readonly viewerHtmlFile: "fragments-viewer.html";
437
+ /** MCP tool name prefix (e.g., "fragments_") */
438
+ readonly mcpToolPrefix: "fragments_";
439
+ /** File extension for block definition files */
440
+ readonly blockFileExtension: ".block.ts";
441
+ /** @deprecated Use blockFileExtension instead */
442
+ readonly recipeFileExtension: ".recipe.ts";
443
+ /** Vite plugin namespace */
444
+ readonly vitePluginNamespace: "fragments-core-shim";
445
+ };
446
+ type Brand = typeof BRAND;
447
+ /**
448
+ * Default configuration values for the service.
449
+ * These can be overridden in fragments.config.ts
450
+ */
451
+ declare const DEFAULTS: {
452
+ /** Default viewport dimensions */
453
+ readonly viewport: {
454
+ readonly width: 1280;
455
+ readonly height: 800;
456
+ };
457
+ /** Default diff threshold (percentage) */
458
+ readonly diffThreshold: 5;
459
+ /** Browser pool size */
460
+ readonly poolSize: 3;
461
+ /** Idle timeout before browser shutdown (ms) - 5 minutes */
462
+ readonly idleTimeoutMs: number;
463
+ /** Delay after render before capture (ms) */
464
+ readonly captureDelayMs: 100;
465
+ /** Font loading timeout (ms) */
466
+ readonly fontTimeoutMs: 3000;
467
+ /** Default theme */
468
+ readonly theme: "light";
469
+ /** Dev server port */
470
+ readonly port: 6006;
471
+ };
472
+ type Defaults = typeof DEFAULTS;
473
+
474
+ /**
475
+ * Design Token Types for Fragments
476
+ *
477
+ * These types define the structure for CSS custom property (CSS variable) discovery,
478
+ * parsing, and reverse lookup capabilities. The token system enables:
479
+ *
480
+ * 1. Automatic discovery of design tokens from CSS/SCSS files
481
+ * 2. Reverse lookup: given a computed value, find which token(s) produce it
482
+ * 3. Detection of hardcoded values vs token usage
483
+ * 4. AI-friendly fix suggestions
484
+ */
485
+ /**
486
+ * Token categories for grouping and filtering
487
+ */
488
+ type TokenCategory = "color" | "spacing" | "typography" | "radius" | "shadow" | "sizing" | "border" | "animation" | "z-index" | "other";
489
+ /**
490
+ * A single design token (CSS custom property)
491
+ */
492
+ interface DesignToken {
493
+ /** Token name with leading dashes (e.g., "--color-primary") */
494
+ name: string;
495
+ /** Raw value as written in CSS (e.g., "var(--color-cobalt-50)") */
496
+ rawValue: string;
497
+ /** Fully resolved value (e.g., "#0051c2") */
498
+ resolvedValue: string;
499
+ /** Inferred category based on naming convention */
500
+ category: TokenCategory;
501
+ /**
502
+ * Token level in the design system hierarchy:
503
+ * - 1 = Base/primitive tokens (raw values like colors, sizes)
504
+ * - 2 = Semantic tokens (references to base tokens with meaning)
505
+ * - 3 = Component tokens (component-specific tokens)
506
+ */
507
+ level: 1 | 2 | 3;
508
+ /**
509
+ * Reference chain showing how the value was resolved
510
+ * e.g., ["--color-primary", "--color-cobalt-50"] means
511
+ * --color-primary references --color-cobalt-50
512
+ */
513
+ referenceChain: string[];
514
+ /** Source file where this token was defined */
515
+ sourceFile: string;
516
+ /** Line number in source file */
517
+ lineNumber?: number;
518
+ /** Theme this token belongs to (e.g., "default", "dark", "light") */
519
+ theme: string;
520
+ /** CSS selector where this token is defined (e.g., ":root", "[data-theme='dark']") */
521
+ selector: string;
522
+ /** Optional description from comments */
523
+ description?: string;
524
+ }
525
+ /**
526
+ * Token registry for fast lookups
527
+ */
528
+ interface TokenRegistry {
529
+ /** Lookup by token name (e.g., "--color-primary") */
530
+ byName: Map<string, DesignToken>;
531
+ /**
532
+ * REVERSE lookup: resolved value -> token names
533
+ * Key is normalized value (e.g., "#0051c2" lowercase)
534
+ * Value is array of token names that resolve to this value
535
+ */
536
+ byValue: Map<string, string[]>;
537
+ /** Tokens grouped by theme */
538
+ byTheme: Map<string, DesignToken[]>;
539
+ /** Tokens grouped by category */
540
+ byCategory: Map<TokenCategory, DesignToken[]>;
541
+ /** Registry metadata */
542
+ meta: TokenRegistryMeta;
543
+ }
544
+ /**
545
+ * Token registry metadata
546
+ */
547
+ interface TokenRegistryMeta {
548
+ /** When tokens were discovered */
549
+ discoveredAt: Date;
550
+ /** Source files that were parsed */
551
+ sourceFiles: string[];
552
+ /** Total number of tokens discovered */
553
+ totalTokens: number;
554
+ /** Time taken to parse (ms) */
555
+ parseTimeMs: number;
556
+ /** Number of circular references detected */
557
+ circularRefs: number;
558
+ /** Number of unresolved references */
559
+ unresolvedRefs: number;
560
+ }
561
+ /**
562
+ * Enhanced style diff item with token information
563
+ */
564
+ interface EnhancedStyleDiffItem {
565
+ /** CSS property name (e.g., "backgroundColor") */
566
+ property: string;
567
+ /** Value from Figma design */
568
+ figma: string;
569
+ /** Value from rendered component */
570
+ rendered: string;
571
+ /** Whether values match (within tolerance) */
572
+ match: boolean;
573
+ /** Token name if Figma value matches a known token */
574
+ figmaToken?: string;
575
+ /** Token name if rendered value uses a token */
576
+ renderedToken?: string;
577
+ /**
578
+ * True if rendered value doesn't use a token but should
579
+ * (i.e., Figma uses a token but code uses hardcoded value)
580
+ */
581
+ isHardcoded: boolean;
582
+ /** Suggested fix if hardcoded */
583
+ suggestedFix?: TokenFix;
584
+ }
585
+ /**
586
+ * Token-based fix suggestion
587
+ */
588
+ interface TokenFix {
589
+ /** Token name to use (e.g., "--color-primary") */
590
+ tokenName: string;
591
+ /** Token's resolved value */
592
+ tokenValue: string;
593
+ /** Code snippet to fix the issue */
594
+ codeFix: string;
595
+ /** Confidence score 0-1 */
596
+ confidence: number;
597
+ /** Human-readable explanation */
598
+ reason: string;
599
+ }
600
+ /**
601
+ * Result of parsing a CSS/SCSS file for tokens
602
+ */
603
+ interface TokenParseResult {
604
+ /** Tokens discovered in the file */
605
+ tokens: DesignToken[];
606
+ /** Errors encountered during parsing */
607
+ errors: TokenParseError[];
608
+ /** Warnings (non-fatal issues) */
609
+ warnings: string[];
610
+ /** Parse time in ms */
611
+ parseTimeMs: number;
612
+ }
613
+ /**
614
+ * Error during token parsing
615
+ */
616
+ interface TokenParseError {
617
+ /** Error message */
618
+ message: string;
619
+ /** File where error occurred */
620
+ file: string;
621
+ /** Line number if known */
622
+ line?: number;
623
+ /** The problematic content if available */
624
+ content?: string;
625
+ }
626
+ /**
627
+ * Request to match a value to tokens
628
+ */
629
+ interface TokenMatchRequest {
630
+ /** The value to find tokens for (e.g., "#0051c2") */
631
+ value: string;
632
+ /** Property type hint for better matching (e.g., "color") */
633
+ propertyType?: "color" | "spacing" | "typography" | "other";
634
+ /** Specific theme to search in */
635
+ theme?: string;
636
+ }
637
+ /**
638
+ * Result of token matching
639
+ */
640
+ interface TokenMatchResult {
641
+ /** Exact matches (same resolved value) */
642
+ exactMatches: DesignToken[];
643
+ /** Close matches (similar value, useful for colors) */
644
+ closeMatches: Array<{
645
+ token: DesignToken;
646
+ /** How close the match is (0-1, 1 = exact) */
647
+ similarity: number;
648
+ }>;
649
+ /** Whether any match was found */
650
+ found: boolean;
651
+ }
652
+ /**
653
+ * Summary of token usage in a component
654
+ */
655
+ interface TokenUsageSummary {
656
+ /** Total CSS properties checked */
657
+ totalProperties: number;
658
+ /** Properties using design tokens */
659
+ usingTokens: number;
660
+ /** Properties with hardcoded values */
661
+ hardcoded: number;
662
+ /** Properties matching but not using tokens explicitly */
663
+ implicitMatches: number;
664
+ /** Compliance percentage (usingTokens / totalProperties * 100) */
665
+ compliancePercent: number;
666
+ /** List of hardcoded properties with fix suggestions */
667
+ hardcodedProperties: EnhancedStyleDiffItem[];
668
+ }
669
+
670
+ declare const figmaPropMappingSchema: z.ZodDiscriminatedUnion<"__type", [z.ZodObject<{
671
+ __type: z.ZodLiteral<"figma-string">;
672
+ figmaProperty: z.ZodString;
673
+ }, "strip", z.ZodTypeAny, {
674
+ __type: "figma-string";
675
+ figmaProperty: string;
676
+ }, {
677
+ __type: "figma-string";
678
+ figmaProperty: string;
679
+ }>, z.ZodObject<{
680
+ __type: z.ZodLiteral<"figma-boolean">;
681
+ figmaProperty: z.ZodString;
682
+ valueMapping: z.ZodOptional<z.ZodObject<{
683
+ true: z.ZodUnknown;
684
+ false: z.ZodUnknown;
685
+ }, "strip", z.ZodTypeAny, {
686
+ true?: unknown;
687
+ false?: unknown;
688
+ }, {
689
+ true?: unknown;
690
+ false?: unknown;
691
+ }>>;
692
+ }, "strip", z.ZodTypeAny, {
693
+ __type: "figma-boolean";
694
+ figmaProperty: string;
695
+ valueMapping?: {
696
+ true?: unknown;
697
+ false?: unknown;
698
+ } | undefined;
699
+ }, {
700
+ __type: "figma-boolean";
701
+ figmaProperty: string;
702
+ valueMapping?: {
703
+ true?: unknown;
704
+ false?: unknown;
705
+ } | undefined;
706
+ }>, z.ZodObject<{
707
+ __type: z.ZodLiteral<"figma-enum">;
708
+ figmaProperty: z.ZodString;
709
+ valueMapping: z.ZodRecord<z.ZodString, z.ZodUnknown>;
710
+ }, "strip", z.ZodTypeAny, {
711
+ __type: "figma-enum";
712
+ figmaProperty: string;
713
+ valueMapping: Record<string, unknown>;
714
+ }, {
715
+ __type: "figma-enum";
716
+ figmaProperty: string;
717
+ valueMapping: Record<string, unknown>;
718
+ }>, z.ZodObject<{
719
+ __type: z.ZodLiteral<"figma-instance">;
720
+ figmaProperty: z.ZodString;
721
+ }, "strip", z.ZodTypeAny, {
722
+ __type: "figma-instance";
723
+ figmaProperty: string;
724
+ }, {
725
+ __type: "figma-instance";
726
+ figmaProperty: string;
727
+ }>, z.ZodObject<{
728
+ __type: z.ZodLiteral<"figma-children">;
729
+ layers: z.ZodArray<z.ZodString, "many">;
730
+ }, "strip", z.ZodTypeAny, {
731
+ __type: "figma-children";
732
+ layers: string[];
733
+ }, {
734
+ __type: "figma-children";
735
+ layers: string[];
736
+ }>, z.ZodObject<{
737
+ __type: z.ZodLiteral<"figma-text-content">;
738
+ layer: z.ZodString;
739
+ }, "strip", z.ZodTypeAny, {
740
+ __type: "figma-text-content";
741
+ layer: string;
742
+ }, {
743
+ __type: "figma-text-content";
744
+ layer: string;
745
+ }>]>;
746
+ declare const fragmentMetaSchema: z.ZodObject<{
747
+ name: z.ZodString;
748
+ description: z.ZodString;
749
+ category: z.ZodString;
750
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
751
+ status: z.ZodOptional<z.ZodEnum<["stable", "beta", "deprecated", "experimental"]>>;
752
+ since: z.ZodOptional<z.ZodString>;
753
+ dependencies: z.ZodOptional<z.ZodArray<z.ZodObject<{
754
+ name: z.ZodString;
755
+ version: z.ZodString;
756
+ reason: z.ZodOptional<z.ZodString>;
757
+ }, "strip", z.ZodTypeAny, {
758
+ name: string;
759
+ version: string;
760
+ reason?: string | undefined;
761
+ }, {
762
+ name: string;
763
+ version: string;
764
+ reason?: string | undefined;
765
+ }>, "many">>;
766
+ figma: z.ZodOptional<z.ZodString>;
767
+ figmaProps: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<"__type", [z.ZodObject<{
768
+ __type: z.ZodLiteral<"figma-string">;
769
+ figmaProperty: z.ZodString;
770
+ }, "strip", z.ZodTypeAny, {
771
+ __type: "figma-string";
772
+ figmaProperty: string;
773
+ }, {
774
+ __type: "figma-string";
775
+ figmaProperty: string;
776
+ }>, z.ZodObject<{
777
+ __type: z.ZodLiteral<"figma-boolean">;
778
+ figmaProperty: z.ZodString;
779
+ valueMapping: z.ZodOptional<z.ZodObject<{
780
+ true: z.ZodUnknown;
781
+ false: z.ZodUnknown;
782
+ }, "strip", z.ZodTypeAny, {
783
+ true?: unknown;
784
+ false?: unknown;
785
+ }, {
786
+ true?: unknown;
787
+ false?: unknown;
788
+ }>>;
789
+ }, "strip", z.ZodTypeAny, {
790
+ __type: "figma-boolean";
791
+ figmaProperty: string;
792
+ valueMapping?: {
793
+ true?: unknown;
794
+ false?: unknown;
795
+ } | undefined;
796
+ }, {
797
+ __type: "figma-boolean";
798
+ figmaProperty: string;
799
+ valueMapping?: {
800
+ true?: unknown;
801
+ false?: unknown;
802
+ } | undefined;
803
+ }>, z.ZodObject<{
804
+ __type: z.ZodLiteral<"figma-enum">;
805
+ figmaProperty: z.ZodString;
806
+ valueMapping: z.ZodRecord<z.ZodString, z.ZodUnknown>;
807
+ }, "strip", z.ZodTypeAny, {
808
+ __type: "figma-enum";
809
+ figmaProperty: string;
810
+ valueMapping: Record<string, unknown>;
811
+ }, {
812
+ __type: "figma-enum";
813
+ figmaProperty: string;
814
+ valueMapping: Record<string, unknown>;
815
+ }>, z.ZodObject<{
816
+ __type: z.ZodLiteral<"figma-instance">;
817
+ figmaProperty: z.ZodString;
818
+ }, "strip", z.ZodTypeAny, {
819
+ __type: "figma-instance";
820
+ figmaProperty: string;
821
+ }, {
822
+ __type: "figma-instance";
823
+ figmaProperty: string;
824
+ }>, z.ZodObject<{
825
+ __type: z.ZodLiteral<"figma-children">;
826
+ layers: z.ZodArray<z.ZodString, "many">;
827
+ }, "strip", z.ZodTypeAny, {
828
+ __type: "figma-children";
829
+ layers: string[];
830
+ }, {
831
+ __type: "figma-children";
832
+ layers: string[];
833
+ }>, z.ZodObject<{
834
+ __type: z.ZodLiteral<"figma-text-content">;
835
+ layer: z.ZodString;
836
+ }, "strip", z.ZodTypeAny, {
837
+ __type: "figma-text-content";
838
+ layer: string;
839
+ }, {
840
+ __type: "figma-text-content";
841
+ layer: string;
842
+ }>]>>>;
843
+ }, "strip", z.ZodTypeAny, {
844
+ name: string;
845
+ category: string;
846
+ description: string;
847
+ figma?: string | undefined;
848
+ tags?: string[] | undefined;
849
+ status?: "stable" | "beta" | "deprecated" | "experimental" | undefined;
850
+ since?: string | undefined;
851
+ dependencies?: {
852
+ name: string;
853
+ version: string;
854
+ reason?: string | undefined;
855
+ }[] | undefined;
856
+ figmaProps?: Record<string, {
857
+ __type: "figma-string";
858
+ figmaProperty: string;
859
+ } | {
860
+ __type: "figma-boolean";
861
+ figmaProperty: string;
862
+ valueMapping?: {
863
+ true?: unknown;
864
+ false?: unknown;
865
+ } | undefined;
866
+ } | {
867
+ __type: "figma-enum";
868
+ figmaProperty: string;
869
+ valueMapping: Record<string, unknown>;
870
+ } | {
871
+ __type: "figma-instance";
872
+ figmaProperty: string;
873
+ } | {
874
+ __type: "figma-children";
875
+ layers: string[];
876
+ } | {
877
+ __type: "figma-text-content";
878
+ layer: string;
879
+ }> | undefined;
880
+ }, {
881
+ name: string;
882
+ category: string;
883
+ description: string;
884
+ figma?: string | undefined;
885
+ tags?: string[] | undefined;
886
+ status?: "stable" | "beta" | "deprecated" | "experimental" | undefined;
887
+ since?: string | undefined;
888
+ dependencies?: {
889
+ name: string;
890
+ version: string;
891
+ reason?: string | undefined;
892
+ }[] | undefined;
893
+ figmaProps?: Record<string, {
894
+ __type: "figma-string";
895
+ figmaProperty: string;
896
+ } | {
897
+ __type: "figma-boolean";
898
+ figmaProperty: string;
899
+ valueMapping?: {
900
+ true?: unknown;
901
+ false?: unknown;
902
+ } | undefined;
903
+ } | {
904
+ __type: "figma-enum";
905
+ figmaProperty: string;
906
+ valueMapping: Record<string, unknown>;
907
+ } | {
908
+ __type: "figma-instance";
909
+ figmaProperty: string;
910
+ } | {
911
+ __type: "figma-children";
912
+ layers: string[];
913
+ } | {
914
+ __type: "figma-text-content";
915
+ layer: string;
916
+ }> | undefined;
917
+ }>;
918
+ declare const fragmentUsageSchema: z.ZodObject<{
919
+ when: z.ZodArray<z.ZodString, "many">;
920
+ whenNot: z.ZodArray<z.ZodString, "many">;
921
+ guidelines: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
922
+ accessibility: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
923
+ }, "strip", z.ZodTypeAny, {
924
+ when: string[];
925
+ whenNot: string[];
926
+ guidelines?: string[] | undefined;
927
+ accessibility?: string[] | undefined;
928
+ }, {
929
+ when: string[];
930
+ whenNot: string[];
931
+ guidelines?: string[] | undefined;
932
+ accessibility?: string[] | undefined;
933
+ }>;
934
+ declare const propDefinitionSchema: z.ZodObject<{
935
+ type: z.ZodType<string, z.ZodTypeDef, string>;
936
+ values: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString, "many">>>;
937
+ default: z.ZodOptional<z.ZodUnknown>;
938
+ description: z.ZodOptional<z.ZodString>;
939
+ required: z.ZodOptional<z.ZodBoolean>;
940
+ constraints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
941
+ typeDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
942
+ }, "strip", z.ZodTypeAny, {
943
+ type: string;
944
+ default?: unknown;
945
+ values?: readonly string[] | undefined;
946
+ description?: string | undefined;
947
+ required?: boolean | undefined;
948
+ constraints?: string[] | undefined;
949
+ typeDetails?: Record<string, unknown> | undefined;
950
+ }, {
951
+ type: string;
952
+ default?: unknown;
953
+ values?: readonly string[] | undefined;
954
+ description?: string | undefined;
955
+ required?: boolean | undefined;
956
+ constraints?: string[] | undefined;
957
+ typeDetails?: Record<string, unknown> | undefined;
958
+ }>;
959
+ declare const componentRelationSchema: z.ZodObject<{
960
+ component: z.ZodString;
961
+ relationship: z.ZodEnum<["alternative", "sibling", "parent", "child", "composition", "complementary", "used-by"]>;
962
+ note: z.ZodString;
963
+ }, "strip", z.ZodTypeAny, {
964
+ component: string;
965
+ relationship: "alternative" | "sibling" | "parent" | "child" | "composition" | "complementary" | "used-by";
966
+ note: string;
967
+ }, {
968
+ component: string;
969
+ relationship: "alternative" | "sibling" | "parent" | "child" | "composition" | "complementary" | "used-by";
970
+ note: string;
971
+ }>;
972
+ declare const fragmentVariantSchema: z.ZodObject<{
973
+ name: z.ZodString;
974
+ description: z.ZodString;
975
+ render: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
976
+ code: z.ZodOptional<z.ZodString>;
977
+ figma: z.ZodOptional<z.ZodString>;
978
+ }, "strip", z.ZodTypeAny, {
979
+ name: string;
980
+ description: string;
981
+ render: (...args: unknown[]) => unknown;
982
+ figma?: string | undefined;
983
+ code?: string | undefined;
984
+ }, {
985
+ name: string;
986
+ description: string;
987
+ render: (...args: unknown[]) => unknown;
988
+ figma?: string | undefined;
989
+ code?: string | undefined;
990
+ }>;
991
+ /**
992
+ * Schema for banned patterns in codebase
993
+ */
994
+ declare const fragmentBanSchema: z.ZodObject<{
995
+ pattern: z.ZodString;
996
+ message: z.ZodString;
997
+ }, "strip", z.ZodTypeAny, {
998
+ pattern: string;
999
+ message: string;
1000
+ }, {
1001
+ pattern: string;
1002
+ message: string;
1003
+ }>;
1004
+ /**
1005
+ * Schema for agent-optimized contract metadata
1006
+ */
1007
+ declare const fragmentContractSchema: z.ZodObject<{
1008
+ propsSummary: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1009
+ a11yRules: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1010
+ bans: z.ZodOptional<z.ZodArray<z.ZodObject<{
1011
+ pattern: z.ZodString;
1012
+ message: z.ZodString;
1013
+ }, "strip", z.ZodTypeAny, {
1014
+ pattern: string;
1015
+ message: string;
1016
+ }, {
1017
+ pattern: string;
1018
+ message: string;
1019
+ }>, "many">>;
1020
+ scenarioTags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1021
+ }, "strip", z.ZodTypeAny, {
1022
+ propsSummary?: string[] | undefined;
1023
+ a11yRules?: string[] | undefined;
1024
+ bans?: {
1025
+ pattern: string;
1026
+ message: string;
1027
+ }[] | undefined;
1028
+ scenarioTags?: string[] | undefined;
1029
+ }, {
1030
+ propsSummary?: string[] | undefined;
1031
+ a11yRules?: string[] | undefined;
1032
+ bans?: {
1033
+ pattern: string;
1034
+ message: string;
1035
+ }[] | undefined;
1036
+ scenarioTags?: string[] | undefined;
1037
+ }>;
1038
+ /**
1039
+ * Schema for provenance tracking of generated fragments
1040
+ */
1041
+ declare const fragmentGeneratedSchema: z.ZodObject<{
1042
+ source: z.ZodEnum<["storybook", "manual", "ai"]>;
1043
+ sourceFile: z.ZodOptional<z.ZodString>;
1044
+ confidence: z.ZodOptional<z.ZodNumber>;
1045
+ timestamp: z.ZodOptional<z.ZodString>;
1046
+ }, "strip", z.ZodTypeAny, {
1047
+ source: "ai" | "storybook" | "manual";
1048
+ sourceFile?: string | undefined;
1049
+ confidence?: number | undefined;
1050
+ timestamp?: string | undefined;
1051
+ }, {
1052
+ source: "ai" | "storybook" | "manual";
1053
+ sourceFile?: string | undefined;
1054
+ confidence?: number | undefined;
1055
+ timestamp?: string | undefined;
1056
+ }>;
1057
+ /**
1058
+ * Schema for AI-specific metadata for playground context generation
1059
+ */
1060
+ declare const aiMetadataSchema: z.ZodObject<{
1061
+ compositionPattern: z.ZodOptional<z.ZodEnum<["compound", "simple", "controlled", "wrapper"]>>;
1062
+ subComponents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1063
+ requiredChildren: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1064
+ commonPatterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1065
+ }, "strip", z.ZodTypeAny, {
1066
+ compositionPattern?: "compound" | "simple" | "controlled" | "wrapper" | undefined;
1067
+ subComponents?: string[] | undefined;
1068
+ requiredChildren?: string[] | undefined;
1069
+ commonPatterns?: string[] | undefined;
1070
+ }, {
1071
+ compositionPattern?: "compound" | "simple" | "controlled" | "wrapper" | undefined;
1072
+ subComponents?: string[] | undefined;
1073
+ requiredChildren?: string[] | undefined;
1074
+ commonPatterns?: string[] | undefined;
1075
+ }>;
1076
+ /**
1077
+ * Schema for block definitions
1078
+ */
1079
+ declare const blockDefinitionSchema: z.ZodObject<{
1080
+ name: z.ZodString;
1081
+ description: z.ZodString;
1082
+ category: z.ZodString;
1083
+ components: z.ZodArray<z.ZodString, "many">;
1084
+ code: z.ZodString;
1085
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1086
+ }, "strip", z.ZodTypeAny, {
1087
+ components: string[];
1088
+ name: string;
1089
+ category: string;
1090
+ code: string;
1091
+ description: string;
1092
+ tags?: string[] | undefined;
1093
+ }, {
1094
+ components: string[];
1095
+ name: string;
1096
+ category: string;
1097
+ code: string;
1098
+ description: string;
1099
+ tags?: string[] | undefined;
1100
+ }>;
1101
+ declare const fragmentDefinitionSchema: z.ZodObject<{
1102
+ component: z.ZodAny;
1103
+ meta: z.ZodObject<{
1104
+ name: z.ZodString;
1105
+ description: z.ZodString;
1106
+ category: z.ZodString;
1107
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1108
+ status: z.ZodOptional<z.ZodEnum<["stable", "beta", "deprecated", "experimental"]>>;
1109
+ since: z.ZodOptional<z.ZodString>;
1110
+ dependencies: z.ZodOptional<z.ZodArray<z.ZodObject<{
1111
+ name: z.ZodString;
1112
+ version: z.ZodString;
1113
+ reason: z.ZodOptional<z.ZodString>;
1114
+ }, "strip", z.ZodTypeAny, {
1115
+ name: string;
1116
+ version: string;
1117
+ reason?: string | undefined;
1118
+ }, {
1119
+ name: string;
1120
+ version: string;
1121
+ reason?: string | undefined;
1122
+ }>, "many">>;
1123
+ figma: z.ZodOptional<z.ZodString>;
1124
+ figmaProps: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<"__type", [z.ZodObject<{
1125
+ __type: z.ZodLiteral<"figma-string">;
1126
+ figmaProperty: z.ZodString;
1127
+ }, "strip", z.ZodTypeAny, {
1128
+ __type: "figma-string";
1129
+ figmaProperty: string;
1130
+ }, {
1131
+ __type: "figma-string";
1132
+ figmaProperty: string;
1133
+ }>, z.ZodObject<{
1134
+ __type: z.ZodLiteral<"figma-boolean">;
1135
+ figmaProperty: z.ZodString;
1136
+ valueMapping: z.ZodOptional<z.ZodObject<{
1137
+ true: z.ZodUnknown;
1138
+ false: z.ZodUnknown;
1139
+ }, "strip", z.ZodTypeAny, {
1140
+ true?: unknown;
1141
+ false?: unknown;
1142
+ }, {
1143
+ true?: unknown;
1144
+ false?: unknown;
1145
+ }>>;
1146
+ }, "strip", z.ZodTypeAny, {
1147
+ __type: "figma-boolean";
1148
+ figmaProperty: string;
1149
+ valueMapping?: {
1150
+ true?: unknown;
1151
+ false?: unknown;
1152
+ } | undefined;
1153
+ }, {
1154
+ __type: "figma-boolean";
1155
+ figmaProperty: string;
1156
+ valueMapping?: {
1157
+ true?: unknown;
1158
+ false?: unknown;
1159
+ } | undefined;
1160
+ }>, z.ZodObject<{
1161
+ __type: z.ZodLiteral<"figma-enum">;
1162
+ figmaProperty: z.ZodString;
1163
+ valueMapping: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1164
+ }, "strip", z.ZodTypeAny, {
1165
+ __type: "figma-enum";
1166
+ figmaProperty: string;
1167
+ valueMapping: Record<string, unknown>;
1168
+ }, {
1169
+ __type: "figma-enum";
1170
+ figmaProperty: string;
1171
+ valueMapping: Record<string, unknown>;
1172
+ }>, z.ZodObject<{
1173
+ __type: z.ZodLiteral<"figma-instance">;
1174
+ figmaProperty: z.ZodString;
1175
+ }, "strip", z.ZodTypeAny, {
1176
+ __type: "figma-instance";
1177
+ figmaProperty: string;
1178
+ }, {
1179
+ __type: "figma-instance";
1180
+ figmaProperty: string;
1181
+ }>, z.ZodObject<{
1182
+ __type: z.ZodLiteral<"figma-children">;
1183
+ layers: z.ZodArray<z.ZodString, "many">;
1184
+ }, "strip", z.ZodTypeAny, {
1185
+ __type: "figma-children";
1186
+ layers: string[];
1187
+ }, {
1188
+ __type: "figma-children";
1189
+ layers: string[];
1190
+ }>, z.ZodObject<{
1191
+ __type: z.ZodLiteral<"figma-text-content">;
1192
+ layer: z.ZodString;
1193
+ }, "strip", z.ZodTypeAny, {
1194
+ __type: "figma-text-content";
1195
+ layer: string;
1196
+ }, {
1197
+ __type: "figma-text-content";
1198
+ layer: string;
1199
+ }>]>>>;
1200
+ }, "strip", z.ZodTypeAny, {
1201
+ name: string;
1202
+ category: string;
1203
+ description: string;
1204
+ figma?: string | undefined;
1205
+ tags?: string[] | undefined;
1206
+ status?: "stable" | "beta" | "deprecated" | "experimental" | undefined;
1207
+ since?: string | undefined;
1208
+ dependencies?: {
1209
+ name: string;
1210
+ version: string;
1211
+ reason?: string | undefined;
1212
+ }[] | undefined;
1213
+ figmaProps?: Record<string, {
1214
+ __type: "figma-string";
1215
+ figmaProperty: string;
1216
+ } | {
1217
+ __type: "figma-boolean";
1218
+ figmaProperty: string;
1219
+ valueMapping?: {
1220
+ true?: unknown;
1221
+ false?: unknown;
1222
+ } | undefined;
1223
+ } | {
1224
+ __type: "figma-enum";
1225
+ figmaProperty: string;
1226
+ valueMapping: Record<string, unknown>;
1227
+ } | {
1228
+ __type: "figma-instance";
1229
+ figmaProperty: string;
1230
+ } | {
1231
+ __type: "figma-children";
1232
+ layers: string[];
1233
+ } | {
1234
+ __type: "figma-text-content";
1235
+ layer: string;
1236
+ }> | undefined;
1237
+ }, {
1238
+ name: string;
1239
+ category: string;
1240
+ description: string;
1241
+ figma?: string | undefined;
1242
+ tags?: string[] | undefined;
1243
+ status?: "stable" | "beta" | "deprecated" | "experimental" | undefined;
1244
+ since?: string | undefined;
1245
+ dependencies?: {
1246
+ name: string;
1247
+ version: string;
1248
+ reason?: string | undefined;
1249
+ }[] | undefined;
1250
+ figmaProps?: Record<string, {
1251
+ __type: "figma-string";
1252
+ figmaProperty: string;
1253
+ } | {
1254
+ __type: "figma-boolean";
1255
+ figmaProperty: string;
1256
+ valueMapping?: {
1257
+ true?: unknown;
1258
+ false?: unknown;
1259
+ } | undefined;
1260
+ } | {
1261
+ __type: "figma-enum";
1262
+ figmaProperty: string;
1263
+ valueMapping: Record<string, unknown>;
1264
+ } | {
1265
+ __type: "figma-instance";
1266
+ figmaProperty: string;
1267
+ } | {
1268
+ __type: "figma-children";
1269
+ layers: string[];
1270
+ } | {
1271
+ __type: "figma-text-content";
1272
+ layer: string;
1273
+ }> | undefined;
1274
+ }>;
1275
+ usage: z.ZodObject<{
1276
+ when: z.ZodArray<z.ZodString, "many">;
1277
+ whenNot: z.ZodArray<z.ZodString, "many">;
1278
+ guidelines: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1279
+ accessibility: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1280
+ }, "strip", z.ZodTypeAny, {
1281
+ when: string[];
1282
+ whenNot: string[];
1283
+ guidelines?: string[] | undefined;
1284
+ accessibility?: string[] | undefined;
1285
+ }, {
1286
+ when: string[];
1287
+ whenNot: string[];
1288
+ guidelines?: string[] | undefined;
1289
+ accessibility?: string[] | undefined;
1290
+ }>;
1291
+ props: z.ZodRecord<z.ZodString, z.ZodObject<{
1292
+ type: z.ZodType<string, z.ZodTypeDef, string>;
1293
+ values: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString, "many">>>;
1294
+ default: z.ZodOptional<z.ZodUnknown>;
1295
+ description: z.ZodOptional<z.ZodString>;
1296
+ required: z.ZodOptional<z.ZodBoolean>;
1297
+ constraints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1298
+ typeDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1299
+ }, "strip", z.ZodTypeAny, {
1300
+ type: string;
1301
+ default?: unknown;
1302
+ values?: readonly string[] | undefined;
1303
+ description?: string | undefined;
1304
+ required?: boolean | undefined;
1305
+ constraints?: string[] | undefined;
1306
+ typeDetails?: Record<string, unknown> | undefined;
1307
+ }, {
1308
+ type: string;
1309
+ default?: unknown;
1310
+ values?: readonly string[] | undefined;
1311
+ description?: string | undefined;
1312
+ required?: boolean | undefined;
1313
+ constraints?: string[] | undefined;
1314
+ typeDetails?: Record<string, unknown> | undefined;
1315
+ }>>;
1316
+ relations: z.ZodOptional<z.ZodArray<z.ZodObject<{
1317
+ component: z.ZodString;
1318
+ relationship: z.ZodEnum<["alternative", "sibling", "parent", "child", "composition", "complementary", "used-by"]>;
1319
+ note: z.ZodString;
1320
+ }, "strip", z.ZodTypeAny, {
1321
+ component: string;
1322
+ relationship: "alternative" | "sibling" | "parent" | "child" | "composition" | "complementary" | "used-by";
1323
+ note: string;
1324
+ }, {
1325
+ component: string;
1326
+ relationship: "alternative" | "sibling" | "parent" | "child" | "composition" | "complementary" | "used-by";
1327
+ note: string;
1328
+ }>, "many">>;
1329
+ variants: z.ZodArray<z.ZodObject<{
1330
+ name: z.ZodString;
1331
+ description: z.ZodString;
1332
+ render: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
1333
+ code: z.ZodOptional<z.ZodString>;
1334
+ figma: z.ZodOptional<z.ZodString>;
1335
+ }, "strip", z.ZodTypeAny, {
1336
+ name: string;
1337
+ description: string;
1338
+ render: (...args: unknown[]) => unknown;
1339
+ figma?: string | undefined;
1340
+ code?: string | undefined;
1341
+ }, {
1342
+ name: string;
1343
+ description: string;
1344
+ render: (...args: unknown[]) => unknown;
1345
+ figma?: string | undefined;
1346
+ code?: string | undefined;
1347
+ }>, "many">;
1348
+ contract: z.ZodOptional<z.ZodObject<{
1349
+ propsSummary: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1350
+ a11yRules: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1351
+ bans: z.ZodOptional<z.ZodArray<z.ZodObject<{
1352
+ pattern: z.ZodString;
1353
+ message: z.ZodString;
1354
+ }, "strip", z.ZodTypeAny, {
1355
+ pattern: string;
1356
+ message: string;
1357
+ }, {
1358
+ pattern: string;
1359
+ message: string;
1360
+ }>, "many">>;
1361
+ scenarioTags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1362
+ }, "strip", z.ZodTypeAny, {
1363
+ propsSummary?: string[] | undefined;
1364
+ a11yRules?: string[] | undefined;
1365
+ bans?: {
1366
+ pattern: string;
1367
+ message: string;
1368
+ }[] | undefined;
1369
+ scenarioTags?: string[] | undefined;
1370
+ }, {
1371
+ propsSummary?: string[] | undefined;
1372
+ a11yRules?: string[] | undefined;
1373
+ bans?: {
1374
+ pattern: string;
1375
+ message: string;
1376
+ }[] | undefined;
1377
+ scenarioTags?: string[] | undefined;
1378
+ }>>;
1379
+ ai: z.ZodOptional<z.ZodObject<{
1380
+ compositionPattern: z.ZodOptional<z.ZodEnum<["compound", "simple", "controlled", "wrapper"]>>;
1381
+ subComponents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1382
+ requiredChildren: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1383
+ commonPatterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1384
+ }, "strip", z.ZodTypeAny, {
1385
+ compositionPattern?: "compound" | "simple" | "controlled" | "wrapper" | undefined;
1386
+ subComponents?: string[] | undefined;
1387
+ requiredChildren?: string[] | undefined;
1388
+ commonPatterns?: string[] | undefined;
1389
+ }, {
1390
+ compositionPattern?: "compound" | "simple" | "controlled" | "wrapper" | undefined;
1391
+ subComponents?: string[] | undefined;
1392
+ requiredChildren?: string[] | undefined;
1393
+ commonPatterns?: string[] | undefined;
1394
+ }>>;
1395
+ _generated: z.ZodOptional<z.ZodObject<{
1396
+ source: z.ZodEnum<["storybook", "manual", "ai"]>;
1397
+ sourceFile: z.ZodOptional<z.ZodString>;
1398
+ confidence: z.ZodOptional<z.ZodNumber>;
1399
+ timestamp: z.ZodOptional<z.ZodString>;
1400
+ }, "strip", z.ZodTypeAny, {
1401
+ source: "ai" | "storybook" | "manual";
1402
+ sourceFile?: string | undefined;
1403
+ confidence?: number | undefined;
1404
+ timestamp?: string | undefined;
1405
+ }, {
1406
+ source: "ai" | "storybook" | "manual";
1407
+ sourceFile?: string | undefined;
1408
+ confidence?: number | undefined;
1409
+ timestamp?: string | undefined;
1410
+ }>>;
1411
+ }, "strip", z.ZodTypeAny, {
1412
+ variants: {
1413
+ name: string;
1414
+ description: string;
1415
+ render: (...args: unknown[]) => unknown;
1416
+ figma?: string | undefined;
1417
+ code?: string | undefined;
1418
+ }[];
1419
+ meta: {
1420
+ name: string;
1421
+ category: string;
1422
+ description: string;
1423
+ figma?: string | undefined;
1424
+ tags?: string[] | undefined;
1425
+ status?: "stable" | "beta" | "deprecated" | "experimental" | undefined;
1426
+ since?: string | undefined;
1427
+ dependencies?: {
1428
+ name: string;
1429
+ version: string;
1430
+ reason?: string | undefined;
1431
+ }[] | undefined;
1432
+ figmaProps?: Record<string, {
1433
+ __type: "figma-string";
1434
+ figmaProperty: string;
1435
+ } | {
1436
+ __type: "figma-boolean";
1437
+ figmaProperty: string;
1438
+ valueMapping?: {
1439
+ true?: unknown;
1440
+ false?: unknown;
1441
+ } | undefined;
1442
+ } | {
1443
+ __type: "figma-enum";
1444
+ figmaProperty: string;
1445
+ valueMapping: Record<string, unknown>;
1446
+ } | {
1447
+ __type: "figma-instance";
1448
+ figmaProperty: string;
1449
+ } | {
1450
+ __type: "figma-children";
1451
+ layers: string[];
1452
+ } | {
1453
+ __type: "figma-text-content";
1454
+ layer: string;
1455
+ }> | undefined;
1456
+ };
1457
+ usage: {
1458
+ when: string[];
1459
+ whenNot: string[];
1460
+ guidelines?: string[] | undefined;
1461
+ accessibility?: string[] | undefined;
1462
+ };
1463
+ props: Record<string, {
1464
+ type: string;
1465
+ default?: unknown;
1466
+ values?: readonly string[] | undefined;
1467
+ description?: string | undefined;
1468
+ required?: boolean | undefined;
1469
+ constraints?: string[] | undefined;
1470
+ typeDetails?: Record<string, unknown> | undefined;
1471
+ }>;
1472
+ ai?: {
1473
+ compositionPattern?: "compound" | "simple" | "controlled" | "wrapper" | undefined;
1474
+ subComponents?: string[] | undefined;
1475
+ requiredChildren?: string[] | undefined;
1476
+ commonPatterns?: string[] | undefined;
1477
+ } | undefined;
1478
+ component?: any;
1479
+ relations?: {
1480
+ component: string;
1481
+ relationship: "alternative" | "sibling" | "parent" | "child" | "composition" | "complementary" | "used-by";
1482
+ note: string;
1483
+ }[] | undefined;
1484
+ contract?: {
1485
+ propsSummary?: string[] | undefined;
1486
+ a11yRules?: string[] | undefined;
1487
+ bans?: {
1488
+ pattern: string;
1489
+ message: string;
1490
+ }[] | undefined;
1491
+ scenarioTags?: string[] | undefined;
1492
+ } | undefined;
1493
+ _generated?: {
1494
+ source: "ai" | "storybook" | "manual";
1495
+ sourceFile?: string | undefined;
1496
+ confidence?: number | undefined;
1497
+ timestamp?: string | undefined;
1498
+ } | undefined;
1499
+ }, {
1500
+ variants: {
1501
+ name: string;
1502
+ description: string;
1503
+ render: (...args: unknown[]) => unknown;
1504
+ figma?: string | undefined;
1505
+ code?: string | undefined;
1506
+ }[];
1507
+ meta: {
1508
+ name: string;
1509
+ category: string;
1510
+ description: string;
1511
+ figma?: string | undefined;
1512
+ tags?: string[] | undefined;
1513
+ status?: "stable" | "beta" | "deprecated" | "experimental" | undefined;
1514
+ since?: string | undefined;
1515
+ dependencies?: {
1516
+ name: string;
1517
+ version: string;
1518
+ reason?: string | undefined;
1519
+ }[] | undefined;
1520
+ figmaProps?: Record<string, {
1521
+ __type: "figma-string";
1522
+ figmaProperty: string;
1523
+ } | {
1524
+ __type: "figma-boolean";
1525
+ figmaProperty: string;
1526
+ valueMapping?: {
1527
+ true?: unknown;
1528
+ false?: unknown;
1529
+ } | undefined;
1530
+ } | {
1531
+ __type: "figma-enum";
1532
+ figmaProperty: string;
1533
+ valueMapping: Record<string, unknown>;
1534
+ } | {
1535
+ __type: "figma-instance";
1536
+ figmaProperty: string;
1537
+ } | {
1538
+ __type: "figma-children";
1539
+ layers: string[];
1540
+ } | {
1541
+ __type: "figma-text-content";
1542
+ layer: string;
1543
+ }> | undefined;
1544
+ };
1545
+ usage: {
1546
+ when: string[];
1547
+ whenNot: string[];
1548
+ guidelines?: string[] | undefined;
1549
+ accessibility?: string[] | undefined;
1550
+ };
1551
+ props: Record<string, {
1552
+ type: string;
1553
+ default?: unknown;
1554
+ values?: readonly string[] | undefined;
1555
+ description?: string | undefined;
1556
+ required?: boolean | undefined;
1557
+ constraints?: string[] | undefined;
1558
+ typeDetails?: Record<string, unknown> | undefined;
1559
+ }>;
1560
+ ai?: {
1561
+ compositionPattern?: "compound" | "simple" | "controlled" | "wrapper" | undefined;
1562
+ subComponents?: string[] | undefined;
1563
+ requiredChildren?: string[] | undefined;
1564
+ commonPatterns?: string[] | undefined;
1565
+ } | undefined;
1566
+ component?: any;
1567
+ relations?: {
1568
+ component: string;
1569
+ relationship: "alternative" | "sibling" | "parent" | "child" | "composition" | "complementary" | "used-by";
1570
+ note: string;
1571
+ }[] | undefined;
1572
+ contract?: {
1573
+ propsSummary?: string[] | undefined;
1574
+ a11yRules?: string[] | undefined;
1575
+ bans?: {
1576
+ pattern: string;
1577
+ message: string;
1578
+ }[] | undefined;
1579
+ scenarioTags?: string[] | undefined;
1580
+ } | undefined;
1581
+ _generated?: {
1582
+ source: "ai" | "storybook" | "manual";
1583
+ sourceFile?: string | undefined;
1584
+ confidence?: number | undefined;
1585
+ timestamp?: string | undefined;
1586
+ } | undefined;
1587
+ }>;
1588
+ /**
1589
+ * Config schema - validates required fields, passes through optional config objects.
1590
+ * Type definitions are in types.ts - schema just ensures basic structure.
1591
+ */
1592
+ declare const fragmentsConfigSchema: z.ZodObject<{
1593
+ include: z.ZodArray<z.ZodString, "many">;
1594
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1595
+ components: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1596
+ outFile: z.ZodOptional<z.ZodString>;
1597
+ framework: z.ZodOptional<z.ZodEnum<["react", "vue", "svelte"]>>;
1598
+ figmaFile: z.ZodOptional<z.ZodString>;
1599
+ figmaToken: z.ZodOptional<z.ZodString>;
1600
+ screenshots: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1601
+ service: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1602
+ registry: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1603
+ tokens: z.ZodOptional<z.ZodObject<{
1604
+ include: z.ZodArray<z.ZodString, "many">;
1605
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1606
+ include: z.ZodArray<z.ZodString, "many">;
1607
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1608
+ include: z.ZodArray<z.ZodString, "many">;
1609
+ }, z.ZodTypeAny, "passthrough">>>;
1610
+ snippets: z.ZodOptional<z.ZodObject<{
1611
+ mode: z.ZodOptional<z.ZodEnum<["warn", "error"]>>;
1612
+ scope: z.ZodOptional<z.ZodEnum<["snippet", "snippet+render"]>>;
1613
+ requireFullSnippet: z.ZodOptional<z.ZodBoolean>;
1614
+ allowedExternalModules: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1615
+ }, "strip", z.ZodTypeAny, {
1616
+ mode?: "warn" | "error" | undefined;
1617
+ scope?: "snippet" | "snippet+render" | undefined;
1618
+ requireFullSnippet?: boolean | undefined;
1619
+ allowedExternalModules?: string[] | undefined;
1620
+ }, {
1621
+ mode?: "warn" | "error" | undefined;
1622
+ scope?: "snippet" | "snippet+render" | undefined;
1623
+ requireFullSnippet?: boolean | undefined;
1624
+ allowedExternalModules?: string[] | undefined;
1625
+ }>>;
1626
+ }, "strip", z.ZodTypeAny, {
1627
+ include: string[];
1628
+ components?: string[] | undefined;
1629
+ screenshots?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1630
+ tokens?: z.objectOutputType<{
1631
+ include: z.ZodArray<z.ZodString, "many">;
1632
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1633
+ registry?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1634
+ exclude?: string[] | undefined;
1635
+ outFile?: string | undefined;
1636
+ framework?: "react" | "vue" | "svelte" | undefined;
1637
+ figmaFile?: string | undefined;
1638
+ figmaToken?: string | undefined;
1639
+ service?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1640
+ snippets?: {
1641
+ mode?: "warn" | "error" | undefined;
1642
+ scope?: "snippet" | "snippet+render" | undefined;
1643
+ requireFullSnippet?: boolean | undefined;
1644
+ allowedExternalModules?: string[] | undefined;
1645
+ } | undefined;
1646
+ }, {
1647
+ include: string[];
1648
+ components?: string[] | undefined;
1649
+ screenshots?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1650
+ tokens?: z.objectInputType<{
1651
+ include: z.ZodArray<z.ZodString, "many">;
1652
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1653
+ registry?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1654
+ exclude?: string[] | undefined;
1655
+ outFile?: string | undefined;
1656
+ framework?: "react" | "vue" | "svelte" | undefined;
1657
+ figmaFile?: string | undefined;
1658
+ figmaToken?: string | undefined;
1659
+ service?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1660
+ snippets?: {
1661
+ mode?: "warn" | "error" | undefined;
1662
+ scope?: "snippet" | "snippet+render" | undefined;
1663
+ requireFullSnippet?: boolean | undefined;
1664
+ allowedExternalModules?: string[] | undefined;
1665
+ } | undefined;
1666
+ }>;
1667
+ /**
1668
+ * @deprecated Use blockDefinitionSchema instead
1669
+ */
1670
+ declare const recipeDefinitionSchema: z.ZodObject<{
1671
+ name: z.ZodString;
1672
+ description: z.ZodString;
1673
+ category: z.ZodString;
1674
+ components: z.ZodArray<z.ZodString, "many">;
1675
+ code: z.ZodString;
1676
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1677
+ }, "strip", z.ZodTypeAny, {
1678
+ components: string[];
1679
+ name: string;
1680
+ category: string;
1681
+ code: string;
1682
+ description: string;
1683
+ tags?: string[] | undefined;
1684
+ }, {
1685
+ components: string[];
1686
+ name: string;
1687
+ category: string;
1688
+ code: string;
1689
+ description: string;
1690
+ tags?: string[] | undefined;
1691
+ }>;
1692
+
1693
+ /**
1694
+ * Figma property mapping DSL
1695
+ *
1696
+ * Provides helpers for mapping Figma component properties to code props.
1697
+ * Inspired by Figma Code Connect's API.
1698
+ *
1699
+ * @example
1700
+ * ```tsx
1701
+ * import { defineFragment, figma } from '@fragments-sdk/cli/core';
1702
+ *
1703
+ * export default defineFragment({
1704
+ * component: Button,
1705
+ * meta: {
1706
+ * name: 'Button',
1707
+ * description: 'Primary action trigger',
1708
+ * category: 'actions',
1709
+ * figma: 'https://figma.com/file/abc/Design?node-id=1-2',
1710
+ * figmaProps: {
1711
+ * children: figma.string('Label'),
1712
+ * disabled: figma.boolean('Disabled'),
1713
+ * variant: figma.enum('Type', {
1714
+ * 'Primary': 'primary',
1715
+ * 'Secondary': 'secondary',
1716
+ * }),
1717
+ * },
1718
+ * },
1719
+ * // ...
1720
+ * });
1721
+ * ```
1722
+ */
1723
+
1724
+ /**
1725
+ * Map a Figma text property to a string prop.
1726
+ *
1727
+ * @param figmaProperty - The name of the text property in Figma
1728
+ * @returns A string mapping descriptor
1729
+ *
1730
+ * @example
1731
+ * ```tsx
1732
+ * figmaProps: {
1733
+ * label: figma.string('Button Text'),
1734
+ * placeholder: figma.string('Placeholder'),
1735
+ * }
1736
+ * ```
1737
+ */
1738
+ declare function string(figmaProperty: string): FigmaStringMapping;
1739
+ /**
1740
+ * Map a Figma boolean property to a boolean prop.
1741
+ * Optionally map true/false to different values.
1742
+ *
1743
+ * @param figmaProperty - The name of the boolean property in Figma
1744
+ * @param valueMapping - Optional mapping of true/false to other values
1745
+ * @returns A boolean mapping descriptor
1746
+ *
1747
+ * @example
1748
+ * ```tsx
1749
+ * figmaProps: {
1750
+ * disabled: figma.boolean('Disabled'),
1751
+ * // Map boolean to string values
1752
+ * size: figma.boolean('Large', { true: 'lg', false: 'md' }),
1753
+ * }
1754
+ * ```
1755
+ */
1756
+ declare function boolean(figmaProperty: string, valueMapping?: {
1757
+ true: unknown;
1758
+ false: unknown;
1759
+ }): FigmaBooleanMapping;
1760
+ /**
1761
+ * Map a Figma variant property to an enum prop.
1762
+ *
1763
+ * @param figmaProperty - The name of the variant property in Figma
1764
+ * @param valueMapping - Mapping of Figma values to code values
1765
+ * @returns An enum mapping descriptor
1766
+ *
1767
+ * @example
1768
+ * ```tsx
1769
+ * figmaProps: {
1770
+ * variant: figma.enum('Type', {
1771
+ * 'Primary': 'primary',
1772
+ * 'Secondary': 'secondary',
1773
+ * 'Outline': 'outline',
1774
+ * }),
1775
+ * size: figma.enum('Size', {
1776
+ * 'Small': 'sm',
1777
+ * 'Medium': 'md',
1778
+ * 'Large': 'lg',
1779
+ * }),
1780
+ * }
1781
+ * ```
1782
+ */
1783
+ declare function enumValue<T extends Record<string, unknown>>(figmaProperty: string, valueMapping: T): FigmaEnumMapping;
1784
+ /**
1785
+ * Reference a nested Figma component instance.
1786
+ * Use this when a prop accepts a component that's represented
1787
+ * as an instance swap in Figma.
1788
+ *
1789
+ * @param figmaProperty - The name of the instance property in Figma
1790
+ * @returns An instance mapping descriptor
1791
+ *
1792
+ * @example
1793
+ * ```tsx
1794
+ * figmaProps: {
1795
+ * icon: figma.instance('Icon'),
1796
+ * avatar: figma.instance('Avatar'),
1797
+ * }
1798
+ * ```
1799
+ */
1800
+ declare function instance(figmaProperty: string): FigmaInstanceMapping;
1801
+ /**
1802
+ * Render children from specific Figma layers.
1803
+ * Use this when children are represented as named layers in Figma.
1804
+ *
1805
+ * @param layers - Array of layer names to include as children
1806
+ * @returns A children mapping descriptor
1807
+ *
1808
+ * @example
1809
+ * ```tsx
1810
+ * figmaProps: {
1811
+ * children: figma.children(['Title', 'Description', 'Actions']),
1812
+ * }
1813
+ * ```
1814
+ */
1815
+ declare function children(layers: string[]): FigmaChildrenMapping;
1816
+ /**
1817
+ * Extract text content from a Figma text layer.
1818
+ * Use this when a prop should be the actual text from a layer.
1819
+ *
1820
+ * @param layer - The name of the text layer in Figma
1821
+ * @returns A text content mapping descriptor
1822
+ *
1823
+ * @example
1824
+ * ```tsx
1825
+ * figmaProps: {
1826
+ * title: figma.textContent('Header Text'),
1827
+ * description: figma.textContent('Body Text'),
1828
+ * }
1829
+ * ```
1830
+ */
1831
+ declare function textContent(layer: string): FigmaTextContentMapping;
1832
+ /**
1833
+ * Figma property mapping helpers.
1834
+ *
1835
+ * Use these to define how Figma properties map to your component props.
1836
+ * The mappings are used for:
1837
+ * - Generating accurate code snippets in Figma Dev Mode
1838
+ * - AI agents understanding the design-to-code relationship
1839
+ * - Automated design verification
1840
+ */
1841
+ declare const figma: {
1842
+ readonly string: typeof string;
1843
+ readonly boolean: typeof boolean;
1844
+ readonly enum: typeof enumValue;
1845
+ readonly instance: typeof instance;
1846
+ readonly children: typeof children;
1847
+ readonly textContent: typeof textContent;
1848
+ };
1849
+ /**
1850
+ * Helper type to check if a value is a Figma prop mapping
1851
+ */
1852
+ declare function isFigmaPropMapping(value: unknown): value is FigmaStringMapping | FigmaBooleanMapping | FigmaEnumMapping | FigmaInstanceMapping | FigmaChildrenMapping | FigmaTextContentMapping;
1853
+ /**
1854
+ * Resolve a Figma prop mapping to an actual value given Figma property values.
1855
+ *
1856
+ * @param mapping - The Figma prop mapping
1857
+ * @param figmaValues - Object containing Figma property values
1858
+ * @returns The resolved value for the code prop
1859
+ */
1860
+ declare function resolveFigmaMapping(mapping: FigmaStringMapping | FigmaBooleanMapping | FigmaEnumMapping | FigmaInstanceMapping | FigmaChildrenMapping | FigmaTextContentMapping, figmaValues: Record<string, unknown>): unknown;
1861
+
1862
+ /**
1863
+ * Token Parser — extracts CSS custom property declarations from SCSS/CSS files.
1864
+ *
1865
+ * Parses files for `--prefix-*: value;` declarations and groups them
1866
+ * by SCSS comment sections (e.g., `// Typography`, `// Colors`).
1867
+ * Falls back to naming-convention-based categorization when comments
1868
+ * are absent.
1869
+ */
1870
+ interface ParsedToken {
1871
+ /** Full CSS variable name (e.g., "--fui-color-accent") */
1872
+ name: string;
1873
+ /** Raw value from the declaration (e.g., "#{$fui-space-4}" or "16px") */
1874
+ value?: string;
1875
+ /** Resolved value after SCSS variable substitution (e.g., "16px") */
1876
+ resolvedValue?: string;
1877
+ /** Category inferred from SCSS comment or naming convention */
1878
+ category: string;
1879
+ /** Description from inline comment, if any */
1880
+ description?: string;
1881
+ }
1882
+ interface TokenParseOutput {
1883
+ /** Detected prefix (e.g., "--fui-") */
1884
+ prefix: string;
1885
+ /** Tokens grouped by category */
1886
+ categories: Record<string, ParsedToken[]>;
1887
+ /** Total number of tokens found */
1888
+ total: number;
1889
+ }
1890
+ /**
1891
+ * Parse a SCSS or CSS file and extract CSS custom property declarations.
1892
+ *
1893
+ * Handles two grouping strategies:
1894
+ * 1. Comment-based: Uses `// Category` comments above groups of declarations
1895
+ * 2. Naming-based: Falls back to inferring category from variable name patterns
1896
+ *
1897
+ * Also resolves SCSS variable interpolations (e.g., `#{$fui-space-4}` → `16px`)
1898
+ * when the SCSS variable definitions are found in the same file content.
1899
+ */
1900
+ declare function parseTokenFile(content: string, filePath: string): TokenParseOutput;
1901
+
1902
+ interface CompositionWarning {
1903
+ type: "missing_parent" | "missing_child" | "missing_composition" | "redundant_alternative" | "deprecated" | "experimental";
1904
+ component: string;
1905
+ message: string;
1906
+ relatedComponent?: string;
1907
+ }
1908
+ interface CompositionSuggestion {
1909
+ component: string;
1910
+ reason: string;
1911
+ relationship: RelationshipType | "category_gap";
1912
+ sourceComponent: string;
1913
+ }
1914
+ interface CompositionGuideline {
1915
+ component: string;
1916
+ guideline: string;
1917
+ }
1918
+ interface CompositionAnalysis {
1919
+ /** The validated component names (filtered to those that exist) */
1920
+ components: string[];
1921
+ /** Components requested but not found in the registry */
1922
+ unknown: string[];
1923
+ /** Issues with the current selection */
1924
+ warnings: CompositionWarning[];
1925
+ /** Components to consider adding */
1926
+ suggestions: CompositionSuggestion[];
1927
+ /** Relevant usage guidelines for the selected components */
1928
+ guidelines: CompositionGuideline[];
1929
+ }
1930
+ /**
1931
+ * Analyzes a set of components as a composition group.
1932
+ * Returns warnings about missing relations, usage conflicts,
1933
+ * and suggestions for additional components.
1934
+ *
1935
+ * When a ComponentGraph is provided via `options.graph`, the analysis is
1936
+ * enhanced with graph-based dependency detection and block-based suggestions.
1937
+ *
1938
+ * Browser-safe: no Node.js APIs used.
1939
+ */
1940
+ declare function analyzeComposition(fragments: Record<string, CompiledFragment>, componentNames: string[], _context?: string, options?: {
1941
+ graph?: ComponentGraph;
1942
+ }): CompositionAnalysis;
1943
+
1944
+ export { BRAND, type Brand, type CSF2Story, type CompositionAnalysis, type CompositionGuideline, type CompositionSuggestion, type CompositionWarning, DEFAULTS, type Decorator, type Defaults, type DesignToken, type EnhancedStyleDiffItem, FigmaBooleanMapping, FigmaChildrenMapping, FigmaEnumMapping, FigmaInstanceMapping, FigmaStringMapping, FigmaTextContentMapping, type Fragment, type FragmentAccessibility, type FragmentContextOptions, FragmentDefinition, type FragmentDoNotItem, type FragmentFigma, type FragmentIndex, type FragmentMeta as FragmentJsonMeta, type FragmentUsage as FragmentJsonUsage, type FragmentPattern, type FragmentRegistry, type FragmentRelated, type Loader, type ParsedToken, type PreviewConfig, type RegistryComponentEntry, type RegistryPropEntry, RelationshipType, type Story, type StoryArgType, type StoryContext, type StoryMeta, type StoryModule, type TokenCategory, type TokenFix, type TokenMatchRequest, type TokenMatchResult, type TokenParseError, type TokenParseOutput, type TokenParseResult, type TokenRegistry, type TokenRegistryMeta, type TokenUsageSummary, aiMetadataSchema, analyzeComposition, blockDefinitionSchema, componentRelationSchema, figma, figmaPropMappingSchema, fragmentBanSchema, fragmentContractSchema, fragmentDefinitionSchema, fragmentGeneratedSchema, fragmentMetaSchema, fragmentUsageSchema, fragmentVariantSchema, fragmentsConfigSchema, getPreviewConfig, isExportStory, isFigmaPropMapping, parseTokenFile, propDefinitionSchema, recipeDefinitionSchema, resolveFigmaMapping, setPreviewConfig, storyModuleToFragment, storyNameFromExport, toId };