@pyreon/rocketstyle 0.12.14 → 0.12.15

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
@@ -289,7 +289,7 @@ interface IRocketStyleComponent<OA extends TObj = {}, EA extends TObj = {}, T ex
289
289
  type RocketComponent<C extends ElementType = ElementType, T extends TObj = {}, CSS extends TObj = {}, D extends Dimensions = DefaultDimensions, UB extends boolean = boolean> = (props: Configuration<C, D>) => RocketStyleComponent<ExtractProps<C>, {}, T, CSS, {}, {}, D, UB, {}>;
290
290
  //#endregion
291
291
  //#region src/init.d.ts
292
- type Rocketstyle = <const D extends Dimensions = DefaultDimensions, UB extends boolean = true>({
292
+ type Rocketstyle = <const D extends Dimensions = DefaultDimensions, UB extends boolean = false>({
293
293
  dimensions,
294
294
  useBooleans
295
295
  }?: {
package/lib/index.js.map CHANGED
@@ -1 +1 @@
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":["/** 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 // object with possible options\n Object.keys(dimensions).forEach((item) => {\n const pickedProp = props[item]\n const t = typeof pickedProp\n\n // if the property is multi key, allow assign array as well\n if (multiKeys?.[item] && Array.isArray(pickedProp)) {\n result[item] = pickedProp\n }\n // assign when it's only a string or number otherwise it's considered\n // as invalid param\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 if (useBooleans) {\n const propsKeys = Object.keys(props)\n\n Object.entries(result).forEach(([key, value]) => {\n const isMultiKey = multiKeys?.[key]\n\n // when value in result is not assigned yet\n if (!value) {\n let newDimensionValue: string | string[] | undefined\n const keywordSet = new Set(Object.keys(dimensions[key] as Record<string, unknown>))\n\n if (isMultiKey) {\n newDimensionValue = propsKeys.filter((propKey) => keywordSet.has(propKey))\n } else {\n // iterate backwards to guarantee the last one will have\n // a priority over previous ones\n for (let i = propsKeys.length - 1; i >= 0; i--) {\n const k = propsKeys[i] as string\n if (keywordSet.has(k) && props[k]) {\n newDimensionValue = k\n break\n }\n }\n }\n\n result[key] = newDimensionValue\n }\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 result = {}\n\n if (isEmpty(options.dimensions)) return result\n\n return Object.entries(options.dimensions).reduce(\n (acc, [key, value]) => {\n const [, dimension] = isMultiKey(value as string | Record<string, unknown>)\n\n const helper = options[key]\n\n if (Array.isArray(helper) && helper.length > 0) {\n const finalDimensionThemes = getThemeFromChain(helper, theme)\n\n acc[dimension] = removeNullableValues(finalDimensionThemes)\n }\n\n return acc\n },\n result as Record<string, any>,\n )\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\nexport const getTheme: GetTheme = ({ rocketstate, themes, baseTheme, transformKeys, appTheme }) => {\n let finalTheme = { ...baseTheme }\n const deferredTransforms: Array<\n (\n currentTheme: Record<string, any>,\n currentAppTheme: Record<string, any>,\n mode: typeof themeModeCallback,\n cssFn: typeof config.css,\n ) => Record<string, any>\n > = []\n\n Object.entries(rocketstate).forEach(([key, value]: [string, string | string[]]) => {\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 (isTransform && typeof val === 'function') {\n deferredTransforms.push(val)\n } else {\n finalTheme = merge({}, finalTheme, val)\n }\n }\n\n if (Array.isArray(value)) {\n value.forEach(mergeValue)\n } else {\n mergeValue(value)\n }\n })\n\n // Apply transform dimension values last with the fully accumulated theme\n for (const transform of deferredTransforms) {\n finalTheme = merge(\n {},\n finalTheme,\n transform(finalTheme, appTheme ?? {}, themeModeCallback, config.css),\n )\n }\n\n // Ensure pseudo-state keys always exist as objects so .styles() can\n // destructure without defaults: const { hover, focus, ... } = $rocketstyle\n finalTheme.hover ??= {}\n finalTheme.focus ??= {}\n finalTheme.active ??= {}\n finalTheme.disabled ??= {}\n finalTheme.pressed ??= {}\n finalTheme.readOnly ??= {}\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 } 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/**\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 // --------------------------------------------------------\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 // Theme structure — cached by theme object identity.\n // Theme object itself doesn't change (enrichTheme produces a stable ref),\n // only mode switches change which mode-variant is resolved.\n // --------------------------------------------------\n const theme = themeAttrs.theme\n\n const baseThemeHelper = ThemeManager.baseTheme\n if (!baseThemeHelper.has(theme)) {\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 dimHelper.set(theme, getDimensionThemes(theme, options))\n }\n const themes = dimHelper.get(theme)\n\n const { keysMap: dimensions, keywords: reservedPropNames } = getDimensionsMap({\n themes,\n useBooleans: options.useBooleans,\n })\n\n const RESERVED_STYLING_PROPS_KEYS = Object.keys(reservedPropNames)\n\n // --------------------------------------------------\n // $rocketstyle as a FUNCTION ACCESSOR — fully reactive.\n // Re-evaluates when 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 // Only read mode and dimension props — NOT pseudo state.\n // Pseudo state (hover, focus, pressed) is read by .styles()\n // via $rocketstate inside runUntracked(). Reading pseudo signals\n // here would subscribe this accessor to hover/focus/pressed,\n // causing CSS recomputation on every mouse event.\n const mode = themeAttrs.mode // reactive: tracks mode signal\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 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 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 // --------------------------------------------------\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, [...PSEUDO_KEYS, ...PSEUDO_META_KEYS])\n\n return {\n ...rocketstate,\n pseudo: { ...localPseudo, ...propPseudo },\n }\n }\n\n // --------------------------------------------------\n // Static mergeProps for final prop filtering (non-dimension props)\n // --------------------------------------------------\n const { pseudo: _pseudo, ...mergeProps } = {\n ...localCtx,\n ...props,\n }\n\n // --------------------------------------------------\n // final props passed to WrappedComponent\n // --------------------------------------------------\n const finalProps: Record<string, any> = {\n ...omit(mergeProps, [\n ...RESERVED_STYLING_PROPS_KEYS,\n ...PSEUDO_KEYS,\n ...options.filterAttrs,\n ]),\n ...(options.passProps ? pick(mergeProps, options.passProps) : {}),\n ref: props.ref,\n // FUNCTION accessors — styled component resolves them reactively\n $rocketstyle: $rocketstyleAccessor,\n $rocketstate: $rocketstateAccessor,\n }\n\n // development debugging\n if (process.env.NODE_ENV !== 'production') {\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 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 } 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 = true,\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 (process.env.NODE_ENV !== 'production') {\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":";;;;;;AACA,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,M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G3C,QAAQ,gBAAwB;EAC9B;EACA;EACA;EACA;EACA,eAAe,QAAQ,WAAW;EAClC,iBAAiB,oBAAoB,WAAW;EAChD,WAAW,sBAAsB,WAAW;EAC5C,eAAe,uBAAuB,WAAW;EACjD,QAAQ;EACT,CAAC;;;;;;ACtFN,MAAM,qBAAwC,cAAc;AAC1D,KACE,cACC,OAAO,cAAc,YAAY,OAAO,cAAc,eACvD,OAAO,OAAO,WAAqB,iBAAiB,CAEpD,QAAO;AAGT,QAAO;;;;;;;;;;;;;;;;AC0ET,SAAgB,aACd,OACG;AACH,QAAO,OAAO,UAAU,aAAc,OAAmB,GAAG;;AAI9D,kBAAe"}
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":["/** 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 // object with possible options\n Object.keys(dimensions).forEach((item) => {\n const pickedProp = props[item]\n const t = typeof pickedProp\n\n // if the property is multi key, allow assign array as well\n if (multiKeys?.[item] && Array.isArray(pickedProp)) {\n result[item] = pickedProp\n }\n // assign when it's only a string or number otherwise it's considered\n // as invalid param\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 if (useBooleans) {\n const propsKeys = Object.keys(props)\n\n Object.entries(result).forEach(([key, value]) => {\n const isMultiKey = multiKeys?.[key]\n\n // when value in result is not assigned yet\n if (!value) {\n let newDimensionValue: string | string[] | undefined\n const keywordSet = new Set(Object.keys(dimensions[key] as Record<string, unknown>))\n\n if (isMultiKey) {\n newDimensionValue = propsKeys.filter((propKey) => keywordSet.has(propKey))\n } else {\n // iterate backwards to guarantee the last one will have\n // a priority over previous ones\n for (let i = propsKeys.length - 1; i >= 0; i--) {\n const k = propsKeys[i] as string\n if (keywordSet.has(k) && props[k]) {\n newDimensionValue = k\n break\n }\n }\n }\n\n result[key] = newDimensionValue\n }\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 result = {}\n\n if (isEmpty(options.dimensions)) return result\n\n return Object.entries(options.dimensions).reduce(\n (acc, [key, value]) => {\n const [, dimension] = isMultiKey(value as string | Record<string, unknown>)\n\n const helper = options[key]\n\n if (Array.isArray(helper) && helper.length > 0) {\n const finalDimensionThemes = getThemeFromChain(helper, theme)\n\n acc[dimension] = removeNullableValues(finalDimensionThemes)\n }\n\n return acc\n },\n result as Record<string, any>,\n )\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\nexport const getTheme: GetTheme = ({ rocketstate, themes, baseTheme, transformKeys, appTheme }) => {\n let finalTheme = { ...baseTheme }\n const deferredTransforms: Array<\n (\n currentTheme: Record<string, any>,\n currentAppTheme: Record<string, any>,\n mode: typeof themeModeCallback,\n cssFn: typeof config.css,\n ) => Record<string, any>\n > = []\n\n Object.entries(rocketstate).forEach(([key, value]: [string, string | string[]]) => {\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 (isTransform && typeof val === 'function') {\n deferredTransforms.push(val)\n } else {\n finalTheme = merge({}, finalTheme, val)\n }\n }\n\n if (Array.isArray(value)) {\n value.forEach(mergeValue)\n } else {\n mergeValue(value)\n }\n })\n\n // Apply transform dimension values last with the fully accumulated theme\n for (const transform of deferredTransforms) {\n finalTheme = merge(\n {},\n finalTheme,\n transform(finalTheme, appTheme ?? {}, themeModeCallback, config.css),\n )\n }\n\n // Ensure pseudo-state keys always exist as objects so .styles() can\n // destructure without defaults: const { hover, focus, ... } = $rocketstyle\n finalTheme.hover ??= {}\n finalTheme.focus ??= {}\n finalTheme.active ??= {}\n finalTheme.disabled ??= {}\n finalTheme.pressed ??= {}\n finalTheme.readOnly ??= {}\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 } 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/**\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 // --------------------------------------------------------\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 // Theme structure — cached by theme object identity.\n // Theme object itself doesn't change (enrichTheme produces a stable ref),\n // only mode switches change which mode-variant is resolved.\n // --------------------------------------------------\n const theme = themeAttrs.theme\n\n const baseThemeHelper = ThemeManager.baseTheme\n if (!baseThemeHelper.has(theme)) {\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 dimHelper.set(theme, getDimensionThemes(theme, options))\n }\n const themes = dimHelper.get(theme)\n\n const { keysMap: dimensions, keywords: reservedPropNames } = getDimensionsMap({\n themes,\n useBooleans: options.useBooleans,\n })\n\n const RESERVED_STYLING_PROPS_KEYS = Object.keys(reservedPropNames)\n\n // --------------------------------------------------\n // $rocketstyle as a FUNCTION ACCESSOR — fully reactive.\n // Re-evaluates when 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 // Only read mode and dimension props — NOT pseudo state.\n // Pseudo state (hover, focus, pressed) is read by .styles()\n // via $rocketstate inside runUntracked(). Reading pseudo signals\n // here would subscribe this accessor to hover/focus/pressed,\n // causing CSS recomputation on every mouse event.\n const mode = themeAttrs.mode // reactive: tracks mode signal\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 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 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 // --------------------------------------------------\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, [...PSEUDO_KEYS, ...PSEUDO_META_KEYS])\n\n return {\n ...rocketstate,\n pseudo: { ...localPseudo, ...propPseudo },\n }\n }\n\n // --------------------------------------------------\n // Static mergeProps for final prop filtering (non-dimension props)\n // --------------------------------------------------\n const { pseudo: _pseudo, ...mergeProps } = {\n ...localCtx,\n ...props,\n }\n\n // --------------------------------------------------\n // final props passed to WrappedComponent\n // --------------------------------------------------\n const finalProps: Record<string, any> = {\n ...omit(mergeProps, [\n ...RESERVED_STYLING_PROPS_KEYS,\n ...PSEUDO_KEYS,\n ...options.filterAttrs,\n ]),\n ...(options.passProps ? pick(mergeProps, options.passProps) : {}),\n ref: props.ref,\n // FUNCTION accessors — styled component resolves them reactively\n $rocketstyle: $rocketstyleAccessor,\n $rocketstate: $rocketstateAccessor,\n }\n\n // development debugging\n if (process.env.NODE_ENV !== 'production') {\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 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 } 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 (process.env.NODE_ENV !== 'production') {\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":";;;;;;AACA,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;;;;;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T,CAAC;;;;;;ACtFN,MAAM,qBAAwC,cAAc;AAC1D,KACE,cACC,OAAO,cAAc,YAAY,OAAO,cAAc,eACvD,OAAO,OAAO,WAAqB,iBAAiB,CAEpD,QAAO;AAGT,QAAO;;;;;;;;;;;;;;;;AC0ET,SAAgB,aACd,OACG;AACH,QAAO,OAAO,UAAU,aAAc,OAAmB,GAAG;;AAI9D,kBAAe"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyreon/rocketstyle",
3
- "version": "0.12.14",
3
+ "version": "0.12.15",
4
4
  "description": "Multi-dimensional style composition for Pyreon components",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -42,16 +42,16 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  "@pyreon/test-utils": "^0.12.10",
45
- "@pyreon/typescript": "^0.12.14",
46
- "@pyreon/ui-core": "^0.12.14",
45
+ "@pyreon/typescript": "^0.12.15",
46
+ "@pyreon/ui-core": "^0.12.15",
47
47
  "@vitest/browser-playwright": "^4.1.4",
48
48
  "@vitus-labs/tools-rolldown": "^1.15.3"
49
49
  },
50
50
  "peerDependencies": {
51
- "@pyreon/core": "^0.12.14",
52
- "@pyreon/reactivity": "^0.12.14",
53
- "@pyreon/styler": "^0.12.14",
54
- "@pyreon/ui-core": "^0.12.14"
51
+ "@pyreon/core": "^0.12.15",
52
+ "@pyreon/reactivity": "^0.12.15",
53
+ "@pyreon/styler": "^0.12.15",
54
+ "@pyreon/ui-core": "^0.12.15"
55
55
  },
56
56
  "engines": {
57
57
  "node": ">= 22"
@@ -94,6 +94,34 @@ describe('rocketstyle factory', () => {
94
94
  })
95
95
  expect(Button).toBeDefined()
96
96
  })
97
+
98
+ // Regression: type default and runtime default must agree. When they
99
+ // diverged (type default `true`, runtime default `false`), boolean
100
+ // dimension props like `<Heading level3 />` typechecked but were silently
101
+ // dropped at runtime — producing components with only base .theme() styles
102
+ // and missing .sizes()/.variants()/.states() overrides.
103
+ it('type default matches runtime default (both false)', () => {
104
+ // Runtime: boolean shorthand is IGNORED when useBooleans is false
105
+ const Button: any = rocketstyle()({ name: 'TypeTest', component: BaseComponent })
106
+ .sizes(() => ({ level3: { fontSize: 24 } }))
107
+ const ignored = getComputedTheme(Button, { level3: true })
108
+ expect(ignored.fontSize).toBeUndefined()
109
+
110
+ // Runtime: object form IS applied
111
+ const applied = getComputedTheme(Button, { size: 'level3' })
112
+ expect(applied.fontSize).toBe(24)
113
+
114
+ // Type-level regression: when useBooleans is omitted, UB infers to
115
+ // `false`, so boolean dimension props must NOT be on the public surface.
116
+ // Before the fix (type default `true`), `level3: true` would typecheck —
117
+ // silently matching the bokisch / ssr-showcase regression.
118
+ const TypedComponent = (_props: { children?: unknown }): null => null
119
+ const Typed = rocketstyle()({ name: 'T', component: TypedComponent })
120
+ .sizes(() => ({ level3: { fontSize: 24 } }))
121
+ type Props = (typeof Typed)['$$types']
122
+ const _hasNoBooleanShorthand: 'level3' extends keyof Props ? false : true = true
123
+ void _hasNoBooleanShorthand
124
+ })
97
125
  })
98
126
 
99
127
  // --------------------------------------------------------
package/src/init.ts CHANGED
@@ -14,7 +14,7 @@ import {
14
14
 
15
15
  export type Rocketstyle = <
16
16
  const D extends Dimensions = DefaultDimensions,
17
- UB extends boolean = true,
17
+ UB extends boolean = false,
18
18
  >({
19
19
  dimensions,
20
20
  useBooleans,