@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
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive media query matching.
|
|
3
|
+
*
|
|
4
|
+
* Returns a reactive boolean signal that tracks whether a CSS media query matches.
|
|
5
|
+
*
|
|
6
|
+
* @module bquery/media
|
|
7
|
+
*/
|
|
8
|
+
import type { MediaSignalHandle } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* Creates a reactive signal that tracks whether a CSS media query matches.
|
|
11
|
+
*
|
|
12
|
+
* Uses `window.matchMedia()` under the hood and automatically updates
|
|
13
|
+
* when the match state changes (e.g., on window resize, device orientation change).
|
|
14
|
+
*
|
|
15
|
+
* @param query - A valid CSS media query string (e.g., `'(min-width: 768px)'`)
|
|
16
|
+
* @returns A readonly reactive signal that is `true` when the query matches,
|
|
17
|
+
* plus a `destroy()` method to remove the media query listener
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { mediaQuery } from '@bquery/bquery/media';
|
|
22
|
+
* import { effect } from '@bquery/bquery/reactive';
|
|
23
|
+
*
|
|
24
|
+
* const isDark = mediaQuery('(prefers-color-scheme: dark)');
|
|
25
|
+
* effect(() => {
|
|
26
|
+
* document.body.classList.toggle('dark', isDark.value);
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* const isWide = mediaQuery('(min-width: 1024px)');
|
|
30
|
+
* effect(() => {
|
|
31
|
+
* console.log('Wide screen:', isWide.value);
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare const mediaQuery: (query: string) => MediaSignalHandle<boolean>;
|
|
36
|
+
//# sourceMappingURL=media-query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-query.d.ts","sourceRoot":"","sources":["../../src/media/media-query.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,iBAAiB,CAAC,OAAO,CAsDnE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive network status.
|
|
3
|
+
*
|
|
4
|
+
* Provides a reactive signal tracking the browser's network connectivity
|
|
5
|
+
* and connection quality via the Network Information API.
|
|
6
|
+
*
|
|
7
|
+
* @module bquery/media
|
|
8
|
+
*/
|
|
9
|
+
import type { NetworkSignal } from './types';
|
|
10
|
+
/**
|
|
11
|
+
* Returns a reactive signal tracking network connectivity and quality.
|
|
12
|
+
*
|
|
13
|
+
* Tracks whether the browser is online/offline and, where supported,
|
|
14
|
+
* the effective connection type, downlink speed, and round-trip time
|
|
15
|
+
* via the Network Information API.
|
|
16
|
+
*
|
|
17
|
+
* @returns A readonly reactive signal with `{ online, effectiveType, downlink, rtt }`
|
|
18
|
+
* and a `destroy()` method to remove attached listeners
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { useNetworkStatus } from '@bquery/bquery/media';
|
|
23
|
+
* import { effect } from '@bquery/bquery/reactive';
|
|
24
|
+
*
|
|
25
|
+
* const net = useNetworkStatus();
|
|
26
|
+
* effect(() => {
|
|
27
|
+
* if (!net.value.online) {
|
|
28
|
+
* console.warn('You are offline!');
|
|
29
|
+
* }
|
|
30
|
+
* console.log(`Connection: ${net.value.effectiveType}, RTT: ${net.value.rtt}ms`);
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare const useNetworkStatus: () => NetworkSignal;
|
|
35
|
+
//# sourceMappingURL=network.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/media/network.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,SAAS,CAAC;AAuC3D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,gBAAgB,QAAO,aAyCnC,CAAC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the bQuery media module.
|
|
3
|
+
*
|
|
4
|
+
* @module bquery/media
|
|
5
|
+
*/
|
|
6
|
+
import type { ReadonlySignal } from '../reactive/index';
|
|
7
|
+
/**
|
|
8
|
+
* Readonly media signal with an explicit cleanup hook.
|
|
9
|
+
*
|
|
10
|
+
* Some media utilities subscribe to browser APIs such as resize events or
|
|
11
|
+
* geolocation watchers. Call `destroy()` when the signal is no longer needed
|
|
12
|
+
* to release those underlying subscriptions.
|
|
13
|
+
*/
|
|
14
|
+
export interface MediaSignalHandle<T> extends ReadonlySignal<T> {
|
|
15
|
+
/** Releases any underlying browser listeners or observers. Safe to call multiple times. */
|
|
16
|
+
destroy(): void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Viewport information returned by {@link useViewport}.
|
|
20
|
+
*/
|
|
21
|
+
export interface ViewportState {
|
|
22
|
+
/** Current viewport width in pixels. */
|
|
23
|
+
width: number;
|
|
24
|
+
/** Current viewport height in pixels. */
|
|
25
|
+
height: number;
|
|
26
|
+
/** Current orientation: `'portrait'` or `'landscape'`. */
|
|
27
|
+
orientation: 'portrait' | 'landscape';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Viewport signal handle returned by {@link useViewport}.
|
|
31
|
+
*/
|
|
32
|
+
export type ViewportSignal = MediaSignalHandle<ViewportState>;
|
|
33
|
+
/**
|
|
34
|
+
* Network connection information returned by {@link useNetworkStatus}.
|
|
35
|
+
*/
|
|
36
|
+
export interface NetworkState {
|
|
37
|
+
/** Whether the browser is online. */
|
|
38
|
+
online: boolean;
|
|
39
|
+
/** Effective connection type (e.g., `'4g'`, `'3g'`, `'2g'`, `'slow-2g'`). */
|
|
40
|
+
effectiveType: string;
|
|
41
|
+
/** Estimated downlink speed in megabits per second. */
|
|
42
|
+
downlink: number;
|
|
43
|
+
/** Estimated round-trip time in milliseconds. */
|
|
44
|
+
rtt: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Network status signal handle returned by {@link useNetworkStatus}.
|
|
48
|
+
*/
|
|
49
|
+
export type NetworkSignal = MediaSignalHandle<NetworkState>;
|
|
50
|
+
/**
|
|
51
|
+
* Battery status information returned by {@link useBattery}.
|
|
52
|
+
*/
|
|
53
|
+
export interface BatteryState {
|
|
54
|
+
/** Whether the battery API is supported. */
|
|
55
|
+
supported: boolean;
|
|
56
|
+
/** Whether the device is charging. */
|
|
57
|
+
charging: boolean;
|
|
58
|
+
/** Time in seconds until the battery is fully charged, or `Infinity`. */
|
|
59
|
+
chargingTime: number;
|
|
60
|
+
/** Time in seconds until the battery is discharged, or `Infinity`. */
|
|
61
|
+
dischargingTime: number;
|
|
62
|
+
/** Battery level as a value between 0 and 1. */
|
|
63
|
+
level: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Battery signal handle returned by {@link useBattery}.
|
|
67
|
+
*/
|
|
68
|
+
export type BatterySignal = MediaSignalHandle<BatteryState>;
|
|
69
|
+
/**
|
|
70
|
+
* Geolocation state returned by {@link useGeolocation}.
|
|
71
|
+
*/
|
|
72
|
+
export interface GeolocationState {
|
|
73
|
+
/** Whether the geolocation API is supported. */
|
|
74
|
+
supported: boolean;
|
|
75
|
+
/** Whether position data is being loaded. */
|
|
76
|
+
loading: boolean;
|
|
77
|
+
/** Current latitude, or `null` if unavailable. */
|
|
78
|
+
latitude: number | null;
|
|
79
|
+
/** Current longitude, or `null` if unavailable. */
|
|
80
|
+
longitude: number | null;
|
|
81
|
+
/** Position accuracy in meters, or `null`. */
|
|
82
|
+
accuracy: number | null;
|
|
83
|
+
/** Altitude in meters, or `null`. */
|
|
84
|
+
altitude: number | null;
|
|
85
|
+
/** Altitude accuracy in meters, or `null`. */
|
|
86
|
+
altitudeAccuracy: number | null;
|
|
87
|
+
/** Heading in degrees, or `null`. */
|
|
88
|
+
heading: number | null;
|
|
89
|
+
/** Speed in meters per second, or `null`. */
|
|
90
|
+
speed: number | null;
|
|
91
|
+
/** Timestamp of the position, or `null`. */
|
|
92
|
+
timestamp: number | null;
|
|
93
|
+
/** Error message, or `null` if no error. */
|
|
94
|
+
error: string | null;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Geolocation signal handle returned by {@link useGeolocation}.
|
|
98
|
+
*/
|
|
99
|
+
export type GeolocationSignal = MediaSignalHandle<GeolocationState>;
|
|
100
|
+
/**
|
|
101
|
+
* Options for {@link useGeolocation}.
|
|
102
|
+
*/
|
|
103
|
+
export interface GeolocationOptions {
|
|
104
|
+
/** Whether to enable high-accuracy mode. */
|
|
105
|
+
enableHighAccuracy?: boolean;
|
|
106
|
+
/** Maximum age of cached position in milliseconds. */
|
|
107
|
+
maximumAge?: number;
|
|
108
|
+
/** Timeout for position requests in milliseconds. */
|
|
109
|
+
timeout?: number;
|
|
110
|
+
/** Whether to watch for continuous position updates. */
|
|
111
|
+
watch?: boolean;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Device motion state returned by {@link useDeviceMotion}.
|
|
115
|
+
*/
|
|
116
|
+
export interface DeviceMotionState {
|
|
117
|
+
/** Acceleration including gravity (x, y, z). */
|
|
118
|
+
acceleration: {
|
|
119
|
+
x: number | null;
|
|
120
|
+
y: number | null;
|
|
121
|
+
z: number | null;
|
|
122
|
+
};
|
|
123
|
+
/** Acceleration including gravity along each axis. */
|
|
124
|
+
accelerationIncludingGravity: {
|
|
125
|
+
x: number | null;
|
|
126
|
+
y: number | null;
|
|
127
|
+
z: number | null;
|
|
128
|
+
};
|
|
129
|
+
/** Rotation rate around each axis in degrees per second. */
|
|
130
|
+
rotationRate: {
|
|
131
|
+
alpha: number | null;
|
|
132
|
+
beta: number | null;
|
|
133
|
+
gamma: number | null;
|
|
134
|
+
};
|
|
135
|
+
/** Interval in milliseconds between data updates. */
|
|
136
|
+
interval: number;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Device motion signal handle returned by {@link useDeviceMotion}.
|
|
140
|
+
*/
|
|
141
|
+
export type DeviceMotionSignal = MediaSignalHandle<DeviceMotionState>;
|
|
142
|
+
/**
|
|
143
|
+
* Device orientation state returned by {@link useDeviceOrientation}.
|
|
144
|
+
*/
|
|
145
|
+
export interface DeviceOrientationState {
|
|
146
|
+
/** Rotation around the z-axis (0–360). */
|
|
147
|
+
alpha: number | null;
|
|
148
|
+
/** Rotation around the x-axis (−180–180). */
|
|
149
|
+
beta: number | null;
|
|
150
|
+
/** Rotation around the y-axis (−90–90). */
|
|
151
|
+
gamma: number | null;
|
|
152
|
+
/** Whether the orientation is absolute. */
|
|
153
|
+
absolute: boolean;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Device orientation signal handle returned by {@link useDeviceOrientation}.
|
|
157
|
+
*/
|
|
158
|
+
export type DeviceOrientationSignal = MediaSignalHandle<DeviceOrientationState>;
|
|
159
|
+
/**
|
|
160
|
+
* Breakpoint definition map.
|
|
161
|
+
* Keys are breakpoint names, values are minimum widths in pixels.
|
|
162
|
+
*/
|
|
163
|
+
export type BreakpointMap = Record<string, number>;
|
|
164
|
+
/**
|
|
165
|
+
* Clipboard API wrapper.
|
|
166
|
+
*/
|
|
167
|
+
export interface ClipboardAPI {
|
|
168
|
+
/** Read text from the clipboard. */
|
|
169
|
+
read: () => Promise<string>;
|
|
170
|
+
/** Write text to the clipboard. */
|
|
171
|
+
write: (text: string) => Promise<void>;
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/media/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive viewport dimensions.
|
|
3
|
+
*
|
|
4
|
+
* Provides a reactive signal tracking the browser viewport's
|
|
5
|
+
* width, height, and orientation.
|
|
6
|
+
*
|
|
7
|
+
* @module bquery/media
|
|
8
|
+
*/
|
|
9
|
+
import type { ViewportSignal } from './types';
|
|
10
|
+
/**
|
|
11
|
+
* Returns a reactive signal tracking the current viewport dimensions and orientation.
|
|
12
|
+
*
|
|
13
|
+
* Updates automatically when the window is resized. Uses `window.innerWidth`
|
|
14
|
+
* and `window.innerHeight` under the hood.
|
|
15
|
+
*
|
|
16
|
+
* @returns A readonly reactive signal with `{ width, height, orientation }`
|
|
17
|
+
* and a `destroy()` method to remove the resize listener
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { useViewport } from '@bquery/bquery/media';
|
|
22
|
+
* import { effect } from '@bquery/bquery/reactive';
|
|
23
|
+
*
|
|
24
|
+
* const viewport = useViewport();
|
|
25
|
+
* effect(() => {
|
|
26
|
+
* console.log(`Viewport: ${viewport.value.width}x${viewport.value.height}`);
|
|
27
|
+
* console.log(`Orientation: ${viewport.value.orientation}`);
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const useViewport: () => ViewportSignal;
|
|
32
|
+
//# sourceMappingURL=viewport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewport.d.ts","sourceRoot":"","sources":["../../src/media/viewport.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,SAAS,CAAC;AAS7D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,WAAW,QAAO,cA2C9B,CAAC"}
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { n as s } from "./core-DnlyjbF2.js";
|
|
2
|
+
import { i as u } from "./reactive-Cfv0RK6x.js";
|
|
3
|
+
var A = (t) => {
|
|
4
|
+
const a = s(!1);
|
|
5
|
+
let i;
|
|
6
|
+
if (typeof window < "u" && typeof window.matchMedia == "function") try {
|
|
7
|
+
const e = window.matchMedia(t);
|
|
8
|
+
a.value = e.matches;
|
|
9
|
+
const d = (l) => {
|
|
10
|
+
a.value = l.matches;
|
|
11
|
+
};
|
|
12
|
+
if (typeof e.addEventListener == "function")
|
|
13
|
+
e.addEventListener("change", d), i = () => {
|
|
14
|
+
e.removeEventListener("change", d);
|
|
15
|
+
};
|
|
16
|
+
else if (typeof e.addListener == "function") {
|
|
17
|
+
const l = e;
|
|
18
|
+
l.addListener(d), i = () => {
|
|
19
|
+
l.removeListener(d);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
} catch {
|
|
23
|
+
}
|
|
24
|
+
const r = u(a);
|
|
25
|
+
let n = !1;
|
|
26
|
+
return Object.defineProperty(r, "destroy", {
|
|
27
|
+
enumerable: !1,
|
|
28
|
+
configurable: !0,
|
|
29
|
+
value() {
|
|
30
|
+
n || (n = !0, i?.(), a.dispose());
|
|
31
|
+
}
|
|
32
|
+
}), r;
|
|
33
|
+
}, P = (t) => {
|
|
34
|
+
const a = {}, i = [];
|
|
35
|
+
for (const e of Object.keys(t)) {
|
|
36
|
+
const d = t[e], l = s(!1);
|
|
37
|
+
let f;
|
|
38
|
+
if (typeof window < "u" && typeof window.matchMedia == "function") try {
|
|
39
|
+
const c = window.matchMedia(`(min-width: ${d}px)`);
|
|
40
|
+
l.value = c.matches;
|
|
41
|
+
const o = (p) => {
|
|
42
|
+
l.value = p.matches;
|
|
43
|
+
};
|
|
44
|
+
if (typeof c.addEventListener == "function")
|
|
45
|
+
c.addEventListener("change", o), f = () => {
|
|
46
|
+
c.removeEventListener("change", o);
|
|
47
|
+
};
|
|
48
|
+
else {
|
|
49
|
+
const p = c;
|
|
50
|
+
typeof p.addListener == "function" && (p.addListener(o), f = () => {
|
|
51
|
+
p.removeListener?.(o);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
} catch {
|
|
55
|
+
}
|
|
56
|
+
const v = u(l);
|
|
57
|
+
let g = !1;
|
|
58
|
+
Object.defineProperty(v, "destroy", {
|
|
59
|
+
enumerable: !1,
|
|
60
|
+
configurable: !0,
|
|
61
|
+
value() {
|
|
62
|
+
g || (g = !0, f?.(), l.dispose());
|
|
63
|
+
}
|
|
64
|
+
}), i.push(v.destroy), a[e] = v;
|
|
65
|
+
}
|
|
66
|
+
let r = !1;
|
|
67
|
+
const n = Object.defineProperty(a, "destroyAll", {
|
|
68
|
+
enumerable: !1,
|
|
69
|
+
configurable: !0,
|
|
70
|
+
value() {
|
|
71
|
+
r || (r = !0, i.forEach((e) => {
|
|
72
|
+
e();
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
return Object.prototype.hasOwnProperty.call(a, "destroy") || Object.defineProperty(n, "destroy", {
|
|
77
|
+
enumerable: !1,
|
|
78
|
+
configurable: !0,
|
|
79
|
+
value: n.destroyAll
|
|
80
|
+
}), n;
|
|
81
|
+
}, y = (t, a) => a >= t ? "portrait" : "landscape", x = () => {
|
|
82
|
+
const t = s({
|
|
83
|
+
width: typeof window < "u" ? window.innerWidth : 0,
|
|
84
|
+
height: typeof window < "u" ? window.innerHeight : 0,
|
|
85
|
+
orientation: typeof window < "u" ? y(window.innerWidth, window.innerHeight) : "portrait"
|
|
86
|
+
});
|
|
87
|
+
let a;
|
|
88
|
+
if (typeof window < "u") {
|
|
89
|
+
const n = () => {
|
|
90
|
+
t.value = {
|
|
91
|
+
width: window.innerWidth,
|
|
92
|
+
height: window.innerHeight,
|
|
93
|
+
orientation: y(window.innerWidth, window.innerHeight)
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
window.addEventListener("resize", n), a = () => {
|
|
97
|
+
window.removeEventListener("resize", n);
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const i = u(t);
|
|
101
|
+
let r = !1;
|
|
102
|
+
return Object.defineProperty(i, "destroy", {
|
|
103
|
+
enumerable: !1,
|
|
104
|
+
configurable: !0,
|
|
105
|
+
value: () => {
|
|
106
|
+
r || (r = !0, a?.(), t.dispose());
|
|
107
|
+
}
|
|
108
|
+
}), i;
|
|
109
|
+
}, h = () => {
|
|
110
|
+
const t = typeof navigator < "u" && navigator.onLine !== void 0 ? navigator.onLine : !0, a = (typeof navigator < "u" ? navigator : void 0)?.connection;
|
|
111
|
+
return {
|
|
112
|
+
online: t,
|
|
113
|
+
effectiveType: a?.effectiveType ?? "unknown",
|
|
114
|
+
downlink: a?.downlink ?? 0,
|
|
115
|
+
rtt: a?.rtt ?? 0
|
|
116
|
+
};
|
|
117
|
+
}, I = () => {
|
|
118
|
+
const t = s(h());
|
|
119
|
+
let a;
|
|
120
|
+
if (typeof window < "u") {
|
|
121
|
+
const n = () => {
|
|
122
|
+
t.value = h();
|
|
123
|
+
};
|
|
124
|
+
window.addEventListener("online", n), window.addEventListener("offline", n);
|
|
125
|
+
const e = typeof navigator < "u" ? navigator : void 0;
|
|
126
|
+
e?.connection && typeof e.connection.addEventListener == "function" && e.connection.addEventListener("change", n), a = () => {
|
|
127
|
+
window.removeEventListener("online", n), window.removeEventListener("offline", n), e?.connection && typeof e.connection.removeEventListener == "function" && e.connection.removeEventListener("change", n);
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
const i = u(t);
|
|
131
|
+
let r = !1;
|
|
132
|
+
return Object.defineProperty(i, "destroy", {
|
|
133
|
+
value() {
|
|
134
|
+
r || (r = !0, a?.(), t.dispose());
|
|
135
|
+
},
|
|
136
|
+
enumerable: !1,
|
|
137
|
+
configurable: !0
|
|
138
|
+
}), i;
|
|
139
|
+
}, E = {
|
|
140
|
+
supported: !1,
|
|
141
|
+
charging: !1,
|
|
142
|
+
chargingTime: 0,
|
|
143
|
+
dischargingTime: 0,
|
|
144
|
+
level: 1
|
|
145
|
+
}, j = () => {
|
|
146
|
+
const t = s({ ...E });
|
|
147
|
+
let a, i = !1;
|
|
148
|
+
typeof navigator < "u" && "getBattery" in navigator && typeof navigator.getBattery == "function" && navigator.getBattery().then((n) => {
|
|
149
|
+
if (i) return;
|
|
150
|
+
const e = () => {
|
|
151
|
+
t.value = {
|
|
152
|
+
supported: !0,
|
|
153
|
+
charging: n.charging,
|
|
154
|
+
chargingTime: n.chargingTime,
|
|
155
|
+
dischargingTime: n.dischargingTime,
|
|
156
|
+
level: n.level
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
e(), n.addEventListener("chargingchange", e), n.addEventListener("chargingtimechange", e), n.addEventListener("dischargingtimechange", e), n.addEventListener("levelchange", e), a = () => {
|
|
160
|
+
n.removeEventListener("chargingchange", e), n.removeEventListener("chargingtimechange", e), n.removeEventListener("dischargingtimechange", e), n.removeEventListener("levelchange", e);
|
|
161
|
+
};
|
|
162
|
+
}).catch(() => {
|
|
163
|
+
});
|
|
164
|
+
const r = u(t);
|
|
165
|
+
return Object.defineProperty(r, "destroy", {
|
|
166
|
+
enumerable: !1,
|
|
167
|
+
configurable: !0,
|
|
168
|
+
value() {
|
|
169
|
+
i || (i = !0, a?.(), t.dispose());
|
|
170
|
+
}
|
|
171
|
+
}), r;
|
|
172
|
+
}, w = {
|
|
173
|
+
supported: !1,
|
|
174
|
+
loading: !1,
|
|
175
|
+
latitude: null,
|
|
176
|
+
longitude: null,
|
|
177
|
+
accuracy: null,
|
|
178
|
+
altitude: null,
|
|
179
|
+
altitudeAccuracy: null,
|
|
180
|
+
heading: null,
|
|
181
|
+
speed: null,
|
|
182
|
+
timestamp: null,
|
|
183
|
+
error: null
|
|
184
|
+
}, R = (t = {}) => {
|
|
185
|
+
const { enableHighAccuracy: a = !1, maximumAge: i = 0, timeout: r = 1 / 0, watch: n = !1 } = t, e = s({ ...w });
|
|
186
|
+
let d;
|
|
187
|
+
if (typeof navigator < "u" && "geolocation" in navigator) {
|
|
188
|
+
e.value = {
|
|
189
|
+
...w,
|
|
190
|
+
supported: !0,
|
|
191
|
+
loading: !0
|
|
192
|
+
};
|
|
193
|
+
const v = {
|
|
194
|
+
enableHighAccuracy: a,
|
|
195
|
+
maximumAge: i,
|
|
196
|
+
timeout: r === 1 / 0 ? void 0 : r
|
|
197
|
+
}, g = (o) => {
|
|
198
|
+
e.value = {
|
|
199
|
+
supported: !0,
|
|
200
|
+
loading: !1,
|
|
201
|
+
latitude: o.coords.latitude,
|
|
202
|
+
longitude: o.coords.longitude,
|
|
203
|
+
accuracy: o.coords.accuracy,
|
|
204
|
+
altitude: o.coords.altitude,
|
|
205
|
+
altitudeAccuracy: o.coords.altitudeAccuracy,
|
|
206
|
+
heading: o.coords.heading,
|
|
207
|
+
speed: o.coords.speed,
|
|
208
|
+
timestamp: o.timestamp,
|
|
209
|
+
error: null
|
|
210
|
+
};
|
|
211
|
+
}, c = (o) => {
|
|
212
|
+
e.value = {
|
|
213
|
+
...e.value,
|
|
214
|
+
loading: !1,
|
|
215
|
+
error: o.message
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
if (n) {
|
|
219
|
+
const o = navigator.geolocation.watchPosition(g, c, v);
|
|
220
|
+
d = () => {
|
|
221
|
+
navigator.geolocation.clearWatch(o);
|
|
222
|
+
};
|
|
223
|
+
} else navigator.geolocation.getCurrentPosition(g, c, v);
|
|
224
|
+
}
|
|
225
|
+
const l = u(e);
|
|
226
|
+
let f = !1;
|
|
227
|
+
return Object.defineProperty(l, "destroy", {
|
|
228
|
+
enumerable: !1,
|
|
229
|
+
configurable: !0,
|
|
230
|
+
value() {
|
|
231
|
+
f || (f = !0, d?.(), e.dispose());
|
|
232
|
+
}
|
|
233
|
+
}), l;
|
|
234
|
+
}, L = {
|
|
235
|
+
acceleration: {
|
|
236
|
+
x: null,
|
|
237
|
+
y: null,
|
|
238
|
+
z: null
|
|
239
|
+
},
|
|
240
|
+
accelerationIncludingGravity: {
|
|
241
|
+
x: null,
|
|
242
|
+
y: null,
|
|
243
|
+
z: null
|
|
244
|
+
},
|
|
245
|
+
rotationRate: {
|
|
246
|
+
alpha: null,
|
|
247
|
+
beta: null,
|
|
248
|
+
gamma: null
|
|
249
|
+
},
|
|
250
|
+
interval: 0
|
|
251
|
+
}, b = {
|
|
252
|
+
alpha: null,
|
|
253
|
+
beta: null,
|
|
254
|
+
gamma: null,
|
|
255
|
+
absolute: !1
|
|
256
|
+
}, _ = () => {
|
|
257
|
+
const t = s({ ...L });
|
|
258
|
+
let a;
|
|
259
|
+
if (typeof window < "u") {
|
|
260
|
+
const n = (e) => {
|
|
261
|
+
t.value = {
|
|
262
|
+
acceleration: {
|
|
263
|
+
x: e.acceleration?.x ?? null,
|
|
264
|
+
y: e.acceleration?.y ?? null,
|
|
265
|
+
z: e.acceleration?.z ?? null
|
|
266
|
+
},
|
|
267
|
+
accelerationIncludingGravity: {
|
|
268
|
+
x: e.accelerationIncludingGravity?.x ?? null,
|
|
269
|
+
y: e.accelerationIncludingGravity?.y ?? null,
|
|
270
|
+
z: e.accelerationIncludingGravity?.z ?? null
|
|
271
|
+
},
|
|
272
|
+
rotationRate: {
|
|
273
|
+
alpha: e.rotationRate?.alpha ?? null,
|
|
274
|
+
beta: e.rotationRate?.beta ?? null,
|
|
275
|
+
gamma: e.rotationRate?.gamma ?? null
|
|
276
|
+
},
|
|
277
|
+
interval: e.interval ?? 0
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
window.addEventListener("devicemotion", n), a = () => {
|
|
281
|
+
window.removeEventListener("devicemotion", n);
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
const i = u(t);
|
|
285
|
+
let r = !1;
|
|
286
|
+
return Object.defineProperty(i, "destroy", {
|
|
287
|
+
enumerable: !1,
|
|
288
|
+
configurable: !0,
|
|
289
|
+
value() {
|
|
290
|
+
r || (r = !0, a?.(), t.dispose());
|
|
291
|
+
}
|
|
292
|
+
}), i;
|
|
293
|
+
}, k = () => {
|
|
294
|
+
const t = s({ ...b });
|
|
295
|
+
let a;
|
|
296
|
+
if (typeof window < "u") {
|
|
297
|
+
const n = (e) => {
|
|
298
|
+
t.value = {
|
|
299
|
+
alpha: e.alpha ?? null,
|
|
300
|
+
beta: e.beta ?? null,
|
|
301
|
+
gamma: e.gamma ?? null,
|
|
302
|
+
absolute: e.absolute ?? !1
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
window.addEventListener("deviceorientation", n), a = () => {
|
|
306
|
+
window.removeEventListener("deviceorientation", n);
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
const i = u(t);
|
|
310
|
+
let r = !1;
|
|
311
|
+
return Object.defineProperty(i, "destroy", {
|
|
312
|
+
enumerable: !1,
|
|
313
|
+
configurable: !0,
|
|
314
|
+
value() {
|
|
315
|
+
r || (r = !0, a?.(), t.dispose());
|
|
316
|
+
}
|
|
317
|
+
}), i;
|
|
318
|
+
}, m = "bQuery media: Clipboard API is unavailable. Use a secure context (HTTPS or localhost) and ensure clipboard permissions or user-activation requirements are met.", z = {
|
|
319
|
+
read: async () => {
|
|
320
|
+
if (typeof navigator > "u" || !navigator.clipboard || typeof navigator.clipboard.readText != "function") throw new Error(m);
|
|
321
|
+
return navigator.clipboard.readText();
|
|
322
|
+
},
|
|
323
|
+
write: async (t) => {
|
|
324
|
+
if (typeof navigator > "u" || !navigator.clipboard || typeof navigator.clipboard.writeText != "function") throw new Error(m);
|
|
325
|
+
return navigator.clipboard.writeText(t);
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
export {
|
|
329
|
+
j as a,
|
|
330
|
+
P as c,
|
|
331
|
+
R as i,
|
|
332
|
+
A as l,
|
|
333
|
+
_ as n,
|
|
334
|
+
I as o,
|
|
335
|
+
k as r,
|
|
336
|
+
x as s,
|
|
337
|
+
z as t
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
//# sourceMappingURL=media-Di2Ta22s.js.map
|