@meonode/ui 0.4.10 → 0.4.12

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.
Files changed (159) hide show
  1. package/CHANGELOG.md +56 -2
  2. package/dist/cjs/client.js +1 -0
  3. package/dist/cjs/components/html.node.js +1 -0
  4. package/dist/cjs/components/meonode-unmounter.client.js +2 -0
  5. package/dist/cjs/components/react.node.js +1 -0
  6. package/dist/cjs/components/registry.client.js +2 -0
  7. package/dist/cjs/components/styled-renderer.client.js +2 -0
  8. package/dist/cjs/components/theme-provider.client.js +2 -0
  9. package/dist/cjs/components/theme-provider.js +1 -0
  10. package/dist/cjs/constant/common.const.js +1 -0
  11. package/dist/{constant → cjs/constant}/css-properties.const.js +1 -1
  12. package/dist/cjs/core.node.js +1 -0
  13. package/dist/cjs/helper/common.helper.js +1 -0
  14. package/dist/cjs/helper/obj.helper.js +1 -0
  15. package/dist/cjs/helper/react-is.helper.js +1 -0
  16. package/dist/cjs/hoc/component.hoc.js +1 -0
  17. package/dist/cjs/hoc/portal.hoc.js +1 -0
  18. package/dist/cjs/hook/usePortal.js +2 -0
  19. package/dist/cjs/hook/useTheme.js +2 -0
  20. package/dist/cjs/main.js +1 -0
  21. package/dist/cjs/nextjs-registry/index.js +1 -0
  22. package/dist/cjs/util/mount-tracker.util.js +1 -0
  23. package/dist/cjs/util/navigation-cache-manager.util.js +1 -0
  24. package/dist/cjs/util/node.util.js +1 -0
  25. package/dist/cjs/util/theme.util.js +1 -0
  26. package/dist/esm/client.d.ts.map +1 -0
  27. package/dist/esm/client.js +1 -0
  28. package/dist/esm/components/html.node.d.ts.map +1 -0
  29. package/dist/esm/components/html.node.js +1 -0
  30. package/dist/esm/components/meonode-unmounter.client.d.ts +24 -0
  31. package/dist/esm/components/meonode-unmounter.client.d.ts.map +1 -0
  32. package/dist/esm/components/meonode-unmounter.client.js +2 -0
  33. package/dist/esm/components/react.node.d.ts.map +1 -0
  34. package/dist/esm/components/react.node.js +1 -0
  35. package/dist/esm/components/registry.client.d.ts.map +1 -0
  36. package/dist/esm/components/registry.client.js +2 -0
  37. package/dist/esm/components/styled-renderer.client.d.ts.map +1 -0
  38. package/dist/esm/components/styled-renderer.client.js +2 -0
  39. package/dist/esm/components/theme-provider.client.d.ts.map +1 -0
  40. package/dist/esm/components/theme-provider.client.js +2 -0
  41. package/dist/esm/components/theme-provider.d.ts.map +1 -0
  42. package/dist/esm/components/theme-provider.js +1 -0
  43. package/dist/esm/constant/common.const.d.ts.map +1 -0
  44. package/dist/esm/constant/common.const.js +1 -0
  45. package/dist/esm/constant/css-properties.const.d.ts.map +1 -0
  46. package/dist/esm/constant/css-properties.const.js +1 -0
  47. package/dist/esm/core.node.d.ts.map +1 -0
  48. package/dist/esm/core.node.js +1 -0
  49. package/dist/esm/helper/common.helper.d.ts.map +1 -0
  50. package/dist/esm/helper/common.helper.js +1 -0
  51. package/dist/esm/helper/obj.helper.d.ts.map +1 -0
  52. package/dist/esm/helper/obj.helper.js +1 -0
  53. package/dist/esm/helper/react-is.helper.d.ts.map +1 -0
  54. package/dist/esm/helper/react-is.helper.js +1 -0
  55. package/dist/esm/hoc/component.hoc.d.ts.map +1 -0
  56. package/dist/esm/hoc/component.hoc.js +1 -0
  57. package/dist/esm/hoc/index.d.ts.map +1 -0
  58. package/dist/esm/hoc/portal.hoc.d.ts.map +1 -0
  59. package/dist/esm/hoc/portal.hoc.js +1 -0
  60. package/dist/esm/hook/index.d.ts.map +1 -0
  61. package/dist/esm/hook/usePortal.d.ts.map +1 -0
  62. package/dist/esm/hook/usePortal.js +2 -0
  63. package/dist/esm/hook/useTheme.d.ts.map +1 -0
  64. package/dist/esm/hook/useTheme.js +2 -0
  65. package/dist/esm/main.d.ts.map +1 -0
  66. package/dist/esm/main.js +1 -0
  67. package/dist/esm/nextjs-registry/index.d.ts.map +1 -0
  68. package/dist/esm/nextjs-registry/index.js +1 -0
  69. package/dist/esm/types/node.type.d.ts.map +1 -0
  70. package/dist/esm/util/mount-tracker.util.d.ts.map +1 -0
  71. package/dist/esm/util/mount-tracker.util.js +1 -0
  72. package/dist/esm/util/navigation-cache-manager.util.d.ts.map +1 -0
  73. package/dist/esm/util/navigation-cache-manager.util.js +1 -0
  74. package/dist/{util → esm/util}/node.util.d.ts +62 -16
  75. package/dist/esm/util/node.util.d.ts.map +1 -0
  76. package/dist/esm/util/node.util.js +1 -0
  77. package/dist/{util → esm/util}/theme.util.d.ts +1 -8
  78. package/dist/esm/util/theme.util.d.ts.map +1 -0
  79. package/dist/esm/util/theme.util.js +1 -0
  80. package/package.json +27 -23
  81. package/dist/client.d.ts.map +0 -1
  82. package/dist/client.js +0 -6
  83. package/dist/components/html.node.d.ts.map +0 -1
  84. package/dist/components/html.node.js +0 -632
  85. package/dist/components/meonode-unmounter.client.d.ts +0 -22
  86. package/dist/components/meonode-unmounter.client.d.ts.map +0 -1
  87. package/dist/components/meonode-unmounter.client.js +0 -15
  88. package/dist/components/react.node.d.ts.map +0 -1
  89. package/dist/components/react.node.js +0 -43
  90. package/dist/components/registry.client.d.ts.map +0 -1
  91. package/dist/components/registry.client.js +0 -14
  92. package/dist/components/styled-renderer.client.d.ts.map +0 -1
  93. package/dist/components/styled-renderer.client.js +0 -10
  94. package/dist/components/theme-provider.client.d.ts.map +0 -1
  95. package/dist/components/theme-provider.client.js +0 -8
  96. package/dist/components/theme-provider.d.ts.map +0 -1
  97. package/dist/components/theme-provider.js +0 -3
  98. package/dist/constant/common.const.d.ts.map +0 -1
  99. package/dist/constant/common.const.js +0 -1
  100. package/dist/constant/css-properties.const.d.ts.map +0 -1
  101. package/dist/core.node.d.ts.map +0 -1
  102. package/dist/core.node.js +0 -139
  103. package/dist/helper/common.helper.d.ts.map +0 -1
  104. package/dist/helper/common.helper.js +0 -73
  105. package/dist/helper/obj.helper.d.ts.map +0 -1
  106. package/dist/helper/obj.helper.js +0 -23
  107. package/dist/helper/react-is.helper.d.ts.map +0 -1
  108. package/dist/helper/react-is.helper.js +0 -94
  109. package/dist/hoc/component.hoc.d.ts.map +0 -1
  110. package/dist/hoc/component.hoc.js +0 -50
  111. package/dist/hoc/index.d.ts.map +0 -1
  112. package/dist/hoc/index.js +0 -1
  113. package/dist/hoc/portal.hoc.d.ts.map +0 -1
  114. package/dist/hoc/portal.hoc.js +0 -73
  115. package/dist/hook/index.d.ts.map +0 -1
  116. package/dist/hook/index.js +0 -1
  117. package/dist/hook/usePortal.d.ts.map +0 -1
  118. package/dist/hook/usePortal.js +0 -4
  119. package/dist/hook/useTheme.d.ts.map +0 -1
  120. package/dist/hook/useTheme.js +0 -8
  121. package/dist/main.d.ts.map +0 -1
  122. package/dist/main.js +0 -7
  123. package/dist/nextjs-registry/index.d.ts.map +0 -1
  124. package/dist/nextjs-registry/index.js +0 -1
  125. package/dist/types/env.d.js +0 -1
  126. package/dist/types/node.type.d.ts.map +0 -1
  127. package/dist/types/node.type.js +0 -1
  128. package/dist/util/mount-tracker.util.d.ts.map +0 -1
  129. package/dist/util/mount-tracker.util.js +0 -15
  130. package/dist/util/navigation-cache-manager.util.d.ts.map +0 -1
  131. package/dist/util/navigation-cache-manager.util.js +0 -19
  132. package/dist/util/node.util.d.ts.map +0 -1
  133. package/dist/util/node.util.js +0 -169
  134. package/dist/util/theme.util.d.ts.map +0 -1
  135. package/dist/util/theme.util.js +0 -118
  136. /package/dist/{client.d.ts → esm/client.d.ts} +0 -0
  137. /package/dist/{components → esm/components}/html.node.d.ts +0 -0
  138. /package/dist/{components → esm/components}/react.node.d.ts +0 -0
  139. /package/dist/{components → esm/components}/registry.client.d.ts +0 -0
  140. /package/dist/{components → esm/components}/styled-renderer.client.d.ts +0 -0
  141. /package/dist/{components → esm/components}/theme-provider.client.d.ts +0 -0
  142. /package/dist/{components → esm/components}/theme-provider.d.ts +0 -0
  143. /package/dist/{constant → esm/constant}/common.const.d.ts +0 -0
  144. /package/dist/{constant → esm/constant}/css-properties.const.d.ts +0 -0
  145. /package/dist/{core.node.d.ts → esm/core.node.d.ts} +0 -0
  146. /package/dist/{helper → esm/helper}/common.helper.d.ts +0 -0
  147. /package/dist/{helper → esm/helper}/obj.helper.d.ts +0 -0
  148. /package/dist/{helper → esm/helper}/react-is.helper.d.ts +0 -0
  149. /package/dist/{hoc → esm/hoc}/component.hoc.d.ts +0 -0
  150. /package/dist/{hoc → esm/hoc}/index.d.ts +0 -0
  151. /package/dist/{hoc → esm/hoc}/portal.hoc.d.ts +0 -0
  152. /package/dist/{hook → esm/hook}/index.d.ts +0 -0
  153. /package/dist/{hook → esm/hook}/usePortal.d.ts +0 -0
  154. /package/dist/{hook → esm/hook}/useTheme.d.ts +0 -0
  155. /package/dist/{main.d.ts → esm/main.d.ts} +0 -0
  156. /package/dist/{nextjs-registry → esm/nextjs-registry}/index.d.ts +0 -0
  157. /package/dist/{types → esm/types}/node.type.d.ts +0 -0
  158. /package/dist/{util → esm/util}/mount-tracker.util.d.ts +0 -0
  159. /package/dist/{util → esm/util}/navigation-cache-manager.util.d.ts +0 -0
