frosty 0.0.10 → 0.0.12
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 +4 -3
- package/dist/_native.js.map +1 -1
- package/dist/_native.mjs +3 -2
- package/dist/_native.mjs.map +1 -1
- package/dist/dom.js +4 -3
- package/dist/dom.js.map +1 -1
- package/dist/dom.mjs +4 -3
- package/dist/dom.mjs.map +1 -1
- package/dist/hooks.d.ts +301 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +456 -0
- package/dist/hooks.js.map +1 -0
- package/dist/hooks.mjs +447 -0
- package/dist/hooks.mjs.map +1 -0
- package/dist/index.d.ts +45 -6
- package/dist/index.js +26 -146
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -129
- package/dist/index.mjs.map +1 -1
- package/dist/internals/{common-k5HsGdzR.mjs → common-Ckz4gBk9.mjs} +2 -2
- package/dist/internals/{common-k5HsGdzR.mjs.map → common-Ckz4gBk9.mjs.map} +1 -1
- package/dist/internals/{common-B4XOP6NZ.js → common-DqlVf-xT.js} +2 -2
- package/dist/internals/{common-B4XOP6NZ.js.map → common-DqlVf-xT.js.map} +1 -1
- package/dist/internals/{renderer-Bm8MRGC1.js → renderer-BUJ2DoXL.js} +9 -8
- package/dist/internals/{renderer-Bm8MRGC1.js.map → renderer-BUJ2DoXL.js.map} +1 -1
- package/dist/internals/{renderer-9_cxxw3Y.mjs → renderer-Cq_i6OKU.mjs} +3 -2
- package/dist/internals/{renderer-9_cxxw3Y.mjs.map → renderer-Cq_i6OKU.mjs.map} +1 -1
- package/dist/internals/{utils-CKVbI8zs.mjs → state-9vom4rCh.mjs} +3 -41
- package/dist/internals/state-9vom4rCh.mjs.map +1 -0
- package/dist/internals/{utils-CE_x-p37.js → state-B6LE4jGc.js} +2 -41
- package/dist/internals/state-B6LE4jGc.js.map +1 -0
- package/dist/internals/state-df0MMBIK.js +239 -0
- package/dist/internals/state-df0MMBIK.js.map +1 -0
- package/dist/internals/state-p-XyvhOU.mjs +232 -0
- package/dist/internals/state-p-XyvhOU.mjs.map +1 -0
- package/dist/internals/{sync-Dz7J-jHL.js → sync-CHeK3n3H.js} +19 -19
- package/dist/internals/sync-CHeK3n3H.js.map +1 -0
- package/dist/internals/{sync-n3Qiv-YB.mjs → sync-D6Hyms7Q.mjs} +5 -5
- package/dist/internals/sync-D6Hyms7Q.mjs.map +1 -0
- package/dist/internals/utils-DAEKakog.mjs +42 -0
- package/dist/internals/utils-DAEKakog.mjs.map +1 -0
- package/dist/internals/utils-Dc66ARNS.js +44 -0
- package/dist/internals/utils-Dc66ARNS.js.map +1 -0
- package/dist/server-dom.js +4 -3
- package/dist/server-dom.js.map +1 -1
- package/dist/server-dom.mjs +4 -3
- package/dist/server-dom.mjs.map +1 -1
- package/dist/web.js +10 -9
- package/dist/web.js.map +1 -1
- package/dist/web.mjs +6 -5
- package/dist/web.mjs.map +1 -1
- package/package.json +23 -1
- package/dist/internals/sync-Dz7J-jHL.js.map +0 -1
- package/dist/internals/sync-n3Qiv-YB.mjs.map +0 -1
- package/dist/internals/utils-CE_x-p37.js.map +0 -1
- package/dist/internals/utils-CKVbI8zs.mjs.map +0 -1
package/dist/_native.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var runtime = require('./internals/runtime-CHi74WKN.js');
|
|
4
|
-
var renderer = require('./internals/renderer-
|
|
5
|
-
var
|
|
4
|
+
var renderer = require('./internals/renderer-BUJ2DoXL.js');
|
|
5
|
+
var state = require('./internals/state-B6LE4jGc.js');
|
|
6
6
|
var component = require('./internals/component-DJsXAx2C.js');
|
|
7
7
|
require('lodash');
|
|
8
8
|
require('nextick');
|
|
9
|
+
require('./internals/utils-Dc66ARNS.js');
|
|
9
10
|
require('myers.js');
|
|
10
11
|
|
|
11
12
|
//
|
|
@@ -37,7 +38,7 @@ function _createNativeElement(type, props, key) {
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
exports._Renderer = renderer._Renderer;
|
|
40
|
-
exports.VNode =
|
|
41
|
+
exports.VNode = state.VNode;
|
|
41
42
|
exports.NativeElementType = component.NativeElementType;
|
|
42
43
|
exports._createNativeElement = _createNativeElement;
|
|
43
44
|
//# sourceMappingURL=_native.js.map
|
package/dist/_native.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_native.js","sources":["../../src/renderer/native.ts"],"sourcesContent":["//\n// native.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 { _createElement, PropsType } from '../core/types/runtime';\nimport { ComponentNode, NativeElementType } from '../core/types/component';\n\nexport { _Renderer } from '../core/renderer';\nexport { VNode } from '../core/reconciler/vnode';\nexport { NativeElementType } from '../core/types/component';\n\nexport function _createNativeElement(\n type: typeof NativeElementType,\n props: PropsType,\n key?: string | number\n): ComponentNode {\n return _createElement(type, { ...props, key });\n}\n"],"names":["_createElement"],"mappings":"
|
|
1
|
+
{"version":3,"file":"_native.js","sources":["../../src/renderer/native.ts"],"sourcesContent":["//\n// native.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 { _createElement, PropsType } from '../core/types/runtime';\nimport { ComponentNode, NativeElementType } from '../core/types/component';\n\nexport { _Renderer } from '../core/renderer';\nexport { VNode } from '../core/reconciler/vnode';\nexport { NativeElementType } from '../core/types/component';\n\nexport function _createNativeElement(\n type: typeof NativeElementType,\n props: PropsType,\n key?: string | number\n): ComponentNode {\n return _createElement(type, { ...props, key });\n}\n"],"names":["_createElement"],"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;SASgB,oBAAoB,CAClC,IAA8B,EAC9B,KAAgB,EAChB,GAAqB,EAAA;IAErB,OAAOA,sBAAc,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC;AAChD;;;;;;;"}
|
package/dist/_native.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { _ as _createElement } from './internals/runtime-BN27rc51.mjs';
|
|
2
|
-
export { _ as _Renderer } from './internals/renderer-
|
|
3
|
-
export { V as VNode } from './internals/
|
|
2
|
+
export { _ as _Renderer } from './internals/renderer-Cq_i6OKU.mjs';
|
|
3
|
+
export { V as VNode } from './internals/state-9vom4rCh.mjs';
|
|
4
4
|
export { N as NativeElementType } from './internals/component-tyF62qKh.mjs';
|
|
5
5
|
import 'lodash';
|
|
6
6
|
import 'nextick';
|
|
7
|
+
import './internals/utils-DAEKakog.mjs';
|
|
7
8
|
import 'myers.js';
|
|
8
9
|
|
|
9
10
|
//
|
package/dist/_native.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_native.mjs","sources":["../../src/renderer/native.ts"],"sourcesContent":["//\n// native.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 { _createElement, PropsType } from '../core/types/runtime';\nimport { ComponentNode, NativeElementType } from '../core/types/component';\n\nexport { _Renderer } from '../core/renderer';\nexport { VNode } from '../core/reconciler/vnode';\nexport { NativeElementType } from '../core/types/component';\n\nexport function _createNativeElement(\n type: typeof NativeElementType,\n props: PropsType,\n key?: string | number\n): ComponentNode {\n return _createElement(type, { ...props, key });\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_native.mjs","sources":["../../src/renderer/native.ts"],"sourcesContent":["//\n// native.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 { _createElement, PropsType } from '../core/types/runtime';\nimport { ComponentNode, NativeElementType } from '../core/types/component';\n\nexport { _Renderer } from '../core/renderer';\nexport { VNode } from '../core/reconciler/vnode';\nexport { NativeElementType } from '../core/types/component';\n\nexport function _createNativeElement(\n type: typeof NativeElementType,\n props: PropsType,\n key?: string | number\n): ComponentNode {\n return _createElement(type, { ...props, key });\n}\n"],"names":[],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;SASgB,oBAAoB,CAClC,IAA8B,EAC9B,KAAgB,EAChB,GAAqB,EAAA;IAErB,OAAO,cAAc,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC;AAChD;;;;"}
|
package/dist/dom.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var common = require('./internals/common-
|
|
3
|
+
var common = require('./internals/common-DqlVf-xT.js');
|
|
4
4
|
require('lodash');
|
|
5
5
|
require('myers.js');
|
|
6
|
-
require('./internals/renderer-
|
|
7
|
-
require('./internals/
|
|
6
|
+
require('./internals/renderer-BUJ2DoXL.js');
|
|
7
|
+
require('./internals/state-B6LE4jGc.js');
|
|
8
8
|
require('./internals/component-DJsXAx2C.js');
|
|
9
9
|
require('nextick');
|
|
10
|
+
require('./internals/utils-Dc66ARNS.js');
|
|
10
11
|
require('postcss');
|
|
11
12
|
require('postcss-js');
|
|
12
13
|
require('postcss-nested');
|
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":"
|
|
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;AAKM,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,10 +1,11 @@
|
|
|
1
|
-
import { _ as _DOMRenderer } from './internals/common-
|
|
1
|
+
import { _ as _DOMRenderer } from './internals/common-Ckz4gBk9.mjs';
|
|
2
2
|
import 'lodash';
|
|
3
3
|
import 'myers.js';
|
|
4
|
-
import './internals/renderer-
|
|
5
|
-
import './internals/
|
|
4
|
+
import './internals/renderer-Cq_i6OKU.mjs';
|
|
5
|
+
import './internals/state-9vom4rCh.mjs';
|
|
6
6
|
import './internals/component-tyF62qKh.mjs';
|
|
7
7
|
import 'nextick';
|
|
8
|
+
import './internals/utils-DAEKakog.mjs';
|
|
8
9
|
import 'postcss';
|
|
9
10
|
import 'postcss-js';
|
|
10
11
|
import 'postcss-nested';
|
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 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;AAKM,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;;;;;;"}
|
package/dist/hooks.d.ts
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import { Awaitable } from '@o2ter/utils-js';
|
|
3
|
+
import { C as ComponentType, P as PropsWithChildren, S as SetStateAction } from './internals/common-CIXimrNw.js';
|
|
4
|
+
import 'csstype';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Options for configuring the animation.
|
|
8
|
+
*
|
|
9
|
+
* @property fromValue - The starting value of the animation. Defaults to the current value.
|
|
10
|
+
* @property toValue - The target value of the animation.
|
|
11
|
+
* @property duration - The duration of the animation in milliseconds.
|
|
12
|
+
* @property easing - An optional easing function to control the animation's progress. Defaults to a linear function.
|
|
13
|
+
* @property delay - An optional delay (in milliseconds) before the animation starts. Defaults to `0`.
|
|
14
|
+
* @property onCompleted - An optional callback function invoked when the animation completes or is stopped.
|
|
15
|
+
*/
|
|
16
|
+
type AnimateOptions = {
|
|
17
|
+
fromValue?: number;
|
|
18
|
+
toValue: number;
|
|
19
|
+
duration: number;
|
|
20
|
+
easing?: (value: number) => number;
|
|
21
|
+
delay?: number;
|
|
22
|
+
onCompleted?: (result: {
|
|
23
|
+
value: number;
|
|
24
|
+
finished: boolean;
|
|
25
|
+
}) => void;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Options for interpolating a value.
|
|
29
|
+
*
|
|
30
|
+
* @property inputRange - A tuple specifying the input range for interpolation.
|
|
31
|
+
* @property outputRange - A tuple specifying the output range for interpolation.
|
|
32
|
+
*/
|
|
33
|
+
type InterpolateOptions = {
|
|
34
|
+
inputRange: [number, number];
|
|
35
|
+
outputRange: [number, number];
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Represents an interpolated value and provides a method to further interpolate it.
|
|
39
|
+
*
|
|
40
|
+
* @property value - The interpolated value.
|
|
41
|
+
* @property interpolate - A function to interpolate the current value based on new input and output ranges.
|
|
42
|
+
*/
|
|
43
|
+
type AnimatedInterpolation = {
|
|
44
|
+
value: number;
|
|
45
|
+
interpolate: ({ inputRange, outputRange }: InterpolateOptions) => AnimatedInterpolation;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* A hook to manage animations with support for starting, stopping, and interpolating values.
|
|
49
|
+
*
|
|
50
|
+
* @param initialValue - The initial value of the animation.
|
|
51
|
+
*
|
|
52
|
+
* @returns An object containing:
|
|
53
|
+
* - `value`: The current animated value.
|
|
54
|
+
* - `stop`: A function to stop the animation.
|
|
55
|
+
* - `start`: A function to start the animation with specified options.
|
|
56
|
+
* - `interpolate`: A function to interpolate the current value based on input and output ranges.
|
|
57
|
+
*/
|
|
58
|
+
declare const useAnimate: (initialValue: number) => {
|
|
59
|
+
value: number;
|
|
60
|
+
stop: () => void;
|
|
61
|
+
start: ({ fromValue, toValue, duration, easing, delay, onCompleted, }: AnimateOptions) => void;
|
|
62
|
+
interpolate: ({ inputRange, outputRange }: InterpolateOptions) => AnimatedInterpolation;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Represents a function to fetch asynchronous resources.
|
|
67
|
+
*
|
|
68
|
+
* @template T - The type of the resource being fetched.
|
|
69
|
+
* @template P - The type of the parameters passed to the fetch function.
|
|
70
|
+
*
|
|
71
|
+
* @param x - An object containing:
|
|
72
|
+
* - `abortSignal`: An `AbortSignal` to handle cancellation of the fetch operation.
|
|
73
|
+
* - `param`: Optional parameters for the fetch operation, passed by the `refresh` or `next` function.
|
|
74
|
+
* - `prevState`: The previous state of the resource, if applicable. This is only populated when the `next` function is called.
|
|
75
|
+
* - `dispatch`: A function to update the resource state during the fetch process.
|
|
76
|
+
*
|
|
77
|
+
* @returns A promise that resolves to the fetched resource or `void`.
|
|
78
|
+
*/
|
|
79
|
+
type Fetch<T, P> = (x: {
|
|
80
|
+
abortSignal: AbortSignal;
|
|
81
|
+
param?: P;
|
|
82
|
+
prevState?: T;
|
|
83
|
+
dispatch: (value: T | ((prevState?: T) => T)) => void;
|
|
84
|
+
}) => PromiseLike<void | T>;
|
|
85
|
+
/**
|
|
86
|
+
* Represents a function to fetch asynchronous iterable resources, such as streams or paginated data.
|
|
87
|
+
*
|
|
88
|
+
* @template T - The type of the resource items being fetched.
|
|
89
|
+
* @template P - The type of the parameters passed to the fetch function.
|
|
90
|
+
*
|
|
91
|
+
* @param x - An object containing:
|
|
92
|
+
* - `abortSignal`: An `AbortSignal` to handle cancellation of the fetch operation.
|
|
93
|
+
* - `param`: Optional parameters for the fetch operation, passed by the `refresh` or `next` function.
|
|
94
|
+
*
|
|
95
|
+
* @returns An `AsyncIterable` that yields the fetched resource items.
|
|
96
|
+
*/
|
|
97
|
+
type FetchWithIterable<T, P> = (x: {
|
|
98
|
+
abortSignal: AbortSignal;
|
|
99
|
+
param?: P;
|
|
100
|
+
}) => Awaitable<AsyncIterable<T>>;
|
|
101
|
+
/**
|
|
102
|
+
* Configuration object for asynchronous resource fetching.
|
|
103
|
+
*
|
|
104
|
+
* @template F - The type of the fetch function.
|
|
105
|
+
*
|
|
106
|
+
* @property fetch - The fetch function to retrieve the resource.
|
|
107
|
+
* @property debounce - Optional debounce settings to control the frequency of fetch calls.
|
|
108
|
+
* - `wait`: The number of milliseconds to delay.
|
|
109
|
+
* - Other settings as defined in `_.DebounceSettings`.
|
|
110
|
+
*/
|
|
111
|
+
type Config<F> = {
|
|
112
|
+
fetch: F;
|
|
113
|
+
debounce?: _.DebounceSettings & {
|
|
114
|
+
wait?: number;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
type Errors = {
|
|
119
|
+
token: string;
|
|
120
|
+
error: any;
|
|
121
|
+
refresh: () => Awaitable<void>;
|
|
122
|
+
refreshing: boolean;
|
|
123
|
+
loading: boolean;
|
|
124
|
+
}[];
|
|
125
|
+
/**
|
|
126
|
+
* A context provider component for managing asynchronous resource errors.
|
|
127
|
+
*
|
|
128
|
+
* This component provides a shared context for tracking errors encountered during
|
|
129
|
+
* asynchronous operations. It allows child components to access and manage these errors
|
|
130
|
+
* using the `useResourceErrors` hook.
|
|
131
|
+
*
|
|
132
|
+
* ### Usage:
|
|
133
|
+
* Wrap your application or specific parts of it with this component to enable error tracking:
|
|
134
|
+
*
|
|
135
|
+
* ```tsx
|
|
136
|
+
* <ResourceErrors>
|
|
137
|
+
* <YourComponent />
|
|
138
|
+
* </ResourceErrors>
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
141
|
+
* @param children - The child components that will have access to the error context.
|
|
142
|
+
*
|
|
143
|
+
* @returns A context provider that wraps the provided children.
|
|
144
|
+
*/
|
|
145
|
+
declare const ResourceErrors: ComponentType<PropsWithChildren<{}>>;
|
|
146
|
+
/**
|
|
147
|
+
* A hook to access the list of asynchronous resource errors.
|
|
148
|
+
*
|
|
149
|
+
* This hook allows components to retrieve the current list of errors being tracked
|
|
150
|
+
* in the `ResourceErrors` context. It must be used within a component that is
|
|
151
|
+
* a descendant of the `ResourceErrors` provider.
|
|
152
|
+
*
|
|
153
|
+
* ### Usage:
|
|
154
|
+
* ```tsx
|
|
155
|
+
* const errors = useResourceErrors();
|
|
156
|
+
*
|
|
157
|
+
* errors.forEach(({ token, error, refresh }) => {
|
|
158
|
+
* console.error(`Error [${token}]:`, error);
|
|
159
|
+
* // Optionally call refresh() to retry the operation
|
|
160
|
+
* });
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
163
|
+
* @returns The list of errors currently being tracked in the context. Each error includes:
|
|
164
|
+
* - `token`: A unique identifier for the error.
|
|
165
|
+
* - `error`: The error object or message.
|
|
166
|
+
* - `refresh`: A function to retry the operation that caused the error.
|
|
167
|
+
*/
|
|
168
|
+
declare const useResourceErrors: () => Errors;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* A hook to manage asynchronous resources with support for debouncing, error handling, and state management.
|
|
172
|
+
*
|
|
173
|
+
* @template T - The type of the resource being fetched.
|
|
174
|
+
* @template P - The type of the parameters passed to the fetch function.
|
|
175
|
+
*
|
|
176
|
+
* @param config - The fetch function or a configuration object containing the fetch function and optional debounce settings.
|
|
177
|
+
* @param deps - An optional dependency array to control when the resource is refreshed.
|
|
178
|
+
*
|
|
179
|
+
* @returns An object containing:
|
|
180
|
+
* - `count`: The number of times the resource has been fetched.
|
|
181
|
+
* - `refreshing`: A boolean indicating if the resource is currently being refreshed.
|
|
182
|
+
* - `loading`: A boolean indicating if the resource is currently being loaded.
|
|
183
|
+
* - `resource`: The fetched resource.
|
|
184
|
+
* - `error`: Any error encountered during the fetch.
|
|
185
|
+
* - `cancel`: A function to cancel the current fetch operation.
|
|
186
|
+
* - `refresh`: A function to refresh the resource.
|
|
187
|
+
* - `next`: A function to fetch the next set of data (for paginated resources).
|
|
188
|
+
* - `setResource`: A function to manually update the resource state.
|
|
189
|
+
*/
|
|
190
|
+
declare const useResource: <T, P = any>(config: Fetch<T, P> | Config<Fetch<T, P>>, deps?: any) => {
|
|
191
|
+
count: number;
|
|
192
|
+
refreshing: boolean;
|
|
193
|
+
loading: boolean;
|
|
194
|
+
resource: T | undefined;
|
|
195
|
+
error: any;
|
|
196
|
+
cancel: (reason?: any) => void;
|
|
197
|
+
refresh: (param?: P) => Promise<void>;
|
|
198
|
+
next: (param?: P) => Promise<void>;
|
|
199
|
+
setResource: (resource: T | ((prevState?: T) => T)) => void;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* A hook to manage asynchronous iterable resources, such as streams or paginated data.
|
|
203
|
+
*
|
|
204
|
+
* @template T - The type of the resource items being fetched.
|
|
205
|
+
* @template P - The type of the parameters passed to the fetch function.
|
|
206
|
+
*
|
|
207
|
+
* @param config - The fetch function or a configuration object containing the fetch function and optional debounce settings.
|
|
208
|
+
* @param deps - An optional dependency array to control when the resource is refreshed.
|
|
209
|
+
*
|
|
210
|
+
* @returns An object containing the same properties as `useResource`, but optimized for iterable resources.
|
|
211
|
+
*/
|
|
212
|
+
declare const useIterableResource: <T, P = any>(config: FetchWithIterable<T, P> | Config<FetchWithIterable<T, P>>, deps?: any) => {
|
|
213
|
+
count: number;
|
|
214
|
+
refreshing: boolean;
|
|
215
|
+
loading: boolean;
|
|
216
|
+
resource: T[] | undefined;
|
|
217
|
+
error: any;
|
|
218
|
+
cancel: (reason?: any) => void;
|
|
219
|
+
refresh: (param?: any) => Promise<void>;
|
|
220
|
+
setResource: (resource: T[] | ((prevState?: T[] | undefined) => T[])) => void;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* A hook that repeatedly calls the provided callback function at the specified interval.
|
|
225
|
+
*
|
|
226
|
+
* @param callback - The function to be executed at each interval.
|
|
227
|
+
* @param ms - The delay in milliseconds between each call to the callback. If not provided, the interval will not be set.
|
|
228
|
+
* @returns void
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* useInterval(() => {
|
|
232
|
+
* // Code to run every 1000ms
|
|
233
|
+
* }, 1000);
|
|
234
|
+
*/
|
|
235
|
+
declare const useInterval: (callback: () => void, ms?: number) => void;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* A class representing a store that holds a value and allows for subscription
|
|
239
|
+
* to changes in that value.
|
|
240
|
+
*
|
|
241
|
+
* @template T - The type of the value stored in the store.
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* const store = createStore(0);
|
|
245
|
+
* store.setValue(1);
|
|
246
|
+
* store.subscribe((oldVal, newVal) => {
|
|
247
|
+
* console.log(`Value changed from ${oldVal} to ${newVal}`);
|
|
248
|
+
* });
|
|
249
|
+
*/
|
|
250
|
+
declare class Store<T> {
|
|
251
|
+
#private;
|
|
252
|
+
/**
|
|
253
|
+
* Gets the current value of the store.
|
|
254
|
+
*
|
|
255
|
+
* @returns The current value of the store.
|
|
256
|
+
*/
|
|
257
|
+
get value(): T;
|
|
258
|
+
/**
|
|
259
|
+
* Sets the value of the store and notifies all subscribers.
|
|
260
|
+
*
|
|
261
|
+
* @param dispatch - The new value or a function that returns the new value.
|
|
262
|
+
*/
|
|
263
|
+
setValue(dispatch: SetStateAction<T>): void;
|
|
264
|
+
/**
|
|
265
|
+
* Subscribes to changes in the store's value.
|
|
266
|
+
*
|
|
267
|
+
* @param callback - The function to call when the value changes.
|
|
268
|
+
* @returns A function to unsubscribe from the store.
|
|
269
|
+
*/
|
|
270
|
+
subscribe(callback: (oldVal: T, newVal: T) => void): () => void;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Creates a new store with the given initial value.
|
|
274
|
+
*
|
|
275
|
+
* @param initialValue - The initial value to be stored.
|
|
276
|
+
* @returns {Store<T>} A new store instance.
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* const counterStore = createStore(0);
|
|
280
|
+
*/
|
|
281
|
+
declare const createStore: <T extends unknown = any>(initialValue: T) => Store<T>;
|
|
282
|
+
/**
|
|
283
|
+
* A hook to subscribe to a store and select a slice of its state.
|
|
284
|
+
* The component will re-render when the selected state changes.
|
|
285
|
+
*
|
|
286
|
+
* @param store - The store instance to subscribe to.
|
|
287
|
+
* @param selector - A function to select a part of the store's state. Defaults to the entire state.
|
|
288
|
+
* @param equal - A function to compare selected values for equality. Defaults to deep equality.
|
|
289
|
+
* @returns The selected slice of the store's state.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* const count = useStore(counterStore);
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* // Using a selector
|
|
296
|
+
* const userName = useStore(userStore, user => user.name);
|
|
297
|
+
*/
|
|
298
|
+
declare const useStore: <T extends unknown = any, S = T>(store: Store<T>, selector?: (state: T) => S, equal?: (value: S, other: S) => boolean) => S;
|
|
299
|
+
|
|
300
|
+
export { ResourceErrors, createStore, useAnimate, useInterval, useIterableResource, useResource, useResourceErrors, useStore };
|
|
301
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|