foldkit 0.19.0 → 0.20.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 (57) hide show
  1. package/README.md +3 -3
  2. package/dist/command/index.d.ts +4 -0
  3. package/dist/command/index.d.ts.map +1 -0
  4. package/dist/command/index.js +1 -0
  5. package/dist/command/public.d.ts +2 -0
  6. package/dist/command/public.d.ts.map +1 -0
  7. package/dist/command/public.js +1 -0
  8. package/dist/html/index.d.ts +14 -0
  9. package/dist/html/index.d.ts.map +1 -1
  10. package/dist/html/index.js +5 -1
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/runtime/public.d.ts +1 -1
  14. package/dist/runtime/public.d.ts.map +1 -1
  15. package/dist/runtime/runtime.d.ts +2 -3
  16. package/dist/runtime/runtime.d.ts.map +1 -1
  17. package/dist/runtime/runtime.js +1 -1
  18. package/dist/task/dom.d.ts +26 -27
  19. package/dist/task/dom.d.ts.map +1 -1
  20. package/dist/task/dom.js +36 -37
  21. package/dist/task/error.d.ts +18 -0
  22. package/dist/task/error.d.ts.map +1 -0
  23. package/dist/task/error.js +7 -0
  24. package/dist/task/index.d.ts +1 -0
  25. package/dist/task/index.d.ts.map +1 -1
  26. package/dist/task/index.js +1 -0
  27. package/dist/task/inert.d.ts +12 -11
  28. package/dist/task/inert.d.ts.map +1 -1
  29. package/dist/task/inert.js +12 -13
  30. package/dist/task/public.d.ts +1 -1
  31. package/dist/task/public.d.ts.map +1 -1
  32. package/dist/task/public.js +1 -1
  33. package/dist/task/random.d.ts +3 -4
  34. package/dist/task/random.d.ts.map +1 -1
  35. package/dist/task/random.js +3 -4
  36. package/dist/task/scrollLock.d.ts +9 -9
  37. package/dist/task/scrollLock.d.ts.map +1 -1
  38. package/dist/task/scrollLock.js +9 -11
  39. package/dist/task/time.d.ts +17 -16
  40. package/dist/task/time.d.ts.map +1 -1
  41. package/dist/task/time.js +20 -21
  42. package/dist/task/timing.d.ts +14 -15
  43. package/dist/task/timing.d.ts.map +1 -1
  44. package/dist/task/timing.js +16 -20
  45. package/dist/ui/dialog/index.d.ts +1 -1
  46. package/dist/ui/dialog/index.d.ts.map +1 -1
  47. package/dist/ui/dialog/index.js +3 -3
  48. package/dist/ui/disclosure/index.d.ts +1 -1
  49. package/dist/ui/disclosure/index.d.ts.map +1 -1
  50. package/dist/ui/disclosure/index.js +3 -3
  51. package/dist/ui/menu/index.d.ts +1 -1
  52. package/dist/ui/menu/index.d.ts.map +1 -1
  53. package/dist/ui/menu/index.js +24 -17
  54. package/dist/ui/tabs/index.d.ts +4 -5
  55. package/dist/ui/tabs/index.d.ts.map +1 -1
  56. package/dist/ui/tabs/index.js +6 -8
  57. package/package.json +9 -1
@@ -1,3 +1,4 @@
1
+ export { ElementNotFound, TimeZoneError } from './error';
1
2
  export { getTime, getTimeZone, getZonedTime, getZonedTimeIn } from './time';
2
3
  export { focus, showModal, closeModal, clickElement, scrollIntoView, } from './dom';
3
4
  export { delay, nextFrame, waitForTransitions } from './timing';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/task/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAC3E,OAAO,EACL,KAAK,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,cAAc,GACf,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/task/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAC3E,OAAO,EACL,KAAK,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,cAAc,GACf,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA"}
@@ -1,3 +1,4 @@
1
+ export { ElementNotFound, TimeZoneError } from './error';
1
2
  export { getTime, getTimeZone, getZonedTime, getZonedTimeIn } from './time';
2
3
  export { focus, showModal, closeModal, clickElement, scrollIntoView, } from './dom';
3
4
  export { delay, nextFrame, waitForTransitions } from './timing';
@@ -1,25 +1,26 @@
1
1
  import { Effect } from 'effect';
2
2
  /**
3
- * Creates a command that marks all DOM elements outside the given selectors as
4
- * `inert` and `aria-hidden="true"`. Walks each allowed element up to
5
- * `document.body`, marking siblings that don't contain an allowed element.
6
- * Uses reference counting so nested calls are safe.
3
+ * Marks all DOM elements outside the given selectors as `inert` and
4
+ * `aria-hidden="true"`. Walks each allowed element up to `document.body`,
5
+ * marking siblings that don't contain an allowed element. Uses reference
6
+ * counting so nested calls are safe.
7
7
  *
8
8
  * @example
9
9
  * ```typescript
10
- * Task.inertOthers('my-menu', ['#menu-button', '#menu-items'], () => NoOp())
10
+ * Task.inertOthers('my-menu', ['#menu-button', '#menu-items']).pipe(
11
+ * Effect.as(NoOp()),
12
+ * )
11
13
  * ```
12
14
  */
