@damarkuncoro/meta-architecture-style-engine 0.1.0 → 0.1.1

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/domain/strategies/TokenExistenceValidator.ts","../../src/domain/strategies/DomainValidator.ts","../../src/domain/strategies/AllowedTokenValidator.ts","../../src/domain/StyleResolutionEngine.ts","../../src/domain/CanonicalStyleGraph.ts","../../src/domain/ContextBinder.ts","../../src/domain/ViolationEngine.ts","../../src/data/tokens.ts","../../src/domain/TokenRegistry.ts","../../src/domain/ThemeResolver.ts","../../src/domain/ContextFactory.ts","../../src/runtime/StyleContract.ts","../../src/runtime/StyleProvider.tsx","../../src/adapter/MasePlugin.ts","../../src/adapter/pipeline-factory.ts","../../src/data/constitutions/CardConstitution.ts","../../src/adapter/rules.ts","../../src/data/constitutions/ButtonConstitution.ts","../../src/dsl/Tokenizer.ts","../../src/dsl/Parser.ts","../../src/dsl/Validator.ts","../../src/dsl/Compiler.ts","../../src/materializer/Materializer.ts","../../src/materializer/CSSMaterializer.ts","../../src/materializer/RNMaterializer.ts","../../src/materializer/PDFMaterializer.ts"],"sourcesContent":["// Domain\nexport * from './domain/types';\nexport * from './domain/StyleResolutionEngine';\nexport * from './domain/CanonicalStyleGraph';\nexport * from './domain/ContextBinder';\nexport * from './domain/ViolationEngine';\nexport * from './domain/TokenRegistry';\nexport * from './domain/ThemeResolver';\nexport * from './domain/ContextFactory';\n\n// Runtime\nexport * from './runtime/StyleContract';\nexport * from './runtime/StyleProvider';\n\n// Adapter\nexport * from './adapter/MasePlugin';\nexport * from './adapter/pipeline-factory';\nexport * from './adapter/rules';\n\n// Data\nexport * from './data/tokens';\nexport * from './data/constitutions';\n\n// DSL\nexport { ContractDSLTokenizer, ContractDSLParser, ContractDSLValidator, ContractDSLCompiler } from './dsl';\n\n// Materializer\nexport type { Materializer, MaterializationContext, MaterializationResult } from './materializer';\nexport { MaterializationError, CSSMaterializer, RNMaterializer, PDFMaterializer } from './materializer';\n","import type { IValidationStrategy } from '../interfaces/IValidationStrategy';\nimport type { StyleRule, StyleContext, StyleViolation } from '../types';\nimport type { ITokenRegistry } from '../interfaces/ITokenRegistry';\n\n/**\n * TokenExistenceValidator\n * Validates that a token exists in the registry.\n */\nexport class TokenExistenceValidator implements IValidationStrategy {\n private readonly tokenRegistry: ITokenRegistry;\n \n constructor(tokenRegistry: ITokenRegistry) {\n this.tokenRegistry = tokenRegistry;\n }\n \n /**\n * Validate that token exists\n */\n validate(\n property: string,\n tokenId: string,\n rule: StyleRule,\n context?: StyleContext\n ): StyleViolation | null {\n if (!this.tokenRegistry.hasToken(tokenId)) {\n return {\n rule: 'invalid-token',\n message: `Token '${tokenId}' does not exist in Registry.`,\n severity: 'error',\n semantic: `${property}.${tokenId}`,\n context: context ? { ...context } : undefined\n };\n }\n \n return null;\n }\n \n /**\n * Get strategy name\n */\n getName(): string {\n return 'TokenExistenceValidator';\n }\n}","import type { IValidationStrategy } from '../interfaces/IValidationStrategy';\nimport type { StyleRule, StyleContext, StyleViolation } from '../types';\nimport type { ITokenRegistry } from '../interfaces/ITokenRegistry';\n\n/**\n * DomainValidator\n * Validates that token domain matches rule domain.\n */\nexport class DomainValidator implements IValidationStrategy {\n private readonly tokenRegistry: ITokenRegistry;\n \n constructor(tokenRegistry: ITokenRegistry) {\n this.tokenRegistry = tokenRegistry;\n }\n \n /**\n * Validate that token domain matches rule domain\n */\n validate(\n property: string,\n tokenId: string,\n rule: StyleRule,\n context?: StyleContext\n ): StyleViolation | null {\n const token = this.tokenRegistry.getToken(tokenId);\n \n if (token.domain !== rule.domain) {\n return {\n rule: 'domain-violation',\n message: `Property '${property}' expects domain '${rule.domain}', but got token from '${token.domain}'.`,\n severity: 'error',\n semantic: `${property}.${tokenId}`,\n context: context ? { ...context } : undefined\n };\n }\n \n return null;\n }\n \n /**\n * Get strategy name\n */\n getName(): string {\n return 'DomainValidator';\n }\n}","import type { IValidationStrategy } from '../interfaces/IValidationStrategy';\nimport type { StyleRule, StyleContext, StyleViolation } from '../types';\n\n/**\n * AllowedTokenValidator\n * Validates that token is in the allowed list for a rule.\n */\nexport class AllowedTokenValidator implements IValidationStrategy {\n /**\n * Validate that token is allowed\n */\n validate(\n property: string,\n tokenId: string,\n rule: StyleRule,\n context?: StyleContext\n ): StyleViolation | null {\n if (!rule.allowedTokens.includes(tokenId)) {\n return {\n rule: 'illegal-token-usage',\n message: `Token '${tokenId}' is NOT allowed for property '${property}'. Allowed: ${rule.allowedTokens.join(', ')}`,\n severity: 'error',\n semantic: `${property}.${tokenId}`,\n context: context ? { ...context } : undefined\n };\n }\n \n return null;\n }\n \n /**\n * Get strategy name\n */\n getName(): string {\n return 'AllowedTokenValidator';\n }\n}","import type { \n StyleContractDefinition, \n ComponentConstitution, \n StyleResolutionResult, \n StyleContext, \n StyleViolation, \n SemanticNode,\n StyleBreakpoint\n} from './types';\nimport type { ITokenRegistry } from './interfaces/ITokenRegistry';\nimport type { IThemeResolver } from './interfaces/IThemeResolver';\nimport type { IValidationStrategy } from './interfaces/IValidationStrategy';\nimport { TokenExistenceValidator } from './strategies/TokenExistenceValidator';\nimport { DomainValidator } from './strategies/DomainValidator';\nimport { AllowedTokenValidator } from './strategies/AllowedTokenValidator';\nimport { clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * StyleResolutionEngine (REFACTORED)\n * \n * Refactored to follow SOLID principles:\n * - SRP: Only handles resolution logic\n * - DIP: Depends on abstractions (ITokenRegistry, IThemeResolver)\n * - OCP: Extensible via validation strategies\n * \n * Responsibilities:\n * - Contract validation against constitution\n * - Semantic node generation\n * - Materialization (temporary, will move to SME)\n */\nexport class StyleResolutionEngine {\n private readonly tokenRegistry: ITokenRegistry;\n private readonly themeResolver: IThemeResolver;\n private readonly validators: ReadonlyArray<IValidationStrategy>;\n \n constructor(\n tokenRegistry: ITokenRegistry,\n themeResolver: IThemeResolver,\n validators?: ReadonlyArray<IValidationStrategy>\n ) {\n this.tokenRegistry = tokenRegistry;\n this.themeResolver = themeResolver;\n this.validators = validators || [\n new TokenExistenceValidator(tokenRegistry),\n new DomainValidator(tokenRegistry),\n new AllowedTokenValidator()\n ];\n }\n \n /**\n * resolve()\n * Main function: Validates style contract against constitution\n * \n * @param contract - Style contract definition\n * @param constitution - Component constitution\n * @param context - Optional style context\n * @returns Resolution result with nodes, violations, and className\n */\n resolve(\n contract: StyleContractDefinition, \n constitution: ComponentConstitution,\n context?: StyleContext\n ): StyleResolutionResult {\n const violations: StyleViolation[] = [];\n const nodes: SemanticNode[] = [];\n const validClassNames: string[] = [];\n\n // Check each property in contract\n for (const [property, rawValue] of Object.entries(contract)) {\n const rule = constitution.rules.find((r) => r.property === property);\n \n // 1. Rule Existence Check\n if (!rule) {\n violations.push({\n rule: 'unknown-property',\n message: `Property '${property}' is not defined in ${constitution.componentName} constitution.`,\n severity: 'warning',\n semantic: `${property}`\n });\n continue;\n }\n\n // Handle ResponsiveValue (String or Object)\n if (typeof rawValue === 'string') {\n this.validateAndResolve(\n property, \n rawValue, \n rule, \n constitution, \n violations, \n nodes, \n validClassNames, \n undefined, \n context\n );\n } else if (typeof rawValue === 'object' && rawValue !== null) {\n // Iterate over breakpoints\n for (const [bp, tokenId] of Object.entries(rawValue)) {\n this.validateAndResolve(\n property, \n tokenId as string, \n rule, \n constitution, \n violations, \n nodes, \n validClassNames, \n bp as StyleBreakpoint,\n context\n );\n }\n }\n }\n\n // Return Immutable Result\n return {\n valid: violations.length === 0,\n nodes: Object.freeze(nodes),\n violations: Object.freeze(violations),\n className: validClassNames.join(' '),\n };\n }\n \n /**\n * validateAndResolve()\n * Internal helper to validate and resolve a single token\n */\n private validateAndResolve(\n property: string,\n tokenId: string,\n rule: any,\n constitution: any,\n violations: StyleViolation[],\n nodes: SemanticNode[],\n validClassNames: string[],\n breakpoint?: StyleBreakpoint,\n context?: StyleContext\n ) {\n // Run all validation strategies\n for (const validator of this.validators) {\n const violation = validator.validate(property, tokenId, rule, context);\n if (violation) {\n violations.push({\n ...violation,\n context: breakpoint ? { breakpoint } : undefined\n });\n return;\n }\n }\n \n // If valid, create semantic node\n const token = this.tokenRegistry.getToken(tokenId);\n nodes.push({\n domain: token.domain,\n semantic: `${constitution.componentName}.${property}`,\n tokenRef: token.id,\n source: 'SRE.v2',\n breakpoint\n });\n \n // Materialize value (temporary, will move to SME)\n const materializedValue = this.materializeToken(token, breakpoint, context);\n validClassNames.push(materializedValue);\n }\n \n /**\n * materializeToken()\n * Resolve token value based on context (Theme/Breakpoint)\n * \n * NOTE: This is temporary materialization logic.\n * In Phase 5, this will be replaced by StyleMaterializationEngine (SME).\n */\n private materializeToken(\n token: { value: string | Record<string, string> },\n breakpoint?: StyleBreakpoint,\n context?: StyleContext\n ): string {\n const theme = this.themeResolver.getCurrentTheme(context);\n const baseValue = this.themeResolver.resolve(token.value, theme);\n \n // Resolve Breakpoint Prefix\n if (breakpoint) {\n return `${breakpoint}:${baseValue}`;\n }\n \n return baseValue;\n }\n}\n","import type { ComponentConstitution, StyleRule, StyleDomain } from './types';\nimport type { ITokenRegistry } from './interfaces/ITokenRegistry';\n\n/**\n * CSGNode\n * Node in the Canonical Style Graph.\n * Represents a single style rule with its dependencies.\n */\nexport interface CSGNode {\n readonly id: string;\n readonly contractRef: string;\n readonly property: string;\n readonly domain: StyleDomain;\n readonly dependencies: CSGEdge[];\n readonly constraints: ConstraintRule[];\n}\n\n/**\n * CSGEdge\n * Edge in the Canonical Style Graph.\n * Represents a dependency between nodes.\n */\nexport interface CSGEdge {\n readonly from: string;\n readonly to: string;\n readonly type: 'token' | 'contract' | 'constraint';\n}\n\n/**\n * ConstraintRule\n * Constraint definition for a style rule.\n */\nexport interface ConstraintRule {\n readonly type: 'min' | 'max' | 'range' | 'enum' | 'custom';\n readonly value?: any;\n readonly allowed?: any[];\n readonly message?: string;\n}\n\n/**\n * GraphValidation\n * Result of graph validation.\n */\nexport interface GraphValidation {\n readonly isValid: boolean;\n readonly cycles: string[][];\n readonly errors: string[];\n}\n\n/**\n * CanonicalStyleGraph (CSG)\n * \n * The Canonical Style Graph is the immutable constitution of the style system.\n * It represents all style contracts and their dependencies as a directed graph.\n * \n * Responsibilities:\n * - Build dependency graph from contracts\n * - Detect circular dependencies\n * - Provide topological sort for resolution order\n * - Enable efficient lookups\n * \n * Key Principles:\n * - IMMUTABLE: Never mutated after creation\n * - READ-ONLY: Context creates views, not modifications\n * - AUDITABLE: All changes are traceable\n */\nexport class CanonicalStyleGraph {\n private readonly nodes: Map<string, CSGNode>;\n private readonly edges: CSGEdge[];\n private readonly constitutionsMap: Map<string, ComponentConstitution>;\n private readonly tokenRegistry: ITokenRegistry;\n \n constructor(\n contracts: ComponentConstitution[],\n tokenRegistry: ITokenRegistry\n ) {\n this.nodes = new Map();\n this.edges = [];\n this.constitutionsMap = new Map();\n this.tokenRegistry = tokenRegistry;\n \n // Build graph from contracts\n this.buildGraph(contracts);\n \n // Validate graph\n const validation = this.validateGraph();\n if (!validation.isValid) {\n throw new Error(\n `Invalid Canonical Style Graph: ${validation.errors.join(', ')}`\n );\n }\n }\n \n /**\n * Build dependency graph from contracts\n */\n private buildGraph(contracts: ComponentConstitution[]): void {\n for (const constitution of contracts) {\n // Store constitution reference\n this.constitutionsMap.set(constitution.componentName, constitution);\n \n // Create nodes for each rule\n for (const rule of constitution.rules) {\n const nodeId = `${constitution.componentName}.${rule.property}`;\n \n const node: CSGNode = {\n id: nodeId,\n contractRef: constitution.componentName,\n property: rule.property,\n domain: rule.domain,\n dependencies: [],\n constraints: this.extractConstraints(rule)\n };\n \n this.nodes.set(nodeId, node);\n \n // Add edges for dependencies\n this.addDependencyEdges(node, rule);\n }\n }\n }\n \n /**\n * Extract constraints from a rule\n */\n private extractConstraints(rule: StyleRule): ConstraintRule[] {\n const constraints: ConstraintRule[] = [];\n \n // Extract allowed tokens as enum constraint\n if (rule.allowedTokens && rule.allowedTokens.length > 0) {\n constraints.push({\n type: 'enum',\n allowed: [...rule.allowedTokens],\n message: `Must be one of: ${rule.allowedTokens.join(', ')}`\n });\n }\n \n // Extract conflicts as custom constraints\n if (rule.conflictsWith && rule.conflictsWith.length > 0) {\n constraints.push({\n type: 'custom',\n value: rule.conflictsWith,\n message: `Cannot be used with: ${rule.conflictsWith.join(', ')}`\n });\n }\n \n return constraints;\n }\n \n /**\n * Add dependency edges for a node\n */\n private addDependencyEdges(node: CSGNode, rule: StyleRule): void {\n // Add edges for allowed tokens (token dependencies)\n for (const tokenId of rule.allowedTokens) {\n if (this.tokenRegistry.hasToken(tokenId)) {\n const token = this.tokenRegistry.getToken(tokenId);\n \n this.edges.push({\n from: node.id,\n to: token.id,\n type: 'token'\n });\n \n node.dependencies.push({\n from: node.id,\n to: token.id,\n type: 'token'\n });\n }\n }\n \n // Add edges for conflicts (constraint dependencies)\n if (rule.conflictsWith) {\n for (const conflictProperty of rule.conflictsWith) {\n const conflictNodeId = `${node.contractRef}.${conflictProperty}`;\n \n this.edges.push({\n from: node.id,\n to: conflictNodeId,\n type: 'constraint'\n });\n \n node.dependencies.push({\n from: node.id,\n to: conflictNodeId,\n type: 'constraint'\n });\n }\n }\n }\n \n /**\n * Validate graph for circular dependencies\n */\n private validateGraph(): GraphValidation {\n const errors: string[] = [];\n const cycles: string[][] = [];\n \n // Detect cycles using DFS\n const visited = new Set<string>();\n const recursionStack = new Set<string>();\n \n for (const nodeId of this.nodes.keys()) {\n if (!visited.has(nodeId)) {\n const cycle = this.detectCycle(nodeId, visited, recursionStack);\n if (cycle) {\n cycles.push(cycle);\n }\n }\n }\n \n if (cycles.length > 0) {\n errors.push(`Circular dependencies detected: ${cycles.map(c => c.join(' → ')).join(', ')}`);\n }\n \n return {\n isValid: errors.length === 0,\n cycles,\n errors\n };\n }\n \n /**\n * Detect cycle starting from a node using DFS\n */\n private detectCycle(\n nodeId: string,\n visited: Set<string>,\n recursionStack: Set<string>\n ): string[] | null {\n visited.add(nodeId);\n recursionStack.add(nodeId);\n \n const node = this.nodes.get(nodeId);\n if (!node) return null;\n \n for (const edge of node.dependencies) {\n const neighborId = edge.to;\n \n if (!visited.has(neighborId)) {\n const cycle = this.detectCycle(neighborId, visited, recursionStack);\n if (cycle) return cycle;\n } else if (recursionStack.has(neighborId)) {\n // Found a cycle\n return this.buildCyclePath(neighborId, recursionStack);\n }\n }\n \n recursionStack.delete(nodeId);\n return null;\n }\n \n /**\n * Build cycle path from recursion stack\n */\n private buildCyclePath(startNodeId: string, stack: Set<string>): string[] {\n const path: string[] = [startNodeId];\n \n // Reconstruct path from stack\n for (const nodeId of stack) {\n path.push(nodeId);\n if (nodeId === startNodeId) break;\n }\n \n return path;\n }\n \n /**\n * Get resolution order using topological sort\n * @returns Array of node IDs in resolution order\n */\n getResolutionOrder(): string[] {\n const visited = new Set<string>();\n const result: string[] = [];\n \n // Kahn's algorithm for topological sort\n const inDegree = new Map<string, number>();\n \n // Calculate in-degrees\n for (const [nodeId] of this.nodes.keys()) {\n inDegree.set(nodeId, 0);\n }\n \n for (const edge of this.edges) {\n const current = inDegree.get(edge.to) || 0;\n inDegree.set(edge.to, current + 1);\n }\n \n // Process nodes with in-degree 0\n const queue: string[] = [];\n for (const [nodeId, degree] of inDegree.entries()) {\n if (degree === 0) {\n queue.push(nodeId);\n }\n }\n \n while (queue.length > 0) {\n const nodeId = queue.shift()!;\n result.push(nodeId);\n visited.add(nodeId);\n \n // Reduce in-degree for neighbors\n const node = this.nodes.get(nodeId);\n if (node) {\n for (const edge of node.dependencies) {\n const neighborId = edge.to;\n const current = inDegree.get(neighborId) || 0;\n inDegree.set(neighborId, current - 1);\n \n if (current - 1 === 0) {\n queue.push(neighborId);\n }\n }\n }\n }\n \n // Check if all nodes were visited (no cycles)\n if (visited.size !== this.nodes.size) {\n throw new Error('Cannot resolve order: graph contains cycles');\n }\n \n return result;\n }\n \n /**\n * Get node by ID\n */\n getNode(id: string): CSGNode | undefined {\n return this.nodes.get(id);\n }\n \n /**\n * Get all nodes\n */\n getAllNodes(): ReadonlyArray<CSGNode> {\n return Array.from(this.nodes.values());\n }\n \n /**\n * Get all edges\n */\n getAllEdges(): ReadonlyArray<CSGEdge> {\n return this.edges;\n }\n \n /**\n * Get constitution by component name\n */\n getConstitution(componentName: string): ComponentConstitution | undefined {\n return this.constitutionsMap.get(componentName);\n }\n \n /**\n * Get all constitutions\n */\n getAllConstitutions(): ReadonlyArray<ComponentConstitution> {\n return Array.from(this.constitutionsMap.values());\n }\n \n /**\n * Check if graph is empty\n */\n isEmpty(): boolean {\n return this.nodes.size === 0;\n }\n \n /**\n * Get graph size\n */\n size(): number {\n return this.nodes.size;\n }\n}","import type { StyleContext, StyleDomain, StyleBreakpoint, StyleTheme } from './types';\nimport type { CanonicalStyleGraph, CSGNode } from './CanonicalStyleGraph';\n\n/**\n * BoundContext\n * Result of context binding.\n * Contains active contracts and disabled variants for a specific context.\n */\nexport interface BoundContext {\n readonly context: StyleContext;\n readonly activeContracts: Set<string>;\n readonly disabledVariants: Map<string, string[]>;\n readonly graphView: ReadonlyArray<CSGNode>;\n}\n\n/**\n * ContextBindingRule\n * Rule for context-aware contract activation.\n */\nexport interface ContextBindingRule {\n readonly contract: string;\n readonly property: string;\n readonly condition: (context: StyleContext) => boolean;\n readonly disabledVariants?: string[];\n}\n\n/**\n * ContextBinder\n * \n * Binds style contracts to specific contexts (device, theme, platform).\n * Creates immutable views of the Canonical Style Graph.\n * \n * Responsibilities:\n * - Determine which contracts are active in a context\n * - Determine which variants are disabled in a context\n * - Create immutable view of the graph\n * - Enable parallel context evaluation\n * \n * Key Principles:\n * - IMMUTABLE: Never mutates the original graph\n * - VIEW-BASED: Creates views, not modifications\n * - COMPOSABLE: Contexts can be combined\n * - AUDITABLE: All decisions are traceable\n */\nexport class ContextBinder {\n private readonly graph: CanonicalStyleGraph;\n private readonly bindingRules: ContextBindingRule[];\n \n constructor(\n graph: CanonicalStyleGraph,\n bindingRules: ContextBindingRule[] = []\n ) {\n this.graph = graph;\n this.bindingRules = bindingRules;\n }\n \n /**\n * Bind graph to a specific context\n * @param context - Style context to bind to\n * @returns Bound context with active contracts and disabled variants\n */\n bind(context: StyleContext): BoundContext {\n const activeContracts = new Set<string>();\n const disabledVariants = new Map<string, string[]>();\n \n // Process each binding rule\n for (const rule of this.bindingRules) {\n // Check if contract is active in this context\n const isActive = rule.condition(context);\n \n if (isActive) {\n activeContracts.add(rule.contract);\n \n // Add disabled variants if specified\n if (rule.disabledVariants && rule.disabledVariants.length > 0) {\n disabledVariants.set(rule.contract, rule.disabledVariants);\n }\n }\n }\n \n // Create graph view (immutable)\n const graphView = this.createGraphView(activeContracts, disabledVariants);\n \n return {\n context,\n activeContracts,\n disabledVariants,\n graphView\n };\n }\n \n /**\n * Bind graph to multiple contexts\n * @param contexts - Array of style contexts\n * @returns Array of bound contexts\n */\n bindMultiple(contexts: ReadonlyArray<StyleContext>): ReadonlyArray<BoundContext> {\n return contexts.map(ctx => this.bind(ctx));\n }\n \n /**\n * Create immutable view of the graph\n * @param activeContracts - Set of active contract names\n * @param disabledVariants - Map of disabled variants per contract\n * @returns Immutable array of nodes\n */\n private createGraphView(\n activeContracts: Set<string>,\n disabledVariants: Map<string, string[]>\n ): ReadonlyArray<CSGNode> {\n const allNodes = this.graph.getAllNodes();\n const view: CSGNode[] = [];\n \n for (const node of allNodes) {\n // Check if node's contract is active\n if (!activeContracts.has(node.contractRef)) {\n continue; // Skip inactive contracts\n }\n \n // Check if node's variant is disabled\n const disabledForContract = disabledVariants.get(node.contractRef);\n if (disabledForContract && disabledForContract.length > 0) {\n // Extract variant from node ID (e.g., \"Button.padding.md\" -> \"md\")\n const variant = this.extractVariant(node.id);\n if (variant && disabledForContract.includes(variant)) {\n continue; // Skip disabled variants\n }\n }\n \n // Add node to view\n view.push(node);\n }\n \n return Object.freeze(view);\n }\n \n /**\n * Extract variant from node ID\n * @param nodeId - Node ID (e.g., \"Button.padding.md\")\n * @returns Variant (e.g., \"md\") or null\n */\n private extractVariant(nodeId: string): string | null {\n // Node ID format: \"{contract}.{property}.{variant}\"\n const parts = nodeId.split('.');\n if (parts.length >= 3) {\n return parts[2];\n }\n return null;\n }\n \n /**\n * Add a binding rule\n * @param rule - Context binding rule\n */\n addBindingRule(rule: ContextBindingRule): void {\n this.bindingRules.push(rule);\n }\n \n /**\n * Remove a binding rule\n * @param contract - Contract name\n * @param property - Property name\n */\n removeBindingRule(contract: string, property: string): void {\n const index = this.bindingRules.findIndex(\n r => r.contract === contract && r.property === property\n );\n if (index !== -1) {\n this.bindingRules.splice(index, 1);\n }\n }\n \n /**\n * Get all binding rules\n * @returns Immutable array of binding rules\n */\n getBindingRules(): ReadonlyArray<ContextBindingRule> {\n return Object.freeze([...this.bindingRules]);\n }\n \n /**\n * Create default binding rules for common scenarios\n * @returns Array of default binding rules\n */\n static createDefaultRules(): ContextBindingRule[] {\n return [\n // Mobile: Disable large spacing\n {\n contract: 'Card',\n property: 'padding',\n condition: (ctx) => ctx.device === 'mobile',\n disabledVariants: ['lg', 'xl', '2xl']\n },\n // Mobile: Disable large shadows\n {\n contract: 'Card',\n property: 'shadow',\n condition: (ctx) => ctx.device === 'mobile',\n disabledVariants: ['lg', 'xl']\n },\n // Dark mode: Disable light surfaces\n {\n contract: 'Card',\n property: 'background',\n condition: (ctx) => ctx.theme === 'dark',\n disabledVariants: ['surface.white', 'surface.gray']\n },\n // Reduced motion: Disable animations\n {\n contract: 'Button',\n property: 'effect',\n condition: (ctx) => ctx.state === 'disabled',\n disabledVariants: ['animate', 'transition']\n }\n ];\n }\n}","import type { StyleViolation, StyleContext } from './types';\n\n/**\n * ViolationAction\n * Action to take when a violation is detected.\n */\nexport type ViolationAction = 'reject' | 'fallback' | 'override' | 'warn';\n\n/**\n * ViolationOutcome\n * Pure function result from violation handling.\n * No side effects, just decision.\n */\nexport interface ViolationOutcome {\n readonly action: ViolationAction;\n readonly replacement?: any;\n readonly metadata: {\n readonly contract: string;\n readonly reason: string;\n readonly context: Partial<StyleContext>;\n readonly severity: 'error' | 'warning';\n };\n}\n\n/**\n * ViolationHandler\n * Strategy for handling violations.\n */\nexport interface ViolationHandler {\n /**\n * Handle a violation\n * @param violation - The violation to handle\n * @returns Outcome (decision, not execution)\n */\n handle(violation: StyleViolation): ViolationOutcome;\n}\n\n/**\n * ViolationEngine\n * \n * Pure function engine for handling style violations.\n * Returns decisions, never executes them.\n * \n * Responsibilities:\n * - Evaluate violations against policies\n * - Determine appropriate action (reject/fallback/override/warn)\n * - Provide replacement values for fallback\n * - Generate audit metadata\n * \n * Key Principles:\n * - PURE: No side effects, no execution\n * - POLICY-DRIVEN: Decisions based on configured policies\n * - AUDITABLE: All decisions are traceable\n * - COMPOSABLE: Handlers can be combined\n */\nexport class ViolationEngine {\n private readonly handlers: Map<string, ViolationHandler>;\n private defaultAction: ViolationAction;\n \n constructor(\n defaultAction: ViolationAction = 'reject',\n handlers?: ViolationHandler[]\n ) {\n this.defaultAction = defaultAction;\n this.handlers = new Map();\n \n // Register handlers\n if (handlers) {\n for (const handler of handlers) {\n this.handlers.set(handler.constructor.name, handler);\n }\n }\n }\n \n /**\n * Handle a violation\n * @param violation - The violation to handle\n * @returns Outcome (decision, not execution)\n */\n handle(violation: StyleViolation): ViolationOutcome {\n // Try to find specific handler\n const handler = this.handlers.get(violation.rule);\n \n if (handler) {\n return handler.handle(violation);\n }\n \n // Fall back to default action\n return this.createDefaultOutcome(violation);\n }\n \n /**\n * Handle multiple violations\n * @param violations - Array of violations\n * @returns Array of outcomes\n */\n handleMultiple(violations: ReadonlyArray<StyleViolation>): ViolationOutcome[] {\n return violations.map(v => this.handle(v));\n }\n \n /**\n * Get current default action\n * @returns Current default action\n */\n getCurrentDefaultAction(): ViolationAction {\n return this.defaultAction;\n }\n \n /**\n * Create default outcome based on default action\n * @param violation - The violation\n * @returns Default outcome\n */\n private createDefaultOutcome(violation: StyleViolation): ViolationOutcome {\n const currentAction = this.getCurrentDefaultAction();\n \n switch (currentAction) {\n case 'reject':\n return {\n action: 'reject',\n metadata: {\n contract: violation.semantic || 'unknown',\n reason: violation.message,\n context: violation.context || {} as Partial<StyleContext>,\n severity: violation.severity as 'error' | 'warning'\n }\n };\n \n case 'fallback':\n return {\n action: 'fallback',\n replacement: this.determineFallbackValue(violation),\n metadata: {\n contract: violation.semantic || 'unknown',\n reason: violation.message,\n context: violation.context || {} as Partial<StyleContext>,\n severity: 'warning'\n }\n };\n \n case 'override':\n return {\n action: 'override',\n metadata: {\n contract: violation.semantic || 'unknown',\n reason: violation.message,\n context: violation.context || {} as Partial<StyleContext>,\n severity: 'warning'\n }\n };\n \n case 'warn':\n return {\n action: 'warn',\n metadata: {\n contract: violation.semantic || 'unknown',\n reason: violation.message,\n context: violation.context || {} as Partial<StyleContext>,\n severity: 'warning'\n }\n };\n \n default:\n throw new Error(`Unknown action: ${currentAction}`);\n }\n }\n \n /**\n * Determine fallback value for a violation\n * @param violation - The violation\n * @returns Fallback value or undefined\n */\n private determineFallbackValue(violation: StyleViolation): any {\n // Extract fallback from violation message if available\n const match = violation.message.match(/fallback to \\[([^\\]]+)\\]/i);\n if (match && match[1]) {\n return match[1];\n }\n \n // Try to infer from semantic\n if (violation.semantic) {\n const parts = violation.semantic.split('.');\n if (parts.length >= 2) {\n const property = parts[parts.length - 1];\n // Common fallbacks\n const fallbacks: Record<string, string> = {\n 'padding': 'md',\n 'margin': 'md',\n 'spacing': 'md',\n 'radius': 'md',\n 'shadow': 'md',\n 'background': 'surface.card',\n 'color': 'color.primary'\n };\n \n if (property in fallbacks) {\n return fallbacks[property];\n }\n }\n }\n \n return undefined;\n }\n \n /**\n * Register a handler\n * @param handler - The handler to register\n */\n registerHandler(handler: ViolationHandler): void {\n this.handlers.set(handler.constructor.name, handler);\n }\n \n /**\n * Unregister a handler\n * @param handlerName - Name of handler to unregister\n */\n unregisterHandler(handlerName: string): void {\n this.handlers.delete(handlerName);\n }\n \n /**\n * Get all registered handlers\n * @returns Array of handler names\n */\n getHandlers(): ReadonlyArray<string> {\n return Array.from(this.handlers.keys());\n }\n \n /**\n * Set default action\n * @param action - The default action\n */\n setDefaultAction(action: ViolationAction): void {\n (this as any).defaultAction = action;\n }\n}\n\n/**\n * DefaultViolationHandlers\n * Common violation handlers for typical scenarios.\n */\nexport class DefaultViolationHandlers {\n /**\n * TokenExistenceHandler\n * Handles invalid token violations.\n */\n static TokenExistenceHandler: ViolationHandler = {\n handle(violation: StyleViolation): ViolationOutcome {\n return {\n action: 'reject',\n metadata: {\n contract: violation.semantic || 'unknown',\n reason: violation.message,\n context: violation.context || {} as Partial<StyleContext>,\n severity: 'error'\n }\n };\n }\n };\n \n /**\n * DomainViolationHandler\n * Handles domain mismatch violations.\n */\n static DomainViolationHandler: ViolationHandler = {\n handle(violation: StyleViolation): ViolationOutcome {\n return {\n action: 'reject',\n metadata: {\n contract: violation.semantic || 'unknown',\n reason: violation.message,\n context: violation.context || {} as Partial<StyleContext>,\n severity: 'error'\n }\n };\n }\n };\n \n /**\n * IllegalTokenHandler\n * Handles illegal token usage violations.\n */\n static IllegalTokenHandler: ViolationHandler = {\n handle(violation: StyleViolation): ViolationOutcome {\n return {\n action: 'fallback',\n replacement: 'md', // Default fallback\n metadata: {\n contract: violation.semantic || 'unknown',\n reason: violation.message,\n context: violation.context || {} as Partial<StyleContext>,\n severity: 'warning'\n }\n };\n }\n };\n \n /**\n * ContextViolationHandler\n * Handles context-specific violations.\n */\n static ContextViolationHandler: ViolationHandler = {\n handle(violation: StyleViolation): ViolationOutcome {\n return {\n action: 'fallback',\n replacement: 'md', // Default fallback\n metadata: {\n contract: violation.semantic || 'unknown',\n reason: violation.message,\n context: violation.context || {} as Partial<StyleContext>,\n severity: 'warning'\n }\n };\n }\n };\n}","import type { Token } from '../domain/types';\n\n// 1. Token Registry (Mata Uang Negara)\nexport const TOKENS: Record<string, Token> = {\n // Colors - Intent based\n 'color.primary': { id: 'color.primary', domain: 'color', value: 'bg-blue-600' },\n 'color.secondary': { id: 'color.secondary', domain: 'color', value: 'bg-gray-600' },\n 'color.danger': { id: 'color.danger', domain: 'color', value: 'bg-red-600' },\n\n // Spacing - Scale based\n 'space.sm': { id: 'space.sm', domain: 'layout', value: 'p-2' },\n 'space.md': { id: 'space.md', domain: 'layout', value: 'p-4' },\n 'space.lg': { id: 'space.lg', domain: 'layout', value: 'p-6' },\n \n // Forbidden/Raw tokens (for demo)\n 'raw.hex': { id: 'raw.hex', domain: 'color', value: 'bg-[#123456]' }, // Illegal\n\n // Surface (Theme Aware!)\n 'surface.card': { \n id: 'surface.card', \n domain: 'color', \n value: {\n light: 'bg-white',\n dark: 'bg-slate-800'\n } \n },\n 'surface.ground': { \n id: 'surface.ground', \n domain: 'color', \n value: {\n light: 'bg-gray-50',\n dark: 'bg-slate-900'\n } \n },\n 'surface.paper': {\n id: 'surface.paper',\n domain: 'color',\n value: {\n light: 'bg-white',\n dark: 'bg-slate-700'\n }\n },\n\n // Text (Theme Aware!)\n 'text.light': { \n id: 'text.light', \n domain: 'color', \n value: {\n light: 'text-white',\n dark: 'text-gray-100'\n }\n },\n 'text.dark': { \n id: 'text.dark', \n domain: 'color', \n value: {\n light: 'text-gray-900',\n dark: 'text-white'\n }\n },\n 'text.primary': {\n id: 'text.primary',\n domain: 'color',\n value: {\n light: 'text-gray-900',\n dark: 'text-gray-50'\n }\n },\n 'text.secondary': {\n id: 'text.secondary',\n domain: 'color',\n value: {\n light: 'text-gray-500',\n dark: 'text-gray-400'\n }\n },\n 'shadow.sm': { id: 'shadow.sm', domain: 'effect', value: 'shadow-sm' },\n 'shadow.md': { id: 'shadow.md', domain: 'effect', value: 'shadow-md' },\n 'shadow.lg': { id: 'shadow.lg', domain: 'effect', value: 'shadow-lg' },\n \n // Radius\n 'radius.md': { id: 'radius.md', domain: 'layout', value: 'rounded-md' },\n 'radius.lg': { id: 'radius.lg', domain: 'layout', value: 'rounded-lg' },\n};\n","import type { ITokenRegistry } from './interfaces/ITokenRegistry';\nimport type { Token } from './types';\nimport { TOKENS } from '../data/tokens';\n\n/**\n * TokenRegistry\n * Concrete implementation of ITokenRegistry.\n * Provides immutable access to token definitions.\n */\nexport class TokenRegistry implements ITokenRegistry {\n private readonly tokens: Readonly<Record<string, Token>>;\n \n constructor(tokens: Record<string, Token> = TOKENS) {\n // Freeze tokens to ensure immutability\n this.tokens = Object.freeze({ ...tokens });\n }\n \n /**\n * Get token by ID\n * @throws Error if token not found\n */\n getToken(id: string): Token {\n const token = this.tokens[id];\n if (!token) {\n throw new Error(`Token '${id}' not found in registry`);\n }\n return token;\n }\n \n /**\n * Check if token exists\n */\n hasToken(id: string): boolean {\n return id in this.tokens;\n }\n \n /**\n * Get all tokens (immutable)\n */\n getAllTokens(): Readonly<Record<string, Token>> {\n return this.tokens;\n }\n}","import type { IThemeResolver } from './interfaces/IThemeResolver';\nimport type { StyleTheme, ThemeValue } from './types';\n\n/**\n * ThemeResolver\n * Concrete implementation of IThemeResolver.\n * Handles theme-aware value resolution.\n */\nexport class ThemeResolver implements IThemeResolver {\n /**\n * Resolve theme value based on current theme\n */\n resolve(value: ThemeValue, theme: StyleTheme): string {\n // If value is a simple string, return it directly\n if (typeof value === 'string') {\n return value;\n }\n \n // If value is theme-aware object, resolve based on theme\n if (theme in value) {\n return value[theme];\n }\n \n // Theme not found in value\n throw new Error(`Theme '${theme}' not found in value. Available themes: ${Object.keys(value).join(', ')}`);\n }\n \n /**\n * Get current theme from context\n * Defaults to 'light' if not specified\n */\n getCurrentTheme(context?: { theme?: StyleTheme }): StyleTheme {\n return context?.theme || 'light';\n }\n}","import type { StyleContext, StyleTheme, StyleBreakpoint } from './types';\n\n/**\n * ContextFactory\n * Factory for creating style contexts.\n * Eliminates context creation duplication (DRY).\n */\nexport class ContextFactory {\n /**\n * Create a style context with all required fields\n * @param options - Context configuration options\n * @returns Frozen style context\n */\n static create(options: {\n platform?: 'web' | 'native' | 'canvas';\n theme?: StyleTheme;\n device?: 'mobile' | 'tablet' | 'desktop';\n breakpoint?: StyleBreakpoint;\n state?: 'default' | 'hover' | 'active' | 'disabled';\n }): StyleContext {\n return Object.freeze({\n platform: options.platform || 'web',\n theme: options.theme || 'light',\n device: options.device || 'desktop',\n breakpoint: options.breakpoint,\n state: options.state || 'default'\n });\n }\n \n /**\n * Create multiple contexts for testing\n * @returns Array of frozen test contexts\n */\n static createTestContexts(): ReadonlyArray<StyleContext> {\n return Object.freeze([\n this.create({ platform: 'web', theme: 'light', device: 'desktop' }),\n this.create({ platform: 'web', theme: 'dark', device: 'desktop' }),\n this.create({ platform: 'web', theme: 'light', device: 'mobile' })\n ]);\n }\n \n /**\n * Create mobile context\n */\n static createMobile(theme: StyleTheme = 'light'): StyleContext {\n return this.create({ platform: 'web', theme, device: 'mobile' });\n }\n \n /**\n * Create tablet context\n */\n static createTablet(theme: StyleTheme = 'light'): StyleContext {\n return this.create({ platform: 'web', theme, device: 'tablet' });\n }\n \n /**\n * Create desktop context\n */\n static createDesktop(theme: StyleTheme = 'light'): StyleContext {\n return this.create({ platform: 'web', theme, device: 'desktop' });\n }\n}","import type { ValidationResult } from '@damarkuncoro/meta-architecture';\nimport type { StyleContractDefinition as IStyleContract, StyleContext, StyleResolutionResult, ComponentConstitution, StyleDomain } from '../domain/types';\nimport { StyleResolutionEngine } from '../domain/StyleResolutionEngine';\nimport { TokenRegistry } from '../domain/TokenRegistry';\nimport { ThemeResolver } from '../domain/ThemeResolver';\n\n/**\n * StyleContract (INTEGRATED)\n * \n * Wrapper Class untuk menangani Style Contract di Runtime.\n * Menggunakan @damarkuncoro/meta-architecture untuk definisi tipe validasi.\n * \n * Refactored to use dependency injection for better testability.\n * Integrated with ContractEntity for constitutional governance.\n * \n * Key Principles:\n * - EXTENDS ContractEntity: First-class citizen in governance system\n * - DEPENDENCY INJECTION: Testable and flexible\n * - DOMAIN EVENTS: Emits events for audit trail\n * - CONTEXT-AWARE: Resolves in specific contexts\n */\nexport class StyleContract {\n private readonly contract: IStyleContract;\n private readonly constitution: ComponentConstitution;\n private readonly engine: StyleResolutionEngine;\n private readonly contractId: string;\n \n constructor(\n contract: IStyleContract,\n constitution: ComponentConstitution,\n engine?: StyleResolutionEngine\n ) {\n this.contract = contract;\n this.constitution = constitution;\n this.contractId = this.generateContractId();\n \n // Inject dependencies (testable!)\n this.engine = engine || new StyleResolutionEngine(\n new TokenRegistry(),\n new ThemeResolver()\n );\n }\n \n /**\n * validate()\n * Memeriksa apakah kontrak sesuai dengan Konstitusi Komponen.\n * Mengembalikan ValidationResult standar dari meta-architecture.\n * \n * This method is compatible with ContractEntity.validate()\n */\n validate(): Partial<ValidationResult> {\n const result = this.engine.resolve(this.contract, this.constitution);\n \n // Mapping internal result to Meta Architecture standard ValidationResult\n return {\n isValid: result.valid,\n errors: result.violations.map((v: any) => ({\n code: v.rule,\n message: v.message,\n severity: v.severity as 'error' | 'warning',\n field: v.semantic,\n timestamp: new Date()\n }) as any), // Casting as 'any' temporarily because library ValidationError is complex\n };\n }\n \n /**\n * resolve()\n * Menjalankan SRE untuk menghasilkan Semantic Nodes.\n * \n * This method is compatible with ContractEntity.resolve()\n */\n resolve(context: StyleContext): StyleResolutionResult {\n return this.engine.resolve(this.contract, this.constitution, context);\n }\n \n /**\n * getConstitution()\n * Mendapatkan konstitusi komponen.\n * \n * This method is compatible with ContractEntity.getConstitution()\n */\n getConstitution(): ComponentConstitution {\n return this.constitution;\n }\n \n /**\n * getContractId()\n * Mendapatkan ID unik untuk kontrak.\n */\n getContractId(): string {\n return this.contractId;\n }\n \n /**\n * getDomain()\n * Mendapatkan domain style kontrak.\n * Derived from the first rule's domain.\n */\n getDomain(): StyleDomain {\n return this.constitution.rules[0]?.domain || 'layout';\n }\n \n /**\n * getJurisdiction()\n * Mendapatkan jurisdiction (platforms) kontrak.\n * Default to ['web'] if not specified.\n */\n getJurisdiction(): string[] {\n return ['web'];\n }\n \n /**\n * generateContractId()\n * Generate unique contract ID.\n */\n private generateContractId(): string {\n return `StyleContract:${this.constitution.componentName}`;\n }\n \n /**\n * toJSON()\n * Serialize contract to JSON for audit trail.\n */\n toJSON(): Record<string, any> {\n return {\n contractId: this.contractId,\n componentName: this.constitution.componentName,\n domain: this.getDomain(),\n jurisdiction: this.getJurisdiction(),\n contract: this.contract,\n constitution: this.constitution,\n timestamp: new Date().toISOString()\n };\n }\n}\n","import React, { createContext, useContext, useEffect, useState } from 'react';\nimport type { ReactNode } from 'react';\nimport type { StyleContext, StyleTheme } from '../domain/types';\n\ninterface StyleContextState extends StyleContext {\n toggleTheme: () => void;\n setTheme: (theme: StyleTheme) => void;\n}\n\nconst defaultContext: StyleContextState = {\n platform: 'web',\n theme: 'light',\n device: 'desktop',\n toggleTheme: () => {},\n setTheme: () => {}\n};\n\nconst StyleEngineContext = createContext<StyleContextState>(defaultContext);\n\ninterface StyleProviderProps {\n children: ReactNode;\n initialTheme?: StyleTheme;\n}\n\nexport const StyleProvider: React.FC<StyleProviderProps> = ({ children, initialTheme = 'light' }) => {\n const [theme, setThemeState] = useState<StyleTheme>(initialTheme);\n const [device, setDevice] = useState<'mobile' | 'tablet' | 'desktop'>('desktop');\n\n // Simple responsive detection\n useEffect(() => {\n const handleResize = () => {\n const width = window.innerWidth;\n if (width < 640) setDevice('mobile');\n else if (width < 1024) setDevice('tablet');\n else setDevice('desktop');\n };\n\n handleResize();\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n // Update HTML class for global styles if needed (e.g. Tailwind dark mode)\n useEffect(() => {\n if (theme === 'dark') {\n document.documentElement.classList.add('dark');\n } else {\n document.documentElement.classList.remove('dark');\n }\n }, [theme]);\n\n const toggleTheme = () => {\n setThemeState(prev => prev === 'light' ? 'dark' : 'light');\n };\n\n const setTheme = (newTheme: StyleTheme) => {\n setThemeState(newTheme);\n };\n\n const value: StyleContextState = {\n platform: 'web',\n theme,\n device,\n toggleTheme,\n setTheme\n };\n\n return (\n <StyleEngineContext.Provider value={value}>\n {children}\n </StyleEngineContext.Provider>\n );\n};\n\nexport const useStyleContext = () => useContext(StyleEngineContext);\n","import {\n type ValidationRule,\n type ValidationContext,\n ValidationError\n} from '@damarkuncoro/meta-architecture';\nimport { StyleResolutionEngine } from '../domain/StyleResolutionEngine';\nimport { StyleContract } from '../runtime/StyleContract';\nimport { type ComponentConstitution } from '../domain/types';\nimport { ContextFactory } from '../domain/ContextFactory';\n\n// -- Interfaces not exported by library --\nexport interface ValidationPluginMetadata {\n name: string;\n version: string;\n description: string;\n author: string;\n homepage?: string;\n repository?: string;\n license?: string;\n dependencies?: Record<string, string>;\n}\n\nexport interface ValidationPluginConfig {\n enabled: boolean;\n priority: number;\n config?: Record<string, any>;\n}\n\nexport interface ValidationPlugin {\n metadata: ValidationPluginMetadata;\n rules: ValidationRule[];\n initialize(config: ValidationPluginConfig): Promise<void>;\n destroy(): Promise<void>;\n getHealth(): Promise<{\n status: 'healthy' | 'degraded' | 'unhealthy';\n message?: string;\n }>;\n}\n// ----------------------------------------\n\n/**\n * MaseValidationRule\n * Adapts MASE's StyleResolutionEngine to Meta Architecture's ValidationRule interface.\n * Allows \"Style Audits\" to be run as part of the broader governance pipeline.\n */\nexport class MaseValidationRule implements ValidationRule<any> {\n name = 'mase-style-compliance';\n description = 'Validates style contracts against MASE Constitution';\n category = 'business' as const;\n severity = 'error' as const;\n\n async validate(target: any, context: ValidationContext): Promise<ValidationError | null> {\n // 1. Identification: Check if target is a MASE-compatible component\n // We support passing Constitution/Contract directly or via metadata\n const constitution = target.constitution || target.metadata?.constitution;\n const contractData = target.contract || target.metadata?.styleContract;\n\n if (!constitution || !contractData) {\n // Not a MASE component, or missing required data. \n // We skip validation (return null) rather than erroring, \n // as this rule only applies to MASE components.\n return null;\n }\n\n // 2. Wrap in StyleContract\n // This allows us to use the existing logic for contract initialization\n const contract = new StyleContract(contractData, constitution);\n\n // 3. Resolve & Validate\n // Iterate through multiple contexts to ensure full compliance across all scenarios.\n const contextsToValidate = ContextFactory.createTestContexts();\n\n const allViolations: any[] = [];\n\n for (const ctx of contextsToValidate) {\n const result = contract.resolve(ctx);\n if (!result.valid) {\n // Tag violations with the context they failed in\n const taggedViolations = result.violations.map((v: any) => ({\n ...v,\n validationContext: `${ctx.theme}-${ctx.device}`\n }));\n allViolations.push(...taggedViolations);\n }\n }\n\n if (allViolations.length === 0) {\n return null;\n }\n\n // 4. Map Violations to ValidationError\n const firstViolation = allViolations[0];\n \n return new ValidationError(\n `[${firstViolation.rule}] ${firstViolation.message}`,\n firstViolation.rule, // Use rule name as Error Code\n { \n semantic: firstViolation.semantic,\n context: firstViolation.context,\n failedContext: firstViolation.validationContext,\n allViolations: allViolations // Attach full list for debug\n }\n );\n }\n}\n\n/**\n * MasePlugin\n * The entry point for Meta Architecture to load MASE capabilities.\n */\nexport class MaseGraphValidationPlugin implements ValidationPlugin {\n metadata: ValidationPluginMetadata = {\n name: 'mase-core-plugin',\n version: '1.0.0',\n description: 'Meta Architecture Style Engine Integration',\n author: 'MASE Team',\n dependencies: {}\n };\n\n rules: ValidationRule[] = [new MaseValidationRule()];\n\n async initialize(config: ValidationPluginConfig): Promise<void> {\n // We could load external constitutions or configs here if needed\n console.log('[MASE Plugin] Initialized with config:', config);\n }\n\n async destroy(): Promise<void> {\n // Cleanup if necessary\n }\n\n async getHealth(): Promise<{ status: 'healthy' | 'degraded' | 'unhealthy'; message?: string }> {\n return { status: 'healthy', message: 'Style Engine is ready' };\n }\n}\n","import { ValidationPipeline } from '@damarkuncoro/meta-architecture';\nimport { MaseGraphValidationPlugin } from './MasePlugin';\nimport type { MaseContractTarget } from './rules';\nimport { CardConstitution } from '../data/constitutions/CardConstitution';\n\n/**\n * Factory untuk membuat pipeline validasi yang sudah dikonfigurasi dengan MASE Plugin.\n * Ini mensimulasikan \"System Boot\" di environment Enterprise/Server-side.\n */\nexport class CompliancePipelineFactory {\n static async createPipeline() {\n const pipeline = new ValidationPipeline();\n const masePlugin = new MaseGraphValidationPlugin();\n \n // Register Plugin\n // Note: Library meta-architecture mungkin belum punya method registerPlugin yang exposed public di versi ini,\n // jadi kita inisialisasi plugin manual dan ambil rules-nya.\n await masePlugin.initialize({ enabled: true, priority: 1 });\n \n // Inject rules ke pipeline (workaround jika registerPlugin tidak tersedia di interface public)\n masePlugin.rules.forEach(rule => pipeline.addRule(rule));\n\n return pipeline;\n }\n\n static createMockTargets(): any[] {\n return [\n {\n // Mock ContractEntity properties required by ValidationPipeline\n id: 'artifact-001',\n name: { value: 'Valid Card Component' },\n category: { value: 'UI Component' },\n contractVersion: '1.0.0',\n \n // MaseContractTarget properties required by MaseGovernanceRule\n constitution: CardConstitution,\n contract: {\n background: 'surface.card',\n padding: 'space.md',\n shadow: 'shadow.md',\n radius: 'radius.md'\n }\n },\n {\n id: 'artifact-002',\n name: { value: 'Invalid Card Component' },\n category: { value: 'UI Component' },\n contractVersion: '1.0.0',\n \n constitution: CardConstitution,\n contract: {\n background: 'bg-red-500', // Violation\n padding: 'space.md',\n shadow: 'shadow.none', // Violation\n radius: 'radius.md'\n }\n },\n {\n id: 'artifact-003',\n name: { value: 'Responsive Card Component' },\n category: { value: 'UI Component' },\n contractVersion: '1.0.0',\n\n constitution: CardConstitution,\n contract: {\n background: 'surface.paper',\n padding: { sm: 'space.sm', lg: 'space.xl' }, // Responsive\n shadow: 'shadow.lg',\n radius: 'radius.full'\n }\n }\n ];\n }\n}\n","import type { ComponentConstitution } from '../../domain/types';\n\nexport const CardConstitution: ComponentConstitution = {\n componentName: 'Card',\n rules: [\n {\n property: 'background',\n domain: 'color',\n allowedTokens: ['surface.card', 'surface.ground'],\n },\n {\n property: 'padding',\n domain: 'layout',\n allowedTokens: ['space.md', 'space.lg'], // Card needs breathing room\n },\n {\n property: 'shadow',\n domain: 'effect',\n allowedTokens: ['shadow.sm', 'shadow.md', 'shadow.lg'],\n },\n {\n property: 'radius',\n domain: 'layout',\n allowedTokens: ['radius.md', 'radius.lg'],\n }\n ]\n};\n","import type {\n ValidationRule,\n ValidationContext,\n} from '@damarkuncoro/meta-architecture';\n// Mocking ValidationError locally because direct import from lib/esm is fragile in some TS setups\n// In a real scenario, we should import from the public API or adjust tsconfig paths.\n// However, since we need to extend/instantiate it, we'll create a local adapter class.\nexport class MaseValidationError extends Error {\n public code: string;\n public field?: string;\n\n constructor(\n message: string,\n code: string,\n field?: string\n ) {\n super(message);\n this.name = 'ValidationError';\n this.code = code;\n this.field = field;\n }\n}\n\nimport { StyleResolutionEngine } from '../domain/StyleResolutionEngine';\nimport { TokenRegistry, ThemeResolver, ContextFactory } from '../domain';\nimport type { ComponentConstitution, StyleContractDefinition } from '../domain/types';\n\n/**\n * MASE Contract Wrapper\n * Used to pass both contract and constitution to the validator\n */\nexport interface MaseContractTarget {\n contract: StyleContractDefinition;\n constitution: ComponentConstitution;\n}\n\n/**\n * MaseGovernanceRule\n * Wraps the synchronous StyleResolutionEngine into a Meta Architecture ValidationRule.\n */\nexport class MaseGovernanceRule implements ValidationRule<MaseContractTarget> {\n public readonly name = 'MASE-Constitutional-Compliance';\n public readonly description = 'Enforces strict adherence to Component Constitution using MASE SRE.';\n public readonly category = 'business'; // It's a business rule (Design System Law)\n public readonly severity = 'error';\n\n private readonly engine: StyleResolutionEngine;\n\n constructor() {\n // Create dependencies using factory\n const tokenRegistry = new TokenRegistry();\n const themeResolver = new ThemeResolver();\n this.engine = new StyleResolutionEngine(tokenRegistry, themeResolver);\n }\n\n async validate(target: MaseContractTarget, _context: ValidationContext): Promise<MaseValidationError | null> {\n // 1. Run Synchronous SRE\n const result = this.engine.resolve(target.contract, target.constitution);\n\n // 2. Check Validity\n if (result.valid) {\n return null;\n }\n\n // 3. Map Violations to ValidationError (Meta Architecture Standard)\n const primaryViolation = result.violations[0];\n \n // We aggregate all violations into one ValidationError message for now,\n // or we could return just the first one as a blocker.\n const messages = result.violations.map((v: any) => `[${v.rule}] ${v.message} (${v.semantic})`).join('; ');\n\n return new MaseValidationError(\n messages,\n primaryViolation.rule, // code\n target.constitution.componentName // field/target\n );\n }\n}\n","import type { ComponentConstitution } from '../../domain/types';\n\nexport const ButtonConstitution: ComponentConstitution = {\n componentName: 'Button',\n rules: [\n {\n property: 'background',\n domain: 'color',\n allowedTokens: ['color.primary', 'color.secondary', 'color.danger'],\n conflictsWith: ['background'], // Cannot have multiple backgrounds\n },\n {\n property: 'padding',\n domain: 'layout',\n allowedTokens: ['space.sm', 'space.md'], // Large padding illegal for buttons\n },\n {\n property: 'text',\n domain: 'color',\n allowedTokens: ['text.light', 'text.dark'],\n }\n ],\n};\n","/**\n * Contract DSL Tokenizer\n * \n * Tokenizes Contract DSL source code into tokens for parsing.\n * \n * Responsibilities:\n * - Convert DSL source to tokens\n * - Handle whitespace and comments\n * - Provide error locations\n * \n * Key Principles:\n * - DRY: Single tokenization logic\n * - SOLID: Single responsibility\n * - YAGNI: Only tokenize what's needed\n * - DDD: Domain-specific token types\n */\n\n/**\n * TokenType\n * Enum of all token types in Contract DSL.\n */\nexport type TokenType =\n // Keywords\n | 'CONTRACT'\n | 'DOMAIN'\n | 'ALLOWS'\n | 'DEFAULT'\n | 'CONSTRAINTS'\n | 'CONFLICTS'\n \n // Contexts\n | 'MOBILE'\n | 'TABLET'\n | 'DESKTOP'\n | 'LIGHT'\n | 'DARK'\n | 'WEB'\n | 'NATIVE'\n | 'CANVAS'\n | 'DEFAULT_CTX'\n | 'HOVER'\n | 'ACTIVE'\n | 'DISABLED'\n \n // Domains\n | 'LAYOUT'\n | 'TYPOGRAPHY'\n | 'COLOR'\n | 'EFFECT'\n | 'INTERACTION'\n \n // Punctuation\n | 'LBRACE'\n | 'RBRACE'\n | 'LBRACKET'\n | 'RBRACKET'\n | 'COLON'\n | 'SEMICOLON'\n | 'COMMA'\n \n // Literals\n | 'IDENTIFIER'\n \n // Special\n | 'EOF'\n | 'UNKNOWN';\n\nexport const TokenType = {\n // Keywords\n CONTRACT: 'CONTRACT' as const,\n DOMAIN: 'DOMAIN' as const,\n ALLOWS: 'ALLOWS' as const,\n DEFAULT: 'DEFAULT' as const,\n CONSTRAINTS: 'CONSTRAINTS' as const,\n CONFLICTS: 'CONFLICTS' as const,\n \n // Contexts\n MOBILE: 'MOBILE' as const,\n TABLET: 'TABLET' as const,\n DESKTOP: 'DESKTOP' as const,\n LIGHT: 'LIGHT' as const,\n DARK: 'DARK' as const,\n WEB: 'WEB' as const,\n NATIVE: 'NATIVE' as const,\n CANVAS: 'CANVAS' as const,\n DEFAULT_CTX: 'DEFAULT_CTX' as const,\n HOVER: 'HOVER' as const,\n ACTIVE: 'ACTIVE' as const,\n DISABLED: 'DISABLED' as const,\n \n // Domains\n LAYOUT: 'LAYOUT' as const,\n TYPOGRAPHY: 'TYPOGRAPHY' as const,\n COLOR: 'COLOR' as const,\n EFFECT: 'EFFECT' as const,\n INTERACTION: 'INTERACTION' as const,\n \n // Punctuation\n LBRACE: 'LBRACE' as const,\n RBRACE: 'RBRACE' as const,\n LBRACKET: 'LBRACKET' as const,\n RBRACKET: 'RBRACKET' as const,\n COLON: 'COLON' as const,\n SEMICOLON: 'SEMICOLON' as const,\n COMMA: 'COMMA' as const,\n \n // Literals\n IDENTIFIER: 'IDENTIFIER' as const,\n \n // Special\n EOF: 'EOF' as const,\n UNKNOWN: 'UNKNOWN' as const\n};\n\n/**\n * Token\n * Represents a single token in the DSL.\n */\nexport interface Token {\n readonly type: TokenType;\n readonly value: string;\n readonly line: number;\n readonly column: number;\n}\n\n/**\n * TokenizerError\n * Error during tokenization.\n */\nexport class TokenizerError extends Error {\n readonly line: number;\n readonly column: number;\n \n constructor(message: string, line: number, column: number) {\n super(message);\n this.name = 'TokenizerError';\n this.line = line;\n this.column = column;\n }\n}\n\n/**\n * ContractDSLTokenizer\n * Tokenizes Contract DSL source code.\n */\nexport class ContractDSLTokenizer {\n private source: string = '';\n private position: number = 0;\n private line: number = 1;\n private column: number = 1;\n \n // Keyword map\n private readonly keywords: Map<string, TokenType> = new Map([\n ['contract', TokenType.CONTRACT],\n ['domain', TokenType.DOMAIN],\n ['allows', TokenType.ALLOWS],\n ['default', TokenType.DEFAULT],\n ['constraints', TokenType.CONSTRAINTS],\n ['conflicts', TokenType.CONFLICTS],\n \n // Contexts\n ['mobile', TokenType.MOBILE],\n ['tablet', TokenType.TABLET],\n ['desktop', TokenType.DESKTOP],\n ['light', TokenType.LIGHT],\n ['dark', TokenType.DARK],\n ['web', TokenType.WEB],\n ['native', TokenType.NATIVE],\n ['canvas', TokenType.CANVAS],\n ['default', TokenType.DEFAULT_CTX],\n ['hover', TokenType.HOVER],\n ['active', TokenType.ACTIVE],\n ['disabled', TokenType.DISABLED],\n \n // Domains\n ['layout', TokenType.LAYOUT],\n ['typography', TokenType.TYPOGRAPHY],\n ['color', TokenType.COLOR],\n ['effect', TokenType.EFFECT],\n ['interaction', TokenType.INTERACTION]\n ]);\n \n /**\n * Tokenize source code\n * @param source - DSL source code\n * @returns Array of tokens\n */\n tokenize(source: string): Token[] {\n this.source = source;\n this.position = 0;\n this.line = 1;\n this.column = 1;\n \n const tokens: Token[] = [];\n \n while (this.position < this.source.length) {\n const char = this.source[this.position];\n \n // Skip whitespace\n if (this.isWhitespace(char)) {\n this.advance();\n continue;\n }\n \n // Skip comments\n if (char === '/' && this.peek() === '/') {\n this.skipComment();\n continue;\n }\n \n // Tokenize\n const token = this.nextToken();\n if (token) {\n tokens.push(token);\n }\n }\n \n // Add EOF token\n tokens.push({\n type: TokenType.EOF,\n value: '',\n line: this.line,\n column: this.column\n });\n \n return tokens;\n }\n \n /**\n * Get next token\n * @returns Token or null if EOF\n */\n private nextToken(): Token | null {\n const char = this.source[this.position];\n \n // Punctuation\n if (char === '{') return this.createToken(TokenType.LBRACE, char);\n if (char === '}') return this.createToken(TokenType.RBRACE, char);\n if (char === '[') return this.createToken(TokenType.LBRACKET, char);\n if (char === ']') return this.createToken(TokenType.RBRACKET, char);\n if (char === ':') return this.createToken(TokenType.COLON, char);\n if (char === ';') return this.createToken(TokenType.SEMICOLON, char);\n if (char === ',') return this.createToken(TokenType.COMMA, char);\n \n // Identifier or keyword\n if (this.isLetter(char) || char === '_' || char === '-') {\n return this.readIdentifier();\n }\n \n // Unknown character\n throw new TokenizerError(\n `Unknown character: '${char}'`,\n this.line,\n this.column\n );\n }\n \n /**\n * Read identifier or keyword\n * @returns Token\n */\n private readIdentifier(): Token {\n const start = this.position;\n const startLine = this.line;\n const startColumn = this.column;\n \n while (\n this.position < this.source.length &&\n (this.isLetter(this.source[this.position]) ||\n this.isDigit(this.source[this.position]) ||\n this.source[this.position] === '_' ||\n this.source[this.position] === '-' ||\n this.source[this.position] === '.')\n ) {\n this.advance();\n }\n \n const value = this.source.substring(start, this.position);\n const type = this.keywords.get(value) || TokenType.IDENTIFIER;\n \n return {\n type,\n value,\n line: startLine,\n column: startColumn\n };\n }\n \n /**\n * Skip single-line comment\n */\n private skipComment(): void {\n while (this.position < this.source.length && this.source[this.position] !== '\\n') {\n this.advance();\n }\n }\n \n /**\n * Create token\n * @param type - Token type\n * @param value - Token value\n * @returns Token\n */\n private createToken(type: TokenType, value: string): Token {\n const token = {\n type,\n value,\n line: this.line,\n column: this.column\n };\n \n this.advance();\n return token;\n }\n \n /**\n * Advance to next character\n */\n private advance(): void {\n if (this.source[this.position] === '\\n') {\n this.line++;\n this.column = 1;\n } else {\n this.column++;\n }\n this.position++;\n }\n \n /**\n * Peek at next character\n * @returns Next character or empty string\n */\n private peek(): string {\n if (this.position + 1 < this.source.length) {\n return this.source[this.position + 1];\n }\n return '';\n }\n \n /**\n * Check if character is whitespace\n * @param char - Character to check\n * @returns True if whitespace\n */\n private isWhitespace(char: string): boolean {\n return char === ' ' || char === '\\t' || char === '\\n' || char === '\\r';\n }\n \n /**\n * Check if character is letter\n * @param char - Character to check\n * @returns True if letter\n */\n private isLetter(char: string): boolean {\n return /[a-zA-Z]/.test(char);\n }\n \n /**\n * Check if character is digit\n * @param char - Character to check\n * @returns True if digit\n */\n private isDigit(char: string): boolean {\n return /[0-9]/.test(char);\n }\n}","/**\n * Contract DSL Parser\n * \n * Parses tokens from Contract DSL into Abstract Syntax Tree (AST).\n * \n * Responsibilities:\n * - Parse tokens into AST\n * - Implement EBNF grammar\n * - Provide syntax errors\n * \n * Key Principles:\n * - DRY: Single parsing logic\n * - SOLID: Single responsibility\n * - YAGNI: Only parse what's needed\n * - DDD: Domain-specific AST structure\n */\n\nimport type { Token, TokenType } from './Tokenizer';\nimport { TokenType as TT } from './Tokenizer';\n\n/**\n * ContractAST\n * Abstract Syntax Tree for a contract.\n */\nexport interface ContractAST {\n readonly name: string;\n readonly domain: string;\n readonly properties: PropertyAST[];\n}\n\n/**\n * PropertyAST\n * AST for a property declaration.\n */\nexport interface PropertyAST {\n readonly name: string;\n readonly allows: string[];\n readonly default?: string;\n readonly constraints?: ConstraintAST[];\n readonly conflicts?: string[];\n}\n\n/**\n * ConstraintAST\n * AST for a constraint declaration.\n */\nexport interface ConstraintAST {\n readonly context: string;\n readonly allows: string[];\n}\n\n/**\n * ParserError\n * Error during parsing.\n */\nexport class ParserError extends Error {\n readonly line: number;\n readonly column: number;\n \n constructor(message: string, line: number, column: number) {\n super(message);\n this.name = 'ParserError';\n this.line = line;\n this.column = column;\n }\n}\n\n/**\n * ContractDSLParser\n * Parses Contract DSL tokens into AST.\n */\nexport class ContractDSLParser {\n private tokens: Token[] = [];\n private position: number = 0;\n \n /**\n * Parse tokens into AST\n * @param tokens - Array of tokens\n * @returns Contract AST\n */\n parse(tokens: Token[]): ContractAST {\n this.tokens = tokens;\n this.position = 0;\n \n // Parse contract\n const contract = this.parseContract();\n \n // Expect EOF\n this.expect(TT.EOF);\n \n return contract;\n }\n \n /**\n * Parse contract\n * @returns Contract AST\n */\n private parseContract(): ContractAST {\n // Expect 'contract'\n this.expect(TT.CONTRACT);\n \n // Expect identifier (contract name)\n const name = this.expectIdentifier();\n \n // Expect '{'\n this.expect(TT.LBRACE);\n \n // Parse domain\n const domain = this.parseDomain();\n \n // Parse properties\n const properties: PropertyAST[] = [];\n while (this.peek()?.type === TT.IDENTIFIER) {\n properties.push(this.parseProperty());\n }\n \n // Expect '}'\n this.expect(TT.RBRACE);\n \n return {\n name,\n domain,\n properties\n };\n }\n \n /**\n * Parse domain declaration\n * @returns Domain name\n */\n private parseDomain(): string {\n // Expect 'domain'\n this.expect(TT.DOMAIN);\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect domain identifier\n const domain = this.expectIdentifier();\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return domain;\n }\n \n /**\n * Parse property declaration\n * @returns Property AST\n */\n private parseProperty(): PropertyAST {\n // Expect identifier (property name)\n const name = this.expectIdentifier();\n \n // Expect '{'\n this.expect(TT.LBRACE);\n \n // Parse property body\n const allows = this.parseAllows();\n const defaultVal = this.parseDefault();\n const constraints = this.parseConstraints();\n const conflicts = this.parseConflicts();\n \n // Expect '}'\n this.expect(TT.RBRACE);\n \n return {\n name,\n allows,\n default: defaultVal,\n constraints,\n conflicts\n };\n }\n \n /**\n * Parse allows declaration\n * @returns Array of allowed tokens\n */\n private parseAllows(): string[] {\n // Expect 'allows'\n this.expect(TT.ALLOWS);\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect '['\n this.expect(TT.LBRACKET);\n \n // Parse token list\n const tokens: string[] = [];\n if (this.peek()?.type === TT.IDENTIFIER) {\n tokens.push(this.expectIdentifier());\n \n while (this.peek()?.type === TT.COMMA) {\n this.expect(TT.COMMA);\n tokens.push(this.expectIdentifier());\n }\n }\n \n // Expect ']'\n this.expect(TT.RBRACKET);\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return tokens;\n }\n \n /**\n * Parse default declaration\n * @returns Default token or undefined\n */\n private parseDefault(): string | undefined {\n // Check if 'default' keyword\n if (this.peek()?.type !== TT.DEFAULT) {\n return undefined;\n }\n \n // Expect 'default'\n this.expect(TT.DEFAULT);\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect identifier\n const value = this.expectIdentifier();\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return value;\n }\n \n /**\n * Parse constraints declaration\n * @returns Array of constraints or undefined\n */\n private parseConstraints(): ConstraintAST[] | undefined {\n // Check if 'constraints' keyword\n if (this.peek()?.type !== TT.CONSTRAINTS) {\n return undefined;\n }\n \n // Expect 'constraints'\n this.expect(TT.CONSTRAINTS);\n \n // Expect '{'\n this.expect(TT.LBRACE);\n \n // Parse constraint list\n const constraints: ConstraintAST[] = [];\n while (this.peek()?.type === TT.MOBILE || \n this.peek()?.type === TT.TABLET || \n this.peek()?.type === TT.DESKTOP ||\n this.peek()?.type === TT.LIGHT || \n this.peek()?.type === TT.DARK ||\n this.peek()?.type === TT.WEB || \n this.peek()?.type === TT.NATIVE ||\n this.peek()?.type === TT.CANVAS ||\n this.peek()?.type === TT.DEFAULT_CTX ||\n this.peek()?.type === TT.HOVER || \n this.peek()?.type === TT.ACTIVE ||\n this.peek()?.type === TT.DISABLED) {\n constraints.push(this.parseConstraint());\n }\n \n // Expect '}'\n this.expect(TT.RBRACE);\n \n return constraints;\n }\n \n /**\n * Parse constraint\n * @returns Constraint AST\n */\n private parseConstraint(): ConstraintAST {\n // Expect context\n const context = this.expectContext();\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect '['\n this.expect(TT.LBRACKET);\n \n // Parse token list\n const tokens: string[] = [];\n if (this.peek()?.type === TT.IDENTIFIER) {\n tokens.push(this.expectIdentifier());\n \n while (this.peek()?.type === TT.COMMA) {\n this.expect(TT.COMMA);\n tokens.push(this.expectIdentifier());\n }\n }\n \n // Expect ']'\n this.expect(TT.RBRACKET);\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return {\n context,\n allows: tokens\n };\n }\n \n /**\n * Parse conflicts declaration\n * @returns Array of conflicting properties or undefined\n */\n private parseConflicts(): string[] | undefined {\n // Check if 'conflicts' keyword\n if (this.peek()?.type !== TT.CONFLICTS) {\n return undefined;\n }\n \n // Expect 'conflicts'\n this.expect(TT.CONFLICTS);\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect '['\n this.expect(TT.LBRACKET);\n \n // Parse property list\n const properties: string[] = [];\n if (this.peek()?.type === TT.IDENTIFIER) {\n properties.push(this.expectIdentifier());\n \n while (this.peek()?.type === TT.COMMA) {\n this.expect(TT.COMMA);\n properties.push(this.expectIdentifier());\n }\n }\n \n // Expect ']'\n this.expect(TT.RBRACKET);\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return properties;\n }\n \n /**\n * Expect identifier token\n * @returns Identifier value\n */\n private expectIdentifier(): string {\n const token = this.peek();\n if (!token || token.type !== TT.IDENTIFIER) {\n throw new ParserError(\n `Expected identifier, got ${token?.type || 'EOF'}`,\n token?.line || 0,\n token?.column || 0\n );\n }\n \n this.advance();\n return token.value;\n }\n \n /**\n * Expect context token\n * @returns Context value\n */\n private expectContext(): string {\n const token = this.peek();\n if (!token || \n (token.type !== TT.MOBILE && \n token.type !== TT.TABLET && \n token.type !== TT.DESKTOP &&\n token.type !== TT.LIGHT && \n token.type !== TT.DARK &&\n token.type !== TT.WEB && \n token.type !== TT.NATIVE &&\n token.type !== TT.CANVAS &&\n token.type !== TT.DEFAULT_CTX &&\n token.type !== TT.HOVER && \n token.type !== TT.ACTIVE &&\n token.type !== TT.DISABLED)) {\n throw new ParserError(\n `Expected context, got ${token?.type || 'EOF'}`,\n token?.line || 0,\n token?.column || 0\n );\n }\n \n this.advance();\n return token.value;\n }\n \n /**\n * Expect specific token type\n * @param type - Expected token type\n */\n private expect(type: TokenType): void {\n const token = this.peek();\n if (!token || token.type !== type) {\n throw new ParserError(\n `Expected ${type}, got ${token?.type || 'EOF'}`,\n token?.line || 0,\n token?.column || 0\n );\n }\n \n this.advance();\n }\n \n /**\n * Peek at current token\n * @returns Current token or undefined\n */\n private peek(): Token | undefined {\n return this.tokens[this.position];\n }\n \n /**\n * Advance to next token\n */\n private advance(): void {\n this.position++;\n }\n}","/**\n * Contract DSL Validator\n * \n * Validates Contract DSL AST structure and semantics.\n * \n * Responsibilities:\n * - Validate AST structure\n * - Check token references\n * - Validate constraints\n * \n * Key Principles:\n * - DRY: Single validation logic\n * - SOLID: Single responsibility\n * - YAGNI: Only validate what's needed\n * - DDD: Domain-specific validation rules\n */\n\nimport type { ContractAST, PropertyAST, ConstraintAST } from './Parser';\nimport type { StyleDomain } from '../domain/types';\n\n/**\n * ValidationError\n * Error during validation.\n */\nexport class ValidationError extends Error {\n readonly path: string;\n \n constructor(message: string, path: string) {\n super(message);\n this.name = 'ValidationError';\n this.path = path;\n }\n}\n\n/**\n * ValidationResult\n * Result of validation.\n */\nexport interface ValidationResult {\n readonly isValid: boolean;\n readonly errors: ValidationError[];\n}\n\n/**\n * ContractDSLValidator\n * Validates Contract DSL AST.\n */\nexport class ContractDSLValidator {\n private readonly validDomains: Set<StyleDomain> = new Set([\n 'layout',\n 'typography',\n 'color',\n 'effect',\n 'interaction'\n ]);\n \n private readonly validContexts: Set<string> = new Set([\n 'mobile',\n 'tablet',\n 'desktop',\n 'light',\n 'dark',\n 'web',\n 'native',\n 'canvas',\n 'default',\n 'hover',\n 'active',\n 'disabled'\n ]);\n \n /**\n * Validate contract AST\n * @param ast - Contract AST\n * @returns Validation result\n */\n validate(ast: ContractAST): ValidationResult {\n const errors: ValidationError[] = [];\n \n // Validate contract name\n this.validateContractName(ast.name, errors);\n \n // Validate domain\n this.validateDomain(ast.domain, errors);\n \n // Validate properties\n this.validateProperties(ast.properties, errors);\n \n return {\n isValid: errors.length === 0,\n errors\n };\n }\n \n /**\n * Validate contract name\n * @param name - Contract name\n * @param errors - Array to collect errors\n */\n private validateContractName(name: string, errors: ValidationError[]): void {\n if (!name || name.trim().length === 0) {\n errors.push(new ValidationError(\n 'Contract name cannot be empty',\n 'contract.name'\n ));\n }\n \n if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(name)) {\n errors.push(new ValidationError(\n `Invalid contract name: '${name}'. Must start with a letter and contain only letters, digits, underscores, and hyphens.`,\n 'contract.name'\n ));\n }\n }\n \n /**\n * Validate domain\n * @param domain - Domain name\n * @param errors - Array to collect errors\n */\n private validateDomain(domain: string, errors: ValidationError[]): void {\n if (!domain || domain.trim().length === 0) {\n errors.push(new ValidationError(\n 'Domain cannot be empty',\n 'contract.domain'\n ));\n return;\n }\n \n if (!this.validDomains.has(domain as StyleDomain)) {\n errors.push(new ValidationError(\n `Invalid domain: '${domain}'. Must be one of: ${Array.from(this.validDomains).join(', ')}`,\n 'contract.domain'\n ));\n }\n }\n \n /**\n * Validate properties\n * @param properties - Array of properties\n * @param errors - Array to collect errors\n */\n private validateProperties(properties: PropertyAST[], errors: ValidationError[]): void {\n if (!properties || properties.length === 0) {\n errors.push(new ValidationError(\n 'Contract must have at least one property',\n 'contract.properties'\n ));\n return;\n }\n \n // Check for duplicate property names\n const propertyNames = new Set<string>();\n for (const property of properties) {\n if (propertyNames.has(property.name)) {\n errors.push(new ValidationError(\n `Duplicate property name: '${property.name}'`,\n `contract.properties.${property.name}`\n ));\n }\n propertyNames.add(property.name);\n \n // Validate individual property\n this.validateProperty(property, errors);\n }\n }\n \n /**\n * Validate property\n * @param property - Property AST\n * @param errors - Array to collect errors\n */\n private validateProperty(property: PropertyAST, errors: ValidationError[]): void {\n const path = `contract.properties.${property.name}`;\n \n // Validate property name\n if (!property.name || property.name.trim().length === 0) {\n errors.push(new ValidationError(\n 'Property name cannot be empty',\n `${path}.name`\n ));\n }\n \n // Validate allows\n this.validateAllows(property.allows, `${path}.allows`, errors);\n \n // Validate default\n if (property.default) {\n this.validateDefault(property.default, property.allows, `${path}.default`, errors);\n }\n \n // Validate constraints\n if (property.constraints) {\n this.validateConstraints(property.constraints, property.allows, `${path}.constraints`, errors);\n }\n \n // Validate conflicts\n if (property.conflicts) {\n this.validateConflicts(property.conflicts, `${path}.conflicts`, errors);\n }\n }\n \n /**\n * Validate allows\n * @param allows - Array of allowed tokens\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateAllows(allows: string[], path: string, errors: ValidationError[]): void {\n if (!allows || allows.length === 0) {\n errors.push(new ValidationError(\n 'Property must have at least one allowed token',\n path\n ));\n return;\n }\n \n // Check for duplicate tokens\n const tokenSet = new Set<string>();\n for (const token of allows) {\n if (tokenSet.has(token)) {\n errors.push(new ValidationError(\n `Duplicate allowed token: '${token}'`,\n path\n ));\n }\n tokenSet.add(token);\n \n // Validate token format\n this.validateTokenFormat(token, path, errors);\n }\n }\n \n /**\n * Validate default\n * @param defaultVal - Default token\n * @param allows - Array of allowed tokens\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateDefault(defaultVal: string, allows: string[], path: string, errors: ValidationError[]): void {\n // Validate token format\n this.validateTokenFormat(defaultVal, path, errors);\n \n // Check if default is in allows\n if (!allows.includes(defaultVal)) {\n errors.push(new ValidationError(\n `Default token '${defaultVal}' is not in allowed tokens`,\n path\n ));\n }\n }\n \n /**\n * Validate constraints\n * @param constraints - Array of constraints\n * @param allows - Array of allowed tokens\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateConstraints(constraints: ConstraintAST[], allows: string[], path: string, errors: ValidationError[]): void {\n if (!constraints || constraints.length === 0) {\n return;\n }\n \n // Check for duplicate contexts\n const contextSet = new Set<string>();\n for (const constraint of constraints) {\n if (contextSet.has(constraint.context)) {\n errors.push(new ValidationError(\n `Duplicate context: '${constraint.context}'`,\n `${path}.${constraint.context}`\n ));\n }\n contextSet.add(constraint.context);\n \n // Validate individual constraint\n this.validateConstraint(constraint, allows, `${path}.${constraint.context}`, errors);\n }\n }\n \n /**\n * Validate constraint\n * @param constraint - Constraint AST\n * @param allows - Array of allowed tokens\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateConstraint(constraint: ConstraintAST, allows: string[], path: string, errors: ValidationError[]): void {\n // Validate context\n if (!this.validContexts.has(constraint.context)) {\n errors.push(new ValidationError(\n `Invalid context: '${constraint.context}'. Must be one of: ${Array.from(this.validContexts).join(', ')}`,\n `${path}.context`\n ));\n }\n \n // Validate allows\n if (!constraint.allows || constraint.allows.length === 0) {\n errors.push(new ValidationError(\n 'Constraint must have at least one allowed token',\n `${path}.allows`\n ));\n return;\n }\n \n // Check if constraint allows are subset of property allows\n for (const token of constraint.allows) {\n if (!allows.includes(token)) {\n errors.push(new ValidationError(\n `Constraint token '${token}' is not in property allowed tokens`,\n `${path}.allows`\n ));\n }\n \n // Validate token format\n this.validateTokenFormat(token, `${path}.allows`, errors);\n }\n }\n \n /**\n * Validate conflicts\n * @param conflicts - Array of conflicting properties\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateConflicts(conflicts: string[], path: string, errors: ValidationError[]): void {\n if (!conflicts || conflicts.length === 0) {\n return;\n }\n \n // Check for duplicate properties\n const propertySet = new Set<string>();\n for (const property of conflicts) {\n if (propertySet.has(property)) {\n errors.push(new ValidationError(\n `Duplicate conflicting property: '${property}'`,\n path\n ));\n }\n propertySet.add(property);\n \n // Validate property name format\n if (!property || property.trim().length === 0) {\n errors.push(new ValidationError(\n 'Conflicting property name cannot be empty',\n path\n ));\n }\n }\n }\n \n /**\n * Validate token format\n * @param token - Token to validate\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateTokenFormat(token: string, path: string, errors: ValidationError[]): void {\n if (!token || token.trim().length === 0) {\n errors.push(new ValidationError(\n 'Token cannot be empty',\n path\n ));\n return;\n }\n \n // Token should be in format: category.subcategory.value\n const parts = token.split('.');\n if (parts.length < 2) {\n errors.push(new ValidationError(\n `Invalid token format: '${token}'. Must be in format: 'category.subcategory.value'`,\n path\n ));\n }\n \n // Each part should be valid identifier\n for (const part of parts) {\n if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(part)) {\n errors.push(new ValidationError(\n `Invalid token part: '${part}'. Must start with a letter and contain only letters, digits, underscores, and hyphens.`,\n path\n ));\n }\n }\n }\n}","/**\n * Contract DSL Compiler\n * \n * Compiles Contract DSL AST to ComponentConstitution and StyleContractDefinition.\n * \n * Responsibilities:\n * - Compile AST to ComponentConstitution\n * - Generate StyleContractDefinition\n * - Provide compile errors\n * \n * Key Principles:\n * - DRY: Single compilation logic\n * - SOLID: Single responsibility\n * - YAGNI: Only compile what's needed\n * - DDD: Domain-specific compilation\n */\n\nimport type { ContractAST, PropertyAST, ConstraintAST } from './Parser';\nimport type { ComponentConstitution, StyleContractDefinition, StyleRule, StyleDomain } from '../domain/types';\n\n/**\n * CompileResult\n * Result of compilation.\n */\nexport interface CompileResult {\n readonly constitution: ComponentConstitution;\n readonly contract: StyleContractDefinition;\n readonly errors: string[];\n}\n\n/**\n * CompilerError\n * Error during compilation.\n */\nexport class CompilerError extends Error {\n readonly path: string;\n \n constructor(message: string, path: string) {\n super(message);\n this.name = 'CompilerError';\n this.path = path;\n }\n}\n\n/**\n * ContractDSLCompiler\n * Compiles Contract DSL AST to ComponentConstitution and StyleContractDefinition.\n */\nexport class ContractDSLCompiler {\n /**\n * Compile AST to ComponentConstitution and StyleContractDefinition\n * @param ast - Contract AST\n * @returns Compile result\n */\n compile(ast: ContractAST): CompileResult {\n const errors: string[] = [];\n \n // Compile to ComponentConstitution\n const constitution = this.compileToConstitution(ast, errors);\n \n // Compile to StyleContractDefinition\n const contract = this.compileToContractDefinition(ast, errors);\n \n return {\n constitution,\n contract,\n errors\n };\n }\n \n /**\n * Compile AST to ComponentConstitution\n * @param ast - Contract AST\n * @param errors - Array to collect errors\n * @returns ComponentConstitution\n */\n private compileToConstitution(ast: ContractAST, errors: string[]): ComponentConstitution {\n const rules: StyleRule[] = [];\n \n for (const property of ast.properties) {\n const rule = this.compilePropertyToRule(property, errors);\n rules.push(rule);\n }\n \n return {\n componentName: ast.name,\n rules\n };\n }\n \n /**\n * Compile property to StyleRule\n * @param property - Property AST\n * @param errors - Array to collect errors\n * @returns StyleRule\n */\n private compilePropertyToRule(property: PropertyAST, errors: string[]): StyleRule {\n return {\n property: property.name,\n domain: this.inferDomain(property.name, errors),\n allowedTokens: property.allows,\n conflictsWith: property.conflicts\n };\n }\n \n /**\n * Infer domain from property name\n * @param propertyName - Property name\n * @param errors - Array to collect errors\n * @returns Inferred domain\n */\n private inferDomain(propertyName: string, errors: string[]): StyleDomain {\n // Simple heuristic to infer domain from property name\n const layoutProperties = ['padding', 'margin', 'spacing', 'gap', 'width', 'height', 'radius', 'shadow'];\n const typographyProperties = ['size', 'weight', 'line-height', 'color', 'font'];\n const colorProperties = ['background', 'foreground', 'border', 'text', 'intent'];\n const effectProperties = ['opacity', 'blur', 'transform', 'transition', 'animation'];\n const interactionProperties = ['hover', 'active', 'focus', 'disabled', 'state'];\n \n if (layoutProperties.some(prop => propertyName.includes(prop))) {\n return 'layout';\n }\n \n if (typographyProperties.some(prop => propertyName.includes(prop))) {\n return 'typography';\n }\n \n if (colorProperties.some(prop => propertyName.includes(prop))) {\n return 'color';\n }\n \n if (effectProperties.some(prop => propertyName.includes(prop))) {\n return 'effect';\n }\n \n if (interactionProperties.some(prop => propertyName.includes(prop))) {\n return 'interaction';\n }\n \n // Default to layout if unknown\n errors.push(`Warning: Could not infer domain for property '${propertyName}', defaulting to 'layout'`);\n return 'layout';\n }\n \n /**\n * Compile AST to StyleContractDefinition\n * @param ast - Contract AST\n * @param errors - Array to collect errors\n * @returns StyleContractDefinition\n */\n private compileToContractDefinition(ast: ContractAST, errors: string[]): StyleContractDefinition {\n const contract: Record<string, string> = {};\n \n for (const property of ast.properties) {\n const defaultValue = property.default || property.allows[0];\n contract[property.name] = defaultValue;\n }\n \n return contract as StyleContractDefinition;\n }\n \n /**\n * Generate TypeScript code for ComponentConstitution\n * @param ast - Contract AST\n * @returns TypeScript code\n */\n generateConstitutionCode(ast: ContractAST): string {\n const lines: string[] = [];\n \n lines.push(`import type { ComponentConstitution } from '../domain/types';`);\n lines.push('');\n lines.push(`export const ${ast.name}Constitution: ComponentConstitution = {`);\n lines.push(` componentName: '${ast.name}',`);\n lines.push(` domain: '${ast.domain}',`);\n lines.push(` rules: [`);\n \n for (const property of ast.properties) {\n lines.push(` {`);\n lines.push(` property: '${property.name}',`);\n lines.push(` domain: '${this.inferDomain(property.name, [])}',`);\n lines.push(` allowedTokens: [${property.allows.map(t => `'${t}'`).join(', ')}],`);\n \n if (property.conflicts && property.conflicts.length > 0) {\n lines.push(` conflictsWith: [${property.conflicts.map(c => `'${c}'`).join(', ')}],`);\n }\n \n lines.push(` },`);\n }\n \n lines.push(` ]`);\n lines.push(`};`);\n \n return lines.join('\\n');\n }\n \n /**\n * Generate TypeScript code for StyleContractDefinition\n * @param ast - Contract AST\n * @returns TypeScript code\n */\n generateContractCode(ast: ContractAST): string {\n const lines: string[] = [];\n \n lines.push(`import type { StyleContractDefinition } from '../domain/types';`);\n lines.push('');\n lines.push(`export const ${ast.name}Contract: StyleContractDefinition = {`);\n \n for (const property of ast.properties) {\n const defaultValue = property.default || property.allows[0];\n lines.push(` ${property.name}: '${defaultValue}',`);\n }\n \n lines.push(`};`);\n \n return lines.join('\\n');\n }\n \n /**\n * Generate complete TypeScript file\n * @param ast - Contract AST\n * @returns TypeScript file content\n */\n generateTypeScriptFile(ast: ContractAST): string {\n const lines: string[] = [];\n \n lines.push(`/**`);\n lines.push(` * ${ast.name} Contract`);\n lines.push(` * Generated from Contract DSL`);\n lines.push(` */`);\n lines.push('');\n lines.push(this.generateConstitutionCode(ast));\n lines.push('');\n lines.push(this.generateContractCode(ast));\n \n return lines.join('\\n');\n }\n}","/**\n * Style Materialization Engine (SME) - Base Interface\n * \n * The executive layer of the constitutional architecture.\n * Converts semantic nodes from the judicial system into platform-specific output.\n * \n * Key Principles:\n * - Pure Execution: Only executes decisions, doesn't make them\n * - Platform Agnostic: Same semantic nodes → multiple platforms\n * - Deterministic: Same input → same output\n * - Stateless: No side effects, no mutations\n * - Layer Mapping: Domain → CSS layer mapping\n */\n\nimport type { SemanticNode } from '../domain/types';\n\n/**\n * MaterializationContext\n * Context for materialization.\n */\nexport interface MaterializationContext {\n readonly platform: 'web' | 'native' | 'pdf';\n readonly theme: 'light' | 'dark';\n readonly device: 'mobile' | 'tablet' | 'desktop';\n readonly outputFormat: 'class' | 'inline' | 'variable';\n}\n\n/**\n * MaterializationResult\n * Result of materialization.\n */\nexport interface MaterializationResult<T> {\n readonly output: T;\n readonly metadata: {\n readonly platform: string;\n readonly theme: string;\n readonly device: string;\n readonly format: string;\n readonly timestamp: string;\n };\n}\n\n/**\n * Materializer\n * Base interface for materializers.\n */\nexport interface Materializer<T> {\n /**\n * Materialize semantic nodes to platform-specific output\n * @param nodes - Resolved semantic nodes\n * @param context - Materialization context\n * @returns Materialization result\n */\n materialize(\n nodes: readonly SemanticNode[],\n context: MaterializationContext\n ): MaterializationResult<T>;\n}\n\n/**\n * MaterializationError\n * Error during materialization.\n */\nexport class MaterializationError extends Error {\n readonly platform: string;\n readonly semantic?: string;\n \n constructor(message: string, platform: string, semantic?: string) {\n super(message);\n this.name = 'MaterializationError';\n this.platform = platform;\n this.semantic = semantic;\n }\n}","/**\n * CSS Materializer\n * \n * Converts semantic nodes to CSS output for web platform.\n * \n * Responsibilities:\n * - Map semantic → CSS property\n * - Map token → CSS value\n * - Map domain → CSS layer\n * - Generate CSS classes or variables\n * - Support responsive variants\n * \n * Key Principles:\n * - DRY: Single materialization logic\n * - SOLID: Single responsibility\n * - YAGNI: Only materialize what's needed\n * - DDD: Domain-specific CSS generation\n */\n\nimport type { Materializer, MaterializationContext, MaterializationResult } from './Materializer';\nimport type { SemanticNode } from '../domain/types';\n\n/**\n * CSSOutput\n * CSS output format.\n */\nexport interface CSSOutput {\n readonly classes: string;\n readonly variables: string;\n readonly inline: string;\n}\n\n/**\n * SemanticToCSSMapping\n * Mapping from semantic to CSS property.\n */\ninterface SemanticToCSSMapping {\n readonly [semantic: string]: string;\n}\n\n/**\n * CSSMaterializer\n * Materializes semantic nodes to CSS output.\n */\nexport class CSSMaterializer implements Materializer<CSSOutput> {\n private readonly semanticToCSS: SemanticToCSSMapping;\n \n constructor() {\n this.semanticToCSS = this.buildSemanticToCSSMapping();\n }\n \n /**\n * Materialize semantic nodes to CSS output\n * @param nodes - Resolved semantic nodes\n * @param context - Materialization context\n * @returns CSS output\n */\n materialize(\n nodes: readonly SemanticNode[],\n context: MaterializationContext\n ): MaterializationResult<CSSOutput> {\n const classes: string[] = [];\n const variables: string[] = [];\n const inline: string[] = [];\n \n for (const node of nodes) {\n const cssProperty = this.mapSemanticToCSS(node.semantic);\n const cssValue = this.mapTokenToCSS(node.tokenRef, context.theme);\n \n // Generate based on output format\n switch (context.outputFormat) {\n case 'class':\n classes.push(this.generateCSSClass(node.semantic, cssProperty, cssValue));\n break;\n case 'variable':\n variables.push(this.generateCSSVariable(node.tokenRef, cssValue));\n break;\n case 'inline':\n inline.push(this.generateInlineStyle(cssProperty, cssValue));\n break;\n }\n }\n \n return {\n output: {\n classes: classes.join('\\n'),\n variables: variables.join('\\n'),\n inline: inline.join('; ')\n },\n metadata: {\n platform: context.platform,\n theme: context.theme,\n device: context.device,\n format: context.outputFormat,\n timestamp: new Date().toISOString()\n }\n };\n }\n \n /**\n * Build semantic to CSS mapping\n * @returns Mapping object\n */\n private buildSemanticToCSSMapping(): SemanticToCSSMapping {\n return {\n // Spacing\n 'spacing.padding.small': 'padding',\n 'spacing.padding.medium': 'padding',\n 'spacing.padding.large': 'padding',\n 'spacing.margin.small': 'margin',\n 'spacing.margin.medium': 'margin',\n 'spacing.margin.large': 'margin',\n 'spacing.gap.small': 'gap',\n 'spacing.gap.medium': 'gap',\n 'spacing.gap.large': 'gap',\n \n // Color\n 'color.background.primary': 'background-color',\n 'color.background.secondary': 'background-color',\n 'color.background.tertiary': 'background-color',\n 'color.text.primary': 'color',\n 'color.text.secondary': 'color',\n 'color.text.tertiary': 'color',\n 'color.border.primary': 'border-color',\n 'color.border.secondary': 'border-color',\n \n // Typography\n 'typography.size.small': 'font-size',\n 'typography.size.base': 'font-size',\n 'typography.size.large': 'font-size',\n 'typography.weight.light': 'font-weight',\n 'typography.weight.normal': 'font-weight',\n 'typography.weight.bold': 'font-weight',\n 'typography.line-height.tight': 'line-height',\n 'typography.line-height.normal': 'line-height',\n 'typography.line-height.relaxed': 'line-height',\n \n // Effect\n 'effect.shadow.small': 'box-shadow',\n 'effect.shadow.medium': 'box-shadow',\n 'effect.shadow.large': 'box-shadow',\n 'effect.radius.small': 'border-radius',\n 'effect.radius.medium': 'border-radius',\n 'effect.radius.large': 'border-radius',\n 'effect.opacity.low': 'opacity',\n 'effect.opacity.medium': 'opacity',\n 'effect.opacity.high': 'opacity'\n };\n }\n \n /**\n * Map semantic to CSS property\n * @param semantic - Semantic string\n * @returns CSS property\n */\n private mapSemanticToCSS(semantic: string): string {\n const cssProperty = this.semanticToCSS[semantic];\n \n if (!cssProperty) {\n // Fallback: extract last part of semantic\n const parts = semantic.split('.');\n const lastPart = parts[parts.length - 1];\n \n // Map common patterns\n if (lastPart === 'small' || lastPart === 'medium' || lastPart === 'large') {\n return parts[parts.length - 2]; // e.g., padding, margin\n }\n \n return lastPart;\n }\n \n return cssProperty;\n }\n \n /**\n * Map token to CSS value\n * @param tokenRef - Token reference\n * @param theme - Theme\n * @returns CSS value\n */\n private mapTokenToCSS(tokenRef: string, theme: string): string {\n // In a real implementation, this would resolve the token from a token registry\n // For now, we'll use CSS variables as the default approach\n \n // Convert token reference to CSS variable name\n const cssVarName = tokenRef.replace(/\\./g, '-');\n \n // Add theme suffix if dark mode\n if (theme === 'dark') {\n return `var(--${cssVarName}-dark)`;\n }\n \n return `var(--${cssVarName})`;\n }\n \n /**\n * Generate CSS class\n * @param semantic - Semantic string\n * @param property - CSS property\n * @param value - CSS value\n * @returns CSS class string\n */\n private generateCSSClass(semantic: string, property: string, value: string): string {\n // Generate class name from semantic\n const className = this.generateClassName(semantic);\n \n return `.${className} { ${property}: ${value}; }`;\n }\n \n /**\n * Generate CSS variable\n * @param tokenRef - Token reference\n * @param value - CSS value\n * @returns CSS variable string\n */\n private generateCSSVariable(tokenRef: string, value: string): string {\n const varName = tokenRef.replace(/\\./g, '-');\n \n return `--${varName}: ${value};`;\n }\n \n /**\n * Generate inline style\n * @param property - CSS property\n * @param value - CSS value\n * @returns Inline style string\n */\n private generateInlineStyle(property: string, value: string): string {\n return `${property}: ${value}`;\n }\n \n /**\n * Generate class name from semantic\n * @param semantic - Semantic string\n * @returns Class name\n */\n private generateClassName(semantic: string): string {\n // Convert semantic to kebab-case class name\n return semantic\n .replace(/\\./g, '-')\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .toLowerCase();\n }\n}","/**\n * React Native Materializer\n * \n * Converts semantic nodes to React Native style objects.\n * \n * Responsibilities:\n * - Map semantic → RN property\n * - Map token → RN value\n * - Handle platform-specific differences\n * - Generate RN style objects\n * \n * Key Principles:\n * - DRY: Single materialization logic\n * - SOLID: Single responsibility\n * - YAGNI: Only materialize what's needed\n * - DDD: Domain-specific RN style generation\n */\n\nimport type { Materializer, MaterializationContext, MaterializationResult } from './Materializer';\nimport type { SemanticNode } from '../domain/types';\n\n/**\n * RNStyle\n * React Native style object.\n */\nexport type RNStyle = Record<string, string | number>;\n\n/**\n * SemanticToRNMapping\n * Mapping from semantic to RN property.\n */\ninterface SemanticToRNMapping {\n readonly [semantic: string]: string;\n}\n\n/**\n * RNMaterializer\n * Materializes semantic nodes to React Native style objects.\n */\nexport class RNMaterializer implements Materializer<RNStyle> {\n private readonly semanticToRN: SemanticToRNMapping;\n \n constructor() {\n this.semanticToRN = this.buildSemanticToRNMapping();\n }\n \n /**\n * Materialize semantic nodes to RN style\n * @param nodes - Resolved semantic nodes\n * @param context - Materialization context\n * @returns RN style object\n */\n materialize(\n nodes: readonly SemanticNode[],\n context: MaterializationContext\n ): MaterializationResult<RNStyle> {\n const style: RNStyle = {};\n \n for (const node of nodes) {\n const rnProperty = this.mapSemanticToRN(node.semantic);\n const rnValue = this.mapTokenToRN(node.tokenRef, context.theme);\n \n style[rnProperty] = rnValue;\n }\n \n return {\n output: style,\n metadata: {\n platform: context.platform,\n theme: context.theme,\n device: context.device,\n format: context.outputFormat,\n timestamp: new Date().toISOString()\n }\n };\n }\n \n /**\n * Build semantic to RN mapping\n * @returns Mapping object\n */\n private buildSemanticToRNMapping(): SemanticToRNMapping {\n return {\n // Spacing\n 'spacing.padding.small': 'padding',\n 'spacing.padding.medium': 'padding',\n 'spacing.padding.large': 'padding',\n 'spacing.margin.small': 'margin',\n 'spacing.margin.medium': 'margin',\n 'spacing.margin.large': 'margin',\n 'spacing.gap.small': 'gap',\n 'spacing.gap.medium': 'gap',\n 'spacing.gap.large': 'gap',\n \n // Color\n 'color.background.primary': 'backgroundColor',\n 'color.background.secondary': 'backgroundColor',\n 'color.background.tertiary': 'backgroundColor',\n 'color.text.primary': 'color',\n 'color.text.secondary': 'color',\n 'color.text.tertiary': 'color',\n 'color.border.primary': 'borderColor',\n 'color.border.secondary': 'borderColor',\n \n // Typography\n 'typography.size.small': 'fontSize',\n 'typography.size.base': 'fontSize',\n 'typography.size.large': 'fontSize',\n 'typography.weight.light': 'fontWeight',\n 'typography.weight.normal': 'fontWeight',\n 'typography.weight.bold': 'fontWeight',\n 'typography.line-height.tight': 'lineHeight',\n 'typography.line-height.normal': 'lineHeight',\n 'typography.line-height.relaxed': 'lineHeight',\n \n // Effect\n 'effect.shadow.small': 'shadow...',\n 'effect.shadow.medium': 'shadow...',\n 'effect.shadow.large': 'shadow...',\n 'effect.radius.small': 'borderRadius',\n 'effect.radius.medium': 'borderRadius',\n 'effect.radius.large': 'borderRadius',\n 'effect.opacity.low': 'opacity',\n 'effect.opacity.medium': 'opacity',\n 'effect.opacity.high': 'opacity'\n };\n }\n \n /**\n * Map semantic to RN property\n * @param semantic - Semantic string\n * @returns RN property\n */\n private mapSemanticToRN(semantic: string): string {\n const rnProperty = this.semanticToRN[semantic];\n \n if (!rnProperty) {\n // Fallback: extract last part of semantic\n const parts = semantic.split('.');\n const lastPart = parts[parts.length - 1];\n \n // Map common patterns\n if (lastPart === 'small' || lastPart === 'medium' || lastPart === 'large') {\n return parts[parts.length - 2]; // e.g., padding, margin\n }\n \n // Convert to camelCase\n return this.toCamelCase(lastPart);\n }\n \n return rnProperty;\n }\n \n /**\n * Map token to RN value\n * @param tokenRef - Token reference\n * @param theme - Theme\n * @returns RN value\n */\n private mapTokenToRN(tokenRef: string, theme: string): string | number {\n // In a real implementation, this would resolve the token from a token registry\n // For now, we'll return the token reference as a string\n \n // Add theme suffix if dark mode\n if (theme === 'dark') {\n return `${tokenRef}-dark`;\n }\n \n return tokenRef;\n }\n \n /**\n * Convert string to camelCase\n * @param str - String to convert\n * @returns camelCase string\n */\n private toCamelCase(str: string): string {\n return str\n .replace(/-([a-z])/g, (_, letter) => letter.toUpperCase())\n .replace(/^[A-Z]/, letter => letter.toLowerCase());\n }\n}","/**\n * PDF Materializer\n * \n * Converts semantic nodes to PDF style objects.\n * \n * Responsibilities:\n * - Map semantic → PDF property\n * - Map token → PDF value\n * - Handle PDF-specific units\n * - Generate PDF style objects\n * \n * Key Principles:\n * - DRY: Single materialization logic\n * - SOLID: Single responsibility\n * - YAGNI: Only materialize what's needed\n * - DDD: Domain-specific PDF style generation\n */\n\nimport type { Materializer, MaterializationContext, MaterializationResult } from './Materializer';\nimport type { SemanticNode } from '../domain/types';\n\n/**\n * PDFStyle\n * PDF style object.\n */\nexport type PDFStyle = Record<string, string | number>;\n\n/**\n * SemanticToPDFMapping\n * Mapping from semantic to PDF property.\n */\ninterface SemanticToPDFMapping {\n readonly [semantic: string]: string;\n}\n\n/**\n * PDFMaterializer\n * Materializes semantic nodes to PDF style objects.\n */\nexport class PDFMaterializer implements Materializer<PDFStyle> {\n private readonly semanticToPDF: SemanticToPDFMapping;\n \n constructor() {\n this.semanticToPDF = this.buildSemanticToPDFMapping();\n }\n \n /**\n * Materialize semantic nodes to PDF style\n * @param nodes - Resolved semantic nodes\n * @param context - Materialization context\n * @returns PDF style object\n */\n materialize(\n nodes: readonly SemanticNode[],\n context: MaterializationContext\n ): MaterializationResult<PDFStyle> {\n const style: PDFStyle = {};\n \n for (const node of nodes) {\n const pdfProperty = this.mapSemanticToPDF(node.semantic);\n const pdfValue = this.mapTokenToPDF(node.tokenRef, context.theme);\n \n style[pdfProperty] = pdfValue;\n }\n \n return {\n output: style,\n metadata: {\n platform: context.platform,\n theme: context.theme,\n device: context.device,\n format: context.outputFormat,\n timestamp: new Date().toISOString()\n }\n };\n }\n \n /**\n * Build semantic to PDF mapping\n * @returns Mapping object\n */\n private buildSemanticToPDFMapping(): SemanticToPDFMapping {\n return {\n // Spacing\n 'spacing.padding.small': 'padding',\n 'spacing.padding.medium': 'padding',\n 'spacing.padding.large': 'padding',\n 'spacing.margin.small': 'margin',\n 'spacing.margin.medium': 'margin',\n 'spacing.margin.large': 'margin',\n 'spacing.gap.small': 'gap',\n 'spacing.gap.medium': 'gap',\n 'spacing.gap.large': 'gap',\n \n // Color\n 'color.background.primary': 'fillColor',\n 'color.background.secondary': 'fillColor',\n 'color.background.tertiary': 'fillColor',\n 'color.text.primary': 'fillColor',\n 'color.text.secondary': 'fillColor',\n 'color.text.tertiary': 'fillColor',\n 'color.border.primary': 'borderColor',\n 'color.border.secondary': 'borderColor',\n \n // Typography\n 'typography.size.small': 'fontSize',\n 'typography.size.base': 'fontSize',\n 'typography.size.large': 'fontSize',\n 'typography.weight.light': 'fontWeight',\n 'typography.weight.normal': 'fontWeight',\n 'typography.weight.bold': 'fontWeight',\n 'typography.line-height.tight': 'lineHeight',\n 'typography.line-height.normal': 'lineHeight',\n 'typography.line-height.relaxed': 'lineHeight',\n \n // Effect\n 'effect.shadow.small': 'shadow...',\n 'effect.shadow.medium': 'shadow...',\n 'effect.shadow.large': 'shadow...',\n 'effect.radius.small': 'borderRadius',\n 'effect.radius.medium': 'borderRadius',\n 'effect.radius.large': 'borderRadius',\n 'effect.opacity.low': 'opacity',\n 'effect.opacity.medium': 'opacity',\n 'effect.opacity.high': 'opacity'\n };\n }\n \n /**\n * Map semantic to PDF property\n * @param semantic - Semantic string\n * @returns PDF property\n */\n private mapSemanticToPDF(semantic: string): string {\n const pdfProperty = this.semanticToPDF[semantic];\n \n if (!pdfProperty) {\n // Fallback: extract last part of semantic\n const parts = semantic.split('.');\n const lastPart = parts[parts.length - 1];\n \n // Map common patterns\n if (lastPart === 'small' || lastPart === 'medium' || lastPart === 'large') {\n return parts[parts.length - 2]; // e.g., padding, margin\n }\n \n // Convert to camelCase\n return this.toCamelCase(lastPart);\n }\n \n return pdfProperty;\n }\n \n /**\n * Map token to PDF value\n * @param tokenRef - Token reference\n * @param theme - Theme\n * @returns PDF value\n */\n private mapTokenToPDF(tokenRef: string, theme: string): string | number {\n // In a real implementation, this would resolve the token from a token registry\n // For now, we'll return the token reference as a string\n \n // Add theme suffix if dark mode\n if (theme === 'dark') {\n return `${tokenRef}-dark`;\n }\n \n return tokenRef;\n }\n \n /**\n * Convert string to camelCase\n * @param str - String to convert\n * @returns camelCase string\n */\n private toCamelCase(str: string): string {\n return str\n .replace(/-([a-z])/g, (_, letter) => letter.toUpperCase())\n .replace(/^[A-Z]/, letter => letter.toLowerCase());\n }\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACQO,IAAM,0BAAN,MAA6D;AAAA,EAGlE,YAAY,eAA+B;AACzC,SAAK,gBAAgB;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA,EAKA,SACE,UACA,SACA,MACA,SACuB;AACvB,QAAI,CAAC,KAAK,cAAc,SAAS,OAAO,GAAG;AACzC,aAAO;AAAA,QACL,MAAM;AAAA,QACN,SAAS,UAAU,OAAO;AAAA,QAC1B,UAAU;AAAA,QACV,UAAU,GAAG,QAAQ,IAAI,OAAO;AAAA,QAChC,SAAS,UAAU,EAAE,GAAG,QAAQ,IAAI;AAAA,MACtC;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,UAAkB;AAChB,WAAO;AAAA,EACT;AACF;;;ACnCO,IAAM,kBAAN,MAAqD;AAAA,EAG1D,YAAY,eAA+B;AACzC,SAAK,gBAAgB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AI,UAAU,QAAQ;AACpB,aAAO,GAAG,QAAQ;AAAA,IACpB;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOQ,YAAY,KAAqB;AACvC,WAAO,IACJ,QAAQ,aAAa,CAAC,GAAG,WAAW,OAAO,YAAY,CAAC,EACxD,QAAQ,UAAU,YAAU,OAAO,YAAY,CAAC;AAAA,EACrD;AACF;","names":["import_meta_architecture","ValidationError"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/data/tokens.ts","../../src/domain/registry/TokenRegistry.ts","../../src/domain/resolution/ThemeResolver.ts","../../src/domain/resolution/ContextBinder.ts","../../src/domain/resolution/CanonicalStyleGraph.ts","../../src/domain/governance/strategies/TokenExistenceValidator.ts","../../src/domain/governance/strategies/DomainValidator.ts","../../src/domain/governance/strategies/AllowedTokenValidator.ts","../../src/domain/resolution/StyleResolutionEngine.ts","../../src/domain/governance/DefaultViolationHandlers.ts","../../src/domain/governance/ViolationEngine.ts","../../src/domain/factories/ContextFactory.ts","../../src/runtime/core/StyleContract.ts","../../src/runtime/react/StyleProvider.tsx","../../src/runtime/adapters/WebPlatformAdapter.ts","../../src/runtime/adapters/NativePlatformAdapter.ts","../../src/adapter/meta-architecture/rules/MaseValidationRule.ts","../../src/adapter/meta-architecture/MasePlugin.ts","../../src/adapter/meta-architecture/errors/MaseValidationError.ts","../../src/adapter/meta-architecture/rules/MaseGovernanceRule.ts","../../src/adapter/meta-architecture/factories/CompliancePipelineFactory.ts","../../src/data/constitutions/CardConstitution.ts","../../src/data/constitutions/ButtonConstitution.ts","../../src/dsl/lexer/TokenizerError.ts","../../src/dsl/lexer/Tokenizer.ts","../../src/dsl/parser/ParserError.ts","../../src/dsl/parser/Parser.ts","../../src/dsl/validator/ValidationError.ts","../../src/dsl/validator/Validator.ts","../../src/dsl/compiler/Compiler.ts","../../src/materializer/core/MaterializationError.ts","../../src/materializer/targets/CSSMaterializer.ts","../../src/materializer/targets/RNMaterializer.ts","../../src/materializer/targets/PDFMaterializer.ts"],"sourcesContent":["// Domain\nexport * from './domain';\n\n// Runtime\nexport * from './runtime';\n\n// Adapter\nexport * from './adapter';\n\n// Data\nexport * from './data/tokens';\nexport * from './data/constitutions';\n\n// DSL\nexport { ContractDSLTokenizer, ContractDSLParser, ContractDSLValidator, ContractDSLCompiler } from './dsl';\n\n// Materializer\nexport type { Materializer, MaterializationContext, MaterializationResult } from './materializer';\nexport { MaterializationError, CSSMaterializer, RNMaterializer, PDFMaterializer } from './materializer';\n","import type { Token } from '../domain';\n\n// 1. Token Registry (Mata Uang Negara)\nexport const TOKENS: Record<string, Token> = {\n // Colors - Intent based\n 'color.primary': { id: 'color.primary', domain: 'color', value: 'bg-blue-600' },\n 'color.secondary': { id: 'color.secondary', domain: 'color', value: 'bg-gray-600' },\n 'color.danger': { id: 'color.danger', domain: 'color', value: 'bg-red-600' },\n\n // Spacing - Scale based\n 'space.sm': { id: 'space.sm', domain: 'layout', value: 'p-2' },\n 'space.md': { id: 'space.md', domain: 'layout', value: 'p-4' },\n 'space.lg': { id: 'space.lg', domain: 'layout', value: 'p-6' },\n \n // Forbidden/Raw tokens (for demo)\n 'raw.hex': { id: 'raw.hex', domain: 'color', value: 'bg-[#123456]' }, // Illegal\n\n // Surface (Theme Aware!)\n 'surface.card': { \n id: 'surface.card', \n domain: 'color', \n value: {\n light: 'bg-white',\n dark: 'bg-slate-800'\n } \n },\n 'surface.ground': { \n id: 'surface.ground', \n domain: 'color', \n value: {\n light: 'bg-gray-50',\n dark: 'bg-slate-900'\n } \n },\n 'surface.paper': {\n id: 'surface.paper',\n domain: 'color',\n value: {\n light: 'bg-white',\n dark: 'bg-slate-700'\n }\n },\n\n // Text (Theme Aware!)\n 'text.light': { \n id: 'text.light', \n domain: 'color', \n value: {\n light: 'text-white',\n dark: 'text-gray-100'\n }\n },\n 'text.dark': { \n id: 'text.dark', \n domain: 'color', \n value: {\n light: 'text-gray-900',\n dark: 'text-white'\n }\n },\n 'text.primary': {\n id: 'text.primary',\n domain: 'color',\n value: {\n light: 'text-gray-900',\n dark: 'text-gray-50'\n }\n },\n 'text.secondary': {\n id: 'text.secondary',\n domain: 'color',\n value: {\n light: 'text-gray-500',\n dark: 'text-gray-400'\n }\n },\n 'shadow.sm': { id: 'shadow.sm', domain: 'effect', value: 'shadow-sm' },\n 'shadow.md': { id: 'shadow.md', domain: 'effect', value: 'shadow-md' },\n 'shadow.lg': { id: 'shadow.lg', domain: 'effect', value: 'shadow-lg' },\n \n // Radius\n 'radius.md': { id: 'radius.md', domain: 'layout', value: 'rounded-md' },\n 'radius.lg': { id: 'radius.lg', domain: 'layout', value: 'rounded-lg' },\n};\n","import type { ITokenRegistry } from './ITokenRegistry';\nimport type { Token } from '../types';\nimport { TOKENS } from '../../data/tokens';\n\n/**\n * TokenRegistry\n * Concrete implementation of ITokenRegistry.\n * Provides immutable access to token definitions.\n */\nexport class TokenRegistry implements ITokenRegistry {\n private readonly tokens: Readonly<Record<string, Token>>;\n \n constructor(tokens: Record<string, Token> = TOKENS) {\n // Freeze tokens to ensure immutability\n this.tokens = Object.freeze({ ...tokens });\n }\n \n /**\n * Get token by ID\n * @throws Error if token not found\n */\n getToken(id: string): Token {\n const token = this.tokens[id];\n if (!token) {\n throw new Error(`Token '${id}' not found in registry`);\n }\n return token;\n }\n \n /**\n * Check if token exists\n */\n hasToken(id: string): boolean {\n return id in this.tokens;\n }\n \n /**\n * Get all tokens (immutable)\n */\n getAllTokens(): Readonly<Record<string, Token>> {\n return this.tokens;\n }\n}","import type { IThemeResolver } from './IThemeResolver';\nimport type { StyleTheme, ThemeValue } from '../types';\n\n/**\n * ThemeResolver\n * Concrete implementation of IThemeResolver.\n * Handles theme-aware value resolution.\n */\nexport class ThemeResolver implements IThemeResolver {\n /**\n * Resolve theme value based on current theme\n */\n resolve(value: ThemeValue, theme: StyleTheme): string {\n // If value is a simple string, return it directly\n if (typeof value === 'string') {\n return value;\n }\n \n // If value is theme-aware object, resolve based on theme\n if (theme in value) {\n return value[theme];\n }\n \n // Theme not found in value\n throw new Error(`Theme '${theme}' not found in value. Available themes: ${Object.keys(value).join(', ')}`);\n }\n \n /**\n * Get current theme from context\n * Defaults to 'light' if not specified\n */\n getCurrentTheme(context?: { theme?: StyleTheme }): StyleTheme {\n return context?.theme || 'light';\n }\n}","import type { StyleContext, StyleDomain, StyleBreakpoint, StyleTheme } from '../types';\nimport type { CanonicalStyleGraph, CSGNode } from './CanonicalStyleGraph';\n\n/**\n * BoundContext\n * Result of context binding.\n * Contains active contracts and disabled variants for a specific context.\n */\nexport interface BoundContext {\n readonly context: StyleContext;\n readonly activeContracts: Set<string>;\n readonly disabledVariants: Map<string, string[]>;\n readonly graphView: ReadonlyArray<CSGNode>;\n}\n\n/**\n * ContextBindingRule\n * Rule for context-aware contract activation.\n */\nexport interface ContextBindingRule {\n readonly contract: string;\n readonly property: string;\n readonly condition: (context: StyleContext) => boolean;\n readonly disabledVariants?: string[];\n}\n\n/**\n * ContextBinder\n * \n * Binds style contracts to specific contexts (device, theme, platform).\n * Creates immutable views of the Canonical Style Graph.\n * \n * Responsibilities:\n * - Determine which contracts are active in a context\n * - Determine which variants are disabled in a context\n * - Create immutable view of the graph\n * - Enable parallel context evaluation\n * \n * Key Principles:\n * - IMMUTABLE: Never mutates the original graph\n * - VIEW-BASED: Creates views, not modifications\n * - COMPOSABLE: Contexts can be combined\n * - AUDITABLE: All decisions are traceable\n */\nexport class ContextBinder {\n private readonly graph: CanonicalStyleGraph;\n private readonly bindingRules: ContextBindingRule[];\n \n constructor(\n graph: CanonicalStyleGraph,\n bindingRules: ContextBindingRule[] = []\n ) {\n this.graph = graph;\n this.bindingRules = bindingRules;\n }\n \n /**\n * Bind graph to a specific context\n * @param context - Style context to bind to\n * @returns Bound context with active contracts and disabled variants\n */\n bind(context: StyleContext): BoundContext {\n const activeContracts = new Set<string>();\n const disabledVariants = new Map<string, string[]>();\n \n // Process each binding rule\n for (const rule of this.bindingRules) {\n // Check if contract is active in this context\n const isActive = rule.condition(context);\n \n if (isActive) {\n activeContracts.add(rule.contract);\n \n // Add disabled variants if specified\n if (rule.disabledVariants && rule.disabledVariants.length > 0) {\n disabledVariants.set(rule.contract, rule.disabledVariants);\n }\n }\n }\n \n // Create graph view (immutable)\n const graphView = this.createGraphView(activeContracts, disabledVariants);\n \n return {\n context,\n activeContracts,\n disabledVariants,\n graphView\n };\n }\n \n /**\n * Bind graph to multiple contexts\n * @param contexts - Array of style contexts\n * @returns Array of bound contexts\n */\n bindMultiple(contexts: ReadonlyArray<StyleContext>): ReadonlyArray<BoundContext> {\n return contexts.map(ctx => this.bind(ctx));\n }\n \n /**\n * Create immutable view of the graph\n * @param activeContracts - Set of active contract names\n * @param disabledVariants - Map of disabled variants per contract\n * @returns Immutable array of nodes\n */\n private createGraphView(\n activeContracts: Set<string>,\n disabledVariants: Map<string, string[]>\n ): ReadonlyArray<CSGNode> {\n const allNodes = this.graph.getAllNodes();\n const view: CSGNode[] = [];\n \n for (const node of allNodes) {\n // Check if node's contract is active\n if (!activeContracts.has(node.contractRef)) {\n continue; // Skip inactive contracts\n }\n \n // Check if node's variant is disabled\n const disabledForContract = disabledVariants.get(node.contractRef);\n if (disabledForContract && disabledForContract.length > 0) {\n // Extract variant from node ID (e.g., \"Button.padding.md\" -> \"md\")\n const variant = this.extractVariant(node.id);\n if (variant && disabledForContract.includes(variant)) {\n continue; // Skip disabled variants\n }\n }\n \n // Add node to view\n view.push(node);\n }\n \n return Object.freeze(view);\n }\n \n /**\n * Extract variant from node ID\n * @param nodeId - Node ID (e.g., \"Button.padding.md\")\n * @returns Variant (e.g., \"md\") or null\n */\n private extractVariant(nodeId: string): string | null {\n // Node ID format: \"{contract}.{property}.{variant}\"\n const parts = nodeId.split('.');\n if (parts.length >= 3) {\n return parts[2];\n }\n return null;\n }\n \n /**\n * Add a binding rule\n * @param rule - Context binding rule\n */\n addBindingRule(rule: ContextBindingRule): void {\n this.bindingRules.push(rule);\n }\n \n /**\n * Remove a binding rule\n * @param contract - Contract name\n * @param property - Property name\n */\n removeBindingRule(contract: string, property: string): void {\n const index = this.bindingRules.findIndex(\n r => r.contract === contract && r.property === property\n );\n if (index !== -1) {\n this.bindingRules.splice(index, 1);\n }\n }\n \n /**\n * Get all binding rules\n * @returns Immutable array of binding rules\n */\n getBindingRules(): ReadonlyArray<ContextBindingRule> {\n return Object.freeze([...this.bindingRules]);\n }\n \n /**\n * Create default binding rules for common scenarios\n * @returns Array of default binding rules\n */\n static createDefaultRules(): ContextBindingRule[] {\n return [\n // Mobile: Disable large spacing\n {\n contract: 'Card',\n property: 'padding',\n condition: (ctx) => ctx.device === 'mobile',\n disabledVariants: ['lg', 'xl', '2xl']\n },\n // Mobile: Disable large shadows\n {\n contract: 'Card',\n property: 'shadow',\n condition: (ctx) => ctx.device === 'mobile',\n disabledVariants: ['lg', 'xl']\n },\n // Dark mode: Disable light surfaces\n {\n contract: 'Card',\n property: 'background',\n condition: (ctx) => ctx.theme === 'dark',\n disabledVariants: ['surface.white', 'surface.gray']\n },\n // Reduced motion: Disable animations\n {\n contract: 'Button',\n property: 'effect',\n condition: (ctx) => ctx.state === 'disabled',\n disabledVariants: ['animate', 'transition']\n }\n ];\n }\n}","import type { ComponentConstitution, StyleRule, StyleDomain } from '../types';\nimport type { ITokenRegistry } from '../registry/ITokenRegistry';\n\n/**\n * CSGNode\n * Node in the Canonical Style Graph.\n * Represents a single style rule with its dependencies.\n */\nexport interface CSGNode {\n readonly id: string;\n readonly contractRef: string;\n readonly property: string;\n readonly domain: StyleDomain;\n readonly dependencies: CSGEdge[];\n readonly constraints: ConstraintRule[];\n}\n\n/**\n * CSGEdge\n * Edge in the Canonical Style Graph.\n * Represents a dependency between nodes.\n */\nexport interface CSGEdge {\n readonly from: string;\n readonly to: string;\n readonly type: 'token' | 'contract' | 'constraint';\n}\n\n/**\n * ConstraintRule\n * Constraint definition for a style rule.\n */\nexport interface ConstraintRule {\n readonly type: 'min' | 'max' | 'range' | 'enum' | 'custom';\n readonly value?: any;\n readonly allowed?: any[];\n readonly message?: string;\n}\n\n/**\n * GraphValidation\n * Result of graph validation.\n */\nexport interface GraphValidation {\n readonly isValid: boolean;\n readonly cycles: string[][];\n readonly errors: string[];\n}\n\n/**\n * CanonicalStyleGraph (CSG)\n * \n * The Canonical Style Graph is the immutable constitution of the style system.\n * It represents all style contracts and their dependencies as a directed graph.\n * \n * Responsibilities:\n * - Build dependency graph from contracts\n * - Detect circular dependencies\n * - Provide topological sort for resolution order\n * - Enable efficient lookups\n * \n * Key Principles:\n * - IMMUTABLE: Never mutated after creation\n * - READ-ONLY: Context creates views, not modifications\n * - AUDITABLE: All changes are traceable\n */\nexport class CanonicalStyleGraph {\n private readonly nodes: Map<string, CSGNode>;\n private readonly edges: CSGEdge[];\n private readonly constitutionsMap: Map<string, ComponentConstitution>;\n private readonly tokenRegistry: ITokenRegistry;\n \n constructor(\n contracts: ComponentConstitution[],\n tokenRegistry: ITokenRegistry\n ) {\n this.nodes = new Map();\n this.edges = [];\n this.constitutionsMap = new Map();\n this.tokenRegistry = tokenRegistry;\n \n // Build graph from contracts\n this.buildGraph(contracts);\n \n // Validate graph\n const validation = this.validateGraph();\n if (!validation.isValid) {\n throw new Error(\n `Invalid Canonical Style Graph: ${validation.errors.join(', ')}`\n );\n }\n }\n \n /**\n * Build dependency graph from contracts\n */\n private buildGraph(contracts: ComponentConstitution[]): void {\n for (const constitution of contracts) {\n // Store constitution reference\n this.constitutionsMap.set(constitution.componentName, constitution);\n \n // Create nodes for each rule\n for (const rule of constitution.rules) {\n const nodeId = `${constitution.componentName}.${rule.property}`;\n \n const node: CSGNode = {\n id: nodeId,\n contractRef: constitution.componentName,\n property: rule.property,\n domain: rule.domain,\n dependencies: [],\n constraints: this.extractConstraints(rule)\n };\n \n this.nodes.set(nodeId, node);\n \n // Add edges for dependencies\n this.addDependencyEdges(node, rule);\n }\n }\n }\n \n /**\n * Extract constraints from a rule\n */\n private extractConstraints(rule: StyleRule): ConstraintRule[] {\n const constraints: ConstraintRule[] = [];\n \n // Extract allowed tokens as enum constraint\n if (rule.allowedTokens && rule.allowedTokens.length > 0) {\n constraints.push({\n type: 'enum',\n allowed: [...rule.allowedTokens],\n message: `Must be one of: ${rule.allowedTokens.join(', ')}`\n });\n }\n \n // Extract conflicts as custom constraints\n if (rule.conflictsWith && rule.conflictsWith.length > 0) {\n constraints.push({\n type: 'custom',\n value: rule.conflictsWith,\n message: `Cannot be used with: ${rule.conflictsWith.join(', ')}`\n });\n }\n \n return constraints;\n }\n \n /**\n * Add dependency edges for a node\n */\n private addDependencyEdges(node: CSGNode, rule: StyleRule): void {\n // Add edges for allowed tokens (token dependencies)\n for (const tokenId of rule.allowedTokens) {\n if (this.tokenRegistry.hasToken(tokenId)) {\n const token = this.tokenRegistry.getToken(tokenId);\n \n this.edges.push({\n from: node.id,\n to: token.id,\n type: 'token'\n });\n \n node.dependencies.push({\n from: node.id,\n to: token.id,\n type: 'token'\n });\n }\n }\n \n // Add edges for conflicts (constraint dependencies)\n if (rule.conflictsWith) {\n for (const conflictProperty of rule.conflictsWith) {\n const conflictNodeId = `${node.contractRef}.${conflictProperty}`;\n \n this.edges.push({\n from: node.id,\n to: conflictNodeId,\n type: 'constraint'\n });\n \n node.dependencies.push({\n from: node.id,\n to: conflictNodeId,\n type: 'constraint'\n });\n }\n }\n }\n \n /**\n * Validate graph for circular dependencies\n */\n private validateGraph(): GraphValidation {\n const errors: string[] = [];\n const cycles: string[][] = [];\n \n // Detect cycles using DFS\n const visited = new Set<string>();\n const recursionStack = new Set<string>();\n \n for (const nodeId of this.nodes.keys()) {\n if (!visited.has(nodeId)) {\n const cycle = this.detectCycle(nodeId, visited, recursionStack);\n if (cycle) {\n cycles.push(cycle);\n }\n }\n }\n \n if (cycles.length > 0) {\n errors.push(`Circular dependencies detected: ${cycles.map(c => c.join(' → ')).join(', ')}`);\n }\n \n return {\n isValid: errors.length === 0,\n cycles,\n errors\n };\n }\n \n /**\n * Detect cycle starting from a node using DFS\n */\n private detectCycle(\n nodeId: string,\n visited: Set<string>,\n recursionStack: Set<string>\n ): string[] | null {\n visited.add(nodeId);\n recursionStack.add(nodeId);\n \n const node = this.nodes.get(nodeId);\n if (!node) return null;\n \n for (const edge of node.dependencies) {\n const neighborId = edge.to;\n \n if (!visited.has(neighborId)) {\n const cycle = this.detectCycle(neighborId, visited, recursionStack);\n if (cycle) return cycle;\n } else if (recursionStack.has(neighborId)) {\n // Found a cycle\n return this.buildCyclePath(neighborId, recursionStack);\n }\n }\n \n recursionStack.delete(nodeId);\n return null;\n }\n \n /**\n * Build cycle path from recursion stack\n */\n private buildCyclePath(startNodeId: string, stack: Set<string>): string[] {\n const path: string[] = [startNodeId];\n \n // Reconstruct path from stack\n for (const nodeId of stack) {\n path.push(nodeId);\n if (nodeId === startNodeId) break;\n }\n \n return path;\n }\n \n /**\n * Get resolution order using topological sort\n * @returns Array of node IDs in resolution order\n */\n getResolutionOrder(): string[] {\n const visited = new Set<string>();\n const result: string[] = [];\n \n // Kahn's algorithm for topological sort\n const inDegree = new Map<string, number>();\n \n // Calculate in-degrees\n for (const [nodeId] of this.nodes.keys()) {\n inDegree.set(nodeId, 0);\n }\n \n for (const edge of this.edges) {\n const current = inDegree.get(edge.to) || 0;\n inDegree.set(edge.to, current + 1);\n }\n \n // Process nodes with in-degree 0\n const queue: string[] = [];\n for (const [nodeId, degree] of inDegree.entries()) {\n if (degree === 0) {\n queue.push(nodeId);\n }\n }\n \n while (queue.length > 0) {\n const nodeId = queue.shift()!;\n result.push(nodeId);\n visited.add(nodeId);\n \n // Reduce in-degree for neighbors\n const node = this.nodes.get(nodeId);\n if (node) {\n for (const edge of node.dependencies) {\n const neighborId = edge.to;\n const current = inDegree.get(neighborId) || 0;\n inDegree.set(neighborId, current - 1);\n \n if (current - 1 === 0) {\n queue.push(neighborId);\n }\n }\n }\n }\n \n // Check if all nodes were visited (no cycles)\n if (visited.size !== this.nodes.size) {\n throw new Error('Cannot resolve order: graph contains cycles');\n }\n \n return result;\n }\n \n /**\n * Get node by ID\n */\n getNode(id: string): CSGNode | undefined {\n return this.nodes.get(id);\n }\n \n /**\n * Get all nodes\n */\n getAllNodes(): ReadonlyArray<CSGNode> {\n return Array.from(this.nodes.values());\n }\n \n /**\n * Get all edges\n */\n getAllEdges(): ReadonlyArray<CSGEdge> {\n return this.edges;\n }\n \n /**\n * Get constitution by component name\n */\n getConstitution(componentName: string): ComponentConstitution | undefined {\n return this.constitutionsMap.get(componentName);\n }\n \n /**\n * Get all constitutions\n */\n getAllConstitutions(): ReadonlyArray<ComponentConstitution> {\n return Array.from(this.constitutionsMap.values());\n }\n \n /**\n * Check if graph is empty\n */\n isEmpty(): boolean {\n return this.nodes.size === 0;\n }\n \n /**\n * Get graph size\n */\n size(): number {\n return this.nodes.size;\n }\n}","import type { IValidationStrategy } from '../IValidationStrategy';\nimport type { StyleRule, StyleContext, StyleViolation } from '../../types';\nimport type { ITokenRegistry } from '../../registry/ITokenRegistry';\n\n/**\n * TokenExistenceValidator\n * Validates that a token exists in the registry.\n */\nexport class TokenExistenceValidator implements IValidationStrategy {\n private readonly tokenRegistry: ITokenRegistry;\n \n constructor(tokenRegistry: ITokenRegistry) {\n this.tokenRegistry = tokenRegistry;\n }\n \n /**\n * Validate that token exists\n */\n validate(\n property: string,\n tokenId: string,\n rule: StyleRule,\n context?: StyleContext\n ): StyleViolation | null {\n if (!this.tokenRegistry.hasToken(tokenId)) {\n return {\n rule: 'invalid-token',\n message: `Token '${tokenId}' does not exist in Registry.`,\n severity: 'error',\n semantic: `${property}.${tokenId}`,\n context: context ? { ...context } : undefined\n };\n }\n \n return null;\n }\n \n /**\n * Get strategy name\n */\n getName(): string {\n return 'TokenExistenceValidator';\n }\n}","import type { IValidationStrategy } from '../IValidationStrategy';\nimport type { StyleRule, StyleContext, StyleViolation } from '../../types';\nimport type { ITokenRegistry } from '../../registry/ITokenRegistry';\n\n/**\n * DomainValidator\n * Validates that token domain matches rule domain.\n */\nexport class DomainValidator implements IValidationStrategy {\n private readonly tokenRegistry: ITokenRegistry;\n \n constructor(tokenRegistry: ITokenRegistry) {\n this.tokenRegistry = tokenRegistry;\n }\n \n /**\n * Validate that token domain matches rule domain\n */\n validate(\n property: string,\n tokenId: string,\n rule: StyleRule,\n context?: StyleContext\n ): StyleViolation | null {\n const token = this.tokenRegistry.getToken(tokenId);\n \n if (token.domain !== rule.domain) {\n return {\n rule: 'domain-violation',\n message: `Property '${property}' expects domain '${rule.domain}', but got token from '${token.domain}'.`,\n severity: 'error',\n semantic: `${property}.${tokenId}`,\n context: context ? { ...context } : undefined\n };\n }\n \n return null;\n }\n \n /**\n * Get strategy name\n */\n getName(): string {\n return 'DomainValidator';\n }\n}","import type { IValidationStrategy } from '../IValidationStrategy';\nimport type { StyleRule, StyleContext, StyleViolation } from '../../types';\n\n/**\n * AllowedTokenValidator\n * Validates that token is in the allowed list for a rule.\n */\nexport class AllowedTokenValidator implements IValidationStrategy {\n /**\n * Validate that token is allowed\n */\n validate(\n property: string,\n tokenId: string,\n rule: StyleRule,\n context?: StyleContext\n ): StyleViolation | null {\n if (!rule.allowedTokens.includes(tokenId)) {\n return {\n rule: 'illegal-token-usage',\n message: `Token '${tokenId}' is NOT allowed for property '${property}'. Allowed: ${rule.allowedTokens.join(', ')}`,\n severity: 'error',\n semantic: `${property}.${tokenId}`,\n context: context ? { ...context } : undefined\n };\n }\n \n return null;\n }\n \n /**\n * Get strategy name\n */\n getName(): string {\n return 'AllowedTokenValidator';\n }\n}","import type { \n StyleContractDefinition, \n ComponentConstitution, \n StyleResolutionResult, \n StyleContext, \n StyleViolation, \n SemanticNode,\n StyleBreakpoint\n} from '../types';\nimport type { ITokenRegistry } from '../registry/ITokenRegistry';\nimport type { IThemeResolver } from './IThemeResolver';\nimport type { IValidationStrategy } from '../governance/IValidationStrategy';\nimport { TokenExistenceValidator } from '../governance/strategies/TokenExistenceValidator';\nimport { DomainValidator } from '../governance/strategies/DomainValidator';\nimport { AllowedTokenValidator } from '../governance/strategies/AllowedTokenValidator';\n\n/**\n * StyleResolutionEngine (REFACTORED)\n * \n * Refactored to follow SOLID principles:\n * - SRP: Only handles resolution logic\n * - DIP: Depends on abstractions (ITokenRegistry, IThemeResolver)\n * - OCP: Extensible via validation strategies\n * \n * Responsibilities:\n * - Contract validation against constitution\n * - Semantic node generation\n */\nexport class StyleResolutionEngine {\n private readonly tokenRegistry: ITokenRegistry;\n private readonly themeResolver: IThemeResolver;\n private readonly validators: ReadonlyArray<IValidationStrategy>;\n \n constructor(\n tokenRegistry: ITokenRegistry,\n themeResolver: IThemeResolver,\n validators?: ReadonlyArray<IValidationStrategy>\n ) {\n this.tokenRegistry = tokenRegistry;\n this.themeResolver = themeResolver;\n this.validators = validators || [\n new TokenExistenceValidator(tokenRegistry),\n new DomainValidator(tokenRegistry),\n new AllowedTokenValidator()\n ];\n }\n \n /**\n * resolve()\n * Main function: Validates style contract against constitution\n * \n * @param contract - Style contract definition\n * @param constitution - Component constitution\n * @param context - Optional style context\n * @returns Resolution result with nodes and violations\n */\n resolve(\n contract: StyleContractDefinition, \n constitution: ComponentConstitution,\n context?: StyleContext\n ): StyleResolutionResult {\n const violations: StyleViolation[] = [];\n const nodes: SemanticNode[] = [];\n\n // Check each property in contract\n for (const [property, rawValue] of Object.entries(contract)) {\n const rule = constitution.rules.find((r) => r.property === property);\n \n // 1. Rule Existence Check\n if (!rule) {\n violations.push({\n rule: 'unknown-property',\n message: `Property '${property}' is not defined in ${constitution.componentName} constitution.`,\n severity: 'warning',\n semantic: `${property}`\n });\n continue;\n }\n\n // Handle ResponsiveValue (String or Object)\n if (typeof rawValue === 'string') {\n this.validateAndResolve(\n property, \n rawValue, \n rule, \n constitution, \n violations, \n nodes, \n undefined, \n context\n );\n } else if (typeof rawValue === 'object' && rawValue !== null) {\n // Iterate over breakpoints\n for (const [bp, tokenId] of Object.entries(rawValue)) {\n this.validateAndResolve(\n property, \n tokenId as string, \n rule, \n constitution, \n violations, \n nodes, \n bp as StyleBreakpoint,\n context\n );\n }\n }\n }\n\n // Return Immutable Result\n return {\n valid: violations.length === 0,\n nodes: Object.freeze(nodes),\n violations: Object.freeze(violations),\n };\n }\n \n /**\n * validateAndResolve()\n * Internal helper to validate and resolve a single token\n */\n private validateAndResolve(\n property: string,\n tokenId: string,\n rule: any,\n constitution: any,\n violations: StyleViolation[],\n nodes: SemanticNode[],\n breakpoint?: StyleBreakpoint,\n context?: StyleContext\n ) {\n // Run all validation strategies\n for (const validator of this.validators) {\n const violation = validator.validate(property, tokenId, rule, context);\n if (violation) {\n violations.push({\n ...violation,\n context: breakpoint ? { breakpoint } : undefined\n });\n return;\n }\n }\n \n // If valid, create semantic node\n const token = this.tokenRegistry.getToken(tokenId);\n nodes.push({\n domain: token.domain,\n semantic: `${constitution.componentName}.${property}`,\n tokenRef: token.id,\n source: 'SRE.v2',\n breakpoint\n });\n }\n}\n","import type { StyleViolation, StyleContext } from '../types';\nimport type { ViolationHandler, ViolationOutcome } from './ViolationEngine';\n\n/**\n * DefaultViolationHandlers\n * Common violation handlers for typical scenarios.\n */\nexport class DefaultViolationHandlers {\n /**\n * TokenExistenceHandler\n * Handles invalid token violations.\n */\n static TokenExistenceHandler: ViolationHandler = {\n handle(violation: StyleViolation): ViolationOutcome {\n return {\n action: 'reject',\n metadata: {\n contract: violation.semantic || 'unknown',\n reason: violation.message,\n context: violation.context || {} as Partial<StyleContext>,\n severity: 'error'\n }\n };\n }\n };\n \n /**\n * DomainViolationHandler\n * Handles domain mismatch violations.\n */\n static DomainViolationHandler: ViolationHandler = {\n handle(violation: StyleViolation): ViolationOutcome {\n return {\n action: 'reject',\n metadata: {\n contract: violation.semantic || 'unknown',\n reason: violation.message,\n context: violation.context || {} as Partial<StyleContext>,\n severity: 'error'\n }\n };\n }\n };\n \n /**\n * IllegalTokenHandler\n * Handles illegal token usage violations.\n */\n static IllegalTokenHandler: ViolationHandler = {\n handle(violation: StyleViolation): ViolationOutcome {\n return {\n action: 'fallback',\n replacement: 'md', // Default fallback\n metadata: {\n contract: violation.semantic || 'unknown',\n reason: violation.message,\n context: violation.context || {} as Partial<StyleContext>,\n severity: 'warning'\n }\n };\n }\n };\n \n /**\n * ContextViolationHandler\n * Handles context-specific violations.\n */\n static ContextViolationHandler: ViolationHandler = {\n handle(violation: StyleViolation): ViolationOutcome {\n return {\n action: 'fallback',\n replacement: 'md', // Default fallback\n metadata: {\n contract: violation.semantic || 'unknown',\n reason: violation.message,\n context: violation.context || {} as Partial<StyleContext>,\n severity: 'warning'\n }\n };\n }\n };\n}\n","import type { StyleViolation, StyleContext } from '../types';\n\n/**\n * ViolationAction\n * Action to take when a violation is detected.\n */\nexport type ViolationAction = 'reject' | 'fallback' | 'override' | 'warn';\n\n/**\n * ViolationOutcome\n * Pure function result from violation handling.\n * No side effects, just decision.\n */\nexport interface ViolationOutcome {\n readonly action: ViolationAction;\n readonly replacement?: any;\n readonly metadata: {\n readonly contract: string;\n readonly reason: string;\n readonly context: Partial<StyleContext>;\n readonly severity: 'error' | 'warning';\n };\n}\n\n/**\n * ViolationHandler\n * Strategy for handling violations.\n */\nexport interface ViolationHandler {\n /**\n * Handle a violation\n * @param violation - The violation to handle\n * @returns Outcome (decision, not execution)\n */\n handle(violation: StyleViolation): ViolationOutcome;\n}\n\n/**\n * ViolationEngine\n * \n * Pure function engine for handling style violations.\n * Returns decisions, never executes them.\n * \n * Responsibilities:\n * - Evaluate violations against policies\n * - Determine appropriate action (reject/fallback/override/warn)\n * - Provide replacement values for fallback\n * - Generate audit metadata\n * \n * Key Principles:\n * - PURE: No side effects, no execution\n * - POLICY-DRIVEN: Decisions based on configured policies\n * - AUDITABLE: All decisions are traceable\n * - COMPOSABLE: Handlers can be combined\n */\nexport class ViolationEngine {\n private readonly handlers: Map<string, ViolationHandler>;\n private defaultAction: ViolationAction;\n \n constructor(\n defaultAction: ViolationAction = 'reject',\n handlers?: ViolationHandler[]\n ) {\n this.defaultAction = defaultAction;\n this.handlers = new Map();\n \n // Register handlers\n if (handlers) {\n for (const handler of handlers) {\n this.handlers.set(handler.constructor.name, handler);\n }\n }\n }\n \n /**\n * Handle a violation\n * @param violation - The violation to handle\n * @returns Outcome (decision, not execution)\n */\n handle(violation: StyleViolation): ViolationOutcome {\n // Try to find specific handler\n const handler = this.handlers.get(violation.rule);\n \n if (handler) {\n return handler.handle(violation);\n }\n \n // Fall back to default action\n return this.createDefaultOutcome(violation);\n }\n \n /**\n * Handle multiple violations\n * @param violations - Array of violations\n * @returns Array of outcomes\n */\n handleMultiple(violations: ReadonlyArray<StyleViolation>): ViolationOutcome[] {\n return violations.map(v => this.handle(v));\n }\n \n /**\n * Get current default action\n * @returns Current default action\n */\n getCurrentDefaultAction(): ViolationAction {\n return this.defaultAction;\n }\n \n /**\n * Create default outcome based on default action\n * @param violation - The violation\n * @returns Default outcome\n */\n private createDefaultOutcome(violation: StyleViolation): ViolationOutcome {\n const currentAction = this.getCurrentDefaultAction();\n \n switch (currentAction) {\n case 'reject':\n return {\n action: 'reject',\n metadata: {\n contract: violation.semantic || 'unknown',\n reason: violation.message,\n context: violation.context || {} as Partial<StyleContext>,\n severity: violation.severity as 'error' | 'warning'\n }\n };\n \n case 'fallback':\n return {\n action: 'fallback',\n replacement: this.determineFallbackValue(violation),\n metadata: {\n contract: violation.semantic || 'unknown',\n reason: violation.message,\n context: violation.context || {} as Partial<StyleContext>,\n severity: 'warning'\n }\n };\n \n case 'override':\n return {\n action: 'override',\n metadata: {\n contract: violation.semantic || 'unknown',\n reason: violation.message,\n context: violation.context || {} as Partial<StyleContext>,\n severity: 'warning'\n }\n };\n \n case 'warn':\n return {\n action: 'warn',\n metadata: {\n contract: violation.semantic || 'unknown',\n reason: violation.message,\n context: violation.context || {} as Partial<StyleContext>,\n severity: 'warning'\n }\n };\n \n default:\n throw new Error(`Unknown action: ${currentAction}`);\n }\n }\n \n /**\n * Determine fallback value for a violation\n * @param violation - The violation\n * @returns Fallback value or undefined\n */\n private determineFallbackValue(violation: StyleViolation): any {\n // Extract fallback from violation message if available\n const match = violation.message.match(/fallback to \\[([^\\]]+)\\]/i);\n if (match && match[1]) {\n return match[1];\n }\n \n // Try to infer from semantic\n if (violation.semantic) {\n const parts = violation.semantic.split('.');\n if (parts.length >= 2) {\n const property = parts[parts.length - 1];\n // Common fallbacks\n const fallbacks: Record<string, string> = {\n 'padding': 'md',\n 'margin': 'md',\n 'spacing': 'md',\n 'radius': 'md',\n 'shadow': 'md',\n 'background': 'surface.card',\n 'color': 'color.primary'\n };\n \n if (property in fallbacks) {\n return fallbacks[property];\n }\n }\n }\n \n return undefined;\n }\n \n /**\n * Register a handler\n * @param handler - The handler to register\n */\n registerHandler(handler: ViolationHandler): void {\n this.handlers.set(handler.constructor.name, handler);\n }\n \n /**\n * Unregister a handler\n * @param handlerName - Name of handler to unregister\n */\n unregisterHandler(handlerName: string): void {\n this.handlers.delete(handlerName);\n }\n \n /**\n * Get all registered handlers\n * @returns Array of handler names\n */\n getHandlers(): ReadonlyArray<string> {\n return Array.from(this.handlers.keys());\n }\n \n /**\n * Set default action\n * @param action - The default action\n */\n setDefaultAction(action: ViolationAction): void {\n (this as any).defaultAction = action;\n }\n}\n","import type { StyleContext, StyleTheme, StyleBreakpoint } from '../types';\n\n/**\n * ContextFactory\n * Factory for creating style contexts.\n * Eliminates context creation duplication (DRY).\n */\nexport class ContextFactory {\n /**\n * Create a style context with all required fields\n * @param options - Context configuration options\n * @returns Frozen style context\n */\n static create(options: {\n platform?: 'web' | 'native' | 'canvas';\n theme?: StyleTheme;\n device?: 'mobile' | 'tablet' | 'desktop';\n breakpoint?: StyleBreakpoint;\n state?: 'default' | 'hover' | 'active' | 'disabled';\n }): StyleContext {\n return Object.freeze({\n platform: options.platform || 'web',\n theme: options.theme || 'light',\n device: options.device || 'desktop',\n breakpoint: options.breakpoint,\n state: options.state || 'default'\n });\n }\n \n /**\n * Create multiple contexts for testing\n * @returns Array of frozen test contexts\n */\n static createTestContexts(): ReadonlyArray<StyleContext> {\n return Object.freeze([\n this.create({ platform: 'web', theme: 'light', device: 'desktop' }),\n this.create({ platform: 'web', theme: 'dark', device: 'desktop' }),\n this.create({ platform: 'web', theme: 'light', device: 'mobile' })\n ]);\n }\n \n /**\n * Create mobile context\n */\n static createMobile(theme: StyleTheme = 'light'): StyleContext {\n return this.create({ platform: 'web', theme, device: 'mobile' });\n }\n \n /**\n * Create tablet context\n */\n static createTablet(theme: StyleTheme = 'light'): StyleContext {\n return this.create({ platform: 'web', theme, device: 'tablet' });\n }\n \n /**\n * Create desktop context\n */\n static createDesktop(theme: StyleTheme = 'light'): StyleContext {\n return this.create({ platform: 'web', theme, device: 'desktop' });\n }\n}","import type { ValidationResult } from '@damarkuncoro/meta-architecture';\nimport type { StyleContractDefinition as IStyleContract, StyleContext, StyleResolutionResult, ComponentConstitution, StyleDomain } from '../../domain';\nimport { StyleResolutionEngine } from '../../domain';\nimport { TokenRegistry } from '../../domain';\nimport { ThemeResolver } from '../../domain';\n\n/**\n * StyleContract (INTEGRATED)\n * \n * Wrapper Class untuk menangani Style Contract di Runtime.\n * Menggunakan @damarkuncoro/meta-architecture untuk definisi tipe validasi.\n * \n * Refactored to use dependency injection for better testability.\n * Integrated with ContractEntity for constitutional governance.\n * \n * Key Principles:\n * - EXTENDS ContractEntity: First-class citizen in governance system\n * - DEPENDENCY INJECTION: Testable and flexible\n * - DOMAIN EVENTS: Emits events for audit trail\n * - CONTEXT-AWARE: Resolves in specific contexts\n */\nexport class StyleContract {\n private readonly contract: IStyleContract;\n private readonly constitution: ComponentConstitution;\n private readonly engine: StyleResolutionEngine;\n private readonly contractId: string;\n \n constructor(\n contract: IStyleContract,\n constitution: ComponentConstitution,\n engine?: StyleResolutionEngine\n ) {\n this.contract = contract;\n this.constitution = constitution;\n this.contractId = this.generateContractId();\n \n // Inject dependencies (testable!)\n this.engine = engine || new StyleResolutionEngine(\n new TokenRegistry(),\n new ThemeResolver()\n );\n }\n \n /**\n * validate()\n * Memeriksa apakah kontrak sesuai dengan Konstitusi Komponen.\n * Mengembalikan ValidationResult standar dari meta-architecture.\n * \n * This method is compatible with ContractEntity.validate()\n */\n validate(): Partial<ValidationResult> {\n const result = this.engine.resolve(this.contract, this.constitution);\n \n // Mapping internal result to Meta Architecture standard ValidationResult\n return {\n isValid: result.valid,\n errors: result.violations.map((v: any) => ({\n code: v.rule,\n message: v.message,\n severity: v.severity as 'error' | 'warning',\n field: v.semantic,\n timestamp: new Date()\n }) as any), // Casting as 'any' temporarily because library ValidationError is complex\n };\n }\n \n /**\n * resolve()\n * Menjalankan SRE untuk menghasilkan Semantic Nodes.\n * \n * This method is compatible with ContractEntity.resolve()\n */\n resolve(context: StyleContext): StyleResolutionResult {\n return this.engine.resolve(this.contract, this.constitution, context);\n }\n \n /**\n * getConstitution()\n * Mendapatkan konstitusi komponen.\n * \n * This method is compatible with ContractEntity.getConstitution()\n */\n getConstitution(): ComponentConstitution {\n return this.constitution;\n }\n \n /**\n * getContractId()\n * Mendapatkan ID unik untuk kontrak.\n */\n getContractId(): string {\n return this.contractId;\n }\n \n /**\n * getDomain()\n * Mendapatkan domain style kontrak.\n * Derived from the first rule's domain.\n */\n getDomain(): StyleDomain {\n return this.constitution.rules[0]?.domain || 'layout';\n }\n \n /**\n * getJurisdiction()\n * Mendapatkan jurisdiction (platforms) kontrak.\n * Default to ['web'] if not specified.\n */\n getJurisdiction(): string[] {\n return ['web'];\n }\n \n /**\n * generateContractId()\n * Generate unique contract ID.\n */\n private generateContractId(): string {\n return `StyleContract:${this.constitution.componentName}`;\n }\n \n /**\n * toJSON()\n * Serialize contract to JSON for audit trail.\n */\n toJSON(): Record<string, any> {\n return {\n contractId: this.contractId,\n componentName: this.constitution.componentName,\n domain: this.getDomain(),\n jurisdiction: this.getJurisdiction(),\n contract: this.contract,\n constitution: this.constitution,\n timestamp: new Date().toISOString()\n };\n }\n}\n","import React, { createContext, useContext, useEffect, useState, useMemo } from 'react';\nimport type { ReactNode } from 'react';\nimport type { StyleContext, StyleTheme } from '../../domain';\nimport type { PlatformAdapter } from '../adapters/PlatformAdapter';\nimport { WebPlatformAdapter } from '../adapters/WebPlatformAdapter';\n\ninterface StyleContextState extends StyleContext {\n toggleTheme: () => void;\n setTheme: (theme: StyleTheme) => void;\n}\n\nconst defaultContext: StyleContextState = {\n platform: 'web',\n theme: 'light',\n device: 'desktop',\n toggleTheme: () => {},\n setTheme: () => {}\n};\n\nconst StyleEngineContext = createContext<StyleContextState>(defaultContext);\n\ninterface StyleProviderProps {\n children: ReactNode;\n initialTheme?: StyleTheme;\n /**\n * Platform adapter for device detection and theme application.\n * Defaults to WebPlatformAdapter if not provided.\n */\n adapter?: PlatformAdapter;\n}\n\nexport const StyleProvider: React.FC<StyleProviderProps> = ({ \n children, \n initialTheme = 'light',\n adapter \n}) => {\n // Use useMemo to ensure adapter is stable if created internally\n const platformAdapter = useMemo(() => adapter || new WebPlatformAdapter(), [adapter]);\n\n const [theme, setThemeState] = useState<StyleTheme>(initialTheme);\n // Initialize device state from adapter if possible, otherwise default to desktop\n const [device, setDevice] = useState<'mobile' | 'tablet' | 'desktop'>(() => {\n try {\n return platformAdapter.getInitialDevice();\n } catch {\n return 'desktop';\n }\n });\n\n // Responsive detection via adapter\n useEffect(() => {\n const unsubscribe = platformAdapter.subscribeToResize((newDevice) => {\n setDevice(newDevice);\n });\n return unsubscribe;\n }, [platformAdapter]);\n\n // Apply theme side-effects via adapter\n useEffect(() => {\n platformAdapter.applyTheme(theme);\n }, [theme, platformAdapter]);\n\n const toggleTheme = () => {\n setThemeState(prev => prev === 'light' ? 'dark' : 'light');\n };\n\n const setTheme = (newTheme: StyleTheme) => {\n setThemeState(newTheme);\n };\n\n const value: StyleContextState = {\n platform: platformAdapter.platform,\n theme,\n device,\n toggleTheme,\n setTheme\n };\n\n return (\n <StyleEngineContext.Provider value={value}>\n {children}\n </StyleEngineContext.Provider>\n );\n};\n\nexport const useStyleContext = () => useContext(StyleEngineContext);\n","import { PlatformAdapter } from './PlatformAdapter';\n\nexport class WebPlatformAdapter implements PlatformAdapter {\n readonly platform = 'web' as const;\n\n getInitialDevice(): 'mobile' | 'tablet' | 'desktop' {\n if (typeof window === 'undefined') return 'desktop'; // Server-side fallback\n \n const width = window.innerWidth;\n if (width < 768) return 'mobile';\n if (width < 1024) return 'tablet';\n return 'desktop';\n }\n\n subscribeToResize(callback: (device: 'mobile' | 'tablet' | 'desktop') => void): () => void {\n if (typeof window === 'undefined') {\n return () => {};\n }\n\n const handleResize = () => {\n const width = window.innerWidth;\n let device: 'mobile' | 'tablet' | 'desktop' = 'desktop';\n \n if (width < 768) device = 'mobile';\n else if (width < 1024) device = 'tablet';\n \n callback(device);\n };\n\n window.addEventListener('resize', handleResize);\n \n // Initial call to ensure sync\n handleResize();\n\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n }\n\n applyTheme(theme: 'light' | 'dark'): void {\n if (typeof document === 'undefined') return;\n\n const root = document.documentElement;\n if (theme === 'dark') {\n root.classList.add('dark');\n } else {\n root.classList.remove('dark');\n }\n }\n}\n","import { PlatformAdapter } from './PlatformAdapter';\n\n/**\n * NativePlatformAdapter\n * \n * Implementation for React Native / Native environments.\n * Currently a stub as we are primarily Web-first, but ensures architecture is ready.\n * \n * TODO: Implement with React Native Dimensions/Appearance API\n */\nexport class NativePlatformAdapter implements PlatformAdapter {\n readonly platform = 'native' as const;\n\n getInitialDevice(): 'mobile' | 'tablet' | 'desktop' {\n // In a real RN app, we would use Dimensions.get('window').width\n // For now, default to mobile as a safe bet for native\n return 'mobile';\n }\n\n subscribeToResize(callback: (device: 'mobile' | 'tablet' | 'desktop') => void): () => void {\n // In RN: Dimensions.addEventListener('change', ...)\n // For now, no-op\n return () => {};\n }\n\n applyTheme(theme: 'light' | 'dark'): void {\n // In RN, we don't manipulate DOM classes.\n // Theme is usually passed down via Context or Appearance API.\n // No side effects needed here for now.\n }\n}\n","import {\n type ValidationRule,\n type ValidationContext,\n ValidationError\n} from '@damarkuncoro/meta-architecture';\nimport { StyleContract } from '../../../runtime';\nimport { ContextFactory } from '../../../domain';\n\n/**\n * MaseValidationRule\n * Adapts MASE's StyleResolutionEngine to Meta Architecture's ValidationRule interface.\n * Allows \"Style Audits\" to be run as part of the broader governance pipeline.\n */\nexport class MaseValidationRule implements ValidationRule<any> {\n name = 'mase-style-compliance';\n description = 'Validates style contracts against MASE Constitution';\n category = 'business' as const;\n severity = 'error' as const;\n\n async validate(target: any, context: ValidationContext): Promise<ValidationError | null> {\n // 1. Identification: Check if target is a MASE-compatible component\n // We support passing Constitution/Contract directly or via metadata\n const constitution = target.constitution || target.metadata?.constitution;\n const contractData = target.contract || target.metadata?.styleContract;\n\n if (!constitution || !contractData) {\n // Not a MASE component, or missing required data. \n // We skip validation (return null) rather than erroring, \n // as this rule only applies to MASE components.\n return null;\n }\n\n // 2. Wrap in StyleContract\n // This allows us to use the existing logic for contract initialization\n const contract = new StyleContract(contractData, constitution);\n\n // 3. Resolve & Validate\n // Iterate through multiple contexts to ensure full compliance across all scenarios.\n const contextsToValidate = ContextFactory.createTestContexts();\n\n const allViolations: any[] = [];\n\n for (const ctx of contextsToValidate) {\n const result = contract.resolve(ctx);\n if (!result.valid) {\n // Tag violations with the context they failed in\n const taggedViolations = result.violations.map((v: any) => ({\n ...v,\n validationContext: `${ctx.theme}-${ctx.device}`\n }));\n allViolations.push(...taggedViolations);\n }\n }\n\n if (allViolations.length === 0) {\n return null;\n }\n\n // 4. Map Violations to ValidationError\n const firstViolation = allViolations[0];\n \n return new ValidationError(\n `[${firstViolation.rule}] ${firstViolation.message}`,\n firstViolation.rule, // Use rule name as Error Code\n { \n semantic: firstViolation.semantic,\n context: firstViolation.context,\n failedContext: firstViolation.validationContext,\n allViolations: allViolations // Attach full list for debug\n }\n );\n }\n}\n","import {\n type ValidationRule\n} from '@damarkuncoro/meta-architecture';\nimport { MaseValidationRule } from './rules/MaseValidationRule';\n\n// -- Interfaces not exported by library --\nexport interface ValidationPluginMetadata {\n name: string;\n version: string;\n description: string;\n author: string;\n homepage?: string;\n repository?: string;\n license?: string;\n dependencies?: Record<string, string>;\n}\n\nexport interface ValidationPluginConfig {\n enabled: boolean;\n priority: number;\n config?: Record<string, any>;\n}\n\nexport interface ValidationPlugin {\n metadata: ValidationPluginMetadata;\n rules: ValidationRule[];\n initialize(config: ValidationPluginConfig): Promise<void>;\n destroy(): Promise<void>;\n getHealth(): Promise<{\n status: 'healthy' | 'degraded' | 'unhealthy';\n message?: string;\n }>;\n}\n// ----------------------------------------\n\n/**\n * MasePlugin\n * The entry point for Meta Architecture to load MASE capabilities.\n */\nexport class MaseGraphValidationPlugin implements ValidationPlugin {\n metadata: ValidationPluginMetadata = {\n name: 'mase-core-plugin',\n version: '1.0.0',\n description: 'Meta Architecture Style Engine Integration',\n author: 'MASE Team',\n dependencies: {}\n };\n\n rules: ValidationRule[] = [new MaseValidationRule()];\n\n async initialize(config: ValidationPluginConfig): Promise<void> {\n // We could load external constitutions or configs here if needed\n console.log('[MASE Plugin] Initialized with config:', config);\n }\n\n async destroy(): Promise<void> {\n // Cleanup if necessary\n }\n\n async getHealth(): Promise<{ status: 'healthy' | 'degraded' | 'unhealthy'; message?: string }> {\n return { status: 'healthy', message: 'Style Engine is ready' };\n }\n}\n","\nexport class MaseValidationError extends Error {\n public code: string;\n public field?: string;\n\n constructor(\n message: string,\n code: string,\n field?: string\n ) {\n super(message);\n this.name = 'ValidationError';\n this.code = code;\n this.field = field;\n }\n}\n","import type {\n ValidationRule,\n ValidationContext,\n} from '@damarkuncoro/meta-architecture';\nimport { MaseValidationError } from '../errors/MaseValidationError';\nimport { StyleResolutionEngine } from '../../../domain';\nimport { TokenRegistry, ThemeResolver } from '../../../domain';\nimport type { ComponentConstitution, StyleContractDefinition } from '../../../domain';\n\n/**\n * MASE Contract Wrapper\n * Used to pass both contract and constitution to the validator\n */\nexport interface MaseContractTarget {\n contract: StyleContractDefinition;\n constitution: ComponentConstitution;\n}\n\n/**\n * MaseGovernanceRule\n * Wraps the synchronous StyleResolutionEngine into a Meta Architecture ValidationRule.\n */\nexport class MaseGovernanceRule implements ValidationRule<MaseContractTarget> {\n public readonly name = 'MASE-Constitutional-Compliance';\n public readonly description = 'Enforces strict adherence to Component Constitution using MASE SRE.';\n public readonly category = 'business'; // It's a business rule (Design System Law)\n public readonly severity = 'error';\n\n private readonly engine: StyleResolutionEngine;\n\n constructor() {\n // Create dependencies using factory\n const tokenRegistry = new TokenRegistry();\n const themeResolver = new ThemeResolver();\n this.engine = new StyleResolutionEngine(tokenRegistry, themeResolver);\n }\n\n async validate(target: MaseContractTarget, _context: ValidationContext): Promise<MaseValidationError | null> {\n // 1. Run Synchronous SRE\n const result = this.engine.resolve(target.contract, target.constitution);\n\n // 2. Check Validity\n if (result.valid) {\n return null;\n }\n\n // 3. Map Violations to ValidationError (Meta Architecture Standard)\n const primaryViolation = result.violations[0];\n \n // We aggregate all violations into one ValidationError message for now,\n // or we could return just the first one as a blocker.\n const messages = result.violations.map((v: any) => `[${v.rule}] ${v.message} (${v.semantic})`).join('; ');\n\n return new MaseValidationError(\n messages,\n primaryViolation.rule, // code\n target.constitution.componentName // field/target\n );\n }\n}\n","import { ValidationPipeline } from '@damarkuncoro/meta-architecture';\nimport { MaseGraphValidationPlugin } from '../MasePlugin';\nimport type { MaseContractTarget } from '../rules/MaseGovernanceRule';\nimport { CardConstitution } from '../../../data/constitutions/CardConstitution';\n\n/**\n * Factory untuk membuat pipeline validasi yang sudah dikonfigurasi dengan MASE Plugin.\n * Ini mensimulasikan \"System Boot\" di environment Enterprise/Server-side.\n */\nexport class CompliancePipelineFactory {\n static async createPipeline() {\n const pipeline = new ValidationPipeline();\n const masePlugin = new MaseGraphValidationPlugin();\n \n // Register Plugin\n // Note: Library meta-architecture mungkin belum punya method registerPlugin yang exposed public di versi ini,\n // jadi kita inisialisasi plugin manual dan ambil rules-nya.\n await masePlugin.initialize({ enabled: true, priority: 1 });\n \n // Inject rules ke pipeline (workaround jika registerPlugin tidak tersedia di interface public)\n masePlugin.rules.forEach(rule => pipeline.addRule(rule));\n\n return pipeline;\n }\n\n static createMockTargets(): any[] {\n return [\n {\n // Mock ContractEntity properties required by ValidationPipeline\n id: 'artifact-001',\n name: { value: 'Valid Card Component' },\n category: { value: 'UI Component' },\n contractVersion: '1.0.0',\n \n // MaseContractTarget properties required by MaseGovernanceRule\n constitution: CardConstitution,\n contract: {\n background: 'surface.card',\n padding: 'space.md',\n shadow: 'shadow.md',\n radius: 'radius.md'\n }\n },\n {\n id: 'artifact-002',\n name: { value: 'Invalid Card Component' },\n category: { value: 'UI Component' },\n contractVersion: '1.0.0',\n \n constitution: CardConstitution,\n contract: {\n background: 'bg-red-500', // Violation\n padding: 'space.md',\n shadow: 'shadow.none', // Violation\n radius: 'radius.md'\n }\n },\n {\n id: 'artifact-003',\n name: { value: 'Responsive Card Component' },\n category: { value: 'UI Component' },\n contractVersion: '1.0.0',\n\n constitution: CardConstitution,\n contract: {\n background: 'surface.paper',\n padding: { sm: 'space.sm', lg: 'space.xl' }, // Responsive\n shadow: 'shadow.lg',\n radius: 'radius.full'\n }\n }\n ];\n }\n}\n","import type { ComponentConstitution } from '../../domain/types';\n\nexport const CardConstitution: ComponentConstitution = {\n componentName: 'Card',\n rules: [\n {\n property: 'background',\n domain: 'color',\n allowedTokens: ['surface.card', 'surface.ground'],\n },\n {\n property: 'padding',\n domain: 'layout',\n allowedTokens: ['space.md', 'space.lg'], // Card needs breathing room\n },\n {\n property: 'shadow',\n domain: 'effect',\n allowedTokens: ['shadow.sm', 'shadow.md', 'shadow.lg'],\n },\n {\n property: 'radius',\n domain: 'layout',\n allowedTokens: ['radius.md', 'radius.lg'],\n }\n ]\n};\n","import type { ComponentConstitution } from '../../domain/types';\n\nexport const ButtonConstitution: ComponentConstitution = {\n componentName: 'Button',\n rules: [\n {\n property: 'background',\n domain: 'color',\n allowedTokens: ['color.primary', 'color.secondary', 'color.danger'],\n conflictsWith: ['background'], // Cannot have multiple backgrounds\n },\n {\n property: 'padding',\n domain: 'layout',\n allowedTokens: ['space.sm', 'space.md'], // Large padding illegal for buttons\n },\n {\n property: 'text',\n domain: 'color',\n allowedTokens: ['text.light', 'text.dark'],\n }\n ],\n};\n","export class TokenizerError extends Error {\n readonly line: number;\n readonly column: number;\n \n constructor(message: string, line: number, column: number) {\n super(message);\n this.name = 'TokenizerError';\n this.line = line;\n this.column = column;\n }\n}\n","/**\n * Contract DSL Tokenizer\n * \n * Tokenizes Contract DSL source code into tokens for parsing.\n * \n * Responsibilities:\n * - Convert DSL source to tokens\n * - Handle whitespace and comments\n * - Provide error locations\n * \n * Key Principles:\n * - DRY: Single tokenization logic\n * - SOLID: Single responsibility\n * - YAGNI: Only tokenize what's needed\n * - DDD: Domain-specific token types\n */\n\n/**\n * TokenType\n * Enum of all token types in Contract DSL.\n */\nexport type TokenType =\n // Keywords\n | 'CONTRACT'\n | 'DOMAIN'\n | 'ALLOWS'\n | 'DEFAULT'\n | 'CONSTRAINTS'\n | 'CONFLICTS'\n \n // Contexts\n | 'MOBILE'\n | 'TABLET'\n | 'DESKTOP'\n | 'LIGHT'\n | 'DARK'\n | 'WEB'\n | 'NATIVE'\n | 'CANVAS'\n | 'DEFAULT_CTX'\n | 'HOVER'\n | 'ACTIVE'\n | 'DISABLED'\n \n // Domains\n | 'LAYOUT'\n | 'TYPOGRAPHY'\n | 'COLOR'\n | 'EFFECT'\n | 'INTERACTION'\n \n // Punctuation\n | 'LBRACE'\n | 'RBRACE'\n | 'LBRACKET'\n | 'RBRACKET'\n | 'COLON'\n | 'SEMICOLON'\n | 'COMMA'\n \n // Literals\n | 'IDENTIFIER'\n \n // Special\n | 'EOF'\n | 'UNKNOWN';\n\nexport const TokenType = {\n // Keywords\n CONTRACT: 'CONTRACT' as const,\n DOMAIN: 'DOMAIN' as const,\n ALLOWS: 'ALLOWS' as const,\n DEFAULT: 'DEFAULT' as const,\n CONSTRAINTS: 'CONSTRAINTS' as const,\n CONFLICTS: 'CONFLICTS' as const,\n \n // Contexts\n MOBILE: 'MOBILE' as const,\n TABLET: 'TABLET' as const,\n DESKTOP: 'DESKTOP' as const,\n LIGHT: 'LIGHT' as const,\n DARK: 'DARK' as const,\n WEB: 'WEB' as const,\n NATIVE: 'NATIVE' as const,\n CANVAS: 'CANVAS' as const,\n DEFAULT_CTX: 'DEFAULT_CTX' as const,\n HOVER: 'HOVER' as const,\n ACTIVE: 'ACTIVE' as const,\n DISABLED: 'DISABLED' as const,\n \n // Domains\n LAYOUT: 'LAYOUT' as const,\n TYPOGRAPHY: 'TYPOGRAPHY' as const,\n COLOR: 'COLOR' as const,\n EFFECT: 'EFFECT' as const,\n INTERACTION: 'INTERACTION' as const,\n \n // Punctuation\n LBRACE: 'LBRACE' as const,\n RBRACE: 'RBRACE' as const,\n LBRACKET: 'LBRACKET' as const,\n RBRACKET: 'RBRACKET' as const,\n COLON: 'COLON' as const,\n SEMICOLON: 'SEMICOLON' as const,\n COMMA: 'COMMA' as const,\n \n // Literals\n IDENTIFIER: 'IDENTIFIER' as const,\n \n // Special\n EOF: 'EOF' as const,\n UNKNOWN: 'UNKNOWN' as const\n};\n\n/**\n * Token\n * Represents a single token in the DSL.\n */\nexport interface Token {\n readonly type: TokenType;\n readonly value: string;\n readonly line: number;\n readonly column: number;\n}\n\nimport { TokenizerError } from './TokenizerError';\n\n/**\n * ContractDSLTokenizer\n * Tokenizes Contract DSL source code.\n */\nexport class ContractDSLTokenizer {\n private source: string = '';\n private position: number = 0;\n private line: number = 1;\n private column: number = 1;\n \n // Keyword map\n private readonly keywords: Map<string, TokenType> = new Map([\n ['contract', TokenType.CONTRACT],\n ['domain', TokenType.DOMAIN],\n ['allows', TokenType.ALLOWS],\n ['default', TokenType.DEFAULT],\n ['constraints', TokenType.CONSTRAINTS],\n ['conflicts', TokenType.CONFLICTS],\n \n // Contexts\n ['mobile', TokenType.MOBILE],\n ['tablet', TokenType.TABLET],\n ['desktop', TokenType.DESKTOP],\n ['light', TokenType.LIGHT],\n ['dark', TokenType.DARK],\n ['web', TokenType.WEB],\n ['native', TokenType.NATIVE],\n ['canvas', TokenType.CANVAS],\n // ['default', TokenType.DEFAULT_CTX], // Removed duplicate mapping\n ['hover', TokenType.HOVER],\n ['active', TokenType.ACTIVE],\n ['disabled', TokenType.DISABLED],\n \n // Domains\n ['layout', TokenType.LAYOUT],\n ['typography', TokenType.TYPOGRAPHY],\n ['color', TokenType.COLOR],\n ['effect', TokenType.EFFECT],\n ['interaction', TokenType.INTERACTION]\n ]);\n \n /**\n * Tokenize source code\n * @param source - DSL source code\n * @returns Array of tokens\n */\n tokenize(source: string): Token[] {\n this.source = source;\n this.position = 0;\n this.line = 1;\n this.column = 1;\n \n const tokens: Token[] = [];\n \n while (this.position < this.source.length) {\n const char = this.source[this.position];\n \n // Skip whitespace\n if (this.isWhitespace(char)) {\n this.advance();\n continue;\n }\n \n // Skip comments\n if (char === '/' && this.peek() === '/') {\n this.skipComment();\n continue;\n }\n \n // Tokenize\n const token = this.nextToken();\n if (token) {\n tokens.push(token);\n }\n }\n \n // Add EOF token\n tokens.push({\n type: TokenType.EOF,\n value: '',\n line: this.line,\n column: this.column\n });\n \n return tokens;\n }\n \n /**\n * Get next token\n * @returns Token or null if EOF\n */\n private nextToken(): Token | null {\n const char = this.source[this.position];\n \n // Punctuation\n if (char === '{') return this.createToken(TokenType.LBRACE, char);\n if (char === '}') return this.createToken(TokenType.RBRACE, char);\n if (char === '[') return this.createToken(TokenType.LBRACKET, char);\n if (char === ']') return this.createToken(TokenType.RBRACKET, char);\n if (char === ':') return this.createToken(TokenType.COLON, char);\n if (char === ';') return this.createToken(TokenType.SEMICOLON, char);\n if (char === ',') return this.createToken(TokenType.COMMA, char);\n \n // Identifier or keyword\n if (this.isLetter(char) || char === '_' || char === '-') {\n return this.readIdentifier();\n }\n \n // Unknown character\n throw new TokenizerError(\n `Unknown character: '${char}'`,\n this.line,\n this.column\n );\n }\n \n /**\n * Read identifier or keyword\n * @returns Token\n */\n private readIdentifier(): Token {\n const start = this.position;\n const startLine = this.line;\n const startColumn = this.column;\n \n while (\n this.position < this.source.length &&\n (this.isLetter(this.source[this.position]) ||\n this.isDigit(this.source[this.position]) ||\n this.source[this.position] === '_' ||\n this.source[this.position] === '-' ||\n this.source[this.position] === '.')\n ) {\n this.advance();\n }\n \n const value = this.source.substring(start, this.position);\n const type = this.keywords.get(value) || TokenType.IDENTIFIER;\n \n return {\n type,\n value,\n line: startLine,\n column: startColumn\n };\n }\n \n /**\n * Skip single-line comment\n */\n private skipComment(): void {\n while (this.position < this.source.length && this.source[this.position] !== '\\n') {\n this.advance();\n }\n }\n \n /**\n * Create token\n * @param type - Token type\n * @param value - Token value\n * @returns Token\n */\n private createToken(type: TokenType, value: string): Token {\n const token = {\n type,\n value,\n line: this.line,\n column: this.column\n };\n \n this.advance();\n return token;\n }\n \n /**\n * Advance to next character\n */\n private advance(): void {\n if (this.source[this.position] === '\\n') {\n this.line++;\n this.column = 1;\n } else {\n this.column++;\n }\n this.position++;\n }\n \n /**\n * Peek at next character\n * @returns Next character or empty string\n */\n private peek(): string {\n if (this.position + 1 < this.source.length) {\n return this.source[this.position + 1];\n }\n return '';\n }\n \n /**\n * Check if character is whitespace\n * @param char - Character to check\n * @returns True if whitespace\n */\n private isWhitespace(char: string): boolean {\n return char === ' ' || char === '\\t' || char === '\\n' || char === '\\r';\n }\n \n /**\n * Check if character is letter\n * @param char - Character to check\n * @returns True if letter\n */\n private isLetter(char: string): boolean {\n return /[a-zA-Z]/.test(char);\n }\n \n /**\n * Check if character is digit\n * @param char - Character to check\n * @returns True if digit\n */\n private isDigit(char: string): boolean {\n return /[0-9]/.test(char);\n }\n}","export class ParserError extends Error {\n readonly line: number;\n readonly column: number;\n \n constructor(message: string, line: number, column: number) {\n super(message);\n this.name = 'ParserError';\n this.line = line;\n this.column = column;\n }\n}\n","/**\n * Contract DSL Parser\n * \n * Parses tokens from Contract DSL into Abstract Syntax Tree (AST).\n * \n * Responsibilities:\n * - Parse tokens into AST\n * - Implement EBNF grammar\n * - Provide syntax errors\n * \n * Key Principles:\n * - DRY: Single parsing logic\n * - SOLID: Single responsibility\n * - YAGNI: Only parse what's needed\n * - DDD: Domain-specific AST structure\n */\n\nimport type { Token, TokenType } from '../lexer/Tokenizer';\nimport { TokenType as TT } from '../lexer/Tokenizer';\nimport { ParserError } from './ParserError';\n\n/**\n * ContractAST\n * Abstract Syntax Tree for a contract.\n */\nexport interface ContractAST {\n readonly name: string;\n readonly domain: string;\n readonly properties: PropertyAST[];\n}\n\n/**\n * PropertyAST\n * AST for a property declaration.\n */\nexport interface PropertyAST {\n readonly name: string;\n readonly allows: string[];\n readonly default?: string;\n readonly constraints?: ConstraintAST[];\n readonly conflicts?: string[];\n}\n\n/**\n * ConstraintAST\n * AST for a constraint declaration.\n */\nexport interface ConstraintAST {\n readonly context: string;\n readonly allows: string[];\n}\n\n/**\n * ContractDSLParser\n * Parses Contract DSL tokens into AST.\n */\nexport class ContractDSLParser {\n private tokens: Token[] = [];\n private position: number = 0;\n \n /**\n * Parse tokens into AST\n * @param tokens - Array of tokens\n * @returns Contract AST\n */\n parse(tokens: Token[]): ContractAST {\n this.tokens = tokens;\n this.position = 0;\n \n // Parse contract\n const contract = this.parseContract();\n \n // Expect EOF\n this.expect(TT.EOF);\n \n return contract;\n }\n \n /**\n * Parse contract\n * @returns Contract AST\n */\n private parseContract(): ContractAST {\n // Expect 'contract'\n this.expect(TT.CONTRACT);\n \n // Expect identifier (contract name)\n const name = this.expectIdentifier();\n \n // Expect '{'\n this.expect(TT.LBRACE);\n \n // Parse domain\n const domain = this.parseDomain();\n \n // Parse properties\n const properties: PropertyAST[] = [];\n while (this.peek()?.type === TT.IDENTIFIER) {\n properties.push(this.parseProperty());\n }\n \n // Expect '}'\n this.expect(TT.RBRACE);\n \n return {\n name,\n domain,\n properties\n };\n }\n \n /**\n * Parse domain declaration\n * @returns Domain name\n */\n private parseDomain(): string {\n // Expect 'domain'\n this.expect(TT.DOMAIN);\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect domain identifier\n const domain = this.expectDomain();\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return domain;\n }\n \n /**\n * Parse property declaration\n * @returns Property AST\n */\n private parseProperty(): PropertyAST {\n // Expect identifier (property name)\n const name = this.expectIdentifier();\n \n // Expect '{'\n this.expect(TT.LBRACE);\n \n // Parse property body\n const allows = this.parseAllows();\n const defaultVal = this.parseDefault();\n const constraints = this.parseConstraints();\n const conflicts = this.parseConflicts();\n \n // Expect '}'\n this.expect(TT.RBRACE);\n \n return {\n name,\n allows,\n default: defaultVal,\n constraints,\n conflicts\n };\n }\n \n /**\n * Parse allows declaration\n * @returns Array of allowed tokens\n */\n private parseAllows(): string[] {\n // Expect 'allows'\n this.expect(TT.ALLOWS);\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect '['\n this.expect(TT.LBRACKET);\n \n // Parse token list\n const tokens: string[] = [];\n if (this.peek()?.type === TT.IDENTIFIER) {\n tokens.push(this.expectIdentifier());\n \n while (this.peek()?.type === TT.COMMA) {\n this.expect(TT.COMMA);\n tokens.push(this.expectIdentifier());\n }\n }\n \n // Expect ']'\n this.expect(TT.RBRACKET);\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return tokens;\n }\n \n /**\n * Parse default declaration\n * @returns Default token or undefined\n */\n private parseDefault(): string | undefined {\n // Check if 'default' keyword\n if (this.peek()?.type !== TT.DEFAULT) {\n return undefined;\n }\n \n // Expect 'default'\n this.expect(TT.DEFAULT);\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect identifier\n const value = this.expectIdentifier();\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return value;\n }\n \n /**\n * Parse constraints declaration\n * @returns Array of constraints or undefined\n */\n private parseConstraints(): ConstraintAST[] | undefined {\n // Check if 'constraints' keyword\n if (this.peek()?.type !== TT.CONSTRAINTS) {\n return undefined;\n }\n \n // Expect 'constraints'\n this.expect(TT.CONSTRAINTS);\n \n // Expect '{'\n this.expect(TT.LBRACE);\n \n // Parse constraint list\n const constraints: ConstraintAST[] = [];\n while (this.peek()?.type === TT.MOBILE || \n this.peek()?.type === TT.TABLET || \n this.peek()?.type === TT.DESKTOP ||\n this.peek()?.type === TT.LIGHT || \n this.peek()?.type === TT.DARK ||\n this.peek()?.type === TT.WEB || \n this.peek()?.type === TT.NATIVE ||\n this.peek()?.type === TT.CANVAS ||\n this.peek()?.type === TT.DEFAULT_CTX ||\n this.peek()?.type === TT.HOVER || \n this.peek()?.type === TT.ACTIVE ||\n this.peek()?.type === TT.DISABLED) {\n constraints.push(this.parseConstraint());\n }\n \n // Expect '}'\n this.expect(TT.RBRACE);\n \n return constraints;\n }\n \n /**\n * Parse constraint\n * @returns Constraint AST\n */\n private parseConstraint(): ConstraintAST {\n // Expect context\n const context = this.expectContext();\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect '['\n this.expect(TT.LBRACKET);\n \n // Parse token list\n const tokens: string[] = [];\n if (this.peek()?.type === TT.IDENTIFIER) {\n tokens.push(this.expectIdentifier());\n \n while (this.peek()?.type === TT.COMMA) {\n this.expect(TT.COMMA);\n tokens.push(this.expectIdentifier());\n }\n }\n \n // Expect ']'\n this.expect(TT.RBRACKET);\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return {\n context,\n allows: tokens\n };\n }\n \n /**\n * Parse conflicts declaration\n * @returns Array of conflicting properties or undefined\n */\n private parseConflicts(): string[] | undefined {\n // Check if 'conflicts' keyword\n if (this.peek()?.type !== TT.CONFLICTS) {\n return undefined;\n }\n \n // Expect 'conflicts'\n this.expect(TT.CONFLICTS);\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect '['\n this.expect(TT.LBRACKET);\n \n // Parse property list\n const properties: string[] = [];\n if (this.peek()?.type === TT.IDENTIFIER) {\n properties.push(this.expectIdentifier());\n \n while (this.peek()?.type === TT.COMMA) {\n this.expect(TT.COMMA);\n properties.push(this.expectIdentifier());\n }\n }\n \n // Expect ']'\n this.expect(TT.RBRACKET);\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return properties;\n }\n \n /**\n * Expect identifier token\n * @returns Identifier value\n */\n private expectIdentifier(): string {\n const token = this.peek();\n if (!token || token.type !== TT.IDENTIFIER) {\n throw new ParserError(\n `Expected identifier, got ${token?.type || 'EOF'}`,\n token?.line || 0,\n token?.column || 0\n );\n }\n \n this.advance();\n return token.value;\n }\n \n /**\n * Expect domain token\n * @returns Domain value\n */\n private expectDomain(): string {\n const token = this.peek();\n if (!token || \n (token.type !== TT.LAYOUT && \n token.type !== TT.TYPOGRAPHY && \n token.type !== TT.COLOR &&\n token.type !== TT.EFFECT &&\n token.type !== TT.INTERACTION &&\n token.type !== TT.IDENTIFIER)) {\n throw new ParserError(\n `Expected domain, got ${token?.type || 'EOF'}`,\n token?.line || 0,\n token?.column || 0\n );\n }\n \n this.advance();\n return token.value;\n }\n\n /**\n * Expect context token\n * @returns Context value\n */\n private expectContext(): string {\n const token = this.peek();\n if (!token || \n (token.type !== TT.MOBILE && \n token.type !== TT.TABLET && \n token.type !== TT.DESKTOP &&\n token.type !== TT.LIGHT && \n token.type !== TT.DARK &&\n token.type !== TT.WEB && \n token.type !== TT.NATIVE &&\n token.type !== TT.CANVAS &&\n token.type !== TT.DEFAULT_CTX &&\n token.type !== TT.DEFAULT &&\n token.type !== TT.HOVER && \n token.type !== TT.ACTIVE &&\n token.type !== TT.DISABLED)) {\n throw new ParserError(\n `Expected context, got ${token?.type || 'EOF'}`,\n token?.line || 0,\n token?.column || 0\n );\n }\n \n this.advance();\n return token.value;\n }\n \n /**\n * Expect specific token type\n * @param type - Expected token type\n */\n private expect(type: TokenType): void {\n const token = this.peek();\n if (!token || token.type !== type) {\n throw new ParserError(\n `Expected ${type}, got ${token?.type || 'EOF'}`,\n token?.line || 0,\n token?.column || 0\n );\n }\n \n this.advance();\n }\n \n /**\n * Peek at current token\n * @returns Current token or undefined\n */\n private peek(): Token | undefined {\n return this.tokens[this.position];\n }\n \n /**\n * Advance to next token\n */\n private advance(): void {\n this.position++;\n }\n}","export class ValidationError extends Error {\n readonly path: string;\n \n constructor(message: string, path: string) {\n super(message);\n this.name = 'ValidationError';\n this.path = path;\n }\n}\n","/**\n * Contract DSL Validator\n * \n * Validates Contract DSL AST structure and semantics.\n * \n * Responsibilities:\n * - Validate AST structure\n * - Check token references\n * - Validate constraints\n * \n * Key Principles:\n * - DRY: Single validation logic\n * - SOLID: Single responsibility\n * - YAGNI: Only validate what's needed\n * - DDD: Domain-specific validation rules\n */\n\nimport type { ContractAST, PropertyAST, ConstraintAST } from '../parser/Parser';\nimport type { StyleDomain } from '../../domain';\nimport { ValidationError } from './ValidationError';\n\n/**\n * ValidationResult\n * Result of validation.\n */\nexport interface ValidationResult {\n readonly isValid: boolean;\n readonly errors: ValidationError[];\n}\n\n/**\n * ContractDSLValidator\n * Validates Contract DSL AST.\n */\nexport class ContractDSLValidator {\n private readonly validDomains: Set<StyleDomain> = new Set([\n 'layout',\n 'typography',\n 'color',\n 'effect',\n 'interaction'\n ]);\n \n private readonly validContexts: Set<string> = new Set([\n 'mobile',\n 'tablet',\n 'desktop',\n 'light',\n 'dark',\n 'web',\n 'native',\n 'canvas',\n 'default',\n 'hover',\n 'active',\n 'disabled'\n ]);\n \n /**\n * Validate contract AST\n * @param ast - Contract AST\n * @returns Validation result\n */\n validate(ast: ContractAST): ValidationResult {\n const errors: ValidationError[] = [];\n \n // Validate contract name\n this.validateContractName(ast.name, errors);\n \n // Validate domain\n this.validateDomain(ast.domain, errors);\n \n // Validate properties\n this.validateProperties(ast.properties, errors);\n \n return {\n isValid: errors.length === 0,\n errors\n };\n }\n \n /**\n * Validate contract name\n * @param name - Contract name\n * @param errors - Array to collect errors\n */\n private validateContractName(name: string, errors: ValidationError[]): void {\n if (!name || name.trim().length === 0) {\n errors.push(new ValidationError(\n 'Contract name cannot be empty',\n 'contract.name'\n ));\n }\n \n if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(name)) {\n errors.push(new ValidationError(\n `Invalid contract name: '${name}'. Must start with a letter and contain only letters, digits, underscores, and hyphens.`,\n 'contract.name'\n ));\n }\n }\n \n /**\n * Validate domain\n * @param domain - Domain name\n * @param errors - Array to collect errors\n */\n private validateDomain(domain: string, errors: ValidationError[]): void {\n if (!domain || domain.trim().length === 0) {\n errors.push(new ValidationError(\n 'Domain cannot be empty',\n 'contract.domain'\n ));\n return;\n }\n \n if (!this.validDomains.has(domain as StyleDomain)) {\n errors.push(new ValidationError(\n `Invalid domain: '${domain}'. Must be one of: ${Array.from(this.validDomains).join(', ')}`,\n 'contract.domain'\n ));\n }\n }\n \n /**\n * Validate properties\n * @param properties - Array of properties\n * @param errors - Array to collect errors\n */\n private validateProperties(properties: PropertyAST[], errors: ValidationError[]): void {\n if (!properties || properties.length === 0) {\n errors.push(new ValidationError(\n 'Contract must have at least one property',\n 'contract.properties'\n ));\n return;\n }\n \n // Check for duplicate property names\n const propertyNames = new Set<string>();\n for (const property of properties) {\n if (propertyNames.has(property.name)) {\n errors.push(new ValidationError(\n `Duplicate property name: '${property.name}'`,\n `contract.properties.${property.name}`\n ));\n }\n propertyNames.add(property.name);\n \n // Validate individual property\n this.validateProperty(property, errors);\n }\n }\n \n /**\n * Validate property\n * @param property - Property AST\n * @param errors - Array to collect errors\n */\n private validateProperty(property: PropertyAST, errors: ValidationError[]): void {\n const path = `contract.properties.${property.name}`;\n \n // Validate property name\n if (!property.name || property.name.trim().length === 0) {\n errors.push(new ValidationError(\n 'Property name cannot be empty',\n `${path}.name`\n ));\n }\n \n // Validate allows\n this.validateAllows(property.allows, `${path}.allows`, errors);\n \n // Validate default\n if (property.default) {\n this.validateDefault(property.default, property.allows, `${path}.default`, errors);\n }\n \n // Validate constraints\n if (property.constraints) {\n this.validateConstraints(property.constraints, property.allows, `${path}.constraints`, errors);\n }\n \n // Validate conflicts\n if (property.conflicts) {\n this.validateConflicts(property.conflicts, `${path}.conflicts`, errors);\n }\n }\n \n /**\n * Validate allows\n * @param allows - Array of allowed tokens\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateAllows(allows: string[], path: string, errors: ValidationError[]): void {\n if (!allows || allows.length === 0) {\n errors.push(new ValidationError(\n 'Property must have at least one allowed token',\n path\n ));\n return;\n }\n \n // Check for duplicate tokens\n const tokenSet = new Set<string>();\n for (const token of allows) {\n if (tokenSet.has(token)) {\n errors.push(new ValidationError(\n `Duplicate allowed token: '${token}'`,\n path\n ));\n }\n tokenSet.add(token);\n \n // Validate token format\n this.validateTokenFormat(token, path, errors);\n }\n }\n \n /**\n * Validate default\n * @param defaultVal - Default token\n * @param allows - Array of allowed tokens\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateDefault(defaultVal: string, allows: string[], path: string, errors: ValidationError[]): void {\n // Validate token format\n this.validateTokenFormat(defaultVal, path, errors);\n \n // Check if default is in allows\n if (!allows.includes(defaultVal)) {\n errors.push(new ValidationError(\n `Default token '${defaultVal}' is not in allowed tokens`,\n path\n ));\n }\n }\n \n /**\n * Validate constraints\n * @param constraints - Array of constraints\n * @param allows - Array of allowed tokens\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateConstraints(constraints: ConstraintAST[], allows: string[], path: string, errors: ValidationError[]): void {\n if (!constraints || constraints.length === 0) {\n return;\n }\n \n // Check for duplicate contexts\n const contextSet = new Set<string>();\n for (const constraint of constraints) {\n if (contextSet.has(constraint.context)) {\n errors.push(new ValidationError(\n `Duplicate context: '${constraint.context}'`,\n `${path}.${constraint.context}`\n ));\n }\n contextSet.add(constraint.context);\n \n // Validate individual constraint\n this.validateConstraint(constraint, allows, `${path}.${constraint.context}`, errors);\n }\n }\n \n /**\n * Validate constraint\n * @param constraint - Constraint AST\n * @param allows - Array of allowed tokens\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateConstraint(constraint: ConstraintAST, allows: string[], path: string, errors: ValidationError[]): void {\n // Validate context\n if (!this.validContexts.has(constraint.context)) {\n errors.push(new ValidationError(\n `Invalid context: '${constraint.context}'. Must be one of: ${Array.from(this.validContexts).join(', ')}`,\n `${path}.context`\n ));\n }\n \n // Validate allows\n if (!constraint.allows || constraint.allows.length === 0) {\n errors.push(new ValidationError(\n 'Constraint must have at least one allowed token',\n `${path}.allows`\n ));\n return;\n }\n \n // Check if constraint allows are subset of property allows\n for (const token of constraint.allows) {\n if (!allows.includes(token)) {\n errors.push(new ValidationError(\n `Constraint token '${token}' is not in property allowed tokens`,\n `${path}.allows`\n ));\n }\n \n // Validate token format\n this.validateTokenFormat(token, `${path}.allows`, errors);\n }\n }\n \n /**\n * Validate conflicts\n * @param conflicts - Array of conflicting properties\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateConflicts(conflicts: string[], path: string, errors: ValidationError[]): void {\n if (!conflicts || conflicts.length === 0) {\n return;\n }\n \n // Check for duplicate properties\n const propertySet = new Set<string>();\n for (const property of conflicts) {\n if (propertySet.has(property)) {\n errors.push(new ValidationError(\n `Duplicate conflicting property: '${property}'`,\n path\n ));\n }\n propertySet.add(property);\n \n // Validate property name format\n if (!property || property.trim().length === 0) {\n errors.push(new ValidationError(\n 'Conflicting property name cannot be empty',\n path\n ));\n }\n }\n }\n \n /**\n * Validate token format\n * @param token - Token to validate\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateTokenFormat(token: string, path: string, errors: ValidationError[]): void {\n if (!token || token.trim().length === 0) {\n errors.push(new ValidationError(\n 'Token cannot be empty',\n path\n ));\n return;\n }\n \n // Token should be in format: category.subcategory.value\n const parts = token.split('.');\n if (parts.length < 2) {\n errors.push(new ValidationError(\n `Invalid token format: '${token}'. Must be in format: 'category.subcategory.value'`,\n path\n ));\n }\n \n // Each part should be valid identifier\n for (const part of parts) {\n if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(part)) {\n errors.push(new ValidationError(\n `Invalid token part: '${part}'. Must start with a letter and contain only letters, digits, underscores, and hyphens.`,\n path\n ));\n }\n }\n }\n}","/**\n * Contract DSL Compiler\n * \n * Compiles Contract DSL AST to ComponentConstitution and StyleContractDefinition.\n * \n * Responsibilities:\n * - Compile AST to ComponentConstitution\n * - Generate StyleContractDefinition\n * - Provide compile errors\n * \n * Key Principles:\n * - DRY: Single compilation logic\n * - SOLID: Single responsibility\n * - YAGNI: Only compile what's needed\n * - DDD: Domain-specific compilation\n */\n\nimport type { ContractAST, PropertyAST, ConstraintAST } from '../parser/Parser';\nimport type { ComponentConstitution, StyleContractDefinition, StyleRule, StyleDomain } from '../../domain';\nimport { CompilerError } from './CompilerError';\n\n/**\n * CompileResult\n * Result of compilation.\n */\nexport interface CompileResult {\n readonly constitution: ComponentConstitution;\n readonly contract: StyleContractDefinition;\n readonly errors: string[];\n}\n\n/**\n * ContractDSLCompiler\n * Compiles Contract DSL AST to ComponentConstitution and StyleContractDefinition.\n */\nexport class ContractDSLCompiler {\n /**\n * Compile AST to ComponentConstitution and StyleContractDefinition\n * @param ast - Contract AST\n * @returns Compile result\n */\n compile(ast: ContractAST): CompileResult {\n const errors: string[] = [];\n \n // Compile to ComponentConstitution\n const constitution = this.compileToConstitution(ast, errors);\n \n // Compile to StyleContractDefinition\n const contract = this.compileToContractDefinition(ast, errors);\n \n return {\n constitution,\n contract,\n errors\n };\n }\n \n /**\n * Compile AST to ComponentConstitution\n * @param ast - Contract AST\n * @param errors - Array to collect errors\n * @returns ComponentConstitution\n */\n private compileToConstitution(ast: ContractAST, errors: string[]): ComponentConstitution {\n const rules: StyleRule[] = [];\n \n for (const property of ast.properties) {\n const rule = this.compilePropertyToRule(property, errors);\n rules.push(rule);\n }\n \n return {\n componentName: ast.name,\n rules\n };\n }\n \n /**\n * Compile property to StyleRule\n * @param property - Property AST\n * @param errors - Array to collect errors\n * @returns StyleRule\n */\n private compilePropertyToRule(property: PropertyAST, errors: string[]): StyleRule {\n return {\n property: property.name,\n domain: this.inferDomain(property.name, errors),\n allowedTokens: property.allows,\n conflictsWith: property.conflicts\n };\n }\n \n /**\n * Infer domain from property name\n * @param propertyName - Property name\n * @param errors - Array to collect errors\n * @returns Inferred domain\n */\n private inferDomain(propertyName: string, errors: string[]): StyleDomain {\n // Simple heuristic to infer domain from property name\n const layoutProperties = ['padding', 'margin', 'spacing', 'gap', 'width', 'height', 'radius', 'shadow'];\n const typographyProperties = ['size', 'weight', 'line-height', 'color', 'font'];\n const colorProperties = ['background', 'foreground', 'border', 'text', 'intent'];\n const effectProperties = ['opacity', 'blur', 'transform', 'transition', 'animation'];\n const interactionProperties = ['hover', 'active', 'focus', 'disabled', 'state'];\n \n if (layoutProperties.some(prop => propertyName.includes(prop))) {\n return 'layout';\n }\n \n if (typographyProperties.some(prop => propertyName.includes(prop))) {\n return 'typography';\n }\n \n if (colorProperties.some(prop => propertyName.includes(prop))) {\n return 'color';\n }\n \n if (effectProperties.some(prop => propertyName.includes(prop))) {\n return 'effect';\n }\n \n if (interactionProperties.some(prop => propertyName.includes(prop))) {\n return 'interaction';\n }\n \n // Default to layout if unknown\n errors.push(`Warning: Could not infer domain for property '${propertyName}', defaulting to 'layout'`);\n return 'layout';\n }\n \n /**\n * Compile AST to StyleContractDefinition\n * @param ast - Contract AST\n * @param errors - Array to collect errors\n * @returns StyleContractDefinition\n */\n private compileToContractDefinition(ast: ContractAST, errors: string[]): StyleContractDefinition {\n const contract: Record<string, string> = {};\n \n for (const property of ast.properties) {\n const defaultValue = property.default || property.allows[0];\n contract[property.name] = defaultValue;\n }\n \n return contract as StyleContractDefinition;\n }\n \n /**\n * Generate TypeScript code for ComponentConstitution\n * @param ast - Contract AST\n * @returns TypeScript code\n */\n generateConstitutionCode(ast: ContractAST): string {\n const lines: string[] = [];\n \n lines.push(`import type { ComponentConstitution } from '../domain/types';`);\n lines.push('');\n lines.push(`export const ${ast.name}Constitution: ComponentConstitution = {`);\n lines.push(` componentName: '${ast.name}',`);\n lines.push(` domain: '${ast.domain}',`);\n lines.push(` rules: [`);\n \n for (const property of ast.properties) {\n lines.push(` {`);\n lines.push(` property: '${property.name}',`);\n lines.push(` domain: '${this.inferDomain(property.name, [])}',`);\n lines.push(` allowedTokens: [${property.allows.map((t: string) => `'${t}'`).join(', ')}],`);\n \n if (property.conflicts && property.conflicts.length > 0) {\n lines.push(` conflictsWith: [${property.conflicts.map((c: string) => `'${c}'`).join(', ')}],`);\n }\n \n lines.push(` },`);\n }\n \n lines.push(` ]`);\n lines.push(`};`);\n \n return lines.join('\\n');\n }\n \n /**\n * Generate TypeScript code for StyleContractDefinition\n * @param ast - Contract AST\n * @returns TypeScript code\n */\n generateContractCode(ast: ContractAST): string {\n const lines: string[] = [];\n \n lines.push(`import type { StyleContractDefinition } from '../domain/types';`);\n lines.push('');\n lines.push(`export const ${ast.name}Contract: StyleContractDefinition = {`);\n \n for (const property of ast.properties) {\n const defaultValue = property.default || property.allows[0];\n lines.push(` ${property.name}: '${defaultValue}',`);\n }\n \n lines.push(`};`);\n \n return lines.join('\\n');\n }\n \n /**\n * Generate complete TypeScript file\n * @param ast - Contract AST\n * @returns TypeScript file content\n */\n generateTypeScriptFile(ast: ContractAST): string {\n const lines: string[] = [];\n \n lines.push(`/**`);\n lines.push(` * ${ast.name} Contract`);\n lines.push(` * Generated from Contract DSL`);\n lines.push(` */`);\n lines.push('');\n lines.push(this.generateConstitutionCode(ast));\n lines.push('');\n lines.push(this.generateContractCode(ast));\n \n return lines.join('\\n');\n }\n}","/**\n * MaterializationError\n * Error during materialization.\n */\nexport class MaterializationError extends Error {\n readonly platform: string;\n readonly semantic?: string;\n \n constructor(message: string, platform: string, semantic?: string) {\n super(message);\n this.name = 'MaterializationError';\n this.platform = platform;\n this.semantic = semantic;\n }\n}\n","/**\n * CSS Materializer\n * \n * Converts semantic nodes to CSS output for web platform.\n * \n * Responsibilities:\n * - Map semantic → CSS property\n * - Map token → CSS value\n * - Map domain → CSS layer\n * - Generate CSS classes or variables\n * - Support responsive variants\n * \n * Key Principles:\n * - DRY: Single materialization logic\n * - SOLID: Single responsibility\n * - YAGNI: Only materialize what's needed\n * - DDD: Domain-specific CSS generation\n */\n\nimport type { Materializer, MaterializationContext, MaterializationResult } from '../core/Materializer';\nimport type { SemanticNode } from '../../domain';\nimport { MaterializationError } from '../core/MaterializationError';\n\n/**\n * CSSOutput\n * CSS output format.\n */\nexport interface CSSOutput {\n readonly classes: string;\n readonly variables: string;\n readonly inline: string;\n}\n\n/**\n * SemanticToCSSMapping\n * Mapping from semantic to CSS property.\n */\ninterface SemanticToCSSMapping {\n readonly [semantic: string]: string;\n}\n\n/**\n * CSSMaterializer\n * Materializes semantic nodes to CSS output.\n */\nexport class CSSMaterializer implements Materializer<CSSOutput> {\n private readonly semanticToCSS: SemanticToCSSMapping;\n \n constructor() {\n this.semanticToCSS = this.buildSemanticToCSSMapping();\n }\n \n /**\n * Materialize semantic nodes to CSS output\n * @param nodes - Resolved semantic nodes\n * @param context - Materialization context\n * @returns CSS output\n */\n materialize(\n nodes: readonly SemanticNode[],\n context: MaterializationContext\n ): MaterializationResult<CSSOutput> {\n const classes: string[] = [];\n const variables: string[] = [];\n const inline: string[] = [];\n \n for (const node of nodes) {\n const cssProperty = this.mapSemanticToCSS(node.semantic);\n const cssValue = this.mapTokenToCSS(node.tokenRef, context.theme);\n \n // Generate based on output format\n switch (context.outputFormat) {\n case 'class':\n classes.push(this.generateCSSClass(node.semantic, cssProperty, cssValue));\n break;\n case 'variable':\n variables.push(this.generateCSSVariable(node.tokenRef, cssValue));\n break;\n case 'inline':\n inline.push(this.generateInlineStyle(cssProperty, cssValue));\n break;\n }\n }\n \n return {\n output: {\n classes: classes.join('\\n'),\n variables: variables.join('\\n'),\n inline: inline.join('; ')\n },\n metadata: {\n platform: context.platform,\n theme: context.theme,\n device: context.device,\n format: context.outputFormat,\n timestamp: new Date().toISOString()\n }\n };\n }\n \n /**\n * Build semantic to CSS mapping\n * @returns Mapping object\n */\n private buildSemanticToCSSMapping(): SemanticToCSSMapping {\n return {\n // Spacing\n 'spacing.padding.small': 'padding',\n 'spacing.padding.medium': 'padding',\n 'spacing.padding.large': 'padding',\n 'spacing.margin.small': 'margin',\n 'spacing.margin.medium': 'margin',\n 'spacing.margin.large': 'margin',\n 'spacing.gap.small': 'gap',\n 'spacing.gap.medium': 'gap',\n 'spacing.gap.large': 'gap',\n \n // Color\n 'color.background.primary': 'background-color',\n 'color.background.secondary': 'background-color',\n 'color.background.tertiary': 'background-color',\n 'color.text.primary': 'color',\n 'color.text.secondary': 'color',\n 'color.text.tertiary': 'color',\n 'color.border.primary': 'border-color',\n 'color.border.secondary': 'border-color',\n \n // Typography\n 'typography.size.small': 'font-size',\n 'typography.size.base': 'font-size',\n 'typography.size.large': 'font-size',\n 'typography.weight.light': 'font-weight',\n 'typography.weight.normal': 'font-weight',\n 'typography.weight.bold': 'font-weight',\n 'typography.line-height.tight': 'line-height',\n 'typography.line-height.normal': 'line-height',\n 'typography.line-height.relaxed': 'line-height',\n \n // Effect\n 'effect.shadow.small': 'box-shadow',\n 'effect.shadow.medium': 'box-shadow',\n 'effect.shadow.large': 'box-shadow',\n 'effect.radius.small': 'border-radius',\n 'effect.radius.medium': 'border-radius',\n 'effect.radius.large': 'border-radius',\n 'effect.opacity.low': 'opacity',\n 'effect.opacity.medium': 'opacity',\n 'effect.opacity.high': 'opacity'\n };\n }\n \n /**\n * Map semantic to CSS property\n * @param semantic - Semantic string\n * @returns CSS property\n */\n private mapSemanticToCSS(semantic: string): string {\n const cssProperty = this.semanticToCSS[semantic];\n \n if (!cssProperty) {\n // Fallback: extract last part of semantic\n const parts = semantic.split('.');\n const lastPart = parts[parts.length - 1];\n \n // Map common patterns\n if (lastPart === 'small' || lastPart === 'medium' || lastPart === 'large') {\n return parts[parts.length - 2]; // e.g., padding, margin\n }\n \n return lastPart;\n }\n \n return cssProperty;\n }\n \n /**\n * Map token to CSS value\n * @param tokenRef - Token reference\n * @param theme - Theme\n * @returns CSS value\n */\n private mapTokenToCSS(tokenRef: string, theme: string): string {\n // In a real implementation, this would resolve the token from a token registry\n // For now, we'll use CSS variables as the default approach\n \n // Convert token reference to CSS variable name\n const cssVarName = tokenRef.replace(/\\./g, '-');\n \n // Add theme suffix if dark mode\n if (theme === 'dark') {\n return `var(--${cssVarName}-dark)`;\n }\n \n return `var(--${cssVarName})`;\n }\n \n /**\n * Generate CSS class\n * @param semantic - Semantic string\n * @param property - CSS property\n * @param value - CSS value\n * @returns CSS class string\n */\n private generateCSSClass(semantic: string, property: string, value: string): string {\n // Generate class name from semantic\n const className = this.generateClassName(semantic);\n \n return `.${className} { ${property}: ${value}; }`;\n }\n \n /**\n * Generate CSS variable\n * @param tokenRef - Token reference\n * @param value - CSS value\n * @returns CSS variable string\n */\n private generateCSSVariable(tokenRef: string, value: string): string {\n const varName = tokenRef.replace(/\\./g, '-');\n \n return `--${varName}: ${value};`;\n }\n \n /**\n * Generate inline style\n * @param property - CSS property\n * @param value - CSS value\n * @returns Inline style string\n */\n private generateInlineStyle(property: string, value: string): string {\n return `${property}: ${value}`;\n }\n \n /**\n * Generate class name from semantic\n * @param semantic - Semantic string\n * @returns Class name\n */\n private generateClassName(semantic: string): string {\n // Convert semantic to kebab-case class name\n return semantic\n .replace(/\\./g, '-')\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .toLowerCase();\n }\n}","/**\n * React Native Materializer\n * \n * Converts semantic nodes to React Native style objects.\n * \n * Responsibilities:\n * - Map semantic → RN property\n * - Map token → RN value\n * - Handle platform-specific differences\n * - Generate RN style objects\n * \n * Key Principles:\n * - DRY: Single materialization logic\n * - SOLID: Single responsibility\n * - YAGNI: Only materialize what's needed\n * - DDD: Domain-specific RN style generation\n */\n\nimport type { Materializer, MaterializationContext, MaterializationResult } from '../core/Materializer';\nimport type { SemanticNode } from '../../domain';\nimport { MaterializationError } from '../core/MaterializationError';\n\n/**\n * RNStyle\n * React Native style object.\n */\nexport type RNStyle = Record<string, string | number>;\n\n/**\n * SemanticToRNMapping\n * Mapping from semantic to RN property.\n */\ninterface SemanticToRNMapping {\n readonly [semantic: string]: string;\n}\n\n/**\n * RNMaterializer\n * Materializes semantic nodes to React Native style objects.\n */\nexport class RNMaterializer implements Materializer<RNStyle> {\n private readonly semanticToRN: SemanticToRNMapping;\n \n constructor() {\n this.semanticToRN = this.buildSemanticToRNMapping();\n }\n \n /**\n * Materialize semantic nodes to RN style\n * @param nodes - Resolved semantic nodes\n * @param context - Materialization context\n * @returns RN style object\n */\n materialize(\n nodes: readonly SemanticNode[],\n context: MaterializationContext\n ): MaterializationResult<RNStyle> {\n const style: RNStyle = {};\n \n for (const node of nodes) {\n const rnProperty = this.mapSemanticToRN(node.semantic);\n const rnValue = this.mapTokenToRN(node.tokenRef, context.theme);\n \n style[rnProperty] = rnValue;\n }\n \n return {\n output: style,\n metadata: {\n platform: context.platform,\n theme: context.theme,\n device: context.device,\n format: context.outputFormat,\n timestamp: new Date().toISOString()\n }\n };\n }\n \n /**\n * Build semantic to RN mapping\n * @returns Mapping object\n */\n private buildSemanticToRNMapping(): SemanticToRNMapping {\n return {\n // Spacing\n 'spacing.padding.small': 'padding',\n 'spacing.padding.medium': 'padding',\n 'spacing.padding.large': 'padding',\n 'spacing.margin.small': 'margin',\n 'spacing.margin.medium': 'margin',\n 'spacing.margin.large': 'margin',\n 'spacing.gap.small': 'gap',\n 'spacing.gap.medium': 'gap',\n 'spacing.gap.large': 'gap',\n \n // Color\n 'color.background.primary': 'backgroundColor',\n 'color.background.secondary': 'backgroundColor',\n 'color.background.tertiary': 'backgroundColor',\n 'color.text.primary': 'color',\n 'color.text.secondary': 'color',\n 'color.text.tertiary': 'color',\n 'color.border.primary': 'borderColor',\n 'color.border.secondary': 'borderColor',\n \n // Typography\n 'typography.size.small': 'fontSize',\n 'typography.size.base': 'fontSize',\n 'typography.size.large': 'fontSize',\n 'typography.weight.light': 'fontWeight',\n 'typography.weight.normal': 'fontWeight',\n 'typography.weight.bold': 'fontWeight',\n 'typography.line-height.tight': 'lineHeight',\n 'typography.line-height.normal': 'lineHeight',\n 'typography.line-height.relaxed': 'lineHeight',\n \n // Effect\n 'effect.shadow.small': 'shadow...',\n 'effect.shadow.medium': 'shadow...',\n 'effect.shadow.large': 'shadow...',\n 'effect.radius.small': 'borderRadius',\n 'effect.radius.medium': 'borderRadius',\n 'effect.radius.large': 'borderRadius',\n 'effect.opacity.low': 'opacity',\n 'effect.opacity.medium': 'opacity',\n 'effect.opacity.high': 'opacity'\n };\n }\n \n /**\n * Map semantic to RN property\n * @param semantic - Semantic string\n * @returns RN property\n */\n private mapSemanticToRN(semantic: string): string {\n const rnProperty = this.semanticToRN[semantic];\n \n if (!rnProperty) {\n // Fallback: extract last part of semantic\n const parts = semantic.split('.');\n const lastPart = parts[parts.length - 1];\n \n // Map common patterns\n if (lastPart === 'small' || lastPart === 'medium' || lastPart === 'large') {\n return parts[parts.length - 2]; // e.g., padding, margin\n }\n \n // Convert to camelCase\n return this.toCamelCase(lastPart);\n }\n \n return rnProperty;\n }\n \n /**\n * Map token to RN value\n * @param tokenRef - Token reference\n * @param theme - Theme\n * @returns RN value\n */\n private mapTokenToRN(tokenRef: string, theme: string): string | number {\n // In a real implementation, this would resolve the token from a token registry\n // For now, we'll return the token reference as a string\n \n // Add theme suffix if dark mode\n if (theme === 'dark') {\n return `${tokenRef}-dark`;\n }\n \n return tokenRef;\n }\n \n /**\n * Convert string to camelCase\n * @param str - String to convert\n * @returns camelCase string\n */\n private toCamelCase(str: string): string {\n return str\n .replace(/-([a-z])/g, (_, letter) => letter.toUpperCase())\n .replace(/^[A-Z]/, letter => letter.toLowerCase());\n }\n}","/**\n * PDF Materializer\n * \n * Converts semantic nodes to PDF style objects.\n * \n * Responsibilities:\n * - Map semantic → PDF property\n * - Map token → PDF value\n * - Handle PDF-specific units\n * - Generate PDF style objects\n * \n * Key Principles:\n * - DRY: Single materialization logic\n * - SOLID: Single responsibility\n * - YAGNI: Only materialize what's needed\n * - DDD: Domain-specific PDF style generation\n */\n\nimport type { Materializer, MaterializationContext, MaterializationResult } from '../core/Materializer';\nimport type { SemanticNode } from '../../domain';\nimport { MaterializationError } from '../core/MaterializationError';\n\n/**\n * PDFStyle\n * PDF style object.\n */\nexport type PDFStyle = Record<string, string | number>;\n\n/**\n * SemanticToPDFMapping\n * Mapping from semantic to PDF property.\n */\ninterface SemanticToPDFMapping {\n readonly [semantic: string]: string;\n}\n\n/**\n * PDFMaterializer\n * Materializes semantic nodes to PDF style objects.\n */\nexport class PDFMaterializer implements Materializer<PDFStyle> {\n private readonly semanticToPDF: SemanticToPDFMapping;\n \n constructor() {\n this.semanticToPDF = this.buildSemanticToPDFMapping();\n }\n \n /**\n * Materialize semantic nodes to PDF style\n * @param nodes - Resolved semantic nodes\n * @param context - Materialization context\n * @returns PDF style object\n */\n materialize(\n nodes: readonly SemanticNode[],\n context: MaterializationContext\n ): MaterializationResult<PDFStyle> {\n const style: PDFStyle = {};\n \n for (const node of nodes) {\n const pdfProperty = this.mapSemanticToPDF(node.semantic);\n const pdfValue = this.mapTokenToPDF(node.tokenRef, context.theme);\n \n style[pdfProperty] = pdfValue;\n }\n \n return {\n output: style,\n metadata: {\n platform: context.platform,\n theme: context.theme,\n device: context.device,\n format: context.outputFormat,\n timestamp: new Date().toISOString()\n }\n };\n }\n \n /**\n * Build semantic to PDF mapping\n * @returns Mapping object\n */\n private buildSemanticToPDFMapping(): SemanticToPDFMapping {\n return {\n // Spacing\n 'spacing.padding.small': 'padding',\n 'spacing.padding.medium': 'padding',\n 'spacing.padding.large': 'padding',\n 'spacing.margin.small': 'margin',\n 'spacing.margin.medium': 'margin',\n 'spacing.margin.large': 'margin',\n 'spacing.gap.small': 'gap',\n 'spacing.gap.medium': 'gap',\n 'spacing.gap.large': 'gap',\n \n // Color\n 'color.background.primary': 'fillColor',\n 'color.background.secondary': 'fillColor',\n 'color.background.tertiary': 'fillColor',\n 'color.text.primary': 'fillColor',\n 'color.text.secondary': 'fillColor',\n 'color.text.tertiary': 'fillColor',\n 'color.border.primary': 'borderColor',\n 'color.border.secondary': 'borderColor',\n \n // Typography\n 'typography.size.small': 'fontSize',\n 'typography.size.base': 'fontSize',\n 'typography.size.large': 'fontSize',\n 'typography.weight.light': 'fontWeight',\n 'typography.weight.normal': 'fontWeight',\n 'typography.weight.bold': 'fontWeight',\n 'typography.line-height.tight': 'lineHeight',\n 'typography.line-height.normal': 'lineHeight',\n 'typography.line-height.relaxed': 'lineHeight',\n \n // Effect\n 'effect.shadow.small': 'shadow...',\n 'effect.shadow.medium': 'shadow...',\n 'effect.shadow.large': 'shadow...',\n 'effect.radius.small': 'borderRadius',\n 'effect.radius.medium': 'borderRadius',\n 'effect.radius.large': 'borderRadius',\n 'effect.opacity.low': 'opacity',\n 'effect.opacity.medium': 'opacity',\n 'effect.opacity.high': 'opacity'\n };\n }\n \n /**\n * Map semantic to PDF property\n * @param semantic - Semantic string\n * @returns PDF property\n */\n private mapSemanticToPDF(semantic: string): string {\n const pdfProperty = this.semanticToPDF[semantic];\n \n if (!pdfProperty) {\n // Fallback: extract last part of semantic\n const parts = semantic.split('.');\n const lastPart = parts[parts.length - 1];\n \n // Map common patterns\n if (lastPart === 'small' || lastPart === 'medium' || lastPart === 'large') {\n return parts[parts.length - 2]; // e.g., padding, margin\n }\n \n // Convert to camelCase\n return this.toCamelCase(lastPart);\n }\n \n return pdfProperty;\n }\n \n /**\n * Map token to PDF value\n * @param tokenRef - Token reference\n * @param theme - Theme\n * @returns PDF value\n */\n private mapTokenToPDF(tokenRef: string, theme: string): string | number {\n // In a real implementation, this would resolve the token from a token registry\n // For now, we'll return the token reference as a string\n \n // Add theme suffix if dark mode\n if (theme === 'dark') {\n return `${tokenRef}-dark`;\n }\n \n return tokenRef;\n }\n \n /**\n * Convert string to camelCase\n * @param str - String to convert\n * @returns camelCase string\n */\n private toCamelCase(str: string): string {\n return str\n .replace(/-([a-z])/g, (_, letter) => letter.toUpperCase())\n .replace(/^[A-Z]/, letter => letter.toLowerCase());\n }\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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