@meonode/ui 0.1.100 → 0.1.101

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.
@@ -11,7 +11,7 @@ import type { ComponentProps, CSSProperties, ElementType } from 'react';
11
11
  * @param path The dot-separated path string (e.g., 'background.primary').
12
12
  * @returns The value at the specified path, or undefined if not found.
13
13
  */
14
- export declare function getValueByPath(obj: Record<string, any> | undefined, path: string): Record<string, any>;
14
+ export declare const getValueByPath: (obj: any, path: string) => any;
15
15
  /**
16
16
  * Returns a string describing the type of a given React component or element.
17
17
  *
@@ -1 +1 @@
1
- {"version":3,"file":"common.helper.d.ts","sourceRoot":"","sources":["../src/common.helper.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAEvE;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YAAK,EAAE,IAAI,EAAE,MAAM,uBAEzE;AAED;;;;;;;;;;;;;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;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,GAAG,CAAC,MAAM,CAA0B,CAAA;AAEjE;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,CAAC,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AC,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAUjH"}
@@ -8,7 +8,7 @@ function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof
8
8
  * @param obj The object to traverse, defaults to an empty object if not provided.
9
9
  * @param path The dot-separated path string (e.g., 'background.primary').
10
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)}/**
11
+ */export var getValueByPath=function getValueByPath(a,b){return b.split(".").reduce(function(a,b){return a&&a[b]!==void 0?a[b]:void 0},a)};/**
12
12
  * Returns a string describing the type of a given React component or element.
13
13
  *
14
14
  * Checks for common React types (class, forwardRef, memo, etc.) and returns a string
@@ -23,7 +23,6 @@ export declare class BaseNode<E extends NodeElement = NodeElement> implements No
23
23
  private _portalDOMElement;
24
24
  /** React root instance for portal rendering */
25
25
  private _portalReactRoot;
