foldkit 0.88.1 → 0.90.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/command/index.d.ts.map +1 -1
- package/dist/command/index.js +3 -11
- package/dist/devTools/overlay.d.ts +3 -3
- package/dist/devTools/overlay.d.ts.map +1 -1
- package/dist/devTools/overlay.js +62 -24
- package/dist/devTools/protocol.d.ts +77 -19
- package/dist/devTools/protocol.d.ts.map +1 -1
- package/dist/devTools/protocol.js +10 -5
- package/dist/devTools/serialize.d.ts +8 -2
- package/dist/devTools/serialize.d.ts.map +1 -1
- package/dist/devTools/serialize.js +11 -2
- package/dist/devTools/store.d.ts +9 -5
- package/dist/devTools/store.d.ts.map +1 -1
- package/dist/devTools/store.js +13 -13
- package/dist/devTools/webSocketBridge.d.ts.map +1 -1
- package/dist/devTools/webSocketBridge.js +2 -2
- package/dist/html/index.d.ts +12 -0
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +20 -4
- package/dist/mount/index.d.ts +64 -21
- package/dist/mount/index.d.ts.map +1 -1
- package/dist/mount/index.js +43 -32
- package/dist/mount/public.d.ts +1 -1
- package/dist/mount/public.d.ts.map +1 -1
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +4 -4
- package/dist/test/apps/counter.d.ts +5 -1
- package/dist/test/apps/counter.d.ts.map +1 -1
- package/dist/test/apps/counter.js +34 -5
- package/dist/test/apps/mountPanel.d.ts +19 -3
- package/dist/test/apps/mountPanel.d.ts.map +1 -1
- package/dist/test/apps/mountPanel.js +36 -15
- package/dist/test/internal.d.ts +56 -26
- package/dist/test/internal.d.ts.map +1 -1
- package/dist/test/internal.js +75 -82
- package/dist/test/scene.d.ts +12 -8
- package/dist/test/scene.d.ts.map +1 -1
- package/dist/test/scene.js +56 -39
- package/dist/test/story.d.ts +5 -1
- package/dist/test/story.d.ts.map +1 -1
- package/dist/test/story.js +16 -4
- package/dist/ui/anchor.d.ts +12 -8
- package/dist/ui/anchor.d.ts.map +1 -1
- package/dist/ui/anchor.js +41 -16
- package/dist/ui/combobox/multi.d.ts +1 -7
- package/dist/ui/combobox/multi.d.ts.map +1 -1
- package/dist/ui/combobox/shared.d.ts +14 -5
- package/dist/ui/combobox/shared.d.ts.map +1 -1
- package/dist/ui/combobox/shared.js +40 -40
- package/dist/ui/combobox/single.d.ts +1 -7
- package/dist/ui/combobox/single.d.ts.map +1 -1
- package/dist/ui/listbox/multi.d.ts +1 -7
- package/dist/ui/listbox/multi.d.ts.map +1 -1
- package/dist/ui/listbox/shared.d.ts +12 -3
- package/dist/ui/listbox/shared.d.ts.map +1 -1
- package/dist/ui/listbox/shared.js +8 -12
- package/dist/ui/listbox/single.d.ts +1 -7
- package/dist/ui/listbox/single.d.ts.map +1 -1
- package/dist/ui/menu/index.d.ts +12 -3
- package/dist/ui/menu/index.d.ts.map +1 -1
- package/dist/ui/menu/index.js +8 -12
- package/dist/ui/popover/index.d.ts +13 -3
- package/dist/ui/popover/index.d.ts.map +1 -1
- package/dist/ui/popover/index.js +22 -15
- package/dist/ui/tooltip/index.d.ts +11 -2
- package/dist/ui/tooltip/index.d.ts.map +1 -1
- package/dist/ui/tooltip/index.js +10 -10
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAuB,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE5D,qDAAqD;AAErD,eAAO,MAAM,uBAAuB,EAAE,OAAO,MAEN,CAAA;AAEvC,qDAAqD;AACrD,MAAM,MAAM,uBAAuB,GAAG,OAAO,uBAAuB,CAAA;AAEpE,iGAAiG;AACjG,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,CA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AAC;QAChB,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;KACjC,CAAC,EACF,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;QACV,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;KACjC,CAAC,CAAA;CAeH,CAAA"}
|
package/dist/command/index.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { Schema } from 'effect';
|
|
1
|
+
import { Function, Predicate, Schema } from 'effect';
|
|
2
2
|
/** Type-level brand for CommandDefinition values. */
|
|
3
3
|
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */
|
|
4
4
|
export const CommandDefinitionTypeId = Symbol.for('foldkit/CommandDefinition');
|
|
5
5
|
export function define(name, ...rest) {
|
|
6
6
|
const [maybeArgs] = rest;
|
|
7
|
-
const isArgsRecord = maybeArgs
|
|
8
|
-
typeof maybeArgs === 'object' &&
|
|
9
|
-
maybeArgs !== null &&
|
|
10
|
-
!Schema.isSchema(maybeArgs);
|
|
7
|
+
const isArgsRecord = Predicate.isObject(maybeArgs) && !Schema.isSchema(maybeArgs);
|
|
11
8
|
if (isArgsRecord) {
|
|
12
9
|
return (effectBuilder) => {
|
|
13
10
|
const definition = (args) => ({
|
|
@@ -40,9 +37,4 @@ export function define(name, ...rest) {
|
|
|
40
37
|
};
|
|
41
38
|
}
|
|
42
39
|
/** Transforms the Effect inside a Command while preserving its name and args. */
|
|
43
|
-
export const mapEffect = ((
|
|
44
|
-
? (command) => ({
|
|
45
|
-
...command,
|
|
46
|
-
effect: args[0](command.effect),
|
|
47
|
-
})
|
|
48
|
-
: { ...args[0], effect: args[1](args[0].effect) });
|
|
40
|
+
export const mapEffect = Function.dual(2, (command, f) => ({ ...command, effect: f(command.effect) }));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Context, Effect, HashSet, Option, Schema as S, SubscriptionRef } from 'effect';
|
|
2
2
|
import * as Command from '../command/index.js';
|
|
3
3
|
import type { DevToolsMode, DevToolsPosition } from '../runtime/runtime.js';
|
|
4
|
-
import { type CommandRecord, type DevToolsStore, type StoreState } from './store.js';
|
|
4
|
+
import { type CommandRecord, type DevToolsStore, type MountRecord, type StoreState } from './store.js';
|
|
5
5
|
declare const StoreService_base: Context.ServiceClass<StoreService, "foldkit/DevToolsStore", Readonly<{
|
|
6
|
-
recordInit: (model: unknown, commands: ReadonlyArray<CommandRecord>,
|
|
6
|
+
recordInit: (model: unknown, commands: ReadonlyArray<CommandRecord>, mountStarts?: ReadonlyArray<MountRecord>) => Effect.Effect<void>;
|
|
7
7
|
recordMessage: (message: Readonly<{
|
|
8
8
|
_tag: string;
|
|
9
9
|
}>, modelBeforeUpdate: unknown, modelAfterUpdate: unknown, commands: ReadonlyArray<CommandRecord>, isModelChanged: boolean) => Effect.Effect<void>;
|
|
10
|
-
attachRenderedMounts: (
|
|
10
|
+
attachRenderedMounts: (mountStarts: ReadonlyArray<MountRecord>, mountEnds: ReadonlyArray<MountRecord>) => Effect.Effect<void>;
|
|
11
11
|
getModelAtIndex: (index: number) => Effect.Effect<unknown>;
|
|
12
12
|
getMessageAtIndex: (index: number) => Effect.Effect<Option.Option<unknown>>;
|
|
13
13
|
getDiffAtIndex: (index: number) => Effect.Effect<import("./store.js").DiffResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../src/devTools/overlay.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,OAAO,EACP,MAAM,EAGN,OAAO,EAGP,MAAM,EAKN,MAAM,IAAI,CAAC,EAGX,eAAe,EAEhB,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../src/devTools/overlay.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,OAAO,EACP,MAAM,EAGN,OAAO,EAGP,MAAM,EAKN,MAAM,IAAI,CAAC,EAGX,eAAe,EAEhB,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAA;AAa9C,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAO3E,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAElB,KAAK,WAAW,EAChB,KAAK,UAAU,EAChB,MAAM,YAAY,CAAA;;oFAiYJ,CAAC;;;;;;;;;;;;;AAtIhB,cAAM,YAAa,SAAQ,iBAE1B;CAAG;;AAEJ,cAAM,iBAAkB,SAAQ,sBAGC;CAAG;AAEpC,eAAO,MAAM,UAAU;;iBAGsB,CAAA;AAE7C,eAAO,MAAM,YAAY;;iBAGwB,CAAA;AAWjD,eAAO,MAAM,MAAM;;;;wBAUlB,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;wBAIqB,CAAA;AAE9C,eAAO,MAAM,aAAa;;;;;;wBAYzB,CAAA;AAED,eAAO,MAAM,MAAM;;wBASlB,CAAA;AAED,eAAO,MAAM,KAAK;;wBASjB,CAAA;AAED,eAAO,MAAM,WAAW;;6BAYvB,CAAA;AAugDD,eAAO,MAAM,aAAa,GACxB,OAAO,aAAa,EACpB,UAAU,gBAAgB,EAC1B,MAAM,YAAY,EAClB,aAAa,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,sCAoDhC,CAAA"}
|
package/dist/devTools/overlay.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Array as Array_, Context, Effect, Equal, Function, HashSet, Match as M,
|
|
|
3
3
|
import * as Command from '../command/index.js';
|
|
4
4
|
import { lockScroll, unlockScroll } from '../dom/scrollLock.js';
|
|
5
5
|
import { OptionExt } from '../effectExtensions/index.js';
|
|
6
|
-
import { createKeyedLazy, createLazy, html, } from '../html/index.js';
|
|
6
|
+
import { DEVTOOLS_HOST_ID, createKeyedLazy, createLazy, html, } from '../html/index.js';
|
|
7
7
|
import { m } from '../message/index.js';
|
|
8
8
|
import { makeProgram } from '../runtime/runtime.js';
|
|
9
9
|
import { makeSubscriptions } from '../runtime/subscription.js';
|
|
@@ -19,13 +19,17 @@ const DisplayCommand = S.Struct({
|
|
|
19
19
|
name: S.String,
|
|
20
20
|
args: S.Option(S.Record(S.String, S.Unknown)),
|
|
21
21
|
});
|
|
22
|
+
const DisplayMount = S.Struct({
|
|
23
|
+
name: S.String,
|
|
24
|
+
args: S.Option(S.Record(S.String, S.Unknown)),
|
|
25
|
+
});
|
|
22
26
|
const DisplayEntry = S.Struct({
|
|
23
27
|
tag: S.String,
|
|
24
28
|
submodelPath: S.Array(S.String),
|
|
25
29
|
maybeLeafTag: S.Option(S.String),
|
|
26
30
|
commands: S.Array(DisplayCommand),
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
mountStarts: S.Array(DisplayMount),
|
|
32
|
+
mountEnds: S.Array(DisplayMount),
|
|
29
33
|
timestamp: S.Number,
|
|
30
34
|
isModelChanged: S.Boolean,
|
|
31
35
|
});
|
|
@@ -54,7 +58,7 @@ const Model = S.Struct({
|
|
|
54
58
|
isMobile: S.Boolean,
|
|
55
59
|
entries: S.Array(DisplayEntry),
|
|
56
60
|
initCommands: S.Array(DisplayCommand),
|
|
57
|
-
|
|
61
|
+
initMountStarts: S.Array(DisplayMount),
|
|
58
62
|
startIndex: S.Number,
|
|
59
63
|
isPaused: S.Boolean,
|
|
60
64
|
pausedAtIndex: S.Number,
|
|
@@ -74,7 +78,7 @@ const Flags = S.Struct({
|
|
|
74
78
|
isMobile: S.Boolean,
|
|
75
79
|
entries: S.Array(DisplayEntry),
|
|
76
80
|
initCommands: S.Array(DisplayCommand),
|
|
77
|
-
|
|
81
|
+
initMountStarts: S.Array(DisplayMount),
|
|
78
82
|
startIndex: S.Number,
|
|
79
83
|
isPaused: S.Boolean,
|
|
80
84
|
pausedAtIndex: S.Number,
|
|
@@ -107,7 +111,7 @@ const GotInspectorTabsMessage = m('GotInspectorTabsMessage', {
|
|
|
107
111
|
const ReceivedStoreUpdate = m('ReceivedStoreUpdate', {
|
|
108
112
|
entries: S.Array(DisplayEntry),
|
|
109
113
|
initCommands: S.Array(DisplayCommand),
|
|
110
|
-
|
|
114
|
+
initMountStarts: S.Array(DisplayMount),
|
|
111
115
|
startIndex: S.Number,
|
|
112
116
|
isPaused: S.Boolean,
|
|
113
117
|
pausedAtIndex: S.Number,
|
|
@@ -154,6 +158,10 @@ const toDisplayCommand = (command) => ({
|
|
|
154
158
|
name: command.name,
|
|
155
159
|
args: Option.fromNullishOr(command.args),
|
|
156
160
|
});
|
|
161
|
+
const toDisplayMount = (mount) => ({
|
|
162
|
+
name: mount.name,
|
|
163
|
+
args: Option.fromNullishOr(mount.args),
|
|
164
|
+
});
|
|
157
165
|
const toDisplayEntries = ({ entries }) => Array_.map(entries, entry => {
|
|
158
166
|
const { submodelPath, maybeLeafTag } = extractSubmodelInfo(entry.tag, entry.message);
|
|
159
167
|
return {
|
|
@@ -161,8 +169,8 @@ const toDisplayEntries = ({ entries }) => Array_.map(entries, entry => {
|
|
|
161
169
|
submodelPath,
|
|
162
170
|
maybeLeafTag,
|
|
163
171
|
commands: Array_.map(entry.commands, toDisplayCommand),
|
|
164
|
-
|
|
165
|
-
|
|
172
|
+
mountStarts: Array_.map(entry.mountStarts, toDisplayMount),
|
|
173
|
+
mountEnds: Array_.map(entry.mountEnds, toDisplayMount),
|
|
166
174
|
timestamp: entry.timestamp,
|
|
167
175
|
isModelChanged: entry.isModelChanged,
|
|
168
176
|
};
|
|
@@ -170,7 +178,7 @@ const toDisplayEntries = ({ entries }) => Array_.map(entries, entry => {
|
|
|
170
178
|
const toDisplayState = (state) => ({
|
|
171
179
|
entries: toDisplayEntries(state),
|
|
172
180
|
initCommands: Array_.map(state.initCommands, toDisplayCommand),
|
|
173
|
-
|
|
181
|
+
initMountStarts: Array_.map(state.initMountStarts, toDisplayMount),
|
|
174
182
|
startIndex: state.startIndex,
|
|
175
183
|
isPaused: state.isPaused,
|
|
176
184
|
pausedAtIndex: state.pausedAtIndex,
|
|
@@ -326,7 +334,7 @@ const makeUpdate = (store, shadow, mode) => {
|
|
|
326
334
|
}),
|
|
327
335
|
[],
|
|
328
336
|
],
|
|
329
|
-
ReceivedStoreUpdate: ({ entries, initCommands,
|
|
337
|
+
ReceivedStoreUpdate: ({ entries, initCommands, initMountStarts, startIndex, isPaused, pausedAtIndex, }) => {
|
|
330
338
|
const shouldFollowLatest = M.value(mode).pipe(M.when('TimeTravel', () => !isPaused), M.when('Inspect', () => model.isFollowingLatest), M.exhaustive);
|
|
331
339
|
const latestIndex = Array_.match(entries, {
|
|
332
340
|
onEmpty: () => INIT_INDEX,
|
|
@@ -338,7 +346,7 @@ const makeUpdate = (store, shadow, mode) => {
|
|
|
338
346
|
evo(model, {
|
|
339
347
|
entries: () => entries,
|
|
340
348
|
initCommands: () => initCommands,
|
|
341
|
-
|
|
349
|
+
initMountStarts: () => initMountStarts,
|
|
342
350
|
startIndex: () => startIndex,
|
|
343
351
|
isPaused: () => isPaused,
|
|
344
352
|
pausedAtIndex: () => pausedAtIndex,
|
|
@@ -666,30 +674,49 @@ const makeView = (position, mode, maybeBanner) => {
|
|
|
666
674
|
const selectedMountActivity = (model) => {
|
|
667
675
|
const selectedIndex = selectedHistoryIndex(model);
|
|
668
676
|
if (selectedIndex === INIT_INDEX) {
|
|
669
|
-
return { starts: model.
|
|
677
|
+
return { starts: model.initMountStarts, ends: NO_MOUNTS };
|
|
670
678
|
}
|
|
671
679
|
else {
|
|
672
680
|
return pipe(model.entries, Array_.get(selectedIndex - model.startIndex), Option.match({
|
|
673
681
|
onNone: () => ({ starts: NO_MOUNTS, ends: NO_MOUNTS }),
|
|
674
682
|
onSome: entry => ({
|
|
675
|
-
starts: entry.
|
|
676
|
-
ends: entry.
|
|
683
|
+
starts: entry.mountStarts,
|
|
684
|
+
ends: entry.mountEnds,
|
|
677
685
|
}),
|
|
678
686
|
}));
|
|
679
687
|
}
|
|
680
688
|
};
|
|
681
|
-
const
|
|
689
|
+
const flattenMount = (mount, sectionLabel, index, expandedPaths) => {
|
|
690
|
+
const taggedValue = Option.match(mount.args, {
|
|
691
|
+
onNone: () => ({ _tag: mount.name }),
|
|
692
|
+
onSome: argsValue => ({ ...argsValue, _tag: mount.name }),
|
|
693
|
+
});
|
|
694
|
+
const rootPath = `mount-${sectionLabel}-${index}`;
|
|
695
|
+
const nodes = [];
|
|
696
|
+
flattenTree({
|
|
697
|
+
value: toInspectableValue(taggedValue),
|
|
698
|
+
treePath: rootPath,
|
|
699
|
+
rootPath,
|
|
700
|
+
expandedPaths,
|
|
701
|
+
changedPaths: HashSet.empty(),
|
|
702
|
+
affectedPaths: HashSet.empty(),
|
|
703
|
+
depth: 0,
|
|
704
|
+
key: '',
|
|
705
|
+
accumulator: nodes,
|
|
706
|
+
indentRootChildren: false,
|
|
707
|
+
});
|
|
708
|
+
return nodes;
|
|
709
|
+
};
|
|
710
|
+
const mountListSection = (label, mounts, expandedPaths) => div([Class('flex flex-col shrink-0')], [
|
|
682
711
|
div([
|
|
683
712
|
Class('px-2 py-1 border-b text-2xs text-dt-muted font-mono shrink-0'),
|
|
684
713
|
], [label]),
|
|
685
|
-
...Array_.map(
|
|
686
|
-
Class('flex items-center px-2 py-1 text-base font-mono text-dt border-b gap-1.5'),
|
|
687
|
-
], [
|
|
714
|
+
...Array_.map(mounts, (mount, index) => div([Class('flex items-start px-2 py-1 border-b gap-1.5')], [
|
|
688
715
|
span([Class(indexClass)], [String(index + 1)]),
|
|
689
|
-
|
|
716
|
+
div([Class('flex flex-col flex-1 min-w-0')], Array_.map(flattenMount(mount, label, index, expandedPaths), renderFlatNode)),
|
|
690
717
|
])),
|
|
691
718
|
]);
|
|
692
|
-
const mountsTabContent = (starts, ends) => {
|
|
719
|
+
const mountsTabContent = (starts, ends, expandedPaths) => {
|
|
693
720
|
const hasAny = Array_.isReadonlyArrayNonEmpty(starts) ||
|
|
694
721
|
Array_.isReadonlyArrayNonEmpty(ends);
|
|
695
722
|
if (!hasAny) {
|
|
@@ -701,10 +728,10 @@ const makeView = (position, mode, maybeBanner) => {
|
|
|
701
728
|
Class('flex flex-col flex-1 min-h-0 min-w-0 overflow-auto overscroll-none'),
|
|
702
729
|
], [
|
|
703
730
|
...(Array_.isReadonlyArrayNonEmpty(starts)
|
|
704
|
-
? [mountListSection('Started', starts)]
|
|
731
|
+
? [mountListSection('Started', starts, expandedPaths)]
|
|
705
732
|
: []),
|
|
706
733
|
...(Array_.isReadonlyArrayNonEmpty(ends)
|
|
707
|
-
? [mountListSection('Ended', ends)]
|
|
734
|
+
? [mountListSection('Ended', ends, expandedPaths)]
|
|
708
735
|
: []),
|
|
709
736
|
]);
|
|
710
737
|
};
|
|
@@ -723,7 +750,11 @@ const makeView = (position, mode, maybeBanner) => {
|
|
|
723
750
|
model.expandedPaths,
|
|
724
751
|
])), M.when('Mounts', () => {
|
|
725
752
|
const { starts, ends } = selectedMountActivity(model);
|
|
726
|
-
return lazyTabContent('Mounts', mountsTabContent, [
|
|
753
|
+
return lazyTabContent('Mounts', mountsTabContent, [
|
|
754
|
+
starts,
|
|
755
|
+
ends,
|
|
756
|
+
model.expandedPaths,
|
|
757
|
+
]);
|
|
727
758
|
}), M.exhaustive);
|
|
728
759
|
const inspectorPaneView = (model) => div([
|
|
729
760
|
Class('flex flex-col border-l min-w-0 min-h-0 flex-1 dt-inspector-pane'),
|
|
@@ -970,7 +1001,6 @@ const makeView = (position, mode, maybeBanner) => {
|
|
|
970
1001
|
});
|
|
971
1002
|
};
|
|
972
1003
|
// CREATE
|
|
973
|
-
const DEVTOOLS_HOST_ID = 'foldkit-devtools';
|
|
974
1004
|
const createShadowContainer = () => {
|
|
975
1005
|
const existingHost = document.getElementById(DEVTOOLS_HOST_ID);
|
|
976
1006
|
if (existingHost) {
|
|
@@ -978,6 +1008,14 @@ const createShadowContainer = () => {
|
|
|
978
1008
|
}
|
|
979
1009
|
const host = document.createElement('div');
|
|
980
1010
|
host.id = DEVTOOLS_HOST_ID;
|
|
1011
|
+
host.addEventListener('pointerdown', event => {
|
|
1012
|
+
const activeElement = document.activeElement;
|
|
1013
|
+
if (activeElement !== null &&
|
|
1014
|
+
activeElement !== host &&
|
|
1015
|
+
activeElement !== document.body) {
|
|
1016
|
+
event.preventDefault();
|
|
1017
|
+
}
|
|
1018
|
+
}, { capture: true });
|
|
981
1019
|
document.body.appendChild(host);
|
|
982
1020
|
const shadow = host.attachShadow({ mode: 'open' });
|
|
983
1021
|
const styleElement = document.createElement('style');
|
|
@@ -6,7 +6,14 @@ export declare const SerializedCommand: S.Struct<{
|
|
|
6
6
|
}>;
|
|
7
7
|
/** A serialized Command suitable for transmission over the WS protocol. */
|
|
8
8
|
export type SerializedCommand = typeof SerializedCommand.Type;
|
|
9
|
-
/** A serialized
|
|
9
|
+
/** A serialized Mount lifecycle event (start or end). `args` is `Some` when the Mount's definition declared an args record, and carries the runtime values used to construct the MountAction instance. */
|
|
10
|
+
export declare const SerializedMount: S.Struct<{
|
|
11
|
+
readonly name: S.String;
|
|
12
|
+
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
13
|
+
}>;
|
|
14
|
+
/** A serialized Mount lifecycle event suitable for transmission over the WS protocol. */
|
|
15
|
+
export type SerializedMount = typeof SerializedMount.Type;
|
|
16
|
+
/** A serialized history entry as it appears on the wire. `submodelPath` lists `Got<Child>Message` wrapper tags from outer to inner when the entry came up through a Submodel chain; `maybeLeafTag` is `Some` with the innermost child Message tag when one exists. `mountStarts` lists Mounts that fired during the render after this Message; `mountEnds` lists Mounts whose elements were unmounted during that render. The Messages dispatched by mount Effects appear as their own entries elsewhere in history. */
|
|
10
17
|
export declare const SerializedEntry: S.Struct<{
|
|
11
18
|
readonly index: S.Number;
|
|
12
19
|
readonly tag: S.String;
|
|
@@ -15,8 +22,14 @@ export declare const SerializedEntry: S.Struct<{
|
|
|
15
22
|
readonly name: S.String;
|
|
16
23
|
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
17
24
|
}>>;
|
|
18
|
-
readonly
|
|
19
|
-
|
|
25
|
+
readonly mountStarts: S.$Array<S.Struct<{
|
|
26
|
+
readonly name: S.String;
|
|
27
|
+
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
28
|
+
}>>;
|
|
29
|
+
readonly mountEnds: S.$Array<S.Struct<{
|
|
30
|
+
readonly name: S.String;
|
|
31
|
+
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
32
|
+
}>>;
|
|
20
33
|
readonly timestamp: S.Number;
|
|
21
34
|
readonly isModelChanged: S.Boolean;
|
|
22
35
|
readonly changedPaths: S.$Array<S.String>;
|
|
@@ -114,8 +127,14 @@ export declare const ResponseMessages: import("../schema/index.js").CallableTagg
|
|
|
114
127
|
readonly name: S.String;
|
|
115
128
|
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
116
129
|
}>>;
|
|
117
|
-
readonly
|
|
118
|
-
|
|
130
|
+
readonly mountStarts: S.$Array<S.Struct<{
|
|
131
|
+
readonly name: S.String;
|
|
132
|
+
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
133
|
+
}>>;
|
|
134
|
+
readonly mountEnds: S.$Array<S.Struct<{
|
|
135
|
+
readonly name: S.String;
|
|
136
|
+
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
137
|
+
}>>;
|
|
119
138
|
readonly timestamp: S.Number;
|
|
120
139
|
readonly isModelChanged: S.Boolean;
|
|
121
140
|
readonly changedPaths: S.$Array<S.String>;
|
|
@@ -135,8 +154,14 @@ export declare const ResponseMessage: import("../schema/index.js").CallableTagge
|
|
|
135
154
|
readonly name: S.String;
|
|
136
155
|
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
137
156
|
}>>;
|
|
138
|
-
readonly
|
|
139
|
-
|
|
157
|
+
readonly mountStarts: S.$Array<S.Struct<{
|
|
158
|
+
readonly name: S.String;
|
|
159
|
+
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
160
|
+
}>>;
|
|
161
|
+
readonly mountEnds: S.$Array<S.Struct<{
|
|
162
|
+
readonly name: S.String;
|
|
163
|
+
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
164
|
+
}>>;
|
|
140
165
|
readonly timestamp: S.Number;
|
|
141
166
|
readonly isModelChanged: S.Boolean;
|
|
142
167
|
readonly changedPaths: S.$Array<S.String>;
|
|
@@ -169,14 +194,17 @@ export declare const ResponseRuntimes: import("../schema/index.js").CallableTagg
|
|
|
169
194
|
readonly title: S.String;
|
|
170
195
|
}>>;
|
|
171
196
|
}>;
|
|
172
|
-
/** Response carrying the recorded init data. `maybeModel` is `None` until the runtime has finished its first render and recorded init; once set it stays set for the rest of the runtime's life. `commands` lists the Commands returned from the application's `init` function in the order they were produced, with their args when declared. `
|
|
197
|
+
/** Response carrying the recorded init data. `maybeModel` is `None` until the runtime has finished its first render and recorded init; once set it stays set for the rest of the runtime's life. `commands` lists the Commands returned from the application's `init` function in the order they were produced, with their args when declared. `mountStarts` lists the Mounts that fired during the initial render, with their args when declared. */
|
|
173
198
|
export declare const ResponseInit: import("../schema/index.js").CallableTaggedStruct<"ResponseInit", {
|
|
174
199
|
maybeModel: S.OptionFromNullOr<S.Unknown>;
|
|
175
200
|
commands: S.$Array<S.Struct<{
|
|
176
201
|
readonly name: S.String;
|
|
177
202
|
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
178
203
|
}>>;
|
|
179
|
-
|
|
204
|
+
mountStarts: S.$Array<S.Struct<{
|
|
205
|
+
readonly name: S.String;
|
|
206
|
+
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
207
|
+
}>>;
|
|
180
208
|
}>;
|
|
181
209
|
/** Response carrying a snapshot of the runtime's DevTools state. `currentIndex` is the absolute index of the most recently recorded Message, or -1 when no Messages have been recorded yet. `startIndex` is the earliest absolute index still retained in the rolling buffer (older entries are evicted past `maxEntries`). `totalEntries` is the number of retained entries. `isPaused` is true while the runtime is paused at a replayed snapshot; `maybePausedAtIndex` is `Some(index)` then and `None` otherwise. `hasInitModel` is true once the runtime has finished initialising. */
|
|
182
210
|
export declare const ResponseRuntimeState: import("../schema/index.js").CallableTaggedStruct<"ResponseRuntimeState", {
|
|
@@ -205,8 +233,14 @@ export declare const Response: S.Union<readonly [import("../schema/index.js").Ca
|
|
|
205
233
|
readonly name: S.String;
|
|
206
234
|
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
207
235
|
}>>;
|
|
208
|
-
readonly
|
|
209
|
-
|
|
236
|
+
readonly mountStarts: S.$Array<S.Struct<{
|
|
237
|
+
readonly name: S.String;
|
|
238
|
+
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
239
|
+
}>>;
|
|
240
|
+
readonly mountEnds: S.$Array<S.Struct<{
|
|
241
|
+
readonly name: S.String;
|
|
242
|
+
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
243
|
+
}>>;
|
|
210
244
|
readonly timestamp: S.Number;
|
|
211
245
|
readonly isModelChanged: S.Boolean;
|
|
212
246
|
readonly changedPaths: S.$Array<S.String>;
|
|
@@ -224,8 +258,14 @@ export declare const Response: S.Union<readonly [import("../schema/index.js").Ca
|
|
|
224
258
|
readonly name: S.String;
|
|
225
259
|
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
226
260
|
}>>;
|
|
227
|
-
readonly
|
|
228
|
-
|
|
261
|
+
readonly mountStarts: S.$Array<S.Struct<{
|
|
262
|
+
readonly name: S.String;
|
|
263
|
+
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
264
|
+
}>>;
|
|
265
|
+
readonly mountEnds: S.$Array<S.Struct<{
|
|
266
|
+
readonly name: S.String;
|
|
267
|
+
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
268
|
+
}>>;
|
|
229
269
|
readonly timestamp: S.Number;
|
|
230
270
|
readonly isModelChanged: S.Boolean;
|
|
231
271
|
readonly changedPaths: S.$Array<S.String>;
|
|
@@ -253,7 +293,10 @@ export declare const Response: S.Union<readonly [import("../schema/index.js").Ca
|
|
|
253
293
|
readonly name: S.String;
|
|
254
294
|
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
255
295
|
}>>;
|
|
256
|
-
|
|
296
|
+
mountStarts: S.$Array<S.Struct<{
|
|
297
|
+
readonly name: S.String;
|
|
298
|
+
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
299
|
+
}>>;
|
|
257
300
|
}>, import("../schema/index.js").CallableTaggedStruct<"ResponseRuntimeState", {
|
|
258
301
|
currentIndex: S.Number;
|
|
259
302
|
startIndex: S.Number;
|
|
@@ -330,8 +373,14 @@ export declare const ResponseFrame: S.Struct<{
|
|
|
330
373
|
readonly name: S.String;
|
|
331
374
|
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
332
375
|
}>>;
|
|
333
|
-
readonly
|
|
334
|
-
|
|
376
|
+
readonly mountStarts: S.$Array<S.Struct<{
|
|
377
|
+
readonly name: S.String;
|
|
378
|
+
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
379
|
+
}>>;
|
|
380
|
+
readonly mountEnds: S.$Array<S.Struct<{
|
|
381
|
+
readonly name: S.String;
|
|
382
|
+
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
383
|
+
}>>;
|
|
335
384
|
readonly timestamp: S.Number;
|
|
336
385
|
readonly isModelChanged: S.Boolean;
|
|
337
386
|
readonly changedPaths: S.$Array<S.String>;
|
|
@@ -349,8 +398,14 @@ export declare const ResponseFrame: S.Struct<{
|
|
|
349
398
|
readonly name: S.String;
|
|
350
399
|
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
351
400
|
}>>;
|
|
352
|
-
readonly
|
|
353
|
-
|
|
401
|
+
readonly mountStarts: S.$Array<S.Struct<{
|
|
402
|
+
readonly name: S.String;
|
|
403
|
+
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
404
|
+
}>>;
|
|
405
|
+
readonly mountEnds: S.$Array<S.Struct<{
|
|
406
|
+
readonly name: S.String;
|
|
407
|
+
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
408
|
+
}>>;
|
|
354
409
|
readonly timestamp: S.Number;
|
|
355
410
|
readonly isModelChanged: S.Boolean;
|
|
356
411
|
readonly changedPaths: S.$Array<S.String>;
|
|
@@ -378,7 +433,10 @@ export declare const ResponseFrame: S.Struct<{
|
|
|
378
433
|
readonly name: S.String;
|
|
379
434
|
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
380
435
|
}>>;
|
|
381
|
-
|
|
436
|
+
mountStarts: S.$Array<S.Struct<{
|
|
437
|
+
readonly name: S.String;
|
|
438
|
+
readonly args: S.OptionFromNullOr<S.$Record<S.String, S.Unknown>>;
|
|
439
|
+
}>>;
|
|
382
440
|
}>, import("../schema/index.js").CallableTaggedStruct<"ResponseRuntimeState", {
|
|
383
441
|
currentIndex: S.Number;
|
|
384
442
|
startIndex: S.Number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/devTools/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAMpC,0NAA0N;AAC1N,eAAO,MAAM,iBAAiB;;;EAG5B,CAAA;AACF,2EAA2E;AAC3E,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAA;AAE7D,
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/devTools/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAMpC,0NAA0N;AAC1N,eAAO,MAAM,iBAAiB;;;EAG5B,CAAA;AACF,2EAA2E;AAC3E,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAA;AAE7D,0MAA0M;AAC1M,eAAO,MAAM,eAAe;;;EAG1B,CAAA;AACF,yFAAyF;AACzF,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAA;AAEzD,wfAAwf;AACxf,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;EAa1B,CAAA;AACF,iFAAiF;AACjF,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAA;AAEzD,wHAAwH;AACxH,eAAO,MAAM,YAAY;;EAEvB,CAAA;AACF,wCAAwC;AACxC,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAA;AAEnD,kDAAkD;AAClD,eAAO,MAAM,WAAW;;;;EAItB,CAAA;AACF,kDAAkD;AAClD,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAIjD,yFAAyF;AACzF,eAAO,MAAM,eAAe;;;EAG1B,CAAA;AAEF,8JAA8J;AAC9J,eAAO,MAAM,iBAAiB;;;;EAI5B,CAAA;AA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});
|
|
9
|
-
/** A serialized
|
|
9
|
+
/** A serialized Mount lifecycle event (start or end). `args` is `Some` when the Mount's definition declared an args record, and carries the runtime values used to construct the MountAction instance. */
|
|
10
|
+
export const SerializedMount = S.Struct({
|
|
11
|
+
name: S.String,
|
|
12
|
+
args: S.OptionFromNullOr(S.Record(S.String, S.Unknown)),
|
|
13
|
+
});
|
|
14
|
+
/** A serialized history entry as it appears on the wire. `submodelPath` lists `Got<Child>Message` wrapper tags from outer to inner when the entry came up through a Submodel chain; `maybeLeafTag` is `Some` with the innermost child Message tag when one exists. `mountStarts` lists Mounts that fired during the render after this Message; `mountEnds` lists Mounts whose elements were unmounted during that render. The Messages dispatched by mount Effects appear as their own entries elsewhere in history. */
|
|
10
15
|
export const SerializedEntry = S.Struct({
|
|
11
16
|
index: S.Number,
|
|
12
17
|
tag: S.String,
|
|
13
18
|
message: S.Unknown,
|
|
14
19
|
commands: S.Array(SerializedCommand),
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
mountStarts: S.Array(SerializedMount),
|
|
21
|
+
mountEnds: S.Array(SerializedMount),
|
|
17
22
|
timestamp: S.Number,
|
|
18
23
|
isModelChanged: S.Boolean,
|
|
19
24
|
changedPaths: S.Array(S.String),
|
|
@@ -118,11 +123,11 @@ export const ResponseDispatched = ts('ResponseDispatched', {
|
|
|
118
123
|
export const ResponseRuntimes = ts('ResponseRuntimes', {
|
|
119
124
|
runtimes: S.Array(RuntimeInfo),
|
|
120
125
|
});
|
|
121
|
-
/** Response carrying the recorded init data. `maybeModel` is `None` until the runtime has finished its first render and recorded init; once set it stays set for the rest of the runtime's life. `commands` lists the Commands returned from the application's `init` function in the order they were produced, with their args when declared. `
|
|
126
|
+
/** Response carrying the recorded init data. `maybeModel` is `None` until the runtime has finished its first render and recorded init; once set it stays set for the rest of the runtime's life. `commands` lists the Commands returned from the application's `init` function in the order they were produced, with their args when declared. `mountStarts` lists the Mounts that fired during the initial render, with their args when declared. */
|
|
122
127
|
export const ResponseInit = ts('ResponseInit', {
|
|
123
128
|
maybeModel: S.OptionFromNullOr(S.Unknown),
|
|
124
129
|
commands: S.Array(SerializedCommand),
|
|
125
|
-
|
|
130
|
+
mountStarts: S.Array(SerializedMount),
|
|
126
131
|
});
|
|
127
132
|
/** Response carrying a snapshot of the runtime's DevTools state. `currentIndex` is the absolute index of the most recently recorded Message, or -1 when no Messages have been recorded yet. `startIndex` is the earliest absolute index still retained in the rolling buffer (older entries are evicted past `maxEntries`). `totalEntries` is the number of retained entries. `isPaused` is true while the runtime is paused at a replayed snapshot; `maybePausedAtIndex` is `Some(index)` then and `None` otherwise. `hasInitModel` is true once the runtime has finished initialising. */
|
|
128
133
|
export const ResponseRuntimeState = ts('ResponseRuntimeState', {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SerializedCommand, SerializedEntry } from './protocol.js';
|
|
2
|
-
import type { CommandRecord, HistoryEntry } from './store.js';
|
|
1
|
+
import type { SerializedCommand, SerializedEntry, SerializedMount } from './protocol.js';
|
|
2
|
+
import type { CommandRecord, HistoryEntry, MountRecord } from './store.js';
|
|
3
3
|
/**
|
|
4
4
|
* Convert DOM-class instances (File, Blob, Date, URL) to plain-object
|
|
5
5
|
* representations so the tree renderer's key-enumeration walk can see their
|
|
@@ -25,6 +25,12 @@ export declare const toInspectableValue: (value: unknown) => unknown;
|
|
|
25
25
|
* happen to have an empty args record.
|
|
26
26
|
*/
|
|
27
27
|
export declare const toSerializedCommand: (command: CommandRecord) => SerializedCommand;
|
|
28
|
+
/**
|
|
29
|
+
* Convert a runtime `MountRecord` to its wire shape. Args are wrapped in an
|
|
30
|
+
* `Option` so `None` cleanly distinguishes argless Mounts from Mounts that
|
|
31
|
+
* happen to have an empty args record.
|
|
32
|
+
*/
|
|
33
|
+
export declare const toSerializedMount: (mount: MountRecord) => SerializedMount;
|
|
28
34
|
/**
|
|
29
35
|
* Convert a `HistoryEntry` plus its absolute index into the wire-friendly
|
|
30
36
|
* `SerializedEntry` shape. Flattens the diff's `HashSet` path collections to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/devTools/serialize.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/devTools/serialize.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,eAAe,EAChB,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAwB1E;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,KAAG,OAUnD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,aAAa,KACrB,iBAGD,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,WAAW,KAAG,eAGrD,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC5B,OAAO,YAAY,EACnB,OAAO,MAAM,KACZ,eAoBF,CAAA"}
|
|
@@ -48,6 +48,15 @@ export const toSerializedCommand = (command) => ({
|
|
|
48
48
|
name: command.name,
|
|
49
49
|
args: Option.fromNullishOr(command.args),
|
|
50
50
|
});
|
|
51
|
+
/**
|
|
52
|
+
* Convert a runtime `MountRecord` to its wire shape. Args are wrapped in an
|
|
53
|
+
* `Option` so `None` cleanly distinguishes argless Mounts from Mounts that
|
|
54
|
+
* happen to have an empty args record.
|
|
55
|
+
*/
|
|
56
|
+
export const toSerializedMount = (mount) => ({
|
|
57
|
+
name: mount.name,
|
|
58
|
+
args: Option.fromNullishOr(mount.args),
|
|
59
|
+
});
|
|
51
60
|
/**
|
|
52
61
|
* Convert a `HistoryEntry` plus its absolute index into the wire-friendly
|
|
53
62
|
* `SerializedEntry` shape. Flattens the diff's `HashSet` path collections to
|
|
@@ -61,8 +70,8 @@ export const toSerializedEntry = (entry, index) => {
|
|
|
61
70
|
tag: entry.tag,
|
|
62
71
|
message: toInspectableValue(entry.message),
|
|
63
72
|
commands: Array_.map(entry.commands, toSerializedCommand),
|
|
64
|
-
|
|
65
|
-
|
|
73
|
+
mountStarts: Array_.map(entry.mountStarts, toSerializedMount),
|
|
74
|
+
mountEnds: Array_.map(entry.mountEnds, toSerializedMount),
|
|
66
75
|
timestamp: entry.timestamp,
|
|
67
76
|
isModelChanged: entry.isModelChanged,
|
|
68
77
|
changedPaths: Array_.fromIterable(entry.diff.changedPaths),
|
package/dist/devTools/store.d.ts
CHANGED
|
@@ -10,12 +10,16 @@ export type CommandRecord = Readonly<{
|
|
|
10
10
|
name: string;
|
|
11
11
|
args?: Record<string, unknown>;
|
|
12
12
|
}>;
|
|
13
|
+
export type MountRecord = Readonly<{
|
|
14
|
+
name: string;
|
|
15
|
+
args?: Record<string, unknown>;
|
|
16
|
+
}>;
|
|
13
17
|
export type HistoryEntry = Readonly<{
|
|
14
18
|
tag: string;
|
|
15
19
|
message: unknown;
|
|
16
20
|
commands: ReadonlyArray<CommandRecord>;
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
mountStarts: ReadonlyArray<MountRecord>;
|
|
22
|
+
mountEnds: ReadonlyArray<MountRecord>;
|
|
19
23
|
timestamp: number;
|
|
20
24
|
isModelChanged: boolean;
|
|
21
25
|
diff: DiffResult;
|
|
@@ -25,7 +29,7 @@ export type StoreState = Readonly<{
|
|
|
25
29
|
keyframes: HashMap.HashMap<number, unknown>;
|
|
26
30
|
maybeInitModel: Option.Option<unknown>;
|
|
27
31
|
initCommands: ReadonlyArray<CommandRecord>;
|
|
28
|
-
|
|
32
|
+
initMountStarts: ReadonlyArray<MountRecord>;
|
|
29
33
|
startIndex: number;
|
|
30
34
|
isPaused: boolean;
|
|
31
35
|
pausedAtIndex: number;
|
|
@@ -38,11 +42,11 @@ export type Bridge = Readonly<{
|
|
|
38
42
|
}>;
|
|
39
43
|
export declare const createDevToolsStore: (bridge: Bridge, maxEntries?: number) => Effect.Effect<DevToolsStore>;
|
|
40
44
|
export type DevToolsStore = Readonly<{
|
|
41
|
-
recordInit: (model: unknown, commands: ReadonlyArray<CommandRecord>,
|
|
45
|
+
recordInit: (model: unknown, commands: ReadonlyArray<CommandRecord>, mountStarts?: ReadonlyArray<MountRecord>) => Effect.Effect<void>;
|
|
42
46
|
recordMessage: (message: Readonly<{
|
|
43
47
|
_tag: string;
|
|
44
48
|
}>, modelBeforeUpdate: unknown, modelAfterUpdate: unknown, commands: ReadonlyArray<CommandRecord>, isModelChanged: boolean) => Effect.Effect<void>;
|
|
45
|
-
attachRenderedMounts: (
|
|
49
|
+
attachRenderedMounts: (mountStarts: ReadonlyArray<MountRecord>, mountEnds: ReadonlyArray<MountRecord>) => Effect.Effect<void>;
|
|
46
50
|
getModelAtIndex: (index: number) => Effect.Effect<unknown>;
|
|
47
51
|
getMessageAtIndex: (index: number) => Effect.Effect<Option.Option<unknown>>;
|
|
48
52
|
getDiffAtIndex: (index: number) => Effect.Effect<DiffResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/devTools/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EACN,OAAO,EACP,OAAO,EAEP,MAAM,EAIN,eAAe,EAEhB,MAAM,QAAQ,CAAA;AAEf,eAAO,MAAM,UAAU,KAAK,CAAA;AAM5B,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACrC,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;CACvC,CAAC,CAAA;AAEF,eAAO,MAAM,SAAS,EAAE,UAGvB,CAAA;AAID,eAAO,MAAM,WAAW,GACtB,UAAU,OAAO,EACjB,SAAS,OAAO,KACf,UA6EF,CAAA;AAID,MAAM,MAAM,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