@meonode/ui 0.1.112 → 0.1.113
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 +29 -7
- package/dist/core.node.d.ts.map +1 -1
- package/dist/core.node.js +25 -5
- package/dist/hoc/component.hoc.d.ts +3 -3
- package/dist/hoc/component.hoc.d.ts.map +1 -1
- package/dist/html.node.d.ts +997 -139
- package/dist/html.node.d.ts.map +1 -1
- package/dist/html.node.js +55 -59
- package/dist/node.type.d.ts +3 -13
- package/dist/node.type.d.ts.map +1 -1
- package/package.json +14 -14
package/dist/core.node.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ElementType, type ReactNode } from 'react';
|
|
1
|
+
import { type ElementType, type ReactNode, type ReactElement } from 'react';
|
|
2
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
|
/**
|
|
@@ -94,7 +94,7 @@ export declare class BaseNode<E extends NodeElement = NodeElement> implements No
|
|
|
94
94
|
* Recursively processes child nodes and uses `React.createElement` to construct the final React element.
|
|
95
95
|
* @returns A ReactNode representing the rendered element.
|
|
96
96
|
*/
|
|
97
|
-
render():
|
|
97
|
+
render(): ReactElement;
|
|
98
98
|
private _ensurePortalInfrastructure;
|
|
99
99
|
toPortal(): ReactDOMRoot | null;
|
|
100
100
|
}
|
|
@@ -106,16 +106,38 @@ export declare class BaseNode<E extends NodeElement = NodeElement> implements No
|
|
|
106
106
|
*/
|
|
107
107
|
export declare function Node<E extends NodeElement>(element: E, props?: NodeProps<E>): NodeInstance<E>;
|
|
108
108
|
/**
|
|
109
|
-
* Creates a curried node factory for a given React element type.
|
|
109
|
+
* Creates a curried node factory for a given React element or component type.
|
|
110
110
|
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
111
|
+
* Returns a function that, when called with props, produces a `BaseNode` instance.
|
|
112
|
+
* Useful for creating reusable node factories for specific components or element types.
|
|
113
113
|
* @template E The React element or component type.
|
|
114
|
+
* @template AdditionalInitialProps Additional props to merge with node props.
|
|
114
115
|
* @param element The React element or component type to wrap.
|
|
116
|
+
* @param initialProps Initial props to apply to every node instance.
|
|
115
117
|
* @returns A function that takes node props and returns a `NodeInstance<E>`.
|
|
116
118
|
* @example
|
|
117
|
-
* const ButtonNode = createNode('button');
|
|
119
|
+
* const ButtonNode = createNode('button', { type: 'button' });
|
|
118
120
|
* const myButton = ButtonNode({ children: 'Click me', style: { color: 'red' } });
|
|
119
121
|
*/
|
|
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>;
|
|
122
|
+
export declare function createNode<AdditionalInitialProps extends Record<string, any> = Record<string, any>, E extends ElementType = ElementType>(element: E, initialProps?: NodeProps<E> & AdditionalInitialProps): HasRequiredProps<PropsOf<E>> extends true ? <AdditionalProps extends Record<string, any> = AdditionalInitialProps>(props: NodeProps<E> & AdditionalProps) => NodeInstance<E> : <AdditionalProps extends Record<string, any> = AdditionalInitialProps>(props?: NodeProps<E> & AdditionalProps) => NodeInstance<E>;
|
|
123
|
+
/**
|
|
124
|
+
* Creates a node factory function where the first argument is `children` and the second is `props`.
|
|
125
|
+
*
|
|
126
|
+
* This is useful for ergonomic creation of nodes where children are the primary concern,
|
|
127
|
+
* such as for layout or container components.
|
|
128
|
+
*
|
|
129
|
+
* The returned function takes `children` as the first argument and `props` (excluding `children`) as the second.
|
|
130
|
+
* It merges any `initialProps` provided at factory creation, then creates a `BaseNode` instance.
|
|
131
|
+
*
|
|
132
|
+
* Type parameters:
|
|
133
|
+
* - `AdditionalInitialProps`: Extra props to merge with node props.
|
|
134
|
+
* - `E`: The React element or component type.
|
|
135
|
+
* @param element The React element or component type to wrap.
|
|
136
|
+
* @param initialProps Initial props to apply to every node instance (excluding `children`).
|
|
137
|
+
* @returns A function that takes `children` and `props`, returning a `NodeInstance<E>`.
|
|
138
|
+
* @example
|
|
139
|
+
* const DivNode = createChildrenFirstNode('div');
|
|
140
|
+
* const myDiv = DivNode([<span key="1" />, <span key="2" />], { className: 'container' });
|
|
141
|
+
*/
|
|
142
|
+
export declare function createChildrenFirstNode<AdditionalInitialProps extends Record<string, any> = Record<string, any>, E extends ElementType = ElementType>(element: E, initialProps?: Omit<NodeProps<E> & AdditionalInitialProps, 'children'>): HasRequiredProps<PropsOf<E>> extends true ? <AdditionalProps extends Record<string, any> = AdditionalInitialProps>(children: NodeElement | NodeElement[], props: Omit<NodeProps<E> & AdditionalProps, 'children'>) => NodeInstance<E> : <AdditionalProps extends Record<string, any> = AdditionalInitialProps>(children?: NodeElement | NodeElement[], props?: Omit<NodeProps<E> & AdditionalProps, 'children'>) => NodeInstance<E>;
|
|
121
143
|
//# 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,EAAgD,KAAK,WAAW,EAA4B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../src/core.node.ts"],"names":[],"mappings":"AACA,OAAc,EAAgD,KAAK,WAAW,EAA4B,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAA;AAC1J,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,CAA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pB,CAAC,eAAe,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,sBAAsB,EACnE,QAAQ,CAAC,EAAE,WAAW,GAAG,WAAW,EAAE,EACtC,KAAK,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,eAAe,EAAE,UAAU,CAAC,KACrD,YAAY,CAAC,CAAC,CAAC,CAKvB"}
|
package/dist/core.node.js
CHANGED
|
@@ -118,14 +118,34 @@ var i;return i=this.element===Fragment||isFragment(this.element)?{key:e}:_object
|
|
|
118
118
|
* @param props The props for the node (optional).
|
|
119
119
|
* @returns NodeInstance<E> - A new BaseNode instance.
|
|
120
120
|
*/export function Node(a,b){var c=_objectSpread({},b||{});return c.theme&&!c.nodetheme&&(c.nodetheme=c.theme),new BaseNode(a,c)}/**
|
|
121
|
-
* Creates a curried node factory for a given React element type.
|
|
121
|
+
* Creates a curried node factory for a given React element or component type.
|
|
122
122
|
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
123
|
+
* Returns a function that, when called with props, produces a `BaseNode` instance.
|
|
124
|
+
* Useful for creating reusable node factories for specific components or element types.
|
|
125
125
|
* @template E The React element or component type.
|
|
126
|
+
* @template AdditionalInitialProps Additional props to merge with node props.
|
|
126
127
|
* @param element The React element or component type to wrap.
|
|
128
|
+
* @param initialProps Initial props to apply to every node instance.
|
|
127
129
|
* @returns A function that takes node props and returns a `NodeInstance<E>`.
|
|
128
130
|
* @example
|
|
129
|
-
* const ButtonNode = createNode('button');
|
|
131
|
+
* const ButtonNode = createNode('button', { type: 'button' });
|
|
130
132
|
* const myButton = ButtonNode({ children: 'Click me', style: { color: 'red' } });
|
|
131
|
-
*/export function createNode(a){return function(
|
|
133
|
+
*/export function createNode(a,b){return function(c){return Node(a,_objectSpread(_objectSpread({},b),c))}}/**
|
|
134
|
+
* Creates a node factory function where the first argument is `children` and the second is `props`.
|
|
135
|
+
*
|
|
136
|
+
* This is useful for ergonomic creation of nodes where children are the primary concern,
|
|
137
|
+
* such as for layout or container components.
|
|
138
|
+
*
|
|
139
|
+
* The returned function takes `children` as the first argument and `props` (excluding `children`) as the second.
|
|
140
|
+
* It merges any `initialProps` provided at factory creation, then creates a `BaseNode` instance.
|
|
141
|
+
*
|
|
142
|
+
* Type parameters:
|
|
143
|
+
* - `AdditionalInitialProps`: Extra props to merge with node props.
|
|
144
|
+
* - `E`: The React element or component type.
|
|
145
|
+
* @param element The React element or component type to wrap.
|
|
146
|
+
* @param initialProps Initial props to apply to every node instance (excluding `children`).
|
|
147
|
+
* @returns A function that takes `children` and `props`, returning a `NodeInstance<E>`.
|
|
148
|
+
* @example
|
|
149
|
+
* const DivNode = createChildrenFirstNode('div');
|
|
150
|
+
* const myDiv = DivNode([<span key="1" />, <span key="2" />], { className: 'container' });
|
|
151
|
+
*/export function createChildrenFirstNode(a,b){return function(c,d){return Node(a,_objectSpread(_objectSpread(_objectSpread({},b),d),{},{children:c}))}}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentNode, HasCSSCompatibleStyleProp, NodeElement, Theme } from '../node.type';
|
|
2
|
-
import { type CSSProperties, type
|
|
2
|
+
import { type CSSProperties, type ReactElement } from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* Props definition for components wrapped using the `Component` higher-order function.
|
|
5
5
|
*
|
|
@@ -36,7 +36,7 @@ export type ComponentNodeProps<TProps> = TProps extends undefined ? Partial<{
|
|
|
36
36
|
* Title({ children: 'Hello' })
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
|
-
export declare function Component<TProps extends undefined>(component: (props: ComponentNodeProps<TProps>) => ComponentNode): (props?: ComponentNodeProps<TProps>) =>
|
|
39
|
+
export declare function Component<TProps extends undefined>(component: (props: ComponentNodeProps<TProps>) => ComponentNode): (props?: ComponentNodeProps<TProps>) => ReactElement | Promise<Awaited<ReactElement>>;
|
|
40
40
|
/**
|
|
41
41
|
* Creates a component from a function that uses a defined props interface.
|
|
42
42
|
* @template TProps Props interface expected by the component.
|
|
@@ -59,5 +59,5 @@ export declare function Component<TProps extends undefined>(component: (props: C
|
|
|
59
59
|
* Button({ label: 'Click me', onClick: () => alert('clicked')})
|
|
60
60
|
* ```
|
|
61
61
|
*/
|
|
62
|
-
export declare function Component<TProps extends Record<string, any>>(component: (props: ComponentNodeProps<TProps>) => ComponentNode): (props: ComponentNodeProps<TProps>) =>
|
|
62
|
+
export declare function Component<TProps extends Record<string, any>>(component: (props: ComponentNodeProps<TProps>) => ComponentNode): (props: ComponentNodeProps<TProps>) => ReactElement | Promise<Awaited<ReactElement>>;
|
|
63
63
|
//# sourceMappingURL=component.hoc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.hoc.d.ts","sourceRoot":"","sources":["../../src/hoc/component.hoc.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAClG,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"component.hoc.d.ts","sourceRoot":"","sources":["../../src/hoc/component.hoc.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAClG,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAkB,MAAM,OAAO,CAAA;AAE7E;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,kBAAkB,CAAC,MAAM,IAAI,MAAM,SAAS,SAAS,GAC7D,OAAO,CAAC;IACN,QAAQ,EAAE,WAAW,GAAG,WAAW,EAAE,CAAA;IACrC,KAAK,EAAE,KAAK,CAAA;CACb,CAAC,GACF,MAAM,GACJ,CAAC,yBAAyB,CAAC,MAAM,CAAC,SAAS,IAAI,GAAG,aAAa,GAAG,MAAM,CAAC,GACzE,OAAO,CAAC;IACN,KAAK,EAAE,OAA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