@meonode/ui 0.0.1-alpha.9 → 0.1.0
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 +2 -2
- package/dist/core.node.d.ts.map +1 -1
- package/dist/core.node.js +27 -25
- package/dist/node.helper.d.ts +10 -12
- package/dist/node.helper.d.ts.map +1 -1
- package/dist/node.helper.js +9 -11
- package/dist/node.type.d.ts +6 -11
- package/dist/node.type.d.ts.map +1 -1
- package/dist/react-is.helper.d.ts +2 -5
- package/dist/react-is.helper.d.ts.map +1 -1
- package/dist/react-is.helper.js +2 -2
- package/package.json +7 -4
package/dist/core.node.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import { BaseNodeInstance, NodeElement, NodeProps } from './node.type.js';
|
|
3
3
|
/**
|
|
4
4
|
* Factory function to create a BaseNode instance.
|
|
@@ -21,5 +21,5 @@ export declare function Node<E extends NodeElement>(element: E, props?: Partial<
|
|
|
21
21
|
* return Node('div', { ...props })
|
|
22
22
|
* })
|
|
23
23
|
*/
|
|
24
|
-
export declare function Component<T extends Record<string, any>>(component: (props: T) => BaseNodeInstance<any> | ReactNode): (props: T) => string | number | bigint | boolean |
|
|
24
|
+
export declare function Component<T extends Record<string, any>>(component: (props: T) => BaseNodeInstance<any> | ReactNode): (props: T) => string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | BaseNodeInstance<any> | null | undefined;
|
|
25
25
|
//# 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,OAAO,EAAkF,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../src/core.node.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAkF,SAAS,EAAE,MAAM,OAAO,CAAA;AACxH,OAAO,EAAE,gBAAgB,EAAwC,WAAW,EAAE,SAAS,EAA4B,MAAM,mBAAmB,CAAA;AAuT5I;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,WAAW,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,GAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAS9G;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,gBAAgB,CAAC,GAAG,CAAC,GAAG,SAAS,IACzG,OAAO,CAAC,kXAOjB"}
|
package/dist/core.node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _excluded=["children","nodeTheme"],_excluded2=["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 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 _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 _classCallCheck(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),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{createElement,isValidElement}from"react";import{getComponentType,getCSSProps,getDOMProps,getElementTypeName,getValueByPath}from"./node.helper.js";import{isForwardRef,isMemo,isReactClassComponent,isValidElementType}from"./react-is.helper.js";/**
|
|
1
|
+
"use strict";var _excluded=["children","nodeTheme"],_excluded2=["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 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 _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 _classCallCheck(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),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,{createElement,isValidElement}from"react";import{getComponentType,getCSSProps,getDOMProps,getElementTypeName,getValueByPath}from"./node.helper.js";import{isForwardRef,isMemo,isReactClassComponent,isValidElementType}from"./react-is.helper.js";/**
|
|
2
2
|
* Represents a node in a React component tree, providing a structured way to define and manipulate
|
|
3
3
|
* React elements before they are rendered. Handles props processing, theme application, and child node management.
|
|
4
4
|
* @template E The type of the React element this node represents (e.g., 'div', a custom component).
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* Constructs a new BaseNode instance.
|
|
7
7
|
* @param element The React element type.
|
|
8
8
|
* @param rawProps The raw props for the node.
|
|
9
|
-
*/function BaseNode(a,b){var c=this;_classCallCheck(this,BaseNode),this.element=a,this.
|
|
10
|
-
i=0<Object.keys(i).length?i:{};var j=getDOMProps(g),k=void 0;// 2. Process
|
|
11
|
-
if(e!==void 0&&null!==e)if(Array.isArray(e)){k=e.map(function(a,b){return c.
|
|
12
|
-
)}else// For a single child, no index is passed; existing key logic in
|
|
13
|
-
k=this.
|
|
9
|
+
*/function BaseNode(a,b){var c=this;_classCallCheck(this,BaseNode),this.element=a,this.rawProps=b;var d=b||{},e=d.children,f=d.nodeTheme,g=_objectWithoutProperties(d,_excluded),h=getCSSProps(g),i=this._resolveStyleWithTheme(h,f);// 1. Resolve styles and DOM props for this node
|
|
10
|
+
i=0<Object.keys(i).length?i:{};var j=getDOMProps(g),k=void 0;// 2. Process rawNoderen into BaseNode instances or primitives, passing down currentTheme
|
|
11
|
+
if(e!==void 0&&null!==e)if(Array.isArray(e)){k=e.map(function(a,b){return c._processRawNode(a,f,b)}// Pass index for array children
|
|
12
|
+
)}else// For a single child, no index is passed; existing key logic in _processRawNode will apply
|
|
13
|
+
k=this._processRawNode(e,f);// 3. Construct final this.props
|
|
14
14
|
this.props=_objectSpread(_objectSpread({},j),{},{style:i,nodeTheme:f,children:k})}/**
|
|
15
15
|
* Resolves style properties by replacing theme path placeholders with actual theme values.
|
|
16
16
|
* Handles complex strings like '1px solid theme.background.primary' and iterative resolution.
|
|
@@ -34,39 +34,41 @@ return void 0!==d&&null!==d&&("string"==typeof d||"number"==typeof d)?d+"":a;//
|
|
|
34
34
|
* @param props.render The function to invoke for rendering the child.
|
|
35
35
|
* @param props.passedTheme The theme to provide to the child, if applicable.
|
|
36
36
|
* @returns The rendered ReactNode, with theme applied if necessary.
|
|
37
|
-
*/},{key:"_functionRenderer",value:function _functionRenderer(a){var b=a.render,c=a.passedTheme,d=a.passedKey,e=b();// Call the user-provided render function to get the child.
|
|
38
|
-
if(e instanceof BaseNode){var
|
|
37
|
+
*/},{key:"_functionRenderer",value:function _functionRenderer(a){var b=a.render,c=a.passedTheme,d=a.passedKey,e=a.processRawNode,f=b();// Call the user-provided render function to get the child.
|
|
38
|
+
if(f instanceof React.Component){var g=f.render(),h=e(g,c);return h instanceof BaseNode?h.render():h}if(f instanceof BaseNode){var i,j=f;// If the returned BaseNode does not have its own theme, but a theme is provided,
|
|
39
39
|
// re-create the node with the provided theme to ensure correct theme propagation.
|
|
40
|
-
return void 0===(null===(
|
|
41
|
-
key:d})).render():
|
|
40
|
+
return void 0===(null===(i=j.rawProps)||void 0===i?void 0:i.nodeTheme)&&void 0!==c?new BaseNode(j.element,_objectSpread(_objectSpread({},j.rawProps||{}),{},{nodeTheme:c,theme:c,// Also pass theme for consistency if it was used in rawProps
|
|
41
|
+
key:d})).render():j.render();// If the node already has a theme or no theme is provided, render as-is.
|
|
42
42
|
}// If the result is not a BaseNode (e.g., JSX, string, etc.), return it directly.
|
|
43
43
|
// Note: Non-BaseNode results will not automatically receive the theme.
|
|
44
|
-
return
|
|
44
|
+
return f}/**
|
|
45
45
|
* Processes a single raw child element, converting it into a ProcessedChild.
|
|
46
46
|
* If the child is part of an array and lacks an explicit key, a stable indexed key
|
|
47
47
|
* (`elementName_child_index`) is generated for new BaseNode instances.
|
|
48
|
-
* @param
|
|
48
|
+
* @param rawNode The raw child element to process.
|
|
49
49
|
* @param parentTheme The theme inherited from the parent node.
|
|
50
50
|
* @param childIndex Optional index of the child if it's part of an array.
|
|
51
51
|
* @returns The processed child.
|
|
52
|
-
*/},{key:"
|
|
53
|
-
){var d=getComponentType(a),e=function generateIndexedKeyIfNeeded(a,b){if(b!==void 0&&null!==b)return b;if(void 0!==c){var d=getElementTypeName(a);return"".concat(d,"
|
|
52
|
+
*/},{key:"_processRawNode",value:function _processRawNode(a,b,c// Index for generating stable keys for array children
|
|
53
|
+
){var d=getComponentType(a),e=function generateIndexedKeyIfNeeded(a,b){if(b!==void 0&&null!==b)return b;if(void 0!==c){var d=getElementTypeName(a);return"".concat(d,"-").concat(c)}// No explicit key, and not an array child, so BaseNode constructor will handle.
|
|
54
54
|
};// Helper to generate an indexed key if no explicit key is present and an index is available.
|
|
55
55
|
// Case 1: Child is already a BaseNode instance
|
|
56
|
-
if(a instanceof BaseNode||"object"===_typeof(a)&&null!==a&&!0===a._isBaseNode){var f=a,g=f.
|
|
56
|
+
if(a instanceof BaseNode||"object"===_typeof(a)&&null!==a&&!0===a._isBaseNode){var f=a,g=f.rawProps||{},h=g.nodeTheme,i=e(f.element,g.key);// Prefer child's own theme
|
|
57
57
|
return new BaseNode(f.element,_objectSpread(_objectSpread({},g),{},{nodeTheme:h||b||{},key:i}))}// Case 2: Child is a primitive (string, number, boolean, null, undefined)
|
|
58
58
|
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).
|
|
59
59
|
if("function"===d&&!isReactClassComponent(a)&&!isMemo(a)&&!isForwardRef(a)){// The key is for the BaseNode that wraps the _functionRenderer component.
|
|
60
60
|
// Functions themselves don't have a .key prop that we can access here.
|
|
61
|
-
var j=e(this._functionRenderer,void 0);return new BaseNode(this._functionRenderer,{render:a,passedTheme:b,key:j})}// Case 4: Child is a React Element (JSX element)
|
|
62
|
-
if(isValidElement(a)){
|
|
63
|
-
|
|
64
|
-
//
|
|
65
|
-
|
|
66
|
-
// Create new BaseNode with props
|
|
67
|
-
return
|
|
68
|
-
if(isReactClassComponent(a)||"object"===d&&(isMemo(a)||isForwardRef(a))){// ElementTypes don't have an intrinsic key from the
|
|
69
|
-
var
|
|
61
|
+
var j=e(this._functionRenderer,void 0);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>)
|
|
62
|
+
if(isValidElement(a)){var k,l=_objectSpread({},a.props);// Extract and merge props from the JSX element, flattening style props
|
|
63
|
+
l=_objectSpread(_objectSpread({},l.style),l),delete l.style;// Remove original style object after merging
|
|
64
|
+
// Handle theme by preferring nodeTheme from child's props, falling back to parent theme if not set
|
|
65
|
+
var m=(null===(k=l)||void 0===k?void 0:k.nodeTheme)||b,n=e(a.type,a.key);// For array children without keys, generate stable key from element type and index
|
|
66
|
+
// Create new BaseNode instance with processed props and theme
|
|
67
|
+
return new BaseNode(a.type,_objectSpread(_objectSpread({},l),{},{nodeTheme:m,key:n}))}// Case 5: Child is an ElementType (string tag, class component, Memo/ForwardRef)
|
|
68
|
+
if(isReactClassComponent(a)||"object"===d&&(isMemo(a)||isForwardRef(a))){// ElementTypes don't have an intrinsic key from the rawNode itself.
|
|
69
|
+
var o=e(a,void 0);return new BaseNode(a,{nodeTheme:b,key:o})}// Case 6: Handle instances of React.Component
|
|
70
|
+
if(a instanceof React.Component){var p=a.render();// Recursively process the rendered element with parent theme and index
|
|
71
|
+
return this._processRawNode(p,b,c)}// Case 7: Fallback for other ReactNode types (e.g., Fragments, Portals if not caught by isValidElement)
|
|
70
72
|
// These are returned as-is. If they are elements within an array, React expects them to have keys.
|
|
71
73
|
// This logic primarily adds keys to BaseNode instances we create.
|
|
72
74
|
return a}/**
|
|
@@ -88,7 +90,7 @@ return delete h.nodeTheme,createElement(this.element,h,f)}}])}();/**
|
|
|
88
90
|
* @returns BaseNodeInstance<E> - A new BaseNode instance.
|
|
89
91
|
*/export function Node(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c=_objectSpread({},b);// Ensure we are working with a mutable copy
|
|
90
92
|
// 'theme' prop itself is not directly used by BaseNode after this, nodeTheme is.
|
|
91
|
-
// We can keep `theme` in
|
|
93
|
+
// We can keep `theme` in rawProps if needed for cloning or inspection.
|
|
92
94
|
return c.theme&&void 0===c.nodeTheme&&(c.nodeTheme=c.theme),new BaseNode(a,c)}/**
|
|
93
95
|
* Higher-order component wrapper that converts BaseNode components into React components.
|
|
94
96
|
*
|
package/dist/node.helper.d.ts
CHANGED
|
@@ -14,22 +14,20 @@ import type { NodeElement, OriginalNodeProps } from './node.type.js';
|
|
|
14
14
|
* getComponentType(React.memo(() => <div/>)) // 'memo'
|
|
15
15
|
* getComponentType(() => <div/>) // 'function'
|
|
16
16
|
*/
|
|
17
|
-
export declare const getComponentType: (component?: NodeElement) => "class" | "forwardRef" | "memo" | "object" | "
|
|
17
|
+
export declare const getComponentType: (component?: NodeElement) => "class" | "forwardRef" | "memo" | "object" | "function" | "fragment" | "portal" | "profiler" | "strict-mode" | "suspense" | "suspense-list" | "context-consumer" | "context-provider" | "lazy" | "element" | "unknown" | string;
|
|
18
18
|
/**
|
|
19
|
-
* Generates a string name for an ElementType.
|
|
19
|
+
* Generates a string name for an ElementType or ReactElement.
|
|
20
20
|
*
|
|
21
|
-
* This function attempts to extract a meaningful name from a React ElementType
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* `React.
|
|
25
|
-
* for functions and unwraps higher-order components to get the underlying name.
|
|
21
|
+
* This function attempts to extract a meaningful name from a React ElementType
|
|
22
|
+
* (string, function, class, HOC) or a ReactElement instance.
|
|
23
|
+
* It prioritizes `displayName` and `name` properties and unwraps HOCs like
|
|
24
|
+
* `React.memo` and `React.forwardRef` to get the underlying component name.
|
|
26
25
|
*
|
|
27
|
-
* If a name cannot be determined, it returns 'UnknownElementType'.
|
|
28
|
-
* @
|
|
29
|
-
* @
|
|
30
|
-
* @returns A string representation of the element type.
|
|
26
|
+
* If a name cannot be determined, it returns a fallback like 'UnknownElementType' or 'AnonymousComponent'.
|
|
27
|
+
* @param node The ElementType or ReactElement (e.g., 'div', MyComponent, <MyComponent />).
|
|
28
|
+
* @returns A string representation of the element type's name.
|
|
31
29
|
*/
|
|
32
|
-
export declare function getElementTypeName(
|
|
30
|
+
export declare function getElementTypeName(node: unknown): string;
|
|
33
31
|
/**
|
|
34
32
|
* Filters an object to only include valid CSS properties
|
|
35
33
|
* @param props The object containing potential CSS properties
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.helper.d.ts","sourceRoot":"","sources":["../src/node.helper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAwBvE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,GAC3B,YAAY,WAAW,KAErB,OAAO,GACP,YAAY,GACZ,MAAM,GACN,QAAQ,GACR,
|
|
1
|
+
{"version":3,"file":"node.helper.d.ts","sourceRoot":"","sources":["../src/node.helper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAwBvE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,GAC3B,YAAY,WAAW,KAErB,OAAO,GACP,YAAY,GACZ,MAAM,GACN,QAAQ,GACR,UAAU,GACV,UAAU,GACV,QAAQ,GACR,UAAU,GACV,aAAa,GACb,UAAU,GACV,eAAe,GACf,kBAAkB,GAClB,kBAAkB,GAClB,MAAM,GACN,SAAS,GACT,SAAS,GACT,MAgBH,CAAA;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAsFxD;AAwBD;;;;;;;;;;;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,iBAAiB,CAAC,CAUpH;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YAAK,EAAE,IAAI,EAAE,MAAM,GAAG,GAAG,CAE/E"}
|
package/dist/node.helper.js
CHANGED
|
@@ -15,19 +15,17 @@
|
|
|
15
15
|
* getComponentType(React.memo(() => <div/>)) // 'memo'
|
|
16
16
|
* getComponentType(() => <div/>) // 'function'
|
|
17
17
|
*/export var getComponentType=function getComponentType(a){return isForwardRef(a)?"forwardRef":isMemo(a)?"memo":isFragment(a)?"fragment":isPortal(a)?"portal":isProfiler(a)?"profiler":isStrictMode(a)?"strict-mode":isSuspense(a)?"suspense":isSuspenseList(a)?"suspense-list":isContextConsumer(a)?"context-consumer":isContextProvider(a)?"context-provider":isLazy(a)?"lazy":isElement(a)?"element":isReactClassComponent(a)?"class":_typeof(a)};/**
|
|
18
|
-
* Generates a string name for an ElementType.
|
|
18
|
+
* Generates a string name for an ElementType or ReactElement.
|
|
19
19
|
*
|
|
20
|
-
* This function attempts to extract a meaningful name from a React ElementType
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* `React.
|
|
24
|
-
* for functions and unwraps higher-order components to get the underlying name.
|
|
20
|
+
* This function attempts to extract a meaningful name from a React ElementType
|
|
21
|
+
* (string, function, class, HOC) or a ReactElement instance.
|
|
22
|
+
* It prioritizes `displayName` and `name` properties and unwraps HOCs like
|
|
23
|
+
* `React.memo` and `React.forwardRef` to get the underlying component name.
|
|
25
24
|
*
|
|
26
|
-
* If a name cannot be determined, it returns 'UnknownElementType'.
|
|
27
|
-
* @
|
|
28
|
-
* @
|
|
29
|
-
|
|
30
|
-
*/export function getElementTypeName(a){var b;switch(!0){case"string"==typeof a:return a;case"function"==typeof a&&"displayName"in a:return a.displayName||a.name||"AnonymousComponent";case"object"===_typeof(a)&&null!==a:{if(a.displayName)return a.displayName;var c=a.type||a.render;switch(!0){case"function"==typeof c:return c.displayName||c.name||"WrappedComponent";case"string"==typeof c:return c;case"function"==typeof a.render&&(null===(b=a.prototype)||void 0===b?void 0:b.isReactComponent):return a.name||"ClassComponent";default:return"ObjectComponent"}}default:return"UnknownElementType"}}/**
|
|
25
|
+
* If a name cannot be determined, it returns a fallback like 'UnknownElementType' or 'AnonymousComponent'.
|
|
26
|
+
* @param node The ElementType or ReactElement (e.g., 'div', MyComponent, <MyComponent />).
|
|
27
|
+
* @returns A string representation of the element type's name.
|
|
28
|
+
*/export function getElementTypeName(a){var b,c;function getDisplayName(a,b){var c=(null===a||void 0===a?void 0:a.displayName)||(null===a||void 0===a?void 0:a.name);return!c||"render"===c?b:c}if(null===a||a===void 0)return"UnknownElementType";var d=a,e=getComponentType(d);switch(e){case"string":return a;case"class":return getDisplayName(d,"ClassComponent");case"function":return getDisplayName(d,"AnonymousFunctionComponent");case"forwardRef":return getDisplayName(d,"")||getDisplayName(d.render,"")||"ForwardRefComponent";case"memo":return getDisplayName(d,"")||(d.type?getElementTypeName(d.type):"MemoComponent");case"element":return getElementTypeName(d.type);case"fragment":return"Fragment";case"portal":return"Portal";case"profiler":return getDisplayName(d,"Profiler");case"strict-mode":return"StrictMode";case"suspense":return getDisplayName(d,"Suspense");case"suspense-list":return"SuspenseList";case"context-consumer":return null!==(b=d._context)&&void 0!==b&&b.displayName?"".concat(d._context.displayName,".Consumer"):"ContextConsumer";case"context-provider":return null!==(c=d._context)&&void 0!==c&&c.displayName?"".concat(d._context.displayName,".Provider"):"ContextProvider";case"lazy":return getDisplayName(d,"LazyComponent");case"object":return getDisplayName(d,"")?getDisplayName(d,""):"function"==typeof d.render?getDisplayName(d.render,"ObjectWithRender"):d.type&&d.type!==a?"Wrapped<".concat(getElementTypeName(d.type),">"):getDisplayName(d,"ObjectComponent");case"symbol":if("symbol"===_typeof(a)){var f;return(null===(f=a.description)||void 0===f?void 0:f.replace(/^react\./,"").split(".").map(function(a){var b;return(null===(b=a[0])||void 0===b?void 0:b.toUpperCase())+a.slice(1)}).join(""))||a.toString()}return"SymbolComponent";case"unknown":return"UnknownElementType";default:return"UnsupportedType<".concat(e,">")}}/**
|
|
31
29
|
* Converts kebab-case CSS property names to camelCase, preserving CSS custom properties.
|
|
32
30
|
* Converts kebab-case CSS property names to their camelCase equivalents
|
|
33
31
|
* Preserves CSS custom properties that start with --
|
package/dist/node.type.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Attributes as ReactAttributes, ComponentProps, CSSProperties, ReactNode, JSX, ElementType, ComponentType, JSXElementConstructor } from 'react';
|
|
2
|
-
export type NodeElement = ReactNode | ElementType | ComponentType | BaseNodeInstance<any> | ((props?: any) => ReactNode | Promise<ReactNode> | BaseNodeInstance<any>);
|
|
1
|
+
import type { Attributes as ReactAttributes, ComponentProps, CSSProperties, ReactNode, JSX, ElementType, ComponentType, JSXElementConstructor, ReactInstance } from 'react';
|
|
2
|
+
export type NodeElement = ReactNode | ReactInstance | ElementType | ComponentType | BaseNodeInstance<any> | ((props?: any) => ReactNode | Promise<ReactNode> | ReactInstance | BaseNodeInstance<any>);
|
|
3
3
|
/**
|
|
4
4
|
* Defines valid child types that can be passed to a node:
|
|
5
5
|
* - ReactNode: Any valid React child (elements, strings, numbers, etc.)
|
|
@@ -7,7 +7,7 @@ export type NodeElement = ReactNode | ElementType | ComponentType | BaseNodeInst
|
|
|
7
7
|
* - BaseNodeInstance: Other node instances in the tree
|
|
8
8
|
* - Function: Lazy child evaluation, useful for conditional rendering and hooks
|
|
9
9
|
*/
|
|
10
|
-
export type Children = ReactNode | NodeElement | BaseNodeInstance<any>;
|
|
10
|
+
export type Children = ReactNode | ReactInstance | NodeElement | BaseNodeInstance<any>;
|
|
11
11
|
/**
|
|
12
12
|
* Forward declaration of the BaseNode interface to avoid circular dependencies.
|
|
13
13
|
* Defines the core structure and capabilities of a BaseNode instance.
|
|
@@ -17,7 +17,7 @@ export interface BaseNodeInstance<T extends NodeElement = NodeElement> {
|
|
|
17
17
|
/** The underlying React element or component type that this node will render */
|
|
18
18
|
readonly element: T;
|
|
19
19
|
/** Original props passed during node construction, preserved for cloning/recreation */
|
|
20
|
-
readonly
|
|
20
|
+
readonly rawProps?: BaseNodeProps<T>;
|
|
21
21
|
/** Converts this node instance into a renderable React element/tree */
|
|
22
22
|
render(): ReactNode;
|
|
23
23
|
}
|
|
@@ -39,12 +39,6 @@ export type PropsOf<E extends NodeElement> = E extends keyof JSX.IntrinsicElemen
|
|
|
39
39
|
export interface Theme {
|
|
40
40
|
[key: string]: string | number | boolean | null | undefined | any | Theme | Record<string, Theme | string | number | boolean | null | undefined | any>;
|
|
41
41
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Internal representation of processed children after BaseNode handles them.
|
|
44
|
-
* All dynamic/function children are converted to concrete nodes or React elements.
|
|
45
|
-
* Ensures consistent handling of children during the render phase.
|
|
46
|
-
*/
|
|
47
|
-
export type ProcessedChild = BaseNodeInstance | ReactNode;
|
|
48
42
|
/**
|
|
49
43
|
* Internal props type used by BaseNode instances after initial processing.
|
|
50
44
|
* Ensures consistent prop shape throughout the node's lifecycle:
|
|
@@ -98,11 +92,12 @@ export type BaseNodeProps<E extends NodeElement> = Partial<NodeProps<E>> & {
|
|
|
98
92
|
*/
|
|
99
93
|
export interface FunctionRendererProps<E extends NodeElement> {
|
|
100
94
|
/** Function that returns the child content to render */
|
|
101
|
-
render: (props?:
|
|
95
|
+
render: (props?: NodeProps<E>) => ReactNode | BaseNodeInstance<E>;
|
|
102
96
|
/** Theme context to be applied to the rendered content */
|
|
103
97
|
passedTheme?: Theme;
|
|
104
98
|
/** Optional key prop to help React identify unique instances in lists */
|
|
105
99
|
passedKey?: string;
|
|
100
|
+
processRawNode: (node: NodeElement, parentTheme?: Theme, childIndex?: number) => BaseNodeInstance<E>;
|
|
106
101
|
}
|
|
107
102
|
export {};
|
|
108
103
|
//# 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,
|
|
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,aAAa,EACd,MAAM,OAAO,CAAA;AAEd,MAAM,MAAM,WAAW,GACnB,SAAS,GACT,aAAa,GACb,WAAW,GACX,aAAa,GACb,gBAAgB,CAAC,GAAG,CAAC,GACrB,CAAC,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,aAAa,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAA;AAE7F;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAA;AAEtF;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW;IACnE,gFAAgF;IAChF,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AC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC,GACnF,eAAe,GACf,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GAC/C,OAAO,CAAC,aAAa,CAAC,GACtB,MAAM,CAAC,GAAG;IACZ,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,EAAE,CAAA;IAChC,KAAK,CAAC,EAAE,KAAK,CAAA;CAEd,CAAA;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,WAAW,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG;IAAE,SAAS,CAAC,EAAE,KAAK,CAAA;CAAE,CAAA;AAEhG;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS,WAAW;IAC1D,wDAAwD;IACxD,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,SAAS,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAA;IAEjE,0DAA0D;IAC1D,WAAW,CAAC,EAAE,KAAK,CAAA;IAEnB,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,cAAc,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,WAAW,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,gBAAgB,CAAC,CAAC,CAAC,CAAA;CACrG"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Provides utilities for identifying and checking React component/element types.
|
|
4
4
|
* Inspired by react-is package but implemented in TypeScript with type safety.
|
|
5
5
|
*/
|
|
6
|
+
import React from 'react';
|
|
6
7
|
/**
|
|
7
8
|
* Symbol identifiers for React internal component types
|
|
8
9
|
* These are used to identify different kinds of React elements and components
|
|
@@ -131,9 +132,5 @@ export declare const isValidElementType: <T>(type: T) => boolean;
|
|
|
131
132
|
* @param {unknown} component Component to check
|
|
132
133
|
* @returns {boolean} - True if component is a React class component
|
|
133
134
|
*/
|
|
134
|
-
export declare const isReactClassComponent: (component: unknown) => component is
|
|
135
|
-
prototype: {
|
|
136
|
-
isReactComponent: any;
|
|
137
|
-
};
|
|
138
|
-
};
|
|
135
|
+
export declare const isReactClassComponent: (component: unknown) => component is React.ComponentType;
|
|
139
136
|
//# sourceMappingURL=react-is.helper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-is.helper.d.ts","sourceRoot":"","sources":["../src/react-is.helper.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,eAA2C,CAAA;AAC1E,eAAO,MAAM,iBAAiB,eAA6B,CAAA;AAC3D,eAAO,MAAM,mBAAmB,eAA+B,CAAA;AAC/D,eAAO,MAAM,sBAAsB,eAAkC,CAAA;AACrE,eAAO,MAAM,mBAAmB,eAA+B,CAAA;AAC/D,eAAO,MAAM,mBAAmB,eAA+B,CAAA;AAC/D,eAAO,MAAM,mBAAmB,eAA+B,CAAA;AAC/D,eAAO,MAAM,kBAAkB,eAA8B,CAAA;AAC7D,eAAO,MAAM,sBAAsB,eAAkC,CAAA;AACrE,eAAO,MAAM,mBAAmB,eAA+B,CAAA;AAC/D,eAAO,MAAM,wBAAwB,eAAoC,CAAA;AACzE,eAAO,MAAM,eAAe,eAA2B,CAAA;AACvD,eAAO,MAAM,eAAe,eAA2B,CAAA;AACvD,eAAO,MAAM,0BAA0B,eAAsC,CAAA;AAC7E,eAAO,MAAM,sBAAsB,eAAuC,CAAA;AAE1E;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACxB,OAAO,kBAAkB,GACzB,OAAO,iBAAiB,GACxB,OAAO,mBAAmB,GAC1B,OAAO,sBAAsB,GAC7B,OAAO,mBAAmB,GAC1B,OAAO,mBAAmB,GAC1B,OAAO,mBAAmB,GAC1B,OAAO,kBAAkB,GACzB,OAAO,sBAAsB,GAC7B,OA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I,QAAQ,OAAO,KAAG,OAAiD,CAAA;AAE9F;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,OAAO,KAAG,OAAsD,CAAA;AASvG;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAAE,MAAM,CAAC,KAAG,OAgB/C,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,GAAI,WAAW,OAAO,KAAG,SAAS,IAAI,KAAK,CAAC,aAS7E,CAAA"}
|
package/dist/react-is.helper.js
CHANGED
|
@@ -2,7 +2,7 @@ function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof
|
|
|
2
2
|
* Custom React Type Checker (TypeScript Version)
|
|
3
3
|
* Provides utilities for identifying and checking React component/element types.
|
|
4
4
|
* Inspired by react-is package but implemented in TypeScript with type safety.
|
|
5
|
-
|
|
5
|
+
*/import React from"react";/**
|
|
6
6
|
* Symbol identifiers for React internal component types
|
|
7
7
|
* These are used to identify different kinds of React elements and components
|
|
8
8
|
*/export var REACT_ELEMENT_TYPE=Symbol["for"]("react.transitional.element");export var REACT_PORTAL_TYPE=Symbol["for"]("react.portal");export var REACT_FRAGMENT_TYPE=Symbol["for"]("react.fragment");export var REACT_STRICT_MODE_TYPE=Symbol["for"]("react.strict_mode");export var REACT_PROFILER_TYPE=Symbol["for"]("react.profiler");export var REACT_PROVIDER_TYPE=Symbol["for"]("react.provider");export var REACT_CONSUMER_TYPE=Symbol["for"]("react.consumer");export var REACT_CONTEXT_TYPE=Symbol["for"]("react.context");export var REACT_FORWARD_REF_TYPE=Symbol["for"]("react.forward_ref");export var REACT_SUSPENSE_TYPE=Symbol["for"]("react.suspense");export var REACT_SUSPENSE_LIST_TYPE=Symbol["for"]("react.suspense_list");export var REACT_MEMO_TYPE=Symbol["for"]("react.memo");export var REACT_LAZY_TYPE=Symbol["for"]("react.lazy");export var REACT_VIEW_TRANSITION_TYPE=Symbol["for"]("react.view_transition");export var REACT_CLIENT_REFERENCE=Symbol["for"]("react.client.reference");/**
|
|
@@ -81,4 +81,4 @@ function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof
|
|
|
81
81
|
* that React adds to all class components.
|
|
82
82
|
* @param {unknown} component Component to check
|
|
83
83
|
* @returns {boolean} - True if component is a React class component
|
|
84
|
-
*/export var isReactClassComponent=function isReactClassComponent(a){
|
|
84
|
+
*/export var isReactClassComponent=function isReactClassComponent(a){if("function"!=typeof a)return!1;try{var b=Object.getPrototypeOf(a);return b===React.Component||b===React.PureComponent||b instanceof React.Component}catch(a){return!1}};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meonode/ui",
|
|
3
3
|
"description": "`@meonode/ui` is a lightweight yet powerful utility for the programmatic creation and manipulation of React elements. It offers an enhanced, structured way to define components, manage props (separating CSS from DOM attributes), handle theming, and compose children *before* they are rendered by React. This provides greater control and flexibility, especially for dynamic UIs and design systems.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/main.js",
|
|
7
7
|
"types": "./dist/main.d.ts",
|
|
@@ -19,9 +19,13 @@
|
|
|
19
19
|
"README.md"
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
|
+
"watch:build": "yarn dlx nodemon --watch src --ext ts,js,json --exec \"yarn build\"",
|
|
22
23
|
"lint": "eslint --fix",
|
|
23
24
|
"build": "rm -rf ./dist && babel src --out-dir dist --extensions \".ts,.js\" && tsc && tsc-alias && copyfiles -u 1 \"src/**/*.json\" dist",
|
|
24
|
-
"publish": "
|
|
25
|
+
"publish:pre": "./prepublish.sh && yarn version -i prerelease && yarn npm publish --tag next",
|
|
26
|
+
"publish:patch": "./prepublish.sh && yarn version -i patch && yarn npm publish --tag latest",
|
|
27
|
+
"publish:minor": "./prepublish.sh && yarn version -i minor && yarn npm publish --tag latest",
|
|
28
|
+
"publish:major": "./prepublish.sh && yarn version -i major && yarn npm publish --tag latest"
|
|
25
29
|
},
|
|
26
30
|
"devDependencies": {
|
|
27
31
|
"@babel/cli": "^7.0.0",
|
|
@@ -60,6 +64,5 @@
|
|
|
60
64
|
"publishConfig": {
|
|
61
65
|
"access": "public"
|
|
62
66
|
},
|
|
63
|
-
"license": "MIT"
|
|
64
|
-
"stableVersion": "0.0.1-alpha.7"
|
|
67
|
+
"license": "MIT"
|
|
65
68
|
}
|