@meonode/ui 0.1.104 → 0.1.106
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/dist/common.helper.d.ts +1 -1
- package/dist/common.helper.d.ts.map +1 -1
- package/dist/core.node.d.ts +18 -5
- package/dist/core.node.d.ts.map +1 -1
- package/dist/core.node.js +14 -7
- package/dist/hoc/portal.hoc.d.ts +0 -24
- package/dist/hoc/portal.hoc.d.ts.map +1 -1
- package/dist/hoc/portal.hoc.js +4 -25
- package/dist/hook/useClasses.d.ts +1 -0
- package/dist/hook/useClasses.d.ts.map +1 -1
- package/dist/html.node.d.ts +154 -138
- package/dist/html.node.d.ts.map +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +1 -1
- package/dist/node.helper.d.ts +8 -6
- package/dist/node.helper.d.ts.map +1 -1
- package/dist/node.type.d.ts +25 -23
- package/dist/node.type.d.ts.map +1 -1
- package/dist/react-is.helper.d.ts +1 -1
- package/dist/react-is.helper.d.ts.map +1 -1
- package/package.json +3 -2
package/dist/common.helper.d.ts
CHANGED
|
@@ -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) =>
|
|
29
|
+
export declare const getComponentType: (component?: 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/common.helper.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAEvE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"common.helper.d.ts","sourceRoot":"","sources":["../src/common.helper.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAEvE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,iCAE1B,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,qCAmC5B,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"}
|
package/dist/core.node.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
2
|
-
import type { FinalNodeProps, NodeElement, NodeInstance, NodeProps, RawNodeProps, Theme } from './node.type.js';
|
|
1
|
+
import { type ElementType, type ReactNode } from 'react';
|
|
2
|
+
import type { FinalNodeProps, HasRequiredProps, NodeElement, NodeInstance, NodeProps, PropsOf, RawNodeProps, Theme } from './node.type.js';
|
|
3
3
|
import { type Root as ReactDOMRoot } from 'react-dom/client';
|
|
4
4
|
/**
|
|
5
5
|
* Represents a node in a React component tree with theme and styling capabilities.
|
|
@@ -18,7 +18,7 @@ export declare class BaseNode<E extends NodeElement = NodeElement> implements No
|
|
|
18
18
|
/** Processed props after theme resolution, style processing, and child normalization */
|
|
19
19
|
props: FinalNodeProps;
|
|
20
20
|
/** Flag to identify BaseNode instances */
|
|
21
|
-
readonly isBaseNode
|
|
21
|
+
readonly isBaseNode: boolean;
|
|
22
22
|
/** DOM element used for portal rendering */
|
|
23
23
|
private _portalDOMElement;
|
|
24
24
|
/** React root instance for portal rendering */
|
|
@@ -101,8 +101,21 @@ export declare class BaseNode<E extends NodeElement = NodeElement> implements No
|
|
|
101
101
|
/**
|
|
102
102
|
* Factory function to create a BaseNode instance.
|
|
103
103
|
* @param element The React element type.
|
|
104
|
-
* @param props The props for the node.
|
|
104
|
+
* @param props The props for the node (optional).
|
|
105
105
|
* @returns NodeInstance<E> - A new BaseNode instance.
|
|
106
106
|
*/
|
|
107
|
-
export declare function Node<E extends NodeElement>(element: E, props?:
|
|
107
|
+
export declare function Node<E extends NodeElement>(element: E, props?: NodeProps<E>): NodeInstance<E>;
|
|
108
|
+
/**
|
|
109
|
+
* Creates a curried node factory for a given React element type.
|
|
110
|
+
*
|
|
111
|
+
* This utility returns a function that, when called with props, produces a `BaseNode` instance.
|
|
112
|
+
* It is useful for creating reusable node factories for specific components or element types.
|
|
113
|
+
* @template E The React element or component type.
|
|
114
|
+
* @param element The React element or component type to wrap.
|
|
115
|
+
* @returns A function that takes node props and returns a `NodeInstance<E>`.
|
|
116
|
+
* @example
|
|
117
|
+
* const ButtonNode = createNode('button');
|
|
118
|
+
* const myButton = ButtonNode({ children: 'Click me', style: { color: 'red' } });
|
|
119
|
+
*/
|
|
120
|
+
export declare function createNode<E extends ElementType>(element: E): HasRequiredProps<PropsOf<E>> extends true ? (props: NodeProps<E>) => NodeInstance<E> : (props?: NodeProps<E>) => NodeInstance<E>;
|
|
108
121
|
//# sourceMappingURL=core.node.d.ts.map
|
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,OAAc,
|
|
1
|
+
{"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../src/core.node.ts"],"names":[],"mappings":"AACA,OAAc,EAAsC,KAAK,WAAW,EAA4B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAC7H,OAAO,KAAK,EACV,cAAc,EAEd,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,OAAO,EACP,YAAY,EACZ,KAAK,EACN,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAAc,KAAK,IAAI,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAGxE;;;;;;;;GAQG;AACH,qBAAa,QAAQ,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,CAAE,YAAW,YAAY,CAAC,CAAC,CAAC;IACnF,+EAA+E;IACxE,OAAO,EAAE,CAAC,CAAA;IAEjB,kFAAkF;IAC3E,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAK;IAErC,wFAAwF;IACjF,KAAK,EAAE,cAAc,CAAA;IAE5B,0CAA0C;IAC1C,SAAgB,UAAU,UAAO;IAEjC,4CAA4C;IAC5C,OAAO,CAAC,iBAAiB,CAA8B;IAEvD,+CAA+C;IAC/C,OAAO,CAAC,gBAAgB,CAA4B;IAEpD;;;;;;;;OAQG;IACH,YAAY,OAAO,EAAE,CAAC,EAAE,QAAQ,GAAE,YAAY,CAAC,CAAC,CAAM,EAuCrD;IAED,OAAO,CAAC,gBAAgB;IAYxB;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,oBAAoB,CAAC,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAsCnI;IAED;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,iBAAiB;IAgCzB;;;;;;;;OAQG;IACI,eAAe,CACpB,OAAO,EAAE,WAAW,EACpB,WAAW,CAAC,EAAE,KAAK,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,WAAW,CAuFb;IAED;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,eAAe,CAwBtB;IAED;;;;OAIG;IACI,MAAM,IAAI,SAAS,CAoCzB;IAED,OAAO,CAAC,2BAA2B;IAsB5B,QAAQ,IAAI,YAAY,GAAG,IAAI,CAqBrC;CACF;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,WAAW,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAO7F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,WAAW,EAC9C,OAAO,EAAE,CAAC,GACT,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,CAElI"}
|
package/dist/core.node.js
CHANGED
|
@@ -79,8 +79,7 @@ if("string"===d||"number"===d||"boolean"===d||null===a||void 0===a)return a;// C
|
|
|
79
79
|
if("function"===d&&!isReactClassComponent(a)&&!isMemo(a)&&!isForwardRef(a)){// The key is for the BaseNode that wraps the _functionRenderer component.
|
|
80
80
|
// Functions themselves don't have a .key prop that we can access here.
|
|
81
81
|
var j=e(this._functionRenderer,void 0);// Generate key for function renderer
|
|
82
|
-
return new BaseNode(this._functionRenderer,{processRawNode:this._processRawNode.bind(this),render:a,passedTheme:b,key:j//
|
|
83
|
-
})}// Case 4: Child is a React Element (JSX element like <div> or <MyComponent>)
|
|
82
|
+
return new BaseNode(this._functionRenderer,{processRawNode:this._processRawNode.bind(this),render:a,passedTheme:b,key:j})}// Case 4: Child is a React Element (JSX element like <div> or <MyComponent>)
|
|
84
83
|
if(isValidElement(a)){var k=a.props,l=k.style,m=_objectWithoutProperties(k,_excluded4),n=_objectSpread(_objectSpread({},m),l||{}),o=n.theme||n.nodetheme||b,p=e(a.type,a.key);// Combine top-level props from the element with its flattened style object properties
|
|
85
84
|
return new BaseNode(a.type,_objectSpread(_objectSpread({},n),{},{// Pass the combined props
|
|
86
85
|
nodetheme:o,key:p}))}// Case 5: Child is an ElementType (string tag, class component, Memo/ForwardRef)
|
|
@@ -117,9 +116,17 @@ g=h.every(function(a){return null===a||void 0===a})?void 0:h}else g=void 0;// Pr
|
|
|
117
116
|
var i=_objectSpread(_objectSpread({},f),{},{key:e});return createElement(this.element,i,g)}_ensurePortalInfrastructure(){if("undefined"==typeof window)return!1;if(this._portalDOMElement&&this._portalReactRoot)return!0;if(this._portalDOMElement&&!this._portalDOMElement.isConnected&&(this._portalDOMElement=null,this._portalDOMElement=null),this._portalDOMElement||(this._portalDOMElement=document.createElement("div"),document.body.appendChild(this._portalDOMElement)),!this._portalReactRoot){if(!this._portalDOMElement)return!1;this._portalReactRoot=createRoot(this._portalDOMElement)}return!0}toPortal(){var a=this;if(!this._ensurePortalInfrastructure()||!this._portalReactRoot)return null;var b=this.render();return this._portalReactRoot.render(b),_objectSpread(_objectSpread({},this._portalReactRoot),{},{unmount:function unmount(){a._portalReactRoot&&(a._portalReactRoot.unmount(),a._portalReactRoot=null),a._portalDOMElement&&(a._portalDOMElement.parentNode&&a._portalDOMElement.parentNode.removeChild(a._portalDOMElement),a._portalDOMElement=null)}})}}/**
|
|
118
117
|
* Factory function to create a BaseNode instance.
|
|
119
118
|
* @param element The React element type.
|
|
120
|
-
* @param props The props for the node.
|
|
119
|
+
* @param props The props for the node (optional).
|
|
121
120
|
* @returns NodeInstance<E> - A new BaseNode instance.
|
|
122
|
-
*/export function Node(a){var
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
*/export function Node(a,b){var c=_objectSpread({},b||{});return c.theme&&!c.nodetheme&&(c.nodetheme=c.theme),new BaseNode(a,c)}/**
|
|
122
|
+
* Creates a curried node factory for a given React element type.
|
|
123
|
+
*
|
|
124
|
+
* This utility returns a function that, when called with props, produces a `BaseNode` instance.
|
|
125
|
+
* It is useful for creating reusable node factories for specific components or element types.
|
|
126
|
+
* @template E The React element or component type.
|
|
127
|
+
* @param element The React element or component type to wrap.
|
|
128
|
+
* @returns A function that takes node props and returns a `NodeInstance<E>`.
|
|
129
|
+
* @example
|
|
130
|
+
* const ButtonNode = createNode('button');
|
|
131
|
+
* const myButton = ButtonNode({ children: 'Click me', style: { color: 'red' } });
|
|
132
|
+
*/export function createNode(a){return function(b){return Node(a,b)}}
|
package/dist/hoc/portal.hoc.d.ts
CHANGED
|
@@ -1,28 +1,4 @@
|
|
|
1
1
|
import type { BasePortalProps, ComponentNode, NodeInstance, PortalLauncher, PortalProps } from '../node.type';
|
|
2
|
-
/**
|
|
3
|
-
* Creates a portal component with a fixed set of providers by passing an array of `NodeInstance`s.
|
|
4
|
-
* The content component will be rendered within these providers. This method is considered deprecated.
|
|
5
|
-
* @deprecated Use `Portal(provider: NodeInstance<any>, component: ...)` instead for fixed providers.
|
|
6
|
-
* Passing an array of providers for fixed setup is deprecated and will trigger a console warning.
|
|
7
|
-
* @param provider An array of `NodeInstance`s that will wrap the portal content. Each NodeInstance
|
|
8
|
-
* should represent a React context provider (e.g., `ThemeProvider({ theme })`).
|
|
9
|
-
* @param component The React component function that defines the portal's content. It receives
|
|
10
|
-
* props of type `PortalProps<P>` and should return a `ComponentNode`.
|
|
11
|
-
* @returns A launcher function that, when called, creates and controls the portal instance.
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* // Example of a deprecated usage with an array of fixed providers:
|
|
15
|
-
* const DeprecatedThemedModal = Portal(
|
|
16
|
-
* [ThemeProvider({ theme: 'dark' }), LanguageProvider({ lang: 'en' })],
|
|
17
|
-
* (props) => Div({ children: props.children, style: { background: props.nodetheme?.background } })
|
|
18
|
-
* );
|
|
19
|
-
*
|
|
20
|
-
* const deprecatedModalInstance = DeprecatedThemedModal({ children: "Deprecated content" });
|
|
21
|
-
* // A console warning will be logged when DeprecatedThemedModal is created.
|
|
22
|
-
* deprecatedModalInstance.unmount();
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare function Portal<P extends BasePortalProps | Record<string, any> = BasePortalProps>(provider: NodeInstance<any>[], component: (props: PortalProps<P>) => ComponentNode): PortalLauncher<P>;
|
|
26
2
|
/**
|
|
27
3
|
* Creates a portal component with a single fixed provider.
|
|
28
4
|
* The content component will be rendered within this provider. This is the preferred method
|
|
@@ -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,EAAE,YAAY,EAAa,cAAc,EAAE,WAAW,EAAS,MAAM,gBAAgB,CAAA;AAIjI
|
|
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,EAAa,cAAc,EAAE,WAAW,EAAS,MAAM,gBAAgB,CAAA;AAIjI;;;;;;;;;;;;;;;;;;;;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
|
@@ -1,26 +1,4 @@
|
|
|
1
1
|
"use strict";var _excluded=["nodetheme"],_excluded2=["provider","nodetheme"];function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return(b=_toPropertyKey(b))in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}function _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=_objectWithoutPropertiesLoose(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],-1===b.indexOf(c)&&{}.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c={};for(var d in a)if({}.hasOwnProperty.call(a,d)){if(-1!==b.indexOf(d))continue;c[d]=a[d]}return c}import{BaseNode,Node}from"../core.node";/**
|
|
2
|
-
* Creates a portal component with a fixed set of providers by passing an array of `NodeInstance`s.
|
|
3
|
-
* The content component will be rendered within these providers. This method is considered deprecated.
|
|
4
|
-
* @deprecated Use `Portal(provider: NodeInstance<any>, component: ...)` instead for fixed providers.
|
|
5
|
-
* Passing an array of providers for fixed setup is deprecated and will trigger a console warning.
|
|
6
|
-
* @param provider An array of `NodeInstance`s that will wrap the portal content. Each NodeInstance
|
|
7
|
-
* should represent a React context provider (e.g., `ThemeProvider({ theme })`).
|
|
8
|
-
* @param component The React component function that defines the portal's content. It receives
|
|
9
|
-
* props of type `PortalProps<P>` and should return a `ComponentNode`.
|
|
10
|
-
* @returns A launcher function that, when called, creates and controls the portal instance.
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* // Example of a deprecated usage with an array of fixed providers:
|
|
14
|
-
* const DeprecatedThemedModal = Portal(
|
|
15
|
-
* [ThemeProvider({ theme: 'dark' }), LanguageProvider({ lang: 'en' })],
|
|
16
|
-
* (props) => Div({ children: props.children, style: { background: props.nodetheme?.background } })
|
|
17
|
-
* );
|
|
18
|
-
*
|
|
19
|
-
* const deprecatedModalInstance = DeprecatedThemedModal({ children: "Deprecated content" });
|
|
20
|
-
* // A console warning will be logged when DeprecatedThemedModal is created.
|
|
21
|
-
* deprecatedModalInstance.unmount();
|
|
22
|
-
* ```
|
|
23
|
-
*//**
|
|
24
2
|
* Creates a portal component with a single fixed provider.
|
|
25
3
|
* The content component will be rendered within this provider. This is the preferred method
|
|
26
4
|
* for providing fixed context to your portal content.
|
|
@@ -71,8 +49,9 @@
|
|
|
71
49
|
export function Portal(a,b){// --- Initialization ---
|
|
72
50
|
var c,d=void 0,e=null;// --- Argument Parsing and Overload Handling ---
|
|
73
51
|
// Determines which Portal overload was called (e.g., with fixed provider or just component).
|
|
74
|
-
if("function"==typeof b&&
|
|
75
|
-
c=
|
|
52
|
+
if("function"==typeof b&&a instanceof BaseNode)// Handles the case where a fixed provider (single) is passed.
|
|
53
|
+
d=[a],c=b;else if("function"==typeof a&&b===void 0)// Handles the case where only the component function is passed.
|
|
54
|
+
c=a;else throw new Error("Invalid arguments for Portal HOC. Use Portal(component) or Portal(providerNodeInstance, component).");// --- Core Content Renderer Function ---
|
|
76
55
|
// This function is the actual React component that will be rendered inside the portal.
|
|
77
56
|
// It receives props and handles theme application and portal control.
|
|
78
57
|
var f=function Renderer(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},b=a.nodetheme,d=_objectWithoutProperties(a,_excluded),f=c(_objectSpread(_objectSpread({},d),{},{portal:e// Passes the portal control object to the content component
|
|
@@ -87,7 +66,7 @@ var j=injectContentDeeply(g,b);return Node(a.element,_objectSpread(_objectSpread
|
|
|
87
66
|
// Iterates through the combined providers (fixed + dynamic) to wrap the content.
|
|
88
67
|
// Providers are applied in reverse order to ensure the innermost content is wrapped by the outermost provider.
|
|
89
68
|
var b,c=[];// Combine fixed and dynamic providers
|
|
90
|
-
|
|
69
|
+
a.provider&&c.push(a.provider);var g=[...(null!==d&&void 0!==d?d:[]),...c],h=a.provider,i=a.nodetheme,j=_objectWithoutProperties(a,_excluded2),k=_objectSpread(_objectSpread({},j),{},{nodetheme:i}),l=Node(f,k);// Separates props for the portal's content from internal props like 'provider' or 'nodetheme'.
|
|
91
70
|
// Creates the base node for the portal's content.
|
|
92
71
|
return b=0<g.length?g.reduceRight(function(a,b){var c,d,e;if(!(b instanceof BaseNode))return console.warn("Portal: Item in provider is not a valid NodeInstance. Skipping.",b),a;var f=(null===(c=b.rawProps)||void 0===c?void 0:c.children)instanceof BaseNode;// If the provider already has nested children, inject content deeply.
|
|
93
72
|
// Otherwise, simply set currentWrappedContent as its direct child.
|
|
@@ -4,6 +4,7 @@ import { type CSSProperties } from 'react';
|
|
|
4
4
|
* @returns {string} The CSS string.
|
|
5
5
|
*/
|
|
6
6
|
export declare function getServerStyles(): string;
|
|
7
|
+
// Type definitions for CSS values and style objects
|
|
7
8
|
type CSSValue = string | number;
|
|
8
9
|
interface NestedStyle extends CSSProperties {
|
|
9
10
|
[key: string]: CSSValue | NestedStyle | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useClasses.d.ts","sourceRoot":"","sources":["../../src/hook/useClasses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,OAAO,CAAA;AAM9D;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;
|
|
1
|
+
{"version":3,"file":"useClasses.d.ts","sourceRoot":"","sources":["../../src/hook/useClasses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,OAAO,CAAA;AAM9D;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AA2BD,oDAAoD;AACpD,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAA;AAC/B,UAAU,WAAY,SAAQ,aAAa;IACzC,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAA;CAClD;AACD,UAAU,WAAY,SAAQ,WAAW;IACvC,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAA;CAClD;AA+CD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,WAAW,EAAE,IAAI,GAAE,GAAG,EAAO,GAAG,MAAM,CA6E1E;AAkKD;;;GAGG;AACH,wBAAgB,WAAW,SAa1B"}
|