@meonode/ui 1.1.3 → 1.2.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 (64) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +53 -0
  3. package/dist/cjs/components/portal-host.cjs +1 -0
  4. package/dist/cjs/components/portal-host.client.cjs +2 -0
  5. package/dist/cjs/components/portal-provider.cjs +1 -0
  6. package/dist/cjs/components/portal-provider.client.cjs +2 -0
  7. package/dist/cjs/components/style-registry.client.cjs +2 -0
  8. package/dist/cjs/core.node.cjs +1 -1
  9. package/dist/cjs/helper/data-channel.helper.cjs +1 -0
  10. package/dist/cjs/hook/useDataChannel.cjs +2 -0
  11. package/dist/cjs/hook/usePortal.cjs +2 -0
  12. package/dist/cjs/main.cjs +1 -1
  13. package/dist/cjs/nextjs-registry/index.cjs +1 -1
  14. package/dist/cjs/util/node.util.cjs +1 -1
  15. package/dist/esm/components/portal-host.client.d.ts +26 -0
  16. package/dist/esm/components/portal-host.client.d.ts.map +1 -0
  17. package/dist/esm/components/portal-host.client.js +2 -0
  18. package/dist/esm/components/portal-host.d.ts +9 -0
  19. package/dist/esm/components/portal-host.d.ts.map +1 -0
  20. package/dist/esm/components/portal-host.js +1 -0
  21. package/dist/esm/components/portal-provider.client.d.ts +14 -0
  22. package/dist/esm/components/portal-provider.client.d.ts.map +1 -0
  23. package/dist/esm/components/portal-provider.client.js +2 -0
  24. package/dist/esm/components/portal-provider.d.ts +9 -0
  25. package/dist/esm/components/portal-provider.d.ts.map +1 -0
  26. package/dist/esm/components/portal-provider.js +1 -0
  27. package/dist/esm/components/{registry.client.d.ts → style-registry.client.d.ts} +1 -1
  28. package/dist/esm/components/style-registry.client.d.ts.map +1 -0
  29. package/dist/esm/components/style-registry.client.js +2 -0
  30. package/dist/esm/core.node.d.ts +1 -28
  31. package/dist/esm/core.node.d.ts.map +1 -1
  32. package/dist/esm/core.node.js +1 -1
  33. package/dist/esm/helper/data-channel.helper.d.ts +13 -0
  34. package/dist/esm/helper/data-channel.helper.d.ts.map +1 -0
  35. package/dist/esm/helper/data-channel.helper.js +1 -0
  36. package/dist/esm/hoc/index.d.ts +0 -1
  37. package/dist/esm/hoc/index.d.ts.map +1 -1
  38. package/dist/esm/hook/index.d.ts +2 -0
  39. package/dist/esm/hook/index.d.ts.map +1 -1
  40. package/dist/esm/hook/useDataChannel.d.ts +10 -0
  41. package/dist/esm/hook/useDataChannel.d.ts.map +1 -0
  42. package/dist/esm/hook/useDataChannel.js +2 -0
  43. package/dist/esm/hook/usePortal.d.ts +34 -0
  44. package/dist/esm/hook/usePortal.d.ts.map +1 -0
  45. package/dist/esm/hook/usePortal.js +2 -0
  46. package/dist/esm/main.d.ts +3 -0
  47. package/dist/esm/main.d.ts.map +1 -1
  48. package/dist/esm/main.js +1 -1
  49. package/dist/esm/nextjs-registry/index.d.ts +1 -1
  50. package/dist/esm/nextjs-registry/index.d.ts.map +1 -1
  51. package/dist/esm/nextjs-registry/index.js +1 -1
  52. package/dist/esm/types/node.type.d.ts +52 -30
  53. package/dist/esm/types/node.type.d.ts.map +1 -1
  54. package/dist/esm/util/node.util.d.ts +1 -31
  55. package/dist/esm/util/node.util.d.ts.map +1 -1
  56. package/dist/esm/util/node.util.js +1 -1
  57. package/package.json +4 -2
  58. package/dist/cjs/components/registry.client.cjs +0 -2
  59. package/dist/cjs/hoc/portal.hoc.cjs +0 -1
  60. package/dist/esm/components/registry.client.d.ts.map +0 -1
  61. package/dist/esm/components/registry.client.js +0 -2
  62. package/dist/esm/hoc/portal.hoc.d.ts +0 -52
  63. package/dist/esm/hoc/portal.hoc.d.ts.map +0 -1
  64. package/dist/esm/hoc/portal.hoc.js +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,44 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.2.0-0] - 2026-02-15
