@meonode/ui 0.4.11 → 0.4.13

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 (158) hide show
  1. package/CHANGELOG.md +32 -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/{components → esm/components}/meonode-unmounter.client.d.ts +1 -1
  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/esm/util/node.util.d.ts.map +1 -0
  75. package/dist/esm/util/node.util.js +1 -0
  76. package/dist/esm/util/theme.util.d.ts.map +1 -0
  77. package/dist/esm/util/theme.util.js +1 -0
  78. package/package.json +21 -19
  79. package/dist/client.d.ts.map +0 -1
  80. package/dist/client.js +0 -6
  81. package/dist/components/html.node.d.ts.map +0 -1
  82. package/dist/components/html.node.js +0 -632
  83. package/dist/components/meonode-unmounter.client.d.ts.map +0 -1
  84. package/dist/components/meonode-unmounter.client.js +0 -17
  85. package/dist/components/react.node.d.ts.map +0 -1
  86. package/dist/components/react.node.js +0 -43
  87. package/dist/components/registry.client.d.ts.map +0 -1
  88. package/dist/components/registry.client.js +0 -14
  89. package/dist/components/styled-renderer.client.d.ts.map +0 -1
  90. package/dist/components/styled-renderer.client.js +0 -10
  91. package/dist/components/theme-provider.client.d.ts.map +0 -1
  92. package/dist/components/theme-provider.client.js +0 -8
  93. package/dist/components/theme-provider.d.ts.map +0 -1
  94. package/dist/components/theme-provider.js +0 -3
  95. package/dist/constant/common.const.d.ts.map +0 -1
  96. package/dist/constant/common.const.js +0 -1
  97. package/dist/constant/css-properties.const.d.ts.map +0 -1
  98. package/dist/core.node.d.ts.map +0 -1
  99. package/dist/core.node.js +0 -139
  100. package/dist/helper/common.helper.d.ts.map +0 -1
  101. package/dist/helper/common.helper.js +0 -73
  102. package/dist/helper/obj.helper.d.ts.map +0 -1
  103. package/dist/helper/obj.helper.js +0 -23
  104. package/dist/helper/react-is.helper.d.ts.map +0 -1
  105. package/dist/helper/react-is.helper.js +0 -94
  106. package/dist/hoc/component.hoc.d.ts.map +0 -1
  107. package/dist/hoc/component.hoc.js +0 -50
  108. package/dist/hoc/index.d.ts.map +0 -1
  109. package/dist/hoc/index.js +0 -1
  110. package/dist/hoc/portal.hoc.d.ts.map +0 -1
  111. package/dist/hoc/portal.hoc.js +0 -73
  112. package/dist/hook/index.d.ts.map +0 -1
  113. package/dist/hook/index.js +0 -1
  114. package/dist/hook/usePortal.d.ts.map +0 -1
  115. package/dist/hook/usePortal.js +0 -4
  116. package/dist/hook/useTheme.d.ts.map +0 -1
  117. package/dist/hook/useTheme.js +0 -8
  118. package/dist/main.d.ts.map +0 -1
  119. package/dist/main.js +0 -7
  120. package/dist/nextjs-registry/index.d.ts.map +0 -1
  121. package/dist/nextjs-registry/index.js +0 -1
  122. package/dist/types/env.d.js +0 -1
  123. package/dist/types/node.type.d.ts.map +0 -1
  124. package/dist/types/node.type.js +0 -1
  125. package/dist/util/mount-tracker.util.d.ts.map +0 -1
  126. package/dist/util/mount-tracker.util.js +0 -15
  127. package/dist/util/navigation-cache-manager.util.d.ts.map +0 -1
  128. package/dist/util/navigation-cache-manager.util.js +0 -19
  129. package/dist/util/node.util.d.ts.map +0 -1
  130. package/dist/util/node.util.js +0 -241
  131. package/dist/util/theme.util.d.ts.map +0 -1
  132. package/dist/util/theme.util.js +0 -112
  133. /package/dist/{client.d.ts → esm/client.d.ts} +0 -0
  134. /package/dist/{components → esm/components}/html.node.d.ts +0 -0
  135. /package/dist/{components → esm/components}/react.node.d.ts +0 -0
  136. /package/dist/{components → esm/components}/registry.client.d.ts +0 -0
  137. /package/dist/{components → esm/components}/styled-renderer.client.d.ts +0 -0
  138. /package/dist/{components → esm/components}/theme-provider.client.d.ts +0 -0
  139. /package/dist/{components → esm/components}/theme-provider.d.ts +0 -0
  140. /package/dist/{constant → esm/constant}/common.const.d.ts +0 -0
  141. /package/dist/{constant → esm/constant}/css-properties.const.d.ts +0 -0
  142. /package/dist/{core.node.d.ts → esm/core.node.d.ts} +0 -0
  143. /package/dist/{helper → esm/helper}/common.helper.d.ts +0 -0
  144. /package/dist/{helper → esm/helper}/obj.helper.d.ts +0 -0
  145. /package/dist/{helper → esm/helper}/react-is.helper.d.ts +0 -0
  146. /package/dist/{hoc → esm/hoc}/component.hoc.d.ts +0 -0
  147. /package/dist/{hoc → esm/hoc}/index.d.ts +0 -0
  148. /package/dist/{hoc → esm/hoc}/portal.hoc.d.ts +0 -0
  149. /package/dist/{hook → esm/hook}/index.d.ts +0 -0
  150. /package/dist/{hook → esm/hook}/usePortal.d.ts +0 -0
  151. /package/dist/{hook → esm/hook}/useTheme.d.ts +0 -0
  152. /package/dist/{main.d.ts → esm/main.d.ts} +0 -0
  153. /package/dist/{nextjs-registry → esm/nextjs-registry}/index.d.ts +0 -0
  154. /package/dist/{types → esm/types}/node.type.d.ts +0 -0
  155. /package/dist/{util → esm/util}/mount-tracker.util.d.ts +0 -0
  156. /package/dist/{util → esm/util}/navigation-cache-manager.util.d.ts +0 -0
  157. /package/dist/{util → esm/util}/node.util.d.ts +0 -0
  158. /package/dist/{util → esm/util}/theme.util.d.ts +0 -0
