foldkit-primitives 0.15.3 → 0.15.4
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/dist/device/index.d.mts +10 -20
- package/dist/device/index.d.mts.map +1 -1
- package/dist/device/index.mjs +6 -11
- package/dist/device/index.mjs.map +1 -1
- package/dist/dom/index.d.mts +1 -37
- package/dist/dom/index.d.mts.map +1 -1
- package/dist/dom/index.mjs +18 -35
- package/dist/dom/index.mjs.map +1 -1
- package/dist/{editable-text-1D31qthY.d.mts → editable-text-Bg7vil7h.d.mts} +1 -13
- package/dist/editable-text-Bg7vil7h.d.mts.map +1 -0
- package/dist/events/index.d.mts +1 -17
- package/dist/events/index.d.mts.map +1 -1
- package/dist/events/index.mjs +10 -18
- package/dist/events/index.mjs.map +1 -1
- package/dist/{follow-tab-stop-Caog2qg1.mjs → follow-tab-stop-DM5EI4Ci.mjs} +8 -15
- package/dist/{follow-tab-stop-Caog2qg1.mjs.map → follow-tab-stop-DM5EI4Ci.mjs.map} +1 -1
- package/dist/{index-CmmxqSEi.d.mts → index-Bomdwb7e.d.mts} +4 -11
- package/dist/index-Bomdwb7e.d.mts.map +1 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/{input-modality-BXD383jg.mjs → input-modality-XwQOFLip.mjs} +2 -3
- package/dist/{input-modality-BXD383jg.mjs.map → input-modality-XwQOFLip.mjs.map} +1 -1
- package/dist/{input-modality-BY-bSrEc.d.mts → input-modality-l7InESYh.d.mts} +1 -3
- package/dist/input-modality-l7InESYh.d.mts.map +1 -0
- package/dist/interaction/index.d.mts +2 -3
- package/dist/interaction/index.d.mts.map +1 -1
- package/dist/interaction/index.mjs +24 -44
- package/dist/interaction/index.mjs.map +1 -1
- package/dist/{internal-DP-xLKbT.mjs → internal-C4gHodLc.mjs} +2 -3
- package/dist/{internal-DP-xLKbT.mjs.map → internal-C4gHodLc.mjs.map} +1 -1
- package/dist/media/index.d.mts +0 -6
- package/dist/media/index.d.mts.map +1 -1
- package/dist/media/index.mjs +3 -6
- package/dist/media/index.mjs.map +1 -1
- package/dist/motion/index.d.mts +1 -1
- package/dist/motion/index.mjs +1 -1
- package/dist/{motion-DmFDppRn.mjs → motion-BmlJCjn6.mjs} +6 -10
- package/dist/{motion-DmFDppRn.mjs.map → motion-BmlJCjn6.mjs.map} +1 -1
- package/dist/net/index.d.mts +0 -10
- package/dist/net/index.d.mts.map +1 -1
- package/dist/net/index.mjs +6 -11
- package/dist/net/index.mjs.map +1 -1
- package/dist/observers/index.d.mts +0 -8
- package/dist/observers/index.d.mts.map +1 -1
- package/dist/observers/index.mjs +4 -8
- package/dist/observers/index.mjs.map +1 -1
- package/dist/{rolldown-runtime-D7D4PA-g.mjs → rolldown-runtime-D8jQpDG7.mjs} +1 -2
- package/dist/state/index.d.mts +0 -12
- package/dist/state/index.d.mts.map +1 -1
- package/dist/state/index.mjs +7 -13
- package/dist/state/index.mjs.map +1 -1
- package/dist/time/index.d.mts +0 -12
- package/dist/time/index.d.mts.map +1 -1
- package/dist/time/index.mjs +6 -12
- package/dist/time/index.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/editable-text-1D31qthY.d.mts.map +0 -1
- package/dist/index-CmmxqSEi.d.mts.map +0 -1
- package/dist/input-modality-BY-bSrEc.d.mts.map +0 -1
package/dist/device/index.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ import { Option, Queue, Schema, Stream } from "effect";
|
|
|
2
2
|
import { Bundle } from "foldkit-bundle";
|
|
3
3
|
import * as ManagedResource from "foldkit/managedResource";
|
|
4
4
|
import { Command } from "foldkit/command";
|
|
5
|
-
//#region src/device/fullscreen.d.ts
|
|
6
5
|
export declare const FullscreenMessage: import("foldkit/message").MessageUnion<{
|
|
7
6
|
readonly Changed: {
|
|
8
7
|
active: Schema.Boolean;
|
|
@@ -28,8 +27,6 @@ export declare const exitFullscreen: () => Command<FullscreenMessage, never, nev
|
|
|
28
27
|
* answer. Without a document the stream is empty instead of throwing.
|
|
29
28
|
*/
|
|
30
29
|
export declare const fullscreenChanges: () => Stream.Stream<FullscreenMessage>;
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region src/device/geolocation.d.ts
|
|
33
30
|
export declare const Coordinates: Schema.Struct<{
|
|
34
31
|
readonly latitude: Schema.Number;
|
|
35
32
|
readonly longitude: Schema.Number;
|
|
@@ -83,8 +80,6 @@ export declare const Geolocation: Bundle.Bundle<"Geolocation", void, {
|
|
|
83
80
|
readonly longitude: number;
|
|
84
81
|
readonly accuracy: number;
|
|
85
82
|
}, never, never, never, void, {}, {}>;
|
|
86
|
-
//#endregion
|
|
87
|
-
//#region src/device/media-devices.d.ts
|
|
88
83
|
export declare const MediaDevice: Schema.Struct<{
|
|
89
84
|
readonly deviceId: Schema.String;
|
|
90
85
|
readonly groupId: Schema.String;
|
|
@@ -170,8 +165,6 @@ export declare const mediaDevices: <const Name extends string>(config: {
|
|
|
170
165
|
} | {
|
|
171
166
|
readonly _tag: "Scan";
|
|
172
167
|
}, never, never, never, void, {}, {}>;
|
|
173
|
-
//#endregion
|
|
174
|
-
//#region src/device/media-stream.d.ts
|
|
175
168
|
export declare const MediaStreamModel: Schema.Struct<{
|
|
176
169
|
readonly status: Schema.Literals<readonly ["idle", "requesting", "live", "denied"]>;
|
|
177
170
|
readonly lastError: Schema.NullOr<Schema.String>;
|
|
@@ -225,6 +218,10 @@ export declare const mediaStream: <const Name extends string>(config: {
|
|
|
225
218
|
readonly status: "denied" | "idle" | "live" | "requesting";
|
|
226
219
|
readonly lastError: string | null;
|
|
227
220
|
}, {
|
|
221
|
+
readonly _tag: "Started";
|
|
222
|
+
} | {
|
|
223
|
+
readonly _tag: "Stopped";
|
|
224
|
+
} | {
|
|
228
225
|
readonly _tag: "Denied";
|
|
229
226
|
} | {
|
|
230
227
|
readonly _tag: "Ended";
|
|
@@ -233,15 +230,15 @@ export declare const mediaStream: <const Name extends string>(config: {
|
|
|
233
230
|
readonly message: string;
|
|
234
231
|
} | {
|
|
235
232
|
readonly _tag: "Live";
|
|
236
|
-
} | {
|
|
237
|
-
readonly _tag: "Started";
|
|
238
|
-
} | {
|
|
239
|
-
readonly _tag: "Stopped";
|
|
240
233
|
}, never, never, never, void, {
|
|
241
234
|
stream: ManagedResource.Entry<{
|
|
242
235
|
readonly status: "denied" | "idle" | "live" | "requesting";
|
|
243
236
|
readonly lastError: string | null;
|
|
244
237
|
}, {
|
|
238
|
+
readonly _tag: "Started";
|
|
239
|
+
} | {
|
|
240
|
+
readonly _tag: "Stopped";
|
|
241
|
+
} | {
|
|
245
242
|
readonly _tag: "Denied";
|
|
246
243
|
} | {
|
|
247
244
|
readonly _tag: "Ended";
|
|
@@ -250,10 +247,6 @@ export declare const mediaStream: <const Name extends string>(config: {
|
|
|
250
247
|
readonly message: string;
|
|
251
248
|
} | {
|
|
252
249
|
readonly _tag: "Live";
|
|
253
|
-
} | {
|
|
254
|
-
readonly _tag: "Started";
|
|
255
|
-
} | {
|
|
256
|
-
readonly _tag: "Stopped";
|
|
257
250
|
}, Option.Option<{
|
|
258
251
|
readonly audio: boolean;
|
|
259
252
|
readonly video: boolean;
|
|
@@ -261,8 +254,6 @@ export declare const mediaStream: <const Name extends string>(config: {
|
|
|
261
254
|
readonly _tag: "Live";
|
|
262
255
|
}>;
|
|
263
256
|
}, {}>;
|
|
264
|
-
//#endregion
|
|
265
|
-
//#region src/device/permissions.d.ts
|
|
266
257
|
export declare const PermissionState: Schema.Literals<readonly ["granted", "denied", "prompt"]>;
|
|
267
258
|
export type PermissionState = typeof PermissionState.Type;
|
|
268
259
|
export declare const PermissionsModel: Schema.Struct<{
|
|
@@ -324,11 +315,11 @@ export declare const permissions: <const Name extends string>(config: {
|
|
|
324
315
|
};
|
|
325
316
|
readonly lastError: string | null;
|
|
326
317
|
}, {
|
|
318
|
+
readonly _tag: "Cleared";
|
|
319
|
+
} | {
|
|
327
320
|
readonly _tag: "Changed";
|
|
328
321
|
readonly name: string;
|
|
329
322
|
readonly state: "denied" | "granted" | "prompt";
|
|
330
|
-
} | {
|
|
331
|
-
readonly _tag: "Cleared";
|
|
332
323
|
} | {
|
|
333
324
|
readonly _tag: "Failed";
|
|
334
325
|
readonly message: string;
|
|
@@ -340,6 +331,5 @@ export declare const permissions: <const Name extends string>(config: {
|
|
|
340
331
|
}, never, never, ManagedResource.ManagedResourceService<"permissions">, void, Readonly<{
|
|
341
332
|
watch: ManagedResource.Entry<PermissionsModel, PermissionsMessage, Option.Option<ReadonlyArray<string>>, Acquired, WatchService, (acquired: Acquired) => PermissionsMessage>;
|
|
342
333
|
}>, {}>;
|
|
343
|
-
//#endregion
|
|
344
334
|
export {};
|
|
345
335
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/device/fullscreen.ts","../../src/device/geolocation.ts","../../src/device/media-devices.ts","../../src/device/media-stream.ts","../../src/device/permissions.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/device/fullscreen.ts","../../src/device/geolocation.ts","../../src/device/media-devices.ts","../../src/device/media-stream.ts","../../src/device/permissions.ts"],"mappings":";;;;qBAWa,6CAAiB;;IACjB,QAAM,OAAA;;;;;IAGP,SAAO,OAAA;;;YAEP,2BAA2B,kBAAkB;;;;;;;qBAW5C,kBAAe,SAAa,YAAU,QAAQ;;qBA0B9C,sBAAqB,QAAQ;;;;;qBAgC7B,yBAAwB,OAAO,OAAO;qBC/EtC,aAAW,OAAA;;;;;YAKZ,qBAAqB,YAAY;qBAEhC,kBAAgB,OAAA;;;;;;;;;YAKjB,0BAA0B,iBAAiB;qBAE1C,8CAAkB;;IAE3B,UAAQ,OAAA;IACR,WAAS,OAAA;IACT,UAAQ,OAAA;;;;IAGA,SAAO,OAAA;;;YAEP,4BAA4B,mBAAmB;;;;;;;qBAyD9C,aAAW,OAAA;;;;;;;;;;;;;;;;;;;qBChFX,aAAW,OAAA;;;;;;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BAAA;;YAGN,eAAe,gBAAgB,iBAAiB;;;;;;;;;qBA+B/C,oBAAqB,qBAAmB;WAC1C,MAAM;;WAEN,WAAW,WAAW,cAAc;MAC9C,OAAA,OAAA;WAYqB,OAAA;;;;;;;;;;;;;;;;;;;;;EA5Cb,OAAA,gBAAgB,MACrB,kBACA,oBACA,OAAO,OAAO,wBACd,UACA,eACC,UAAU,aAAa"}
|
package/dist/device/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { i as unlessSame } from "../internal-
|
|
1
|
+
import { i as unlessSame } from "../internal-C4gHodLc.mjs";
|
|
2
2
|
import { Effect, Option, Queue, Schema, Stream } from "effect";
|
|
3
3
|
import { defineMessageUnion } from "foldkit/message";
|
|
4
4
|
import * as Subscription from "foldkit/subscription";
|
|
5
5
|
import { Bundle } from "foldkit-bundle";
|
|
6
6
|
import * as ManagedResource from "foldkit/managedResource";
|
|
7
|
-
|
|
7
|
+
// src/device/fullscreen.ts
|
|
8
8
|
/**
|
|
9
9
|
* Fullscreen as Commands plus an entry — not a bundle, because the document
|
|
10
10
|
* owns the state: `document.fullscreenElement` is the fact, and the entry
|
|
@@ -68,8 +68,7 @@ const fullscreenChanges = () => {
|
|
|
68
68
|
const isActive = () => document.fullscreenElement !== null && document.fullscreenElement !== void 0;
|
|
69
69
|
return Stream.concat(Stream.make(FullscreenMessage.Changed({ active: isActive() })), Stream.fromEventListener(document, "fullscreenchange").pipe(Stream.map(() => FullscreenMessage.Changed({ active: isActive() }))));
|
|
70
70
|
};
|
|
71
|
-
|
|
72
|
-
//#region src/device/geolocation.ts
|
|
71
|
+
// src/device/geolocation.ts
|
|
73
72
|
const Coordinates = Schema.Struct({
|
|
74
73
|
latitude: Schema.Number,
|
|
75
74
|
longitude: Schema.Number,
|
|
@@ -148,8 +147,7 @@ const Geolocation = Bundle.make("Geolocation", {
|
|
|
148
147
|
}),
|
|
149
148
|
subscriptions: () => Subscription.make()(() => ({ watch: Subscription.persistentEntry(watchStream()) }))
|
|
150
149
|
});
|
|
151
|
-
|
|
152
|
-
//#region src/device/media-devices.ts
|
|
150
|
+
// src/device/media-devices.ts
|
|
153
151
|
const MediaDevice = Schema.Struct({
|
|
154
152
|
deviceId: Schema.String,
|
|
155
153
|
groupId: Schema.String,
|
|
@@ -258,8 +256,7 @@ const mediaDevices = (config) => {
|
|
|
258
256
|
subscriptions: () => Subscription.make()(() => ({ changes: Subscription.persistentEntry(changedStream()) }))
|
|
259
257
|
});
|
|
260
258
|
};
|
|
261
|
-
|
|
262
|
-
//#region src/device/media-stream.ts
|
|
259
|
+
// src/device/media-stream.ts
|
|
263
260
|
const MediaStreamModel = Schema.Struct({
|
|
264
261
|
status: Schema.Literals([
|
|
265
262
|
"idle",
|
|
@@ -357,8 +354,7 @@ const mediaStream = (config) => {
|
|
|
357
354
|
}) }))
|
|
358
355
|
});
|
|
359
356
|
};
|
|
360
|
-
|
|
361
|
-
//#region src/device/permissions.ts
|
|
357
|
+
// src/device/permissions.ts
|
|
362
358
|
const PermissionState = Schema.Literals([
|
|
363
359
|
"granted",
|
|
364
360
|
"denied",
|
|
@@ -492,7 +488,6 @@ const permissions = (config) => {
|
|
|
492
488
|
}))) }))
|
|
493
489
|
});
|
|
494
490
|
};
|
|
495
|
-
//#endregion
|
|
496
491
|
export { Coordinates, FullscreenMessage, Geolocation, GeolocationMessage, GeolocationModel, LiveStream, MediaDevice, MediaDevicesMessage, MediaDevicesModel, MediaStreamMessage, MediaStreamModel, PermissionState, PermissionsMessage, PermissionsModel, Watch, enterFullscreen, exitFullscreen, fullscreenChanges, mediaDevices, mediaStream, permissions };
|
|
497
492
|
|
|
498
493
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["failMessage","failMessage","isDenied","failMessage"],"sources":["../../src/device/fullscreen.ts","../../src/device/geolocation.ts","../../src/device/media-devices.ts","../../src/device/media-stream.ts","../../src/device/permissions.ts"],"sourcesContent":["/**\n * Fullscreen as Commands plus an entry — not a bundle, because the document\n * owns the state: `document.fullscreenElement` is the fact, and the entry\n * reports it as `Changed`. Commands yield `Entered`/`Exited` on success and\n * `Failed` otherwise (rejected request, missing API), so `update` handles\n * both outcomes as Messages.\n */\nimport { Effect, Schema, Stream } from 'effect'\nimport type { Command } from 'foldkit/command'\nimport { defineMessageUnion } from 'foldkit/message'\n\nexport const FullscreenMessage = defineMessageUnion({\n Changed: { active: Schema.Boolean },\n Entered: {},\n Exited: {},\n Failed: { message: Schema.String },\n})\nexport type FullscreenMessage = typeof FullscreenMessage.Type\n\nconst failMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error)\n\n/**\n * Requests fullscreen for an element. The capability is feature-checked on\n * the element itself (SVG and HTML elements both qualify), falling back to\n * the legacy `webkit` prefix; a platform with neither yields `Failed`\n * instead of throwing.\n */\nexport const enterFullscreen = (element: Element): Command<FullscreenMessage, never, never> => ({\n name: 'Fullscreen.enter',\n args: {},\n effect: Effect.matchEffect(\n Effect.tryPromise({\n try: () => {\n const requestable = element as unknown as {\n readonly requestFullscreen?: unknown\n readonly webkitRequestFullscreen?: unknown\n }\n const request = requestable.requestFullscreen ?? requestable.webkitRequestFullscreen\n if (typeof request !== 'function') {\n throw new Error('fullscreen is unavailable')\n }\n return (request as () => Promise<void>).call(element)\n },\n catch: (error: unknown) => error,\n }),\n {\n onFailure: error => Effect.succeed(FullscreenMessage.Failed({ message: failMessage(error) })),\n onSuccess: () => Effect.succeed(FullscreenMessage.Entered()),\n },\n ),\n})\n\n/** Leaves fullscreen, with the same legacy fallback. Without a document API it yields `Failed`, not a throw. */\nexport const exitFullscreen = (): Command<FullscreenMessage, never, never> => ({\n name: 'Fullscreen.exit',\n args: {},\n effect: Effect.matchEffect(\n Effect.tryPromise({\n try: () => {\n if (typeof document === 'undefined') {\n throw new Error('fullscreen is unavailable')\n }\n const api = document as unknown as {\n readonly exitFullscreen?: unknown\n readonly webkitExitFullscreen?: unknown\n }\n const exit = api.exitFullscreen ?? api.webkitExitFullscreen\n if (typeof exit !== 'function') {\n throw new Error('fullscreen is unavailable')\n }\n return (exit as () => Promise<void>).call(document)\n },\n catch: (error: unknown) => error,\n }),\n {\n onFailure: error => Effect.succeed(FullscreenMessage.Failed({ message: failMessage(error) })),\n onSuccess: () => Effect.succeed(FullscreenMessage.Exited()),\n },\n ),\n})\n\n/**\n * `Changed` whenever fullscreen state flips, starting with the current\n * answer. Without a document the stream is empty instead of throwing.\n */\nexport const fullscreenChanges = (): Stream.Stream<FullscreenMessage> => {\n if (typeof document === 'undefined' || typeof document.addEventListener !== 'function') {\n return Stream.empty\n }\n // Incomplete DOMs leave fullscreenElement undefined instead of null.\n const isActive = (): boolean =>\n document.fullscreenElement !== null && document.fullscreenElement !== undefined\n return Stream.concat(\n Stream.make(FullscreenMessage.Changed({ active: isActive() })),\n Stream.fromEventListener(document, 'fullscreenchange').pipe(\n Stream.map(() => FullscreenMessage.Changed({ active: isActive() })),\n ),\n )\n}\n","import { Effect, Queue, Schema, Stream } from 'effect'\nimport { defineMessageUnion } from 'foldkit/message'\nimport * as Subscription from 'foldkit/subscription'\nimport type * as Update from 'foldkit/update'\nimport { Bundle } from 'foldkit-bundle'\nimport { unlessSame } from '../internal.js'\n\nexport const Coordinates = Schema.Struct({\n latitude: Schema.Number,\n longitude: Schema.Number,\n accuracy: Schema.Number,\n})\nexport type Coordinates = typeof Coordinates.Type\n\nexport const GeolocationModel = Schema.Struct({\n status: Schema.Literals(['unknown', 'ready', 'denied']),\n coords: Schema.NullOr(Coordinates),\n lastError: Schema.NullOr(Schema.String),\n})\nexport type GeolocationModel = typeof GeolocationModel.Type\n\nexport const GeolocationMessage = defineMessageUnion({\n Located: {\n latitude: Schema.Number,\n longitude: Schema.Number,\n accuracy: Schema.Number,\n },\n Denied: {},\n Failed: { message: Schema.String },\n})\nexport type GeolocationMessage = typeof GeolocationMessage.Type\n\ntype PositionCallback = (position: {\n readonly coords: {\n readonly latitude: number\n readonly longitude: number\n readonly accuracy: number\n }\n}) => void\ntype ErrorCallback = (error: { readonly code: number; readonly message: string }) => void\n\nconst watchStream = (): Stream.Stream<GeolocationMessage> => {\n if (\n typeof navigator === 'undefined' ||\n typeof navigator.geolocation?.watchPosition !== 'function'\n ) {\n return Stream.empty\n }\n const geolocation = navigator.geolocation\n return Stream.unwrap(\n Effect.gen(function* () {\n const queue = yield* Queue.unbounded<GeolocationMessage>()\n const onLocated: PositionCallback = position => {\n Effect.runFork(\n Queue.offer(\n queue,\n GeolocationMessage.Located({\n latitude: position.coords.latitude,\n longitude: position.coords.longitude,\n accuracy: position.coords.accuracy,\n }),\n ),\n )\n }\n const onError: ErrorCallback = error => {\n Effect.runFork(\n Queue.offer(\n queue,\n error.code === 1\n ? GeolocationMessage.Denied()\n : GeolocationMessage.Failed({ message: error.message }),\n ),\n )\n }\n const watchId = geolocation.watchPosition(onLocated, onError)\n yield* Effect.addFinalizer(() => Effect.sync(() => geolocation.clearWatch(watchId)))\n return Stream.fromQueue(queue)\n }),\n )\n}\n\n/**\n * Geolocation as a bundle: the device position in the Model, watched while\n * placed. Permission denial is its own status (actionable UI); transient\n * failures keep the last fix and note the error. No geolocation API yields\n * an empty stream instead of throwing.\n */\nexport const Geolocation = Bundle.make<\n 'Geolocation',\n GeolocationModel,\n GeolocationMessage,\n void,\n never,\n never,\n never,\n void,\n {},\n {}\n>('Geolocation', {\n Model: GeolocationModel,\n Message: GeolocationMessage,\n init: () => ({ model: { status: 'unknown', coords: null, lastError: null } }),\n update: (model, message) =>\n GeolocationMessage.match<\n Update.ReturnWithOutMessage<GeolocationModel, GeolocationMessage, never>\n >(message, {\n // A watch repeats a fix that has not moved.\n Located: ({ latitude, longitude, accuracy }) =>\n model.status === 'ready' &&\n model.coords !== null &&\n model.coords.latitude === latitude &&\n model.coords.longitude === longitude &&\n model.coords.accuracy === accuracy\n ? { model }\n : {\n model: {\n ...model,\n status: 'ready' as const,\n coords: { latitude, longitude, accuracy },\n },\n },\n Denied: () => ({ model: unlessSame(model, { ...model, status: 'denied' }) }),\n Failed: ({ message }) => ({ model: unlessSame(model, { ...model, lastError: message }) }),\n }),\n subscriptions: (): Subscription.Subscriptions<GeolocationModel, GeolocationMessage> =>\n Subscription.make<GeolocationModel, GeolocationMessage>()(() => ({\n watch: Subscription.persistentEntry(watchStream()),\n })),\n})\n","import { Effect, Schema, Stream } from 'effect'\nimport { defineMessageUnion } from 'foldkit/message'\nimport * as Subscription from 'foldkit/subscription'\nimport type * as Update from 'foldkit/update'\nimport { Bundle } from 'foldkit-bundle'\nimport { unlessSame } from '../internal.js'\n\nexport const MediaDevice = Schema.Struct({\n deviceId: Schema.String,\n groupId: Schema.String,\n kind: Schema.Literals(['audioinput', 'audiooutput', 'videoinput']),\n label: Schema.String,\n})\nexport type MediaDevice = typeof MediaDevice.Type\n\nexport const MediaDevicesModel = Schema.Struct({\n status: Schema.Literals(['unknown', 'ready', 'denied']),\n devices: Schema.Array(MediaDevice),\n lastError: Schema.NullOr(Schema.String),\n})\nexport type MediaDevicesModel = typeof MediaDevicesModel.Type\n\nexport const MediaDevicesMessage = defineMessageUnion({\n Scan: {},\n DevicesChanged: {},\n Refreshed: { devices: Schema.Array(MediaDevice) },\n Denied: {},\n Failed: { message: Schema.String },\n})\nexport type MediaDevicesMessage = typeof MediaDevicesMessage.Type\n\nconst sameDevices = (a: ReadonlyArray<MediaDevice>, b: ReadonlyArray<MediaDevice>): boolean =>\n a.length === b.length &&\n a.every(\n (device, index) =>\n device.deviceId === b[index]!.deviceId &&\n device.groupId === b[index]!.groupId &&\n device.kind === b[index]!.kind &&\n device.label === b[index]!.label,\n )\n\n/** The slice of MediaDevices the bundle needs; satisfied by the platform object. */\nexport interface MediaDevicesHandle {\n enumerateDevices(): Promise<\n ReadonlyArray<{\n readonly deviceId: string\n readonly groupId: string\n readonly kind: string\n readonly label: string\n }>\n >\n addEventListener(type: string, listener: () => void): void\n removeEventListener(type: string, listener: () => void): void\n}\n\nconst failMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error)\n\nconst isDenied = (error: unknown): boolean =>\n typeof (error as { readonly name?: unknown } | null)?.name === 'string' &&\n ['NotAllowedError', 'SecurityError'].includes((error as { readonly name: string }).name)\n\n/**\n * Media devices as a bundle factory: the enumerated device list in the\n * Model, scanned on placement and re-scanned on every `devicechange`.\n * Denial lands as `denied` while keeping the last list (actionable UI over\n * stale data, like Geolocation's last fix); any other failure keeps the\n * list and notes the error. No media-devices API yields an empty stream\n * and a `Failed` scan instead of throwing.\n */\nexport const mediaDevices = <const Name extends string>(config: {\n readonly name: Name\n /** Read lazily so tests can substitute a double, like the SSE bundle. */\n readonly create?: ((navigator: Navigator) => MediaDevicesHandle | null) | undefined\n}) => {\n const handle = (): MediaDevicesHandle | null => {\n if (typeof navigator === 'undefined') return null\n if (config.create !== undefined) return config.create(navigator)\n const devices = navigator.mediaDevices as unknown as MediaDevicesHandle | undefined\n return devices ?? null\n }\n\n const scanEffect = Effect.matchEffect(\n Effect.tryPromise({\n try: async () => {\n const devices = handle()\n if (devices === null) throw new Error('media devices are unavailable')\n const listed = await devices.enumerateDevices()\n // The platform constrains kind to three values; anything else is a\n // boundary violation, so it fails the scan instead of entering the Model.\n return listed.map(item => {\n if (\n item.kind !== 'audioinput' &&\n item.kind !== 'audiooutput' &&\n item.kind !== 'videoinput'\n ) {\n throw new Error(`unknown device kind: ${item.kind}`)\n }\n // Guarded by the check above: only the three platform kinds reach here.\n return {\n deviceId: item.deviceId,\n groupId: item.groupId,\n kind: item.kind as MediaDevice['kind'],\n label: item.label,\n }\n })\n },\n catch: (error: unknown) => error,\n }),\n {\n onFailure: error =>\n Effect.succeed(\n isDenied(error)\n ? MediaDevicesMessage.Denied()\n : MediaDevicesMessage.Failed({ message: failMessage(error) }),\n ),\n onSuccess: devices =>\n Effect.succeed(MediaDevicesMessage.Refreshed({ devices: [...devices] })),\n },\n )\n\n const scan = () => ({ name: `${config.name}.scan`, effect: scanEffect })\n\n const changedStream = (): Stream.Stream<MediaDevicesMessage> => {\n const devices = handle()\n if (devices === null) return Stream.empty\n // The handle carries only the slice the bundle needs, not the full\n // EventTarget surface, so the listener attaches through a cast.\n return Stream.fromEventListener(devices as unknown as EventTarget, 'devicechange').pipe(\n Stream.map(() => MediaDevicesMessage.DevicesChanged()),\n )\n }\n\n return Bundle.make<Name, MediaDevicesModel, MediaDevicesMessage>(config.name, {\n Model: MediaDevicesModel,\n Message: MediaDevicesMessage,\n init: () => ({\n model: { status: 'unknown', devices: [], lastError: null },\n commands: [scan()],\n }),\n update: (model, message) =>\n MediaDevicesMessage.match<\n Update.ReturnWithOutMessage<MediaDevicesModel, MediaDevicesMessage, never>\n >(message, {\n Scan: () => ({ model, commands: [scan()] }),\n DevicesChanged: () => ({ model, commands: [scan()] }),\n // One plug-in fires several `devicechange`s, and each rescan finds the same list.\n Refreshed: ({ devices }) =>\n model.status === 'ready' && sameDevices(model.devices, devices)\n ? { model }\n : { model: { ...model, status: 'ready' as const, devices } },\n Denied: () => ({ model: unlessSame(model, { ...model, status: 'denied' }) }),\n Failed: ({ message }) => ({ model: unlessSame(model, { ...model, lastError: message }) }),\n }),\n subscriptions: (): Subscription.Subscriptions<MediaDevicesModel, MediaDevicesMessage> =>\n Subscription.make<MediaDevicesModel, MediaDevicesMessage>()(() => ({\n changes: Subscription.persistentEntry(changedStream()),\n })),\n })\n}\n","import { Effect, Option, Schema } from 'effect'\nimport { defineMessageUnion } from 'foldkit/message'\nimport * as ManagedResource from 'foldkit/managedResource'\nimport type * as Update from 'foldkit/update'\nimport { Bundle } from 'foldkit-bundle'\nimport { unlessSame } from '../internal.js'\n\nexport const MediaStreamModel = Schema.Struct({\n status: Schema.Literals(['idle', 'requesting', 'live', 'denied']),\n lastError: Schema.NullOr(Schema.String),\n})\nexport type MediaStreamModel = typeof MediaStreamModel.Type\n\nexport const MediaStreamMessage = defineMessageUnion({\n Started: {},\n Stopped: {},\n Live: {},\n Ended: {},\n Denied: {},\n Failed: { message: Schema.String },\n})\nexport type MediaStreamMessage = typeof MediaStreamMessage.Type\n\n/** A single media track: stopped on release. */\nexport interface MediaTrackHandle {\n stop(): void\n}\n\n/** The live stream: its tracks stop on release. */\nexport interface MediaStreamHandle {\n getTracks(): ReadonlyArray<MediaTrackHandle>\n}\n\n/** Which tracks `mediaStream` asks `getUserMedia` for. */\nexport interface MediaStreamConstraints {\n readonly audio: boolean\n readonly video: boolean\n}\n\n/** The live stream, for commands that attach it to an element. One assembly holds one. */\nexport const LiveStream = ManagedResource.tag<MediaStreamHandle>()('media-stream')\n\n/** The stream service a placed camera requires. */\nexport type LiveStreamService = ManagedResource.ServiceOf<typeof LiveStream>\n\ntype StreamResources = Readonly<{\n stream: ManagedResource.Entry<\n MediaStreamModel,\n MediaStreamMessage,\n Option.Option<MediaStreamConstraints>,\n MediaStreamHandle,\n LiveStreamService,\n () => MediaStreamMessage\n >\n}>\n\nconst failMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error)\n\nconst isDenied = (error: unknown): boolean =>\n typeof (error as { readonly name?: unknown } | null)?.name === 'string' &&\n ['NotAllowedError', 'SecurityError'].includes((error as { readonly name: string }).name)\n\n/**\n * A camera/mic stream as a bundle factory: one live MediaStream held in a\n * Managed Resource while the Model asks for it. `Started` requests,\n * `Stopped` releases; denial parks at `denied` (actionable UI), any other\n * acquire failure parks at `idle` with the error noted — both clear\n * requirements, so a failing device never spins an acquire loop. Release\n * stops every track. No media-devices API fails the acquire instead of\n * throwing.\n */\nexport const mediaStream = <const Name extends string>(config: {\n readonly name: Name\n /** Read lazily so tests can substitute a double, like the SSE bundle. */\n readonly request?:\n | ((constraints: MediaStreamConstraints) => Promise<MediaStreamHandle>)\n | undefined\n}) => {\n const request = (constraints: MediaStreamConstraints): Promise<MediaStreamHandle> => {\n if (config.request !== undefined) return config.request(constraints)\n if (\n typeof navigator === 'undefined' ||\n typeof navigator.mediaDevices?.getUserMedia !== 'function'\n ) {\n return Promise.reject(new Error('media devices are unavailable'))\n }\n return navigator.mediaDevices.getUserMedia(constraints)\n }\n\n return Bundle.make(config.name, {\n Model: MediaStreamModel,\n Message: MediaStreamMessage,\n args: Schema.Struct({ audio: Schema.Boolean, video: Schema.Boolean }),\n init: () => ({ model: { status: 'idle' as const, lastError: null } }),\n update: (model, message) =>\n MediaStreamMessage.match<\n Update.ReturnWithOutMessage<MediaStreamModel, MediaStreamMessage, never>\n >(message, {\n // Starting a live stream would wait at `requesting` for an acquire\n // that never comes: the requirements are the same.\n Started: () =>\n model.status === 'requesting' || model.status === 'live'\n ? { model }\n : { model: { ...model, status: 'requesting' as const } },\n Stopped: () => ({ model: unlessSame(model, { ...model, status: 'idle' }) }),\n Live: () => ({ model: unlessSame(model, { ...model, status: 'live', lastError: null }) }),\n // Stopping releases the stream, whose release reports it ended.\n Ended: () => ({ model: unlessSame(model, { ...model, status: 'idle' }) }),\n Denied: () => ({ model: unlessSame(model, { ...model, status: 'denied' }) }),\n Failed: ({ message }) => ({\n model: unlessSame(model, { ...model, status: 'idle', lastError: message }),\n }),\n }),\n resources: args =>\n ManagedResource.make<MediaStreamModel, MediaStreamMessage>()(entry => ({\n stream: entry(\n Schema.Option(Schema.Struct({ audio: Schema.Boolean, video: Schema.Boolean })),\n {\n resource: LiveStream,\n modelToMaybeRequirements: model =>\n model.status === 'requesting' || model.status === 'live'\n ? Option.some({ audio: args.audio, video: args.video })\n : Option.none(),\n acquire: (constraints: MediaStreamConstraints) =>\n Effect.tryPromise({\n try: () => request(constraints),\n catch: (error: unknown) => error,\n }),\n onAcquired: () => MediaStreamMessage.Live(),\n onReleased: () => MediaStreamMessage.Ended(),\n onAcquireError: error =>\n isDenied(error)\n ? MediaStreamMessage.Denied()\n : MediaStreamMessage.Failed({ message: failMessage(error) }),\n release: stream =>\n Effect.sync(() => {\n for (const track of stream.getTracks()) track.stop()\n }),\n },\n ),\n })),\n })\n}\n","import { Effect, Option, Queue, Schema, Stream } from 'effect'\nimport { defineMessageUnion } from 'foldkit/message'\nimport * as ManagedResource from 'foldkit/managedResource'\nimport * as Subscription from 'foldkit/subscription'\nimport type * as Update from 'foldkit/update'\nimport { Bundle } from 'foldkit-bundle'\nimport { unlessSame } from '../internal.js'\n\nexport const PermissionState = Schema.Literals(['granted', 'denied', 'prompt'])\nexport type PermissionState = typeof PermissionState.Type\n\nexport const PermissionsModel = Schema.Struct({\n states: Schema.Record(Schema.String, PermissionState),\n lastError: Schema.NullOr(Schema.String),\n})\nexport type PermissionsModel = typeof PermissionsModel.Type\n\nexport const PermissionsMessage = defineMessageUnion({\n Snapshot: { states: Schema.Record(Schema.String, PermissionState) },\n Changed: { name: Schema.String, state: PermissionState },\n Cleared: {},\n Failed: { message: Schema.String },\n})\nexport type PermissionsMessage = typeof PermissionsMessage.Type\n\n/** A queried permission status; `onchange` fires while watched. */\nexport interface PermissionStatusHandle {\n readonly state: string\n onchange: (() => void) | null\n}\n\n/** The slice of the Permissions API the bundle needs. */\nexport interface PermissionsHandle {\n query(descriptor: { readonly name: string }): Promise<PermissionStatusHandle>\n}\n\ninterface Acquired {\n readonly statuses: ReadonlyMap<string, PermissionStatusHandle>\n readonly snapshot: Readonly<Record<string, PermissionState>>\n readonly events: Queue.Queue<PermissionsMessage>\n}\n\n/** The watched statuses, for the changes subscription. One assembly holds one. */\nexport const Watch = ManagedResource.tag<Acquired>()('permissions')\n\n/** The watch service a placed Permissions bundle requires. */\nexport type WatchService = ManagedResource.ServiceOf<typeof Watch>\n\ntype WatchResources = Readonly<{\n watch: ManagedResource.Entry<\n PermissionsModel,\n PermissionsMessage,\n Option.Option<ReadonlyArray<string>>,\n Acquired,\n WatchService,\n (acquired: Acquired) => PermissionsMessage\n >\n}>\n\nconst failMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error)\n\nconst readState = (state: string, name: string): PermissionState => {\n if (state !== 'granted' && state !== 'denied' && state !== 'prompt') {\n throw new Error(`unknown permission state for ${name}: ${state}`)\n }\n return state\n}\n\n/**\n * Permission states as a bundle factory: queried on placement, kept current\n * by each status object's `onchange`. A resource holds the status objects\n * (they cannot live in the Model); its queue feeds the subscription, and\n * release detaches every handler. An unknown permission name fails the\n * acquire; an unknown state string fails it too — both become `Failed`,\n * never Model facts.\n */\nexport const permissions = <const Name extends string>(config: {\n readonly name: Name\n /** Read lazily so tests can substitute a double, like the SSE bundle. */\n readonly create?: ((navigator: Navigator) => PermissionsHandle | null) | undefined\n}) => {\n const handle = (): PermissionsHandle | null => {\n if (typeof navigator === 'undefined') return null\n if (config.create !== undefined) return config.create(navigator)\n const api = navigator.permissions as unknown as PermissionsHandle | undefined\n return api ?? null\n }\n\n return Bundle.make<\n Name,\n PermissionsModel,\n PermissionsMessage,\n { readonly names: ReadonlyArray<string> },\n never,\n never,\n WatchService,\n void,\n WatchResources,\n {}\n >(config.name, {\n Model: PermissionsModel,\n Message: PermissionsMessage,\n args: Schema.Struct({ names: Schema.Array(Schema.String) }),\n init: () => ({ model: { states: {}, lastError: null } }),\n update: (model, message) =>\n PermissionsMessage.match<\n Update.ReturnWithOutMessage<PermissionsModel, PermissionsMessage, never>\n >(message, {\n Snapshot: ({ states }) => {\n const next = unlessSame(model.states, { ...states })\n return next === model.states ? { model } : { model: { ...model, states: next } }\n },\n Changed: ({ name, state }) =>\n Object.hasOwn(model.states, name) && model.states[name] === state\n ? { model }\n : { model: { ...model, states: { ...model.states, [name]: state } } },\n Cleared: () =>\n Object.keys(model.states).length === 0 ? { model } : { model: { ...model, states: {} } },\n Failed: ({ message }) => ({ model: unlessSame(model, { ...model, lastError: message }) }),\n }),\n resources: args => {\n const names = Option.some([...new Set(args.names)])\n return ManagedResource.make<PermissionsModel, PermissionsMessage>()(entry => ({\n watch: entry(Schema.Option(Schema.Array(Schema.String)), {\n resource: Watch,\n modelToMaybeRequirements: () => names,\n acquire: (names: ReadonlyArray<string>) =>\n Effect.gen(function* () {\n const api = handle()\n if (api === null) throw new Error('permissions are unavailable')\n const events = yield* Queue.unbounded<PermissionsMessage>()\n const statuses = new Map<string, PermissionStatusHandle>()\n // Offers run in arrival order; see the WebSocket bundle.\n let tail: Promise<void> = Promise.resolve()\n const offer = (message: PermissionsMessage) => {\n const run = () =>\n Effect.runPromise(Queue.offer(events, message)).then(\n () => undefined,\n () => undefined,\n )\n tail = tail.then(run, run)\n }\n // Two phases: query and validate everything first, so a later\n // name failing cannot abandon handlers attached to earlier ones.\n const queried: Array<readonly [string, PermissionStatusHandle, PermissionState]> = []\n for (const name of names) {\n const status = yield* Effect.tryPromise({\n try: () => api.query({ name }),\n catch: (error: unknown) => error,\n })\n queried.push([name, status, readState(status.state, name)] as const)\n }\n const snapshot: Record<string, PermissionState> = {}\n for (const [name, status, state] of queried) {\n status.onchange = () => {\n try {\n offer(\n PermissionsMessage.Changed({ name, state: readState(status.state, name) }),\n )\n } catch {\n // readState evaluates before offer runs, so a state the\n // schema rejects lands here instead of crashing the handler.\n offer(\n PermissionsMessage.Failed({\n message: `unknown permission state for ${name}`,\n }),\n )\n }\n }\n statuses.set(name, status)\n snapshot[name] = state\n }\n return { statuses, snapshot, events }\n }),\n // The snapshot is captured during acquire, so onAcquired cannot\n // throw re-reading a state that changed mid-acquire.\n onAcquired: ({ snapshot }) => PermissionsMessage.Snapshot({ states: { ...snapshot } }),\n onReleased: () => PermissionsMessage.Cleared(),\n onAcquireError: error => PermissionsMessage.Failed({ message: failMessage(error) }),\n release: ({ statuses, events }) =>\n Effect.asVoid(\n Effect.andThen(\n Effect.sync(() => {\n for (const status of statuses.values()) status.onchange = null\n }),\n Queue.shutdown(events),\n ),\n ),\n }),\n }))\n },\n subscriptions: (): Subscription.Subscriptions<\n PermissionsModel,\n PermissionsMessage,\n WatchService\n > =>\n Subscription.make<PermissionsModel, PermissionsMessage, WatchService>()(() => ({\n // No model gate: the queue outlives every state change, and release\n // ends the stream through teardown, not through dependencies.\n changes: Subscription.persistentEntry(\n Stream.unwrap(\n Effect.matchEffect(Watch.get, {\n // Released between placement and attach: end quietly.\n onFailure: () => Effect.succeed(Stream.empty),\n onSuccess: ({ events })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AQ,KAAK;OAAC;OAAM;OAAQ,UAAU,OAAO,OAAO,IAAI;MAAC,CAAU;KACrE;KACA,MAAM,WAA4C,CAAC;KACnD,KAAK,MAAM,CAAC,MAAM,QAAQ,UAAU,SAAS;MAC3C,OAAO,iBAAiB;OACtB,IAAI;QACF,MACE,mBAAmB,QAAQ;SAAE;SAAM,OAAO,UAAU,OAAO,OAAO,IAAI;QAAE,CAAC,CAC3E;OACF,QAAQ;QAGN,MACE,mBAAmB,OAAO,EACxB,SAAS,gCAAgC,OAC3C,CAAC,CACH;OACF;MACF;MACA,SAAS,IAAI,MAAM,MAAM;MACzB,SAAS,QAAQ;KACnB;KACA,OAAO;MAAE;MAAU;MAAU;KAAO;IACtC,CAAC;IAGH,aAAa,EAAE,eAAe,mBAAmB,SAAS,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,CAAC;IACrF,kBAAkB,mBAAmB,QAAQ;IAC7C,iBAAgB,UAAS,mBAAmB,OAAO,EAAE,SAAS,YAAY,KAAK,EAAE,CAAC;IAClF,UAAU,EAAE,UAAU,aACpB,OAAO,OACL,OAAO,QACL,OAAO,WAAW;KAChB,KAAK,MAAM,UAAU,SAAS,OAAO,GAAG,OAAO,WAAW;IAC5D,CAAC,GACD,MAAM,SAAS,MAAM,CACvB,CACF;GACJ,CAAC,EACH,EAAE;EACJ;EACA,qBAKE,aAAa,KAAyD,CAAC,QAAQ,EAG7E,SAAS,aAAa,gBACpB,OAAO,OACL,OAAO,YAAY,MAAM,KAAK;GAE5B,iBAAiB,OAAO,QAAQ,OAAO,KAAK;GAC5C,YAAY,EAAE,aAAa,OAAO,QAAQ,OAAO,UAAU,MAAM,CAAC;EACpE,CAAC,CACH,CACF,EACF,EAAE;CACN,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["failMessage","failMessage","isDenied","failMessage"],"sources":["../../src/device/fullscreen.ts","../../src/device/geolocation.ts","../../src/device/media-devices.ts","../../src/device/media-stream.ts","../../src/device/permissions.ts"],"sourcesContent":["/**\n * Fullscreen as Commands plus an entry — not a bundle, because the document\n * owns the state: `document.fullscreenElement` is the fact, and the entry\n * reports it as `Changed`. Commands yield `Entered`/`Exited` on success and\n * `Failed` otherwise (rejected request, missing API), so `update` handles\n * both outcomes as Messages.\n */\nimport { Effect, Schema, Stream } from 'effect'\nimport type { Command } from 'foldkit/command'\nimport { defineMessageUnion } from 'foldkit/message'\n\nexport const FullscreenMessage = defineMessageUnion({\n Changed: { active: Schema.Boolean },\n Entered: {},\n Exited: {},\n Failed: { message: Schema.String },\n})\nexport type FullscreenMessage = typeof FullscreenMessage.Type\n\nconst failMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error)\n\n/**\n * Requests fullscreen for an element. The capability is feature-checked on\n * the element itself (SVG and HTML elements both qualify), falling back to\n * the legacy `webkit` prefix; a platform with neither yields `Failed`\n * instead of throwing.\n */\nexport const enterFullscreen = (element: Element): Command<FullscreenMessage, never, never> => ({\n name: 'Fullscreen.enter',\n args: {},\n effect: Effect.matchEffect(\n Effect.tryPromise({\n try: () => {\n const requestable = element as unknown as {\n readonly requestFullscreen?: unknown\n readonly webkitRequestFullscreen?: unknown\n }\n const request = requestable.requestFullscreen ?? requestable.webkitRequestFullscreen\n if (typeof request !== 'function') {\n throw new Error('fullscreen is unavailable')\n }\n return (request as () => Promise<void>).call(element)\n },\n catch: (error: unknown) => error,\n }),\n {\n onFailure: error => Effect.succeed(FullscreenMessage.Failed({ message: failMessage(error) })),\n onSuccess: () => Effect.succeed(FullscreenMessage.Entered()),\n },\n ),\n})\n\n/** Leaves fullscreen, with the same legacy fallback. Without a document API it yields `Failed`, not a throw. */\nexport const exitFullscreen = (): Command<FullscreenMessage, never, never> => ({\n name: 'Fullscreen.exit',\n args: {},\n effect: Effect.matchEffect(\n Effect.tryPromise({\n try: () => {\n if (typeof document === 'undefined') {\n throw new Error('fullscreen is unavailable')\n }\n const api = document as unknown as {\n readonly exitFullscreen?: unknown\n readonly webkitExitFullscreen?: unknown\n }\n const exit = api.exitFullscreen ?? api.webkitExitFullscreen\n if (typeof exit !== 'function') {\n throw new Error('fullscreen is unavailable')\n }\n return (exit as () => Promise<void>).call(document)\n },\n catch: (error: unknown) => error,\n }),\n {\n onFailure: error => Effect.succeed(FullscreenMessage.Failed({ message: failMessage(error) })),\n onSuccess: () => Effect.succeed(FullscreenMessage.Exited()),\n },\n ),\n})\n\n/**\n * `Changed` whenever fullscreen state flips, starting with the current\n * answer. Without a document the stream is empty instead of throwing.\n */\nexport const fullscreenChanges = (): Stream.Stream<FullscreenMessage> => {\n if (typeof document === 'undefined' || typeof document.addEventListener !== 'function') {\n return Stream.empty\n }\n // Incomplete DOMs leave fullscreenElement undefined instead of null.\n const isActive = (): boolean =>\n document.fullscreenElement !== null && document.fullscreenElement !== undefined\n return Stream.concat(\n Stream.make(FullscreenMessage.Changed({ active: isActive() })),\n Stream.fromEventListener(document, 'fullscreenchange').pipe(\n Stream.map(() => FullscreenMessage.Changed({ active: isActive() })),\n ),\n )\n}\n","import { Effect, Queue, Schema, Stream } from 'effect'\nimport { defineMessageUnion } from 'foldkit/message'\nimport * as Subscription from 'foldkit/subscription'\nimport type * as Update from 'foldkit/update'\nimport { Bundle } from 'foldkit-bundle'\nimport { unlessSame } from '../internal.js'\n\nexport const Coordinates = Schema.Struct({\n latitude: Schema.Number,\n longitude: Schema.Number,\n accuracy: Schema.Number,\n})\nexport type Coordinates = typeof Coordinates.Type\n\nexport const GeolocationModel = Schema.Struct({\n status: Schema.Literals(['unknown', 'ready', 'denied']),\n coords: Schema.NullOr(Coordinates),\n lastError: Schema.NullOr(Schema.String),\n})\nexport type GeolocationModel = typeof GeolocationModel.Type\n\nexport const GeolocationMessage = defineMessageUnion({\n Located: {\n latitude: Schema.Number,\n longitude: Schema.Number,\n accuracy: Schema.Number,\n },\n Denied: {},\n Failed: { message: Schema.String },\n})\nexport type GeolocationMessage = typeof GeolocationMessage.Type\n\ntype PositionCallback = (position: {\n readonly coords: {\n readonly latitude: number\n readonly longitude: number\n readonly accuracy: number\n }\n}) => void\ntype ErrorCallback = (error: { readonly code: number; readonly message: string }) => void\n\nconst watchStream = (): Stream.Stream<GeolocationMessage> => {\n if (\n typeof navigator === 'undefined' ||\n typeof navigator.geolocation?.watchPosition !== 'function'\n ) {\n return Stream.empty\n }\n const geolocation = navigator.geolocation\n return Stream.unwrap(\n Effect.gen(function* () {\n const queue = yield* Queue.unbounded<GeolocationMessage>()\n const onLocated: PositionCallback = position => {\n Effect.runFork(\n Queue.offer(\n queue,\n GeolocationMessage.Located({\n latitude: position.coords.latitude,\n longitude: position.coords.longitude,\n accuracy: position.coords.accuracy,\n }),\n ),\n )\n }\n const onError: ErrorCallback = error => {\n Effect.runFork(\n Queue.offer(\n queue,\n error.code === 1\n ? GeolocationMessage.Denied()\n : GeolocationMessage.Failed({ message: error.message }),\n ),\n )\n }\n const watchId = geolocation.watchPosition(onLocated, onError)\n yield* Effect.addFinalizer(() => Effect.sync(() => geolocation.clearWatch(watchId)))\n return Stream.fromQueue(queue)\n }),\n )\n}\n\n/**\n * Geolocation as a bundle: the device position in the Model, watched while\n * placed. Permission denial is its own status (actionable UI); transient\n * failures keep the last fix and note the error. No geolocation API yields\n * an empty stream instead of throwing.\n */\nexport const Geolocation = Bundle.make<\n 'Geolocation',\n GeolocationModel,\n GeolocationMessage,\n void,\n never,\n never,\n never,\n void,\n {},\n {}\n>('Geolocation', {\n Model: GeolocationModel,\n Message: GeolocationMessage,\n init: () => ({ model: { status: 'unknown', coords: null, lastError: null } }),\n update: (model, message) =>\n GeolocationMessage.match<\n Update.ReturnWithOutMessage<GeolocationModel, GeolocationMessage, never>\n >(message, {\n // A watch repeats a fix that has not moved.\n Located: ({ latitude, longitude, accuracy }) =>\n model.status === 'ready' &&\n model.coords !== null &&\n model.coords.latitude === latitude &&\n model.coords.longitude === longitude &&\n model.coords.accuracy === accuracy\n ? { model }\n : {\n model: {\n ...model,\n status: 'ready' as const,\n coords: { latitude, longitude, accuracy },\n },\n },\n Denied: () => ({ model: unlessSame(model, { ...model, status: 'denied' }) }),\n Failed: ({ message }) => ({ model: unlessSame(model, { ...model, lastError: message }) }),\n }),\n subscriptions: (): Subscription.Subscriptions<GeolocationModel, GeolocationMessage> =>\n Subscription.make<GeolocationModel, GeolocationMessage>()(() => ({\n watch: Subscription.persistentEntry(watchStream()),\n })),\n})\n","import { Effect, Schema, Stream } from 'effect'\nimport { defineMessageUnion } from 'foldkit/message'\nimport * as Subscription from 'foldkit/subscription'\nimport type * as Update from 'foldkit/update'\nimport { Bundle } from 'foldkit-bundle'\nimport { unlessSame } from '../internal.js'\n\nexport const MediaDevice = Schema.Struct({\n deviceId: Schema.String,\n groupId: Schema.String,\n kind: Schema.Literals(['audioinput', 'audiooutput', 'videoinput']),\n label: Schema.String,\n})\nexport type MediaDevice = typeof MediaDevice.Type\n\nexport const MediaDevicesModel = Schema.Struct({\n status: Schema.Literals(['unknown', 'ready', 'denied']),\n devices: Schema.Array(MediaDevice),\n lastError: Schema.NullOr(Schema.String),\n})\nexport type MediaDevicesModel = typeof MediaDevicesModel.Type\n\nexport const MediaDevicesMessage = defineMessageUnion({\n Scan: {},\n DevicesChanged: {},\n Refreshed: { devices: Schema.Array(MediaDevice) },\n Denied: {},\n Failed: { message: Schema.String },\n})\nexport type MediaDevicesMessage = typeof MediaDevicesMessage.Type\n\nconst sameDevices = (a: ReadonlyArray<MediaDevice>, b: ReadonlyArray<MediaDevice>): boolean =>\n a.length === b.length &&\n a.every(\n (device, index) =>\n device.deviceId === b[index]!.deviceId &&\n device.groupId === b[index]!.groupId &&\n device.kind === b[index]!.kind &&\n device.label === b[index]!.label,\n )\n\n/** The slice of MediaDevices the bundle needs; satisfied by the platform object. */\nexport interface MediaDevicesHandle {\n enumerateDevices(): Promise<\n ReadonlyArray<{\n readonly deviceId: string\n readonly groupId: string\n readonly kind: string\n readonly label: string\n }>\n >\n addEventListener(type: string, listener: () => void): void\n removeEventListener(type: string, listener: () => void): void\n}\n\nconst failMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error)\n\nconst isDenied = (error: unknown): boolean =>\n typeof (error as { readonly name?: unknown } | null)?.name === 'string' &&\n ['NotAllowedError', 'SecurityError'].includes((error as { readonly name: string }).name)\n\n/**\n * Media devices as a bundle factory: the enumerated device list in the\n * Model, scanned on placement and re-scanned on every `devicechange`.\n * Denial lands as `denied` while keeping the last list (actionable UI over\n * stale data, like Geolocation's last fix); any other failure keeps the\n * list and notes the error. No media-devices API yields an empty stream\n * and a `Failed` scan instead of throwing.\n */\nexport const mediaDevices = <const Name extends string>(config: {\n readonly name: Name\n /** Read lazily so tests can substitute a double, like the SSE bundle. */\n readonly create?: ((navigator: Navigator) => MediaDevicesHandle | null) | undefined\n}) => {\n const handle = (): MediaDevicesHandle | null => {\n if (typeof navigator === 'undefined') return null\n if (config.create !== undefined) return config.create(navigator)\n const devices = navigator.mediaDevices as unknown as MediaDevicesHandle | undefined\n return devices ?? null\n }\n\n const scanEffect = Effect.matchEffect(\n Effect.tryPromise({\n try: async () => {\n const devices = handle()\n if (devices === null) throw new Error('media devices are unavailable')\n const listed = await devices.enumerateDevices()\n // The platform constrains kind to three values; anything else is a\n // boundary violation, so it fails the scan instead of entering the Model.\n return listed.map(item => {\n if (\n item.kind !== 'audioinput' &&\n item.kind !== 'audiooutput' &&\n item.kind !== 'videoinput'\n ) {\n throw new Error(`unknown device kind: ${item.kind}`)\n }\n // Guarded by the check above: only the three platform kinds reach here.\n return {\n deviceId: item.deviceId,\n groupId: item.groupId,\n kind: item.kind as MediaDevice['kind'],\n label: item.label,\n }\n })\n },\n catch: (error: unknown) => error,\n }),\n {\n onFailure: error =>\n Effect.succeed(\n isDenied(error)\n ? MediaDevicesMessage.Denied()\n : MediaDevicesMessage.Failed({ message: failMessage(error) }),\n ),\n onSuccess: devices =>\n Effect.succeed(MediaDevicesMessage.Refreshed({ devices: [...devices] })),\n },\n )\n\n const scan = () => ({ name: `${config.name}.scan`, effect: scanEffect })\n\n const changedStream = (): Stream.Stream<MediaDevicesMessage> => {\n const devices = handle()\n if (devices === null) return Stream.empty\n // The handle carries only the slice the bundle needs, not the full\n // EventTarget surface, so the listener attaches through a cast.\n return Stream.fromEventListener(devices as unknown as EventTarget, 'devicechange').pipe(\n Stream.map(() => MediaDevicesMessage.DevicesChanged()),\n )\n }\n\n return Bundle.make<Name, MediaDevicesModel, MediaDevicesMessage>(config.name, {\n Model: MediaDevicesModel,\n Message: MediaDevicesMessage,\n init: () => ({\n model: { status: 'unknown', devices: [], lastError: null },\n commands: [scan()],\n }),\n update: (model, message) =>\n MediaDevicesMessage.match<\n Update.ReturnWithOutMessage<MediaDevicesModel, MediaDevicesMessage, never>\n >(message, {\n Scan: () => ({ model, commands: [scan()] }),\n DevicesChanged: () => ({ model, commands: [scan()] }),\n // One plug-in fires several `devicechange`s, and each rescan finds the same list.\n Refreshed: ({ devices }) =>\n model.status === 'ready' && sameDevices(model.devices, devices)\n ? { model }\n : { model: { ...model, status: 'ready' as const, devices } },\n Denied: () => ({ model: unlessSame(model, { ...model, status: 'denied' }) }),\n Failed: ({ message }) => ({ model: unlessSame(model, { ...model, lastError: message }) }),\n }),\n subscriptions: (): Subscription.Subscriptions<MediaDevicesModel, MediaDevicesMessage> =>\n Subscription.make<MediaDevicesModel, MediaDevicesMessage>()(() => ({\n changes: Subscription.persistentEntry(changedStream()),\n })),\n })\n}\n","import { Effect, Option, Schema } from 'effect'\nimport { defineMessageUnion } from 'foldkit/message'\nimport * as ManagedResource from 'foldkit/managedResource'\nimport type * as Update from 'foldkit/update'\nimport { Bundle } from 'foldkit-bundle'\nimport { unlessSame } from '../internal.js'\n\nexport const MediaStreamModel = Schema.Struct({\n status: Schema.Literals(['idle', 'requesting', 'live', 'denied']),\n lastError: Schema.NullOr(Schema.String),\n})\nexport type MediaStreamModel = typeof MediaStreamModel.Type\n\nexport const MediaStreamMessage = defineMessageUnion({\n Started: {},\n Stopped: {},\n Live: {},\n Ended: {},\n Denied: {},\n Failed: { message: Schema.String },\n})\nexport type MediaStreamMessage = typeof MediaStreamMessage.Type\n\n/** A single media track: stopped on release. */\nexport interface MediaTrackHandle {\n stop(): void\n}\n\n/** The live stream: its tracks stop on release. */\nexport interface MediaStreamHandle {\n getTracks(): ReadonlyArray<MediaTrackHandle>\n}\n\n/** Which tracks `mediaStream` asks `getUserMedia` for. */\nexport interface MediaStreamConstraints {\n readonly audio: boolean\n readonly video: boolean\n}\n\n/** The live stream, for commands that attach it to an element. One assembly holds one. */\nexport const LiveStream = ManagedResource.tag<MediaStreamHandle>()('media-stream')\n\n/** The stream service a placed camera requires. */\nexport type LiveStreamService = ManagedResource.ServiceOf<typeof LiveStream>\n\ntype StreamResources = Readonly<{\n stream: ManagedResource.Entry<\n MediaStreamModel,\n MediaStreamMessage,\n Option.Option<MediaStreamConstraints>,\n MediaStreamHandle,\n LiveStreamService,\n () => MediaStreamMessage\n >\n}>\n\nconst failMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error)\n\nconst isDenied = (error: unknown): boolean =>\n typeof (error as { readonly name?: unknown } | null)?.name === 'string' &&\n ['NotAllowedError', 'SecurityError'].includes((error as { readonly name: string }).name)\n\n/**\n * A camera/mic stream as a bundle factory: one live MediaStream held in a\n * Managed Resource while the Model asks for it. `Started` requests,\n * `Stopped` releases; denial parks at `denied` (actionable UI), any other\n * acquire failure parks at `idle` with the error noted — both clear\n * requirements, so a failing device never spins an acquire loop. Release\n * stops every track. No media-devices API fails the acquire instead of\n * throwing.\n */\nexport const mediaStream = <const Name extends string>(config: {\n readonly name: Name\n /** Read lazily so tests can substitute a double, like the SSE bundle. */\n readonly request?:\n | ((constraints: MediaStreamConstraints) => Promise<MediaStreamHandle>)\n | undefined\n}) => {\n const request = (constraints: MediaStreamConstraints): Promise<MediaStreamHandle> => {\n if (config.request !== undefined) return config.request(constraints)\n if (\n typeof navigator === 'undefined' ||\n typeof navigator.mediaDevices?.getUserMedia !== 'function'\n ) {\n return Promise.reject(new Error('media devices are unavailable'))\n }\n return navigator.mediaDevices.getUserMedia(constraints)\n }\n\n return Bundle.make(config.name, {\n Model: MediaStreamModel,\n Message: MediaStreamMessage,\n args: Schema.Struct({ audio: Schema.Boolean, video: Schema.Boolean }),\n init: () => ({ model: { status: 'idle' as const, lastError: null } }),\n update: (model, message) =>\n MediaStreamMessage.match<\n Update.ReturnWithOutMessage<MediaStreamModel, MediaStreamMessage, never>\n >(message, {\n // Starting a live stream would wait at `requesting` for an acquire\n // that never comes: the requirements are the same.\n Started: () =>\n model.status === 'requesting' || model.status === 'live'\n ? { model }\n : { model: { ...model, status: 'requesting' as const } },\n Stopped: () => ({ model: unlessSame(model, { ...model, status: 'idle' }) }),\n Live: () => ({ model: unlessSame(model, { ...model, status: 'live', lastError: null }) }),\n // Stopping releases the stream, whose release reports it ended.\n Ended: () => ({ model: unlessSame(model, { ...model, status: 'idle' }) }),\n Denied: () => ({ model: unlessSame(model, { ...model, status: 'denied' }) }),\n Failed: ({ message }) => ({\n model: unlessSame(model, { ...model, status: 'idle', lastError: message }),\n }),\n }),\n resources: args =>\n ManagedResource.make<MediaStreamModel, MediaStreamMessage>()(entry => ({\n stream: entry(\n Schema.Option(Schema.Struct({ audio: Schema.Boolean, video: Schema.Boolean })),\n {\n resource: LiveStream,\n modelToMaybeRequirements: model =>\n model.status === 'requesting' || model.status === 'live'\n ? Option.some({ audio: args.audio, video: args.video })\n : Option.none(),\n acquire: (constraints: MediaStreamConstraints) =>\n Effect.tryPromise({\n try: () => request(constraints),\n catch: (error: unknown) => error,\n }),\n onAcquired: () => MediaStreamMessage.Live(),\n onReleased: () => MediaStreamMessage.Ended(),\n onAcquireError: error =>\n isDenied(error)\n ? MediaStreamMessage.Denied()\n : MediaStreamMessage.Failed({ message: failMessage(error) }),\n release: stream =>\n Effect.sync(() => {\n for (const track of stream.getTracks()) track.stop()\n }),\n },\n ),\n })),\n })\n}\n","import { Effect, Option, Queue, Schema, Stream } from 'effect'\nimport { defineMessageUnion } from 'foldkit/message'\nimport * as ManagedResource from 'foldkit/managedResource'\nimport * as Subscription from 'foldkit/subscription'\nimport type * as Update from 'foldkit/update'\nimport { Bundle } from 'foldkit-bundle'\nimport { unlessSame } from '../internal.js'\n\nexport const PermissionState = Schema.Literals(['granted', 'denied', 'prompt'])\nexport type PermissionState = typeof PermissionState.Type\n\nexport const PermissionsModel = Schema.Struct({\n states: Schema.Record(Schema.String, PermissionState),\n lastError: Schema.NullOr(Schema.String),\n})\nexport type PermissionsModel = typeof PermissionsModel.Type\n\nexport const PermissionsMessage = defineMessageUnion({\n Snapshot: { states: Schema.Record(Schema.String, PermissionState) },\n Changed: { name: Schema.String, state: PermissionState },\n Cleared: {},\n Failed: { message: Schema.String },\n})\nexport type PermissionsMessage = typeof PermissionsMessage.Type\n\n/** A queried permission status; `onchange` fires while watched. */\nexport interface PermissionStatusHandle {\n readonly state: string\n onchange: (() => void) | null\n}\n\n/** The slice of the Permissions API the bundle needs. */\nexport interface PermissionsHandle {\n query(descriptor: { readonly name: string }): Promise<PermissionStatusHandle>\n}\n\ninterface Acquired {\n readonly statuses: ReadonlyMap<string, PermissionStatusHandle>\n readonly snapshot: Readonly<Record<string, PermissionState>>\n readonly events: Queue.Queue<PermissionsMessage>\n}\n\n/** The watched statuses, for the changes subscription. One assembly holds one. */\nexport const Watch = ManagedResource.tag<Acquired>()('permissions')\n\n/** The watch service a placed Permissions bundle requires. */\nexport type WatchService = ManagedResource.ServiceOf<typeof Watch>\n\ntype WatchResources = Readonly<{\n watch: ManagedResource.Entry<\n PermissionsModel,\n PermissionsMessage,\n Option.Option<ReadonlyArray<string>>,\n Acquired,\n WatchService,\n (acquired: Acquired) => PermissionsMessage\n >\n}>\n\nconst failMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error)\n\nconst readState = (state: string, name: string): PermissionState => {\n if (state !== 'granted' && state !== 'denied' && state !== 'prompt') {\n throw new Error(`unknown permission state for ${name}: ${state}`)\n }\n return state\n}\n\n/**\n * Permission states as a bundle factory: queried on placement, kept current\n * by each status object's `onchange`. A resource holds the status objects\n * (they cannot live in the Model); its queue feeds the subscription, and\n * release detaches every handler. An unknown permission name fails the\n * acquire; an unknown state string fails it too — both become `Failed`,\n * never Model facts.\n */\nexport const permissions = <const Name extends string>(config: {\n readonly name: Name\n /** Read lazily so tests can substitute a double, like the SSE bundle. */\n readonly create?: ((navigator: Navigator) => PermissionsHandle | null) | undefined\n}) => {\n const handle = (): PermissionsHandle | null => {\n if (typeof navigator === 'undefined') return null\n if (config.create !== undefined) return config.create(navigator)\n const api = navigator.permissions as unknown as PermissionsHandle | undefined\n return api ?? null\n }\n\n return Bundle.make<\n Name,\n PermissionsModel,\n PermissionsMessage,\n { readonly names: ReadonlyArray<string> },\n never,\n never,\n WatchService,\n void,\n WatchResources,\n {}\n >(config.name, {\n Model: PermissionsModel,\n Message: PermissionsMessage,\n args: Schema.Struct({ names: Schema.Array(Schema.String) }),\n init: () => ({ model: { states: {}, lastError: null } }),\n update: (model, message) =>\n PermissionsMessage.match<\n Update.ReturnWithOutMessage<PermissionsModel, PermissionsMessage, never>\n >(message, {\n Snapshot: ({ states }) => {\n const next = unlessSame(model.states, { ...states })\n return next === model.states ? { model } : { model: { ...model, states: next } }\n },\n Changed: ({ name, state }) =>\n Object.hasOwn(model.states, name) && model.states[name] === state\n ? { model }\n : { model: { ...model, states: { ...model.states, [name]: state } } },\n Cleared: () =>\n Object.keys(model.states).length === 0 ? { model } : { model: { ...model, states: {} } },\n Failed: ({ message }) => ({ model: unlessSame(model, { ...model, lastError: message }) }),\n }),\n resources: args => {\n const names = Option.some([...new Set(args.names)])\n return ManagedResource.make<PermissionsModel, PermissionsMessage>()(entry => ({\n watch: entry(Schema.Option(Schema.Array(Schema.String)), {\n resource: Watch,\n modelToMaybeRequirements: () => names,\n acquire: (names: ReadonlyArray<string>) =>\n Effect.gen(function* () {\n const api = handle()\n if (api === null) throw new Error('permissions are unavailable')\n const events = yield* Queue.unbounded<PermissionsMessage>()\n const statuses = new Map<string, PermissionStatusHandle>()\n // Offers run in arrival order; see the WebSocket bundle.\n let tail: Promise<void> = Promise.resolve()\n const offer = (message: PermissionsMessage) => {\n const run = () =>\n Effect.runPromise(Queue.offer(events, message)).then(\n () => undefined,\n () => undefined,\n )\n tail = tail.then(run, run)\n }\n // Two phases: query and validate everything first, so a later\n // name failing cannot abandon handlers attached to earlier ones.\n const queried: Array<readonly [string, PermissionStatusHandle, PermissionState]> = []\n for (const name of names) {\n const status = yield* Effect.tryPromise({\n try: () => api.query({ name }),\n catch: (error: unknown) => error,\n })\n queried.push([name, status, readState(status.state, name)] as const)\n }\n const snapshot: Record<string, PermissionState> = {}\n for (const [name, status, state] of queried) {\n status.onchange = () => {\n try {\n offer(\n PermissionsMessage.Changed({ name, state: readState(status.state, name) }),\n )\n } catch {\n // readState evaluates before offer runs, so a state the\n // schema rejects lands here instead of crashing the handler.\n offer(\n PermissionsMessage.Failed({\n message: `unknown permission state for ${name}`,\n }),\n )\n }\n }\n statuses.set(name, status)\n snapshot[name] = state\n }\n return { statuses, snapshot, events }\n }),\n // The snapshot is captured during acquire, so onAcquired cannot\n // throw re-reading a state that changed mid-acquire.\n onAcquired: ({ snapshot }) => PermissionsMessage.Snapshot({ states: { ...snapshot } }),\n onReleased: () => PermissionsMessage.Cleared(),\n onAcquireError: error => PermissionsMessage.Failed({ message: failMessage(error) }),\n release: ({ statuses, events }) =>\n Effect.asVoid(\n Effect.andThen(\n Effect.sync(() => {\n for (const status of statuses.values()) status.onchange = null\n }),\n Queue.shutdown(events),\n ),\n ),\n }),\n }))\n },\n subscriptions: (): Subscription.Subscriptions<\n PermissionsModel,\n PermissionsMessage,\n WatchService\n > =>\n Subscription.make<PermissionsModel, PermissionsMessage, WatchService>()(() => ({\n // No model gate: the queue outlives every state change, and release\n // ends the stream through teardown, not through dependencies.\n changes: Subscription.persistentEntry(\n Stream.unwrap(\n Effect.matchEffect(Watch.get, {\n // Released between placement and attach: end quietly.\n onFailure: () => Effect.succeed(Stream.empty),\n onS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MACD,QAAQ,KAAK;OAAC;OAAM;OAAQ,UAAU,OAAO,OAAO,IAAI;MAAC,CAAU;KACrE;KACA,MAAM,WAA4C,CAAC;KACnD,KAAK,MAAM,CAAC,MAAM,QAAQ,UAAU,SAAS;MAC3C,OAAO,iBAAiB;OACtB,IAAI;QACF,MACE,mBAAmB,QAAQ;SAAE;SAAM,OAAO,UAAU,OAAO,OAAO,IAAI;QAAE,CAAC,CAC3E;OACF,QAAQ;QAGN,MACE,mBAAmB,OAAO,EACxB,SAAS,gCAAgC,OAC3C,CAAC,CACH;OACF;MACF;MACA,SAAS,IAAI,MAAM,MAAM;MACzB,SAAS,QAAQ;KACnB;KACA,OAAO;MAAE;MAAU;MAAU;KAAO;IACtC,CAAC;IAGH,aAAa,EAAE,eAAe,mBAAmB,SAAS,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,CAAC;IACrF,kBAAkB,mBAAmB,QAAQ;IAC7C,iBAAgB,UAAS,mBAAmB,OAAO,EAAE,SAAS,YAAY,KAAK,EAAE,CAAC;IAClF,UAAU,EAAE,UAAU,aACpB,OAAO,OACL,OAAO,QACL,OAAO,WAAW;KAChB,KAAK,MAAM,UAAU,SAAS,OAAO,GAAG,OAAO,WAAW;IAC5D,CAAC,GACD,MAAM,SAAS,MAAM,CACvB,CACF;GACJ,CAAC,EACH,EAAE;EACJ;EACA,qBAKE,aAAa,KAAyD,CAAC,QAAQ,EAG7E,SAAS,aAAa,gBACpB,OAAO,OACL,OAAO,YAAY,MAAM,KAAK;GAE5B,iBAAiB,OAAO,QAAQ,OAAO,KAAK;GAC5C,YAAY,EAAE,aAAa,OAAO,QAAQ,OAAO,UAAU,MAAM,CAAC;EACpE,CAAC,CACH,CACF,EACF,EAAE;CACN,CAAC;AACH"}
|
package/dist/dom/index.d.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { A as Moved, C as TargetPressed, D as Move, E as Fact, M as ScrollLock, N as FocusScope, O as MoveEnded, P as tabbableWithin, S as TargetHovered, T as targetOf, _ as HOLD_TO_DRAG_MS, a as TextEdited, b as zoneOf, c as DRAG_THRESHOLD, d as DragFact, f as DragPlace, g as HOLD_SLOP, h as DraggedOver, i as TextCommitted, j as HideOutside, k as MoveStarted, l as DragCancelled, m as DragZone, n as EditableText, o as TextFact, p as DragStarted, r as TextCancelled, s as textOf, t as EditAsked, u as DragDropped, v as PointerDrag, w as Targets, x as TargetFact, y as boxOf } from "../editable-text-
|
|
1
|
+
import { A as Moved, C as TargetPressed, D as Move, E as Fact, M as ScrollLock, N as FocusScope, O as MoveEnded, P as tabbableWithin, S as TargetHovered, T as targetOf, _ as HOLD_TO_DRAG_MS, a as TextEdited, b as zoneOf, c as DRAG_THRESHOLD, d as DragFact, f as DragPlace, g as HOLD_SLOP, h as DraggedOver, i as TextCommitted, j as HideOutside, k as MoveStarted, l as DragCancelled, m as DragZone, n as EditableText, o as TextFact, p as DragStarted, r as TextCancelled, s as textOf, t as EditAsked, u as DragDropped, v as PointerDrag, w as Targets, x as TargetFact, y as boxOf } from "../editable-text-Bg7vil7h.mjs";
|
|
2
2
|
import { Schema, Stream } from "effect";
|
|
3
3
|
import * as Mount from "foldkit/mount";
|
|
4
4
|
import { Url } from "foldkit/url";
|
|
5
5
|
import { Command } from "foldkit/command";
|
|
6
|
-
//#region src/dom/autofocus.d.ts
|
|
7
6
|
export declare const Focused: Schema.TaggedStruct<"Focused", {}>;
|
|
8
7
|
export type Focused = typeof Focused.Type;
|
|
9
8
|
/**
|
|
@@ -16,8 +15,6 @@ export type Focused = typeof Focused.Type;
|
|
|
16
15
|
export declare const Autofocus: Mount.MountDefinitionNoArgs<"Autofocus", {
|
|
17
16
|
readonly _tag: "Focused";
|
|
18
17
|
}>;
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region src/dom/clipboard.d.ts
|
|
21
18
|
export declare const ClipboardMessage: import("foldkit/message").MessageUnion<{
|
|
22
19
|
readonly Copied: {};
|
|
23
20
|
readonly CopyFailed: {
|
|
@@ -45,8 +42,6 @@ export declare const copyText: (text: string) => Command<ClipboardMessage, never
|
|
|
45
42
|
* an insecure context or no clipboard API yields `ReadFailed`.
|
|
46
43
|
*/
|
|
47
44
|
export declare const readText: () => Command<ClipboardReadMessage, never, never>;
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/dom/input-mask.d.ts
|
|
50
45
|
/** What `InputMask` reports after each edit: the masked text shown, and the characters typed. */
|
|
51
46
|
export declare const Input: Schema.TaggedStruct<"Input", {
|
|
52
47
|
readonly value: Schema.String;
|
|
@@ -79,8 +74,6 @@ export declare const InputMask: Mount.MountDefinitionWithArgs<"InputMask", {
|
|
|
79
74
|
readonly value: string;
|
|
80
75
|
readonly raw: string;
|
|
81
76
|
}>;
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region src/dom/keep-in-view.d.ts
|
|
84
77
|
/**
|
|
85
78
|
* Keeps what is marked in view as a Mount: whenever an element in the mounted
|
|
86
79
|
* one's subtree newly matches `selector`, such as the row just selected in a
|
|
@@ -94,8 +87,6 @@ export declare const KeepInView: Mount.MountDefinitionWithArgs<"KeepInView", {
|
|
|
94
87
|
/** What is marked, as a selector within the element: `[aria-selected="true"]`. */
|
|
95
88
|
selector: Schema.String;
|
|
96
89
|
}, never>;
|
|
97
|
-
//#endregion
|
|
98
|
-
//#region src/dom/script-loader.d.ts
|
|
99
90
|
export declare const ScriptMessage: import("foldkit/message").MessageUnion<{
|
|
100
91
|
readonly Loaded: {};
|
|
101
92
|
readonly LoadFailed: {
|
|
@@ -105,8 +96,6 @@ export declare const ScriptMessage: import("foldkit/message").MessageUnion<{
|
|
|
105
96
|
export type ScriptMessage = typeof ScriptMessage.Type;
|
|
106
97
|
/** Loads a script by URL, once per URL. */
|
|
107
98
|
export declare const loadScript: (src: string) => Command<ScriptMessage, never, never>;
|
|
108
|
-
//#endregion
|
|
109
|
-
//#region src/dom/share.d.ts
|
|
110
99
|
export declare const ShareData: Schema.Struct<{
|
|
111
100
|
readonly title: Schema.optional<Schema.String>;
|
|
112
101
|
readonly text: Schema.optional<Schema.String>;
|
|
@@ -123,8 +112,6 @@ export declare const ShareMessage: import("foldkit/message").MessageUnion<{
|
|
|
123
112
|
export type ShareMessage = typeof ShareMessage.Type;
|
|
124
113
|
/** Shares data through the platform sheet. */
|
|
125
114
|
export declare const share: (data: ShareData) => Command<ShareMessage, never, never>;
|
|
126
|
-
//#endregion
|
|
127
|
-
//#region src/dom/measure.d.ts
|
|
128
115
|
/** The custom properties `Measure` writes for a target named `name`. */
|
|
129
116
|
export declare const measured: (name: string) => {
|
|
130
117
|
readonly x: `--fk-${string}-x`;
|
|
@@ -164,8 +151,6 @@ export declare const Measure: Mount.MountDefinitionWithArgs<"Measure", {
|
|
|
164
151
|
/** Each target by name, as a selector within the element: `{ selected: '[aria-selected="true"]' }`. */
|
|
165
152
|
targets: Schema.$Record<Schema.String, Schema.String>;
|
|
166
153
|
}, never>;
|
|
167
|
-
//#endregion
|
|
168
|
-
//#region src/dom/follow-tab-stop.d.ts
|
|
169
154
|
/**
|
|
170
155
|
* Keeps focus that is inside a container of roving tab stops on its stop, as a
|
|
171
156
|
* Mount: when a transition moves the stop (a row made current by a command the
|
|
@@ -175,8 +160,6 @@ export declare const Measure: Mount.MountDefinitionWithArgs<"Measure", {
|
|
|
175
160
|
* taken, and focus the user moved away stays where it went.
|
|
176
161
|
*/
|
|
177
162
|
export declare const FollowTabStop: Mount.MountDefinitionNoArgs<"FollowTabStop", never>;
|
|
178
|
-
//#endregion
|
|
179
|
-
//#region src/dom/scroll.d.ts
|
|
180
163
|
/** How `keepScroll` remembers and restores each history entry's offset. */
|
|
181
164
|
export interface KeepScrollOptions {
|
|
182
165
|
/** The `sessionStorage` key holding entry offsets. Default `'foldkit:scroll'`. */
|
|
@@ -196,8 +179,6 @@ export interface KeepScrollOptions {
|
|
|
196
179
|
* `Subscription.persistentEntry`; the stream sends no Messages.
|
|
197
180
|
*/
|
|
198
181
|
export declare const keepScroll: (options?: KeepScrollOptions) => Stream.Stream<never>;
|
|
199
|
-
//#endregion
|
|
200
|
-
//#region src/dom/pointed-links.d.ts
|
|
201
182
|
/**
|
|
202
183
|
* The address of the link a reader points at or tabs to, on the page's own
|
|
203
184
|
* origin: where they may go next, for a `Data.preload` before they go. Each
|
|
@@ -206,8 +187,6 @@ export declare const keepScroll: (options?: KeepScrollOptions) => Stream.Stream<
|
|
|
206
187
|
* `Subscription.persistentEntry`, mapping each address to a Message.
|
|
207
188
|
*/
|
|
208
189
|
export declare const pointedLinks: () => Stream.Stream<Url>;
|
|
209
|
-
//#endregion
|
|
210
|
-
//#region src/dom/fluid-hover.d.ts
|
|
211
190
|
/** The custom properties `FluidHover` writes on its container for a highlight named `name`. */
|
|
212
191
|
export declare const fluidHovered: (name: string) => {
|
|
213
192
|
readonly x: `--fk-${string}-x`;
|
|
@@ -297,8 +276,6 @@ export declare const FluidHover: Mount.MountDefinitionWithArgs<"FluidHover", {
|
|
|
297
276
|
/** The selector, run from a focused element outside any item, of the item it lights. */
|
|
298
277
|
focused: Schema.optional<Schema.String>;
|
|
299
278
|
}, never>;
|
|
300
|
-
//#endregion
|
|
301
|
-
//#region src/dom/keyboard-inset.d.ts
|
|
302
279
|
/**
|
|
303
280
|
* The custom property `KeyboardInset` writes on its element: how much of the layout
|
|
304
281
|
* viewport's bottom the on-screen keyboard (or anything else the visual viewport leaves
|
|
@@ -326,8 +303,6 @@ export declare const keyboardInset: (view: {
|
|
|
326
303
|
* no visual viewport it writes nothing.
|
|
327
304
|
*/
|
|
328
305
|
export declare const KeyboardInset: Mount.MountDefinitionWithArgs<"KeyboardInset", {}, never>;
|
|
329
|
-
//#endregion
|
|
330
|
-
//#region src/dom/scroll-bars.d.ts
|
|
331
306
|
/**
|
|
332
307
|
* The attribute that marks a bar beside a scroller `ScrollBars` runs on, set
|
|
333
308
|
* to the axis it shows: `block` (the up-and-down bar) or `inline`.
|
|
@@ -377,8 +352,6 @@ export declare const ScrollBars: Mount.MountDefinitionWithArgs<"ScrollBars", {
|
|
|
377
352
|
*/
|
|
378
353
|
scroller: Schema.optional<Schema.String>;
|
|
379
354
|
}, never>;
|
|
380
|
-
//#endregion
|
|
381
|
-
//#region src/dom/swipe.d.ts
|
|
382
355
|
export declare const SwipeStarted: Schema.TaggedStruct<"SwipeStarted", {
|
|
383
356
|
readonly pointerId: Schema.Number;
|
|
384
357
|
readonly pointerType: Schema.String;
|
|
@@ -496,8 +469,6 @@ export declare const Swipe: Mount.MountDefinitionWithArgs<"Swipe", {
|
|
|
496
469
|
readonly velocityY: number;
|
|
497
470
|
readonly completed: boolean;
|
|
498
471
|
}>;
|
|
499
|
-
//#endregion
|
|
500
|
-
//#region src/dom/scroll-settle.d.ts
|
|
501
472
|
export declare const ScrollSettled: Schema.TaggedStruct<"ScrollSettled", {
|
|
502
473
|
/** The item whose start lies nearest the scroller's start, from 0. */
|
|
503
474
|
readonly index: Schema.Number;
|
|
@@ -528,8 +499,6 @@ export declare const ScrollSettle: Mount.MountDefinitionWithArgs<"ScrollSettle",
|
|
|
528
499
|
readonly _tag: "ScrollSettled";
|
|
529
500
|
readonly index: number;
|
|
530
501
|
}>;
|
|
531
|
-
//#endregion
|
|
532
|
-
//#region src/dom/pointer-position.d.ts
|
|
533
502
|
/**
|
|
534
503
|
* A place in an element's padding box, in CSS pixels from its top left
|
|
535
504
|
* corner, and the pointer's pressure there (0 to 1; a mouse reads 0.5 while
|
|
@@ -659,8 +628,6 @@ export declare const PointerPosition: Mount.MountDefinitionWithArgs<"PointerPosi
|
|
|
659
628
|
readonly _tag: "PointerReleased";
|
|
660
629
|
readonly completed: boolean;
|
|
661
630
|
}>;
|
|
662
|
-
//#endregion
|
|
663
|
-
//#region src/dom/track-box.d.ts
|
|
664
631
|
/** The attribute on the mounted element naming the element `TrackBox` follows, by id. */
|
|
665
632
|
export declare const TRACK_TARGET_ATTRIBUTE = "data-target";
|
|
666
633
|
/** The custom properties `TrackBox` writes for `name`, as `measured` names `Measure`'s. */
|
|
@@ -719,8 +686,6 @@ export declare const TrackBox: Mount.MountDefinitionWithArgs<"TrackBox", {
|
|
|
719
686
|
readonly target: string;
|
|
720
687
|
readonly found: boolean;
|
|
721
688
|
}>;
|
|
722
|
-
//#endregion
|
|
723
|
-
//#region src/dom/image-decode.d.ts
|
|
724
689
|
export declare const ImageDecodeMessage: import("foldkit/message").MessageUnion<{
|
|
725
690
|
readonly Decoded: {
|
|
726
691
|
src: Schema.String;
|
|
@@ -745,6 +710,5 @@ export interface ImageSource {
|
|
|
745
710
|
* it would draw, so the decoded file is the one shown.
|
|
746
711
|
*/
|
|
747
712
|
export declare const decodeImage: (source: ImageSource) => Command<ImageDecodeMessage, never, never>;
|
|
748
|
-
//#endregion
|
|
749
713
|
export { DRAG_THRESHOLD, DragCancelled, DragDropped, DragFact, DragPlace, DragStarted, DragZone, DraggedOver, EditAsked, EditableText, Fact, FocusScope, HOLD_SLOP, HOLD_TO_DRAG_MS, HideOutside, Move, MoveEnded, MoveStarted, Moved, PointerDrag, ScrollLock, TargetFact, TargetHovered, TargetPressed, Targets, TextCancelled, TextCommitted, TextEdited, TextFact, boxOf, tabbableWithin, targetOf, textOf, zoneOf };
|
|
750
714
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/dom/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/dom/autofocus.ts","../../src/dom/clipboard.ts","../../src/dom/input-mask.ts","../../src/dom/keep-in-view.ts","../../src/dom/script-loader.ts","../../src/dom/share.ts","../../src/dom/measure.ts","../../src/dom/follow-tab-stop.ts","../../src/dom/scroll.ts","../../src/dom/pointed-links.ts","../../src/dom/fluid-hover.ts","../../src/dom/keyboard-inset.ts","../../src/dom/scroll-bars.ts","../../src/dom/swipe.ts","../../src/dom/scroll-settle.ts","../../src/dom/pointer-position.ts","../../src/dom/track-box.ts","../../src/dom/image-decode.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/dom/autofocus.ts","../../src/dom/clipboard.ts","../../src/dom/input-mask.ts","../../src/dom/keep-in-view.ts","../../src/dom/script-loader.ts","../../src/dom/share.ts","../../src/dom/measure.ts","../../src/dom/follow-tab-stop.ts","../../src/dom/scroll.ts","../../src/dom/pointed-links.ts","../../src/dom/fluid-hover.ts","../../src/dom/keyboard-inset.ts","../../src/dom/scroll-bars.ts","../../src/dom/swipe.ts","../../src/dom/scroll-settle.ts","../../src/dom/pointer-position.ts","../../src/dom/track-box.ts","../../src/dom/image-decode.ts"],"mappings":";;;;;qBAGa,SAAO,OAAA;YACR,iBAAiB,QAAQ;;;;;;;;qBASxB,WAAS,MAAA;;;qBCJT,4CAAgB;;;IAEb,SAAO,OAAA;;;YAEX,0BAA0B,iBAAiB;qBAE1C,gDAAoB;;IACvB,MAAI,OAAA;;;IACE,SAAO,OAAA;;;YAEX,8BAA8B,qBAAqB;;;;;;qBAUlD,WAAQ,iBAAmB,QAAQ;;;;;qBAsBnC,gBAAe,QAAQ;;qBC/CvB,OAAK,OAAA;;;;YAIN,eAAe,MAAM;;;;;;;qBAiCpB,YAAS,eACP;WAED;WAAyB;;;;;;;;;;;qBA6C1B,WAAS,MAAA;;;;;;;;;;;;;;;;qBC7ET,YAAU,MAAA;;;;qBCDV,yCAAa;;;IAEV,SAAO,OAAA;;;YAEX,uBAAuB,cAAc;;qBASpC,aAAU,gBAAkB,QAAQ;qBCbpC,WAAS,OAAA;;;;;YAKV,mBAAmB,UAAU;qBAE5B,wCAAY;;;;IAGR,SAAO,OAAA;;;YAEZ,sBAAsB,aAAa;;qBAUlC,QAAK,MAAU,cAAY,QAAQ;;qBC7BnC,WAAQ;WAEjB;WACA;WACA;WACA;WACA;;;;;;;WAOA;;;;;;;;;;;;;;;;;;;;;;qBAuBS,SAAO,MAAA;;;;;;;;;;;;qBC7BP,eAAa,MAAA;;iBCuBT;;WAEN;;WAEA;;;;;WAKA;;;;;;;;qBAuHE,aAAU,UAAa,sBAAyB,OAAO;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