@meonode/ui 0.2.19 → 0.2.20

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,17 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachachangelog.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.20] - 2025-09-22
9
+
10
+ ### Refactor
11
+
12
+ - **refactor(obj.helper)**: streamline serialization logic and improve performance
13
+
14
+ ### Fixed
15
+
16
+ - **fix(eslint)**: enforce no-unsafe-function-type rule for better type safety
17
+ - **fix(node.helper.ts)**: update nodeSignature function to accept Children type and improve circular reference handling
18
+
8
19
  ## [0.2.19] - 2025-09-21
9
20
 
10
21
  ### Refactor
@@ -1 +1 @@
1
- {"version":3,"file":"node.helper.d.ts","sourceRoot":"","sources":["../../src/helper/node.helper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAItE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,4CAS1B,CAAA;AA4DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiE/B,CAAA;AA8FD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAE,KAAK,UAIjE"}
@@ -115,11 +115,12 @@ minWidth:0},d)};/**
115
115
  * - element type (string or component name)
116
116
  * - key (if present)
117
117
  * - basic children shape (recursing within limits)
118
- */function nodeSignature(a){var b=Math.min,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:5,d=2<arguments.length&&void 0!==arguments[2]?arguments[2]:6,e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:new WeakSet;if(null===a)return"null";if(void 0===a)return"undefined";var f=_typeof(a);if("string"===f)return"s:".concat(a);if("number"===f)return"n:".concat(a+"");if("boolean"===f)return"b:".concat(a+"");if("function"===f)return"\u0192:(".concat(a+"",")");if("symbol"===f)return"sym:".concat(a+"");// Arrays
119
- if(Array.isArray(a)){if(0>=c)return"ary[...]";for(var g=[],h=b(a.length,d),j=0;j<h;j++)g.push(nodeSignature(a[j],c-1,d,e));return a.length>d&&g.push("...len:".concat(a.length)),"ary[".concat(g.join(","),"]")}// React element-ish: detect common shapes (type + props)
120
- if("object"===f&&(Object.prototype.hasOwnProperty.call(a,"type")||Object.prototype.hasOwnProperty.call(a,"props"))){var l,m,n,o=null!==(l=a.type)&&void 0!==l?l:a;// Type can be string (div) or function/class. Use helper to get name.
121
- try{n=getElementTypeName(o)}catch(a){try{n=o+""}catch(a){n="unknown"}}var p,q="key"in a&&void 0!==a.key&&null!==a.key?"#".concat(a.key+""):"",r="props"in a&&"object"===_typeof(a.props)?null!==(m=a.props)&&void 0!==m?m:{}:{};try{p=nodeSignature(r.children,c-1,d,e)}catch(a){p="<err>"}var s=r&&"object"===_typeof(r)&&"id"in r&&r.id?"@id:".concat(r.id+""):"",t=r&&"object"===_typeof(r)&&"className"in r&&r.className?"@class:".concat(r.className+""):"";return"el:".concat(n).concat(q).concat(s).concat(t,"{").concat(p,"}")}// Plain object
122
- if("object"===f&&a&&"object"===_typeof(a)&&!("type"in a)&&!("props"in a)){if(e.has(a))return"[Circular]";if(e.add(a),0>=c)return"obj[...]";for(var u,v=Object.keys(a).sort(),w=[],x=b(v.length,d),y=0;y<x;y++){u=v[y];try{w.push("".concat(u,":").concat(nodeSignature(a[u],c-1,d,e)))}catch(a){w.push("".concat(u,":<err>"))}}return v.length>d&&w.push("...keys:".concat(v.length)),"obj{".concat(w.join(","),"}")}// Fallback
118
+ */function nodeSignature(a){var b=Math.min,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:5,d=2<arguments.length&&void 0!==arguments[2]?arguments[2]:6,e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:new WeakSet;if(null===a)return"null";if(void 0===a)return"undefined";var f=_typeof(a);if("string"===f)return"s:".concat(a);if("number"===f)return"n:".concat(a+"");if("boolean"===f)return"b:".concat(a+"");if("function"===f)return"\u0192:(".concat(a+"",")");if("symbol"===f)return"sym:".concat(a+"");// Circular reference check for all objects
119
+ if("object"===f){if(e.has(a))return"[Circular]";e.add(a)}// Arrays
120
+ if(Array.isArray(a)){if(0>=c)return"ary[...]";for(var g=[],h=b(a.length,d),j=0;j<h;j++)g.push(nodeSignature(a[j],c-1,d,e));return a.length>d&&g.push("...len:".concat(a.length)),"ary[".concat(g.join(","),"]")}// React element-ish: require a 'type' property
121
+ if("object"===f&&a&&"type"in a){// Type can be string (div) or function/class. Use helper to get name.
122
+ var l,m=a.type;try{l=getElementTypeName(m)}catch(a){try{l=m+""}catch(a){l="unknown"}}var n,o="object"===f&&"key"in a&&null!=a.key?"#".concat(a.key+""):"",p="props"in a&&"object"===_typeof(a.props)&&a.props||{};try{n=nodeSignature(p.children,c-1,d,e)}catch(a){n="<err>"}var q=p.id?"@id:".concat(p.id+""):"",r=p.className?"@class:".concat(p.className+""):"";return"el:".concat(l).concat(o).concat(q).concat(r,"{").concat(n,"}")}// Plain object: handles any other object
123
+ if("object"===f&&a){if(0>=c)return"obj[...]";for(var s,t=Object.keys(a).sort(),u=[],v=b(t.length,d),w=0;w<v;w++){s=t[w];try{u.push("".concat(s,":").concat(nodeSignature(a[s],c-1,d,e)))}catch(a){u.push("".concat(s,":<err>"))}}return t.length>d&&u.push("...keys:".concat(t.length)),"obj{".concat(u.join(","),"}")}// Fallback
123
124
  try{return"o:".concat(a+"")}catch(a){return"o:<unserializable>"}}/**
124
125
  * Public: createStableHash
125
126
  * Produces a deterministic string signature for children + theme.
@@ -1,17 +1,16 @@
1
1
  export declare class ObjHelper {
2
2
  private constructor();
3
3
  /**
4
- * Build a deterministic, serializable representation of `value`.
5
- * - sorts plain object keys
4
+ * Build a serializable representation of `value`.
6
5
  * - preserves encoded placeholders for special types
7
6
  * - emits { $type: 'Circular', ref: id } for circular refs
8
7
  */
9
8
  private static buildSerializable;
10
9
  /**
11
- * Deterministic stringify: first build a canonical serializable structure
12
- * (with sorted object keys and encoded special types), then JSON.stringify it.
10
+ * Stringify with performance optimizations.
11
+ * @param obj Object to serialize
12
+ * @param space JSON.stringify space parameter
13
13
  */
14
14
  static stringify(obj: any, space?: number): string;
15
- static parse(str: string): any;
16
15
  }
