@usefragments/core 1.0.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.
Files changed (228) hide show
  1. package/LICENSE +21 -0
  2. package/dist/chunk-243QYRUF.js +2145 -0
  3. package/dist/chunk-243QYRUF.js.map +1 -0
  4. package/dist/chunk-3LLRNCPX.js +111 -0
  5. package/dist/chunk-3LLRNCPX.js.map +1 -0
  6. package/dist/chunk-EIYNNS77.js +48 -0
  7. package/dist/chunk-EIYNNS77.js.map +1 -0
  8. package/dist/chunk-JNBFJ34I.js +326 -0
  9. package/dist/chunk-JNBFJ34I.js.map +1 -0
  10. package/dist/chunk-R3X7UBHU.js +228 -0
  11. package/dist/chunk-R3X7UBHU.js.map +1 -0
  12. package/dist/chunk-SH4KPIYH.js +393 -0
  13. package/dist/chunk-SH4KPIYH.js.map +1 -0
  14. package/dist/chunk-V4VQB57N.js +56 -0
  15. package/dist/chunk-V4VQB57N.js.map +1 -0
  16. package/dist/chunk-X34IA4LR.js +319 -0
  17. package/dist/chunk-X34IA4LR.js.map +1 -0
  18. package/dist/chunk-YF65VYRY.js +493 -0
  19. package/dist/chunk-YF65VYRY.js.map +1 -0
  20. package/dist/codes/index.d.ts +40 -0
  21. package/dist/codes/index.js +23 -0
  22. package/dist/codes/index.js.map +1 -0
  23. package/dist/compiled-types/index.d.ts +5 -0
  24. package/dist/compiled-types/index.js +1 -0
  25. package/dist/compiled-types/index.js.map +1 -0
  26. package/dist/generate/index.d.ts +47 -0
  27. package/dist/generate/index.js +11 -0
  28. package/dist/generate/index.js.map +1 -0
  29. package/dist/governance-BOa3KyiJ.d.ts +3279 -0
  30. package/dist/graph/index.d.ts +66 -0
  31. package/dist/graph/index.js +17 -0
  32. package/dist/graph/index.js.map +1 -0
  33. package/dist/index.d.ts +11388 -0
  34. package/dist/index.js +8711 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/package-identity.d.ts +42 -0
  37. package/dist/package-identity.js +23 -0
  38. package/dist/package-identity.js.map +1 -0
  39. package/dist/preview/index.d.ts +484 -0
  40. package/dist/preview/index.js +1129 -0
  41. package/dist/preview/index.js.map +1 -0
  42. package/dist/react-types.d.ts +22 -0
  43. package/dist/react-types.js +1 -0
  44. package/dist/react-types.js.map +1 -0
  45. package/dist/registry.d.ts +2367 -0
  46. package/dist/registry.js +62 -0
  47. package/dist/registry.js.map +1 -0
  48. package/dist/schemas/index.d.ts +2584 -0
  49. package/dist/schemas/index.js +55 -0
  50. package/dist/schemas/index.js.map +1 -0
  51. package/dist/severity.d.ts +18 -0
  52. package/dist/severity.js +27 -0
  53. package/dist/severity.js.map +1 -0
  54. package/dist/test-utils.d.ts +14 -0
  55. package/dist/test-utils.js +63 -0
  56. package/dist/test-utils.js.map +1 -0
  57. package/dist/topology/index.d.ts +48 -0
  58. package/dist/topology/index.js +7 -0
  59. package/dist/topology/index.js.map +1 -0
  60. package/dist/types-xJ2xyp_G.d.ts +119 -0
  61. package/package.json +120 -0
  62. package/src/__tests__/contract-parser.test.ts +614 -0
  63. package/src/__tests__/dtcg-generators.test.ts +439 -0
  64. package/src/__tests__/dtcg-parser.test.ts +884 -0
  65. package/src/__tests__/preview-runtime.test.tsx +111 -0
  66. package/src/__tests__/schema.test.ts +31 -0
  67. package/src/__tests__/severity.test.ts +34 -0
  68. package/src/__tests__/style-comparison.test.ts +662 -0
  69. package/src/__tests__/tokens-compat.test.ts +51 -0
  70. package/src/agent-format.test.ts +105 -0
  71. package/src/agent-format.ts +141 -0
  72. package/src/bundle.ts +149 -0
  73. package/src/codes/__tests__/codes.test.ts +73 -0
  74. package/src/codes/codes.ts +463 -0
  75. package/src/codes/index.ts +7 -0
  76. package/src/codes/source-finding-bridge.ts +113 -0
  77. package/src/compiled-types/index.ts +293 -0
  78. package/src/component-contract.ts +231 -0
  79. package/src/component-discovery.ts +80 -0
  80. package/src/composition.test.ts +262 -0
  81. package/src/composition.ts +318 -0
  82. package/src/config-paths.test.ts +78 -0
  83. package/src/config-paths.ts +47 -0
  84. package/src/config.ts +18 -0
  85. package/src/conform-prove.test.ts +274 -0
  86. package/src/conform-prove.ts +326 -0
  87. package/src/conform.ts +160 -0
  88. package/src/constants.ts +114 -0
  89. package/src/context.ts +2 -0
  90. package/src/contract/fixture.ts +110 -0
  91. package/src/contract/hash.test.ts +86 -0
  92. package/src/contract/hash.ts +195 -0
  93. package/src/contract/index.ts +43 -0
  94. package/src/contract/preimage.test.ts +254 -0
  95. package/src/contract/preimage.ts +365 -0
  96. package/src/contract/stamp.test.ts +100 -0
  97. package/src/contract/stamp.ts +105 -0
  98. package/src/contract-parser.ts +141 -0
  99. package/src/defineFragment.test.ts +257 -0
  100. package/src/defineFragment.ts +293 -0
  101. package/src/dtcg-generators.ts +324 -0
  102. package/src/dtcg-parser.ts +1 -0
  103. package/src/dtcg.ts +237 -0
  104. package/src/facts/__snapshots__/facts.test.ts.snap +124 -0
  105. package/src/facts/builders.ts +835 -0
  106. package/src/facts/compile.ts +422 -0
  107. package/src/facts/fact-index.ts +394 -0
  108. package/src/facts/facts.test.ts +494 -0
  109. package/src/facts/ids.ts +125 -0
  110. package/src/facts/index.ts +119 -0
  111. package/src/facts/types.ts +614 -0
  112. package/src/figma.ts +263 -0
  113. package/src/fragment-types.ts +214 -0
  114. package/src/generate/generate.test.ts +594 -0
  115. package/src/generate/index.ts +438 -0
  116. package/src/governance-integrity.test.ts +186 -0
  117. package/src/governance-integrity.ts +282 -0
  118. package/src/governance.test.ts +300 -0
  119. package/src/governance.ts +605 -0
  120. package/src/governance.type-test.ts +75 -0
  121. package/src/graph/engine.ts +446 -0
  122. package/src/graph/graph.test.ts +746 -0
  123. package/src/graph/index.ts +32 -0
  124. package/src/graph/serialization.ts +55 -0
  125. package/src/graph/types.ts +178 -0
  126. package/src/index.ts +891 -0
  127. package/src/local-canonical.ts +102 -0
  128. package/src/mcp-snapshot.ts +222 -0
  129. package/src/package-identity-match.ts +33 -0
  130. package/src/package-identity.generated.ts +233 -0
  131. package/src/package-identity.test.ts +99 -0
  132. package/src/package-identity.ts +157 -0
  133. package/src/performance-presets.ts +142 -0
  134. package/src/preview/comparison-artifact.test.ts +228 -0
  135. package/src/preview/comparison-artifact.ts +181 -0
  136. package/src/preview/comparison-context.ts +93 -0
  137. package/src/preview/comparison-evidence.ts +112 -0
  138. package/src/preview/comparison-format.ts +21 -0
  139. package/src/preview/comparison-presentation.ts +187 -0
  140. package/src/preview/comparison-references.test.ts +430 -0
  141. package/src/preview/comparison-references.ts +72 -0
  142. package/src/preview/comparison-score.ts +59 -0
  143. package/src/preview/comparison-styles.ts +197 -0
  144. package/src/preview/comparison.test.ts +559 -0
  145. package/src/preview/comparison.ts +488 -0
  146. package/src/preview/index.ts +10 -0
  147. package/src/preview/types.ts +309 -0
  148. package/src/preview/validation.test.ts +290 -0
  149. package/src/preview/validation.ts +356 -0
  150. package/src/preview-runtime.tsx +144 -0
  151. package/src/raw-html-canonical.test.ts +41 -0
  152. package/src/raw-html-canonical.ts +179 -0
  153. package/src/react-types.ts +21 -0
  154. package/src/registry-install-plan.ts +344 -0
  155. package/src/registry.test.ts +245 -0
  156. package/src/registry.ts +369 -0
  157. package/src/rules/a11y-required-accessible-name.ts +93 -0
  158. package/src/rules/color-math.test.ts +72 -0
  159. package/src/rules/color-math.ts +192 -0
  160. package/src/rules/components-forbidden-prop-value.ts +108 -0
  161. package/src/rules/components-prefer-library.ts +943 -0
  162. package/src/rules/components-unknown-prop.ts +94 -0
  163. package/src/rules/composition-pattern-schema.ts +125 -0
  164. package/src/rules/composition-pattern.test.ts +320 -0
  165. package/src/rules/composition-pattern.ts +271 -0
  166. package/src/rules/emit-gate.test.ts +42 -0
  167. package/src/rules/emit-gate.ts +60 -0
  168. package/src/rules/finding.ts +54 -0
  169. package/src/rules/index.ts +235 -0
  170. package/src/rules/jsx-preferred-component.ts +68 -0
  171. package/src/rules/jsx-preferred-import-path.ts +67 -0
  172. package/src/rules/presets.ts +57 -0
  173. package/src/rules/props-invalid-value.ts +115 -0
  174. package/src/rules/rules.test.ts +3636 -0
  175. package/src/rules/spacing-resolution.ts +184 -0
  176. package/src/rules/styles-no-raw-color.ts +329 -0
  177. package/src/rules/styles-no-raw-dimensions.ts +357 -0
  178. package/src/rules/styles-no-raw-spacing.ts +236 -0
  179. package/src/rules/styles-no-raw-typography.ts +237 -0
  180. package/src/rules/tailwind-arbitrary-color.test.ts +128 -0
  181. package/src/rules/tailwind-arbitrary-color.ts +93 -0
  182. package/src/rules/tailwind-arbitrary-spacing.test.ts +157 -0
  183. package/src/rules/tailwind-arbitrary-spacing.ts +120 -0
  184. package/src/rules/tailwind-forbidden-palette.test.ts +116 -0
  185. package/src/rules/tailwind-forbidden-palette.ts +107 -0
  186. package/src/rules/tailwind-off-scale-spacing-token.test.ts +100 -0
  187. package/src/rules/tailwind-off-scale-spacing-token.ts +108 -0
  188. package/src/rules/tailwind-raw-color-via-token.test.ts +108 -0
  189. package/src/rules/tailwind-raw-color-via-token.ts +82 -0
  190. package/src/rules/tailwind-rule-utils.ts +106 -0
  191. package/src/rules/tailwind-unknown-class.test.ts +157 -0
  192. package/src/rules/tailwind-unknown-class.ts +121 -0
  193. package/src/rules/taxonomy.test.ts +238 -0
  194. package/src/rules/theme-no-theme-coupled-literal.ts +132 -0
  195. package/src/rules/tiers.ts +111 -0
  196. package/src/rules/tokens-css-vars-must-be-defined.test.ts +244 -0
  197. package/src/rules/tokens-css-vars-must-be-defined.ts +156 -0
  198. package/src/rules/tokens-require-dual-fallback.ts +78 -0
  199. package/src/rules/types.ts +27 -0
  200. package/src/rules/utils.test.ts +110 -0
  201. package/src/rules/utils.ts +599 -0
  202. package/src/schema.ts +427 -0
  203. package/src/schemas/index.ts +275 -0
  204. package/src/schemas/schemas.test.ts +124 -0
  205. package/src/severity.ts +54 -0
  206. package/src/storyAdapter.test.ts +571 -0
  207. package/src/storyAdapter.ts +761 -0
  208. package/src/storyFilters.test.ts +350 -0
  209. package/src/storyFilters.ts +253 -0
  210. package/src/storybook-csf.ts +11 -0
  211. package/src/style-comparison.ts +423 -0
  212. package/src/test-utils.ts +68 -0
  213. package/src/token-parser.ts +2 -0
  214. package/src/token-types.ts +287 -0
  215. package/src/tokens/categories.ts +131 -0
  216. package/src/tokens/color.ts +193 -0
  217. package/src/tokens/design-token-parser.test.ts +159 -0
  218. package/src/tokens/design-token-parser.ts +402 -0
  219. package/src/tokens/dtcg.ts +428 -0
  220. package/src/tokens/index.ts +130 -0
  221. package/src/tokens/lookup.ts +19 -0
  222. package/src/tokens/scss.ts +171 -0
  223. package/src/tokens/tailwind-v4.ts +187 -0
  224. package/src/tokens/types.ts +43 -0
  225. package/src/topology/index.ts +9 -0
  226. package/src/topology/resolve-area.test.ts +174 -0
  227. package/src/topology/resolve-area.ts +215 -0
  228. package/src/types.ts +1057 -0
