@meonode/ui 0.2.5 → 0.2.7

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/CHANGELOG.md CHANGED
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.2.7] - 2025-09-04
9
+
10
+ ### Changed
11
+
12
+ - **core.node**: rename `childIndex` to `nodeIndex` and update key generation logic
13
+
14
+ ## [0.2.6] - 2025-09-04
15
+
16
+ - **deps**: update TypeScript ESLint, native-preview, and jsdoc to latest versions
17
+ - **core.node**: improve generateIndexedKeyIfNeeded to accept object parameters and enhance key uniqueness with children count
18
+ - **imports**: update import paths to include file extensions for compatibility
19
+
8
20
  ## [0.2.5] - 2025-09-03
9
21
 
10
22
  - **imports**: Update import paths to include file extensions for compatibility.
@@ -1,5 +1,5 @@
1
1
  import { type ElementType, type ReactNode, type ReactElement } from 'react';
2
- import type { FinalNodeProps, HasRequiredProps, NodeElement, NodeInstance, NodeProps, PropsOf, RawNodeProps, Theme } from './node.type';
2
+ import type { FinalNodeProps, HasRequiredProps, NodeElement, NodeInstance, NodeProps, PropsOf, RawNodeProps, Theme } from './node.type.js';
3
3
  import { type Root as ReactDOMRoot } from 'react-dom/client';
4
4
  /**
5
5
  * Represents a node in a React component tree with theme and styling capabilities.
@@ -70,10 +70,10 @@ export declare class BaseNode<E extends NodeElement> implements NodeInstance<E>
70
70
  * (`elementName_child_index`) is generated for new BaseNode instances.
71
71
  * @param rawNode The raw child element to process.
72
72
  * @param parentTheme The theme inherited from the parent node.
73
- * @param childIndex Optional index of the child if it's part of an array.
73
+ * @param nodeIndex Optional index of the child if it's part of an array.
74
74
  * @returns The processed child.
75
75
  */
