@usefragments/core 1.5.1 → 1.5.2
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/{chunk-AOG4FTV6.js → chunk-BAHCOAVG.js} +26 -2
- package/dist/chunk-BAHCOAVG.js.map +1 -0
- package/dist/codes/index.d.ts +1 -1
- package/dist/codes/index.js +1 -1
- package/dist/compiled-types/index.d.ts +1 -1
- package/dist/generate/index.d.ts +1 -1
- package/dist/{governance-B88uR3Zq.d.ts → governance-pKrfh517.d.ts} +46 -3
- package/dist/index.d.ts +46 -3
- package/dist/index.js +236 -7
- package/dist/index.js.map +1 -1
- package/dist/react-types.d.ts +1 -1
- package/dist/test-utils.d.ts +1 -1
- package/package.json +1 -1
- package/src/codes/__tests__/codes.test.ts +1 -1
- package/src/codes/codes.ts +20 -0
- package/src/config.ts +20 -0
- package/src/facts/fact-index.ts +8 -1
- package/src/facts/facts.test.ts +14 -18
- package/src/governance-integrity.test.ts +105 -0
- package/src/governance-integrity.ts +316 -0
- package/src/governance.test.ts +20 -1
- package/src/governance.ts +45 -0
- package/src/index.ts +7 -1
- package/src/rules/styles-no-raw-spacing.test.ts +48 -0
- package/src/rules/styles-no-raw-spacing.ts +5 -5
- package/src/types.ts +21 -3
- package/dist/chunk-AOG4FTV6.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export { b as AGENT_FORMAT_SCHEMA_VERSION, c as AgentErrorEnvelope, d as AgentOu
|
|
|
3
3
|
import { Severity } from './severity.js';
|
|
4
4
|
export { SEVERITIES, SEVERITY_RANK, SEVERITY_WEIGHTS, SeverityLevel, compareSeverity, maxSeverity, severityLevel, severitySchema, sortBySeverity } from './severity.js';
|
|
5
5
|
export { BridgeViolationInput, CODES, CodeCategory, CodeLifecycle, EXPLAIN_URL_BASE, FuiCode, bridgeSourceViolation, bridgeSourceViolations, byCode, byRuleId, explainUrlForCode } from './codes/index.js';
|
|
6
|
-
import { c as ContractDomain, d as ContractCatalogInput, G as GovernanceSeverity, b as CompiledFragment, e as GovernedFragmentDefinition, R as ResolvedGovernedFragmentDefinition, f as GovernanceConfig, g as FragmentsConfig, T as TokenConfig, h as FragmentComponent, B as BlockDefinition, C as CompiledBlock, F as FragmentDefinition, a as FragmentDefinitionV2, S as StorybookFilterConfig, i as FigmaStringMapping, j as FigmaBooleanMapping, k as FigmaEnumMapping, l as FigmaInstanceMapping, m as FigmaChildrenMapping, n as FigmaTextContentMapping, o as RelationshipType, V as VariantRenderOptions, p as VariantLoader, q as CanonicalSource, r as CanonicalBridgeV1, s as ContractCanonicalMappingInput } from './governance-
|
|
7
|
-
export { A as AIMetadata, t as AccessibilityGovernanceBuilder, u as AppConfig, v as BaselineInfo, w as BoundingBox, x as CONTRACT_DOMAINS, y as CONTRACT_PREIMAGE_CAPABILITY_HEADER, z as CONTRACT_PREIMAGE_SCHEMA, D as CanonicalMappingStatus, E as CompiledFragmentsFile, H as CompiledRecipe, I as CompiledTokenData, J as CompiledTokenEntry, K as ComponentGovernanceBuilder, L as ComponentGovernanceRecord, M as ComponentRef, N as ComponentRelation, O as CompositionMetadata, P as ContractComponentInput, Q as ContractIdentityPin, U as ContractPolicyInput, W as ContractPreimage, X as ContractPropMappingInput, Y as ContractTokenInput, Z as ContractWaiverInput, _ as ControlType, $ as DesignSystemConfig, a0 as DiffResult, a1 as FigmaPropMapping, a2 as FragmentContract, a3 as FragmentExample, a4 as FragmentGenerated, a5 as FragmentGuidance, a6 as FragmentMeta, a7 as FragmentProvenance, a8 as FragmentUsage, a9 as FragmentVariant, aa as GlobalGovernanceRecord, ab as GlobalJsxGovernanceRecord, ac as GlobalStyleGovernanceRecord, ad as GovernancePropValue, ae as InspectConfig, af as LocalCanonicalDeclaration, ag as LocalCanonicalResolveRule, ah as Manifest, ai as ObservedComponentUsage, aj as ObservedUsageProp, ak as PlayFunction, al as PlayFunctionContext, am as PropDefinition, an as PropGovernanceBuilder, ao as PropGovernanceOptions, ap as PropKey, aq as PropType, ar as RecipeDefinition, as as RegistryOptions, at as RepoRelativePath, au as ScaleGovernanceRecord, av as Screenshot, aw as ScreenshotConfig, ax as ScreenshotMetadata, ay as ServiceConfig, az as SnapshotConfig, aA as SnippetPolicyConfig, aB as Theme, aC as ThemeSeeds, aD as TokenSourceConfig, aE as TokenSourceFormat, aF as VerifyRequest, aG as VerifyResult, aH as Viewport, aI as canonicalBridgeV1Schema, aJ as componentGovernanceRecordSchema, aK as componentGovernanceRecordsSchema, aL as contractComponentsFromFragments, aM as contractPolicyFromGovernanceConfig, aN as diffContractDomains, aO as g, aP as globalGovernanceRecordSchema, aQ as globalJsxGovernanceRecordSchema, aR as globalStyleGovernanceRecordSchema, aS as governanceConfigSchema, aT as governanceConfigWithLocalCanonical, aU as governanceSeveritySchema, aV as localCanonicalContractMappings, aW as normalizeGovernanceConfig, aX as projectContractPreimage, aY as scaleGovernanceRecordSchema, aZ as verifiedContractPreimageFromPin } from './governance-
|
|
6
|
+
import { c as ContractDomain, d as ContractCatalogInput, G as GovernanceSeverity, b as CompiledFragment, e as GovernedFragmentDefinition, R as ResolvedGovernedFragmentDefinition, f as GovernanceConfig, g as FragmentsConfig, T as TokenConfig, h as FragmentComponent, B as BlockDefinition, C as CompiledBlock, F as FragmentDefinition, a as FragmentDefinitionV2, S as StorybookFilterConfig, i as FigmaStringMapping, j as FigmaBooleanMapping, k as FigmaEnumMapping, l as FigmaInstanceMapping, m as FigmaChildrenMapping, n as FigmaTextContentMapping, o as RelationshipType, V as VariantRenderOptions, p as VariantLoader, q as CanonicalSource, r as CanonicalBridgeV1, s as ContractCanonicalMappingInput } from './governance-pKrfh517.js';
|
|
7
|
+
export { A as AIMetadata, t as AccessibilityGovernanceBuilder, u as AppConfig, v as BaselineInfo, w as BoundingBox, x as CONTRACT_DOMAINS, y as CONTRACT_PREIMAGE_CAPABILITY_HEADER, z as CONTRACT_PREIMAGE_SCHEMA, D as CanonicalMappingStatus, E as CompiledFragmentsFile, H as CompiledRecipe, I as CompiledTokenData, J as CompiledTokenEntry, K as ComponentGovernanceBuilder, L as ComponentGovernanceRecord, M as ComponentRef, N as ComponentRelation, O as CompositionMetadata, P as ContractComponentInput, Q as ContractIdentityPin, U as ContractPolicyInput, W as ContractPreimage, X as ContractPropMappingInput, Y as ContractTokenInput, Z as ContractWaiverInput, _ as ControlType, $ as DesignSystemConfig, a0 as DiffResult, a1 as FigmaPropMapping, a2 as FragmentContract, a3 as FragmentExample, a4 as FragmentGenerated, a5 as FragmentGuidance, a6 as FragmentMeta, a7 as FragmentProvenance, a8 as FragmentUsage, a9 as FragmentVariant, aa as GlobalGovernanceRecord, ab as GlobalJsxGovernanceRecord, ac as GlobalStyleGovernanceRecord, ad as GovernancePropValue, ae as InspectConfig, af as LocalCanonicalDeclaration, ag as LocalCanonicalResolveRule, ah as Manifest, ai as ObservedComponentUsage, aj as ObservedUsageProp, ak as PlayFunction, al as PlayFunctionContext, am as PropDefinition, an as PropGovernanceBuilder, ao as PropGovernanceOptions, ap as PropKey, aq as PropType, ar as RecipeDefinition, as as RegistryOptions, at as RepoRelativePath, au as ScaleGovernanceRecord, av as Screenshot, aw as ScreenshotConfig, ax as ScreenshotMetadata, ay as ServiceConfig, az as SnapshotConfig, aA as SnippetPolicyConfig, aB as Theme, aC as ThemeSeeds, aD as TokenSourceConfig, aE as TokenSourceFormat, aF as VerifyRequest, aG as VerifyResult, aH as Viewport, aI as canonicalBridgeV1Schema, aJ as componentGovernanceRecordSchema, aK as componentGovernanceRecordsSchema, aL as contractComponentsFromFragments, aM as contractPolicyFromGovernanceConfig, aN as diffContractDomains, aO as g, aP as globalGovernanceRecordSchema, aQ as globalJsxGovernanceRecordSchema, aR as globalStyleGovernanceRecordSchema, aS as governanceConfigSchema, aT as governanceConfigWithLocalCanonical, aU as governanceSeveritySchema, aV as localCanonicalContractMappings, aW as normalizeGovernanceConfig, aX as projectContractPreimage, aY as scaleGovernanceRecordSchema, aZ as verifiedContractPreimageFromPin } from './governance-pKrfh517.js';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { RegistryArtifact, RegistryDependency, RegistryInstallReceipt } from './registry.js';
|
|
10
10
|
export { REGISTRY_ARTIFACT_SCHEMA_VERSION, REGISTRY_INSTALL_RECEIPT_SCHEMA_VERSION, REGISTRY_MANIFEST_SCHEMA_VERSION, RegistryArtifactInput, RegistryComponent, RegistryComponentExport, RegistryDependencyType, RegistryEntrypoint, RegistryFile, RegistryFileContent, RegistryFileInput, RegistryFileRole, RegistryInstallProfile, RegistryInstallReceiptComponent, RegistryInstallReceiptFile, RegistryManifest, RegistryManifestDraft, RegistrySource, assertValidRegistryArtifact, buildRegistryArtifact, buildRegistryFile, computeRegistryHash, finalizeRegistryManifest, hashRegistryFileContent, registryArtifactDigest, registryArtifactSchema, registryComponentExportSchema, registryComponentSchema, registryDependencySchema, registryDependencyTypeSchema, registryEntrypointSchema, registryFileContentSchema, registryFileRoleSchema, registryFileSchema, registryFileSize, registryInstallProfileSchema, registryInstallReceiptComponentSchema, registryInstallReceiptFileSchema, registryInstallReceiptSchema, registryManifestCanonicalPreimage, registryManifestDraftSchema, registryManifestSchema, registrySourceSchema } from './registry.js';
|
|
@@ -1556,6 +1556,10 @@ interface FactEvidence {
|
|
|
1556
1556
|
factId: FactId;
|
|
1557
1557
|
fact: Fact;
|
|
1558
1558
|
}
|
|
1559
|
+
interface FactIndexOptions {
|
|
1560
|
+
/** Optional internal diagnostic route. Product output is quiet by default. */
|
|
1561
|
+
onConflict?: (message: string) => void;
|
|
1562
|
+
}
|
|
1559
1563
|
/**
|
|
1560
1564
|
* Match a literal path against a simple glob pattern. `*` matches any run of
|
|
1561
1565
|
* non-separator characters; `**` matches any run of characters including
|
|
@@ -1563,10 +1567,12 @@ interface FactEvidence {
|
|
|
1563
1567
|
*/
|
|
1564
1568
|
declare function matchesGlob(path: string, pattern: string): boolean;
|
|
1565
1569
|
declare class FactIndex {
|
|
1570
|
+
private readonly options;
|
|
1566
1571
|
private readonly facts;
|
|
1567
1572
|
private readonly idsByKind;
|
|
1568
1573
|
private readonly idsByComponent;
|
|
1569
1574
|
private readonly tokenBySymbol;
|
|
1575
|
+
constructor(options?: FactIndexOptions);
|
|
1570
1576
|
add(fact: Fact): void;
|
|
1571
1577
|
addMany(facts: Iterable<Fact>): void;
|
|
1572
1578
|
get(id: FactId): Fact | undefined;
|
|
@@ -9559,6 +9565,14 @@ declare const recipeDefinitionSchema: z.ZodObject<{
|
|
|
9559
9565
|
tags?: string[] | undefined;
|
|
9560
9566
|
}>;
|
|
9561
9567
|
|
|
9568
|
+
/**
|
|
9569
|
+
* Recover the authored declaration before Zod stripped unknown keys.
|
|
9570
|
+
*
|
|
9571
|
+
* `defineConfig` still returns the schema-parsed config so its runtime semantics
|
|
9572
|
+
* do not change. The non-enumerable source declaration exists only long enough
|
|
9573
|
+
* for config loaders to diagnose keys that validated but would otherwise vanish.
|
|
9574
|
+
*/
|
|
9575
|
+
declare function configDeclarationForDiagnostics(config: unknown): unknown;
|
|
9562
9576
|
declare function defineConfig<TConfig extends FragmentsConfig>(config: TConfig): TConfig;
|
|
9563
9577
|
|
|
9564
9578
|
/**
|
|
@@ -11916,6 +11930,20 @@ declare function resolveSpacingValue(input: {
|
|
|
11916
11930
|
*/
|
|
11917
11931
|
|
|
11918
11932
|
type GovernanceIntegrityStatus = "healthy" | "degraded" | "inert";
|
|
11933
|
+
type InertConfigDiagnosticKind = "orphan-scale" | "unconsumed-key";
|
|
11934
|
+
type InertConfigDiagnosticCode = "FUI9004" | "FUI9005";
|
|
11935
|
+
interface InertConfigDiagnostic {
|
|
11936
|
+
code: InertConfigDiagnosticCode;
|
|
11937
|
+
kind: InertConfigDiagnosticKind;
|
|
11938
|
+
severity: "warn";
|
|
11939
|
+
path: string;
|
|
11940
|
+
message: string;
|
|
11941
|
+
}
|
|
11942
|
+
interface GovernanceIntegrityRoster {
|
|
11943
|
+
configured: number;
|
|
11944
|
+
active: number;
|
|
11945
|
+
inert: number;
|
|
11946
|
+
}
|
|
11919
11947
|
type GovernanceIntegrityFamilyId = "policy" | "components" | "tokens" | "hygiene" | "blocking-deny";
|
|
11920
11948
|
interface GovernanceIntegrityFamily {
|
|
11921
11949
|
id: GovernanceIntegrityFamilyId;
|
|
@@ -11938,6 +11966,8 @@ interface GovernanceIntegrityInput {
|
|
|
11938
11966
|
/** Whether `tokens/css-vars-must-be-defined` is activated (caller supplies). */
|
|
11939
11967
|
cssVarsActive?: boolean;
|
|
11940
11968
|
mode?: "scan" | "ci" | "hook" | "doctor" | "setup";
|
|
11969
|
+
/** Named, verdict-neutral diagnostics derived from the authored config. */
|
|
11970
|
+
configDiagnostics?: readonly InertConfigDiagnostic[];
|
|
11941
11971
|
}
|
|
11942
11972
|
interface GovernanceIntegrityVerdict {
|
|
11943
11973
|
status: GovernanceIntegrityStatus;
|
|
@@ -11948,6 +11978,8 @@ interface GovernanceIntegrityVerdict {
|
|
|
11948
11978
|
armed: GovernanceIntegrityFamilyId[];
|
|
11949
11979
|
summary: string;
|
|
11950
11980
|
remediations: string[];
|
|
11981
|
+
configDiagnostics?: InertConfigDiagnostic[];
|
|
11982
|
+
roster?: GovernanceIntegrityRoster;
|
|
11951
11983
|
}
|
|
11952
11984
|
/**
|
|
11953
11985
|
* Whether a canonical source contributes an effective component vocabulary.
|
|
@@ -11965,6 +11997,17 @@ declare function isEffectiveCanonicalSource(source: CanonicalSource): boolean;
|
|
|
11965
11997
|
* canonical source. Accepts the raw fact `options` bag (values are `unknown`).
|
|
11966
11998
|
*/
|
|
11967
11999
|
declare function hasEffectiveComponentVocabulary(options: Record<string, unknown> | undefined): boolean;
|
|
12000
|
+
/**
|
|
12001
|
+
* Diagnose config keys that the permissive validation boundary accepts but the
|
|
12002
|
+
* runtime cannot consume. The parsed config is the source of truth for stripped
|
|
12003
|
+
* keys; explicit allow-sets cover intentional `.passthrough()`/record seams.
|
|
12004
|
+
*/
|
|
12005
|
+
declare function detectUnconsumedConfigKeys(authoredConfig: unknown, parsedConfig: unknown): InertConfigDiagnostic[];
|
|
12006
|
+
/**
|
|
12007
|
+
* Compare locally declared scales with the effective property-policy graph.
|
|
12008
|
+
* Preset-only scales are not diagnosed because the user did not declare them.
|
|
12009
|
+
*/
|
|
12010
|
+
declare function detectOrphanGovernanceScales(declaredPolicy: GovernanceConfig | undefined, effectivePolicy: GovernanceConfig | undefined): InertConfigDiagnostic[];
|
|
11968
12011
|
declare function evaluateGovernanceIntegrity(input: GovernanceIntegrityInput): GovernanceIntegrityVerdict;
|
|
11969
12012
|
|
|
11970
12013
|
interface CanonicalDirectionConflict {
|
|
@@ -12044,4 +12087,4 @@ interface ComponentKeyInput {
|
|
|
12044
12087
|
*/
|
|
12045
12088
|
declare function buildComponentKey({ repoRelativeFile, exportName }: ComponentKeyInput): string;
|
|
12046
12089
|
|
|
12047
|
-
export { type A11yNameRequiredFact, AGENT_CONTEXT_RELATIVE_PATH, AgentFormat, BLOCKING_RULE_ALLOWLIST, BRAND, BlockDefinition, type Brand, type BuildAgentFormatInput, type BuildRegistryInstallPlanInput, type BundleArtifactMetadata, type BundleComponentShard, type BundleManifest, type BundleManifestComponentEntry, type BundleSchemaVersion, type BundleTarget, type BundleTokenFile, CATALOG_FIXTURE_A_FCID, type CSF2Story, type CSSGeneratorOptions, CanonicalBridgeV1, type CanonicalCandidateFact, type CanonicalDirectionConflict, Finding as CanonicalFinding, type CanonicalIdentityReference, type CanonicalMappingFact, type CanonicalReplacementFact, CanonicalSource, type CheckStoryExclusionOpts, type CheckedSpacingValue, type ClassNameDynamicFact, type ClassNameDynamicReason, type ClassNameFact, type ClassNameLiteralFact, type ClassNameOrigin, type ClassifyIdentityInput, type CompileEffectiveGovernanceInputsOptions, CompiledBlock, type CompiledContractOutput, CompiledFragment, type ComplexityTier, type ComponentCapabilityFact, type ComponentContract, type ComponentDefinitionFact, type ComponentDefinitionRenderRoot, type ComponentFactInput, type ComponentId, type ComponentIdentityFact, type ComponentIdentityUsage, type ComponentKeyInput, type ComponentLevelFact, type ComponentMetadataFact, type CompositionAnalysis, type CompositionAuthoringEntry, type CompositionChildSelector, type CompositionConstraint, type CompositionGuideline, type CompositionPattern, type CompositionRegionSelector, type CompositionSuggestion, type CompositionWarning, type ConformChange, type ConformComponentMapping, type ConformConfidence, type ConformCoverage, type ConformInput, type ConformLocation, type ConformPropMapping, type ConformResult, type ConformSuggestion, type ConformToken, type ConformUnresolved, ContractCanonicalMappingInput, ContractCatalogInput, ContractDomain, type ContractStampPin, type ContractStampRecord, DEFAULTS, DEFAULT_ENHANCED_STYLE_PROPERTIES, DEFAULT_STYLE_PROPERTIES, type DTCGColorValue, type DTCGDimensionValue, type DTCGGroup, type DTCGToken, type DTCGTokenFile, type DTCGTokenType, type Decorator, type Defaults, type DeltaEMatch, type DesignSystemContext, type DesignToken, type DesignTokenParseOptions, type DiscoverComponentsOptions, EFFECTIVE_GOVERNANCE_INPUTS_SCHEMA, type EffectiveGovernanceInputs, type EffectiveGovernanceInputsSourceState, type EnhancedStyleComparisonResult, type EnhancedStyleDiffItem, EvidenceGrade, type ExclusionReason, type ExclusionResult, type ExternalIdentityReference, FRAGMENTS_INTERNAL_RULE_IDS, type Fact, type FactEvidence, type FactId, FactIndex, type FactKind, type FactLocation, type FactOfKind, FigmaBooleanMapping, FigmaChildrenMapping, FigmaEnumMapping, FigmaInstanceMapping, FigmaStringMapping, FigmaTextContentMapping, type FigmaVariable, type FigmaVariableCollection, Finding, FindingFix, type Fragment, type FragmentAccessibility, FragmentComponent, type FragmentContextOptions, FragmentDefinition, FragmentDefinitionV2, type FragmentDoNotItem, type FragmentFigma, type FragmentIndex, type FragmentMeta as FragmentJsonMeta, type FragmentUsage as FragmentJsonUsage, type FragmentPattern, type FragmentRegistry, type FragmentRelated, FragmentsConfig, Severity as FuiSeverity, GovernanceConfig, type GovernanceIntegrityFamily, type GovernanceIntegrityFamilyId, type GovernanceIntegrityInput, type GovernanceIntegrityStatus, type GovernanceIntegrityVerdict, GovernanceSeverity, GovernedFragmentDefinition, type IdentityClassification, type IdentityConfidence, type IdentityDecision, type IdentityFact, type IdentityState, type InferProps, type JsxComponentPreferredFact, type JsxImportPathPreferredFact, type JsxInlineStyleForbiddenRawFact, type JsxUnknownPropsForbiddenFact, type Loader, type LocalIdentityReference, type McpBlock, type McpCapability, type McpComponent, type McpComponentExample, type McpComponentGuidance, type McpComponentMetadata, type McpComponentProp, type McpComponentRelation, type McpCompoundChild, type McpGuidancePattern, type McpPerformanceData, type McpPerformanceImport, type McpPerformanceSummary, type McpSnapshot, type McpSnapshotMetadata, type McpSnapshotSchemaVersion, type McpSourceType, type McpToken, type McpTokenData, type NearestByDeltaEOptions, type NormalizedStyleMap, type NormalizedToken, PRESET_NAMES, PROVE_DEFAULT_MAX_PASSES, PROVE_MAX_PASSES, type ParseTokensOptions, type ParsedToken, type PerformanceData as PerfData, type PerformanceSummary as PerfSummary, type PerformanceBudgets, type PerformanceConfig, type PolicyFact, type PresetRuleState, type PreviewConfig, type PreviewRuntimeOptions, type PreviewRuntimeState, type PreviewVariantLike, PreviewVariantRuntime, type PropMetadataFact, type PropValueAvoidedFact, type PropValueForbiddenFact, type ProveCallbacks, type ProveLoopResult, type ProveOptions, type ProvePass, type ProvePassSampling, type ProveResidual, type ProveSample, type ProveSamplerArgs, type ProveVerdict, RAW_HTML_ADVISORY_TAGS, RAW_HTML_CANONICAL_TAGS, RAW_HTML_INPUT_TYPE_CANONICALS, RAW_HTML_ROLE_CANONICALS, type RGB, type RGBA, RULES, RULE_TIER, type RawHtmlCanonicalMatch, type RawHtmlPrecisionTier, RegistryArtifact, type RegistryComponentEntry, RegistryDependency, type RegistryInstallPlan, RegistryInstallReceipt, type RegistryPropEntry, type RegistryWritePlan, RelationshipType, type ResolvedDTCGToken, ResolvedGovernedFragmentDefinition, type ResolvedIdentityRenderRoot, type ResolvedIntrinsicIdentityRoot, type Rule, type RuleFn, type RuleTier, type SCSSGeneratorOptions, type ScaleFact, type ScaleValueFact, Severity, type SpacingResolutionScale, type SpacingTokenLookup, type Story, type StoryArgType, type StoryContext, type StoryMeta, type StoryModule, StorybookFilterConfig, type StructuralConfidenceFact, type StyleComparisonOptions, type StyleComparisonResult, type StyleCssVarsMustBeDefinedFact, type StyleDeclarationFact, type StyleDiffItem, type StyleFontSizeScaleFact, type StylePropertyScaleFact, type StyleRawColorForbiddenFact, type StyleUnsupportedFact, type SuppressionDirectiveFact, type TailwindClassFact, type TailwindModifier, type TailwindModifierKind, type TailwindPaletteAllowFact, type TailwindPaletteDenyFact, type TailwindResolutionSource, type TailwindResolvedKind, type TailwindResolvedValue, type TailwindTokenResolvedFact, type TailwindUnknownClassEnabledFact, type TailwindValue, type ThemeDeclarationFact, type ThemeParserResult, type TokenCatalog, type TokenCatalogDefinition, type TokenCatalogDiagnostic, type TokenCatalogLocation, type TokenCatalogReference, type TokenCatalogSourceState, type TokenCategory, TokenConfig, type TokenDefinitionFact, type TokenFix, type TokenFormat, type TokenLookup, type TokenMatchRequest, type TokenMatchResult, type TokenParseError, type TokenParseOutput, type TokenParseResult, type TokenRegistry, type TokenRegistryMeta, type TokenUsageSummary, type UnsupportedStyleReason, type UsageComponentFact, type UsageFact, type UsageImportFact, type UsageInlineStyleFact, type UsageNodeFact, type UsagePropResolvedFact, type UsageTextChildFact, VariantLoader, aiMetadataSchema, analyzeComposition, asComponentId, assertPortableRegistryPath, blockDefinitionSchema, budgetBar, buildAgentFormat, buildComponentKey, buildRegistryInstallPlan, buildRegistryInstallReceipt, buildSpacingTokenLookup, bundleArtifactMetadataSchema, bundleComponentShardSchema, bundleManifestComponentEntrySchema, bundleManifestSchema, bundleSchemaVersionSchema, bundleTargetSchema, bundleTokenFileSchema, calculateDeltaE, canonicalBridgeContractMappings, canonicalDirectionConflictsTarget, canonicalJson, canonicalPreimage, catalogFixtureA, catalogFixtureAContractPayload, catalogFixtureATokensDtcg, checkStoryExclusion, clampMaxPasses, classifyComplexity, classifyIdentity, collectRegistryInstallDependencies, colorSimilarity, compareByVocabularyRank, compareColors, compareNumericValues, compareStyleValue, compareStyles, compareStylesWithTokens, compileBlock, compileComponentFacts, compileEffectiveGovernanceInputs, compileFragment, compileGlobalGovernanceFacts, compileRecipe, componentContractSchema, componentId, componentRelationSchema, compositionAuthoringEntrySchema, compositionMetadataSchema, compositionPatternSchema, containsTailwindV4Theme, contractHash, contractTierRuleIds, customerDefaultRuleStates, defineBlock, defineConfig, defineFragment, defineRecipe, detectSubComponentPaths, discoverComponents, dtcgTokenFileSchema, emptyConformResult, evaluateGovernanceIntegrity, executeVariantLoaders, factId, familyDistance, figma, figmaPropMappingSchema, formatBytes, formatStampHeader, formatStampPin, formatStampVersionHash, formatTokenSummary, fragmentBanSchema, fragmentContractSchema, fragmentDefinitionSchema, fragmentDefinitionV2Schema, fragmentGeneratedSchema, fragmentMetaSchema, fragmentProvenanceSchema, fragmentUsageSchema, fragmentVariantSchema, fragmentsConfigSchema, fragmentsPresetRuleStates, gatesCi, generateCSSCustomProperties, generateFigmaVariables, generateSCSSVariables, generateTailwindConfig, getComplianceBadge, getPreviewConfig, governedFragmentDefinitionSchema, hasEffectiveComponentVocabulary, hash64Hex, hexToRgb, hygieneTierRuleIds, indexComponentIdentityUsage, inferTokenCategory, inferTokenGroup, isColorLike, isCompositionPattern, isConfigExcluded, isContractFile, isContractTierRule, isDTCGFile, isDenyEligible, isEffectiveCanonicalSource, isEnforceableHtmlEquivalent, isExportStory, isFigmaPropMapping, isForceIncluded, isPortableRepoPath, isRawHtmlAdvisoryTier, isReactComponent, lowerCompositionContract, makeA11yNameRequiredFact, makeCanonicalCandidateFact, makeCanonicalMappingFact, makeCanonicalReplacementFact, makeClassNameDynamicFact, makeClassNameLiteralFact, makeComponentCapabilityFact, makeComponentDefinitionFact, makeComponentIdentityFact, makeComponentMetadataFact, makeContractTokenFact, makeFinding, makeJsxComponentPreferredFact, makeJsxImportPathPreferredFact, makeJsxInlineStyleForbiddenRawFact, makeJsxUnknownPropsForbiddenFact, makePropMetadataFact, makePropValueAvoidedFact, makePropValueForbiddenFact, makeScaleFact, makeScaleValueFact, makeStructuralConfidenceFact, makeStyleCssVarsMustBeDefinedFact, makeStyleDeclarationFact, makeStyleFontSizeScaleFact, makeStylePropertyScaleFact, makeStyleRawColorForbiddenFact, makeStyleUnsupportedFact, makeTailwindClassFact, makeTailwindPaletteAllowFact, makeTailwindPaletteDenyFact, makeTailwindTokenResolvedFact, makeTailwindUnknownClassEnabledFact, makeThemeDeclarationFact, makeTokenDefinitionFact, makeUsageComponentFact, makeUsageImportFact, makeUsageInlineStyleFact, makeUsageNodeFact, makeUsagePropResolvedFact, makeUsageTextChildFact, matchesGlob, mcpBlockSchema, mcpCapabilitySchema, mcpComponentExampleSchema, mcpComponentGuidanceSchema, mcpComponentMetadataSchema, mcpComponentPropSchema, mcpComponentRelationSchema, mcpComponentSchema, mcpCompoundChildSchema, mcpGuidancePatternSchema, mcpPerformanceDataSchema, mcpPerformanceImportSchema, mcpPerformanceSummarySchema, mcpSnapshotMetadataSchema, mcpSnapshotSchema, mcpSnapshotSchemaVersionSchema, mcpSourceTypeSchema, mcpTokenDataSchema, mcpTokenSchema, nearestByDeltaE, nearestSignedScaleValue, normalizeColor, normalizeConfigPath, normalizeRegistryRepoPath, normalizeStyleValue, normalizeToV1, normalizeTokenGroupComment, normalizeTokenValue, parseColor, parseColorToRgb, parseComponentContract, parseContractStamp, parseCssTokens, parseDtcgTokens as parseDTCGFile, parseDesignTokenContent, parseDtcgTokens, parseRgb, parseScssTokens, parseScssVariables, parseTailwindV4Theme, parseTokenFile, parseTokens, portableRepoPathError, projectCanonicalDirectionConflicts, propDefinitionSchema, proveCompliant, proveIssueCount, recipeDefinitionSchema, resolveCanonicalForAriaRole, resolveCanonicalForRawHtml, resolveConfiguredAppPath, resolveDesignTokenValue, resolveFigmaMapping, resolvePerformanceConfig, resolvePreviewRuntimeState, resolveProveVerdict, resolveSpacingValue, resolveTokenValue, rgbToHex, ruleA11yRequiredAccessibleName, ruleComponentsForbiddenPropValue, ruleComponentsPreferLibrary, ruleComponentsShadowComponent, ruleComponentsUnknownProp, ruleJsxPreferredComponent, ruleJsxPreferredImportPath, rulePropsInvalidValue, ruleStylesNoRawColor, ruleStylesNoRawDimensions, ruleStylesNoRawSpacing, ruleStylesNoRawTypography, ruleTailwindArbitraryColor, ruleTailwindArbitrarySpacing, ruleTailwindForbiddenPalette, ruleTailwindOffScaleSpacingToken, ruleTailwindRawColorViaToken, ruleTailwindUnknownClass, ruleThemeNoThemeCoupledLiteral, ruleTokensRequireDualFallback, runRules, selectedRegistryComponentNames, serializeContractStamp, setPreviewConfig, sha256Hex, sourceToRegistryTargetPath, storyModuleToFragment, storyNameFromExport, tierFor, toId, tokenIncludesFromConfig, topologyBase, usePreviewVariantRuntime, vocabularyRank };
|
|
12090
|
+
export { type A11yNameRequiredFact, AGENT_CONTEXT_RELATIVE_PATH, AgentFormat, BLOCKING_RULE_ALLOWLIST, BRAND, BlockDefinition, type Brand, type BuildAgentFormatInput, type BuildRegistryInstallPlanInput, type BundleArtifactMetadata, type BundleComponentShard, type BundleManifest, type BundleManifestComponentEntry, type BundleSchemaVersion, type BundleTarget, type BundleTokenFile, CATALOG_FIXTURE_A_FCID, type CSF2Story, type CSSGeneratorOptions, CanonicalBridgeV1, type CanonicalCandidateFact, type CanonicalDirectionConflict, Finding as CanonicalFinding, type CanonicalIdentityReference, type CanonicalMappingFact, type CanonicalReplacementFact, CanonicalSource, type CheckStoryExclusionOpts, type CheckedSpacingValue, type ClassNameDynamicFact, type ClassNameDynamicReason, type ClassNameFact, type ClassNameLiteralFact, type ClassNameOrigin, type ClassifyIdentityInput, type CompileEffectiveGovernanceInputsOptions, CompiledBlock, type CompiledContractOutput, CompiledFragment, type ComplexityTier, type ComponentCapabilityFact, type ComponentContract, type ComponentDefinitionFact, type ComponentDefinitionRenderRoot, type ComponentFactInput, type ComponentId, type ComponentIdentityFact, type ComponentIdentityUsage, type ComponentKeyInput, type ComponentLevelFact, type ComponentMetadataFact, type CompositionAnalysis, type CompositionAuthoringEntry, type CompositionChildSelector, type CompositionConstraint, type CompositionGuideline, type CompositionPattern, type CompositionRegionSelector, type CompositionSuggestion, type CompositionWarning, type ConformChange, type ConformComponentMapping, type ConformConfidence, type ConformCoverage, type ConformInput, type ConformLocation, type ConformPropMapping, type ConformResult, type ConformSuggestion, type ConformToken, type ConformUnresolved, ContractCanonicalMappingInput, ContractCatalogInput, ContractDomain, type ContractStampPin, type ContractStampRecord, DEFAULTS, DEFAULT_ENHANCED_STYLE_PROPERTIES, DEFAULT_STYLE_PROPERTIES, type DTCGColorValue, type DTCGDimensionValue, type DTCGGroup, type DTCGToken, type DTCGTokenFile, type DTCGTokenType, type Decorator, type Defaults, type DeltaEMatch, type DesignSystemContext, type DesignToken, type DesignTokenParseOptions, type DiscoverComponentsOptions, EFFECTIVE_GOVERNANCE_INPUTS_SCHEMA, type EffectiveGovernanceInputs, type EffectiveGovernanceInputsSourceState, type EnhancedStyleComparisonResult, type EnhancedStyleDiffItem, EvidenceGrade, type ExclusionReason, type ExclusionResult, type ExternalIdentityReference, FRAGMENTS_INTERNAL_RULE_IDS, type Fact, type FactEvidence, type FactId, FactIndex, type FactKind, type FactLocation, type FactOfKind, FigmaBooleanMapping, FigmaChildrenMapping, FigmaEnumMapping, FigmaInstanceMapping, FigmaStringMapping, FigmaTextContentMapping, type FigmaVariable, type FigmaVariableCollection, Finding, FindingFix, type Fragment, type FragmentAccessibility, FragmentComponent, type FragmentContextOptions, FragmentDefinition, FragmentDefinitionV2, type FragmentDoNotItem, type FragmentFigma, type FragmentIndex, type FragmentMeta as FragmentJsonMeta, type FragmentUsage as FragmentJsonUsage, type FragmentPattern, type FragmentRegistry, type FragmentRelated, FragmentsConfig, Severity as FuiSeverity, GovernanceConfig, type GovernanceIntegrityFamily, type GovernanceIntegrityFamilyId, type GovernanceIntegrityInput, type GovernanceIntegrityRoster, type GovernanceIntegrityStatus, type GovernanceIntegrityVerdict, GovernanceSeverity, GovernedFragmentDefinition, type IdentityClassification, type IdentityConfidence, type IdentityDecision, type IdentityFact, type IdentityState, type InertConfigDiagnostic, type InertConfigDiagnosticCode, type InertConfigDiagnosticKind, type InferProps, type JsxComponentPreferredFact, type JsxImportPathPreferredFact, type JsxInlineStyleForbiddenRawFact, type JsxUnknownPropsForbiddenFact, type Loader, type LocalIdentityReference, type McpBlock, type McpCapability, type McpComponent, type McpComponentExample, type McpComponentGuidance, type McpComponentMetadata, type McpComponentProp, type McpComponentRelation, type McpCompoundChild, type McpGuidancePattern, type McpPerformanceData, type McpPerformanceImport, type McpPerformanceSummary, type McpSnapshot, type McpSnapshotMetadata, type McpSnapshotSchemaVersion, type McpSourceType, type McpToken, type McpTokenData, type NearestByDeltaEOptions, type NormalizedStyleMap, type NormalizedToken, PRESET_NAMES, PROVE_DEFAULT_MAX_PASSES, PROVE_MAX_PASSES, type ParseTokensOptions, type ParsedToken, type PerformanceData as PerfData, type PerformanceSummary as PerfSummary, type PerformanceBudgets, type PerformanceConfig, type PolicyFact, type PresetRuleState, type PreviewConfig, type PreviewRuntimeOptions, type PreviewRuntimeState, type PreviewVariantLike, PreviewVariantRuntime, type PropMetadataFact, type PropValueAvoidedFact, type PropValueForbiddenFact, type ProveCallbacks, type ProveLoopResult, type ProveOptions, type ProvePass, type ProvePassSampling, type ProveResidual, type ProveSample, type ProveSamplerArgs, type ProveVerdict, RAW_HTML_ADVISORY_TAGS, RAW_HTML_CANONICAL_TAGS, RAW_HTML_INPUT_TYPE_CANONICALS, RAW_HTML_ROLE_CANONICALS, type RGB, type RGBA, RULES, RULE_TIER, type RawHtmlCanonicalMatch, type RawHtmlPrecisionTier, RegistryArtifact, type RegistryComponentEntry, RegistryDependency, type RegistryInstallPlan, RegistryInstallReceipt, type RegistryPropEntry, type RegistryWritePlan, RelationshipType, type ResolvedDTCGToken, ResolvedGovernedFragmentDefinition, type ResolvedIdentityRenderRoot, type ResolvedIntrinsicIdentityRoot, type Rule, type RuleFn, type RuleTier, type SCSSGeneratorOptions, type ScaleFact, type ScaleValueFact, Severity, type SpacingResolutionScale, type SpacingTokenLookup, type Story, type StoryArgType, type StoryContext, type StoryMeta, type StoryModule, StorybookFilterConfig, type StructuralConfidenceFact, type StyleComparisonOptions, type StyleComparisonResult, type StyleCssVarsMustBeDefinedFact, type StyleDeclarationFact, type StyleDiffItem, type StyleFontSizeScaleFact, type StylePropertyScaleFact, type StyleRawColorForbiddenFact, type StyleUnsupportedFact, type SuppressionDirectiveFact, type TailwindClassFact, type TailwindModifier, type TailwindModifierKind, type TailwindPaletteAllowFact, type TailwindPaletteDenyFact, type TailwindResolutionSource, type TailwindResolvedKind, type TailwindResolvedValue, type TailwindTokenResolvedFact, type TailwindUnknownClassEnabledFact, type TailwindValue, type ThemeDeclarationFact, type ThemeParserResult, type TokenCatalog, type TokenCatalogDefinition, type TokenCatalogDiagnostic, type TokenCatalogLocation, type TokenCatalogReference, type TokenCatalogSourceState, type TokenCategory, TokenConfig, type TokenDefinitionFact, type TokenFix, type TokenFormat, type TokenLookup, type TokenMatchRequest, type TokenMatchResult, type TokenParseError, type TokenParseOutput, type TokenParseResult, type TokenRegistry, type TokenRegistryMeta, type TokenUsageSummary, type UnsupportedStyleReason, type UsageComponentFact, type UsageFact, type UsageImportFact, type UsageInlineStyleFact, type UsageNodeFact, type UsagePropResolvedFact, type UsageTextChildFact, VariantLoader, aiMetadataSchema, analyzeComposition, asComponentId, assertPortableRegistryPath, blockDefinitionSchema, budgetBar, buildAgentFormat, buildComponentKey, buildRegistryInstallPlan, buildRegistryInstallReceipt, buildSpacingTokenLookup, bundleArtifactMetadataSchema, bundleComponentShardSchema, bundleManifestComponentEntrySchema, bundleManifestSchema, bundleSchemaVersionSchema, bundleTargetSchema, bundleTokenFileSchema, calculateDeltaE, canonicalBridgeContractMappings, canonicalDirectionConflictsTarget, canonicalJson, canonicalPreimage, catalogFixtureA, catalogFixtureAContractPayload, catalogFixtureATokensDtcg, checkStoryExclusion, clampMaxPasses, classifyComplexity, classifyIdentity, collectRegistryInstallDependencies, colorSimilarity, compareByVocabularyRank, compareColors, compareNumericValues, compareStyleValue, compareStyles, compareStylesWithTokens, compileBlock, compileComponentFacts, compileEffectiveGovernanceInputs, compileFragment, compileGlobalGovernanceFacts, compileRecipe, componentContractSchema, componentId, componentRelationSchema, compositionAuthoringEntrySchema, compositionMetadataSchema, compositionPatternSchema, configDeclarationForDiagnostics, containsTailwindV4Theme, contractHash, contractTierRuleIds, customerDefaultRuleStates, defineBlock, defineConfig, defineFragment, defineRecipe, detectOrphanGovernanceScales, detectSubComponentPaths, detectUnconsumedConfigKeys, discoverComponents, dtcgTokenFileSchema, emptyConformResult, evaluateGovernanceIntegrity, executeVariantLoaders, factId, familyDistance, figma, figmaPropMappingSchema, formatBytes, formatStampHeader, formatStampPin, formatStampVersionHash, formatTokenSummary, fragmentBanSchema, fragmentContractSchema, fragmentDefinitionSchema, fragmentDefinitionV2Schema, fragmentGeneratedSchema, fragmentMetaSchema, fragmentProvenanceSchema, fragmentUsageSchema, fragmentVariantSchema, fragmentsConfigSchema, fragmentsPresetRuleStates, gatesCi, generateCSSCustomProperties, generateFigmaVariables, generateSCSSVariables, generateTailwindConfig, getComplianceBadge, getPreviewConfig, governedFragmentDefinitionSchema, hasEffectiveComponentVocabulary, hash64Hex, hexToRgb, hygieneTierRuleIds, indexComponentIdentityUsage, inferTokenCategory, inferTokenGroup, isColorLike, isCompositionPattern, isConfigExcluded, isContractFile, isContractTierRule, isDTCGFile, isDenyEligible, isEffectiveCanonicalSource, isEnforceableHtmlEquivalent, isExportStory, isFigmaPropMapping, isForceIncluded, isPortableRepoPath, isRawHtmlAdvisoryTier, isReactComponent, lowerCompositionContract, makeA11yNameRequiredFact, makeCanonicalCandidateFact, makeCanonicalMappingFact, makeCanonicalReplacementFact, makeClassNameDynamicFact, makeClassNameLiteralFact, makeComponentCapabilityFact, makeComponentDefinitionFact, makeComponentIdentityFact, makeComponentMetadataFact, makeContractTokenFact, makeFinding, makeJsxComponentPreferredFact, makeJsxImportPathPreferredFact, makeJsxInlineStyleForbiddenRawFact, makeJsxUnknownPropsForbiddenFact, makePropMetadataFact, makePropValueAvoidedFact, makePropValueForbiddenFact, makeScaleFact, makeScaleValueFact, makeStructuralConfidenceFact, makeStyleCssVarsMustBeDefinedFact, makeStyleDeclarationFact, makeStyleFontSizeScaleFact, makeStylePropertyScaleFact, makeStyleRawColorForbiddenFact, makeStyleUnsupportedFact, makeTailwindClassFact, makeTailwindPaletteAllowFact, makeTailwindPaletteDenyFact, makeTailwindTokenResolvedFact, makeTailwindUnknownClassEnabledFact, makeThemeDeclarationFact, makeTokenDefinitionFact, makeUsageComponentFact, makeUsageImportFact, makeUsageInlineStyleFact, makeUsageNodeFact, makeUsagePropResolvedFact, makeUsageTextChildFact, matchesGlob, mcpBlockSchema, mcpCapabilitySchema, mcpComponentExampleSchema, mcpComponentGuidanceSchema, mcpComponentMetadataSchema, mcpComponentPropSchema, mcpComponentRelationSchema, mcpComponentSchema, mcpCompoundChildSchema, mcpGuidancePatternSchema, mcpPerformanceDataSchema, mcpPerformanceImportSchema, mcpPerformanceSummarySchema, mcpSnapshotMetadataSchema, mcpSnapshotSchema, mcpSnapshotSchemaVersionSchema, mcpSourceTypeSchema, mcpTokenDataSchema, mcpTokenSchema, nearestByDeltaE, nearestSignedScaleValue, normalizeColor, normalizeConfigPath, normalizeRegistryRepoPath, normalizeStyleValue, normalizeToV1, normalizeTokenGroupComment, normalizeTokenValue, parseColor, parseColorToRgb, parseComponentContract, parseContractStamp, parseCssTokens, parseDtcgTokens as parseDTCGFile, parseDesignTokenContent, parseDtcgTokens, parseRgb, parseScssTokens, parseScssVariables, parseTailwindV4Theme, parseTokenFile, parseTokens, portableRepoPathError, projectCanonicalDirectionConflicts, propDefinitionSchema, proveCompliant, proveIssueCount, recipeDefinitionSchema, resolveCanonicalForAriaRole, resolveCanonicalForRawHtml, resolveConfiguredAppPath, resolveDesignTokenValue, resolveFigmaMapping, resolvePerformanceConfig, resolvePreviewRuntimeState, resolveProveVerdict, resolveSpacingValue, resolveTokenValue, rgbToHex, ruleA11yRequiredAccessibleName, ruleComponentsForbiddenPropValue, ruleComponentsPreferLibrary, ruleComponentsShadowComponent, ruleComponentsUnknownProp, ruleJsxPreferredComponent, ruleJsxPreferredImportPath, rulePropsInvalidValue, ruleStylesNoRawColor, ruleStylesNoRawDimensions, ruleStylesNoRawSpacing, ruleStylesNoRawTypography, ruleTailwindArbitraryColor, ruleTailwindArbitrarySpacing, ruleTailwindForbiddenPalette, ruleTailwindOffScaleSpacingToken, ruleTailwindRawColorViaToken, ruleTailwindUnknownClass, ruleThemeNoThemeCoupledLiteral, ruleTokensRequireDualFallback, runRules, selectedRegistryComponentNames, serializeContractStamp, setPreviewConfig, sha256Hex, sourceToRegistryTargetPath, storyModuleToFragment, storyNameFromExport, tierFor, toId, tokenIncludesFromConfig, topologyBase, usePreviewVariantRuntime, vocabularyRank };
|
package/dist/index.js
CHANGED
|
@@ -112,7 +112,7 @@ import {
|
|
|
112
112
|
ownedImportsEqual,
|
|
113
113
|
resolveComponentGovernance,
|
|
114
114
|
scaleGovernanceRecordSchema
|
|
115
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-BAHCOAVG.js";
|
|
116
116
|
import {
|
|
117
117
|
AGENT_FORMAT_SCHEMA_VERSION,
|
|
118
118
|
agentErrorEnvelopeSchema,
|
|
@@ -1841,9 +1841,14 @@ var governedFragmentDefinitionSchema = z4.object({
|
|
|
1841
1841
|
var recipeDefinitionSchema = blockDefinitionSchema;
|
|
1842
1842
|
|
|
1843
1843
|
// src/config.ts
|
|
1844
|
+
var RAW_CONFIG_DECLARATION = /* @__PURE__ */ Symbol.for("@usefragments/core/raw-config-declaration");
|
|
1844
1845
|
function formatZodErrors(errors) {
|
|
1845
1846
|
return errors.map((error) => ` - ${error.path.join(".")}: ${error.message}`).join("\n");
|
|
1846
1847
|
}
|
|
1848
|
+
function configDeclarationForDiagnostics(config) {
|
|
1849
|
+
if (!config || typeof config !== "object") return config;
|
|
1850
|
+
return config[RAW_CONFIG_DECLARATION] ?? config;
|
|
1851
|
+
}
|
|
1847
1852
|
function defineConfig(config) {
|
|
1848
1853
|
const normalized = normalizeGovernanceConfig(config);
|
|
1849
1854
|
const result = fragmentsConfigSchema.safeParse(normalized);
|
|
@@ -1851,6 +1856,12 @@ function defineConfig(config) {
|
|
|
1851
1856
|
throw new Error(`Invalid fragments config:
|
|
1852
1857
|
${formatZodErrors(result.error.errors)}`);
|
|
1853
1858
|
}
|
|
1859
|
+
Object.defineProperty(result.data, RAW_CONFIG_DECLARATION, {
|
|
1860
|
+
value: normalized,
|
|
1861
|
+
enumerable: false,
|
|
1862
|
+
configurable: false,
|
|
1863
|
+
writable: false
|
|
1864
|
+
});
|
|
1854
1865
|
return result.data;
|
|
1855
1866
|
}
|
|
1856
1867
|
|
|
@@ -7189,7 +7200,7 @@ function checkDeclaration(ix, decl, lookupFor) {
|
|
|
7189
7200
|
ruleId: RULE_ID11,
|
|
7190
7201
|
ruleVersion: RULE_VERSION12,
|
|
7191
7202
|
severity: policy.severity,
|
|
7192
|
-
message: spacingMessage(decl.property, decl.value, allowed, scale
|
|
7203
|
+
message: spacingMessage(decl.property, decl.value, allowed, scale, checked),
|
|
7193
7204
|
location: decl.location,
|
|
7194
7205
|
evidence: ix.evidence([decl.id, policy.id, scale.id]),
|
|
7195
7206
|
fingerprintIdentity: {
|
|
@@ -7244,7 +7255,7 @@ function checkInlineStyle(ix, inline, componentByNode, lookupFor) {
|
|
|
7244
7255
|
ruleId: RULE_ID11,
|
|
7245
7256
|
ruleVersion: RULE_VERSION12,
|
|
7246
7257
|
severity: policy.severity,
|
|
7247
|
-
message: spacingMessage(inline.property, inline.value, allowed, scale
|
|
7258
|
+
message: spacingMessage(inline.property, inline.value, allowed, scale, checked),
|
|
7248
7259
|
location: node.location,
|
|
7249
7260
|
evidence: ix.evidence(evidenceIds),
|
|
7250
7261
|
fingerprintIdentity: {
|
|
@@ -7292,14 +7303,14 @@ function buildSpacingFix(property, checked, ix) {
|
|
|
7292
7303
|
ix
|
|
7293
7304
|
);
|
|
7294
7305
|
}
|
|
7295
|
-
function spacingMessage(property, value, allowed,
|
|
7306
|
+
function spacingMessage(property, value, allowed, scale, checked) {
|
|
7296
7307
|
if (checked.reason === "token-equivalent" && checked.matchedToken) {
|
|
7297
7308
|
return `\`${property}: ${value}\` is a raw literal that matches token \`${checked.matchedToken}\`. Reference the token instead.`;
|
|
7298
7309
|
}
|
|
7299
7310
|
const sample = allowed.slice().sort((a, b) => a - b).slice(0, 6);
|
|
7300
|
-
const suffix = `${sample.join(unit + ", ")}${unit}`;
|
|
7311
|
+
const suffix = `${sample.join(scale.unit + ", ")}${scale.unit}`;
|
|
7301
7312
|
const ellipsis = allowed.length > sample.length ? ", \u2026" : "";
|
|
7302
|
-
return `\`${property}: ${value}\` is not on the
|
|
7313
|
+
return `\`${property}: ${value}\` is not on the \`${scale.name}\` scale. Allowed: ${suffix}${ellipsis}. Configure \`govern.scales.${scale.name}\` to change it.`;
|
|
7303
7314
|
}
|
|
7304
7315
|
|
|
7305
7316
|
// src/rules/styles-no-raw-typography.ts
|
|
@@ -8612,6 +8623,207 @@ function policyDeclaresCssVars(policy) {
|
|
|
8612
8623
|
function dedupe(values) {
|
|
8613
8624
|
return [...new Set(values)];
|
|
8614
8625
|
}
|
|
8626
|
+
var RULE_FAMILY_IDS = /* @__PURE__ */ new Set(["tokens/hardcoded-values", "components/usage", "a11y/wcag"]);
|
|
8627
|
+
var CONSUMED_RULE_IDS = new Set(Object.keys(RULE_TIER));
|
|
8628
|
+
var RECOGNIZED_RULE_IDS = /* @__PURE__ */ new Set([...CONSUMED_RULE_IDS, ...RULE_FAMILY_IDS]);
|
|
8629
|
+
var RULE_CONFIG_KEYS = /* @__PURE__ */ new Set(["enabled", "severity", "options"]);
|
|
8630
|
+
var PASSTHROUGH_KEYS = [
|
|
8631
|
+
{
|
|
8632
|
+
path: ["tokens"],
|
|
8633
|
+
keys: [
|
|
8634
|
+
"include",
|
|
8635
|
+
"sources",
|
|
8636
|
+
"packages",
|
|
8637
|
+
"aliases",
|
|
8638
|
+
"upstream",
|
|
8639
|
+
"exclude",
|
|
8640
|
+
"themeSelectors",
|
|
8641
|
+
"enabled",
|
|
8642
|
+
"format",
|
|
8643
|
+
"namespace"
|
|
8644
|
+
]
|
|
8645
|
+
},
|
|
8646
|
+
{
|
|
8647
|
+
path: ["screenshots"],
|
|
8648
|
+
keys: ["viewport", "threshold", "delay", "outputDir", "themes"]
|
|
8649
|
+
},
|
|
8650
|
+
{
|
|
8651
|
+
path: ["service"],
|
|
8652
|
+
keys: ["poolSize", "idleTimeout"]
|
|
8653
|
+
},
|
|
8654
|
+
{
|
|
8655
|
+
path: ["registry"],
|
|
8656
|
+
keys: ["requireStory", "publicOnly", "categoryDepth", "includeProps", "embedFragments"]
|
|
8657
|
+
},
|
|
8658
|
+
{
|
|
8659
|
+
path: ["govern", "tailwind"],
|
|
8660
|
+
keys: ["palette"]
|
|
8661
|
+
},
|
|
8662
|
+
{
|
|
8663
|
+
path: ["govern", "agent"],
|
|
8664
|
+
keys: ["repairOrder"]
|
|
8665
|
+
},
|
|
8666
|
+
{
|
|
8667
|
+
path: ["govern", "ci"],
|
|
8668
|
+
keys: ["failOnWarnings"]
|
|
8669
|
+
}
|
|
8670
|
+
];
|
|
8671
|
+
function objectRecord(value) {
|
|
8672
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
8673
|
+
return value;
|
|
8674
|
+
}
|
|
8675
|
+
function valueAtPath(value, path) {
|
|
8676
|
+
let current = value;
|
|
8677
|
+
for (const segment of path) {
|
|
8678
|
+
const record = objectRecord(current);
|
|
8679
|
+
if (!record) return void 0;
|
|
8680
|
+
current = record[segment];
|
|
8681
|
+
}
|
|
8682
|
+
return current;
|
|
8683
|
+
}
|
|
8684
|
+
function configPath(path) {
|
|
8685
|
+
return path.reduce(
|
|
8686
|
+
(output, segment) => typeof segment === "number" ? `${output}[${segment}]` : output ? `${output}.${segment}` : segment,
|
|
8687
|
+
""
|
|
8688
|
+
);
|
|
8689
|
+
}
|
|
8690
|
+
function unconsumedKeyDiagnostic(path) {
|
|
8691
|
+
const renderedPath = configPath(path);
|
|
8692
|
+
return {
|
|
8693
|
+
code: "FUI9004",
|
|
8694
|
+
kind: "unconsumed-key",
|
|
8695
|
+
severity: "warn",
|
|
8696
|
+
path: renderedPath,
|
|
8697
|
+
message: `${renderedPath} is not consumed by Fragments and has no effect. Remove it or use a supported config key.`
|
|
8698
|
+
};
|
|
8699
|
+
}
|
|
8700
|
+
function collectStrippedKeys(authored, parsed, path, diagnostics) {
|
|
8701
|
+
if (Array.isArray(authored)) {
|
|
8702
|
+
if (!Array.isArray(parsed)) return;
|
|
8703
|
+
authored.forEach((item, index) => {
|
|
8704
|
+
collectStrippedKeys(item, parsed[index], [...path, index], diagnostics);
|
|
8705
|
+
});
|
|
8706
|
+
return;
|
|
8707
|
+
}
|
|
8708
|
+
const authoredRecord = objectRecord(authored);
|
|
8709
|
+
const parsedRecord = objectRecord(parsed);
|
|
8710
|
+
if (!authoredRecord || !parsedRecord) return;
|
|
8711
|
+
for (const key of Object.keys(authoredRecord).sort()) {
|
|
8712
|
+
if (!Object.prototype.hasOwnProperty.call(parsedRecord, key)) {
|
|
8713
|
+
diagnostics.push(unconsumedKeyDiagnostic([...path, key]));
|
|
8714
|
+
continue;
|
|
8715
|
+
}
|
|
8716
|
+
collectStrippedKeys(authoredRecord[key], parsedRecord[key], [...path, key], diagnostics);
|
|
8717
|
+
}
|
|
8718
|
+
}
|
|
8719
|
+
function collectPassthroughKeys(authored, path, allowed, diagnostics) {
|
|
8720
|
+
const record = objectRecord(valueAtPath(authored, path));
|
|
8721
|
+
if (!record) return;
|
|
8722
|
+
for (const key of Object.keys(record).sort()) {
|
|
8723
|
+
if (!allowed.has(key)) diagnostics.push(unconsumedKeyDiagnostic([...path, key]));
|
|
8724
|
+
}
|
|
8725
|
+
}
|
|
8726
|
+
function collectRuleConfigKeys(authored, path, diagnostics) {
|
|
8727
|
+
const rules = objectRecord(valueAtPath(authored, path));
|
|
8728
|
+
if (!rules) return;
|
|
8729
|
+
for (const ruleId of Object.keys(rules).sort()) {
|
|
8730
|
+
if (!RECOGNIZED_RULE_IDS.has(ruleId)) {
|
|
8731
|
+
diagnostics.push(unconsumedKeyDiagnostic([...path, ruleId]));
|
|
8732
|
+
continue;
|
|
8733
|
+
}
|
|
8734
|
+
const config = objectRecord(rules[ruleId]);
|
|
8735
|
+
if (!config) continue;
|
|
8736
|
+
for (const key of Object.keys(config).sort()) {
|
|
8737
|
+
if (!RULE_CONFIG_KEYS.has(key)) {
|
|
8738
|
+
diagnostics.push(unconsumedKeyDiagnostic([...path, ruleId, key]));
|
|
8739
|
+
}
|
|
8740
|
+
}
|
|
8741
|
+
}
|
|
8742
|
+
}
|
|
8743
|
+
function collectPassthroughRecordValues(authored, path, allowed, diagnostics) {
|
|
8744
|
+
const entries = objectRecord(valueAtPath(authored, path));
|
|
8745
|
+
if (!entries) return;
|
|
8746
|
+
for (const [entryName, value] of Object.entries(entries).sort(
|
|
8747
|
+
([left], [right]) => left.localeCompare(right)
|
|
8748
|
+
)) {
|
|
8749
|
+
const record = objectRecord(value);
|
|
8750
|
+
if (!record) continue;
|
|
8751
|
+
for (const key of Object.keys(record).sort()) {
|
|
8752
|
+
if (!allowed.has(key)) {
|
|
8753
|
+
diagnostics.push(unconsumedKeyDiagnostic([...path, entryName, key]));
|
|
8754
|
+
}
|
|
8755
|
+
}
|
|
8756
|
+
}
|
|
8757
|
+
}
|
|
8758
|
+
function stableConfigDiagnostics(diagnostics) {
|
|
8759
|
+
const unique = /* @__PURE__ */ new Map();
|
|
8760
|
+
for (const diagnostic of diagnostics) {
|
|
8761
|
+
unique.set(`${diagnostic.code}\0${diagnostic.path}`, diagnostic);
|
|
8762
|
+
}
|
|
8763
|
+
return [...unique.values()].sort(
|
|
8764
|
+
(left, right) => left.path.localeCompare(right.path) || left.code.localeCompare(right.code) || left.message.localeCompare(right.message)
|
|
8765
|
+
);
|
|
8766
|
+
}
|
|
8767
|
+
function detectUnconsumedConfigKeys(authoredConfig, parsedConfig) {
|
|
8768
|
+
const diagnostics = [];
|
|
8769
|
+
collectStrippedKeys(authoredConfig, parsedConfig, [], diagnostics);
|
|
8770
|
+
for (const boundary of PASSTHROUGH_KEYS) {
|
|
8771
|
+
collectPassthroughKeys(
|
|
8772
|
+
authoredConfig,
|
|
8773
|
+
boundary.path,
|
|
8774
|
+
new Set(boundary.keys),
|
|
8775
|
+
diagnostics
|
|
8776
|
+
);
|
|
8777
|
+
}
|
|
8778
|
+
collectRuleConfigKeys(authoredConfig, ["govern", "rules"], diagnostics);
|
|
8779
|
+
collectPassthroughRecordValues(
|
|
8780
|
+
authoredConfig,
|
|
8781
|
+
["govern", "agents"],
|
|
8782
|
+
/* @__PURE__ */ new Set(["rules"]),
|
|
8783
|
+
diagnostics
|
|
8784
|
+
);
|
|
8785
|
+
collectPassthroughKeys(authoredConfig, ["govern", "audit"], /* @__PURE__ */ new Set(), diagnostics);
|
|
8786
|
+
collectPassthroughRecordValues(authoredConfig, ["govern", "runners"], /* @__PURE__ */ new Set(), diagnostics);
|
|
8787
|
+
return stableConfigDiagnostics(diagnostics);
|
|
8788
|
+
}
|
|
8789
|
+
function effectiveScaleBindings(policy) {
|
|
8790
|
+
const bindings = [];
|
|
8791
|
+
for (const style of policy?.styles ?? []) {
|
|
8792
|
+
if (style.kind === "style.rawSpacing.mustMatchScale") {
|
|
8793
|
+
bindings.push({
|
|
8794
|
+
label: "Spacing properties",
|
|
8795
|
+
mechanism: "style.rawSpacing.mustMatchScale",
|
|
8796
|
+
scale: style.scale
|
|
8797
|
+
});
|
|
8798
|
+
} else if (style.kind === "style.fontSize.mustMatchScale") {
|
|
8799
|
+
bindings.push({
|
|
8800
|
+
label: "Font-size properties",
|
|
8801
|
+
mechanism: "style.fontSize.mustMatchScale",
|
|
8802
|
+
scale: style.scale
|
|
8803
|
+
});
|
|
8804
|
+
}
|
|
8805
|
+
}
|
|
8806
|
+
return bindings;
|
|
8807
|
+
}
|
|
8808
|
+
function detectOrphanGovernanceScales(declaredPolicy, effectivePolicy) {
|
|
8809
|
+
const bindings = effectiveScaleBindings(effectivePolicy);
|
|
8810
|
+
const referenced = new Set(bindings.map((binding) => binding.scale));
|
|
8811
|
+
const diagnostics = [];
|
|
8812
|
+
for (const scale of Object.keys(declaredPolicy?.scales ?? {}).sort()) {
|
|
8813
|
+
if (referenced.has(scale)) continue;
|
|
8814
|
+
const path = `govern.scales.${scale}`;
|
|
8815
|
+
const preferred = (scale.toLowerCase().includes("spac") ? bindings.find((binding) => binding.mechanism === "style.rawSpacing.mustMatchScale") : void 0) ?? (scale.toLowerCase().includes("font") ? bindings.find((binding) => binding.mechanism === "style.fontSize.mustMatchScale") : void 0) ?? bindings[0];
|
|
8816
|
+
const remediation = preferred ? `${preferred.label} are bound to the scale named "${preferred.scale}" \u2014 rename the key to "${preferred.scale}" or bind it via ${preferred.mechanism}.` : `Bind it via style.rawSpacing.mustMatchScale or style.fontSize.mustMatchScale, or remove it.`;
|
|
8817
|
+
diagnostics.push({
|
|
8818
|
+
code: "FUI9005",
|
|
8819
|
+
kind: "orphan-scale",
|
|
8820
|
+
severity: "warn",
|
|
8821
|
+
path,
|
|
8822
|
+
message: `${path} is not referenced by any property policy. ${remediation}`
|
|
8823
|
+
});
|
|
8824
|
+
}
|
|
8825
|
+
return stableConfigDiagnostics(diagnostics);
|
|
8826
|
+
}
|
|
8615
8827
|
function summarize(status, flags) {
|
|
8616
8828
|
if (status === "inert") {
|
|
8617
8829
|
return "Governance inert \u2014 no enforceable rule family is armed";
|
|
@@ -8627,6 +8839,7 @@ function summarize(status, flags) {
|
|
|
8627
8839
|
}
|
|
8628
8840
|
function evaluateGovernanceIntegrity(input) {
|
|
8629
8841
|
const configs = effectiveRuleConfigs(input.policy);
|
|
8842
|
+
const configDiagnostics = stableConfigDiagnostics(input.configDiagnostics ?? []);
|
|
8630
8843
|
const policyArmed = input.policy !== void 0 && input.policySource !== "none";
|
|
8631
8844
|
const policyFamily = {
|
|
8632
8845
|
id: "policy",
|
|
@@ -8727,6 +8940,17 @@ function evaluateGovernanceIntegrity(input) {
|
|
|
8727
8940
|
families.map((family) => family.remediation).filter((remediation) => remediation !== void 0)
|
|
8728
8941
|
);
|
|
8729
8942
|
const summary = summarize(status, { componentsArmed, tokensArmed, blockingArmed });
|
|
8943
|
+
const configuredRuleCount = [...configs.keys()].filter(
|
|
8944
|
+
(ruleId) => CONSUMED_RULE_IDS.has(ruleId)
|
|
8945
|
+
).length;
|
|
8946
|
+
const activeRuleCount = [...configs.entries()].filter(
|
|
8947
|
+
([ruleId, config]) => CONSUMED_RULE_IDS.has(ruleId) && config.enabled
|
|
8948
|
+
).length;
|
|
8949
|
+
const roster = {
|
|
8950
|
+
configured: configuredRuleCount + configDiagnostics.length,
|
|
8951
|
+
active: activeRuleCount,
|
|
8952
|
+
inert: configDiagnostics.length
|
|
8953
|
+
};
|
|
8730
8954
|
return {
|
|
8731
8955
|
status,
|
|
8732
8956
|
declared: input.declared,
|
|
@@ -8735,7 +8959,9 @@ function evaluateGovernanceIntegrity(input) {
|
|
|
8735
8959
|
families,
|
|
8736
8960
|
armed,
|
|
8737
8961
|
summary,
|
|
8738
|
-
remediations
|
|
8962
|
+
remediations,
|
|
8963
|
+
configDiagnostics,
|
|
8964
|
+
roster
|
|
8739
8965
|
};
|
|
8740
8966
|
}
|
|
8741
8967
|
|
|
@@ -9396,6 +9622,7 @@ export {
|
|
|
9396
9622
|
compositionMetadataSchema,
|
|
9397
9623
|
compositionPatternSchema,
|
|
9398
9624
|
computeRegistryHash,
|
|
9625
|
+
configDeclarationForDiagnostics,
|
|
9399
9626
|
containsTailwindV4Theme,
|
|
9400
9627
|
contractComponentsFromFragments,
|
|
9401
9628
|
contractHash,
|
|
@@ -9406,7 +9633,9 @@ export {
|
|
|
9406
9633
|
defineConfig,
|
|
9407
9634
|
defineFragment,
|
|
9408
9635
|
defineRecipe,
|
|
9636
|
+
detectOrphanGovernanceScales,
|
|
9409
9637
|
detectSubComponentPaths,
|
|
9638
|
+
detectUnconsumedConfigKeys,
|
|
9410
9639
|
diffContractDomains,
|
|
9411
9640
|
discoverComponents,
|
|
9412
9641
|
dtcgTokenFileSchema,
|