@fragments-sdk/core 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +50 -13
- package/package.json +3 -3
- package/src/index.ts +3 -0
- package/src/types.ts +50 -0
package/dist/index.d.ts
CHANGED
|
@@ -465,6 +465,39 @@ interface StorybookFilterConfig {
|
|
|
465
465
|
/** Exclude sub-components detected by directory structure (default: true) */
|
|
466
466
|
excludeSubComponents?: boolean;
|
|
467
467
|
}
|
|
468
|
+
/**
|
|
469
|
+
* Theme seed configuration.
|
|
470
|
+
* The 5 root values that derive 120+ CSS custom properties.
|
|
471
|
+
*/
|
|
472
|
+
interface ThemeSeeds {
|
|
473
|
+
/** Primary brand color as hex (e.g., "#6366f1") */
|
|
474
|
+
brand?: string;
|
|
475
|
+
/** Neutral palette name */
|
|
476
|
+
neutral?: 'stone' | 'ice' | 'earth' | 'sand' | 'fire';
|
|
477
|
+
/** Spacing density scale */
|
|
478
|
+
density?: 'compact' | 'default' | 'relaxed';
|
|
479
|
+
/** Border radius style */
|
|
480
|
+
radiusStyle?: 'sharp' | 'subtle' | 'default' | 'rounded' | 'pill';
|
|
481
|
+
/** Danger/error color as hex (e.g., "#ef4444") */
|
|
482
|
+
danger?: string;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Visual snapshot testing configuration.
|
|
486
|
+
*/
|
|
487
|
+
interface SnapshotConfig {
|
|
488
|
+
/** Enable visual snapshot tests (default: false) */
|
|
489
|
+
enabled: boolean;
|
|
490
|
+
/** Output directory for snapshot baselines (relative to project root) */
|
|
491
|
+
outputDir?: string;
|
|
492
|
+
/** Viewport width for snapshots (default: 1440) */
|
|
493
|
+
viewportWidth?: number;
|
|
494
|
+
/** Viewport height for snapshots (default: 1100) */
|
|
495
|
+
viewportHeight?: number;
|
|
496
|
+
/** Diff threshold percentage before a snapshot fails (default: 0.1) */
|
|
497
|
+
threshold?: number;
|
|
498
|
+
/** Disable CSS animations during capture (default: true) */
|
|
499
|
+
disableAnimations?: boolean;
|
|
500
|
+
}
|
|
468
501
|
/**
|
|
469
502
|
* Config file structure
|
|
470
503
|
*/
|
|
@@ -504,6 +537,10 @@ interface FragmentsConfig {
|
|
|
504
537
|
};
|
|
505
538
|
/** Storybook adapter filtering configuration */
|
|
506
539
|
storybook?: StorybookFilterConfig;
|
|
540
|
+
/** Theme seed values for the 5-seed theming system */
|
|
541
|
+
theme?: ThemeSeeds;
|
|
542
|
+
/** Visual snapshot testing configuration */
|
|
543
|
+
snapshots?: SnapshotConfig;
|
|
507
544
|
}
|
|
508
545
|
/**
|
|
509
546
|
* Screenshot capture configuration
|
|
@@ -1238,16 +1275,16 @@ declare const propDefinitionSchema: z.ZodObject<{
|
|
|
1238
1275
|
}, "strip", z.ZodTypeAny, {
|
|
1239
1276
|
type: string;
|
|
1240
1277
|
values?: readonly string[] | undefined;
|
|
1241
|
-
description?: string | undefined;
|
|
1242
1278
|
default?: unknown;
|
|
1279
|
+
description?: string | undefined;
|
|
1243
1280
|
required?: boolean | undefined;
|
|
1244
1281
|
constraints?: string[] | undefined;
|
|
1245
1282
|
typeDetails?: Record<string, unknown> | undefined;
|
|
1246
1283
|
}, {
|
|
1247
1284
|
type: string;
|
|
1248
1285
|
values?: readonly string[] | undefined;
|
|
1249
|
-
description?: string | undefined;
|
|
1250
1286
|
default?: unknown;
|
|
1287
|
+
description?: string | undefined;
|
|
1251
1288
|
required?: boolean | undefined;
|
|
1252
1289
|
constraints?: string[] | undefined;
|
|
1253
1290
|
typeDetails?: Record<string, unknown> | undefined;
|
|
@@ -1598,16 +1635,16 @@ declare const fragmentDefinitionSchema: z.ZodObject<{
|
|
|
1598
1635
|
}, "strip", z.ZodTypeAny, {
|
|
1599
1636
|
type: string;
|
|
1600
1637
|
values?: readonly string[] | undefined;
|
|
1601
|
-
description?: string | undefined;
|
|
1602
1638
|
default?: unknown;
|
|
1639
|
+
description?: string | undefined;
|
|
1603
1640
|
required?: boolean | undefined;
|
|
1604
1641
|
constraints?: string[] | undefined;
|
|
1605
1642
|
typeDetails?: Record<string, unknown> | undefined;
|
|
1606
1643
|
}, {
|
|
1607
1644
|
type: string;
|
|
1608
1645
|
values?: readonly string[] | undefined;
|
|
1609
|
-
description?: string | undefined;
|
|
1610
1646
|
default?: unknown;
|
|
1647
|
+
description?: string | undefined;
|
|
1611
1648
|
required?: boolean | undefined;
|
|
1612
1649
|
constraints?: string[] | undefined;
|
|
1613
1650
|
typeDetails?: Record<string, unknown> | undefined;
|
|
@@ -1758,8 +1795,8 @@ declare const fragmentDefinitionSchema: z.ZodObject<{
|
|
|
1758
1795
|
props: Record<string, {
|
|
1759
1796
|
type: string;
|
|
1760
1797
|
values?: readonly string[] | undefined;
|
|
1761
|
-
description?: string | undefined;
|
|
1762
1798
|
default?: unknown;
|
|
1799
|
+
description?: string | undefined;
|
|
1763
1800
|
required?: boolean | undefined;
|
|
1764
1801
|
constraints?: string[] | undefined;
|
|
1765
1802
|
typeDetails?: Record<string, unknown> | undefined;
|
|
@@ -1847,8 +1884,8 @@ declare const fragmentDefinitionSchema: z.ZodObject<{
|
|
|
1847
1884
|
props: Record<string, {
|
|
1848
1885
|
type: string;
|
|
1849
1886
|
values?: readonly string[] | undefined;
|
|
1850
|
-
description?: string | undefined;
|
|
1851
1887
|
default?: unknown;
|
|
1888
|
+
description?: string | undefined;
|
|
1852
1889
|
required?: boolean | undefined;
|
|
1853
1890
|
constraints?: string[] | undefined;
|
|
1854
1891
|
typeDetails?: Record<string, unknown> | undefined;
|
|
@@ -1937,12 +1974,12 @@ declare const fragmentsConfigSchema: z.ZodObject<{
|
|
|
1937
1974
|
bundleSize?: number | undefined;
|
|
1938
1975
|
}>>;
|
|
1939
1976
|
}, "strip", z.ZodTypeAny, {
|
|
1940
|
-
preset?: "
|
|
1977
|
+
preset?: "relaxed" | "strict" | "standard" | undefined;
|
|
1941
1978
|
budgets?: {
|
|
1942
1979
|
bundleSize?: number | undefined;
|
|
1943
1980
|
} | undefined;
|
|
1944
1981
|
}, {
|
|
1945
|
-
preset?: "
|
|
1982
|
+
preset?: "relaxed" | "strict" | "standard" | undefined;
|
|
1946
1983
|
budgets?: {
|
|
1947
1984
|
bundleSize?: number | undefined;
|
|
1948
1985
|
} | undefined;
|
|
@@ -1997,8 +2034,8 @@ declare const fragmentsConfigSchema: z.ZodObject<{
|
|
|
1997
2034
|
requireFullSnippet?: boolean | undefined;
|
|
1998
2035
|
allowedExternalModules?: string[] | undefined;
|
|
1999
2036
|
} | undefined;
|
|
2000
|
-
performance?: "
|
|
2001
|
-
preset?: "
|
|
2037
|
+
performance?: "relaxed" | "strict" | "standard" | {
|
|
2038
|
+
preset?: "relaxed" | "strict" | "standard" | undefined;
|
|
2002
2039
|
budgets?: {
|
|
2003
2040
|
bundleSize?: number | undefined;
|
|
2004
2041
|
} | undefined;
|
|
@@ -2031,8 +2068,8 @@ declare const fragmentsConfigSchema: z.ZodObject<{
|
|
|
2031
2068
|
requireFullSnippet?: boolean | undefined;
|
|
2032
2069
|
allowedExternalModules?: string[] | undefined;
|
|
2033
2070
|
} | undefined;
|
|
2034
|
-
performance?: "
|
|
2035
|
-
preset?: "
|
|
2071
|
+
performance?: "relaxed" | "strict" | "standard" | {
|
|
2072
|
+
preset?: "relaxed" | "strict" | "standard" | undefined;
|
|
2036
2073
|
budgets?: {
|
|
2037
2074
|
bundleSize?: number | undefined;
|
|
2038
2075
|
} | undefined;
|
|
@@ -2870,4 +2907,4 @@ interface PreviewVariantRuntimeProps extends PreviewRuntimeOptions {
|
|
|
2870
2907
|
*/
|
|
2871
2908
|
declare function PreviewVariantRuntime({ variant, loadedData, children, }: PreviewVariantRuntimeProps): react_jsx_runtime.JSX.Element;
|
|
2872
2909
|
|
|
2873
|
-
export { type AIMetadata, BRAND, type BaselineInfo, type BlockDefinition, type BoundingBox, type Brand, type CSF2Story, type CheckStoryExclusionOpts, type CompiledRecipe, type ComplexityTier, type ComponentRelation, type CompositionAnalysis, type CompositionGuideline, type CompositionSuggestion, type CompositionWarning, type ControlType, DEFAULTS, type Decorator, type Defaults, type DesignToken, type DiffResult, type EnhancedStyleDiffItem, type ExclusionReason, type ExclusionResult, type FigmaBooleanMapping, type FigmaChildrenMapping, type FigmaEnumMapping, type FigmaInstanceMapping, type FigmaPropMapping, type FigmaStringMapping, type FigmaTextContentMapping, type Fragment, type FragmentAccessibility, type FragmentComponent, type FragmentContextOptions, type FragmentContract, type FragmentDefinition, type FragmentDoNotItem, type FragmentFigma, type FragmentGenerated, type FragmentIndex, type FragmentMeta as FragmentJsonMeta, type FragmentUsage as FragmentJsonUsage, type FragmentMeta$1 as FragmentMeta, type FragmentPattern, type FragmentRegistry, type FragmentRelated, type FragmentUsage$1 as FragmentUsage, type FragmentVariant, type FragmentsConfig, type InferProps, type Loader, type Manifest, PRESET_NAMES, type ParsedToken, type PerformanceData as PerfData, type PerformanceSummary as PerfSummary, type PerformanceBudgets, type PerformanceConfig, type PlayFunction, type PlayFunctionContext, type PreviewConfig, type PreviewRuntimeOptions, type PreviewRuntimeState, type PreviewVariantLike, PreviewVariantRuntime, type PropDefinition, type PropType, type RecipeDefinition, type RegistryComponentEntry, type RegistryOptions, type RegistryPropEntry, type RelationshipType, type Screenshot, type ScreenshotConfig, type ScreenshotMetadata, type ServiceConfig, type SnippetPolicyConfig, type Story, type StoryArgType, type StoryContext, type StoryMeta, type StoryModule, type StorybookFilterConfig, type Theme, type TokenCategory, type TokenConfig, type TokenFix, type TokenMatchRequest, type TokenMatchResult, type TokenParseError, type TokenParseOutput, type TokenParseResult, type TokenRegistry, type TokenRegistryMeta, type TokenUsageSummary, type VariantLoader, type VerifyRequest, type VerifyResult, type Viewport, aiMetadataSchema, analyzeComposition, blockDefinitionSchema, budgetBar, checkStoryExclusion, classifyComplexity, compileBlock, compileFragment, compileRecipe, componentRelationSchema, defineBlock, defineFragment, defineRecipe, detectSubComponentPaths, executeVariantLoaders, figma, figmaPropMappingSchema, formatBytes, fragmentBanSchema, fragmentContractSchema, fragmentDefinitionSchema, fragmentGeneratedSchema, fragmentMetaSchema, fragmentUsageSchema, fragmentVariantSchema, fragmentsConfigSchema, getPreviewConfig, isConfigExcluded, isExportStory, isFigmaPropMapping, isForceIncluded, parseTokenFile, propDefinitionSchema, recipeDefinitionSchema, resolveFigmaMapping, resolvePerformanceConfig, resolvePreviewRuntimeState, setPreviewConfig, storyModuleToFragment, storyNameFromExport, toId, usePreviewVariantRuntime };
|
|
2910
|
+
export { type AIMetadata, BRAND, type BaselineInfo, type BlockDefinition, type BoundingBox, type Brand, type CSF2Story, type CheckStoryExclusionOpts, type CompiledRecipe, type ComplexityTier, type ComponentRelation, type CompositionAnalysis, type CompositionGuideline, type CompositionSuggestion, type CompositionWarning, type ControlType, DEFAULTS, type Decorator, type Defaults, type DesignToken, type DiffResult, type EnhancedStyleDiffItem, type ExclusionReason, type ExclusionResult, type FigmaBooleanMapping, type FigmaChildrenMapping, type FigmaEnumMapping, type FigmaInstanceMapping, type FigmaPropMapping, type FigmaStringMapping, type FigmaTextContentMapping, type Fragment, type FragmentAccessibility, type FragmentComponent, type FragmentContextOptions, type FragmentContract, type FragmentDefinition, type FragmentDoNotItem, type FragmentFigma, type FragmentGenerated, type FragmentIndex, type FragmentMeta as FragmentJsonMeta, type FragmentUsage as FragmentJsonUsage, type FragmentMeta$1 as FragmentMeta, type FragmentPattern, type FragmentRegistry, type FragmentRelated, type FragmentUsage$1 as FragmentUsage, type FragmentVariant, type FragmentsConfig, type InferProps, type Loader, type Manifest, PRESET_NAMES, type ParsedToken, type PerformanceData as PerfData, type PerformanceSummary as PerfSummary, type PerformanceBudgets, type PerformanceConfig, type PlayFunction, type PlayFunctionContext, type PreviewConfig, type PreviewRuntimeOptions, type PreviewRuntimeState, type PreviewVariantLike, PreviewVariantRuntime, type PropDefinition, type PropType, type RecipeDefinition, type RegistryComponentEntry, type RegistryOptions, type RegistryPropEntry, type RelationshipType, type Screenshot, type ScreenshotConfig, type ScreenshotMetadata, type ServiceConfig, type SnapshotConfig, type SnippetPolicyConfig, type Story, type StoryArgType, type StoryContext, type StoryMeta, type StoryModule, type StorybookFilterConfig, type Theme, type ThemeSeeds, type TokenCategory, type TokenConfig, type TokenFix, type TokenMatchRequest, type TokenMatchResult, type TokenParseError, type TokenParseOutput, type TokenParseResult, type TokenRegistry, type TokenRegistryMeta, type TokenUsageSummary, type VariantLoader, type VerifyRequest, type VerifyResult, type Viewport, aiMetadataSchema, analyzeComposition, blockDefinitionSchema, budgetBar, checkStoryExclusion, classifyComplexity, compileBlock, compileFragment, compileRecipe, componentRelationSchema, defineBlock, defineFragment, defineRecipe, detectSubComponentPaths, executeVariantLoaders, figma, figmaPropMappingSchema, formatBytes, fragmentBanSchema, fragmentContractSchema, fragmentDefinitionSchema, fragmentGeneratedSchema, fragmentMetaSchema, fragmentUsageSchema, fragmentVariantSchema, fragmentsConfigSchema, getPreviewConfig, isConfigExcluded, isExportStory, isFigmaPropMapping, isForceIncluded, parseTokenFile, propDefinitionSchema, recipeDefinitionSchema, resolveFigmaMapping, resolvePerformanceConfig, resolvePreviewRuntimeState, setPreviewConfig, storyModuleToFragment, storyNameFromExport, toId, usePreviewVariantRuntime };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fragments-sdk/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Core types, schemas, and runtime API for Fragments component definitions",
|
|
6
6
|
"author": "Conan McNicholl",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"zod": "^3.24.1"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@fragments-sdk/context": ">=0.4.
|
|
43
|
+
"@fragments-sdk/context": ">=0.4.3",
|
|
44
44
|
"@storybook/csf": "^0.1.0",
|
|
45
45
|
"react": ">=18"
|
|
46
46
|
},
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"tsup": "^8.3.5",
|
|
64
64
|
"typescript": "^5.7.2",
|
|
65
65
|
"vitest": "^2.1.8",
|
|
66
|
-
"@fragments-sdk/context": "0.4.
|
|
66
|
+
"@fragments-sdk/context": "0.4.3"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"build": "tsup",
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -473,6 +473,50 @@ export interface StorybookFilterConfig {
|
|
|
473
473
|
excludeSubComponents?: boolean;
|
|
474
474
|
}
|
|
475
475
|
|
|
476
|
+
/**
|
|
477
|
+
* Theme seed configuration.
|
|
478
|
+
* The 5 root values that derive 120+ CSS custom properties.
|
|
479
|
+
*/
|
|
480
|
+
export interface ThemeSeeds {
|
|
481
|
+
/** Primary brand color as hex (e.g., "#6366f1") */
|
|
482
|
+
brand?: string;
|
|
483
|
+
|
|
484
|
+
/** Neutral palette name */
|
|
485
|
+
neutral?: 'stone' | 'ice' | 'earth' | 'sand' | 'fire';
|
|
486
|
+
|
|
487
|
+
/** Spacing density scale */
|
|
488
|
+
density?: 'compact' | 'default' | 'relaxed';
|
|
489
|
+
|
|
490
|
+
/** Border radius style */
|
|
491
|
+
radiusStyle?: 'sharp' | 'subtle' | 'default' | 'rounded' | 'pill';
|
|
492
|
+
|
|
493
|
+
/** Danger/error color as hex (e.g., "#ef4444") */
|
|
494
|
+
danger?: string;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Visual snapshot testing configuration.
|
|
499
|
+
*/
|
|
500
|
+
export interface SnapshotConfig {
|
|
501
|
+
/** Enable visual snapshot tests (default: false) */
|
|
502
|
+
enabled: boolean;
|
|
503
|
+
|
|
504
|
+
/** Output directory for snapshot baselines (relative to project root) */
|
|
505
|
+
outputDir?: string;
|
|
506
|
+
|
|
507
|
+
/** Viewport width for snapshots (default: 1440) */
|
|
508
|
+
viewportWidth?: number;
|
|
509
|
+
|
|
510
|
+
/** Viewport height for snapshots (default: 1100) */
|
|
511
|
+
viewportHeight?: number;
|
|
512
|
+
|
|
513
|
+
/** Diff threshold percentage before a snapshot fails (default: 0.1) */
|
|
514
|
+
threshold?: number;
|
|
515
|
+
|
|
516
|
+
/** Disable CSS animations during capture (default: true) */
|
|
517
|
+
disableAnimations?: boolean;
|
|
518
|
+
}
|
|
519
|
+
|
|
476
520
|
/**
|
|
477
521
|
* Config file structure
|
|
478
522
|
*/
|
|
@@ -521,6 +565,12 @@ export interface FragmentsConfig {
|
|
|
521
565
|
|
|
522
566
|
/** Storybook adapter filtering configuration */
|
|
523
567
|
storybook?: StorybookFilterConfig;
|
|
568
|
+
|
|
569
|
+
/** Theme seed values for the 5-seed theming system */
|
|
570
|
+
theme?: ThemeSeeds;
|
|
571
|
+
|
|
572
|
+
/** Visual snapshot testing configuration */
|
|
573
|
+
snapshots?: SnapshotConfig;
|
|
524
574
|
}
|
|
525
575
|
|
|
526
576
|
/**
|