@meonode/ui 0.1.31 → 0.1.33

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 +1 @@
1
- {"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../src/core.node.ts"],"names":[],"mappings":"AACA,OAAO,KAAyG,MAAM,OAAO,CAAA;AAC7H,OAAO,KAAK,EACV,aAAa,EAGb,WAAW,EACX,YAAY,EACZ,SAAS,EACT,cAAc,EACd,gCAAgC,EAChC,WAAW,EAGZ,MAAM,mBAAmB,CAAA;AA0e1B;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,WAAW,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,GAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAU1G;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACrD,SAAS,EAAE,CACT,KAAK,EAAE,CAAC,GAAG;IACT,QAAQ,CAAC,EAAE,WAAW,CAAA;CACvB,KACE,aAAa,IAkBV,QAAO,GAAQ,qBACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,MAAM,CAAC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1D,SAAS,EAAE,YAAY,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,EAAE,EAClD,SAAS,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,SAAS,CAAC,KAAK,aAAa,GAC1D,gCAAgC,CAAC,SAAS,CAAC,CAAA;AAC9C,wBAAgB,MAAM,CAAC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,SAAS,CAAC,KAAK,aAA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=c.children,e=c.nodetheme,f=c.theme,g=_objectWithoutProperties(c,_excluded)
24
24
  // Extract remaining props that are valid DOM attributes
25
25
  // Process children while maintaining theme inheritance
26
26
  // Combine processed props into final normalized form
27
- d&&(Array.isArray(d)?l=d.map(function(a,c){return b._processRawNode(a,h,c)}):l=this._processRawNode(d,h)),this.props=_objectSpread(_objectSpread({},k),{},{style:j,nodetheme:h,theme:f,children:l})}// In class BaseNode
28
- /**
29
- * Resolves obj properties by replacing theme path placeholders with actual theme values.
30
- * Handles complex strings like '1px solid theme.background.primary' and nested objects.
31
- * This version includes detection for circular references to prevent infinite loops.
32
- * @param obj The initial obj properties object.
33
- * @param theme The theme object to use for resolving paths.
34
- * @returns A new CSSProperties object with theme values resolved.
35
- */return _createClass(BaseNode,[{key:"_resolveObjWithTheme",value:function _resolveObjWithTheme(a,b){var c;// Return early if no theme or empty object
36
- if(!b||0===Object.keys(a).length)return a;// Merge raw nodetheme with passed theme for resolution
37
- var d=_objectSpread(_objectSpread({},null===(c=this.rawProps)||void 0===c?void 0:c.nodetheme),b),e=function resolveRecursively(a,b){// Prevent infinite recursion by detecting cycles in the object graph
38
- // If this object was already processed in the current branch, return it as-is
39
- if(b.has(a))return a;// Track this object to detect future cycles
40
- b.add(a);var c={};// Process all enumerable properties of the current object
41
- for(var f in a)// Skip inherited properties from the prototype chain
42
- // This ensures we only process the object's own properties
43
- if(Object.prototype.hasOwnProperty.call(a,f)){var g=a[f];// Special handling for "private" properties that start with underscore
44
- // These are exempt from theme resolution to allow implementation details
45
- if(f.startsWith("_")){c[f]=g;continue}// Process string values that contain theme path references
46
- // Example: "1px solid theme.colors.border" -> "1px solid #ccc"
47
- if("string"==typeof g&&g.includes("theme.")){var h=g;// Find and replace all theme path references using regex
48
- h=h.replace(/theme\.([a-zA-Z0-9_.-]+)/g,function(a,b){var c=getValueByPath(d,b);// Only convert theme values that are strings or numbers
49
- // Other types are left as-is to maintain the reference format
50
- return void 0!==c&&null!==c&&("string"==typeof c||"number"==typeof c)?c+"":a;// Theme path not found - keep original reference
51
- // Could add warning: console.warn(`Theme path ${path} not found`)
52
- }),c[f]=h}// Recursively process nested objects, excluding arrays
53
- // This allows theme resolution in deeply nested structures
54
- else c[f]=g&&"object"===_typeof(g)&&!Array.isArray(g)?// Use same visited set to maintain cycle detection across the entire tree
55
- e(g,b):g}// Important: We added `currentObj` to `visited` at the start of this function call.
56
- // For cycle detection within a single top-level `_resolveObjWithTheme` call,
57
- // we don't remove it here. The `visited` set is fresh for each top-level call.
58
- // If `visited` was a longer-lived cache across multiple calls, cleanup logic might be needed.
59
- return c};/**
60
- * Recursively resolves theme values in an object by traversing its properties and replacing theme path references.
61
- *
62
- * This function handles:
63
- * - Theme path resolution (e.g. 'theme.colors.primary' -> '#ff0000')
64
- * - Nested object traversal with cycle detection
65
- * - Type preservation for non-theme values
66
- * - Special case handling for private props (starting with '_')
67
- * @param currentObj The current object being processed in the recursion
68
- * @param visited Set tracking visited objects to prevent infinite loops from circular references
69
- * @returns A new object with all theme path references resolved to actual values
70
- */// Initial call to the recursive function with a new Set to track visited objects for this resolution.
71
- return e(a,new Set)}/**
27
+ d&&(Array.isArray(d)?l=d.map(function(a,c){return b._processRawNode(a,h,c)}):l=this._processRawNode(d,h)),this.props=_objectSpread(_objectSpread({},k),{},{style:j,nodetheme:h,theme:f,children:l})}/**
28
+ * Resolves theme variable references in an object's values recursively.
29
+ * Handles nested objects and prevents circular references.
30
+ * Theme variables are referenced using the format "theme.path.to.value".
31
+ * @param obj The object whose values should be resolved against the theme
32
+ * @param theme Optional theme object containing variable definitions
33
+ * @returns A new object with all theme variables resolved to their values
34
+ */return _createClass(BaseNode,[{key:"_resolveObjWithTheme",value:function _resolveObjWithTheme(a,b){var c;// Early return if no theme or empty object
35
+ if(!b||0===Object.keys(a).length)return a;// Merge parent theme with current theme
36
+ var d=_objectSpread(_objectSpread({},null===(c=this.rawProps)||void 0===c?void 0:c.nodetheme),b),e=function resolveRecursively(a,b){// Prevent processing same object multiple times
37
+ if(b.has(a))return a;// Track this object to detect circular references
38
+ b.add(a);var c={};for(var f in a)// Skip non-own properties
39
+ if(Object.prototype.hasOwnProperty.call(a,f)){var g=a[f];// Skip private props (starting with _)
40
+ if(f.startsWith("_")){c[f]=g;continue}// Resolve theme variables in string values
41
+ if("string"==typeof g&&g.includes("theme.")){var h=g;h=h.replace(/theme\.([a-zA-Z0-9_.-]+)/g,function(a,b){var c=getValueByPath(d,b);// Only convert string/number theme values
42
+ return void 0!==c&&null!==c&&"object"!==_typeof(c)?c:a;// Keep original if no valid theme value found
43
+ }),c[f]=h}// Recursively process nested objects
44
+ else c[f]=g&&"object"===_typeof(g)&&!Array.isArray(g)?e(g,b):g}return c};/**
45
+ * Recursively resolves theme variables in an object, tracking visited objects
46
+ * to prevent infinite recursion with circular references.
47
+ */return e(a,new Set)}/**
72
48
  * React component that renders the result of a function child, supporting theme propagation.
73
49
  *
74
50
  * This component is used to render children that are functions (i.e., `() => Children`).