foldkit 0.81.1 → 0.82.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 (200) hide show
  1. package/README.md +3 -3
  2. package/dist/calendar/calendarDate.d.ts +11 -11
  3. package/dist/calendar/calendarDate.d.ts.map +1 -1
  4. package/dist/calendar/calendarDate.js +14 -13
  5. package/dist/calendar/comparison.d.ts +3 -3
  6. package/dist/calendar/comparison.d.ts.map +1 -1
  7. package/dist/calendar/comparison.js +5 -5
  8. package/dist/calendar/info.d.ts +1 -1
  9. package/dist/calendar/info.d.ts.map +1 -1
  10. package/dist/calendar/info.js +9 -1
  11. package/dist/calendar/locale.d.ts +5 -5
  12. package/dist/calendar/locale.js +23 -2
  13. package/dist/command/index.d.ts +2 -2
  14. package/dist/command/index.d.ts.map +1 -1
  15. package/dist/devTools/overlay.d.ts.map +1 -1
  16. package/dist/devTools/overlay.js +49 -27
  17. package/dist/devTools/protocol.d.ts +192 -192
  18. package/dist/devTools/protocol.d.ts.map +1 -1
  19. package/dist/devTools/protocol.js +36 -12
  20. package/dist/devTools/serialize.d.ts.map +1 -1
  21. package/dist/devTools/serialize.js +4 -4
  22. package/dist/devTools/store.d.ts.map +1 -1
  23. package/dist/devTools/store.js +1 -2
  24. package/dist/devTools/submodelPath.d.ts +1 -1
  25. package/dist/devTools/summarize.d.ts +6 -6
  26. package/dist/devTools/summarize.d.ts.map +1 -1
  27. package/dist/devTools/summarize.js +6 -6
  28. package/dist/devTools/webSocketBridge.d.ts +1 -1
  29. package/dist/devTools/webSocketBridge.d.ts.map +1 -1
  30. package/dist/devTools/webSocketBridge.js +19 -18
  31. package/dist/fieldValidation/index.d.ts +11 -11
  32. package/dist/fieldValidation/index.d.ts.map +1 -1
  33. package/dist/fieldValidation/index.js +8 -7
  34. package/dist/file/error.d.ts +1 -1
  35. package/dist/file/file.d.ts +1 -1
  36. package/dist/file/file.js +1 -1
  37. package/dist/file/reader.d.ts +4 -4
  38. package/dist/file/reader.js +5 -5
  39. package/dist/file/select.js +1 -1
  40. package/dist/html/index.d.ts.map +1 -1
  41. package/dist/html/index.js +4 -3
  42. package/dist/html/lazy.d.ts.map +1 -1
  43. package/dist/html/lazy.js +6 -7
  44. package/dist/managedResource/index.d.ts +2 -2
  45. package/dist/managedResource/index.d.ts.map +1 -1
  46. package/dist/managedResource/index.js +2 -2
  47. package/dist/mount/index.d.ts +1 -1
  48. package/dist/mount/index.d.ts.map +1 -1
  49. package/dist/route/parser.d.ts +2 -2
  50. package/dist/route/parser.d.ts.map +1 -1
  51. package/dist/route/parser.js +5 -5
  52. package/dist/runtime/browserListeners.d.ts.map +1 -1
  53. package/dist/runtime/browserListeners.js +6 -7
  54. package/dist/runtime/deepFreeze.d.ts +1 -1
  55. package/dist/runtime/deepFreeze.js +2 -2
  56. package/dist/runtime/hmrProtocol.d.ts +22 -0
  57. package/dist/runtime/hmrProtocol.d.ts.map +1 -0
  58. package/dist/runtime/hmrProtocol.js +15 -0
  59. package/dist/runtime/hmrProtocolPublic.d.ts +2 -0
  60. package/dist/runtime/hmrProtocolPublic.d.ts.map +1 -0
  61. package/dist/runtime/hmrProtocolPublic.js +1 -0
  62. package/dist/runtime/runtime.d.ts +10 -7
  63. package/dist/runtime/runtime.d.ts.map +1 -1
  64. package/dist/runtime/runtime.js +116 -114
  65. package/dist/runtime/subscription.d.ts +5 -5
  66. package/dist/runtime/subscription.d.ts.map +1 -1
  67. package/dist/runtime/urlRequest.d.ts +15 -15
  68. package/dist/runtime/urlRequest.d.ts.map +1 -1
  69. package/dist/runtime/urlRequest.js +1 -1
  70. package/dist/schema/index.d.ts +3 -3
  71. package/dist/schema/index.d.ts.map +1 -1
  72. package/dist/schema/index.js +10 -4
  73. package/dist/task/dom.js +1 -1
  74. package/dist/task/elementMovement.js +1 -1
  75. package/dist/task/error.d.ts +2 -2
  76. package/dist/task/inert.d.ts.map +1 -1
  77. package/dist/task/inert.js +4 -7
  78. package/dist/task/time.d.ts +1 -1
  79. package/dist/task/time.js +1 -1
  80. package/dist/task/timing.d.ts +1 -1
  81. package/dist/task/timing.d.ts.map +1 -1
  82. package/dist/task/timing.js +2 -2
  83. package/dist/test/apps/bubbling.d.ts +3 -3
  84. package/dist/test/apps/bubbling.d.ts.map +1 -1
  85. package/dist/test/apps/bubbling.js +1 -1
  86. package/dist/test/apps/counter.d.ts +6 -6
  87. package/dist/test/apps/counter.d.ts.map +1 -1
  88. package/dist/test/apps/counter.js +7 -1
  89. package/dist/test/apps/disabledButton.d.ts +11 -11
  90. package/dist/test/apps/disabledButton.d.ts.map +1 -1
  91. package/dist/test/apps/disabledButton.js +1 -1
  92. package/dist/test/apps/fileUpload.d.ts +4 -4
  93. package/dist/test/apps/fileUpload.d.ts.map +1 -1
  94. package/dist/test/apps/fileUpload.js +1 -1
  95. package/dist/test/apps/formChild.d.ts +16 -16
  96. package/dist/test/apps/formChild.d.ts.map +1 -1
  97. package/dist/test/apps/formChild.js +9 -4
  98. package/dist/test/apps/interactions.d.ts +8 -8
  99. package/dist/test/apps/interactions.d.ts.map +1 -1
  100. package/dist/test/apps/interactions.js +8 -1
  101. package/dist/test/apps/keypress.d.ts +7 -7
  102. package/dist/test/apps/keypress.d.ts.map +1 -1
  103. package/dist/test/apps/keypress.js +1 -1
  104. package/dist/test/apps/login.d.ts +14 -14
  105. package/dist/test/apps/login.d.ts.map +1 -1
  106. package/dist/test/apps/login.js +9 -2
  107. package/dist/test/apps/logoutButton.d.ts +3 -3
  108. package/dist/test/apps/logoutButton.d.ts.map +1 -1
  109. package/dist/test/apps/logoutButton.js +2 -2
  110. package/dist/test/apps/multiRole.d.ts +2 -2
  111. package/dist/test/apps/multiRole.d.ts.map +1 -1
  112. package/dist/test/apps/multiRole.js +1 -1
  113. package/dist/test/apps/pointer.d.ts +6 -6
  114. package/dist/test/apps/pointer.d.ts.map +1 -1
  115. package/dist/test/apps/pointer.js +1 -1
  116. package/dist/test/apps/resumeUpload.d.ts +8 -8
  117. package/dist/test/apps/resumeUpload.d.ts.map +1 -1
  118. package/dist/test/apps/resumeUpload.js +12 -5
  119. package/dist/test/internal.js +10 -10
  120. package/dist/test/matchers.js +1 -1
  121. package/dist/test/query.d.ts.map +1 -1
  122. package/dist/test/query.js +13 -13
  123. package/dist/test/scene.d.ts.map +1 -1
  124. package/dist/test/scene.js +3 -3
  125. package/dist/test/story.js +1 -1
  126. package/dist/ui/animation/schema.d.ts +5 -5
  127. package/dist/ui/animation/schema.d.ts.map +1 -1
  128. package/dist/ui/animation/schema.js +9 -3
  129. package/dist/ui/calendar/index.d.ts +77 -77
  130. package/dist/ui/calendar/index.d.ts.map +1 -1
  131. package/dist/ui/calendar/index.js +26 -11
  132. package/dist/ui/checkbox/index.d.ts +2 -2
  133. package/dist/ui/combobox/multi.d.ts +38 -42
  134. package/dist/ui/combobox/multi.d.ts.map +1 -1
  135. package/dist/ui/combobox/multi.js +4 -1
  136. package/dist/ui/combobox/shared.d.ts +31 -31
  137. package/dist/ui/combobox/shared.d.ts.map +1 -1
  138. package/dist/ui/combobox/shared.js +34 -12
  139. package/dist/ui/combobox/single.d.ts +39 -43
  140. package/dist/ui/combobox/single.d.ts.map +1 -1
  141. package/dist/ui/combobox/single.js +7 -6
  142. package/dist/ui/datePicker/index.d.ts +86 -86
  143. package/dist/ui/datePicker/index.d.ts.map +1 -1
  144. package/dist/ui/datePicker/index.js +10 -3
  145. package/dist/ui/dialog/index.d.ts +8 -8
  146. package/dist/ui/dialog/index.d.ts.map +1 -1
  147. package/dist/ui/dialog/index.js +9 -3
  148. package/dist/ui/disclosure/index.d.ts +2 -2
  149. package/dist/ui/disclosure/index.d.ts.map +1 -1
  150. package/dist/ui/disclosure/index.js +1 -1
  151. package/dist/ui/dragAndDrop/index.d.ts +76 -76
  152. package/dist/ui/dragAndDrop/index.d.ts.map +1 -1
  153. package/dist/ui/dragAndDrop/index.js +47 -29
  154. package/dist/ui/fileDrop/index.d.ts +8 -8
  155. package/dist/ui/fileDrop/index.d.ts.map +1 -1
  156. package/dist/ui/fileDrop/index.js +7 -2
  157. package/dist/ui/listbox/multi.d.ts +36 -40
  158. package/dist/ui/listbox/multi.d.ts.map +1 -1
  159. package/dist/ui/listbox/multi.js +4 -1
  160. package/dist/ui/listbox/shared.d.ts +32 -32
  161. package/dist/ui/listbox/shared.d.ts.map +1 -1
  162. package/dist/ui/listbox/shared.js +36 -11
  163. package/dist/ui/listbox/single.d.ts +36 -40
  164. package/dist/ui/listbox/single.d.ts.map +1 -1
  165. package/dist/ui/listbox/single.js +5 -2
  166. package/dist/ui/menu/index.d.ts +40 -40
  167. package/dist/ui/menu/index.d.ts.map +1 -1
  168. package/dist/ui/menu/index.js +38 -11
  169. package/dist/ui/popover/index.d.ts +12 -12
  170. package/dist/ui/popover/index.d.ts.map +1 -1
  171. package/dist/ui/popover/index.js +17 -2
  172. package/dist/ui/radioGroup/index.d.ts +6 -6
  173. package/dist/ui/radioGroup/index.d.ts.map +1 -1
  174. package/dist/ui/radioGroup/index.js +5 -5
  175. package/dist/ui/slider/index.d.ts +26 -26
  176. package/dist/ui/slider/index.d.ts.map +1 -1
  177. package/dist/ui/slider/index.js +30 -16
  178. package/dist/ui/switch/index.d.ts +2 -2
  179. package/dist/ui/tabs/index.d.ts +8 -8
  180. package/dist/ui/tabs/index.d.ts.map +1 -1
  181. package/dist/ui/tabs/index.js +3 -3
  182. package/dist/ui/toast/index.d.ts +75 -75
  183. package/dist/ui/toast/index.d.ts.map +1 -1
  184. package/dist/ui/toast/index.js +1 -1
  185. package/dist/ui/toast/schema.d.ts +63 -63
  186. package/dist/ui/toast/schema.d.ts.map +1 -1
  187. package/dist/ui/toast/schema.js +19 -4
  188. package/dist/ui/toast/update.d.ts +67 -67
  189. package/dist/ui/toast/update.d.ts.map +1 -1
  190. package/dist/ui/toast/update.js +2 -2
  191. package/dist/ui/tooltip/index.d.ts +15 -15
  192. package/dist/ui/tooltip/index.d.ts.map +1 -1
  193. package/dist/ui/tooltip/index.js +14 -4
  194. package/dist/ui/virtualList/index.d.ts +16 -16
  195. package/dist/ui/virtualList/index.d.ts.map +1 -1
  196. package/dist/ui/virtualList/index.js +46 -42
  197. package/dist/url/index.d.ts +8 -8
  198. package/dist/url/index.d.ts.map +1 -1
  199. package/dist/url/index.js +14 -14
  200. package/package.json +11 -7
