frosty 0.0.111 → 0.0.113

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 (73) hide show
  1. package/dist/_native.d.mts +19 -0
  2. package/dist/_native.d.mts.map +1 -0
  3. package/dist/_native.js +3 -3
  4. package/dist/_native.mjs +4 -4
  5. package/dist/dom.d.mts +15 -0
  6. package/dist/dom.d.mts.map +1 -0
  7. package/dist/dom.js +4 -4
  8. package/dist/dom.mjs +4 -4
  9. package/dist/index.d.mts +551 -0
  10. package/dist/index.d.mts.map +1 -0
  11. package/dist/index.d.ts +8 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +3 -3
  14. package/dist/index.mjs +4 -4
  15. package/dist/internals/common-CpEB3ieX.d.mts +3451 -0
  16. package/dist/internals/common-CpEB3ieX.d.mts.map +1 -0
  17. package/dist/internals/fragment-BlS4iF_x.d.mts +9 -0
  18. package/dist/internals/fragment-BlS4iF_x.d.mts.map +1 -0
  19. package/dist/internals/{fragment-CaAgTjMI.d.ts → fragment-Dch7YNeZ.d.ts} +4 -1
  20. package/dist/internals/{fragment-CaAgTjMI.d.ts.map → fragment-Dch7YNeZ.d.ts.map} +1 -1
  21. package/dist/internals/renderer-BQawOCgo.d.mts +38 -0
  22. package/dist/internals/renderer-BQawOCgo.d.mts.map +1 -0
  23. package/dist/internals/renderer-BelBgEvy.d.mts +47 -0
  24. package/dist/internals/renderer-BelBgEvy.d.mts.map +1 -0
  25. package/dist/internals/{renderer-D042jXUg.mjs → renderer-CA9aKFMW.mjs} +3 -3
  26. package/dist/internals/{renderer-D042jXUg.mjs.map → renderer-CA9aKFMW.mjs.map} +1 -1
  27. package/dist/internals/{renderer-mim3fEAf.js → renderer-CNz1Y3a_.js} +3 -3
  28. package/dist/internals/{renderer-mim3fEAf.js.map → renderer-CNz1Y3a_.js.map} +1 -1
  29. package/dist/internals/{renderer-DUavelz2.mjs → renderer-DowEJaeR.mjs} +4 -4
  30. package/dist/internals/{renderer-DUavelz2.mjs.map → renderer-DowEJaeR.mjs.map} +1 -1
  31. package/dist/internals/{renderer-B04DCuHt.js → renderer-I-1wuWMB.js} +4 -4
  32. package/dist/internals/{renderer-B04DCuHt.js.map → renderer-I-1wuWMB.js.map} +1 -1
  33. package/dist/internals/{runtime-BFi9M0jE.js → runtime-57ivQprw.js} +4 -1
  34. package/dist/internals/runtime-57ivQprw.js.map +1 -0
  35. package/dist/internals/{runtime-BB51vIJ7.mjs → runtime-Dp4_akLf.mjs} +4 -1
  36. package/dist/internals/runtime-Dp4_akLf.mjs.map +1 -0
  37. package/dist/internals/{state-DFlnc6I0.js → state-C9_fGuhZ.js} +9 -2
  38. package/dist/internals/state-C9_fGuhZ.js.map +1 -0
  39. package/dist/internals/{state-YzaxTA1n.mjs → state-DgSrjGGU.mjs} +9 -2
  40. package/dist/internals/state-DgSrjGGU.mjs.map +1 -0
  41. package/dist/internals/{sync-OyR_m41B.js → sync-B7gLfyQK.js} +2 -2
  42. package/dist/internals/{sync-OyR_m41B.js.map → sync-B7gLfyQK.js.map} +1 -1
  43. package/dist/internals/{sync-CxgNMmpR.mjs → sync-CeJllG9M.mjs} +2 -2
  44. package/dist/internals/{sync-CxgNMmpR.mjs.map → sync-CeJllG9M.mjs.map} +1 -1
  45. package/dist/internals/utils-CWsh4Zpu.d.mts +7 -0
  46. package/dist/internals/utils-CWsh4Zpu.d.mts.map +1 -0
  47. package/dist/jsx-dev-runtime.d.mts +11 -0
  48. package/dist/jsx-dev-runtime.d.mts.map +1 -0
  49. package/dist/jsx-dev-runtime.d.ts +1 -1
  50. package/dist/jsx-dev-runtime.js +1 -1
  51. package/dist/jsx-dev-runtime.mjs +1 -1
  52. package/dist/jsx-runtime.d.mts +23 -0
  53. package/dist/jsx-runtime.d.mts.map +1 -0
  54. package/dist/jsx-runtime.d.ts +1 -1
  55. package/dist/jsx-runtime.js +1 -1
  56. package/dist/jsx-runtime.mjs +2 -2
  57. package/dist/server-dom.d.mts +15 -0
  58. package/dist/server-dom.d.mts.map +1 -0
  59. package/dist/server-dom.js +4 -4
  60. package/dist/server-dom.mjs +4 -4
  61. package/dist/web.d.mts +211 -0
  62. package/dist/web.d.mts.map +1 -0
  63. package/dist/web.d.ts +99 -0
  64. package/dist/web.d.ts.map +1 -1
  65. package/dist/web.js +104 -5
  66. package/dist/web.js.map +1 -1
  67. package/dist/web.mjs +105 -6
  68. package/dist/web.mjs.map +1 -1
  69. package/package.json +5 -17
  70. package/dist/internals/runtime-BB51vIJ7.mjs.map +0 -1
  71. package/dist/internals/runtime-BFi9M0jE.js.map +0 -1
  72. package/dist/internals/state-DFlnc6I0.js.map +0 -1
  73. package/dist/internals/state-YzaxTA1n.mjs.map +0 -1
@@ -24,6 +24,9 @@
24
24
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
25
  // THE SOFTWARE.
26
26
  //
27
+ /**
28
+ * A component that renders its children without adding extra nodes to the DOM.
29
+ */
27
30
  const Fragment = ({ children }) => {
28
31
  return children;
29
32
  };
@@ -119,4 +122,4 @@ exports.Fragment = Fragment;
119
122
  exports.NativeElementType = NativeElementType;
120
123
  exports._createElement = _createElement;
121
124
  exports.createElement = createElement;
122
- //# sourceMappingURL=runtime-BFi9M0jE.js.map
125
+ //# sourceMappingURL=runtime-57ivQprw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-57ivQprw.js","sources":["../../../src/core/components/fragment.ts","../../../src/core/types/component.ts","../../../src/core/types/runtime.ts"],"sourcesContent":["//\n// fragment.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { ComponentType, PropsWithChildren } from '../types/common';\n\n/**\n * A component that renders its children without adding extra nodes to the DOM.\n */\nexport const Fragment: ComponentType<PropsWithChildren<{}>> = ({ children }) => {\n return children;\n}\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _ElementType, PropsType } from './runtime';\n\nexport abstract class NativeElementType {\n constructor(...args: any[]) { };\n}\n\nexport class ComponentNode {\n\n /** @internal */\n private _type: _ElementType | typeof NativeElementType;\n\n /** @internal */\n private _props: PropsType;\n\n /** @internal */\n private _key?: string | number;\n\n /** @internal */\n constructor(\n type: _ElementType | typeof NativeElementType,\n props: PropsType,\n key?: string | number\n ) {\n this._type = type;\n this._props = props;\n this._key = key;\n }\n\n get type() {\n return this._type;\n }\n\n get props() {\n return this._props;\n }\n\n get key() {\n return this._key;\n }\n\n /** @internal */\n _equal(other: ComponentNode) {\n return this.type === other.type && this.key === other.key;\n }\n}\n","//\n// basic.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { MergeObject, PickType, WritableKeys } from '@o2ter/utils-js';\nimport { ComponentType, ElementNode, PropsWithChildren, RefAttribute } from './common';\nimport { ClassName, StyleProp } from './style';\nimport { CSSProperties, ExtendedCSSProperties } from '../web/styles/css';\nimport { globalEvents } from '../web/event';\nimport { ComponentNode, NativeElementType } from './component';\nimport { _HTMLElementTagNameMap, _MathMLElementTagNameMap, _SVGElementTagNameMap } from '../web/props';\n\nexport type _ElementType = string | ComponentType<any>;\n\nexport type _IntrinsicAttributes = {\n key?: string | number;\n};\n\nexport type PropsType = Record<string, any>;\n\ntype EventHandler<E extends Event, C, T = EventTarget> = (this: C, event: E & {\n currentTarget: C;\n target: T;\n }) => void;\ntype EventMap = {\n [ev in typeof globalEvents[number]]: ev extends `on${infer x}`\n ? Lowercase<x> extends keyof GlobalEventHandlersEventMap ? GlobalEventHandlersEventMap[Lowercase<x>] : Event\n : never;\n};\n\ntype _PropsOfInstance<Instance> = Omit<\n PickType<{\n [k in WritableKeys<Instance>]: Instance[k];\n }, boolean | number | string | null | undefined>,\n 'className' | 'style' | 'innerText' | 'outerText' | 'outerHTML' | 'nodeValue'\n> & {\n [x in keyof EventMap]?: EventHandler<EventMap[x], Instance>;\n} & {\n [x in keyof EventMap as `${x}Capture`]?: EventHandler<EventMap[x], Instance>;\n};\n\ntype Combine<T, R> = Omit<T, keyof R> & R;\n\ntype _ElementProps<ElementMap extends { [x: string]: { type: any; props?: any; } }> = {\n [x in keyof ElementMap]: PropsWithChildren<\n Partial<\n RefAttribute<ElementMap[x]['type'] | null | undefined>\n & {\n className?: ClassName;\n style?: StyleProp<ExtendedCSSProperties>;\n inlineStyle?: CSSProperties;\n }\n & Combine<ElementMap[x]['props'], _PropsOfInstance<ElementMap[x]['type']>>\n >\n >\n};\n\nexport type _IntrinsicElements = MergeObject<\n | _ElementProps<_HTMLElementTagNameMap>\n | _ElementProps<_SVGElementTagNameMap>\n | _ElementProps<_MathMLElementTagNameMap>\n> & { [x: string]: any; };\n\nexport const _createElement = (\n type: _ElementType | typeof NativeElementType,\n props: PropsType\n) => {\n const { key, ..._props } = props;\n return new ComponentNode(type, _props, key);\n}\n\nexport const createElement = (\n type: _ElementType,\n props?: PropsType | null,\n ...children: ElementNode[]\n) => _createElement(type, { ...props ?? {}, children });\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;;AAEG;MACU,QAAQ,GAAyC,CAAC,EAAE,QAAQ,EAAE,KAAI;AAC7E,IAAA,OAAO,QAAQ;AACjB;;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MAKsB,iBAAiB,CAAA;IACrC,WAAA,CAAY,GAAG,IAAW,EAAA,EAAI;;AAC/B;MAEY,aAAa,CAAA;;AAGhB,IAAA,KAAK;;AAGL,IAAA,MAAM;;AAGN,IAAA,IAAI;;AAGZ,IAAA,WAAA,CACE,IAA6C,EAC7C,KAAgB,EAChB,GAAqB,EAAA;AAErB,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI;AACjB,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK;AACnB,QAAA,IAAI,CAAC,IAAI,GAAG,GAAG;IACjB;AAEA,IAAA,IAAI,IAAI,GAAA;QACN,OAAO,IAAI,CAAC,KAAK;IACnB;AAEA,IAAA,IAAI,KAAK,GAAA;QACP,OAAO,IAAI,CAAC,MAAM;IACpB;AAEA,IAAA,IAAI,GAAG,GAAA;QACL,OAAO,IAAI,CAAC,IAAI;IAClB;;AAGA,IAAA,MAAM,CAAC,KAAoB,EAAA;AACzB,QAAA,OAAO,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG;IAC3D;AACD;;ACtED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MA6Da,cAAc,GAAG,CAC5B,IAA6C,EAC7C,KAAgB,KACd;IACF,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;IAChC,OAAO,IAAI,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC;AAC7C;AAEO,MAAM,aAAa,GAAG,CAC3B,IAAkB,EAClB,KAAwB,EACxB,GAAG,QAAuB,KACvB,cAAc,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,IAAI,EAAE,EAAE,QAAQ,EAAE;;;;;;;;"}
@@ -22,6 +22,9 @@
22
22
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  // THE SOFTWARE.
24
24
  //