@@ -1,43 +0,0 @@
1
- import{Fragment as BaseFragment,Activity as BaseActivity,Suspense as BaseSuspense}from"react";import{createNode}from"../core.node.js";/**
2
- * A container that does not render any extra DOM element.
3
- * @see {@link https://react.dev/reference/react/Fragment React Docs}
4
- * @example
5
- *
6
- * ```typescript
7
- * import { Fragment, Div, Span } from '@meonode/ui';
8
- *
9
- * Fragment({
10
- * children: [
11
- * Div('First Div'),
12
- * Span('A Span inside Fragment'),
13
- * Div('Second Div'),
14
- * ],
15
- * })
16
- * ```
17
- */export const Fragment=createNode(BaseFragment);/**
18
- * Lets you hide and restore the UI and internal state of its children.
19
- * @see {@link https://react.dev/reference/react/Activity React Docs}
20
- * @example
21
- *
22
- * ```typescript
23
- * import { Activity } from '@meonode/ui';
24
- *
25
- * Activity({
26
- * mode: isShowingSidebar ? "visible" : "hidden",
27
- * children: Div(...),
28
- * })
29
- * ```
30
- */export const Activity=createNode(BaseActivity);/**
31
- * Lets you display a fallback until its children have finished loading.
32
- * @see {@link https://react.dev/reference/react/Suspense React Docs}
33
- * @example
34
- *
35
- * ```typescript
36
- * import { Suspense } from '@meonode/ui';
37
- *
38
- * Suspense({
39
- * fallback: 'Loading...',
40
- * children: Div(...),
41
- * })
42
- * ```
43
- */export const Suspense=createNode(BaseSuspense);
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.client.d.ts","sourceRoot":"","sources":["../../src/components/registry.client.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,YAAY,EAAY,MAAM,OAAO,CAAA;AAWlE;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,YAAY,CAAA;CAAE,yGA4B7E"}
@@ -1,14 +0,0 @@
1
- "use client";import{createElement,useState}from"react";import{CacheProvider}from"@emotion/react";import createCache from"@emotion/cache";import{Node}from"../core.node.js";import{useServerInsertedHTML}from"next/navigation.js";// Emotion cache setup
2
- function createEmotionCache(){return createCache({key:"meonode-css"})}/**
3
- * Style registry for Emotion to support SSR/streaming in Next.js App Router.
4
- *
5
- * - Creates a single Emotion cache instance in compat mode.
6
- * - Uses `useServerInsertedHTML` to inline critical CSS collected during render.
7
- * @param children React subtree that consumes Emotion styles.
8
- * @returns React element that provides the cache and injects critical CSS during SSR.
9
- */export default function StyleRegistry({children:a}){// Lazily create a single Emotion cache; enable compat for SSR/legacy Emotion APIs.
10
- const[b]=useState(()=>{const a=createEmotionCache();return a.compat=!0,a});// During server rendering, collect styles inserted into the cache and inline them in the HTML.
11
- // Provide the Emotion cache to descendants.
12
- return useServerInsertedHTML(()=>{// Ensure deterministic output by sorting ids.
13
- const a=Object.keys(b.inserted).sort(),c=a.map(a=>b.inserted[a]).join(""),d=a.join(" ");return c?createElement("style",{"data-emotion":`${b.key} ${d}`,dangerouslySetInnerHTML:{__html:c}}):null;// Insert a single style tag with the tracked Emotion ids.
14
- }),Node(CacheProvider,{value:b,children:a}).render()}
@@ -1 +0,0 @@
1
- {"version":3,"file":"styled-renderer.client.d.ts","sourceRoot":"","sources":["../../src/components/styled-renderer.client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,SAAS,EAAc,MAAM,OAAO,CAAA;AAE5D,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAInE,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,WAAW;IACxD,OAAO,EAAE,CAAC,CAAA;IACV,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,GAAG,EAAE,OAAO,CAAA;CACb;AAED;;;;;;;;;GASG;AACH,iBAAwB,cAAc,CAAC,CAAC,SAAS,WAAW,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAChG,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,GAAG,CAAC,OAAO,CAoB/C"}
@@ -1,10 +0,0 @@
1
- "use client";const _excluded=["element","children"],_excluded2=["css"];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)}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}import{useContext}from"react";import{jsx}from"@emotion/react";import{ThemeContext}from"./theme-provider.client.js";import{ThemeUtil}from"../util/theme.util.js";/**
2
- * A client-side component that renders a styled element using Emotion.
3
- * It resolves theme values and applies default styles.
4
- * @template E The type of the HTML element to render.
5
- * @template TProps The type of the props for the component.
6
- * @param element The HTML element to render (e.g., 'div', 'span').
7
- * @param children Optional children to be rendered inside the element.
8
- * @param props
9
- * @returns {JSX.Element} The rendered JSX element.
10
- */export default function StyledRenderer(a){let{element:b,children:c}=a,d=_objectWithoutProperties(a,_excluded);const e=useContext(ThemeContext),f=e?.theme,{css:g}=d,h=_objectWithoutProperties(d,_excluded2);let i=g,j=h;f&&(i=ThemeUtil.resolveObjWithTheme(g,f,{processFunctions:!0}),j=ThemeUtil.resolveObjWithTheme(h,f,{processFunctions:!1}));const k=ThemeUtil.resolveDefaultStyle(i);return jsx(b,_objectSpread(_objectSpread({},j),{},{css:k}),c)}StyledRenderer.displayName="Styled";
@@ -1 +0,0 @@
1
- {"version":3,"file":"theme-provider.client.d.ts","sourceRoot":"","sources":["../../src/components/theme-provider.client.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,SAAS,EAAY,MAAM,OAAO,CAAA;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAG9D,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,KAAK,CAAA;IACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;CACjC;AAED,eAAO,MAAM,YAAY,mDAAgD,CAAA;AAEzE;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GAAG,SAAS,CAgB3G"}
@@ -1,8 +0,0 @@
1
- "use client";import{createContext,useState}from"react";import{Node}from"../core.node.js";export const ThemeContext=createContext(null);/**
2
- * The internal implementation of the ThemeProvider component.
3
- * @param {object} props The props for the component.
4
- * @param {Children} [props.children] The children to render.
5
- * @param {Theme} props.theme The theme to provide.
6
- * @returns {ReactNode} The rendered component.
7
- * @private
8
- */export default function ThemeProvider({children:a,theme:b}){const[c,d]=useState(b);if(!b)throw new Error("`theme` prop must be defined");return Node(ThemeContext.Provider,{value:{theme:c,setTheme:a=>{document.cookie=`theme=${a.mode}; path=/;`,d(a)}},children:a}).render()}
@@ -1 +0,0 @@
1
- {"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../../src/components/theme-provider.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,0CAA0C,CAAA;AAErE;;GAEG;AACH,eAAO,MAAM,aAAa;;CAA6B,CAAA"}
@@ -1,3 +0,0 @@
1
- import{createNode}from"../core.node.js";import _ThemeProvider from"./theme-provider.client.js";/**
2
- * A component that provides a theme to its children.
3
- */export const ThemeProvider=createNode(_ThemeProvider);
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.const.d.ts","sourceRoot":"","sources":["../../src/constant/common.const.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,uOAwBhB,CAAA;AAEV,eAAO,MAAM,cAAc,uPAAyB,CAAA;AACpD,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAA;AAEhD,eAAO,IAAI,SAAS,SAAQ,CAAA;AAE5B,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,QAK5C"}
@@ -1 +0,0 @@
1
- export const NO_STYLE_TAGS=["html","head","meta","link","script","style","noscript","template","slot","base","param","source","track","wbr","embed","object","iframe","frame","frameset","applet","bgsound","noembed","noframes"];export const noStyleTagsSet=new Set(NO_STYLE_TAGS);export let __DEBUG__=!1;export function setDebugMode(a){__DEBUG__=a,__DEBUG__&&console.log("[MeoNode] Debug mode enabled.")}
@@ -1 +0,0 @@
1
- {"version":3,"file":"css-properties.const.d.ts","sourceRoot":"","sources":["../../src/constant/css-properties.const.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,aAAa,k0ZAirBT,CAAA;AAEV,eAAe,aAAa,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../src/core.node.ts"],"names":[],"mappings":"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"}
package/dist/core.node.js DELETED
@@ -1,139 +0,0 @@
1
- const _excluded=["ref","children"],_excluded2=["key"],_excluded3=["children","key","css","nativeProps","disableEmotion"];var _BaseNode;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{createElement,Fragment,isValidElement}from"react";import{isFragment,isValidElementType}from"./helper/react-is.helper.js";import{getComponentType,getElementTypeName,hasNoStyleTag}from"./helper/common.helper.js";import StyledRenderer from"./components/styled-renderer.client.js";import{__DEBUG__}from"./constant/common.const.js";import{MountTrackerUtil}from"./util/mount-tracker.util.js";import MeoNodeUnmounter from"./components/meonode-unmounter.client.js";import{NavigationCacheManagerUtil}from"./util/navigation-cache-manager.util.js";import{NodeUtil}from"./util/node.util.js";import{ThemeUtil}from"./util/theme.util.js";/**
2
- * The core abstraction of the MeoNode library. It wraps a React element or component,
3
- * providing a unified interface for processing props, normalizing children, and handling styles.
4
- * This class is central to the library's ability to offer a JSX-free, fluent API for building UIs.
5
- * It uses an iterative rendering approach to handle deeply nested structures without causing stack overflows.
6
- * @class BaseNode
7
- * @template E - The type of React element or component this node represents.
8
- */export class BaseNode{static acquireRenderContext(){const a=BaseNode.renderContextPool;return 0<a.length?a.pop():{workStack:Array(512),renderedElements:new Map}}static releaseRenderContext(a){50>BaseNode.renderContextPool.length&&2048>a.workStack.length&&(a.workStack.length=0,a.renderedElements.clear(),BaseNode.renderContextPool.push(a))}constructor(a,b={},c){// Element type validation is performed once at construction to prevent invalid nodes from being created.
9
- if(_defineProperty(this,"instanceId",Math.random().toString(36).slice(2)+Date.now().toString(36)),_defineProperty(this,"rawProps",{}),_defineProperty(this,"isBaseNode",!0),!isValidElementType(a)){const b=getComponentType(a);throw new Error(`Invalid element type: ${b} provided!`)}this.element=a,this.rawProps=b,this._deps=c;// Extract commonly handled props; the remaining `propsForSignature` are used to compute a stable hash.
10
- const{ref:d,children:e}=b,f=_objectWithoutProperties(b,_excluded);// Generate or get cached stable key
11
- this.stableKey=this._getStableKey(f),NodeUtil.isServer||BaseNode._navigationStarted||(NavigationCacheManagerUtil.getInstance().start(),BaseNode._navigationStarted=!0)}/**
12
- * Lazily processes and retrieves the final, normalized props for the node.
13
- * The props are processed only once and then cached for subsequent accesses.
14
- * @getter props
15
- */get props(){return this._props||(this._props=NodeUtil.processProps(this.element,this.rawProps,this.stableKey)),this._props}/**
16
- * Returns the dependency list associated with this node.
17
- * Used by the renderer to decide if the node (and subtree) should update.
18
- * Mirrors React hook semantics: `undefined` means always update; when an
19
- * array is provided a shallow comparison against previous deps determines
20
- * whether a re-render is required.
21
- * @getter deps
22
- */get dependencies(){return this._deps}/**
23
- * Generates or returns a cached signature representing the props shape and values.
24
- * The signature is used as a stable key for caching prop-derived computations (e.g. CSS extraction).
25
- * - Uses a fast reference check to return the previous signature if the same props object is passed.
26
- * - For very large prop objects (> 100 keys) it builds a smaller "criticalProps" fingerprint
27
- * containing only style-related keys, event handlers, className/css and a `_keyCount` to avoid
28
- * expensive serialization of huge objects while still retaining reasonable cache discrimination.
29
- * - Stores the last props reference and computed signature to speed up repeated calls with the same object.
30
- * @param key Key passed for prefix if exist
31
- * @param props The props object to create a signature for.
32
- * @returns A compact string signature suitable for use as a cache key.
33
- */_getStableKey(a){let{key:b}=a,c=_objectWithoutProperties(a,_excluded2);if(NodeUtil.isServer)return;if(this.lastPropsObj===c)return this.lastSignature;this.lastPropsObj=c;const d=Object.keys(c),e=d.length;if(100<e){const a=NodeUtil.extractCriticalProps(c,d);this.lastSignature=NodeUtil.createPropSignature(this.element,a),__DEBUG__&&200<e&&console.warn(`MeoNode: Large props (${e} keys) on "${getElementTypeName(this.element)}". Consider splitting.`)}else this.lastSignature=NodeUtil.createPropSignature(this.element,c);return b!==void 0&&null!==b?`${b+""}:${this.lastSignature}`:this.lastSignature}/**
34
- * FinalizationRegistry for cleaning up `elementCache` entries when the associated `BaseNode` instance
35
- * is garbage-collected. This helps prevent memory leaks by ensuring that cache entries for
36
- * unreferenced nodes are eventually removed.
37
- *
38
- * The held value must include `cacheKey` which is used to identify and delete the corresponding
39
- * entry from `BaseNode.elementCache`.
40
- * @public
41
- *//**
42
- * Renders the `BaseNode` and its entire subtree into a ReactElement, with support for opt-in reactivity
43
- * via dependency arrays and inherited blocking.
44
- *
45
- * This method uses an **iterative (non-recursive) approach** with a manual work stack.
46
- * This is a crucial architectural choice to prevent "Maximum call stack size exceeded" errors
47
- * when rendering very deeply nested component trees, a common limitation of naive recursive rendering.
48
- *
49
- * The process works in two phases for each node:
50
- * 1. **Begin Phase:** When a node is first visited, its children are pushed onto the stack. This ensures a bottom-up build.
51
- * 2. **Complete Phase:** After all of a node's descendants have been rendered, the loop returns to the node.
52
- * It then collects the rendered children from a temporary map and creates its own React element.
53
- * @method render
54
- */render(a=!1){!NodeUtil.isServer&&this.stableKey&&MountTrackerUtil.trackMount(this.stableKey);// On server, we never reuse cached elements because that can cause hydration mismatches.
55
- const b=NodeUtil.isServer||!this.stableKey?void 0:BaseNode.elementCache.get(this.stableKey),c=NodeUtil.shouldNodeUpdate(b?.prevDeps,this._deps,a);// Decide whether this node (and its subtree) should update given dependency arrays.
56
- // Fast return: if nothing should update and we have a cached element, reuse it.
57
- if(!c&&b?.renderedElement)return b.accessCount+=1,b.renderedElement;// When this node doesn't need update, its children are considered "blocked" and may be skipped.
58
- const d=BaseNode.acquireRenderContext();// Acquire context from pool to reduce allocation pressure
59
- let{workStack:e}=d;const{renderedElements:f}=d;let g=0;try{// Fast capacity check with exponential growth
60
- const a=a=>{if(a>e.length){// Double capacity or use exact requirement (whichever is larger)
61
- const b=Math.max(a,e.length<<1),c=Array(b);// Manual copy is faster than Array methods for primitive/object arrays
62
- for(let a=0;a<g;a++)c[a]=e[a];e=c}};// Push initial work item
63
- // Iterative depth-first traversal with explicit begin/complete phases to avoid recursion.
64
- for(e[g++]={node:this,isProcessed:!1,blocked:!c};0<g;){const b=e[g-1];if(!b){g--;continue}const{node:c,isProcessed:d,blocked:h}=b;if(!d){b.isProcessed=!0;const d=c.props.children;if(d){// Only consider BaseNode children for further traversal; primitives and React elements are terminal.
65
- const b=(Array.isArray(d)?d:[d]).filter(NodeUtil.isNodeInstance),c=g+b.length;// --- Check capacity ONCE before loop ---
66
- a(c);for(let a=b.length-1;0<=a;a--){const c=b[a],d=NodeUtil.isServer||!c.stableKey?void 0:BaseNode.elementCache.get(c.stableKey),i=NodeUtil.shouldNodeUpdate(d?.prevDeps,c._deps,h);// Respect server/client differences for child cache lookup.
67
- // Determine whether the child should update given its deps and the parent's blocked state.
68
- // If child doesn't need update and has cached element, reuse it immediately (no push).
69
- if(!i&&d?.renderedElement){f.set(c,d.renderedElement);continue}// Otherwise push child for processing; childBlocked inherits parent's blocked state.
70
- const j=h||!i;e[g++]={node:c,isProcessed:!1,blocked:j}}}}else{g--;// Extract node props. Non-present props default to undefined via destructuring.
71
- const a=c.props,{children:b,key:d,css:e,nativeProps:h,disableEmotion:i}=a,j=_objectWithoutProperties(a,_excluded3);let k=[];if(b){// Convert child placeholders into concrete React nodes:
72
- // - If it's a BaseNode, lookup its rendered ReactElement from the map.
73
- // - If it's already a React element, use it directly.
74
- // - Otherwise treat as primitive ReactNode.
75
- const a=Array.isArray(b)?b:[b],c=a.length;// Pre-allocate array to avoid resizing during iteration
76
- k=Array(c);for(let b=0;b<c;b++){const c=a[b];if(NodeUtil.isNodeInstance(c)){const a=f.get(c);if(!a)throw new Error(`[MeoNode] Missing rendered element for child node: ${c.stableKey}`);k[b]=a}else k[b]=isValidElement(c)?c:c}}// Merge element props: explicit other props + DOM native props + React key.
77
- const l=_objectSpread(_objectSpread({},j),{},{key:d},h);let m;// Handle fragments specially: create fragment element with key and children.
78
- if(c.element===Fragment||isFragment(c.element))m=createElement(c.element,{key:d},...k);else{// StyledRenderer for emotion-based styling unless explicitly disabled or no styles are present.
79
- // StyledRenderer handles SSR hydration and emotion CSS injection when css prop exists or element has style tags.
80
- const a=!i&&(e||!hasNoStyleTag(c.element));m=a?createElement(StyledRenderer,_objectSpread(_objectSpread({element:c.element},l),{},{css:e,suppressHydrationWarning:!0}),...k):createElement(c.element,l,...k)}// Cache the generated element on client-side to speed up future renders.
81
- if(!NodeUtil.isServer&&c.stableKey){const a=BaseNode.elementCache.get(c.stableKey);if(a)a.prevDeps=c._deps,a.renderedElement=m,a.accessCount+=1;else{// Create new cache entry and register for cleanup
82
- const a={prevDeps:c._deps,renderedElement:m,nodeRef:new WeakRef(c),createdAt:Date.now(),accessCount:1,instanceId:c.instanceId};// Set new cache entry
83
- BaseNode.elementCache.set(c.stableKey,a),BaseNode.cacheCleanupRegistry.register(c,{cacheKey:c.stableKey,instanceId:c.instanceId},c)}}// Store the rendered element so parent nodes can reference it.
84
- f.set(c,m)}}// Get the final rendered element for the root node of this render cycle.
85
- const b=f.get(this);return!NodeUtil.isServer&&this.stableKey?createElement(MeoNodeUnmounter,{node:this},b):b}finally{// Always release context back to pool, even if an exception occurred
86
- // Null out workStack slots to help GC before releasing
87
- for(let a=0;a<g;a++)e[a]=null;BaseNode.releaseRenderContext({workStack:e,renderedElements:f})}}/**
88
- * Renders the node into a React Portal, mounting it directly under `document.body`.
89
- * Returns a handle with `update` and `unmount` methods to control the portal's lifecycle.
90
- * @method toPortal
91
- */toPortal(){if(!NodeUtil.ensurePortalInfrastructure(this))throw new Error("toPortal() can only be called in a client-side environment");const a=NodeUtil.portalInfrastructure.get(this),{domElement:b,reactRoot:c}=a,d=()=>{try{c.render(this.render())}catch(a){__DEBUG__&&console.error("[MeoNode] Portal render error:",a)}};d();// Track if already unmounted to make unmount idempotent
92
- let e=!1;const f=c.unmount.bind(c);return c.update=a=>{if(e)return void(__DEBUG__&&console.warn("[MeoNode] Attempt to update already-unmounted portal"));try{const b=NodeUtil.isNodeInstance(a)?a.render():a;c.render(b)}catch(a){__DEBUG__&&console.error("[MeoNode] Portal update error:",a)}},c.unmount=()=>{// Idempotent guard
93
- if(e)return void(__DEBUG__&&console.warn("[MeoNode] Portal already unmounted"));e=!0;// Unregister FIRST to prevent FinalizationRegistry from firing
94
- try{BaseNode.portalCleanupRegistry.unregister(this)}catch(a){__DEBUG__&&console.warn("[MeoNode] Portal unregister warning:",a)}// Remove from WeakMap
95
- NodeUtil.portalInfrastructure.delete(this);// Now do the actual cleanup
96
- try{b?.isConnected&&f()}catch(a){__DEBUG__&&console.error("[MeoNode] Portal unmount error:",a)}try{b?.isConnected&&b.remove()}catch(a){__DEBUG__&&console.error("[MeoNode] Portal DOM cleanup error:",a)}},c}/**
97
- * A static method to clear all internal caches.
98
- *
99
- * This method performs manual cleanup of all cache entries, calling their
100
- * `onEvict` callbacks before clearing. Note that FinalizationRegistry entries
101
- * are not manually cleared as they will be garbage collected naturally when
102
- * the associated nodes are collected.
103
- * @method clearCaches
104
- */static clearCaches(){// Collect all cache keys first
105
- const a=Array.from(BaseNode.elementCache.keys());__DEBUG__&&console.log(`[MeoNode] clearCaches: Clearing ${a.length} entries`);// Call onEvict for all entries (idempotent) and clear node properties
106
- for(const b of a){const a=BaseNode.elementCache.get(b);if(a){// Try to unregister from FinalizationRegistry
107
- const c=a.nodeRef?.deref();if(c)try{BaseNode.cacheCleanupRegistry.unregister(c),c.lastSignature=void 0,c.lastPropsObj=void 0}catch(a){__DEBUG__&&console.warn(`[MeoNode] Could not unregister ${b} from FinalizationRegistry`)}}}// Clear all caches
108
- // Clear mount tracking
109
- BaseNode.propProcessingCache.clear(),BaseNode.elementCache.clear(),ThemeUtil.clearThemeCache(),MountTrackerUtil.cleanup(),__DEBUG__&&console.log("[MeoNode] All caches cleared")}// --- Utilities ---
110
- }// --- Factory Functions ---
111
- /**
112
- * The primary factory function for creating a `BaseNode` instance.
113
- * It's the simplest way to wrap a component or element.
114
- * @function Node
115
- */_BaseNode=BaseNode,_defineProperty(BaseNode,"elementCache",new Map),_defineProperty(BaseNode,"propProcessingCache",new Map),_defineProperty(BaseNode,"scheduledCleanup",!1),_defineProperty(BaseNode,"_navigationStarted",!1),_defineProperty(BaseNode,"renderContextPool",[]),_defineProperty(BaseNode,"cacheCleanupRegistry",new FinalizationRegistry(a=>{const{cacheKey:b,instanceId:c}=a,d=_BaseNode.elementCache.get(b);d?.instanceId===c&&_BaseNode.elementCache.delete(b),MountTrackerUtil.mountedNodes.has(b)&&MountTrackerUtil.untrackMount(b)})),_defineProperty(BaseNode,"portalCleanupRegistry",new FinalizationRegistry(a=>{const{domElement:b,reactRoot:c}=a;__DEBUG__&&console.log("[MeoNode] FinalizationRegistry auto-cleaning portal");// Guard: Check if already unmounted
116
- try{c&&"function"==typeof c.unmount&&c.unmount()}catch(a){__DEBUG__&&console.error("[MeoNode] Portal auto-cleanup unmount error:",a)}// Guard: Check if DOM element still connected
117
- try{b?.isConnected&&b.remove()}catch(a){__DEBUG__&&console.error("[MeoNode] Portal auto-cleanup DOM removal error:",a)}}));function Node(a,b={},c){return new BaseNode(a,b,c)}/**
118
- * Static alias on the `Node` factory for clearing all internal caches used by `BaseNode`.
119
- *
120
- * Use cases include:
121
- * - resetting state between tests,
122
- * - hot-module-replacement (HMR) cycles,
123
- * - manual resets in development,
124
- * - or during SPA navigation to avoid stale cached elements/styles.
125
- *
126
- * Notes:
127
- * - Clears only internal prop/element caches; does not touch portal infrastructure or external runtime state.
128
- * - Safe to call on the server, but most useful on the client.
129
- * @method Node.clearCaches
130
- */Node.clearCaches=BaseNode.clearCaches;// Export the Node factory as the main export
131
- export{Node};/**
132
- * Creates a curried node factory for a given React element or component type.
133
- * This is useful for creating reusable, specialized factory functions (e.g., `const Div = createNode('div')`).
134
- * @function createNode
135
- */export function createNode(a,b){const c=(c,d)=>Node(a,_objectSpread(_objectSpread({},b),c),d);return c.element=a,c}/**
136
- * Creates a node factory function where the first argument is `children` and the second is `props`.
137
- * This provides a more ergonomic API for components that primarily wrap content (e.g., `P('Some text')`).
138
- * @function createChildrenFirstNode
139
- */export function createChildrenFirstNode(a,b){const c=(c,d,e)=>Node(a,_objectSpread(_objectSpread(_objectSpread({},b),d),{},{children:c}),e);return c.element=a,c}
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.helper.d.ts","sourceRoot":"","sources":["../../src/helper/common.helper.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAExF,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAGvE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,iCAE1B,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,oDAmC5B,CAAA;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAsFxD;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,GAAG,CAAC,MAAM,CAA0B,CAAA;AAEjE;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAU3F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAUjH;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,CAAC,EAAE,WAAW,GAAG,OAAO,CAGxD;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAQ1F;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAQlE"}
@@ -1,73 +0,0 @@
1
- import{isContextConsumer,isContextProvider,isElement,isForwardRef,isFragment,isLazy,isMemo,isPortal,isProfiler,isReactClassComponent,isStrictMode,isSuspense,isSuspenseList}from"./react-is.helper.js";import cssProperties from"../constant/css-properties.const.js";import{noStyleTagsSet}from"../constant/common.const.js";/**
2
- * Retrieves a deeply nested value from an object using a dot-separated string path.
3
- *
4
- * This function traverses an object based on the provided path, which is a
5
- * string of keys separated by dots. It returns the value found at the end of
6
- * the path or `undefined` if any key in the path is not found or if the object
7
- * is nullish at any point during traversal.
8
- * @param obj The object to traverse, defaults to an empty object if not provided.
9
- * @param path The dot-separated path string (e.g., 'background.primary').
10
- * @returns The value at the specified path, or undefined if not found.
11
- */export const getValueByPath=(a,b)=>b.split(".").reduce((a,b)=>a&&void 0!==a[b]?a[b]:void 0,a);/**
12
- * Returns a string describing the type of a given React component or element.
13
- *
14
- * Checks for common React types (class, forwardRef, memo, etc.) and returns a string
15
- * such as 'class', 'forwardRef', 'memo', 'object-with-render', 'function', or other
16
- * React-specific types. Falls back to `typeof` or 'unknown' if not recognized.
17
- * @param component The React component, element type, or element-like object to check.
18
- * @returns A string describing the component type.
19
- * @example
20
- * getComponentType(class extends React.Component {}) // 'class'
21
- * getComponentType(React.forwardRef(() => <div/>)) // 'forwardRef'
22
- * getComponentType(React.memo(() => <div/>)) // 'memo'
23
- * getComponentType(() => <div/>) // 'function'
24
- */export const getComponentType=a=>isForwardRef(a)?"forwardRef":isMemo(a)?"memo":isFragment(a)?"fragment":isPortal(a)?"portal":isProfiler(a)?"profiler":isStrictMode(a)?"strict-mode":isSuspense(a)?"suspense":isSuspenseList(a)?"suspense-list":isContextConsumer(a)?"context-consumer":isContextProvider(a)?"context-provider":isLazy(a)?"lazy":isElement(a)?"element":isReactClassComponent(a)?"class":typeof a;/**
25
- * Generates a string name for an ElementType or ReactElement.
26
- *
27
- * This function attempts to extract a meaningful name from a React ElementType
28
- * (string, function, class, HOC) or a ReactElement instance.
29
- * It prioritizes `displayName` and `name` properties and unwraps HOCs like
30
- * `React.memo` and `React.forwardRef` to get the underlying component name.
31
- *
32
- * If a name cannot be determined, it returns a fallback like 'UnknownElementType' or 'AnonymousComponent'.
33
- * @param node The ElementType or ReactElement (e.g., 'div', MyComponent, <MyComponent />).
34
- * @returns A string representation of the element type's name.
35
- */export function getElementTypeName(a){function getDisplayName(a,b){const c=a?.displayName||a?.name;return!c||"render"===c?b:c}if(null===a||a===void 0)return"UnknownElementType";const b=a,c=getComponentType(b);return"string"===c?a:"class"===c?getDisplayName(b,"ClassComponent"):"function"===c?getDisplayName(b,"AnonymousFunctionComponent"):"forwardRef"===c?getDisplayName(b,"")||getDisplayName(b.render,"")||"ForwardRefComponent":"memo"===c?getDisplayName(b,"")||(b.type?getElementTypeName(b.type):"MemoComponent"):"element"===c?getElementTypeName(b.type):"fragment"===c?"Fragment":"portal"===c?"Portal":"profiler"===c?getDisplayName(b,"Profiler"):"strict-mode"===c?"StrictMode":"suspense"===c?getDisplayName(b,"Suspense"):"suspense-list"===c?"SuspenseList":"context-consumer"===c?b._context?.displayName?`${b._context.displayName}.Consumer`:"ContextConsumer":"context-provider"===c?b._context?.displayName?`${b._context.displayName}.Provider`:"ContextProvider":"lazy"===c?getDisplayName(b,"LazyComponent"):"object"===c?getDisplayName(b,"")?getDisplayName(b,""):"function"==typeof b.render?getDisplayName(b.render,"ObjectWithRender"):b.type&&b.type!==a?`Wrapped<${getElementTypeName(b.type)}>`:getDisplayName(b,"ObjectComponent"):"symbol"===c?"symbol"==typeof a?a.description?.replace(/^react\./,"").split(".").map(a=>a[0]?.toUpperCase()+a.slice(1)).join("")||a.toString():"SymbolComponent":"unknown"===c?"UnknownElementType":`UnsupportedType<${c}>`}/**
36
- * A set of valid CSS property names in camelCase, including CSS custom properties, used for validation.
37
- * This set contains all CSS properties including non-standard vendor prefixed properties.
38
- */export const CSSPropertySet=new Set(cssProperties);/**
39
- * Filters an object to only include valid CSS properties
40
- * @param props The object containing potential CSS properties
41
- * @returns An object containing only valid CSS properties
42
- * @example
43
- * ```ts
44
- * getCSSProps({
45
- * backgroundColor: 'red',
46
- * invalid: true
47
- * }) // { backgroundColor: 'red' }
48
- * ```
49
- */export function getCSSProps(a){const b={};for(const c in a)Object.prototype.hasOwnProperty.call(a,c)&&CSSPropertySet.has(c)&&(b[c]=a[c]);return b}/**
50
- * Filters component props to include only valid DOM properties and attributes.
51
- *
52
- * This function iterates through the provided props and retains only those that
53
- * are not CSS properties (as determined by `cssPropertySet`). This is useful for
54
- * separating style-related props from standard DOM attributes when rendering
55
- * elements.
56
- * @ty E - The type of the React element.
57
- * @typeParam T - The type of the component props.
58
- * @param props The component props to filter.
59
- * @returns An object containing only valid DOM props.
60
- */export function getDOMProps(a){const b={};for(const c in a)Object.prototype.hasOwnProperty.call(a,c)&&!CSSPropertySet.has(c)&&(b[c]=a[c]);return b}/**
61
- * Checks if a given tag is in the set of tags that should not receive style props.
62
- * @param tag The tag name to check (e.g., 'script', 'style').
63
- * @returns `true` if the tag is in the no-style set, otherwise `false`.
64
- */export function hasNoStyleTag(a){return!!(a&&"string"==typeof a)&&noStyleTagsSet.has(a.toLowerCase())}/**
65
- * Returns a shallow copy of the object with the specified keys omitted.
66
- * @param obj The source object.
67
- * @param keys The property keys to omit.
68
- * @returns A new object without the omitted keys.
69
- */export function omit(a,...b){const c={};for(const d in a)Object.prototype.hasOwnProperty.call(a,d)&&!b.includes(d)&&(c[d]=a[d]);return c}/**
70
- * Removes keys from an object whose values are `undefined`.
71
- * @param obj The source object.
72
- * @returns A new object without keys that have `undefined` values.
73
- */export function omitUndefined(a){const b={};for(const c in a)Object.prototype.hasOwnProperty.call(a,c)&&void 0!==a[c]&&(b[c]=a[c]);return b}
@@ -1 +0,0 @@
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,23 +0,0 @@
1
- export class ObjHelper{constructor(){}/**
2
- * Build a serializable representation of `value`.
3
- * - preserves encoded placeholders for special types
4
- * - emits { $type: 'Circular', ref: id } for circular refs
5
- */static buildSerializable(a,b){// Fast path for primitives
6
- if(null===a||void 0===a)return a;const c=typeof a;// Handle primitives first (most common case)
7
- if("string"==c||"number"===c||"boolean"===c)return a;// Handle functions
8
- if("function"==c){let c=b.functionIds.get(a);return void 0===c&&(c=b.nextFunctionId++,b.functionIds.set(a,c)),{$type:"Function",name:a.name||"",id:c}}// Handle other primitives
9
- if("symbol"==c)return{$type:"Symbol",key:a.description??""};if("bigint"==c)return{$type:"BigInt",value:a.toString()};// Only objects beyond this point
10
- if("object"!=c)// 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
- const d=b.seen.get(a);if(void 0!==d)return{$type:"Circular",ref:d};// Assign ID and mark as seen
14
- const e=b.nextObjId++;// Handle Map
15
- if(b.seen.set(a,e),a instanceof Map){const c=[];for(const[d,e]of a.entries())c.push([this.buildSerializable(d,b),this.buildSerializable(e,b)]);return{$type:"Map",entries:c}}// Handle Set
16
- if(a instanceof Set){const c=[];for(const d of a.values())c.push(this.buildSerializable(d,b));return{$type:"Set",values:c}}// Handle Arrays
17
- if(Array.isArray(a))// Use map for cleaner code and potential engine optimizations
18
- return a.map(a=>this.buildSerializable(a,b));// Handle plain objects
19
- try{const c=Object.keys(a),d={};for(const e of c)try{d[e]=this.buildSerializable(a[e],b)}catch(a){d[e]="<unserializable>"}return d}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,b=0){const c={nextObjId:0,nextFunctionId:0,seen:new Map,functionIds:new Map},d=this.buildSerializable(a,c);return JSON.stringify(d,null,b)}}
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-is.helper.d.ts","sourceRoot":"","sources":["../../src/helper/react-is.helper.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;GAGG;AACH,eAAO,MAAM,kBAAkB,eAA2C,CAAA;AAC1E,eAAO,MAAM,iBAAiB,eAA6B,CAAA;AAC3D,eAAO,MAAM,mBAAmB,eAA+B,CAAA;AAC/D,eAAO,MAAM,sBAAsB,eAAkC,CAAA;AACrE,eAAO,MAAM,mBAAmB,eAA+B,CAAA;AAC/D,eAAO,MAAM,mBAAmB,eAA+B,CAAA;AAC/D,eAAO,MAAM,mBAAmB,eAA+B,CAAA;AAC/D,eAAO,MAAM,kBAAkB,eAA8B,CAAA;AAC7D,eAAO,MAAM,sBAAsB,eAAkC,CAAA;AACrE,eAAO,MAAM,mBAAmB,eAA+B,CAAA;AAC/D,eAAO,MAAM,wBAAwB,eAAoC,CAAA;AACzE,eAAO,MAAM,eAAe,eAA2B,CAAA;AACvD,eAAO,MAAM,eAAe,eAA2B,CAAA;AACvD,eAAO,MAAM,0BAA0B,eAAsC,CAAA;AAC7E,eAAO,MAAM,sBAAsB,eAAuC,CAAA;AAC1E,eAAO,MAAM,mBAAmB,eAA+B,CAAA;AAE/D;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACxB,OAAO,kBAAkB,GACzB,OAAO,iBAAiB,GACxB,OAAO,mBAAmB,GAC1B,OAAO,sBAAsB,GAC7B,OAAO,mBAAmB,GAC1B,OAAO,mBAAmB,GAC1B,OAAO,mBAAmB,GAC1B,OAAO,kBAAkB,GACzB,OAAO,sBAAsB,GAC7B,OAAO,mBAAmB,GAC1B,OAAO,wBAAwB,GAC/B,OAAO,eAAe,GACtB,OAAO,eAAe,GACtB,OAAO,0BAA0B,GACjC,OAAO,sBAAsB,GAC7B,OAAO,mBAAmB,CAAA;AAE9B;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,GAAG,CAAA;IAEV,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,gBAAgB,GAAG,SAAS,CAoCpE;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,8BAAuE,CAAA;AAErG;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,8BAAuE,CAAA;AAErG;;;;GAIG;AACH,eAAO,MAAM,SAAS,8BACyF,CAAA;AAE/G;;;;GAIG;AACH,eAAO,MAAM,YAAY,8BAA0E,CAAA;AAEnG;;;;GAIG;AACH,eAAO,MAAM,UAAU,8BAAuE,CAAA;AAE9F;;;;GAIG;AACH,eAAO,MAAM,MAAM,8BAAmE,CAAA;AAEtF;;;;GAIG;AACH,eAAO,MAAM,MAAM,8BAAmE,CAAA;AAEtF;;;;GAIG;AACH,eAAO,MAAM,QAAQ,8BAAqE,CAAA;AAE1F;;;;GAIG;AACH,eAAO,MAAM,UAAU,8BAAuE,CAAA;AAE9F;;;;GAIG;AACH,eAAO,MAAM,YAAY,8BAA0E,CAAA;AAEnG;;;;GAIG;AACH,eAAO,MAAM,UAAU,8BAAuE,CAAA;AAE9F;;;;GAIG;AACH,eAAO,MAAM,cAAc,8BAA4E,CAAA;AAEvG;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,8BAA8E,CAAA;AAE3G;;;;GAIG;AACH,eAAO,MAAM,UAAU,8BAAuE,CAAA;AAiB9F;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,qBAgBnC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,8DAQjC,CAAA"}
@@ -1,94 +0,0 @@
1
- /**
2
- * Custom React Type Checker (TypeScript Version)
3
- * Provides utilities for identifying and checking React component/element types.
4
- * Inspired by react-is package but implemented in TypeScript with type safety.
5
- *//**
6
- * Symbol identifiers for React internal component types
7
- * These are used to identify different kinds of React elements and components
8
- */export const REACT_ELEMENT_TYPE=Symbol.for("react.transitional.element");export const REACT_PORTAL_TYPE=Symbol.for("react.portal");export const REACT_FRAGMENT_TYPE=Symbol.for("react.fragment");export const REACT_STRICT_MODE_TYPE=Symbol.for("react.strict_mode");export const REACT_PROFILER_TYPE=Symbol.for("react.profiler");export const REACT_PROVIDER_TYPE=Symbol.for("react.provider");export const REACT_CONSUMER_TYPE=Symbol.for("react.consumer");export const REACT_CONTEXT_TYPE=Symbol.for("react.context");export const REACT_FORWARD_REF_TYPE=Symbol.for("react.forward_ref");export const REACT_SUSPENSE_TYPE=Symbol.for("react.suspense");export const REACT_SUSPENSE_LIST_TYPE=Symbol.for("react.suspense_list");export const REACT_MEMO_TYPE=Symbol.for("react.memo");export const REACT_LAZY_TYPE=Symbol.for("react.lazy");export const REACT_VIEW_TRANSITION_TYPE=Symbol.for("react.view_transition");export const REACT_CLIENT_REFERENCE=Symbol.for("react.client.reference");export const REACT_ACTIVITY_TYPE=Symbol.for("react.activity");/**
9
- * Union type of all possible React internal type symbols.
10
- * Used to strongly type return values from type checking functions.
11
- *//**
12
- * Interface describing the minimal shape of a React element-like object.
13
- * Used for type checking without coupling to React's internal element type.
14
- *//**
15
- * Determines the internal React type of an object.
16
- * Examines the object's $$typeof property and nested type properties
17
- * to identify what kind of React element or component it represents.
18
- * @param {unknown} object The object to check
19
- * @returns {boolean} - The matching React type symbol or undefined if not a React object
20
- */export function typeOf(a){if("object"==typeof a&&null!==a){const b=a.$$typeof;switch(b){case REACT_ELEMENT_TYPE:{const c=a.type;switch(c){case REACT_FRAGMENT_TYPE:case REACT_PROFILER_TYPE:case REACT_STRICT_MODE_TYPE:case REACT_SUSPENSE_TYPE:case REACT_SUSPENSE_LIST_TYPE:case REACT_VIEW_TRANSITION_TYPE:return c;default:{const a=c?.$$typeof;return a===REACT_CONTEXT_TYPE||a===REACT_FORWARD_REF_TYPE||a===REACT_LAZY_TYPE||a===REACT_MEMO_TYPE||a===REACT_PROVIDER_TYPE||a===REACT_CONSUMER_TYPE?a:b}}}case REACT_PORTAL_TYPE:return b}}}/**
21
- * Checks if an object is a React Context Consumer
22
- * @param {unknown} object Object to check
23
- * @returns {boolean} - True if object is a Context.Consumer
24
- */export const isContextConsumer=a=>typeOf(a)===REACT_CONSUMER_TYPE;/**
25
- * Checks if an object is a React Context Provider
26
- * @param {unknown} object Object to check
27
- * @returns {boolean} - True if object is a Context.Provider
28
- */export const isContextProvider=a=>typeOf(a)===REACT_PROVIDER_TYPE;/**
29
- * Checks if an object is a valid React element
30
- * @param {unknown} object Object to check
31
- * @returns {boolean} - True if object is a React element
32
- */export const isElement=a=>"object"==typeof a&&null!==a&&a.$$typeof===REACT_ELEMENT_TYPE;/**
33
- * Checks if an object is a React forwardRef component
34
- * @param {unknown} object Object to check
35
- * @returns {boolean} - True if object is a forwardRef component
36
- */export const isForwardRef=a=>typeOf(a)===REACT_FORWARD_REF_TYPE;/**
37
- * Checks if an object is a React Fragment
38
- * @param {unknown} object Object to check
39
- * @returns {boolean} - True if object is a Fragment
40
- */export const isFragment=a=>typeOf(a)===REACT_FRAGMENT_TYPE;/**
41
- * Checks if an object is a React lazy component
42
- * @param {unknown} object Object to check
43
- * @returns {boolean} - True if object is a lazy component
44
- */export const isLazy=a=>typeOf(a)===REACT_LAZY_TYPE;/**
45
- * Checks if an object is a React memo component
46
- * @param {unknown} object Object to check
47
- * @returns {boolean} - True if object is a memo component
48
- */export const isMemo=a=>typeOf(a)===REACT_MEMO_TYPE;/**
49
- * Checks if an object is a React portal
50
- * @param {unknown} object Object to check
51
- * @returns {boolean} - True if object is a portal
52
- */export const isPortal=a=>typeOf(a)===REACT_PORTAL_TYPE;/**
53
- * Checks if an object is a React Profiler
54
- * @param {unknown} object Object to check
55
- * @returns {boolean} - True if object is a Profiler
56
- */export const isProfiler=a=>typeOf(a)===REACT_PROFILER_TYPE;/**
57
- * Checks if an object is a React StrictMode component
58
- * @param {unknown} object Object to check
59
- * @returns {boolean} - True if object is StrictMode
60
- */export const isStrictMode=a=>typeOf(a)===REACT_STRICT_MODE_TYPE;/**
61
- * Checks if an object is a React Suspense component
62
- * @param {unknown} object Object to check
63
- * @returns {boolean} - True if object is Suspense
64
- */export const isSuspense=a=>typeOf(a)===REACT_SUSPENSE_TYPE;/**
65
- * Checks if an object is a React SuspenseList component
66
- * @param {unknown} object Object to check
67
- * @returns {boolean} - True if `object` is SuspenseList
68
- */export const isSuspenseList=a=>typeOf(a)===REACT_SUSPENSE_LIST_TYPE;/**
69
- * Checks if an object is a React ViewTransition component
70
- * @param {unknown} object Object to check
71
- * @returns {boolean} - True if object is ViewTransition
72
- */export const isViewTransition=a=>typeOf(a)===REACT_VIEW_TRANSITION_TYPE;/**
73
- * Checks if an object is a React Activity component
74
- * @param {unknown} object Object to check
75
- * @returns {boolean} - True if object is Activity
76
- */export const isActivity=a=>typeOf(a)===REACT_ACTIVITY_TYPE;/**
77
- * Set of known valid React special element types.
78
- * Used for quick validation of element types in isValidElementType().
79
- * Includes Fragment, Profiler, StrictMode, Suspense and SuspenseList.
80
- */const knownValidSymbols=new Set([REACT_FRAGMENT_TYPE,REACT_PROFILER_TYPE,REACT_STRICT_MODE_TYPE,REACT_SUSPENSE_TYPE,REACT_SUSPENSE_LIST_TYPE,REACT_VIEW_TRANSITION_TYPE,REACT_ACTIVITY_TYPE]);/**
81
- * Checks if a type is a valid React element type that can be rendered.
82
- * This includes strings (for DOM elements), functions (for components),
83
- * and various React-specific types like Fragment, Context, etc.
84
- * @param {any} type The type to validate
85
- * @returns {boolean} - True if the type can be rendered as a React element
86
- */export const isValidElementType=a=>{if("string"==typeof a||"number"==typeof a||"bigint"==typeof a||"function"==typeof a)return!0;if(knownValidSymbols.has(a))return!0;if("object"==typeof a&&null!==a){const b=a.$$typeof;return b===REACT_LAZY_TYPE||b===REACT_MEMO_TYPE||b===REACT_CONTEXT_TYPE||b===REACT_CONSUMER_TYPE||b===REACT_FORWARD_REF_TYPE||b===REACT_CLIENT_REFERENCE||b===REACT_PROVIDER_TYPE}return!1};/**
87
- * Type guard that checks if a component is a React class component.
88
- * Examines the component's prototype for the isReactComponent marker property
89
- * that React adds to all class components.
90
- * @param {unknown} component Component to check
91
- * @returns {boolean} - True if component is a React class component
92
- */export const isReactClassComponent=a=>{if("function"!=typeof a)return!1;// Check for `isReactComponent` flag which is set on class components.
93
- // Also handles components created with React.createClass.
94
- const b=a.prototype;return!!(b&&b.isReactComponent)};
@@ -1 +0,0 @@
1
- {"version":3,"file":"component.hoc.d.ts","sourceRoot":"","sources":["../../src/hoc/component.hoc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AACjH,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAkB,MAAM,OAAO,CAAA;AAI7E;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,kBAAkB,CAAC,MAAM,IAAI,MAAM,SAAS,SAAS,GAC7D,OAAO,CAAC;IACN,QAAQ,EAAE,QAAQ,CAAA;CACnB,CAAC,GACF,MAAM,GACJ,CAAC,yBAAyB,CAAC,MAAM,CAAC,SAAS,IAAI,GAAG,aAAa,GAAG,MAAM,CAAC,GACzE,OAAO,CAAC;IACN,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAA;IACxC,QAAQ,EAAE,QAAQ,CAAA;CACnB,CAAC,CAAA;AAER;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,MAAM,SAAS,SAAS,EAChD,SAAS,EAAE,CAAC,KAAK,EAAE,kBAAkB,CAAC,MAAM,CAAC,KAAK,aAAa,GAC9D,CAAC,KAAK,CAAC,EAAE,kBAAkB,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,cAAc,KAAK,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAA;AAE/G;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1D,SAAS,EAAE,CAAC,KAAK,EAAE,kBAAkB,CAAC,MAAM,CAAC,KAAK,aAAa,GAC9D,CAAC,KAAK,EAAE,kBAAkB,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,cAAc,KAAK,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAA"}
@@ -1,50 +0,0 @@
1
- import{BaseNode,Node}from"../core.node.js";import{getElementTypeName}from"../helper/common.helper.js";import{NodeUtil}from"../util/node.util.js";/**
2
- * Props definition for components wrapped using the `Component` higher-order function.
3
- *
4
- * This type adapts based on whether the underlying component defines its own props:
5
- *
6
- * - If `TProps` is `undefined`, only `children` can be passed.
7
- * - If `TProps` is defined, the component will accept:
8
- * - The full prop shape `TProps`
9
- * - Optional `props` to override part of `TProps` (excluding `children`)
10
- * - Optional `children`
11
- *
12
- * If the component supports inline styles (determined via `HasCSSCompatibleStyleProp`), the props also allow `CSSProperties`.
13
- *//**
14
- * Creates a component from a function that uses no custom props.
15
- * @template TProps Must be `undefined`
16
- * @param component A function that returns a MeoNode `ComponentNode` and only uses basic props like `children`.
17
- * @returns A React-compatible component that can accept `children`.
18
- * @example
19
- * ```ts
20
- * const Title = Component((props) => {
21
- * return H1(props.children)
22
- * })
23
- *
24
- * Title({ children: 'Hello' })
25
- * ```
26
- *//**
27
- * Creates a component from a function that uses a defined props interface.
28
- * @template TProps Props interface expected by the component.
29
- * @param component A function that returns a MeoNode `ComponentNode` using props of type `TProps`.
30
- * @returns A React-compatible component that supports full prop shape and `children`/`props` overrides.
31
- * @example
32
- * ```ts
33
- * interface ButtonProps {
34
- * label: string
35
- * onClick: () => void
36
- * }
37
- *
38
- * const Button = Component<ButtonProps>((props) => {
39
- * return Div({
40
- * children: props.label,
41
- * onClick: props.onClick,
42
- * })
43
- * })
44
- *
45
- * Button({ label: 'Click me', onClick: () => alert('clicked')})
46
- * ```
47
- *//**
48
- * Internal implementation of the `Component` HOC.
49
- * Handles BaseNode conversion and wrapper creation.
50
- */export function Component(a){function Func(a={},b){return Node(c,a,b).render()}const b=getElementTypeName(a),c=b=>{const c=a(b);return c instanceof BaseNode||NodeUtil.isNodeInstance(c)?Node(c.element,c.rawProps).render():c};return c.displayName=`Renderer(${b})`,Func.displayName=`Component(${b})`,Func}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hoc/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA"}
package/dist/hoc/index.js DELETED
@@ -1 +0,0 @@
1
- export*from"./portal.hoc.js";export*from"./component.hoc.js";
@@ -1 +0,0 @@
1
- {"version":3,"file":"portal.hoc.d.ts","sourceRoot":"","sources":["../../src/hoc/portal.hoc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAe,YAAY,EAAyB,cAAc,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAK5J;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,EACtF,QAAQ,EAAE,YAAY,CAAC,GAAG,CAAC,EAC3B,SAAS,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,aAAa,GAClD,cAAc,CAAC,CAAC,CAAC,CAAA;AAEpB,wBAAgB,MAAM,CAAC,CAAC,SAAS,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,EACtF,SAAS,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,aAAa,GAClD,cAAc,CAAC,CAAC,CAAC,CAAA"}