frosty 0.0.154 → 0.0.156

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/_native.d.mts +2 -1
  2. package/dist/_native.d.mts.map +1 -1
  3. package/dist/_native.d.ts +2 -1
  4. package/dist/_native.d.ts.map +1 -1
  5. package/dist/_native.js +3 -3
  6. package/dist/_native.mjs +1 -1
  7. package/dist/dom.d.mts +3 -2
  8. package/dist/dom.d.mts.map +1 -1
  9. package/dist/dom.d.ts +3 -2
  10. package/dist/dom.d.ts.map +1 -1
  11. package/dist/dom.js +3 -3
  12. package/dist/dom.mjs +2 -2
  13. package/dist/i18n.d.mts +38 -0
  14. package/dist/i18n.d.mts.map +1 -0
  15. package/dist/i18n.d.ts +38 -0
  16. package/dist/i18n.d.ts.map +1 -0
  17. package/dist/i18n.js +79 -0
  18. package/dist/i18n.js.map +1 -0
  19. package/dist/i18n.mjs +72 -0
  20. package/dist/i18n.mjs.map +1 -0
  21. package/dist/index.js +47 -42
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +4 -2
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/internals/callback-DEKCuARB.mjs +170 -0
  26. package/dist/internals/callback-DEKCuARB.mjs.map +1 -0
  27. package/dist/internals/callback-DVD1MTA9.js +180 -0
  28. package/dist/internals/callback-DVD1MTA9.js.map +1 -0
  29. package/dist/internals/{events-BgboMOG9.js → events-CcBnpWOF.js} +7 -3
  30. package/dist/internals/{events-BgboMOG9.js.map → events-CcBnpWOF.js.map} +1 -1
  31. package/dist/internals/{form-BGe5OdHZ.js → form-CC8A5nkh.js} +40 -205
  32. package/dist/internals/form-CC8A5nkh.js.map +1 -0
  33. package/dist/internals/{form-RKmiM_eK.mjs → form-Cee86QUZ.mjs} +4 -168
  34. package/dist/internals/form-Cee86QUZ.mjs.map +1 -0
  35. package/dist/internals/{index-CHID44Lo.js → index-Bvwj3lIq.js} +39 -35
  36. package/dist/internals/{index-CHID44Lo.js.map → index-Bvwj3lIq.js.map} +1 -1
  37. package/dist/internals/{index-DCYqTHyF.d.mts → index-BzVLlTCa.d.mts} +3 -1
  38. package/dist/internals/index-BzVLlTCa.d.mts.map +1 -0
  39. package/dist/internals/{index-BXYwGmMq.d.ts → index-OvcTjmzX.d.ts} +3 -1
  40. package/dist/internals/index-OvcTjmzX.d.ts.map +1 -0
  41. package/dist/internals/{renderer-BtM_6vlI.d.mts → renderer-BluiQ1F-.d.mts} +2 -2
  42. package/dist/internals/{renderer-BtM_6vlI.d.mts.map → renderer-BluiQ1F-.d.mts.map} +1 -1
  43. package/dist/internals/{renderer-CRJ6yD_V.mjs → renderer-BvM6i6Cl.mjs} +2 -2
  44. package/dist/internals/{renderer-CRJ6yD_V.mjs.map → renderer-BvM6i6Cl.mjs.map} +1 -1
  45. package/dist/internals/{renderer-1wYRgACC.d.ts → renderer-C1RBQB2f.d.ts} +2 -2
  46. package/dist/internals/{renderer-1wYRgACC.d.ts.map → renderer-C1RBQB2f.d.ts.map} +1 -1
  47. package/dist/internals/{renderer-BXTVLEhY.js → renderer-C5NIsxDg.js} +67 -61
  48. package/dist/internals/{renderer-BXTVLEhY.js.map → renderer-C5NIsxDg.js.map} +1 -1
  49. package/dist/internals/{renderer-FQADFg6I.js → renderer-DR_CVQzd.js} +17 -11
  50. package/dist/internals/renderer-DR_CVQzd.js.map +1 -0
  51. package/dist/internals/{renderer-DxQAalyV.mjs → renderer-DaX4zUo8.mjs} +3 -2
  52. package/dist/internals/renderer-DaX4zUo8.mjs.map +1 -0
  53. package/dist/server-dom.d.mts +3 -2
  54. package/dist/server-dom.d.mts.map +1 -1
  55. package/dist/server-dom.d.ts +3 -2
  56. package/dist/server-dom.d.ts.map +1 -1
  57. package/dist/server-dom.js +3 -3
  58. package/dist/server-dom.mjs +2 -2
  59. package/dist/web.d.mts +3 -2
  60. package/dist/web.d.mts.map +1 -1
  61. package/dist/web.d.ts +3 -2
  62. package/dist/web.d.ts.map +1 -1
  63. package/dist/web.js +31 -26
  64. package/dist/web.js.map +1 -1
  65. package/dist/web.mjs +5 -4
  66. package/dist/web.mjs.map +1 -1
  67. package/package.json +2 -1
  68. package/packages/frosty-cli/webpack.mjs +2 -2
  69. package/packages/frosty-cli/yarn.lock +3 -3
  70. package/dist/internals/form-BGe5OdHZ.js.map +0 -1
  71. package/dist/internals/form-RKmiM_eK.mjs.map +0 -1
  72. package/dist/internals/index-BXYwGmMq.d.ts.map +0 -1
  73. package/dist/internals/index-DCYqTHyF.d.mts.map +0 -1
  74. package/dist/internals/renderer-DxQAalyV.mjs.map +0 -1
  75. package/dist/internals/renderer-FQADFg6I.js.map +0 -1
@@ -2,6 +2,10 @@
2
2
 
3
3
  var _ = require('lodash');
4
4
 
5
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
+
7
+ var ___default = /*#__PURE__*/_interopDefault(_);
8
+
5
9
  //
6
10
  // events.ts
7
11
  //
