@pyreon/rocketstyle 0.14.0 → 0.15.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 CHANGED
@@ -1,4 +1,4 @@
1
- import * as _pyreon_core0 from "@pyreon/core";
1
+ import * as _$_pyreon_core0 from "@pyreon/core";
2
2
  import { VNodeChild } from "@pyreon/core";
3
3
  import { config, context, render } from "@pyreon/ui-core";
4
4
 
@@ -222,7 +222,7 @@ type Configuration<C = ElementType | unknown, D extends Dimensions = Dimensions>
222
222
  statics: Record<string, any>;
223
223
  } & Record<string, any>;
224
224
  type DefaultProps = Partial<PseudoProps> & {
225
- children?: _pyreon_core0.VNodeChild;
225
+ children?: _$_pyreon_core0.VNodeChild;
226
226
  };
227
227
  //#endregion
228
228
  //#region src/types/attrs.d.ts
package/lib/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { createContext, provide, useContext } from "@pyreon/core";
1
+ import { createContext, nativeCompat, provide, useContext } from "@pyreon/core";
2
2
  import { Provider as Provider$1, compose, config, context, get, hoistNonReactStatics, isEmpty, merge, omit, pick, render, set } from "@pyreon/ui-core";
3
3
  import { signal } from "@pyreon/reactivity";
4
4
 
5
5
  //#region src/constants/index.ts
6
6
  /** Tree-shakeable dev-mode flag. `true` in dev, `false` (dead code eliminated) in prod. */
7
- const __DEV__ = import.meta.env?.DEV === true;
7
+ const __DEV__ = process.env.NODE_ENV !== "production";
8
8
  /** Default theme mode used when no mode is provided via context. */
9
9
  const MODE_DEFAULT = "light";
10
10
  /** Pseudo-state interaction keys tracked for styling (hover, active, focus, pressed). */
@@ -74,6 +74,7 @@ const Provider = ({ provider = Provider$1, inversed, ...props }) => {
74
74
  children
75
75
  }) ?? null;
76
76
  };
77
+ nativeCompat(Provider);
77
78
 
78
79
  //#endregion
79
80
  //#region src/constants/defaultDimensions.ts
@@ -510,6 +511,8 @@ const rocketComponent = (options) => {
510
511
  ...options.filterAttrs ?? []
511
512
  ];
512
513
  const _omitSetCache = /* @__PURE__ */ new WeakMap();
514
+ const _rsMemo = /* @__PURE__ */ new WeakMap();
515
+ const RS_MEMO_CAP = 32;
513
516
  const hocsFuncs = [rocketStyleHOC(options), ...calculateHocsFuncs(options.compose)];
514
517
  const EnhancedComponent = (props) => {
515
518
  const localCtx = useLocalContext(options.consumer);
@@ -527,7 +530,7 @@ const rocketComponent = (options) => {
527
530
  })();
528
531
  let dimResult = _dimensionsCache.get(initialDimensionThemes);
