@bquery/bquery 1.5.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +193 -23
- package/dist/a11y/announce.d.ts +43 -0
- package/dist/a11y/announce.d.ts.map +1 -0
- package/dist/a11y/audit.d.ts +42 -0
- package/dist/a11y/audit.d.ts.map +1 -0
- package/dist/a11y/index.d.ts +53 -0
- package/dist/a11y/index.d.ts.map +1 -0
- package/dist/a11y/media-preferences.d.ts +77 -0
- package/dist/a11y/media-preferences.d.ts.map +1 -0
- package/dist/a11y/roving-tab-index.d.ts +38 -0
- package/dist/a11y/roving-tab-index.d.ts.map +1 -0
- package/dist/a11y/skip-link.d.ts +37 -0
- package/dist/a11y/skip-link.d.ts.map +1 -0
- package/dist/a11y/trap-focus.d.ts +49 -0
- package/dist/a11y/trap-focus.d.ts.map +1 -0
- package/dist/a11y/types.d.ts +152 -0
- package/dist/a11y/types.d.ts.map +1 -0
- package/dist/a11y-C5QOVvRn.js +421 -0
- package/dist/a11y-C5QOVvRn.js.map +1 -0
- package/dist/a11y.es.mjs +14 -0
- package/dist/component/component.d.ts +13 -5
- package/dist/component/component.d.ts.map +1 -1
- package/dist/component/html.d.ts +40 -3
- package/dist/component/html.d.ts.map +1 -1
- package/dist/component/index.d.ts +3 -2
- package/dist/component/index.d.ts.map +1 -1
- package/dist/component/library.d.ts.map +1 -1
- package/dist/component/scope.d.ts +138 -0
- package/dist/component/scope.d.ts.map +1 -0
- package/dist/component/types.d.ts +184 -17
- package/dist/component/types.d.ts.map +1 -1
- package/dist/component-CuuTijA6.js +684 -0
- package/dist/component-CuuTijA6.js.map +1 -0
- package/dist/component.es.mjs +10 -6
- package/dist/{config-DRmZZno3.js → config-BW35FKuA.js} +4 -4
- package/dist/config-BW35FKuA.js.map +1 -0
- package/dist/constraints-3lV9yyBw.js +100 -0
- package/dist/constraints-3lV9yyBw.js.map +1 -0
- package/dist/core/collection.d.ts +48 -0
- package/dist/core/collection.d.ts.map +1 -1
- package/dist/core/element.d.ts +92 -0
- package/dist/core/element.d.ts.map +1 -1
- package/dist/core/env.d.ts +18 -0
- package/dist/core/env.d.ts.map +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/shared.d.ts +8 -0
- package/dist/core/shared.d.ts.map +1 -1
- package/dist/core/utils/index.d.ts +52 -41
- package/dist/core/utils/index.d.ts.map +1 -1
- package/dist/core-Cjl7GUu8.js +717 -0
- package/dist/core-Cjl7GUu8.js.map +1 -0
- package/dist/{core-DPdbItcq.js → core-DnlyjbF2.js} +1 -1
- package/dist/{core-DPdbItcq.js.map → core-DnlyjbF2.js.map} +1 -1
- package/dist/core.es.mjs +45 -44
- package/dist/custom-directives-7wAShnnd.js +9 -0
- package/dist/custom-directives-7wAShnnd.js.map +1 -0
- package/dist/devtools/devtools.d.ts +212 -0
- package/dist/devtools/devtools.d.ts.map +1 -0
- package/dist/devtools/index.d.ts +20 -0
- package/dist/devtools/index.d.ts.map +1 -0
- package/dist/devtools/types.d.ts +69 -0
- package/dist/devtools/types.d.ts.map +1 -0
- package/dist/devtools-D2fQLhDN.js +122 -0
- package/dist/devtools-D2fQLhDN.js.map +1 -0
- package/dist/devtools.es.mjs +19 -0
- package/dist/dnd/draggable.d.ts +51 -0
- package/dist/dnd/draggable.d.ts.map +1 -0
- package/dist/dnd/droppable.d.ts +38 -0
- package/dist/dnd/droppable.d.ts.map +1 -0
- package/dist/dnd/index.d.ts +47 -0
- package/dist/dnd/index.d.ts.map +1 -0
- package/dist/dnd/sortable.d.ts +43 -0
- package/dist/dnd/sortable.d.ts.map +1 -0
- package/dist/dnd/types.d.ts +250 -0
- package/dist/dnd/types.d.ts.map +1 -0
- package/dist/dnd-B8EgyzaI.js +244 -0
- package/dist/dnd-B8EgyzaI.js.map +1 -0
- package/dist/dnd.es.mjs +6 -0
- package/dist/env-NeVmr4Gf.js +19 -0
- package/dist/env-NeVmr4Gf.js.map +1 -0
- package/dist/forms/create-form.d.ts +49 -0
- package/dist/forms/create-form.d.ts.map +1 -0
- package/dist/forms/index.d.ts +39 -0
- package/dist/forms/index.d.ts.map +1 -0
- package/dist/forms/types.d.ts +139 -0
- package/dist/forms/types.d.ts.map +1 -0
- package/dist/forms/validators.d.ts +179 -0
- package/dist/forms/validators.d.ts.map +1 -0
- package/dist/forms-C3yovgH9.js +141 -0
- package/dist/forms-C3yovgH9.js.map +1 -0
- package/dist/forms.es.mjs +14 -0
- package/dist/full.d.ts +37 -9
- package/dist/full.d.ts.map +1 -1
- package/dist/full.es.mjs +186 -91
- package/dist/full.iife.js +47 -31
- package/dist/full.iife.js.map +1 -1
- package/dist/full.umd.js +47 -31
- package/dist/full.umd.js.map +1 -1
- package/dist/i18n/formatting.d.ts +40 -0
- package/dist/i18n/formatting.d.ts.map +1 -0
- package/dist/i18n/i18n.d.ts +48 -0
- package/dist/i18n/i18n.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +57 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/translate.d.ts +83 -0
- package/dist/i18n/translate.d.ts.map +1 -0
- package/dist/i18n/types.d.ts +156 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n-BnnhTFOS.js +89 -0
- package/dist/i18n-BnnhTFOS.js.map +1 -0
- package/dist/i18n.es.mjs +6 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.mjs +233 -138
- package/dist/media/battery.d.ts +35 -0
- package/dist/media/battery.d.ts.map +1 -0
- package/dist/media/breakpoints.d.ts +51 -0
- package/dist/media/breakpoints.d.ts.map +1 -0
- package/dist/media/clipboard.d.ts +30 -0
- package/dist/media/clipboard.d.ts.map +1 -0
- package/dist/media/device-sensors.d.ts +54 -0
- package/dist/media/device-sensors.d.ts.map +1 -0
- package/dist/media/geolocation.d.ts +38 -0
- package/dist/media/geolocation.d.ts.map +1 -0
- package/dist/media/index.d.ts +42 -0
- package/dist/media/index.d.ts.map +1 -0
- package/dist/media/media-query.d.ts +36 -0
- package/dist/media/media-query.d.ts.map +1 -0
- package/dist/media/network.d.ts +35 -0
- package/dist/media/network.d.ts.map +1 -0
- package/dist/media/types.d.ts +173 -0
- package/dist/media/types.d.ts.map +1 -0
- package/dist/media/viewport.d.ts +32 -0
- package/dist/media/viewport.d.ts.map +1 -0
- package/dist/media-Di2Ta22s.js +340 -0
- package/dist/media-Di2Ta22s.js.map +1 -0
- package/dist/media.es.mjs +12 -0
- package/dist/motion/index.d.ts +7 -3
- package/dist/motion/index.d.ts.map +1 -1
- package/dist/motion/morph.d.ts +27 -0
- package/dist/motion/morph.d.ts.map +1 -0
- package/dist/motion/parallax.d.ts +30 -0
- package/dist/motion/parallax.d.ts.map +1 -0
- package/dist/motion/reduced-motion.d.ts +36 -3
- package/dist/motion/reduced-motion.d.ts.map +1 -1
- package/dist/motion/types.d.ts +58 -0
- package/dist/motion/types.d.ts.map +1 -1
- package/dist/motion/typewriter.d.ts +31 -0
- package/dist/motion/typewriter.d.ts.map +1 -0
- package/dist/motion-qPj_TYGv.js +530 -0
- package/dist/motion-qPj_TYGv.js.map +1 -0
- package/dist/motion.es.mjs +27 -23
- package/dist/mount-SM07RUa6.js +403 -0
- package/dist/mount-SM07RUa6.js.map +1 -0
- package/dist/{object-qGpWr6-J.js → object-BCk-1c8T.js} +5 -4
- package/dist/{object-qGpWr6-J.js.map → object-BCk-1c8T.js.map} +1 -1
- package/dist/{platform-B7JhGBc7.js → platform-CPbCprb6.js} +3 -3
- package/dist/platform-CPbCprb6.js.map +1 -0
- package/dist/platform.es.mjs +2 -2
- package/dist/plugin/index.d.ts +22 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/registry.d.ts +108 -0
- package/dist/plugin/registry.d.ts.map +1 -0
- package/dist/plugin/types.d.ts +110 -0
- package/dist/plugin/types.d.ts.map +1 -0
- package/dist/plugin-cPoOHFLY.js +64 -0
- package/dist/plugin-cPoOHFLY.js.map +1 -0
- package/dist/plugin.es.mjs +9 -0
- package/dist/reactive/computed.d.ts +7 -0
- package/dist/reactive/computed.d.ts.map +1 -1
- package/dist/reactive-Cfv0RK6x.js +233 -0
- package/dist/reactive-Cfv0RK6x.js.map +1 -0
- package/dist/reactive.es.mjs +18 -17
- package/dist/registry-CWf368tT.js +26 -0
- package/dist/registry-CWf368tT.js.map +1 -0
- package/dist/router/bq-link.d.ts +112 -0
- package/dist/router/bq-link.d.ts.map +1 -0
- package/dist/router/constraints.d.ts +9 -0
- package/dist/router/constraints.d.ts.map +1 -0
- package/dist/router/index.d.ts +14 -6
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/match.d.ts +0 -1
- package/dist/router/match.d.ts.map +1 -1
- package/dist/router/path-pattern.d.ts +14 -0
- package/dist/router/path-pattern.d.ts.map +1 -0
- package/dist/router/query.d.ts.map +1 -1
- package/dist/router/router.d.ts +3 -1
- package/dist/router/router.d.ts.map +1 -1
- package/dist/router/types.d.ts +48 -4
- package/dist/router/types.d.ts.map +1 -1
- package/dist/router/use-route.d.ts +50 -0
- package/dist/router/use-route.d.ts.map +1 -0
- package/dist/router/utils.d.ts +3 -0
- package/dist/router/utils.d.ts.map +1 -1
- package/dist/router-BrthaP_z.js +473 -0
- package/dist/router-BrthaP_z.js.map +1 -0
- package/dist/router.es.mjs +13 -10
- package/dist/{sanitize-jyJ2ryE2.js → sanitize-B1V4JswB.js} +95 -83
- package/dist/sanitize-B1V4JswB.js.map +1 -0
- package/dist/security/index.d.ts +2 -0
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/sanitize.d.ts +4 -1
- package/dist/security/sanitize.d.ts.map +1 -1
- package/dist/security/trusted-html.d.ts +53 -0
- package/dist/security/trusted-html.d.ts.map +1 -0
- package/dist/security.es.mjs +10 -9
- package/dist/ssr/hydrate.d.ts +65 -0
- package/dist/ssr/hydrate.d.ts.map +1 -0
- package/dist/ssr/index.d.ts +59 -0
- package/dist/ssr/index.d.ts.map +1 -0
- package/dist/ssr/render.d.ts +62 -0
- package/dist/ssr/render.d.ts.map +1 -0
- package/dist/ssr/serialize.d.ts +118 -0
- package/dist/ssr/serialize.d.ts.map +1 -0
- package/dist/ssr/types.d.ts +70 -0
- package/dist/ssr/types.d.ts.map +1 -0
- package/dist/ssr-B2qd_WBB.js +248 -0
- package/dist/ssr-B2qd_WBB.js.map +1 -0
- package/dist/ssr.es.mjs +9 -0
- package/dist/store/create-store.d.ts.map +1 -1
- package/dist/store/define-store.d.ts +1 -1
- package/dist/store/define-store.d.ts.map +1 -1
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/mapping.d.ts +1 -1
- package/dist/store/mapping.d.ts.map +1 -1
- package/dist/store/persisted.d.ts +38 -4
- package/dist/store/persisted.d.ts.map +1 -1
- package/dist/store/types.d.ts +140 -3
- package/dist/store/types.d.ts.map +1 -1
- package/dist/store/utils.d.ts +2 -2
- package/dist/store/utils.d.ts.map +1 -1
- package/dist/store/watch.d.ts +1 -1
- package/dist/store/watch.d.ts.map +1 -1
- package/dist/store-DWpyH6p5.js +338 -0
- package/dist/store-DWpyH6p5.js.map +1 -0
- package/dist/store.es.mjs +11 -10
- package/dist/storybook/index.d.ts +37 -0
- package/dist/storybook/index.d.ts.map +1 -0
- package/dist/storybook.es.mjs +151 -0
- package/dist/storybook.es.mjs.map +1 -0
- package/dist/testing/index.d.ts +23 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/testing.d.ts +156 -0
- package/dist/testing/testing.d.ts.map +1 -0
- package/dist/testing/types.d.ts +134 -0
- package/dist/testing/types.d.ts.map +1 -0
- package/dist/testing-CsqjNUyy.js +224 -0
- package/dist/testing-CsqjNUyy.js.map +1 -0
- package/dist/testing.es.mjs +9 -0
- package/dist/type-guards-Do9DWgNp.js +44 -0
- package/dist/type-guards-Do9DWgNp.js.map +1 -0
- package/dist/untrack-DJVQQ2WM.js +33 -0
- package/dist/untrack-DJVQQ2WM.js.map +1 -0
- package/dist/view/custom-directives.d.ts +20 -0
- package/dist/view/custom-directives.d.ts.map +1 -0
- package/dist/view/evaluate.d.ts.map +1 -1
- package/dist/view/process.d.ts.map +1 -1
- package/dist/view.es.mjs +11 -10
- package/package.json +52 -11
- package/src/a11y/announce.ts +131 -0
- package/src/a11y/audit.ts +314 -0
- package/src/a11y/index.ts +68 -0
- package/src/a11y/media-preferences.ts +255 -0
- package/src/a11y/roving-tab-index.ts +164 -0
- package/src/a11y/skip-link.ts +255 -0
- package/src/a11y/trap-focus.ts +184 -0
- package/src/a11y/types.ts +183 -0
- package/src/component/component.ts +345 -65
- package/src/component/html.ts +153 -53
- package/src/component/index.ts +12 -2
- package/src/component/library.ts +66 -28
- package/src/component/scope.ts +212 -0
- package/src/component/types.ts +238 -19
- package/src/core/collection.ts +707 -628
- package/src/core/element.ts +981 -774
- package/src/core/env.ts +60 -0
- package/src/core/index.ts +49 -48
- package/src/core/shared.ts +62 -13
- package/src/core/utils/index.ts +148 -83
- package/src/devtools/devtools.ts +410 -0
- package/src/devtools/index.ts +48 -0
- package/src/devtools/types.ts +104 -0
- package/src/dnd/draggable.ts +296 -0
- package/src/dnd/droppable.ts +228 -0
- package/src/dnd/index.ts +62 -0
- package/src/dnd/sortable.ts +307 -0
- package/src/dnd/types.ts +293 -0
- package/src/forms/create-form.ts +278 -0
- package/src/forms/index.ts +65 -0
- package/src/forms/types.ts +154 -0
- package/src/forms/validators.ts +265 -0
- package/src/full.ts +260 -3
- package/src/i18n/formatting.ts +67 -0
- package/src/i18n/i18n.ts +200 -0
- package/src/i18n/index.ts +67 -0
- package/src/i18n/translate.ts +182 -0
- package/src/i18n/types.ts +171 -0
- package/src/index.ts +108 -36
- package/src/media/battery.ts +116 -0
- package/src/media/breakpoints.ts +131 -0
- package/src/media/clipboard.ts +80 -0
- package/src/media/device-sensors.ts +158 -0
- package/src/media/geolocation.ts +119 -0
- package/src/media/index.ts +76 -0
- package/src/media/media-query.ts +92 -0
- package/src/media/network.ts +115 -0
- package/src/media/types.ts +177 -0
- package/src/media/viewport.ts +84 -0
- package/src/motion/index.ts +57 -48
- package/src/motion/morph.ts +151 -0
- package/src/motion/parallax.ts +120 -0
- package/src/motion/reduced-motion.ts +66 -17
- package/src/motion/transition.ts +97 -97
- package/src/motion/types.ts +63 -0
- package/src/motion/typewriter.ts +164 -0
- package/src/platform/announcer.ts +208 -208
- package/src/platform/config.ts +163 -163
- package/src/platform/cookies.ts +165 -165
- package/src/platform/index.ts +39 -39
- package/src/platform/meta.ts +168 -168
- package/src/plugin/index.ts +37 -0
- package/src/plugin/registry.ts +269 -0
- package/src/plugin/types.ts +137 -0
- package/src/reactive/async-data.ts +486 -486
- package/src/reactive/computed.ts +130 -92
- package/src/reactive/index.ts +37 -37
- package/src/reactive/signal.ts +29 -29
- package/src/router/bq-link.ts +279 -0
- package/src/router/constraints.ts +201 -0
- package/src/router/index.ts +49 -41
- package/src/router/match.ts +312 -106
- package/src/router/path-pattern.ts +52 -0
- package/src/router/query.ts +38 -35
- package/src/router/router.ts +402 -211
- package/src/router/types.ts +139 -93
- package/src/router/use-route.ts +68 -0
- package/src/router/utils.ts +157 -116
- package/src/security/constants.ts +211 -211
- package/src/security/index.ts +12 -10
- package/src/security/sanitize.ts +6 -2
- package/src/security/trusted-html.ts +71 -0
- package/src/ssr/hydrate.ts +82 -0
- package/src/ssr/index.ts +70 -0
- package/src/ssr/render.ts +508 -0
- package/src/ssr/serialize.ts +296 -0
- package/src/ssr/types.ts +81 -0
- package/src/store/create-store.ts +467 -329
- package/src/store/define-store.ts +2 -1
- package/src/store/index.ts +27 -22
- package/src/store/mapping.ts +2 -1
- package/src/store/persisted.ts +249 -61
- package/src/store/types.ts +247 -94
- package/src/store/utils.ts +135 -141
- package/src/store/watch.ts +2 -1
- package/src/storybook/index.ts +480 -0
- package/src/testing/index.ts +42 -0
- package/src/testing/testing.ts +593 -0
- package/src/testing/types.ts +170 -0
- package/src/view/custom-directives.ts +30 -0
- package/src/view/evaluate.ts +292 -290
- package/src/view/process.ts +108 -92
- package/dist/component-CY5MVoYN.js +0 -531
- package/dist/component-CY5MVoYN.js.map +0 -1
- package/dist/config-DRmZZno3.js.map +0 -1
- package/dist/core-CK2Mfpf4.js +0 -648
- package/dist/core-CK2Mfpf4.js.map +0 -1
- package/dist/motion-C5DRdPnO.js +0 -415
- package/dist/motion-C5DRdPnO.js.map +0 -1
- package/dist/platform-B7JhGBc7.js.map +0 -1
- package/dist/reactive-BDya-ia8.js +0 -253
- package/dist/reactive-BDya-ia8.js.map +0 -1
- package/dist/router-CijiICxt.js +0 -188
- package/dist/router-CijiICxt.js.map +0 -1
- package/dist/sanitize-jyJ2ryE2.js.map +0 -1
- package/dist/store-CPK9E62U.js +0 -262
- package/dist/store-CPK9E62U.js.map +0 -1
- package/dist/view-Cdi0g-qo.js +0 -396
- package/dist/view-Cdi0g-qo.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/store/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AAEtC;;GAEG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI;KACzB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI;KAC5B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/store/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,MAAM,CA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,6 +23,6 @@ export declare const deepEqual: (a: unknown, b: unknown) => boolean;
|
|
|
23
23
|
* @internal
|
|
24
24
|
*/
|
|
25
25
|
export declare const detectNestedMutations: <S extends Record<string, unknown>>(before: S, after: S, signalValues: Map<keyof S, unknown>) => Array<keyof S>;
|
|
26
|
-
/** @internal
|
|
27
|
-
export declare const isDev: boolean;
|
|
26
|
+
/** @internal Returns whether development warnings should be enabled */
|
|
27
|
+
export declare const isDev: () => boolean;
|
|
28
28
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/store/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/store/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAI7E,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,KAAK,CAAC,KAAG,CA0BrC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,GAAG,OAAO,EAAE,GAAG,OAAO,KAAG,OA+ClD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrE,QAAQ,CAAC,EACT,OAAO,CAAC,EACR,cAAc,GAAG,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,KAClC,KAAK,CAAC,MAAM,CAAC,CAoBf,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,KAAK,QAAO,OAAiC,CAAC"}
|
package/dist/store/watch.d.ts
CHANGED
|
@@ -19,5 +19,5 @@ export type WatchStoreOptions<T> = {
|
|
|
19
19
|
* @param options - Watch options
|
|
20
20
|
* @returns Unsubscribe function
|
|
21
21
|
*/
|
|
22
|
-
export declare const watchStore: <S extends Record<string, unknown>, G extends Record<string, unknown>, A extends Record<string, (...args:
|
|
22
|
+
export declare const watchStore: <S extends Record<string, unknown>, G extends Record<string, unknown>, A extends Record<string, (...args: any[]) => any>, T>(store: Store<S, G, A>, selector: (state: S) => T, callback: (value: T, previous: T | undefined) => void, options?: WatchStoreOptions<T>) => (() => void);
|
|
23
23
|
//# sourceMappingURL=watch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/store/watch.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGrC,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IACjC,4DAA4D;IAC5D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oDAAoD;IACpD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,iDAAiD;IACjD,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC;CAClC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,GACrB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/store/watch.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGrC,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IACjC,4DAA4D;IAC5D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oDAAoD;IACpD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,iDAAiD;IACjD,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC;CAClC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,GACrB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAEjC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,EACjD,CAAC,EAED,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACrB,UAAU,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,EACzB,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,SAAS,KAAK,IAAI,EACrD,UAAS,iBAAiB,CAAC,CAAC,CAAM,KACjC,CAAC,MAAM,IAAI,CAgBb,CAAC"}
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { i as T } from "./object-BCk-1c8T.js";
|
|
2
|
+
import { l as E } from "./type-guards-Do9DWgNp.js";
|
|
3
|
+
import { n as q } from "./core-DnlyjbF2.js";
|
|
4
|
+
import { u as V } from "./reactive-Cfv0RK6x.js";
|
|
5
|
+
import { r as B, t as L } from "./untrack-DJVQQ2WM.js";
|
|
6
|
+
import { t as U } from "./env-NeVmr4Gf.js";
|
|
7
|
+
import { a as G, n as Q, o as H, r as C, s as J } from "./registry-CWf368tT.js";
|
|
8
|
+
var M = [], ce = (e) => {
|
|
9
|
+
M.push(e);
|
|
10
|
+
}, W = (e, t) => {
|
|
11
|
+
for (const o of M) {
|
|
12
|
+
const a = o({
|
|
13
|
+
store: e,
|
|
14
|
+
options: t
|
|
15
|
+
});
|
|
16
|
+
a && Object.assign(e, a);
|
|
17
|
+
}
|
|
18
|
+
}, F = (e) => e !== null && typeof e == "object" && Object.getPrototypeOf(e) === Object.prototype, P = (e) => {
|
|
19
|
+
if (e === null || typeof e != "object") return e;
|
|
20
|
+
if (Array.isArray(e)) return e.map(P);
|
|
21
|
+
if (e instanceof Date) return new Date(e.getTime());
|
|
22
|
+
if (e instanceof Map) return new Map(Array.from(e.entries()).map(([o, a]) => [o, P(a)]));
|
|
23
|
+
if (e instanceof Set) return new Set(Array.from(e).map(P));
|
|
24
|
+
const t = {};
|
|
25
|
+
for (const o of Object.keys(e)) t[o] = P(e[o]);
|
|
26
|
+
return t;
|
|
27
|
+
}, j = (e, t) => {
|
|
28
|
+
if (e === t) return !0;
|
|
29
|
+
if (e === null || t === null || typeof e != "object" || typeof t != "object") return !1;
|
|
30
|
+
if (e instanceof Date && t instanceof Date) return e.getTime() === t.getTime();
|
|
31
|
+
if (e instanceof Map && t instanceof Map) {
|
|
32
|
+
if (e.size !== t.size) return !1;
|
|
33
|
+
for (const [i, c] of e.entries()) if (!t.has(i) || !j(c, t.get(i))) return !1;
|
|
34
|
+
return !0;
|
|
35
|
+
}
|
|
36
|
+
if (e instanceof Set && t instanceof Set) {
|
|
37
|
+
if (e.size !== t.size) return !1;
|
|
38
|
+
for (const i of e.values()) {
|
|
39
|
+
let c = !1;
|
|
40
|
+
for (const n of t.values()) if (j(i, n)) {
|
|
41
|
+
c = !0;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
if (!c) return !1;
|
|
45
|
+
}
|
|
46
|
+
return !0;
|
|
47
|
+
}
|
|
48
|
+
if (Array.isArray(e) && Array.isArray(t))
|
|
49
|
+
return e.length !== t.length ? !1 : e.every((i, c) => j(i, t[c]));
|
|
50
|
+
if (Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
51
|
+
const o = Object.keys(e), a = Object.keys(t);
|
|
52
|
+
return o.length !== a.length ? !1 : o.every((i) => j(e[i], t[i]));
|
|
53
|
+
}, X = (e, t, o) => {
|
|
54
|
+
const a = [];
|
|
55
|
+
for (const i of Object.keys(t)) {
|
|
56
|
+
const c = e[i], n = t[i];
|
|
57
|
+
o.get(i) === n && F(c) && F(n) && !j(c, n) && a.push(i);
|
|
58
|
+
}
|
|
59
|
+
return a;
|
|
60
|
+
}, D = () => U(), N = (e) => {
|
|
61
|
+
const { id: t, state: o, getters: a = {}, actions: i = {} } = e;
|
|
62
|
+
if (C(t))
|
|
63
|
+
return console.warn(`bQuery store: Store "${t}" already exists. Returning existing instance.`), Q(t);
|
|
64
|
+
const c = o(), n = /* @__PURE__ */ new Map();
|
|
65
|
+
for (const r of Object.keys(c)) n.set(r, q(c[r]));
|
|
66
|
+
const v = [], h = [], $ = (r, s, f) => {
|
|
67
|
+
!D() || typeof console > "u" || typeof console.error != "function" || console.error(`[bQuery store "${t}"] Error in $onAction ${r} for action "${s}"`, f);
|
|
68
|
+
}, O = /* @__PURE__ */ new WeakSet(), z = (r, s) => {
|
|
69
|
+
!D() || typeof console > "u" || typeof console.warn != "function" || O.has(r) || (O.add(r), console.warn(`[bQuery store "${t}"] Async $onAction listener detected for action "${s}". If it awaits, register after()/onError() before the first await; late registrations will not affect the current action.`));
|
|
70
|
+
}, b = (r, s, f, d) => {
|
|
71
|
+
try {
|
|
72
|
+
const p = f();
|
|
73
|
+
E(p) && (r === "listener" && d && z(d, s), p.catch((l) => {
|
|
74
|
+
$(r, s, l);
|
|
75
|
+
}));
|
|
76
|
+
} catch (p) {
|
|
77
|
+
$(r, s, p);
|
|
78
|
+
}
|
|
79
|
+
}, A = () => L(() => ({ ...g })), k = () => {
|
|
80
|
+
const r = typeof window < "u" && typeof window.__BQUERY_DEVTOOLS__?.onStateChange == "function";
|
|
81
|
+
if (v.length === 0 && !r) return;
|
|
82
|
+
const s = A();
|
|
83
|
+
for (const f of v) f(s);
|
|
84
|
+
H(t, s);
|
|
85
|
+
}, g = new Proxy({}, {
|
|
86
|
+
get: (r, s) => {
|
|
87
|
+
const f = s;
|
|
88
|
+
if (n.has(f)) return n.get(f).value;
|
|
89
|
+
},
|
|
90
|
+
ownKeys: () => Array.from(n.keys()),
|
|
91
|
+
getOwnPropertyDescriptor: (r, s) => {
|
|
92
|
+
if (n.has(s)) return {
|
|
93
|
+
enumerable: !0,
|
|
94
|
+
configurable: !0
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
has: (r, s) => n.has(s)
|
|
98
|
+
}), S = /* @__PURE__ */ new Map(), m = {};
|
|
99
|
+
for (const r of Object.keys(c)) Object.defineProperty(m, r, {
|
|
100
|
+
get: () => n.get(r).value,
|
|
101
|
+
set: (s) => {
|
|
102
|
+
n.get(r).value = s, k();
|
|
103
|
+
},
|
|
104
|
+
enumerable: !0,
|
|
105
|
+
configurable: !1
|
|
106
|
+
});
|
|
107
|
+
for (const r of Object.keys(a)) {
|
|
108
|
+
const s = a[r], f = B(() => s(g, new Proxy({}, { get: (d, p) => {
|
|
109
|
+
const l = p;
|
|
110
|
+
if (S.has(l)) return S.get(l).value;
|
|
111
|
+
} })));
|
|
112
|
+
S.set(r, f), Object.defineProperty(m, r, {
|
|
113
|
+
get: () => f.value,
|
|
114
|
+
enumerable: !0,
|
|
115
|
+
configurable: !1
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
for (const r of Object.keys(i)) {
|
|
119
|
+
const s = i[r], f = r;
|
|
120
|
+
m[f] = function(...d) {
|
|
121
|
+
const p = new Proxy(m, {
|
|
122
|
+
get: (u, y) => typeof y == "string" && n.has(y) ? n.get(y).value : u[y],
|
|
123
|
+
set: (u, y, _) => typeof y == "string" && n.has(y) ? (n.get(y).value = _, k(), !0) : Reflect.set(u, y, _)
|
|
124
|
+
});
|
|
125
|
+
if (h.length === 0) return s.apply(p, d);
|
|
126
|
+
const l = [], w = [], K = [...h], R = {
|
|
127
|
+
name: f,
|
|
128
|
+
store: m,
|
|
129
|
+
args: d,
|
|
130
|
+
after: (u) => {
|
|
131
|
+
l.push((y) => u(y));
|
|
132
|
+
},
|
|
133
|
+
onError: (u) => {
|
|
134
|
+
w.push(u);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
for (const u of K) b("listener", f, () => u(R), u);
|
|
138
|
+
let x;
|
|
139
|
+
try {
|
|
140
|
+
x = s.apply(p, d);
|
|
141
|
+
} catch (u) {
|
|
142
|
+
for (const y of w) b("onError", f, () => y(u));
|
|
143
|
+
throw u;
|
|
144
|
+
}
|
|
145
|
+
if (E(x)) return x.then((u) => {
|
|
146
|
+
for (const y of l) b("after", f, () => y(u));
|
|
147
|
+
return u;
|
|
148
|
+
}, (u) => {
|
|
149
|
+
for (const y of w) b("onError", f, () => y(u));
|
|
150
|
+
throw u;
|
|
151
|
+
});
|
|
152
|
+
for (const u of l) b("after", f, () => u(x));
|
|
153
|
+
return x;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
return Object.defineProperties(m, {
|
|
157
|
+
$id: {
|
|
158
|
+
value: t,
|
|
159
|
+
writable: !1,
|
|
160
|
+
enumerable: !1
|
|
161
|
+
},
|
|
162
|
+
$reset: {
|
|
163
|
+
value: () => {
|
|
164
|
+
const r = o();
|
|
165
|
+
V(() => {
|
|
166
|
+
for (const [s, f] of n) f.value = r[s];
|
|
167
|
+
}), k();
|
|
168
|
+
},
|
|
169
|
+
writable: !1,
|
|
170
|
+
enumerable: !1
|
|
171
|
+
},
|
|
172
|
+
$subscribe: {
|
|
173
|
+
value: (r) => (v.push(r), () => {
|
|
174
|
+
const s = v.indexOf(r);
|
|
175
|
+
s > -1 && v.splice(s, 1);
|
|
176
|
+
}),
|
|
177
|
+
writable: !1,
|
|
178
|
+
enumerable: !1
|
|
179
|
+
},
|
|
180
|
+
$onAction: {
|
|
181
|
+
value: (r) => (h.push(r), () => {
|
|
182
|
+
const s = h.indexOf(r);
|
|
183
|
+
s > -1 && h.splice(s, 1);
|
|
184
|
+
}),
|
|
185
|
+
writable: !1,
|
|
186
|
+
enumerable: !1
|
|
187
|
+
},
|
|
188
|
+
$patch: {
|
|
189
|
+
value: (r) => {
|
|
190
|
+
V(() => {
|
|
191
|
+
if (typeof r == "function") {
|
|
192
|
+
const s = D(), f = s ? P(A()) : null, d = s ? new Map(Array.from(n.entries()).map(([l, w]) => [l, w.value])) : null, p = A();
|
|
193
|
+
if (r(p), s && f && d) {
|
|
194
|
+
const l = X(f, p, d);
|
|
195
|
+
l.length > 0 && console.warn(`[bQuery store "${t}"] Nested mutation detected in $patch() for keys: ${l.map(String).join(", ")}.
|
|
196
|
+
Nested object mutations do not trigger reactive updates because the store uses shallow reactivity.
|
|
197
|
+
To fix this, either:
|
|
198
|
+
1. Replace the entire object: state.user = { ...state.user, name: "New" }
|
|
199
|
+
2. Use $patchDeep() for automatic deep cloning
|
|
200
|
+
See: https://bquery.dev/guide/store#deep-reactivity`);
|
|
201
|
+
}
|
|
202
|
+
for (const [l, w] of Object.entries(p)) n.has(l) && (n.get(l).value = w);
|
|
203
|
+
} else for (const [s, f] of Object.entries(r)) n.has(s) && (n.get(s).value = f);
|
|
204
|
+
}), k();
|
|
205
|
+
},
|
|
206
|
+
writable: !1,
|
|
207
|
+
enumerable: !1
|
|
208
|
+
},
|
|
209
|
+
$patchDeep: {
|
|
210
|
+
value: (r) => {
|
|
211
|
+
V(() => {
|
|
212
|
+
if (typeof r == "function") {
|
|
213
|
+
const s = P(A());
|
|
214
|
+
r(s);
|
|
215
|
+
for (const [f, d] of Object.entries(s)) n.has(f) && (n.get(f).value = d);
|
|
216
|
+
} else for (const [s, f] of Object.entries(r)) n.has(s) && (n.get(s).value = P(f));
|
|
217
|
+
}), k();
|
|
218
|
+
},
|
|
219
|
+
writable: !1,
|
|
220
|
+
enumerable: !1
|
|
221
|
+
},
|
|
222
|
+
$state: {
|
|
223
|
+
get: () => A(),
|
|
224
|
+
enumerable: !1
|
|
225
|
+
}
|
|
226
|
+
}), G(t, m), W(m, e), J(t, m), m;
|
|
227
|
+
}, ue = (e, t) => () => C(e) ? Q(e) : N({
|
|
228
|
+
id: e,
|
|
229
|
+
...t
|
|
230
|
+
}), le = (e, t) => {
|
|
231
|
+
const o = {};
|
|
232
|
+
for (const a of t) Object.defineProperty(o, a, {
|
|
233
|
+
get: () => e[a],
|
|
234
|
+
enumerable: !0
|
|
235
|
+
});
|
|
236
|
+
return o;
|
|
237
|
+
}, ye = (e, t) => {
|
|
238
|
+
const o = {};
|
|
239
|
+
for (const a of t) Object.defineProperty(o, a, {
|
|
240
|
+
get: () => e[a],
|
|
241
|
+
enumerable: !0
|
|
242
|
+
});
|
|
243
|
+
return o;
|
|
244
|
+
}, pe = (e, t) => {
|
|
245
|
+
const o = {};
|
|
246
|
+
for (const a of t) o[a] = (...i) => e[a](...i);
|
|
247
|
+
return o;
|
|
248
|
+
}, Y = "__version", Z = {
|
|
249
|
+
serialize: (e) => JSON.stringify(e),
|
|
250
|
+
deserialize: (e) => JSON.parse(e)
|
|
251
|
+
}, I = (e) => {
|
|
252
|
+
if (typeof e != "object" || e === null || Array.isArray(e)) return !1;
|
|
253
|
+
const t = Object.getPrototypeOf(e);
|
|
254
|
+
return t === null || Object.getPrototypeOf(t) === null;
|
|
255
|
+
}, ee = (e, t) => {
|
|
256
|
+
const o = { ...e };
|
|
257
|
+
for (const [a, i] of Object.entries(t))
|
|
258
|
+
T(a) || Object.prototype.hasOwnProperty.call(e, a) && (o[a] = i);
|
|
259
|
+
return o;
|
|
260
|
+
}, te = () => {
|
|
261
|
+
try {
|
|
262
|
+
return globalThis.localStorage;
|
|
263
|
+
} catch {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
}, de = (e, t) => {
|
|
267
|
+
const o = typeof t == "string" ? { key: t } : t ?? {}, a = o.key ?? `bquery-store-${e.id}`, i = o.storage ?? te(), c = o.serializer ?? Z, n = o.version, v = o.migrate, h = a + Y;
|
|
268
|
+
let $ = i !== void 0 && n !== void 0, O = !1, z = !1;
|
|
269
|
+
const b = (g) => {
|
|
270
|
+
if (!i || n === void 0) return !1;
|
|
271
|
+
try {
|
|
272
|
+
return i.setItem(h, String(n)), !0;
|
|
273
|
+
} catch (S) {
|
|
274
|
+
return g && D() && typeof console < "u" && typeof console.warn == "function" && console.warn(g, S), !1;
|
|
275
|
+
}
|
|
276
|
+
}, A = e.state, k = N({
|
|
277
|
+
...e,
|
|
278
|
+
state: () => {
|
|
279
|
+
const g = A();
|
|
280
|
+
if (!i) return g;
|
|
281
|
+
try {
|
|
282
|
+
const S = i.getItem(a);
|
|
283
|
+
if (!S) return g;
|
|
284
|
+
const m = c.deserialize(S);
|
|
285
|
+
if (!I(m)) return g;
|
|
286
|
+
let r = m;
|
|
287
|
+
if (n !== void 0 && v) {
|
|
288
|
+
const s = i.getItem(h), f = s !== null ? Number(s) : 0, d = Number.isFinite(f) ? f : 0;
|
|
289
|
+
if (d !== n) {
|
|
290
|
+
$ = !1, O = !0;
|
|
291
|
+
const p = v(r, d);
|
|
292
|
+
if (!I(p)) return g;
|
|
293
|
+
r = p;
|
|
294
|
+
let l = !1;
|
|
295
|
+
try {
|
|
296
|
+
i.setItem(a, c.serialize(r)), l = !0, z = !0;
|
|
297
|
+
} catch (w) {
|
|
298
|
+
D() && typeof console < "u" && typeof console.warn == "function" && console.warn(`[bQuery store "${e.id}"] Failed to persist migrated state:`, w);
|
|
299
|
+
}
|
|
300
|
+
l && b(`[bQuery store "${e.id}"] Failed to persist migrated version:`) && (O = !1);
|
|
301
|
+
} else $ = !1;
|
|
302
|
+
}
|
|
303
|
+
return ee(g, r);
|
|
304
|
+
} catch {
|
|
305
|
+
return g;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
return $ && i ? b() : O && z && b(`[bQuery store "${e.id}"] Failed to persist migrated version after store creation:`) && (O = !1), k.$subscribe((g) => {
|
|
310
|
+
if (i)
|
|
311
|
+
try {
|
|
312
|
+
i.setItem(a, c.serialize(g)), O && b(`[bQuery store "${e.id}"] Failed to persist migrated version after a successful state write:`) && (O = !1);
|
|
313
|
+
} catch {
|
|
314
|
+
}
|
|
315
|
+
}), k;
|
|
316
|
+
}, ge = (e, t, o, a = {}) => {
|
|
317
|
+
const i = a.equals ?? (a.deep ? j : Object.is);
|
|
318
|
+
let c = t(e.$state);
|
|
319
|
+
return a.immediate && o(c, void 0), e.$subscribe((n) => {
|
|
320
|
+
const v = t(n);
|
|
321
|
+
if (!i(v, c)) {
|
|
322
|
+
const h = c;
|
|
323
|
+
c = v, o(v, h);
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
export {
|
|
328
|
+
le as a,
|
|
329
|
+
ce as c,
|
|
330
|
+
ye as i,
|
|
331
|
+
de as n,
|
|
332
|
+
ue as o,
|
|
333
|
+
pe as r,
|
|
334
|
+
N as s,
|
|
335
|
+
ge as t
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
//# sourceMappingURL=store-DWpyH6p5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-DWpyH6p5.js","names":[],"sources":["../src/store/plugins.ts","../src/store/utils.ts","../src/store/create-store.ts","../src/store/define-store.ts","../src/store/mapping.ts","../src/store/persisted.ts","../src/store/watch.ts"],"sourcesContent":["/**\n * Store plugins API.\n */\n\nimport type { Store, StoreDefinition, StorePlugin } from './types';\n\n/** @internal Registered plugins */\nconst plugins: StorePlugin[] = [];\n\n/**\n * Registers a plugin that extends all stores.\n *\n * @param plugin - The plugin function\n */\nexport const registerPlugin = (plugin: StorePlugin): void => {\n plugins.push(plugin);\n};\n\n/** @internal */\nexport const applyPlugins = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n store: Store<any, any, any>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n options: StoreDefinition<any, any, any>\n): void => {\n for (const plugin of plugins) {\n const extension = plugin({ store, options });\n if (extension) {\n Object.assign(store, extension);\n }\n }\n};\n","/**\r\n * Internal utilities for the store module.\r\n * @internal\r\n */\r\n\r\nimport { detectDevEnvironment } from '../core/env';\r\n\r\n/**\r\n * Check if a value is a plain object (not array, null, Date, etc.).\r\n * @internal\r\n */\r\nexport const isPlainObject = (value: unknown): value is Record<string, unknown> => {\r\n return (\r\n value !== null && typeof value === 'object' && Object.getPrototypeOf(value) === Object.prototype\r\n );\r\n};\r\n\r\n/**\r\n * Deep clones an object. Used for deep reactivity support.\r\n * @internal\r\n */\r\nexport const deepClone = <T>(obj: T): T => {\r\n if (obj === null || typeof obj !== 'object') {\r\n return obj;\r\n }\r\n\r\n if (Array.isArray(obj)) {\r\n return obj.map(deepClone) as T;\r\n }\r\n\r\n if (obj instanceof Date) {\r\n return new Date(obj.getTime()) as T;\r\n }\r\n\r\n if (obj instanceof Map) {\r\n return new Map(Array.from(obj.entries()).map(([k, v]) => [k, deepClone(v)])) as T;\r\n }\r\n\r\n if (obj instanceof Set) {\r\n return new Set(Array.from(obj).map(deepClone)) as T;\r\n }\r\n\r\n const cloned = {} as T;\r\n for (const key of Object.keys(obj)) {\r\n (cloned as Record<string, unknown>)[key] = deepClone((obj as Record<string, unknown>)[key]);\r\n }\r\n return cloned;\r\n};\r\n\r\n/**\r\n * Compares two values for deep equality.\r\n * @internal\r\n */\r\nexport const deepEqual = (a: unknown, b: unknown): boolean => {\r\n if (a === b) return true;\r\n if (a === null || b === null) return false;\r\n if (typeof a !== 'object' || typeof b !== 'object') return false;\r\n\r\n if (a instanceof Date && b instanceof Date) {\r\n return a.getTime() === b.getTime();\r\n }\r\n\r\n if (a instanceof Map && b instanceof Map) {\r\n if (a.size !== b.size) return false;\r\n for (const [key, value] of a.entries()) {\r\n if (!b.has(key) || !deepEqual(value, b.get(key))) return false;\r\n }\r\n return true;\r\n }\r\n\r\n if (a instanceof Set && b instanceof Set) {\r\n if (a.size !== b.size) return false;\r\n for (const value of a.values()) {\r\n let found = false;\r\n for (const candidate of b.values()) {\r\n if (deepEqual(value, candidate)) {\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (!found) return false;\r\n }\r\n return true;\r\n }\r\n\r\n if (Array.isArray(a) && Array.isArray(b)) {\r\n if (a.length !== b.length) return false;\r\n return a.every((item, i) => deepEqual(item, b[i]));\r\n }\r\n\r\n if (Array.isArray(a) !== Array.isArray(b)) return false;\r\n\r\n const keysA = Object.keys(a as object);\r\n const keysB = Object.keys(b as object);\r\n\r\n if (keysA.length !== keysB.length) return false;\r\n\r\n return keysA.every((key) =>\r\n deepEqual((a as Record<string, unknown>)[key], (b as Record<string, unknown>)[key])\r\n );\r\n};\r\n\r\n/**\r\n * Detects if nested objects were mutated but the reference stayed the same.\r\n * Returns the keys where nested mutations were detected.\r\n * @internal\r\n */\r\nexport const detectNestedMutations = <S extends Record<string, unknown>>(\r\n before: S,\r\n after: S,\r\n signalValues: Map<keyof S, unknown>\r\n): Array<keyof S> => {\r\n const mutatedKeys: Array<keyof S> = [];\r\n\r\n for (const key of Object.keys(after) as Array<keyof S>) {\r\n const beforeValue = before[key];\r\n const afterValue = after[key];\r\n const signalValue = signalValues.get(key);\r\n\r\n // Check if it's the same reference but content changed\r\n if (\r\n signalValue === afterValue &&\r\n isPlainObject(beforeValue) &&\r\n isPlainObject(afterValue) &&\r\n !deepEqual(beforeValue, afterValue)\r\n ) {\r\n mutatedKeys.push(key);\r\n }\r\n }\r\n\r\n return mutatedKeys;\r\n};\r\n\r\n/** @internal Returns whether development warnings should be enabled */\r\nexport const isDev = (): boolean => detectDevEnvironment();\r\n","/**\r\n * Store creation logic.\r\n */\r\n\r\nimport { isPromise } from '../core/utils/type-guards';\r\nimport {\r\n batch,\r\n computed,\r\n signal,\r\n untrack,\r\n type ReadonlySignal,\r\n type Signal,\r\n} from '../reactive/index';\r\nimport { notifyDevtoolsStateChange, registerDevtoolsStore } from './devtools';\r\nimport { applyPlugins } from './plugins';\r\nimport { getStore, hasStore, registerStore } from './registry';\r\nimport type {\r\n ActionContext,\r\n Getters,\r\n OnActionCallback,\r\n Store,\r\n StoreDefinition,\r\n StoreSubscriber,\r\n} from './types';\r\nimport { deepClone, detectNestedMutations, isDev } from './utils';\r\n\r\n/**\r\n * Creates a reactive store with state, getters, and actions.\r\n *\r\n * @template S - State type\r\n * @template G - Getters type\r\n * @template A - Actions type\r\n * @param definition - Store definition\r\n * @returns The reactive store instance\r\n */\r\nexport const createStore = <\r\n S extends Record<string, unknown>,\r\n G extends Record<string, unknown> = Record<string, never>,\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n A extends Record<string, (...args: any[]) => any> = Record<string, never>,\r\n>(\r\n definition: StoreDefinition<S, G, A>\r\n): Store<S, G, A> => {\r\n const { id, state: stateFactory, getters = {} as Getters<S, G>, actions = {} as A } = definition;\r\n\r\n // Check for duplicate store IDs\r\n if (hasStore(id)) {\r\n console.warn(`bQuery store: Store \"${id}\" already exists. Returning existing instance.`);\r\n return getStore(id) as Store<S, G, A>;\r\n }\r\n\r\n // Create initial state\r\n const initialState = stateFactory();\r\n\r\n // Create signals for each state property\r\n const stateSignals = new Map<keyof S, Signal<unknown>>();\r\n for (const key of Object.keys(initialState) as Array<keyof S>) {\r\n stateSignals.set(key, signal(initialState[key]));\r\n }\r\n\r\n // Subscribers for $subscribe\r\n const subscribers: Array<StoreSubscriber<S>> = [];\r\n\r\n // Action lifecycle hooks for $onAction\r\n const actionListeners: Array<OnActionCallback<S, G, A>> = [];\r\n\r\n const reportOnActionError = (\r\n phase: 'listener' | 'after' | 'onError',\r\n actionName: string,\r\n error: unknown\r\n ): void => {\r\n if (!isDev() || typeof console === 'undefined' || typeof console.error !== 'function') return;\r\n console.error(\r\n `[bQuery store \"${id}\"] Error in $onAction ${phase} for action \"${actionName}\"`,\r\n error\r\n );\r\n };\r\n\r\n const warnedAsyncOnActionListeners = new WeakSet<OnActionCallback<S, G, A>>();\r\n\r\n const warnAsyncOnActionListener = (\r\n listener: OnActionCallback<S, G, A>,\r\n actionName: string\r\n ): void => {\r\n if (!isDev() || typeof console === 'undefined' || typeof console.warn !== 'function') return;\r\n if (warnedAsyncOnActionListeners.has(listener)) return;\r\n warnedAsyncOnActionListeners.add(listener);\r\n console.warn(\r\n `[bQuery store \"${id}\"] Async $onAction listener detected for action \"${actionName}\". If it awaits, register after()/onError() before the first await; late registrations will not affect the current action.`\r\n );\r\n };\r\n\r\n /**\r\n * Executes an action observer callback without allowing observer failures to\r\n * affect the action result. Handles both synchronous exceptions and async\r\n * rejections, routing all failures through the standard $onAction logger.\r\n *\r\n * @internal\r\n */\r\n const runOnActionCallback = (\r\n phase: 'listener' | 'after' | 'onError',\r\n actionName: string,\r\n callback: () => unknown,\r\n listener?: OnActionCallback<S, G, A>\r\n ): void => {\r\n try {\r\n const result = callback();\r\n if (isPromise(result)) {\r\n if (phase === 'listener' && listener) {\r\n warnAsyncOnActionListener(listener, actionName);\r\n }\r\n void result.catch((error) => {\r\n reportOnActionError(phase, actionName, error);\r\n });\r\n }\r\n } catch (error) {\r\n reportOnActionError(phase, actionName, error);\r\n }\r\n };\r\n\r\n /**\r\n * Gets the current state.\r\n *\r\n * For subscriber notifications (where a plain object snapshot is needed),\r\n * this creates a shallow copy. For internal reads, use stateProxy directly.\r\n *\r\n * **Note:** Returns a shallow snapshot. Nested object mutations will NOT\r\n * trigger reactive updates. This differs from frameworks like Pinia that\r\n * use deep reactivity. To update nested state, replace the entire object.\r\n *\r\n * Uses `untrack()` to prevent accidental dependency tracking when called\r\n * from within reactive contexts (e.g., `effect()` or `computed()`).\r\n *\r\n * @internal\r\n */\r\n const getCurrentState = (): S =>\r\n untrack(() => {\r\n return { ...stateProxy };\r\n });\r\n\r\n /**\r\n * Notifies subscribers of state changes.\r\n * Short-circuits if there are no subscribers and devtools aren't active\r\n * to avoid unnecessary snapshot overhead.\r\n * @internal\r\n */\r\n const notifySubscribers = (): void => {\r\n // Early return if no subscribers and no devtools hook\r\n const hasDevtools =\r\n typeof window !== 'undefined' &&\r\n typeof window.__BQUERY_DEVTOOLS__?.onStateChange === 'function';\r\n if (subscribers.length === 0 && !hasDevtools) {\r\n return;\r\n }\r\n\r\n const currentState = getCurrentState();\r\n for (const callback of subscribers) {\r\n callback(currentState);\r\n }\r\n\r\n notifyDevtoolsStateChange(id, currentState);\r\n };\r\n\r\n /**\r\n * Cached state proxy that lazily reads signal values.\r\n * Uses a Proxy to avoid creating new objects on each access.\r\n *\r\n * **Note:** This returns a shallow snapshot of the state. Nested object\r\n * mutations will NOT trigger reactive updates. For nested reactivity,\r\n * replace the entire object or use signals for nested properties.\r\n *\r\n * @internal\r\n */\r\n const stateProxy = new Proxy({} as S, {\r\n get: (_, prop: string | symbol) => {\r\n const key = prop as keyof S;\r\n if (stateSignals.has(key)) {\r\n return stateSignals.get(key)!.value;\r\n }\r\n return undefined;\r\n },\r\n ownKeys: () => Array.from(stateSignals.keys()) as string[],\r\n getOwnPropertyDescriptor: (_, prop) => {\r\n if (stateSignals.has(prop as keyof S)) {\r\n return { enumerable: true, configurable: true };\r\n }\r\n return undefined;\r\n },\r\n has: (_, prop) => stateSignals.has(prop as keyof S),\r\n });\r\n\r\n // Create computed getters\r\n const getterComputed = new Map<keyof G, ReadonlySignal<unknown>>();\r\n\r\n // Build the store proxy\r\n const store = {} as Store<S, G, A>;\r\n\r\n // Define state properties with getters/setters\r\n for (const key of Object.keys(initialState) as Array<keyof S>) {\r\n Object.defineProperty(store, key, {\r\n get: () => stateSignals.get(key)!.value,\r\n set: (value: unknown) => {\r\n stateSignals.get(key)!.value = value;\r\n notifySubscribers();\r\n },\r\n enumerable: true,\r\n configurable: false,\r\n });\r\n }\r\n\r\n // Define getters as computed properties\r\n for (const key of Object.keys(getters) as Array<keyof G>) {\r\n const getterFn = getters[key];\r\n\r\n // Create computed that reads from state signals via proxy (more efficient)\r\n const computedGetter = computed(() => {\r\n const state = stateProxy;\r\n // For getter dependencies, pass a proxy that reads from computed getters\r\n const getterProxy = new Proxy({} as G, {\r\n get: (_, prop: string | symbol) => {\r\n const propKey = prop as keyof G;\r\n if (getterComputed.has(propKey)) {\r\n return getterComputed.get(propKey)!.value;\r\n }\r\n return undefined;\r\n },\r\n });\r\n return getterFn(state, getterProxy);\r\n });\r\n\r\n getterComputed.set(key, computedGetter as unknown as ReadonlySignal<unknown>);\r\n\r\n Object.defineProperty(store, key, {\r\n get: () => computedGetter.value,\r\n enumerable: true,\r\n configurable: false,\r\n });\r\n }\r\n\r\n // Bind actions to the store context, with $onAction lifecycle support\r\n for (const key of Object.keys(actions) as Array<keyof A>) {\r\n const actionFn = actions[key];\r\n const actionName = key as keyof A & string;\r\n\r\n // Wrap action to enable 'this' binding and $onAction hooks\r\n (store as Record<string, unknown>)[actionName] = function (...args: unknown[]) {\r\n // Create a context that allows 'this.property' access\r\n const context = new Proxy(store, {\r\n get: (target, prop) => {\r\n if (typeof prop === 'string' && stateSignals.has(prop as keyof S)) {\r\n return stateSignals.get(prop as keyof S)!.value;\r\n }\r\n return (target as Record<string, unknown>)[prop as string];\r\n },\r\n set: (target, prop, value) => {\r\n if (typeof prop === 'string' && stateSignals.has(prop as keyof S)) {\r\n stateSignals.get(prop as keyof S)!.value = value;\r\n notifySubscribers();\r\n return true;\r\n }\r\n // Allow non-state property assignments (e.g., temporary variables in actions)\r\n // by delegating to the target object rather than returning false\r\n return Reflect.set(target, prop, value);\r\n },\r\n });\r\n\r\n // Run $onAction hooks if any listeners are registered\r\n if (actionListeners.length === 0) {\r\n return actionFn.apply(context, args);\r\n }\r\n\r\n const afterHooks: Array<(result: unknown) => void> = [];\r\n const errorHooks: Array<(error: unknown) => void> = [];\r\n const listenerSnapshot = [...actionListeners];\r\n\r\n const listenerContext = {\r\n name: actionName,\r\n store,\r\n args: args as Parameters<A[typeof actionName]>,\r\n after: (callback: (result: Awaited<ReturnType<A[typeof actionName]>>) => void) => {\r\n afterHooks.push((result) =>\r\n callback(result as Awaited<ReturnType<A[typeof actionName]>>)\r\n );\r\n },\r\n onError: (callback: (error: unknown) => void) => {\r\n errorHooks.push(callback);\r\n },\r\n } satisfies ActionContext<S, G, A, typeof actionName>;\r\n\r\n // Notify all action listeners (before phase)\r\n for (const listener of listenerSnapshot) {\r\n runOnActionCallback('listener', actionName, () => listener(listenerContext), listener);\r\n }\r\n\r\n let result: unknown;\r\n try {\r\n result = actionFn.apply(context, args);\r\n } catch (error) {\r\n for (const hook of errorHooks) {\r\n runOnActionCallback('onError', actionName, () => hook(error));\r\n }\r\n throw error;\r\n }\r\n\r\n // Handle async actions (promises)\r\n if (isPromise(result)) {\r\n return result.then(\r\n (resolved) => {\r\n for (const hook of afterHooks) {\r\n runOnActionCallback('after', actionName, () => hook(resolved));\r\n }\r\n return resolved;\r\n },\r\n (error) => {\r\n for (const hook of errorHooks) {\r\n runOnActionCallback('onError', actionName, () => hook(error));\r\n }\r\n throw error;\r\n }\r\n );\r\n }\r\n\r\n // Sync action — run after hooks immediately\r\n for (const hook of afterHooks) {\r\n runOnActionCallback('after', actionName, () => hook(result));\r\n }\r\n return result;\r\n };\r\n }\r\n\r\n // Add store utility methods\r\n Object.defineProperties(store, {\r\n $id: {\r\n value: id,\r\n writable: false,\r\n enumerable: false,\r\n },\r\n $reset: {\r\n value: () => {\r\n const fresh = stateFactory();\r\n batch(() => {\r\n for (const [key, sig] of stateSignals) {\r\n sig.value = fresh[key];\r\n }\r\n });\r\n notifySubscribers();\r\n },\r\n writable: false,\r\n enumerable: false,\r\n },\r\n $subscribe: {\r\n value: (callback: StoreSubscriber<S>) => {\r\n subscribers.push(callback);\r\n return () => {\r\n const index = subscribers.indexOf(callback);\r\n if (index > -1) subscribers.splice(index, 1);\r\n };\r\n },\r\n writable: false,\r\n enumerable: false,\r\n },\r\n $onAction: {\r\n value: (callback: OnActionCallback<S, G, A>) => {\r\n actionListeners.push(callback);\r\n return () => {\r\n const index = actionListeners.indexOf(callback);\r\n if (index > -1) actionListeners.splice(index, 1);\r\n };\r\n },\r\n writable: false,\r\n enumerable: false,\r\n },\r\n $patch: {\r\n value: (partial: Partial<S> | ((state: S) => void)) => {\r\n batch(() => {\r\n if (typeof partial === 'function') {\r\n // Capture state before mutation for nested mutation detection\r\n const devMode = isDev();\r\n const stateBefore = devMode ? deepClone(getCurrentState()) : null;\r\n const signalValuesBefore = devMode\r\n ? new Map(Array.from(stateSignals.entries()).map(([k, s]) => [k, s.value]))\r\n : null;\r\n\r\n // Mutation function\r\n const state = getCurrentState();\r\n partial(state);\r\n\r\n // Detect nested mutations in development mode\r\n if (devMode && stateBefore && signalValuesBefore) {\r\n const mutatedKeys = detectNestedMutations(stateBefore, state, signalValuesBefore);\r\n if (mutatedKeys.length > 0) {\r\n console.warn(\r\n `[bQuery store \"${id}\"] Nested mutation detected in $patch() for keys: ${mutatedKeys\r\n .map(String)\r\n .join(', ')}.\\n` +\r\n 'Nested object mutations do not trigger reactive updates because the store uses shallow reactivity.\\n' +\r\n 'To fix this, either:\\n' +\r\n ' 1. Replace the entire object: state.user = { ...state.user, name: \"New\" }\\n' +\r\n ' 2. Use $patchDeep() for automatic deep cloning\\n' +\r\n 'See: https://bquery.dev/guide/store#deep-reactivity'\r\n );\r\n }\r\n }\r\n\r\n for (const [key, value] of Object.entries(state) as Array<[keyof S, unknown]>) {\r\n if (stateSignals.has(key)) {\r\n stateSignals.get(key)!.value = value;\r\n }\r\n }\r\n } else {\r\n // Partial object\r\n for (const [key, value] of Object.entries(partial) as Array<[keyof S, unknown]>) {\r\n if (stateSignals.has(key)) {\r\n stateSignals.get(key)!.value = value;\r\n }\r\n }\r\n }\r\n });\r\n notifySubscribers();\r\n },\r\n writable: false,\r\n enumerable: false,\r\n },\r\n $patchDeep: {\r\n value: (partial: Partial<S> | ((state: S) => void)) => {\r\n batch(() => {\r\n if (typeof partial === 'function') {\r\n // Deep clone state before mutation to ensure new references\r\n const state = deepClone(getCurrentState());\r\n partial(state);\r\n\r\n for (const [key, value] of Object.entries(state) as Array<[keyof S, unknown]>) {\r\n if (stateSignals.has(key)) {\r\n stateSignals.get(key)!.value = value;\r\n }\r\n }\r\n } else {\r\n // Deep clone each value in partial to ensure new references\r\n for (const [key, value] of Object.entries(partial) as Array<[keyof S, unknown]>) {\r\n if (stateSignals.has(key)) {\r\n stateSignals.get(key)!.value = deepClone(value);\r\n }\r\n }\r\n }\r\n });\r\n notifySubscribers();\r\n },\r\n writable: false,\r\n enumerable: false,\r\n },\r\n $state: {\r\n get: () => getCurrentState(),\r\n enumerable: false,\r\n },\r\n });\r\n\r\n // Register store\r\n registerStore(id, store);\r\n\r\n // Apply plugins\r\n applyPlugins(store, definition);\r\n\r\n // Notify devtools\r\n registerDevtoolsStore(id, store);\r\n\r\n return store;\r\n};\r\n","/**\n * Store factory helpers.\n */\n\nimport { createStore } from './create-store';\nimport { getStore, hasStore } from './registry';\nimport type { Store, StoreDefinition } from './types';\n\n/**\n * Creates a store factory that returns the store instance.\n *\n * The store is lazily created on first call and cached in the global store\n * registry. Subsequent calls return the same instance. After calling\n * `destroyStore(id)`, the next factory call will create a fresh store.\n *\n * @param id - Store identifier\n * @param definition - Store definition without id\n * @returns A function that returns the store instance\n *\n * @example\n * ```ts\n * const useCounter = defineStore('counter', {\n * state: () => ({ count: 0 }),\n * actions: { increment() { this.count++; } },\n * });\n *\n * const counter = useCounter();\n * counter.increment();\n * ```\n */\nexport const defineStore = <\n S extends Record<string, unknown>,\n G extends Record<string, unknown> = Record<string, never>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- actions may declare specific parameter types\n A extends Record<string, (...args: any[]) => any> = Record<string, never>,\n>(\n id: string,\n definition: Omit<StoreDefinition<S, G, A>, 'id'>\n): (() => Store<S, G, A>) => {\n // Check registry first to avoid noisy warnings from createStore()\n // when the factory is called multiple times (intended usage pattern).\n // createStore() only called when store doesn't exist or was destroyed.\n return () => {\n if (hasStore(id)) {\n return getStore(id) as Store<S, G, A>;\n }\n return createStore({ id, ...definition });\n };\n};\n","/**\n * Mapping helpers for store state and actions.\n */\n\n/**\n * Maps store state properties to a reactive object for use in components.\n *\n * @param store - The store instance\n * @param keys - State keys to map\n * @returns Object with mapped properties\n */\nexport const mapState = <S extends Record<string, unknown>, K extends keyof S>(\n store: S,\n keys: K[]\n): Pick<S, K> => {\n const mapped = {} as Pick<S, K>;\n\n for (const key of keys) {\n Object.defineProperty(mapped, key, {\n get: () => store[key],\n enumerable: true,\n });\n }\n\n return mapped;\n};\n\n/**\n * Maps store getters to a reactive object for use in components.\n *\n * @param store - The store instance\n * @param keys - Getter keys to map\n * @returns Object with mapped getters\n */\nexport const mapGetters = <G extends Record<string, unknown>, K extends keyof G>(\n store: G,\n keys: K[]\n): Pick<G, K> => {\n const mapped = {} as Pick<G, K>;\n\n for (const key of keys) {\n Object.defineProperty(mapped, key, {\n get: () => store[key],\n enumerable: true,\n });\n }\n\n return mapped;\n};\n\n/**\n * Maps store actions to an object for easier destructuring.\n *\n * @param store - The store instance\n * @param keys - Action keys to map\n * @returns Object with mapped actions\n */\nexport const mapActions = <\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- actions may declare specific parameter types\n A extends Record<string, (...args: any[]) => any>,\n K extends keyof A,\n>(\n store: A,\n keys: K[]\n): Pick<A, K> => {\n const mapped = {} as Pick<A, K>;\n\n for (const key of keys) {\n (mapped as Record<string, unknown>)[key as string] = (...args: unknown[]) =>\n (store[key] as (...args: unknown[]) => unknown)(...args);\n }\n\n return mapped;\n};\n","/**\r\n * Store persistence helpers.\r\n */\r\n\r\nimport { isPrototypePollutionKey } from '../core/utils/object';\r\nimport { createStore } from './create-store';\r\nimport { isDev } from './utils';\r\nimport type { PersistedStoreOptions, StorageBackend, Store, StoreDefinition } from './types';\r\n\r\n/** @internal Version key suffix */\r\nconst VERSION_SUFFIX = '__version';\r\n\r\n/** @internal Default JSON serializer */\r\nconst defaultSerializer = {\r\n serialize: (state: unknown) => JSON.stringify(state),\r\n deserialize: (raw: string) => JSON.parse(raw) as unknown,\r\n};\r\n\r\n/** @internal Check whether a value can be merged into store state. */\r\nconst isPersistedStateObject = (value: unknown): value is Record<string, unknown> => {\r\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return false;\r\n\r\n const prototype = Object.getPrototypeOf(value);\r\n return prototype === null || Object.getPrototypeOf(prototype) === null;\r\n};\r\n\r\n/**\r\n * Applies persisted state onto the default state while ignoring dangerous\r\n * prototype-pollution keys such as `__proto__`, `constructor`, and `prototype`.\r\n *\r\n * @internal\r\n */\r\nconst mergePersistedState = <S extends Record<string, unknown>>(\r\n defaultState: S,\r\n persisted: Record<string, unknown>\r\n): S => {\r\n const merged = { ...defaultState };\r\n for (const [key, value] of Object.entries(persisted)) {\r\n if (isPrototypePollutionKey(key)) continue;\r\n if (!Object.prototype.hasOwnProperty.call(defaultState, key)) continue;\r\n merged[key as keyof S] = value as S[keyof S];\r\n }\r\n return merged;\r\n};\r\n\r\n/** @internal Resolve the default storage backend safely. */\r\nconst getDefaultStorage = (): StorageBackend | undefined => {\r\n try {\r\n return globalThis.localStorage;\r\n } catch {\r\n return undefined;\r\n }\r\n};\r\n\r\n/**\r\n * Creates a store with automatic persistence.\r\n *\r\n * Supports configurable storage backends, custom serializers, and schema\r\n * versioning with migration functions. All options are optional and\r\n * backward-compatible with the simple `(definition, storageKey?)` signature.\r\n *\r\n * @param definition - Store definition\r\n * @param options - Persistence options or a plain string storage key for backward compatibility\r\n * @returns The reactive store instance\r\n *\r\n * @example Basic usage (localStorage + JSON)\r\n * ```ts\r\n * const store = createPersistedStore({\r\n * id: 'settings',\r\n * state: () => ({ theme: 'dark' }),\r\n * });\r\n * ```\r\n *\r\n * @example With sessionStorage and custom key\r\n * ```ts\r\n * const store = createPersistedStore(\r\n * { id: 'session', state: () => ({ token: '' }) },\r\n * { key: 'my-session', storage: sessionStorage },\r\n * );\r\n * ```\r\n *\r\n * @example With versioning and migration\r\n * ```ts\r\n * const store = createPersistedStore(\r\n * { id: 'app', state: () => ({ name: '', theme: 'auto' }) },\r\n * {\r\n * version: 2,\r\n * migrate: (old, v) => {\r\n * if (v < 2) return { ...old, theme: 'auto' };\r\n * return old;\r\n * },\r\n * },\r\n * );\r\n * ```\r\n */\r\nexport const createPersistedStore = <\r\n S extends Record<string, unknown>,\r\n G extends Record<string, unknown> = Record<string, never>,\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- actions may declare specific parameter types\r\n A extends Record<string, (...args: any[]) => any> = Record<string, never>,\r\n>(\r\n definition: StoreDefinition<S, G, A>,\r\n options?: PersistedStoreOptions | string\r\n): Store<S, G, A> => {\r\n // Normalize options — a plain string is treated as the storage key for backward compatibility\r\n const opts: PersistedStoreOptions =\r\n typeof options === 'string' ? { key: options } : (options ?? {});\r\n\r\n const key = opts.key ?? `bquery-store-${definition.id}`;\r\n const storage = opts.storage ?? getDefaultStorage();\r\n const serializer = opts.serializer ?? defaultSerializer;\r\n const version = opts.version;\r\n const migrate = opts.migrate;\r\n const versionKey = key + VERSION_SUFFIX;\r\n let shouldPersistInitialVersion = storage !== undefined && version !== undefined;\r\n let pendingVersionWrite = false;\r\n let canRetryPendingVersionAfterCreate = false;\r\n\r\n const tryPersistVersion = (warningMessage?: string): boolean => {\r\n if (!storage || version === undefined) return false;\r\n\r\n try {\r\n storage.setItem(versionKey, String(version));\r\n return true;\r\n } catch (error) {\r\n if (\r\n warningMessage &&\r\n isDev() &&\r\n typeof console !== 'undefined' &&\r\n typeof console.warn === 'function'\r\n ) {\r\n console.warn(warningMessage, error);\r\n }\r\n return false;\r\n }\r\n };\r\n\r\n const originalStateFactory = definition.state;\r\n\r\n const wrappedDefinition: StoreDefinition<S, G, A> = {\r\n ...definition,\r\n state: () => {\r\n const defaultState = originalStateFactory();\r\n\r\n if (!storage) return defaultState;\r\n\r\n try {\r\n const saved = storage.getItem(key);\r\n if (!saved) return defaultState;\r\n\r\n const deserialized = serializer.deserialize(saved);\r\n if (!isPersistedStateObject(deserialized)) {\r\n return defaultState;\r\n }\r\n\r\n let persisted = deserialized;\r\n\r\n // Handle versioning & migration\r\n if (version !== undefined && migrate) {\r\n const rawVersion = storage.getItem(versionKey);\r\n const parsedVersion = rawVersion !== null ? Number(rawVersion) : 0;\r\n const oldVersion = Number.isFinite(parsedVersion) ? parsedVersion : 0;\r\n\r\n if (oldVersion !== version) {\r\n shouldPersistInitialVersion = false;\r\n pendingVersionWrite = true;\r\n const migrated = migrate(persisted, oldVersion);\r\n if (!isPersistedStateObject(migrated)) {\r\n return defaultState;\r\n }\r\n persisted = migrated;\r\n\r\n let migratedStatePersisted = false;\r\n // Save the migrated state and version immediately when possible.\r\n // If the state write fails, never advance the version key.\r\n try {\r\n storage.setItem(key, serializer.serialize(persisted));\r\n migratedStatePersisted = true;\r\n canRetryPendingVersionAfterCreate = true;\r\n } catch (e) {\r\n // Migration will re-run on next load, but state is still usable\r\n if (\r\n isDev() &&\r\n typeof console !== 'undefined' &&\r\n typeof console.warn === 'function'\r\n ) {\r\n console.warn(\r\n `[bQuery store \"${definition.id}\"] Failed to persist migrated state:`,\r\n e\r\n );\r\n }\r\n }\r\n\r\n if (\r\n migratedStatePersisted &&\r\n tryPersistVersion(\r\n `[bQuery store \"${definition.id}\"] Failed to persist migrated version:`\r\n )\r\n ) {\r\n pendingVersionWrite = false;\r\n }\r\n } else {\r\n shouldPersistInitialVersion = false;\r\n }\r\n }\r\n\r\n return mergePersistedState(defaultState, persisted);\r\n } catch {\r\n // Ignore parse errors\r\n return defaultState;\r\n }\r\n },\r\n };\r\n\r\n const store = createStore(wrappedDefinition);\r\n\r\n // Persist the version number on first creation\r\n if (shouldPersistInitialVersion && storage) {\r\n tryPersistVersion();\r\n } else if (\r\n pendingVersionWrite &&\r\n canRetryPendingVersionAfterCreate &&\r\n tryPersistVersion(\r\n `[bQuery store \"${definition.id}\"] Failed to persist migrated version after store creation:`\r\n )\r\n ) {\r\n pendingVersionWrite = false;\r\n }\r\n\r\n // Subscribe to save changes\r\n store.$subscribe((state) => {\r\n if (!storage) return;\r\n try {\r\n storage.setItem(key, serializer.serialize(state));\r\n if (\r\n pendingVersionWrite &&\r\n tryPersistVersion(\r\n `[bQuery store \"${definition.id}\"] Failed to persist migrated version after a successful state write:`\r\n )\r\n ) {\r\n pendingVersionWrite = false;\r\n }\r\n } catch {\r\n // Ignore quota errors\r\n }\r\n });\r\n\r\n return store;\r\n};\r\n","/**\n * Store watch helpers.\n */\n\nimport type { Store } from './types';\nimport { deepEqual } from './utils';\n\nexport type WatchStoreOptions<T> = {\n /** Call the callback immediately with the current value. */\n immediate?: boolean;\n /** Use deep comparison when determining changes. */\n deep?: boolean;\n /** Custom equality check for selected values. */\n equals?: (a: T, b: T) => boolean;\n};\n\n/**\n * Watch a selected slice of store state.\n *\n * @param store - The store instance\n * @param selector - Function to select the watched value\n * @param callback - Called when the selected value changes\n * @param options - Watch options\n * @returns Unsubscribe function\n */\nexport const watchStore = <\n S extends Record<string, unknown>,\n G extends Record<string, unknown>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- actions may declare specific parameter types\n A extends Record<string, (...args: any[]) => any>,\n T,\n>(\n store: Store<S, G, A>,\n selector: (state: S) => T,\n callback: (value: T, previous: T | undefined) => void,\n options: WatchStoreOptions<T> = {}\n): (() => void) => {\n const equals = options.equals ?? (options.deep ? deepEqual : Object.is);\n let previous = selector(store.$state);\n\n if (options.immediate) {\n callback(previous, undefined);\n }\n\n return store.$subscribe((state) => {\n const current = selector(state);\n if (!equals(current, previous)) {\n const prev = previous;\n previous = current;\n callback(current, prev);\n }\n });\n};\n"],"mappings":";;;;;;;AAOA,IAAM,IAAyB,CAAA,GAOlB,KAAA,CAAkB,MAA8B;AAC3D,EAAA,EAAQ,KAAK,CAAA;GAIF,IAAA,CAEX,GAEA,MACS;AACT,aAAW,KAAU,GAAS;AAC5B,UAAM,IAAY,EAAO;AAAA,MAAE,OAAA;AAAA,MAAO,SAAA;AAAA,KAAS;AAC3C,IAAI,KACF,OAAO,OAAO,GAAO,CAAA;AAAA;GCjBd,IAAA,CAAiB,MAE1B,MAAU,QAAQ,OAAO,KAAU,YAAY,OAAO,eAAe,CAAA,MAAW,OAAO,WAQ9E,IAAA,CAAgB,MAAc;AACzC,MAAI,MAAQ,QAAQ,OAAO,KAAQ,SACjC,QAAO;AAGT,MAAI,MAAM,QAAQ,CAAA,EAChB,QAAO,EAAI,IAAI,CAAA;AAGjB,MAAI,aAAe,KACjB,QAAO,IAAI,KAAK,EAAI,QAAA,CAAS;AAG/B,MAAI,aAAe,IACjB,QAAO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B,QAAK;AACL,UAAI;AACF,QAAA,EAAQ,QAAQ,GAAK,EAAW,UAAU,CAAA,CAAM,GAE9C,KACA,EACE,kBAAkB,EAAW,EAAA,uEAAG,MAGlC,IAAsB;AAAA,cAElB;AAAA,MAAA;AAAA,MAKH;GC9NI,KAAA,CAOX,GACA,GACA,GACA,IAAgC,CAAA,MACf;AACjB,QAAM,IAAS,EAAQ,WAAW,EAAQ,OAAO,IAAY,OAAO;AACpE,MAAI,IAAW,EAAS,EAAM,MAAA;AAE9B,SAAI,EAAQ,aACV,EAAS,GAAU,MAAA,GAGd,EAAM,WAAA,CAAY,MAAU;AACjC,UAAM,IAAU,EAAS,CAAA;AACzB,QAAI,CAAC,EAAO,GAAS,CAAA,GAAW;AAC9B,YAAM,IAAO;AACb,MAAA,IAAW,GACX,EAAS,GAAS,CAAA;AAAA"}
|
package/dist/store.es.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as e, n as r, t as s } from "./registry-CWf368tT.js";
|
|
2
|
+
import { a as o, c as i, i as S, n as m, o as p, r as c, s as n, t as d } from "./store-DWpyH6p5.js";
|
|
2
3
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
m as createPersistedStore,
|
|
5
|
+
n as createStore,
|
|
6
|
+
p as defineStore,
|
|
6
7
|
s as destroyStore,
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
r as getStore,
|
|
9
|
+
e as listStores,
|
|
9
10
|
c as mapActions,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
S as mapGetters,
|
|
12
|
+
o as mapState,
|
|
13
|
+
i as registerPlugin,
|
|
14
|
+
d as watchStore
|
|
14
15
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storybook template helpers for authoring bQuery component stories.
|
|
3
|
+
*
|
|
4
|
+
* `storyHtml` mirrors bQuery's string-based `html` tag while adding support for
|
|
5
|
+
* Storybook-friendly boolean attribute shorthand (`?disabled=${true}`).
|
|
6
|
+
*
|
|
7
|
+
* @module bquery/storybook
|
|
8
|
+
*/
|
|
9
|
+
type StoryValue = string | number | boolean | null | undefined | StoryValue[] | (() => StoryValue);
|
|
10
|
+
/**
|
|
11
|
+
* Tagged template literal for Storybook render functions.
|
|
12
|
+
*
|
|
13
|
+
* Supports boolean attribute shorthand compatible with Storybook's string
|
|
14
|
+
* renderer:
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* storyHtml`<bq-button ?disabled=${true}>Save</bq-button>`;
|
|
18
|
+
* // => '<bq-button disabled="">Save</bq-button>'
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param strings - Template literal string parts
|
|
22
|
+
* @param values - Interpolated values
|
|
23
|
+
* @returns HTML string compatible with `@storybook/web-components`
|
|
24
|
+
*/
|
|
25
|
+
export declare const storyHtml: (strings: TemplateStringsArray, ...values: StoryValue[]) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Conditionally render a value or template fragment.
|
|
28
|
+
*
|
|
29
|
+
* @param condition - Condition that controls rendering
|
|
30
|
+
* @param truthyValue - Value or callback rendered when the condition is truthy
|
|
31
|
+
* @param falsyValue - Optional value or callback rendered when the condition is falsy
|
|
32
|
+
* @returns Rendered string fragment, or an empty string when the condition is
|
|
33
|
+
* falsy and no fallback is provided
|
|
34
|
+
*/
|
|
35
|
+
export declare const when: (condition: unknown, truthyValue: StoryValue, falsyValue?: StoryValue) => string;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storybook/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,KAAK,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,UAAU,EAAE,GAAG,CAAC,MAAM,UAAU,CAAC,CAAC;AAganG;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS,GAAI,SAAS,oBAAoB,EAAE,GAAG,QAAQ,UAAU,EAAE,KAAG,MAoBlF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI,GACf,WAAW,OAAO,EAClB,aAAa,UAAU,EACvB,aAAa,UAAU,KACtB,MAEF,CAAC"}
|