@pyreon/styler 0.26.0 → 0.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/lib/index.js +17 -3
- package/lib/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -214,7 +214,9 @@ Templates with function interpolations resolve on every render. A class-cache ke
|
|
|
214
214
|
|
|
215
215
|
### CSS nesting passes through
|
|
216
216
|
|
|
217
|
-
Native CSS nesting is forwarded unchanged — `&:hover`, `&::before`, nested selectors, and `@media` queries work as-is in
|
|
217
|
+
Native CSS nesting is forwarded unchanged — `&:hover`, `&::before`, nested selectors, and `@media` queries work as-is in browsers that support native CSS Nesting.
|
|
218
|
+
|
|
219
|
+
**Browser baseline**: Chrome/Edge **112+** (Apr 2023), Safari **16.5+** (May 2023), Firefox **117+** (Aug 2023). For older targets, run the consumer build through PostCSS Nesting or Vite's lightningcss (which can flatten `&:hover` down to `.classname:hover` at build time) — the styler itself does not transform nesting selectors, so any consumer-side CSS post-processor that handles native nesting will work.
|
|
218
220
|
|
|
219
221
|
```ts
|
|
220
222
|
const Card = styled('div')`
|
package/lib/index.js
CHANGED
|
@@ -373,9 +373,23 @@ const filterProps = (props) => {
|
|
|
373
373
|
*/
|
|
374
374
|
const buildProps = (rawProps, generatedCls, isDOM, customFilter) => {
|
|
375
375
|
const result = {};
|
|
376
|
-
const
|
|
377
|
-
if (
|
|
378
|
-
|
|
376
|
+
const classDesc = Object.getOwnPropertyDescriptor(rawProps, "class") ?? Object.getOwnPropertyDescriptor(rawProps, "className");
|
|
377
|
+
if (classDesc?.get) {
|
|
378
|
+
const getUserCls = classDesc.get;
|
|
379
|
+
Object.defineProperty(result, "class", {
|
|
380
|
+
enumerable: true,
|
|
381
|
+
configurable: true,
|
|
382
|
+
get() {
|
|
383
|
+
const uc = getUserCls.call(rawProps);
|
|
384
|
+
if (generatedCls) return uc ? `${generatedCls} ${uc}` : generatedCls;
|
|
385
|
+
return uc ?? "";
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
} else {
|
|
389
|
+
const userCls = rawProps.class || rawProps.className;
|
|
390
|
+
if (generatedCls) result.class = userCls ? `${generatedCls} ${userCls}` : generatedCls;
|
|
391
|
+
else if (userCls) result.class = userCls;
|
|
392
|
+
}
|
|
379
393
|
const copyDescriptor = (key) => {
|
|
380
394
|
const d = Object.getOwnPropertyDescriptor(rawProps, key);
|
|
381
395
|
if (d) Object.defineProperty(result, key, d);
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_countSink","_countSink"],"sources":["../src/resolve.ts","../src/css.ts","../src/forward.ts","../src/shared.ts","../src/hash.ts","../src/sheet.ts","../src/ThemeProvider.ts","../src/globalStyle.ts","../src/keyframes.ts","../src/styled.tsx","../src/useCSS.ts","../src/index.ts"],"sourcesContent":["/**\n * Interpolation resolver: converts tagged template strings + values into a\n * final CSS string. Handles nested CSSResults, arrays, functions, and\n * primitive values.\n */\n\nimport type { DefaultTheme } from './ThemeProvider'\n\n// Dev-time counter sink — populated by `@pyreon/perf-harness` on install().\n// Guarded on call sites with `process.env.NODE_ENV !== 'production'` so prod bundles\n// tree-shake the entire reference. No cross-package import, no publish surface.\nconst _countSink = globalThis as { __pyreon_count__?: (name: string, n?: number) => void }\n\n/**\n * Props passed to interpolation functions inside tagged templates.\n * Generic `P` allows consumers to type their custom props (e.g. transient $-prefixed):\n *\n * @example\n * styled('div')<{ $color: string }>`\n * background: ${(props) => props.$color}; // props.$color is typed!\n * `\n */\nexport type StyledProps<P extends object = Record<string, unknown>> = P & {\n theme?: DefaultTheme & Record<string, unknown>\n}\n\nexport type Interpolation<P extends object = Record<string, unknown>> =\n | string\n | number\n | boolean\n | null\n | undefined\n | CSSResult\n | Interpolation<P>[]\n | ((props: StyledProps<P>) => Interpolation<P>)\n\n/**\n * Lazy representation of a `css` tagged template. Stores the raw template\n * strings and interpolation values without resolving them. Resolution is\n * deferred until a styled component renders (or until explicitly resolved).\n */\nexport class CSSResult {\n /**\n * Memoized result of `isDynamic(this)`. Populated on first access from\n * `shared.ts#isDynamic`. CSSResult instances are typically created once\n * at module load (one per `css\\`...\\`` literal) and reused everywhere —\n * a `styled()` component, a `useCSS` consumer, a nested interpolation,\n * etc. Lazy-cache avoids rescanning whole sub-trees on every consumer.\n * Ported from vitus-labs `c483cabc`.\n */\n _isDynamic: boolean | undefined = undefined\n\n /**\n * Memoized resolved CSS string for STATIC CSSResults — populated by\n * `resolveValue` the first time a known-static nested CSSResult is\n * resolved. Safe because props don't affect output when there are no\n * function interpolations. Skipped for dynamic CSSResults (the resolved\n * string depends on props each call). Common pattern: a shared static\n * snippet interpolated into many dynamic components — pre-cache, that\n * snippet was re-resolved per-render of every consumer. Ported from\n * vitus-labs `754cd203`; measured upstream: 2.6M→6.5M ops/s (+149%,\n * ~2.5× speedup on the 8-repeated-resolve micro).\n */\n _staticResolved: string | undefined = undefined\n\n constructor(\n readonly strings: TemplateStringsArray,\n readonly values: Interpolation[],\n ) {}\n\n /** Resolve with empty props — useful for static templates, testing, and debugging. */\n toString(): string {\n return resolve(this.strings, this.values, {})\n }\n}\n\n/** Resolve a tagged template's strings + values into a final CSS string. */\nexport const resolve = (\n strings: TemplateStringsArray,\n values: Interpolation[],\n props: Record<string, any>,\n): string => {\n if (process.env.NODE_ENV !== 'production') _countSink.__pyreon_count__?.('styler.resolve')\n // Tagged templates guarantee strings.length === values.length + 1,\n // so strings[0] and strings[i+1] are always defined — no ?? needed.\n let result = strings[0] as string\n for (let i = 0; i < values.length; i++) {\n const v = values[i]\n const s = strings[i + 1] as string\n // Inline the most common value types to avoid function call overhead.\n if (typeof v === 'function') {\n const r = v(props)\n result +=\n (typeof r === 'string'\n ? r\n : r == null || r === false || r === true\n ? ''\n : resolveValue(r as Interpolation, props)) + s\n } else if (v == null || v === false || v === true) {\n result += s\n } else if (typeof v === 'string') {\n result += v + s\n } else if (typeof v === 'number') {\n result += v + s\n } else {\n result += resolveValue(v, props) + s\n }\n }\n return result\n}\n\n/**\n * Normalize resolved CSS text for strict `insertRule` compatibility.\n *\n * Single-pass scanner that handles all cleanup in one traversal:\n * - Strips block comments and line comments (preserves :// in URLs)\n * - Collapses whitespace to single spaces\n * - Removes redundant semicolons\n * - Trims leading/trailing whitespace\n */\nconst normCache = new Map<string, string>()\n/** Clear the normalizeCSS cache (called during HMR cleanup). */\nexport const clearNormCache = () => normCache.clear()\n\nexport const normalizeCSS = (css: string): string => {\n const cached = normCache.get(css)\n if (cached !== undefined) return cached\n\n const len = css.length\n let out = ''\n let space = false // pending space to emit before next non-whitespace char\n let last = 0 // charCode of last char written to output (0 = nothing yet)\n\n for (let i = 0; i < len; i++) {\n const c = css.charCodeAt(i)\n\n // /* block comment */\n if (c === 47 /* / */ && css.charCodeAt(i + 1) === 42 /* * */) {\n const end = css.indexOf('*/', i + 2)\n i = end === -1 ? len : end + 1\n space = true\n continue\n }\n\n // // line comment (but not :// in URLs)\n if (c === 47 /* / */ && css.charCodeAt(i + 1) === 47 /* / */ && last !== 58 /* : */) {\n const nl = css.indexOf('\\n', i + 2)\n i = nl === -1 ? len : nl\n space = true\n continue\n }\n\n // Whitespace → collapse\n if (c === 32 || c === 9 || c === 10 || c === 13 || c === 12) {\n space = true\n continue\n }\n\n // Semicolon → skip if redundant (after start, {, }, or another ;)\n if (c === 59 /* ; */) {\n if (last === 0 || last === 123 /* { */ || last === 125 /* } */ || last === 59 /* ; */) {\n continue\n }\n space = false\n out += ';'\n last = 59\n continue\n }\n\n // Regular char — emit pending space (but not at start of output)\n if (space && last !== 0) out += ' '\n space = false\n\n out += css[i]\n last = c\n }\n\n // Evict oldest ~10% to prevent memory leaks without cliff-edge drop\n if (normCache.size > 2000) {\n let count = 0\n for (const key of normCache.keys()) {\n if (count >= 200) break\n normCache.delete(key)\n count++\n }\n }\n normCache.set(css, out)\n\n return out\n}\n\nexport const resolveValue = (value: Interpolation, props: Record<string, any>): string => {\n // null, undefined, false, true → empty (enables conditional: ${cond && css`...`})\n if (value == null || value === false || value === true) return ''\n\n // function interpolation → call with props/theme context, resolve result\n if (typeof value === 'function') return resolveValue(value(props) as Interpolation, props)\n\n // nested CSSResult → recursively resolve, with static-result memoization.\n // When `_isDynamic === false` (populated by shared.ts#isDynamic at styled\n // component creation), the resolved string is independent of props and can\n // be cached on the instance. Saves re-walking strings/values for every\n // consumer of a shared static snippet. Ported from vitus-labs `754cd203`;\n // measured upstream: ~2.5× speedup on 8-repeated-resolve micro.\n if (value instanceof CSSResult) {\n if (value._isDynamic === false) {\n if (value._staticResolved === undefined) {\n value._staticResolved = resolve(value.strings, value.values, {})\n }\n return value._staticResolved\n }\n return resolve(value.strings, value.values, props)\n }\n\n // array of results (e.g. from makeItResponsive's breakpoints.map())\n if (Array.isArray(value)) {\n let arrayResult = ''\n for (let i = 0; i < value.length; i++) {\n arrayResult += resolveValue(value[i], props)\n }\n return arrayResult\n }\n\n return String(value)\n}\n","import { CSSResult, type Interpolation } from './resolve'\n\n/**\n * Tagged template function for CSS. Captures the template strings and\n * interpolation values as a lazy CSSResult — resolution is deferred\n * until a styled component renders.\n *\n * Works as both a tagged template (`css\\`...\\``) and a regular function\n * call (`css(...args)`) since tagged templates are syntactic sugar for\n * function calls with (TemplateStringsArray, ...values).\n */\nexport const css = (strings: TemplateStringsArray, ...values: Interpolation[]): CSSResult =>\n new CSSResult(strings, values)\n","/**\n * HTML prop filtering. Prevents unknown props from being forwarded to DOM\n * elements (which causes warnings). Props starting with `$` are\n * transient (styling-only) and are always filtered out.\n */\n\n// Common HTML attributes, event handlers, and ARIA/data attributes.\n//\n// Using a plain object with `key in HTML_PROPS` instead of `Set.has(key)`:\n// V8 inlines `in` checks via hidden-class lookups (the object has a fixed\n// shape at module load and never changes), which is meaningfully faster\n// than going through the Set protocol on hot prop-filter paths. Measured\n// upstream (vitus-labs `be471b19`): +19% on the 5-lookup mix benchmark\n// (4 hits + 1 miss).\nconst HTML_PROPS_LIST = [\n // Core props\n 'className',\n 'class',\n 'dangerouslySetInnerHTML',\n 'htmlFor',\n 'id',\n 'key',\n 'ref',\n 'style',\n 'tabIndex',\n 'role',\n // Event handlers\n 'onAbort',\n 'onAnimationEnd',\n 'onAnimationIteration',\n 'onAnimationStart',\n 'onBlur',\n 'onChange',\n 'onClick',\n 'onCompositionEnd',\n 'onCompositionStart',\n 'onCompositionUpdate',\n 'onContextMenu',\n 'onCopy',\n 'onCut',\n 'onDoubleClick',\n 'onDrag',\n 'onDragEnd',\n 'onDragEnter',\n 'onDragLeave',\n 'onDragOver',\n 'onDragStart',\n 'onDrop',\n 'onError',\n 'onFocus',\n 'onInput',\n 'onKeyDown',\n 'onKeyPress',\n 'onKeyUp',\n 'onLoad',\n 'onMouseDown',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseMove',\n 'onMouseOut',\n 'onMouseOver',\n 'onMouseUp',\n 'onPaste',\n 'onPointerCancel',\n 'onPointerDown',\n 'onPointerEnter',\n 'onPointerLeave',\n 'onPointerMove',\n 'onPointerOut',\n 'onPointerOver',\n 'onPointerUp',\n 'onScroll',\n 'onSelect',\n 'onSubmit',\n 'onTouchCancel',\n 'onTouchEnd',\n 'onTouchMove',\n 'onTouchStart',\n 'onTransitionEnd',\n 'onWheel',\n // HTML attributes\n 'accept',\n 'acceptCharset',\n 'accessKey',\n 'action',\n 'allow',\n 'allowFullScreen',\n 'alt',\n 'as',\n 'async',\n 'autoCapitalize',\n 'autoComplete',\n 'autoCorrect',\n 'autoFocus',\n 'autoPlay',\n 'capture',\n 'cellPadding',\n 'cellSpacing',\n 'charSet',\n 'checked',\n 'cite',\n 'cols',\n 'colSpan',\n 'content',\n 'contentEditable',\n 'controls',\n 'controlsList',\n 'coords',\n 'crossOrigin',\n 'dateTime',\n 'decoding',\n 'default',\n 'defaultChecked',\n 'defaultValue',\n 'defer',\n 'dir',\n 'disabled',\n 'disablePictureInPicture',\n 'disableRemotePlayback',\n 'download',\n 'draggable',\n 'encType',\n 'enterKeyHint',\n 'fetchPriority',\n 'form',\n 'formAction',\n 'formEncType',\n 'formMethod',\n 'formNoValidate',\n 'formTarget',\n 'frameBorder',\n 'headers',\n 'height',\n 'hidden',\n 'high',\n 'href',\n 'hrefLang',\n 'httpEquiv',\n 'inputMode',\n 'integrity',\n 'is',\n 'label',\n 'lang',\n 'list',\n 'loading',\n 'loop',\n 'low',\n 'max',\n 'maxLength',\n 'media',\n 'method',\n 'min',\n 'minLength',\n 'multiple',\n 'muted',\n 'name',\n 'noModule',\n 'noValidate',\n 'nonce',\n 'open',\n 'optimum',\n 'pattern',\n 'placeholder',\n 'playsInline',\n 'poster',\n 'preload',\n 'readOnly',\n 'referrerPolicy',\n 'rel',\n 'required',\n 'reversed',\n 'rows',\n 'rowSpan',\n 'sandbox',\n 'scope',\n 'scoped',\n 'scrolling',\n 'selected',\n 'shape',\n 'size',\n 'sizes',\n 'slot',\n 'span',\n 'spellCheck',\n 'src',\n 'srcDoc',\n 'srcLang',\n 'srcSet',\n 'start',\n 'step',\n 'summary',\n 'target',\n 'title',\n 'translate',\n 'type',\n 'useMap',\n 'value',\n 'width',\n 'wrap',\n] as const\n\n// Build the lookup object once at module load. `null`-prototype keeps the\n// object's hidden class lean and means `in` checks don't accidentally pick\n// up `Object.prototype` keys.\nconst HTML_PROPS: Record<string, true> = Object.create(null)\nfor (const k of HTML_PROPS_LIST) HTML_PROPS[k] = true\n\n/**\n * Filters props for HTML elements. Keeps valid HTML attrs, data-*, aria-*.\n * Rejects unknown props and $-prefixed transient props.\n */\nexport const filterProps = (props: Record<string, unknown>): Record<string, unknown> => {\n const filtered: Record<string, unknown> = {}\n\n for (const key in props) {\n // Skip transient props ($-prefixed) — used for styling-only props\n if (key.charCodeAt(0) === 36) continue // '$'\n\n // Skip `as` prop — handled separately by styled\n if (key === 'as') continue\n\n // Keep data-* and aria-* attributes\n if (key.startsWith('data-') || key.startsWith('aria-')) {\n filtered[key] = props[key]\n continue\n }\n\n // Keep known HTML props — `in` against the null-prototype lookup\n // object beats `Set.has` on the hot DOM-filter path.\n if (key in HTML_PROPS) {\n filtered[key] = props[key]\n }\n }\n\n return filtered\n}\n\n/**\n * Build final props for a styled component in a single pass.\n * Combines className merging, ref injection, and prop filtering into one\n * allocation and one iteration.\n *\n * Copies own property DESCRIPTORS rather than values for forwarded\n * props — getter-shaped reactive props (compiler-emitted `_rp(() =>\n * signal())` converted to getters by `makeReactiveProps`) survive the\n * copy with their reactive subscription intact. A bare `result[key] =\n * rawProps[key]` fires the getter at setup time and stores a static\n * value, breaking signal-driven reactivity for any consumer that reads\n * `props.x` in a reactive scope downstream.\n */\nexport const buildProps = (\n rawProps: Record<string, any>,\n generatedCls: string,\n isDOM: boolean,\n customFilter?: (prop: string) => boolean,\n): Record<string, any> => {\n const result: Record<string, any> = {}\n\n // Merge generated + user className. Reading `rawProps.class` /\n // `.className` synchronously is fine — `class` is consumed at this\n // boundary (merged with the generated class), never forwarded\n // reactively. The string we write is consumed by the DOM at apply\n // time, not stored as a getter.\n const userCls = rawProps.class || rawProps.className\n if (generatedCls) {\n result.class = userCls ? `${generatedCls} ${userCls}` : generatedCls\n } else if (userCls) {\n result.class = userCls\n }\n\n // Helper: copy a prop's OWN descriptor (preserves getters) into result.\n // Falls back to a no-op if the source has no own descriptor for the key.\n const copyDescriptor = (key: string): void => {\n const d = Object.getOwnPropertyDescriptor(rawProps, key)\n if (d) Object.defineProperty(result, key, d)\n }\n\n // Component target — forward all props except as/className/class and $-prefixed\n if (!isDOM) {\n for (const key in rawProps) {\n if (key === 'as' || key === 'className' || key === 'class') continue\n if (key.charCodeAt(0) === 36) continue // $-prefixed transient\n copyDescriptor(key)\n }\n return result\n }\n\n // DOM element with custom shouldForwardProp\n if (customFilter) {\n for (const key in rawProps) {\n if (key === 'as' || key === 'className' || key === 'class') continue\n if (customFilter(key)) copyDescriptor(key)\n }\n return result\n }\n\n // DOM element with default filtering\n for (const key in rawProps) {\n if (key === 'as' || key === 'className' || key === 'class') continue\n if (key.charCodeAt(0) === 36) continue // $-prefixed transient\n if (key.startsWith('data-') || key.startsWith('aria-')) {\n copyDescriptor(key)\n continue\n }\n if (key in HTML_PROPS) copyDescriptor(key)\n }\n return result\n}\n","/**\n * Shared utilities used across multiple modules.\n */\nimport { CSSResult, type Interpolation } from './resolve'\n\n/** Check if an interpolation value is dynamic (contains functions or nested dynamic CSSResults). */\nexport const isDynamic = (v: Interpolation): boolean => {\n if (typeof v === 'function') return true\n if (Array.isArray(v)) return v.some(isDynamic)\n if (v instanceof CSSResult) {\n // Memoize per-instance — CSSResults are created once at module level\n // (one per `css\\`...\\`` literal) and reused across many `styled()` /\n // `useCSS()` / nested-interpolation checks. Avoids rescanning whole\n // sub-trees on every consumer. Ported from vitus-labs `c483cabc`.\n const cached = v._isDynamic\n if (cached !== undefined) return cached\n const r = v.values.some(isDynamic)\n v._isDynamic = r\n return r\n }\n return false\n}\n","/**\n * Fast FNV-1a non-cryptographic hash. Returns base-36 string for compact class names.\n *\n * 32-bit hash space → ~4.3 billion unique values. Collision probability is\n * negligible for typical applications (< 10,000 unique CSS rules).\n */\n\n/** FNV-1a offset basis — starting state for streaming hash. */\nexport const HASH_INIT = 2166136261\n\nconst FNV_PRIME = 16777619\n\n/** Feed a string segment into the running hash state.\n * Streaming: hashUpdate(hashUpdate(HASH_INIT, 'ab'), 'cd') === hash('abcd').\n */\nexport const hashUpdate = (init: number, str: string): number => {\n let h = init\n for (let i = 0; i < str.length; i++) {\n h = Math.imul(h ^ str.charCodeAt(i), FNV_PRIME)\n }\n return h\n}\n\n/** Finalize a hash state into a base-36 class name suffix. */\nexport const hashFinalize = (h: number): string => (h >>> 0).toString(36)\n\n/** Hash a complete string in one shot. Returns base-36 string. */\nexport const hash = (str: string): string => hashFinalize(hashUpdate(HASH_INIT, str))\n","/**\n * StyleSheet manager. Handles CSS rule injection, hash-based deduplication,\n * SSR buffering, client-side hydration, bounded cache, and @layer support.\n *\n * Media queries (@media), @supports, and @container blocks nested inside\n * component CSS are automatically extracted into separate top-level rules.\n */\nimport { hash } from './hash'\nimport { clearNormCache } from './resolve'\n\n// Dev-time counter sink — see styler/resolve.ts for the contract.\nconst _countSink = globalThis as { __pyreon_count__?: (name: string, n?: number) => void }\n\n// Dev-mode gate. `import.meta.env.DEV` is literal-replaced by Vite at build\n// time and tree-shakes to zero bytes in prod. The previous\n// `process.env.NODE_ENV !== 'production'` form was dead code in real Vite\n// browser bundles (Vite does not polyfill `process`), so insertRule failures\n// were silently swallowed in production — masking malformed CSS bugs.\nconst PREFIX = 'pyr'\nconst ATTR = 'data-pyreon-styler'\nconst DEFAULT_MAX_CACHE_SIZE = 10000\n\nexport interface StyleSheetOptions {\n /** Maximum number of cached rules before eviction (default: 10000). */\n maxCacheSize?: number\n /** CSS @layer name to wrap scoped rules in. */\n layer?: string\n}\n\nexport class StyleSheet {\n private cache = new Map<string, string>()\n private insertCache = new Map<string, string>()\n // Reverse index: cache key (className / keyframe name / global key) →\n // the insertCache keys that resolve to it. Lets eviction drop the\n // (large) cssText-keyed insertCache entries in lockstep with `cache`,\n // instead of letting them grow unbounded for the process lifetime.\n private icKeysByClass = new Map<string, Set<string>>()\n // Reverse index: cache key → the top-level CSSRule objects it inserted\n // into the live sheet. Object references survive `deleteRule()`\n // reindexing (only the numeric index shifts), so eviction can locate\n // and remove the exact DOM rules without fragile index bookkeeping.\n private domRules = new Map<string, CSSRule[]>()\n private sheet: CSSStyleSheet | null = null\n private ssrBuffer: string[] = []\n private isSSR: boolean\n private maxCacheSize: number\n private layer: string | undefined\n private supportsLayer = false\n\n constructor(options: StyleSheetOptions = {}) {\n this.maxCacheSize = options.maxCacheSize ?? DEFAULT_MAX_CACHE_SIZE\n this.layer = options.layer\n this.isSSR = typeof document === 'undefined'\n if (!this.isSSR) this.mount()\n }\n\n private mount() {\n // SSR guard: the constructor only calls mount() when !this.isSSR, but\n // keep the guard in-method so it's self-evidently SSR-safe regardless\n // of caller (matches `this.isSSR = typeof document === 'undefined'`).\n if (this.isSSR) return\n // Reuse existing <style> tag from SSR hydration\n const existing = document.querySelector(`style[${ATTR}]`) as HTMLStyleElement | null\n\n if (existing) {\n this.sheet = existing.sheet ?? null\n this.hydrateFromTag(existing)\n } else {\n const el = document.createElement('style')\n el.setAttribute(ATTR, '')\n document.head.appendChild(el)\n this.sheet = el.sheet ?? null\n }\n\n // Inject CSS @layer ordering for the framework's cascade.\n //\n // Two layers: `elements` (base layout primitives) < `rocketstyle`\n // (themed component styles). The explicit ordering declaration\n // ensures rocketstyle theme styles always override element base\n // styles regardless of source order, while media queries within\n // each layer still work correctly (media conditions are evaluated\n // within each layer independently).\n //\n // Previously this used a single `@layer pyreon` which put\n // rocketstyle and elements in the same layer, relying on source\n // order. That broke when Elements were rendered WITHOUT a layer\n // (unlayered CSS always wins over layered CSS per the cascade\n // spec), making rocketstyle themes unable to override element\n // base styles.\n if (this.sheet) {\n try {\n this.sheet.insertRule('@layer elements, rocketstyle;', 0)\n this.supportsLayer = true\n } catch {\n // @layer not supported — falls back to source order\n }\n }\n }\n\n /** Extract className from a selector like \".pyr-abc\" or \".pyr-abc.pyr-abc\" → \"pyr-abc\" */\n private extractClassName(selectorText: string): string | null {\n if (selectorText[0] !== '.') return null\n const dotIdx = selectorText.indexOf('.', 1)\n return dotIdx > 0 ? selectorText.slice(1, dotIdx) : selectorText.slice(1)\n }\n\n /** Parse existing rules from SSR-rendered <style> tag into cache. */\n private hydrateFromTag(el: HTMLStyleElement) {\n const sheet = el.sheet\n if (!sheet) return\n\n for (let i = 0; i < sheet.cssRules.length; i++) {\n const rule = sheet.cssRules[i]\n\n if (rule instanceof CSSStyleRule) {\n const className = this.extractClassName(rule.selectorText)\n if (className) this.cache.set(className, className)\n }\n\n // Handle split @media rules that wrap our selectors\n if (typeof CSSMediaRule !== 'undefined' && rule instanceof CSSMediaRule) {\n for (let j = 0; j < rule.cssRules.length; j++) {\n const inner = rule.cssRules[j]\n if (inner instanceof CSSStyleRule) {\n const className = this.extractClassName(inner.selectorText)\n if (className) this.cache.set(className, className)\n }\n }\n }\n }\n }\n\n /** Record that `icKey` resolves to `cacheKey` (for lockstep eviction). */\n private trackIcKey(cacheKey: string, icKey: string): void {\n let s = this.icKeysByClass.get(cacheKey)\n if (!s) {\n s = new Set()\n this.icKeysByClass.set(cacheKey, s)\n }\n s.add(icKey)\n }\n\n /** Record a top-level CSSRule this `cacheKey` inserted into the sheet. */\n private trackDomRule(cacheKey: string, ref: CSSRule | null | undefined): void {\n if (!ref) return\n let a = this.domRules.get(cacheKey)\n if (!a) {\n a = []\n this.domRules.set(cacheKey, a)\n }\n a.push(ref)\n }\n\n /**\n * Evict the given cache keys across ALL three storage layers:\n * the `cache` Map, the cssText-keyed `insertCache` Map, and the live\n * DOM rules. Without the latter two, `maxCacheSize` bounded only the\n * smallest of the three — `insertCache` keys (full CSS text) and the\n * `<style>` tag's `cssRules` grew unbounded for the app's lifetime,\n * which is the actual memory leak this method exists to prevent.\n */\n private evictKeys(keys: string[]): void {\n const ruleRefs = new Set<CSSRule>()\n for (const key of keys) {\n this.cache.delete(key)\n const ics = this.icKeysByClass.get(key)\n if (ics) {\n for (const ic of ics) this.insertCache.delete(ic)\n this.icKeysByClass.delete(key)\n }\n const refs = this.domRules.get(key)\n if (refs) {\n for (const r of refs) ruleRefs.add(r)\n this.domRules.delete(key)\n }\n }\n if (this.sheet && ruleRefs.size > 0) {\n // Descending walk: deleting at i never shifts a not-yet-visited\n // lower index, so identity matching stays correct mid-loop.\n for (let i = this.sheet.cssRules.length - 1; i >= 0; i--) {\n const r = this.sheet.cssRules[i]\n if (r && ruleRefs.has(r)) {\n try {\n this.sheet.deleteRule(i)\n } catch {\n // Rule already gone (e.g. external clearAll) — ignore.\n }\n }\n }\n }\n }\n\n /** Evict oldest entries when cache exceeds max size. */\n private evictIfNeeded() {\n if (this.cache.size <= this.maxCacheSize) return\n\n // Map iteration order is insertion order — delete oldest 10%\n const toDelete = Math.floor(this.maxCacheSize * 0.1)\n const evicted: string[] = []\n let count = 0\n for (const key of this.cache.keys()) {\n if (count >= toDelete) break\n evicted.push(key)\n count++\n }\n this.evictKeys(evicted)\n }\n\n /**\n * Extract nested at-rules (@media, @supports, @container) from CSS text\n * and wrap their content in the given selector as separate top-level rules.\n */\n private splitAtRules(cssText: string, selector: string): { base: string; atRules: string[] } {\n // Fast path: no at-rules to split\n if (cssText.indexOf('@') === -1) return { base: cssText, atRules: [] }\n\n const atRules: string[] = []\n const baseParts: string[] = []\n const len = cssText.length\n let depth = 0\n let atStart = -1\n let lastBase = 0\n\n // `charCodeAt(i)` returns a primitive int; `cssText[i]` allocates a\n // fresh 1-char string in V8 per iteration. On long stylesheets with\n // at-rule blocks the per-char allocation dominates. Ported from\n // vitus-labs `c483cabc`.\n for (let i = 0; i < len; i++) {\n const ch = cssText.charCodeAt(i)\n\n if (ch === 123 /* { */) {\n depth++\n } else if (ch === 125 /* } */) {\n depth--\n if (depth === 0 && atStart >= 0) {\n // End of a tracked at-rule block — extract and wrap with selector\n const openBrace = cssText.indexOf('{', atStart)\n const atPrefix = cssText.slice(atStart, openBrace).trim()\n const innerCSS = cssText.slice(openBrace + 1, i).trim()\n if (innerCSS) {\n atRules.push(`${atPrefix}{${selector}{${innerCSS}}}`)\n }\n atStart = -1\n lastBase = i + 1\n }\n } else if (depth === 0 && ch === 64 /* @ */ && atStart < 0) {\n // Check if this starts a splittable at-rule (not @keyframes, @font-face, etc.)\n const remaining = cssText.slice(i, i + 20)\n if (/^@(?:media|supports|container)\\b/.test(remaining)) {\n // Save any base CSS that precedes this at-rule\n const baseBefore = cssText.slice(lastBase, i).trim()\n if (baseBefore) baseParts.push(baseBefore)\n atStart = i\n }\n }\n }\n\n // Collect remaining base CSS after the last at-rule\n if (lastBase < cssText.length && atStart < 0) {\n const remaining = cssText.slice(lastBase).trim()\n if (remaining) baseParts.push(remaining)\n }\n\n // If no at-rules were found, return original unchanged\n if (atRules.length === 0) return { base: cssText, atRules: [] }\n\n return { base: baseParts.join(' '), atRules }\n }\n\n /**\n * Compute a className from CSS text without injecting (pure function).\n */\n getClassName(cssText: string): string {\n const cached = this.insertCache.get(cssText)\n if (cached) return cached\n const h = hash(cssText)\n return `${PREFIX}-${h}`\n }\n\n /**\n * Insert CSS rules for a component. Returns the class name (deterministic, hash-based).\n * Deduplicates: same CSS text always produces the same class name and\n * the rules are only injected once.\n *\n * @param cssText - CSS declarations to insert\n * @param _unused - Reserved for backward compatibility (was `boost`)\n * @param insertLayer - CSS @layer to wrap this rule in (e.g. 'rocketstyle').\n * Used by rocketstyle to ensure wrapper styles override inner component styles\n * via @layer order (base < rocketstyle) instead of specificity hacks.\n */\n insert(cssText: string, _unused = false, insertLayer?: string): string {\n if (process.env.NODE_ENV !== 'production')\n _countSink.__pyreon_count__?.('styler.sheet.insert')\n // Fast path: skip hash computation on repeated insertions of same CSS text\n const icKey = insertLayer ? `${cssText}\\0L:${insertLayer}` : cssText\n const icHit = this.insertCache.get(icKey)\n if (icHit) {\n if (process.env.NODE_ENV !== 'production')\n _countSink.__pyreon_count__?.('styler.sheet.insert.hit')\n return icHit\n }\n\n const h = hash(cssText)\n const className = `${PREFIX}-${h}`\n\n if (this.cache.has(className)) {\n this.insertCache.set(icKey, className)\n this.trackIcKey(className, icKey)\n return className\n }\n\n this.evictIfNeeded()\n this.cache.set(className, className)\n\n const selector = `.${className}`\n\n // Split nested at-rules into separate top-level rules\n const { base, atRules } = this.splitAtRules(cssText, selector)\n\n const rules: string[] = []\n if (base) rules.push(`${selector}{${base}}`)\n rules.push(...atRules)\n\n // Apply @layer wrapping — per-insert layer takes precedence over sheet-level layer.\n // In SSR, always apply layers (output goes to real browsers).\n // In client, skip if @layer isn't supported (e.g. happy-dom in tests).\n const layerName = this.isSSR || this.supportsLayer ? (insertLayer ?? this.layer) : undefined\n const finalRules = layerName ? rules.map((r) => `@layer ${layerName}{${r}}`) : rules\n\n if (this.isSSR) {\n for (const rule of finalRules) {\n this.ssrBuffer.push(rule)\n }\n } else if (this.sheet) {\n for (const rule of finalRules) {\n try {\n const at = this.sheet.insertRule(rule, this.sheet.cssRules.length)\n this.trackDomRule(className, this.sheet.cssRules[at])\n } catch (_e) {\n if (process.env.NODE_ENV !== 'production') {\n // oxlint-disable-next-line no-console\n console.warn('[styler] Failed to insert CSS rule:', rule, _e)\n }\n }\n }\n }\n\n this.insertCache.set(icKey, className)\n this.trackIcKey(className, icKey)\n return className\n }\n\n /** Insert a @keyframes rule. Deduplicates by animation name. */\n insertKeyframes(name: string, body: string): void {\n if (this.cache.has(name)) return\n\n this.evictIfNeeded()\n this.cache.set(name, name)\n\n const rule = `@keyframes ${name}{${body}}`\n\n if (this.isSSR) {\n this.ssrBuffer.push(rule)\n } else if (this.sheet) {\n try {\n const at = this.sheet.insertRule(rule, this.sheet.cssRules.length)\n this.trackDomRule(name, this.sheet.cssRules[at])\n } catch (_e) {\n if (process.env.NODE_ENV !== 'production') {\n // oxlint-disable-next-line no-console\n console.warn('[styler] Failed to insert @keyframes rule:', rule, _e)\n }\n }\n }\n }\n\n /**\n * Split CSS text into individual top-level rules.\n * CSSStyleSheet.insertRule() only accepts one rule at a time.\n */\n private splitRules(cssText: string): string[] {\n const rules: string[] = []\n const len = cssText.length\n let depth = 0\n let start = 0\n\n // `charCodeAt(i)` returns a primitive int; `cssText[i]` allocates a\n // fresh 1-char string per iteration. Ported from vitus-labs `c483cabc`.\n for (let i = 0; i < len; i++) {\n const ch = cssText.charCodeAt(i)\n if (ch === 123 /* { */) depth++\n else if (ch === 125 /* } */) {\n depth--\n if (depth === 0) {\n const rule = cssText.slice(start, i + 1).trim()\n if (rule) rules.push(rule)\n start = i + 1\n }\n }\n }\n\n return rules\n }\n\n /** Insert global CSS rules (no wrapper selector). Deduplicates by hash. */\n insertGlobal(cssText: string): void {\n const h = hash(cssText)\n const key = `global-${h}`\n\n if (this.cache.has(key)) return\n\n this.evictIfNeeded()\n this.cache.set(key, key)\n\n if (this.isSSR) {\n this.ssrBuffer.push(cssText)\n } else if (this.sheet) {\n const rules = this.splitRules(cssText)\n for (const rule of rules) {\n try {\n const at = this.sheet.insertRule(rule, this.sheet.cssRules.length)\n this.trackDomRule(key, this.sheet.cssRules[at])\n } catch (_e) {\n if (process.env.NODE_ENV !== 'production') {\n // oxlint-disable-next-line no-console\n console.warn('[styler] Failed to insert global CSS rule:', rule, _e)\n }\n }\n }\n }\n }\n\n /** Returns collected CSS for SSR as a complete `<style>` tag string. */\n getStyleTag(): string {\n if (this.ssrBuffer.length === 0) return `<style ${ATTR}=\"\"></style>`\n // Emit the layer ordering declaration for SSR output so the cascade\n // is correct when the browser parses the SSR HTML. On the client side\n // this ordering is injected via insertRule in mount().\n const layerDecl = this.hasLayeredRules()\n ? '@layer elements, rocketstyle;'\n : this.layer\n ? `@layer ${this.layer};`\n : ''\n const css = (layerDecl + this.ssrBuffer.join('')).replace(/<\\/style/gi, '<\\\\/style')\n return `<style ${ATTR}=\"\">${css}</style>`\n }\n\n /**\n * Returns the collected SSR rules as a raw array (one entry per\n * top-level rule, already `@layer`-wrapped + class-prefixed exactly as\n * `insert()` produced them). Used by the compile-time rocketstyle\n * collapse resolver: it renders a component under SSR, reads the rules\n * here, and the build emits an idempotent `injectRules()` call so the\n * collapsed `_tpl()` site is self-sufficient (no prior runtime mount\n * needed to populate the sheet). A copy — callers must not mutate the\n * internal buffer.\n */\n getStyleRules(): readonly string[] {\n return this.ssrBuffer.slice()\n }\n\n // Idempotency guard for injectRules — keyed by the FNV hash the\n // collapse resolver computes over the rule set. A second injection of\n // the same resolved bundle (e.g. the module re-evaluated under HMR, or\n // two collapsed call sites resolving to the same dimension combo) is a\n // no-op instead of duplicate live `cssRules`.\n private injectedBundles = new Set<string>()\n\n /**\n * Inject pre-resolved CSS rule text (from `getStyleRules()` captured at\n * build time by the rocketstyle-collapse resolver) directly into the\n * live sheet. Unlike `insert()` this does NOT re-hash — the class names\n * are already baked into `rules` and into the collapsed `_tpl()` HTML;\n * re-hashing would produce a different class and break the contract.\n * Idempotent by `key` (the resolver's FNV hash of the bundle).\n */\n injectRules(rules: readonly string[], key: string): void {\n if (this.injectedBundles.has(key)) return\n this.injectedBundles.add(key)\n if (this.isSSR) {\n for (const rule of rules) this.ssrBuffer.push(rule)\n return\n }\n if (!this.sheet) return\n for (const rule of rules) {\n try {\n this.sheet.insertRule(rule, this.sheet.cssRules.length)\n } catch (_e) {\n if (process.env.NODE_ENV !== 'production') {\n // oxlint-disable-next-line no-console\n console.warn('[styler] injectRules: failed to insert collapsed rule:', rule, _e)\n }\n }\n }\n }\n\n /**\n * Test-only: live `cssRules.length` (0 in SSR). Mirrors runtime-dom's\n * `_tplCacheSize()` test-only-accessor convention; lets injectRules /\n * eviction tests assert without reaching into the private sheet.\n */\n ruleCountForTest(): number {\n return this.sheet?.cssRules.length ?? 0\n }\n\n /**\n * Clear the SSR rule-capture buffer ONLY. Leaves `cache`,\n * `insertCache`, `icKeysByClass`, `domRules`, and `injectedBundles`\n * intact.\n *\n * Used by the rocketstyle-collapse build-time resolver to isolate\n * per-site rule captures between concurrent renders against the\n * shared singleton sheet (audit #8). Without resetting the buffer\n * between the resolver's render pairs, the `getStyleRules()` slice\n * for site N captures `[...site1Rules, ...site2Rules, ..., siteNRules]`\n * — every FNV key becomes unique per call order, and the cross-site\n * `injectedBundles` runtime dedup at consumer sites silently breaks\n * even when the underlying rule bundles are identical.\n *\n * Important context — the resolver MUST also pair this with per-test\n * resolver isolation OR truly-distinct dimension props per render to\n * actually produce non-empty `getStyleRules()` slices: `insert()`\n * short-circuits at `cache.has(className)` / `insertCache.get(icKey)`\n * when a className has been seen, AND cache layers above the styler\n * (styled.tsx `classCache` / `elClassCache` keyed on rocketstyle's\n * `$rocketstyle`/`$rocketstate` identity, and rocketstyle's `_rsMemo`)\n * survive between resolves within a single nested-Vite-SSR lifetime.\n * A second resolve sharing dimension props with a prior one will hit\n * the styled-component cache, skip `sheet.insert()` entirely, and\n * leave the just-reset buffer empty for that className. The fix is\n * resolver-level isolation (fresh nested Vite SSR per build) plus\n * this buffer-reset to keep concurrent captures from interleaving.\n *\n * Internal-use only — NEVER call this from a request-handling path\n * (the per-request `reset()` is the correct shape there, since the\n * request lifecycle is bounded and the styler caches should be\n * dropped wholesale).\n */\n resetSSRBuffer(): void {\n this.ssrBuffer = []\n }\n\n /** Returns collected CSS rules as a raw string (useful for streaming SSR). */\n getStyles(): string {\n if (this.ssrBuffer.length === 0) return ''\n const layerDecl = this.hasLayeredRules()\n ? '@layer elements, rocketstyle;'\n : this.layer\n ? `@layer ${this.layer};`\n : ''\n return layerDecl + this.ssrBuffer.join('')\n }\n\n /** Check if any buffered SSR rules use @layer wrapping. */\n private hasLayeredRules(): boolean {\n return this.ssrBuffer.some((r) => r.startsWith('@layer '))\n }\n\n /** Reset SSR buffer and cache (call between server requests). */\n reset(): void {\n this.ssrBuffer = []\n this.cache.clear()\n this.insertCache.clear()\n this.icKeysByClass.clear()\n this.domRules.clear()\n }\n\n /** Clear the dedup cache. Useful for HMR / dev-time reloads. */\n clearCache(): void {\n this.cache.clear()\n this.insertCache.clear()\n this.icKeysByClass.clear()\n this.domRules.clear()\n clearNormCache()\n }\n\n /**\n * Full cleanup: clear cache and remove all CSS rules from the DOM.\n * Intended for HMR / dev-time reloads where stale styles must be purged.\n *\n * Also fires `onSheetClear` subscribers so downstream caches (e.g.\n * `styled.tsx`'s static-component cache) reset alongside the sheet.\n * Without this, stale `StaticStyled` ComponentFn references survive HMR\n * and continue to apply CSS class names that were just deleted from\n * the DOM — observable as missing styles after every hot reload.\n */\n clearAll(): void {\n this.cache.clear()\n this.insertCache.clear()\n this.icKeysByClass.clear()\n this.domRules.clear()\n clearNormCache()\n this.ssrBuffer = []\n if (this.sheet) {\n while (this.sheet.cssRules.length > 0) {\n this.sheet.deleteRule(0)\n }\n }\n fireSheetClearSubscribers()\n }\n\n /**\n * Compute className and full CSS rule text without injecting.\n */\n prepare(cssText: string): { className: string; rules: string } {\n const h = hash(cssText)\n const className = `${PREFIX}-${h}`\n const selector = `.${className}`\n const { base, atRules } = this.splitAtRules(cssText, selector)\n\n const allRules: string[] = []\n if (base) allRules.push(`${selector}{${base}}`)\n allRules.push(...atRules)\n\n const finalRules = this.layer ? allRules.map((r) => `@layer ${this.layer}{${r}}`) : allRules\n\n return { className, rules: finalRules.join('') }\n }\n\n /** Check if a className is already in the cache. O(1) Map lookup. */\n has(className: string): boolean {\n return this.cache.has(className)\n }\n\n /** Current number of cached rules. */\n get cacheSize(): number {\n return this.cache.size\n }\n}\n\n/** Default singleton sheet for client-side use.\n * No default layer — each consumer specifies their own:\n * Elements use `{ layer: 'elements' }`\n * Rocketstyle uses `{ layer: 'rocketstyle' }`\n * The layer ordering `@layer elements, rocketstyle` is injected\n * in mount() so rocketstyle always overrides elements.\n */\nexport const sheet = new StyleSheet()\n\n/**\n * Factory for creating isolated StyleSheet instances.\n * Use in SSR to get per-request isolation.\n */\nexport const createSheet = (options?: StyleSheetOptions): StyleSheet => new StyleSheet(options)\n\n// ─── onSheetClear subscriber registry ─────────────────────────────────────\n//\n// Used by `styled.tsx` to reset its static-component cache when the\n// singleton sheet is cleared via `clearAll()`. Module-level Set so the\n// subscription survives between calls; ports the vitus-labs pattern from\n// `connector-styler/sheet.ts:onClear`. Scoped to the singleton sheet —\n// per-instance sheets created via `createSheet()` don't fire the hook.\nconst _sheetClearSubscribers = new Set<() => void>()\n\nconst fireSheetClearSubscribers = (): void => {\n for (const cb of _sheetClearSubscribers) cb()\n}\n\n/**\n * Subscribe to `sheet.clearAll()`. Fires after the sheet has been\n * fully cleared, so subscribers can drop downstream caches that depend\n * on the sheet's class names being live in the DOM.\n *\n * Returns a disposer for symmetry; in practice subscribers register\n * once at module load and never unsubscribe.\n */\nexport const onSheetClear = (callback: () => void): (() => void) => {\n _sheetClearSubscribers.add(callback)\n return () => _sheetClearSubscribers.delete(callback)\n}\n","/**\n * Theme context for styled components.\n *\n * Extensible theme interface. Consumers can augment this via module\n * declaration merging for full strict types:\n *\n * declare module '@pyreon/styler' {\n * interface DefaultTheme {\n * colors: { primary: string; secondary: string }\n * spacing: (n: number) => string\n * }\n * }\n */\nimport type { VNode, VNodeChild } from '@pyreon/core'\nimport { createReactiveContext, nativeCompat, provide, useContext } from '@pyreon/core'\n\nexport interface DefaultTheme {}\n\ntype Theme = DefaultTheme & Record<string, unknown>\n\n/**\n * Reactive theme context. Consumers get `() => Theme` from useContext.\n *\n * Styled components read the theme accessor inside a COMPUTED (not an\n * effect). The computed tracks theme + mode +\n * dimensions simultaneously, and the resolve itself runs untracked.\n * This gives reactive theme/mode/dimension switching with:\n * - Zero per-component effect()\n * - One lightweight computed per component\n * - String-equality memoization (same CSS class = no DOM update)\n * - Untracked resolve (no exponential cascade)\n */\nexport const ThemeContext = createReactiveContext<Theme>({} as Theme)\n\n/**\n * Read the current theme. Returns the theme value (calls the accessor).\n * Inside a reactive scope (computed/effect), this tracks theme changes.\n */\nexport const useTheme = <T extends object = Theme>(): T => useContext(ThemeContext)() as T\n\n/**\n * Returns the raw `() => Theme` accessor for use inside computeds\n * where you need explicit control over when the read happens.\n */\nexport const useThemeAccessor = <T extends object = Theme>(): (() => T) =>\n useContext(ThemeContext) as () => T\n\n/**\n * @internal Low-level provider — use `PyreonUI` from `@pyreon/ui-core` instead.\n * @deprecated Prefer `<PyreonUI theme={theme}>`\n */\nexport function ThemeProvider({\n theme,\n children,\n}: {\n theme: Theme\n children?: VNodeChild\n}): VNode | null {\n provide(ThemeContext, () => theme)\n return (children ?? null) as VNode | null\n}\n\n// Mark as native — compat-mode jsx() runtimes skip wrapCompatComponent so\n// provide(ThemeContext, ...) reaches Pyreon's setup frame.\nnativeCompat(ThemeProvider)\n","/**\n * createGlobalStyle() — tagged template function that injects global CSS\n * rules (not scoped to a class name). Returns a component function that\n * injects styles when called and supports dynamic interpolations via\n * props/theme.\n *\n * Usage:\n * const GlobalStyle = createGlobalStyle`\n * body { margin: 0; font-family: ${({ theme }) => theme.font}; }\n * *, *::before, *::after { box-sizing: border-box; }\n * `\n */\nimport type { ComponentFn } from '@pyreon/core'\nimport { type Interpolation, normalizeCSS, resolve } from './resolve'\nimport { isDynamic } from './shared'\nimport { sheet } from './sheet'\nimport { useTheme } from './ThemeProvider'\n\nexport const createGlobalStyle = (\n strings: TemplateStringsArray,\n ...values: Interpolation[]\n): ComponentFn => {\n const hasDynamicValues = values.some(isDynamic)\n\n // STATIC FAST PATH: compute once at creation time\n if (!hasDynamicValues) {\n const cssText = normalizeCSS(resolve(strings, values, {}))\n\n // Inject into sheet immediately. `normalizeCSS` already strips\n // leading/trailing whitespace, so a length check is equivalent to the\n // prior `.trim()` (no O(n) whitespace scan, no string allocation).\n // Ported from vitus-labs `be471b19`.\n if (cssText.length > 0) sheet.insertGlobal(cssText)\n\n const StaticGlobal: ComponentFn = () => null\n return StaticGlobal\n }\n\n // DYNAMIC PATH: resolve on every render with theme/props\n const DynamicGlobal: ComponentFn = (props: Record<string, any>) => {\n const theme = useTheme()\n const allProps = { ...props, theme }\n const cssText = normalizeCSS(resolve(strings, values, allProps))\n\n // Length check — `normalizeCSS` already trims. Ported from\n // vitus-labs `be471b19`.\n if (cssText.length > 0) sheet.insertGlobal(cssText)\n\n return null\n }\n\n return DynamicGlobal\n}\n","/**\n * keyframes() tagged template function. Creates a CSS @keyframes rule,\n * injects it into the stylesheet, and returns the generated animation name.\n *\n * Usage:\n * const fadeIn = keyframes`\n * from { opacity: 0; }\n * to { opacity: 1; }\n * `\n * // fadeIn === \"pyr-kf-abc123\" (deterministic, hash-based)\n */\nimport { hash } from './hash'\nimport { type Interpolation, normalizeCSS, resolve } from './resolve'\nimport { sheet } from './sheet'\n\nclass KeyframesResult {\n readonly name: string\n\n constructor(strings: TemplateStringsArray, values: Interpolation[]) {\n const body = normalizeCSS(resolve(strings, values, {}))\n const h = hash(body)\n this.name = `pyr-kf-${h}`\n\n sheet.insertKeyframes(this.name, body)\n }\n\n /** Returns the animation name when used in string context. */\n toString(): string {\n return this.name\n }\n}\n\nexport const keyframes = (\n strings: TemplateStringsArray,\n ...values: Interpolation[]\n): KeyframesResult => new KeyframesResult(strings, values)\n","/**\n * styled() component factory. Creates Pyreon components that inject CSS\n * class names from tagged template literals.\n *\n * Supports:\n * - styled('div')`...` and styled(Component)`...`\n * - styled.div`...` (via Proxy)\n * - `as` prop for polymorphic rendering\n * - $-prefixed transient props (not forwarded to DOM)\n * - Custom shouldForwardProp for per-component prop filtering\n * - Static path optimization (templates with no dynamic interpolations)\n * - Boost specificity via doubled selector\n *\n * CSS nesting (`&` selectors) works natively — the resolver passes CSS\n * through without transformation, so `&:hover`, `&::before`, etc. work\n * as-is in browsers supporting CSS Nesting (all modern browsers).\n */\nimport type { ComponentFn, Ref, VNode } from '@pyreon/core'\nimport { h } from '@pyreon/core'\nimport { computed, renderEffect, runUntracked } from '@pyreon/reactivity'\nimport { buildProps } from './forward'\nimport { type Interpolation, normalizeCSS, resolve } from './resolve'\nimport { isDynamic } from './shared'\nimport { onSheetClear, sheet } from './sheet'\nimport { useThemeAccessor } from './ThemeProvider'\n\n// Dev-time counter sink — see packages/internals/perf-harness/COUNTERS.md.\nconst _countSink = globalThis as { __pyreon_count__?: (name: string, n?: number) => void }\n\ntype Tag = string | ComponentFn<any>\n\nexport interface StyledOptions {\n /** Custom prop filter. Return true to forward the prop to the DOM element. */\n shouldForwardProp?: (prop: string) => boolean\n /**\n * CSS @layer name. Rules are wrapped in `@layer <name> { ... }`.\n * Framework CSS uses two layers with explicit ordering:\n * `@layer elements, rocketstyle;`\n * Elements (base layout) use `'elements'`, rocketstyle themes use\n * `'rocketstyle'`. The ordering ensures themes always override base\n * styles regardless of source order.\n */\n layer?: string\n}\n\nconst getDisplayName = (tag: Tag): string =>\n typeof tag === 'string'\n ? tag\n : (tag as ComponentFn<any> & { displayName?: string }).displayName || tag.name || 'Component'\n\n// Component cache: same template literal + tag + no options → same component.\n// WeakMap on `strings` (TemplateStringsArray is object-identity per source location).\n// `let` so `sheet.clearAll()` (HMR / dev reload) can drop stale entries by\n// swapping the WeakMap reference — WeakMap has no `.clear()` method, and stale\n// `StaticStyled` ComponentFns left behind would keep returning class names the\n// sheet just deleted from the DOM.\nlet staticComponentCache = new WeakMap<TemplateStringsArray, Map<Tag, ComponentFn>>()\n\n// Single-entry hot cache — 3 reference comparisons, no Map/WeakMap overhead.\n// All 3 fields move atomically (consolidated into one object so `clearAll`\n// resets them together — pre-fix, partial state was possible if a reset\n// path forgot one field).\nconst _hotCache: {\n strings: TemplateStringsArray | null\n tag: Tag | null\n component: ComponentFn | null\n} = { strings: null, tag: null, component: null }\n\n// Subscribe to `sheet.clearAll()` (HMR / dev-time reset). Drops both the\n// WeakMap and the hot-cache slots so subsequent `styled()` calls produce\n// fresh components with up-to-date class names. Static class names emitted\n// before `clearAll` are stale by the time the user observes them — the rule\n// they pointed at has been deleted from the DOM.\nonSheetClear(() => {\n staticComponentCache = new WeakMap()\n _hotCache.strings = null\n _hotCache.tag = null\n _hotCache.component = null\n})\n\nconst createStyledComponent = (\n tag: Tag,\n strings: TemplateStringsArray,\n values: Interpolation[],\n options?: StyledOptions,\n): ComponentFn => {\n // Ultra-fast hot cache: 3 reference comparisons → return immediately\n if (values.length === 0 && !options) {\n if (strings === _hotCache.strings && tag === _hotCache.tag)\n return _hotCache.component as ComponentFn\n\n // WeakMap fallback for alternating patterns\n const tagMap = staticComponentCache.get(strings)\n if (tagMap) {\n const cached = tagMap.get(tag)\n if (cached) {\n _hotCache.strings = strings\n _hotCache.tag = tag\n _hotCache.component = cached\n return cached\n }\n }\n }\n\n // Fast check: no values means no dynamic interpolations — avoids .some() scan\n const hasDynamicValues = values.length > 0 && values.some(isDynamic)\n const customFilter = options ? options.shouldForwardProp : undefined\n const insertLayer = options?.layer\n\n // STATIC FAST PATH: no function interpolations → compute class once at creation time\n if (!hasDynamicValues) {\n // Inline resolve for the common no-values case\n const raw = values.length === 0 ? (strings[0] as string) : resolve(strings, values, {})\n const cssText = normalizeCSS(raw)\n const hasCss = cssText.length > 0\n\n const staticClassName = hasCss ? sheet.insert(cssText, false, insertLayer) : ''\n\n // Hoisted out of the render fn: `tag` is known at component-creation time,\n // and `tag` matches `rawProps.as ?? tag` whenever rawProps is empty (the\n // common case for `<MyStyled />` without any props). The DOM-ness check\n // doesn't change between renders for the same `tag`.\n const tagIsDOM = typeof tag === 'string'\n\n // Pre-built VNode for the no-extra-props hot path (`<MyStyled />`). Same\n // shape `h(tag, { class })` would produce per render, but allocated once\n // at component-creation time. Mount.ts spreads `vnode.props` into a new\n // object before invoking the component (mount.ts:404-418 doesn't mutate\n // the source vnode), so sharing the same VNode across mount sites is\n // safe. `vnode.children` is empty here because the empty-rawProps branch\n // also implies no children were passed — `rawProps.children` would be\n // `undefined` and the `Array.isArray ? : ?? : []` chain produces `[]`.\n //\n // **Cache lifetime**: this VNode references `staticClassName`, which is\n // the className the sheet just inserted. If `sheet.clearAll()` runs\n // (HMR / dev reload), the className becomes stale BUT the outer\n // `staticComponentCache` (and `_hot*` caches) ALSO survive that path —\n // so consumers continue to receive the stale className regardless. The\n // companion fix to wire `onSheetClear` and reset both caches is tracked\n // separately. This optimization is correct under the existing cache\n // lifetime contract; the HMR-staleness issue is broader than the VNode\n // cache.\n const cachedEmptyVNode = h(\n tag as string,\n staticClassName ? { class: staticClassName } : {},\n )\n\n const StaticStyled: ComponentFn = (rawProps: Record<string, any>): VNode | null => {\n // Hot path: no extra props beyond what's empty AND no `ref` / `as`.\n // `for ... in` over an empty object is O(0); the `break` exits on the\n // first key. Skipping the cache when `ref` is present is necessary\n // because the user expects their callback to fire on the mounted DOM\n // node — the pre-built VNode has no `ref` in its props.\n let hasExtraProps = false\n for (const _k in rawProps) {\n hasExtraProps = true\n break\n }\n if (!hasExtraProps && rawProps.ref == null) {\n if (process.env.NODE_ENV !== 'production')\n _countSink.__pyreon_count__?.('styler.staticVNode.hit')\n return cachedEmptyVNode\n }\n\n const finalTag = rawProps.as || tag\n // Fast `isDOM` when the user didn't pass `as` — reuses the closure-time\n // check. Only `typeof` is needed when `as` overrides the tag.\n const isDOM = finalTag === tag ? tagIsDOM : typeof finalTag === 'string'\n const finalProps = buildProps(rawProps, staticClassName, isDOM, customFilter)\n\n return h(\n finalTag as string,\n finalProps,\n ...(Array.isArray(rawProps.children)\n ? rawProps.children\n : rawProps.children != null\n ? [rawProps.children]\n : []),\n )\n }\n\n ;(StaticStyled as ComponentFn & { displayName?: string }).displayName =\n `styled(${getDisplayName(tag)})`\n\n // Store in component cache + hot cache for future reuse\n if (!options && values.length === 0) {\n let tagMap = staticComponentCache.get(strings)\n if (!tagMap) {\n tagMap = new Map()\n staticComponentCache.set(strings, tagMap)\n }\n tagMap.set(tag, StaticStyled)\n _hotCache.strings = strings\n _hotCache.tag = tag\n _hotCache.component = StaticStyled\n }\n\n return StaticStyled\n }\n\n // ─── Tier 2: Per-definition class cache ───────────────────────────────────\n // Two-level WeakMap: $rocketstyle → $rocketstate → className.\n // 50 identical Items with the same resolved theme → 1 resolve + 49 hits.\n const classCache = new WeakMap<object, WeakMap<object, string>>()\n // Single-key cache for non-rocketstyle styled components (e.g. Element's\n // Wrapper, which depends on `$element` + `$childFix`). The key is the\n // `$element` object identity; `$childFix` is folded into a `Map<bool,\n // string>` per `$element` to avoid wrong-cache hits when childFix differs.\n // Element-layer interning (see `@pyreon/elements` Element/component.tsx)\n // gives `$element` stable identity across mounts, which is what makes this\n // cache fire — analogous to rocketstyle's dimension-prop memo.\n const elClassCache = new WeakMap<object, Map<unknown, string>>()\n\n // DYNAMIC PATH: uses computed() for reactive class derivation.\n //\n // Architecture:\n // - $rocketstyle/$rocketstate may be function ACCESSORS (from rocketstyle)\n // or plain objects (from direct styled() usage).\n // - When they're accessors, a computed() tracks them so mode/dimension\n // signal changes produce a new CSS class reactively.\n // - The resolve() itself runs UNTRACKED inside the computed to prevent\n // exponential cascade from theme deep-reads in interpolation functions.\n // - The computed memoizes by string equality — same CSS class = no DOM update.\n // - Pyreon's built-in renderEffect handles the DOM class attribute update\n // when the computed value changes.\n //\n // This gives reactive mode/dimension switching WITHOUT per-component effect().\n const DynamicStyled: ComponentFn = (rawProps: Record<string, any>): VNode | null => {\n const themeAccessor = useThemeAccessor()\n const theme = themeAccessor() // snapshot for initial + static path\n const $rs = rawProps.$rocketstyle\n const $rsState = rawProps.$rocketstate\n const isReactiveRS = typeof $rs === 'function'\n const isReactiveState = typeof $rsState === 'function'\n\n // Helper: resolve CSS + cache result.\n // `rs` and `rsState` are opaque from styler's perspective (the styler can't\n // import rocketstyle types — that would be a circular dep). The body\n // narrows them via `typeof === 'object'` guards before using as WeakMap\n // keys. `t` is the resolved theme object — opaque shape from styler's\n // perspective (consumers augment `DefaultTheme` via declaration merging).\n const doResolve = (rs: unknown, rsState: unknown, t: unknown): string => {\n // Tier 2 cache: skip resolve if same object identity seen before\n if (rs && typeof rs === 'object' && rsState && typeof rsState === 'object') {\n const inner = classCache.get(rs)\n if (inner) {\n const cached = inner.get(rsState)\n if (cached !== undefined) return cached\n }\n }\n\n // Element-layer cache (no rocketstyle props, but $element is present\n // and an object). Fires only when the rocketstyle path didn't apply\n // — they're mutually exclusive in practice.\n const $el = rawProps.$element\n const $childFix = rawProps.$childFix\n const useElCache =\n (!rs || typeof rs !== 'object' || !rsState || typeof rsState !== 'object') &&\n $el &&\n typeof $el === 'object'\n if (useElCache) {\n const inner = elClassCache.get($el as object)\n if (inner) {\n const cached = inner.get($childFix)\n if (cached !== undefined) {\n if (process.env.NODE_ENV !== 'production')\n _countSink.__pyreon_count__?.('styler.elClassCache.hit')\n return cached\n }\n }\n }\n\n const resolveProps = {\n ...rawProps,\n ...(isReactiveRS ? { $rocketstyle: rs } : {}),\n ...(isReactiveState ? { $rocketstate: rsState } : {}),\n theme: t,\n }\n const cssText = normalizeCSS(resolve(strings, values, resolveProps))\n const className = cssText.length > 0 ? sheet.insert(cssText, false, insertLayer) : ''\n\n if (rs && typeof rs === 'object' && rsState && typeof rsState === 'object') {\n let inner = classCache.get(rs)\n if (!inner) {\n inner = new WeakMap()\n classCache.set(rs, inner)\n }\n inner.set(rsState, className)\n } else if (useElCache) {\n let inner = elClassCache.get($el as object)\n if (!inner) {\n inner = new Map()\n elClassCache.set($el as object, inner)\n }\n inner.set($childFix, className)\n }\n return className\n }\n\n // If any axis is reactive, wrap in computed that tracks all three:\n // 1. $rocketstyle accessor (mode + dimension signals)\n // 2. $rocketstate accessor (state descriptor)\n // 3. themeAccessor (user-preference theme swap)\n // The resolve itself runs UNTRACKED to prevent exponential cascade.\n const hasReactive = isReactiveRS || isReactiveState\n const cssClass = hasReactive\n ? computed(() => {\n // TRACKED reads:\n const rs = isReactiveRS ? $rs() : $rs\n const rsState = isReactiveState ? $rsState() : $rsState\n const t = themeAccessor() // TRACKED — theme swap\n\n // UNTRACKED: resolve + sheet insert\n return runUntracked(() => doResolve(rs, rsState, t))\n }, { equals: (a, b) => a === b })\n : null\n\n const finalTag = rawProps.as || tag\n const isDOM = typeof finalTag === 'string'\n\n // Initial class: computed (reactive) or direct resolve (static)\n const className = cssClass\n ? cssClass()\n : doResolve($rs, $rsState, theme)\n const finalProps = buildProps(rawProps, className, isDOM, customFilter)\n\n // Reactive path: lightweight renderEffect that reads the pre-computed\n // class string and toggles classList. The expensive resolve() already\n // happened inside the computed — this renderEffect only does: read\n // string → compare → toggle.\n if (cssClass) {\n let el: Element | null = null\n let currentClassName = className\n\n const originalRef = finalProps.ref\n finalProps.ref = (node: Element | null) => {\n el = node\n if (originalRef) {\n if (typeof originalRef === 'function') originalRef(node)\n else if (typeof originalRef === 'object') (originalRef as Ref<Element>).current = node\n }\n }\n\n renderEffect(() => {\n const newClass = cssClass() // reads computed — O(1), just string\n if (el && newClass !== currentClassName) {\n if (currentClassName) el.classList.remove(currentClassName)\n if (newClass) el.classList.add(newClass)\n currentClassName = newClass\n }\n })\n }\n\n return h(\n finalTag as string,\n finalProps,\n ...(Array.isArray(rawProps.children)\n ? rawProps.children\n : rawProps.children != null\n ? [rawProps.children]\n : []),\n )\n }\n\n ;(DynamicStyled as ComponentFn & { displayName?: string }).displayName =\n `styled(${getDisplayName(tag)})`\n return DynamicStyled\n}\n\n/** Factory function: styled(tag) returns a tagged template function. */\nconst styledFactory = (tag: Tag, options?: StyledOptions) => {\n const templateFn = (strings: TemplateStringsArray, ...values: Interpolation[]) =>\n createStyledComponent(tag, strings, values, options)\n\n return templateFn\n}\n\n/**\n * Main styled export. Supports both calling conventions:\n * - `styled('div')` or `styled(Component)` → returns tagged template function\n * - `styled('div', { shouldForwardProp })` → with custom prop filtering\n * - `styled.div` → shorthand via Proxy (no options)\n */\n// Cache template functions per tag to avoid closure allocation on every Proxy get\nconst proxyCache = new Map<string, TagTemplateFn>()\n\n/**\n * Generic tagged template function returned by `styled(tag)` and `styled.tag`.\n *\n * Accepts an optional type parameter `<P>` for consumer-defined props\n * (typically transient $-prefixed props that aren't forwarded to the DOM).\n *\n * @example\n * const Box = styled('div')<{ $color: string }>`\n * background: ${(props) => props.$color};\n * `\n * <Box $color=\"red\" /> // $color is required and typed\n */\ntype TagTemplateFn = <P extends object = Record<string, unknown>>(\n strings: TemplateStringsArray,\n ...values: Interpolation<P>[]\n) => ComponentFn<P & Record<string, unknown>>\n\ntype HtmlTags =\n | 'a'\n | 'abbr'\n | 'address'\n | 'article'\n | 'aside'\n | 'audio'\n | 'b'\n | 'blockquote'\n | 'body'\n | 'br'\n | 'button'\n | 'canvas'\n | 'caption'\n | 'code'\n | 'col'\n | 'colgroup'\n | 'dd'\n | 'details'\n | 'div'\n | 'dl'\n | 'dt'\n | 'em'\n | 'fieldset'\n | 'figcaption'\n | 'figure'\n | 'footer'\n | 'form'\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'\n | 'head'\n | 'header'\n | 'hr'\n | 'html'\n | 'i'\n | 'iframe'\n | 'img'\n | 'input'\n | 'label'\n | 'legend'\n | 'li'\n | 'link'\n | 'main'\n | 'mark'\n | 'menu'\n | 'meta'\n | 'nav'\n | 'ol'\n | 'optgroup'\n | 'option'\n | 'output'\n | 'p'\n | 'picture'\n | 'pre'\n | 'progress'\n | 'q'\n | 'section'\n | 'select'\n | 'small'\n | 'source'\n | 'span'\n | 'strong'\n | 'style'\n | 'sub'\n | 'summary'\n | 'sup'\n | 'svg'\n | 'table'\n | 'tbody'\n | 'td'\n | 'template'\n | 'textarea'\n | 'tfoot'\n | 'th'\n | 'thead'\n | 'time'\n | 'tr'\n | 'u'\n | 'ul'\n | 'video'\n\nexport type StyledFunction = ((tag: Tag, options?: StyledOptions) => TagTemplateFn) & {\n [K in HtmlTags]: TagTemplateFn\n}\n\n// Proxy is needed to support styled.div`...` syntax; the cast bridges\n// styledFactory's call signature to StyledFunction which adds HTML tag properties.\n// Proxy target uses `as any` because TS can't resolve Proxy<StyledFunction> with mapped types\nexport const styled: StyledFunction = new Proxy(styledFactory as any, {\n get(_target: unknown, prop: string) {\n if (prop === 'prototype' || prop === '$$typeof') return undefined\n // styled.div`...`, styled.span`...`, etc.\n let fn = proxyCache.get(prop)\n if (!fn) {\n // The arrow's `Interpolation[]` arg shape can't be expressed as the\n // generic `<P>(strings, ...values: Interpolation<P>[])` of TagTemplateFn\n // (no generic arrow inside a Proxy handler), but the call signature is\n // structurally compatible — the inner `createStyledComponent` accepts\n // any-P interpolations. Cast bridges the variance at the assignment.\n fn = ((strings: TemplateStringsArray, ...values: Interpolation[]) =>\n createStyledComponent(prop, strings, values)) as TagTemplateFn\n proxyCache.set(prop, fn)\n }\n return fn\n },\n})\n","/**\n * Hook that resolves a CSSResult template with props, injects CSS\n * into the shared stylesheet, and returns the className.\n *\n * Use this when you need computed CSS class names on plain elements\n * without the overhead of a styled component layer.\n */\nimport { type CSSResult, normalizeCSS, resolve } from './resolve'\nimport { sheet } from './sheet'\nimport { useTheme } from './ThemeProvider'\n\nexport function useCSS(template: CSSResult, props?: Record<string, any>, boost?: boolean): string {\n const theme = useTheme()\n const allProps = theme ? { ...props, theme } : (props ?? {})\n const cssText = normalizeCSS(resolve(template.strings, template.values, allProps))\n\n if (!cssText.trim()) return ''\n\n return sheet.insert(cssText, boost)\n}\n","import { registerSingleton } from '@pyreon/reactivity'\n\n// Singleton sentinel — fail-loud detection of duplicate @pyreon/styler\n// instances in the same heap. See @pyreon/reactivity/singleton-sentinel for\n// full rationale. Hardcoded version is acceptable here — it's a diagnostic\n// aid, not a load-bearing identity check.\nregisterSingleton('@pyreon/styler', '0.24.6', import.meta.url)\n\nexport { css } from './css'\nexport { buildProps, filterProps } from './forward'\nexport { createGlobalStyle } from './globalStyle'\nexport { HASH_INIT, hash, hashFinalize, hashUpdate } from './hash'\nexport { keyframes } from './keyframes'\nexport type { CSSResult, Interpolation } from './resolve'\nexport { clearNormCache, normalizeCSS, resolve, resolveValue } from './resolve'\nexport { isDynamic } from './shared'\nexport type { StyleSheetOptions } from './sheet'\nexport { createSheet, StyleSheet, sheet } from './sheet'\nexport type { StyledFunction, StyledOptions } from './styled'\nexport { styled } from './styled'\nexport type { DefaultTheme } from './ThemeProvider'\nexport { ThemeContext, ThemeProvider, useTheme, useThemeAccessor } from './ThemeProvider'\nexport { useCSS } from './useCSS'\n"],"mappings":";;;;AAWA,MAAMA,eAAa;;;;;;AA8BnB,IAAa,YAAb,MAAuB;CAyBV;CACA;;;;;;;;;CAjBX,aAAkC;;;;;;;;;;;;CAalC,kBAAsC;CAEtC,YACE,AAAS,SACT,AAAS,QACT;EAFS;EACA;CACR;;CAGH,WAAmB;EACjB,OAAO,QAAQ,KAAK,SAAS,KAAK,QAAQ,CAAC,CAAC;CAC9C;AACF;;AAGA,MAAa,WACX,SACA,QACA,UACW;CACX,IAAI,QAAQ,IAAI,aAAa,cAAc,aAAW,mBAAmB,gBAAgB;CAGzF,IAAI,SAAS,QAAQ;CACrB,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;EACtC,MAAM,IAAI,OAAO;EACjB,MAAM,IAAI,QAAQ,IAAI;EAEtB,IAAI,OAAO,MAAM,YAAY;GAC3B,MAAM,IAAI,EAAE,KAAK;GACjB,WACG,OAAO,MAAM,WACV,IAC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AEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAKA,MAAM,aAAmC,OAAO,OAAO,IAAI;AAC3D,KAAK,MAAM,KAAK,iBAAiB,WAAW,KAAK;;;;;AAMjD,MAAa,eAAe,UAA4D;CACtF,MAAM,WAAoC,CAAC;CAE3C,KAAK,MAAM,OAAO,OAAO;EAEvB,IAAI,IAAI,WAAW,CAAC,MAAM,IAAI;EAG9B,IAAI,QAAQ,MAAM;EAGlB,IAAI,IAAI,WAAW,OAAO,KAAK,IAAI,WAAW,OAAO,GAAG;GACtD,SAAS,OAAO,MAAM;GACtB;EACF;EAIA,IAAI,OAAO,YACT,SAAS,OAAO,MAAM;CAE1B;CAEA,OAAO;AACT;;;;;;;;;;;;;;AAeA,MAAa,cACX,UACA,cACA,OACA,iBACwB;CACxB,MAAM,SAA8B,CAAC;CAOrC,MAAM,UAAU,SAAS,SAAS,SAAS;CAC3C,IAAI,cACF,OAAO,QAAQ,UAAU,GAAG,aAAa,GAAG,YAAY;MACnD,IAAI,SACT,OAAO,QAAQ;CAKjB,MAAM,kBAAkB,QAAsB;EAC5C,MAAM,IAAI,O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AU,aAAa,QAAQ,SAAS,SAAS,SAAS,QAAQ,QAAQ,CAAC;CAEjF,IAAI,CAAC,QAAQ,KAAK,GAAG,OAAO;CAE5B,OAAO,MAAM,OAAO,SAAS,KAAK;AACpC;;;;ACbA,kBAAkB,kBAAkB,UAAU,OAAO,KAAK,GAAG"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_countSink","_countSink"],"sources":["../src/resolve.ts","../src/css.ts","../src/forward.ts","../src/shared.ts","../src/hash.ts","../src/sheet.ts","../src/ThemeProvider.ts","../src/globalStyle.ts","../src/keyframes.ts","../src/styled.tsx","../src/useCSS.ts","../src/index.ts"],"sourcesContent":["/**\n * Interpolation resolver: converts tagged template strings + values into a\n * final CSS string. Handles nested CSSResults, arrays, functions, and\n * primitive values.\n */\n\nimport type { DefaultTheme } from './ThemeProvider'\n\n// Dev-time counter sink — populated by `@pyreon/perf-harness` on install().\n// Guarded on call sites with `process.env.NODE_ENV !== 'production'` so prod bundles\n// tree-shake the entire reference. No cross-package import, no publish surface.\nconst _countSink = globalThis as { __pyreon_count__?: (name: string, n?: number) => void }\n\n/**\n * Props passed to interpolation functions inside tagged templates.\n * Generic `P` allows consumers to type their custom props (e.g. transient $-prefixed):\n *\n * @example\n * styled('div')<{ $color: string }>`\n * background: ${(props) => props.$color}; // props.$color is typed!\n * `\n */\nexport type StyledProps<P extends object = Record<string, unknown>> = P & {\n theme?: DefaultTheme & Record<string, unknown>\n}\n\nexport type Interpolation<P extends object = Record<string, unknown>> =\n | string\n | number\n | boolean\n | null\n | undefined\n | CSSResult\n | Interpolation<P>[]\n | ((props: StyledProps<P>) => Interpolation<P>)\n\n/**\n * Lazy representation of a `css` tagged template. Stores the raw template\n * strings and interpolation values without resolving them. Resolution is\n * deferred until a styled component renders (or until explicitly resolved).\n */\nexport class CSSResult {\n /**\n * Memoized result of `isDynamic(this)`. Populated on first access from\n * `shared.ts#isDynamic`. CSSResult instances are typically created once\n * at module load (one per `css\\`...\\`` literal) and reused everywhere —\n * a `styled()` component, a `useCSS` consumer, a nested interpolation,\n * etc. Lazy-cache avoids rescanning whole sub-trees on every consumer.\n * Ported from vitus-labs `c483cabc`.\n */\n _isDynamic: boolean | undefined = undefined\n\n /**\n * Memoized resolved CSS string for STATIC CSSResults — populated by\n * `resolveValue` the first time a known-static nested CSSResult is\n * resolved. Safe because props don't affect output when there are no\n * function interpolations. Skipped for dynamic CSSResults (the resolved\n * string depends on props each call). Common pattern: a shared static\n * snippet interpolated into many dynamic components — pre-cache, that\n * snippet was re-resolved per-render of every consumer. Ported from\n * vitus-labs `754cd203`; measured upstream: 2.6M→6.5M ops/s (+149%,\n * ~2.5× speedup on the 8-repeated-resolve micro).\n */\n _staticResolved: string | undefined = undefined\n\n constructor(\n readonly strings: TemplateStringsArray,\n readonly values: Interpolation[],\n ) {}\n\n /** Resolve with empty props — useful for static templates, testing, and debugging. */\n toString(): string {\n return resolve(this.strings, this.values, {})\n }\n}\n\n/** Resolve a tagged template's strings + values into a final CSS string. */\nexport const resolve = (\n strings: TemplateStringsArray,\n values: Interpolation[],\n props: Record<string, any>,\n): string => {\n if (process.env.NODE_ENV !== 'production') _countSink.__pyreon_count__?.('styler.resolve')\n // Tagged templates guarantee strings.length === values.length + 1,\n // so strings[0] and strings[i+1] are always defined — no ?? needed.\n let result = strings[0] as string\n for (let i = 0; i < values.length; i++) {\n const v = values[i]\n const s = strings[i + 1] as string\n // Inline the most common value types to avoid function call overhead.\n if (typeof v === 'function') {\n const r = v(props)\n result +=\n (typeof r === 'string'\n ? r\n : r == null || r === false || r === true\n ? ''\n : resolveValue(r as Interpolation, props)) + s\n } else if (v == null || v === false || v === true) {\n result += s\n } else if (typeof v === 'string') {\n result += v + s\n } else if (typeof v === 'number') {\n result += v + s\n } else {\n result += resolveValue(v, props) + s\n }\n }\n return result\n}\n\n/**\n * Normalize resolved CSS text for strict `insertRule` compatibility.\n *\n * Single-pass scanner that handles all cleanup in one traversal:\n * - Strips block comments and line comments (preserves :// in URLs)\n * - Collapses whitespace to single spaces\n * - Removes redundant semicolons\n * - Trims leading/trailing whitespace\n */\nconst normCache = new Map<string, string>()\n/** Clear the normalizeCSS cache (called during HMR cleanup). */\nexport const clearNormCache = () => normCache.clear()\n\nexport const normalizeCSS = (css: string): string => {\n const cached = normCache.get(css)\n if (cached !== undefined) return cached\n\n const len = css.length\n let out = ''\n let space = false // pending space to emit before next non-whitespace char\n let last = 0 // charCode of last char written to output (0 = nothing yet)\n\n for (let i = 0; i < len; i++) {\n const c = css.charCodeAt(i)\n\n // /* block comment */\n if (c === 47 /* / */ && css.charCodeAt(i + 1) === 42 /* * */) {\n const end = css.indexOf('*/', i + 2)\n i = end === -1 ? len : end + 1\n space = true\n continue\n }\n\n // // line comment (but not :// in URLs)\n if (c === 47 /* / */ && css.charCodeAt(i + 1) === 47 /* / */ && last !== 58 /* : */) {\n const nl = css.indexOf('\\n', i + 2)\n i = nl === -1 ? len : nl\n space = true\n continue\n }\n\n // Whitespace → collapse\n if (c === 32 || c === 9 || c === 10 || c === 13 || c === 12) {\n space = true\n continue\n }\n\n // Semicolon → skip if redundant (after start, {, }, or another ;)\n if (c === 59 /* ; */) {\n if (last === 0 || last === 123 /* { */ || last === 125 /* } */ || last === 59 /* ; */) {\n continue\n }\n space = false\n out += ';'\n last = 59\n continue\n }\n\n // Regular char — emit pending space (but not at start of output)\n if (space && last !== 0) out += ' '\n space = false\n\n out += css[i]\n last = c\n }\n\n // Evict oldest ~10% to prevent memory leaks without cliff-edge drop\n if (normCache.size > 2000) {\n let count = 0\n for (const key of normCache.keys()) {\n if (count >= 200) break\n normCache.delete(key)\n count++\n }\n }\n normCache.set(css, out)\n\n return out\n}\n\nexport const resolveValue = (value: Interpolation, props: Record<string, any>): string => {\n // null, undefined, false, true → empty (enables conditional: ${cond && css`...`})\n if (value == null || value === false || value === true) return ''\n\n // function interpolation → call with props/theme context, resolve result\n if (typeof value === 'function') return resolveValue(value(props) as Interpolation, props)\n\n // nested CSSResult → recursively resolve, with static-result memoization.\n // When `_isDynamic === false` (populated by shared.ts#isDynamic at styled\n // component creation), the resolved string is independent of props and can\n // be cached on the instance. Saves re-walking strings/values for every\n // consumer of a shared static snippet. Ported from vitus-labs `754cd203`;\n // measured upstream: ~2.5× speedup on 8-repeated-resolve micro.\n if (value instanceof CSSResult) {\n if (value._isDynamic === false) {\n if (value._staticResolved === undefined) {\n value._staticResolved = resolve(value.strings, value.values, {})\n }\n return value._staticResolved\n }\n return resolve(value.strings, value.values, props)\n }\n\n // array of results (e.g. from makeItResponsive's breakpoints.map())\n if (Array.isArray(value)) {\n let arrayResult = ''\n for (let i = 0; i < value.length; i++) {\n arrayResult += resolveValue(value[i], props)\n }\n return arrayResult\n }\n\n return String(value)\n}\n","import { CSSResult, type Interpolation } from './resolve'\n\n/**\n * Tagged template function for CSS. Captures the template strings and\n * interpolation values as a lazy CSSResult — resolution is deferred\n * until a styled component renders.\n *\n * Works as both a tagged template (`css\\`...\\``) and a regular function\n * call (`css(...args)`) since tagged templates are syntactic sugar for\n * function calls with (TemplateStringsArray, ...values).\n */\nexport const css = (strings: TemplateStringsArray, ...values: Interpolation[]): CSSResult =>\n new CSSResult(strings, values)\n","/**\n * HTML prop filtering. Prevents unknown props from being forwarded to DOM\n * elements (which causes warnings). Props starting with `$` are\n * transient (styling-only) and are always filtered out.\n */\n\n// Common HTML attributes, event handlers, and ARIA/data attributes.\n//\n// Using a plain object with `key in HTML_PROPS` instead of `Set.has(key)`:\n// V8 inlines `in` checks via hidden-class lookups (the object has a fixed\n// shape at module load and never changes), which is meaningfully faster\n// than going through the Set protocol on hot prop-filter paths. Measured\n// upstream (vitus-labs `be471b19`): +19% on the 5-lookup mix benchmark\n// (4 hits + 1 miss).\nconst HTML_PROPS_LIST = [\n // Core props\n 'className',\n 'class',\n 'dangerouslySetInnerHTML',\n 'htmlFor',\n 'id',\n 'key',\n 'ref',\n 'style',\n 'tabIndex',\n 'role',\n // Event handlers\n 'onAbort',\n 'onAnimationEnd',\n 'onAnimationIteration',\n 'onAnimationStart',\n 'onBlur',\n 'onChange',\n 'onClick',\n 'onCompositionEnd',\n 'onCompositionStart',\n 'onCompositionUpdate',\n 'onContextMenu',\n 'onCopy',\n 'onCut',\n 'onDoubleClick',\n 'onDrag',\n 'onDragEnd',\n 'onDragEnter',\n 'onDragLeave',\n 'onDragOver',\n 'onDragStart',\n 'onDrop',\n 'onError',\n 'onFocus',\n 'onInput',\n 'onKeyDown',\n 'onKeyPress',\n 'onKeyUp',\n 'onLoad',\n 'onMouseDown',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseMove',\n 'onMouseOut',\n 'onMouseOver',\n 'onMouseUp',\n 'onPaste',\n 'onPointerCancel',\n 'onPointerDown',\n 'onPointerEnter',\n 'onPointerLeave',\n 'onPointerMove',\n 'onPointerOut',\n 'onPointerOver',\n 'onPointerUp',\n 'onScroll',\n 'onSelect',\n 'onSubmit',\n 'onTouchCancel',\n 'onTouchEnd',\n 'onTouchMove',\n 'onTouchStart',\n 'onTransitionEnd',\n 'onWheel',\n // HTML attributes\n 'accept',\n 'acceptCharset',\n 'accessKey',\n 'action',\n 'allow',\n 'allowFullScreen',\n 'alt',\n 'as',\n 'async',\n 'autoCapitalize',\n 'autoComplete',\n 'autoCorrect',\n 'autoFocus',\n 'autoPlay',\n 'capture',\n 'cellPadding',\n 'cellSpacing',\n 'charSet',\n 'checked',\n 'cite',\n 'cols',\n 'colSpan',\n 'content',\n 'contentEditable',\n 'controls',\n 'controlsList',\n 'coords',\n 'crossOrigin',\n 'dateTime',\n 'decoding',\n 'default',\n 'defaultChecked',\n 'defaultValue',\n 'defer',\n 'dir',\n 'disabled',\n 'disablePictureInPicture',\n 'disableRemotePlayback',\n 'download',\n 'draggable',\n 'encType',\n 'enterKeyHint',\n 'fetchPriority',\n 'form',\n 'formAction',\n 'formEncType',\n 'formMethod',\n 'formNoValidate',\n 'formTarget',\n 'frameBorder',\n 'headers',\n 'height',\n 'hidden',\n 'high',\n 'href',\n 'hrefLang',\n 'httpEquiv',\n 'inputMode',\n 'integrity',\n 'is',\n 'label',\n 'lang',\n 'list',\n 'loading',\n 'loop',\n 'low',\n 'max',\n 'maxLength',\n 'media',\n 'method',\n 'min',\n 'minLength',\n 'multiple',\n 'muted',\n 'name',\n 'noModule',\n 'noValidate',\n 'nonce',\n 'open',\n 'optimum',\n 'pattern',\n 'placeholder',\n 'playsInline',\n 'poster',\n 'preload',\n 'readOnly',\n 'referrerPolicy',\n 'rel',\n 'required',\n 'reversed',\n 'rows',\n 'rowSpan',\n 'sandbox',\n 'scope',\n 'scoped',\n 'scrolling',\n 'selected',\n 'shape',\n 'size',\n 'sizes',\n 'slot',\n 'span',\n 'spellCheck',\n 'src',\n 'srcDoc',\n 'srcLang',\n 'srcSet',\n 'start',\n 'step',\n 'summary',\n 'target',\n 'title',\n 'translate',\n 'type',\n 'useMap',\n 'value',\n 'width',\n 'wrap',\n] as const\n\n// Build the lookup object once at module load. `null`-prototype keeps the\n// object's hidden class lean and means `in` checks don't accidentally pick\n// up `Object.prototype` keys.\nconst HTML_PROPS: Record<string, true> = Object.create(null)\nfor (const k of HTML_PROPS_LIST) HTML_PROPS[k] = true\n\n/**\n * Filters props for HTML elements. Keeps valid HTML attrs, data-*, aria-*.\n * Rejects unknown props and $-prefixed transient props.\n */\nexport const filterProps = (props: Record<string, unknown>): Record<string, unknown> => {\n const filtered: Record<string, unknown> = {}\n\n for (const key in props) {\n // Skip transient props ($-prefixed) — used for styling-only props\n if (key.charCodeAt(0) === 36) continue // '$'\n\n // Skip `as` prop — handled separately by styled\n if (key === 'as') continue\n\n // Keep data-* and aria-* attributes\n if (key.startsWith('data-') || key.startsWith('aria-')) {\n filtered[key] = props[key]\n continue\n }\n\n // Keep known HTML props — `in` against the null-prototype lookup\n // object beats `Set.has` on the hot DOM-filter path.\n if (key in HTML_PROPS) {\n filtered[key] = props[key]\n }\n }\n\n return filtered\n}\n\n/**\n * Build final props for a styled component in a single pass.\n * Combines className merging, ref injection, and prop filtering into one\n * allocation and one iteration.\n *\n * Copies own property DESCRIPTORS rather than values for forwarded\n * props — getter-shaped reactive props (compiler-emitted `_rp(() =>\n * signal())` converted to getters by `makeReactiveProps`) survive the\n * copy with their reactive subscription intact. A bare `result[key] =\n * rawProps[key]` fires the getter at setup time and stores a static\n * value, breaking signal-driven reactivity for any consumer that reads\n * `props.x` in a reactive scope downstream.\n */\nexport const buildProps = (\n rawProps: Record<string, any>,\n generatedCls: string,\n isDOM: boolean,\n customFilter?: (prop: string) => boolean,\n): Record<string, any> => {\n const result: Record<string, any> = {}\n\n // Merge generated + user className.\n //\n // **Reactive contract** — when the user passes a signal-driven class\n // (`class={() => variant()}` via the compiler's `_rp(() => …)`\n // wrapping → `makeReactiveProps` getter descriptor), value-reading\n // `rawProps.class` here fires the getter ONCE at setup time, captures\n // the snapshot, and merges it into a STATIC string. Downstream\n // `applyProp` then sees a plain string and writes it once; the DOM\n // never updates on signal change.\n //\n // Detect getter-shaped class / className and wrap the merge in a\n // getter that re-reads + re-composes on every access. The string we\n // emit then carries the reactive subscription through to applyProp,\n // which DOES re-fire its renderEffect on getter access via the\n // descriptor it sees here. Static (data-descriptor) class still\n // takes the simple value-merge fast path.\n const classDesc =\n Object.getOwnPropertyDescriptor(rawProps, 'class') ??\n Object.getOwnPropertyDescriptor(rawProps, 'className')\n if (classDesc?.get) {\n const getUserCls = classDesc.get\n Object.defineProperty(result, 'class', {\n enumerable: true,\n configurable: true,\n get() {\n const uc = getUserCls.call(rawProps)\n if (generatedCls) return uc ? `${generatedCls} ${uc}` : generatedCls\n return uc ?? ''\n },\n })\n } else {\n const userCls = rawProps.class || rawProps.className\n if (generatedCls) {\n result.class = userCls ? `${generatedCls} ${userCls}` : generatedCls\n } else if (userCls) {\n result.class = userCls\n }\n }\n\n // Helper: copy a prop's OWN descriptor (preserves getters) into result.\n // Falls back to a no-op if the source has no own descriptor for the key.\n const copyDescriptor = (key: string): void => {\n const d = Object.getOwnPropertyDescriptor(rawProps, key)\n if (d) Object.defineProperty(result, key, d)\n }\n\n // Component target — forward all props except as/className/class and $-prefixed\n if (!isDOM) {\n for (const key in rawProps) {\n if (key === 'as' || key === 'className' || key === 'class') continue\n if (key.charCodeAt(0) === 36) continue // $-prefixed transient\n copyDescriptor(key)\n }\n return result\n }\n\n // DOM element with custom shouldForwardProp\n if (customFilter) {\n for (const key in rawProps) {\n if (key === 'as' || key === 'className' || key === 'class') continue\n if (customFilter(key)) copyDescriptor(key)\n }\n return result\n }\n\n // DOM element with default filtering\n for (const key in rawProps) {\n if (key === 'as' || key === 'className' || key === 'class') continue\n if (key.charCodeAt(0) === 36) continue // $-prefixed transient\n if (key.startsWith('data-') || key.startsWith('aria-')) {\n copyDescriptor(key)\n continue\n }\n if (key in HTML_PROPS) copyDescriptor(key)\n }\n return result\n}\n","/**\n * Shared utilities used across multiple modules.\n */\nimport { CSSResult, type Interpolation } from './resolve'\n\n/** Check if an interpolation value is dynamic (contains functions or nested dynamic CSSResults). */\nexport const isDynamic = (v: Interpolation): boolean => {\n if (typeof v === 'function') return true\n if (Array.isArray(v)) return v.some(isDynamic)\n if (v instanceof CSSResult) {\n // Memoize per-instance — CSSResults are created once at module level\n // (one per `css\\`...\\`` literal) and reused across many `styled()` /\n // `useCSS()` / nested-interpolation checks. Avoids rescanning whole\n // sub-trees on every consumer. Ported from vitus-labs `c483cabc`.\n const cached = v._isDynamic\n if (cached !== undefined) return cached\n const r = v.values.some(isDynamic)\n v._isDynamic = r\n return r\n }\n return false\n}\n","/**\n * Fast FNV-1a non-cryptographic hash. Returns base-36 string for compact class names.\n *\n * 32-bit hash space → ~4.3 billion unique values. Collision probability is\n * negligible for typical applications (< 10,000 unique CSS rules).\n */\n\n/** FNV-1a offset basis — starting state for streaming hash. */\nexport const HASH_INIT = 2166136261\n\nconst FNV_PRIME = 16777619\n\n/** Feed a string segment into the running hash state.\n * Streaming: hashUpdate(hashUpdate(HASH_INIT, 'ab'), 'cd') === hash('abcd').\n */\nexport const hashUpdate = (init: number, str: string): number => {\n let h = init\n for (let i = 0; i < str.length; i++) {\n h = Math.imul(h ^ str.charCodeAt(i), FNV_PRIME)\n }\n return h\n}\n\n/** Finalize a hash state into a base-36 class name suffix. */\nexport const hashFinalize = (h: number): string => (h >>> 0).toString(36)\n\n/** Hash a complete string in one shot. Returns base-36 string. */\nexport const hash = (str: string): string => hashFinalize(hashUpdate(HASH_INIT, str))\n","/**\n * StyleSheet manager. Handles CSS rule injection, hash-based deduplication,\n * SSR buffering, client-side hydration, bounded cache, and @layer support.\n *\n * Media queries (@media), @supports, and @container blocks nested inside\n * component CSS are automatically extracted into separate top-level rules.\n */\nimport { hash } from './hash'\nimport { clearNormCache } from './resolve'\n\n// Dev-time counter sink — see styler/resolve.ts for the contract.\nconst _countSink = globalThis as { __pyreon_count__?: (name: string, n?: number) => void }\n\n// Dev-mode gate. `import.meta.env.DEV` is literal-replaced by Vite at build\n// time and tree-shakes to zero bytes in prod. The previous\n// `process.env.NODE_ENV !== 'production'` form was dead code in real Vite\n// browser bundles (Vite does not polyfill `process`), so insertRule failures\n// were silently swallowed in production — masking malformed CSS bugs.\nconst PREFIX = 'pyr'\nconst ATTR = 'data-pyreon-styler'\nconst DEFAULT_MAX_CACHE_SIZE = 10000\n\nexport interface StyleSheetOptions {\n /** Maximum number of cached rules before eviction (default: 10000). */\n maxCacheSize?: number\n /** CSS @layer name to wrap scoped rules in. */\n layer?: string\n}\n\nexport class StyleSheet {\n private cache = new Map<string, string>()\n private insertCache = new Map<string, string>()\n // Reverse index: cache key (className / keyframe name / global key) →\n // the insertCache keys that resolve to it. Lets eviction drop the\n // (large) cssText-keyed insertCache entries in lockstep with `cache`,\n // instead of letting them grow unbounded for the process lifetime.\n private icKeysByClass = new Map<string, Set<string>>()\n // Reverse index: cache key → the top-level CSSRule objects it inserted\n // into the live sheet. Object references survive `deleteRule()`\n // reindexing (only the numeric index shifts), so eviction can locate\n // and remove the exact DOM rules without fragile index bookkeeping.\n private domRules = new Map<string, CSSRule[]>()\n private sheet: CSSStyleSheet | null = null\n private ssrBuffer: string[] = []\n private isSSR: boolean\n private maxCacheSize: number\n private layer: string | undefined\n private supportsLayer = false\n\n constructor(options: StyleSheetOptions = {}) {\n this.maxCacheSize = options.maxCacheSize ?? DEFAULT_MAX_CACHE_SIZE\n this.layer = options.layer\n this.isSSR = typeof document === 'undefined'\n if (!this.isSSR) this.mount()\n }\n\n private mount() {\n // SSR guard: the constructor only calls mount() when !this.isSSR, but\n // keep the guard in-method so it's self-evidently SSR-safe regardless\n // of caller (matches `this.isSSR = typeof document === 'undefined'`).\n if (this.isSSR) return\n // Reuse existing <style> tag from SSR hydration\n const existing = document.querySelector(`style[${ATTR}]`) as HTMLStyleElement | null\n\n if (existing) {\n this.sheet = existing.sheet ?? null\n this.hydrateFromTag(existing)\n } else {\n const el = document.createElement('style')\n el.setAttribute(ATTR, '')\n document.head.appendChild(el)\n this.sheet = el.sheet ?? null\n }\n\n // Inject CSS @layer ordering for the framework's cascade.\n //\n // Two layers: `elements` (base layout primitives) < `rocketstyle`\n // (themed component styles). The explicit ordering declaration\n // ensures rocketstyle theme styles always override element base\n // styles regardless of source order, while media queries within\n // each layer still work correctly (media conditions are evaluated\n // within each layer independently).\n //\n // Previously this used a single `@layer pyreon` which put\n // rocketstyle and elements in the same layer, relying on source\n // order. That broke when Elements were rendered WITHOUT a layer\n // (unlayered CSS always wins over layered CSS per the cascade\n // spec), making rocketstyle themes unable to override element\n // base styles.\n if (this.sheet) {\n try {\n this.sheet.insertRule('@layer elements, rocketstyle;', 0)\n this.supportsLayer = true\n } catch {\n // @layer not supported — falls back to source order\n }\n }\n }\n\n /** Extract className from a selector like \".pyr-abc\" or \".pyr-abc.pyr-abc\" → \"pyr-abc\" */\n private extractClassName(selectorText: string): string | null {\n if (selectorText[0] !== '.') return null\n const dotIdx = selectorText.indexOf('.', 1)\n return dotIdx > 0 ? selectorText.slice(1, dotIdx) : selectorText.slice(1)\n }\n\n /** Parse existing rules from SSR-rendered <style> tag into cache. */\n private hydrateFromTag(el: HTMLStyleElement) {\n const sheet = el.sheet\n if (!sheet) return\n\n for (let i = 0; i < sheet.cssRules.length; i++) {\n const rule = sheet.cssRules[i]\n\n if (rule instanceof CSSStyleRule) {\n const className = this.extractClassName(rule.selectorText)\n if (className) this.cache.set(className, className)\n }\n\n // Handle split @media rules that wrap our selectors\n if (typeof CSSMediaRule !== 'undefined' && rule instanceof CSSMediaRule) {\n for (let j = 0; j < rule.cssRules.length; j++) {\n const inner = rule.cssRules[j]\n if (inner instanceof CSSStyleRule) {\n const className = this.extractClassName(inner.selectorText)\n if (className) this.cache.set(className, className)\n }\n }\n }\n }\n }\n\n /** Record that `icKey` resolves to `cacheKey` (for lockstep eviction). */\n private trackIcKey(cacheKey: string, icKey: string): void {\n let s = this.icKeysByClass.get(cacheKey)\n if (!s) {\n s = new Set()\n this.icKeysByClass.set(cacheKey, s)\n }\n s.add(icKey)\n }\n\n /** Record a top-level CSSRule this `cacheKey` inserted into the sheet. */\n private trackDomRule(cacheKey: string, ref: CSSRule | null | undefined): void {\n if (!ref) return\n let a = this.domRules.get(cacheKey)\n if (!a) {\n a = []\n this.domRules.set(cacheKey, a)\n }\n a.push(ref)\n }\n\n /**\n * Evict the given cache keys across ALL three storage layers:\n * the `cache` Map, the cssText-keyed `insertCache` Map, and the live\n * DOM rules. Without the latter two, `maxCacheSize` bounded only the\n * smallest of the three — `insertCache` keys (full CSS text) and the\n * `<style>` tag's `cssRules` grew unbounded for the app's lifetime,\n * which is the actual memory leak this method exists to prevent.\n */\n private evictKeys(keys: string[]): void {\n const ruleRefs = new Set<CSSRule>()\n for (const key of keys) {\n this.cache.delete(key)\n const ics = this.icKeysByClass.get(key)\n if (ics) {\n for (const ic of ics) this.insertCache.delete(ic)\n this.icKeysByClass.delete(key)\n }\n const refs = this.domRules.get(key)\n if (refs) {\n for (const r of refs) ruleRefs.add(r)\n this.domRules.delete(key)\n }\n }\n if (this.sheet && ruleRefs.size > 0) {\n // Descending walk: deleting at i never shifts a not-yet-visited\n // lower index, so identity matching stays correct mid-loop.\n for (let i = this.sheet.cssRules.length - 1; i >= 0; i--) {\n const r = this.sheet.cssRules[i]\n if (r && ruleRefs.has(r)) {\n try {\n this.sheet.deleteRule(i)\n } catch {\n // Rule already gone (e.g. external clearAll) — ignore.\n }\n }\n }\n }\n }\n\n /** Evict oldest entries when cache exceeds max size. */\n private evictIfNeeded() {\n if (this.cache.size <= this.maxCacheSize) return\n\n // Map iteration order is insertion order — delete oldest 10%\n const toDelete = Math.floor(this.maxCacheSize * 0.1)\n const evicted: string[] = []\n let count = 0\n for (const key of this.cache.keys()) {\n if (count >= toDelete) break\n evicted.push(key)\n count++\n }\n this.evictKeys(evicted)\n }\n\n /**\n * Extract nested at-rules (@media, @supports, @container) from CSS text\n * and wrap their content in the given selector as separate top-level rules.\n */\n private splitAtRules(cssText: string, selector: string): { base: string; atRules: string[] } {\n // Fast path: no at-rules to split\n if (cssText.indexOf('@') === -1) return { base: cssText, atRules: [] }\n\n const atRules: string[] = []\n const baseParts: string[] = []\n const len = cssText.length\n let depth = 0\n let atStart = -1\n let lastBase = 0\n\n // `charCodeAt(i)` returns a primitive int; `cssText[i]` allocates a\n // fresh 1-char string in V8 per iteration. On long stylesheets with\n // at-rule blocks the per-char allocation dominates. Ported from\n // vitus-labs `c483cabc`.\n for (let i = 0; i < len; i++) {\n const ch = cssText.charCodeAt(i)\n\n if (ch === 123 /* { */) {\n depth++\n } else if (ch === 125 /* } */) {\n depth--\n if (depth === 0 && atStart >= 0) {\n // End of a tracked at-rule block — extract and wrap with selector\n const openBrace = cssText.indexOf('{', atStart)\n const atPrefix = cssText.slice(atStart, openBrace).trim()\n const innerCSS = cssText.slice(openBrace + 1, i).trim()\n if (innerCSS) {\n atRules.push(`${atPrefix}{${selector}{${innerCSS}}}`)\n }\n atStart = -1\n lastBase = i + 1\n }\n } else if (depth === 0 && ch === 64 /* @ */ && atStart < 0) {\n // Check if this starts a splittable at-rule (not @keyframes, @font-face, etc.)\n const remaining = cssText.slice(i, i + 20)\n if (/^@(?:media|supports|container)\\b/.test(remaining)) {\n // Save any base CSS that precedes this at-rule\n const baseBefore = cssText.slice(lastBase, i).trim()\n if (baseBefore) baseParts.push(baseBefore)\n atStart = i\n }\n }\n }\n\n // Collect remaining base CSS after the last at-rule\n if (lastBase < cssText.length && atStart < 0) {\n const remaining = cssText.slice(lastBase).trim()\n if (remaining) baseParts.push(remaining)\n }\n\n // If no at-rules were found, return original unchanged\n if (atRules.length === 0) return { base: cssText, atRules: [] }\n\n return { base: baseParts.join(' '), atRules }\n }\n\n /**\n * Compute a className from CSS text without injecting (pure function).\n */\n getClassName(cssText: string): string {\n const cached = this.insertCache.get(cssText)\n if (cached) return cached\n const h = hash(cssText)\n return `${PREFIX}-${h}`\n }\n\n /**\n * Insert CSS rules for a component. Returns the class name (deterministic, hash-based).\n * Deduplicates: same CSS text always produces the same class name and\n * the rules are only injected once.\n *\n * @param cssText - CSS declarations to insert\n * @param _unused - Reserved for backward compatibility (was `boost`)\n * @param insertLayer - CSS @layer to wrap this rule in (e.g. 'rocketstyle').\n * Used by rocketstyle to ensure wrapper styles override inner component styles\n * via @layer order (base < rocketstyle) instead of specificity hacks.\n */\n insert(cssText: string, _unused = false, insertLayer?: string): string {\n if (process.env.NODE_ENV !== 'production')\n _countSink.__pyreon_count__?.('styler.sheet.insert')\n // Fast path: skip hash computation on repeated insertions of same CSS text\n const icKey = insertLayer ? `${cssText}\\0L:${insertLayer}` : cssText\n const icHit = this.insertCache.get(icKey)\n if (icHit) {\n if (process.env.NODE_ENV !== 'production')\n _countSink.__pyreon_count__?.('styler.sheet.insert.hit')\n return icHit\n }\n\n const h = hash(cssText)\n const className = `${PREFIX}-${h}`\n\n if (this.cache.has(className)) {\n this.insertCache.set(icKey, className)\n this.trackIcKey(className, icKey)\n return className\n }\n\n this.evictIfNeeded()\n this.cache.set(className, className)\n\n const selector = `.${className}`\n\n // Split nested at-rules into separate top-level rules\n const { base, atRules } = this.splitAtRules(cssText, selector)\n\n const rules: string[] = []\n if (base) rules.push(`${selector}{${base}}`)\n rules.push(...atRules)\n\n // Apply @layer wrapping — per-insert layer takes precedence over sheet-level layer.\n // In SSR, always apply layers (output goes to real browsers).\n // In client, skip if @layer isn't supported (e.g. happy-dom in tests).\n const layerName = this.isSSR || this.supportsLayer ? (insertLayer ?? this.layer) : undefined\n const finalRules = layerName ? rules.map((r) => `@layer ${layerName}{${r}}`) : rules\n\n if (this.isSSR) {\n for (const rule of finalRules) {\n this.ssrBuffer.push(rule)\n }\n } else if (this.sheet) {\n for (const rule of finalRules) {\n try {\n const at = this.sheet.insertRule(rule, this.sheet.cssRules.length)\n this.trackDomRule(className, this.sheet.cssRules[at])\n } catch (_e) {\n if (process.env.NODE_ENV !== 'production') {\n // oxlint-disable-next-line no-console\n console.warn('[styler] Failed to insert CSS rule:', rule, _e)\n }\n }\n }\n }\n\n this.insertCache.set(icKey, className)\n this.trackIcKey(className, icKey)\n return className\n }\n\n /** Insert a @keyframes rule. Deduplicates by animation name. */\n insertKeyframes(name: string, body: string): void {\n if (this.cache.has(name)) return\n\n this.evictIfNeeded()\n this.cache.set(name, name)\n\n const rule = `@keyframes ${name}{${body}}`\n\n if (this.isSSR) {\n this.ssrBuffer.push(rule)\n } else if (this.sheet) {\n try {\n const at = this.sheet.insertRule(rule, this.sheet.cssRules.length)\n this.trackDomRule(name, this.sheet.cssRules[at])\n } catch (_e) {\n if (process.env.NODE_ENV !== 'production') {\n // oxlint-disable-next-line no-console\n console.warn('[styler] Failed to insert @keyframes rule:', rule, _e)\n }\n }\n }\n }\n\n /**\n * Split CSS text into individual top-level rules.\n * CSSStyleSheet.insertRule() only accepts one rule at a time.\n */\n private splitRules(cssText: string): string[] {\n const rules: string[] = []\n const len = cssText.length\n let depth = 0\n let start = 0\n\n // `charCodeAt(i)` returns a primitive int; `cssText[i]` allocates a\n // fresh 1-char string per iteration. Ported from vitus-labs `c483cabc`.\n for (let i = 0; i < len; i++) {\n const ch = cssText.charCodeAt(i)\n if (ch === 123 /* { */) depth++\n else if (ch === 125 /* } */) {\n depth--\n if (depth === 0) {\n const rule = cssText.slice(start, i + 1).trim()\n if (rule) rules.push(rule)\n start = i + 1\n }\n }\n }\n\n return rules\n }\n\n /** Insert global CSS rules (no wrapper selector). Deduplicates by hash. */\n insertGlobal(cssText: string): void {\n const h = hash(cssText)\n const key = `global-${h}`\n\n if (this.cache.has(key)) return\n\n this.evictIfNeeded()\n this.cache.set(key, key)\n\n if (this.isSSR) {\n this.ssrBuffer.push(cssText)\n } else if (this.sheet) {\n const rules = this.splitRules(cssText)\n for (const rule of rules) {\n try {\n const at = this.sheet.insertRule(rule, this.sheet.cssRules.length)\n this.trackDomRule(key, this.sheet.cssRules[at])\n } catch (_e) {\n if (process.env.NODE_ENV !== 'production') {\n // oxlint-disable-next-line no-console\n console.warn('[styler] Failed to insert global CSS rule:', rule, _e)\n }\n }\n }\n }\n }\n\n /** Returns collected CSS for SSR as a complete `<style>` tag string. */\n getStyleTag(): string {\n if (this.ssrBuffer.length === 0) return `<style ${ATTR}=\"\"></style>`\n // Emit the layer ordering declaration for SSR output so the cascade\n // is correct when the browser parses the SSR HTML. On the client side\n // this ordering is injected via insertRule in mount().\n const layerDecl = this.hasLayeredRules()\n ? '@layer elements, rocketstyle;'\n : this.layer\n ? `@layer ${this.layer};`\n : ''\n const css = (layerDecl + this.ssrBuffer.join('')).replace(/<\\/style/gi, '<\\\\/style')\n return `<style ${ATTR}=\"\">${css}</style>`\n }\n\n /**\n * Returns the collected SSR rules as a raw array (one entry per\n * top-level rule, already `@layer`-wrapped + class-prefixed exactly as\n * `insert()` produced them). Used by the compile-time rocketstyle\n * collapse resolver: it renders a component under SSR, reads the rules\n * here, and the build emits an idempotent `injectRules()` call so the\n * collapsed `_tpl()` site is self-sufficient (no prior runtime mount\n * needed to populate the sheet). A copy — callers must not mutate the\n * internal buffer.\n */\n getStyleRules(): readonly string[] {\n return this.ssrBuffer.slice()\n }\n\n // Idempotency guard for injectRules — keyed by the FNV hash the\n // collapse resolver computes over the rule set. A second injection of\n // the same resolved bundle (e.g. the module re-evaluated under HMR, or\n // two collapsed call sites resolving to the same dimension combo) is a\n // no-op instead of duplicate live `cssRules`.\n private injectedBundles = new Set<string>()\n\n /**\n * Inject pre-resolved CSS rule text (from `getStyleRules()` captured at\n * build time by the rocketstyle-collapse resolver) directly into the\n * live sheet. Unlike `insert()` this does NOT re-hash — the class names\n * are already baked into `rules` and into the collapsed `_tpl()` HTML;\n * re-hashing would produce a different class and break the contract.\n * Idempotent by `key` (the resolver's FNV hash of the bundle).\n */\n injectRules(rules: readonly string[], key: string): void {\n if (this.injectedBundles.has(key)) return\n this.injectedBundles.add(key)\n if (this.isSSR) {\n for (const rule of rules) this.ssrBuffer.push(rule)\n return\n }\n if (!this.sheet) return\n for (const rule of rules) {\n try {\n this.sheet.insertRule(rule, this.sheet.cssRules.length)\n } catch (_e) {\n if (process.env.NODE_ENV !== 'production') {\n // oxlint-disable-next-line no-console\n console.warn('[styler] injectRules: failed to insert collapsed rule:', rule, _e)\n }\n }\n }\n }\n\n /**\n * Test-only: live `cssRules.length` (0 in SSR). Mirrors runtime-dom's\n * `_tplCacheSize()` test-only-accessor convention; lets injectRules /\n * eviction tests assert without reaching into the private sheet.\n */\n ruleCountForTest(): number {\n return this.sheet?.cssRules.length ?? 0\n }\n\n /**\n * Clear the SSR rule-capture buffer ONLY. Leaves `cache`,\n * `insertCache`, `icKeysByClass`, `domRules`, and `injectedBundles`\n * intact.\n *\n * Used by the rocketstyle-collapse build-time resolver to isolate\n * per-site rule captures between concurrent renders against the\n * shared singleton sheet (audit #8). Without resetting the buffer\n * between the resolver's render pairs, the `getStyleRules()` slice\n * for site N captures `[...site1Rules, ...site2Rules, ..., siteNRules]`\n * — every FNV key becomes unique per call order, and the cross-site\n * `injectedBundles` runtime dedup at consumer sites silently breaks\n * even when the underlying rule bundles are identical.\n *\n * Important context — the resolver MUST also pair this with per-test\n * resolver isolation OR truly-distinct dimension props per render to\n * actually produce non-empty `getStyleRules()` slices: `insert()`\n * short-circuits at `cache.has(className)` / `insertCache.get(icKey)`\n * when a className has been seen, AND cache layers above the styler\n * (styled.tsx `classCache` / `elClassCache` keyed on rocketstyle's\n * `$rocketstyle`/`$rocketstate` identity, and rocketstyle's `_rsMemo`)\n * survive between resolves within a single nested-Vite-SSR lifetime.\n * A second resolve sharing dimension props with a prior one will hit\n * the styled-component cache, skip `sheet.insert()` entirely, and\n * leave the just-reset buffer empty for that className. The fix is\n * resolver-level isolation (fresh nested Vite SSR per build) plus\n * this buffer-reset to keep concurrent captures from interleaving.\n *\n * Internal-use only — NEVER call this from a request-handling path\n * (the per-request `reset()` is the correct shape there, since the\n * request lifecycle is bounded and the styler caches should be\n * dropped wholesale).\n */\n resetSSRBuffer(): void {\n this.ssrBuffer = []\n }\n\n /** Returns collected CSS rules as a raw string (useful for streaming SSR). */\n getStyles(): string {\n if (this.ssrBuffer.length === 0) return ''\n const layerDecl = this.hasLayeredRules()\n ? '@layer elements, rocketstyle;'\n : this.layer\n ? `@layer ${this.layer};`\n : ''\n return layerDecl + this.ssrBuffer.join('')\n }\n\n /** Check if any buffered SSR rules use @layer wrapping. */\n private hasLayeredRules(): boolean {\n return this.ssrBuffer.some((r) => r.startsWith('@layer '))\n }\n\n /** Reset SSR buffer and cache (call between server requests). */\n reset(): void {\n this.ssrBuffer = []\n this.cache.clear()\n this.insertCache.clear()\n this.icKeysByClass.clear()\n this.domRules.clear()\n }\n\n /** Clear the dedup cache. Useful for HMR / dev-time reloads. */\n clearCache(): void {\n this.cache.clear()\n this.insertCache.clear()\n this.icKeysByClass.clear()\n this.domRules.clear()\n clearNormCache()\n }\n\n /**\n * Full cleanup: clear cache and remove all CSS rules from the DOM.\n * Intended for HMR / dev-time reloads where stale styles must be purged.\n *\n * Also fires `onSheetClear` subscribers so downstream caches (e.g.\n * `styled.tsx`'s static-component cache) reset alongside the sheet.\n * Without this, stale `StaticStyled` ComponentFn references survive HMR\n * and continue to apply CSS class names that were just deleted from\n * the DOM — observable as missing styles after every hot reload.\n */\n clearAll(): void {\n this.cache.clear()\n this.insertCache.clear()\n this.icKeysByClass.clear()\n this.domRules.clear()\n clearNormCache()\n this.ssrBuffer = []\n if (this.sheet) {\n while (this.sheet.cssRules.length > 0) {\n this.sheet.deleteRule(0)\n }\n }\n fireSheetClearSubscribers()\n }\n\n /**\n * Compute className and full CSS rule text without injecting.\n */\n prepare(cssText: string): { className: string; rules: string } {\n const h = hash(cssText)\n const className = `${PREFIX}-${h}`\n const selector = `.${className}`\n const { base, atRules } = this.splitAtRules(cssText, selector)\n\n const allRules: string[] = []\n if (base) allRules.push(`${selector}{${base}}`)\n allRules.push(...atRules)\n\n const finalRules = this.layer ? allRules.map((r) => `@layer ${this.layer}{${r}}`) : allRules\n\n return { className, rules: finalRules.join('') }\n }\n\n /** Check if a className is already in the cache. O(1) Map lookup. */\n has(className: string): boolean {\n return this.cache.has(className)\n }\n\n /** Current number of cached rules. */\n get cacheSize(): number {\n return this.cache.size\n }\n}\n\n/** Default singleton sheet for client-side use.\n * No default layer — each consumer specifies their own:\n * Elements use `{ layer: 'elements' }`\n * Rocketstyle uses `{ layer: 'rocketstyle' }`\n * The layer ordering `@layer elements, rocketstyle` is injected\n * in mount() so rocketstyle always overrides elements.\n */\nexport const sheet = new StyleSheet()\n\n/**\n * Factory for creating isolated StyleSheet instances.\n * Use in SSR to get per-request isolation.\n */\nexport const createSheet = (options?: StyleSheetOptions): StyleSheet => new StyleSheet(options)\n\n// ─── onSheetClear subscriber registry ─────────────────────────────────────\n//\n// Used by `styled.tsx` to reset its static-component cache when the\n// singleton sheet is cleared via `clearAll()`. Module-level Set so the\n// subscription survives between calls; ports the vitus-labs pattern from\n// `connector-styler/sheet.ts:onClear`. Scoped to the singleton sheet —\n// per-instance sheets created via `createSheet()` don't fire the hook.\nconst _sheetClearSubscribers = new Set<() => void>()\n\nconst fireSheetClearSubscribers = (): void => {\n for (const cb of _sheetClearSubscribers) cb()\n}\n\n/**\n * Subscribe to `sheet.clearAll()`. Fires after the sheet has been\n * fully cleared, so subscribers can drop downstream caches that depend\n * on the sheet's class names being live in the DOM.\n *\n * Returns a disposer for symmetry; in practice subscribers register\n * once at module load and never unsubscribe.\n */\nexport const onSheetClear = (callback: () => void): (() => void) => {\n _sheetClearSubscribers.add(callback)\n return () => _sheetClearSubscribers.delete(callback)\n}\n","/**\n * Theme context for styled components.\n *\n * Extensible theme interface. Consumers can augment this via module\n * declaration merging for full strict types:\n *\n * declare module '@pyreon/styler' {\n * interface DefaultTheme {\n * colors: { primary: string; secondary: string }\n * spacing: (n: number) => string\n * }\n * }\n */\nimport type { VNode, VNodeChild } from '@pyreon/core'\nimport { createReactiveContext, nativeCompat, provide, useContext } from '@pyreon/core'\n\nexport interface DefaultTheme {}\n\ntype Theme = DefaultTheme & Record<string, unknown>\n\n/**\n * Reactive theme context. Consumers get `() => Theme` from useContext.\n *\n * Styled components read the theme accessor inside a COMPUTED (not an\n * effect). The computed tracks theme + mode +\n * dimensions simultaneously, and the resolve itself runs untracked.\n * This gives reactive theme/mode/dimension switching with:\n * - Zero per-component effect()\n * - One lightweight computed per component\n * - String-equality memoization (same CSS class = no DOM update)\n * - Untracked resolve (no exponential cascade)\n */\nexport const ThemeContext = createReactiveContext<Theme>({} as Theme)\n\n/**\n * Read the current theme. Returns the theme value (calls the accessor).\n * Inside a reactive scope (computed/effect), this tracks theme changes.\n */\nexport const useTheme = <T extends object = Theme>(): T => useContext(ThemeContext)() as T\n\n/**\n * Returns the raw `() => Theme` accessor for use inside computeds\n * where you need explicit control over when the read happens.\n */\nexport const useThemeAccessor = <T extends object = Theme>(): (() => T) =>\n useContext(ThemeContext) as () => T\n\n/**\n * @internal Low-level provider — use `PyreonUI` from `@pyreon/ui-core` instead.\n * @deprecated Prefer `<PyreonUI theme={theme}>`\n */\nexport function ThemeProvider({\n theme,\n children,\n}: {\n theme: Theme\n children?: VNodeChild\n}): VNode | null {\n provide(ThemeContext, () => theme)\n return (children ?? null) as VNode | null\n}\n\n// Mark as native — compat-mode jsx() runtimes skip wrapCompatComponent so\n// provide(ThemeContext, ...) reaches Pyreon's setup frame.\nnativeCompat(ThemeProvider)\n","/**\n * createGlobalStyle() — tagged template function that injects global CSS\n * rules (not scoped to a class name). Returns a component function that\n * injects styles when called and supports dynamic interpolations via\n * props/theme.\n *\n * Usage:\n * const GlobalStyle = createGlobalStyle`\n * body { margin: 0; font-family: ${({ theme }) => theme.font}; }\n * *, *::before, *::after { box-sizing: border-box; }\n * `\n */\nimport type { ComponentFn } from '@pyreon/core'\nimport { type Interpolation, normalizeCSS, resolve } from './resolve'\nimport { isDynamic } from './shared'\nimport { sheet } from './sheet'\nimport { useTheme } from './ThemeProvider'\n\nexport const createGlobalStyle = (\n strings: TemplateStringsArray,\n ...values: Interpolation[]\n): ComponentFn => {\n const hasDynamicValues = values.some(isDynamic)\n\n // STATIC FAST PATH: compute once at creation time\n if (!hasDynamicValues) {\n const cssText = normalizeCSS(resolve(strings, values, {}))\n\n // Inject into sheet immediately. `normalizeCSS` already strips\n // leading/trailing whitespace, so a length check is equivalent to the\n // prior `.trim()` (no O(n) whitespace scan, no string allocation).\n // Ported from vitus-labs `be471b19`.\n if (cssText.length > 0) sheet.insertGlobal(cssText)\n\n const StaticGlobal: ComponentFn = () => null\n return StaticGlobal\n }\n\n // DYNAMIC PATH: resolve on every render with theme/props\n const DynamicGlobal: ComponentFn = (props: Record<string, any>) => {\n const theme = useTheme()\n const allProps = { ...props, theme }\n const cssText = normalizeCSS(resolve(strings, values, allProps))\n\n // Length check — `normalizeCSS` already trims. Ported from\n // vitus-labs `be471b19`.\n if (cssText.length > 0) sheet.insertGlobal(cssText)\n\n return null\n }\n\n return DynamicGlobal\n}\n","/**\n * keyframes() tagged template function. Creates a CSS @keyframes rule,\n * injects it into the stylesheet, and returns the generated animation name.\n *\n * Usage:\n * const fadeIn = keyframes`\n * from { opacity: 0; }\n * to { opacity: 1; }\n * `\n * // fadeIn === \"pyr-kf-abc123\" (deterministic, hash-based)\n */\nimport { hash } from './hash'\nimport { type Interpolation, normalizeCSS, resolve } from './resolve'\nimport { sheet } from './sheet'\n\nclass KeyframesResult {\n readonly name: string\n\n constructor(strings: TemplateStringsArray, values: Interpolation[]) {\n const body = normalizeCSS(resolve(strings, values, {}))\n const h = hash(body)\n this.name = `pyr-kf-${h}`\n\n sheet.insertKeyframes(this.name, body)\n }\n\n /** Returns the animation name when used in string context. */\n toString(): string {\n return this.name\n }\n}\n\nexport const keyframes = (\n strings: TemplateStringsArray,\n ...values: Interpolation[]\n): KeyframesResult => new KeyframesResult(strings, values)\n","/**\n * styled() component factory. Creates Pyreon components that inject CSS\n * class names from tagged template literals.\n *\n * Supports:\n * - styled('div')`...` and styled(Component)`...`\n * - styled.div`...` (via Proxy)\n * - `as` prop for polymorphic rendering\n * - $-prefixed transient props (not forwarded to DOM)\n * - Custom shouldForwardProp for per-component prop filtering\n * - Static path optimization (templates with no dynamic interpolations)\n * - Boost specificity via doubled selector\n *\n * CSS nesting (`&` selectors) works natively — the resolver passes CSS\n * through without transformation, so `&:hover`, `&::before`, etc. work\n * as-is in browsers supporting CSS Nesting (all modern browsers).\n */\nimport type { ComponentFn, Ref, VNode } from '@pyreon/core'\nimport { h } from '@pyreon/core'\nimport { computed, renderEffect, runUntracked } from '@pyreon/reactivity'\nimport { buildProps } from './forward'\nimport { type Interpolation, normalizeCSS, resolve } from './resolve'\nimport { isDynamic } from './shared'\nimport { onSheetClear, sheet } from './sheet'\nimport { useThemeAccessor } from './ThemeProvider'\n\n// Dev-time counter sink — see packages/internals/perf-harness/COUNTERS.md.\nconst _countSink = globalThis as { __pyreon_count__?: (name: string, n?: number) => void }\n\ntype Tag = string | ComponentFn<any>\n\nexport interface StyledOptions {\n /** Custom prop filter. Return true to forward the prop to the DOM element. */\n shouldForwardProp?: (prop: string) => boolean\n /**\n * CSS @layer name. Rules are wrapped in `@layer <name> { ... }`.\n * Framework CSS uses two layers with explicit ordering:\n * `@layer elements, rocketstyle;`\n * Elements (base layout) use `'elements'`, rocketstyle themes use\n * `'rocketstyle'`. The ordering ensures themes always override base\n * styles regardless of source order.\n */\n layer?: string\n}\n\nconst getDisplayName = (tag: Tag): string =>\n typeof tag === 'string'\n ? tag\n : (tag as ComponentFn<any> & { displayName?: string }).displayName || tag.name || 'Component'\n\n// Component cache: same template literal + tag + no options → same component.\n// WeakMap on `strings` (TemplateStringsArray is object-identity per source location).\n// `let` so `sheet.clearAll()` (HMR / dev reload) can drop stale entries by\n// swapping the WeakMap reference — WeakMap has no `.clear()` method, and stale\n// `StaticStyled` ComponentFns left behind would keep returning class names the\n// sheet just deleted from the DOM.\nlet staticComponentCache = new WeakMap<TemplateStringsArray, Map<Tag, ComponentFn>>()\n\n// Single-entry hot cache — 3 reference comparisons, no Map/WeakMap overhead.\n// All 3 fields move atomically (consolidated into one object so `clearAll`\n// resets them together — pre-fix, partial state was possible if a reset\n// path forgot one field).\nconst _hotCache: {\n strings: TemplateStringsArray | null\n tag: Tag | null\n component: ComponentFn | null\n} = { strings: null, tag: null, component: null }\n\n// Subscribe to `sheet.clearAll()` (HMR / dev-time reset). Drops both the\n// WeakMap and the hot-cache slots so subsequent `styled()` calls produce\n// fresh components with up-to-date class names. Static class names emitted\n// before `clearAll` are stale by the time the user observes them — the rule\n// they pointed at has been deleted from the DOM.\nonSheetClear(() => {\n staticComponentCache = new WeakMap()\n _hotCache.strings = null\n _hotCache.tag = null\n _hotCache.component = null\n})\n\nconst createStyledComponent = (\n tag: Tag,\n strings: TemplateStringsArray,\n values: Interpolation[],\n options?: StyledOptions,\n): ComponentFn => {\n // Ultra-fast hot cache: 3 reference comparisons → return immediately\n if (values.length === 0 && !options) {\n if (strings === _hotCache.strings && tag === _hotCache.tag)\n return _hotCache.component as ComponentFn\n\n // WeakMap fallback for alternating patterns\n const tagMap = staticComponentCache.get(strings)\n if (tagMap) {\n const cached = tagMap.get(tag)\n if (cached) {\n _hotCache.strings = strings\n _hotCache.tag = tag\n _hotCache.component = cached\n return cached\n }\n }\n }\n\n // Fast check: no values means no dynamic interpolations — avoids .some() scan\n const hasDynamicValues = values.length > 0 && values.some(isDynamic)\n const customFilter = options ? options.shouldForwardProp : undefined\n const insertLayer = options?.layer\n\n // STATIC FAST PATH: no function interpolations → compute class once at creation time\n if (!hasDynamicValues) {\n // Inline resolve for the common no-values case\n const raw = values.length === 0 ? (strings[0] as string) : resolve(strings, values, {})\n const cssText = normalizeCSS(raw)\n const hasCss = cssText.length > 0\n\n const staticClassName = hasCss ? sheet.insert(cssText, false, insertLayer) : ''\n\n // Hoisted out of the render fn: `tag` is known at component-creation time,\n // and `tag` matches `rawProps.as ?? tag` whenever rawProps is empty (the\n // common case for `<MyStyled />` without any props). The DOM-ness check\n // doesn't change between renders for the same `tag`.\n const tagIsDOM = typeof tag === 'string'\n\n // Pre-built VNode for the no-extra-props hot path (`<MyStyled />`). Same\n // shape `h(tag, { class })` would produce per render, but allocated once\n // at component-creation time. Mount.ts spreads `vnode.props` into a new\n // object before invoking the component (mount.ts:404-418 doesn't mutate\n // the source vnode), so sharing the same VNode across mount sites is\n // safe. `vnode.children` is empty here because the empty-rawProps branch\n // also implies no children were passed — `rawProps.children` would be\n // `undefined` and the `Array.isArray ? : ?? : []` chain produces `[]`.\n //\n // **Cache lifetime**: this VNode references `staticClassName`, which is\n // the className the sheet just inserted. If `sheet.clearAll()` runs\n // (HMR / dev reload), the className becomes stale BUT the outer\n // `staticComponentCache` (and `_hot*` caches) ALSO survive that path —\n // so consumers continue to receive the stale className regardless. The\n // companion fix to wire `onSheetClear` and reset both caches is tracked\n // separately. This optimization is correct under the existing cache\n // lifetime contract; the HMR-staleness issue is broader than the VNode\n // cache.\n const cachedEmptyVNode = h(\n tag as string,\n staticClassName ? { class: staticClassName } : {},\n )\n\n const StaticStyled: ComponentFn = (rawProps: Record<string, any>): VNode | null => {\n // Hot path: no extra props beyond what's empty AND no `ref` / `as`.\n // `for ... in` over an empty object is O(0); the `break` exits on the\n // first key. Skipping the cache when `ref` is present is necessary\n // because the user expects their callback to fire on the mounted DOM\n // node — the pre-built VNode has no `ref` in its props.\n let hasExtraProps = false\n for (const _k in rawProps) {\n hasExtraProps = true\n break\n }\n if (!hasExtraProps && rawProps.ref == null) {\n if (process.env.NODE_ENV !== 'production')\n _countSink.__pyreon_count__?.('styler.staticVNode.hit')\n return cachedEmptyVNode\n }\n\n const finalTag = rawProps.as || tag\n // Fast `isDOM` when the user didn't pass `as` — reuses the closure-time\n // check. Only `typeof` is needed when `as` overrides the tag.\n const isDOM = finalTag === tag ? tagIsDOM : typeof finalTag === 'string'\n const finalProps = buildProps(rawProps, staticClassName, isDOM, customFilter)\n\n return h(\n finalTag as string,\n finalProps,\n ...(Array.isArray(rawProps.children)\n ? rawProps.children\n : rawProps.children != null\n ? [rawProps.children]\n : []),\n )\n }\n\n ;(StaticStyled as ComponentFn & { displayName?: string }).displayName =\n `styled(${getDisplayName(tag)})`\n\n // Store in component cache + hot cache for future reuse\n if (!options && values.length === 0) {\n let tagMap = staticComponentCache.get(strings)\n if (!tagMap) {\n tagMap = new Map()\n staticComponentCache.set(strings, tagMap)\n }\n tagMap.set(tag, StaticStyled)\n _hotCache.strings = strings\n _hotCache.tag = tag\n _hotCache.component = StaticStyled\n }\n\n return StaticStyled\n }\n\n // ─── Tier 2: Per-definition class cache ───────────────────────────────────\n // Two-level WeakMap: $rocketstyle → $rocketstate → className.\n // 50 identical Items with the same resolved theme → 1 resolve + 49 hits.\n const classCache = new WeakMap<object, WeakMap<object, string>>()\n // Single-key cache for non-rocketstyle styled components (e.g. Element's\n // Wrapper, which depends on `$element` + `$childFix`). The key is the\n // `$element` object identity; `$childFix` is folded into a `Map<bool,\n // string>` per `$element` to avoid wrong-cache hits when childFix differs.\n // Element-layer interning (see `@pyreon/elements` Element/component.tsx)\n // gives `$element` stable identity across mounts, which is what makes this\n // cache fire — analogous to rocketstyle's dimension-prop memo.\n const elClassCache = new WeakMap<object, Map<unknown, string>>()\n\n // DYNAMIC PATH: uses computed() for reactive class derivation.\n //\n // Architecture:\n // - $rocketstyle/$rocketstate may be function ACCESSORS (from rocketstyle)\n // or plain objects (from direct styled() usage).\n // - When they're accessors, a computed() tracks them so mode/dimension\n // signal changes produce a new CSS class reactively.\n // - The resolve() itself runs UNTRACKED inside the computed to prevent\n // exponential cascade from theme deep-reads in interpolation functions.\n // - The computed memoizes by string equality — same CSS class = no DOM update.\n // - Pyreon's built-in renderEffect handles the DOM class attribute update\n // when the computed value changes.\n //\n // This gives reactive mode/dimension switching WITHOUT per-component effect().\n const DynamicStyled: ComponentFn = (rawProps: Record<string, any>): VNode | null => {\n const themeAccessor = useThemeAccessor()\n const theme = themeAccessor() // snapshot for initial + static path\n const $rs = rawProps.$rocketstyle\n const $rsState = rawProps.$rocketstate\n const isReactiveRS = typeof $rs === 'function'\n const isReactiveState = typeof $rsState === 'function'\n\n // Helper: resolve CSS + cache result.\n // `rs` and `rsState` are opaque from styler's perspective (the styler can't\n // import rocketstyle types — that would be a circular dep). The body\n // narrows them via `typeof === 'object'` guards before using as WeakMap\n // keys. `t` is the resolved theme object — opaque shape from styler's\n // perspective (consumers augment `DefaultTheme` via declaration merging).\n const doResolve = (rs: unknown, rsState: unknown, t: unknown): string => {\n // Tier 2 cache: skip resolve if same object identity seen before\n if (rs && typeof rs === 'object' && rsState && typeof rsState === 'object') {\n const inner = classCache.get(rs)\n if (inner) {\n const cached = inner.get(rsState)\n if (cached !== undefined) return cached\n }\n }\n\n // Element-layer cache (no rocketstyle props, but $element is present\n // and an object). Fires only when the rocketstyle path didn't apply\n // — they're mutually exclusive in practice.\n const $el = rawProps.$element\n const $childFix = rawProps.$childFix\n const useElCache =\n (!rs || typeof rs !== 'object' || !rsState || typeof rsState !== 'object') &&\n $el &&\n typeof $el === 'object'\n if (useElCache) {\n const inner = elClassCache.get($el as object)\n if (inner) {\n const cached = inner.get($childFix)\n if (cached !== undefined) {\n if (process.env.NODE_ENV !== 'production')\n _countSink.__pyreon_count__?.('styler.elClassCache.hit')\n return cached\n }\n }\n }\n\n const resolveProps = {\n ...rawProps,\n ...(isReactiveRS ? { $rocketstyle: rs } : {}),\n ...(isReactiveState ? { $rocketstate: rsState } : {}),\n theme: t,\n }\n const cssText = normalizeCSS(resolve(strings, values, resolveProps))\n const className = cssText.length > 0 ? sheet.insert(cssText, false, insertLayer) : ''\n\n if (rs && typeof rs === 'object' && rsState && typeof rsState === 'object') {\n let inner = classCache.get(rs)\n if (!inner) {\n inner = new WeakMap()\n classCache.set(rs, inner)\n }\n inner.set(rsState, className)\n } else if (useElCache) {\n let inner = elClassCache.get($el as object)\n if (!inner) {\n inner = new Map()\n elClassCache.set($el as object, inner)\n }\n inner.set($childFix, className)\n }\n return className\n }\n\n // If any axis is reactive, wrap in computed that tracks all three:\n // 1. $rocketstyle accessor (mode + dimension signals)\n // 2. $rocketstate accessor (state descriptor)\n // 3. themeAccessor (user-preference theme swap)\n // The resolve itself runs UNTRACKED to prevent exponential cascade.\n const hasReactive = isReactiveRS || isReactiveState\n const cssClass = hasReactive\n ? computed(() => {\n // TRACKED reads:\n const rs = isReactiveRS ? $rs() : $rs\n const rsState = isReactiveState ? $rsState() : $rsState\n const t = themeAccessor() // TRACKED — theme swap\n\n // UNTRACKED: resolve + sheet insert\n return runUntracked(() => doResolve(rs, rsState, t))\n }, { equals: (a, b) => a === b })\n : null\n\n const finalTag = rawProps.as || tag\n const isDOM = typeof finalTag === 'string'\n\n // Initial class: computed (reactive) or direct resolve (static)\n const className = cssClass\n ? cssClass()\n : doResolve($rs, $rsState, theme)\n const finalProps = buildProps(rawProps, className, isDOM, customFilter)\n\n // Reactive path: lightweight renderEffect that reads the pre-computed\n // class string and toggles classList. The expensive resolve() already\n // happened inside the computed — this renderEffect only does: read\n // string → compare → toggle.\n if (cssClass) {\n let el: Element | null = null\n let currentClassName = className\n\n const originalRef = finalProps.ref\n finalProps.ref = (node: Element | null) => {\n el = node\n if (originalRef) {\n if (typeof originalRef === 'function') originalRef(node)\n else if (typeof originalRef === 'object') (originalRef as Ref<Element>).current = node\n }\n }\n\n renderEffect(() => {\n const newClass = cssClass() // reads computed — O(1), just string\n if (el && newClass !== currentClassName) {\n if (currentClassName) el.classList.remove(currentClassName)\n if (newClass) el.classList.add(newClass)\n currentClassName = newClass\n }\n })\n }\n\n return h(\n finalTag as string,\n finalProps,\n ...(Array.isArray(rawProps.children)\n ? rawProps.children\n : rawProps.children != null\n ? [rawProps.children]\n : []),\n )\n }\n\n ;(DynamicStyled as ComponentFn & { displayName?: string }).displayName =\n `styled(${getDisplayName(tag)})`\n return DynamicStyled\n}\n\n/** Factory function: styled(tag) returns a tagged template function. */\nconst styledFactory = (tag: Tag, options?: StyledOptions) => {\n const templateFn = (strings: TemplateStringsArray, ...values: Interpolation[]) =>\n createStyledComponent(tag, strings, values, options)\n\n return templateFn\n}\n\n/**\n * Main styled export. Supports both calling conventions:\n * - `styled('div')` or `styled(Component)` → returns tagged template function\n * - `styled('div', { shouldForwardProp })` → with custom prop filtering\n * - `styled.div` → shorthand via Proxy (no options)\n */\n// Cache template functions per tag to avoid closure allocation on every Proxy get\nconst proxyCache = new Map<string, TagTemplateFn>()\n\n/**\n * Generic tagged template function returned by `styled(tag)` and `styled.tag`.\n *\n * Accepts an optional type parameter `<P>` for consumer-defined props\n * (typically transient $-prefixed props that aren't forwarded to the DOM).\n *\n * @example\n * const Box = styled('div')<{ $color: string }>`\n * background: ${(props) => props.$color};\n * `\n * <Box $color=\"red\" /> // $color is required and typed\n */\ntype TagTemplateFn = <P extends object = Record<string, unknown>>(\n strings: TemplateStringsArray,\n ...values: Interpolation<P>[]\n) => ComponentFn<P & Record<string, unknown>>\n\ntype HtmlTags =\n | 'a'\n | 'abbr'\n | 'address'\n | 'article'\n | 'aside'\n | 'audio'\n | 'b'\n | 'blockquote'\n | 'body'\n | 'br'\n | 'button'\n | 'canvas'\n | 'caption'\n | 'code'\n | 'col'\n | 'colgroup'\n | 'dd'\n | 'details'\n | 'div'\n | 'dl'\n | 'dt'\n | 'em'\n | 'fieldset'\n | 'figcaption'\n | 'figure'\n | 'footer'\n | 'form'\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'\n | 'head'\n | 'header'\n | 'hr'\n | 'html'\n | 'i'\n | 'iframe'\n | 'img'\n | 'input'\n | 'label'\n | 'legend'\n | 'li'\n | 'link'\n | 'main'\n | 'mark'\n | 'menu'\n | 'meta'\n | 'nav'\n | 'ol'\n | 'optgroup'\n | 'option'\n | 'output'\n | 'p'\n | 'picture'\n | 'pre'\n | 'progress'\n | 'q'\n | 'section'\n | 'select'\n | 'small'\n | 'source'\n | 'span'\n | 'strong'\n | 'style'\n | 'sub'\n | 'summary'\n | 'sup'\n | 'svg'\n | 'table'\n | 'tbody'\n | 'td'\n | 'template'\n | 'textarea'\n | 'tfoot'\n | 'th'\n | 'thead'\n | 'time'\n | 'tr'\n | 'u'\n | 'ul'\n | 'video'\n\nexport type StyledFunction = ((tag: Tag, options?: StyledOptions) => TagTemplateFn) & {\n [K in HtmlTags]: TagTemplateFn\n}\n\n// Proxy is needed to support styled.div`...` syntax; the cast bridges\n// styledFactory's call signature to StyledFunction which adds HTML tag properties.\n// Proxy target uses `as any` because TS can't resolve Proxy<StyledFunction> with mapped types\nexport const styled: StyledFunction = new Proxy(styledFactory as any, {\n get(_target: unknown, prop: string) {\n if (prop === 'prototype' || prop === '$$typeof') return undefined\n // styled.div`...`, styled.span`...`, etc.\n let fn = proxyCache.get(prop)\n if (!fn) {\n // The arrow's `Interpolation[]` arg shape can't be expressed as the\n // generic `<P>(strings, ...values: Interpolation<P>[])` of TagTemplateFn\n // (no generic arrow inside a Proxy handler), but the call signature is\n // structurally compatible — the inner `createStyledComponent` accepts\n // any-P interpolations. Cast bridges the variance at the assignment.\n fn = ((strings: TemplateStringsArray, ...values: Interpolation[]) =>\n createStyledComponent(prop, strings, values)) as TagTemplateFn\n proxyCache.set(prop, fn)\n }\n return fn\n },\n})\n","/**\n * Hook that resolves a CSSResult template with props, injects CSS\n * into the shared stylesheet, and returns the className.\n *\n * Use this when you need computed CSS class names on plain elements\n * without the overhead of a styled component layer.\n */\nimport { type CSSResult, normalizeCSS, resolve } from './resolve'\nimport { sheet } from './sheet'\nimport { useTheme } from './ThemeProvider'\n\nexport function useCSS(template: CSSResult, props?: Record<string, any>, boost?: boolean): string {\n const theme = useTheme()\n const allProps = theme ? { ...props, theme } : (props ?? {})\n const cssText = normalizeCSS(resolve(template.strings, template.values, allProps))\n\n if (!cssText.trim()) return ''\n\n return sheet.insert(cssText, boost)\n}\n","import { registerSingleton } from '@pyreon/reactivity'\n\n// Singleton sentinel — fail-loud detection of duplicate @pyreon/styler\n// instances in the same heap. See @pyreon/reactivity/singleton-sentinel for\n// full rationale. Hardcoded version is acceptable here — it's a diagnostic\n// aid, not a load-bearing identity check.\nregisterSingleton('@pyreon/styler', '0.24.6', import.meta.url)\n\nexport { css } from './css'\nexport { buildProps, filterProps } from './forward'\nexport { createGlobalStyle } from './globalStyle'\nexport { HASH_INIT, hash, hashFinalize, hashUpdate } from './hash'\nexport { keyframes } from './keyframes'\nexport type { CSSResult, Interpolation } from './resolve'\nexport { clearNormCache, normalizeCSS, resolve, resolveValue } from './resolve'\nexport { isDynamic } from './shared'\nexport type { StyleSheetOptions } from './sheet'\nexport { createSheet, StyleSheet, sheet } from './sheet'\nexport type { StyledFunction, StyledOptions } from './styled'\nexport { styled } from './styled'\nexport type { DefaultTheme } from './ThemeProvider'\nexport { ThemeContext, ThemeProvider, useTheme, useThemeAccessor } from './ThemeProvider'\nexport { useCSS } from './useCSS'\n"],"mappings":";;;;AAWA,MAAMA,eAAa;;;;;;AA8BnB,IAAa,YAAb,MAAuB;CAyBV;CACA;;;;;;;;;CAjBX,aAAkC;;;;;;;;;;;;CAalC,kBAAsC;CAEtC,YACE,AAAS,SACT,AAAS,QACT;EAFS;EACA;CACR;;CAGH,WAAmB;EACjB,OAAO,QAAQ,KAAK,SAAS,KAAK,Q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SAAS,MAAM;;;;;;;;;ACE/B,MAAM,kBAAkB;CAEtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAKA,MAAM,aAAmC,OAAO,OAAO,IAAI;AAC3D,KAAK,MAAM,KAAK,iBAAiB,WAAW,KAAK;;;;;AAMjD,MAAa,eAAe,UAA4D;CACtF,MAAM,WAAoC,CAAC;CAE3C,KAAK,MAAM,OAAO,OAAO;EAEvB,IAAI,IAAI,WAAW,CAAC,MAAM,IAAI;EAG9B,IAAI,QAAQ,MAAM;EAGlB,IAAI,IAAI,WAAW,OAAO,KAAK,IAAI,WAAW,OAAO,GAAG;GACtD,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ACF;CAEC,AAAC,cAAyD,cACzD,UAAU,eAAe,GAAG,EAAE;CAChC,OAAO;AACT;;AAGA,MAAM,iBAAiB,KAAU,YAA4B;CAC3D,MAAM,cAAc,SAA+B,GAAG,WACpD,sBAAsB,KAAK,SAAS,QAAQ,OAAO;CAErD,OAAO;AACT;;;;;;;AASA,MAAM,6BAAa,IAAI,IAA2B;AA+GlD,MAAa,SAAyB,IAAI,MAAM,eAAsB,EACpE,IAAI,SAAkB,MAAc;CAClC,IAAI,SAAS,eAAe,SAAS,YAAY,OAAO;CAExD,IAAI,KAAK,WAAW,IAAI,IAAI;CAC5B,IAAI,CAAC,IAAI;EAMP,OAAO,SAA+B,GAAG,WACvC,sBAAsB,MAAM,SAAS,MAAM;EAC7C,WAAW,IAAI,MAAM,EAAE;CACzB;CACA,OAAO;AACT,EACF,CAAC;;;;;;;;;;;ACrfD,SAAgB,OAAO,UAAqB,OAA6B,OAAyB;CAChG,MAAM,QAAQ,SAAS;CACvB,MAAM,WAAW,QAAQ;EAAE,GAAG;EAAO;CAAM,IAAK,SAAS,CAAC;CAC1D,MAAM,UAAU,aAAa,QAAQ,SAAS,SAAS,SAAS,QAAQ,QAAQ,CAAC;CAEjF,IAAI,CAAC,QAAQ,KAAK,GAAG,OAAO;CAE5B,OAAO,MAAM,OAAO,SAAS,KAAK;AACpC;;;;ACbA,kBAAkB,kBAAkB,UAAU,OAAO,KAAK,GAAG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pyreon/styler",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.2",
|
|
4
4
|
"description": "Lightweight CSS-in-JS engine for Pyreon",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@pyreon/manifest": "0.13.1",
|
|
43
43
|
"@pyreon/test-utils": "^0.13.13",
|
|
44
|
-
"@pyreon/typescript": "^0.26.
|
|
44
|
+
"@pyreon/typescript": "^0.26.2",
|
|
45
45
|
"@pyreon/vitest-config": "0.13.1",
|
|
46
46
|
"@vitest/browser-playwright": "^4.1.7",
|
|
47
47
|
"@vitus-labs/tools-rolldown": "^2.5.0"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"node": ">= 22"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@pyreon/core": "^0.26.
|
|
54
|
-
"@pyreon/reactivity": "^0.26.
|
|
53
|
+
"@pyreon/core": "^0.26.2",
|
|
54
|
+
"@pyreon/reactivity": "^0.26.2"
|
|
55
55
|
}
|
|
56
56
|
}
|