@bquery/bquery 1.6.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 +716 -586
- 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.map +1 -1
- package/dist/component/html.d.ts.map +1 -1
- package/dist/component/index.d.ts +2 -1
- 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 +53 -1
- 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 +9 -6
- package/dist/{config-DRmZZno3.js → config-BW35FKuA.js} +4 -4
- package/dist/{config-DRmZZno3.js.map → config-BW35FKuA.js.map} +1 -1
- 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-DnlyjbF2.js +112 -0
- package/dist/core-DnlyjbF2.js.map +1 -0
- 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 +35 -7
- package/dist/full.d.ts.map +1 -1
- package/dist/full.es.mjs +182 -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 +227 -136
- 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/{view-C70lA3vf.js → mount-SM07RUa6.js} +166 -160
- 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-Dr9b6fsq.js → platform-CPbCprb6.js} +21 -22
- package/dist/{platform-Dr9b6fsq.js.map → platform-CPbCprb6.js.map} +1 -1
- 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 +19 -20
- 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-Bs2dkMby.js → sanitize-B1V4JswB.js} +2 -1
- package/dist/{sanitize-Bs2dkMby.js.map → sanitize-B1V4JswB.js.map} +1 -1
- package/dist/security/index.d.ts +2 -2
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security.es.mjs +1 -1
- 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/index.d.ts +1 -1
- package/dist/store/index.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 +138 -1
- 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-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.map +1 -1
- package/dist/storybook.es.mjs +1 -1
- package/dist/storybook.es.mjs.map +1 -1
- 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 +9 -9
- package/package.json +177 -141
- 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 +104 -29
- package/src/component/html.ts +5 -5
- package/src/component/index.ts +2 -0
- package/src/component/library.ts +26 -2
- package/src/component/scope.ts +212 -0
- package/src/component/types.ts +94 -40
- 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 +253 -2
- 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/types.ts +271 -208
- package/src/motion/typewriter.ts +164 -0
- package/src/plugin/index.ts +37 -0
- package/src/plugin/registry.ts +269 -0
- package/src/plugin/types.ts +137 -0
- package/src/reactive/computed.ts +130 -92
- 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/index.ts +2 -7
- package/src/security/sanitize.ts +70 -70
- package/src/security/trusted-html.ts +71 -71
- 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 +49 -49
- package/src/store/index.ts +27 -22
- package/src/store/mapping.ts +74 -74
- package/src/store/persisted.ts +206 -19
- package/src/store/types.ts +157 -2
- package/src/store/utils.ts +135 -141
- package/src/store/watch.ts +53 -53
- package/src/storybook/index.ts +2 -1
- 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-BEQgt5hl.js +0 -600
- package/dist/component-BEQgt5hl.js.map +0 -1
- package/dist/core-BGQJVw0-.js +0 -35
- package/dist/core-BGQJVw0-.js.map +0 -1
- package/dist/core-CCEabVHl.js +0 -648
- package/dist/core-CCEabVHl.js.map +0 -1
- package/dist/effect-AFRW_Plg.js +0 -84
- package/dist/effect-AFRW_Plg.js.map +0 -1
- package/dist/motion-D9TcHxOF.js +0 -415
- package/dist/motion-D9TcHxOF.js.map +0 -1
- package/dist/reactive-DSkct0dO.js +0 -254
- package/dist/reactive-DSkct0dO.js.map +0 -1
- package/dist/router-CbDhl8rS.js +0 -188
- package/dist/router-CbDhl8rS.js.map +0 -1
- package/dist/store-BwDvI45q.js +0 -263
- package/dist/store-BwDvI45q.js.map +0 -1
- package/dist/untrack-B0rVscTc.js +0 -7
- package/dist/untrack-B0rVscTc.js.map +0 -1
- package/dist/view-C70lA3vf.js.map +0 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global plugin registry for bQuery.
|
|
3
|
+
*
|
|
4
|
+
* Provides `use()` to register plugins and query helpers consumed by
|
|
5
|
+
* other modules (e.g. the view module reads custom directives from here).
|
|
6
|
+
*
|
|
7
|
+
* @module bquery/plugin
|
|
8
|
+
*/
|
|
9
|
+
import type { BQueryPlugin, CustomDirective, CustomDirectiveHandler } from './types';
|
|
10
|
+
/**
|
|
11
|
+
* Register a bQuery plugin.
|
|
12
|
+
*
|
|
13
|
+
* Plugins are installed at most once (identified by `plugin.name`).
|
|
14
|
+
* Duplicate calls with the same name are silently ignored.
|
|
15
|
+
*
|
|
16
|
+
* @param plugin - The plugin object implementing `{ name, install }`.
|
|
17
|
+
* @param options - Optional configuration forwarded to `plugin.install()`.
|
|
18
|
+
* @throws If `plugin` is not a valid plugin object.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { use } from '@bquery/bquery/plugin';
|
|
23
|
+
*
|
|
24
|
+
* use({
|
|
25
|
+
* name: 'highlight',
|
|
26
|
+
* install(ctx) {
|
|
27
|
+
* ctx.directive('highlight', (el, expr) => {
|
|
28
|
+
* (el as HTMLElement).style.background = String(expr);
|
|
29
|
+
* });
|
|
30
|
+
* },
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare const use: <TOptions = unknown>(plugin: BQueryPlugin<TOptions>, options?: TOptions) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Check whether a plugin with the given name has been installed.
|
|
37
|
+
*
|
|
38
|
+
* @param name - The plugin name to check.
|
|
39
|
+
* @returns `true` if the plugin was previously installed via `use()`.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* import { isInstalled } from '@bquery/bquery/plugin';
|
|
44
|
+
*
|
|
45
|
+
* if (!isInstalled('my-plugin')) {
|
|
46
|
+
* use(myPlugin);
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare const isInstalled: (name: string) => boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Return a read-only snapshot of all installed plugin names.
|
|
53
|
+
*
|
|
54
|
+
* @returns Array of plugin name strings.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { getInstalledPlugins } from '@bquery/bquery/plugin';
|
|
59
|
+
* console.log(getInstalledPlugins()); // ['my-plugin', 'other-plugin']
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare const getInstalledPlugins: () => readonly string[];
|
|
63
|
+
/**
|
|
64
|
+
* Retrieve the handler for a custom directive registered by a plugin.
|
|
65
|
+
*
|
|
66
|
+
* This is used internally by the view module's `processElement` to
|
|
67
|
+
* resolve directives that aren't built-in.
|
|
68
|
+
*
|
|
69
|
+
* @param name - Directive name **without** prefix (e.g. `'tooltip'`).
|
|
70
|
+
* @returns The handler, or `undefined` if none is registered.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* import { getCustomDirective } from '@bquery/bquery/plugin';
|
|
75
|
+
* const handler = getCustomDirective('tooltip');
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare const getCustomDirective: (name: string) => CustomDirectiveHandler | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Return a read-only snapshot of all registered custom directives.
|
|
81
|
+
*
|
|
82
|
+
* @returns Array of `{ name, handler }` descriptors.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* import { getCustomDirectives } from '@bquery/bquery/plugin';
|
|
87
|
+
* for (const { name, handler } of getCustomDirectives()) {
|
|
88
|
+
* console.log(`Directive: bq-${name}`);
|
|
89
|
+
* }
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export declare const getCustomDirectives: () => readonly CustomDirective[];
|
|
93
|
+
/**
|
|
94
|
+
* Reset all plugin registrations.
|
|
95
|
+
*
|
|
96
|
+
* Clears all installed plugins and custom directives.
|
|
97
|
+
*
|
|
98
|
+
* This utility is primarily intended for tests and other isolated environments
|
|
99
|
+
* that need to reinitialize plugin state between runs.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* import { resetPlugins } from '@bquery/bquery/plugin';
|
|
104
|
+
* afterEach(() => resetPlugins());
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
export declare const resetPlugins: () => void;
|
|
108
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/plugin/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AA0GjB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,GAAG,GAAI,QAAQ,GAAG,OAAO,EACpC,QAAQ,YAAY,CAAC,QAAQ,CAAC,EAC9B,UAAU,QAAQ,KACjB,IAqCF,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,KAAG,OAAqC,CAAC;AAEjF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,QAAO,SAAS,MAAM,EAA2B,CAAC;AAElF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,KAAG,sBAAsB,GAAG,SAC/C,CAAC;AAE7B;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,QAAO,SAAS,eAAe,EACgB,CAAC;AAEhF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,QAAO,IAG/B,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public types for the bQuery plugin system.
|
|
3
|
+
*
|
|
4
|
+
* Plugins extend bQuery by registering custom directives and Web Components
|
|
5
|
+
* through a single unified interface.
|
|
6
|
+
*
|
|
7
|
+
* @module bquery/plugin
|
|
8
|
+
*/
|
|
9
|
+
import type { CleanupFn } from '../reactive/index';
|
|
10
|
+
import type { BindingContext } from '../view/types';
|
|
11
|
+
/**
|
|
12
|
+
* A custom directive handler that is invoked when the view module encounters
|
|
13
|
+
* a `bq-{name}` attribute during mount processing.
|
|
14
|
+
*
|
|
15
|
+
* @param el - The DOM element carrying the directive attribute
|
|
16
|
+
* @param expression - The raw attribute value (expression string)
|
|
17
|
+
* @param context - The current binding context (data / signals)
|
|
18
|
+
* @param cleanups - Array where the handler should push any cleanup functions
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const tooltipDirective: CustomDirectiveHandler = (el, expression, ctx, cleanups) => {
|
|
23
|
+
* const tip = document.createElement('span');
|
|
24
|
+
* tip.textContent = String(expression);
|
|
25
|
+
* el.appendChild(tip);
|
|
26
|
+
* cleanups.push(() => tip.remove());
|
|
27
|
+
* };
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export type CustomDirectiveHandler = (el: Element, expression: string, context: BindingContext, cleanups: CleanupFn[]) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Descriptor for a custom directive registered by a plugin.
|
|
33
|
+
*/
|
|
34
|
+
export interface CustomDirective {
|
|
35
|
+
/** The directive name (without prefix). e.g. `'tooltip'` → `bq-tooltip` */
|
|
36
|
+
readonly name: string;
|
|
37
|
+
/** The handler function called when the directive is encountered. */
|
|
38
|
+
readonly handler: CustomDirectiveHandler;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Context object provided to a plugin's `install` function.
|
|
42
|
+
*
|
|
43
|
+
* Plugins use these helpers to register their contributions into bQuery's
|
|
44
|
+
* global registries without directly importing internal modules.
|
|
45
|
+
*/
|
|
46
|
+
export interface PluginInstallContext {
|
|
47
|
+
/**
|
|
48
|
+
* Register a custom view directive that will be recognized during
|
|
49
|
+
* `mount()` processing.
|
|
50
|
+
*
|
|
51
|
+
* @param name - Directive name **without** the `bq-` prefix (e.g. `'tooltip'`)
|
|
52
|
+
* @param handler - The handler called for each element with the directive
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* ctx.directive('focus', (el) => {
|
|
57
|
+
* (el as HTMLElement).focus();
|
|
58
|
+
* });
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
directive(name: string, handler: CustomDirectiveHandler): void;
|
|
62
|
+
/**
|
|
63
|
+
* Register a Web Component via the native `customElements.define()` API.
|
|
64
|
+
*
|
|
65
|
+
* @param tagName - Custom element tag (e.g. `'my-counter'`)
|
|
66
|
+
* @param constructor - The `HTMLElement` subclass
|
|
67
|
+
* @param options - Optional `ElementDefinitionOptions` (e.g. `{ extends: 'div' }`)
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* ctx.component('my-counter', MyCounterElement);
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
component(tagName: string, constructor: CustomElementConstructor, options?: ElementDefinitionOptions): void;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A bQuery plugin.
|
|
78
|
+
*
|
|
79
|
+
* Plugins are plain objects with a `name` and an `install` function.
|
|
80
|
+
* Call `use(plugin)` to activate a plugin before creating routers, stores,
|
|
81
|
+
* or mounting views.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* import { use } from '@bquery/bquery/plugin';
|
|
86
|
+
*
|
|
87
|
+
* const myPlugin: BQueryPlugin = {
|
|
88
|
+
* name: 'my-plugin',
|
|
89
|
+
* install(ctx, options) {
|
|
90
|
+
* ctx.directive('highlight', (el, expr) => {
|
|
91
|
+
* (el as HTMLElement).style.background = String(expr);
|
|
92
|
+
* });
|
|
93
|
+
* },
|
|
94
|
+
* };
|
|
95
|
+
*
|
|
96
|
+
* use(myPlugin, { color: 'yellow' });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
export interface BQueryPlugin<TOptions = unknown> {
|
|
100
|
+
/** Unique human-readable name for the plugin. */
|
|
101
|
+
readonly name: string;
|
|
102
|
+
/**
|
|
103
|
+
* Called once when the plugin is registered via `use()`.
|
|
104
|
+
*
|
|
105
|
+
* @param context - Helpers for registering directives, components, etc.
|
|
106
|
+
* @param options - User-provided options forwarded from `use(plugin, options)`.
|
|
107
|
+
*/
|
|
108
|
+
install(context: PluginInstallContext, options?: TOptions): void;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plugin/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAMpD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,sBAAsB,GAAG,CACnC,EAAE,EAAE,OAAO,EACX,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,SAAS,EAAE,KAClB,IAAI,CAAC;AAEV;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;CAC1C;AAMD;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;;;;;OAaG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAE/D;;;;;;;;;;;OAWG;IACH,SAAS,CACP,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,wBAAwB,EACrC,OAAO,CAAC,EAAE,wBAAwB,GACjC,IAAI,CAAC;CACT;AAMD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,YAAY,CAAC,QAAQ,GAAG,OAAO;IAC9C,iDAAiD;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;;;OAKG;IACH,OAAO,CAAC,OAAO,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;CAClE"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { n as u } from "./custom-directives-7wAShnnd.js";
|
|
2
|
+
var s = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map();
|
|
3
|
+
u((t) => n.get(t));
|
|
4
|
+
var c = (t) => {
|
|
5
|
+
n.clear();
|
|
6
|
+
for (const [e, r] of t) n.set(e, r);
|
|
7
|
+
}, l = (t) => ({
|
|
8
|
+
directive(e, r) {
|
|
9
|
+
if (typeof e != "string" || e.length === 0) throw new Error("bQuery plugin directive: name must be a non-empty string");
|
|
10
|
+
if (e.startsWith("bq-")) {
|
|
11
|
+
const i = e.slice(3);
|
|
12
|
+
throw new Error(`bQuery plugin directive: name "${e}" must be provided without the "bq-" prefix` + (i ? ` (use "${i}")` : ""));
|
|
13
|
+
}
|
|
14
|
+
if (typeof r != "function") throw new Error(`bQuery plugin directive: handler for "${e}" must be a function`);
|
|
15
|
+
if (n.has(e)) throw new Error(`bQuery plugin directive: a directive named "${e}" is already registered`);
|
|
16
|
+
n.set(e, r);
|
|
17
|
+
},
|
|
18
|
+
component(e, r, i) {
|
|
19
|
+
if (typeof e != "string" || e.length === 0) throw new Error("bQuery plugin component: tagName must be a non-empty string");
|
|
20
|
+
if (!e.includes("-")) throw new Error(`bQuery plugin component: tagName "${e}" must be a valid custom element name containing a hyphen`);
|
|
21
|
+
if (typeof r != "function") throw new Error(`bQuery plugin component: constructor for "${e}" must be a function`);
|
|
22
|
+
if (typeof customElements > "u") {
|
|
23
|
+
typeof console < "u" && typeof console.warn == "function" && console.warn(`[bQuery] plugin component "${e}" was not registered because customElements is not available in this environment.`);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
!customElements.get(e) && !t.some((a) => a.tagName === e) && t.push({
|
|
27
|
+
tagName: e,
|
|
28
|
+
constructor: r,
|
|
29
|
+
options: i
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}), m = (t, e) => {
|
|
33
|
+
if (!t || typeof t != "object") throw new Error("bQuery plugin: use() expects a plugin object with { name, install }");
|
|
34
|
+
if (typeof t.name != "string" || t.name.length === 0) throw new Error('bQuery plugin: plugin must have a non-empty "name" property');
|
|
35
|
+
if (typeof t.install != "function") throw new Error(`bQuery plugin: plugin "${t.name}" must have an "install" function`);
|
|
36
|
+
if (s.has(t.name)) return;
|
|
37
|
+
const r = [], i = l(r), a = new Map(n);
|
|
38
|
+
try {
|
|
39
|
+
t.install(i, e);
|
|
40
|
+
} catch (o) {
|
|
41
|
+
throw c(a), o;
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
for (const o of r) customElements.get(o.tagName) || customElements.define(o.tagName, o.constructor, o.options);
|
|
45
|
+
} catch (o) {
|
|
46
|
+
throw c(a), o;
|
|
47
|
+
}
|
|
48
|
+
s.add(t.name);
|
|
49
|
+
}, p = (t) => s.has(t), h = () => [...s], w = (t) => n.get(t), y = () => [...n.entries()].map(([t, e]) => ({
|
|
50
|
+
name: t,
|
|
51
|
+
handler: e
|
|
52
|
+
})), v = () => {
|
|
53
|
+
s.clear(), n.clear();
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
v as a,
|
|
57
|
+
p as i,
|
|
58
|
+
y as n,
|
|
59
|
+
m as o,
|
|
60
|
+
h as r,
|
|
61
|
+
w as t
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=plugin-cPoOHFLY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-cPoOHFLY.js","names":[],"sources":["../src/plugin/registry.ts"],"sourcesContent":["/**\r\n * Global plugin registry for bQuery.\r\n *\r\n * Provides `use()` to register plugins and query helpers consumed by\r\n * other modules (e.g. the view module reads custom directives from here).\r\n *\r\n * @module bquery/plugin\r\n */\r\n\r\nimport { registerCustomDirectiveResolver } from '../view/custom-directives';\r\nimport type {\r\n BQueryPlugin,\r\n CustomDirective,\r\n CustomDirectiveHandler,\r\n PluginInstallContext,\r\n} from './types';\r\n\r\n// ---------------------------------------------------------------------------\r\n// Internal registries\r\n// ---------------------------------------------------------------------------\r\n\r\n/** Set of installed plugin names — prevents double-install. */\r\nconst installedPlugins = new Set<string>();\r\n\r\n/** Custom directives contributed by plugins. */\r\nconst customDirectives = new Map<string, CustomDirectiveHandler>();\r\n\r\ntype PendingComponentRegistration = {\r\n tagName: string;\r\n constructor: CustomElementConstructor;\r\n options?: ElementDefinitionOptions;\r\n};\r\n\r\nregisterCustomDirectiveResolver((name) => customDirectives.get(name));\r\n\r\n/**\r\n * Restore the directive registry to a previously captured snapshot.\r\n *\r\n * Used to roll back partial plugin installation when `install()` or staged\r\n * `customElements.define()` calls fail after directives were already registered.\r\n *\r\n * @internal\r\n */\r\nconst restoreDirectiveSnapshot = (\r\n directivesSnapshot: ReadonlyMap<string, CustomDirectiveHandler>\r\n): void => {\r\n customDirectives.clear();\r\n for (const [name, handler] of directivesSnapshot) {\r\n customDirectives.set(name, handler);\r\n }\r\n};\r\n\r\n// ---------------------------------------------------------------------------\r\n// Install context factory\r\n// ---------------------------------------------------------------------------\r\n\r\n/**\r\n * Build the `PluginInstallContext` handed to each plugin's `install()`.\r\n * @internal\r\n */\r\nconst createInstallContext = (\r\n pendingComponents: PendingComponentRegistration[]\r\n): PluginInstallContext => ({\r\n directive(name: string, handler: CustomDirectiveHandler): void {\r\n if (typeof name !== 'string' || name.length === 0) {\r\n throw new Error('bQuery plugin directive: name must be a non-empty string');\r\n }\r\n if (name.startsWith('bq-')) {\r\n const suggestedName = name.slice(3);\r\n throw new Error(\r\n `bQuery plugin directive: name \"${name}\" must be provided without the \"bq-\" prefix` +\r\n (suggestedName ? ` (use \"${suggestedName}\")` : '')\r\n );\r\n }\r\n if (typeof handler !== 'function') {\r\n throw new Error(`bQuery plugin directive: handler for \"${name}\" must be a function`);\r\n }\r\n if (customDirectives.has(name)) {\r\n throw new Error(`bQuery plugin directive: a directive named \"${name}\" is already registered`);\r\n }\r\n customDirectives.set(name, handler);\r\n },\r\n\r\n component(\r\n tagName: string,\r\n constructor: CustomElementConstructor,\r\n options?: ElementDefinitionOptions\r\n ): void {\r\n if (typeof tagName !== 'string' || tagName.length === 0) {\r\n throw new Error('bQuery plugin component: tagName must be a non-empty string');\r\n }\r\n if (!tagName.includes('-')) {\r\n throw new Error(\r\n `bQuery plugin component: tagName \"${tagName}\" must be a valid custom element name containing a hyphen`\r\n );\r\n }\r\n if (typeof constructor !== 'function') {\r\n throw new Error(`bQuery plugin component: constructor for \"${tagName}\" must be a function`);\r\n }\r\n if (typeof customElements === 'undefined') {\r\n if (typeof console !== 'undefined' && typeof console.warn === 'function') {\r\n console.warn(\r\n `[bQuery] plugin component \"${tagName}\" was not registered because customElements is not available in this environment.`\r\n );\r\n }\r\n return;\r\n }\r\n // Idempotent — skip if already defined or already staged during this install\r\n if (\r\n !customElements.get(tagName) &&\r\n !pendingComponents.some((entry) => entry.tagName === tagName)\r\n ) {\r\n pendingComponents.push({ tagName, constructor, options });\r\n }\r\n },\r\n});\r\n\r\n// ---------------------------------------------------------------------------\r\n// Public API\r\n// ---------------------------------------------------------------------------\r\n\r\n/**\r\n * Register a bQuery plugin.\r\n *\r\n * Plugins are installed at most once (identified by `plugin.name`).\r\n * Duplicate calls with the same name are silently ignored.\r\n *\r\n * @param plugin - The plugin object implementing `{ name, install }`.\r\n * @param options - Optional configuration forwarded to `plugin.install()`.\r\n * @throws If `plugin` is not a valid plugin object.\r\n *\r\n * @example\r\n * ```ts\r\n * import { use } from '@bquery/bquery/plugin';\r\n *\r\n * use({\r\n * name: 'highlight',\r\n * install(ctx) {\r\n * ctx.directive('highlight', (el, expr) => {\r\n * (el as HTMLElement).style.background = String(expr);\r\n * });\r\n * },\r\n * });\r\n * ```\r\n */\r\nexport const use = <TOptions = unknown>(\r\n plugin: BQueryPlugin<TOptions>,\r\n options?: TOptions\r\n): void => {\r\n if (!plugin || typeof plugin !== 'object') {\r\n throw new Error('bQuery plugin: use() expects a plugin object with { name, install }');\r\n }\r\n if (typeof plugin.name !== 'string' || plugin.name.length === 0) {\r\n throw new Error('bQuery plugin: plugin must have a non-empty \"name\" property');\r\n }\r\n if (typeof plugin.install !== 'function') {\r\n throw new Error(`bQuery plugin: plugin \"${plugin.name}\" must have an \"install\" function`);\r\n }\r\n\r\n // Deduplicate\r\n if (installedPlugins.has(plugin.name)) return;\r\n\r\n const pendingComponents: PendingComponentRegistration[] = [];\r\n const ctx = createInstallContext(pendingComponents);\r\n const directivesSnapshot = new Map(customDirectives);\r\n\r\n try {\r\n plugin.install(ctx, options);\r\n } catch (error) {\r\n restoreDirectiveSnapshot(directivesSnapshot);\r\n throw error;\r\n }\r\n\r\n try {\r\n for (const entry of pendingComponents) {\r\n if (!customElements.get(entry.tagName)) {\r\n customElements.define(entry.tagName, entry.constructor, entry.options);\r\n }\r\n }\r\n } catch (error) {\r\n restoreDirectiveSnapshot(directivesSnapshot);\r\n throw error;\r\n }\r\n\r\n installedPlugins.add(plugin.name);\r\n};\r\n\r\n/**\r\n * Check whether a plugin with the given name has been installed.\r\n *\r\n * @param name - The plugin name to check.\r\n * @returns `true` if the plugin was previously installed via `use()`.\r\n *\r\n * @example\r\n * ```ts\r\n * import { isInstalled } from '@bquery/bquery/plugin';\r\n *\r\n * if (!isInstalled('my-plugin')) {\r\n * use(myPlugin);\r\n * }\r\n * ```\r\n */\r\nexport const isInstalled = (name: string): boolean => installedPlugins.has(name);\r\n\r\n/**\r\n * Return a read-only snapshot of all installed plugin names.\r\n *\r\n * @returns Array of plugin name strings.\r\n *\r\n * @example\r\n * ```ts\r\n * import { getInstalledPlugins } from '@bquery/bquery/plugin';\r\n * console.log(getInstalledPlugins()); // ['my-plugin', 'other-plugin']\r\n * ```\r\n */\r\nexport const getInstalledPlugins = (): readonly string[] => [...installedPlugins];\r\n\r\n/**\r\n * Retrieve the handler for a custom directive registered by a plugin.\r\n *\r\n * This is used internally by the view module's `processElement` to\r\n * resolve directives that aren't built-in.\r\n *\r\n * @param name - Directive name **without** prefix (e.g. `'tooltip'`).\r\n * @returns The handler, or `undefined` if none is registered.\r\n *\r\n * @example\r\n * ```ts\r\n * import { getCustomDirective } from '@bquery/bquery/plugin';\r\n * const handler = getCustomDirective('tooltip');\r\n * ```\r\n */\r\nexport const getCustomDirective = (name: string): CustomDirectiveHandler | undefined =>\r\n customDirectives.get(name);\r\n\r\n/**\r\n * Return a read-only snapshot of all registered custom directives.\r\n *\r\n * @returns Array of `{ name, handler }` descriptors.\r\n *\r\n * @example\r\n * ```ts\r\n * import { getCustomDirectives } from '@bquery/bquery/plugin';\r\n * for (const { name, handler } of getCustomDirectives()) {\r\n * console.log(`Directive: bq-${name}`);\r\n * }\r\n * ```\r\n */\r\nexport const getCustomDirectives = (): readonly CustomDirective[] =>\r\n [...customDirectives.entries()].map(([name, handler]) => ({ name, handler }));\r\n\r\n/**\r\n * Reset all plugin registrations.\r\n *\r\n * Clears all installed plugins and custom directives.\r\n *\r\n * This utility is primarily intended for tests and other isolated environments\r\n * that need to reinitialize plugin state between runs.\r\n *\r\n * @example\r\n * ```ts\r\n * import { resetPlugins } from '@bquery/bquery/plugin';\r\n * afterEach(() => resetPlugins());\r\n * ```\r\n */\r\nexport const resetPlugins = (): void => {\r\n installedPlugins.clear();\r\n customDirectives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
14
14
|
private readonly compute;
|
|
15
15
|
private cachedValue;
|
|
16
|
+
private hasCachedValue;
|
|
16
17
|
private dirty;
|
|
18
|
+
private disposed;
|
|
17
19
|
private subscribers;
|
|
18
20
|
private readonly markDirty;
|
|
19
21
|
/**
|
|
@@ -38,6 +40,11 @@ export declare class Computed<T> implements ReactiveSource {
|
|
|
38
40
|
* @internal
|
|
39
41
|
*/
|
|
40
42
|
unsubscribe(observer: () => void): void;
|
|
43
|
+
/**
|
|
44
|
+
* Disposes the computed value by unsubscribing its internal observer
|
|
45
|
+
* from all upstream dependencies and clearing subscribers.
|
|
46
|
+
*/
|
|
47
|
+
dispose(): void;
|
|
41
48
|
}
|
|
42
49
|
/**
|
|
43
50
|
* Creates a new computed value.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computed.d.ts","sourceRoot":"","sources":["../../src/reactive/computed.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"computed.d.ts","sourceRoot":"","sources":["../../src/reactive/computed.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAOL,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAErB;;;;;;;GAOG;AACH,qBAAa,QAAQ,CAAC,CAAC,CAAE,YAAW,cAAc;IAsBpC,OAAO,CAAC,QAAQ,CAAC,OAAO;IArBpC,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,WAAW,CAAyB;IAC5C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAUxB;IAEF;;;OAGG;gBAC0B,OAAO,EAAE,MAAM,CAAC;IAE7C;;;OAGG;IACH,IAAI,KAAK,IAAI,CAAC,CAsBb;IAED;;;;;OAKG;IACH,IAAI,IAAI,CAAC;IAmBT;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAIvC;;;OAGG;IACH,OAAO,IAAI,IAAI;CAShB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,IAAI,MAAM,CAAC,KAAG,QAAQ,CAAC,CAAC,CAAqB,CAAC"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { a as R } from "./object-BCk-1c8T.js";
|
|
2
|
+
import { i as E, n as v, o as q, r as g, t as k } from "./core-DnlyjbF2.js";
|
|
3
|
+
import { n as U } from "./config-BW35FKuA.js";
|
|
4
|
+
import { n as B, r as b, t as S } from "./untrack-DJVQQ2WM.js";
|
|
5
|
+
var F = (e) => {
|
|
6
|
+
E();
|
|
7
|
+
try {
|
|
8
|
+
e();
|
|
9
|
+
} finally {
|
|
10
|
+
q();
|
|
11
|
+
}
|
|
12
|
+
}, I = (e) => {
|
|
13
|
+
if (e instanceof Error) return e;
|
|
14
|
+
if (typeof e == "string") return new Error(e);
|
|
15
|
+
try {
|
|
16
|
+
return new Error(JSON.stringify(e));
|
|
17
|
+
} catch {
|
|
18
|
+
return new Error(String(e));
|
|
19
|
+
}
|
|
20
|
+
}, O = (e) => typeof e == "function" ? e() : e.value, p = (...e) => {
|
|
21
|
+
const t = new Headers();
|
|
22
|
+
for (const a of e)
|
|
23
|
+
a && new Headers(a).forEach((r, s) => {
|
|
24
|
+
t.set(s, r);
|
|
25
|
+
});
|
|
26
|
+
return t;
|
|
27
|
+
}, x = (e) => typeof e == "string" || e instanceof Blob || e instanceof FormData || e instanceof URLSearchParams || typeof ArrayBuffer < "u" && e instanceof ArrayBuffer || typeof ReadableStream < "u" && e instanceof ReadableStream ? !0 : typeof e == "object" && e !== null && ArrayBuffer.isView(e), _ = (e, t) => e == null || x(e) ? e : (t.has("content-type") || t.set("content-type", "application/json"), JSON.stringify(e)), L = (e) => typeof e == "function" ? e() : e, A = (e, t) => {
|
|
28
|
+
for (const [a, r] of Object.entries(t))
|
|
29
|
+
if (r != null) {
|
|
30
|
+
if (Array.isArray(r)) {
|
|
31
|
+
for (const s of r) s != null && e.searchParams.append(a, String(s));
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
e.searchParams.set(a, String(r));
|
|
35
|
+
}
|
|
36
|
+
}, M = (e, t) => {
|
|
37
|
+
const a = typeof window < "u" && /^https?:/i.test(window.location.href) ? window.location.href : "http://localhost", r = t ? new URL(t, a).toString() : a;
|
|
38
|
+
return e instanceof URL ? new URL(e.toString(), r) : new URL(e, r);
|
|
39
|
+
}, j = async (e, t) => {
|
|
40
|
+
if (t === "response") return e;
|
|
41
|
+
if (t === "text") return await e.text();
|
|
42
|
+
if (t === "blob") return await e.blob();
|
|
43
|
+
if (t === "arrayBuffer") return await e.arrayBuffer();
|
|
44
|
+
if (t === "formData") return await e.formData();
|
|
45
|
+
const a = await e.text();
|
|
46
|
+
if (a)
|
|
47
|
+
try {
|
|
48
|
+
return JSON.parse(a);
|
|
49
|
+
} catch (r) {
|
|
50
|
+
const s = e.url ? ` for ${e.url}` : "";
|
|
51
|
+
throw new Error(`Failed to parse JSON response${s} (status ${e.status}): ${r instanceof Error ? r.message : String(r)}`);
|
|
52
|
+
}
|
|
53
|
+
}, w = (e) => {
|
|
54
|
+
const t = e?.trim();
|
|
55
|
+
return t ? t.toUpperCase() : void 0;
|
|
56
|
+
}, D = (e, t, a) => {
|
|
57
|
+
const r = t instanceof Request ? w(t.method) : void 0;
|
|
58
|
+
return e ?? r ?? (a ? "POST" : void 0);
|
|
59
|
+
}, P = (e, t, a) => e || (t instanceof Request ? void 0 : a), T = (e) => {
|
|
60
|
+
const t = w(e.method);
|
|
61
|
+
let a;
|
|
62
|
+
if (t !== "GET" && t !== "HEAD" && !e.bodyUsed) try {
|
|
63
|
+
a = e.clone().body ?? void 0;
|
|
64
|
+
} catch {
|
|
65
|
+
a = void 0;
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
method: t,
|
|
69
|
+
headers: e.headers,
|
|
70
|
+
body: a,
|
|
71
|
+
cache: e.cache,
|
|
72
|
+
credentials: e.credentials,
|
|
73
|
+
integrity: e.integrity,
|
|
74
|
+
keepalive: e.keepalive,
|
|
75
|
+
mode: e.mode,
|
|
76
|
+
redirect: e.redirect,
|
|
77
|
+
referrer: e.referrer,
|
|
78
|
+
referrerPolicy: e.referrerPolicy,
|
|
79
|
+
signal: e.signal
|
|
80
|
+
};
|
|
81
|
+
}, V = (e, t = {}) => {
|
|
82
|
+
const a = t.immediate ?? !0, r = v(t.defaultValue), s = v(null), n = v("idle"), o = b(() => n.value === "pending");
|
|
83
|
+
let c = 0, f = !1, y = () => {
|
|
84
|
+
};
|
|
85
|
+
const h = () => {
|
|
86
|
+
c += 1, r.value = t.defaultValue, s.value = null, n.value = "idle";
|
|
87
|
+
}, m = () => {
|
|
88
|
+
f || (f = !0, c += 1, y());
|
|
89
|
+
}, d = async () => {
|
|
90
|
+
if (f) return r.peek();
|
|
91
|
+
const i = ++c;
|
|
92
|
+
n.value = "pending", s.value = null;
|
|
93
|
+
try {
|
|
94
|
+
const l = await e(), u = t.transform ? t.transform(l) : l;
|
|
95
|
+
return f || i !== c ? r.peek() : (r.value = u, n.value = "success", t.onSuccess?.(u), u);
|
|
96
|
+
} catch (l) {
|
|
97
|
+
const u = I(l);
|
|
98
|
+
return f || i !== c || (s.value = u, n.value = "error", t.onError?.(u)), r.peek();
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
if (t.watch?.length) {
|
|
102
|
+
let i = !1;
|
|
103
|
+
y = g(() => {
|
|
104
|
+
for (const l of t.watch ?? []) O(l);
|
|
105
|
+
if (!i) {
|
|
106
|
+
i = !0, a && S(() => d());
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
S(() => d());
|
|
110
|
+
});
|
|
111
|
+
} else a && d();
|
|
112
|
+
return {
|
|
113
|
+
data: r,
|
|
114
|
+
error: s,
|
|
115
|
+
status: n,
|
|
116
|
+
pending: o,
|
|
117
|
+
execute: d,
|
|
118
|
+
refresh: d,
|
|
119
|
+
clear: h,
|
|
120
|
+
dispose: m
|
|
121
|
+
};
|
|
122
|
+
}, $ = (e, t = {}) => {
|
|
123
|
+
const a = U().fetch, r = t.parseAs ?? a?.parseAs ?? "json", s = t.fetcher ?? fetch;
|
|
124
|
+
return V(async () => {
|
|
125
|
+
const n = L(e), o = typeof n == "string" || n instanceof URL ? M(n, t.baseUrl ?? a?.baseUrl) : n instanceof Request && t.query ? new URL(n.url) : null;
|
|
126
|
+
o && t.query && A(o, t.query);
|
|
127
|
+
const c = p(a?.headers, n instanceof Request ? n.headers : void 0, t.headers), f = t.body != null, y = w(t.method), h = D(y, n, f), m = h === "GET" || h === "HEAD" ? h : null;
|
|
128
|
+
if (f && m) throw new Error(`Cannot send a request body with ${m} requests`);
|
|
129
|
+
const d = P(y, n, h), i = {
|
|
130
|
+
...t,
|
|
131
|
+
method: d,
|
|
132
|
+
headers: c,
|
|
133
|
+
body: _(t.body, c)
|
|
134
|
+
};
|
|
135
|
+
delete i.baseUrl, delete i.query, delete i.parseAs, delete i.fetcher, delete i.defaultValue, delete i.immediate, delete i.watch, delete i.transform, delete i.onSuccess, delete i.onError;
|
|
136
|
+
let l = o ?? n;
|
|
137
|
+
n instanceof Request && o && o.toString() !== n.url && (l = new Request(o.toString(), T(n)));
|
|
138
|
+
const u = await s(l, i);
|
|
139
|
+
if (!u.ok) throw Object.assign(/* @__PURE__ */ new Error(`Request failed with status ${u.status}`), {
|
|
140
|
+
response: u,
|
|
141
|
+
status: u.status,
|
|
142
|
+
statusText: u.statusText
|
|
143
|
+
});
|
|
144
|
+
return j(u, r);
|
|
145
|
+
}, t);
|
|
146
|
+
};
|
|
147
|
+
function H(e = {}) {
|
|
148
|
+
return (t, a = {}) => {
|
|
149
|
+
const r = e, s = R({}, r.query ?? {}, a.query ?? {});
|
|
150
|
+
return $(t, {
|
|
151
|
+
...r,
|
|
152
|
+
...a,
|
|
153
|
+
headers: p(r.headers, a.headers),
|
|
154
|
+
query: Object.keys(s).length > 0 ? s : void 0
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
var G = (e, t) => {
|
|
159
|
+
const a = b(e);
|
|
160
|
+
return {
|
|
161
|
+
get value() {
|
|
162
|
+
return a.value;
|
|
163
|
+
},
|
|
164
|
+
set value(r) {
|
|
165
|
+
t(r);
|
|
166
|
+
},
|
|
167
|
+
peek() {
|
|
168
|
+
return a.peek();
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
}, Q = (e, t) => {
|
|
172
|
+
let a = !1, r = null;
|
|
173
|
+
try {
|
|
174
|
+
if (r = globalThis.localStorage, r) {
|
|
175
|
+
const o = `__bquery_test_${Math.random().toString(36).slice(2, 9)}__`, c = "__test__";
|
|
176
|
+
try {
|
|
177
|
+
r.setItem(o, c), r.getItem(o), a = !0;
|
|
178
|
+
} finally {
|
|
179
|
+
try {
|
|
180
|
+
r.removeItem(o);
|
|
181
|
+
} catch {
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
} catch {
|
|
186
|
+
a = !1;
|
|
187
|
+
}
|
|
188
|
+
let s = t;
|
|
189
|
+
if (a && r) try {
|
|
190
|
+
const o = r.getItem(e);
|
|
191
|
+
o !== null && (s = JSON.parse(o));
|
|
192
|
+
} catch {
|
|
193
|
+
}
|
|
194
|
+
const n = v(s);
|
|
195
|
+
return a && r && g(() => {
|
|
196
|
+
try {
|
|
197
|
+
r.setItem(e, JSON.stringify(n.value));
|
|
198
|
+
} catch {
|
|
199
|
+
}
|
|
200
|
+
}), n;
|
|
201
|
+
}, W = (e) => ({
|
|
202
|
+
get value() {
|
|
203
|
+
return e.value;
|
|
204
|
+
},
|
|
205
|
+
peek() {
|
|
206
|
+
return e.peek();
|
|
207
|
+
}
|
|
208
|
+
}), K = (e) => e instanceof k, X = (e) => e instanceof B, Y = (e, t, a = {}) => {
|
|
209
|
+
const { immediate: r = !1, equals: s = Object.is } = a;
|
|
210
|
+
let n, o = !0;
|
|
211
|
+
return g(() => {
|
|
212
|
+
const c = e.value;
|
|
213
|
+
if (o) {
|
|
214
|
+
o = !1, n = c, r && t(c, void 0);
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
s(c, n) || (t(c, n), n = c);
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
export {
|
|
221
|
+
Q as a,
|
|
222
|
+
V as c,
|
|
223
|
+
W as i,
|
|
224
|
+
$ as l,
|
|
225
|
+
X as n,
|
|
226
|
+
G as o,
|
|
227
|
+
K as r,
|
|
228
|
+
H as s,
|
|
229
|
+
Y as t,
|
|
230
|
+
F as u
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
//# sourceMappingURL=reactive-Cfv0RK6x.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactive-Cfv0RK6x.js","names":[],"sources":["../src/reactive/batch.ts","../src/reactive/async-data.ts","../src/reactive/linked.ts","../src/reactive/persisted.ts","../src/reactive/readonly.ts","../src/reactive/type-guards.ts","../src/reactive/watch.ts"],"sourcesContent":["/**\n * Batched reactive updates.\n */\n\nimport { beginBatch, endBatch } from './internals';\n\n/**\n * Batches multiple signal updates into a single notification cycle.\n *\n * Updates made inside the batch function are deferred until the batch\n * completes, preventing intermediate re-renders and improving performance.\n *\n * @param fn - Function containing multiple signal updates\n */\nexport const batch = (fn: () => void): void => {\n beginBatch();\n try {\n fn();\n } finally {\n endBatch();\n }\n};\n","/**\n * Async data and fetch composables built on bQuery signals.\n *\n * @module bquery/reactive\n */\n\nimport { merge } from '../core/utils/object';\nimport { getBqueryConfig, type BqueryFetchParseAs } from '../platform/config';\nimport { computed } from './computed';\nimport { effect } from './effect';\nimport { Signal, signal } from './core';\nimport { untrack } from './untrack';\n\n/** Allowed status values for async composables. */\nexport type AsyncDataStatus = 'idle' | 'pending' | 'success' | 'error';\n\n/** Reactive source types that can trigger refreshes. */\nexport type AsyncWatchSource = (() => unknown) | { value: unknown };\n\n/** Options shared by async composables. */\nexport interface UseAsyncDataOptions<TResult, TData = TResult> {\n /** Run the handler immediately (default: true). */\n immediate?: boolean;\n /** Default data value before the first successful execution. */\n defaultValue?: TData;\n /** Optional reactive sources that trigger refreshes when they change. */\n watch?: AsyncWatchSource[];\n /** Transform the resolved value before storing it. */\n transform?: (value: TResult) => TData;\n /** Called after a successful execution. */\n onSuccess?: (value: TData) => void;\n /** Called after a failed execution. */\n onError?: (error: Error) => void;\n}\n\n/** Return value of useAsyncData() and useFetch(). */\nexport interface AsyncDataState<TData> {\n /** Reactive data signal. */\n data: Signal<TData | undefined>;\n /** Last error encountered by the composable. */\n error: Signal<Error | null>;\n /** Current lifecycle status. */\n status: Signal<AsyncDataStatus>;\n /** Computed boolean that mirrors `status === 'pending'`. */\n pending: { readonly value: boolean; peek(): boolean };\n /** Execute the handler manually. Returns the cached data value when called after dispose(). */\n execute: () => Promise<TData | undefined>;\n /** Alias for execute(). */\n refresh: () => Promise<TData | undefined>;\n /** Clear data, error, and status back to the initial state. */\n clear: () => void;\n /** Dispose reactive watchers and prevent future executions. */\n dispose: () => void;\n}\n\n/** Options for useFetch(). */\nexport interface UseFetchOptions<TResponse = unknown, TData = TResponse>\n extends UseAsyncDataOptions<TResponse, TData>, Omit<RequestInit, 'body' | 'headers'> {\n /** Base URL prepended to relative URLs. */\n baseUrl?: string;\n /** Query parameters appended to the request URL. */\n query?: Record<string, unknown>;\n /** Request headers. */\n headers?: HeadersInit;\n /** Request body, including plain objects for JSON requests. */\n body?: BodyInit | Record<string, unknown> | unknown[] | null;\n /** Override the parser used for the response body. */\n parseAs?: BqueryFetchParseAs;\n /** Custom fetch implementation for testing or adapters. */\n fetcher?: typeof fetch;\n}\n\n/** Input accepted by useFetch(). */\nexport type FetchInput = string | URL | Request | (() => string | URL | Request);\n\nconst normalizeError = (error: unknown): Error => {\n if (error instanceof Error) return error;\n if (typeof error === 'string') {\n return new Error(error);\n }\n\n try {\n return new Error(JSON.stringify(error));\n } catch {\n return new Error(String(error));\n }\n};\n\nconst readWatchSource = (source: AsyncWatchSource): unknown => {\n if (typeof source === 'function') {\n return source();\n }\n return source.value;\n};\n\nconst toHeaders = (...sources: Array<HeadersInit | undefined>): Headers => {\n const headers = new Headers();\n for (const source of sources) {\n if (!source) continue;\n new Headers(source).forEach((value, key) => {\n headers.set(key, value);\n });\n }\n return headers;\n};\n\nconst isBodyLike = (value: unknown): value is BodyInit => {\n if (typeof value === 'string') return true;\n if (value instanceof Blob || value instanceof FormData || value instanceof URLSearchParams) {\n return true;\n }\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) return true;\n if (typeof ReadableStream !== 'undefined' && value instanceof ReadableStream) return true;\n return typeof value === 'object' && value !== null && ArrayBuffer.isView(value);\n};\n\nconst serializeBody = (\n body: UseFetchOptions['body'],\n headers: Headers\n): BodyInit | null | undefined => {\n if (body == null) return body;\n if (isBodyLike(body)) return body;\n\n if (!headers.has('content-type')) {\n headers.set('content-type', 'application/json');\n }\n\n return JSON.stringify(body);\n};\n\nconst resolveInput = (input: FetchInput): string | URL | Request => {\n return typeof input === 'function' ? input() : input;\n};\n\nconst appendQuery = (url: URL, query: Record<string, unknown>): void => {\n for (const [key, value] of Object.entries(query)) {\n if (value == null) continue;\n\n if (Array.isArray(value)) {\n for (const item of value) {\n if (item != null) {\n url.searchParams.append(key, String(item));\n }\n }\n continue;\n }\n\n url.searchParams.set(key, String(value));\n }\n};\n\nconst toUrl = (input: string | URL, baseUrl?: string): URL => {\n const runtimeBase =\n typeof window !== 'undefined' && /^https?:/i.test(window.location.href)\n ? window.location.href\n : 'http://localhost';\n const base = baseUrl ? new URL(baseUrl, runtimeBase).toString() : runtimeBase;\n return input instanceof URL ? new URL(input.toString(), base) : new URL(input, base);\n};\n\nconst parseResponse = async <TResponse>(\n response: Response,\n parseAs: BqueryFetchParseAs\n): Promise<TResponse> => {\n if (parseAs === 'response') return response as TResponse;\n if (parseAs === 'text') return (await response.text()) as TResponse;\n if (parseAs === 'blob') return (await response.blob()) as TResponse;\n if (parseAs === 'arrayBuffer') return (await response.arrayBuffer()) as TResponse;\n if (parseAs === 'formData') return (await response.formData()) as TResponse;\n\n const text = await response.text();\n if (!text) {\n return undefined as TResponse;\n }\n\n try {\n return JSON.parse(text) as TResponse;\n } catch (error) {\n const detail = response.url ? ` for ${response.url}` : '';\n throw new Error(\n `Failed to parse JSON response${detail} (status ${response.status}): ${error instanceof Error ? error.message : String(error)}`\n );\n }\n};\n\nconst normalizeMethod = (method?: string): string | undefined => {\n const normalized = method?.trim();\n return normalized ? normalized.toUpperCase() : undefined;\n};\n\nconst resolveMethod = (\n explicitMethod: string | undefined,\n requestInput: string | URL | Request,\n bodyProvided: boolean\n): string | undefined => {\n const requestMethod =\n requestInput instanceof Request ? normalizeMethod(requestInput.method) : undefined;\n return explicitMethod ?? requestMethod ?? (bodyProvided ? 'POST' : undefined);\n};\n\nconst resolveRequestInitMethod = (\n explicitMethod: string | undefined,\n requestInput: string | URL | Request,\n method: string | undefined\n): string | undefined => {\n if (explicitMethod) return explicitMethod;\n return requestInput instanceof Request ? undefined : method;\n};\n\nconst toRequestInit = (request: Request): RequestInit => {\n const requestMethod = normalizeMethod(request.method);\n let body: BodyInit | undefined;\n if (requestMethod !== 'GET' && requestMethod !== 'HEAD' && !request.bodyUsed) {\n try {\n body = request.clone().body ?? undefined;\n } catch {\n body = undefined;\n }\n }\n\n return {\n method: requestMethod,\n headers: request.headers,\n body,\n cache: request.cache,\n credentials: request.credentials,\n integrity: request.integrity,\n keepalive: request.keepalive,\n mode: request.mode,\n redirect: request.redirect,\n referrer: request.referrer,\n referrerPolicy: request.referrerPolicy,\n signal: request.signal,\n };\n};\n\n/**\n * Create a reactive wrapper around an async resolver.\n *\n * @template TResult - Raw result type returned by the handler\n * @template TData - Stored data type after optional transformation\n * @param handler - Async function to execute\n * @param options - Execution, transform, and refresh options\n * @returns Reactive data state with execute(), refresh(), and clear()\n *\n * @example\n * ```ts\n * const user = useAsyncData(() => fetch('/api/user').then((res) => res.json()));\n * ```\n */\nexport const useAsyncData = <TResult, TData = TResult>(\n handler: () => Promise<TResult>,\n options: UseAsyncDataOptions<TResult, TData> = {}\n): AsyncDataState<TData> => {\n const immediate = options.immediate ?? true;\n const data = signal<TData | undefined>(options.defaultValue);\n const error = signal<Error | null>(null);\n const status = signal<AsyncDataStatus>('idle');\n const pending = computed(() => status.value === 'pending');\n let executionId = 0;\n let disposed = false;\n let stopWatching = (): void => {};\n\n const clear = (): void => {\n executionId += 1;\n data.value = options.defaultValue;\n error.value = null;\n status.value = 'idle';\n };\n\n const dispose = (): void => {\n if (disposed) return;\n disposed = true;\n executionId += 1;\n stopWatching();\n };\n\n const execute = async (): Promise<TData | undefined> => {\n if (disposed) {\n return data.peek();\n }\n\n const currentExecution = ++executionId;\n status.value = 'pending';\n error.value = null;\n\n try {\n const resolved = await handler();\n const transformed = options.transform\n ? options.transform(resolved)\n : (resolved as unknown as TData);\n\n if (disposed || currentExecution !== executionId) {\n return data.peek();\n }\n\n data.value = transformed;\n status.value = 'success';\n options.onSuccess?.(transformed);\n return transformed;\n } catch (caught) {\n const normalizedError = normalizeError(caught);\n\n if (disposed || currentExecution !== executionId) {\n return data.peek();\n }\n\n error.value = normalizedError;\n status.value = 'error';\n options.onError?.(normalizedError);\n return data.peek();\n }\n };\n\n if (options.watch?.length) {\n let initialized = false;\n stopWatching = effect(() => {\n for (const source of options.watch ?? []) {\n readWatchSource(source);\n }\n\n if (!initialized) {\n initialized = true;\n if (immediate) {\n void untrack(() => execute());\n }\n return;\n }\n\n void untrack(() => execute());\n });\n } else if (immediate) {\n void execute();\n }\n\n return {\n data,\n error,\n status,\n pending,\n execute,\n refresh: execute,\n clear,\n dispose,\n };\n};\n\n/**\n * Reactive fetch composable using the browser Fetch API.\n *\n * @template TResponse - Raw parsed response type\n * @template TData - Stored response type after optional transformation\n * @param input - Request URL, Request object, or lazy input factory\n * @param options - Request and reactive state options\n * @returns Reactive fetch state with execute(), refresh(), and clear()\n *\n * @example\n * ```ts\n * const users = useFetch<{ id: number; name: string }[]>('/api/users');\n * ```\n */\nexport const useFetch = <TResponse = unknown, TData = TResponse>(\n input: FetchInput,\n options: UseFetchOptions<TResponse, TData> = {}\n): AsyncDataState<TData> => {\n const fetchConfig = getBqueryConfig().fetch;\n const parseAs = options.parseAs ?? fetchConfig?.parseAs ?? 'json';\n const fetcher = options.fetcher ?? fetch;\n\n return useAsyncData<TResponse, TData>(async () => {\n const requestInput = resolveInput(input);\n const requestUrl =\n typeof requestInput === 'string' || requestInput instanceof URL\n ? toUrl(requestInput, options.baseUrl ?? fetchConfig?.baseUrl)\n : requestInput instanceof Request && options.query\n ? new URL(requestInput.url)\n : null;\n\n if (requestUrl && options.query) {\n appendQuery(requestUrl, options.query);\n }\n\n const headers = toHeaders(\n fetchConfig?.headers,\n requestInput instanceof Request ? requestInput.headers : undefined,\n options.headers\n );\n const bodyProvided = options.body != null;\n const explicitMethod = normalizeMethod(options.method);\n const method = resolveMethod(explicitMethod, requestInput, bodyProvided);\n const bodylessMethod = method === 'GET' || method === 'HEAD' ? method : null;\n if (bodyProvided && bodylessMethod) {\n throw new Error(`Cannot send a request body with ${bodylessMethod} requests`);\n }\n const requestInitMethod = resolveRequestInitMethod(explicitMethod, requestInput, method);\n const requestInit: RequestInit = {\n ...options,\n method: requestInitMethod,\n headers,\n body: serializeBody(options.body, headers),\n };\n\n delete (requestInit as Partial<UseFetchOptions>).baseUrl;\n delete (requestInit as Partial<UseFetchOptions>).query;\n delete (requestInit as Partial<UseFetchOptions>).parseAs;\n delete (requestInit as Partial<UseFetchOptions>).fetcher;\n delete (requestInit as Partial<UseFetchOptions>).defaultValue;\n delete (requestInit as Partial<UseFetchOptions>).immediate;\n delete (requestInit as Partial<UseFetchOptions>).watch;\n delete (requestInit as Partial<UseFetchOptions>).transform;\n delete (requestInit as Partial<UseFetchOptions>).onSuccess;\n delete (requestInit as Partial<UseFetchOptions>).onError;\n\n let requestTarget: Request | string | URL = requestUrl ?? requestInput;\n if (\n requestInput instanceof Request &&\n requestUrl &&\n requestUrl.toString() !== requestInput.url\n ) {\n // Rebuild Request inputs when query params changed so the updated URL is preserved.\n // String/URL inputs already use `requestUrl` directly, so only Request objects need rebuilding.\n requestTarget = new Request(requestUrl.toString(), toRequestInit(requestInput));\n }\n const response = await fetcher(requestTarget, requestInit);\n\n if (!response.ok) {\n throw Object.assign(new Error(`Request failed with status ${response.status}`), {\n response,\n status: response.status,\n statusText: response.statusText,\n });\n }\n\n return parseResponse<TResponse>(response, parseAs);\n }, options);\n};\n\n/**\n * Create a preconfigured useFetch() helper.\n *\n * @param defaults - Default request options merged into every useFetch() call\n * @returns A useFetch-compatible function with merged defaults\n *\n * @example\n * ```ts\n * const useApiFetch = createUseFetch({ baseUrl: 'https://api.example.com' });\n * const profile = useApiFetch('/profile');\n * ```\n */\n/** Overload for factories without a configured transform, preserving per-call `TResponse -> TData` inference. */\nexport function createUseFetch<TDefaultResponse = unknown>(\n defaults?: UseFetchOptions<TDefaultResponse, TDefaultResponse>\n): <TResponse = TDefaultResponse, TData = TResponse>(\n input: FetchInput,\n options?: UseFetchOptions<TResponse, TData>\n) => AsyncDataState<TData>;\n\n/** Overload for factories with a configured transform, preserving the transformed factory data type by default. */\nexport function createUseFetch<TDefaultResponse = unknown, TDefaultData = TDefaultResponse>(\n defaults: UseFetchOptions<TDefaultResponse, TDefaultData>\n): <TResponse = TDefaultResponse, TData = TDefaultData>(\n input: FetchInput,\n options?: UseFetchOptions<TResponse, TData>\n) => AsyncDataState<TData>;\n\nexport function createUseFetch<TDefaultResponse = unknown, TDefaultData = TDefaultResponse>(\n defaults: UseFetchOptions<TDefaultResponse, TDefaultData> = {}\n) {\n return <TResponse = TDefaultResponse, TData = TDefaultData>(\n input: FetchInput,\n options: UseFetchOptions<TResponse, TData> = {}\n ): AsyncDataState<TData> => {\n const resolvedDefaults = defaults as unknown as UseFetchOptions<TResponse, TData>;\n const mergedQuery = merge({}, resolvedDefaults.query ?? {}, options.query ?? {}) as Record<\n string,\n unknown\n >;\n\n return useFetch<TResponse, TData>(input, {\n ...resolvedDefaults,\n ...options,\n headers: toHeaders(resolvedDefaults.headers, options.headers),\n query: Object.keys(mergedQuery).length > 0 ? mergedQuery : undefined,\n });\n };\n}\n","/**\n * Linked (writable) computed helpers.\n */\n\nimport { computed, Computed } from './computed';\n\n/**\n * A writable computed-like signal.\n */\nexport interface LinkedSignal<T> {\n /** Gets or sets the current value with dependency tracking. */\n value: T;\n /** Gets the current value without dependency tracking. */\n peek(): T;\n}\n\n/**\n * Creates a writable computed signal by linking a getter and setter.\n *\n * @template T - The derived value type\n * @param getValue - Getter that derives the current value\n * @param setValue - Setter that writes back to underlying signals\n * @returns A writable computed-like signal\n *\n * @example\n * ```ts\n * const first = signal('Ada');\n * const last = signal('Lovelace');\n * const fullName = linkedSignal(\n * () => `${first.value} ${last.value}`,\n * (next) => {\n * const [a, b] = next.split(' ');\n * first.value = a ?? '';\n * last.value = b ?? '';\n * }\n * );\n * ```\n */\nexport const linkedSignal = <T>(\n getValue: () => T,\n setValue: (value: T) => void\n): LinkedSignal<T> => {\n const derived: Computed<T> = computed(getValue);\n\n return {\n get value(): T {\n return derived.value;\n },\n set value(next: T) {\n setValue(next);\n },\n peek(): T {\n return derived.peek();\n },\n };\n};\n","/**\n * LocalStorage-backed signals.\n */\n\nimport { signal, Signal } from './core';\nimport { effect } from './effect';\n\n/**\n * Creates a signal that persists to localStorage.\n *\n * @template T - The type of the signal value\n * @param key - The localStorage key\n * @param initialValue - The initial value if not found in storage\n * @returns A Signal that syncs with localStorage (falls back to in-memory if unavailable)\n */\nexport const persistedSignal = <T>(key: string, initialValue: T): Signal<T> => {\n // Check if localStorage is available and accessible\n let hasLocalStorage = false;\n let storage: Storage | null = null;\n\n try {\n // In Safari private mode, accessing localStorage can throw SecurityError\n storage = globalThis.localStorage;\n if (storage) {\n // Test actual access to ensure it's not just present but usable\n // Use a randomized test key to avoid overwriting real user data\n const testKey = `__bquery_test_${Math.random().toString(36).slice(2, 9)}__`;\n const testValue = '__test__';\n try {\n storage.setItem(testKey, testValue);\n storage.getItem(testKey);\n hasLocalStorage = true;\n } finally {\n // Ensure we don't leave any test data behind\n try {\n storage.removeItem(testKey);\n } catch {\n // Ignore cleanup errors (e.g., storage becoming unavailable)\n }\n }\n }\n } catch {\n // localStorage unavailable or access denied (Safari private mode, sandboxed iframes, etc.)\n hasLocalStorage = false;\n }\n\n let stored: T = initialValue;\n\n if (hasLocalStorage && storage) {\n try {\n const raw = storage.getItem(key);\n if (raw !== null) {\n stored = JSON.parse(raw) as T;\n }\n } catch {\n // Use initial value on parse error or access denial\n }\n }\n\n const sig = signal(stored);\n\n // Only set up persistence effect if localStorage is available\n if (hasLocalStorage && storage) {\n effect(() => {\n try {\n storage!.setItem(key, JSON.stringify(sig.value));\n } catch {\n // Ignore storage errors (quota exceeded, sandboxed iframes, etc.)\n }\n });\n }\n\n return sig;\n};\n","/**\n * Read-only signal wrappers.\n */\n\nimport type { Signal } from './core';\n\n/**\n * A readonly wrapper around a signal that prevents writes.\n * Provides read-only access to a signal's value while maintaining reactivity.\n *\n * @template T - The type of the wrapped value\n */\nexport interface ReadonlySignal<T> {\n /** Gets the current value with dependency tracking. */\n readonly value: T;\n /** Gets the current value without dependency tracking. */\n peek(): T;\n}\n\n/**\n * Creates a read-only view of a signal.\n * Useful for exposing reactive state without allowing modifications.\n *\n * @template T - The type of the signal value\n * @param sig - The signal to wrap\n * @returns A readonly signal wrapper\n */\nexport const readonly = <T>(sig: Signal<T>): ReadonlySignal<T> => ({\n get value(): T {\n return sig.value;\n },\n peek(): T {\n return sig.peek();\n },\n});\n","/**\n * Type guards for reactive primitives.\n */\n\nimport { Computed } from './computed';\nimport { Signal } from './core';\n\n/**\n * Type guard to check if a value is a Signal instance.\n *\n * @param value - The value to check\n * @returns True if the value is a Signal\n */\nexport const isSignal = (value: unknown): value is Signal<unknown> => value instanceof Signal;\n\n/**\n * Type guard to check if a value is a Computed instance.\n *\n * @param value - The value to check\n * @returns True if the value is a Computed\n */\nexport const isComputed = (value: unknown): value is Computed<unknown> => value instanceof Computed;\n","/**\n * Value watching helpers.\n */\n\nimport type { Computed } from './computed';\nimport type { Signal } from './core';\nimport type { CleanupFn } from './internals';\n\nimport { effect } from './effect';\n\n/**\n * Options for the watch function.\n */\nexport interface WatchOptions<T> {\n /** If true, the callback is invoked immediately with the current value. */\n immediate?: boolean;\n /** Custom equality function. Defaults to Object.is. */\n equals?: (a: T, b: T | undefined) => boolean;\n}\n\n/**\n * Watches a signal or computed value and calls a callback with old and new values.\n * Unlike effect, watch provides access to the previous value.\n * The callback is only invoked when the value actually changes (compared via Object.is or custom equals).\n *\n * @template T - The type of the watched value\n * @param source - The signal or computed to watch\n * @param callback - Function called with (newValue, oldValue) on changes\n * @param options - Watch options\n * @returns A cleanup function to stop watching\n *\n * @example\n * ```ts\n * const count = signal(0);\n * watch(count, (newVal, oldVal) => {\n * console.log(`Changed from ${oldVal} to ${newVal}`);\n * });\n *\n * // With custom equality for objects\n * const user = signal({ id: 1, name: 'Alice' });\n * watch(user, (newVal, oldVal) => { ... }, {\n * equals: (a, b) => a?.id === b?.id\n * });\n * ```\n */\nexport const watch = <T>(\n source: Signal<T> | Computed<T>,\n callback: (newValue: T, oldValue: T | undefined) => void,\n options: WatchOptions<T> = {}\n): CleanupFn => {\n const { immediate = false, equals = Object.is } = options;\n let oldValue: T | undefined;\n let isFirst = true;\n\n return effect(() => {\n const newValue = source.value;\n\n if (isFirst) {\n isFirst = false;\n oldValue = newValue;\n if (immediate) {\n callback(newValue, undefined);\n }\n return;\n }\n\n // Only call callback if value actually changed\n if (!equals(newValue, oldValue)) {\n callback(newValue, oldValue);\n oldValue = newValue;\n }\n });\n};\n"],"mappings":";;;;AAcA,IAAa,IAAA,CAAS,MAAyB;AAC7C,EAAA,EAAA;AACA,MAAI;AACF,IAAA,EAAA;AAAA;AAEA,IAAA,EAAA;AAAA;GCwDE,IAAA,CA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