@@ -1,73 +0,0 @@
1
- const _excluded=["provider"];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 _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{BaseNode,Node}from"../core.node.js";// --- Function Overloads ---
2
- /**
3
- * Higher-Order Component (HOC) to create and manage React portals with optional provider wrapping.
4
- * This function supports two overloads:
5
- * 1. `Portal(providerNodeInstance, component)` - Creates a portal with a fixed provider node instance.
6
- * 2. `Portal(component)` - Creates a portal without a fixed provider, allowing dynamic providers at launch time.
7
- * @template P The prop types for the component rendered inside the portal, extending BasePortalProps.
8
- * @param provider Optional NodeInstance to wrap the portal content (fixed provider).
9
- * @param component The component function that returns the content to render inside the portal.
10
- * @returns A function that launches the portal instance, accepting props and optional dynamic providers.
11
- * @example
12
- * // Using Portal with a fixed provider
13
- * const MyPortal = Portal(MyProviderNodeInstance, (props) => (
14
- * Div({
15
- * backgroundColor: 'white',
16
- * padding: '20px',
17
- * borderRadius: '8px',
18
- * children: [
19
- * H1({ children: 'Fixed Provider Portal' }),
20
- * Button({
21
- * onClick: () => props.portal.unmount(),
22
- * children: 'Close',
23
- * }),
24
- * ],
25
- * })
26
- * ));
27
- *
28
- * // Launching the portal
29
- * const portalInstance = MyPortal({ someProp: 'value' });
30
- * @example
31
- * // Using Portal without a fixed provider
32
- * const MyPortal = Portal((props) => (
33
- * Div({
34
- * backgroundColor: 'white',
35
- * padding: '20px',
36
- * borderRadius: '8px',
37
- * children: [
38
- * H1({ children: 'Dynamic Provider Portal' }),
39
- * Button({
40
- * onClick: () => props.portal.unmount(),
41
- * children: 'Close',
42
- * }),
43
- * ],
44
- * })
45
- * ));
46
- *
47
- * // Launching the portal with a dynamic provider
48
- * const portalInstance = MyPortal({ provider: AnotherProviderNodeInstance, someProp: 'value' });
49
- */// --- Implementation ---
50
- export function Portal(a,b){// --- Initialization ---
51
- let c,d,e={unmount:()=>{console.warn("Portal instance not yet created. Cannot unmount.")},update:a=>{console.warn("Portal instance not yet created. Cannot update.",a)}};// --- Argument Parsing and Overload Handling ---
52
- // Determines which Portal overload was called (e.g., with fixed provider or just component).
53
- if("function"==typeof b&&a instanceof BaseNode)// Handles the case where a fixed provider (single) is passed.
54
- c=[a],d=b;else if("function"==typeof a&&b===void 0)// Handles the case where only the component function is passed.
55
- d=a;else throw new Error("Invalid arguments for Portal HOC. Use Portal(component) or Portal(providerNodeInstance, component).");// --- Core Content Renderer Function ---
56
- // This function is the actual React component that will be rendered inside the portal.
57
- const f=(a={})=>{const b=d(_objectSpread(_objectSpread({},a),{},{portal:e// Passes the portal control object to the content component
58
- }));// If the result is a BaseNode, render it.
59
- return b instanceof BaseNode?b.render():b};// --- Portal Launcher Function (Returned to User) ---
60
- // This is the function that developers call to actually create and manage a portal instance.
61
- return function Func(a={}){// --- Helper for Deep Content Injection ---
62
- // Recursively injects content into the deepest child of a provider chain.
63
- function injectContentDeeply(a,b){const c=a.rawProps?.children;// If no children, or children is not a NodeInstance, inject directly
64
- if(!c||!(c instanceof BaseNode))return Node(a.element,_objectSpread(_objectSpread({},a.rawProps),{},{children:b}));// Recursively inject into the deepest node
65
- const d=injectContentDeeply(c,b);return Node(a.element,_objectSpread(_objectSpread({},a.rawProps),{},{children:d}))}// --- Provider Wrapping Logic ---
66
- // Iterates through the combined providers (fixed + dynamic) to wrap the content.
67
- // Providers are applied in reverse order to ensure the innermost content is wrapped by the outermost provider.
68
- let b;// Combine fixed and dynamic providers
69
- const d=[];a.provider&&d.push(a.provider);const g=[...(c??[]),...d],{provider:h}=a,i=_objectWithoutProperties(a,_excluded),j=Node(f,i);// Separates props for the portal's content from internal props like 'provider'.
70
- // Creates the base node for the portal's content.
71
- return b=0<g.length?g.reduceRight((a,b)=>{if(!(b instanceof BaseNode))return console.warn("Portal: Item in provider is not a valid NodeInstance. Skipping.",b),a;const c=b.rawProps?.children instanceof BaseNode;// If the provider already has nested children, inject content deeply.
72
- // Otherwise, simply set currentWrappedContent as its direct child.
73
- return c?injectContentDeeply(b,a):Node(b.element,_objectSpread(_objectSpread({},b.rawProps),{},{children:a}))},j):j,e=b.toPortal(),e}}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hook/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA"}
@@ -1 +0,0 @@
1
- export*from"./usePortal.js";export*from"./useTheme.js";
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePortal.d.ts","sourceRoot":"","sources":["../../src/hook/usePortal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAkC,MAAM,OAAO,CAAA;AACzE,OAAO,KAAK,EAAmB,UAAU,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAGvF;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,IAAI,GAAE,CAAsB;;;sBAGhC,CAAC;EAgCvC"}
@@ -1,4 +0,0 @@
1
- "use client";import{useCallback,useEffect,useRef}from"react";import{Node}from"../core.node.js";/**
2
- * Hook for managing a portal that renders node components outside the React component tree.
3
- * @deprecated This hook is unstable and will likely be removed in future versions
4
- */export function usePortal(a=[]){const b=useRef({}),c=useCallback(a=>(b.current.component=a,new Proxy(a,{apply:(a,c,[d])=>(b.current.props=d,a.call(c,d))})),[]);return useEffect(()=>{const{portal:a,component:c,props:d}=b.current;a&&c&&a.update(Node(c,d))},a),useEffect(()=>()=>{b.current.portal?.unmount(),b.current.portal=void 0,b.current.component=void 0,b.current.props=void 0},[]),{portal:b.current.portal,setPortal:a=>b.current.portal=a,createComponent:c}}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/hook/useTheme.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,4EA+BpB,CAAA"}
@@ -1,8 +0,0 @@
1
- "use client";import{useContext,useEffect}from"react";import{ThemeContext}from"../components/theme-provider.client.js";/**
2
- * A hook that provides access to the theme context.
3
- * It also handles side effects like updating localStorage and applying the theme to the document root.
4
- * @returns {ThemeContextValue} The theme context value.
5
- * @throws {Error} If used outside a ThemeProvider.
6
- */export const useTheme=()=>{const a=useContext(ThemeContext);if(!a)throw new Error("useTheme must be used within a ThemeProvider");const{theme:b}=a;return useEffect(()=>{// Sync theme mode with localStorage
7
- const a=localStorage.getItem("theme");a&&a===b.mode||localStorage.setItem("theme",b.mode);// Apply theme to document root
8
- const c=document.documentElement;"dark"===b.mode?(c.setAttribute("data-theme","dark"),c.classList.add("dark-theme"),c.classList.remove("light-theme")):(c.setAttribute("data-theme","light"),c.classList.add("light-theme"),c.classList.remove("dark-theme"))},[b.mode,b.system]),a};
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAG5D,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAG7E,cAAc,mBAAmB,CAAA;AAGjC,cAAc,yBAAyB,CAAA;AAGvC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,mCAAmC,CAAA;AAGjD,cAAc,oBAAoB,CAAA"}
package/dist/main.js DELETED
@@ -1,7 +0,0 @@
1
- // Common
2
- export{setDebugMode}from"./constant/common.const.js";// Core
3
- export{Node,createNode,createChildrenFirstNode}from"./core.node.js";// High Order Components
4
- export*from"./hoc/index.js";// Types
5
- export*from"./types/node.type.js";// Components
6
- export*from"./components/react.node.js";export*from"./components/html.node.js";export*from"./components/theme-provider.js";// Hooks
7
- export*from"./hook/index.js";
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/nextjs-registry/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,oCAAoC,CAAA;AAG/D,eAAO,MAAM,aAAa;;CAA6B,CAAA"}
@@ -1 +0,0 @@
1
- import _StyleRegistry from"../components/registry.client.js";import{createNode}from"../core.node.js";export const StyleRegistry=createNode(_StyleRegistry);
@@ -1 +0,0 @@
1
- export{};
@@ -1 +0,0 @@
1
- {"version":3,"file":"node.type.d.ts","sourceRoot":"","sources":["../../src/types/node.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,GAAG,EACR,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAI5C,KAAK,YAAY,CAAC,CAAC,IAAI;KACpB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC;CACxD,CAAC,MAAM,CAAC,CAAC,CAAA;AAGV,MAA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
- 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{__DEBUG__}from"../constant/common.const.js";/**
2
- * MountTrackerUtil keeps track of which BaseNode instances are currently mounted in the DOM.
3
- * It provides a simple registry for mount/unmount state that other systems
4
- * (like NavigationCacheManager) can query for safe cache eviction.
5
- */export class MountTrackerUtil{constructor(){}// Debug only
6
- /**
7
- * Tracks a node as mounted. Adds its stable key and a WeakRef to the node to the map of mounted nodes.
8
- */static trackMount(a){this.mountedNodes.add(a),__DEBUG__&&this._unmountCallCount.delete(a)}/**
9
- * Removes its stable key from the set of mounted nodes.
10
- * In development mode, it also tracks multiple unmount calls for debugging purposes.
11
- * @returns True if the node was previously tracked as mounted and is now removed, false otherwise.
12
- */static untrackMount(a){const b=this.mountedNodes.delete(a);if(__DEBUG__&&!b){const b=(this._unmountCallCount.get(a)||0)+1;this._unmountCallCount.set(a,b),1<b&&console.warn(`[MeoNode] untrackMount called ${b} times for an already unmounted node: ${a}. This could indicate a memory leak or a bug in a component's lifecycle.`)}return b}/**
13
- * Cleans up all internal state of the MountTrackerUtil.
14
- * Removes all tracked nodes and debug counters.
15
- */static cleanup(){this.mountedNodes.clear(),__DEBUG__&&this._unmountCallCount.clear()}}_defineProperty(MountTrackerUtil,"mountedNodes",new Set),_defineProperty(MountTrackerUtil,"_unmountCallCount",new Map);
@@ -1 +0,0 @@
1
- {"version":3,"file":"navigation-cache-manager.util.d.ts","sourceRoot":"","sources":["../../src/util/navigation-cache-manager.util.ts"],"names":[],"mappings":"AAIA,OAAO,CAAC,MAAM,CAAC,CAAC;IACd,UAAU,MAAM;QACd,4BAA4B,CAAC,EAAE,OAAO,CAAA;KACvC;CACF;AAED;;GAEG;AACH,qBAAa,0BAA0B;IACrC,OAAO,eAAiB;IAExB,OAAO,CAAC,MAAM,CAAC,SAAS,CAA0C;IAClE,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAwC;IACzE,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAA2C;IAC/E,OAAO,CAAC,MAAM,CAAC,UAAU,CAAQ;IAEjC,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,eAAe,CAA8B;IAErD,OAAc,WAAW,IAAI,0BAA0B,CAKtD;IAED;;OAEG;IACI,KAAK,SAaX;IAED;;;OAGG;IACH,OAAO,CAAC,KAAK;IAkBb;;OAEG;IACH,OAAO,CAAC,iBAAiB,CA4BxB;IAED;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAmB5B;;;OAGG;IACH,OAAO,CAAC,iBAAiB;CAW1B"}
@@ -1,19 +0,0 @@
1
- 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{__DEBUG__}from"../constant/common.const.js";import{BaseNode}from"../core.node.js";import{MountTrackerUtil}from"./mount-tracker.util.js";/**
2
- * Lightweight navigation handler that clears cache on SPA navigation.
3
- */export class NavigationCacheManagerUtil{constructor(){/**
4
- * Debounced navigation handler. Clears mounted element cache and props cache.
5
- */_defineProperty(this,"_isListening",!1),_defineProperty(this,"_cleanupTimeout",null),_defineProperty(this,"_handleNavigation",()=>{this._cleanupTimeout&&clearTimeout(this._cleanupTimeout);const a=BaseNode.elementCache.size,b=100>a?50:500>a?100:200;this._cleanupTimeout=setTimeout(()=>{const a=BaseNode.propProcessingCache.size;let b=0;// Only clean UNMOUNTED elements
6
- BaseNode.elementCache.keys().forEach(a=>{MountTrackerUtil.mountedNodes.has(a)||(BaseNode.elementCache.delete(a),b++)}),200<a&&BaseNode.propProcessingCache.clear(),__DEBUG__&&console.log(`[MeoNode] Navigation: cleared ${b} unmounted elements, ${a} props entries`)},b)})}static getInstance(){return this._instance||(this._instance=new NavigationCacheManagerUtil),this._instance}/**
7
- * Start listening for navigation events. Idempotent.
8
- */start(){this._isListening||"undefined"==typeof window||(// Setup automatic cleanup on page unload
9
- this._isListening=!0,window.addEventListener("popstate",this._handleNavigation),this._patchHistoryMethods(),this._setupAutoCleanup(),__DEBUG__&&console.log("[MeoNode] NavigationCacheManagerUtil started"))}/**
10
- * Stops listening for navigation events and restores original browser APIs.
11
- * This is important for cleanup during HMR or when unmounting the library.
12
- */_stop(){this._isListening&&"undefined"!=typeof window&&(window.removeEventListener("popstate",this._handleNavigation),this._cleanupTimeout&&(clearTimeout(this._cleanupTimeout),this._cleanupTimeout=null),this._isListening=!1,__DEBUG__&&console.log("[MeoNode] NavigationCacheManagerUtil stopped"))}/**
13
- * Patch history.pushState/replaceState to detect SPA navigation.
14
- */_patchHistoryMethods(){NavigationCacheManagerUtil._isPatched||(NavigationCacheManagerUtil._originalPushState=history.pushState,NavigationCacheManagerUtil._originalReplaceState=history.replaceState,history.pushState=(...a)=>{NavigationCacheManagerUtil._originalPushState.apply(history,a),this._handleNavigation()},history.replaceState=(...a)=>{NavigationCacheManagerUtil._originalReplaceState.apply(history,a),this._handleNavigation()},NavigationCacheManagerUtil._isPatched=!0)}/**
15
- * Setup automatic cleanup on page unload.
16
- * Covers HMR, navigation away, and browser close.
17
- */_setupAutoCleanup(){// Only set up once
18
- window.__MEONODE_CLEANUP_REGISTERED||(// Handle page unload (navigation away, refresh, close)
19
- window.addEventListener("beforeunload",()=>{this._stop(),BaseNode.clearCaches()}),window.__MEONODE_CLEANUP_REGISTERED=!0)}}_defineProperty(NavigationCacheManagerUtil,"_instance",null),_defineProperty(NavigationCacheManagerUtil,"_originalPushState",null),_defineProperty(NavigationCacheManagerUtil,"_originalReplaceState",null),_defineProperty(NavigationCacheManagerUtil,"_isPatched",!1);
@@ -1 +0,0 @@
1
- {"version":3,"file":"node.util.d.ts","sourceRoot":"","sources":["../../src/util/node.util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAyC,KAAK,SAAS,EAAiC,MAAM,OAAO,CAAA;AACnH,OAAO,KAAK,EACV,qBAAqB,EACrB,WAAW,EACX,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,cAAc,EACd,cAAc,EAEd,UAAU,EAEX,MAAM,yBAAyB,CAAA;AAKhC,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAExD;;;;;GAKG;AACH,qBAAa,QAAQ;IACnB,OAAO,eAAiB;IAGxB,OAAc,QAAQ,UAAgC;IAGtD,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAAgC;IAGtE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,OAAM;IAC9C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,MAAK;IAGhD,OAAO,CAAC,MAAM,CAAC,SAAS,CAAgC;IAKxD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAA2D;IAGjG,OAAc,oBAAoB;;;;;OAM/B;IAEH;;;;;;;;;;OAUG;IACH,OAAc,cAAc,wCAS3B;IAED;;;;;OAKG;IACH,OAAc,WAAW,yBAAgH;IAEzI;;;OAGG;IACH,OAAc,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAc5C;IAED,OAAO,CAAC,MAAM,CAAC,OAAO;IA0BtB;;;;;OAKG;IACH,OAAc,mBAAmB,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE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,OAAc,gBAAgB,CAAC,CAAC,SAAS,SAAS,GAAG,YAAY,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,CA4DrJ;IAED;;;;;;;;;OASG;IACH,OAAc,mBAAmB,CAAC,EAChC,gBAAgB,EAChB,SAAS,EACT,cAAc,EACf,EAAE;QACD,gBAAgB,EAAE,WAAW,CAAA;QAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,cAAc,CAAC,EAAE,OAAO,CAAA;KACzB,wUA8BA;IAED;;;;OAIG;IACH,OAAc,0BAA0B,CAAC,IAAI,EAAE,YAAY,WA0C1D;IAED,OAAc,kBAAkB,CAAC,KAAK,EAAE;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,SAAS,EAAE,IAAI,CAAA;KAAE,QAgBtF;CACF"}
@@ -1,169 +0,0 @@
1
- const _excluded=["ref","key","children","css","props","disableEmotion"],_excluded2=["style"];var _NodeUtil;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 _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 _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{isForwardRef,isMemo,isReactClassComponent}from"../helper/react-is.helper.js";import{getCSSProps,getDOMProps,getElementTypeName,omitUndefined}from"../helper/common.helper.js";import{__DEBUG__}from"../constant/common.const.js";import{BaseNode}from"../core.node.js";import{createRoot}from"react-dom/client";/**
2
- * NodeUtil provides a collection of static utility methods and properties
3
- * used internally by BaseNode for various tasks such as hashing, shallow comparison,
4
- * and stable element ID generation. This centralizes common helper functions,
5
- * improving modularity and maintainability of the core library.
6
- */export class NodeUtil{constructor(){}// Determines if the current environment is server-side (Node.js) or client-side (browser).
7
- /**
8
- * Combines FNV-1a and djb2 hash functions for a more robust signature.
9
- * @method hashString
10
- */static hashString(a){let b=2166136261,c=5381;// FNV offset basis
11
- // djb2 init
12
- for(let d=0;d<a.length;d++){const e=a.charCodeAt(d);// FNV-1a
13
- // djb2
14
- b^=e,b=Math.imul(b,16777619),c=33*c^e}return`${(b>>>0).toString(36)}_${(c>>>0).toString(36)}`}static hashCSS(a){var b=Math.min;const c=this._cssCache.get(a);if(c)return c;// Fast structural hash without full serialization
15
- const d=Object.keys(a);let e=d.length;for(let c=0;c<b(d.length,10);c++){// Sample first 10
16
- const b=d[c],f=a[b],g=b.charCodeAt(0);e=(e<<5)-e+g,e&=e,"string"==typeof f&&(e=(e<<5)-e+f.length)}const f=e.toString(36);return this._cssCache.set(a,f),f}/**
17
- * Creates a unique, stable signature from the element type and props.
18
- * This signature includes the element's type to prevent collisions between different components
19
- * and handles primitive values in arrays and objects for better caching.
20
- * @method createPropSignature
21
- */static createPropSignature(a,b){if(NodeUtil.isServer)return;const c=getElementTypeName(a),d=Object.keys(b);// Optimization: Only sort if there's more than one key to ensure stability
22
- 1<d.length&&d.sort();const e=[`${c}:`];if("function"==typeof a){let b=NodeUtil._functionSignatureCache.get(a);b||(b=NodeUtil.hashString(a.toString()),NodeUtil._functionSignatureCache.set(a,b)),e.push(b)}for(const c of d){const a=b[c];let d;const f=typeof a;if("string"==f||"number"===f||"boolean"===f)d=`${c}:${a};`;else if(null===a)d=`${c}:null;`;else if(a===void 0)d=`${c}:undefined;`;else if("css"===c&&"object"==typeof a)d=`css:${this.hashCSS(a)};`;else if(Array.isArray(a)){// Hash primitive values in arrays for better cache hits
23
- const b=a.filter(a=>{const b=typeof a;return"string"==b||"number"===b||"boolean"===b||null===a});d=b.length===a.length?`${c}:[${b.join(",")}];`:`${c}:[${a.length}];`}else if(a&&a.isBaseNode)d=`${c}:${a.stableKey};`;else{// Include sorted keys for object structure signature
24
- const b=Object.keys(a).sort();d=`${c}:{${b.join(",")}};`}e.push(d)}return NodeUtil.hashString(e.join(","))}/**
25
- * Extracts "critical" props from a given set of props. Critical props are those
26
- * that are frequently used for styling or event handling, such as `on*` handlers,
27
- * `aria-*` attributes, `data-*` attributes, `css`, `className`, and `style`.
28
- * This method is used to optimize prop processing by focusing on props that are
29
- * most likely to influence rendering or behavior.
30
- */static extractCriticalProps(a,b){const c={_keyCount:b.length};let d=0;for(const e of b){if(50<=d)break;// Fast path: direct Set check first (O(1))
31
- if(NodeUtil.CRITICAL_PROPS.has(e)){c[e]=a[e],d++;continue}// Inline prefix checks using charCode (faster than startsWith for short prefixes)
32
- const f=e.charCodeAt(0);// Check 'on' prefix (111 = 'o', 110 = 'n')
33
- if(111===f&&110===e.charCodeAt(1)){c[e]=a[e],d++;continue}// Check 'aria' prefix (97 = 'a', 114 = 'r', 105 = 'i')
34
- if(97===f&&114===e.charCodeAt(1)&&105===e.charCodeAt(2)&&97===e.charCodeAt(3)){c[e]=a[e],d++;continue}// Check 'data' prefix (100 = 'd', 97 = 'a', 116 = 't')
35
- if(100===f&&97===e.charCodeAt(1)&&116===e.charCodeAt(2)&&97===e.charCodeAt(3)){c[e]=a[e],d++;continue}// Style prop check last (most expensive), only for smaller objects
36
- 100>=b.length&&NodeUtil.isStyleProp(e)&&(c[e]=a[e],d++)}return c}/**
37
- * Retrieves computed CSS props from the cache with LRU tracking.
38
- * Access time and hit count are tracked for smarter eviction.
39
- * @method getCachedCssProps
40
- */static getCachedCssProps(a,b){if(NodeUtil.isServer||!b)return{cssProps:getCSSProps(a)};const c=BaseNode.propProcessingCache.get(b);if(c)return c.lastAccess=Date.now(),c.hitCount++,{cssProps:c.cssProps};const d=getCSSProps(a);return BaseNode.propProcessingCache.set(b,{cssProps:d,signature:b,lastAccess:Date.now(),hitCount:1}),BaseNode.propProcessingCache.size>NodeUtil.CACHE_SIZE_LIMIT&&!BaseNode.scheduledCleanup&&(BaseNode.scheduledCleanup=!0,"undefined"==typeof requestIdleCallback?setTimeout(()=>{NodeUtil._evictLRUEntries(),BaseNode.scheduledCleanup=!1},100):requestIdleCallback(()=>{NodeUtil._evictLRUEntries(),BaseNode.scheduledCleanup=!1},{timeout:2e3})),{cssProps:d}}/**
41
- * Implements an LRU eviction strategy that removes multiple entries at once.
42
- * It uses a scoring system where older and less frequently used entries have a higher eviction priority.
43
- * @method _evictLRUEntries
44
- */static _evictLRUEntries(){const a=Date.now(),b=new MinHeap((c,a)=>a.score-c.score);// Create max-heap (using min-heap with inverted comparison) to get highest scores first
45
- for(const[c,d]of BaseNode.propProcessingCache.entries()){const e=this._calculateEvictionScore(d,a);b.push({key:c,score:e})}// O(log n) eviction of top N entries
46
- for(let a=0;a<NodeUtil.CACHE_CLEANUP_BATCH;a++){const a=b.pop();if(a)BaseNode.propProcessingCache.delete(a.key);else// No more items to evict
47
- break}}/**
48
- * Calculates an eviction score based on age and frequency of access.
49
- * Higher scores mean more likelihood to be evicted.
50
- * @method _calculateEvictionScore
51
- */static _calculateEvictionScore(a,b){const c=b-a.lastAccess,d=a.hitCount;// Weighted scoring: recency 30%, frequency 70% - favors frequently accessed items
52
- return .3*(c/1e3)+.7*(1e3/(d+1))}/**
53
- * The main prop processing pipeline. It separates cacheable and non-cacheable props,
54
- * generates a signature for caching, and assembles the final props object.
55
- * @method processProps
56
- */static processProps(a,b={},c){const{ref:d,key:e,children:f,css:g,props:i={},disableEmotion:h}=b,j=_objectWithoutProperties(b,_excluded);// --- Fast Path Optimization ---
57
- if(0===Object.keys(j).length&&!g)return omitUndefined({ref:d,key:e,disableEmotion:h,nativeProps:omitUndefined(i),children:NodeUtil._processChildren(f,h)});// --- Hybrid Caching Strategy ---
58
- const k={},l={},m=Object.keys(j);// 1. Categorize props into cacheable (primitives) and non-cacheable (objects/functions).
59
- // Optimization: Use Object.keys loop instead of for..in for better performance and safety
60
- for(let d=0;d<m.length;d++){const a=m[d],b=j[a],c=typeof b;"string"===c||"number"===c||"boolean"===c?k[a]=b:l[a]=b}// 2. Pass element type to signature generation
61
- const n=NodeUtil.createPropSignature(a,k),{cssProps:o}=NodeUtil.getCachedCssProps(k,n),p=getCSSProps(l),q=getDOMProps(j),r=_objectSpread(_objectSpread(_objectSpread({},o),p),g),s=NodeUtil._processChildren(f,h,c);// 3. Process non-cacheable props on every render to ensure correctness for functions and objects.
62
- // DOM props are always processed fresh.
63
- // 4. Assemble the final CSS object.
64
- // --- Child Normalization ---
65
- // --- Final Assembly ---
66
- return omitUndefined(_objectSpread(_objectSpread({ref:d,key:e,css:r},q),{},{disableEmotion:h,nativeProps:omitUndefined(i),children:s}))}/**
67
- * Processes and normalizes children of the node.
68
- * Converts raw children (React elements, primitives, or other BaseNodes) into a consistent format.
69
- * @param children The raw children to process.
70
- * @param disableEmotion If true, emotion styling will be disabled for these children.
71
- * @param parentStableKey The stable key of the parent node, used for generating unique keys for children.
72
- */static _processChildren(a,b,c){return a?"function"==typeof a?a:Array.isArray(a)?1===a.length?NodeUtil.processRawNode(a[0],b,`${c}_0`):a.map((a,d)=>NodeUtil.processRawNode(a,b,`${c}_${d}`)):NodeUtil.processRawNode(a,b,c):void 0;// Fast path for non-array (single child)
73
- // Fast path for single element array
74
- // General case: multiple children
75
- }/**
76
- * Determines if a node should update based on its dependency array.
77
- * Uses a shallow comparison, similar to React's `useMemo` and `useCallback`.
78
- * @method shouldNodeUpdate
79
- */static shouldNodeUpdate(a,b,c){// SSR has no concept of re-renders, so deps system doesn't apply
80
- return!!NodeUtil.isServer||!c&&(!(void 0!==b)||!(void 0!==a)||b.length!==a.length||!!b.some((b,c)=>!Object.is(b,a[c])));// No deps array means always update.
81
- // First render for this keyed component, or no previous deps.
82
- // Length change means update.
83
- // Shallow compare deps. If any have changed, update.
84
- // Deps are the same, no update needed.
85
- }/**
86
- * The core normalization function for a single child. It takes any valid `NodeElement`
87
- * (primitive, React element, function, `BaseNode` instance) and converts it into a standardized `BaseNode`
88
- * instance if it isn't one already. This ensures a consistent structure for the iterative renderer.
89
- * @method processRawNode
90
- */static processRawNode(a,b,c){// Primitives and null/undefined are returned as-is.
91
- if(null===a||a===void 0||"string"==typeof a||"number"==typeof a||"boolean"==typeof a)return a;// If it's already a BaseNode, clone it with a positional key if available.
92
- if(NodeUtil.isNodeInstance(a)){const d=c||b&&!a.rawProps.disableEmotion;if(d){// Create a new BaseNode instance.
93
- const d=new BaseNode(a.element,a.rawProps,a.dependencies);// Augment the internal stableKey with positional information.
94
- // This is purely for BaseNode's internal caching, not for React's 'key' prop.
95
- return d.stableKey=`${c}:${d.stableKey}`,b&&!d.rawProps.disableEmotion&&(d.rawProps.disableEmotion=!0),d}return a}// Handle function-as-a-child (render props).
96
- if(NodeUtil.isFunctionChild(a))return new BaseNode(NodeUtil.functionRenderer,{props:{render:a,disableEmotion:b}},void 0);// Handle standard React elements.
97
- if(isValidElement(a)){const c=a.props,{style:d}=c,e=_objectWithoutProperties(c,_excluded2),f=_objectSpread(_objectSpread({},e),d||{});return new BaseNode(a.type,_objectSpread(_objectSpread(_objectSpread({},f),null!==a.key&&void 0!==a.key?{key:a.key}:{}),{},{disableEmotion:b}),void 0)}// Handle component classes and memos.
98
- return isReactClassComponent(a)||isMemo(a)||isForwardRef(a)?new BaseNode(a,{disableEmotion:b},void 0):a instanceof React.Component?NodeUtil.processRawNode(a.render(),b,c):a;// Handle component instances.
99
- }/**
100
- * A helper to reliably identify if a given function is a "function-as-a-child" (render prop)
101
- * rather than a standard Function Component.
102
- * @method isFunctionChild
103
- */static isFunctionChild(a){if("function"!=typeof a||isReactClassComponent(a)||isMemo(a)||isForwardRef(a))return!1;try{return!(a.prototype&&"function"==typeof a.prototype.render)}catch(a){return __DEBUG__&&console.error("MeoNode: Error checking if a node is a function child.",a),!0}}/**
104
- * A special internal React component used to render "function-as-a-child" (render prop) patterns.
105
- * When a `BaseNode` receives a function as its `children` prop, it wraps that function
106
- * inside this `functionRenderer` component. This component then executes the render function
107
- * and processes its return value, normalizing it into a renderable ReactNode.
108
- *
109
- * This allows `BaseNode` to support render props while maintaining its internal processing
110
- * and normalization logic for the dynamically generated content.
111
- * @method functionRenderer
112
- * @param {Object} props The properties passed to the renderer.
113
- * @param {Function} props.render The function-as-a-child to execute.
114
- * @param {boolean} [props.disableEmotion] Inherited flag to disable Emotion styling for children.
115
- * @returns {ReactNode | null | undefined} The processed and rendered output of the render function.
116
- */static functionRenderer({render:a,disableEmotion:b}){let c;try{// Execute the render prop function to get its output.
117
- c=a()}catch(a){// If the render function throws, treat its output as null to prevent crashes.
118
- __DEBUG__&&console.error("MeoNode: Error executing function-as-a-child.",a),c=null}// Handle null or undefined results directly, as they are valid React render outputs.
119
- if(null===c||c===void 0)return c;// If the result is already a BaseNode instance, process it.
120
- if(NodeUtil.isNodeInstance(c))// If emotion is disabled for the parent and not explicitly re-enabled on the child,
121
- // create a new BaseNode with emotion disabled and render it.
122
- return b&&!c.rawProps.disableEmotion?new BaseNode(c.element,_objectSpread(_objectSpread({},c.rawProps),{},{disableEmotion:!0})).render():c.render();// Otherwise, render the existing BaseNode directly.
123
- // If the result is an array, it likely contains multiple children.
124
- if(Array.isArray(c)){// Helper to generate a stable key for array items, crucial for React's reconciliation.
125
- const a=(a,b)=>{try{// Attempt to get a meaningful name for the element type.
126
- return`${getElementTypeName(a)}-${b}`}catch(a){// Fallback to a generic key if type name cannot be determined.
127
- return __DEBUG__&&console.error("MeoNode: Could not determine element type name for key in function-as-a-child.",a),`item-${b}`}};// Map over the array, processing each item and assigning a key.
128
- return c.map((c,d)=>NodeUtil.renderProcessedNode({processedElement:NodeUtil.processRawNode(c,b),passedKey:a(c,d),disableEmotion:b}))}// If the result is a React component instance (e.g., `new MyClassComponent()`).
129
- if(c instanceof React.Component)return NodeUtil.renderProcessedNode({processedElement:NodeUtil.processRawNode(c.render(),b),disableEmotion:b});// Handle primitive types directly, as they are valid React children.
130
- if("string"==typeof c||"number"==typeof c||"boolean"==typeof c)return c;// For any other non-primitive, non-array result, process it as a single NodeElement.
131
- const d=NodeUtil.processRawNode(c,b);// If processing yields a valid element, render it.
132
- return d?NodeUtil.renderProcessedNode({processedElement:d,disableEmotion:b}):c;// Fallback: return the original result if it couldn't be processed into a renderable node.
133
- }/**
134
- * Renders a processed `NodeElement` into a ReactNode.
135
- * This helper is primarily used by `functionRenderer` to handle the output of render props,
136
- * ensuring that `BaseNode` instances are correctly rendered and other React elements or primitives
137
- * are passed through. It also applies `disableEmotion` and `key` props as needed.
138
- *
139
- * This method is part of the child processing pipeline, converting internal `NodeElement` representations
140
- * into actual React elements that can be rendered by React.
141
- * @method renderProcessedNode
142
- */static renderProcessedNode({processedElement:a,passedKey:b,disableEmotion:c}){// Initialize an object to hold common props that might be applied to the new BaseNode.
143
- const d={};// If a `passedKey` is provided, add it to `commonBaseNodeProps`.
144
- // This key is typically used for React's reconciliation process.
145
- // If the processed element is already a BaseNode instance.
146
- if(void 0!==b&&(d.key=b),NodeUtil.isNodeInstance(a)){// Get the existing key from the raw props of the BaseNode.
147
- const e=a.rawProps?.key;// Apply the `disableEmotion` flag to the raw props of the BaseNode.
148
- // If the existing key is the same as the passed key, render the existing BaseNode directly.
149
- // This avoids unnecessary re-creation of the BaseNode instance.
150
- return a.rawProps.disableEmotion=c,e===b?a.render():new BaseNode(a.element,_objectSpread(_objectSpread({},a.rawProps),d)).render();// Otherwise, create a new BaseNode instance, merging existing raw props with common props, then render it.
151
- }// If the processed element is a React class component (e.g., `class MyComponent extends React.Component`).
152
- // Create a new BaseNode for it, applying common props and `disableEmotion`, then render.
153
- return isReactClassComponent(a)?new BaseNode(a,_objectSpread(_objectSpread({},d),{},{disableEmotion:c})).render():a instanceof React.Component?a.render():"function"==typeof a?createElement(a,{key:b}):a;// If the processed element is an instance of a React component (e.g., `new MyComponent()`).
154
- // Directly call its `render` method.
155
- // If the processed element is a function (likely a functional component or a render prop that returned a component type).
156
- // Create a React element directly using `createElement`, passing the `passedKey`.
157
- // For any other type (primitives, null, undefined, etc.), return it as a ReactNode.
158
- }/**
159
- * Ensures that the necessary DOM element and React root are available for portal rendering.
160
- * This is only executed on the client-side.
161
- * @method ensurePortalInfrastructure
162
- */static ensurePortalInfrastructure(a){if(NodeUtil.isServer)return!1;let b=NodeUtil.portalInfrastructure.get(a);// Check if infrastructure exists and is still connected
163
- if(b?.domElement?.isConnected&&b?.reactRoot)return!0;// Clean up stale or disconnected infrastructure
164
- if(b&&(!b.domElement?.isConnected||!b.reactRoot)){try{b.reactRoot?.unmount?.()}catch(a){__DEBUG__&&console.error("MeoNode: Error unmounting stale portal root.",a)}NodeUtil.cleanupPortalInfra(b),NodeUtil.portalInfrastructure.delete(a),b=void 0}// Create new infrastructure
165
- const c=document.createElement("div");document.body.appendChild(c);const d=createRoot(c),e={render:d.render.bind(d),unmount:d.unmount.bind(d),update:()=>{}// Placeholder, will be overridden
166
- };return b={domElement:c,reactRoot:e},NodeUtil.portalInfrastructure.set(a,b),BaseNode.portalCleanupRegistry.register(a,{domElement:c,reactRoot:e},a),!0}static cleanupPortalInfra(a){try{a.reactRoot?.unmount&&a.reactRoot.unmount()}catch(a){__DEBUG__&&console.error("Portal cleanup error:",a)}try{a.domElement?.isConnected&&a.domElement.remove()}catch(a){__DEBUG__&&console.error("DOM removal error:",a)}}}/**
167
- * A min-heap implementation for efficient priority queue operations.
168
- * Used for O(log n) eviction in the LRU cache system.
169
- */_NodeUtil=NodeUtil,_defineProperty(NodeUtil,"isServer","undefined"==typeof window),_defineProperty(NodeUtil,"_functionSignatureCache",new WeakMap),_defineProperty(NodeUtil,"CACHE_SIZE_LIMIT",500),_defineProperty(NodeUtil,"CACHE_CLEANUP_BATCH",50),_defineProperty(NodeUtil,"_cssCache",new WeakMap),_defineProperty(NodeUtil,"CRITICAL_PROPS",new Set(["css","className","disableEmotion","props"])),_defineProperty(NodeUtil,"portalInfrastructure",new WeakMap),_defineProperty(NodeUtil,"isNodeInstance",a=>"object"==typeof a&&null!==a&&"element"in a&&"function"==typeof a.render&&"function"==typeof a.toPortal&&"isBaseNode"in a),_defineProperty(NodeUtil,"isStyleProp",_NodeUtil.isServer||"undefined"==typeof document?()=>!1:a=>a in document.body.style);class MinHeap{constructor(a){_defineProperty(this,"heap",[]),this.comparator=a}size(){return this.heap.length}isEmpty(){return 0===this.size()}push(a){this.heap.push(a),this.bubbleUp()}pop(){if(!this.isEmpty()){this.swap(0,this.size()-1);const a=this.heap.pop();return this.bubbleDown(),a}}peek(){return this.isEmpty()?void 0:this.heap[0]}bubbleUp(a=this.size()-1){for(;0<a;){const b=Math.floor((a-1)/2);if(0>=this.comparator(this.heap[b],this.heap[a]))break;this.swap(b,a),a=b}}bubbleDown(a=0){for(const b=this.size()-1;;){const c=2*a+1,d=2*a+2;let e=a;if(c<=b&&0>this.comparator(this.heap[c],this.heap[e])&&(e=c),d<=b&&0>this.comparator(this.heap[d],this.heap[e])&&(e=d),e===a)break;this.swap(a,e),a=e}}swap(a,b){[this.heap[a],this.heap[b]]=[this.heap[b],this.heap[a]]}}
@@ -1 +0,0 @@
1
- {"version":3,"file":"theme.util.d.ts","sourceRoot":"","sources":["../../src/util/theme.util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAe,MAAM,yBAAyB,CAAA;AAiG1E;;;;;;GAMG;AACH,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CACvB;AACD,qBAAa,SAAS;IACpB,OAAO,eAAiB;IAExB,OAAO,CAAC,MAAM,CAAC,UAAU,CAAmC;IAE5D;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAc,kBAAkB,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,cAAc,GAAG,IAAI,CA2BnF;IAED,OAAc,aAAa,uDAM1B;IAED;;;;;;;;OAQG;IACH,OAAc,mBAAmB,GAAI,CAAC;;YA0HrC;IAED,OAAc,eAAe,aAE5B;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqDG;IACH,OAAc,mBAAmB,yBAmEhC;CACF"}
@@ -1,118 +0,0 @@
1
- const _excluded=["flex"];var _ThemeUtil;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 _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{ObjHelper}from"../helper/obj.helper.js";import{getValueByPath}from"../helper/common.helper.js";/**
2
- * Cache manager for theme resolution operations.
3
- */class ThemeResolverCache{constructor(){_defineProperty(this,"CACHE_SIZE_LIMIT",500),_defineProperty(this,"CACHE_EVICTION_BATCH_SIZE",50),_defineProperty(this,"_resolutionCache",new Map),_defineProperty(this,"_pathLookupCache",new Map),_defineProperty(this,"_themeRegex",/theme\.([a-zA-Z0-9_.-]+)/g)}static getInstance(){return ThemeResolverCache._instance||(ThemeResolverCache._instance=new ThemeResolverCache),ThemeResolverCache._instance}/**
4
- * Generate a stable cache key from object and theme, including the theme mode.
5
- */_generateCacheKey(a,b){// Including theme.mode is critical for cache correctness.
6
- return`${ObjHelper.stringify(a)}_${b.mode}_${ObjHelper.stringify(b.system)}`}getResolution(a,b){const c=this._generateCacheKey(a,b),d=this._resolutionCache.get(c);return d&&(this._resolutionCache.delete(c),this._resolutionCache.set(c,d)),d||null}setResolution(a,b,c){const d=this._generateCacheKey(a,b);this._resolutionCache.set(d,c),this._resolutionCache.size>this.CACHE_SIZE_LIMIT&&this._evict(this._resolutionCache)}getPathLookup(a,b){const c=`${ObjHelper.stringify(a)}_${b}`,d=this._pathLookupCache.get(c);return d&&(this._pathLookupCache.delete(c),this._pathLookupCache.set(c,d)),d??null}setPathLookup(a,b,c){const d=`${ObjHelper.stringify(a)}_${b}`;this._pathLookupCache.set(d,c),this._pathLookupCache.size>this.CACHE_SIZE_LIMIT&&this._evict(this._pathLookupCache)}_evict(a){const b=a.keys();for(let c=0;c<this.CACHE_EVICTION_BATCH_SIZE;c++){const c=b.next().value;if(c)a.delete(c);else break}}getThemeRegex(){return this._themeRegex.lastIndex=0,this._themeRegex}shouldCache(){return"undefined"==typeof window}clear(){this._resolutionCache.clear(),this._pathLookupCache.clear()}}/**
7
- * Parsed flex shorthand components for CSS flex property
8
- * @interface FlexComponents
9
- * @property grow - The flex-grow value (how much the item should grow)
10
- * @property shrink - The flex-shrink value (how much the item should shrink)
11
- * @property basis - The flex-basis value (initial main size before free space is distributed)
12
- */_defineProperty(ThemeResolverCache,"_instance",null);export class ThemeUtil{constructor(){}/**
13
- * Parses a CSS flex shorthand property into its individual components.
14
- *
15
- * The CSS flex property is a shorthand for flex-grow, flex-shrink, and flex-basis.
16
- * This parser handles the most common flex shorthand patterns to extract the shrink value
17
- * when it's explicitly set by the user.
18
- *
19
- * Supported patterns:
20
- * - Keywords: 'none' | 'auto' | 'initial'
21
- * - Single number: '1' → {grow: 1, shrink: 1, basis: '0%'}
22
- * - Full shorthand: '1 0 auto' → {grow: 1, shrink: 0, basis: 'auto'}
23
- * @param flex The CSS flex property value to parse
24
- * @returns FlexComponents object with parsed values, or null if unparseable
25
- * @example
26
- * parseFlexShorthand('none') // → {grow: 0, shrink: 0, basis: 'auto'}
27
- * parseFlexShorthand('1') // → {grow: 1, shrink: 1, basis: '0%'}
28
- * parseFlexShorthand('1 0 auto') // → {grow: 1, shrink: 0, basis: 'auto'}
29
- */static parseFlexShorthand(a){// Early returns for invalid inputs
30
- if(null===a||a===void 0)return null;// Handle numeric flex values (e.g., flex: 1)
31
- if("number"==typeof a)return{grow:a,shrink:1,basis:"0%"};if("string"!=typeof a)return null;const b=a.trim().toLowerCase();if(!b)return null;// Handle CSS keyword values
32
- return"none"===b?{grow:0,shrink:0,basis:"auto"}:"auto"===b?{grow:1,shrink:1,basis:"auto"}:"initial"===b?{grow:0,shrink:1,basis:"auto"}:null}}/**
33
- * Resolves theme variable references in an object's values iteratively.
34
- * This function uses a manual work stack to traverse the object, which prevents
35
- * "Maximum call stack size exceeded" errors for deeply nested objects.
36
- * It performs a "smart merge" by using a copy-on-write strategy, creating new
37
- * objects/arrays only when a value inside them has changed. This preserves
38
- * object references for unchanged parts of the tree, which is critical for
39
- * React's reconciliation and memoization.
40
- *//**
41
- * Resolves default CSS styles to fix common flexbox layout issues.
42
- *
43
- * PRIMARY PURPOSE: Fix the flexbox scrolling problem
44
- * ================================================
45
- *
46
- * THE PROBLEM:
47
- * By default, flex items have `min-width: auto` and `min-height: auto`, which means they
48
- * cannot shrink below their content size. This prevents scrollable containers from working
49
- * properly when they are flex items.
50
- *
51
- * THE SOLUTION:
52
- * 1. Set `minHeight: 0` and `minWidth: 0` to allow flex items to shrink
53
- * 2. Control `flexShrink` behavior based on context to prevent unwanted shrinking
54
- * 3. Respect user's explicit values to avoid overriding intentional styling
55
- *
56
- * FLEX SHRINK BEHAVIOR RULES:
57
- * ===========================
58
- *
59
- * For FLEX CONTAINERS:
60
- * - If overflow is NOT handled AND no wrapping → flexShrink: 0 (prevent shrinking)
61
- * - If overflow is handled OR wrapping enabled → flexShrink: undefined (allow default)
62
- *
63
- * For NON-FLEX CONTAINERS (flex items):
64
- * - Always → flexShrink: 0 (prevent unwanted shrinking)
65
- *
66
- * NESTED SCENARIOS:
67
- * ================
68
- * An element can be both a flex container AND a flex item simultaneously.
69
- * This function handles this correctly by checking if the element itself is a container,
70
- * not whether it's inside a flex context.
71
- *
72
- * EXPLICIT VALUE PRESERVATION:
73
- * ===========================
74
- * - If user sets `flexShrink` explicitly → never override
75
- * - If user sets `flex` shorthand → extract and use the shrink value from it
76
- * - Otherwise → apply smart defaults based on context
77
- * @param style The input CSSProperties object to process
78
- * @returns Processed CSSProperties with resolved defaults
79
- * @example
80
- * // Fix scrollable flex item
81
- * resolveDefaultStyle({
82
- * overflow: 'auto',
83
- * height: '200px'
84
- * })
85
- * // → { overflow: 'auto', height: '200px', flexShrink: 0, minHeight: 0, minWidth: 0 }
86
- * @example
87
- * // Flex container with wrapping (allows shrinking)
88
- * resolveDefaultStyle({
89
- * display: 'flex',
90
- * flexWrap: 'wrap'
91
- * })
92
- * // → { display: 'flex', flexWrap: 'wrap', minHeight: 0, minWidth: 0 }
93
- */_ThemeUtil=ThemeUtil,_defineProperty(ThemeUtil,"themeCache",ThemeResolverCache.getInstance()),_defineProperty(ThemeUtil,"isPlainObject",a=>{if("object"!=typeof a||null===a)return!1;const b=Object.getPrototypeOf(a);return null===b||b===Object.prototype}),_defineProperty(ThemeUtil,"resolveObjWithTheme",(a,b,c={})=>{const{processFunctions:d=!1}=c;if(!b||!b.system||"object"!=typeof b.system||0===Object.keys(b.system).length||!a||0===Object.keys(a).length)return a;const e=b.system;if(_ThemeUtil.themeCache.shouldCache()){const c=_ThemeUtil.themeCache.getResolution(a,b);if(null!==c)return c}const f=[{value:a,isProcessed:!1}],g=new Map,h=new Set,i=a=>{const b=_ThemeUtil.themeCache.getThemeRegex();let c=!1;const d=a.replace(b,(a,b)=>{let d=_ThemeUtil.themeCache.getPathLookup(e,b);if(null===d&&(d=getValueByPath(e,b),_ThemeUtil.themeCache.setPathLookup(e,b,d)),void 0!==d&&null!==d){if(c=!0,"object"==typeof d){if(!Array.isArray(d)&&"default"in d)return d.default;throw new Error("The provided theme path is invalid!")}return d}return a});return c?d:a};// Used for cycle detection within the current traversal path.
94
- for(;0<f.length;){const a=f[f.length-1],c=a.value;if(!_ThemeUtil.isPlainObject(c)&&!Array.isArray(c)){f.pop();continue}if(g.has(c)){f.pop();continue}if(!a.isProcessed){a.isProcessed=!0,h.add(c);const b=Array.isArray(c)?c:Object.values(c);for(let a=b.length-1;0<=a;a--){const c=b[a];// Only push containers that are not already in the current path (cycle detection).
95
- (_ThemeUtil.isPlainObject(c)||Array.isArray(c))&&!h.has(c)&&f.push({value:c,isProcessed:!1})}}else{f.pop(),h.delete(c);// Unwind the path
96
- let a=c;if(Array.isArray(c)){let b=null;for(let a=0;a<c.length;a++){const d=c[a],e=g.get(d)??d;e!==d&&(null===b&&(b=[...c]),b[a]=e)}null!==b&&(a=b)}else{let e=null;for(const a in c)if(Object.prototype.hasOwnProperty.call(c,a)){const f=c[a];let h=g.get(f)??f;if("function"==typeof h&&d){const a=h(b);h="string"==typeof a&&a.includes("theme.")?i(a):a}else"string"==typeof h&&h.includes("theme.")&&(h=i(h));h!==f&&(null===e&&(e=_objectSpread({},c)),e[a]=h)}null!==e&&(a=e)}g.set(c,a)}}const j=g.get(a)??a;return _ThemeUtil.themeCache.shouldCache()&&_ThemeUtil.themeCache.setResolution(a,b,j),j}),_defineProperty(ThemeUtil,"clearThemeCache",()=>{_ThemeUtil.themeCache.clear()}),_defineProperty(ThemeUtil,"resolveDefaultStyle",a=>{if(null===a||a===void 0||"string"==typeof a||"number"==typeof a||"boolean"==typeof a)return{};// === STEP 1: EXTRACT FLEX PROPERTY ===
97
- // Extract flex shorthand to handle it separately from individual flex properties
98
- const b=a,{flex:c}=b,d=_objectWithoutProperties(b,_excluded),e="flex"===d.display||"inline-flex"===d.display,f=!!(d.overflow||d.overflowY||d.overflowX),g=d.flexFlow?.includes("wrap")||"wrap"===d.flexWrap||"wrap-reverse"===d.flexWrap,h="flexShrink"in a&&a.flexShrink!==void 0,i=c?_ThemeUtil.parseFlexShorthand(c):null;// === STEP 2: ANALYZE LAYOUT CONTEXT ===
99
- // Determine what kind of element we're dealing with
100
- // Check if overflow is set (any overflow value indicates potential scrolling)
101
- // Check if flex wrapping is enabled (allows items to wrap to new lines)
102
- // === STEP 3: CHECK FOR EXPLICIT USER VALUES ===
103
- // Respect user's explicit flexShrink setting
104
- // Extract shrink value from flex shorthand if provided
105
- // === STEP 4: DETERMINE FLEX SHRINK BEHAVIOR ===
106
- let j;// Only set flexShrink if user hasn't explicitly provided it
107
- if(!h)// If flex shorthand contains a shrink value, use that
108
- if(i)j=i.shrink;else// Apply context-based defaults
109
- if(!e)// NON-FLEX CONTAINER LOGIC:
110
- // Default flex-shrink to 0 to prevent unwanted shrinking of flex items
111
- j=0;else// FLEX CONTAINER LOGIC:
112
- // Only prevent shrinking when container is constrained (no overflow handling, no wrapping)
113
- if(!f){const a="column"===d.flexDirection||"column-reverse"===d.flexDirection,b="row"===d.flexDirection||"row-reverse"===d.flexDirection||!d.flexDirection;a&&!g?j=0:b&&!g&&(j=0)}// === STEP 5: RETURN RESOLVED STYLES ===
114
- // Combine all processed styles with essential defaults
115
- return _objectSpread({flex:c,// Preserve original flex shorthand
116
- flexShrink:j,// Apply computed or explicit flexShrink
117
- minHeight:0,// Fix flex item scrolling issues
118
- minWidth:0},d)});
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes