@meonode/ui 1.0.0-0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +233 -87
  3. package/dist/cjs/components/theme-provider.client.js +1 -1
  4. package/dist/cjs/core.node.js +1 -1
  5. package/dist/cjs/helper/common.helper.js +1 -1
  6. package/dist/cjs/util/navigation-cache-manager.util.js +1 -1
  7. package/dist/cjs/util/node.util.js +1 -1
  8. package/dist/cjs/util/theme.util.js +1 -1
  9. package/dist/esm/components/meonode-unmounter.client.d.ts.map +1 -1
  10. package/dist/esm/components/theme-provider.client.d.ts +1 -2
  11. package/dist/esm/components/theme-provider.client.d.ts.map +1 -1
  12. package/dist/esm/components/theme-provider.client.js +1 -1
  13. package/dist/esm/core.node.d.ts +8 -10
  14. package/dist/esm/core.node.d.ts.map +1 -1
  15. package/dist/esm/core.node.js +1 -1
  16. package/dist/esm/helper/common.helper.d.ts +9 -0
  17. package/dist/esm/helper/common.helper.d.ts.map +1 -1
  18. package/dist/esm/helper/common.helper.js +1 -1
  19. package/dist/esm/types/node.type.d.ts +0 -9
  20. package/dist/esm/types/node.type.d.ts.map +1 -1
  21. package/dist/esm/util/navigation-cache-manager.util.d.ts.map +1 -1
  22. package/dist/esm/util/navigation-cache-manager.util.js +1 -1
  23. package/dist/esm/util/node.util.d.ts +15 -32
  24. package/dist/esm/util/node.util.d.ts.map +1 -1
  25. package/dist/esm/util/node.util.js +1 -1
  26. package/dist/esm/util/theme.util.d.ts +0 -2
  27. package/dist/esm/util/theme.util.d.ts.map +1 -1
  28. package/dist/esm/util/theme.util.js +1 -1
  29. package/package.json +2 -3
  30. package/dist/cjs/helper/obj.helper.js +0 -1
  31. package/dist/esm/helper/obj.helper.d.ts +0 -16
  32. package/dist/esm/helper/obj.helper.d.ts.map +0 -1
  33. package/dist/esm/helper/obj.helper.js +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.0.0] - 2025-11-28
