@pyreon/styler 0.34.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +3 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +52 -6
- package/lib/index.js.map +1 -1
- package/package.json +5 -5
package/lib/index.d.ts
CHANGED
|
@@ -385,6 +385,8 @@ declare const sheet: StyleSheet;
|
|
|
385
385
|
declare const createSheet: (options?: StyleSheetOptions) => StyleSheet;
|
|
386
386
|
//#endregion
|
|
387
387
|
//#region src/styled.d.ts
|
|
388
|
+
/** @internal Wired by `@pyreon/ui-core` `init({ styleExtraction })`. */
|
|
389
|
+
declare const setStyleExtraction: (enabled: boolean, rewrite?: (cssText: string, varsOut: Record<string, string>) => string) => void;
|
|
388
390
|
type Tag = string | ComponentFn<any>;
|
|
389
391
|
interface StyledOptions {
|
|
390
392
|
/** Custom prop filter. Return true to forward the prop to the DOM element. */
|
|
@@ -419,5 +421,5 @@ declare const styled: StyledFunction;
|
|
|
419
421
|
//#region src/useCSS.d.ts
|
|
420
422
|
declare function useCSS(template: CSSResult, props?: Record<string, any>, boost?: boolean): string;
|
|
421
423
|
//#endregion
|
|
422
|
-
export { type CSSResult, type DefaultTheme, HASH_INIT, type Interpolation, StyleSheet, type StyleSheetOptions, type StyledFunction, type StyledOptions, ThemeContext, ThemeProvider, buildProps, clearNormCache, createGlobalStyle, createSheet, css, filterProps, hash, hashFinalize, hashUpdate, isDynamic, keyframes, normalizeCSS, resolve, resolveValue, sheet, styled, useCSS, useTheme, useThemeAccessor };
|
|
424
|
+
export { type CSSResult, type DefaultTheme, HASH_INIT, type Interpolation, StyleSheet, type StyleSheetOptions, type StyledFunction, type StyledOptions, ThemeContext, ThemeProvider, buildProps, clearNormCache, createGlobalStyle, createSheet, css, filterProps, hash, hashFinalize, hashUpdate, isDynamic, keyframes, normalizeCSS, resolve, resolveValue, setStyleExtraction, sheet, styled, useCSS, useTheme, useThemeAccessor };
|
|
423
425
|
//# sourceMappingURL=index2.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index2.d.ts","names":[],"sources":["../../src/ThemeProvider.ts","../../src/resolve.ts","../../src/css.ts","../../src/forward.ts","../../src/globalStyle.ts","../../src/hash.ts","../../src/keyframes.ts","../../src/shared.ts","../../src/sheet.ts","../../src/styled.tsx","../../src/useCSS.ts"],"mappings":";;;UAgBiB,YAAA;AAAA,KAEZ,KAAA,GAAQ,YAAA,GAAe,MAAM;AAcT;AAMzB;;;;;;;;AAA0F;AAM1F;;AAZyB,cAAZ,YAAA,yBAAY,eAAA,CAAA,KAAA;;;;;cAMZ,QAAA,sBAA+B,KAAA,OAAU,CAAoC;AAMpB;AAOtE;;;AAPsE,cAAzD,gBAAA,sBAAuC,KAAA,cAAiB,CAAC;;;;;iBAOtD,aAAA
|
|
1
|
+
{"version":3,"file":"index2.d.ts","names":[],"sources":["../../src/ThemeProvider.ts","../../src/resolve.ts","../../src/css.ts","../../src/forward.ts","../../src/globalStyle.ts","../../src/hash.ts","../../src/keyframes.ts","../../src/shared.ts","../../src/sheet.ts","../../src/styled.tsx","../../src/useCSS.ts"],"mappings":";;;UAgBiB,YAAA;AAAA,KAEZ,KAAA,GAAQ,YAAA,GAAe,MAAM;AAcT;AAMzB;;;;;;;;AAA0F;AAM1F;;AAZyB,cAAZ,YAAA,yBAAY,eAAA,CAAA,KAAA;;;;;cAMZ,QAAA,sBAA+B,KAAA,OAAU,CAAoC;AAMpB;AAOtE;;;AAPsE,cAAzD,gBAAA,sBAAuC,KAAA,cAAiB,CAAC;;;;;iBAOtD,aAAA;EACd,KAAA;EACA;AAAA;EAEA,KAAA,EAAO,KAAA;EACP,QAAA,GAAW,UAAA;AAAA,IACT,KAAA;;;;AAzCyB;AAAG;;;;AAEE;AAclC;;KCVY,WAAA,oBAA+B,MAAA,qBAA2B,CAAA;EACpE,KAAA,GAAQ,YA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;ACpL7E;;;;;;;;;EM0mBE,eAAA;EN1mBoD;EMioBpD,SAAA;ENjoB8E;EAAA,QM4oBtE,eAAA;EN3oBsB;EMgpB9B,KAAA;;EAUA,UAAA;ELndW;;;;;;;;AAAsD;AAuCnE;EK8bE,QAAA;;;;EAmBA,OAAA,CAAQ,OAAA;IAAoB,SAAA;IAAmB,KAAA;EAAA;EL7c/C;EK6dA,GAAA,CAAI,SAAA;EL5dG;EAAA,IKieH,SAAA;AAAA;;;AJ9sBN;;;;;cI0tBa,KAAA,EAAK,UAAmB;;;;;cAMxB,WAAA,GAAe,OAAA,GAAU,iBAAA,KAAoB,UAAqC;;;;cCprBlF,kBAAA,GACX,OAAA,WACA,OAAA,IAAW,OAAA,UAAiB,OAAA,EAAS,MAAM;AAAA,KAyBxC,GAAA,YAAe,WAAW;AAAA,UAEd,aAAA;ETrD2B;ESuD1C,iBAAA,IAAqB,IAAA;ETvDmE;AAAA;AAM1F;;;;;;ES0DE,KAAA;AAAA;AT1DoE;AAOtE;;;;;;;;;;;AAPsE,KSifjE,aAAA,uBAAoC,MAAA,mBACvC,OAAA,EAAS,oBAAA,KACN,MAAA,EAAQ,aAAA,CAAc,CAAA,QACtB,WAAA,CAAY,CAAA,GAAI,MAAA;AAAA,KAEhB,QAAA;AAAA,KAqFO,cAAA,KAAmB,GAAA,EAAK,GAAA,EAAK,OAAA,GAAU,aAAA,KAAkB,aAAA,YAC7D,QAAA,GAAW,aAAA;AAAA,cAMN,MAAA,EAAQ,cAiBnB;;;iBCpoBc,MAAA,CAAO,QAAA,EAAU,SAAA,EAAW,KAAA,GAAQ,MAAM,eAAe,KAAA"}
|
package/lib/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createReactiveContext, h, nativeCompat, provide, useContext } from "@py
|
|
|
3
3
|
|
|
4
4
|
//#region package.json
|
|
5
5
|
var name = "@pyreon/styler";
|
|
6
|
-
var version = "0.
|
|
6
|
+
var version = "0.35.0";
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/resolve.ts
|
|
@@ -1103,6 +1103,35 @@ const keyframes = (strings, ...values) => new KeyframesResult(strings, values);
|
|
|
1103
1103
|
//#endregion
|
|
1104
1104
|
//#region src/styled.tsx
|
|
1105
1105
|
const _countSink = globalThis;
|
|
1106
|
+
function aliasInnerRef(rawProps) {
|
|
1107
|
+
if (rawProps.innerRef == null || rawProps.ref != null) return rawProps;
|
|
1108
|
+
const descs = Object.getOwnPropertyDescriptors(rawProps);
|
|
1109
|
+
descs.ref = descs.innerRef;
|
|
1110
|
+
delete descs.innerRef;
|
|
1111
|
+
return Object.defineProperties({}, descs);
|
|
1112
|
+
}
|
|
1113
|
+
let _cpseEnabled = false;
|
|
1114
|
+
let _cpseRewrite = null;
|
|
1115
|
+
/** @internal Wired by `@pyreon/ui-core` `init({ styleExtraction })`. */
|
|
1116
|
+
const setStyleExtraction = (enabled, rewrite) => {
|
|
1117
|
+
_cpseEnabled = enabled;
|
|
1118
|
+
if (rewrite) _cpseRewrite = rewrite;
|
|
1119
|
+
};
|
|
1120
|
+
const cpseVarsCache = /* @__PURE__ */ new WeakMap();
|
|
1121
|
+
/** Merge CPSE custom-property vars into a finalProps `style` (object | string | absent). */
|
|
1122
|
+
const mergeCpseStyle = (finalProps, vars) => {
|
|
1123
|
+
const existing = finalProps.style;
|
|
1124
|
+
if (existing == null) finalProps.style = vars;
|
|
1125
|
+
else if (typeof existing === "string") {
|
|
1126
|
+
let s = existing.trim();
|
|
1127
|
+
if (s && !s.endsWith(";")) s += ";";
|
|
1128
|
+
for (const k in vars) s += `${k}:${vars[k]};`;
|
|
1129
|
+
finalProps.style = s;
|
|
1130
|
+
} else if (typeof existing === "object") finalProps.style = {
|
|
1131
|
+
...existing,
|
|
1132
|
+
...vars
|
|
1133
|
+
};
|
|
1134
|
+
};
|
|
1106
1135
|
const getDisplayName = (tag) => typeof tag === "string" ? tag : tag.displayName || tag.name || "Component";
|
|
1107
1136
|
const IS_SERVER = isServer;
|
|
1108
1137
|
let staticComponentCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -1139,7 +1168,8 @@ const createStyledComponent = (tag, strings, values, options) => {
|
|
|
1139
1168
|
const staticClassName = cssText.length > 0 ? sheet.insert(cssText, false, insertLayer) : "";
|
|
1140
1169
|
const tagIsDOM = typeof tag === "string";
|
|
1141
1170
|
const cachedEmptyVNode = h(tag, staticClassName ? { class: staticClassName } : {});
|
|
1142
|
-
const StaticStyled = (
|
|
1171
|
+
const StaticStyled = (rawPropsIn) => {
|
|
1172
|
+
const rawProps = aliasInnerRef(rawPropsIn);
|
|
1143
1173
|
let hasExtraProps = false;
|
|
1144
1174
|
for (const _k in rawProps) {
|
|
1145
1175
|
hasExtraProps = true;
|
|
@@ -1168,14 +1198,17 @@ const createStyledComponent = (tag, strings, values, options) => {
|
|
|
1168
1198
|
}
|
|
1169
1199
|
const classCache = /* @__PURE__ */ new WeakMap();
|
|
1170
1200
|
const elClassCache = /* @__PURE__ */ new WeakMap();
|
|
1171
|
-
const DynamicStyled = (
|
|
1201
|
+
const DynamicStyled = (rawPropsIn) => {
|
|
1202
|
+
const rawProps = aliasInnerRef(rawPropsIn);
|
|
1172
1203
|
const themeAccessor = useThemeAccessor();
|
|
1173
1204
|
const theme = themeAccessor();
|
|
1174
1205
|
const $rs = rawProps.$rocketstyle;
|
|
1175
1206
|
const $rsState = rawProps.$rocketstate;
|
|
1176
1207
|
const isReactiveRS = typeof $rs === "function";
|
|
1177
1208
|
const isReactiveState = typeof $rsState === "function";
|
|
1209
|
+
let pendingCpseVars = null;
|
|
1178
1210
|
const doResolve = (rs, rsState, t) => {
|
|
1211
|
+
pendingCpseVars = null;
|
|
1179
1212
|
if (rs && typeof rs === "object" && rsState && typeof rsState === "object") {
|
|
1180
1213
|
const inner = classCache.get(rs);
|
|
1181
1214
|
if (inner) {
|
|
@@ -1192,16 +1225,26 @@ const createStyledComponent = (tag, strings, values, options) => {
|
|
|
1192
1225
|
const cached = inner.get($childFix);
|
|
1193
1226
|
if (cached !== void 0) {
|
|
1194
1227
|
if (process.env.NODE_ENV !== "production") _countSink.__pyreon_count__?.("styler.elClassCache.hit");
|
|
1228
|
+
if (_cpseEnabled) pendingCpseVars = cpseVarsCache.get($el) ?? null;
|
|
1195
1229
|
return cached;
|
|
1196
1230
|
}
|
|
1197
1231
|
}
|
|
1198
1232
|
}
|
|
1199
|
-
|
|
1233
|
+
let cssText = normalizeCSS(resolve(strings, values, {
|
|
1200
1234
|
...rawProps,
|
|
1201
1235
|
...isReactiveRS ? { $rocketstyle: rs } : {},
|
|
1202
1236
|
...isReactiveState ? { $rocketstate: rsState } : {},
|
|
1203
1237
|
theme: t
|
|
1204
1238
|
}));
|
|
1239
|
+
if (_cpseEnabled && _cpseRewrite && !(rs && typeof rs === "object" && rsState && typeof rsState === "object")) {
|
|
1240
|
+
const vars = {};
|
|
1241
|
+
const agnostic = _cpseRewrite(cssText, vars);
|
|
1242
|
+
if (Object.keys(vars).length > 0) {
|
|
1243
|
+
cssText = agnostic;
|
|
1244
|
+
pendingCpseVars = vars;
|
|
1245
|
+
if (useElCache) cpseVarsCache.set($el, vars);
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1205
1248
|
const className = cssText.length > 0 ? sheet.insert(cssText, false, insertLayer) : "";
|
|
1206
1249
|
if (rs && typeof rs === "object" && rsState && typeof rsState === "object") {
|
|
1207
1250
|
let inner = classCache.get(rs);
|
|
@@ -1222,7 +1265,9 @@ const createStyledComponent = (tag, strings, values, options) => {
|
|
|
1222
1265
|
};
|
|
1223
1266
|
if (IS_SERVER) {
|
|
1224
1267
|
const finalTag = rawProps.as || tag;
|
|
1225
|
-
|
|
1268
|
+
const finalProps = buildProps(rawProps, runUntracked(() => doResolve(isReactiveRS ? $rs() : $rs, isReactiveState ? $rsState() : $rsState, theme)), typeof finalTag === "string", customFilter);
|
|
1269
|
+
if (pendingCpseVars) mergeCpseStyle(finalProps, pendingCpseVars);
|
|
1270
|
+
return h(finalTag, finalProps, ...Array.isArray(rawProps.children) ? rawProps.children : rawProps.children != null ? [rawProps.children] : []);
|
|
1226
1271
|
}
|
|
1227
1272
|
const cssClass = isReactiveRS || isReactiveState ? computed(() => {
|
|
1228
1273
|
const rs = isReactiveRS ? $rs() : $rs;
|
|
@@ -1234,6 +1279,7 @@ const createStyledComponent = (tag, strings, values, options) => {
|
|
|
1234
1279
|
const isDOM = typeof finalTag === "string";
|
|
1235
1280
|
const className = cssClass ? cssClass() : doResolve($rs, $rsState, theme);
|
|
1236
1281
|
const finalProps = buildProps(rawProps, className, isDOM, customFilter);
|
|
1282
|
+
if (!cssClass && pendingCpseVars) mergeCpseStyle(finalProps, pendingCpseVars);
|
|
1237
1283
|
if (cssClass) {
|
|
1238
1284
|
let el = null;
|
|
1239
1285
|
let currentClassName = className;
|
|
@@ -1307,5 +1353,5 @@ function useCSS(template, props, boost) {
|
|
|
1307
1353
|
registerSingleton(name, version, import.meta.url);
|
|
1308
1354
|
|
|
1309
1355
|
//#endregion
|
|
1310
|
-
export { HASH_INIT, StyleSheet, ThemeContext, ThemeProvider, buildProps, clearNormCache, createGlobalStyle, createSheet, css, filterProps, hash, hashFinalize, hashUpdate, isDynamic, keyframes, normalizeCSS, resolve, resolveValue, sheet, styled, useCSS, useTheme, useThemeAccessor };
|
|
1356
|
+
export { HASH_INIT, StyleSheet, ThemeContext, ThemeProvider, buildProps, clearNormCache, createGlobalStyle, createSheet, css, filterProps, hash, hashFinalize, hashUpdate, isDynamic, keyframes, normalizeCSS, resolve, resolveValue, setStyleExtraction, sheet, styled, useCSS, useTheme, useThemeAccessor };
|
|
1311
1357
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_countSink","_countSink","__pkgName","__pkgVersion"],"sources":["../package.json","../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 // Watermark for streaming SSR — index into `ssrBuffer` of the first\n // rule NOT yet flushed by `flushSSRPending()`. Lets the streaming\n // pipeline emit `<style>` tags inline next to each Suspense boundary\n // that resolves, so boundary content arrives at the browser with its\n // styles already present (instead of FOUCing until the final\n // consolidated `<style>` flushes at end-of-stream).\n private ssrFlushedIdx = 0\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 // Unreachable in practice (the only caller already gates on !isSSR), so\n // the early-return arm is never taken — ignored for coverage.\n /* v8 ignore next */\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 // Dedup set for the dev-mode resolved-CSS validator — one warning per\n // unique (finding, snippet) pair, so a hot re-render can't spam the console.\n private warnedInvalidCss = new Set<string>()\n\n /**\n * Dev-only sanity scan over resolved CSS text — the safety net for the\n * CSS-variables theming mode. Var-leaf theme tokens are plain strings, so\n * legacy JS arithmetic (`t.spacing.small * 2` → `NaN`) and string concat\n * (`t.color.x + '99'` → `var(--px-…)99`) produce silently-invalid CSS\n * that the browser drops. This scan names the offending declaration the\n * moment it reaches the sheet. Tree-shaken from production (call site is\n * gated on `process.env.NODE_ENV !== 'production'`).\n */\n private validateDevCss(cssText: string): void {\n if (process.env.NODE_ENV === 'production') return\n const found: string[] = []\n if (/[:\\s(,]NaN(?:[a-z%]*)?[;\\s)}]/.test(`:${cssText};`)) {\n found.push(\n \"a 'NaN' value — JS arithmetic on a var()/string theme token? Compose with native CSS calc() instead\",\n )\n }\n if (/:\\s*(?:undefined|null)[;\\s}]/.test(`${cssText};`)) {\n found.push(\"an 'undefined'/'null' value — a theme token path that does not exist?\")\n }\n const malformed = /var\\(--[a-zA-Z0-9-]+\\)[a-zA-Z0-9#%]/.exec(cssText)\n if (malformed) {\n found.push(\n `a malformed var() concatenation ('${malformed[0]}…') — string-concat on a CSS-variable theme token? Use calc() for math or color-mix() for alpha`,\n )\n }\n if (found.length === 0) return\n const key = `${found.join('|')}::${cssText.slice(0, 120)}`\n if (this.warnedInvalidCss.has(key)) return\n this.warnedInvalidCss.add(key)\n // oxlint-disable-next-line no-console\n console.warn(\n `[Pyreon] styler: resolved CSS contains ${found.join(' AND ')}.\\n in: ${cssText.slice(0, 200)}`,\n )\n }\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 this.validateDevCss(cssText)\n }\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 // The slice ends at this depth-0 `}` (index i), so it always\n // contains at least one `}` and the trim can never be empty —\n // the false arm is unreachable. Kept as a defensive guard.\n /* v8 ignore next */\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 this.ssrFlushedIdx = 0\n }\n\n /**\n * Streaming SSR — return CSS rules added to the buffer since the last\n * `flushSSRPending()` call, joined as a raw CSS body (no `<style>`\n * wrapper). Advances an internal watermark so subsequent calls return\n * only newer rules. Returns `''` when no new rules.\n *\n * Used by `@pyreon/runtime-server`'s streaming pipeline to emit\n * `<style data-pyreon-stream>` tags inline next to each Suspense\n * boundary's resolved HTML — so boundary content arrives at the\n * browser with its styles already present, instead of FOUCing until\n * the final consolidated `<style>` flushes at end-of-stream.\n *\n * Discovery contract: runtime-server reads this via\n * `globalThis.__PYREON_STYLER_FLUSH__` (set by sheet.ts on module\n * load when running under SSR). This avoids a hard\n * `runtime-server → styler` dependency — the streamer is no-op when\n * no styler is loaded. Mirrors the `__pyreon_count__` perf-counter\n * pattern.\n *\n * Idempotent on the watermark: `flushSSRPending()` immediately after\n * another `flushSSRPending()` returns `''` regardless of any prior\n * `getStyleTag()` / `reset()` calls. The watermark resets to 0 when\n * the buffer is reset (via `reset()` / `resetSSRBuffer()` /\n * `clearAll()` — request boundaries).\n *\n * NOT meant to be used WITH `getStyleTag()` on the same render —\n * `getStyleTag()` returns ALL buffered rules (SSG / non-streaming\n * SSR). Streaming SSR drives the buffer entirely through\n * `flushSSRPending()`.\n */\n flushSSRPending(): string {\n if (this.ssrBuffer.length === this.ssrFlushedIdx) return ''\n // Emit `@layer` ordering declaration on the FIRST flush of a stream\n // — only when there are layered rules to order. Once emitted, never\n // re-emitted (idempotent — second declaration would be redundant).\n const isFirstFlush = this.ssrFlushedIdx === 0\n let prefix = ''\n if (isFirstFlush) {\n const hasLayered = this.ssrBuffer\n .slice(this.ssrFlushedIdx)\n .some((r) => r.startsWith('@layer '))\n prefix = hasLayered\n ? '@layer elements, rocketstyle;'\n : this.layer\n ? `@layer ${this.layer};`\n : ''\n }\n const slice = this.ssrBuffer.slice(this.ssrFlushedIdx).join('')\n this.ssrFlushedIdx = this.ssrBuffer.length\n return prefix + slice\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.ssrFlushedIdx = 0\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 this.ssrFlushedIdx = 0\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// ─── Streaming SSR hook ───────────────────────────────────────────────────\n//\n// On SSR module init, register a global flush callback so\n// `@pyreon/runtime-server`'s streaming pipeline can emit collected CSS\n// rules inline alongside each Suspense boundary's HTML — without a hard\n// `runtime-server → styler` dependency.\n//\n// Same pattern as the `__pyreon_count__` perf-counter sink and the SSG\n// plugin's `getStyleTag` lookup: the consumer reads the global and\n// no-ops if styler isn't loaded.\n//\n// Client-side: `IS_SERVER === false` → registration skipped. The hook\n// is server-only.\nif (typeof document === 'undefined') {\n ;(\n globalThis as { __PYREON_STYLER_FLUSH__?: () => string }\n ).__PYREON_STYLER_FLUSH__ = () => sheet.flushSSRPending()\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, isServer, 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// SSR detection — evaluated once at module load (matches `sheet.ts` /\n// `@pyreon/runtime-server`). On the server every render is a single pass with\n// no client reactivity, so `DynamicStyled` skips the computed subscription +\n// ref closure + renderEffect (all client-only dead weight server-side).\n// `isServer` (from @pyreon/reactivity) is the same `typeof document` check,\n// now the canonical framework primitive instead of a local copy.\nconst IS_SERVER = isServer\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.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\n // is the className the sheet just inserted. The `onSheetClear`\n // subscriber wired at module top (see ~line 80) drops the outer\n // `staticComponentCache` + `_hotCache` on `sheet.clearAll()` (HMR /\n // dev reload). That forces a fresh `createStyledComponent` call on\n // the next mount, which produces a fresh `cachedEmptyVNode` with\n // the new (sheet-inserted) className. Cache lifetime is correctly\n // tied to the sheet's lifetime — no separate VNode-cache\n // invalidation needed.\n const cachedEmptyVNode = h(tag as string, staticClassName ? { class: staticClassName } : {})\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 // SSR fast path — a single render with no client reactivity. Resolve the\n // class once and emit, skipping the `computed` subscription, the `ref`\n // closure, and the `renderEffect` that the client path sets up below. All\n // three are client-only dead weight on the server: `el` is never assigned\n // (refs don't fire during `renderToString`), and no signal changes within\n // one SSR pass — so they allocate per dynamic component and produce zero\n // HTML. The emitted className is byte-identical to the reactive path's\n // initial value (`cssClass()` resolves the same inputs). Mirrors the\n // IS_SERVER variant split in vitus-labs/styler.\n if (IS_SERVER) {\n const finalTag = rawProps.as || tag\n const className = runUntracked(() =>\n doResolve(\n isReactiveRS ? $rs() : $rs,\n isReactiveState ? $rsState() : $rsState,\n theme,\n ),\n )\n const finalProps = buildProps(rawProps, className, typeof finalTag === 'string', customFilter)\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 // 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 () => {\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 },\n { equals: (a, b) => a === b },\n )\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 ? cssClass() : 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 // A valid `RefProp` is only ever a function or a `{ current }`\n // object, so the final `else` (truthy ref that is neither) is\n // unreachable — kept as a defensive guard, ignored for coverage.\n /* v8 ignore else */\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 { name as __pkgName, version as __pkgVersion } from '../package.json' with { type: 'json' }\nimport { 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(__pkgName, __pkgVersion, 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":";;;;;;;;;ACWA,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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ACA;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,SAAS,OAAO,MAAM;GACtB;EACF;EAIA,IAAI,OAAO,YACT,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gVersion"],"sources":["../package.json","../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 // Watermark for streaming SSR — index into `ssrBuffer` of the first\n // rule NOT yet flushed by `flushSSRPending()`. Lets the streaming\n // pipeline emit `<style>` tags inline next to each Suspense boundary\n // that resolves, so boundary content arrives at the browser with its\n // styles already present (instead of FOUCing until the final\n // consolidated `<style>` flushes at end-of-stream).\n private ssrFlushedIdx = 0\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 // Unreachable in practice (the only caller already gates on !isSSR), so\n // the early-return arm is never taken — ignored for coverage.\n /* v8 ignore next */\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 // Dedup set for the dev-mode resolved-CSS validator — one warning per\n // unique (finding, snippet) pair, so a hot re-render can't spam the console.\n private warnedInvalidCss = new Set<string>()\n\n /**\n * Dev-only sanity scan over resolved CSS text — the safety net for the\n * CSS-variables theming mode. Var-leaf theme tokens are plain strings, so\n * legacy JS arithmetic (`t.spacing.small * 2` → `NaN`) and string concat\n * (`t.color.x + '99'` → `var(--px-…)99`) produce silently-invalid CSS\n * that the browser drops. This scan names the offending declaration the\n * moment it reaches the sheet. Tree-shaken from production (call site is\n * gated on `process.env.NODE_ENV !== 'production'`).\n */\n private validateDevCss(cssText: string): void {\n if (process.env.NODE_ENV === 'production') return\n const found: string[] = []\n if (/[:\\s(,]NaN(?:[a-z%]*)?[;\\s)}]/.test(`:${cssText};`)) {\n found.push(\n \"a 'NaN' value — JS arithmetic on a var()/string theme token? Compose with native CSS calc() instead\",\n )\n }\n if (/:\\s*(?:undefined|null)[;\\s}]/.test(`${cssText};`)) {\n found.push(\"an 'undefined'/'null' value — a theme token path that does not exist?\")\n }\n const malformed = /var\\(--[a-zA-Z0-9-]+\\)[a-zA-Z0-9#%]/.exec(cssText)\n if (malformed) {\n found.push(\n `a malformed var() concatenation ('${malformed[0]}…') — string-concat on a CSS-variable theme token? Use calc() for math or color-mix() for alpha`,\n )\n }\n if (found.length === 0) return\n const key = `${found.join('|')}::${cssText.slice(0, 120)}`\n if (this.warnedInvalidCss.has(key)) return\n this.warnedInvalidCss.add(key)\n // oxlint-disable-next-line no-console\n console.warn(\n `[Pyreon] styler: resolved CSS contains ${found.join(' AND ')}.\\n in: ${cssText.slice(0, 200)}`,\n )\n }\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 this.validateDevCss(cssText)\n }\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 // The slice ends at this depth-0 `}` (index i), so it always\n // contains at least one `}` and the trim can never be empty —\n // the false arm is unreachable. Kept as a defensive guard.\n /* v8 ignore next */\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 this.ssrFlushedIdx = 0\n }\n\n /**\n * Streaming SSR — return CSS rules added to the buffer since the last\n * `flushSSRPending()` call, joined as a raw CSS body (no `<style>`\n * wrapper). Advances an internal watermark so subsequent calls return\n * only newer rules. Returns `''` when no new rules.\n *\n * Used by `@pyreon/runtime-server`'s streaming pipeline to emit\n * `<style data-pyreon-stream>` tags inline next to each Suspense\n * boundary's resolved HTML — so boundary content arrives at the\n * browser with its styles already present, instead of FOUCing until\n * the final consolidated `<style>` flushes at end-of-stream.\n *\n * Discovery contract: runtime-server reads this via\n * `globalThis.__PYREON_STYLER_FLUSH__` (set by sheet.ts on module\n * load when running under SSR). This avoids a hard\n * `runtime-server → styler` dependency — the streamer is no-op when\n * no styler is loaded. Mirrors the `__pyreon_count__` perf-counter\n * pattern.\n *\n * Idempotent on the watermark: `flushSSRPending()` immediately after\n * another `flushSSRPending()` returns `''` regardless of any prior\n * `getStyleTag()` / `reset()` calls. The watermark resets to 0 when\n * the buffer is reset (via `reset()` / `resetSSRBuffer()` /\n * `clearAll()` — request boundaries).\n *\n * NOT meant to be used WITH `getStyleTag()` on the same render —\n * `getStyleTag()` returns ALL buffered rules (SSG / non-streaming\n * SSR). Streaming SSR drives the buffer entirely through\n * `flushSSRPending()`.\n */\n flushSSRPending(): string {\n if (this.ssrBuffer.length === this.ssrFlushedIdx) return ''\n // Emit `@layer` ordering declaration on the FIRST flush of a stream\n // — only when there are layered rules to order. Once emitted, never\n // re-emitted (idempotent — second declaration would be redundant).\n const isFirstFlush = this.ssrFlushedIdx === 0\n let prefix = ''\n if (isFirstFlush) {\n const hasLayered = this.ssrBuffer\n .slice(this.ssrFlushedIdx)\n .some((r) => r.startsWith('@layer '))\n prefix = hasLayered\n ? '@layer elements, rocketstyle;'\n : this.layer\n ? `@layer ${this.layer};`\n : ''\n }\n const slice = this.ssrBuffer.slice(this.ssrFlushedIdx).join('')\n this.ssrFlushedIdx = this.ssrBuffer.length\n return prefix + slice\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.ssrFlushedIdx = 0\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 this.ssrFlushedIdx = 0\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// ─── Streaming SSR hook ───────────────────────────────────────────────────\n//\n// On SSR module init, register a global flush callback so\n// `@pyreon/runtime-server`'s streaming pipeline can emit collected CSS\n// rules inline alongside each Suspense boundary's HTML — without a hard\n// `runtime-server → styler` dependency.\n//\n// Same pattern as the `__pyreon_count__` perf-counter sink and the SSG\n// plugin's `getStyleTag` lookup: the consumer reads the global and\n// no-ops if styler isn't loaded.\n//\n// Client-side: `IS_SERVER === false` → registration skipped. The hook\n// is server-only.\nif (typeof document === 'undefined') {\n ;(\n globalThis as { __PYREON_STYLER_FLUSH__?: () => string }\n ).__PYREON_STYLER_FLUSH__ = () => sheet.flushSSRPending()\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, isServer, 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\n// `innerRef` → `ref` alias. `@pyreon/elements` Element treats `innerRef` as a\n// first-class prop (it's a multi-layer component where a plain `ref` might land\n// on a wrapper, not the inner DOM node). A `styled()` component renders a SINGLE\n// DOM node, so plain `ref` already targets it — but users coming from Element\n// reasonably reach for `innerRef`, and a bare styled() would otherwise SILENTLY\n// drop it (it's not a forwarded DOM prop), so the ref callback never fires.\n// Accepting it as a `ref` alias makes the convention uniform across Element +\n// styled and turns a silent-no-op footgun into working code. An explicit `ref`\n// always wins. Returns `rawProps` UNCHANGED (zero alloc) when there's nothing to\n// alias — the dominant path. `getOwnPropertyDescriptors` preserves getter-shaped\n// reactive props + symbol-keyed brands; the new object drops `innerRef` so it\n// never reaches the DOM as an invalid `innerref=` attribute.\nfunction aliasInnerRef(rawProps: Record<string, any>): Record<string, any> {\n if (rawProps.innerRef == null || rawProps.ref != null) return rawProps\n const descs: Record<string, PropertyDescriptor> = Object.getOwnPropertyDescriptors(rawProps)\n // Guarded above (rawProps.innerRef != null) ⇒ the own descriptor exists.\n descs.ref = descs.innerRef!\n delete descs.innerRef\n return Object.defineProperties({}, descs)\n}\n\n// ── Custom-Property Style Extraction (CPSE) — opt-in default-pipeline hook ──\n// `@pyreon/ui-core`'s `init({ styleExtraction: true })` calls `setStyleExtraction`\n// to enable + inject `cpseRewrite` (it lives in `@pyreon/unistyle`, which styler\n// cannot import — dep direction). EVERY branch below is gated on `_cpseEnabled`,\n// so with the flag off (the default) this is byte-identical to the classic path.\n// Scope: the NON-reactive (static + SSR) resolve — plain `styled` + `Element`\n// ($element path). The reactive (rocketstyle accessor) path stays classic.\n// Win: O(1) CSS rules (the value lives in an inline custom property); the styler\n// still resolves per distinct $element, so resolve stays O(N) (documented).\nlet _cpseEnabled = false\nlet _cpseRewrite: ((cssText: string, varsOut: Record<string, string>) => string) | null = null\n/** @internal Wired by `@pyreon/ui-core` `init({ styleExtraction })`. */\nexport const setStyleExtraction = (\n enabled: boolean,\n rewrite?: (cssText: string, varsOut: Record<string, string>) => string,\n): void => {\n _cpseEnabled = enabled\n if (rewrite) _cpseRewrite = rewrite\n}\n// Per-$element vars cache — the value must survive `elClassCache` HITS, where\n// `doResolve` returns the cached className WITHOUT re-resolving (so the vars\n// would otherwise be lost for repeated-identical Elements). Only written when\n// CPSE is on.\nconst cpseVarsCache = new WeakMap<object, Record<string, string>>()\n/** Merge CPSE custom-property vars into a finalProps `style` (object | string | absent). */\nconst mergeCpseStyle = (finalProps: Record<string, any>, vars: Record<string, string>): void => {\n const existing = finalProps.style\n if (existing == null) {\n finalProps.style = vars\n } else if (typeof existing === 'string') {\n let s = existing.trim()\n if (s && !s.endsWith(';')) s += ';'\n for (const k in vars) s += `${k}:${vars[k]};`\n finalProps.style = s\n } else if (typeof existing === 'object') {\n finalProps.style = { ...existing, ...vars }\n }\n}\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// SSR detection — evaluated once at module load (matches `sheet.ts` /\n// `@pyreon/runtime-server`). On the server every render is a single pass with\n// no client reactivity, so `DynamicStyled` skips the computed subscription +\n// ref closure + renderEffect (all client-only dead weight server-side).\n// `isServer` (from @pyreon/reactivity) is the same `typeof document` check,\n// now the canonical framework primitive instead of a local copy.\nconst IS_SERVER = isServer\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.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\n // is the className the sheet just inserted. The `onSheetClear`\n // subscriber wired at module top (see ~line 80) drops the outer\n // `staticComponentCache` + `_hotCache` on `sheet.clearAll()` (HMR /\n // dev reload). That forces a fresh `createStyledComponent` call on\n // the next mount, which produces a fresh `cachedEmptyVNode` with\n // the new (sheet-inserted) className. Cache lifetime is correctly\n // tied to the sheet's lifetime — no separate VNode-cache\n // invalidation needed.\n const cachedEmptyVNode = h(tag as string, staticClassName ? { class: staticClassName } : {})\n\n const StaticStyled: ComponentFn = (rawPropsIn: Record<string, any>): VNode | null => {\n // Normalize `innerRef` → `ref` before the ref-aware fast path below\n // (otherwise an innerRef-only call would hit the cached ref-less VNode).\n const rawProps = aliasInnerRef(rawPropsIn)\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 = (rawPropsIn: Record<string, any>): VNode | null => {\n // `innerRef` → `ref` alias (uniform with @pyreon/elements Element).\n const rawProps = aliasInnerRef(rawPropsIn)\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 // CPSE: the current resolve's per-instance vars, surfaced to the static /\n // SSR render paths below. Reset at the top of every doResolve; only set on\n // the non-reactive CPSE paths when the flag is on (else stays null).\n let pendingCpseVars: Record<string, string> | null = null\n // The `.set()` calls in doResolve are WeakMap/Map CACHE writes (classCache,\n // elClassCache, cpseVarsCache), NOT signal updates — `batch()` does not\n // apply. The rule counts `.set()` syntactically (a known Map-like FP class,\n // per its own docstring); CPSE's cpseVarsCache.set pushed the Element path to 3.\n // pyreon-lint-disable-next-line pyreon/no-unbatched-updates\n const doResolve = (rs: unknown, rsState: unknown, t: unknown): string => {\n pendingCpseVars = null\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 // Restore the per-instance CPSE vars cached alongside this $element\n // (the className was the value-agnostic one) so the value survives\n // the cache hit.\n if (_cpseEnabled) pendingCpseVars = cpseVarsCache.get($el as object) ?? null\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 let cssText = normalizeCSS(resolve(strings, values, resolveProps))\n // CPSE (non-reactive path only — excludes the rocketstyle classCache\n // path): rewrite the resolved declarations to a value-agnostic rule\n // (`prop: var(--u-…)`) and collect the per-instance values. The agnostic\n // text dedups across distinct values → ONE shared CSS rule (O(1) rules);\n // the value rides as an inline custom property. Flag-off → skipped.\n if (\n _cpseEnabled &&\n _cpseRewrite &&\n !(rs && typeof rs === 'object' && rsState && typeof rsState === 'object')\n ) {\n const vars: Record<string, string> = {}\n const agnostic = _cpseRewrite(cssText, vars)\n if (Object.keys(vars).length > 0) {\n cssText = agnostic\n pendingCpseVars = vars\n if (useElCache) cpseVarsCache.set($el as object, vars)\n }\n }\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 // SSR fast path — a single render with no client reactivity. Resolve the\n // class once and emit, skipping the `computed` subscription, the `ref`\n // closure, and the `renderEffect` that the client path sets up below. All\n // three are client-only dead weight on the server: `el` is never assigned\n // (refs don't fire during `renderToString`), and no signal changes within\n // one SSR pass — so they allocate per dynamic component and produce zero\n // HTML. The emitted className is byte-identical to the reactive path's\n // initial value (`cssClass()` resolves the same inputs). Mirrors the\n // IS_SERVER variant split in vitus-labs/styler.\n if (IS_SERVER) {\n const finalTag = rawProps.as || tag\n const className = runUntracked(() =>\n doResolve(\n isReactiveRS ? $rs() : $rs,\n isReactiveState ? $rsState() : $rsState,\n theme,\n ),\n )\n const finalProps = buildProps(rawProps, className, typeof finalTag === 'string', customFilter)\n // CPSE: surface the per-instance custom properties into the SSR style attr.\n if (pendingCpseVars) mergeCpseStyle(finalProps, pendingCpseVars)\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 // 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 () => {\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 },\n { equals: (a, b) => a === b },\n )\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 ? cssClass() : doResolve($rs, $rsState, theme)\n const finalProps = buildProps(rawProps, className, isDOM, customFilter)\n // CPSE: surface the per-instance custom properties into the client style\n // attr (static / Element path only — `!cssClass` excludes the reactive\n // rocketstyle path, which stays classic).\n if (!cssClass && pendingCpseVars) mergeCpseStyle(finalProps, pendingCpseVars)\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 // A valid `RefProp` is only ever a function or a `{ current }`\n // object, so the final `else` (truthy ref that is neither) is\n // unreachable — kept as a defensive guard, ignored for coverage.\n /* v8 ignore else */\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 { name as __pkgName, version as __pkgVersion } from '../package.json' with { type: 'json' }\nimport { 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(__pkgName, __pkgVersion, 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 { setStyleExtraction, styled } from './styled'\nexport type { DefaultTheme } from './ThemeProvider'\nexport { ThemeContext, ThemeProvider, useTheme, useThemeAccessor } from './ThemeProvider'\nexport { useCSS } from './useCSS'\n"],"mappings":";;;;;;;;;ACWA,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,IACA,KAAK,QAAQ,MAAM,SAAS,MAAM,OAChC,KACA,aAAa,GAAoB,KAAK,KAAK;EACrD,OAAO,IAAI,KAAK,QAAQ,MAAM,SAAS,MAAM,MAC3C,UAAU;OACL,IAAI,OAAO,MAAM,UACtB,UAAU,IAAI;OACT,IAAI,OAAO,MAAM,UACtB,UAAU,IAAI;OAEd,UAAU,aAAa,GAAG,KAAK,IAAI;CAEvC;CACA,OAAO;AACT;;;;;;;;;;AAWA,MAAM,4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AAU,SAAS,UAAU,MAAM,OAAO;CAG/D,IAAI,OAAO,UAAU,YAAY,OAAO,aAAa,MAAM,KAAK,GAAoB,KAAK;CAQzF,IAAI,iBAAiB,WAAW;EAC9B,IAAI,MAAM,eAAe,OAAO;GAC9B,IAAI,MAAM,oBAAoB,QAC5B,MAAM,kBAAkB,QAAQ,MAAM,SAAS,MAAM,QAAQ,CAAC,CAAC;GAEjE,OAAO,MAAM;EACf;EACA,OAAO,QAAQ,MAAM,SAAS,MAAM,QAAQ,KAAK;CACnD;CAGA,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,IAAI,cAAc;EAClB,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAChC,eAAe,aAAa,MAAM,IAAI,KAAK;EAE7C,OAAO;CACT;CAEA,OAAO,OAAO,KAAK;AACrB;;;;;;;;;;;;;ACrNA,MAAa,OAAO,SAA+B,GAAG,WACpD,IAAI,UAAU,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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;;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;;;;;;;;;;;ACpoBD,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;;;;ACZA,kBAAkBC,MAAWC,SAAc,OAAO,KAAK,GAAG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pyreon/styler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"description": "Lightweight CSS-in-JS engine for Pyreon",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/pyreon/pyreon/tree/main/packages/ui-system/styler#readme",
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
"typecheck": "tsc --noEmit"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@pyreon/core": "^0.
|
|
44
|
-
"@pyreon/reactivity": "^0.
|
|
43
|
+
"@pyreon/core": "^0.35.0",
|
|
44
|
+
"@pyreon/reactivity": "^0.35.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@pyreon/manifest": "0.13.2",
|
|
48
|
-
"@pyreon/test-utils": "^0.13.
|
|
49
|
-
"@pyreon/typescript": "^0.
|
|
48
|
+
"@pyreon/test-utils": "^0.13.23",
|
|
49
|
+
"@pyreon/typescript": "^0.35.0",
|
|
50
50
|
"@pyreon/vitest-config": "0.13.3",
|
|
51
51
|
"@vitest/browser-playwright": "^4.1.8",
|
|
52
52
|
"@vitus-labs/tools-rolldown": "^2.5.0"
|