foldkit 0.36.2 → 0.37.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/README.md +4 -5
- package/dist/command/index.d.ts +36 -2
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +11 -1
- package/dist/command/public.d.ts +1 -0
- package/dist/command/public.d.ts.map +1 -1
- package/dist/command/public.js +1 -1
- package/dist/devtools/overlay.d.ts.map +1 -1
- package/dist/devtools/overlay.js +16 -15
- package/dist/devtools/store.d.ts +2 -2
- package/dist/devtools/store.d.ts.map +1 -1
- package/dist/devtools/store.js +2 -2
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +10 -4
- package/dist/task/dom.d.ts +1 -9
- package/dist/task/dom.d.ts.map +1 -1
- package/dist/task/dom.js +81 -111
- package/dist/ui/combobox/multi.d.ts +56 -53
- package/dist/ui/combobox/multi.d.ts.map +1 -1
- package/dist/ui/combobox/shared.d.ts +63 -60
- package/dist/ui/combobox/shared.d.ts.map +1 -1
- package/dist/ui/combobox/shared.js +11 -10
- package/dist/ui/combobox/single.d.ts +56 -53
- package/dist/ui/combobox/single.d.ts.map +1 -1
- package/dist/ui/dialog/index.d.ts +2 -2
- package/dist/ui/dialog/index.d.ts.map +1 -1
- package/dist/ui/dialog/index.js +10 -7
- package/dist/ui/disclosure/index.d.ts +2 -2
- package/dist/ui/disclosure/index.d.ts.map +1 -1
- package/dist/ui/disclosure/index.js +3 -2
- package/dist/ui/listbox/multi.d.ts +65 -62
- package/dist/ui/listbox/multi.d.ts.map +1 -1
- package/dist/ui/listbox/shared.d.ts +71 -68
- package/dist/ui/listbox/shared.d.ts.map +1 -1
- package/dist/ui/listbox/shared.js +14 -13
- package/dist/ui/listbox/single.d.ts +65 -62
- package/dist/ui/listbox/single.d.ts.map +1 -1
- package/dist/ui/menu/index.d.ts +2 -2
- package/dist/ui/menu/index.d.ts.map +1 -1
- package/dist/ui/menu/index.js +17 -16
- package/dist/ui/popover/index.d.ts +2 -2
- package/dist/ui/popover/index.d.ts.map +1 -1
- package/dist/ui/popover/index.js +12 -11
- package/dist/ui/radioGroup/index.d.ts +2 -2
- package/dist/ui/radioGroup/index.d.ts.map +1 -1
- package/dist/ui/radioGroup/index.js +2 -1
- package/dist/ui/tabs/index.d.ts +2 -2
- package/dist/ui/tabs/index.d.ts.map +1 -1
- package/dist/ui/tabs/index.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,8 +47,7 @@ This is a complete Foldkit program. State lives in a single Model. Events become
|
|
|
47
47
|
|
|
48
48
|
```ts
|
|
49
49
|
import { Match as M, Schema as S } from 'effect'
|
|
50
|
-
import { Runtime } from 'foldkit'
|
|
51
|
-
import { Command } from 'foldkit/command'
|
|
50
|
+
import { Command, Runtime } from 'foldkit'
|
|
52
51
|
import { Html, html } from 'foldkit/html'
|
|
53
52
|
import { m } from 'foldkit/message'
|
|
54
53
|
|
|
@@ -71,9 +70,9 @@ type Message = typeof Message.Type
|
|
|
71
70
|
const update = (
|
|
72
71
|
model: Model,
|
|
73
72
|
message: Message,
|
|
74
|
-
): [Model, ReadonlyArray<Command<Message>>] =>
|
|
73
|
+
): [Model, ReadonlyArray<Command.Command<Message>>] =>
|
|
75
74
|
M.value(message).pipe(
|
|
76
|
-
M.withReturnType<[Model, ReadonlyArray<Command<Message>>]>(),
|
|
75
|
+
M.withReturnType<[Model, ReadonlyArray<Command.Command<Message>>]>(),
|
|
77
76
|
M.tagsExhaustive({
|
|
78
77
|
ClickedDecrement: () => [{ count: model.count - 1 }, []],
|
|
79
78
|
ClickedIncrement: () => [{ count: model.count + 1 }, []],
|
|
@@ -135,7 +134,7 @@ Source: [examples/counter/src/main.ts](https://github.com/foldkit/foldkit/blob/m
|
|
|
135
134
|
|
|
136
135
|
Foldkit is a complete system, not a collection of libraries you stitch together.
|
|
137
136
|
|
|
138
|
-
- **Commands** — Side effects are
|
|
137
|
+
- **Commands** — Side effects are named Effects that return Messages and are executed by the runtime. Each Command has a `name` for identification in tracing and testing, and an `effect` that the runtime runs. Use any Effect combinator you want — retry, timeout, race, parallel.
|
|
139
138
|
- **Routing** — Type-safe bidirectional routing. URLs parse into typed routes and routes build back into URLs. No string matching, no mismatches between parsing and building.
|
|
140
139
|
- **Subscriptions** — Declare which streams your app needs as a function of the Model. The runtime diffs and switches them when the Model changes.
|
|
141
140
|
- **Managed Resources** — Model-driven lifecycle for long-lived browser resources like WebSockets, AudioContext, and RTCPeerConnection. Acquire on state change, release on cleanup.
|
package/dist/command/index.d.ts
CHANGED
|
@@ -1,4 +1,38 @@
|
|
|
1
1
|
import { Effect, Schema } from 'effect';
|
|
2
|
-
/**
|
|
3
|
-
export type Command<T, E = never, R = never> =
|
|
2
|
+
/** A named Effect that produces a message. */
|
|
3
|
+
export type Command<T, E = never, R = never> = [T] extends [Schema.Schema.Any] ? {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly effect: Effect.Effect<Schema.Schema.Type<T>, E, R>;
|
|
6
|
+
} : {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly effect: Effect.Effect<T, E, R>;
|
|
9
|
+
};
|
|
10
|
+
/** Creates a named Command from an Effect. */
|
|
11
|
+
export declare const make: {
|
|
12
|
+
(name: string): <A, E, R>(effect: Effect.Effect<A, E, R>) => Readonly<{
|
|
13
|
+
name: string;
|
|
14
|
+
effect: Effect.Effect<A, E, R>;
|
|
15
|
+
}>;
|
|
16
|
+
<A, E = never, R = never>(name: string, effect: Effect.Effect<A, E, R>): Readonly<{
|
|
17
|
+
name: string;
|
|
18
|
+
effect: Effect.Effect<A, E, R>;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
/** Transforms the Effect inside a Command while preserving its name. */
|
|
22
|
+
export declare const mapEffect: {
|
|
23
|
+
<A, E, R, B>(f: (effect: Effect.Effect<A, E, R>) => Effect.Effect<B, E, R>): (command: Readonly<{
|
|
24
|
+
name: string;
|
|
25
|
+
effect: Effect.Effect<A, E, R>;
|
|
26
|
+
}>) => Readonly<{
|
|
27
|
+
name: string;
|
|
28
|
+
effect: Effect.Effect<B, E, R>;
|
|
29
|
+
}>;
|
|
30
|
+
<A, E1, R1, B, E2, R2>(command: Readonly<{
|
|
31
|
+
name: string;
|
|
32
|
+
effect: Effect.Effect<A, E1, R1>;
|
|
33
|
+
}>, f: (effect: Effect.Effect<A, E1, R1>) => Effect.Effect<B, E2, R2>): Readonly<{
|
|
34
|
+
name: string;
|
|
35
|
+
effect: Effect.Effect<B, E2, R2>;
|
|
36
|
+
}>;
|
|
37
|
+
};
|
|
4
38
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEvC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEvC,8CAA8C;AAC9C,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,GAC1E;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;CAC5D,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;CACxC,C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AAC,CAAA;KAAE,CAAC,CAAA;IAC/D,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EACnB,OAAO,EAAE,QAAQ,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;KAAE,CAAC,EACrE,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,GAChE,QAAQ,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;KAAE,CAAC,CAAA;CAQI,CAAA"}
|
package/dist/command/index.js
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/** Creates a named Command from an Effect. */
|
|
2
|
+
export const make = ((...args) => args.length === 1
|
|
3
|
+
? (effect) => ({ name: args[0], effect })
|
|
4
|
+
: { name: args[0], effect: args[1] });
|
|
5
|
+
/** Transforms the Effect inside a Command while preserving its name. */
|
|
6
|
+
export const mapEffect = ((...args) => args.length === 1
|
|
7
|
+
? (command) => ({
|
|
8
|
+
name: command.name,
|
|
9
|
+
effect: args[0](command.effect),
|
|
10
|
+
})
|
|
11
|
+
: { name: args[0].name, effect: args[1](args[0].effect) });
|
package/dist/command/public.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/command/public.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/command/public.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/command/public.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { make, mapEffect } from './index';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../src/devtools/overlay.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,MAAM,EAIN,MAAM,EAQP,MAAM,QAAQ,CAAA;AAOf,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAMxE,OAAO,EAAE,KAAK,aAAa,EAA+B,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../src/devtools/overlay.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,MAAM,EAIN,MAAM,EAQP,MAAM,QAAQ,CAAA;AAOf,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAMxE,OAAO,EAAE,KAAK,aAAa,EAA+B,MAAM,SAAS,CAAA;AA6yCzE,eAAO,MAAM,aAAa,GACxB,OAAO,aAAa,EACpB,UAAU,gBAAgB,EAC1B,MAAM,YAAY,EAClB,aAAa,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,sCA4ChC,CAAA"}
|
package/dist/devtools/overlay.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import { Array as Array_, Effect, HashSet, Match as M, Number as Number_, Option, Predicate, Record, Schema as S, Stream, String as String_, SubscriptionRef, pipe, } from 'effect';
|
|
3
|
+
import * as Command from '../command';
|
|
3
4
|
import { OptionExt } from '../effectExtensions';
|
|
4
5
|
import { createKeyedLazy, html } from '../html';
|
|
5
6
|
import { m } from '../message';
|
|
@@ -13,7 +14,7 @@ import { INIT_INDEX } from './store';
|
|
|
13
14
|
// MODEL
|
|
14
15
|
const DisplayEntry = S.Struct({
|
|
15
16
|
tag: S.String,
|
|
16
|
-
|
|
17
|
+
commandNames: S.Array(S.String),
|
|
17
18
|
timestamp: S.Number,
|
|
18
19
|
isModelChanged: S.Boolean,
|
|
19
20
|
});
|
|
@@ -87,9 +88,9 @@ const TREE_INDENT_PX = 12;
|
|
|
87
88
|
const MAX_PREVIEW_KEYS = 3;
|
|
88
89
|
const formatTimeDelta = (deltaMs) => M.value(deltaMs).pipe(M.when(0, () => '0ms'), M.when(Number_.lessThan(MILLIS_PER_SECOND), ms => `+${Math.round(ms)}ms`), M.orElse(ms => `+${(ms / MILLIS_PER_SECOND).toFixed(1)}s`));
|
|
89
90
|
const MESSAGE_LIST_SELECTOR = '.message-list';
|
|
90
|
-
const toDisplayEntries = ({ entries }) => Array_.map(entries, ({ tag,
|
|
91
|
+
const toDisplayEntries = ({ entries }) => Array_.map(entries, ({ tag, commandNames, timestamp, isModelChanged }) => ({
|
|
91
92
|
tag,
|
|
92
|
-
|
|
93
|
+
commandNames,
|
|
93
94
|
timestamp,
|
|
94
95
|
isModelChanged,
|
|
95
96
|
}));
|
|
@@ -177,7 +178,7 @@ const makeUpdate = (store, shadow, mode) => {
|
|
|
177
178
|
const jumpTo = (index) => Effect.gen(function* () {
|
|
178
179
|
yield* store.jumpTo(index);
|
|
179
180
|
return CompletedJump();
|
|
180
|
-
});
|
|
181
|
+
}).pipe(Command.make('JumpTo'));
|
|
181
182
|
const inspectState = (index) => Effect.gen(function* () {
|
|
182
183
|
const model = yield* store.getModelAtIndex(index);
|
|
183
184
|
const maybeMessage = yield* store.getMessageAtIndex(index);
|
|
@@ -185,32 +186,32 @@ const makeUpdate = (store, shadow, mode) => {
|
|
|
185
186
|
? emptyDiff
|
|
186
187
|
: yield* pipe(store.getModelAtIndex(index - 1), Effect.map(previousModel => computeDiff(previousModel, model)), Effect.catchAll(() => Effect.succeed(emptyDiff)));
|
|
187
188
|
return ReceivedInspectedState({ model, maybeMessage, ...diff });
|
|
188
|
-
});
|
|
189
|
+
}).pipe(Command.make('InspectState'));
|
|
189
190
|
const inspectLatest = Effect.gen(function* () {
|
|
190
191
|
const state = yield* SubscriptionRef.get(store.stateRef);
|
|
191
192
|
const latestIndex = Array_.isEmptyReadonlyArray(state.entries)
|
|
192
193
|
? INIT_INDEX
|
|
193
194
|
: state.startIndex + state.entries.length - 1;
|
|
194
|
-
return yield* inspectState(latestIndex);
|
|
195
|
-
});
|
|
195
|
+
return yield* inspectState(latestIndex).effect;
|
|
196
|
+
}).pipe(Command.make('InspectLatest'));
|
|
196
197
|
const resume = Effect.gen(function* () {
|
|
197
198
|
yield* store.resume;
|
|
198
199
|
return CompletedResume();
|
|
199
|
-
});
|
|
200
|
+
}).pipe(Command.make('Resume'));
|
|
200
201
|
const clear = Effect.gen(function* () {
|
|
201
202
|
yield* store.clear;
|
|
202
203
|
return CompletedClear();
|
|
203
|
-
});
|
|
204
|
+
}).pipe(Command.make('Clear'));
|
|
204
205
|
const toggleScrollLock = (shouldLock) => shouldLock
|
|
205
|
-
? lockScroll.pipe(Effect.as(LockedScroll()))
|
|
206
|
-
: unlockScroll.pipe(Effect.as(UnlockedScroll()));
|
|
206
|
+
? lockScroll.pipe(Effect.as(LockedScroll()), Command.make('LockScroll'))
|
|
207
|
+
: unlockScroll.pipe(Effect.as(UnlockedScroll()), Command.make('UnlockScroll'));
|
|
207
208
|
const scrollToTop = Effect.sync(() => {
|
|
208
209
|
const messageList = shadow.querySelector(MESSAGE_LIST_SELECTOR);
|
|
209
210
|
if (messageList instanceof HTMLElement) {
|
|
210
211
|
messageList.scrollTop = 0;
|
|
211
212
|
}
|
|
212
213
|
return ScrolledToTop();
|
|
213
|
-
});
|
|
214
|
+
}).pipe(Command.make('ScrollToTop'));
|
|
214
215
|
return (model, message) => M.value(message).pipe(M.withReturnType(), M.tags({
|
|
215
216
|
ClickedToggle: () => {
|
|
216
217
|
const nextIsOpen = !model.isOpen;
|
|
@@ -284,7 +285,7 @@ const makeUpdate = (store, shadow, mode) => {
|
|
|
284
285
|
evo(model, {
|
|
285
286
|
inspectorTabs: () => nextTabsModel,
|
|
286
287
|
}),
|
|
287
|
-
tabsCommands.map(Effect.map(innerMessage => GotInspectorTabsMessage({ message: innerMessage }))),
|
|
288
|
+
tabsCommands.map(Command.mapEffect(Effect.map(innerMessage => GotInspectorTabsMessage({ message: innerMessage })))),
|
|
288
289
|
];
|
|
289
290
|
},
|
|
290
291
|
ToggledTreeNode: ({ path }) => [
|
|
@@ -320,14 +321,14 @@ const SubscriptionDeps = S.Struct({
|
|
|
320
321
|
const makeOverlaySubscriptions = (store) => makeSubscriptions(SubscriptionDeps)({
|
|
321
322
|
storeUpdates: {
|
|
322
323
|
modelToDependencies: () => null,
|
|
323
|
-
depsToStream: () => Stream.concat(Stream.make(pipe(SubscriptionRef.get(store.stateRef), Effect.map(state => ReceivedStoreUpdate(toDisplayState(state))))), pipe(store.stateRef.changes, Stream.map(state => Effect.succeed(ReceivedStoreUpdate(toDisplayState(state)))))),
|
|
324
|
+
depsToStream: () => Stream.concat(Stream.make(pipe(SubscriptionRef.get(store.stateRef), Effect.map(state => ReceivedStoreUpdate(toDisplayState(state))), Command.make('LoadStoreState'))), pipe(store.stateRef.changes, Stream.map(state => Effect.succeed(ReceivedStoreUpdate(toDisplayState(state))).pipe(Command.make('ReceiveStoreUpdate'))))),
|
|
324
325
|
},
|
|
325
326
|
mobileBreakpoint: {
|
|
326
327
|
modelToDependencies: () => null,
|
|
327
328
|
depsToStream: () => Stream.async(emit => {
|
|
328
329
|
const mediaQuery = window.matchMedia(MOBILE_BREAKPOINT_QUERY);
|
|
329
330
|
const handler = (event) => {
|
|
330
|
-
emit.single(Effect.succeed(CrossedMobileBreakpoint({ isMobile: event.matches })));
|
|
331
|
+
emit.single(Effect.succeed(CrossedMobileBreakpoint({ isMobile: event.matches })).pipe(Command.make('CrossMobileBreakpoint')));
|
|
331
332
|
};
|
|
332
333
|
mediaQuery.addEventListener('change', handler);
|
|
333
334
|
return Effect.sync(() => mediaQuery.removeEventListener('change', handler));
|
package/dist/devtools/store.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare const INIT_INDEX = -1;
|
|
|
3
3
|
export type HistoryEntry = Readonly<{
|
|
4
4
|
tag: string;
|
|
5
5
|
message: unknown;
|
|
6
|
-
|
|
6
|
+
commandNames: ReadonlyArray<string>;
|
|
7
7
|
timestamp: number;
|
|
8
8
|
isModelChanged: boolean;
|
|
9
9
|
}>;
|
|
@@ -25,7 +25,7 @@ export type DevtoolsStore = Readonly<{
|
|
|
25
25
|
recordInit: (model: unknown) => Effect.Effect<void>;
|
|
26
26
|
recordMessage: (message: Readonly<{
|
|
27
27
|
_tag: string;
|
|
28
|
-
}>, modelAfterUpdate: unknown,
|
|
28
|
+
}>, modelAfterUpdate: unknown, commandNames: ReadonlyArray<string>, isModelChanged: boolean) => Effect.Effect<void>;
|
|
29
29
|
getModelAtIndex: (index: number) => Effect.Effect<unknown>;
|
|
30
30
|
getMessageAtIndex: (index: number) => Effect.Effect<Option.Option<unknown>>;
|
|
31
31
|
jumpTo: (index: number) => Effect.Effect<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/devtools/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAQ,MAAM,QAAQ,CAAA;AAE9E,eAAO,MAAM,UAAU,KAAK,CAAA;AAI5B,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/devtools/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,OAAO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,QAAQ,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,EACnC,gBAAgB,EAAE,OAAO,EACzB,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,EACnC,cAAc,EAAE,OAAO,KACpB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACxB,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAC1D,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;IAC3E,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC9C,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC1B,QAAQ,EAAE,eAAe,CAAC,eAAe,CAAC,UAAU,CAAC,CAAA;CACtD,CAAC,CAAA"}
|
package/dist/devtools/store.js
CHANGED
|
@@ -39,14 +39,14 @@ export const createDevtoolsStore = (bridge, maxEntries = DEFAULT_MAX_ENTRIES) =>
|
|
|
39
39
|
maybeInitModel: Option.some(model),
|
|
40
40
|
keyframes: HashMap.set(state.keyframes, 0, model),
|
|
41
41
|
}));
|
|
42
|
-
const recordMessage = (message, modelAfterUpdate,
|
|
42
|
+
const recordMessage = (message, modelAfterUpdate, commandNames, isModelChanged) => SubscriptionRef.update(stateRef, state => {
|
|
43
43
|
const absoluteIndex = state.startIndex + state.entries.length;
|
|
44
44
|
const nextState = {
|
|
45
45
|
...state,
|
|
46
46
|
entries: Array.append(state.entries, {
|
|
47
47
|
tag: message._tag,
|
|
48
48
|
message,
|
|
49
|
-
|
|
49
|
+
commandNames,
|
|
50
50
|
timestamp: performance.now(),
|
|
51
51
|
isModelChanged,
|
|
52
52
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/runtime/runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,OAAO,EACP,MAAM,EAGN,KAAK,EAEL,MAAM,EAMN,MAAM,EAKP,MAAM,QAAQ,CAAA;AAGf,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAGzC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,GAAG,EAA+B,MAAM,QAAQ,CAAA;AAOzD,OAAO,KAAK,EAAyB,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/runtime/runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,OAAO,EACP,MAAM,EAGN,KAAK,EAEL,MAAM,EAMN,MAAM,EAKP,MAAM,QAAQ,CAAA;AAGf,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAGzC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,GAAG,EAA+B,MAAM,QAAQ,CAAA;AAOzD,OAAO,KAAK,EAAyB,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAOzC,0DAA0D;AAC1D,MAAM,MAAM,gBAAgB,GACxB,aAAa,GACb,YAAY,GACZ,UAAU,GACV,SAAS,CAAA;AAEb,wCAAwC;AACxC,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,QAAQ,CAAA;AAEjD;;;;GAIG;AACH,M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S,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EACzD,SAAS,GAAG,KAAK,EACjB,uBAAuB,GAAG,KAAK,EAE/B,MAAM,EAAE,yBAAyB,CAC/B,KAAK,EACL,OAAO,EACP,aAAa,EACb,SAAS,EACT,uBAAuB,CACxB,GACA,iBAAiB,CAAA;AAiFpB,wGAAwG;AACxG,wBAAgB,eAAe,CAC7B,KAAK,EACL,OAAO,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAChC,aAAa,SAAS,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EACzD,KAAK,EACL,SAAS,GAAG,KAAK,EACjB,uBAAuB,GAAG,KAAK,EAE/B,MAAM,EAAE,0BAA0B,CAChC,KAAK,EACL,OAAO,EACP,aAAa,EACb,KAAK,EACL,SAAS,EACT,uBAAuB,CACxB,GACA,iBAAiB,CAAA;AAEpB,wBAAgB,eAAe,CAC7B,KAAK,EACL,OAAO,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAChC,aAAa,SAAS,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EACzD,SAAS,GAAG,KAAK,EACjB,uBAAuB,GAAG,KAAK,EAE/B,MAAM,EAAE,6BAA6B,CACnC,KAAK,EACL,OAAO,EACP,aAAa,EACb,SAAS,EACT,uBAAuB,CACxB,GACA,iBAAiB,CAAA;AA4FpB,kEAAkE;AAClE,eAAO,MAAM,GAAG,GAAI,gBAAgB,iBAAiB,KAAG,IA+BvD,CAAA"}
|
package/dist/runtime/runtime.js
CHANGED
|
@@ -75,7 +75,9 @@ const makeRuntime = ({ Model, flags: resolveFlags, init, update, view, subscript
|
|
|
75
75
|
}))
|
|
76
76
|
: init(flags, Option.getOrUndefined(currentUrl));
|
|
77
77
|
const modelSubscriptionRef = yield* SubscriptionRef.make(initModel);
|
|
78
|
-
yield* Effect.forEach(
|
|
78
|
+
yield* Effect.forEach(
|
|
79
|
+
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */
|
|
80
|
+
initCommands, command => Effect.forkDaemon(command.effect.pipe(Effect.withSpan(command.name), provideAllResources, Effect.flatMap(enqueueMessage))));
|
|
79
81
|
if (browserConfig) {
|
|
80
82
|
addNavigationEventListeners(messageQueue, browserConfig);
|
|
81
83
|
}
|
|
@@ -101,13 +103,17 @@ const makeRuntime = ({ Model, flags: resolveFlags, init, update, view, subscript
|
|
|
101
103
|
preserveModel(nextModel);
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
|
-
yield* Effect.forEach(
|
|
106
|
+
yield* Effect.forEach(
|
|
107
|
+
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */
|
|
108
|
+
commands, command => Effect.forkDaemon(command.effect.pipe(Effect.withSpan(command.name), provideAllResources, Effect.flatMap(enqueueMessage))));
|
|
105
109
|
const maybeDevtoolsStore = yield* Ref.get(maybeDevtoolsStoreRef);
|
|
106
110
|
yield* Option.match(maybeDevtoolsStore, {
|
|
107
111
|
onNone: () => Effect.void,
|
|
108
112
|
onSome: store => store.recordMessage(
|
|
109
113
|
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */
|
|
110
|
-
message, nextModel,
|
|
114
|
+
message, nextModel, Array.map(
|
|
115
|
+
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */
|
|
116
|
+
commands, command => command.name), !modelEquivalence(currentModel, nextModel)),
|
|
111
117
|
});
|
|
112
118
|
});
|
|
113
119
|
const runProcessMessage = (message, messageEffect) => (runtime) => {
|
|
@@ -191,7 +197,7 @@ const makeRuntime = ({ Model, flags: resolveFlags, init, update, view, subscript
|
|
|
191
197
|
if (subscriptions) {
|
|
192
198
|
yield* pipe(subscriptions, Record.toEntries, Effect.forEach(([_key, { schema, modelToDependencies, depsToStream }]) => {
|
|
193
199
|
const modelStream = Stream.concat(Stream.make(initModel), modelSubscriptionRef.changes);
|
|
194
|
-
return Effect.forkDaemon(modelStream.pipe(Stream.map(modelToDependencies), Stream.changesWith(Schema.equivalence(schema)), Stream.flatMap(depsToStream, { switch: true }), Stream.runForEach(command => command.pipe(Effect.flatMap(enqueueMessage))), provideAllResources));
|
|
200
|
+
return Effect.forkDaemon(modelStream.pipe(Stream.map(modelToDependencies), Stream.changesWith(Schema.equivalence(schema)), Stream.flatMap(depsToStream, { switch: true }), Stream.runForEach((command) => command.effect.pipe(Effect.withSpan(command.name), Effect.flatMap(enqueueMessage))), provideAllResources));
|
|
195
201
|
}, {
|
|
196
202
|
concurrency: 'unbounded',
|
|
197
203
|
discard: true,
|
package/dist/task/dom.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { Effect } from 'effect';
|
|
|
2
2
|
import { ElementNotFound } from './error';
|
|
3
3
|
/**
|
|
4
4
|
* Focuses an element matching the given selector.
|
|
5
|
-
* Uses requestAnimationFrame to ensure the DOM is updated before attempting to focus.
|
|
6
5
|
* Fails with `ElementNotFound` if the selector does not match an `HTMLElement`.
|
|
7
6
|
*
|
|
8
7
|
* @example
|
|
@@ -16,12 +15,9 @@ export declare const focus: (selector: string) => Effect.Effect<void, ElementNot
|
|
|
16
15
|
* and Escape key handling. Uses `show()` instead of `showModal()` so that
|
|
17
16
|
* DevTools (and any other high-z-index overlay) remains interactive — the
|
|
18
17
|
* Dialog component provides its own backdrop, scroll locking, and transitions.
|
|
19
|
-
* Uses requestAnimationFrame to ensure the DOM is updated before attempting to show.
|
|
20
18
|
* Fails with `ElementNotFound` if the selector does not match an `HTMLDialogElement`.
|
|
21
19
|
*
|
|
22
|
-
* Pass `focusSelector` to focus an element inside the dialog
|
|
23
|
-
* as `show()` — required on mobile browsers where `focus()` is ignored outside
|
|
24
|
-
* the original user-gesture call stack.
|
|
20
|
+
* Pass `focusSelector` to focus an element inside the dialog when it opens.
|
|
25
21
|
*
|
|
26
22
|
* @example
|
|
27
23
|
* ```typescript
|
|
@@ -35,7 +31,6 @@ export declare const showModal: (selector: string, options?: Readonly<{
|
|
|
35
31
|
/**
|
|
36
32
|
* Closes a dialog element using `.close()`.
|
|
37
33
|
* Cleans up the keyboard handlers installed by `showModal`.
|
|
38
|
-
* Uses requestAnimationFrame to ensure the DOM is updated before attempting to close.
|
|
39
34
|
* Fails with `ElementNotFound` if the selector does not match an `HTMLDialogElement`.
|
|
40
35
|
*
|
|
41
36
|
* @example
|
|
@@ -46,7 +41,6 @@ export declare const showModal: (selector: string, options?: Readonly<{
|
|
|
46
41
|
export declare const closeModal: (selector: string) => Effect.Effect<void, ElementNotFound>;
|
|
47
42
|
/**
|
|
48
43
|
* Programmatically clicks an element matching the given selector.
|
|
49
|
-
* Uses requestAnimationFrame to ensure the DOM is updated before attempting to click.
|
|
50
44
|
* Fails with `ElementNotFound` if the selector does not match an `HTMLElement`.
|
|
51
45
|
*
|
|
52
46
|
* @example
|
|
@@ -57,7 +51,6 @@ export declare const closeModal: (selector: string) => Effect.Effect<void, Eleme
|
|
|
57
51
|
export declare const clickElement: (selector: string) => Effect.Effect<void, ElementNotFound>;
|
|
58
52
|
/**
|
|
59
53
|
* Scrolls an element into view by selector using `{ block: 'nearest' }`.
|
|
60
|
-
* Uses requestAnimationFrame to ensure the DOM is updated before attempting to scroll.
|
|
61
54
|
* Fails with `ElementNotFound` if the selector does not match an `HTMLElement`.
|
|
62
55
|
*
|
|
63
56
|
* @example
|
|
@@ -70,7 +63,6 @@ export declare const scrollIntoView: (selector: string) => Effect.Effect<void, E
|
|
|
70
63
|
export type FocusDirection = 'Next' | 'Previous';
|
|
71
64
|
/**
|
|
72
65
|
* Focuses the next or previous focusable element in the document relative to the element matching the given selector.
|
|
73
|
-
* Uses requestAnimationFrame to ensure the DOM is updated before querying focus order.
|
|
74
66
|
* Fails with `ElementNotFound` if the selector does not match an `HTMLElement`.
|
|
75
67
|
*
|
|
76
68
|
* @example
|
package/dist/task/dom.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.d.ts","sourceRo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