frosty 0.0.153 → 0.0.155

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 (46) hide show
  1. package/dist/_native.d.mts +2 -1
  2. package/dist/_native.d.mts.map +1 -1
  3. package/dist/_native.d.ts +2 -1
  4. package/dist/_native.d.ts.map +1 -1
  5. package/dist/_native.js +1 -1
  6. package/dist/_native.mjs +1 -1
  7. package/dist/dom.d.mts +3 -2
  8. package/dist/dom.d.mts.map +1 -1
  9. package/dist/dom.d.ts +3 -2
  10. package/dist/dom.d.ts.map +1 -1
  11. package/dist/dom.js +2 -2
  12. package/dist/dom.mjs +2 -2
  13. package/dist/internals/{index-DCYqTHyF.d.mts → index-BzVLlTCa.d.mts} +3 -1
  14. package/dist/internals/index-BzVLlTCa.d.mts.map +1 -0
  15. package/dist/internals/{index-BXYwGmMq.d.ts → index-OvcTjmzX.d.ts} +3 -1
  16. package/dist/internals/index-OvcTjmzX.d.ts.map +1 -0
  17. package/dist/internals/{renderer-BtM_6vlI.d.mts → renderer-BluiQ1F-.d.mts} +2 -2
  18. package/dist/internals/{renderer-BtM_6vlI.d.mts.map → renderer-BluiQ1F-.d.mts.map} +1 -1
  19. package/dist/internals/{renderer-CRJ6yD_V.mjs → renderer-BvM6i6Cl.mjs} +2 -2
  20. package/dist/internals/{renderer-CRJ6yD_V.mjs.map → renderer-BvM6i6Cl.mjs.map} +1 -1
  21. package/dist/internals/{renderer-1wYRgACC.d.ts → renderer-C1RBQB2f.d.ts} +2 -2
  22. package/dist/internals/{renderer-1wYRgACC.d.ts.map → renderer-C1RBQB2f.d.ts.map} +1 -1
  23. package/dist/internals/{renderer-BXTVLEhY.js → renderer-CFxFx-Ik.js} +2 -2
  24. package/dist/internals/{renderer-BXTVLEhY.js.map → renderer-CFxFx-Ik.js.map} +1 -1
  25. package/dist/internals/{renderer-DxQAalyV.mjs → renderer-DaX4zUo8.mjs} +3 -2
  26. package/dist/internals/renderer-DaX4zUo8.mjs.map +1 -0
  27. package/dist/internals/{renderer-FQADFg6I.js → renderer-ijDmCUMe.js} +3 -2
  28. package/dist/internals/renderer-ijDmCUMe.js.map +1 -0
  29. package/dist/server-dom.d.mts +3 -2
  30. package/dist/server-dom.d.mts.map +1 -1
  31. package/dist/server-dom.d.ts +3 -2
  32. package/dist/server-dom.d.ts.map +1 -1
  33. package/dist/server-dom.js +2 -2
  34. package/dist/server-dom.mjs +2 -2
  35. package/dist/web.d.mts +3 -2
  36. package/dist/web.d.mts.map +1 -1
  37. package/dist/web.d.ts +3 -2
  38. package/dist/web.d.ts.map +1 -1
  39. package/dist/web.js +2 -2
  40. package/dist/web.mjs +3 -3
  41. package/package.json +3 -3
  42. package/packages/frosty-cli/webpack.mjs +1 -1
  43. package/dist/internals/index-BXYwGmMq.d.ts.map +0 -1
  44. package/dist/internals/index-DCYqTHyF.d.mts.map +0 -1
  45. package/dist/internals/renderer-DxQAalyV.mjs.map +0 -1
  46. package/dist/internals/renderer-FQADFg6I.js.map +0 -1
@@ -1,9 +1,10 @@
1
1
  import { N as NativeElementType, c as PropsType, a as ComponentNode } from './internals/common-DU6Re-Mj.mjs';
2
- export { V as VNode, _ as _Renderer } from './internals/index-DCYqTHyF.mjs';
2
+ export { V as VNode, _ as _Renderer } from './internals/index-BzVLlTCa.mjs';
3
3
  export { u as uniqueId } from './internals/utils-ukNJhgdU.mjs';
4
4
  import '@o2ter/utils-js';
5
5
  import 'lodash';
6
6
  import 'csstype';
7
+ import 'nextick';
7
8
 
