frosty 0.0.2 → 0.0.4

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 (59) hide show
  1. package/dist/_native.d.ts +3 -3
  2. package/dist/_native.js +5 -4
  3. package/dist/_native.js.map +1 -1
  4. package/dist/_native.mjs +4 -4
  5. package/dist/_native.mjs.map +1 -1
  6. package/dist/dom.d.ts +3 -3
  7. package/dist/dom.js +4 -4
  8. package/dist/dom.mjs +4 -4
  9. package/dist/index.d.ts +37 -4
  10. package/dist/index.js +53 -4
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.mjs +52 -8
  13. package/dist/index.mjs.map +1 -1
  14. package/dist/internals/{common-D2qumIG-.js → common-B4tIJSMl.js} +2 -2
  15. package/dist/internals/{common-D2qumIG-.js.map → common-B4tIJSMl.js.map} +1 -1
  16. package/dist/internals/{common-BmoFkpvW.d.ts → common-DMvqD6NS.d.ts} +3 -3
  17. package/dist/internals/common-DMvqD6NS.d.ts.map +1 -0
  18. package/dist/internals/{common-De2Ddc8P.mjs → common-NA2Gjnll.mjs} +2 -2
  19. package/dist/internals/{common-De2Ddc8P.mjs.map → common-NA2Gjnll.mjs.map} +1 -1
  20. package/dist/internals/{common-tTif_A6X.d.ts → common-xxkcEb7j.d.ts} +2 -2
  21. package/dist/internals/common-xxkcEb7j.d.ts.map +1 -0
  22. package/dist/internals/{component-DEV8vsnm.mjs → component-B5n5Hl18.mjs} +2 -2
  23. package/dist/internals/{component-DEV8vsnm.mjs.map → component-B5n5Hl18.mjs.map} +1 -1
  24. package/dist/internals/{component-BbXL632k.js → component-DB7Cyozz.js} +2 -1
  25. package/dist/internals/{component-BbXL632k.js.map → component-DB7Cyozz.js.map} +1 -1
  26. package/dist/internals/{fragment-CiP98fWd.d.ts → fragment-DT_iZuu1.d.ts} +2 -2
  27. package/dist/internals/fragment-DT_iZuu1.d.ts.map +1 -0
  28. package/dist/internals/{renderer-CiM3ufRM.d.ts → renderer-CqBUe0mX.d.ts} +2 -2
  29. package/dist/internals/renderer-CqBUe0mX.d.ts.map +1 -0
  30. package/dist/internals/{renderer-B7EH7HAA.mjs → renderer-D6Mow9aT.mjs} +2 -2
  31. package/dist/internals/{renderer-B7EH7HAA.mjs.map → renderer-D6Mow9aT.mjs.map} +1 -1
  32. package/dist/internals/{renderer-D3zwukmJ.js → renderer-DffqnYzl.js} +2 -2
  33. package/dist/internals/{renderer-D3zwukmJ.js.map → renderer-DffqnYzl.js.map} +1 -1
  34. package/dist/internals/{runtime-Bc12AYVQ.mjs → runtime-BN8wmxT_.mjs} +2 -2
  35. package/dist/internals/{runtime-Bc12AYVQ.mjs.map → runtime-BN8wmxT_.mjs.map} +1 -1
  36. package/dist/internals/{runtime-X8YxT6Gi.js → runtime-Cwnkczvh.js} +2 -2
  37. package/dist/internals/{runtime-X8YxT6Gi.js.map → runtime-Cwnkczvh.js.map} +1 -1
  38. package/dist/internals/{sync-BlxufCQn.js → sync-B9y351zF.js} +2 -2
  39. package/dist/internals/{sync-BlxufCQn.js.map → sync-B9y351zF.js.map} +1 -1
  40. package/dist/internals/{sync-BayBMXKm.mjs → sync-DNuAULip.mjs} +3 -3
  41. package/dist/internals/{sync-BayBMXKm.mjs.map → sync-DNuAULip.mjs.map} +1 -1
  42. package/dist/internals/{utils-CJK72Yog.mjs → utils-CLD8n033.mjs} +2 -2
  43. package/dist/internals/{utils-CJK72Yog.mjs.map → utils-CLD8n033.mjs.map} +1 -1
  44. package/dist/internals/{utils-DGp0ZtFY.js → utils-DbbfgpdQ.js} +2 -2
  45. package/dist/internals/{utils-DGp0ZtFY.js.map → utils-DbbfgpdQ.js.map} +1 -1
  46. package/dist/jsx-runtime.d.ts +2 -2
  47. package/dist/jsx-runtime.js +2 -2
  48. package/dist/jsx-runtime.mjs +2 -2
  49. package/dist/server-dom.d.ts +3 -3
  50. package/dist/server-dom.js +4 -4
  51. package/dist/server-dom.mjs +4 -4
  52. package/dist/web.d.ts +1 -1
  53. package/dist/web.js +5 -5
  54. package/dist/web.mjs +5 -5
  55. package/package.json +3 -3
  56. package/dist/internals/common-BmoFkpvW.d.ts.map +0 -1
  57. package/dist/internals/common-tTif_A6X.d.ts.map +0 -1
  58. package/dist/internals/fragment-CiP98fWd.d.ts.map +0 -1
  59. package/dist/internals/renderer-CiM3ufRM.d.ts.map +0 -1
package/dist/_native.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { N as NativeElementType, c as PropsType, b as ComponentNode } from './internals/common-tTif_A6X.js';
2
- export { _ as _Renderer } from './internals/renderer-CiM3ufRM.js';
1
+ import { N as NativeElementType, c as PropsType, b as ComponentNode } from './internals/common-xxkcEb7j.js';
2
+ export { _ as _Renderer } from './internals/renderer-CqBUe0mX.js';
3
3
  import '@o2ter/utils-js';
4
4
  import 'lodash';
5
5
  import 'csstype';
6
6
 
