frosty 0.0.36 → 0.0.38
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.d.ts +3 -3
- package/dist/_native.js +5 -4
- package/dist/_native.js.map +1 -1
- package/dist/_native.mjs +4 -4
- package/dist/dom.d.ts +4 -3
- package/dist/dom.js +4 -6
- package/dist/dom.js.map +1 -1
- package/dist/dom.mjs +4 -6
- package/dist/dom.mjs.map +1 -1
- package/dist/index.d.ts +5 -50
- package/dist/index.js +109 -77
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +99 -62
- package/dist/index.mjs.map +1 -1
- package/dist/internals/{common-BOZ7LFsB.mjs → common-CFQAs-2w.mjs} +10 -6
- package/dist/internals/{common-BOZ7LFsB.mjs.map → common-CFQAs-2w.mjs.map} +1 -1
- package/dist/internals/{common-oNHXt-X6.d.ts → common-CUIKizze.d.ts} +6 -6
- package/dist/internals/common-CUIKizze.d.ts.map +1 -0
- package/dist/internals/{common-CjVBgVnj.js → common-P_QiOxQQ.js} +11 -7
- package/dist/internals/{common-CjVBgVnj.js.map → common-P_QiOxQQ.js.map} +1 -1
- package/dist/internals/{common-BLDQwvsd.d.ts → common-k6qbeyHu.d.ts} +7 -4
- package/dist/internals/common-k6qbeyHu.d.ts.map +1 -0
- package/dist/internals/{runtime-PKOt40BM.js → component-BiP3XIPe.js} +1 -33
- package/dist/internals/component-BiP3XIPe.js.map +1 -0
- package/dist/internals/{runtime-DrGYUphO.mjs → component-BzurKp_J.mjs} +2 -32
- package/dist/internals/component-BzurKp_J.mjs.map +1 -0
- package/dist/internals/{fragment-BkyAEmoa.d.ts → fragment-50WCFjrW.d.ts} +2 -2
- package/dist/internals/fragment-50WCFjrW.d.ts.map +1 -0
- package/dist/internals/{renderer-BIGBfQIc.mjs → renderer-ClDlweEF.mjs} +3 -3
- package/dist/internals/{renderer-BIGBfQIc.mjs.map → renderer-ClDlweEF.mjs.map} +1 -1
- package/dist/internals/{renderer-Bmw8wKAf.d.ts → renderer-DPoACdip.d.ts} +2 -2
- package/dist/internals/renderer-DPoACdip.d.ts.map +1 -0
- package/dist/internals/{renderer-Ds5Glygc.js → renderer-a9zN1_RB.js} +12 -12
- package/dist/internals/{renderer-Ds5Glygc.js.map → renderer-a9zN1_RB.js.map} +1 -1
- package/dist/internals/runtime-DCKT7fd6.js +37 -0
- package/dist/internals/runtime-DCKT7fd6.js.map +1 -0
- package/dist/internals/runtime-DK28Kyy2.mjs +34 -0
- package/dist/internals/runtime-DK28Kyy2.mjs.map +1 -0
- package/dist/internals/{state-CK2bzUOk.mjs → state-5PNx91ec.mjs} +3 -3
- package/dist/internals/{state-CK2bzUOk.mjs.map → state-5PNx91ec.mjs.map} +1 -1
- package/dist/internals/{state-CKAt_mTM.js → state-Lf_tbWNd.js} +4 -4
- package/dist/internals/{state-CKAt_mTM.js.map → state-Lf_tbWNd.js.map} +1 -1
- package/dist/internals/{sync-CyAho2g-.mjs → sync-C4RmxDzS.mjs} +99 -4
- package/dist/internals/sync-C4RmxDzS.mjs.map +1 -0
- package/dist/internals/{sync-w9XkAX8E.js → sync-e3464vDv.js} +105 -7
- package/dist/internals/sync-e3464vDv.js.map +1 -0
- package/dist/internals/{utils--X3fYqdu.d.ts → utils-DWp2-G3N.d.ts} +2 -2
- package/dist/internals/utils-DWp2-G3N.d.ts.map +1 -0
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/jsx-runtime.js +3 -2
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/jsx-runtime.mjs +2 -1
- package/dist/jsx-runtime.mjs.map +1 -1
- package/dist/server-dom.d.ts +3 -3
- package/dist/server-dom.js +5 -7
- package/dist/server-dom.js.map +1 -1
- package/dist/server-dom.mjs +5 -7
- package/dist/server-dom.mjs.map +1 -1
- package/dist/web.d.ts +7 -5
- package/dist/web.js +18 -8
- package/dist/web.js.map +1 -1
- package/dist/web.mjs +18 -9
- package/dist/web.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/internals/common-BLDQwvsd.d.ts.map +0 -1
- package/dist/internals/common-oNHXt-X6.d.ts.map +0 -1
- package/dist/internals/error-BT7hiUUR.mjs +0 -193
- package/dist/internals/error-BT7hiUUR.mjs.map +0 -1
- package/dist/internals/error-Cbb2rheX.js +0 -201
- package/dist/internals/error-Cbb2rheX.js.map +0 -1
- package/dist/internals/fragment-BkyAEmoa.d.ts.map +0 -1
- package/dist/internals/renderer-Bmw8wKAf.d.ts.map +0 -1
- package/dist/internals/runtime-DrGYUphO.mjs.map +0 -1
- package/dist/internals/runtime-PKOt40BM.js.map +0 -1
- package/dist/internals/sync-CyAho2g-.mjs.map +0 -1
- package/dist/internals/sync-w9XkAX8E.js.map +0 -1
- package/dist/internals/utils--X3fYqdu.d.ts.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { N as NativeElementType, b as ComponentNode } from './common-
|
|
2
|
-
import { _ as _Renderer } from './renderer-
|
|
1
|
+
import { N as NativeElementType, b as ComponentNode } from './common-CUIKizze.js';
|
|
2
|
+
import { _ as _Renderer } from './renderer-DPoACdip.js';
|
|
3
|
+
import { DOMWindow } from 'jsdom';
|
|
3
4
|
|
|
4
5
|
declare abstract class DOMNativeNode extends NativeElementType {
|
|
5
6
|
static createElement: (doc: Document, renderer: _DOMRenderer) => DOMNativeNode;
|
|
@@ -13,14 +14,16 @@ declare abstract class DOMNativeNode extends NativeElementType {
|
|
|
13
14
|
}
|
|
14
15
|
declare abstract class _DOMRenderer extends _Renderer<Element | DOMNativeNode> {
|
|
15
16
|
private _doc?;
|
|
17
|
+
private _window?;
|
|
16
18
|
private _namespace_map;
|
|
17
19
|
private _tracked_props;
|
|
18
20
|
private _tracked_listener;
|
|
19
21
|
private _tracked_head_children;
|
|
20
22
|
private _tracked_style;
|
|
21
23
|
private _tracked_style_names;
|
|
22
|
-
constructor(doc?: Document);
|
|
24
|
+
constructor(doc?: Document, window?: Window | DOMWindow);
|
|
23
25
|
get doc(): Document;
|
|
26
|
+
get window(): Window | DOMWindow;
|
|
24
27
|
private __createBuiltClassName;
|
|
25
28
|
private __updateEventListener;
|
|
26
29
|
__replaceChildren(element: Element, children: (string | Element | DOMNativeNode)[]): void;
|
|
@@ -28,4 +31,4 @@ declare abstract class _DOMRenderer extends _Renderer<Element | DOMNativeNode> {
|
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
export { DOMNativeNode as D, _DOMRenderer as _ };
|
|
31
|
-
//# sourceMappingURL=common-
|
|
34
|
+
//# sourceMappingURL=common-k6qbeyHu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-k6qbeyHu.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -56,38 +56,6 @@ class ComponentNode {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
//
|
|
60
|
-
// basic.ts
|
|
61
|
-
//
|
|
62
|
-
// The MIT License
|
|
63
|
-
// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
|
|
64
|
-
//
|
|
65
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
66
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
67
|
-
// in the Software without restriction, including without limitation the rights
|
|
68
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
69
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
70
|
-
// furnished to do so, subject to the following conditions:
|
|
71
|
-
//
|
|
72
|
-
// The above copyright notice and this permission notice shall be included in
|
|
73
|
-
// all copies or substantial portions of the Software.
|
|
74
|
-
//
|
|
75
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
76
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
77
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
78
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
79
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
80
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
81
|
-
// THE SOFTWARE.
|
|
82
|
-
//
|
|
83
|
-
const _createElement = (type, props) => {
|
|
84
|
-
const { key, ..._props } = props;
|
|
85
|
-
return new ComponentNode(type, _props, key);
|
|
86
|
-
};
|
|
87
|
-
const createElement = (type, props, ...children) => _createElement(type, { ...props ?? {}, children });
|
|
88
|
-
|
|
89
59
|
exports.ComponentNode = ComponentNode;
|
|
90
60
|
exports.NativeElementType = NativeElementType;
|
|
91
|
-
|
|
92
|
-
exports.createElement = createElement;
|
|
93
|
-
//# sourceMappingURL=runtime-PKOt40BM.js.map
|
|
61
|
+
//# sourceMappingURL=component-BiP3XIPe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-BiP3XIPe.js","sources":["../../../src/core/types/component.ts"],"sourcesContent":["//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _ElementType, PropsType } from './runtime';\n\nexport abstract class NativeElementType {\n constructor(...args: any[]) { };\n}\n\nexport class ComponentNode {\n\n /** @internal */\n private _type: _ElementType | typeof NativeElementType;\n\n /** @internal */\n private _props: PropsType;\n\n /** @internal */\n private _key?: string | number;\n\n /** @internal */\n constructor(\n type: _ElementType | typeof NativeElementType,\n props: PropsType,\n key?: string | number\n ) {\n this._type = type;\n this._props = props;\n this._key = key;\n }\n\n get type() {\n return this._type;\n }\n\n get props() {\n return this._props;\n }\n\n get key() {\n return this._key;\n }\n\n /** @internal */\n _equal(other: ComponentNode) {\n return this.type === other.type && this.key === other.key;\n }\n}\n"],"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;MAKsB,iBAAiB,CAAA;IACrC,WAAY,CAAA,GAAG,IAAW,EAAA;;AAC3B;MAEY,aAAa,CAAA;;AAGhB,IAAA,KAAK;;AAGL,IAAA,MAAM;;AAGN,IAAA,IAAI;;AAGZ,IAAA,WAAA,CACE,IAA6C,EAC7C,KAAgB,EAChB,GAAqB,EAAA;AAErB,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI;AACjB,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK;AACnB,QAAA,IAAI,CAAC,IAAI,GAAG,GAAG;;AAGjB,IAAA,IAAI,IAAI,GAAA;QACN,OAAO,IAAI,CAAC,KAAK;;AAGnB,IAAA,IAAI,KAAK,GAAA;QACP,OAAO,IAAI,CAAC,MAAM;;AAGpB,IAAA,IAAI,GAAG,GAAA;QACL,OAAO,IAAI,CAAC,IAAI;;;AAIlB,IAAA,MAAM,CAAC,KAAoB,EAAA;AACzB,QAAA,OAAO,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG;;AAE5D;;;;;"}
|
|
@@ -54,35 +54,5 @@ class ComponentNode {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
//
|
|
60
|
-
// The MIT License
|
|
61
|
-
// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
|
|
62
|
-
//
|
|
63
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
64
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
65
|
-
// in the Software without restriction, including without limitation the rights
|
|
66
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
67
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
68
|
-
// furnished to do so, subject to the following conditions:
|
|
69
|
-
//
|
|
70
|
-
// The above copyright notice and this permission notice shall be included in
|
|
71
|
-
// all copies or substantial portions of the Software.
|
|
72
|
-
//
|
|
73
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
74
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
75
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
76
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
77
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
78
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
79
|
-
// THE SOFTWARE.
|
|
80
|
-
//
|
|
81
|
-
const _createElement = (type, props) => {
|
|
82
|
-
const { key, ..._props } = props;
|
|
83
|
-
return new ComponentNode(type, _props, key);
|
|
84
|
-
};
|
|
85
|
-
const createElement = (type, props, ...children) => _createElement(type, { ...props ?? {}, children });
|
|
86
|
-
|
|
87
|
-
export { ComponentNode as C, NativeElementType as N, _createElement as _, createElement as c };
|
|
88
|
-
//# sourceMappingURL=runtime-DrGYUphO.mjs.map
|
|
57
|
+
export { ComponentNode as C, NativeElementType as N };
|
|
58
|
+
//# sourceMappingURL=component-BzurKp_J.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-BzurKp_J.mjs","sources":["../../../src/core/types/component.ts"],"sourcesContent":["//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _ElementType, PropsType } from './runtime';\n\nexport abstract class NativeElementType {\n constructor(...args: any[]) { };\n}\n\nexport class ComponentNode {\n\n /** @internal */\n private _type: _ElementType | typeof NativeElementType;\n\n /** @internal */\n private _props: PropsType;\n\n /** @internal */\n private _key?: string | number;\n\n /** @internal */\n constructor(\n type: _ElementType | typeof NativeElementType,\n props: PropsType,\n key?: string | number\n ) {\n this._type = type;\n this._props = props;\n this._key = key;\n }\n\n get type() {\n return this._type;\n }\n\n get props() {\n return this._props;\n }\n\n get key() {\n return this._key;\n }\n\n /** @internal */\n _equal(other: ComponentNode) {\n return this.type === other.type && this.key === other.key;\n }\n}\n"],"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;MAKsB,iBAAiB,CAAA;IACrC,WAAY,CAAA,GAAG,IAAW,EAAA;;AAC3B;MAEY,aAAa,CAAA;;AAGhB,IAAA,KAAK;;AAGL,IAAA,MAAM;;AAGN,IAAA,IAAI;;AAGZ,IAAA,WAAA,CACE,IAA6C,EAC7C,KAAgB,EAChB,GAAqB,EAAA;AAErB,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI;AACjB,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK;AACnB,QAAA,IAAI,CAAC,IAAI,GAAG,GAAG;;AAGjB,IAAA,IAAI,IAAI,GAAA;QACN,OAAO,IAAI,CAAC,KAAK;;AAGnB,IAAA,IAAI,KAAK,GAAA;QACP,OAAO,IAAI,CAAC,MAAM;;AAGpB,IAAA,IAAI,GAAG,GAAA;QACL,OAAO,IAAI,CAAC,IAAI;;;AAIlB,IAAA,MAAM,CAAC,KAAoB,EAAA;AACzB,QAAA,OAAO,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG;;AAE5D;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as ComponentType, P as PropsWithChildren } from './common-
|
|
1
|
+
import { C as ComponentType, P as PropsWithChildren } from './common-CUIKizze.js';
|
|
2
2
|
|
|
3
3
|
declare const Fragment: ComponentType<PropsWithChildren<{}>>;
|
|
4
4
|
|
|
5
5
|
export { Fragment as F };
|
|
6
|
-
//# sourceMappingURL=fragment-
|
|
6
|
+
//# sourceMappingURL=fragment-50WCFjrW.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fragment-50WCFjrW.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
-
import { r as reconciler, V as VNode, e as equalDeps } from './state-
|
|
3
|
-
import { N as NativeElementType } from './
|
|
2
|
+
import { r as reconciler, V as VNode, e as equalDeps } from './state-5PNx91ec.mjs';
|
|
3
|
+
import { N as NativeElementType } from './component-BzurKp_J.mjs';
|
|
4
4
|
import nextick from 'nextick';
|
|
5
5
|
|
|
6
6
|
//
|
|
@@ -158,4 +158,4 @@ class _Renderer {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
export { _Renderer as _ };
|
|
161
|
-
//# sourceMappingURL=renderer-
|
|
161
|
+
//# sourceMappingURL=renderer-ClDlweEF.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer-BIGBfQIc.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';\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)[]): void;\n\n abstract get _server(): boolean;\n\n private _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 }>): (string | T)[] => {\n return _.flatMap(node.children, x => _.isString(x) ? x : elements.get(x)?.native ?? children(x, elements));\n };\n\n const commit = (elements: Map<VNode, { native?: T }>) => {\n\n const _mount = (\n node: VNode,\n ) => {\n const element = elements.get(node)?.native;\n if (element) {\n this._replaceChildren(node, element, children(node, elements));\n }\n for (const item of node.children) {\n if (item instanceof VNode) _mount(item);\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) unmount();\n state.push({\n hook: curState[i].hook,\n deps: curState[i].deps,\n unmount: options?.skipMount || !changed ? prevState[i]?.unmount : curState[i].mount?.(),\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) unmount?.();\n mountState.delete(node);\n }\n if (root) this._replaceChildren(runtime.node, root, _.castArray(elements.get(runtime.node)?.native ?? children(runtime.node, elements)));\n _mount(runtime.node);\n };\n\n const update = (elements?: Map<VNode, { native?: T }>) => {\n this._beforeUpdate();\n const map = new Map<VNode, { native?: T }>();\n for (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 continue;\n }\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 }\n commit(map);\n if (elements) {\n for (const [node, element] of elements) {\n if (map.has(node) || !element.native) continue;\n this._destroyElement(node, element.native);\n }\n }\n this._afterUpdate();\n return map;\n };\n\n let update_count = 0;\n let render_count = 0;\n let destroyed = false;\n let elements = update();\n\n const listener = runtime.event.register('onchange', () => {\n if (render_count !== update_count++) return;\n nextick(() => {\n if (destroyed) return;\n render_count = update_count;\n elements = update(elements);\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, []);\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: ReturnType<typeof this._createRoot> | undefined;\n return {\n get root() {\n return state?.root;\n },\n mount: (\n component: ComponentNode,\n options?: {\n skipMount?: boolean;\n },\n ) => {\n state = 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;MASsB,SAAS,CAAA;AAgBrB,IAAA,WAAW,CACjB,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,QAAQ,GAAG,CAAC,IAAW,EAAE,QAAoC,KAAoB;AACrF,YAAA,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AAC5G,SAAC;AAED,QAAA,MAAM,MAAM,GAAG,CAAC,QAAoC,KAAI;AAEtD,YAAA,MAAM,MAAM,GAAG,CACb,IAAW,KACT;gBACF,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM;gBAC1C,IAAI,OAAO,EAAE;AACX,oBAAA,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;;AAEhE,gBAAA,KAAK,MAAM,I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AQ,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;gBACjG,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAQ;AACzD,gBAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK;aAC7C;YACD,OAAO,EAAE,MAAK;AACZ,gBAAA,IAAI,IAAI;oBAAE,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;gBACvD,SAAS,GAAG,IAAI;gBAChB,QAAQ,CAAC,MAAM,EAAE;gBACjB,KAAK,MAAM,KAAK,IAAI,UAAU,CAAC,MAAM,EAAE,EAAE;AACvC,oBAAA,KAAK,MAAM,EAAE,OAAO,EAAE,IAAI,KAAK;wBAAE,OAAO,IAAI;;aAE/C;SACF;;AAGH,IAAA,UAAU,CAAC,IAAQ,EAAA;AACjB,QAAA,IAAI,KAAsD;QAC1D,OAAO;AACL,YAAA,IAAI,IAAI,GAAA;gBACN,OAAO,KAAK,EAAE,IAAI;aACnB;AACD,YAAA,KAAK,EAAE,CACL,SAAwB,EACxB,OAEC,KACC;AACF,gBAAA,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC;aAC3D;YACD,OAAO,EAAE,MAAK;gBACZ,KAAK,EAAE,OAAO,EAAE;gBAChB,KAAK,GAAG,SAAS;aAClB;SACF;;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"renderer-ClDlweEF.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';\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)[]): void;\n\n abstract get _server(): boolean;\n\n private _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 }>): (string | T)[] => {\n return _.flatMap(node.children, x => _.isString(x) ? x : elements.get(x)?.native ?? children(x, elements));\n };\n\n const commit = (elements: Map<VNode, { native?: T }>) => {\n\n const _mount = (\n node: VNode,\n ) => {\n const element = elements.get(node)?.native;\n if (element) {\n this._replaceChildren(node, element, children(node, elements));\n }\n for (const item of node.children) {\n if (item instanceof VNode) _mount(item);\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) unmount();\n state.push({\n hook: curState[i].hook,\n deps: curState[i].deps,\n unmount: options?.skipMount || !changed ? prevState[i]?.unmount : curState[i].mount?.(),\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) unmount?.();\n mountState.delete(node);\n }\n if (root) this._replaceChildren(runtime.node, root, _.castArray(elements.get(runtime.node)?.native ?? children(runtime.node, elements)));\n _mount(runtime.node);\n };\n\n const update = (elements?: Map<VNode, { native?: T }>) => {\n this._beforeUpdate();\n const map = new Map<VNode, { native?: T }>();\n for (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 continue;\n }\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 }\n commit(map);\n if (elements) {\n for (const [node, element] of elements) {\n if (map.has(node) || !element.native) continue;\n this._destroyElement(node, element.native);\n }\n }\n this._afterUpdate();\n return map;\n };\n\n let update_count = 0;\n let render_count = 0;\n let destroyed = false;\n let elements = update();\n\n const listener = runtime.event.register('onchange', () => {\n if (render_count !== update_count++) return;\n nextick(() => {\n if (destroyed) return;\n render_count = update_count;\n elements = update(elements);\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, []);\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: ReturnType<typeof this._createRoot> | undefined;\n return {\n get root() {\n return state?.root;\n },\n mount: (\n component: ComponentNode,\n options?: {\n skipMount?: boolean;\n },\n ) => {\n state = 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;MASsB,SAAS,CAAA;AAgBrB,IAAA,WAAW,CACjB,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,QAAQ,GAAG,CAAC,IAAW,EAAE,QAAoC,KAAoB;AACrF,YAAA,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AAC5G,SAAC;AAED,QAAA,MAAM,MAAM,GAAG,CAAC,QAAoC,KAAI;AAEtD,YAAA,MAAM,MAAM,GAAG,CACb,IAAW,KACT;gBACF,MA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EJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as _ElementType, N as NativeElementType, c as PropsType, b as ComponentNode } from './common-
|
|
1
|
+
import { _ as _ElementType, N as NativeElementType, c as PropsType, b as ComponentNode } from './common-CUIKizze.js';
|
|
2
2
|
|
|
3
3
|
type VNodeState = {
|
|
4
4
|
hook: string;
|
|
@@ -44,4 +44,4 @@ declare abstract class _Renderer<T> {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export { VNode as V, _Renderer as _ };
|
|
47
|
-
//# sourceMappingURL=renderer-
|
|
47
|
+
//# sourceMappingURL=renderer-DPoACdip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer-DPoACdip.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _ = require('lodash');
|
|
4
|
-
var state = require('./state-
|
|
5
|
-
var
|
|
4
|
+
var state = require('./state-Lf_tbWNd.js');
|
|
5
|
+
var component = require('./component-BiP3XIPe.js');
|
|
6
6
|
var nextick = require('nextick');
|
|
7
7
|
|
|
8
8
|
//
|
|
@@ -30,8 +30,8 @@ var nextick = require('nextick');
|
|
|
30
30
|
// THE SOFTWARE.
|
|
31
31
|
//
|
|
32
32
|
class _Renderer {
|
|
33
|
-
_createRoot(root, component, options) {
|
|
34
|
-
const runtime
|
|
33
|
+
_createRoot(root, component$1, options) {
|
|
34
|
+
const runtime = state.reconciler.buildVNodes(component$1, this);
|
|
35
35
|
const mountState = new Map();
|
|
36
36
|
const children = (node, elements) => {
|
|
37
37
|
return _.flatMap(node.children, x => _.isString(x) ? x : elements.get(x)?.native ?? children(x, elements));
|
|
@@ -70,16 +70,16 @@ class _Renderer {
|
|
|
70
70
|
mountState.delete(node);
|
|
71
71
|
}
|
|
72
72
|
if (root)
|
|
73
|
-
this._replaceChildren(runtime
|
|
74
|
-
_mount(runtime
|
|
73
|
+
this._replaceChildren(runtime.node, root, _.castArray(elements.get(runtime.node)?.native ?? children(runtime.node, elements)));
|
|
74
|
+
_mount(runtime.node);
|
|
75
75
|
};
|
|
76
76
|
const update = (elements) => {
|
|
77
77
|
this._beforeUpdate();
|
|
78
78
|
const map = new Map();
|
|
79
|
-
for (const { node, stack, updated } of runtime
|
|
79
|
+
for (const { node, stack, updated } of runtime.excute()) {
|
|
80
80
|
if (node.error)
|
|
81
81
|
continue;
|
|
82
|
-
if (_.isFunction(node.type) && !(node.type.prototype instanceof
|
|
82
|
+
if (_.isFunction(node.type) && !(node.type.prototype instanceof component.NativeElementType)) {
|
|
83
83
|
map.set(node, {});
|
|
84
84
|
continue;
|
|
85
85
|
}
|
|
@@ -112,7 +112,7 @@ class _Renderer {
|
|
|
112
112
|
let render_count = 0;
|
|
113
113
|
let destroyed = false;
|
|
114
114
|
let elements = update();
|
|
115
|
-
const listener = runtime
|
|
115
|
+
const listener = runtime.event.register('onchange', () => {
|
|
116
116
|
if (render_count !== update_count++)
|
|
117
117
|
return;
|
|
118
118
|
nextick(() => {
|
|
@@ -126,13 +126,13 @@ class _Renderer {
|
|
|
126
126
|
get root() {
|
|
127
127
|
if (root)
|
|
128
128
|
return root;
|
|
129
|
-
const elems = _.castArray(elements.get(runtime
|
|
129
|
+
const elems = _.castArray(elements.get(runtime.node)?.native ?? children(runtime.node, elements));
|
|
130
130
|
const nodes = _.filter(elems, x => !_.isString(x));
|
|
131
131
|
return nodes.length === 1 ? nodes[0] : nodes;
|
|
132
132
|
},
|
|
133
133
|
destroy: () => {
|
|
134
134
|
if (root)
|
|
135
|
-
this._replaceChildren(runtime
|
|
135
|
+
this._replaceChildren(runtime.node, root, []);
|
|
136
136
|
destroyed = true;
|
|
137
137
|
listener.remove();
|
|
138
138
|
for (const state of mountState.values()) {
|
|
@@ -160,4 +160,4 @@ class _Renderer {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
exports._Renderer = _Renderer;
|
|
163
|
-
//# sourceMappingURL=renderer-
|
|
163
|
+
//# sourceMappingURL=renderer-a9zN1_RB.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer-Ds5Glygc.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';\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)[]): void;\n\n abstract get _server(): boolean;\n\n private _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 }>): (string | T)[] => {\n return _.flatMap(node.children, x => _.isString(x) ? x : elements.get(x)?.native ?? children(x, elements));\n };\n\n const commit = (elements: Map<VNode, { native?: T }>) => {\n\n const _mount = (\n node: VNode,\n ) => {\n const element = elements.get(node)?.native;\n if (element) {\n this._replaceChildren(node, element, children(node, elements));\n }\n for (const item of node.children) {\n if (item instanceof VNode) _mount(item);\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) unmount();\n state.push({\n hook: curState[i].hook,\n deps: curState[i].deps,\n unmount: options?.skipMount || !changed ? prevState[i]?.unmount : curState[i].mount?.(),\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) unmount?.();\n mountState.delete(node);\n }\n if (root) this._replaceChildren(runtime.node, root, _.castArray(elements.get(runtime.node)?.native ?? children(runtime.node, elements)));\n _mount(runtime.node);\n };\n\n const update = (elements?: Map<VNode, { native?: T }>) => {\n this._beforeUpdate();\n const map = new Map<VNode, { native?: T }>();\n for (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 continue;\n }\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 }\n commit(map);\n if (elements) {\n for (const [node, element] of elements) {\n if (map.has(node) || !element.native) continue;\n this._destroyElement(node, element.native);\n }\n }\n this._afterUpdate();\n return map;\n };\n\n let update_count = 0;\n let render_count = 0;\n let destroyed = false;\n let elements = update();\n\n const listener = runtime.event.register('onchange', () => {\n if (render_count !== update_count++) return;\n nextick(() => {\n if (destroyed) return;\n render_count = update_count;\n elements = update(elements);\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, []);\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: ReturnType<typeof this._createRoot> | undefined;\n return {\n get root() {\n return state?.root;\n },\n mount: (\n component: ComponentNode,\n options?: {\n skipMount?: boolean;\n },\n ) => {\n state = this._createRoot(root ?? null, component, options);\n },\n unmount: () => {\n state?.destroy();\n state = undefined;\n },\n };\n }\n}"],"names":["runtime","reconciler","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;MASsB,SAAS,CAAA;AAgBrB,IAAA,WAAW,CACjB,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,QAAQ,GAAG,CAAC,IAAW,EAAE,QAAoC,K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IAAQ,EAAA;AACjB,QAAA,IAAI,KAAsD;QAC1D,OAAO;AACL,YAAA,IAAI,IAAI,GAAA;gBACN,OAAO,KAAK,EAAE,IAAI;aACnB;AACD,YAAA,KAAK,EAAE,CACL,SAAwB,EACxB,OAEC,KACC;AACF,gBAAA,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC;aAC3D;YACD,OAAO,EAAE,MAAK;gBACZ,KAAK,EAAE,OAAO,EAAE;gBAChB,KAAK,GAAG,SAAS;aAClB;SACF;;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"renderer-a9zN1_RB.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';\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)[]): void;\n\n abstract get _server(): boolean;\n\n private _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 }>): (string | T)[] => {\n return _.flatMap(node.children, x => _.isString(x) ? x : elements.get(x)?.native ?? children(x, elements));\n };\n\n const commit = (elements: Map<VNode, { native?: T }>) => {\n\n const _mount = (\n node: VNode,\n ) => {\n const element = elements.get(node)?.native;\n if (element) {\n this._replaceChildren(node, element, children(node, elements));\n }\n for (const item of node.children) {\n if (item instanceof VNode) _mount(item);\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) unmount();\n state.push({\n hook: curState[i].hook,\n deps: curState[i].deps,\n unmount: options?.skipMount || !changed ? prevState[i]?.unmount : curState[i].mount?.(),\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) unmount?.();\n mountState.delete(node);\n }\n if (root) this._replaceChildren(runtime.node, root, _.castArray(elements.get(runtime.node)?.native ?? children(runtime.node, elements)));\n _mount(runtime.node);\n };\n\n const update = (elements?: Map<VNode, { native?: T }>) => {\n this._beforeUpdate();\n const map = new Map<VNode, { native?: T }>();\n for (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 continue;\n }\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 }\n commit(map);\n if (elements) {\n for (const [node, element] of elements) {\n if (map.has(node) || !element.native) continue;\n this._destroyElement(node, element.native);\n }\n }\n this._afterUpdate();\n return map;\n };\n\n let update_count = 0;\n let render_count = 0;\n let destroyed = false;\n let elements = update();\n\n const listener = runtime.event.register('onchange', () => {\n if (render_count !== update_count++) return;\n nextick(() => {\n if (destroyed) return;\n render_count = update_count;\n elements = update(elements);\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, []);\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: ReturnType<typeof this._createRoot> | undefined;\n return {\n get root() {\n return state?.root;\n },\n mount: (\n component: ComponentNode,\n options?: {\n skipMount?: boolean;\n },\n ) => {\n state = this._createRoot(root ?? null, component, options);\n },\n unmount: () => {\n state?.destroy();\n state = undefined;\n },\n };\n }\n}"],"names":["component","reconciler","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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,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;gBACvD,SAAS,GAAG,IAAI;gBAChB,QAAQ,CAAC,MAAM,EAAE;gBACjB,KAAK,MAAM,KAAK,IAAI,UAAU,CAAC,MAAM,EAAE,EAAE;AACvC,oBAAA,KAAK,MAAM,EAAE,OAAO,EAAE,IAAI,KAAK;wBAAE,OAAO,IAAI;;aAE/C;SACF;;AAGH,IAAA,UAAU,CAAC,IAAQ,EAAA;AACjB,QAAA,IAAI,KAAsD;QAC1D,OAAO;AACL,YAAA,IAAI,IAAI,GAAA;gBACN,OAAO,KAAK,EAAE,IAAI;aACnB;AACD,YAAA,KAAK,EAAE,CACL,SAAwB,EACxB,OAEC,KACC;AACF,gBAAA,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC;aAC3D;YACD,OAAO,EAAE,MAAK;gBACZ,KAAK,EAAE,OAAO,EAAE;gBAChB,KAAK,GAAG,SAAS;aAClB;SACF;;AAEJ;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var component = require('./component-BiP3XIPe.js');
|
|
4
|
+
|
|
5
|
+
//
|
|
6
|
+
// basic.ts
|
|
7
|
+
//
|
|
8
|
+
// The MIT License
|
|
9
|
+
// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
|
|
10
|
+
//
|
|
11
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
// in the Software without restriction, including without limitation the rights
|
|
14
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
// furnished to do so, subject to the following conditions:
|
|
17
|
+
//
|
|
18
|
+
// The above copyright notice and this permission notice shall be included in
|
|
19
|
+
// all copies or substantial portions of the Software.
|
|
20
|
+
//
|
|
21
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
27
|
+
// THE SOFTWARE.
|
|
28
|
+
//
|
|
29
|
+
const _createElement = (type, props) => {
|
|
30
|
+
const { key, ..._props } = props;
|
|
31
|
+
return new component.ComponentNode(type, _props, key);
|
|
32
|
+
};
|
|
33
|
+
const createElement = (type, props, ...children) => _createElement(type, { ...props ?? {}, children });
|
|
34
|
+
|
|
35
|
+
exports._createElement = _createElement;
|
|
36
|
+
exports.createElement = createElement;
|
|
37
|
+
//# sourceMappingURL=runtime-DCKT7fd6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-DCKT7fd6.js","sources":["../../../src/core/types/runtime.ts"],"sourcesContent":["//\n// basic.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { MergeObject, PickType, WritableKeys } from '@o2ter/utils-js';\nimport { ComponentType, ElementNode, PropsWithChildren, RefAttribute } from './common';\nimport { ClassName, StyleProp } from './style';\nimport { CSSProperties, ExtendedCSSProperties } from '../web/styles/css';\nimport { globalEvents } from '../web/event';\nimport { ComponentNode, NativeElementType } from './component';\nimport { _HTMLElementTagNameMap, _MathMLElementTagNameMap, _SVGElementTagNameMap } from '../web/props';\n\nexport type _ElementType = string | ComponentType<any>;\n\nexport type _IntrinsicAttributes = {\n key?: string | number;\n};\n\nexport type PropsType = Record<string, any>;\n\ntype EventHandler<E extends Event, C, T = EventTarget> = (event: E & {\n currentTarget: C;\n target: T;\n }) => void;\ntype EventMap = {\n [ev in typeof globalEvents[number]]: ev extends `on${infer x}`\n ? Lowercase<x> extends keyof GlobalEventHandlersEventMap ? GlobalEventHandlersEventMap[Lowercase<x>] : Event\n : never;\n};\n\ntype _PropsOfInstance<Instance> = Omit<\n PickType<{\n [k in WritableKeys<Instance>]: Instance[k];\n }, boolean | number | string | null | undefined>,\n 'className' | 'style' | 'innerText' | 'outerText' | 'outerHTML' | 'nodeValue'\n> & {\n [x in keyof EventMap]?: EventHandler<EventMap[x], Instance>;\n} & {\n [x in keyof EventMap as `${x}Capture`]?: EventHandler<EventMap[x], Instance>;\n};\n\ntype Combine<T, R> = Omit<T, keyof R> & R;\n\ntype _ElementProps<ElementMap extends { [x: string]: { type: any; props?: any; } }> = {\n [x in keyof ElementMap]: PropsWithChildren<\n Partial<\n RefAttribute<ElementMap[x]['type'] | null | undefined>\n & {\n className?: ClassName;\n style?: StyleProp<ExtendedCSSProperties>;\n inlineStyle?: CSSProperties;\n }\n & Combine<ElementMap[x]['props'], _PropsOfInstance<ElementMap[x]['type']>>\n >\n >\n};\n\nexport type _IntrinsicElements = MergeObject<\n | _ElementProps<_HTMLElementTagNameMap>\n | _ElementProps<_SVGElementTagNameMap>\n | _ElementProps<_MathMLElementTagNameMap>\n> & { [x: string]: any; };\n\nexport const _createElement = (\n type: _ElementType | typeof NativeElementType,\n props: PropsType\n) => {\n const { key, ..._props } = props;\n return new ComponentNode(type, _props, key);\n}\n\nexport const createElement = (\n type: _ElementType,\n props?: PropsType | null,\n ...children: ElementNode[]\n) => _createElement(type, { ...props ?? {}, children });\n"],"names":["ComponentNode"],"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;MA6Da,cAAc,GAAG,CAC5B,IAA6C,EAC7C,KAAgB,KACd;IACF,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;IAChC,OAAO,IAAIA,uBAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC;AAC7C;AAEa,MAAA,aAAa,GAAG,CAC3B,IAAkB,EAClB,KAAwB,EACxB,GAAG,QAAuB,KACvB,cAAc,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,IAAI,EAAE,EAAE,QAAQ,EAAE;;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { C as ComponentNode } from './component-BzurKp_J.mjs';
|
|
2
|
+
|
|
3
|
+
//
|
|
4
|
+
// basic.ts
|
|
5
|
+
//
|
|
6
|
+
// The MIT License
|
|
7
|
+
// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
|
|
8
|
+
//
|
|
9
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
// in the Software without restriction, including without limitation the rights
|
|
12
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
// furnished to do so, subject to the following conditions:
|
|
15
|
+
//
|
|
16
|
+
// The above copyright notice and this permission notice shall be included in
|
|
17
|
+
// all copies or substantial portions of the Software.
|
|
18
|
+
//
|
|
19
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
|
+
// THE SOFTWARE.
|
|
26
|
+
//
|
|
27
|
+
const _createElement = (type, props) => {
|
|
28
|
+
const { key, ..._props } = props;
|
|
29
|
+
return new ComponentNode(type, _props, key);
|
|
30
|
+
};
|
|
31
|
+
const createElement = (type, props, ...children) => _createElement(type, { ...props ?? {}, children });
|
|
32
|
+
|
|
33
|
+
export { _createElement as _, createElement as c };
|
|
34
|
+
//# sourceMappingURL=runtime-DK28Kyy2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-DK28Kyy2.mjs","sources":["../../../src/core/types/runtime.ts"],"sourcesContent":["//\n// basic.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { MergeObject, PickType, WritableKeys } from '@o2ter/utils-js';\nimport { ComponentType, ElementNode, PropsWithChildren, RefAttribute } from './common';\nimport { ClassName, StyleProp } from './style';\nimport { CSSProperties, ExtendedCSSProperties } from '../web/styles/css';\nimport { globalEvents } from '../web/event';\nimport { ComponentNode, NativeElementType } from './component';\nimport { _HTMLElementTagNameMap, _MathMLElementTagNameMap, _SVGElementTagNameMap } from '../web/props';\n\nexport type _ElementType = string | ComponentType<any>;\n\nexport type _IntrinsicAttributes = {\n key?: string | number;\n};\n\nexport type PropsType = Record<string, any>;\n\ntype EventHandler<E extends Event, C, T = EventTarget> = (event: E & {\n currentTarget: C;\n target: T;\n }) => void;\ntype EventMap = {\n [ev in typeof globalEvents[number]]: ev extends `on${infer x}`\n ? Lowercase<x> extends keyof GlobalEventHandlersEventMap ? GlobalEventHandlersEventMap[Lowercase<x>] : Event\n : never;\n};\n\ntype _PropsOfInstance<Instance> = Omit<\n PickType<{\n [k in WritableKeys<Instance>]: Instance[k];\n }, boolean | number | string | null | undefined>,\n 'className' | 'style' | 'innerText' | 'outerText' | 'outerHTML' | 'nodeValue'\n> & {\n [x in keyof EventMap]?: EventHandler<EventMap[x], Instance>;\n} & {\n [x in keyof EventMap as `${x}Capture`]?: EventHandler<EventMap[x], Instance>;\n};\n\ntype Combine<T, R> = Omit<T, keyof R> & R;\n\ntype _ElementProps<ElementMap extends { [x: string]: { type: any; props?: any; } }> = {\n [x in keyof ElementMap]: PropsWithChildren<\n Partial<\n RefAttribute<ElementMap[x]['type'] | null | undefined>\n & {\n className?: ClassName;\n style?: StyleProp<ExtendedCSSProperties>;\n inlineStyle?: CSSProperties;\n }\n & Combine<ElementMap[x]['props'], _PropsOfInstance<ElementMap[x]['type']>>\n >\n >\n};\n\nexport type _IntrinsicElements = MergeObject<\n | _ElementProps<_HTMLElementTagNameMap>\n | _ElementProps<_SVGElementTagNameMap>\n | _ElementProps<_MathMLElementTagNameMap>\n> & { [x: string]: any; };\n\nexport const _createElement = (\n type: _ElementType | typeof NativeElementType,\n props: PropsType\n) => {\n const { key, ..._props } = props;\n return new ComponentNode(type, _props, key);\n}\n\nexport const createElement = (\n type: _ElementType,\n props?: PropsType | null,\n ...children: ElementNode[]\n) => _createElement(type, { ...props ?? {}, children });\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MA6Da,cAAc,GAAG,CAC5B,IAA6C,EAC7C,KAAgB,KACd;IACF,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;IAChC,OAAO,IAAI,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC;AAC7C;AAEa,MAAA,aAAa,GAAG,CAC3B,IAAkB,EAClB,KAAwB,EACxB,GAAG,QAAuB,KACvB,cAAc,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,IAAI,EAAE,EAAE,QAAQ,EAAE;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
-
import { C as ComponentNode, N as NativeElementType } from './
|
|
2
|
+
import { C as ComponentNode, N as NativeElementType } from './component-BzurKp_J.mjs';
|
|
3
3
|
import { myersSync } from 'myers.js';
|
|
4
4
|
|
|
5
5
|
//
|
|
@@ -532,5 +532,5 @@ const reconciler = new class {
|
|
|
532
532
|
}
|
|
533
533
|
};
|
|
534
534
|
|
|
535
|
-
export { ErrorBoundary as E, PropsProvider as P, VNode as V,
|
|
536
|
-
//# sourceMappingURL=state-
|
|
535
|
+
export { ErrorBoundary as E, PropsProvider as P, VNode as V, uniqueId as a, EventEmitter as b, createContext as c, equalDeps as e, mergeRefs as m, reconciler as r, useContext as u };
|
|
536
|
+
//# sourceMappingURL=state-5PNx91ec.mjs.map
|