@meonode/ui 0.2.2 → 0.2.4
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 +143 -0
- package/README.md +29 -29
- package/dist/core.node.d.ts +10 -2
- package/dist/core.node.d.ts.map +1 -1
- package/dist/core.node.js +9 -9
- package/dist/html.node.d.ts +552 -276
- package/dist/html.node.d.ts.map +1 -1
- package/dist/node.type.d.ts.map +1 -1
- package/dist/node.type.js +1 -1
- package/package.json +5 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.2.4] - 2025-09-02
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **core**: Exposed the original element via the created Node for easier access and debugging.
|
|
12
|
+
```typescript
|
|
13
|
+
import { createNode } from "@meonode/ui";
|
|
14
|
+
|
|
15
|
+
// Create a Node wrapping a 'div' element
|
|
16
|
+
const MyComp = createNode('div');
|
|
17
|
+
|
|
18
|
+
// Access the underlying element type
|
|
19
|
+
console.log(MyComp.element); // 'div'
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## [0.2.3] - 2025-09-01
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
- **types**: Remove forbidden css import to resolve RSC error
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
- **package**: Bump version to 0.2.3
|
|
29
|
+
|
|
30
|
+
## [0.2.2] - 2025-09-01
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
- **core**: Include nativeProps in props extraction for improved component flexibility
|
|
34
|
+
|
|
35
|
+
### Enhanced
|
|
36
|
+
- **types**: Enhance StyledRendererProps and FinalNodeProps for improved type safety
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
- **package**: Bump version to 0.2.2
|
|
40
|
+
|
|
41
|
+
## [0.2.1] - 2025-09-01
|
|
42
|
+
|
|
43
|
+
### Changed
|
|
44
|
+
- **types**: Update CSS type from CSSObject to CSSInterpolation for better compatibility
|
|
45
|
+
- **package**: Bump version to 0.2.1
|
|
46
|
+
|
|
47
|
+
## [0.2.0] - 2025-08-31
|
|
48
|
+
|
|
49
|
+
### Added
|
|
50
|
+
- **docs**: Add badges for NPM version, license, and bundle size to README
|
|
51
|
+
|
|
52
|
+
### Enhanced
|
|
53
|
+
- **docs**: Update installation instructions and enhance clarity in core concepts
|
|
54
|
+
- **docs**: Enhance documentation with new examples and improved clarity
|
|
55
|
+
|
|
56
|
+
### Removed
|
|
57
|
+
- **package**: Remove deprecated hook entry from package.json
|
|
58
|
+
|
|
59
|
+
### Fixed
|
|
60
|
+
- **core.node**: Add suppressHydrationWarning to propsForCreateElement
|
|
61
|
+
|
|
62
|
+
### Changed
|
|
63
|
+
- **package**: Bump version to 0.2.0
|
|
64
|
+
|
|
65
|
+
## [0.1.121] - 2025-08-30
|
|
66
|
+
|
|
67
|
+
### Changed
|
|
68
|
+
- **core.node**: Simplify style resolution and improve prop handling
|
|
69
|
+
- **StyledRenderer**: Remove unused style prop and simplify component
|
|
70
|
+
- **package**: Bump version to 0.1.121
|
|
71
|
+
|
|
72
|
+
## [0.1.120] - 2025-08-30
|
|
73
|
+
|
|
74
|
+
### Added
|
|
75
|
+
- **styles**: Add Emotion support and Next.js style registry integration
|
|
76
|
+
- Add @emotion/react and @emotion/cache dependencies
|
|
77
|
+
- Add StyledRenderer and StyleRegistry components for Emotion
|
|
78
|
+
- Integrate StyledRenderer into BaseNode for style prop rendering
|
|
79
|
+
- Add nextjs-registry export for Next.js style registry
|
|
80
|
+
|
|
81
|
+
### Enhanced
|
|
82
|
+
- **core**: Enhance style handling with StyledRenderer for Emotion support
|
|
83
|
+
|
|
84
|
+
### Fixed
|
|
85
|
+
- **deps**: Update peerDependencies for Emotion and React to use version constraints
|
|
86
|
+
- **deps**: Update @types/react and @types/react-dom to latest versions
|
|
87
|
+
|
|
88
|
+
### Changed
|
|
89
|
+
- **package**: Update peerDependencies for @emotion/cache
|
|
90
|
+
- **package**: Bump version to 0.1.120
|
|
91
|
+
|
|
92
|
+
## [0.1.118] - 2025-08-30
|
|
93
|
+
|
|
94
|
+
### Fixed
|
|
95
|
+
- **deps**: Update peerDependencies for Emotion and React to use version constraints
|
|
96
|
+
|
|
97
|
+
### Changed
|
|
98
|
+
- **package**: Bump version to 0.1.118
|
|
99
|
+
|
|
100
|
+
## [0.1.117] - 2025-08-30
|
|
101
|
+
|
|
102
|
+
### Added
|
|
103
|
+
- **flexbox**: Improve default style resolution and add flex shorthand parser
|
|
104
|
+
- Add parseFlexShorthand to extract flex-grow, shrink, and basis
|
|
105
|
+
- Enhance resolveDefaultStyle to respect explicit flex/flexShrink values
|
|
106
|
+
- Improve handling of minHeight, minWidth, and flexShrink for flex items
|
|
107
|
+
|
|
108
|
+
### Enhanced
|
|
109
|
+
- **core**: Refine type of finalChildren for improved type safety
|
|
110
|
+
- **docs**: Update documentation for clarity on flexbox scrolling fixes
|
|
111
|
+
|
|
112
|
+
### Changed
|
|
113
|
+
- **core**: Move comments position for better readability
|
|
114
|
+
- **imports**: Remove .js extensions from internal imports
|
|
115
|
+
- **package**: Bump version to 0.1.117
|
|
116
|
+
|
|
117
|
+
## [0.1.116] - 2025-08-27
|
|
118
|
+
|
|
119
|
+
### Changed
|
|
120
|
+
- **package**: Bump version to 0.1.116
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Notes
|
|
125
|
+
|
|
126
|
+
- This changelog covers the most recent development history available
|
|
127
|
+
- The project focuses on building React UIs with type-safe fluency without JSX syntax
|
|
128
|
+
- Recent development has emphasized Emotion integration, type safety improvements, and enhanced flexbox support
|
|
129
|
+
- For a complete history, view all commits on GitHub: [View all commits](https://github.com/l7aromeo/meonode-ui/commits)
|
|
130
|
+
|
|
131
|
+
## Development Highlights
|
|
132
|
+
|
|
133
|
+
### Major Features Added
|
|
134
|
+
- **Emotion Support**: Complete integration with @emotion/react for CSS-in-JS styling
|
|
135
|
+
- **Next.js Integration**: Style registry support for server-side rendering
|
|
136
|
+
- **Enhanced Type Safety**: Improved TypeScript definitions and prop handling
|
|
137
|
+
- **Flexbox Enhancements**: Advanced flex shorthand parsing and default style resolution
|
|
138
|
+
|
|
139
|
+
### Core Improvements
|
|
140
|
+
- Better component flexibility with native props extraction
|
|
141
|
+
- Simplified style resolution and prop handling
|
|
142
|
+
- Enhanced documentation and examples
|
|
143
|
+
- Improved dependency management and version constraints
|
package/README.md
CHANGED
|
@@ -14,39 +14,39 @@ A revolutionary approach to React component composition featuring function-based
|
|
|
14
14
|
import { Component, Root, Center, Column, H1, Button, Text } from '@meonode/ui';
|
|
15
15
|
|
|
16
16
|
const theme = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
primary: { default: '#FF6B6B', content: '#4A0000' },
|
|
18
|
+
secondary: { default: '#6BCB77', content: '#0A3B0F' },
|
|
19
|
+
base: { default: '#F8F8F8', content: '#333333' }
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
const App = Component(() =>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
})
|
|
23
|
+
Root({
|
|
24
|
+
theme,
|
|
25
|
+
backgroundColor: 'theme.base.default',
|
|
26
|
+
children: Center({
|
|
27
|
+
padding: 40,
|
|
28
|
+
children: Column({
|
|
29
|
+
gap: 24,
|
|
30
|
+
textAlign: 'center',
|
|
31
|
+
children: [
|
|
32
|
+
H1('Welcome to MeoNode', {
|
|
33
|
+
fontSize: '3rem',
|
|
34
|
+
color: 'theme.primary.default',
|
|
35
|
+
marginBottom: 16
|
|
36
|
+
}),
|
|
37
|
+
Button('Get Started', {
|
|
38
|
+
backgroundColor: 'theme.primary.default',
|
|
39
|
+
color: 'theme.primary.content',
|
|
40
|
+
padding: '12px 24px',
|
|
41
|
+
borderRadius: 8,
|
|
42
|
+
fontSize: '1.1rem',
|
|
43
|
+
cursor: 'pointer',
|
|
44
|
+
onClick: () => alert('Hello MeoNode!')
|
|
45
|
+
})
|
|
46
|
+
]
|
|
47
|
+
})
|
|
49
48
|
})
|
|
49
|
+
})
|
|
50
50
|
);
|
|
51
51
|
```
|
|
52
52
|
|
package/dist/core.node.d.ts
CHANGED
|
@@ -122,7 +122,11 @@ export declare function Node<AdditionalProps extends Record<string, any>, E exte
|
|
|
122
122
|
* const ButtonNode = createNode('button', { type: 'button' });
|
|
123
123
|
* const myButton = ButtonNode({ children: 'Click me', style: { color: 'red' } });
|
|
124
124
|
*/
|
|
125
|
-
export declare function createNode<AdditionalInitialProps extends Record<string, any>, E extends NodeElement>(element: E, initialProps?: NodeProps<E> & AdditionalInitialProps): HasRequiredProps<PropsOf<E>> extends true ? <AdditionalProps extends Record<string, any> = Record<string, any>>(props: NodeProps<E> & AdditionalProps) => NodeInstance<E>
|
|
125
|
+
export declare function createNode<AdditionalInitialProps extends Record<string, any>, E extends NodeElement>(element: E, initialProps?: NodeProps<E> & AdditionalInitialProps): HasRequiredProps<PropsOf<E>> extends true ? (<AdditionalProps extends Record<string, any> = Record<string, any>>(props: NodeProps<E> & AdditionalProps) => NodeInstance<E>) & {
|
|
126
|
+
element: E;
|
|
127
|
+
} : (<AdditionalProps extends Record<string, any> = Record<string, any>>(props?: NodeProps<E> & AdditionalProps) => NodeInstance<E>) & {
|
|
128
|
+
element: E;
|
|
129
|
+
};
|
|
126
130
|
/**
|
|
127
131
|
* Creates a node factory function where the first argument is `children` and the second is `props`.
|
|
128
132
|
*
|
|
@@ -142,5 +146,9 @@ export declare function createNode<AdditionalInitialProps extends Record<string,
|
|
|
142
146
|
* const Text = createChildrenFirstNode('p');
|
|
143
147
|
* const myDiv = Text('Hello', { className: 'text-lg' });
|
|
144
148
|
*/
|
|
145
|
-
export declare function createChildrenFirstNode<AdditionalInitialProps extends Record<string, any>, E extends ElementType>(element: E, initialProps?: Omit<NodeProps<E> & AdditionalInitialProps, 'children'>): HasRequiredProps<PropsOf<E>> extends true ? <AdditionalProps extends Record<string, any> = Record<string, any>>(children: NodeElement | NodeElement[], props: Omit<NodeProps<E> & AdditionalProps, 'children'>) => NodeInstance<E>
|
|
149
|
+
export declare function createChildrenFirstNode<AdditionalInitialProps extends Record<string, any>, E extends ElementType>(element: E, initialProps?: Omit<NodeProps<E> & AdditionalInitialProps, 'children'>): HasRequiredProps<PropsOf<E>> extends true ? (<AdditionalProps extends Record<string, any> = Record<string, any>>(children: NodeElement | NodeElement[], props: Omit<NodeProps<E> & AdditionalProps, 'children'>) => NodeInstance<E>) & {
|
|
150
|
+
element: E;
|
|
151
|
+
} : (<AdditionalProps extends Record<string, any> = Record<string, any>>(children?: NodeElement | NodeElement[], props?: Omit<NodeProps<E> & AdditionalProps, 'children'>) => NodeInstance<E>) & {
|
|
152
|
+
element: E;
|
|
153
|
+
};
|
|
146
154
|
//# 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,KAAK,YAAY,EAAE,MAAM,OAAO,CAAA;AAC1J,OAAO,KAAK,EACV,cAAc,EAEd,gBAAgB,EA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CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,SAAS,WAAW,EAC/G,OAAO,EAAE,CAAC,EACV,YAAY,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,sBAAsB,EAAE,UAAU,CAAC,GACrE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GACxC,CAAC,CAAC,eAAe,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACjE,QAAQ,EAAE,WAAW,GAAG,WAAW,EAAE,EACrC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,eAAe,EAAE,UAAU,CAAC,KACpD,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,GACtC,CAAC,CAAC,eAAe,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACjE,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,CAAC,GAAG;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,CAQzC"}
|
package/dist/core.node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _excluded=["ref","key","children","nodetheme","theme","props"],_excluded2=["style"],_excluded3=["style","css"],_excluded4=["style"],_excluded5=["children","key"];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 _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}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)}import React,{Fragment,createElement,isValidElement}from"react";import{isNodeInstance,resolveDefaultStyle,resolveObjWithTheme}from"./node.helper";import{isForwardRef,isFragment,isMemo,isReactClassComponent,isValidElementType}from"./react-is.helper";import{createRoot}from"react-dom/client";import{getComponentType,getCSSProps,getDOMProps,getElementTypeName}from"./common.helper";import{StyledRenderer}from"./components";/**
|
|
1
|
+
"use strict";var _excluded=["ref","key","children","nodetheme","theme","props"],_excluded2=["style"],_excluded3=["style","css"],_excluded4=["style"],_excluded5=["children","key","nativeProps"];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 _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}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)}import React,{Fragment,createElement,isValidElement}from"react";import{isNodeInstance,resolveDefaultStyle,resolveObjWithTheme}from"./node.helper";import{isForwardRef,isFragment,isMemo,isReactClassComponent,isValidElementType}from"./react-is.helper";import{createRoot}from"react-dom/client";import{getComponentType,getCSSProps,getDOMProps,getElementTypeName}from"./common.helper";import{StyledRenderer}from"./components";/**
|
|
2
2
|
* Represents a node in a React component tree with theme and styling capabilities.
|
|
3
3
|
* This class wraps React elements and handles:
|
|
4
4
|
* - Props processing and normalization
|
|
@@ -108,13 +108,13 @@ return a}/**
|
|
|
108
108
|
* Recursively processes child nodes and uses `React.createElement` to construct the final React element.
|
|
109
109
|
* @returns A ReactNode representing the rendered element.
|
|
110
110
|
*/render(){var a=this;if(!isValidElementType(this.element)){var b=getComponentType(this.element);throw new Error("Invalid element type: ".concat(b," provided!"))}// Extract children and key
|
|
111
|
-
var c=this.props,d=c.children,e=c.key,f=_objectWithoutProperties(c,_excluded5),
|
|
112
|
-
var
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
var
|
|
111
|
+
var c=this.props,d=c.children,e=c.key,f=c.nativeProps,g=_objectWithoutProperties(c,_excluded5),h=void 0;if(void 0!==d&&null!==d)if(!Array.isArray(d))h=this._normalizeChild(d);else if(0<d.length){// Normalize each child in the array
|
|
112
|
+
var i=d.map(function(b){return a._normalizeChild(b)});// Check if all children are null/undefined (e.g., conditional rendering resulted in nothing)
|
|
113
|
+
h=i.every(function(a){return null===a||void 0===a})?void 0:i}else// Empty array of children
|
|
114
|
+
h=void 0;// Prepare props for React.createElement
|
|
115
|
+
var j;// If the element has css props, render using the StyledRenderer component
|
|
116
116
|
// This allows for styles to be handled by emotion
|
|
117
|
-
return this.element===Fragment||isFragment(this.element)?
|
|
117
|
+
return j=this.element===Fragment||isFragment(this.element)?{key:e}:_objectSpread(_objectSpread(_objectSpread({},g),{},{key:e},f),{},{suppressHydrationWarning:!0}),this.element&&j.css?createElement(StyledRenderer,_objectSpread({element:this.element},j),h):createElement(this.element,j,h)}_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
|
* @template AdditionalProps Additional props to merge with node props.
|
|
120
120
|
* @template E The React element or component type.
|
|
@@ -135,7 +135,7 @@ return this.element===Fragment||isFragment(this.element)?i={key:e}:(i=_objectSpr
|
|
|
135
135
|
* @example
|
|
136
136
|
* const ButtonNode = createNode('button', { type: 'button' });
|
|
137
137
|
* const myButton = ButtonNode({ children: 'Click me', style: { color: 'red' } });
|
|
138
|
-
*/export function createNode(a,b){
|
|
138
|
+
*/export function createNode(a,b){var c=function Instance(c){return Node(a,_objectSpread(_objectSpread({},b),c))};return c.element=a,c}/**
|
|
139
139
|
* Creates a node factory function where the first argument is `children` and the second is `props`.
|
|
140
140
|
*
|
|
141
141
|
* Useful for ergonomic creation of nodes where children are the primary concern,
|
|
@@ -153,4 +153,4 @@ return this.element===Fragment||isFragment(this.element)?i={key:e}:(i=_objectSpr
|
|
|
153
153
|
* @example
|
|
154
154
|
* const Text = createChildrenFirstNode('p');
|
|
155
155
|
* const myDiv = Text('Hello', { className: 'text-lg' });
|
|
156
|
-
*/export function createChildrenFirstNode(a,b){
|
|
156
|
+
*/export function createChildrenFirstNode(a,b){var c=function Instance(c,d){return Node(a,_objectSpread(_objectSpread(_objectSpread({},b),d),{},{children:c}))};return c.element=a,c}
|