6
+
7
+ ### Feat
8
+
9
+ - **portal**: implement stack-based portal system with PortalProvider and PortalHost ([`7196f6f`](https://github.com/l7aromeo/meonode-ui/commit/7196f6f))
10
+ - Introduced `PortalProvider` and `PortalHost` for managed overlay stacks.
11
+ - **helper**: add data-channel helper for efficient portal updates ([`6508c0a`](https://github.com/l7aromeo/meonode-ui/commit/6508c0a))
12
+ - Added `createDataChannel` for high-performance, subscription-based state updates between components.
13
+ - **hook**: add usePortal and useDataChannel hooks ([`b2f7d19`](https://github.com/l7aromeo/meonode-ui/commit/b2f7d19))
14
+ - Added reactive hooks to interact with the new portal system and data channels.
15
+
16
+ ### Refactor
17
+
18
+ - **portal**: remove legacy portal system and update core ([`91ced63`](https://github.com/l7aromeo/meonode-ui/commit/91ced63))
19
+ - **BREAKING CHANGE**: Removed legacy `portal.hoc.ts` and associated logic in favor of the new stack-based architecture.
20
+ - Updated `BaseNode` and `NodeUtil` for better portal integration.
21
+
22
+ ### Test
23
+
24
+ - **portal**: add tests for new portal system ([`92cd3c0`](https://github.com/l7aromeo/meonode-ui/commit/92cd3c0))
25
+ - Added integration tests for stack management and data synchronization.
26
+
27
+ ### Docs
28
+
29
+ - **portal**: update README with new portal system examples ([`3f7a314`](https://github.com/l7aromeo/meonode-ui/commit/3f7a314))
30
+
31
+ ## [1.1.4] - 2026-02-15
32
+
33
+ ### Fix
34
+
35
+ - **nextjs**: prevent duplicate style tags and content in StyleRegistry ([`91bec99`](https://github.com/l7aromeo/meonode-ui/commit/91bec99))
36
+ - Renamed `registry.client.ts` to `style-registry.client.ts` and implemented tracking of inserted IDs during SSR to avoid duplicate CSS injection in Next.js streaming.
37
+
38
+ ### Test
39
+
40
+ - **emotion**: add style tag generation monitoring test ([`0576f0c`](https://github.com/l7aromeo/meonode-ui/commit/0576f0c))
41
+ - Added tests to verify that nested `Div` structures efficiently batch styles into a single style tag and that state changes correctly append new rules.
42
+
5
43
  ## [1.1.3] - 2026-02-15
6
44
 
7
45
  ### Feat
package/README.md CHANGED
@@ -60,6 +60,59 @@ Button('Submit', {
60
60
  })
61
61
  ```
62
62
 
63
+ ### Advanced Portal System
64
+
65
+ Manage complex UI layers like modals, drawers, and overlays with a powerful stack-based portal system. Supports nested portals and state synchronization.
66
+
67
+ **Key Features:**
68
+ - **Global Layout Integration:** Define the provider and host at the root for app-wide access.
69
+ - **Auto-Sync:** Keep portal content in sync with parent state automatically.
70
+ - **Nested Portals:** Open portals from within other portals easily.
71
+ - **Stack-based management:** Automatically manages multiple overlapping layers.
72
+
73
+ ```typescript
74
+ // 1. Setup at Layout Level
75
+ const RootLayout = ({ children }: { children: ReactNode }) =>
76
+ PortalProvider({
77
+ children: [
78
+ ...children,
79
+ PortalHost() // Portals render here, on top of content
80
+ ]
81
+ })
82
+
83
+ // 2. Define data interface and portal content
84
+ interface MyData {
85
+ count: number;
86
+ setCount: React.Dispatch<React.SetStateAction<number>>;
87
+ }
88
+
89
+ const MyPortalContent = ({ data, close }: PortalLayerProps<MyData>) =>
90
+ Div({
91
+ children: [
92
+ Text(`Count: ${data?.count}`),
93
+ Button('Increment', { onClick: () => data?.setCount(c => c + 1) }),
94
+ Button('Close', { onClick: close })
95
+ ]
96
+ })
97
+
98
+ // 3. Use anywhere in the tree
99
+ const MyComponent = () => {
100
+ const [count, setCount] = useState(0)
101
+ // Auto-sync: portal updates whenever count changes
102
+ const portal = usePortal<MyData>({ count, setCount })
103
+
104
+ return Div({
105
+ children: [
106
+ Button('Open Modal', {
107
+ onClick: () => portal.open(MyPortalContent)
108
+ })
109
+ ]
110
+ })
111
+ }
112
+ ```
113
+
114
+
115
+
63
116
  ### Context-Based Theming
64
117
 
65
118
  Theme values resolve automatically through React Context. Reference semantic tokens anywhere without prop drilling.
@@ -0,0 +1 @@
1
+ "use strict";var e=require("../core.node.cjs"),r=require("./portal-host.client.cjs");const t=e.createNode(r.default);exports.PortalHost=t;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("./portal-provider.client.cjs"),r=require("../hook/useDataChannel.cjs");function n({layer:t,index:n,onClose:a}){const o=r.useDataChannel(t.channel),{Component:l}=t,s=n+1;return e.createElement(l,{data:o,depth:s,close:a})}function a(){const r=e.useContext(t.PortalContext);if(!r)throw new Error("PortalHost must be used within a PortalProvider");const{stack:a,hidePortalById:o}=r;return 0===a.length?null:e.createElement(e.Fragment,null,...a.map((t,r)=>e.createElement(n,{key:t.id,layer:t,index:r,onClose:()=>o(t.id)})))}n.displayName="PortalLayerRenderer",a.displayName="PortalHost",exports.default=a;
@@ -0,0 +1 @@
1
+ "use strict";var e=require("../core.node.cjs"),r=require("./portal-provider.client.cjs");const o=e.createNode(r.default);exports.PortalProvider=o;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("../core.node.cjs"),t=require("../helper/data-channel.helper.cjs");const a=e.createContext(null);exports.PortalContext=a,exports.default=function({children:l}){const[c,n]=e.useState([]),o=e.useRef(0),s=e.useCallback((e,r)=>{const a=++o.current,l=t.createDataChannel(r);return n(r=>[...r,{id:a,Component:e,channel:l}]),{id:a,updateData:e=>l.set(e),close:()=>n(e=>e.filter(e=>e.id!==a))}},[]),u=e.useCallback(()=>{n(e=>e.slice(0,-1))},[]),d=e.useCallback(e=>{n(r=>r.filter(r=>r.id!==e))},[]),i=e.useCallback(()=>{n([])},[]),h=e.useMemo(()=>({stack:c,showPortal:s,hidePortal:u,hidePortalById:d,hideAll:i}),[c,s,u,d,i]);return r.Node(a.Provider,{value:h,children:l}).render()};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("@emotion/react"),t=require("@emotion/cache"),n=require("../core.node.cjs"),o=require("next/navigation.js");exports.default=function({children:s}){const[i]=e.useState(()=>{const e=t({key:"meonode-css"});return e.compat=!0,e}),[a]=e.useState(()=>new Set);return o.useServerInsertedHTML(()=>{const r=Object.keys(i.inserted).filter(e=>!a.has(e));if(0===r.length)return null;r.forEach(e=>a.add(e));const t=r.sort(),n=t.map(e=>i.inserted[e]).join(""),o=t.join(" ");return e.createElement("style",{"data-emotion":`${i.key} ${o}`,dangerouslySetInnerHTML:{__html:n}})}),n.Node(r.CacheProvider,{value:i,children:s}).render()};
@@ -1 +1 @@
1
- "use strict";var e=require("react"),t=require("./helper/react-is.helper.cjs"),n=require("./helper/common.helper.cjs"),r=require("./components/styled-renderer.client.cjs"),o=require("./constant/common.const.cjs"),s=require("./util/mount-tracker.util.cjs"),a=require("./components/meonode-unmounter.client.cjs"),l=require("./util/navigation-cache-manager.util.cjs"),i=require("./util/node.util.cjs");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{static _idCounter=0;instanceId="m"+ ++m._idCounter;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);if(i.NodeUtil.isNodeInstance(e))throw new Error("Invalid element type: MeoNode UI instance provided!");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.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 e=Array.isArray(o)?o:[o],t=e.length;g=new Array(t);for(let n=0;n<t;n++){const t=e[n];if(i.NodeUtil.isNodeInstance(t)){const e=h.get(t);if(!e)throw new Error(`[MeoNode] Missing rendered element for child node: ${t.stableKey}`);g[n]=e}else g[n]=t}}const y={...u,key:s,...c};let _;if(a.element===e.Fragment||t.isFragment(a.element))_=e.createElement(a.element,{key:s},...g);else{_=!d&&(l||!n.hasNoStyleTag(a.element))?e.createElement(r.default,{element:a.element,...y,css:l,suppressHydrationWarning:!0},...g):e.createElement(a.element,y,...g)}if(a!==this&&i.NodeUtil.shouldCacheElement(a)){const e=m.elementCache.get(a.stableKey);if(e)e.prevDeps=a._deps,e.renderedElement=_,e.accessCount+=1;else{const e={prevDeps:a._deps,renderedElement:_,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,_)}else{s.isProcessed=!0;const e=a.props.children;if(e){const t=Array.isArray(e)?e:[e];let n=0;for(let e=0;e<t.length;e++)i.NodeUtil.isNodeInstance(t[e])&&n++;o(p+n);for(let e=t.length-1;e>=0;e--){const n=t[e];if(!i.NodeUtil.isNodeInstance(n))continue;const 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.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
+ "use strict";var e=require("react"),t=require("./helper/react-is.helper.cjs"),n=require("./helper/common.helper.cjs"),s=require("./components/styled-renderer.client.cjs"),r=require("./constant/common.const.cjs"),o=require("./util/mount-tracker.util.cjs"),a=require("./components/meonode-unmounter.client.cjs"),i=require("./util/navigation-cache-manager.util.cjs"),l=require("./util/node.util.cjs");const c=Symbol.for("@meonode/ui/BaseNode/elementCache"),d=Symbol.for("@meonode/ui/BaseNode/navigationStarted"),h=Symbol.for("@meonode/ui/BaseNode/renderContextPool"),u=Symbol.for("@meonode/ui/BaseNode/cacheCleanupRegistry");class p{static _idCounter=0;instanceId="m"+ ++p._idCounter;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(h,()=>[])}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,s={},r){if(!t.isValidElementType(e)){const t=n.getComponentType(e);if(l.NodeUtil.isNodeInstance(e))throw new Error("Invalid element type: MeoNode UI instance provided!");throw new Error(`Invalid element type: ${t} provided!`)}this.element=e,this.rawProps=s,this._deps=r;const{ref:o,children:a,...c}=s;this.stableKey=this._getStableKey(c),l.NodeUtil.isServer||p._navigationStarted||(i.NavigationCacheManagerUtil.getInstance().start(),p._navigationStarted=!0)}get props(){return this._props||(this._props=l.NodeUtil.processProps(this.rawProps,this.stableKey)),this._props}get dependencies(){return this._deps}_getStableKey({key:e,...t}){if(l.NodeUtil.isServer)return;if(this.lastPropsObj===t)return this.lastSignature;this.lastPropsObj=t;const s=Object.keys(t),o=s.length;if(o>100){const e=l.NodeUtil.extractCriticalProps(t,s);this.lastSignature=l.NodeUtil.createPropSignature(this.element,e),r.__DEBUG__&&o>200&&console.warn(`MeoNode: Large props (${o} keys) on "${n.getElementTypeName(this.element)}". Consider splitting.`)}else this.lastSignature=l.NodeUtil.createPropSignature(this.element,t);return null!=e?`${String(e)}:${this.lastSignature}`:this.lastSignature}static get cacheCleanupRegistry(){return n.getGlobalState(u,()=>new FinalizationRegistry(e=>{const{cacheKey:t,instanceId:n}=e,s=p.elementCache.get(t);s?.instanceId===n&&p.elementCache.delete(t),o.MountTrackerUtil.isMounted(t)&&o.MountTrackerUtil.untrackMount(t)}))}render(r=!1){const o=l.NodeUtil.shouldCacheElement(this)?p.elementCache.get(this.stableKey):void 0,i=l.NodeUtil.shouldNodeUpdate(o?.prevDeps,this._deps,r);if(!i&&o?.renderedElement)return o.accessCount+=1,o.renderedElement;const c=!i,d=p.acquireRenderContext();let{workStack:h}=d;const{renderedElements:u}=d;let m=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<m;e++)n[e]=h[e];h=n}};for(h[m++]={node:this,isProcessed:!1,blocked:c};m>0;){const o=h[m-1];if(!o){m--;continue}const{node:a,isProcessed:i,blocked:c}=o;if(i){m--;const{children:r,key:o,css:i,nativeProps:c,disableEmotion:d,...h}=a.props;let g=[];if(r){const e=Array.isArray(r)?r:[r],t=e.length;g=new Array(t);for(let n=0;n<t;n++){const t=e[n];if(l.NodeUtil.isNodeInstance(t)){const e=u.get(t);if(!e)throw new Error(`[MeoNode] Missing rendered element for child node: ${t.stableKey}`);g[n]=e}else g[n]=t}}const y={...h,key:o,...c};let f;if(a.element===e.Fragment||t.isFragment(a.element))f=e.createElement(a.element,{key:o},...g);else{f=!d&&(i||!n.hasNoStyleTag(a.element))?e.createElement(s.default,{element:a.element,...y,css:i,suppressHydrationWarning:!0},...g):e.createElement(a.element,y,...g)}if(a!==this&&l.NodeUtil.shouldCacheElement(a)){const e=p.elementCache.get(a.stableKey);if(e)e.prevDeps=a._deps,e.renderedElement=f,e.accessCount+=1;else{const e={prevDeps:a._deps,renderedElement:f,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)}}u.set(a,f)}else{o.isProcessed=!0;const e=a.props.children;if(e){const t=Array.isArray(e)?e:[e];let n=0;for(let e=0;e<t.length;e++)l.NodeUtil.isNodeInstance(t[e])&&n++;r(m+n);for(let e=t.length-1;e>=0;e--){const n=t[e];if(!l.NodeUtil.isNodeInstance(n))continue;const s=l.NodeUtil.shouldCacheElement(n)?p.elementCache.get(n.stableKey):void 0,r=l.NodeUtil.shouldNodeUpdate(s?.prevDeps,n._deps,c);if(!r&&s?.renderedElement){u.set(n,s.renderedElement);continue}const o=c||!r;h[m++]={node:n,isProcessed:!1,blocked:o}}}}}let o=u.get(this);if(!l.NodeUtil.isServer&&this.stableKey&&(o=e.createElement(a.default,{node:this},o)),l.NodeUtil.shouldCacheElement(this)){const e=p.elementCache.get(this.stableKey);if(e)e.prevDeps=this._deps,e.renderedElement=o,e.accessCount+=1;else{const e={prevDeps:this._deps,renderedElement:o,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 o}finally{for(let e=0;e<m;e++)h[e]=null;p.releaseRenderContext({workStack:h,renderedElements:u})}}static clearCaches(){const e=Array.from(p.elementCache.keys());r.__DEBUG__&&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{r.__DEBUG__&&console.warn(`[MeoNode] Could not unregister ${t} from FinalizationRegistry`)}}}p.elementCache.clear(),o.MountTrackerUtil.cleanup(),r.__DEBUG__&&console.log("[MeoNode] All caches cleared")}}function m(e,t={},n){return new p(e,t,n)}m.clearCaches=p.clearCaches,exports.BaseNode=p,exports.Node=m,exports.createChildrenFirstNode=function(e,t){const n=(n,s,r)=>m(e,{...t,...s,children:n},r);return n.element=e,n},exports.createNode=function(e,t){const n=(n,s)=>m(e,{...t,...n},s);return n.element=e,n};
@@ -0,0 +1 @@
1
+ "use strict";exports.createDataChannel=function(e){let t=e;const n=new Set;return{get:()=>t,set:e=>{t=e,n.forEach(e=>e(t))},subscribe:e=>(n.add(e),()=>{n.delete(e)})}};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use strict";var e=require("react");exports.useDataChannel=function(t){const[r,s]=e.useState(()=>t?.get());return e.useEffect(()=>{if(t)return s(t.get()),t.subscribe(s)},[t]),r};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use strict";var e=require("react"),r=require("../components/portal-provider.client.cjs");exports.usePortal=function(t){const u=e.useContext(r.PortalContext);if(!u)throw new Error("usePortal must be used within a PortalProvider");const a=e.useRef(null);return e.useEffect(()=>{void 0!==t&&a.current&&a.current.updateData(t)},[t]),{open:e.useCallback((e,r)=>{const o=u.showPortal(e,r??t);return a.current=o,o},[u.showPortal,t]),updateData:e.useCallback(e=>{a.current?.updateData(e)},[]),close:e.useCallback(()=>{a.current?.close(),a.current=null},[]),handle:a}};
package/dist/cjs/main.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("./constant/common.const.cjs"),t=require("./core.node.cjs"),r=require("./hoc/portal.hoc.cjs"),o=require("./hoc/component.hoc.cjs");require("react");var s=require("./components/react.node.cjs"),p=require("./components/html.node.cjs"),x=require("./components/theme-provider.cjs"),a=require("./hook/useTheme.cjs");exports.setDebugMode=e.setDebugMode,exports.Node=t.Node,exports.createChildrenFirstNode=t.createChildrenFirstNode,exports.createNode=t.createNode,exports.Portal=r.Portal,exports.Component=o.Component,exports.Activity=s.Activity,exports.Fragment=s.Fragment,exports.Suspense=s.Suspense,exports.A=p.A,exports.Abbr=p.Abbr,exports.Absolute=p.Absolute,exports.Address=p.Address,exports.Area=p.Area,exports.Article=p.Article,exports.Aside=p.Aside,exports.Audio=p.Audio,exports.B=p.B,exports.Base=p.Base,exports.Bdi=p.Bdi,exports.Bdo=p.Bdo,exports.Blockquote=p.Blockquote,exports.Body=p.Body,exports.Br=p.Br,exports.Button=p.Button,exports.Canvas=p.Canvas,exports.Caption=p.Caption,exports.Center=p.Center,exports.Cite=p.Cite,exports.Code=p.Code,exports.Col=p.Col,exports.Colgroup=p.Colgroup,exports.Column=p.Column,exports.Container=p.Container,exports.Data=p.Data,exports.Datalist=p.Datalist,exports.Dd=p.Dd,exports.Details=p.Details,exports.Dfn=p.Dfn,exports.Dialog=p.Dialog,exports.Div=p.Div,exports.Dl=p.Dl,exports.Dt=p.Dt,exports.Em=p.Em,exports.Embed=p.Embed,exports.Fieldset=p.Fieldset,exports.Figcaption=p.Figcaption,exports.Figure=p.Figure,exports.Fixed=p.Fixed,exports.Footer=p.Footer,exports.Form=p.Form,exports.Grid=p.Grid,exports.H1=p.H1,exports.H2=p.H2,exports.H3=p.H3,exports.H4=p.H4,exports.H5=p.H5,exports.H6=p.H6,exports.Head=p.Head,exports.Header=p.Header,exports.Hgroup=p.Hgroup,exports.Hr=p.Hr,exports.Html=p.Html,exports.I=p.I,exports.Iframe=p.Iframe,exports.Img=p.Img,exports.Input=p.Input,exports.Kbd=p.Kbd,exports.Label=p.Label,exports.Legend=p.Legend,exports.Li=p.Li,exports.Link=p.Link,exports.Main=p.Main,exports.MapElement=p.MapElement,exports.Mark=p.Mark,exports.Menu=p.Menu,exports.Meta=p.Meta,exports.Meter=p.Meter,exports.Nav=p.Nav,exports.Noscript=p.Noscript,exports.ObjectElement=p.ObjectElement,exports.Ol=p.Ol,exports.Optgroup=p.Optgroup,exports.Option=p.Option,exports.Output=p.Output,exports.P=p.P,exports.Param=p.Param,exports.Picture=p.Picture,exports.Pre=p.Pre,exports.Progress=p.Progress,exports.Q=p.Q,exports.Relative=p.Relative,exports.Root=p.Root,exports.Row=p.Row,exports.Rp=p.Rp,exports.Rt=p.Rt,exports.Ruby=p.Ruby,exports.S=p.S,exports.Samp=p.Samp,exports.Script=p.Script,exports.Search=p.Search,exports.Section=p.Section,exports.Select=p.Select,exports.Small=p.Small,exports.Source=p.Source,exports.Span=p.Span,exports.Static=p.Static,exports.Sticky=p.Sticky,exports.Strong=p.Strong,exports.Style=p.Style,exports.Sub=p.Sub,exports.Summary=p.Summary,exports.Sup=p.Sup,exports.Svg=p.Svg,exports.SvgCircle=p.SvgCircle,exports.SvgDefs=p.SvgDefs,exports.SvgEllipse=p.SvgEllipse,exports.SvgG=p.SvgG,exports.SvgLine=p.SvgLine,exports.SvgLinearGradient=p.SvgLinearGradient,exports.SvgPath=p.SvgPath,exports.SvgPolygon=p.SvgPolygon,exports.SvgPolyline=p.SvgPolyline,exports.SvgRadialGradient=p.SvgRadialGradient,exports.SvgRect=p.SvgRect,exports.SvgStop=p.SvgStop,exports.SvgSymbol=p.SvgSymbol,exports.SvgText=p.SvgText,exports.SvgTspan=p.SvgTspan,exports.SvgUse=p.SvgUse,exports.Table=p.Table,exports.Tbody=p.Tbody,exports.Td=p.Td,exports.Template=p.Template,exports.Text=p.Text,exports.Textarea=p.Textarea,exports.Tfoot=p.Tfoot,exports.Th=p.Th,exports.Thead=p.Thead,exports.Time=p.Time,exports.Title=p.Title,exports.Tr=p.Tr,exports.Track=p.Track,exports.U=p.U,exports.Ul=p.Ul,exports.Var=p.Var,exports.Video=p.Video,exports.Wbr=p.Wbr,exports.ThemeProvider=x.ThemeProvider,exports.useTheme=a.useTheme;
1
+ "use strict";var e=require("./constant/common.const.cjs"),t=require("./helper/data-channel.helper.cjs"),r=require("./core.node.cjs"),o=require("./hoc/component.hoc.cjs");require("react");var s=require("./components/react.node.cjs"),p=require("./components/html.node.cjs"),x=require("./components/theme-provider.cjs"),a=require("./components/portal-provider.cjs"),i=require("./components/portal-host.cjs"),n=require("./hook/useTheme.cjs"),l=require("./hook/usePortal.cjs"),S=require("./hook/useDataChannel.cjs");exports.setDebugMode=e.setDebugMode,exports.createDataChannel=t.createDataChannel,exports.Node=r.Node,exports.createChildrenFirstNode=r.createChildrenFirstNode,exports.createNode=r.createNode,exports.Component=o.Component,exports.Activity=s.Activity,exports.Fragment=s.Fragment,exports.Suspense=s.Suspense,exports.A=p.A,exports.Abbr=p.Abbr,exports.Absolute=p.Absolute,exports.Address=p.Address,exports.Area=p.Area,exports.Article=p.Article,exports.Aside=p.Aside,exports.Audio=p.Audio,exports.B=p.B,exports.Base=p.Base,exports.Bdi=p.Bdi,exports.Bdo=p.Bdo,exports.Blockquote=p.Blockquote,exports.Body=p.Body,exports.Br=p.Br,exports.Button=p.Button,exports.Canvas=p.Canvas,exports.Caption=p.Caption,exports.Center=p.Center,exports.Cite=p.Cite,exports.Code=p.Code,exports.Col=p.Col,exports.Colgroup=p.Colgroup,exports.Column=p.Column,exports.Container=p.Container,exports.Data=p.Data,exports.Datalist=p.Datalist,exports.Dd=p.Dd,exports.Details=p.Details,exports.Dfn=p.Dfn,exports.Dialog=p.Dialog,exports.Div=p.Div,exports.Dl=p.Dl,exports.Dt=p.Dt,exports.Em=p.Em,exports.Embed=p.Embed,exports.Fieldset=p.Fieldset,exports.Figcaption=p.Figcaption,exports.Figure=p.Figure,exports.Fixed=p.Fixed,exports.Footer=p.Footer,exports.Form=p.Form,exports.Grid=p.Grid,exports.H1=p.H1,exports.H2=p.H2,exports.H3=p.H3,exports.H4=p.H4,exports.H5=p.H5,exports.H6=p.H6,exports.Head=p.Head,exports.Header=p.Header,exports.Hgroup=p.Hgroup,exports.Hr=p.Hr,exports.Html=p.Html,exports.I=p.I,exports.Iframe=p.Iframe,exports.Img=p.Img,exports.Input=p.Input,exports.Kbd=p.Kbd,exports.Label=p.Label,exports.Legend=p.Legend,exports.Li=p.Li,exports.Link=p.Link,exports.Main=p.Main,exports.MapElement=p.MapElement,exports.Mark=p.Mark,exports.Menu=p.Menu,exports.Meta=p.Meta,exports.Meter=p.Meter,exports.Nav=p.Nav,exports.Noscript=p.Noscript,exports.ObjectElement=p.ObjectElement,exports.Ol=p.Ol,exports.Optgroup=p.Optgroup,exports.Option=p.Option,exports.Output=p.Output,exports.P=p.P,exports.Param=p.Param,exports.Picture=p.Picture,exports.Pre=p.Pre,exports.Progress=p.Progress,exports.Q=p.Q,exports.Relative=p.Relative,exports.Root=p.Root,exports.Row=p.Row,exports.Rp=p.Rp,exports.Rt=p.Rt,exports.Ruby=p.Ruby,exports.S=p.S,exports.Samp=p.Samp,exports.Script=p.Script,exports.Search=p.Search,exports.Section=p.Section,exports.Select=p.Select,exports.Small=p.Small,exports.Source=p.Source,exports.Span=p.Span,exports.Static=p.Static,exports.Sticky=p.Sticky,exports.Strong=p.Strong,exports.Style=p.Style,exports.Sub=p.Sub,exports.Summary=p.Summary,exports.Sup=p.Sup,exports.Svg=p.Svg,exports.SvgCircle=p.SvgCircle,exports.SvgDefs=p.SvgDefs,exports.SvgEllipse=p.SvgEllipse,exports.SvgG=p.SvgG,exports.SvgLine=p.SvgLine,exports.SvgLinearGradient=p.SvgLinearGradient,exports.SvgPath=p.SvgPath,exports.SvgPolygon=p.SvgPolygon,exports.SvgPolyline=p.SvgPolyline,exports.SvgRadialGradient=p.SvgRadialGradient,exports.SvgRect=p.SvgRect,exports.SvgStop=p.SvgStop,exports.SvgSymbol=p.SvgSymbol,exports.SvgText=p.SvgText,exports.SvgTspan=p.SvgTspan,exports.SvgUse=p.SvgUse,exports.Table=p.Table,exports.Tbody=p.Tbody,exports.Td=p.Td,exports.Template=p.Template,exports.Text=p.Text,exports.Textarea=p.Textarea,exports.Tfoot=p.Tfoot,exports.Th=p.Th,exports.Thead=p.Thead,exports.Time=p.Time,exports.Title=p.Title,exports.Tr=p.Tr,exports.Track=p.Track,exports.U=p.U,exports.Ul=p.Ul,exports.Var=p.Var,exports.Video=p.Video,exports.Wbr=p.Wbr,exports.ThemeProvider=x.ThemeProvider,exports.PortalProvider=a.PortalProvider,exports.PortalHost=i.PortalHost,exports.useTheme=n.useTheme,exports.usePortal=l.usePortal,exports.useDataChannel=S.useDataChannel;
@@ -1 +1 @@
1
- "use strict";var e=require("../components/registry.client.cjs");const r=require("../core.node.cjs").createNode(e.default);exports.StyleRegistry=r;
1
+ "use strict";var e=require("../components/style-registry.client.cjs");const r=require("../core.node.cjs").createNode(e.default);exports.StyleRegistry=r;
@@ -1 +1 @@
1
- "use strict";var e=require("react"),t=require("../helper/react-is.helper.cjs"),r=require("../helper/common.helper.cjs"),o=require("../constant/common.const.cjs"),n=require("../core.node.cjs"),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 r.getGlobalState(i,()=>new WeakMap)}static CRITICAL_PROPS=new Set(["css","className","disableEmotion","props"]);static _propFuncCache=new WeakMap;static get portalInfrastructure(){return r.getGlobalState(a,()=>new WeakMap)}static isNodeInstance=e=>e instanceof n.BaseNode;static isStyleProp=c.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=Math.imul(r,33)^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(c.isServer)return;const o=r.getElementTypeName(e),n=Object.keys(t);n.length>1&&n.sort();const s=[`${o}:`];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 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){let t=c._propFuncCache.get(r);t||(t=c.hashString(r.toString()),c._propFuncCache.set(r,t)),o=`${e}:${t};`}else{o=`${e}:{${Object.keys(r).sort().join(",")}};`}s.push(o)}return c.hashString(s.join(","))}static extractCriticalProps(e,t){const r={_keyCount:t.length};let o=0;for(const n of t){if(o>=50)break;if(c.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&&c.isStyleProp(n)&&(r[n]=e[n],o++):(r[n]=e[n],o++):(r[n]=e[n],o++)}return r}static processProps(e={},t){const{ref:o,key:n,children:s,css:i,props:a={},disableEmotion:d,...l}=e;if(0===Object.keys(l).length&&!i)return r.omitUndefined({ref:o,key:n,disableEmotion:d,nativeProps:r.omitUndefined(a),children:c._processChildren(s,d)});const u={},p={},f=Object.keys(l);for(let e=0;e<f.length;e++){const t=f[e],r=l[t],o=typeof r;"string"===o||"number"===o||"boolean"===o?u[t]=r:p[t]=r}const m=r.getCSSProps(u),h=r.getCSSProps(p),y=r.getDOMProps(l),g={...m,...h,...i},b=c._processChildren(s,d,t);return r.omitUndefined({ref:o,key:n,css:g,...y,disableEmotion:d,nativeProps:r.omitUndefined(a),children:b})}static _processChildren(e,t,r){if(e)return"function"==typeof e?e:Array.isArray(e)?1===e.length?c.processRawNode(e[0],t,`${r}_0`):e.map((e,o)=>c.processRawNode(e,t,`${r}_${o}`)):c.processRawNode(e,t,r)}static shouldCacheElement(e){return!c.isServer&&!!e.stableKey&&!!e.dependencies}static shouldNodeUpdate(e,t,r){if(c.isServer)return!0;if(r)return!1;if(void 0===t)return!0;if(void 0===e)return!0;if(t.length!==e.length)return!0;for(let r=0;r<t.length;r++)if(!Object.is(t[r],e[r]))return!0;return!1}static processRawNode(r,o,s){if(null==r||"string"==typeof r||"number"==typeof r||"boolean"==typeof r)return r;if(c.isNodeInstance(r)){if(s||o&&!r.rawProps.disableEmotion){const e=new n.BaseNode(r.element,r.rawProps,r.dependencies);return e.stableKey=`${s}:${e.stableKey}`,o&&!e.rawProps.disableEmotion&&(e.rawProps.disableEmotion=!0),e}return r}if(c.isFunctionChild(r))return new n.BaseNode(c.functionRenderer,{props:{render:r,disableEmotion:o}},void 0);if(e.isValidElement(r)){if("string"==typeof r.type){const{style:e,...t}=r.props,s={...t,...e||{}};return new n.BaseNode(r.type,{...s,...null!==r.key&&void 0!==r.key?{key:r.key}:{},disableEmotion:o},void 0)}return new n.BaseNode(r.type,{...r.props,...null!==r.key&&void 0!==r.key?{key:r.key}:{},disableEmotion:o},void 0)}return t.isReactClassComponent(r)||t.isMemo(r)||t.isForwardRef(r)?new n.BaseNode(r,{disableEmotion:o},void 0):r instanceof e.Component?c.processRawNode(r.render(),o,s):r}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 o.__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){o.__DEBUG__&&console.error("MeoNode: Error executing function-as-a-child.",e),i=null}if(null==i||"string"==typeof i||"number"==typeof i||"boolean"==typeof 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`${r.getElementTypeName(e)}-${t}`}catch(e){return o.__DEBUG__&&console.error("MeoNode: Could not determine element type name for key in function-as-a-child.",e),`item-${t}`}};return i.map((t,r)=>c.renderProcessedNode({processedElement:c.processRawNode(t,s),passedKey:e(t,r),disableEmotion:s}))}if(i instanceof e.Component)return c.renderProcessedNode({processedElement:c.processRawNode(i.render(),s),disableEmotion:s});const a=c.processRawNode(i,s);return a?c.renderProcessedNode({processedElement:a,disableEmotion:s}):i}static renderProcessedNode({processedElement:r,passedKey:o,disableEmotion:s}){const i={};if(void 0!==o&&(i.key=o),c.isNodeInstance(r)){const e=r.rawProps?.key;return r.rawProps.disableEmotion=s,e===o?r.render():new n.BaseNode(r.element,{...r.rawProps,...i}).render()}return t.isReactClassComponent(r)?new n.BaseNode(r,{...i,disableEmotion:s}).render():r instanceof e.Component?r.render():"function"==typeof r?e.createElement(r,{key:o}):r}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){o.__DEBUG__&&console.error("MeoNode: Error unmounting stale portal root.",e)}c.cleanupPortalInfra(t),c.portalInfrastructure.delete(e),t=void 0}const r=document.createElement("div");document.body.appendChild(r);const i=s.createRoot(r),a={render:i.render.bind(i),unmount:i.unmount.bind(i),update:()=>{}};return t={domElement:r,reactRoot:a,instanceId:e.instanceId},c.portalInfrastructure.set(e,t),n.BaseNode.portalCleanupRegistry.register(e,{domElement:r,reactRoot:a},e),!0}static cleanupPortalInfra(e){try{e.reactRoot?.unmount&&e.reactRoot.unmount()}catch(e){o.__DEBUG__&&console.error("Portal cleanup error:",e)}try{e.domElement?.isConnected&&e.domElement.remove()}catch(e){o.__DEBUG__&&console.error("DOM removal error:",e)}}}exports.NodeUtil=c;
1
+ "use strict";var e=require("react"),t=require("../helper/react-is.helper.cjs"),o=require("../helper/common.helper.cjs"),n=require("../constant/common.const.cjs"),r=require("../core.node.cjs");const s=Symbol.for("@meonode/ui/NodeUtil/functionSignatureCache");class i{constructor(){}static isServer="undefined"==typeof window;static get _functionSignatureCache(){return o.getGlobalState(s,()=>new WeakMap)}static CRITICAL_PROPS=new Set(["css","className","disableEmotion","props"]);static _propFuncCache=new WeakMap;static isNodeInstance=e=>e instanceof r.BaseNode;static isStyleProp=i.isServer||"undefined"==typeof document?()=>!1:e=>e in document.body.style;static hashString(e){let t=2166136261,o=5381;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);t^=r,t=Math.imul(t,16777619),o=Math.imul(o,33)^r}return`${(t>>>0).toString(36)}_${(o>>>0).toString(36)}`}static hashCSS(e){const t=Object.keys(e);let o=t.length;for(let n=0;n<Math.min(t.length,10);n++){const r=t[n],s=e[r];o=(o<<5)-o+r.charCodeAt(0),o&=o,"string"==typeof s&&(o=(o<<5)-o+s.length)}return o.toString(36)}static createPropSignature(e,t){if(i.isServer)return;const n=o.getElementTypeName(e),r=Object.keys(t);r.length>1&&r.sort();const s=[`${n}:`];if("function"==typeof e){let t=i._functionSignatureCache.get(e);t||(t=i.hashString(e.toString()),i._functionSignatureCache.set(e,t)),s.push(t)}for(const e of r){const o=t[e];let n;const r=typeof o;if("string"===r||"number"===r||"boolean"===r)n=`${e}:${o};`;else if(null===o)n=`${e}:null;`;else if(void 0===o)n=`${e}:undefined;`;else if("css"===e&&"object"==typeof o)n=`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});n=t.length===o.length?`${e}:[${t.join(",")}];`:`${e}:[${o.length}];`}else if(o&&o.isBaseNode)n=`${e}:${o.stableKey};`;else if("function"===r){let t=i._propFuncCache.get(o);t||(t=i.hashString(o.toString()),i._propFuncCache.set(o,t)),n=`${e}:${t};`}else{n=`${e}:{${Object.keys(o).sort().join(",")}};`}s.push(n)}return i.hashString(s.join(","))}static extractCriticalProps(e,t){const o={_keyCount:t.length};let n=0;for(const r of t){if(n>=50)break;if(i.CRITICAL_PROPS.has(r)){o[r]=e[r],n++;continue}const s=r.charCodeAt(0);111!==s||110!==r.charCodeAt(1)?!(97===s&&114===r.charCodeAt(1)&&105===r.charCodeAt(2)&&97===r.charCodeAt(3)||100===s&&97===r.charCodeAt(1)&&116===r.charCodeAt(2)&&97===r.charCodeAt(3))?t.length<=100&&i.isStyleProp(r)&&(o[r]=e[r],n++):(o[r]=e[r],n++):(o[r]=e[r],n++)}return o}static processProps(e={},t){const{ref:n,key:r,children:s,css:a,props:c={},disableEmotion:d,...l}=e;if(0===Object.keys(l).length&&!a)return o.omitUndefined({ref:n,key:r,disableEmotion:d,nativeProps:o.omitUndefined(c),children:i._processChildren(s,d)});const p={},u={},f=Object.keys(l);for(let e=0;e<f.length;e++){const t=f[e],o=l[t],n=typeof o;"string"===n||"number"===n||"boolean"===n?p[t]=o:u[t]=o}const h=o.getCSSProps(p),m=o.getCSSProps(u),y=o.getDOMProps(l),g={...h,...m,...a},b=i._processChildren(s,d,t);return o.omitUndefined({ref:n,key:r,css:g,...y,disableEmotion:d,nativeProps:o.omitUndefined(c),children:b})}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,n)=>i.processRawNode(e,t,`${o}_${n}`)):i.processRawNode(e,t,o)}static shouldCacheElement(e){return!i.isServer&&!!e.stableKey&&!!e.dependencies}static shouldNodeUpdate(e,t,o){if(i.isServer)return!0;if(o)return!1;if(void 0===t)return!0;if(void 0===e)return!0;if(t.length!==e.length)return!0;for(let o=0;o<t.length;o++)if(!Object.is(t[o],e[o]))return!0;return!1}static processRawNode(o,n,s){if(null==o||"string"==typeof o||"number"==typeof o||"boolean"==typeof o)return o;if(i.isNodeInstance(o)){if(s||n&&!o.rawProps.disableEmotion){const e=new r.BaseNode(o.element,o.rawProps,o.dependencies);return e.stableKey=`${s}:${e.stableKey}`,n&&!e.rawProps.disableEmotion&&(e.rawProps.disableEmotion=!0),e}return o}if(i.isFunctionChild(o))return new r.BaseNode(i.functionRenderer,{props:{render:o,disableEmotion:n}},void 0);if(e.isValidElement(o)){if("string"==typeof o.type){const{style:e,...t}=o.props,s={...t,...e||{}};return new r.BaseNode(o.type,{...s,...null!==o.key&&void 0!==o.key?{key:o.key}:{},disableEmotion:n},void 0)}return new r.BaseNode(o.type,{...o.props,...null!==o.key&&void 0!==o.key?{key:o.key}:{},disableEmotion:n},void 0)}return t.isReactClassComponent(o)||t.isMemo(o)||t.isForwardRef(o)?new r.BaseNode(o,{disableEmotion:n},void 0):o instanceof e.Component?i.processRawNode(o.render(),n,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 n.__DEBUG__&&console.error("MeoNode: Error checking if a node is a function child.",e),!0}}static functionRenderer({render:t,disableEmotion:s}){let a;try{a=t()}catch(e){n.__DEBUG__&&console.error("MeoNode: Error executing function-as-a-child.",e),a=null}if(null==a||"string"==typeof a||"number"==typeof a||"boolean"==typeof a)return a;if(i.isNodeInstance(a))return s&&!a.rawProps.disableEmotion?new r.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 n.__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,s),passedKey:e(t,o),disableEmotion:s}))}if(a instanceof e.Component)return i.renderProcessedNode({processedElement:i.processRawNode(a.render(),s),disableEmotion:s});const c=i.processRawNode(a,s);return c?i.renderProcessedNode({processedElement:c,disableEmotion:s}):a}static renderProcessedNode({processedElement:o,passedKey:n,disableEmotion:s}){const a={};if(void 0!==n&&(a.key=n),i.isNodeInstance(o)){const e=o.rawProps?.key;return o.rawProps.disableEmotion=s,e===n?o.render():new r.BaseNode(o.element,{...o.rawProps,...a}).render()}return t.isReactClassComponent(o)?new r.BaseNode(o,{...a,disableEmotion:s}).render():o instanceof e.Component?o.render():"function"==typeof o?e.createElement(o,{key:n}):o}}exports.NodeUtil=i;
@@ -0,0 +1,26 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { PortalStackEntry } from '../types/node.type.js';
3
+ /**
4
+ * Renders a single portal layer, subscribing to its data channel.
5
+ * Passes `{ data, depth, close }` props to the user's component.
6
+ * @internal
7
+ */
8
+ declare function PortalLayerRenderer({ layer, index, onClose }: {
9
+ layer: PortalStackEntry;
10
+ index: number;
11
+ onClose: () => void;
12
+ }): ReactNode;
13
+ declare namespace PortalLayerRenderer {
14
+ var displayName: string;
15
+ }
16
+ /**
17
+ * Renders the portal stack. Place this component where portal layers should appear in the DOM.
18
+ * Renders nothing when the stack is empty.
19
+ * Must be used within a `PortalProvider`.
20
+ */
21
+ declare function PortalHost(): ReactNode;
22
+ export default PortalHost;
23
+ declare namespace PortalHost {
24
+ var displayName: string;
25
+ }
26
+ //# sourceMappingURL=portal-host.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal-host.client.d.ts","sourceRoot":"","sources":["../../../src/components/portal-host.client.ts"],"names":[],"mappings":"AACA,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAG3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE/D;;;;GAIG;AACH,iBAAS,mBAAmB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;IAAE,KAAK,EAAE,gBAAgB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,GAAG,SAAS,CAMlI;;;;AAGD;;;;GAIG;AACH,iBAAwB,UAAU,IAAI,SAAS,CAuB9C"}
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{useContext as o,createElement as e,Fragment as r}from"react";import{PortalContext as t}from"./portal-provider.client.js";import{useDataChannel as n}from"../hook/useDataChannel.js";function a({layer:o,index:r,onClose:t}){const a=n(o.channel),{Component:l}=o;return e(l,{data:a,depth:r+1,close:t})}function l(){const n=o(t);if(!n)throw new Error("PortalHost must be used within a PortalProvider");const{stack:l,hidePortalById:i}=n;return 0===l.length?null:e(r,null,...l.map((o,r)=>e(a,{key:o.id,layer:o,index:r,onClose:()=>i(o.id)})))}a.displayName="PortalLayerRenderer",l.displayName="PortalHost";export{l as default};
@@ -0,0 +1,9 @@
1
+ import _PortalHost from '../components/portal-host.client.js';
2
+ /**
3
+ * Renders the portal stack. Place this where portal layers should appear in the DOM.
4
+ * Must be used within a `PortalProvider`.
5
+ */
6
+ export declare const PortalHost: (<AdditionalProps, ExactProps extends object = object>(props?: import("../main").MergedProps<typeof _PortalHost, AdditionalProps, ExactProps> | undefined, deps?: import("../main").DependencyList | undefined) => import("../main").NodeInstance<typeof _PortalHost>) & {
7
+ element: typeof _PortalHost;
8
+ };
9
+ //# sourceMappingURL=portal-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal-host.d.ts","sourceRoot":"","sources":["../../../src/components/portal-host.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,uCAAuC,CAAA;AAE/D;;;GAGG;AACH,eAAO,MAAM,UAAU;;CAA0B,CAAA"}
@@ -0,0 +1 @@
1
+ import{createNode as o}from"../core.node.js";import r from"./portal-host.client.js";const t=o(r);export{t as PortalHost};
@@ -0,0 +1,14 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { Children, PortalContextValue } from '../types/node.type.js';
3
+ export declare const PortalContext: import("react").Context<PortalContextValue | null>;
4
+ /**
5
+ * Provides portal context to the component tree.
6
+ * Manages the portal stack state and exposes methods for opening/closing portals.
7
+ * Must wrap any components that use `usePortal()` or `PortalHost`.
8
+ * @param children The children to render.
9
+ * @returns The rendered component tree with portal context.
10
+ */
11
+ export default function PortalProvider({ children }: {
12
+ children?: Children;
13
+ }): ReactNode;
14
+ //# sourceMappingURL=portal-provider.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal-provider.client.d.ts","sourceRoot":"","sources":["../../../src/components/portal-provider.client.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,SAAS,EAA0C,MAAM,OAAO,CAAA;AAC7F,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAoD,MAAM,yBAAyB,CAAA;AAI7H,eAAO,MAAM,aAAa,oDAAiD,CAAA;AAE3E;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,GAAG,SAAS,CAmCvF"}
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{createContext as e,useState as r,useRef as t,useCallback as o,useMemo as l}from"react";import{Node as n}from"../core.node.js";import{createDataChannel as i}from"../helper/data-channel.helper.js";const d=e(null);function a({children:e}){const[a,c]=r([]),s=t(0),h=o((e,r)=>{const t=++s.current,o=i(r);return c(r=>[...r,{id:t,Component:e,channel:o}]),{id:t,updateData:e=>o.set(e),close:()=>c(e=>e.filter(e=>e.id!==t))}},[]),p=o(()=>{c(e=>e.slice(0,-1))},[]),u=o(e=>{c(r=>r.filter(r=>r.id!==e))},[]),f=o(()=>{c([])},[]),m=l(()=>({stack:a,showPortal:h,hidePortal:p,hidePortalById:u,hideAll:f}),[a,h,p,u,f]);return n(d.Provider,{value:m,children:e}).render()}export{d as PortalContext,a as default};
@@ -0,0 +1,9 @@
1
+ import _PortalProvider from '../components/portal-provider.client.js';
2
+ /**
3
+ * A component that provides portal context to its children.
4
+ * Must wrap any components that use `usePortal()` or `PortalHost`.
5
+ */
6
+ export declare const PortalProvider: (<AdditionalProps, ExactProps extends object = object>(props?: import("../main").MergedProps<typeof _PortalProvider, AdditionalProps, ExactProps> | undefined, deps?: import("../main").DependencyList | undefined) => import("../main").NodeInstance<typeof _PortalProvider>) & {
7
+ element: typeof _PortalProvider;
8
+ };
9
+ //# sourceMappingURL=portal-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal-provider.d.ts","sourceRoot":"","sources":["../../../src/components/portal-provider.ts"],"names":[],"mappings":"AACA,OAAO,eAAe,MAAM,2CAA2C,CAAA;AAEvE;;;GAGG;AACH,eAAO,MAAM,cAAc;;CAA8B,CAAA"}
@@ -0,0 +1 @@
1
+ import{createNode as o}from"../core.node.js";import r from"./portal-provider.client.js";const t=o(r);export{t as PortalProvider};
@@ -10,4 +10,4 @@ import { type ReactElement } from 'react';
10
10
  export default function StyleRegistry({ children }: {
11
11
  children: ReactElement;
12
12
  }): ReactElement<import("../main").FinalNodeProps, string | import("react").JSXElementConstructor<any>>;
13
- //# sourceMappingURL=registry.client.d.ts.map
13
+ //# sourceMappingURL=style-registry.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-registry.client.d.ts","sourceRoot":"","sources":["../../../src/components/style-registry.client.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,YAAY,EAAY,MAAM,OAAO,CAAA;AAWlE;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,YAAY,CAAA;CAAE,yGAqC7E"}
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{useState as e,createElement as t}from"react";import{CacheProvider as o}from"@emotion/react";import r from"@emotion/cache";import{Node as n}from"../core.node.js";import{useServerInsertedHTML as i}from"next/navigation.js";function m({children:m}){const[a]=e(()=>{const e=r({key:"meonode-css"});return e.compat=!0,e}),[c]=e(()=>new Set);return i(()=>{const e=Object.keys(a.inserted).filter(e=>!c.has(e));if(0===e.length)return null;e.forEach(e=>c.add(e));const o=e.sort(),r=o.map(e=>a.inserted[e]).join(""),n=o.join(" ");return t("style",{"data-emotion":`${a.key} ${n}`,dangerouslySetInnerHTML:{__html:r}})}),n(o,{value:a,children:m}).render()}export{m as default};
@@ -1,5 +1,5 @@
1
1
  import { type ReactElement } from 'react';
2
- import type { Children, DependencyList, ElementCacheEntry, FinalNodeProps, HasRequiredProps, MergedProps, NodeElementType, NodeInstance, NodePortal, NodeProps, PropsOf } from './types/node.type.js';
2
+ import type { Children, DependencyList, ElementCacheEntry, FinalNodeProps, HasRequiredProps, MergedProps, NodeElementType, NodeInstance, 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.
@@ -66,27 +66,6 @@ export declare class BaseNode<E extends NodeElementType = NodeElementType> {
66
66
  cacheKey: string;
67
67
  instanceId: string;
68
68
  }>;
69
- /**
70
- * FinalizationRegistry for cleaning up portal DOM containers and their associated React roots
71
- * when the owning `BaseNode` instance is garbage-collected.
72
- *
73
- * The held value must include:
74
- * - `domElement`: the container `HTMLDivElement` appended to `document.body`.
75
- * - `reactRoot`: an object with an `unmount()` method to unmount the React root.
76
- *
77
- * On cleanup the registry handler will attempt to:
78
- * 1. Unmount the React root (errors are swallowed in non-production builds with logging).
79
- * 2. Remove the `domElement` from the DOM if it is still connected.
80
- *
81
- * This prevents detached portal containers from leaking memory in long-running client apps.
82
- * @internal
83
- */
84
- static get portalCleanupRegistry(): FinalizationRegistry<{
85
- domElement: HTMLDivElement;
86
- reactRoot: {
87
- unmount(): void;
88
- };
89
- }>;
90
69
  /**
91
70
  * Renders the `BaseNode` and its entire subtree into a ReactElement, with support for opt-in reactivity
92
71
  * via dependency arrays and inherited blocking.
@@ -102,12 +81,6 @@ export declare class BaseNode<E extends NodeElementType = NodeElementType> {
102
81
  * @method render
103
82
  */
104
83
  render(parentBlocked?: boolean): ReactElement<FinalNodeProps>;
105
- /**
106
- * Renders the node into a React Portal, mounting it directly under `document.body`.
107
- * Returns a handle with `update` and `unmount` methods to control the portal's lifecycle.
108
- * @method toPortal
109
- */
110
- toPortal(): NodePortal;
111
84
  /**
112
85
  * A static method to clear all internal caches.
113
86
  *
@@ -1 +1 @@
1
- {"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../../src/core.node.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,YAAY,EAElB,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,YAAY,EACZ,UAAU,EACV,SAAS,EACT,OAAO,EAER,MAAM,yBAAyB,CAAA;AAgBhC;;;;;;GAMG;AACH,qBAAa,QAAQ,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe;IAC/D,OAAO,CAAC,MAAM,CAAC,UAAU,CAAI;IACtB,UAAU,EAAE,MAAM,CAA8B;IAEhD,OAAO,EAAE,CAAC,CAAA;IACV,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAK;IAC3C,SAAgB,UAAU,QAAO;IAEjC,OAAO,CAAC,MAAM,CAAC,CAAgB;IAC/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAgB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAGzB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAEtC,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB,WAAkB,YAAY,oDAE7B;IAGD,OAAO,CAAC,MAAM,KAAK,kBAAkB,GAEpC;IAED,OAAO,CAAC,MAAM,KAAK,kBAAkB,QAEpC;IAGD,OAAO,CAAC,MAAM,KAAK,iBAAiB,GAEnC;IAED,OAAO,CAAC,MAAM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AAO,EAAE,CAAC,CAAA;CACX,CAQJ"}
@@ -1 +1 @@
1
- import{Fragment as e,createElement as t}from"react";import{isValidElementType as n,isFragment as r}from"./helper/react-is.helper.js";import{getGlobalState as o,getComponentType as s,hasNoStyleTag as a,getElementTypeName as i}from"./helper/common.helper.js";import l from"./components/styled-renderer.client.js";import{__DEBUG__ as c}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 u}from"./util/navigation-cache-manager.util.js";import{NodeUtil as m}from"./util/node.util.js";const p=Symbol.for("@meonode/ui/BaseNode/elementCache"),g=Symbol.for("@meonode/ui/BaseNode/navigationStarted"),y=Symbol.for("@meonode/ui/BaseNode/renderContextPool"),f=Symbol.for("@meonode/ui/BaseNode/cacheCleanupRegistry"),C=Symbol.for("@meonode/ui/BaseNode/portalCleanupRegistry");class w{static _idCounter=0;instanceId="m"+ ++w._idCounter;element;rawProps={};isBaseNode=!0;_props;_deps;stableKey;lastPropsObj;lastSignature;static get elementCache(){return o(p,()=>new Map)}static get _navigationStarted(){return o(g,()=>({value:!1})).value}static set _navigationStarted(e){o(g,()=>({value:!1})).value=e}static get renderContextPool(){return o(y,()=>[])}static acquireRenderContext(){const e=w.renderContextPool;return e.length>0?e.pop():{workStack:new Array(512),renderedElements:new Map}}static releaseRenderContext(e){w.renderContextPool.length<50&&e.workStack.length<2048&&(e.workStack.length=0,e.renderedElements.clear(),w.renderContextPool.push(e))}constructor(e,t={},r){if(!n(e)){const t=s(e);if(m.isNodeInstance(e))throw new Error("Invalid element type: MeoNode UI instance provided!");throw new Error(`Invalid element type: ${t} provided!`)}this.element=e,this.rawProps=t,this._deps=r;const{ref:o,children:a,...i}=t;this.stableKey=this._getStableKey(i),m.isServer||w._navigationStarted||(u.getInstance().start(),w._navigationStarted=!0)}get props(){return this._props||(this._props=m.processProps(this.rawProps,this.stableKey)),this._props}get dependencies(){return this._deps}_getStableKey({key:e,...t}){if(m.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=m.extractCriticalProps(t,n);this.lastSignature=m.createPropSignature(this.element,e),c&&r>200&&console.warn(`MeoNode: Large props (${r} keys) on "${i(this.element)}". Consider splitting.`)}else this.lastSignature=m.createPropSignature(this.element,t);return null!=e?`${String(e)}:${this.lastSignature}`:this.lastSignature}static get cacheCleanupRegistry(){return o(f,()=>new FinalizationRegistry(e=>{const{cacheKey:t,instanceId:n}=e,r=w.elementCache.get(t);r?.instanceId===n&&w.elementCache.delete(t),d.isMounted(t)&&d.untrackMount(t)}))}static get portalCleanupRegistry(){return o(C,()=>new FinalizationRegistry(e=>{const{domElement:t,reactRoot:n}=e;c&&console.log("[MeoNode] FinalizationRegistry auto-cleaning portal");try{n&&"function"==typeof n.unmount&&n.unmount()}catch(e){c&&console.error("[MeoNode] Portal auto-cleanup unmount error:",e)}try{t?.isConnected&&t.remove()}catch(e){c&&console.error("[MeoNode] Portal auto-cleanup DOM removal error:",e)}}))}render(n=!1){const o=m.shouldCacheElement(this)?w.elementCache.get(this.stableKey):void 0,s=m.shouldNodeUpdate(o?.prevDeps,this._deps,n);if(!s&&o?.renderedElement)return o.accessCount+=1,o.renderedElement;const i=!s,c=w.acquireRenderContext();let{workStack:d}=c;const{renderedElements:u}=c;let p=0;try{const n=e=>{if(e>d.length){const t=Math.max(e,d.length<<1),n=new Array(t);for(let e=0;e<p;e++)n[e]=d[e];d=n}};for(d[p++]={node:this,isProcessed:!1,blocked:i};p>0;){const o=d[p-1];if(!o){p--;continue}const{node:s,isProcessed:i,blocked:c}=o;if(i){p--;const{children:n,key:o,css:i,nativeProps:c,disableEmotion:d,...h}=s.props;let g=[];if(n){const e=Array.isArray(n)?n:[n],t=e.length;g=new Array(t);for(let n=0;n<t;n++){const t=e[n];if(m.isNodeInstance(t)){const e=u.get(t);if(!e)throw new Error(`[MeoNode] Missing rendered element for child node: ${t.stableKey}`);g[n]=e}else g[n]=t}}const y={...h,key:o,...c};let f;if(s.element===e||r(s.element))f=t(s.element,{key:o},...g);else{f=!d&&(i||!a(s.element))?t(l,{element:s.element,...y,css:i,suppressHydrationWarning:!0},...g):t(s.element,y,...g)}if(s!==this&&m.shouldCacheElement(s)){const e=w.elementCache.get(s.stableKey);if(e)e.prevDeps=s._deps,e.renderedElement=f,e.accessCount+=1;else{const e={prevDeps:s._deps,renderedElement:f,nodeRef:new WeakRef(s),createdAt:Date.now(),accessCount:1,instanceId:s.instanceId};w.elementCache.set(s.stableKey,e),w.cacheCleanupRegistry.register(s,{cacheKey:s.stableKey,instanceId:s.instanceId},s)}}u.set(s,f)}else{o.isProcessed=!0;const e=s.props.children;if(e){const t=Array.isArray(e)?e:[e];let r=0;for(let e=0;e<t.length;e++)m.isNodeInstance(t[e])&&r++;n(p+r);for(let e=t.length-1;e>=0;e--){const n=t[e];if(!m.isNodeInstance(n))continue;const r=m.shouldCacheElement(n)?w.elementCache.get(n.stableKey):void 0,o=m.shouldNodeUpdate(r?.prevDeps,n._deps,c);if(!o&&r?.renderedElement){u.set(n,r.renderedElement);continue}const s=c||!o;d[p++]={node:n,isProcessed:!1,blocked:s}}}}}let o=u.get(this);if(!m.isServer&&this.stableKey&&(o=t(h,{node:this},o)),m.shouldCacheElement(this)){const e=w.elementCache.get(this.stableKey);if(e)e.prevDeps=this._deps,e.renderedElement=o,e.accessCount+=1;else{const e={prevDeps:this._deps,renderedElement:o,nodeRef:new WeakRef(this),createdAt:Date.now(),accessCount:1,instanceId:this.instanceId};w.elementCache.set(this.stableKey,e),w.cacheCleanupRegistry.register(this,{cacheKey:this.stableKey,instanceId:this.instanceId},this)}}return o}finally{for(let e=0;e<p;e++)d[e]=null;w.releaseRenderContext({workStack:d,renderedElements:u})}}toPortal(){if(!m.ensurePortalInfrastructure(this))throw new Error("toPortal() can only be called in a client-side environment");const e=m.portalInfrastructure.get(this),{domElement:t,reactRoot:n}=e;(()=>{try{n.render(this.render())}catch(e){c&&console.error("[MeoNode] Portal render error:",e)}})();let r=!1;const o=n.unmount.bind(n);return n.unmount=()=>{if(r)c&&console.warn("[MeoNode] Portal already unmounted");else{r=!0;try{w.portalCleanupRegistry.unregister(this)}catch(e){c&&console.warn("[MeoNode] Portal unregister warning:",e)}m.portalInfrastructure.delete(this);try{t?.isConnected&&o()}catch(e){c&&console.error("[MeoNode] Portal unmount error:",e)}try{t?.isConnected&&t.remove()}catch(e){c&&console.error("[MeoNode] Portal DOM cleanup error:",e)}}},n}static clearCaches(){const e=Array.from(w.elementCache.keys());c&&console.log(`[MeoNode] clearCaches: Clearing ${e.length} entries`);for(const t of e){const e=w.elementCache.get(t);if(e){const n=e.nodeRef?.deref();if(n)try{w.cacheCleanupRegistry.unregister(n),n.lastSignature=void 0,n.lastPropsObj=void 0}catch{c&&console.warn(`[MeoNode] Could not unregister ${t} from FinalizationRegistry`)}}}w.elementCache.clear(),d.cleanup(),c&&console.log("[MeoNode] All caches cleared")}}function v(e,t={},n){return new w(e,t,n)}function b(e,t){const n=(n,r)=>v(e,{...t,...n},r);return n.element=e,n}function P(e,t){const n=(n,r,o)=>v(e,{...t,...r,children:n},o);return n.element=e,n}v.clearCaches=w.clearCaches;export{w as BaseNode,v as Node,P as createChildrenFirstNode,b as createNode};
1
+ import{Fragment as e,createElement as t}from"react";import{isValidElementType as n,isFragment as s}from"./helper/react-is.helper.js";import{getGlobalState as r,getComponentType as o,hasNoStyleTag as i,getElementTypeName as a}from"./helper/common.helper.js";import l from"./components/styled-renderer.client.js";import{__DEBUG__ as c}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 m}from"./util/navigation-cache-manager.util.js";import{NodeUtil as p}from"./util/node.util.js";const u=Symbol.for("@meonode/ui/BaseNode/elementCache"),g=Symbol.for("@meonode/ui/BaseNode/navigationStarted"),f=Symbol.for("@meonode/ui/BaseNode/renderContextPool"),y=Symbol.for("@meonode/ui/BaseNode/cacheCleanupRegistry");class C{static _idCounter=0;instanceId="m"+ ++C._idCounter;element;rawProps={};isBaseNode=!0;_props;_deps;stableKey;lastPropsObj;lastSignature;static get elementCache(){return r(u,()=>new Map)}static get _navigationStarted(){return r(g,()=>({value:!1})).value}static set _navigationStarted(e){r(g,()=>({value:!1})).value=e}static get renderContextPool(){return r(f,()=>[])}static acquireRenderContext(){const e=C.renderContextPool;return e.length>0?e.pop():{workStack:new Array(512),renderedElements:new Map}}static releaseRenderContext(e){C.renderContextPool.length<50&&e.workStack.length<2048&&(e.workStack.length=0,e.renderedElements.clear(),C.renderContextPool.push(e))}constructor(e,t={},s){if(!n(e)){const t=o(e);if(p.isNodeInstance(e))throw new Error("Invalid element type: MeoNode UI instance provided!");throw new Error(`Invalid element type: ${t} provided!`)}this.element=e,this.rawProps=t,this._deps=s;const{ref:r,children:i,...a}=t;this.stableKey=this._getStableKey(a),p.isServer||C._navigationStarted||(m.getInstance().start(),C._navigationStarted=!0)}get props(){return this._props||(this._props=p.processProps(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),s=n.length;if(s>100){const e=p.extractCriticalProps(t,n);this.lastSignature=p.createPropSignature(this.element,e),c&&s>200&&console.warn(`MeoNode: Large props (${s} keys) on "${a(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 r(y,()=>new FinalizationRegistry(e=>{const{cacheKey:t,instanceId:n}=e,s=C.elementCache.get(t);s?.instanceId===n&&C.elementCache.delete(t),d.isMounted(t)&&d.untrackMount(t)}))}render(n=!1){const r=p.shouldCacheElement(this)?C.elementCache.get(this.stableKey):void 0,o=p.shouldNodeUpdate(r?.prevDeps,this._deps,n);if(!o&&r?.renderedElement)return r.accessCount+=1,r.renderedElement;const a=!o,c=C.acquireRenderContext();let{workStack:d}=c;const{renderedElements:m}=c;let u=0;try{const n=e=>{if(e>d.length){const t=Math.max(e,d.length<<1),n=new Array(t);for(let e=0;e<u;e++)n[e]=d[e];d=n}};for(d[u++]={node:this,isProcessed:!1,blocked:a};u>0;){const r=d[u-1];if(!r){u--;continue}const{node:o,isProcessed:a,blocked:c}=r;if(a){u--;const{children:n,key:r,css:a,nativeProps:c,disableEmotion:d,...h}=o.props;let g=[];if(n){const e=Array.isArray(n)?n:[n],t=e.length;g=new Array(t);for(let n=0;n<t;n++){const t=e[n];if(p.isNodeInstance(t)){const e=m.get(t);if(!e)throw new Error(`[MeoNode] Missing rendered element for child node: ${t.stableKey}`);g[n]=e}else g[n]=t}}const f={...h,key:r,...c};let y;if(o.element===e||s(o.element))y=t(o.element,{key:r},...g);else{y=!d&&(a||!i(o.element))?t(l,{element:o.element,...f,css:a,suppressHydrationWarning:!0},...g):t(o.element,f,...g)}if(o!==this&&p.shouldCacheElement(o)){const e=C.elementCache.get(o.stableKey);if(e)e.prevDeps=o._deps,e.renderedElement=y,e.accessCount+=1;else{const e={prevDeps:o._deps,renderedElement:y,nodeRef:new WeakRef(o),createdAt:Date.now(),accessCount:1,instanceId:o.instanceId};C.elementCache.set(o.stableKey,e),C.cacheCleanupRegistry.register(o,{cacheKey:o.stableKey,instanceId:o.instanceId},o)}}m.set(o,y)}else{r.isProcessed=!0;const e=o.props.children;if(e){const t=Array.isArray(e)?e:[e];let s=0;for(let e=0;e<t.length;e++)p.isNodeInstance(t[e])&&s++;n(u+s);for(let e=t.length-1;e>=0;e--){const n=t[e];if(!p.isNodeInstance(n))continue;const s=p.shouldCacheElement(n)?C.elementCache.get(n.stableKey):void 0,r=p.shouldNodeUpdate(s?.prevDeps,n._deps,c);if(!r&&s?.renderedElement){m.set(n,s.renderedElement);continue}const o=c||!r;d[u++]={node:n,isProcessed:!1,blocked:o}}}}}let r=m.get(this);if(!p.isServer&&this.stableKey&&(r=t(h,{node:this},r)),p.shouldCacheElement(this)){const e=C.elementCache.get(this.stableKey);if(e)e.prevDeps=this._deps,e.renderedElement=r,e.accessCount+=1;else{const e={prevDeps:this._deps,renderedElement:r,nodeRef:new WeakRef(this),createdAt:Date.now(),accessCount:1,instanceId:this.instanceId};C.elementCache.set(this.stableKey,e),C.cacheCleanupRegistry.register(this,{cacheKey:this.stableKey,instanceId:this.instanceId},this)}}return r}finally{for(let e=0;e<u;e++)d[e]=null;C.releaseRenderContext({workStack:d,renderedElements:m})}}static clearCaches(){const e=Array.from(C.elementCache.keys());c&&console.log(`[MeoNode] clearCaches: Clearing ${e.length} entries`);for(const t of e){const e=C.elementCache.get(t);if(e){const n=e.nodeRef?.deref();if(n)try{C.cacheCleanupRegistry.unregister(n),n.lastSignature=void 0,n.lastPropsObj=void 0}catch{c&&console.warn(`[MeoNode] Could not unregister ${t} from FinalizationRegistry`)}}}C.elementCache.clear(),d.cleanup(),c&&console.log("[MeoNode] All caches cleared")}}function S(e,t={},n){return new C(e,t,n)}function b(e,t){const n=(n,s)=>S(e,{...t,...n},s);return n.element=e,n}function v(e,t){const n=(n,s,r)=>S(e,{...t,...s,children:n},r);return n.element=e,n}S.clearCaches=C.clearCaches;export{C as BaseNode,S as Node,v as createChildrenFirstNode,b as createNode};
@@ -0,0 +1,13 @@
1
+ import type { DataChannel } from '../types/node.type.js';
2
+ /**
3
+ * Creates a ref-based pub/sub data channel for pushing updates to subscribers
4
+ * without triggering React re-renders in the producer.
5
+ *
6
+ * Used internally by the portal system to sync data from the parent component
7
+ * to portal layers efficiently.
8
+ * @template T The data type managed by the channel.
9
+ * @param initial Optional initial data value.
10
+ * @returns A DataChannel with get, set, and subscribe methods.
11
+ */
12
+ export declare function createDataChannel<T = any>(initial?: T): DataChannel<T>;
13
+ //# sourceMappingURL=data-channel.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-channel.helper.d.ts","sourceRoot":"","sources":["../../../src/helper/data-channel.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAE1D;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,GAAG,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAiBtE"}
@@ -0,0 +1 @@
1
+ function e(e){let t=e;const n=new Set;return{get:()=>t,set:e=>{t=e,n.forEach(e=>e(t))},subscribe:e=>(n.add(e),()=>{n.delete(e)})}}export{e as createDataChannel};
@@ -1,3 +1,2 @@
1
- export * from '../hoc/portal.hoc.js';
2
1
  export * from '../hoc/component.hoc.js';
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hoc/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hoc/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA"}
@@ -1,2 +1,4 @@
1
1
  export * from '../hook/useTheme.js';
2
+ export * from '../hook/usePortal.js';
3
+ export * from '../hook/useDataChannel.js';
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hook/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hook/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA"}
@@ -0,0 +1,10 @@
1
+ import type { DataChannel } from '../types/node.type.js';
2
+ /**
3
+ * React hook that subscribes to a DataChannel and returns the current snapshot.
4
+ * Re-renders the component whenever the channel pushes new data via `set()`.
5
+ * @template T The data type of the channel.
6
+ * @param channel The data channel to subscribe to, or null/undefined.
7
+ * @returns The current data value, or undefined if no channel is provided.
8
+ */
9
+ export declare function useDataChannel<T>(channel: DataChannel<T> | null | undefined): T | undefined;
10
+ //# sourceMappingURL=useDataChannel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDataChannel.d.ts","sourceRoot":"","sources":["../../../src/hook/useDataChannel.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAE1D;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,CAU3F"}
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{useState as r,useEffect as t}from"react";function e(e){const[n,o]=r(()=>e?.get());return t(()=>{if(e)return o(e.get()),e.subscribe(o)},[e]),n}export{e as useDataChannel};
@@ -0,0 +1,34 @@
1
+ import type { PortalHandle, PortalLayerProps } from '../types/node.type.js';
2
+ /**
3
+ * React hook for imperative portal control.
4
+ * Provides methods to open, update, and close portals from within the component tree.
5
+ * Must be used within a `PortalProvider`.
6
+ * @template T The type of data to be synchronized with the portal.
7
+ * @param data Optional data to keep in sync with the most recently opened portal.
8
+ * If provided, any changes to this data will automatically call `updateData`.
9
+ * @returns An object with:
10
+ * - `open(Component, initialData?)` — opens a portal layer and returns a PortalHandle
11
+ * - `updateData(next)` — pushes new data to the most recently opened portal
12
+ * - `close()` — closes the most recently opened portal
13
+ * - `handle` — ref to the current PortalHandle
14
+ * @example
15
+ * ```ts
16
+ * // With auto-sync
17
+ * const [count, setCount] = useState(0)
18
+ * const portal = usePortal({ count, setCount })
19
+ *
20
+ * const handleOpen = () => {
21
+ * portal.open(MyContent, { count, setCount })
22
+ * }
23
+ *
24
+ * // Without auto-sync
25
+ * const portal = usePortal()
26
+ * ```
27
+ */
28
+ export declare function usePortal<T = any>(data?: T): {
29
+ open: <P = T>(Component: import("react").ComponentType<PortalLayerProps<P>>, initialData?: P | undefined) => PortalHandle<P>;
30
+ updateData: <T>(next: T) => void;
31
+ close: () => void;
32
+ handle: import("react").RefObject<PortalHandle<any> | null>;
33
+ };
34
+ //# sourceMappingURL=usePortal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePortal.d.ts","sourceRoot":"","sources":["../../../src/hook/usePortal.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,SAAS,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC;WAiBtC,CAAC;iBAQ4B,CAAC;;;EAUlC"}
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{useContext as r,useRef as t,useEffect as o,useCallback as e}from"react";import{PortalContext as n}from"../components/portal-provider.client.js";function a(a){const u=r(n);if(!u)throw new Error("usePortal must be used within a PortalProvider");const c=t(null);o(()=>{void 0!==a&&c.current&&c.current.updateData(a)},[a]);return{open:e((r,t)=>{const o=u.showPortal(r,t??a);return c.current=o,o},[u.showPortal,a]),updateData:e(r=>{c.current?.updateData(r)},[]),close:e(()=>{c.current?.close(),c.current=null},[]),handle:c}}export{a as usePortal};
@@ -1,9 +1,12 @@
1
1
  export { setDebugMode } from './constant/common.const.js';
2
+ export { createDataChannel } from './helper/data-channel.helper.js';
2
3
  export { Node, createNode, createChildrenFirstNode } from './core.node.js';
3
4
  export * from './hoc/index.js';
4
5
  export * from './types/node.type.js';
5
6
  export * from './components/react.node.js';
6
7
  export * from './components/html.node.js';
7
8
  export * from './components/theme-provider.js';
9
+ export * from './components/portal-provider.js';
10
+ export * from './components/portal-host.js';
8
11
  export * from './hook/index.js';
9
12
  //# sourceMappingURL=main.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAG5D,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAG7E,cAAc,mBAAmB,CAAA;AAGjC,cAAc,yBAAyB,CAAA;AAGvC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,mCAAmC,CAAA;AAGjD,cAAc,oBAAoB,CAAA"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AAGtE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAG7E,cAAc,mBAAmB,CAAA;AAGjC,cAAc,yBAAyB,CAAA;AAGvC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,mCAAmC,CAAA;AACjD,cAAc,oCAAoC,CAAA;AAClD,cAAc,gCAAgC,CAAA;AAG9C,cAAc,oBAAoB,CAAA"}
package/dist/esm/main.js CHANGED
@@ -1 +1 @@
1
- export{setDebugMode}from"./constant/common.const.js";export{Node,createChildrenFirstNode,createNode}from"./core.node.js";export{Portal}from"./hoc/portal.hoc.js";export{Component}from"./hoc/component.hoc.js";import"react";export{Activity,Fragment,Suspense}from"./components/react.node.js";export{A,Abbr,Absolute,Address,Area,Article,Aside,Audio,B,Base,Bdi,Bdo,Blockquote,Body,Br,Button,Canvas,Caption,Center,Cite,Code,Col,Colgroup,Column,Container,Data,Datalist,Dd,Details,Dfn,Dialog,Div,Dl,Dt,Em,Embed,Fieldset,Figcaption,Figure,Fixed,Footer,Form,Grid,H1,H2,H3,H4,H5,H6,Head,Header,Hgroup,Hr,Html,I,Iframe,Img,Input,Kbd,Label,Legend,Li,Link,Main,MapElement,Mark,Menu,Meta,Meter,Nav,Noscript,ObjectElement,Ol,Optgroup,Option,Output,P,Param,Picture,Pre,Progress,Q,Relative,Root,Row,Rp,Rt,Ruby,S,Samp,Script,Search,Section,Select,Small,Source,Span,Static,Sticky,Strong,Style,Sub,Summary,Sup,Svg,SvgCircle,SvgDefs,SvgEllipse,SvgG,SvgLine,SvgLinearGradient,SvgPath,SvgPolygon,SvgPolyline,SvgRadialGradient,SvgRect,SvgStop,SvgSymbol,SvgText,SvgTspan,SvgUse,Table,Tbody,Td,Template,Text,Textarea,Tfoot,Th,Thead,Time,Title,Tr,Track,U,Ul,Var,Video,Wbr}from"./components/html.node.js";export{ThemeProvider}from"./components/theme-provider.js";export{useTheme}from"./hook/useTheme.js";
1
+ export{setDebugMode}from"./constant/common.const.js";export{createDataChannel}from"./helper/data-channel.helper.js";export{Node,createChildrenFirstNode,createNode}from"./core.node.js";export{Component}from"./hoc/component.hoc.js";import"react";export{Activity,Fragment,Suspense}from"./components/react.node.js";export{A,Abbr,Absolute,Address,Area,Article,Aside,Audio,B,Base,Bdi,Bdo,Blockquote,Body,Br,Button,Canvas,Caption,Center,Cite,Code,Col,Colgroup,Column,Container,Data,Datalist,Dd,Details,Dfn,Dialog,Div,Dl,Dt,Em,Embed,Fieldset,Figcaption,Figure,Fixed,Footer,Form,Grid,H1,H2,H3,H4,H5,H6,Head,Header,Hgroup,Hr,Html,I,Iframe,Img,Input,Kbd,Label,Legend,Li,Link,Main,MapElement,Mark,Menu,Meta,Meter,Nav,Noscript,ObjectElement,Ol,Optgroup,Option,Output,P,Param,Picture,Pre,Progress,Q,Relative,Root,Row,Rp,Rt,Ruby,S,Samp,Script,Search,Section,Select,Small,Source,Span,Static,Sticky,Strong,Style,Sub,Summary,Sup,Svg,SvgCircle,SvgDefs,SvgEllipse,SvgG,SvgLine,SvgLinearGradient,SvgPath,SvgPolygon,SvgPolyline,SvgRadialGradient,SvgRect,SvgStop,SvgSymbol,SvgText,SvgTspan,SvgUse,Table,Tbody,Td,Template,Text,Textarea,Tfoot,Th,Thead,Time,Title,Tr,Track,U,Ul,Var,Video,Wbr}from"./components/html.node.js";export{ThemeProvider}from"./components/theme-provider.js";export{PortalProvider}from"./components/portal-provider.js";export{PortalHost}from"./components/portal-host.js";export{useTheme}from"./hook/useTheme.js";export{usePortal}from"./hook/usePortal.js";export{useDataChannel}from"./hook/useDataChannel.js";
@@ -1,4 +1,4 @@
1
- import _StyleRegistry from '../components/registry.client.js';
1
+ import _StyleRegistry from '../components/style-registry.client';
2
2
  export declare const StyleRegistry: (<AdditionalProps, ExactProps extends object = object>(props: import("../main").MergedProps<typeof _StyleRegistry, AdditionalProps, ExactProps>, deps?: import("../main").DependencyList | undefined) => import("../main").NodeInstance<typeof _StyleRegistry>) & {
3
3
  element: typeof _StyleRegistry;
4
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/nextjs-registry/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,oCAAoC,CAAA;AAG/D,eAAO,MAAM,aAAa;;CAA6B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/nextjs-registry/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,uCAAuC,CAAA;AAGlE,eAAO,MAAM,aAAa;;CAA6B,CAAA"}
@@ -1 +1 @@
1
- import o from"../components/registry.client.js";import{createNode as r}from"../core.node.js";const t=r(o);export{t as StyleRegistry};
1
+ import o from"../components/style-registry.client.js";import{createNode as r}from"../core.node.js";const t=r(o);export{t as StyleRegistry};
@@ -280,44 +280,66 @@ export interface FunctionRendererProps<E extends NodeElementType> {
280
280
  */
281
281
  export type ComponentNode = (NodeInstance | ReactNode) | (() => NodeInstance | ReactNode);
282
282
  /**
283
- * Base props interface for components rendered inside a portal.
284
- * @property children - The content to render within the portal. Accepts a single NodeElement or an array of NodeElements.
285
- * @property portal - An object providing portal lifecycle control methods.
286
- * @property unmount - Function to unmount and clean up the portal instance.
283
+ * A ref-based pub/sub data channel for pushing updates to portal layers
284
+ * without re-rendering the parent component.
285
+ * @template T The data type managed by the channel.
287
286
  */
288
- export interface BasePortalProps {
289
- /** Content to render within the portal */
290
- children?: Children;
291
- /** Portal control object containing lifecycle methods */
292
- portal: {
293
- /** Unmounts and cleans up the portal */
294
- unmount: () => void;
295
- };
287
+ export interface DataChannel<T = any> {
288
+ /** Returns the current data value */
289
+ get: () => T;
290
+ /** Sets a new data value and notifies all subscribers */
291
+ set: (next: T) => void;
292
+ /** Subscribes to data changes. Returns an unsubscribe function. */
293
+ subscribe: (cb: (data: T) => void) => () => void;
296
294
  }
297
295
  /**
298
- * Props type for components rendered through the Portal HOC.
299
- * Extends the component's own props with portal-specific functionality.
300
- * @template T The component's own prop types
296
+ * An entry in the portal stack managed by PortalProvider.
297
+ * @template T The data type for this portal layer.
298
+ * @internal
301
299
  */
302
- export type PortalProps<T extends BasePortalProps | Record<string, any> = Record<string, any>> = T & BasePortalProps;
300
+ export interface PortalStackEntry<T = any> {
301
+ id: number;
302
+ Component: React.ComponentType<PortalLayerProps<T>>;
303
+ channel: DataChannel<T>;
304
+ }
303
305
  /**
304
- * Interface representing a portal instance with lifecycle methods.
305
- * Provides methods to unmount the portal and update its content dynamically.
306
+ * Props received by components rendered inside a portal layer.
307
+ * @template T The data type passed via the data channel.
306
308
  */
307
- export interface NodePortal {
308
- /**
309
- * Unmounts the portal and cleans up the DOM element.
310
- * This removes the portal container from the document body.
311
- */
312
- unmount: () => void;
309
+ export interface PortalLayerProps<T = any> {
310
+ /** Current data from the data channel */
311
+ data: T;
312
+ /** The depth of this layer in the portal stack (1-indexed from bottom) */
313
+ depth: number;
314
+ /** Closes this specific portal layer */
315
+ close: () => void;
313
316
  }
314
317
  /**
315
- * Function type for creating portal instances.
316
- * Allows passing providers through props at portal creation time.
317
- * @template P The portal content component's prop types
318
+ * Handle returned by `showPortal` or `usePortal().open` for controlling a portal instance.
319
+ * @template T The data type for this portal.
318
320
  */
319
- export type PortalLauncher<P extends BasePortalProps | Record<string, any>> = (props?: (P & {
320
- provider?: NodeInstance;
321
- }) & Omit<PortalProps<P>, 'portal'>) => NodePortal;
321
+ export interface PortalHandle<T = any> {
322
+ /** Unique identifier for this portal layer */
323
+ id: number;
324
+ /** Pushes new data to the portal layer without re-rendering the parent */
325
+ updateData: (next: T) => void;
326
+ /** Closes this specific portal layer */
327
+ close: () => void;
328
+ }
329
+ /**
330
+ * The value provided by PortalContext for managing the portal stack.
331
+ */
332
+ export interface PortalContextValue {
333
+ /** Current portal stack entries */
334
+ stack: PortalStackEntry[];
335
+ /** Opens a new portal layer with a component and optional initial data */
336
+ showPortal: <T>(Component: React.ComponentType<PortalLayerProps<T>>, initialData?: T) => PortalHandle<T>;
337
+ /** Closes the topmost portal layer */
338
+ hidePortal: () => void;
339
+ /** Closes a specific portal layer by its id */
340
+ hidePortalById: (id: number) => void;
341
+ /** Closes all portal layers */
342
+ hideAll: () => void;
343
+ }
322
344
  export {};
323
345
  //# sourceMappingURL=node.type.d.ts.map
@@ -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,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,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,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAm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AC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,EAAE,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,CAAA;IACxG,sCAAsC;IACtC,UAAU,EAAE,MAAM,IAAI,CAAA;IACtB,+CAA+C;IAC/C,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,+BAA+B;IAC/B,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB"}
@@ -1,6 +1,5 @@
1
1
  import React, { type ReactNode } from 'react';
2
- import type { FunctionRendererProps, NodeElement, NodeElementType, NodeFunction, NodeInstance, NodeProps, DependencyList, FinalNodeProps, NodePortal } from '../types/node.type.js';
3
- import { type Root } from 'react-dom/client';
2
+ import type { FunctionRendererProps, NodeElement, NodeElementType, NodeFunction, NodeInstance, NodeProps, DependencyList, FinalNodeProps } from '../types/node.type.js';
4
3
  /**
5
4
  * NodeUtil provides a collection of static utility methods and properties
6
5
  * used internally by BaseNode for various tasks such as hashing, shallow comparison,
@@ -13,18 +12,6 @@ export declare class NodeUtil {
13
12
  private static get _functionSignatureCache();
14
13
  private static readonly CRITICAL_PROPS;
15
14
  private static _propFuncCache;
16
- /**
17
- * Portal infrastructure using WeakMap for memory-safe management.
18
- * Stores the DOM element and React root associated with a NodeInstance.
19
- * @internal
20
- */
21
- static get portalInfrastructure(): WeakMap<NodeInstance, {
22
- instanceId: string;
23
- domElement: HTMLDivElement;
24
- reactRoot: NodePortal & {
25
- render(children: ReactNode): void;
26
- };
27
- }>;
28
15
  /**
29
16
  * Type guard to check if an object is a NodeInstance.
30
17
  *
@@ -178,22 +165,5 @@ export declare class NodeUtil {
178
165
  passedKey?: string;
179
166
  disableEmotion?: boolean;
180
167
  }): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ReactPortal | null | undefined> | React.ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined;
181
- /**
182
- * Ensures that the necessary DOM element and React root are available for portal rendering.
183
- * This is only executed on the client-side.
184
- * Handles cleanup of stale infrastructure and creates new infrastructure as needed.
185
- * @param node The node instance that requires portal infrastructure.
186
- * @returns True if portal infrastructure is ready, false on server or if setup fails.
187
- */
188
- static ensurePortalInfrastructure(node: NodeInstance): boolean;
189
- /**
190
- * Cleans up portal infrastructure by unmounting the React root and removing the DOM element.
191
- * This ensures proper memory cleanup and prevents memory leaks.
192
- * @param infra The infrastructure object containing the DOM element and React root to clean up.
193
- */
194
- static cleanupPortalInfra(infra: {
195
- domElement: HTMLDivElement;
196
- reactRoot: Root;
197
- }): void;
198
168
  }
199
169
  //# sourceMappingURL=node.util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.util.d.ts","sourceRoot":"","sources":["../../../src/util/node.util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAyC,KAAK,SAAS,EAAiC,MAAM,OAAO,CAAA;AACnH,OAAO,KAAK,EACV,qBAAqB,EACrB,WAAW,EACX,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,cAAc,EACd,cAAc,EAEd,UAAU,EACX,MAAM,yBAAyB,CAAA;AAKhC,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAKxD;;;;;GAKG;AACH,qBAAa,QAAQ;IACnB,OAAO,eAAiB;IAGxB,OAAc,QAAQ,UAAgC;IAGtD,OAAO,CAAC,MAAM,KAAK,uBAAuB,GAEzC;IAGD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAA2D;IAGjG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAiD;IAE9E;;;;OAIG;IACH,WAAkB,oBAAoB;;;;;;OAarC;IAED;;;;;;;;;;OAUG;IACH,OAAc,cAAc,wCAAiE;IAE7F;;;;;;OAMG;IACH,OAAc,WAAW,yBAAgH;IAEzI;;;;;OAKG;IACH,OAAc,UAAU,CAAC,GAAG,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C,CAAC,CAAC,CAUnG;IAED;;;;;;;;;;;OAWG;IACH,OAAc,gBAAgB,CAAC,CAAC,SAAS,eAAe,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,CA2D5I;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;CACF"}
@@ -1 +1 @@
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 _propFuncCache=new WeakMap;static get portalInfrastructure(){return i(h,()=>new WeakMap)}static isNodeInstance=e=>e instanceof p;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=Math.imul(r,33)^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){let t=y._propFuncCache.get(r);t||(t=y.hashString(r.toString()),y._propFuncCache.set(r,t)),o=`${e}:${t};`}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){const{ref:r,key:o,children:n,css:s,props:i={},disableEmotion:c,...u}=e;if(0===Object.keys(u).length&&!s)return a({ref:r,key:o,disableEmotion:c,nativeProps:a(i),children:y._processChildren(n,c)});const p={},f={},m=Object.keys(u);for(let e=0;e<m.length;e++){const t=m[e],r=u[t],o=typeof r;"string"===o||"number"===o||"boolean"===o?p[t]=r:f[t]=r}const h=l(p),b=l(f),g=d(u),C={...h,...b,...s},E=y._processChildren(n,c,t);return a({ref:r,key:o,css:C,...g,disableEmotion:c,nativeProps:a(i),children:E})}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){if(y.isServer)return!0;if(r)return!1;if(void 0===t)return!0;if(void 0===e)return!0;if(t.length!==e.length)return!0;for(let r=0;r<t.length;r++)if(!Object.is(t[r],e[r]))return!0;return!1}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)){if("string"==typeof r.type){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 new p(r.type,{...r.props,...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||"string"==typeof o||"number"==typeof o||"boolean"==typeof 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});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};
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 d,getDOMProps as l}from"../helper/common.helper.js";import{__DEBUG__ as p}from"../constant/common.const.js";import{BaseNode as f}from"../core.node.js";const u=Symbol.for("@meonode/ui/NodeUtil/functionSignatureCache");class h{constructor(){}static isServer="undefined"==typeof window;static get _functionSignatureCache(){return i(u,()=>new WeakMap)}static CRITICAL_PROPS=new Set(["css","className","disableEmotion","props"]);static _propFuncCache=new WeakMap;static isNodeInstance=e=>e instanceof f;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 n=e.charCodeAt(o);t^=n,t=Math.imul(t,16777619),r=Math.imul(r,33)^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(h.isServer)return;const r=c(e),o=Object.keys(t);o.length>1&&o.sort();const n=[`${r}:`];if("function"==typeof e){let t=h._functionSignatureCache.get(e);t||(t=h.hashString(e.toString()),h._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){let t=h._propFuncCache.get(r);t||(t=h.hashString(r.toString()),h._propFuncCache.set(r,t)),o=`${e}:${t};`}else{o=`${e}:{${Object.keys(r).sort().join(",")}};`}n.push(o)}return h.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(h.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&&h.isStyleProp(n)&&(r[n]=e[n],o++):(r[n]=e[n],o++):(r[n]=e[n],o++)}return r}static processProps(e={},t){const{ref:r,key:o,children:n,css:s,props:i={},disableEmotion:c,...p}=e;if(0===Object.keys(p).length&&!s)return a({ref:r,key:o,disableEmotion:c,nativeProps:a(i),children:h._processChildren(n,c)});const f={},u={},y=Object.keys(p);for(let e=0;e<y.length;e++){const t=y[e],r=p[t],o=typeof r;"string"===o||"number"===o||"boolean"===o?f[t]=r:u[t]=r}const m=d(f),b=d(u),g=l(p),C={...m,...b,...s},w=h._processChildren(n,c,t);return a({ref:r,key:o,css:C,...g,disableEmotion:c,nativeProps:a(i),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){if(h.isServer)return!0;if(r)return!1;if(void 0===t)return!0;if(void 0===e)return!0;if(t.length!==e.length)return!0;for(let r=0;r<t.length;r++)if(!Object.is(t[r],e[r]))return!0;return!1}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 f(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 f(h.functionRenderer,{props:{render:r,disableEmotion:i}},void 0);if(t(r)){if("string"==typeof r.type){const{style:e,...t}=r.props,o={...t,...e||{}};return new f(r.type,{...o,...null!==r.key&&void 0!==r.key?{key:r.key}:{},disableEmotion:i},void 0)}return new f(r.type,{...r.props,...null!==r.key&&void 0!==r.key?{key:r.key}:{},disableEmotion:i},void 0)}return o(r)||n(r)||s(r)?new f(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)||n(e)||s(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||"string"==typeof o||"number"==typeof o||"boolean"==typeof o)return o;if(h.isNodeInstance(o))return r&&!o.rawProps.disableEmotion?new f(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 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});const n=h.processRawNode(o,r);return n?h.renderProcessedNode({processedElement:n,disableEmotion:r}):o}static renderProcessedNode({processedElement:t,passedKey:n,disableEmotion:s}){const i={};if(void 0!==n&&(i.key=n),h.isNodeInstance(t)){const e=t.rawProps?.key;return t.rawProps.disableEmotion=s,e===n?t.render():new f(t.element,{...t.rawProps,...i}).render()}return o(t)?new f(t,{...i,disableEmotion:s}).render():t instanceof e.Component?t.render():"function"==typeof t?r(t,{key:n}):t}}export{h as NodeUtil};
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.1.3",
4
+ "version": "1.2.0-0",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "types": "./dist/main.d.ts",
@@ -38,6 +38,7 @@
38
38
  "build": "yarn prebuild && rm -rf ./dist && rollup -c rollup.config.ts && tsgo -p tsconfig.build.json --diagnostics && tsc-alias -p tsconfig.build.json",
39
39
  "publish:prerelease": "./prepublish.sh && yarn build && yarn version -i prerelease && yarn npm publish --tag next",
40
40
  "publish:patch": "./prepublish.sh && yarn build && yarn version -i patch && yarn npm publish --tag latest",
41
+ "publish:preminor": "./prepublish.sh && yarn build && yarn version -i preminor && yarn npm publish --tag next",
41
42
  "publish:minor": "./prepublish.sh && yarn build && yarn version -i minor && yarn npm publish --tag latest",
42
43
  "publish:premajor": "./prepublish.sh && yarn build && yarn version -i premajor && yarn npm publish --tag next",
43
44
  "publish:major": "./prepublish.sh && yarn build && yarn version -i major && yarn npm publish --tag latest",
@@ -130,5 +131,6 @@
130
131
  "accessible-components",
131
132
  "meonode-ui",
132
133
  "meonode"
133
- ]
134
+ ],
135
+ "stableVersion": "1.1.4"
134
136
  }