6
+
7
+ ### Perf
8
+
9
+ - **cache**: Remove props, CSS, and theme caching to improve performance and reduce overhead. ([`206361d`](https://github.com/l7aromeo/meonode-ui/commit/206361d)), ([`d7baa16`](https://github.com/l7aromeo/meonode-ui/commit/d7baa16))
10
+
11
+ ### Fix
12
+
13
+ - **theme-provider**: Allow `setTheme` to accept an updater function for more flexible state management. ([`be8d261`](https://github.com/l7aromeo/meonode-ui/commit/be8d261))
14
+ - **core**: Improve mount tracking for cached elements by ensuring `MeoNodeUnmounter` wraps all renderable nodes. ([`d0ca27e`](https://github.com/l7aromeo/meonode-ui/commit/d0ca27e))
15
+ - **theme-provider**: Remove incorrect `@private` JSDoc tag from `ThemeProvider` component. ([`816e398`](https://github.com/l7aromeo/meonode-ui/commit/816e398))
16
+
17
+ ### Test
18
+
19
+ - **performance**: Add controlled input performance tests to simulate human typing and measure `deps` memoization effectiveness. ([`bba48b8`](https://github.com/l7aromeo/meonode-ui/commit/bba48b8))
20
+
21
+ ### Docs
22
+
23
+ - **readme**: Update `README.md` to reflect the removal of automatic caching and emphasize `deps`-based memoization. ([`2600d9c`](https://github.com/l7aromeo/meonode-ui/commit/2600d9c))
24
+
5
25
  ## [1.0.0-0] - 2025-11-27
6
26
 
7
27
  ### Fix
package/README.md CHANGED
@@ -4,75 +4,261 @@
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
  [![Bundle Size](https://img.shields.io/bundlephobia/minzip/@meonode/ui)](https://bundlephobia.com/package/@meonode/ui)
6
6
 
7
- **Build React UIs with Type-Safe Fluency Without JSX Syntax**
7
+ **Type-safe React components without JSX**
8
8
 
9
- A revolutionary approach to React component composition featuring function-based syntax, direct CSS-first prop styling, built-in theming system, and powerful portal capabilities.
9
+ A production-ready component library that replaces JSX with function-based composition, featuring direct CSS prop
10
+ styling, context-based theming, automatic memoization, and full React Server Components support—powered by
11
+ @emotion/react.
10
12
 
11
- ## Quick Start
13
+ ## Core Concept
14
+
15
+ MeoNode UI eliminates JSX while maintaining full React compatibility through functional composition. Style components
16
+ with CSS properties as props, leverage automatic theme resolution via React Context, and benefit from intelligent
17
+ caching without manual optimization.
18
+
19
+ **JSX Pattern:**
20
+
21
+ ```tsx
22
+ <div style={{ padding: '20px', borderRadius: '12px' }}>
23
+ <h2 style={{ fontSize: '1.5rem', marginBottom: '8px' }}>{title}</h2>
24
+ {children}
25
+ </div>
26
+ ```
12
27
 
13
- ```bash
14
- npm install @meonode/ui react
28
+ **MeoNode Pattern:**
29
+
30
+ ```typescript
31
+ Div({
32
+ padding: '20px',
33
+ borderRadius: '12px',
34
+ backgroundColor: 'theme.primary',
35
+ children: [H2(title, { fontSize: '1.5rem', marginBottom: '8px' }), ...children],
36
+ })
15
37
  ```
16
38
 
39
+ ## Features
40
+
41
+ ### Function-Based Composition
42
+
43
+ Plain JavaScript functions replace JSX—no build transforms, no syntax extensions. Compose UIs as first-class function
44
+ trees with full TypeScript inference.
45
+
46
+ ### Direct CSS-in-Props
47
+
48
+ Pass CSS properties directly to components. No separate styled-components declarations, no className juggling. All valid
49
+ CSS properties work as props with full type safety.
50
+
51
+ ```typescript
52
+ Button('Submit', {
53
+ padding: '12px 24px',
54
+ backgroundColor: 'theme.primary',
55
+ borderRadius: 8,
56
+ transition: 'all 0.2s ease',
57
+ css: {
58
+ ':hover': { transform: 'scale(1.05)' },
59
+ },
60
+ })
61
+ ```
62
+
63
+ ### Context-Based Theming
64
+
65
+ Theme values resolve automatically through React Context. Reference semantic tokens anywhere without prop drilling.
66
+ Supports nested themes and dynamic switching.
67
+
17
68
  ```typescript
18
- import {
19
- Component,
20
- ThemeProvider,
21
- Div,
22
- Center,
23
- Column,
24
- H1,
25
- Button,
26
- } from "@meonode/ui";
69
+ ThemeProvider({
70
+ theme: {
71
+ mode: 'dark',
72
+ system: {
73
+ primary: { default: '#FF6B6B', content: '#4A0000' },
74
+ spacing: { sm: 8, md: 16, lg: 24 },
75
+ },
76
+ },
77
+ children: [
78
+ /* your app */
79
+ ],
80
+ })
81
+ ```
82
+
83
+ ### Surgical Memoization
84
+
85
+ Memoize at node-level granularity—not just entire components. Control re-renders with precision by specifying dependency
86
+ arrays directly on individual nodes.
87
+
88
+ **Node-Level Memoization:**
89
+
90
+ ```typescript
91
+ const UserCard = ({ user }) =>
92
+ Div(
93
+ {
94
+ padding: 16,
95
+ children: [
96
+ H2(user.name), // Re-renders on any prop change
97
+ Text(user.bio),
98
+ ],
99
+ },
100
+ [user.id],
101
+ ).render() // Only re-render when user.id changes
102
+ ```
103
+
104
+ **Component-Level Memoization:**
105
+
106
+ ```typescript
107
+ Node(ExpensiveComponent, { data }, [data.id]).render()
108
+ ```
109
+
110
+ ### React Server Components Compatible
111
+
112
+ Full RSC support with proper client/server component boundaries. Use in Next.js App Router, Remix, or any RSC-enabled
113
+ environment without configuration.
114
+
115
+ ### Emotion-Powered Styling
116
+
117
+ Built on @emotion/react for:
118
+
119
+ - Automatic critical CSS extraction
120
+ - Vendor prefixing
121
+ - Dead code elimination
122
+ - Server-side rendering support
123
+ - Zero-runtime overhead in production
124
+
125
+ ### Smart Prop Differentiation
126
+
127
+ Automatically separates style props from DOM attributes. Pass `onClick`, `aria-*`, `data-*` alongside CSS props—MeoNode
128
+ routes them correctly.
129
+
130
+ ```typescript
131
+ Button('Click Me', {
132
+ padding: '12px', // → style
133
+ color: 'theme.primary', // → style
134
+ onClick: handleClick, // → DOM attribute
135
+ 'aria-label': 'Submit', // → DOM attribute
136
+ disabled: isLoading, // → DOM attribute
137
+ })
138
+ ```
139
+
140
+ ## Performance Benchmarks
141
+
142
+ MeoNode is built for high-performance applications, featuring an optimized caching system and iterative rendering
143
+ engine.
144
+
145
+ ### Layout Rendering
146
+
147
+ | Metric | Value | Description |
148
+ |:------------------------|:--------|:----------------------------------------------------|
149
+ | **Single-Page Layout** | ~9ms | Full SPA layout with header, hero, features, etc. |
150
+ | **10,000 Flat Nodes** | ~304ms | Rendering 10k nodes at the same level |
151
+ | **10,000 Nested Nodes** | ~1604ms | Deeply nested structure (single parent-child chain) |
152
+
153
+ ### Memory Management
154
+
155
+ | Metric | Value | Description |
156
+ |:---------------------------|:-------------|:-------------------------------------------------|
157
+ | **Navigation Memory Leak** | **-7.24 MB** | Memory is efficiently reclaimed after navigation |
158
+ | **Mount/Unmount Cycles** | Stable | No leaks detected over 200 cycles |
159
+ | **State Updates** | Efficient | Handles heavy state changes without bloating |
160
+
161
+ ### Form Input Performance
162
+
163
+ | Metric | Value | Description |
164
+ |:----------------------|:------------|:------------------------------------------------|
165
+ | **Avg Response Time** | **2.54 ms** | 100 controlled inputs with simulated typing |
166
+ | **Max Response Time** | 4.09 ms | Worst-case scenario remains instant |
167
+ | **Optimization** | `deps` | Granular updates prevent unnecessary re-renders |
168
+
169
+ ### React Comparison (10k Flat Nodes)
170
+
171
+ | Implementation | Time (ms) | Initial Mem |
172
+ |:------------------------|:----------|:------------|
173
+ | **React.createElement** | ~90ms | ~230 MB |
174
+ | **MeoNode** | ~186ms | ~344 MB |
175
+
176
+ > **Note**: While slightly slower in raw micro-benchmarks due to the feature-rich object syntax, MeoNode excels in
177
+ > real-world scenarios with its intelligent caching and memory management.
178
+
179
+ ## Quick Start
180
+
181
+ ```typescript
182
+ import { ThemeProvider, Center, Column, H1, Button, Text } from '@meonode/ui'
27
183
 
28
184
  const theme = {
29
- mode: "light",
185
+ mode: 'light',
30
186
  system: {
31
- primary: { default: '#FF6B6B', content: '#4A0000' },
187
+ primary: { default: '#FF6B6B', content: '#FFFFFF' },
32
188
  base: { default: '#F8F8F8', content: '#333333' },
33
- }
34
- };
189
+ },
190
+ }
35
191
 
36
- const App = Component(() =>
192
+ const App = () =>
37
193
  ThemeProvider({
38
194
  theme,
39
- children: Div({
40
- backgroundColor: "theme.base.default",
41
- children: Center({
195
+ children: [
196
+ Center({
42
197
  padding: 40,
198
+ backgroundColor: 'theme.base',
43
199
  children: Column({
44
200
  gap: 24,
45
- textAlign: "center",
46
201
  children: [
47
- H1("Welcome to MeoNode", {
48
- fontSize: "3rem",
49
- color: "theme.primary.default",
202
+ H1('MeoNode UI', {
203
+ fontSize: '3rem',
204
+ color: 'theme.primary',
205
+ }),
206
+ Text('Type-safe React without JSX', {
207
+ fontSize: '1.2rem',
208
+ color: 'theme.base.content',
50
209
  }),
51
- Button("Get Started", {
52
- backgroundColor: "theme.primary.default",
53
- color: "theme.primary.content",
54
- padding: "12px 24px",
210
+ Button('Get Started', {
211
+ backgroundColor: 'theme.primary',
212
+ color: 'theme.primary.content',
213
+ padding: '12px 24px',
55
214
  borderRadius: 8,
56
- cursor: "pointer",
57
- onClick: () => alert("Hello MeoNode!"),
215
+ cursor: 'pointer',
216
+ onClick: () => console.log('Started!'),
58
217
  }),
59
218
  ],
60
219
  }),
61
220
  }),
62
- }),
63
- })
64
- );
221
+ ],
222
+ }).render()
65
223
  ```
66
224
 
67
- ## Key Features
225
+ ## Architecture
226
+
227
+ **Component Factory System**
228
+ `Node` factory + `Component` wrapper + semantic elements (Div, Button, etc.) enable both rapid prototyping and
229
+ sophisticated component architectures.
230
+
231
+ **Theme Resolution Engine**
232
+ Context-based theme propagation with automatic value resolution. Nested theme objects inherit and override parent values
233
+ without explicit passing.
234
+
235
+ **CSS Engine**
236
+ @emotion/react provides CSS-in-JS with automatic optimization, critical CSS extraction for SSR, and zero-runtime
237
+ overhead in production builds.
238
+
239
+ ## Why MeoNode UI?
240
+
241
+ **For Teams Building Design Systems:**
242
+
243
+ - Context-based theme propagation
244
+ - Semantic token system ensures visual consistency
245
+ - Component composition patterns scale naturally
246
+ - Full TypeScript support catches design token errors
247
+
248
+ **For Performance-Critical Applications:**
68
249
 
69
- - **Function-based components** - No JSX required, pure TypeScript functions
70
- - **Built-in Theming System** - Use `ThemeProvider` to propagate theme through your app.
71
- - **Theme-aware styling** - Direct CSS props with automatic theme resolution
72
- - **Advanced CSS support** - Pseudo-classes, media queries, animations via `css` prop
73
- - **Portal system** - Context-aware modals and overlays
74
- - **TypeScript first** - Full type safety with intelligent autocomplete
75
- - **Performance optimized** - Powered by @emotion/react
250
+ - Emotion's CSS optimization and caching
251
+ - Surgical memoization at node granularity
252
+ - SSR-ready with critical CSS extraction
253
+ - RSC compatibility for modern React architectures
254
+
255
+ **For Developer Productivity:**
256
+
257
+ - No JSX compilation overhead
258
+ - Direct CSS-in-props reduces context switching
259
+ - Intelligent prop routing (style vs DOM attributes)
260
+ - Full autocomplete for all CSS properties
261
+ - Composable function trees with first-class JavaScript
76
262
 
77
263
  ## Documentation
78
264
 
@@ -80,51 +266,10 @@ const App = Component(() =>
80
266
 
81
267
  🎮 **[Interactive Playground](https://codesandbox.io/p/github/l7aromeo/nextjs-meonode/main?import=true)**
82
268
 
83
- ## Core API
84
-
85
- ```typescript
86
- // Create reusable components
87
- const Card = Component<{ title: string }>(({ title }) =>
88
- Div({
89
- padding: '20px',
90
- borderRadius: '8px',
91
- backgroundColor: 'white',
92
- children: H2(title)
93
- })
94
- );
95
-
96
- // Advanced styling with css prop
97
- const AnimatedBox = Div({
98
- padding: '20px',
99
- css: {
100
- '&:hover': { transform: 'scale(1.05)' },
101
- '@media (max-width: 768px)': { padding: '12px' }
102
- }
103
- });
104
-
105
- // Portal for modals/overlays
106
- const Modal = Portal(({ portal, message }) =>
107
- Center({
108
- position: 'fixed',
109
- top: 0, left: 0, right: 0, bottom: 0,
110
- backgroundColor: 'rgba(0,0,0,0.5)',
111
- onClick: portal.unmount,
112
- children: Div({
113
- backgroundColor: 'white',
114
- padding: '24px',
115
- borderRadius: '12px',
116
- children: [
117
- Text(message),
118
- Button('Close', { onClick: portal.unmount })
119
- ]
120
- })
121
- })
122
- );
123
- ```
124
-
125
269
  ## Contributing
126
270
 
127
- We welcome contributions! Please see our [contributing guidelines](https://github.com/l7aromeo/meonode-ui/blob/main/CONTRIBUTING.md).
271
+ We welcome contributions! Please see
272
+ our [contributing guidelines](https://github.com/l7aromeo/meonode-ui/blob/main/CONTRIBUTING.md).
128
273
 
129
274
  ## License
130
275
 
@@ -132,4 +277,5 @@ MIT © [Ukasyah Rahmatullah Zada](https://github.com/l7aromeo)
132
277
 
133
278
  ---
134
279
 
135
- **[📖 Full Documentation](https://ui.meonode.com)** • **[🐛 Issues](https://github.com/l7aromeo/meonode-ui/issues)** • **[💬 Discussions](https://github.com/l7aromeo/meonode-ui/discussions)**
280
+ **[📖 Full Documentation](https://ui.meonode.com)** • **[🐛 Issues](https://github.com/l7aromeo/meonode-ui/issues)** • *
281
+ *[💬 Discussions](https://github.com/l7aromeo/meonode-ui/discussions)**
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../core.node.js");const r=e.createContext(null);exports.ThemeContext=r,exports.default=function({children:o,theme:n}){const[c,d]=e.useState(n);if(!n)throw new Error("`theme` prop must be defined");const s={theme:c,setTheme:e=>{document.cookie=`theme=${e.mode}; path=/;`,d(e)}};return t.Node(r.Provider,{value:s,children:o}).render()};
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../core.node.js");const r=e.createContext(null);exports.ThemeContext=r,exports.default=function({children:o,theme:n}){const[c,u]=e.useState(n);if(!n)throw new Error("`theme` prop must be defined");const d={theme:c,setTheme:e=>{"function"==typeof e&&(e=e(c)),document.cookie=`theme=${e.mode}; path=/;`,u(e)}};return t.Node(r.Provider,{value:d,children:o}).render()};
@@ -1 +1 @@
1
- "use strict";var e=require("react"),t=require("./helper/react-is.helper.js"),r=require("./helper/common.helper.js"),n=require("./components/styled-renderer.client.js"),o=require("./constant/common.const.js"),s=require("./util/mount-tracker.util.js"),a=require("./components/meonode-unmounter.client.js"),l=require("./util/navigation-cache-manager.util.js"),i=require("./util/node.util.js"),c=require("./util/theme.util.js");class d{instanceId=Math.random().toString(36).slice(2)+Date.now().toString(36);element;rawProps={};isBaseNode=!0;_props;_deps;stableKey;lastPropsObj;lastSignature;static elementCache=new Map;static propProcessingCache=new Map;static scheduledCleanup=!1;static _navigationStarted=!1;static renderContextPool=[];static acquireRenderContext(){const e=d.renderContextPool;return e.length>0?e.pop():{workStack:new Array(512),renderedElements:new Map}}static releaseRenderContext(e){d.renderContextPool.length<50&&e.workStack.length<2048&&(e.workStack.length=0,e.renderedElements.clear(),d.renderContextPool.push(e))}constructor(e,n={},o){if(!t.isValidElementType(e)){const t=r.getComponentType(e);throw new Error(`Invalid element type: ${t} provided!`)}this.element=e,this.rawProps=n,this._deps=o;const{ref:s,children:a,...c}=n;this.stableKey=this._getStableKey(c),i.NodeUtil.isServer||d._navigationStarted||(l.NavigationCacheManagerUtil.getInstance().start(),d._navigationStarted=!0)}get props(){return this._props||(this._props=i.NodeUtil.processProps(this.element,this.rawProps,this.stableKey)),this._props}get dependencies(){return this._deps}_getStableKey({key:e,...t}){if(i.NodeUtil.isServer)return;if(this.lastPropsObj===t)return this.lastSignature;this.lastPropsObj=t;const n=Object.keys(t),s=n.length;if(s>100){const e=i.NodeUtil.extractCriticalProps(t,n);this.lastSignature=i.NodeUtil.createPropSignature(this.element,e),o.__DEBUG__&&s>200&&console.warn(`MeoNode: Large props (${s} keys) on "${r.getElementTypeName(this.element)}". Consider splitting.`)}else this.lastSignature=i.NodeUtil.createPropSignature(this.element,t);return null!=e?`${String(e)}:${this.lastSignature}`:this.lastSignature}static cacheCleanupRegistry=new FinalizationRegistry(e=>{const{cacheKey:t,instanceId:r}=e,n=d.elementCache.get(t);n?.instanceId===r&&d.elementCache.delete(t),s.MountTrackerUtil.isMounted(t)&&s.MountTrackerUtil.untrackMount(t)});static portalCleanupRegistry=new FinalizationRegistry(e=>{const{domElement:t,reactRoot:r}=e;o.__DEBUG__&&console.log("[MeoNode] FinalizationRegistry auto-cleaning portal");try{r&&"function"==typeof r.unmount&&r.unmount()}catch(e){o.__DEBUG__&&console.error("[MeoNode] Portal auto-cleanup unmount error:",e)}try{t?.isConnected&&t.remove()}catch(e){o.__DEBUG__&&console.error("[MeoNode] Portal auto-cleanup DOM removal error:",e)}});render(o=!1){const s=i.NodeUtil.shouldCacheElement(this)?d.elementCache.get(this.stableKey):void 0,l=i.NodeUtil.shouldNodeUpdate(s?.prevDeps,this._deps,o);if(!l&&s?.renderedElement)return s.accessCount+=1,s.renderedElement;const c=!l,h=d.acquireRenderContext();let{workStack:u}=h;const{renderedElements:p}=h;let m=0;try{const o=e=>{if(e>u.length){const t=Math.max(e,u.length<<1),r=new Array(t);for(let e=0;e<m;e++)r[e]=u[e];u=r}};for(u[m++]={node:this,isProcessed:!1,blocked:c};m>0;){const s=u[m-1];if(!s){m--;continue}const{node:a,isProcessed:l,blocked:c}=s;if(l){m--;const{children:o,key:s,css:l,nativeProps:c,disableEmotion:h,...u}=a.props;let g=[];if(o){const t=Array.isArray(o)?o:[o],r=t.length;g=new Array(r);for(let n=0;n<r;n++){const r=t[n];if(i.NodeUtil.isNodeInstance(r)){const e=p.get(r);if(!e)throw new Error(`[MeoNode] Missing rendered element for child node: ${r.stableKey}`);g[n]=e}else e.isValidElement(r),g[n]=r}}const _={...u,key:s,...c};let y;if(a.element===e.Fragment||t.isFragment(a.element))y=e.createElement(a.element,{key:s},...g);else{y=!h&&(l||!r.hasNoStyleTag(a.element))?e.createElement(n.default,{element:a.element,..._,css:l,suppressHydrationWarning:!0},...g):e.createElement(a.element,_,...g)}if(a!==this&&i.NodeUtil.shouldCacheElement(a)){const e=d.elementCache.get(a.stableKey);if(e)e.prevDeps=a._deps,e.renderedElement=y,e.accessCount+=1;else{const e={prevDeps:a._deps,renderedElement:y,nodeRef:new WeakRef(a),createdAt:Date.now(),accessCount:1,instanceId:a.instanceId};d.elementCache.set(a.stableKey,e),d.cacheCleanupRegistry.register(a,{cacheKey:a.stableKey,instanceId:a.instanceId},a)}}p.set(a,y)}else{s.isProcessed=!0;const e=a.props.children;if(e){const t=(Array.isArray(e)?e:[e]).filter(i.NodeUtil.isNodeInstance);o(m+t.length);for(let e=t.length-1;e>=0;e--){const r=t[e],n=i.NodeUtil.shouldCacheElement(r)?d.elementCache.get(r.stableKey):void 0,o=i.NodeUtil.shouldNodeUpdate(n?.prevDeps,r._deps,c);if(!o&&n?.renderedElement){p.set(r,n.renderedElement);continue}const s=c||!o;u[m++]={node:r,isProcessed:!1,blocked:s}}}}}let s=p.get(this);if(!i.NodeUtil.isServer&&this.stableKey&&(s=e.createElement(a.default,{node:this},s)),i.NodeUtil.shouldCacheElement(this)){const e=d.elementCache.get(this.stableKey);if(e)e.prevDeps=this._deps,e.renderedElement=s,e.accessCount+=1;else{const e={prevDeps:this._deps,renderedElement:s,nodeRef:new WeakRef(this),createdAt:Date.now(),accessCount:1,instanceId:this.instanceId};d.elementCache.set(this.stableKey,e),d.cacheCleanupRegistry.register(this,{cacheKey:this.stableKey,instanceId:this.instanceId},this)}}return s}finally{for(let e=0;e<m;e++)u[e]=null;d.releaseRenderContext({workStack:u,renderedElements:p})}}toPortal(){if(!i.NodeUtil.ensurePortalInfrastructure(this))throw new Error("toPortal() can only be called in a client-side environment");const e=i.NodeUtil.portalInfrastructure.get(this),{domElement:t,reactRoot:r}=e;(()=>{try{r.render(this.render())}catch(e){o.__DEBUG__&&console.error("[MeoNode] Portal render error:",e)}})();let n=!1;const s=r.unmount.bind(r);return r.update=e=>{if(n)o.__DEBUG__&&console.warn("[MeoNode] Attempt to update already-unmounted portal");else try{const t=i.NodeUtil.isNodeInstance(e)?e.render():e;r.render(t)}catch(e){o.__DEBUG__&&console.error("[MeoNode] Portal update error:",e)}},r.unmount=()=>{if(n)o.__DEBUG__&&console.warn("[MeoNode] Portal already unmounted");else{n=!0;try{d.portalCleanupRegistry.unregister(this)}catch(e){o.__DEBUG__&&console.warn("[MeoNode] Portal unregister warning:",e)}i.NodeUtil.portalInfrastructure.delete(this);try{t?.isConnected&&s()}catch(e){o.__DEBUG__&&console.error("[MeoNode] Portal unmount error:",e)}try{t?.isConnected&&t.remove()}catch(e){o.__DEBUG__&&console.error("[MeoNode] Portal DOM cleanup error:",e)}}},r}static clearCaches(){const e=Array.from(d.elementCache.keys());o.__DEBUG__&&console.log(`[MeoNode] clearCaches: Clearing ${e.length} entries`);for(const t of e){const e=d.elementCache.get(t);if(e){const r=e.nodeRef?.deref();if(r)try{d.cacheCleanupRegistry.unregister(r),r.lastSignature=void 0,r.lastPropsObj=void 0}catch{o.__DEBUG__&&console.warn(`[MeoNode] Could not unregister ${t} from FinalizationRegistry`)}}}d.propProcessingCache.clear(),d.elementCache.clear(),c.ThemeUtil.clearThemeCache(),s.MountTrackerUtil.cleanup(),o.__DEBUG__&&console.log("[MeoNode] All caches cleared")}}function h(e,t={},r){return new d(e,t,r)}h.clearCaches=d.clearCaches,exports.BaseNode=d,exports.Node=h,exports.createChildrenFirstNode=function(e,t){const r=(r,n,o)=>h(e,{...t,...n,children:r},o);return r.element=e,r},exports.createNode=function(e,t){const r=(r,n)=>h(e,{...t,...r},n);return r.element=e,r};
1
+ "use strict";var e=require("react"),t=require("./helper/react-is.helper.js"),n=require("./helper/common.helper.js"),r=require("./components/styled-renderer.client.js"),o=require("./constant/common.const.js"),s=require("./util/mount-tracker.util.js"),a=require("./components/meonode-unmounter.client.js"),l=require("./util/navigation-cache-manager.util.js"),i=require("./util/node.util.js");const c=Symbol.for("@meonode/ui/BaseNode/elementCache"),d=Symbol.for("@meonode/ui/BaseNode/navigationStarted"),u=Symbol.for("@meonode/ui/BaseNode/renderContextPool"),h=Symbol.for("@meonode/ui/BaseNode/cacheCleanupRegistry"),p=Symbol.for("@meonode/ui/BaseNode/portalCleanupRegistry");class m{instanceId=Math.random().toString(36).slice(2)+Date.now().toString(36);element;rawProps={};isBaseNode=!0;_props;_deps;stableKey;lastPropsObj;lastSignature;static get elementCache(){return n.getGlobalState(c,()=>new Map)}static get _navigationStarted(){return n.getGlobalState(d,()=>({value:!1})).value}static set _navigationStarted(e){n.getGlobalState(d,()=>({value:!1})).value=e}static get renderContextPool(){return n.getGlobalState(u,()=>[])}static acquireRenderContext(){const e=m.renderContextPool;return e.length>0?e.pop():{workStack:new Array(512),renderedElements:new Map}}static releaseRenderContext(e){m.renderContextPool.length<50&&e.workStack.length<2048&&(e.workStack.length=0,e.renderedElements.clear(),m.renderContextPool.push(e))}constructor(e,r={},o){if(!t.isValidElementType(e)){const t=n.getComponentType(e);throw new Error(`Invalid element type: ${t} provided!`)}this.element=e,this.rawProps=r,this._deps=o;const{ref:s,children:a,...c}=r;this.stableKey=this._getStableKey(c),i.NodeUtil.isServer||m._navigationStarted||(l.NavigationCacheManagerUtil.getInstance().start(),m._navigationStarted=!0)}get props(){return this._props||(this._props=i.NodeUtil.processProps(this.element,this.rawProps,this.stableKey)),this._props}get dependencies(){return this._deps}_getStableKey({key:e,...t}){if(i.NodeUtil.isServer)return;if(this.lastPropsObj===t)return this.lastSignature;this.lastPropsObj=t;const r=Object.keys(t),s=r.length;if(s>100){const e=i.NodeUtil.extractCriticalProps(t,r);this.lastSignature=i.NodeUtil.createPropSignature(this.element,e),o.__DEBUG__&&s>200&&console.warn(`MeoNode: Large props (${s} keys) on "${n.getElementTypeName(this.element)}". Consider splitting.`)}else this.lastSignature=i.NodeUtil.createPropSignature(this.element,t);return null!=e?`${String(e)}:${this.lastSignature}`:this.lastSignature}static get cacheCleanupRegistry(){return n.getGlobalState(h,()=>new FinalizationRegistry(e=>{const{cacheKey:t,instanceId:n}=e,r=m.elementCache.get(t);r?.instanceId===n&&m.elementCache.delete(t),s.MountTrackerUtil.isMounted(t)&&s.MountTrackerUtil.untrackMount(t)}))}static get portalCleanupRegistry(){return n.getGlobalState(p,()=>new FinalizationRegistry(e=>{const{domElement:t,reactRoot:n}=e;o.__DEBUG__&&console.log("[MeoNode] FinalizationRegistry auto-cleaning portal");try{n&&"function"==typeof n.unmount&&n.unmount()}catch(e){o.__DEBUG__&&console.error("[MeoNode] Portal auto-cleanup unmount error:",e)}try{t?.isConnected&&t.remove()}catch(e){o.__DEBUG__&&console.error("[MeoNode] Portal auto-cleanup DOM removal error:",e)}}))}render(o=!1){const s=i.NodeUtil.shouldCacheElement(this)?m.elementCache.get(this.stableKey):void 0,l=i.NodeUtil.shouldNodeUpdate(s?.prevDeps,this._deps,o);if(!l&&s?.renderedElement)return s.accessCount+=1,s.renderedElement;const c=!l,d=m.acquireRenderContext();let{workStack:u}=d;const{renderedElements:h}=d;let p=0;try{const o=e=>{if(e>u.length){const t=Math.max(e,u.length<<1),n=new Array(t);for(let e=0;e<p;e++)n[e]=u[e];u=n}};for(u[p++]={node:this,isProcessed:!1,blocked:c};p>0;){const s=u[p-1];if(!s){p--;continue}const{node:a,isProcessed:l,blocked:c}=s;if(l){p--;const{children:o,key:s,css:l,nativeProps:c,disableEmotion:d,...u}=a.props;let g=[];if(o){const t=Array.isArray(o)?o:[o],n=t.length;g=new Array(n);for(let r=0;r<n;r++){const n=t[r];if(i.NodeUtil.isNodeInstance(n)){const e=h.get(n);if(!e)throw new Error(`[MeoNode] Missing rendered element for child node: ${n.stableKey}`);g[r]=e}else e.isValidElement(n),g[r]=n}}const _={...u,key:s,...c};let y;if(a.element===e.Fragment||t.isFragment(a.element))y=e.createElement(a.element,{key:s},...g);else{y=!d&&(l||!n.hasNoStyleTag(a.element))?e.createElement(r.default,{element:a.element,..._,css:l,suppressHydrationWarning:!0},...g):e.createElement(a.element,_,...g)}if(a!==this&&i.NodeUtil.shouldCacheElement(a)){const e=m.elementCache.get(a.stableKey);if(e)e.prevDeps=a._deps,e.renderedElement=y,e.accessCount+=1;else{const e={prevDeps:a._deps,renderedElement:y,nodeRef:new WeakRef(a),createdAt:Date.now(),accessCount:1,instanceId:a.instanceId};m.elementCache.set(a.stableKey,e),m.cacheCleanupRegistry.register(a,{cacheKey:a.stableKey,instanceId:a.instanceId},a)}}h.set(a,y)}else{s.isProcessed=!0;const e=a.props.children;if(e){const t=(Array.isArray(e)?e:[e]).filter(i.NodeUtil.isNodeInstance);o(p+t.length);for(let e=t.length-1;e>=0;e--){const n=t[e],r=i.NodeUtil.shouldCacheElement(n)?m.elementCache.get(n.stableKey):void 0,o=i.NodeUtil.shouldNodeUpdate(r?.prevDeps,n._deps,c);if(!o&&r?.renderedElement){h.set(n,r.renderedElement);continue}const s=c||!o;u[p++]={node:n,isProcessed:!1,blocked:s}}}}}let s=h.get(this);if(!i.NodeUtil.isServer&&this.stableKey&&(s=e.createElement(a.default,{node:this},s)),i.NodeUtil.shouldCacheElement(this)){const e=m.elementCache.get(this.stableKey);if(e)e.prevDeps=this._deps,e.renderedElement=s,e.accessCount+=1;else{const e={prevDeps:this._deps,renderedElement:s,nodeRef:new WeakRef(this),createdAt:Date.now(),accessCount:1,instanceId:this.instanceId};m.elementCache.set(this.stableKey,e),m.cacheCleanupRegistry.register(this,{cacheKey:this.stableKey,instanceId:this.instanceId},this)}}return s}finally{for(let e=0;e<p;e++)u[e]=null;m.releaseRenderContext({workStack:u,renderedElements:h})}}toPortal(){if(!i.NodeUtil.ensurePortalInfrastructure(this))throw new Error("toPortal() can only be called in a client-side environment");const e=i.NodeUtil.portalInfrastructure.get(this),{domElement:t,reactRoot:n}=e;(()=>{try{n.render(this.render())}catch(e){o.__DEBUG__&&console.error("[MeoNode] Portal render error:",e)}})();let r=!1;const s=n.unmount.bind(n);return n.update=e=>{if(r)o.__DEBUG__&&console.warn("[MeoNode] Attempt to update already-unmounted portal");else try{const t=i.NodeUtil.isNodeInstance(e)?e.render():e;n.render(t)}catch(e){o.__DEBUG__&&console.error("[MeoNode] Portal update error:",e)}},n.unmount=()=>{if(r)o.__DEBUG__&&console.warn("[MeoNode] Portal already unmounted");else{r=!0;try{m.portalCleanupRegistry.unregister(this)}catch(e){o.__DEBUG__&&console.warn("[MeoNode] Portal unregister warning:",e)}i.NodeUtil.portalInfrastructure.delete(this);try{t?.isConnected&&s()}catch(e){o.__DEBUG__&&console.error("[MeoNode] Portal unmount error:",e)}try{t?.isConnected&&t.remove()}catch(e){o.__DEBUG__&&console.error("[MeoNode] Portal DOM cleanup error:",e)}}},n}static clearCaches(){const e=Array.from(m.elementCache.keys());o.__DEBUG__&&console.log(`[MeoNode] clearCaches: Clearing ${e.length} entries`);for(const t of e){const e=m.elementCache.get(t);if(e){const n=e.nodeRef?.deref();if(n)try{m.cacheCleanupRegistry.unregister(n),n.lastSignature=void 0,n.lastPropsObj=void 0}catch{o.__DEBUG__&&console.warn(`[MeoNode] Could not unregister ${t} from FinalizationRegistry`)}}}m.elementCache.clear(),s.MountTrackerUtil.cleanup(),o.__DEBUG__&&console.log("[MeoNode] All caches cleared")}}function g(e,t={},n){return new m(e,t,n)}g.clearCaches=m.clearCaches,exports.BaseNode=m,exports.Node=g,exports.createChildrenFirstNode=function(e,t){const n=(n,r,o)=>g(e,{...t,...r,children:n},o);return n.element=e,n},exports.createNode=function(e,t){const n=(n,r)=>g(e,{...t,...n},r);return n.element=e,n};
@@ -1 +1 @@
1
- "use strict";var e=require("./react-is.helper.js"),t=require("../constant/css-properties.const.js"),r=require("../constant/common.const.js");const n=t=>e.isForwardRef(t)?"forwardRef":e.isMemo(t)?"memo":e.isFragment(t)?"fragment":e.isPortal(t)?"portal":e.isProfiler(t)?"profiler":e.isStrictMode(t)?"strict-mode":e.isSuspense(t)?"suspense":e.isSuspenseList(t)?"suspense-list":e.isContextConsumer(t)?"context-consumer":e.isContextProvider(t)?"context-provider":e.isLazy(t)?"lazy":e.isElement(t)?"element":e.isReactClassComponent(t)?"class":typeof t;const o=new Set(t.default);exports.CSSPropertySet=o,exports.getCSSProps=function(e){const t={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&o.has(r)&&(t[r]=e[r]);return t},exports.getComponentType=n,exports.getDOMProps=function(e){const t={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&!o.has(r)&&(t[r]=e[r]);return t},exports.getElementTypeName=function e(t){function r(e,t){const r=e?.displayName||e?.name;return r&&"render"!==r?r:t}if(null==t)return"UnknownElementType";const o=t,s=n(o);switch(s){case"string":return t;case"class":return r(o,"ClassComponent");case"function":return r(o,"AnonymousFunctionComponent");case"forwardRef":return r(o,"")||r(o.render,"")||"ForwardRefComponent";case"memo":return r(o,"")||(o.type?e(o.type):"MemoComponent");case"element":return e(o.type);case"fragment":return"Fragment";case"portal":return"Portal";case"profiler":return r(o,"Profiler");case"strict-mode":return"StrictMode";case"suspense":return r(o,"Suspense");case"suspense-list":return"SuspenseList";case"context-consumer":return o._context?.displayName?`${o._context.displayName}.Consumer`:"ContextConsumer";case"context-provider":return o._context?.displayName?`${o._context.displayName}.Provider`:"ContextProvider";case"lazy":return r(o,"LazyComponent");case"object":return r(o,"")?r(o,""):"function"==typeof o.render?r(o.render,"ObjectWithRender"):o.type&&o.type!==t?`Wrapped<${e(o.type)}>`:r(o,"ObjectComponent");case"symbol":return"symbol"==typeof t?t.description?.replace(/^react\./,"").split(".").map(e=>e[0]?.toUpperCase()+e.slice(1)).join("")||t.toString():"SymbolComponent";case"unknown":return"UnknownElementType";default:return`UnsupportedType<${s}>`}},exports.getValueByPath=(e,t)=>t.split(".").reduce((e,t)=>e&&void 0!==e[t]?e[t]:void 0,e),exports.hasNoStyleTag=function(e){return!(!e||"string"!=typeof e)&&r.noStyleTagsSet.has(e.toLowerCase())},exports.omitUndefined=function(e){const t={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&void 0!==e[r]&&(t[r]=e[r]);return t};
1
+ "use strict";var e=require("./react-is.helper.js"),t=require("../constant/css-properties.const.js"),n=require("../constant/common.const.js");const r=t=>e.isForwardRef(t)?"forwardRef":e.isMemo(t)?"memo":e.isFragment(t)?"fragment":e.isPortal(t)?"portal":e.isProfiler(t)?"profiler":e.isStrictMode(t)?"strict-mode":e.isSuspense(t)?"suspense":e.isSuspenseList(t)?"suspense-list":e.isContextConsumer(t)?"context-consumer":e.isContextProvider(t)?"context-provider":e.isLazy(t)?"lazy":e.isElement(t)?"element":e.isReactClassComponent(t)?"class":typeof t;const o=new Set(t.default);exports.CSSPropertySet=o,exports.getCSSProps=function(e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.has(n)&&(t[n]=e[n]);return t},exports.getComponentType=r,exports.getDOMProps=function(e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&!o.has(n)&&(t[n]=e[n]);return t},exports.getElementTypeName=function e(t){function n(e,t){const n=e?.displayName||e?.name;return n&&"render"!==n?n:t}if(null==t)return"UnknownElementType";const o=t,s=r(o);switch(s){case"string":return t;case"class":return n(o,"ClassComponent");case"function":return n(o,"AnonymousFunctionComponent");case"forwardRef":return n(o,"")||n(o.render,"")||"ForwardRefComponent";case"memo":return n(o,"")||(o.type?e(o.type):"MemoComponent");case"element":return e(o.type);case"fragment":return"Fragment";case"portal":return"Portal";case"profiler":return n(o,"Profiler");case"strict-mode":return"StrictMode";case"suspense":return n(o,"Suspense");case"suspense-list":return"SuspenseList";case"context-consumer":return o._context?.displayName?`${o._context.displayName}.Consumer`:"ContextConsumer";case"context-provider":return o._context?.displayName?`${o._context.displayName}.Provider`:"ContextProvider";case"lazy":return n(o,"LazyComponent");case"object":return n(o,"")?n(o,""):"function"==typeof o.render?n(o.render,"ObjectWithRender"):o.type&&o.type!==t?`Wrapped<${e(o.type)}>`:n(o,"ObjectComponent");case"symbol":return"symbol"==typeof t?t.description?.replace(/^react\./,"").split(".").map(e=>e[0]?.toUpperCase()+e.slice(1)).join("")||t.toString():"SymbolComponent";case"unknown":return"UnknownElementType";default:return`UnsupportedType<${s}>`}},exports.getGlobalState=function(e,t){const n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{};return Object.prototype.hasOwnProperty.call(n,e)||(n[e]=t()),n[e]},exports.getValueByPath=(e,t)=>t.split(".").reduce((e,t)=>e&&void 0!==e[t]?e[t]:void 0,e),exports.hasNoStyleTag=function(e){return!(!e||"string"!=typeof e)&&n.noStyleTagsSet.has(e.toLowerCase())},exports.omitUndefined=function(e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&void 0!==e[n]&&(t[n]=e[n]);return t};
@@ -1 +1 @@
1
- "use strict";var e=require("../constant/common.const.js"),t=require("../core.node.js"),i=require("./mount-tracker.util.js");class a{constructor(){}static _instance=null;static _originalPushState=null;static _originalReplaceState=null;static _isPatched=!1;_isListening=!1;_cleanupTimeout=null;static getInstance(){return this._instance||(this._instance=new a),this._instance}start(){this._isListening||"undefined"==typeof window||(this._isListening=!0,window.addEventListener("popstate",this._handleNavigation),this._patchHistoryMethods(),this._setupAutoCleanup(),e.__DEBUG__&&console.log("[MeoNode] NavigationCacheManagerUtil started"))}_stop(){this._isListening&&"undefined"!=typeof window&&(window.removeEventListener("popstate",this._handleNavigation),this._cleanupTimeout&&(clearTimeout(this._cleanupTimeout),this._cleanupTimeout=null),this._isListening=!1,e.__DEBUG__&&console.log("[MeoNode] NavigationCacheManagerUtil stopped"))}_handleNavigation=()=>{this._cleanupTimeout&&clearTimeout(this._cleanupTimeout);const a=t.BaseNode.elementCache.size,s=a<100?50:a<500?100:200;this._cleanupTimeout=setTimeout(()=>{const a=t.BaseNode.propProcessingCache.size;let s=0;t.BaseNode.elementCache.keys().forEach(e=>{i.MountTrackerUtil.isMounted(e)||(t.BaseNode.elementCache.delete(e),s++)}),a>200&&t.BaseNode.propProcessingCache.clear(),e.__DEBUG__&&console.log(`[MeoNode] Navigation: cleared ${s} unmounted elements, ${a} props entries`)},s)};_patchHistoryMethods(){a._isPatched||(a._originalPushState=history.pushState,a._originalReplaceState=history.replaceState,history.pushState=(...e)=>{a._originalPushState.apply(history,e),this._handleNavigation()},history.replaceState=(...e)=>{a._originalReplaceState.apply(history,e),this._handleNavigation()},a._isPatched=!0)}_setupAutoCleanup(){window.__MEONODE_CLEANUP_REGISTERED||(window.addEventListener("beforeunload",()=>{this._stop(),t.BaseNode.clearCaches()}),window.__MEONODE_CLEANUP_REGISTERED=!0)}}exports.NavigationCacheManagerUtil=a;
1
+ "use strict";var e=require("../constant/common.const.js"),t=require("../core.node.js"),i=require("./mount-tracker.util.js");class a{constructor(){}static _instance=null;static _originalPushState=null;static _originalReplaceState=null;static _isPatched=!1;_isListening=!1;_cleanupTimeout=null;static getInstance(){return this._instance||(this._instance=new a),this._instance}start(){this._isListening||"undefined"==typeof window||(this._isListening=!0,window.addEventListener("popstate",this._handleNavigation),this._patchHistoryMethods(),this._setupAutoCleanup(),e.__DEBUG__&&console.log("[MeoNode] NavigationCacheManagerUtil started"))}_stop(){this._isListening&&"undefined"!=typeof window&&(window.removeEventListener("popstate",this._handleNavigation),this._cleanupTimeout&&(clearTimeout(this._cleanupTimeout),this._cleanupTimeout=null),this._isListening=!1,e.__DEBUG__&&console.log("[MeoNode] NavigationCacheManagerUtil stopped"))}_handleNavigation=()=>{this._cleanupTimeout&&clearTimeout(this._cleanupTimeout);const a=t.BaseNode.elementCache.size,n=a<100?50:a<500?100:200;this._cleanupTimeout=setTimeout(()=>{let a=0;t.BaseNode.elementCache.keys().forEach(e=>{i.MountTrackerUtil.isMounted(e)||(t.BaseNode.elementCache.delete(e),a++)}),e.__DEBUG__&&console.log(`[MeoNode] Navigation: cleared ${a} unmounted elements`)},n)};_patchHistoryMethods(){a._isPatched||(a._originalPushState=history.pushState,a._originalReplaceState=history.replaceState,history.pushState=(...e)=>{a._originalPushState.apply(history,e),this._handleNavigation()},history.replaceState=(...e)=>{a._originalReplaceState.apply(history,e),this._handleNavigation()},a._isPatched=!0)}_setupAutoCleanup(){window.__MEONODE_CLEANUP_REGISTERED||(window.addEventListener("beforeunload",()=>{this._stop(),t.BaseNode.clearCaches()}),window.__MEONODE_CLEANUP_REGISTERED=!0)}}exports.NavigationCacheManagerUtil=a;
@@ -1 +1 @@
1
- "use strict";var e=require("react"),t=require("../helper/react-is.helper.js"),o=require("../helper/common.helper.js"),r=require("../constant/common.const.js"),s=require("../core.node.js"),n=require("react-dom/client");class i{constructor(){}static isServer="undefined"==typeof window;static _functionSignatureCache=new WeakMap;static CACHE_SIZE_LIMIT=500;static CACHE_CLEANUP_BATCH=50;static _cssCache=new WeakMap;static CRITICAL_PROPS=new Set(["css","className","disableEmotion","props"]);static portalInfrastructure=new WeakMap;static isNodeInstance=e=>"object"==typeof e&&null!==e&&"element"in e&&"function"==typeof e.render&&"function"==typeof e.toPortal&&"isBaseNode"in e;static isStyleProp=i.isServer||"undefined"==typeof document?()=>!1:e=>e in document.body.style;static hashString(e){let t=2166136261,o=5381;for(let r=0;r<e.length;r++){const s=e.charCodeAt(r);t^=s,t=Math.imul(t,16777619),o=33*o^s}return`${(t>>>0).toString(36)}_${(o>>>0).toString(36)}`}static hashCSS(e){const t=this._cssCache.get(e);if(t)return t;const o=Object.keys(e);let r=o.length;for(let t=0;t<Math.min(o.length,10);t++){const s=o[t],n=e[s];r=(r<<5)-r+s.charCodeAt(0),r&=r,"string"==typeof n&&(r=(r<<5)-r+n.length)}const s=r.toString(36);return this._cssCache.set(e,s),s}static createPropSignature(e,t){if(i.isServer)return;const r=o.getElementTypeName(e),s=Object.keys(t);s.length>1&&s.sort();const n=[`${r}:`];if("function"==typeof e){let t=i._functionSignatureCache.get(e);t||(t=i.hashString(e.toString()),i._functionSignatureCache.set(e,t)),n.push(t)}for(const e of s){const o=t[e];let r;const s=typeof o;if("string"===s||"number"===s||"boolean"===s)r=`${e}:${o};`;else if(null===o)r=`${e}:null;`;else if(void 0===o)r=`${e}:undefined;`;else if("css"===e&&"object"==typeof o)r=`css:${this.hashCSS(o)};`;else if(Array.isArray(o)){const t=o.filter(e=>{const t=typeof e;return"string"===t||"number"===t||"boolean"===t||null===e});r=t.length===o.length?`${e}:[${t.join(",")}];`:`${e}:[${o.length}];`}else if(o&&o.isBaseNode)r=`${e}:${o.stableKey};`;else if("function"===s)r=`${e}:${i.hashString(o.toString())};`;else{r=`${e}:{${Object.keys(o).sort().join(",")}};`}n.push(r)}return i.hashString(n.join(","))}static extractCriticalProps(e,t){const o={_keyCount:t.length};let r=0;for(const s of t){if(r>=50)break;if(i.CRITICAL_PROPS.has(s)){o[s]=e[s],r++;continue}const n=s.charCodeAt(0);111!==n||110!==s.charCodeAt(1)?!(97===n&&114===s.charCodeAt(1)&&105===s.charCodeAt(2)&&97===s.charCodeAt(3)||100===n&&97===s.charCodeAt(1)&&116===s.charCodeAt(2)&&97===s.charCodeAt(3))?t.length<=100&&i.isStyleProp(s)&&(o[s]=e[s],r++):(o[s]=e[s],r++):(o[s]=e[s],r++)}return o}static getCachedCssProps(e,t){if(i.isServer||!t)return{cssProps:o.getCSSProps(e)};const r=s.BaseNode.propProcessingCache.get(t);if(r)return r.lastAccess=Date.now(),r.hitCount++,{cssProps:r.cssProps};const n=o.getCSSProps(e);return s.BaseNode.propProcessingCache.set(t,{cssProps:n,signature:t,lastAccess:Date.now(),hitCount:1}),s.BaseNode.propProcessingCache.size>i.CACHE_SIZE_LIMIT&&!s.BaseNode.scheduledCleanup&&(s.BaseNode.scheduledCleanup=!0,"undefined"!=typeof requestIdleCallback?requestIdleCallback(()=>{i._evictLRUEntries(),s.BaseNode.scheduledCleanup=!1},{timeout:2e3}):setTimeout(()=>{i._evictLRUEntries(),s.BaseNode.scheduledCleanup=!1},100)),{cssProps:n}}static _evictLRUEntries(){const e=Date.now(),t=new a((e,t)=>t.score-e.score);for(const[o,r]of s.BaseNode.propProcessingCache.entries()){const s=this._calculateEvictionScore(r,e);t.push({key:o,score:s})}const o=i.CACHE_SIZE_LIMIT,r=s.BaseNode.propProcessingCache.size,n=Math.max(0,r-o)+i.CACHE_CLEANUP_BATCH;for(let e=0;e<n;e++){const e=t.pop();if(!e)break;s.BaseNode.propProcessingCache.delete(e.key)}}static _calculateEvictionScore(e,t){return(t-e.lastAccess)/1e3*.3+1e3/(e.hitCount+1)*.7}static processProps(e,t={},r){const{ref:s,key:n,children:a,css:c,props:d={},disableEmotion:l,...p}=t;if(0===Object.keys(p).length&&!c)return o.omitUndefined({ref:s,key:n,disableEmotion:l,nativeProps:o.omitUndefined(d),children:i._processChildren(a,l)});const u={},h={},f=Object.keys(p);for(let e=0;e<f.length;e++){const t=f[e],o=p[t],r=typeof o;"string"===r||"number"===r||"boolean"===r?u[t]=o:h[t]=o}const m=i.createPropSignature(e,u),{cssProps:C}=i.getCachedCssProps(u,m),y=o.getCSSProps(h),b=o.getDOMProps(p),E={...C,...y,...c},g=i._processChildren(a,l,r);return o.omitUndefined({ref:s,key:n,css:E,...b,disableEmotion:l,nativeProps:o.omitUndefined(d),children:g})}static _processChildren(e,t,o){if(e)return"function"==typeof e?e:Array.isArray(e)?1===e.length?i.processRawNode(e[0],t,`${o}_0`):e.map((e,r)=>i.processRawNode(e,t,`${o}_${r}`)):i.processRawNode(e,t,o)}static shouldCacheElement(e){return!i.isServer&&!!e.stableKey&&!!e.dependencies}static shouldNodeUpdate(e,t,o){return!!i.isServer||!o&&(void 0===t||(void 0===e||(t.length!==e.length||!!t.some((t,o)=>!Object.is(t,e[o])))))}static processRawNode(o,r,n){if(null==o||"string"==typeof o||"number"==typeof o||"boolean"==typeof o)return o;if(i.isNodeInstance(o)){if(n||r&&!o.rawProps.disableEmotion){const e=new s.BaseNode(o.element,o.rawProps,o.dependencies);return e.stableKey=`${n}:${e.stableKey}`,r&&!e.rawProps.disableEmotion&&(e.rawProps.disableEmotion=!0),e}return o}if(i.isFunctionChild(o))return new s.BaseNode(i.functionRenderer,{props:{render:o,disableEmotion:r}},void 0);if(e.isValidElement(o)){const{style:e,...t}=o.props,n={...t,...e||{}};return new s.BaseNode(o.type,{...n,...null!==o.key&&void 0!==o.key?{key:o.key}:{},disableEmotion:r},void 0)}return t.isReactClassComponent(o)||t.isMemo(o)||t.isForwardRef(o)?new s.BaseNode(o,{disableEmotion:r},void 0):o instanceof e.Component?i.processRawNode(o.render(),r,n):o}static isFunctionChild(e){if("function"!=typeof e||t.isReactClassComponent(e)||t.isMemo(e)||t.isForwardRef(e))return!1;try{return!(e.prototype&&"function"==typeof e.prototype.render)}catch(e){return r.__DEBUG__&&console.error("MeoNode: Error checking if a node is a function child.",e),!0}}static functionRenderer({render:t,disableEmotion:n}){let a;try{a=t()}catch(e){r.__DEBUG__&&console.error("MeoNode: Error executing function-as-a-child.",e),a=null}if(null==a)return a;if(i.isNodeInstance(a))return n&&!a.rawProps.disableEmotion?new s.BaseNode(a.element,{...a.rawProps,disableEmotion:!0}).render():a.render();if(Array.isArray(a)){const e=(e,t)=>{try{return`${o.getElementTypeName(e)}-${t}`}catch(e){return r.__DEBUG__&&console.error("MeoNode: Could not determine element type name for key in function-as-a-child.",e),`item-${t}`}};return a.map((t,o)=>i.renderProcessedNode({processedElement:i.processRawNode(t,n),passedKey:e(t,o),disableEmotion:n}))}if(a instanceof e.Component)return i.renderProcessedNode({processedElement:i.processRawNode(a.render(),n),disableEmotion:n});if("string"==typeof a||"number"==typeof a||"boolean"==typeof a)return a;const c=i.processRawNode(a,n);return c?i.renderProcessedNode({processedElement:c,disableEmotion:n}):a}static renderProcessedNode({processedElement:o,passedKey:r,disableEmotion:n}){const a={};if(void 0!==r&&(a.key=r),i.isNodeInstance(o)){const e=o.rawProps?.key;return o.rawProps.disableEmotion=n,e===r?o.render():new s.BaseNode(o.element,{...o.rawProps,...a}).render()}return t.isReactClassComponent(o)?new s.BaseNode(o,{...a,disableEmotion:n}).render():o instanceof e.Component?o.render():"function"==typeof o?e.createElement(o,{key:r}):o}static ensurePortalInfrastructure(e){if(i.isServer)return!1;let t=i.portalInfrastructure.get(e);if(t?.domElement?.isConnected&&t?.reactRoot)return!0;if(t&&(!t.domElement?.isConnected||!t.reactRoot)){try{t.reactRoot?.unmount?.()}catch(e){r.__DEBUG__&&console.error("MeoNode: Error unmounting stale portal root.",e)}i.cleanupPortalInfra(t),i.portalInfrastructure.delete(e),t=void 0}const o=document.createElement("div");document.body.appendChild(o);const a=n.createRoot(o),c={render:a.render.bind(a),unmount:a.unmount.bind(a),update:()=>{}};return t={domElement:o,reactRoot:c},i.portalInfrastructure.set(e,t),s.BaseNode.portalCleanupRegistry.register(e,{domElement:o,reactRoot:c},e),!0}static cleanupPortalInfra(e){try{e.reactRoot?.unmount&&e.reactRoot.unmount()}catch(e){r.__DEBUG__&&console.error("Portal cleanup error:",e)}try{e.domElement?.isConnected&&e.domElement.remove()}catch(e){r.__DEBUG__&&console.error("DOM removal error:",e)}}}class a{heap=[];comparator;constructor(e){this.comparator=e}size(){return this.heap.length}isEmpty(){return 0===this.size()}push(e){this.heap.push(e),this.bubbleUp()}pop(){if(this.isEmpty())return;this.swap(0,this.size()-1);const e=this.heap.pop();return this.bubbleDown(),e}bubbleUp(e=this.size()-1){for(;e>0;){const t=Math.floor((e-1)/2);if(this.comparator(this.heap[t],this.heap[e])<=0)break;this.swap(t,e),e=t}}bubbleDown(e=0){const t=this.size()-1;for(;;){const o=2*e+1,r=2*e+2;let s=e;if(o<=t&&this.comparator(this.heap[o],this.heap[s])<0&&(s=o),r<=t&&this.comparator(this.heap[r],this.heap[s])<0&&(s=r),s===e)break;this.swap(e,s),e=s}}swap(e,t){[this.heap[e],this.heap[t]]=[this.heap[t],this.heap[e]]}}exports.NodeUtil=i;
1
+ "use strict";var e=require("react"),t=require("../helper/react-is.helper.js"),o=require("../helper/common.helper.js"),r=require("../constant/common.const.js"),n=require("../core.node.js"),s=require("react-dom/client");const i=Symbol.for("@meonode/ui/NodeUtil/functionSignatureCache"),a=Symbol.for("@meonode/ui/NodeUtil/portalInfrastructure");class c{constructor(){}static isServer="undefined"==typeof window;static get _functionSignatureCache(){return o.getGlobalState(i,()=>new WeakMap)}static CRITICAL_PROPS=new Set(["css","className","disableEmotion","props"]);static get portalInfrastructure(){return o.getGlobalState(a,()=>new WeakMap)}static isNodeInstance=e=>"object"==typeof e&&null!==e&&"element"in e&&"function"==typeof e.render&&"function"==typeof e.toPortal&&"isBaseNode"in e;static isStyleProp=c.isServer||"undefined"==typeof document?()=>!1:e=>e in document.body.style;static hashString(e){let t=2166136261,o=5381;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t^=n,t=Math.imul(t,16777619),o=33*o^n}return`${(t>>>0).toString(36)}_${(o>>>0).toString(36)}`}static hashCSS(e){const t=Object.keys(e);let o=t.length;for(let r=0;r<Math.min(t.length,10);r++){const n=t[r],s=e[n];o=(o<<5)-o+n.charCodeAt(0),o&=o,"string"==typeof s&&(o=(o<<5)-o+s.length)}return o.toString(36)}static createPropSignature(e,t){if(c.isServer)return;const r=o.getElementTypeName(e),n=Object.keys(t);n.length>1&&n.sort();const s=[`${r}:`];if("function"==typeof e){let t=c._functionSignatureCache.get(e);t||(t=c.hashString(e.toString()),c._functionSignatureCache.set(e,t)),s.push(t)}for(const e of n){const o=t[e];let r;const n=typeof o;if("string"===n||"number"===n||"boolean"===n)r=`${e}:${o};`;else if(null===o)r=`${e}:null;`;else if(void 0===o)r=`${e}:undefined;`;else if("css"===e&&"object"==typeof o)r=`css:${this.hashCSS(o)};`;else if(Array.isArray(o)){const t=o.filter(e=>{const t=typeof e;return"string"===t||"number"===t||"boolean"===t||null===e});r=t.length===o.length?`${e}:[${t.join(",")}];`:`${e}:[${o.length}];`}else if(o&&o.isBaseNode)r=`${e}:${o.stableKey};`;else if("function"===n)r=`${e}:${c.hashString(o.toString())};`;else{r=`${e}:{${Object.keys(o).sort().join(",")}};`}s.push(r)}return c.hashString(s.join(","))}static extractCriticalProps(e,t){const o={_keyCount:t.length};let r=0;for(const n of t){if(r>=50)break;if(c.CRITICAL_PROPS.has(n)){o[n]=e[n],r++;continue}const s=n.charCodeAt(0);111!==s||110!==n.charCodeAt(1)?!(97===s&&114===n.charCodeAt(1)&&105===n.charCodeAt(2)&&97===n.charCodeAt(3)||100===s&&97===n.charCodeAt(1)&&116===n.charCodeAt(2)&&97===n.charCodeAt(3))?t.length<=100&&c.isStyleProp(n)&&(o[n]=e[n],r++):(o[n]=e[n],r++):(o[n]=e[n],r++)}return o}static processProps(e,t={},r){const{ref:n,key:s,children:i,css:a,props:d={},disableEmotion:l,...u}=t;if(0===Object.keys(u).length&&!a)return o.omitUndefined({ref:n,key:s,disableEmotion:l,nativeProps:o.omitUndefined(d),children:c._processChildren(i,l)});const p={},f={},m=Object.keys(u);for(let e=0;e<m.length;e++){const t=m[e],o=u[t],r=typeof o;"string"===r||"number"===r||"boolean"===r?p[t]=o:f[t]=o}const{cssProps:h}={cssProps:o.getCSSProps(p)},y=o.getCSSProps(f),g=o.getDOMProps(u),b={...h,...y,...a},C=c._processChildren(i,l,r);return o.omitUndefined({ref:n,key:s,css:b,...g,disableEmotion:l,nativeProps:o.omitUndefined(d),children:C})}static _processChildren(e,t,o){if(e)return"function"==typeof e?e:Array.isArray(e)?1===e.length?c.processRawNode(e[0],t,`${o}_0`):e.map((e,r)=>c.processRawNode(e,t,`${o}_${r}`)):c.processRawNode(e,t,o)}static shouldCacheElement(e){return!c.isServer&&!!e.stableKey&&!!e.dependencies}static shouldNodeUpdate(e,t,o){return!!c.isServer||!o&&(void 0===t||(void 0===e||(t.length!==e.length||!!t.some((t,o)=>!Object.is(t,e[o])))))}static processRawNode(o,r,s){if(null==o||"string"==typeof o||"number"==typeof o||"boolean"==typeof o)return o;if(c.isNodeInstance(o)){if(s||r&&!o.rawProps.disableEmotion){const e=new n.BaseNode(o.element,o.rawProps,o.dependencies);return e.stableKey=`${s}:${e.stableKey}`,r&&!e.rawProps.disableEmotion&&(e.rawProps.disableEmotion=!0),e}return o}if(c.isFunctionChild(o))return new n.BaseNode(c.functionRenderer,{props:{render:o,disableEmotion:r}},void 0);if(e.isValidElement(o)){const{style:e,...t}=o.props,s={...t,...e||{}};return new n.BaseNode(o.type,{...s,...null!==o.key&&void 0!==o.key?{key:o.key}:{},disableEmotion:r},void 0)}return t.isReactClassComponent(o)||t.isMemo(o)||t.isForwardRef(o)?new n.BaseNode(o,{disableEmotion:r},void 0):o instanceof e.Component?c.processRawNode(o.render(),r,s):o}static isFunctionChild(e){if("function"!=typeof e||t.isReactClassComponent(e)||t.isMemo(e)||t.isForwardRef(e))return!1;try{return!(e.prototype&&"function"==typeof e.prototype.render)}catch(e){return r.__DEBUG__&&console.error("MeoNode: Error checking if a node is a function child.",e),!0}}static functionRenderer({render:t,disableEmotion:s}){let i;try{i=t()}catch(e){r.__DEBUG__&&console.error("MeoNode: Error executing function-as-a-child.",e),i=null}if(null==i)return i;if(c.isNodeInstance(i))return s&&!i.rawProps.disableEmotion?new n.BaseNode(i.element,{...i.rawProps,disableEmotion:!0}).render():i.render();if(Array.isArray(i)){const e=(e,t)=>{try{return`${o.getElementTypeName(e)}-${t}`}catch(e){return r.__DEBUG__&&console.error("MeoNode: Could not determine element type name for key in function-as-a-child.",e),`item-${t}`}};return i.map((t,o)=>c.renderProcessedNode({processedElement:c.processRawNode(t,s),passedKey:e(t,o),disableEmotion:s}))}if(i instanceof e.Component)return c.renderProcessedNode({processedElement:c.processRawNode(i.render(),s),disableEmotion:s});if("string"==typeof i||"number"==typeof i||"boolean"==typeof i)return i;const a=c.processRawNode(i,s);return a?c.renderProcessedNode({processedElement:a,disableEmotion:s}):i}static renderProcessedNode({processedElement:o,passedKey:r,disableEmotion:s}){const i={};if(void 0!==r&&(i.key=r),c.isNodeInstance(o)){const e=o.rawProps?.key;return o.rawProps.disableEmotion=s,e===r?o.render():new n.BaseNode(o.element,{...o.rawProps,...i}).render()}return t.isReactClassComponent(o)?new n.BaseNode(o,{...i,disableEmotion:s}).render():o instanceof e.Component?o.render():"function"==typeof o?e.createElement(o,{key:r}):o}static ensurePortalInfrastructure(e){if(c.isServer)return!1;let t=c.portalInfrastructure.get(e);if(t?.domElement?.isConnected&&t?.reactRoot)return!0;if(t&&(!t.domElement?.isConnected||!t.reactRoot)){try{t.reactRoot?.unmount?.()}catch(e){r.__DEBUG__&&console.error("MeoNode: Error unmounting stale portal root.",e)}c.cleanupPortalInfra(t),c.portalInfrastructure.delete(e),t=void 0}const o=document.createElement("div");document.body.appendChild(o);const i=s.createRoot(o),a={render:i.render.bind(i),unmount:i.unmount.bind(i),update:()=>{}};return t={domElement:o,reactRoot:a,instanceId:e.instanceId},c.portalInfrastructure.set(e,t),n.BaseNode.portalCleanupRegistry.register(e,{domElement:o,reactRoot:a},e),!0}static cleanupPortalInfra(e){try{e.reactRoot?.unmount&&e.reactRoot.unmount()}catch(e){r.__DEBUG__&&console.error("Portal cleanup error:",e)}try{e.domElement?.isConnected&&e.domElement.remove()}catch(e){r.__DEBUG__&&console.error("DOM removal error:",e)}}}exports.NodeUtil=c;
@@ -1 +1 @@
1
- "use strict";var e=require("../helper/obj.helper.js"),t=require("../helper/common.helper.js");class s{static _instance=null;CACHE_SIZE_LIMIT=500;CACHE_EVICTION_BATCH_SIZE=50;_resolutionCache=new Map;_pathLookupCache=new Map;_themeRegex=/theme\.([a-zA-Z0-9_.-]+)/g;static getInstance(){return s._instance||(s._instance=new s),s._instance}getResolution(e,t){const s=this._generateCacheKey(e,t),r=this._resolutionCache.get(s);return r&&(this._resolutionCache.delete(s),this._resolutionCache.set(s,r)),r||null}setResolution(e,t,s){const r=this._generateCacheKey(e,t);this._resolutionCache.set(r,s),this._resolutionCache.size>this.CACHE_SIZE_LIMIT&&this._evict(this._resolutionCache)}getPathLookup(t,s){const r=`${e.ObjHelper.stringify(t)}_${s}`,n=this._pathLookupCache.get(r);return n&&(this._pathLookupCache.delete(r),this._pathLookupCache.set(r,n)),n??null}setPathLookup(t,s,r){const n=`${e.ObjHelper.stringify(t)}_${s}`;this._pathLookupCache.set(n,r),this._pathLookupCache.size>this.CACHE_SIZE_LIMIT&&this._evict(this._pathLookupCache)}getThemeRegex(){return this._themeRegex.lastIndex=0,this._themeRegex}shouldCache(){return"undefined"==typeof window}clear(){this._resolutionCache.clear(),this._pathLookupCache.clear()}_generateCacheKey(t,s){return`${e.ObjHelper.stringify(t)}_${s.mode}_${e.ObjHelper.stringify(s.system)}`}_evict(e){const t=e.keys();for(let s=0;s<this.CACHE_EVICTION_BATCH_SIZE;s++){const s=t.next().value;if(!s)break;e.delete(s)}}}class r{static themeCache=s.getInstance();constructor(){}static parseFlexShorthand(e){if(null==e)return null;if("number"==typeof e)return{grow:e,shrink:1,basis:"0%"};if("string"!=typeof e)return null;const t=e.trim().toLowerCase();if(!t)return null;switch(t){case"none":return{grow:0,shrink:0,basis:"auto"};case"auto":return{grow:1,shrink:1,basis:"auto"};case"initial":return{grow:0,shrink:1,basis:"auto"};default:return null}}static isPlainObject=e=>{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype};static resolveObjWithTheme=(e,s,n={})=>{const{processFunctions:i=!1}=n;if(!s||!s.system||"object"!=typeof s.system||0===Object.keys(s.system).length||!e||0===Object.keys(e).length)return e;const o=s.system;if(r.themeCache.shouldCache()){const t=r.themeCache.getResolution(e,s);if(null!==t)return t}const l=[{value:e,isProcessed:!1}],a=new Map,h=new Set,c=e=>{const s=r.themeCache.getThemeRegex();let n=!1;const i=e.replace(s,(e,s)=>{let i=r.themeCache.getPathLookup(o,s);if(null===i&&(i=t.getValueByPath(o,s),r.themeCache.setPathLookup(o,s,i)),null!=i){if(n=!0,"object"==typeof i){if(!Array.isArray(i)&&"default"in i)return i.default;throw new Error("The provided theme path is invalid!")}return i}return e});return n?i:e};for(;l.length>0;){const e=l[l.length-1],t=e.value;if(r.isPlainObject(t)||Array.isArray(t))if(a.has(t))l.pop();else if(e.isProcessed){l.pop(),h.delete(t);let e=t;if(Array.isArray(t)){let s=null;for(let e=0;e<t.length;e++){const r=t[e],n=a.get(r)??r;n!==r&&(null===s&&(s=[...t]),s[e]=n)}null!==s&&(e=s)}else{let r=null;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];let o=a.get(n)??n;if("function"==typeof o&&i){const e=o(s);o="string"==typeof e&&e.includes("theme.")?c(e):e}else"string"==typeof o&&o.includes("theme.")&&(o=c(o));o!==n&&(null===r&&(r={...t}),r[e]=o)}null!==r&&(e=r)}a.set(t,e)}else{e.isProcessed=!0,h.add(t);const s=Array.isArray(t)?t:Object.values(t);for(let e=s.length-1;e>=0;e--){const t=s[e];!r.isPlainObject(t)&&!Array.isArray(t)||h.has(t)||l.push({value:t,isProcessed:!1})}}else l.pop()}const u=a.get(e)??e;return r.themeCache.shouldCache()&&r.themeCache.setResolution(e,s,u),u};static clearThemeCache=()=>{r.themeCache.clear()};static resolveDefaultStyle=e=>{if(null==e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)return{};const{flex:t,...s}=e,n="flex"===s.display||"inline-flex"===s.display,i=!!(s.overflow||s.overflowY||s.overflowX),o=s.flexFlow?.includes("wrap")||"wrap"===s.flexWrap||"wrap-reverse"===s.flexWrap,l="flexShrink"in e&&void 0!==e.flexShrink,a=t?r.parseFlexShorthand(t):null;let h;if(!l)if(a)h=a.shrink;else if(n){if(!i){const e="column"===s.flexDirection||"column-reverse"===s.flexDirection,t="row"===s.flexDirection||"row-reverse"===s.flexDirection||!s.flexDirection;(e&&!o||t&&!o)&&(h=0)}}else h=0;return{flex:t,flexShrink:h,minHeight:0,minWidth:0,...s}}}exports.ThemeUtil=r;
1
+ "use strict";var e=require("../helper/common.helper.js");class t{constructor(){}static parseFlexShorthand(e){if(null==e)return null;if("number"==typeof e)return{grow:e,shrink:1,basis:"0%"};if("string"!=typeof e)return null;const t=e.trim().toLowerCase();if(!t)return null;switch(t){case"none":return{grow:0,shrink:0,basis:"auto"};case"auto":return{grow:1,shrink:1,basis:"auto"};case"initial":return{grow:0,shrink:1,basis:"auto"};default:return null}}static isPlainObject=e=>{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype};static resolveObjWithTheme=(r,l,s={})=>{const{processFunctions:n=!1}=s;if(!l||!l.system||"object"!=typeof l.system||0===Object.keys(l.system).length||!r||0===Object.keys(r).length)return r;const i=l.system,o=[{value:r,isProcessed:!1}],a=new Map,u=new Set,c=/theme\.([a-zA-Z0-9_.-]+)/g,f=t=>{c.lastIndex=0;let r=!1;const l=t.replace(c,(t,l)=>{const s=e.getValueByPath(i,l);if(null!=s){if(r=!0,"object"==typeof s){if(!Array.isArray(s)&&"default"in s)return s.default;throw new Error("The provided theme path is invalid!")}return s}return t});return r?l:t};for(;o.length>0;){const e=o[o.length-1],r=e.value;if(t.isPlainObject(r)||Array.isArray(r))if(a.has(r))o.pop();else if(e.isProcessed){o.pop(),u.delete(r);let e=r;if(Array.isArray(r)){let t=null;for(let e=0;e<r.length;e++){const l=r[e],s=a.get(l)??l;s!==l&&(null===t&&(t=[...r]),t[e]=s)}null!==t&&(e=t)}else{let t=null;for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e)){const s=r[e];let i=a.get(s)??s;if("function"==typeof i&&n){const e=i(l);i="string"==typeof e&&e.includes("theme.")?f(e):e}else"string"==typeof i&&i.includes("theme.")&&(i=f(i));i!==s&&(null===t&&(t={...r}),t[e]=i)}null!==t&&(e=t)}a.set(r,e)}else{e.isProcessed=!0,u.add(r);const l=Array.isArray(r)?r:Object.values(r);for(let e=l.length-1;e>=0;e--){const r=l[e];!t.isPlainObject(r)&&!Array.isArray(r)||u.has(r)||o.push({value:r,isProcessed:!1})}}else o.pop()}return a.get(r)??r};static resolveDefaultStyle=e=>{if(null==e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)return{};const{flex:r,...l}=e,s="flex"===l.display||"inline-flex"===l.display,n=!!(l.overflow||l.overflowY||l.overflowX),i=l.flexFlow?.includes("wrap")||"wrap"===l.flexWrap||"wrap-reverse"===l.flexWrap,o="flexShrink"in e&&void 0!==e.flexShrink,a=r?t.parseFlexShorthand(r):null;let u;if(!o)if(a)u=a.shrink;else if(s){if(!n){const e="column"===l.flexDirection||"column-reverse"===l.flexDirection,t="row"===l.flexDirection||"row-reverse"===l.flexDirection||!l.flexDirection;(e&&!i||t&&!i)&&(u=0)}}else u=0;return{flex:r,flexShrink:u,minHeight:0,minWidth:0,...l}}}exports.ThemeUtil=t;
@@ -1 +1 @@
1
- {"version":3,"file":"meonode-unmounter.client.d.ts","sourceRoot":"","sources":["../../../src/components/meonode-unmounter.client.ts"],"names":[],"mappings":"AACA,OAAO,EAAgC,KAAK,SAAS,EAA6B,MAAM,OAAO,CAAA;AAG/F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE3D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,SAAS,CAsCxH"}
1
+ {"version":3,"file":"meonode-unmounter.client.d.ts","sourceRoot":"","sources":["../../../src/components/meonode-unmounter.client.ts"],"names":[],"mappings":"AACA,OAAO,EAAgC,KAAK,SAAS,EAA6B,MAAM,OAAO,CAAA;AAG/F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE3D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,SAAS,CA0CxH"}
@@ -2,7 +2,7 @@ import { type ReactNode } from 'react';
2
2
  import type { Children, Theme } from '../types/node.type.js';
3
3
  export interface ThemeContextValue {
4
4
  theme: Theme;
5
- setTheme: (theme: Theme) => void;
5
+ setTheme: (theme: Theme | ((theme: Theme) => Theme)) => void;
6
6
  }
7
7
  export declare const ThemeContext: import("react").Context<ThemeContextValue | null>;
8
8
  /**
@@ -11,7 +11,6 @@ export declare const ThemeContext: import("react").Context<ThemeContextValue | n
11
11
  * @param {Children} [props.children] The children to render.
12
12
  * @param {Theme} props.theme The theme to provide.
13
13
  * @returns {ReactNode} The rendered component.
14
- * @private
15
14
  */
16
15
  export default function ThemeProvider({ children, theme }: {
17
16
  children?: Children;
@@ -1 +1 @@
1
- {"version":3,"file":"theme-provider.client.d.ts","sourceRoot":"","sources":["../../../src/components/theme-provider.client.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,SAAS,EAAY,MAAM,OAAO,CAAA;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAG9D,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,KAAK,CAAA;IACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;CACjC;AAED,eAAO,MAAM,YAAY,mDAAgD,CAAA;AAEzE;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GAAG,SAAS,CAgB3G"}
1
+ {"version":3,"file":"theme-provider.client.d.ts","sourceRoot":"","sources":["../../../src/components/theme-provider.client.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,SAAS,EAAY,MAAM,OAAO,CAAA;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAG9D,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,KAAK,CAAA;IACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,KAAK,CAAC,KAAK,IAAI,CAAA;CAC7D;AAED,eAAO,MAAM,YAAY,mDAAgD,CAAA;AAEzE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GAAG,SAAS,CAmB3G"}
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{createContext as e,useState as r}from"react";import{Node as o}from"../core.node.js";const t=e(null);function n({children:e,theme:n}){const[m,c]=r(n);if(!n)throw new Error("`theme` prop must be defined");const d={theme:m,setTheme:e=>{document.cookie=`theme=${e.mode}; path=/;`,c(e)}};return o(t.Provider,{value:d,children:e}).render()}export{t as ThemeContext,n as default};
2
+ import{createContext as e,useState as o}from"react";import{Node as t}from"../core.node.js";const r=e(null);function n({children:e,theme:n}){const[m,c]=o(n);if(!n)throw new Error("`theme` prop must be defined");const d={theme:m,setTheme:e=>{"function"==typeof e&&(e=e(m)),document.cookie=`theme=${e.mode}; path=/;`,c(e)}};return t(r.Provider,{value:d,children:e}).render()}export{r as ThemeContext,n as default};
@@ -1,11 +1,10 @@
1
1
  import { type ReactElement } from 'react';
2
- import type { Children, DependencyList, ElementCacheEntry, FinalNodeProps, HasRequiredProps, MergedProps, NodeElementType, NodeInstance, NodePortal, NodeProps, PropProcessingCache, PropsOf } from './types/node.type.js';
2
+ import type { Children, DependencyList, ElementCacheEntry, FinalNodeProps, HasRequiredProps, MergedProps, NodeElementType, NodeInstance, NodePortal, NodeProps, PropsOf } from './types/node.type.js';
3
3
  /**
4
4
  * The core abstraction of the MeoNode library. It wraps a React element or component,
5
5
  * providing a unified interface for processing props, normalizing children, and handling styles.
6
6
  * This class is central to the library's ability to offer a JSX-free, fluent API for building UIs.
7
7
  * It uses an iterative rendering approach to handle deeply nested structures without causing stack overflows.
8
- * @class BaseNode
9
8
  * @template E - The type of React element or component this node represents.
10
9
  */
11
10
  export declare class BaseNode<E extends NodeElementType = NodeElementType> {
@@ -18,11 +17,10 @@ export declare class BaseNode<E extends NodeElementType = NodeElementType> {
18
17
  stableKey?: string;
19
18
  lastPropsObj?: Record<string, unknown>;
20
19
  lastSignature?: string;
21
- static elementCache: Map<string, ElementCacheEntry>;
22
- static propProcessingCache: Map<string, PropProcessingCache>;
23
- static scheduledCleanup: boolean;
24
- private static _navigationStarted;
25
- private static renderContextPool;
20
+ static get elementCache(): Map<string, ElementCacheEntry>;
21
+ private static get _navigationStarted();
22
+ private static set _navigationStarted(value);
23
+ private static get renderContextPool();
26
24
  private static acquireRenderContext;
27
25
  private static releaseRenderContext;
28
26
  constructor(element: E, rawProps?: Partial<NodeProps<E>>, deps?: DependencyList);
@@ -63,7 +61,7 @@ export declare class BaseNode<E extends NodeElementType = NodeElementType> {
63
61
  * entry from `BaseNode.elementCache`.
64
62
  * @public
65
63
  */
66
- static cacheCleanupRegistry: FinalizationRegistry<{
64
+ static get cacheCleanupRegistry(): FinalizationRegistry<{
67
65
  cacheKey: string;
68
66
  instanceId: string;
69
67
  }>;
@@ -80,9 +78,9 @@ export declare class BaseNode<E extends NodeElementType = NodeElementType> {
80
78
  * 2. Remove the `domElement` from the DOM if it is still connected.
81
79
  *
82
80
  * This prevents detached portal containers from leaking memory in long-running client apps.
83
- * @private
81
+ * @internal
84
82
  */
85
- static portalCleanupRegistry: FinalizationRegistry<{
83
+ static get portalCleanupRegistry(): FinalizationRegistry<{
86
84
  domElement: HTMLDivElement;
87
85
  reactRoot: {
88
86
  unmount(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../../src/core.node.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,YAAY,EAElB,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,WAAW,EAEX,eAAe,EACf,YAAY,EACZ,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,OAAO,EAER,MAAM,yBAAyB,CAAA;AAWhC;;;;;;;GAOG;AACH,qBAAa,QAAQ,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe;IACxD,UAAU,EAAE,MAAM,CAAgE;IAElF,OAAO,EAAE,CAAC,CAAA;IACV,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAK;IAC3C,SAAgB,UAAU,UAAO;IAEjC,OAAO,CAAC,MAAM,CAAC,CAAgB;IAC/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAgB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;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AAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzE,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,UAAU,CAAC,EACxD,IAAI,CAAC,EAAE,cAAc,KAClB,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,GACtC,CAAC,CAAC,eAAe,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzE,QAAQ,CAAC,EAAE,QAAQ,EACnB,KAAK,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,UAAU,CAAC,EACzD,IAAI,CAAC,EAAE,cAAc,KAClB,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,CAQzC"}
@@ -1 +1 @@
1
- import{isValidElement as e,Fragment as t,createElement as n}from"react";import{isValidElementType as r,isFragment as o}from"./helper/react-is.helper.js";import{getComponentType as s,hasNoStyleTag as a,getElementTypeName as l}from"./helper/common.helper.js";import c from"./components/styled-renderer.client.js";import{__DEBUG__ as i}from"./constant/common.const.js";import{MountTrackerUtil as d}from"./util/mount-tracker.util.js";import h from"./components/meonode-unmounter.client.js";import{NavigationCacheManagerUtil as p}from"./util/navigation-cache-manager.util.js";import{NodeUtil as u}from"./util/node.util.js";import{ThemeUtil as m}from"./util/theme.util.js";class g{instanceId=Math.random().toString(36).slice(2)+Date.now().toString(36);element;rawProps={};isBaseNode=!0;_props;_deps;stableKey;lastPropsObj;lastSignature;static elementCache=new Map;static propProcessingCache=new Map;static scheduledCleanup=!1;static _navigationStarted=!1;static renderContextPool=[];static acquireRenderContext(){const e=g.renderContextPool;return e.length>0?e.pop():{workStack:new Array(512),renderedElements:new Map}}static releaseRenderContext(e){g.renderContextPool.length<50&&e.workStack.length<2048&&(e.workStack.length=0,e.renderedElements.clear(),g.renderContextPool.push(e))}constructor(e,t={},n){if(!r(e)){const t=s(e);throw new Error(`Invalid element type: ${t} provided!`)}this.element=e,this.rawProps=t,this._deps=n;const{ref:o,children:a,...l}=t;this.stableKey=this._getStableKey(l),u.isServer||g._navigationStarted||(p.getInstance().start(),g._navigationStarted=!0)}get props(){return this._props||(this._props=u.processProps(this.element,this.rawProps,this.stableKey)),this._props}get dependencies(){return this._deps}_getStableKey({key:e,...t}){if(u.isServer)return;if(this.lastPropsObj===t)return this.lastSignature;this.lastPropsObj=t;const n=Object.keys(t),r=n.length;if(r>100){const e=u.extractCriticalProps(t,n);this.lastSignature=u.createPropSignature(this.element,e),i&&r>200&&console.warn(`MeoNode: Large props (${r} keys) on "${l(this.element)}". Consider splitting.`)}else this.lastSignature=u.createPropSignature(this.element,t);return null!=e?`${String(e)}:${this.lastSignature}`:this.lastSignature}static cacheCleanupRegistry=new FinalizationRegistry(e=>{const{cacheKey:t,instanceId:n}=e,r=g.elementCache.get(t);r?.instanceId===n&&g.elementCache.delete(t),d.isMounted(t)&&d.untrackMount(t)});static portalCleanupRegistry=new FinalizationRegistry(e=>{const{domElement:t,reactRoot:n}=e;i&&console.log("[MeoNode] FinalizationRegistry auto-cleaning portal");try{n&&"function"==typeof n.unmount&&n.unmount()}catch(e){i&&console.error("[MeoNode] Portal auto-cleanup unmount error:",e)}try{t?.isConnected&&t.remove()}catch(e){i&&console.error("[MeoNode] Portal auto-cleanup DOM removal error:",e)}});render(r=!1){const s=u.shouldCacheElement(this)?g.elementCache.get(this.stableKey):void 0,l=u.shouldNodeUpdate(s?.prevDeps,this._deps,r);if(!l&&s?.renderedElement)return s.accessCount+=1,s.renderedElement;const i=!l,d=g.acquireRenderContext();let{workStack:p}=d;const{renderedElements:m}=d;let f=0;try{const r=e=>{if(e>p.length){const t=Math.max(e,p.length<<1),n=new Array(t);for(let e=0;e<f;e++)n[e]=p[e];p=n}};for(p[f++]={node:this,isProcessed:!1,blocked:i};f>0;){const s=p[f-1];if(!s){f--;continue}const{node:l,isProcessed:i,blocked:d}=s;if(i){f--;const{children:r,key:s,css:i,nativeProps:d,disableEmotion:h,...p}=l.props;let y=[];if(r){const t=Array.isArray(r)?r:[r],n=t.length;y=new Array(n);for(let r=0;r<n;r++){const n=t[r];if(u.isNodeInstance(n)){const e=m.get(n);if(!e)throw new Error(`[MeoNode] Missing rendered element for child node: ${n.stableKey}`);y[r]=e}else e(n),y[r]=n}}const C={...p,key:s,...d};let w;if(l.element===t||o(l.element))w=n(l.element,{key:s},...y);else{w=!h&&(i||!a(l.element))?n(c,{element:l.element,...C,css:i,suppressHydrationWarning:!0},...y):n(l.element,C,...y)}if(l!==this&&u.shouldCacheElement(l)){const e=g.elementCache.get(l.stableKey);if(e)e.prevDeps=l._deps,e.renderedElement=w,e.accessCount+=1;else{const e={prevDeps:l._deps,renderedElement:w,nodeRef:new WeakRef(l),createdAt:Date.now(),accessCount:1,instanceId:l.instanceId};g.elementCache.set(l.stableKey,e),g.cacheCleanupRegistry.register(l,{cacheKey:l.stableKey,instanceId:l.instanceId},l)}}m.set(l,w)}else{s.isProcessed=!0;const e=l.props.children;if(e){const t=(Array.isArray(e)?e:[e]).filter(u.isNodeInstance);r(f+t.length);for(let e=t.length-1;e>=0;e--){const n=t[e],r=u.shouldCacheElement(n)?g.elementCache.get(n.stableKey):void 0,o=u.shouldNodeUpdate(r?.prevDeps,n._deps,d);if(!o&&r?.renderedElement){m.set(n,r.renderedElement);continue}const s=d||!o;p[f++]={node:n,isProcessed:!1,blocked:s}}}}}let s=m.get(this);if(!u.isServer&&this.stableKey&&(s=n(h,{node:this},s)),u.shouldCacheElement(this)){const e=g.elementCache.get(this.stableKey);if(e)e.prevDeps=this._deps,e.renderedElement=s,e.accessCount+=1;else{const e={prevDeps:this._deps,renderedElement:s,nodeRef:new WeakRef(this),createdAt:Date.now(),accessCount:1,instanceId:this.instanceId};g.elementCache.set(this.stableKey,e),g.cacheCleanupRegistry.register(this,{cacheKey:this.stableKey,instanceId:this.instanceId},this)}}return s}finally{for(let e=0;e<f;e++)p[e]=null;g.releaseRenderContext({workStack:p,renderedElements:m})}}toPortal(){if(!u.ensurePortalInfrastructure(this))throw new Error("toPortal() can only be called in a client-side environment");const e=u.portalInfrastructure.get(this),{domElement:t,reactRoot:n}=e;(()=>{try{n.render(this.render())}catch(e){i&&console.error("[MeoNode] Portal render error:",e)}})();let r=!1;const o=n.unmount.bind(n);return n.update=e=>{if(r)i&&console.warn("[MeoNode] Attempt to update already-unmounted portal");else try{const t=u.isNodeInstance(e)?e.render():e;n.render(t)}catch(e){i&&console.error("[MeoNode] Portal update error:",e)}},n.unmount=()=>{if(r)i&&console.warn("[MeoNode] Portal already unmounted");else{r=!0;try{g.portalCleanupRegistry.unregister(this)}catch(e){i&&console.warn("[MeoNode] Portal unregister warning:",e)}u.portalInfrastructure.delete(this);try{t?.isConnected&&o()}catch(e){i&&console.error("[MeoNode] Portal unmount error:",e)}try{t?.isConnected&&t.remove()}catch(e){i&&console.error("[MeoNode] Portal DOM cleanup error:",e)}}},n}static clearCaches(){const e=Array.from(g.elementCache.keys());i&&console.log(`[MeoNode] clearCaches: Clearing ${e.length} entries`);for(const t of e){const e=g.elementCache.get(t);if(e){const n=e.nodeRef?.deref();if(n)try{g.cacheCleanupRegistry.unregister(n),n.lastSignature=void 0,n.lastPropsObj=void 0}catch{i&&console.warn(`[MeoNode] Could not unregister ${t} from FinalizationRegistry`)}}}g.propProcessingCache.clear(),g.elementCache.clear(),m.clearThemeCache(),d.cleanup(),i&&console.log("[MeoNode] All caches cleared")}}function f(e,t={},n){return new g(e,t,n)}function y(e,t){const n=(n,r)=>f(e,{...t,...n},r);return n.element=e,n}function C(e,t){const n=(n,r,o)=>f(e,{...t,...r,children:n},o);return n.element=e,n}f.clearCaches=g.clearCaches;export{g as BaseNode,f as Node,C as createChildrenFirstNode,y as createNode};
1
+ import{isValidElement as e,Fragment as t,createElement as n}from"react";import{isValidElementType as r,isFragment as o}from"./helper/react-is.helper.js";import{getGlobalState as s,getComponentType as a,hasNoStyleTag as l,getElementTypeName as i}from"./helper/common.helper.js";import c from"./components/styled-renderer.client.js";import{__DEBUG__ as d}from"./constant/common.const.js";import{MountTrackerUtil as h}from"./util/mount-tracker.util.js";import u from"./components/meonode-unmounter.client.js";import{NavigationCacheManagerUtil as m}from"./util/navigation-cache-manager.util.js";import{NodeUtil as p}from"./util/node.util.js";const g=Symbol.for("@meonode/ui/BaseNode/elementCache"),y=Symbol.for("@meonode/ui/BaseNode/navigationStarted"),f=Symbol.for("@meonode/ui/BaseNode/renderContextPool"),C=Symbol.for("@meonode/ui/BaseNode/cacheCleanupRegistry"),w=Symbol.for("@meonode/ui/BaseNode/portalCleanupRegistry");class P{instanceId=Math.random().toString(36).slice(2)+Date.now().toString(36);element;rawProps={};isBaseNode=!0;_props;_deps;stableKey;lastPropsObj;lastSignature;static get elementCache(){return s(g,()=>new Map)}static get _navigationStarted(){return s(y,()=>({value:!1})).value}static set _navigationStarted(e){s(y,()=>({value:!1})).value=e}static get renderContextPool(){return s(f,()=>[])}static acquireRenderContext(){const e=P.renderContextPool;return e.length>0?e.pop():{workStack:new Array(512),renderedElements:new Map}}static releaseRenderContext(e){P.renderContextPool.length<50&&e.workStack.length<2048&&(e.workStack.length=0,e.renderedElements.clear(),P.renderContextPool.push(e))}constructor(e,t={},n){if(!r(e)){const t=a(e);throw new Error(`Invalid element type: ${t} provided!`)}this.element=e,this.rawProps=t,this._deps=n;const{ref:o,children:s,...l}=t;this.stableKey=this._getStableKey(l),p.isServer||P._navigationStarted||(m.getInstance().start(),P._navigationStarted=!0)}get props(){return this._props||(this._props=p.processProps(this.element,this.rawProps,this.stableKey)),this._props}get dependencies(){return this._deps}_getStableKey({key:e,...t}){if(p.isServer)return;if(this.lastPropsObj===t)return this.lastSignature;this.lastPropsObj=t;const n=Object.keys(t),r=n.length;if(r>100){const e=p.extractCriticalProps(t,n);this.lastSignature=p.createPropSignature(this.element,e),d&&r>200&&console.warn(`MeoNode: Large props (${r} keys) on "${i(this.element)}". Consider splitting.`)}else this.lastSignature=p.createPropSignature(this.element,t);return null!=e?`${String(e)}:${this.lastSignature}`:this.lastSignature}static get cacheCleanupRegistry(){return s(C,()=>new FinalizationRegistry(e=>{const{cacheKey:t,instanceId:n}=e,r=P.elementCache.get(t);r?.instanceId===n&&P.elementCache.delete(t),h.isMounted(t)&&h.untrackMount(t)}))}static get portalCleanupRegistry(){return s(w,()=>new FinalizationRegistry(e=>{const{domElement:t,reactRoot:n}=e;d&&console.log("[MeoNode] FinalizationRegistry auto-cleaning portal");try{n&&"function"==typeof n.unmount&&n.unmount()}catch(e){d&&console.error("[MeoNode] Portal auto-cleanup unmount error:",e)}try{t?.isConnected&&t.remove()}catch(e){d&&console.error("[MeoNode] Portal auto-cleanup DOM removal error:",e)}}))}render(r=!1){const s=p.shouldCacheElement(this)?P.elementCache.get(this.stableKey):void 0,a=p.shouldNodeUpdate(s?.prevDeps,this._deps,r);if(!a&&s?.renderedElement)return s.accessCount+=1,s.renderedElement;const i=!a,d=P.acquireRenderContext();let{workStack:h}=d;const{renderedElements:m}=d;let g=0;try{const r=e=>{if(e>h.length){const t=Math.max(e,h.length<<1),n=new Array(t);for(let e=0;e<g;e++)n[e]=h[e];h=n}};for(h[g++]={node:this,isProcessed:!1,blocked:i};g>0;){const s=h[g-1];if(!s){g--;continue}const{node:a,isProcessed:i,blocked:d}=s;if(i){g--;const{children:r,key:s,css:i,nativeProps:d,disableEmotion:h,...u}=a.props;let y=[];if(r){const t=Array.isArray(r)?r:[r],n=t.length;y=new Array(n);for(let r=0;r<n;r++){const n=t[r];if(p.isNodeInstance(n)){const e=m.get(n);if(!e)throw new Error(`[MeoNode] Missing rendered element for child node: ${n.stableKey}`);y[r]=e}else e(n),y[r]=n}}const f={...u,key:s,...d};let C;if(a.element===t||o(a.element))C=n(a.element,{key:s},...y);else{C=!h&&(i||!l(a.element))?n(c,{element:a.element,...f,css:i,suppressHydrationWarning:!0},...y):n(a.element,f,...y)}if(a!==this&&p.shouldCacheElement(a)){const e=P.elementCache.get(a.stableKey);if(e)e.prevDeps=a._deps,e.renderedElement=C,e.accessCount+=1;else{const e={prevDeps:a._deps,renderedElement:C,nodeRef:new WeakRef(a),createdAt:Date.now(),accessCount:1,instanceId:a.instanceId};P.elementCache.set(a.stableKey,e),P.cacheCleanupRegistry.register(a,{cacheKey:a.stableKey,instanceId:a.instanceId},a)}}m.set(a,C)}else{s.isProcessed=!0;const e=a.props.children;if(e){const t=(Array.isArray(e)?e:[e]).filter(p.isNodeInstance);r(g+t.length);for(let e=t.length-1;e>=0;e--){const n=t[e],r=p.shouldCacheElement(n)?P.elementCache.get(n.stableKey):void 0,o=p.shouldNodeUpdate(r?.prevDeps,n._deps,d);if(!o&&r?.renderedElement){m.set(n,r.renderedElement);continue}const s=d||!o;h[g++]={node:n,isProcessed:!1,blocked:s}}}}}let s=m.get(this);if(!p.isServer&&this.stableKey&&(s=n(u,{node:this},s)),p.shouldCacheElement(this)){const e=P.elementCache.get(this.stableKey);if(e)e.prevDeps=this._deps,e.renderedElement=s,e.accessCount+=1;else{const e={prevDeps:this._deps,renderedElement:s,nodeRef:new WeakRef(this),createdAt:Date.now(),accessCount:1,instanceId:this.instanceId};P.elementCache.set(this.stableKey,e),P.cacheCleanupRegistry.register(this,{cacheKey:this.stableKey,instanceId:this.instanceId},this)}}return s}finally{for(let e=0;e<g;e++)h[e]=null;P.releaseRenderContext({workStack:h,renderedElements:m})}}toPortal(){if(!p.ensurePortalInfrastructure(this))throw new Error("toPortal() can only be called in a client-side environment");const e=p.portalInfrastructure.get(this),{domElement:t,reactRoot:n}=e;(()=>{try{n.render(this.render())}catch(e){d&&console.error("[MeoNode] Portal render error:",e)}})();let r=!1;const o=n.unmount.bind(n);return n.update=e=>{if(r)d&&console.warn("[MeoNode] Attempt to update already-unmounted portal");else try{const t=p.isNodeInstance(e)?e.render():e;n.render(t)}catch(e){d&&console.error("[MeoNode] Portal update error:",e)}},n.unmount=()=>{if(r)d&&console.warn("[MeoNode] Portal already unmounted");else{r=!0;try{P.portalCleanupRegistry.unregister(this)}catch(e){d&&console.warn("[MeoNode] Portal unregister warning:",e)}p.portalInfrastructure.delete(this);try{t?.isConnected&&o()}catch(e){d&&console.error("[MeoNode] Portal unmount error:",e)}try{t?.isConnected&&t.remove()}catch(e){d&&console.error("[MeoNode] Portal DOM cleanup error:",e)}}},n}static clearCaches(){const e=Array.from(P.elementCache.keys());d&&console.log(`[MeoNode] clearCaches: Clearing ${e.length} entries`);for(const t of e){const e=P.elementCache.get(t);if(e){const n=e.nodeRef?.deref();if(n)try{P.cacheCleanupRegistry.unregister(n),n.lastSignature=void 0,n.lastPropsObj=void 0}catch{d&&console.warn(`[MeoNode] Could not unregister ${t} from FinalizationRegistry`)}}}P.elementCache.clear(),h.cleanup(),d&&console.log("[MeoNode] All caches cleared")}}function S(e,t={},n){return new P(e,t,n)}function b(e,t){const n=(n,r)=>S(e,{...t,...n},r);return n.element=e,n}function v(e,t){const n=(n,r,o)=>S(e,{...t,...r,children:n},o);return n.element=e,n}S.clearCaches=P.clearCaches;export{P as BaseNode,S as Node,v as createChildrenFirstNode,b as createNode};
@@ -1,5 +1,14 @@
1
1
  import type { FinalNodeProps, NodeElement, NodeInstance } from '../types/node.type.js';
2
2
  import type { ComponentProps, CSSProperties, ElementType } from 'react';
3
+ /**
4
+ * Retrieves or initializes a global state value using a Symbol key.
5
+ * This ensures singleton behavior across multiple bundles or module reloads,
6
+ * and protects against property name mangling during obfuscation.
7
+ * @param key The Symbol key to use for the global state.
8
+ * @param factory A factory function to create the initial value if it doesn't exist.
9
+ * @returns The global state value.
10
+ */
11
+ export declare function getGlobalState<T>(key: symbol, factory: () => T): T;
3
12
  /**
4
13
  * Retrieves a deeply nested value from an object using a dot-separated string path.
5
14
  *
@@ -1 +1 @@
1
- {"version":3,"file":"common.helper.d.ts","sourceRoot":"","sources":["../../../src/helper/common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1F;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAQlE"}
@@ -1 +1 @@
1
- import{isForwardRef as e,isMemo as t,isFragment as n,isPortal as r,isProfiler as o,isStrictMode as s,isSuspense as c,isSuspenseList as p,isContextConsumer as a,isContextProvider as i,isLazy as u,isElement as m,isReactClassComponent as l}from"./react-is.helper.js";import y from"../constant/css-properties.const.js";import{noStyleTagsSet as f}from"../constant/common.const.js";const d=(e,t)=>t.split(".").reduce((e,t)=>e&&void 0!==e[t]?e[t]:void 0,e),C=y=>e(y)?"forwardRef":t(y)?"memo":n(y)?"fragment":r(y)?"portal":o(y)?"profiler":s(y)?"strict-mode":c(y)?"suspense":p(y)?"suspense-list":a(y)?"context-consumer":i(y)?"context-provider":u(y)?"lazy":m(y)?"element":l(y)?"class":typeof y;function w(e){function t(e,t){const n=e?.displayName||e?.name;return n&&"render"!==n?n:t}if(null==e)return"UnknownElementType";const n=e,r=C(n);switch(r){case"string":return e;case"class":return t(n,"ClassComponent");case"function":return t(n,"AnonymousFunctionComponent");case"forwardRef":return t(n,"")||t(n.render,"")||"ForwardRefComponent";case"memo":return t(n,"")||(n.type?w(n.type):"MemoComponent");case"element":return w(n.type);case"fragment":return"Fragment";case"portal":return"Portal";case"profiler":return t(n,"Profiler");case"strict-mode":return"StrictMode";case"suspense":return t(n,"Suspense");case"suspense-list":return"SuspenseList";case"context-consumer":return n._context?.displayName?`${n._context.displayName}.Consumer`:"ContextConsumer";case"context-provider":return n._context?.displayName?`${n._context.displayName}.Provider`:"ContextProvider";case"lazy":return t(n,"LazyComponent");case"object":return t(n,"")?t(n,""):"function"==typeof n.render?t(n.render,"ObjectWithRender"):n.type&&n.type!==e?`Wrapped<${w(n.type)}>`:t(n,"ObjectComponent");case"symbol":return"symbol"==typeof e?e.description?.replace(/^react\./,"").split(".").map(e=>e[0]?.toUpperCase()+e.slice(1)).join("")||e.toString():"SymbolComponent";case"unknown":return"UnknownElementType";default:return`UnsupportedType<${r}>`}}const x=new Set(y);function j(e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&x.has(n)&&(t[n]=e[n]);return t}function b(e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&!x.has(n)&&(t[n]=e[n]);return t}function h(e){return!(!e||"string"!=typeof e)&&f.has(e.toLowerCase())}function O(e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&void 0!==e[n]&&(t[n]=e[n]);return t}export{x as CSSPropertySet,j as getCSSProps,C as getComponentType,b as getDOMProps,w as getElementTypeName,d as getValueByPath,h as hasNoStyleTag,O as omitUndefined};
1
+ import{isForwardRef as e,isMemo as t,isFragment as n,isPortal as r,isProfiler as o,isStrictMode as s,isSuspense as c,isSuspenseList as p,isContextConsumer as a,isContextProvider as i,isLazy as u,isElement as l,isReactClassComponent as m}from"./react-is.helper.js";import f from"../constant/css-properties.const.js";import{noStyleTagsSet as d}from"../constant/common.const.js";function y(e,t){const n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{};return Object.prototype.hasOwnProperty.call(n,e)||(n[e]=t()),n[e]}const w=(e,t)=>t.split(".").reduce((e,t)=>e&&void 0!==e[t]?e[t]:void 0,e),b=f=>e(f)?"forwardRef":t(f)?"memo":n(f)?"fragment":r(f)?"portal":o(f)?"profiler":s(f)?"strict-mode":c(f)?"suspense":p(f)?"suspense-list":a(f)?"context-consumer":i(f)?"context-provider":u(f)?"lazy":l(f)?"element":m(f)?"class":typeof f;function C(e){function t(e,t){const n=e?.displayName||e?.name;return n&&"render"!==n?n:t}if(null==e)return"UnknownElementType";const n=e,r=b(n);switch(r){case"string":return e;case"class":return t(n,"ClassComponent");case"function":return t(n,"AnonymousFunctionComponent");case"forwardRef":return t(n,"")||t(n.render,"")||"ForwardRefComponent";case"memo":return t(n,"")||(n.type?C(n.type):"MemoComponent");case"element":return C(n.type);case"fragment":return"Fragment";case"portal":return"Portal";case"profiler":return t(n,"Profiler");case"strict-mode":return"StrictMode";case"suspense":return t(n,"Suspense");case"suspense-list":return"SuspenseList";case"context-consumer":return n._context?.displayName?`${n._context.displayName}.Consumer`:"ContextConsumer";case"context-provider":return n._context?.displayName?`${n._context.displayName}.Provider`:"ContextProvider";case"lazy":return t(n,"LazyComponent");case"object":return t(n,"")?t(n,""):"function"==typeof n.render?t(n.render,"ObjectWithRender"):n.type&&n.type!==e?`Wrapped<${C(n.type)}>`:t(n,"ObjectComponent");case"symbol":return"symbol"==typeof e?e.description?.replace(/^react\./,"").split(".").map(e=>e[0]?.toUpperCase()+e.slice(1)).join("")||e.toString():"SymbolComponent";case"unknown":return"UnknownElementType";default:return`UnsupportedType<${r}>`}}const h=new Set(f);function j(e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&h.has(n)&&(t[n]=e[n]);return t}function x(e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&!h.has(n)&&(t[n]=e[n]);return t}function g(e){return!(!e||"string"!=typeof e)&&d.has(e.toLowerCase())}function O(e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&void 0!==e[n]&&(t[n]=e[n]);return t}export{h as CSSPropertySet,j as getCSSProps,b as getComponentType,x as getDOMProps,C as getElementTypeName,y as getGlobalState,w as getValueByPath,g as hasNoStyleTag,O as omitUndefined};
@@ -35,15 +35,6 @@ export type NodeElementType = ElementType | (ExoticComponent & {
35
35
  }) | (<TProps extends Record<string, any> | undefined>(props: ComponentNodeProps<TProps>) => ComponentNode);
36
36
  /** A single NodeElement or an array of NodeElements */
37
37
  export type Children = NodeElement | NodeElement[];
38
- /**
39
- * Cache for prop processing results to avoid repeated computations
40
- */
41
- export interface PropProcessingCache {
42
- cssProps: Record<string, any>;
43
- signature: string;
44
- lastAccess: number;
45
- hitCount: number;
46
- }
47
38
  /**
48
39
  * Represents an entry in the element cache.
49
40
  * Stores the rendered React element and its previous dependencies for memoization.
@@ -1 +1 @@
1
- {"version":3,"file":"node.type.d.ts","sourceRoot":"","sources":["../../../src/types/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,+BAA+B,CAAA;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAI5C,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,gBAAgB,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,GAAG,IAAI,CAAA;AAE9E;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,EAAE,CAAA;AAE3C,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED;;;GAGG;AACH,MAAM,MAAM,uBAAuB,CAAC,CAAC,IACnC,CAAC,SAAS,eAAe,CAAC,aAAa,CAAC,GAAG,IAAI,GAAG,CAAC,SAAS,eAAe,CAAC,aAAa,CAAC,GAAG,IAAI,GAAG,CAAC,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MAAM,EAAE,GAAG,CAAC,IAAI,CAC5E,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAA;CAAE,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,KAC5E,UAAU,CAAA;AAEf;;;;;GAKG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,EAAE,eAAe,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,eAAe,EAAE,MAAM,eAAe,CAAC,GACvJ,eAAe,CAAA;AAEjB,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,YAAY,CAAA;IAClB,WAAW,EAAE,OAAO,CAAA;IACpB,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;CACnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"navigation-cache-manager.util.d.ts","sourceRoot":"","sources":["../../../src/util/navigation-cache-manager.util.ts"],"names":[],"mappings":"AAIA,OAAO,CAAC,MAAM,CAAC,CAAC;IACd,UAAU,MAAM;QACd,4BAA4B,CAAC,EAAE,OAAO,CAAA;KACvC;CACF;AAED;;GAEG;AACH,qBAAa,0BAA0B;IACrC,OAAO,eAAiB;IAExB,OAAO,CAAC,MAAM,CAAC,SAAS,CAA0C;IAClE,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAwC;IACzE,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAA2C;IAC/E,OAAO,CAAC,MAAM,CAAC,UAAU,CAAQ;IAEjC,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,eAAe,CAA8B;IAErD,OAAc,WAAW,IAAI,0BAA0B,CAKtD;IAED;;OAEG;IACI,KAAK,SAaX;IAED;;;OAGG;IACH,OAAO,CAAC,KAAK;IAkBb;;OAEG;IACH,OAAO,CAAC,iBAAiB,CA4BxB;IAED;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAmB5B;;;OAGG;IACH,OAAO,CAAC,iBAAiB;CAW1B"}
1
+ {"version":3,"file":"navigation-cache-manager.util.d.ts","sourceRoot":"","sources":["../../../src/util/navigation-cache-manager.util.ts"],"names":[],"mappings":"AAIA,OAAO,CAAC,MAAM,CAAC,CAAC;IACd,UAAU,MAAM;QACd,4BAA4B,CAAC,EAAE,OAAO,CAAA;KACvC;CACF;AAED;;GAEG;AACH,qBAAa,0BAA0B;IACrC,OAAO,eAAiB;IAExB,OAAO,CAAC,MAAM,CAAC,SAAS,CAA0C;IAClE,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAwC;IACzE,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAA2C;IAC/E,OAAO,CAAC,MAAM,CAAC,UAAU,CAAQ;IAEjC,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,eAAe,CAA8B;IAErD,OAAc,WAAW,IAAI,0BAA0B,CAKtD;IAED;;OAEG;IACI,KAAK,SAaX;IAED;;;OAGG;IACH,OAAO,CAAC,KAAK;IAkBb;;OAEG;IACH,OAAO,CAAC,iBAAiB,CAsBxB;IAED;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAmB5B;;;OAGG;IACH,OAAO,CAAC,iBAAiB;CAW1B"}
@@ -1 +1 @@
1
- import{__DEBUG__ as t}from"../constant/common.const.js";import{BaseNode as e}from"../core.node.js";import{MountTrackerUtil as i}from"./mount-tracker.util.js";class n{constructor(){}static _instance=null;static _originalPushState=null;static _originalReplaceState=null;static _isPatched=!1;_isListening=!1;_cleanupTimeout=null;static getInstance(){return this._instance||(this._instance=new n),this._instance}start(){this._isListening||"undefined"==typeof window||(this._isListening=!0,window.addEventListener("popstate",this._handleNavigation),this._patchHistoryMethods(),this._setupAutoCleanup(),t&&console.log("[MeoNode] NavigationCacheManagerUtil started"))}_stop(){this._isListening&&"undefined"!=typeof window&&(window.removeEventListener("popstate",this._handleNavigation),this._cleanupTimeout&&(clearTimeout(this._cleanupTimeout),this._cleanupTimeout=null),this._isListening=!1,t&&console.log("[MeoNode] NavigationCacheManagerUtil stopped"))}_handleNavigation=()=>{this._cleanupTimeout&&clearTimeout(this._cleanupTimeout);const n=e.elementCache.size,a=n<100?50:n<500?100:200;this._cleanupTimeout=setTimeout(()=>{const n=e.propProcessingCache.size;let a=0;e.elementCache.keys().forEach(t=>{i.isMounted(t)||(e.elementCache.delete(t),a++)}),n>200&&e.propProcessingCache.clear(),t&&console.log(`[MeoNode] Navigation: cleared ${a} unmounted elements, ${n} props entries`)},a)};_patchHistoryMethods(){n._isPatched||(n._originalPushState=history.pushState,n._originalReplaceState=history.replaceState,history.pushState=(...t)=>{n._originalPushState.apply(history,t),this._handleNavigation()},history.replaceState=(...t)=>{n._originalReplaceState.apply(history,t),this._handleNavigation()},n._isPatched=!0)}_setupAutoCleanup(){window.__MEONODE_CLEANUP_REGISTERED||(window.addEventListener("beforeunload",()=>{this._stop(),e.clearCaches()}),window.__MEONODE_CLEANUP_REGISTERED=!0)}}export{n as NavigationCacheManagerUtil};
1
+ import{__DEBUG__ as t}from"../constant/common.const.js";import{BaseNode as e}from"../core.node.js";import{MountTrackerUtil as i}from"./mount-tracker.util.js";class a{constructor(){}static _instance=null;static _originalPushState=null;static _originalReplaceState=null;static _isPatched=!1;_isListening=!1;_cleanupTimeout=null;static getInstance(){return this._instance||(this._instance=new a),this._instance}start(){this._isListening||"undefined"==typeof window||(this._isListening=!0,window.addEventListener("popstate",this._handleNavigation),this._patchHistoryMethods(),this._setupAutoCleanup(),t&&console.log("[MeoNode] NavigationCacheManagerUtil started"))}_stop(){this._isListening&&"undefined"!=typeof window&&(window.removeEventListener("popstate",this._handleNavigation),this._cleanupTimeout&&(clearTimeout(this._cleanupTimeout),this._cleanupTimeout=null),this._isListening=!1,t&&console.log("[MeoNode] NavigationCacheManagerUtil stopped"))}_handleNavigation=()=>{this._cleanupTimeout&&clearTimeout(this._cleanupTimeout);const a=e.elementCache.size,n=a<100?50:a<500?100:200;this._cleanupTimeout=setTimeout(()=>{let a=0;e.elementCache.keys().forEach(t=>{i.isMounted(t)||(e.elementCache.delete(t),a++)}),t&&console.log(`[MeoNode] Navigation: cleared ${a} unmounted elements`)},n)};_patchHistoryMethods(){a._isPatched||(a._originalPushState=history.pushState,a._originalReplaceState=history.replaceState,history.pushState=(...t)=>{a._originalPushState.apply(history,t),this._handleNavigation()},history.replaceState=(...t)=>{a._originalReplaceState.apply(history,t),this._handleNavigation()},a._isPatched=!0)}_setupAutoCleanup(){window.__MEONODE_CLEANUP_REGISTERED||(window.addEventListener("beforeunload",()=>{this._stop(),e.clearCaches()}),window.__MEONODE_CLEANUP_REGISTERED=!0)}}export{a as NavigationCacheManagerUtil};
@@ -10,12 +10,15 @@ import { type Root } from 'react-dom/client';
10
10
  export declare class NodeUtil {
11
11
  private constructor();
12
12
  static isServer: boolean;
13
- private static _functionSignatureCache;
14
- private static readonly CACHE_SIZE_LIMIT = 500;
15
- private static readonly CACHE_CLEANUP_BATCH = 50;
16
- private static _cssCache;
13
+ private static get _functionSignatureCache();
17
14
  private static readonly CRITICAL_PROPS;
18
- static portalInfrastructure: WeakMap<NodeInstance, {
15
+ /**
16
+ * Portal infrastructure using WeakMap for memory-safe management.
17
+ * Stores the DOM element and React root associated with a NodeInstance.
18
+ * @internal
19
+ */
20
+ static get portalInfrastructure(): WeakMap<NodeInstance, {
21
+ instanceId: string;
19
22
  domElement: HTMLDivElement;
20
23
  reactRoot: NodePortal & {
21
24
  render(children: ReactNode): void;
@@ -48,6 +51,12 @@ export declare class NodeUtil {
48
51
  * @returns A combined hash string in base-36 format.
49
52
  */
50
53
  static hashString(str: string): string;
54
+ /**
55
+ * Generates a fast structural hash for CSS objects without full serialization.
56
+ * This is an optimized hashing method that samples the first 10 keys for performance.
57
+ * @param css The CSS object to hash.
58
+ * @returns A hash string representing the CSS object structure.
59
+ */
51
60
  /**
52
61
  * Generates a fast structural hash for CSS objects without full serialization.
53
62
  * This is an optimized hashing method that samples the first 10 keys for performance.
@@ -76,32 +85,6 @@ export declare class NodeUtil {
76
85
  * @returns An object containing only the critical props with an added count property.
77
86
  */
78
87
  static extractCriticalProps(props: Record<string, unknown>, keys: string[]): Record<string, unknown>;
79
- /**
80
- * Retrieves computed CSS props from the cache with LRU tracking.
81
- * Access time and hit count are tracked for smarter eviction.
82
- * Falls back to direct computation if no signature is provided or running on server.
83
- * @param cacheableProps The props to compute CSS properties from.
84
- * @param signature The cache signature to use for lookup.
85
- * @returns An object containing the CSS props.
86
- */
87
- static getCachedCssProps(cacheableProps: Record<string, unknown>, signature?: string): {
88
- cssProps: Record<string, unknown>;
89
- };
90
- /**
91
- * Implements an LRU eviction strategy that removes multiple entries at once.
92
- * It uses a scoring system where older and less frequently used entries have a higher eviction priority.
93
- * This batch eviction approach improves performance by avoiding frequent cache cleanup operations.
94
- */
95
- private static _evictLRUEntries;
96
- /**
97
- * Calculates an eviction score based on age and frequency of access.
98
- * Higher scores mean more likelihood to be evicted.
99
- * The scoring system uses weighted factors: 30% recency and 70% frequency.
100
- * @param value The cache entry to score.
101
- * @param now The current timestamp for calculating age.
102
- * @returns A numeric score representing how likely the entry should be evicted.
103
- */
104
- private static _calculateEvictionScore;
105
88
  /**
106
89
  * The main prop processing pipeline. It separates cacheable and non-cacheable props,
107
90
  * generates a signature for caching, and assembles the final props object.
@@ -111,7 +94,7 @@ export declare class NodeUtil {
111
94
  * @param stableKey The stable key used for child normalization (optional).
112
95
  * @returns The processed props object ready for rendering.
113
96
  */
114
- static processProps(element: NodeElementType, rawProps?: Partial<NodeProps<NodeElementType>>, stableKey?: string): FinalNodeProps;
97
+ static processProps(_element: NodeElementType, rawProps?: Partial<NodeProps<NodeElementType>>, stableKey?: string): FinalNodeProps;
115
98
  /**
116
99
  * Processes and normalizes children of the node.
117
100
  * Converts raw children (React elements, primitives, or other BaseNodes) into a consistent format.
@@ -1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G,WAAW,CAsDzG;IAED;;;;;;OAMG;IACH,OAAc,eAAe,CAAC,CAAC,SAAS,YAAY,GAAG,SAAS,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,IAAI,YAAY,CAAC,CAAC,CAAC,CAU5G;IAED;;;;;;;;;;;OAWG;IACH,OAAc,gBAAgB,CAAC,CAAC,SAAS,SAAS,GAAG,YAAY,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,CA4DrJ;IAED;;;;;;;;;;;;OAYG;IACH,OAAc,mBAAmB,CAAC,EAChC,gBAAgB,EAChB,SAAS,EACT,cAAc,EACf,EAAE;QACD,gBAAgB,EAAE,WAAW,CAAA;QAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,cAAc,CAAC,EAAE,OAAO,CAAA;KACzB,wUA8BA;IAED;;;;;;OAMG;IACH,OAAc,0BAA0B,CAAC,IAAI,EAAE,YAAY,WA0C1D;IAED;;;;OAIG;IACH,OAAc,kBAAkB,CAAC,KAAK,EAAE;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,SAAS,EAAE,IAAI,CAAA;KAAE,QAgBtF;CACF"}
@@ -1 +1 @@
1
- import e,{isValidElement as t,createElement as r}from"react";import{isReactClassComponent as o,isMemo as s,isForwardRef as n}from"../helper/react-is.helper.js";import{getElementTypeName as i,getCSSProps as c,omitUndefined as a,getDOMProps as l}from"../helper/common.helper.js";import{__DEBUG__ as p}from"../constant/common.const.js";import{BaseNode as d}from"../core.node.js";import{createRoot as u}from"react-dom/client";class h{constructor(){}static isServer="undefined"==typeof window;static _functionSignatureCache=new WeakMap;static CACHE_SIZE_LIMIT=500;static CACHE_CLEANUP_BATCH=50;static _cssCache=new WeakMap;static CRITICAL_PROPS=new Set(["css","className","disableEmotion","props"]);static portalInfrastructure=new WeakMap;static isNodeInstance=e=>"object"==typeof e&&null!==e&&"element"in e&&"function"==typeof e.render&&"function"==typeof e.toPortal&&"isBaseNode"in e;static isStyleProp=h.isServer||"undefined"==typeof document?()=>!1:e=>e in document.body.style;static hashString(e){let t=2166136261,r=5381;for(let o=0;o<e.length;o++){const s=e.charCodeAt(o);t^=s,t=Math.imul(t,16777619),r=33*r^s}return`${(t>>>0).toString(36)}_${(r>>>0).toString(36)}`}static hashCSS(e){const t=this._cssCache.get(e);if(t)return t;const r=Object.keys(e);let o=r.length;for(let t=0;t<Math.min(r.length,10);t++){const s=r[t],n=e[s];o=(o<<5)-o+s.charCodeAt(0),o&=o,"string"==typeof n&&(o=(o<<5)-o+n.length)}const s=o.toString(36);return this._cssCache.set(e,s),s}static createPropSignature(e,t){if(h.isServer)return;const r=i(e),o=Object.keys(t);o.length>1&&o.sort();const s=[`${r}:`];if("function"==typeof e){let t=h._functionSignatureCache.get(e);t||(t=h.hashString(e.toString()),h._functionSignatureCache.set(e,t)),s.push(t)}for(const e of o){const r=t[e];let o;const n=typeof r;if("string"===n||"number"===n||"boolean"===n)o=`${e}:${r};`;else if(null===r)o=`${e}:null;`;else if(void 0===r)o=`${e}:undefined;`;else if("css"===e&&"object"==typeof r)o=`css:${this.hashCSS(r)};`;else if(Array.isArray(r)){const t=r.filter(e=>{const t=typeof e;return"string"===t||"number"===t||"boolean"===t||null===e});o=t.length===r.length?`${e}:[${t.join(",")}];`:`${e}:[${r.length}];`}else if(r&&r.isBaseNode)o=`${e}:${r.stableKey};`;else if("function"===n)o=`${e}:${h.hashString(r.toString())};`;else{o=`${e}:{${Object.keys(r).sort().join(",")}};`}s.push(o)}return h.hashString(s.join(","))}static extractCriticalProps(e,t){const r={_keyCount:t.length};let o=0;for(const s of t){if(o>=50)break;if(h.CRITICAL_PROPS.has(s)){r[s]=e[s],o++;continue}const n=s.charCodeAt(0);111!==n||110!==s.charCodeAt(1)?!(97===n&&114===s.charCodeAt(1)&&105===s.charCodeAt(2)&&97===s.charCodeAt(3)||100===n&&97===s.charCodeAt(1)&&116===s.charCodeAt(2)&&97===s.charCodeAt(3))?t.length<=100&&h.isStyleProp(s)&&(r[s]=e[s],o++):(r[s]=e[s],o++):(r[s]=e[s],o++)}return r}static getCachedCssProps(e,t){if(h.isServer||!t)return{cssProps:c(e)};const r=d.propProcessingCache.get(t);if(r)return r.lastAccess=Date.now(),r.hitCount++,{cssProps:r.cssProps};const o=c(e);return d.propProcessingCache.set(t,{cssProps:o,signature:t,lastAccess:Date.now(),hitCount:1}),d.propProcessingCache.size>h.CACHE_SIZE_LIMIT&&!d.scheduledCleanup&&(d.scheduledCleanup=!0,"undefined"!=typeof requestIdleCallback?requestIdleCallback(()=>{h._evictLRUEntries(),d.scheduledCleanup=!1},{timeout:2e3}):setTimeout(()=>{h._evictLRUEntries(),d.scheduledCleanup=!1},100)),{cssProps:o}}static _evictLRUEntries(){const e=Date.now(),t=new f((e,t)=>t.score-e.score);for(const[r,o]of d.propProcessingCache.entries()){const s=this._calculateEvictionScore(o,e);t.push({key:r,score:s})}const r=h.CACHE_SIZE_LIMIT,o=d.propProcessingCache.size,s=Math.max(0,o-r)+h.CACHE_CLEANUP_BATCH;for(let e=0;e<s;e++){const e=t.pop();if(!e)break;d.propProcessingCache.delete(e.key)}}static _calculateEvictionScore(e,t){return(t-e.lastAccess)/1e3*.3+1e3/(e.hitCount+1)*.7}static processProps(e,t={},r){const{ref:o,key:s,children:n,css:i,props:p={},disableEmotion:d,...u}=t;if(0===Object.keys(u).length&&!i)return a({ref:o,key:s,disableEmotion:d,nativeProps:a(p),children:h._processChildren(n,d)});const f={},m={},y=Object.keys(u);for(let e=0;e<y.length;e++){const t=y[e],r=u[t],o=typeof r;"string"===o||"number"===o||"boolean"===o?f[t]=r:m[t]=r}const C=h.createPropSignature(e,f),{cssProps:b}=h.getCachedCssProps(f,C),g=c(m),E=l(u),P={...b,...g,...i},w=h._processChildren(n,d,r);return a({ref:o,key:s,css:P,...E,disableEmotion:d,nativeProps:a(p),children:w})}static _processChildren(e,t,r){if(e)return"function"==typeof e?e:Array.isArray(e)?1===e.length?h.processRawNode(e[0],t,`${r}_0`):e.map((e,o)=>h.processRawNode(e,t,`${r}_${o}`)):h.processRawNode(e,t,r)}static shouldCacheElement(e){return!h.isServer&&!!e.stableKey&&!!e.dependencies}static shouldNodeUpdate(e,t,r){return!!h.isServer||!r&&(void 0===t||(void 0===e||(t.length!==e.length||!!t.some((t,r)=>!Object.is(t,e[r])))))}static processRawNode(r,i,c){if(null==r||"string"==typeof r||"number"==typeof r||"boolean"==typeof r)return r;if(h.isNodeInstance(r)){if(c||i&&!r.rawProps.disableEmotion){const e=new d(r.element,r.rawProps,r.dependencies);return e.stableKey=`${c}:${e.stableKey}`,i&&!e.rawProps.disableEmotion&&(e.rawProps.disableEmotion=!0),e}return r}if(h.isFunctionChild(r))return new d(h.functionRenderer,{props:{render:r,disableEmotion:i}},void 0);if(t(r)){const{style:e,...t}=r.props,o={...t,...e||{}};return new d(r.type,{...o,...null!==r.key&&void 0!==r.key?{key:r.key}:{},disableEmotion:i},void 0)}return o(r)||s(r)||n(r)?new d(r,{disableEmotion:i},void 0):r instanceof e.Component?h.processRawNode(r.render(),i,c):r}static isFunctionChild(e){if("function"!=typeof e||o(e)||s(e)||n(e))return!1;try{return!(e.prototype&&"function"==typeof e.prototype.render)}catch(e){return p&&console.error("MeoNode: Error checking if a node is a function child.",e),!0}}static functionRenderer({render:t,disableEmotion:r}){let o;try{o=t()}catch(e){p&&console.error("MeoNode: Error executing function-as-a-child.",e),o=null}if(null==o)return o;if(h.isNodeInstance(o))return r&&!o.rawProps.disableEmotion?new d(o.element,{...o.rawProps,disableEmotion:!0}).render():o.render();if(Array.isArray(o)){const e=(e,t)=>{try{return`${i(e)}-${t}`}catch(e){return p&&console.error("MeoNode: Could not determine element type name for key in function-as-a-child.",e),`item-${t}`}};return o.map((t,o)=>h.renderProcessedNode({processedElement:h.processRawNode(t,r),passedKey:e(t,o),disableEmotion:r}))}if(o instanceof e.Component)return h.renderProcessedNode({processedElement:h.processRawNode(o.render(),r),disableEmotion:r});if("string"==typeof o||"number"==typeof o||"boolean"==typeof o)return o;const s=h.processRawNode(o,r);return s?h.renderProcessedNode({processedElement:s,disableEmotion:r}):o}static renderProcessedNode({processedElement:t,passedKey:s,disableEmotion:n}){const i={};if(void 0!==s&&(i.key=s),h.isNodeInstance(t)){const e=t.rawProps?.key;return t.rawProps.disableEmotion=n,e===s?t.render():new d(t.element,{...t.rawProps,...i}).render()}return o(t)?new d(t,{...i,disableEmotion:n}).render():t instanceof e.Component?t.render():"function"==typeof t?r(t,{key:s}):t}static ensurePortalInfrastructure(e){if(h.isServer)return!1;let t=h.portalInfrastructure.get(e);if(t?.domElement?.isConnected&&t?.reactRoot)return!0;if(t&&(!t.domElement?.isConnected||!t.reactRoot)){try{t.reactRoot?.unmount?.()}catch(e){p&&console.error("MeoNode: Error unmounting stale portal root.",e)}h.cleanupPortalInfra(t),h.portalInfrastructure.delete(e),t=void 0}const r=document.createElement("div");document.body.appendChild(r);const o=u(r),s={render:o.render.bind(o),unmount:o.unmount.bind(o),update:()=>{}};return t={domElement:r,reactRoot:s},h.portalInfrastructure.set(e,t),d.portalCleanupRegistry.register(e,{domElement:r,reactRoot:s},e),!0}static cleanupPortalInfra(e){try{e.reactRoot?.unmount&&e.reactRoot.unmount()}catch(e){p&&console.error("Portal cleanup error:",e)}try{e.domElement?.isConnected&&e.domElement.remove()}catch(e){p&&console.error("DOM removal error:",e)}}}class f{heap=[];comparator;constructor(e){this.comparator=e}size(){return this.heap.length}isEmpty(){return 0===this.size()}push(e){this.heap.push(e),this.bubbleUp()}pop(){if(this.isEmpty())return;this.swap(0,this.size()-1);const e=this.heap.pop();return this.bubbleDown(),e}bubbleUp(e=this.size()-1){for(;e>0;){const t=Math.floor((e-1)/2);if(this.comparator(this.heap[t],this.heap[e])<=0)break;this.swap(t,e),e=t}}bubbleDown(e=0){const t=this.size()-1;for(;;){const r=2*e+1,o=2*e+2;let s=e;if(r<=t&&this.comparator(this.heap[r],this.heap[s])<0&&(s=r),o<=t&&this.comparator(this.heap[o],this.heap[s])<0&&(s=o),s===e)break;this.swap(e,s),e=s}}swap(e,t){[this.heap[e],this.heap[t]]=[this.heap[t],this.heap[e]]}}export{h as NodeUtil};
1
+ import e,{isValidElement as t,createElement as r}from"react";import{isReactClassComponent as o,isMemo as n,isForwardRef as s}from"../helper/react-is.helper.js";import{getGlobalState as i,getElementTypeName as c,omitUndefined as a,getCSSProps as l,getDOMProps as d}from"../helper/common.helper.js";import{__DEBUG__ as u}from"../constant/common.const.js";import{BaseNode as p}from"../core.node.js";import{createRoot as f}from"react-dom/client";const m=Symbol.for("@meonode/ui/NodeUtil/functionSignatureCache"),h=Symbol.for("@meonode/ui/NodeUtil/portalInfrastructure");class y{constructor(){}static isServer="undefined"==typeof window;static get _functionSignatureCache(){return i(m,()=>new WeakMap)}static CRITICAL_PROPS=new Set(["css","className","disableEmotion","props"]);static get portalInfrastructure(){return i(h,()=>new WeakMap)}static isNodeInstance=e=>"object"==typeof e&&null!==e&&"element"in e&&"function"==typeof e.render&&"function"==typeof e.toPortal&&"isBaseNode"in e;static isStyleProp=y.isServer||"undefined"==typeof document?()=>!1:e=>e in document.body.style;static hashString(e){let t=2166136261,r=5381;for(let o=0;o<e.length;o++){const n=e.charCodeAt(o);t^=n,t=Math.imul(t,16777619),r=33*r^n}return`${(t>>>0).toString(36)}_${(r>>>0).toString(36)}`}static hashCSS(e){const t=Object.keys(e);let r=t.length;for(let o=0;o<Math.min(t.length,10);o++){const n=t[o],s=e[n];r=(r<<5)-r+n.charCodeAt(0),r&=r,"string"==typeof s&&(r=(r<<5)-r+s.length)}return r.toString(36)}static createPropSignature(e,t){if(y.isServer)return;const r=c(e),o=Object.keys(t);o.length>1&&o.sort();const n=[`${r}:`];if("function"==typeof e){let t=y._functionSignatureCache.get(e);t||(t=y.hashString(e.toString()),y._functionSignatureCache.set(e,t)),n.push(t)}for(const e of o){const r=t[e];let o;const s=typeof r;if("string"===s||"number"===s||"boolean"===s)o=`${e}:${r};`;else if(null===r)o=`${e}:null;`;else if(void 0===r)o=`${e}:undefined;`;else if("css"===e&&"object"==typeof r)o=`css:${this.hashCSS(r)};`;else if(Array.isArray(r)){const t=r.filter(e=>{const t=typeof e;return"string"===t||"number"===t||"boolean"===t||null===e});o=t.length===r.length?`${e}:[${t.join(",")}];`:`${e}:[${r.length}];`}else if(r&&r.isBaseNode)o=`${e}:${r.stableKey};`;else if("function"===s)o=`${e}:${y.hashString(r.toString())};`;else{o=`${e}:{${Object.keys(r).sort().join(",")}};`}n.push(o)}return y.hashString(n.join(","))}static extractCriticalProps(e,t){const r={_keyCount:t.length};let o=0;for(const n of t){if(o>=50)break;if(y.CRITICAL_PROPS.has(n)){r[n]=e[n],o++;continue}const s=n.charCodeAt(0);111!==s||110!==n.charCodeAt(1)?!(97===s&&114===n.charCodeAt(1)&&105===n.charCodeAt(2)&&97===n.charCodeAt(3)||100===s&&97===n.charCodeAt(1)&&116===n.charCodeAt(2)&&97===n.charCodeAt(3))?t.length<=100&&y.isStyleProp(n)&&(r[n]=e[n],o++):(r[n]=e[n],o++):(r[n]=e[n],o++)}return r}static processProps(e,t={},r){const{ref:o,key:n,children:s,css:i,props:c={},disableEmotion:u,...p}=t;if(0===Object.keys(p).length&&!i)return a({ref:o,key:n,disableEmotion:u,nativeProps:a(c),children:y._processChildren(s,u)});const f={},m={},h=Object.keys(p);for(let e=0;e<h.length;e++){const t=h[e],r=p[t],o=typeof r;"string"===o||"number"===o||"boolean"===o?f[t]=r:m[t]=r}const{cssProps:b}={cssProps:l(f)},g=l(m),C=d(p),E={...b,...g,...i},P=y._processChildren(s,u,r);return a({ref:o,key:n,css:E,...C,disableEmotion:u,nativeProps:a(c),children:P})}static _processChildren(e,t,r){if(e)return"function"==typeof e?e:Array.isArray(e)?1===e.length?y.processRawNode(e[0],t,`${r}_0`):e.map((e,o)=>y.processRawNode(e,t,`${r}_${o}`)):y.processRawNode(e,t,r)}static shouldCacheElement(e){return!y.isServer&&!!e.stableKey&&!!e.dependencies}static shouldNodeUpdate(e,t,r){return!!y.isServer||!r&&(void 0===t||(void 0===e||(t.length!==e.length||!!t.some((t,r)=>!Object.is(t,e[r])))))}static processRawNode(r,i,c){if(null==r||"string"==typeof r||"number"==typeof r||"boolean"==typeof r)return r;if(y.isNodeInstance(r)){if(c||i&&!r.rawProps.disableEmotion){const e=new p(r.element,r.rawProps,r.dependencies);return e.stableKey=`${c}:${e.stableKey}`,i&&!e.rawProps.disableEmotion&&(e.rawProps.disableEmotion=!0),e}return r}if(y.isFunctionChild(r))return new p(y.functionRenderer,{props:{render:r,disableEmotion:i}},void 0);if(t(r)){const{style:e,...t}=r.props,o={...t,...e||{}};return new p(r.type,{...o,...null!==r.key&&void 0!==r.key?{key:r.key}:{},disableEmotion:i},void 0)}return o(r)||n(r)||s(r)?new p(r,{disableEmotion:i},void 0):r instanceof e.Component?y.processRawNode(r.render(),i,c):r}static isFunctionChild(e){if("function"!=typeof e||o(e)||n(e)||s(e))return!1;try{return!(e.prototype&&"function"==typeof e.prototype.render)}catch(e){return u&&console.error("MeoNode: Error checking if a node is a function child.",e),!0}}static functionRenderer({render:t,disableEmotion:r}){let o;try{o=t()}catch(e){u&&console.error("MeoNode: Error executing function-as-a-child.",e),o=null}if(null==o)return o;if(y.isNodeInstance(o))return r&&!o.rawProps.disableEmotion?new p(o.element,{...o.rawProps,disableEmotion:!0}).render():o.render();if(Array.isArray(o)){const e=(e,t)=>{try{return`${c(e)}-${t}`}catch(e){return u&&console.error("MeoNode: Could not determine element type name for key in function-as-a-child.",e),`item-${t}`}};return o.map((t,o)=>y.renderProcessedNode({processedElement:y.processRawNode(t,r),passedKey:e(t,o),disableEmotion:r}))}if(o instanceof e.Component)return y.renderProcessedNode({processedElement:y.processRawNode(o.render(),r),disableEmotion:r});if("string"==typeof o||"number"==typeof o||"boolean"==typeof o)return o;const n=y.processRawNode(o,r);return n?y.renderProcessedNode({processedElement:n,disableEmotion:r}):o}static renderProcessedNode({processedElement:t,passedKey:n,disableEmotion:s}){const i={};if(void 0!==n&&(i.key=n),y.isNodeInstance(t)){const e=t.rawProps?.key;return t.rawProps.disableEmotion=s,e===n?t.render():new p(t.element,{...t.rawProps,...i}).render()}return o(t)?new p(t,{...i,disableEmotion:s}).render():t instanceof e.Component?t.render():"function"==typeof t?r(t,{key:n}):t}static ensurePortalInfrastructure(e){if(y.isServer)return!1;let t=y.portalInfrastructure.get(e);if(t?.domElement?.isConnected&&t?.reactRoot)return!0;if(t&&(!t.domElement?.isConnected||!t.reactRoot)){try{t.reactRoot?.unmount?.()}catch(e){u&&console.error("MeoNode: Error unmounting stale portal root.",e)}y.cleanupPortalInfra(t),y.portalInfrastructure.delete(e),t=void 0}const r=document.createElement("div");document.body.appendChild(r);const o=f(r),n={render:o.render.bind(o),unmount:o.unmount.bind(o),update:()=>{}};return t={domElement:r,reactRoot:n,instanceId:e.instanceId},y.portalInfrastructure.set(e,t),p.portalCleanupRegistry.register(e,{domElement:r,reactRoot:n},e),!0}static cleanupPortalInfra(e){try{e.reactRoot?.unmount&&e.reactRoot.unmount()}catch(e){u&&console.error("Portal cleanup error:",e)}try{e.domElement?.isConnected&&e.domElement.remove()}catch(e){u&&console.error("DOM removal error:",e)}}}export{y as NodeUtil};
@@ -6,7 +6,6 @@ interface FlexComponents {
6
6
  basis: string | number;
7
7
  }
8
8
  export declare class ThemeUtil {
9
- private static themeCache;
10
9
  private constructor();
11
10
  /**
12
11
  * Parses a CSS flex shorthand property into its individual components.
@@ -40,7 +39,6 @@ export declare class ThemeUtil {
40
39
  static resolveObjWithTheme: <O extends Record<string, unknown>>(obj: O, theme?: Theme | undefined, options?: {
41
40
  processFunctions?: boolean | undefined;
42
41
  }) => O;
43
- static clearThemeCache: () => void;
44
42
  /**
45
43
  * Resolves default CSS styles to fix common flexbox layout issues.
46
44
  *
@@ -1 +1 @@
1
- {"version":3,"file":"theme.util.d.ts","sourceRoot":"","sources":["../../../src/util/theme.util.ts"],"names":[],"mappings":"AAAA,OAAO,KA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C;;YA4GrC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqDG;IACH,OAAc,mBAAmB,yBAmEhC;CACF"}
@@ -1 +1 @@
1
- import{ObjHelper as e}from"../helper/obj.helper.js";import{getValueByPath as t}from"../helper/common.helper.js";class s{static _instance=null;CACHE_SIZE_LIMIT=500;CACHE_EVICTION_BATCH_SIZE=50;_resolutionCache=new Map;_pathLookupCache=new Map;_themeRegex=/theme\.([a-zA-Z0-9_.-]+)/g;static getInstance(){return s._instance||(s._instance=new s),s._instance}getResolution(e,t){const s=this._generateCacheKey(e,t),r=this._resolutionCache.get(s);return r&&(this._resolutionCache.delete(s),this._resolutionCache.set(s,r)),r||null}setResolution(e,t,s){const r=this._generateCacheKey(e,t);this._resolutionCache.set(r,s),this._resolutionCache.size>this.CACHE_SIZE_LIMIT&&this._evict(this._resolutionCache)}getPathLookup(t,s){const r=`${e.stringify(t)}_${s}`,n=this._pathLookupCache.get(r);return n&&(this._pathLookupCache.delete(r),this._pathLookupCache.set(r,n)),n??null}setPathLookup(t,s,r){const n=`${e.stringify(t)}_${s}`;this._pathLookupCache.set(n,r),this._pathLookupCache.size>this.CACHE_SIZE_LIMIT&&this._evict(this._pathLookupCache)}getThemeRegex(){return this._themeRegex.lastIndex=0,this._themeRegex}shouldCache(){return"undefined"==typeof window}clear(){this._resolutionCache.clear(),this._pathLookupCache.clear()}_generateCacheKey(t,s){return`${e.stringify(t)}_${s.mode}_${e.stringify(s.system)}`}_evict(e){const t=e.keys();for(let s=0;s<this.CACHE_EVICTION_BATCH_SIZE;s++){const s=t.next().value;if(!s)break;e.delete(s)}}}class r{static themeCache=s.getInstance();constructor(){}static parseFlexShorthand(e){if(null==e)return null;if("number"==typeof e)return{grow:e,shrink:1,basis:"0%"};if("string"!=typeof e)return null;const t=e.trim().toLowerCase();if(!t)return null;switch(t){case"none":return{grow:0,shrink:0,basis:"auto"};case"auto":return{grow:1,shrink:1,basis:"auto"};case"initial":return{grow:0,shrink:1,basis:"auto"};default:return null}}static isPlainObject=e=>{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype};static resolveObjWithTheme=(e,s,n={})=>{const{processFunctions:o=!1}=n;if(!s||!s.system||"object"!=typeof s.system||0===Object.keys(s.system).length||!e||0===Object.keys(e).length)return e;const i=s.system;if(r.themeCache.shouldCache()){const t=r.themeCache.getResolution(e,s);if(null!==t)return t}const l=[{value:e,isProcessed:!1}],a=new Map,h=new Set,c=e=>{const s=r.themeCache.getThemeRegex();let n=!1;const o=e.replace(s,(e,s)=>{let o=r.themeCache.getPathLookup(i,s);if(null===o&&(o=t(i,s),r.themeCache.setPathLookup(i,s,o)),null!=o){if(n=!0,"object"==typeof o){if(!Array.isArray(o)&&"default"in o)return o.default;throw new Error("The provided theme path is invalid!")}return o}return e});return n?o:e};for(;l.length>0;){const e=l[l.length-1],t=e.value;if(r.isPlainObject(t)||Array.isArray(t))if(a.has(t))l.pop();else if(e.isProcessed){l.pop(),h.delete(t);let e=t;if(Array.isArray(t)){let s=null;for(let e=0;e<t.length;e++){const r=t[e],n=a.get(r)??r;n!==r&&(null===s&&(s=[...t]),s[e]=n)}null!==s&&(e=s)}else{let r=null;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];let i=a.get(n)??n;if("function"==typeof i&&o){const e=i(s);i="string"==typeof e&&e.includes("theme.")?c(e):e}else"string"==typeof i&&i.includes("theme.")&&(i=c(i));i!==n&&(null===r&&(r={...t}),r[e]=i)}null!==r&&(e=r)}a.set(t,e)}else{e.isProcessed=!0,h.add(t);const s=Array.isArray(t)?t:Object.values(t);for(let e=s.length-1;e>=0;e--){const t=s[e];!r.isPlainObject(t)&&!Array.isArray(t)||h.has(t)||l.push({value:t,isProcessed:!1})}}else l.pop()}const u=a.get(e)??e;return r.themeCache.shouldCache()&&r.themeCache.setResolution(e,s,u),u};static clearThemeCache=()=>{r.themeCache.clear()};static resolveDefaultStyle=e=>{if(null==e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)return{};const{flex:t,...s}=e,n="flex"===s.display||"inline-flex"===s.display,o=!!(s.overflow||s.overflowY||s.overflowX),i=s.flexFlow?.includes("wrap")||"wrap"===s.flexWrap||"wrap-reverse"===s.flexWrap,l="flexShrink"in e&&void 0!==e.flexShrink,a=t?r.parseFlexShorthand(t):null;let h;if(!l)if(a)h=a.shrink;else if(n){if(!o){const e="column"===s.flexDirection||"column-reverse"===s.flexDirection,t="row"===s.flexDirection||"row-reverse"===s.flexDirection||!s.flexDirection;(e&&!i||t&&!i)&&(h=0)}}else h=0;return{flex:t,flexShrink:h,minHeight:0,minWidth:0,...s}}}export{r as ThemeUtil};
1
+ import{getValueByPath as e}from"../helper/common.helper.js";class t{constructor(){}static parseFlexShorthand(e){if(null==e)return null;if("number"==typeof e)return{grow:e,shrink:1,basis:"0%"};if("string"!=typeof e)return null;const t=e.trim().toLowerCase();if(!t)return null;switch(t){case"none":return{grow:0,shrink:0,basis:"auto"};case"auto":return{grow:1,shrink:1,basis:"auto"};case"initial":return{grow:0,shrink:1,basis:"auto"};default:return null}}static isPlainObject=e=>{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype};static resolveObjWithTheme=(r,l,n={})=>{const{processFunctions:s=!1}=n;if(!l||!l.system||"object"!=typeof l.system||0===Object.keys(l.system).length||!r||0===Object.keys(r).length)return r;const o=l.system,i=[{value:r,isProcessed:!1}],a=new Map,f=new Set,c=/theme\.([a-zA-Z0-9_.-]+)/g,u=t=>{c.lastIndex=0;let r=!1;const l=t.replace(c,(t,l)=>{const n=e(o,l);if(null!=n){if(r=!0,"object"==typeof n){if(!Array.isArray(n)&&"default"in n)return n.default;throw new Error("The provided theme path is invalid!")}return n}return t});return r?l:t};for(;i.length>0;){const e=i[i.length-1],r=e.value;if(t.isPlainObject(r)||Array.isArray(r))if(a.has(r))i.pop();else if(e.isProcessed){i.pop(),f.delete(r);let e=r;if(Array.isArray(r)){let t=null;for(let e=0;e<r.length;e++){const l=r[e],n=a.get(l)??l;n!==l&&(null===t&&(t=[...r]),t[e]=n)}null!==t&&(e=t)}else{let t=null;for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e)){const n=r[e];let o=a.get(n)??n;if("function"==typeof o&&s){const e=o(l);o="string"==typeof e&&e.includes("theme.")?u(e):e}else"string"==typeof o&&o.includes("theme.")&&(o=u(o));o!==n&&(null===t&&(t={...r}),t[e]=o)}null!==t&&(e=t)}a.set(r,e)}else{e.isProcessed=!0,f.add(r);const l=Array.isArray(r)?r:Object.values(r);for(let e=l.length-1;e>=0;e--){const r=l[e];!t.isPlainObject(r)&&!Array.isArray(r)||f.has(r)||i.push({value:r,isProcessed:!1})}}else i.pop()}return a.get(r)??r};static resolveDefaultStyle=e=>{if(null==e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)return{};const{flex:r,...l}=e,n="flex"===l.display||"inline-flex"===l.display,s=!!(l.overflow||l.overflowY||l.overflowX),o=l.flexFlow?.includes("wrap")||"wrap"===l.flexWrap||"wrap-reverse"===l.flexWrap,i="flexShrink"in e&&void 0!==e.flexShrink,a=r?t.parseFlexShorthand(r):null;let f;if(!i)if(a)f=a.shrink;else if(n){if(!s){const e="column"===l.flexDirection||"column-reverse"===l.flexDirection,t="row"===l.flexDirection||"row-reverse"===l.flexDirection||!l.flexDirection;(e&&!o||t&&!o)&&(f=0)}}else f=0;return{flex:r,flexShrink:f,minHeight:0,minWidth:0,...l}}}export{t as ThemeUtil};
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": "1.0.0-0",
4
+ "version": "1.0.0",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "types": "./dist/main.d.ts",
@@ -126,6 +126,5 @@
126
126
  "accessible-components",
127
127
  "meonode-ui",
128
128
  "meonode"
129
- ],
130
- "stableVersion": "0.4.14"
129
+ ]
131
130
  }
@@ -1 +0,0 @@
1
- "use strict";exports.ObjHelper=class{constructor(){}static buildSerializable(e,t){if(null==e)return e;const i=typeof e;if("string"===i||"number"===i||"boolean"===i)return e;if("function"===i){let i=t.functionIds.get(e);return void 0===i&&(i=t.nextFunctionId++,t.functionIds.set(e,i)),{$type:"Function",name:e.name||"",id:i}}if("symbol"===i)return{$type:"Symbol",key:e.description??""};if("bigint"===i)return{$type:"BigInt",value:e.toString()};if("object"!==i)try{return String(e)}catch{return"<unserializable>"}if(e instanceof Date)return{$type:"Date",value:e.toISOString()};if(e instanceof RegExp)return{$type:"RegExp",source:e.source,flags:e.flags};const n=t.seen.get(e);if(void 0!==n)return{$type:"Circular",ref:n};const r=t.nextObjId++;if(t.seen.set(e,r),e instanceof Map){const i=[];for(const[n,r]of e.entries())i.push([this.buildSerializable(n,t),this.buildSerializable(r,t)]);return{$type:"Map",entries:i}}if(e instanceof Set){const i=[];for(const n of e.values())i.push(this.buildSerializable(n,t));return{$type:"Set",values:i}}if(Array.isArray(e))return e.map(e=>this.buildSerializable(e,t));try{const i=Object.keys(e),n={};for(const r of i)try{n[r]=this.buildSerializable(e[r],t)}catch{n[r]="<unserializable>"}return n}catch{return"<unserializable>"}}static stringify(e,t=0){const i={nextObjId:0,nextFunctionId:0,seen:new Map,functionIds:new Map},n=this.buildSerializable(e,i);return JSON.stringify(n,null,t)}};
@@ -1,16 +0,0 @@
1
- export declare class ObjHelper {
2
- private constructor();
3
- /**
4
- * Build a serializable representation of `value`.
5
- * - preserves encoded placeholders for special types
6
- * - emits { $type: 'Circular', ref: id } for circular refs
7
- */
8
- private static buildSerializable;
9
- /**
10
- * Stringify with performance optimizations.
11
- * @param obj Object to serialize
12
- * @param space JSON.stringify space parameter
13
- */
14
- static stringify(obj: any, space?: number): string;
15
- }
16
- //# sourceMappingURL=obj.helper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"obj.helper.d.ts","sourceRoot":"","sources":["../../../src/helper/obj.helper.ts"],"names":[],"mappings":"AAOA,qBAAa,SAAS;IACpB,OAAO,eAAiB;IAExB;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAmGhC;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,SAAI,GAAG,MAAM,CAU5C;CACF"}
@@ -1 +0,0 @@
1
- class e{constructor(){}static buildSerializable(e,t){if(null==e)return e;const i=typeof e;if("string"===i||"number"===i||"boolean"===i)return e;if("function"===i){let i=t.functionIds.get(e);return void 0===i&&(i=t.nextFunctionId++,t.functionIds.set(e,i)),{$type:"Function",name:e.name||"",id:i}}if("symbol"===i)return{$type:"Symbol",key:e.description??""};if("bigint"===i)return{$type:"BigInt",value:e.toString()};if("object"!==i)try{return String(e)}catch{return"<unserializable>"}if(e instanceof Date)return{$type:"Date",value:e.toISOString()};if(e instanceof RegExp)return{$type:"RegExp",source:e.source,flags:e.flags};const n=t.seen.get(e);if(void 0!==n)return{$type:"Circular",ref:n};const r=t.nextObjId++;if(t.seen.set(e,r),e instanceof Map){const i=[];for(const[n,r]of e.entries())i.push([this.buildSerializable(n,t),this.buildSerializable(r,t)]);return{$type:"Map",entries:i}}if(e instanceof Set){const i=[];for(const n of e.values())i.push(this.buildSerializable(n,t));return{$type:"Set",values:i}}if(Array.isArray(e))return e.map(e=>this.buildSerializable(e,t));try{const i=Object.keys(e),n={};for(const r of i)try{n[r]=this.buildSerializable(e[r],t)}catch{n[r]="<unserializable>"}return n}catch{return"<unserializable>"}}static stringify(e,t=0){const i={nextObjId:0,nextFunctionId:0,seen:new Map,functionIds:new Map},n=this.buildSerializable(e,i);return JSON.stringify(n,null,t)}}export{e as ObjHelper};