@meonode/ui 0.1.16 → 0.1.18

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.
@@ -1,5 +1,5 @@
1
1
  import React, { type ReactNode } from 'react';
2
- import type { BaseNodeInstance, NodeElement, NodeProps, Theme } from './node.type.js';
2
+ import type { BaseNodeInstance, ComponentNode, NodeElement, NodeProps, Theme } from './node.type.js';
3
3
  /**
4
4
  * Factory function to create a BaseNode instance.
5
5
  * @param element The React element type.
@@ -22,9 +22,8 @@ export declare function Node<E extends NodeElement>(element: E, props?: Partial<
22
22
  * @example
23
23
  * ```ts
24
24
  * // Basic usage
25
- * const Button = Component((props) => {
26
- * return Node('button', {
27
- * ...props,
25
+ * const App = Component(() => {
26
+ * return Div({
28
27
  * theme: { color: 'blue' }
29
28
  * })
30
29
  * })
@@ -32,5 +31,5 @@ export declare function Node<E extends NodeElement>(element: E, props?: Partial<
32
31
  */
33
32
  export declare function Component<T extends Record<string, any> & {
34
33
  theme?: Theme;
35
- }>(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;
34
+ }>(component: (props: T) => ComponentNode): (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> | (() => BaseNodeInstance<any> | ReactNode) | null | undefined;
36
35
  //# sourceMappingURL=core.node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../src/core.node.ts"],"names":[],"mappings":"AAC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AE,CAAC,KAAK,EAAE,CAAC,KAAK,aAAa,IAEzG,QAAO,CAAW,8ZAmB3B"}
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 _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";/**
1
+ "use strict";var _excluded=["children","nodeTheme","theme"],_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 _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";/**
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,28 +14,36 @@
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
- */function BaseNode(a,b){var c=this;_classCallCheck(this,BaseNode),_defineProperty(this,"_normalizeChild",function(a){var b,d;if(!a)return a;var e=(null===(b=c.rawProps)||void 0===b?void 0:b.nodeTheme)||(null===(d=c.rawProps)||void 0===d?void 0:d.theme)||c.props.nodeTheme||c.props.theme;// For BaseNode instances, apply current theme if child has no theme
17
+ */function BaseNode(a){var b=this,c=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};_classCallCheck(this,BaseNode),_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()}// For React.Component instances, wrap in BaseNode with theme if needed
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
- return a}),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);// Process styles with theme variables
22
- i=0<Object.keys(i).length?i:{};// Extract non-style DOM props
23
- var j=getDOMProps(g),k=void 0;// Process children with theme inheritance
24
- if(e!==void 0&&null!==e)if(Array.isArray(e)){k=e.map(function(a,b){return c._processRawNode(a,f,b)})}else k=this._processRawNode(e,f);// Build final normalized props
25
- this.props=_objectSpread(_objectSpread({},j),{},{style:i,nodeTheme:f,children:k})}/**
26
- * Resolves style properties by replacing theme path placeholders with actual theme values.
27
- * Handles complex strings like '1px solid theme.background.primary' and iterative resolution.
28
- * @param initialCssProps The initial CSS properties object.
21
+ return a}),this.element=a,this.rawProps=c;// Destructure raw props into relevant parts
22
+ var d=c.children,e=c.nodeTheme,f=c.theme,g=_objectWithoutProperties(c,_excluded),h=this._resolveObjWithTheme(g,e),i=getCSSProps(h),j=getDOMProps(h),k=void 0;// Resolve any theme variables in the remaining props
23
+ // Extract style-related props that match valid CSS properties
24
+ // Extract remaining props that are valid DOM attributes
25
+ // Process children while maintaining theme inheritance
26
+ // Combine processed props into final normalized form
27
+ d&&(Array.isArray(d)?k=d.map(function(a,c){return b._processRawNode(a,e,c)}):k=this._processRawNode(d,e)),this.props=_objectSpread(_objectSpread({},j),{},{style:i,nodeTheme:e,children:k})}/**
28
+ * Resolves obj properties by replacing theme path placeholders with actual theme values.
29
+ * Handles complex strings like '1px solid theme.background.primary' and nested objects.
30
+ * @param obj The initial obj properties object.
29
31
  * @param theme The theme object to use for resolving paths.
30
32
  * @returns A new CSSProperties object with theme values resolved.
31
- */return _createClass(BaseNode,[{key:"_resolveStyleWithTheme",value:function _resolveStyleWithTheme(a,b){var c;// If no theme is provided or there are no initial CSS props to process, return the initial props.
32
- if(!b||0===Object.keys(a).length)return a;var d=_objectSpread(_objectSpread({},null===(c=this.rawProps)||void 0===c?void 0:c.nodeTheme),b),e=_objectSpread({},a);// Merge nodeTheme from rawProps with theme
33
- for(var f in e)if(Object.prototype.hasOwnProperty.call(e,f)){var g=e[f];if("string"==typeof g&&g.includes("theme.")){var h=g;// Iteratively resolve theme references within the string
34
- h=h.replace(/theme\.([a-zA-Z0-9_.-]+)/g,function(a,b){var c=getValueByPath(d,b);// Use 'theme' passed to the function
35
- // Replace it if themeValue is found and is a string or number.
36
- // null is explicitly excluded to avoid 'null' string in output unless intended.
37
- return void 0!==c&&null!==c&&("string"==typeof c||"number"==typeof c)?c+"":a;// If themeValue is not a string or number or is undefined/null, keep the original placeholder
38
- }),e[f]=h}}return e}/**
33
+ */return _createClass(BaseNode,[{key:"_resolveObjWithTheme",value:function _resolveObjWithTheme(a,b){var c;// Return early if no theme or empty object
34
+ if(!b||0===Object.keys(a).length)return a;// Merge raw nodeTheme with passed theme for resolution
35
+ var d=_objectSpread(_objectSpread({},null===(c=this.rawProps)||void 0===c?void 0:c.nodeTheme),b),e=function resolveRecursively(a){var b={};// Process each property in the current object
36
+ for(var c in a)// Skip non-own properties
37
+ if(Object.prototype.hasOwnProperty.call(a,c)){var f=a[c];// Skip private properties starting with underscore
38
+ if(c.startsWith("_"))return a;// Handle string values containing theme references
39
+ if("string"==typeof f&&f.includes("theme.")){var g=f;// Replace theme path placeholders with actual theme values
40
+ g=g.replace(/theme\.([a-zA-Z0-9_.-]+)/g,function(a,b){var c=getValueByPath(d,b);// Convert theme value to string if it exists and is a valid type
41
+ return null!=c&&["string","number"].includes(_typeof(c))?c+"":a}),b[c]=g}// Recursively process nested objects (excluding arrays)
42
+ else b[c]=f&&"object"===_typeof(f)&&!Array.isArray(f)?e(f):f}return b};/**
43
+ * Recursively resolves theme values in an object
44
+ * @param currentObj The current object level being processed
45
+ * @returns New object with resolved theme values
46
+ */return e(a)}/**
39
47
  * React component that renders the result of a function child, supporting theme propagation.
40
48
  *
41
49
  * This component is used to render children that are functions (i.e., `() => Children`).
@@ -48,11 +56,9 @@ return void 0!==c&&null!==c&&("string"==typeof c||"number"==typeof c)?c+"":a;//
48
56
  */},{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.
49
57
  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,
50
58
  // re-create the node with the provided theme to ensure correct theme propagation.
51
- 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,// Pass theme for consistency if used in rawProps
52
- key:d})).render():j.render();// If the node already has a theme or no theme is provided, render as-is.
59
+ 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,key:d})).render():j.render();// If the node already has a theme or no theme is provided, render as-is.
53
60
  }// Process the result if it's not a React.Component or BaseNode