package/src/index.ts ADDED
@@ -0,0 +1,891 @@
1
+ /**
2
+ * Browser-safe exports for @usefragments/cli/core
3
+ * For Node.js-only APIs (config, discovery, loader), import from '@usefragments/cli' directly.
4
+ */
5
+
6
+ // Brand and default constants
7
+ export { BRAND, DEFAULTS } from "./constants.js";
8
+ export type { Brand, Defaults } from "./constants.js";
9
+
10
+ // Conform engine contract (shared across extract engine, mcp tool, surfaces)
11
+ export type {
12
+ ConformChange,
13
+ ConformComponentMapping,
14
+ ConformConfidence,
15
+ ConformCoverage,
16
+ ConformInput,
17
+ ConformLocation,
18
+ ConformPropMapping,
19
+ ConformResult,
20
+ ConformSuggestion,
21
+ ConformToken,
22
+ ConformUnresolved,
23
+ DesignSystemContext,
24
+ } from "./conform.js";
25
+
26
+ // Prove-compliant loop (Contract Mode Phase 2): the pure validate-fix-validate
27
+ // primitive behind `contract.prove`. Framework-agnostic — takes a conform
28
+ // callback + optional sampler, returns a 3-valued verdict.
29
+ export {
30
+ PROVE_DEFAULT_MAX_PASSES,
31
+ PROVE_MAX_PASSES,
32
+ clampMaxPasses,
33
+ emptyConformResult,
34
+ proveCompliant,
35
+ proveIssueCount,
36
+ resolveProveVerdict,
37
+ } from "./conform-prove.js";
38
+ export type {
39
+ ProveCallbacks,
40
+ ProveLoopResult,
41
+ ProveOptions,
42
+ ProvePass,
43
+ ProvePassSampling,
44
+ ProveResidual,
45
+ ProveSample,
46
+ ProveSamplerArgs,
47
+ ProveVerdict,
48
+ } from "./conform-prove.js";
49
+
50
+ // Shared TypeStyle severity helpers
51
+ export {
52
+ SEVERITIES,
53
+ SEVERITY_RANK,
54
+ SEVERITY_WEIGHTS,
55
+ compareSeverity,
56
+ maxSeverity,
57
+ severityLevel,
58
+ severitySchema,
59
+ sortBySeverity,
60
+ } from "./severity.js";
61
+ export type { Severity, SeverityLevel } from "./severity.js";
62
+
63
+ // Canonical TypeStyle schemas
64
+ export {
65
+ agentFormatSchema,
66
+ factEvidenceSchema,
67
+ factLocationSchema,
68
+ findingFixSchema,
69
+ findingReplaceClassTokenFixSchema,
70
+ findingReplaceComponentFixSchema,
71
+ findingReplaceImportFixSchema,
72
+ findingReplacePropValueFixSchema,
73
+ findingReplaceStyleValueFixSchema,
74
+ findingSchema,
75
+ fixSchema,
76
+ governanceVerdictMetadataSchema,
77
+ governanceVerdictSchema,
78
+ normalizeFinding,
79
+ normalizeSeverity,
80
+ normalizeViolation,
81
+ suppressionDirectiveSchema,
82
+ validatorResultSchema,
83
+ violationSchema,
84
+ } from "./schemas/index.js";
85
+ export type {
86
+ AgentFormat,
87
+ Fix,
88
+ Finding as CanonicalFinding,
89
+ GovernanceVerdict as CanonicalGovernanceVerdict,
90
+ GovernanceVerdictMetadata,
91
+ SuppressionDirective,
92
+ ValidatorResult,
93
+ Violation,
94
+ } from "./schemas/index.js";
95
+
96
+ // FUI code registry
97
+ export {
98
+ CODES,
99
+ EXPLAIN_URL_BASE,
100
+ bridgeSourceViolation,
101
+ bridgeSourceViolations,
102
+ byCode,
103
+ byRuleId,
104
+ explainUrlForCode,
105
+ } from "./codes/index.js";
106
+ export type {
107
+ BridgeViolationInput,
108
+ CodeCategory,
109
+ CodeLifecycle,
110
+ FuiCode,
111
+ Severity as FuiSeverity,
112
+ } from "./codes/index.js";
113
+
114
+ export { buildAgentFormat, type BuildAgentFormatInput } from "./agent-format.js";
115
+
116
+ export {
117
+ isPortableRepoPath,
118
+ normalizeConfigPath,
119
+ portableRepoPathError,
120
+ resolveConfiguredAppPath,
121
+ tokenIncludesFromConfig,
122
+ topologyBase,
123
+ } from "./config-paths.js";
124
+
125
+ // Types
126
+ export type {
127
+ FragmentComponent,
128
+ ComponentRef,
129
+ FragmentMeta,
130
+ FragmentUsage,
131
+ PropType,
132
+ PropDefinition,
133
+ ControlType,
134
+ RelationshipType,
135
+ ComponentRelation,
136
+ VariantLoader,
137
+ PlayFunction,
138
+ PlayFunctionContext,
139
+ FragmentVariant,
140
+ FragmentDefinition,
141
+ FragmentsConfig,
142
+ SnippetPolicyConfig,
143
+ RegistryOptions,
144
+ CompiledFragment,
145
+ CompiledFragmentsFile,
146
+ ObservedComponentUsage,
147
+ ObservedUsageProp,
148
+ BlockDefinition,
149
+ CompiledBlock,
150
+ RecipeDefinition, // @deprecated - use BlockDefinition
151
+ CompiledRecipe, // @deprecated - use CompiledBlock
152
+ // Contract and provenance types
153
+ FragmentContract,
154
+ FragmentGenerated,
155
+ // AI metadata type
156
+ AIMetadata,
157
+ // v2 types (alongside v1, non-breaking)
158
+ FragmentGuidance,
159
+ FragmentExample,
160
+ CompositionMetadata,
161
+ FragmentProvenance,
162
+ FragmentDefinitionV2,
163
+ // Screenshot types
164
+ ScreenshotConfig,
165
+ ServiceConfig,
166
+ Viewport,
167
+ Theme,
168
+ Screenshot,
169
+ ScreenshotMetadata,
170
+ DiffResult,
171
+ BoundingBox,
172
+ BaselineInfo,
173
+ Manifest,
174
+ VerifyRequest,
175
+ VerifyResult,
176
+ // Figma property mapping types
177
+ FigmaPropMapping,
178
+ FigmaStringMapping,
179
+ FigmaBooleanMapping,
180
+ FigmaEnumMapping,
181
+ FigmaInstanceMapping,
182
+ FigmaChildrenMapping,
183
+ FigmaTextContentMapping,
184
+ // Storybook filter configuration
185
+ StorybookFilterConfig,
186
+ // Token configuration
187
+ AppConfig,
188
+ DesignSystemConfig,
189
+ RepoRelativePath,
190
+ TokenConfig,
191
+ TokenSourceConfig,
192
+ TokenSourceFormat,
193
+ // Theme and snapshot configuration
194
+ ThemeSeeds,
195
+ SnapshotConfig,
196
+ // Compiled token types
197
+ CompiledTokenEntry,
198
+ CompiledTokenData,
199
+ } from "./types.js";
200
+
201
+ // Performance presets
202
+ export {
203
+ resolvePerformanceConfig,
204
+ classifyComplexity,
205
+ formatBytes,
206
+ budgetBar,
207
+ PRESET_NAMES,
208
+ } from "./performance-presets.js";
209
+ export type {
210
+ PerformanceBudgets,
211
+ PerformanceConfig,
212
+ ComplexityTier,
213
+ PerformanceData as PerfData,
214
+ PerformanceSummary as PerfSummary,
215
+ } from "./performance-presets.js";
216
+
217
+ // Token types
218
+ export type {
219
+ TokenCategory,
220
+ DesignToken,
221
+ TokenRegistry,
222
+ TokenRegistryMeta,
223
+ EnhancedStyleDiffItem,
224
+ TokenFix,
225
+ TokenParseResult,
226
+ TokenParseError,
227
+ TokenMatchRequest,
228
+ TokenMatchResult,
229
+ TokenUsageSummary,
230
+ } from "./token-types.js";
231
+
232
+ // Bundle contracts for Cloud setup bundles
233
+ export {
234
+ bundleSchemaVersionSchema,
235
+ bundleTargetSchema,
236
+ bundleArtifactMetadataSchema,
237
+ bundleManifestComponentEntrySchema,
238
+ bundleManifestSchema,
239
+ bundleComponentShardSchema,
240
+ bundleTokenFileSchema,
241
+ } from "./bundle.js";
242
+ export type {
243
+ BundleSchemaVersion,
244
+ BundleTarget,
245
+ BundleArtifactMetadata,
246
+ BundleManifestComponentEntry,
247
+ BundleManifest,
248
+ BundleComponentShard,
249
+ BundleTokenFile,
250
+ } from "./bundle.js";
251
+
252
+ // Fragments Registry Protocol contracts
253
+ export {
254
+ REGISTRY_ARTIFACT_SCHEMA_VERSION,
255
+ REGISTRY_INSTALL_RECEIPT_SCHEMA_VERSION,
256
+ REGISTRY_MANIFEST_SCHEMA_VERSION,
257
+ assertValidRegistryArtifact,
258
+ buildRegistryArtifact,
259
+ buildRegistryFile,
260
+ computeRegistryHash,
261
+ finalizeRegistryManifest,
262
+ hashRegistryFileContent,
263
+ registryArtifactDigest,
264
+ registryArtifactSchema,
265
+ registryComponentExportSchema,
266
+ registryComponentSchema,
267
+ registryDependencySchema,
268
+ registryDependencyTypeSchema,
269
+ registryEntrypointSchema,
270
+ registryFileContentSchema,
271
+ registryFileRoleSchema,
272
+ registryFileSchema,
273
+ registryFileSize,
274
+ registryInstallProfileSchema,
275
+ registryInstallReceiptComponentSchema,
276
+ registryInstallReceiptFileSchema,
277
+ registryInstallReceiptSchema,
278
+ registryManifestCanonicalPreimage,
279
+ registryManifestDraftSchema,
280
+ registryManifestSchema,
281
+ registrySourceSchema,
282
+ } from "./registry.js";
283
+ export type {
284
+ RegistryArtifact,
285
+ RegistryArtifactInput,
286
+ RegistryComponent,
287
+ RegistryComponentExport,
288
+ RegistryDependency,
289
+ RegistryDependencyType,
290
+ RegistryEntrypoint,
291
+ RegistryFile,
292
+ RegistryFileContent,
293
+ RegistryFileInput,
294
+ RegistryFileRole,
295
+ RegistryInstallProfile,
296
+ RegistryInstallReceipt,
297
+ RegistryInstallReceiptComponent,
298
+ RegistryInstallReceiptFile,
299
+ RegistryManifest,
300
+ RegistryManifestDraft,
301
+ RegistrySource,
302
+ } from "./registry.js";
303
+
304
+ export {
305
+ assertPortableRegistryPath,
306
+ buildRegistryInstallPlan,
307
+ buildRegistryInstallReceipt,
308
+ collectRegistryInstallDependencies,
309
+ normalizeRegistryRepoPath,
310
+ selectedRegistryComponentNames,
311
+ sourceToRegistryTargetPath,
312
+ } from "./registry-install-plan.js";
313
+ export type {
314
+ BuildRegistryInstallPlanInput,
315
+ RegistryInstallPlan,
316
+ RegistryWritePlan,
317
+ } from "./registry-install-plan.js";
318
+
319
+ // MCP snapshot contracts
320
+ export {
321
+ mcpSnapshotSchemaVersionSchema,
322
+ mcpSourceTypeSchema,
323
+ mcpCapabilitySchema,
324
+ mcpPerformanceImportSchema,
325
+ mcpPerformanceDataSchema,
326
+ mcpPerformanceSummarySchema,
327
+ mcpComponentPropSchema,
328
+ mcpComponentExampleSchema,
329
+ mcpComponentRelationSchema,
330
+ mcpCompoundChildSchema,
331
+ mcpGuidancePatternSchema,
332
+ mcpComponentGuidanceSchema,
333
+ mcpComponentMetadataSchema,
334
+ mcpComponentSchema,
335
+ mcpBlockSchema,
336
+ mcpTokenSchema,
337
+ mcpTokenDataSchema,
338
+ mcpSnapshotMetadataSchema,
339
+ mcpSnapshotSchema,
340
+ } from "./mcp-snapshot.js";
341
+ export type {
342
+ McpSnapshotSchemaVersion,
343
+ McpSourceType,
344
+ McpCapability,
345
+ McpPerformanceImport,
346
+ McpPerformanceData,
347
+ McpPerformanceSummary,
348
+ McpComponentProp,
349
+ McpComponentExample,
350
+ McpComponentRelation,
351
+ McpCompoundChild,
352
+ McpGuidancePattern,
353
+ McpComponentGuidance,
354
+ McpComponentMetadata,
355
+ McpComponent,
356
+ McpBlock,
357
+ McpToken,
358
+ McpTokenData,
359
+ McpSnapshotMetadata,
360
+ McpSnapshot,
361
+ } from "./mcp-snapshot.js";
362
+
363
+ // Canonical style comparison engine used by Fragments Inspect.
364
+ export {
365
+ compareStyleValue,
366
+ compareStyles,
367
+ compareStylesWithTokens,
368
+ normalizeStyleValue,
369
+ compareColors,
370
+ compareNumericValues,
371
+ formatTokenSummary,
372
+ getComplianceBadge,
373
+ DEFAULT_STYLE_PROPERTIES,
374
+ DEFAULT_ENHANCED_STYLE_PROPERTIES,
375
+ } from "./style-comparison.js";
376
+ export type {
377
+ NormalizedToken,
378
+ NormalizedStyleMap,
379
+ StyleComparisonOptions,
380
+ StyleDiffItem,
381
+ StyleComparisonResult,
382
+ TokenLookup,
383
+ EnhancedStyleComparisonResult,
384
+ } from "./style-comparison.js";
385
+
386
+ // Schema validation (Zod is browser-safe)
387
+ export {
388
+ fragmentMetaSchema,
389
+ fragmentUsageSchema,
390
+ propDefinitionSchema,
391
+ componentRelationSchema,
392
+ fragmentVariantSchema,
393
+ fragmentDefinitionSchema,
394
+ fragmentsConfigSchema,
395
+ figmaPropMappingSchema,
396
+ // Contract and provenance schemas
397
+ fragmentContractSchema,
398
+ fragmentGeneratedSchema,
399
+ fragmentBanSchema,
400
+ blockDefinitionSchema,
401
+ recipeDefinitionSchema, // @deprecated - use blockDefinitionSchema
402
+ // AI metadata schema
403
+ aiMetadataSchema,
404
+ // v2 schemas
405
+ compositionMetadataSchema,
406
+ fragmentProvenanceSchema,
407
+ fragmentDefinitionV2Schema,
408
+ governedFragmentDefinitionSchema,
409
+ } from "./schema.js";
410
+
411
+ // Main API
412
+ export { defineConfig } from "./config.js";
413
+ export {
414
+ defineFragment,
415
+ compileFragment,
416
+ normalizeToV1,
417
+ defineBlock,
418
+ compileBlock,
419
+ defineRecipe,
420
+ compileRecipe,
421
+ } from "./defineFragment.js";
422
+ export type { InferProps } from "./defineFragment.js";
423
+
424
+ // Governance authoring DSL
425
+ export {
426
+ componentGovernanceRecordSchema,
427
+ componentGovernanceRecordsSchema,
428
+ g,
429
+ globalGovernanceRecordSchema,
430
+ globalJsxGovernanceRecordSchema,
431
+ globalStyleGovernanceRecordSchema,
432
+ governanceConfigSchema,
433
+ governanceSeveritySchema,
434
+ normalizeGovernanceConfig,
435
+ scaleGovernanceRecordSchema,
436
+ } from "./governance.js";
437
+ export type {
438
+ AccessibilityGovernanceBuilder,
439
+ CanonicalSource,
440
+ ComponentGovernanceBuilder,
441
+ ComponentGovernanceRecord,
442
+ GlobalGovernanceRecord,
443
+ GlobalJsxGovernanceRecord,
444
+ GlobalStyleGovernanceRecord,
445
+ GovernanceConfig,
446
+ GovernancePropValue,
447
+ GovernanceSeverity,
448
+ GovernedFragmentDefinition,
449
+ PropGovernanceBuilder,
450
+ PropGovernanceOptions,
451
+ PropKey,
452
+ ResolvedGovernedFragmentDefinition,
453
+ ScaleGovernanceRecord,
454
+ } from "./governance.js";
455
+
456
+ // Story adapter (runtime conversion of Storybook modules)
457
+ export {
458
+ storyModuleToFragment,
459
+ setPreviewConfig,
460
+ getPreviewConfig,
461
+ // Re-export @storybook/csf utilities
462
+ toId,
463
+ storyNameFromExport,
464
+ isExportStory,
465
+ } from "./storyAdapter.js";
466
+ export type {
467
+ StoryModule,
468
+ StoryMeta,
469
+ Story,
470
+ StoryArgType,
471
+ StoryContext,
472
+ Decorator,
473
+ Loader,
474
+ PreviewConfig,
475
+ CSF2Story,
476
+ } from "./storyAdapter.js";
477
+
478
+ // Storybook adapter filtering
479
+ export {
480
+ checkStoryExclusion,
481
+ detectSubComponentPaths,
482
+ isForceIncluded,
483
+ isConfigExcluded,
484
+ } from "./storyFilters.js";
485
+ export type { ExclusionReason, ExclusionResult, CheckStoryExclusionOpts } from "./storyFilters.js";
486
+
487
+ // Context generation for AI agents
488
+ export { generateContext } from "./context.js";
489
+ export type { ContextOptions, ContextResult } from "./context.js";
490
+
491
+ // Figma property mapping DSL
492
+ export { figma, isFigmaPropMapping, resolveFigmaMapping } from "./figma.js";
493
+
494
+ // Fragment JSON types (for .fragment.json files)
495
+ export type {
496
+ Fragment,
497
+ FragmentFigma,
498
+ FragmentUsage as FragmentJsonUsage,
499
+ FragmentDoNotItem,
500
+ FragmentPattern,
501
+ FragmentAccessibility,
502
+ FragmentRelated,
503
+ FragmentMeta as FragmentJsonMeta,
504
+ FragmentIndex,
505
+ FragmentRegistry,
506
+ RegistryComponentEntry,
507
+ RegistryPropEntry,
508
+ FragmentContextOptions,
509
+ } from "./fragment-types.js";
510
+
511
+ // Token parsing and token-domain helpers
512
+ export {
513
+ calculateDeltaE,
514
+ colorSimilarity,
515
+ containsTailwindV4Theme,
516
+ familyDistance,
517
+ hexToRgb,
518
+ inferTokenCategory,
519
+ inferTokenGroup,
520
+ isColorLike,
521
+ nearestByDeltaE,
522
+ normalizeColor,
523
+ normalizeTokenGroupComment,
524
+ normalizeTokenValue,
525
+ parseColor,
526
+ parseColorToRgb,
527
+ parseCssTokens,
528
+ parseDesignTokenContent,
529
+ parseDtcgTokens,
530
+ parseRgb,
531
+ parseScssTokens,
532
+ parseScssVariables,
533
+ parseTailwindV4Theme,
534
+ parseTokenFile,
535
+ parseTokens,
536
+ resolveDesignTokenValue,
537
+ resolveTokenValue,
538
+ rgbToHex,
539
+ } from "./tokens/index.js";
540
+ export type {
541
+ DeltaEMatch,
542
+ DesignTokenParseOptions,
543
+ NearestByDeltaEOptions,
544
+ ParsedToken,
545
+ ParseTokensOptions,
546
+ RGB,
547
+ RGBA,
548
+ ThemeParserResult,
549
+ TokenFormat,
550
+ TokenParseOutput,
551
+ } from "./tokens/index.js";
552
+
553
+ // DTCG token format
554
+ export { parseDTCGFile, isDTCGFile } from "./dtcg-parser.js";
555
+ export type {
556
+ DTCGTokenFile,
557
+ DTCGToken,
558
+ DTCGGroup,
559
+ DTCGTokenType,
560
+ DTCGColorValue,
561
+ DTCGDimensionValue,
562
+ ResolvedDTCGToken,
563
+ } from "./dtcg.js";
564
+ export { dtcgTokenFileSchema } from "./dtcg.js";
565
+
566
+ // Component contracts (framework-agnostic)
567
+ export { parseComponentContract, isContractFile } from "./contract-parser.js";
568
+ export type { CompiledContractOutput } from "./contract-parser.js";
569
+ export type { ComponentContract } from "./component-contract.js";
570
+ export { componentContractSchema } from "./component-contract.js";
571
+
572
+ // DTCG output generators
573
+ export {
574
+ generateCSSCustomProperties,
575
+ generateSCSSVariables,
576
+ generateTailwindConfig,
577
+ generateFigmaVariables,
578
+ } from "./dtcg-generators.js";
579
+ export type {
580
+ CSSGeneratorOptions,
581
+ SCSSGeneratorOptions,
582
+ FigmaVariable,
583
+ FigmaVariableCollection,
584
+ } from "./dtcg-generators.js";
585
+
586
+ // Composition analysis
587
+ export { analyzeComposition } from "./composition.js";
588
+ export type {
589
+ CompositionAnalysis,
590
+ CompositionWarning,
591
+ CompositionSuggestion,
592
+ CompositionGuideline,
593
+ } from "./composition.js";
594
+
595
+ // Shared preview runtime
596
+ export {
597
+ executeVariantLoaders,
598
+ resolvePreviewRuntimeState,
599
+ usePreviewVariantRuntime,
600
+ PreviewVariantRuntime,
601
+ } from "./preview-runtime.js";
602
+ export type {
603
+ PreviewVariantLike,
604
+ PreviewRuntimeState,
605
+ PreviewRuntimeOptions,
606
+ } from "./preview-runtime.js";
607
+
608
+ // Component discovery
609
+ export { discoverComponents, isReactComponent } from "./component-discovery.js";
610
+ export type { DiscoverComponentsOptions } from "./component-discovery.js";
611
+
612
+ // Phase 5 rules (governance compiler refactor)
613
+ export {
614
+ RULES,
615
+ runRules,
616
+ makeFinding,
617
+ ruleComponentsUnknownProp,
618
+ ruleComponentsForbiddenPropValue,
619
+ ruleComponentsPreferLibrary,
620
+ rulePropsInvalidValue,
621
+ ruleJsxPreferredImportPath,
622
+ ruleJsxPreferredComponent,
623
+ ruleStylesNoRawColor,
624
+ ruleStylesNoRawDimensions,
625
+ ruleStylesNoRawSpacing,
626
+ ruleStylesNoRawTypography,
627
+ ruleThemeNoThemeCoupledLiteral,
628
+ ruleTailwindArbitraryColor,
629
+ ruleTailwindArbitrarySpacing,
630
+ ruleTailwindForbiddenPalette,
631
+ ruleTailwindOffScaleSpacingToken,
632
+ ruleTailwindRawColorViaToken,
633
+ ruleTailwindUnknownClass,
634
+ ruleTokensRequireDualFallback,
635
+ ruleA11yRequiredAccessibleName,
636
+ } from "./rules/index.js";
637
+ export { nearestSignedScaleValue } from "./rules/utils.js";
638
+ export {
639
+ buildSpacingTokenLookup,
640
+ resolveSpacingValue,
641
+ type CheckedSpacingValue,
642
+ type SpacingResolutionScale,
643
+ type SpacingTokenLookup,
644
+ } from "./rules/spacing-resolution.js";
645
+ export type {
646
+ Rule,
647
+ RuleFn,
648
+ Finding,
649
+ FindingFix,
650
+ FindingReplaceComponentFix,
651
+ FindingReplaceImportFix,
652
+ FindingReplacePropValueFix,
653
+ FindingReplaceStyleValueFix,
654
+ FindingReplaceClassTokenFix,
655
+ } from "./rules/index.js";
656
+ // Composition config contract (region-scoped governance, brief 04) — shared
657
+ // across the policy boundary: rule guard, cloud policy validation, fragment
658
+ // authoring sugar.
659
+ export {
660
+ compositionPatternSchema,
661
+ compositionAuthoringEntrySchema,
662
+ isCompositionPattern,
663
+ lowerCompositionContract,
664
+ } from "./rules/index.js";
665
+ export type {
666
+ CompositionPattern,
667
+ CompositionRegionSelector,
668
+ CompositionChildSelector,
669
+ CompositionConstraint,
670
+ CompositionAuthoringEntry,
671
+ } from "./rules/index.js";
672
+
673
+ // Rule taxonomy SSOT (contract-findings brief 02): tier map + customer/fragments
674
+ // presets, consumed by the cloud policy composer + UI rules editor.
675
+ export {
676
+ RULE_TIER,
677
+ FRAGMENTS_INTERNAL_RULE_IDS,
678
+ tierFor,
679
+ isContractTierRule,
680
+ contractTierRuleIds,
681
+ hygieneTierRuleIds,
682
+ vocabularyRank,
683
+ compareByVocabularyRank,
684
+ customerDefaultRuleStates,
685
+ fragmentsPresetRuleStates,
686
+ } from "./rules/index.js";
687
+ export type { RuleTier, PresetRuleState } from "./rules/index.js";
688
+
689
+ // Blocking deny-set (Contract Mode Phase 0): shared "may this finding hard-deny
690
+ // a write" criteria — single-sourced for the CLI hook + the emit gate.
691
+ export { BLOCKING_RULE_ALLOWLIST, gatesCi, isDenyEligible } from "./rules/index.js";
692
+
693
+ // Governance integrity — armed-vs-declared verdict over a fully-resolved policy.
694
+ // Encodes "enabled ≠ armed": a rule with no vocabulary enforces nothing.
695
+ export {
696
+ evaluateGovernanceIntegrity,
697
+ hasEffectiveComponentVocabulary,
698
+ isEffectiveCanonicalSource,
699
+ } from "./governance-integrity.js";
700
+ export type {
701
+ GovernanceIntegrityFamily,
702
+ GovernanceIntegrityFamilyId,
703
+ GovernanceIntegrityInput,
704
+ GovernanceIntegrityStatus,
705
+ GovernanceIntegrityVerdict,
706
+ } from "./governance-integrity.js";
707
+
708
+ // Fact IR + index (Phase 3 of the governance compiler refactor)
709
+ export {
710
+ componentId,
711
+ asComponentId,
712
+ factId,
713
+ hash64Hex,
714
+ canonicalJson,
715
+ FactIndex,
716
+ matchesGlob,
717
+ makeComponentMetadataFact,
718
+ makeComponentCapabilityFact,
719
+ makeCanonicalCandidateFact,
720
+ makeCanonicalMappingFact,
721
+ makeCanonicalReplacementFact,
722
+ makePropMetadataFact,
723
+ makePropValueAvoidedFact,
724
+ makePropValueForbiddenFact,
725
+ makeA11yNameRequiredFact,
726
+ makeScaleFact,
727
+ makeScaleValueFact,
728
+ makeStructuralConfidenceFact,
729
+ makeStyleRawColorForbiddenFact,
730
+ makeStylePropertyScaleFact,
731
+ makeStyleFontSizeScaleFact,
732
+ makeStyleCssVarsMustBeDefinedFact,
733
+ makeContractTokenFact,
734
+ makeJsxUnknownPropsForbiddenFact,
735
+ makeJsxInlineStyleForbiddenRawFact,
736
+ makeJsxImportPathPreferredFact,
737
+ makeJsxComponentPreferredFact,
738
+ makeTokenDefinitionFact,
739
+ makeTailwindPaletteAllowFact,
740
+ makeTailwindPaletteDenyFact,
741
+ makeTailwindUnknownClassEnabledFact,
742
+ makeUsageNodeFact,
743
+ makeUsageComponentFact,
744
+ makeUsageImportFact,
745
+ makeUsagePropResolvedFact,
746
+ makeUsageInlineStyleFact,
747
+ makeUsageTextChildFact,
748
+ makeStyleDeclarationFact,
749
+ makeStyleUnsupportedFact,
750
+ makeClassNameLiteralFact,
751
+ makeClassNameDynamicFact,
752
+ makeTailwindClassFact,
753
+ makeThemeDeclarationFact,
754
+ makeTailwindTokenResolvedFact,
755
+ compileGlobalGovernanceFacts,
756
+ compileComponentFacts,
757
+ } from "./facts/index.js";
758
+ export {
759
+ canonicalPreimage,
760
+ AGENT_CONTEXT_RELATIVE_PATH,
761
+ CATALOG_FIXTURE_A_FCID,
762
+ catalogFixtureA,
763
+ catalogFixtureAContractPayload,
764
+ catalogFixtureATokensDtcg,
765
+ CONTRACT_DOMAINS,
766
+ CONTRACT_PREIMAGE_SCHEMA,
767
+ contractComponentsFromFragments,
768
+ contractHash,
769
+ contractPolicyFromGovernanceConfig,
770
+ diffContractDomains,
771
+ formatStampHeader,
772
+ formatStampPin,
773
+ formatStampVersionHash,
774
+ parseContractStamp,
775
+ projectContractPreimage,
776
+ serializeContractStamp,
777
+ sha256Hex,
778
+ } from "./contract/index.js";
779
+ export {
780
+ OWNED_PACKAGE_IDENTITY_EPOCH,
781
+ OWNED_PACKAGE_IDENTITY_SOURCE_SHA256,
782
+ authorOwnedImport,
783
+ canonicalizeOwnedComponentId,
784
+ canonicalizeOwnedImport,
785
+ ownedImportEquivalents,
786
+ projectV1OwnedComponentId,
787
+ projectV1OwnedImportIdentity,
788
+ resolveOwnedPackageImport,
789
+ } from "./package-identity.js";
790
+ export type { OwnedPackageIdentityResolution, OwnedPackageStatus } from "./package-identity.js";
791
+ export type {
792
+ CanonicalMappingStatus,
793
+ ContractCanonicalMappingInput,
794
+ ContractCatalogInput,
795
+ ContractComponentInput,
796
+ ContractDomain,
797
+ ContractPolicyInput,
798
+ ContractPreimage,
799
+ ContractPropMappingInput,
800
+ ContractStampPin,
801
+ ContractStampRecord,
802
+ ContractTokenInput,
803
+ ContractWaiverInput,
804
+ } from "./contract/index.js";
805
+ export {
806
+ governanceConfigWithLocalCanonical,
807
+ localCanonicalContractMappings,
808
+ } from "./local-canonical.js";
809
+ export type {
810
+ InspectConfig,
811
+ LocalCanonicalDeclaration,
812
+ LocalCanonicalResolveRule,
813
+ } from "./local-canonical.js";
814
+ export {
815
+ RAW_HTML_ADVISORY_TAGS,
816
+ RAW_HTML_CANONICAL_TAGS,
817
+ RAW_HTML_INPUT_TYPE_CANONICALS,
818
+ RAW_HTML_ROLE_CANONICALS,
819
+ isEnforceableHtmlEquivalent,
820
+ isRawHtmlAdvisoryTier,
821
+ resolveCanonicalForAriaRole,
822
+ resolveCanonicalForRawHtml,
823
+ type RawHtmlCanonicalMatch,
824
+ type RawHtmlPrecisionTier,
825
+ } from "./raw-html-canonical.js";
826
+ export type {
827
+ ComponentId,
828
+ FactId,
829
+ Fact,
830
+ FactKind,
831
+ FactOfKind,
832
+ FactLocation,
833
+ FactEvidence,
834
+ CanonicalCandidateFact,
835
+ CanonicalMappingFact,
836
+ CanonicalReplacementFact,
837
+ ComponentLevelFact,
838
+ PolicyFact,
839
+ UsageFact,
840
+ ComponentMetadataFact,
841
+ ComponentCapabilityFact,
842
+ PropMetadataFact,
843
+ PropValueAvoidedFact,
844
+ PropValueForbiddenFact,
845
+ A11yNameRequiredFact,
846
+ ScaleFact,
847
+ ScaleValueFact,
848
+ StructuralConfidenceFact,
849
+ StyleRawColorForbiddenFact,
850
+ StylePropertyScaleFact,
851
+ StyleFontSizeScaleFact,
852
+ StyleCssVarsMustBeDefinedFact,
853
+ JsxUnknownPropsForbiddenFact,
854
+ JsxInlineStyleForbiddenRawFact,
855
+ JsxImportPathPreferredFact,
856
+ JsxComponentPreferredFact,
857
+ TokenDefinitionFact,
858
+ TailwindPaletteAllowFact,
859
+ TailwindPaletteDenyFact,
860
+ TailwindUnknownClassEnabledFact,
861
+ UsageNodeFact,
862
+ UsageComponentFact,
863
+ UsageImportFact,
864
+ UsagePropResolvedFact,
865
+ UsageInlineStyleFact,
866
+ UsageTextChildFact,
867
+ StyleDeclarationFact,
868
+ StyleUnsupportedFact,
869
+ UnsupportedStyleReason,
870
+ ClassNameLiteralFact,
871
+ ClassNameDynamicFact,
872
+ ClassNameFact,
873
+ ClassNameOrigin,
874
+ ClassNameDynamicReason,
875
+ TailwindClassFact,
876
+ TailwindModifier,
877
+ TailwindModifierKind,
878
+ TailwindValue,
879
+ ThemeDeclarationFact,
880
+ TailwindResolvedKind,
881
+ TailwindResolutionSource,
882
+ TailwindResolvedValue,
883
+ TailwindTokenResolvedFact,
884
+ SuppressionDirectiveFact,
885
+ ComponentFactInput,
886
+ } from "./facts/index.js";
887
+
888
+ // Topology — map file paths to product areas (area-scoped governance).
889
+ // Also available at the `@usefragments/core/topology` subpath.
890
+ export { resolveArea } from "./topology/index.js";
891
+ export type { Area, AreaCriticality, AreaMatch, Topology } from "./topology/index.js";