@@ -1,2 +0,0 @@
1
- "use client";
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("@emotion/react"),t=require("@emotion/cache"),n=require("../core.node.cjs"),o=require("next/navigation.js");exports.default=function({children:s}){const[i]=e.useState(()=>{const e=t({key:"meonode-css"});return e.compat=!0,e});return o.useServerInsertedHTML(()=>{const r=Object.keys(i.inserted).sort(),t=r.map(e=>i.inserted[e]).join(""),n=r.join(" ");return t?e.createElement("style",{"data-emotion":`${i.key} ${n}`,dangerouslySetInnerHTML:{__html:t}}):null}),n.Node(r.CacheProvider,{value:i,children:s}).render()};
@@ -1 +0,0 @@
1
- "use strict";var e=require("../core.node.cjs");exports.Portal=function(n,o){let r,t,a={unmount:()=>{console.warn("Portal instance not yet created. Cannot unmount.")}};if("function"==typeof o&&n instanceof e.BaseNode)r=[n],t=o;else{if("function"!=typeof n||void 0!==o)throw new Error("Invalid arguments for Portal HOC. Use Portal(component) or Portal(providerNodeInstance, component).");t=n}const i=(n={})=>{const o=t({...n,portal:a});return o instanceof e.BaseNode?o.render():o};return function(n={}){let o;const t=[];n.provider&&t.push(n.provider);const s=[...r??[],...t],{provider:c,...d}=n,l=e.Node(i,d);function u(n,o){const r=n.rawProps?.children;if(!(r&&r instanceof e.BaseNode))return e.Node(n.element,{...n.rawProps,children:o});const t=u(r,o);return e.Node(n.element,{...n.rawProps,children:t})}return o=s.length>0?s.reduceRight((n,o)=>{if(!(o instanceof e.BaseNode))return console.warn("Portal: Item in provider is not a valid NodeInstance. Skipping.",o),n;return o.rawProps?.children instanceof e.BaseNode?u(o,n):e.Node(o.element,{...o.rawProps,children:n})},l):l,a=o.toPortal(),a}};
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.client.d.ts","sourceRoot":"","sources":["../../../src/components/registry.client.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,YAAY,EAAY,MAAM,OAAO,CAAA;AAWlE;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,YAAY,CAAA;CAAE,yGA4B7E"}
@@ -1,2 +0,0 @@
1
- "use client";
2
- import{useState as e,createElement as o}from"react";import{CacheProvider as t}from"@emotion/react";import r from"@emotion/cache";import{Node as n}from"../core.node.js";import{useServerInsertedHTML as i}from"next/navigation.js";function m({children:m}){const[c]=e(()=>{const e=r({key:"meonode-css"});return e.compat=!0,e});return i(()=>{const e=Object.keys(c.inserted).sort(),t=e.map(e=>c.inserted[e]).join(""),r=e.join(" ");return t?o("style",{"data-emotion":`${c.key} ${r}`,dangerouslySetInnerHTML:{__html:t}}):null}),n(t,{value:c,children:m}).render()}export{m as default};
@@ -1,52 +0,0 @@
1
- import type { BasePortalProps, ComponentNode, NodeInstance, PortalLauncher, PortalProps } from '../types/node.type.js';
2
- /**
3
- * Higher-Order Component (HOC) to create and manage React portals with optional provider wrapping.
4
- * This function supports two overloads:
5
- * 1. `Portal(providerNodeInstance, component)` - Creates a portal with a fixed provider node instance.
6
- * 2. `Portal(component)` - Creates a portal without a fixed provider, allowing dynamic providers at launch time.
7
- * @template P The prop types for the component rendered inside the portal, extending BasePortalProps.
8
- * @param provider Optional NodeInstance to wrap the portal content (fixed provider).
9
- * @param component The component function that returns the content to render inside the portal.
10
- * @returns A function that launches the portal instance, accepting props and optional dynamic providers.
11
- * @example
12
- * // Using Portal with a fixed provider
13
- * const MyPortal = Portal(MyProviderNodeInstance, (props) => (
14
- * Div({
15
- * backgroundColor: 'white',
16
- * padding: '20px',
17
- * borderRadius: '8px',
18
- * children: [
19
- * H1({ children: 'Fixed Provider Portal' }),
20
- * Button({
21
- * onClick: () => props.portal.unmount(),
22
- * children: 'Close',
23
- * }),
24
- * ],
25
- * })
26
- * ));
27
- *
28
- * // Launching the portal
29
- * const portalInstance = MyPortal({ someProp: 'value' });
30
- * @example
31
- * // Using Portal without a fixed provider
32
- * const MyPortal = Portal((props) => (
33
- * Div({
34
- * backgroundColor: 'white',
35
- * padding: '20px',
36
- * borderRadius: '8px',
37
- * children: [
38
- * H1({ children: 'Dynamic Provider Portal' }),
39
- * Button({
40
- * onClick: () => props.portal.unmount(),
41
- * children: 'Close',
42
- * }),
43
- * ],
44
- * })
45
- * ));
46
- *
47
- * // Launching the portal with a dynamic provider
48
- * const portalInstance = MyPortal({ provider: AnotherProviderNodeInstance, someProp: 'value' });
49
- */
50
- export declare function Portal<P extends BasePortalProps | Record<string, any> = BasePortalProps>(provider: NodeInstance, component: (props: PortalProps<P>) => ComponentNode): PortalLauncher<P>;
51
- export declare function Portal<P extends BasePortalProps | Record<string, any> = BasePortalProps>(component: (props: PortalProps<P>) => ComponentNode): PortalLauncher<P>;
52
- //# sourceMappingURL=portal.hoc.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"portal.hoc.d.ts","sourceRoot":"","sources":["../../../src/hoc/portal.hoc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAyB,cAAc,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAK/I;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,EACtF,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,aAAa,GAClD,cAAc,CAAC,CAAC,CAAC,CAAA;AAEpB,wBAAgB,MAAM,CAAC,CAAC,SAAS,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,EACtF,SAAS,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,aAAa,GAClD,cAAc,CAAC,CAAC,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- import{BaseNode as n,Node as r}from"../core.node.js";function e(e,o){let t,i,c={unmount:()=>{console.warn("Portal instance not yet created. Cannot unmount.")}};if("function"==typeof o&&e instanceof n)t=[e],i=o;else{if("function"!=typeof e||void 0!==o)throw new Error("Invalid arguments for Portal HOC. Use Portal(component) or Portal(providerNodeInstance, component).");i=e}const a=(r={})=>{const e=i({...r,portal:c});return e instanceof n?e.render():e};return function(e={}){let o;const i=[];e.provider&&i.push(e.provider);const s=[...t??[],...i],{provider:l,...p}=e,d=r(a,p);function u(e,o){const t=e.rawProps?.children;if(!(t&&t instanceof n))return r(e.element,{...e.rawProps,children:o});const i=u(t,o);return r(e.element,{...e.rawProps,children:i})}return o=s.length>0?s.reduceRight((e,o)=>{if(!(o instanceof n))return console.warn("Portal: Item in provider is not a valid NodeInstance. Skipping.",o),e;return o.rawProps?.children instanceof n?u(o,e):r(o.element,{...o.rawProps,children:e})},d):d,c=o.toPortal(),c}}export{e as Portal};