frosty 0.0.24 → 0.0.26
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/dom.d.ts +2 -1
- package/dist/dom.js +3 -2
- package/dist/dom.js.map +1 -1
- package/dist/dom.mjs +3 -2
- package/dist/dom.mjs.map +1 -1
- package/dist/internals/{common-DV3pvrs5.js → common-BYkI-LyH.js} +41 -17
- package/dist/internals/{common-DV3pvrs5.js.map → common-BYkI-LyH.js.map} +1 -1
- package/dist/internals/{common-DrondvLe.mjs → common-Cdpc1Wfn.mjs} +41 -18
- package/dist/internals/{common-DrondvLe.mjs.map → common-Cdpc1Wfn.mjs.map} +1 -1
- package/dist/internals/common-D1aDqVhZ.d.ts +28 -0
- package/dist/internals/common-D1aDqVhZ.d.ts.map +1 -0
- package/dist/server-dom.d.ts +2 -1
- package/dist/server-dom.js +3 -2
- package/dist/server-dom.js.map +1 -1
- package/dist/server-dom.mjs +3 -2
- package/dist/server-dom.mjs.map +1 -1
- package/dist/web.d.ts +4 -4
- package/dist/web.js +19 -13
- package/dist/web.js.map +1 -1
- package/dist/web.mjs +18 -14
- package/dist/web.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/internals/common-lyg386GG.d.ts +0 -21
- package/dist/internals/common-lyg386GG.d.ts.map +0 -1
package/dist/dom.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { _ as _DOMRenderer } from './internals/common-
|
|
1
|
+
import { _ as _DOMRenderer } from './internals/common-D1aDqVhZ.js';
|
|
2
|
+
export { D as DOMNativeNode } from './internals/common-D1aDqVhZ.js';
|
|
2
3
|
import './internals/common-agClzvnU.js';
|
|
3
4
|
import '@o2ter/utils-js';
|
|
4
5
|
import 'lodash';
|
package/dist/dom.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var common = require('./internals/common-
|
|
3
|
+
var common = require('./internals/common-BYkI-LyH.js');
|
|
4
4
|
require('lodash');
|
|
5
5
|
require('myers.js');
|
|
6
|
+
require('./internals/component-DJsXAx2C.js');
|
|
6
7
|
require('./internals/renderer-CF5XEhhm.js');
|
|
7
8
|
require('./internals/state-Dq9CkYWl.js');
|
|
8
|
-
require('./internals/component-DJsXAx2C.js');
|
|
9
9
|
require('nextick');
|
|
10
10
|
require('postcss');
|
|
11
11
|
require('postcss-js');
|
|
@@ -47,5 +47,6 @@ class DOMRenderer extends common._DOMRenderer {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
exports.DOMNativeNode = common.DOMNativeNode;
|
|
50
51
|
exports.DOMRenderer = DOMRenderer;
|
|
51
52
|
//# sourceMappingURL=dom.js.map
|
package/dist/dom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.js","sources":["../../src/renderer/dom.ts"],"sourcesContent":["//\n// dom.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 { _DOMRenderer } from './common';\n\nexport class DOMRenderer extends _DOMRenderer {\n\n static default = new DOMRenderer();\n\n static createRoot(root: Element): ReturnType<typeof DOMRenderer.default.createRoot> {\n return this.default.createRoot(root);\n }\n\n /** @internal */\n get _server(): boolean {\n return typeof window === 'undefined';\n }\n}\n"],"names":["_DOMRenderer"],"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;
|
|
1
|
+
{"version":3,"file":"dom.js","sources":["../../src/renderer/dom.ts"],"sourcesContent":["//\n// dom.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 { _DOMRenderer } from './common';\n\nexport { DOMNativeNode } from './common';\n\nexport class DOMRenderer extends _DOMRenderer {\n\n static default = new DOMRenderer();\n\n static createRoot(root: Element): ReturnType<typeof DOMRenderer.default.createRoot> {\n return this.default.createRoot(root);\n }\n\n /** @internal */\n get _server(): boolean {\n return typeof window === 'undefined';\n }\n}\n"],"names":["_DOMRenderer"],"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;AAOM,MAAO,WAAY,SAAQA,mBAAY,CAAA;AAE3C,IAAA,OAAO,OAAO,GAAG,IAAI,WAAW,EAAE;IAElC,OAAO,UAAU,CAAC,IAAa,EAAA;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;;;AAItC,IAAA,IAAI,OAAO,GAAA;AACT,QAAA,OAAO,OAAO,MAAM,KAAK,WAAW;;;;;;;"}
|
package/dist/dom.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { _ as _DOMRenderer } from './internals/common-
|
|
1
|
+
import { _ as _DOMRenderer } from './internals/common-Cdpc1Wfn.mjs';
|
|
2
|
+
export { D as DOMNativeNode } from './internals/common-Cdpc1Wfn.mjs';
|
|
2
3
|
import 'lodash';
|
|
3
4
|
import 'myers.js';
|
|
5
|
+
import './internals/component-tyF62qKh.mjs';
|
|
4
6
|
import './internals/renderer-C4lqJp-s.mjs';
|
|
5
7
|
import './internals/state-D54t8ETv.mjs';
|
|
6
|
-
import './internals/component-tyF62qKh.mjs';
|
|
7
8
|
import 'nextick';
|
|
8
9
|
import 'postcss';
|
|
9
10
|
import 'postcss-js';
|
package/dist/dom.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.mjs","sources":["../../src/renderer/dom.ts"],"sourcesContent":["//\n// dom.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 { _DOMRenderer } from './common';\n\nexport class DOMRenderer extends _DOMRenderer {\n\n static default = new DOMRenderer();\n\n static createRoot(root: Element): ReturnType<typeof DOMRenderer.default.createRoot> {\n return this.default.createRoot(root);\n }\n\n /** @internal */\n get _server(): boolean {\n return typeof window === 'undefined';\n }\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dom.mjs","sources":["../../src/renderer/dom.ts"],"sourcesContent":["//\n// dom.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 { _DOMRenderer } from './common';\n\nexport { DOMNativeNode } from './common';\n\nexport class DOMRenderer extends _DOMRenderer {\n\n static default = new DOMRenderer();\n\n static createRoot(root: Element): ReturnType<typeof DOMRenderer.default.createRoot> {\n return this.default.createRoot(root);\n }\n\n /** @internal */\n get _server(): boolean {\n return typeof window === 'undefined';\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;AAOM,MAAO,WAAY,SAAQ,YAAY,CAAA;AAE3C,IAAA,OAAO,OAAO,GAAG,IAAI,WAAW,EAAE;IAElC,OAAO,UAAU,CAAC,IAAa,EAAA;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;;;AAItC,IAAA,IAAI,OAAO,GAAA;AACT,QAAA,OAAO,OAAO,MAAM,KAAK,WAAW;;;;;;"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _ = require('lodash');
|
|
4
4
|
var myers_js = require('myers.js');
|
|
5
|
+
var component = require('./component-DJsXAx2C.js');
|
|
5
6
|
var renderer = require('./renderer-CF5XEhhm.js');
|
|
6
7
|
var postcss = require('postcss');
|
|
7
8
|
var postcssJs = require('postcss-js');
|
|
@@ -3889,6 +3890,9 @@ const isWriteable = (object, propertyName) => {
|
|
|
3889
3890
|
}
|
|
3890
3891
|
return !!desc.set;
|
|
3891
3892
|
};
|
|
3893
|
+
class DOMNativeNode extends component.NativeElementType {
|
|
3894
|
+
static createElement;
|
|
3895
|
+
}
|
|
3892
3896
|
class _DOMRenderer extends renderer._Renderer {
|
|
3893
3897
|
_doc;
|
|
3894
3898
|
_namespace_map = new WeakMap();
|
|
@@ -3934,6 +3938,12 @@ class _DOMRenderer extends renderer._Renderer {
|
|
|
3934
3938
|
/** @internal */
|
|
3935
3939
|
_createElement(node, stack) {
|
|
3936
3940
|
const { type } = node;
|
|
3941
|
+
if (!_.isString(type) && type.prototype instanceof DOMNativeNode) {
|
|
3942
|
+
const ElementType = type;
|
|
3943
|
+
const elem = ElementType.createElement();
|
|
3944
|
+
this._updateElement(node, elem, stack);
|
|
3945
|
+
return elem;
|
|
3946
|
+
}
|
|
3937
3947
|
if (!_.isString(type))
|
|
3938
3948
|
throw Error('Invalid type');
|
|
3939
3949
|
switch (type) {
|
|
@@ -3953,17 +3963,11 @@ class _DOMRenderer extends renderer._Renderer {
|
|
|
3953
3963
|
this._updateElement(node, elem, stack);
|
|
3954
3964
|
return elem;
|
|
3955
3965
|
}
|
|
3956
|
-
|
|
3966
|
+
__createBuiltClassName(className, style) {
|
|
3957
3967
|
const _className = _.compact(_.flattenDeep([className]));
|
|
3958
3968
|
const built = this._tracked_style.buildStyle(_.compact(_.flattenDeep([style])));
|
|
3959
|
-
const joined = [..._className, ...built].join(' ');
|
|
3960
|
-
if (_.isEmpty(joined)) {
|
|
3961
|
-
element.removeAttribute('class');
|
|
3962
|
-
}
|
|
3963
|
-
else {
|
|
3964
|
-
element.className = joined;
|
|
3965
|
-
}
|
|
3966
3969
|
this._tracked_style_names.push(...built);
|
|
3970
|
+
return [..._className, ...built].join(' ');
|
|
3967
3971
|
}
|
|
3968
3972
|
__updateEventListener(element, key, listener, options) {
|
|
3969
3973
|
const event = key.endsWith('Capture') ? key.slice(2, -7).toLowerCase() : key.slice(2).toLowerCase();
|
|
@@ -3980,6 +3984,11 @@ class _DOMRenderer extends renderer._Renderer {
|
|
|
3980
3984
|
/** @internal */
|
|
3981
3985
|
_updateElement(node, element, stack) {
|
|
3982
3986
|
const { type, props: { className, style, inlineStyle, innerHTML, ..._props } } = node;
|
|
3987
|
+
if (element instanceof DOMNativeNode) {
|
|
3988
|
+
const builtClassName = this.__createBuiltClassName(className, style);
|
|
3989
|
+
element.update({ className: builtClassName, style: inlineStyle, innerHTML, ..._props });
|
|
3990
|
+
return;
|
|
3991
|
+
}
|
|
3983
3992
|
if (!_.isString(type))
|
|
3984
3993
|
throw Error('Invalid type');
|
|
3985
3994
|
switch (type) {
|
|
@@ -3987,7 +3996,13 @@ class _DOMRenderer extends renderer._Renderer {
|
|
|
3987
3996
|
case 'head': return;
|
|
3988
3997
|
case 'body': return;
|
|
3989
3998
|
}
|
|
3990
|
-
this.
|
|
3999
|
+
const builtClassName = this.__createBuiltClassName(className, style);
|
|
4000
|
+
if (_.isEmpty(builtClassName)) {
|
|
4001
|
+
element.removeAttribute('class');
|
|
4002
|
+
}
|
|
4003
|
+
else {
|
|
4004
|
+
element.className = builtClassName;
|
|
4005
|
+
}
|
|
3991
4006
|
if (!_.isEmpty(innerHTML))
|
|
3992
4007
|
element.innerHTML = innerHTML;
|
|
3993
4008
|
if (inlineStyle) {
|
|
@@ -4050,22 +4065,30 @@ class _DOMRenderer extends renderer._Renderer {
|
|
|
4050
4065
|
if (type === 'head') {
|
|
4051
4066
|
this._tracked_head_children.push(...children);
|
|
4052
4067
|
}
|
|
4068
|
+
else if (element instanceof DOMNativeNode) {
|
|
4069
|
+
element.replaceChildren(children);
|
|
4070
|
+
}
|
|
4053
4071
|
else if (_.isEmpty(innerHTML)) {
|
|
4054
4072
|
this.__replaceChildren(element, children);
|
|
4055
4073
|
}
|
|
4056
4074
|
}
|
|
4057
4075
|
/** @internal */
|
|
4058
4076
|
_destroyElement(node, element) {
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4077
|
+
if (element instanceof DOMNativeNode) {
|
|
4078
|
+
element.destroy();
|
|
4079
|
+
}
|
|
4080
|
+
else {
|
|
4081
|
+
const tracked_listener = this._tracked_listener.get(element) ?? {};
|
|
4082
|
+
for (const [key, listener] of _.entries(tracked_listener)) {
|
|
4083
|
+
const event = key.endsWith('Capture') ? key.slice(2, -7).toLowerCase() : key.slice(2).toLowerCase();
|
|
4084
|
+
if (_.isFunction(listener)) {
|
|
4085
|
+
element.removeEventListener(event, listener, { capture: key.endsWith('Capture') });
|
|
4086
|
+
}
|
|
4064
4087
|
}
|
|
4065
4088
|
}
|
|
4066
4089
|
}
|
|
4067
4090
|
__replaceChildren(element, children) {
|
|
4068
|
-
const diff = myers_js.myersSync(_.map(element.childNodes, x => x.nodeType === this.doc.TEXT_NODE ? x.textContent ?? '' : x), children, { compare: (a, b) => a === b });
|
|
4091
|
+
const diff = myers_js.myersSync(_.map(element.childNodes, x => x.nodeType === this.doc.TEXT_NODE ? x.textContent ?? '' : x), _.map(children, x => x instanceof DOMNativeNode ? x.target : x), { compare: (a, b) => a === b });
|
|
4069
4092
|
let i = 0;
|
|
4070
4093
|
for (const { remove, insert, equivalent } of diff) {
|
|
4071
4094
|
if (equivalent) {
|
|
@@ -4088,7 +4111,7 @@ class _DOMRenderer extends renderer._Renderer {
|
|
|
4088
4111
|
const root = this.createRoot();
|
|
4089
4112
|
try {
|
|
4090
4113
|
root.mount(component, { skipMount: true });
|
|
4091
|
-
const str = _.map(_.castArray(root.root ?? []), x => x.outerHTML).join('');
|
|
4114
|
+
const str = _.map(_.castArray(root.root ?? []), x => (x instanceof DOMNativeNode ? x.target : x).outerHTML).join('');
|
|
4092
4115
|
return str.startsWith('<html>') ? `<!DOCTYPE html>${str}` : str;
|
|
4093
4116
|
}
|
|
4094
4117
|
finally {
|
|
@@ -4097,5 +4120,6 @@ class _DOMRenderer extends renderer._Renderer {
|
|
|
4097
4120
|
}
|
|
4098
4121
|
}
|
|
4099
4122
|
|
|
4123
|
+
exports.DOMNativeNode = DOMNativeNode;
|
|
4100
4124
|
exports._DOMRenderer = _DOMRenderer;
|
|
4101
|
-
//# sourceMappingURL=common-
|
|
4125
|
+
//# sourceMappingURL=common-BYkI-LyH.js.map
|