529
532
  if (dimResult) {
530
- if (import.meta.env?.DEV === true) _countSink.__pyreon_count__?.("rocketstyle.dimensionsMap.hit");
533
+ if (process.env.NODE_ENV !== "production") _countSink.__pyreon_count__?.("rocketstyle.dimensionsMap.hit");
531
534
  } else {
532
535
  dimResult = getDimensionsMap({
533
536
  themes: initialDimensionThemes,
@@ -541,59 +544,89 @@ const rocketComponent = (options) => {
541
544
  RESERVED_STYLING_PROPS_KEYS = Object.keys(reservedPropNames);
542
545
  _reservedKeysCache.set(reservedPropNames, RESERVED_STYLING_PROPS_KEYS);
543
546
  }
544
- const $rocketstyleAccessor = () => {
545
- if (import.meta.env?.DEV === true) _countSink.__pyreon_count__?.("rocketstyle.getTheme");
547
+ const localPseudo = localCtx?.pseudo;
548
+ const _resolveRsEntry = () => {
546
549
  const theme = themeAttrs.theme;
547
550
  const mode = themeAttrs.mode;
551
+ let key = mode;
552
+ const propsRec = props;
553
+ for (const dimName in dimensions) {
554
+ const v = propsRec[dimName];
555
+ key += "|" + (typeof v === "string" || typeof v === "number" || typeof v === "boolean" ? String(v) : v === void 0 ? "" : "~" + typeof v);
556
+ }
557
+ for (const k of ALL_PSEUDO_KEYS) {
558
+ const propV = propsRec[k];
559
+ const localV = localPseudo?.[k];
560
+ const v = propV !== void 0 ? propV : localV;
561
+ key += "|" + (v === void 0 ? "" : v ? "1" : "0");
562
+ }
563
+ let themeMemo = _rsMemo.get(theme);
564
+ if (!themeMemo) {
565
+ themeMemo = /* @__PURE__ */ new Map();
566
+ _rsMemo.set(theme, themeMemo);
567
+ }
568
+ const cached = themeMemo.get(key);
569
+ if (cached) {
570
+ if (process.env.NODE_ENV !== "production") _countSink.__pyreon_count__?.("rocketstyle.dimensionMemo.hit");
571
+ themeMemo.delete(key);
572
+ themeMemo.set(key, cached);
573
+ return cached;
574
+ }
575
+ if (process.env.NODE_ENV !== "production") _countSink.__pyreon_count__?.("rocketstyle.getTheme");
548
576
  const baseThemeHelper = ThemeManager$1.baseTheme;
549
577
  if (baseThemeHelper.has(theme)) {
550
- if (import.meta.env?.DEV === true) _countSink.__pyreon_count__?.("rocketstyle.localThemeManager.hit");
578
+ if (process.env.NODE_ENV !== "production") _countSink.__pyreon_count__?.("rocketstyle.localThemeManager.hit");
551
579
  } else baseThemeHelper.set(theme, getThemeFromChain(options.theme, theme));
552
580
  const baseTheme = baseThemeHelper.get(theme);
553
581
  const dimHelper = ThemeManager$1.dimensionsThemes;
554
582
  if (dimHelper.has(theme)) {
555
- if (import.meta.env?.DEV === true) _countSink.__pyreon_count__?.("rocketstyle.localThemeManager.hit");
583
+ if (process.env.NODE_ENV !== "production") _countSink.__pyreon_count__?.("rocketstyle.localThemeManager.hit");
556
584
  } else dimHelper.set(theme, getDimensionThemes(theme, options));
557
585
  const themes = dimHelper.get(theme);
558
- const rocketstate = _calculateStylingAttrs({
559
- props: pickStyledAttrs(props, reservedPropNames),
586
+ const rocketstateRaw = _calculateStylingAttrs({
587
+ props: pickStyledAttrs(propsRec, reservedPropNames),
560
588
  dimensions
561
589
  });
562
590
  const modeBaseHelper = ThemeManager$1.modeBaseTheme[mode];
563
591
  if (modeBaseHelper.has(baseTheme)) {
564
- if (import.meta.env?.DEV === true) _countSink.__pyreon_count__?.("rocketstyle.localThemeManager.hit");
592
+ if (process.env.NODE_ENV !== "production") _countSink.__pyreon_count__?.("rocketstyle.localThemeManager.hit");
565
593
  } else modeBaseHelper.set(baseTheme, getThemeByMode(baseTheme, mode));
566
594
  const currentModeBaseTheme = modeBaseHelper.get(baseTheme);
567
595
  const modeDimHelper = ThemeManager$1.modeDimensionTheme[mode];
568
596
  if (modeDimHelper.has(themes)) {
569
- if (import.meta.env?.DEV === true) _countSink.__pyreon_count__?.("rocketstyle.localThemeManager.hit");
597
+ if (process.env.NODE_ENV !== "production") _countSink.__pyreon_count__?.("rocketstyle.localThemeManager.hit");
570
598
  } else modeDimHelper.set(themes, getThemeByMode(themes, mode));
571
- return getTheme({
572
- rocketstate,
599
+ const rocketstyle = getTheme({
600
+ rocketstate: rocketstateRaw,
573
601
  themes: modeDimHelper.get(themes),
574
602
  baseTheme: currentModeBaseTheme,
575
603
  transformKeys: options.transformKeys,
576
604
  appTheme: theme
577
605
  });
578
- };
579
- const localPseudo = localCtx?.pseudo;
580
- const $rocketstateAccessor = () => {
581
- const rocketstate = _calculateStylingAttrs({
582
- props: pickStyledAttrs(props, reservedPropNames),
583
- dimensions
584
- });
585
- const propPseudo = pick(props, ALL_PSEUDO_KEYS);
586
- return {
587
- ...rocketstate,
606
+ const propPseudo = pick(propsRec, ALL_PSEUDO_KEYS);
607
+ const rocketstate = {
608
+ ...rocketstateRaw,
588
609
  pseudo: {
589
610
  ...localPseudo,
590
611
  ...propPseudo
591
612
  }
592
613
  };
614
+ if (themeMemo.size >= RS_MEMO_CAP) {
615
+ const oldestKey = themeMemo.keys().next().value;
616
+ if (oldestKey !== void 0) themeMemo.delete(oldestKey);
617
+ }
618
+ const entry = {
619
+ rocketstyle,
620
+ rocketstate
621
+ };
622
+ themeMemo.set(key, entry);
623
+ return entry;
593
624
  };
625
+ const $rocketstyleAccessor = () => _resolveRsEntry().rocketstyle;
626
+ const $rocketstateAccessor = () => _resolveRsEntry().rocketstate;
594
627
  let omitSet = _omitSetCache.get(RESERVED_STYLING_PROPS_KEYS);
595
628
  if (omitSet) {
596
- if (import.meta.env?.DEV === true) _countSink.__pyreon_count__?.("rocketstyle.omitSet.hit");
629
+ if (process.env.NODE_ENV !== "production") _countSink.__pyreon_count__?.("rocketstyle.omitSet.hit");
597
630
  } else {
598
631
  omitSet = new Set([...RESERVED_STYLING_PROPS_KEYS, ...STATIC_OMIT_KEYS]);
599
632
  _omitSetCache.set(RESERVED_STYLING_PROPS_KEYS, omitSet);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyreon/rocketstyle",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "Multi-dimensional style composition for Pyreon components",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -10,6 +10,7 @@
10
10
  },
11
11
  "files": [
12
12
  "lib",
13
+ "!lib/**/*.map",
13
14
  "!lib/analysis",
14
15
  "README.md",
15
16
  "LICENSE",
@@ -42,16 +43,16 @@
42
43
  },
43
44
  "devDependencies": {
44
45
  "@pyreon/test-utils": "^0.13.2",
45
- "@pyreon/typescript": "^0.14.0",
46
- "@pyreon/ui-core": "^0.14.0",
46
+ "@pyreon/typescript": "^0.15.0",
47
+ "@pyreon/ui-core": "^0.15.0",
47
48
  "@vitest/browser-playwright": "^4.1.4",
48
- "@vitus-labs/tools-rolldown": "^1.15.3"
49
+ "@vitus-labs/tools-rolldown": "^2.3.0"
49
50
  },
50
51
  "peerDependencies": {
51
- "@pyreon/core": "^0.14.0",
52
- "@pyreon/reactivity": "^0.14.0",
53
- "@pyreon/styler": "^0.14.0",
54
- "@pyreon/ui-core": "^0.14.0"
52
+ "@pyreon/core": "^0.15.0",
53
+ "@pyreon/reactivity": "^0.15.0",
54
+ "@pyreon/styler": "^0.15.0",
55
+ "@pyreon/ui-core": "^0.15.0"
55
56
  },
56
57
  "engines": {
57
58
  "node": ">= 22"
@@ -0,0 +1,9 @@
1
+ import { isNativeCompat } from '@pyreon/core'
2
+ import { describe, expect, it } from 'vitest'
3
+ import RocketstyleProvider from '../context/context'
4
+
5
+ describe('native-compat marker — @pyreon/rocketstyle', () => {
6
+ it('Provider is marked native', () => {
7
+ expect(isNativeCompat(RocketstyleProvider)).toBe(true)
8
+ })
9
+ })
@@ -2,11 +2,8 @@
2
2
  // literal-replaced so prod bundles tree-shake the dev branch to zero bytes.
3
3
  // Typed through a narrowing interface so downstream packages don't need
4
4
  // `vite/client` in their tsconfigs to type-check this file transitively.
5
- interface ViteMeta {
6
- readonly env?: { readonly DEV?: boolean }
7
- }
8
5
  /** Tree-shakeable dev-mode flag. `true` in dev, `false` (dead code eliminated) in prod. */
9
- export const __DEV__: boolean = (import.meta as ViteMeta).env?.DEV === true
6
+ export const __DEV__: boolean = process.env.NODE_ENV !== 'production'
10
7
 
11
8
  /** Default theme mode used when no mode is provided via context. */
12
9
  export const MODE_DEFAULT = 'light'
@@ -1,5 +1,5 @@
1
1
  import type { VNodeChild } from '@pyreon/core'
2
- import { useContext } from '@pyreon/core'
2
+ import { nativeCompat, useContext } from '@pyreon/core'
3
3
  import { Provider as CoreProvider, context } from '@pyreon/ui-core'
4
4
  import { MODE_DEFAULT, THEME_MODES_INVERSED } from '../constants'
5
5
 
@@ -49,6 +49,10 @@ const Provider = ({ provider = CoreProvider, inversed, ...props }: TProvider): V
49
49
  return result ?? null
50
50
  }
51
51
 
52
+ // Mark as native — reads useContext() and delegates to CoreProvider, both
53
+ // of which need Pyreon's setup frame.
54
+ nativeCompat(Provider)
55
+
52
56
  export { context }
53
57
 
54
58
  export default Provider
package/src/env.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Minimal process type — just enough for `process.env.NODE_ENV` checks.
3
+ * Avoids requiring @types/node in consumers that import pyreon source
4
+ * via the `"bun"` export condition.
5
+ */
6
+ declare var process: { env: { NODE_ENV?: string } }
@@ -18,9 +18,6 @@ import { calculateStyles } from './utils/styles'
18
18
  import { getDimensionThemes, getTheme, getThemeByMode, getThemeFromChain } from './utils/theme'
19
19
 
20
20
  // Dev-time counter sink — see packages/internals/perf-harness for contract.
21
- interface ViteMeta {
22
- readonly env?: { readonly DEV?: boolean }
23
- }
24
21
  const _countSink = globalThis as { __pyreon_count__?: (name: string, n?: number) => void }
25
22
 
26
23
  /**
@@ -114,6 +111,28 @@ const rocketComponent: RocketComponent = (options) => {
114
111
  // dimension-dependent reserved keys are known (first mount), then reused.
115
112
  const _omitSetCache = new WeakMap<string[], Set<string>>()
116
113
 
114
+ // ── Dimension-prop memo (per-definition) ─────────────────────────────
115
+ // Keyed on theme identity → Map<keyString, { rocketstyle, rocketstate }>.
116
+ // The accessors below build a key from (mode, dimension prop tuple,
117
+ // pseudo state tuple) and look up here. On hit they return the SAME
118
+ // object identities for both `$rocketstyle` and `$rocketstate`, which
119
+ // lets the styler's existing `classCache` (keyed on those identities)
120
+ // skip the entire CSS resolve pipeline. On miss they compute fresh
121
+ // and store the result.
122
+ //
123
+ // Why this matters: B-FINDING.md (PR #342) showed every Button mount
124
+ // fires 22 styler.resolve calls even when the styler-sheet cache hits
125
+ // — the cache catches at the LAST step (insert dedup), but the resolve
126
+ // pipeline still runs to compute the hash. Stable accessor identities
127
+ // mean the styler's classCache hits earlier and the resolves don't run.
128
+ //
129
+ // LRU bound prevents unbounded growth from prop-tuple churn (e.g. a
130
+ // table where every cell has a unique state). 32 entries per theme
131
+ // covers ~99% of unique combos in real apps.
132
+ type RsMemoEntry = { readonly rocketstyle: object; readonly rocketstate: object }
133
+ const _rsMemo = new WeakMap<object, Map<string, RsMemoEntry>>()
134
+ const RS_MEMO_CAP = 32
135
+
117
136
  // --------------------------------------------------------
118
137
  // COMPOSE - high-order components
119
138
  // --------------------------------------------------------
@@ -171,7 +190,7 @@ const rocketComponent: RocketComponent = (options) => {
171
190
  // of the same component definition share the same dimension structure.
172
191
  let dimResult = _dimensionsCache.get(initialDimensionThemes as object)
173
192
  if (dimResult) {
174
- if ((import.meta as ViteMeta).env?.DEV === true)
193
+ if (process.env.NODE_ENV !== 'production')
175
194
  _countSink.__pyreon_count__?.('rocketstyle.dimensionsMap.hit')
176
195
  } else {
177
196
  dimResult = getDimensionsMap({
@@ -189,28 +208,90 @@ const rocketComponent: RocketComponent = (options) => {
189
208
  _reservedKeysCache.set(reservedPropNames as object, RESERVED_STYLING_PROPS_KEYS)
190
209
  }
191
210
 
211
+ // Silence "unused" warnings for initialBaseTheme / initialDimensionThemes —
212
+ // they're eagerly populated into ThemeManager caches so the first accessor
213
+ // call hits cache, but not referenced directly.
214
+ void initialBaseTheme
215
+ void initialDimensionThemes
216
+
217
+ // Capture pseudo from localCtx once at setup — pseudo properties are
218
+ // getters (from createLocalProvider) that read signals lazily.
219
+ // Passing them through preserves reactivity without subscribing here.
220
+ const localPseudo = localCtx?.pseudo
221
+
192
222
  // --------------------------------------------------
193
- // $rocketstyle as a FUNCTION ACCESSOR — fully reactive.
194
- // Re-evaluates when THEME, MODE, or dimension props change.
195
- // Props are resolved fresh each call so reactive prop accessors
196
- // (signals, getters) produce updated dimension values.
223
+ // Shared accessor resolver.
224
+ //
225
+ // Both `$rocketstyleAccessor` and `$rocketstateAccessor` derive from the
226
+ // same input set (theme, mode, dimension props, pseudo state). Folding
227
+ // them into one resolver lets the dimension-prop memo return the SAME
228
+ // object identities for both — which is what the styler's `classCache`
229
+ // (keyed on `(rocketstyle, rocketstate)` identity) needs to skip the
230
+ // resolve pipeline on cache hit.
231
+ //
232
+ // Reactive contract: this runs inside the styler's `computed()` (one per
233
+ // mounted instance). All signal reads — theme, mode, dimension props,
234
+ // pseudo getters from localCtx — are TRACKED, so any change re-runs the
235
+ // computed which re-resolves the entry. Same key → cached entry; new key
236
+ // → fresh computation, stored under LRU cap.
197
237
  // --------------------------------------------------
198
- const $rocketstyleAccessor = () => {
199
- if ((import.meta as ViteMeta).env?.DEV === true)
238
+ const _resolveRsEntry = (): RsMemoEntry => {
239
+ // Read reactive inputs (tracks theme + mode signals)
240
+ const theme = themeAttrs.theme
241
+ const mode = themeAttrs.mode
242
+
243
+ // Build key: mode | dimensionProps | pseudoState. Reading dimension
244
+ // props + pseudo signals here tracks them in the surrounding computed
245
+ // so any change re-runs us with a different key.
246
+ let key = mode as string
247
+ const propsRec = props as Record<string, unknown>
248
+ for (const dimName in dimensions) {
249
+ const v = propsRec[dimName]
250
+ // String/number/boolean serialize directly. Anything else (including
251
+ // undefined / objects) gets a typeof tag so we don't collide.
252
+ key +=
253
+ '|' +
254
+ (typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean'
255
+ ? String(v)
256
+ : v === undefined
257
+ ? ''
258
+ : '~' + typeof v)
259
+ }
260
+ for (const k of ALL_PSEUDO_KEYS) {
261
+ const propV = propsRec[k]
262
+ const localV = localPseudo?.[k as keyof typeof localPseudo]
263
+ const v = propV !== undefined ? propV : localV
264
+ key += '|' + (v === undefined ? '' : v ? '1' : '0')
265
+ }
266
+
267
+ // Cache lookup
268
+ let themeMemo = _rsMemo.get(theme as object)
269
+ if (!themeMemo) {
270
+ themeMemo = new Map()
271
+ _rsMemo.set(theme as object, themeMemo)
272
+ }
273
+
274
+ const cached = themeMemo.get(key)
275
+ if (cached) {
276
+ if (process.env.NODE_ENV !== 'production')
277
+ _countSink.__pyreon_count__?.('rocketstyle.dimensionMemo.hit')
278
+ // LRU touch: move to end so eviction targets oldest unused entry
279
+ themeMemo.delete(key)
280
+ themeMemo.set(key, cached)
281
+ return cached
282
+ }
283
+
284
+ // Miss: compute fresh. Counter measures actual theme resolutions
285
+ // (not accessor invocations) — see COUNTERS.md.
286
+ if (process.env.NODE_ENV !== 'production')
200
287
  _countSink.__pyreon_count__?.('rocketstyle.getTheme')
201
- // Read theme + mode LAZILY via the getter-backed themeAttrs object.
202
- // Both reads are tracked when this accessor runs inside a reactive
203
- // scope (styler's effect), so theme swap / mode toggle re-runs the
204
- // surrounding resolver and swaps the generated class.
205
- const theme = themeAttrs.theme // reactive: tracks theme signal
206
- const mode = themeAttrs.mode // reactive: tracks mode signal
207
288
 
208
289
  // Resolve base + dimension themes for the CURRENT theme. WeakMap
209
290
  // keyed on theme identity — stable-theme renders hit cache in O(1),
210
291
  // theme swaps fall through to recompute (once per new theme).
211
292
  const baseThemeHelper = ThemeManager.baseTheme
212
293
  if (baseThemeHelper.has(theme)) {
213
- if ((import.meta as ViteMeta).env?.DEV === true)
294
+ if (process.env.NODE_ENV !== 'production')
214
295
  _countSink.__pyreon_count__?.('rocketstyle.localThemeManager.hit')
215
296
  } else {
216
297
  baseThemeHelper.set(theme, getThemeFromChain(options.theme, theme))
@@ -219,7 +300,7 @@ const rocketComponent: RocketComponent = (options) => {
219
300
 
220
301
  const dimHelper = ThemeManager.dimensionsThemes
221
302
  if (dimHelper.has(theme)) {
222
- if ((import.meta as ViteMeta).env?.DEV === true)
303
+ if (process.env.NODE_ENV !== 'production')
223
304
  _countSink.__pyreon_count__?.('rocketstyle.localThemeManager.hit')
224
305
  } else {
225
306
  dimHelper.set(theme, getDimensionThemes(theme, options))
@@ -227,15 +308,15 @@ const rocketComponent: RocketComponent = (options) => {
227
308
  const themes = dimHelper.get(theme)
228
309
 
229
310
  // Resolve active dimensions from props (not localCtx which has pseudo getters)
230
- const rocketstate = _calculateStylingAttrs({
231
- props: pickStyledAttrs(props as Record<string, unknown>, reservedPropNames),
311
+ const rocketstateRaw = _calculateStylingAttrs({
312
+ props: pickStyledAttrs(propsRec, reservedPropNames),
232
313
  dimensions,
233
314
  })
234
315
 
235
316
  // Resolve mode-specific theme
236
317
  const modeBaseHelper = ThemeManager.modeBaseTheme[mode]
237
318
  if (modeBaseHelper.has(baseTheme)) {
238
- if ((import.meta as ViteMeta).env?.DEV === true)
319
+ if (process.env.NODE_ENV !== 'production')
239
320
  _countSink.__pyreon_count__?.('rocketstyle.localThemeManager.hit')
240
321
  } else {
241
322
  modeBaseHelper.set(baseTheme, getThemeByMode(baseTheme, mode))
@@ -244,54 +325,42 @@ const rocketComponent: RocketComponent = (options) => {
244
325
 
245
326
  const modeDimHelper = ThemeManager.modeDimensionTheme[mode]
246
327
  if (modeDimHelper.has(themes)) {
247
- if ((import.meta as ViteMeta).env?.DEV === true)
328
+ if (process.env.NODE_ENV !== 'production')
248
329
  _countSink.__pyreon_count__?.('rocketstyle.localThemeManager.hit')
249
330
  } else {
250
331
  modeDimHelper.set(themes, getThemeByMode(themes, mode))
251
332
  }
252
333
  const currentModeThemes = modeDimHelper.get(themes)
253
334
 
254
- return getTheme({
255
- rocketstate,
335
+ const rocketstyle = getTheme({
336
+ rocketstate: rocketstateRaw,
256
337
  themes: currentModeThemes,
257
338
  baseTheme: currentModeBaseTheme,
258
339
  transformKeys: options.transformKeys,
259
340
  appTheme: theme,
260
341
  })
261
- }
262
-
263
- // Silence "unused" warnings for initialBaseTheme / initialDimensionThemes —
264
- // they're eagerly populated into ThemeManager caches so the first accessor
265
- // call hits cache, but not referenced directly.
266
- void initialBaseTheme
267
- void initialDimensionThemes
268
342
 
269
- // --------------------------------------------------
270
- // $rocketstate as a FUNCTION ACCESSOR reactive on prop changes.
271
- // Re-evaluates active dimensions + pseudo state from current props.
272
- // --------------------------------------------------
273
- // Capture pseudo from localCtx once at setup — pseudo properties are
274
- // getters (from createLocalProvider) that read signals lazily.
275
- // Passing them through preserves reactivity without subscribing here.
276
- const localPseudo = localCtx?.pseudo
277
-
278
- const $rocketstateAccessor = () => {
279
- const rocketstate = _calculateStylingAttrs({
280
- props: pickStyledAttrs(props as Record<string, unknown>, reservedPropNames),
281
- dimensions,
282
- })
283
-
284
- // Read pseudo props fresh each call — props may have reactive getters
285
- // from _rp() wrapping. Reading inside the accessor (which runs in an
286
- // effect) ensures changes to pseudo props like active={isDark()} are tracked.
287
- const propPseudo = pick(props, ALL_PSEUDO_KEYS)
288
-
289
- return {
290
- ...rocketstate,
343
+ // $rocketstate carries dimension state + pseudo flags so the styler
344
+ // emits matching pseudo selectors (`:hover`, `:focus`, etc.).
345
+ const propPseudo = pick(propsRec, ALL_PSEUDO_KEYS)
346
+ const rocketstate = {
347
+ ...rocketstateRaw,
291
348
  pseudo: { ...localPseudo, ...propPseudo },
292
349
  }
350
+
351
+ // LRU eviction at cap — drop the oldest (first-inserted) entry.
352
+ if (themeMemo.size >= RS_MEMO_CAP) {
353
+ const oldestKey = themeMemo.keys().next().value
354
+ if (oldestKey !== undefined) themeMemo.delete(oldestKey)
355
+ }
356
+ const entry: RsMemoEntry = { rocketstyle, rocketstate }
357
+ themeMemo.set(key, entry)
358
+ return entry
293
359
  }
294
360
 
361
+ const $rocketstyleAccessor = () => _resolveRsEntry().rocketstyle
362
+ const $rocketstateAccessor = () => _resolveRsEntry().rocketstate
363
+
295
364
  // --------------------------------------------------
296
365
  // final props passed to WrappedComponent
297
366
  // --------------------------------------------------
@@ -299,7 +368,7 @@ const rocketComponent: RocketComponent = (options) => {
299
368
  // the key array on every mount. Same dimension structure = same Set.
300
369
  let omitSet = _omitSetCache.get(RESERVED_STYLING_PROPS_KEYS)
301
370
  if (omitSet) {
302
- if ((import.meta as ViteMeta).env?.DEV === true)
371
+ if (process.env.NODE_ENV !== 'production')
303
372
  _countSink.__pyreon_count__?.('rocketstyle.omitSet.hit')
304
373
  } else {
305
374
  omitSet = new Set([...RESERVED_STYLING_PROPS_KEYS, ...STATIC_OMIT_KEYS])
@@ -1 +0,0 @@
1
- {"version":3,"file":"index2.d.ts","names":[],"sources":["../../src/context/context.ts","../../src/constants/defaultDimensions.ts","../../src/types/pseudo.ts","../../src/types/utils.ts","../../src/types/styles.ts","../../src/constants/index.ts","../../src/types/theme.ts","../../src/types/dimensions.ts","../../src/types/config.ts","../../src/types/configuration.ts","../../src/types/attrs.ts","../../src/types/hoc.ts","../../src/types/rocketstyle.ts","../../src/types/rocketComponent.ts","../../src/init.ts","../../src/isRocketComponent.ts","../../src/index.ts"],"mappings":";;;;;KAKK,OAAA;EACH,QAAA;EACA,WAAA,GAAc,MAAA;AAAA,IACZ,MAAA;AAAA,KAEQ,SAAA;EACV,QAAA,EAAU,UAAA;EACV,KAAA,GAAQ,OAAA;EACR,IAAA;EACA,QAAA;EACA,QAAA,KAAa,KAAA,EAAO,MAAA,sBAA4B,UAAA;AAAA;;;AALlD;;;;;cAeM,QAAA;EAAY,QAAA;EAAA,QAAA;EAAA,GAAA;AAAA,GAAiD,SAAA,KAAY,UAAA;;;;;;;;cC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,IAAA,EAAM,IAAA,EAAM,aAAA,KAAkB,IAAA;EAAA,SAE3D,aAAA,EAAe,iBAAA,CAAkB,CAAA,EAAG,GAAA;EAAA,SACpC,aAAA,EAAe,EAAA;EAAA,SACf,eAAA,EAAiB,EAAA;EAAA,SACjB,OAAA,EAAS,GAAA;EAElB,cAAA;EACA,WAAA;EZjI6E;;;;;;;;;;;;;EAAA,SYgJpE,UAAA,EAAY,aAAA,EAAe,KAAA,EAAO,MAAA,sBAA4B,MAAA;AAAA;;;KCpK7D,eAAA,WACA,WAAA,GAAc,WAAA,YACd,IAAA,mBACE,IAAA,iBACF,UAAA,GAAa,iBAAA,mCAEpB,KAAA,EAAO,aAAA,CAAc,CAAA,EAAG,CAAA,MAAO,oBAAA,CAElC,YAAA,CAAa,CAAA,OAGb,CAAA,EACA,GAAA,UAGA,CAAA,EACA,EAAA;;;KCPU,WAAA,oBACM,UAAA,GAAa,iBAAA;EAG7B,UAAA;EACA;AAAA;EAEA,UAAA,GAAa,CAAA;EACb,WAAA,GAAc,EAAA;AAAA,iBACC,WAAA;EACf,IAAA;EACA;AAAA;EAEA,IAAA;EACA,SAAA,EAAW,CAAA;AAAA,MACP,UAAA,CAAW,eAAA,CAAgB,CAAA,UAAW,CAAA,EAAG,EAAA;AAAA,cA4CzC,WAAA,EAiBa,WAAA;;;KC1FP,iBAAA,OAAwB,SAAA,EAAW,CAAA;;cAGzC,iBAAA,EAAmB,iBAAA;;;;;;;;;;;;;;iBCmFT,YAAA,KAAiB,MAAA,kBAAA,CAC/B,KAAA,SAAc,CAAA,IAAK,CAAA,GAClB,CAAA"}
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["CoreProvider","useTheme","ThemeManager","LocalThemeManager","rocketstyleAttrsHoc","useTheme","defaultDimensions"],"sources":["../src/constants/index.ts","../src/context/context.ts","../src/constants/defaultDimensions.ts","../src/cache/LocalThemeManager.ts","../src/context/localContext.ts","../src/context/createLocalProvider.ts","../src/hooks/useTheme.ts","../src/utils/attrs.ts","../src/hoc/rocketstyleAttrsHoc.ts","../src/utils/chaining.ts","../src/utils/compose.ts","../src/utils/dimensions.ts","../src/utils/statics.ts","../src/utils/styles.ts","../src/utils/collection.ts","../src/utils/theme.ts","../src/rocketstyle.ts","../src/init.ts","../src/isRocketComponent.ts","../src/index.ts"],"sourcesContent":["// `import.meta.env.DEV` is provided by Vite/Rolldown at build time and\n// literal-replaced so prod bundles tree-shake the dev branch to zero bytes.\n// Typed through a narrowing interface so downstream packages don't need\n// `vite/client` in their tsconfigs to type-check this file transitively.\ninterface ViteMeta {\n readonly env?: { readonly DEV?: boolean }\n}\n/** Tree-shakeable dev-mode flag. `true` in dev, `false` (dead code eliminated) in prod. */\nexport const __DEV__: boolean = (import.meta as ViteMeta).env?.DEV === true\n\n/** Default theme mode used when no mode is provided via context. */\nexport const MODE_DEFAULT = 'light'\n\n/** Pseudo-state interaction keys tracked for styling (hover, active, focus, pressed). */\nexport const PSEUDO_KEYS = ['hover', 'active', 'focus', 'pressed'] as const\n\n/** Meta pseudo-state keys representing non-interactive states (disabled, readOnly). */\nexport const PSEUDO_META_KEYS = ['disabled', 'readOnly'] as const\n\n/** Supported theme mode flags. */\nexport const THEME_MODES = {\n light: true,\n dark: true,\n} as const\n\n/** Maps each theme mode to its inverse (light -> dark, dark -> light). */\nexport const THEME_MODES_INVERSED = {\n dark: 'light',\n light: 'dark',\n} as const\n\n/** Reserved configuration keys accepted by the `.config()` chaining method. */\nexport const CONFIG_KEYS = [\n 'provider',\n 'consumer',\n 'DEBUG',\n 'name',\n 'component',\n 'inversed',\n 'passProps',\n 'styled',\n] as const\n\n/** Keys for theme and styles chaining methods. */\nexport const STYLING_KEYS = ['theme', 'styles'] as const\nexport const STATIC_KEYS = [...STYLING_KEYS, 'compose'] as const\n\n/** Union of all reserved keys that cannot be used as dimension names. */\nexport const ALL_RESERVED_KEYS = [\n ...Object.keys(THEME_MODES),\n ...CONFIG_KEYS,\n ...STATIC_KEYS,\n 'attrs',\n] as const\n","import type { VNodeChild } from '@pyreon/core'\nimport { useContext } from '@pyreon/core'\nimport { Provider as CoreProvider, context } from '@pyreon/ui-core'\nimport { MODE_DEFAULT, THEME_MODES_INVERSED } from '../constants'\n\ntype Theme = {\n rootSize: number\n breakpoints?: Record<string, number>\n} & Record<string, unknown>\n\nexport type TProvider = {\n children: VNodeChild\n theme?: Theme | undefined\n mode?: 'light' | 'dark' | undefined\n inversed?: boolean | undefined\n provider?: ((props: Record<string, unknown>) => VNodeChild) | undefined\n}\n\n/**\n * Top-level theme and mode provider for rocketstyle components.\n * Reads the parent context, merges incoming props, and resolves\n * the active mode (with optional inversion for nested dark/light switching).\n *\n * In Pyreon, context is provided via provide() instead of React.Provider.\n */\nconst Provider = ({ provider = CoreProvider, inversed, ...props }: TProvider): VNodeChild => {\n const getCtx = useContext(context)\n const ctx = getCtx()\n\n const merged = { ...ctx, ...props, provider } as unknown as TProvider & Record<string, unknown>\n const { theme, mode, provider: RocketstyleProvider, children } = merged\n\n let newMode = MODE_DEFAULT\n\n if (mode) {\n newMode = inversed ? THEME_MODES_INVERSED[mode] : mode\n }\n\n const FinalProvider = RocketstyleProvider ?? CoreProvider\n const result = FinalProvider({\n mode: newMode,\n isDark: newMode === 'dark',\n isLight: newMode === 'light',\n ...(theme !== undefined ? { theme } : {}),\n provider,\n children,\n })\n\n return result ?? null\n}\n\nexport { context }\n\nexport default Provider\n","/**\n * Default dimension configuration for rocketstyle components.\n * Defines four built-in dimensions: `states`, `sizes`, `variants`,\n * and `multiple` (a multi-select dimension).\n */\nconst DEFAULT_DIMENSIONS = {\n states: 'state',\n sizes: 'size',\n variants: 'variant',\n multiple: {\n propName: 'multiple',\n multi: true,\n },\n modifiers: {\n propName: 'modifier',\n multi: true,\n transform: true,\n },\n} as const\n\nexport type DefaultDimensions = typeof DEFAULT_DIMENSIONS\n\nexport default DEFAULT_DIMENSIONS\n","/**\n * WeakMap-based multi-tier cache for computed theme objects.\n * Maintains separate caches for base themes, dimension themes,\n * and their light/dark mode variants to avoid recalculation on re-renders.\n */\nexport default class ThemeManager {\n baseTheme = new WeakMap()\n\n dimensionsThemes = new WeakMap()\n\n modeBaseTheme = { light: new WeakMap(), dark: new WeakMap() }\n\n modeDimensionTheme = { light: new WeakMap(), dark: new WeakMap() }\n}\n","import { createContext, useContext } from '@pyreon/core'\nimport type { PseudoState } from '../types/pseudo'\n\ntype LocalContext = Partial<\n {\n pseudo: PseudoState\n } & Record<string, string>\n>\n\n/**\n * Local context for propagating pseudo-state (hover, focus, pressed)\n * and additional styling attributes from a parent provider component\n * to its rocketstyle children.\n */\nconst localContext = createContext<LocalContext>({})\n\nconst EMPTY_CTX = { pseudo: {} } as LocalContext\n\n/**\n * Retrieves the local pseudo-state context. When a consumer callback\n * is provided, it transforms the raw context; otherwise returns defaults.\n *\n * In Pyreon, components are plain functions that run once — no useMemo needed.\n */\ntype UseLocalContext = (consumer: any) => LocalContext\nexport const useLocalContext: UseLocalContext = (consumer) => {\n const ctx = useContext(localContext)\n\n if (!consumer) return EMPTY_CTX\n\n const result = consumer((callback: any) => callback(ctx))\n return { pseudo: {}, ...result }\n}\n\nexport { localContext }\n\nexport default localContext\n","import { provide } from '@pyreon/core'\nimport { signal } from '@pyreon/reactivity'\nimport type { PseudoProps } from '../types/pseudo'\nimport type { ComponentFn } from '../types/utils'\nimport { localContext } from './localContext'\n\ntype Props = PseudoProps & Record<string, any>\n\n/**\n * Higher-order component that wraps a component with a LocalProvider,\n * detecting pseudo-states (hover, focus, pressed) via mouse/focus events\n * and broadcasting them through local context to child rocketstyle components.\n *\n * In Pyreon, context is provided via provide(), and state is managed\n * with signals instead of useState.\n */\nconst createLocalProvider = (WrappedComponent: ComponentFn<any>) => {\n const HOCComponent: ComponentFn<Props> = ({\n onMouseEnter,\n onMouseLeave,\n onMouseUp,\n onMouseDown,\n onFocus,\n onBlur,\n $rocketstate,\n ...props\n }) => {\n const hover = signal(false)\n const focus = signal(false)\n const pressed = signal(false)\n\n const events = {\n onMouseEnter: (e: MouseEvent) => {\n hover.set(true)\n if (onMouseEnter) onMouseEnter(e)\n },\n onMouseLeave: (e: MouseEvent) => {\n hover.set(false)\n pressed.set(false)\n if (onMouseLeave) onMouseLeave(e)\n },\n onMouseDown: (e: MouseEvent) => {\n pressed.set(true)\n if (onMouseDown) onMouseDown(e)\n },\n onMouseUp: (e: MouseEvent) => {\n pressed.set(false)\n if (onMouseUp) onMouseUp(e)\n },\n onFocus: (e: FocusEvent) => {\n focus.set(true)\n if (onFocus) onFocus(e)\n },\n onBlur: (e: FocusEvent) => {\n focus.set(false)\n if (onBlur) onBlur(e)\n },\n }\n\n // Use getters so pseudo-state signals are read lazily by consumers\n // inside their own reactive scopes — NOT eagerly during parent setup.\n // Without getters, hover()/focus()/pressed() reads here would register\n // as dependencies of any parent effect, causing cascading re-renders\n // on every mouse event.\n // Resolve $rocketstate if it's a function accessor (from EnhancedComponent)\n const resolvedState =\n typeof $rocketstate === 'function' ? $rocketstate() : $rocketstate\n const updatedState = {\n ...resolvedState,\n pseudo: {\n ...resolvedState?.pseudo,\n get hover() {\n return hover()\n },\n get focus() {\n return focus()\n },\n get pressed() {\n return pressed()\n },\n },\n }\n\n // Provide local context for child rocketstyle components\n provide(localContext, updatedState)\n\n return WrappedComponent({\n ...props,\n ...events,\n $rocketstate: updatedState,\n })\n }\n\n return HOCComponent\n}\n\nexport default createLocalProvider\n","import { useContext } from '@pyreon/core'\nimport { THEME_MODES_INVERSED } from '../constants'\nimport { context } from '../context/context'\nimport type { ThemeModeKeys } from '../types/theme'\n\ntype Context = {\n theme: Record<string, unknown>\n mode: ThemeModeKeys\n isDark: boolean\n isLight: boolean\n}\n\ntype UseThemeAttrs = ({ inversed }: { inversed?: boolean | undefined }) => Context\n\n/**\n * Retrieves the current theme object and resolved mode from context.\n *\n * Returns an object with getter properties so that mode/isDark/isLight\n * are evaluated lazily on each access. The context is a ReactiveContext,\n * so useContext returns `() => CoreContextValue` — we call it inside\n * each getter to ensure reactive tracking.\n */\nconst useThemeAttrs: UseThemeAttrs = ({ inversed }) => {\n // ReactiveContext: useContext returns () => CoreContextValue.\n // Call the getter inside each property getter for reactive tracking.\n const getCtx = useContext(context)\n\n return {\n get theme() {\n return getCtx().theme ?? ({} as Record<string, unknown>)\n },\n get mode() {\n const ctxMode = getCtx().mode ?? 'light'\n return inversed ? THEME_MODES_INVERSED[ctxMode] : ctxMode\n },\n get isDark() {\n const ctxDark = getCtx().isDark ?? false\n return inversed ? !ctxDark : ctxDark\n },\n get isLight() {\n const ctxDark = getCtx().isDark ?? false\n const isDark = inversed ? !ctxDark : ctxDark\n return !isDark\n },\n }\n}\n\nexport default useThemeAttrs\n","import type { MultiKeys } from '../types/dimensions'\n\n// --------------------------------------------------------\n// remove undefined props\n// --------------------------------------------------------\n/** Strips keys with `undefined` values so they don't shadow default props during merging. */\ntype RemoveUndefinedProps = <T extends Record<string, any>>(props: T) => Partial<T>\n\nexport const removeUndefinedProps: RemoveUndefinedProps = (props) => {\n const result: Partial<typeof props> = {}\n for (const key in props) {\n if (props[key] !== undefined) result[key] = props[key]\n }\n return result\n}\n\n// --------------------------------------------------------\n// pick styled props\n// --------------------------------------------------------\n/** Picks only the props whose keys exist in the dimension keywords lookup and have truthy values. */\nexport const pickStyledAttrs = <\n T extends Record<string, any>,\n K extends Record<string, true | undefined>,\n>(\n props: T,\n keywords: K,\n): { [I in keyof K & keyof T]: T[I] } => {\n const result: Record<string, unknown> = {}\n for (const key of Object.keys(props)) {\n if (keywords[key] && props[key]) result[key] = props[key]\n }\n return result as { [I in keyof K & keyof T]: T[I] }\n}\n\n// --------------------------------------------------------\n// combine values\n// --------------------------------------------------------\n/**\n * Returns a curried function that evaluates an array of `.attrs()` callbacks,\n * spreading each result into a single merged props object via `Object.assign`.\n */\ntype OptionFunc<A> = (...arg: A[]) => Record<string, unknown>\ntype CalculateChainOptions = <A>(\n options?: OptionFunc<A>[],\n) => (args: A[]) => ReturnType<OptionFunc<A>>\n\nexport const calculateChainOptions: CalculateChainOptions = (options) => (args) => {\n if (!options || options.length === 0) return {}\n\n return options.reduce<Record<string, unknown>>(\n (acc, item) => Object.assign(acc, item(...args)),\n {},\n )\n}\n\n// --------------------------------------------------------\n// get style attributes\n// --------------------------------------------------------\n/**\n * Resolves the active value for each styling dimension from component props.\n * First checks for explicit prop values (string, number, or array for multi-keys),\n * then falls back to boolean shorthand props when `useBooleans` is enabled.\n */\ntype CalculateStylingAttrs = ({\n useBooleans,\n multiKeys,\n}: {\n useBooleans?: boolean\n multiKeys?: MultiKeys\n}) => ({\n props,\n dimensions,\n}: {\n props: Record<string, unknown>\n dimensions: Record<string, unknown>\n}) => Record<string, any>\nexport const calculateStylingAttrs: CalculateStylingAttrs =\n ({ useBooleans, multiKeys }) =>\n ({ props, dimensions }) => {\n const result: Record<string, any> = {}\n\n // (1) find dimension keys values & initialize\n for (const item in dimensions) {\n const pickedProp = props[item]\n const t = typeof pickedProp\n\n if (multiKeys?.[item] && Array.isArray(pickedProp)) {\n result[item] = pickedProp\n } else if (t === 'string' || t === 'number') {\n result[item] = pickedProp\n } else {\n result[item] = undefined\n }\n }\n\n // (2) if booleans are being used let's find the rest\n // Use `in` operator on the dimension map instead of allocating\n // a new Set per dimension — the map is already an object with\n // the keywords as keys.\n if (useBooleans) {\n for (const key in result) {\n if (result[key]) continue // already assigned\n\n const dimensionMap = dimensions[key] as Record<string, unknown>\n const isMultiKey = multiKeys?.[key]\n let newDimensionValue: string | string[] | undefined\n\n if (isMultiKey) {\n const matches: string[] = []\n for (const propKey in props) {\n if (propKey in dimensionMap) matches.push(propKey)\n }\n newDimensionValue = matches.length > 0 ? matches : undefined\n } else {\n // Iterate props to find last matching keyword\n // (last wins for priority)\n for (const k in props) {\n if (k in dimensionMap && props[k]) {\n newDimensionValue = k\n }\n }\n }\n\n result[key] = newDimensionValue\n }\n }\n\n return result\n }\n","import { render } from '@pyreon/ui-core'\nimport { useTheme } from '../hooks'\nimport type { Configuration } from '../types/configuration'\nimport type { ComponentFn } from '../types/utils'\nimport { calculateChainOptions, removeUndefinedProps } from '../utils/attrs'\n\nexport type RocketStyleHOC = ({\n inversed,\n attrs,\n priorityAttrs,\n}: Pick<Configuration, 'inversed' | 'attrs' | 'priorityAttrs'>) => (\n WrappedComponent: ComponentFn<any>,\n) => ComponentFn<any>\n\n/**\n * HOC that resolves the `.attrs()` chain before the inner component renders.\n * Evaluates both regular and priority attrs callbacks with the current theme\n * and mode, then merges the results with explicit props (priority attrs\n * are applied first, regular attrs can be overridden by direct props).\n *\n * In Pyreon, there is no forwardRef — ref flows as a normal prop.\n * Components are plain functions.\n */\nconst rocketStyleHOC: RocketStyleHOC = ({ inversed, attrs, priorityAttrs }) => {\n const calculateAttrs = calculateChainOptions(attrs)\n const calculatePriorityAttrs = calculateChainOptions(priorityAttrs)\n\n const Enhanced = (WrappedComponent: ComponentFn<any>) => {\n const HOCComponent: ComponentFn<any> = (props) => {\n // IMPORTANT: Do NOT destructure — useTheme returns getter properties.\n // Destructuring calls getters once and captures static values.\n // Keep the object reference so properties re-evaluate lazily.\n const themeAttrs = useTheme({ inversed })\n\n // Remove undefined props not to override potential default props\n const filteredProps = removeUndefinedProps(props)\n\n // Read theme attrs eagerly — .attrs() callbacks run once at mount.\n // Mode-dependent styling is handled reactively by the $rocketstyle\n // accessor in EnhancedComponent, not by re-running attrs.\n const callbackParams = [\n themeAttrs.theme,\n { render, mode: themeAttrs.mode, isDark: themeAttrs.isDark, isLight: themeAttrs.isLight },\n ]\n\n const prioritizedAttrs = calculatePriorityAttrs([filteredProps, ...callbackParams])\n\n const finalAttrs = calculateAttrs([\n {\n ...prioritizedAttrs,\n ...filteredProps,\n },\n ...callbackParams,\n ])\n\n const finalProps = {\n ...prioritizedAttrs,\n ...finalAttrs,\n ...filteredProps,\n }\n\n return WrappedComponent(finalProps)\n }\n return HOCComponent\n }\n\n return Enhanced\n}\n\nexport default rocketStyleHOC\n","type Func = (...args: any) => Record<string, unknown>\ntype Obj = Record<string, unknown>\n\n// --------------------------------------------------------\n// Chain Options\n// --------------------------------------------------------\n/**\n * Appends a new option (function or plain object) to an existing chain\n * of option callbacks. Objects are wrapped in a thunk for uniform handling.\n */\ntype ChainOptions = (opts: Obj | Func | undefined, defaultOpts: Func[]) => Func[]\n\nexport const chainOptions: ChainOptions = (opts, defaultOpts = []) => {\n const result = [...defaultOpts]\n\n if (typeof opts === 'function') result.push(opts)\n else if (typeof opts === 'object') result.push(() => opts)\n\n return result\n}\n\n// --------------------------------------------------------\n// Chain Or Options\n// --------------------------------------------------------\n/**\n * For each key, picks the new value if truthy, otherwise falls back\n * to the default. Used for config keys that replace rather than merge.\n */\ntype ChainOrOptions = (\n keys: readonly string[],\n opts: Obj,\n defaultOpts: Obj,\n) => Record<string, unknown>\n\nexport const chainOrOptions: ChainOrOptions = (keys, opts, defaultOpts) =>\n keys.reduce((acc, item) => ({ ...acc, [item]: opts[item] || defaultOpts[item] }), {})\n\n// --------------------------------------------------------\n// Chain Reserved Options\n// --------------------------------------------------------\n/**\n * Chains option callbacks for reserved dimension and styling keys,\n * delegating to `chainOptions` for each key individually.\n */\ntype ChainReservedKeyOptions = (\n keys: readonly string[],\n opts: Record<string, Obj | Func>,\n defaultOpts: Record<string, Func[]>,\n) => Record<string, ReturnType<typeof chainOptions>>\n\nexport const chainReservedKeyOptions: ChainReservedKeyOptions = (keys, opts, defaultOpts) =>\n keys.reduce(\n (acc, item) => ({\n ...acc,\n [item]: chainOptions(opts[item], defaultOpts[item] ?? []),\n }),\n {},\n )\n","/**\n * Extracts HOC functions from the compose configuration object,\n * filters out non-function entries, and reverses them so the\n * outermost HOC in the chain wraps first (inside-out composition).\n */\ntype CalculateHocsFuncs = (options: Record<string, any>) => ((arg: any) => any)[]\n\nexport const calculateHocsFuncs: CalculateHocsFuncs = (options = {}) =>\n Object.values(options)\n .filter((item) => typeof item === 'function')\n .reverse()\n","import { get, isEmpty, set } from '@pyreon/ui-core'\nimport type { Dimensions, DimensionValue, MultiKeys } from '../types/dimensions'\n\n// --------------------------------------------------------\n// Is value a valid key\n// --------------------------------------------------------\n/** Checks whether a dimension value is defined and not explicitly disabled (false). */\ntype IsValidKey = (value: any) => boolean\nexport const isValidKey: IsValidKey = (value) =>\n value !== undefined && value !== null && value !== false\n\n// --------------------------------------------------------\n// Is value a multi key\n// --------------------------------------------------------\n/** Determines if a dimension value is a multi-key config object, returning [isMulti, propName]. */\ntype IsMultiKey = (value: string | Record<string, unknown>) => [boolean, string]\nexport const isMultiKey: IsMultiKey = (value) => {\n if (typeof value === 'object' && value !== null) return [true, get(value, 'propName') as string]\n return [false, value]\n}\n\n// --------------------------------------------------------\n// calculate dimensions map\n// --------------------------------------------------------\n/**\n * Builds a two-level map (`keysMap`) of dimension -> option -> true,\n * and a flat `keywords` lookup of all prop names reserved by dimensions\n * (including boolean shorthand keys when `useBooleans` is enabled).\n */\ntype GetDimensionsMap = <T extends Record<string, any>>({\n themes,\n useBooleans,\n}: {\n themes: T\n useBooleans?: boolean\n}) => { keysMap: Record<string, any>; keywords: Record<string, any> }\n\nexport const getDimensionsMap: GetDimensionsMap = ({ themes, useBooleans }) => {\n const result = {\n keysMap: {} as Record<string, any>,\n keywords: {} as Record<string, any>,\n }\n\n if (isEmpty(themes)) return result\n\n return Object.entries(themes).reduce((accumulator, [key, value]) => {\n const { keysMap, keywords } = accumulator\n keywords[key] = true\n\n Object.entries(value).forEach(([itemKey, itemValue]) => {\n if (!isValidKey(itemValue)) return\n\n if (useBooleans) {\n keywords[itemKey] = true\n }\n\n set(keysMap, [key, itemKey], true)\n })\n\n return accumulator\n }, result)\n}\n\n// --------------------------------------------------------\n// simple object getters\n// --------------------------------------------------------\n/** Returns the keys of an object with proper typing. */\ntype GetKeys = <T extends Record<string, unknown>>(obj: T) => Array<keyof T>\nexport const getKeys: GetKeys = (obj) => Object.keys(obj)\n\ntype GetValues = <T extends Record<string, unknown>, K extends keyof T>(obj: T) => T[K][]\nexport const getValues = (<T extends Record<string, unknown>>(obj: T) =>\n Object.values(obj)) as GetValues\n\n// --------------------------------------------------------\n// get dimensions values array\n// --------------------------------------------------------\n/** Extracts the prop name from each dimension value, unwrapping multi-key config objects. */\ntype ValueType<T> = T extends string ? T : T[][0]\ntype GetDimensionsValues = <T extends Dimensions, K extends keyof T>(obj: T) => ValueType<T[K]>[]\n\nexport const getDimensionsValues = (<T extends Dimensions>(obj: T) =>\n getValues(obj).map((item: DimensionValue) => {\n if (typeof item === 'object') {\n return item.propName as string\n }\n\n return item\n })) as GetDimensionsValues\n\n// --------------------------------------------------------\n// get multiple dimensions map\n// --------------------------------------------------------\n/** Builds a lookup of dimension prop names that accept multiple simultaneous values. */\ntype GetMultipleDimensions = <T extends Dimensions>(obj: T) => MultiKeys<T>\n\nexport const getMultipleDimensions: GetMultipleDimensions = (obj) =>\n getValues(obj).reduce(\n (accumulator, value: DimensionValue) => {\n if (typeof value === 'object') {\n if (value.multi === true) accumulator[value.propName] = true\n }\n\n return accumulator\n },\n {} as Record<string, true>,\n )\n\n// --------------------------------------------------------\n// get transform dimensions map\n// --------------------------------------------------------\n/** Builds a lookup of dimension prop names that are transform dimensions (evaluated last with function values). */\ntype TransformKeys = Partial<Record<string, true>>\ntype GetTransformDimensions = <T extends Dimensions>(obj: T) => TransformKeys\n\nexport const getTransformDimensions: GetTransformDimensions = (obj) =>\n getValues(obj).reduce(\n (accumulator, value: DimensionValue) => {\n if (typeof value === 'object') {\n if (value.transform === true) accumulator[value.propName] = true\n }\n\n return accumulator\n },\n {} as Record<string, true>,\n )\n","import { isEmpty } from '@pyreon/ui-core'\nimport { STATIC_KEYS } from '../constants'\n\n// --------------------------------------------------------\n// helpers for create statics chaining methods on component\n// --------------------------------------------------------\n/**\n * Attaches chaining static methods (e.g. `.states()`, `.sizes()`, `.theme()`)\n * to a component. Each method calls `cloneAndEnhance` with the corresponding key.\n */\ntype CreateStaticsChainingEnhancers = <O extends Record<string, any>, DK extends string[]>(props: {\n context: Record<string, any>\n dimensionKeys: DK\n func: (defaultOpts: O, opts: any) => void\n options: O\n}) => void\n\nexport const createStaticsChainingEnhancers: CreateStaticsChainingEnhancers = ({\n context,\n dimensionKeys,\n func,\n options,\n}) => {\n const keys = [...dimensionKeys, ...STATIC_KEYS]\n\n keys.forEach((item) => {\n context[item] = (props: any) => func(options, { [item]: props })\n })\n}\n\n// --------------------------------------------------------\n// helpers for create statics on component\n// --------------------------------------------------------\n/** Copies user-defined static properties onto the component's `meta` object. */\ntype CreateStaticsEnhancers = (params: {\n context: Record<string, any>\n options: Record<string, any>\n}) => void\n\nexport const createStaticsEnhancers: CreateStaticsEnhancers = ({ context, options }) => {\n if (!isEmpty(options)) {\n Object.assign(context, options)\n }\n}\n","import { config } from '@pyreon/ui-core'\nimport type { StylesCbArray } from '../types/styles'\n\n// --------------------------------------------------------\n// Calculate styles\n// --------------------------------------------------------\n/**\n * Evaluates an array of style callback functions with the configured\n * `css` tagged-template helper, producing the final CSS interpolations\n * to be passed into the styled-component template literal.\n */\ntype CalculateStyles = (styles: StylesCbArray | undefined) => ReturnType<StylesCbArray[number]>[]\n\nexport const calculateStyles: CalculateStyles = (styles) => {\n if (!styles) return []\n\n return styles.map((item) => item(config.css as Parameters<typeof item>[0]))\n}\n","// --------------------------------------------------------\n// Remove Nullable values\n// --------------------------------------------------------\n/** Filters out entries with `null`, `undefined`, or `false` values from an object. */\ntype RemoveNullableValues = (obj: Record<string, any>) => Record<string, any>\nexport const removeNullableValues: RemoveNullableValues = (obj) =>\n Object.entries(obj)\n .filter(([, v]) => v != null && v !== false)\n .reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {})\n","import { config, isEmpty, merge } from '@pyreon/ui-core'\nimport type { ThemeModeCallback } from '../types/theme'\nimport { removeNullableValues } from './collection'\nimport { isMultiKey } from './dimensions'\n\n// --------------------------------------------------------\n// Theme Mode Callback\n// --------------------------------------------------------\nconst MODE_CALLBACK_BRAND = Symbol.for('pyreon.themeModeCallback')\n\n/** Creates a mode-switching function that returns the light or dark value based on the active mode. */\nexport const themeModeCallback: ThemeModeCallback = (light, dark) => {\n const fn = (mode: string) => {\n if (!mode || mode === 'light') return light\n return dark\n }\n ;(fn as unknown as Record<string, unknown>).__brand = MODE_CALLBACK_BRAND\n return fn\n}\n\n// --------------------------------------------------------\n// Theme Mode Callback Check\n// --------------------------------------------------------\n/** Detects whether a value is a `themeModeCallback` function via Symbol brand. */\ntype IsModeCallback = (value: unknown) => boolean\nconst isModeCallback: IsModeCallback = (value: unknown) =>\n typeof value === 'function' &&\n (value as unknown as Record<string, unknown>).__brand === MODE_CALLBACK_BRAND\n\n// --------------------------------------------------------\n// Get Theme From Chain\n// --------------------------------------------------------\n/** Reduces an array of chained `.theme()` callbacks into a single merged theme object. */\ntype OptionFunc = (...arg: any) => Record<string, unknown>\ntype GetThemeFromChain = (\n options: OptionFunc[] | undefined | null,\n theme: Record<string, any>,\n) => ReturnType<OptionFunc>\n\nexport const getThemeFromChain: GetThemeFromChain = (options, theme) => {\n const result = {}\n if (!options || isEmpty(options)) return result\n\n return options.reduce(\n (acc, item) => merge(acc, item(theme, themeModeCallback, config.css)),\n result,\n )\n}\n\n// --------------------------------------------------------\n// calculate dimension themes\n// --------------------------------------------------------\n/**\n * Computes the theme object for each dimension by evaluating its\n * chained callbacks against the global theme, then strips nullable values.\n */\ntype GetDimensionThemes = (\n theme: Record<string, any>,\n options: Record<string, any>,\n) => Record<string, any>\n\nexport const getDimensionThemes: GetDimensionThemes = (theme, options) => {\n const dims = options.dimensions\n if (isEmpty(dims)) return {}\n\n const result: Record<string, any> = {}\n\n for (const key in dims) {\n const [, dimension] = isMultiKey(dims[key] as string | Record<string, unknown>)\n const helper = options[key]\n\n if (Array.isArray(helper) && helper.length > 0) {\n result[dimension] = removeNullableValues(getThemeFromChain(helper, theme))\n }\n }\n\n return result\n}\n\n// --------------------------------------------------------\n// combine values\n// --------------------------------------------------------\n/** Reduces an array of option callbacks by calling each with the given args and deep-merging results. */\ntype CalculateChainOptions = (\n options: OptionFunc[] | undefined | null,\n args: any[],\n) => Record<string, any>\n\nexport const calculateChainOptions: CalculateChainOptions = (options, args) => {\n const result = {}\n if (!options || isEmpty(options)) return result\n\n return options.reduce((acc, item) => merge(acc, item(...args)), result)\n}\n\n// --------------------------------------------------------\n// generate theme\n// --------------------------------------------------------\n/**\n * Generates the final theme object by starting with the base theme\n * and merging in dimension-specific theme slices based on the current\n * rocketstate (active dimension values). Supports multi-key dimensions.\n *\n * Transform dimensions (marked with `transform: true`) are evaluated last.\n * Their values are functions that receive the fully accumulated theme and\n * return overrides — enabling derived styles like \"outlined\" or \"inversed\".\n */\nexport type GetTheme = (params: {\n rocketstate: Record<string, string | string[]>\n themes: Record<string, Record<string, any>>\n baseTheme: Record<string, any>\n transformKeys?: Partial<Record<string, true>>\n /** App theme from context — passed to transform dimension callbacks. */\n appTheme?: Record<string, any>\n}) => Record<string, unknown>\n\n// Shared empty object for pseudo-state defaults — allocated once, reused by\n// every getTheme call. Frozen to prevent accidental mutation.\nconst EMPTY_PSEUDO: Record<string, never> = Object.freeze({}) as Record<string, never>\n\nexport const getTheme: GetTheme = ({ rocketstate, themes, baseTheme, transformKeys, appTheme }) => {\n // Spread baseTheme into result — this is unavoidable (we must not mutate\n // the cached baseTheme). But we merge dimension slices in-place onto\n // finalTheme instead of creating a new {} target each merge() call.\n const finalTheme: Record<string, any> = { ...baseTheme }\n type TransformFn = (\n currentTheme: Record<string, any>,\n currentAppTheme: Record<string, any>,\n mode: typeof themeModeCallback,\n cssFn: typeof config.css,\n ) => Record<string, any>\n const deferredTransforms: TransformFn[] = []\n\n for (const key in rocketstate) {\n const value = rocketstate[key]\n if (value == null) continue\n const keyTheme: Record<string, any> = themes[key] ?? {}\n const isTransform = transformKeys?.[key]\n\n const mergeValue = (item: string) => {\n const val = keyTheme[item]\n if (val == null) return\n if (isTransform && typeof val === 'function') {\n deferredTransforms.push(val as TransformFn)\n } else {\n // Merge in-place onto finalTheme — avoids allocating a fresh {}\n // as merge target on every dimension slice.\n merge(finalTheme, val)\n }\n }\n\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) mergeValue(value[i] as string)\n } else {\n mergeValue(value as string)\n }\n }\n\n // Apply transform dimension values last with the fully accumulated theme\n for (let i = 0; i < deferredTransforms.length; i++) {\n merge(finalTheme, deferredTransforms[i]!(finalTheme, appTheme ?? {}, themeModeCallback, config.css))\n }\n\n // Ensure pseudo-state keys always exist as objects so .styles() can\n // destructure without defaults: const { hover, focus, ... } = $rocketstyle\n // Uses a frozen shared empty object instead of allocating 6 new {} per call.\n finalTheme.hover ??= EMPTY_PSEUDO\n finalTheme.focus ??= EMPTY_PSEUDO\n finalTheme.active ??= EMPTY_PSEUDO\n finalTheme.disabled ??= EMPTY_PSEUDO\n finalTheme.pressed ??= EMPTY_PSEUDO\n finalTheme.readOnly ??= EMPTY_PSEUDO\n\n return finalTheme\n}\n\n// --------------------------------------------------------\n// resolve theme by mode\n// --------------------------------------------------------\n/**\n * Recursively traverses a theme object and resolves any `themeModeCallback`\n * functions to their concrete light or dark values for the given mode.\n */\nexport type GetThemeByMode = (\n object: Record<string, any>,\n mode: 'light' | 'dark',\n) => Partial<{\n baseTheme: Record<string, unknown>\n themes: Record<string, unknown>\n}>\n\nexport const getThemeByMode: GetThemeByMode = (object, mode) =>\n Object.keys(object).reduce(\n (acc, key) => {\n const value = object[key]\n\n if (typeof value === 'object' && value !== null) {\n acc[key] = getThemeByMode(value, mode)\n } else if (isModeCallback(value)) {\n acc[key] = value(mode)\n } else {\n acc[key] = value\n }\n\n return acc\n },\n {} as Record<string, any>,\n )\n","import { compose, config, hoistNonReactStatics, omit, pick, render } from '@pyreon/ui-core'\nimport { LocalThemeManager } from './cache'\nimport { CONFIG_KEYS, PSEUDO_KEYS, PSEUDO_META_KEYS, STYLING_KEYS, __DEV__ } from './constants'\nimport createLocalProvider from './context/createLocalProvider'\nimport { useLocalContext } from './context/localContext'\nimport { rocketstyleAttrsHoc } from './hoc'\nimport { useTheme } from './hooks'\nimport type { Configuration, ExtendedConfiguration } from './types/configuration'\nimport type { RocketComponent } from './types/rocketComponent'\nimport type { InnerComponentProps, RocketStyleComponent } from './types/rocketstyle'\nimport type { ComponentFn } from './types/utils'\nimport { calculateChainOptions, calculateStylingAttrs, pickStyledAttrs } from './utils/attrs'\nimport { chainOptions, chainOrOptions, chainReservedKeyOptions } from './utils/chaining'\nimport { calculateHocsFuncs } from './utils/compose'\nimport { getDimensionsMap } from './utils/dimensions'\nimport { createStaticsChainingEnhancers, createStaticsEnhancers } from './utils/statics'\nimport { calculateStyles } from './utils/styles'\nimport { getDimensionThemes, getTheme, getThemeByMode, getThemeFromChain } from './utils/theme'\n\n// Dev-time counter sink — see packages/internals/perf-harness for contract.\ninterface ViteMeta {\n readonly env?: { readonly DEV?: boolean }\n}\nconst _countSink = globalThis as { __pyreon_count__?: (name: string, n?: number) => void }\n\n/**\n * Core rocketstyle component factory. Creates a fully-featured Pyreon component\n * that integrates theme management (with light/dark mode support), multi-tier\n * WeakMap caching, dimension-based styling props, pseudo-state detection, and\n * chainable static methods (`.attrs()`, `.theme()`, `.styles()`, `.config()`, etc.).\n *\n * In Pyreon, components are plain functions that run once per mount.\n * No forwardRef, useMemo, useState — ref flows as a normal prop.\n */\n\n// --------------------------------------------------------\n// cloneAndEnhance\n// --------------------------------------------------------\ntype CloneAndEnhance = (\n defaultOpts: Configuration,\n opts: Partial<ExtendedConfiguration>,\n) => ReturnType<typeof rocketComponent>\n\n/** Clones the current configuration and merges new options, returning a fresh rocketComponent. */\nconst cloneAndEnhance: CloneAndEnhance = (defaultOpts, opts) =>\n rocketComponent({\n ...defaultOpts,\n attrs: chainOptions(opts.attrs, defaultOpts.attrs),\n filterAttrs: [...(defaultOpts.filterAttrs ?? []), ...(opts.filterAttrs ?? [])],\n priorityAttrs: chainOptions(opts.priorityAttrs, defaultOpts.priorityAttrs),\n statics: { ...defaultOpts.statics, ...opts.statics },\n compose: { ...defaultOpts.compose, ...opts.compose },\n ...chainOrOptions(CONFIG_KEYS, opts, defaultOpts),\n ...chainReservedKeyOptions([...defaultOpts.dimensionKeys, ...STYLING_KEYS], opts, defaultOpts),\n } as Parameters<typeof rocketComponent>[0])\n\n// --------------------------------------------------------\n// rocketComponent\n// --------------------------------------------------------\n// @ts-expect-error\nconst rocketComponent: RocketComponent = (options) => {\n const { component, styles } = options\n const { styled } = config\n\n const _calculateStylingAttrs = calculateStylingAttrs({\n multiKeys: options.multiKeys,\n useBooleans: options.useBooleans,\n })\n\n const componentName = options.name ?? options.component.displayName ?? options.component.name\n\n // Create styled component with all options.styles if available.\n // Rocketstyle CSS lives in `@layer rocketstyle`, which is declared\n // AFTER `@layer elements` in the cascade ordering (see sheet.ts).\n // This ensures rocketstyle theme styles always override element base\n // styles regardless of source order.\n const STYLED_COMPONENT =\n (component.IS_ROCKETSTYLE ?? options.styled !== true)\n ? component\n : styled(component, { layer: 'rocketstyle' })`\n ${calculateStyles(styles)};\n `\n\n // --------------------------------------------------------\n // COMPONENT - Final component to be rendered\n // --------------------------------------------------------\n const RenderComponent: ComponentFn<any> = options.provider\n ? createLocalProvider(STYLED_COMPONENT)\n : STYLED_COMPONENT\n\n // --------------------------------------------------------\n // THEME - Cached & Calculated theme(s)\n // --------------------------------------------------------\n const ThemeManager = new LocalThemeManager()\n\n // ── Per-definition caches (shared across all instances) ──────────────\n // getDimensionsMap + Object.keys(reservedPropNames) are theme-independent\n // (dimension structure comes from .sizes()/.states()/.variants() chain,\n // not from runtime theme values). Cache them so 50 instances of the same\n // component definition skip the rebuild entirely.\n const _dimensionsCache = new WeakMap<\n object,\n { keysMap: Record<string, unknown>; keywords: Record<string, true | undefined> }\n >()\n const _reservedKeysCache = new WeakMap<object, string[]>()\n\n // Pre-compute merged key arrays once per definition (not per mount)\n const ALL_PSEUDO_KEYS = [...PSEUDO_KEYS, ...PSEUDO_META_KEYS]\n // Static portion of omit keys — PSEUDO_KEYS + filterAttrs + 'pseudo' are definition-scoped.\n // RESERVED_STYLING_PROPS_KEYS is dimension-dependent but also cached per definition.\n // 'pseudo' is included here so we can skip the destructuring spread of mergeProps.\n const STATIC_OMIT_KEYS = ['pseudo', ...PSEUDO_KEYS, ...(options.filterAttrs ?? [])]\n // Pre-built Set for omit() — avoids per-call Set allocation. Built once the\n // dimension-dependent reserved keys are known (first mount), then reused.\n const _omitSetCache = new WeakMap<string[], Set<string>>()\n\n // --------------------------------------------------------\n // COMPOSE - high-order components\n // --------------------------------------------------------\n const hocsFuncs = [rocketstyleAttrsHoc(options), ...calculateHocsFuncs(options.compose)]\n\n // --------------------------------------------------------\n // ENHANCED COMPONENT\n // --------------------------------------------------------\n // In Pyreon, components are plain functions — no forwardRef needed.\n // Ref flows as a normal prop through the chain.\n const EnhancedComponent: ComponentFn<InnerComponentProps> = (props) => {\n // --------------------------------------------------\n // hover - focus - pressed state passed via context from parent component\n // --------------------------------------------------\n const localCtx = useLocalContext(options.consumer)\n\n // --------------------------------------------------\n // general theme and theme mode dark / light passed in context\n // --------------------------------------------------\n // IMPORTANT: Do NOT destructure — useTheme returns getter properties.\n // Destructuring calls getters once and captures static values.\n // Keep the object reference so mode/isDark/isLight re-evaluate lazily.\n const themeAttrs = useTheme(options)\n\n // --------------------------------------------------\n // Dimension KEY structure is theme-independent — dimension names (e.g.\n // `level3`, `primary`) come from the .sizes()/.states()/.variants()\n // callback structure at component-definition time, not from theme values.\n // Compute reservedPropNames + dimensions once using the initial theme;\n // they remain stable across theme swaps.\n //\n // Dimension VALUES (used in $rocketstyleAccessor) DO depend on theme and\n // are resolved inside the accessor on each tracked invocation — allowing\n // whole-theme swaps (user preference themes) to re-resolve CSS without\n // remounting. WeakMap caches in ThemeManager keep the common static-theme\n // case O(1).\n // --------------------------------------------------\n const initialTheme = themeAttrs.theme\n const initialBaseTheme = (() => {\n const helper = ThemeManager.baseTheme\n if (!helper.has(initialTheme)) {\n helper.set(initialTheme, getThemeFromChain(options.theme, initialTheme))\n }\n return helper.get(initialTheme)\n })()\n const initialDimensionThemes = (() => {\n const helper = ThemeManager.dimensionsThemes\n if (!helper.has(initialTheme)) {\n helper.set(initialTheme, getDimensionThemes(initialTheme, options))\n }\n return helper.get(initialTheme)\n })()\n\n // Cache getDimensionsMap per dimension-themes identity — all instances\n // of the same component definition share the same dimension structure.\n let dimResult = _dimensionsCache.get(initialDimensionThemes as object)\n if (dimResult) {\n if ((import.meta as ViteMeta).env?.DEV === true)\n _countSink.__pyreon_count__?.('rocketstyle.dimensionsMap.hit')\n } else {\n dimResult = getDimensionsMap({\n themes: initialDimensionThemes,\n useBooleans: options.useBooleans,\n })\n _dimensionsCache.set(initialDimensionThemes as object, dimResult)\n }\n const { keysMap: dimensions, keywords: reservedPropNames } = dimResult\n\n // Cache Object.keys() result — same dimension structure = same keys\n let RESERVED_STYLING_PROPS_KEYS = _reservedKeysCache.get(reservedPropNames as object)\n if (!RESERVED_STYLING_PROPS_KEYS) {\n RESERVED_STYLING_PROPS_KEYS = Object.keys(reservedPropNames)\n _reservedKeysCache.set(reservedPropNames as object, RESERVED_STYLING_PROPS_KEYS)\n }\n\n // --------------------------------------------------\n // $rocketstyle as a FUNCTION ACCESSOR — fully reactive.\n // Re-evaluates when THEME, MODE, or dimension props change.\n // Props are resolved fresh each call so reactive prop accessors\n // (signals, getters) produce updated dimension values.\n // --------------------------------------------------\n const $rocketstyleAccessor = () => {\n if ((import.meta as ViteMeta).env?.DEV === true)\n _countSink.__pyreon_count__?.('rocketstyle.getTheme')\n // Read theme + mode LAZILY via the getter-backed themeAttrs object.\n // Both reads are tracked when this accessor runs inside a reactive\n // scope (styler's effect), so theme swap / mode toggle re-runs the\n // surrounding resolver and swaps the generated class.\n const theme = themeAttrs.theme // reactive: tracks theme signal\n const mode = themeAttrs.mode // reactive: tracks mode signal\n\n // Resolve base + dimension themes for the CURRENT theme. WeakMap\n // keyed on theme identity — stable-theme renders hit cache in O(1),\n // theme swaps fall through to recompute (once per new theme).\n const baseThemeHelper = ThemeManager.baseTheme\n if (baseThemeHelper.has(theme)) {\n if ((import.meta as ViteMeta).env?.DEV === true)\n _countSink.__pyreon_count__?.('rocketstyle.localThemeManager.hit')\n } else {\n baseThemeHelper.set(theme, getThemeFromChain(options.theme, theme))\n }\n const baseTheme = baseThemeHelper.get(theme)\n\n const dimHelper = ThemeManager.dimensionsThemes\n if (dimHelper.has(theme)) {\n if ((import.meta as ViteMeta).env?.DEV === true)\n _countSink.__pyreon_count__?.('rocketstyle.localThemeManager.hit')\n } else {\n dimHelper.set(theme, getDimensionThemes(theme, options))\n }\n const themes = dimHelper.get(theme)\n\n // Resolve active dimensions from props (not localCtx which has pseudo getters)\n const rocketstate = _calculateStylingAttrs({\n props: pickStyledAttrs(props as Record<string, unknown>, reservedPropNames),\n dimensions,\n })\n\n // Resolve mode-specific theme\n const modeBaseHelper = ThemeManager.modeBaseTheme[mode]\n if (modeBaseHelper.has(baseTheme)) {\n if ((import.meta as ViteMeta).env?.DEV === true)\n _countSink.__pyreon_count__?.('rocketstyle.localThemeManager.hit')\n } else {\n modeBaseHelper.set(baseTheme, getThemeByMode(baseTheme, mode))\n }\n const currentModeBaseTheme = modeBaseHelper.get(baseTheme)\n\n const modeDimHelper = ThemeManager.modeDimensionTheme[mode]\n if (modeDimHelper.has(themes)) {\n if ((import.meta as ViteMeta).env?.DEV === true)\n _countSink.__pyreon_count__?.('rocketstyle.localThemeManager.hit')\n } else {\n modeDimHelper.set(themes, getThemeByMode(themes, mode))\n }\n const currentModeThemes = modeDimHelper.get(themes)\n\n return getTheme({\n rocketstate,\n themes: currentModeThemes,\n baseTheme: currentModeBaseTheme,\n transformKeys: options.transformKeys,\n appTheme: theme,\n })\n }\n\n // Silence \"unused\" warnings for initialBaseTheme / initialDimensionThemes —\n // they're eagerly populated into ThemeManager caches so the first accessor\n // call hits cache, but not referenced directly.\n void initialBaseTheme\n void initialDimensionThemes\n\n // --------------------------------------------------\n // $rocketstate as a FUNCTION ACCESSOR — reactive on prop changes.\n // Re-evaluates active dimensions + pseudo state from current props.\n // --------------------------------------------------\n // Capture pseudo from localCtx once at setup — pseudo properties are\n // getters (from createLocalProvider) that read signals lazily.\n // Passing them through preserves reactivity without subscribing here.\n const localPseudo = localCtx?.pseudo\n\n const $rocketstateAccessor = () => {\n const rocketstate = _calculateStylingAttrs({\n props: pickStyledAttrs(props as Record<string, unknown>, reservedPropNames),\n dimensions,\n })\n\n // Read pseudo props fresh each call — props may have reactive getters\n // from _rp() wrapping. Reading inside the accessor (which runs in an\n // effect) ensures changes to pseudo props like active={isDark()} are tracked.\n const propPseudo = pick(props, ALL_PSEUDO_KEYS)\n\n return {\n ...rocketstate,\n pseudo: { ...localPseudo, ...propPseudo },\n }\n }\n\n // --------------------------------------------------\n // final props passed to WrappedComponent\n // --------------------------------------------------\n // Cache a pre-built Set for omit() — avoids building a new Set from\n // the key array on every mount. Same dimension structure = same Set.\n let omitSet = _omitSetCache.get(RESERVED_STYLING_PROPS_KEYS)\n if (omitSet) {\n if ((import.meta as ViteMeta).env?.DEV === true)\n _countSink.__pyreon_count__?.('rocketstyle.omitSet.hit')\n } else {\n omitSet = new Set([...RESERVED_STYLING_PROPS_KEYS, ...STATIC_OMIT_KEYS])\n _omitSetCache.set(RESERVED_STYLING_PROPS_KEYS, omitSet)\n }\n\n // Merge localCtx + props without an intermediate spread object.\n // omit() handles 'pseudo' removal (included in STATIC_OMIT_KEYS).\n const mergeProps = localCtx ? { ...localCtx, ...props } : props\n\n // omit() already returns a fresh object — assign directly onto it\n // instead of spreading into another {} (saves one object allocation).\n const finalProps = omit(mergeProps as Record<string, unknown>, omitSet) as Record<string, any>\n\n if (options.passProps) {\n const passed = pick(mergeProps, options.passProps)\n for (const k in passed) finalProps[k] = passed[k]\n }\n\n finalProps.ref = props.ref\n // Function accessors — DynamicStyled wraps them in a computed() so\n // mode/dimension changes produce a new CSS class reactively. The\n // computed tracks only these two accessors; the resolve itself runs\n // untracked to prevent exponential cascade from theme deep-reads.\n finalProps.$rocketstyle = $rocketstyleAccessor\n finalProps.$rocketstate = $rocketstateAccessor\n\n // development debugging — tree-shaken in production via import.meta.env.DEV\n if (__DEV__) {\n finalProps['data-rocketstyle'] = componentName\n\n if (options.DEBUG) {\n const debugPayload = {\n component: componentName,\n rocketstate: $rocketstateAccessor(),\n rocketstyle: $rocketstyleAccessor(),\n dimensions,\n mode: themeAttrs.mode,\n reservedPropNames: RESERVED_STYLING_PROPS_KEYS,\n filteredAttrs: options.filterAttrs,\n }\n\n // oxlint-disable-next-line no-console\n console.debug(`[rocketstyle] ${componentName} render:`, debugPayload)\n }\n }\n\n // STATIC VNode — created once, never remounted on mode change.\n // The styled component handles reactive class swaps internally.\n return RenderComponent(finalProps)\n }\n\n // ------------------------------------------------------\n // Compose HOC chain and create final component\n // ------------------------------------------------------\n const FinalComponent: RocketStyleComponent = compose(...hocsFuncs)(EnhancedComponent)\n FinalComponent.IS_ROCKETSTYLE = true\n FinalComponent.displayName = componentName\n\n hoistNonReactStatics(FinalComponent as Record<string, unknown>, options.component)\n\n // ------------------------------------------------------\n // enhance for chaining methods\n // ------------------------------------------------------\n createStaticsChainingEnhancers({\n context: FinalComponent,\n dimensionKeys: options.dimensionKeys,\n func: cloneAndEnhance,\n options,\n })\n\n FinalComponent.IS_ROCKETSTYLE = true\n FinalComponent.displayName = componentName\n FinalComponent.meta = {}\n\n // ------------------------------------------------------\n // enhance for statics\n // ------------------------------------------------------\n createStaticsEnhancers({\n context: FinalComponent.meta,\n options: options.statics,\n })\n\n // Also assign statics directly onto the component so they are\n // discoverable via `\"key\" in Component` checks (e.g. _documentType).\n createStaticsEnhancers({\n context: FinalComponent,\n options: options.statics,\n })\n\n // ─── Hoisted attrs chain (T3.1) ──────────────────────────────────────\n //\n // Expose the accumulated `.attrs()` callback chain on the component so\n // external inspectors (notably `extractDocumentTree` from\n // `@pyreon/connector-document`) can compute the post-attrs props\n // without invoking the full component. The previous Path B workaround\n // had to run the entire styled wrapper — JSX tree creation, dimension\n // resolution, the lot — just to read `_documentProps` off the result.\n //\n // Typed surface: `RocketStyleComponent.__rs_attrs` is a `readonly\n // ReadonlyArray<(props) => Record<string, unknown>>`. Empty when\n // no `.attrs()` was ever called. `chain.reduce(Object.assign, {})`\n // produces the post-attrs result for a given props bag.\n //\n // The `readonly` modifier guards external CONSUMERS — internal\n // assignment from the factory itself is the only legitimate write,\n // hence the cast. Do not drop the readonly on the type.\n ;(FinalComponent as unknown as { __rs_attrs: typeof options.attrs }).__rs_attrs =\n options.attrs ?? []\n\n Object.assign(FinalComponent, {\n attrs: (attrs: any, { priority, filter }: any = {}) => {\n const result: Record<string, any> = {}\n\n if (filter) {\n result.filterAttrs = filter\n }\n\n if (priority) {\n result.priorityAttrs = attrs as ExtendedConfiguration['priorityAttrs']\n\n return cloneAndEnhance(options, result)\n }\n\n result.attrs = attrs as ExtendedConfiguration['attrs']\n\n return cloneAndEnhance(options, result)\n },\n\n config: (opts: any = {}) => {\n const result = pick(opts, CONFIG_KEYS) as ExtendedConfiguration\n\n return cloneAndEnhance(options, result)\n },\n\n statics: (opts: any) => cloneAndEnhance(options, { statics: opts }),\n\n getStaticDimensions: (theme: any) => {\n const themes = getDimensionThemes(theme, options)\n\n const { keysMap, keywords } = getDimensionsMap({\n themes,\n useBooleans: options.useBooleans,\n })\n\n return {\n dimensions: keysMap,\n keywords,\n useBooleans: options.useBooleans,\n multiKeys: options.multiKeys,\n }\n },\n\n getDefaultAttrs: (props: any, theme: any, mode: any) =>\n calculateChainOptions(options.attrs)([\n props,\n theme,\n {\n render,\n mode,\n isDark: mode === 'light',\n isLight: mode === 'dark',\n },\n ]),\n })\n\n return FinalComponent\n}\n\nexport default rocketComponent\n","import { isEmpty } from '@pyreon/ui-core'\nimport { ALL_RESERVED_KEYS, __DEV__ } from './constants'\nimport defaultDimensions from './constants/defaultDimensions'\nimport rocketComponent from './rocketstyle'\nimport type { DefaultDimensions, Dimensions } from './types/dimensions'\nimport type { RocketComponent } from './types/rocketComponent'\nimport type { ElementType } from './types/utils'\nimport {\n getDimensionsValues,\n getKeys,\n getMultipleDimensions,\n getTransformDimensions,\n} from './utils/dimensions'\n\nexport type Rocketstyle = <\n const D extends Dimensions = DefaultDimensions,\n UB extends boolean = false,\n>({\n dimensions,\n useBooleans,\n}?: {\n dimensions?: D\n useBooleans?: UB\n}) => <C extends ElementType>({\n name,\n component,\n}: {\n name: string\n component: C\n}) => ReturnType<RocketComponent<C, {}, {}, D, UB>>\n\n/**\n * Factory initializer for rocketstyle components. Validates dimension\n * configurations against reserved keys, then delegates to the core\n * `rocketComponent` builder with pre-computed dimension metadata.\n */\ntype InitErrors = Partial<{\n component: string\n name: string\n dimensions: string\n invalidDimensions: string\n}>\n\nconst validateInit = (name: string, component: unknown, dimensions: Dimensions) => {\n const errors: InitErrors = {}\n\n if (!component) {\n errors.component = 'Parameter `component` is missing in params!'\n }\n\n if (!name) {\n errors.name = 'Parameter `name` is missing in params!'\n }\n\n if (isEmpty(dimensions)) {\n errors.dimensions = 'Parameter `dimensions` is missing in params!'\n } else {\n const definedDimensions = getKeys(dimensions)\n const invalidDimension = ALL_RESERVED_KEYS.some((item) =>\n definedDimensions.some((d) => d === item),\n )\n\n if (invalidDimension) {\n errors.invalidDimensions = `Some of your \\`dimensions\\` is invalid and uses reserved static keys which are\n ${defaultDimensions.toString()}`\n }\n }\n\n if (!isEmpty(errors)) {\n throw Error(JSON.stringify(errors))\n }\n}\n\nconst rocketstyle = (({ dimensions = defaultDimensions, useBooleans = false } = {}) =>\n ({ name, component }: { name: string; component: any }) => {\n if (__DEV__) {\n validateInit(name, component, dimensions)\n }\n\n return (rocketComponent as any)({\n name,\n component,\n useBooleans,\n dimensions,\n dimensionKeys: getKeys(dimensions),\n dimensionValues: getDimensionsValues(dimensions),\n multiKeys: getMultipleDimensions(dimensions),\n transformKeys: getTransformDimensions(dimensions),\n styled: true,\n })\n }) as unknown as Rocketstyle\n\nexport default rocketstyle\n","export type IsRocketComponent = <T>(component: T) => boolean\n\n/** Runtime type guard — checks if a component was created by `rocketstyle()`. */\nconst isRocketComponent: IsRocketComponent = (component) => {\n if (\n component &&\n (typeof component === 'object' || typeof component === 'function') &&\n Object.hasOwn(component as object, 'IS_ROCKETSTYLE')\n ) {\n return true\n }\n\n return false\n}\n\nexport default isRocketComponent\n","import type { TProvider } from './context/context'\nimport Provider, { context } from './context/context'\nimport type { Rocketstyle } from './init'\nimport rocketstyle from './init'\nimport type { IsRocketComponent } from './isRocketComponent'\nimport isRocketComponent from './isRocketComponent'\nimport type { AttrsCb } from './types/attrs'\nimport type {\n ConfigAttrs,\n ConsumerCb,\n ConsumerCtxCBValue,\n ConsumerCtxCb,\n RocketComponentType,\n RocketProviderState,\n} from './types/config'\nimport type { DefaultProps } from './types/configuration'\nimport type {\n DimensionCallbackParam,\n DimensionProps,\n Dimensions,\n DimensionValue,\n ExtractDimensionProps,\n ExtractDimensions,\n TDKP,\n} from './types/dimensions'\nimport type { ComposeParam, GenericHoc } from './types/hoc'\nimport type { IRocketStyleComponent, RocketStyleComponent } from './types/rocketstyle'\nimport type { RocketStyleInterpolationProps, StylesCb, StylesDefault } from './types/styles'\nimport type {\n ThemeCb,\n ThemeDefault,\n ThemeMode,\n ThemeModeCallback,\n ThemeModeKeys,\n} from './types/theme'\nimport type { ComponentFn, ElementType, ExtractProps, MergeTypes, TObj } from './types/utils'\n\nexport type {\n AttrsCb,\n ComponentFn,\n ComposeParam,\n ConfigAttrs,\n ConsumerCb,\n ConsumerCtxCBValue,\n ConsumerCtxCb,\n DefaultProps,\n DimensionCallbackParam,\n DimensionProps,\n Dimensions,\n DimensionValue,\n ElementType,\n ExtractDimensionProps,\n ExtractDimensions,\n ExtractProps,\n GenericHoc,\n IRocketStyleComponent,\n IsRocketComponent,\n MergeTypes,\n RocketComponentType,\n RocketProviderState,\n RocketStyleComponent,\n RocketStyleInterpolationProps,\n Rocketstyle,\n StylesCb,\n StylesDefault,\n TDKP,\n ThemeCb,\n ThemeDefault,\n ThemeMode,\n ThemeModeCallback,\n ThemeModeKeys,\n TObj,\n TProvider,\n}\n\n/**\n * Resolve a $rocketstyle value — handles both function accessor and plain object.\n * Use in styled() interpolation functions when $rocketstyle may be a reactive accessor.\n *\n * @example\n * ```ts\n * styled(Component)`\n * color: ${(props) => resolveTheme(props.$rocketstyle).color};\n * `\n * ```\n */\nexport function resolveTheme<T = Record<string, unknown>>(\n value: (() => T) | T,\n): T {\n return typeof value === 'function' ? (value as () => T)() : value\n}\n\nexport { context, isRocketComponent, Provider, rocketstyle }\nexport default rocketstyle\n"],"mappings":";;;;;;AAQA,MAAa,UAAoB,OAAO,KAAkB,KAAK,QAAQ;;AAGvE,MAAa,eAAe;;AAG5B,MAAa,cAAc;CAAC;CAAS;CAAU;CAAS;CAAU;;AAGlE,MAAa,mBAAmB,CAAC,YAAY,WAAW;;AAGxD,MAAa,cAAc;CACzB,OAAO;CACP,MAAM;CACP;;AAGD,MAAa,uBAAuB;CAClC,MAAM;CACN,OAAO;CACR;;AAGD,MAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAa,eAAe,CAAC,SAAS,SAAS;AAC/C,MAAa,cAAc,CAAC,GAAG,cAAc,UAAU;;AAGvD,MAAa,oBAAoB;CAC/B,GAAG,OAAO,KAAK,YAAY;CAC3B,GAAG;CACH,GAAG;CACH;CACD;;;;;;;;;;;AC5BD,MAAM,YAAY,EAAE,WAAWA,YAAc,UAAU,GAAG,YAAmC;CAK3F,MAAM,EAAE,OAAO,MAAM,UAAU,qBAAqB,aADrC;EAAE,GAHF,WAAW,QAAQ,EACd;EAEK,GAAG;EAAO;EAAU;CAG7C,IAAI,UAAU;AAEd,KAAI,KACF,WAAU,WAAW,qBAAqB,QAAQ;AAapD,SAVsB,uBAAuBA,YAChB;EAC3B,MAAM;EACN,QAAQ,YAAY;EACpB,SAAS,YAAY;EACrB,GAAI,UAAU,SAAY,EAAE,OAAO,GAAG,EAAE;EACxC;EACA;EACD,CAAC,IAEe;;;;;;;;;;AC3CnB,MAAM,qBAAqB;CACzB,QAAQ;CACR,O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