@foldkit/devtools 0.168.0-canary.060271955cc2 → 0.168.0-canary.1fbeaffe6563
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 +16 -10
- package/dist/overlay.d.ts +430 -26
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +536 -494
- package/package.json +6 -6
package/dist/overlay.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
-
import { Array, Context, Effect, Function, HashMap, HashSet, Match, Number, Option, Order, Predicate, Record, Schema, Stream, String, SubscriptionRef, pipe, } from 'effect';
|
|
3
|
+
import { Array, Context, Effect, Function, HashMap, HashSet, Layer, Match, Number, Option, Order, Predicate, Record, Schema, Stream, String, SubscriptionRef, Tuple, pipe, } from 'effect';
|
|
4
4
|
import { KeyValueStore } from 'effect/persistence';
|
|
5
|
-
import { Update } from 'foldkit';
|
|
6
|
-
import
|
|
7
|
-
import { DEVTOOLS_HOST_ID, GOT_MESSAGE_PATTERN, INIT_INDEX, extractSubmodelInfo, isTagged, latestEntryIndex, toInspectableValue, } from 'foldkit/devtools-host';
|
|
5
|
+
import { Block, Program, Update } from 'foldkit';
|
|
6
|
+
import { DEVTOOLS_HOST_ID, GOT_MESSAGE_PATTERN, INIT_INDEX, extractBlockInfo, isTagged, latestEntryIndex, toInspectableValue, } from 'foldkit/devtools-host';
|
|
8
7
|
import * as Dom from 'foldkit/dom';
|
|
9
8
|
import { lockScroll, unlockScroll } from 'foldkit/dom';
|
|
10
|
-
import { createKeyedLazy, createLazy
|
|
9
|
+
import { createKeyedLazy, createLazy } from 'foldkit/html';
|
|
11
10
|
import { defineMessageUnion } from 'foldkit/message';
|
|
12
|
-
import { makeElement } from 'foldkit/runtime';
|
|
13
11
|
import { defineTaggedUnion } from 'foldkit/schema';
|
|
14
12
|
import { modifyFields } from 'foldkit/struct';
|
|
15
|
-
import * as Subscription from 'foldkit/subscription';
|
|
16
13
|
import { BrowserKeyValueStore } from '@effect/platform-browser';
|
|
17
14
|
import * as Listbox from '@foldkit/ui/listbox';
|
|
18
15
|
import * as Slider from '@foldkit/ui/slider';
|
|
@@ -20,12 +17,12 @@ import * as Switch from '@foldkit/ui/switch';
|
|
|
20
17
|
import * as Tabs from '@foldkit/ui/tabs';
|
|
21
18
|
import * as OptionExt from './internal/optionExtensions.js';
|
|
22
19
|
import { overlayStyles } from './overlay-styles.js';
|
|
23
|
-
const
|
|
20
|
+
const BlockFilterListboxBlock = Listbox.create();
|
|
24
21
|
// MODEL
|
|
25
22
|
const DisplayCommand = Schema.Struct({
|
|
26
23
|
name: Schema.String,
|
|
27
24
|
args: Schema.Option(Schema.Record(Schema.String, Schema.Unknown)),
|
|
28
|
-
|
|
25
|
+
maybeBlockPath: Schema.Option(Schema.Array(Schema.String)),
|
|
29
26
|
});
|
|
30
27
|
const DisplayMount = Schema.Struct({
|
|
31
28
|
name: Schema.String,
|
|
@@ -33,7 +30,7 @@ const DisplayMount = Schema.Struct({
|
|
|
33
30
|
});
|
|
34
31
|
const DisplayEntry = Schema.Struct({
|
|
35
32
|
tag: Schema.String,
|
|
36
|
-
|
|
33
|
+
blockPath: Schema.Array(Schema.String),
|
|
37
34
|
maybeLeafTag: Schema.Option(Schema.String),
|
|
38
35
|
commands: Schema.Array(DisplayCommand),
|
|
39
36
|
mountStarts: Schema.Array(DisplayMount),
|
|
@@ -46,12 +43,12 @@ const CopyState = defineTaggedUnion({
|
|
|
46
43
|
Copied: { requestId: Schema.Number },
|
|
47
44
|
});
|
|
48
45
|
const INSPECTOR_TABS_ID = 'dt-inspector';
|
|
49
|
-
const
|
|
46
|
+
const BLOCK_FILTER_ID = 'dt-block-filter';
|
|
50
47
|
const FLATTEN_SWITCH_ID = 'dt-flatten-switch';
|
|
51
48
|
const SCRUBBER_SLIDER_ID = 'dt-scrubber';
|
|
52
49
|
const InspectorTab = Schema.Literals(['Model', 'Message', 'Commands', 'Mounts']);
|
|
53
50
|
const INSPECTOR_TABS = InspectorTab.literals;
|
|
54
|
-
const
|
|
51
|
+
const InspectorTabsBlock = Tabs.create();
|
|
55
52
|
/**
|
|
56
53
|
* `Schema.Unknown` whose equivalence is reference equality. Effect 4's default
|
|
57
54
|
* equivalence for `Schema.Unknown` is `Equal.equals`, which walks the value
|
|
@@ -65,7 +62,17 @@ const InspectorTabs = Tabs.create();
|
|
|
65
62
|
*/
|
|
66
63
|
const UnknownByReference = Schema.Unknown.pipe(Schema.overrideToEquivalence(() => __foldkitBrandViewResult(((a, b) => __foldkitBrandViewResult((a === b), "@foldkit/devtools/overlay.js#anonymous~2")), "@foldkit/devtools/overlay.js#anonymous")));
|
|
67
64
|
const Screen = Schema.Literals(['Messages', 'Settings']);
|
|
65
|
+
const Position = Schema.Literals([
|
|
66
|
+
'BottomRight',
|
|
67
|
+
'BottomLeft',
|
|
68
|
+
'TopRight',
|
|
69
|
+
'TopLeft',
|
|
70
|
+
]);
|
|
71
|
+
const Mode = Schema.Literals(['TimeTravel', 'Inspect']);
|
|
68
72
|
const Model = Schema.Struct({
|
|
73
|
+
position: Position,
|
|
74
|
+
mode: Mode,
|
|
75
|
+
maybeBanner: Schema.Option(Schema.String),
|
|
69
76
|
isOpen: Schema.Boolean,
|
|
70
77
|
isMobile: Schema.Boolean,
|
|
71
78
|
screen: Screen,
|
|
@@ -80,30 +87,33 @@ const Model = Schema.Struct({
|
|
|
80
87
|
isFollowingTop: Schema.Boolean,
|
|
81
88
|
maybeInspectedModel: Schema.Option(UnknownByReference),
|
|
82
89
|
maybeInspectedMessage: Schema.Option(UnknownByReference),
|
|
83
|
-
|
|
84
|
-
|
|
90
|
+
blockTags: Schema.Array(Schema.String),
|
|
91
|
+
maybeBlockFilter: Schema.Option(Schema.String),
|
|
85
92
|
isFlattened: Schema.Boolean,
|
|
86
|
-
|
|
93
|
+
blockFilterListbox: BlockFilterListboxBlock.Model,
|
|
87
94
|
expandedPaths: Schema.HashSet(Schema.String),
|
|
88
95
|
changedPaths: Schema.HashSet(Schema.String),
|
|
89
96
|
affectedPaths: Schema.HashSet(Schema.String),
|
|
90
97
|
copyStates: Schema.HashMap(Schema.String, CopyState),
|
|
91
98
|
nextCopyRequestId: Schema.Number,
|
|
92
99
|
maybePendingScrubIndex: Schema.Option(Schema.Number),
|
|
93
|
-
inspectorTabs:
|
|
100
|
+
inspectorTabs: InspectorTabsBlock.Model,
|
|
94
101
|
activeInspectorTab: InspectorTab,
|
|
95
|
-
// NOTE: empirically, inlining `Slider.Model` here throws
|
|
102
|
+
// NOTE: empirically, inlining `Slider.SliderBlock.Model` here throws
|
|
96
103
|
// "Cannot read properties of undefined (reading 'ast')" when running slider
|
|
97
104
|
// tests, because slider imports html → runtime → overlay, and overlay
|
|
98
|
-
// references Slider.Model mid-cycle. Schema.suspend defers the read until after
|
|
99
|
-
// the cycle resolves. Inlining Listbox
|
|
105
|
+
// references Slider.SliderBlock.Model mid-cycle. Schema.suspend defers the read until after
|
|
106
|
+
// the cycle resolves. Inlining the Listbox Model works in practice but goes
|
|
100
107
|
// through the same import chain; the exact cause of the asymmetry isn't
|
|
101
108
|
// pinned down. Suspend is the conservative fix until the runtime ↔ overlay
|
|
102
109
|
// cycle is broken at the source.
|
|
103
|
-
scrubberSlider: Schema.suspend(() => __foldkitBrandViewResult((Slider.Model), "@foldkit/devtools/overlay.js#anonymous~3")),
|
|
110
|
+
scrubberSlider: Schema.suspend(() => __foldkitBrandViewResult((Slider.SliderBlock.Model), "@foldkit/devtools/overlay.js#anonymous~3")),
|
|
104
111
|
scrubberValue: Schema.Number,
|
|
105
112
|
});
|
|
106
113
|
const Flags = Schema.Struct({
|
|
114
|
+
position: Position,
|
|
115
|
+
mode: Mode,
|
|
116
|
+
maybeBanner: Schema.Option(Schema.String),
|
|
107
117
|
isOpen: Schema.Boolean,
|
|
108
118
|
isMobile: Schema.Boolean,
|
|
109
119
|
isFlattened: Schema.Boolean,
|
|
@@ -115,7 +125,6 @@ const Flags = Schema.Struct({
|
|
|
115
125
|
pausedAtIndex: Schema.Number,
|
|
116
126
|
});
|
|
117
127
|
// MESSAGE
|
|
118
|
-
// NOTE: suspend for the same init-order reason as scrubberSlider above.
|
|
119
128
|
const Message = defineMessageUnion({
|
|
120
129
|
ClickedToggle: {},
|
|
121
130
|
ClickedSettingsToggle: {},
|
|
@@ -154,7 +163,6 @@ const Message = defineMessageUnion({
|
|
|
154
163
|
requestId: Schema.Number,
|
|
155
164
|
},
|
|
156
165
|
TickedScrubFrame: {},
|
|
157
|
-
GotInspectorTabsMessage: { message: Tabs.Message },
|
|
158
166
|
ReceivedStoreUpdate: {
|
|
159
167
|
entries: Schema.Array(DisplayEntry),
|
|
160
168
|
initCommands: Schema.Array(DisplayCommand),
|
|
@@ -163,10 +171,6 @@ const Message = defineMessageUnion({
|
|
|
163
171
|
isPaused: Schema.Boolean,
|
|
164
172
|
pausedAtIndex: Schema.Number,
|
|
165
173
|
},
|
|
166
|
-
GotSubmodelFilterMessage: { message: Listbox.Message },
|
|
167
|
-
GotScrubberSliderMessage: {
|
|
168
|
-
message: Schema.suspend(() => __foldkitBrandViewResult((Slider.Message), "@foldkit/devtools/overlay.js#anonymous~4")),
|
|
169
|
-
},
|
|
170
174
|
});
|
|
171
175
|
// HELPERS
|
|
172
176
|
const MILLIS_PER_SECOND = 1000;
|
|
@@ -179,7 +183,7 @@ const ALL_MESSAGES_VALUE = '';
|
|
|
179
183
|
const DEVTOOLS_STORAGE_KEY = 'foldkit-devtools';
|
|
180
184
|
const NO_COMMANDS = [];
|
|
181
185
|
const NO_MOUNTS = [];
|
|
182
|
-
const formatTimeDelta = (deltaMs) => __foldkitBrandViewResult((Match.value(deltaMs).pipe(Match.when(0, () => __foldkitBrandViewResult(('0ms'), "@foldkit/devtools/overlay.js#anonymous~
|
|
186
|
+
const formatTimeDelta = (deltaMs) => __foldkitBrandViewResult((Match.value(deltaMs).pipe(Match.when(0, () => __foldkitBrandViewResult(('0ms'), "@foldkit/devtools/overlay.js#anonymous~4")), Match.when(Number.isLessThan(MILLIS_PER_SECOND), ms => __foldkitBrandViewResult((`+${Math.round(ms)}ms`), "@foldkit/devtools/overlay.js#anonymous~5")), Match.orElse(ms => __foldkitBrandViewResult((`+${(ms / MILLIS_PER_SECOND).toFixed(1)}s`), "@foldkit/devtools/overlay.js#anonymous~6")))), "@foldkit/devtools/overlay.js#formatTimeDelta");
|
|
183
187
|
const MESSAGE_LIST_SELECTOR = '.message-list';
|
|
184
188
|
// NOTE: scrubber slider value space is independent of the store's host
|
|
185
189
|
// indices. Slider value 0 represents init; 1..entries.length represents
|
|
@@ -190,30 +194,30 @@ const MESSAGE_LIST_SELECTOR = '.message-list';
|
|
|
190
194
|
const hostIndexToSliderValue = (hostIndex, startIndex) => (__foldkitBrandViewResult((hostIndex === INIT_INDEX ? 0 : hostIndex - startIndex + 1), "@foldkit/devtools/overlay.js#hostIndexToSliderValue"));
|
|
191
195
|
const sliderValueToHostIndex = (sliderValue, startIndex) => (__foldkitBrandViewResult((sliderValue === 0 ? INIT_INDEX : startIndex + sliderValue - 1), "@foldkit/devtools/overlay.js#sliderValueToHostIndex"));
|
|
192
196
|
const SCROLL_FOLLOW_THRESHOLD_PX = 8;
|
|
193
|
-
const
|
|
194
|
-
const
|
|
195
|
-
const
|
|
197
|
+
const computeBlockTags = (entries) => __foldkitBrandViewResult((pipe(entries, Array.flatMap(({ blockPath }) => __foldkitBrandViewResult((blockPath), "@foldkit/devtools/overlay.js#anonymous~7")), Array.dedupe, Array.sort(Order.String))), "@foldkit/devtools/overlay.js#computeBlockTags");
|
|
198
|
+
const blockSegmentLabel = (tag) => __foldkitBrandViewResult((pipe(tag, String.replace(/^Got/, ''), String.replace(/Message$/, ''))), "@foldkit/devtools/overlay.js#blockSegmentLabel");
|
|
199
|
+
const formatBlockPath = (blockPath) => __foldkitBrandViewResult((pipe(blockPath, Array.map(blockSegmentLabel), Array.join(' › '))), "@foldkit/devtools/overlay.js#formatBlockPath");
|
|
196
200
|
const toDisplayCommand = (command) => (__foldkitBrandViewResult(({
|
|
197
201
|
name: command.name,
|
|
198
202
|
args: Option.fromNullishOr(command.args),
|
|
199
|
-
|
|
203
|
+
maybeBlockPath: command.maybeBlockPath,
|
|
200
204
|
}), "@foldkit/devtools/overlay.js#toDisplayCommand"));
|
|
201
205
|
const toDisplayMount = (mount) => (__foldkitBrandViewResult(({
|
|
202
206
|
name: mount.name,
|
|
203
207
|
args: Option.fromNullishOr(mount.args),
|
|
204
208
|
}), "@foldkit/devtools/overlay.js#toDisplayMount"));
|
|
205
209
|
const toDisplayEntries = ({ entries }) => __foldkitBrandViewResult((Array.map(entries, entry => {
|
|
206
|
-
const {
|
|
210
|
+
const { blockPath, maybeLeafTag } = extractBlockInfo(entry.tag, entry.message);
|
|
207
211
|
return __foldkitBrandViewResult(({
|
|
208
212
|
tag: entry.tag,
|
|
209
|
-
|
|
213
|
+
blockPath,
|
|
210
214
|
maybeLeafTag,
|
|
211
215
|
commands: Array.map(entry.commands, toDisplayCommand),
|
|
212
216
|
mountStarts: Array.map(entry.mountStarts, toDisplayMount),
|
|
213
217
|
mountEnds: Array.map(entry.mountEnds, toDisplayMount),
|
|
214
218
|
timestamp: entry.timestamp,
|
|
215
219
|
isModelChanged: entry.isModelChanged,
|
|
216
|
-
}), "@foldkit/devtools/overlay.js#anonymous~
|
|
220
|
+
}), "@foldkit/devtools/overlay.js#anonymous~8");
|
|
217
221
|
})), "@foldkit/devtools/overlay.js#toDisplayEntries");
|
|
218
222
|
const toDisplayState = (state) => (__foldkitBrandViewResult(({
|
|
219
223
|
entries: toDisplayEntries(state),
|
|
@@ -224,7 +228,7 @@ const toDisplayState = (state) => (__foldkitBrandViewResult(({
|
|
|
224
228
|
pausedAtIndex: state.pausedAtIndex,
|
|
225
229
|
}), "@foldkit/devtools/overlay.js#toDisplayState"));
|
|
226
230
|
const isExpandable = Predicate.isObjectOrArray;
|
|
227
|
-
const objectPreview = (value) => __foldkitBrandViewResult((pipe(value, Record.keys, Array.filter(key => __foldkitBrandViewResult((key !== '_tag'), "@foldkit/devtools/overlay.js#anonymous~
|
|
231
|
+
const objectPreview = (value) => __foldkitBrandViewResult((pipe(value, Record.keys, Array.filter(key => __foldkitBrandViewResult((key !== '_tag'), "@foldkit/devtools/overlay.js#anonymous~9")), Array.match({
|
|
228
232
|
onEmpty: () => __foldkitBrandViewResult(('{}'), "@foldkit/devtools/overlay.js#onEmpty"),
|
|
229
233
|
onNonEmpty: keys => {
|
|
230
234
|
const preview = pipe(keys, Array.take(MAX_PREVIEW_KEYS), Array.join(', '));
|
|
@@ -233,7 +237,7 @@ const objectPreview = (value) => __foldkitBrandViewResult((pipe(value, Record.ke
|
|
|
233
237
|
: `{ ${preview} }`), "@foldkit/devtools/overlay.js#onNonEmpty");
|
|
234
238
|
},
|
|
235
239
|
}))), "@foldkit/devtools/overlay.js#objectPreview");
|
|
236
|
-
const collapsedPreview = (value) => __foldkitBrandViewResult((Match.value(value).pipe(Match.when(globalThis.Array.isArray, array => __foldkitBrandViewResult((`(${array.length})`), "@foldkit/devtools/overlay.js#anonymous~
|
|
240
|
+
const collapsedPreview = (value) => __foldkitBrandViewResult((Match.value(value).pipe(Match.when(globalThis.Array.isArray, array => __foldkitBrandViewResult((`(${array.length})`), "@foldkit/devtools/overlay.js#anonymous~10")), Match.when(Predicate.isObject, objectPreview), Match.orElse(() => __foldkitBrandViewResult((''), "@foldkit/devtools/overlay.js#anonymous~11")))), "@foldkit/devtools/overlay.js#collapsedPreview");
|
|
237
241
|
const serializePayload = (value) => __foldkitBrandViewResult((Effect.try({
|
|
238
242
|
try: () => {
|
|
239
243
|
const serialized = JSON.stringify(toInspectableValue(value), null, JSON_INDENT);
|
|
@@ -248,66 +252,121 @@ const taggedPayload = (name, args) => __foldkitBrandViewResult((Option.match(arg
|
|
|
248
252
|
onNone: () => (__foldkitBrandViewResult(({ _tag: name }), "@foldkit/devtools/overlay.js#onNone")),
|
|
249
253
|
onSome: argsValue => (__foldkitBrandViewResult(({ ...argsValue, _tag: name }), "@foldkit/devtools/overlay.js#onSome")),
|
|
250
254
|
})), "@foldkit/devtools/overlay.js#taggedPayload");
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
const foldInspectorTabs = Update.foldChild({
|
|
257
|
-
update: InspectorTabs.update,
|
|
258
|
-
read: (model) => __foldkitBrandViewResult((Option.some(model.inspectorTabs)), "@foldkit/devtools/overlay.js#read"),
|
|
259
|
-
write: (model, nextInspectorTabs) => __foldkitBrandViewResult((modifyFields(model, { inspectorTabs: () => __foldkitBrandViewResult((nextInspectorTabs), "@foldkit/devtools/overlay.js#inspectorTabs") })), "@foldkit/devtools/overlay.js#write"),
|
|
260
|
-
toParentMessage: message => __foldkitBrandViewResult((Message.GotInspectorTabsMessage({ message })), "@foldkit/devtools/overlay.js#toParentMessage"),
|
|
261
|
-
foldOutMessage: foldInspectorTabsOutMessage,
|
|
255
|
+
// UPDATE
|
|
256
|
+
const ApplicationDefinition = Block.makeDefinition('Application', {
|
|
257
|
+
Model,
|
|
258
|
+
Message,
|
|
259
|
+
ChildInitContext: Flags,
|
|
262
260
|
});
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
261
|
+
const InspectorTabsBinding = ApplicationDefinition.bindChild(InspectorTabsBlock, {
|
|
262
|
+
field: 'inspectorTabs',
|
|
263
|
+
init: { contextToArgs: () => __foldkitBrandViewResult(([{ id: INSPECTOR_TABS_ID }]), "@foldkit/devtools/overlay.js#contextToArgs") },
|
|
264
|
+
}).withOutMessagePolicy({
|
|
265
|
+
fold: ApplicationDefinition.makeOutMessageFold(InspectorTabsBlock, {
|
|
266
|
+
Selected: ({ value }) => __foldkitBrandViewResult((ApplicationDefinition.stepFields(() => (__foldkitBrandViewResult(({
|
|
267
|
+
activeInspectorTab: () => __foldkitBrandViewResult((value), "@foldkit/devtools/overlay.js#activeInspectorTab"),
|
|
268
|
+
}), "@foldkit/devtools/overlay.js#anonymous~12")))), "@foldkit/devtools/overlay.js#Selected"),
|
|
269
|
+
}),
|
|
269
270
|
});
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
271
|
+
const BlockFilterListboxBinding = ApplicationDefinition.bindChild(BlockFilterListboxBlock, {
|
|
272
|
+
field: 'blockFilterListbox',
|
|
273
|
+
init: { contextToArgs: () => __foldkitBrandViewResult(([{ id: BLOCK_FILTER_ID }]), "@foldkit/devtools/overlay.js#contextToArgs~2") },
|
|
274
|
+
}).withOutMessagePolicy({
|
|
275
|
+
fold: ApplicationDefinition.makeOutMessageFold(BlockFilterListboxBlock, {
|
|
276
|
+
Selected: ({ value }) => __foldkitBrandViewResult((ApplicationDefinition.stepFields(() => (__foldkitBrandViewResult(({
|
|
277
|
+
maybeBlockFilter: () => __foldkitBrandViewResult((Option.liftPredicate(value, String.isNonEmpty)), "@foldkit/devtools/overlay.js#maybeBlockFilter"),
|
|
278
|
+
}), "@foldkit/devtools/overlay.js#anonymous~13")))), "@foldkit/devtools/overlay.js#Selected~2"),
|
|
279
|
+
}),
|
|
278
280
|
});
|
|
279
|
-
|
|
280
|
-
//
|
|
281
|
-
//
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
281
|
+
const makeApplicationComposition = (scrubberSliderBlock) => {
|
|
282
|
+
// NOTE: Pointer Messages update the thumb immediately, but jumping to and
|
|
283
|
+
// inspecting the corresponding state is expensive. Keep only the latest host
|
|
284
|
+
// index until TickedScrubFrame flushes one navigation on the next frame.
|
|
285
|
+
const ScrubberBinding = ApplicationDefinition.bindChild(scrubberSliderBlock, {
|
|
286
|
+
field: 'scrubberSlider',
|
|
287
|
+
init: {
|
|
288
|
+
contextToArgs: flags => __foldkitBrandViewResult(([
|
|
289
|
+
{
|
|
290
|
+
id: SCRUBBER_SLIDER_ID,
|
|
291
|
+
min: 0,
|
|
292
|
+
max: flags.entries.length,
|
|
293
|
+
step: 1,
|
|
294
|
+
},
|
|
295
|
+
]), "@foldkit/devtools/overlay.js#contextToArgs~3"),
|
|
296
|
+
},
|
|
297
|
+
}).withOutMessagePolicy({
|
|
298
|
+
fold: ApplicationDefinition.makeOutMessageFold(scrubberSliderBlock, {
|
|
299
|
+
ChangedValue: ({ value }) => __foldkitBrandViewResult((ApplicationDefinition.stepFields(model => (__foldkitBrandViewResult(({
|
|
300
|
+
scrubberValue: () => __foldkitBrandViewResult((value), "@foldkit/devtools/overlay.js#scrubberValue"),
|
|
301
|
+
maybePendingScrubIndex: () => __foldkitBrandViewResult((Option.some(sliderValueToHostIndex(value, model.startIndex))), "@foldkit/devtools/overlay.js#maybePendingScrubIndex"),
|
|
302
|
+
}), "@foldkit/devtools/overlay.js#anonymous~14")))), "@foldkit/devtools/overlay.js#ChangedValue"),
|
|
287
303
|
}),
|
|
288
|
-
})
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
});
|
|
304
|
+
});
|
|
305
|
+
const bindings = {
|
|
306
|
+
InspectorTabsBinding,
|
|
307
|
+
BlockFilterListboxBinding,
|
|
308
|
+
ScrubberBinding,
|
|
309
|
+
};
|
|
310
|
+
const ApplicationComposition = ApplicationDefinition.makeComposition({
|
|
311
|
+
bindings: Tuple.make(InspectorTabsBinding, BlockFilterListboxBinding, ScrubberBinding),
|
|
312
|
+
});
|
|
313
|
+
return __foldkitBrandViewResult((Tuple.make(bindings, ApplicationComposition)), "@foldkit/devtools/overlay.js#makeApplicationComposition");
|
|
314
|
+
};
|
|
315
|
+
const getDevToolsShadowRoot = () => {
|
|
316
|
+
const shadow = document.getElementById(DEVTOOLS_HOST_ID)?.shadowRoot;
|
|
317
|
+
if (shadow === null || shadow === undefined) {
|
|
318
|
+
throw new Error('Expected the DevTools shadow root to exist');
|
|
319
|
+
}
|
|
320
|
+
return __foldkitBrandViewResult((shadow), "@foldkit/devtools/overlay.js#getDevToolsShadowRoot");
|
|
321
|
+
};
|
|
322
|
+
const scrubberSliderBlock = Slider.forRoot(getDevToolsShadowRoot);
|
|
323
|
+
const [bindings, ApplicationComposition] = makeApplicationComposition(scrubberSliderBlock);
|
|
297
324
|
class StoreService extends Context.Service()('foldkit/DevToolsStore') {
|
|
298
325
|
}
|
|
299
326
|
class ShadowRootService extends Context.Service()('foldkit/DevToolsShadowRoot') {
|
|
300
327
|
}
|
|
301
|
-
|
|
328
|
+
const subscriptions = ApplicationDefinition.subscriptions(entry => (__foldkitBrandViewResult(({
|
|
329
|
+
scrubFrameTicks: entry('ScrubFrameTicks', { isActive: Schema.Boolean }, {
|
|
330
|
+
messages: [Message.TickedScrubFrame],
|
|
331
|
+
modelToDependencies: model => (__foldkitBrandViewResult(({
|
|
332
|
+
isActive: Option.isSome(model.maybePendingScrubIndex),
|
|
333
|
+
}), "@foldkit/devtools/overlay.js#modelToDependencies")),
|
|
334
|
+
handler: function* () {
|
|
335
|
+
return __foldkitBrandViewResult((({ isActive }) => __foldkitBrandViewResult((isActive
|
|
336
|
+
? Dom.animationFrameTicks.pipe(Stream.map(() => __foldkitBrandViewResult((Message.TickedScrubFrame()), "@foldkit/devtools/overlay.js#anonymous~17")))
|
|
337
|
+
: Stream.empty), "@foldkit/devtools/overlay.js#anonymous~16")), "@foldkit/devtools/overlay.js#handler");
|
|
338
|
+
},
|
|
339
|
+
}),
|
|
340
|
+
storeUpdates: entry('StoreUpdates', {
|
|
341
|
+
messages: [Message.ReceivedStoreUpdate],
|
|
342
|
+
handler: function* () {
|
|
343
|
+
const store = yield* StoreService;
|
|
344
|
+
return __foldkitBrandViewResult((() => __foldkitBrandViewResult((SubscriptionRef.changes(store.stateRef).pipe(Stream.map(state => __foldkitBrandViewResult((Message.ReceivedStoreUpdate(toDisplayState(state))), "@foldkit/devtools/overlay.js#anonymous~19")))), "@foldkit/devtools/overlay.js#anonymous~18")), "@foldkit/devtools/overlay.js#handler~2");
|
|
345
|
+
},
|
|
346
|
+
}),
|
|
347
|
+
mobileBreakpointChanges: entry('MobileBreakpointChanges', {
|
|
348
|
+
messages: [Message.ObservedMobileBreakpoint],
|
|
349
|
+
handler: function* () {
|
|
350
|
+
return __foldkitBrandViewResult((() => __foldkitBrandViewResult((Dom.streamFromMediaQuery({
|
|
351
|
+
query: MOBILE_BREAKPOINT_QUERY,
|
|
352
|
+
mapMatches: isMobile => __foldkitBrandViewResult((Message.ObservedMobileBreakpoint({ isMobile })), "@foldkit/devtools/overlay.js#mapMatches"),
|
|
353
|
+
})), "@foldkit/devtools/overlay.js#anonymous~20")), "@foldkit/devtools/overlay.js#handler~3");
|
|
354
|
+
},
|
|
355
|
+
}),
|
|
356
|
+
}), "@foldkit/devtools/overlay.js#anonymous~15")));
|
|
357
|
+
export const LockScroll = ApplicationDefinition.command('LockScroll', {
|
|
302
358
|
messages: [Message.CompletedLockScroll],
|
|
303
|
-
|
|
359
|
+
handler: function* () {
|
|
360
|
+
return __foldkitBrandViewResult((() => __foldkitBrandViewResult((lockScroll.pipe(Effect.as(Message.CompletedLockScroll()))), "@foldkit/devtools/overlay.js#anonymous~21")), "@foldkit/devtools/overlay.js#handler~4");
|
|
361
|
+
},
|
|
304
362
|
});
|
|
305
|
-
export const UnlockScroll =
|
|
363
|
+
export const UnlockScroll = ApplicationDefinition.command('UnlockScroll', {
|
|
306
364
|
messages: [Message.CompletedUnlockScroll],
|
|
307
|
-
|
|
365
|
+
handler: function* () {
|
|
366
|
+
return __foldkitBrandViewResult((() => __foldkitBrandViewResult((unlockScroll.pipe(Effect.as(Message.CompletedUnlockScroll()))), "@foldkit/devtools/overlay.js#anonymous~22")), "@foldkit/devtools/overlay.js#handler~5");
|
|
367
|
+
},
|
|
308
368
|
});
|
|
309
|
-
const
|
|
310
|
-
const maybeLockScroll = (isOpen, isMobile) => __foldkitBrandViewResult((OptionExt.when(isOpen && isMobile, LockScroll())), "@foldkit/devtools/overlay.js#maybeLockScroll");
|
|
369
|
+
const scrollLockCommands = (isEnabled, shouldLock) => __foldkitBrandViewResult((Array.filter([shouldLock ? LockScroll() : UnlockScroll()], () => __foldkitBrandViewResult((isEnabled), "@foldkit/devtools/overlay.js#anonymous~23"))), "@foldkit/devtools/overlay.js#scrollLockCommands");
|
|
311
370
|
const DevToolsPersistedState = Schema.Struct({
|
|
312
371
|
isOpen: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
|
|
313
372
|
isFlattened: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
|
|
@@ -320,31 +379,31 @@ const DEFAULT_PERSISTED_STATE = {
|
|
|
320
379
|
const readPersistedState = Effect.gen(function* () {
|
|
321
380
|
const store = yield* KeyValueStore.KeyValueStore;
|
|
322
381
|
const json = yield* Effect.fromOption(Option.fromNullishOr(yield* store.get(DEVTOOLS_STORAGE_KEY)));
|
|
323
|
-
return __foldkitBrandViewResult((yield* Schema.decodeEffect(DevToolsPersistedStateJson)(json)), "@foldkit/devtools/overlay.js#anonymous~
|
|
324
|
-
}).pipe(Effect.catch(() => __foldkitBrandViewResult((Effect.succeed(DEFAULT_PERSISTED_STATE)), "@foldkit/devtools/overlay.js#anonymous~
|
|
325
|
-
export const PersistDevToolsState =
|
|
382
|
+
return __foldkitBrandViewResult((yield* Schema.decodeEffect(DevToolsPersistedStateJson)(json)), "@foldkit/devtools/overlay.js#anonymous~24");
|
|
383
|
+
}).pipe(Effect.catch(() => __foldkitBrandViewResult((Effect.succeed(DEFAULT_PERSISTED_STATE)), "@foldkit/devtools/overlay.js#anonymous~25")));
|
|
384
|
+
export const PersistDevToolsState = ApplicationDefinition.command('PersistDevToolsState', {
|
|
326
385
|
args: { isOpen: Schema.Boolean, isFlattened: Schema.Boolean },
|
|
327
386
|
messages: [Message.CompletedPersistDevToolsState],
|
|
328
|
-
|
|
387
|
+
handler: function* () {
|
|
329
388
|
const store = yield* KeyValueStore.KeyValueStore;
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
389
|
+
return __foldkitBrandViewResult((({ isOpen, isFlattened }) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
390
|
+
const json = yield* Schema.encodeEffect(DevToolsPersistedStateJson)({
|
|
391
|
+
isOpen,
|
|
392
|
+
isFlattened,
|
|
393
|
+
});
|
|
394
|
+
yield* store.set(DEVTOOLS_STORAGE_KEY, json);
|
|
395
|
+
return __foldkitBrandViewResult((Message.CompletedPersistDevToolsState()), "@foldkit/devtools/overlay.js#anonymous~27");
|
|
396
|
+
}).pipe(Effect.catch(() => __foldkitBrandViewResult((Effect.succeed(Message.CompletedPersistDevToolsState())), "@foldkit/devtools/overlay.js#anonymous~28")))), "@foldkit/devtools/overlay.js#anonymous~26")), "@foldkit/devtools/overlay.js#handler~6");
|
|
397
|
+
},
|
|
337
398
|
});
|
|
338
|
-
const buildInspectionFromModel = (index, model) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
339
|
-
const store = yield* StoreService;
|
|
399
|
+
const buildInspectionFromModel = (store, index, model) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
340
400
|
const maybeMessage = yield* store.getMessageAtIndex(index);
|
|
341
401
|
const diff = yield* store.getDiffAtIndex(index);
|
|
342
|
-
return __foldkitBrandViewResult((Message.ReceivedInspectedState({ model, maybeMessage, ...diff })), "@foldkit/devtools/overlay.js#anonymous~
|
|
402
|
+
return __foldkitBrandViewResult((Message.ReceivedInspectedState({ model, maybeMessage, ...diff })), "@foldkit/devtools/overlay.js#anonymous~29");
|
|
343
403
|
})), "@foldkit/devtools/overlay.js#buildInspectionFromModel");
|
|
344
|
-
const buildInspectionEffect = (index) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
345
|
-
const store = yield* StoreService;
|
|
404
|
+
const buildInspectionEffect = (store, index) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
346
405
|
const model = yield* store.getModelAtIndex(index);
|
|
347
|
-
return __foldkitBrandViewResult((yield* buildInspectionFromModel(index, model)), "@foldkit/devtools/overlay.js#anonymous~
|
|
406
|
+
return __foldkitBrandViewResult((yield* buildInspectionFromModel(store, index, model)), "@foldkit/devtools/overlay.js#anonymous~30");
|
|
348
407
|
})), "@foldkit/devtools/overlay.js#buildInspectionEffect");
|
|
349
408
|
// NOTE: jump and inspect both need the model at `index`. Resolving it twice
|
|
350
409
|
// (once to render the host, once to feed the inspector) replays the segment
|
|
@@ -352,45 +411,50 @@ const buildInspectionEffect = (index) => __foldkitBrandViewResult((Effect.gen(fu
|
|
|
352
411
|
// returns the model it resolved so the inspector reuses that single
|
|
353
412
|
// resolution. Inspect-only navigation (no host pause) still uses
|
|
354
413
|
// `InspectState`, which resolves once on its own.
|
|
355
|
-
export const JumpToAndInspect =
|
|
414
|
+
export const JumpToAndInspect = ApplicationDefinition.command('JumpToAndInspect', {
|
|
356
415
|
args: { index: Schema.Number },
|
|
357
416
|
messages: [Message.ReceivedInspectedState],
|
|
358
|
-
|
|
417
|
+
handler: function* () {
|
|
359
418
|
const store = yield* StoreService;
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
419
|
+
return __foldkitBrandViewResult((({ index }) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
420
|
+
const model = yield* store.jumpTo(index);
|
|
421
|
+
return __foldkitBrandViewResult((yield* buildInspectionFromModel(store, index, model)), "@foldkit/devtools/overlay.js#anonymous~32");
|
|
422
|
+
})), "@foldkit/devtools/overlay.js#anonymous~31")), "@foldkit/devtools/overlay.js#handler~7");
|
|
423
|
+
},
|
|
363
424
|
});
|
|
364
|
-
export const InspectState =
|
|
425
|
+
export const InspectState = ApplicationDefinition.command('InspectState', {
|
|
365
426
|
args: { index: Schema.Number },
|
|
366
427
|
messages: [Message.ReceivedInspectedState],
|
|
367
|
-
|
|
428
|
+
handler: function* () {
|
|
429
|
+
const store = yield* StoreService;
|
|
430
|
+
return __foldkitBrandViewResult((({ index }) => __foldkitBrandViewResult((buildInspectionEffect(store, index)), "@foldkit/devtools/overlay.js#anonymous~33")), "@foldkit/devtools/overlay.js#handler~8");
|
|
431
|
+
},
|
|
368
432
|
});
|
|
369
|
-
export const InspectLatest =
|
|
433
|
+
export const InspectLatest = ApplicationDefinition.command('InspectLatest', {
|
|
370
434
|
messages: [Message.ReceivedInspectedState],
|
|
371
|
-
|
|
435
|
+
handler: function* () {
|
|
372
436
|
const store = yield* StoreService;
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
437
|
+
return __foldkitBrandViewResult((() => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
438
|
+
const state = yield* SubscriptionRef.get(store.stateRef);
|
|
439
|
+
return __foldkitBrandViewResult((yield* buildInspectionEffect(store, latestEntryIndex(state))), "@foldkit/devtools/overlay.js#anonymous~35");
|
|
440
|
+
})), "@foldkit/devtools/overlay.js#anonymous~34")), "@foldkit/devtools/overlay.js#handler~9");
|
|
441
|
+
},
|
|
376
442
|
});
|
|
377
|
-
export const Resume =
|
|
443
|
+
export const Resume = ApplicationDefinition.command('Resume', {
|
|
378
444
|
messages: [Message.CompletedResume],
|
|
379
|
-
|
|
445
|
+
handler: function* () {
|
|
380
446
|
const store = yield* StoreService;
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
}),
|
|
447
|
+
return __foldkitBrandViewResult((() => __foldkitBrandViewResult((store.resume.pipe(Effect.as(Message.CompletedResume()))), "@foldkit/devtools/overlay.js#anonymous~36")), "@foldkit/devtools/overlay.js#handler~10");
|
|
448
|
+
},
|
|
384
449
|
});
|
|
385
|
-
export const Clear =
|
|
450
|
+
export const Clear = ApplicationDefinition.command('Clear', {
|
|
386
451
|
messages: [Message.CompletedClear],
|
|
387
|
-
|
|
452
|
+
handler: function* () {
|
|
388
453
|
const store = yield* StoreService;
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}),
|
|
454
|
+
return __foldkitBrandViewResult((() => __foldkitBrandViewResult((store.clear.pipe(Effect.as(Message.CompletedClear()))), "@foldkit/devtools/overlay.js#anonymous~37")), "@foldkit/devtools/overlay.js#handler~11");
|
|
455
|
+
},
|
|
392
456
|
});
|
|
393
|
-
export const CopyPayloadToClipboard =
|
|
457
|
+
export const CopyPayloadToClipboard = ApplicationDefinition.command('CopyPayloadToClipboard', {
|
|
394
458
|
args: {
|
|
395
459
|
targetId: Schema.String,
|
|
396
460
|
requestId: Schema.Number,
|
|
@@ -400,262 +464,270 @@ export const CopyPayloadToClipboard = Command.define('CopyPayloadToClipboard', {
|
|
|
400
464
|
Message.SucceededCopyPayloadToClipboard,
|
|
401
465
|
Message.FailedCopyPayloadToClipboard,
|
|
402
466
|
],
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
467
|
+
handler: function* () {
|
|
468
|
+
return __foldkitBrandViewResult((({ targetId, requestId, payload }) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
469
|
+
const text = yield* serializePayload(payload);
|
|
470
|
+
yield* Effect.tryPromise({
|
|
471
|
+
try: () => __foldkitBrandViewResult((navigator.clipboard.writeText(text)), "@foldkit/devtools/overlay.js#try~2"),
|
|
472
|
+
catch: () => __foldkitBrandViewResult((new Error('Failed to copy payload to clipboard')), "@foldkit/devtools/overlay.js#catch~2"),
|
|
473
|
+
});
|
|
474
|
+
return __foldkitBrandViewResult((Message.SucceededCopyPayloadToClipboard({
|
|
475
|
+
targetId,
|
|
476
|
+
requestId,
|
|
477
|
+
})), "@foldkit/devtools/overlay.js#anonymous~39");
|
|
478
|
+
}).pipe(Effect.catch(() => __foldkitBrandViewResult((Effect.succeed(Message.FailedCopyPayloadToClipboard({ targetId, requestId }))), "@foldkit/devtools/overlay.js#anonymous~40")))), "@foldkit/devtools/overlay.js#anonymous~38")), "@foldkit/devtools/overlay.js#handler~12");
|
|
479
|
+
},
|
|
411
480
|
});
|
|
481
|
+
/** Provides the DevTools clipboard Command handler. */
|
|
482
|
+
export const CopyPayloadToClipboardLayer = CopyPayloadToClipboard.layer;
|
|
412
483
|
const COPY_INDICATOR_DURATION = '1 second';
|
|
413
|
-
export const WaitBeforeHidingCopyIndicator =
|
|
484
|
+
export const WaitBeforeHidingCopyIndicator = ApplicationDefinition.command('WaitBeforeHidingCopyIndicator', {
|
|
414
485
|
args: { targetId: Schema.String, requestId: Schema.Number },
|
|
415
486
|
messages: [Message.CompletedWaitBeforeHidingCopyIndicator],
|
|
416
|
-
|
|
417
|
-
targetId,
|
|
418
|
-
|
|
419
|
-
|
|
487
|
+
handler: function* () {
|
|
488
|
+
return __foldkitBrandViewResult((({ targetId, requestId }) => __foldkitBrandViewResult((Effect.sleep(COPY_INDICATOR_DURATION).pipe(Effect.as(Message.CompletedWaitBeforeHidingCopyIndicator({
|
|
489
|
+
targetId,
|
|
490
|
+
requestId,
|
|
491
|
+
})))), "@foldkit/devtools/overlay.js#anonymous~41")), "@foldkit/devtools/overlay.js#handler~13");
|
|
492
|
+
},
|
|
420
493
|
});
|
|
421
|
-
export const ScrollToTop =
|
|
494
|
+
export const ScrollToTop = ApplicationDefinition.command('ScrollToTop', {
|
|
422
495
|
messages: [Message.CompletedScrollToTop],
|
|
423
|
-
|
|
496
|
+
handler: function* () {
|
|
424
497
|
const shadow = yield* ShadowRootService;
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
messageList
|
|
428
|
-
|
|
429
|
-
return __foldkitBrandViewResult((Message.CompletedScrollToTop()), "@foldkit/devtools/overlay.js#anonymous~28");
|
|
430
|
-
}),
|
|
431
|
-
});
|
|
432
|
-
const makeUpdate = (store, shadow, mode) => {
|
|
433
|
-
const provideContext = (effect) => __foldkitBrandViewResult((effect.pipe(Effect.provideService(StoreService, store), Effect.provideService(ShadowRootService, shadow))), "@foldkit/devtools/overlay.js#provideContext");
|
|
434
|
-
const inspectLatest = Command.mapEffect(InspectLatest(), provideContext);
|
|
435
|
-
const resume = Command.mapEffect(Resume(), provideContext);
|
|
436
|
-
const clear = Command.mapEffect(Clear(), provideContext);
|
|
437
|
-
const scrollToTop = Command.mapEffect(ScrollToTop(), provideContext);
|
|
438
|
-
const jumpToAndInspect = (index) => __foldkitBrandViewResult((Command.mapEffect(JumpToAndInspect({ index }), provideContext)), "@foldkit/devtools/overlay.js#jumpToAndInspect");
|
|
439
|
-
const inspectState = (index) => __foldkitBrandViewResult((Command.mapEffect(InspectState({ index }), provideContext)), "@foldkit/devtools/overlay.js#inspectState");
|
|
440
|
-
return __foldkitBrandViewResult(((model, message) => __foldkitBrandViewResult((Message.match(message, {
|
|
441
|
-
ClickedToggle: () => {
|
|
442
|
-
const nextIsOpen = !model.isOpen;
|
|
443
|
-
return __foldkitBrandViewResult(({
|
|
444
|
-
model: modifyFields(model, { isOpen: () => __foldkitBrandViewResult((nextIsOpen), "@foldkit/devtools/overlay.js#isOpen") }),
|
|
445
|
-
commands: [
|
|
446
|
-
...Option.toArray(maybeToggleScrollLock(model.isMobile, nextIsOpen)),
|
|
447
|
-
PersistDevToolsState({
|
|
448
|
-
isOpen: nextIsOpen,
|
|
449
|
-
isFlattened: model.isFlattened,
|
|
450
|
-
}),
|
|
451
|
-
],
|
|
452
|
-
}), "@foldkit/devtools/overlay.js#ClickedToggle");
|
|
453
|
-
},
|
|
454
|
-
ClickedSettingsToggle: () => (__foldkitBrandViewResult(({
|
|
455
|
-
model: modifyFields(model, {
|
|
456
|
-
screen: currentScreen => __foldkitBrandViewResult((Match.value(currentScreen).pipe(Match.withReturnType(), Match.when('Messages', () => __foldkitBrandViewResult(('Settings'), "@foldkit/devtools/overlay.js#anonymous~30")), Match.when('Settings', () => __foldkitBrandViewResult(('Messages'), "@foldkit/devtools/overlay.js#anonymous~31")), Match.exhaustive)), "@foldkit/devtools/overlay.js#screen"),
|
|
457
|
-
}),
|
|
458
|
-
}), "@foldkit/devtools/overlay.js#ClickedSettingsToggle")),
|
|
459
|
-
ToggledFlatten: ({ isFlattened }) => (__foldkitBrandViewResult(({
|
|
460
|
-
model: modifyFields(model, { isFlattened: () => __foldkitBrandViewResult((isFlattened), "@foldkit/devtools/overlay.js#isFlattened") }),
|
|
461
|
-
commands: [PersistDevToolsState({ isOpen: model.isOpen, isFlattened })],
|
|
462
|
-
}), "@foldkit/devtools/overlay.js#ToggledFlatten")),
|
|
463
|
-
ObservedMobileBreakpoint: ({ isMobile }) => {
|
|
464
|
-
if (isMobile === model.isMobile) {
|
|
465
|
-
return __foldkitBrandViewResult(({ model }), "@foldkit/devtools/overlay.js#ObservedMobileBreakpoint");
|
|
498
|
+
return __foldkitBrandViewResult((() => __foldkitBrandViewResult((Effect.sync(() => {
|
|
499
|
+
const messageList = shadow.querySelector(MESSAGE_LIST_SELECTOR);
|
|
500
|
+
if (messageList instanceof HTMLElement) {
|
|
501
|
+
messageList.scrollTop = 0;
|
|
466
502
|
}
|
|
467
|
-
return __foldkitBrandViewResult((
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
503
|
+
return __foldkitBrandViewResult((Message.CompletedScrollToTop()), "@foldkit/devtools/overlay.js#anonymous~43");
|
|
504
|
+
})), "@foldkit/devtools/overlay.js#anonymous~42")), "@foldkit/devtools/overlay.js#handler~14");
|
|
505
|
+
},
|
|
506
|
+
});
|
|
507
|
+
const EffectsLayer = Layer.mergeAll(LockScroll.layer, UnlockScroll.layer, PersistDevToolsState.layer, JumpToAndInspect.layer, InspectState.layer, InspectLatest.layer, Resume.layer, Clear.layer, CopyPayloadToClipboardLayer, WaitBeforeHidingCopyIndicator.layer, ScrollToTop.layer, subscriptions.scrubFrameTicks.layer, subscriptions.storeUpdates.layer, subscriptions.mobileBreakpointChanges.layer);
|
|
508
|
+
const init = ApplicationComposition.makeInit((flags) => {
|
|
509
|
+
const { isFlattened, ...displayFlags } = flags;
|
|
510
|
+
const sliderMax = flags.entries.length;
|
|
511
|
+
const initialSliderValue = flags.isPaused
|
|
512
|
+
? hostIndexToSliderValue(flags.pausedAtIndex, flags.startIndex)
|
|
513
|
+
: sliderMax;
|
|
514
|
+
return __foldkitBrandViewResult(({
|
|
515
|
+
childInitContext: flags,
|
|
516
|
+
model: {
|
|
517
|
+
screen: 'Messages',
|
|
518
|
+
...displayFlags,
|
|
519
|
+
isFlattened,
|
|
520
|
+
selectedIndex: INIT_INDEX,
|
|
521
|
+
isFollowingLatest: true,
|
|
522
|
+
isFollowingTop: true,
|
|
523
|
+
blockTags: computeBlockTags(flags.entries),
|
|
524
|
+
maybeBlockFilter: Option.none(),
|
|
525
|
+
maybeInspectedModel: Option.none(),
|
|
526
|
+
maybeInspectedMessage: Option.none(),
|
|
527
|
+
expandedPaths: HashSet.empty(),
|
|
528
|
+
changedPaths: HashSet.empty(),
|
|
529
|
+
affectedPaths: HashSet.empty(),
|
|
530
|
+
copyStates: HashMap.empty(),
|
|
531
|
+
nextCopyRequestId: 0,
|
|
532
|
+
maybePendingScrubIndex: Option.none(),
|
|
533
|
+
activeInspectorTab: 'Model',
|
|
534
|
+
scrubberValue: Slider.snapAndClamp(initialSliderValue, 0, sliderMax, 1),
|
|
471
535
|
},
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
}),
|
|
480
|
-
commands: [
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
expandedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#expandedPaths"),
|
|
486
|
-
changedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#changedPaths"),
|
|
487
|
-
affectedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#affectedPaths"),
|
|
488
|
-
}),
|
|
489
|
-
commands: [resume, inspectLatest, scrollToTop],
|
|
490
|
-
}), "@foldkit/devtools/overlay.js#ClickedResume")),
|
|
491
|
-
ClickedClear: () => (__foldkitBrandViewResult(({
|
|
492
|
-
model: modifyFields(model, {
|
|
493
|
-
selectedIndex: () => __foldkitBrandViewResult((INIT_INDEX), "@foldkit/devtools/overlay.js#selectedIndex~2"),
|
|
494
|
-
isFollowingLatest: () => __foldkitBrandViewResult((true), "@foldkit/devtools/overlay.js#isFollowingLatest~2"),
|
|
495
|
-
isFollowingTop: () => __foldkitBrandViewResult((true), "@foldkit/devtools/overlay.js#isFollowingTop~2"),
|
|
496
|
-
maybeSubmodelFilter: () => __foldkitBrandViewResult((Option.none()), "@foldkit/devtools/overlay.js#maybeSubmodelFilter~2"),
|
|
497
|
-
expandedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#expandedPaths~2"),
|
|
498
|
-
changedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#changedPaths~2"),
|
|
499
|
-
affectedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#affectedPaths~2"),
|
|
500
|
-
copyStates: () => __foldkitBrandViewResult((HashMap.empty()), "@foldkit/devtools/overlay.js#copyStates"),
|
|
501
|
-
}),
|
|
502
|
-
commands: [clear, inspectLatest, scrollToTop],
|
|
503
|
-
}), "@foldkit/devtools/overlay.js#ClickedClear")),
|
|
504
|
-
ClickedFollowLatest: () => {
|
|
505
|
-
const latestIndex = Array.match(model.entries, {
|
|
506
|
-
onEmpty: () => __foldkitBrandViewResult((INIT_INDEX), "@foldkit/devtools/overlay.js#onEmpty~2"),
|
|
507
|
-
onNonEmpty: () => __foldkitBrandViewResult((model.startIndex + model.entries.length - 1), "@foldkit/devtools/overlay.js#onNonEmpty~2"),
|
|
508
|
-
});
|
|
509
|
-
return __foldkitBrandViewResult(({
|
|
510
|
-
model: modifyFields(model, {
|
|
511
|
-
selectedIndex: () => __foldkitBrandViewResult((latestIndex), "@foldkit/devtools/overlay.js#selectedIndex~3"),
|
|
512
|
-
isFollowingLatest: () => __foldkitBrandViewResult((true), "@foldkit/devtools/overlay.js#isFollowingLatest~3"),
|
|
513
|
-
isFollowingTop: () => __foldkitBrandViewResult((true), "@foldkit/devtools/overlay.js#isFollowingTop~3"),
|
|
514
|
-
expandedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#expandedPaths~3"),
|
|
515
|
-
changedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#changedPaths~3"),
|
|
516
|
-
affectedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#affectedPaths~3"),
|
|
536
|
+
commands: Array.filter([LockScroll()], () => __foldkitBrandViewResult((flags.isOpen && flags.isMobile), "@foldkit/devtools/overlay.js#anonymous~45")),
|
|
537
|
+
}), "@foldkit/devtools/overlay.js#anonymous~44");
|
|
538
|
+
});
|
|
539
|
+
const update = ApplicationComposition.makeUpdate((model, message) => __foldkitBrandViewResult((Message.match(message, {
|
|
540
|
+
ClickedToggle: () => {
|
|
541
|
+
const nextIsOpen = !model.isOpen;
|
|
542
|
+
return __foldkitBrandViewResult(({
|
|
543
|
+
model: modifyFields(model, { isOpen: () => __foldkitBrandViewResult((nextIsOpen), "@foldkit/devtools/overlay.js#isOpen") }),
|
|
544
|
+
commands: [
|
|
545
|
+
...scrollLockCommands(model.isMobile, nextIsOpen),
|
|
546
|
+
PersistDevToolsState({
|
|
547
|
+
isOpen: nextIsOpen,
|
|
548
|
+
isFlattened: model.isFlattened,
|
|
517
549
|
}),
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
550
|
+
],
|
|
551
|
+
}), "@foldkit/devtools/overlay.js#ClickedToggle");
|
|
552
|
+
},
|
|
553
|
+
ClickedSettingsToggle: () => (__foldkitBrandViewResult(({
|
|
554
|
+
model: modifyFields(model, {
|
|
555
|
+
screen: currentScreen => __foldkitBrandViewResult((Match.value(currentScreen).pipe(Match.withReturnType(), Match.when('Messages', () => __foldkitBrandViewResult(('Settings'), "@foldkit/devtools/overlay.js#anonymous~47")), Match.when('Settings', () => __foldkitBrandViewResult(('Messages'), "@foldkit/devtools/overlay.js#anonymous~48")), Match.exhaustive)), "@foldkit/devtools/overlay.js#screen"),
|
|
556
|
+
}),
|
|
557
|
+
}), "@foldkit/devtools/overlay.js#ClickedSettingsToggle")),
|
|
558
|
+
ToggledFlatten: ({ isFlattened }) => (__foldkitBrandViewResult(({
|
|
559
|
+
model: modifyFields(model, { isFlattened: () => __foldkitBrandViewResult((isFlattened), "@foldkit/devtools/overlay.js#isFlattened") }),
|
|
560
|
+
commands: [PersistDevToolsState({ isOpen: model.isOpen, isFlattened })],
|
|
561
|
+
}), "@foldkit/devtools/overlay.js#ToggledFlatten")),
|
|
562
|
+
ObservedMobileBreakpoint: ({ isMobile }) => {
|
|
563
|
+
if (isMobile === model.isMobile) {
|
|
564
|
+
return __foldkitBrandViewResult(({ model }), "@foldkit/devtools/overlay.js#ObservedMobileBreakpoint");
|
|
565
|
+
}
|
|
566
|
+
return __foldkitBrandViewResult(({
|
|
567
|
+
model: modifyFields(model, { isMobile: () => __foldkitBrandViewResult((isMobile), "@foldkit/devtools/overlay.js#isMobile") }),
|
|
568
|
+
commands: scrollLockCommands(model.isOpen, isMobile),
|
|
569
|
+
}), "@foldkit/devtools/overlay.js#ObservedMobileBreakpoint");
|
|
570
|
+
},
|
|
571
|
+
ClickedRow: ({ index }) => __foldkitBrandViewResult((Match.value(model.mode).pipe(Match.when('TimeTravel', () => (__foldkitBrandViewResult(({
|
|
572
|
+
model,
|
|
573
|
+
commands: [JumpToAndInspect({ index })],
|
|
574
|
+
}), "@foldkit/devtools/overlay.js#anonymous~49"))), Match.when('Inspect', () => (__foldkitBrandViewResult(({
|
|
575
|
+
model: modifyFields(model, {
|
|
576
|
+
selectedIndex: () => __foldkitBrandViewResult((index), "@foldkit/devtools/overlay.js#selectedIndex"),
|
|
577
|
+
isFollowingLatest: () => __foldkitBrandViewResult((false), "@foldkit/devtools/overlay.js#isFollowingLatest"),
|
|
578
|
+
}),
|
|
579
|
+
commands: [InspectState({ index })],
|
|
580
|
+
}), "@foldkit/devtools/overlay.js#anonymous~50"))), Match.exhaustive)), "@foldkit/devtools/overlay.js#ClickedRow"),
|
|
581
|
+
ClickedResume: () => (__foldkitBrandViewResult(({
|
|
582
|
+
model: modifyFields(model, {
|
|
583
|
+
isFollowingTop: () => __foldkitBrandViewResult((true), "@foldkit/devtools/overlay.js#isFollowingTop"),
|
|
584
|
+
expandedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#expandedPaths"),
|
|
585
|
+
changedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#changedPaths"),
|
|
586
|
+
affectedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#affectedPaths"),
|
|
587
|
+
}),
|
|
588
|
+
commands: [Resume(), InspectLatest(), ScrollToTop()],
|
|
589
|
+
}), "@foldkit/devtools/overlay.js#ClickedResume")),
|
|
590
|
+
ClickedClear: () => (__foldkitBrandViewResult(({
|
|
591
|
+
model: modifyFields(model, {
|
|
592
|
+
selectedIndex: () => __foldkitBrandViewResult((INIT_INDEX), "@foldkit/devtools/overlay.js#selectedIndex~2"),
|
|
593
|
+
isFollowingLatest: () => __foldkitBrandViewResult((true), "@foldkit/devtools/overlay.js#isFollowingLatest~2"),
|
|
594
|
+
isFollowingTop: () => __foldkitBrandViewResult((true), "@foldkit/devtools/overlay.js#isFollowingTop~2"),
|
|
595
|
+
maybeBlockFilter: () => __foldkitBrandViewResult((Option.none()), "@foldkit/devtools/overlay.js#maybeBlockFilter~2"),
|
|
596
|
+
expandedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#expandedPaths~2"),
|
|
597
|
+
changedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#changedPaths~2"),
|
|
598
|
+
affectedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#affectedPaths~2"),
|
|
599
|
+
copyStates: () => __foldkitBrandViewResult((HashMap.empty()), "@foldkit/devtools/overlay.js#copyStates"),
|
|
600
|
+
}),
|
|
601
|
+
commands: [Clear(), InspectLatest(), ScrollToTop()],
|
|
602
|
+
}), "@foldkit/devtools/overlay.js#ClickedClear")),
|
|
603
|
+
ClickedFollowLatest: () => {
|
|
604
|
+
const latestIndex = Array.match(model.entries, {
|
|
605
|
+
onEmpty: () => __foldkitBrandViewResult((INIT_INDEX), "@foldkit/devtools/overlay.js#onEmpty~2"),
|
|
606
|
+
onNonEmpty: () => __foldkitBrandViewResult((model.startIndex + model.entries.length - 1), "@foldkit/devtools/overlay.js#onNonEmpty~2"),
|
|
607
|
+
});
|
|
608
|
+
return __foldkitBrandViewResult(({
|
|
534
609
|
model: modifyFields(model, {
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
610
|
+
selectedIndex: () => __foldkitBrandViewResult((latestIndex), "@foldkit/devtools/overlay.js#selectedIndex~3"),
|
|
611
|
+
isFollowingLatest: () => __foldkitBrandViewResult((true), "@foldkit/devtools/overlay.js#isFollowingLatest~3"),
|
|
612
|
+
isFollowingTop: () => __foldkitBrandViewResult((true), "@foldkit/devtools/overlay.js#isFollowingTop~3"),
|
|
613
|
+
expandedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#expandedPaths~3"),
|
|
614
|
+
changedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#changedPaths~3"),
|
|
615
|
+
affectedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#affectedPaths~3"),
|
|
539
616
|
}),
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
617
|
+
commands: [InspectLatest(), ScrollToTop()],
|
|
618
|
+
}), "@foldkit/devtools/overlay.js#ClickedFollowLatest");
|
|
619
|
+
},
|
|
620
|
+
ClickedScrollToTopPill: () => (__foldkitBrandViewResult(({
|
|
621
|
+
model: modifyFields(model, {
|
|
622
|
+
isFollowingTop: () => __foldkitBrandViewResult((true), "@foldkit/devtools/overlay.js#isFollowingTop~4"),
|
|
623
|
+
}),
|
|
624
|
+
commands: [ScrollToTop()],
|
|
625
|
+
}), "@foldkit/devtools/overlay.js#ClickedScrollToTopPill")),
|
|
626
|
+
ScrolledMessageList: ({ scrollTop }) => {
|
|
627
|
+
const isAtTop = scrollTop <= SCROLL_FOLLOW_THRESHOLD_PX;
|
|
628
|
+
return __foldkitBrandViewResult((isAtTop === model.isFollowingTop
|
|
629
|
+
? { model }
|
|
630
|
+
: { model: modifyFields(model, { isFollowingTop: () => __foldkitBrandViewResult((isAtTop), "@foldkit/devtools/overlay.js#isFollowingTop~5") }) }), "@foldkit/devtools/overlay.js#ScrolledMessageList");
|
|
631
|
+
},
|
|
632
|
+
ReceivedInspectedState: ({ model: inspectedModel, maybeMessage, changedPaths, affectedPaths, }) => (__foldkitBrandViewResult(({
|
|
633
|
+
model: modifyFields(model, {
|
|
634
|
+
maybeInspectedModel: () => __foldkitBrandViewResult((Option.some(inspectedModel)), "@foldkit/devtools/overlay.js#maybeInspectedModel"),
|
|
635
|
+
maybeInspectedMessage: () => __foldkitBrandViewResult((maybeMessage), "@foldkit/devtools/overlay.js#maybeInspectedMessage"),
|
|
636
|
+
changedPaths: () => __foldkitBrandViewResult((changedPaths), "@foldkit/devtools/overlay.js#changedPaths~4"),
|
|
637
|
+
affectedPaths: () => __foldkitBrandViewResult((affectedPaths), "@foldkit/devtools/overlay.js#affectedPaths~4"),
|
|
638
|
+
}),
|
|
639
|
+
}), "@foldkit/devtools/overlay.js#ReceivedInspectedState")),
|
|
640
|
+
ToggledTreeNode: ({ path }) => (__foldkitBrandViewResult(({
|
|
641
|
+
model: modifyFields(model, {
|
|
642
|
+
expandedPaths: paths => __foldkitBrandViewResult((HashSet.has(paths, path)
|
|
643
|
+
? HashSet.remove(paths, path)
|
|
644
|
+
: HashSet.add(paths, path)), "@foldkit/devtools/overlay.js#expandedPaths~4"),
|
|
645
|
+
}),
|
|
646
|
+
}), "@foldkit/devtools/overlay.js#ToggledTreeNode")),
|
|
647
|
+
ClickedCopyPayload: ({ targetId, payload }) => {
|
|
648
|
+
if (Option.isSome(HashMap.get(model.copyStates, targetId))) {
|
|
649
|
+
return __foldkitBrandViewResult(({ model }), "@foldkit/devtools/overlay.js#ClickedCopyPayload");
|
|
650
|
+
}
|
|
651
|
+
const requestId = model.nextCopyRequestId;
|
|
652
|
+
return __foldkitBrandViewResult(({
|
|
543
653
|
model: modifyFields(model, {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
: HashSet.add(paths, path)), "@foldkit/devtools/overlay.js#expandedPaths~4"),
|
|
654
|
+
copyStates: states => __foldkitBrandViewResult((HashMap.set(states, targetId, CopyState.Copying({ requestId }))), "@foldkit/devtools/overlay.js#copyStates~2"),
|
|
655
|
+
nextCopyRequestId: current => __foldkitBrandViewResult((current + 1), "@foldkit/devtools/overlay.js#nextCopyRequestId"),
|
|
547
656
|
}),
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
onNonEmpty: () => __foldkitBrandViewResult((startIndex + entries.length - 1), "@foldkit/devtools/overlay.js#onNonEmpty~3"),
|
|
568
|
-
});
|
|
569
|
-
const nextSubmodelTags = computeSubmodelTags(entries);
|
|
570
|
-
const isFilterStale = Option.exists(model.maybeSubmodelFilter, filterTag => __foldkitBrandViewResult((!Array.contains(nextSubmodelTags, filterTag)), "@foldkit/devtools/overlay.js#anonymous~38"));
|
|
571
|
-
const sliderMax = entries.length;
|
|
572
|
-
const targetSliderValue = isPaused
|
|
573
|
-
? hostIndexToSliderValue(pausedAtIndex, startIndex)
|
|
574
|
-
: sliderMax;
|
|
575
|
-
return __foldkitBrandViewResult(({
|
|
576
|
-
model: modifyFields(model, {
|
|
657
|
+
commands: [CopyPayloadToClipboard({ targetId, requestId, payload })],
|
|
658
|
+
}), "@foldkit/devtools/overlay.js#ClickedCopyPayload");
|
|
659
|
+
},
|
|
660
|
+
ReceivedStoreUpdate: ({ entries, initCommands, initMountStarts, startIndex, isPaused, pausedAtIndex, }) => {
|
|
661
|
+
const shouldFollowSelection = Match.value(model.mode).pipe(Match.when('TimeTravel', () => __foldkitBrandViewResult((!isPaused), "@foldkit/devtools/overlay.js#anonymous~51")), Match.when('Inspect', () => __foldkitBrandViewResult((model.isFollowingLatest), "@foldkit/devtools/overlay.js#anonymous~52")), Match.exhaustive);
|
|
662
|
+
const shouldFollowScroll = Match.value(model.mode).pipe(Match.when('TimeTravel', () => __foldkitBrandViewResult((!isPaused && model.isFollowingTop), "@foldkit/devtools/overlay.js#anonymous~53")), Match.when('Inspect', () => __foldkitBrandViewResult((model.isFollowingTop), "@foldkit/devtools/overlay.js#anonymous~54")), Match.exhaustive);
|
|
663
|
+
const latestIndex = Array.match(entries, {
|
|
664
|
+
onEmpty: () => __foldkitBrandViewResult((INIT_INDEX), "@foldkit/devtools/overlay.js#onEmpty~3"),
|
|
665
|
+
onNonEmpty: () => __foldkitBrandViewResult((startIndex + entries.length - 1), "@foldkit/devtools/overlay.js#onNonEmpty~3"),
|
|
666
|
+
});
|
|
667
|
+
const nextBlockTags = computeBlockTags(entries);
|
|
668
|
+
const isFilterStale = Option.exists(model.maybeBlockFilter, filterTag => __foldkitBrandViewResult((!Array.contains(nextBlockTags, filterTag)), "@foldkit/devtools/overlay.js#anonymous~55"));
|
|
669
|
+
const sliderMax = entries.length;
|
|
670
|
+
const targetSliderValue = isPaused
|
|
671
|
+
? hostIndexToSliderValue(pausedAtIndex, startIndex)
|
|
672
|
+
: sliderMax;
|
|
673
|
+
return __foldkitBrandViewResult((Update.combineSteps(model, [
|
|
674
|
+
ApplicationDefinition.step(stepModel => (__foldkitBrandViewResult(({
|
|
675
|
+
model: modifyFields(stepModel, {
|
|
577
676
|
entries: () => __foldkitBrandViewResult((entries), "@foldkit/devtools/overlay.js#entries"),
|
|
578
677
|
initCommands: () => __foldkitBrandViewResult((initCommands), "@foldkit/devtools/overlay.js#initCommands"),
|
|
579
678
|
initMountStarts: () => __foldkitBrandViewResult((initMountStarts), "@foldkit/devtools/overlay.js#initMountStarts"),
|
|
580
679
|
startIndex: () => __foldkitBrandViewResult((startIndex), "@foldkit/devtools/overlay.js#startIndex"),
|
|
581
680
|
isPaused: () => __foldkitBrandViewResult((isPaused), "@foldkit/devtools/overlay.js#isPaused"),
|
|
582
681
|
pausedAtIndex: () => __foldkitBrandViewResult((pausedAtIndex), "@foldkit/devtools/overlay.js#pausedAtIndex"),
|
|
583
|
-
|
|
584
|
-
|
|
682
|
+
blockTags: () => __foldkitBrandViewResult((nextBlockTags), "@foldkit/devtools/overlay.js#blockTags"),
|
|
683
|
+
maybeBlockFilter: current => __foldkitBrandViewResult((isFilterStale ? Option.none() : current), "@foldkit/devtools/overlay.js#maybeBlockFilter~3"),
|
|
585
684
|
selectedIndex: current => __foldkitBrandViewResult((shouldFollowSelection ? latestIndex : current), "@foldkit/devtools/overlay.js#selectedIndex~4"),
|
|
586
|
-
|
|
587
|
-
scrubberValue: current => __foldkitBrandViewResult((Match.value(model.scrubberSlider.dragState).pipe(Match.tag('Dragging', () => __foldkitBrandViewResult((Slider.snapAndClamp(current, 0, sliderMax, 1)), "@foldkit/devtools/overlay.js#anonymous~39")), Match.orElse(() => __foldkitBrandViewResult((Slider.snapAndClamp(targetSliderValue, 0, sliderMax, 1)), "@foldkit/devtools/overlay.js#anonymous~40")))), "@foldkit/devtools/overlay.js#scrubberValue~2"),
|
|
685
|
+
scrubberValue: current => __foldkitBrandViewResult((Match.value(model.scrubberSlider.dragState).pipe(Match.tag('Dragging', () => __foldkitBrandViewResult((Slider.snapAndClamp(current, 0, sliderMax, 1)), "@foldkit/devtools/overlay.js#anonymous~57")), Match.orElse(() => __foldkitBrandViewResult((Slider.snapAndClamp(targetSliderValue, 0, sliderMax, 1)), "@foldkit/devtools/overlay.js#anonymous~58")))), "@foldkit/devtools/overlay.js#scrubberValue~2"),
|
|
588
686
|
}),
|
|
589
687
|
commands: [
|
|
590
|
-
...(
|
|
591
|
-
...(
|
|
688
|
+
...Array.filter([InspectLatest()], () => __foldkitBrandViewResult((shouldFollowSelection), "@foldkit/devtools/overlay.js#anonymous~59")),
|
|
689
|
+
...Array.filter([ScrollToTop()], () => __foldkitBrandViewResult((shouldFollowScroll), "@foldkit/devtools/overlay.js#anonymous~60")),
|
|
592
690
|
],
|
|
593
|
-
}), "@foldkit/devtools/overlay.js#
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
}), "@foldkit/devtools/overlay.js#CompletedWaitBeforeHidingCopyIndicator")),
|
|
634
|
-
})), "@foldkit/devtools/overlay.js#anonymous~29")), "@foldkit/devtools/overlay.js#makeUpdate");
|
|
635
|
-
};
|
|
636
|
-
// SUBSCRIPTION
|
|
637
|
-
const makeOverlaySubscriptions = (store, shadow) => {
|
|
638
|
-
const sliderSubscriptions = Slider.subscriptionsForRoot(() => __foldkitBrandViewResult((shadow), "@foldkit/devtools/overlay.js#anonymous~44"));
|
|
639
|
-
const scrubberSubscriptions = Subscription.lift({
|
|
640
|
-
scrubberPointer: sliderSubscriptions.dragPointer,
|
|
641
|
-
scrubberEscape: sliderSubscriptions.dragEscape,
|
|
642
|
-
})({
|
|
643
|
-
read: model => __foldkitBrandViewResult((Option.some(model.scrubberSlider)), "@foldkit/devtools/overlay.js#read~4"),
|
|
644
|
-
toParentMessage: message => __foldkitBrandViewResult((Message.GotScrubberSliderMessage({ message })), "@foldkit/devtools/overlay.js#toParentMessage~4"),
|
|
645
|
-
});
|
|
646
|
-
const ownSubscriptions = Subscription.make()(_entry => (__foldkitBrandViewResult(({
|
|
647
|
-
scrubFrame: Subscription.animationFrameEntry({
|
|
648
|
-
isActive: model => __foldkitBrandViewResult((Option.isSome(model.maybePendingScrubIndex)), "@foldkit/devtools/overlay.js#isActive"),
|
|
649
|
-
toMessage: () => __foldkitBrandViewResult((Message.TickedScrubFrame()), "@foldkit/devtools/overlay.js#toMessage"),
|
|
650
|
-
}),
|
|
651
|
-
storeUpdates: Subscription.persistentEntry(SubscriptionRef.changes(store.stateRef).pipe(Stream.map(state => __foldkitBrandViewResult((Message.ReceivedStoreUpdate(toDisplayState(state))), "@foldkit/devtools/overlay.js#anonymous~46")))),
|
|
652
|
-
mobileBreakpoint: Subscription.persistentEntry(Dom.streamFromMediaQuery({
|
|
653
|
-
query: MOBILE_BREAKPOINT_QUERY,
|
|
654
|
-
mapMatches: isMobile => __foldkitBrandViewResult((Message.ObservedMobileBreakpoint({ isMobile })), "@foldkit/devtools/overlay.js#mapMatches"),
|
|
655
|
-
})),
|
|
656
|
-
}), "@foldkit/devtools/overlay.js#anonymous~45")));
|
|
657
|
-
return __foldkitBrandViewResult((Subscription.aggregate(ownSubscriptions, scrubberSubscriptions)), "@foldkit/devtools/overlay.js#makeOverlaySubscriptions");
|
|
658
|
-
};
|
|
691
|
+
}), "@foldkit/devtools/overlay.js#anonymous~56"))),
|
|
692
|
+
bindings.ScrubberBinding.informRangeChanged({ min: 0, max: sliderMax }),
|
|
693
|
+
])), "@foldkit/devtools/overlay.js#ReceivedStoreUpdate");
|
|
694
|
+
},
|
|
695
|
+
TickedScrubFrame: () => __foldkitBrandViewResult((Option.match(model.maybePendingScrubIndex, {
|
|
696
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@foldkit/devtools/overlay.js#onNone~2")),
|
|
697
|
+
onSome: hostIndex => (__foldkitBrandViewResult(({
|
|
698
|
+
model: modifyFields(model, {
|
|
699
|
+
maybePendingScrubIndex: () => __foldkitBrandViewResult((Option.none()), "@foldkit/devtools/overlay.js#maybePendingScrubIndex~2"),
|
|
700
|
+
}),
|
|
701
|
+
commands: [JumpToAndInspect({ index: hostIndex })],
|
|
702
|
+
}), "@foldkit/devtools/overlay.js#onSome~2")),
|
|
703
|
+
})), "@foldkit/devtools/overlay.js#TickedScrubFrame"),
|
|
704
|
+
CompletedResume: () => (__foldkitBrandViewResult(({ model }), "@foldkit/devtools/overlay.js#CompletedResume")),
|
|
705
|
+
CompletedClear: () => (__foldkitBrandViewResult(({ model }), "@foldkit/devtools/overlay.js#CompletedClear")),
|
|
706
|
+
CompletedPersistDevToolsState: () => (__foldkitBrandViewResult(({ model }), "@foldkit/devtools/overlay.js#CompletedPersistDevToolsState")),
|
|
707
|
+
CompletedLockScroll: () => (__foldkitBrandViewResult(({ model }), "@foldkit/devtools/overlay.js#CompletedLockScroll")),
|
|
708
|
+
CompletedUnlockScroll: () => (__foldkitBrandViewResult(({ model }), "@foldkit/devtools/overlay.js#CompletedUnlockScroll")),
|
|
709
|
+
CompletedScrollToTop: () => (__foldkitBrandViewResult(({ model }), "@foldkit/devtools/overlay.js#CompletedScrollToTop")),
|
|
710
|
+
SucceededCopyPayloadToClipboard: ({ targetId, requestId }) => __foldkitBrandViewResult((Option.exists(HashMap.get(model.copyStates, targetId), state => __foldkitBrandViewResult((state._tag === 'Copying' && state.requestId === requestId), "@foldkit/devtools/overlay.js#anonymous~61"))
|
|
711
|
+
? {
|
|
712
|
+
model: modifyFields(model, {
|
|
713
|
+
copyStates: states => __foldkitBrandViewResult((HashMap.set(states, targetId, CopyState.Copied({ requestId }))), "@foldkit/devtools/overlay.js#copyStates~3"),
|
|
714
|
+
}),
|
|
715
|
+
commands: [WaitBeforeHidingCopyIndicator({ targetId, requestId })],
|
|
716
|
+
}
|
|
717
|
+
: { model }), "@foldkit/devtools/overlay.js#SucceededCopyPayloadToClipboard"),
|
|
718
|
+
FailedCopyPayloadToClipboard: ({ targetId, requestId }) => (__foldkitBrandViewResult(({
|
|
719
|
+
model: Option.exists(HashMap.get(model.copyStates, targetId), state => __foldkitBrandViewResult((state._tag === 'Copying' && state.requestId === requestId), "@foldkit/devtools/overlay.js#anonymous~62"))
|
|
720
|
+
? modifyFields(model, { copyStates: HashMap.remove(targetId) })
|
|
721
|
+
: model,
|
|
722
|
+
}), "@foldkit/devtools/overlay.js#FailedCopyPayloadToClipboard")),
|
|
723
|
+
CompletedWaitBeforeHidingCopyIndicator: ({ targetId, requestId }) => (__foldkitBrandViewResult(({
|
|
724
|
+
model: Option.exists(HashMap.get(model.copyStates, targetId), state => __foldkitBrandViewResult((state._tag === 'Copied' && state.requestId === requestId), "@foldkit/devtools/overlay.js#anonymous~63"))
|
|
725
|
+
? modifyFields(model, {
|
|
726
|
+
copyStates: HashMap.remove(targetId),
|
|
727
|
+
})
|
|
728
|
+
: model,
|
|
729
|
+
}), "@foldkit/devtools/overlay.js#CompletedWaitBeforeHidingCopyIndicator")),
|
|
730
|
+
})), "@foldkit/devtools/overlay.js#anonymous~46"));
|
|
659
731
|
// VIEW
|
|
660
732
|
const indexClass = 'text-2xs text-dt-muted font-mono min-w-5';
|
|
661
733
|
const headerButtonClass = 'dt-header-button bg-transparent border-none text-dt-muted cursor-pointer text-base font-mono transition-colors';
|
|
@@ -680,24 +752,38 @@ const PANEL_POSITION_CLASS = {
|
|
|
680
752
|
// every memo on every render. Hoisting only the lazy slots out does not help;
|
|
681
753
|
// the closures themselves have to be reference-stable.
|
|
682
754
|
//
|
|
683
|
-
// Safe despite the "thread `h`, never store it" rule because
|
|
684
|
-
// its
|
|
685
|
-
//
|
|
686
|
-
const makeView = (
|
|
687
|
-
|
|
755
|
+
// Safe despite the "thread `h`, never store it" rule because each cached view
|
|
756
|
+
// is keyed by the ShadowRoot that owns its root frame, and the builder is the
|
|
757
|
+
// runtime's process-wide singleton.
|
|
758
|
+
const makeView = (bindings) => {
|
|
759
|
+
const views = new WeakMap();
|
|
688
760
|
return __foldkitBrandViewResult(((model, h) => {
|
|
689
|
-
|
|
690
|
-
|
|
761
|
+
const shadow = getDevToolsShadowRoot();
|
|
762
|
+
const existingView = views.get(shadow);
|
|
763
|
+
if (existingView !== undefined) {
|
|
764
|
+
return __foldkitBrandViewResult((existingView(model)), "@foldkit/devtools/overlay.js#anonymous~64");
|
|
765
|
+
}
|
|
766
|
+
const view = buildOverlayView(model.position, model.mode, shadow, model.maybeBanner, bindings, h);
|
|
767
|
+
views.set(shadow, view);
|
|
768
|
+
return __foldkitBrandViewResult((view(model)), "@foldkit/devtools/overlay.js#anonymous~64");
|
|
691
769
|
}), "@foldkit/devtools/overlay.js#makeView");
|
|
692
770
|
};
|
|
693
|
-
const
|
|
771
|
+
const view = ApplicationComposition.makeView(makeView(bindings));
|
|
772
|
+
const ApplicationBlock = ApplicationComposition.assembleBlock({
|
|
773
|
+
init,
|
|
774
|
+
update,
|
|
775
|
+
view,
|
|
776
|
+
subscriptions,
|
|
777
|
+
EffectsLayer,
|
|
778
|
+
});
|
|
779
|
+
const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
|
|
694
780
|
const lazyTreeNode = createKeyedLazy();
|
|
695
781
|
const lazyMessageRow = createKeyedLazy();
|
|
696
782
|
const lazyTabContent = createKeyedLazy();
|
|
697
783
|
const lazyMessageList = createLazy();
|
|
698
784
|
// JSON TREE
|
|
699
785
|
const leafSpan = (className, text) => __foldkitBrandViewResult((h.span([h.Class(className)], [text])), "@foldkit/devtools/overlay.js#leafSpan");
|
|
700
|
-
const leafValueView = (value) => __foldkitBrandViewResult((Match.value(value).pipe(Match.when(Predicate.isNull, () => __foldkitBrandViewResult((leafSpan('json-null italic', 'null')), "@foldkit/devtools/overlay.js#anonymous~
|
|
786
|
+
const leafValueView = (value) => __foldkitBrandViewResult((Match.value(value).pipe(Match.when(Predicate.isNull, () => __foldkitBrandViewResult((leafSpan('json-null italic', 'null')), "@foldkit/devtools/overlay.js#anonymous~65")), Match.when(Predicate.isUndefined, () => __foldkitBrandViewResult((leafSpan('json-null italic', 'undefined')), "@foldkit/devtools/overlay.js#anonymous~66")), Match.when(Predicate.isString, stringValue => __foldkitBrandViewResult((leafSpan('json-string', `"${stringValue}"`)), "@foldkit/devtools/overlay.js#anonymous~67")), Match.when(Predicate.isNumber, numberValue => __foldkitBrandViewResult((leafSpan('json-number', globalThis.String(numberValue))), "@foldkit/devtools/overlay.js#anonymous~68")), Match.when(Predicate.isBoolean, booleanValue => __foldkitBrandViewResult((leafSpan('json-boolean', globalThis.String(booleanValue))), "@foldkit/devtools/overlay.js#anonymous~69")), Match.orElse(unknownValue => __foldkitBrandViewResult((leafSpan('json-null', globalThis.String(unknownValue))), "@foldkit/devtools/overlay.js#anonymous~70")))), "@foldkit/devtools/overlay.js#leafValueView");
|
|
701
787
|
const keyView = (key) => __foldkitBrandViewResult((h.span([h.Class('json-key')], [`${key}:\u00a0`])), "@foldkit/devtools/overlay.js#keyView");
|
|
702
788
|
const CHEVRON_RIGHT = 'M8.25 4.5l7.5 7.5-7.5 7.5';
|
|
703
789
|
const CHEVRON_DOWN = 'M19.5 8.25l-7.5 7.5-7.5-7.5';
|
|
@@ -721,8 +807,8 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
721
807
|
const tagLabelView = (tag) => __foldkitBrandViewResult((h.span([h.Class('json-tag')], [tag])), "@foldkit/devtools/overlay.js#tagLabelView");
|
|
722
808
|
const copyPayloadButtonView = (payload, targetId, copyStates, subject) => {
|
|
723
809
|
const maybeCopyState = HashMap.get(copyStates, targetId);
|
|
724
|
-
const isCopying = Option.exists(maybeCopyState, state => __foldkitBrandViewResult((state._tag === 'Copying'), "@foldkit/devtools/overlay.js#anonymous~
|
|
725
|
-
const isCopied = Option.exists(maybeCopyState, state => __foldkitBrandViewResult((state._tag === 'Copied'), "@foldkit/devtools/overlay.js#anonymous~
|
|
810
|
+
const isCopying = Option.exists(maybeCopyState, state => __foldkitBrandViewResult((state._tag === 'Copying'), "@foldkit/devtools/overlay.js#anonymous~71"));
|
|
811
|
+
const isCopied = Option.exists(maybeCopyState, state => __foldkitBrandViewResult((state._tag === 'Copied'), "@foldkit/devtools/overlay.js#anonymous~72"));
|
|
726
812
|
const ariaLabel = Option.match(maybeCopyState, {
|
|
727
813
|
onNone: () => __foldkitBrandViewResult((`Copy ${subject} as JSON`), "@foldkit/devtools/overlay.js#onNone~3"),
|
|
728
814
|
onSome: CopyState.match({
|
|
@@ -808,16 +894,16 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
808
894
|
treePath: `${treePath}.${arrayIndex}`,
|
|
809
895
|
depth: childDepth,
|
|
810
896
|
key: globalThis.String(arrayIndex),
|
|
811
|
-
})), "@foldkit/devtools/overlay.js#anonymous~
|
|
897
|
+
})), "@foldkit/devtools/overlay.js#anonymous~73"));
|
|
812
898
|
}
|
|
813
899
|
else if (Predicate.isObject(value)) {
|
|
814
|
-
pipe(value, Record.toEntries, Array.filter(([entryKey]) => __foldkitBrandViewResult((entryKey !== '_tag'), "@foldkit/devtools/overlay.js#anonymous~
|
|
900
|
+
pipe(value, Record.toEntries, Array.filter(([entryKey]) => __foldkitBrandViewResult((entryKey !== '_tag'), "@foldkit/devtools/overlay.js#anonymous~74")), Array.forEach(([entryKey, childValue]) => __foldkitBrandViewResult((flattenTree({
|
|
815
901
|
...shared,
|
|
816
902
|
value: childValue,
|
|
817
903
|
treePath: `${treePath}.${entryKey}`,
|
|
818
904
|
depth: childDepth,
|
|
819
905
|
key: entryKey,
|
|
820
|
-
})), "@foldkit/devtools/overlay.js#anonymous~
|
|
906
|
+
})), "@foldkit/devtools/overlay.js#anonymous~75")));
|
|
821
907
|
}
|
|
822
908
|
};
|
|
823
909
|
const flatNodeView = (value, treePath, depth, key, nodeIsExpandable, isExpanded, isChanged, isAffected, isRoot, tag) => {
|
|
@@ -837,7 +923,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
837
923
|
'diff-changed': isChanged,
|
|
838
924
|
})),
|
|
839
925
|
indent,
|
|
840
|
-
], rowSegments.map(segment => __foldkitBrandViewResult((h.keyed('li')(segment._tag, [h.Class('contents')], [rowSegmentView(segment)])), "@foldkit/devtools/overlay.js#anonymous~
|
|
926
|
+
], rowSegments.map(segment => __foldkitBrandViewResult((h.keyed('li')(segment._tag, [h.Class('contents')], [rowSegmentView(segment)])), "@foldkit/devtools/overlay.js#anonymous~76")))), "@foldkit/devtools/overlay.js#flatNodeView");
|
|
841
927
|
}
|
|
842
928
|
const preview = isExpanded
|
|
843
929
|
? globalThis.Array.isArray(value)
|
|
@@ -861,7 +947,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
861
947
|
...(isRoot
|
|
862
948
|
? []
|
|
863
949
|
: [h.OnClick(Message.ToggledTreeNode({ path: treePath }))]),
|
|
864
|
-
], rowSegments.map(segment => __foldkitBrandViewResult((h.keyed('li')(segment._tag, [h.Class('contents')], [rowSegmentView(segment)])), "@foldkit/devtools/overlay.js#anonymous~
|
|
950
|
+
], rowSegments.map(segment => __foldkitBrandViewResult((h.keyed('li')(segment._tag, [h.Class('contents')], [rowSegmentView(segment)])), "@foldkit/devtools/overlay.js#anonymous~77")))), "@foldkit/devtools/overlay.js#flatNodeView");
|
|
865
951
|
};
|
|
866
952
|
const renderFlatNode = (node) => __foldkitBrandViewResult((lazyTreeNode(node.treePath, flatNodeView, [
|
|
867
953
|
node.value,
|
|
@@ -885,7 +971,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
885
971
|
changedPaths,
|
|
886
972
|
affectedPaths,
|
|
887
973
|
depth: 0,
|
|
888
|
-
key: Option.getOrElse(maybeRootLabel, () => __foldkitBrandViewResult((''), "@foldkit/devtools/overlay.js#anonymous~
|
|
974
|
+
key: Option.getOrElse(maybeRootLabel, () => __foldkitBrandViewResult((''), "@foldkit/devtools/overlay.js#anonymous~78")),
|
|
889
975
|
accumulator: nodes,
|
|
890
976
|
indentRootChildren,
|
|
891
977
|
});
|
|
@@ -908,8 +994,8 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
908
994
|
const remainingMs = delta % MILLIS_PER_SECOND;
|
|
909
995
|
return __foldkitBrandViewResult((seconds > 0
|
|
910
996
|
? `+${seconds}s ${remainingMs.toFixed(1)}ms`
|
|
911
|
-
: `+${remainingMs.toFixed(1)}ms`), "@foldkit/devtools/overlay.js#anonymous~
|
|
912
|
-
}), Option.getOrElse(() => __foldkitBrandViewResult((''), "@foldkit/devtools/overlay.js#anonymous~
|
|
997
|
+
: `+${remainingMs.toFixed(1)}ms`), "@foldkit/devtools/overlay.js#anonymous~79");
|
|
998
|
+
}), Option.getOrElse(() => __foldkitBrandViewResult((''), "@foldkit/devtools/overlay.js#anonymous~80")))), "@foldkit/devtools/overlay.js#inspectedTimestamp");
|
|
913
999
|
};
|
|
914
1000
|
const emptyInspectorView = h.div([
|
|
915
1001
|
h.Class('flex-1 flex items-center justify-center text-dt-muted text-2xs font-mono min-w-0'),
|
|
@@ -938,11 +1024,11 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
938
1024
|
return __foldkitBrandViewResult((message), "@foldkit/devtools/overlay.js#unwrapToLeaf");
|
|
939
1025
|
}
|
|
940
1026
|
};
|
|
941
|
-
const unwrapIfFiltered = (message,
|
|
942
|
-
if (Option.isNone(
|
|
1027
|
+
const unwrapIfFiltered = (message, maybeBlockFilter) => {
|
|
1028
|
+
if (Option.isNone(maybeBlockFilter)) {
|
|
943
1029
|
return __foldkitBrandViewResult((message), "@foldkit/devtools/overlay.js#unwrapIfFiltered");
|
|
944
1030
|
}
|
|
945
|
-
const { value: filterTag } =
|
|
1031
|
+
const { value: filterTag } = maybeBlockFilter;
|
|
946
1032
|
let current = message;
|
|
947
1033
|
let matched = false;
|
|
948
1034
|
while (isTagged(current) && GOT_MESSAGE_PATTERN.test(current._tag)) {
|
|
@@ -961,18 +1047,18 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
961
1047
|
}
|
|
962
1048
|
return __foldkitBrandViewResult((current), "@foldkit/devtools/overlay.js#unwrapIfFiltered");
|
|
963
1049
|
};
|
|
964
|
-
const messageTabContent = (maybeInspectedMessage,
|
|
1050
|
+
const messageTabContent = (maybeInspectedMessage, maybeBlockFilter, isFlattened, expandedPaths, timestamp, selectedIndex, copyStates) => __foldkitBrandViewResult((Option.match(maybeInspectedMessage, {
|
|
965
1051
|
onNone: noMessageView,
|
|
966
1052
|
onSome: rawMessage => {
|
|
967
1053
|
const message = isFlattened
|
|
968
1054
|
? unwrapToLeaf(rawMessage)
|
|
969
|
-
: unwrapIfFiltered(rawMessage,
|
|
1055
|
+
: unwrapIfFiltered(rawMessage, maybeBlockFilter);
|
|
970
1056
|
return __foldkitBrandViewResult((h.div([h.Class('flex flex-col flex-1 min-h-0 min-w-0')], [
|
|
971
1057
|
h.div([
|
|
972
1058
|
h.Class('flex items-center justify-between px-2 py-1 border-b text-2xs text-dt-muted font-mono shrink-0'),
|
|
973
1059
|
], [
|
|
974
1060
|
h.span([], [timestamp]),
|
|
975
|
-
copyPayloadButtonView(message, `Message:${selectedIndex}:${isFlattened}:${Option.getOrElse(
|
|
1061
|
+
copyPayloadButtonView(message, `Message:${selectedIndex}:${isFlattened}:${Option.getOrElse(maybeBlockFilter, () => __foldkitBrandViewResult(('All'), "@foldkit/devtools/overlay.js#anonymous~81"))}`, copyStates, 'Message payload'),
|
|
976
1062
|
]),
|
|
977
1063
|
h.div([h.Class('flex flex-col flex-1 min-h-0 min-w-0 pt-1 pl-1')], [
|
|
978
1064
|
treeView(message, 'root', expandedPaths, HashSet.empty(), HashSet.empty(), Option.none(), false),
|
|
@@ -985,7 +1071,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
985
1071
|
onEmpty: () => __foldkitBrandViewResult((INIT_INDEX), "@foldkit/devtools/overlay.js#onEmpty~4"),
|
|
986
1072
|
onNonEmpty: () => __foldkitBrandViewResult((model.startIndex + model.entries.length - 1), "@foldkit/devtools/overlay.js#onNonEmpty~4"),
|
|
987
1073
|
});
|
|
988
|
-
return __foldkitBrandViewResult((Match.value(mode).pipe(Match.when('TimeTravel', () => __foldkitBrandViewResult((model.isPaused ? model.pausedAtIndex : lastIndex), "@foldkit/devtools/overlay.js#anonymous~
|
|
1074
|
+
return __foldkitBrandViewResult((Match.value(mode).pipe(Match.when('TimeTravel', () => __foldkitBrandViewResult((model.isPaused ? model.pausedAtIndex : lastIndex), "@foldkit/devtools/overlay.js#anonymous~82")), Match.when('Inspect', () => __foldkitBrandViewResult((model.selectedIndex), "@foldkit/devtools/overlay.js#anonymous~83")), Match.exhaustive)), "@foldkit/devtools/overlay.js#selectedHistoryIndex");
|
|
989
1075
|
};
|
|
990
1076
|
const selectedCommands = (model) => {
|
|
991
1077
|
const selectedIndex = selectedHistoryIndex(model);
|
|
@@ -993,7 +1079,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
993
1079
|
return __foldkitBrandViewResult((model.initCommands), "@foldkit/devtools/overlay.js#selectedCommands");
|
|
994
1080
|
}
|
|
995
1081
|
else {
|
|
996
|
-
return __foldkitBrandViewResult((pipe(model.entries, Array.get(selectedIndex - model.startIndex), Option.map(entry => __foldkitBrandViewResult((entry.commands), "@foldkit/devtools/overlay.js#anonymous~
|
|
1082
|
+
return __foldkitBrandViewResult((pipe(model.entries, Array.get(selectedIndex - model.startIndex), Option.map(entry => __foldkitBrandViewResult((entry.commands), "@foldkit/devtools/overlay.js#anonymous~84")), Option.getOrElse(() => __foldkitBrandViewResult((NO_COMMANDS), "@foldkit/devtools/overlay.js#anonymous~85")))), "@foldkit/devtools/overlay.js#selectedCommands");
|
|
997
1083
|
}
|
|
998
1084
|
};
|
|
999
1085
|
const flattenCommand = (command, index, expandedPaths) => {
|
|
@@ -1023,26 +1109,26 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
1023
1109
|
], Array.map(commandList, (command, index) => __foldkitBrandViewResult((h.div([h.Class('flex items-start px-2 py-1 border-b gap-1.5')], [
|
|
1024
1110
|
h.span([h.Class(indexClass)], [globalThis.String(index + 1)]),
|
|
1025
1111
|
h.div([h.Class('flex flex-col flex-1 min-w-0')], [
|
|
1026
|
-
...Option.match(command.
|
|
1112
|
+
...Option.match(command.maybeBlockPath, {
|
|
1027
1113
|
onNone: () => __foldkitBrandViewResult(([
|
|
1028
1114
|
h.div([h.Class('text-2xs text-dt-muted font-mono')], [
|
|
1029
1115
|
h.span([h.AriaHidden(true)], ['…']),
|
|
1030
1116
|
h.span([h.Class('sr-only')], ['Destination pending']),
|
|
1031
1117
|
]),
|
|
1032
1118
|
]), "@foldkit/devtools/overlay.js#onNone~5"),
|
|
1033
|
-
onSome:
|
|
1119
|
+
onSome: blockPath => __foldkitBrandViewResult((Array.match(blockPath, {
|
|
1034
1120
|
onEmpty: () => __foldkitBrandViewResult(([]), "@foldkit/devtools/overlay.js#onEmpty~6"),
|
|
1035
|
-
onNonEmpty:
|
|
1121
|
+
onNonEmpty: blockPath => __foldkitBrandViewResult(([
|
|
1036
1122
|
h.div([
|
|
1037
1123
|
h.Class('text-2xs text-dt-muted font-mono truncate'),
|
|
1038
|
-
], [
|
|
1124
|
+
], [formatBlockPath(blockPath)]),
|
|
1039
1125
|
]), "@foldkit/devtools/overlay.js#onNonEmpty~6"),
|
|
1040
1126
|
})), "@foldkit/devtools/overlay.js#onSome~5"),
|
|
1041
1127
|
}),
|
|
1042
1128
|
...Array.map(flattenCommand(command, index, expandedPaths), renderFlatNode),
|
|
1043
1129
|
]),
|
|
1044
1130
|
copyPayloadButtonView(taggedPayload(command.name, command.args), `Command:${selectedIndex}:${index}`, copyStates, `Command ${index + 1} (${command.name}) payload`),
|
|
1045
|
-
])), "@foldkit/devtools/overlay.js#anonymous~
|
|
1131
|
+
])), "@foldkit/devtools/overlay.js#anonymous~86")))), "@foldkit/devtools/overlay.js#onNonEmpty~5"),
|
|
1046
1132
|
})), "@foldkit/devtools/overlay.js#commandsTabContent");
|
|
1047
1133
|
const selectedMountActivity = (model) => {
|
|
1048
1134
|
const selectedIndex = selectedHistoryIndex(model);
|
|
@@ -1085,7 +1171,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
1085
1171
|
h.span([h.Class(indexClass)], [globalThis.String(index + 1)]),
|
|
1086
1172
|
h.div([h.Class('flex flex-col flex-1 min-w-0')], Array.map(flattenMount(mount, label, index, expandedPaths), renderFlatNode)),
|
|
1087
1173
|
copyPayloadButtonView(taggedPayload(mount.name, mount.args), `Mount:${selectedIndex}:${label}:${index}`, copyStates, `${label} Mount ${index + 1} (${mount.name}) payload`),
|
|
1088
|
-
])), "@foldkit/devtools/overlay.js#anonymous~
|
|
1174
|
+
])), "@foldkit/devtools/overlay.js#anonymous~87")),
|
|
1089
1175
|
])), "@foldkit/devtools/overlay.js#mountListSection");
|
|
1090
1176
|
const mountsTabContent = (starts, ends, expandedPaths, selectedIndex, copyStates) => {
|
|
1091
1177
|
const hasAny = Array.isReadonlyArrayNonEmpty(starts) ||
|
|
@@ -1119,20 +1205,20 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
1119
1205
|
model.affectedPaths,
|
|
1120
1206
|
selectedIndex,
|
|
1121
1207
|
model.copyStates,
|
|
1122
|
-
])), "@foldkit/devtools/overlay.js#anonymous~
|
|
1208
|
+
])), "@foldkit/devtools/overlay.js#anonymous~88")), Match.when('Message', () => __foldkitBrandViewResult((lazyTabContent('Message', messageTabContent, [
|
|
1123
1209
|
model.maybeInspectedMessage,
|
|
1124
|
-
model.
|
|
1210
|
+
model.maybeBlockFilter,
|
|
1125
1211
|
model.isFlattened,
|
|
1126
1212
|
model.expandedPaths,
|
|
1127
1213
|
inspectedTimestamp(model),
|
|
1128
1214
|
selectedIndex,
|
|
1129
1215
|
model.copyStates,
|
|
1130
|
-
])), "@foldkit/devtools/overlay.js#anonymous~
|
|
1216
|
+
])), "@foldkit/devtools/overlay.js#anonymous~89")), Match.when('Commands', () => __foldkitBrandViewResult((lazyTabContent('Commands', commandsTabContent, [
|
|
1131
1217
|
selectedCommands(model),
|
|
1132
1218
|
model.expandedPaths,
|
|
1133
1219
|
selectedIndex,
|
|
1134
1220
|
model.copyStates,
|
|
1135
|
-
])), "@foldkit/devtools/overlay.js#anonymous~
|
|
1221
|
+
])), "@foldkit/devtools/overlay.js#anonymous~90")), Match.when('Mounts', () => {
|
|
1136
1222
|
const { starts, ends } = selectedMountActivity(model);
|
|
1137
1223
|
return __foldkitBrandViewResult((lazyTabContent('Mounts', mountsTabContent, [
|
|
1138
1224
|
starts,
|
|
@@ -1140,16 +1226,15 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
1140
1226
|
model.expandedPaths,
|
|
1141
1227
|
selectedIndex,
|
|
1142
1228
|
model.copyStates,
|
|
1143
|
-
])), "@foldkit/devtools/overlay.js#anonymous~
|
|
1229
|
+
])), "@foldkit/devtools/overlay.js#anonymous~91");
|
|
1144
1230
|
}), Match.exhaustive)), "@foldkit/devtools/overlay.js#inspectorTabContent");
|
|
1145
1231
|
};
|
|
1146
1232
|
const inspectorPaneView = (model) => __foldkitBrandViewResult((h.div([
|
|
1147
1233
|
h.Class('flex flex-col border-l min-w-0 min-h-0 flex-1 dt-inspector-pane'),
|
|
1148
1234
|
], [
|
|
1149
|
-
h.
|
|
1235
|
+
h.block(bindings.InspectorTabsBinding.embedView({
|
|
1150
1236
|
slotId: model.inspectorTabs.id,
|
|
1151
1237
|
model: model.inspectorTabs,
|
|
1152
|
-
view: InspectorTabs.view,
|
|
1153
1238
|
viewInputs: {
|
|
1154
1239
|
tabs: INSPECTOR_TABS,
|
|
1155
1240
|
selectedValue: model.activeInspectorTab,
|
|
@@ -1161,7 +1246,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
1161
1246
|
h.Class(clsx('dt-tab-button cursor-pointer text-base font-mono px-3 py-1', tab.isActive
|
|
1162
1247
|
? 'text-dt dt-tab-active'
|
|
1163
1248
|
: 'text-dt-muted')),
|
|
1164
|
-
], [h.span([], [tab.value])])), "@foldkit/devtools/overlay.js#anonymous~
|
|
1249
|
+
], [h.span([], [tab.value])])), "@foldkit/devtools/overlay.js#anonymous~92"))),
|
|
1165
1250
|
...tabs.map(tab => __foldkitBrandViewResult((h.div([
|
|
1166
1251
|
...tab.panel,
|
|
1167
1252
|
h.Class('flex flex-col flex-1 min-h-0 min-w-0'),
|
|
@@ -1174,11 +1259,10 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
1174
1259
|
onNone: () => __foldkitBrandViewResult((emptyInspectorView), "@foldkit/devtools/overlay.js#onNone~7"),
|
|
1175
1260
|
onSome: inspectedModel => __foldkitBrandViewResult((inspectorTabContent(model, tab.value, inspectedModel)), "@foldkit/devtools/overlay.js#onSome~7"),
|
|
1176
1261
|
}),
|
|
1177
|
-
])), "@foldkit/devtools/overlay.js#anonymous~
|
|
1262
|
+
])), "@foldkit/devtools/overlay.js#anonymous~93")),
|
|
1178
1263
|
])), "@foldkit/devtools/overlay.js#toView"),
|
|
1179
1264
|
},
|
|
1180
|
-
|
|
1181
|
-
}),
|
|
1265
|
+
})),
|
|
1182
1266
|
])), "@foldkit/devtools/overlay.js#inspectorPaneView");
|
|
1183
1267
|
// MESSAGE LIST
|
|
1184
1268
|
const badgeView = (model) => __foldkitBrandViewResult((h.button([
|
|
@@ -1226,7 +1310,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
1226
1310
|
h.StrokeLinejoin('round'),
|
|
1227
1311
|
]),
|
|
1228
1312
|
]);
|
|
1229
|
-
const filterItemLabel = (item) => __foldkitBrandViewResult((String.isNonEmpty(item) ?
|
|
1313
|
+
const filterItemLabel = (item) => __foldkitBrandViewResult((String.isNonEmpty(item) ? blockSegmentLabel(item) : 'All Messages'), "@foldkit/devtools/overlay.js#filterItemLabel");
|
|
1230
1314
|
const ARROW_UP = 'M4.5 10.5L12 3m0 0l7.5 7.5M12 3v18';
|
|
1231
1315
|
const arrowUpIconView = h.svg([
|
|
1232
1316
|
h.AriaHidden(true),
|
|
@@ -1247,18 +1331,17 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
1247
1331
|
arrowUpIconView,
|
|
1248
1332
|
h.span([h.Class('dt-scroll-pill-text')], ['Jump to top']),
|
|
1249
1333
|
])), "@foldkit/devtools/overlay.js#scrollToTopPillView");
|
|
1250
|
-
const
|
|
1251
|
-
const buttonLabel = Option.match(model.
|
|
1334
|
+
const blockFilterView = (model) => {
|
|
1335
|
+
const buttonLabel = Option.match(model.maybeBlockFilter, {
|
|
1252
1336
|
onNone: () => __foldkitBrandViewResult(('All Messages'), "@foldkit/devtools/overlay.js#onNone~8"),
|
|
1253
|
-
onSome:
|
|
1337
|
+
onSome: blockSegmentLabel,
|
|
1254
1338
|
});
|
|
1255
|
-
return __foldkitBrandViewResult((h.
|
|
1256
|
-
slotId: '
|
|
1257
|
-
model: model.
|
|
1258
|
-
view: SubmodelFilterListbox.view,
|
|
1339
|
+
return __foldkitBrandViewResult((h.block(bindings.BlockFilterListboxBinding.embedView({
|
|
1340
|
+
slotId: 'block-filter',
|
|
1341
|
+
model: model.blockFilterListbox,
|
|
1259
1342
|
viewInputs: {
|
|
1260
|
-
items: [ALL_MESSAGES_VALUE, ...model.
|
|
1261
|
-
maybeSelectedValue: Option.orElseSome(model.
|
|
1343
|
+
items: [ALL_MESSAGES_VALUE, ...model.blockTags],
|
|
1344
|
+
maybeSelectedValue: Option.orElseSome(model.maybeBlockFilter, () => __foldkitBrandViewResult((ALL_MESSAGES_VALUE), "@foldkit/devtools/overlay.js#anonymous~94")),
|
|
1262
1345
|
itemToConfig: item => (__foldkitBrandViewResult(({
|
|
1263
1346
|
className: 'dt-filter-item',
|
|
1264
1347
|
content: h.div([h.Class('flex items-center gap-2')], [checkIconView, h.span([], [filterItemLabel(item)])]),
|
|
@@ -1286,8 +1369,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
1286
1369
|
className: 'dt-filter-wrapper',
|
|
1287
1370
|
backdropClassName: 'dt-filter-backdrop',
|
|
1288
1371
|
},
|
|
1289
|
-
|
|
1290
|
-
})), "@foldkit/devtools/overlay.js#submodelFilterView");
|
|
1372
|
+
}))), "@foldkit/devtools/overlay.js#blockFilterView");
|
|
1291
1373
|
};
|
|
1292
1374
|
// SETTINGS
|
|
1293
1375
|
const flattenSwitchView = (model) => __foldkitBrandViewResult((Switch.view({
|
|
@@ -1328,7 +1410,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
1328
1410
|
: {
|
|
1329
1411
|
status: h.span([h.Class(`${statusClass} text-dt-live font-medium`)], ['Live']),
|
|
1330
1412
|
maybeAction: Option.none(),
|
|
1331
|
-
}), "@foldkit/devtools/overlay.js#anonymous~
|
|
1413
|
+
}), "@foldkit/devtools/overlay.js#anonymous~95")), Match.when('Inspect', () => (__foldkitBrandViewResult(({
|
|
1332
1414
|
status: h.span([h.Class(`${statusClass} text-dt-accent`)], [
|
|
1333
1415
|
model.selectedIndex === INIT_INDEX
|
|
1334
1416
|
? 'Inspecting (init)'
|
|
@@ -1338,19 +1420,17 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
1338
1420
|
h.Class(actionButtonClass),
|
|
1339
1421
|
h.OnClick(Message.ClickedFollowLatest()),
|
|
1340
1422
|
], ['Follow Latest →'])),
|
|
1341
|
-
}), "@foldkit/devtools/overlay.js#anonymous~
|
|
1342
|
-
const
|
|
1343
|
-
return __foldkitBrandViewResult((h.header([h.Class(headerClass)], [
|
|
1344
|
-
status,
|
|
1345
|
-
...Option.toArray(maybeAction),
|
|
1346
|
-
...Option.toArray(maybeClearHistoryButton),
|
|
1347
|
-
])), "@foldkit/devtools/overlay.js#headerView");
|
|
1423
|
+
}), "@foldkit/devtools/overlay.js#anonymous~96"))), Match.exhaustive);
|
|
1424
|
+
const clearHistoryButtons = Array.filter([clearHistoryButton()], () => __foldkitBrandViewResult((!model.isPaused), "@foldkit/devtools/overlay.js#anonymous~97"));
|
|
1425
|
+
return __foldkitBrandViewResult((h.header([h.Class(headerClass)], [status, ...Option.toArray(maybeAction), ...clearHistoryButtons])), "@foldkit/devtools/overlay.js#headerView");
|
|
1348
1426
|
};
|
|
1349
1427
|
const initRowView = (isSelected, isPausedHere) => __foldkitBrandViewResult((h.keyed('li')('init', [
|
|
1350
1428
|
h.Class(clsx(ROW_BASE, { selected: isSelected })),
|
|
1351
1429
|
h.OnClick(Message.ClickedRow({ index: INIT_INDEX })),
|
|
1352
1430
|
], [
|
|
1353
|
-
...
|
|
1431
|
+
...Array.filter([
|
|
1432
|
+
h.span([h.Class('pause-column')], isPausedHere ? [pauseIconView] : []),
|
|
1433
|
+
], () => __foldkitBrandViewResult((mode === 'TimeTravel'), "@foldkit/devtools/overlay.js#anonymous~98")),
|
|
1354
1434
|
h.span([h.Class('dot-column')]),
|
|
1355
1435
|
h.span([h.Class(indexClass)]),
|
|
1356
1436
|
h.span([h.Class('text-base text-dt-muted font-mono')], ['init']),
|
|
@@ -1374,7 +1454,9 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
1374
1454
|
h.Class(clsx(ROW_BASE, { selected: isSelected })),
|
|
1375
1455
|
h.OnClick(Message.ClickedRow({ index: absoluteIndex })),
|
|
1376
1456
|
], [
|
|
1377
|
-
...
|
|
1457
|
+
...Array.filter([
|
|
1458
|
+
h.span([h.Class('pause-column')], isPausedHere ? [pauseIconView] : []),
|
|
1459
|
+
], () => __foldkitBrandViewResult((mode === 'TimeTravel'), "@foldkit/devtools/overlay.js#anonymous~99")),
|
|
1378
1460
|
h.span([h.Class('dot-column')], isModelChanged ? [inlineDiffDotView] : []),
|
|
1379
1461
|
h.span([h.Class(indexClass)], [globalThis.String(absoluteIndex + 1)]),
|
|
1380
1462
|
h.span([h.Class('text-base text-dt font-mono flex-1 truncate')], [tag]),
|
|
@@ -1389,7 +1471,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
1389
1471
|
}));
|
|
1390
1472
|
const isInitSelected = selectedIndex === INIT_INDEX;
|
|
1391
1473
|
const isFiltered = Option.isSome(maybeFilterTag);
|
|
1392
|
-
const leafOrTag = (entry) => __foldkitBrandViewResult((Option.getOrElse(entry.maybeLeafTag, () => __foldkitBrandViewResult((entry.tag), "@foldkit/devtools/overlay.js#anonymous~
|
|
1474
|
+
const leafOrTag = (entry) => __foldkitBrandViewResult((Option.getOrElse(entry.maybeLeafTag, () => __foldkitBrandViewResult((entry.tag), "@foldkit/devtools/overlay.js#anonymous~100"))), "@foldkit/devtools/overlay.js#leafOrTag");
|
|
1393
1475
|
const displayTagFor = (entry) => {
|
|
1394
1476
|
if (isFlattened) {
|
|
1395
1477
|
return __foldkitBrandViewResult((leafOrTag(entry)), "@foldkit/devtools/overlay.js#displayTagFor");
|
|
@@ -1397,15 +1479,15 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
1397
1479
|
else {
|
|
1398
1480
|
return __foldkitBrandViewResult((Option.match(maybeFilterTag, {
|
|
1399
1481
|
onNone: () => __foldkitBrandViewResult((entry.tag), "@foldkit/devtools/overlay.js#onNone~10"),
|
|
1400
|
-
onSome: filterTag => __foldkitBrandViewResult((pipe(entry.
|
|
1482
|
+
onSome: filterTag => __foldkitBrandViewResult((pipe(entry.blockPath, Array.findFirstIndex(pathTag => __foldkitBrandViewResult((pathTag === filterTag), "@foldkit/devtools/overlay.js#anonymous~101")), Option.flatMap(filterIndex => __foldkitBrandViewResult((Array.get(entry.blockPath, Number.increment(filterIndex))), "@foldkit/devtools/overlay.js#anonymous~102")), Option.orElse(() => __foldkitBrandViewResult((entry.maybeLeafTag), "@foldkit/devtools/overlay.js#anonymous~103")), Option.getOrElse(() => __foldkitBrandViewResult((entry.tag), "@foldkit/devtools/overlay.js#anonymous~104")))), "@foldkit/devtools/overlay.js#onSome~9"),
|
|
1401
1483
|
})), "@foldkit/devtools/overlay.js#displayTagFor");
|
|
1402
1484
|
}
|
|
1403
1485
|
};
|
|
1404
1486
|
const indexedEntries = pipe(entries, Array.map((entry, arrayIndex) => (__foldkitBrandViewResult(({
|
|
1405
1487
|
entry,
|
|
1406
1488
|
absoluteIndex: startIndex + arrayIndex,
|
|
1407
|
-
}), "@foldkit/devtools/overlay.js#anonymous~
|
|
1408
|
-
? Array.filter(({ entry }) => __foldkitBrandViewResult((Array.contains(entry.
|
|
1489
|
+
}), "@foldkit/devtools/overlay.js#anonymous~105"))), isFiltered
|
|
1490
|
+
? Array.filter(({ entry }) => __foldkitBrandViewResult((Array.contains(entry.blockPath, maybeFilterTag.value)), "@foldkit/devtools/overlay.js#anonymous~106"))
|
|
1409
1491
|
: Function.identity);
|
|
1410
1492
|
const messageRows = pipe(indexedEntries, Array.map(({ entry, absoluteIndex }) => {
|
|
1411
1493
|
const isSelected = selectedIndex === absoluteIndex;
|
|
@@ -1418,11 +1500,11 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
1418
1500
|
isPausedHere,
|
|
1419
1501
|
entry.timestamp - baseTimestamp,
|
|
1420
1502
|
entry.isModelChanged,
|
|
1421
|
-
])), "@foldkit/devtools/overlay.js#anonymous~
|
|
1503
|
+
])), "@foldkit/devtools/overlay.js#anonymous~107");
|
|
1422
1504
|
}), Array.reverse);
|
|
1423
1505
|
return __foldkitBrandViewResult((h.ul([
|
|
1424
1506
|
h.Class('message-list flex-1 overflow-y-auto min-h-0 overscroll-none'),
|
|
1425
|
-
h.OnScroll(scrollTop => __foldkitBrandViewResult((Message.ScrolledMessageList({ scrollTop })), "@foldkit/devtools/overlay.js#anonymous~
|
|
1507
|
+
h.OnScroll(scrollTop => __foldkitBrandViewResult((Message.ScrolledMessageList({ scrollTop })), "@foldkit/devtools/overlay.js#anonymous~108")),
|
|
1426
1508
|
], isFiltered
|
|
1427
1509
|
? messageRows
|
|
1428
1510
|
: [
|
|
@@ -1438,7 +1520,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
1438
1520
|
selectedIndex,
|
|
1439
1521
|
model.isPaused,
|
|
1440
1522
|
model.pausedAtIndex,
|
|
1441
|
-
model.
|
|
1523
|
+
model.maybeBlockFilter,
|
|
1442
1524
|
model.isFlattened,
|
|
1443
1525
|
])), "@foldkit/devtools/overlay.js#messageListView");
|
|
1444
1526
|
};
|
|
@@ -1448,10 +1530,9 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
1448
1530
|
const current = globalThis.String(model.scrubberValue).padStart(3, '0');
|
|
1449
1531
|
return __foldkitBrandViewResult((`${current} / ${total}`), "@foldkit/devtools/overlay.js#scrubberPositionLabel");
|
|
1450
1532
|
};
|
|
1451
|
-
const scrubberView = (model) => __foldkitBrandViewResult((h.
|
|
1533
|
+
const scrubberView = (model) => __foldkitBrandViewResult((h.block(bindings.ScrubberBinding.embedView({
|
|
1452
1534
|
slotId: model.scrubberSlider.id,
|
|
1453
1535
|
model: model.scrubberSlider,
|
|
1454
|
-
view: Slider.view,
|
|
1455
1536
|
viewInputs: {
|
|
1456
1537
|
value: model.scrubberValue,
|
|
1457
1538
|
ariaLabel: 'Session scrubber',
|
|
@@ -1478,8 +1559,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
1478
1559
|
], [scrubberPositionLabel(model)]),
|
|
1479
1560
|
])), "@foldkit/devtools/overlay.js#toView~3"),
|
|
1480
1561
|
},
|
|
1481
|
-
|
|
1482
|
-
})), "@foldkit/devtools/overlay.js#scrubberView");
|
|
1562
|
+
}))), "@foldkit/devtools/overlay.js#scrubberView");
|
|
1483
1563
|
// FOOTER
|
|
1484
1564
|
const isScrubberVisible = mode === 'TimeTravel';
|
|
1485
1565
|
const GEAR_OUTER = 'M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z';
|
|
@@ -1535,38 +1615,38 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
|
|
|
1535
1615
|
h.Class('dt-footer flex items-center gap-3 px-3 py-2 border-t shrink-0'),
|
|
1536
1616
|
], [
|
|
1537
1617
|
settingsToggleView(model.screen),
|
|
1538
|
-
...
|
|
1618
|
+
...Array.filter([scrubberView(model)], () => __foldkitBrandViewResult((isScrubberVisible), "@foldkit/devtools/overlay.js#anonymous~109")),
|
|
1539
1619
|
])), "@foldkit/devtools/overlay.js#footerView");
|
|
1540
1620
|
// PANEL
|
|
1541
1621
|
const messagesScreenView = (model) => {
|
|
1542
|
-
const
|
|
1543
|
-
const
|
|
1622
|
+
const blockFilterViews = Array.filter([blockFilterView(model)], () => __foldkitBrandViewResult((Array.isReadonlyArrayNonEmpty(model.blockTags)), "@foldkit/devtools/overlay.js#anonymous~110"));
|
|
1623
|
+
const scrollToTopPillViews = Array.filter([scrollToTopPillView()], () => __foldkitBrandViewResult((!model.isFollowingTop), "@foldkit/devtools/overlay.js#anonymous~111"));
|
|
1544
1624
|
return __foldkitBrandViewResult((h.div([h.Class('flex flex-1 min-h-0 dt-content')], [
|
|
1545
1625
|
h.div([h.Class('flex flex-col min-h-0 dt-message-pane')], [
|
|
1546
|
-
...
|
|
1547
|
-
...
|
|
1626
|
+
...blockFilterViews,
|
|
1627
|
+
...scrollToTopPillViews,
|
|
1548
1628
|
messageListView(model),
|
|
1549
1629
|
]),
|
|
1550
1630
|
inspectorPaneView(model),
|
|
1551
1631
|
])), "@foldkit/devtools/overlay.js#messagesScreenView");
|
|
1552
1632
|
};
|
|
1553
|
-
const contentView = (model) => __foldkitBrandViewResult((Match.value(model.screen).pipe(Match.withReturnType(), Match.when('Messages', () => __foldkitBrandViewResult((messagesScreenView(model)), "@foldkit/devtools/overlay.js#anonymous~
|
|
1633
|
+
const contentView = (model) => __foldkitBrandViewResult((Match.value(model.screen).pipe(Match.withReturnType(), Match.when('Messages', () => __foldkitBrandViewResult((messagesScreenView(model)), "@foldkit/devtools/overlay.js#anonymous~112")), Match.when('Settings', () => __foldkitBrandViewResult((settingsScreenView(model)), "@foldkit/devtools/overlay.js#anonymous~113")), Match.exhaustive)), "@foldkit/devtools/overlay.js#contentView");
|
|
1554
1634
|
const panelView = (model) => __foldkitBrandViewResult((h.div([
|
|
1555
1635
|
h.Class(clsx('fixed dt-panel dt-panel-wide bg-dt-bg border rounded-lg flex flex-col overflow-hidden font-mono text-dt', PANEL_POSITION_CLASS[position])),
|
|
1556
1636
|
], [
|
|
1557
1637
|
...Option.map(maybeBanner, banner => __foldkitBrandViewResult((h.div([
|
|
1558
1638
|
h.Class('px-3 py-2 border-b text-sm text-dt-muted font-mono shrink-0 leading-snug'),
|
|
1559
|
-
], [banner])), "@foldkit/devtools/overlay.js#anonymous~
|
|
1639
|
+
], [banner])), "@foldkit/devtools/overlay.js#anonymous~114")).pipe(Option.toArray),
|
|
1560
1640
|
headerView(model),
|
|
1561
1641
|
contentView(model),
|
|
1562
1642
|
footerView(model),
|
|
1563
1643
|
])), "@foldkit/devtools/overlay.js#panelView");
|
|
1564
1644
|
const interactionBlocker = () => __foldkitBrandViewResult((h.div([h.Class('dt-interaction-blocker')])), "@foldkit/devtools/overlay.js#interactionBlocker");
|
|
1565
|
-
return __foldkitBrandViewResult((
|
|
1566
|
-
...
|
|
1567
|
-
...
|
|
1645
|
+
return __foldkitBrandViewResult((model => __foldkitBrandViewResult((h.div([], [
|
|
1646
|
+
...Array.filter([interactionBlocker()], () => __foldkitBrandViewResult((model.isPaused && mode === 'TimeTravel'), "@foldkit/devtools/overlay.js#anonymous~116")),
|
|
1647
|
+
...Array.filter([panelView(model)], () => __foldkitBrandViewResult((model.isOpen), "@foldkit/devtools/overlay.js#anonymous~117")),
|
|
1568
1648
|
badgeView(model),
|
|
1569
|
-
])), "@foldkit/devtools/overlay.js#anonymous~
|
|
1649
|
+
])), "@foldkit/devtools/overlay.js#anonymous~115")), "@foldkit/devtools/overlay.js#buildOverlayView");
|
|
1570
1650
|
};
|
|
1571
1651
|
// CREATE
|
|
1572
1652
|
const VIEW_TRANSITION_NAME = 'foldkit-devtools';
|
|
@@ -1647,72 +1727,34 @@ const createShadowContainer = () => {
|
|
|
1647
1727
|
return __foldkitBrandViewResult(({ container, shadow }), "@foldkit/devtools/overlay.js#createShadowContainer");
|
|
1648
1728
|
};
|
|
1649
1729
|
export const createOverlay = (store, position, mode, maybeBanner) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
1650
|
-
const { container, shadow } = yield* Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((createShadowContainer()), "@foldkit/devtools/overlay.js#anonymous~
|
|
1730
|
+
const { container, shadow } = yield* Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((createShadowContainer()), "@foldkit/devtools/overlay.js#anonymous~120")), createdShadowContainer => __foldkitBrandViewResult((Effect.sync(() => {
|
|
1651
1731
|
createdShadowContainer.shadow.host.remove();
|
|
1652
1732
|
document.getElementById(VIEW_TRANSITION_STYLE_ID)?.remove();
|
|
1653
|
-
})), "@foldkit/devtools/overlay.js#anonymous~
|
|
1733
|
+
})), "@foldkit/devtools/overlay.js#anonymous~121"));
|
|
1654
1734
|
container.id = '__foldkit_devtools_overlay__';
|
|
1735
|
+
const ServicesLayer = Layer.mergeAll(Layer.succeed(StoreService, store), Layer.succeed(ShadowRootService, shadow), BrowserKeyValueStore.layerLocalStorage);
|
|
1655
1736
|
const flags = Effect.gen(function* () {
|
|
1737
|
+
const store = yield* StoreService;
|
|
1656
1738
|
const storeState = yield* SubscriptionRef.get(store.stateRef);
|
|
1657
1739
|
const { isOpen, isFlattened } = yield* readPersistedState;
|
|
1658
1740
|
return __foldkitBrandViewResult(({
|
|
1741
|
+
position,
|
|
1742
|
+
mode,
|
|
1743
|
+
maybeBanner,
|
|
1659
1744
|
isOpen,
|
|
1660
1745
|
isMobile: window.matchMedia(MOBILE_BREAKPOINT_QUERY).matches,
|
|
1661
1746
|
isFlattened,
|
|
1662
1747
|
...toDisplayState(storeState),
|
|
1663
|
-
}), "@foldkit/devtools/overlay.js#anonymous~
|
|
1748
|
+
}), "@foldkit/devtools/overlay.js#anonymous~123");
|
|
1664
1749
|
});
|
|
1665
|
-
const
|
|
1666
|
-
|
|
1667
|
-
const sliderMax = flags.entries.length;
|
|
1668
|
-
const initialSliderValue = flags.isPaused
|
|
1669
|
-
? hostIndexToSliderValue(flags.pausedAtIndex, flags.startIndex)
|
|
1670
|
-
: sliderMax;
|
|
1671
|
-
return __foldkitBrandViewResult(({
|
|
1672
|
-
model: {
|
|
1673
|
-
screen: 'Messages',
|
|
1674
|
-
...displayFlags,
|
|
1675
|
-
isFlattened,
|
|
1676
|
-
selectedIndex: INIT_INDEX,
|
|
1677
|
-
isFollowingLatest: true,
|
|
1678
|
-
isFollowingTop: true,
|
|
1679
|
-
submodelTags: computeSubmodelTags(flags.entries),
|
|
1680
|
-
maybeSubmodelFilter: Option.none(),
|
|
1681
|
-
submodelFilterListbox: Listbox.init({
|
|
1682
|
-
id: SUBMODEL_FILTER_ID,
|
|
1683
|
-
}),
|
|
1684
|
-
maybeInspectedModel: Option.none(),
|
|
1685
|
-
maybeInspectedMessage: Option.none(),
|
|
1686
|
-
expandedPaths: HashSet.empty(),
|
|
1687
|
-
changedPaths: HashSet.empty(),
|
|
1688
|
-
affectedPaths: HashSet.empty(),
|
|
1689
|
-
copyStates: HashMap.empty(),
|
|
1690
|
-
nextCopyRequestId: 0,
|
|
1691
|
-
maybePendingScrubIndex: Option.none(),
|
|
1692
|
-
inspectorTabs: Tabs.init({ id: INSPECTOR_TABS_ID }),
|
|
1693
|
-
activeInspectorTab: 'Model',
|
|
1694
|
-
scrubberSlider: Slider.init({
|
|
1695
|
-
id: SCRUBBER_SLIDER_ID,
|
|
1696
|
-
min: 0,
|
|
1697
|
-
max: sliderMax,
|
|
1698
|
-
step: 1,
|
|
1699
|
-
}),
|
|
1700
|
-
scrubberValue: Slider.snapAndClamp(initialSliderValue, 0, sliderMax, 1),
|
|
1701
|
-
},
|
|
1702
|
-
commands: Option.toArray(maybeLockScroll(flags.isOpen, flags.isMobile)),
|
|
1703
|
-
}), "@foldkit/devtools/overlay.js#init");
|
|
1704
|
-
};
|
|
1705
|
-
const overlayRuntime = makeElement({
|
|
1706
|
-
Model,
|
|
1750
|
+
const program = Program.makeElement({
|
|
1751
|
+
block: ApplicationBlock,
|
|
1707
1752
|
Flags,
|
|
1708
1753
|
flags,
|
|
1709
|
-
init,
|
|
1710
|
-
update: makeUpdate(store, shadow, mode),
|
|
1711
|
-
view: makeView(position, mode, shadow, maybeBanner),
|
|
1712
1754
|
container,
|
|
1713
|
-
subscriptions: makeOverlaySubscriptions(store, shadow),
|
|
1714
1755
|
devTools: false,
|
|
1715
1756
|
freezeModel: false,
|
|
1716
1757
|
});
|
|
1717
|
-
|
|
1758
|
+
const overlay = program.provide(ServicesLayer);
|
|
1759
|
+
yield* Effect.forkScoped(overlay.start());
|
|
1718
1760
|
})), "@foldkit/devtools/overlay.js#createOverlay");
|