7
7
  declare function _createNativeElement(type: NativeElementType, props: PropsType, key?: string | number): ComponentNode;
8
8
 
9
- export { _createNativeElement };
9
+ export { NativeElementType, _createNativeElement };
10
10
  //# sourceMappingURL=_native.d.ts.map
package/dist/_native.js CHANGED
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var runtime = require('./internals/runtime-X8YxT6Gi.js');
4
- var renderer = require('./internals/renderer-D3zwukmJ.js');
5
- require('./internals/component-BbXL632k.js');
3
+ var runtime = require('./internals/runtime-Cwnkczvh.js');
4
+ var renderer = require('./internals/renderer-DffqnYzl.js');
5
+ var component = require('./internals/component-DB7Cyozz.js');
6
6
  require('lodash');
7
- require('./internals/utils-DGp0ZtFY.js');
7
+ require('./internals/utils-DbbfgpdQ.js');
8
8
  require('myers.js');
9
9
  require('nextick');
10
10
 
@@ -37,5 +37,6 @@ function _createNativeElement(type, props, key) {
37
37
  }
38
38
 
39
39
  exports._Renderer = renderer._Renderer;
40
+ exports.NativeElementType = component.NativeElementType;
40
41
  exports._createNativeElement = _createNativeElement;
41
42
  //# sourceMappingURL=_native.js.map
@@ -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';\nexport { _Renderer } from '../core/renderer';\n\nexport function _createNativeElement(\n type: 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;SAMgB,oBAAoB,CAClC,IAAuB,EACvB,KAAgB,EAChB,GAAqB,EAAA;IAErB,OAAOA,sBAAc,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC;AAChD;;;;;"}
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';\nexport { _Renderer } from '../core/renderer';\nexport { NativeElementType } from '../core/types/component';\n\nexport function _createNativeElement(\n type: 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;SAOgB,oBAAoB,CAClC,IAAuB,EACvB,KAAgB,EAChB,GAAqB,EAAA;IAErB,OAAOA,sBAAc,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC;AAChD;;;;;;"}
package/dist/_native.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { _ as _createElement } from './internals/runtime-Bc12AYVQ.mjs';
2
- export { _ as _Renderer } from './internals/renderer-B7EH7HAA.mjs';
3
- import './internals/component-DEV8vsnm.mjs';
1
+ import { _ as _createElement } from './internals/runtime-BN8wmxT_.mjs';
2
+ export { _ as _Renderer } from './internals/renderer-D6Mow9aT.mjs';
3
+ export { N as NativeElementType } from './internals/component-B5n5Hl18.mjs';
4
4
  import 'lodash';
5
- import './internals/utils-CJK72Yog.mjs';
5
+ import './internals/utils-CLD8n033.mjs';
6
6
  import 'myers.js';
7
7
  import 'nextick';
8
8
 
@@ -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';\nexport { _Renderer } from '../core/renderer';\n\nexport function _createNativeElement(\n type: 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;SAMgB,oBAAoB,CAClC,IAAuB,EACvB,KAAgB,EAChB,GAAqB,EAAA;IAErB,OAAO,cAAc,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC;AAChD;;;;"}
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';\nexport { _Renderer } from '../core/renderer';\nexport { NativeElementType } from '../core/types/component';\n\nexport function _createNativeElement(\n type: 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;SAOgB,oBAAoB,CAClC,IAAuB,EACvB,KAAgB,EAChB,GAAqB,EAAA;IAErB,OAAO,cAAc,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC;AAChD;;;;"}
package/dist/dom.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { _ as _DOMRenderer } from './internals/common-BmoFkpvW.js';
2
- import './internals/common-tTif_A6X.js';
1
+ import { _ as _DOMRenderer } from './internals/common-DMvqD6NS.js';
2
+ import './internals/common-xxkcEb7j.js';
3
3
  import '@o2ter/utils-js';
4
4
  import 'lodash';
5
5
  import 'csstype';
6
- import './internals/renderer-CiM3ufRM.js';
6
+ import './internals/renderer-CqBUe0mX.js';
7
7
 
