foldkit 0.159.0 → 0.160.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.
- package/dist/calendar/calendarDate.js +1 -1
- package/dist/command/index.d.ts +10 -8
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +8 -6
- package/dist/mount/index.d.ts +2 -2
- package/dist/runtime/start.d.ts.map +1 -1
- package/dist/runtime/start.js +3 -14
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +21 -16
- package/dist/subscription/fromEvent.d.ts +106 -14
- package/dist/subscription/fromEvent.d.ts.map +1 -1
- package/dist/subscription/fromEvent.js +93 -12
- package/dist/subscription/public.d.ts +2 -2
- package/dist/subscription/public.d.ts.map +1 -1
- package/dist/subscription/public.js +1 -1
- package/dist/test/vitest.d.ts +2 -2
- package/dist/test/vitest.d.ts.map +1 -1
- package/dist/test/vitest.js +1 -1
- package/dist/url/index.js +1 -1
- package/package.json +8 -6
|
@@ -178,7 +178,7 @@ const isoPattern = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
|
178
178
|
* encode(Calendar.make(2026, 4, 13)) // "2026-04-13"
|
|
179
179
|
* ```
|
|
180
180
|
*/
|
|
181
|
-
export const CalendarDateFromIsoString = Schema.String.pipe(Schema.decodeTo(CalendarDate, SchemaTransformation.
|
|
181
|
+
export const CalendarDateFromIsoString = Schema.String.pipe(Schema.decodeTo(CalendarDate, SchemaTransformation.transformEffect({
|
|
182
182
|
decode: input => {
|
|
183
183
|
const match = input.match(isoPattern);
|
|
184
184
|
if (match === null) {
|
package/dist/command/index.d.ts
CHANGED
|
@@ -172,18 +172,20 @@ export declare function define<const Name extends string, const Messages extends
|
|
|
172
172
|
interrupt?: never;
|
|
173
173
|
execute: Eff;
|
|
174
174
|
}>): CommandDefinitionNoArgs<Name, Eff>;
|
|
175
|
-
/** Transforms the Effect inside a Command while preserving its
|
|
176
|
-
* message-mapping chain. Reach for this to
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
175
|
+
/** Transforms the Effect inside a Command while preserving its result Message,
|
|
176
|
+
* name, args, and message-mapping chain. Reach for this to provide a service,
|
|
177
|
+
* add a delay or retry, or change the error or requirement channel. Its type
|
|
178
|
+
* prevents the transform from changing the result Message. Never use it to
|
|
179
|
+
* lift that Message, even via
|
|
180
|
+
* `Effect.map(message => Message.GotChildMessage({ message }))`. That dispatches
|
|
180
181
|
* correctly in production but is invisible to `Story`/`Scene` `resolve`, which
|
|
181
182
|
* replays only the recorded chain and never runs the Effect, so the test would
|
|
182
183
|
* see the child's raw Message instead of the wrapped one. Lift result Messages
|
|
183
|
-
* with {@link mapMessage} / {@link mapMessages}, which record the lift.
|
|
184
|
+
* with {@link mapMessage} / {@link mapMessages}, which record the lift. The
|
|
185
|
+
* `foldkit/prefer-command-mapmessage` lint rule flags this misuse. */
|
|
184
186
|
export declare const mapEffect: {
|
|
185
|
-
<A, E1, R1,
|
|
186
|
-
<A, E1, R1,
|
|
187
|
+
<A, E1, R1, E2, R2>(f: (effect: Effect.Effect<A, E1, R1>) => Effect.Effect<NoInfer<A>, E2, R2>): (command: Command<A, E1, R1>) => Command<A, E2, R2>;
|
|
188
|
+
<A, E1, R1, E2, R2>(command: Command<A, E1, R1>, f: (effect: Effect.Effect<A, E1, R1>) => Effect.Effect<NoInfer<A>, E2, R2>): Command<A, E2, R2>;
|
|
187
189
|
};
|
|
188
190
|
/** Lifts a single Command's result Message through `f`, transforming
|
|
189
191
|
* `FromMessage` to `ToMessage`. The singular complement to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAA+B,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE3E,OAAO,EAAE,uBAAuB,EAAqB,MAAM,YAAY,CAAA;AACvE,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAA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EAAE,CAAC,CAAC,CAAA;CA4B9B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CA4B2C;AAC3C,eAAO,MAAM,WAAW,EAAE;IACxB,CAAC,WAAW,EAAE,SAAS,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,KAAK,EAC3C,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,EAC/D,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,SAAS,GACrC,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAC1C,CAAC,WAAW,EAAE,SAAS,EACrB,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,SAAS,GACrC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,KAAK,EACtB,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,KAC5D,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;CAQ7C,CAAA"}
|
package/dist/command/index.js
CHANGED
|
@@ -87,15 +87,17 @@ export function define(name, config) {
|
|
|
87
87
|
});
|
|
88
88
|
return definition;
|
|
89
89
|
}
|
|
90
|
-
/** Transforms the Effect inside a Command while preserving its
|
|
91
|
-
* message-mapping chain. Reach for this to
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
90
|
+
/** Transforms the Effect inside a Command while preserving its result Message,
|
|
91
|
+
* name, args, and message-mapping chain. Reach for this to provide a service,
|
|
92
|
+
* add a delay or retry, or change the error or requirement channel. Its type
|
|
93
|
+
* prevents the transform from changing the result Message. Never use it to
|
|
94
|
+
* lift that Message, even via
|
|
95
|
+
* `Effect.map(message => Message.GotChildMessage({ message }))`. That dispatches
|
|
95
96
|
* correctly in production but is invisible to `Story`/`Scene` `resolve`, which
|
|
96
97
|
* replays only the recorded chain and never runs the Effect, so the test would
|
|
97
98
|
* see the child's raw Message instead of the wrapped one. Lift result Messages
|
|
98
|
-
* with {@link mapMessage} / {@link mapMessages}, which record the lift.
|
|
99
|
+
* with {@link mapMessage} / {@link mapMessages}, which record the lift. The
|
|
100
|
+
* `foldkit/prefer-command-mapmessage` lint rule flags this misuse. */
|
|
99
101
|
export const mapEffect = Function.dual(2, (command, f) => ({ ...command, effect: f(command.effect) }));
|
|
100
102
|
/** Lifts a single Command's result Message through `f`, transforming
|
|
101
103
|
* `FromMessage` to `ToMessage`. The singular complement to
|
package/dist/mount/index.d.ts
CHANGED
|
@@ -225,8 +225,8 @@ export declare const liveViewStateChanges: Stream.Stream<ViewState>;
|
|
|
225
225
|
* document events, library callbacks), not from Model state itself.
|
|
226
226
|
* Translating Model changes into side effects is what `update` does on
|
|
227
227
|
* every Message, via the Commands it returns. (Subscriptions do legitimately
|
|
228
|
-
* touch the DOM in some contexts: calling `preventDefault` in
|
|
229
|
-
* handler where going through `update` would arrive too late, or
|
|
228
|
+
* touch the DOM in some contexts: calling `preventDefault` in a non-passive
|
|
229
|
+
* event handler where going through `update` would arrive too late, or
|
|
230
230
|
* maintaining DOM state for as long as a Model condition is true (like
|
|
231
231
|
* applying `user-select: none` to the document while a drag is in progress
|
|
232
232
|
* and undoing it when the drag ends).)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/runtime/start.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/runtime/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAA2C,MAAM,QAAQ,CAAA;AAI/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAE7C,OAAO,EACL,KAAK,WAAW,EAGjB,MAAM,oB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from 'effect';
|
|
2
|
+
import { BrowserRuntime } from '@effect/platform-browser';
|
|
2
3
|
import { provideBrowserScheduler } from './browserScheduler.js';
|
|
3
4
|
import { buildPortHandles, makeHostConnector, } from './hostConnector.js';
|
|
4
5
|
import { resolvePreservedModel } from './modelPreservationBridge.js';
|
|
@@ -17,18 +18,6 @@ export const __startProgram = (program, preservedModel, bootMode, flags, buildId
|
|
|
17
18
|
}
|
|
18
19
|
return internals.startWith(Option.none(), preservedModel, bootMode, flags, buildId);
|
|
19
20
|
};
|
|
20
|
-
// NOTE: deliberately not `BrowserRuntime.runMain`, which interrupts the
|
|
21
|
-
// runtime on `beforeunload`. `beforeunload` is a question, not a commitment:
|
|
22
|
-
// the browser also fires it for a click on a download link, for a navigation
|
|
23
|
-
// the user cancels, and when freezing the page into the back/forward cache.
|
|
24
|
-
// The document survives all three, but the interrupt finalizer has already
|
|
25
|
-
// put the container element back empty, so the page is left alive with no app
|
|
26
|
-
// in it. A page-owning runtime gains nothing from tearing itself down while
|
|
27
|
-
// the document is on its way out, so it starts with no page-lifecycle
|
|
28
|
-
// interrupt at all and lets the document take the runtime with it. The
|
|
29
|
-
// keep-alive interval still comes from `makeRunMain`; Foldkit owns the shared
|
|
30
|
-
// error-reporting policy used by page-owning and embedded runtimes below.
|
|
31
|
-
const runMainWithoutUnloadInterrupt = Runtime.makeRunMain(Function.constVoid);
|
|
32
21
|
/** Reports unhandled non-interrupt Causes using Effect's runtime policy.
|
|
33
22
|
* @internal */
|
|
34
23
|
export const __reportUnhandledCause = (cause) => {
|
|
@@ -41,7 +30,7 @@ export const __reportUnhandledCause = (cause) => {
|
|
|
41
30
|
};
|
|
42
31
|
const withUnhandledCauseReporting = (effect) => Effect.tapCause(effect, __reportUnhandledCause);
|
|
43
32
|
const startProgram = (program, bootMode, flags, buildId) => {
|
|
44
|
-
|
|
33
|
+
BrowserRuntime.runMain(withUnhandledCauseReporting(provideBrowserScheduler(Effect.flatMap(resolvePreservedModel(program.runtimeId), preservedModel => __startProgram(program, preservedModel, bootMode, flags, buildId)))), { disableErrorReporting: true });
|
|
45
34
|
};
|
|
46
35
|
export function run(program, options) {
|
|
47
36
|
startProgram(program, 'Fresh', options?.flags);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,MAAM,EAAa,KAAK,EAAE,MAAM,QAAQ,CAAA;AAEtE,qIAAqI;AACrI,MAAM,MAAM,oBAAoB,CAC9B,GAAG,SAAS,MAAM,EAClB,MAAM,SAAS,MAAM,CAAC,MAAM,CAAC,MAAM,IACjC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,GAClC,CAAC,MAAM,MAAM,SAAS,KAAK,GACvB,CACE,KAAK,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,KACnE,KAAK,CAAC,QAAQ,CACjB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;CAAE,GAAG,MAAM,CAAC,CAChE,GACD,CACE,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAC3D,KAAK,CAAC,QAAQ,CACjB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;CAAE,GAAG,MAAM,CAAC,CAChE,CAAC,CAAA;AAwJR,KAAK,mBAAmB,GAA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G,EAAE,GAAG,GACP,oBAAoB,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;AAChC,wBAAgB,YAAY,CAC1B,GAAG,SAAS,MAAM,EAClB,MAAM,SAAS,MAAM,CAAC,MAAM,CAAC,MAAM,EACnC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA"}
|
package/dist/schema/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Array, Match, Schema, SchemaAST } from 'effect';
|
|
1
|
+
import { Array, Cause, Match, Schema, SchemaAST } from 'effect';
|
|
2
2
|
const assignPlainProperty = (output, name, value) => {
|
|
3
3
|
if (name === '__proto__') {
|
|
4
4
|
Object.defineProperty(output, name, {
|
|
@@ -12,11 +12,20 @@ const assignPlainProperty = (output, name, value) => {
|
|
|
12
12
|
output[name] = value;
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
+
const runConstructorOperation = (operation) => {
|
|
16
|
+
try {
|
|
17
|
+
return operation();
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
throw new Error('Constructor adapter can only throw schema issues', {
|
|
21
|
+
cause: Cause.die(error),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
};
|
|
15
25
|
const isDirectlyCopyable = (ast) => {
|
|
16
26
|
if (ast.checks !== undefined ||
|
|
17
27
|
ast.encoding !== undefined ||
|
|
18
|
-
ast.context !== undefined
|
|
19
|
-
ast.annotations?.['parseOptions'] !== undefined) {
|
|
28
|
+
ast.context !== undefined) {
|
|
20
29
|
return false;
|
|
21
30
|
}
|
|
22
31
|
return Match.value(ast).pipe(Match.withReturnType(), Match.tagsExhaustive({
|
|
@@ -39,7 +48,7 @@ const isDirectlyCopyable = (ast) => {
|
|
|
39
48
|
TemplateLiteral: ({ parts }) => parts.every(isDirectlyCopyable),
|
|
40
49
|
Arrays: () => false,
|
|
41
50
|
Objects: () => false,
|
|
42
|
-
Union: ({
|
|
51
|
+
Union: ({ options, types }) => options?.mode !== 'oneOf' && types.every(isDirectlyCopyable),
|
|
43
52
|
Suspend: () => false,
|
|
44
53
|
}));
|
|
45
54
|
};
|
|
@@ -70,24 +79,20 @@ const makeCallable = (tag, fields) => {
|
|
|
70
79
|
}
|
|
71
80
|
const output = {};
|
|
72
81
|
for (const name of propertyNames) {
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return
|
|
78
|
-
}
|
|
79
|
-
if (descriptor !== undefined && !('value' in descriptor)) {
|
|
80
|
-
return make(value);
|
|
81
|
-
}
|
|
82
|
-
const inputValue = descriptor === undefined ? undefined : input[name];
|
|
82
|
+
const inputValue = runConstructorOperation(() => {
|
|
83
|
+
const hasProperty = name === '__proto__'
|
|
84
|
+
? Object.hasOwn(input, name)
|
|
85
|
+
: Reflect.has(input, name);
|
|
86
|
+
return hasProperty ? input[name] : undefined;
|
|
87
|
+
});
|
|
83
88
|
if (name === '_tag') {
|
|
84
89
|
if (inputValue !== undefined && inputValue !== tag) {
|
|
85
90
|
return make(value);
|
|
86
91
|
}
|
|
87
|
-
assignPlainProperty(output, name, tag);
|
|
92
|
+
runConstructorOperation(() => assignPlainProperty(output, name, tag));
|
|
88
93
|
}
|
|
89
94
|
else {
|
|
90
|
-
assignPlainProperty(output, name, inputValue);
|
|
95
|
+
runConstructorOperation(() => assignPlainProperty(output, name, inputValue));
|
|
91
96
|
}
|
|
92
97
|
}
|
|
93
98
|
return output;
|
|
@@ -10,7 +10,12 @@ import { Option, Stream } from 'effect';
|
|
|
10
10
|
*
|
|
11
11
|
* `toMessage(event)` transforms each dispatched event into a Message. The
|
|
12
12
|
* mapper runs synchronously in the same call stack as the browser's event
|
|
13
|
-
* dispatch, so calling `event.preventDefault()` inside it
|
|
13
|
+
* dispatch, so calling `event.preventDefault()` inside it takes effect,
|
|
14
|
+
* unless the listener is passive. Some browsers default wheel and touch
|
|
15
|
+
* listeners on global targets to passive, where `preventDefault()` is
|
|
16
|
+
* ignored. Pass `options: { passive: false }` explicitly when cancelling
|
|
17
|
+
* those events, or reach for `fromEventFilterMapPreventDefault`, which does
|
|
18
|
+
* so for you.
|
|
14
19
|
*/
|
|
15
20
|
export type FromEventConfig<EventType extends Event, Message> = Readonly<{
|
|
16
21
|
target: EventTarget | (() => EventTarget);
|
|
@@ -30,7 +35,11 @@ export type FromEventConfig<EventType extends Event, Message> = Readonly<{
|
|
|
30
35
|
* `toMessage(event)` returns `Option.some(message)` to emit a Message for the
|
|
31
36
|
* event, or `Option.none()` to ignore it. The mapper runs synchronously in the
|
|
32
37
|
* same call stack as the browser's event dispatch, so calling
|
|
33
|
-
* `event.preventDefault()` inside it
|
|
38
|
+
* `event.preventDefault()` inside it takes effect, unless the listener is
|
|
39
|
+
* passive. Some browsers default wheel and touch listeners on global targets
|
|
40
|
+
* to passive, where `preventDefault()` is ignored. Pass
|
|
41
|
+
* `options: { passive: false }` explicitly when cancelling those events, or
|
|
42
|
+
* reach for `fromEventFilterMapPreventDefault`, which does so for you.
|
|
34
43
|
*/
|
|
35
44
|
export type FromEventFilterMapConfig<EventType extends Event, Message> = Readonly<{
|
|
36
45
|
target: EventTarget | (() => EventTarget);
|
|
@@ -38,6 +47,31 @@ export type FromEventFilterMapConfig<EventType extends Event, Message> = Readonl
|
|
|
38
47
|
toMessage: (event: EventType) => Option.Option<Message>;
|
|
39
48
|
options?: AddEventListenerOptions;
|
|
40
49
|
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Configuration for the `fromEventFilterMapPreventDefault` Stream helper.
|
|
52
|
+
*
|
|
53
|
+
* `target` is read inside the acquire Effect, never before it, so the
|
|
54
|
+
* resolved `EventTarget` is captured at the moment the Subscription's scope
|
|
55
|
+
* opens. Pass a thunk when the target may not exist until the scope opens, or
|
|
56
|
+
* pass the `EventTarget` directly for always-present globals like `window` or
|
|
57
|
+
* `document`.
|
|
58
|
+
*
|
|
59
|
+
* `toMessage(event)` returns `Option.some(message)` to mark the dispatch
|
|
60
|
+
* handled, or `Option.none()` to leave the default behavior intact. For a
|
|
61
|
+
* handled dispatch the helper calls `event.preventDefault()` and queues the
|
|
62
|
+
* Message before the listener returns; the mapper itself never calls
|
|
63
|
+
* `preventDefault()`.
|
|
64
|
+
*
|
|
65
|
+
* `options.passive` defaults to `false` so `preventDefault()` keeps working
|
|
66
|
+
* for the events browsers would otherwise register as passive. Passing
|
|
67
|
+
* `passive: true` explicitly contradicts the helper's purpose and throws.
|
|
68
|
+
*/
|
|
69
|
+
export type FromEventFilterMapPreventDefaultConfig<EventType extends Event, Message> = Readonly<{
|
|
70
|
+
target: EventTarget | (() => EventTarget);
|
|
71
|
+
type: string;
|
|
72
|
+
toMessage: (event: EventType) => Option.Option<Message>;
|
|
73
|
+
options?: AddEventListenerOptions;
|
|
74
|
+
}>;
|
|
41
75
|
/**
|
|
42
76
|
* Build a Stream that emits a Message for the dispatches of a DOM event the
|
|
43
77
|
* mapper chooses to keep, registering the listener when the Stream's scope
|
|
@@ -51,7 +85,11 @@ export type FromEventFilterMapConfig<EventType extends Event, Message> = Readonl
|
|
|
51
85
|
* keep an event is paired with `event.preventDefault()`. The mapper runs
|
|
52
86
|
* synchronously inside the browser's event dispatch, so `preventDefault()`
|
|
53
87
|
* takes effect, while a downstream filter would run on a later turn after the
|
|
54
|
-
* default action has already happened.
|
|
88
|
+
* default action has already happened. The exception is a passive listener,
|
|
89
|
+
* which ignores `preventDefault()`. Some browsers default wheel and touch
|
|
90
|
+
* listeners on global targets to passive. Pass
|
|
91
|
+
* `options: { passive: false }` explicitly when cancelling those events, or
|
|
92
|
+
* reach for `fromEventFilterMapPreventDefault`, which does so for you.
|
|
55
93
|
*
|
|
56
94
|
* The listener lifecycle uses `Effect.acquireRelease`. The `addEventListener`
|
|
57
95
|
* call happens inside the acquire Effect, and the matching
|
|
@@ -67,22 +105,19 @@ export type FromEventFilterMapConfig<EventType extends Event, Message> = Readonl
|
|
|
67
105
|
* @example
|
|
68
106
|
* ```typescript
|
|
69
107
|
* const subscriptions = Subscription.make<Model, Message>()(entry => ({
|
|
70
|
-
*
|
|
108
|
+
* escapeKey: entry(
|
|
71
109
|
* { isListening: Schema.Boolean },
|
|
72
110
|
* {
|
|
73
111
|
* modelToDependencies: model => ({ isListening: model.isListening }),
|
|
74
112
|
* dependenciesToStream: ({ isListening }) =>
|
|
75
113
|
* Stream.when(
|
|
76
114
|
* Subscription.fromEventFilterMap<KeyboardEvent, Message>({
|
|
77
|
-
* target:
|
|
115
|
+
* target: document,
|
|
78
116
|
* type: 'keydown',
|
|
79
|
-
* toMessage: event =>
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* }
|
|
84
|
-
* return Option.none()
|
|
85
|
-
* },
|
|
117
|
+
* toMessage: event =>
|
|
118
|
+
* event.key === 'Escape'
|
|
119
|
+
* ? Option.some(Message.PressedEscape())
|
|
120
|
+
* : Option.none(),
|
|
86
121
|
* }),
|
|
87
122
|
* Effect.sync(() => isListening),
|
|
88
123
|
* ),
|
|
@@ -109,7 +144,9 @@ export declare const fromEventFilterMap: <EventType extends Event, Message>(conf
|
|
|
109
144
|
* Model condition.
|
|
110
145
|
*
|
|
111
146
|
* For a listener that reacts to only some events, reach for
|
|
112
|
-
* `fromEventFilterMap`, whose mapper returns `Option<Message>`.
|
|
147
|
+
* `fromEventFilterMap`, whose mapper returns `Option<Message>`. For a
|
|
148
|
+
* listener that also cancels the default action of the events it handles,
|
|
149
|
+
* reach for `fromEventFilterMapPreventDefault`.
|
|
113
150
|
*
|
|
114
151
|
* @example
|
|
115
152
|
* ```typescript
|
|
@@ -123,7 +160,7 @@ export declare const fromEventFilterMap: <EventType extends Event, Message>(conf
|
|
|
123
160
|
* Subscription.fromEvent<KeyboardEvent, Message>({
|
|
124
161
|
* target: window,
|
|
125
162
|
* type: 'keydown',
|
|
126
|
-
* toMessage: event => PressedKey({ key: event.key }),
|
|
163
|
+
* toMessage: event => Message.PressedKey({ key: event.key }),
|
|
127
164
|
* }),
|
|
128
165
|
* Effect.sync(() => isListening),
|
|
129
166
|
* ),
|
|
@@ -133,4 +170,59 @@ export declare const fromEventFilterMap: <EventType extends Event, Message>(conf
|
|
|
133
170
|
* ```
|
|
134
171
|
*/
|
|
135
172
|
export declare const fromEvent: <EventType extends Event, Message>(config: FromEventConfig<EventType, Message>) => Stream.Stream<Message>;
|
|
173
|
+
/**
|
|
174
|
+
* Build a Stream that emits a Message for the dispatches of a DOM event the
|
|
175
|
+
* mapper marks handled, calling `event.preventDefault()` on each of them,
|
|
176
|
+
* registering the listener when the Stream's scope opens and removing it when
|
|
177
|
+
* the scope closes.
|
|
178
|
+
*
|
|
179
|
+
* This is the cancelling variant of `fromEventFilterMap`, mirroring
|
|
180
|
+
* `h.OnKeyDownPreventDefault` from `foldkit/html`. Its `toMessage` returns
|
|
181
|
+
* `Option.some(message)` to mark a dispatch handled. The helper evaluates the
|
|
182
|
+
* mapper, calls `event.preventDefault()`, and queues the Message before the
|
|
183
|
+
* native listener returns. `Option.none()` leaves the default behavior intact.
|
|
184
|
+
* The mapper never calls `preventDefault()` itself.
|
|
185
|
+
*
|
|
186
|
+
* Because cancelling is the point, the listener registers with
|
|
187
|
+
* `passive: false` when the config does not say otherwise. This keeps wheel
|
|
188
|
+
* and touch events cancelable when a browser would otherwise make listeners
|
|
189
|
+
* on a global target passive. Passing `passive: true` explicitly contradicts
|
|
190
|
+
* the helper's purpose and throws.
|
|
191
|
+
*
|
|
192
|
+
* The listener lifecycle uses `Effect.acquireRelease`. The `addEventListener`
|
|
193
|
+
* call happens inside the acquire Effect, and the matching
|
|
194
|
+
* `removeEventListener` is registered only after acquire completes, so the
|
|
195
|
+
* listener never leaks on interruption.
|
|
196
|
+
*
|
|
197
|
+
* This is a Stream, not a Subscription entry. Wrap it with
|
|
198
|
+
* `Subscription.persistent` for a listener whose lifetime spans the whole
|
|
199
|
+
* Subscriptions record, or plug it into a `Subscription.make` entry's
|
|
200
|
+
* `dependenciesToStream` (typically behind `Stream.when`) to gate it on a
|
|
201
|
+
* Model condition.
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```typescript
|
|
205
|
+
* const subscriptions = Subscription.make<Model, Message>()(entry => ({
|
|
206
|
+
* wheelLock: entry(
|
|
207
|
+
* { isModalOpen: Schema.Boolean },
|
|
208
|
+
* {
|
|
209
|
+
* modelToDependencies: model => ({ isModalOpen: model.isModalOpen }),
|
|
210
|
+
* dependenciesToStream: ({ isModalOpen }) =>
|
|
211
|
+
* Stream.when(
|
|
212
|
+
* Subscription.fromEventFilterMapPreventDefault<
|
|
213
|
+
* WheelEvent,
|
|
214
|
+
* Message
|
|
215
|
+
* >({
|
|
216
|
+
* target: window,
|
|
217
|
+
* type: 'wheel',
|
|
218
|
+
* toMessage: () => Option.some(Message.SuppressedWheelScroll()),
|
|
219
|
+
* }),
|
|
220
|
+
* Effect.sync(() => isModalOpen),
|
|
221
|
+
* ),
|
|
222
|
+
* },
|
|
223
|
+
* ),
|
|
224
|
+
* }))
|
|
225
|
+
* ```
|
|
226
|
+
*/
|
|
227
|
+
export declare const fromEventFilterMapPreventDefault: <EventType extends Event, Message>(config: FromEventFilterMapPreventDefaultConfig<EventType, Message>) => Stream.Stream<Message>;
|
|
136
228
|
//# sourceMappingURL=fromEvent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fromEvent.d.ts","sourceRoot":"","sources":["../../src/subscription/fromEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAS,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEtD
|
|
1
|
+
{"version":3,"file":"fromEvent.d.ts","sourceRoot":"","sources":["../../src/subscription/fromEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAS,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEtD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,eAAe,CAAC,SAAS,SAAS,KAAK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H,eAAO,MAAM,SAAS,GAAI,SAAS,SAAS,KAAK,EAAE,OAAO,UAChD,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,KAC1C,MAAM,CAAC,MAAM,CAAC,OAAO,CAIpB,CAAA;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,eAAO,MAAM,gCAAgC,GAC3C,SAAS,SAAS,KAAK,EACvB,OAAO,UAEC,sCAAsC,CAAC,SAAS,EAAE,OAAO,CAAC,KACjE,MAAM,CAAC,MAAM,CAAC,OAAO,CA0BvB,CAAA"}
|
|
@@ -13,7 +13,11 @@ const resolveTarget = (target) => (typeof target === 'function' ? target() : tar
|
|
|
13
13
|
* keep an event is paired with `event.preventDefault()`. The mapper runs
|
|
14
14
|
* synchronously inside the browser's event dispatch, so `preventDefault()`
|
|
15
15
|
* takes effect, while a downstream filter would run on a later turn after the
|
|
16
|
-
* default action has already happened.
|
|
16
|
+
* default action has already happened. The exception is a passive listener,
|
|
17
|
+
* which ignores `preventDefault()`. Some browsers default wheel and touch
|
|
18
|
+
* listeners on global targets to passive. Pass
|
|
19
|
+
* `options: { passive: false }` explicitly when cancelling those events, or
|
|
20
|
+
* reach for `fromEventFilterMapPreventDefault`, which does so for you.
|
|
17
21
|
*
|
|
18
22
|
* The listener lifecycle uses `Effect.acquireRelease`. The `addEventListener`
|
|
19
23
|
* call happens inside the acquire Effect, and the matching
|
|
@@ -29,22 +33,19 @@ const resolveTarget = (target) => (typeof target === 'function' ? target() : tar
|
|
|
29
33
|
* @example
|
|
30
34
|
* ```typescript
|
|
31
35
|
* const subscriptions = Subscription.make<Model, Message>()(entry => ({
|
|
32
|
-
*
|
|
36
|
+
* escapeKey: entry(
|
|
33
37
|
* { isListening: Schema.Boolean },
|
|
34
38
|
* {
|
|
35
39
|
* modelToDependencies: model => ({ isListening: model.isListening }),
|
|
36
40
|
* dependenciesToStream: ({ isListening }) =>
|
|
37
41
|
* Stream.when(
|
|
38
42
|
* Subscription.fromEventFilterMap<KeyboardEvent, Message>({
|
|
39
|
-
* target:
|
|
43
|
+
* target: document,
|
|
40
44
|
* type: 'keydown',
|
|
41
|
-
* toMessage: event =>
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* }
|
|
46
|
-
* return Option.none()
|
|
47
|
-
* },
|
|
45
|
+
* toMessage: event =>
|
|
46
|
+
* event.key === 'Escape'
|
|
47
|
+
* ? Option.some(Message.PressedEscape())
|
|
48
|
+
* : Option.none(),
|
|
48
49
|
* }),
|
|
49
50
|
* Effect.sync(() => isListening),
|
|
50
51
|
* ),
|
|
@@ -84,7 +85,9 @@ export const fromEventFilterMap = (config) => Stream.callback(queue => Effect.ac
|
|
|
84
85
|
* Model condition.
|
|
85
86
|
*
|
|
86
87
|
* For a listener that reacts to only some events, reach for
|
|
87
|
-
* `fromEventFilterMap`, whose mapper returns `Option<Message>`.
|
|
88
|
+
* `fromEventFilterMap`, whose mapper returns `Option<Message>`. For a
|
|
89
|
+
* listener that also cancels the default action of the events it handles,
|
|
90
|
+
* reach for `fromEventFilterMapPreventDefault`.
|
|
88
91
|
*
|
|
89
92
|
* @example
|
|
90
93
|
* ```typescript
|
|
@@ -98,7 +101,7 @@ export const fromEventFilterMap = (config) => Stream.callback(queue => Effect.ac
|
|
|
98
101
|
* Subscription.fromEvent<KeyboardEvent, Message>({
|
|
99
102
|
* target: window,
|
|
100
103
|
* type: 'keydown',
|
|
101
|
-
* toMessage: event => PressedKey({ key: event.key }),
|
|
104
|
+
* toMessage: event => Message.PressedKey({ key: event.key }),
|
|
102
105
|
* }),
|
|
103
106
|
* Effect.sync(() => isListening),
|
|
104
107
|
* ),
|
|
@@ -111,3 +114,81 @@ export const fromEvent = (config) => fromEventFilterMap({
|
|
|
111
114
|
...config,
|
|
112
115
|
toMessage: event => Option.some(config.toMessage(event)),
|
|
113
116
|
});
|
|
117
|
+
/**
|
|
118
|
+
* Build a Stream that emits a Message for the dispatches of a DOM event the
|
|
119
|
+
* mapper marks handled, calling `event.preventDefault()` on each of them,
|
|
120
|
+
* registering the listener when the Stream's scope opens and removing it when
|
|
121
|
+
* the scope closes.
|
|
122
|
+
*
|
|
123
|
+
* This is the cancelling variant of `fromEventFilterMap`, mirroring
|
|
124
|
+
* `h.OnKeyDownPreventDefault` from `foldkit/html`. Its `toMessage` returns
|
|
125
|
+
* `Option.some(message)` to mark a dispatch handled. The helper evaluates the
|
|
126
|
+
* mapper, calls `event.preventDefault()`, and queues the Message before the
|
|
127
|
+
* native listener returns. `Option.none()` leaves the default behavior intact.
|
|
128
|
+
* The mapper never calls `preventDefault()` itself.
|
|
129
|
+
*
|
|
130
|
+
* Because cancelling is the point, the listener registers with
|
|
131
|
+
* `passive: false` when the config does not say otherwise. This keeps wheel
|
|
132
|
+
* and touch events cancelable when a browser would otherwise make listeners
|
|
133
|
+
* on a global target passive. Passing `passive: true` explicitly contradicts
|
|
134
|
+
* the helper's purpose and throws.
|
|
135
|
+
*
|
|
136
|
+
* The listener lifecycle uses `Effect.acquireRelease`. The `addEventListener`
|
|
137
|
+
* call happens inside the acquire Effect, and the matching
|
|
138
|
+
* `removeEventListener` is registered only after acquire completes, so the
|
|
139
|
+
* listener never leaks on interruption.
|
|
140
|
+
*
|
|
141
|
+
* This is a Stream, not a Subscription entry. Wrap it with
|
|
142
|
+
* `Subscription.persistent` for a listener whose lifetime spans the whole
|
|
143
|
+
* Subscriptions record, or plug it into a `Subscription.make` entry's
|
|
144
|
+
* `dependenciesToStream` (typically behind `Stream.when`) to gate it on a
|
|
145
|
+
* Model condition.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const subscriptions = Subscription.make<Model, Message>()(entry => ({
|
|
150
|
+
* wheelLock: entry(
|
|
151
|
+
* { isModalOpen: Schema.Boolean },
|
|
152
|
+
* {
|
|
153
|
+
* modelToDependencies: model => ({ isModalOpen: model.isModalOpen }),
|
|
154
|
+
* dependenciesToStream: ({ isModalOpen }) =>
|
|
155
|
+
* Stream.when(
|
|
156
|
+
* Subscription.fromEventFilterMapPreventDefault<
|
|
157
|
+
* WheelEvent,
|
|
158
|
+
* Message
|
|
159
|
+
* >({
|
|
160
|
+
* target: window,
|
|
161
|
+
* type: 'wheel',
|
|
162
|
+
* toMessage: () => Option.some(Message.SuppressedWheelScroll()),
|
|
163
|
+
* }),
|
|
164
|
+
* Effect.sync(() => isModalOpen),
|
|
165
|
+
* ),
|
|
166
|
+
* },
|
|
167
|
+
* ),
|
|
168
|
+
* }))
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
export const fromEventFilterMapPreventDefault = (config) => {
|
|
172
|
+
if (config.options?.passive === true) {
|
|
173
|
+
throw new Error(`Foldkit: \`Subscription.fromEventFilterMapPreventDefault\` was passed ` +
|
|
174
|
+
`\`options: { passive: true }\` for a "${config.type}" listener. ` +
|
|
175
|
+
`The helper exists to call \`event.preventDefault()\` on every ` +
|
|
176
|
+
`dispatch the mapper marks handled, and a passive listener promises ` +
|
|
177
|
+
`the browser the exact opposite: \`preventDefault()\` inside it is ` +
|
|
178
|
+
`ignored and logs a console warning. Drop the \`passive\` option ` +
|
|
179
|
+
`(the helper registers the listener with \`passive: false\` for ` +
|
|
180
|
+
`you), or use \`Subscription.fromEventFilterMap\` for a listener ` +
|
|
181
|
+
`that only observes.`);
|
|
182
|
+
}
|
|
183
|
+
return fromEventFilterMap({
|
|
184
|
+
...config,
|
|
185
|
+
options: { ...config.options, passive: false },
|
|
186
|
+
toMessage: event => {
|
|
187
|
+
const maybeMessage = config.toMessage(event);
|
|
188
|
+
if (Option.isSome(maybeMessage)) {
|
|
189
|
+
event.preventDefault();
|
|
190
|
+
}
|
|
191
|
+
return maybeMessage;
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
};
|
|
@@ -2,6 +2,6 @@ export { aggregate, lift, make, persistent } from './subscription.js';
|
|
|
2
2
|
export type { EntryWithoutKeepAlive, GatedDependencies, Subscription, Subscriptions, } from './subscription.js';
|
|
3
3
|
export { animationFrame } from './animationFrame.js';
|
|
4
4
|
export type { AnimationFrameConfig } from './animationFrame.js';
|
|
5
|
-
export { fromEvent, fromEventFilterMap } from './fromEvent.js';
|
|
6
|
-
export type { FromEventConfig, FromEventFilterMapConfig } from './fromEvent.js';
|
|
5
|
+
export { fromEvent, fromEventFilterMap, fromEventFilterMapPreventDefault, } from './fromEvent.js';
|
|
6
|
+
export type { FromEventConfig, FromEventFilterMapConfig, FromEventFilterMapPreventDefaultConfig, } from './fromEvent.js';
|
|
7
7
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/subscription/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAErE,YAAY,EACV,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,aAAa,GACd,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAE/D,OAAO,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/subscription/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAErE,YAAY,EACV,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,aAAa,GACd,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAE/D,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,gCAAgC,GACjC,MAAM,gBAAgB,CAAA;AAEvB,YAAY,EACV,eAAe,EACf,wBAAwB,EACxB,sCAAsC,GACvC,MAAM,gBAAgB,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { aggregate, lift, make, persistent } from './subscription.js';
|
|
2
2
|
export { animationFrame } from './animationFrame.js';
|
|
3
|
-
export { fromEvent, fromEventFilterMap } from './fromEvent.js';
|
|
3
|
+
export { fromEvent, fromEventFilterMap, fromEventFilterMapPreventDefault, } from './fromEvent.js';
|
package/dist/test/vitest.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare module 'vitest' {
|
|
2
|
-
interface Assertion<T> {
|
|
2
|
+
interface Assertion<R, T> {
|
|
3
3
|
toHaveText(expected: string | RegExp): this;
|
|
4
4
|
toContainText(expected: string | RegExp): this;
|
|
5
5
|
toHaveClass(expected: string): this;
|
|
@@ -27,7 +27,7 @@ declare module 'vitest' {
|
|
|
27
27
|
* setup()
|
|
28
28
|
* ```
|
|
29
29
|
*
|
|
30
|
-
* Importing this module also augments `Assertion<T>` with the Scene
|
|
30
|
+
* Importing this module also augments `Assertion<R, T>` with the Scene
|
|
31
31
|
* matcher types — no manual `declare module 'vitest'` block needed. */
|
|
32
32
|
export declare const setup: () => void;
|
|
33
33
|
//# sourceMappingURL=vitest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../../src/test/vitest.ts"],"names":[],"mappings":"AAIA,OAAO,QAAQ,QAAQ,CAAC;IAEtB,UAAU,SAAS,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../../src/test/vitest.ts"],"names":[],"mappings":"AAIA,OAAO,QAAQ,QAAQ,CAAC;IAEtB,UAAU,SAAS,CAAC,CAAC,EAAE,CAAC;QACtB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;QAC3C,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;QAC9C,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;QACnC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QAC9C,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QAC/C,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;QAC9B,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;QACjC,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;QACnC,YAAY,IAAI,IAAI,CAAA;QACpB,WAAW,IAAI,IAAI,CAAA;QACnB,WAAW,IAAI,IAAI,CAAA;QACnB,SAAS,IAAI,IAAI,CAAA;QACjB,WAAW,IAAI,IAAI,CAAA;QACnB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;QAChC,OAAO,IAAI,IAAI,CAAA;QACf,UAAU,IAAI,IAAI,CAAA;KACnB;CACF;AAED;;;;;;;;;;wEAUwE;AACxE,eAAO,MAAM,KAAK,QAAO,IAExB,CAAA"}
|
package/dist/test/vitest.js
CHANGED
|
@@ -9,7 +9,7 @@ import { sceneMatchers } from './matchers.js';
|
|
|
9
9
|
* setup()
|
|
10
10
|
* ```
|
|
11
11
|
*
|
|
12
|
-
* Importing this module also augments `Assertion<T>` with the Scene
|
|
12
|
+
* Importing this module also augments `Assertion<R, T>` with the Scene
|
|
13
13
|
* matcher types — no manual `declare module 'vitest'` block needed. */
|
|
14
14
|
export const setup = () => {
|
|
15
15
|
expect.extend(sceneMatchers);
|
package/dist/url/index.js
CHANGED
|
@@ -17,7 +17,7 @@ const LocationAndHref = Schema.Struct({
|
|
|
17
17
|
port: Schema.String,
|
|
18
18
|
}),
|
|
19
19
|
});
|
|
20
|
-
const LocationAndHrefFromString = Schema.String.pipe(Schema.decodeTo(LocationAndHref, SchemaTransformation.
|
|
20
|
+
const LocationAndHrefFromString = Schema.String.pipe(Schema.decodeTo(LocationAndHref, SchemaTransformation.transformEffect({
|
|
21
21
|
decode: urlString => Effect.try({
|
|
22
22
|
try: () => {
|
|
23
23
|
const url = new URL(urlString);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foldkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.160.0",
|
|
4
4
|
"description": "A TypeScript frontend framework, built on Effect and architected like Elm",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -161,16 +161,18 @@
|
|
|
161
161
|
"parse5": "^8.0.1"
|
|
162
162
|
},
|
|
163
163
|
"peerDependencies": {
|
|
164
|
-
"effect": "4.0.0-rc.
|
|
164
|
+
"@effect/platform-browser": "4.0.0-rc.115",
|
|
165
|
+
"effect": "4.0.0-rc.115"
|
|
165
166
|
},
|
|
166
167
|
"devDependencies": {
|
|
167
|
-
"@effect/
|
|
168
|
-
"@vitest
|
|
169
|
-
"
|
|
168
|
+
"@effect/platform-browser": "4.0.0-rc.115",
|
|
169
|
+
"@effect/vitest": "4.0.0-rc.115",
|
|
170
|
+
"@vitest/coverage-v8": "^5.0.0",
|
|
171
|
+
"effect": "4.0.0-rc.115",
|
|
170
172
|
"happy-dom": "^20.11.13",
|
|
171
173
|
"rimraf": "^6.1.3",
|
|
172
174
|
"typescript": "^7.0.2",
|
|
173
|
-
"vitest": "^
|
|
175
|
+
"vitest": "^5.0.0"
|
|
174
176
|
},
|
|
175
177
|
"keywords": [
|
|
176
178
|
"effect",
|