@meonode/ui 0.1.96 → 0.1.98

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.
@@ -0,0 +1,85 @@
1
+ import type { FinalNodeProps, NodeElement } from './node.type';
2
+ import type { ComponentProps, CSSProperties, ElementType } from 'react';
3
+ /**
4
+ * Retrieves a deeply nested value from an object using a dot-separated string path.
5
+ *
6
+ * This function traverses an object based on the provided path, which is a
7
+ * string of keys separated by dots. It returns the value found at the end of
8
+ * the path or `undefined` if any key in the path is not found or if the object
9
+ * is nullish at any point during traversal.
10
+ * @param obj The object to traverse, defaults to an empty object if not provided.
11
+ * @param path The dot-separated path string (e.g., 'background.primary').
12
+ * @returns The value at the specified path, or undefined if not found.
13
+ */
14
+ export declare function getValueByPath(obj: Record<string, any> | undefined, path: string): Record<string, any>;
15
+ /**
16
+ * Returns a string describing the type of a given React component or element.
17
+ *
18
+ * Checks for common React types (class, forwardRef, memo, etc.) and returns a string
19
+ * such as 'class', 'forwardRef', 'memo', 'object-with-render', 'function', or other
20
+ * React-specific types. Falls back to `typeof` or 'unknown' if not recognized.
21
+ * @param component The React component, element type, or element-like object to check.
22
+ * @returns A string describing the component type.
23
+ * @example
24
+ * getComponentType(class extends React.Component {}) // 'class'
25
+ * getComponentType(React.forwardRef(() => <div/>)) // 'forwardRef'
26
+ * getComponentType(React.memo(() => <div/>)) // 'memo'
27
+ * getComponentType(() => <div/>) // 'function'
28
+ */
29
+ 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;
30
+ /**
31
+ * Generates a string name for an ElementType or ReactElement.
32
+ *
33
+ * This function attempts to extract a meaningful name from a React ElementType
34
+ * (string, function, class, HOC) or a ReactElement instance.
35
+ * It prioritizes `displayName` and `name` properties and unwraps HOCs like
36
+ * `React.memo` and `React.forwardRef` to get the underlying component name.
37
+ *
38
+ * If a name cannot be determined, it returns a fallback like 'UnknownElementType' or 'AnonymousComponent'.
39
+ * @param node The ElementType or ReactElement (e.g., 'div', MyComponent, <MyComponent />).
40
+ * @returns A string representation of the element type's name.
41
+ */
42
+ export declare function getElementTypeName(node: unknown): string;
43
+ /**
44
+ * A set of valid CSS property names in camelCase, including CSS custom properties, used for validation.
45
+ * This set contains all CSS properties including non-standard vendor prefixed properties.
46
+ */
47
+ export declare const CSSPropertySet: Set<string>;
48
+ /**
49
+ * Filters an object to only include valid CSS properties
50
+ * @param props The object containing potential CSS properties
51
+ * @returns An object containing only valid CSS properties
52
+ * @example
53
+ * ```ts
54
+ * getCSSProps({
55
+ * backgroundColor: 'red',
56
+ * invalid: true
57
+ * }) // { backgroundColor: 'red' }
58
+ * ```
59
+ */
60
+ export declare function getCSSProps<T extends Record<string, any>>(props: T): Partial<CSSProperties>;
61
+ /**
62
+ * Filters component props to include only valid DOM properties and attributes.
63
+ *
64
+ * This function iterates through the provided props and retains only those that
65
+ * are not CSS properties (as determined by `cssPropertySet`). This is useful for
66
+ * separating style-related props from standard DOM attributes when rendering
67
+ * elements.
68
+ * @ty E - The type of the React element.
69
+ * @typeParam T - The type of the component props.
70
+ * @param props The component props to filter.
71
+ * @returns An object containing only valid DOM props.
72
+ */
73
+ export declare function getDOMProps<E extends ElementType, T extends ComponentProps<E>>(props: T): Partial<FinalNodeProps>;
74
+ /**
75
+ * Checks if a property on an object is writable.
76
+ *
77
+ * This function uses `Object.getOwnPropertyDescriptor` to determine if the specified
78
+ * property is writable. If the property descriptor is not found (property does not exist
79
+ * or is inherited), it returns `true` by default.
80
+ * @param obj The object to check.
81
+ * @param key The property name to check for writability.
82
+ * @returns `true` if the property is writable or not explicitly defined, otherwise `false`.
83
+ */
84
+ export declare function isWritable(obj: Record<string, any>, key: string): boolean;
85
+ //# sourceMappingURL=common.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.helper.d.ts","s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71 @@
1
+ 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)}import{isContextConsumer,isContextProvider,isElement,isForwardRef,isFragment,isLazy,isMemo,isPortal,isProfiler,isReactClassComponent,isStrictMode,isSuspense,isSuspenseList}from"./react-is.helper.js";import cssProperties from"./data/css-properties";/**
2
+ * Retrieves a deeply nested value from an object using a dot-separated string path.
3
+ *
4
+ * This function traverses an object based on the provided path, which is a
5
+ * string of keys separated by dots. It returns the value found at the end of
6
+ * the path or `undefined` if any key in the path is not found or if the object
7
+ * is nullish at any point during traversal.
8
+ * @param obj The object to traverse, defaults to an empty object if not provided.
9
+ * @param path The dot-separated path string (e.g., 'background.primary').
10
+ * @returns The value at the specified path, or undefined if not found.
11
+ */export function getValueByPath(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},b=1<arguments.length?arguments[1]:void 0;return b.split(".").reduce(function(a,b){return null===a||void 0===a?void 0:a[b]},a)}/**
12
+ * Returns a string describing the type of a given React component or element.
13
+ *
14
+ * Checks for common React types (class, forwardRef, memo, etc.) and returns a string
15
+ * such as 'class', 'forwardRef', 'memo', 'object-with-render', 'function', or other
16
+ * React-specific types. Falls back to `typeof` or 'unknown' if not recognized.
17
+ * @param component The React component, element type, or element-like object to check.
18
+ * @returns A string describing the component type.
19
+ * @example
20
+ * getComponentType(class extends React.Component {}) // 'class'
21
+ * getComponentType(React.forwardRef(() => <div/>)) // 'forwardRef'
22
+ * getComponentType(React.memo(() => <div/>)) // 'memo'
23
+ * getComponentType(() => <div/>) // 'function'
24
+ */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)};/**
25
+ * Generates a string name for an ElementType or ReactElement.
26
+ *
27
+ * This function attempts to extract a meaningful name from a React ElementType
28
+ * (string, function, class, HOC) or a ReactElement instance.
29
+ * It prioritizes `displayName` and `name` properties and unwraps HOCs like
30
+ * `React.memo` and `React.forwardRef` to get the underlying component name.
31
+ *
32
+ * If a name cannot be determined, it returns a fallback like 'UnknownElementType' or 'AnonymousComponent'.
33
+ * @param node The ElementType or ReactElement (e.g., 'div', MyComponent, <MyComponent />).
34
+ * @returns A string representation of the element type's name.
35
+ */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,">")}}/**
36
+ * A set of valid CSS property names in camelCase, including CSS custom properties, used for validation.
37
+ * This set contains all CSS properties including non-standard vendor prefixed properties.
38
+ */export var CSSPropertySet=new Set(cssProperties);/**
39
+ * Filters an object to only include valid CSS properties
40
+ * @param props The object containing potential CSS properties
41
+ * @returns An object containing only valid CSS properties
42
+ * @example
43
+ * ```ts
44
+ * getCSSProps({
45
+ * backgroundColor: 'red',
46
+ * invalid: true
47
+ * }) // { backgroundColor: 'red' }
48
+ * ```
49
+ */export function getCSSProps(a){var b={};for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&CSSPropertySet.has(c)&&(b[c]=a[c]);return b}/**
50
+ * Filters component props to include only valid DOM properties and attributes.
51
+ *
52
+ * This function iterates through the provided props and retains only those that
53
+ * are not CSS properties (as determined by `cssPropertySet`). This is useful for
54
+ * separating style-related props from standard DOM attributes when rendering
55
+ * elements.
56
+ * @ty E - The type of the React element.
57
+ * @typeParam T - The type of the component props.
58
+ * @param props The component props to filter.
59
+ * @returns An object containing only valid DOM props.
60
+ */export function getDOMProps(a){var b={};for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&!CSSPropertySet.has(c)&&(b[c]=a[c]);return b}/**
61
+ * Checks if a property on an object is writable.
62
+ *
63
+ * This function uses `Object.getOwnPropertyDescriptor` to determine if the specified
64
+ * property is writable. If the property descriptor is not found (property does not exist
65
+ * or is inherited), it returns `true` by default.
66
+ * @param obj The object to check.
67
+ * @param key The property name to check for writability.
68
+ * @returns `true` if the property is writable or not explicitly defined, otherwise `false`.
69
+ */export function isWritable(a,b){var c=Object.getOwnPropertyDescriptor(a,b);// If the property doesn't exist or is inherited, desc will be undefined.
70
+ // In such cases, it's typically considered writable unless explicitly defined otherwise.
71
+ return!c||!!c.writable}
@@ -1 +1 @@
1
- {"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../src/core.node.ts"],"names":[],"mappings":"AACA,OAAc,EAAkF,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAC7H,OAAO,KAAK,EAAE,cAAc,EAAyB,WAAW,EAAE,YAAY,EAAE,SAAS,EAAW,YAAY,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAGlJ,OAAO,EAAc,KAAK,IAAI,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAExE;;;;;;;;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,SAAgB,UAAU,QAAO;IAEjC,OAAO,CAAC,iBAAiB,CAA8B;IACvD,OAAO,CAAC,gBAAgB,CAA4B;IAEpD;;;;;;;;OAQG;gBACS,OAAO,EAAE,CAAC,EAAE,QAAQ,GAAE,YAAY,CAAC,CAAC,CAAM;IAsCtD,OAAO,CAAC,gBAAgB;IAYxB;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,oBAAoB,CAAC,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAwCpI;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,iBAAiB;IAgCzB;;;;;;;;OAQG;IACI,eAAe,CACpB,OAAO,EAAE,WAAW,EACpB,WAAW,CAAC,EAAE,KAAK,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,WAAW;IAyFd;;;;;;;;;;;;;OAaG;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G,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAwCpI;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,iBAAiB;IAgCzB;;;;;;;;OAQG;IACI,eAAe,CACpB,OAAO,EAAE,WAAW,EACpB,WAAW,CAAC,EAAE,KAAK,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,WAAW;IAyFd;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,eAAe,CAwBtB;IAED;;;;OAIG;IACI,MAAM,IAAI,SAAS;IAsC1B,OAAO,CAAC,2BAA2B;IAsB5B,QAAQ,IAAI,YAAY,GAAG,IAAI;CAsBvC;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,WAAW,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,GAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAU1G"}
package/dist/core.node.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var _excluded=["ref","children","nodetheme","theme","props"],_excluded2=["style"],_excluded3=["style"],_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,{createElement,isValidElement}from"react";import{getComponentType,getCSSProps,getDOMProps,getElementTypeName,isNodeInstance,resolveDefaultStyle,resolveObjWithTheme}from"./node.helper.js";import{isForwardRef,isMemo,isReactClassComponent,isValidElementType}from"./react-is.helper.js";import{createRoot}from"react-dom/client";/**
1
+ "use strict";var _excluded=["ref","children","nodetheme","theme","props"],_excluded2=["style"],_excluded3=["style"],_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,{createElement,isValidElement}from"react";import{isNodeInstance,resolveDefaultStyle,resolveObjWithTheme}from"./node.helper.js";import{isForwardRef,isMemo,isReactClassComponent,isValidElementType}from"./react-is.helper.js";import{createRoot}from"react-dom/client";import{getComponentType,getCSSProps,getDOMProps,getElementTypeName}from"./common.helper";/**
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
@@ -1,76 +1,5 @@
1
- import type { ComponentProps, CSSProperties, ElementType } from 'react';
2
- import type { NodeElement, FinalNodeProps, NodeInstance, Theme } from './node.type.js';
3
- /**
4
- * Returns a string describing the type of a given React component or element.
5
- *
6
- * Checks for common React types (class, forwardRef, memo, etc.) and returns a string
7
- * such as 'class', 'forwardRef', 'memo', 'object-with-render', 'function', or other
8
- * React-specific types. Falls back to `typeof` or 'unknown' if not recognized.
9
- * @param component The React component, element type, or element-like object to check.
10
- * @returns A string describing the component type.
11
- * @example
12
- * getComponentType(class extends React.Component {}) // 'class'
13
- * getComponentType(React.forwardRef(() => <div/>)) // 'forwardRef'
14
- * getComponentType(React.memo(() => <div/>)) // 'memo'
15
- * getComponentType(() => <div/>) // 'function'
16
- */
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
- /**
19
- * Generates a string name for an ElementType or ReactElement.
20
- *
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.
25
- *
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.
29
- */
30
- export declare function getElementTypeName(node: unknown): string;
31
- /**
32
- * A set of valid CSS property names in camelCase, including CSS custom properties, used for validation.
33
- * This set contains all CSS properties including non-standard vendor prefixed properties.
34
- */
35
- export declare const CSSPropertySet: Set<string>;
36
- /**
37
- * Filters an object to only include valid CSS properties
38
- * @param props The object containing potential CSS properties
39
- * @returns An object containing only valid CSS properties
40
- * @example
41
- * ```ts
42
- * getCSSProps({
43
- * backgroundColor: 'red',
44
- * invalid: true
45
- * }) // { backgroundColor: 'red' }
46
- * ```
47
- */
48
- export declare function getCSSProps<T extends Record<string, any>>(props: T): Partial<CSSProperties>;
49
- /**
50
- * Filters component props to include only valid DOM properties and attributes.
51
- *
52
- * This function iterates through the provided props and retains only those that
53
- * are not CSS properties (as determined by `cssPropertySet`). This is useful for
54
- * separating style-related props from standard DOM attributes when rendering
55
- * elements.
56
- * @ty E - The type of the React element.
57
- * @typeParam T - The type of the component props.
58
- * @param props The component props to filter.
59
- * @returns An object containing only valid DOM props.
60
- */
61
- export declare function getDOMProps<E extends ElementType, T extends ComponentProps<E>>(props: T): Partial<FinalNodeProps>;
62
- /**
63
- * Retrieves a deeply nested value from an object using a dot-separated string path.
64
- *
65
- * This function traverses an object based on the provided path, which is a
66
- * string of keys separated by dots. It returns the value found at the end of
67
- * the path or `undefined` if any key in the path is not found or if the object
68
- * is nullish at any point during traversal.
69
- * @param obj The object to traverse. Defaults to an empty object if not provided.
70
- * @param path The dot-separated path string (e.g., 'background.primary').
71
- * @returns The value at the specified path, or undefined if not found.
72
- */
73
- export declare function getValueByPath(obj: Record<string, any> | undefined, path: string): Record<string, any>;
1
+ import type { CSSProperties } from 'react';
2
+ import type { NodeInstance, Theme } from './node.type.js';
74
3
  /**
75
4
  * Type guard to check if an object is a NodeInstance.
76
5
  *
@@ -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,cAAc,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAkBzF;;;;;;;;;;;;;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;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BvD,CAAA"}
@@ -1,63 +1,4 @@
1
- "use strict";var _excluded=["flex"];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}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)}import{isContextConsumer,isContextProvider,isElement,isForwardRef,isFragment,isLazy,isMemo,isPortal,isProfiler,isReactClassComponent,isStrictMode,isSuspense,isSuspenseList}from"./react-is.helper.js";import cssProperties from"./data/css-properties";/**
2
- * Returns a string describing the type of a given React component or element.
3
- *
4
- * Checks for common React types (class, forwardRef, memo, etc.) and returns a string
5
- * such as 'class', 'forwardRef', 'memo', 'object-with-render', 'function', or other
6
- * React-specific types. Falls back to `typeof` or 'unknown' if not recognized.
7
- * @param component The React component, element type, or element-like object to check.
8
- * @returns A string describing the component type.
9
- * @example
10
- * getComponentType(class extends React.Component {}) // 'class'
11
- * getComponentType(React.forwardRef(() => <div/>)) // 'forwardRef'
12
- * getComponentType(React.memo(() => <div/>)) // 'memo'
13
- * getComponentType(() => <div/>) // 'function'
14
- */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)};/**
15
- * Generates a string name for an ElementType or ReactElement.
16
- *
17
- * This function attempts to extract a meaningful name from a React ElementType
18
- * (string, function, class, HOC) or a ReactElement instance.
19
- * It prioritizes `displayName` and `name` properties and unwraps HOCs like
20
- * `React.memo` and `React.forwardRef` to get the underlying component name.
21
- *
22
- * If a name cannot be determined, it returns a fallback like 'UnknownElementType' or 'AnonymousComponent'.
23
- * @param node The ElementType or ReactElement (e.g., 'div', MyComponent, <MyComponent />).
24
- * @returns A string representation of the element type's name.
25
- */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,">")}}/**
26
- * A set of valid CSS property names in camelCase, including CSS custom properties, used for validation.
27
- * This set contains all CSS properties including non-standard vendor prefixed properties.
28
- */export var CSSPropertySet=new Set(cssProperties);/**
29
- * Filters an object to only include valid CSS properties
30
- * @param props The object containing potential CSS properties
31
- * @returns An object containing only valid CSS properties
32
- * @example
33
- * ```ts
34
- * getCSSProps({
35
- * backgroundColor: 'red',
36
- * invalid: true
37
- * }) // { backgroundColor: 'red' }
38
- * ```
39
- */export function getCSSProps(a){var b={};for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&CSSPropertySet.has(c)&&(b[c]=a[c]);return b}/**
40
- * Filters component props to include only valid DOM properties and attributes.
41
- *
42
- * This function iterates through the provided props and retains only those that
43
- * are not CSS properties (as determined by `cssPropertySet`). This is useful for
44
- * separating style-related props from standard DOM attributes when rendering
45
- * elements.
46
- * @ty E - The type of the React element.
47
- * @typeParam T - The type of the component props.
48
- * @param props The component props to filter.
49
- * @returns An object containing only valid DOM props.
50
- */export function getDOMProps(a){var b={};for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&!CSSPropertySet.has(c)&&(b[c]=a[c]);return b}/**
51
- * Retrieves a deeply nested value from an object using a dot-separated string path.
52
- *
53
- * This function traverses an object based on the provided path, which is a
54
- * string of keys separated by dots. It returns the value found at the end of
55
- * the path or `undefined` if any key in the path is not found or if the object
56
- * is nullish at any point during traversal.
57
- * @param obj The object to traverse. Defaults to an empty object if not provided.
58
- * @param path The dot-separated path string (e.g., 'background.primary').
59
- * @returns The value at the specified path, or undefined if not found.
60
- */export function getValueByPath(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},b=1<arguments.length?arguments[1]:void 0;return b.split(".").reduce(function(a,b){return null===a||void 0===a?void 0:a[b]},a)}/**
1
+ "use strict";var _excluded=["flex"];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}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)}import{getValueByPath}from"./common.helper";/**
61
2
  * Type guard to check if an object is a NodeInstance.
62
3
  *
63
4
  * A NodeInstance is expected to be a non-null object with:
@@ -75,20 +16,19 @@
75
16
  * @param theme Optional theme object containing variable definitions
76
17
  * @returns A new object with all theme variables resolved to their values
77
18
  */export var resolveObjWithTheme=function resolveObjWithTheme(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},b=1<arguments.length?arguments[1]:void 0;// Early return if no theme or empty object
