frosty 0.0.107 → 0.0.109

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.
package/dist/_native.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var runtime = require('./internals/runtime-PKOt40BM.js');
4
- var renderer = require('./internals/renderer-DMQqKE1j.js');
4
+ var renderer = require('./internals/renderer-C5DRQlCe.js');
5
5
  var state = require('./internals/state-4DjTr6NP.js');
6
6
  require('lodash');
7
7
  require('nextick');
package/dist/_native.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { _ as _createElement } from './internals/runtime-DrGYUphO.mjs';
2
2
  export { N as NativeElementType } from './internals/runtime-DrGYUphO.mjs';
3
- export { _ as _Renderer } from './internals/renderer-FPMPLNKC.mjs';
3
+ export { _ as _Renderer } from './internals/renderer-BDLWYA3i.mjs';
4
4
  export { d as EventEmitter, V as VNode, a as uniqueId } from './internals/state-DHNx5rLZ.mjs';
5
5
  import 'lodash';
6
6
  import 'nextick';
package/dist/dom.js CHANGED
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var renderer = require('./internals/renderer-D1z5QGPB.js');
3
+ var renderer = require('./internals/renderer-D5VWxoFX.js');
4
4
  require('lodash');
5
5
  require('myers.js');
6
- require('./internals/renderer-DMQqKE1j.js');
6
+ require('./internals/renderer-C5DRQlCe.js');
7
7
  require('./internals/state-4DjTr6NP.js');
8
8
  require('./internals/runtime-PKOt40BM.js');
9
9
  require('nextick');
package/dist/dom.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { _ as _DOMRenderer } from './internals/renderer-B-0wMO7O.mjs';
1
+ import { _ as _DOMRenderer } from './internals/renderer-E4Kz-AlP.mjs';
2
2
  import 'lodash';
3
3
  import 'myers.js';
4
- import './internals/renderer-FPMPLNKC.mjs';
4
+ import './internals/renderer-BDLWYA3i.mjs';
5
5
  import './internals/state-DHNx5rLZ.mjs';
6
6
  import './internals/runtime-DrGYUphO.mjs';
7
7
  import 'nextick';
