@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+"");//
|
|
119
|
-
if(
|
|
120
|
-
if(
|
|
121
|
-
|
|
122
|
-
|
|
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
|
|
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
|
-
*
|
|
12
|
-
*
|
|
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":"
|
|
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
|
|
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
|
|
7
|
-
if(null===a||
|
|
8
|
-
if(
|
|
9
|
-
if(a
|
|
10
|
-
if(
|
|
11
|
-
if(
|
|
12
|
-
|
|
13
|
-
if(
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
try{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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.
|
|
4
|
+
"version": "0.2.20",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/main.js",
|
|
7
7
|
"types": "./dist/main.d.ts",
|