@foldkit/devtools 0.169.0-canary.82ac2ec6c9b5 → 0.169.0-canary.af4b0bc7b683

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