@@ -1 +1 @@
1
- {"version":3,"file":"renderer--F4YB5QP.d.ts","sources":["../../src/core/reconciler/vnode.ts","../../src/core/renderer.ts"],"sourcesContent":["//\n// vnode.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { ComponentNode, NativeElementType } from '../types/component';\nimport { Context, isContext } from '../hooks/context';\nimport { reconciler } from './state';\nimport { myersSync } from 'myers.js';\nimport { EventEmitter } from './events';\nimport { equalDeps, equalProps } from './utils';\nimport { _Renderer } from '../renderer';\nimport { PropsType } from '../types/runtime';\nimport { uniqueId } from '../utils';\n\nexport type VNodeState = {\n hook: string;\n deps: any;\n data?: any;\n mount?: () => () => void;\n};\n\nexport type _ContextState = {\n value: any;\n state: string;\n node: VNode;\n};\n\nexport class VNode {\n\n /** @internal */\n _component: ComponentNode;\n\n private _id = uniqueId();\n\n private _event: EventEmitter;\n private _props: PropsType = {};\n private _error?: any;\n private _children: (VNode | string)[] = [];\n private _state?: VNodeState[];\n private _dirty = true;\n private _listens = new Map<Context<any>, Omit<_ContextState, 'value'>>();\n\n /** @internal */\n _content_state = uniqueId();\n private _content_value?: any;\n\n /** @internal */\n constructor(component: ComponentNode, event: EventEmitter) {\n this._component = component;\n this._event = event;\n }\n\n /** @internal */\n _resolve_children(child: any): (VNode | string)[] {\n if (_.isBoolean(child) || _.isNil(child)) return [];\n if (_.isString(child)) return [child];\n if (_.isNumber(child)) return [`${child}`];\n if (child instanceof ComponentNode) return [new VNode(child, this._event)];\n if (_.isArrayLikeObject(child)) return _.flatMap(child, x => this._resolve_children(x));\n if (typeof child[Symbol.iterator] === 'function') return _.flatMap([...child], x => this._resolve_children(x));\n throw Error(`${child} are not valid as a child.`);\n }\n\n get id() {\n return this._id;\n }\n\n get type() {\n return this._component.type;\n }\n\n get props() {\n return this._props;\n }\n\n get key() {\n return this._component.key;\n }\n\n get state() {\n return this._state ?? [];\n }\n\n get children() {\n return this._children;\n }\n\n get error() {\n return this._error;\n }\n\n /** @internal */\n _setDirty() {\n this._dirty = true;\n this._event.emit('onchange');\n }\n\n /** @internal */\n private _check_context(values: Map<Context<any>, Omit<_ContextState, 'value'>>) {\n return this._listens.entries().every(([k, v]) => {\n const { state, node } = values.get(k) ?? {};\n return state === v.state && node === v.node;\n });\n }\n\n /** @internal */\n async _updateIfNeed(options: {\n renderer: _Renderer<any>;\n stack: VNode[];\n propsProvider: VNode[];\n errorBoundary?: VNode;\n contextValue: Map<Context<any>, _ContextState>;\n }) {\n if (!this._dirty && this._check_context(options.contextValue)) return false;\n try {\n const self = this;\n const { type, props: _props } = this._component;\n const props = _.mapValues(\n options.propsProvider.reduceRight((p, node) => node.props.callback({ type, props: p }), _props),\n (v, k) => _.isFunction(v) ? function (this: any, ...args: any[]) {\n const current = self._component.props[k];\n return _.isFunction(current) ? current.call(this, ...args) : v.call(this, ...args);\n } : v,\n );\n let children: (VNode | string)[];\n if (_.isString(type) || type?.prototype instanceof NativeElementType) {\n children = this._resolve_children(props.children);\n } else if (isContext(type)) {\n const { value } = props;\n if (!equalDeps(this._content_value, value)) this._content_state = uniqueId();\n this._content_value = value;\n children = this._resolve_children(type(props as any));\n } else if (_.isFunction(type)) {\n let resolved;\n while (true) {\n const {\n resolved: rendered,\n error,\n state,\n } = reconciler.withHookState({\n renderer: options.renderer,\n node: this,\n state: this._state,\n stack: options.stack,\n contextValue: options.contextValue,\n }, () => type(props));\n this._state = state.state;\n if (_.isEmpty(state.tasks)) {\n if (error) throw error;\n resolved = { rendered, state };\n break;\n }\n await Promise.all(state.tasks);\n }\n this._listens = new Map(options.contextValue.entries().filter(([k]) => resolved.state.listens.has(k)));\n children = this._resolve_children(resolved.rendered);\n } else {\n throw Error(`Invalid node type ${type}`);\n }\n const diff = myersSync(this._children, children, {\n compare: (lhs, rhs) => {\n if (_.isString(lhs) && _.isString(rhs)) return lhs === rhs;\n if (lhs instanceof VNode && rhs instanceof VNode) return lhs._component._equal(rhs._component);\n return false;\n },\n });\n this._props = _.omit(props, 'children');\n this._children = _.flatMap(diff, x => x.equivalent ?? x.insert ?? []);\n this._error = undefined;\n for (const [i, item] of this._children.entries()) {\n if (!(item instanceof VNode)) continue;\n if (!(children[i] instanceof VNode)) continue;\n if (!equalProps(item._component.props, children[i]._component.props)) item._dirty = true;\n item._component = children[i]._component;\n }\n } catch (error) {\n this._props = {};\n this._children = [];\n this._error = error;\n (async () => {\n try {\n const { onError, silent } = options.errorBoundary?.props ?? {};\n if (!silent) console.error(error);\n if (_.isFunction(onError)) await onError(error, this._component, _.map(options.stack, x => x._component));\n } catch (e) {\n console.error(e);\n }\n })();\n } finally {\n this._dirty = false;\n }\n return true;\n }\n}\n","//\n// renderer.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { VNode } from './reconciler/vnode';\nimport { ComponentNode, NativeElementType } from './types/component';\nimport { reconciler } from './reconciler/state';\nimport nextick from 'nextick';\nimport { equalDeps } from './reconciler/utils';\nimport { _ChildComponent, _ParentComponent } from './components/pairs';\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, stack: VNode[]): T;\n\n protected abstract _updateElement(node: VNode, element: T, stack: VNode[]): void;\n\n protected abstract _destroyElement(node: VNode, element: T): void;\n\n protected abstract _replaceChildren(node: VNode, element: T, children: (T | string)[], stack: VNode[], force?: boolean): void;\n\n abstract get _server(): boolean;\n\n private async _createRoot(\n root: T | null,\n component: ComponentNode,\n options?: {\n skipMount?: boolean;\n },\n ) {\n\n const runtime = reconciler.buildVNodes(component, this);\n\n type _State = {\n hook: string;\n deps: any;\n unmount?: () => void;\n };\n\n const mountState = new Map<VNode, _State[]>();\n\n const children = (node: VNode, elements: Map<VNode, { native?: T }>) => {\n const _children = (node: VNode, allowedChild?: (node: T) => boolean): (string | T)[] => _.flatMap(node.children, x => {\n if (_.isString(x)) return x;\n const _node = elements.get(x)?.native;\n if (_node instanceof _ParentComponent) {\n const c = _children(x, c => _node.isChildNode(c));\n return _.flatMap(c, x => x instanceof VNode ? _children(x) : _node.isChildNode(x) ? x : []);\n }\n if (_node instanceof _ChildComponent) return allowedChild?.(_node) ? x as any : _children(x, allowedChild);\n return _node ?? _children(x, allowedChild);\n });\n return _children(node);\n };\n\n const commit = (elements: Map<VNode, { native?: T }>, force?: boolean) => {\n\n const _mount = (node: VNode, stack: VNode[]) => {\n for (const item of node.children) {\n if (item instanceof VNode) _mount(item, [...stack, node]);\n }\n const element = elements.get(node)?.native;\n if (element instanceof _ParentComponent || element instanceof _ChildComponent) return;\n if (element) {\n try {\n this._replaceChildren(node, element, children(node, elements), stack, force);\n } catch (e) {\n console.error(e);\n }\n }\n const state: _State[] = [];\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 for (const [node, state] of mountState) {\n if (elements.has(node)) continue;\n for (const { unmount } of state) {\n try {\n unmount?.();\n } catch (e) {\n console.error(e);\n }\n }\n mountState.delete(node);\n }\n if (root) this._replaceChildren(\n runtime.node, root,\n _.castArray(elements.get(runtime.node)?.native ?? children(runtime.node, elements)),\n [],\n force,\n );\n _mount(runtime.node, []);\n };\n\n const update = async (elements?: Map<VNode, { native?: T }>, force?: boolean) => {\n try {\n this._beforeUpdate();\n } catch (e) {\n console.error(e);\n }\n const map = new Map<VNode, { native?: T }>();\n for await (const { node, stack, updated } of runtime.excute()) {\n if (node.error) continue;\n if (_.isFunction(node.type) && !(node.type.prototype instanceof NativeElementType)) {\n map.set(node, {});\n } else if (_.isFunction(node.type) && (\n node.type.prototype instanceof _ParentComponent ||\n node.type.prototype instanceof _ChildComponent\n )) {\n let elem = elements?.get(node)?.native;\n if (!elem) {\n const Component = node.type as any;\n elem = new Component();\n }\n map.set(node, { native: elem });\n } else {\n try {\n if (updated) {\n let elem = elements?.get(node)?.native;\n if (elem) {\n this._updateElement(node, elem, stack);\n } else {\n elem = this._createElement(node, stack);\n }\n map.set(node, { native: elem });\n } else {\n map.set(node, { native: elements?.get(node)?.native ?? this._createElement(node, stack) });\n }\n } catch (e) {\n console.error(e);\n }\n }\n }\n commit(map, force);\n if (elements) {\n for (const [node, element] of elements) {\n if (map.has(node) || !element.native) continue;\n try {\n this._destroyElement(node, element.native);\n } catch (e) {\n console.error(e);\n }\n }\n }\n try {\n this._afterUpdate();\n } catch (e) {\n console.error(e);\n }\n return map;\n };\n\n let update_count = 0;\n let render_count = 0;\n let destroyed = false;\n let elements = await update(undefined, true);\n\n const listener = runtime.event.register('onchange', () => {\n if (render_count !== update_count++) return;\n nextick(async () => {\n while (render_count !== update_count) {\n if (destroyed) return;\n const current = update_count;\n elements = await update(elements, false);\n render_count = current;\n }\n });\n });\n\n return {\n get root() {\n if (root) return root;\n const elems = _.castArray(elements.get(runtime.node)?.native ?? children(runtime.node, elements));\n const nodes = _.filter(elems, x => !_.isString(x)) as T[];\n return nodes.length === 1 ? nodes[0] : nodes;\n },\n destroy: () => {\n if (root) this._replaceChildren(runtime.node, root, [], [], true);\n destroyed = true;\n listener.remove();\n for (const state of mountState.values()) {\n for (const { unmount } of state) unmount?.();\n }\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 },\n ) => {\n state = await this._createRoot(root ?? null, component, options);\n },\n unmount: () => {\n state?.destroy();\n state = undefined;\n },\n };\n }\n}"],"names":[],"mappings":";;AAEO;AACP;AACA;AACA;AACA;AACA;AAMO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;"}
1
+ {"version":3,"file":"renderer--F4YB5QP.d.ts","sources":["../../src/core/reconciler/vnode.ts","../../src/core/renderer.ts"],"sourcesContent":["//\n// vnode.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { ComponentNode, NativeElementType } from '../types/component';\nimport { Context, isContext } from '../hooks/context';\nimport { reconciler } from './state';\nimport { myersSync } from 'myers.js';\nimport { EventEmitter } from './events';\nimport { equalDeps, equalProps } from './utils';\nimport { _Renderer } from '../renderer';\nimport { PropsType } from '../types/runtime';\nimport { uniqueId } from '../utils';\n\nexport type VNodeState = {\n hook: string;\n deps: any;\n data?: any;\n mount?: () => () => void;\n};\n\nexport type _ContextState = {\n value: any;\n state: string;\n node: VNode;\n};\n\nexport class VNode {\n\n /** @internal */\n _component: ComponentNode;\n\n private _id = uniqueId();\n\n private _event: EventEmitter;\n private _props: PropsType = {};\n private _error?: any;\n private _children: (VNode | string)[] = [];\n private _state?: VNodeState[];\n private _dirty = true;\n private _listens = new Map<Context<any>, Omit<_ContextState, 'value'>>();\n\n /** @internal */\n _content_state = uniqueId();\n private _content_value?: any;\n\n /** @internal */\n constructor(component: ComponentNode, event: EventEmitter) {\n this._component = component;\n this._event = event;\n }\n\n /** @internal */\n _resolve_children(child: any): (VNode | string)[] {\n if (_.isBoolean(child) || _.isNil(child)) return [];\n if (_.isString(child)) return [child];\n if (_.isNumber(child)) return [`${child}`];\n if (child instanceof ComponentNode) return [new VNode(child, this._event)];\n if (_.isArrayLikeObject(child)) return _.flatMap(child, x => this._resolve_children(x));\n if (typeof child[Symbol.iterator] === 'function') return _.flatMap([...child], x => this._resolve_children(x));\n throw Error(`${child} are not valid as a child.`);\n }\n\n get id() {\n return this._id;\n }\n\n get type() {\n return this._component.type;\n }\n\n get props() {\n return this._props;\n }\n\n get key() {\n return this._component.key;\n }\n\n get state() {\n return this._state ?? [];\n }\n\n get children() {\n return this._children;\n }\n\n get error() {\n return this._error;\n }\n\n /** @internal */\n _setDirty() {\n this._dirty = true;\n this._event.emit('onchange');\n }\n\n /** @internal */\n private _check_context(values: Map<Context<any>, Omit<_ContextState, 'value'>>) {\n return this._listens.entries().every(([k, v]) => {\n const { state, node } = values.get(k) ?? {};\n return state === v.state && node === v.node;\n });\n }\n\n /** @internal */\n async _updateIfNeed(options: {\n renderer: _Renderer<any>;\n stack: VNode[];\n propsProvider: VNode[];\n errorBoundary?: VNode;\n contextValue: Map<Context<any>, _ContextState>;\n }) {\n if (!this._dirty && this._check_context(options.contextValue)) return false;\n try {\n const self = this;\n const { type, props: _props } = this._component;\n const props = _.mapValues(\n options.propsProvider.reduceRight((p, node) => node.props.callback({ type, props: p }), _props),\n (v, k) => _.isFunction(v) ? function (this: any, ...args: any[]) {\n const current = self._component.props[k];\n return _.isFunction(current) ? current.call(this, ...args) : v.call(this, ...args);\n } : v,\n );\n let children: (VNode | string)[];\n if (_.isString(type) || type?.prototype instanceof NativeElementType) {\n children = this._resolve_children(props.children);\n } else if (isContext(type)) {\n const { value } = props;\n if (!equalDeps(this._content_value, value)) this._content_state = uniqueId();\n this._content_value = value;\n children = this._resolve_children(type(props as any));\n } else if (_.isFunction(type)) {\n let resolved;\n while (true) {\n const {\n resolved: rendered,\n error,\n state,\n } = reconciler.withHookState({\n renderer: options.renderer,\n node: this,\n state: this._state,\n stack: options.stack,\n contextValue: options.contextValue,\n }, () => type(props));\n this._state = state.state;\n if (_.isEmpty(state.tasks)) {\n if (error) throw error;\n resolved = { rendered, state };\n break;\n }\n await Promise.all(state.tasks);\n }\n this._listens = new Map(options.contextValue.entries().filter(([k]) => resolved.state.listens.has(k)));\n children = this._resolve_children(resolved.rendered);\n } else {\n throw Error(`Invalid node type ${type}`);\n }\n const diff = myersSync(this._children, children, {\n compare: (lhs, rhs) => {\n if (_.isString(lhs) && _.isString(rhs)) return lhs === rhs;\n if (lhs instanceof VNode && rhs instanceof VNode) return lhs._component._equal(rhs._component);\n return false;\n },\n });\n this._props = _.omit(props, 'children');\n this._children = _.flatMap(diff, x => x.equivalent ?? x.insert ?? []);\n this._error = undefined;\n for (const [i, item] of this._children.entries()) {\n if (!(item instanceof VNode)) continue;\n if (!(children[i] instanceof VNode)) continue;\n if (!equalProps(item._component.props, children[i]._component.props)) item._dirty = true;\n item._component = children[i]._component;\n }\n } catch (error) {\n this._props = {};\n this._children = [];\n this._error = error;\n (async () => {\n try {\n const { onError, silent } = options.errorBoundary?.props ?? {};\n if (!silent) console.error(error);\n if (_.isFunction(onError)) await onError(error, this._component, _.map(options.stack, x => x._component));\n } catch (e) {\n console.error(e);\n }\n })();\n } finally {\n this._dirty = false;\n }\n return true;\n }\n}\n","//\n// renderer.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { VNode } from './reconciler/vnode';\nimport { ComponentNode, NativeElementType } from './types/component';\nimport { reconciler } from './reconciler/state';\nimport nextick from 'nextick';\nimport { equalDeps } from './reconciler/utils';\nimport { _ChildComponent, _ParentComponent } from './components/pairs';\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, stack: VNode[]): T;\n\n protected abstract _updateElement(node: VNode, element: T, stack: VNode[]): void;\n\n protected abstract _destroyElement(node: VNode, element: T): void;\n\n protected abstract _replaceChildren(node: VNode, element: T, children: (T | string)[], stack: VNode[], force?: boolean): void;\n\n abstract get _server(): boolean;\n\n private async _createRoot(\n root: T | null,\n component: ComponentNode,\n options?: {\n skipMount?: boolean;\n },\n ) {\n\n const runtime = reconciler.buildVNodes(component, this);\n\n type _State = {\n hook: string;\n deps: any;\n unmount?: () => void;\n };\n\n const mountState = new Map<VNode, _State[]>();\n\n const resolveChildren = (node: VNode, elements: Map<VNode, { native?: T }>) => {\n const childrenOfParent = (node: VNode, allowedChild: (node: string | T) => boolean): (string | T)[] => _.flatMap(node.children, x => {\n if (_.isString(x)) return allowedChild(x) ? x : [];\n const _node = elements.get(x)?.native;\n if (!_node) return childrenOfParent(x, allowedChild);\n if (!allowedChild(_node)) return [];\n return _node instanceof _ChildComponent ? children(x) : _node;\n });\n const children = (node: VNode): (string | T)[] => _.flatMap(node.children, x => {\n if (_.isString(x)) return x;\n const _node = elements.get(x)?.native;\n if (_node instanceof _ParentComponent) return childrenOfParent(x, c => _node.isChildNode(c));\n if (_node instanceof _ChildComponent) return children(x);\n return _node ?? children(x);\n });\n return children(node);\n };\n\n const commit = (elements: Map<VNode, { native?: T }>, force?: boolean) => {\n\n const _mount = (node: VNode, stack: VNode[]) => {\n for (const item of node.children) {\n if (item instanceof VNode) _mount(item, [...stack, node]);\n }\n const element = elements.get(node)?.native;\n if (element instanceof _ParentComponent || element instanceof _ChildComponent) return;\n if (element) {\n try {\n this._replaceChildren(node, element, resolveChildren(node, elements), stack, force);\n } catch (e) {\n console.error(e);\n }\n }\n const state: _State[] = [];\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 for (const [node, state] of mountState) {\n if (elements.has(node)) continue;\n for (const { unmount } of state) {\n try {\n unmount?.();\n } catch (e) {\n console.error(e);\n }\n }\n mountState.delete(node);\n }\n if (root) this._replaceChildren(\n runtime.node, root,\n _.castArray(elements.get(runtime.node)?.native ?? resolveChildren(runtime.node, elements)),\n [],\n force,\n );\n _mount(runtime.node, []);\n };\n\n const update = async (elements?: Map<VNode, { native?: T }>, force?: boolean) => {\n try {\n this._beforeUpdate();\n } catch (e) {\n console.error(e);\n }\n const map = new Map<VNode, { native?: T }>();\n for await (const { node, stack, updated } of runtime.excute()) {\n if (node.error) continue;\n if (_.isFunction(node.type) && !(node.type.prototype instanceof NativeElementType)) {\n map.set(node, {});\n } else if (_.isFunction(node.type) && (\n node.type.prototype instanceof _ParentComponent ||\n node.type.prototype instanceof _ChildComponent\n )) {\n let elem = elements?.get(node)?.native;\n if (!elem) {\n const Component = node.type as any;\n elem = new Component();\n }\n map.set(node, { native: elem });\n } else {\n try {\n if (updated) {\n let elem = elements?.get(node)?.native;\n if (elem) {\n this._updateElement(node, elem, stack);\n } else {\n elem = this._createElement(node, stack);\n }\n map.set(node, { native: elem });\n } else {\n map.set(node, { native: elements?.get(node)?.native ?? this._createElement(node, stack) });\n }\n } catch (e) {\n console.error(e);\n }\n }\n }\n commit(map, force);\n if (elements) {\n for (const [node, element] of elements) {\n if (map.has(node) || !element.native) continue;\n try {\n this._destroyElement(node, element.native);\n } catch (e) {\n console.error(e);\n }\n }\n }\n try {\n this._afterUpdate();\n } catch (e) {\n console.error(e);\n }\n return map;\n };\n\n let update_count = 0;\n let render_count = 0;\n let destroyed = false;\n let elements = await update(undefined, true);\n\n const listener = runtime.event.register('onchange', () => {\n if (render_count !== update_count++) return;\n nextick(async () => {\n while (render_count !== update_count) {\n if (destroyed) return;\n const current = update_count;\n elements = await update(elements, false);\n render_count = current;\n }\n });\n });\n\n return {\n get root() {\n if (root) return root;\n const elems = _.castArray(elements.get(runtime.node)?.native ?? resolveChildren(runtime.node, elements));\n const nodes = _.filter(elems, x => !_.isString(x)) as T[];\n return nodes.length === 1 ? nodes[0] : nodes;\n },\n destroy: () => {\n if (root) this._replaceChildren(runtime.node, root, [], [], true);\n destroyed = true;\n listener.remove();\n for (const state of mountState.values()) {\n for (const { unmount } of state) unmount?.();\n }\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 },\n ) => {\n state = await this._createRoot(root ?? null, component, options);\n },\n unmount: () => {\n state?.destroy();\n state = undefined;\n },\n };\n }\n}"],"names":[],"mappings":";;AAEO;AACP;AACA;AACA;AACA;AACA;AAMO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;"}
@@ -31,20 +31,28 @@ class _Renderer {
31
31
  async _createRoot(root, component, options) {
32
32
  const runtime = reconciler.buildVNodes(component, this);
33
33
  const mountState = new Map();
34
- const children = (node, elements) => {
35
- const _children = (node, allowedChild) => _.flatMap(node.children, x => {
34
+ const resolveChildren = (node, elements) => {
35
+ const childrenOfParent = (node, allowedChild) => _.flatMap(node.children, x => {
36
+ if (_.isString(x))
37
+ return allowedChild(x) ? x : [];
38
+ const _node = elements.get(x)?.native;
39
+ if (!_node)
40
+ return childrenOfParent(x, allowedChild);
41
+ if (!allowedChild(_node))
42
+ return [];
43
+ return _node instanceof _ChildComponent ? children(x) : _node;
44
+ });
45
+ const children = (node) => _.flatMap(node.children, x => {
36
46
  if (_.isString(x))
37
47
  return x;
38
48
  const _node = elements.get(x)?.native;
39
- if (_node instanceof _ParentComponent) {
40
- const c = _children(x, c => _node.isChildNode(c));
41
- return _.flatMap(c, x => x instanceof VNode ? _children(x) : _node.isChildNode(x) ? x : []);
42
- }
49
+ if (_node instanceof _ParentComponent)
50
+ return childrenOfParent(x, c => _node.isChildNode(c));
43
51
  if (_node instanceof _ChildComponent)
44
- return allowedChild?.(_node) ? x : _children(x, allowedChild);
45
- return _node ?? _children(x, allowedChild);
52
+ return children(x);
53
+ return _node ?? children(x);
46
54
  });
47
- return _children(node);
55
+ return children(node);
48
56
  };
49
57
  const commit = (elements, force) => {
50
58
  const _mount = (node, stack) => {
@@ -57,7 +65,7 @@ class _Renderer {
57
65
  return;
58
66
  if (element) {
59
67
  try {
60
- this._replaceChildren(node, element, children(node, elements), stack, force);
68
+ this._replaceChildren(node, element, resolveChildren(node, elements), stack, force);
61
69
  }
62
70
  catch (e) {
63
71
  console.error(e);
@@ -106,7 +114,7 @@ class _Renderer {
106
114
  mountState.delete(node);
107
115
  }
108
116
  if (root)
109
- this._replaceChildren(runtime.node, root, _.castArray(elements.get(runtime.node)?.native ?? children(runtime.node, elements)), [], force);
117
+ this._replaceChildren(runtime.node, root, _.castArray(elements.get(runtime.node)?.native ?? resolveChildren(runtime.node, elements)), [], force);
110
118
  _mount(runtime.node, []);
111
119
  };
112
120
  const update = async (elements, force) => {
@@ -195,7 +203,7 @@ class _Renderer {
195
203
  get root() {
196
204
  if (root)
197
205
  return root;
198
- const elems = _.castArray(elements.get(runtime.node)?.native ?? children(runtime.node, elements));
206
+ const elems = _.castArray(elements.get(runtime.node)?.native ?? resolveChildren(runtime.node, elements));
199
207
  const nodes = _.filter(elems, x => !_.isString(x));
200
208
  return nodes.length === 1 ? nodes[0] : nodes;
201
209
  },
@@ -229,4 +237,4 @@ class _Renderer {
229
237
  }
230
238
 
231
239
  export { _Renderer as _ };
232
- //# sourceMappingURL=renderer-FPMPLNKC.mjs.map
240
+ //# sourceMappingURL=renderer-BDLWYA3i.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer-BDLWYA3i.mjs","sources":["../../../src/core/renderer.ts"],"sourcesContent":["//\n// renderer.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { VNode } from './reconciler/vnode';\nimport { ComponentNode, NativeElementType } from './types/component';\nimport { reconciler } from './reconciler/state';\nimport nextick from 'nextick';\nimport { equalDeps } from './reconciler/utils';\nimport { _ChildComponent, _ParentComponent } from './components/pairs';\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, stack: VNode[]): T;\n\n protected abstract _updateElement(node: VNode, element: T, stack: VNode[]): void;\n\n protected abstract _destroyElement(node: VNode, element: T): void;\n\n protected abstract _replaceChildren(node: VNode, element: T, children: (T | string)[], stack: VNode[], force?: boolean): void;\n\n abstract get _server(): boolean;\n\n private async _createRoot(\n root: T | null,\n component: ComponentNode,\n options?: {\n skipMount?: boolean;\n },\n ) {\n\n const runtime = reconciler.buildVNodes(component, this);\n\n type _State = {\n hook: string;\n deps: any;\n unmount?: () => void;\n };\n\n const mountState = new Map<VNode, _State[]>();\n\n const resolveChildren = (node: VNode, elements: Map<VNode, { native?: T }>) => {\n const childrenOfParent = (node: VNode, allowedChild: (node: string | T) => boolean): (string | T)[] => _.flatMap(node.children, x => {\n if (_.isString(x)) return allowedChild(x) ? x : [];\n const _node = elements.get(x)?.native;\n if (!_node) return childrenOfParent(x, allowedChild);\n if (!allowedChild(_node)) return [];\n return _node instanceof _ChildComponent ? children(x) : _node;\n });\n const children = (node: VNode): (string | T)[] => _.flatMap(node.children, x => {\n if (_.isString(x)) return x;\n const _node = elements.get(x)?.native;\n if (_node instanceof _ParentComponent) return childrenOfParent(x, c => _node.isChildNode(c));\n if (_node instanceof _ChildComponent) return children(x);\n return _node ?? children(x);\n });\n return children(node);\n };\n\n const commit = (elements: Map<VNode, { native?: T }>, force?: boolean) => {\n\n const _mount = (node: VNode, stack: VNode[]) => {\n for (const item of node.children) {\n if (item instanceof VNode) _mount(item, [...stack, node]);\n }\n const element = elements.get(node)?.native;\n if (element instanceof _ParentComponent || element instanceof _ChildComponent) return;\n if (element) {\n try {\n this._replaceChildren(node, element, resolveChildren(node, elements), stack, force);\n } catch (e) {\n console.error(e);\n }\n }\n const state: _State[] = [];\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 for (const [node, state] of mountState) {\n if (elements.has(node)) continue;\n for (const { unmount } of state) {\n try {\n unmount?.();\n } catch (e) {\n console.error(e);\n }\n }\n mountState.delete(node);\n }\n if (root) this._replaceChildren(\n runtime.node, root,\n _.castArray(elements.get(runtime.node)?.native ?? resolveChildren(runtime.node, elements)),\n [],\n force,\n );\n _mount(runtime.node, []);\n };\n\n const update = async (elements?: Map<VNode, { native?: T }>, force?: boolean) => {\n try {\n this._beforeUpdate();\n } catch (e) {\n console.error(e);\n }\n const map = new Map<VNode, { native?: T }>();\n for await (const { node, stack, updated } of runtime.excute()) {\n if (node.error) continue;\n if (_.isFunction(node.type) && !(node.type.prototype instanceof NativeElementType)) {\n map.set(node, {});\n } else if (_.isFunction(node.type) && (\n node.type.prototype instanceof _ParentComponent ||\n node.type.prototype instanceof _ChildComponent\n )) {\n let elem = elements?.get(node)?.native;\n if (!elem) {\n const Component = node.type as any;\n elem = new Component();\n }\n map.set(node, { native: elem });\n } else {\n try {\n if (updated) {\n let elem = elements?.get(node)?.native;\n if (elem) {\n this._updateElement(node, elem, stack);\n } else {\n elem = this._createElement(node, stack);\n }\n map.set(node, { native: elem });\n } else {\n map.set(node, { native: elements?.get(node)?.native ?? this._createElement(node, stack) });\n }\n } catch (e) {\n console.error(e);\n }\n }\n }\n commit(map, force);\n if (elements) {\n for (const [node, element] of elements) {\n if (map.has(node) || !element.native) continue;\n try {\n this._destroyElement(node, element.native);\n } catch (e) {\n console.error(e);\n }\n }\n }\n try {\n this._afterUpdate();\n } catch (e) {\n console.error(e);\n }\n return map;\n };\n\n let update_count = 0;\n let render_count = 0;\n let destroyed = false;\n let elements = await update(undefined, true);\n\n const listener = runtime.event.register('onchange', () => {\n if (render_count !== update_count++) return;\n nextick(async () => {\n while (render_count !== update_count) {\n if (destroyed) return;\n const current = update_count;\n elements = await update(elements, false);\n render_count = current;\n }\n });\n });\n\n return {\n get root() {\n if (root) return root;\n const elems = _.castArray(elements.get(runtime.node)?.native ?? resolveChildren(runtime.node, elements));\n const nodes = _.filter(elems, x => !_.isString(x)) as T[];\n return nodes.length === 1 ? nodes[0] : nodes;\n },\n destroy: () => {\n if (root) this._replaceChildren(runtime.node, root, [], [], true);\n destroyed = true;\n listener.remove();\n for (const state of mountState.values()) {\n for (const { unmount } of state) unmount?.();\n }\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 },\n ) => {\n state = await this._createRoot(root ?? null, component, options);\n },\n unmount: () => {\n state?.destroy();\n state = undefined;\n },\n };\n }\n}"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MAUsB,SAAS,CAAA;AAgBrB,IAAA,MAAM,WAAW,CACvB,IAAc,EACd,SAAwB,EACxB,OAEC,EAAA;QAGD,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC;AAQvD,QAAA,MAAM,UAAU,GAAG,IAAI,GAAG,EAAmB;AAE7C,QAAA,MAAM,eAAe,GAAG,CAAC,IAAW,EAAE,QAAoC,KAAI;AAC5E,YAAA,MAAM,gBAAgB,GAAG,CAAC,IAAW,EAAE,YAA2C,KAAqB,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAG;AAClI,gBAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AAAE,oBAAA,OAAO,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE;gBAClD,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM;AACrC,gBAAA,IAAI,CAAC,KAAK;AAAE,oBAAA,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QAAA,IAAI,KAA+D;QACnE,OAAO;AACL,YAAA,IAAI,IAAI,GAAA;gBACN,OAAO,KAAK,EAAE,IAAI;YACpB,CAAC;AACD,YAAA,KAAK,EAAE,OACL,SAAwB,EACxB,OAEC,KACC;AACF,gBAAA,KAAK,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC;YAClE,CAAC;YACD,OAAO,EAAE,MAAK;gBACZ,KAAK,EAAE,OAAO,EAAE;gBAChB,KAAK,GAAG,SAAS;YACnB,CAAC;SACF;IACH;AACD;;;;"}
@@ -33,20 +33,28 @@ class _Renderer {
33
33
  async _createRoot(root, component, options) {
34
34
  const runtime$1 = state.reconciler.buildVNodes(component, this);
35
35
  const mountState = new Map();
36
- const children = (node, elements) => {
37
- const _children = (node, allowedChild) => _.flatMap(node.children, x => {
36
+ const resolveChildren = (node, elements) => {
37
+ const childrenOfParent = (node, allowedChild) => _.flatMap(node.children, x => {
38
+ if (_.isString(x))
39
+ return allowedChild(x) ? x : [];
40
+ const _node = elements.get(x)?.native;
41
+ if (!_node)
42
+ return childrenOfParent(x, allowedChild);
43
+ if (!allowedChild(_node))
44
+ return [];
45
+ return _node instanceof state._ChildComponent ? children(x) : _node;
46
+ });
47
+ const children = (node) => _.flatMap(node.children, x => {
38
48
  if (_.isString(x))
39
49
  return x;
40
50
  const _node = elements.get(x)?.native;
41
- if (_node instanceof state._ParentComponent) {
42
- const c = _children(x, c => _node.isChildNode(c));
43
- return _.flatMap(c, x => x instanceof state.VNode ? _children(x) : _node.isChildNode(x) ? x : []);
44
- }
51
+ if (_node instanceof state._ParentComponent)
52
+ return childrenOfParent(x, c => _node.isChildNode(c));
45
53
  if (_node instanceof state._ChildComponent)
46
- return allowedChild?.(_node) ? x : _children(x, allowedChild);
47
- return _node ?? _children(x, allowedChild);
54
+ return children(x);
55
+ return _node ?? children(x);
48
56
  });
49
- return _children(node);
57
+ return children(node);
50
58
  };
51
59
  const commit = (elements, force) => {
52
60
  const _mount = (node, stack) => {
@@ -59,7 +67,7 @@ class _Renderer {
59
67
  return;
60
68
  if (element) {
61
69
  try {
62
- this._replaceChildren(node, element, children(node, elements), stack, force);
70
+ this._replaceChildren(node, element, resolveChildren(node, elements), stack, force);
63
71
  }
64
72
  catch (e) {
65
73
  console.error(e);
@@ -108,7 +116,7 @@ class _Renderer {
108
116
  mountState.delete(node);
109
117
  }
110
118
  if (root)
111
- this._replaceChildren(runtime$1.node, root, _.castArray(elements.get(runtime$1.node)?.native ?? children(runtime$1.node, elements)), [], force);
119
+ this._replaceChildren(runtime$1.node, root, _.castArray(elements.get(runtime$1.node)?.native ?? resolveChildren(runtime$1.node, elements)), [], force);
112
120
  _mount(runtime$1.node, []);
113
121
  };
114
122
  const update = async (elements, force) => {
@@ -197,7 +205,7 @@ class _Renderer {
197
205
  get root() {
198
206
  if (root)
199
207
  return root;
200
- const elems = _.castArray(elements.get(runtime$1.node)?.native ?? children(runtime$1.node, elements));
208
+ const elems = _.castArray(elements.get(runtime$1.node)?.native ?? resolveChildren(runtime$1.node, elements));
201
209
  const nodes = _.filter(elems, x => !_.isString(x));
202
210
  return nodes.length === 1 ? nodes[0] : nodes;
203
211
  },
@@ -231,4 +239,4 @@ class _Renderer {
231
239
  }
232
240
 
233
241
  exports._Renderer = _Renderer;
234
- //# sourceMappingURL=renderer-DMQqKE1j.js.map
242
+ //# sourceMappingURL=renderer-C5DRQlCe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer-C5DRQlCe.js","sources":["../../../src/core/renderer.ts"],"sourcesContent":["//\n// renderer.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { VNode } from './reconciler/vnode';\nimport { ComponentNode, NativeElementType } from './types/component';\nimport { reconciler } from './reconciler/state';\nimport nextick from 'nextick';\nimport { equalDeps } from './reconciler/utils';\nimport { _ChildComponent, _ParentComponent } from './components/pairs';\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, stack: VNode[]): T;\n\n protected abstract _updateElement(node: VNode, element: T, stack: VNode[]): void;\n\n protected abstract _destroyElement(node: VNode, element: T): void;\n\n protected abstract _replaceChildren(node: VNode, element: T, children: (T | string)[], stack: VNode[], force?: boolean): void;\n\n abstract get _server(): boolean;\n\n private async _createRoot(\n root: T | null,\n component: ComponentNode,\n options?: {\n skipMount?: boolean;\n },\n ) {\n\n const runtime = reconciler.buildVNodes(component, this);\n\n type _State = {\n hook: string;\n deps: any;\n unmount?: () => void;\n };\n\n const mountState = new Map<VNode, _State[]>();\n\n const resolveChildren = (node: VNode, elements: Map<VNode, { native?: T }>) => {\n const childrenOfParent = (node: VNode, allowedChild: (node: string | T) => boolean): (string | T)[] => _.flatMap(node.children, x => {\n if (_.isString(x)) return allowedChild(x) ? x : [];\n const _node = elements.get(x)?.native;\n if (!_node) return childrenOfParent(x, allowedChild);\n if (!allowedChild(_node)) return [];\n return _node instanceof _ChildComponent ? children(x) : _node;\n });\n const children = (node: VNode): (string | T)[] => _.flatMap(node.children, x => {\n if (_.isString(x)) return x;\n const _node = elements.get(x)?.native;\n if (_node instanceof _ParentComponent) return childrenOfParent(x, c => _node.isChildNode(c));\n if (_node instanceof _ChildComponent) return children(x);\n return _node ?? children(x);\n });\n return children(node);\n };\n\n const commit = (elements: Map<VNode, { native?: T }>, force?: boolean) => {\n\n const _mount = (node: VNode, stack: VNode[]) => {\n for (const item of node.children) {\n if (item instanceof VNode) _mount(item, [...stack, node]);\n }\n const element = elements.get(node)?.native;\n if (element instanceof _ParentComponent || element instanceof _ChildComponent) return;\n if (element) {\n try {\n this._replaceChildren(node, element, resolveChildren(node, elements), stack, force);\n } catch (e) {\n console.error(e);\n }\n }\n const state: _State[] = [];\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 for (const [node, state] of mountState) {\n if (elements.has(node)) continue;\n for (const { unmount } of state) {\n try {\n unmount?.();\n } catch (e) {\n console.error(e);\n }\n }\n mountState.delete(node);\n }\n if (root) this._replaceChildren(\n runtime.node, root,\n _.castArray(elements.get(runtime.node)?.native ?? resolveChildren(runtime.node, elements)),\n [],\n force,\n );\n _mount(runtime.node, []);\n };\n\n const update = async (elements?: Map<VNode, { native?: T }>, force?: boolean) => {\n try {\n this._beforeUpdate();\n } catch (e) {\n console.error(e);\n }\n const map = new Map<VNode, { native?: T }>();\n for await (const { node, stack, updated } of runtime.excute()) {\n if (node.error) continue;\n if (_.isFunction(node.type) && !(node.type.prototype instanceof NativeElementType)) {\n map.set(node, {});\n } else if (_.isFunction(node.type) && (\n node.type.prototype instanceof _ParentComponent ||\n node.type.prototype instanceof _ChildComponent\n )) {\n let elem = elements?.get(node)?.native;\n if (!elem) {\n const Component = node.type as any;\n elem = new Component();\n }\n map.set(node, { native: elem });\n } else {\n try {\n if (updated) {\n let elem = elements?.get(node)?.native;\n if (elem) {\n this._updateElement(node, elem, stack);\n } else {\n elem = this._createElement(node, stack);\n }\n map.set(node, { native: elem });\n } else {\n map.set(node, { native: elements?.get(node)?.native ?? this._createElement(node, stack) });\n }\n } catch (e) {\n console.error(e);\n }\n }\n }\n commit(map, force);\n if (elements) {\n for (const [node, element] of elements) {\n if (map.has(node) || !element.native) continue;\n try {\n this._destroyElement(node, element.native);\n } catch (e) {\n console.error(e);\n }\n }\n }\n try {\n this._afterUpdate();\n } catch (e) {\n console.error(e);\n }\n return map;\n };\n\n let update_count = 0;\n let render_count = 0;\n let destroyed = false;\n let elements = await update(undefined, true);\n\n const listener = runtime.event.register('onchange', () => {\n if (render_count !== update_count++) return;\n nextick(async () => {\n while (render_count !== update_count) {\n if (destroyed) return;\n const current = update_count;\n elements = await update(elements, false);\n render_count = current;\n }\n });\n });\n\n return {\n get root() {\n if (root) return root;\n const elems = _.castArray(elements.get(runtime.node)?.native ?? resolveChildren(runtime.node, elements));\n const nodes = _.filter(elems, x => !_.isString(x)) as T[];\n return nodes.length === 1 ? nodes[0] : nodes;\n },\n destroy: () => {\n if (root) this._replaceChildren(runtime.node, root, [], [], true);\n destroyed = true;\n listener.remove();\n for (const state of mountState.values()) {\n for (const { unmount } of state) unmount?.();\n }\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 },\n ) => {\n state = await this._createRoot(root ?? null, component, options);\n },\n unmount: () => {\n state?.destroy();\n state = undefined;\n },\n };\n }\n}"],"names":["runtime","reconciler","_ChildComponent","_ParentComponent","VNode","state","equalDeps","NativeElementType"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MAUsB,SAAS,CAAA;AAgBrB,IAAA,MAAM,WAAW,CACvB,IAAc,EACd,SAAwB,EACxB,OAEC,EAAA;QAGD,MAAMA,SAAO,GAAGC,gBAAU,CAAC,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC;AAQvD,QAAA,MAAM,UAAU,GAAG,IAAI,GAAG,EAAmB;AAE7C,QAAA,MAAM,eAAe,GAAG,CAAC,IAAW,EAAE,QAAoC,KAAI;AAC5E,YAAA,MAAM,gBAAgB,GAAG,CAAC,IAAW,EAAE,YAA2C,KAAqB,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAG;AAClI,gBAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AAAE,oBAAA,OAAO,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE;gBAClD,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM;AACrC,gBAAA,IAAI,CAAC,KAAK;AAAE,oBAAA,OAAO,gBAAgB,CAAC,CAAC,EAAE,YAAY,CAAC;AACpD,gBAAA,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;AAAE,oBAAA,OAAO,EAAE;AACnC,gBAAA,OAAO,KAAK,YAAYC,qBAAe,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK;AAC/D,YAAA,CAAC,CAAC;AACF,YAAA,MAAM,QAAQ,GAAG,CAAC,IAAW,K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AO,CAAC;YAClE,CAAC;YACD,OAAO,EAAE,MAAK;gBACZ,KAAK,EAAE,OAAO,EAAE;gBAChB,KAAK,GAAG,SAAS;YACnB,CAAC;SACF;IACH;AACD;;;;"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var _ = require('lodash');
4
- var renderer = require('./renderer-DMQqKE1j.js');
4
+ var renderer = require('./renderer-C5DRQlCe.js');
5
5
  var postcss = require('postcss');
6
6
  var postcssJs = require('postcss-js');
7
7
  var nested = require('postcss-nested');
@@ -4397,4 +4397,4 @@ class _DOMRenderer extends renderer._Renderer {
4397
4397
 
4398
4398
  exports.DOMNativeNode = DOMNativeNode;
4399
4399
  exports._DOMRenderer = _DOMRenderer;
4400
- //# sourceMappingURL=renderer-D1z5QGPB.js.map
4400
+ //# sourceMappingURL=renderer-D5VWxoFX.js.map