@meonode/ui 0.2.20 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"styled-renderer.client.d.ts","sourceRoot":"","sources":["../../src/components/styled-renderer.client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,WAAW;IACxD,OAAO,EAAE,CAAC,CAAA;IACV,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,GAAG,CAAC,EAAE,gBAAgB,CAAA;CACvB;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,CAAC,SAAS,WAAW,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAChG,OAAO,EACP,GAAG,EACH,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,MAAM;;wDAEjC"}
1
+ {"version":3,"file":"styled-renderer.client.d.ts","sourceRoot":"","sources":["../../src/components/styled-renderer.client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,SAAS,EAAc,MAAM,OAAO,CAAA;AAE5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAKpD,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,WAAW;IACxD,OAAO,EAAE,CAAC,CAAA;IACV,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,GAAG,EAAE,gBAAgB,CAAA;CACtB;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,U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function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return(b=_toPropertyKey(b))in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}function _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=_objectWithoutPropertiesLoose(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],-1===b.indexOf(c)&&{}.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c={};for(var d in a)if({}.hasOwnProperty.call(a,d)){if(-1!==b.indexOf(d))continue;c[d]=a[d]}return c}import{jsx}from"@emotion/react";export default function StyledRenderer(a){var b=a.element,c=a.css,d=a.children,e=_objectWithoutProperties(a,_excluded);return jsx(b,_objectSpread(_objectSpread({},e),{},{css:c}),d)}StyledRenderer.displayName="Styled";
1
+ "use client";var _excluded=["element","children"];function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return(b=_toPropertyKey(b))in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}function _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=_objectWithoutPropertiesLoose(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],-1===b.indexOf(c)&&{}.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c={};for(var d in a)if({}.hasOwnProperty.call(a,d)){if(-1!==b.indexOf(d))continue;c[d]=a[d]}return c}import{useContext}from"react";import{jsx}from"@emotion/react";import{resolveObjWithTheme}from"../helper/theme.helper.js";import{ThemeContext}from"./theme-provider.client.js";import{resolveDefaultStyle}from"../helper/node.helper.js";/**
2
+ * A client-side component that renders a styled element using Emotion.
3
+ * It resolves theme values and applies default styles.
4
+ * @template E The type of the HTML element to render.
5
+ * @template TProps The type of the props for the component.
6
+ * @param element The HTML element to render (e.g., 'div', 'span').
7
+ * @param children Optional children to be rendered inside the element.
8
+ * @returns {JSX.Element} The rendered JSX element.
9
+ */export default function StyledRenderer(a){var b=a.element,c=a.children,d=_objectWithoutProperties(a,_excluded),e=useContext(ThemeContext),f=null===e||void 0===e?void 0:e.theme,g=d;f&&(g=resolveObjWithTheme(d,f.system));var h=resolveDefaultStyle(g.css);return jsx(b,_objectSpread(_objectSpread({},g),{},{css:h}),c)}StyledRenderer.displayName="Styled";
@@ -0,0 +1,25 @@
1
+ import type { Children, Theme } from '../node.type.js';
2
+ export interface ThemeContextValue {
3
+ theme: Theme;
4
+ setTheme: (theme: Theme) => void;
5
+ }
6
+ export declare const ThemeContext: import("react").Context<ThemeContextValue | null>;
7
+ /**
8
+ * The internal implementation of the ThemeProvider component.
9
+ * @param {object} props The props for the component.
10
+ * @param {Children} [props.children] The children to render.
11
+ * @param {Theme} props.theme The theme to provide.
12
+ * @returns {React.ReactNode} The rendered component.
13
+ * @private
14
+ */
15
+ export declare function _ThemeProvider({ children, theme }: {
16
+ children?: Children;
17
+ theme: Theme;
18
+ }): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
19
+ /**
20
+ * A component that provides a theme to its children.
21
+ */
22
+ export declare const ThemeProvider: (<AdditionalProps extends Record<string, any> = Record<string, any>>(props: import("../node.type.js").MergedProps<typeof _ThemeProvider, AdditionalProps>) => import("../node.type.js").NodeInstance<typeof _ThemeProvider>) & {
23
+ element: typeof _ThemeProvider;
24
+ };
25
+ //# sourceMappingURL=theme-provider.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-provider.client.d.ts","sourceRoot":"","sources":["../../src/components/theme-provider.client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAGxD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,KAAK,CAAA;IACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;CACjC;AAED,eAAO,MAAM,YAAY,mDAAgD,CAAA;AAEzE;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,8FAgBxF;AAED;;GAEG;AACH,eAAO,MAAM,aAAa;;CAA6B,CAAA"}
@@ -0,0 +1,10 @@
1
+ "use client";function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(b,c){if(b){if("string"==typeof b)return _arrayLikeToArray(b,c);var a={}.toString.call(b).slice(8,-1);return"Object"===a&&b.constructor&&(a=b.constructor.name),"Map"===a||"Set"===a?Array.from(b):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(b,c):void 0}}function _arrayLikeToArray(b,c){(null==c||c>b.length)&&(c=b.length);for(var d=0,f=Array(c);d<c;d++)f[d]=b[d];return f}function _iterableToArrayLimit(b,c){var d=null==b?null:"undefined"!=typeof Symbol&&b[Symbol.iterator]||b["@@iterator"];if(null!=d){var g,h,j,k,l=[],a=!0,m=!1;try{if(j=(d=d.call(b)).next,0===c){if(Object(d)!==d)return;a=!1}else for(;!(a=(g=j.call(d)).done)&&(l.push(g.value),l.length!==c);a=!0);}catch(a){m=!0,h=a}finally{try{if(!a&&null!=d["return"]&&(k=d["return"](),Object(k)!==k))return}finally{if(m)throw h}}return l}}function _arrayWithHoles(a){if(Array.isArray(a))return a}import{createContext,useState}from"react";import{createNode,Node}from"../main.js";export var ThemeContext=createContext(null);/**
2
+ * The internal implementation of the ThemeProvider component.
3
+ * @param {object} props The props for the component.
4
+ * @param {Children} [props.children] The children to render.
5
+ * @param {Theme} props.theme The theme to provide.
6
+ * @returns {React.ReactNode} The rendered component.
7
+ * @private
8
+ */export function _ThemeProvider(a){var b=a.children,c=a.theme,d=useState(c),e=_slicedToArray(d,2),f=e[0],g=e[1];if(!c)throw new Error("`theme` prop must be defined");return Node(ThemeContext.Provider,{value:{theme:f,setTheme:function setTheme(a){document.cookie="theme=".concat(a.mode),g(a)}},children:b}).render()}/**
9
+ * A component that provides a theme to its children.
10
+ */export var ThemeProvider=createNode(_ThemeProvider);
@@ -1,45 +1,30 @@
1
- import React, { type ReactElement, type ReactNode } from 'react';
2
- import type { Children, FinalNodeProps, HasRequiredProps, MergedProps, NodeElement, NodeElementType, NodeInstance, NodePortal, NodeProps, PropsOf, RawNodeProps, Theme } from './node.type.js';
1
+ import { type ReactElement } from 'react';
2
+ import type { Children, FinalNodeProps, HasRequiredProps, MergedProps, NodeElementType, NodeInstance, NodePortal, NodeProps, PropsOf } from './node.type.js';
3
3
  /**
4
- * Represents a node in a React component tree with theme and styling capabilities.
4
+ * Represents a node in a React component tree.
5
5
  * This class wraps React elements and handles:
6
6
  * - Props processing and normalization
7
- * - Theme inheritance and resolution
8
7
  * - Child node processing and management
9
- * - Style processing with theme variables
8
+ * - Style processing
10
9
  * @template E The type of React element or component this node represents
11
10
  */