@@ -1,4 +1,4 @@
1
- import { Array, Effect, Match as M, Number, Option, Schema as S, Stream, pipe, } from 'effect';
1
+ import { Array, Effect, Match as M, Number, Option, Queue, Schema as S, Stream, pipe, } from 'effect';
2
2
  import * as Command from '../../command/index.js';
3
3
  import { createLazy, html, } from '../../html/index.js';
4
4
  import { m } from '../../message/index.js';
@@ -15,14 +15,14 @@ const Measured = ts('Measured', { containerHeight: S.Number });
15
15
  * `Unmeasured` explicitly, typically by rendering a placeholder until the
16
16
  * first measurement arrives.
17
17
  */
18
- const Measurement = S.Union(Unmeasured, Measured);
18
+ const Measurement = S.Union([Unmeasured, Measured]);
19
19
  const Idle = ts('Idle');
20
20
  const ScrollingToIndex = ts('ScrollingToIndex', {
21
21
  index: S.Number,
22
22
  version: S.Number,
23
23
  });
24
24
  /** State of a programmatic scroll initiated by `scrollToIndex`. */
25
- const PendingScroll = S.Union(Idle, ScrollingToIndex);
25
+ const PendingScroll = S.Union([Idle, ScrollingToIndex]);
26
26
  /** Schema for the virtual list's state. Tracks scroll position, container
27
27
  * measurement, and any in-flight programmatic scroll. */