17
16
  //# sourceMappingURL=obj.helper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"obj.helper.d.ts","sourceRoot":"","sources":["../../src/helper/obj.helper.ts"],"names":[],"mappings":"AAWA,qBAAa,SAAS;IACpB,OAAO,eAAiB;IAExB;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IA2FhC;;;OAGG;IACH,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,SAAI,GAAG,MAAM,CAO5C;IAED,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CA+C7B;CACF"}
1
+ {"version":3,"file":"obj.helper.d.ts","sourceRoot":"","sources":["../../src/helper/obj.helper.ts"],"names":[],"mappings":"AAOA,qBAAa,SAAS;IACpB,OAAO,eAAiB;IAExB;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAmGhC;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,SAAI,GAAG,MAAM,CAU5C;CACF"}
@@ -1,19 +1,23 @@
1
1
  function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(b,c){var d=null==b?null:"undefined"!=typeof Symbol&&b[Symbol.iterator]||b["@@iterator"];if(null!=d){var g,h,j,k,l=[],a=!0,m=!1;try{if(j=(d=d.call(b)).next,0===c){if(Object(d)!==d)return;a=!1}else for(;!(a=(g=j.call(d)).done)&&(l.push(g.value),l.length!==c);a=!0);}catch(a){m=!0,h=a}finally{try{if(!a&&null!=d["return"]&&(k=d["return"](),Object(k)!==k))return}finally{if(m)throw h}}return l}}function _arrayWithHoles(a){if(Array.isArray(a))return a}function _createForOfIteratorHelper(b,c){var d="undefined"!=typeof Symbol&&b[Symbol.iterator]||b["@@iterator"];if(!d){if(Array.isArray(b)||(d=_unsupportedIterableToArray(b))||c&&b&&"number"==typeof b.length){d&&(b=d);var e=0,f=function F(){};return{s:f,n:function n(){return e>=b.length?{done:!0}:{done:!1,value:b[e++]}},e:function e(a){throw a},f:f}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var g,h=!0,i=!1;return{s:function s(){d=d.call(b)},n:function n(){var a=d.next();return h=a.done,a},e:function e(a){i=!0,g=a},f:function f(){try{h||null==d["return"]||d["return"]()}finally{if(i)throw g}}}}function _unsupportedIterableToArray(b,c){if(b){if("string"==typeof b)return _arrayLikeToArray(b,c);var a={}.toString.call(b).slice(8,-1);return"Object"===a&&b.constructor&&(a=b.constructor.name),"Map"===a||"Set"===a?Array.from(b):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(b,c):void 0}}function _arrayLikeToArray(b,c){(null==c||c>b.length)&&(c=b.length);for(var d=0,f=Array(c);d<c;d++)f[d]=b[d];return f}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)}export class ObjHelper{constructor(){}/**
2
- * Build a deterministic, serializable representation of `value`.
3
- * - sorts plain object keys
2
+ * Build a serializable representation of `value`.
4
3
  * - preserves encoded placeholders for special types
5
4
  * - emits { $type: 'Circular', ref: id } for circular refs
6
- */static buildSerializable(a,b,c,d){// primitives & simple types
7
- if(null===a||a===void 0)return a;var e=_typeof(a);if("string"===e||"number"===e||"boolean"===e)return a;if("function"===e)return c.has(a)||c.set(a,d.nextFunctionId++),{$type:"Function",name:a.name||"",id:c.get(a)};if("symbol"===e){var f;return{$type:"Symbol",key:null!==(f=a.description)&&void 0!==f?f:""}}if("bigint"===e)return{$type:"BigInt",value:a.toString()};// Date
8
- if(a instanceof Date)return{$type:"Date",value:a.toISOString()};// RegExp
9
- if(a instanceof RegExp)return{$type:"RegExp",source:a.source,flags:a.flags};// Map
10
- if(a instanceof Map){var g,h=[],j=_createForOfIteratorHelper(a.entries());try{for(j.s();!(g=j.n()).done;){var l=_slicedToArray(g.value,2),m=l[0],n=l[1];h.push([ObjHelper.buildSerializable(m,b,c,d),ObjHelper.buildSerializable(n,b,c,d)])}}catch(a){j.e(a)}finally{j.f()}return{$type:"Map",entries:h}}// Set
11
- if(a instanceof Set){var o,p=[],q=_createForOfIteratorHelper(a.values());try{for(q.s();!(o=q.n()).done;){var r=o.value;p.push(ObjHelper.buildSerializable(r,b,c,d))}}catch(a){q.e(a)}finally{q.f()}return{$type:"Set",values:p}}// Objects and arrays
12
- if("object"===e){// Circular detection
13
- if(b.has(a))return{$type:"Circular",ref:b.get(a)};// assign id
14
- var s=d.nextObjId++;if(b.set(a,s),Array.isArray(a)){for(var t=[],u=0;u<a.length;u++)t.push(ObjHelper.buildSerializable(a[u],b,c,d));return t}// Plain object: sort keys for determinism
15
- var w,x=Object.keys(a).sort(),y={},z=_createForOfIteratorHelper(x);try{for(z.s();!(w=z.n()).done;){var A=w.value;try{y[A]=ObjHelper.buildSerializable(a[A],b,c,d)}catch(a){y[A]="<unserializable>"}}}catch(a){z.e(a)}finally{z.f()}return y}// Fallback: try to stringify
16
- try{return a+""}catch(a){return"<unserializable>"}}/**
17
- * Deterministic stringify: first build a canonical serializable structure
18
- * (with sorted object keys and encoded special types), then JSON.stringify it.
19
- */static stringify(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:2,c=new Map,d=new Map,e=ObjHelper.buildSerializable(a,c,d,{nextObjId:0,nextFunctionId:0});return JSON.stringify(e,null,b)}static parse(a){var b=[],c=function reviver(a,b){if(b&&"object"===_typeof(b)&&"$type"in b)switch(b.$type){case"Function":return function FunctionPlaceholder(){throw new Error("Function placeholder called: ".concat(b.name||"anonymous","#").concat(b.id))};case"Symbol":return Symbol(b.key);case"BigInt":return BigInt(b.value);case"Date":return new Date(b.value);case"RegExp":return new RegExp(b.source,b.flags);case"Map":return new Map(b.entries);case"Set":return new Set(b.values);case"Circular":return{$circularRef:b.ref}}return b},d=JSON.parse(a,c),e=function fixCirculars(a){if(a&&"object"===_typeof(a)){if(a.$circularRef!==void 0)return b[a.$circularRef];if(!b.includes(a)){b.push(a);for(var c,d=0,f=Object.keys(a);d<f.length;d++)c=f[d],a[c]=e(a[c])}}return a};return e(d)}}
5
+ */static buildSerializable(a,b){var c=this;// Fast path for primitives
6
+ if(null===a||void 0===a)return a;var d=_typeof(a);// Handle primitives first (most common case)
7
+ if("string"===d||"number"===d||"boolean"===d)return a;// Handle functions
8
+ if("function"===d){var e=b.functionIds.get(a);return void 0===e&&(e=b.nextFunctionId++,b.functionIds.set(a,e)),{$type:"Function",name:a.name||"",id:e}}// Handle other primitives
9
+ if("symbol"===d){var f;return{$type:"Symbol",key:null!==(f=a.description)&&void 0!==f?f:""}}if("bigint"===d)return{$type:"BigInt",value:a.toString()};// Only objects beyond this point
10
+ if("object"!==d)// Fallback for unknown types
11
+ try{return a+""}catch(a){return"<unserializable>"}// Handle built-in object types before circular check (they're less likely to be circular)
12
+ if(a instanceof Date)return{$type:"Date",value:a.toISOString()};if(a instanceof RegExp)return{$type:"RegExp",source:a.source,flags:a.flags};// Circular detection
13
+ var g=b.seen.get(a);if(void 0!==g)return{$type:"Circular",ref:g};// Assign ID and mark as seen
14
+ var h=b.nextObjId++;// Handle Map
15
+ if(b.seen.set(a,h),a instanceof Map){var i,j=[],l=_createForOfIteratorHelper(a.entries());try{for(l.s();!(i=l.n()).done;){var m=_slicedToArray(i.value,2),n=m[0],o=m[1];j.push([this.buildSerializable(n,b),this.buildSerializable(o,b)])}}catch(a){l.e(a)}finally{l.f()}return{$type:"Map",entries:j}}// Handle Set
16
+ if(a instanceof Set){var p,q=[],r=_createForOfIteratorHelper(a.values());try{for(r.s();!(p=r.n()).done;){var s=p.value;q.push(this.buildSerializable(s,b))}}catch(a){r.e(a)}finally{r.f()}return{$type:"Set",values:q}}// Handle Arrays
17
+ if(Array.isArray(a))// Use map for cleaner code and potential engine optimizations
18
+ return a.map(function(a){return c.buildSerializable(a,b)});// Handle plain objects
19
+ try{for(var t,u=Object.keys(a),w={},x=0,y=u;x<y.length;x++){t=y[x];try{w[t]=this.buildSerializable(a[t],b)}catch(a){w[t]="<unserializable>"}}return w}catch(a){return"<unserializable>"}}/**
20
+ * Stringify with performance optimizations.
21
+ * @param obj Object to serialize
22
+ * @param space JSON.stringify space parameter
23
+ */static stringify(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0,c={nextObjId:0,nextFunctionId:0,seen:new Map,functionIds:new Map},d=this.buildSerializable(a,c);return JSON.stringify(d,null,b)}}
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.19",
4
+ "version": "0.2.20",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "types": "./dist/main.d.ts",