12
11
  export declare class BaseNode<E extends NodeElementType> implements NodeInstance<E> {
13
12
  /** The underlying React element or component type that this node represents */
14
13
  element: E;
15
14
  /** Original props passed during construction, preserved for cloning/recreation */
16
- rawProps: RawNodeProps<E>;
15
+ rawProps: Partial<NodeProps<E>>;
17
16
  /** Flag to identify BaseNode instances */
18
17
  readonly isBaseNode: boolean;
19
- /** Processed props after theme resolution, style processing, and child normalization */
18
+ /** Processed props after style processing, and child normalization */
20
19
  private _props?;
21
20
  /** DOM element used for portal rendering */
22
21
  private _portalDOMElement;
23
22
  /** React root instance for portal rendering */
24
23
  private _portalReactRoot;
25
- /** Hash of the current children and theme to detect changes */
26
- private _childrenHash?;
27
24
  /** Cache for normalized children */
28
25
  private _normalizedChildren?;
29
26
  /** Indicates whether the code is running on the server (true) or client (false) */
30
27
  private static _isServer;
31
- /**
32
- * WeakMap cache for processed children, keyed by object/array identity for GC friendliness.
33
- * Each entry stores the hash, processed children, and a server-side flag.
34
- */
35
- private static _processedChildrenWeakCache;
36
- /**
37
- * Map cache for processed children, keyed by a stable string signature.
38
- * Used for non-object cases or as a fallback. Each entry stores the processed children and a server-side flag.
39
- */
40
- private static _processedChildrenMapCache;
41
- /** Maximum number of entries in the Map cache to prevent unbounded growth */
42
- private static readonly _MAX_PROCESSED_CHILDREN_CACHE = 1000;
43
28
  /**
44
29
  * Constructs a new BaseNode instance.
45
30
  *
@@ -49,124 +34,79 @@ export declare class BaseNode<E extends NodeElementType> implements NodeInstance
49
34
  * @param element The React element or component type this node will represent.
50
35
  * @param rawProps The initial, unprocessed props for the element.
51
36
  */
52
- constructor(element: E, rawProps?: RawNodeProps<E>);
37
+ constructor(element: E, rawProps?: Partial<NodeProps<E>>);
53
38
  /**
54
39
  * Lazily processes and retrieves the final, normalized props for the node.
55
40
  *
56
41
  * The first time this getter is accessed, it triggers `_processProps` to resolve
57
- * themes, styles, and children. Subsequent accesses return the cached result
42
+ * styles, and children. Subsequent accesses return the cached result
58
43
  * until the node is cloned or recreated.
59
44
  * @returns The fully processed and normalized `FinalNodeProps`.
60
45
  */
61
46
  get props(): FinalNodeProps;
62
47
  /**
63
- * Performs the core logic of processing raw props into their final, normalized form.
64
- *
65
- * This method is called by the `props` getter on its first access. It handles:
66
- * 1. **Theme Resolution**: Selects the active theme from `theme` or `nodetheme` props.
67
- * 2. **Prop Resolution**: Resolves theme-aware values (functions) in `rawProps` and `nativeProps.style`.
68
- * 3. **Style Extraction**: Separates style-related props (`css`, `style`) from other DOM/component props.
69
- * 4. **Default Style Merging**: Combines default styles with resolved style props.
70
- * 5. **Child Processing**: Normalizes the `children` prop, propagating the theme.
71
- * @returns The processed `FinalNodeProps` object.
48
+ * Processes raw props into a final, normalized form.
49
+ * This includes:
50
+ * - Extracting and separating style-related props
51
+ * - Merging CSS-in-JS styles with other style props
52
+ * - Processing and normalizing children
53
+ * - Combining all parts into a single props object
72
54
  * @private
55
+ * @returns The processed `FinalNodeProps` ready for rendering.
73
56
  */
74
57
  private _processProps;
75
58
  /**
76
- * Deeply clones processed children before returning them from cache so that each parent receives
77
- * independent `BaseNode` instances (prevents sharing cycles and mutation bugs).
78
- *
79
- * - If the input is an array, each child is cloned recursively.
80
- * - If the input is a `BaseNode`, a new instance is created with the same element and copied rawProps.
81
- * - For other objects/primitives, the value is returned as-is (they are immutable or safe to reuse).
82
- *
83
- * This ensures that cached children are never shared between different parents in the React tree.
84
- * @param processed The processed child or array of children to clone.
85
- * @returns A deep clone of the processed children, safe for use in multiple parents.
86
- * @private
87
- */
88
- private static _cloneProcessedChildren;
89
- /**
90
- * Retrieves cached processed children for a given set of `children` and an optional `theme`.
59
+ * Recursively processes raw children, converting them into `BaseNode` instances as needed.
91
60
  *
92
- * - Skips caching entirely when executed on the server (returns `null`).
93
- * - Uses a **WeakMap** for identity-based caching when `children` is an object or array,
94
- * ensuring garbage collection safety.
95
- * - Falls back to a **Map** keyed by a stable hash of `children` and `theme`
96
- * for value-based caching.
97
- * - Only returns cached entries that are **not server-side**.
98
- * @param children The child node(s) to resolve cached results for.
99
- * @param theme The theme context that may influence child processing.
100
- * @returns A cloned version of the cached processed children if available, otherwise `null`.
101
- * @private
102
- */
103
- private _getCachedChildren;
104
- /**
105
- * Caches processed children for a given set of children and theme.
106
- * This method stores the processed NodeElement(s) in a Map keyed by a stable hash.
107
- * The cache is bounded to avoid unbounded memory growth.
108
- * No caching is performed on the server to avoid RSC issues.
109
- * @param children The original children to cache.
110
- * @param theme The theme associated with the children.
111
- * @param processed The processed NodeElement(s) to cache.
112
- * @private
113
- */
114
- private _setCachedChildren;
115
- /**
116
- * Recursively processes raw children, converting them into `BaseNode` instances as needed
117
- * and propagating the provided theme.
118
- *
119
- * This method ensures consistent theme handling for all children and optimizes performance
120
- * using caching strategies: a Map for client-side and no caching for server-side.
61
+ * This method ensures consistent handling for all children.
121
62
  *
122
63
  * - If `children` is an array, each child is processed individually.
123
64
  * - If `children` is a single node, it is processed directly.
124
- * - The processed result is cached on the client to avoid redundant work.
125
65
  * @param children The raw child or array of children to process.
126
- * @param theme The theme to propagate to the children.
127
66
  * @returns The processed children, ready for normalization and rendering.
128
67
  * @private
129
68
  */
130
69
  private _processChildren;
131
70
  /**
132
- * Renders a processed `NodeElement` into a `ReactNode`, applying a theme and key if necessary.
71
+ * Renders a processed `NodeElement` into a `ReactNode`, applying a key if necessary.
133
72
  *
134
73
  * This static method centralizes the logic for converting various types of processed elements
135
74
  * into renderable React nodes. It handles:
136
- * - `BaseNode` instances: Re-wraps them to apply a new key or theme.
75
+ * - `BaseNode` instances: Re-wraps them to apply a new key.
137
76
  * - React class components: Wraps them in a new `BaseNode`.
138
77
  * - `NodeInstance` objects: Invokes their `render()` method.
139
78
  * - React component instances: Invokes their `render()` method.
140
79
  * - Functional components: Creates a React element from them.
141
80
  * - Other valid `ReactNode` types (strings, numbers, etc.): Returns them as-is.
142
81
  * @param processedElement The node element to render.
143
- * @param passedTheme The theme to propagate.
144
82
  * @param passedKey The React key to assign.
145
83
  * @returns A renderable `ReactNode`.
146
84
  * @private
147
85
  * @static
148
86
  */
149
- static _renderProcessedNode(processedElement: NodeElement, passedTheme: Theme | undefined, passedKey?: string): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ReactPortal | null | undefined> | ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined;
87
+ private static _renderProcessedNode;
150
88
  /**
151
- * Determines if a raw node is a function that should be treated as a render prop.
152
- * @param rawNode
89
+ * Renders this node into a `ReactNode`, handling function node element.
90
+ * @param node The node to render.
153
91
  * @private
92
+ * @static
93
+ * @example
94
+ * ```typescript
95
+ * const myNode = Node('div', { children: [ () => 'Hello' ] });
96
+ * ```
154
97
  */
155
- private _isFunctionChild;
98
+ private static _isFunctionChild;
156
99
  /**
157
- * Renders the output of a function-as-a-child, ensuring theme propagation.
100
+ * Renders the output of a function-as-a-child.
158
101
  *
159
102
  * This method is designed to handle "render prop" style children (`() => ReactNode`).
160
- * It invokes the function, processes its result, and ensures the parent's theme is
161
- * correctly passed down to any `BaseNode` instances returned by the function.
103
+ * It invokes the function and processes its result.
162
104
  * @param props The properties for the function renderer.
163
105
  * @param props.render The function to execute to get the child content.
164
- * @param props.passedTheme The theme to propagate to the rendered child.
165
- * @param props.processRawNode A reference to the `_processRawNode` method for recursive processing.
166
106
  * @returns The rendered `ReactNode`.
167
107
  * @private
168
108
  */
169
- private _functionRenderer;
109
+ private static _functionRenderer;
170
110
  /**
171
111
  * Generates a stable key for a node, especially for elements within an array.
172
112
  *
@@ -180,34 +120,35 @@ export declare class BaseNode<E extends NodeElementType> implements NodeInstance
180
120
  * @param options.children The children of the node, used to add complexity to the key.
181
121
  * @returns A React key, or `undefined` if no key could be generated.
182
122
  * @private
123
+ * @static
183
124
  */
184
- private _generateKey;
125
+ private static _generateKey;
185
126
  /**
186
127
  * Processes a single raw node, recursively converting it into a `BaseNode` or other renderable type.
187
128
  *
188
129
  * This is a central method for normalizing children. It handles various types of input:
189
- * - **`BaseNode` instances**: Re-creates them to ensure the correct theme and key are applied.
130
+ * - **`BaseNode` instances**: Re-creates them to ensure the correct key is applied.
190
131
  * - **Primitives**: Returns strings, numbers, booleans, null, and undefined as-is.
191
132
  * - **Functions (Render Props)**: Wraps them in a `BaseNode` that uses `_functionRenderer` to delay execution.
192
- * - **Valid React Elements**: Converts them into `BaseNode` instances, extracting props and propagating the theme.
193
- * - **React Component Types**: Wraps them in a `BaseNode` with the parent theme.
133
+ * - **Valid React Elements**: Converts them into `BaseNode` instances, extracting props.
134
+ * - **React Component Types**: Wraps them in a `BaseNode`.
194
135
  * - **React Component Instances**: Renders them and processes the output recursively.
195
136
  *
196
137
  * It also generates a stable key for elements within an array if one is not provided.
197
- * @param rawNode The raw child node to process.
198
- * @param parentTheme The theme inherited from the parent.
138
+ * @param node The raw child node to process.
199
139
  * @param nodeIndex The index of the child if it is in an array, used for key generation.
200
140
  * @returns A processed `NodeElement` (typically a `BaseNode` instance or a primitive).
201
141
  * @private
142
+ * @static
202
143
  */
203
- private _processRawNode;
144
+ private static _processRawNode;
204
145
  /**
205
146
  * Normalizes a processed child node into a final, renderable `ReactNode`.
206
147
  *
207
148
  * This method is called during the `render` phase. It takes a child that has already
208
149
  * been processed by `_processChildren` and prepares it for `React.createElement`.
209
150
  *
210
- * - For `BaseNode` instances, it calls their `render()` method, ensuring the theme is consistent.
151
+ * - For `BaseNode` instances, it calls their `render()` method.
211
152
  * - It validates that other children are valid React element types.
212
153
  * - Primitives and other valid nodes are returned as-is.
213
154
  * @param child The processed child node to normalize.
@@ -1 +1 @@
1
- {"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../src/core.node.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAQZ,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EAEd,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,eAAe,EACf,YAAY,EACZ,UAAU,EACV,SAAS,EACT,OAAO,EACP,YAAY,EACZ,KAAK,EACN,MAAM,mBAAmB,CAAA;AAQ1B;;;;;;;;GAQG;AACH,qBAAa,QAAQ,CAAC,CAAC,SAAS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