@tachui/responsive 0.8.23 → 0.8.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index-BqVqOmco.js +96 -0
- package/dist/index-BqVqOmco.js.map +1 -0
- package/dist/index-GFNh0I50.mjs +2621 -0
- package/dist/index.js +1 -95
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +74 -2894
- package/dist/modifiers/index.d.ts +3 -0
- package/dist/modifiers/index.d.ts.map +1 -1
- package/dist/modifiers/index.js +2 -0
- package/dist/modifiers/index.js.map +1 -0
- package/dist/modifiers/index.mjs +74 -0
- package/package.json +11 -7
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../types/dist/reactive.js","../../core/src/reactive/context.ts","../../core/src/reactive/cleanup.ts","../../core/src/reactive/equality.ts","../../core/src/reactive/unified-scheduler.ts","../../core/src/reactive/computed.ts","../../core/src/reactive/signal.ts","../../core/src/reactive/theme.ts","../../core/src/runtime/element-override.ts","../../core/src/modifiers/registry.ts","../../core/src/version.ts","../../core/src/modifiers/registration-utils.ts","../src/version.ts","../src/modifiers/responsive/types.ts","../src/modifiers/responsive/breakpoints.ts","../src/modifiers/responsive/css-generator.ts","../src/modifiers/responsive/performance.ts","../src/modifiers/responsive/responsive-modifier.ts","../src/modifiers/responsive/responsive-builder.ts","../src/modifiers/responsive/utilities.ts","../src/modifiers/responsive/layout-patterns.ts","../src/modifiers/responsive/advanced-utilities.ts","../src/modifiers/responsive/dev-tools.ts","../src/modifiers/responsive/index.ts","../src/index.ts"],"sourcesContent":["// Runtime exports for reactive types\nexport const ComputationState = {\n Clean: 0,\n Check: 1,\n Dirty: 2,\n Disposed: 3,\n}\n","/**\n * Reactive context and computation management\n *\n * Manages the reactive execution context, dependency tracking,\n * and computation lifecycle.\n */\n\nimport type {\n CleanupFunction,\n Computation,\n ComputationStateValue,\n Owner,\n ReactiveContext,\n} from './types'\nimport { ComputationState } from './types'\n\nlet computationIdCounter = 0\nlet ownerIdCounter = 0\n\n// Module instance identifier for debugging\nconst moduleInstanceId = Math.random().toString(36).substr(2, 6)\n\n// Pure ESM module singleton - no globalThis\nlet currentComputation: Computation | null = null\nlet currentOwner: Owner | null = null\nlet isBatching = false\n\n// Module instance tracking for debugging\nconst moduleInstances = new Set<string>()\nmoduleInstances.add(moduleInstanceId)\n\n// Pure ESM Reactive context module loaded\n\n// Export the singleton state directly\nconst reactiveContext = {\n get currentComputation() {\n return currentComputation\n },\n set currentComputation(value) {\n currentComputation = value\n },\n get currentOwner() {\n return currentOwner\n },\n set currentOwner(value) {\n currentOwner = value\n },\n get isBatching() {\n return isBatching\n },\n set isBatching(value) {\n isBatching = value\n },\n}\n\n/**\n * Get the current computation context\n */\nexport function getCurrentComputation(): Computation | null {\n const computation = reactiveContext.currentComputation\n return computation\n}\n\n/**\n * Get the current owner context\n */\nexport function getCurrentOwner(): Owner | null {\n return reactiveContext.currentOwner\n}\n\n/**\n * Check if we're currently batching updates\n */\nexport function isBatchingUpdates(): boolean {\n return reactiveContext.isBatching\n}\n\n/**\n * Owner implementation for managing cleanup and context\n */\nclass OwnerImpl implements Owner {\n readonly id: number\n readonly parent: Owner | null\n readonly context = new Map<symbol, any>()\n readonly cleanups: CleanupFunction[] = []\n readonly sources = new Set<Computation>()\n disposed = false\n\n constructor(parent: Owner | null = null) {\n this.id = ++ownerIdCounter\n this.parent = parent\n }\n\n dispose(): void {\n if (this.disposed) return\n\n this.disposed = true\n\n // Dispose all child computations\n for (const computation of this.sources) {\n computation.dispose()\n }\n this.sources.clear()\n\n // Run cleanup functions\n for (const cleanup of this.cleanups) {\n try {\n cleanup()\n } catch (error) {\n console.error('Error in cleanup function:', error)\n }\n }\n this.cleanups.length = 0\n\n // Remove from parent\n if (this.parent && !this.parent.disposed) {\n this.parent.sources.delete(this as any)\n }\n }\n}\n\n/**\n * Computation implementation\n */\nexport class ComputationImpl implements Computation {\n readonly id: number\n readonly owner: Owner | null\n readonly fn: () => any\n readonly sources = new Set<any>() // Signals this computation depends on\n readonly observers = new Set<Computation>() // Computations that depend on this\n state: ComputationStateValue = ComputationState.Dirty\n value: any = undefined\n\n constructor(fn: () => any, owner: Owner | null = null) {\n this.id = ++computationIdCounter\n this.fn = fn\n this.owner = owner\n\n if (owner && !owner.disposed) {\n owner.sources.add(this)\n }\n }\n\n execute(): any {\n if (this.state === ComputationState.Disposed) {\n return this.value\n }\n\n // Clean up old dependencies\n for (const source of this.sources) {\n if (source && typeof source === 'object' && 'removeObserver' in source) {\n ;(source as any).removeObserver(this)\n }\n }\n this.sources.clear()\n\n const prevComputation = reactiveContext.currentComputation\n reactiveContext.currentComputation = this\n\n try {\n this.state = ComputationState.Clean\n this.value = this.fn()\n return this.value\n } catch (error) {\n this.state = ComputationState.Disposed\n // Don't suppress errors - let them propagate for proper error handling\n // Only log in non-test environments to avoid polluting test output\n if (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n console.error('Error in computation:', error)\n }\n throw error\n } finally {\n reactiveContext.currentComputation = prevComputation\n }\n }\n\n dispose(): void {\n if (this.state === ComputationState.Disposed) return\n\n this.state = ComputationState.Disposed\n\n // Remove from all sources\n for (const source of this.sources) {\n if (source && typeof source === 'object' && 'removeObserver' in source) {\n ;(source as any).removeObserver(this)\n }\n }\n this.sources.clear()\n\n // Notify observers that this computation is disposed\n for (const observer of this.observers) {\n observer.sources.delete(this)\n }\n this.observers.clear()\n\n // Remove from owner\n if (this.owner && !this.owner.disposed) {\n this.owner.sources.delete(this)\n }\n }\n}\n\n/**\n * Create a new reactive computation root\n */\nexport function createRoot<T>(fn: (dispose: () => void) => T): T {\n const owner = new OwnerImpl(reactiveContext.currentOwner)\n const prevOwner = reactiveContext.currentOwner\n reactiveContext.currentOwner = owner\n\n try {\n return fn(() => owner.dispose())\n } finally {\n reactiveContext.currentOwner = prevOwner\n }\n}\n\n/**\n * Run a function with a specific owner context\n */\nexport function runWithOwner<T>(owner: Owner | null, fn: () => T): T {\n const prevOwner = reactiveContext.currentOwner\n reactiveContext.currentOwner = owner\n\n try {\n return fn()\n } finally {\n reactiveContext.currentOwner = prevOwner\n }\n}\n\n/**\n * Get the current owner context\n */\nexport function getOwner(): Owner | null {\n return reactiveContext.currentOwner\n}\n\n// Global flush function reference\nlet flushFunction: (() => void) | null = null\n\n/**\n * Set the flush function (called by signal module)\n */\nexport function setFlushFunction(fn: () => void): void {\n flushFunction = fn\n}\n\n/**\n * Batch multiple updates together\n */\nexport function batch<T>(fn: () => T): T {\n if (reactiveContext.isBatching) {\n return fn()\n }\n\n const wasBatching = reactiveContext.isBatching\n reactiveContext.isBatching = true\n\n try {\n const result = fn()\n // Flush updates after batch completes\n if (!wasBatching && flushFunction) {\n flushFunction()\n }\n return result\n } finally {\n reactiveContext.isBatching = wasBatching\n }\n}\n\n/**\n * Read a signal without tracking dependency\n */\nexport function untrack<T>(fn: () => T): T {\n const prevComputation = reactiveContext.currentComputation\n reactiveContext.currentComputation = null\n\n try {\n return fn()\n } finally {\n reactiveContext.currentComputation = prevComputation\n }\n}\n\n/**\n * Add cleanup function to current owner\n */\nexport function onCleanup(fn: CleanupFunction): void {\n const owner = reactiveContext.currentOwner\n if (owner && !owner.disposed) {\n owner.cleanups.push(fn)\n }\n}\n\n/**\n * Create a computation that runs immediately and tracks dependencies\n */\nexport function createComputation<T>(\n fn: () => T,\n owner?: Owner\n): ComputationImpl {\n const computation = new ComputationImpl(\n fn,\n owner || reactiveContext.currentOwner\n )\n computation.execute()\n return computation\n}\n\n/**\n * Get reactive context information\n */\nexport function getReactiveContext(): ReactiveContext {\n return {\n computation: reactiveContext.currentComputation,\n batch: reactiveContext.isBatching,\n }\n}\n\n/**\n * Debug utilities\n */\nexport const DEBUG = {\n getCurrentComputation: () => reactiveContext.currentComputation,\n getCurrentOwner: () => reactiveContext.currentOwner,\n getComputationCount: () => computationIdCounter,\n getOwnerCount: () => ownerIdCounter,\n isBatching: () => reactiveContext.isBatching,\n getModuleInstances: () => Array.from(moduleInstances),\n getModuleId: () => moduleInstanceId,\n}\n","/**\n * Cleanup and disposal utilities for reactive system\n *\n * Provides memory management, cleanup functions, and disposal\n * utilities to prevent memory leaks in reactive computations.\n */\n\nimport { getCurrentOwner } from './context'\nimport type { CleanupFunction, Owner } from './types'\n\n// Global development flag\ndeclare const __DEV__: boolean\n\n// Build-time injected globals\ndeclare const process: {\n env: {\n NODE_ENV: string\n [key: string]: any\n }\n}\n\n/**\n * Add a cleanup function to the current reactive context\n *\n * @param fn Cleanup function to run when the context is disposed\n *\n * @example\n * ```typescript\n * createEffect(() => {\n * const interval = setInterval(() => {\n * console.log('tick')\n * }, 1000)\n *\n * onCleanup(() => {\n * clearInterval(interval)\n * })\n * })\n * ```\n */\nexport function onCleanup(fn: CleanupFunction): void {\n const owner = getCurrentOwner()\n if (owner && !owner.disposed) {\n owner.cleanups.push(fn)\n } else if (__DEV__) {\n console.warn('onCleanup called outside of reactive context')\n }\n}\n\n/**\n * Dispose a reactive owner and all its children\n *\n * @param owner The owner to dispose\n */\nexport function dispose(owner: Owner): void {\n if ('dispose' in owner && typeof owner.dispose === 'function') {\n owner.dispose()\n }\n}\n\n/**\n * Create a disposable resource with automatic cleanup\n *\n * @param fn Function that creates and returns a resource and its cleanup\n * @returns The created resource\n *\n * @example\n * ```typescript\n * const timer = createResource(() => {\n * const id = setInterval(() => console.log('tick'), 1000)\n * return [id, () => clearInterval(id)]\n * })\n * ```\n */\nexport function createResource<T>(fn: () => [T, CleanupFunction]): T {\n const [resource, cleanup] = fn()\n onCleanup(cleanup)\n return resource\n}\n\n/**\n * Create a cleanup group that can be disposed manually\n *\n * @returns Cleanup group with dispose function\n *\n * @example\n * ```typescript\n * const group = createCleanupGroup()\n *\n * group.add(() => console.log('cleanup 1'))\n * group.add(() => console.log('cleanup 2'))\n *\n * // Later...\n * group.dispose() // Runs both cleanup functions\n * ```\n */\nexport function createCleanupGroup(): {\n add: (fn: CleanupFunction) => void\n dispose: () => void\n disposed: boolean\n} {\n const cleanups: CleanupFunction[] = []\n let disposed = false\n\n return {\n add(fn: CleanupFunction) {\n if (disposed) {\n if (__DEV__) {\n console.warn('Adding cleanup to disposed group')\n }\n return\n }\n cleanups.push(fn)\n },\n\n dispose() {\n if (disposed) return\n disposed = true\n\n for (const cleanup of cleanups) {\n try {\n cleanup()\n } catch (error) {\n console.error('Error in cleanup function:', error)\n }\n }\n cleanups.length = 0\n },\n\n get disposed() {\n return disposed\n },\n }\n}\n\n/**\n * Create a weak disposal tracker using WeakRef and FinalizationRegistry\n * for automatic cleanup of unreferenced objects\n */\nexport function createWeakDisposal<T extends object>(\n target: T,\n cleanup: CleanupFunction\n): WeakRef<T> {\n const weakRef = new WeakRef(target)\n\n if (typeof FinalizationRegistry !== 'undefined') {\n const registry = new FinalizationRegistry(cleanup)\n registry.register(target, cleanup)\n }\n\n return weakRef\n}\n\n/**\n * Defer a cleanup function to run after the current reactive cycle\n *\n * @param fn Cleanup function to defer\n */\nexport function deferCleanup(fn: CleanupFunction): void {\n queueMicrotask(() => {\n try {\n fn()\n } catch (error) {\n console.error('Error in deferred cleanup:', error)\n }\n })\n}\n\n/**\n * Create a cleanup function that only runs once\n *\n * @param fn Cleanup function\n * @returns Cleanup function that only runs once\n */\nexport function createOnceCleanup(fn: CleanupFunction): CleanupFunction {\n let hasRun = false\n\n return () => {\n if (hasRun) return\n hasRun = true\n fn()\n }\n}\n\n/**\n * Create a timeout with automatic cleanup\n *\n * @param fn Function to run after timeout\n * @param delay Delay in milliseconds\n * @returns Timeout ID\n */\nexport function createTimeout(fn: () => void, delay: number): NodeJS.Timeout {\n const id = setTimeout(fn, delay)\n onCleanup(() => clearTimeout(id))\n return id\n}\n\n/**\n * Create an interval with automatic cleanup\n *\n * @param fn Function to run on interval\n * @param delay Delay in milliseconds\n * @returns Interval ID\n */\nexport function createInterval(fn: () => void, delay: number): NodeJS.Timeout {\n const id = setInterval(fn, delay)\n onCleanup(() => clearInterval(id))\n return id\n}\n\n/**\n * Create an event listener with automatic cleanup\n *\n * @param target Event target\n * @param event Event name\n * @param handler Event handler\n * @param options Event listener options\n */\nexport function createEventListener<K extends keyof WindowEventMap>(\n target: Window,\n event: K,\n handler: (event: WindowEventMap[K]) => void,\n options?: AddEventListenerOptions\n): void\nexport function createEventListener<K extends keyof DocumentEventMap>(\n target: Document,\n event: K,\n handler: (event: DocumentEventMap[K]) => void,\n options?: AddEventListenerOptions\n): void\nexport function createEventListener<K extends keyof HTMLElementEventMap>(\n target: HTMLElement,\n event: K,\n handler: (event: HTMLElementEventMap[K]) => void,\n options?: AddEventListenerOptions\n): void\nexport function createEventListener(\n target: EventTarget,\n event: string,\n handler: (event: Event) => void,\n options?: AddEventListenerOptions\n): void {\n target.addEventListener(event, handler, options)\n onCleanup(() => target.removeEventListener(event, handler, options))\n}\n\n// Development mode flag - simplified approach\nif (typeof (globalThis as any).__DEV__ === 'undefined') {\n ;(globalThis as any).__DEV__ = process.env.NODE_ENV !== 'production'\n}\n\n// Re-export types\nexport type { CleanupFunction }\n","/**\n * Equality Functions for Reactive System\n *\n * Provides various equality comparison functions for signal updates\n * including deep, shallow, and custom equality checking.\n */\n\nexport type EqualityFunction<T> = (a: T, b: T) => boolean\n\n/**\n * Default reference equality (===)\n */\nexport const defaultEquals = <T>(a: T, b: T): boolean => a === b\n\n/**\n * Deep equality comparison for objects and arrays\n * Recursively compares all properties and array elements\n */\nexport const deepEquals = <T>(a: T, b: T): boolean => {\n if (a === b) return true\n if (a == null || b == null) return false\n if (typeof a !== typeof b) return false\n\n if (typeof a === 'object') {\n if (Array.isArray(a) !== Array.isArray(b)) return false\n\n if (Array.isArray(a)) {\n const arrayA = a as unknown as any[]\n const arrayB = b as unknown as any[]\n if (arrayA.length !== arrayB.length) return false\n return arrayA.every((item, index) => deepEquals(item, arrayB[index]))\n }\n\n const objA = a as Record<string, any>\n const objB = b as Record<string, any>\n\n const keysA = Object.keys(objA)\n const keysB = Object.keys(objB)\n if (keysA.length !== keysB.length) return false\n\n return keysA.every((key) => deepEquals(objA[key], objB[key]))\n }\n\n return false\n}\n\n/**\n * Shallow equality comparison for objects\n * Compares only the top-level properties with reference equality\n */\nexport const shallowEquals = <T>(a: T, b: T): boolean => {\n if (a === b) return true\n if (typeof a !== 'object' || typeof b !== 'object') return false\n if (a == null || b == null) return false\n\n const objA = a as Record<string, any>\n const objB = b as Record<string, any>\n\n const keysA = Object.keys(objA)\n const keysB = Object.keys(objB)\n if (keysA.length !== keysB.length) return false\n\n return keysA.every((key) => objA[key] === objB[key])\n}\n\n/**\n * Structural equality for specific data types\n */\nexport const structuralEquals = <T>(a: T, b: T): boolean => {\n if (a === b) return true\n\n // Handle Date objects\n if (a instanceof Date && b instanceof Date) {\n return a.getTime() === b.getTime()\n }\n\n // Handle RegExp objects\n if (a instanceof RegExp && b instanceof RegExp) {\n return a.toString() === b.toString()\n }\n\n // Handle Set objects\n if (a instanceof Set && b instanceof Set) {\n if (a.size !== b.size) return false\n for (const item of a) {\n if (!b.has(item)) return false\n }\n return true\n }\n\n // Handle Map objects\n if (a instanceof Map && b instanceof Map) {\n if (a.size !== b.size) return false\n for (const [key, value] of a) {\n if (!b.has(key) || b.get(key) !== value) return false\n }\n return true\n }\n\n // Fall back to deep equals for other objects\n return deepEquals(a, b)\n}\n\n/**\n * JSON-based equality (serializes and compares)\n * Useful for complex nested structures but slower\n */\nexport const jsonEquals = <T>(a: T, b: T): boolean => {\n if (a === b) return true\n\n try {\n return JSON.stringify(a) === JSON.stringify(b)\n } catch {\n // If serialization fails, fall back to reference equality\n return a === b\n }\n}\n\n/**\n * Create a custom equality function based on a selector\n */\nexport const createSelectorEquals = <T, K>(\n selector: (value: T) => K,\n equalsFn: EqualityFunction<K> = defaultEquals\n): EqualityFunction<T> => {\n return (a: T, b: T): boolean => {\n return equalsFn(selector(a), selector(b))\n }\n}\n\n/**\n * Create an array equality function with custom element comparison\n */\nexport const createArrayEquals = <T>(\n elementEquals: EqualityFunction<T> = defaultEquals\n): EqualityFunction<T[]> => {\n return (a: T[], b: T[]): boolean => {\n if (a === b) return true\n if (a.length !== b.length) return false\n\n return a.every((item, index) => elementEquals(item, b[index]))\n }\n}\n\n/**\n * Create an object equality function with custom property comparison\n */\nexport const createObjectEquals = <T extends Record<string, any>>(\n propertyEquals: EqualityFunction<any> = defaultEquals\n): EqualityFunction<T> => {\n return (a: T, b: T): boolean => {\n if (a === b) return true\n if (a == null || b == null) return false\n\n const keysA = Object.keys(a)\n const keysB = Object.keys(b)\n if (keysA.length !== keysB.length) return false\n\n return keysA.every((key) => propertyEquals(a[key], b[key]))\n }\n}\n\n/**\n * Combine multiple equality functions with AND logic\n */\nexport const combineEquals = <T>(\n ...equalsFunctions: EqualityFunction<T>[]\n): EqualityFunction<T> => {\n return (a: T, b: T): boolean => {\n return equalsFunctions.every((equals) => equals(a, b))\n }\n}\n\n/**\n * Utility to wrap an equality function with debugging\n */\nexport const debugEquals = <T>(\n equalsFn: EqualityFunction<T>,\n debugName?: string\n): EqualityFunction<T> => {\n return (a: T, b: T): boolean => {\n const result = equalsFn(a, b)\n if (process.env.NODE_ENV === 'development') {\n console.log(`[${debugName || 'equals'}]`, { a, b, equal: result })\n }\n return result\n }\n}\n","/**\n * Unified Reactive Scheduler v2.0\n *\n * Eliminates duplicate update queues and provides enterprise-grade\n * reactive system with proper error handling and memory management.\n *\n * Replaces the existing duplicated queue systems in signal.ts and computed.ts\n */\n\nexport enum UpdatePriority {\n Immediate = 0, // Synchronous updates (rare)\n High = 1, // User interaction responses\n Normal = 2, // Regular updates\n Low = 3, // Background updates\n Idle = 4, // Idle time updates\n}\n\nexport interface ReactiveNode {\n readonly id: number\n readonly type: 'signal' | 'computed' | 'effect'\n readonly priority: UpdatePriority\n notify(): void\n cleanup(): void\n}\n\nexport class ReactiveError extends Error {\n constructor(\n message: string,\n public readonly cause: any,\n public readonly node: ReactiveNode\n ) {\n super(message)\n this.name = 'ReactiveError'\n }\n}\n\nexport interface ReactivePerformanceMetrics {\n totalNodes: number\n updateCycles: number\n averageUpdateTime: number\n memoryUsage: number\n errorCount: number\n}\n\n/**\n * Unified reactive scheduler that replaces all duplicate queue systems\n */\nexport class ReactiveScheduler {\n private static instance: ReactiveScheduler | null = null\n private updateQueues = new Map<UpdatePriority, Set<ReactiveNode>>()\n private isFlushPending = false\n private isDestroyed = false\n\n // Error handling\n private errorHandlers = new Set<(error: ReactiveError) => void>()\n private readonly maxRetries = 3\n\n // Performance tracking\n private totalUpdateCycles = 0\n private totalUpdateTime = 0\n private errorCount = 0\n private nodeRegistry = new WeakSet<ReactiveNode>()\n\n private constructor() {\n // Initialize priority queues\n for (const priority of Object.values(UpdatePriority)) {\n if (typeof priority === 'number') {\n this.updateQueues.set(priority, new Set())\n }\n }\n }\n\n static getInstance(): ReactiveScheduler {\n if (!ReactiveScheduler.instance) {\n ReactiveScheduler.instance = new ReactiveScheduler()\n }\n return ReactiveScheduler.instance\n }\n\n /**\n * Schedule reactive node for update\n */\n schedule(node: ReactiveNode): void {\n if (this.isDestroyed) return\n\n this.nodeRegistry.add(node)\n const queue = this.getQueue(node.priority)\n queue.add(node)\n\n if (!this.isFlushPending) {\n this.isFlushPending = true\n this.scheduleFlush(node.priority)\n }\n }\n\n /**\n * Process all queued updates by priority\n */\n private async flush(): Promise<void> {\n if (this.isDestroyed) return\n\n this.isFlushPending = false\n const startTime = performance.now()\n\n try {\n // Process queues in priority order\n for (const priority of [\n UpdatePriority.Immediate,\n UpdatePriority.High,\n UpdatePriority.Normal,\n UpdatePriority.Low,\n UpdatePriority.Idle,\n ]) {\n const queue = this.updateQueues.get(priority)\n if (!queue || queue.size === 0) continue\n\n const nodesToUpdate = Array.from(queue)\n queue.clear()\n\n // Process nodes with error handling\n for (const node of nodesToUpdate) {\n try {\n await this.updateNodeWithRetry(node)\n } catch (error) {\n this.handleReactiveError(\n new ReactiveError(`Failed to update ${node.type} node ${node.id}`, error, node)\n )\n }\n }\n\n // Allow higher priority updates to interrupt\n if (this.hasHigherPriorityWork(priority)) {\n return this.flush()\n }\n }\n\n this.totalUpdateCycles++\n } finally {\n const endTime = performance.now()\n this.totalUpdateTime += endTime - startTime\n }\n }\n\n /**\n * Update node with retry logic\n */\n private async updateNodeWithRetry(node: ReactiveNode, attempt = 1): Promise<void> {\n try {\n node.notify()\n } catch (error) {\n if (attempt < this.maxRetries) {\n console.warn(`Reactive update failed, retrying (${attempt}/${this.maxRetries})`)\n // Exponential backoff\n await new Promise((resolve) => setTimeout(resolve, attempt * 10))\n return this.updateNodeWithRetry(node, attempt + 1)\n } else {\n throw error\n }\n }\n }\n\n /**\n * Schedule flush based on priority\n */\n private scheduleFlush(priority: UpdatePriority): void {\n switch (priority) {\n case UpdatePriority.Immediate:\n // Synchronous update (use sparingly)\n void this.flush()\n break\n case UpdatePriority.High:\n // Next microtask for user interactions\n queueMicrotask(() => this.flush())\n break\n case UpdatePriority.Normal:\n // RequestAnimationFrame for normal updates\n if (typeof requestAnimationFrame !== 'undefined') {\n requestAnimationFrame(() => this.flush())\n } else {\n queueMicrotask(() => this.flush())\n }\n break\n case UpdatePriority.Low:\n case UpdatePriority.Idle:\n // Idle callback for low priority updates\n if (typeof requestIdleCallback !== 'undefined') {\n requestIdleCallback(() => this.flush(), { timeout: 1000 })\n } else {\n setTimeout(() => this.flush(), 50)\n }\n break\n }\n }\n\n /**\n * Check if there's higher priority work waiting\n */\n private hasHigherPriorityWork(currentPriority: UpdatePriority): boolean {\n for (let priority = UpdatePriority.Immediate; priority < currentPriority; priority++) {\n const queue = this.updateQueues.get(priority)\n if (queue && queue.size > 0) {\n return true\n }\n }\n return false\n }\n\n /**\n * Get queue for priority level\n */\n private getQueue(priority: UpdatePriority): Set<ReactiveNode> {\n const queue = this.updateQueues.get(priority)\n if (!queue) {\n throw new Error(`Invalid priority level: ${priority}`)\n }\n return queue\n }\n\n /**\n * Register error handler\n */\n onError(handler: (error: ReactiveError) => void): () => void {\n this.errorHandlers.add(handler)\n return () => this.errorHandlers.delete(handler)\n }\n\n /**\n * Handle reactive errors with recovery\n */\n private handleReactiveError(error: ReactiveError): void {\n this.errorCount++\n\n // Notify error handlers\n let handled = false\n for (const handler of this.errorHandlers) {\n try {\n handler(error)\n handled = true\n } catch (handlerError) {\n console.error('Error handler threw error:', handlerError)\n }\n }\n\n // If no handlers or all handlers failed, log and continue\n if (!handled) {\n console.error('Unhandled reactive error:', error)\n // In development, we might want to throw to surface errors\n if (process.env.NODE_ENV === 'development') {\n throw error\n }\n }\n }\n\n /**\n * Get performance metrics\n */\n getPerformanceMetrics(): ReactivePerformanceMetrics {\n let totalNodes = 0\n for (const queue of this.updateQueues.values()) {\n totalNodes += queue.size\n }\n\n return {\n totalNodes,\n updateCycles: this.totalUpdateCycles,\n averageUpdateTime:\n this.totalUpdateCycles > 0 ? this.totalUpdateTime / this.totalUpdateCycles : 0,\n memoryUsage: this.estimateMemoryUsage(),\n errorCount: this.errorCount,\n }\n }\n\n /**\n * Estimate memory usage (rough approximation)\n */\n private estimateMemoryUsage(): number {\n let usage = 0\n for (const queue of this.updateQueues.values()) {\n usage += queue.size * 50 // Rough estimate per node\n }\n usage += this.errorHandlers.size * 100 // Rough estimate per handler\n return usage\n }\n\n /**\n * Check if node is scheduled\n */\n hasNode(node: ReactiveNode): boolean {\n for (const queue of this.updateQueues.values()) {\n if (queue.has(node)) {\n return true\n }\n }\n return false\n }\n\n /**\n * Flush all pending updates synchronously\n */\n flushSync(): void {\n if (this.isFlushPending) {\n this.isFlushPending = false\n void this.flush()\n }\n }\n\n /**\n * Clear all pending updates\n */\n clearPending(): void {\n for (const queue of this.updateQueues.values()) {\n queue.clear()\n }\n this.isFlushPending = false\n }\n\n /**\n * Cleanup all reactive nodes and destroy scheduler\n */\n destroy(): void {\n this.isDestroyed = true\n\n // Cleanup all queued nodes\n for (const queue of this.updateQueues.values()) {\n for (const node of queue) {\n try {\n node.cleanup()\n } catch (error) {\n console.error('Error cleaning up reactive node:', error)\n }\n }\n queue.clear()\n }\n\n this.updateQueues.clear()\n this.errorHandlers.clear()\n ReactiveScheduler.instance = null\n }\n\n /**\n * Get debug information\n */\n getDebugInfo(): object {\n const queueInfo: Record<string, number> = {}\n for (const [priority, queue] of this.updateQueues) {\n queueInfo[UpdatePriority[priority]] = queue.size\n }\n\n return {\n isFlushPending: this.isFlushPending,\n isDestroyed: this.isDestroyed,\n queueSizes: queueInfo,\n errorHandlerCount: this.errorHandlers.size,\n performance: this.getPerformanceMetrics(),\n }\n }\n}\n","/**\n * Computed values implementation\n *\n * Computed values are derived reactive values that automatically\n * update when their dependencies change, with memoization.\n */\n\nimport { ComputationImpl, getCurrentComputation, getCurrentOwner } from './context'\nimport { defaultEquals, type EqualityFunction } from './equality'\nimport type { Computation, Owner, Signal } from './types'\nimport { ComputationState } from './types'\nimport { type ReactiveNode, UpdatePriority } from './unified-scheduler'\n\nexport interface ComputedOptions<T> {\n equals?: EqualityFunction<T>\n priority?: UpdatePriority\n debugName?: string\n onError?: (error: Error) => T // Error recovery function\n releaseOnNoObservers?: boolean\n}\n\n/**\n * Robust computed value implementation with error recovery\n */\nclass ComputedImpl<T> extends ComputationImpl implements ReactiveNode {\n readonly type = 'computed' as const\n readonly priority: UpdatePriority\n\n private _hasValue = false\n private _error: Error | null = null\n private equalsFn: EqualityFunction<T>\n private options: ComputedOptions<T>\n\n constructor(\n fn: () => T,\n options: ComputedOptions<T> = {},\n owner: Owner | null = getCurrentOwner()\n ) {\n super(fn, owner)\n this.priority = options.priority ?? UpdatePriority.Normal\n this.equalsFn = options.equals ?? defaultEquals\n this.options = options\n }\n\n /**\n * Get the computed value, tracking dependency and lazily computing\n */\n getValue(): T {\n // Track this computed as a dependency if we're in a reactive context\n const computation = getCurrentComputation()\n if (computation && computation.state !== ComputationState.Disposed) {\n this.observers.add(computation)\n computation.sources.add(this)\n }\n\n // Compute value if needed\n if (this.state === ComputationState.Dirty || !this._hasValue) {\n this.execute()\n this._hasValue = true\n }\n\n return this.value\n }\n\n /**\n * Get the current value without tracking dependency\n */\n peek(): T {\n if (this.state === ComputationState.Dirty || !this._hasValue) {\n this.execute()\n this._hasValue = true\n }\n return this.value\n }\n\n /**\n * Remove an observer (cleanup)\n */\n removeObserver(computation: Computation): void {\n this.observers.delete(computation)\n const shouldReleaseOnNoObservers =\n this.options.releaseOnNoObservers === true\n if (\n shouldReleaseOnNoObservers &&\n this.observers.size === 0 &&\n computation.state === ComputationState.Disposed\n ) {\n this.releaseSources()\n }\n }\n\n releaseSources(): void {\n for (const source of this.sources) {\n if ('removeObserver' in source) {\n ;(source as any).removeObserver(this)\n }\n }\n this.sources.clear()\n this._hasValue = false\n this.state = ComputationState.Dirty\n }\n\n /**\n * Execute the computation and notify observers\n */\n execute(): T {\n const previousValue = this._hasValue ? this.value : undefined\n const result = super.execute()\n\n // Only notify observers if the value actually changed\n if (!this._hasValue || !this.equalsFn(previousValue, result)) {\n // Notify dependent computations\n for (const observer of this.observers) {\n if (observer.state !== ComputationState.Disposed) {\n observer.state = ComputationState.Dirty\n // Use the signal's scheduling mechanism for consistency\n if ('execute' in observer && typeof observer.execute === 'function') {\n queueMicrotask(() => {\n if (observer.state === ComputationState.Dirty) {\n observer.execute()\n }\n })\n }\n }\n }\n }\n\n return result\n }\n\n /**\n * Notify method for ReactiveNode compatibility\n */\n notify(): void {\n // For computations, notify means execute\n this.execute()\n }\n\n /**\n * Complete cleanup for memory management\n */\n cleanup(): void {\n // Complete bidirectional cleanup\n for (const source of this.sources) {\n if ('removeObserver' in source) {\n ;(source as any).removeObserver(this)\n }\n }\n this.sources.clear()\n\n for (const observer of this.observers) {\n observer.sources.delete(this)\n }\n this.observers.clear()\n\n this._hasValue = false\n this._error = null\n this.state = ComputationState.Disposed\n }\n\n /**\n * Dispose the computed value\n */\n dispose(): void {\n this.cleanup()\n super.dispose()\n }\n\n /**\n * Debug information\n */\n [Symbol.for('tachui.debug')](): object {\n return {\n id: this.id,\n type: this.type,\n value: this._hasValue ? this.value : undefined,\n hasValue: this._hasValue,\n error: this._error?.message,\n state: this.state,\n sourceCount: this.sources.size,\n observerCount: this.observers.size,\n priority: UpdatePriority[this.priority],\n debugName: this.options.debugName,\n equalsFn: this.equalsFn.name || 'anonymous',\n }\n }\n\n toString(): string {\n return `Computed(${this.options.debugName || this.id}): ${this._hasValue ? this.value : 'no value'}`\n }\n}\n\n/**\n * Create a computed value that automatically updates when dependencies change\n *\n * @param fn The computation function\n * @param options Configuration options for the computed value\n * @returns An accessor function for the computed value\n *\n * @example\n * ```typescript\n * const [count, setCount] = createSignal(0)\n * const doubleCount = createComputed(() => count() * 2, {\n * debugName: 'doubleCounter',\n * onError: (error) => {\n * console.error('Computation failed:', error)\n * return 0 // fallback value\n * }\n * })\n *\n * console.log(doubleCount()) // 0\n * setCount(5)\n * console.log(doubleCount()) // 10\n * ```\n */\nexport function createComputed<T>(fn: () => T, options?: ComputedOptions<T>): Signal<T> {\n const computed = new ComputedImpl(fn, options)\n\n // Create bound accessor with peek method - this is already a Signal<T>\n const accessor = computed.getValue.bind(computed) as Signal<T>\n accessor.peek = computed.peek.bind(computed)\n\n // Add debug information\n Object.defineProperty(accessor, Symbol.for('tachui.computed'), {\n value: computed,\n enumerable: false,\n })\n\n return accessor\n}\n\n/**\n * Create a memo (alias for createComputed for SolidJS compatibility)\n */\nexport function createMemo<T>(fn: () => T, options?: ComputedOptions<T>): Signal<T> {\n return createComputed(fn, options)\n}\n\n/**\n * Type guard to check if a value is a computed\n */\nexport function isComputed<T = any>(value: any): value is Signal<T> {\n return typeof value === 'function' && Symbol.for('tachui.computed') in value\n}\n\n/**\n * Get the underlying computed implementation for debugging\n */\nexport function getComputedImpl<T>(computed: Signal<T>): ComputedImpl<T> | null {\n return (computed as any)[Symbol.for('tachui.computed')] || null\n}\n\nexport function releaseComputedSourcesIfUnobserved<T>(\n computed: Signal<T>\n): void {\n const impl = getComputedImpl(computed)\n if (!impl || impl.observers.size !== 0) {\n return\n }\n impl.releaseSources()\n}\n\n/**\n * Create a computed value with explicit dependency tracking\n *\n * @param fn The computation function\n * @param deps Explicit dependencies (optional)\n * @returns An accessor function for the computed value\n */\nexport function createDerivedSignal<T>(fn: () => T, deps?: (() => any)[]): Signal<T> {\n if (!deps) {\n return createComputed(fn)\n }\n\n // Wrap function to explicitly track dependencies\n const wrappedFn = () => {\n // Read all dependencies to track them\n for (const dep of deps) {\n dep()\n }\n return fn()\n }\n\n return createComputed(wrappedFn)\n}\n\n/**\n * Create a computed value that only updates when a condition is met\n *\n * @param fn The computation function\n * @param when Condition function that must return true for updates\n * @returns An accessor function for the computed value\n */\nexport function createConditionalComputed<T>(fn: () => T, when: () => boolean): Signal<T> {\n let lastValue: T\n let hasValue = false\n\n return createComputed(() => {\n if (when()) {\n lastValue = fn()\n hasValue = true\n }\n\n if (!hasValue) {\n lastValue = fn()\n hasValue = true\n }\n\n return lastValue\n })\n}\n\n/**\n * Public Computed type export\n */\nexport type Computed<T> = Signal<T>\n","/**\n * Signal implementation - core reactive primitive\n *\n * Signals are the foundation of TachUI's reactive system, providing\n * fine-grained reactivity similar to SolidJS signals.\n */\n\nimport {\n getCurrentComputation,\n isBatchingUpdates,\n setFlushFunction,\n} from './context'\nimport type { Computation, SignalImpl as ISignal } from './types'\nimport { ComputationState } from './types'\n\nlet signalIdCounter = 0\n\n/**\n * Signal setter function type\n */\nexport type SignalSetter<T> = (value: T | ((prev: T) => T)) => T\n\n/**\n * Internal signal implementation (keeping original behavior)\n */\nclass SignalImpl<T> implements ISignal<T> {\n readonly id: number\n readonly observers = new Set<Computation>()\n private _value: T\n\n constructor(initialValue: T) {\n this.id = ++signalIdCounter\n this._value = initialValue\n }\n\n /**\n * Get the current value and track dependency\n */\n getValue(): T {\n const computation = getCurrentComputation()\n if (computation && computation.state !== ComputationState.Disposed) {\n // Track this signal as a dependency\n this.observers.add(computation)\n computation.sources.add(this)\n } else {\n }\n return this._value\n }\n\n /**\n * Get the current value without tracking dependency\n */\n peek(): T {\n return this._value\n }\n\n /**\n * Set a new value and notify observers\n */\n set(newValue: T | ((prev: T) => T)): T {\n const value =\n typeof newValue === 'function'\n ? (newValue as (prev: T) => T)(this._value)\n : newValue\n\n if (value !== this._value) {\n this._value = value\n this.notify()\n } else {\n }\n\n return value\n }\n\n /**\n * Notify all observers that this signal has changed\n */\n private notify(): void {\n for (const observer of this.observers) {\n if (observer.state !== ComputationState.Disposed) {\n observer.state = ComputationState.Dirty\n scheduleUpdate(observer)\n } else {\n }\n }\n }\n\n /**\n * Remove an observer (cleanup)\n */\n removeObserver(computation: Computation): void {\n this.observers.delete(computation)\n }\n\n /**\n * Get debug information about this signal\n */\n [Symbol.for('tachui.debug')](): object {\n return {\n id: this.id,\n value: this._value,\n observerCount: this.observers.size,\n type: 'Signal',\n }\n }\n}\n\n/**\n * Update queue for batching reactive updates\n */\nconst updateQueue = new Set<Computation>()\nlet isFlushingUpdates = false\n\n/**\n * Schedule a computation for update\n */\nfunction scheduleUpdate(computation: Computation): void {\n updateQueue.add(computation)\n\n if (!isFlushingUpdates && !isBatchingUpdates()) {\n queueMicrotask(flushUpdates)\n }\n}\n\n/**\n * Flush all pending updates\n */\nfunction flushUpdates(): void {\n if (isFlushingUpdates) return\n\n isFlushingUpdates = true\n\n try {\n // Keep processing until no more computations are added\n while (updateQueue.size > 0) {\n // Process updates in order of computation ID for deterministic execution\n const computations = Array.from(updateQueue).sort((a, b) => a.id - b.id)\n updateQueue.clear()\n\n for (const computation of computations) {\n if (computation.state === ComputationState.Dirty) {\n computation.execute()\n }\n }\n }\n } finally {\n isFlushingUpdates = false\n }\n}\n\n/**\n * Create a new reactive signal\n *\n * @param initialValue The initial value of the signal\n * @returns A tuple of [getter, setter] functions\n *\n * @example\n * ```typescript\n * const [count, setCount] = createSignal(0)\n *\n * console.log(count()) // 0\n * setCount(5)\n * console.log(count()) // 5\n *\n * // Functional update\n * setCount(prev => prev + 1)\n * console.log(count()) // 6\n * ```\n */\nexport function createSignal<T>(initialValue: T): [() => T, SignalSetter<T>] {\n const signal = new SignalImpl(initialValue)\n\n const getter = signal.getValue.bind(signal) as (() => T) & { peek: () => T }\n getter.peek = signal.peek.bind(signal)\n\n const setter: SignalSetter<T> = signal.set.bind(signal)\n\n // Add debug information\n Object.defineProperty(getter, Symbol.for('tachui.signal'), {\n value: signal,\n enumerable: false,\n })\n\n return [getter, setter]\n}\n\n/**\n * Type guard to check if a value is a signal\n */\nexport function isSignal<T = any>(\n value: any\n): value is (() => T) & { peek: () => T } {\n return typeof value === 'function' && Symbol.for('tachui.signal') in value\n}\n\n/**\n * Get the underlying signal implementation for debugging\n */\nexport function getSignalImpl<T>(\n signal: (() => T) & { peek: () => T }\n): SignalImpl<T> | null {\n return (signal as any)[Symbol.for('tachui.signal')] || null\n}\n\n/**\n * Public Signal type export (callable getter)\n */\nexport type { Signal } from './types'\n\n// Export flush function for testing and manual control\nexport { flushUpdates as flushSync }\n\n// Register flush function with context module\nsetFlushFunction(flushUpdates)\n","/**\n * Theme Management System for TachUI\n *\n * Provides reactive theme management with light/dark mode support.\n */\n\nimport { createSignal } from './signal'\nimport { createComputed, type Computed } from './computed'\n\nexport type Theme = 'light' | 'dark' | 'system'\n\n// Global theme signal\nconst [currentTheme, setCurrentTheme] = createSignal<Theme>('light')\n\n// Function to get the current theme\nexport function getCurrentTheme(): Theme {\n const theme = currentTheme()\n if (theme === 'system') {\n return detectSystemTheme()\n }\n return theme\n}\n\n// Function to set the theme\nexport function setTheme(theme: Theme): void {\n setCurrentTheme(theme)\n}\n\n// Create a single shared computed theme signal\nconst themeComputed = createComputed(() => {\n const theme = currentTheme()\n if (theme === 'system') {\n return detectSystemTheme()\n }\n return theme\n})\n\n// Function to get the reactive theme signal for use in reactive effects\nexport function getThemeSignal(): Computed<'light' | 'dark'> {\n return themeComputed\n}\n\n// Auto-detect system theme\nexport function detectSystemTheme(): 'light' | 'dark' {\n if (typeof window !== 'undefined' && window.matchMedia) {\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'\n }\n return 'light'\n}\n","/**\n * Element Override System - Tag Specification Enhancement\n *\n * Enables components to override their default HTML tags for semantic markup,\n * improving SEO and accessibility while preserving all styling and functionality.\n */\n\n// import { DevelopmentWarnings } from './development-warnings'\n\nexport interface ElementOverrideProps {\n element?: string\n}\n\nexport interface ValidationResult {\n valid: boolean\n warnings?: Warning[]\n severity?: 'error' | 'warning' | 'info'\n warning?: string\n semanticRole?: SemanticRoleInfo\n}\n\nexport interface Warning {\n message: string\n severity: 'error' | 'warning' | 'info'\n}\n\nexport interface SemanticRoleInfo {\n role: string\n applyARIA: boolean\n}\n\nexport interface ElementOverrideConfig {\n // Accessibility\n autoApplySemanticRoles: boolean\n\n // Development warnings\n warnOnOverrides: boolean\n warnOnSemanticIssues: boolean\n\n // Validation\n validateTags: boolean\n allowInvalidTags: boolean\n}\n\n// Valid HTML tag validation\nexport const VALID_HTML_TAGS = new Set([\n // Container tags\n 'div',\n 'section',\n 'article',\n 'aside',\n 'nav',\n 'main',\n 'header',\n 'footer',\n // Heading tags\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n // Content tags\n 'p',\n 'span',\n 'strong',\n 'em',\n 'code',\n 'pre',\n 'blockquote',\n 'address',\n // List tags\n 'ul',\n 'ol',\n 'li',\n 'dl',\n 'dt',\n 'dd',\n // Interactive tags (with warnings)\n 'button',\n 'a',\n 'input',\n 'textarea',\n 'select',\n 'form',\n 'label',\n // Media tags\n 'img',\n 'video',\n 'audio',\n 'canvas',\n 'svg',\n 'picture',\n 'source',\n // Table tags\n 'table',\n 'thead',\n 'tbody',\n 'tfoot',\n 'tr',\n 'th',\n 'td',\n 'caption',\n 'colgroup',\n 'col',\n // Form tags\n 'fieldset',\n 'legend',\n 'optgroup',\n 'option',\n 'datalist',\n 'output',\n 'progress',\n 'meter',\n // Interactive content\n 'details',\n 'summary',\n 'dialog',\n // Text semantics\n 'abbr',\n 'cite',\n 'dfn',\n 'kbd',\n 'mark',\n 'q',\n 's',\n 'samp',\n 'small',\n 'sub',\n 'sup',\n 'time',\n 'u',\n 'var',\n // Document sections\n 'body',\n 'head',\n 'title',\n 'base',\n 'link',\n 'meta',\n 'style',\n 'script',\n 'noscript',\n // Embedded content\n 'embed',\n 'iframe',\n 'object',\n 'param',\n 'track',\n 'map',\n 'area',\n // Interactive elements\n 'menu',\n 'menuitem',\n])\n\nexport const SEMANTIC_TAG_ROLES = new Map<string, SemanticRoleInfo>([\n ['nav', { role: 'navigation', applyARIA: true }],\n ['main', { role: 'main', applyARIA: true }],\n ['article', { role: 'article', applyARIA: true }],\n ['section', { role: 'region', applyARIA: true }],\n ['aside', { role: 'complementary', applyARIA: true }],\n ['header', { role: 'banner', applyARIA: false }], // Context dependent - may not always be page banner\n ['footer', { role: 'contentinfo', applyARIA: false }], // Context dependent - may not always be page footer\n ['form', { role: 'form', applyARIA: true }],\n ['search', { role: 'search', applyARIA: true }],\n ['dialog', { role: 'dialog', applyARIA: true }],\n ['button', { role: 'button', applyARIA: false }], // Usually implicit\n ['a', { role: 'link', applyARIA: false }], // Usually implicit\n])\n\n/**\n * Component Eligibility Matrix - Warning Levels\n * Based on design/Enh-TagSpecification.md Component Eligibility Matrix\n */\nexport const COMPONENT_ELIGIBILITY = new Map<\n string,\n {\n warningLevel: 'none' | 'info' | 'warning'\n idealTags?: string[]\n problematicTags?: string[]\n }\n>([\n // Layout Components - Ideal for semantic containers (Warning Level: None)\n [\n 'HStack',\n {\n warningLevel: 'none',\n idealTags: [\n 'nav',\n 'header',\n 'footer',\n 'section',\n 'article',\n 'aside',\n 'main',\n 'div',\n ],\n },\n ],\n [\n 'VStack',\n {\n warningLevel: 'none',\n idealTags: [\n 'main',\n 'section',\n 'article',\n 'aside',\n 'header',\n 'footer',\n 'div',\n ],\n },\n ],\n [\n 'ZStack',\n { warningLevel: 'none', idealTags: ['article', 'aside', 'section', 'div'] },\n ],\n\n // Content Components - Common for specific overrides (Warning Level: None for appropriate tags)\n [\n 'Text',\n {\n warningLevel: 'none',\n idealTags: [\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'p',\n 'span',\n 'strong',\n 'em',\n ],\n },\n ],\n [\n 'Image',\n { warningLevel: 'warning', problematicTags: ['figure', 'picture'] },\n ], // May break functionality\n ['Spacer', { warningLevel: 'none' }],\n\n // Interactive Components - Use with warnings\n [\n 'Button',\n { warningLevel: 'warning', problematicTags: ['div', 'span', 'a'] },\n ], // May break accessibility\n [\n 'Link',\n { warningLevel: 'warning', problematicTags: ['div', 'span', 'button'] },\n ], // May break navigation\n])\n\n/**\n * Check if an element override should show a warning based on component eligibility matrix\n */\nexport function shouldWarnOnOverride(\n componentType: string,\n tag: string\n): boolean {\n const eligibility = COMPONENT_ELIGIBILITY.get(componentType)\n\n if (!eligibility) {\n // Unknown component - always warn for safety\n return true\n }\n\n // If component has no warning for any overrides\n if (eligibility.warningLevel === 'none') {\n return false\n }\n\n // If component warns for specific problematic tags\n if (eligibility.warningLevel === 'warning' && eligibility.problematicTags) {\n return eligibility.problematicTags.includes(tag)\n }\n\n // If component has ideal tags defined, only warn for non-ideal ones\n if (eligibility.idealTags && eligibility.idealTags.includes(tag)) {\n return false\n }\n\n // Default to warning for unknown combinations\n return true\n}\n\n/**\n * The applyARIA flag controls whether the framework automatically adds\n * the corresponding ARIA role attribute to elements with semantic tags.\n *\n * applyARIA: true - Always add the ARIA role (e.g., <nav> gets role=\"navigation\")\n * applyARIA: false - Don't automatically add ARIA role due to context sensitivity\n *\n * Examples:\n * - <nav> always represents navigation → applyARIA: true\n * - <header> could be page banner OR section header → applyARIA: false\n * - <footer> could be page footer OR article footer → applyARIA: false\n *\n * When applyARIA is false, developers should manually specify appropriate\n * ARIA roles using the .aria() modifier when semantic meaning is ambiguous.\n */\n\nexport class ElementTagValidator {\n static validate(tag: string, componentType: string): ValidationResult {\n if (!VALID_HTML_TAGS.has(tag)) {\n // Show development warning for invalid tags\n if (process.env.NODE_ENV !== 'production') {\n console.error(\n `Invalid tag '${tag}' for component type '${componentType}'`\n )\n }\n\n return {\n valid: false,\n warning: `Invalid HTML tag '${tag}' specified for ${componentType}. Tag will be used as-is.`,\n severity: 'error',\n }\n }\n\n // Check for potentially problematic combinations\n const warnings = this.checkSemanticWarnings(tag, componentType)\n\n return {\n valid: true,\n warnings,\n semanticRole: SEMANTIC_TAG_ROLES.get(tag),\n }\n }\n\n private static checkSemanticWarnings(\n tag: string,\n componentType: string\n ): Warning[] {\n const warnings: Warning[] = []\n\n // Warn about interactive tags on layout components\n if (['button', 'a', 'input', 'select', 'textarea'].includes(tag)) {\n if (['HStack', 'VStack', 'ZStack'].includes(componentType)) {\n const message = `Using interactive tag '${tag}' on layout component ${componentType} may cause accessibility issues.`\n warnings.push({ message, severity: 'warning' })\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Interactive tag '${tag}' on layout component '${componentType}' may cause unexpected behavior`\n )\n }\n }\n }\n\n // Warn about structural violations\n if (tag === 'li' && !['VStack', 'HStack'].includes(componentType)) {\n const message = `<li> tags should typically be used within list structures.`\n warnings.push({ message, severity: 'info' })\n if (process.env.NODE_ENV !== 'production') {\n console.info(\n `Consider using '${tag}' within <ul> or <ol> structure for component '${componentType}'`\n )\n }\n }\n\n // Warn about heading tags on layout components\n if (['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag)) {\n if (['HStack', 'VStack', 'ZStack'].includes(componentType)) {\n const message = `Using heading tag '${tag}' on layout component ${componentType}. Consider using Text component instead.`\n warnings.push({ message, severity: 'info' })\n if (process.env.NODE_ENV !== 'production') {\n console.info(\n `Heading tag '${tag}' is better suited for Text components than '${componentType}'`\n )\n }\n }\n }\n\n // Warn about form tags on non-form components\n if (['form', 'fieldset', 'legend'].includes(tag)) {\n if (!['VStack', 'HStack', 'Form'].includes(componentType)) {\n const message = `Form tag '${tag}' used on ${componentType}. Ensure proper form semantics.`\n warnings.push({ message, severity: 'info' })\n if (process.env.NODE_ENV !== 'production') {\n console.info(\n `Form tag '${tag}' requires proper semantic context for component '${componentType}'`\n )\n }\n }\n }\n\n return warnings\n }\n}\n\n// Global configuration\nlet globalConfig: ElementOverrideConfig = {\n autoApplySemanticRoles: true,\n warnOnOverrides: process.env.NODE_ENV !== 'production',\n warnOnSemanticIssues: process.env.NODE_ENV !== 'production',\n validateTags: true,\n allowInvalidTags: true,\n}\n\nexport function configureElementOverrides(\n config: Partial<ElementOverrideConfig>\n): void {\n globalConfig = { ...globalConfig, ...config }\n}\n\nexport function getElementOverrideConfig(): ElementOverrideConfig {\n return { ...globalConfig }\n}\n\n/**\n * Process element override for a component with validation and warnings\n */\nexport function processElementOverride(\n componentType: string,\n defaultTag: string,\n overrideTag?: string\n): { tag: string; validation: ValidationResult } {\n const effectiveTag = overrideTag || defaultTag\n const config = getElementOverrideConfig()\n\n // Always validate in development, even when validation is disabled\n let validation: ValidationResult = { valid: true }\n\n if (overrideTag) {\n // Show override warning if enabled and appropriate per component eligibility matrix\n if (\n config.warnOnOverrides &&\n shouldWarnOnOverride(componentType, overrideTag)\n ) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Element override: ${componentType} changed from '${defaultTag}' to '${overrideTag}'`\n )\n }\n }\n\n // Validate tag if enabled\n if (config.validateTags) {\n validation = ElementTagValidator.validate(overrideTag, componentType)\n\n // If validation fails and we don't allow invalid tags, use default\n if (!validation.valid && !config.allowInvalidTags) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Invalid tag '${overrideTag}' rejected for '${componentType}', using default '${defaultTag}' instead`\n )\n }\n return { tag: defaultTag, validation }\n }\n }\n }\n\n return { tag: effectiveTag, validation }\n}\n\n/**\n * Create element override validation helper for components\n */\nexport function createElementOverrideValidator(\n componentType: string,\n defaultTag: string\n) {\n return (overrideTag?: string) =>\n processElementOverride(componentType, defaultTag, overrideTag)\n}\n","/**\n * Modifier Registry and Application System\n *\n * Manages registration, storage, and application of modifiers to components.\n * Provides a centralized system for custom modifier registration and application.\n */\n\nimport type {\n ComponentInstance,\n ComponentProps,\n DOMNode,\n CloneOptions,\n} from \"../runtime/types\";\nimport { createModifierBuilder } from \"./builder\";\nimport type {\n ModifiableComponent,\n Modifier,\n ModifierApplicationOptions,\n ModifierContext,\n ModifierFactory,\n} from \"./types\";\nimport type { Concatenatable, ComponentSegment } from \"../concatenation/types\";\nimport { ConcatenatedComponent } from \"../concatenation/concatenated-component\";\n\n// Using global singleton registry from @tachui/registry instead of local implementation\n// The local ModifierRegistryImpl has been removed to prevent multiple registry instances\nimport { globalModifierRegistry as registrySingleton } from \"@tachui/registry\";\nimport type { ModifierRegistry as CoreModifierRegistry } from \"./types\";\n\n/**\n * Adapter to bridge between registry package and core package types\n */\nclass RegistryAdapter implements CoreModifierRegistry {\n register<TProps>(name: string, factory: ModifierFactory<TProps>): void {\n registrySingleton.register(name, factory as any);\n }\n\n get<TProps>(name: string): ModifierFactory<TProps> | undefined {\n return registrySingleton.get(name) as any;\n }\n\n has(name: string): boolean {\n return registrySingleton.has(name);\n }\n\n list(): string[] {\n return registrySingleton.list();\n }\n\n clear(): void {\n registrySingleton.clear();\n }\n\n validateRegistry(): {\n totalModifiers: number;\n duplicateNames: string[];\n orphanedReferences: any[];\n instanceId: string;\n createdAt: number;\n instanceCount: number;\n } {\n return (registrySingleton as any).validateRegistry();\n }\n}\n\n/**\n * Global modifier registry instance using singleton pattern\n */\nconst registryAdapter = new RegistryAdapter();\nexport { registryAdapter as globalModifierRegistry };\n\nif (process.env.NODE_ENV === \"development\") {\n console.log(\"📤 Created RegistryAdapter for globalModifierRegistry\", {\n registryId: (registrySingleton as any).instanceId,\n currentSize: registrySingleton.list().length,\n });\n}\n\n/**\n * Create a new modifier registry (returns singleton for consistency)\n */\nexport function createModifierRegistry(): CoreModifierRegistry {\n return registryAdapter;\n}\n\n/**\n * Apply modifiers to a DOM node\n */\nexport function applyModifiersToNode(\n node: DOMNode,\n modifiers: Modifier[],\n context: Partial<ModifierContext> = {},\n options: ModifierApplicationOptions = {},\n): DOMNode {\n if (!modifiers.length) return node;\n\n const fullContext: ModifierContext = {\n componentId: context.componentId || \"unknown\",\n phase: context.phase || \"creation\",\n ...(context.element && { element: context.element }),\n ...(context.parentElement && { parentElement: context.parentElement }),\n ...(context.componentInstance && {\n componentInstance: context.componentInstance,\n }),\n ...(context.previousModifiers && {\n previousModifiers: context.previousModifiers,\n }),\n };\n\n const strategy = options.batch ? \"batch\" : \"sequential\";\n\n switch (strategy) {\n case \"batch\":\n return applyModifiersBatch(node, modifiers, fullContext, options);\n default:\n return applyModifiersSequential(node, modifiers, fullContext, options);\n }\n}\n\n/**\n * Apply modifiers sequentially\n */\nfunction applyModifiersSequential(\n node: DOMNode,\n modifiers: Modifier[],\n context: ModifierContext,\n options: ModifierApplicationOptions,\n): DOMNode {\n // Sort modifiers by priority\n const sortedModifiers = [...modifiers].sort(\n (a, b) => a.priority - b.priority,\n );\n\n let currentNode = node;\n const effects: (() => void)[] = [];\n const cleanup: (() => void)[] = [];\n\n for (const modifier of sortedModifiers) {\n try {\n const result = modifier.apply(currentNode, context);\n\n if (result && typeof result === \"object\" && \"type\" in result) {\n currentNode = result;\n }\n\n if (options.immediate && !options.suppressEffects) {\n // Apply effects immediately\n effects.forEach((effect) => effect());\n effects.length = 0;\n }\n } catch (error) {\n console.error(`Failed to apply modifier ${modifier.type}:`, error);\n }\n }\n\n // Store cleanup functions on the node\n if (cleanup.length > 0) {\n const existingCleanup = currentNode.dispose;\n currentNode.dispose = () => {\n cleanup.forEach((fn) => fn());\n if (existingCleanup) existingCleanup();\n };\n }\n\n return currentNode;\n}\n\n/**\n * Apply modifiers in batch mode for better performance\n */\nfunction applyModifiersBatch(\n node: DOMNode,\n modifiers: Modifier[],\n context: ModifierContext,\n options: ModifierApplicationOptions,\n): DOMNode {\n // Group modifiers by type for more efficient application\n const modifierGroups = groupModifiersByType(modifiers);\n\n let currentNode = node;\n const allEffects: (() => void)[] = [];\n const allCleanup: (() => void)[] = [];\n\n // Apply each group\n for (const [type, groupModifiers] of modifierGroups) {\n try {\n currentNode = applyModifierGroup(currentNode, groupModifiers, context);\n } catch (error) {\n // Only log in non-test environments to avoid polluting test output\n if (typeof process === \"undefined\" || process.env.NODE_ENV !== \"test\") {\n console.error(`Failed to apply modifier group ${type}:`, error);\n }\n }\n }\n\n // Apply all effects at once if not suppressed\n if (!options.suppressEffects) {\n allEffects.forEach((effect) => effect());\n }\n\n // Store cleanup functions\n if (allCleanup.length > 0) {\n const existingCleanup = currentNode.dispose;\n currentNode.dispose = () => {\n allCleanup.forEach((fn) => fn());\n if (existingCleanup) existingCleanup();\n };\n }\n\n return currentNode;\n}\n\n/**\n * Group modifiers by type for batch processing\n */\nfunction groupModifiersByType(modifiers: Modifier[]): Map<string, Modifier[]> {\n const groups = new Map<string, Modifier[]>();\n\n for (const modifier of modifiers) {\n const existing = groups.get(modifier.type) || [];\n existing.push(modifier);\n groups.set(modifier.type, existing);\n }\n\n return groups;\n}\n\n/**\n * Apply a group of modifiers of the same type\n */\nfunction applyModifierGroup(\n node: DOMNode,\n modifiers: Modifier[],\n context: ModifierContext,\n): DOMNode {\n // Sort by priority within the group\n const sortedModifiers = [...modifiers].sort(\n (a, b) => a.priority - b.priority,\n );\n\n let currentNode = node;\n\n for (const modifier of sortedModifiers) {\n try {\n const result = modifier.apply(currentNode, context);\n if (result && typeof result === \"object\" && \"type\" in result) {\n currentNode = result;\n }\n } catch (error) {\n // In batch mode, individual modifier failures shouldn't break the entire batch\n // Only log in non-test environments to avoid polluting test output\n if (typeof process === \"undefined\" || process.env.NODE_ENV !== \"test\") {\n console.error(`Failed to apply modifier ${modifier.type}:`, error);\n }\n // Continue with the next modifier\n }\n }\n\n return currentNode;\n}\n\n/**\n * Helper function to check if a component implements Concatenatable\n */\nfunction isConcatenatable(component: any): component is Concatenatable {\n return (\n component &&\n typeof component.concat === \"function\" &&\n typeof component.toSegment === \"function\" &&\n typeof component.isConcatenatable === \"function\"\n );\n}\n\n/**\n * Create a modifiable component from a regular component\n */\nexport function createModifiableComponent<P extends ComponentProps>(\n component: ComponentInstance<P>,\n initialModifiers: Modifier[] = [],\n): ModifiableComponent<P> {\n // Create a proper copy to avoid shared references\n const modifiableComponent: ModifiableComponent<P> = {\n type: component.type,\n id: component.id,\n props: { ...component.props },\n mounted: component.mounted,\n cleanup: component.cleanup ? [...component.cleanup] : [],\n modifiers: [...initialModifiers],\n modifierBuilder: null as any, // Will be set after component is created\n render: component.render ? component.render.bind(component) : () => [], // Bind to original component or provide default\n // Store reference to original component for modifier context\n _originalComponent: component,\n };\n\n // Create modifier builder with the modifiable component so it can update the right modifiers array\n modifiableComponent.modifierBuilder = createModifierBuilder(\n modifiableComponent,\n ) as any;\n\n (modifiableComponent as any).modifier = modifiableComponent.modifierBuilder as any\n\n if (!Object.prototype.hasOwnProperty.call(component, 'modifier')) {\n Object.defineProperty(component, 'modifier', {\n configurable: true,\n enumerable: false,\n get() {\n return modifiableComponent.modifierBuilder;\n },\n });\n }\n\n // Store reference to modifiable component so Button can access modifiers\n (component as any).modifiableComponent = modifiableComponent;\n\n // CRITICAL: Preserve enhanced lifecycle hooks when creating modifiable components\n const enhancedLifecycle = (component as any)._enhancedLifecycle;\n if (enhancedLifecycle) {\n // Preserve the enhanced lifecycle hooks\n (modifiableComponent as any)._enhancedLifecycle = enhancedLifecycle;\n\n // Also preserve other component properties that might be important\n if (\"domElements\" in component) {\n (modifiableComponent as any).domElements = component.domElements;\n }\n if (\"primaryElement\" in component) {\n (modifiableComponent as any).primaryElement = component.primaryElement;\n }\n if (\"domReady\" in component) {\n (modifiableComponent as any).domReady = component.domReady;\n }\n if (\"children\" in component) {\n (modifiableComponent as any).children = component.children;\n }\n }\n\n // Enhance the render function to attach modifiers for later application\n const originalRender = component.render\n ? component.render.bind(component)\n : () => [];\n modifiableComponent.render = () => {\n const renderResult = originalRender();\n const nodes = Array.isArray(renderResult) ? renderResult : [renderResult];\n\n // CRITICAL FIX: Only attach modifiers to the root node (first node)\n // not to all child nodes which was causing modifier bleed-through\n return nodes.map((node: any, index: number) => {\n if (node && typeof node === \"object\") {\n // Only attach modifiers to the root node (index 0)\n if (index === 0) {\n node.modifiers = [...modifiableComponent.modifiers];\n node.componentId = component.id;\n node._originalComponent = modifiableComponent._originalComponent;\n } else {\n // Ensure no modifiers leak to non-root nodes\n if (node.modifiers) {\n delete node.modifiers;\n }\n if (node.componentId && node.componentId === component.id) {\n delete node.componentId;\n }\n }\n return node;\n }\n return node;\n });\n };\n\n // If the original component supports concatenation, add concatenation methods to modifiable component\n if (isConcatenatable(component)) {\n (modifiableComponent as any).concat = function <\n U extends Concatenatable<any>,\n >(other: U): ConcatenatedComponent<P | U> {\n // Create segment for this modifiable component\n const thisSegment: ComponentSegment = {\n id: modifiableComponent.id,\n component: modifiableComponent,\n modifiers: modifiableComponent.modifiers,\n render: () => {\n const result = modifiableComponent.render();\n return Array.isArray(result) ? result[0] : result;\n },\n };\n\n // Get segment from other component\n const otherSegment = other.toSegment();\n\n // Create concatenated component with appropriate metadata\n const metadata = {\n totalSegments:\n other instanceof ConcatenatedComponent\n ? other.segments.length + 1\n : 2,\n accessibilityRole: \"text\" as const, // Simplified for now\n semanticStructure: \"inline\" as const, // Simplified for now\n };\n\n if (other instanceof ConcatenatedComponent) {\n return new ConcatenatedComponent(\n [thisSegment, ...other.segments],\n metadata,\n );\n }\n\n return new ConcatenatedComponent([thisSegment, otherSegment], metadata);\n };\n (modifiableComponent as any).toSegment = function (): ComponentSegment {\n return {\n id: modifiableComponent.id,\n component: modifiableComponent,\n modifiers: modifiableComponent.modifiers,\n render: () => {\n const result = modifiableComponent.render();\n return Array.isArray(result) ? result[0] : result;\n },\n };\n };\n (modifiableComponent as any).isConcatenatable = function (): boolean {\n return true;\n };\n }\n\n if (typeof (component as any)?.clone === \"function\") {\n (modifiableComponent as any).clone = (options?: CloneOptions) => {\n const clonedOriginal = (component as any).clone(options)\n return createModifiableComponent(\n clonedOriginal,\n [...modifiableComponent.modifiers],\n ) as any\n }\n }\n\n return modifiableComponent;\n}\n\n/**\n * Update modifiers on an existing modifiable component\n */\nexport function updateComponentModifiers<P extends ComponentProps>(\n component: ModifiableComponent<P>,\n newModifiers: Modifier[],\n _options: ModifierApplicationOptions = {},\n): void {\n // const _previousModifiers = component.modifiers\n component.modifiers = [...newModifiers];\n\n // If the component is mounted, reapply modifiers\n if (component.mounted && component.context) {\n // This would require access to the actual DOM element\n // Implementation would depend on the component mounting system\n }\n}\n\n/**\n * Modifier application utilities\n */\nexport const modifierApplicationUtils = {\n /**\n * Check if a component has specific modifier types\n */\n hasModifierOfType(component: ModifiableComponent, type: string): boolean {\n return component.modifiers.some((modifier) => modifier.type === type);\n },\n\n /**\n * Get modifiers of a specific type from a component\n */\n getModifiersOfType(component: ModifiableComponent, type: string): Modifier[] {\n return component.modifiers.filter((modifier) => modifier.type === type);\n },\n\n /**\n * Remove modifiers of a specific type from a component\n */\n removeModifiersOfType(component: ModifiableComponent, type: string): void {\n component.modifiers = component.modifiers.filter(\n (modifier) => modifier.type !== type,\n );\n },\n\n /**\n * Replace modifiers of a specific type\n */\n replaceModifiersOfType(\n component: ModifiableComponent,\n type: string,\n newModifiers: Modifier[],\n ): void {\n // Remove existing modifiers of this type\n component.modifiers = component.modifiers.filter(\n (modifier) => modifier.type !== type,\n );\n\n // Add new modifiers\n component.modifiers.push(...newModifiers);\n },\n\n /**\n * Get the total number of modifiers on a component\n */\n getModifierCount(component: ModifiableComponent): number {\n return component.modifiers.length;\n },\n\n /**\n * Check if two modifier arrays are equivalent\n */\n areModifiersEqual(modifiers1: Modifier[], modifiers2: Modifier[]): boolean {\n if (modifiers1.length !== modifiers2.length) return false;\n\n for (let i = 0; i < modifiers1.length; i++) {\n const m1 = modifiers1[i];\n const m2 = modifiers2[i];\n\n if (m1.type !== m2.type || m1.priority !== m2.priority) {\n return false;\n }\n\n // Deep compare properties (simplified)\n if (JSON.stringify(m1.properties) !== JSON.stringify(m2.properties)) {\n return false;\n }\n }\n\n return true;\n },\n};\n","/**\n * Package Information\n *\n * Provides consistent package name and version exports across all TachUI packages\n */\n\nimport * as packageJson from '../package.json'\n\n/**\n * The name of this TachUI package (from package.json)\n */\nexport const TACHUI_PACKAGE = (packageJson as any).name\n\n/**\n * The version of this TachUI package (from package.json)\n */\nexport const TACHUI_PACKAGE_VERSION = (packageJson as any).version\n\n/**\n * Legacy version export for backwards compatibility\n * @deprecated Use TACHUI_PACKAGE_VERSION instead\n */\nexport const VERSION = (packageJson as any).version\n","import { globalModifierRegistry } from '@tachui/registry'\nimport type {\n ModifierFactory,\n ModifierMetadata,\n ModifierRegistry,\n PluginInfo,\n} from '@tachui/registry'\nimport type { Modifier } from './types'\nimport { TACHUI_PACKAGE_VERSION } from '../version'\n\nconst metadataEnabledRegistries = new WeakSet<ModifierRegistry>()\nconst registeredPlugins = new WeakMap<ModifierRegistry, Set<string>>()\n\nexport const CORE_PLUGIN_INFO: PluginInfo = {\n name: '@tachui/core',\n version: TACHUI_PACKAGE_VERSION,\n author: 'TachUI Team',\n verified: true,\n}\n\nfunction ensureMetadataRegistration(registry: ModifierRegistry) {\n if (metadataEnabledRegistries.has(registry)) {\n return\n }\n registry.setFeatureFlags({\n metadataRegistration: true,\n })\n metadataEnabledRegistries.add(registry)\n}\n\nfunction ensurePluginRegistered(\n registry: ModifierRegistry,\n plugin: PluginInfo,\n) {\n let plugins = registeredPlugins.get(registry)\n if (!plugins) {\n plugins = new Set<string>()\n registeredPlugins.set(registry, plugins)\n }\n\n if (plugins.has(plugin.name)) {\n return\n }\n\n registry.registerPlugin(plugin)\n plugins.add(plugin.name)\n}\n\ntype AnyModifierFactory<T = any> =\n | ModifierFactory<T>\n | ((...args: any[]) => Modifier)\n\nexport function registerModifierWithMetadata<T>(\n name: string,\n factory: AnyModifierFactory<T>,\n metadata: Omit<ModifierMetadata, 'name' | 'plugin'>,\n registry: ModifierRegistry = globalModifierRegistry,\n plugin: PluginInfo = CORE_PLUGIN_INFO,\n) {\n ensureMetadataRegistration(registry)\n ensurePluginRegistered(registry, plugin)\n\n if (!registry.has(name)) {\n registry.register(name, factory as ModifierFactory<T>)\n }\n\n if (!registry.getMetadata(name)) {\n registry.registerMetadata({\n ...metadata,\n name,\n plugin: plugin.name,\n })\n }\n}\n","/**\n * Package Information\n *\n * Provides consistent package name and version exports for @tachui/responsive.\n */\n\nimport * as packageJson from '../package.json'\n\nexport const TACHUI_PACKAGE = (packageJson as any).name\nexport const TACHUI_PACKAGE_VERSION = (packageJson as any).version\n","/**\n * Responsive Design System Types\n *\n * CSS-Native media query and responsive design type definitions for tachUI.\n * Provides comprehensive type safety for responsive modifiers while maintaining\n * backward compatibility with existing modifier system.\n */\n\n/**\n * Standard breakpoint identifiers following Tailwind conventions\n */\nexport type BreakpointKey = 'base' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n\n/**\n * Breakpoint configuration mapping breakpoint keys to CSS values\n */\nexport interface BreakpointConfig {\n base?: string // Mobile-first base (no media query)\n sm?: string // 640px+ (small tablets and large phones)\n md?: string // 768px+ (tablets)\n lg?: string // 1024px+ (laptops and small desktops)\n xl?: string // 1280px+ (large desktops)\n '2xl'?: string // 1536px+ (extra large screens)\n}\n\n/**\n * Default breakpoint values (Tailwind-inspired)\n */\nexport const DEFAULT_BREAKPOINTS: Required<BreakpointConfig> = {\n base: '0px', // Mobile-first base\n sm: '640px', // Small tablets and large phones\n md: '768px', // Tablets\n lg: '1024px', // Laptops and small desktops\n xl: '1280px', // Large desktops\n '2xl': '1536px', // Extra large screens\n} as const\n\n/**\n * Responsive value type that accepts either a single value or breakpoint-specific values\n */\nexport type ResponsiveValue<T> = T | Partial<Record<BreakpointKey, T>>\n\n/**\n * CSS property values that can be responsive\n */\nexport type ResponsiveCSSValue = ResponsiveValue<string | number>\n\n/**\n * Advanced media query configuration for custom responsive behavior\n */\nexport interface MediaQueryConfig {\n query: string // Raw CSS media query\n styles: Record<string, string | number> // CSS properties to apply\n}\n\n/**\n * Responsive modifier configuration combining breakpoints and custom media queries\n */\nexport interface ResponsiveModifierConfig<T = any> {\n breakpoints?: Partial<Record<BreakpointKey, T>>\n mediaQueries?: MediaQueryConfig[]\n fallback?: T // Fallback value if no conditions match\n}\n\n/**\n * Responsive layout configuration for common responsive patterns\n */\nexport interface ResponsiveLayoutConfig {\n direction?: ResponsiveValue<\n 'row' | 'column' | 'row-reverse' | 'column-reverse'\n >\n wrap?: ResponsiveValue<'nowrap' | 'wrap' | 'wrap-reverse'>\n justify?: ResponsiveValue<\n | 'flex-start'\n | 'flex-end'\n | 'center'\n | 'space-between'\n | 'space-around'\n | 'space-evenly'\n >\n align?: ResponsiveValue<\n 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline'\n >\n gap?: ResponsiveValue<number | string>\n}\n\n/**\n * Responsive typography configuration\n */\nexport interface ResponsiveTypographyConfig {\n fontSize?: ResponsiveValue<number | string>\n lineHeight?: ResponsiveValue<number | string>\n letterSpacing?: ResponsiveValue<number | string>\n fontWeight?: ResponsiveValue<number | string>\n textAlign?: ResponsiveValue<'left' | 'center' | 'right' | 'justify'>\n textTransform?: ResponsiveValue<\n 'none' | 'uppercase' | 'lowercase' | 'capitalize'\n >\n}\n\n/**\n * Responsive spacing configuration\n */\nexport interface ResponsiveSpacingConfig {\n top?: ResponsiveValue<number | string>\n right?: ResponsiveValue<number | string>\n bottom?: ResponsiveValue<number | string>\n left?: ResponsiveValue<number | string>\n horizontal?: ResponsiveValue<number | string> // left + right\n vertical?: ResponsiveValue<number | string> // top + bottom\n all?: ResponsiveValue<number | string> // all sides\n}\n\n/**\n * Responsive dimension configuration\n */\nexport interface ResponsiveDimensionConfig {\n width?: ResponsiveValue<number | string>\n height?: ResponsiveValue<number | string>\n minWidth?: ResponsiveValue<number | string>\n maxWidth?: ResponsiveValue<number | string>\n minHeight?: ResponsiveValue<number | string>\n maxHeight?: ResponsiveValue<number | string>\n}\n\n/**\n * Responsive visibility configuration\n */\nexport interface ResponsiveVisibilityConfig {\n display?: ResponsiveValue<\n | 'none'\n | 'block'\n | 'inline'\n | 'inline-block'\n | 'flex'\n | 'inline-flex'\n | 'grid'\n | 'inline-grid'\n >\n visibility?: ResponsiveValue<'visible' | 'hidden' | 'collapse'>\n opacity?: ResponsiveValue<number>\n}\n\n/**\n * Comprehensive responsive style configuration\n */\nexport interface ResponsiveStyleConfig\n extends ResponsiveLayoutConfig,\n ResponsiveTypographyConfig,\n ResponsiveDimensionConfig,\n ResponsiveVisibilityConfig {\n // Additional CSS properties that can be responsive\n backgroundColor?: ResponsiveValue<string>\n color?: ResponsiveValue<string>\n border?: ResponsiveValue<string>\n borderRadius?: ResponsiveValue<number | string>\n boxShadow?: ResponsiveValue<string>\n transform?: ResponsiveValue<string>\n transition?: ResponsiveValue<string>\n\n // Spacing\n padding?: ResponsiveSpacingConfig | ResponsiveValue<number | string>\n margin?: ResponsiveSpacingConfig | ResponsiveValue<number | string>\n\n // Custom CSS properties\n [key: string]: any\n}\n\n/**\n * Breakpoint context information for responsive utilities\n */\nexport interface BreakpointContext {\n current: BreakpointKey\n width: number\n height: number\n isAbove: (breakpoint: BreakpointKey) => boolean\n isBelow: (breakpoint: BreakpointKey) => boolean\n isBetween: (min: BreakpointKey, max: BreakpointKey) => boolean\n matches: (query: string) => boolean\n}\n\n/**\n * Responsive modifier factory configuration\n */\nexport interface ResponsiveModifierFactoryConfig {\n breakpoints?: BreakpointConfig\n generateCSS?: boolean // Generate CSS media queries vs JavaScript\n fallbackToJS?: boolean // Fallback to JavaScript if CSS not supported\n optimizeOutput?: boolean // Optimize generated CSS\n debugMode?: boolean // Enable responsive debugging\n}\n\n/**\n * CSS media query generation result\n */\nexport interface GeneratedMediaQuery {\n breakpoint: BreakpointKey\n query: string // CSS media query string\n styles: Record<string, string | number> // CSS properties\n selector: string // CSS selector\n}\n\n/**\n * Responsive modifier application result\n */\nexport interface ResponsiveModifierResult {\n cssRules: string[] // Generated CSS rules\n mediaQueries: GeneratedMediaQuery[] // Generated media queries\n fallbackStyles: Record<string, string | number> // Fallback styles for base\n hasResponsiveStyles: boolean // Whether responsive styles were applied\n}\n\n/**\n * Type guard to check if a value is responsive\n */\nexport function isResponsiveValue<T>(\n value: ResponsiveValue<T>\n): value is Partial<Record<BreakpointKey, T>> {\n return (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n Object.keys(value).some(key =>\n ['base', 'sm', 'md', 'lg', 'xl', '2xl'].includes(key)\n )\n )\n}\n\n/**\n * Type guard to check if a breakpoint key is valid\n */\nexport function isValidBreakpointKey(key: string): key is BreakpointKey {\n return ['base', 'sm', 'md', 'lg', 'xl', '2xl'].includes(key)\n}\n\n/**\n * Utility type to make any property responsive\n */\nexport type MakeResponsive<T> = {\n [K in keyof T]: ResponsiveValue<T[K]>\n}\n\n/**\n * Extract responsive properties from a configuration object\n */\nexport type ResponsiveProperties<T> = {\n [K in keyof T as T[K] extends ResponsiveValue<any> ? K : never]: T[K]\n}\n\n/**\n * Extract non-responsive properties from a configuration object\n */\nexport type NonResponsiveProperties<T> = {\n [K in keyof T as T[K] extends ResponsiveValue<any> ? never : K]: T[K]\n}\n","/**\n * Breakpoint Configuration System\n *\n * Manages responsive breakpoint configuration, validation, and utilities.\n * Supports both default Tailwind-inspired breakpoints and custom configurations.\n */\n\nimport {\n BreakpointKey,\n BreakpointConfig,\n DEFAULT_BREAKPOINTS,\n BreakpointContext,\n isValidBreakpointKey,\n} from './types'\nimport { createSignal } from '@tachui/core'\nimport type { Signal } from '@tachui/core/reactive/types'\n\n/**\n * Global breakpoint configuration state\n */\nlet currentBreakpointConfig: Required<BreakpointConfig> = {\n ...DEFAULT_BREAKPOINTS,\n}\n\n/**\n * Current active breakpoint signal\n */\nconst [currentBreakpoint, setCurrentBreakpoint] =\n createSignal<BreakpointKey>('base')\n\n/**\n * Current viewport dimensions signal\n */\nconst [viewportDimensions, setViewportDimensions] = createSignal({\n width: 0,\n height: 0,\n})\n\nlet responsiveSystemInitialized = false\nconst resizeListener = (): void => {\n updateViewportDimensions()\n updateCurrentBreakpoint()\n}\nconst orientationChangeListener = (): void => {\n // Delay to ensure accurate dimensions after orientation change\n setTimeout(() => {\n updateViewportDimensions()\n updateCurrentBreakpoint()\n }, 100)\n}\n\n/**\n * Configure global breakpoints for the application\n */\nexport function configureBreakpoints(config: Partial<BreakpointConfig>): void {\n // Validate breakpoint configuration\n validateBreakpointConfig(config)\n\n // Update global configuration\n currentBreakpointConfig = {\n ...DEFAULT_BREAKPOINTS,\n ...config,\n }\n\n // Re-evaluate current breakpoint\n updateCurrentBreakpoint()\n\n if (typeof window !== 'undefined') {\n // Update breakpoint on window resize\n window.addEventListener('resize', updateCurrentBreakpoint)\n }\n}\n\n/**\n * Get the current breakpoint configuration\n */\nexport function getCurrentBreakpointConfig(): Required<BreakpointConfig> {\n return { ...currentBreakpointConfig }\n}\n\n/**\n * Get the current active breakpoint\n */\nexport function getCurrentBreakpoint(): Signal<BreakpointKey> {\n return currentBreakpoint as Signal<BreakpointKey>\n}\n\n/**\n * Get current viewport dimensions\n */\nexport function getViewportDimensions(): Signal<{\n width: number\n height: number\n}> {\n return viewportDimensions as Signal<{ width: number; height: number }>\n}\n\n/**\n * Initialize the responsive system (should be called once on app startup)\n */\nexport function initializeResponsiveSystem(): void {\n if (typeof window === 'undefined') {\n return // Skip on server-side\n }\n\n if (responsiveSystemInitialized) {\n return\n }\n\n // Set initial viewport dimensions\n updateViewportDimensions()\n updateCurrentBreakpoint()\n\n // Listen for window resize events\n window.addEventListener('resize', resizeListener)\n\n // Listen for orientation changes\n window.addEventListener('orientationchange', orientationChangeListener)\n responsiveSystemInitialized = true\n}\n\n/**\n * Test helper: synchronize responsive signals from the current window dimensions.\n */\nexport function __syncResponsiveSignalsForTests(): void {\n if (typeof window === 'undefined') {\n return\n }\n\n updateViewportDimensions()\n updateCurrentBreakpoint()\n}\n\n/**\n * Test helper: reset responsive singleton state and detach global listeners.\n */\nexport function __resetResponsiveSystemForTests(): void {\n currentBreakpointConfig = {\n ...DEFAULT_BREAKPOINTS,\n }\n setCurrentBreakpoint('base')\n setViewportDimensions({\n width: 0,\n height: 0,\n })\n\n if (typeof window !== 'undefined' && responsiveSystemInitialized) {\n window.removeEventListener('resize', resizeListener)\n window.removeEventListener('orientationchange', orientationChangeListener)\n }\n\n responsiveSystemInitialized = false\n}\n\n/**\n * Create a breakpoint context for utilities\n */\nexport function createBreakpointContext(): BreakpointContext {\n const current = currentBreakpoint()\n const dimensions = viewportDimensions()\n\n return {\n current,\n width: dimensions.width,\n height: dimensions.height,\n isAbove: (breakpoint: BreakpointKey) =>\n isBreakpointAbove(current, breakpoint),\n isBelow: (breakpoint: BreakpointKey) =>\n isBreakpointBelow(current, breakpoint),\n isBetween: (min: BreakpointKey, max: BreakpointKey) =>\n isBreakpointAbove(current, min) && isBreakpointBelow(current, max),\n matches: (query: string) => window.matchMedia(query).matches,\n }\n}\n\n/**\n * Convert breakpoint value to numeric pixels for comparison\n */\nexport function breakpointToPixels(breakpoint: BreakpointKey): number {\n const value = currentBreakpointConfig[breakpoint]\n\n // Handle different CSS units\n if (value.endsWith('px')) {\n return parseInt(value, 10)\n } else if (value.endsWith('em')) {\n return parseInt(value, 10) * 16 // Assume 16px base font size\n } else if (value.endsWith('rem')) {\n return parseInt(value, 10) * 16 // Assume 16px base font size\n }\n\n // Fallback to direct number conversion\n return parseInt(value, 10) || 0\n}\n\n/**\n * Get breakpoint index for comparison (base = 0, sm = 1, etc.)\n */\nexport function getBreakpointIndex(breakpoint: BreakpointKey): number {\n const order: BreakpointKey[] = ['base', 'sm', 'md', 'lg', 'xl', '2xl']\n return order.indexOf(breakpoint)\n}\n\n/**\n * Check if breakpoint A is above breakpoint B\n */\nexport function isBreakpointAbove(a: BreakpointKey, b: BreakpointKey): boolean {\n return getBreakpointIndex(a) > getBreakpointIndex(b)\n}\n\n/**\n * Check if breakpoint A is below breakpoint B\n */\nexport function isBreakpointBelow(a: BreakpointKey, b: BreakpointKey): boolean {\n return getBreakpointIndex(a) < getBreakpointIndex(b)\n}\n\n/**\n * Generate CSS media query string for a breakpoint\n */\nexport function generateMediaQuery(breakpoint: BreakpointKey): string {\n if (breakpoint === 'base') {\n return '' // No media query for base (mobile-first)\n }\n\n const minWidth = currentBreakpointConfig[breakpoint]\n return `(min-width: ${minWidth})`\n}\n\n/**\n * Generate CSS media query for a range of breakpoints\n */\nexport function generateRangeMediaQuery(\n min: BreakpointKey,\n max?: BreakpointKey\n): string {\n const queries: string[] = []\n\n if (min !== 'base') {\n queries.push(`(min-width: ${currentBreakpointConfig[min]})`)\n }\n\n if (max && max !== '2xl') {\n const maxBreakpoints: BreakpointKey[] = ['sm', 'md', 'lg', 'xl', '2xl']\n const maxIndex = maxBreakpoints.indexOf(max)\n if (maxIndex >= 0 && maxIndex < maxBreakpoints.length - 1) {\n const nextBreakpoint = maxBreakpoints[maxIndex + 1]\n const maxWidth = `${breakpointToPixels(nextBreakpoint) - 1}px`\n queries.push(`(max-width: ${maxWidth})`)\n }\n }\n\n return queries.length > 0 ? queries.join(' and ') : ''\n}\n\n/**\n * Get all breakpoints sorted by size\n */\nexport function getSortedBreakpoints(): BreakpointKey[] {\n return ['base', 'sm', 'md', 'lg', 'xl', '2xl']\n}\n\n/**\n * Get breakpoints above a given breakpoint\n */\nexport function getBreakpointsAbove(\n breakpoint: BreakpointKey\n): BreakpointKey[] {\n const sorted = getSortedBreakpoints()\n const index = sorted.indexOf(breakpoint)\n return index >= 0 ? sorted.slice(index + 1) : []\n}\n\n/**\n * Get breakpoints below a given breakpoint\n */\nexport function getBreakpointsBelow(\n breakpoint: BreakpointKey\n): BreakpointKey[] {\n const sorted = getSortedBreakpoints()\n const index = sorted.indexOf(breakpoint)\n return index > 0 ? sorted.slice(0, index) : []\n}\n\n/**\n * Resolve current breakpoint based on viewport width\n */\nfunction updateCurrentBreakpoint(): void {\n if (typeof window === 'undefined') {\n return\n }\n\n const width = window.innerWidth\n const breakpoints = getSortedBreakpoints().reverse() // Start from largest\n\n for (const breakpoint of breakpoints) {\n if (breakpoint === 'base' || width >= breakpointToPixels(breakpoint)) {\n setCurrentBreakpoint(breakpoint)\n return\n }\n }\n\n setCurrentBreakpoint('base')\n}\n\n/**\n * Update viewport dimensions\n */\nfunction updateViewportDimensions(): void {\n if (typeof window !== 'undefined') {\n setViewportDimensions({\n width: window.innerWidth,\n height: window.innerHeight,\n })\n }\n}\n\n/**\n * Validate breakpoint configuration\n */\nfunction validateBreakpointConfig(config: Partial<BreakpointConfig>): void {\n for (const [key, value] of Object.entries(config)) {\n if (!isValidBreakpointKey(key)) {\n throw new Error(\n `Invalid breakpoint key: \"${key}\". Valid keys are: base, sm, md, lg, xl, 2xl`\n )\n }\n\n if (typeof value !== 'string') {\n throw new Error(\n `Breakpoint value for \"${key}\" must be a string (e.g., \"768px\")`\n )\n }\n\n if (!value.match(/^\\d+(\\.\\d+)?(px|em|rem|%)$/)) {\n throw new Error(\n `Invalid breakpoint value for \"${key}\": \"${value}\". Must be a valid CSS length (e.g., \"768px\", \"48em\")`\n )\n }\n }\n\n // Validate that breakpoints are in ascending order\n const sortedKeys = Object.keys(config)\n .filter(isValidBreakpointKey)\n .sort((a, b) => {\n return (\n getBreakpointIndex(a as BreakpointKey) -\n getBreakpointIndex(b as BreakpointKey)\n )\n })\n\n for (let i = 1; i < sortedKeys.length; i++) {\n const prev = sortedKeys[i - 1] as BreakpointKey\n const current = sortedKeys[i] as BreakpointKey\n const prevValue = config[prev]!\n const currentValue = config[current]!\n\n if (breakpointToPixels(prev) >= parseInt(currentValue, 10)) {\n throw new Error(\n `Breakpoint \"${current}\" (${currentValue}) must be larger than \"${prev}\" (${prevValue})`\n )\n }\n }\n}\n\n/**\n * Create common breakpoint configurations\n */\nexport const BreakpointPresets = {\n // Tailwind CSS (default)\n tailwind: {\n sm: '640px',\n md: '768px',\n lg: '1024px',\n xl: '1280px',\n '2xl': '1536px',\n } as BreakpointConfig,\n\n // Bootstrap\n bootstrap: {\n sm: '576px',\n md: '768px',\n lg: '992px',\n xl: '1200px',\n '2xl': '1400px',\n } as BreakpointConfig,\n\n // Material Design\n material: {\n sm: '600px',\n md: '960px',\n lg: '1280px',\n xl: '1920px',\n '2xl': '2560px',\n } as BreakpointConfig,\n\n // Custom mobile-first\n mobileFocus: {\n sm: '480px',\n md: '768px',\n lg: '1024px',\n xl: '1200px',\n '2xl': '1440px',\n } as BreakpointConfig,\n} as const\n","/**\n * Responsive CSS Generation Engine\n *\n * Generates optimized CSS media queries from responsive modifier configurations.\n * Supports mobile-first design patterns and advanced media query features.\n */\n\nimport {\n BreakpointKey,\n ResponsiveValue,\n ResponsiveStyleConfig,\n MediaQueryConfig,\n GeneratedMediaQuery,\n ResponsiveModifierResult,\n isResponsiveValue,\n} from './types'\nimport {\n generateMediaQuery,\n getCurrentBreakpointConfig,\n getSortedBreakpoints,\n} from './breakpoints'\n\n/**\n * CSS generation options\n */\nexport interface CSSGenerationOptions {\n selector: string // CSS selector for the element\n generateMinified?: boolean // Generate minified CSS\n includeComments?: boolean // Include helpful comments\n optimizeOutput?: boolean // Optimize and deduplicate CSS\n mobileFirst?: boolean // Use mobile-first approach (default: true)\n}\n\n/**\n * Main CSS generation class\n */\nexport class ResponsiveCSSGenerator {\n private options: Required<CSSGenerationOptions>\n\n constructor(options: CSSGenerationOptions) {\n this.options = {\n generateMinified: false,\n includeComments: true,\n optimizeOutput: true,\n mobileFirst: true,\n ...options,\n }\n }\n\n /**\n * Generate complete responsive CSS from a style configuration\n */\n generateResponsiveCSS(\n config: ResponsiveStyleConfig\n ): ResponsiveModifierResult {\n const mediaQueries: GeneratedMediaQuery[] = []\n const cssRules: string[] = []\n const fallbackStyles: Record<string, string | number> = {}\n let hasResponsiveStyles = false\n\n // Process each property in the configuration\n for (const [property, value] of Object.entries(config)) {\n if (isResponsiveValue(value)) {\n hasResponsiveStyles = true\n const result = this.generatePropertyMediaQueries(property, value)\n mediaQueries.push(...result.mediaQueries)\n\n // Add base styles to fallback\n if (result.baseStyles) {\n Object.assign(fallbackStyles, result.baseStyles)\n }\n } else {\n // Non-responsive property - add to fallback styles\n fallbackStyles[this.toCSSPropertyName(property)] = this.formatCSSValue(\n property,\n value\n )\n }\n }\n\n // Generate CSS rules from media queries\n cssRules.push(...this.generateCSSRules(mediaQueries, fallbackStyles))\n\n return {\n cssRules,\n mediaQueries,\n fallbackStyles,\n hasResponsiveStyles,\n }\n }\n\n /**\n * Generate media queries for a single property\n */\n private generatePropertyMediaQueries(\n property: string,\n value: Partial<Record<BreakpointKey, any>>\n ): {\n mediaQueries: GeneratedMediaQuery[]\n baseStyles?: Record<string, string | number>\n } {\n const mediaQueries: GeneratedMediaQuery[] = []\n const baseStyles: Record<string, string | number> = {}\n const sortedBreakpoints = getSortedBreakpoints()\n\n for (const breakpoint of sortedBreakpoints) {\n const breakpointValue = value[breakpoint]\n if (breakpointValue === undefined) continue\n\n const cssProperty = this.toCSSPropertyName(property)\n const cssValue = this.formatCSSValue(property, breakpointValue)\n\n if (breakpoint === 'base') {\n // Base styles (no media query needed for mobile-first)\n baseStyles[cssProperty] = cssValue\n } else {\n // Generate media query for this breakpoint\n const query = generateMediaQuery(breakpoint)\n const styles = { [cssProperty]: cssValue }\n\n mediaQueries.push({\n breakpoint,\n query,\n styles,\n selector: this.options.selector,\n })\n }\n }\n\n return {\n mediaQueries,\n baseStyles: Object.keys(baseStyles).length > 0 ? baseStyles : undefined,\n }\n }\n\n /**\n * Generate CSS rules from media queries and base styles\n */\n private generateCSSRules(\n mediaQueries: GeneratedMediaQuery[],\n baseStyles: Record<string, string | number>\n ): string[] {\n const rules: string[] = []\n\n // Generate base styles rule (mobile-first)\n if (Object.keys(baseStyles).length > 0) {\n const baseRule = this.generateCSSRule(this.options.selector, baseStyles)\n rules.push(baseRule)\n }\n\n // Generate media query rules\n const groupedQueries = this.groupQueriesByMediaQuery(mediaQueries)\n\n for (const [query, queryMediaQueries] of Object.entries(groupedQueries)) {\n if (query === '') continue // Skip empty queries (base styles)\n\n // Combine all styles for this media query\n const combinedStyles: Record<string, string | number> = {}\n for (const mq of queryMediaQueries) {\n Object.assign(combinedStyles, mq.styles)\n }\n\n const mediaRule = this.generateMediaQueryRule(\n query,\n this.options.selector,\n combinedStyles\n )\n rules.push(mediaRule)\n }\n\n return rules\n }\n\n /**\n * Group media queries by their query string for optimization\n */\n private groupQueriesByMediaQuery(\n mediaQueries: GeneratedMediaQuery[]\n ): Record<string, GeneratedMediaQuery[]> {\n const grouped: Record<string, GeneratedMediaQuery[]> = {}\n\n for (const mq of mediaQueries) {\n if (!grouped[mq.query]) {\n grouped[mq.query] = []\n }\n grouped[mq.query].push(mq)\n }\n\n return grouped\n }\n\n /**\n * Generate a single CSS rule\n */\n private generateCSSRule(\n selector: string,\n styles: Record<string, string | number>\n ): string {\n const { generateMinified, includeComments } = this.options\n const indent = generateMinified ? '' : ' '\n const newline = generateMinified ? '' : '\\n'\n const space = generateMinified ? '' : ' '\n\n let rule = `${selector}${space}{${newline}`\n\n for (const [property, value] of Object.entries(styles)) {\n rule += `${indent}${property}:${space}${value};${newline}`\n }\n\n rule += `}${newline}`\n\n if (includeComments && !generateMinified) {\n rule = `/* Base styles (mobile-first) */${newline}${rule}`\n }\n\n return rule\n }\n\n /**\n * Generate a CSS media query rule\n */\n private generateMediaQueryRule(\n query: string,\n selector: string,\n styles: Record<string, string | number>\n ): string {\n const { generateMinified, includeComments } = this.options\n const indent = generateMinified ? '' : ' '\n const doubleIndent = generateMinified ? '' : ' '\n const newline = generateMinified ? '' : '\\n'\n const space = generateMinified ? '' : ' '\n\n let rule = `@media ${query}${space}{${newline}`\n rule += `${indent}${selector}${space}{${newline}`\n\n for (const [property, value] of Object.entries(styles)) {\n rule += `${doubleIndent}${property}:${space}${value};${newline}`\n }\n\n rule += `${indent}}${newline}`\n rule += `}${newline}`\n\n if (includeComments && !generateMinified) {\n const breakpoint = this.getBreakpointFromQuery(query)\n rule = `/* ${breakpoint} styles */${newline}${rule}`\n }\n\n return rule\n }\n\n /**\n * Convert camelCase property to CSS kebab-case\n */\n private toCSSProperty(property: string): string {\n return property.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)\n }\n\n /**\n * Format CSS value with appropriate units and validation\n */\n private formatCSSValue(property: string, value: any): string {\n if (value === null || value === undefined) {\n return 'inherit'\n }\n\n // Handle numeric values that need units\n if (typeof value === 'number') {\n const unitlessProperties = [\n 'opacity',\n 'z-index',\n 'font-weight',\n 'line-height',\n 'flex-grow',\n 'flex-shrink',\n 'order',\n 'grid-column-start',\n 'grid-column-end',\n 'grid-row-start',\n 'grid-row-end',\n ]\n\n const cssProperty = this.toCSSProperty(property)\n if (unitlessProperties.includes(cssProperty)) {\n return this.addImportantIfNeeded(property, value.toString())\n }\n\n // Add px unit for dimension properties\n const dimensionProperties = [\n 'width',\n 'height',\n 'min-width',\n 'max-width',\n 'min-height',\n 'max-height',\n 'padding',\n 'margin',\n 'border-width',\n 'border-radius',\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'font-size',\n 'letter-spacing',\n 'text-indent',\n ]\n\n if (dimensionProperties.some(prop => cssProperty.includes(prop))) {\n return this.addImportantIfNeeded(property, `${value}px`)\n }\n }\n\n return this.addImportantIfNeeded(property, value.toString())\n }\n\n /**\n * Add !important for properties that need to override base component styles\n */\n private addImportantIfNeeded(property: string, value: string): string {\n const conflictingProperties = [\n 'flexDirection',\n 'flex-direction',\n 'justifyContent',\n 'justify-content',\n 'alignItems',\n 'align-items',\n 'display',\n ]\n\n const cssProperty = this.toCSSProperty(property)\n if (\n conflictingProperties.includes(property) ||\n conflictingProperties.includes(cssProperty)\n ) {\n return `${value} !important`\n }\n\n return value\n }\n\n /**\n * Convert property name to appropriate CSS property (including custom properties)\n */\n private toCSSPropertyName(property: string): string {\n return this.toCSSProperty(property)\n }\n\n /**\n * Extract breakpoint name from media query for comments\n */\n private getBreakpointFromQuery(query: string): string {\n const breakpointConfig = getCurrentBreakpointConfig()\n\n for (const [breakpoint, value] of Object.entries(breakpointConfig)) {\n if (query.includes(value)) {\n return breakpoint\n }\n }\n\n return 'custom'\n }\n}\n\n/**\n * Utility function to generate responsive CSS for a single property\n */\nexport function generateResponsiveProperty(\n selector: string,\n property: string,\n value: ResponsiveValue<any>,\n options?: Partial<CSSGenerationOptions>\n): string[] {\n if (!isResponsiveValue(value)) {\n // Non-responsive value - return simple CSS rule\n const cssProperty = property.replace(\n /[A-Z]/g,\n match => `-${match.toLowerCase()}`\n )\n const cssValue = typeof value === 'number' ? `${value}px` : value.toString()\n return [`${selector} { ${cssProperty}: ${cssValue}; }`]\n }\n\n const generator = new ResponsiveCSSGenerator({ selector, ...options })\n const config = { [property]: value }\n const result = generator.generateResponsiveCSS(config)\n\n return result.cssRules\n}\n\n/**\n * Utility function to generate media query for custom conditions\n */\nexport function generateCustomMediaQuery(\n selector: string,\n mediaQueryConfig: MediaQueryConfig,\n options?: Partial<CSSGenerationOptions>\n): string {\n const { generateMinified = false } = options || {}\n const indent = generateMinified ? '' : ' '\n const newline = generateMinified ? '' : '\\n'\n const space = generateMinified ? '' : ' '\n\n let rule = `@media ${mediaQueryConfig.query}${space}{${newline}`\n rule += `${indent}${selector}${space}{${newline}`\n\n for (const [property, value] of Object.entries(mediaQueryConfig.styles)) {\n const cssProperty = property.replace(\n /[A-Z]/g,\n match => `-${match.toLowerCase()}`\n )\n const cssValue = typeof value === 'number' ? `${value}px` : value.toString()\n rule += `${indent}${indent}${cssProperty}:${space}${cssValue};${newline}`\n }\n\n rule += `${indent}}${newline}`\n rule += `}${newline}`\n\n return rule\n}\n\n/**\n * CSS injection utilities for runtime application\n */\nexport class CSSInjector {\n private static styleSheet: CSSStyleSheet | null = null\n private static injectedRules = new Set<string>()\n\n /**\n * Get or create the tachUI responsive stylesheet\n */\n private static getStyleSheet(): CSSStyleSheet {\n if (this.styleSheet) {\n return this.styleSheet\n }\n\n const style = document.createElement('style')\n style.setAttribute('data-tachui-responsive', 'true')\n document.head.appendChild(style)\n\n this.styleSheet = style.sheet as CSSStyleSheet\n return this.styleSheet\n }\n\n /**\n * Inject CSS rules into the document\n */\n static injectCSS(rules: string[]): void {\n if (typeof document === 'undefined') {\n return // Skip on server-side\n }\n\n const styleSheet = this.getStyleSheet()\n\n for (const rule of rules) {\n if (this.injectedRules.has(rule)) {\n continue // Skip duplicate rules\n }\n\n try {\n styleSheet.insertRule(rule, styleSheet.cssRules.length)\n this.injectedRules.add(rule)\n } catch (error) {\n console.warn('Failed to inject CSS rule:', rule, error)\n }\n }\n }\n\n /**\n * Clear all injected responsive CSS\n */\n static clearCSS(): void {\n if (this.styleSheet) {\n while (this.styleSheet.cssRules.length > 0) {\n this.styleSheet.deleteRule(0)\n }\n this.injectedRules.clear()\n }\n }\n\n /**\n * Check if a rule has been injected\n */\n static hasRule(rule: string): boolean {\n return this.injectedRules.has(rule)\n }\n}\n","/**\n * Responsive System Performance Optimizations\n *\n * Optimizes CSS generation, caching, and runtime performance for the responsive system.\n */\n\nimport { ResponsiveStyleConfig, BreakpointKey } from './types'\n\n/**\n * CSS rule cache for deduplication\n */\nclass CSSRuleCache {\n private cache = new Map<string, string>()\n private hitCount = 0\n private missCount = 0\n\n get(key: string): string | undefined {\n const result = this.cache.get(key)\n if (result) {\n this.hitCount++\n } else {\n this.missCount++\n }\n return result\n }\n\n set(key: string, value: string): void {\n this.cache.set(key, value)\n }\n\n clear(): void {\n this.cache.clear()\n this.hitCount = 0\n this.missCount = 0\n }\n\n getStats() {\n return {\n size: this.cache.size,\n hitRate: this.hitCount / (this.hitCount + this.missCount) || 0,\n hits: this.hitCount,\n misses: this.missCount,\n }\n }\n}\n\n/**\n * Global CSS rule cache instance\n */\nexport const cssRuleCache = new CSSRuleCache()\n\n/**\n * Performance-optimized CSS generation\n */\nexport class OptimizedCSSGenerator {\n private static readonly BATCH_SIZE = 50\n private static ruleQueue: string[] = []\n private static flushTimer: number | null = null\n\n /**\n * Generate CSS with caching and batching\n */\n static generateOptimizedCSS(\n selector: string,\n config: ResponsiveStyleConfig,\n options: {\n minify?: boolean\n batch?: boolean\n deduplicate?: boolean\n } = {}\n ): string {\n const {\n minify = process.env.NODE_ENV === 'production',\n batch = true,\n deduplicate = true,\n } = options\n\n // Create cache key\n const cacheKey = this.createCacheKey(selector, config, { minify })\n\n // Check cache first\n if (deduplicate) {\n const cached = cssRuleCache.get(cacheKey)\n if (cached) {\n return cached\n }\n }\n\n // Generate CSS\n const css = this.generateCSS(selector, config, { minify })\n\n // Cache result\n if (deduplicate) {\n cssRuleCache.set(cacheKey, css)\n }\n\n // Handle batching\n if (batch && css.trim()) {\n this.addToBatch(css)\n return '' // Return empty since we're batching\n }\n\n return css\n }\n\n /**\n * Create cache key for CSS rule\n */\n private static createCacheKey(\n selector: string,\n config: ResponsiveStyleConfig,\n options: { minify?: boolean }\n ): string {\n return JSON.stringify({ selector, config, options })\n }\n\n /**\n * Generate CSS without optimizations (for comparison)\n */\n private static generateCSS(\n selector: string,\n config: ResponsiveStyleConfig,\n options: { minify?: boolean }\n ): string {\n const { minify = false } = options\n const indent = minify ? '' : ' '\n const newline = minify ? '' : '\\n'\n const space = minify ? '' : ' '\n\n let css = ''\n const processedBreakpoints = new Set<string>()\n\n // Base styles first\n const baseStyles = this.extractBaseStyles(config)\n if (Object.keys(baseStyles).length > 0) {\n css += `${selector}${space}{${newline}`\n css += this.generateProperties(baseStyles, indent, newline, space)\n css += `}${newline}`\n }\n\n // Responsive styles\n for (const [property, value] of Object.entries(config)) {\n if (typeof value === 'object' && value !== null) {\n for (const [breakpoint, breakpointValue] of Object.entries(value)) {\n if (breakpoint === 'base') continue\n\n const mediaQuery = this.getMediaQuery(breakpoint as BreakpointKey)\n const breakpointKey = `${mediaQuery}:${property}`\n\n if (!processedBreakpoints.has(breakpointKey)) {\n css += `@media ${mediaQuery}${space}{${newline}`\n css += `${indent}${selector}${space}{${newline}`\n css += `${indent}${indent}${this.propertyToCSS(property)}:${space}${this.valueToCSS(breakpointValue)};${newline}`\n css += `${indent}}${newline}`\n css += `}${newline}`\n\n processedBreakpoints.add(breakpointKey)\n }\n }\n }\n }\n\n return css\n }\n\n /**\n * Add CSS to batch queue\n */\n private static addToBatch(css: string): void {\n this.ruleQueue.push(css)\n\n if (this.ruleQueue.length >= this.BATCH_SIZE) {\n this.flushBatch()\n } else if (!this.flushTimer) {\n this.flushTimer = window.setTimeout(() => this.flushBatch(), 16) // Next frame\n }\n }\n\n /**\n * Flush batched CSS rules\n */\n private static flushBatch(): void {\n if (this.ruleQueue.length === 0) return\n\n const batchedCSS = this.ruleQueue.join('')\n this.ruleQueue = []\n\n if (this.flushTimer) {\n clearTimeout(this.flushTimer)\n this.flushTimer = null\n }\n\n // Inject batched CSS\n this.injectCSS(batchedCSS)\n }\n\n /**\n * Inject CSS into document\n */\n private static injectCSS(css: string): void {\n if (typeof document === 'undefined') return\n\n let styleElement = document.getElementById(\n 'tachui-responsive-styles'\n ) as HTMLStyleElement\n\n if (!styleElement) {\n styleElement = document.createElement('style')\n styleElement.id = 'tachui-responsive-styles'\n styleElement.type = 'text/css'\n document.head.appendChild(styleElement)\n }\n\n // Use standard approach (legacy IE support removed)\n styleElement.appendChild(document.createTextNode(css))\n }\n\n /**\n * Extract base (non-responsive) styles\n */\n private static extractBaseStyles(\n config: ResponsiveStyleConfig\n ): Record<string, any> {\n const baseStyles: Record<string, any> = {}\n\n for (const [property, value] of Object.entries(config)) {\n if (typeof value !== 'object' || value === null) {\n baseStyles[property] = value\n } else if ('base' in value) {\n baseStyles[property] = value.base\n }\n }\n\n return baseStyles\n }\n\n /**\n * Generate CSS properties\n */\n private static generateProperties(\n styles: Record<string, any>,\n indent: string,\n newline: string,\n space: string\n ): string {\n let css = ''\n\n for (const [property, value] of Object.entries(styles)) {\n if (value !== undefined) {\n css += `${indent}${this.propertyToCSS(property)}:${space}${this.valueToCSS(value)};${newline}`\n }\n }\n\n return css\n }\n\n /**\n * Convert property name to CSS\n */\n private static propertyToCSS(property: string): string {\n return property.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)\n }\n\n /**\n * Convert value to CSS\n */\n private static valueToCSS(value: any): string {\n if (typeof value === 'number') {\n return `${value}px`\n }\n return value.toString()\n }\n\n /**\n * Get media query for breakpoint\n */\n private static getMediaQuery(breakpoint: BreakpointKey): string {\n const queries: Record<BreakpointKey, string> = {\n base: '',\n sm: '(min-width: 640px)',\n md: '(min-width: 768px)',\n lg: '(min-width: 1024px)',\n xl: '(min-width: 1280px)',\n '2xl': '(min-width: 1536px)',\n }\n\n return queries[breakpoint] || breakpoint\n }\n\n /**\n * Force flush any pending batched CSS\n */\n static flush(): void {\n this.flushBatch()\n }\n\n /**\n * Get performance statistics\n */\n static getStats() {\n return {\n cache: cssRuleCache.getStats(),\n batch: {\n queueSize: this.ruleQueue.length,\n batchSize: this.BATCH_SIZE,\n },\n }\n }\n\n /**\n * Clear all caches and reset performance counters\n */\n static reset(): void {\n cssRuleCache.clear()\n this.ruleQueue = []\n if (this.flushTimer) {\n clearTimeout(this.flushTimer)\n this.flushTimer = null\n }\n }\n}\n\n/**\n * Performance monitoring for responsive system\n */\nexport class ResponsivePerformanceMonitor {\n private static measurements = new Map<string, number[]>()\n\n /**\n * Start performance measurement\n */\n static startMeasurement(name: string): () => number {\n const startTime = performance.now()\n\n return () => {\n const duration = performance.now() - startTime\n this.recordMeasurement(name, duration)\n return duration\n }\n }\n\n /**\n * Record measurement\n */\n private static recordMeasurement(name: string, duration: number): void {\n if (!this.measurements.has(name)) {\n this.measurements.set(name, [])\n }\n\n const measurements = this.measurements.get(name)!\n measurements.push(duration)\n\n // Keep only last 100 measurements\n if (measurements.length > 100) {\n measurements.shift()\n }\n }\n\n /**\n * Get performance statistics\n */\n static getStats() {\n const stats: Record<string, any> = {}\n\n for (const [name, measurements] of this.measurements) {\n const sorted = [...measurements].sort((a, b) => a - b)\n const avg =\n measurements.reduce((sum, val) => sum + val, 0) / measurements.length\n\n stats[name] = {\n count: measurements.length,\n average: avg,\n min: sorted[0],\n max: sorted[sorted.length - 1],\n p50: sorted[Math.floor(sorted.length * 0.5)],\n p95: sorted[Math.floor(sorted.length * 0.95)],\n p99: sorted[Math.floor(sorted.length * 0.99)],\n }\n }\n\n return stats\n }\n\n /**\n * Clear all performance data\n */\n static reset(): void {\n this.measurements.clear()\n }\n}\n","/**\n * Responsive Modifier Implementation\n *\n * Core responsive modifier that integrates with the existing tachUI modifier system.\n * Provides CSS-native media query generation with backward compatibility.\n */\n\nimport { BaseModifier } from '@tachui/modifiers'\nimport type { ModifierContext } from '@tachui/modifiers'\nimport type { DOMNode } from '@tachui/core'\nimport {\n ResponsiveValue,\n ResponsiveStyleConfig,\n ResponsiveModifierResult,\n isResponsiveValue,\n BreakpointKey,\n} from './types'\nimport { ResponsiveCSSGenerator, CSSInjector } from './css-generator'\nimport { ResponsivePerformanceMonitor } from './performance'\nimport { createEffect, isSignal, isComputed } from '@tachui/core'\nimport { getThemeSignal } from '@tachui/core'\n\n/**\n * Responsive modifier priority (between appearance and interaction)\n */\nexport const RESPONSIVE_MODIFIER_PRIORITY = 250\n\n/**\n * Core responsive modifier class\n */\nexport class ResponsiveModifier extends BaseModifier<ResponsiveStyleConfig> {\n readonly type = 'responsive'\n readonly priority = RESPONSIVE_MODIFIER_PRIORITY\n private generatedCSS: ResponsiveModifierResult | null = null\n private elementSelector: string = ''\n private _config: ResponsiveStyleConfig\n\n constructor(config: ResponsiveStyleConfig) {\n super(config)\n this._config = config\n }\n\n get config(): ResponsiveStyleConfig {\n return this._config\n }\n\n /**\n * Apply responsive styles to the element\n */\n apply(node: DOMNode, _context: ModifierContext): DOMNode | undefined {\n const element = node.element\n\n if (!element || !(element instanceof HTMLElement)) {\n return undefined\n }\n\n // Generate unique selector for this element\n this.elementSelector = this.generateUniqueSelector(element)\n element.classList.add(this.getClassFromSelector(this.elementSelector))\n\n // Generate responsive CSS\n this.generateAndInjectCSS()\n\n // Set up reactive updates for dynamic responsive values\n this.setupReactiveUpdates()\n\n return undefined // No DOM modifications needed\n }\n\n /**\n * Generate and inject responsive CSS\n */\n private generateAndInjectCSS(): void {\n const endMeasurement =\n ResponsivePerformanceMonitor.startMeasurement('css-generation')\n\n try {\n // Always use immediate CSS generation for responsive modifiers\n // Batching can cause FOUC and layout issues when components need responsive styles immediately\n const generator = new ResponsiveCSSGenerator({\n selector: this.elementSelector,\n generateMinified: process.env.NODE_ENV === 'production',\n includeComments: process.env.NODE_ENV !== 'production',\n optimizeOutput: true,\n })\n\n this.generatedCSS = generator.generateResponsiveCSS(this.config)\n\n // Inject CSS rules into the document immediately\n if (this.generatedCSS.cssRules.length > 0) {\n CSSInjector.injectCSS(this.generatedCSS.cssRules)\n }\n } finally {\n endMeasurement()\n }\n }\n\n /**\n * Set up reactive updates for dynamic responsive values\n */\n private setupReactiveUpdates(): void {\n // Check if any values are reactive signals\n const hasReactiveValues = this.hasReactiveValues(this.properties as ResponsiveStyleConfig)\n\n if (hasReactiveValues) {\n // Create reactive effect to regenerate CSS when values change\n createEffect(() => {\n // Track all reactive dependencies by accessing them\n this.trackReactiveDependencies(this.properties as ResponsiveStyleConfig)\n\n // Re-evaluate config with current signal values\n const currentConfig = this.resolveReactiveConfig(this.properties as ResponsiveStyleConfig)\n\n // Update CSS if config changed\n this.updateConfig(currentConfig)\n })\n }\n }\n\n /**\n * Track reactive dependencies by accessing all reactive values\n */\n private trackReactiveDependencies(config: ResponsiveStyleConfig): void {\n // Track theme signal for any Assets that might be present\n let hasAssets = false\n\n for (const [_key, value] of Object.entries(config)) {\n if (this.isReactiveValue(value)) {\n if (isSignal(value) || isComputed(value)) {\n value() // Access to establish dependency tracking\n } else if (this.isAsset(value)) {\n hasAssets = true\n value.resolve() // Access to establish theme dependency tracking\n }\n } else if (isResponsiveValue(value)) {\n for (const [_breakpoint, breakpointValue] of Object.entries(value)) {\n if (this.isReactiveValue(breakpointValue)) {\n if (isSignal(breakpointValue) || isComputed(breakpointValue)) {\n breakpointValue() // Access to establish dependency tracking\n } else if (this.isAsset(breakpointValue)) {\n hasAssets = true\n breakpointValue.resolve() // Access to establish theme dependency tracking\n }\n }\n }\n }\n }\n\n // If we have Assets, explicitly track the theme signal to ensure theme changes trigger updates\n if (hasAssets) {\n const themeSignal = getThemeSignal()\n themeSignal() // Access theme signal to establish dependency\n }\n }\n\n /**\n * Update configuration and regenerate CSS\n */\n private updateConfig(newConfig: ResponsiveStyleConfig): void {\n this._config = newConfig\n\n // Clear old CSS rules (if we had a way to track them individually)\n // For now, we'll rely on CSS override behavior\n\n // Generate new CSS\n this.generateAndInjectCSS()\n }\n\n /**\n * Generate unique CSS selector for this element\n */\n private generateUniqueSelector(_element: HTMLElement): string {\n const uniqueId = this.generateUniqueId()\n const className = `tachui-responsive-${uniqueId}`\n return `.${className}`\n }\n\n /**\n * Extract class name from CSS selector\n */\n private getClassFromSelector(selector: string): string {\n return selector.replace(/^\\./, '') // Remove leading dot\n }\n\n /**\n * Generate unique ID for CSS class names\n */\n private generateUniqueId(): string {\n return Math.random().toString(36).substr(2, 9)\n }\n\n /**\n * Check if configuration contains reactive values (signals)\n */\n private hasReactiveValues(config: ResponsiveStyleConfig): boolean {\n for (const value of Object.values(config)) {\n if (this.isReactiveValue(value)) {\n return true\n }\n\n if (isResponsiveValue(value)) {\n for (const breakpointValue of Object.values(value)) {\n if (this.isReactiveValue(breakpointValue)) {\n return true\n }\n }\n }\n }\n\n return false\n }\n\n /**\n * Check if a value is a reactive signal, computed, or Asset\n */\n private isReactiveValue(value: any): boolean {\n // Check for TachUI signals and computed values\n if (isSignal(value) || isComputed(value)) {\n return true\n }\n\n // Check for Assets (have a resolve method and are theme-reactive)\n if (this.isAsset(value)) {\n return true\n }\n\n return false\n }\n\n /**\n * Check if a value is an Asset object\n */\n private isAsset(value: any): boolean {\n return (\n value !== null &&\n value !== undefined &&\n typeof value === 'object' &&\n 'resolve' in value &&\n typeof value.resolve === 'function'\n )\n }\n\n /**\n * Resolve configuration with current signal values\n */\n private resolveReactiveConfig(\n config: ResponsiveStyleConfig\n ): ResponsiveStyleConfig {\n const resolved: ResponsiveStyleConfig = {}\n\n for (const [key, value] of Object.entries(config)) {\n if (this.isReactiveValue(value)) {\n // Handle different types of reactive values\n if (isSignal(value) || isComputed(value)) {\n resolved[key] = value() // Call signal/computed to get current value\n } else if (this.isAsset(value)) {\n resolved[key] = value.resolve() // Resolve Asset to current theme value\n }\n } else if (isResponsiveValue(value)) {\n const resolvedBreakpoints: Partial<Record<BreakpointKey, any>> = {}\n\n for (const [breakpoint, breakpointValue] of Object.entries(value)) {\n if (this.isReactiveValue(breakpointValue)) {\n // Handle different types of reactive values at breakpoint level\n if (isSignal(breakpointValue) || isComputed(breakpointValue)) {\n resolvedBreakpoints[breakpoint as BreakpointKey] =\n breakpointValue()\n } else if (this.isAsset(breakpointValue)) {\n resolvedBreakpoints[breakpoint as BreakpointKey] =\n breakpointValue.resolve()\n }\n } else {\n resolvedBreakpoints[breakpoint as BreakpointKey] = breakpointValue\n }\n }\n\n resolved[key] = resolvedBreakpoints\n } else {\n resolved[key] = value\n }\n }\n\n return resolved\n }\n\n /**\n * Get generated CSS information (for debugging)\n */\n getGeneratedCSS(): ResponsiveModifierResult | null {\n return this.generatedCSS\n }\n\n /**\n * Get configuration (for debugging)\n */\n getConfig(): ResponsiveStyleConfig {\n return this.config\n }\n}\n\n/**\n * Factory function to create responsive modifiers\n */\nexport function createResponsiveModifier(\n config: ResponsiveStyleConfig\n): ResponsiveModifier {\n return new ResponsiveModifier(config)\n}\n\n/**\n * Media query modifier for custom media queries\n */\nexport class MediaQueryModifier extends BaseModifier<{\n query: string\n styles: Record<string, any>\n}> {\n readonly type = 'media-query'\n readonly priority = RESPONSIVE_MODIFIER_PRIORITY + 1 // Slightly higher than responsive\n private elementSelector: string = ''\n\n constructor(query: string, styles: Record<string, any>) {\n super({ query, styles })\n }\n\n get query(): string {\n return this.properties.query\n }\n\n get styles(): Record<string, any> {\n return this.properties.styles\n }\n\n apply(node: DOMNode, _context: ModifierContext): DOMNode | undefined {\n const element = node.element\n\n if (!element || !(element instanceof HTMLElement)) {\n return undefined\n }\n\n // Generate unique selector\n this.elementSelector = this.generateUniqueSelector(element)\n element.classList.add(this.getClassFromSelector(this.elementSelector))\n\n // Generate and inject media query CSS\n this.generateMediaQueryCSS()\n\n return undefined\n }\n\n private generateMediaQueryCSS(): void {\n const { generateMinified = process.env.NODE_ENV === 'production' } = {}\n const indent = generateMinified ? '' : ' '\n const doubleIndent = generateMinified ? '' : ' '\n const newline = generateMinified ? '' : '\\n'\n const space = generateMinified ? '' : ' '\n\n let rule = `@media ${this.query}${space}{${newline}`\n rule += `${indent}${this.elementSelector}${space}{${newline}`\n\n for (const [property, value] of Object.entries(this.styles)) {\n const cssProperty = property.replace(\n /[A-Z]/g,\n match => `-${match.toLowerCase()}`\n )\n const cssValue =\n typeof value === 'number' ? `${value}px` : value.toString()\n rule += `${doubleIndent}${cssProperty}:${space}${cssValue};${newline}`\n }\n\n rule += `${indent}}${newline}`\n rule += `}${newline}`\n\n CSSInjector.injectCSS([rule])\n }\n\n private generateUniqueSelector(_element: HTMLElement): string {\n const uniqueId = Math.random().toString(36).substr(2, 9)\n const className = `tachui-mq-${uniqueId}`\n return `.${className}`\n }\n\n private getClassFromSelector(selector: string): string {\n return selector.replace(/^\\./, '')\n }\n}\n\n/**\n * Factory function to create media query modifiers\n */\nexport function createMediaQueryModifier(\n query: string,\n styles: Record<string, any>\n): MediaQueryModifier {\n return new MediaQueryModifier(query, styles)\n}\n\n/**\n * Utility to create responsive property modifier\n */\nexport function createResponsivePropertyModifier<T>(\n property: string,\n value: ResponsiveValue<T>\n): ResponsiveModifier {\n const config = { [property]: value } as ResponsiveStyleConfig\n return new ResponsiveModifier(config)\n}\n\n/**\n * Create a responsive layout modifier\n */\nexport function createResponsiveLayoutModifier(config: {\n direction?: ResponsiveValue<\n 'row' | 'column' | 'row-reverse' | 'column-reverse'\n >\n wrap?: ResponsiveValue<'nowrap' | 'wrap' | 'wrap-reverse'>\n justify?: ResponsiveValue<\n | 'flex-start'\n | 'flex-end'\n | 'center'\n | 'space-between'\n | 'space-around'\n | 'space-evenly'\n >\n align?: ResponsiveValue<\n 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline'\n >\n gap?: ResponsiveValue<number | string>\n}): ResponsiveModifier {\n const styleConfig: ResponsiveStyleConfig = {}\n\n if (config.direction) styleConfig.flexDirection = config.direction\n if (config.wrap) styleConfig.flexWrap = config.wrap\n if (config.justify) styleConfig.justifyContent = config.justify\n if (config.align) styleConfig.alignItems = config.align\n if (config.gap) styleConfig.gap = config.gap\n\n return new ResponsiveModifier(styleConfig)\n}\n","/**\n * Responsive Modifier Builder\n *\n * Extends the existing ModifierBuilder with responsive capabilities.\n * Provides a fluent API for creating responsive modifiers that integrate\n * seamlessly with the existing modifier system.\n */\n\nimport type { ModifierBuilder, Modifier } from '@tachui/core'\nimport type { ComponentInstance } from '@tachui/core'\nimport {\n ResponsiveValue,\n ResponsiveStyleConfig,\n ResponsiveSpacingConfig,\n ResponsiveDimensionConfig,\n ResponsiveTypographyConfig,\n BreakpointKey,\n isResponsiveValue,\n} from './types'\nimport {\n createResponsiveModifier,\n createMediaQueryModifier,\n createResponsivePropertyModifier,\n createResponsiveLayoutModifier,\n} from './responsive-modifier'\n\n/**\n * Responsive modifier builder interface\n */\nexport interface ResponsiveModifierBuilder<\n T extends ComponentInstance = ComponentInstance,\n> {\n // Core responsive methods\n responsive(config: ResponsiveStyleConfig): ResponsiveModifierBuilder<T>\n mediaQuery(\n query: string,\n styles: Record<string, any>\n ): ResponsiveModifierBuilder<T>\n\n // Advanced media query methods\n orientation(\n orientation: 'portrait' | 'landscape',\n styles: Record<string, any>\n ): ResponsiveModifierBuilder<T>\n colorScheme(\n scheme: 'light' | 'dark',\n styles: Record<string, any>\n ): ResponsiveModifierBuilder<T>\n reducedMotion(styles: Record<string, any>): ResponsiveModifierBuilder<T>\n highContrast(styles: Record<string, any>): ResponsiveModifierBuilder<T>\n touchDevice(styles: Record<string, any>): ResponsiveModifierBuilder<T>\n mouseDevice(styles: Record<string, any>): ResponsiveModifierBuilder<T>\n retina(styles: Record<string, any>): ResponsiveModifierBuilder<T>\n print(styles: Record<string, any>): ResponsiveModifierBuilder<T>\n\n // Responsive layout methods\n responsiveLayout(config: {\n direction?: ResponsiveValue<\n 'row' | 'column' | 'row-reverse' | 'column-reverse'\n >\n wrap?: ResponsiveValue<'nowrap' | 'wrap' | 'wrap-reverse'>\n justify?: ResponsiveValue<\n | 'flex-start'\n | 'flex-end'\n | 'center'\n | 'space-between'\n | 'space-around'\n | 'space-evenly'\n >\n align?: ResponsiveValue<\n 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline'\n >\n gap?: ResponsiveValue<number | string>\n }): ResponsiveModifierBuilder<T>\n\n // Responsive dimension methods\n responsiveWidth(\n value: ResponsiveValue<number | string>\n ): ResponsiveModifierBuilder<T>\n responsiveHeight(\n value: ResponsiveValue<number | string>\n ): ResponsiveModifierBuilder<T>\n responsiveSize(\n config: ResponsiveDimensionConfig\n ): ResponsiveModifierBuilder<T>\n\n // Responsive spacing methods\n responsivePadding(\n value: ResponsiveValue<number | string> | ResponsiveSpacingConfig\n ): ResponsiveModifierBuilder<T>\n responsiveMargin(\n value: ResponsiveValue<number | string> | ResponsiveSpacingConfig\n ): ResponsiveModifierBuilder<T>\n\n // Responsive typography methods\n responsiveFont(\n config: ResponsiveTypographyConfig\n ): ResponsiveModifierBuilder<T>\n responsiveFontSize(\n value: ResponsiveValue<number | string>\n ): ResponsiveModifierBuilder<T>\n responsiveTextAlign(\n value: ResponsiveValue<'left' | 'center' | 'right' | 'justify'>\n ): ResponsiveModifierBuilder<T>\n\n // Breakpoint shorthand methods\n base: ResponsiveBreakpointBuilder<T>\n sm: ResponsiveBreakpointBuilder<T>\n md: ResponsiveBreakpointBuilder<T>\n lg: ResponsiveBreakpointBuilder<T>\n xl: ResponsiveBreakpointBuilder<T>\n '2xl': ResponsiveBreakpointBuilder<T>\n\n // Builder methods\n addModifier(modifier: Modifier): void\n build(): T\n}\n\n/**\n * Breakpoint-specific builder for shorthand syntax\n * Returns ModifierBuilder to allow chaining with regular modifiers after responsive ones\n */\nexport interface ResponsiveBreakpointBuilder<\n T extends ComponentInstance = ComponentInstance,\n> {\n // Layout properties\n width(value: number | string): ResponsiveModifierBuilder<T>\n height(value: number | string): ResponsiveModifierBuilder<T>\n minWidth(value: number | string): ResponsiveModifierBuilder<T>\n maxWidth(value: number | string): ResponsiveModifierBuilder<T>\n minHeight(value: number | string): ResponsiveModifierBuilder<T>\n maxHeight(value: number | string): ResponsiveModifierBuilder<T>\n\n // Padding properties\n padding(value: number | string): ResponsiveModifierBuilder<T>\n paddingHorizontal(value: number | string): ResponsiveModifierBuilder<T>\n paddingVertical(value: number | string): ResponsiveModifierBuilder<T>\n paddingTop(value: number | string): ResponsiveModifierBuilder<T>\n paddingBottom(value: number | string): ResponsiveModifierBuilder<T>\n paddingLeft(value: number | string): ResponsiveModifierBuilder<T>\n paddingRight(value: number | string): ResponsiveModifierBuilder<T>\n\n // Margin properties\n margin(value: number | string): ResponsiveModifierBuilder<T>\n marginHorizontal(value: number | string): ResponsiveModifierBuilder<T>\n marginVertical(value: number | string): ResponsiveModifierBuilder<T>\n marginTop(value: number | string): ResponsiveModifierBuilder<T>\n marginBottom(value: number | string): ResponsiveModifierBuilder<T>\n marginLeft(value: number | string): ResponsiveModifierBuilder<T>\n marginRight(value: number | string): ResponsiveModifierBuilder<T>\n\n // Typography properties\n fontSize(value: number | string): ResponsiveModifierBuilder<T>\n textAlign(value: 'left' | 'center' | 'right' | 'justify'): ResponsiveModifierBuilder<T>\n\n // Display properties\n display(\n value:\n | 'none'\n | 'block'\n | 'inline'\n | 'inline-block'\n | 'flex'\n | 'inline-flex'\n | 'grid'\n ): ResponsiveModifierBuilder<T>\n\n // Flexbox properties\n flexDirection(\n value: 'row' | 'column' | 'row-reverse' | 'column-reverse'\n ): ResponsiveModifierBuilder<T>\n justifyContent(\n value:\n | 'flex-start'\n | 'flex-end'\n | 'center'\n | 'space-between'\n | 'space-around'\n | 'space-evenly'\n ): ResponsiveModifierBuilder<T>\n alignItems(\n value: 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline'\n ): ResponsiveModifierBuilder<T>\n\n // Visual properties\n backgroundColor(value: string): ResponsiveModifierBuilder<T>\n color(value: string): ResponsiveModifierBuilder<T>\n opacity(value: number): ResponsiveModifierBuilder<T>\n}\n\n/**\n * Implementation of responsive modifier builder using Proxy delegation\n */\nexport class ResponsiveModifierBuilderImpl<\n T extends ComponentInstance = ComponentInstance,\n> implements ResponsiveModifierBuilder<T>\n{\n constructor(private baseBuilder: ModifierBuilder<T>) {\n // Return a Proxy that delegates unknown methods to baseBuilder\n return new Proxy(this, {\n get(target, prop) {\n // Special handling for responsive breakpoint getters FIRST\n if (\n prop === 'base' ||\n prop === 'sm' ||\n prop === 'md' ||\n prop === 'lg' ||\n prop === 'xl' ||\n prop === '2xl'\n ) {\n return target[prop as keyof ResponsiveModifierBuilderImpl<T>]\n }\n\n // If the method exists on this class, use it\n if (prop in target) {\n return target[prop as keyof ResponsiveModifierBuilderImpl<T>]\n }\n\n // Delegate everything else to baseBuilder\n const baseProp = (target.baseBuilder as any)[prop]\n if (typeof baseProp === 'function') {\n return (...args: any[]) => {\n const result = baseProp.apply(target.baseBuilder, args)\n // If the base method returns the baseBuilder, return the proxy instead\n // to maintain fluent chaining with responsive methods\n return result === target.baseBuilder ? target : result\n }\n }\n\n // For non-function properties, return the baseBuilder's property\n return baseProp\n },\n }) as ResponsiveModifierBuilderImpl<T>\n }\n\n // Delegate essential builder methods\n addModifier(modifier: Modifier): void {\n this.baseBuilder.addModifier(modifier)\n }\n\n build(): T {\n return this.baseBuilder.build()\n }\n\n // Core responsive methods\n responsive(config: ResponsiveStyleConfig): ResponsiveModifierBuilder<T> {\n const modifier = createResponsiveModifier(config)\n this.baseBuilder.addModifier(modifier)\n return this\n }\n\n mediaQuery(\n query: string,\n styles: Record<string, any>\n ): ResponsiveModifierBuilder<T> {\n const modifier = createMediaQueryModifier(query, styles)\n this.baseBuilder.addModifier(modifier)\n return this\n }\n\n // Advanced media query methods\n orientation(\n orientation: 'portrait' | 'landscape',\n styles: Record<string, any>\n ): ResponsiveModifierBuilder<T> {\n const query = `(orientation: ${orientation})`\n const modifier = createMediaQueryModifier(query, styles)\n this.baseBuilder.addModifier(modifier)\n return this\n }\n\n colorScheme(\n scheme: 'light' | 'dark',\n styles: Record<string, any>\n ): ResponsiveModifierBuilder<T> {\n const query = `(prefers-color-scheme: ${scheme})`\n const modifier = createMediaQueryModifier(query, styles)\n this.baseBuilder.addModifier(modifier)\n return this\n }\n\n reducedMotion(styles: Record<string, any>): ResponsiveModifierBuilder<T> {\n const query = '(prefers-reduced-motion: reduce)'\n const modifier = createMediaQueryModifier(query, styles)\n this.baseBuilder.addModifier(modifier)\n return this\n }\n\n highContrast(styles: Record<string, any>): ResponsiveModifierBuilder<T> {\n const query = '(prefers-contrast: high)'\n const modifier = createMediaQueryModifier(query, styles)\n this.baseBuilder.addModifier(modifier)\n return this\n }\n\n touchDevice(styles: Record<string, any>): ResponsiveModifierBuilder<T> {\n const query = '(pointer: coarse)'\n const modifier = createMediaQueryModifier(query, styles)\n this.baseBuilder.addModifier(modifier)\n return this\n }\n\n mouseDevice(styles: Record<string, any>): ResponsiveModifierBuilder<T> {\n const query = '(pointer: fine)'\n const modifier = createMediaQueryModifier(query, styles)\n this.baseBuilder.addModifier(modifier)\n return this\n }\n\n retina(styles: Record<string, any>): ResponsiveModifierBuilder<T> {\n const query = '(min-resolution: 2dppx)'\n const modifier = createMediaQueryModifier(query, styles)\n this.baseBuilder.addModifier(modifier)\n return this\n }\n\n print(styles: Record<string, any>): ResponsiveModifierBuilder<T> {\n const query = 'print'\n const modifier = createMediaQueryModifier(query, styles)\n this.baseBuilder.addModifier(modifier)\n return this\n }\n\n // Responsive layout methods\n responsiveLayout(config: {\n direction?: ResponsiveValue<\n 'row' | 'column' | 'row-reverse' | 'column-reverse'\n >\n wrap?: ResponsiveValue<'nowrap' | 'wrap' | 'wrap-reverse'>\n justify?: ResponsiveValue<\n | 'flex-start'\n | 'flex-end'\n | 'center'\n | 'space-between'\n | 'space-around'\n | 'space-evenly'\n >\n align?: ResponsiveValue<\n 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline'\n >\n gap?: ResponsiveValue<number | string>\n }): ResponsiveModifierBuilder<T> {\n const modifier = createResponsiveLayoutModifier(config)\n this.baseBuilder.addModifier(modifier)\n return this\n }\n\n // Responsive dimension methods\n responsiveWidth(\n value: ResponsiveValue<number | string>\n ): ResponsiveModifierBuilder<T> {\n const modifier = createResponsivePropertyModifier('width', value)\n this.baseBuilder.addModifier(modifier)\n return this\n }\n\n responsiveHeight(\n value: ResponsiveValue<number | string>\n ): ResponsiveModifierBuilder<T> {\n const modifier = createResponsivePropertyModifier('height', value)\n this.baseBuilder.addModifier(modifier)\n return this\n }\n\n responsiveSize(\n config: ResponsiveDimensionConfig\n ): ResponsiveModifierBuilder<T> {\n const modifier = createResponsiveModifier(config)\n this.baseBuilder.addModifier(modifier)\n return this\n }\n\n // Responsive spacing methods\n responsivePadding(\n value: ResponsiveValue<number | string> | ResponsiveSpacingConfig\n ): ResponsiveModifierBuilder<T> {\n if (\n isResponsiveValue(value) ||\n typeof value === 'string' ||\n typeof value === 'number'\n ) {\n const modifier = createResponsivePropertyModifier(\n 'padding',\n value as ResponsiveValue<number | string>\n )\n this.baseBuilder.addModifier(modifier)\n } else {\n // Handle spacing config\n const styleConfig: ResponsiveStyleConfig = {}\n const config = value as ResponsiveSpacingConfig\n\n if (config.all) styleConfig.padding = config.all\n if (config.horizontal) {\n styleConfig.paddingLeft = config.horizontal\n styleConfig.paddingRight = config.horizontal\n }\n if (config.vertical) {\n styleConfig.paddingTop = config.vertical\n styleConfig.paddingBottom = config.vertical\n }\n if (config.top) styleConfig.paddingTop = config.top\n if (config.right) styleConfig.paddingRight = config.right\n if (config.bottom) styleConfig.paddingBottom = config.bottom\n if (config.left) styleConfig.paddingLeft = config.left\n\n const modifier = createResponsiveModifier(styleConfig)\n this.baseBuilder.addModifier(modifier)\n }\n return this\n }\n\n responsiveMargin(\n value: ResponsiveValue<number | string> | ResponsiveSpacingConfig\n ): ResponsiveModifierBuilder<T> {\n if (\n isResponsiveValue(value) ||\n typeof value === 'string' ||\n typeof value === 'number'\n ) {\n const modifier = createResponsivePropertyModifier(\n 'margin',\n value as ResponsiveValue<number | string>\n )\n this.baseBuilder.addModifier(modifier)\n } else {\n // Handle spacing config\n const styleConfig: ResponsiveStyleConfig = {}\n const config = value as ResponsiveSpacingConfig\n\n if (config.all) styleConfig.margin = config.all\n if (config.horizontal) {\n styleConfig.marginLeft = config.horizontal\n styleConfig.marginRight = config.horizontal\n }\n if (config.vertical) {\n styleConfig.marginTop = config.vertical\n styleConfig.marginBottom = config.vertical\n }\n if (config.top) styleConfig.marginTop = config.top\n if (config.right) styleConfig.marginRight = config.right\n if (config.bottom) styleConfig.marginBottom = config.bottom\n if (config.left) styleConfig.marginLeft = config.left\n\n const modifier = createResponsiveModifier(styleConfig)\n this.baseBuilder.addModifier(modifier)\n }\n return this\n }\n\n // Responsive typography methods\n responsiveFont(\n config: ResponsiveTypographyConfig\n ): ResponsiveModifierBuilder<T> {\n const modifier = createResponsiveModifier(config)\n this.baseBuilder.addModifier(modifier)\n return this\n }\n\n responsiveFontSize(\n value: ResponsiveValue<number | string>\n ): ResponsiveModifierBuilder<T> {\n const modifier = createResponsivePropertyModifier('fontSize', value)\n this.baseBuilder.addModifier(modifier)\n return this\n }\n\n responsiveTextAlign(\n value: ResponsiveValue<'left' | 'center' | 'right' | 'justify'>\n ): ResponsiveModifierBuilder<T> {\n const modifier = createResponsivePropertyModifier('textAlign', value)\n this.baseBuilder.addModifier(modifier)\n return this\n }\n\n // Breakpoint shorthand methods\n get base(): ResponsiveBreakpointBuilder<T> {\n return new ResponsiveBreakpointBuilderImpl('base', this, this.baseBuilder)\n }\n\n get sm(): ResponsiveBreakpointBuilder<T> {\n return new ResponsiveBreakpointBuilderImpl('sm', this, this.baseBuilder)\n }\n\n get md(): ResponsiveBreakpointBuilder<T> {\n return new ResponsiveBreakpointBuilderImpl('md', this, this.baseBuilder)\n }\n\n get lg(): ResponsiveBreakpointBuilder<T> {\n return new ResponsiveBreakpointBuilderImpl('lg', this, this.baseBuilder)\n }\n\n get xl(): ResponsiveBreakpointBuilder<T> {\n return new ResponsiveBreakpointBuilderImpl('xl', this, this.baseBuilder)\n }\n\n get '2xl'(): ResponsiveBreakpointBuilder<T> {\n return new ResponsiveBreakpointBuilderImpl('2xl', this, this.baseBuilder)\n }\n\n // Delegate to base builder methods\n [key: string]: any\n}\n\n/**\n * Implementation of breakpoint-specific builder\n */\nclass ResponsiveBreakpointBuilderImpl<\n T extends ComponentInstance = ComponentInstance,\n> implements ResponsiveBreakpointBuilder<T>\n{\n constructor(\n private breakpoint: BreakpointKey,\n private parentBuilder: ResponsiveModifierBuilder<T>,\n private baseBuilder: ModifierBuilder<T>\n ) {}\n\n // Layout properties\n width(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier('width', responsiveValue)\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n height(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier('height', responsiveValue)\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n minWidth(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'minWidth',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n maxWidth(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'maxWidth',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n minHeight(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'minHeight',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n maxHeight(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'maxHeight',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n padding(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'padding',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n paddingHorizontal(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const leftModifier = createResponsivePropertyModifier(\n 'paddingLeft',\n responsiveValue\n )\n const rightModifier = createResponsivePropertyModifier(\n 'paddingRight',\n responsiveValue\n )\n this.parentBuilder.addModifier(leftModifier)\n this.parentBuilder.addModifier(rightModifier)\n return this.parentBuilder\n }\n\n paddingVertical(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const topModifier = createResponsivePropertyModifier(\n 'paddingTop',\n responsiveValue\n )\n const bottomModifier = createResponsivePropertyModifier(\n 'paddingBottom',\n responsiveValue\n )\n this.parentBuilder.addModifier(topModifier)\n this.parentBuilder.addModifier(bottomModifier)\n return this.parentBuilder\n }\n\n paddingTop(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'paddingTop',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n paddingBottom(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'paddingBottom',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n paddingLeft(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'paddingLeft',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n paddingRight(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'paddingRight',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n margin(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier('margin', responsiveValue)\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n marginHorizontal(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const leftModifier = createResponsivePropertyModifier(\n 'marginLeft',\n responsiveValue\n )\n const rightModifier = createResponsivePropertyModifier(\n 'marginRight',\n responsiveValue\n )\n this.parentBuilder.addModifier(leftModifier)\n this.parentBuilder.addModifier(rightModifier)\n return this.parentBuilder\n }\n\n marginVertical(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const topModifier = createResponsivePropertyModifier(\n 'marginTop',\n responsiveValue\n )\n const bottomModifier = createResponsivePropertyModifier(\n 'marginBottom',\n responsiveValue\n )\n this.parentBuilder.addModifier(topModifier)\n this.parentBuilder.addModifier(bottomModifier)\n return this.parentBuilder\n }\n\n marginTop(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'marginTop',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n marginBottom(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'marginBottom',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n marginLeft(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'marginLeft',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n marginRight(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'marginRight',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n // Typography properties\n fontSize(value: number | string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'fontSize',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n textAlign(\n value: 'left' | 'center' | 'right' | 'justify'\n ): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'textAlign',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n // Display properties\n display(\n value:\n | 'none'\n | 'block'\n | 'inline'\n | 'inline-block'\n | 'flex'\n | 'inline-flex'\n | 'grid'\n ): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'display',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n // Flexbox properties\n flexDirection(\n value: 'row' | 'column' | 'row-reverse' | 'column-reverse'\n ): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'flexDirection',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n justifyContent(\n value:\n | 'flex-start'\n | 'flex-end'\n | 'center'\n | 'space-between'\n | 'space-around'\n | 'space-evenly'\n ): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'justifyContent',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n alignItems(\n value: 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline'\n ): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'alignItems',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n // Visual properties\n backgroundColor(value: string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'backgroundColor',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n color(value: string): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier('color', responsiveValue)\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n\n opacity(value: number): ResponsiveModifierBuilder<T> {\n const responsiveValue = { [this.breakpoint]: value }\n const modifier = createResponsivePropertyModifier(\n 'opacity',\n responsiveValue\n )\n this.parentBuilder.addModifier(modifier)\n return this.parentBuilder\n }\n}\n\n/**\n * Utility function to wrap existing modifier builder with responsive capabilities\n */\nexport function withResponsive<T extends ComponentInstance = ComponentInstance>(\n builder: ModifierBuilder<T>\n): ResponsiveModifierBuilder<T> {\n return new ResponsiveModifierBuilderImpl(builder)\n}\n\n/**\n * Create a responsive modifier builder from scratch\n */\nexport function createResponsiveBuilder<\n T extends ComponentInstance = ComponentInstance,\n>(baseBuilder: ModifierBuilder<T>): ResponsiveModifierBuilder<T> {\n return new ResponsiveModifierBuilderImpl(baseBuilder)\n}\n","/**\n * Responsive Design Utilities\n *\n * Provides utility functions and hooks for working with responsive design\n * in tachUI applications. Includes breakpoint detection, media query helpers,\n * and responsive value resolution.\n */\n\nimport {\n BreakpointKey,\n BreakpointContext,\n ResponsiveValue,\n isResponsiveValue,\n} from './types'\nimport {\n getCurrentBreakpoint,\n createBreakpointContext,\n getBreakpointIndex,\n} from './breakpoints'\nimport { createSignal, createComputed } from '@tachui/core'\nimport type { Signal } from '@tachui/core/reactive/types'\n\n/**\n * Hook to get current breakpoint information\n */\nexport function useBreakpoint(): {\n current: Signal<BreakpointKey>\n context: Signal<BreakpointContext>\n isAbove: (breakpoint: BreakpointKey) => Signal<boolean>\n isBelow: (breakpoint: BreakpointKey) => Signal<boolean>\n isBetween: (min: BreakpointKey, max: BreakpointKey) => Signal<boolean>\n matches: (query: string) => Signal<boolean>\n} {\n const current = getCurrentBreakpoint()\n\n const context = createComputed(() => createBreakpointContext())\n\n const isAbove = (breakpoint: BreakpointKey) =>\n createComputed(\n () => getBreakpointIndex(current()) > getBreakpointIndex(breakpoint)\n )\n\n const isBelow = (breakpoint: BreakpointKey) =>\n createComputed(\n () => getBreakpointIndex(current()) < getBreakpointIndex(breakpoint)\n )\n\n const isBetween = (min: BreakpointKey, max: BreakpointKey) =>\n createComputed(() => {\n const currentIndex = getBreakpointIndex(current())\n const minIndex = getBreakpointIndex(min)\n const maxIndex = getBreakpointIndex(max)\n return currentIndex >= minIndex && currentIndex <= maxIndex\n })\n\n const matches = (query: string) => {\n const [matchesSignal, setMatches] = createSignal(false)\n\n if (typeof window !== 'undefined') {\n const mediaQuery = window.matchMedia(query)\n setMatches(mediaQuery.matches)\n\n const handler = (e: MediaQueryListEvent) => setMatches(e.matches)\n mediaQuery.addEventListener('change', handler)\n\n // Cleanup would need to be handled by caller\n }\n\n return matchesSignal as Signal<boolean>\n }\n\n return {\n current,\n context,\n isAbove,\n isBelow,\n isBetween,\n matches,\n }\n}\n\n/**\n * Hook to create a reactive media query\n */\nexport function useMediaQuery(query: string): Signal<boolean> {\n const [matches, setMatches] = createSignal(false)\n\n if (typeof window !== 'undefined') {\n const mediaQuery = window.matchMedia(query)\n setMatches(mediaQuery.matches)\n\n const handler = (e: MediaQueryListEvent) => setMatches(e.matches)\n mediaQuery.addEventListener('change', handler)\n\n // TODO: Implement cleanup mechanism\n }\n\n return matches as Signal<boolean>\n}\n\n/**\n * Resolve a responsive value to its current value based on the current breakpoint\n */\nexport function useResponsiveValue<T>(value: ResponsiveValue<T>): Signal<T> {\n const currentBreakpoint = getCurrentBreakpoint()\n\n return createComputed(() => {\n if (!isResponsiveValue(value)) {\n return value as T\n }\n\n const breakpoint = currentBreakpoint()\n const responsiveObj = value as Partial<Record<BreakpointKey, T>>\n\n // Try to find value for current breakpoint or closest smaller breakpoint\n const breakpointOrder: BreakpointKey[] = [\n 'base',\n 'sm',\n 'md',\n 'lg',\n 'xl',\n '2xl',\n ]\n const currentIndex = breakpointOrder.indexOf(breakpoint)\n\n // Search backwards from current breakpoint to find defined value\n for (let i = currentIndex; i >= 0; i--) {\n const bp = breakpointOrder[i]\n if (responsiveObj[bp] !== undefined) {\n return responsiveObj[bp]!\n }\n }\n\n // Fallback to any defined value\n for (const bp of breakpointOrder) {\n if (responsiveObj[bp] !== undefined) {\n return responsiveObj[bp]!\n }\n }\n\n // This shouldn't happen with proper TypeScript usage\n throw new Error('No responsive value found for any breakpoint')\n })\n}\n\n/**\n * Create a responsive value resolver for static resolution\n */\nexport function resolveResponsiveValue<T>(\n value: ResponsiveValue<T>,\n targetBreakpoint?: BreakpointKey\n): T {\n if (!isResponsiveValue(value)) {\n return value as T\n }\n\n const responsiveObj = value as Partial<Record<BreakpointKey, T>>\n const breakpoint = targetBreakpoint || getCurrentBreakpoint()()\n\n // Find value for target breakpoint or closest smaller breakpoint\n const breakpointOrder: BreakpointKey[] = [\n 'base',\n 'sm',\n 'md',\n 'lg',\n 'xl',\n '2xl',\n ]\n const targetIndex = breakpointOrder.indexOf(breakpoint)\n\n // Search backwards from target breakpoint\n for (let i = targetIndex; i >= 0; i--) {\n const bp = breakpointOrder[i]\n if (responsiveObj[bp] !== undefined) {\n return responsiveObj[bp]!\n }\n }\n\n // Fallback to any defined value\n for (const bp of breakpointOrder) {\n if (responsiveObj[bp] !== undefined) {\n return responsiveObj[bp]!\n }\n }\n\n throw new Error('No responsive value found for any breakpoint')\n}\n\n/**\n * Create responsive CSS custom properties (CSS variables)\n */\nexport function createResponsiveCSSVariables(\n prefix: string,\n values: Record<string, ResponsiveValue<string | number>>\n): Record<string, string> {\n const cssVariables: Record<string, string> = {}\n\n for (const [key, value] of Object.entries(values)) {\n if (isResponsiveValue(value)) {\n const responsiveObj = value as Partial<\n Record<BreakpointKey, string | number>\n >\n\n // Create CSS variables for each breakpoint\n for (const [breakpoint, val] of Object.entries(responsiveObj)) {\n if (val !== undefined) {\n const varName =\n breakpoint === 'base'\n ? `--${prefix}-${key}`\n : `--${prefix}-${key}-${breakpoint}`\n cssVariables[varName] = val.toString()\n }\n }\n } else {\n cssVariables[`--${prefix}-${key}`] = value.toString()\n }\n }\n\n return cssVariables\n}\n\n/**\n * Generate CSS media query string for common patterns\n */\nexport const MediaQueries = {\n // Viewport size queries\n mobile: '(max-width: 767px)',\n tablet: '(min-width: 768px) and (max-width: 1023px)',\n desktop: '(min-width: 1024px)',\n\n // Device orientation\n landscape: '(orientation: landscape)',\n portrait: '(orientation: portrait)',\n\n // Device pixel density\n highDPI: '(min-resolution: 2dppx)',\n lowDPI: '(max-resolution: 1dppx)',\n retinaDisplay: '(min-resolution: 2dppx)',\n standardDisplay: '(max-resolution: 1.9dppx)',\n\n // Color scheme preference\n darkMode: '(prefers-color-scheme: dark)',\n lightMode: '(prefers-color-scheme: light)',\n noColorSchemePreference: '(prefers-color-scheme: no-preference)',\n\n // Reduced motion preference\n reducedMotion: '(prefers-reduced-motion: reduce)',\n allowMotion: '(prefers-reduced-motion: no-preference)',\n\n // Contrast preference (accessibility)\n highContrast: '(prefers-contrast: high)',\n lowContrast: '(prefers-contrast: low)',\n normalContrast: '(prefers-contrast: no-preference)',\n\n // Data usage preference\n reduceData: '(prefers-reduced-data: reduce)',\n allowData: '(prefers-reduced-data: no-preference)',\n\n // Transparency preference\n reduceTransparency: '(prefers-reduced-transparency: reduce)',\n allowTransparency: '(prefers-reduced-transparency: no-preference)',\n\n // Hover capability\n canHover: '(hover: hover)',\n noHover: '(hover: none)',\n\n // Pointer capability\n finePointer: '(pointer: fine)', // Mouse, trackpad\n coarsePointer: '(pointer: coarse)', // Touch\n\n // Any-hover (any input can hover)\n anyCanHover: '(any-hover: hover)',\n anyNoHover: '(any-hover: none)',\n\n // Any-pointer (any input type)\n anyFinePointer: '(any-pointer: fine)',\n anyCoarsePointer: '(any-pointer: coarse)',\n\n // Update preference\n slowUpdate: '(update: slow)', // E-ink displays\n fastUpdate: '(update: fast)', // Standard displays\n\n // Overflow-block capability\n blockScrolling: '(overflow-block: scroll)',\n blockPaged: '(overflow-block: paged)',\n\n // Overflow-inline capability\n inlineScrolling: '(overflow-inline: scroll)',\n\n // Forced colors (high contrast mode)\n forcedColors: '(forced-colors: active)',\n normalColors: '(forced-colors: none)',\n\n // Inverted colors\n invertedColors: '(inverted-colors: inverted)',\n normalInvertedColors: '(inverted-colors: none)',\n\n // Scripting capability\n scriptingEnabled: '(scripting: enabled)',\n scriptingDisabled: '(scripting: none)',\n scriptingInitialOnly: '(scripting: initial-only)',\n\n // Container queries (future)\n containerSmall: '(max-width: 400px)',\n containerMedium: '(min-width: 401px) and (max-width: 800px)',\n containerLarge: '(min-width: 801px)',\n\n // Custom breakpoint builders\n minWidth: (width: number | string) =>\n `(min-width: ${width}${typeof width === 'number' ? 'px' : ''})`,\n maxWidth: (width: number | string) =>\n `(max-width: ${width}${typeof width === 'number' ? 'px' : ''})`,\n between: (min: number | string, max: number | string) =>\n `(min-width: ${min}${typeof min === 'number' ? 'px' : ''}) and (max-width: ${max}${typeof max === 'number' ? 'px' : ''})`,\n\n // Height-based queries\n minHeight: (height: number | string) =>\n `(min-height: ${height}${typeof height === 'number' ? 'px' : ''})`,\n maxHeight: (height: number | string) =>\n `(max-height: ${height}${typeof height === 'number' ? 'px' : ''})`,\n heightBetween: (min: number | string, max: number | string) =>\n `(min-height: ${min}${typeof min === 'number' ? 'px' : ''}) and (max-height: ${max}${typeof max === 'number' ? 'px' : ''})`,\n\n // Aspect ratio queries\n square: '(aspect-ratio: 1/1)',\n landscape16_9: '(aspect-ratio: 16/9)',\n portrait9_16: '(aspect-ratio: 9/16)',\n widescreen: '(min-aspect-ratio: 16/9)',\n tallscreen: '(max-aspect-ratio: 9/16)',\n customAspectRatio: (ratio: string) => `(aspect-ratio: ${ratio})`,\n minAspectRatio: (ratio: string) => `(min-aspect-ratio: ${ratio})`,\n maxAspectRatio: (ratio: string) => `(max-aspect-ratio: ${ratio})`,\n\n // Resolution queries\n lowRes: '(max-resolution: 120dpi)',\n standardRes: '(min-resolution: 120dpi) and (max-resolution: 192dpi)',\n highRes: '(min-resolution: 192dpi)',\n customResolution: (dpi: number) => `(min-resolution: ${dpi}dpi)`,\n\n // Print media\n print: 'print',\n screen: 'screen',\n speech: 'speech',\n\n // Device-specific queries (common patterns)\n iPhone: '(max-width: 428px)',\n iPad: '(min-width: 768px) and (max-width: 1024px)',\n desktopSmall: '(min-width: 1024px) and (max-width: 1440px)',\n desktopLarge: '(min-width: 1440px)',\n\n // Special conditions\n touchDevice: '(pointer: coarse)',\n mouseDevice: '(pointer: fine)',\n keyboardNavigation: '(hover: none) and (pointer: coarse)',\n\n // Modern display features\n wideColorGamut: '(color-gamut: p3)',\n standardColorGamut: '(color-gamut: srgb)',\n hdr: '(dynamic-range: high)',\n sdr: '(dynamic-range: standard)',\n} as const\n\n/**\n * Utility to combine multiple media queries\n */\nexport function combineMediaQueries(...queries: string[]): string {\n return queries.filter(q => q).join(' and ')\n}\n\n/**\n * Utility to create OR media queries\n */\nexport function orMediaQueries(...queries: string[]): string {\n return queries.filter(q => q).join(', ')\n}\n\n/**\n * Create a responsive show/hide utility\n */\nexport function createResponsiveVisibility(config: {\n showOn?: BreakpointKey[]\n hideOn?: BreakpointKey[]\n}): Signal<boolean> {\n const currentBreakpoint = getCurrentBreakpoint()\n\n return createComputed(() => {\n const current = currentBreakpoint()\n\n if (config.hideOn && config.hideOn.includes(current)) {\n return false\n }\n\n if (config.showOn && !config.showOn.includes(current)) {\n return false\n }\n\n return true\n })\n}\n\n/**\n * Debug utility to log current responsive state\n */\nexport function logResponsiveState(): void {\n if (typeof window === 'undefined') return\n\n const context = createBreakpointContext()\n\n console.group('🔍 tachUI Responsive State')\n console.log('Current breakpoint:', context.current)\n console.log('Viewport dimensions:', `${context.width}x${context.height}`)\n console.log('Available breakpoints:', ['base', 'sm', 'md', 'lg', 'xl', '2xl'])\n\n // Test common media queries\n const commonQueries = {\n Mobile: MediaQueries.mobile,\n Tablet: MediaQueries.tablet,\n Desktop: MediaQueries.desktop,\n 'Dark mode': MediaQueries.darkMode,\n 'Reduced motion': MediaQueries.reducedMotion,\n 'Can hover': MediaQueries.canHover,\n }\n\n console.log('Media query matches:')\n for (const [name, query] of Object.entries(commonQueries)) {\n console.log(` ${name}: ${window.matchMedia(query).matches}`)\n }\n\n console.groupEnd()\n}\n\n/**\n * Utility function to wrap existing modifier builder with responsive capabilities\n */\nexport function withResponsive<T>(value: T): T {\n // For now, just return the value as-is\n // This would be enhanced to work with actual modifier builders\n return value\n}\n\n/**\n * Development-only responsive debugging overlay\n */\nexport function enableResponsiveDebugOverlay(\n options: {\n position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n showDimensions?: boolean\n showBreakpoint?: boolean\n } = {}\n): void {\n if (typeof window === 'undefined' || process.env.NODE_ENV === 'production') {\n return\n }\n\n const {\n position = 'top-right',\n showDimensions = true,\n showBreakpoint = true,\n } = options\n\n // Create debug overlay element\n const overlay = document.createElement('div')\n overlay.id = 'tachui-responsive-debug'\n overlay.style.cssText = `\n position: fixed;\n ${position.includes('top') ? 'top: 10px' : 'bottom: 10px'};\n ${position.includes('right') ? 'right: 10px' : 'left: 10px'};\n background: rgba(0, 0, 0, 0.8);\n color: white;\n padding: 8px 12px;\n border-radius: 4px;\n font-family: monospace;\n font-size: 12px;\n z-index: 9999;\n pointer-events: none;\n white-space: pre-line;\n `\n\n document.body.appendChild(overlay)\n\n // Update overlay content\n function updateOverlay() {\n const context = createBreakpointContext()\n let content = ''\n\n if (showBreakpoint) {\n content += `Breakpoint: ${context.current}`\n }\n\n if (showDimensions) {\n if (content) content += '\\n'\n content += `Size: ${context.width}×${context.height}`\n }\n\n overlay.textContent = content\n }\n\n // Initial update\n updateOverlay()\n\n // Update on resize\n window.addEventListener('resize', updateOverlay)\n\n // Log initial state\n logResponsiveState()\n}\n","/**\n * Responsive Layout Utility Patterns\n *\n * Provides common responsive layout patterns and utilities that make it easy\n * to create responsive designs without writing custom CSS for every use case.\n */\n\nimport {\n ResponsiveValue,\n BreakpointKey,\n ResponsiveSpacingConfig,\n} from './types'\nimport { createResponsiveModifier } from './responsive-modifier'\n\n/**\n * Configuration for responsive grid layout\n */\nexport interface ResponsiveGridConfig {\n columns?: ResponsiveValue<number>\n rows?: ResponsiveValue<number>\n gap?: ResponsiveValue<string | number>\n columnGap?: ResponsiveValue<string | number>\n rowGap?: ResponsiveValue<string | number>\n autoFlow?: ResponsiveValue<'row' | 'column' | 'row dense' | 'column dense'>\n autoRows?: ResponsiveValue<string>\n autoColumns?: ResponsiveValue<string>\n templateAreas?: ResponsiveValue<string>\n}\n\n/**\n * Configuration for responsive flexbox layout\n */\nexport interface ResponsiveFlexConfig {\n direction?: ResponsiveValue<\n 'row' | 'row-reverse' | 'column' | 'column-reverse'\n >\n wrap?: ResponsiveValue<'nowrap' | 'wrap' | 'wrap-reverse'>\n justify?: ResponsiveValue<\n | 'flex-start'\n | 'flex-end'\n | 'center'\n | 'space-between'\n | 'space-around'\n | 'space-evenly'\n >\n align?: ResponsiveValue<\n 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline'\n >\n alignContent?: ResponsiveValue<\n | 'flex-start'\n | 'flex-end'\n | 'center'\n | 'stretch'\n | 'space-between'\n | 'space-around'\n >\n gap?: ResponsiveValue<string | number>\n columnGap?: ResponsiveValue<string | number>\n rowGap?: ResponsiveValue<string | number>\n}\n\n/**\n * Configuration for responsive container layout\n */\nexport interface ResponsiveContainerConfig {\n maxWidth?: ResponsiveValue<string | number>\n width?: ResponsiveValue<string | number>\n padding?: ResponsiveValue<string | number>\n margin?: ResponsiveValue<string | number>\n centerContent?: ResponsiveValue<boolean>\n}\n\n/**\n * Responsive Grid Layout Utilities\n */\nexport class ResponsiveGridPatterns {\n /**\n * Create a responsive grid with automatic column sizing\n */\n static autoFit(config: {\n minColumnWidth: ResponsiveValue<string | number>\n gap?: ResponsiveValue<string | number>\n maxColumns?: ResponsiveValue<number>\n }) {\n const gridConfig: any = {}\n\n if (typeof config.minColumnWidth === 'object') {\n // Handle responsive minColumnWidth\n gridConfig.gridTemplateColumns = {}\n for (const [breakpoint, width] of Object.entries(config.minColumnWidth)) {\n const widthValue = typeof width === 'number' ? `${width}px` : width\n const maxCols =\n config.maxColumns && typeof config.maxColumns === 'object'\n ? config.maxColumns[breakpoint as BreakpointKey] || 'auto'\n : config.maxColumns || 'auto'\n\n gridConfig.gridTemplateColumns[breakpoint] =\n maxCols === 'auto'\n ? `repeat(auto-fit, minmax(${widthValue}, 1fr))`\n : `repeat(${maxCols}, minmax(${widthValue}, 1fr))`\n }\n } else {\n const widthValue =\n typeof config.minColumnWidth === 'number'\n ? `${config.minColumnWidth}px`\n : config.minColumnWidth\n const maxCols = config.maxColumns || 'auto'\n gridConfig.gridTemplateColumns =\n maxCols === 'auto'\n ? `repeat(auto-fit, minmax(${widthValue}, 1fr))`\n : `repeat(${maxCols}, minmax(${widthValue}, 1fr))`\n }\n\n if (config.gap) {\n gridConfig.gap = config.gap\n }\n\n gridConfig.display = 'grid'\n\n return createResponsiveModifier(gridConfig)\n }\n\n /**\n * Create a responsive grid with explicit column counts\n */\n static columns(\n columns: ResponsiveValue<number>,\n config?: {\n gap?: ResponsiveValue<string | number>\n rowGap?: ResponsiveValue<string | number>\n autoRows?: ResponsiveValue<string>\n }\n ) {\n const gridConfig: any = {\n display: 'grid',\n gridTemplateColumns:\n typeof columns === 'object'\n ? Object.fromEntries(\n Object.entries(columns).map(([bp, cols]) => [\n bp,\n `repeat(${cols}, 1fr)`,\n ])\n )\n : `repeat(${columns}, 1fr)`,\n }\n\n if (config?.gap) gridConfig.gap = config.gap\n if (config?.rowGap) gridConfig.rowGap = config.rowGap\n if (config?.autoRows) gridConfig.gridAutoRows = config.autoRows\n\n return createResponsiveModifier(gridConfig)\n }\n\n /**\n * Create responsive masonry-style grid\n */\n static masonry(config: {\n columns: ResponsiveValue<number>\n gap?: ResponsiveValue<string | number>\n }) {\n const gridConfig: any = {\n display: 'grid',\n gridTemplateColumns:\n typeof config.columns === 'object'\n ? Object.fromEntries(\n Object.entries(config.columns).map(([bp, cols]) => [\n bp,\n `repeat(${cols}, 1fr)`,\n ])\n )\n : `repeat(${config.columns}, 1fr)`,\n gridAutoRows: 'max-content',\n }\n\n if (config.gap) gridConfig.gap = config.gap\n\n return createResponsiveModifier(gridConfig)\n }\n}\n\n/**\n * Responsive Flexbox Layout Utilities\n */\nexport class ResponsiveFlexPatterns {\n /**\n * Create a responsive flex container that stacks on mobile, flows horizontally on desktop\n */\n static stackToRow(config?: {\n stackBreakpoint?: BreakpointKey\n gap?: ResponsiveValue<string | number>\n align?: ResponsiveValue<\n 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline'\n >\n justify?: ResponsiveValue<\n | 'flex-start'\n | 'flex-end'\n | 'center'\n | 'space-between'\n | 'space-around'\n | 'space-evenly'\n >\n }) {\n const stackBreakpoint = config?.stackBreakpoint || 'md'\n\n const flexConfig: any = {\n display: 'flex',\n flexDirection: {\n base: 'column',\n [stackBreakpoint]: 'row',\n },\n }\n\n if (config?.gap) flexConfig.gap = config.gap\n if (config?.align) flexConfig.alignItems = config.align\n if (config?.justify) flexConfig.justifyContent = config.justify\n\n return createResponsiveModifier(flexConfig)\n }\n\n /**\n * Create a responsive flex container with wrapping behavior\n */\n static wrap(config?: ResponsiveFlexConfig) {\n const flexConfig: any = {\n display: 'flex',\n flexWrap: 'wrap',\n ...config,\n }\n\n return createResponsiveModifier(flexConfig)\n }\n\n /**\n * Create centered flex layout\n */\n static center(direction: ResponsiveValue<'row' | 'column'> = 'row') {\n const flexConfig: any = {\n display: 'flex',\n flexDirection: direction,\n justifyContent: 'center',\n alignItems: 'center',\n }\n\n return createResponsiveModifier(flexConfig)\n }\n\n /**\n * Create space-between flex layout\n */\n static spaceBetween(direction: ResponsiveValue<'row' | 'column'> = 'row') {\n const flexConfig: any = {\n display: 'flex',\n flexDirection: direction,\n justifyContent: 'space-between',\n alignItems: 'center',\n }\n\n return createResponsiveModifier(flexConfig)\n }\n}\n\n/**\n * Responsive Container Utilities\n */\nexport class ResponsiveContainerPatterns {\n /**\n * Create a responsive container with max-width constraints\n */\n static container(config?: ResponsiveContainerConfig) {\n const containerConfig: any = {\n width: '100%',\n marginLeft: 'auto',\n marginRight: 'auto',\n }\n\n if (config?.maxWidth) {\n containerConfig.maxWidth = config.maxWidth\n } else {\n // Default responsive max-widths\n containerConfig.maxWidth = {\n sm: '640px',\n md: '768px',\n lg: '1024px',\n xl: '1280px',\n '2xl': '1536px',\n }\n }\n\n if (config?.padding) {\n containerConfig.paddingLeft = config.padding\n containerConfig.paddingRight = config.padding\n }\n\n if (config?.margin) {\n containerConfig.marginTop = config.margin\n containerConfig.marginBottom = config.margin\n }\n\n return createResponsiveModifier(containerConfig)\n }\n\n /**\n * Create a full-width container that breaks out of constraints\n */\n static fullWidth() {\n return createResponsiveModifier({\n width: '100vw',\n marginLeft: 'calc(-50vw + 50%)',\n marginRight: 'calc(-50vw + 50%)',\n })\n }\n\n /**\n * Create a section container with responsive padding\n */\n static section(config?: {\n paddingY?: ResponsiveValue<string | number>\n paddingX?: ResponsiveValue<string | number>\n maxWidth?: ResponsiveValue<string | number>\n }) {\n const sectionConfig: any = {}\n\n if (config?.paddingY) {\n sectionConfig.paddingTop = config.paddingY\n sectionConfig.paddingBottom = config.paddingY\n }\n\n if (config?.paddingX) {\n sectionConfig.paddingLeft = config.paddingX\n sectionConfig.paddingRight = config.paddingX\n }\n\n if (config?.maxWidth) {\n sectionConfig.maxWidth = config.maxWidth\n sectionConfig.marginLeft = 'auto'\n sectionConfig.marginRight = 'auto'\n }\n\n return createResponsiveModifier(sectionConfig)\n }\n}\n\n/**\n * Responsive Visibility Utilities\n */\nexport class ResponsiveVisibilityPatterns {\n /**\n * Show element only on specific breakpoints\n */\n static showOn(breakpoints: BreakpointKey[]) {\n const displayConfig: any = {\n display: {}, // Start with empty object\n }\n\n // Show on specified breakpoints\n for (const breakpoint of breakpoints) {\n displayConfig.display[breakpoint] = 'block'\n }\n\n return createResponsiveModifier(displayConfig)\n }\n\n /**\n * Hide element only on specific breakpoints\n */\n static hideOn(breakpoints: BreakpointKey[]) {\n const displayConfig: any = {\n display: {}, // Start with empty object\n }\n\n // Hide on specified breakpoints\n for (const breakpoint of breakpoints) {\n displayConfig.display[breakpoint] = 'none'\n }\n\n return createResponsiveModifier(displayConfig)\n }\n\n /**\n * Show on mobile, hide on desktop\n */\n static mobileOnly() {\n return createResponsiveModifier({\n display: {\n base: 'block',\n md: 'none',\n },\n })\n }\n\n /**\n * Hide on mobile, show on desktop\n */\n static desktopOnly() {\n return createResponsiveModifier({\n display: {\n base: 'none',\n md: 'block',\n },\n })\n }\n\n /**\n * Show only on tablet breakpoint\n */\n static tabletOnly() {\n return createResponsiveModifier({\n display: {\n base: 'none',\n md: 'block',\n lg: 'none',\n },\n })\n }\n}\n\n/**\n * Responsive Spacing Utilities\n */\nexport class ResponsiveSpacingPatterns {\n /**\n * Create responsive padding\n */\n static padding(config: ResponsiveSpacingConfig) {\n const paddingConfig: any = {}\n\n if (config.all) paddingConfig.padding = config.all\n if (config.horizontal) {\n paddingConfig.paddingLeft = config.horizontal\n paddingConfig.paddingRight = config.horizontal\n }\n if (config.vertical) {\n paddingConfig.paddingTop = config.vertical\n paddingConfig.paddingBottom = config.vertical\n }\n if (config.top) paddingConfig.paddingTop = config.top\n if (config.right) paddingConfig.paddingRight = config.right\n if (config.bottom) paddingConfig.paddingBottom = config.bottom\n if (config.left) paddingConfig.paddingLeft = config.left\n\n return createResponsiveModifier(paddingConfig)\n }\n\n /**\n * Create responsive margin\n */\n static margin(config: ResponsiveSpacingConfig) {\n const marginConfig: any = {}\n\n if (config.all) marginConfig.margin = config.all\n if (config.horizontal) {\n marginConfig.marginLeft = config.horizontal\n marginConfig.marginRight = config.horizontal\n }\n if (config.vertical) {\n marginConfig.marginTop = config.vertical\n marginConfig.marginBottom = config.vertical\n }\n if (config.top) marginConfig.marginTop = config.top\n if (config.right) marginConfig.marginRight = config.right\n if (config.bottom) marginConfig.marginBottom = config.bottom\n if (config.left) marginConfig.marginLeft = config.left\n\n return createResponsiveModifier(marginConfig)\n }\n\n /**\n * Create responsive gap (for flexbox and grid)\n */\n static gap(config: {\n all?: ResponsiveValue<string | number>\n column?: ResponsiveValue<string | number>\n row?: ResponsiveValue<string | number>\n }) {\n const gapConfig: any = {}\n\n if (config.all) gapConfig.gap = config.all\n if (config.column) gapConfig.columnGap = config.column\n if (config.row) gapConfig.rowGap = config.row\n\n return createResponsiveModifier(gapConfig)\n }\n}\n\n/**\n * Responsive Typography Utilities\n */\nexport class ResponsiveTypographyPatterns {\n /**\n * Create responsive font scale\n */\n static scale(config: {\n base: string | number\n scale?: ResponsiveValue<number>\n lineHeight?: ResponsiveValue<number | string>\n }) {\n const typographyConfig: any = {\n fontSize: config.base,\n }\n\n if (config.scale && typeof config.scale === 'object') {\n typographyConfig.fontSize = {}\n for (const [breakpoint, scaleValue] of Object.entries(config.scale)) {\n const baseSize =\n typeof config.base === 'number'\n ? config.base\n : parseFloat(config.base)\n typographyConfig.fontSize[breakpoint] = `${baseSize * scaleValue}px`\n }\n }\n\n if (config.lineHeight) {\n typographyConfig.lineHeight = config.lineHeight\n }\n\n return createResponsiveModifier(typographyConfig)\n }\n\n /**\n * Create fluid typography that scales smoothly\n */\n static fluid(config: {\n minSize: string | number\n maxSize: string | number\n minBreakpoint?: string\n maxBreakpoint?: string\n }) {\n const minBp = config.minBreakpoint || '320px'\n const maxBp = config.maxBreakpoint || '1200px'\n const minSize =\n typeof config.minSize === 'number'\n ? `${config.minSize}px`\n : config.minSize\n const maxSize =\n typeof config.maxSize === 'number'\n ? `${config.maxSize}px`\n : config.maxSize\n\n return createResponsiveModifier({\n fontSize: `clamp(${minSize}, calc(${minSize} + (${maxSize} - ${minSize}) * ((100vw - ${minBp}) / (${maxBp} - ${minBp}))), ${maxSize})`,\n })\n }\n}\n\n/**\n * Common Layout Patterns\n */\nexport const LayoutPatterns = {\n /**\n * Sidebar layout that collapses on mobile\n */\n sidebar: (config?: {\n sidebarWidth?: ResponsiveValue<string | number>\n collapseBreakpoint?: BreakpointKey\n gap?: ResponsiveValue<string | number>\n }) => {\n const collapseBreakpoint = config?.collapseBreakpoint || 'md'\n const sidebarWidth = config?.sidebarWidth || '250px'\n\n return createResponsiveModifier({\n display: 'grid',\n gridTemplateColumns: {\n base: '1fr',\n [collapseBreakpoint]: `${sidebarWidth} 1fr`,\n },\n gap: config?.gap || '1rem',\n })\n },\n\n /**\n * Holy grail layout (header, footer, sidebar, main content)\n */\n holyGrail: (config?: {\n headerHeight?: ResponsiveValue<string | number>\n footerHeight?: ResponsiveValue<string | number>\n sidebarWidth?: ResponsiveValue<string | number>\n collapseBreakpoint?: BreakpointKey\n }) => {\n const collapseBreakpoint = config?.collapseBreakpoint || 'lg'\n\n return createResponsiveModifier({\n display: 'grid',\n gridTemplateAreas: {\n base: '\"header\" \"main\" \"footer\"',\n [collapseBreakpoint]: '\"header header\" \"sidebar main\" \"footer footer\"',\n },\n gridTemplateRows: {\n base: `${config?.headerHeight || 'auto'} 1fr ${config?.footerHeight || 'auto'}`,\n [collapseBreakpoint]: `${config?.headerHeight || 'auto'} 1fr ${config?.footerHeight || 'auto'}`,\n },\n gridTemplateColumns: {\n base: '1fr',\n [collapseBreakpoint]: `${config?.sidebarWidth || '250px'} 1fr`,\n },\n minHeight: '100vh',\n })\n },\n\n /**\n * Card grid layout\n */\n cardGrid: (config?: {\n minCardWidth?: ResponsiveValue<string | number>\n gap?: ResponsiveValue<string | number>\n maxColumns?: ResponsiveValue<number>\n }) => {\n return ResponsiveGridPatterns.autoFit({\n minColumnWidth: config?.minCardWidth || '300px',\n gap: config?.gap || '1rem',\n maxColumns: config?.maxColumns,\n })\n },\n\n /**\n * Hero section layout\n */\n hero: (config?: {\n minHeight?: ResponsiveValue<string | number>\n textAlign?: ResponsiveValue<'left' | 'center' | 'right'>\n padding?: ResponsiveValue<string | number>\n }) => {\n return createResponsiveModifier({\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n alignItems: 'center',\n textAlign: config?.textAlign || 'center',\n minHeight: config?.minHeight || '50vh',\n padding: config?.padding || '2rem',\n })\n },\n}\n\n/**\n * Export all layout patterns for easy access\n */\nexport {\n ResponsiveGridPatterns as ResponsiveGrid,\n ResponsiveFlexPatterns as Flex,\n ResponsiveContainerPatterns as Container,\n ResponsiveVisibilityPatterns as Visibility,\n ResponsiveSpacingPatterns as Spacing,\n ResponsiveTypographyPatterns as ResponsiveTypography,\n}\n","/**\n * Advanced Responsive Utilities\n *\n * Provides programmatic access to responsive behavior, advanced hooks,\n * and complex responsive logic utilities for sophisticated applications.\n */\n\nimport { createSignal, createComputed, createEffect, createMemo } from '@tachui/core'\nimport type { Signal } from '@tachui/core/reactive/types'\nimport {\n ResponsiveValue,\n BreakpointKey,\n BreakpointContext,\n isResponsiveValue,\n} from './types'\nimport {\n getCurrentBreakpoint,\n getBreakpointIndex,\n createBreakpointContext,\n getCurrentBreakpointConfig,\n} from './breakpoints'\n\n/**\n * Advanced breakpoint utilities with enhanced functionality\n */\nexport class AdvancedBreakpointUtils {\n /**\n * Create a responsive value resolver with custom logic\n */\n static createResponsiveResolver<T>(\n getValue: (breakpoint: BreakpointKey, context: BreakpointContext) => T,\n dependencies: Signal<any>[] = []\n ): Signal<T> {\n const currentBreakpoint = getCurrentBreakpoint()\n\n return createComputed(() => {\n // Include dependencies in computation\n dependencies.forEach(dep => dep())\n\n const breakpoint = currentBreakpoint()\n const context = createBreakpointContext()\n return getValue(breakpoint, context)\n })\n }\n\n /**\n * Create responsive value that interpolates between breakpoints\n */\n static createInterpolatedValue(\n values: Partial<Record<BreakpointKey, number>>,\n options: {\n smoothing?: 'linear' | 'ease' | 'ease-in' | 'ease-out'\n clamp?: boolean\n } = {}\n ): Signal<number> {\n const { smoothing = 'linear', clamp = true } = options\n\n return createComputed(() => {\n const context = createBreakpointContext()\n const width = context.width\n const breakpointConfig = getCurrentBreakpointConfig()\n\n // Convert breakpoint values to numeric widths\n const sortedPoints: Array<{ width: number; value: number }> = []\n\n for (const [bp, value] of Object.entries(values)) {\n if (value !== undefined) {\n const bpWidth =\n bp === 'base'\n ? 0\n : parseInt(breakpointConfig[bp as BreakpointKey] || '0')\n sortedPoints.push({ width: bpWidth, value })\n }\n }\n\n sortedPoints.sort((a, b) => a.width - b.width)\n\n if (sortedPoints.length === 0) return 0\n if (sortedPoints.length === 1) return sortedPoints[0].value\n\n // Find interpolation points\n let lowerPoint = sortedPoints[0]\n let upperPoint = sortedPoints[sortedPoints.length - 1]\n\n for (let i = 0; i < sortedPoints.length - 1; i++) {\n if (\n width >= sortedPoints[i].width &&\n width <= sortedPoints[i + 1].width\n ) {\n lowerPoint = sortedPoints[i]\n upperPoint = sortedPoints[i + 1]\n break\n }\n }\n\n // Handle edge cases\n if (clamp) {\n if (width <= lowerPoint.width) return lowerPoint.value\n if (width >= upperPoint.width) return upperPoint.value\n }\n\n // Calculate interpolation factor\n const factor =\n (width - lowerPoint.width) / (upperPoint.width - lowerPoint.width)\n\n // Apply smoothing function\n let smoothedFactor = factor\n switch (smoothing) {\n case 'ease':\n smoothedFactor = 0.5 - 0.5 * Math.cos(factor * Math.PI)\n break\n case 'ease-in':\n smoothedFactor = factor * factor\n break\n case 'ease-out':\n smoothedFactor = 1 - (1 - factor) * (1 - factor)\n break\n case 'linear':\n default:\n smoothedFactor = factor\n break\n }\n\n // Interpolate value\n return (\n lowerPoint.value +\n (upperPoint.value - lowerPoint.value) * smoothedFactor\n )\n }) as Signal<number>\n }\n\n /**\n * Create conditional responsive behavior\n */\n static createConditionalResponsive<T>(\n condition: (context: BreakpointContext) => boolean,\n trueValue: ResponsiveValue<T>,\n falseValue: ResponsiveValue<T>\n ): Signal<T> {\n const currentBreakpoint = getCurrentBreakpoint()\n\n return createComputed(() => {\n const context = createBreakpointContext()\n const shouldUseTrue = condition(context)\n const activeValue = shouldUseTrue ? trueValue : falseValue\n\n return this.resolveResponsiveValue(activeValue, currentBreakpoint())\n })\n }\n\n /**\n * Resolve responsive value at specific breakpoint\n */\n private static resolveResponsiveValue<T>(\n value: ResponsiveValue<T>,\n breakpoint: BreakpointKey\n ): T {\n if (!isResponsiveValue(value)) {\n return value as T\n }\n\n const responsiveObj = value as Partial<Record<BreakpointKey, T>>\n const breakpointOrder: BreakpointKey[] = [\n 'base',\n 'sm',\n 'md',\n 'lg',\n 'xl',\n '2xl',\n ]\n const currentIndex = breakpointOrder.indexOf(breakpoint)\n\n // Search backwards from current breakpoint\n for (let i = currentIndex; i >= 0; i--) {\n const bp = breakpointOrder[i]\n if (responsiveObj[bp] !== undefined) {\n return responsiveObj[bp]!\n }\n }\n\n // Fallback to any defined value\n for (const bp of breakpointOrder) {\n if (responsiveObj[bp] !== undefined) {\n return responsiveObj[bp]!\n }\n }\n\n throw new Error('No responsive value found')\n }\n}\n\n/**\n * Advanced responsive hooks for complex scenarios\n */\nexport class ResponsiveHooks {\n /**\n * Hook for responsive arrays (e.g., responsive grid columns data)\n */\n static useResponsiveArray<T>(\n arrays: Partial<Record<BreakpointKey, T[]>>\n ): Signal<T[]> {\n const currentBreakpoint = getCurrentBreakpoint()\n\n return createComputed(() => {\n const breakpoint = currentBreakpoint()\n return (\n AdvancedBreakpointUtils['resolveResponsiveValue'](arrays, breakpoint) ||\n []\n )\n })\n }\n\n /**\n * Hook for responsive object selection\n */\n static useResponsiveObject<T extends Record<string, any>>(\n objects: Partial<Record<BreakpointKey, T>>\n ): Signal<T | null> {\n const currentBreakpoint = getCurrentBreakpoint()\n\n return createComputed(() => {\n const breakpoint = currentBreakpoint()\n try {\n return AdvancedBreakpointUtils['resolveResponsiveValue'](\n objects,\n breakpoint\n )\n } catch {\n return null\n }\n })\n }\n\n /**\n * Hook for responsive function selection and execution\n */\n static useResponsiveFunction<TArgs extends any[], TReturn>(\n functions: Partial<Record<BreakpointKey, (...args: TArgs) => TReturn>>\n ): Signal<((...args: TArgs) => TReturn) | null> {\n const currentBreakpoint = getCurrentBreakpoint()\n\n return createComputed(() => {\n const breakpoint = currentBreakpoint()\n try {\n return AdvancedBreakpointUtils['resolveResponsiveValue'](\n functions,\n breakpoint\n )\n } catch {\n return null\n }\n })\n }\n\n /**\n * Hook for responsive state management\n */\n static useResponsiveState<T>(\n initialValues: Partial<Record<BreakpointKey, T>>\n ): [\n Signal<T | undefined>,\n (value: T | Partial<Record<BreakpointKey, T>>) => void,\n ] {\n const [state, setState] =\n createSignal<Partial<Record<BreakpointKey, T>>>(initialValues)\n const currentBreakpoint = getCurrentBreakpoint()\n\n const currentValue = createComputed(() => {\n const stateObj = state()\n const breakpoint = currentBreakpoint()\n\n try {\n return AdvancedBreakpointUtils['resolveResponsiveValue'](\n stateObj,\n breakpoint\n )\n } catch {\n return undefined\n }\n })\n\n const setResponsiveState = (\n value: T | Partial<Record<BreakpointKey, T>>\n ) => {\n if (isResponsiveValue(value)) {\n setState(value as Partial<Record<BreakpointKey, T>>)\n } else {\n setState({ [currentBreakpoint()]: value as T })\n }\n }\n\n return [currentValue, setResponsiveState]\n }\n\n /**\n * Hook for responsive computations with memoization\n */\n static useResponsiveComputation<T>(\n computation: (context: BreakpointContext) => T,\n dependencies: Signal<any>[] = []\n ): Signal<T> {\n return createMemo(() => {\n // Include dependencies\n dependencies.forEach(dep => dep())\n\n const context = createBreakpointContext()\n return computation(context)\n })\n }\n\n /**\n * Hook for responsive side effects\n */\n static useResponsiveEffect(\n effect: (\n context: BreakpointContext,\n prevContext?: BreakpointContext\n ) => void | (() => void),\n dependencies: Signal<any>[] = []\n ): void {\n let cleanup: (() => void) | undefined\n let prevContext: BreakpointContext | undefined\n\n createEffect(() => {\n // Include dependencies\n dependencies.forEach(dep => dep())\n\n const context = createBreakpointContext()\n\n // Run cleanup from previous effect\n if (cleanup) {\n cleanup()\n cleanup = undefined\n }\n\n // Run the effect\n const result = effect(context, prevContext)\n\n if (typeof result === 'function') {\n cleanup = result\n }\n\n prevContext = context\n })\n }\n}\n\n/**\n * Responsive breakpoint targeting utilities\n */\nexport class ResponsiveTargeting {\n /**\n * Execute callback only on specific breakpoints\n */\n static onBreakpoints(\n breakpoints: BreakpointKey[],\n callback: (context: BreakpointContext) => void | (() => void)\n ): () => void {\n let cleanup: (() => void) | undefined\n\n createEffect(() => {\n const context = createBreakpointContext()\n\n if (breakpoints.includes(context.current)) {\n // Run cleanup from previous execution\n if (cleanup) {\n cleanup()\n cleanup = undefined\n }\n\n // Execute callback\n const result = callback(context)\n if (typeof result === 'function') {\n cleanup = result\n }\n }\n })\n\n return () => {\n if (cleanup) cleanup()\n }\n }\n\n /**\n * Execute callback when breakpoint changes\n */\n static onBreakpointChange(\n callback: (\n newBreakpoint: BreakpointKey,\n oldBreakpoint: BreakpointKey,\n context: BreakpointContext\n ) => void\n ): () => void {\n let oldBreakpoint: BreakpointKey | undefined\n\n createEffect(() => {\n const context = createBreakpointContext()\n const newBreakpoint = context.current\n\n if (oldBreakpoint && oldBreakpoint !== newBreakpoint) {\n callback(newBreakpoint, oldBreakpoint, context)\n }\n\n oldBreakpoint = newBreakpoint\n })\n\n return () => {\n // No-op for now since createEffect doesn't return dispose function\n }\n }\n\n /**\n * Execute callback when entering/leaving specific breakpoint ranges\n */\n static onBreakpointRange(\n minBreakpoint: BreakpointKey,\n maxBreakpoint: BreakpointKey,\n callbacks: {\n onEnter?: (context: BreakpointContext) => void | (() => void)\n onLeave?: (context: BreakpointContext) => void\n onWithin?: (context: BreakpointContext) => void | (() => void)\n }\n ): () => void {\n let isWithinRange = false\n let withinCleanup: (() => void) | undefined\n let enterCleanup: (() => void) | undefined\n\n createEffect(() => {\n const context = createBreakpointContext()\n const currentIndex = getBreakpointIndex(context.current)\n const minIndex = getBreakpointIndex(minBreakpoint)\n const maxIndex = getBreakpointIndex(maxBreakpoint)\n\n const nowWithinRange =\n currentIndex >= minIndex && currentIndex <= maxIndex\n\n if (nowWithinRange && !isWithinRange) {\n // Entering range\n if (callbacks.onEnter) {\n const result = callbacks.onEnter(context)\n if (typeof result === 'function') {\n enterCleanup = result\n }\n }\n isWithinRange = true\n } else if (!nowWithinRange && isWithinRange) {\n // Leaving range\n if (enterCleanup) {\n enterCleanup()\n enterCleanup = undefined\n }\n if (withinCleanup) {\n withinCleanup()\n withinCleanup = undefined\n }\n if (callbacks.onLeave) {\n callbacks.onLeave(context)\n }\n isWithinRange = false\n }\n\n if (nowWithinRange && callbacks.onWithin) {\n // Within range\n if (withinCleanup) {\n withinCleanup()\n withinCleanup = undefined\n }\n\n const result = callbacks.onWithin(context)\n if (typeof result === 'function') {\n withinCleanup = result\n }\n }\n })\n\n return () => {\n if (enterCleanup) enterCleanup()\n if (withinCleanup) withinCleanup()\n }\n }\n}\n\n/**\n * Responsive data management utilities\n */\nexport class ResponsiveDataUtils {\n /**\n * Create responsive pagination\n */\n static createResponsivePagination<T>(\n data: T[],\n itemsPerPage: ResponsiveValue<number>\n ): {\n currentPage: Signal<number>\n totalPages: Signal<number>\n currentItems: Signal<T[]>\n setPage: (page: number) => void\n nextPage: () => void\n prevPage: () => void\n hasNext: Signal<boolean>\n hasPrev: Signal<boolean>\n } {\n const [currentPage, setCurrentPage] = createSignal(1)\n const currentBreakpoint = getCurrentBreakpoint()\n\n const itemsPerPageResolved = createComputed(() => {\n const breakpoint = currentBreakpoint()\n return AdvancedBreakpointUtils['resolveResponsiveValue'](\n itemsPerPage,\n breakpoint\n )\n }) as Signal<number>\n\n const totalPages = createComputed(() => {\n return Math.ceil(data.length / itemsPerPageResolved())\n }) as Signal<number>\n\n const currentItems = createComputed(() => {\n const itemsCount = itemsPerPageResolved()\n const page = currentPage()\n const startIndex = (page - 1) * itemsCount\n const endIndex = startIndex + itemsCount\n return data.slice(startIndex, endIndex)\n }) as Signal<T[]>\n\n const hasNext = createComputed(\n () => currentPage() < totalPages()\n ) as Signal<boolean>\n const hasPrev = createComputed(() => currentPage() > 1) as Signal<boolean>\n\n const setPage = (page: number) => {\n const maxPage = totalPages()\n setCurrentPage(Math.max(1, Math.min(page, maxPage)))\n }\n\n const nextPage = () => {\n if (hasNext()) {\n setCurrentPage(currentPage() + 1)\n }\n }\n\n const prevPage = () => {\n if (hasPrev()) {\n setCurrentPage(currentPage() - 1)\n }\n }\n\n // Reset to page 1 when items per page changes\n createEffect(() => {\n itemsPerPageResolved() // Subscribe to changes\n setCurrentPage(1)\n })\n\n return {\n currentPage: currentPage as Signal<number>,\n totalPages,\n currentItems,\n setPage,\n nextPage,\n prevPage,\n hasNext,\n hasPrev,\n }\n }\n\n /**\n * Create responsive filtering\n */\n static createResponsiveFilter<T>(\n data: T[],\n filters: Partial<Record<BreakpointKey, (item: T) => boolean>>\n ): Signal<T[]> {\n const currentBreakpoint = getCurrentBreakpoint()\n\n return createComputed(() => {\n const breakpoint = currentBreakpoint()\n const filter = AdvancedBreakpointUtils['resolveResponsiveValue'](\n filters,\n breakpoint\n )\n\n if (!filter) return data\n return data.filter(filter)\n }) as Signal<T[]>\n }\n\n /**\n * Create responsive sorting\n */\n static createResponsiveSort<T>(\n data: T[],\n sorters: Partial<Record<BreakpointKey, (a: T, b: T) => number>>\n ): Signal<T[]> {\n const currentBreakpoint = getCurrentBreakpoint()\n\n return createComputed(() => {\n const breakpoint = currentBreakpoint()\n const sorter = AdvancedBreakpointUtils['resolveResponsiveValue'](\n sorters,\n breakpoint\n )\n\n if (!sorter) return data\n return [...data].sort(sorter)\n }) as Signal<T[]>\n }\n}\n\n/**\n * Export all advanced utilities\n */\nexport const ResponsiveAdvanced = {\n Breakpoints: AdvancedBreakpointUtils,\n Hooks: ResponsiveHooks,\n Targeting: ResponsiveTargeting,\n Data: ResponsiveDataUtils,\n}\n","/**\n * Responsive Development Tools and Debugging Features\n *\n * Provides comprehensive debugging, inspection, and development tools\n * for the responsive design system.\n */\n\nimport { createComputed } from '@tachui/core'\nimport type { Signal } from '@tachui/core/reactive/types'\nimport {\n ResponsiveValue,\n BreakpointKey,\n BreakpointContext,\n isResponsiveValue,\n} from './types'\nimport {\n getCurrentBreakpoint,\n createBreakpointContext,\n getCurrentBreakpointConfig,\n} from './breakpoints'\nimport { ResponsivePerformanceMonitor, cssRuleCache } from './performance'\nimport { MediaQueries } from './utilities'\n\n/**\n * Development mode responsive debugging\n */\nexport class ResponsiveDevTools {\n private static isEnabled = false\n private static debugOverlay: HTMLElement | null = null\n private static logLevel: 'error' | 'warn' | 'info' | 'debug' = 'info'\n\n /**\n * Enable responsive development tools\n */\n static enable(\n options: {\n showOverlay?: boolean\n showBreakpoints?: boolean\n showPerformance?: boolean\n logLevel?: 'error' | 'warn' | 'info' | 'debug'\n highlightResponsiveElements?: boolean\n position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n } = {}\n ): void {\n if (process.env.NODE_ENV === 'production') {\n console.warn('ResponsiveDevTools: Not enabling in production mode')\n return\n }\n\n this.isEnabled = true\n this.logLevel = options.logLevel || 'info'\n\n this.log('info', 'ResponsiveDevTools: Enabled')\n\n if (options.showOverlay) {\n this.createDebugOverlay(options)\n }\n\n if (options.highlightResponsiveElements) {\n this.enableElementHighlighting()\n }\n\n if (options.showPerformance) {\n this.enablePerformanceMonitoring()\n }\n\n // Log initial state\n this.logResponsiveState()\n }\n\n /**\n * Disable responsive development tools\n */\n static disable(): void {\n this.isEnabled = false\n\n if (this.debugOverlay) {\n this.debugOverlay.remove()\n this.debugOverlay = null\n }\n\n this.disableElementHighlighting()\n this.log('info', 'ResponsiveDevTools: Disabled')\n }\n\n /**\n * Check if development tools are enabled\n */\n static get enabled(): boolean {\n return this.isEnabled && process.env.NODE_ENV !== 'production'\n }\n\n /**\n * Log responsive information\n */\n private static log(\n level: 'error' | 'warn' | 'info' | 'debug',\n ...args: any[]\n ): void {\n if (!this.enabled) return\n\n const levels = ['error', 'warn', 'info', 'debug']\n const currentLevel = levels.indexOf(this.logLevel)\n const messageLevel = levels.indexOf(level)\n\n if (messageLevel <= currentLevel) {\n console[level]('[ResponsiveDevTools]', ...args)\n }\n }\n\n /**\n * Create visual debug overlay\n */\n private static createDebugOverlay(options: {\n showBreakpoints?: boolean\n showPerformance?: boolean\n position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n }): void {\n if (typeof document === 'undefined') return\n\n const position = options.position || 'top-right'\n\n this.debugOverlay = document.createElement('div')\n this.debugOverlay.id = 'tachui-responsive-debug'\n this.debugOverlay.style.cssText = `\n position: fixed;\n ${position.includes('top') ? 'top: 10px' : 'bottom: 10px'};\n ${position.includes('right') ? 'right: 10px' : 'left: 10px'};\n background: rgba(0, 0, 0, 0.9);\n color: white;\n padding: 12px;\n border-radius: 8px;\n font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;\n font-size: 12px;\n z-index: 10000;\n pointer-events: auto;\n cursor: pointer;\n max-width: 300px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);\n border: 1px solid rgba(255, 255, 255, 0.1);\n `\n\n // Add close button\n const closeButton = document.createElement('div')\n closeButton.textContent = '×'\n closeButton.style.cssText = `\n position: absolute;\n top: 4px;\n right: 8px;\n cursor: pointer;\n font-size: 16px;\n color: #ff6b6b;\n `\n closeButton.onclick = () => this.disable()\n this.debugOverlay.appendChild(closeButton)\n\n document.body.appendChild(this.debugOverlay)\n\n // Update overlay content reactively\n this.updateDebugOverlay(options)\n\n // Update on resize\n let resizeTimer: number\n window.addEventListener('resize', () => {\n clearTimeout(resizeTimer)\n resizeTimer = window.setTimeout(() => {\n this.updateDebugOverlay(options)\n }, 100)\n })\n }\n\n /**\n * Update debug overlay content\n */\n private static updateDebugOverlay(options: {\n showBreakpoints?: boolean\n showPerformance?: boolean\n }): void {\n if (!this.debugOverlay) return\n\n const context = createBreakpointContext()\n const breakpointConfig = getCurrentBreakpointConfig()\n\n let content = `\n <div style=\"margin-bottom: 8px; font-weight: bold; color: #4fc3f7;\">\n 📱 Responsive Debug\n </div>\n `\n\n // Current breakpoint info\n content += `\n <div style=\"margin-bottom: 6px;\">\n <strong>Current:</strong> <span style=\"color: #66bb6a;\">${context.current}</span>\n </div>\n <div style=\"margin-bottom: 6px;\">\n <strong>Size:</strong> ${context.width}×${context.height}\n </div>\n `\n\n // Breakpoint ranges\n if (options.showBreakpoints) {\n content += `<div style=\"margin: 8px 0; font-weight: bold; color: #ffb74d;\">Breakpoints:</div>`\n\n for (const [name, value] of Object.entries(breakpointConfig)) {\n const isActive = name === context.current\n const color = isActive ? '#66bb6a' : '#999'\n content += `\n <div style=\"color: ${color}; margin-bottom: 2px;\">\n ${isActive ? '▶' : '▷'} ${name}: ${value}\n </div>\n `\n }\n }\n\n // Performance info\n if (options.showPerformance) {\n const perfStats = ResponsivePerformanceMonitor.getStats()\n const cacheStats = cssRuleCache.getStats()\n\n content += `<div style=\"margin: 8px 0; font-weight: bold; color: #f06292;\">Performance:</div>`\n content += `\n <div style=\"margin-bottom: 2px;\">\n Cache: ${cacheStats.size} rules (${(cacheStats.hitRate * 100).toFixed(1)}% hit rate)\n </div>\n `\n\n if (Object.keys(perfStats).length > 0) {\n for (const [name, stats] of Object.entries(perfStats)) {\n content += `\n <div style=\"margin-bottom: 2px;\">\n ${name}: ${stats.average.toFixed(2)}ms avg\n </div>\n `\n }\n }\n }\n\n // Media query test results\n content += `<div style=\"margin: 8px 0; font-weight: bold; color: #ba68c8;\">Media Queries:</div>`\n\n const testQueries = {\n Touch: MediaQueries.touchDevice,\n Dark: MediaQueries.darkMode,\n 'Reduced Motion': MediaQueries.reducedMotion,\n 'High Contrast': MediaQueries.highContrast,\n }\n\n for (const [name, query] of Object.entries(testQueries)) {\n const matches = window.matchMedia(query).matches\n const color = matches ? '#66bb6a' : '#666'\n content += `\n <div style=\"color: ${color}; margin-bottom: 2px;\">\n ${matches ? '✓' : '✗'} ${name}\n </div>\n `\n }\n\n this.debugOverlay.innerHTML =\n content + this.debugOverlay.querySelector('div:last-child')?.outerHTML ||\n ''\n }\n\n /**\n * Enable element highlighting for responsive elements\n */\n private static enableElementHighlighting(): void {\n if (typeof document === 'undefined') return\n\n const style = document.createElement('style')\n style.id = 'tachui-responsive-highlight'\n style.textContent = `\n .tachui-responsive-element {\n outline: 2px dashed #4fc3f7 !important;\n outline-offset: 2px !important;\n position: relative !important;\n }\n\n .tachui-responsive-element::before {\n content: 'R';\n position: absolute !important;\n top: -8px !important;\n right: -8px !important;\n background: #4fc3f7 !important;\n color: white !important;\n width: 16px !important;\n height: 16px !important;\n border-radius: 50% !important;\n font-size: 10px !important;\n font-weight: bold !important;\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n z-index: 10001 !important;\n font-family: monospace !important;\n }\n `\n\n document.head.appendChild(style)\n\n // Find and mark responsive elements\n const observer = new MutationObserver(() => {\n this.highlightResponsiveElements()\n })\n\n observer.observe(document.body, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['class'],\n })\n\n // Initial highlighting\n this.highlightResponsiveElements()\n }\n\n /**\n * Disable element highlighting\n */\n private static disableElementHighlighting(): void {\n if (typeof document === 'undefined') return\n\n const style = document.getElementById('tachui-responsive-highlight')\n if (style) {\n style.remove()\n }\n\n document.querySelectorAll('.tachui-responsive-element').forEach(el => {\n el.classList.remove('tachui-responsive-element')\n })\n }\n\n /**\n * Highlight elements with responsive classes\n */\n private static highlightResponsiveElements(): void {\n if (typeof document === 'undefined') return\n\n // Find elements with tachui responsive classes\n const responsiveSelectors = [\n '[class*=\"tachui-responsive-\"]',\n '[class*=\"tachui-mq-\"]',\n ]\n\n responsiveSelectors.forEach(selector => {\n document.querySelectorAll(selector).forEach(el => {\n if (!el.classList.contains('tachui-responsive-element')) {\n el.classList.add('tachui-responsive-element')\n }\n })\n })\n }\n\n /**\n * Enable performance monitoring display\n */\n private static enablePerformanceMonitoring(): void {\n // Log performance stats periodically\n setInterval(() => {\n if (!this.enabled) return\n\n const perfStats = ResponsivePerformanceMonitor.getStats()\n const cacheStats = cssRuleCache.getStats()\n\n this.log('debug', 'Performance Stats:', {\n cache: cacheStats,\n performance: perfStats,\n })\n }, 5000)\n }\n\n /**\n * Log current responsive state\n */\n static logResponsiveState(): void {\n if (!this.enabled) return\n\n const context = createBreakpointContext()\n const config = getCurrentBreakpointConfig()\n\n console.group('🔍 TachUI Responsive State')\n console.log('Current breakpoint:', context.current)\n console.log('Viewport:', `${context.width}×${context.height}`)\n console.log('Configuration:', config)\n\n // Test media queries only in browser environment\n if (typeof window !== 'undefined' && window.matchMedia) {\n const queries = {\n Mobile: MediaQueries.mobile,\n Tablet: MediaQueries.tablet,\n Desktop: MediaQueries.desktop,\n 'Touch Device': MediaQueries.touchDevice,\n 'Dark Mode': MediaQueries.darkMode,\n 'Reduced Motion': MediaQueries.reducedMotion,\n }\n\n console.log('Media Query Results:')\n for (const [name, query] of Object.entries(queries)) {\n try {\n console.log(` ${name}: ${window.matchMedia(query).matches}`)\n } catch (_error) {\n console.log(` ${name}: Error testing query`)\n }\n }\n }\n\n console.groupEnd()\n }\n\n /**\n * Inspect a responsive value\n */\n static inspectResponsiveValue<T>(\n value: ResponsiveValue<T>,\n label?: string\n ): void {\n if (!this.enabled) return\n\n const currentBreakpoint = getCurrentBreakpoint()\n\n console.group(`🔍 Responsive Value${label ? ` - ${label}` : ''}`)\n\n if (isResponsiveValue(value)) {\n const responsiveObj = value as Partial<Record<BreakpointKey, T>>\n console.log('Responsive object:', responsiveObj)\n\n // Show resolved value for current breakpoint\n const breakpointOrder: BreakpointKey[] = [\n 'base',\n 'sm',\n 'md',\n 'lg',\n 'xl',\n '2xl',\n ]\n const currentIndex = breakpointOrder.indexOf(currentBreakpoint())\n\n let resolvedValue: T | undefined\n for (let i = currentIndex; i >= 0; i--) {\n const bp = breakpointOrder[i]\n if (responsiveObj[bp] !== undefined) {\n resolvedValue = responsiveObj[bp]\n console.log(`Resolved value (${bp}):`, resolvedValue)\n break\n }\n }\n\n // Show all defined breakpoints\n console.log('Defined breakpoints:')\n for (const [bp, val] of Object.entries(responsiveObj)) {\n if (val !== undefined) {\n const isCurrent = bp === currentBreakpoint()\n console.log(` ${isCurrent ? '→' : ' '} ${bp}:`, val)\n }\n }\n } else {\n console.log('Static value:', value)\n }\n\n console.groupEnd()\n }\n\n /**\n * Test responsive behavior\n */\n static testResponsiveBehavior(\n responsiveValue: ResponsiveValue<any>,\n testBreakpoints: BreakpointKey[] = ['base', 'sm', 'md', 'lg', 'xl', '2xl']\n ): Partial<Record<BreakpointKey, any>> {\n if (!this.enabled) return {}\n\n const results: Partial<Record<BreakpointKey, any>> = {}\n\n // Mock different breakpoints and test resolution\n testBreakpoints.forEach(bp => {\n // This would require breakpoint mocking functionality\n // For now, just log what would happen\n this.log('debug', `Testing breakpoint ${bp}:`, responsiveValue)\n })\n\n return results\n }\n\n /**\n * Export responsive configuration for debugging\n */\n static exportConfiguration(): {\n breakpoints: Record<BreakpointKey, string>\n currentContext: BreakpointContext\n performance: any\n mediaQueries: Record<string, boolean>\n } {\n const context = createBreakpointContext()\n const config = getCurrentBreakpointConfig()\n const perfStats = ResponsivePerformanceMonitor.getStats()\n const cacheStats = cssRuleCache.getStats()\n\n const mediaQueryResults: Record<string, boolean> = {}\n if (typeof window !== 'undefined' && window.matchMedia) {\n for (const [name, query] of Object.entries(MediaQueries)) {\n if (typeof query === 'string') {\n try {\n mediaQueryResults[name] = window.matchMedia(query).matches\n } catch (_error) {\n mediaQueryResults[name] = false\n }\n }\n }\n }\n\n return {\n breakpoints: config,\n currentContext: context,\n performance: {\n cache: cacheStats,\n timings: perfStats,\n },\n mediaQueries: mediaQueryResults,\n }\n }\n}\n\n/**\n * Responsive value inspector hook\n */\nexport function useResponsiveInspector<T>(\n value: ResponsiveValue<T>,\n label?: string\n): Signal<{\n resolvedValue: T | undefined\n activeBreakpoint: BreakpointKey\n allValues: Partial<Record<BreakpointKey, T>>\n isResponsive: boolean\n}> {\n const currentBreakpoint = getCurrentBreakpoint()\n\n return createComputed(() => {\n const breakpoint = currentBreakpoint()\n const isResponsive = isResponsiveValue(value)\n\n let resolvedValue: T | undefined\n let allValues: Partial<Record<BreakpointKey, T>> = {}\n\n if (isResponsive) {\n const responsiveObj = value as Partial<Record<BreakpointKey, T>>\n allValues = responsiveObj\n\n // Resolve value for current breakpoint\n const breakpointOrder: BreakpointKey[] = [\n 'base',\n 'sm',\n 'md',\n 'lg',\n 'xl',\n '2xl',\n ]\n const currentIndex = breakpointOrder.indexOf(breakpoint)\n\n for (let i = currentIndex; i >= 0; i--) {\n const bp = breakpointOrder[i]\n if (responsiveObj[bp] !== undefined) {\n resolvedValue = responsiveObj[bp]\n break\n }\n }\n } else {\n resolvedValue = value as T\n allValues = { [breakpoint]: resolvedValue }\n }\n\n // Log in development mode\n if (ResponsiveDevTools.enabled && label) {\n ResponsiveDevTools.inspectResponsiveValue(value, label)\n }\n\n return {\n resolvedValue,\n activeBreakpoint: breakpoint,\n allValues,\n isResponsive,\n }\n }) as Signal<{\n resolvedValue: T | undefined\n activeBreakpoint: BreakpointKey\n allValues: Partial<Record<BreakpointKey, T>>\n isResponsive: boolean\n }>\n}\n\n/**\n * Browser compatibility testing utilities\n */\nexport class BrowserCompatibility {\n /**\n * Test CSS features support\n */\n static testCSSFeatures(): Record<string, boolean> {\n if (\n typeof window === 'undefined' ||\n typeof CSS === 'undefined' ||\n !CSS.supports\n ) {\n return {}\n }\n\n const features: Record<string, boolean> = {}\n\n try {\n // Test CSS Grid\n features.cssGrid = CSS.supports('display', 'grid')\n\n // Test CSS Flexbox\n features.flexbox = CSS.supports('display', 'flex')\n\n // Test CSS Custom Properties\n features.customProperties = CSS.supports('--test', 'value')\n\n // Test viewport units\n features.viewportUnits = CSS.supports('width', '100vw')\n\n // Test media queries\n features.mediaQueries = typeof window.matchMedia === 'function'\n\n // Test container queries (modern feature)\n features.containerQueries = CSS.supports('container-type', 'inline-size')\n\n // Test CSS logical properties\n features.logicalProperties = CSS.supports('margin-inline-start', '1rem')\n } catch (_error) {\n // If any test fails, just return what we have so far\n }\n\n return features\n }\n\n /**\n * Test responsive behavior across different viewport sizes\n */\n static testViewportSizes(\n callback: (width: number, height: number) => void\n ): void {\n if (typeof window === 'undefined') return\n\n const testSizes = [\n { width: 320, height: 568, name: 'iPhone SE' },\n { width: 375, height: 667, name: 'iPhone 8' },\n { width: 768, height: 1024, name: 'iPad Portrait' },\n { width: 1024, height: 768, name: 'iPad Landscape' },\n { width: 1280, height: 720, name: 'Desktop Small' },\n { width: 1920, height: 1080, name: 'Desktop Large' },\n ]\n\n // This would require a testing environment or dev tools integration\n if (ResponsiveDevTools.enabled) {\n ResponsiveDevTools['log']('info', 'Testing viewport sizes:', testSizes)\n }\n\n testSizes.forEach(size => {\n // In a real implementation, this would simulate the viewport size\n callback(size.width, size.height)\n })\n }\n}\n\n/**\n * Development-only global helpers\n */\nif (typeof window !== 'undefined' && process.env.NODE_ENV !== 'production') {\n // Add global helpers for development\n ;(window as any).tachUIResponsive = {\n devTools: ResponsiveDevTools,\n inspector: useResponsiveInspector,\n compatibility: BrowserCompatibility,\n logState: () => ResponsiveDevTools.logResponsiveState(),\n export: () => ResponsiveDevTools.exportConfiguration(),\n }\n}\n","/**\n * Responsive Design System - Main Export\n *\n * Complete CSS-native responsive design system for tachUI.\n * Provides mobile-first responsive modifiers with TypeScript support.\n */\n\nimport { registerModifierWithMetadata } from '@tachui/core/modifiers'\nimport type { ModifierRegistry, PluginInfo } from '@tachui/registry'\nimport { TACHUI_PACKAGE_VERSION } from '../../version'\nimport {\n createResponsiveModifier,\n createMediaQueryModifier,\n createResponsivePropertyModifier,\n createResponsiveLayoutModifier,\n} from './responsive-modifier'\n\n// Type definitions\nexport * from './types'\n\n// Breakpoint configuration and utilities\nexport * from './breakpoints'\n\n// CSS generation engine\nexport * from './css-generator'\n\n// Responsive modifier implementations\nexport * from './responsive-modifier'\n\n// Enhanced modifier builder with responsive capabilities\nexport * from './responsive-builder'\n\n// Responsive utilities and hooks\nexport * from './utilities'\n\n// Responsive layout patterns\nexport * from './layout-patterns'\n\n// Performance optimizations\nexport * from './performance'\n\n// Advanced responsive utilities\nexport * from './advanced-utilities'\n\n// Development tools and debugging\nexport * from './dev-tools'\n\n// Re-export commonly used types for convenience\nexport type {\n ResponsiveValue,\n BreakpointKey,\n ResponsiveStyleConfig,\n} from './types'\n\nexport type { ResponsiveModifierBuilder } from './responsive-builder'\n\nexport {\n ResponsiveModifierBuilderImpl,\n withResponsive,\n createResponsiveBuilder,\n} from './responsive-builder'\n\n// Re-export commonly used functions\nexport {\n configureBreakpoints,\n initializeResponsiveSystem,\n getCurrentBreakpointConfig,\n getCurrentBreakpoint,\n getViewportDimensions,\n createBreakpointContext,\n generateMediaQuery,\n BreakpointPresets,\n} from './breakpoints'\n\nexport {\n createResponsiveModifier,\n createMediaQueryModifier,\n createResponsivePropertyModifier,\n createResponsiveLayoutModifier,\n} from './responsive-modifier'\n\nexport { useBreakpoint, useMediaQuery, useResponsiveValue } from './utilities'\n\nexport { DEFAULT_BREAKPOINTS } from './types'\n\nexport {\n MediaQueries,\n enableResponsiveDebugOverlay,\n logResponsiveState,\n} from './utilities'\n\nexport {\n ResponsiveGridPatterns,\n ResponsiveFlexPatterns,\n ResponsiveContainerPatterns,\n ResponsiveVisibilityPatterns,\n ResponsiveSpacingPatterns,\n ResponsiveTypographyPatterns,\n LayoutPatterns,\n ResponsiveGrid,\n Flex,\n Container,\n Visibility,\n Spacing,\n ResponsiveTypography,\n} from './layout-patterns'\n\nexport {\n AdvancedBreakpointUtils,\n ResponsiveHooks,\n ResponsiveTargeting,\n ResponsiveDataUtils,\n ResponsiveAdvanced,\n} from './advanced-utilities'\n\nexport {\n OptimizedCSSGenerator,\n ResponsivePerformanceMonitor,\n cssRuleCache,\n} from './performance'\n\nexport {\n ResponsiveDevTools,\n BrowserCompatibility,\n useResponsiveInspector,\n} from './dev-tools'\n\nconst RESPONSIVE_PLUGIN_INFO: PluginInfo = {\n name: '@tachui/responsive',\n version: TACHUI_PACKAGE_VERSION,\n author: 'TachUI Team',\n verified: true,\n}\n\ntype ResponsiveRegistration = [\n name: string,\n factory: (...args: any[]) => any,\n metadata: {\n category: 'layout' | 'custom'\n priority: number\n signature: string\n description: string\n }\n]\n\nconst RESPONSIVE_PRIORITY = 80\n\nconst responsiveRegistrations: ResponsiveRegistration[] = [\n [\n 'responsive',\n createResponsiveModifier,\n {\n category: 'layout',\n priority: RESPONSIVE_PRIORITY,\n signature: '(config: ResponsiveStyleConfig) => Modifier',\n description:\n 'Applies responsive style mappings across configured breakpoints.',\n },\n ],\n [\n 'mediaQuery',\n createMediaQueryModifier,\n {\n category: 'layout',\n priority: RESPONSIVE_PRIORITY,\n signature: '(query: string, styles: Record<string, any>) => Modifier',\n description: 'Attaches custom CSS rules for a media query to a component.',\n },\n ],\n [\n 'responsiveProperty',\n createResponsivePropertyModifier,\n {\n category: 'layout',\n priority: RESPONSIVE_PRIORITY,\n signature:\n '(property: string, value: ResponsiveValue<any>) => Modifier',\n description:\n 'Creates a responsive modifier from a single style property/value map.',\n },\n ],\n [\n 'responsiveLayout',\n createResponsiveLayoutModifier,\n {\n category: 'layout',\n priority: RESPONSIVE_PRIORITY,\n signature: '(config: ResponsiveLayoutConfig) => Modifier',\n description:\n 'Configures responsive flexbox layout properties such as direction, wrap, and gap.',\n },\n ],\n]\n\nlet responsiveRegistered = false\n\nexport interface RegisterResponsiveModifiersOptions {\n registry?: ModifierRegistry\n plugin?: PluginInfo\n force?: boolean\n}\n\nexport function registerResponsiveModifiers(\n options?: RegisterResponsiveModifiersOptions,\n): void {\n const targetRegistry = options?.registry\n const targetPlugin = options?.plugin ?? RESPONSIVE_PLUGIN_INFO\n const shouldForce = options?.force === true\n const isCustomTarget = Boolean(targetRegistry || options?.plugin)\n\n if (!isCustomTarget && responsiveRegistered && !shouldForce) {\n return\n }\n\n responsiveRegistrations.forEach(([name, factory, metadata]) => {\n registerModifierWithMetadata(\n name,\n factory,\n metadata,\n targetRegistry,\n targetPlugin,\n )\n })\n\n if (!isCustomTarget) {\n responsiveRegistered = true\n }\n}\n","/**\n * @tachui/responsive - Advanced Responsive Design Plugin\n *\n * Advanced responsive design utilities that extend the core responsive system\n * with sophisticated breakpoint management, responsive typography, container queries,\n * and adaptive component behaviors.\n */\n\n// Export all responsive modifiers and utilities\nexport * from './modifiers/responsive'\n\n// Re-export core types for convenience\nexport type {\n ResponsiveValue,\n BreakpointKey,\n ResponsiveStyleConfig,\n ResponsiveModifierResult,\n BreakpointConfig,\n} from './modifiers/responsive/types'\n\n// Re-export commonly used functions\nexport {\n createResponsiveModifier,\n ResponsiveCSSGenerator,\n CSSInjector,\n configureBreakpoints,\n useBreakpoint,\n useMediaQuery,\n useResponsiveValue,\n DEFAULT_BREAKPOINTS,\n} from './modifiers/responsive'\n\nimport { registerResponsiveModifiers } from './modifiers/responsive'\n\nregisterResponsiveModifiers()\n\nexport { registerResponsiveModifiers } from './modifiers/responsive'\n\nif (typeof import.meta !== 'undefined' && (import.meta as any).hot) {\n ;(import.meta as any).hot.accept(() => {\n registerResponsiveModifiers({ force: true })\n })\n}\n"],"names":["ComputationState","computationIdCounter","moduleInstanceId","currentComputation","currentOwner","moduleInstances","reactiveContext","value","getCurrentComputation","getCurrentOwner","ComputationImpl","fn","owner","source","prevComputation","error","observer","defaultEquals","a","b","UpdatePriority","ComputedImpl","options","computation","previousValue","result","createComputed","computed","accessor","signalIdCounter","SignalImpl","initialValue","newValue","scheduleUpdate","updateQueue","isFlushingUpdates","flushUpdates","computations","createSignal","signal","getter","setter","currentTheme","setCurrentTheme","theme","detectSystemTheme","registrySingleton","TACHUI_PACKAGE_VERSION","packageJson.version","metadataEnabledRegistries","registeredPlugins","CORE_PLUGIN_INFO","ensureMetadataRegistration","registry","ensurePluginRegistered","plugin","plugins","registerModifierWithMetadata","name","factory","metadata","globalModifierRegistry","DEFAULT_BREAKPOINTS","isResponsiveValue","key","isValidBreakpointKey","currentBreakpointConfig","currentBreakpoint","setCurrentBreakpoint","viewportDimensions","setViewportDimensions","responsiveSystemInitialized","resizeListener","updateViewportDimensions","updateCurrentBreakpoint","orientationChangeListener","configureBreakpoints","config","validateBreakpointConfig","getCurrentBreakpointConfig","getCurrentBreakpoint","getViewportDimensions","initializeResponsiveSystem","__syncResponsiveSignalsForTests","__resetResponsiveSystemForTests","createBreakpointContext","current","dimensions","breakpoint","isBreakpointAbove","isBreakpointBelow","min","max","query","breakpointToPixels","getBreakpointIndex","generateMediaQuery","generateRangeMediaQuery","queries","maxBreakpoints","maxIndex","nextBreakpoint","maxWidth","getSortedBreakpoints","getBreakpointsAbove","sorted","index","getBreakpointsBelow","width","breakpoints","sortedKeys","i","prev","prevValue","currentValue","BreakpointPresets","ResponsiveCSSGenerator","mediaQueries","cssRules","fallbackStyles","hasResponsiveStyles","property","baseStyles","sortedBreakpoints","breakpointValue","cssProperty","cssValue","styles","rules","baseRule","groupedQueries","queryMediaQueries","combinedStyles","mq","mediaRule","grouped","selector","generateMinified","includeComments","indent","newline","space","rule","doubleIndent","match","unitlessProperties","prop","conflictingProperties","breakpointConfig","generateResponsiveProperty","generator","generateCustomMediaQuery","mediaQueryConfig","CSSInjector","style","styleSheet","CSSRuleCache","cssRuleCache","OptimizedCSSGenerator","minify","batch","deduplicate","cacheKey","cached","css","processedBreakpoints","mediaQuery","breakpointKey","batchedCSS","styleElement","ResponsivePerformanceMonitor","startTime","duration","measurements","stats","avg","sum","val","RESPONSIVE_MODIFIER_PRIORITY","ResponsiveModifier","BaseModifier","node","_context","element","endMeasurement","createEffect","currentConfig","hasAssets","_key","isSignal","isComputed","_breakpoint","getThemeSignal","newConfig","_element","resolved","resolvedBreakpoints","createResponsiveModifier","MediaQueryModifier","createMediaQueryModifier","createResponsivePropertyModifier","createResponsiveLayoutModifier","styleConfig","ResponsiveModifierBuilderImpl","baseBuilder","target","baseProp","args","modifier","orientation","scheme","ResponsiveBreakpointBuilderImpl","parentBuilder","responsiveValue","leftModifier","rightModifier","topModifier","bottomModifier","withResponsive","builder","createResponsiveBuilder","useBreakpoint","context","currentIndex","minIndex","matchesSignal","setMatches","handler","e","useMediaQuery","matches","useResponsiveValue","responsiveObj","breakpointOrder","bp","resolveResponsiveValue","targetBreakpoint","targetIndex","createResponsiveCSSVariables","prefix","values","cssVariables","varName","MediaQueries","height","ratio","dpi","combineMediaQueries","q","orMediaQueries","createResponsiveVisibility","logResponsiveState","commonQueries","enableResponsiveDebugOverlay","position","showDimensions","showBreakpoint","overlay","updateOverlay","content","ResponsiveGridPatterns","gridConfig","widthValue","maxCols","columns","cols","ResponsiveFlexPatterns","flexConfig","direction","ResponsiveContainerPatterns","containerConfig","sectionConfig","ResponsiveVisibilityPatterns","displayConfig","ResponsiveSpacingPatterns","paddingConfig","marginConfig","gapConfig","ResponsiveTypographyPatterns","typographyConfig","scaleValue","baseSize","minBp","maxBp","minSize","maxSize","LayoutPatterns","collapseBreakpoint","sidebarWidth","AdvancedBreakpointUtils","getValue","dependencies","dep","smoothing","clamp","sortedPoints","bpWidth","lowerPoint","upperPoint","factor","smoothedFactor","condition","trueValue","falseValue","activeValue","ResponsiveHooks","arrays","objects","functions","initialValues","state","setState","stateObj","createMemo","effect","cleanup","prevContext","ResponsiveTargeting","callback","oldBreakpoint","newBreakpoint","minBreakpoint","maxBreakpoint","callbacks","isWithinRange","withinCleanup","enterCleanup","nowWithinRange","ResponsiveDataUtils","data","itemsPerPage","currentPage","setCurrentPage","itemsPerPageResolved","totalPages","currentItems","itemsCount","startIndex","endIndex","hasNext","hasPrev","setPage","page","maxPage","nextPage","prevPage","filters","filter","sorters","sorter","ResponsiveAdvanced","ResponsiveDevTools","level","levels","currentLevel","closeButton","resizeTimer","isActive","perfStats","cacheStats","testQueries","el","label","resolvedValue","isCurrent","testBreakpoints","results","mediaQueryResults","useResponsiveInspector","isResponsive","allValues","BrowserCompatibility","features","testSizes","size","RESPONSIVE_PLUGIN_INFO","RESPONSIVE_PRIORITY","responsiveRegistrations","responsiveRegistered","registerResponsiveModifiers","targetRegistry","targetPlugin","shouldForce","isCustomTarget"],"mappings":"8KACaA,EAAmB,CAC9B,MAAO,EACP,MAAO,EACP,MAAO,EACP,SAAU,CACZ,ECUA,IAAIC,GAAuB,EAI3B,MAAMC,GAAmB,KAAK,SAAS,SAAS,EAAE,EAAE,OAAO,EAAG,CAAC,EAG/D,IAAIC,GAAyC,KACzCC,GAA6B,KAIjC,MAAMC,OAAsB,IAC5BA,GAAgB,IAAIH,EAAgB,EAKpC,MAAMI,EAAkB,CACtB,IAAI,oBAAqB,CACvB,OAAOH,EACT,EACA,IAAI,mBAAmBI,EAAO,CAC5BJ,GAAqBI,CACvB,EACA,IAAI,cAAe,CACjB,OAAOH,EACT,EACA,IAAI,aAAaG,EAAO,CACtBH,GAAeG,CACjB,CAOF,EAKO,SAASC,IAA4C,CAE1D,OADoBF,EAAgB,kBAEtC,CAKO,SAASG,IAAgC,CAC9C,OAAOH,EAAgB,YACzB,CAwDO,MAAMI,EAAuC,CACzC,GACA,MACA,GACA,YAAc,IACd,cAAgB,IACzB,MAA+BV,EAAiB,MAChD,MAAa,OAEb,YAAYW,EAAeC,EAAsB,KAAM,CACrD,KAAK,GAAK,EAAEX,GACZ,KAAK,GAAKU,EACV,KAAK,MAAQC,EAETA,GAAS,CAACA,EAAM,UAClBA,EAAM,QAAQ,IAAI,IAAI,CAE1B,CAEA,SAAe,CACb,GAAI,KAAK,QAAUZ,EAAiB,SAClC,OAAO,KAAK,MAId,UAAWa,KAAU,KAAK,QACpBA,GAAU,OAAOA,GAAW,UAAY,mBAAoBA,GAC5DA,EAAe,eAAe,IAAI,EAGxC,KAAK,QAAQ,MAAA,EAEb,MAAMC,EAAkBR,EAAgB,mBACxCA,EAAgB,mBAAqB,KAErC,GAAI,CACF,YAAK,MAAQN,EAAi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eG,GACf,SAAU,IAAMpB,EAAmB,mBAAA,EACnC,OAAQ,IAAMA,EAAmB,oBAAA,CAAoB,GCliBzD,MAAMwB,GAAqC,CACzC,KAAM,qBACN,QAASxU,GACT,OAAQ,cACR,SAAU,EACZ,EAaMyU,EAAsB,GAEtBC,GAAoD,CACxD,CACE,aACApL,EACA,CACE,SAAU,SACV,SAAUmL,EACV,UAAW,8CACX,YACE,kEAAA,CACJ,EAEF,CACE,aACAjL,EACA,CACE,SAAU,SACV,SAAUiL,EACV,UAAW,2DACX,YAAa,6DAAA,CACf,EAEF,CACE,qBACAhL,EACA,CACE,SAAU,SACV,SAAUgL,EACV,UACE,8DACF,YACE,uEAAA,CACJ,EAEF,CACE,mBACA/K,GACA,CACE,SAAU,SACV,SAAU+K,EACV,UAAW,+CACX,YACE,mFAAA,CACJ,CAEJ,EAEA,IAAIE,GAAuB,GAQpB,SAASC,GACdrW,EACM,CACN,MAAMsW,EAAiBtW,GAAS,SAC1BuW,EAAevW,GAAS,QAAUiW,GAClCO,EAAcxW,GAAS,QAAU,GACjCyW,EAAiB,GAAQH,GAAkBtW,GAAS,QAEtD,CAACyW,GAAkBL,IAAwB,CAACI,IAIhDL,GAAwB,QAAQ,CAAC,CAAC/T,EAAMC,EAASC,CAAQ,IAAM,CAC7DH,GACEC,EACAC,EACAC,EACAgU,EACAC,CAAA,CAEJ,CAAC,EAEIE,IACHL,GAAuB,IAE3B,CCjMAC,GAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * @tachui/responsive - Advanced Responsive Design Plugin\n *\n * Advanced responsive design utilities that extend the core responsive system\n * with sophisticated breakpoint management, responsive typography, container queries,\n * and adaptive component behaviors.\n */\n\n// Export all responsive modifiers and utilities\nexport * from './modifiers/responsive'\n\n// Re-export core types for convenience\nexport type {\n ResponsiveValue,\n BreakpointKey,\n ResponsiveStyleConfig,\n ResponsiveModifierResult,\n BreakpointConfig,\n} from './modifiers/responsive/types'\n\n// Re-export commonly used functions\nexport {\n createResponsiveModifier,\n ResponsiveCSSGenerator,\n CSSInjector,\n configureBreakpoints,\n useBreakpoint,\n useMediaQuery,\n useResponsiveValue,\n DEFAULT_BREAKPOINTS,\n} from './modifiers/responsive'\n\nimport { registerResponsiveModifiers } from './modifiers/responsive'\n\nregisterResponsiveModifiers()\n\nexport { registerResponsiveModifiers } from './modifiers/responsive'\n\nif (typeof import.meta !== 'undefined' && (import.meta as any).hot) {\n ;(import.meta as any).hot.accept(() => {\n registerResponsiveModifiers({ force: true })\n })\n}\n"],"names":["registerResponsiveModifiers"],"mappings":"uHAkCAA,EAAAA,4BAAA"}
|