13
- export declare const inertOthers: <Message>(id: string, allowedSelectors: ReadonlyArray<string>, f: () => Message) => Effect.Effect<Message>;
15
+ export declare const inertOthers: (id: string, allowedSelectors: ReadonlyArray<string>) => Effect.Effect<void>;
14
16
  /**
15
- * Creates a command that restores all elements previously marked inert by
16
- * `inertOthers` for the given ID. Safe to call without a preceding
17
- * `inertOthers` — acts as a no-op in that case.
17
+ * Restores all elements previously marked inert by `inertOthers` for the
18
+ * given ID. Safe to call without a preceding `inertOthers` — acts as a no-op.
18
19
  *
19
20
  * @example
20
21
  * ```typescript
21
- * Task.restoreInert('my-menu', () => NoOp())
22
+ * Task.restoreInert('my-menu').pipe(Effect.as(NoOp()))
22
23
  * ```
23
24
  */
24
- export declare const restoreInert: <Message>(id: string, f: () => Message) => Effect.Effect<Message>;
25
+ export declare const restoreInert: (id: string) => Effect.Effect<void>;
25
26
  //# sourceMappingURL=inert.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inert.d.ts","sourceRoot":"","sources":["../../src/task/inert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAmC,MAAM,QAAQ,CAAA;AAoFvE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,EACjC,IAAI,MAAM,EACV,kBAAkB,aAAa,CAAC,MAAM,CAAC,EACvC,GAAG,MAAM,OAAO,KACf,MAAM,CAAC,MAAM,CAAC,OAAO,CAepB,CAAA;AAEJ;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,EAClC,IAAI,MAAM,EACV,GAAG,MAAM,OAAO,KACf,MAAM,CAAC,MAAM,CAAC,OAAO,CAUpB,CAAA"}
1
+ {"version":3,"file":"inert.d.ts","sourceRoot":"","sources":["../../src/task/inert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAmC,MAAM,QAAQ,CAAA;AAoFvE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,GACtB,IAAI,MAAM,EACV,kBAAkB,aAAa,CAAC,MAAM,CAAC,KACtC,MAAM,CAAC,MAAM,CAAC,IAAI,CAajB,CAAA;AAEJ;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GAAI,IAAI,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAQxD,CAAA"}
@@ -52,37 +52,36 @@ const inertableSiblings = (parent, allowedElements) => pipe(parent.children, Arr
52
52
  ? Option.some(child)
53
53
  : Option.none()));
54
54
  /**
55
- * Creates a command that marks all DOM elements outside the given selectors as
56
- * `inert` and `aria-hidden="true"`. Walks each allowed element up to
57
- * `document.body`, marking siblings that don't contain an allowed element.
58
- * Uses reference counting so nested calls are safe.
55
+ * Marks all DOM elements outside the given selectors as `inert` and
56
+ * `aria-hidden="true"`. Walks each allowed element up to `document.body`,
57
+ * marking siblings that don't contain an allowed element. Uses reference
58
+ * counting so nested calls are safe.
59
59
  *
60
60
  * @example
61
61
  * ```typescript
62
- * Task.inertOthers('my-menu', ['#menu-button', '#menu-items'], () => NoOp())
62
+ * Task.inertOthers('my-menu', ['#menu-button', '#menu-items']).pipe(
63
+ * Effect.as(NoOp()),
64
+ * )
63
65
  * ```
64
66
  */
