@meonode/ui 0.3.16 → 0.3.17

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/CHANGELOG.md CHANGED
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.17] - 2025-11-12
9
+
10
+ ### Perf
11
+ - **core**: implement iterative renderer and prop caching ([`8a3a264`](https://github.com/l7aromeo/meonode-ui/commit/8a3a264be68bd041b6340636f5f7ee2b0caa63ff))
12
+ - **helper**: refactor theme resolution logic for improved performance and cache correctness ([`9614cb8`](https://github.com/l7aromeo/meonode-ui/commit/9614cb8d2aeae0d9bd2f9cf3edd51c022cd93273))
13
+
14
+ ### Chore
15
+ - fix typo in JSDoc comment for useTheme hook ([`de0ddd9`](https://github.com/l7aromeo/meonode-ui/commit/de0ddd9a6308f4a76b6ad843a6139d42bd3fcf53))
16
+ - add deprecation notice to usePortal hook for future removal ([`f8a2923`](https://github.com/l7aromeo/meonode-ui/commit/f8a29230cad3962addb8cf28ed3538e6de236181))
17
+ - update PortalProps type definition to provide a default type parameter ([`de73ba5`](https://github.com/l7aromeo/meonode-ui/commit/de73ba5b9d9dd51637b24b0309d681309d9338ae))
18
+ - update isNodeInstance type guard to use BaseNode instead of NodeInstance ([`2c69d05`](https://github.com/l7aromeo/meonode-ui/commit/2c69d05b3d1593a976e439ca7404696b781e5012))
19
+ - rename jest.config.mjs to jest.config.ts and update configuration for TypeScript support ([`a3213eb`](https://github.com/l7aromeo/meonode-ui/commit/a3213eb5b91a55364cb4f5362005bc2a46934de5))
20
+ - **scripts**: increase stack size for jest test and fix build commands ([`e046cdf`](https://github.com/l7aromeo/meonode-ui/commit/e046cdf397e2cf418e09e149a9e0cf1e48f3d926))
21
+ - update tsconfig.json to exclude dist and node_modules directories ([`eeb9577`](https://github.com/l7aromeo/meonode-ui/commit/eeb957722ab7a26cbe59047c068f9955b082502e))
22
+ - update tsconfig.json with enhanced compiler options and path mappings for better development experience ([`89bc1a4`](https://github.com/l7aromeo/meonode-ui/commit/89bc1a42c23f015acfed1bcb860ebb6a4c684fc1))
23
+
8
24
  ## [0.3.16] - 2025-11-05
9
25
 
10
26
  ### Added
@@ -441,7 +457,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
441
457
  - Improves developer experience when working with prebuilt components:
442
458
  - Example:
443
459
  ```typescript
444
- import { Div, Input } from '@meonode/ui'
460
+ import { Div, Input } from '@meonode/ui'
445
461
 
446
462
  // Add new props
447
463
  Div<{ field: string }>({ field: 'Hello' })
@@ -621,4 +637,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
621
637
  - This changelog covers the most recent development history available
622
638
  - The project focuses on building React UIs with type-safe fluency without JSX syntax
623
639
  - Recent development has emphasized Emotion integration, type safety improvements, and enhanced flexbox support
624
- - For a complete history, view all commits on GitHub: [View all commits](https://github.com/l7aromeo/meonode-ui/commits)
640
+ - For a complete history, view all commits on GitHub: [View all commits](https://github.com/l7aromeo/meonode-ui/commits)
@@ -1,85 +1,131 @@
1
1
  import { type ReactElement } from 'react';
2
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.
5
- * This class wraps React elements and handles:
6
- * - Props processing and normalization
7
- * - Child node processing and management
8
- * - Style processing
9
- * @template E The type of React element or component this node represents
4
+ * The core abstraction of the MeoNode library. It wraps a React element or component,
5
+ * providing a unified interface for processing props, normalizing children, and handling styles.
6
+ * This class is central to the library's ability to offer a JSX-free, fluent API for building UIs.
7
+ * It uses an iterative rendering approach to handle deeply nested structures without causing stack overflows.
8
+ * @class BaseNode
9
+ * @template E - The type of React element or component this node represents.
10
10
  */
11
11
  export declare class BaseNode<E extends NodeElementType> implements NodeInstance<E> {
12
- /** The underlying React element or component type that this node represents */
13
12
  element: E;
14
- /** Original props passed during construction, preserved for cloning/recreation */
15
13
  rawProps: Partial<NodeProps<E>>;
16
- /** Flag to identify BaseNode instances */
17
14
  readonly isBaseNode: boolean;
18
- /** Processed props after style processing, and child normalization */
19
15
  private _props?;
20
- /** DOM element used for portal rendering */
21
16
  private _portalDOMElement;
22
- /** React root instance for portal rendering */
23
17
  private _portalReactRoot;
24
- /** Cache for normalized children */
25
- private _normalizedChildren?;
26
- /** Indicates whether the code is running on the server (true) or client (false) */
27
18
  private static _isServer;
28
- /**
29
- * Constructs a new BaseNode instance.
30
- */
19
+ private static _propProcessingCache;
20
+ private static _isValidElement;
31
21
  constructor(element: E, rawProps?: Partial<NodeProps<E>>);
32
22
  /**
33
23
  * Lazily processes and retrieves the final, normalized props for the node.
24
+ * The props are processed only once and then cached for subsequent accesses.
25
+ * @getter props
34
26
  */
35
27
  get props(): FinalNodeProps;
36
28
  /**
37
- * Processes raw props into a final, normalized form.
29
+ * A fast, non-cryptographic hash function (FNV-1a) used to generate a unique signature for a set of props.
30
+ * This is significantly faster than `JSON.stringify` for creating cache keys.
31
+ * @method _hashString
32
+ */
33
+ private static _hashString;
34
+ /**
35
+ * Creates a unique, stable signature from a set of props. This signature is used as a key for caching computed CSS props.
36
+ * It serializes only primitive values and the structure of objects/arrays to ensure speed and stability.
37
+ * @method _createPropSignature
38
+ */
39
+ private static _createPropSignature;
40
+ /**
41
+ * Retrieves computed CSS props from the cache if available. If not, it computes them,
42
+ * adds them to the cache, and then returns them. An LRU-like mechanism is used to prevent the cache from growing indefinitely.
43
+ * @method _getCachedCssProps
44
+ */
45
+ private static _getCachedCssProps;
46
+ /**
47
+ * Separates props into cacheable (primitives, arrays, plain objects) and non-cacheable (functions) groups.
48
+ * This is crucial for ensuring that only serializable, static values are used for generating cache signatures.
49
+ * @method _splitProps
50
+ */
51
+ private static _splitProps;
52
+ /**
53
+ * The main prop processing pipeline. It orchestrates splitting props, generating cache signatures,
54
+ * retrieving cached CSS props, computing DOM props, and normalizing children.
55
+ * @method _processProps
38
56
  */
39
57
  private _processProps;
40
58
  /**
41
- * Recursively processes raw children, converting them into `BaseNode` instances as needed.
59
+ * Processes the `children` prop of a node. It handles single children, arrays of children,
60
+ * and function-as-a-child render props, passing them to `_processRawNode` for normalization.
61
+ * @method _processChildren
42
62
  */
43
63
  private _processChildren;
44
64
  /**
45
- * Renders a processed `NodeElement` into a `ReactNode`.
65
+ * The core normalization function for a single child. It takes any valid `NodeElement`
66
+ * (primitive, React element, function, `BaseNode` instance) and converts it into a standardized `BaseNode`
67
+ * instance if it isn't one already. This ensures a consistent structure for the iterative renderer.
68
+ * @method _processRawNode
46
69
  */
47
- private static _renderProcessedNode;
70
+ private static _processRawNode;
48
71
  /**
49
- * Checks if a node is a function child (render prop style).
72
+ * A helper to reliably identify if a given function is a "function-as-a-child" (render prop)
73
+ * rather than a standard Function Component.
74
+ * @method _isFunctionChild
50
75
  */
51
76
  private static _isFunctionChild;
52
77
  /**
53
- * Renders the output of a function-as-a-child.
78
+ * A wrapper component that executes a function-as-a-child and processes its return value.
79
+ * @method _functionRenderer
54
80
  */
55
81
  private static _functionRenderer;
56
82
  /**
57
- * Processes a single raw node, recursively converting it into a `BaseNode` or other renderable type.
83
+ * A legacy helper for the recursive child processing path. This is primarily used by `_functionRenderer`.
84
+ * @method _renderProcessedNode
58
85
  */
59
- private static _processRawNode;
60
- /**
61
- * Normalizes a processed child node into a final, renderable `ReactNode`.
62
- */
63
- private _normalizeChild;
86
+ private static _renderProcessedNode;
64
87
  /**
65
- * Renders the `BaseNode` into a `ReactElement`.
88
+ * Renders the `BaseNode` and its entire subtree into a ReactElement.
89
+ * This method uses an **iterative (non-recursive) approach** with a manual work stack.
90
+ * This is a crucial architectural choice to prevent "Maximum call stack size exceeded" errors
91
+ * when rendering very deeply nested component trees, a common limitation of naive recursive rendering.
92
+ *
93
+ * The process works in two phases for each node:
94
+ * 1. **Begin Phase:** When a node is first visited, its children are pushed onto the stack. This ensures a bottom-up build.
95
+ * 2. **Complete Phase:** After all of a node's descendants have been rendered, the loop returns to the node.
96
+ * It then collects the rendered children from a temporary map and creates its own React element.
97
+ * @method render
66
98
  */
67
99
  render(): ReactElement<FinalNodeProps>;
68
100
  /**
69
- * Portal infrastructure setup
101
+ * Ensures that the necessary DOM element and React root are available for portal rendering.
102
+ * This is only executed on the client-side.
103
+ * @method _ensurePortalInfrastructure
70
104
  */
71
105
  private _ensurePortalInfrastructure;
72
106
  /**
73
- * Portal rendering
107
+ * Renders the node into a React Portal, mounting it directly under `document.body`.
108
+ * Returns a handle with `update` and `unmount` methods to control the portal's lifecycle.
109
+ * @method toPortal
74
110
  */
75
111
  toPortal(): NodePortal;
112
+ /**
113
+ * A static method to clear all internal caches. This is primarily useful for testing
114
+ * to ensure that tests run in a clean, isolated state.
115
+ * @method clearCaches
116
+ */
117
+ static clearCaches(): void;
76
118
  }
77
119
  /**
78
- * Factory function to create a `BaseNode` instance.
120
+ * The primary factory function for creating a `BaseNode` instance.
121
+ * It's the simplest way to wrap a component or element.
122
+ * @function Node
79
123
  */
80
124
  export declare function Node<AdditionalProps extends Record<string, any>, E extends NodeElementType>(element: E, props?: MergedProps<E, AdditionalProps>, additionalProps?: AdditionalProps): NodeInstance<E>;
81
125
  /**
82
126
  * Creates a curried node factory for a given React element or component type.
127
+ * This is useful for creating reusable, specialized factory functions (e.g., `const Div = createNode('div')`).
128
+ * @function createNode
83
129
  */
84
130
  export declare function createNode<AdditionalInitialProps extends Record<string, any>, E extends NodeElementType>(element: E, initialProps?: MergedProps<E, AdditionalInitialProps>): HasRequiredProps<PropsOf<E>> extends true ? (<AdditionalProps extends Record<string, any> = Record<string, any>>(props: MergedProps<E, AdditionalProps>) => NodeInstance<E>) & {
85
131
  element: E;
@@ -88,6 +134,8 @@ export declare function createNode<AdditionalInitialProps extends Record<string,
88
134
  };
89
135
  /**
90
136
  * Creates a node factory function where the first argument is `children` and the second is `props`.
137
+ * This provides a more ergonomic API for components that primarily wrap content (e.g., `P('Some text')`).
138
+ * @function createChildrenFirstNode
91
139
  */
92
140
  export declare function createChildrenFirstNode<AdditionalInitialProps extends Record<string, any>, E extends NodeElementType>(element: E, initialProps?: Omit<NodeProps<E>, keyof AdditionalInitialProps | 'children'> & AdditionalInitialProps): HasRequiredProps<PropsOf<E>> extends true ? (<AdditionalProps extends Record<string, any> = Record<string, any>>(children: Children, props: Omit<MergedProps<E, AdditionalProps>, 'children'>) => NodeInstance<E>) & {
93
141
  element: E;
@@ -1 +1 @@
1
- {"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../src/core.node.ts"],"names":[],"mappings":"AAAA,OAAc,EAKZ,KAAK,YAAY,EAOlB,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EAEd,gBAAgB,EAChB,WAAW,EAEX,eAAe,EAEf,YAAY,EACZ,UAAU,EACV,SAAS,EACT,OAAO,EACR,MAAM,mBAAmB,CAAA;AAO1B;;;;;;;GAOG;AACH,qBAAa,QAAQ,CAAC,CAAC,SAAS,eAAe,CAAE,YAAW,YAAY,CAAC,CAAC,CAAC;IACzE,+EAA+E;IACxE,OAAO,EAAE,CAAC,CAAA;IACjB,kFAAkF;IAC3E,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAK;IAC3C,0CAA0C;IAC1C,SAAgB,UAAU,UAAO;IAEjC,sEAAsE;IACtE,OAAO,CAAC,MAAM,CAAC,CAAgB;IAC/B,4CAA4C;IAC5C,OAAO,CAAC,iBAAiB,CAA8B;IACvD,+CAA+C;IAC/C,OAAO,CAAC,gBAAgB,CAA0E;IAClG,oCAAoC;IACpC,OAAO,CAAC,mBAAmB,CAAC,CAAyB;IACrD,mFAAmF;IACnF,OAAO,CAAC,MAAM,CAAC,SAAS,CAAgC;IAExD;;OAEG;IACH,YAAY,OAAO,EAAE,CAAC,EAAE,QAAQ,GAA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excluded3=["style"],_excluded4=["children","key","css","nativeProps","disableEmotion"];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 _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}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 _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)}import React,{createElement,isValidElement,Activity,Fragment,Suspense}from"react";import{isNodeInstance}from"./helper/node.helper.js";import{isActivity,isForwardRef,isFragment,isMemo,isPortal,isReactClassComponent,isSuspense,isValidElementType}from"./helper/react-is.helper.js";import{createRoot}from"react-dom/client";import{getComponentType,getCSSProps,getDOMProps,getElementTypeName,hasNoStyleTag,omitUndefined}from"./helper/common.helper.js";import StyledRenderer from"./components/styled-renderer.client.js";/**
2
- * Represents a node in a React component tree.
3
- * This class wraps React elements and handles:
4
- * - Props processing and normalization
5
- * - Child node processing and management
6
- * - Style processing
7
- * @template E The type of React element or component this node represents
8
- */export class BaseNode{/**
9
- * Constructs a new BaseNode instance.
10
- */constructor(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};/** The underlying React element or component type that this node represents *//** Original props passed during construction, preserved for cloning/recreation *//** Flag to identify BaseNode instances *//** DOM element used for portal rendering *//** React root instance for portal rendering *//**
11
- * Normalizes a processed child node into a final, renderable `ReactNode`.
12
- */_defineProperty(this,"rawProps",{}),_defineProperty(this,"isBaseNode",!0),_defineProperty(this,"_portalDOMElement",null),_defineProperty(this,"_portalReactRoot",null),_defineProperty(this,"_normalizeChild",function(a){if(null===a||a===void 0)return a;var b=_typeof(a);if("string"===b||"number"===b||"boolean"===b)return a;if(a instanceof BaseNode||isNodeInstance(a))return a.render();if("function"==typeof a.render)return a.render();if("object"===_typeof(a)&&"isBaseNode"in a&&"rawProps"in a&&"element"in a&&!isNodeInstance(a))return new BaseNode(a.element,a.rawProps).render();if(!isValidElementType(a)&&!isPortal(a)){var c=getComponentType(a);throw new Error("Invalid element type: ".concat(c," provided!"))}return a}),this.element=a,this.rawProps=b}/**
1
+ var _excluded=["ref","key","children","css","props","disableEmotion"],_excluded2=["style"],_excluded3=["children","key","css","nativeProps","disableEmotion"];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 _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}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 _createForOfIteratorHelper(b,c){var d="undefined"!=typeof Symbol&&b[Symbol.iterator]||b["@@iterator"];if(!d){if(Array.isArray(b)||(d=_unsupportedIterableToArray(b))||c&&b&&"number"==typeof b.length){d&&(b=d);var e=0,f=function F(){};return{s:f,n:function n(){return e>=b.length?{done:!0}:{done:!1,value:b[e++]}},e:function e(a){throw a},f:f}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var g,h=!0,i=!1;return{s:function s(){d=d.call(b)},n:function n(){var a=d.next();return h=a.done,a},e:function e(a){i=!0,g=a},f:function f(){try{h||null==d["return"]||d["return"]()}finally{if(i)throw g}}}}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 _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)}import React,{createElement,isValidElement,Fragment}from"react";import{isNodeInstance}from"./helper/node.helper.js";import{isForwardRef,isFragment,isMemo,isReactClassComponent,isValidElementType}from"./helper/react-is.helper.js";import{createRoot}from"react-dom/client";import{getComponentType,getCSSProps,getDOMProps,getElementTypeName,hasNoStyleTag,omitUndefined}from"./helper/common.helper.js";import StyledRenderer from"./components/styled-renderer.client.js";/**
2
+ * Defines the structure for caching CSS property processing results.
3
+ * This cache helps to avoid re-computing CSS props for the same set of input props,
4
+ * significantly speeding up rendering for components with static styles.
5
+ * @interface PropProcessingCache
6
+ * @property {Record<string, any>} cssProps - The computed CSS properties.
7
+ * @property {string} signature - A unique signature generated from the cacheable props.
8
+ *//**
9
+ * The core abstraction of the MeoNode library. It wraps a React element or component,
10
+ * providing a unified interface for processing props, normalizing children, and handling styles.
11
+ * This class is central to the library's ability to offer a JSX-free, fluent API for building UIs.
12
+ * It uses an iterative rendering approach to handle deeply nested structures without causing stack overflows.
13
+ * @class BaseNode
14
+ * @template E - The type of React element or component this node represents.
15
+ */export class BaseNode{constructor(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};// Element type validation is performed once at construction to prevent invalid nodes from being created.
16
+ if(_defineProperty(this,"rawProps",{}),_defineProperty(this,"isBaseNode",!0),_defineProperty(this,"_portalDOMElement",null),_defineProperty(this,"_portalReactRoot",null),!BaseNode._isValidElement(a)){var c=getComponentType(a);throw new Error("Invalid element type: ".concat(c," provided!"))}this.element=a,this.rawProps=b}/**
13
17
  * Lazily processes and retrieves the final, normalized props for the node.
14
- */get props(){return this._props||(this._props=this._processProps()),this._props}/**
15
- * Processes raw props into a final, normalized form.
16
- */_processProps(){var a=this.rawProps,b=a.ref,c=a.key,d=a.children,e=a.css,f=a.props,g=void 0===f?{}:f,h=a.disableEmotion,i=_objectWithoutProperties(a,_excluded),j=g,k=j.style,l=_objectWithoutProperties(j,_excluded2),m=getCSSProps(i),n=getDOMProps(i),o=this._processChildren(d,h);return omitUndefined(_objectSpread(_objectSpread({ref:b,key:c,css:_objectSpread(_objectSpread({},m),e),style:k},n),{},{disableEmotion:h,nativeProps:l,children:o}))}/**
17
- * Recursively processes raw children, converting them into `BaseNode` instances as needed.
18
- */_processChildren(a,b){if(a){var c;return c="function"==typeof a?a:Array.isArray(a)?a.map(function(a){return BaseNode._processRawNode(a,b)}):BaseNode._processRawNode(a,b),c}}/**
19
- * Renders a processed `NodeElement` into a `ReactNode`.
20
- */static _renderProcessedNode(a){var b=a.processedElement,c=a.passedKey,d=a.disableEmotion,e={};if(void 0!==c&&(e.key=c),b instanceof BaseNode||isNodeInstance(b)){var f,g=null===(f=b.rawProps)||void 0===f?void 0:f.key;return b.rawProps.disableEmotion=d,g===c?b.render():new BaseNode(b.element,_objectSpread(_objectSpread({},b.rawProps),e)).render()}return isReactClassComponent(b)?new BaseNode(b,_objectSpread(_objectSpread({},e),{},{disableEmotion:d})).render():isNodeInstance(b)?(b.rawProps.disableEmotion=d,b.render()):b instanceof React.Component?b.render():"function"==typeof b?createElement(b,{key:c}):b}/**
21
- * Checks if a node is a function child (render prop style).
22
- */static _isFunctionChild(a){if("function"!=typeof a)return!1;if(isReactClassComponent(a))return!1;if(isMemo(a))return!1;if(isForwardRef(a))return!1;try{return!(a.prototype&&"function"==typeof a.prototype.render)}catch(a){return!0}}/**
23
- * Renders the output of a function-as-a-child.
24
- */static _functionRenderer(a){var b,c=a.render,d=a.disableEmotion;try{b=c()}catch(a){b=null}if(null===b||b===void 0)return b;if(b instanceof BaseNode||isNodeInstance(b))// If disableEmotion is true and the result doesn't have it, create a new node.
25
- return d&&!b.rawProps.disableEmotion?new BaseNode(b.element,_objectSpread(_objectSpread({},b.rawProps),{},{disableEmotion:!0})).render():b.render();// Otherwise, just render the result.
26
- if(Array.isArray(b))return b.map(function(a,b){var c=BaseNode._processRawNode(a,d);return BaseNode._renderProcessedNode({processedElement:c,passedKey:"".concat(getElementTypeName(a),"-").concat(b)})});if(b instanceof React.Component){var e=b.render(),f=BaseNode._processRawNode(e,d);return BaseNode._renderProcessedNode({processedElement:f,disableEmotion:d})}if("string"==typeof b||"number"==typeof b||"boolean"==typeof b)return b;var g=BaseNode._processRawNode(b,d);return g?BaseNode._renderProcessedNode({processedElement:g,disableEmotion:d}):b}/**
27
- * Processes a single raw node, recursively converting it into a `BaseNode` or other renderable type.
28
- */static _processRawNode(a,b){// Primitives and null/undefined - return as-is
29
- if(null===a||a===void 0||"string"==typeof a||"number"==typeof a||"boolean"==typeof a)return a;// Already processed nodes - return as-is
30
- if(a instanceof BaseNode||isNodeInstance(a))return b&&!a.rawProps.disableEmotion?new BaseNode(a.element,_objectSpread(_objectSpread({},a.rawProps),{},{disableEmotion:!0})):a;// Function children (render props) - wrap in function renderer
31
- if(BaseNode._isFunctionChild(a))return new BaseNode(BaseNode._functionRenderer,{props:{render:a,disableEmotion:b}});// React elements - extract props and wrap in BaseNode
32
- if(isValidElement(a)){var c=a.props,d=c.style,e=_objectWithoutProperties(c,_excluded3),f=_objectSpread(_objectSpread({},e),d||{});return new BaseNode(a.type,_objectSpread(_objectSpread(_objectSpread({},f),null!==a.key&&void 0!==a.key?{key:a.key}:{}),{},{disableEmotion:b}))}// Component types - wrap in BaseNode
33
- if(isReactClassComponent(a)||isMemo(a)||isForwardRef(a))return new BaseNode(a,{disableEmotion:b});// React.Component instances - render and process recursively
34
- if(a instanceof React.Component){var g=a.render();return BaseNode._processRawNode(g,b)}// Everything else - return as-is
35
- return a}/**
36
- * Renders the `BaseNode` into a `ReactElement`.
37
- */render(){var a=this;if(!isValidElementType(this.element)){var b=getComponentType(this.element);throw new Error("Invalid element type: ".concat(b," provided!"))}var c=this.props,d=c.children,e=c.key,f=c.css,g=c.nativeProps,h=c.disableEmotion,i=_objectWithoutProperties(c,_excluded4),j=void 0;if(d!==void 0&&null!==d){if(!this._normalizedChildren)if(!Array.isArray(d))this._normalizedChildren=this._normalizeChild(d);else if(0<d.length){var k=d.map(function(b){return a._normalizeChild(b)});this._normalizedChildren=k.every(function(a){return null===a||void 0===a})?void 0:k}else this._normalizedChildren=void 0;j=this._normalizedChildren}// Fragment handling
38
- if(this.element===Fragment||isFragment(this.element))return createElement(this.element,{key:e},...(Array.isArray(j)?j:[j]));// Common props for all createElement calls
39
- var l=_objectSpread(_objectSpread({},i),{},{key:e},g),m=[function(a){return a===Suspense},function(a){return a===Activity},function(a){return isSuspense(a)},function(a){return isActivity(a)}].some(function(b){try{return b(a.element)}catch(a){return!1}}),n=this.element&&!hasNoStyleTag(this.element)&&f&&!h&&!m&&!isFragment(this.element)&&this.element!==Fragment&&!isSuspense(this.element)&&this.element!==Suspense&&!isActivity(this.element)&&this.element!==Activity;// Determine if the element is a non-styled React component
40
- // Determine if the element is a styled component
41
- /* Styled component handling */if(n){try{var o=getElementTypeName(this.element);StyledRenderer.displayName="Styled(".concat(o,")")}catch(a){// swallow: displayName is not critical
42
- }return createElement(StyledRenderer,_objectSpread(_objectSpread({element:this.element},l),{},{css:f,suppressHydrationWarning:!0}),...(Array.isArray(j)?j:[j]))}/* End styled component handling */// Regular element handling
43
- try{this.element.displayName=getElementTypeName(this.element)}catch(a){// swallow: displayName is not critical
44
- }return createElement(this.element,l,...(Array.isArray(j)?j:[j]))}/**
45
- * Portal infrastructure setup
46
- */_ensurePortalInfrastructure(){if(BaseNode._isServer)return!1;if(this._portalDOMElement&&this._portalReactRoot&&this._portalDOMElement.isConnected)return!0;if(this._portalDOMElement&&!this._portalDOMElement.isConnected){if(this._portalReactRoot){try{this._portalReactRoot.unmount()}catch(a){// swallow
47
- }this._portalReactRoot=null}this._portalDOMElement=null}if(this._portalDOMElement||(this._portalDOMElement=document.createElement("div"),document.body.appendChild(this._portalDOMElement)),!this._portalReactRoot){if(!this._portalDOMElement)return!1;var a=createRoot(this._portalDOMElement);this._portalReactRoot={render:a.render.bind(a),unmount:a.unmount.bind(a),update:function update(){}}}return!0}/**
48
- * Portal rendering
49
- */toPortal(){var a=this;if(!this._ensurePortalInfrastructure()||!this._portalReactRoot)throw new Error("toPortal() can only be called in a client-side environment where document.body is available.");(function renderCurrent(){try{var b=a.render();a._portalReactRoot.render(b)}catch(a){// swallow render errors to avoid breaking caller
50
- }})();try{var b=this._portalReactRoot.unmount.bind(this._portalReactRoot),c=this._portalReactRoot;return c.update=function(b){try{if(!a._portalReactRoot)return;if(b instanceof BaseNode||b&&"function"==typeof b.render){var c=b.render?b.render():b;return void a._portalReactRoot.render(c)}a._portalReactRoot.render(b)}catch(a){// swallow
51
- }},c.unmount=function(){try{b()}catch(a){// swallow
52
- }if(a._portalDOMElement){try{a._portalDOMElement.parentNode&&a._portalDOMElement.parentNode.removeChild(a._portalDOMElement)}catch(a){// swallow
53
- }a._portalDOMElement=null}a._portalReactRoot=null},c}catch(a){return this._portalReactRoot}}}/**
54
- * Factory function to create a `BaseNode` instance.
55
- */_defineProperty(BaseNode,"_isServer","undefined"==typeof window);export function Node(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=_objectSpread(_objectSpread({},b),c);return new BaseNode(a,d)}/**
18
+ * The props are processed only once and then cached for subsequent accesses.
19
+ * @getter props
20
+ */get props(){return this._props||(this._props=this._processProps()),this._props}// --- Prop Caching and Processing ---
21
+ /**
22
+ * A fast, non-cryptographic hash function (FNV-1a) used to generate a unique signature for a set of props.
23
+ * This is significantly faster than `JSON.stringify` for creating cache keys.
24
+ * @method _hashString
25
+ */static _hashString(a){// FNV offset basis
26
+ for(var b=Math.imul,c=2166136261,d=0;d<a.length;d++)c^=a.charCodeAt(d),c=b(c,16777619);return(c>>>0).toString(36)}/**
27
+ * Creates a unique, stable signature from a set of props. This signature is used as a key for caching computed CSS props.
28
+ * It serializes only primitive values and the structure of objects/arrays to ensure speed and stability.
29
+ * @method _createPropSignature
30
+ */static _createPropSignature(a){var b,c=Object.keys(a).sort(),d="",e=_createForOfIteratorHelper(c);try{for(e.s();!(b=e.n()).done;){var f=b.value,g=a[f],h=void 0,i=_typeof(g);h="string"===i||"number"===i||"boolean"===i?"".concat(f,":").concat(g,";"):null===g?"".concat(f,":null;"):void 0===g?"".concat(f,":undefined;"):Array.isArray(g)?"".concat(f,":[").concat(g.length,"];"):"".concat(f,":{").concat(Object.keys(g).length,"};"),d+=h}}catch(a){e.e(a)}finally{e.f()}return BaseNode._hashString(d)}/**
31
+ * Retrieves computed CSS props from the cache if available. If not, it computes them,
32
+ * adds them to the cache, and then returns them. An LRU-like mechanism is used to prevent the cache from growing indefinitely.
33
+ * @method _getCachedCssProps
34
+ */static _getCachedCssProps(a,b){var c=BaseNode._propProcessingCache.get(b);if(c)return{cssProps:c.cssProps};var d=getCSSProps(a);// LRU-like cache eviction policy.
35
+ if(BaseNode._propProcessingCache.set(b,{cssProps:d,signature:b}),500<BaseNode._propProcessingCache.size){var e=BaseNode._propProcessingCache.keys().next().value;e&&BaseNode._propProcessingCache["delete"](e)}return{cssProps:d}}/**
36
+ * Separates props into cacheable (primitives, arrays, plain objects) and non-cacheable (functions) groups.
37
+ * This is crucial for ensuring that only serializable, static values are used for generating cache signatures.
38
+ * @method _splitProps
39
+ */static _splitProps(a){var b={};for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&"function"!=typeof a[c]&&(b[c]=a[c]);return{cacheable:b}}/**
40
+ * The main prop processing pipeline. It orchestrates splitting props, generating cache signatures,
41
+ * retrieving cached CSS props, computing DOM props, and normalizing children.
42
+ * @method _processProps
43
+ */_processProps(){var a=this.rawProps,b=a.ref,c=a.key,d=a.children,e=a.css,f=a.props,g=void 0===f?{}:f,h=a.disableEmotion,i=_objectWithoutProperties(a,_excluded);// --- Fast Path Optimization ---
44
+ // For simple nodes with no styling props, we can bypass most of the expensive processing.
45
+ // This dramatically improves performance for deeply nested, unstyled structures.
46
+ if(0===Object.keys(i).length&&!e)return omitUndefined({ref:b,key:c,css:{},style:g.style,disableEmotion:h,nativeProps:omitUndefined(g),children:this._processChildren(d,h)});// --- Prop Caching and Computation ---
47
+ var j=BaseNode._splitProps(i),k=j.cacheable,l=BaseNode._createPropSignature(k),m=BaseNode._getCachedCssProps(k,l),n=m.cssProps,o=getDOMProps(i),p=_objectSpread(_objectSpread({},n),e),q=this._processChildren(d,h);// DOM props (like event handlers) are always computed fresh to ensure reference correctness.
48
+ // Merge computed CSS props with any explicit `css` prop provided.
49
+ // --- Child Normalization ---
50
+ // --- Final Assembly ---
51
+ return omitUndefined(_objectSpread(_objectSpread({ref:b,key:c,css:p,style:g.style},o),{},{disableEmotion:h,nativeProps:omitUndefined(g),children:q}))}// --- Child Processing ---
52
+ /**
53
+ * Processes the `children` prop of a node. It handles single children, arrays of children,
54
+ * and function-as-a-child render props, passing them to `_processRawNode` for normalization.
55
+ * @method _processChildren
56
+ */_processChildren(a,b){return a?"function"==typeof a?a:Array.isArray(a)?a.map(function(a){return BaseNode._processRawNode(a,b)}):BaseNode._processRawNode(a,b):void 0}/**
57
+ * The core normalization function for a single child. It takes any valid `NodeElement`
58
+ * (primitive, React element, function, `BaseNode` instance) and converts it into a standardized `BaseNode`
59
+ * instance if it isn't one already. This ensures a consistent structure for the iterative renderer.
60
+ * @method _processRawNode
61
+ */static _processRawNode(a,b){// Primitives and null/undefined are returned as-is.
62
+ if(null===a||a===void 0||"string"==typeof a||"number"==typeof a||"boolean"==typeof a)return a;// If it's already a BaseNode, just ensure the `disableEmotion` flag is propagated.
63
+ if(isNodeInstance(a))return b&&!a.rawProps.disableEmotion?new BaseNode(a.element,_objectSpread(_objectSpread({},a.rawProps),{},{disableEmotion:!0})):a;// Handle function-as-a-child (render props).
64
+ if(BaseNode._isFunctionChild(a))return new BaseNode(BaseNode._functionRenderer,{props:{render:a,disableEmotion:b}});// Handle standard React elements.
65
+ if(isValidElement(a)){var c=a.props,d=c.style,e=_objectWithoutProperties(c,_excluded2),f=_objectSpread(_objectSpread({},e),d||{});return new BaseNode(a.type,_objectSpread(_objectSpread(_objectSpread({},f),null!==a.key&&void 0!==a.key?{key:a.key}:{}),{},{disableEmotion:b}))}// Handle component classes and memos.
66
+ return isReactClassComponent(a)||isMemo(a)||isForwardRef(a)?new BaseNode(a,{disableEmotion:b}):a instanceof React.Component?BaseNode._processRawNode(a.render(),b):a;// Handle component instances.
67
+ }/**
68
+ * A helper to reliably identify if a given function is a "function-as-a-child" (render prop)
69
+ * rather than a standard Function Component.
70
+ * @method _isFunctionChild
71
+ */static _isFunctionChild(a){if("function"!=typeof a||isReactClassComponent(a)||isMemo(a)||isForwardRef(a))return!1;try{return!(a.prototype&&"function"==typeof a.prototype.render)}catch(a){return!0}}/**
72
+ * A wrapper component that executes a function-as-a-child and processes its return value.
73
+ * @method _functionRenderer
74
+ */static _functionRenderer(a){var b,c=a.render,d=a.disableEmotion;try{b=c()}catch(a){b=null}if(null===b||b===void 0)return b;if(isNodeInstance(b))return d&&!b.rawProps.disableEmotion?new BaseNode(b.element,_objectSpread(_objectSpread({},b.rawProps),{},{disableEmotion:!0})).render():b.render();if(Array.isArray(b))return b.map(function(a,b){return BaseNode._renderProcessedNode({processedElement:BaseNode._processRawNode(a,d),passedKey:"".concat(getElementTypeName(a),"-").concat(b)})});if(b instanceof React.Component)return BaseNode._renderProcessedNode({processedElement:BaseNode._processRawNode(b.render(),d),disableEmotion:d});if("string"==typeof b||"number"==typeof b||"boolean"==typeof b)return b;var e=BaseNode._processRawNode(b,d);return e?BaseNode._renderProcessedNode({processedElement:e,disableEmotion:d}):b}/**
75
+ * A legacy helper for the recursive child processing path. This is primarily used by `_functionRenderer`.
76
+ * @method _renderProcessedNode
77
+ */static _renderProcessedNode(a){var b=a.processedElement,c=a.passedKey,d=a.disableEmotion,e={};if(void 0!==c&&(e.key=c),isNodeInstance(b)){var f,g=null===(f=b.rawProps)||void 0===f?void 0:f.key;return b.rawProps.disableEmotion=d,g===c?b.render():new BaseNode(b.element,_objectSpread(_objectSpread({},b.rawProps),e)).render()}return isReactClassComponent(b)?new BaseNode(b,_objectSpread(_objectSpread({},e),{},{disableEmotion:d})).render():b instanceof React.Component?b.render():"function"==typeof b?createElement(b,{key:c}):b}// --- Iterative Renderer ---
78
+ /**
79
+ * Renders the `BaseNode` and its entire subtree into a ReactElement.
80
+ * This method uses an **iterative (non-recursive) approach** with a manual work stack.
81
+ * This is a crucial architectural choice to prevent "Maximum call stack size exceeded" errors
82
+ * when rendering very deeply nested component trees, a common limitation of naive recursive rendering.
83
+ *
84
+ * The process works in two phases for each node:
85
+ * 1. **Begin Phase:** When a node is first visited, its children are pushed onto the stack. This ensures a bottom-up build.
86
+ * 2. **Complete Phase:** After all of a node's descendants have been rendered, the loop returns to the node.
87
+ * It then collects the rendered children from a temporary map and creates its own React element.
88
+ * @method render
89
+ */render(){for(var a=[{node:this,isProcessed:!1}],b=new Map;0<a.length;){var c=a[a.length-1],d=c.node,e=c.isProcessed;// Peek at the top of the stack
90
+ if(!e){c.isProcessed=!0;var f=d.props.children;if(f)// Push children in reverse order to maintain the correct processing sequence.
91
+ for(var g=(Array.isArray(f)?f:[f]).filter(isNodeInstance),h=g.length-1;0<=h;h--)a.push({node:g[h],isProcessed:!1})}else{a.pop();// Pop the completed work.
92
+ var j=d.props,k=j.children,l=j.key,m=j.css,n=j.nativeProps,o=j.disableEmotion,p=_objectWithoutProperties(j,_excluded3),q=[];// Collect rendered children from the map.
93
+ k&&(q=(Array.isArray(k)?k:[k]).map(function(a){return isNodeInstance(a)?b.get(a):isValidElement(a)?a:a}));var r=_objectSpread(_objectSpread({},p),{},{key:l},n),s=void 0;// Handle special cases like Fragment.
94
+ if(d.element===Fragment||isFragment(d.element))s=createElement(d.element,{key:l},...q);else{// Determine if the component should be styled with Emotion.
95
+ var t=m&&!o&&!hasNoStyleTag(d.element);s=t?createElement(StyledRenderer,_objectSpread(_objectSpread({element:d.element},r),{},{css:m,suppressHydrationWarning:!0}),...q):createElement(d.element,r,...q)}// Store the final rendered element in the map for its parent to retrieve.
96
+ b.set(d,s)}}return b.get(this)}// --- Portal System ---
97
+ /**
98
+ * Ensures that the necessary DOM element and React root are available for portal rendering.
99
+ * This is only executed on the client-side.
100
+ * @method _ensurePortalInfrastructure
101
+ */_ensurePortalInfrastructure(){if(BaseNode._isServer)return!1;if(this._portalDOMElement&&this._portalReactRoot&&this._portalDOMElement.isConnected)return!0;if(this._portalDOMElement&&!this._portalDOMElement.isConnected){if(this._portalReactRoot){try{this._portalReactRoot.unmount()}catch(a){/* empty */}this._portalReactRoot=null}this._portalDOMElement=null}if(this._portalDOMElement||(this._portalDOMElement=document.createElement("div"),document.body.appendChild(this._portalDOMElement)),!this._portalReactRoot){if(!this._portalDOMElement)return!1;var a=createRoot(this._portalDOMElement);this._portalReactRoot={render:a.render.bind(a),unmount:a.unmount.bind(a),update:function update(){}}}return!0}/**
102
+ * Renders the node into a React Portal, mounting it directly under `document.body`.
103
+ * Returns a handle with `update` and `unmount` methods to control the portal's lifecycle.
104
+ * @method toPortal
105
+ */toPortal(){var a=this;if(!this._ensurePortalInfrastructure()||!this._portalReactRoot)throw new Error("toPortal() can only be called in a client-side environment where document.body is available.");(function renderCurrent(){try{a._portalReactRoot.render(a.render())}catch(a){/* empty */}})();try{var b=this._portalReactRoot.unmount.bind(this._portalReactRoot),c=this._portalReactRoot;return c.update=function(b){try{if(!a._portalReactRoot)return;var c=isNodeInstance(b)?b.render():b;a._portalReactRoot.render(c)}catch(a){/* empty */}},c.unmount=function(){try{b()}catch(a){/* empty */}if(a._portalDOMElement){try{a._portalDOMElement.parentNode&&a._portalDOMElement.parentNode.removeChild(a._portalDOMElement)}catch(a){/* empty */}a._portalDOMElement=null}a._portalReactRoot=null},c}catch(a){return this._portalReactRoot}}/**
106
+ * A static method to clear all internal caches. This is primarily useful for testing
107
+ * to ensure that tests run in a clean, isolated state.
108
+ * @method clearCaches
109
+ */static clearCaches(){BaseNode._propProcessingCache.clear()}}// --- Factory Functions ---
110
+ /**
111
+ * The primary factory function for creating a `BaseNode` instance.
112
+ * It's the simplest way to wrap a component or element.
113
+ * @function Node
114
+ */_defineProperty(BaseNode,"_isServer","undefined"==typeof window),_defineProperty(BaseNode,"_propProcessingCache",new Map),_defineProperty(BaseNode,"_isValidElement",isValidElementType);export function Node(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=_objectSpread(_objectSpread({},b),c);return new BaseNode(a,d)}/**
56
115
  * Creates a curried node factory for a given React element or component type.
116
+ * This is useful for creating reusable, specialized factory functions (e.g., `const Div = createNode('div')`).
117
+ * @function createNode
57
118
  */export function createNode(a,b){var c=function Instance(c){return Node(a,_objectSpread(_objectSpread({},b),c))};return c.element=a,c}/**
58
119
  * Creates a node factory function where the first argument is `children` and the second is `props`.
120
+ * This provides a more ergonomic API for components that primarily wrap content (e.g., `P('Some text')`).
121
+ * @function createChildrenFirstNode
59
122
  */export function createChildrenFirstNode(a,b){var c=function Instance(c,d){return Node(a,_objectSpread(_objectSpread(_objectSpread({},b),d),{},{children:c}))};return c.element=a,c}
@@ -1,5 +1,5 @@
1
1
  import type { CSSInterpolation } from '@emotion/serialize';
2
- import type { NodeInstance } from '../node.type.js';
2
+ import { BaseNode } from '../core.node.js';
3
3
  /**
4
4
  * Type guard to check if an object is a NodeInstance.
5
5
  *
@@ -11,7 +11,7 @@ import type { NodeInstance } from '../node.type.js';
11
11
  * @param obj The object to check.
12
12
  * @returns True if the object is a NodeInstance, false otherwise.
13
13
  */
14
- export declare const isNodeInstance: (obj: unknown) => obj is NodeInstance<any>;
14
+ export declare const isNodeInstance: (obj: unknown) => obj is BaseNode<any>;
15
15
  /**
16
16
  * Resolves default CSS styles to fix common flexbox layout issues.
17
17
  *
@@ -1 +1 @@
1
- {"version":3,"file":"node.helper.d.ts","sourceRoot":"","sources":["../../src/helper/node.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAiB,MAAM,oBAAoB,CAAA;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,4CAS1B,CAAA;AA8DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,eAAO,MAAM,mBAAmB,iCAmE/B,CAAA"}
1
+ {"version":3,"file":"node.helper.d.ts","sourceRoot":"","sources":["../../src/helper/node.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAiB,MAAM,oBAAoB,CAAA;AAEzE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,wCAS1B,CAAA;AA8DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,eAAO,MAAM,mBAAmB,iCAmE/B,CAAA"}
@@ -1,18 +1,12 @@
1
1
  import type { Theme } from '../node.type.js';
2
2
  /**
3
- * Resolves theme variable references in an object's values recursively.
4
- * This function performs a "smart merge" to maintain object reference identity
5
- * for parts of the object that do not contain resolved theme variables or
6
- * other modifications. Only creates new objects or properties when a change occurs.
7
- * Handles nested objects and arrays, and prevents circular references.
8
- * Theme variables are referenced using the format "theme.path.to.value".
9
- * @param obj The object (or array) whose values should be resolved against the theme. Defaults to an empty object.
10
- * @param theme The theme object containing variable definitions. Optional.
11
- * @param options Options to control processing behavior.
12
- * - processFunctions: If true, functions within the object will be executed with the theme as an argument.
13
- * If false, functions will be ignored. Defaults to false.
14
- * @returns A new object (or array) with all theme variables resolved to their corresponding values,
15
- * or the original object (or array) if no changes were necessary.
3
+ * Resolves theme variable references in an object's values iteratively.
4
+ * This function uses a manual work stack to traverse the object, which prevents
5
+ * "Maximum call stack size exceeded" errors for deeply nested objects.
6
+ * It performs a "smart merge" by using a copy-on-write strategy, creating new
7
+ * objects/arrays only when a value inside them has changed. This preserves
8
+ * object references for unchanged parts of the tree, which is critical for
9
+ * React's reconciliation and memoization.
16
10
  */
17
11
  export declare const resolveObjWithTheme: (obj?: Record<string, any>, theme?: Theme | undefined, options?: {
18
12
  processFunctions?: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"theme.helper.d.ts","sourceRoot":"","sources":["../../src/helper/theme.helper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,mBAAmB,CAAA;AA8G3D;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB;;SAoI/B,CAAA"}
1
+ {"version":3,"file":"theme.helper.d.ts","sourceRoot":"","sources":["../../src/helper/theme.helper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,mBAAmB,CAAA;AAoE3D;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB;;SAoH/B,CAAA"}
@@ -1,43 +1,16 @@
1
1
  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 _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 _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)}import{getValueByPath}from"./common.helper.js";import{ObjHelper}from"./obj.helper.js";/**
2
2
  * Cache manager for theme resolution operations.
3
- * Provides singleton-based caching with different strategies for server vs client environments.
4
- */class ThemeResolverCache{constructor(){// Track cache statistics for performance monitoring
5
- _defineProperty(this,"_resolutionCache",new Map),_defineProperty(this,"_pathLookupCache",new Map),_defineProperty(this,"_themeRegex",/theme\.([a-zA-Z0-9_.-]+)/g),_defineProperty(this,"_stats",{hits:0,misses:0,pathHits:0,pathMisses:0})}// Private constructor for singleton pattern
6
- /**
7
- * Get the singleton instance of the cache manager
8
- */static getInstance(){return ThemeResolverCache._instance||(ThemeResolverCache._instance=new ThemeResolverCache),ThemeResolverCache._instance}/**
9
- * Generate a stable cache key from object and theme
10
- */_generateCacheKey(a,b){// Use a more efficient key generation for better performance
11
- return"".concat(ObjHelper.stringify(a),"_").concat(ObjHelper.stringify(b))}/**
12
- * Check if resolution result exists in cache
13
- */getResolution(a,b){var c=this._generateCacheKey(a,b);return this._resolutionCache.has(c)?(this._stats.hits++,this._resolutionCache.get(c)):(this._stats.misses++,null)}/**
14
- * Store resolution result in cache
15
- */setResolution(a,b,c){var d=this._generateCacheKey(a,b);this._resolutionCache.set(d,c)}/**
16
- * Get cached theme path lookup
17
- */getPathLookup(a,b){var c="".concat(ObjHelper.stringify(a),"_").concat(b);return this._pathLookupCache.has(c)?(this._stats.pathHits++,this._pathLookupCache.get(c)):(this._stats.pathMisses++,null)}/**
18
- * Cache theme path lookup result
19
- */setPathLookup(a,b,c){var d="".concat(ObjHelper.stringify(a),"_").concat(b);this._pathLookupCache.set(d,c)}/**
20
- * Get the shared regex instance (reused for performance)
21
- */getThemeRegex(){return this._themeRegex.lastIndex=0,this._themeRegex}/**
22
- * Check if we should use caching (server-side only for RSC optimization)
23
- */shouldCache(){return"undefined"==typeof window}}// Module-level cache instance
24
- _defineProperty(ThemeResolverCache,"_instance",null);var themeCache=ThemeResolverCache.getInstance();/**
25
- * Resolves theme variable references in an object's values recursively.
26
- * This function performs a "smart merge" to maintain object reference identity
27
- * for parts of the object that do not contain resolved theme variables or
28
- * other modifications. Only creates new objects or properties when a change occurs.
29
- * Handles nested objects and arrays, and prevents circular references.
30
- * Theme variables are referenced using the format "theme.path.to.value".
31
- * @param obj The object (or array) whose values should be resolved against the theme. Defaults to an empty object.
32
- * @param theme The theme object containing variable definitions. Optional.
33
- * @param options Options to control processing behavior.
34
- * - processFunctions: If true, functions within the object will be executed with the theme as an argument.
35
- * If false, functions will be ignored. Defaults to false.
36
- * @returns A new object (or array) with all theme variables resolved to their corresponding values,
37
- * or the original object (or array) if no changes were necessary.
38
- */export var resolveObjWithTheme=function resolveObjWithTheme(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},b=1<arguments.length?arguments[1]:void 0,c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},d=c.processFunctions;if(!b||!!b&&"object"===_typeof(b)&&0===Object.keys(b).length||0===Object.keys(a).length)return a;// Ensure theme has a valid system property
39
- var e=null===b||void 0===b?void 0:b.system;if(!e||"object"!==_typeof(e)||0===Object.keys(e).length)return a;// Check cache first (only on server-side for RSC optimization)
40
- if(themeCache.shouldCache()){// Note: Caching is based on the input object. If processFunctions changes behavior,
41
- // a more complex cache key may be needed in the future.
42
- var f=themeCache.getResolution(a,e);if(null!==f)return f}var g=function resolveRecursively(a,c){if(null===a||"object"!==_typeof(a))return a;if(c.has(a))return a;c.add(a);var f=function processThemeString(a){var b=a,c=!1,d=themeCache.getThemeRegex();return b=b.replace(d,function(a,b){var d=themeCache.getPathLookup(e,b);return null===d&&(d=getValueByPath(e,b),themeCache.setPathLookup(e,b,d)),void 0!==d&&null!==d?(c=!0,"object"===_typeof(d)&&!Array.isArray(d)&&"default"in d?d["default"]:d):a}),c?b:a};if(Array.isArray(a)){for(var h=a,j=!1,k=0;k<a.length;k++){var l=a[k],m=g(l,c);m===l?j&&(h[k]=l):(!j&&(h=[...a],j=!0),h[k]=m)}return h}var n=a,o=!1;for(var p in a){var q=a[p],r=q;if("function"!=typeof q)("object"!==_typeof(q)||null===q||Array.isArray(q)||Object.getPrototypeOf(q)===Object.prototype||null===Object.getPrototypeOf(q))&&("object"===_typeof(q)||"string"==typeof q)?"string"==typeof q&&q.includes("theme.")?r=f(q):"object"===_typeof(q)&&null!==q&&(r=g(q,c)):r=q;else if(void 0!==d&&d){var s=q(b);// Process string results that contain theme references
43
- r="string"==typeof s&&s.includes("theme.")?f(s):g(s,c)}else r=q;r===q?o&&(n[p]=q):(!o&&(n=_objectSpread({},a),o=!0),n[p]=r)}return n},h=g(a,new Set);return themeCache.shouldCache()&&themeCache.setResolution(a,e,h),h};
3
+ */class ThemeResolverCache{constructor(){_defineProperty(this,"_resolutionCache",new Map),_defineProperty(this,"_pathLookupCache",new Map),_defineProperty(this,"_themeRegex",/theme\.([a-zA-Z0-9_.-]+)/g)}static getInstance(){return ThemeResolverCache._instance||(ThemeResolverCache._instance=new ThemeResolverCache),ThemeResolverCache._instance}/**
4
+ * Generate a stable cache key from object and theme, including the theme mode.
5
+ */_generateCacheKey(a,b){// Including theme.mode is critical for cache correctness.
6
+ return"".concat(ObjHelper.stringify(a),"_").concat(b.mode,"_").concat(ObjHelper.stringify(b.system))}getResolution(a,b){var c=this._generateCacheKey(a,b);return this._resolutionCache.get(c)||null}setResolution(a,b,c){var d=this._generateCacheKey(a,b);this._resolutionCache.set(d,c)}getPathLookup(a,b){var c="".concat(ObjHelper.stringify(a),"_").concat(b);return this._pathLookupCache.get(c)||null}setPathLookup(a,b,c){var d="".concat(ObjHelper.stringify(a),"_").concat(b);this._pathLookupCache.set(d,c)}getThemeRegex(){return this._themeRegex.lastIndex=0,this._themeRegex}shouldCache(){return"undefined"==typeof window}}_defineProperty(ThemeResolverCache,"_instance",null);var themeCache=ThemeResolverCache.getInstance(),isPlainObject=function isPlainObject(a){if("object"!==_typeof(a)||null===a)return!1;var b=Object.getPrototypeOf(a);return null===b||b===Object.prototype};/**
7
+ * Resolves theme variable references in an object's values iteratively.
8
+ * This function uses a manual work stack to traverse the object, which prevents
9
+ * "Maximum call stack size exceeded" errors for deeply nested objects.
10
+ * It performs a "smart merge" by using a copy-on-write strategy, creating new
11
+ * objects/arrays only when a value inside them has changed. This preserves
12
+ * object references for unchanged parts of the tree, which is critical for
13
+ * React's reconciliation and memoization.
14
+ */export var resolveObjWithTheme=function resolveObjWithTheme(){var a,b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},c=1<arguments.length?arguments[1]:void 0,d=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},e=d.processFunctions;if(!c||!c.system||"object"!==_typeof(c.system)||0===Object.keys(c.system).length||0===Object.keys(b).length)return b;var f=c.system;if(themeCache.shouldCache()){var g=themeCache.getResolution(b,c);if(null!==g)return g}// Used for cycle detection within the current traversal path.
15
+ for(var h=[{value:b,isProcessed:!1}],j=new Map,k=new Set,l=function processThemeString(a){var b=themeCache.getThemeRegex(),c=!1,d=a.replace(b,function(a,b){var d=themeCache.getPathLookup(f,b);return null===d&&(d=getValueByPath(f,b),themeCache.setPathLookup(f,b,d)),void 0!==d&&null!==d?(c=!0,"object"===_typeof(d)&&!Array.isArray(d)&&"default"in d?d["default"]:d):a});return c?d:a};0<h.length;){var m=h[h.length-1],n=m.value;if(!isPlainObject(n)&&!Array.isArray(n)){h.pop();continue}if(j.has(n)){h.pop();continue}if(!m.isProcessed){m.isProcessed=!0,k.add(n);for(var o,p=Array.isArray(n)?n:Object.values(n),q=p.length-1;0<=q;q--)o=p[q],(isPlainObject(o)||Array.isArray(o))&&!k.has(o)&&h.push({value:o,isProcessed:!1})}else{h.pop(),k["delete"](n);// Unwind the path
16
+ var r=n;if(Array.isArray(n)){for(var s=null,t=0;t<n.length;t++){var u,v=n[t],w=null!==(u=j.get(v))&&void 0!==u?u:v;w!==v&&(null===s&&(s=[...n]),s[t]=w)}null!==s&&(r=s)}else{var x=null;for(var y in n)if(Object.prototype.hasOwnProperty.call(n,y)){var z,A=n[y],B=null!==(z=j.get(A))&&void 0!==z?z:A;if("function"==typeof B&&void 0!==e&&e){var C=B(c);B="string"==typeof C&&C.includes("theme.")?l(C):C}else"string"==typeof B&&B.includes("theme.")&&(B=l(B));B!==A&&(null===x&&(x=_objectSpread({},n)),x[y]=B)}null!==x&&(r=x)}j.set(n,r)}}var D=null!==(a=j.get(b))&&void 0!==a?a:b;return themeCache.shouldCache()&&themeCache.setResolution(b,c,D),D};
@@ -1,5 +1,9 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { NodePortal, PortalProps } from '../node.type.js';
3
+ /**
4
+ * Hook for managing a portal that renders node components outside the React component tree.
5
+ * @deprecated This hook is unstable and will likely be removed in future versions
6
+ */
3
7
  export declare function usePortal<T extends any[]>(deps?: T): {
4
8
  portal: NodePortal | undefined;
5
9
  setPortal: (p: NodePortal) => NodePortal;
@@ -1 +1 @@
1
- {"version":3,"file":"usePortal.d.ts","sourceRoot":"","sources":["../../src/hook/usePortal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAkC,MAAM,OAAO,CAAA;AACzE,OAAO,KAAK,EAAmB,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAGjF,wBAAgB,SAAS,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,IAAI,GAAE,CAAsB;;;sBAGhC,CAAC;EAgCvC"}
1
+ {"version":3,"file":"usePortal.d.ts","sourceRoot":"","sources":["../../src/hook/usePortal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAkC,MAAM,OAAO,CAAA;AACzE,OAAO,KAAK,EAAmB,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAGjF;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,IAAI,GAAE,CAAsB;;;sBAGhC,CAAC;EAgCvC"}
@@ -1 +1,4 @@
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{useCallback,useEffect,useRef}from"react";import{Node}from"../core.node.js";export function usePortal(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],b=useRef({}),c=useCallback(function(a){return b.current.component=a,new Proxy(a,{apply:function apply(a,c,d){var e=_slicedToArray(d,1),f=e[0];return b.current.props=f,a.call(c,f)}})},[]);return useEffect(function(){var a=b.current,c=a.portal,d=a.component,e=a.props;c&&d&&c.update(Node(d,e))},a),useEffect(function(){return function(){var a;null===(a=b.current.portal)||void 0===a||a.unmount(),b.current.portal=void 0,b.current.component=void 0,b.current.props=void 0}},[]),{portal:b.current.portal,setPortal:function setPortal(a){return b.current.portal=a},createComponent:c}}
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{useCallback,useEffect,useRef}from"react";import{Node}from"../core.node.js";/**
2
+ * Hook for managing a portal that renders node components outside the React component tree.
3
+ * @deprecated This hook is unstable and will likely be removed in future versions
4
+ */export function usePortal(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],b=useRef({}),c=useCallback(function(a){return b.current.component=a,new Proxy(a,{apply:function apply(a,c,d){var e=_slicedToArray(d,1),f=e[0];return b.current.props=f,a.call(c,f)}})},[]);return useEffect(function(){var a=b.current,c=a.portal,d=a.component,e=a.props;c&&d&&c.update(Node(d,e))},a),useEffect(function(){return function(){var a;null===(a=b.current.portal)||void 0===a||a.unmount(),b.current.portal=void 0,b.current.component=void 0,b.current.props=void 0}},[]),{portal:b.current.portal,setPortal:function setPortal(a){return b.current.portal=a},createComponent:c}}
@@ -2,7 +2,7 @@
2
2
  * A hook that provides access to the theme context.
3
3
  * It also handles side effects like updating localStorage and applying the theme to the document root.
4
4
  * @returns {ThemeContextValue} The theme context value.
5
- * @throws {Error} If used outside of a ThemeProvider.
5
+ * @throws {Error} If used outside a ThemeProvider.
6
6
  */
7
7
  export declare const useTheme: () => import("../components/theme-provider.client.js").ThemeContextValue;
8
8
  //# sourceMappingURL=useTheme.d.ts.map
@@ -2,7 +2,7 @@
2
2
  * A hook that provides access to the theme context.
3
3
  * It also handles side effects like updating localStorage and applying the theme to the document root.
4
4
  * @returns {ThemeContextValue} The theme context value.
5
- * @throws {Error} If used outside of a ThemeProvider.
5
+ * @throws {Error} If used outside a ThemeProvider.
6
6
  */export var useTheme=function useTheme(){var a=useContext(ThemeContext);if(!a)throw new Error("useTheme must be used within a ThemeProvider");var b=a.theme;return useEffect(function(){// Sync theme mode with localStorage
7
7
  var a=localStorage.getItem("theme");a&&a===b.mode||localStorage.setItem("theme",b.mode);// Apply theme to document root
8
8
  var c=document.documentElement;"dark"===b.mode?(c.setAttribute("data-theme","dark"),c.classList.add("dark-theme"),c.classList.remove("light-theme")):(c.setAttribute("data-theme","light"),c.classList.add("light-theme"),c.classList.remove("dark-theme"))},[b.mode,b.system]),a};
@@ -195,7 +195,7 @@ export interface BasePortalProps {
195
195
  * Extends the component's own props with portal-specific functionality.
196
196
  * @template T The component's own prop types
197
197
  */
198
- export type PortalProps<T extends BasePortalProps | Record<string, any>> = T & BasePortalProps;
198
+ export type PortalProps<T extends BasePortalProps | Record<string, any> = Record<string, any>> = T & BasePortalProps;
199
199
  /**
200
200
  * Interface representing a portal instance with lifecycle methods.
201
201
  * Provides methods to unmount the portal and update its content dynamically.
@@ -1 +1 @@
1
- {"version":3,"file":"node.type.d.ts","sourceRoot":"","sources":["../src/node.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,GAAG,EACR,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAIrE,KAAK,YAAY,CAAC,CAAC,IAAI;KACpB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC;CACxD,CAAC,MAAM,CAAC,CAAC,CAAA;AAGV,MAAM,MAAM,gBAA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AG,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,eAAe,EAAE,MAAM,eAAe,CAAC,GACvJ,eAAe,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meonode/ui",
3
3
  "description": "A structured approach to component composition, direct CSS-first prop styling, built-in theming, smart prop handling (including raw property pass-through), and dynamic children.",
4
- "version": "0.3.16",
4
+ "version": "0.3.17",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "types": "./dist/main.d.ts",
@@ -28,9 +28,9 @@
28
28
  "scripts": {
29
29
  "watch:build": "yarn dlx nodemon --watch src --ext ts,tsx,js,json --exec \"yarn build\"",
30
30
  "lint": "eslint --fix",
31
- "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --ci",
31
+ "test": "node --stack-size=10000 --experimental-vm-modules node_modules/jest/bin/jest.js --ci",
32
32
  "prebuild": "yarn lint && yarn test",
33
- "build": "yarn prebuild && rm -rf ./dist && babel src --out-dir dist --extensions \".ts,.tsx,.js\" && tsgo --project tsconfig.build.json --diagnostics && tsc-alias",
33
+ "build": "yarn prebuild && rm -rf ./dist && babel src --out-dir dist --extensions \".ts,.tsx,.js\" && tsgo -p tsconfig.build.json --diagnostics && tsc-alias -p tsconfig.build.json",
34
34
  "publish:pre": "./prepublish.sh && yarn build && yarn version -i prerelease && yarn npm publish --tag next",
35
35
  "publish:patch": "./prepublish.sh && yarn build && yarn version -i patch && yarn npm publish --tag latest",
36
36
  "publish:minor": "./prepublish.sh && yarn build && yarn version -i minor && yarn npm publish --tag latest",