@meonode/ui 0.2.17 → 0.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +63 -10
- package/dist/core.node.d.ts +22 -15
- package/dist/core.node.d.ts.map +1 -1
- package/dist/core.node.js +46 -26
- package/dist/helper/common.helper.d.ts +2 -2
- package/dist/helper/common.helper.d.ts.map +1 -1
- package/dist/helper/node.helper.js +3 -3
- package/dist/hoc/portal.hoc.d.ts +6 -6
- package/dist/hoc/portal.hoc.d.ts.map +1 -1
- package/dist/hoc/portal.hoc.js +7 -7
- package/dist/hook/index.d.ts +2 -0
- package/dist/hook/index.d.ts.map +1 -0
- package/dist/hook/index.js +1 -0
- package/dist/hook/usePortal.d.ts +8 -0
- package/dist/hook/usePortal.d.ts.map +1 -0
- package/dist/hook/usePortal.js +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +1 -1
- package/dist/node.type.d.ts +13 -5
- package/dist/node.type.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,59 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.2.18] - 2025-09-19
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **feat(core)**: support function children and enhance rendering logic
|
|
13
|
+
- **feat(core)**: enhance portal with update method and NodePortal type
|
|
14
|
+
- **feat(hook)**: introduce usePortal hook for reactive portals
|
|
15
|
+
|
|
16
|
+
### Example
|
|
17
|
+
|
|
18
|
+
- **feat(portal)**: use `usePortal` hook to make the portal reactive to state changes
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { Button, Div, Node, Portal, type PortalProps } from '@meonode/ui';
|
|
22
|
+
import { usePortal } from '@meonode/ui';
|
|
23
|
+
import { useState } from 'react';
|
|
24
|
+
|
|
25
|
+
const MyPortal = () => {
|
|
26
|
+
const [state, setState] = useState<number>(0);
|
|
27
|
+
const { setPortal, createComponent } = usePortal([state]);
|
|
28
|
+
|
|
29
|
+
const PortalContent = createComponent(({ portal, text }: { text: string } & PortalProps<any>) => {
|
|
30
|
+
return Div({
|
|
31
|
+
children: [
|
|
32
|
+
'This is portal content!',
|
|
33
|
+
state === 1 ? text : 'Initial text value',
|
|
34
|
+
Button(`Update Portal (${state + 1})`, {
|
|
35
|
+
onClick: () => {
|
|
36
|
+
setState((s: number) => s + 1);
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
Button('Close Portal', {
|
|
40
|
+
onClick: () => {
|
|
41
|
+
portal?.unmount();
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
],
|
|
45
|
+
}).render();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
return Div({
|
|
49
|
+
children: [
|
|
50
|
+
Button('Open Portal', {
|
|
51
|
+
onClick: () => {
|
|
52
|
+
const portal = Portal<{ text: string }>(PortalContent)({ text: `Text prop still passed after update` });
|
|
53
|
+
setPortal(portal);
|
|
54
|
+
},
|
|
55
|
+
}),
|
|
56
|
+
],
|
|
57
|
+
}).render();
|
|
58
|
+
};
|
|
59
|
+
```
|
|
60
|
+
|
|
8
61
|
## [0.2.17] - 2025-09-14
|
|
9
62
|
|
|
10
63
|
### Added
|
|
@@ -116,20 +169,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
116
169
|
This abstracts away the need to manually use `react-dom/client`.
|
|
117
170
|
- **Before**:
|
|
118
171
|
```typescript
|
|
119
|
-
import { createRoot } from 'react-dom/client';
|
|
120
|
-
import { Div } from '@meonode/ui';
|
|
172
|
+
import { createRoot } from \'react-dom/client\';
|
|
173
|
+
import { Div } from \'@meonode/ui\';
|
|
121
174
|
|
|
122
|
-
const container = document.getElementById('root');
|
|
175
|
+
const container = document.getElementById(\'root\');
|
|
123
176
|
const root = createRoot(container);
|
|
124
|
-
root.render(Div({ children: 'Hello' }).render());
|
|
177
|
+
root.render(Div({ children: \'Hello\' }).render());
|
|
125
178
|
```
|
|
126
179
|
- **After**:
|
|
127
180
|
```typescript
|
|
128
|
-
import { Div } from '@meonode/ui';
|
|
129
|
-
import { render } from '@meonode/ui/client';
|
|
181
|
+
import { Div } from \'@meonode/ui\';
|
|
182
|
+
import { render } from \'@meonode/ui/client\';
|
|
130
183
|
|
|
131
|
-
const container = document.getElementById('root');
|
|
132
|
-
render(Div({ children: 'Hello' }), container);
|
|
184
|
+
const container = document.getElementById(\'root\');
|
|
185
|
+
render(Div({ children: \'Hello\' }), container);
|
|
133
186
|
```
|
|
134
187
|
- **constants**: add `NO_STYLE_TAGS` array and `noStyleTagsSet` for quick lookup of tags that should not receive styles
|
|
135
188
|
|
|
@@ -163,10 +216,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
163
216
|
- Improves developer experience when working with prebuilt components:
|
|
164
217
|
- Example:
|
|
165
218
|
```typescript
|
|
166
|
-
import { Div, Input } from '@meonode/ui'
|
|
219
|
+
import { Div, Input } from \'@meonode/ui\'
|
|
167
220
|
|
|
168
221
|
// Add new props
|
|
169
|
-
Div<{ field: string }>({ field: 'Hello' })
|
|
222
|
+
Div<{ field: string }>({ field: \'Hello\' })
|
|
170
223
|
|
|
171
224
|
// Override existing React props
|
|
172
225
|
Input<{ onChange: (e: { target: { value: string } }) => void }>({
|
package/dist/core.node.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React, { type
|
|
2
|
-
import type { Children, FinalNodeProps, HasRequiredProps, MergedProps, NodeElement, NodeInstance, NodeProps, PropsOf, RawNodeProps, Theme } from './node.type.js';
|
|
3
|
-
import { type Root as ReactDOMRoot } from 'react-dom/client';
|
|
1
|
+
import React, { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import type { Children, FinalNodeProps, HasRequiredProps, MergedProps, NodeElement, NodeElementType, NodeInstance, NodePortal, NodeProps, PropsOf, RawNodeProps, Theme } from './node.type.js';
|
|
4
3
|
/**
|
|
5
4
|
* Represents a node in a React component tree with theme and styling capabilities.
|
|
6
5
|
* This class wraps React elements and handles:
|
|
@@ -10,7 +9,7 @@ import { type Root as ReactDOMRoot } from 'react-dom/client';
|
|
|
10
9
|
* - Style processing with theme variables
|
|
11
10
|
* @template E The type of React element or component this node represents
|
|
12
11
|
*/
|
|
13
|
-
export declare class BaseNode<E extends
|
|
12
|
+
export declare class BaseNode<E extends NodeElementType> implements NodeInstance<E> {
|
|
14
13
|
/** The underlying React element or component type that this node represents */
|
|
15
14
|
element: E;
|
|
16
15
|
/** Original props passed during construction, preserved for cloning/recreation */
|
|
@@ -148,6 +147,12 @@ export declare class BaseNode<E extends NodeElement> implements NodeInstance<E>
|
|
|
148
147
|
* @static
|
|
149
148
|
*/
|
|
150
149
|
static _renderProcessedNode(processedElement: NodeElement, passedTheme: Theme | undefined, passedKey?: string): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ReactPortal | null | undefined> | ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined;
|
|
150
|
+
/**
|
|
151
|
+
* Determines if a raw node is a function that should be treated as a render prop.
|
|
152
|
+
* @param rawNode
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
private _isFunctionChild;
|
|
151
156
|
/**
|
|
152
157
|
* Renders the output of a function-as-a-child, ensuring theme propagation.
|
|
153
158
|
*
|
|
@@ -241,16 +246,18 @@ export declare class BaseNode<E extends NodeElement> implements NodeInstance<E>
|
|
|
241
246
|
/**
|
|
242
247
|
* Renders the node into a React Portal.
|
|
243
248
|
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
249
|
+
* Mounts the node's rendered output into a detached DOM tree (a `div` appended to `document.body`),
|
|
250
|
+
* enabling UI elements like modals, tooltips, or notifications to appear above the main app content.
|
|
251
|
+
*
|
|
252
|
+
* Returns a `NodePortal` object with:
|
|
253
|
+
* - `render(content)`: Renders new content into the portal.
|
|
254
|
+
* - `update(next?)`: Rerenders the current node or new content.
|
|
255
|
+
* - `unmount()`: Unmounts the portal and removes the DOM element.
|
|
247
256
|
*
|
|
248
|
-
*
|
|
249
|
-
* @returns A `
|
|
250
|
-
* called in a server-side environment. The returned instance is enhanced
|
|
251
|
-
* with a custom `unmount` method that also cleans up the associated DOM element.
|
|
257
|
+
* Throws if called on the server (where `document.body` is unavailable).
|
|
258
|
+
* @returns A `NodePortal` instance for managing the portal.
|
|
252
259
|
*/
|
|
253
|
-
toPortal():
|
|
260
|
+
toPortal(): NodePortal;
|
|
254
261
|
}
|
|
255
262
|
/**
|
|
256
263
|
* Factory function to create a `BaseNode` instance.
|
|
@@ -261,7 +268,7 @@ export declare class BaseNode<E extends NodeElement> implements NodeInstance<E>
|
|
|
261
268
|
* @param additionalProps Additional props to merge into the node (optional).
|
|
262
269
|
* @returns A new `BaseNode` instance as a `NodeInstance<E>`.
|
|
263
270
|
*/
|
|
264
|
-
export declare function Node<AdditionalProps extends Record<string, any>, E extends
|
|
271
|
+
export declare function Node<AdditionalProps extends Record<string, any>, E extends NodeElementType>(element: E, props?: MergedProps<E, AdditionalProps>, additionalProps?: AdditionalProps): NodeInstance<E>;
|
|
265
272
|
/**
|
|
266
273
|
* Creates a curried node factory for a given React element or component type.
|
|
267
274
|
*
|
|
@@ -276,7 +283,7 @@ export declare function Node<AdditionalProps extends Record<string, any>, E exte
|
|
|
276
283
|
* const ButtonNode = createNode('button', { type: 'button' });
|
|
277
284
|
* const myButton = ButtonNode({ children: 'Click me', style: { color: 'red' } });
|
|
278
285
|
*/
|
|
279
|
-
export declare function createNode<AdditionalInitialProps extends Record<string, any>, E extends
|
|
286
|
+
export declare function createNode<AdditionalInitialProps extends Record<string, any>, E extends NodeElementType>(element: E, initialProps?: MergedProps<E, AdditionalInitialProps>): HasRequiredProps<PropsOf<E>> extends true ? (<AdditionalProps extends Record<string, any> = Record<string, any>>(props: MergedProps<E, AdditionalProps>) => NodeInstance<E>) & {
|
|
280
287
|
element: E;
|
|
281
288
|
} : (<AdditionalProps extends Record<string, any> = Record<string, any>>(props?: MergedProps<E, AdditionalProps>) => NodeInstance<E>) & {
|
|
282
289
|
element: E;
|
|
@@ -300,7 +307,7 @@ export declare function createNode<AdditionalInitialProps extends Record<string,
|
|
|
300
307
|
* const Text = createChildrenFirstNode('p');
|
|
301
308
|
* const myDiv = Text('Hello', { className: 'text-lg' });
|
|
302
309
|
*/
|
|
303
|
-
export declare function createChildrenFirstNode<AdditionalInitialProps extends Record<string, any>, E extends
|
|
310
|
+
export declare function createChildrenFirstNode<AdditionalInitialProps extends Record<string, any>, E extends NodeElementType>(element: E, initialProps?: Omit<NodeProps<E>, keyof AdditionalInitialProps | 'children'> & AdditionalInitialProps): HasRequiredProps<PropsOf<E>> extends true ? (<AdditionalProps extends Record<string, any> = Record<string, any>>(children: Children, props: Omit<MergedProps<E, AdditionalProps>, 'children'>) => NodeInstance<E>) & {
|
|
304
311
|
element: E;
|
|
305
312
|
} : (<AdditionalProps extends Record<string, any> = Record<string, any>>(children?: Children, props?: Omit<MergedProps<E, AdditionalProps>, 'children'>) => NodeInstance<E>) & {
|
|
306
313
|
element: E;
|
package/dist/core.node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../src/core.node.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../src/core.node.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAQZ,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EACV,QAAQ,EACR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M,EAAE,GAAG,CAAC,EACjE,QAAQ,CAAC,EAAE,QAAQ,EACnB,KAAK,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,UAAU,CAAC,KACtD,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,CAQzC"}
|
package/dist/core.node.js
CHANGED
|
@@ -43,7 +43,9 @@
|
|
|
43
43
|
*/_defineProperty(this,"rawProps",{}),_defineProperty(this,"isBaseNode",!0),_defineProperty(this,"_portalDOMElement",null),_defineProperty(this,"_portalReactRoot",null),_defineProperty(this,"_generateKey",function(a){var b=a.nodeIndex,c=a.element,d=a.existingKey,e=a.children;if(d)return d;var f,g=getElementTypeName(c);return f=Array.isArray(e)&&0<e.length?void 0===b?"".concat(g,"-").concat(e.length):"".concat(g,"-").concat(b,"-").concat(e.length):void 0===b?g:"".concat(g,"-").concat(b),f}),_defineProperty(this,"_normalizeChild",function(a){var c,d;// Handle null/undefined quickly
|
|
44
44
|
if(null===a||a===void 0)return a;// Primitives should be returned as-is (text nodes, numbers, booleans)
|
|
45
45
|
var e=_typeof(a);if("string"===e||"number"===e||"boolean"===e)return a;var f=(null===(c=b.rawProps)||void 0===c?void 0:c.nodetheme)||(null===(d=b.rawProps)||void 0===d?void 0:d.theme)||b.props.nodetheme||b.props.theme;// For BaseNode instances, apply current theme if child has no theme
|
|
46
|
-
if(a instanceof BaseNode){var g;return null!==(g=a.rawProps)&&void 0!==g&&g.nodetheme||void 0===f?a.render():new BaseNode(a.element,_objectSpread(_objectSpread({},a.rawProps),{},{nodetheme:f})).render()}//
|
|
46
|
+
if(a instanceof BaseNode||isNodeInstance(a)){var g;return null!==(g=a.rawProps)&&void 0!==g&&g.nodetheme||void 0===f?a.render():new BaseNode(a.element,_objectSpread(_objectSpread({},a.rawProps),{},{nodetheme:f})).render()}// Handle React.Component instances
|
|
47
|
+
if("function"==typeof a.render)// React.Component instance
|
|
48
|
+
return a.render();// Validate element type before returning
|
|
47
49
|
if(!isValidElementType(a)){var h=getComponentType(a);throw new Error("Invalid element type: ".concat(h," provided!"))}// Return valid React elements as-is
|
|
48
50
|
return a}),this.element=a,this.rawProps=c}/**
|
|
49
51
|
* Lazily processes and retrieves the final, normalized props for the node.
|
|
@@ -123,8 +125,7 @@ if(BaseNode._processedChildrenMapCache.has(d))return void BaseNode._processedChi
|
|
|
123
125
|
* @returns The processed children, ready for normalization and rendering.
|
|
124
126
|
* @private
|
|
125
127
|
*/_processChildren(a,b){var c=this;if(a){// Use RSC-safe caching strategy
|
|
126
|
-
var d=this._getCachedChildren(a,b);if(d)return d;var e=Array.isArray(a)?a.map(function(a,d){return c._processRawNode(a,b,d)}):this._processRawNode(a,b)
|
|
127
|
-
return BaseNode._isServer||this._setCachedChildren(a,b,e),e}}/**
|
|
128
|
+
var d=this._getCachedChildren(a,b);if(d)return d;var e;return e="function"==typeof a?a:Array.isArray(a)?a.map(function(a,d){return c._processRawNode(a,b,d)}):this._processRawNode(a,b),BaseNode._isServer||this._setCachedChildren(a,b,e),e}}/**
|
|
128
129
|
* Renders a processed `NodeElement` into a `ReactNode`, applying a theme and key if necessary.
|
|
129
130
|
*
|
|
130
131
|
* This static method centralizes the logic for converting various types of processed elements
|
|
@@ -147,6 +148,15 @@ return isReactClassComponent(a)?new BaseNode(a,d).render():isNodeInstance(a)?a.r
|
|
|
147
148
|
// 4. React.Component instance: call its render
|
|
148
149
|
// 5. Functional component: create element with key
|
|
149
150
|
// 6. Other valid ReactNode types
|
|
151
|
+
}/**
|
|
152
|
+
* Determines if a raw node is a function that should be treated as a render prop.
|
|
153
|
+
* @param rawNode
|
|
154
|
+
* @private
|
|
155
|
+
*/_isFunctionChild(a){// Basic function check
|
|
156
|
+
return!("function"!=typeof a)&&!isReactClassComponent(a)&&!isMemo(a)&&!isForwardRef(a)&&!("displayName"in a&&a.displayName&&/^[A-Z]/.test(a.displayName))&&!(a.name&&/^[A-Z]/.test(a.name))&&!(a.prototype&&"function"==typeof a.prototype.render);// Exclude React component types
|
|
157
|
+
// Check if it's a component function vs render function
|
|
158
|
+
// Component functions typically have displayName, name starting with capital, or prototype
|
|
159
|
+
// If function has prototype properties (likely a constructor), it's probably a component
|
|
150
160
|
}/**
|
|
151
161
|
* Renders the output of a function-as-a-child, ensuring theme propagation.
|
|
152
162
|
*
|
|
@@ -160,10 +170,15 @@ return isReactClassComponent(a)?new BaseNode(a,d).render():isNodeInstance(a)?a.r
|
|
|
160
170
|
* @returns The rendered `ReactNode`.
|
|
161
171
|
* @private
|
|
162
172
|
*/_functionRenderer(a){var b,c=a.render,d=a.passedTheme,e=a.processRawNode;// Invoke the render function to get the child node.
|
|
163
|
-
try{b=c()}catch(a){b=null}// Handle
|
|
164
|
-
if(b
|
|
165
|
-
if(b
|
|
166
|
-
var
|
|
173
|
+
try{b=c()}catch(a){b=null}// Handle null/undefined
|
|
174
|
+
if(null===b||b===void 0)return b;// Handle arrays of elements (common in render props)
|
|
175
|
+
if(Array.isArray(b))return b.map(function(a,b){var c=e(a,d,b);return BaseNode._renderProcessedNode(c,d,"".concat(getElementTypeName(a),"-").concat(b))});// Handle React.Component instance
|
|
176
|
+
if(b instanceof React.Component){var f=b.render(),g=e(f,d);return BaseNode._renderProcessedNode(g,d)}// Handle BaseNode instance or NodeInstance
|
|
177
|
+
if(b instanceof BaseNode||isNodeInstance(b)){var h,i=b;// If nodetheme is missing and passedTheme exists, inject it
|
|
178
|
+
return void 0===(null===(h=i.rawProps)||void 0===h?void 0:h.nodetheme)&&void 0!==d?new BaseNode(i.element,_objectSpread(_objectSpread({},i.rawProps),{},{nodetheme:d})).render():i.render()}// Handle primitives and valid React nodes (JSX, string, number, boolean)
|
|
179
|
+
if("string"==typeof b||"number"==typeof b||"boolean"==typeof b||b&&"object"===_typeof(b)&&"$$typeof"in b// React JSX element
|
|
180
|
+
)return b;// Process any other result types
|
|
181
|
+
var j=e?e(b,d):b;return j?BaseNode._renderProcessedNode(j,d):b}/**
|
|
167
182
|
* Processes a single raw node, recursively converting it into a `BaseNode` or other renderable type.
|
|
168
183
|
*
|
|
169
184
|
* This is a central method for normalizing children. It handles various types of input:
|
|
@@ -191,13 +206,8 @@ return new BaseNode(e.element,_objectSpread(_objectSpread({},f),{},{nodetheme:g,
|
|
|
191
206
|
key:h}));// Create a new BaseNode with merged props and theme
|
|
192
207
|
}// Case 2: Child is a primitive (string, number, boolean, null, undefined)
|
|
193
208
|
if("string"===d||"number"===d||"boolean"===d||null===a||void 0===a)return a;// Case 3: Child is a function that needs to be called during render (FunctionRenderer).
|
|
194
|
-
if(
|
|
195
|
-
//
|
|
196
|
-
var i=this._generateKey({nodeIndex:c,element:this._functionRenderer});// Generate key for function renderer
|
|
197
|
-
return new BaseNode(this._functionRenderer,{processRawNode:this._processRawNode.bind(this),render:a,passedTheme:b,key:i})}// Case 4: Child is a React Element (JSX element like <div> or <MyComponent>)
|
|
198
|
-
if(isValidElement(a)){var j=a.props,k=j.style,l=_objectWithoutProperties(j,_excluded4),m=_objectSpread(_objectSpread({},l),k||{}),n=m.theme||m.nodetheme||b,o=this._generateKey({nodeIndex:c,element:a.type,existingKey:a.key,children:m.children});// Combine top-level props from the element with its flattened style object properties
|
|
199
|
-
return new BaseNode(a.type,_objectSpread(_objectSpread({},m),{},{// Pass the combined props
|
|
200
|
-
nodetheme:n,key:o}))}// Case 5: Child is an ElementType (string tag, class component, Memo/ForwardRef)
|
|
209
|
+
if(this._isFunctionChild(a)){var i=this._generateKey({nodeIndex:c,element:this._functionRenderer});return new BaseNode(this._functionRenderer,{processRawNode:this._processRawNode.bind(this),render:a,passedTheme:b,key:i})}// Case 4: Child is a React Element (JSX element like <div> or <MyComponent>)
|
|
210
|
+
if(isValidElement(a)){var j=a.props,k=j.style,l=_objectWithoutProperties(j,_excluded4),m=_objectSpread(_objectSpread({},l),k||{}),n=m.theme||m.nodetheme||b,o=this._generateKey({nodeIndex:c,element:a.type,existingKey:a.key,children:m.children});return new BaseNode(a.type,_objectSpread(_objectSpread({},m),{},{nodetheme:n,key:o}))}// Case 5: Child is an ElementType (string tag, class component, Memo/ForwardRef)
|
|
201
211
|
if(isReactClassComponent(a)||"object"===d&&(isMemo(a)||isForwardRef(a))){var p,q=this._generateKey({nodeIndex:c,element:a,children:"object"===_typeof(a)&&"props"in a?null===(p=a.props)||void 0===p?void 0:p.children:void 0});// ElementTypes don't have an intrinsic key from the rawNode itself.
|
|
202
212
|
return new BaseNode(a,{nodetheme:b,// Apply parent theme
|
|
203
213
|
key:q})}// Case 6: Handle instances of React.Component
|
|
@@ -243,22 +253,32 @@ if(this._portalDOMElement&&!this._portalDOMElement.isConnected){// attempt to un
|
|
|
243
253
|
if(this._portalReactRoot){try{this._portalReactRoot.unmount()}catch(a){// swallow: unmount might fail if already removed; avoid breaking the app
|
|
244
254
|
}this._portalReactRoot=null}this._portalDOMElement=null}// Create DOM element if needed
|
|
245
255
|
// Create react root if needed
|
|
246
|
-
if(this._portalDOMElement||(this._portalDOMElement=document.createElement("div"),document.body.appendChild(this._portalDOMElement)),!this._portalReactRoot){if(!this._portalDOMElement)return!1;
|
|
256
|
+
if(this._portalDOMElement||(this._portalDOMElement=document.createElement("div"),document.body.appendChild(this._portalDOMElement)),!this._portalReactRoot){if(!this._portalDOMElement)return!1;var a=createRoot(this._portalDOMElement);this._portalReactRoot={render:a.render.bind(a),unmount:a.unmount.bind(a),update:function update(){/* will be patched later */}}}return!0}/**
|
|
247
257
|
* Renders the node into a React Portal.
|
|
248
258
|
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
259
|
+
* Mounts the node's rendered output into a detached DOM tree (a `div` appended to `document.body`),
|
|
260
|
+
* enabling UI elements like modals, tooltips, or notifications to appear above the main app content.
|
|
261
|
+
*
|
|
262
|
+
* Returns a `NodePortal` object with:
|
|
263
|
+
* - `render(content)`: Renders new content into the portal.
|
|
264
|
+
* - `update(next?)`: Rerenders the current node or new content.
|
|
265
|
+
* - `unmount()`: Unmounts the portal and removes the DOM element.
|
|
252
266
|
*
|
|
253
|
-
*
|
|
254
|
-
* @returns A `
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
try{var
|
|
267
|
+
* Throws if called on the server (where `document.body` is unavailable).
|
|
268
|
+
* @returns A `NodePortal` instance for managing the portal.
|
|
269
|
+
*/toPortal(){var a=this;if(!this._ensurePortalInfrastructure()||!this._portalReactRoot)throw new Error("toPortal() can only be called in a client-side environment where document.body is available.");// Initial render
|
|
270
|
+
(function renderCurrent(){try{var b=a.render();a._portalReactRoot.render(b)}catch(a){// swallow render errors to avoid breaking caller
|
|
271
|
+
}})();// Patch the root with an update() method and a safe unmount that also removes DOM element.
|
|
272
|
+
try{var b=this._portalReactRoot.unmount.bind(this._portalReactRoot),c=this._portalReactRoot;// Create typed handle
|
|
273
|
+
return c.update=function(b){try{if(!a._portalReactRoot)return;if(void 0===b){// Re-render current BaseNode (useful when external state changed, and you want to rerender)
|
|
274
|
+
var c=a.render();return void a._portalReactRoot.render(c)}// If next is a BaseNode or NodeInstance, render its output
|
|
275
|
+
if(b instanceof BaseNode||b&&"function"==typeof b.render){var d=b.render?b.render():b;return void a._portalReactRoot.render(d)}// Otherwise assume a ReactNode and render directly
|
|
276
|
+
a._portalReactRoot.render(b)}catch(a){// swallow
|
|
277
|
+
}},c.unmount=function(){try{b()}catch(a){// swallow
|
|
259
278
|
}// Clear references and remove DOM element
|
|
260
|
-
a._portalDOMElement
|
|
261
|
-
}
|
|
279
|
+
if(a._portalDOMElement){try{a._portalDOMElement.parentNode&&a._portalDOMElement.parentNode.removeChild(a._portalDOMElement)}catch(a){// swallow
|
|
280
|
+
}a._portalDOMElement=null}a._portalReactRoot=null},c}catch(a){// fallback: return the raw root as-is (without update/unmount patch)
|
|
281
|
+
return this._portalReactRoot}}}/**
|
|
262
282
|
* Factory function to create a `BaseNode` instance.
|
|
263
283
|
* @template AdditionalProps Additional props to merge with node props.
|
|
264
284
|
* @template E The React element or component type.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FinalNodeProps, NodeElement } from '../node.type.js';
|
|
1
|
+
import type { FinalNodeProps, NodeElement, NodeInstance } from '../node.type.js';
|
|
2
2
|
import type { ComponentProps, CSSProperties, ElementType } from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* Retrieves a deeply nested value from an object using a dot-separated string path.
|
|
@@ -26,7 +26,7 @@ export declare const getValueByPath: (obj: any, path: string) => any;
|
|
|
26
26
|
* getComponentType(React.memo(() => <div/>)) // 'memo'
|
|
27
27
|
* getComponentType(() => <div/>) // 'function'
|
|
28
28
|
*/
|
|
29
|
-
export declare const getComponentType: (component?: NodeElement) => string;
|
|
29
|
+
export declare const getComponentType: (component?: NodeInstance<NodeElement> | NodeElement) => string;
|
|
30
30
|
/**
|
|
31
31
|
* Generates a string name for an ElementType or ReactElement.
|
|
32
32
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.helper.d.ts","sourceRoot":"","sources":["../../src/helper/common.helper.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"common.helper.d.ts","sourceRoot":"","sources":["../../src/helper/common.helper.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAElF,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAGvE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,iCAE1B,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,iEAmC5B,CAAA;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAsFxD;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,GAAG,CAAC,MAAM,CAA0B,CAAA;AAEjE;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAU3F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAUjH;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,CAAC,EAAE,WAAW,GAAG,OAAO,CAGxD;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAQ1F;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAQlE"}
|
|
@@ -115,10 +115,10 @@ minWidth:0},d)};/**
|
|
|
115
115
|
* - element type (string or component name)
|
|
116
116
|
* - key (if present)
|
|
117
117
|
* - basic children shape (recursing within limits)
|
|
118
|
-
*/function nodeSignature(a){var b=Math.min,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:5,d=2<arguments.length&&void 0!==arguments[2]?arguments[2]:6,e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:new WeakSet;if(null===a)return"null";if(void 0===a)return"undefined";var f=_typeof(a);if("string"===f)return"s:".concat(a);if("number"===f)return"n:".concat(a+"");if("boolean"===f)return"b:".concat(a+"");if("function"===f)return"\u0192()";if("symbol"===f)return"sym:".concat(a+"");// Arrays
|
|
118
|
+
*/function nodeSignature(a){var b=Math.min,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:5,d=2<arguments.length&&void 0!==arguments[2]?arguments[2]:6,e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:new WeakSet;if(null===a)return"null";if(void 0===a)return"undefined";var f=_typeof(a);if("string"===f)return"s:".concat(a);if("number"===f)return"n:".concat(a+"");if("boolean"===f)return"b:".concat(a+"");if("function"===f)return"\u0192:(".concat(a+"",")");if("symbol"===f)return"sym:".concat(a+"");// Arrays
|
|
119
119
|
if(Array.isArray(a)){if(0>=c)return"ary[...]";for(var g=[],h=b(a.length,d),j=0;j<h;j++)g.push(nodeSignature(a[j],c-1,d,e));return a.length>d&&g.push("...len:".concat(a.length)),"ary[".concat(g.join(","),"]")}// React element-ish: detect common shapes (type + props)
|
|
120
|
-
if("object"===f&&(Object.prototype.hasOwnProperty.call(a,"type")||Object.prototype.hasOwnProperty.call(a,"props"))){var l,m,n=null!==(l=a.type)&&void 0!==l?l:a
|
|
121
|
-
try{
|
|
120
|
+
if("object"===f&&(Object.prototype.hasOwnProperty.call(a,"type")||Object.prototype.hasOwnProperty.call(a,"props"))){var l,m,n,o=null!==(l=a.type)&&void 0!==l?l:a;// Type can be string (div) or function/class. Use helper to get name.
|
|
121
|
+
try{n=getElementTypeName(o)}catch(a){try{n=o+""}catch(a){n="unknown"}}var p,q="key"in a&&void 0!==a.key&&null!==a.key?"#".concat(a.key+""):"",r="props"in a&&"object"===_typeof(a.props)?null!==(m=a.props)&&void 0!==m?m:{}:{};try{p=nodeSignature(r.children,c-1,d,e)}catch(a){p="<err>"}var s=r&&"object"===_typeof(r)&&"id"in r&&r.id?"@id:".concat(r.id+""):"",t=r&&"object"===_typeof(r)&&"className"in r&&r.className?"@class:".concat(r.className+""):"";return"el:".concat(n).concat(q).concat(s).concat(t,"{").concat(p,"}")}// Plain object
|
|
122
122
|
if("object"===f&&a&&"object"===_typeof(a)&&!("type"in a)&&!("props"in a)){if(e.has(a))return"[Circular]";if(e.add(a),0>=c)return"obj[...]";for(var u,v=Object.keys(a).sort(),w=[],x=b(v.length,d),y=0;y<x;y++){u=v[y];try{w.push("".concat(u,":").concat(nodeSignature(a[u],c-1,d,e)))}catch(a){w.push("".concat(u,":<err>"))}}return v.length>d&&w.push("...keys:".concat(v.length)),"obj{".concat(w.join(","),"}")}// Fallback
|
|
123
123
|
try{return"o:".concat(a+"")}catch(a){return"o:<unserializable>"}}/**
|
|
124
124
|
* Public: createStableHash
|
package/dist/hoc/portal.hoc.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ import type { BasePortalProps, ComponentNode, NodeInstance, PortalLauncher, Port
|
|
|
12
12
|
* ```ts
|
|
13
13
|
* // Example of preferred usage with a single fixed provider:
|
|
14
14
|
* const ThemedModal = Portal(
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* ThemeProvider({ theme: 'light' }),
|
|
16
|
+
* (props) => Div({ children: props.children, style: { background: props.nodetheme?.background } })
|
|
17
17
|
* );
|
|
18
18
|
*
|
|
19
19
|
* const modalInstance = ThemedModal({ children: "Preferred content" });
|
|
@@ -31,7 +31,7 @@ export declare function Portal<P extends BasePortalProps | Record<string, any> =
|
|
|
31
31
|
* ```ts
|
|
32
32
|
* // Example of basic usage without fixed providers:
|
|
33
33
|
* const BasicModal = Portal(
|
|
34
|
-
*
|
|
34
|
+
* (props) => Div({ children: props.children, style: { padding: '20px', border: '1px solid black' } })
|
|
35
35
|
* );
|
|
36
36
|
*
|
|
37
37
|
* const basicModalInstance = BasicModal({ children: "Hello from a basic portal!" });
|
|
@@ -39,12 +39,12 @@ export declare function Portal<P extends BasePortalProps | Record<string, any> =
|
|
|
39
39
|
*
|
|
40
40
|
* // Example with dynamic providers when launching:
|
|
41
41
|
* const DynamicThemedModal = Portal(
|
|
42
|
-
*
|
|
42
|
+
* (props) => Div({ children: props.children, style: { background: props.nodetheme?.background || 'white' } })
|
|
43
43
|
* );
|
|
44
44
|
*
|
|
45
45
|
* const dynamicModalInstance = DynamicThemedModal({
|
|
46
|
-
*
|
|
47
|
-
*
|
|
46
|
+
* providers: ThemeProvider({ theme: 'blue' }), // Dynamic provider
|
|
47
|
+
* children: "Content with dynamic theme"
|
|
48
48
|
* });
|
|
49
49
|
* dynamicModalInstance.unmount();
|
|
50
50
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal.hoc.d.ts","sourceRoot":"","sources":["../../src/hoc/portal.hoc.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"portal.hoc.d.ts","sourceRoot":"","sources":["../../src/hoc/portal.hoc.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAe,YAAY,EAAyB,cAAc,EAAE,WAAW,EAAS,MAAM,mBAAmB,CAAA;AAG7J;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,EACtF,QAAQ,EAAE,YAAY,CAAC,GAAG,CAAC,EAC3B,SAAS,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,aAAa,GAClD,cAAc,CAAC,CAAC,CAAC,CAAA;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,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"}
|
package/dist/hoc/portal.hoc.js
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* ```ts
|
|
12
12
|
* // Example of preferred usage with a single fixed provider:
|
|
13
13
|
* const ThemedModal = Portal(
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* ThemeProvider({ theme: 'light' }),
|
|
15
|
+
* (props) => Div({ children: props.children, style: { background: props.nodetheme?.background } })
|
|
16
16
|
* );
|
|
17
17
|
*
|
|
18
18
|
* const modalInstance = ThemedModal({ children: "Preferred content" });
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* ```ts
|
|
29
29
|
* // Example of basic usage without fixed providers:
|
|
30
30
|
* const BasicModal = Portal(
|
|
31
|
-
*
|
|
31
|
+
* (props) => Div({ children: props.children, style: { padding: '20px', border: '1px solid black' } })
|
|
32
32
|
* );
|
|
33
33
|
*
|
|
34
34
|
* const basicModalInstance = BasicModal({ children: "Hello from a basic portal!" });
|
|
@@ -36,18 +36,18 @@
|
|
|
36
36
|
*
|
|
37
37
|
* // Example with dynamic providers when launching:
|
|
38
38
|
* const DynamicThemedModal = Portal(
|
|
39
|
-
*
|
|
39
|
+
* (props) => Div({ children: props.children, style: { background: props.nodetheme?.background || 'white' } })
|
|
40
40
|
* );
|
|
41
41
|
*
|
|
42
42
|
* const dynamicModalInstance = DynamicThemedModal({
|
|
43
|
-
*
|
|
44
|
-
*
|
|
43
|
+
* providers: ThemeProvider({ theme: 'blue' }), // Dynamic provider
|
|
44
|
+
* children: "Content with dynamic theme"
|
|
45
45
|
* });
|
|
46
46
|
* dynamicModalInstance.unmount();
|
|
47
47
|
* ```
|
|
48
48
|
*/// --- Implementation ---
|
|
49
49
|
export function Portal(a,b){// --- Initialization ---
|
|
50
|
-
var c,d=void 0,e=
|
|
50
|
+
var c,d=void 0,e={unmount:function unmount(){console.warn("Portal instance not yet created. Cannot unmount.")},update:function update(a){console.warn("Portal instance not yet created. Cannot update.",a)}};// --- Argument Parsing and Overload Handling ---
|
|
51
51
|
// Determines which Portal overload was called (e.g., with fixed provider or just component).
|
|
52
52
|
if("function"==typeof b&&a instanceof BaseNode)// Handles the case where a fixed provider (single) is passed.
|
|
53
53
|
d=[a],c=b;else if("function"==typeof a&&b===void 0)// Handles the case where only the component function is passed.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hook/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./usePortal.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import type { NodePortal } from '../node.type.js';
|
|
3
|
+
export declare function usePortal<T extends any[]>(deps?: T): {
|
|
4
|
+
portal: NodePortal | undefined;
|
|
5
|
+
setPortal: (p: NodePortal) => NodePortal;
|
|
6
|
+
createComponent: <P>(fn: (props: P) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>) => (props: P) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=usePortal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePortal.d.ts","sourceRoot":"","sources":["../../src/hook/usePortal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAkC,MAAM,OAAO,CAAA;AACzE,OAAO,KAAK,EAAmB,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAGpE,wBAAgB,SAAS,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,IAAI,GAAE,CAAsB;;;sBAGhC,CAAC;EAwBvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(b,c){if(b){if("string"==typeof b)return _arrayLikeToArray(b,c);var a={}.toString.call(b).slice(8,-1);return"Object"===a&&b.constructor&&(a=b.constructor.name),"Map"===a||"Set"===a?Array.from(b):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(b,c):void 0}}function _arrayLikeToArray(b,c){(null==c||c>b.length)&&(c=b.length);for(var d=0,f=Array(c);d<c;d++)f[d]=b[d];return f}function _iterableToArrayLimit(b,c){var d=null==b?null:"undefined"!=typeof Symbol&&b[Symbol.iterator]||b["@@iterator"];if(null!=d){var g,h,j,k,l=[],a=!0,m=!1;try{if(j=(d=d.call(b)).next,0===c){if(Object(d)!==d)return;a=!1}else for(;!(a=(g=j.call(d)).done)&&(l.push(g.value),l.length!==c);a=!0);}catch(a){m=!0,h=a}finally{try{if(!a&&null!=d["return"]&&(k=d["return"](),Object(k)!==k))return}finally{if(m)throw h}}return l}}function _arrayWithHoles(a){if(Array.isArray(a))return a}import{useCallback,useEffect,useRef}from"react";import{Node}from"../main.js";export function usePortal(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],b=useRef({}),c=useCallback(function(a){return b.current.component=a,new Proxy(a,{apply:function apply(a,c,d){var e=_slicedToArray(d,1),f=e[0];return b.current.props=f,a.call(c,f)}})},[]);return useEffect(function(){var a=b.current,c=a.portal,d=a.component,e=a.props;c&&d&&c.update(Node(d,e))},a),useEffect(function(){return function(){var a;return null===(a=b.current.portal)||void 0===a?void 0:a.unmount()}},[]),{portal:b.current.portal,setPortal:function setPortal(a){return b.current.portal=a},createComponent:c}}
|
package/dist/main.d.ts
CHANGED
package/dist/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAC7E,cAAc,mBAAmB,CAAA;AACjC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,mBAAmB,CAAA;AACjC,cAAc,8BAA8B,CAAA"}
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAC7E,cAAc,mBAAmB,CAAA;AACjC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,mBAAmB,CAAA;AACjC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA"}
|
package/dist/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Node,createNode,createChildrenFirstNode}from"./core.node.js";export*from"./hoc/index.js";export*from"./helper/node.helper.js";export*from"./node.type.js";export*from"./components/html.node.js";
|
|
1
|
+
export{Node,createNode,createChildrenFirstNode}from"./core.node.js";export*from"./hoc/index.js";export*from"./helper/node.helper.js";export*from"./node.type.js";export*from"./components/html.node.js";export*from"./hook/index.js";
|
package/dist/node.type.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { type CSSProperties, type ReactNode, type JSX, type ElementType, type ComponentType, type JSXElementConstructor, type Component, type ExoticComponent, type ReactElement } from 'react';
|
|
2
|
-
import type { Root as ReactDOMRoot } from 'react-dom/client';
|
|
3
2
|
import type { CSSInterpolation } from '@emotion/serialize';
|
|
4
3
|
import type { NO_STYLE_TAGS } from './constants/common.const.js';
|
|
5
4
|
// --- Utility Types ---
|
|
@@ -22,6 +21,7 @@ export type NonArrayReactNode = Exclude<ReactNode, ReactNode[]>;
|
|
|
22
21
|
* This includes React elements, components, promises resolving to React nodes, and NodeInstance objects.
|
|
23
22
|
*/
|
|
24
23
|
export type NodeElement = ExoticComponent<any> | NonArrayReactNode | Promise<Awaited<NonArrayReactNode>> | Component<any, any, any> | ElementType | ComponentType<any> | NodeInstance<any> | ((props?: any) => NonArrayReactNode | Promise<Awaited<NonArrayReactNode>> | Component<any, any, any> | NodeInstance<any> | ComponentNode);
|
|
24
|
+
export type NodeElementType = ElementType | ExoticComponent<any>;
|
|
25
25
|
/** A single NodeElement or an array of NodeElements */
|
|
26
26
|
export type Children = NodeElement | NodeElement[];
|
|
27
27
|
/**
|
|
@@ -37,8 +37,8 @@ export interface NodeInstance<T extends NodeElement = NodeElement> {
|
|
|
37
37
|
readonly isBaseNode: true;
|
|
38
38
|
/** Converts this node instance into a renderable React element/tree */
|
|
39
39
|
render(): ReactElement;
|
|
40
|
-
/** Creates Portal-compatible React elements for rendering outside
|
|
41
|
-
toPortal():
|
|
40
|
+
/** Creates Portal-compatible React elements for rendering outside the DOM tree */
|
|
41
|
+
toPortal(): NodePortal;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Infers the props type for a given NodeElement.
|
|
@@ -163,6 +163,14 @@ export interface BasePortalProps {
|
|
|
163
163
|
* @template T The component's own prop types
|
|
164
164
|
*/
|
|
165
165
|
export type PortalProps<T extends BasePortalProps | Record<string, any>> = T & BasePortalProps;
|
|
166
|
+
/**
|
|
167
|
+
* Interface representing a portal instance with lifecycle methods.
|
|
168
|
+
* Provides methods to unmount the portal and update its content dynamically.
|
|
169
|
+
*/
|
|
170
|
+
export interface NodePortal {
|
|
171
|
+
unmount: () => void;
|
|
172
|
+
update: (node: NodeElement) => void;
|
|
173
|
+
}
|
|
166
174
|
/**
|
|
167
175
|
* Function type for creating portal instances.
|
|
168
176
|
* Allows passing providers through props at portal creation time.
|
|
@@ -171,10 +179,10 @@ export type PortalProps<T extends BasePortalProps | Record<string, any>> = T & B
|
|
|
171
179
|
export type PortalLauncher<P extends BasePortalProps | Record<string, any>> = P extends BasePortalProps ? (props?: {
|
|
172
180
|
/** Optional provider components to wrap the portal content */
|
|
173
181
|
provider?: NodeInstance<any>;
|
|
174
|
-
}) =>
|
|
182
|
+
}) => NodePortal : (props: P & {
|
|
175
183
|
/** Optional provider components to wrap the portal content */
|
|
176
184
|
provider?: NodeInstance<any>;
|
|
177
|
-
} & Omit<PortalProps<P>, 'portal'>) =>
|
|
185
|
+
} & Omit<PortalProps<P>, 'portal'>) => NodePortal;
|
|
178
186
|
/**
|
|
179
187
|
* Merges `NodeProps<E>` with additional custom props, giving precedence to `AdditionalProps`.
|
|
180
188
|
* Useful for extending node props with extra properties, while overriding any overlapping keys.
|
package/dist/node.type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.type.d.ts","sourceRoot":"","sources":["../src/node.type.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EACZ,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,GAAG,EACR,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"node.type.d.ts","sourceRoot":"","sources":["../src/node.type.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EACZ,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,GAAG,EACR,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAEnE,wBAAwB;AACxB,0DAA0D;AAC1D,KAAK,YAAY,CAAC,CAAC,IAAI;KACpB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC;CACxD,CAAC,MAAM,CAAC,CAAC,CAAA;AAEV,4DAA4D;AAC5D,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,GAAG,IAAI,CAAA;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T,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAA;CAC7B,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,KAC/B,UAAU,CAAA;AAEnB;;;;;GAKG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,EAAE,eAAe,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,eAAe,EAAE,MAAM,eAAe,CAAC,GACvJ,eAAe,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meonode/ui",
|
|
3
3
|
"description": "A structured approach to component composition, direct CSS-first prop styling, built-in theming, smart prop handling (including raw property pass-through), and dynamic children.",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.18",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/main.js",
|
|
7
7
|
"types": "./dist/main.d.ts",
|