26
- private _resolveAbleProps;
27
26
  /**
28
27
  * Creates a new BaseNode instance that wraps a React element.
29
28
  * Processes raw props by:
@@ -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;AAGxE;;;;;;;;GAQG;AACH,qBAAa,QAAQ,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,CAAE,YAAW,YAAY,CAAC,CAAC,CAAC;IACnF,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;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{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";/**
1
+ "use strict";var _excluded=["ref","key","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
@@ -14,13 +14,13 @@
14
14
  * - Normalizing children with theme inheritance
15
15
  * @param element The React element/component to wrap
16
16
  * @param rawProps Initial props including theme, styles, and children
17
- */constructor(a){var b=this,c=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};_defineProperty(this,"rawProps",{}),_defineProperty(this,"isBaseNode",!0),_defineProperty(this,"_portalDOMElement",null),_defineProperty(this,"_portalReactRoot",null),_defineProperty(this,"_resolveAbleProps",null),_defineProperty(this,"_normalizeChild",function(a){var c,d;if(!a)return a;var e=(null===(c=b.rawProps)||void 0===c?void 0:c.nodetheme)||(null===(d=b.rawProps)||void 0===d?void 0:d.theme)||b.props.nodetheme||b.props.theme;// For BaseNode instances, apply current theme if child has no theme
17
+ */constructor(a){var b=this,c=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};_defineProperty(this,"rawProps",{}),_defineProperty(this,"isBaseNode",!0),_defineProperty(this,"_portalDOMElement",null),_defineProperty(this,"_portalReactRoot",null),_defineProperty(this,"_normalizeChild",function(a){var c,d;if(!a)return a;var e=(null===(c=b.rawProps)||void 0===c?void 0:c.nodetheme)||(null===(d=b.rawProps)||void 0===d?void 0:d.theme)||b.props.nodetheme||b.props.theme;// For BaseNode instances, apply current theme if child has no theme
18
18
  if(a instanceof BaseNode){var f;return null!==(f=a.rawProps)&&void 0!==f&&f.nodetheme||void 0===e?a.render():new BaseNode(a.element,_objectSpread(_objectSpread({},a.rawProps),{},{nodetheme:e})).render()}// Validate element type before returning
19
19
  if(!isValidElementType(a)){var g=getComponentType(a);throw new Error("Invalid element type: ".concat(g," provided!"))}// Return valid React elements as-is
20
20
  return a}),this.element=a,this.rawProps=c;// Destructure raw props into relevant parts
21
- var d=c.ref,e=c.children,f=c.nodetheme,g=c.theme,h=c.props,i=void 0===h?{}:h,j=_objectWithoutProperties(c,_excluded),k=g||f,l=i,m=l.style,n=_objectWithoutProperties(l,_excluded2),o=_objectSpread(_objectSpread({},j),{},{style:_objectSpread(_objectSpread({},null===j||void 0===j?void 0:j.style),m)}),p=resolveObjWithTheme(o,k),q=p.style,r=_objectWithoutProperties(p,_excluded3),s=getCSSProps(r),t=getDOMProps(r),u=resolveDefaultStyle(_objectSpread(_objectSpread({},s),q)),v=this._processChildren(e,k);// Process children while maintaining theme inheritance
21
+ var d=c.ref,e=c.key,f=c.children,g=c.nodetheme,h=c.theme,i=c.props,j=void 0===i?{}:i,k=_objectWithoutProperties(c,_excluded),l=h||g,m=j,n=m.style,o=_objectWithoutProperties(m,_excluded2),p=_objectSpread(_objectSpread({},k),{},{style:_objectSpread(_objectSpread({},null===k||void 0===k?void 0:k.style),n)}),q=resolveObjWithTheme(p,l),r=q.style,s=_objectWithoutProperties(q,_excluded3),t=getCSSProps(s),u=getDOMProps(s),v=resolveDefaultStyle(_objectSpread(_objectSpread({},t),r)),w=this._processChildren(f,l);// Process children while maintaining theme inheritance
22
22
  // Combine processed props into final normalized form
23
- this.props=_objectSpread(_objectSpread(_objectSpread({ref:d,nodetheme:k,theme:g,style:u},t),n),{},{children:v})}_processChildren(a,b){var c=this;return a?Array.isArray(a)?a.map(function(a,d){return c._processRawNode(a,b,d)}):this._processRawNode(a,b):void 0}/**
23
+ this.props=_objectSpread(_objectSpread(_objectSpread({ref:d,key:e,nodetheme:l,theme:h,style:v},u),o),{},{children:w})}_processChildren(a,b){var c=this;return a?Array.isArray(a)?a.map(function(a,d){return c._processRawNode(a,b,d)}):this._processRawNode(a,b):void 0}/**
24
24
  * Renders a processed NodeElement into a ReactNode, applying theme and key if needed.
25
25
  *
26
26
  * Handles the following cases:
@@ -13,19 +13,18 @@ import type { NodeInstance, Theme } from './node.type.js';
13
13
  */
14
14
  export declare const isNodeInstance: (obj: unknown) => obj is NodeInstance<any>;
15
15
  /**
16
- *
17
- *Resolves theme variable references in an object's values recursively.
18
- *This function performs a "smart merge" to maintain object reference identity
19
- *for parts of the object that do not contain resolved theme variables or
20
- *other modifications. Only creates new objects or properties when a change occurs.
21
- *Handles nested objects and prevents circular references.
22
- *Theme variables are referenced using the format "theme.path.to.value".
23
- * @param obj The object whose values should be resolved against the theme. Defaults to an empty object.
16
+ * Resolves theme variable references in an object's values recursively.
17
+ * This function performs a "smart merge" to maintain object reference identity
18
+ * for parts of the object that do not contain resolved theme variables or
19
+ * other modifications. Only creates new objects or properties when a change occurs.
20
+ * Handles nested objects and arrays, and prevents circular references.
21
+ * Theme variables are referenced using the format "theme.path.to.value".
22
+ * @param obj The object (or array) whose values should be resolved against the theme. Defaults to an empty object.
24
23
  * @param theme The theme object containing variable definitions. Optional.
25
- * @returns A new object with all theme variables resolved to their corresponding values,
26
- * or the original object if no changes were necessary.
24
+ * @returns A new object (or array) with all theme variables resolved to their corresponding values,
25
+ * or the original object (or array) if no changes were necessary.
27
26
  */
28
- export declare const resolveObjWithTheme: (obj?: Record<string, any>, theme?: Theme) => Record<string, any>;
27
+ export declare const resolveObjWithTheme: (obj?: Record<string, any>, theme?: Theme) => any;
29
28
  /**
30
29
  * Resolves default styles for a given CSSProperties object.
31
30
  * This method ensures that certain default styles, such as `minHeight`, `minWidth`,
@@ -1 +1 @@
1
- {"version":3,"file":"node.helper.d.ts","sourceRoot":"","sources":["../src/node.helper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAG5D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,GAAI,KAAK,OAAO,KAAG,GAAG,IAAI,YAAY,CAAC,GAAG,CASpE,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,QAAQ,KAAK,wBA+F/E,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BvD,CAAA"}
@@ -9,29 +9,33 @@
9
9
  * @param obj The object to check.
10
10
  * @returns True if the object is a NodeInstance, false otherwise.
11
11
  */export var isNodeInstance=function isNodeInstance(a){return"object"===_typeof(a)&&null!==a&&"element"in a&&"function"==typeof a.render&&"function"==typeof a.toPortal&&"isBaseNode"in a};/**
12
- *
13
- *Resolves theme variable references in an object's values recursively.
14
- *This function performs a "smart merge" to maintain object reference identity
15
- *for parts of the object that do not contain resolved theme variables or
16
- *other modifications. Only creates new objects or properties when a change occurs.
17
- *Handles nested objects and prevents circular references.
18
- *Theme variables are referenced using the format "theme.path.to.value".
19
- * @param obj The object whose values should be resolved against the theme. Defaults to an empty object.
12
+ * Resolves theme variable references in an object's values recursively.
13
+ * This function performs a "smart merge" to maintain object reference identity
14
+ * for parts of the object that do not contain resolved theme variables or
15
+ * other modifications. Only creates new objects or properties when a change occurs.
16
+ * Handles nested objects and arrays, and prevents circular references.
17
+ * Theme variables are referenced using the format "theme.path.to.value".
18
+ * @param obj The object (or array) whose values should be resolved against the theme. Defaults to an empty object.
20
19
  * @param theme The theme object containing variable definitions. Optional.
21
- * @returns A new object with all theme variables resolved to their corresponding values,
22
- * or the original object if no changes were necessary.
23
- */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, no resolution needed.
24
- if(!b||0===Object.keys(a).length)return a;/**
25
- *
26
- *Recursively resolves theme variables within an object.
27
- *It tracks visited objects to prevent infinite recursion caused by circular references.
28
- *This function implements a "smart merge" to preserve object identity for unchanged parts.
29
- * @param currentObj The current object being processed in the recursion.
20
+ * @returns A new object (or array) with all theme variables resolved to their corresponding values,
21
+ * or the original object (or array) if no changes were necessary.
22
+ */export var resolveObjWithTheme=function resolveObjWithTheme(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},b=1<arguments.length?arguments[1]:void 0;if(!b||0===Object.keys(a).length)return a;/**
23
+ * Recursively resolves theme variables within an object or array.
24
+ * It tracks visited objects to prevent infinite recursion caused by circular references.
25
+ * This function implements a "smart merge" to preserve object/array identity for unchanged parts.
26
+ * @param currentObj The current object or array being processed in the recursion.
30
27
  * @param visited A Set to keep track of objects that have already been visited to detect circular references.
31
- * @returns The processed object with theme variables resolved, or the original `currentObj`
28
+ * @returns The processed object/array with theme variables resolved, or the original `currentObj`
32
29
  * if no changes were made to it or its direct children (excluding deeper nested changes).
33
- */var c=function resolveRecursively(a,d){if(null===a||"object"!==_typeof(a)||Array.isArray(a)||Object.getPrototypeOf(a)!==Object.prototype)return a;if(d.has(a))return a;d.add(a);var e=a,f=!1,g=function _loop(){var g,i=a[h];if("function"==typeof i||"ref"===h||"key"===h||"object"===_typeof(i)&&null!==i&&!Array.isArray(i)&&Object.getPrototypeOf(i)!==Object.prototype||"string"==typeof i&&!i.includes("theme.")||"object"!==_typeof(i)&&"string"!=typeof i&&"function"!=typeof i)g=i;else if("string"==typeof i&&i.includes("theme.")){var j=i,k=!1;j=j.replace(/theme\.([a-zA-Z0-9_.-]+)/g,function(a,c){var d=getValueByPath(b,c);return void 0!==d&&null!==d?(k=!0,"object"===_typeof(d)&&!Array.isArray(d)&&"default"in d?d["default"]:d):a}),g=k&&j!==i?j:i}// Recursively process nested objects.
34
- else g="object"===_typeof(i)&&null!==i?c(i,d):i;g===i?f&&(e[h]=i):(!f&&(e=_objectSpread({},a),f=!0),e[h]=g)};for(var h in a)g();return e};return c(a,new Set)};/**
30
+ */var c=function resolveRecursively(a,d){// Base cases for non-objects/null, or already visited objects (circular reference)
31
+ if(null===a||"object"!==_typeof(a))return a;if(d.has(a))return a;// Handle Arrays
32
+ if(d.add(a),Array.isArray(a)){for(var e=a,f=!1,g=0;g<a.length;g++){var h=a[g],j=c(h,d);j===h?f&&(e[g]=h):(!f&&(e=[...a],f=!0),e[g]=j)}return e}// Handle Plain Objects (only process objects created with {})
33
+ if(Object.getPrototypeOf(a)===Object.prototype){var k=a,l=!1,m=function _loop(){if(Object.prototype.hasOwnProperty.call(a,n)){// Ensure it's an own property
34
+ var e=a[n],f=e;if("function"==typeof e||"object"===_typeof(e)&&null!==e&&!Array.isArray(e)&&Object.getPrototypeOf(e)!==Object.prototype||// Exclude plain objects and arrays
35
+ "object"!==_typeof(e)&&"string"!=typeof e)f=e;else if("string"==typeof e&&e.includes("theme.")){var g=e,h=!1;g=g.replace(/theme\.([a-zA-Z0-9_.-]+)/g,function(a,c){var d=getValueByPath(b,c);return void 0!==d&&null!==d?(h=!0,"object"===_typeof(d)&&!Array.isArray(d)&&"default"in d?d["default"]:d):a}),f=h&&g!==e?g:e}else"object"===_typeof(e)&&null!==e&&(// Recursively process nested objects or arrays
36
+ f=c(e,d));f===e?l&&(k[n]=e):(!l&&(k=_objectSpread({},a),l=!0),k[n]=f)}};for(var n in a)m();return k}// If it's an object but not a plain object (e.g., Date, RegExp, custom class instance), return as is.
37
+ return a};// Initial call, ensure `obj` could be an array as well
38
+ return c(a,new Set)};/**
35
39
  * Resolves default styles for a given CSSProperties object.
36
40
  * This method ensures that certain default styles, such as `minHeight`, `minWidth`,
37
41
  * 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.100",
4
+ "version": "0.1.101",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "types": "./dist/main.d.ts",