@@ -29,13 +33,13 @@ var _ = require('lodash');
29
33
  class EventEmitter {
30
34
  #listeners = {};
31
35
  register(event, callback) {
32
- if (_.isNil(this.#listeners[event]))
36
+ if (___default.default.isNil(this.#listeners[event]))
33
37
  this.#listeners[event] = [];
34
38
  const _callback = (...args) => callback(event, ...args);
35
39
  this.#listeners[event].push(_callback);
36
40
  return {
37
41
  remove: () => {
38
- this.#listeners[event] = _.filter(this.#listeners[event], x => x !== _callback);
42
+ this.#listeners[event] = ___default.default.filter(this.#listeners[event], x => x !== _callback);
39
43
  },
40
44
  };
41
45
  }
@@ -52,4 +56,4 @@ class EventEmitter {
52
56
  }
53
57
 
54
58
  exports.EventEmitter = EventEmitter;
55
- //# sourceMappingURL=events-BgboMOG9.js.map
59
+ //# sourceMappingURL=events-CcBnpWOF.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"events-BgboMOG9.js","sources":["../../../src/core/reconciler/events.ts"],"sourcesContent":["//\n// events.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\n\nexport class EventEmitter {\n\n #listeners: Record<string, ((...args: any[]) => void)[]> = {};\n\n register(event: string, callback: (event: string, ...args: any[]) => void) {\n if (_.isNil(this.#listeners[event])) this.#listeners[event] = [];\n const _callback = (...args: any[]) => callback(event, ...args);\n this.#listeners[event].push(_callback);\n return {\n remove: () => {\n this.#listeners[event] = _.filter(this.#listeners[event], x => x !== _callback);\n },\n };\n }\n\n emit(event: string, ...args: any[]) {\n this.#listeners[event]?.forEach(async callback => {\n try {\n await callback(...args)\n } catch (e) {\n console.error(e);\n }\n });\n }\n}\n"],"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;MAIa,YAAY,CAAA;IAEvB,UAAU,GAAiD,EAAE;IAE7D,QAAQ,CAAC,KAAa,EAAE,QAAiD,EAAA;QACvE,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AAAE,YAAA,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE;AAChE,QAAA,MAAM,SAAS,GAAG,CAAC,GAAG,IAAW,KAAK,QAAQ,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC;QAC9D,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;QACtC,OAAO;YACL,MAAM,EAAE,MAAK;gBACX,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC;YACjF,CAAC;SACF;IACH;AAEA,IAAA,IAAI,CAAC,KAAa,EAAE,GAAG,IAAW,EAAA;AAChC,QAAA,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,OAAM,QAAQ,KAAG;AAC/C,YAAA,IAAI;AACF,gBAAA,MAAM,QAAQ,CAAC,GAAG,IAAI,CAAC;YACzB;YAAE,OAAO,CAAC,EAAE;AACV,gBAAA,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;YAClB;AACF,QAAA,CAAC,CAAC;IACJ;AACD;;;;"}
1
+ {"version":3,"file":"events-CcBnpWOF.js","sources":["../../../src/core/reconciler/events.ts"],"sourcesContent":["//\n// events.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\n\nexport class EventEmitter {\n\n #listeners: Record<string, ((...args: any[]) => void)[]> = {};\n\n register(event: string, callback: (event: string, ...args: any[]) => void) {\n if (_.isNil(this.#listeners[event])) this.#listeners[event] = [];\n const _callback = (...args: any[]) => callback(event, ...args);\n this.#listeners[event].push(_callback);\n return {\n remove: () => {\n this.#listeners[event] = _.filter(this.#listeners[event], x => x !== _callback);\n },\n };\n }\n\n emit(event: string, ...args: any[]) {\n this.#listeners[event]?.forEach(async callback => {\n try {\n await callback(...args)\n } catch (e) {\n console.error(e);\n }\n });\n }\n}\n"],"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;MAIa,YAAY,CAAA;IAEvB,UAAU,GAAiD,EAAE;IAE7D,QAAQ,CAAC,KAAa,EAAE,QAAiD,EAAA;QACvE,IAAIA,kBAAC,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AAAE,YAAA,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE;AAChE,QAAA,MAAM,SAAS,GAAG,CAAC,GAAG,IAAW,KAAK,QAAQ,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC;QAC9D,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;QACtC,OAAO;YACL,MAAM,EAAE,MAAK;gBACX,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAGA,kBAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC;YACjF,CAAC;SACF;IACH;AAEA,IAAA,IAAI,CAAC,KAAa,EAAE,GAAG,IAAW,EAAA;AAChC,QAAA,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,OAAM,QAAQ,KAAG;AAC/C,YAAA,IAAI;AACF,gBAAA,MAAM,QAAQ,CAAC,GAAG,IAAI,CAAC;YACzB;YAAE,OAAO,CAAC,EAAE;AACV,gBAAA,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;YAClB;AACF,QAAA,CAAC,CAAC;IACJ;AACD;;;;"}
@@ -2,68 +2,12 @@
2
2
 
3
3
  var jsxRuntime = require('../jsx-runtime.js');
4
4
  var _ = require('lodash');
5
- var index = require('./index-CHID44Lo.js');
5
+ var index = require('./index-Bvwj3lIq.js');
6
+ var callback = require('./callback-DVD1MTA9.js');
6
7
 
7
- //
8
- // index.ts
9
- //
10
- // The MIT License
11
- // Copyright (c) 2021 - 2026 O2ter Limited. All rights reserved.
12
- //
13
- // Permission is hereby granted, free of charge, to any person obtaining a copy
14
- // of this software and associated documentation files (the "Software"), to deal
15
- // in the Software without restriction, including without limitation the rights
16
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
- // copies of the Software, and to permit persons to whom the Software is
18
- // furnished to do so, subject to the following conditions:
19
- //
20
- // The above copyright notice and this permission notice shall be included in
21
- // all copies or substantial portions of the Software.
22
- //
23
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29
- // THE SOFTWARE.
30
- //
31
- const _useHookState = (hook) => {
32
- const state = index.reconciler.currentHookState;
33
- if (!state)
34
- throw Error(`${hook} must be used within a render function.`);
35
- const { prevState, state: newState } = state;
36
- if (prevState && prevState[newState.length]?.hook !== hook) {
37
- console.warn([
38
- `Hook "${hook}" is called conditionally.`,
39
- 'Hooks must be called in the exact same order in every component render.',
40
- 'Did you accidentally call a hook after an early return?'
41
- ].join(' '));
42
- }
43
- return state;
44
- };
45
- const _useEffect = (hook, effect, deps) => {
46
- const state = _useHookState(hook);
47
- const { state: newState } = state;
48
- newState.push({
49
- mount: () => effect(state),
50
- deps,
51
- hook,
52
- });
53
- };
54
- const _useMemo = (hook, factory, deps) => {
55
- const state = _useHookState(hook);
56
- const { prevState, state: newState } = state;
57
- const idx = newState.length;
58
- const changed = prevState?.[idx]?.hook !== hook || !index.equalDeps(prevState[idx].deps, deps);
59
- const data = changed ? factory(state) : prevState[idx].data;
60
- newState.push({
61
- deps,
62
- hook,
63
- data
64
- });
65
- return data;
66
- };
8
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
+
10
+ var ___default = /*#__PURE__*/_interopDefault(_);
67
11
 
68
12
  //
69
13
  // memo.ts
@@ -90,12 +34,12 @@ const _useMemo = (hook, factory, deps) => {
90
34
  // THE SOFTWARE.
91
35
  //
92
36
  function useState(initialState) {
93
- const { value, setValue } = _useMemo('useState', (_state) => {
37
+ const { value, setValue } = callback._useMemo('useState', (_state) => {
94
38
  const state = {
95
- value: _.isFunction(initialState) ? initialState() : initialState,
39
+ value: ___default.default.isFunction(initialState) ? initialState() : initialState,
96
40
  setValue: (dispatch) => {
97
41
  const oldValue = state.value;
98
- const newValue = _.isFunction(dispatch) ? dispatch(oldValue) : dispatch;
42
+ const newValue = ___default.default.isFunction(dispatch) ? dispatch(oldValue) : dispatch;
99
43
  if (oldValue === newValue)
100
44
  return;
101
45
  state.value = newValue;
@@ -107,41 +51,6 @@ function useState(initialState) {
107
51
  return [value, setValue];
108
52
  }
109
53
 
110
- //
111
- // memo.ts
112
- //
113
- // The MIT License
114
- // Copyright (c) 2021 - 2026 O2ter Limited. All rights reserved.
115
- //
116
- // Permission is hereby granted, free of charge, to any person obtaining a copy
117
- // of this software and associated documentation files (the "Software"), to deal
118
- // in the Software without restriction, including without limitation the rights
119
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
120
- // copies of the Software, and to permit persons to whom the Software is
121
- // furnished to do so, subject to the following conditions:
122
- //
123
- // The above copyright notice and this permission notice shall be included in
124
- // all copies or substantial portions of the Software.
125
- //
126
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
127
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
128
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
129
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
130
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
131
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
132
- // THE SOFTWARE.
133
- //
134
- /**
135
- * A utility function that memoizes the result of a factory function.
136
- *
137
- * @template T The type of the value returned by the factory function.
138
- * @param factory A function that produces a value to be memoized.
139
- * @param deps An optional dependency array. The memoized value is recalculated
140
- * only when the dependencies change.
141
- * @returns The memoized value produced by the factory function.
142
- */
143
- const useMemo = (factory, deps) => _useMemo('useMemo', () => factory(), deps);
144
-
145
54
  const contextMap = new WeakMap();
146
55
  const dispatchCache = index.createCache();
147
56
  /**
@@ -180,7 +89,7 @@ const createActivity = ({ defaultDelay: _defaultDelay = 250, } = {}) => {
180
89
  });
181
90
  const component = ({ defaultDelay = _defaultDelay, children, }) => {
182
91
  const [tasks, setTasks] = useState([]);
183
- const value = useMemo(() => ({ setTasks, defaultDelay }), []);
92
+ const value = callback.useMemo(() => ({ setTasks, defaultDelay }), []);
184
93
  return (jsxRuntime.jsx(Context, { value: value, children: children(tasks.length) }));
185
94
  };
186
95
  contextMap.set(component, Context);
@@ -235,7 +144,7 @@ const useActivity = (component) => {
235
144
  const id = index.uniqueId();
236
145
  let timeout;
237
146
  const _delay = delay ?? store.defaultDelay;
238
- if (_.isNumber(_delay) && _delay > 0) {
147
+ if (___default.default.isNumber(_delay) && _delay > 0) {
239
148
  timeout = setTimeout(() => {
240
149
  store.setTasks(tasks => [...tasks, id]);
241
150
  }, _delay);
@@ -249,7 +158,7 @@ const useActivity = (component) => {
249
158
  finally {
250
159
  if (timeout)
251
160
  clearTimeout(timeout);
252
- store.setTasks(tasks => _.filter(tasks, x => x !== id));
161
+ store.setTasks(tasks => ___default.default.filter(tasks, x => x !== id));
253
162
  }
254
163
  });
255
164
  };
@@ -330,7 +239,7 @@ const useActivity = (component) => {
330
239
  * };
331
240
  * }, []);
332
241
  */
333
- const useEffect = (effect, deps) => _useEffect('useEffect', () => {
242
+ const useEffect = (effect, deps) => callback._useEffect('useEffect', () => {
334
243
  const abort = new AbortController();
335
244
  try {
336
245
  const destructor = effect(abort.signal);
@@ -339,7 +248,7 @@ const useEffect = (effect, deps) => _useEffect('useEffect', () => {
339
248
  (async () => {
340
249
  try {
341
250
  const _destructor = await destructor;
342
- if (_.isFunction(_destructor))
251
+ if (___default.default.isFunction(_destructor))
343
252
  _destructor();
344
253
  }
345
254
  catch (e) {
@@ -354,75 +263,6 @@ const useEffect = (effect, deps) => _useEffect('useEffect', () => {
354
263
  }
355
264
  }, deps);
356
265
 
357
- //
358
- // memo.ts
359
- //
360
- // The MIT License
361
- // Copyright (c) 2021 - 2026 O2ter Limited. All rights reserved.
362
- //
363
- // Permission is hereby granted, free of charge, to any person obtaining a copy
364
- // of this software and associated documentation files (the "Software"), to deal
365
- // in the Software without restriction, including without limitation the rights
366
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
367
- // copies of the Software, and to permit persons to whom the Software is
368
- // furnished to do so, subject to the following conditions:
369
- //
370
- // The above copyright notice and this permission notice shall be included in
371
- // all copies or substantial portions of the Software.
372
- //
373
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
374
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
375
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
376
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
377
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
378
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
379
- // THE SOFTWARE.
380
- //
381
- const _useCallbacks = (callbacks, deps) => {
382
- if (!_.isUndefined(deps))
383
- return _useMemo('_useCallbacks', () => callbacks, deps);
384
- const store = _useMemo('_useCallbacks', () => {
385
- const store = {
386
- current: callbacks,
387
- stable: _.mapValues(callbacks, (v, k) => v && (function (...args) {
388
- const callback = store.current[k];
389
- if (_.isFunction(callback))
390
- return callback.call(this, ...args);
391
- })),
392
- };
393
- return store;
394
- }, null);
395
- store.current = callbacks;
396
- store.stable = _.mapValues(callbacks, (v, k) => v && (store.stable[k] || (function (...args) {
397
- const callback = store.current[k];
398
- if (_.isFunction(callback))
399
- return callback.call(this, ...args);
400
- })));
401
- return store.stable;
402
- };
403
- /**
404
- * A hook that memoizes a callback function, ensuring that it only changes
405
- * if its dependencies change. This is useful for optimizing performance by preventing
406
- * unnecessary re-creations of functions.
407
- *
408
- * @template T - The type of the callback function.
409
- * @param callback - The callback function to be memoized.
410
- * @param deps - An optional dependencies. If provided, the callback
411
- * will only be updated when one of these dependencies changes.
412
- * If not provided, the callback will remain stable.
413
- * @returns - A stable version of the callback function that will not change unless
414
- * its dependencies change.
415
- *
416
- * @example
417
- * const memoizedCallback = useCallback(() => {
418
- * console.log('This function is memoized!');
419
- * }, [dependency]);
420
- */
421
- const useCallback = (callback, deps) => {
422
- const { callback: stable } = _useCallbacks({ callback }, deps);
423
- return stable;
424
- };
425
-
426
266
  //
427
267
  // storage.ts
428
268
  //
@@ -493,7 +333,7 @@ const Context = index.createContext();
493
333
  */
494
334
  const ResourceErrors = ({ children }) => {
495
335
  const [errors, setErrors] = useState([]);
496
- const value = useMemo(() => ({ errors, setErrors }), [errors, setErrors]);
336
+ const value = callback.useMemo(() => ({ errors, setErrors }), [errors, setErrors]);
497
337
  return (jsxRuntime.jsx(Context, { value: value, children: children }));
498
338
  };
499
339
  const useErrorContext = () => {
@@ -507,7 +347,7 @@ const useErrorContext = () => {
507
347
  const store = {
508
348
  errors: [],
509
349
  setErrors: (values) => {
510
- store.errors = _.isFunction(values) ? values(store.errors) : values;
350
+ store.errors = ___default.default.isFunction(values) ? values(store.errors) : values;
511
351
  },
512
352
  };
513
353
  storage.set(defaultStorageKey, store);
@@ -584,7 +424,7 @@ const useSyncExternalStore = (subscribe, getSnapshot, getServerSnapshot) => {
584
424
  const state = index.reconciler.currentHookState;
585
425
  if (!state)
586
426
  throw Error('useSyncExternalStore must be used within a render function.');
587
- _useEffect('useSyncExternalStore', (_state) => {
427
+ callback._useEffect('useSyncExternalStore', (_state) => {
588
428
  const abort = new AbortController();
589
429
  try {
590
430
  const destructor = subscribe(() => { _state.setDirty(); }, abort.signal);
@@ -593,7 +433,7 @@ const useSyncExternalStore = (subscribe, getSnapshot, getServerSnapshot) => {
593
433
  (async () => {
594
434
  try {
595
435
  const _destructor = await destructor;
596
- if (_.isFunction(_destructor))
436
+ if (___default.default.isFunction(_destructor))
597
437
  _destructor();
598
438
  }
599
439
  catch (e) {
@@ -639,26 +479,26 @@ const useSyncExternalStore = (subscribe, getSnapshot, getServerSnapshot) => {
639
479
  //
640
480
  const FormActivity = createActivity();
641
481
  const cloneValue = (x) => {
642
- if (_.isArray(x))
482
+ if (___default.default.isArray(x))
643
483
  return x.map(v => cloneValue(v));
644
- if (_.isPlainObject(x))
645
- return _.mapValues(x, v => cloneValue(v));
484
+ if (___default.default.isPlainObject(x))
485
+ return ___default.default.mapValues(x, v => cloneValue(v));
646
486
  return x;
647
487
  };
648
- const useFormState = ({ initialValues, activity, callback, }) => {
488
+ const useFormState = ({ initialValues, activity, callback: callback$1, }) => {
649
489
  const [state, setState] = useState({});
650
490
  const startActivity = useActivity(FormActivity);
651
491
  const [nextTick, setNextTick] = useState([]);
652
- const { setValues, setListeners, perform, } = _useCallbacks({
653
- setValues: (update) => setState(s => ({ ...s, values: _.isFunction(update) ? update(s.values ?? initialValues) : update })),
654
- setListeners: (update) => setState(s => ({ ...s, listeners: _.isFunction(update) ? update(s.listeners ?? []) : update })),
492
+ const { setValues, setListeners, perform, } = callback._useCallbacks({
493
+ setValues: (update) => setState(s => ({ ...s, values: ___default.default.isFunction(update) ? update(s.values ?? initialValues) : update })),
494
+ setListeners: (update) => setState(s => ({ ...s, listeners: ___default.default.isFunction(update) ? update(s.listeners ?? []) : update })),
655
495
  perform: (action) => {
656
496
  const perform = async () => {
657
497
  const taskId = index.uniqueId();
658
498
  const _callback = async (state) => {
659
499
  if (action === 'reset')
660
- setState(s => _.omit(s, 'values'));
661
- await callback(action, state);
500
+ setState(s => ___default.default.omit(s, 'values'));
501
+ await callback$1(action, state);
662
502
  setState(s => ({
663
503
  ...s,
664
504
  count: { ...s.count, [action]: (s.count?.[action] ?? 0) + 1 },
@@ -669,8 +509,8 @@ const useFormState = ({ initialValues, activity, callback, }) => {
669
509
  ...s,
670
510
  loading: { ...s.loading, [action]: [...(s.loading?.[action] ?? []), taskId] },
671
511
  }));
672
- const resolved = await Promise.all(_.map(state.listeners, l => l(action, formState)));
673
- if (_.isEmpty(resolved)) {
512
+ const resolved = await Promise.all(___default.default.map(state.listeners, l => l(action, formState)));
513
+ if (___default.default.isEmpty(resolved)) {
674
514
  await _callback(formState);
675
515
  }
676
516
  else {
@@ -680,58 +520,53 @@ const useFormState = ({ initialValues, activity, callback, }) => {
680
520
  }
681
521
  }
682
522
  catch (error) {
683
- callback('error', formState, error);
523
+ callback$1('error', formState, error);
684
524
  }
685
525
  finally {
686
526
  setState(s => ({
687
527
  ...s,
688
- loading: { ...s.loading, [action]: _.without(s.loading?.[action] ?? [], taskId) },
528
+ loading: { ...s.loading, [action]: ___default.default.without(s.loading?.[action] ?? [], taskId) },
689
529
  }));
690
530
  }
691
531
  };
692
- if (_.isBoolean(activity) ? activity : (activity?.actions?.includes(action) ?? _.isNumber(activity?.delay))) {
693
- return startActivity(perform, _.isBoolean(activity) ? undefined : activity?.delay);
532
+ if (___default.default.isBoolean(activity) ? activity : (activity?.actions?.includes(action) ?? ___default.default.isNumber(activity?.delay))) {
533
+ return startActivity(perform, ___default.default.isBoolean(activity) ? undefined : activity?.delay);
694
534
  }
695
535
  else {
696
536
  return perform();
697
537
  }
698
538
  },
699
539
  });
700
- const formState = useMemo(() => ({
701
- get dirty() { return !_.isNil(state.values); },
540
+ const formState = callback.useMemo(() => ({
541
+ get dirty() { return !___default.default.isNil(state.values); },
702
542
  get values() { return state.values ?? initialValues; },
703
- get loading() { return _.keys(_.pickBy(state.loading, x => !_.isEmpty(x))); },
543
+ get loading() { return ___default.default.keys(___default.default.pickBy(state.loading, x => !___default.default.isEmpty(x))); },
704
544
  get count() { return state.count ?? {}; },
705
545
  get setValues() { return setValues; },
706
- setValue: (path, value) => setValues(values => _.set(cloneValue(values), path, _.isFunction(value) ? value(_.get(values, path)) : value)),
546
+ setValue: (path, value) => setValues(values => ___default.default.set(cloneValue(values), path, ___default.default.isFunction(value) ? value(___default.default.get(values, path)) : value)),
707
547
  perform: (action) => perform(action),
708
548
  addEventListener: (callback) => setListeners(v => [...v, callback]),
709
- removeEventListener: (callback) => setListeners(v => _.filter(v, x => x !== callback)),
549
+ removeEventListener: (callback) => setListeners(v => ___default.default.filter(v, x => x !== callback)),
710
550
  }), [state, initialValues]);
711
551
  useEffect(() => {
712
- if (_.isEmpty(nextTick))
552
+ if (___default.default.isEmpty(nextTick))
713
553
  return;
714
554
  for (const callback of nextTick)
715
555
  callback(formState);
716
- setNextTick(v => _.filter(v, x => _.every(nextTick, c => c !== x)));
556
+ setNextTick(v => ___default.default.filter(v, x => ___default.default.every(nextTick, c => c !== x)));
717
557
  }, [nextTick]);
718
558
  return formState;
719
559
  };
720
560
 
721
561
  exports.FormActivity = FormActivity;
722
562
  exports.ResourceErrors = ResourceErrors;
723
- exports._useCallbacks = _useCallbacks;
724
- exports._useEffect = _useEffect;
725
- exports._useMemo = _useMemo;
726
563
  exports.createActivity = createActivity;
727
564
  exports.useActivity = useActivity;
728
- exports.useCallback = useCallback;
729
565
  exports.useEffect = useEffect;
730
566
  exports.useErrorContext = useErrorContext;
731
567
  exports.useFormState = useFormState;
732
- exports.useMemo = useMemo;
733
568
  exports.useRendererStorage = useRendererStorage;
734
569
  exports.useResourceErrors = useResourceErrors;
735
570
  exports.useState = useState;
736
571
  exports.useSyncExternalStore = useSyncExternalStore;
737
- //# sourceMappingURL=form-BGe5OdHZ.js.map
572
+ //# sourceMappingURL=form-CC8A5nkh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-CC8A5nkh.js","sources":["../../../src/core/hooks/state.ts","../../../src/core/hooks/misc/activity.tsx","../../../src/core/hooks/effect.ts","../../../src/core/hooks/storage.ts","../../../src/core/hooks/misc/resource/error.tsx","../../../src/core/hooks/sync.ts","../../../src/core/hooks/misc/form.ts"],"sourcesContent":["//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\nimport { SetStateAction } from '../types/common';\n\n/**\n * A hook function for managing state within a custom framework or library.\n *\n * @template T - The type of the state value.\n * @param - The initial state value or a function that returns the initial state.\n * @returns - A tuple containing the current state value and a function to update the state.\n *\n * The `useState` function provides a way to manage stateful values. It returns the current state\n * and a setter function that can update the state. The setter function accepts either a new value\n * or a function that receives the current state and returns the updated state.\n *\n * Example:\n * ```typescript\n * const [count, setCount] = useState(0);\n * setCount(5); // Updates the state to 5\n * setCount(prev => prev + 1); // Updates the state to the previous value + 1\n * ```\n */\nexport function useState<T>(initialState: T | (() => T)): [T, (dispatch: SetStateAction<T>) => void];\nexport function useState<T = undefined>(): [T | undefined, (dispatch: SetStateAction<T | undefined>) => void];\n\nexport function useState(initialState?: any) {\n const { value, setValue } = _useMemo('useState', (_state) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n setValue: (dispatch: SetStateAction<any>) => {\n const oldValue = state.value;\n const newValue = _.isFunction(dispatch) ? dispatch(oldValue) : dispatch;\n if (oldValue === newValue) return;\n state.value = newValue;\n _state.setDirty();\n },\n };\n return state;\n }, null);\n return [value, setValue];\n}\n","//\n// activity.tsx\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { useState } from '../state';\nimport { ElementNode, SetStateAction } from '../../types/common';\nimport { Context, createContext, useContext } from '../context';\nimport { createCache, uniqueId } from '../../utils';\nimport { useMemo } from '../memo';\n\ntype ActivityContextValue = {\n setTasks: (dispatch: SetStateAction<string[]>) => void;\n defaultDelay: number;\n};\n\nconst contextMap: WeakMap<any, Context<ActivityContextValue>> = new WeakMap();\nconst dispatchCache = createCache();\n\n/**\n * Creates an activity tracking component that monitors and counts active asynchronous tasks.\n * Returns a component that provides an activity context and renders children with the current task count.\n * \n * @param options - Configuration options for the activity tracker.\n * @param options.defaultDelay - Default delay in milliseconds before a task is considered active.\n * Defaults to 250ms. Set to 0 for immediate tracking.\n * \n * @returns A component that accepts `defaultDelay` (optional override) and `children` \n * (a render function that receives the number of active tasks).\n * \n * @example\n * ```tsx\n * const ActivityIndicator = createActivity({ defaultDelay: 300 });\n * \n * function App() {\n * return (\n * <ActivityIndicator>\n * {(taskCount) => (\n * <div>\n * {taskCount > 0 && <Spinner />}\n * <MyContent />\n * </div>\n * )}\n * </ActivityIndicator>\n * );\n * }\n * ```\n */\nexport const createActivity = ({\n defaultDelay: _defaultDelay = 250,\n}: {\n defaultDelay?: number;\n} = {}) => {\n const Context = createContext<ActivityContextValue>({\n setTasks: () => { },\n defaultDelay: _defaultDelay,\n });\n const component = ({\n defaultDelay = _defaultDelay,\n children,\n }: {\n defaultDelay?: number;\n children: ((tasks: number) => ElementNode);\n }) => {\n const [tasks, setTasks] = useState<string[]>([]);\n const value = useMemo(() => ({ setTasks, defaultDelay }), []);\n return (\n <Context value={value}>\n {children(tasks.length)}\n </Context>\n );\n };\n contextMap.set(component, Context);\n return component;\n};\n\n/**\n * A hook that returns a wrapper function for tracking asynchronous operations as active tasks.\n * Tasks are registered in the activity context created by `createActivity`, allowing parent\n * components to show loading indicators based on the number of active tasks.\n * \n * @template T - The return type of the callback function.\n * @param component - The activity component created by `createActivity`.\n * \n * @returns An async wrapper function that accepts a callback and optional delay override.\n * The wrapper executes the callback while tracking it as an active task.\n * \n * @throws {Error} If the provided component was not created by `createActivity`.\n * \n * @example\n * ```tsx\n * const ActivityIndicator = createActivity({ defaultDelay: 250 });\n * \n * function MyComponent() {\n * const trackActivity = useActivity(ActivityIndicator);\n * \n * const handleClick = async () => {\n * // Task is tracked after 250ms delay (default)\n * const result = await trackActivity(async () => {\n * const response = await fetch('/api/data');\n * return response.json();\n * });\n * console.log(result);\n * };\n * \n * const handleUrgent = async () => {\n * // Task is tracked immediately (0ms delay)\n * await trackActivity(async () => {\n * await criticalOperation();\n * }, 0);\n * };\n * \n * return <button onClick={handleClick}>Load Data</button>;\n * }\n * ```\n */\nexport const useActivity = (component: ReturnType<typeof createActivity>) => {\n const context = contextMap.get(component);\n if (!context) throw new Error('Invalid activity component');\n const store = useContext(context);\n return dispatchCache(store, () => async <T extends any>(callback: () => Awaitable<T>, delay?: number) => {\n const id = uniqueId();\n let timeout;\n const _delay = delay ?? store.defaultDelay;\n if (_.isNumber(_delay) && _delay > 0) {\n timeout = setTimeout(() => {\n store.setTasks(tasks => [...tasks, id]);\n }, _delay);\n } else {\n store.setTasks(tasks => [...tasks, id]);\n }\n try {\n return await callback();\n } finally {\n if (timeout) clearTimeout(timeout);\n store.setTasks(tasks => _.filter(tasks, x => x !== id));\n }\n });\n};","//\n// effect.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { _useEffect } from '../reconciler/hooks';\n\n/**\n * A hook that manages side effects with support for an `AbortSignal`.\n * It ensures proper cleanup logic and handles asynchronous operations effectively.\n *\n * **Use `useEffect` for:**\n * - Registering and cleaning up event listeners\n * - Synchronizing with external APIs/events (browser APIs, third-party libraries)\n * - Performing actions on component mount/unmount\n * - Imperative operations (e.g., focus management, animations, logging)\n *\n * **Do NOT use `useEffect` for:**\n * - Computing UI state → Use `useMemo` instead\n * - Fetching data → Use `useResource` or `useServerResource` instead\n * - Subscribing to external stores → Use `useSyncExternalStore` instead\n * - Deriving state from props → Use `useMemo` or compute during render\n *\n * @param effect - \n * A function that receives an `AbortSignal` and performs side effects. \n * It can optionally return a cleanup function or a promise that resolves to a cleanup function.\n *\n * @param deps - \n * An optional dependencies array that determines when the effect should be re-executed.\n *\n * @example\n * // Register a window event listener\n * useEffect((signal) => {\n * const handleResize = () => {\n * console.log('Window resized:', window.innerWidth);\n * };\n * \n * window.addEventListener('resize', handleResize, { signal });\n * \n * // Cleanup happens automatically via AbortSignal\n * // Optional: return additional cleanup logic if needed\n * return () => {\n * console.log('Component unmounting');\n * };\n * }, []);\n *\n * @example\n * // Perform side effects on mount/unmount\n * useEffect((signal) => {\n * console.log('Component mounted');\n * \n * // Perform initialization work\n * document.title = 'My App';\n * \n * return () => {\n * console.log('Component unmounting, cleanup here');\n * };\n * }, []);\n */\nexport const useEffect = (\n effect: (\n signal: AbortSignal,\n ) => Awaitable<void | (() => Awaitable<void>)>,\n deps?: any,\n) => _useEffect('useEffect', () => {\n const abort = new AbortController();\n try {\n const destructor = effect(abort.signal);\n return () => {\n abort.abort();\n (async () => {\n try {\n const _destructor = await destructor;\n if (_.isFunction(_destructor)) _destructor();\n } catch (e) {\n console.error(e);\n }\n })();\n };\n } catch (e) {\n console.error(e);\n return () => abort.abort();\n }\n}, deps);","//\n// storage.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from '../reconciler';\n\nconst storage = new WeakMap<any, Map<any, any>>();\n\n/**\n * Returns a persistent storage Map associated with the current renderer instance.\n * This hook allows components to store and retrieve values that persist across renders,\n * scoped to the renderer. Must be called within a render function.\n *\n * @throws Error if called outside of a render function.\n * @returns {Map<any, any>} The storage map for the current renderer.\n */\nexport const useRendererStorage = (\n persist = true\n) => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useRendererStorage must be used within a render function.');\n if (!persist) return state.renderer.renderStorage;\n const found = storage.get(state.renderer);\n const store = found ?? new Map<any, any>();\n if (!found) storage.set(state.renderer, store);\n return store;\n};\n","//\n// error.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { ComponentType, PropsWithChildren, SetStateAction } from '../../../types/common';\nimport { createContext } from '../../context';\nimport { useContext } from '../../context';\nimport { useState } from '../../state';\nimport { useMemo } from '../../memo';\nimport { useRendererStorage } from '../../storage';\n\ntype Errors = {\n token: string;\n error: any;\n refresh: () => Awaitable<void>;\n refreshing: boolean;\n loading: boolean;\n}[];\n\ntype ContextValue = {\n errors: Errors;\n setErrors: (values: SetStateAction<Errors>) => void;\n};\n\nconst defaultStorageKey = Symbol();\nconst Context = createContext<ContextValue>();\n\n/**\n * A context provider component for managing asynchronous resource errors.\n * \n * This component provides a shared context for tracking errors encountered during\n * asynchronous operations. It allows child components to access and manage these errors\n * using the `useResourceErrors` hook.\n * \n * ### Usage:\n * Wrap your application or specific parts of it with this component to enable error tracking:\n * \n * ```tsx\n * <ResourceErrors>\n * <YourComponent />\n * </ResourceErrors>\n * ```\n * \n * @param children - The child components that will have access to the error context.\n * \n * @returns A context provider that wraps the provided children.\n */\nexport const ResourceErrors: ComponentType<PropsWithChildren<{}>> = ({\n children\n}) => {\n const [errors, setErrors] = useState<Errors>([]);\n const value = useMemo(() => ({ errors, setErrors }), [errors, setErrors]);\n return (\n <Context value={value}>{children}</Context>\n );\n}\n\nexport const useErrorContext = () => {\n const value = useContext(Context);\n if (value) return value;\n const storage = useRendererStorage();\n const found = storage.get(defaultStorageKey);\n if (found) return found as ContextValue;\n const store: ContextValue = {\n errors: [],\n setErrors: (values: SetStateAction<Errors>) => {\n store.errors = _.isFunction(values) ? values(store.errors) : values;\n },\n };\n storage.set(defaultStorageKey, store);\n return store;\n};\n\n/**\n * A hook to access the list of asynchronous resource errors.\n * \n * This hook allows components to retrieve the current list of errors being tracked\n * in the `ResourceErrors` context. It must be used within a component that is\n * a descendant of the `ResourceErrors` provider.\n * \n * ### Usage:\n * ```tsx\n * import { useEffect, useResourceErrors } from 'frosty';\n * \n * const errors = useResourceErrors();\n * \n * useEffect(() => {\n * errors.forEach(({ token, error, refresh }) => {\n * console.error(`Error [${token}]:`, error);\n * // Optionally call refresh() to retry the operation\n * });\n * }, [errors]);\n * ```\n * \n * @returns The list of errors currently being tracked in the context. Each error includes:\n * - `token`: A unique identifier for the error.\n * - `error`: The error object or message.\n * - `refresh`: A function to retry the operation that caused the error.\n */\nexport const useResourceErrors = () => useErrorContext().errors;\n","//\n// sync.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { _useEffect } from '../reconciler/hooks';\nimport { reconciler } from '../reconciler';\n\n/**\n * A hook utility for synchronizing with an external store.\n *\n * @template Snapshot - The type of the snapshot returned by the store.\n * @param subscribe - A function that sets up a subscription to the external store.\n * - `onStoreChange`: A callback to invoke when the store changes.\n * - `signal`: An `AbortSignal` to handle cleanup when the subscription is no longer needed.\n * - Returns an optional cleanup function or a promise resolving to one.\n * @param getSnapshot - A function that retrieves the current snapshot of the store.\n * @param getServerSnapshot - (Optional) A function that retrieves the snapshot of the store\n * in a server environment.\n * @returns The current snapshot of the store.\n *\n * @throws Will throw an error if used outside of a valid render context.\n */\nexport const useSyncExternalStore = <Snapshot>(\n subscribe: (\n onStoreChange: () => void,\n signal: AbortSignal,\n ) => Awaitable<void | (() => Awaitable<void>)>,\n getSnapshot: () => Snapshot,\n getServerSnapshot?: () => Snapshot,\n) => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useSyncExternalStore must be used within a render function.');\n _useEffect('useSyncExternalStore', (_state) => {\n const abort = new AbortController();\n try {\n const destructor = subscribe(() => { _state.setDirty(); }, abort.signal);\n return () => {\n abort.abort();\n (async () => {\n try {\n const _destructor = await destructor;\n if (_.isFunction(_destructor)) _destructor();\n } catch (e) {\n console.error(e);\n }\n })();\n };\n } catch (e) {\n console.error(e);\n return () => abort.abort();\n }\n }, null);\n if (getServerSnapshot && state.renderer._server) {\n return getServerSnapshot();\n }\n return getSnapshot();\n};","//\n// form.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2026 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { useState } from '../state';\nimport { useMemo } from '../memo';\nimport { SetStateAction } from '../../../core/types/common';\nimport { createActivity, useActivity } from './activity';\nimport { useEffect } from '../effect';\nimport { uniqueId } from '../../../core/utils';\nimport { _useCallbacks } from '../callback';\n\nexport const FormActivity = createActivity();\n\ntype FormAction = 'submit' | 'reset' | string & {};\n\ntype FormState<V extends Record<string, any>> = {\n readonly dirty: boolean;\n readonly values: V;\n readonly loading: string[];\n readonly count: Record<string, number>;\n readonly setValues: (update: SetStateAction<V>) => void;\n setValue: (path: string, value: any) => void;\n perform: (action: FormAction) => Promise<void>;\n addEventListener: (callback: (action: string, state: FormState<V>) => Awaitable<void>) => void;\n removeEventListener: (callback: (action: string, state: FormState<V>) => Awaitable<void>) => void;\n};\n\nconst cloneValue = (x: any): any => {\n if (_.isArray(x)) return x.map(v => cloneValue(v));\n if (_.isPlainObject(x)) return _.mapValues(x, v => cloneValue(v));\n return x;\n};\n\nexport const useFormState = <V extends Record<string, any>>({\n initialValues,\n activity,\n callback,\n}: {\n initialValues: V,\n activity?: boolean | { actions?: string[]; delay?: number; };\n callback: (action: FormAction | 'error', state: FormState<V>, error?: any) => Awaitable<void>,\n}): FormState<V> => {\n const [state, setState] = useState<{\n values?: V;\n loading?: Record<string, string[]>;\n count?: Record<string, number>;\n listeners?: ((action: string, state: FormState<V>) => void)[];\n }>({});\n const startActivity = useActivity(FormActivity);\n const [nextTick, setNextTick] = useState<((state: FormState<V>) => void)[]>([]);\n const {\n setValues,\n setListeners,\n perform,\n } = _useCallbacks({\n setValues: (update: SetStateAction<V>) => setState(s => ({ ...s, values: _.isFunction(update) ? update(s.values ?? initialValues) : update })),\n setListeners: (update: SetStateAction<((action: string, state: FormState<V>) => void)[]>) => setState(s => ({ ...s, listeners: _.isFunction(update) ? update(s.listeners ?? []) : update })),\n perform: (action: string) => {\n const perform = async () => {\n const taskId = uniqueId();\n const _callback = async (state: FormState<V>) => {\n if (action === 'reset') setState(s => _.omit(s, 'values'));\n await callback(action, state);\n setState(s => ({\n ...s,\n count: { ...s.count, [action]: (s.count?.[action] ?? 0) + 1 },\n }))\n };\n try {\n setState(s => ({\n ...s,\n loading: { ...s.loading, [action]: [...(s.loading?.[action] ?? []), taskId] },\n }));\n const resolved = await Promise.all(_.map(state.listeners, l => l(action, formState)));\n if (_.isEmpty(resolved)) {\n await _callback(formState);\n } else {\n await new Promise((resolve, reject) => {\n setNextTick(v => [...v, (formState) => { _callback(formState).then(resolve, reject); }]);\n });\n }\n } catch (error) {\n callback('error', formState, error);\n } finally {\n setState(s => ({\n ...s,\n loading: { ...s.loading, [action]: _.without(s.loading?.[action] ?? [], taskId) },\n }));\n }\n };\n if (_.isBoolean(activity) ? activity : (activity?.actions?.includes(action) ?? _.isNumber(activity?.delay))) {\n return startActivity(perform, _.isBoolean(activity) ? undefined : activity?.delay);\n } else {\n return perform();\n }\n },\n });\n const formState = useMemo(() => ({\n get dirty() { return !_.isNil(state.values) },\n get values() { return state.values ?? initialValues },\n get loading() { return _.keys(_.pickBy(state.loading, x => !_.isEmpty(x))) },\n get count() { return state.count ?? {} },\n get setValues() { return setValues },\n setValue: (path: string, value: any) => setValues(\n values => _.set(cloneValue(values), path, _.isFunction(value) ? value(_.get(values, path)) : value)\n ),\n perform: (action: FormAction) => perform(action),\n addEventListener: (callback: (action: string, state: FormState<V>) => Awaitable<void>) => setListeners(v => [...v, callback]),\n removeEventListener: (callback: (action: string, state: FormState<V>) => Awaitable<void>) => setListeners(v => _.filter(v, x => x !== callback)),\n }), [state, initialValues]);\n useEffect(() => {\n if (_.isEmpty(nextTick)) return;\n for (const callback of nextTick) callback(formState);\n setNextTick(v => _.filter(v, x => _.every(nextTick, c => c !== x)));\n }, [nextTick]);\n return formState;\n};\n"],"names":["_useMemo","_","createCache","createContext","useMemo","_jsx","useContext","uniqueId","_useEffect","reconciler","callback","_useCallbacks"],"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;AA2BM,SAAU,QAAQ,CAAC,YAAkB,EAAA;AACzC,IAAA,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAGA,iBAAQ,CAAC,UAAU,EAAE,CAAC,MAAM,KAAI;AAC1D,QAAA,MAAM,KAAK,GAAG;AACZ,YAAA,KAAK,EAAEC,kBAAC,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,YAAY,EAAE,GAAG,YAAY;AACjE,YAAA,QAAQ,EAAE,CAAC,QAA6B,KAAI;AAC1C,gBAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK;AAC5B,gBAAA,MAAM,QAAQ,GAAGA,kBAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,GA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