@meonode/ui 0.2.13 → 0.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +103 -39
- package/README.md +51 -1468
- package/dist/components/html.node.d.ts +22 -3
- package/dist/components/html.node.d.ts.map +1 -1
- package/dist/components/html.node.js +18 -3
- package/dist/components/styled-renderer.client.js +1 -1
- package/dist/core.node.d.ts +66 -12
- package/dist/core.node.d.ts.map +1 -1
- package/dist/core.node.js +78 -25
- package/dist/helper/common.helper.d.ts +0 -2
- package/dist/helper/common.helper.d.ts.map +1 -1
- package/dist/helper/common.helper.js +1 -2
- package/dist/helper/node.helper.d.ts +6 -17
- package/dist/helper/node.helper.d.ts.map +1 -1
- package/dist/helper/node.helper.js +18 -18
- package/dist/helper/obj.helper.d.ts +11 -0
- package/dist/helper/obj.helper.d.ts.map +1 -1
- package/dist/helper/obj.helper.js +19 -1
- package/dist/hoc/component.hoc.d.ts.map +1 -1
- package/dist/hoc/component.hoc.js +2 -2
- package/dist/node.type.d.ts +14 -11
- package/dist/node.type.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -7,16 +7,33 @@
|
|
|
7
7
|
export declare const Div: (<AdditionalProps extends Record<string, any> = Record<string, any>>(props?: import("../node.type").MergedProps<"div", AdditionalProps> | undefined) => import("../node.type").NodeInstance<"div">) & {
|
|
8
8
|
element: "div";
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Alias for \`Div(...)\`. Recommended for general-purpose container elements.
|
|
12
|
+
*
|
|
13
|
+
* **Example:**
|
|
14
|
+
* ```typescript
|
|
15
|
+
* Container({
|
|
16
|
+
* padding: 'theme.spacing.md',
|
|
17
|
+
* backgroundColor: 'lightgray',
|
|
18
|
+
* children: [H2('Welcome'), P('This is a container example.')]
|
|
19
|
+
* })
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const Container: (<AdditionalProps extends Record<string, any> = Record<string, any>>(props?: import("../node.type").MergedProps<"div", AdditionalProps> | undefined) => import("../node.type").NodeInstance<"div">) & {
|
|
23
|
+
element: "div";
|
|
24
|
+
};
|
|
10
25
|
/**
|
|
11
26
|
* Represents a root div element with full viewport dimensions and column flex layout.
|
|
12
27
|
* By default, applies flex column layout and 100% viewport dimensions.
|
|
13
28
|
* @param props Optional properties for the root div element that merge with defaults.
|
|
14
29
|
* @returns A div element node configured as root container.
|
|
15
30
|
* @example
|
|
31
|
+
* ```typescript
|
|
16
32
|
* Root({
|
|
17
|
-
*
|
|
18
|
-
*
|
|
33
|
+
* backgroundColor: 'white',
|
|
34
|
+
* children: [Header(), Main(), Footer()]
|
|
19
35
|
* })
|
|
36
|
+
* ```
|
|
20
37
|
*/
|
|
21
38
|
export declare const Root: (<AdditionalProps extends Record<string, any> = Record<string, any>>(props?: import("../node.type").MergedProps<"div", AdditionalProps> | undefined) => import("../node.type").NodeInstance<"div">) & {
|
|
22
39
|
element: "div";
|
|
@@ -207,7 +224,9 @@ export declare const P: (<AdditionalProps extends Record<string, any> = Record<s
|
|
|
207
224
|
* Renders a semantic block of text using a `<p>` element.
|
|
208
225
|
* Alias for `P(...)`, recommended for general-purpose text content.
|
|
209
226
|
* @example
|
|
210
|
-
*
|
|
227
|
+
* ```typescript
|
|
228
|
+
* Text('This is a sample text paragraph.', { fontSize: 'theme.text.base', color: 'theme.text.primary' })
|
|
229
|
+
* ```
|
|
211
230
|
*/
|
|
212
231
|
export declare const Text: (<AdditionalProps extends Record<string, any> = Record<string, any>>(children?: import("../node.type").NodeElement[] | import("../node.type").NodeElement, props?: Omit<import("../node.type").MergedProps<"p", AdditionalProps>, "children"> | undefined) => import("../node.type").NodeInstance<"p">) & {
|
|
213
232
|
element: "p";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.node.d.ts","sourceRoot":"","sources":["../../src/components/html.node.ts"],"names":[],"mappings":"AAGA,oBAAoB;AAEpB;;;;GAIG;AACH,eAAO,MAAM,GAAG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,MAAM,UAAU;;CAAoB,CAAA;AAE3C;;;;GAIG;AACH,eAAO,MAAM,IAAI;;CAAqB,CAAA;AAEtC,oCAAoC;AAEpC;;;;GAIG;AACH,eAAO,MAAM,QAAQ;;CAAyB,CAAA;AAE9C;;;;GAIG;AACH,eAAO,MAAM,MAAM;;CAAuB,CAAA;AAE1C;;;;GAIG;AACH,eAAO,MAAM,QAAQ;;CAAyB,CAAA;AAE9C;;;;GAIG;AACH,eAAO,MAAM,KAAK;;CAAsB,CAAA;AAExC,mDAAmD;AAEnD;;;;GAIG;AACH,eAAO,MAAM,QAAQ;;CAAyB,CAAA;AAE9C;;;;GAIG;AACH,eAAO,MAAM,QAAQ;;CAAyB,CAAA;AAE9C,uCAAuC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,MAAM;;CAAuB,CAAA"}
|
|
@@ -4,15 +4,28 @@
|
|
|
4
4
|
* @param props Optional properties for the div element.
|
|
5
5
|
* @returns A div element node.
|
|
6
6
|
*/export var Div=createNode("div");/**
|
|
7
|
+
* Alias for \`Div(...)\`. Recommended for general-purpose container elements.
|
|
8
|
+
*
|
|
9
|
+
* **Example:**
|
|
10
|
+
* ```typescript
|
|
11
|
+
* Container({
|
|
12
|
+
* padding: 'theme.spacing.md',
|
|
13
|
+
* backgroundColor: 'lightgray',
|
|
14
|
+
* children: [H2('Welcome'), P('This is a container example.')]
|
|
15
|
+
* })
|
|
16
|
+
* ```
|
|
17
|
+
*/export var Container=Div;/**
|
|
7
18
|
* Represents a root div element with full viewport dimensions and column flex layout.
|
|
8
19
|
* By default, applies flex column layout and 100% viewport dimensions.
|
|
9
20
|
* @param props Optional properties for the root div element that merge with defaults.
|
|
10
21
|
* @returns A div element node configured as root container.
|
|
11
22
|
* @example
|
|
23
|
+
* ```typescript
|
|
12
24
|
* Root({
|
|
13
|
-
*
|
|
14
|
-
*
|
|
25
|
+
* backgroundColor: 'white',
|
|
26
|
+
* children: [Header(), Main(), Footer()]
|
|
15
27
|
* })
|
|
28
|
+
* ```
|
|
16
29
|
*/export var Root=createNode("div",{display:"flex",flexDirection:"column",minHeight:"100vh",minWidth:"100vw"});/**
|
|
17
30
|
* Represents a column layout using flexbox.
|
|
18
31
|
* @param props Optional properties for the column layout.
|
|
@@ -115,7 +128,9 @@
|
|
|
115
128
|
* Renders a semantic block of text using a `<p>` element.
|
|
116
129
|
* Alias for `P(...)`, recommended for general-purpose text content.
|
|
117
130
|
* @example
|
|
118
|
-
*
|
|
131
|
+
* ```typescript
|
|
132
|
+
* Text('This is a sample text paragraph.', { fontSize: 'theme.text.base', color: 'theme.text.primary' })
|
|
133
|
+
* ```
|
|
119
134
|
*/export var Text=P;/**
|
|
120
135
|
* Creates a preformatted text element node.
|
|
121
136
|
* @param children The content to be rendered within the element (text, numbers, components, etc) for the pre element.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";var _excluded=["element","css","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{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)}
|
|
1
|
+
"use client";var _excluded=["element","css","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{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";
|
package/dist/core.node.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ElementType, type
|
|
2
|
-
import type {
|
|
1
|
+
import React, { type ElementType, type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import type { FinalNodeProps, HasRequiredProps, MergedProps, NodeElement, NodeInstance, NodeProps, PropsOf, RawNodeProps, Theme } from './node.type.js';
|
|
3
3
|
import { type Root as ReactDOMRoot } from 'react-dom/client';
|
|
4
4
|
/**
|
|
5
5
|
* Represents a node in a React component tree with theme and styling capabilities.
|
|
@@ -27,6 +27,18 @@ export declare class BaseNode<E extends NodeElement> implements NodeInstance<E>
|
|
|
27
27
|
private _childrenHash?;
|
|
28
28
|
/** Cache for normalized children */
|
|
29
29
|
private _normalizedChildren?;
|
|
30
|
+
/**
|
|
31
|
+
* WeakMap cache for processed children, keyed by object/array identity for GC friendliness.
|
|
32
|
+
* Each entry stores the hash, processed children, and a server-side flag.
|
|
33
|
+
*/
|
|
34
|
+
private static _processedChildrenWeakCache;
|
|
35
|
+
/**
|
|
36
|
+
* Map cache for processed children, keyed by a stable string signature.
|
|
37
|
+
* Used for non-object cases or as a fallback. Each entry stores the processed children and a server-side flag.
|
|
38
|
+
*/
|
|
39
|
+
private static _processedChildrenMapCache;
|
|
40
|
+
/** Maximum number of entries in the Map cache to prevent unbounded growth */
|
|
41
|
+
private static readonly _MAX_PROCESSED_CHILDREN_CACHE = 1000;
|
|
30
42
|
/**
|
|
31
43
|
* Constructs a new BaseNode instance.
|
|
32
44
|
*
|
|
@@ -60,16 +72,58 @@ export declare class BaseNode<E extends NodeElement> implements NodeInstance<E>
|
|
|
60
72
|
*/
|
|
61
73
|
private _processProps;
|
|
62
74
|
/**
|
|
63
|
-
*
|
|
64
|
-
* and
|
|
75
|
+
* Deeply clones processed children before returning them from cache so that each parent receives
|
|
76
|
+
* independent `BaseNode` instances (prevents sharing cycles and mutation bugs).
|
|
77
|
+
*
|
|
78
|
+
* - If the input is an array, each child is cloned recursively.
|
|
79
|
+
* - If the input is a `BaseNode`, a new instance is created with the same element and copied rawProps.
|
|
80
|
+
* - For other objects/primitives, the value is returned as-is (they are immutable or safe to reuse).
|
|
81
|
+
*
|
|
82
|
+
* This ensures that cached children are never shared between different parents in the React tree.
|
|
83
|
+
* @param processed The processed child or array of children to clone.
|
|
84
|
+
* @returns A deep clone of the processed children, safe for use in multiple parents.
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
private static _cloneProcessedChildren;
|
|
88
|
+
/**
|
|
89
|
+
* Retrieves cached processed children for a given set of `children` and an optional `theme`.
|
|
90
|
+
*
|
|
91
|
+
* - Skips caching entirely when executed on the server (returns `null`).
|
|
92
|
+
* - Uses a **WeakMap** for identity-based caching when `children` is an object or array,
|
|
93
|
+
* ensuring garbage collection safety.
|
|
94
|
+
* - Falls back to a **Map** keyed by a stable hash of `children` and `theme`
|
|
95
|
+
* for value-based caching.
|
|
96
|
+
* - Only returns cached entries that are **not server-side**.
|
|
97
|
+
* @param children The child node(s) to resolve cached results for.
|
|
98
|
+
* @param theme The theme context that may influence child processing.
|
|
99
|
+
* @returns A cloned version of the cached processed children if available, otherwise `null`.
|
|
100
|
+
* @private
|
|
101
|
+
*/
|
|
102
|
+
private _getCachedChildren;
|
|
103
|
+
/**
|
|
104
|
+
* Caches processed children for a given set of children and theme.
|
|
105
|
+
* This method stores the processed NodeElement(s) in a Map keyed by a stable hash.
|
|
106
|
+
* The cache is bounded to avoid unbounded memory growth.
|
|
107
|
+
* No caching is performed on the server to avoid RSC issues.
|
|
108
|
+
* @param children The original children to cache.
|
|
109
|
+
* @param theme The theme associated with the children.
|
|
110
|
+
* @param processed The processed NodeElement(s) to cache.
|
|
111
|
+
* @private
|
|
112
|
+
*/
|
|
113
|
+
private _setCachedChildren;
|
|
114
|
+
/**
|
|
115
|
+
* Recursively processes raw children, converting them into `BaseNode` instances as needed
|
|
116
|
+
* and propagating the provided theme.
|
|
117
|
+
*
|
|
118
|
+
* This method ensures consistent theme handling for all children and optimizes performance
|
|
119
|
+
* using caching strategies: a Map for client-side and no caching for server-side.
|
|
65
120
|
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* and client-side (WeakMap-based key) environments.
|
|
121
|
+
* - If `children` is an array, each child is processed individually.
|
|
122
|
+
* - If `children` is a single node, it is processed directly.
|
|
123
|
+
* - The processed result is cached on the client to avoid redundant work.
|
|
70
124
|
* @param children The raw child or array of children to process.
|
|
71
125
|
* @param theme The theme to propagate to the children.
|
|
72
|
-
* @returns The processed children, ready
|
|
126
|
+
* @returns The processed children, ready for normalization and rendering.
|
|
73
127
|
* @private
|
|
74
128
|
*/
|
|
75
129
|
private _processChildren;
|
|
@@ -91,7 +145,7 @@ export declare class BaseNode<E extends NodeElement> implements NodeInstance<E>
|
|
|
91
145
|
* @private
|
|
92
146
|
* @static
|
|
93
147
|
*/
|
|
94
|
-
static _renderProcessedNode(processedElement: NodeElement, passedTheme: Theme | undefined, passedKey: string | undefined): ReactNode;
|
|
148
|
+
static _renderProcessedNode(processedElement: NodeElement, passedTheme: Theme | undefined, passedKey: string | undefined): 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;
|
|
95
149
|
/**
|
|
96
150
|
* Renders the output of a function-as-a-child, ensuring theme propagation.
|
|
97
151
|
*
|
|
@@ -171,7 +225,7 @@ export declare class BaseNode<E extends NodeElement> implements NodeInstance<E>
|
|
|
171
225
|
* @returns The rendered `ReactElement`.
|
|
172
226
|
* @throws {Error} If the node's `element` is not a valid React element type.
|
|
173
227
|
*/
|
|
174
|
-
render(): ReactElement
|
|
228
|
+
render(): ReactElement<FinalNodeProps>;
|
|
175
229
|
/**
|
|
176
230
|
* Ensures the necessary DOM elements for portal rendering are created and attached.
|
|
177
231
|
*
|
|
@@ -210,7 +264,7 @@ export declare function Node<AdditionalProps extends Record<string, any>, E exte
|
|
|
210
264
|
/**
|
|
211
265
|
* Creates a curried node factory for a given React element or component type.
|
|
212
266
|
*
|
|
213
|
-
* Returns a function that, when called with props, produces a `
|
|
267
|
+
* Returns a function that, when called with props, produces a `NodeInstance<E>`.
|
|
214
268
|
* Useful for creating reusable node factories for specific components or element types.
|
|
215
269
|
* @template AdditionalInitialProps Additional initial props to merge with node props.
|
|
216
270
|
* @template E The React element or component type.
|
package/dist/core.node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../src/core.node.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../src/core.node.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE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ACtC,CAAC,CAAC,eAAe,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACjE,QAAQ,CAAC,EAAE,WAAW,GAAG,WAAW,EAAE,EACtC,KAAK,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,UAAU,CAAC,KACtD,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,CAQzC"}
|
package/dist/core.node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _excluded=["ref","key","children","nodetheme","theme","props"],_excluded2=["style"],_excluded3=["style","css"],_excluded4=["style"],_excluded5=["children","key","nativeProps"];function
|
|
1
|
+
"use strict";var _excluded=["ref","key","children","nodetheme","theme","props"],_excluded2=["style"],_excluded3=["style","css"],_excluded4=["style"],_excluded5=["children","key","nativeProps"];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 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 React,{createElement,Fragment,isValidElement}from"react";import{createStableHash,isNodeInstance,resolveDefaultStyle}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}from"./helper/common.helper.js";import StyledRenderer from"./components/styled-renderer.client.js";import{resolveObjWithTheme}from"./helper/theme.helper.js";/**
|
|
2
2
|
* Represents a node in a React component tree with theme and styling capabilities.
|
|
3
3
|
* This class wraps React elements and handles:
|
|
4
4
|
* - Props processing and normalization
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - Child node processing and management
|
|
7
7
|
* - Style processing with theme variables
|
|
8
8
|
* @template E The type of React element or component this node represents
|
|
9
|
-
*/export class BaseNode{/**
|
|
9
|
+
*/export class BaseNode{/**
|
|
10
10
|
* Constructs a new BaseNode instance.
|
|
11
11
|
*
|
|
12
12
|
* This constructor initializes a node with a given React element or component type
|
|
@@ -40,9 +40,11 @@
|
|
|
40
40
|
* @returns A renderable `ReactNode`.
|
|
41
41
|
* @throws {Error} If the child is not a valid React element type.
|
|
42
42
|
* @private
|
|
43
|
-
*/_defineProperty(this,"rawProps",{}),_defineProperty(this,"isBaseNode",!0),_defineProperty(this,"_portalDOMElement",null),_defineProperty(this,"_portalReactRoot",null),_defineProperty(this,"_generateKey",function(a){var b=a.nodeIndex,c=a.element,d=a.existingKey,e=a.children;if(d)return d;var f,g=getElementTypeName(c);return f=Array.isArray(e)&&0<e.length?void 0===b?"".concat(g,"-").concat(e.length):"".concat(g,"-").concat(b,"-").concat(e.length):void 0===b?g:"".concat(g,"-").concat(b),f}),_defineProperty(this,"_normalizeChild",function(a){var c,d
|
|
44
|
-
if(
|
|
45
|
-
|
|
43
|
+
*/_defineProperty(this,"rawProps",{}),_defineProperty(this,"isBaseNode",!0),_defineProperty(this,"_portalDOMElement",null),_defineProperty(this,"_portalReactRoot",null),_defineProperty(this,"_generateKey",function(a){var b=a.nodeIndex,c=a.element,d=a.existingKey,e=a.children;if(d)return d;var f,g=getElementTypeName(c);return f=Array.isArray(e)&&0<e.length?void 0===b?"".concat(g,"-").concat(e.length):"".concat(g,"-").concat(b,"-").concat(e.length):void 0===b?g:"".concat(g,"-").concat(b),f}),_defineProperty(this,"_normalizeChild",function(a){var c,d;// Handle null/undefined quickly
|
|
44
|
+
if(null===a||a===void 0)return a;// Primitives should be returned as-is (text nodes, numbers, booleans)
|
|
45
|
+
var e=_typeof(a);if("string"===e||"number"===e||"boolean"===e)return a;var f=(null===(c=b.rawProps)||void 0===c?void 0:c.nodetheme)||(null===(d=b.rawProps)||void 0===d?void 0:d.theme)||b.props.nodetheme||b.props.theme;// For BaseNode instances, apply current theme if child has no theme
|
|
46
|
+
if(a instanceof BaseNode){var g;return null!==(g=a.rawProps)&&void 0!==g&&g.nodetheme||void 0===f?a.render():new BaseNode(a.element,_objectSpread(_objectSpread({},a.rawProps),{},{nodetheme:f})).render()}// Validate element type before returning
|
|
47
|
+
if(!isValidElementType(a)){var h=getComponentType(a);throw new Error("Invalid element type: ".concat(h," provided!"))}// Return valid React elements as-is
|
|
46
48
|
return a}),this.element=a,this.rawProps=c}/**
|
|
47
49
|
* Lazily processes and retrieves the final, normalized props for the node.
|
|
48
50
|
*
|
|
@@ -65,19 +67,63 @@ return a}),this.element=a,this.rawProps=c}/**
|
|
|
65
67
|
var a=this.rawProps,b=a.ref,c=a.key,d=a.children,e=a.nodetheme,f=a.theme,g=a.props,h=void 0===g?{}:g,i=_objectWithoutProperties(a,_excluded),j=f||e,k=h,l=k.style,m=_objectWithoutProperties(k,_excluded2),n=resolveObjWithTheme(i,j),o=resolveObjWithTheme(l,j),p=n.style,q=n.css,r=_objectWithoutProperties(n,_excluded3),s=getCSSProps(r),t=getDOMProps(r),u=resolveDefaultStyle(_objectSpread(_objectSpread({},s),p)),v=this._processChildren(d,j);// Process children while maintaining theme inheritance
|
|
66
68
|
// Combine processed props into final normalized form
|
|
67
69
|
return _objectSpread(_objectSpread({ref:b,key:c,nodetheme:j,theme:f,css:_objectSpread(_objectSpread({},u),q),style:o},t),{},{nativeProps:m,children:v})}/**
|
|
68
|
-
*
|
|
69
|
-
* and
|
|
70
|
+
* Deeply clones processed children before returning them from cache so that each parent receives
|
|
71
|
+
* independent `BaseNode` instances (prevents sharing cycles and mutation bugs).
|
|
70
72
|
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
73
|
+
* - If the input is an array, each child is cloned recursively.
|
|
74
|
+
* - If the input is a `BaseNode`, a new instance is created with the same element and copied rawProps.
|
|
75
|
+
* - For other objects/primitives, the value is returned as-is (they are immutable or safe to reuse).
|
|
76
|
+
*
|
|
77
|
+
* This ensures that cached children are never shared between different parents in the React tree.
|
|
78
|
+
* @param processed The processed child or array of children to clone.
|
|
79
|
+
* @returns A deep clone of the processed children, safe for use in multiple parents.
|
|
80
|
+
* @private
|
|
81
|
+
*/static _cloneProcessedChildren(a){var b=function cloneOne(a){return a instanceof BaseNode?new BaseNode(a.element,_objectSpread({},a.rawProps)):a;// NodeInstance returns its own instances when render() is called - we avoid calling render here.
|
|
82
|
+
// For other objects/primitives, return as-is (they are immutable or safe to reuse).
|
|
83
|
+
};return Array.isArray(a)?a.map(function(a){return b(a)}):b(a)}/**
|
|
84
|
+
* Retrieves cached processed children for a given set of `children` and an optional `theme`.
|
|
85
|
+
*
|
|
86
|
+
* - Skips caching entirely when executed on the server (returns `null`).
|
|
87
|
+
* - Uses a **WeakMap** for identity-based caching when `children` is an object or array,
|
|
88
|
+
* ensuring garbage collection safety.
|
|
89
|
+
* - Falls back to a **Map** keyed by a stable hash of `children` and `theme`
|
|
90
|
+
* for value-based caching.
|
|
91
|
+
* - Only returns cached entries that are **not server-side**.
|
|
92
|
+
* @param children The child node(s) to resolve cached results for.
|
|
93
|
+
* @param theme The theme context that may influence child processing.
|
|
94
|
+
* @returns A cloned version of the cached processed children if available, otherwise `null`.
|
|
95
|
+
* @private
|
|
96
|
+
*/_getCachedChildren(a,b){if("undefined"==typeof window)return null;// No server caching
|
|
97
|
+
// Compute hash once
|
|
98
|
+
var c=createStableHash(a,b);// If children is an object (array or object), try identity-keyed WeakMap first
|
|
99
|
+
if(a&&"object"===_typeof(a)){var d=BaseNode._processedChildrenWeakCache.get(a);if(d&&d.hash===c&&!d.isServerSide)return BaseNode._cloneProcessedChildren(d.children)}// Fallback to string-hash Map cache
|
|
100
|
+
var e=BaseNode._processedChildrenMapCache.get(c);return e&&!e.isServerSide?BaseNode._cloneProcessedChildren(e.children):null}/**
|
|
101
|
+
* Caches processed children for a given set of children and theme.
|
|
102
|
+
* This method stores the processed NodeElement(s) in a Map keyed by a stable hash.
|
|
103
|
+
* The cache is bounded to avoid unbounded memory growth.
|
|
104
|
+
* No caching is performed on the server to avoid RSC issues.
|
|
105
|
+
* @param children The original children to cache.
|
|
106
|
+
* @param theme The theme associated with the children.
|
|
107
|
+
* @param processed The processed NodeElement(s) to cache.
|
|
108
|
+
* @private
|
|
109
|
+
*/_setCachedChildren(a,b,c){if("undefined"!=typeof window){var d=createStableHash(a,b);if(a&&"object"===_typeof(a))return void BaseNode._processedChildrenWeakCache.set(a,{hash:d,children:c,isServerSide:!1});// Manage bounded Map cache (FIFO eviction)
|
|
110
|
+
if(BaseNode._processedChildrenMapCache.has(d))return void BaseNode._processedChildrenMapCache.set(d,{children:c,isServerSide:!1});if(BaseNode._processedChildrenMapCache.size>=BaseNode._MAX_PROCESSED_CHILDREN_CACHE){var e=BaseNode._processedChildrenMapCache.keys().next().value;void 0!==e&&BaseNode._processedChildrenMapCache["delete"](e)}BaseNode._processedChildrenMapCache.set(d,{children:c,isServerSide:!1})}}/**
|
|
111
|
+
* Recursively processes raw children, converting them into `BaseNode` instances as needed
|
|
112
|
+
* and propagating the provided theme.
|
|
113
|
+
*
|
|
114
|
+
* This method ensures consistent theme handling for all children and optimizes performance
|
|
115
|
+
* using caching strategies: a Map for client-side and no caching for server-side.
|
|
116
|
+
*
|
|
117
|
+
* - If `children` is an array, each child is processed individually.
|
|
118
|
+
* - If `children` is a single node, it is processed directly.
|
|
119
|
+
* - The processed result is cached on the client to avoid redundant work.
|
|
75
120
|
* @param children The raw child or array of children to process.
|
|
76
121
|
* @param theme The theme to propagate to the children.
|
|
77
|
-
* @returns The processed children, ready
|
|
122
|
+
* @returns The processed children, ready for normalization and rendering.
|
|
78
123
|
* @private
|
|
79
|
-
*/_processChildren(a,b){var c=this;
|
|
80
|
-
}
|
|
124
|
+
*/_processChildren(a,b){var c=this;if(a){// Use RSC-safe caching strategy
|
|
125
|
+
var d=this._getCachedChildren(a,b);if(d)return d;var e=Array.isArray(a)?a.map(function(a,d){return c._processRawNode(a,b,d)}):this._processRawNode(a,b);// Only cache on client-side
|
|
126
|
+
return"undefined"!=typeof window&&this._setCachedChildren(a,b,e),e}}/**
|
|
81
127
|
* Renders a processed `NodeElement` into a `ReactNode`, applying a theme and key if necessary.
|
|
82
128
|
*
|
|
83
129
|
* This static method centralizes the logic for converting various types of processed elements
|
|
@@ -95,8 +141,7 @@ return _objectSpread(_objectSpread({ref:b,key:c,nodetheme:j,theme:f,css:_objectS
|
|
|
95
141
|
* @private
|
|
96
142
|
* @static
|
|
97
143
|
*/static _renderProcessedNode(a,b,c){var d={};// 1. BaseNode instance: re-wrap to apply key/theme if needed
|
|
98
|
-
if(void 0!==c&&(d.key=c),a instanceof BaseNode){var e,f,g,h,i,j=(null===(e=a.rawProps)||void 0===e?void 0:e.theme)||(null===(f=a.rawProps)||void 0===f?void 0:f.nodetheme)||b
|
|
99
|
-
return shallowEqual(d,{key:null===(g=a.rawProps)||void 0===g?void 0:g.key})&&j===((null===(h=a.rawProps)||void 0===h?void 0:h.nodetheme)||(null===(i=a.rawProps)||void 0===i?void 0:i.theme))?a.render():new BaseNode(a.element,_objectSpread(_objectSpread(_objectSpread({},a.rawProps),d),{},{nodetheme:j})).render()}// 2. React class component type: wrap in BaseNode
|
|
144
|
+
if(void 0!==c&&(d.key=c),a instanceof BaseNode){var e,f,g,h,i,j=(null===(e=a.rawProps)||void 0===e?void 0:e.theme)||(null===(f=a.rawProps)||void 0===f?void 0:f.nodetheme)||b,k=null===(g=a.rawProps)||void 0===g?void 0:g.key;return k===c&&j===((null===(h=a.rawProps)||void 0===h?void 0:h.nodetheme)||(null===(i=a.rawProps)||void 0===i?void 0:i.theme))?a.render():new BaseNode(a.element,_objectSpread(_objectSpread(_objectSpread({},a.rawProps),d),{},{nodetheme:j})).render()}// 2. React class component type: wrap in BaseNode
|
|
100
145
|
return isReactClassComponent(a)?new BaseNode(a,d).render():isNodeInstance(a)?a.render():a instanceof React.Component?a.render():"function"==typeof a?createElement(a,{key:c}):a;// 3. NodeInstance object: call its render
|
|
101
146
|
// 4. React.Component instance: call its render
|
|
102
147
|
// 5. Functional component: create element with key
|
|
@@ -114,11 +159,11 @@ return isReactClassComponent(a)?new BaseNode(a,d).render():isNodeInstance(a)?a.r
|
|
|
114
159
|
* @param props.processRawNode A reference to the `_processRawNode` method for recursive processing.
|
|
115
160
|
* @returns The rendered `ReactNode`.
|
|
116
161
|
* @private
|
|
117
|
-
*/_functionRenderer(a){var b=a.render,
|
|
118
|
-
// Handle React.Component instance
|
|
119
|
-
if(
|
|
120
|
-
if(
|
|
121
|
-
var k=
|
|
162
|
+
*/_functionRenderer(a){var b,c=a.render,d=a.passedTheme,e=a.passedKey,f=a.processRawNode;// Invoke the render function to get the child node.
|
|
163
|
+
try{b=c()}catch(a){b=null}// Handle React.Component instance
|
|
164
|
+
if(b instanceof React.Component){var g=b.render(),h=f(g,d);return BaseNode._renderProcessedNode(h,d,e)}// Handle BaseNode instance
|
|
165
|
+
if(b instanceof BaseNode||isNodeInstance(b)){var i,j=b;return void 0===(null===(i=j.rawProps)||void 0===i?void 0:i.nodetheme)&&void 0!==d?new BaseNode(j.element,_objectSpread(_objectSpread({key:e},j.rawProps),{},{nodetheme:d})).render():j.render()}// Process other result types
|
|
166
|
+
var k=f(b,d);return k?BaseNode._renderProcessedNode(k,d,e):b}/**
|
|
122
167
|
* Processes a single raw node, recursively converting it into a `BaseNode` or other renderable type.
|
|
123
168
|
*
|
|
124
169
|
* This is a central method for normalizing children. It handles various types of input:
|
|
@@ -178,7 +223,9 @@ return a}/**
|
|
|
178
223
|
var c=this.props,d=c.children,e=c.key,f=c.nativeProps,g=_objectWithoutProperties(c,_excluded5),h=void 0;if(void 0!==d&&null!==d){if(!this._normalizedChildren||this._childrenHash!==createStableHash(d,this.props.nodetheme||this.props.theme))if(!Array.isArray(d))this._normalizedChildren=this._normalizeChild(d);else if(0<d.length){var i=d.map(function(b){return a._normalizeChild(b)});this._normalizedChildren=i.every(function(a){return null===a||void 0===a})?void 0:i}else this._normalizedChildren=void 0;h=this._normalizedChildren}// Prepare props for React.createElement
|
|
179
224
|
var j;// If the element has a `css` prop and has style tag, render using the `StyledRenderer` component
|
|
180
225
|
// This enables emotion-based style handling for the element
|
|
181
|
-
|
|
226
|
+
if(j=this.element===Fragment||isFragment(this.element)?{key:e}:_objectSpread(_objectSpread(_objectSpread({},g),{},{key:e},f),{},{suppressHydrationWarning:!0}),this.element&&!hasNoStyleTag(this.element)&&j.css){var k=_objectSpread({element:this.element},j);try{var l=getElementTypeName(k.element);StyledRenderer.displayName="Styled(".concat(l,")")}catch(a){// swallow: displayName is not critical
|
|
227
|
+
}return createElement(StyledRenderer,k,h)}try{this.element.displayName=getElementTypeName(this.element)}catch(a){// swallow: displayName is not critical
|
|
228
|
+
}return createElement(this.element,j,h)}/**
|
|
182
229
|
* Ensures the necessary DOM elements for portal rendering are created and attached.
|
|
183
230
|
*
|
|
184
231
|
* On the client-side, this method checks for or creates a `div` element appended
|
|
@@ -187,7 +234,13 @@ return j=this.element===Fragment||isFragment(this.element)?{key:e}:_objectSpread
|
|
|
187
234
|
* to call multiple times.
|
|
188
235
|
* @returns `true` if the portal infrastructure is ready, `false` if on the server.
|
|
189
236
|
* @private
|
|
190
|
-
*/_ensurePortalInfrastructure(){if("undefined"==typeof window)return!1
|
|
237
|
+
*/_ensurePortalInfrastructure(){if("undefined"==typeof window)return!1;// If both exist and DOM is connected, we're ready
|
|
238
|
+
if(this._portalDOMElement&&this._portalReactRoot&&this._portalDOMElement.isConnected)return!0;// If DOM element exists but isn't connected, clear both DOM element and root
|
|
239
|
+
if(this._portalDOMElement&&!this._portalDOMElement.isConnected){// attempt to unmount root if present
|
|
240
|
+
if(this._portalReactRoot){try{this._portalReactRoot.unmount()}catch(a){// swallow: unmount might fail if already removed; avoid breaking the app
|
|
241
|
+
}this._portalReactRoot=null}this._portalDOMElement=null}// Create DOM element if needed
|
|
242
|
+
// Create react root if needed
|
|
243
|
+
if(this._portalDOMElement||(this._portalDOMElement=document.createElement("div"),document.body.appendChild(this._portalDOMElement)),!this._portalReactRoot){if(!this._portalDOMElement)return!1;this._portalReactRoot=createRoot(this._portalDOMElement)}return!0}/**
|
|
191
244
|
* Renders the node into a React Portal.
|
|
192
245
|
*
|
|
193
246
|
* This method mounts the node's rendered content into a separate DOM tree
|
|
@@ -206,10 +259,10 @@ return j=this.element===Fragment||isFragment(this.element)?{key:e}:_objectSpread
|
|
|
206
259
|
* @param props The props for the node (optional).
|
|
207
260
|
* @param additionalProps Additional props to merge into the node (optional).
|
|
208
261
|
* @returns A new `BaseNode` instance as a `NodeInstance<E>`.
|
|
209
|
-
*/export function Node(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},d=_objectSpread(_objectSpread({},b),c);return d.theme&&!d.nodetheme&&(d.nodetheme=d.theme),new BaseNode(a,d)}/**
|
|
262
|
+
*/_defineProperty(BaseNode,"_processedChildrenWeakCache",new WeakMap),_defineProperty(BaseNode,"_processedChildrenMapCache",new Map),_defineProperty(BaseNode,"_MAX_PROCESSED_CHILDREN_CACHE",1e3);export function Node(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},d=_objectSpread(_objectSpread({},b),c);return d.theme&&!d.nodetheme&&(d.nodetheme=d.theme),new BaseNode(a,d)}/**
|
|
210
263
|
* Creates a curried node factory for a given React element or component type.
|
|
211
264
|
*
|
|
212
|
-
* Returns a function that, when called with props, produces a `
|
|
265
|
+
* Returns a function that, when called with props, produces a `NodeInstance<E>`.
|
|
213
266
|
* Useful for creating reusable node factories for specific components or element types.
|
|
214
267
|
* @template AdditionalInitialProps Additional initial props to merge with node props.
|
|
215
268
|
* @template E The React element or component type.
|
|
@@ -77,6 +77,4 @@ export declare function getDOMProps<E extends ElementType, T extends ComponentPr
|
|
|
77
77
|
* @returns `true` if the tag is in the no-style set, otherwise `false`.
|
|
78
78
|
*/
|
|
79
79
|
export declare function hasNoStyleTag(tag?: NodeElement): boolean;
|
|
80
|
-
// Shallow comparison utility
|
|
81
|
-
export declare function shallowEqual(obj1: any, obj2: any): boolean;
|
|
82
80
|
//# sourceMappingURL=common.helper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.helper.d.ts","sourceRoot":"","sources":["../../src/helper/common.helper.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;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAsFxD;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,GAAG,CAAC,MAAM,CAA0B,CAAA;AAEjE;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAU3F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAUjH;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,CAAC,EAAE,WAAW,GAAG,OAAO,CAGxD"}
|
|
@@ -61,5 +61,4 @@ function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof
|
|
|
61
61
|
* Checks if a given tag is in the set of tags that should not receive style props.
|
|
62
62
|
* @param tag The tag name to check (e.g., 'script', 'style').
|
|
63
63
|
* @returns `true` if the tag is in the no-style set, otherwise `false`.
|
|
64
|
-
*/export function hasNoStyleTag(a){return!!(a&&"string"==typeof a)&&noStyleTagsSet.has(a.toLowerCase())}
|
|
65
|
-
export function shallowEqual(a,b){if(a===b)return!0;if(!a||!b)return!1;if("object"!==_typeof(a)||"object"!==_typeof(b))return a===b;var c=Object.keys(a),d=Object.keys(b);if(c.length!==d.length)return!1;for(var e,f=0,g=c;f<g.length;f++)if(e=g[f],!(e in b)||a[e]!==b[e])return!1;return!0}
|
|
64
|
+
*/export function hasNoStyleTag(a){return!!(a&&"string"==typeof a)&&noStyleTagsSet.has(a.toLowerCase())}
|
|
@@ -894,24 +894,13 @@ export declare const resolveDefaultStyle: (style: CSSProperties) => {
|
|
|
894
894
|
minWidth: import("csstype").Property.MinWidth<string | number>;
|
|
895
895
|
};
|
|
896
896
|
/**
|
|
897
|
-
*
|
|
897
|
+
* Public: createStableHash
|
|
898
|
+
* Produces a deterministic string signature for children + theme.
|
|
899
|
+
* Keep traversal limited so it is cheap in large trees.
|
|
898
900
|
*
|
|
899
|
-
*
|
|
900
|
-
*
|
|
901
|
-
*
|
|
902
|
-
*
|
|
903
|
-
* The hashing strategy includes:
|
|
904
|
-
* - For arrays of children, it includes the length and samples the types of the first few children.
|
|
905
|
-
* - For single child nodes, it includes the type of the node.
|
|
906
|
-
* - For primitive values (strings, numbers, etc.), it includes their type.
|
|
907
|
-
* - If a theme is provided, it includes a stringified version of the theme.
|
|
908
|
-
*
|
|
909
|
-
* This approach avoids deep traversal of potentially large or complex node trees,
|
|
910
|
-
* focusing instead on key characteristics that are likely to change when the structure
|
|
911
|
-
* or content changes.
|
|
912
|
-
* @param children The child nodes to hash, which can be a single node or an array of nodes.
|
|
913
|
-
* @param theme An optional theme object or string to include in the hash.
|
|
914
|
-
* @returns A stable hash string representing the structure and types of the children and theme.
|
|
901
|
+
* If you prefer a shorter hashed output, wrap the returned string in a lightweight
|
|
902
|
+
* hash function (fnv1a, xxhash, etc.). Returning the full signature is useful
|
|
903
|
+
* for debugging and deterministic comparisons.
|
|
915
904
|
*/
|
|
916
905
|
export declare function createStableHash(children: NodeElement | NodeElement[], theme?: Theme): string;
|
|
917
906
|
//# sourceMappingURL=node.helper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.helper.d.ts","sourceRoot":"","sources":["../../src/helper/node.helper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAIzE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,4CAS1B,CAAA;AA4DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,WAAW,GAAG,WAAW,EAAE,EAAE,KAAK,CAAC,EAAE,KAAK,UAIpF"}
|
|
@@ -110,22 +110,22 @@ return _objectSpread({flex:c,// Preserve original flex shorthand
|
|
|
110
110
|
flexShrink:j,// Apply computed or explicit flexShrink
|
|
111
111
|
minHeight:0,// Fix flex item scrolling issues
|
|
112
112
|
minWidth:0},d)};/**
|
|
113
|
-
*
|
|
113
|
+
* Create a stable signature for a React node (children) with bounded traversal.
|
|
114
|
+
* This focuses on the structural identity important for rendering decisions:
|
|
115
|
+
* - element type (string or component name)
|
|
116
|
+
* - key (if present)
|
|
117
|
+
* - basic children shape (recursing within limits)
|
|
118
|
+
*/function nodeSignature(a){var b=Math.min,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:5,d=2<arguments.length&&void 0!==arguments[2]?arguments[2]:6,e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:new WeakSet;if(null===a)return"null";if(void 0===a)return"undefined";var f=_typeof(a);if("string"===f)return"s:".concat(a);if("number"===f)return"n:".concat(a+"");if("boolean"===f)return"b:".concat(a+"");if("function"===f)return"\u0192()";if("symbol"===f)return"sym:".concat(a+"");// Arrays
|
|
119
|
+
if(Array.isArray(a)){if(0>=c)return"ary[...]";for(var g=[],h=b(a.length,d),j=0;j<h;j++)g.push(nodeSignature(a[j],c-1,d,e));return a.length>d&&g.push("...len:".concat(a.length)),"ary[".concat(g.join(","),"]")}// React element-ish: detect common shapes (type + props)
|
|
120
|
+
if("object"===f&&(Object.prototype.hasOwnProperty.call(a,"type")||Object.prototype.hasOwnProperty.call(a,"props"))){var l,m,n=null!==(l=a.type)&&void 0!==l?l:a,o="";// Type can be string (div) or function/class. Use helper to get name.
|
|
121
|
+
try{o=getElementTypeName(n)}catch(a){try{o=n+""}catch(a){o="unknown"}}var p="key"in a&&void 0!==a.key&&null!==a.key?"#".concat(a.key+""):"",q="props"in a&&"object"===_typeof(a.props)?null!==(m=a.props)&&void 0!==m?m:{}:{},r="";try{r=nodeSignature(q.children,c-1,d,e)}catch(a){r="<err>"}var s=q&&"object"===_typeof(q)&&"id"in q&&q.id?"@id:".concat(q.id+""):"",t=q&&"object"===_typeof(q)&&"className"in q&&q.className?"@class:".concat(q.className+""):"";return"el:".concat(o).concat(p).concat(s).concat(t,"{").concat(r,"}")}// Plain object
|
|
122
|
+
if("object"===f&&a&&"object"===_typeof(a)&&!("type"in a)&&!("props"in a)){if(e.has(a))return"[Circular]";if(e.add(a),0>=c)return"obj[...]";for(var u,v=Object.keys(a).sort(),w=[],x=b(v.length,d),y=0;y<x;y++){u=v[y];try{w.push("".concat(u,":").concat(nodeSignature(a[u],c-1,d,e)))}catch(a){w.push("".concat(u,":<err>"))}}return v.length>d&&w.push("...keys:".concat(v.length)),"obj{".concat(w.join(","),"}")}// Fallback
|
|
123
|
+
try{return"o:".concat(a+"")}catch(a){return"o:<unserializable>"}}/**
|
|
124
|
+
* Public: createStableHash
|
|
125
|
+
* Produces a deterministic string signature for children + theme.
|
|
126
|
+
* Keep traversal limited so it is cheap in large trees.
|
|
114
127
|
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
|
|
119
|
-
* The hashing strategy includes:
|
|
120
|
-
* - For arrays of children, it includes the length and samples the types of the first few children.
|
|
121
|
-
* - For single child nodes, it includes the type of the node.
|
|
122
|
-
* - For primitive values (strings, numbers, etc.), it includes their type.
|
|
123
|
-
* - If a theme is provided, it includes a stringified version of the theme.
|
|
124
|
-
*
|
|
125
|
-
* This approach avoids deep traversal of potentially large or complex node trees,
|
|
126
|
-
* focusing instead on key characteristics that are likely to change when the structure
|
|
127
|
-
* or content changes.
|
|
128
|
-
* @param children The child nodes to hash, which can be a single node or an array of nodes.
|
|
129
|
-
* @param theme An optional theme object or string to include in the hash.
|
|
130
|
-
* @returns A stable hash string representing the structure and types of the children and theme.
|
|
131
|
-
*/export function createStableHash(a,b){var c=Math.min,d="";if(b&&(d+="t:".concat("object"===_typeof(b)?ObjHelper.stringify(b):b+"",";")),Array.isArray(a)){d+="a:".concat(a.length,";");for(var e,f=c(3,a.length),g=0;g<f;g++)e=a[g],d+=e&&"object"===_typeof(e)&&"type"in e?"c".concat(g,":").concat(getElementTypeName(e),";"):"c".concat(g,":").concat(_typeof(e),";")}else d+=a&&"object"===_typeof(a)&&"type"in a?"s:".concat(getElementTypeName(a),";"):"s:".concat(_typeof(a),";");return d}
|
|
128
|
+
* If you prefer a shorter hashed output, wrap the returned string in a lightweight
|
|
129
|
+
* hash function (fnv1a, xxhash, etc.). Returning the full signature is useful
|
|
130
|
+
* for debugging and deterministic comparisons.
|
|
131
|
+
*/export function createStableHash(a,b){var c=b?ObjHelper.stringify(b,6):"theme:undefined",d=nodeSignature(a,6,8);return"".concat(c,"|").concat(d)}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
export declare class ObjHelper {
|
|
2
2
|
private constructor();
|
|
3
|
+
/**
|
|
4
|
+
* Build a deterministic, serializable representation of `value`.
|
|
5
|
+
* - sorts plain object keys
|
|
6
|
+
* - preserves encoded placeholders for special types
|
|
7
|
+
* - emits { $type: 'Circular', ref: id } for circular refs
|
|
8
|
+
*/
|
|
9
|
+
private static buildSerializable;
|
|
10
|
+
/**
|
|
11
|
+
* Deterministic stringify: first build a canonical serializable structure
|
|
12
|
+
* (with sorted object keys and encoded special types), then JSON.stringify it.
|
|
13
|
+
*/
|
|
3
14
|
static stringify(obj: any, space?: number): string;
|
|
4
15
|
static parse(str: string): any;
|
|
5
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obj.helper.d.ts","sourceRoot":"","sources":["../../src/helper/obj.helper.ts"],"names":[],"mappings":"AAWA,qBAAa,SAAS;IACpB,OAAO,eAAiB;IAExB,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,SAAI,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"obj.helper.d.ts","sourceRoot":"","sources":["../../src/helper/obj.helper.ts"],"names":[],"mappings":"AAWA,qBAAa,SAAS;IACpB,OAAO,eAAiB;IAExB;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IA2FhC;;;OAGG;IACH,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,SAAI,GAAG,MAAM,CAO5C;IAED,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CA+C7B;CACF"}
|