28
28
  export const Model = S.Struct({
@@ -50,7 +50,7 @@ export const CompletedApplyScroll = m('CompletedApplyScroll', {
50
50
  version: S.Number,
51
51
  });
52
52
  /** Union of all messages the virtual list component can produce. */
53
- export const Message = S.Union(ScrolledContainer, MeasuredContainer, CompletedApplyScroll);
53
+ export const Message = S.Union([ScrolledContainer, MeasuredContainer, CompletedApplyScroll]);
54
54
  /** Creates an initial virtual list model from a config. The container starts
55
55
  * in `Unmeasured` state. The first `ResizeObserver` entry transitions it to
56
56
  * `Measured`. */
@@ -204,11 +204,11 @@ export const visibleWindowVariable = (model, items, itemToRowHeightPx, overscan)
204
204
  const itemCount = items.length;
205
205
  const cumulativeOffsets = prefixSum(items, itemToRowHeightPx);
206
206
  const totalHeight = lastOrZero(cumulativeOffsets);
207
- const firstVisibleIndex = pipe(cumulativeOffsets, Array.findFirstIndex(Number.greaterThan(model.scrollTop)), Option.match({
207
+ const firstVisibleIndex = pipe(cumulativeOffsets, Array.findFirstIndex(Number.isGreaterThan(model.scrollTop)), Option.match({
208
208
  onNone: () => itemCount,
209
209
  onSome: index => Math.max(0, index - 1),
210
210
  }));
211
- const lastVisibleIndex = pipe(cumulativeOffsets, Array.findFirstIndex(Number.greaterThanOrEqualTo(model.scrollTop + containerHeight)), Option.getOrElse(() => itemCount));
211
+ const lastVisibleIndex = pipe(cumulativeOffsets, Array.findFirstIndex(Number.isGreaterThanOrEqualTo(model.scrollTop + containerHeight)), Option.getOrElse(() => itemCount));
212
212
  const startIndex = clampIndex(firstVisibleIndex - overscan, itemCount);
213
213
  const endIndex = clampIndex(lastVisibleIndex + overscan, itemCount);
214
214
  const topSpacerHeight = pipe(cumulativeOffsets, Array.get(startIndex), Option.getOrElse(() => 0));
@@ -223,7 +223,7 @@ export const visibleWindowVariable = (model, items, itemToRowHeightPx, overscan)
223
223
  },
224
224
  }));
225
225
  // SUBSCRIPTION
226
- const containerElement = (id) => Option.fromNullable(document.getElementById(id));
226
+ const containerElement = (id) => Option.fromNullishOr(document.getElementById(id));
227
227
  /** Schema describing the subscription dependencies for container scroll and
228
228
  * resize tracking. */
229
229
  export const SubscriptionDeps = S.Struct({
@@ -247,46 +247,49 @@ export const SubscriptionDeps = S.Struct({
247
247
  export const subscriptions = makeSubscriptions(SubscriptionDeps)({
248
248
  containerEvents: {
249
249
  modelToDependencies: model => ({ id: model.id }),
250
- dependenciesToStream: ({ id }) => Stream.async(emit => {
251
- let scrollListener = null;
252
- let resizeObserver = null;
253
- let observedElement = null;
254
- let pendingFrame = null;
250
+ dependenciesToStream: ({ id }) => Stream.callback(queue => Effect.acquireRelease(Effect.sync(() => {
251
+ const state = {
252
+ scrollListener: null,
253
+ resizeObserver: null,
254
+ observedElement: null,
255
+ pendingFrame: null,
256
+ };
255
257
  const detach = () => {
256
- if (resizeObserver !== null) {
257
- resizeObserver.disconnect();
258
- resizeObserver = null;
258
+ if (state.resizeObserver !== null) {
259
+ state.resizeObserver.disconnect();
260
+ state.resizeObserver = null;
259
261
  }
260
- if (observedElement !== null && scrollListener !== null) {
261
- observedElement.removeEventListener('scroll', scrollListener);
262
+ if (state.observedElement !== null &&
263
+ state.scrollListener !== null) {
264
+ state.observedElement.removeEventListener('scroll', state.scrollListener);
262
265
  }
263
- observedElement = null;
264
- scrollListener = null;
266
+ state.observedElement = null;
267
+ state.scrollListener = null;
265
268
  };
266
269
  const attach = (element) => {
267
- const listener = () => emit.single(ScrolledContainer({ scrollTop: element.scrollTop }));
270
+ const listener = () => Queue.offerUnsafe(queue, ScrolledContainer({ scrollTop: element.scrollTop }));
268
271
  element.addEventListener('scroll', listener, { passive: true });
269
- scrollListener = listener;
270
- observedElement = element;
271
- resizeObserver = new ResizeObserver(entries => {
272
+ state.scrollListener = listener;
273
+ state.observedElement = element;
274
+ state.resizeObserver = new ResizeObserver(entries => {
272
275
  const lastEntry = Array.last(entries);
273
276
  if (Option.isSome(lastEntry)) {
274
- emit.single(MeasuredContainer({
277
+ Queue.offerUnsafe(queue, MeasuredContainer({
275
278
  containerHeight: lastEntry.value.contentRect.height,
276
279
  }));
277
280
  }
278
281
  });
279
- resizeObserver.observe(element);
282
+ state.resizeObserver.observe(element);
280
283
  };
281
284
  const reconcile = () => {
282
285
  const maybeElement = containerElement(id);
283
286
  if (Option.isNone(maybeElement)) {
284
- if (observedElement !== null) {
287
+ if (state.observedElement !== null) {
285
288
  detach();
286
289
  }
287
290
  return;
288
291
  }
289
- if (observedElement === maybeElement.value) {
292
+ if (state.observedElement === maybeElement.value) {
290
293
  return;
291
294
  }
292
295
  detach();
@@ -295,16 +298,17 @@ export const subscriptions = makeSubscriptions(SubscriptionDeps)({
295
298
  reconcile();
296
299
  // NOTE: observes the entire document subtree because the container
297
300
  // can be inserted/removed by any parent the consumer chooses (route
298
- // changes, conditional renders, modal mounts), and the framework has
299
- // no way to know that hierarchy in advance. Reconcile is gated by rAF
300
- // and short-circuits when the cached observedElement is still in the
301
- // DOM, so per-mutation cost stays low even with subtree: true.
301
+ // changes, conditional renders, modal mounts), and the framework
302
+ // has no way to know that hierarchy in advance. Reconcile is gated
303
+ // by rAF and short-circuits when the cached observedElement is
304
+ // still in the DOM, so per-mutation cost stays low even with
305
+ // subtree: true.
302
306
  const mutationObserver = new MutationObserver(() => {
303
- if (pendingFrame !== null) {
307
+ if (state.pendingFrame !== null) {
304
308
  return;
305
309
  }
306
- pendingFrame = requestAnimationFrame(() => {
307
- pendingFrame = null;
310
+ state.pendingFrame = requestAnimationFrame(() => {
311
+ state.pendingFrame = null;
308
312
  reconcile();
309
313
  });
310
314
  });
@@ -312,14 +316,14 @@ export const subscriptions = makeSubscriptions(SubscriptionDeps)({
312
316
  childList: true,
313
317
  subtree: true,
314
318
  });
315
- return Effect.sync(() => {
316
- mutationObserver.disconnect();
317
- if (pendingFrame !== null) {
318
- cancelAnimationFrame(pendingFrame);
319
- }
320
- detach();
321
- });
322
- }),
319
+ return { state, detach, mutationObserver };
320
+ }), ({ state, detach, mutationObserver }) => Effect.sync(() => {
321
+ mutationObserver.disconnect();
322
+ if (state.pendingFrame !== null) {
323
+ cancelAnimationFrame(state.pendingFrame);
324
+ }
325
+ detach();
326
+ })).pipe(Effect.flatMap(() => Effect.never))),
323
327
  },
324
328
  });
325
329
  // VIEW
@@ -1,22 +1,22 @@
1
1
  import { Option, Schema as S } from 'effect';
2
2
  /** Schema representing a parsed URL with protocol, host, port, pathname, search, and hash fields. */
3
3
  export declare const Url: S.Struct<{
4
- protocol: typeof S.String;
5
- host: typeof S.String;
6
- port: S.OptionFromSelf<typeof S.String>;
7
- pathname: typeof S.String;
8
- search: S.OptionFromSelf<typeof S.String>;
9
- hash: S.OptionFromSelf<typeof S.String>;
4
+ readonly protocol: S.String;
5
+ readonly host: S.String;
6
+ readonly port: S.Option<S.String>;
7
+ readonly pathname: S.String;
8
+ readonly search: S.Option<S.String>;
9
+ readonly hash: S.Option<S.String>;
10
10
  }>;
11
11
  export type Url = typeof Url.Type;
12
12
  /** Parses a URL string into a `Url`, returning `Option.None` if invalid. */
13
13
  export declare const fromString: (str: string) => Option.Option<{
14
14
  readonly search: Option.Option<string>;
15
+ readonly port: Option.Option<string>;
16
+ readonly hash: Option.Option<string>;
15
17
  readonly protocol: string;
16
18
  readonly host: string;
17
- readonly port: Option.Option<string>;
18
19
  readonly pathname: string;
19
- readonly hash: Option.Option<string>;
20
20
  }>;
21
21
  /** Serializes a `Url` back to a string. */
22
22
  export declare const toString: (url: Url) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/url/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAe,MAAM,IAAI,CAAC,EAAU,MAAM,QAAQ,CAAA;AAIzE,qGAAqG;AACrG,eAAO,MAAM,GAAG;;;;;;;EAOd,CAAA;AACF,MAAM,MAAM,GAAG,GAAG,OAAO,GAAG,CAAC,IAAI,CAAA;AA+EjC,4EAA4E;AAC5E,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM;;;;;;;EAAuC,CAAA;AAC7E,2CAA2C;AAC3C,eAAO,MAAM,QAAQ,GAAI,KAAK,GAAG,WAAqC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/url/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EACN,MAAM,IAAI,CAAC,EAIZ,MAAM,QAAQ,CAAA;AAIf,qGAAqG;AACrG,eAAO,MAAM,GAAG;;;;;;;EAOd,CAAA;AACF,MAAM,MAAM,GAAG,GAAG,OAAO,GAAG,CAAC,IAAI,CAAA;AAwFjC,4EAA4E;AAC5E,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM;;;;;;;EAAuC,CAAA;AAC7E,2CAA2C;AAC3C,eAAO,MAAM,QAAQ,GAAI,KAAK,GAAG,WAAqC,CAAA"}
package/dist/url/index.js CHANGED
@@ -1,13 +1,13 @@
1
- import { Effect, Option, ParseResult, Schema as S, String } from 'effect';
1
+ import { Effect, Option, Schema as S, SchemaIssue, SchemaTransformation, String, } from 'effect';
2
2
  import { OptionExt } from '../effectExtensions/index.js';
3
3
  /** Schema representing a parsed URL with protocol, host, port, pathname, search, and hash fields. */
4
4
  export const Url = S.Struct({
5
5
  protocol: S.String,
6
6
  host: S.String,
7
- port: S.OptionFromSelf(S.String),
7
+ port: S.Option(S.String),
8
8
  pathname: S.String,
9
- search: S.OptionFromSelf(S.String),
10
- hash: S.OptionFromSelf(S.String),
9
+ search: S.Option(S.String),
10
+ hash: S.Option(S.String),
11
11
  });
12
12
  const LocationAndHref = S.Struct({
13
13
  href: S.String,
@@ -17,9 +17,8 @@ const LocationAndHref = S.Struct({
17
17
  port: S.String,
18
18
  }),
19
19
  });
20
- const LocationAndHrefFromString = S.transformOrFail(S.String, LocationAndHref, {
21
- strict: true,
22
- decode: (urlString, _options, ast) => Effect.try({
20
+ const LocationAndHrefFromString = S.String.pipe(S.decodeTo(LocationAndHref, SchemaTransformation.transformOrFail({
21
+ decode: urlString => Effect.try({
23
22
  try: () => {
24
23
  const url = new URL(urlString);
25
24
  return {
@@ -31,15 +30,16 @@ const LocationAndHrefFromString = S.transformOrFail(S.String, LocationAndHref, {
31
30
  },
32
31
  };
33
32
  },
34
- catch: error => new ParseResult.Type(ast, urlString, `Invalid URL: ${error}`),
33
+ catch: () => new SchemaIssue.InvalidValue(Option.some(urlString), {
34
+ description: `Invalid URL: ${urlString}`,
35
+ }),
35
36
  }),
36
37
  encode: ({ href, location }) => {
37
38
  const portString = location.port ? `:${location.port}` : '';
38
- return ParseResult.succeed(`${location.protocol}//${location.host}${portString}${href}`);
39
+ return Effect.succeed(`${location.protocol}//${location.host}${portString}${href}`);
39
40
  },
40
- });
41
- const UrlFromLocationAndHref = S.transform(LocationAndHref, Url, {
42
- strict: true,
41
+ })));
42
+ const UrlFromLocationAndHref = LocationAndHref.pipe(S.decodeTo(Url, SchemaTransformation.transform({
43
43
  decode: ({ href, location }) => {
44
44
  const [pathAndQuery, hashPart] = String.split(href, '#');
45
45
  const [pathname, searchPart] = String.split(pathAndQuery, '?');
@@ -71,8 +71,8 @@ const UrlFromLocationAndHref = S.transform(LocationAndHref, Url, {
71
71
  },
72
72
  };
73
73
  },
74
- });
75
- const UrlFromString = S.compose(LocationAndHrefFromString, UrlFromLocationAndHref);
74
+ })));
75
+ const UrlFromString = LocationAndHrefFromString.pipe(S.decodeTo(UrlFromLocationAndHref));
76
76
  /** Parses a URL string into a `Url`, returning `Option.None` if invalid. */
77
77
  export const fromString = (str) => S.decodeOption(UrlFromString)(str);
78
78
  /** Serializes a `Url` back to a string. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "foldkit",
3
- "version": "0.81.1",
4
- "description": "A frontend framework for TypeScript, built on Effect, using The Elm Architecture",
3
+ "version": "0.82.0",
4
+ "description": "A TypeScript frontend framework, built on Effect and architected like Elm",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
@@ -47,6 +47,10 @@
47
47
  "types": "./dist/runtime/public.d.ts",
48
48
  "import": "./dist/runtime/public.js"
49
49
  },
50
+ "./hmr-protocol": {
51
+ "types": "./dist/runtime/hmrProtocolPublic.d.ts",
52
+ "import": "./dist/runtime/hmrProtocolPublic.js"
53
+ },
50
54
  "./fieldValidation": {
51
55
  "types": "./dist/fieldValidation/public.d.ts",
52
56
  "import": "./dist/fieldValidation/public.js"
@@ -180,13 +184,13 @@
180
184
  "dist"
181
185
  ],
182
186
  "peerDependencies": {
183
- "@effect/platform-browser": "^0.74.0",
184
- "effect": "^3.18.2"
187
+ "@effect/platform-browser": "4.0.0-beta.59",
188
+ "effect": "4.0.0-beta.59"
185
189
  },
186
190
  "devDependencies": {
187
- "@effect/platform-browser": "^0.74.0",
188
- "@effect/vitest": "^0.27.0",
189
- "effect": "^3.19.19",
191
+ "@effect/platform-browser": "4.0.0-beta.59",
192
+ "@effect/vitest": "4.0.0-beta.59",
193
+ "effect": "4.0.0-beta.59",
190
194
  "happy-dom": "^18.0.1",
191
195
  "typescript": "^6.0.2",
192
196
  "vitest": "^3.2.4"