54
- var k=e(f,c);if(k instanceof BaseNode){var l,m;if(((null===(l=k.rawProps)||void 0===l?void 0:l.theme)||(null===(m=k.rawProps)||void 0===m?void 0:m.nodeTheme))===void 0&&c!==void 0){var n,o,p;return new BaseNode(k.element,_objectSpread(_objectSpread({},k.rawProps),{},{nodeTheme:(null===(n=k.rawProps)||void 0===n?void 0:n.theme)||(null===(o=k.rawProps)||void 0===o?void 0:o.nodeTheme)||c,key:(null===(p=k.rawProps)||void 0===p?void 0:p.key)||d// Use an existing key or passed key
55
- })).render()}return k.render()}// If the result is not a BaseNode (e.g., JSX, string, etc.), return it directly.
61
+ var k=e(f,c);if(k instanceof BaseNode){var l,m;if(((null===(l=k.rawProps)||void 0===l?void 0:l.theme)||(null===(m=k.rawProps)||void 0===m?void 0:m.nodeTheme))===void 0&&c!==void 0){var n,o,p;return new BaseNode(k.element,_objectSpread(_objectSpread({},k.rawProps),{},{nodeTheme:(null===(n=k.rawProps)||void 0===n?void 0:n.theme)||(null===(o=k.rawProps)||void 0===o?void 0:o.nodeTheme)||c,key:(null===(p=k.rawProps)||void 0===p?void 0:p.key)||d})).render()}return k.render()}// If the result is not a BaseNode (e.g., JSX, string, etc.), return it directly.
56
62
  // Note: Non-BaseNode results will not automatically receive the theme.