78
- if(!b||0===Object.keys(a).length)return a;/**
79
- * Recursively resolves theme variables in an object, tracking visited objects
80
- * to prevent infinite recursion with circular references.
81
- */var c=function resolveRecursively(a,d){// Skip functions and non-plain objects to prevent unintended flattening or
82
- // modification of complex instances like React components, DOM elements, or Date objects.
83
- if(!a||"object"!==_typeof(a)||Array.isArray(a)||Object.getPrototypeOf(a)!==Object.prototype)return a;// Prevent processing same object multiple times
84
- if(d.has(a))return a;// Track this object to detect circular references
85
- d.add(a);var e={};for(var f in a){var g=a[f];// Skip functions and non-plain objects to prevent unintended flattening or
19
+ if(!b||0===Object.keys(a).length)return a;var c=new Set(["ref","key"]),d=function resolveRecursively(a,e){// Skip functions and non-plain objects to prevent unintended flattening or
86
20
  // modification of complex instances like React components, DOM elements, or Date objects.
87
- if("function"==typeof g||g&&"object"===_typeof(g)&&!Array.isArray(g)&&Object.getPrototypeOf(g)!==Object.prototype||"ref"===f){e[f]=g;continue}// Resolve theme variables in string values
21
+ if(!a||"object"!==_typeof(a)||Array.isArray(a)||Object.getPrototypeOf(a)!==Object.prototype)return a;// Prevent processing the same object multiple times
22
+ if(e.has(a))return a;// Track this object to detect circular references
23
+ for(var f in e.add(a),a)try{var g=a[f];// Conditions for direct assignment (no resolution or deep processing needed)
24
+ if(c.has(f)||"function"==typeof g||"object"===_typeof(g)&&null!==g&&!Array.isArray(g)&&Object.getPrototypeOf(g)!==Object.prototype||"string"==typeof g&&!g.includes("theme.")||"object"!==_typeof(g)&&"string"!=typeof g&&"function"!=typeof g||"symbol"===_typeof(g))continue;// Resolve theme variables in string values
88
25
  if("string"==typeof g&&g.includes("theme.")){var h=g;h=h.replace(/theme\.([a-zA-Z0-9_.-]+)/g,function(a,c){var d=getValueByPath(b,c);// Only convert string/number theme values
89
26
  return void 0!==d&&null!==d?"object"===_typeof(d)&&!Array.isArray(d)&&"default"in d?d["default"]:d:a;// Keep original if no valid theme value found
90
- }),e[f]=h}// Recursively process nested objects
91
- else e[f]=c(g,d)}return e};return c(a,new Set)};/**
27
+ }),a[f]=h}// Recursively process nested objects
28
+ else a[f]=d(g,e)}catch(a){/* empty */}return a};/**
29
+ * Recursively resolves theme variables in an object, tracking visited objects
30
+ * to prevent infinite recursion with circular references.
31
+ */return d(a,new Set)};/**
92
32
  * Resolves default styles for a given CSSProperties object.
93
33
  * This method ensures that certain default styles, such as `minHeight`, `minWidth`,
94
34
  * and `flexShrink`, are applied based on the provided style properties.
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.96",
4
+ "version": "0.1.98",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "types": "./dist/main.d.ts",