65
- export const inertOthers = (id, allowedSelectors, f) => Effect.sync(() => {
67
+ export const inertOthers = (id, allowedSelectors) => Effect.sync(() => {
66
68
  const allowedElements = resolveElements(allowedSelectors);
67
69
  const cleanupFunctions = pipe(allowedElements, Array.flatMap(ancestorsUpToBody), Array.flatMap(ancestor => Array.map(inertableSiblings(ancestor, allowedElements), markInert)));
68
70
  inertState.cleanups.set(id, cleanupFunctions);
69
- return f();
70
71
  });
71
72
  /**
72
- * Creates a command that restores all elements previously marked inert by
73
- * `inertOthers` for the given ID. Safe to call without a preceding
74
- * `inertOthers` — acts as a no-op in that case.
73
+ * Restores all elements previously marked inert by `inertOthers` for the
74
+ * given ID. Safe to call without a preceding `inertOthers` — acts as a no-op.
75
75
  *
76
76
  * @example
77
77
  * ```typescript
78
- * Task.restoreInert('my-menu', () => NoOp())
78
+ * Task.restoreInert('my-menu').pipe(Effect.as(NoOp()))
79
79
  * ```
80
80
  */
81
- export const restoreInert = (id, f) => Effect.sync(() => {
81
+ export const restoreInert = (id) => Effect.sync(() => {
82
82
  const cleanupFunctions = inertState.cleanups.get(id);
83
83
  if (cleanupFunctions) {
84
84
  Array.forEach(cleanupFunctions, cleanup => cleanup());
85
85
  inertState.cleanups.delete(id);
86
86
  }
87
- return f();
88
87
  });
@@ -1,2 +1,2 @@
1
- export { getTime, getTimeZone, getZonedTime, getZonedTimeIn, focus, showModal, closeModal, clickElement, delay, scrollIntoView, randomInt, nextFrame, waitForTransitions, } from './index';
1
+ export { ElementNotFound, TimeZoneError, getTime, getTimeZone, getZonedTime, getZonedTimeIn, focus, showModal, closeModal, clickElement, delay, scrollIntoView, randomInt, nextFrame, waitForTransitions, } from './index';
2
2
  //# sourceMappingURL=public.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/task/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,WAAW,EACX,YAAY,EACZ,cAAc,EACd,KAAK,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,KAAK,EACL,cAAc,EACd,SAAS,EACT,SAAS,EACT,kBAAkB,GACnB,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/task/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,aAAa,EACb,OAAO,EACP,WAAW,EACX,YAAY,EACZ,cAAc,EACd,KAAK,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,KAAK,EACL,cAAc,EACd,SAAS,EACT,SAAS,EACT,kBAAkB,GACnB,MAAM,SAAS,CAAA"}
@@ -1 +1 @@
1
- export { getTime, getTimeZone, getZonedTime, getZonedTimeIn, focus, showModal, closeModal, clickElement, delay, scrollIntoView, randomInt, nextFrame, waitForTransitions, } from './index';
1
+ export { ElementNotFound, TimeZoneError, getTime, getTimeZone, getZonedTime, getZonedTimeIn, focus, showModal, closeModal, clickElement, delay, scrollIntoView, randomInt, nextFrame, waitForTransitions, } from './index';
@@ -1,12 +1,11 @@
1
1
  import { Effect } from 'effect';
2
2
  /**
3
- * Creates a command that generates a random integer between min (inclusive) and max (exclusive)
4
- * and passes it to a message constructor.
3
+ * Generates a random integer between min (inclusive) and max (exclusive).
5
4
  *
6
5
  * @example
7
6
  * ```typescript
8
- * Task.randomInt(0, 100, value => GotRandom({ value }))
7
+ * Task.randomInt(1, 7).pipe(Effect.map(value => GotDiceRoll({ value })))
9
8
  * ```
10
9
  */
11
- export declare const randomInt: <Message>(min: number, max: number, f: (value: number) => Message) => Effect.Effect<Message>;
10
+ export declare const randomInt: (min: number, max: number) => Effect.Effect<number>;
12
11
  //# sourceMappingURL=random.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../src/task/random.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,EAC/B,KAAK,MAAM,EACX,KAAK,MAAM,EACX,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,KAC5B,MAAM,CAAC,MAAM,CAAC,OAAO,CAC6C,CAAA"}
1
+ {"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../src/task/random.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,EAAE,KAAK,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CACP,CAAA"}
@@ -1,11 +1,10 @@
1
1
  import { Effect } from 'effect';
2
2
  /**
3
- * Creates a command that generates a random integer between min (inclusive) and max (exclusive)
4
- * and passes it to a message constructor.
3
+ * Generates a random integer between min (inclusive) and max (exclusive).
5
4
  *
6
5
  * @example
7
6
  * ```typescript
8
- * Task.randomInt(0, 100, value => GotRandom({ value }))
7
+ * Task.randomInt(1, 7).pipe(Effect.map(value => GotDiceRoll({ value })))
9
8
  * ```
10
9
  */
11
- export const randomInt = (min, max, f) => Effect.sync(() => f(Math.floor(Math.random() * (max - min)) + min));
10
+ export const randomInt = (min, max) => Effect.sync(() => Math.floor(Math.random() * (max - min)) + min);
@@ -1,24 +1,24 @@
1
1
  import { Effect } from 'effect';
2
2
  /**
3
- * Creates a command that locks page scroll by setting `overflow: hidden` on the
4
- * document element. Compensates for scrollbar width with padding to prevent layout
5
- * shift. Uses reference counting so nested locks are safe — the page only unlocks
3
+ * Locks page scroll by setting `overflow: hidden` on the document element.
4
+ * Compensates for scrollbar width with padding to prevent layout shift.
5
+ * Uses reference counting so nested locks are safe — the page only unlocks
6
6
  * when every lock has been released.
7
7
  *
8
8
  * @example
9
9
  * ```typescript
10
- * Task.lockScroll(() => NoOp())
10
+ * Task.lockScroll.pipe(Effect.as(NoOp()))
11
11
  * ```
12
12
  */
13
- export declare const lockScroll: <Message>(f: () => Message) => Effect.Effect<Message>;
13
+ export declare const lockScroll: Effect.Effect<void>;
14
14
  /**
15
- * Creates a command that releases one scroll lock. When the last lock is released,
16
- * restores the original `overflow` and `padding-right` on the document element.
15
+ * Releases one scroll lock. When the last lock is released, restores the
16
+ * original `overflow` and `padding-right` on the document element.
17
17
  *
18
18
  * @example
19
19
  * ```typescript
20
- * Task.unlockScroll(() => NoOp())
20
+ * Task.unlockScroll.pipe(Effect.as(NoOp()))
21
21
  * ```
22
22
  */
23
- export declare const unlockScroll: <Message>(f: () => Message) => Effect.Effect<Message>;
23
+ export declare const unlockScroll: Effect.Effect<void>;
24
24
  //# sourceMappingURL=scrollLock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scrollLock.d.ts","sourceRoot":"","sources":["../../src/task/scrollLock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAA;AAQvC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,EAAE,GAAG,MAAM,OAAO,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAqBxE,CAAA;AAEJ;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,EAClC,GAAG,MAAM,OAAO,KACf,MAAM,CAAC,MAAM,CAAC,OAAO,CAapB,CAAA"}
1
+ {"version":3,"file":"scrollLock.d.ts","sourceRoot":"","sources":["../../src/task/scrollLock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAA;AAQvC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAkBzC,CAAA;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAU3C,CAAA"}
@@ -5,17 +5,17 @@ const scrollLockState = {
5
5
  paddingRight: '',
6
6
  };
7
7
  /**
8
- * Creates a command that locks page scroll by setting `overflow: hidden` on the
9
- * document element. Compensates for scrollbar width with padding to prevent layout
10
- * shift. Uses reference counting so nested locks are safe — the page only unlocks
8
+ * Locks page scroll by setting `overflow: hidden` on the document element.
9
+ * Compensates for scrollbar width with padding to prevent layout shift.
10
+ * Uses reference counting so nested locks are safe — the page only unlocks
11
11
  * when every lock has been released.
12
12
  *
13
13
  * @example
14
14
  * ```typescript
15
- * Task.lockScroll(() => NoOp())
15
+ * Task.lockScroll.pipe(Effect.as(NoOp()))
16
16
  * ```
17
17
  */
18
- export const lockScroll = (f) => Effect.sync(() => {
18
+ export const lockScroll = Effect.sync(() => {
19
19
  const { documentElement, documentElement: { style }, } = document;
20
20
  if (scrollLockState.count === 0) {
21
21
  scrollLockState.overflow = style.overflow;
@@ -26,23 +26,21 @@ export const lockScroll = (f) => Effect.sync(() => {
26
26
  scrollbarWidth > 0 ? `${scrollbarWidth}px` : style.paddingRight;
27
27
  }
28
28
  scrollLockState.count++;
29
- return f();
30
29
  });
31
30
  /**
32
- * Creates a command that releases one scroll lock. When the last lock is released,
33
- * restores the original `overflow` and `padding-right` on the document element.
31
+ * Releases one scroll lock. When the last lock is released, restores the
32
+ * original `overflow` and `padding-right` on the document element.
34
33
  *
35
34
  * @example
36
35
  * ```typescript
37
- * Task.unlockScroll(() => NoOp())
36
+ * Task.unlockScroll.pipe(Effect.as(NoOp()))
38
37
  * ```
39
38
  */
40
- export const unlockScroll = (f) => Effect.sync(() => {
39
+ export const unlockScroll = Effect.sync(() => {
41
40
  scrollLockState.count = Math.max(0, Number.decrement(scrollLockState.count));
42
41
  if (scrollLockState.count === 0) {
43
42
  const { documentElement: { style }, } = document;
44
43
  style.overflow = scrollLockState.overflow;
45
44
  style.paddingRight = scrollLockState.paddingRight;
46
45
  }
47
- return f();
48
46
  });
@@ -1,42 +1,43 @@
1
1
  import { DateTime, Effect } from 'effect';
2
+ import { TimeZoneError } from './error';
2
3
  /**
3
- * Creates a command that gets the current UTC time and passes it to a message constructor.
4
- * This is similar to Elm's `Task.perform` with `Time.now`.
4
+ * Gets the current UTC time.
5
5
  *
6
6
  * @example
7
7
  * ```typescript
8
- * Task.getTime(utc => GotTime({ utc }))
8
+ * Task.getTime.pipe(Effect.map(utc => GotTime({ utc })))
9
9
  * ```
10
10
  */
11
- export declare const getTime: <Message>(f: (utc: DateTime.Utc) => Message) => Effect.Effect<Message>;
11
+ export declare const getTime: Effect.Effect<DateTime.Utc>;
12
12
  /**
13
- * Creates a command that gets the system timezone and passes it to a message constructor.
14
- * This is similar to Elm's `Task.perform` with `Time.here`.
13
+ * Gets the system timezone.
15
14
  *
16
15
  * @example
17
16
  * ```typescript
18
- * Task.getTimeZone(zone => GotTimeZone({ zone }))
17
+ * Task.getTimeZone.pipe(Effect.map(zone => GotTimeZone({ zone })))
19
18
  * ```
20
19
  */
21
- export declare const getTimeZone: <Message>(f: (zone: DateTime.TimeZone) => Message) => Effect.Effect<Message>;
20
+ export declare const getTimeZone: Effect.Effect<DateTime.TimeZone>;
22
21
  /**
23
- * Creates a command that gets the current time in the system timezone and passes it to a message constructor.
24
- * This combines both time and timezone in a single task.
22
+ * Gets the current time in the system timezone.
25
23
  *
26
24
  * @example
27
25
  * ```typescript
28
- * Task.getZonedTime(zoned => GotTime({ zoned }))
26
+ * Task.getZonedTime.pipe(Effect.map(zoned => GotTime({ zoned })))
29
27
  * ```
30
28
  */
31
- export declare const getZonedTime: <Message>(f: (zoned: DateTime.Zoned) => Message) => Effect.Effect<Message>;
29
+ export declare const getZonedTime: Effect.Effect<DateTime.Zoned>;
32
30
  /**
33
- * Creates a command that gets the current time in a specific timezone and passes it to a message constructor.
34
- * If the timezone is invalid, the effect will fail with an error string.
31
+ * Gets the current time in a specific timezone.
32
+ * Fails with `TimeZoneError` if the timezone ID is invalid.
35
33
  *
36
34
  * @example
37
35
  * ```typescript
38
- * Task.getZonedTimeIn('America/New_York', zoned => GotNYTime({ zoned }))
36
+ * Task.getZonedTimeIn('America/New_York').pipe(
37
+ * Effect.map(zoned => GotNYTime({ zoned })),
38
+ * Effect.catchAll(() => Effect.succeed(FailedTimeZone())),
39
+ * )
39
40
  * ```
40
41
  */
41
- export declare const getZonedTimeIn: <Message>(zoneId: string, f: (zoned: DateTime.Zoned) => Message) => Effect.Effect<Message, string>;
42
+ export declare const getZonedTimeIn: (zoneId: string) => Effect.Effect<DateTime.Zoned, TimeZoneError>;
42
43
  //# sourceMappingURL=time.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/task/time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAA;AAEjD;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,EAC7B,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,KAAK,OAAO,KAChC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAgC,CAAA;AAExD;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,EACjC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,QAAQ,KAAK,OAAO,KACtC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAmD,CAAA;AAE3E;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,EAClC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,KAAK,OAAO,KACpC,MAAM,CAAC,MAAM,CAAC,OAAO,CAMpB,CAAA;AAEJ;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,EACpC,QAAQ,MAAM,EACd,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,KAAK,OAAO,KACpC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAS5B,CAAA"}
1
+ {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/task/time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAA;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAgB,CAAA;AAEhE;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAExD,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAMtD,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,KACb,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAQ1C,CAAA"}
package/dist/task/time.js CHANGED
@@ -1,54 +1,53 @@
1
1
  import { DateTime, Effect, Option } from 'effect';
2
+ import { TimeZoneError } from './error';
2
3
  /**
3
- * Creates a command that gets the current UTC time and passes it to a message constructor.
4
- * This is similar to Elm's `Task.perform` with `Time.now`.
4
+ * Gets the current UTC time.
5
5
  *
6
6
  * @example
7
7
  * ```typescript
8
- * Task.getTime(utc => GotTime({ utc }))
8
+ * Task.getTime.pipe(Effect.map(utc => GotTime({ utc })))
9
9
  * ```
10
10
  */
11
- export const getTime = (f) => Effect.map(DateTime.now, f);
11
+ export const getTime = DateTime.now;
12
12
  /**
13
- * Creates a command that gets the system timezone and passes it to a message constructor.
14
- * This is similar to Elm's `Task.perform` with `Time.here`.
13
+ * Gets the system timezone.
15
14
  *
16
15
  * @example
17
16
  * ```typescript
18
- * Task.getTimeZone(zone => GotTimeZone({ zone }))
17
+ * Task.getTimeZone.pipe(Effect.map(zone => GotTimeZone({ zone })))
19
18
  * ```
20
19
  */
21
- export const getTimeZone = (f) => Effect.sync(() => f(DateTime.zoneMakeLocal()));
20
+ export const getTimeZone = Effect.sync(() => DateTime.zoneMakeLocal());
22
21
  /**
23
- * Creates a command that gets the current time in the system timezone and passes it to a message constructor.
24
- * This combines both time and timezone in a single task.
22
+ * Gets the current time in the system timezone.
25
23
  *
26
24
  * @example
27
25
  * ```typescript
28
- * Task.getZonedTime(zoned => GotTime({ zoned }))
26
+ * Task.getZonedTime.pipe(Effect.map(zoned => GotTime({ zoned })))
29
27
  * ```
30
28
  */
31
- export const getZonedTime = (f) => Effect.gen(function* () {
29
+ export const getZonedTime = Effect.gen(function* () {
32
30
  const utc = yield* DateTime.now;
33
31
  const zone = DateTime.zoneMakeLocal();
34
- const zoned = DateTime.setZone(utc, zone);
35
- return f(zoned);
32
+ return DateTime.setZone(utc, zone);
36
33
  });
37
34
  /**
38
- * Creates a command that gets the current time in a specific timezone and passes it to a message constructor.
39
- * If the timezone is invalid, the effect will fail with an error string.
35
+ * Gets the current time in a specific timezone.
36
+ * Fails with `TimeZoneError` if the timezone ID is invalid.
40
37
  *
41
38
  * @example
42
39
  * ```typescript
43
- * Task.getZonedTimeIn('America/New_York', zoned => GotNYTime({ zoned }))
40
+ * Task.getZonedTimeIn('America/New_York').pipe(
41
+ * Effect.map(zoned => GotNYTime({ zoned })),
42
+ * Effect.catchAll(() => Effect.succeed(FailedTimeZone())),
43
+ * )
44
44
  * ```
45
45
  */
46
- export const getZonedTimeIn = (zoneId, f) => Effect.gen(function* () {
46
+ export const getZonedTimeIn = (zoneId) => Effect.gen(function* () {
47
47
  const utc = yield* DateTime.now;
48
48
  const maybeZone = DateTime.zoneMakeNamed(zoneId);
49
49
  if (Option.isNone(maybeZone)) {
50
- return yield* Effect.fail(`Invalid timezone: ${zoneId}`);
50
+ return yield* Effect.fail(new TimeZoneError({ zoneId }));
51
51
  }
52
- const zoned = DateTime.setZone(utc, maybeZone.value);
53
- return f(zoned);
52
+ return DateTime.setZone(utc, maybeZone.value);
54
53
  });
@@ -1,36 +1,35 @@
1
1
  import { Duration, Effect } from 'effect';
2
2
  /**
3
- * Creates a command that resolves to a message after a delay.
3
+ * Waits for the given duration before completing.
4
4
  * Useful for debouncing, such as clearing a typeahead search query.
5
5
  *
6
6
  * @example
7
7
  * ```typescript
8
- * Task.delay(350, () => ClearedSearch({ version: model.searchVersion }))
9
- * Task.delay(Duration.seconds(1), () => TimedOut())
8
+ * Task.delay('1 second').pipe(Effect.as(TimedOut()))
10
9
  * ```
11
10
  */
12
- export declare const delay: <Message>(duration: Duration.DurationInput, f: () => Message) => Effect.Effect<Message>;
11
+ export declare const delay: (duration: Duration.DurationInput) => Effect.Effect<void>;
13
12
  /**
14
- * Creates a command that resolves to a message after two animation frames,
15
- * ensuring the browser has painted the current state before proceeding.
16
- * Used for CSS transition orchestration — the double-rAF guarantees the "from"
17
- * state is visible before transitioning to the "to" state.
13
+ * Completes after two animation frames, ensuring the browser has painted
14
+ * the current state before proceeding. Used for CSS transition orchestration —
15
+ * the double-rAF guarantees the "from" state is visible before transitioning
16
+ * to the "to" state.
18
17
  *
19
18
  * @example
20
19
  * ```typescript
21
- * Task.nextFrame(() => TransitionFrameAdvanced())
20
+ * Task.nextFrame.pipe(Effect.as(TransitionFrameAdvanced()))
22
21
  * ```
23
22
  */
24
- export declare const nextFrame: <Message>(f: () => Message) => Effect.Effect<Message>;
23
+ export declare const nextFrame: Effect.Effect<void>;
25
24
  /**
26
- * Creates a command that waits for all CSS transitions on the element matching the selector
27
- * to complete, then resolves to a message. Uses the Web Animations API for reliable detection.
28
- * Falls back to resolving immediately if the element is missing or has no active transitions.
25
+ * Waits for all CSS transitions on the element matching the selector to complete.
26
+ * Uses the Web Animations API for reliable detection. Falls back to completing
27
+ * immediately if the element is missing or has no active transitions.
29
28
  *
30
29
  * @example
31
30
  * ```typescript
32
- * Task.waitForTransitions('#menu-items', () => TransitionEnded())
31
+ * Task.waitForTransitions('#menu-items').pipe(Effect.as(TransitionEnded()))
33
32
  * ```
34
33
  */
35
- export declare const waitForTransitions: <Message>(selector: string, f: () => Message) => Effect.Effect<Message>;
34
+ export declare const waitForTransitions: (selector: string) => Effect.Effect<void>;
36
35
  //# sourceMappingURL=timing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"timing.d.ts","sourceRoot":"","sources":["../../src/task/timing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEzC;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK,GAAI,OAAO,EAC3B,UAAU,QAAQ,CAAC,aAAa,EAChC,GAAG,MAAM,OAAO,KACf,MAAM,CAAC,MAAM,CAAC,OAAO,CAIpB,CAAA;AAEJ;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,EAAE,GAAG,MAAM,OAAO,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAOvE,CAAA;AAEJ;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,EACxC,UAAU,MAAM,EAChB,GAAG,MAAM,OAAO,KACf,MAAM,CAAC,MAAM,CAAC,OAAO,CAgBpB,CAAA"}
1
+ {"version":3,"file":"timing.d.ts","sourceRoot":"","sources":["../../src/task/timing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEzC;;;;;;;;GAQG;AACH,eAAO,MAAM,KAAK,GAAI,UAAU,QAAQ,CAAC,aAAa,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CACnD,CAAA;AAExB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAMxC,CAAA;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAgBpE,CAAA"}
@@ -1,47 +1,43 @@
1
1
  import { Effect } from 'effect';
2
2
  /**
3
- * Creates a command that resolves to a message after a delay.
3
+ * Waits for the given duration before completing.
4
4
  * Useful for debouncing, such as clearing a typeahead search query.
5
5
  *
6
6
  * @example
7
7
  * ```typescript
8
- * Task.delay(350, () => ClearedSearch({ version: model.searchVersion }))
9
- * Task.delay(Duration.seconds(1), () => TimedOut())
8
+ * Task.delay('1 second').pipe(Effect.as(TimedOut()))
10
9
  * ```
11
10
  */
12
- export const delay = (duration, f) => Effect.gen(function* () {
13
- yield* Effect.sleep(duration);
14
- return f();
15
- });
11
+ export const delay = (duration) => Effect.sleep(duration);
16
12
  /**
17
- * Creates a command that resolves to a message after two animation frames,
18
- * ensuring the browser has painted the current state before proceeding.
19
- * Used for CSS transition orchestration — the double-rAF guarantees the "from"
20
- * state is visible before transitioning to the "to" state.
13
+ * Completes after two animation frames, ensuring the browser has painted
14
+ * the current state before proceeding. Used for CSS transition orchestration —
15
+ * the double-rAF guarantees the "from" state is visible before transitioning
16
+ * to the "to" state.
21
17
  *
22
18
  * @example
23
19
  * ```typescript
24
- * Task.nextFrame(() => TransitionFrameAdvanced())
20
+ * Task.nextFrame.pipe(Effect.as(TransitionFrameAdvanced()))
25
21
  * ```
26
22
  */
27
- export const nextFrame = (f) => Effect.async(resume => {
23
+ export const nextFrame = Effect.async(resume => {
28
24
  requestAnimationFrame(() => {
29
25
  requestAnimationFrame(() => {
30
- resume(Effect.succeed(f()));
26
+ resume(Effect.void);
31
27
  });
32
28
  });
33
29
  });
34
30
  /**
35
- * Creates a command that waits for all CSS transitions on the element matching the selector
36
- * to complete, then resolves to a message. Uses the Web Animations API for reliable detection.
37
- * Falls back to resolving immediately if the element is missing or has no active transitions.
31
+ * Waits for all CSS transitions on the element matching the selector to complete.
32
+ * Uses the Web Animations API for reliable detection. Falls back to completing
33
+ * immediately if the element is missing or has no active transitions.
38
34
  *
39
35
  * @example
40
36
  * ```typescript
41
- * Task.waitForTransitions('#menu-items', () => TransitionEnded())
37
+ * Task.waitForTransitions('#menu-items').pipe(Effect.as(TransitionEnded()))
42
38
  * ```
43
39
  */
44
- export const waitForTransitions = (selector, f) => Effect.async(resume => {
40
+ export const waitForTransitions = (selector) => Effect.async(resume => {
45
41
  requestAnimationFrame(async () => {
46
42
  const element = document.querySelector(selector);
47
43
  const cssTransitions = element instanceof HTMLElement
@@ -50,6 +46,6 @@ export const waitForTransitions = (selector, f) => Effect.async(resume => {
50
46
  .filter(animation => 'transitionProperty' in animation)
51
47
  : [];
52
48
  await Promise.allSettled(cssTransitions.map(({ finished }) => finished));
53
- resume(Effect.succeed(f()));
49
+ resume(Effect.void);
54
50
  });
55
51
  });
@@ -1,6 +1,6 @@
1
1
  import { Schema as S } from 'effect';
2
+ import type { Command } from '../../command';
2
3
  import type { Html } from '../../html';
3
- import type { Command } from '../../runtime/runtime';
4
4
  /** Schema for the dialog component's state, tracking its unique ID and open/closed status. */
5
5
  export declare const Model: S.Struct<{
6
6
  id: typeof S.String;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,MAAM,IA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GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAIzC,6DAA6D;AAC7D,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC,CAAA;AAEF,yEAAyE;AACzE,eAAO,MAAM,IAAI,GAAI,QAAQ,UAAU,KAAG,KAGxC,CAAA;AAMF,0EAA0E;AAC1E,eAAO,MAAM,MAAM,GACjB,OAAO,KAAK,EACZ,SAAS,OAAO,KACf,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAkCvC,CAAA;AAIH,iGAAiG;AACjG,eAAO,MAAM,OAAO,GAAI,OAAO,KAAK,KAAG,MAA6B,CAAA;AAEpE,wGAAwG;AACxG,eAAO,MAAM,aAAa,GAAI,OAAO,KAAK,KAAG,MAAmC,CAAA;AAEhF,wDAAwD;AACxD,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,KAAK,EAAE,KAAK,CAAA;IACZ,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAA;IAC9C,YAAY,EAAE,IAAI,CAAA;IAClB,cAAc,EAAE,MAAM,CAAA;IACtB,iBAAiB,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAC,CAAA;AAEF,sGAAsG;AACtG,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IA6C3D,CAAA"}
@@ -1,4 +1,4 @@
1
- import { Match as M, Option, Schema as S } from 'effect';
1
+ import { Effect, Match as M, Option, Schema as S } from 'effect';
2
2
  import { html } from '../../html';
3
3
  import { m } from '../../message';
4
4
  import { evo } from '../../struct';
@@ -28,14 +28,14 @@ const dialogSelector = (id) => `#${id}`;
28
28
  /** Processes a dialog message and returns the next model and commands. */
29
29
  export const update = (model, message) => M.value(message).pipe(M.withReturnType(), M.tagsExhaustive({
30
30
  Opened: () => {
31
- const maybeShowCommand = Option.liftPredicate(Task.showModal(dialogSelector(model.id), () => NoOp()), () => !model.isOpen);
31
+ const maybeShowCommand = Option.liftPredicate(Task.showModal(dialogSelector(model.id)).pipe(Effect.ignore, Effect.as(NoOp())), () => !model.isOpen);
32
32
  return [
33
33
  evo(model, { isOpen: () => true }),
34
34
  Option.toArray(maybeShowCommand),
35
35
  ];
36
36
  },
37
37
  Closed: () => {
38
- const maybeCloseCommand = Option.liftPredicate(Task.closeModal(dialogSelector(model.id), () => NoOp()), () => model.isOpen);
38
+ const maybeCloseCommand = Option.liftPredicate(Task.closeModal(dialogSelector(model.id)).pipe(Effect.ignore, Effect.as(NoOp())), () => model.isOpen);
39
39
  return [
40
40
  evo(model, { isOpen: () => false }),
41
41
  Option.toArray(maybeCloseCommand),
@@ -1,6 +1,6 @@
1
1
  import { Schema as S } from 'effect';
2
+ import type { Command } from '../../command';
2
3
  import type { Html, TagName } from '../../html';
3
- import type { Command } from '../../runtime/runtime';
4
4
  /** Schema for the disclosure component's state, tracking its unique ID and open/closed status. */
5
5
  export declare const Model: S.Struct<{
6
6
  id: typeof S.String;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/disclosure/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAGxD,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAE/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAMpD,kGAAkG;AAClG,eAAO,MAAM,KAAK;;;EAGhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,iFAAiF;AACjF,eAAO,MAAM,OAAO,4DAAe,CAAA;AACnC,gFAAgF;AAChF,eAAO,MA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AAK,EACZ,SAAS,OAAO,KACf,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAkCvC,CAAA;AAIH,4DAA4D;AAC5D,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,KAAK,EAAE,KAAK,CAAA;IACZ,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,KAAK,OAAO,CAAA;IACxD,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,IAAI,CAAA;IACnB,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,IAAI,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAC,CAAA;AAEF,oGAAoG;AACpG,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IAyF3D,CAAA"}
@@ -1,4 +1,4 @@
1
- import { Match as M, Option, Schema as S } from 'effect';
1
+ import { Effect, Match as M, Option, Schema as S } from 'effect';
2
2
  import { html } from '../../html';
3
3
  import { m } from '../../message';
4
4
  import { evo } from '../../struct';
@@ -29,14 +29,14 @@ const panelId = (id) => `${id}-panel`;
29
29
  /** Processes a disclosure message and returns the next model and commands. */
30
30
  export const update = (model, message) => M.value(message).pipe(M.withReturnType(), M.tagsExhaustive({
31
31
  Toggled: () => {
32
- const maybeFocusCommand = Option.liftPredicate(Task.focus(`#${buttonId(model.id)}`, () => NoOp()), () => model.isOpen);
32
+ const maybeFocusCommand = Option.liftPredicate(Task.focus(`#${buttonId(model.id)}`).pipe(Effect.ignore, Effect.as(NoOp())), () => model.isOpen);
33
33
  return [
34
34
  evo(model, { isOpen: () => !model.isOpen }),
35
35
  Option.toArray(maybeFocusCommand),
36
36
  ];
37
37
  },
38
38
  Closed: () => {
39
- const maybeFocusCommand = Option.liftPredicate(Task.focus(`#${buttonId(model.id)}`, () => NoOp()), () => model.isOpen);
39
+ const maybeFocusCommand = Option.liftPredicate(Task.focus(`#${buttonId(model.id)}`).pipe(Effect.ignore, Effect.as(NoOp())), () => model.isOpen);
40
40
  return [
41
41
  evo(model, { isOpen: () => false }),
42
42
  Option.toArray(maybeFocusCommand),