@excom/provider-geolocation 0.1.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.
Files changed (31) hide show
  1. package/.rush/temp/chunked-rush-logs/provider-geolocation.apply-exports.chunks.jsonl +1 -0
  2. package/.rush/temp/chunked-rush-logs/provider-geolocation.build_docs.chunks.jsonl +1 -0
  3. package/.rush/temp/chunked-rush-logs/provider-geolocation.build_package-metas.chunks.jsonl +1 -0
  4. package/.rush/temp/operation/apply-exports/all.log +1 -0
  5. package/.rush/temp/operation/apply-exports/log-chunks.jsonl +1 -0
  6. package/.rush/temp/operation/apply-exports/state.json +3 -0
  7. package/.rush/temp/operation/build_docs/all.log +1 -0
  8. package/.rush/temp/operation/build_docs/log-chunks.jsonl +1 -0
  9. package/.rush/temp/operation/build_docs/state.json +3 -0
  10. package/.rush/temp/operation/build_package-metas/all.log +1 -0
  11. package/.rush/temp/operation/build_package-metas/log-chunks.jsonl +1 -0
  12. package/.rush/temp/operation/build_package-metas/state.json +3 -0
  13. package/.rush/temp/shrinkwrap-deps.json +3 -0
  14. package/config/rig.json +5 -0
  15. package/index.ts +18 -0
  16. package/package.json +42 -0
  17. package/provider-geolocation.ts +222 -0
  18. package/rush-logs/provider-geolocation.apply-exports.cache.log +1 -0
  19. package/rush-logs/provider-geolocation.apply-exports.log +1 -0
  20. package/rush-logs/provider-geolocation.build_docs.cache.log +1 -0
  21. package/rush-logs/provider-geolocation.build_docs.log +1 -0
  22. package/rush-logs/provider-geolocation.build_package-metas.cache.log +1 -0
  23. package/rush-logs/provider-geolocation.build_package-metas.log +1 -0
  24. package/support/custom-elements.json +271 -0
  25. package/support/demos/request.html +12 -0
  26. package/support/dist-docs/provider-geolocation.md +108 -0
  27. package/support/docs/README.md +34 -0
  28. package/support/package-meta.json +148 -0
  29. package/support/tests/provider-geolocation.test.ts +563 -0
  30. package/support/tests/request.view.test.ts +38 -0
  31. package/tsconfig.json +5 -0