57
63
  return f}/**
58
64
  * Processes a single raw child element, converting it into a ProcessedChild.
@@ -142,18 +148,16 @@ return c.theme&&void 0===c.nodeTheme&&(c.nodeTheme=c.theme),new BaseNode(a,c)}/*
142
148
  * @example
143
149
  * ```ts
144
150
  * // Basic usage
145
- * const Button = Component((props) => {
146
- * return Node('button', {
147
- * ...props,
151
+ * const App = Component(() => {
152
+ * return Div({
148
153
  * theme: { color: 'blue' }
149
154
  * })
150
155
  * })
151
156
  * ```
152
157
  */export function Component(a){// Create a wrapper component that handles theme and rendering
153
- return function(){var b=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},c=a(_objectSpread({},b));// Execute wrapped component
158
+ return function(){var b=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},c=a(b);// Execute wrapped component
154
159
  // Handle BaseNode results - requires special processing
155
160
  if(c instanceof BaseNode){var d,e;// Theme merging: Check if we need to handle theme inheritance
156
161
  if(!!(null!==b&&void 0!==b&&b.theme||null!==b&&void 0!==b&&b.nodeTheme)||!!(null!==(d=c.rawProps)&&void 0!==d&&d.theme||null!==(e=c.rawProps)&&void 0!==e&&e.nodeTheme)){var f,g;return new BaseNode(c.element,_objectSpread(_objectSpread({},c.rawProps),{},{// Theme priority: props.theme > rawProps.theme > rawProps.nodeTheme
157
162
  nodeTheme:(null===b||void 0===b?void 0:b.theme)||(null===(f=c.rawProps)||void 0===f?void 0:f.theme)||(null===(g=c.rawProps)||void 0===g?void 0:g.nodeTheme)})).render()}return c.render();// No theme to handle, just render
158
- }// Direct return for non-BaseNode results (standard React nodes)
159
- return c}}
163
+ }return c}}
@@ -1,5 +1,5 @@
1
1
  import type { Attributes as ReactAttributes, ComponentProps, CSSProperties, ReactNode, JSX, ElementType, ComponentType, JSXElementConstructor, Component } from 'react';
2
- export type NodeElement = ReactNode | Component<any, any> | ElementType | ComponentType<any> | BaseNodeInstance<any> | ((props?: any) => ReactNode | Promise<ReactNode> | Component<any> | BaseNodeInstance<any>);
2
+ export type NodeElement = ReactNode | Component<any, any> | ElementType | ComponentType<any> | BaseNodeInstance<any> | ((props?: any) => ReactNode | Promise<ReactNode> | Component<any> | BaseNodeInstance<any> | ComponentNode);
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 | Component<any, any> | ElementType | Compon
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 | Component<any> | NodeElement | BaseNodeInstance<any>;
10
+ export type Children = ReactNode | Component<any> | NodeElement | BaseNodeInstance<any> | ComponentNode;
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.
@@ -99,5 +99,6 @@ export interface FunctionRendererProps<E extends NodeElement> {
99
99
  passedKey?: string;
100
100
  processRawNode: (node: NodeElement, parentTheme?: Theme, childIndex?: number) => BaseNodeInstance<E>;
101
101
  }
102
+ export type ComponentNode = (BaseNodeInstance<any> | ReactNode) | (() => BaseNodeInstance<any> | ReactNode);
102
103
  export {};
103
104
  //# sourceMappingURL=node.type.d.ts.map
@@ -1 +1 @@
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,SAAS,EACV,MAAM,OAAO,CAAA;AAEd,MAAM,MAAM,WAAW,GACnB,SAAS,GACT,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,GACnB,WAAW,GACX,aAAa,CAAC,GAAG,CAAC,GAClB,gBAAgB,CAAC,GAAG,CAAC,GACrB,CAAC,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAA;AAE9F;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,WAAW,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAA;AAEvF;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW;IACnE,gFAAgF;IAChF,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;IAEnB,uFAAuF;IACvF,QAAQ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E,WAAW,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,gBAAgB,CAAC,CAAC,CAAC,CAAA;CACrG;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,gBAAgB,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAA"}
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.16",
4
+ "version": "0.1.18",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "types": "./dist/main.d.ts",