76
- _processRawNode(rawNode: NodeElement, parentTheme?: Theme, childIndex?: number): NodeElement;
76
+ _processRawNode(rawNode: NodeElement, parentTheme?: Theme, nodeIndex?: number): NodeElement;
77
77
  /**
78
78
  * Normalizes a child node into a renderable ReactNode.
79
79
  * Processes different types of child nodes to ensure they can be properly rendered
@@ -1 +1 @@
1
- {"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../src/core.node.ts"],"names":[],"mappings":"AACA,OAAc,EAAgD,KAAK,WAAW,EAA4B,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAA;AAC1J,OAAO,KAAK,EACV,cAAc,EAEd,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,OAAO,EACP,YAAY,EACZ,KAAK,EACN,MAAM,gBAAgB,CAAA;AAGvB,OAAO,EAAc,KAAK,IAAI,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAKxE;;;;;;;;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,EAAE,YAAY,CAAC,CAAC,CAAC,CAAK;IAErC,wFAAwF;IACjF,KAAK,EAAE,cAAc,CAAA;IAE5B,0CAA0C;IAC1C,SAAgB,UAAU,UAAO;IAEjC,4CAA4C;IAC5C,OAAO,CAAC,iBAAiB,CAA8B;IAEvD,+CAA+C;IAC/C,OAAO,CAAC,gBAAgB,CAA4B;IAEpD;;;;;;;;OAQG;IACH,YAAY,OAAO,EAAE,CAAC,EAAE,QAAQ,GAAE,YAAY,CAAC,CAAC,CAAM,EAsCrD;IAED,OAAO,CAAC,gBAAgB;IAYxB;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,oBAAoB,CAAC,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAsCnI;IAED;;;;;;;;;;;;OAY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AS,WAAW,EAC/G,OAAO,EAAE,CAAC,EACV,YAAY,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,sBAAsB,EAAE,UAAU,CAAC,GACrE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GACxC,CAAC,CAAC,eAAe,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACjE,QAAQ,EAAE,WAAW,GAAG,WAAW,EAAE,EACrC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,eAAe,EAAE,UAAU,CAAC,KACpD,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,GACtC,CAAC,CAAC,eAAe,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACjE,QAAQ,CAAC,EAAE,WAAW,GAAG,WAAW,EAAE,EACtC,KAAK,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,eAAe,EAAE,UAAU,CAAC,KACrD,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,CAQzC"}
package/dist/core.node.js CHANGED
@@ -62,32 +62,31 @@ var k=e(f,c);return k?BaseNode._renderProcessedNode(k,c,d):f}/**
62
62
  * (`elementName_child_index`) is generated for new BaseNode instances.
63
63
  * @param rawNode The raw child element to process.
64
64
  * @param parentTheme The theme inherited from the parent node.
65
- * @param childIndex Optional index of the child if it's part of an array.
65
+ * @param nodeIndex Optional index of the child if it's part of an array.
66
66
  * @returns The processed child.
67
67
  */_processRawNode(a,b,c// Index for generating stable keys for array children
68
- ){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
69
- return"".concat(d,"-").concat(c)}// No explicit key, and not an array child, so BaseNode constructor will handle.
70
- };// Determine the type of the raw node
68
+ ){var d=getComponentType(a),e=function generateKey(a){var b=a.element,d=a.existingKey,e=a.children;if(d)return d;var f=getElementTypeName(b);return Array.isArray(e)&&0<e.length?void 0===c?"".concat(f,"-").concat(e.length):"".concat(f,"-").concat(c,"-").concat(e.length):void 0===c?f:"".concat(f,"-").concat(c)};// Determine the type of the raw node
71
69
  // Helper to generate an indexed key if no explicit key is present and an index is available.
72
70
  // Case 1: Child is already a BaseNode instance
73
- if(a instanceof BaseNode){var f=a,g=f.rawProps||{},h=g.theme||g.nodetheme||b,i=e(f.element,g.key);// Get initial raw props of the child
71
+ if(a instanceof BaseNode){var f=a,g=f.rawProps||{},h=g.theme||g.nodetheme||b,i=e({element:f.element,existingKey:g.key,children:g.children});// Get initial raw props of the child
74
72
  // Prefer child's own theme
73
+ // Generate key if needed
75
74
  return new BaseNode(f.element,_objectSpread(_objectSpread({},g),{},{nodetheme:h,// Use the determined theme for the new node
76
75
  key:i}));// Create a new BaseNode with merged props and theme
77
76
  }// Case 2: Child is a primitive (string, number, boolean, null, undefined)
78
77
  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).
79
78
  if("function"===d&&!isReactClassComponent(a)&&!isMemo(a)&&!isForwardRef(a)){// The key is for the BaseNode that wraps the _functionRenderer component.
80
79
  // Functions themselves don't have a .key prop that we can access here.
81
- var j=e(this._functionRenderer,void 0);// Generate key for function renderer
80
+ var j=e({element:this._functionRenderer});// Generate key for function renderer
82
81
  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>)
83
- if(isValidElement(a)){var k=a.props,l=k.style,m=_objectWithoutProperties(k,_excluded4),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
82
+ if(isValidElement(a)){var k=a.props,l=k.style,m=_objectWithoutProperties(k,_excluded4),n=_objectSpread(_objectSpread({},m),l||{}),o=n.theme||n.nodetheme||b,p=e({element:a.type,existingKey:a.key,children:n.children});// Combine top-level props from the element with its flattened style object properties
84
83
  return new BaseNode(a.type,_objectSpread(_objectSpread({},n),{},{// Pass the combined props
85
84
  nodetheme:o,key:p}))}// Case 5: Child is an ElementType (string tag, class component, Memo/ForwardRef)
86
- if(isReactClassComponent(a)||"object"===d&&(isMemo(a)||isForwardRef(a))){// ElementTypes don't have an intrinsic key from the rawNode itself.
87
- var q=e(a,void 0);return new BaseNode(a,{nodetheme:b,// Apply parent theme
88
- key:q})}// Case 6: Handle instances of React.Component
89
- if(a instanceof React.Component){var r=a.render();// Recursively process the rendered element with a parent theme and index if available
90
- return this._processRawNode(r,b,c)}// Case 7: Fallback for other ReactNode types (e.g., Fragments, Portals if not caught by isValidElement)
85
+ if(isReactClassComponent(a)||"object"===d&&(isMemo(a)||isForwardRef(a))){var q,r=e({element:a,children:"object"===_typeof(a)&&"props"in a?null===(q=a.props)||void 0===q?void 0:q.children:void 0});// ElementTypes don't have an intrinsic key from the rawNode itself.
86
+ return new BaseNode(a,{nodetheme:b,// Apply parent theme
87
+ key:r})}// Case 6: Handle instances of React.Component
88
+ if(a instanceof React.Component){var s=a.render();// Recursively process the rendered element with a parent theme and index if available
89
+ return this._processRawNode(s,b,c)}// Case 7: Fallback for other ReactNode types (e.g., Fragments, Portals if not caught by isValidElement)
91
90
  // These are returned as-is. If they are elements within an array, React expects them to have keys.
92
91
  // This logic primarily adds keys to BaseNode instances we create, other ReactNodes are returned as-is.
93
92
  return a}/**
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.2.5",
4
+ "version": "0.2.7",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "types": "./dist/main.d.ts",
@@ -43,13 +43,13 @@
43
43
  "@eslint/js": "^9.34.0",
44
44
  "@types/react": "^19.1.12",
45
45
  "@types/react-dom": "^19.1.9",
46
- "@typescript-eslint/eslint-plugin": "^8.41.0",
47
- "@typescript-eslint/parser": "^8.41.0",
48
- "@typescript/native-preview": "^7.0.0-dev.20250827.1",
46
+ "@typescript-eslint/eslint-plugin": "^8.42.0",
47
+ "@typescript-eslint/parser": "^8.42.0",
48
+ "@typescript/native-preview": "^7.0.0-dev.20250903.1",
49
49
  "babel-plugin-module-resolver": "^5.0.2",
50
50
  "babel-preset-minify": "^0.5.2",
51
51
  "eslint": "^9.34.0",
52
- "eslint-plugin-jsdoc": "^54.1.1",
52
+ "eslint-plugin-jsdoc": "^54.3.1",
53
53
  "eslint-plugin-prettier": "^5.5.4",
54
54
  "eslint-plugin-unused-imports": "^4.2.0",
55
55
  "next": "^15.5.2",
@@ -57,7 +57,7 @@
57
57
  "react-dom": "^19.1.1",
58
58
  "tsc-alias": "^1.8.16",
59
59
  "typescript": "^5.9.2",
60
- "typescript-eslint": "^8.41.0"
60
+ "typescript-eslint": "^8.42.0"
61
61
  },
62
62
  "packageManager": "yarn@4.9.1",
63
63
  "peerDependencies": {