@meonode/ui 0.1.12 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -164,129 +164,166 @@ const Dashboard = Component(() =>
164
164
  ### With Conditional Children That Contains Hook
165
165
 
166
166
  ```ts
167
- // Wraps a hook-capable component into a BaseNode-compatible Client Component
168
167
  'use client'
169
168
  /**
170
169
  * This file demonstrates integration between React hooks and BaseNode components
171
- * using the @meonode/ui library for declarative UI construction
170
+ * using the @meonode/ui library for declarative UI construction.
171
+ * It explores various rendering patterns, Higher-Order Component (HOC) usage,
172
+ * and theme propagation with @meonode/ui components.
172
173
  */
173
- import { Component, Column, Row, Div, P, Node } from '@meonode/ui'
174
+ import { Component, Column, Row, Div, P, Node } from '@meonode/ui' // Theme type is not explicitly imported or used as a prop type in this file's components.
174
175
  import { useState, useEffect } from 'react'
176
+ import { CssBaseline, TextField } from '@meonode/mui'
175
177
 
176
178
  /**
177
- * Global theme configuration
178
- * Contains color palette definitions used throughout components
179
- * Can be extracted to separate theme file if needed
179
+ * Global theme configuration.
180
+ * Contains color palette definitions used by @meonode/ui components
181
+ * when they resolve theme strings from context.
182
+ * This can be extracted to a separate theme file for larger applications.
180
183
  */
181
184
  const theme = {
182
185
  background: { primary: 'lightgreen', secondary: 'lightyellow' },
183
186
  }
184
187
 
185
188
  /**
186
- * Main page component wrapped in Component HOC to enable client-side features
187
- * Demonstrates conditional rendering and component composition patterns
189
+ * The page's main logic is defined as a function (which may use React hooks).
190
+ * This function is wrapped in the `Component` HOC from @meonode/ui.
191
+ * The HOC standardizes it as a React component, ensuring it returns a ReactNode.
192
+ * This makes the component compatible with React's rendering process,
193
+ * supporting both client-side and server-side rendering.
188
194
  */
189
195
  export default Component(() => {
190
- // Controls visibility of detail sections
191
- const [showDetails, setShowDetails] = useState(false)
196
+ // State hook to control the visibility of additional content sections.
197
+ const [showMore, setShowDetails] = useState(false) // 'showMore' controls visibility, 'setShowDetails' is the updater.
192
198
 
193
199
  /**
194
- * Main layout structured as a Column with:
195
- * - Header row containing toggle button
196
- * - Conditional detail sections using different rendering approaches
200
+ * The main layout is structured as a Column.
201
+ * It includes:
202
+ * - A header row with a button to toggle the visibility of additional content.
203
+ * - A series of examples demonstrating different ways to render detail components,
204
+ * both unconditionally and conditionally, highlighting theme propagation.
197
205
  */
198
206
  return Column({
199
- theme,
207
+ theme, // Provide the global theme to the Column and its descendants via React context.
200
208
  padding: 20,
201
209
  gap: 15,
202
210
  children: [
203
- // Interactive header section
211
+ CssBaseline, // Applies baseline MUI styles.
212
+ // Interactive header section for toggling more content.
204
213
  Row({
205
214
  gap: 10,
206
215
  children: [
207
216
  Div({
208
- onClick: () => setShowDetails(prev => !prev), // Toggle detail visibility
209
- cursor: 'pointer',
210
- userSelect: 'none', // Prevent text selection
217
+ onClick: () => setShowDetails(prev => !prev), // Click handler to toggle the 'showMore' state.
218
+ cursor: 'pointer', // Visual cue for clickability.
219
+ userSelect: 'none', // Prevents text selection on the button.
211
220
  padding: '10px 20px',
212
- backgroundColor: 'theme.background.primary', // Themed background
221
+ backgroundColor: 'theme.background.primary', // Background color sourced from the theme context.
213
222
  borderRadius: 5,
214
223
  fontWeight: 'bold',
215
- children: showDetails ? 'Hide Details' : 'Show Details',
224
+ children: showMore ? 'Hide' : 'Show More', // Dynamically sets button text based on 'showMore' state.
216
225
  }),
217
226
  ],
218
227
  }),
219
228
 
220
229
  /**
221
- * Multiple approaches to conditional detail rendering:
222
- * 1. Direct function wrapping
223
- * 2. Component HOC wrapping
224
- * 3. Node with ReturnRenderedDetailComponent
225
- * 4. Non-working example with raw Node usage
230
+ * Unconditional rendering examples:
231
+ * Demonstrates rendering DetailComponent (returns a @meonode/ui Node instance) and
232
+ * ReturnRenderedDetailComponent (returns a ReactNode), and usage of the Node HOC.
233
+ * Pay attention to how theme is (or isn't) propagated to these components.
226
234
  */
227
- showDetails && (() => DetailComponent({ info: 'Here are some details 1!' })), // Method 1
228
- showDetails && Component(() => DetailComponent({ info: 'Here are some details 2!' })), // Method 2
229
- showDetails && Node(ReturnRenderedDetailComponent, { info: 'Here are some details 2!' }).render(), // Method 3
235
+ DetailComponent({ info: 'Here are some details 1!' }), // Renders DetailComponent; its internal Row sources theme from parent Column's context.
236
+ DetailComponent({ info: 'Here are some details 2!' }).render(), // Renders DetailComponent (invoking .render()); its internal Row sources theme from parent Column's context.
237
+ // Node(DetailComponent, { info: 'Here are some details 3!' }), // Fails: Node HOC expects its first argument (a component function) to return ReactNode. DetailComponent returns a @meonode/ui Node instance.
238
+
239
+ ReturnRenderedDetailComponent({ info: 'Here are some details 4!' }), // Renders ReturnRenderedDetailComponent; its internal Row inherits theme from parent Column's context.
240
+ Node(ReturnRenderedDetailComponent, { info: 'Here are some details 5!' }), // Node HOC with a function returning ReactNode: Renders. Theme from Column is NOT propagated by Node HOC to the internal Row.
241
+ Node(ReturnRenderedDetailComponent, { info: 'Here are some details 6!' }).render(), // Node HOC (then .render()): Renders. Theme from Column is NOT propagated by Node HOC to the internal Row.
242
+ // Node(DetailComponent, { info: 'Here are some details 7!' }).render(), // ❌ Fails: Same reason as above; Node HOC expects a function returning ReactNode.
230
243
 
231
- // Fails because DetailComponent returns Node instance instead of ReactNode
232
- showDetails && Node(DetailComponent, { info: 'Here are some details 2!' }).render(), // ❌ Invalid
244
+ /**
245
+ * Conditional rendering examples (shown when 'showMore' is true):
246
+ * These demonstrate various wrapping techniques (inline functions, Component HOC)
247
+ * and their effect on rendering and theme propagation for both types of detail components.
248
+ */
249
+ showMore && (() => DetailComponent({ info: 'Here are some details 8!' })), // Method 1 (inline function wrapper): Renders DetailComponent; its internal Row sources theme from context.
250
+ showMore && (() => DetailComponent({ info: 'Here are some details 9!' }).render()), // Method 2 (inline function wrapper + .render()): Renders DetailComponent; its internal Row sources theme from context.
251
+ showMore && Component(() => DetailComponent({ info: 'Here are some details 10!' })), // Method 3 (Component HOC wrapper): Renders DetailComponent; its internal Row sources theme from context.
252
+
253
+ showMore && (() => ReturnRenderedDetailComponent({ info: 'Here are some details 12!' })), // Method 4 (inline function wrapper): Renders ReturnRenderedDetailComponent; internal Row inherits theme from Column's context.
254
+ showMore && Component(() => ReturnRenderedDetailComponent({ info: 'Here are some details 13!' })), // Method 5 (Component HOC wrapper): Renders ReturnRenderedDetailComponent; internal Row inherits theme from Column's context.
255
+ showMore && Node(ReturnRenderedDetailComponent, { info: 'Here are some details 14!' }).render(), // Method 6 (Node HOC + .render()): Renders. Theme from Column is NOT propagated by Node HOC to internal Row.
256
+ // showMore && ReturnRenderedDetailComponent({ info: 'Here are some details 15!' }), // ❌ Fails: Direct call to a component function using hooks (ReturnRenderedDetailComponent) inside render logic without a React-aware wrapper. This can violate Rules of Hooks.
233
257
  ],
234
258
  })
235
259
  })
236
260
 
237
261
  /**
238
- * Displays a styled detail section with lifecycle logging
239
- * @param {Object} props - Component properties
240
- * @param {string} props.info - Text content to display
241
- * @returns {Node} Rendered Div Node instance
262
+ * A component that displays a styled detail section.
263
+ * It uses `useEffect` for lifecycle logging. The internal `Row` component
264
+ * sources its theme from the React context established by an ancestor
265
+ * @meonode/ui component (e.g., the main Column in this page).
266
+ * This component returns a @meonode/ui `Row` Node instance.
267
+ *
268
+ * @param {object} props - Component properties.
269
+ * @param {string} props.info - Text content to display in the detail section.
270
+ * @returns {import('@meonode/ui').Node} A @meonode/ui Row Node instance.
242
271
  */
243
272
  const DetailComponent = ({ info }: { info: string }) => {
244
- // Log component lifecycle for debugging
273
+ // useEffect hook for logging component mount and unmount phases (for debugging).
245
274
  useEffect(() => {
246
- console.log('DetailComponent mounted')
275
+ console.log('DetailComponent mounted:', info) // Example mount log
247
276
  return () => {
248
- console.log('DetailComponent unmounted')
277
+ console.log('DetailComponent unmounted:', info) // Example unmount log
249
278
  }
250
- }, [])
279
+ }, [info]) // Effect depends on 'info' prop.
251
280
 
252
- // Themed container with text content
253
- return Div({
254
- padding: 15,
281
+ // Returns a @meonode/ui Row component configured with props and children.
282
+ // Its styling (e.g., backgroundColor) will resolve theme strings from React context.
283
+ return Row({
284
+ gap: 10,
285
+ padding: 4,
255
286
  border: '1px solid green',
256
287
  borderRadius: 6,
257
288
  color: 'red',
258
- backgroundColor: 'theme.background.secondary', // Theme-aware background
259
- children: P(info),
289
+ backgroundColor: 'theme.background.secondary', // Background color sourced from theme in React context.
290
+ children: [P(info), TextField({ background: 'theme.background.primary' })],
260
291
  })
261
292
  }
262
293
 
263
294
  /**
264
- * Alternative implementation that explicitly returns rendered content
265
- * Functionally identical to DetailComponent but compatible with Node wrapper
266
- * @param {Object} props - Component properties
267
- * @param {string} props.info - Text content to display
268
- * @returns {ReactNode} Rendered React element
295
+ * An alternative detail component implementation that explicitly calls `.render()`
296
+ * to return a `ReactNode` (a rendered React element) directly.
297
+ * This makes it compatible with wrappers like the `Node` HOC that expect a function returning `ReactNode`.
298
+ * It uses `useEffect` for lifecycle logging. The internal `Row` sources its
299
+ * theme from React context.
300
+ *
301
+ * @param {object} props - Component properties.
302
+ * @param {string} props.info - Text content to display.
303
+ * @returns {React.ReactNode} A rendered React element (the result of `Row(...).render()`).
269
304
  */
270
305
  const ReturnRenderedDetailComponent = ({ info }: { info: string }) => {
271
- // Log component lifecycle for debugging
306
+ // useEffect hook for logging component mount and unmount phases (for debugging).
272
307
  useEffect(() => {
273
- console.log('DetailComponent mounted')
308
+ console.log('ReturnRenderedDetailComponent mounted:', info) // Example mount log
274
309
  return () => {
275
- console.log('DetailComponent unmounted')
310
+ console.log('ReturnRenderedDetailComponent unmounted:', info) // Example unmount log
276
311
  }
277
- }, [])
278
-
279
- // Themed container with text content
280
- return Div({
281
- padding: 15,
312
+ }, [info]) // Effect depends on 'info' prop.
313
+
314
+ // Constructs a @meonode/ui Row and immediately calls .render() on it.
315
+ // The Row itself will attempt to resolve theme strings (e.g., 'theme.background.secondary')
316
+ // from the React context provided by an ancestor @meonode/ui component (like the main Column).
317
+ return Row({
318
+ gap: 10,
319
+ padding: 4,
282
320
  border: '1px solid green',
283
321
  borderRadius: 6,
284
322
  color: 'red',
285
- backgroundColor: 'theme.background.secondary', // Theme-aware background
286
- children: P(info),
287
- }).render()
323
+ backgroundColor: 'theme.background.secondary', // Theme-aware background; relies on theme from React context.
324
+ children: [P(info), TextField({ background: 'theme.background.primary' })],
325
+ }).render() // Explicitly renders to ReactNode.
288
326
  }
289
-
290
327
  ```
291
328
 
292
329
  ### Material UI Integration
@@ -1,5 +1,5 @@
1
1
  import React, { type ReactNode } from 'react';
2
- import type { BaseNodeInstance, NodeElement, NodeProps } from './node.type.js';
2
+ import type { BaseNodeInstance, 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.
@@ -9,17 +9,28 @@ import type { BaseNodeInstance, NodeElement, NodeProps } from './node.type.js';
9
9
  export declare function Node<E extends NodeElement>(element: E, props?: Partial<NodeProps<E>>): BaseNodeInstance<E>;
10
10
  /**
11
11
  * Higher-order component wrapper that converts BaseNode components into React components.
12
+ * This wrapper ensures proper theme propagation and component rendering in the React ecosystem.
12
13
  *
13
- * This function takes a component function that may return either a BaseNode instance
14
- * or a ReactNode, and wraps it to ensure the output is always a renderable ReactNode.
15
- * BaseNode instances are automatically converted using render().
16
- * @template T - The type of props accepted by the component
17
- * @param component The component function that returns either a BaseNode or ReactNode
18
- * @returns A React function component that takes the same props and returns a ReactNode
14
+ * Key features:
15
+ * - Converts BaseNode instances to React elements via render()
16
+ * - Handles theme inheritance and merging
17
+ * - Preserves component props
18
+ * - Type-safe with generic prop types
19
+ * @template T - The props type for the wrapped component
20
+ * @param component Component function that returns a BaseNode or ReactNode
21
+ * @returns A React function component that handles BaseNode conversion and theme propagation
19
22
  * @example
20
- * const MyComponent = Component((props) => {
21
- * return Node('div', { ...props })
23
+ * ```ts
24
+ * // Basic usage
25
+ * const Button = Component((props) => {
26
+ * return Node('button', {
27
+ * ...props,
28
+ * theme: { color: 'blue' }
29
+ * })
22
30
  * })
31
+ * ```
23
32
  */
24
- export declare function Component<T extends Record<string, any>>(component: (props: T) => BaseNodeInstance<any> | ReactNode): (props: T) => string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | BaseNodeInstance<any> | null | undefined;
33
+ export declare function Component<T extends Record<string, any> & {
34
+ 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;
25
36
  //# sourceMappingURL=core.node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../src/core.node.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAsG,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACjJ,OAAO,KAAK,EAAE,gBAAgB,EAAwC,WAAW,EAAE,SAAS,EAA4B,MAAM,mBAAmB,CAAA;AA6TjJ;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,WAAW,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,GAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAS9G;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,gBAAgB,CAAC,GAAG,CAAC,GAAG,SAAS,IACzG,OAAO,CAAC,kXAOjB"}
1
+ {"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../src/core.node.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAsG,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACjJ,OAAO,KAAK,EAAE,gBAAgB,EAAwC,WAAW,EAAE,SAAS,EAAqB,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAoXjJ;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,WAAW,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,GAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAU9G;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAAE,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,gBAAgB,CAAC,GAAG,CAAC,GAAG,SAAS,IAE7H,QAAO,CAAW,kXAmB3B"}
package/dist/core.node.js CHANGED
@@ -1,30 +1,38 @@
1
- "use strict";var _excluded=["children","nodeTheme"],_excluded2=["children","key"];function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return(b=_toPropertyKey(b))in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=_objectWithoutPropertiesLoose(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],-1===b.indexOf(c)&&{}.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c={};for(var d in a)if({}.hasOwnProperty.call(a,d)){if(-1!==b.indexOf(d))continue;c[d]=a[d]}return c}function _classCallCheck(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}import React,{createElement,isValidElement}from"react";import{getComponentType,getCSSProps,getDOMProps,getElementTypeName,getValueByPath}from"./node.helper.js";import{isForwardRef,isMemo,isReactClassComponent,isValidElementType}from"./react-is.helper.js";/**
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";/**
2
2
  * Represents a node in a React component tree, providing a structured way to define and manipulate
3
3
  * React elements before they are rendered. Handles props processing, theme application, and child node management.
4
4
  * @template E The type of the React element this node represents (e.g., 'div', a custom component).
5
- */var BaseNode=/*#__PURE__*/function(){/** The React element type for this node. *//** The original, unprocessed props passed to this node during construction. *//** The processed props for this node, including styles, DOM attributes, and children. *//**
5
+ */var BaseNode=/*#__PURE__*/function(){/** The React element type for this node. *//** The original, unprocessed props passed to this node during construction. */// Initial props before processing
6
+ /** The processed props for this node, including styles, DOM attributes, and children. *//**
6
7
  * Constructs a new BaseNode instance.
7
8
  * @param element The React element type.
8
9
  * @param rawProps The raw props for the node.
9
- */function BaseNode(a,b){var c=this;_classCallCheck(this,BaseNode),this.element=a,this.rawProps=b;var d=b||{},e=d.children,f=d.nodeTheme,g=_objectWithoutProperties(d,_excluded),h=getCSSProps(g),i=this._resolveStyleWithTheme(h,f);// 1. Resolve styles and DOM props for this node
10
- i=0<Object.keys(i).length?i:{};var j=getDOMProps(g),k=void 0;// 2. Process rawNoderen into BaseNode instances or primitives, passing down currentTheme
11
- if(e!==void 0&&null!==e)if(Array.isArray(e)){k=e.map(function(a,b){return c._processRawNode(a,f,b)}// Pass index for array children
10
+ */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
11
+ 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
12
+ 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
13
+ if(!isValidElementType(a)){var g=getComponentType(a);throw new Error("Invalid element type: ".concat(g," provided!"))}// Return valid React elements as-is
14
+ 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);// Extract children and theme
15
+ // 1. Resolve styles and DOM props for this node
16
+ i=0<Object.keys(i).length?i:{};var j=getDOMProps(g),k=void 0;// Extract DOM-related props
17
+ // 2. Process rawNoderen into BaseNode instances or primitives, passing down the currentTheme
18
+ if(e!==void 0&&null!==e)if(Array.isArray(e)){k=e.map(function(a,b){return c._processRawNode(a,f,b)}// Process each child, passing index
12
19
  )}else// For a single child, no index is passed; existing key logic in _processRawNode will apply
13
20
  k=this._processRawNode(e,f);// 3. Construct final this.props
14
- this.props=_objectSpread(_objectSpread({},j),{},{style:i,nodeTheme:f,children:k})}/**
21
+ this.props=_objectSpread(_objectSpread({},j),{},{style:i,nodeTheme:f,children:k// Assign processed children
22
+ })}/**
15
23
  * Resolves style properties by replacing theme path placeholders with actual theme values.
16
24
  * Handles complex strings like '1px solid theme.background.primary' and iterative resolution.
17
25
  * @param initialCssProps The initial CSS properties object.
18
26
  * @param theme The theme object to use for resolving paths.
19
27
  * @returns A new CSSProperties object with theme values resolved.
20
- */return _createClass(BaseNode,[{key:"_resolveStyleWithTheme",value:function _resolveStyleWithTheme(a,b){// If no theme is provided or there are no initial CSS props to process, return the initial props.
21
- if(!b||0===Object.keys(a).length)return a;var c=_objectSpread({},a);// Create a mutable copy
22
- for(var d in c)if(Object.prototype.hasOwnProperty.call(c,d)){var e=c[d];if("string"==typeof e&&e.includes("theme.")){var f=e;// Iteratively resolve theme references within the string
23
- f=f.replace(/theme\.([a-zA-Z0-9_.-]+)/g,function(a,c){var d=getValueByPath(b,c);// Use 'theme' passed to the function
24
- // Replace if themeValue is found and is a string or number.
28
+ */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.
29
+ 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
30
+ 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
31
+ h=h.replace(/theme\.([a-zA-Z0-9_.-]+)/g,function(a,b){var c=getValueByPath(d,b);// Use 'theme' passed to the function
32
+ // Replace it if themeValue is found and is a string or number.
25
33
  // null is explicitly excluded to avoid 'null' string in output unless intended.
26
- return void 0!==d&&null!==d&&("string"==typeof d||"number"==typeof d)?d+"":a;// If themeValue is not a string/number, or is undefined/null, keep the original placeholder
27
- }),c[d]=f}}return c}/**
34
+ 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
35
+ }),e[f]=h}}return e}/**
28
36
  * React component that renders the result of a function child, supporting theme propagation.
29
37
  *
30
38
  * This component is used to render children that are functions (i.e., `() => Children`).
@@ -37,11 +45,13 @@ return void 0!==d&&null!==d&&("string"==typeof d||"number"==typeof d)?d+"":a;//
37
45
  */},{key:"_functionRenderer",value:function _functionRenderer(a){var b=a.render,c=a.passedTheme,d=a.passedKey,e=a.processRawNode,f=b();// Call the user-provided render function to get the child.
38
46
  if(f instanceof React.Component){var g=f.render(),h=e(g,c);return h instanceof BaseNode?h.render():h}if(f instanceof BaseNode){var i,j=f;// If the returned BaseNode does not have its own theme, but a theme is provided,
39
47
  // re-create the node with the provided theme to ensure correct theme propagation.
40
- return void 0===(null===(i=j.rawProps)||void 0===i?void 0:i.nodeTheme)&&void 0!==c?new BaseNode(j.element,_objectSpread(_objectSpread({},j.rawProps||{}),{},{nodeTheme:c,theme:c,// Also pass theme for consistency if it was used in rawProps
48
+ 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
41
49
  key:d})).render():j.render();// If the node already has a theme or no theme is provided, render as-is.
42
- }var k=e(f,c);return k instanceof BaseNode?k.render():f;// If the result is not a BaseNode (e.g., JSX, string, etc.), return it directly.
50
+ }// Process the result if it's not a React.Component or BaseNode
51
+ 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
52
+ })).render()}return k.render()}// If the result is not a BaseNode (e.g., JSX, string, etc.), return it directly.
43
53
  // Note: Non-BaseNode results will not automatically receive the theme.
44
- }/**
54
+ return f}/**
45
55
  * Processes a single raw child element, converting it into a ProcessedChild.
46
56
  * If the child is part of an array and lacks an explicit key, a stable indexed key
47
57
  * (`elementName_child_index`) is generated for new BaseNode instances.
@@ -50,58 +60,98 @@ key:d})).render():j.render();// If the node already has a theme or no theme is p
50
60
  * @param childIndex Optional index of the child if it's part of an array.
51
61
  * @returns The processed child.
52
62
  */},{key:"_processRawNode",value:function _processRawNode(a,b,c// Index for generating stable keys for array children
53
- ){var d=getComponentType(a),e=function generateIndexedKeyIfNeeded(a,b){if(b!==void 0&&null!==b)return b;if(void 0!==c){var d=getElementTypeName(a);return"".concat(d,"-").concat(c)}// No explicit key, and not an array child, so BaseNode constructor will handle.
54
- };// Helper to generate an indexed key if no explicit key is present and an index is available.
63
+ ){var d=getComponentType(a),e=function generateIndexedKeyIfNeeded(a,b){if(b!==void 0&&null!==b)return b;if(void 0!==c){var d=getElementTypeName(a);// Get element type name for key generation
64
+ return"".concat(d,"-").concat(c)}// No explicit key, and not an array child, so BaseNode constructor will handle.
65
+ };// Determine the type of the raw node
66
+ // Helper to generate an indexed key if no explicit key is present and an index is available.
55
67
  // Case 1: Child is already a BaseNode instance
56
- if(a instanceof BaseNode){var f=a,g=f.rawProps||{},h=g.nodeTheme,i=e(f.element,g.key);// Prefer child's own theme
57
- return new BaseNode(f.element,_objectSpread(_objectSpread({},g),{},{nodeTheme:h||b||{},key:i}))}// Case 2: Child is a primitive (string, number, boolean, null, undefined)
68
+ if(a instanceof BaseNode){var f=a,g=f.rawProps||{},h=g.nodeTheme,i=e(f.element,g.key);// Get initial raw props of the child
69
+ // Get the child's own theme
70
+ // Prefer child's own theme
71
+ return new BaseNode(f.element,_objectSpread(_objectSpread({},g),{},{nodeTheme:h||b||{},// Use the determined theme for the new node
72
+ key:i}));// Create a new BaseNode with merged props and theme
73
+ }// Case 2: Child is a primitive (string, number, boolean, null, undefined)
58
74
  if("string"===d||"number"===d||"boolean"===d||null===a||void 0===a)return a;// Case 3: Child is a function that needs to be called during render (FunctionRenderer).
59
75
  if("function"===d&&!isReactClassComponent(a)&&!isMemo(a)&&!isForwardRef(a)){// The key is for the BaseNode that wraps the _functionRenderer component.
60
76
  // Functions themselves don't have a .key prop that we can access here.
61
- var j=e(this._functionRenderer,void 0);return new BaseNode(this._functionRenderer,{processRawNode:this._processRawNode.bind(this),render:a,passedTheme:b,key:j})}// Case 4: Child is a React Element (JSX element like <div> or <MyComponent>)
77
+ var j=e(this._functionRenderer,void 0);// Generate key for function renderer
78
+ return new BaseNode(this._functionRenderer,{processRawNode:this._processRawNode.bind(this),render:a,passedTheme:b,key:j// Assign the generated key
79
+ })}// Case 4: Child is a React Element (JSX element like <div> or <MyComponent>)
62
80
  if(isValidElement(a)){var k,l=_objectSpread({},a.props);// Extract and merge props from the JSX element, flattening style props
63
- l=_objectSpread(_objectSpread({},l.style),l),delete l.style;// Remove original style object after merging
64
- // Handle theme by preferring nodeTheme from child's props, falling back to parent theme if not set
65
- var m=(null===(k=l)||void 0===k?void 0:k.nodeTheme)||b,n=e(a.type,a.key);// For array children without keys, generate stable key from element type and index
66
- // Create new BaseNode instance with processed props and theme
67
- return new BaseNode(a.type,_objectSpread(_objectSpread({},l),{},{nodeTheme:m,key:n}))}// Case 5: Child is an ElementType (string tag, class component, Memo/ForwardRef)
81
+ l=_objectSpread(_objectSpread({},l.style),l),delete l.style;// Remove the original style object after merging
82
+ // Handle theme: prefer nodeTheme from child's props, fallback to the parent theme
83
+ var m=(null===(k=l)||void 0===k?void 0:k.nodeTheme)||b,n=e(a.type,a.key);// For array children without keys, generate a stable key from element type and index
84
+ // Create a new BaseNode instance with processed props and theme
85
+ return new BaseNode(a.type,_objectSpread(_objectSpread({},l),{},{nodeTheme:m,key:n// Assign the generated key
86
+ }))}// Case 5: Child is an ElementType (string tag, class component, Memo/ForwardRef)
68
87
  if(isReactClassComponent(a)||"object"===d&&(isMemo(a)||isForwardRef(a))){// ElementTypes don't have an intrinsic key from the rawNode itself.
69
- var o=e(a,void 0);return new BaseNode(a,{nodeTheme:b,key:o})}// Case 6: Handle instances of React.Component
70
- if(a instanceof React.Component){var p=a.render();// Recursively process the rendered element with parent theme and index
88
+ var o=e(a,void 0);return new BaseNode(a,{nodeTheme:b,// Apply parent theme
89
+ key:o})}// Case 6: Handle instances of React.Component
90
+ if(a instanceof React.Component){var p=a.render();// Recursively process the rendered element with a parent theme and index if available
71
91
  return this._processRawNode(p,b,c)}// Case 7: Fallback for other ReactNode types (e.g., Fragments, Portals if not caught by isValidElement)
72
92
  // These are returned as-is. If they are elements within an array, React expects them to have keys.
73
- // This logic primarily adds keys to BaseNode instances we create.
93
+ // This logic primarily adds keys to BaseNode instances we create, other ReactNodes are returned as-is.
74
94
  return a}/**
95
+ * Normalizes a child node into a renderable ReactNode.
96
+ * Processes different types of child nodes to ensure they can be properly rendered
97
+ * while maintaining theme inheritance.
98
+ *
99
+ * Handles:
100
+ * - BaseNode instances (applies theme if needed)
101
+ * - React.Component instances (applies theme if needed)
102
+ * - Other valid React element types (returned as-is)
103
+ * - null/undefined values (returned as-is)
104
+ * @param child The child node to normalize into a renderable form
105
+ * @returns The normalized ReactNode that can be rendered by React
106
+ * @throws Error if child is an invalid element type
107
+ */},{key:"render",value:/**
75
108
  * Converts this BaseNode instance into a renderable React node.
76
109
  * Recursively processes child nodes and uses `React.createElement` to construct the final React element.
77
110
  * @returns A ReactNode representing the rendered element.
78
- */},{key:"render",value:function render(){if(!isValidElementType(this.element))throw new Error("Invalid element type: ".concat(this.element," provided!"));var a=this.props,b=a.children,c=a.key,d=_objectWithoutProperties(a,_excluded2),e=function normalizeChild(a){// Changed NodeElement to ProcessedChild for accuracy
79
- return a instanceof BaseNode||"object"===_typeof(a)&&null!==a&&"render"in a?a.render():a;// Primitives, other ReactNodes
80
- },f=void 0;// More accurate type
81
- if(void 0!==b&&null!==b)if(!Array.isArray(b))f=e(b);else if(0<b.length){var g=b.map(e);// Check if all children are null/undefined (e.g. conditional rendering resulted in nothing)
111
+ */function render(){if(!isValidElementType(this.element)){var a=getComponentType(this.element);throw new Error("Invalid element type: ".concat(a," provided!"))}var b=this.props,c=b.children,d=b.key,e=_objectWithoutProperties(b,_excluded2),f=void 0;// Extract children and key
112
+ // More accurate type
113
+ if(void 0!==c&&null!==c)if(!Array.isArray(c))f=this._normalizeChild(c);else if(0<c.length){var g=c.map(this._normalizeChild);// Normalize each child in the array
114
+ // Check if all children are null/undefined (e.g., conditional rendering resulted in nothing)
82
115
  f=g.every(function(a){return null===a||void 0===a})?void 0:g}else f=void 0;// Prepare props for React.createElement
83
- var h=_objectSpread(_objectSpread({},d),{},{// Cast otherProps
84
- key:c// This is the key of the current BaseNode itself
85
- });// Delete key `nodeTheme` as it's not a valid DOM/React prop for the element
116
+ var h=_objectSpread(_objectSpread({},e),{},{// Cast otherProps
117
+ key:d// This is the key of the current BaseNode itself
118
+ });// Prepare props for React.createElement
119
+ // Delete the key `nodeTheme` as it's not a valid DOM/React prop for the element
86
120
  return delete h.nodeTheme,createElement(this.element,h,f)}}])}();/**
87
121
  * Factory function to create a BaseNode instance.
88
122
  * @param element The React element type.
89
123
  * @param props The props for the node.
90
124
  * @returns BaseNodeInstance<E> - A new BaseNode instance.
91
125
  */export function Node(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c=_objectSpread({},b);// Ensure we are working with a mutable copy
92
- // 'theme' prop itself is not directly used by BaseNode after this, nodeTheme is.
126
+ // 'theme' prop itself is not directly used by BaseNode after this, nodeTheme is used.
93
127
  // We can keep `theme` in rawProps if needed for cloning or inspection.
94
128
  return c.theme&&void 0===c.nodeTheme&&(c.nodeTheme=c.theme),new BaseNode(a,c)}/**
95
129
  * Higher-order component wrapper that converts BaseNode components into React components.
130
+ * This wrapper ensures proper theme propagation and component rendering in the React ecosystem.
96
131
  *
97
- * This function takes a component function that may return either a BaseNode instance
98
- * or a ReactNode, and wraps it to ensure the output is always a renderable ReactNode.
99
- * BaseNode instances are automatically converted using render().
100
- * @template T - The type of props accepted by the component
101
- * @param component The component function that returns either a BaseNode or ReactNode
102
- * @returns A React function component that takes the same props and returns a ReactNode
132
+ * Key features:
133
+ * - Converts BaseNode instances to React elements via render()
134
+ * - Handles theme inheritance and merging
135
+ * - Preserves component props
136
+ * - Type-safe with generic prop types
137
+ * @template T - The props type for the wrapped component
138
+ * @param component Component function that returns a BaseNode or ReactNode
139
+ * @returns A React function component that handles BaseNode conversion and theme propagation
103
140
  * @example
104
- * const MyComponent = Component((props) => {
105
- * return Node('div', { ...props })
141
+ * ```ts
142
+ * // Basic usage
143
+ * const Button = Component((props) => {
144
+ * return Node('button', {
145
+ * ...props,
146
+ * theme: { color: 'blue' }
147
+ * })
106
148
  * })
107
- */export function Component(a){return function(b){var d=a(b);return d instanceof BaseNode?d.render():d}}
149
+ * ```
150
+ */export function Component(a){// Create a wrapper component that handles theme and rendering
151
+ return function(){var b=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},c=a(_objectSpread({},b));// Execute wrapped component
152
+ // Handle BaseNode results - requires special processing
153
+ if(c instanceof BaseNode){var d,e;// Theme merging: Check if we need to handle theme inheritance
154
+ 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
155
+ 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
156
+ }// Direct return for non-BaseNode results (standard React nodes)
157
+ return c}}
@@ -1,5 +1,5 @@
1
- import type { Attributes as ReactAttributes, ComponentProps, CSSProperties, ReactNode, JSX, ElementType, ComponentType, JSXElementConstructor, ReactInstance } from 'react';
2
- export type NodeElement = ReactNode | ReactInstance | ElementType | ComponentType<any> | BaseNodeInstance<any> | ((props?: any) => ReactNode | Promise<ReactNode> | ReactInstance | BaseNodeInstance<any>);
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>);
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 | ReactInstance | ElementType | ComponentTyp
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 | ReactInstance | NodeElement | BaseNodeInstance<any>;
10
+ export type Children = ReactNode | Component<any> | NodeElement | BaseNodeInstance<any>;
11
11
  /**
12
12
  * Forward declaration of the BaseNode interface to avoid circular dependencies.
13
13
  * Defines the core structure and capabilities of a BaseNode instance.
@@ -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,aAAa,EACd,MAAM,OAAO,CAAA;AAEd,MAAM,MAAM,WAAW,GACnB,SAAS,GACT,aAAa,GACb,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,aAAa,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAA;AAE7F;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAA;AAEtF;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW;IACnE,gFAAgF;IAChF,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;IAEnB,uFAAuF;IACvF,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;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AC,CAAC,CAAA;CACrG"}
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.12",
4
+ "version": "0.1.14",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "types": "./dist/main.d.ts",