25
+ /**
26
+ * A component that renders its children without adding extra nodes to the DOM.
27
+ */
25
28
  const Fragment = ({ children }) => {
26
29
  return children;
27
30
  };
@@ -113,4 +116,4 @@ const _createElement = (type, props) => {
113
116
  const createElement = (type, props, ...children) => _createElement(type, { ...props ?? {}, children });
114
117
 
115
118
  export { ComponentNode as C, Fragment as F, NativeElementType as N, _createElement as _, createElement as c };
116
- //# sourceMappingURL=runtime-BB51vIJ7.mjs.map
119
+ //# sourceMappingURL=runtime-Dp4_akLf.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-Dp4_akLf.mjs","sources":["../../../src/core/components/fragment.ts","../../../src/core/types/component.ts","../../../src/core/types/runtime.ts"],"sourcesContent":["//\n// fragment.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { ComponentType, PropsWithChildren } from '../types/common';\n\n/**\n * A component that renders its children without adding extra nodes to the DOM.\n */\nexport const Fragment: ComponentType<PropsWithChildren<{}>> = ({ children }) => {\n return children;\n}\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _ElementType, PropsType } from './runtime';\n\nexport abstract class NativeElementType {\n constructor(...args: any[]) { };\n}\n\nexport class ComponentNode {\n\n /** @internal */\n private _type: _ElementType | typeof NativeElementType;\n\n /** @internal */\n private _props: PropsType;\n\n /** @internal */\n private _key?: string | number;\n\n /** @internal */\n constructor(\n type: _ElementType | typeof NativeElementType,\n props: PropsType,\n key?: string | number\n ) {\n this._type = type;\n this._props = props;\n this._key = key;\n }\n\n get type() {\n return this._type;\n }\n\n get props() {\n return this._props;\n }\n\n get key() {\n return this._key;\n }\n\n /** @internal */\n _equal(other: ComponentNode) {\n return this.type === other.type && this.key === other.key;\n }\n}\n","//\n// basic.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { MergeObject, PickType, WritableKeys } from '@o2ter/utils-js';\nimport { ComponentType, ElementNode, PropsWithChildren, RefAttribute } from './common';\nimport { ClassName, StyleProp } from './style';\nimport { CSSProperties, ExtendedCSSProperties } from '../web/styles/css';\nimport { globalEvents } from '../web/event';\nimport { ComponentNode, NativeElementType } from './component';\nimport { _HTMLElementTagNameMap, _MathMLElementTagNameMap, _SVGElementTagNameMap } from '../web/props';\n\nexport type _ElementType = string | ComponentType<any>;\n\nexport type _IntrinsicAttributes = {\n key?: string | number;\n};\n\nexport type PropsType = Record<string, any>;\n\ntype EventHandler<E extends Event, C, T = EventTarget> = (this: C, event: E & {\n currentTarget: C;\n target: T;\n }) => void;\ntype EventMap = {\n [ev in typeof globalEvents[number]]: ev extends `on${infer x}`\n ? Lowercase<x> extends keyof GlobalEventHandlersEventMap ? GlobalEventHandlersEventMap[Lowercase<x>] : Event\n : never;\n};\n\ntype _PropsOfInstance<Instance> = Omit<\n PickType<{\n [k in WritableKeys<Instance>]: Instance[k];\n }, boolean | number | string | null | undefined>,\n 'className' | 'style' | 'innerText' | 'outerText' | 'outerHTML' | 'nodeValue'\n> & {\n [x in keyof EventMap]?: EventHandler<EventMap[x], Instance>;\n} & {\n [x in keyof EventMap as `${x}Capture`]?: EventHandler<EventMap[x], Instance>;\n};\n\ntype Combine<T, R> = Omit<T, keyof R> & R;\n\ntype _ElementProps<ElementMap extends { [x: string]: { type: any; props?: any; } }> = {\n [x in keyof ElementMap]: PropsWithChildren<\n Partial<\n RefAttribute<ElementMap[x]['type'] | null | undefined>\n & {\n className?: ClassName;\n style?: StyleProp<ExtendedCSSProperties>;\n inlineStyle?: CSSProperties;\n }\n & Combine<ElementMap[x]['props'], _PropsOfInstance<ElementMap[x]['type']>>\n >\n >\n};\n\nexport type _IntrinsicElements = MergeObject<\n | _ElementProps<_HTMLElementTagNameMap>\n | _ElementProps<_SVGElementTagNameMap>\n | _ElementProps<_MathMLElementTagNameMap>\n> & { [x: string]: any; };\n\nexport const _createElement = (\n type: _ElementType | typeof NativeElementType,\n props: PropsType\n) => {\n const { key, ..._props } = props;\n return new ComponentNode(type, _props, key);\n}\n\nexport const createElement = (\n type: _ElementType,\n props?: PropsType | null,\n ...children: ElementNode[]\n) => _createElement(type, { ...props ?? {}, children });\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;;AAEG;MACU,QAAQ,GAAyC,CAAC,EAAE,QAAQ,EAAE,KAAI;AAC7E,IAAA,OAAO,QAAQ;AACjB;;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MAKsB,iBAAiB,CAAA;IACrC,WAAA,CAAY,GAAG,IAAW,EAAA,EAAI;;AAC/B;MAEY,aAAa,CAAA;;AAGhB,IAAA,KAAK;;AAGL,IAAA,MAAM;;AAGN,IAAA,IAAI;;AAGZ,IAAA,WAAA,CACE,IAA6C,EAC7C,KAAgB,EAChB,GAAqB,EAAA;AAErB,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI;AACjB,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK;AACnB,QAAA,IAAI,CAAC,IAAI,GAAG,GAAG;IACjB;AAEA,IAAA,IAAI,IAAI,GAAA;QACN,OAAO,IAAI,CAAC,KAAK;IACnB;AAEA,IAAA,IAAI,KAAK,GAAA;QACP,OAAO,IAAI,CAAC,MAAM;IACpB;AAEA,IAAA,IAAI,GAAG,GAAA;QACL,OAAO,IAAI,CAAC,IAAI;IAClB;;AAGA,IAAA,MAAM,CAAC,KAAoB,EAAA;AACzB,QAAA,OAAO,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG;IAC3D;AACD;;ACtED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MA6Da,cAAc,GAAG,CAC5B,IAA6C,EAC7C,KAAgB,KACd;IACF,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;IAChC,OAAO,IAAI,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC;AAC7C;AAEO,MAAM,aAAa,GAAG,CAC3B,IAAkB,EAClB,KAAwB,EACxB,GAAG,QAAuB,KACvB,cAAc,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,IAAI,EAAE,EAAE,QAAQ,EAAE;;;;"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var _ = require('lodash');
4
- var runtime = require('./runtime-BFi9M0jE.js');
4
+ var runtime = require('./runtime-57ivQprw.js');
5
5
  var myers_js = require('myers.js');
6
6
 
7
7
  //
@@ -30,6 +30,13 @@ var myers_js = require('myers.js');
30
30
  //
31
31
  class _ParentComponent extends runtime.NativeElementType {
32
32
  }
33
+ /**
34
+ * Create a pair of Parent and Child components.
35
+ *
36
+ * @param allowTextChildren - Whether to allow text children in the Parent component.
37
+ * @param allowedChildTypes - An array of additional allowed child component types.
38
+ * @returns An object containing the Parent and Child components.
39
+ */
33
40
  const createPairs = ({ allowTextChildren, allowedChildTypes = [] } = {}) => {
34
41
  const ChildComponent = ({ children }) => runtime._createElement(runtime.Fragment, { children });
35
42
  class ParentComponent extends _ParentComponent {
@@ -644,4 +651,4 @@ exports.mergeRefs = mergeRefs;
644
651
  exports.reconciler = reconciler;
645
652
  exports.uniqueId = uniqueId;
646
653
  exports.useContext = useContext;
647
- //# sourceMappingURL=state-DFlnc6I0.js.map
654
+ //# sourceMappingURL=state-C9_fGuhZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-C9_fGuhZ.js","sources":["../../../src/core/components/pairs.ts","../../../src/core/hooks/context.ts","../../../src/core/reconciler/utils.ts","../../../src/core/utils.ts","../../../src/core/reconciler/vnode.ts","../../../src/core/reconciler/events.ts","../../../src/core/types/props.ts","../../../src/core/types/error.ts","../../../src/core/reconciler/state.ts"],"sourcesContent":["//\n// pairs.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from \"lodash\";\nimport { PropsWithChildren } from \"../types/common\";\nimport { NativeElementType } from \"../types/component\";\nimport { _createElement, _ElementType } from \"../types/runtime\";\nimport { VNode } from \"../reconciler/vnode\";\nimport { Fragment } from \"./fragment\";\n\nexport abstract class _ParentComponent extends NativeElementType {\n abstract isChildNode(child: string | VNode): boolean;\n}\n\n/**\n * Create a pair of Parent and Child components.\n * \n * @param allowTextChildren - Whether to allow text children in the Parent component.\n * @param allowedChildTypes - An array of additional allowed child component types.\n * @returns An object containing the Parent and Child components.\n */\nexport const createPairs = ({ allowTextChildren, allowedChildTypes = [] }: {\n allowTextChildren?: boolean;\n allowedChildTypes?: (_ElementType | typeof NativeElementType)[];\n} = {}) => {\n const ChildComponent = ({ children }: PropsWithChildren<{}>) => _createElement(Fragment, { children });\n class ParentComponent extends _ParentComponent {\n isChildNode(child: string | VNode) {\n if (_.isString(child)) return !!allowTextChildren;\n return child.type === ChildComponent || _.some(allowedChildTypes, x => child.type === x);\n }\n }\n return {\n Parent: ({ children }: PropsWithChildren<{}>) => _createElement(ParentComponent, { children }),\n Child: ChildComponent,\n }\n}\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from '../reconciler/state';\nimport { ComponentType, ElementNode } from '../types/common';\n\nconst _contextDefaultValue = new WeakMap<Context<any>, any>();\n\nexport const isContext = (type: any): type is Context<any> => {\n return _contextDefaultValue.has(type as any);\n};\n\nexport type Context<Value> = ReturnType<typeof _createContext<Value>>;\nexport type ContextType<C extends Context<any>> = C extends Context<infer T> ? T : never;\n\nconst _createContext = <Value extends unknown>(defaultValue: Value) => {\n const _context: ComponentType<{\n value: Value;\n children?: ElementNode | ((value: Value) => ElementNode);\n }> = ({ value, children }) => {\n return _.isFunction(children) ? children(value) : children;\n };\n const Consumer: ComponentType<{\n children: (value: Value) => ElementNode;\n }> = ({ children }) => {\n const value = useContext(_context as Context<Value>);\n return children(value);\n };\n _contextDefaultValue.set(_context as Context<Value>, defaultValue);\n return _.assign(_context, { Consumer });\n};\n\n/**\n * Creates a new context object with an optional default value.\n *\n * A context object allows you to share a value across a component tree\n * without explicitly passing it as a prop to every level.\n *\n * @template Value - The type of the value to be stored in the context.\n * @param - The default value for the context.\n * @returns A context object that can be used to provide and consume the value.\n */\n\nexport function createContext<Value>(defaultValue: Value): Context<Value>;\nexport function createContext<Value = undefined>(): Context<Value | undefined>;\n\nexport function createContext(defaultValue?: any) {\n return _createContext(defaultValue);\n}\n\n/**\n * A hook that retrieves the current value of a context and optionally applies\n * a selector function to transform the context value. This hook ensures that the component\n * subscribes to the context and re-renders when the context value changes.\n *\n * @template T - The type of the context value.\n * @template R - The type of the transformed value returned by the selector.\n * @param context - The context object to retrieve the value from.\n * @param selector - An optional selector function to transform the context value.\n * Defaults to an identity function.\n * @returns - The current value of the context, optionally transformed by the selector.\n *\n * @throws - Throws an error if the provided context is invalid or if the hook\n * is used outside of a render function.\n *\n * @example\n * const MyContext = createContext({ user: null });\n * \n * function MyComponent() {\n * const user = useContext(MyContext, context => context.user);\n * return <div>{user ? `Hello, ${user.name}` : 'Hello, Guest'}</div>;\n * }\n */\nexport const useContext = <T, R = T>(\n context: Context<T>,\n selector: (state: T) => R = v => v as any\n) => {\n if (!isContext(context)) throw Error(`Invalid type of ${context}`);\n const state = reconciler.currentHookState;\n if (!state) throw Error('useContext must be used within a render function.');\n const { contextValue, listens } = state;\n listens.add(context);\n const { value = _contextDefaultValue.get(context) } = contextValue.get(context) ?? {};\n return selector(value);\n};\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\n\nexport const equalDeps = (lhs: any, rhs: any) => {\n if (lhs === rhs) return true;\n if (_.isArray(lhs) && _.isArray(rhs)) {\n if (lhs.length !== rhs.length) return false;\n for (let i = 0; i < lhs.length; i++) {\n if (!equalDeps(lhs[i], rhs[i])) return false;\n }\n return true;\n }\n if (_.isPlainObject(lhs) && _.isPlainObject(rhs)) {\n const lkeys = _.keys(lhs);\n const rkeys = _.keys(rhs);\n if (lkeys.length !== rkeys.length) return false;\n for (const key of lkeys) {\n if (!equalDeps(lhs[key], rhs[key])) return false;\n }\n return true;\n }\n return false;\n}\n\nexport const equalProps = (lhs: Record<string, any>, rhs: Record<string, any>) => {\n if (lhs === rhs) return true;\n const lkeys = _.keys(lhs);\n const rkeys = _.keys(rhs);\n if (lkeys.length !== rkeys.length) return false;\n for (const key of lkeys) {\n if (_.isFunction(lhs[key]) && _.isFunction(rhs[key])) continue;\n if (!equalDeps(lhs[key], rhs[key])) return false;\n }\n return true;\n};\n","//\n// utils.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Ref } from './types/common';\n\nexport const mergeRefs = <T>(...refs: (Ref<T> | null | undefined)[]) => (x: T) => {\n for (const ref of refs) {\n if (_.isNil(ref)) continue;\n else if (typeof ref === 'function') ref(x);\n else if (typeof ref === 'object') ref.current = x;\n else {\n console.error(`mergeRefs cannot handle Refs of type boolean, number or string, received ref ${ref}`);\n }\n }\n}\n\nlet counter = 0;\n\nexport const uniqueId = () => `${Date.now().toString(36)}${(counter++).toString(36)}${Math.random().toString(36).slice(2)}`;\n","//\n// vnode.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { ComponentNode, NativeElementType } from '../types/component';\nimport { Context, isContext } from '../hooks/context';\nimport { reconciler } from './state';\nimport { myersSync } from 'myers.js';\nimport { EventEmitter } from './events';\nimport { equalDeps, equalProps } from './utils';\nimport { _Renderer } from '../renderer';\nimport { PropsType } from '../types/runtime';\nimport { uniqueId } from '../utils';\n\nexport type VNodeState = {\n hook: string;\n deps: any;\n data?: any;\n mount?: () => () => void;\n};\n\nexport type _ContextState = {\n value: any;\n state: string;\n node: VNode;\n};\n\nexport class VNode {\n\n /** @internal */\n _component: ComponentNode;\n\n private _id = uniqueId();\n\n private _event: EventEmitter;\n private _props: PropsType = {};\n private _error?: any;\n private _children: (VNode | string)[] = [];\n private _state?: VNodeState[];\n private _dirty = true;\n private _listens = new Map<Context<any>, Omit<_ContextState, 'value'>>();\n\n /** @internal */\n _content_state = uniqueId();\n private _content_value?: any;\n\n /** @internal */\n constructor(component: ComponentNode, event: EventEmitter) {\n this._component = component;\n this._event = event;\n }\n\n /** @internal */\n _resolve_children(child: any): (VNode | string)[] {\n if (_.isBoolean(child) || _.isNil(child)) return [];\n if (_.isString(child)) return [child];\n if (_.isNumber(child)) return [`${child}`];\n if (child instanceof ComponentNode) return [new VNode(child, this._event)];\n if (_.isArrayLikeObject(child)) return _.flatMap(child, x => this._resolve_children(x));\n if (typeof child[Symbol.iterator] === 'function') return _.flatMap([...child], x => this._resolve_children(x));\n throw Error(`${child} are not valid as a child.`);\n }\n\n get id() {\n return this._id;\n }\n\n get type() {\n return this._component.type;\n }\n\n get props() {\n return this._props;\n }\n\n get key() {\n return this._component.key;\n }\n\n get state() {\n return this._state ?? [];\n }\n\n get children() {\n return this._children;\n }\n\n get error() {\n return this._error;\n }\n\n /** @internal */\n _setDirty() {\n this._dirty = true;\n this._event.emit('onchange');\n }\n\n /** @internal */\n private _check_context(values: Map<Context<any>, Omit<_ContextState, 'value'>>) {\n return this._listens.entries().every(([k, v]) => {\n const { state, node } = values.get(k) ?? {};\n return state === v.state && node === v.node;\n });\n }\n\n /** @internal */\n async _updateIfNeed(options: {\n renderer: _Renderer<any>;\n stack: VNode[];\n propsProvider: VNode[];\n errorBoundary?: VNode;\n contextValue: Map<Context<any>, _ContextState>;\n }) {\n if (!this._dirty && this._check_context(options.contextValue)) return false;\n try {\n const self = this;\n const { type, props: _props } = this._component;\n const props = _.mapValues(\n options.propsProvider.reduceRight((p, node) => node.props.callback({ type, props: p }), _props),\n (v, k) => _.isFunction(v) ? function (this: any, ...args: any[]) {\n const current = self._component.props[k];\n return _.isFunction(current) ? current.call(this, ...args) : v.call(this, ...args);\n } : v,\n );\n let children: (VNode | string)[];\n if (_.isString(type) || type?.prototype instanceof NativeElementType) {\n children = this._resolve_children(props.children);\n } else if (isContext(type)) {\n const { value } = props;\n if (!equalDeps(this._content_value, value)) this._content_state = uniqueId();\n this._content_value = value;\n children = this._resolve_children(type(props as any));\n } else if (_.isFunction(type)) {\n let resolved;\n while (true) {\n const {\n resolved: rendered,\n error,\n state,\n } = reconciler.withHookState({\n renderer: options.renderer,\n node: this,\n state: this._state,\n stack: options.stack,\n contextValue: options.contextValue,\n }, () => type(props));\n this._state = state.state;\n if (_.isEmpty(state.tasks)) {\n if (error) throw error;\n resolved = { rendered, state };\n break;\n }\n await Promise.all(state.tasks);\n }\n this._listens = new Map(options.contextValue.entries().filter(([k]) => resolved.state.listens.has(k)));\n children = this._resolve_children(resolved.rendered);\n } else {\n throw Error(`Invalid node type ${type}`);\n }\n const diff = myersSync(this._children, children, {\n compare: (lhs, rhs) => {\n if (_.isString(lhs) && _.isString(rhs)) return lhs === rhs;\n if (lhs instanceof VNode && rhs instanceof VNode) return lhs._component._equal(rhs._component);\n return false;\n },\n });\n this._props = _.omit(props, 'children');\n this._children = _.flatMap(diff, x => x.equivalent ?? x.insert ?? []);\n this._error = undefined;\n for (const [i, item] of this._children.entries()) {\n if (!(item instanceof VNode)) continue;\n if (!(children[i] instanceof VNode)) continue;\n if (!equalProps(item._component.props, children[i]._component.props)) item._dirty = true;\n item._component = children[i]._component;\n }\n } catch (error) {\n this._props = {};\n this._children = [];\n this._error = error;\n (async () => {\n try {\n const { onError, silent } = options.errorBoundary?.props ?? {};\n if (!silent) console.error(error);\n if (_.isFunction(onError)) await onError(error, this._component, _.map(options.stack, x => x._component));\n } catch (e) {\n console.error(e);\n }\n })();\n } finally {\n this._dirty = false;\n }\n return true;\n }\n}\n","//\n// events.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\n\nexport class EventEmitter {\n\n private _listeners: Record<string, ((...args: any[]) => void)[]> = {};\n\n register(event: string, callback: (event: string, ...args: any[]) => void) {\n if (_.isNil(this._listeners[event])) this._listeners[event] = [];\n const _callback = (...args: any[]) => callback(event, ...args);\n this._listeners[event].push(_callback);\n return {\n remove: () => {\n this._listeners[event] = _.filter(this._listeners[event], x => x !== _callback);\n },\n };\n }\n\n emit(event: string, ...args: any[]) {\n this._listeners[event]?.forEach(async callback => {\n try {\n await callback(...args)\n } catch (e) {\n console.error(e);\n }\n });\n }\n}\n","//\n// props.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { ComponentType, PropsWithChildren } from './common';\nimport { NativeElementType } from './component';\nimport { _ElementType, PropsType } from './runtime';\n\ntype PropsProviderProps = PropsWithChildren<{\n callback: (v: {\n type: _ElementType | typeof NativeElementType,\n props: PropsType\n }) => PropsType | undefined | null;\n}>;\n\nexport const PropsProvider: ComponentType<PropsProviderProps> = ({ children }) => {\n return children;\n}\n","//\n// error.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { ComponentType, PropsWithChildren } from './common';\nimport { ComponentNode } from './component';\n\ntype ErrorBoundaryProps = PropsWithChildren<{\n silent?: boolean;\n onError?: (\n error: any,\n component: ComponentNode,\n stack: ComponentNode[],\n ) => void;\n}>;\n\nexport const ErrorBoundary: ComponentType<ErrorBoundaryProps> = ({ children }) => {\n return children;\n}\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { ComponentNode } from '../types/component';\nimport { Context, isContext } from '../hooks/context';\nimport { _ContextState, VNode, VNodeState } from './vnode';\nimport { EventEmitter } from './events';\nimport { PropsProvider } from '../types/props';\nimport { ErrorBoundary } from '../types/error';\nimport { _Renderer } from '../renderer';\n\nclass HookState {\n\n renderer: _Renderer<any>;\n\n contextValue: Map<Context<any>, _ContextState>;\n prevState?: VNodeState[];\n state: VNodeState[] = [];\n stack: VNode[] = [];\n node?: VNode;\n\n listens = new WeakSet<Context<any>>();\n\n tasks: PromiseLike<void>[] = [];\n\n constructor(options: {\n renderer: _Renderer<any>;\n node: VNode;\n stack: VNode[];\n state?: VNodeState[];\n contextValue: Map<Context<any>, _ContextState>;\n }) {\n this.renderer = options.renderer;\n this.node = options.node;\n this.stack = options.stack;\n this.prevState = options.state;\n this.contextValue = options.contextValue ?? new Map();\n }\n}\n\nexport const reconciler = new class {\n\n /** @internal */\n _registry = new WeakMap<any, string>();\n\n /** @internal */\n _currentHookState: HookState | undefined;\n\n get currentHookState() {\n return this._currentHookState;\n }\n\n withHookState<R = void>(\n options: ConstructorParameters<typeof HookState>[0],\n callback: (state: HookState) => R,\n ) {\n const state = new HookState(options);\n try {\n reconciler._currentHookState = state;\n return { resolved: callback(state), state };\n } catch (error) {\n return { error, state };\n } finally {\n reconciler._currentHookState = undefined;\n }\n }\n\n buildVNodes(component: ComponentNode, renderer: _Renderer<any>) {\n const event = new EventEmitter();\n const root = new VNode(component, event);\n const excute = async function* () {\n const items: {\n node: VNode;\n stack: VNode[];\n propsProvider: VNode[];\n errorBoundary?: VNode;\n contextValue: Map<Context<any>, _ContextState>;\n }[] = [{\n node: root,\n stack: [],\n propsProvider: [],\n contextValue: new Map(),\n }];\n let item;\n while (item = items.shift()) {\n\n const { node, stack, propsProvider, errorBoundary, contextValue } = item;\n yield {\n node,\n stack,\n updated: await node._updateIfNeed({\n renderer,\n stack,\n propsProvider,\n errorBoundary,\n contextValue\n }),\n };\n\n let _contextValue = contextValue;\n if (isContext(node.type)) {\n _contextValue = new Map(_contextValue);\n _contextValue.set(node.type, {\n value: node.props.value,\n state: node._content_state,\n node: node,\n });\n }\n\n const _propsProvider = node.type === PropsProvider ? [...propsProvider, node] : propsProvider;\n const _errorBoundary = node.type === ErrorBoundary ? node : errorBoundary;\n\n const _stack = [...stack, node];\n for (const item of node.children) {\n if (item instanceof VNode) {\n items.push({\n node: item,\n stack: _stack,\n propsProvider: _propsProvider,\n errorBoundary: _errorBoundary,\n contextValue: _contextValue,\n });\n }\n }\n }\n };\n return { node: root, event, excute };\n }\n};\n"],"names":["NativeElementType","_createElement","Fragment","ComponentNode","myersSync"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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AI,CAAC,IAAI,KAAK,aAAa,GAAG,IAAI,GAAG,aAAa;gBAEzE,MAAM,MAAM,GAAG,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC;AAC/B,gBAAA,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE;AAChC,oBAAA,IAAI,IAAI,YAAY,KAAK,EAAE;wBACzB,KAAK,CAAC,IAAI,CAAC;AACT,4BAAA,IAAI,EAAE,IAAI;AACV,4BAAA,KAAK,EAAE,MAAM;AACb,4BAAA,aAAa,EAAE,cAAc;AAC7B,4BAAA,aAAa,EAAE,cAAc;AAC7B,4BAAA,YAAY,EAAE,aAAa;AAC5B,yBAAA,CAAC;oBACJ;gBACF;YACF;AACF,QAAA,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE;IACtC;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  import _ from 'lodash';
2
- import { N as NativeElementType, _ as _createElement, F as Fragment, C as ComponentNode } from './runtime-BB51vIJ7.mjs';
2
+ import { N as NativeElementType, _ as _createElement, F as Fragment, C as ComponentNode } from './runtime-Dp4_akLf.mjs';
3
3
  import { myersSync } from 'myers.js';
4
4
 
5
5
  //
@@ -28,6 +28,13 @@ import { myersSync } from 'myers.js';
28
28
  //
29
29
  class _ParentComponent extends NativeElementType {
30
30
  }
31
+ /**
32
+ * Create a pair of Parent and Child components.
33
+ *
34
+ * @param allowTextChildren - Whether to allow text children in the Parent component.
35
+ * @param allowedChildTypes - An array of additional allowed child component types.
36
+ * @returns An object containing the Parent and Child components.
37
+ */
31
38
  const createPairs = ({ allowTextChildren, allowedChildTypes = [] } = {}) => {
32
39
  const ChildComponent = ({ children }) => _createElement(Fragment, { children });
33
40
  class ParentComponent extends _ParentComponent {
@@ -631,4 +638,4 @@ const reconciler = new class {
631
638
  };
632
639
 
633
640
  export { ErrorBoundary as E, PropsProvider as P, VNode as V, _ParentComponent as _, uniqueId as a, createPairs as b, createContext as c, EventEmitter as d, equalDeps as e, mergeRefs as m, reconciler as r, useContext as u };
634
- //# sourceMappingURL=state-YzaxTA1n.mjs.map
641
+ //# sourceMappingURL=state-DgSrjGGU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-DgSrjGGU.mjs","sources":["../../../src/core/components/pairs.ts","../../../src/core/hooks/context.ts","../../../src/core/reconciler/utils.ts","../../../src/core/utils.ts","../../../src/core/reconciler/vnode.ts","../../../src/core/reconciler/events.ts","../../../src/core/types/props.ts","../../../src/core/types/error.ts","../../../src/core/reconciler/state.ts"],"sourcesContent":["//\n// pairs.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from \"lodash\";\nimport { PropsWithChildren } from \"../types/common\";\nimport { NativeElementType } from \"../types/component\";\nimport { _createElement, _ElementType } from \"../types/runtime\";\nimport { VNode } from \"../reconciler/vnode\";\nimport { Fragment } from \"./fragment\";\n\nexport abstract class _ParentComponent extends NativeElementType {\n abstract isChildNode(child: string | VNode): boolean;\n}\n\n/**\n * Create a pair of Parent and Child components.\n * \n * @param allowTextChildren - Whether to allow text children in the Parent component.\n * @param allowedChildTypes - An array of additional allowed child component types.\n * @returns An object containing the Parent and Child components.\n */\nexport const createPairs = ({ allowTextChildren, allowedChildTypes = [] }: {\n allowTextChildren?: boolean;\n allowedChildTypes?: (_ElementType | typeof NativeElementType)[];\n} = {}) => {\n const ChildComponent = ({ children }: PropsWithChildren<{}>) => _createElement(Fragment, { children });\n class ParentComponent extends _ParentComponent {\n isChildNode(child: string | VNode) {\n if (_.isString(child)) return !!allowTextChildren;\n return child.type === ChildComponent || _.some(allowedChildTypes, x => child.type === x);\n }\n }\n return {\n Parent: ({ children }: PropsWithChildren<{}>) => _createElement(ParentComponent, { children }),\n Child: ChildComponent,\n }\n}\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from '../reconciler/state';\nimport { ComponentType, ElementNode } from '../types/common';\n\nconst _contextDefaultValue = new WeakMap<Context<any>, any>();\n\nexport const isContext = (type: any): type is Context<any> => {\n return _contextDefaultValue.has(type as any);\n};\n\nexport type Context<Value> = ReturnType<typeof _createContext<Value>>;\nexport type ContextType<C extends Context<any>> = C extends Context<infer T> ? T : never;\n\nconst _createContext = <Value extends unknown>(defaultValue: Value) => {\n const _context: ComponentType<{\n value: Value;\n children?: ElementNode | ((value: Value) => ElementNode);\n }> = ({ value, children }) => {\n return _.isFunction(children) ? children(value) : children;\n };\n const Consumer: ComponentType<{\n children: (value: Value) => ElementNode;\n }> = ({ children }) => {\n const value = useContext(_context as Context<Value>);\n return children(value);\n };\n _contextDefaultValue.set(_context as Context<Value>, defaultValue);\n return _.assign(_context, { Consumer });\n};\n\n/**\n * Creates a new context object with an optional default value.\n *\n * A context object allows you to share a value across a component tree\n * without explicitly passing it as a prop to every level.\n *\n * @template Value - The type of the value to be stored in the context.\n * @param - The default value for the context.\n * @returns A context object that can be used to provide and consume the value.\n */\n\nexport function createContext<Value>(defaultValue: Value): Context<Value>;\nexport function createContext<Value = undefined>(): Context<Value | undefined>;\n\nexport function createContext(defaultValue?: any) {\n return _createContext(defaultValue);\n}\n\n/**\n * A hook that retrieves the current value of a context and optionally applies\n * a selector function to transform the context value. This hook ensures that the component\n * subscribes to the context and re-renders when the context value changes.\n *\n * @template T - The type of the context value.\n * @template R - The type of the transformed value returned by the selector.\n * @param context - The context object to retrieve the value from.\n * @param selector - An optional selector function to transform the context value.\n * Defaults to an identity function.\n * @returns - The current value of the context, optionally transformed by the selector.\n *\n * @throws - Throws an error if the provided context is invalid or if the hook\n * is used outside of a render function.\n *\n * @example\n * const MyContext = createContext({ user: null });\n * \n * function MyComponent() {\n * const user = useContext(MyContext, context => context.user);\n * return <div>{user ? `Hello, ${user.name}` : 'Hello, Guest'}</div>;\n * }\n */\nexport const useContext = <T, R = T>(\n context: Context<T>,\n selector: (state: T) => R = v => v as any\n) => {\n if (!isContext(context)) throw Error(`Invalid type of ${context}`);\n const state = reconciler.currentHookState;\n if (!state) throw Error('useContext must be used within a render function.');\n const { contextValue, listens } = state;\n listens.add(context);\n const { value = _contextDefaultValue.get(context) } = contextValue.get(context) ?? {};\n return selector(value);\n};\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\n\nexport const equalDeps = (lhs: any, rhs: any) => {\n if (lhs === rhs) return true;\n if (_.isArray(lhs) && _.isArray(rhs)) {\n if (lhs.length !== rhs.length) return false;\n for (let i = 0; i < lhs.length; i++) {\n if (!equalDeps(lhs[i], rhs[i])) return false;\n }\n return true;\n }\n if (_.isPlainObject(lhs) && _.isPlainObject(rhs)) {\n const lkeys = _.keys(lhs);\n const rkeys = _.keys(rhs);\n if (lkeys.length !== rkeys.length) return false;\n for (const key of lkeys) {\n if (!equalDeps(lhs[key], rhs[key])) return false;\n }\n return true;\n }\n return false;\n}\n\nexport const equalProps = (lhs: Record<string, any>, rhs: Record<string, any>) => {\n if (lhs === rhs) return true;\n const lkeys = _.keys(lhs);\n const rkeys = _.keys(rhs);\n if (lkeys.length !== rkeys.length) return false;\n for (const key of lkeys) {\n if (_.isFunction(lhs[key]) && _.isFunction(rhs[key])) continue;\n if (!equalDeps(lhs[key], rhs[key])) return false;\n }\n return true;\n};\n","//\n// utils.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Ref } from './types/common';\n\nexport const mergeRefs = <T>(...refs: (Ref<T> | null | undefined)[]) => (x: T) => {\n for (const ref of refs) {\n if (_.isNil(ref)) continue;\n else if (typeof ref === 'function') ref(x);\n else if (typeof ref === 'object') ref.current = x;\n else {\n console.error(`mergeRefs cannot handle Refs of type boolean, number or string, received ref ${ref}`);\n }\n }\n}\n\nlet counter = 0;\n\nexport const uniqueId = () => `${Date.now().toString(36)}${(counter++).toString(36)}${Math.random().toString(36).slice(2)}`;\n","//\n// vnode.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { ComponentNode, NativeElementType } from '../types/component';\nimport { Context, isContext } from '../hooks/context';\nimport { reconciler } from './state';\nimport { myersSync } from 'myers.js';\nimport { EventEmitter } from './events';\nimport { equalDeps, equalProps } from './utils';\nimport { _Renderer } from '../renderer';\nimport { PropsType } from '../types/runtime';\nimport { uniqueId } from '../utils';\n\nexport type VNodeState = {\n hook: string;\n deps: any;\n data?: any;\n mount?: () => () => void;\n};\n\nexport type _ContextState = {\n value: any;\n state: string;\n node: VNode;\n};\n\nexport class VNode {\n\n /** @internal */\n _component: ComponentNode;\n\n private _id = uniqueId();\n\n private _event: EventEmitter;\n private _props: PropsType = {};\n private _error?: any;\n private _children: (VNode | string)[] = [];\n private _state?: VNodeState[];\n private _dirty = true;\n private _listens = new Map<Context<any>, Omit<_ContextState, 'value'>>();\n\n /** @internal */\n _content_state = uniqueId();\n private _content_value?: any;\n\n /** @internal */\n constructor(component: ComponentNode, event: EventEmitter) {\n this._component = component;\n this._event = event;\n }\n\n /** @internal */\n _resolve_children(child: any): (VNode | string)[] {\n if (_.isBoolean(child) || _.isNil(child)) return [];\n if (_.isString(child)) return [child];\n if (_.isNumber(child)) return [`${child}`];\n if (child instanceof ComponentNode) return [new VNode(child, this._event)];\n if (_.isArrayLikeObject(child)) return _.flatMap(child, x => this._resolve_children(x));\n if (typeof child[Symbol.iterator] === 'function') return _.flatMap([...child], x => this._resolve_children(x));\n throw Error(`${child} are not valid as a child.`);\n }\n\n get id() {\n return this._id;\n }\n\n get type() {\n return this._component.type;\n }\n\n get props() {\n return this._props;\n }\n\n get key() {\n return this._component.key;\n }\n\n get state() {\n return this._state ?? [];\n }\n\n get children() {\n return this._children;\n }\n\n get error() {\n return this._error;\n }\n\n /** @internal */\n _setDirty() {\n this._dirty = true;\n this._event.emit('onchange');\n }\n\n /** @internal */\n private _check_context(values: Map<Context<any>, Omit<_ContextState, 'value'>>) {\n return this._listens.entries().every(([k, v]) => {\n const { state, node } = values.get(k) ?? {};\n return state === v.state && node === v.node;\n });\n }\n\n /** @internal */\n async _updateIfNeed(options: {\n renderer: _Renderer<any>;\n stack: VNode[];\n propsProvider: VNode[];\n errorBoundary?: VNode;\n contextValue: Map<Context<any>, _ContextState>;\n }) {\n if (!this._dirty && this._check_context(options.contextValue)) return false;\n try {\n const self = this;\n const { type, props: _props } = this._component;\n const props = _.mapValues(\n options.propsProvider.reduceRight((p, node) => node.props.callback({ type, props: p }), _props),\n (v, k) => _.isFunction(v) ? function (this: any, ...args: any[]) {\n const current = self._component.props[k];\n return _.isFunction(current) ? current.call(this, ...args) : v.call(this, ...args);\n } : v,\n );\n let children: (VNode | string)[];\n if (_.isString(type) || type?.prototype instanceof NativeElementType) {\n children = this._resolve_children(props.children);\n } else if (isContext(type)) {\n const { value } = props;\n if (!equalDeps(this._content_value, value)) this._content_state = uniqueId();\n this._content_value = value;\n children = this._resolve_children(type(props as any));\n } else if (_.isFunction(type)) {\n let resolved;\n while (true) {\n const {\n resolved: rendered,\n error,\n state,\n } = reconciler.withHookState({\n renderer: options.renderer,\n node: this,\n state: this._state,\n stack: options.stack,\n contextValue: options.contextValue,\n }, () => type(props));\n this._state = state.state;\n if (_.isEmpty(state.tasks)) {\n if (error) throw error;\n resolved = { rendered, state };\n break;\n }\n await Promise.all(state.tasks);\n }\n this._listens = new Map(options.contextValue.entries().filter(([k]) => resolved.state.listens.has(k)));\n children = this._resolve_children(resolved.rendered);\n } else {\n throw Error(`Invalid node type ${type}`);\n }\n const diff = myersSync(this._children, children, {\n compare: (lhs, rhs) => {\n if (_.isString(lhs) && _.isString(rhs)) return lhs === rhs;\n if (lhs instanceof VNode && rhs instanceof VNode) return lhs._component._equal(rhs._component);\n return false;\n },\n });\n this._props = _.omit(props, 'children');\n this._children = _.flatMap(diff, x => x.equivalent ?? x.insert ?? []);\n this._error = undefined;\n for (const [i, item] of this._children.entries()) {\n if (!(item instanceof VNode)) continue;\n if (!(children[i] instanceof VNode)) continue;\n if (!equalProps(item._component.props, children[i]._component.props)) item._dirty = true;\n item._component = children[i]._component;\n }\n } catch (error) {\n this._props = {};\n this._children = [];\n this._error = error;\n (async () => {\n try {\n const { onError, silent } = options.errorBoundary?.props ?? {};\n if (!silent) console.error(error);\n if (_.isFunction(onError)) await onError(error, this._component, _.map(options.stack, x => x._component));\n } catch (e) {\n console.error(e);\n }\n })();\n } finally {\n this._dirty = false;\n }\n return true;\n }\n}\n","//\n// events.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\n\nexport class EventEmitter {\n\n private _listeners: Record<string, ((...args: any[]) => void)[]> = {};\n\n register(event: string, callback: (event: string, ...args: any[]) => void) {\n if (_.isNil(this._listeners[event])) this._listeners[event] = [];\n const _callback = (...args: any[]) => callback(event, ...args);\n this._listeners[event].push(_callback);\n return {\n remove: () => {\n this._listeners[event] = _.filter(this._listeners[event], x => x !== _callback);\n },\n };\n }\n\n emit(event: string, ...args: any[]) {\n this._listeners[event]?.forEach(async callback => {\n try {\n await callback(...args)\n } catch (e) {\n console.error(e);\n }\n });\n }\n}\n","//\n// props.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { ComponentType, PropsWithChildren } from './common';\nimport { NativeElementType } from './component';\nimport { _ElementType, PropsType } from './runtime';\n\ntype PropsProviderProps = PropsWithChildren<{\n callback: (v: {\n type: _ElementType | typeof NativeElementType,\n props: PropsType\n }) => PropsType | undefined | null;\n}>;\n\nexport const PropsProvider: ComponentType<PropsProviderProps> = ({ children }) => {\n return children;\n}\n","//\n// error.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { ComponentType, PropsWithChildren } from './common';\nimport { ComponentNode } from './component';\n\ntype ErrorBoundaryProps = PropsWithChildren<{\n silent?: boolean;\n onError?: (\n error: any,\n component: ComponentNode,\n stack: ComponentNode[],\n ) => void;\n}>;\n\nexport const ErrorBoundary: ComponentType<ErrorBoundaryProps> = ({ children }) => {\n return children;\n}\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { ComponentNode } from '../types/component';\nimport { Context, isContext } from '../hooks/context';\nimport { _ContextState, VNode, VNodeState } from './vnode';\nimport { EventEmitter } from './events';\nimport { PropsProvider } from '../types/props';\nimport { ErrorBoundary } from '../types/error';\nimport { _Renderer } from '../renderer';\n\nclass HookState {\n\n renderer: _Renderer<any>;\n\n contextValue: Map<Context<any>, _ContextState>;\n prevState?: VNodeState[];\n state: VNodeState[] = [];\n stack: VNode[] = [];\n node?: VNode;\n\n listens = new WeakSet<Context<any>>();\n\n tasks: PromiseLike<void>[] = [];\n\n constructor(options: {\n renderer: _Renderer<any>;\n node: VNode;\n stack: VNode[];\n state?: VNodeState[];\n contextValue: Map<Context<any>, _ContextState>;\n }) {\n this.renderer = options.renderer;\n this.node = options.node;\n this.stack = options.stack;\n this.prevState = options.state;\n this.contextValue = options.contextValue ?? new Map();\n }\n}\n\nexport const reconciler = new class {\n\n /** @internal */\n _registry = new WeakMap<any, string>();\n\n /** @internal */\n _currentHookState: HookState | undefined;\n\n get currentHookState() {\n return this._currentHookState;\n }\n\n withHookState<R = void>(\n options: ConstructorParameters<typeof HookState>[0],\n callback: (state: HookState) => R,\n ) {\n const state = new HookState(options);\n try {\n reconciler._currentHookState = state;\n return { resolved: callback(state), state };\n } catch (error) {\n return { error, state };\n } finally {\n reconciler._currentHookState = undefined;\n }\n }\n\n buildVNodes(component: ComponentNode, renderer: _Renderer<any>) {\n const event = new EventEmitter();\n const root = new VNode(component, event);\n const excute = async function* () {\n const items: {\n node: VNode;\n stack: VNode[];\n propsProvider: VNode[];\n errorBoundary?: VNode;\n contextValue: Map<Context<any>, _ContextState>;\n }[] = [{\n node: root,\n stack: [],\n propsProvider: [],\n contextValue: new Map(),\n }];\n let item;\n while (item = items.shift()) {\n\n const { node, stack, propsProvider, errorBoundary, contextValue } = item;\n yield {\n node,\n stack,\n updated: await node._updateIfNeed({\n renderer,\n stack,\n propsProvider,\n errorBoundary,\n contextValue\n }),\n };\n\n let _contextValue = contextValue;\n if (isContext(node.type)) {\n _contextValue = new Map(_contextValue);\n _contextValue.set(node.type, {\n value: node.props.value,\n state: node._content_state,\n node: node,\n });\n }\n\n const _propsProvider = node.type === PropsProvider ? [...propsProvider, node] : propsProvider;\n const _errorBoundary = node.type === ErrorBoundary ? node : errorBoundary;\n\n const _stack = [...stack, node];\n for (const item of node.children) {\n if (item instanceof VNode) {\n items.push({\n node: item,\n stack: _stack,\n propsProvider: _propsProvider,\n errorBoundary: _errorBoundary,\n contextValue: _contextValue,\n });\n }\n }\n }\n };\n return { node: root, event, excute };\n }\n};\n"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASM,MAAgB,gBAAiB,SAAQ,iBAAiB,CAAA;AAE/D;AAED;;;;;;AAMG;AACI,MAAM,WAAW,GAAG,CAAC,EAAE,iBAAiB,EAAE,iBAAiB,GAAG,EAAE,EAAA,GAGnE,EAAE,KAAI;AACR,IAAA,MAAM,cAAc,GAAG,CAAC,EAAE,QAAQ,EAAyB,KAAK,cAAc,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,CAAC;IACtG,MAAM,eAAgB,SAAQ,gBAAgB,CAAA;AAC5C,QAAA,WAAW,CAAC,KAAqB,EAAA;AAC/B,YAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAAE,OAAO,CAAC,CAAC,iBAAiB;YACjD,OAAO,KAAK,CAAC,IAAI,KAAK,cAAc,IAAI,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC;QAC1F;AACD;IACD,OAAO;AACL,QAAA,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAyB,KAAK,cAAc,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,CAAC;AAC9F,QAAA,KAAK,EAAE,cAAc;KACtB;AACH;;AC1DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA,MAAM,oBAAoB,GAAG,IAAI,OAAO,EAAqB;AAEtD,MAAM,SAAS,GA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;wBACvB,KAAK,EAAE,IAAI,CAAC,cAAc;AAC1B,wBAAA,IAAI,EAAE,IAAI;AACX,qBAAA,CAAC;gBACJ;gBAEA,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,KAAK,aAAa,GAAG,CAAC,GAAG,aAAa,EAAE,IAAI,CAAC,GAAG,aAAa;AAC7F,gBAAA,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,KAAK,aAAa,GAAG,IAAI,GAAG,aAAa;gBAEzE,MAAM,MAAM,GAAG,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC;AAC/B,gBAAA,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE;AAChC,oBAAA,IAAI,IAAI,YAAY,KAAK,EAAE;wBACzB,KAAK,CAAC,IAAI,CAAC;AACT,4BAAA,IAAI,EAAE,IAAI;AACV,4BAAA,KAAK,EAAE,MAAM;AACb,4BAAA,aAAa,EAAE,cAAc;AAC7B,4BAAA,aAAa,EAAE,cAAc;AAC7B,4BAAA,YAAY,EAAE,aAAa;AAC5B,yBAAA,CAAC;oBACJ;gBACF;YACF;AACF,QAAA,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE;IACtC;;;;;"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var _ = require('lodash');
4
- var state = require('./state-DFlnc6I0.js');
4
+ var state = require('./state-C9_fGuhZ.js');
5
5
 
6
6
  //
7
7
  // index.ts
@@ -296,4 +296,4 @@ exports.useCallback = useCallback;
296
296
  exports.useEffect = useEffect;
297
297
  exports.useMemo = useMemo;
298
298
  exports.useSyncExternalStore = useSyncExternalStore;
299
- //# sourceMappingURL=sync-OyR_m41B.js.map
299
+ //# sourceMappingURL=sync-B7gLfyQK.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sync-OyR_m41B.js","sources":["../../../src/core/reconciler/hooks.ts","../../../src/core/hooks/effect.ts","../../../src/core/hooks/callback.ts","../../../src/core/hooks/memo.ts","../../../src/core/hooks/sync.ts"],"sourcesContent":["//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from './state';\nimport { equalDeps } from './utils';\n\nconst _useHookState = (hook: string) => {\n const state = reconciler.currentHookState;\n if (!state) throw Error(`${hook} must be used within a render function.`);\n const { prevState, state: newState } = state;\n if (prevState && prevState[newState.length]?.hook !== hook) {\n console.warn([\n `Hook \"${hook}\" is called conditionally.`,\n 'Hooks must be called in the exact same order in every component render.',\n 'Did you accidentally call a hook after an early return?'\n ].join(' '));\n }\n return state;\n};\n\nexport const _useEffect = (\n hook: string,\n effect: (state: ReturnType<typeof _useHookState>) => () => void,\n deps?: any\n) => {\n const state = _useHookState(hook);\n const { state: newState } = state;\n newState.push({\n mount: () => effect(state),\n deps,\n hook,\n });\n};\n\nexport const _useMemo = <T>(\n hook: string,\n factory: (state: ReturnType<typeof _useHookState>) => T,\n deps?: any\n): T => {\n const state = _useHookState(hook);\n const { prevState, state: newState } = state;\n const idx = newState.length;\n const changed = prevState?.[idx]?.hook !== hook || !equalDeps(prevState[idx].deps, deps);\n const data = changed ? factory(state) : prevState[idx].data;\n newState.push({\n deps,\n hook,\n data\n });\n return data;\n};\n","//\n// effect.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { _useEffect } from '../reconciler/hooks';\n\n/**\n * A hook that manages side effects with support for an `AbortSignal`.\n * It ensures proper cleanup logic and handles asynchronous operations effectively.\n *\n * @param effect - \n * A function that receives an `AbortSignal` and performs side effects. \n * It can optionally return a cleanup function or a promise that resolves to a cleanup function.\n *\n * @param deps - \n * An optional dependencies that determines when the effect should be re-executed.\n *\n * @example\n * useEffect((signal) => {\n * fetch('/api/data', { signal })\n * .then(response => response.json())\n * .then(data => console.log(data))\n * .catch(err => {\n * if (err.name === 'AbortError') {\n * console.log('Fetch aborted');\n * } else {\n * console.error(err);\n * }\n * });\n * \n * return () => {\n * console.log('Cleanup logic here');\n * };\n * }, []);\n */\nexport const useEffect = (\n effect: (\n signal: AbortSignal,\n ) => Awaitable<void | (() => Awaitable<void>)>,\n deps?: any,\n) => _useEffect('useEffect', () => {\n const abort = new AbortController();\n try {\n const destructor = effect(abort.signal);\n return () => {\n abort.abort();\n (async () => {\n try {\n const _destructor = await destructor;\n if (_.isFunction(_destructor)) _destructor();\n } catch (e) {\n console.error(e);\n }\n })();\n };\n } catch (e) {\n console.error(e);\n return () => abort.abort();\n }\n}, deps);","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\n/**\n * A hook that memoizes a callback function, ensuring that it only changes\n * if its dependencies change. This is useful for optimizing performance by preventing\n * unnecessary re-creations of functions.\n *\n * @template T - The type of the callback function.\n * @param callback - The callback function to be memoized.\n * @param deps - An optional dependencies. If provided, the callback\n * will only be updated when one of these dependencies changes.\n * If not provided, the callback will remain stable.\n * @returns - A stable version of the callback function that will not change unless\n * its dependencies change.\n *\n * @example\n * const memoizedCallback = useCallback(() => {\n * console.log('This function is memoized!');\n * }, [dependency]);\n */\n\nexport function useCallback<T extends (...args: any) => any>(\n callback: T,\n deps?: any\n): T;\n\nexport function useCallback<T extends ((...args: any) => any) | _.Falsey>(\n callback: T,\n deps?: any\n): T;\n\nexport function useCallback<T extends ((...args: any) => any) | _.Falsey>(\n callback: T,\n deps?: any\n): T {\n if (!_.isUndefined(deps)) return _useMemo('useCallback', () => callback, deps);\n const store = _useMemo('useCallback', () => {\n const store = {\n current: callback,\n stable: function (this: any, ...args: any) {\n if (_.isFunction(store.current))\n return store.current.call(this, ...args);\n },\n };\n return store;\n }, null);\n if (_.isFunction(callback)) store.current = callback;\n return callback && (store.stable as T);\n}\n","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that memoizes the result of a factory function.\n * \n * @template T The type of the value returned by the factory function.\n * @param factory A function that produces a value to be memoized.\n * @param deps An optional dependency array. The memoized value is recalculated \n * only when the dependencies change.\n * @returns The memoized value produced by the factory function.\n */\nexport const useMemo = <T>(\n factory: () => T,\n deps?: any,\n) => _useMemo('useMemo', () => factory(), deps);\n","//\n// sync.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { _useEffect } from '../reconciler/hooks';\nimport { reconciler } from '../reconciler/state';\n\n/**\n * A hook utility for synchronizing with an external store.\n *\n * @template Snapshot - The type of the snapshot returned by the store.\n * @param subscribe - A function that sets up a subscription to the external store.\n * - `onStoreChange`: A callback to invoke when the store changes.\n * - `signal`: An `AbortSignal` to handle cleanup when the subscription is no longer needed.\n * - Returns an optional cleanup function or a promise resolving to one.\n * @param getSnapshot - A function that retrieves the current snapshot of the store.\n * @param getServerSnapshot - (Optional) A function that retrieves the snapshot of the store\n * in a server environment.\n * @returns The current snapshot of the store.\n *\n * @throws Will throw an error if used outside of a valid render context.\n */\nexport const useSyncExternalStore = <Snapshot>(\n subscribe: (\n onStoreChange: () => void,\n signal: AbortSignal,\n ) => Awaitable<void | (() => Awaitable<void>)>,\n getSnapshot: () => Snapshot,\n getServerSnapshot?: () => Snapshot,\n) => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useSyncExternalStore must be used within a render function.');\n _useEffect('useSyncExternalStore', ({ node }) => {\n const abort = new AbortController();\n try {\n const destructor = subscribe(() => { node?._setDirty(); }, abort.signal);\n return () => {\n abort.abort();\n (async () => {\n try {\n const _destructor = await destructor;\n if (_.isFunction(_destructor)) _destructor();\n } catch (e) {\n console.error(e);\n }\n })();\n };\n } catch (e) {\n console.error(e);\n return () => abort.abort();\n }\n }, null);\n if (getServerSnapshot && state.renderer._server) {\n return getServerSnapshot();\n }\n return getSnapshot();\n};"],"names":["state","reconciler","equalDeps"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA,MAAM,aAAa,GAAG,CAAC,IAAY,KAAI;AACrC,IAAA,MAAMA,OAAK,GAAGC,gBAAU,CAAC,gBAAgB;AACzC,IAAA,IAAI,CAACD,OAAK;AAAE,QAAA,MAAM,KAAK,CAAC,CAAA,EAAG,IAAI,CAAA,uCAAA,CAAyC,CAAC;IACzE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAGA,O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SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC;AACxE,YAAA,OAAO,MAAK;gBACV,KAAK,CAAC,KAAK,EAAE;gBACb,CAAC,YAAW;AACV,oBAAA,IAAI;AACF,wBAAA,MAAM,WAAW,GAAG,MAAM,UAAU;AACpC,wBAAA,IAAI,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC;AAAE,4BAAA,WAAW,EAAE;oBAC9C;oBAAE,OAAO,CAAC,EAAE;AACV,wBAAA,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;oBAClB;gBACF,CAAC,GAAG;AACN,YAAA,CAAC;QACH;QAAE,OAAO,CAAC,EAAE;AACV,YAAA,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AAChB,YAAA,OAAO,MAAM,KAAK,CAAC,KAAK,EAAE;QAC5B;IACF,CAAC,EAAE,IAAI,CAAC;IACR,IAAI,iBAAiB,IAAIA,OAAK,CAAC,QAAQ,CAAC,OAAO,EAAE;QAC/C,OAAO,iBAAiB,EAAE;IAC5B;IACA,OAAO,WAAW,EAAE;AACtB;;;;;;;;;"}
1
+ {"version":3,"file":"sync-B7gLfyQK.js","sources":["../../../src/core/reconciler/hooks.ts","../../../src/core/hooks/effect.ts","../../../src/core/hooks/callback.ts","../../../src/core/hooks/memo.ts","../../../src/core/hooks/sync.ts"],"sourcesContent":["//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from './state';\nimport { equalDeps } from './utils';\n\nconst _useHookState = (hook: string) => {\n const state = reconciler.currentHookState;\n if (!state) throw Error(`${hook} must be used within a render function.`);\n const { prevState, state: newState } = state;\n if (prevState && prevState[newState.length]?.hook !== hook) {\n console.warn([\n `Hook \"${hook}\" is called conditionally.`,\n 'Hooks must be called in the exact same order in every component render.',\n 'Did you accidentally call a hook after an early return?'\n ].join(' '));\n }\n return state;\n};\n\nexport const _useEffect = (\n hook: string,\n effect: (state: ReturnType<typeof _useHookState>) => () => void,\n deps?: any\n) => {\n const state = _useHookState(hook);\n const { state: newState } = state;\n newState.push({\n mount: () => effect(state),\n deps,\n hook,\n });\n};\n\nexport const _useMemo = <T>(\n hook: string,\n factory: (state: ReturnType<typeof _useHookState>) => T,\n deps?: any\n): T => {\n const state = _useHookState(hook);\n const { prevState, state: newState } = state;\n const idx = newState.length;\n const changed = prevState?.[idx]?.hook !== hook || !equalDeps(prevState[idx].deps, deps);\n const data = changed ? factory(state) : prevState[idx].data;\n newState.push({\n deps,\n hook,\n data\n });\n return data;\n};\n","//\n// effect.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { _useEffect } from '../reconciler/hooks';\n\n/**\n * A hook that manages side effects with support for an `AbortSignal`.\n * It ensures proper cleanup logic and handles asynchronous operations effectively.\n *\n * @param effect - \n * A function that receives an `AbortSignal` and performs side effects. \n * It can optionally return a cleanup function or a promise that resolves to a cleanup function.\n *\n * @param deps - \n * An optional dependencies that determines when the effect should be re-executed.\n *\n * @example\n * useEffect((signal) => {\n * fetch('/api/data', { signal })\n * .then(response => response.json())\n * .then(data => console.log(data))\n * .catch(err => {\n * if (err.name === 'AbortError') {\n * console.log('Fetch aborted');\n * } else {\n * console.error(err);\n * }\n * });\n * \n * return () => {\n * console.log('Cleanup logic here');\n * };\n * }, []);\n */\nexport const useEffect = (\n effect: (\n signal: AbortSignal,\n ) => Awaitable<void | (() => Awaitable<void>)>,\n deps?: any,\n) => _useEffect('useEffect', () => {\n const abort = new AbortController();\n try {\n const destructor = effect(abort.signal);\n return () => {\n abort.abort();\n (async () => {\n try {\n const _destructor = await destructor;\n if (_.isFunction(_destructor)) _destructor();\n } catch (e) {\n console.error(e);\n }\n })();\n };\n } catch (e) {\n console.error(e);\n return () => abort.abort();\n }\n}, deps);","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\n/**\n * A hook that memoizes a callback function, ensuring that it only changes\n * if its dependencies change. This is useful for optimizing performance by preventing\n * unnecessary re-creations of functions.\n *\n * @template T - The type of the callback function.\n * @param callback - The callback function to be memoized.\n * @param deps - An optional dependencies. If provided, the callback\n * will only be updated when one of these dependencies changes.\n * If not provided, the callback will remain stable.\n * @returns - A stable version of the callback function that will not change unless\n * its dependencies change.\n *\n * @example\n * const memoizedCallback = useCallback(() => {\n * console.log('This function is memoized!');\n * }, [dependency]);\n */\n\nexport function useCallback<T extends (...args: any) => any>(\n callback: T,\n deps?: any\n): T;\n\nexport function useCallback<T extends ((...args: any) => any) | _.Falsey>(\n callback: T,\n deps?: any\n): T;\n\nexport function useCallback<T extends ((...args: any) => any) | _.Falsey>(\n callback: T,\n deps?: any\n): T {\n if (!_.isUndefined(deps)) return _useMemo('useCallback', () => callback, deps);\n const store = _useMemo('useCallback', () => {\n const store = {\n current: callback,\n stable: function (this: any, ...args: any) {\n if (_.isFunction(store.current))\n return store.current.call(this, ...args);\n },\n };\n return store;\n }, null);\n if (_.isFunction(callback)) store.current = callback;\n return callback && (store.stable as T);\n}\n","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that memoizes the result of a factory function.\n * \n * @template T The type of the value returned by the factory function.\n * @param factory A function that produces a value to be memoized.\n * @param deps An optional dependency array. The memoized value is recalculated \n * only when the dependencies change.\n * @returns The memoized value produced by the factory function.\n */\nexport const useMemo = <T>(\n factory: () => T,\n deps?: any,\n) => _useMemo('useMemo', () => factory(), deps);\n","//\n// sync.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { _useEffect } from '../reconciler/hooks';\nimport { reconciler } from '../reconciler/state';\n\n/**\n * A hook utility for synchronizing with an external store.\n *\n * @template Snapshot - The type of the snapshot returned by the store.\n * @param subscribe - A function that sets up a subscription to the external store.\n * - `onStoreChange`: A callback to invoke when the store changes.\n * - `signal`: An `AbortSignal` to handle cleanup when the subscription is no longer needed.\n * - Returns an optional cleanup function or a promise resolving to one.\n * @param getSnapshot - A function that retrieves the current snapshot of the store.\n * @param getServerSnapshot - (Optional) A function that retrieves the snapshot of the store\n * in a server environment.\n * @returns The current snapshot of the store.\n *\n * @throws Will throw an error if used outside of a valid render context.\n */\nexport const useSyncExternalStore = <Snapshot>(\n subscribe: (\n onStoreChange: () => void,\n signal: AbortSignal,\n ) => Awaitable<void | (() => Awaitable<void>)>,\n getSnapshot: () => Snapshot,\n getServerSnapshot?: () => Snapshot,\n) => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useSyncExternalStore must be used within a render function.');\n _useEffect('useSyncExternalStore', ({ node }) => {\n const abort = new AbortController();\n try {\n const destructor = subscribe(() => { node?._setDirty(); }, abort.signal);\n return () => {\n abort.abort();\n (async () => {\n try {\n const _destructor = await destructor;\n if (_.isFunction(_destructor)) _destructor();\n } catch (e) {\n console.error(e);\n }\n })();\n };\n } catch (e) {\n console.error(e);\n return () => abort.abort();\n }\n }, null);\n if (getServerSnapshot && state.renderer._server) {\n return getServerSnapshot();\n }\n return getSnapshot();\n};"],"names":["state","reconciler","equalDeps"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA,MAAM,aAAa,GAAG,CAAC,IAAY,KAAI;AACrC,IAAA,MAAMA,OAAK,GAAGC,gBAAU,CAAC,gBAAgB;AACzC,IAAA,IAAI,CAACD,OAAK;AAAE,QAAA,MAAM,KAAK,CAAC,CAAA,EAAG,IAAI,CAAA,uCAAA,CAAyC,CAAC;IACzE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAGA,OAAK;AAC5C,IAAA,IAAI,SAAS,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,KAAK,IAAI,EAAE;QAC1D,OAAO,CAAC,IAAI,CAAC;AACX,YAAA,CAAA,MAAA,EAAS,IAAI,CAAA,0BAAA,CAA4B;YACzC,yEAAyE;YACzE;AACD,SAAA,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACd;AACA,IAAA,OAAOA,OAAK;AACd,CAAC;AAEM,MAAM,UAAU,GAAG,CACxB,IAAY,EACZ,MAA+D,EAC/D,IAAU,KACR;AACF,IAAA,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC;AACjC,IAAA,MA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AAA,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AAChB,YAAA,OAAO,MAAM,KAAK,CAAC,KAAK,EAAE;QAC5B;IACF,CAAC,EAAE,IAAI,CAAC;IACR,IAAI,iBAAiB,IAAIA,OAAK,CAAC,QAAQ,CAAC,OAAO,EAAE;QAC/C,OAAO,iBAAiB,EAAE;IAC5B;IACA,OAAO,WAAW,EAAE;AACtB;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  import _ from 'lodash';
2
- import { e as equalDeps, r as reconciler } from './state-YzaxTA1n.mjs';
2
+ import { e as equalDeps, r as reconciler } from './state-DgSrjGGU.mjs';
3
3
 
4
4
  //
5
5
  // index.ts
@@ -289,4 +289,4 @@ const useSyncExternalStore = (subscribe, getSnapshot, getServerSnapshot) => {
289
289
  };
290
290
 
291
291
  export { _useMemo as _, useEffect as a, useCallback as b, useSyncExternalStore as c, _useEffect as d, useMemo as u };
292
- //# sourceMappingURL=sync-CxgNMmpR.mjs.map
292
+ //# sourceMappingURL=sync-CeJllG9M.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"sync-CxgNMmpR.mjs","sources":["../../../src/core/reconciler/hooks.ts","../../../src/core/hooks/effect.ts","../../../src/core/hooks/callback.ts","../../../src/core/hooks/memo.ts","../../../src/core/hooks/sync.ts"],"sourcesContent":["//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from './state';\nimport { equalDeps } from './utils';\n\nconst _useHookState = (hook: string) => {\n const state = reconciler.currentHookState;\n if (!state) throw Error(`${hook} must be used within a render function.`);\n const { prevState, state: newState } = state;\n if (prevState && prevState[newState.length]?.hook !== hook) {\n console.warn([\n `Hook \"${hook}\" is called conditionally.`,\n 'Hooks must be called in the exact same order in every component render.',\n 'Did you accidentally call a hook after an early return?'\n ].join(' '));\n }\n return state;\n};\n\nexport const _useEffect = (\n hook: string,\n effect: (state: ReturnType<typeof _useHookState>) => () => void,\n deps?: any\n) => {\n const state = _useHookState(hook);\n const { state: newState } = state;\n newState.push({\n mount: () => effect(state),\n deps,\n hook,\n });\n};\n\nexport const _useMemo = <T>(\n hook: string,\n factory: (state: ReturnType<typeof _useHookState>) => T,\n deps?: any\n): T => {\n const state = _useHookState(hook);\n const { prevState, state: newState } = state;\n const idx = newState.length;\n const changed = prevState?.[idx]?.hook !== hook || !equalDeps(prevState[idx].deps, deps);\n const data = changed ? factory(state) : prevState[idx].data;\n newState.push({\n deps,\n hook,\n data\n });\n return data;\n};\n","//\n// effect.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { _useEffect } from '../reconciler/hooks';\n\n/**\n * A hook that manages side effects with support for an `AbortSignal`.\n * It ensures proper cleanup logic and handles asynchronous operations effectively.\n *\n * @param effect - \n * A function that receives an `AbortSignal` and performs side effects. \n * It can optionally return a cleanup function or a promise that resolves to a cleanup function.\n *\n * @param deps - \n * An optional dependencies that determines when the effect should be re-executed.\n *\n * @example\n * useEffect((signal) => {\n * fetch('/api/data', { signal })\n * .then(response => response.json())\n * .then(data => console.log(data))\n * .catch(err => {\n * if (err.name === 'AbortError') {\n * console.log('Fetch aborted');\n * } else {\n * console.error(err);\n * }\n * });\n * \n * return () => {\n * console.log('Cleanup logic here');\n * };\n * }, []);\n */\nexport const useEffect = (\n effect: (\n signal: AbortSignal,\n ) => Awaitable<void | (() => Awaitable<void>)>,\n deps?: any,\n) => _useEffect('useEffect', () => {\n const abort = new AbortController();\n try {\n const destructor = effect(abort.signal);\n return () => {\n abort.abort();\n (async () => {\n try {\n const _destructor = await destructor;\n if (_.isFunction(_destructor)) _destructor();\n } catch (e) {\n console.error(e);\n }\n })();\n };\n } catch (e) {\n console.error(e);\n return () => abort.abort();\n }\n}, deps);","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\n/**\n * A hook that memoizes a callback function, ensuring that it only changes\n * if its dependencies change. This is useful for optimizing performance by preventing\n * unnecessary re-creations of functions.\n *\n * @template T - The type of the callback function.\n * @param callback - The callback function to be memoized.\n * @param deps - An optional dependencies. If provided, the callback\n * will only be updated when one of these dependencies changes.\n * If not provided, the callback will remain stable.\n * @returns - A stable version of the callback function that will not change unless\n * its dependencies change.\n *\n * @example\n * const memoizedCallback = useCallback(() => {\n * console.log('This function is memoized!');\n * }, [dependency]);\n */\n\nexport function useCallback<T extends (...args: any) => any>(\n callback: T,\n deps?: any\n): T;\n\nexport function useCallback<T extends ((...args: any) => any) | _.Falsey>(\n callback: T,\n deps?: any\n): T;\n\nexport function useCallback<T extends ((...args: any) => any) | _.Falsey>(\n callback: T,\n deps?: any\n): T {\n if (!_.isUndefined(deps)) return _useMemo('useCallback', () => callback, deps);\n const store = _useMemo('useCallback', () => {\n const store = {\n current: callback,\n stable: function (this: any, ...args: any) {\n if (_.isFunction(store.current))\n return store.current.call(this, ...args);\n },\n };\n return store;\n }, null);\n if (_.isFunction(callback)) store.current = callback;\n return callback && (store.stable as T);\n}\n","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that memoizes the result of a factory function.\n * \n * @template T The type of the value returned by the factory function.\n * @param factory A function that produces a value to be memoized.\n * @param deps An optional dependency array. The memoized value is recalculated \n * only when the dependencies change.\n * @returns The memoized value produced by the factory function.\n */\nexport const useMemo = <T>(\n factory: () => T,\n deps?: any,\n) => _useMemo('useMemo', () => factory(), deps);\n","//\n// sync.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { _useEffect } from '../reconciler/hooks';\nimport { reconciler } from '../reconciler/state';\n\n/**\n * A hook utility for synchronizing with an external store.\n *\n * @template Snapshot - The type of the snapshot returned by the store.\n * @param subscribe - A function that sets up a subscription to the external store.\n * - `onStoreChange`: A callback to invoke when the store changes.\n * - `signal`: An `AbortSignal` to handle cleanup when the subscription is no longer needed.\n * - Returns an optional cleanup function or a promise resolving to one.\n * @param getSnapshot - A function that retrieves the current snapshot of the store.\n * @param getServerSnapshot - (Optional) A function that retrieves the snapshot of the store\n * in a server environment.\n * @returns The current snapshot of the store.\n *\n * @throws Will throw an error if used outside of a valid render context.\n */\nexport const useSyncExternalStore = <Snapshot>(\n subscribe: (\n onStoreChange: () => void,\n signal: AbortSignal,\n ) => Awaitable<void | (() => Awaitable<void>)>,\n getSnapshot: () => Snapshot,\n getServerSnapshot?: () => Snapshot,\n) => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useSyncExternalStore must be used within a render function.');\n _useEffect('useSyncExternalStore', ({ node }) => {\n const abort = new AbortController();\n try {\n const destructor = subscribe(() => { node?._setDirty(); }, abort.signal);\n return () => {\n abort.abort();\n (async () => {\n try {\n const _destructor = await destructor;\n if (_.isFunction(_destructor)) _destructor();\n } catch (e) {\n console.error(e);\n }\n })();\n };\n } catch (e) {\n console.error(e);\n return () => abort.abort();\n }\n }, null);\n if (getServerSnapshot && state.renderer._server) {\n return getServerSnapshot();\n }\n return getSnapshot();\n};"],"names":[],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA,MAAM,aAAa,GAAG,CAAC,IAAY,KAAI;AACrC,IAAA,MAAM,KAAK,GAAG,UAAU,CAAC,gBAAgB;AACzC,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,MAAM,KAAK,CAAC,CAAA,EAAG,IAAI,CAAA,uCAAA,CAAyC,CAAC;IACzE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK;AAC5C,IAAA,IAAI,SAAS,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,KAAK,IAAI,EAAE;QAC1D,OAAO,CAAC,IAAI,CAAC;AACX,YAAA,CAAA,MAAA,EAAS,IAAI,CAAA,0BAAA,CAA4B;YACzC,yEAAyE;YACzE;AACD,SAAA,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACd;AACA,IAAA,OAAO,KAAK;AACd,CAAC;AAEM,MAAM,UAAU,GAAG,CACxB,IAAY,EACZ,MAA+D,EAC/D,IAAU,KACR;AACF,IAAA,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC;AACjC,IAAA,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK;IACjC,QAA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M,KAAK,CAAC,KAAK,EAAE;QAC5B;IACF,CAAC,EAAE,IAAI,CAAC;IACR,IAAI,iBAAiB,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE;QAC/C,OAAO,iBAAiB,EAAE;IAC5B;IACA,OAAO,WAAW,EAAE;AACtB;;;;"}
1
+ {"version":3,"file":"sync-CeJllG9M.mjs","sources":["../../../src/core/reconciler/hooks.ts","../../../src/core/hooks/effect.ts","../../../src/core/hooks/callback.ts","../../../src/core/hooks/memo.ts","../../../src/core/hooks/sync.ts"],"sourcesContent":["//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from './state';\nimport { equalDeps } from './utils';\n\nconst _useHookState = (hook: string) => {\n const state = reconciler.currentHookState;\n if (!state) throw Error(`${hook} must be used within a render function.`);\n const { prevState, state: newState } = state;\n if (prevState && prevState[newState.length]?.hook !== hook) {\n console.warn([\n `Hook \"${hook}\" is called conditionally.`,\n 'Hooks must be called in the exact same order in every component render.',\n 'Did you accidentally call a hook after an early return?'\n ].join(' '));\n }\n return state;\n};\n\nexport const _useEffect = (\n hook: string,\n effect: (state: ReturnType<typeof _useHookState>) => () => void,\n deps?: any\n) => {\n const state = _useHookState(hook);\n const { state: newState } = state;\n newState.push({\n mount: () => effect(state),\n deps,\n hook,\n });\n};\n\nexport const _useMemo = <T>(\n hook: string,\n factory: (state: ReturnType<typeof _useHookState>) => T,\n deps?: any\n): T => {\n const state = _useHookState(hook);\n const { prevState, state: newState } = state;\n const idx = newState.length;\n const changed = prevState?.[idx]?.hook !== hook || !equalDeps(prevState[idx].deps, deps);\n const data = changed ? factory(state) : prevState[idx].data;\n newState.push({\n deps,\n hook,\n data\n });\n return data;\n};\n","//\n// effect.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { _useEffect } from '../reconciler/hooks';\n\n/**\n * A hook that manages side effects with support for an `AbortSignal`.\n * It ensures proper cleanup logic and handles asynchronous operations effectively.\n *\n * @param effect - \n * A function that receives an `AbortSignal` and performs side effects. \n * It can optionally return a cleanup function or a promise that resolves to a cleanup function.\n *\n * @param deps - \n * An optional dependencies that determines when the effect should be re-executed.\n *\n * @example\n * useEffect((signal) => {\n * fetch('/api/data', { signal })\n * .then(response => response.json())\n * .then(data => console.log(data))\n * .catch(err => {\n * if (err.name === 'AbortError') {\n * console.log('Fetch aborted');\n * } else {\n * console.error(err);\n * }\n * });\n * \n * return () => {\n * console.log('Cleanup logic here');\n * };\n * }, []);\n */\nexport const useEffect = (\n effect: (\n signal: AbortSignal,\n ) => Awaitable<void | (() => Awaitable<void>)>,\n deps?: any,\n) => _useEffect('useEffect', () => {\n const abort = new AbortController();\n try {\n const destructor = effect(abort.signal);\n return () => {\n abort.abort();\n (async () => {\n try {\n const _destructor = await destructor;\n if (_.isFunction(_destructor)) _destructor();\n } catch (e) {\n console.error(e);\n }\n })();\n };\n } catch (e) {\n console.error(e);\n return () => abort.abort();\n }\n}, deps);","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\n/**\n * A hook that memoizes a callback function, ensuring that it only changes\n * if its dependencies change. This is useful for optimizing performance by preventing\n * unnecessary re-creations of functions.\n *\n * @template T - The type of the callback function.\n * @param callback - The callback function to be memoized.\n * @param deps - An optional dependencies. If provided, the callback\n * will only be updated when one of these dependencies changes.\n * If not provided, the callback will remain stable.\n * @returns - A stable version of the callback function that will not change unless\n * its dependencies change.\n *\n * @example\n * const memoizedCallback = useCallback(() => {\n * console.log('This function is memoized!');\n * }, [dependency]);\n */\n\nexport function useCallback<T extends (...args: any) => any>(\n callback: T,\n deps?: any\n): T;\n\nexport function useCallback<T extends ((...args: any) => any) | _.Falsey>(\n callback: T,\n deps?: any\n): T;\n\nexport function useCallback<T extends ((...args: any) => any) | _.Falsey>(\n callback: T,\n deps?: any\n): T {\n if (!_.isUndefined(deps)) return _useMemo('useCallback', () => callback, deps);\n const store = _useMemo('useCallback', () => {\n const store = {\n current: callback,\n stable: function (this: any, ...args: any) {\n if (_.isFunction(store.current))\n return store.current.call(this, ...args);\n },\n };\n return store;\n }, null);\n if (_.isFunction(callback)) store.current = callback;\n return callback && (store.stable as T);\n}\n","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that memoizes the result of a factory function.\n * \n * @template T The type of the value returned by the factory function.\n * @param factory A function that produces a value to be memoized.\n * @param deps An optional dependency array. The memoized value is recalculated \n * only when the dependencies change.\n * @returns The memoized value produced by the factory function.\n */\nexport const useMemo = <T>(\n factory: () => T,\n deps?: any,\n) => _useMemo('useMemo', () => factory(), deps);\n","//\n// sync.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { _useEffect } from '../reconciler/hooks';\nimport { reconciler } from '../reconciler/state';\n\n/**\n * A hook utility for synchronizing with an external store.\n *\n * @template Snapshot - The type of the snapshot returned by the store.\n * @param subscribe - A function that sets up a subscription to the external store.\n * - `onStoreChange`: A callback to invoke when the store changes.\n * - `signal`: An `AbortSignal` to handle cleanup when the subscription is no longer needed.\n * - Returns an optional cleanup function or a promise resolving to one.\n * @param getSnapshot - A function that retrieves the current snapshot of the store.\n * @param getServerSnapshot - (Optional) A function that retrieves the snapshot of the store\n * in a server environment.\n * @returns The current snapshot of the store.\n *\n * @throws Will throw an error if used outside of a valid render context.\n */\nexport const useSyncExternalStore = <Snapshot>(\n subscribe: (\n onStoreChange: () => void,\n signal: AbortSignal,\n ) => Awaitable<void | (() => Awaitable<void>)>,\n getSnapshot: () => Snapshot,\n getServerSnapshot?: () => Snapshot,\n) => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useSyncExternalStore must be used within a render function.');\n _useEffect('useSyncExternalStore', ({ node }) => {\n const abort = new AbortController();\n try {\n const destructor = subscribe(() => { node?._setDirty(); }, abort.signal);\n return () => {\n abort.abort();\n (async () => {\n try {\n const _destructor = await destructor;\n if (_.isFunction(_destructor)) _destructor();\n } catch (e) {\n console.error(e);\n }\n })();\n };\n } catch (e) {\n console.error(e);\n return () => abort.abort();\n }\n }, null);\n if (getServerSnapshot && state.renderer._server) {\n return getServerSnapshot();\n }\n return getSnapshot();\n};"],"names":[],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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AgB;AACzC,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,MAAM,KAAK,CAAC,6DAA6D,CAAC;IACtF,UAAU,CAAC,sBAAsB,EAAE,CAAC,EAAE,IAAI,EAAE,KAAI;AAC9C,QAAA,MAAM,KAAK,GAAG,IAAI,eAAe,EAAE;AACnC,QAAA,IAAI;AACF,YAAA,MAAM,UAAU,GAAG,SAAS,CAAC,QAAQ,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC;AACxE,YAAA,OAAO,MAAK;gBACV,KAAK,CAAC,KAAK,EAAE;gBACb,CAAC,YAAW;AACV,oBAAA,IAAI;AACF,wBAAA,MAAM,WAAW,GAAG,MAAM,UAAU;AACpC,wBAAA,IAAI,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC;AAAE,4BAAA,WAAW,EAAE;oBAC9C;oBAAE,OAAO,CAAC,EAAE;AACV,wBAAA,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;oBAClB;gBACF,CAAC,GAAG;AACN,YAAA,CAAC;QACH;QAAE,OAAO,CAAC,EAAE;AACV,YAAA,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AAChB,YAAA,OAAO,MAAM,KAAK,CAAC,KAAK,EAAE;QAC5B;IACF,CAAC,EAAE,IAAI,CAAC;IACR,IAAI,iBAAiB,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE;QAC/C,OAAO,iBAAiB,EAAE;IAC5B;IACA,OAAO,WAAW,EAAE;AACtB;;;;"}
@@ -0,0 +1,7 @@
1
+ import { b as Ref } from './common-CpEB3ieX.mjs';
2
+
3
+ declare const mergeRefs: <T>(...refs: (Ref<T> | null | undefined)[]) => (x: T) => void;
4
+ declare const uniqueId: () => string;
5
+
6
+ export { mergeRefs as m, uniqueId as u };
7
+ //# sourceMappingURL=utils-CWsh4Zpu.d.mts.map