@meonode/ui 0.1.62 → 0.1.63

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.
@@ -36,14 +36,14 @@ export declare class BaseNode<E extends NodeElement> implements NodeInstance<E>
36
36
  *
37
37
  * - If the element is a flex container:
38
38
  * - Sets `flexShrink` to 0 for specific scenarios:
39
- * - Column-based layout with wrapping.
40
- * - Row-based layout without wrapping (default direction is assumed to be 'row').
39
+ * - Column-based layout without wrapping.
40
+ * - Row-based layout without wrapping (a default direction is assumed to be 'row').
41
41
  * - If the element is not a flex container:
42
42
  * - Defaults `flexShrink` to 0.
43
43
  * @param style The CSSProperties object containing style definitions.
44
44
  * @returns An object with resolved default styles.
45
45
  */
46
- private _resolveDefaultStyles;
46
+ private _resolveDefaultStyle;
47
47
  /**
48
48
  * Resolves theme variable references in an object's values recursively.
49
49
  * Handles nested objects and prevents circular references.
@@ -1 +1 @@
1
- {"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../src/core.node.ts"],"names":[],"mappings":"AACA,OAAc,EAAsG,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACjJ,OAAO,KAAK,EAAE,cAAc,EAAyB,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAGzI,OAAO,EAAc,KAAK,IAAI,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAExE;;;;;;;;GAQG;AACH,qBAAa,QAAQ,CAAC,CAAC,SAAS,WAAW,CAAE,YAAW,YAAY,CAAC,CAAC,CAAC;IACrE,+EAA+E;IACxE,OAAO,EAAE,CAAC,CAAA;IAEjB,kFAAkF;IAC3E,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;IAEjC,wFAAwF;IACjF,KAAK,EAAE,cAAc,CAAA;IAE5B,OAAO,CAAC,iBAAiB,CAA8B;IACvD,OAAO,CAAC,gBAAgB,CAA4B;IA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AC,CAAC,CAAC,CAAA;IAEjC,wFAAwF;IACjF,KAAK,EAAE,cAAc,CAAA;IAE5B,OAAO,CAAC,iBAAiB,CAA8B;IACvD,OAAO,CAAC,gBAAgB,CAA4B;IAEpD;;;;;;;;OAQG;gBACS,OAAO,EAAE,CAAC,EAAE,QAAQ,GAAE,YAAY,CAAC,CAAC,CAAM;IA2CtD;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,oBAAoB;IA8B5B;;;;;;;OAOG;IACH,OAAO,CAAC,oBAAoB;IAsE5B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,iBAAiB;IAuDzB;;;;;;;;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,CAmCtB;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"],_excluded2=["style"],_excluded3=["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 _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 _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,getValueByPath}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"],_excluded2=["flex"],_excluded3=["style"],_excluded4=["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 _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 _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,getValueByPath}from"./node.helper.js";import{isForwardRef,isMemo,isReactClassComponent,isValidElementType}from"./react-is.helper.js";import{createRoot}from"react-dom/client";/**
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
@@ -19,10 +19,10 @@ if(a instanceof BaseNode){var f;return null!==(f=a.rawProps)&&void 0!==f&&f.node
19
19
  if(a instanceof React.Component)return a.props.nodetheme||void 0===e?a.render():new BaseNode(a.render(),_objectSpread(_objectSpread({},a.props),{},{nodetheme:e})).render();// Validate element type before returning
20
20
  if(!isValidElementType(a)){var g=getComponentType(a);throw new Error("Invalid element type: ".concat(g," provided!"))}// Return valid React elements as-is
21
21
  return a}),this.element=a,this.rawProps=c;// Destructure raw props into relevant parts
22
- var d=c.ref,e=c.children,f=c.nodetheme,g=c.theme,h=_objectWithoutProperties(c,_excluded),i=g||f,j=this._resolveObjWithTheme(h,i),k=getCSSProps(j),l=this._resolveDefaultStyles(k),m=_objectSpread(_objectSpread(_objectSpread({},l),j.style),k),n=getDOMProps(j),o=void 0;// Resolve any theme variables in the remaining props
22
+ var d=c.ref,e=c.children,f=c.nodetheme,g=c.theme,h=_objectWithoutProperties(c,_excluded),i=g||f,j=this._resolveObjWithTheme(h,i),k=getCSSProps(j),l=this._resolveDefaultStyle(k),m=_objectSpread(_objectSpread({},l),j.style),n=getDOMProps(j),o=void 0;// Resolve any theme variables in the remaining props
23
23
  // Extract CSS-related properties from the resolved theme-aware props
24
24
  // Resolve default styles based on the processed style properties
25
- // Merge default styles, resolved theme styles, and processed style properties into final style props
25
+ // Merge resolved default styles and processed style properties into final style props
26
26
  // Extract remaining props that are valid DOM attributes
27
27
  // Process children while maintaining theme inheritance
28
28
  // Combine processed props into final normalized form
@@ -33,15 +33,15 @@ e&&(Array.isArray(e)?o=e.map(function(a,c){return b._processRawNode(a,i,c)}):o=t
33
33
  *
34
34
  * - If the element is a flex container:
35
35
  * - Sets `flexShrink` to 0 for specific scenarios:
36
- * - Column-based layout with wrapping.
37
- * - Row-based layout without wrapping (default direction is assumed to be 'row').
36
+ * - Column-based layout without wrapping.
37
+ * - Row-based layout without wrapping (a default direction is assumed to be 'row').
38
38
  * - If the element is not a flex container:
39
39
  * - Defaults `flexShrink` to 0.
40
40
  * @param style The CSSProperties object containing style definitions.
41
41
  * @returns An object with resolved default styles.
42
- */return _createClass(BaseNode,[{key:"_resolveDefaultStyles",value:function _resolveDefaultStyles(a){var b="flex"===a.display,c=!(a.overflow||a.overflowY||a.overflowX),d="wrap"===a.flexFlow||"wrap"===a.flexWrap,e=void 0;if(!b)// If it's not a flex container, default flex-shrink to 0
43
- e=0;else if(c){var f="column"===a.flexDirection||"column-reverse"===a.flexDirection,g="row"===a.flexDirection||"row-reverse"===a.flexDirection||!a.flexDirection;// Scenario 1: Column-based layout with wrapping
44
- f&&d?e=0:g&&!d&&(e=0)}return{minHeight:0,minWidth:0,flexShrink:e}}/**
42
+ */return _createClass(BaseNode,[{key:"_resolveDefaultStyle",value:function _resolveDefaultStyle(a){var b,c=a.flex,d=_objectWithoutProperties(a,_excluded2),e="flex"===d.display,f=!!(d.overflow||d.overflowY||d.overflowX),g=(null===(b=d.flexFlow)||void 0===b?void 0:b.includes("wrap"))||"wrap"===d.flexWrap,h=void 0;if(!e)// If it's not a flex container, default flex-shrink to 0
43
+ h=0;else if(!f){var i="column"===d.flexDirection||"column-reverse"===d.flexDirection,j="row"===d.flexDirection||"row-reverse"===d.flexDirection||!d.flexDirection;// Scenario 1: Column-based layout
44
+ i&&!g?h=0:j&&!g&&(h=0)}return _objectSpread({flex:c,flexShrink:h,minHeight:0,minWidth:0},d)}/**
45
45
  * Resolves theme variable references in an object's values recursively.
46
46
  * Handles nested objects and prevents circular references.
47
47
  * Theme variables are referenced using the format "theme.path.to.value".
@@ -103,7 +103,7 @@ if("function"===d&&!isReactClassComponent(a)&&!isMemo(a)&&!isForwardRef(a)){// T
103
103
  var j=e(this._functionRenderer,void 0);// Generate key for function renderer
104
104
  return new BaseNode(this._functionRenderer,{processRawNode:this._processRawNode.bind(this),render:a,passedTheme:b,key:j// Assign the generated key
105
105
  })}// Case 4: Child is a React Element (JSX element like <div> or <MyComponent>)
106
- if(isValidElement(a)){var k=a.props,l=k.style,m=_objectWithoutProperties(k,_excluded2),n=_objectSpread(_objectSpread({},m),l||{}),o=n.theme||n.nodetheme||b,p=e(a.type,a.key);// Combine top-level props from the element with its flattened style object properties
106
+ if(isValidElement(a)){var k=a.props,l=k.style,m=_objectWithoutProperties(k,_excluded3),n=_objectSpread(_objectSpread({},m),l||{}),o=n.theme||n.nodetheme||b,p=e(a.type,a.key);// Combine top-level props from the element with its flattened style object properties
107
107
  return new BaseNode(a.type,_objectSpread(_objectSpread({},n),{},{// Pass the combined props
108
108
  nodetheme:o,key:p}))}// Case 5: Child is an ElementType (string tag, class component, Memo/ForwardRef)
109
109
  if(isReactClassComponent(a)||"object"===d&&(isMemo(a)||isForwardRef(a))){// ElementTypes don't have an intrinsic key from the rawNode itself.
@@ -130,7 +130,7 @@ return a}/**
130
130
  * Converts this BaseNode instance into a renderable React node.
131
131
  * Recursively processes child nodes and uses `React.createElement` to construct the final React element.
132
132
  * @returns A ReactNode representing the rendered element.
133
- */function render(){var a=this;if(!isValidElementType(this.element)){var b=getComponentType(this.element);throw new Error("Invalid element type: ".concat(b," provided!"))}var c=this.props,d=c.children,e=c.key,f=_objectWithoutProperties(c,_excluded3),g=void 0;// Extract children and key
133
+ */function render(){var a=this;if(!isValidElementType(this.element)){var b=getComponentType(this.element);throw new Error("Invalid element type: ".concat(b," provided!"))}var c=this.props,d=c.children,e=c.key,f=_objectWithoutProperties(c,_excluded4),g=void 0;// Extract children and key
134
134
  // More accurate type
135
135
  if(d!==void 0&&null!==d)if(!Array.isArray(d))// Single child
136
136
  g=this._normalizeChild(d);else if(0<d.length){var h=d.map(function(b){return a._normalizeChild(b)});// Normalize each child in the array
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meonode/ui",
3
3
  "description": "A structured approach to component composition with built-in theming, prop separation, and dynamic children handling.",
4
- "version": "0.1.62",
4
+ "version": "0.1.63",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "types": "./dist/main.d.ts",