8
8
  declare class DOMRenderer extends _DOMRenderer {
9
9
  static default: DOMRenderer;
package/dist/dom.js CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var common = require('./internals/common-D2qumIG-.js');
3
+ var common = require('./internals/common-B4tIJSMl.js');
4
4
  require('lodash');
5
5
  require('myers.js');
6
- require('./internals/renderer-D3zwukmJ.js');
7
- require('./internals/utils-DGp0ZtFY.js');
8
- require('./internals/component-BbXL632k.js');
6
+ require('./internals/renderer-DffqnYzl.js');
7
+ require('./internals/utils-DbbfgpdQ.js');
8
+ require('./internals/component-DB7Cyozz.js');
9
9
  require('nextick');
10
10
  require('postcss');
11
11
  require('postcss-js');
package/dist/dom.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { _ as _DOMRenderer } from './internals/common-De2Ddc8P.mjs';
1
+ import { _ as _DOMRenderer } from './internals/common-NA2Gjnll.mjs';
2
2
  import 'lodash';
3
3
  import 'myers.js';
4
- import './internals/renderer-B7EH7HAA.mjs';
5
- import './internals/utils-CJK72Yog.mjs';
6
- import './internals/component-DEV8vsnm.mjs';
4
+ import './internals/renderer-D6Mow9aT.mjs';
5
+ import './internals/utils-CLD8n033.mjs';
6
+ import './internals/component-B5n5Hl18.mjs';
7
7
  import 'nextick';
8
8
  import 'postcss';
9
9
  import 'postcss-js';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import { C as ComponentType, E as ElementNode, R as RefObject, a as Ref, S as SetStateAction, b as ComponentNode, P as PropsWithChildren, _ as _ElementType, N as NativeElementType, c as PropsType } from './internals/common-tTif_A6X.js';
2
- export { f as ComponentProps, g as ComponentPropsWithoutRef, i as ComponentRef, e as RefAttribute, h as RefCallback, d as createElement } from './internals/common-tTif_A6X.js';
1
+ import { C as ComponentType, E as ElementNode, R as RefObject, a as Ref, S as SetStateAction, b as ComponentNode, P as PropsWithChildren, _ as _ElementType, N as NativeElementType, c as PropsType, d as ComponentProps, e as ComponentPropsWithoutRef, f as ComponentRef, g as RefAttribute, h as RefCallback, i as createElement } from './internals/common-xxkcEb7j.js';
3
2
  import { Awaitable } from '@o2ter/utils-js';
4
- export { F as Fragment } from './internals/fragment-CiP98fWd.js';
3
+ import { F as Fragment } from './internals/fragment-DT_iZuu1.js';
5
4
  import 'lodash';
6
5
  import 'csstype';
7
6
 
@@ -215,5 +214,39 @@ declare const PropsProvider: ComponentType<PropsProviderProps>;
215
214
 
216
215
  declare const mergeRefs: <T>(...refs: Ref<T>[]) => (x: T) => void;
217
216
 
218
- export { ComponentNode, ComponentType, type Context, type ContextType, ElementNode, _ElementType as ElementType, ErrorBoundary, PropsProvider, PropsWithChildren, Ref, RefObject, SetStateAction, createContext, mergeRefs, useCallback, useContext, useEffect, useMemo, useReducer, useRef, useRefHandle, useStack, useState, useSyncExternalStore };
217
+ declare const common_ComponentNode: typeof ComponentNode;
218
+ declare const common_ComponentProps: typeof ComponentProps;
219
+ declare const common_ComponentPropsWithoutRef: typeof ComponentPropsWithoutRef;
220
+ declare const common_ComponentRef: typeof ComponentRef;
221
+ declare const common_ComponentType: typeof ComponentType;
222
+ type common_Context<Value> = Context<Value>;
223
+ type common_ContextType<C extends Context<any>> = ContextType<C>;
224
+ declare const common_ElementNode: typeof ElementNode;
225
+ declare const common_ErrorBoundary: typeof ErrorBoundary;
226
+ declare const common_Fragment: typeof Fragment;
227
+ declare const common_PropsProvider: typeof PropsProvider;
228
+ declare const common_PropsWithChildren: typeof PropsWithChildren;
229
+ declare const common_Ref: typeof Ref;
230
+ declare const common_RefAttribute: typeof RefAttribute;
231
+ declare const common_RefCallback: typeof RefCallback;
232
+ declare const common_RefObject: typeof RefObject;
233
+ declare const common_SetStateAction: typeof SetStateAction;
234
+ declare const common_createContext: typeof createContext;
235
+ declare const common_createElement: typeof createElement;
236
+ declare const common_mergeRefs: typeof mergeRefs;
237
+ declare const common_useCallback: typeof useCallback;
238
+ declare const common_useContext: typeof useContext;
239
+ declare const common_useEffect: typeof useEffect;
240
+ declare const common_useMemo: typeof useMemo;
241
+ declare const common_useReducer: typeof useReducer;
242
+ declare const common_useRef: typeof useRef;
243
+ declare const common_useRefHandle: typeof useRefHandle;
244
+ declare const common_useStack: typeof useStack;
245
+ declare const common_useState: typeof useState;
246
+ declare const common_useSyncExternalStore: typeof useSyncExternalStore;
247
+ declare namespace common {
248
+ export { common_ComponentNode as ComponentNode, common_ComponentProps as ComponentProps, common_ComponentPropsWithoutRef as ComponentPropsWithoutRef, common_ComponentRef as ComponentRef, common_ComponentType as ComponentType, type common_Context as Context, type common_ContextType as ContextType, common_ElementNode as ElementNode, _ElementType as ElementType, common_ErrorBoundary as ErrorBoundary, common_Fragment as Fragment, common_PropsProvider as PropsProvider, common_PropsWithChildren as PropsWithChildren, common_Ref as Ref, common_RefAttribute as RefAttribute, common_RefCallback as RefCallback, common_RefObject as RefObject, common_SetStateAction as SetStateAction, common_createContext as createContext, common_createElement as createElement, common_mergeRefs as mergeRefs, common_useCallback as useCallback, common_useContext as useContext, common_useEffect as useEffect, common_useMemo as useMemo, common_useReducer as useReducer, common_useRef as useRef, common_useRefHandle as useRefHandle, common_useStack as useStack, common_useState as useState, common_useSyncExternalStore as useSyncExternalStore };
249
+ }
250
+
251
+ export { ComponentNode, ComponentProps, ComponentPropsWithoutRef, ComponentRef, ComponentType, type Context, type ContextType, ElementNode, _ElementType as ElementType, ErrorBoundary, Fragment, PropsProvider, PropsWithChildren, Ref, RefAttribute, RefCallback, RefObject, SetStateAction, createContext, createElement, common as default, mergeRefs, useCallback, useContext, useEffect, useMemo, useReducer, useRef, useRefHandle, useStack, useState, useSyncExternalStore };
219
252
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,11 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var sync = require('./internals/sync-BlxufCQn.js');
4
- var utils = require('./internals/utils-DGp0ZtFY.js');
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var sync = require('./internals/sync-B9y351zF.js');
6
+ var utils = require('./internals/utils-DbbfgpdQ.js');
5
7
  var _ = require('lodash');
6
- var component = require('./internals/component-BbXL632k.js');
8
+ var component = require('./internals/component-DB7Cyozz.js');
7
9
  var fragment = require('./internals/fragment-B0rB4qEp.js');
8
- var runtime = require('./internals/runtime-X8YxT6Gi.js');
10
+ var runtime = require('./internals/runtime-Cwnkczvh.js');
9
11
  require('myers.js');
10
12
 
11
13
  //
@@ -213,6 +215,52 @@ function useReducer(reducer, initialState) {
213
215
  return [value, dispatch];
214
216
  }
215
217
 
218
+ //
219
+ // common.ts
220
+ //
221
+ // The MIT License
222
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
223
+ //
224
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
225
+ // of this software and associated documentation files (the "Software"), to deal
226
+ // in the Software without restriction, including without limitation the rights
227
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
228
+ // copies of the Software, and to permit persons to whom the Software is
229
+ // furnished to do so, subject to the following conditions:
230
+ //
231
+ // The above copyright notice and this permission notice shall be included in
232
+ // all copies or substantial portions of the Software.
233
+ //
234
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
235
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
236
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
237
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
238
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
239
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
240
+ // THE SOFTWARE.
241
+ //
242
+
243
+ var common = /*#__PURE__*/Object.freeze({
244
+ __proto__: null,
245
+ ComponentNode: component.ComponentNode,
246
+ ErrorBoundary: utils.ErrorBoundary,
247
+ Fragment: fragment.Fragment,
248
+ PropsProvider: utils.PropsProvider,
249
+ createContext: utils.createContext,
250
+ createElement: runtime.createElement,
251
+ mergeRefs: utils.mergeRefs,
252
+ useCallback: sync.useCallback,
253
+ useContext: utils.useContext,
254
+ useEffect: sync.useEffect,
255
+ useMemo: useMemo,
256
+ useReducer: useReducer,
257
+ useRef: useRef,
258
+ useRefHandle: useRefHandle,
259
+ useStack: useStack,
260
+ useState: useState,
261
+ useSyncExternalStore: sync.useSyncExternalStore
262
+ });
263
+
216
264
  exports.useCallback = sync.useCallback;
217
265
  exports.useEffect = sync.useEffect;
218
266
  exports.useSyncExternalStore = sync.useSyncExternalStore;
@@ -224,6 +272,7 @@ exports.useContext = utils.useContext;
224
272
  exports.ComponentNode = component.ComponentNode;
225
273
  exports.Fragment = fragment.Fragment;
226
274
  exports.createElement = runtime.createElement;
275
+ exports.default = common;
227
276
  exports.useMemo = useMemo;
228
277
  exports.useReducer = useReducer;
229
278
  exports.useRef = useRef;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/core/hooks/memo.ts","../../src/core/hooks/ref.ts","../../src/core/hooks/state.ts","../../src/core/hooks/stack.ts","../../src/core/hooks/reducer.ts"],"sourcesContent":["//\n// memo.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 { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that memoizes the result of a factory function.\n * \n * @template T The type of the value returned by the factory function.\n * @param factory A function that produces a value to be memoized.\n * @param deps An optional dependency array. The memoized value is recalculated \n * only when the dependencies change.\n * @returns The memoized value produced by the factory function.\n */\nexport const useMemo = <T>(\n factory: () => T,\n deps?: any,\n) => _useMemo('useMemo', factory, deps);\n","//\n// memo.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 { _useEffect, _useMemo } from '../reconciler/hooks';\nimport { Ref, RefObject } from '../types/common';\n\n/**\n * Creates a mutable reference object that persists across function calls.\n * \n * @template T The type of the value stored in the reference.\n * @param initialValue The initial value to store in the reference.\n * @returns An object with a `current` property that holds the value.\n */\nexport function useRef<T>(initialValue: T): RefObject<T>;\nexport function useRef<T = undefined>(): RefObject<T | undefined>;\n\nexport function useRef(initialValue?: any) {\n return _useMemo('useRef', () => ({ current: initialValue }), null);\n}\n\n/**\n * Associates a reference with a value created by an initializer function.\n * \n * @template T The type of the reference.\n * @template R The type of the value created by the initializer function.\n * @param ref A reference object or a callback function to receive the value.\n * @param init A function that initializes and returns the value to associate with the reference.\n * @param deps An optional dependency array. The initializer function is re-executed when the dependencies change.\n */\nexport const useRefHandle = <T, R extends T>(\n ref: Ref<T> | undefined,\n init: () => R,\n deps?: any\n) => _useEffect('useRefHandle', () => {\n try {\n if (ref) {\n const _ref = init();\n if (typeof ref === 'function') ref(_ref);\n else if (typeof ref === 'object') ref.current = _ref;\n }\n return () => void 0;\n } catch (e) {\n console.error(e);\n return () => void 0;\n }\n}, deps);","//\n// memo.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 { _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', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n setValue: (dispatch: SetStateAction<any>) => {\n state.value = _.isFunction(dispatch) ? dispatch(state.value) : dispatch;\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, setValue];\n}\n","//\n// stack.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 { reconciler } from '../reconciler/state';\n\n/**\n * Retrieves the stack of parent components from the current hook state.\n *\n * This function accesses the current hook state and extracts the stack of \n * parent components. It throws an error if called outside of a valid render \n * context.\n *\n * @returns An array of parent components from the current hook state.\n * @throws Will throw an error if the function is called outside of a valid render context.\n */\nexport const useStack = () => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useStack must be used within a render function.');\n return _.map(state.stack, x => x._component);\n}\n","//\n// reducer.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 { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that manages state using a reducer pattern.\n * \n * @template T The type of the state.\n * @template A The type of the action object (optional).\n * @param reducer A function that takes the current state and an action, and returns the new state.\n * @param initialState The initial state value or a function that returns the initial state.\n * @returns A tuple containing the current state and a dispatch function to update the state.\n */\nexport function useReducer<T>(\n reducer: (prevState: T) => T,\n initialState: T | (() => T),\n): [T, (dispatch: () => void) => void];\n\nexport function useReducer<T, A = any>(\n reducer: (prevState: T, action: A) => T,\n initialState: T | (() => T),\n): [T, (dispatch: (action: A) => void) => void];\n\nexport function useReducer<T = undefined>(\n reducer: (prevState: T | undefined) => T | undefined\n): [T | undefined, (dispatch: () => void) => void];\n\nexport function useReducer<T = undefined, A = any>(\n reducer: (prevState: T | undefined, action: A) => T | undefined\n): [T | undefined, (dispatch: (action: A) => void) => void];\n\nexport function useReducer(\n reducer: (prevState: any, action?: any) => any,\n initialState?: any,\n) {\n const { value, dispatch } = _useMemo('useReducer', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n dispatch: (action?: any) => {\n state.value = reducer(state.value, action);\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, dispatch];\n}\n"],"names":["_useMemo","_useEffect","reconciler"],"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;AAKA;;;;;;;;AAQG;AACU,MAAA,OAAO,GAAG,CACrB,OAAgB,EAChB,IAAU,KACPA,aAAQ,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI;;ACxCtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBM,SAAU,MAAM,CAAC,YAAkB,EAAA;AACvC,IAAA,OAAOA,aAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,IAAI,CAAC;AACpE;AAEA;;;;;;;;AAQG;AACU,MAAA,YAAY,GAAG,CAC1B,GAAuB,EACvB,IAAa,EACb,IAAU,KACPC,eAAU,CAAC,cAAc,EAAE,MAAK;AACnC,IAAA,IAAI;QACF,IAAI,GAAG,EAAE;AACP,YAAA,MAAM,IAAI,GAAG,IAAI,EAAE;YACnB,IAAI,OAAO,GAAG,KAAK,UAAU;gBAAE,GAAG,CAAC,IAAI,CAAC;iBACnC,IA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AAiD,CAAC;AAC1E,IAAA,OAAO,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC;AAC9C;;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgCgB,SAAA,UAAU,CACxB,OAA8C,EAC9C,YAAkB,EAAA;AAElB,IAAA,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAGF,aAAQ,CAAC,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,KAAI;AAC9D,QAAA,MAAM,KAAK,GAAG;AACZ,YAAA,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,YAAY,EAAE,GAAG,YAAY;AACjE,YAAA,QAAQ,EAAE,CAAC,MAAY,KAAI;gBACzB,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC;gBAC1C,IAAI,EAAE,SAAS,EAAE;aAClB;SACF;AACD,QAAA,OAAO,KAAK;KACb,EAAE,IAAI,CAAC;AACR,IAAA,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC;AAC1B;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/core/hooks/memo.ts","../../src/core/hooks/ref.ts","../../src/core/hooks/state.ts","../../src/core/hooks/stack.ts","../../src/core/hooks/reducer.ts","../../src/common.ts"],"sourcesContent":["//\n// memo.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 { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that memoizes the result of a factory function.\n * \n * @template T The type of the value returned by the factory function.\n * @param factory A function that produces a value to be memoized.\n * @param deps An optional dependency array. The memoized value is recalculated \n * only when the dependencies change.\n * @returns The memoized value produced by the factory function.\n */\nexport const useMemo = <T>(\n factory: () => T,\n deps?: any,\n) => _useMemo('useMemo', factory, deps);\n","//\n// memo.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 { _useEffect, _useMemo } from '../reconciler/hooks';\nimport { Ref, RefObject } from '../types/common';\n\n/**\n * Creates a mutable reference object that persists across function calls.\n * \n * @template T The type of the value stored in the reference.\n * @param initialValue The initial value to store in the reference.\n * @returns An object with a `current` property that holds the value.\n */\nexport function useRef<T>(initialValue: T): RefObject<T>;\nexport function useRef<T = undefined>(): RefObject<T | undefined>;\n\nexport function useRef(initialValue?: any) {\n return _useMemo('useRef', () => ({ current: initialValue }), null);\n}\n\n/**\n * Associates a reference with a value created by an initializer function.\n * \n * @template T The type of the reference.\n * @template R The type of the value created by the initializer function.\n * @param ref A reference object or a callback function to receive the value.\n * @param init A function that initializes and returns the value to associate with the reference.\n * @param deps An optional dependency array. The initializer function is re-executed when the dependencies change.\n */\nexport const useRefHandle = <T, R extends T>(\n ref: Ref<T> | undefined,\n init: () => R,\n deps?: any\n) => _useEffect('useRefHandle', () => {\n try {\n if (ref) {\n const _ref = init();\n if (typeof ref === 'function') ref(_ref);\n else if (typeof ref === 'object') ref.current = _ref;\n }\n return () => void 0;\n } catch (e) {\n console.error(e);\n return () => void 0;\n }\n}, deps);","//\n// memo.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 { _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', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n setValue: (dispatch: SetStateAction<any>) => {\n state.value = _.isFunction(dispatch) ? dispatch(state.value) : dispatch;\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, setValue];\n}\n","//\n// stack.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 { reconciler } from '../reconciler/state';\n\n/**\n * Retrieves the stack of parent components from the current hook state.\n *\n * This function accesses the current hook state and extracts the stack of \n * parent components. It throws an error if called outside of a valid render \n * context.\n *\n * @returns An array of parent components from the current hook state.\n * @throws Will throw an error if the function is called outside of a valid render context.\n */\nexport const useStack = () => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useStack must be used within a render function.');\n return _.map(state.stack, x => x._component);\n}\n","//\n// reducer.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 { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that manages state using a reducer pattern.\n * \n * @template T The type of the state.\n * @template A The type of the action object (optional).\n * @param reducer A function that takes the current state and an action, and returns the new state.\n * @param initialState The initial state value or a function that returns the initial state.\n * @returns A tuple containing the current state and a dispatch function to update the state.\n */\nexport function useReducer<T>(\n reducer: (prevState: T) => T,\n initialState: T | (() => T),\n): [T, (dispatch: () => void) => void];\n\nexport function useReducer<T, A = any>(\n reducer: (prevState: T, action: A) => T,\n initialState: T | (() => T),\n): [T, (dispatch: (action: A) => void) => void];\n\nexport function useReducer<T = undefined>(\n reducer: (prevState: T | undefined) => T | undefined\n): [T | undefined, (dispatch: () => void) => void];\n\nexport function useReducer<T = undefined, A = any>(\n reducer: (prevState: T | undefined, action: A) => T | undefined\n): [T | undefined, (dispatch: (action: A) => void) => void];\n\nexport function useReducer(\n reducer: (prevState: any, action?: any) => any,\n initialState?: any,\n) {\n const { value, dispatch } = _useMemo('useReducer', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n dispatch: (action?: any) => {\n state.value = reducer(state.value, action);\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, dispatch];\n}\n","//\n// common.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\nexport * from './core/types/common';\nexport { useEffect } from './core/hooks/effect';\nexport { useContext } from './core/hooks/context';\nexport { useMemo } from './core/hooks/memo';\nexport { useRef, useRefHandle } from './core/hooks/ref';\nexport { useCallback } from './core/hooks/callback';\nexport { useState } from './core/hooks/state';\nexport { useStack } from './core/hooks/stack';\nexport { useReducer } from './core/hooks/reducer';\nexport { useSyncExternalStore } from './core/hooks/sync';\nexport { ComponentNode } from './core/types/component';\nexport { Context, ContextType, createContext } from './core/types/context';\nexport { ErrorBoundary } from './core/types/error';\nexport { Fragment } from './core/types/fragment';\nexport { PropsProvider } from './core/types/props';\nexport { _ElementType as ElementType, createElement } from './core/types/runtime';\nexport { mergeRefs } from './core/utils';\n"],"names":["_useMemo","_useEffect","reconciler"],"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;AAKA;;;;;;;;AAQG;AACU,MAAA,OAAO,GAAG,CACrB,OAAgB,EAChB,IAAU,KACPA,aAAQ,CAAC,SAAS,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AAI,EAAE,SAAS,EAAE;aAClB;SACF;AACD,QAAA,OAAO,KAAK;KACb,EAAE,IAAI,CAAC;AACR,IAAA,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC;AAC1B;;ACtEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.mjs CHANGED
@@ -1,11 +1,9 @@
1
- import { _ as _useMemo, a as _useEffect } from './internals/sync-BayBMXKm.mjs';
2
- export { b as useCallback, u as useEffect, c as useSyncExternalStore } from './internals/sync-BayBMXKm.mjs';
3
- import { r as reconciler } from './internals/utils-CJK72Yog.mjs';
4
- export { E as ErrorBoundary, P as PropsProvider, c as createContext, m as mergeRefs, u as useContext } from './internals/utils-CJK72Yog.mjs';
1
+ import { _ as _useMemo, a as _useEffect, u as useCallback, b as useEffect, c as useSyncExternalStore } from './internals/sync-DNuAULip.mjs';
2
+ import { r as reconciler, E as ErrorBoundary, P as PropsProvider, c as createContext, m as mergeRefs, u as useContext } from './internals/utils-CLD8n033.mjs';
5
3
  import _ from 'lodash';
6
- export { C as ComponentNode } from './internals/component-DEV8vsnm.mjs';
7
- export { F as Fragment } from './internals/fragment-DPs1AriN.mjs';
8
- export { c as createElement } from './internals/runtime-Bc12AYVQ.mjs';
4
+ import { C as ComponentNode } from './internals/component-B5n5Hl18.mjs';
5
+ import { F as Fragment } from './internals/fragment-DPs1AriN.mjs';
6
+ import { c as createElement } from './internals/runtime-BN8wmxT_.mjs';
9
7
  import 'myers.js';
10
8
 
11
9
  //
@@ -213,5 +211,51 @@ function useReducer(reducer, initialState) {
213
211
  return [value, dispatch];
214
212
  }
215
213
 
216
- export { useMemo, useReducer, useRef, useRefHandle, useStack, useState };
214
+ //
215
+ // common.ts
216
+ //
217
+ // The MIT License
218
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
219
+ //
220
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
221
+ // of this software and associated documentation files (the "Software"), to deal
222
+ // in the Software without restriction, including without limitation the rights
223
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
224
+ // copies of the Software, and to permit persons to whom the Software is
225
+ // furnished to do so, subject to the following conditions:
226
+ //
227
+ // The above copyright notice and this permission notice shall be included in
228
+ // all copies or substantial portions of the Software.
229
+ //
230
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
231
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
232
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
233
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
234
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
235
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
236
+ // THE SOFTWARE.
237
+ //
238
+
239
+ var common = /*#__PURE__*/Object.freeze({
240
+ __proto__: null,
241
+ ComponentNode: ComponentNode,
242
+ ErrorBoundary: ErrorBoundary,
243
+ Fragment: Fragment,
244
+ PropsProvider: PropsProvider,
245
+ createContext: createContext,
246
+ createElement: createElement,
247
+ mergeRefs: mergeRefs,
248
+ useCallback: useCallback,
249
+ useContext: useContext,
250
+ useEffect: useEffect,
251
+ useMemo: useMemo,
252
+ useReducer: useReducer,
253
+ useRef: useRef,
254
+ useRefHandle: useRefHandle,
255
+ useStack: useStack,
256
+ useState: useState,
257
+ useSyncExternalStore: useSyncExternalStore
258
+ });
259
+
260
+ export { ComponentNode, ErrorBoundary, Fragment, PropsProvider, createContext, createElement, common as default, mergeRefs, useCallback, useContext, useEffect, useMemo, useReducer, useRef, useRefHandle, useStack, useState, useSyncExternalStore };
217
261
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/core/hooks/memo.ts","../../src/core/hooks/ref.ts","../../src/core/hooks/state.ts","../../src/core/hooks/stack.ts","../../src/core/hooks/reducer.ts"],"sourcesContent":["//\n// memo.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 { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that memoizes the result of a factory function.\n * \n * @template T The type of the value returned by the factory function.\n * @param factory A function that produces a value to be memoized.\n * @param deps An optional dependency array. The memoized value is recalculated \n * only when the dependencies change.\n * @returns The memoized value produced by the factory function.\n */\nexport const useMemo = <T>(\n factory: () => T,\n deps?: any,\n) => _useMemo('useMemo', factory, deps);\n","//\n// memo.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 { _useEffect, _useMemo } from '../reconciler/hooks';\nimport { Ref, RefObject } from '../types/common';\n\n/**\n * Creates a mutable reference object that persists across function calls.\n * \n * @template T The type of the value stored in the reference.\n * @param initialValue The initial value to store in the reference.\n * @returns An object with a `current` property that holds the value.\n */\nexport function useRef<T>(initialValue: T): RefObject<T>;\nexport function useRef<T = undefined>(): RefObject<T | undefined>;\n\nexport function useRef(initialValue?: any) {\n return _useMemo('useRef', () => ({ current: initialValue }), null);\n}\n\n/**\n * Associates a reference with a value created by an initializer function.\n * \n * @template T The type of the reference.\n * @template R The type of the value created by the initializer function.\n * @param ref A reference object or a callback function to receive the value.\n * @param init A function that initializes and returns the value to associate with the reference.\n * @param deps An optional dependency array. The initializer function is re-executed when the dependencies change.\n */\nexport const useRefHandle = <T, R extends T>(\n ref: Ref<T> | undefined,\n init: () => R,\n deps?: any\n) => _useEffect('useRefHandle', () => {\n try {\n if (ref) {\n const _ref = init();\n if (typeof ref === 'function') ref(_ref);\n else if (typeof ref === 'object') ref.current = _ref;\n }\n return () => void 0;\n } catch (e) {\n console.error(e);\n return () => void 0;\n }\n}, deps);","//\n// memo.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 { _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', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n setValue: (dispatch: SetStateAction<any>) => {\n state.value = _.isFunction(dispatch) ? dispatch(state.value) : dispatch;\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, setValue];\n}\n","//\n// stack.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 { reconciler } from '../reconciler/state';\n\n/**\n * Retrieves the stack of parent components from the current hook state.\n *\n * This function accesses the current hook state and extracts the stack of \n * parent components. It throws an error if called outside of a valid render \n * context.\n *\n * @returns An array of parent components from the current hook state.\n * @throws Will throw an error if the function is called outside of a valid render context.\n */\nexport const useStack = () => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useStack must be used within a render function.');\n return _.map(state.stack, x => x._component);\n}\n","//\n// reducer.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 { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that manages state using a reducer pattern.\n * \n * @template T The type of the state.\n * @template A The type of the action object (optional).\n * @param reducer A function that takes the current state and an action, and returns the new state.\n * @param initialState The initial state value or a function that returns the initial state.\n * @returns A tuple containing the current state and a dispatch function to update the state.\n */\nexport function useReducer<T>(\n reducer: (prevState: T) => T,\n initialState: T | (() => T),\n): [T, (dispatch: () => void) => void];\n\nexport function useReducer<T, A = any>(\n reducer: (prevState: T, action: A) => T,\n initialState: T | (() => T),\n): [T, (dispatch: (action: A) => void) => void];\n\nexport function useReducer<T = undefined>(\n reducer: (prevState: T | undefined) => T | undefined\n): [T | undefined, (dispatch: () => void) => void];\n\nexport function useReducer<T = undefined, A = any>(\n reducer: (prevState: T | undefined, action: A) => T | undefined\n): [T | undefined, (dispatch: (action: A) => void) => void];\n\nexport function useReducer(\n reducer: (prevState: any, action?: any) => any,\n initialState?: any,\n) {\n const { value, dispatch } = _useMemo('useReducer', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n dispatch: (action?: any) => {\n state.value = reducer(state.value, action);\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, dispatch];\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;AAKA;;;;;;;;AAQG;AACU,MAAA,OAAO,GAAG,CACrB,OAAgB,EAChB,IAAU,KACP,QAAQ,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI;;ACxCtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBM,SAAU,MAAM,CAAC,YAAkB,EAAA;AACvC,IAAA,OAAO,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,IAAI,CAAC;AACpE;AAEA;;;;;;;;AAQG;AACU,MAAA,YAAY,GAAG,CAC1B,GAAuB,EACvB,IAAa,EACb,IAAU,KACP,UAAU,CAAC,cAAc,EAAE,MAAK;AACnC,IAAA,IAAI;QACF,IAAI,GAAG,EAAE;AACP,YAAA,MAAM,IAAI,GAAG,IAAI,EAAE;YACnB,IAAI,OAAO,GAAG,KAAK,UAAU;gBAAE,GAAG,CAAC,IAAI,CAAC;iBACnC,IAAI,OAAO,GAAG,KAAK,QAAQ;AAAE,gBAAA,GAAG,CAAC,OAAO,GAAG,IAAI;;AAEtD,QAAA,OAAO,MAAM,KAAK,CAAC;;IACnB,OAAO,CAAC,EAAE;AACV,QAAA,OA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgCgB,SAAA,UAAU,CACxB,OAA8C,EAC9C,YAAkB,EAAA;AAElB,IAAA,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,KAAI;AAC9D,QAAA,MAAM,KAAK,GAAG;AACZ,YAAA,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,YAAY,EAAE,GAAG,YAAY;AACjE,YAAA,QAAQ,EAAE,CAAC,MAAY,KAAI;gBACzB,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC;gBAC1C,IAAI,EAAE,SAAS,EAAE;aAClB;SACF;AACD,QAAA,OAAO,KAAK;KACb,EAAE,IAAI,CAAC;AACR,IAAA,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC;AAC1B;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/core/hooks/memo.ts","../../src/core/hooks/ref.ts","../../src/core/hooks/state.ts","../../src/core/hooks/stack.ts","../../src/core/hooks/reducer.ts","../../src/common.ts"],"sourcesContent":["//\n// memo.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 { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that memoizes the result of a factory function.\n * \n * @template T The type of the value returned by the factory function.\n * @param factory A function that produces a value to be memoized.\n * @param deps An optional dependency array. The memoized value is recalculated \n * only when the dependencies change.\n * @returns The memoized value produced by the factory function.\n */\nexport const useMemo = <T>(\n factory: () => T,\n deps?: any,\n) => _useMemo('useMemo', factory, deps);\n","//\n// memo.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 { _useEffect, _useMemo } from '../reconciler/hooks';\nimport { Ref, RefObject } from '../types/common';\n\n/**\n * Creates a mutable reference object that persists across function calls.\n * \n * @template T The type of the value stored in the reference.\n * @param initialValue The initial value to store in the reference.\n * @returns An object with a `current` property that holds the value.\n */\nexport function useRef<T>(initialValue: T): RefObject<T>;\nexport function useRef<T = undefined>(): RefObject<T | undefined>;\n\nexport function useRef(initialValue?: any) {\n return _useMemo('useRef', () => ({ current: initialValue }), null);\n}\n\n/**\n * Associates a reference with a value created by an initializer function.\n * \n * @template T The type of the reference.\n * @template R The type of the value created by the initializer function.\n * @param ref A reference object or a callback function to receive the value.\n * @param init A function that initializes and returns the value to associate with the reference.\n * @param deps An optional dependency array. The initializer function is re-executed when the dependencies change.\n */\nexport const useRefHandle = <T, R extends T>(\n ref: Ref<T> | undefined,\n init: () => R,\n deps?: any\n) => _useEffect('useRefHandle', () => {\n try {\n if (ref) {\n const _ref = init();\n if (typeof ref === 'function') ref(_ref);\n else if (typeof ref === 'object') ref.current = _ref;\n }\n return () => void 0;\n } catch (e) {\n console.error(e);\n return () => void 0;\n }\n}, deps);","//\n// memo.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 { _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', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n setValue: (dispatch: SetStateAction<any>) => {\n state.value = _.isFunction(dispatch) ? dispatch(state.value) : dispatch;\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, setValue];\n}\n","//\n// stack.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 { reconciler } from '../reconciler/state';\n\n/**\n * Retrieves the stack of parent components from the current hook state.\n *\n * This function accesses the current hook state and extracts the stack of \n * parent components. It throws an error if called outside of a valid render \n * context.\n *\n * @returns An array of parent components from the current hook state.\n * @throws Will throw an error if the function is called outside of a valid render context.\n */\nexport const useStack = () => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useStack must be used within a render function.');\n return _.map(state.stack, x => x._component);\n}\n","//\n// reducer.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 { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that manages state using a reducer pattern.\n * \n * @template T The type of the state.\n * @template A The type of the action object (optional).\n * @param reducer A function that takes the current state and an action, and returns the new state.\n * @param initialState The initial state value or a function that returns the initial state.\n * @returns A tuple containing the current state and a dispatch function to update the state.\n */\nexport function useReducer<T>(\n reducer: (prevState: T) => T,\n initialState: T | (() => T),\n): [T, (dispatch: () => void) => void];\n\nexport function useReducer<T, A = any>(\n reducer: (prevState: T, action: A) => T,\n initialState: T | (() => T),\n): [T, (dispatch: (action: A) => void) => void];\n\nexport function useReducer<T = undefined>(\n reducer: (prevState: T | undefined) => T | undefined\n): [T | undefined, (dispatch: () => void) => void];\n\nexport function useReducer<T = undefined, A = any>(\n reducer: (prevState: T | undefined, action: A) => T | undefined\n): [T | undefined, (dispatch: (action: A) => void) => void];\n\nexport function useReducer(\n reducer: (prevState: any, action?: any) => any,\n initialState?: any,\n) {\n const { value, dispatch } = _useMemo('useReducer', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n dispatch: (action?: any) => {\n state.value = reducer(state.value, action);\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, dispatch];\n}\n","//\n// common.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\nexport * from './core/types/common';\nexport { useEffect } from './core/hooks/effect';\nexport { useContext } from './core/hooks/context';\nexport { useMemo } from './core/hooks/memo';\nexport { useRef, useRefHandle } from './core/hooks/ref';\nexport { useCallback } from './core/hooks/callback';\nexport { useState } from './core/hooks/state';\nexport { useStack } from './core/hooks/stack';\nexport { useReducer } from './core/hooks/reducer';\nexport { useSyncExternalStore } from './core/hooks/sync';\nexport { ComponentNode } from './core/types/component';\nexport { Context, ContextType, createContext } from './core/types/context';\nexport { ErrorBoundary } from './core/types/error';\nexport { Fragment } from './core/types/fragment';\nexport { PropsProvider } from './core/types/props';\nexport { _ElementType as ElementType, createElement } from './core/types/runtime';\nexport { mergeRefs } from './core/utils';\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;AAKA;;;;;;;;AAQG;AACU,MAAA,OAAO,GAAG,CACrB,OAAgB,EAChB,IAAU,KACP,QAAQ,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI;;ACxCtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBM,SAAU,MAAM,CAAC,YAAkB,EAAA;AACvC,IAAA,OA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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,7 +2,7 @@
2
2
 
3
3
  var _ = require('lodash');
4
4
  var myers_js = require('myers.js');
5
- var renderer = require('./renderer-D3zwukmJ.js');
5
+ var renderer = require('./renderer-DffqnYzl.js');
6
6
  var postcss = require('postcss');
7
7
  var postcssJs = require('postcss-js');
8
8
  var nested = require('postcss-nested');
@@ -4097,4 +4097,4 @@ class _DOMRenderer extends renderer._Renderer {
4097
4097
  }
4098
4098
 
4099
4099
  exports._DOMRenderer = _DOMRenderer;
4100
- //# sourceMappingURL=common-D2qumIG-.js.map
4100
+ //# sourceMappingURL=common-B4tIJSMl.js.map