@@ -0,0 +1 @@
1
+ {"kind":"O","text":"Invoking: cd \"$RUSH_PROJECT_FOLDER\" && node ../heft-rig/scripts/apply-exports.mjs \n"}
@@ -0,0 +1 @@
1
+ {"kind":"O","text":"Invoking: node node_modules/@excom/heft-rig/scripts/build-docs.mjs \n"}
@@ -0,0 +1 @@
1
+ {"kind":"O","text":"Invoking: node node_modules/@excom/heft-rig/scripts/build-package-metas.mjs \n"}
@@ -0,0 +1 @@
1
+ Invoking: cd "$RUSH_PROJECT_FOLDER" && node ../heft-rig/scripts/apply-exports.mjs
@@ -0,0 +1 @@
1
+ {"kind":"O","text":"Invoking: cd \"$RUSH_PROJECT_FOLDER\" && node ../heft-rig/scripts/apply-exports.mjs \n"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "nonCachedDurationMs": 38.29784399999994
3
+ }
@@ -0,0 +1 @@
1
+ Invoking: node node_modules/@excom/heft-rig/scripts/build-docs.mjs
@@ -0,0 +1 @@
1
+ {"kind":"O","text":"Invoking: node node_modules/@excom/heft-rig/scripts/build-docs.mjs \n"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "nonCachedDurationMs": 41.80963500000007
3
+ }
@@ -0,0 +1 @@
1
+ Invoking: node node_modules/@excom/heft-rig/scripts/build-package-metas.mjs
@@ -0,0 +1 @@
1
+ {"kind":"O","text":"Invoking: node node_modules/@excom/heft-rig/scripts/build-package-metas.mjs \n"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "nonCachedDurationMs": 113.07771000000002
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "../../packages/provider-geolocation": "../../packages/provider-geolocation:YAC8G8l1nkKknuTXH370JI0/DynCPkP81MNQcvbO6fA=:"
3
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
3
+ "rigPackageName": "@excom/heft-rig",
4
+ "rigProfile": "default"
5
+ }
package/index.ts ADDED
@@ -0,0 +1,18 @@
1
+ import { ProviderGeolocation } from "./provider-geolocation";
2
+
3
+ ProviderGeolocation.define();
4
+
5
+ export { ProviderGeolocation };
6
+
7
+ type T_HTMLProviderGeolocationElement =
8
+ typeof ProviderGeolocation.CustomElement;
9
+ declare global {
10
+ interface HTMLProviderGeolocationElement extends T_HTMLProviderGeolocationElement {}
11
+ interface Window {
12
+ HTMLProviderGeolocationElement: HTMLProviderGeolocationElement;
13
+ }
14
+ interface HTMLElementTagNameMap {
15
+ "provider-geolocation": HTMLProviderGeolocationElement;
16
+ }
17
+ }
18
+ export type { HTMLProviderGeolocationElement };
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@excom/provider-geolocation",
3
+ "version": "0.1.0",
4
+ "description": "<provider-geolocation> custom element",
5
+ "license": "MIT",
6
+ "engines": {
7
+ "node": ">=24.13.0"
8
+ },
9
+ "type": "module",
10
+ "dependencies": {
11
+ "@excom/neutron": "^0.1.0"
12
+ },
13
+ "peerDependencies": {},
14
+ "devDependencies": {
15
+ "@excom/heft-rig": "^0.1.0"
16
+ },
17
+ "repository": {
18
+ "url": "excom-dev/nucleus",
19
+ "directory": "packages/provider-geolocation"
20
+ },
21
+ "homepage": "https://github.com/excom-dev/nucleus/tree/main/packages/provider-geolocation/support/docs/README.md",
22
+ "bugs": "https://github.com/excom-dev/nucleus/issues",
23
+ "keywords": [
24
+ "provider-geolocation",
25
+ "neutron",
26
+ "custom-elements"
27
+ ],
28
+ "excom": {
29
+ "packageType": "kit-element"
30
+ },
31
+ "scripts": {
32
+ "build": "node node_modules/@excom/heft-rig/scripts/vite-build.mjs",
33
+ "build:watch": "node node_modules/@excom/heft-rig/scripts/vite-build-watch.mjs",
34
+ "format": "node node_modules/@excom/heft-rig/scripts/format.mjs",
35
+ "test": "node node_modules/@excom/heft-rig/scripts/vitest.mjs",
36
+ "coverage": "node node_modules/@excom/heft-rig/scripts/coverage.mjs",
37
+ "dev": "node node_modules/@excom/heft-rig/scripts/vite-dev.mjs",
38
+ "preview": "node node_modules/@excom/heft-rig/scripts/vite-preview.mjs",
39
+ "build:package-metas": "node node_modules/@excom/heft-rig/scripts/build-package-metas.mjs",
40
+ "build:docs": "node node_modules/@excom/heft-rig/scripts/build-docs.mjs"
41
+ }
42
+ }
@@ -0,0 +1,222 @@
1
+ import { ConstructorType, Neutron, TEvent } from "@excom/neutron";
2
+
3
+ export type GeoSuccess = {
4
+ coords: {
5
+ longitude: number;
6
+ latitude: number;
7
+ altitude?: number;
8
+ accuracy?: number;
9
+ altitudeAccuracy?: number;
10
+ heading?: number;
11
+ speed?: number;
12
+ timestamp?: number;
13
+ };
14
+ };
15
+
16
+ export type ProviderGeolocationSuccessEvent = TEvent & {
17
+ type: "provider-geolocation-success";
18
+ detail: GeoSuccess;
19
+ };
20
+
21
+ export type ProviderGeolocationErrorEvent = TEvent & {
22
+ type: "provider-geolocation-error";
23
+ detail: GeolocationPositionError;
24
+ };
25
+
26
+ /**
27
+ * Wraps the Geolocation API as a declarative element — request the
28
+ * user's position (once or continuously) and read the result from
29
+ * attributes/state.
30
+ *
31
+ * Lifecycle: a `watch-position` watch is cleared when the element leaves
32
+ * the document and started again on reconnect (unless `is-paused`); a
33
+ * DOM move keeps the current watch / request. A one-shot request that
34
+ * settles after the element was removed is dropped — no event, no state.
35
+ *
36
+ * @fires provider-geolocation-success - Dispatched on every successful
37
+ * position read (including each update while `watch-position` is
38
+ * set).
39
+ * @type ProviderGeolocationSuccessEvent
40
+ * @fires provider-geolocation-error - Dispatched when the request fails
41
+ * (permission denied, timeout, position unavailable, or a thrown
42
+ * error).
43
+ * @type ProviderGeolocationErrorEvent
44
+ * @command --request - (Re)requests the position on demand — the standard
45
+ * way to request from a button (`<button command="--request"
46
+ * commandfor="…">`) while `is-paused` is set, or to force a fresh read
47
+ * at any time.
48
+ * @default-action provider-geolocation-success - Stores the result in
49
+ * `provision` and sets `is-success` (clearing `is-requesting` /
50
+ * `is-error`).
51
+ * @default-action provider-geolocation-error - Stores the error in
52
+ * `provision` and sets `is-error` (clearing `is-requesting` /
53
+ * `is-success`).
54
+ */
55
+ export const ProviderGeolocation = Neutron({
56
+ tag: "provider-geolocation",
57
+ props: {
58
+ // options
59
+ /**
60
+ * @option
61
+ * Skip making a request on connect. `provider-geolocation-request`
62
+ * still works while paused.
63
+ */
64
+ isPaused: Boolean,
65
+ /**
66
+ * @option
67
+ * Request the most accurate position available (more battery /
68
+ * time cost).
69
+ */
70
+ highAccuracy: Boolean,
71
+ /**
72
+ * @option
73
+ * Give up and fire `provider-geolocation-error` after this many ms.
74
+ * @default Infinity
75
+ */
76
+ geoTimeout: {
77
+ type: Number,
78
+ defaultValue: () => Infinity,
79
+ },
80
+ /**
81
+ * @option
82
+ * Accept a cached position up to this many ms old instead of
83
+ * requesting a fresh one. Ignored when `watch-position` is set
84
+ * (always `0`, i.e. no caching).
85
+ */
86
+ maximumAge: Number,
87
+ /**
88
+ * @option
89
+ * Keep requesting — `provider-geolocation-success` fires on every
90
+ * position update instead of once. Uses
91
+ * `navigator.geolocation.watchPosition` under the hood.
92
+ */
93
+ watchPosition: Boolean,
94
+ // state
95
+ /**
96
+ * @state
97
+ * A position request is currently pending.
98
+ */
99
+ isRequesting: Boolean,
100
+ /**
101
+ * @state
102
+ * The most recent request resolved successfully. With
103
+ * `watch-position`, stays set across updates.
104
+ */
105
+ isSuccess: Boolean,
106
+ /**
107
+ * @state
108
+ * The most recent request failed. Fires with the `error` event.
109
+ */
110
+ isError: Boolean,
111
+ /**
112
+ * @provision
113
+ * Latest result: the coords object on success, or the
114
+ * `GeolocationPositionError` (or thrown error) on failure.
115
+ * Not reflected as an attribute.
116
+ * @type GeoSuccess
117
+ */
118
+ provision: Object as unknown as ConstructorType<
119
+ GeoSuccess | GeolocationPositionError | Error
120
+ >,
121
+ // private
122
+ existingWatchId: {
123
+ type: Number,
124
+ attr: false,
125
+ },
126
+ },
127
+ })
128
+ .defineMethods({
129
+ handlePosition: (element, location: GeolocationPosition) => {
130
+ // Settled after disconnect: drop it, don't mutate a detached node.
131
+ if (!element.isConnected) return;
132
+ return {
133
+ // Success for a continuous watch update
134
+ emit: [
135
+ "provider-geolocation-success",
136
+ {
137
+ detail: {
138
+ coords: {
139
+ latitude: location.coords.latitude,
140
+ longitude: location.coords.longitude,
141
+ altitude: location.coords.altitude ?? undefined,
142
+ accuracy: location.coords.accuracy ?? undefined,
143
+ altitudeAccuracy: location.coords.altitudeAccuracy ?? undefined,
144
+ heading: location.coords.heading ?? undefined,
145
+ speed: location.coords.speed ?? undefined,
146
+ timestamp: location.timestamp,
147
+ },
148
+ },
149
+ },
150
+ ],
151
+ };
152
+ },
153
+ handleError: (element, error: GeolocationPositionError) => {
154
+ if (!element.isConnected) return;
155
+ return {
156
+ emit: ["provider-geolocation-error", { detail: error }],
157
+ };
158
+ },
159
+ makeRequest: ({
160
+ highAccuracy,
161
+ geoTimeout,
162
+ maximumAge,
163
+ watchPosition,
164
+ // @ts-ignore TODO defineMethods
165
+ handlePosition,
166
+ // @ts-ignore TODO defineMethods
167
+ handleError,
168
+ }) => {
169
+ let newWatchId: number | void | null = null;
170
+ try {
171
+ newWatchId = navigator.geolocation[
172
+ watchPosition ? "watchPosition" : "getCurrentPosition"
173
+ ](handlePosition, handleError, {
174
+ maximumAge: watchPosition ? 0 : (maximumAge ?? 60000),
175
+ timeout: geoTimeout,
176
+ enableHighAccuracy: highAccuracy ?? false,
177
+ });
178
+ } catch (e) {
179
+ handleError(e);
180
+ }
181
+ return {
182
+ existingWatchId: newWatchId ?? null,
183
+ isRequesting: true,
184
+ };
185
+ },
186
+ })
187
+ .onConnected(
188
+ // A DOM move keeps the current request / watch. Only a fresh connect
189
+ // or a real reconnect requests again.
190
+ ({ isPaused, isMoving }) =>
191
+ !isPaused &&
192
+ !isMoving && {
193
+ makeRequest: [],
194
+ }
195
+ )
196
+ .onPropUnset("isPaused", () => ({
197
+ makeRequest: [],
198
+ }))
199
+ .onPropChanged("existingWatchId", (_, previous) => {
200
+ if (typeof previous.existingWatchId === "number") {
201
+ navigator.geolocation.clearWatch(previous.existingWatchId);
202
+ }
203
+ })
204
+ .onCommand("--request", () => ({ makeRequest: [] }))
205
+ .onEventDefault("provider-geolocation-success", (_, { detail }) => ({
206
+ provision: detail,
207
+ isRequesting: false,
208
+ isSuccess: true,
209
+ isError: false,
210
+ }))
211
+ .onEventDefault("provider-geolocation-error", (_, { detail }) => ({
212
+ provision: detail,
213
+ isRequesting: false,
214
+ isSuccess: false,
215
+ isError: true,
216
+ }))
217
+ .onDisconnected(({ isMoving }) => {
218
+ if (isMoving) return;
219
+ return {
220
+ existingWatchId: null,
221
+ };
222
+ });
@@ -0,0 +1 @@
1
+ Caching has been disabled for this project's "apply-exports" command.
@@ -0,0 +1 @@
1
+ Invoking: cd "$RUSH_PROJECT_FOLDER" && node ../heft-rig/scripts/apply-exports.mjs
@@ -0,0 +1 @@
1
+ This project does not define the caching behavior of the "build:docs" command, so caching has been disabled.
@@ -0,0 +1 @@
1
+ Invoking: node node_modules/@excom/heft-rig/scripts/build-docs.mjs
@@ -0,0 +1 @@
1
+ This project does not define the caching behavior of the "build:package-metas" command, so caching has been disabled.
@@ -0,0 +1 @@
1
+ Invoking: node node_modules/@excom/heft-rig/scripts/build-package-metas.mjs
@@ -0,0 +1,271 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "modules": [
4
+ {
5
+ "kind": "javascript-module",
6
+ "path": "provider-geolocation.ts",
7
+ "declarations": [
8
+ {
9
+ "kind": "class",
10
+ "name": "ProviderGeolocation",
11
+ "customElement": true,
12
+ "tagName": "provider-geolocation",
13
+ "description": "Wraps the Geolocation API as a declarative element — request the user's position (once or continuously) and read the result from attributes/state. Lifecycle: a `watch-position` watch is cleared when the element leaves the document and started again on reconnect (unless `is-paused`); a DOM move keeps the current watch / request. A one-shot request that settles after the element was removed is dropped — no event, no state.",
14
+ "attributes": [
15
+ {
16
+ "name": "is-paused",
17
+ "type": {
18
+ "text": "boolean"
19
+ },
20
+ "description": "Skip making a request on connect. `provider-geolocation-request` still works while paused.",
21
+ "fieldName": "isPaused"
22
+ },
23
+ {
24
+ "name": "high-accuracy",
25
+ "type": {
26
+ "text": "boolean"
27
+ },
28
+ "description": "Request the most accurate position available (more battery / time cost).",
29
+ "fieldName": "highAccuracy"
30
+ },
31
+ {
32
+ "name": "geo-timeout",
33
+ "type": {
34
+ "text": "number"
35
+ },
36
+ "description": "Give up and fire `provider-geolocation-error` after this many ms.",
37
+ "fieldName": "geoTimeout",
38
+ "default": "Infinity"
39
+ },
40
+ {
41
+ "name": "maximum-age",
42
+ "type": {
43
+ "text": "number"
44
+ },
45
+ "description": "Accept a cached position up to this many ms old instead of requesting a fresh one. Ignored when `watch-position` is set (always `0`, i.e. no caching).",
46
+ "fieldName": "maximumAge"
47
+ },
48
+ {
49
+ "name": "watch-position",
50
+ "type": {
51
+ "text": "boolean"
52
+ },
53
+ "description": "Keep requesting — `provider-geolocation-success` fires on every position update instead of once. Uses `navigator.geolocation.watchPosition` under the hood.",
54
+ "fieldName": "watchPosition"
55
+ },
56
+ {
57
+ "name": "is-requesting",
58
+ "type": {
59
+ "text": "boolean"
60
+ },
61
+ "description": "A position request is currently pending.",
62
+ "fieldName": "isRequesting"
63
+ },
64
+ {
65
+ "name": "is-success",
66
+ "type": {
67
+ "text": "boolean"
68
+ },
69
+ "description": "The most recent request resolved successfully. With `watch-position`, stays set across updates.",
70
+ "fieldName": "isSuccess"
71
+ },
72
+ {
73
+ "name": "is-error",
74
+ "type": {
75
+ "text": "boolean"
76
+ },
77
+ "description": "The most recent request failed. Fires with the `error` event.",
78
+ "fieldName": "isError"
79
+ }
80
+ ],
81
+ "members": [
82
+ {
83
+ "kind": "field",
84
+ "name": "isPaused",
85
+ "type": {
86
+ "text": "boolean"
87
+ },
88
+ "privacy": "public",
89
+ "readonly": false,
90
+ "description": "Skip making a request on connect. `provider-geolocation-request` still works while paused.",
91
+ "_neutron": {
92
+ "surface": "option"
93
+ }
94
+ },
95
+ {
96
+ "kind": "field",
97
+ "name": "highAccuracy",
98
+ "type": {
99
+ "text": "boolean"
100
+ },
101
+ "privacy": "public",
102
+ "readonly": false,
103
+ "description": "Request the most accurate position available (more battery / time cost).",
104
+ "_neutron": {
105
+ "surface": "option"
106
+ }
107
+ },
108
+ {
109
+ "kind": "field",
110
+ "name": "geoTimeout",
111
+ "type": {
112
+ "text": "number"
113
+ },
114
+ "privacy": "public",
115
+ "readonly": false,
116
+ "description": "Give up and fire `provider-geolocation-error` after this many ms.",
117
+ "default": "Infinity",
118
+ "_neutron": {
119
+ "surface": "option"
120
+ }
121
+ },
122
+ {
123
+ "kind": "field",
124
+ "name": "maximumAge",
125
+ "type": {
126
+ "text": "number"
127
+ },
128
+ "privacy": "public",
129
+ "readonly": false,
130
+ "description": "Accept a cached position up to this many ms old instead of requesting a fresh one. Ignored when `watch-position` is set (always `0`, i.e. no caching).",
131
+ "_neutron": {
132
+ "surface": "option"
133
+ }
134
+ },
135
+ {
136
+ "kind": "field",
137
+ "name": "watchPosition",
138
+ "type": {
139
+ "text": "boolean"
140
+ },
141
+ "privacy": "public",
142
+ "readonly": false,
143
+ "description": "Keep requesting — `provider-geolocation-success` fires on every position update instead of once. Uses `navigator.geolocation.watchPosition` under the hood.",
144
+ "_neutron": {
145
+ "surface": "option"
146
+ }
147
+ },
148
+ {
149
+ "kind": "field",
150
+ "name": "isRequesting",
151
+ "type": {
152
+ "text": "boolean"
153
+ },
154
+ "privacy": "public",
155
+ "readonly": true,
156
+ "description": "A position request is currently pending.",
157
+ "_neutron": {
158
+ "surface": "state"
159
+ }
160
+ },
161
+ {
162
+ "kind": "field",
163
+ "name": "isSuccess",
164
+ "type": {
165
+ "text": "boolean"
166
+ },
167
+ "privacy": "public",
168
+ "readonly": true,
169
+ "description": "The most recent request resolved successfully. With `watch-position`, stays set across updates.",
170
+ "_neutron": {
171
+ "surface": "state"
172
+ }
173
+ },
174
+ {
175
+ "kind": "field",
176
+ "name": "isError",
177
+ "type": {
178
+ "text": "boolean"
179
+ },
180
+ "privacy": "public",
181
+ "readonly": true,
182
+ "description": "The most recent request failed. Fires with the `error` event.",
183
+ "_neutron": {
184
+ "surface": "state"
185
+ }
186
+ },
187
+ {
188
+ "kind": "field",
189
+ "name": "provision",
190
+ "type": {
191
+ "text": "GeoSuccess",
192
+ "expanded": "{ coords: { longitude: number; latitude: number; altitude?: number; accuracy?: number; altitudeAccuracy?: number; heading?: number; speed?: number; timestamp?: number; }; }"
193
+ },
194
+ "privacy": "public",
195
+ "readonly": false,
196
+ "description": "Latest result: the coords object on success, or the `GeolocationPositionError` (or thrown error) on failure. Not reflected as an attribute.",
197
+ "_neutron": {
198
+ "surface": "option"
199
+ }
200
+ }
201
+ ],
202
+ "events": [
203
+ {
204
+ "name": "provider-geolocation-success",
205
+ "description": "Dispatched on every successful position read (including each update while `watch-position` is set).",
206
+ "type": {
207
+ "text": "ProviderGeolocationSuccessEvent",
208
+ "expanded": "CustomEvent & { type: \"provider-geolocation-success\"; detail: { coords: { longitude: number; latitude: number; altitude?: number; accuracy?: number; altitudeAccuracy?: number; heading?: number; speed?: number; timestamp?: number; }; }; bubbles: true; cancelable: true; composed: true }"
209
+ }
210
+ },
211
+ {
212
+ "name": "provider-geolocation-error",
213
+ "description": "Dispatched when the request fails (permission denied, timeout, position unavailable, or a thrown error).",
214
+ "type": {
215
+ "text": "ProviderGeolocationErrorEvent",
216
+ "expanded": "CustomEvent & { type: \"provider-geolocation-error\"; detail: GeolocationPositionError; bubbles: true; cancelable: true; composed: true }"
217
+ }
218
+ }
219
+ ],
220
+ "_neutron": {
221
+ "provisions": [
222
+ {
223
+ "name": "provision",
224
+ "type": {
225
+ "text": "GeoSuccess",
226
+ "expanded": "{ coords: { longitude: number; latitude: number; altitude?: number; accuracy?: number; altitudeAccuracy?: number; heading?: number; speed?: number; timestamp?: number; }; }"
227
+ },
228
+ "description": "Latest result: the coords object on success, or the `GeolocationPositionError` (or thrown error) on failure. Not reflected as an attribute.",
229
+ "fieldName": "provision"
230
+ }
231
+ ],
232
+ "commands": [
233
+ {
234
+ "name": "--request",
235
+ "description": "(Re)requests the position on demand — the standard way to request from a button (`<button command=\"--request\" commandfor=\"…\">`) while `is-paused` is set, or to force a fresh read at any time."
236
+ }
237
+ ],
238
+ "defaultActions": [
239
+ {
240
+ "name": "provider-geolocation-success",
241
+ "description": "Stores the result in `provision` and sets `is-success` (clearing `is-requesting` / `is-error`)."
242
+ },
243
+ {
244
+ "name": "provider-geolocation-error",
245
+ "description": "Stores the error in `provision` and sets `is-error` (clearing `is-requesting` / `is-success`)."
246
+ }
247
+ ]
248
+ }
249
+ }
250
+ ],
251
+ "exports": [
252
+ {
253
+ "kind": "js",
254
+ "name": "ProviderGeolocation",
255
+ "declaration": {
256
+ "name": "ProviderGeolocation",
257
+ "module": "provider-geolocation.ts"
258
+ }
259
+ },
260
+ {
261
+ "kind": "custom-element-definition",
262
+ "name": "provider-geolocation",
263
+ "declaration": {
264
+ "name": "ProviderGeolocation",
265
+ "module": "provider-geolocation.ts"
266
+ }
267
+ }
268
+ ]
269
+ }
270
+ ]
271
+ }
@@ -0,0 +1,12 @@
1
+ <div id="geo-request-demo">
2
+ <button type="button" command="--request" commandfor="geo-request">
3
+ Request my location
4
+ </button>
5
+ <provider-geolocation id="geo-request" is-paused></provider-geolocation>
6
+ <output>Click above — your browser will prompt for permission.</output>
7
+ <quark-sheet>
8
+ @use "/demo-utils" as *;
9
+
10
+ #geo-request-demo { @on neutron-provision (handle: setOutputFromElementData); }
11
+ </quark-sheet>
12
+ </div>