8
9
  declare class EventEmitter {
9
10
  #private;
@@ -1 +1 @@
1
- {"version":3,"file":"_native.d.mts","sources":["../src/core/reconciler/events.ts","../src/renderer/native.ts"],"sourcesContent":["//\n// events.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 #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// native.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 { _createElement, PropsType } from '../core/types/runtime';\nimport { ComponentNode, NativeElementType } from '../core/types/component';\n\nexport { _Renderer } from '../core/renderer';\nexport { uniqueId } from '../core/utils';\nexport { EventEmitter } from '../core/reconciler/events';\nexport type { VNode } from '../core/reconciler';\nexport { NativeElementType } from '../core/types/component';\n\nexport function _createNativeElement(\n type: typeof NativeElementType,\n props: PropsType,\n key?: string | number\n): ComponentNode {\n return _createElement(type, { ...props, key });\n}\n"],"names":[],"mappings":";;;;;;;AAAO,cAAA,YAAA;AACP;AACA;AACA;AACA;AACA;AACA;;ACCO,iBAAA,oBAAA,cAAA,iBAAA,SAAA,SAAA,0BAAA,aAAA;;;;"}
1
+ {"version":3,"file":"_native.d.mts","sources":["../src/core/reconciler/events.ts","../src/renderer/native.ts"],"sourcesContent":["//\n// events.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 #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// native.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 { _createElement, PropsType } from '../core/types/runtime';\nimport { ComponentNode, NativeElementType } from '../core/types/component';\n\nexport { _Renderer } from '../core/renderer';\nexport { uniqueId } from '../core/utils';\nexport { EventEmitter } from '../core/reconciler/events';\nexport type { VNode } from '../core/reconciler';\nexport { NativeElementType } from '../core/types/component';\n\nexport function _createNativeElement(\n type: typeof NativeElementType,\n props: PropsType,\n key?: string | number\n): ComponentNode {\n return _createElement(type, { ...props, key });\n}\n"],"names":[],"mappings":";;;;;;;;AAAO,cAAA,YAAA;AACP;AACA;AACA;AACA;AACA;AACA;;ACCO,iBAAA,oBAAA,cAAA,iBAAA,SAAA,SAAA,0BAAA,aAAA;;;;"}
package/dist/_native.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { N as NativeElementType, c as PropsType, a as ComponentNode } from './internals/common-DU6Re-Mj.js';
2
- export { V as VNode, _ as _Renderer } from './internals/index-BXYwGmMq.js';
2
+ export { V as VNode, _ as _Renderer } from './internals/index-OvcTjmzX.js';
3
3
  export { u as uniqueId } from './internals/utils-BNdSbzPU.js';
4
4
  import '@o2ter/utils-js';
5
5
  import 'lodash';
6
6
  import 'csstype';
7
+ import 'nextick';
7
8
 
8
9
  declare class EventEmitter {
9
10
  #private;
@@ -1 +1 @@
1
- {"version":3,"file":"_native.d.ts","sources":["../src/core/reconciler/events.ts","../src/renderer/native.ts"],"sourcesContent":["//\n// events.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 #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// native.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 { _createElement, PropsType } from '../core/types/runtime';\nimport { ComponentNode, NativeElementType } from '../core/types/component';\n\nexport { _Renderer } from '../core/renderer';\nexport { uniqueId } from '../core/utils';\nexport { EventEmitter } from '../core/reconciler/events';\nexport type { VNode } from '../core/reconciler';\nexport { NativeElementType } from '../core/types/component';\n\nexport function _createNativeElement(\n type: typeof NativeElementType,\n props: PropsType,\n key?: string | number\n): ComponentNode {\n return _createElement(type, { ...props, key });\n}\n"],"names":[],"mappings":";;;;;;;AAAO,cAAA,YAAA;AACP;AACA;AACA;AACA;AACA;AACA;;ACCO,iBAAA,oBAAA,cAAA,iBAAA,SAAA,SAAA,0BAAA,aAAA;;;;"}
1
+ {"version":3,"file":"_native.d.ts","sources":["../src/core/reconciler/events.ts","../src/renderer/native.ts"],"sourcesContent":["//\n// events.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 #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// native.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 { _createElement, PropsType } from '../core/types/runtime';\nimport { ComponentNode, NativeElementType } from '../core/types/component';\n\nexport { _Renderer } from '../core/renderer';\nexport { uniqueId } from '../core/utils';\nexport { EventEmitter } from '../core/reconciler/events';\nexport type { VNode } from '../core/reconciler';\nexport { NativeElementType } from '../core/types/component';\n\nexport function _createNativeElement(\n type: typeof NativeElementType,\n props: PropsType,\n key?: string | number\n): ComponentNode {\n return _createElement(type, { ...props, key });\n}\n"],"names":[],"mappings":";;;;;;;;AAAO,cAAA,YAAA;AACP;AACA;AACA;AACA;AACA;AACA;;ACCO,iBAAA,oBAAA,cAAA,iBAAA,SAAA,SAAA,0BAAA,aAAA;;;;"}
package/dist/_native.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var runtime = require('./internals/runtime-CeVOFcK_.js');
4
- var renderer = require('./internals/renderer-FQADFg6I.js');
4
+ var renderer = require('./internals/renderer-ijDmCUMe.js');
5
5
  var index = require('./internals/index-CHID44Lo.js');
6
6
  var events = require('./internals/events-BgboMOG9.js');
7
7
  require('lodash');
package/dist/_native.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { _ as _createElement } from './internals/runtime-Bpq-U9sI.mjs';
2
2
  export { N as NativeElementType } from './internals/runtime-Bpq-U9sI.mjs';
3
- export { _ as _Renderer } from './internals/renderer-DxQAalyV.mjs';
3
+ export { _ as _Renderer } from './internals/renderer-DaX4zUo8.mjs';
4
4
  export { u as uniqueId } from './internals/index-CODWK-gF.mjs';
5
5
  export { E as EventEmitter } from './internals/events-BOkAQTmE.mjs';
6
6
  import 'lodash';
package/dist/dom.d.mts CHANGED
@@ -1,9 +1,10 @@
1
- import { _ as _DOMRenderer } from './internals/renderer-BtM_6vlI.mjs';
2
- import './internals/index-DCYqTHyF.mjs';
1
+ import { _ as _DOMRenderer } from './internals/renderer-BluiQ1F-.mjs';
2
+ import './internals/index-BzVLlTCa.mjs';
3
3
  import './internals/common-DU6Re-Mj.mjs';
4
4
  import '@o2ter/utils-js';
5
5
  import 'lodash';
6
6
  import 'csstype';
7
+ import 'nextick';
7
8
  import 'jsdom';
8
9
 
9
10
  declare class DOMRenderer extends _DOMRenderer {
@@ -1 +1 @@
1
- {"version":3,"file":"dom.d.mts","sources":["../src/renderer/dom.ts"],"sourcesContent":["//\n// dom.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 { _DOMRenderer } from './common';\n\nexport class DOMRenderer extends _DOMRenderer {\n\n static default = new DOMRenderer(window);\n\n static createRoot(root: Element): ReturnType<typeof DOMRenderer.default.createRoot> {\n return this.default.createRoot(root);\n }\n\n get _server(): boolean {\n return false;\n }\n}\n"],"names":[],"mappings":";;;;;;;;AACO,cAAA,WAAA,SAAA,YAAA;AACP,oBAAA,WAAA;AACA,4BAAA,OAAA,GAAA,UAAA,QAAA,WAAA,CAAA,OAAA,CAAA,UAAA;AACA;AACA;;;;"}
1
+ {"version":3,"file":"dom.d.mts","sources":["../src/renderer/dom.ts"],"sourcesContent":["//\n// dom.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 { _DOMRenderer } from './common';\n\nexport class DOMRenderer extends _DOMRenderer {\n\n static default = new DOMRenderer(window);\n\n static createRoot(root: Element): ReturnType<typeof DOMRenderer.default.createRoot> {\n return this.default.createRoot(root);\n }\n\n get _server(): boolean {\n return false;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AACO,cAAA,WAAA,SAAA,YAAA;AACP,oBAAA,WAAA;AACA,4BAAA,OAAA,GAAA,UAAA,QAAA,WAAA,CAAA,OAAA,CAAA,UAAA;AACA;AACA;;;;"}
package/dist/dom.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import { _ as _DOMRenderer } from './internals/renderer-1wYRgACC.js';
2
- import './internals/index-BXYwGmMq.js';
1
+ import { _ as _DOMRenderer } from './internals/renderer-C1RBQB2f.js';
2
+ import './internals/index-OvcTjmzX.js';
3
3
  import './internals/common-DU6Re-Mj.js';
4
4
  import '@o2ter/utils-js';
5
5
  import 'lodash';
6
6
  import 'csstype';
7
+ import 'nextick';
7
8
  import 'jsdom';
8
9
 
9
10
  declare class DOMRenderer extends _DOMRenderer {
package/dist/dom.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"dom.d.ts","sources":["../src/renderer/dom.ts"],"sourcesContent":["//\n// dom.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 { _DOMRenderer } from './common';\n\nexport class DOMRenderer extends _DOMRenderer {\n\n static default = new DOMRenderer(window);\n\n static createRoot(root: Element): ReturnType<typeof DOMRenderer.default.createRoot> {\n return this.default.createRoot(root);\n }\n\n get _server(): boolean {\n return false;\n }\n}\n"],"names":[],"mappings":";;;;;;;;AACO,cAAA,WAAA,SAAA,YAAA;AACP,oBAAA,WAAA;AACA,4BAAA,OAAA,GAAA,UAAA,QAAA,WAAA,CAAA,OAAA,CAAA,UAAA;AACA;AACA;;;;"}
1
+ {"version":3,"file":"dom.d.ts","sources":["../src/renderer/dom.ts"],"sourcesContent":["//\n// dom.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 { _DOMRenderer } from './common';\n\nexport class DOMRenderer extends _DOMRenderer {\n\n static default = new DOMRenderer(window);\n\n static createRoot(root: Element): ReturnType<typeof DOMRenderer.default.createRoot> {\n return this.default.createRoot(root);\n }\n\n get _server(): boolean {\n return false;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AACO,cAAA,WAAA,SAAA,YAAA;AACP,oBAAA,WAAA;AACA,4BAAA,OAAA,GAAA,UAAA,QAAA,WAAA,CAAA,OAAA,CAAA,UAAA;AACA;AACA;;;;"}
package/dist/dom.js CHANGED
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var renderer = require('./internals/renderer-BXTVLEhY.js');
3
+ var renderer = require('./internals/renderer-CFxFx-Ik.js');
4
4
  require('lodash');
5
5
  require('myers.js');
6
- require('./internals/renderer-FQADFg6I.js');
6
+ require('./internals/renderer-ijDmCUMe.js');
7
7
  require('./internals/index-CHID44Lo.js');
8
8
  require('./internals/runtime-CeVOFcK_.js');
9
9
  require('nextick');
package/dist/dom.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { _ as _DOMRenderer } from './internals/renderer-CRJ6yD_V.mjs';
1
+ import { _ as _DOMRenderer } from './internals/renderer-BvM6i6Cl.mjs';
2
2
  import 'lodash';
3
3
  import 'myers.js';
4
- import './internals/renderer-DxQAalyV.mjs';
4
+ import './internals/renderer-DaX4zUo8.mjs';
5
5
  import './internals/index-CODWK-gF.mjs';
6
6
  import './internals/runtime-Bpq-U9sI.mjs';
7
7
  import 'nextick';
@@ -1,4 +1,5 @@
1
1
  import { a as ComponentNode, N as NativeElementType, _ as _ElementType, c as PropsType } from './common-DU6Re-Mj.mjs';
2
+ import nextick from 'nextick';
2
3
 
3
4
  declare abstract class _Renderer<T> {
4
5
  #private;
@@ -14,6 +15,7 @@ declare abstract class _Renderer<T> {
14
15
  readonly root: T | T[] | undefined;
15
16
  mount: (component: ComponentNode, options?: {
16
17
  skipMount?: boolean;
18
+ nextick?: typeof nextick;
17
19
  }) => Promise<void>;
18
20
  unmount: () => void;
19
21
  };
@@ -33,4 +35,4 @@ declare class VNode {
33
35
  }
34
36
 
35
37
  export { VNode as V, _Renderer as _ };
36
- //# sourceMappingURL=index-DCYqTHyF.d.mts.map
38
+ //# sourceMappingURL=index-BzVLlTCa.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BzVLlTCa.d.mts","sources":["../../src/core/renderer.ts","../../src/core/reconciler/index.ts"],"sourcesContent":["//\n// renderer.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 { UpdateManager, VNode } from './reconciler';\nimport { ComponentNode, NativeElementType } from './types/component';\nimport { equalDeps } from './reconciler/utils';\nimport { _ParentComponent } from './components/pairs';\nimport nextick from 'nextick';\n\nexport abstract class _Renderer<T> {\n\n protected abstract _beforeUpdate(): void;\n\n protected abstract _afterUpdate(): void;\n\n protected abstract _createElement(node: VNode): T;\n\n protected abstract _updateElement(node: VNode, element: T, children: (T | string)[], force?: boolean): void;\n\n protected abstract _destroyElement(node: VNode, element: T): void;\n\n abstract get _server(): boolean;\n\n #renderStorage = new Map<any, any>();\n\n get renderStorage() {\n return this.#renderStorage;\n }\n\n private async _createRoot(\n root: T | null,\n component: ComponentNode,\n options?: {\n skipMount?: boolean;\n nextick?: typeof nextick;\n },\n ) {\n const _nextick = options?.nextick ?? nextick;\n\n type MountState = {\n hook: string;\n deps: any;\n unmount?: () => void;\n };\n\n const elements = new Map<VNode, T>();\n const mountState = new Map<VNode, MountState[]>();\n\n const childrenDeep = function* (node: VNode): Generator<VNode> {\n for (const child of node.children) {\n if (child instanceof VNode) {\n yield child;\n yield* childrenDeep(child);\n }\n }\n };\n\n const nativeChildren = (node: VNode) => {\n const children = function* (\n node: VNode,\n filter?: (x: string | VNode) => boolean\n ): Generator<T | string> {\n for (const child of node.children) {\n if (_.isString(child)) {\n if (filter && !filter(child)) continue;\n yield child;\n } else {\n if (child.error) continue;\n const element = elements.get(child);\n if (!filter || filter(child)) {\n if (element instanceof _ParentComponent) {\n yield* children(child, x => element.isChildNode(x));\n } else if (element) {\n yield element;\n } else {\n yield* children(child);\n }\n } else if (!element) {\n yield* children(child, filter);\n }\n }\n }\n }\n const element = elements.get(node);\n if (element instanceof _ParentComponent) {\n return children(node, x => element.isChildNode(x));\n } else {\n return children(node);\n }\n }\n\n const unmount = (nodes: Iterable<VNode>) => {\n for (const node of nodes) {\n unmount(_.filter(node.children, x => x instanceof VNode));\n node._release();\n const element = elements.get(node);\n const state = mountState.get(node);\n if (element) {\n try {\n this._destroyElement(node, element);\n } catch (e) {\n console.error(e);\n }\n elements.delete(node);\n } else if (state) {\n for (const { unmount } of state) {\n if (unmount) {\n try {\n unmount();\n } catch (e) {\n console.error(e);\n }\n }\n }\n }\n elements.delete(node);\n mountState.delete(node);\n }\n };\n\n const refresh = async (event: UpdateManager, dirty: Set<VNode>[], force: boolean) => {\n\n try {\n this._beforeUpdate();\n } catch (e) {\n console.error(e);\n }\n\n const mount: Set<VNode>[] = [];\n const removed = new Set<VNode>();\n\n for (const _nodes of dirty) {\n const nodes = [..._nodes || []];\n let node;\n while (node = nodes.shift()) {\n for await (const {\n dirty,\n mount: _mount,\n removed: _removed,\n } of await node._render(event, this)) {\n if (dirty) nodes.push(dirty);\n else if (_mount) {\n if (!mount[_mount.level]) mount[_mount.level] = new Set();\n mount[_mount.level].add(_mount);\n } else if (_removed) removed.add(_removed);\n }\n }\n }\n\n for (const nodes of mount.toReversed()) {\n for (const node of nodes || []) {\n if (removed.has(node)) continue;\n if (_.isFunction(node.type) && node.type.prototype instanceof _ParentComponent) {\n let elem: any = elements?.get(node);\n if (!elem) {\n const Component = node.type as any;\n elem = new Component();\n }\n elements.set(node, elem);\n } else if (_.isString(node.type) || node.type?.prototype instanceof NativeElementType) {\n const element = elements.get(node) ?? this._createElement(node);\n elements.set(node, element);\n try {\n this._updateElement(node, element, nativeChildren(node).toArray(), force);\n } catch (e) {\n console.error(e);\n }\n } else {\n const state: MountState[] = [];\n const prevState = mountState.get(node) ?? [];\n const curState = node.state ?? [];\n for (const i of _.range(Math.max(prevState.length, curState.length))) {\n const unmount = prevState[i]?.unmount;\n const changed = prevState[i]?.hook !== curState[i]?.hook || !equalDeps(prevState[i].deps, curState[i]?.deps);\n if (unmount && changed) {\n try {\n unmount();\n } catch (e) {\n console.error(e);\n }\n }\n state.push({\n hook: curState[i].hook,\n deps: curState[i].deps,\n unmount: options?.skipMount || !changed ? prevState[i]?.unmount : (() => {\n try {\n return curState[i].mount?.();\n } catch (e) {\n console.error(e);\n }\n })(),\n });\n }\n mountState.set(node, state);\n }\n }\n }\n\n unmount(removed);\n\n if (root) this._updateElement(\n rootNode, root,\n _.castArray(elements.get(rootNode) ?? nativeChildren(rootNode).toArray()),\n force,\n );\n\n try {\n this._afterUpdate();\n } catch (e) {\n console.error(e);\n }\n };\n\n let destroyed = false;\n let updating = false;\n const event = new UpdateManager(async (event, force) => {\n if (updating) return;\n updating = true;\n if (event.isDirty) {\n const dirty = event._dirty;\n event._dirty = [];\n await refresh(event, dirty, force);\n }\n while (event.isDirty) {\n if (destroyed) return;\n await new Promise<void>(resolve => _nextick(resolve));\n const dirty = event._dirty;\n event._dirty = [];\n await refresh(event, dirty, force);\n }\n updating = false;\n });\n\n const rootNode = new VNode(component);\n event._setDirty(rootNode);\n await event.refresh(true);\n\n return {\n get root() {\n if (root) return root;\n const elems = _.castArray(elements.get(rootNode) ?? nativeChildren(rootNode).toArray());\n const nodes = _.filter(elems, x => !_.isString(x)) as T[];\n return nodes.length === 1 ? nodes[0] : nodes;\n },\n destroy: () => {\n destroyed = true;\n if (root) this._updateElement(rootNode, root, [], true);\n unmount(elements.keys());\n },\n };\n }\n\n createRoot(root?: T) {\n let state: Awaited<ReturnType<typeof this._createRoot>> | undefined;\n return {\n get root() {\n return state?.root;\n },\n mount: async (\n component: ComponentNode,\n options?: {\n skipMount?: boolean;\n nextick?: typeof nextick;\n },\n ) => {\n state = await this._createRoot(root ?? null, component, options);\n },\n unmount: () => {\n state?.destroy();\n state = undefined;\n },\n };\n }\n}","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 { uniqueId } from '../utils';\nimport { Context, isContext } from '../hooks/context';\nimport { PropsProvider } from '../types/props';\nimport { ErrorBoundary } from '../types/error';\nimport { _Renderer } from '../renderer';\nimport { myersSync } from 'myers.js';\nimport { equalDeps, equalProps } from './utils';\nimport { PropsType } from '../types/runtime';\nimport { _ParentComponent } from '../components/pairs';\n\ntype VNodeState = {\n hook: string;\n deps: any;\n data?: any;\n mount?: () => () => void;\n};\n\nexport class UpdateManager {\n\n /** @internal */\n _dirty: Set<VNode>[] = [];\n\n /** @internal */\n private _refresh: (x: UpdateManager, force: boolean) => Promise<void>;\n\n constructor(refresh: (x: UpdateManager, force: boolean) => Promise<void>) {\n this._refresh = refresh;\n }\n\n async refresh(force: boolean = false) {\n await this._refresh(this, force);\n }\n\n _setDirty(node: VNode) {\n if (!this._dirty[node.level]) this._dirty[node.level] = new Set();\n this._dirty[node.level].add(node);\n }\n\n setDirty(node: VNode) {\n this._setDirty(node);\n this.refresh();\n }\n\n get isDirty() {\n return this._dirty.some(x => !!x.size);\n }\n}\n\nexport class VNode {\n\n #component: ComponentNode;\n \n #id = uniqueId();\n #props: PropsType = {};\n #error?: any;\n #children: (VNode | string)[] = [];\n\n #state?: VNodeState[];\n\n #context: Set<VNode> = new Set();\n #content_listeners: Set<VNode> = new Set();\n #content_value?: any;\n\n #parent?: VNode;\n #nativeParent?: VNode;\n #level = 0;\n\n /** @internal */\n constructor(component: ComponentNode) {\n this.#component = component;\n }\n\n get id() {\n return this.#id;\n }\n\n /** @internal */\n get component() {\n return this.#component;\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 /** @internal */\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 get parent() {\n return this.#parent;\n }\n\n get stack() {\n let node: VNode | undefined = this;\n return (function* () {\n while (node) {\n yield node;\n node = node.#parent;\n }\n })();\n }\n\n get level() {\n return this.#level;\n }\n\n /** @internal */\n async* _render(event: UpdateManager, renderer: _Renderer<any>) {\n\n const _resolve_props = () => {\n const self = this;\n const { type, props: _props } = this.#component;\n if (type === PropsProvider) return _props;\n let props = { ..._props };\n for (const node of this.stack.drop(1)) {\n if (node.type === PropsProvider) {\n props = node.props.callback({ type, props });\n }\n }\n return _.mapValues(props, (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\n const _resolve_children = (child: any): (VNode | string)[] => {\n if (_.isBoolean(child) || _.isNil(child)) return [];\n if (_.isString(child)) return [child];\n if (_.isNumber(child) || typeof child === 'bigint') return [`${child}`];\n if (child instanceof ComponentNode) return [new VNode(child)];\n if (_.isArrayLikeObject(child)) return _.flatMap(child, x => _resolve_children(x));\n if (typeof child[Symbol.iterator] === 'function') return _.flatMap([...child], x => _resolve_children(x));\n throw Error(`${child} are not valid as a child.`);\n };\n\n try {\n const { type } = this.#component;\n this.#props = _resolve_props();\n let children: (VNode | string)[];\n let native = this.#nativeParent;\n if (_.isString(type) || type?.prototype instanceof NativeElementType) {\n children = _resolve_children(this.#props.children);\n if (_.isString(type) || !(type?.prototype instanceof _ParentComponent)) {\n native = this;\n }\n yield { mount: this };\n } else if (isContext(type)) {\n const { value } = this.#props;\n if (!equalDeps(this.#content_value, value)) {\n for (const node of this.#content_listeners) {\n yield { dirty: node };\n }\n }\n this.#content_value = value;\n children = _resolve_children(type(this.#props as any));\n } else if (_.isFunction(type)) {\n while (true) {\n const state = new HookState(this, event, renderer);\n reconciler._currentHookState = state;\n const rendered = type(this.#props);\n for (const node of this.#context.difference(state.context)) {\n node.#content_listeners.delete(this);\n }\n for (const node of state.context.difference(this.#context)) {\n node.#content_listeners.add(this);\n }\n this.#state = state.state;\n this.#context = state.context;\n if (_.isEmpty(state.tasks)) {\n children = _resolve_children(rendered);\n break;\n }\n await Promise.all(state.tasks);\n }\n yield { mount: this };\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.equalType(rhs.#component);\n return false;\n },\n });\n this.#children = _.flatMap(diff, x => x.equivalent ?? x.insert ?? []);\n this.#error = undefined;\n for (const [lhs, rhs] of _.zip(this.#children, children)) {\n if (!(lhs instanceof VNode) || !(rhs instanceof VNode)) continue;\n if (_.isNil(lhs.#state)) {\n yield { dirty: lhs };\n } else if (!equalProps(lhs.#component.props, rhs.#component.props)) {\n yield { dirty: lhs };\n }\n lhs.#component = rhs.#component;\n lhs.#parent = this;\n lhs.#nativeParent = native;\n lhs.#level = this.#level + 1;\n }\n for (const item of _.flatMap(diff, x => x.remove ?? [])) {\n if (item instanceof VNode) yield { removed: item };\n }\n if (_.some(diff, x => !x.equivalent) && this.#nativeParent && this.#nativeParent !== this) {\n yield { mount: this.#nativeParent };\n }\n } catch (error) {\n for (const item of this.#children) {\n if (item instanceof VNode) yield { removed: item };\n }\n this.#children = [];\n this.#error = error;\n (async () => {\n try {\n const { onError, silent } = this.stack.drop(1).find(node => node.type === ErrorBoundary)?.props ?? {};\n if (!silent) console.error(error);\n if (_.isFunction(onError)) await onError(error, this.#component, this.stack.map(x => x.#component));\n } catch (e) {\n console.error(e);\n }\n })();\n yield { removed: this };\n if (this.#nativeParent && this.#nativeParent !== this) {\n yield { mount: this.#nativeParent };\n }\n } finally {\n reconciler._currentHookState = undefined;\n }\n }\n\n /** @internal */\n _release() {\n for (const context of this.#context) {\n context.#content_listeners.delete(this);\n }\n }\n}\n\nclass HookState {\n\n node: VNode;\n event: UpdateManager;\n renderer: _Renderer<any>;\n\n state: VNodeState[] = [];\n tasks: PromiseLike<void>[] = [];\n context: Set<VNode> = new Set();\n\n constructor(\n node: VNode,\n event: UpdateManager,\n renderer: _Renderer<any>,\n ) {\n this.node = node;\n this.event = event;\n this.renderer = renderer;\n }\n\n get prevState() {\n return this.node.state;\n }\n\n get stack() {\n const [, ...stack] = this.node.stack;\n return stack;\n }\n\n setDirty() {\n this.event.setDirty(this.node);\n }\n\n resolveContextNode(context: Context<any>) {\n return this.stack.find(node => node.type === context);\n }\n}\n\nexport const reconciler = new class {\n\n /** @internal */\n _registry = new WeakMap<any, string>();\n\n /** @internal */\n _currentHookState?: HookState;\n\n get currentHookState() {\n return this._currentHookState;\n }\n};\n"],"names":["_____.ElementType"],"mappings":";;;AAGO,uBAAA,SAAA;AACP;AACA;AACA;AACA,4CAAA,KAAA;AACA,4CAAA,KAAA;AACA,6CAAA,KAAA;AACA;AACA,yBAAA,GAAA;AACA;AACA;AACA;AACA,2BAAA,aAAA;AACA;AACA,6BAAA,OAAA;AACA,cAAA,OAAA;AACA;AACA;AACA;;ACJO,cAAA,KAAA;AACP;AACA;AACA,uBAAA,iBAAA,GAA2CA,YAAe;AAC1D,iBAAA,SAAA;AACA;AACA,8BAAA,KAAA;AACA;AACA,kBAAA,KAAA;AACA,iBAAA,SAAA,CAAA,KAAA;AACA;AACA;;;;"}
@@ -1,4 +1,5 @@
1
1
  import { a as ComponentNode, N as NativeElementType, _ as _ElementType, c as PropsType } from './common-DU6Re-Mj.js';
2
+ import nextick from 'nextick';
2
3
 
3
4
  declare abstract class _Renderer<T> {
4
5
  #private;
@@ -14,6 +15,7 @@ declare abstract class _Renderer<T> {
14
15
  readonly root: T | T[] | undefined;
15
16
  mount: (component: ComponentNode, options?: {
16
17
  skipMount?: boolean;
18
+ nextick?: typeof nextick;
17
19
  }) => Promise<void>;
18
20
  unmount: () => void;
19
21
  };
@@ -33,4 +35,4 @@ declare class VNode {
33
35
  }
34
36
 
35
37
  export { VNode as V, _Renderer as _ };
36
- //# sourceMappingURL=index-BXYwGmMq.d.ts.map
38
+ //# sourceMappingURL=index-OvcTjmzX.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-OvcTjmzX.d.ts","sources":["../../src/core/renderer.ts","../../src/core/reconciler/index.ts"],"sourcesContent":["//\n// renderer.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 { UpdateManager, VNode } from './reconciler';\nimport { ComponentNode, NativeElementType } from './types/component';\nimport { equalDeps } from './reconciler/utils';\nimport { _ParentComponent } from './components/pairs';\nimport nextick from 'nextick';\n\nexport abstract class _Renderer<T> {\n\n protected abstract _beforeUpdate(): void;\n\n protected abstract _afterUpdate(): void;\n\n protected abstract _createElement(node: VNode): T;\n\n protected abstract _updateElement(node: VNode, element: T, children: (T | string)[], force?: boolean): void;\n\n protected abstract _destroyElement(node: VNode, element: T): void;\n\n abstract get _server(): boolean;\n\n #renderStorage = new Map<any, any>();\n\n get renderStorage() {\n return this.#renderStorage;\n }\n\n private async _createRoot(\n root: T | null,\n component: ComponentNode,\n options?: {\n skipMount?: boolean;\n nextick?: typeof nextick;\n },\n ) {\n const _nextick = options?.nextick ?? nextick;\n\n type MountState = {\n hook: string;\n deps: any;\n unmount?: () => void;\n };\n\n const elements = new Map<VNode, T>();\n const mountState = new Map<VNode, MountState[]>();\n\n const childrenDeep = function* (node: VNode): Generator<VNode> {\n for (const child of node.children) {\n if (child instanceof VNode) {\n yield child;\n yield* childrenDeep(child);\n }\n }\n };\n\n const nativeChildren = (node: VNode) => {\n const children = function* (\n node: VNode,\n filter?: (x: string | VNode) => boolean\n ): Generator<T | string> {\n for (const child of node.children) {\n if (_.isString(child)) {\n if (filter && !filter(child)) continue;\n yield child;\n } else {\n if (child.error) continue;\n const element = elements.get(child);\n if (!filter || filter(child)) {\n if (element instanceof _ParentComponent) {\n yield* children(child, x => element.isChildNode(x));\n } else if (element) {\n yield element;\n } else {\n yield* children(child);\n }\n } else if (!element) {\n yield* children(child, filter);\n }\n }\n }\n }\n const element = elements.get(node);\n if (element instanceof _ParentComponent) {\n return children(node, x => element.isChildNode(x));\n } else {\n return children(node);\n }\n }\n\n const unmount = (nodes: Iterable<VNode>) => {\n for (const node of nodes) {\n unmount(_.filter(node.children, x => x instanceof VNode));\n node._release();\n const element = elements.get(node);\n const state = mountState.get(node);\n if (element) {\n try {\n this._destroyElement(node, element);\n } catch (e) {\n console.error(e);\n }\n elements.delete(node);\n } else if (state) {\n for (const { unmount } of state) {\n if (unmount) {\n try {\n unmount();\n } catch (e) {\n console.error(e);\n }\n }\n }\n }\n elements.delete(node);\n mountState.delete(node);\n }\n };\n\n const refresh = async (event: UpdateManager, dirty: Set<VNode>[], force: boolean) => {\n\n try {\n this._beforeUpdate();\n } catch (e) {\n console.error(e);\n }\n\n const mount: Set<VNode>[] = [];\n const removed = new Set<VNode>();\n\n for (const _nodes of dirty) {\n const nodes = [..._nodes || []];\n let node;\n while (node = nodes.shift()) {\n for await (const {\n dirty,\n mount: _mount,\n removed: _removed,\n } of await node._render(event, this)) {\n if (dirty) nodes.push(dirty);\n else if (_mount) {\n if (!mount[_mount.level]) mount[_mount.level] = new Set();\n mount[_mount.level].add(_mount);\n } else if (_removed) removed.add(_removed);\n }\n }\n }\n\n for (const nodes of mount.toReversed()) {\n for (const node of nodes || []) {\n if (removed.has(node)) continue;\n if (_.isFunction(node.type) && node.type.prototype instanceof _ParentComponent) {\n let elem: any = elements?.get(node);\n if (!elem) {\n const Component = node.type as any;\n elem = new Component();\n }\n elements.set(node, elem);\n } else if (_.isString(node.type) || node.type?.prototype instanceof NativeElementType) {\n const element = elements.get(node) ?? this._createElement(node);\n elements.set(node, element);\n try {\n this._updateElement(node, element, nativeChildren(node).toArray(), force);\n } catch (e) {\n console.error(e);\n }\n } else {\n const state: MountState[] = [];\n const prevState = mountState.get(node) ?? [];\n const curState = node.state ?? [];\n for (const i of _.range(Math.max(prevState.length, curState.length))) {\n const unmount = prevState[i]?.unmount;\n const changed = prevState[i]?.hook !== curState[i]?.hook || !equalDeps(prevState[i].deps, curState[i]?.deps);\n if (unmount && changed) {\n try {\n unmount();\n } catch (e) {\n console.error(e);\n }\n }\n state.push({\n hook: curState[i].hook,\n deps: curState[i].deps,\n unmount: options?.skipMount || !changed ? prevState[i]?.unmount : (() => {\n try {\n return curState[i].mount?.();\n } catch (e) {\n console.error(e);\n }\n })(),\n });\n }\n mountState.set(node, state);\n }\n }\n }\n\n unmount(removed);\n\n if (root) this._updateElement(\n rootNode, root,\n _.castArray(elements.get(rootNode) ?? nativeChildren(rootNode).toArray()),\n force,\n );\n\n try {\n this._afterUpdate();\n } catch (e) {\n console.error(e);\n }\n };\n\n let destroyed = false;\n let updating = false;\n const event = new UpdateManager(async (event, force) => {\n if (updating) return;\n updating = true;\n if (event.isDirty) {\n const dirty = event._dirty;\n event._dirty = [];\n await refresh(event, dirty, force);\n }\n while (event.isDirty) {\n if (destroyed) return;\n await new Promise<void>(resolve => _nextick(resolve));\n const dirty = event._dirty;\n event._dirty = [];\n await refresh(event, dirty, force);\n }\n updating = false;\n });\n\n const rootNode = new VNode(component);\n event._setDirty(rootNode);\n await event.refresh(true);\n\n return {\n get root() {\n if (root) return root;\n const elems = _.castArray(elements.get(rootNode) ?? nativeChildren(rootNode).toArray());\n const nodes = _.filter(elems, x => !_.isString(x)) as T[];\n return nodes.length === 1 ? nodes[0] : nodes;\n },\n destroy: () => {\n destroyed = true;\n if (root) this._updateElement(rootNode, root, [], true);\n unmount(elements.keys());\n },\n };\n }\n\n createRoot(root?: T) {\n let state: Awaited<ReturnType<typeof this._createRoot>> | undefined;\n return {\n get root() {\n return state?.root;\n },\n mount: async (\n component: ComponentNode,\n options?: {\n skipMount?: boolean;\n nextick?: typeof nextick;\n },\n ) => {\n state = await this._createRoot(root ?? null, component, options);\n },\n unmount: () => {\n state?.destroy();\n state = undefined;\n },\n };\n }\n}","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 { uniqueId } from '../utils';\nimport { Context, isContext } from '../hooks/context';\nimport { PropsProvider } from '../types/props';\nimport { ErrorBoundary } from '../types/error';\nimport { _Renderer } from '../renderer';\nimport { myersSync } from 'myers.js';\nimport { equalDeps, equalProps } from './utils';\nimport { PropsType } from '../types/runtime';\nimport { _ParentComponent } from '../components/pairs';\n\ntype VNodeState = {\n hook: string;\n deps: any;\n data?: any;\n mount?: () => () => void;\n};\n\nexport class UpdateManager {\n\n /** @internal */\n _dirty: Set<VNode>[] = [];\n\n /** @internal */\n private _refresh: (x: UpdateManager, force: boolean) => Promise<void>;\n\n constructor(refresh: (x: UpdateManager, force: boolean) => Promise<void>) {\n this._refresh = refresh;\n }\n\n async refresh(force: boolean = false) {\n await this._refresh(this, force);\n }\n\n _setDirty(node: VNode) {\n if (!this._dirty[node.level]) this._dirty[node.level] = new Set();\n this._dirty[node.level].add(node);\n }\n\n setDirty(node: VNode) {\n this._setDirty(node);\n this.refresh();\n }\n\n get isDirty() {\n return this._dirty.some(x => !!x.size);\n }\n}\n\nexport class VNode {\n\n #component: ComponentNode;\n \n #id = uniqueId();\n #props: PropsType = {};\n #error?: any;\n #children: (VNode | string)[] = [];\n\n #state?: VNodeState[];\n\n #context: Set<VNode> = new Set();\n #content_listeners: Set<VNode> = new Set();\n #content_value?: any;\n\n #parent?: VNode;\n #nativeParent?: VNode;\n #level = 0;\n\n /** @internal */\n constructor(component: ComponentNode) {\n this.#component = component;\n }\n\n get id() {\n return this.#id;\n }\n\n /** @internal */\n get component() {\n return this.#component;\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 /** @internal */\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 get parent() {\n return this.#parent;\n }\n\n get stack() {\n let node: VNode | undefined = this;\n return (function* () {\n while (node) {\n yield node;\n node = node.#parent;\n }\n })();\n }\n\n get level() {\n return this.#level;\n }\n\n /** @internal */\n async* _render(event: UpdateManager, renderer: _Renderer<any>) {\n\n const _resolve_props = () => {\n const self = this;\n const { type, props: _props } = this.#component;\n if (type === PropsProvider) return _props;\n let props = { ..._props };\n for (const node of this.stack.drop(1)) {\n if (node.type === PropsProvider) {\n props = node.props.callback({ type, props });\n }\n }\n return _.mapValues(props, (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\n const _resolve_children = (child: any): (VNode | string)[] => {\n if (_.isBoolean(child) || _.isNil(child)) return [];\n if (_.isString(child)) return [child];\n if (_.isNumber(child) || typeof child === 'bigint') return [`${child}`];\n if (child instanceof ComponentNode) return [new VNode(child)];\n if (_.isArrayLikeObject(child)) return _.flatMap(child, x => _resolve_children(x));\n if (typeof child[Symbol.iterator] === 'function') return _.flatMap([...child], x => _resolve_children(x));\n throw Error(`${child} are not valid as a child.`);\n };\n\n try {\n const { type } = this.#component;\n this.#props = _resolve_props();\n let children: (VNode | string)[];\n let native = this.#nativeParent;\n if (_.isString(type) || type?.prototype instanceof NativeElementType) {\n children = _resolve_children(this.#props.children);\n if (_.isString(type) || !(type?.prototype instanceof _ParentComponent)) {\n native = this;\n }\n yield { mount: this };\n } else if (isContext(type)) {\n const { value } = this.#props;\n if (!equalDeps(this.#content_value, value)) {\n for (const node of this.#content_listeners) {\n yield { dirty: node };\n }\n }\n this.#content_value = value;\n children = _resolve_children(type(this.#props as any));\n } else if (_.isFunction(type)) {\n while (true) {\n const state = new HookState(this, event, renderer);\n reconciler._currentHookState = state;\n const rendered = type(this.#props);\n for (const node of this.#context.difference(state.context)) {\n node.#content_listeners.delete(this);\n }\n for (const node of state.context.difference(this.#context)) {\n node.#content_listeners.add(this);\n }\n this.#state = state.state;\n this.#context = state.context;\n if (_.isEmpty(state.tasks)) {\n children = _resolve_children(rendered);\n break;\n }\n await Promise.all(state.tasks);\n }\n yield { mount: this };\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.equalType(rhs.#component);\n return false;\n },\n });\n this.#children = _.flatMap(diff, x => x.equivalent ?? x.insert ?? []);\n this.#error = undefined;\n for (const [lhs, rhs] of _.zip(this.#children, children)) {\n if (!(lhs instanceof VNode) || !(rhs instanceof VNode)) continue;\n if (_.isNil(lhs.#state)) {\n yield { dirty: lhs };\n } else if (!equalProps(lhs.#component.props, rhs.#component.props)) {\n yield { dirty: lhs };\n }\n lhs.#component = rhs.#component;\n lhs.#parent = this;\n lhs.#nativeParent = native;\n lhs.#level = this.#level + 1;\n }\n for (const item of _.flatMap(diff, x => x.remove ?? [])) {\n if (item instanceof VNode) yield { removed: item };\n }\n if (_.some(diff, x => !x.equivalent) && this.#nativeParent && this.#nativeParent !== this) {\n yield { mount: this.#nativeParent };\n }\n } catch (error) {\n for (const item of this.#children) {\n if (item instanceof VNode) yield { removed: item };\n }\n this.#children = [];\n this.#error = error;\n (async () => {\n try {\n const { onError, silent } = this.stack.drop(1).find(node => node.type === ErrorBoundary)?.props ?? {};\n if (!silent) console.error(error);\n if (_.isFunction(onError)) await onError(error, this.#component, this.stack.map(x => x.#component));\n } catch (e) {\n console.error(e);\n }\n })();\n yield { removed: this };\n if (this.#nativeParent && this.#nativeParent !== this) {\n yield { mount: this.#nativeParent };\n }\n } finally {\n reconciler._currentHookState = undefined;\n }\n }\n\n /** @internal */\n _release() {\n for (const context of this.#context) {\n context.#content_listeners.delete(this);\n }\n }\n}\n\nclass HookState {\n\n node: VNode;\n event: UpdateManager;\n renderer: _Renderer<any>;\n\n state: VNodeState[] = [];\n tasks: PromiseLike<void>[] = [];\n context: Set<VNode> = new Set();\n\n constructor(\n node: VNode,\n event: UpdateManager,\n renderer: _Renderer<any>,\n ) {\n this.node = node;\n this.event = event;\n this.renderer = renderer;\n }\n\n get prevState() {\n return this.node.state;\n }\n\n get stack() {\n const [, ...stack] = this.node.stack;\n return stack;\n }\n\n setDirty() {\n this.event.setDirty(this.node);\n }\n\n resolveContextNode(context: Context<any>) {\n return this.stack.find(node => node.type === context);\n }\n}\n\nexport const reconciler = new class {\n\n /** @internal */\n _registry = new WeakMap<any, string>();\n\n /** @internal */\n _currentHookState?: HookState;\n\n get currentHookState() {\n return this._currentHookState;\n }\n};\n"],"names":["_____.ElementType"],"mappings":";;;AAGO,uBAAA,SAAA;AACP;AACA;AACA;AACA,4CAAA,KAAA;AACA,4CAAA,KAAA;AACA,6CAAA,KAAA;AACA;AACA,yBAAA,GAAA;AACA;AACA;AACA;AACA,2BAAA,aAAA;AACA;AACA,6BAAA,OAAA;AACA,cAAA,OAAA;AACA;AACA;AACA;;ACJO,cAAA,KAAA;AACP;AACA;AACA,uBAAA,iBAAA,GAA2CA,YAAe;AAC1D,iBAAA,SAAA;AACA;AACA,8BAAA,KAAA;AACA;AACA,kBAAA,KAAA;AACA,iBAAA,SAAA,CAAA,KAAA;AACA;AACA;;;;"}
@@ -1,4 +1,4 @@
1
- import { _ as _Renderer, V as VNode } from './index-DCYqTHyF.mjs';
1
+ import { _ as _Renderer, V as VNode } from './index-BzVLlTCa.mjs';
2
2
  import { N as NativeElementType, a as ComponentNode } from './common-DU6Re-Mj.mjs';
3
3
  import { DOMWindow } from 'jsdom';
4
4
 
@@ -34,4 +34,4 @@ declare abstract class _DOMRenderer extends _Renderer<Element | DOMNativeNode> {
34
34
  }
35
35
 
36
36
  export { DOMNativeNode as D, _DOMRenderer as _ };
37
- //# sourceMappingURL=renderer-BtM_6vlI.d.mts.map
37
+ //# sourceMappingURL=renderer-BluiQ1F-.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderer-BtM_6vlI.d.mts","sources":["../../src/renderer/common/node.ts","../../src/renderer/common/renderer.ts"],"sourcesContent":["//\n// common.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 type { _DOMRenderer } from './renderer';\nimport { myersSync } from 'myers.js';\nimport { globalEventKeys, globalEvents } from '../../core/web/event';\nimport { NativeElementType } from '../../core/types/component';\nimport {\n HTMLElementAttributeMaps as htmlProps,\n SVGElementAttributeMaps as svgProps,\n} from '../../../generated/elements';\nimport { _Renderer } from '../../core/renderer';\n\nconst findPrototypeProperty = (object: any, propertyName: string) => {\n while (object && object.constructor && object.constructor.name !== 'Object') {\n let desc = Object.getOwnPropertyDescriptor(object, propertyName);\n if (desc) return desc;\n object = Object.getPrototypeOf(object);\n }\n return null;\n};\n\nconst isWriteable = (object: any, propertyName: string) => {\n let desc = findPrototypeProperty(object, propertyName);\n if (!desc) {\n return false;\n }\n if (desc.writable && typeof desc.value !== 'function') {\n return true;\n }\n return !!desc.set;\n};\n\nconst tracked_props = new WeakMap<Element, string[]>();\nconst tracked_listeners = new WeakMap<Element, Record<string, EventListener | undefined>>();\nconst _updateEventListener = (\n element: Element,\n key: string,\n listener: EventListener | undefined,\n) => {\n const ev = key.endsWith('Capture') ? key.slice(0, -7) : key;\n const event = globalEvents[ev as keyof typeof globalEvents];\n const listeners = tracked_listeners.get(element) ?? {};\n if (!tracked_listeners.has(element)) tracked_listeners.set(element, listeners);\n if (listeners[key] !== listener) {\n const options = { capture: key.endsWith('Capture') };\n if (_.isFunction(listeners[key])) element.removeEventListener(event, listeners[key], options);\n if (_.isFunction(listener)) element.addEventListener(event, listener, options);\n }\n listeners[key] = listener;\n}\n\nconst DOMUtils = new class {\n\n update(\n element: Element,\n { className, style, ...props }: Record<string, any> & {\n className?: string;\n style?: string;\n },\n ) {\n if (className) {\n const oldValue = element.getAttribute('class');\n if (oldValue !== className)\n element.setAttribute('class', className);\n } else if (!_.isNil(element.getAttribute('class'))) {\n element.removeAttribute('class');\n }\n if (style) {\n const oldValue = element.getAttribute('style');\n if (oldValue !== style)\n element.setAttribute('style', style);\n } else if (!_.isNil(element.getAttribute('style'))) {\n element.removeAttribute('style');\n }\n for (const [key, value] of _.entries(props)) {\n if (_.includes(globalEventKeys, key)) {\n _updateEventListener(element, key, value);\n } else if (key.endsWith('Capture') && _.includes(globalEventKeys, key.slice(0, -7))) {\n _updateEventListener(element, key, value);\n } else if (key.startsWith('data-')) {\n const oldValue = element.getAttribute(key);\n if (value === false || _.isNil(value)) {\n if (!_.isNil(oldValue))\n element.removeAttribute(key);\n } else {\n const newValue = value === true ? '' : `${value}`;\n if (oldValue !== newValue)\n element.setAttribute(key, newValue);\n }\n } else {\n const tagName = _.toLower(element.tagName);\n const attr = _.find(htmlProps['*'], a => _.camelCase(a).toLowerCase() === _.camelCase(key).toLowerCase())\n ?? _.find((htmlProps as any)[tagName] as string[], a => _.camelCase(a).toLowerCase() === _.camelCase(key).toLowerCase())\n ?? _.find(svgProps['*'], a => _.camelCase(a).toLowerCase() === _.camelCase(key).toLowerCase())\n ?? _.find((svgProps as any)[tagName] as string[], a => _.camelCase(a).toLowerCase() === _.camelCase(key).toLowerCase());\n const tracked = tracked_props.get(element) ?? [];\n const writeable = isWriteable(element, key);\n if (!tracked_props.has(element)) tracked_props.set(element, tracked);\n const assigned = _.includes(tracked, key);\n if (writeable && !_.isNil(value)) {\n if (!assigned || (element as any)[key] !== value) (element as any)[key] = value;\n if (!assigned) tracked.push(key);\n } else if (attr) {\n const oldValue = element.getAttribute(attr);\n if (value === false || _.isNil(value)) {\n if (!_.isNil(oldValue))\n element.removeAttribute(attr);\n } else {\n const newValue = value === true ? '' : `${value}`;\n if (oldValue !== newValue)\n element.setAttribute(attr, newValue);\n }\n } else if (writeable) {\n if (!assigned || (element as any)[key] !== value) (element as any)[key] = value;\n if (!assigned) tracked.push(key);\n }\n }\n }\n }\n\n replaceChildren(\n element: Element,\n children: (string | ChildNode | DOMNativeNode)[],\n shouldRemove: (child: ChildNode) => boolean = () => true,\n ) {\n const document = element.ownerDocument;\n const diff = myersSync(\n _.map(element.childNodes, x => x.nodeType === document.TEXT_NODE ? x.textContent ?? '' : x),\n _.flatMap(children, x => x instanceof DOMNativeNode ? x.target : x),\n { compare: (a, b) => a === b },\n );\n let i = 0;\n for (const { remove, insert, equivalent } of diff) {\n if (equivalent) {\n i += equivalent.length;\n } else if (remove) {\n for (const child of remove) {\n if (_.isString(child) || shouldRemove(child)) {\n element.removeChild(element.childNodes[i]);\n } else {\n i++;\n }\n }\n }\n if (insert) {\n for (const child of insert) {\n const node = _.isString(child) ? document.createTextNode(child) : child;\n element.insertBefore(node, element.childNodes[i++]);\n }\n }\n }\n }\n\n destroy(element: Element) {\n const listeners = tracked_listeners.get(element);\n for (const [key, listener] of _.entries(listeners)) {\n const event = key.endsWith('Capture') ? key.slice(2, -7).toLowerCase() : key.slice(2).toLowerCase();\n if (_.isFunction(listener)) {\n element.removeEventListener(event, listener, { capture: key.endsWith('Capture') });\n }\n }\n tracked_listeners.delete(element);\n }\n}\n\nexport abstract class DOMNativeNode extends NativeElementType {\n\n static get Utils() { return DOMUtils; }\n\n static createElement: (doc: Document, renderer: _DOMRenderer) => DOMNativeNode;\n\n abstract get target(): Element | Element[];\n\n abstract update(\n props: Record<string, any> & {\n className?: string;\n style?: string;\n },\n children: (string | Element | DOMNativeNode)[]\n ): void;\n\n abstract destroy(): void;\n}\n","//\n// renderer.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 { VNode } from '../../core/reconciler';\nimport { ComponentNode } from '../../core/types/component';\nimport { tags } from '../../../generated/elements';\nimport { ClassName, StyleProp } from '../../core/types/style';\nimport { ExtendedCSSProperties } from '../../core/web/styles/css';\nimport { _Renderer } from '../../core/renderer';\nimport { processCss } from '../../core/web/styles/process';\nimport { StyleBuilder } from '../style';\nimport { mergeRefs } from '../../core/utils';\nimport type { DOMWindow } from 'jsdom';\nimport { compress } from '../minify/compress';\nimport { DOMNativeNode } from './node';\n\nconst SVG_NS = 'http://www.w3.org/2000/svg';\nconst HTML_NS = 'http://www.w3.org/1999/xhtml';\nconst MATHML_NS = 'http://www.w3.org/1998/Math/MathML';\n\nexport abstract class _DOMRenderer extends _Renderer<Element | DOMNativeNode> {\n\n #window: Window | DOMWindow;\n #namespace_map = new WeakMap<VNode, string | undefined>();\n\n #tracked_head_children = new Map<VNode, (string | Element | DOMNativeNode)[]>();\n #tracked_body_head_children = new Map<VNode, (string | Element | DOMNativeNode)[]>();\n #tracked_style = new StyleBuilder();\n /** @internal */\n _tracked_server_resource = new Map<string, string>();\n #tracked_elements = new Map<Element | DOMNativeNode, { props: string[]; className: string[]; }>();\n\n #server_head_elements?: ChildNode[];\n\n constructor(window: Window | DOMWindow) {\n super();\n this.#window = window;\n }\n\n get document() {\n return this.window.document;\n }\n\n get window() {\n return this.#window;\n }\n\n _beforeUpdate() {\n const head = this.document.head\n if (this._server) {\n this._tracked_server_resource = new Map();\n } else if (head) {\n if (!this.#server_head_elements) {\n const found_marker = _.findIndex(head.childNodes, x => x.nodeType === head.COMMENT_NODE && x.textContent === 'frosty-server-head-marker');\n if (found_marker > -1) {\n this.#server_head_elements = _.slice(head.childNodes, 0, found_marker);\n } else {\n const styleElem = this.document.querySelector('style[data-frosty-style]');\n const ssrDataElem = this.document.querySelector('script[data-frosty-ssr-data]');\n this.#server_head_elements = _.filter([...head.childNodes], x => !_.includes([styleElem, ssrDataElem], x));\n }\n DOMNativeNode.Utils.replaceChildren(head, this.#server_head_elements);\n }\n }\n }\n\n _afterUpdate() {\n this.#tracked_style.select([...this.#tracked_elements.values().flatMap(({ className }) => className)]);\n const head = this.document.head ?? this.document.createElementNS(HTML_NS, 'head');\n const styleElem = this.document.querySelector('style[data-frosty-style]') ?? this.document.createElementNS(HTML_NS, 'style');\n styleElem.setAttribute('data-frosty-style', '');\n if (styleElem.textContent !== this.#tracked_style.css)\n styleElem.textContent = this.#tracked_style.css;\n if (this._server) {\n const ssrData = this._tracked_server_resource.size ? this.document.createElementNS(HTML_NS, 'script') : undefined;\n if (ssrData) {\n ssrData.setAttribute('data-frosty-ssr-data', '');\n ssrData.setAttribute('type', 'text/plain');\n ssrData.innerHTML = compress(JSON.stringify(Object.fromEntries(this._tracked_server_resource)));\n }\n const tracked_head_children = _.flattenDeep([...this.#tracked_body_head_children.values()]);\n const maker = this.document.createComment('frosty-server-head-marker');\n DOMNativeNode.Utils.replaceChildren(head, _.compact([\n ..._.flattenDeep([...this.#tracked_head_children.values()]),\n !_.isEmpty(tracked_head_children) && maker,\n ...tracked_head_children,\n styleElem.textContent && styleElem,\n ssrData,\n ]), (x) => this.#tracked_elements.has(x as any));\n } else {\n DOMNativeNode.Utils.replaceChildren(head, _.compact([\n ...this.#server_head_elements ?? [],\n ..._.flattenDeep([...this.#tracked_body_head_children.values()]),\n styleElem.textContent && styleElem,\n ]), (x) => this.#tracked_elements.has(x as any));\n }\n if (!this.document.head) {\n this.document.documentElement.insertBefore(head, this.document.body);\n }\n }\n\n _createElement(node: VNode) {\n const { type, props: { ref } } = node;\n if (!_.isString(type) && type.prototype instanceof DOMNativeNode) {\n const ElementType = type as typeof DOMNativeNode;\n const elem = ElementType.createElement(this.document, this);\n this.#tracked_elements.set(elem, {\n props: [],\n className: [],\n });\n if (ref) mergeRefs(ref)(elem);\n return elem;\n }\n if (!_.isString(type)) throw Error(`Invalid type ${type}`);\n switch (type) {\n case 'html': return this.document.documentElement;\n case 'head': return this.document.head ?? this.document.createElementNS(HTML_NS, 'head');\n case 'body': return this.document.body ?? this.document.createElementNS(HTML_NS, 'body');\n default: break;\n }\n const _ns_list = _.compact([\n _.includes(tags.svg, type) && SVG_NS,\n _.includes(tags.html, type) && HTML_NS,\n _.includes(tags.mathml, type) && MATHML_NS,\n ]);\n const parent = _.last(node.stack.toArray());\n const ns = _ns_list.length > 1 ? parent && _.first(_.intersection([this.#namespace_map.get(parent)], _ns_list)) : _.first(_ns_list);\n const elem = ns ? this.document.createElementNS(ns, type) : this.document.createElement(type);\n this.#namespace_map.set(node, ns);\n this.#tracked_elements.set(elem, {\n props: [],\n className: [],\n });\n if (ref) mergeRefs(ref)(elem);\n return elem;\n }\n\n #createBuiltClassName(\n element: Element | DOMNativeNode,\n className: ClassName,\n style: StyleProp<ExtendedCSSProperties>,\n ) {\n const _className = _.compact(_.flattenDeep([className]));\n const built = this.#tracked_style.buildStyle(_.compact(_.flattenDeep([style])));\n const tracked = this.#tracked_elements.get(element);\n if (tracked) tracked.className = built;\n return [..._className, ...built].join(' ');\n }\n\n _updateElement(\n node: VNode,\n element: Element | DOMNativeNode,\n children: (string | Element | DOMNativeNode)[],\n force?: boolean\n ) {\n\n if (node.type !== 'html') {\n children = _.filter(children, x => x !== this.document.head && x !== this.document.body);\n }\n\n if (element instanceof DOMNativeNode) {\n const {\n props: { ref, className, style, inlineStyle, ..._props }\n } = node;\n if (ref) mergeRefs(ref)(element);\n const builtClassName = this.#createBuiltClassName(element, className, style);\n const { css } = processCss(inlineStyle);\n element.update({\n className: builtClassName ? builtClassName : undefined,\n style: css ? css : undefined,\n ..._props\n }, children);\n return;\n }\n\n const {\n type,\n props: { ref, className, style, inlineStyle, innerHTML, ..._props }\n } = node;\n\n if (!_.isString(type)) {\n DOMNativeNode.Utils.replaceChildren(element, children, (x) => !!force || this.#tracked_elements.has(x as any));\n return;\n }\n switch (type) {\n case 'head': {\n const tracked = node.parent?.type === 'html'\n ? this.#tracked_head_children\n : this.#tracked_body_head_children;\n tracked.set(node, children);\n return;\n }\n default: break;\n }\n\n if (ref) mergeRefs(ref)(element);\n\n const tracked = this.#tracked_elements.get(element);\n const removed = tracked ? _.difference(tracked.props, _.keys(_props)) : [];\n if (tracked) tracked.props = _.keys(_props);\n\n const builtClassName = this.#createBuiltClassName(element, className, style);\n if (_.isNil(innerHTML)) {\n DOMNativeNode.Utils.replaceChildren(element, children, (x) => !!force || this.#tracked_elements.has(x as any));\n } else if (element.innerHTML !== innerHTML) {\n element.innerHTML = innerHTML;\n }\n\n DOMNativeNode.Utils.update(element, {\n className: builtClassName,\n style: inlineStyle ? processCss(inlineStyle).css : undefined,\n ..._props,\n ..._.fromPairs(_.map(removed, x => [x, undefined])),\n });\n }\n\n _destroyElement(node: VNode, element: Element | DOMNativeNode) {\n this.#tracked_head_children.delete(node);\n this.#tracked_body_head_children.delete(node);\n if (element instanceof DOMNativeNode) {\n element.destroy();\n } else {\n DOMNativeNode.Utils.destroy(element);\n }\n }\n\n async renderToString(component: ComponentNode) {\n const root = this.createRoot();\n try {\n await root.mount(component, { skipMount: true });\n const elements = _.flatMap(_.castArray(root.root ?? []), x => x instanceof DOMNativeNode ? x.target : x);\n const str = _.map(elements, x => x.outerHTML).join('');\n if (elements.length !== 1) return str;\n return elements[0].tagName.toLowerCase() === 'html' ? `<!DOCTYPE html>${str}` : str;\n } finally {\n root.unmount();\n }\n }\n}\n"],"names":[],"mappings":";;;;AAEO,uBAAA,aAAA,SAAA,iBAAA;AACP;AACA,wBAAA,OAAA,kCAAA,MAAA;AACA;AACA;AACA;AACA,iCAAA,OAAA,sBAAA,SAAA,GAAA,aAAA,4BAAA,SAAA;AACA,yBAAA,OAAA;AACA;AACA,gCAAA,QAAA,YAAA,YAAA,KAAA,aAAA;AACA,2BAAA,OAAA,GAAA,OAAA;AACA,2BAAA,MAAA;AACA;AACA;AACA,2BAAA,OAAA,GAAA,aAAA;AACA;AACA;;ACbO,uBAAA,YAAA,SAAA,SAAA,CAAA,OAAA,GAAA,aAAA;AACP;AACA,wBAAA,MAAA,GAAA,SAAA;AACA,oBAAA,QAAA;AACA,kBAAA,MAAA,GAAA,SAAA;AACA;AACA;AACA,yBAAA,KAAA,GAAA,OAAA,GAAA,aAAA;AACA,yBAAA,KAAA,WAAA,OAAA,GAAA,aAAA,sBAAA,OAAA,GAAA,aAAA;AACA,0BAAA,KAAA,WAAA,OAAA,GAAA,aAAA;AACA,8BAAA,aAAA,GAAA,OAAA;AACA;;;;"}
1
+ {"version":3,"file":"renderer-BluiQ1F-.d.mts","sources":["../../src/renderer/common/node.ts","../../src/renderer/common/renderer.ts"],"sourcesContent":["//\n// common.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 type { _DOMRenderer } from './renderer';\nimport { myersSync } from 'myers.js';\nimport { globalEventKeys, globalEvents } from '../../core/web/event';\nimport { NativeElementType } from '../../core/types/component';\nimport {\n HTMLElementAttributeMaps as htmlProps,\n SVGElementAttributeMaps as svgProps,\n} from '../../../generated/elements';\nimport { _Renderer } from '../../core/renderer';\n\nconst findPrototypeProperty = (object: any, propertyName: string) => {\n while (object && object.constructor && object.constructor.name !== 'Object') {\n let desc = Object.getOwnPropertyDescriptor(object, propertyName);\n if (desc) return desc;\n object = Object.getPrototypeOf(object);\n }\n return null;\n};\n\nconst isWriteable = (object: any, propertyName: string) => {\n let desc = findPrototypeProperty(object, propertyName);\n if (!desc) {\n return false;\n }\n if (desc.writable && typeof desc.value !== 'function') {\n return true;\n }\n return !!desc.set;\n};\n\nconst tracked_props = new WeakMap<Element, string[]>();\nconst tracked_listeners = new WeakMap<Element, Record<string, EventListener | undefined>>();\nconst _updateEventListener = (\n element: Element,\n key: string,\n listener: EventListener | undefined,\n) => {\n const ev = key.endsWith('Capture') ? key.slice(0, -7) : key;\n const event = globalEvents[ev as keyof typeof globalEvents];\n const listeners = tracked_listeners.get(element) ?? {};\n if (!tracked_listeners.has(element)) tracked_listeners.set(element, listeners);\n if (listeners[key] !== listener) {\n const options = { capture: key.endsWith('Capture') };\n if (_.isFunction(listeners[key])) element.removeEventListener(event, listeners[key], options);\n if (_.isFunction(listener)) element.addEventListener(event, listener, options);\n }\n listeners[key] = listener;\n}\n\nconst DOMUtils = new class {\n\n update(\n element: Element,\n { className, style, ...props }: Record<string, any> & {\n className?: string;\n style?: string;\n },\n ) {\n if (className) {\n const oldValue = element.getAttribute('class');\n if (oldValue !== className)\n element.setAttribute('class', className);\n } else if (!_.isNil(element.getAttribute('class'))) {\n element.removeAttribute('class');\n }\n if (style) {\n const oldValue = element.getAttribute('style');\n if (oldValue !== style)\n element.setAttribute('style', style);\n } else if (!_.isNil(element.getAttribute('style'))) {\n element.removeAttribute('style');\n }\n for (const [key, value] of _.entries(props)) {\n if (_.includes(globalEventKeys, key)) {\n _updateEventListener(element, key, value);\n } else if (key.endsWith('Capture') && _.includes(globalEventKeys, key.slice(0, -7))) {\n _updateEventListener(element, key, value);\n } else if (key.startsWith('data-')) {\n const oldValue = element.getAttribute(key);\n if (value === false || _.isNil(value)) {\n if (!_.isNil(oldValue))\n element.removeAttribute(key);\n } else {\n const newValue = value === true ? '' : `${value}`;\n if (oldValue !== newValue)\n element.setAttribute(key, newValue);\n }\n } else {\n const tagName = _.toLower(element.tagName);\n const attr = _.find(htmlProps['*'], a => _.camelCase(a).toLowerCase() === _.camelCase(key).toLowerCase())\n ?? _.find((htmlProps as any)[tagName] as string[], a => _.camelCase(a).toLowerCase() === _.camelCase(key).toLowerCase())\n ?? _.find(svgProps['*'], a => _.camelCase(a).toLowerCase() === _.camelCase(key).toLowerCase())\n ?? _.find((svgProps as any)[tagName] as string[], a => _.camelCase(a).toLowerCase() === _.camelCase(key).toLowerCase());\n const tracked = tracked_props.get(element) ?? [];\n const writeable = isWriteable(element, key);\n if (!tracked_props.has(element)) tracked_props.set(element, tracked);\n const assigned = _.includes(tracked, key);\n if (writeable && !_.isNil(value)) {\n if (!assigned || (element as any)[key] !== value) (element as any)[key] = value;\n if (!assigned) tracked.push(key);\n } else if (attr) {\n const oldValue = element.getAttribute(attr);\n if (value === false || _.isNil(value)) {\n if (!_.isNil(oldValue))\n element.removeAttribute(attr);\n } else {\n const newValue = value === true ? '' : `${value}`;\n if (oldValue !== newValue)\n element.setAttribute(attr, newValue);\n }\n } else if (writeable) {\n if (!assigned || (element as any)[key] !== value) (element as any)[key] = value;\n if (!assigned) tracked.push(key);\n }\n }\n }\n }\n\n replaceChildren(\n element: Element,\n children: (string | ChildNode | DOMNativeNode)[],\n shouldRemove: (child: ChildNode) => boolean = () => true,\n ) {\n const document = element.ownerDocument;\n const diff = myersSync(\n _.map(element.childNodes, x => x.nodeType === document.TEXT_NODE ? x.textContent ?? '' : x),\n _.flatMap(children, x => x instanceof DOMNativeNode ? x.target : x),\n { compare: (a, b) => a === b },\n );\n let i = 0;\n for (const { remove, insert, equivalent } of diff) {\n if (equivalent) {\n i += equivalent.length;\n } else if (remove) {\n for (const child of remove) {\n if (_.isString(child) || shouldRemove(child)) {\n element.removeChild(element.childNodes[i]);\n } else {\n i++;\n }\n }\n }\n if (insert) {\n for (const child of insert) {\n const node = _.isString(child) ? document.createTextNode(child) : child;\n element.insertBefore(node, element.childNodes[i++]);\n }\n }\n }\n }\n\n destroy(element: Element) {\n const listeners = tracked_listeners.get(element);\n for (const [key, listener] of _.entries(listeners)) {\n const event = key.endsWith('Capture') ? key.slice(2, -7).toLowerCase() : key.slice(2).toLowerCase();\n if (_.isFunction(listener)) {\n element.removeEventListener(event, listener, { capture: key.endsWith('Capture') });\n }\n }\n tracked_listeners.delete(element);\n }\n}\n\nexport abstract class DOMNativeNode extends NativeElementType {\n\n static get Utils() { return DOMUtils; }\n\n static createElement: (doc: Document, renderer: _DOMRenderer) => DOMNativeNode;\n\n abstract get target(): Element | Element[];\n\n abstract update(\n props: Record<string, any> & {\n className?: string;\n style?: string;\n },\n children: (string | Element | DOMNativeNode)[]\n ): void;\n\n abstract destroy(): void;\n}\n","//\n// renderer.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 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 { VNode } from '../../core/reconciler';\nimport { ComponentNode } from '../../core/types/component';\nimport { tags } from '../../../generated/elements';\nimport { ClassName, StyleProp } from '../../core/types/style';\nimport { ExtendedCSSProperties } from '../../core/web/styles/css';\nimport { _Renderer } from '../../core/renderer';\nimport { processCss } from '../../core/web/styles/process';\nimport { StyleBuilder } from '../style';\nimport { mergeRefs } from '../../core/utils';\nimport type { DOMWindow } from 'jsdom';\nimport { compress } from '../minify/compress';\nimport { DOMNativeNode } from './node';\n\nconst SVG_NS = 'http://www.w3.org/2000/svg';\nconst HTML_NS = 'http://www.w3.org/1999/xhtml';\nconst MATHML_NS = 'http://www.w3.org/1998/Math/MathML';\n\nexport abstract class _DOMRenderer extends _Renderer<Element | DOMNativeNode> {\n\n #window: Window | DOMWindow;\n #namespace_map = new WeakMap<VNode, string | undefined>();\n\n #tracked_head_children = new Map<VNode, (string | Element | DOMNativeNode)[]>();\n #tracked_body_head_children = new Map<VNode, (string | Element | DOMNativeNode)[]>();\n #tracked_style = new StyleBuilder();\n /** @internal */\n _tracked_server_resource = new Map<string, string>();\n #tracked_elements = new Map<Element | DOMNativeNode, { props: string[]; className: string[]; }>();\n\n #server_head_elements?: ChildNode[];\n\n constructor(window: Window | DOMWindow) {\n super();\n this.#window = window;\n }\n\n get document() {\n return this.window.document;\n }\n\n get window() {\n return this.#window;\n }\n\n _beforeUpdate() {\n const head = this.document.head\n if (this._server) {\n this._tracked_server_resource = new Map();\n } else if (head) {\n if (!this.#server_head_elements) {\n const found_marker = _.findIndex(head.childNodes, x => x.nodeType === head.COMMENT_NODE && x.textContent === 'frosty-server-head-marker');\n if (found_marker > -1) {\n this.#server_head_elements = _.slice(head.childNodes, 0, found_marker);\n } else {\n const styleElem = this.document.querySelector('style[data-frosty-style]');\n const ssrDataElem = this.document.querySelector('script[data-frosty-ssr-data]');\n this.#server_head_elements = _.filter([...head.childNodes], x => !_.includes([styleElem, ssrDataElem], x));\n }\n DOMNativeNode.Utils.replaceChildren(head, this.#server_head_elements);\n }\n }\n }\n\n _afterUpdate() {\n this.#tracked_style.select([...this.#tracked_elements.values().flatMap(({ className }) => className)]);\n const head = this.document.head ?? this.document.createElementNS(HTML_NS, 'head');\n const styleElem = this.document.querySelector('style[data-frosty-style]') ?? this.document.createElementNS(HTML_NS, 'style');\n styleElem.setAttribute('data-frosty-style', '');\n if (styleElem.textContent !== this.#tracked_style.css)\n styleElem.textContent = this.#tracked_style.css;\n if (this._server) {\n const ssrData = this._tracked_server_resource.size ? this.document.createElementNS(HTML_NS, 'script') : undefined;\n if (ssrData) {\n ssrData.setAttribute('data-frosty-ssr-data', '');\n ssrData.setAttribute('type', 'text/plain');\n ssrData.innerHTML = compress(JSON.stringify(Object.fromEntries(this._tracked_server_resource)));\n }\n const tracked_head_children = _.flattenDeep([...this.#tracked_body_head_children.values()]);\n const maker = this.document.createComment('frosty-server-head-marker');\n DOMNativeNode.Utils.replaceChildren(head, _.compact([\n ..._.flattenDeep([...this.#tracked_head_children.values()]),\n !_.isEmpty(tracked_head_children) && maker,\n ...tracked_head_children,\n styleElem.textContent && styleElem,\n ssrData,\n ]), (x) => this.#tracked_elements.has(x as any));\n } else {\n DOMNativeNode.Utils.replaceChildren(head, _.compact([\n ...this.#server_head_elements ?? [],\n ..._.flattenDeep([...this.#tracked_body_head_children.values()]),\n styleElem.textContent && styleElem,\n ]), (x) => this.#tracked_elements.has(x as any));\n }\n if (!this.document.head) {\n this.document.documentElement.insertBefore(head, this.document.body);\n }\n }\n\n _createElement(node: VNode) {\n const { type, props: { ref } } = node;\n if (!_.isString(type) && type.prototype instanceof DOMNativeNode) {\n const ElementType = type as typeof DOMNativeNode;\n const elem = ElementType.createElement(this.document, this);\n this.#tracked_elements.set(elem, {\n props: [],\n className: [],\n });\n if (ref) mergeRefs(ref)(elem);\n return elem;\n }\n if (!_.isString(type)) throw Error(`Invalid type ${type}`);\n switch (type) {\n case 'html': return this.document.documentElement;\n case 'head': return this.document.head ?? this.document.createElementNS(HTML_NS, 'head');\n case 'body': return this.document.body ?? this.document.createElementNS(HTML_NS, 'body');\n default: break;\n }\n const _ns_list = _.compact([\n _.includes(tags.svg, type) && SVG_NS,\n _.includes(tags.html, type) && HTML_NS,\n _.includes(tags.mathml, type) && MATHML_NS,\n ]);\n const parent = _.last(node.stack.toArray());\n const ns = _ns_list.length > 1 ? parent && _.first(_.intersection([this.#namespace_map.get(parent)], _ns_list)) : _.first(_ns_list);\n const elem = ns ? this.document.createElementNS(ns, type) : this.document.createElement(type);\n this.#namespace_map.set(node, ns);\n this.#tracked_elements.set(elem, {\n props: [],\n className: [],\n });\n if (ref) mergeRefs(ref)(elem);\n return elem;\n }\n\n #createBuiltClassName(\n element: Element | DOMNativeNode,\n className: ClassName,\n style: StyleProp<ExtendedCSSProperties>,\n ) {\n const _className = _.compact(_.flattenDeep([className]));\n const built = this.#tracked_style.buildStyle(_.compact(_.flattenDeep([style])));\n const tracked = this.#tracked_elements.get(element);\n if (tracked) tracked.className = built;\n return [..._className, ...built].join(' ');\n }\n\n _updateElement(\n node: VNode,\n element: Element | DOMNativeNode,\n children: (string | Element | DOMNativeNode)[],\n force?: boolean\n ) {\n\n if (node.type !== 'html') {\n children = _.filter(children, x => x !== this.document.head && x !== this.document.body);\n }\n\n if (element instanceof DOMNativeNode) {\n const {\n props: { ref, className, style, inlineStyle, ..._props }\n } = node;\n if (ref) mergeRefs(ref)(element);\n const builtClassName = this.#createBuiltClassName(element, className, style);\n const { css } = processCss(inlineStyle);\n element.update({\n className: builtClassName ? builtClassName : undefined,\n style: css ? css : undefined,\n ..._props\n }, children);\n return;\n }\n\n const {\n type,\n props: { ref, className, style, inlineStyle, innerHTML, ..._props }\n } = node;\n\n if (!_.isString(type)) {\n DOMNativeNode.Utils.replaceChildren(element, children, (x) => !!force || this.#tracked_elements.has(x as any));\n return;\n }\n switch (type) {\n case 'head': {\n const tracked = node.parent?.type === 'html'\n ? this.#tracked_head_children\n : this.#tracked_body_head_children;\n tracked.set(node, children);\n return;\n }\n default: break;\n }\n\n if (ref) mergeRefs(ref)(element);\n\n const tracked = this.#tracked_elements.get(element);\n const removed = tracked ? _.difference(tracked.props, _.keys(_props)) : [];\n if (tracked) tracked.props = _.keys(_props);\n\n const builtClassName = this.#createBuiltClassName(element, className, style);\n if (_.isNil(innerHTML)) {\n DOMNativeNode.Utils.replaceChildren(element, children, (x) => !!force || this.#tracked_elements.has(x as any));\n } else if (element.innerHTML !== innerHTML) {\n element.innerHTML = innerHTML;\n }\n\n DOMNativeNode.Utils.update(element, {\n className: builtClassName,\n style: inlineStyle ? processCss(inlineStyle).css : undefined,\n ..._props,\n ..._.fromPairs(_.map(removed, x => [x, undefined])),\n });\n }\n\n _destroyElement(node: VNode, element: Element | DOMNativeNode) {\n this.#tracked_head_children.delete(node);\n this.#tracked_body_head_children.delete(node);\n if (element instanceof DOMNativeNode) {\n element.destroy();\n } else {\n DOMNativeNode.Utils.destroy(element);\n }\n }\n\n async renderToString(component: ComponentNode) {\n const root = this.createRoot();\n try {\n await root.mount(component, { skipMount: true });\n const elements = _.flatMap(_.castArray(root.root ?? []), x => x instanceof DOMNativeNode ? x.target : x);\n const str = _.map(elements, x => x.outerHTML).join('');\n if (elements.length !== 1) return str;\n return elements[0].tagName.toLowerCase() === 'html' ? `<!DOCTYPE html>${str}` : str;\n } finally {\n root.unmount();\n }\n }\n}\n"],"names":[],"mappings":";;;;AAEO,uBAAA,aAAA,SAAA,iBAAA;AACP;AACA,wBAAA,OAAA,kCAAA,MAAA;AACA;AACA;AACA;AACA,iCAAA,OAAA,sBAAA,SAAA,GAAA,aAAA,4BAAA,SAAA;AACA,yBAAA,OAAA;AACA;AACA,gCAAA,QAAA,YAAA,YAAA,KAAA,aAAA;AACA,2BAAA,OAAA,GAAA,OAAA;AACA,2BAAA,MAAA;AACA;AACA;AACA,2BAAA,OAAA,GAAA,aAAA;AACA;AACA;;ACbO,uBAAA,YAAA,SAAA,SAAA,CAAA,OAAA,GAAA,aAAA;AACP;AACA,wBAAA,MAAA,GAAA,SAAA;AACA,oBAAA,QAAA;AACA,kBAAA,MAAA,GAAA,SAAA;AACA;AACA;AACA,yBAAA,KAAA,GAAA,OAAA,GAAA,aAAA;AACA,yBAAA,KAAA,WAAA,OAAA,GAAA,aAAA,sBAAA,OAAA,GAAA,aAAA;AACA,0BAAA,KAAA,WAAA,OAAA,GAAA,aAAA;AACA,8BAAA,aAAA,GAAA,OAAA;AACA;;;;"}
@@ -1,5 +1,5 @@
1
1
  import _ from 'lodash';
2
- import { _ as _Renderer } from './renderer-DxQAalyV.mjs';
2
+ import { _ as _Renderer } from './renderer-DaX4zUo8.mjs';
3
3
  import postcss from 'postcss';
4
4
  import { parse } from 'postcss-js';
5
5
  import nested from 'postcss-nested';
@@ -5999,4 +5999,4 @@ class _DOMRenderer extends _Renderer {
5999
5999
  }
6000
6000
 
6001
6001
  export { DOMNativeNode as D, _DOMRenderer as _ };
6002
- //# sourceMappingURL=renderer-CRJ6yD_V.mjs.map
6002
+ //# sourceMappingURL=renderer-BvM6i6Cl.mjs.map