@meonode/ui 0.1.104 → 0.1.105
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/core.node.d.ts +17 -4
- package/dist/core.node.d.ts.map +1 -1
- package/dist/core.node.js +13 -5
- 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/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +1 -1
- package/dist/node.type.d.ts +15 -20
- package/dist/node.type.d.ts.map +1 -1
- package/package.json +1 -1
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.
|
|
@@ -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,SAA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,CAAC,CAElI"}
|
package/dist/core.node.js
CHANGED
|
@@ -117,9 +117,17 @@ g=h.every(function(a){return null===a||void 0===a})?void 0:h}else g=void 0;// Pr
|
|
|
117
117
|
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
118
|
* Factory function to create a BaseNode instance.
|
|
119
119
|
* @param element The React element type.
|
|
120
|
-
* @param props The props for the node.
|
|
120
|
+
* @param props The props for the node (optional).
|
|
121
121
|
* @returns NodeInstance<E> - A new BaseNode instance.
|
|
122
|
-
*/export function Node(a){var
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
*/export function Node(a,b){var c=_objectSpread({},b||{});return c.theme&&!c.nodetheme&&(c.nodetheme=c.theme),new BaseNode(a,c)}/**
|
|
123
|
+
* Creates a curried node factory for a given React element type.
|
|
124
|
+
*
|
|
125
|
+
* This utility returns a function that, when called with props, produces a `BaseNode` instance.
|
|
126
|
+
* It is useful for creating reusable node factories for specific components or element types.
|
|
127
|
+
* @template E The React element or component type.
|
|
128
|
+
* @param element The React element or component type to wrap.
|
|
129
|
+
* @returns A function that takes node props and returns a `NodeInstance<E>`.
|
|
130
|
+
* @example
|
|
131
|
+
* const ButtonNode = createNode('button');
|
|
132
|
+
* const myButton = ButtonNode({ children: 'Click me', style: { color: 'red' } });
|
|
133
|
+
*/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.
|
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,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACjD,cAAc,UAAU,CAAA;AACxB,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA"}
|
package/dist/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Node}from"./core.node";export*from"./hoc";export*from"./node.helper";export*from"./node.type";export*from"./html.node";
|
|
1
|
+
export{Node,createNode}from"./core.node";export*from"./hoc";export*from"./node.helper";export*from"./node.type";export*from"./html.node";
|
package/dist/node.type.d.ts
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import type { Attributes as ReactAttributes, ComponentProps, CSSProperties, ReactNode, JSX, ElementType, ComponentType, JSXElementConstructor, Component, Ref } from 'react';
|
|
2
2
|
import type { Root as ReactDOMRoot } from 'react-dom/client';
|
|
3
|
+
type RequiredKeys<T> = {
|
|
4
|
+
[K in keyof T]-?: object extends Pick<T, K> ? never : K;
|
|
5
|
+
}[keyof T];
|
|
6
|
+
export type HasRequiredProps<T> = RequiredKeys<T> extends never ? false : true;
|
|
3
7
|
/**
|
|
4
8
|
* Union type representing any valid node element in the system.
|
|
5
9
|
* Includes React nodes, component types, node instances, and function-based nodes.
|
|
6
10
|
*/
|
|
7
11
|
export type NodeElement = ReactNode | Promise<Awaited<ReactNode>> | Component<any, any, any> | ElementType | ComponentType<any> | NodeInstance<any> | ((props?: any) => ReactNode | Promise<Awaited<ReactNode>> | Component<any, any, any> | NodeInstance<any> | ComponentNode);
|
|
8
|
-
/**
|
|
9
|
-
* Defines valid child types that can be passed to a node:
|
|
10
|
-
* - ReactNode: Any valid React child (elements, strings, numbers, etc.)
|
|
11
|
-
* - ElementType: React component types (functions/classes)
|
|
12
|
-
* - NodeInstance: Other node instances in the tree
|
|
13
|
-
* - Function: Lazy child evaluation, useful for conditional rendering and hooks
|
|
14
|
-
*/
|
|
15
|
-
export type Children = ReactNode | Promise<Awaited<ReactNode>> | Component<any> | NodeElement | NodeInstance<any> | ComponentNode;
|
|
16
12
|
/**
|
|
17
13
|
* Forward declaration of the BaseNode interface to avoid circular dependencies.
|
|
18
14
|
* Defines the core structure and capabilities of a BaseNode instance.
|
|
@@ -29,6 +25,14 @@ export interface NodeInstance<T extends NodeElement = NodeElement> {
|
|
|
29
25
|
/** Creates Portal-compatible React elements for rendering outside of the DOM tree */
|
|
30
26
|
toPortal(): ReactDOMRoot | null;
|
|
31
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Defines valid child types that can be passed to a node:
|
|
30
|
+
* - ReactNode: Any valid React child (elements, strings, numbers, etc.)
|
|
31
|
+
* - ElementType: React component types (functions/classes)
|
|
32
|
+
* - NodeInstance: Other node instances in the tree
|
|
33
|
+
* - Function: Lazy child evaluation, useful for conditional rendering and hooks
|
|
34
|
+
*/
|
|
35
|
+
export type Children = ReactNode | Promise<Awaited<ReactNode>> | Component<any> | NodeElement | NodeInstance<any> | ComponentNode;
|
|
32
36
|
/**
|
|
33
37
|
* Extracts the props type from a given element type, handling both intrinsic (HTML) elements
|
|
34
38
|
* and custom React components, including MUI's OverridableComponent.
|
|
@@ -138,19 +142,10 @@ export type PortalProps<T extends BasePortalProps | Record<string, any>> = T & B
|
|
|
138
142
|
*/
|
|
139
143
|
export type PortalLauncher<P extends BasePortalProps | Record<string, any>> = P extends BasePortalProps ? (props?: {
|
|
140
144
|
/** Optional provider components to wrap the portal content */
|
|
141
|
-
provider?: NodeInstance<any
|
|
142
|
-
/**
|
|
143
|
-
* @deprecated
|
|
144
|
-
* Use a single NodeInstance instead of an array for fixed provider.
|
|
145
|
-
*/
|
|
146
|
-
| NodeInstance<any>[];
|
|
145
|
+
provider?: NodeInstance<any>;
|
|
147
146
|
}) => ReactDOMRoot | null : (props: P & {
|
|
148
147
|
/** Optional provider components to wrap the portal content */
|
|
149
|
-
provider?: NodeInstance<any
|
|
150
|
-
/**
|
|
151
|
-
* @deprecated
|
|
152
|
-
* Use a single NodeInstance instead of an array for fixed provider.
|
|
153
|
-
*/
|
|
154
|
-
| NodeInstance<any>[];
|
|
148
|
+
provider?: NodeInstance<any>;
|
|
155
149
|
} & Omit<PortalProps<P>, 'portal'>) => ReactDOMRoot | null;
|
|
150
|
+
export {};
|
|
156
151
|
//# sourceMappingURL=node.type.d.ts.map
|
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,EACV,UAAU,IAAI,eAAe,EAC7B,cAAc,EACd,aAAa,EACb,SAAS,EACT,GAAG,EACH,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,SAAS,EACT,GAAG,EACJ,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"node.type.d.ts","sourceRoot":"","sources":["../src/node.type.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,IAAI,eAAe,EAC7B,cAAc,EACd,aAAa,EACb,SAAS,EACT,GAAG,EACH,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,SAAS,EACT,GAAG,EACJ,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAI5D,KAAK,YAAY,CAAC,CAAC,IAAI;KACpB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC;CACxD,CAAC,MAAM,CAAC,CAAC,CAAA;AAGV,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,GAAG,IAAI,CAAA;AAE9E;;;GAGG;AACH,MAAM,MAAM,WAAW,GACnB,SAA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AAE,GAAG,CAAC,IAAI,CAAC,SAAS,eAAe,GACnG,CAAC,KAAK,CAAC,EAAE;IACP,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAA;CAC7B,KAAK,YAAY,GAAG,IAAI,GACzB,CACE,KAAK,EAAE,CAAC,GAAG;IACT,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAA;CAC7B,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,KAC/B,YAAY,GAAG,IAAI,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.1.
|
|
4
|
+
"version": "0.1.105",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/main.js",
|
|
7
7
|
"types": "./dist/main.d.ts",
|