@signality/core 0.0.1-alpha.2
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 +60 -0
- package/browser/battery/index.d.ts +34 -0
- package/browser/bluetooth/index.d.ts +56 -0
- package/browser/breakpoints/index.d.ts +32 -0
- package/browser/broadcast-channel/index.d.ts +42 -0
- package/browser/browser-language/index.d.ts +34 -0
- package/browser/clipboard/index.d.ts +48 -0
- package/browser/device-posture/index.d.ts +18 -0
- package/browser/display-media/index.d.ts +80 -0
- package/browser/eye-dropper/index.d.ts +47 -0
- package/browser/favicon/index.d.ts +39 -0
- package/browser/fps/index.d.ts +46 -0
- package/browser/gamepad/index.d.ts +28 -0
- package/browser/geolocation/index.d.ts +64 -0
- package/browser/index.d.ts +29 -0
- package/browser/input-modality/index.d.ts +26 -0
- package/browser/listener/index.d.ts +61 -0
- package/browser/media-query/index.d.ts +36 -0
- package/browser/network/index.d.ts +44 -0
- package/browser/online/index.d.ts +27 -0
- package/browser/page-visibility/index.d.ts +27 -0
- package/browser/picture-in-picture/index.d.ts +42 -0
- package/browser/pointer-lock-element/index.d.ts +22 -0
- package/browser/screen-orientation/index.d.ts +29 -0
- package/browser/speech-recognition/index.d.ts +77 -0
- package/browser/speech-synthesis/index.d.ts +76 -0
- package/browser/storage/index.d.ts +142 -0
- package/browser/text-direction/index.d.ts +43 -0
- package/browser/vibration/index.d.ts +37 -0
- package/browser/wake-lock/index.d.ts +37 -0
- package/browser/web-notification/index.d.ts +58 -0
- package/browser/web-share/index.d.ts +42 -0
- package/browser/web-worker/index.d.ts +52 -0
- package/elements/active-element/index.d.ts +27 -0
- package/elements/dropzone/index.d.ts +61 -0
- package/elements/element-focus/index.d.ts +38 -0
- package/elements/element-focus-within/index.d.ts +29 -0
- package/elements/element-hover/index.d.ts +27 -0
- package/elements/element-size/index.d.ts +40 -0
- package/elements/element-visibility/index.d.ts +53 -0
- package/elements/index.d.ts +16 -0
- package/elements/mouse-position/index.d.ts +64 -0
- package/elements/on-click-outside/index.d.ts +42 -0
- package/elements/on-disconnect/index.d.ts +45 -0
- package/elements/on-long-press/index.d.ts +44 -0
- package/elements/pointer-swipe/index.d.ts +58 -0
- package/elements/scroll-position/index.d.ts +96 -0
- package/elements/swipe/index.d.ts +49 -0
- package/elements/text-selection/index.d.ts +39 -0
- package/elements/window-size/index.d.ts +46 -0
- package/fesm2022/signality-core-browser-battery.mjs +80 -0
- package/fesm2022/signality-core-browser-battery.mjs.map +1 -0
- package/fesm2022/signality-core-browser-bluetooth.mjs +112 -0
- package/fesm2022/signality-core-browser-bluetooth.mjs.map +1 -0
- package/fesm2022/signality-core-browser-breakpoints.mjs +51 -0
- package/fesm2022/signality-core-browser-breakpoints.mjs.map +1 -0
- package/fesm2022/signality-core-browser-broadcast-channel.mjs +74 -0
- package/fesm2022/signality-core-browser-broadcast-channel.mjs.map +1 -0
- package/fesm2022/signality-core-browser-browser-language.mjs +48 -0
- package/fesm2022/signality-core-browser-browser-language.mjs.map +1 -0
- package/fesm2022/signality-core-browser-clipboard.mjs +102 -0
- package/fesm2022/signality-core-browser-clipboard.mjs.map +1 -0
- package/fesm2022/signality-core-browser-device-posture.mjs +40 -0
- package/fesm2022/signality-core-browser-device-posture.mjs.map +1 -0
- package/fesm2022/signality-core-browser-display-media.mjs +121 -0
- package/fesm2022/signality-core-browser-display-media.mjs.map +1 -0
- package/fesm2022/signality-core-browser-eye-dropper.mjs +82 -0
- package/fesm2022/signality-core-browser-eye-dropper.mjs.map +1 -0
- package/fesm2022/signality-core-browser-favicon.mjs +100 -0
- package/fesm2022/signality-core-browser-favicon.mjs.map +1 -0
- package/fesm2022/signality-core-browser-fps.mjs +103 -0
- package/fesm2022/signality-core-browser-fps.mjs.map +1 -0
- package/fesm2022/signality-core-browser-gamepad.mjs +93 -0
- package/fesm2022/signality-core-browser-gamepad.mjs.map +1 -0
- package/fesm2022/signality-core-browser-geolocation.mjs +120 -0
- package/fesm2022/signality-core-browser-geolocation.mjs.map +1 -0
- package/fesm2022/signality-core-browser-input-modality.mjs +64 -0
- package/fesm2022/signality-core-browser-input-modality.mjs.map +1 -0
- package/fesm2022/signality-core-browser-listener.mjs +132 -0
- package/fesm2022/signality-core-browser-listener.mjs.map +1 -0
- package/fesm2022/signality-core-browser-media-query.mjs +55 -0
- package/fesm2022/signality-core-browser-media-query.mjs.map +1 -0
- package/fesm2022/signality-core-browser-network.mjs +76 -0
- package/fesm2022/signality-core-browser-network.mjs.map +1 -0
- package/fesm2022/signality-core-browser-online.mjs +49 -0
- package/fesm2022/signality-core-browser-online.mjs.map +1 -0
- package/fesm2022/signality-core-browser-page-visibility.mjs +47 -0
- package/fesm2022/signality-core-browser-page-visibility.mjs.map +1 -0
- package/fesm2022/signality-core-browser-picture-in-picture.mjs +93 -0
- package/fesm2022/signality-core-browser-picture-in-picture.mjs.map +1 -0
- package/fesm2022/signality-core-browser-pointer-lock-element.mjs +43 -0
- package/fesm2022/signality-core-browser-pointer-lock-element.mjs.map +1 -0
- package/fesm2022/signality-core-browser-screen-orientation.mjs +43 -0
- package/fesm2022/signality-core-browser-screen-orientation.mjs.map +1 -0
- package/fesm2022/signality-core-browser-speech-recognition.mjs +171 -0
- package/fesm2022/signality-core-browser-speech-recognition.mjs.map +1 -0
- package/fesm2022/signality-core-browser-speech-synthesis.mjs +146 -0
- package/fesm2022/signality-core-browser-speech-synthesis.mjs.map +1 -0
- package/fesm2022/signality-core-browser-storage.mjs +261 -0
- package/fesm2022/signality-core-browser-storage.mjs.map +1 -0
- package/fesm2022/signality-core-browser-text-direction.mjs +62 -0
- package/fesm2022/signality-core-browser-text-direction.mjs.map +1 -0
- package/fesm2022/signality-core-browser-vibration.mjs +94 -0
- package/fesm2022/signality-core-browser-vibration.mjs.map +1 -0
- package/fesm2022/signality-core-browser-wake-lock.mjs +149 -0
- package/fesm2022/signality-core-browser-wake-lock.mjs.map +1 -0
- package/fesm2022/signality-core-browser-web-notification.mjs +137 -0
- package/fesm2022/signality-core-browser-web-notification.mjs.map +1 -0
- package/fesm2022/signality-core-browser-web-share.mjs +92 -0
- package/fesm2022/signality-core-browser-web-share.mjs.map +1 -0
- package/fesm2022/signality-core-browser-web-worker.mjs +105 -0
- package/fesm2022/signality-core-browser-web-worker.mjs.map +1 -0
- package/fesm2022/signality-core-browser.mjs +34 -0
- package/fesm2022/signality-core-browser.mjs.map +1 -0
- package/fesm2022/signality-core-elements-active-element.mjs +88 -0
- package/fesm2022/signality-core-elements-active-element.mjs.map +1 -0
- package/fesm2022/signality-core-elements-dropzone.mjs +158 -0
- package/fesm2022/signality-core-elements-dropzone.mjs.map +1 -0
- package/fesm2022/signality-core-elements-element-focus-within.mjs +56 -0
- package/fesm2022/signality-core-elements-element-focus-within.mjs.map +1 -0
- package/fesm2022/signality-core-elements-element-focus.mjs +54 -0
- package/fesm2022/signality-core-elements-element-focus.mjs.map +1 -0
- package/fesm2022/signality-core-elements-element-hover.mjs +48 -0
- package/fesm2022/signality-core-elements-element-hover.mjs.map +1 -0
- package/fesm2022/signality-core-elements-element-size.mjs +73 -0
- package/fesm2022/signality-core-elements-element-size.mjs.map +1 -0
- package/fesm2022/signality-core-elements-element-visibility.mjs +76 -0
- package/fesm2022/signality-core-elements-element-visibility.mjs.map +1 -0
- package/fesm2022/signality-core-elements-mouse-position.mjs +109 -0
- package/fesm2022/signality-core-elements-mouse-position.mjs.map +1 -0
- package/fesm2022/signality-core-elements-on-click-outside.mjs +97 -0
- package/fesm2022/signality-core-elements-on-click-outside.mjs.map +1 -0
- package/fesm2022/signality-core-elements-on-disconnect.mjs +99 -0
- package/fesm2022/signality-core-elements-on-disconnect.mjs.map +1 -0
- package/fesm2022/signality-core-elements-on-long-press.mjs +84 -0
- package/fesm2022/signality-core-elements-on-long-press.mjs.map +1 -0
- package/fesm2022/signality-core-elements-pointer-swipe.mjs +116 -0
- package/fesm2022/signality-core-elements-pointer-swipe.mjs.map +1 -0
- package/fesm2022/signality-core-elements-scroll-position.mjs +175 -0
- package/fesm2022/signality-core-elements-scroll-position.mjs.map +1 -0
- package/fesm2022/signality-core-elements-swipe.mjs +107 -0
- package/fesm2022/signality-core-elements-swipe.mjs.map +1 -0
- package/fesm2022/signality-core-elements-text-selection.mjs +70 -0
- package/fesm2022/signality-core-elements-text-selection.mjs.map +1 -0
- package/fesm2022/signality-core-elements-window-size.mjs +81 -0
- package/fesm2022/signality-core-elements-window-size.mjs.map +1 -0
- package/fesm2022/signality-core-elements.mjs +21 -0
- package/fesm2022/signality-core-elements.mjs.map +1 -0
- package/fesm2022/signality-core-forms-cva.mjs +140 -0
- package/fesm2022/signality-core-forms-cva.mjs.map +1 -0
- package/fesm2022/signality-core-forms.mjs +6 -0
- package/fesm2022/signality-core-forms.mjs.map +1 -0
- package/fesm2022/signality-core-internal.mjs +268 -0
- package/fesm2022/signality-core-internal.mjs.map +1 -0
- package/fesm2022/signality-core-observers-intersection-observer.mjs +70 -0
- package/fesm2022/signality-core-observers-intersection-observer.mjs.map +1 -0
- package/fesm2022/signality-core-observers-mutation-observer.mjs +77 -0
- package/fesm2022/signality-core-observers-mutation-observer.mjs.map +1 -0
- package/fesm2022/signality-core-observers-performance-observer.mjs +84 -0
- package/fesm2022/signality-core-observers-performance-observer.mjs.map +1 -0
- package/fesm2022/signality-core-observers-resize-observer.mjs +69 -0
- package/fesm2022/signality-core-observers-resize-observer.mjs.map +1 -0
- package/fesm2022/signality-core-observers.mjs +9 -0
- package/fesm2022/signality-core-observers.mjs.map +1 -0
- package/fesm2022/signality-core-reactivity-debounced.mjs +27 -0
- package/fesm2022/signality-core-reactivity-debounced.mjs.map +1 -0
- package/fesm2022/signality-core-reactivity-throttled.mjs +27 -0
- package/fesm2022/signality-core-reactivity-throttled.mjs.map +1 -0
- package/fesm2022/signality-core-reactivity-watcher.mjs +36 -0
- package/fesm2022/signality-core-reactivity-watcher.mjs.map +1 -0
- package/fesm2022/signality-core-reactivity.mjs +8 -0
- package/fesm2022/signality-core-reactivity.mjs.map +1 -0
- package/fesm2022/signality-core-router-fragment.mjs +41 -0
- package/fesm2022/signality-core-router-fragment.mjs.map +1 -0
- package/fesm2022/signality-core-router-params.mjs +45 -0
- package/fesm2022/signality-core-router-params.mjs.map +1 -0
- package/fesm2022/signality-core-router-query-params.mjs +67 -0
- package/fesm2022/signality-core-router-query-params.mjs.map +1 -0
- package/fesm2022/signality-core-router-route-data.mjs +46 -0
- package/fesm2022/signality-core-router-route-data.mjs.map +1 -0
- package/fesm2022/signality-core-router-router-listener.mjs +50 -0
- package/fesm2022/signality-core-router-router-listener.mjs.map +1 -0
- package/fesm2022/signality-core-router-title.mjs +54 -0
- package/fesm2022/signality-core-router-title.mjs.map +1 -0
- package/fesm2022/signality-core-router-url.mjs +53 -0
- package/fesm2022/signality-core-router-url.mjs.map +1 -0
- package/fesm2022/signality-core-router.mjs +12 -0
- package/fesm2022/signality-core-router.mjs.map +1 -0
- package/fesm2022/signality-core-scheduling-debounce-callback.mjs +59 -0
- package/fesm2022/signality-core-scheduling-debounce-callback.mjs.map +1 -0
- package/fesm2022/signality-core-scheduling-interval.mjs +110 -0
- package/fesm2022/signality-core-scheduling-interval.mjs.map +1 -0
- package/fesm2022/signality-core-scheduling-throttle-callback.mjs +66 -0
- package/fesm2022/signality-core-scheduling-throttle-callback.mjs.map +1 -0
- package/fesm2022/signality-core-scheduling.mjs +8 -0
- package/fesm2022/signality-core-scheduling.mjs.map +1 -0
- package/fesm2022/signality-core-types.mjs +4 -0
- package/fesm2022/signality-core-types.mjs.map +1 -0
- package/fesm2022/signality-core.mjs +13 -0
- package/fesm2022/signality-core.mjs.map +1 -0
- package/forms/cva/index.d.ts +60 -0
- package/forms/index.d.ts +1 -0
- package/index.d.ts +8 -0
- package/internal/constants/index.d.ts +2 -0
- package/internal/constants/mobile-regex.d.ts +1 -0
- package/internal/constants/stubs.d.ts +32 -0
- package/internal/index.d.ts +4 -0
- package/internal/providers/index.d.ts +3 -0
- package/internal/providers/is-browser.d.ts +2 -0
- package/internal/providers/is-mobile.d.ts +2 -0
- package/internal/providers/is-server.d.ts +2 -0
- package/internal/types/index.d.ts +2 -0
- package/internal/types/timer.d.ts +1 -0
- package/internal/types/union.d.ts +1 -0
- package/internal/utils/bom/index.d.ts +1 -0
- package/internal/utils/bom/is-window.d.ts +1 -0
- package/internal/utils/const-signal.d.ts +10 -0
- package/internal/utils/context.d.ts +18 -0
- package/internal/utils/create-token.d.ts +8 -0
- package/internal/utils/dom/get-active-element.d.ts +1 -0
- package/internal/utils/dom/get-event-target.d.ts +1 -0
- package/internal/utils/dom/get-pip-element.d.ts +1 -0
- package/internal/utils/dom/get-shadow-root.d.ts +1 -0
- package/internal/utils/dom/index.d.ts +6 -0
- package/internal/utils/dom/is-element.d.ts +1 -0
- package/internal/utils/dom/is-node-within.d.ts +1 -0
- package/internal/utils/index.d.ts +10 -0
- package/internal/utils/is-plain-object.d.ts +1 -0
- package/internal/utils/is-query-signal.d.ts +10 -0
- package/internal/utils/proxy-signal.d.ts +18 -0
- package/internal/utils/to-element.d.ts +12 -0
- package/internal/utils/to-value.d.ts +6 -0
- package/observers/index.d.ts +4 -0
- package/observers/intersection-observer/index.d.ts +42 -0
- package/observers/mutation-observer/index.d.ts +45 -0
- package/observers/performance-observer/index.d.ts +58 -0
- package/observers/resize-observer/index.d.ts +40 -0
- package/package.json +343 -0
- package/reactivity/debounced/index.d.ts +50 -0
- package/reactivity/index.d.ts +3 -0
- package/reactivity/throttled/index.d.ts +53 -0
- package/reactivity/watcher/index.d.ts +68 -0
- package/router/fragment/index.d.ts +26 -0
- package/router/index.d.ts +7 -0
- package/router/params/index.d.ts +28 -0
- package/router/query-params/index.d.ts +80 -0
- package/router/route-data/index.d.ts +28 -0
- package/router/router-listener/index.d.ts +83 -0
- package/router/title/index.d.ts +29 -0
- package/router/url/index.d.ts +32 -0
- package/scheduling/debounce-callback/index.d.ts +28 -0
- package/scheduling/index.d.ts +3 -0
- package/scheduling/interval/index.d.ts +51 -0
- package/scheduling/throttle-callback/index.d.ts +30 -0
- package/types/index.d.ts +6 -0
- package/types/maybe-element-signal.d.ts +2 -0
- package/types/maybe-signal.d.ts +2 -0
- package/types/signal-value.d.ts +2 -0
- package/types/signal-values.d.ts +5 -0
- package/types/unref-element.d.ts +2 -0
- package/types/with-injector.d.ts +8 -0
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @signality/core
|
|
2
|
+
|
|
3
|
+
Signal-first utility collection for Angular. Comprehensive library of reactive utilities for browser APIs, DOM elements, and common patterns.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @signality/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
### Browser Utilities
|
|
14
|
+
- **`battery()`** — Reactive battery status and charging state
|
|
15
|
+
- **`clipboard()`** — Reactive clipboard read/write operations
|
|
16
|
+
- **`geolocation()`** — Reactive geolocation tracking
|
|
17
|
+
- **`pageVisibility()`** — Reactive page visibility state
|
|
18
|
+
- **`storage()`** — Reactive localStorage/sessionStorage with sync
|
|
19
|
+
- **`network()`** — Reactive network connection status
|
|
20
|
+
- **`fullscreen()`** — Reactive fullscreen API
|
|
21
|
+
- And [many more...](https://signality.dev/browser/battery)
|
|
22
|
+
|
|
23
|
+
### Element Utilities
|
|
24
|
+
- **`elementSize()`** — Reactive element dimensions
|
|
25
|
+
- **`elementVisibility()`** — Reactive Intersection Observer
|
|
26
|
+
- **`dropzone()`** — Reactive drag & drop zone
|
|
27
|
+
- **`windowSize()`** — Reactive window dimensions
|
|
28
|
+
- **`scrollPosition()`** — Reactive scroll position
|
|
29
|
+
- And [many more...](https://signality.dev/elements/active-element)
|
|
30
|
+
|
|
31
|
+
### Utils
|
|
32
|
+
- **`debounced()`** — Debounced writable signal
|
|
33
|
+
- **`throttled()`** — Throttled writable signal
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { battery, clipboard, elementSize, debounced } from '@signality/core';
|
|
39
|
+
|
|
40
|
+
// Battery status
|
|
41
|
+
const batteryStatus = battery();
|
|
42
|
+
// batteryStatus.level(), batteryStatus.charging()
|
|
43
|
+
|
|
44
|
+
// Clipboard operations
|
|
45
|
+
const clipboard = clipboard();
|
|
46
|
+
await clipboard.copy('Hello');
|
|
47
|
+
const text = await clipboard.paste();
|
|
48
|
+
|
|
49
|
+
// Element size tracking
|
|
50
|
+
const element = viewChild<ElementRef<HTMLDivElement>>('myElement');
|
|
51
|
+
const size = elementSize(element);
|
|
52
|
+
// size.width(), size.height()
|
|
53
|
+
|
|
54
|
+
// Debounced signal
|
|
55
|
+
const searchQuery = debounced('', 300);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Documentation
|
|
59
|
+
|
|
60
|
+
Full documentation available at [signality.dev](https://signality.dev)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import type { WithInjector } from '@signality/core/types';
|
|
3
|
+
export type BatteryOptions = WithInjector;
|
|
4
|
+
export interface BatteryRef {
|
|
5
|
+
readonly charging: Signal<boolean>;
|
|
6
|
+
readonly chargingTime: Signal<number>;
|
|
7
|
+
readonly dischargingTime: Signal<number>;
|
|
8
|
+
readonly level: Signal<number>;
|
|
9
|
+
readonly isSupported: Signal<boolean>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Signal-based wrapper around the [Battery Status API](https://developer.mozilla.org/en-US/docs/Web/API/Battery_Status_API).
|
|
13
|
+
*
|
|
14
|
+
* @param options - Optional configuration with injector
|
|
15
|
+
* @returns A BatteryRef with battery status signals
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* @Component({
|
|
20
|
+
* template: `
|
|
21
|
+
* @if (batteryStatus.isSupported()) {
|
|
22
|
+
* <div>
|
|
23
|
+
* <p>Charging: {{ batteryStatus.charging() }}</p>
|
|
24
|
+
* <p>Level: {{ batteryStatus.level() * 100 }}%</p>
|
|
25
|
+
* </div>
|
|
26
|
+
* }
|
|
27
|
+
* `
|
|
28
|
+
* })
|
|
29
|
+
* class BatteryComponent {
|
|
30
|
+
* readonly batteryStatus = battery();
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function battery(options?: BatteryOptions): BatteryRef;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import type { WithInjector } from '@signality/core/types';
|
|
3
|
+
export interface BluetoothOptions extends WithInjector {
|
|
4
|
+
/**
|
|
5
|
+
* Accept any Bluetooth device.
|
|
6
|
+
*/
|
|
7
|
+
readonly acceptAllDevices?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Filters for device selection.
|
|
10
|
+
*/
|
|
11
|
+
readonly filters?: BluetoothLEScanFilter[];
|
|
12
|
+
/**
|
|
13
|
+
* Optional services to access.
|
|
14
|
+
*/
|
|
15
|
+
readonly optionalServices?: BluetoothServiceUUID[];
|
|
16
|
+
}
|
|
17
|
+
export interface BluetoothRef {
|
|
18
|
+
/** Whether Web Bluetooth API is supported */
|
|
19
|
+
readonly isSupported: Signal<boolean>;
|
|
20
|
+
/** Whether a device is currently connected */
|
|
21
|
+
readonly isConnected: Signal<boolean>;
|
|
22
|
+
/** Whether connection is in progress */
|
|
23
|
+
readonly isConnecting: Signal<boolean>;
|
|
24
|
+
/** Connected Bluetooth device */
|
|
25
|
+
readonly device: Signal<BluetoothDevice | null>;
|
|
26
|
+
/** GATT server of connected device */
|
|
27
|
+
readonly server: Signal<BluetoothRemoteGATTServer | null>;
|
|
28
|
+
/** Last error that occurred */
|
|
29
|
+
readonly error: Signal<Error | null>;
|
|
30
|
+
/** Request device connection */
|
|
31
|
+
readonly request: (options?: RequestDeviceOptions) => Promise<void>;
|
|
32
|
+
/** Disconnect from device */
|
|
33
|
+
readonly disconnect: () => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Signal-based wrapper around the [Web Bluetooth API](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth).
|
|
37
|
+
*
|
|
38
|
+
* @param options - Optional configuration
|
|
39
|
+
* @returns A BluetoothRef with connection state and control methods
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* @Component({
|
|
44
|
+
* template: `
|
|
45
|
+
* <button (click)="bt.request()">Connect</button>
|
|
46
|
+
* @if (bt.isConnected()) {
|
|
47
|
+
* <p>{{ bt.device()?.name }}</p>
|
|
48
|
+
* }
|
|
49
|
+
* `
|
|
50
|
+
* })
|
|
51
|
+
* class BluetoothComponent {
|
|
52
|
+
* readonly bt = bluetooth();
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function bluetooth(options?: BluetoothOptions): BluetoothRef;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import type { WithInjector } from '@signality/core/types';
|
|
3
|
+
export interface BreakpointsOptions<T extends Record<string, string>> extends WithInjector {
|
|
4
|
+
/**
|
|
5
|
+
* Initial values for SSR.
|
|
6
|
+
*/
|
|
7
|
+
readonly initialValue?: Partial<Record<keyof T, boolean>>;
|
|
8
|
+
}
|
|
9
|
+
export type BreakpointsRef<T extends Record<string, string>> = {
|
|
10
|
+
readonly [K in keyof T]: Signal<boolean>;
|
|
11
|
+
} & {
|
|
12
|
+
readonly current: Signal<(keyof T)[]>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Reactive breakpoint matching using matchMedia.
|
|
16
|
+
* Track responsive breakpoints with Angular signals.
|
|
17
|
+
*
|
|
18
|
+
* @param map - Object mapping breakpoint names to media queries
|
|
19
|
+
* @param options - Optional configuration
|
|
20
|
+
* @returns An object with signals for each breakpoint
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const bp = breakpoints({
|
|
25
|
+
* mobile: '(max-width: 767px)',
|
|
26
|
+
* desktop: '(min-width: 768px)',
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* // In template: @if (bp.mobile()) { ... }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function breakpoints<T extends Record<string, string>>(map: T, options?: BreakpointsOptions<T>): BreakpointsRef<T>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import type { WithInjector } from '@signality/core/types';
|
|
3
|
+
export type BroadcastChannelOptions = WithInjector;
|
|
4
|
+
export interface BroadcastChannelRef<T> {
|
|
5
|
+
/** Last received data */
|
|
6
|
+
readonly data: Signal<T | null>;
|
|
7
|
+
/** The last error that occurred */
|
|
8
|
+
readonly error: Signal<MessageEvent | null>;
|
|
9
|
+
/** Whether the channel is closed */
|
|
10
|
+
readonly isClosed: Signal<boolean>;
|
|
11
|
+
/** Send a message to all tabs */
|
|
12
|
+
readonly post: (data: T) => void;
|
|
13
|
+
/** Close the channel */
|
|
14
|
+
readonly close: () => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Signal-based wrapper around the [Broadcast Channel API](https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API).
|
|
18
|
+
*
|
|
19
|
+
* @param name - Channel name (must match across tabs)
|
|
20
|
+
* @param options - Optional configuration
|
|
21
|
+
* @returns A BroadcastChannelRef with data signal and control methods
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* @Component({
|
|
26
|
+
* template: `
|
|
27
|
+
* @if (channel.data(); as data) {
|
|
28
|
+
* <p>Received: {{ data }}</p>
|
|
29
|
+
* }
|
|
30
|
+
* <button (click)="sendMessage()">Send Message</button>
|
|
31
|
+
* `
|
|
32
|
+
* })
|
|
33
|
+
* class ChatComponent {
|
|
34
|
+
* readonly channel = broadcastChannel<string>('my-channel');
|
|
35
|
+
*
|
|
36
|
+
* sendMessage() {
|
|
37
|
+
* this.channel.post('Hello from this tab!');
|
|
38
|
+
* }
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function broadcastChannel<T>(name: string, options?: BroadcastChannelOptions): BroadcastChannelRef<T>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type CreateSignalOptions, type Signal } from '@angular/core';
|
|
2
|
+
import type { WithInjector } from '@signality/core/types';
|
|
3
|
+
export interface BrowserLanguageOptions extends CreateSignalOptions<string>, WithInjector {
|
|
4
|
+
/**
|
|
5
|
+
* Initial value for SSR.
|
|
6
|
+
* @default ''
|
|
7
|
+
*/
|
|
8
|
+
readonly initialValue?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Reactive wrapper around the [Navigator.language](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/language) property.
|
|
12
|
+
*
|
|
13
|
+
* @param options - Optional configuration including signal options and injector
|
|
14
|
+
* @returns A signal containing the current browser language in BCP 47 format (e.g., 'en-US', 'fr-FR')
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* @Component({
|
|
19
|
+
* template: `
|
|
20
|
+
* <p>Current language: {{ language() }}</p>
|
|
21
|
+
* @if (language() === 'en-US') {
|
|
22
|
+
* <p>Welcome!</p>
|
|
23
|
+
* } @else if (language() === 'fr-FR') {
|
|
24
|
+
* <p>Bienvenue!</p>
|
|
25
|
+
* }
|
|
26
|
+
* `
|
|
27
|
+
* })
|
|
28
|
+
* class LanguageComponent {
|
|
29
|
+
* readonly language = browserLanguage();
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function browserLanguage(options?: BrowserLanguageOptions): Signal<string>;
|
|
34
|
+
export declare const BROWSER_LANGUAGE: import("@angular/core").ProviderToken<Signal<string>>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import type { MaybeSignal, WithInjector } from '@signality/core/types';
|
|
3
|
+
export interface ClipboardOptions extends WithInjector {
|
|
4
|
+
/**
|
|
5
|
+
* How long `copied` stays `true` after copy (ms).
|
|
6
|
+
* @default 1500
|
|
7
|
+
*/
|
|
8
|
+
readonly copiedDuration?: MaybeSignal<number>;
|
|
9
|
+
}
|
|
10
|
+
export interface ClipboardRef {
|
|
11
|
+
/** Whether Clipboard API is supported */
|
|
12
|
+
readonly isSupported: Signal<boolean>;
|
|
13
|
+
/** Current clipboard text content */
|
|
14
|
+
readonly text: Signal<string>;
|
|
15
|
+
/** Whether content was recently copied (resets after timeout) */
|
|
16
|
+
readonly copied: Signal<boolean>;
|
|
17
|
+
/** Copy text to clipboard */
|
|
18
|
+
readonly copy: (text: string) => Promise<void>;
|
|
19
|
+
/** Read text from clipboard */
|
|
20
|
+
readonly paste: () => Promise<string>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Signal-based wrapper around the [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API).
|
|
24
|
+
*
|
|
25
|
+
* @param options - Optional configuration
|
|
26
|
+
* @returns A ClipboardRef with text, copied, isSupported signals and copy/paste methods
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* @Component({
|
|
31
|
+
* template: `
|
|
32
|
+
* <input #input value="Hello World!" />
|
|
33
|
+
* <button (click)="copyText(input.value)">Copy</button>
|
|
34
|
+
* @if (cb.copied()) {
|
|
35
|
+
* <span>Copied!</span>
|
|
36
|
+
* }
|
|
37
|
+
* `
|
|
38
|
+
* })
|
|
39
|
+
* class ClipboardComponent {
|
|
40
|
+
* readonly cb = clipboard();
|
|
41
|
+
*
|
|
42
|
+
* async copyText(text: string) {
|
|
43
|
+
* await this.cb.copy(text);
|
|
44
|
+
* }
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function clipboard(options?: ClipboardOptions): ClipboardRef;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import type { WithInjector } from '@signality/core/types';
|
|
3
|
+
export type DevicePostureType = 'continuous' | 'folded';
|
|
4
|
+
export interface DevicePostureRef {
|
|
5
|
+
/** Whether Device Posture API is supported */
|
|
6
|
+
readonly isSupported: Signal<boolean>;
|
|
7
|
+
/** Current device posture */
|
|
8
|
+
readonly type: Signal<DevicePostureType>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Signal-based wrapper around the [Device Posture API](https://developer.mozilla.org/en-US/docs/Web/API/Device_Posture_API).
|
|
12
|
+
* Track device posture state for foldable devices.
|
|
13
|
+
*
|
|
14
|
+
* @param options - Optional configuration including injector
|
|
15
|
+
* @returns A DevicePostureRef with type signal
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
export declare function devicePosture(options?: WithInjector): DevicePostureRef;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import type { WithInjector } from '@signality/core/types';
|
|
3
|
+
export interface DisplayMediaOptions extends WithInjector {
|
|
4
|
+
/**
|
|
5
|
+
* Video constraints.
|
|
6
|
+
* @default true
|
|
7
|
+
*/
|
|
8
|
+
readonly video?: boolean | MediaTrackConstraints;
|
|
9
|
+
/**
|
|
10
|
+
* Audio constraints.
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
readonly audio?: boolean | MediaTrackConstraints;
|
|
14
|
+
}
|
|
15
|
+
export interface DisplayMediaRef {
|
|
16
|
+
/** Whether Screen Capture API is supported */
|
|
17
|
+
readonly isSupported: Signal<boolean>;
|
|
18
|
+
/** Whether currently capturing */
|
|
19
|
+
readonly isActive: Signal<boolean>;
|
|
20
|
+
/** Current media stream */
|
|
21
|
+
readonly stream: Signal<MediaStream | null>;
|
|
22
|
+
/** Last error */
|
|
23
|
+
readonly error: Signal<Error | null>;
|
|
24
|
+
/** Start screen capture */
|
|
25
|
+
readonly start: (options?: DisplayMediaOptions) => Promise<MediaStream | null>;
|
|
26
|
+
/** Stop screen capture */
|
|
27
|
+
readonly stop: () => void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Signal-based wrapper around the [Screen Capture API](https://developer.mozilla.org/en-US/docs/Web/API/Screen_Capture_API).
|
|
31
|
+
* Capture screen content with Angular signals.
|
|
32
|
+
*
|
|
33
|
+
* @param options - Optional default configuration
|
|
34
|
+
* @returns A DisplayMediaRef with isSupported, stream, error signals and control methods
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* @Component({
|
|
39
|
+
* template: `
|
|
40
|
+
* @if (screen.isSupported()) {
|
|
41
|
+
* <button (click)="toggleCapture()">
|
|
42
|
+
* {{ screen.isActive() ? 'Stop' : 'Start' }} Screen Capture
|
|
43
|
+
* </button>
|
|
44
|
+
* @if (screen.stream(); as stream) {
|
|
45
|
+
* <video [srcObject]="stream" autoplay></video>
|
|
46
|
+
* }
|
|
47
|
+
* @if (screen.error(); as error) {
|
|
48
|
+
* <p class="error">{{ error.message }}</p>
|
|
49
|
+
* }
|
|
50
|
+
* } @else {
|
|
51
|
+
* <p>Screen Capture API not supported</p>
|
|
52
|
+
* }
|
|
53
|
+
* `
|
|
54
|
+
* })
|
|
55
|
+
* class ScreenCaptureComponent {
|
|
56
|
+
* readonly screen = displayMedia();
|
|
57
|
+
*
|
|
58
|
+
* async toggleCapture() {
|
|
59
|
+
* if (this.screen.isActive()) {
|
|
60
|
+
* this.screen.stop();
|
|
61
|
+
* } else {
|
|
62
|
+
* await this.screen.start();
|
|
63
|
+
* }
|
|
64
|
+
* }
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* // With custom constraints
|
|
71
|
+
* const screen = displayMedia({
|
|
72
|
+
* video: {
|
|
73
|
+
* width: { ideal: 1920 },
|
|
74
|
+
* height: { ideal: 1080 },
|
|
75
|
+
* },
|
|
76
|
+
* audio: true,
|
|
77
|
+
* });
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare function displayMedia(options?: DisplayMediaOptions): DisplayMediaRef;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import type { WithInjector } from '@signality/core/types';
|
|
3
|
+
export interface EyeDropperOptions extends WithInjector {
|
|
4
|
+
/**
|
|
5
|
+
* Initial color value in sRGB hex format.
|
|
6
|
+
* @default ''
|
|
7
|
+
*/
|
|
8
|
+
readonly initialValue?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface EyeDropperRef {
|
|
11
|
+
/** Current selected color in sRGB hex format */
|
|
12
|
+
readonly sRGBHex: Signal<string>;
|
|
13
|
+
/** Whether EyeDropper API is supported */
|
|
14
|
+
readonly isSupported: Signal<boolean>;
|
|
15
|
+
/** Open the eyedropper tool to select a color */
|
|
16
|
+
readonly open: () => Promise<void>;
|
|
17
|
+
/** Cancel the active eyedropper operation */
|
|
18
|
+
readonly close: () => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Signal-based wrapper around the [EyeDropper API](https://developer.mozilla.org/en-US/docs/Web/API/EyeDropper_API).
|
|
22
|
+
*
|
|
23
|
+
* @param options - Optional configuration
|
|
24
|
+
* @returns An {@link EyeDropperRef} with `isSupported`, `sRGBHex` signals and `open`/`close` methods
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* @Component({
|
|
29
|
+
* template: `
|
|
30
|
+
* @if (eyeDropper.isSupported()) {
|
|
31
|
+
* <button (click)="pickColor()">Pick Color</button>
|
|
32
|
+
* <div [style.background-color]="eyeDropper.sRGBHex()">
|
|
33
|
+
* Selected: {{ eyeDropper.sRGBHex() }}
|
|
34
|
+
* </div>
|
|
35
|
+
* }
|
|
36
|
+
* `
|
|
37
|
+
* })
|
|
38
|
+
* class ColorPickerComponent {
|
|
39
|
+
* readonly eyeDropper = eyeDropper();
|
|
40
|
+
*
|
|
41
|
+
* async pickColor() {
|
|
42
|
+
* await this.eyeDropper.open();
|
|
43
|
+
* }
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function eyeDropper(options?: EyeDropperOptions): EyeDropperRef;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import type { WithInjector } from '@signality/core/types';
|
|
3
|
+
export interface FaviconOptions extends WithInjector {
|
|
4
|
+
readonly baseUrl?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface FaviconRef {
|
|
7
|
+
readonly current: Signal<string>;
|
|
8
|
+
readonly original: Signal<string>;
|
|
9
|
+
readonly set: (url: string) => void;
|
|
10
|
+
readonly setEmoji: (emoji: string) => void;
|
|
11
|
+
readonly reset: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Reactive favicon manipulation.
|
|
15
|
+
* Dynamically change the page favicon based on application state.
|
|
16
|
+
*
|
|
17
|
+
* @param options - Optional configuration
|
|
18
|
+
* @returns A FaviconRef with favicon control methods
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* @Component({
|
|
23
|
+
* template: `
|
|
24
|
+
* <button (click)="setNotification()">Set Notification</button>
|
|
25
|
+
* <button (click)="fav.reset()">Reset Favicon</button>
|
|
26
|
+
* <p>Current: {{ fav.current() }}</p>
|
|
27
|
+
* `
|
|
28
|
+
* })
|
|
29
|
+
* class FaviconComponent {
|
|
30
|
+
* readonly fav = favicon();
|
|
31
|
+
*
|
|
32
|
+
* setNotification() {
|
|
33
|
+
* this.fav.setEmoji('🔴');
|
|
34
|
+
* }
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function favicon(options?: FaviconOptions): FaviconRef;
|
|
39
|
+
export declare const FAVICON: import("@angular/core").ProviderToken<FaviconRef>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import type { WithInjector } from '@signality/core/types';
|
|
3
|
+
export interface FpsOptions extends WithInjector {
|
|
4
|
+
/**
|
|
5
|
+
* Start monitoring immediately.
|
|
6
|
+
* @default true
|
|
7
|
+
*/
|
|
8
|
+
readonly immediate?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Number of frames to average.
|
|
11
|
+
* @default 60
|
|
12
|
+
*/
|
|
13
|
+
readonly sampleSize?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface FpsRef {
|
|
16
|
+
/** Current frames per second */
|
|
17
|
+
readonly fps: Signal<number>;
|
|
18
|
+
/** Whether monitoring is active */
|
|
19
|
+
readonly isRunning: Signal<boolean>;
|
|
20
|
+
/** Start FPS monitoring */
|
|
21
|
+
readonly start: () => void;
|
|
22
|
+
/** Stop FPS monitoring */
|
|
23
|
+
readonly stop: () => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Reactive FPS monitor using requestAnimationFrame.
|
|
27
|
+
*
|
|
28
|
+
* @param options - Configuration options
|
|
29
|
+
* @returns An FpsRef with fps signal and control methods
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* @Component({
|
|
34
|
+
* template: `
|
|
35
|
+
* <p>FPS: {{ fpsMonitor.fps() }}</p>
|
|
36
|
+
* <button (click)="fpsMonitor.stop()">Stop</button>
|
|
37
|
+
* <button (click)="fpsMonitor.start()">Start</button>
|
|
38
|
+
* `
|
|
39
|
+
* })
|
|
40
|
+
* class FpsComponent {
|
|
41
|
+
* readonly fpsMonitor = fps();
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function fps(options?: FpsOptions): FpsRef;
|
|
46
|
+
export declare const FPS: import("@angular/core").ProviderToken<FpsRef>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import type { WithInjector } from '@signality/core/types';
|
|
3
|
+
export interface GamepadRef {
|
|
4
|
+
/** Whether Gamepad API is supported */
|
|
5
|
+
readonly isSupported: Signal<boolean>;
|
|
6
|
+
/** Array of connected gamepads */
|
|
7
|
+
readonly gamepads: Signal<(Gamepad | null)[]>;
|
|
8
|
+
/** First connected gamepad */
|
|
9
|
+
readonly activeGamepad: Signal<Gamepad | undefined>;
|
|
10
|
+
/** Axes values of active gamepad */
|
|
11
|
+
readonly axes: Signal<readonly number[]>;
|
|
12
|
+
/** Button states of active gamepad */
|
|
13
|
+
readonly buttons: Signal<readonly GamepadButton[]>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Signal-based wrapper around the Gamepad API.
|
|
17
|
+
*
|
|
18
|
+
* @param options - Optional injector for DI context
|
|
19
|
+
* @returns A GamepadRef with gamepad state signals
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const gp = gamepad();
|
|
24
|
+
*
|
|
25
|
+
* // In template: @for (pad of gp.gamepads(); track pad?.index) { ... }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function gamepad(options?: WithInjector): GamepadRef;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
2
|
+
import type { WithInjector } from '@signality/core/types';
|
|
3
|
+
export interface GeolocationOptions extends WithInjector {
|
|
4
|
+
/**
|
|
5
|
+
* Start tracking immediately.
|
|
6
|
+
* @default true
|
|
7
|
+
*/
|
|
8
|
+
readonly immediate?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Use GPS for better accuracy.
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
readonly enableHighAccuracy?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Max age of cached position (ms).
|
|
16
|
+
* @default 0
|
|
17
|
+
*/
|
|
18
|
+
readonly maximumAge?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Request timeout (ms).
|
|
21
|
+
* @default Infinity
|
|
22
|
+
*/
|
|
23
|
+
readonly timeout?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface GeolocationRef {
|
|
26
|
+
/** Whether Geolocation is supported */
|
|
27
|
+
readonly isSupported: Signal<boolean>;
|
|
28
|
+
/** Full position object with timestamp */
|
|
29
|
+
readonly position: Signal<GeolocationPosition | null>;
|
|
30
|
+
/** Last error */
|
|
31
|
+
readonly error: Signal<GeolocationPositionError | null>;
|
|
32
|
+
/** Whether location tracking is currently active */
|
|
33
|
+
readonly isActive: Signal<boolean>;
|
|
34
|
+
/** Whether currently fetching location */
|
|
35
|
+
readonly isLoading: Signal<boolean>;
|
|
36
|
+
/** Start/resume watching position */
|
|
37
|
+
readonly start: () => void;
|
|
38
|
+
/** Stop watching position */
|
|
39
|
+
readonly stop: () => void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Signal-based wrapper around the [Geolocation API](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API).
|
|
43
|
+
*
|
|
44
|
+
* @param options - Configuration options
|
|
45
|
+
* @returns A GeolocationRef with location signals and control methods
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* @Component({
|
|
50
|
+
* template: `
|
|
51
|
+
* @if (geo.isLoading()) {
|
|
52
|
+
* <p>Getting your location...</p>
|
|
53
|
+
* } @else if (geo.position()?.coords; as coords) {
|
|
54
|
+
* <p>{{ coords.latitude }}, {{ coords.longitude }}</p>
|
|
55
|
+
* }
|
|
56
|
+
* <button (click)="geo.stop()">Stop</button>
|
|
57
|
+
* <button (click)="geo.start()">Start</button>
|
|
58
|
+
* })
|
|
59
|
+
* class LocationComponent {
|
|
60
|
+
* readonly geo = geolocation();
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare function geolocation(options?: GeolocationOptions): GeolocationRef;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export * from '@signality/core/browser/battery';
|
|
2
|
+
export * from '@signality/core/browser/bluetooth';
|
|
3
|
+
export * from '@signality/core/browser/breakpoints';
|
|
4
|
+
export * from '@signality/core/browser/broadcast-channel';
|
|
5
|
+
export * from '@signality/core/browser/browser-language';
|
|
6
|
+
export * from '@signality/core/browser/clipboard';
|
|
7
|
+
export * from '@signality/core/browser/device-posture';
|
|
8
|
+
export * from '@signality/core/browser/display-media';
|
|
9
|
+
export * from '@signality/core/browser/eye-dropper';
|
|
10
|
+
export * from '@signality/core/browser/favicon';
|
|
11
|
+
export * from '@signality/core/browser/fps';
|
|
12
|
+
export * from '@signality/core/browser/gamepad';
|
|
13
|
+
export * from '@signality/core/browser/geolocation';
|
|
14
|
+
export * from '@signality/core/browser/input-modality';
|
|
15
|
+
export * from '@signality/core/browser/listener';
|
|
16
|
+
export * from '@signality/core/browser/media-query';
|
|
17
|
+
export * from '@signality/core/browser/network';
|
|
18
|
+
export * from '@signality/core/browser/online';
|
|
19
|
+
export * from '@signality/core/browser/page-visibility';
|
|
20
|
+
export * from '@signality/core/browser/picture-in-picture';
|
|
21
|
+
export * from '@signality/core/browser/web-share';
|
|
22
|
+
export * from '@signality/core/browser/speech-recognition';
|
|
23
|
+
export * from '@signality/core/browser/speech-synthesis';
|
|
24
|
+
export * from '@signality/core/browser/storage';
|
|
25
|
+
export * from '@signality/core/browser/text-direction';
|
|
26
|
+
export * from '@signality/core/browser/vibration';
|
|
27
|
+
export * from '@signality/core/browser/wake-lock';
|
|
28
|
+
export * from '@signality/core/browser/web-notification';
|
|
29
|
+
export * from '@signality/core/browser/web-worker';
|