@foldkit/devtools 0.170.0-canary.54f8bcd443b4 → 0.170.0-canary.7dfe32f9d0cd

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,24 +1,31 @@
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, 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
- import { Listbox, Slider, Switch, Tabs } from '@foldkit/ui';
17
+ import * as Listbox from '@foldkit/ui/listbox';
18
+ import * as Slider from '@foldkit/ui/slider';
19
+ import * as Switch from '@foldkit/ui/switch';
20
+ import * as Tabs from '@foldkit/ui/tabs';
15
21
  import * as OptionExt from './internal/optionExtensions.js';
16
22
  import { overlayStyles } from './overlay-styles.js';
17
- const BlockFilterListboxBlock = Listbox.makeBlock();
23
+ const SubmodelFilterListbox = Listbox.create();
24
+ // MODEL
18
25
  const DisplayCommand = Schema.Struct({
19
26
  name: Schema.String,
20
27
  args: Schema.Option(Schema.Record(Schema.String, Schema.Unknown)),
21
- maybeBlockPath: Schema.Option(Schema.Array(Schema.String)),
28
+ maybeSubmodelPath: Schema.Option(Schema.Array(Schema.String)),
22
29
  });
23
30
  const DisplayMount = Schema.Struct({
24
31
  name: Schema.String,
@@ -26,7 +33,7 @@ const DisplayMount = Schema.Struct({
26
33
  });
27
34
  const DisplayEntry = Schema.Struct({
28
35
  tag: Schema.String,
29
- blockPath: Schema.Array(Schema.String),
36
+ submodelPath: Schema.Array(Schema.String),
30
37
  maybeLeafTag: Schema.Option(Schema.String),
31
38
  commands: Schema.Array(DisplayCommand),
32
39
  mountStarts: Schema.Array(DisplayMount),
@@ -39,12 +46,12 @@ const CopyState = defineTaggedUnion({
39
46
  Copied: { requestId: Schema.Number },
40
47
  });
41
48
  const INSPECTOR_TABS_ID = 'dt-inspector';
42
- const BLOCK_FILTER_ID = 'dt-block-filter';
49
+ const SUBMODEL_FILTER_ID = 'dt-submodel-filter';
43
50
  const FLATTEN_SWITCH_ID = 'dt-flatten-switch';
44
51
  const SCRUBBER_SLIDER_ID = 'dt-scrubber';
45
52
  const InspectorTab = Schema.Literals(['Model', 'Message', 'Commands', 'Mounts']);
46
53
  const INSPECTOR_TABS = InspectorTab.literals;
47
- const InspectorTabsBlock = Tabs.makeBlock();
54
+ const InspectorTabs = Tabs.create();
48
55
  /**
49
56
  * `Schema.Unknown` whose equivalence is reference equality. Effect 4's default
50
57
  * equivalence for `Schema.Unknown` is `Equal.equals`, which walks the value
@@ -58,17 +65,7 @@ const InspectorTabsBlock = Tabs.makeBlock();
58
65
  */
59
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")));
60
67
  const Screen = Schema.Literals(['Messages', 'Settings']);
61
- const Position = Schema.Literals([
62
- 'BottomRight',
63
- 'BottomLeft',
64
- 'TopRight',
65
- 'TopLeft',
66
- ]);
67
- const Mode = Schema.Literals(['TimeTravel', 'Inspect']);
68
68
  const Model = Schema.Struct({
69
- position: Position,
70
- mode: Mode,
71
- maybeBanner: Schema.Option(Schema.String),
72
69
  isOpen: Schema.Boolean,
73
70
  isMobile: Schema.Boolean,
74
71
  screen: Screen,
@@ -83,33 +80,30 @@ const Model = Schema.Struct({
83
80
  isFollowingTop: Schema.Boolean,
84
81
  maybeInspectedModel: Schema.Option(UnknownByReference),
85
82
  maybeInspectedMessage: Schema.Option(UnknownByReference),
86
- blockTags: Schema.Array(Schema.String),
87
- maybeBlockFilter: Schema.Option(Schema.String),
83
+ submodelTags: Schema.Array(Schema.String),
84
+ maybeSubmodelFilter: Schema.Option(Schema.String),
88
85
  isFlattened: Schema.Boolean,
89
- blockFilterListbox: BlockFilterListboxBlock.Model,
86
+ submodelFilterListbox: Listbox.Model,
90
87
  expandedPaths: Schema.HashSet(Schema.String),
91
88
  changedPaths: Schema.HashSet(Schema.String),
92
89
  affectedPaths: Schema.HashSet(Schema.String),
93
90
  copyStates: Schema.HashMap(Schema.String, CopyState),
94
91
  nextCopyRequestId: Schema.Number,
95
92
  maybePendingScrubIndex: Schema.Option(Schema.Number),
96
- inspectorTabs: InspectorTabsBlock.Model,
93
+ inspectorTabs: Tabs.Model,
97
94
  activeInspectorTab: InspectorTab,
98
- // NOTE: empirically, inlining `Slider.SliderBlock.Model` here throws
95
+ // NOTE: empirically, inlining `Slider.Model` here throws
99
96
  // "Cannot read properties of undefined (reading 'ast')" when running slider
100
97
  // tests, because slider imports html → runtime → overlay, and overlay
101
- // references Slider.SliderBlock.Model mid-cycle. Schema.suspend defers the read until after
102
- // 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
103
100
  // through the same import chain; the exact cause of the asymmetry isn't
104
101
  // pinned down. Suspend is the conservative fix until the runtime ↔ overlay
105
102
  // cycle is broken at the source.
106
- 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")),
107
104
  scrubberValue: Schema.Number,
108
105
  });
109
106
  const Flags = Schema.Struct({
110
- position: Position,
111
- mode: Mode,
112
- maybeBanner: Schema.Option(Schema.String),
113
107
  isOpen: Schema.Boolean,
114
108
  isMobile: Schema.Boolean,
115
109
  isFlattened: Schema.Boolean,
@@ -120,6 +114,8 @@ const Flags = Schema.Struct({
120
114
  isPaused: Schema.Boolean,
121
115
  pausedAtIndex: Schema.Number,
122
116
  });
117
+ // MESSAGE
118
+ // NOTE: suspend for the same init-order reason as scrubberSlider above.
123
119
  const Message = defineMessageUnion({
124
120
  ClickedToggle: {},
125
121
  ClickedSettingsToggle: {},
@@ -158,6 +154,7 @@ const Message = defineMessageUnion({
158
154
  requestId: Schema.Number,
159
155
  },
160
156
  TickedScrubFrame: {},
157
+ GotInspectorTabsMessage: { message: Tabs.Message },
161
158
  ReceivedStoreUpdate: {
162
159
  entries: Schema.Array(DisplayEntry),
163
160
  initCommands: Schema.Array(DisplayCommand),
@@ -166,7 +163,12 @@ const Message = defineMessageUnion({
166
163
  isPaused: Schema.Boolean,
167
164
  pausedAtIndex: Schema.Number,
168
165
  },
166
+ GotSubmodelFilterMessage: { message: Listbox.Message },
167
+ GotScrubberSliderMessage: {
168
+ message: Schema.suspend(() => __foldkitBrandViewResult((Slider.Message), "@foldkit/devtools/overlay.js#anonymous~4")),
169
+ },
169
170
  });
171
+ // HELPERS
170
172
  const MILLIS_PER_SECOND = 1000;
171
173
  const MOBILE_BREAKPOINT = 767;
172
174
  const MOBILE_BREAKPOINT_QUERY = `(max-width: ${MOBILE_BREAKPOINT}px)`;
@@ -177,7 +179,7 @@ const ALL_MESSAGES_VALUE = '';
177
179
  const DEVTOOLS_STORAGE_KEY = 'foldkit-devtools';
178
180
  const NO_COMMANDS = [];
179
181
  const NO_MOUNTS = [];
180
- 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");
181
183
  const MESSAGE_LIST_SELECTOR = '.message-list';
182
184
  // NOTE: scrubber slider value space is independent of the store's host
183
185
  // indices. Slider value 0 represents init; 1..entries.length represents
@@ -188,30 +190,30 @@ const MESSAGE_LIST_SELECTOR = '.message-list';
188
190
  const hostIndexToSliderValue = (hostIndex, startIndex) => (__foldkitBrandViewResult((hostIndex === INIT_INDEX ? 0 : hostIndex - startIndex + 1), "@foldkit/devtools/overlay.js#hostIndexToSliderValue"));
189
191
  const sliderValueToHostIndex = (sliderValue, startIndex) => (__foldkitBrandViewResult((sliderValue === 0 ? INIT_INDEX : startIndex + sliderValue - 1), "@foldkit/devtools/overlay.js#sliderValueToHostIndex"));
190
192
  const SCROLL_FOLLOW_THRESHOLD_PX = 8;
191
- 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");
192
- const blockSegmentLabel = (tag) => __foldkitBrandViewResult((pipe(tag, String.replace(/^Got/, ''), String.replace(/Message$/, ''))), "@foldkit/devtools/overlay.js#blockSegmentLabel");
193
- 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");
194
196
  const toDisplayCommand = (command) => (__foldkitBrandViewResult(({
195
197
  name: command.name,
196
198
  args: Option.fromNullishOr(command.args),
197
- maybeBlockPath: command.maybeBlockPath,
199
+ maybeSubmodelPath: command.maybeSubmodelPath,
198
200
  }), "@foldkit/devtools/overlay.js#toDisplayCommand"));
199
201
  const toDisplayMount = (mount) => (__foldkitBrandViewResult(({
200
202
  name: mount.name,
201
203
  args: Option.fromNullishOr(mount.args),
202
204
  }), "@foldkit/devtools/overlay.js#toDisplayMount"));
203
205
  const toDisplayEntries = ({ entries }) => __foldkitBrandViewResult((Array.map(entries, entry => {
204
- const { blockPath, maybeLeafTag } = extractBlockInfo(entry.tag, entry.message);
206
+ const { submodelPath, maybeLeafTag } = extractSubmodelInfo(entry.tag, entry.message);
205
207
  return __foldkitBrandViewResult(({
206
208
  tag: entry.tag,
207
- blockPath,
209
+ submodelPath,
208
210
  maybeLeafTag,
209
211
  commands: Array.map(entry.commands, toDisplayCommand),
210
212
  mountStarts: Array.map(entry.mountStarts, toDisplayMount),
211
213
  mountEnds: Array.map(entry.mountEnds, toDisplayMount),
212
214
  timestamp: entry.timestamp,
213
215
  isModelChanged: entry.isModelChanged,
214
- }), "@foldkit/devtools/overlay.js#anonymous~8");
216
+ }), "@foldkit/devtools/overlay.js#anonymous~9");
215
217
  })), "@foldkit/devtools/overlay.js#toDisplayEntries");
216
218
  const toDisplayState = (state) => (__foldkitBrandViewResult(({
217
219
  entries: toDisplayEntries(state),
@@ -222,7 +224,7 @@ const toDisplayState = (state) => (__foldkitBrandViewResult(({
222
224
  pausedAtIndex: state.pausedAtIndex,
223
225
  }), "@foldkit/devtools/overlay.js#toDisplayState"));
224
226
  const isExpandable = Predicate.isObjectOrArray;
225
- 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({
226
228
  onEmpty: () => __foldkitBrandViewResult(('{}'), "@foldkit/devtools/overlay.js#onEmpty"),
227
229
  onNonEmpty: keys => {
228
230
  const preview = pipe(keys, Array.take(MAX_PREVIEW_KEYS), Array.join(', '));
@@ -231,7 +233,7 @@ const objectPreview = (value) => __foldkitBrandViewResult((pipe(value, Record.ke
231
233
  : `{ ${preview} }`), "@foldkit/devtools/overlay.js#onNonEmpty");
232
234
  },
233
235
  }))), "@foldkit/devtools/overlay.js#objectPreview");
234
- 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");
235
237
  const serializePayload = (value) => __foldkitBrandViewResult((Effect.try({
236
238
  try: () => {
237
239
  const serialized = JSON.stringify(toInspectableValue(value), null, JSON_INDENT);
@@ -246,131 +248,66 @@ const taggedPayload = (name, args) => __foldkitBrandViewResult((Option.match(arg
246
248
  onNone: () => (__foldkitBrandViewResult(({ _tag: name }), "@foldkit/devtools/overlay.js#onNone")),
247
249
  onSome: argsValue => (__foldkitBrandViewResult(({ ...argsValue, _tag: name }), "@foldkit/devtools/overlay.js#onSome")),
248
250
  })), "@foldkit/devtools/overlay.js#taggedPayload");
249
- class StoreService extends Context.Service()('foldkit/DevToolsStore') {
250
- }
251
- class ShadowRootService extends Context.Service()('foldkit/DevToolsShadowRoot') {
252
- }
253
- const ApplicationKey = Symbol('Application');
254
- const ApplicationDefinition = Block.makeDefinition('Application', {
255
- key: ApplicationKey,
256
- InitArgs: Schema.Tuple([Flags]),
257
- view: { kind: 'Element' },
258
- effects: {
259
- services: [StoreService, ShadowRootService, KeyValueStore.KeyValueStore],
260
- },
261
- Model,
262
- Message,
263
- 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"),
264
255
  });
265
- const InspectorTabsBinding = ApplicationDefinition.makeRequiredFieldBinding(InspectorTabsBlock, {
266
- field: 'inspectorTabs',
267
- init: { contextToArgs: () => __foldkitBrandViewResult(([{ id: INSPECTOR_TABS_ID }]), "@foldkit/devtools/overlay.js#contextToArgs") },
268
- }).withOutMessagePolicy({
269
- fold: ApplicationDefinition.makeOutMessageFold(InspectorTabsBlock, {
270
- Selected: ({ value }) => __foldkitBrandViewResult((ApplicationDefinition.makeFieldsStep(() => (__foldkitBrandViewResult(({
271
- activeInspectorTab: () => __foldkitBrandViewResult((value), "@foldkit/devtools/overlay.js#activeInspectorTab"),
272
- }), "@foldkit/devtools/overlay.js#anonymous~12")))), "@foldkit/devtools/overlay.js#Selected"),
273
- }),
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,
274
262
  });
275
- const BlockFilterListboxBinding = ApplicationDefinition.makeRequiredFieldBinding(BlockFilterListboxBlock, {
276
- field: 'blockFilterListbox',
277
- init: { contextToArgs: () => __foldkitBrandViewResult(([{ id: BLOCK_FILTER_ID }]), "@foldkit/devtools/overlay.js#contextToArgs~2") },
278
- }).withOutMessagePolicy({
279
- fold: ApplicationDefinition.makeOutMessageFold(BlockFilterListboxBlock, {
280
- Selected: ({ value }) => __foldkitBrandViewResult((ApplicationDefinition.makeFieldsStep(() => (__foldkitBrandViewResult(({
281
- maybeBlockFilter: () => __foldkitBrandViewResult((Option.liftPredicate(value, String.isNonEmpty)), "@foldkit/devtools/overlay.js#maybeBlockFilter"),
282
- }), "@foldkit/devtools/overlay.js#anonymous~13")))), "@foldkit/devtools/overlay.js#Selected~2"),
283
- }),
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"),
284
269
  });
285
- const makeApplicationComposition = (scrubberSliderBlock) => {
286
- // NOTE: Pointer Messages update the thumb immediately, but jumping to and
287
- // inspecting the corresponding state is expensive. Keep only the latest host
288
- // index until TickedScrubFrame flushes one navigation on the next frame.
289
- const ScrubberSliderBinding = ApplicationDefinition.makeRequiredFieldBinding(scrubberSliderBlock, {
290
- field: 'scrubberSlider',
291
- init: {
292
- contextToArgs: flags => __foldkitBrandViewResult(([
293
- {
294
- id: SCRUBBER_SLIDER_ID,
295
- min: 0,
296
- max: flags.entries.length,
297
- step: 1,
298
- },
299
- ]), "@foldkit/devtools/overlay.js#contextToArgs~3"),
300
- },
301
- }).withOutMessagePolicy({
302
- fold: ApplicationDefinition.makeOutMessageFold(scrubberSliderBlock, {
303
- ChangedValue: ({ value }) => __foldkitBrandViewResult((ApplicationDefinition.makeFieldsStep(model => (__foldkitBrandViewResult(({
304
- scrubberValue: () => __foldkitBrandViewResult((value), "@foldkit/devtools/overlay.js#scrubberValue"),
305
- maybePendingScrubIndex: () => __foldkitBrandViewResult((Option.some(sliderValueToHostIndex(value, model.startIndex))), "@foldkit/devtools/overlay.js#maybePendingScrubIndex"),
306
- }), "@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"),
307
287
  }),
308
- });
309
- const bindings = {
310
- InspectorTabsBinding,
311
- BlockFilterListboxBinding,
312
- ScrubberSliderBinding,
313
- };
314
- const ApplicationComposition = ApplicationDefinition.makeComposition({
315
- bindings: [
316
- InspectorTabsBinding,
317
- BlockFilterListboxBinding,
318
- ScrubberSliderBinding,
319
- ],
320
- });
321
- return __foldkitBrandViewResult(({ bindings, ApplicationComposition }), "@foldkit/devtools/overlay.js#makeApplicationComposition");
322
- };
323
- const getDevToolsShadowRoot = () => {
324
- const shadow = document.getElementById(DEVTOOLS_HOST_ID)?.shadowRoot;
325
- if (shadow === null || shadow === undefined) {
326
- throw new Error('Expected the DevTools shadow root to exist');
327
- }
328
- return __foldkitBrandViewResult((shadow), "@foldkit/devtools/overlay.js#getDevToolsShadowRoot");
329
- };
330
- const scrubberSliderBlock = Slider.forRoot(getDevToolsShadowRoot);
331
- const { bindings, ApplicationComposition } = makeApplicationComposition(scrubberSliderBlock);
332
- const subscriptions = ApplicationDefinition.makeSubscriptions(entry => (__foldkitBrandViewResult(({
333
- scrubFrameTicks: entry('ScrubFrameTicks', { isActive: Schema.Boolean }, {
334
- messages: [Message.TickedScrubFrame],
335
- modelToDependencies: model => (__foldkitBrandViewResult(({
336
- isActive: Option.isSome(model.maybePendingScrubIndex),
337
- }), "@foldkit/devtools/overlay.js#modelToDependencies")),
338
- handler: function* () {
339
- return __foldkitBrandViewResult((({ isActive }) => __foldkitBrandViewResult((isActive
340
- ? Dom.animationFrameTicks.pipe(Stream.map(() => __foldkitBrandViewResult((Message.TickedScrubFrame()), "@foldkit/devtools/overlay.js#anonymous~17")))
341
- : Stream.empty), "@foldkit/devtools/overlay.js#anonymous~16")), "@foldkit/devtools/overlay.js#handler");
342
- },
343
- }),
344
- storeUpdates: entry('StoreUpdates', {
345
- messages: [Message.ReceivedStoreUpdate],
346
- handler: function* () {
347
- const store = yield* StoreService;
348
- 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");
349
- },
350
- }),
351
- mobileBreakpointChanges: entry('MobileBreakpointChanges', {
352
- messages: [Message.ObservedMobileBreakpoint],
353
- handler: function* () {
354
- return __foldkitBrandViewResult((() => __foldkitBrandViewResult((Dom.streamFromMediaQuery({
355
- query: MOBILE_BREAKPOINT_QUERY,
356
- mapMatches: isMobile => __foldkitBrandViewResult((Message.ObservedMobileBreakpoint({ isMobile })), "@foldkit/devtools/overlay.js#mapMatches"),
357
- })), "@foldkit/devtools/overlay.js#anonymous~20")), "@foldkit/devtools/overlay.js#handler~3");
358
- },
359
- }),
360
- }), "@foldkit/devtools/overlay.js#anonymous~15")));
361
- export const LockScroll = ApplicationDefinition.makeCommand('LockScroll', {
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
+ });
297
+ class StoreService extends Context.Service()('foldkit/DevToolsStore') {
298
+ }
299
+ class ShadowRootService extends Context.Service()('foldkit/DevToolsShadowRoot') {
300
+ }
301
+ export const LockScroll = Command.define('LockScroll', {
362
302
  messages: [Message.CompletedLockScroll],
363
- handler: function* () {
364
- return __foldkitBrandViewResult((() => __foldkitBrandViewResult((lockScroll.pipe(Effect.as(Message.CompletedLockScroll()))), "@foldkit/devtools/overlay.js#anonymous~21")), "@foldkit/devtools/overlay.js#handler~4");
365
- },
303
+ execute: lockScroll.pipe(Effect.as(Message.CompletedLockScroll())),
366
304
  });
367
- export const UnlockScroll = ApplicationDefinition.makeCommand('UnlockScroll', {
305
+ export const UnlockScroll = Command.define('UnlockScroll', {
368
306
  messages: [Message.CompletedUnlockScroll],
369
- handler: function* () {
370
- return __foldkitBrandViewResult((() => __foldkitBrandViewResult((unlockScroll.pipe(Effect.as(Message.CompletedUnlockScroll()))), "@foldkit/devtools/overlay.js#anonymous~22")), "@foldkit/devtools/overlay.js#handler~5");
371
- },
307
+ execute: unlockScroll.pipe(Effect.as(Message.CompletedUnlockScroll())),
372
308
  });
373
- 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");
374
311
  const DevToolsPersistedState = Schema.Struct({
375
312
  isOpen: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
376
313
  isFlattened: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
@@ -383,31 +320,31 @@ const DEFAULT_PERSISTED_STATE = {
383
320
  const readPersistedState = Effect.gen(function* () {
384
321
  const store = yield* KeyValueStore.KeyValueStore;
385
322
  const json = yield* Effect.fromOption(Option.fromNullishOr(yield* store.get(DEVTOOLS_STORAGE_KEY)));
386
- return __foldkitBrandViewResult((yield* Schema.decodeEffect(DevToolsPersistedStateJson)(json)), "@foldkit/devtools/overlay.js#anonymous~24");
387
- }).pipe(Effect.catch(() => __foldkitBrandViewResult((Effect.succeed(DEFAULT_PERSISTED_STATE)), "@foldkit/devtools/overlay.js#anonymous~25")));
388
- 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', {
389
326
  args: { isOpen: Schema.Boolean, isFlattened: Schema.Boolean },
390
327
  messages: [Message.CompletedPersistDevToolsState],
391
- handler: function* () {
328
+ execute: ({ isOpen, isFlattened }) => __foldkitBrandViewResult((Effect.gen(function* () {
392
329
  const store = yield* KeyValueStore.KeyValueStore;
393
- return __foldkitBrandViewResult((({ isOpen, isFlattened }) => __foldkitBrandViewResult((Effect.gen(function* () {
394
- const json = yield* Schema.encodeEffect(DevToolsPersistedStateJson)({
395
- isOpen,
396
- isFlattened,
397
- });
398
- yield* store.set(DEVTOOLS_STORAGE_KEY, json);
399
- return __foldkitBrandViewResult((Message.CompletedPersistDevToolsState()), "@foldkit/devtools/overlay.js#anonymous~27");
400
- }).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");
401
- },
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"),
402
337
  });
403
- const buildInspectionFromModel = (store, index, model) => __foldkitBrandViewResult((Effect.gen(function* () {
338
+ const buildInspectionFromModel = (index, model) => __foldkitBrandViewResult((Effect.gen(function* () {
339
+ const store = yield* StoreService;
404
340
  const maybeMessage = yield* store.getMessageAtIndex(index);
405
341
  const diff = yield* store.getDiffAtIndex(index);
406
- 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");
407
343
  })), "@foldkit/devtools/overlay.js#buildInspectionFromModel");
408
- const buildInspectionEffect = (store, index) => __foldkitBrandViewResult((Effect.gen(function* () {
344
+ const buildInspectionEffect = (index) => __foldkitBrandViewResult((Effect.gen(function* () {
345
+ const store = yield* StoreService;
409
346
  const model = yield* store.getModelAtIndex(index);
410
- 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");
411
348
  })), "@foldkit/devtools/overlay.js#buildInspectionEffect");
412
349
  // NOTE: jump and inspect both need the model at `index`. Resolving it twice
413
350
  // (once to render the host, once to feed the inspector) replays the segment
@@ -415,50 +352,45 @@ const buildInspectionEffect = (store, index) => __foldkitBrandViewResult((Effect
415
352
  // returns the model it resolved so the inspector reuses that single
416
353
  // resolution. Inspect-only navigation (no host pause) still uses
417
354
  // `InspectState`, which resolves once on its own.
418
- export const JumpToAndInspect = ApplicationDefinition.makeCommand('JumpToAndInspect', {
355
+ export const JumpToAndInspect = Command.define('JumpToAndInspect', {
419
356
  args: { index: Schema.Number },
420
357
  messages: [Message.ReceivedInspectedState],
421
- handler: function* () {
358
+ execute: ({ index }) => __foldkitBrandViewResult((Effect.gen(function* () {
422
359
  const store = yield* StoreService;
423
- return __foldkitBrandViewResult((({ index }) => __foldkitBrandViewResult((Effect.gen(function* () {
424
- const model = yield* store.jumpTo(index);
425
- return __foldkitBrandViewResult((yield* buildInspectionFromModel(store, index, model)), "@foldkit/devtools/overlay.js#anonymous~32");
426
- })), "@foldkit/devtools/overlay.js#anonymous~31")), "@foldkit/devtools/overlay.js#handler~7");
427
- },
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"),
428
363
  });
429
- export const InspectState = ApplicationDefinition.makeCommand('InspectState', {
364
+ export const InspectState = Command.define('InspectState', {
430
365
  args: { index: Schema.Number },
431
366
  messages: [Message.ReceivedInspectedState],
432
- handler: function* () {
433
- const store = yield* StoreService;
434
- return __foldkitBrandViewResult((({ index }) => __foldkitBrandViewResult((buildInspectionEffect(store, index)), "@foldkit/devtools/overlay.js#anonymous~33")), "@foldkit/devtools/overlay.js#handler~8");
435
- },
367
+ execute: ({ index }) => __foldkitBrandViewResult((buildInspectionEffect(index)), "@foldkit/devtools/overlay.js#execute~3"),
436
368
  });
437
- export const InspectLatest = ApplicationDefinition.makeCommand('InspectLatest', {
369
+ export const InspectLatest = Command.define('InspectLatest', {
438
370
  messages: [Message.ReceivedInspectedState],
439
- handler: function* () {
371
+ execute: Effect.gen(function* () {
440
372
  const store = yield* StoreService;
441
- return __foldkitBrandViewResult((() => __foldkitBrandViewResult((Effect.gen(function* () {
442
- const state = yield* SubscriptionRef.get(store.stateRef);
443
- return __foldkitBrandViewResult((yield* buildInspectionEffect(store, latestEntryIndex(state))), "@foldkit/devtools/overlay.js#anonymous~35");
444
- })), "@foldkit/devtools/overlay.js#anonymous~34")), "@foldkit/devtools/overlay.js#handler~9");
445
- },
373
+ const state = yield* SubscriptionRef.get(store.stateRef);
374
+ return __foldkitBrandViewResult((yield* buildInspectionEffect(latestEntryIndex(state))), "@foldkit/devtools/overlay.js#anonymous~23");
375
+ }),
446
376
  });
447
- export const Resume = ApplicationDefinition.makeCommand('Resume', {
377
+ export const Resume = Command.define('Resume', {
448
378
  messages: [Message.CompletedResume],
449
- handler: function* () {
379
+ execute: Effect.gen(function* () {
450
380
  const store = yield* StoreService;
451
- return __foldkitBrandViewResult((() => __foldkitBrandViewResult((store.resume.pipe(Effect.as(Message.CompletedResume()))), "@foldkit/devtools/overlay.js#anonymous~36")), "@foldkit/devtools/overlay.js#handler~10");
452
- },
381
+ yield* store.resume;
382
+ return __foldkitBrandViewResult((Message.CompletedResume()), "@foldkit/devtools/overlay.js#anonymous~24");
383
+ }),
453
384
  });
454
- export const Clear = ApplicationDefinition.makeCommand('Clear', {
385
+ export const Clear = Command.define('Clear', {
455
386
  messages: [Message.CompletedClear],
456
- handler: function* () {
387
+ execute: Effect.gen(function* () {
457
388
  const store = yield* StoreService;
458
- return __foldkitBrandViewResult((() => __foldkitBrandViewResult((store.clear.pipe(Effect.as(Message.CompletedClear()))), "@foldkit/devtools/overlay.js#anonymous~37")), "@foldkit/devtools/overlay.js#handler~11");
459
- },
389
+ yield* store.clear;
390
+ return __foldkitBrandViewResult((Message.CompletedClear()), "@foldkit/devtools/overlay.js#anonymous~25");
391
+ }),
460
392
  });
461
- export const CopyPayloadToClipboard = ApplicationDefinition.makeCommand('CopyPayloadToClipboard', {
393
+ export const CopyPayloadToClipboard = Command.define('CopyPayloadToClipboard', {
462
394
  args: {
463
395
  targetId: Schema.String,
464
396
  requestId: Schema.Number,
@@ -468,273 +400,263 @@ export const CopyPayloadToClipboard = ApplicationDefinition.makeCommand('CopyPay
468
400
  Message.SucceededCopyPayloadToClipboard,
469
401
  Message.FailedCopyPayloadToClipboard,
470
402
  ],
471
- handler: function* () {
472
- return __foldkitBrandViewResult((({ targetId, requestId, payload }) => __foldkitBrandViewResult((Effect.gen(function* () {
473
- const text = yield* serializePayload(payload);
474
- yield* Effect.tryPromise({
475
- try: () => __foldkitBrandViewResult((navigator.clipboard.writeText(text)), "@foldkit/devtools/overlay.js#try~2"),
476
- catch: () => __foldkitBrandViewResult((new Error('Failed to copy payload to clipboard')), "@foldkit/devtools/overlay.js#catch~2"),
477
- });
478
- return __foldkitBrandViewResult((Message.SucceededCopyPayloadToClipboard({
479
- targetId,
480
- requestId,
481
- })), "@foldkit/devtools/overlay.js#anonymous~39");
482
- }).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");
483
- },
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"),
484
411
  });
485
- /** Provides the DevTools clipboard Command handler. */
486
- export const CopyPayloadToClipboardLayer = CopyPayloadToClipboard.layer;
487
412
  const COPY_INDICATOR_DURATION = '1 second';
488
- export const WaitBeforeHidingCopyIndicator = ApplicationDefinition.makeCommand('WaitBeforeHidingCopyIndicator', {
413
+ export const WaitBeforeHidingCopyIndicator = Command.define('WaitBeforeHidingCopyIndicator', {
489
414
  args: { targetId: Schema.String, requestId: Schema.Number },
490
415
  messages: [Message.CompletedWaitBeforeHidingCopyIndicator],
491
- handler: function* () {
492
- return __foldkitBrandViewResult((({ targetId, requestId }) => __foldkitBrandViewResult((Effect.sleep(COPY_INDICATOR_DURATION).pipe(Effect.as(Message.CompletedWaitBeforeHidingCopyIndicator({
493
- targetId,
494
- requestId,
495
- })))), "@foldkit/devtools/overlay.js#anonymous~41")), "@foldkit/devtools/overlay.js#handler~13");
496
- },
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"),
497
420
  });
498
- export const ScrollToTop = ApplicationDefinition.makeCommand('ScrollToTop', {
421
+ export const ScrollToTop = Command.define('ScrollToTop', {
499
422
  messages: [Message.CompletedScrollToTop],
500
- handler: function* () {
423
+ execute: Effect.gen(function* () {
501
424
  const shadow = yield* ShadowRootService;
502
- return __foldkitBrandViewResult((() => __foldkitBrandViewResult((Effect.sync(() => {
503
- const messageList = shadow.querySelector(MESSAGE_LIST_SELECTOR);
504
- if (messageList instanceof HTMLElement) {
505
- messageList.scrollTop = 0;
506
- }
507
- return __foldkitBrandViewResult((Message.CompletedScrollToTop()), "@foldkit/devtools/overlay.js#anonymous~43");
508
- })), "@foldkit/devtools/overlay.js#anonymous~42")), "@foldkit/devtools/overlay.js#handler~14");
509
- },
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
+ }),
510
431
  });
511
- 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);
512
- const init = ApplicationComposition.makeInit((flags) => {
513
- const { isFlattened, ...displayFlags } = flags;
514
- const sliderMax = flags.entries.length;
515
- const initialSliderValue = flags.isPaused
516
- ? hostIndexToSliderValue(flags.pausedAtIndex, flags.startIndex)
517
- : sliderMax;
518
- return __foldkitBrandViewResult(({
519
- childInitContext: flags,
520
- model: {
521
- screen: 'Messages',
522
- ...displayFlags,
523
- isFlattened,
524
- selectedIndex: INIT_INDEX,
525
- isFollowingLatest: true,
526
- isFollowingTop: true,
527
- blockTags: computeBlockTags(flags.entries),
528
- maybeBlockFilter: Option.none(),
529
- maybeInspectedModel: Option.none(),
530
- maybeInspectedMessage: Option.none(),
531
- expandedPaths: HashSet.empty(),
532
- changedPaths: HashSet.empty(),
533
- affectedPaths: HashSet.empty(),
534
- copyStates: HashMap.empty(),
535
- nextCopyRequestId: 0,
536
- maybePendingScrubIndex: Option.none(),
537
- activeInspectorTab: 'Model',
538
- 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");
539
453
  },
540
- commands: Array.filter([LockScroll()], () => __foldkitBrandViewResult((flags.isOpen && flags.isMobile), "@foldkit/devtools/overlay.js#anonymous~45")),
541
- }), "@foldkit/devtools/overlay.js#anonymous~44");
542
- });
543
- const update = ApplicationComposition.makeUpdate({
544
- ClickedToggle: model => {
545
- const nextIsOpen = !model.isOpen;
546
- return __foldkitBrandViewResult(({
547
- model: modifyFields(model, { isOpen: () => __foldkitBrandViewResult((nextIsOpen), "@foldkit/devtools/overlay.js#isOpen") }),
548
- commands: [
549
- ...scrollLockCommands(model.isMobile, nextIsOpen),
550
- PersistDevToolsState({
551
- isOpen: nextIsOpen,
552
- 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"),
553
517
  }),
554
- ],
555
- }), "@foldkit/devtools/overlay.js#ClickedToggle");
556
- },
557
- ClickedSettingsToggle: model => (__foldkitBrandViewResult(({
558
- model: modifyFields(model, {
559
- 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"),
560
- }),
561
- }), "@foldkit/devtools/overlay.js#ClickedSettingsToggle")),
562
- ToggledFlatten: (model, { isFlattened }) => (__foldkitBrandViewResult(({
563
- model: modifyFields(model, { isFlattened: () => __foldkitBrandViewResult((isFlattened), "@foldkit/devtools/overlay.js#isFlattened") }),
564
- commands: [PersistDevToolsState({ isOpen: model.isOpen, isFlattened })],
565
- }), "@foldkit/devtools/overlay.js#ToggledFlatten")),
566
- ObservedMobileBreakpoint: (model, { isMobile }) => {
567
- if (isMobile === model.isMobile) {
568
- return __foldkitBrandViewResult(({ model }), "@foldkit/devtools/overlay.js#ObservedMobileBreakpoint");
569
- }
570
- return __foldkitBrandViewResult(({
571
- model: modifyFields(model, { isMobile: () => __foldkitBrandViewResult((isMobile), "@foldkit/devtools/overlay.js#isMobile") }),
572
- commands: scrollLockCommands(model.isOpen, isMobile),
573
- }), "@foldkit/devtools/overlay.js#ObservedMobileBreakpoint");
574
- },
575
- ClickedRow: (model, { index }) => __foldkitBrandViewResult((Match.value(model.mode).pipe(Match.when('TimeTravel', () => (__foldkitBrandViewResult(({
576
- model,
577
- commands: [JumpToAndInspect({ index })],
578
- }), "@foldkit/devtools/overlay.js#anonymous~48"))), Match.when('Inspect', () => (__foldkitBrandViewResult(({
579
- model: modifyFields(model, {
580
- selectedIndex: () => __foldkitBrandViewResult((index), "@foldkit/devtools/overlay.js#selectedIndex"),
581
- isFollowingLatest: () => __foldkitBrandViewResult((false), "@foldkit/devtools/overlay.js#isFollowingLatest"),
582
- }),
583
- commands: [InspectState({ index })],
584
- }), "@foldkit/devtools/overlay.js#anonymous~49"))), Match.exhaustive)), "@foldkit/devtools/overlay.js#ClickedRow"),
585
- ClickedResume: model => (__foldkitBrandViewResult(({
586
- model: modifyFields(model, {
587
- isFollowingTop: () => __foldkitBrandViewResult((true), "@foldkit/devtools/overlay.js#isFollowingTop"),
588
- expandedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#expandedPaths"),
589
- changedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#changedPaths"),
590
- affectedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#affectedPaths"),
591
- }),
592
- commands: [Resume(), InspectLatest(), ScrollToTop()],
593
- }), "@foldkit/devtools/overlay.js#ClickedResume")),
594
- ClickedClear: model => (__foldkitBrandViewResult(({
595
- model: modifyFields(model, {
596
- selectedIndex: () => __foldkitBrandViewResult((INIT_INDEX), "@foldkit/devtools/overlay.js#selectedIndex~2"),
597
- isFollowingLatest: () => __foldkitBrandViewResult((true), "@foldkit/devtools/overlay.js#isFollowingLatest~2"),
598
- isFollowingTop: () => __foldkitBrandViewResult((true), "@foldkit/devtools/overlay.js#isFollowingTop~2"),
599
- maybeBlockFilter: () => __foldkitBrandViewResult((Option.none()), "@foldkit/devtools/overlay.js#maybeBlockFilter~2"),
600
- expandedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#expandedPaths~2"),
601
- changedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#changedPaths~2"),
602
- affectedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#affectedPaths~2"),
603
- copyStates: () => __foldkitBrandViewResult((HashMap.empty()), "@foldkit/devtools/overlay.js#copyStates"),
604
- }),
605
- commands: [Clear(), InspectLatest(), ScrollToTop()],
606
- }), "@foldkit/devtools/overlay.js#ClickedClear")),
607
- ClickedFollowLatest: model => {
608
- const latestIndex = Array.match(model.entries, {
609
- onEmpty: () => __foldkitBrandViewResult((INIT_INDEX), "@foldkit/devtools/overlay.js#onEmpty~2"),
610
- onNonEmpty: () => __foldkitBrandViewResult((model.startIndex + model.entries.length - 1), "@foldkit/devtools/overlay.js#onNonEmpty~2"),
611
- });
612
- return __foldkitBrandViewResult(({
518
+ commands: [inspectLatest, scrollToTop],
519
+ }), "@foldkit/devtools/overlay.js#ClickedFollowLatest");
520
+ },
521
+ ClickedScrollToTopPill: () => (__foldkitBrandViewResult(({
613
522
  model: modifyFields(model, {
614
- selectedIndex: () => __foldkitBrandViewResult((latestIndex), "@foldkit/devtools/overlay.js#selectedIndex~3"),
615
- isFollowingLatest: () => __foldkitBrandViewResult((true), "@foldkit/devtools/overlay.js#isFollowingLatest~3"),
616
- isFollowingTop: () => __foldkitBrandViewResult((true), "@foldkit/devtools/overlay.js#isFollowingTop~3"),
617
- expandedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#expandedPaths~3"),
618
- changedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#changedPaths~3"),
619
- affectedPaths: () => __foldkitBrandViewResult((HashSet.empty()), "@foldkit/devtools/overlay.js#affectedPaths~3"),
523
+ isFollowingTop: () => __foldkitBrandViewResult((true), "@foldkit/devtools/overlay.js#isFollowingTop~4"),
620
524
  }),
621
- commands: [InspectLatest(), ScrollToTop()],
622
- }), "@foldkit/devtools/overlay.js#ClickedFollowLatest");
623
- },
624
- ClickedScrollToTopPill: model => (__foldkitBrandViewResult(({
625
- model: modifyFields(model, {
626
- isFollowingTop: () => __foldkitBrandViewResult((true), "@foldkit/devtools/overlay.js#isFollowingTop~4"),
627
- }),
628
- commands: [ScrollToTop()],
629
- }), "@foldkit/devtools/overlay.js#ClickedScrollToTopPill")),
630
- ScrolledMessageList: (model, { scrollTop }) => {
631
- const isAtTop = scrollTop <= SCROLL_FOLLOW_THRESHOLD_PX;
632
- return __foldkitBrandViewResult((isAtTop === model.isFollowingTop
633
- ? { model }
634
- : { model: modifyFields(model, { isFollowingTop: () => __foldkitBrandViewResult((isAtTop), "@foldkit/devtools/overlay.js#isFollowingTop~5") }) }), "@foldkit/devtools/overlay.js#ScrolledMessageList");
635
- },
636
- ReceivedInspectedState: (model, { model: inspectedModel, maybeMessage, changedPaths, affectedPaths }) => (__foldkitBrandViewResult(({
637
- model: modifyFields(model, {
638
- maybeInspectedModel: () => __foldkitBrandViewResult((Option.some(inspectedModel)), "@foldkit/devtools/overlay.js#maybeInspectedModel"),
639
- maybeInspectedMessage: () => __foldkitBrandViewResult((maybeMessage), "@foldkit/devtools/overlay.js#maybeInspectedMessage"),
640
- changedPaths: () => __foldkitBrandViewResult((changedPaths), "@foldkit/devtools/overlay.js#changedPaths~4"),
641
- affectedPaths: () => __foldkitBrandViewResult((affectedPaths), "@foldkit/devtools/overlay.js#affectedPaths~4"),
642
- }),
643
- }), "@foldkit/devtools/overlay.js#ReceivedInspectedState")),
644
- ToggledTreeNode: (model, { path }) => (__foldkitBrandViewResult(({
645
- model: modifyFields(model, {
646
- expandedPaths: paths => __foldkitBrandViewResult((HashSet.has(paths, path)
647
- ? HashSet.remove(paths, path)
648
- : HashSet.add(paths, path)), "@foldkit/devtools/overlay.js#expandedPaths~4"),
649
- }),
650
- }), "@foldkit/devtools/overlay.js#ToggledTreeNode")),
651
- ClickedCopyPayload: (model, { targetId, payload }) => {
652
- if (Option.isSome(HashMap.get(model.copyStates, targetId))) {
653
- return __foldkitBrandViewResult(({ model }), "@foldkit/devtools/overlay.js#ClickedCopyPayload");
654
- }
655
- const requestId = model.nextCopyRequestId;
656
- 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(({
657
534
  model: modifyFields(model, {
658
- copyStates: states => __foldkitBrandViewResult((HashMap.set(states, targetId, CopyState.Copying({ requestId }))), "@foldkit/devtools/overlay.js#copyStates~2"),
659
- 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"),
660
539
  }),
661
- commands: [CopyPayloadToClipboard({ targetId, requestId, payload })],
662
- }), "@foldkit/devtools/overlay.js#ClickedCopyPayload");
663
- },
664
- ReceivedStoreUpdate: (model, { entries, initCommands, initMountStarts, startIndex, isPaused, pausedAtIndex, }) => {
665
- 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);
666
- 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);
667
- const latestIndex = Array.match(entries, {
668
- onEmpty: () => __foldkitBrandViewResult((INIT_INDEX), "@foldkit/devtools/overlay.js#onEmpty~3"),
669
- onNonEmpty: () => __foldkitBrandViewResult((startIndex + entries.length - 1), "@foldkit/devtools/overlay.js#onNonEmpty~3"),
670
- });
671
- const nextBlockTags = computeBlockTags(entries);
672
- const isFilterStale = Option.exists(model.maybeBlockFilter, filterTag => __foldkitBrandViewResult((!Array.contains(nextBlockTags, filterTag)), "@foldkit/devtools/overlay.js#anonymous~54"));
673
- const sliderMax = entries.length;
674
- const targetSliderValue = isPaused
675
- ? hostIndexToSliderValue(pausedAtIndex, startIndex)
676
- : sliderMax;
677
- return __foldkitBrandViewResult((Update.combineSteps(model, [
678
- ApplicationDefinition.makeStep(stepModel => (__foldkitBrandViewResult(({
679
- 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, {
680
577
  entries: () => __foldkitBrandViewResult((entries), "@foldkit/devtools/overlay.js#entries"),
681
578
  initCommands: () => __foldkitBrandViewResult((initCommands), "@foldkit/devtools/overlay.js#initCommands"),
682
579
  initMountStarts: () => __foldkitBrandViewResult((initMountStarts), "@foldkit/devtools/overlay.js#initMountStarts"),
683
580
  startIndex: () => __foldkitBrandViewResult((startIndex), "@foldkit/devtools/overlay.js#startIndex"),
684
581
  isPaused: () => __foldkitBrandViewResult((isPaused), "@foldkit/devtools/overlay.js#isPaused"),
685
582
  pausedAtIndex: () => __foldkitBrandViewResult((pausedAtIndex), "@foldkit/devtools/overlay.js#pausedAtIndex"),
686
- blockTags: () => __foldkitBrandViewResult((nextBlockTags), "@foldkit/devtools/overlay.js#blockTags"),
687
- 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"),
688
585
  selectedIndex: current => __foldkitBrandViewResult((shouldFollowSelection ? latestIndex : current), "@foldkit/devtools/overlay.js#selectedIndex~4"),
689
- 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"),
690
588
  }),
691
589
  commands: [
692
- ...Array.filter([InspectLatest()], () => __foldkitBrandViewResult((shouldFollowSelection), "@foldkit/devtools/overlay.js#anonymous~58")),
693
- ...Array.filter([ScrollToTop()], () => __foldkitBrandViewResult((shouldFollowScroll), "@foldkit/devtools/overlay.js#anonymous~59")),
590
+ ...(shouldFollowSelection ? [inspectLatest] : []),
591
+ ...(shouldFollowScroll ? [scrollToTop] : []),
694
592
  ],
695
- }), "@foldkit/devtools/overlay.js#anonymous~55"))),
696
- bindings.ScrubberSliderBinding.informOfRangeChange({
697
- min: 0,
698
- max: sliderMax,
699
- }),
700
- ])), "@foldkit/devtools/overlay.js#ReceivedStoreUpdate");
701
- },
702
- TickedScrubFrame: model => __foldkitBrandViewResult((Option.match(model.maybePendingScrubIndex, {
703
- onNone: () => (__foldkitBrandViewResult(({ model }), "@foldkit/devtools/overlay.js#onNone~2")),
704
- onSome: hostIndex => (__foldkitBrandViewResult(({
705
- model: modifyFields(model, {
706
- maybePendingScrubIndex: () => __foldkitBrandViewResult((Option.none()), "@foldkit/devtools/overlay.js#maybePendingScrubIndex~2"),
707
- }),
708
- commands: [JumpToAndInspect({ index: hostIndex })],
709
- }), "@foldkit/devtools/overlay.js#onSome~2")),
710
- })), "@foldkit/devtools/overlay.js#TickedScrubFrame"),
711
- CompletedResume: ApplicationDefinition.makeNoopStep(),
712
- CompletedClear: ApplicationDefinition.makeNoopStep(),
713
- CompletedPersistDevToolsState: ApplicationDefinition.makeNoopStep(),
714
- CompletedLockScroll: ApplicationDefinition.makeNoopStep(),
715
- CompletedUnlockScroll: ApplicationDefinition.makeNoopStep(),
716
- CompletedScrollToTop: ApplicationDefinition.makeNoopStep(),
717
- 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"))
718
- ? {
719
- model: modifyFields(model, {
720
- copyStates: states => __foldkitBrandViewResult((HashMap.set(states, targetId, CopyState.Copied({ requestId }))), "@foldkit/devtools/overlay.js#copyStates~3"),
721
- }),
722
- commands: [WaitBeforeHidingCopyIndicator({ targetId, requestId })],
723
- }
724
- : { model }), "@foldkit/devtools/overlay.js#SucceededCopyPayloadToClipboard"),
725
- FailedCopyPayloadToClipboard: (model, { targetId, requestId }) => (__foldkitBrandViewResult(({
726
- model: Option.exists(HashMap.get(model.copyStates, targetId), state => __foldkitBrandViewResult((state._tag === 'Copying' && state.requestId === requestId), "@foldkit/devtools/overlay.js#anonymous~61"))
727
- ? modifyFields(model, { copyStates: HashMap.remove(targetId) })
728
- : model,
729
- }), "@foldkit/devtools/overlay.js#FailedCopyPayloadToClipboard")),
730
- CompletedWaitBeforeHidingCopyIndicator: (model, { targetId, requestId }) => (__foldkitBrandViewResult(({
731
- model: Option.exists(HashMap.get(model.copyStates, targetId), state => __foldkitBrandViewResult((state._tag === 'Copied' && state.requestId === requestId), "@foldkit/devtools/overlay.js#anonymous~62"))
732
- ? modifyFields(model, {
733
- copyStates: HashMap.remove(targetId),
734
- })
735
- : model,
736
- }), "@foldkit/devtools/overlay.js#CompletedWaitBeforeHidingCopyIndicator")),
737
- });
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
+ };
659
+ // VIEW
738
660
  const indexClass = 'text-2xs text-dt-muted font-mono min-w-5';
739
661
  const headerButtonClass = 'dt-header-button bg-transparent border-none text-dt-muted cursor-pointer text-base font-mono transition-colors';
740
662
  const ROW_BASE = 'dt-row flex items-center py-1 px-1 cursor-pointer gap-1.5 transition-colors border-b';
@@ -758,43 +680,24 @@ const PANEL_POSITION_CLASS = {
758
680
  // every memo on every render. Hoisting only the lazy slots out does not help;
759
681
  // the closures themselves have to be reference-stable.
760
682
  //
761
- // Safe despite the "thread `h`, never store it" rule because each cached view
762
- // is keyed by the ShadowRoot that owns its root frame, and the builder is the
763
- // runtime's process-wide singleton.
764
- const makeView = (bindings) => {
765
- 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;
766
688
  return __foldkitBrandViewResult(((model, h) => {
767
- const shadow = getDevToolsShadowRoot();
768
- const existingView = views.get(shadow);
769
- if (existingView !== undefined) {
770
- return __foldkitBrandViewResult((existingView(model)), "@foldkit/devtools/overlay.js#anonymous~63");
771
- }
772
- const view = buildOverlayView(model.position, model.mode, shadow, model.maybeBanner, bindings, h);
773
- views.set(shadow, view);
774
- 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");
775
691
  }), "@foldkit/devtools/overlay.js#makeView");
776
692
  };
777
- const view = ApplicationComposition.makeView(makeView(bindings));
778
- const ApplicationBlock = ApplicationDefinition.makeBlock(Effect.gen(function* () {
779
- const inspectorTabs = yield* bindings.InspectorTabsBinding;
780
- const blockFilterListbox = yield* bindings.BlockFilterListboxBinding;
781
- const scrubberSlider = yield* bindings.ScrubberSliderBinding;
782
- return __foldkitBrandViewResult(({
783
- children: [inspectorTabs, blockFilterListbox, scrubberSlider],
784
- init,
785
- update,
786
- view,
787
- subscriptions,
788
- EffectsLayer,
789
- }), "@foldkit/devtools/overlay.js#anonymous~64");
790
- }));
791
- const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
693
+ const buildOverlayView = (position, mode, shadow, maybeBanner, h) => {
792
694
  const lazyTreeNode = createKeyedLazy();
793
695
  const lazyMessageRow = createKeyedLazy();
794
696
  const lazyTabContent = createKeyedLazy();
795
697
  const lazyMessageList = createLazy();
698
+ // JSON TREE
796
699
  const leafSpan = (className, text) => __foldkitBrandViewResult((h.span([h.Class(className)], [text])), "@foldkit/devtools/overlay.js#leafSpan");
797
- const leafValueView = (value) => __foldkitBrandViewResult((Match.value(value).pipe(Match.when(Predicate.isNull, () => __foldkitBrandViewResult((leafSpan('json-null italic', 'null')), "@foldkit/devtools/overlay.js#anonymous~65")), Match.when(Predicate.isUndefined, () => __foldkitBrandViewResult((leafSpan('json-null italic', 'undefined')), "@foldkit/devtools/overlay.js#anonymous~66")), Match.when(Predicate.isString, stringValue => __foldkitBrandViewResult((leafSpan('json-string', `"${stringValue}"`)), "@foldkit/devtools/overlay.js#anonymous~67")), Match.when(Predicate.isNumber, numberValue => __foldkitBrandViewResult((leafSpan('json-number', globalThis.String(numberValue))), "@foldkit/devtools/overlay.js#anonymous~68")), Match.when(Predicate.isBoolean, booleanValue => __foldkitBrandViewResult((leafSpan('json-boolean', globalThis.String(booleanValue))), "@foldkit/devtools/overlay.js#anonymous~69")), Match.orElse(unknownValue => __foldkitBrandViewResult((leafSpan('json-null', globalThis.String(unknownValue))), "@foldkit/devtools/overlay.js#anonymous~70")))), "@foldkit/devtools/overlay.js#leafValueView");
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");
798
701
  const keyView = (key) => __foldkitBrandViewResult((h.span([h.Class('json-key')], [`${key}:\u00a0`])), "@foldkit/devtools/overlay.js#keyView");
799
702
  const CHEVRON_RIGHT = 'M8.25 4.5l7.5 7.5-7.5 7.5';
800
703
  const CHEVRON_DOWN = 'M19.5 8.25l-7.5 7.5-7.5-7.5';
@@ -818,8 +721,8 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
818
721
  const tagLabelView = (tag) => __foldkitBrandViewResult((h.span([h.Class('json-tag')], [tag])), "@foldkit/devtools/overlay.js#tagLabelView");
819
722
  const copyPayloadButtonView = (payload, targetId, copyStates, subject) => {
820
723
  const maybeCopyState = HashMap.get(copyStates, targetId);
821
- const isCopying = Option.exists(maybeCopyState, state => __foldkitBrandViewResult((state._tag === 'Copying'), "@foldkit/devtools/overlay.js#anonymous~71"));
822
- const isCopied = Option.exists(maybeCopyState, state => __foldkitBrandViewResult((state._tag === 'Copied'), "@foldkit/devtools/overlay.js#anonymous~72"));
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"));
823
726
  const ariaLabel = Option.match(maybeCopyState, {
824
727
  onNone: () => __foldkitBrandViewResult((`Copy ${subject} as JSON`), "@foldkit/devtools/overlay.js#onNone~3"),
825
728
  onSome: CopyState.match({
@@ -905,16 +808,16 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
905
808
  treePath: `${treePath}.${arrayIndex}`,
906
809
  depth: childDepth,
907
810
  key: globalThis.String(arrayIndex),
908
- })), "@foldkit/devtools/overlay.js#anonymous~73"));
811
+ })), "@foldkit/devtools/overlay.js#anonymous~56"));
909
812
  }
910
813
  else if (Predicate.isObject(value)) {
911
- pipe(value, Record.toEntries, Array.filter(([entryKey]) => __foldkitBrandViewResult((entryKey !== '_tag'), "@foldkit/devtools/overlay.js#anonymous~74")), 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({
912
815
  ...shared,
913
816
  value: childValue,
914
817
  treePath: `${treePath}.${entryKey}`,
915
818
  depth: childDepth,
916
819
  key: entryKey,
917
- })), "@foldkit/devtools/overlay.js#anonymous~75")));
820
+ })), "@foldkit/devtools/overlay.js#anonymous~58")));
918
821
  }
919
822
  };
920
823
  const flatNodeView = (value, treePath, depth, key, nodeIsExpandable, isExpanded, isChanged, isAffected, isRoot, tag) => {
@@ -934,7 +837,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
934
837
  'diff-changed': isChanged,
935
838
  })),
936
839
  indent,
937
- ], 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");
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");
938
841
  }
939
842
  const preview = isExpanded
940
843
  ? globalThis.Array.isArray(value)
@@ -958,7 +861,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
958
861
  ...(isRoot
959
862
  ? []
960
863
  : [h.OnClick(Message.ToggledTreeNode({ path: treePath }))]),
961
- ], rowSegments.map(segment => __foldkitBrandViewResult((h.keyed('li')(segment._tag, [h.Class('contents')], [rowSegmentView(segment)])), "@foldkit/devtools/overlay.js#anonymous~77")))), "@foldkit/devtools/overlay.js#flatNodeView");
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");
962
865
  };
963
866
  const renderFlatNode = (node) => __foldkitBrandViewResult((lazyTreeNode(node.treePath, flatNodeView, [
964
867
  node.value,
@@ -982,7 +885,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
982
885
  changedPaths,
983
886
  affectedPaths,
984
887
  depth: 0,
985
- key: Option.getOrElse(maybeRootLabel, () => __foldkitBrandViewResult((''), "@foldkit/devtools/overlay.js#anonymous~78")),
888
+ key: Option.getOrElse(maybeRootLabel, () => __foldkitBrandViewResult((''), "@foldkit/devtools/overlay.js#anonymous~61")),
986
889
  accumulator: nodes,
987
890
  indentRootChildren,
988
891
  });
@@ -1005,8 +908,8 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1005
908
  const remainingMs = delta % MILLIS_PER_SECOND;
1006
909
  return __foldkitBrandViewResult((seconds > 0
1007
910
  ? `+${seconds}s ${remainingMs.toFixed(1)}ms`
1008
- : `+${remainingMs.toFixed(1)}ms`), "@foldkit/devtools/overlay.js#anonymous~79");
1009
- }), Option.getOrElse(() => __foldkitBrandViewResult((''), "@foldkit/devtools/overlay.js#anonymous~80")))), "@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");
1010
913
  };
1011
914
  const emptyInspectorView = h.div([
1012
915
  h.Class('flex-1 flex items-center justify-center text-dt-muted text-2xs font-mono min-w-0'),
@@ -1035,41 +938,41 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1035
938
  return __foldkitBrandViewResult((message), "@foldkit/devtools/overlay.js#unwrapToLeaf");
1036
939
  }
1037
940
  };
1038
- const unwrapToSelectedBlockMessage = (message, maybeBlockFilter) => {
1039
- if (Option.isNone(maybeBlockFilter)) {
1040
- return __foldkitBrandViewResult((message), "@foldkit/devtools/overlay.js#unwrapToSelectedBlockMessage");
941
+ const unwrapIfFiltered = (message, maybeSubmodelFilter) => {
942
+ if (Option.isNone(maybeSubmodelFilter)) {
943
+ return __foldkitBrandViewResult((message), "@foldkit/devtools/overlay.js#unwrapIfFiltered");
1041
944
  }
1042
- const { value: filterTag } = maybeBlockFilter;
1043
- let currentMessage = message;
1044
- while (isTagged(currentMessage) &&
1045
- GOT_MESSAGE_PATTERN.test(currentMessage._tag)) {
1046
- if (!Predicate.hasProperty(currentMessage, 'message')) {
1047
- break;
945
+ const { value: filterTag } = maybeSubmodelFilter;
946
+ let current = message;
947
+ let matched = false;
948
+ while (isTagged(current) && GOT_MESSAGE_PATTERN.test(current._tag)) {
949
+ if (current._tag === filterTag) {
950
+ matched = true;
1048
951
  }
1049
- const nextMessage = currentMessage.message;
1050
- if (nextMessage === undefined) {
952
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
953
+ const inner = current?.['message'];
954
+ if (inner === undefined) {
1051
955
  break;
1052
956
  }
1053
- const isFilterMatched = currentMessage._tag === filterTag;
1054
- currentMessage = nextMessage;
1055
- if (isFilterMatched) {
957
+ current = inner;
958
+ if (matched) {
1056
959
  break;
1057
960
  }
1058
961
  }
1059
- return __foldkitBrandViewResult((currentMessage), "@foldkit/devtools/overlay.js#unwrapToSelectedBlockMessage");
962
+ return __foldkitBrandViewResult((current), "@foldkit/devtools/overlay.js#unwrapIfFiltered");
1060
963
  };
1061
- 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, {
1062
965
  onNone: noMessageView,
1063
966
  onSome: rawMessage => {
1064
967
  const message = isFlattened
1065
968
  ? unwrapToLeaf(rawMessage)
1066
- : unwrapToSelectedBlockMessage(rawMessage, maybeBlockFilter);
969
+ : unwrapIfFiltered(rawMessage, maybeSubmodelFilter);
1067
970
  return __foldkitBrandViewResult((h.div([h.Class('flex flex-col flex-1 min-h-0 min-w-0')], [
1068
971
  h.div([
1069
972
  h.Class('flex items-center justify-between px-2 py-1 border-b text-2xs text-dt-muted font-mono shrink-0'),
1070
973
  ], [
1071
974
  h.span([], [timestamp]),
1072
- copyPayloadButtonView(message, `Message:${selectedIndex}:${isFlattened}:${Option.getOrElse(maybeBlockFilter, () => __foldkitBrandViewResult(('All'), "@foldkit/devtools/overlay.js#anonymous~81"))}`, copyStates, 'Message payload'),
975
+ copyPayloadButtonView(message, `Message:${selectedIndex}:${isFlattened}:${Option.getOrElse(maybeSubmodelFilter, () => __foldkitBrandViewResult(('All'), "@foldkit/devtools/overlay.js#anonymous~64"))}`, copyStates, 'Message payload'),
1073
976
  ]),
1074
977
  h.div([h.Class('flex flex-col flex-1 min-h-0 min-w-0 pt-1 pl-1')], [
1075
978
  treeView(message, 'root', expandedPaths, HashSet.empty(), HashSet.empty(), Option.none(), false),
@@ -1082,7 +985,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1082
985
  onEmpty: () => __foldkitBrandViewResult((INIT_INDEX), "@foldkit/devtools/overlay.js#onEmpty~4"),
1083
986
  onNonEmpty: () => __foldkitBrandViewResult((model.startIndex + model.entries.length - 1), "@foldkit/devtools/overlay.js#onNonEmpty~4"),
1084
987
  });
1085
- return __foldkitBrandViewResult((Match.value(mode).pipe(Match.when('TimeTravel', () => __foldkitBrandViewResult((model.isPaused ? model.pausedAtIndex : lastIndex), "@foldkit/devtools/overlay.js#anonymous~82")), Match.when('Inspect', () => __foldkitBrandViewResult((model.selectedIndex), "@foldkit/devtools/overlay.js#anonymous~83")), Match.exhaustive)), "@foldkit/devtools/overlay.js#selectedHistoryIndex");
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");
1086
989
  };
1087
990
  const selectedCommands = (model) => {
1088
991
  const selectedIndex = selectedHistoryIndex(model);
@@ -1090,7 +993,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1090
993
  return __foldkitBrandViewResult((model.initCommands), "@foldkit/devtools/overlay.js#selectedCommands");
1091
994
  }
1092
995
  else {
1093
- return __foldkitBrandViewResult((pipe(model.entries, Array.get(selectedIndex - model.startIndex), Option.map(entry => __foldkitBrandViewResult((entry.commands), "@foldkit/devtools/overlay.js#anonymous~84")), Option.getOrElse(() => __foldkitBrandViewResult((NO_COMMANDS), "@foldkit/devtools/overlay.js#anonymous~85")))), "@foldkit/devtools/overlay.js#selectedCommands");
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");
1094
997
  }
1095
998
  };
1096
999
  const flattenCommand = (command, index, expandedPaths) => {
@@ -1120,26 +1023,26 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1120
1023
  ], Array.map(commandList, (command, index) => __foldkitBrandViewResult((h.div([h.Class('flex items-start px-2 py-1 border-b gap-1.5')], [
1121
1024
  h.span([h.Class(indexClass)], [globalThis.String(index + 1)]),
1122
1025
  h.div([h.Class('flex flex-col flex-1 min-w-0')], [
1123
- ...Option.match(command.maybeBlockPath, {
1026
+ ...Option.match(command.maybeSubmodelPath, {
1124
1027
  onNone: () => __foldkitBrandViewResult(([
1125
1028
  h.div([h.Class('text-2xs text-dt-muted font-mono')], [
1126
1029
  h.span([h.AriaHidden(true)], ['…']),
1127
1030
  h.span([h.Class('sr-only')], ['Destination pending']),
1128
1031
  ]),
1129
1032
  ]), "@foldkit/devtools/overlay.js#onNone~5"),
1130
- onSome: blockPath => __foldkitBrandViewResult((Array.match(blockPath, {
1033
+ onSome: submodelPath => __foldkitBrandViewResult((Array.match(submodelPath, {
1131
1034
  onEmpty: () => __foldkitBrandViewResult(([]), "@foldkit/devtools/overlay.js#onEmpty~6"),
1132
- onNonEmpty: blockPath => __foldkitBrandViewResult(([
1035
+ onNonEmpty: submodelPath => __foldkitBrandViewResult(([
1133
1036
  h.div([
1134
1037
  h.Class('text-2xs text-dt-muted font-mono truncate'),
1135
- ], [formatBlockPath(blockPath)]),
1038
+ ], [formatSubmodelPath(submodelPath)]),
1136
1039
  ]), "@foldkit/devtools/overlay.js#onNonEmpty~6"),
1137
1040
  })), "@foldkit/devtools/overlay.js#onSome~5"),
1138
1041
  }),
1139
1042
  ...Array.map(flattenCommand(command, index, expandedPaths), renderFlatNode),
1140
1043
  ]),
1141
1044
  copyPayloadButtonView(taggedPayload(command.name, command.args), `Command:${selectedIndex}:${index}`, copyStates, `Command ${index + 1} (${command.name}) payload`),
1142
- ])), "@foldkit/devtools/overlay.js#anonymous~86")))), "@foldkit/devtools/overlay.js#onNonEmpty~5"),
1045
+ ])), "@foldkit/devtools/overlay.js#anonymous~69")))), "@foldkit/devtools/overlay.js#onNonEmpty~5"),
1143
1046
  })), "@foldkit/devtools/overlay.js#commandsTabContent");
1144
1047
  const selectedMountActivity = (model) => {
1145
1048
  const selectedIndex = selectedHistoryIndex(model);
@@ -1182,7 +1085,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1182
1085
  h.span([h.Class(indexClass)], [globalThis.String(index + 1)]),
1183
1086
  h.div([h.Class('flex flex-col flex-1 min-w-0')], Array.map(flattenMount(mount, label, index, expandedPaths), renderFlatNode)),
1184
1087
  copyPayloadButtonView(taggedPayload(mount.name, mount.args), `Mount:${selectedIndex}:${label}:${index}`, copyStates, `${label} Mount ${index + 1} (${mount.name}) payload`),
1185
- ])), "@foldkit/devtools/overlay.js#anonymous~87")),
1088
+ ])), "@foldkit/devtools/overlay.js#anonymous~70")),
1186
1089
  ])), "@foldkit/devtools/overlay.js#mountListSection");
1187
1090
  const mountsTabContent = (starts, ends, expandedPaths, selectedIndex, copyStates) => {
1188
1091
  const hasAny = Array.isReadonlyArrayNonEmpty(starts) ||
@@ -1216,20 +1119,20 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1216
1119
  model.affectedPaths,
1217
1120
  selectedIndex,
1218
1121
  model.copyStates,
1219
- ])), "@foldkit/devtools/overlay.js#anonymous~88")), Match.when('Message', () => __foldkitBrandViewResult((lazyTabContent('Message', messageTabContent, [
1122
+ ])), "@foldkit/devtools/overlay.js#anonymous~71")), Match.when('Message', () => __foldkitBrandViewResult((lazyTabContent('Message', messageTabContent, [
1220
1123
  model.maybeInspectedMessage,
1221
- model.maybeBlockFilter,
1124
+ model.maybeSubmodelFilter,
1222
1125
  model.isFlattened,
1223
1126
  model.expandedPaths,
1224
1127
  inspectedTimestamp(model),
1225
1128
  selectedIndex,
1226
1129
  model.copyStates,
1227
- ])), "@foldkit/devtools/overlay.js#anonymous~89")), Match.when('Commands', () => __foldkitBrandViewResult((lazyTabContent('Commands', commandsTabContent, [
1130
+ ])), "@foldkit/devtools/overlay.js#anonymous~72")), Match.when('Commands', () => __foldkitBrandViewResult((lazyTabContent('Commands', commandsTabContent, [
1228
1131
  selectedCommands(model),
1229
1132
  model.expandedPaths,
1230
1133
  selectedIndex,
1231
1134
  model.copyStates,
1232
- ])), "@foldkit/devtools/overlay.js#anonymous~90")), Match.when('Mounts', () => {
1135
+ ])), "@foldkit/devtools/overlay.js#anonymous~73")), Match.when('Mounts', () => {
1233
1136
  const { starts, ends } = selectedMountActivity(model);
1234
1137
  return __foldkitBrandViewResult((lazyTabContent('Mounts', mountsTabContent, [
1235
1138
  starts,
@@ -1237,15 +1140,16 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1237
1140
  model.expandedPaths,
1238
1141
  selectedIndex,
1239
1142
  model.copyStates,
1240
- ])), "@foldkit/devtools/overlay.js#anonymous~91");
1143
+ ])), "@foldkit/devtools/overlay.js#anonymous~74");
1241
1144
  }), Match.exhaustive)), "@foldkit/devtools/overlay.js#inspectorTabContent");
1242
1145
  };
1243
1146
  const inspectorPaneView = (model) => __foldkitBrandViewResult((h.div([
1244
1147
  h.Class('flex flex-col border-l min-w-0 min-h-0 flex-1 dt-inspector-pane'),
1245
1148
  ], [
1246
- h.block(bindings.InspectorTabsBinding.embedView({
1149
+ h.submodel({
1247
1150
  slotId: model.inspectorTabs.id,
1248
1151
  model: model.inspectorTabs,
1152
+ view: InspectorTabs.view,
1249
1153
  viewInputs: {
1250
1154
  tabs: INSPECTOR_TABS,
1251
1155
  selectedValue: model.activeInspectorTab,
@@ -1257,7 +1161,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1257
1161
  h.Class(clsx('dt-tab-button cursor-pointer text-base font-mono px-3 py-1', tab.isActive
1258
1162
  ? 'text-dt dt-tab-active'
1259
1163
  : 'text-dt-muted')),
1260
- ], [h.span([], [tab.value])])), "@foldkit/devtools/overlay.js#anonymous~92"))),
1164
+ ], [h.span([], [tab.value])])), "@foldkit/devtools/overlay.js#anonymous~75"))),
1261
1165
  ...tabs.map(tab => __foldkitBrandViewResult((h.div([
1262
1166
  ...tab.panel,
1263
1167
  h.Class('flex flex-col flex-1 min-h-0 min-w-0'),
@@ -1270,17 +1174,19 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1270
1174
  onNone: () => __foldkitBrandViewResult((emptyInspectorView), "@foldkit/devtools/overlay.js#onNone~7"),
1271
1175
  onSome: inspectedModel => __foldkitBrandViewResult((inspectorTabContent(model, tab.value, inspectedModel)), "@foldkit/devtools/overlay.js#onSome~7"),
1272
1176
  }),
1273
- ])), "@foldkit/devtools/overlay.js#anonymous~93")),
1177
+ ])), "@foldkit/devtools/overlay.js#anonymous~76")),
1274
1178
  ])), "@foldkit/devtools/overlay.js#toView"),
1275
1179
  },
1276
- })),
1180
+ toParentMessage: message => __foldkitBrandViewResult((Message.GotInspectorTabsMessage({ message })), "@foldkit/devtools/overlay.js#toParentMessage~5"),
1181
+ }),
1277
1182
  ])), "@foldkit/devtools/overlay.js#inspectorPaneView");
1278
- const badgeView = (isOpen, isPaused) => __foldkitBrandViewResult((h.button([
1279
- h.Class(clsx('fixed bg-dt-bg text-dt cursor-pointer flex flex-col items-center justify-center font-mono outline-none dt-badge', BADGE_POSITION_CLASS[position], isPaused ? 'dt-badge-paused' : 'dt-badge-accent')),
1183
+ // MESSAGE LIST
1184
+ const badgeView = (model) => __foldkitBrandViewResult((h.button([
1185
+ h.Class(clsx('fixed bg-dt-bg text-dt cursor-pointer flex flex-col items-center justify-center font-mono outline-none dt-badge', BADGE_POSITION_CLASS[position], model.isPaused ? 'dt-badge-paused' : 'dt-badge-accent')),
1280
1186
  h.Style({ width: '22px', height: '56px', fontSize: '10px' }),
1281
1187
  h.OnClick(Message.ClickedToggle()),
1282
1188
  ], [
1283
- isOpen
1189
+ model.isOpen
1284
1190
  ? h.svg([
1285
1191
  h.AriaHidden(true),
1286
1192
  h.Xmlns('http://www.w3.org/2000/svg'),
@@ -1297,7 +1203,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1297
1203
  ]),
1298
1204
  ])
1299
1205
  : h.div([
1300
- h.Class(clsx('flex flex-col items-center gap-0.5 font-semibold tracking-wider leading-none', isPaused ? 'text-dt-bg' : 'text-dt-muted')),
1206
+ h.Class(clsx('flex flex-col items-center gap-0.5 font-semibold tracking-wider leading-none', model.isPaused ? 'text-dt-bg' : 'text-dt-muted')),
1301
1207
  ], [h.span([], ['D']), h.span([], ['E']), h.span([], ['V'])]),
1302
1208
  ])), "@foldkit/devtools/overlay.js#badgeView");
1303
1209
  const headerClass = 'flex items-center justify-between px-3 py-1.5 border-b shrink-0';
@@ -1320,7 +1226,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1320
1226
  h.StrokeLinejoin('round'),
1321
1227
  ]),
1322
1228
  ]);
1323
- 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");
1324
1230
  const ARROW_UP = 'M4.5 10.5L12 3m0 0l7.5 7.5M12 3v18';
1325
1231
  const arrowUpIconView = h.svg([
1326
1232
  h.AriaHidden(true),
@@ -1341,17 +1247,18 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1341
1247
  arrowUpIconView,
1342
1248
  h.span([h.Class('dt-scroll-pill-text')], ['Jump to top']),
1343
1249
  ])), "@foldkit/devtools/overlay.js#scrollToTopPillView");
1344
- const blockFilterView = (model) => {
1345
- const buttonLabel = Option.match(model.maybeBlockFilter, {
1250
+ const submodelFilterView = (model) => {
1251
+ const buttonLabel = Option.match(model.maybeSubmodelFilter, {
1346
1252
  onNone: () => __foldkitBrandViewResult(('All Messages'), "@foldkit/devtools/overlay.js#onNone~8"),
1347
- onSome: blockSegmentLabel,
1253
+ onSome: submodelSegmentLabel,
1348
1254
  });
1349
- return __foldkitBrandViewResult((h.block(bindings.BlockFilterListboxBinding.embedView({
1350
- slotId: 'block-filter',
1351
- model: model.blockFilterListbox,
1255
+ return __foldkitBrandViewResult((h.submodel({
1256
+ slotId: 'submodel-filter',
1257
+ model: model.submodelFilterListbox,
1258
+ view: SubmodelFilterListbox.view,
1352
1259
  viewInputs: {
1353
- items: [ALL_MESSAGES_VALUE, ...model.blockTags],
1354
- maybeSelectedValue: Option.orElseSome(model.maybeBlockFilter, () => __foldkitBrandViewResult((ALL_MESSAGES_VALUE), "@foldkit/devtools/overlay.js#anonymous~94")),
1260
+ items: [ALL_MESSAGES_VALUE, ...model.submodelTags],
1261
+ maybeSelectedValue: Option.orElseSome(model.maybeSubmodelFilter, () => __foldkitBrandViewResult((ALL_MESSAGES_VALUE), "@foldkit/devtools/overlay.js#anonymous~77")),
1355
1262
  itemToConfig: item => (__foldkitBrandViewResult(({
1356
1263
  className: 'dt-filter-item',
1357
1264
  content: h.div([h.Class('flex items-center gap-2')], [checkIconView, h.span([], [filterItemLabel(item)])]),
@@ -1379,11 +1286,13 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1379
1286
  className: 'dt-filter-wrapper',
1380
1287
  backdropClassName: 'dt-filter-backdrop',
1381
1288
  },
1382
- }))), "@foldkit/devtools/overlay.js#blockFilterView");
1289
+ toParentMessage: message => __foldkitBrandViewResult((Message.GotSubmodelFilterMessage({ message })), "@foldkit/devtools/overlay.js#toParentMessage~6"),
1290
+ })), "@foldkit/devtools/overlay.js#submodelFilterView");
1383
1291
  };
1384
- const flattenSwitchView = (isFlattened) => __foldkitBrandViewResult((Switch.view({
1292
+ // SETTINGS
1293
+ const flattenSwitchView = (model) => __foldkitBrandViewResult((Switch.view({
1385
1294
  id: FLATTEN_SWITCH_ID,
1386
- isChecked: isFlattened,
1295
+ isChecked: model.isFlattened,
1387
1296
  hasDescription: true,
1388
1297
  onToggle: isFlattened => __foldkitBrandViewResult((Message.ToggledFlatten({ isFlattened })), "@foldkit/devtools/overlay.js#onToggle"),
1389
1298
  toView: attributes => __foldkitBrandViewResult((h.div([h.Class('dt-settings-row')], [
@@ -1397,10 +1306,10 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1397
1306
  ]),
1398
1307
  ])), "@foldkit/devtools/overlay.js#toView~2"),
1399
1308
  }, h)), "@foldkit/devtools/overlay.js#flattenSwitchView");
1400
- const settingsScreenView = (isFlattened) => __foldkitBrandViewResult((h.div([h.Class('flex flex-col flex-1 min-h-0 overflow-y-auto overscroll-none')], [
1309
+ const settingsScreenView = (model) => __foldkitBrandViewResult((h.div([h.Class('flex flex-col flex-1 min-h-0 overflow-y-auto overscroll-none')], [
1401
1310
  h.div([h.Class('flex flex-col')], [
1402
1311
  h.span([h.Class('dt-settings-section-title')], ['Message List']),
1403
- flattenSwitchView(isFlattened),
1312
+ flattenSwitchView(model),
1404
1313
  ]),
1405
1314
  ])), "@foldkit/devtools/overlay.js#settingsScreenView");
1406
1315
  const headerView = (model) => {
@@ -1419,7 +1328,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1419
1328
  : {
1420
1329
  status: h.span([h.Class(`${statusClass} text-dt-live font-medium`)], ['Live']),
1421
1330
  maybeAction: Option.none(),
1422
- }), "@foldkit/devtools/overlay.js#anonymous~95")), Match.when('Inspect', () => (__foldkitBrandViewResult(({
1331
+ }), "@foldkit/devtools/overlay.js#anonymous~78")), Match.when('Inspect', () => (__foldkitBrandViewResult(({
1423
1332
  status: h.span([h.Class(`${statusClass} text-dt-accent`)], [
1424
1333
  model.selectedIndex === INIT_INDEX
1425
1334
  ? 'Inspecting (init)'
@@ -1429,17 +1338,19 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1429
1338
  h.Class(actionButtonClass),
1430
1339
  h.OnClick(Message.ClickedFollowLatest()),
1431
1340
  ], ['Follow Latest →'])),
1432
- }), "@foldkit/devtools/overlay.js#anonymous~96"))), Match.exhaustive);
1433
- const clearHistoryButtons = Array.filter([clearHistoryButton()], () => __foldkitBrandViewResult((!model.isPaused), "@foldkit/devtools/overlay.js#anonymous~97"));
1434
- 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");
1435
1348
  };
1436
1349
  const initRowView = (isSelected, isPausedHere) => __foldkitBrandViewResult((h.keyed('li')('init', [
1437
1350
  h.Class(clsx(ROW_BASE, { selected: isSelected })),
1438
1351
  h.OnClick(Message.ClickedRow({ index: INIT_INDEX })),
1439
1352
  ], [
1440
- ...Array.filter([
1441
- h.span([h.Class('pause-column')], isPausedHere ? [pauseIconView] : []),
1442
- ], () => __foldkitBrandViewResult((mode === 'TimeTravel'), "@foldkit/devtools/overlay.js#anonymous~98")),
1353
+ ...OptionExt.when(mode === 'TimeTravel', h.span([h.Class('pause-column')], isPausedHere ? [pauseIconView] : [])).pipe(Option.toArray),
1443
1354
  h.span([h.Class('dot-column')]),
1444
1355
  h.span([h.Class(indexClass)]),
1445
1356
  h.span([h.Class('text-base text-dt-muted font-mono')], ['init']),
@@ -1463,9 +1374,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1463
1374
  h.Class(clsx(ROW_BASE, { selected: isSelected })),
1464
1375
  h.OnClick(Message.ClickedRow({ index: absoluteIndex })),
1465
1376
  ], [
1466
- ...Array.filter([
1467
- h.span([h.Class('pause-column')], isPausedHere ? [pauseIconView] : []),
1468
- ], () => __foldkitBrandViewResult((mode === 'TimeTravel'), "@foldkit/devtools/overlay.js#anonymous~99")),
1377
+ ...OptionExt.when(mode === 'TimeTravel', h.span([h.Class('pause-column')], isPausedHere ? [pauseIconView] : [])).pipe(Option.toArray),
1469
1378
  h.span([h.Class('dot-column')], isModelChanged ? [inlineDiffDotView] : []),
1470
1379
  h.span([h.Class(indexClass)], [globalThis.String(absoluteIndex + 1)]),
1471
1380
  h.span([h.Class('text-base text-dt font-mono flex-1 truncate')], [tag]),
@@ -1480,7 +1389,7 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1480
1389
  }));
1481
1390
  const isInitSelected = selectedIndex === INIT_INDEX;
1482
1391
  const isFiltered = Option.isSome(maybeFilterTag);
1483
- const leafOrTag = (entry) => __foldkitBrandViewResult((Option.getOrElse(entry.maybeLeafTag, () => __foldkitBrandViewResult((entry.tag), "@foldkit/devtools/overlay.js#anonymous~100"))), "@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");
1484
1393
  const displayTagFor = (entry) => {
1485
1394
  if (isFlattened) {
1486
1395
  return __foldkitBrandViewResult((leafOrTag(entry)), "@foldkit/devtools/overlay.js#displayTagFor");
@@ -1488,15 +1397,15 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1488
1397
  else {
1489
1398
  return __foldkitBrandViewResult((Option.match(maybeFilterTag, {
1490
1399
  onNone: () => __foldkitBrandViewResult((entry.tag), "@foldkit/devtools/overlay.js#onNone~10"),
1491
- onSome: filterTag => __foldkitBrandViewResult((pipe(entry.blockPath, Array.findFirstIndex(pathTag => __foldkitBrandViewResult((pathTag === filterTag), "@foldkit/devtools/overlay.js#anonymous~101")), Option.flatMap(filterIndex => __foldkitBrandViewResult((Array.get(entry.blockPath, Number.increment(filterIndex))), "@foldkit/devtools/overlay.js#anonymous~102")), Option.orElse(() => __foldkitBrandViewResult((entry.maybeLeafTag), "@foldkit/devtools/overlay.js#anonymous~103")), Option.getOrElse(() => __foldkitBrandViewResult((entry.tag), "@foldkit/devtools/overlay.js#anonymous~104")))), "@foldkit/devtools/overlay.js#onSome~9"),
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"),
1492
1401
  })), "@foldkit/devtools/overlay.js#displayTagFor");
1493
1402
  }
1494
1403
  };
1495
1404
  const indexedEntries = pipe(entries, Array.map((entry, arrayIndex) => (__foldkitBrandViewResult(({
1496
1405
  entry,
1497
1406
  absoluteIndex: startIndex + arrayIndex,
1498
- }), "@foldkit/devtools/overlay.js#anonymous~105"))), isFiltered
1499
- ? Array.filter(({ entry }) => __foldkitBrandViewResult((Array.contains(entry.blockPath, maybeFilterTag.value)), "@foldkit/devtools/overlay.js#anonymous~106"))
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"))
1500
1409
  : Function.identity);
1501
1410
  const messageRows = pipe(indexedEntries, Array.map(({ entry, absoluteIndex }) => {
1502
1411
  const isSelected = selectedIndex === absoluteIndex;
@@ -1509,11 +1418,11 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1509
1418
  isPausedHere,
1510
1419
  entry.timestamp - baseTimestamp,
1511
1420
  entry.isModelChanged,
1512
- ])), "@foldkit/devtools/overlay.js#anonymous~107");
1421
+ ])), "@foldkit/devtools/overlay.js#anonymous~87");
1513
1422
  }), Array.reverse);
1514
1423
  return __foldkitBrandViewResult((h.ul([
1515
1424
  h.Class('message-list flex-1 overflow-y-auto min-h-0 overscroll-none'),
1516
- h.OnScroll(scrollTop => __foldkitBrandViewResult((Message.ScrolledMessageList({ scrollTop })), "@foldkit/devtools/overlay.js#anonymous~108")),
1425
+ h.OnScroll(scrollTop => __foldkitBrandViewResult((Message.ScrolledMessageList({ scrollTop })), "@foldkit/devtools/overlay.js#anonymous~88")),
1517
1426
  ], isFiltered
1518
1427
  ? messageRows
1519
1428
  : [
@@ -1529,18 +1438,20 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1529
1438
  selectedIndex,
1530
1439
  model.isPaused,
1531
1440
  model.pausedAtIndex,
1532
- model.maybeBlockFilter,
1441
+ model.maybeSubmodelFilter,
1533
1442
  model.isFlattened,
1534
1443
  ])), "@foldkit/devtools/overlay.js#messageListView");
1535
1444
  };
1536
- const scrubberPositionLabel = (scrubberValue, entryCount) => {
1537
- const total = globalThis.String(entryCount).padStart(3, '0');
1538
- const current = globalThis.String(scrubberValue).padStart(3, '0');
1445
+ // SCRUBBER
1446
+ const scrubberPositionLabel = (model) => {
1447
+ const total = globalThis.String(model.entries.length).padStart(3, '0');
1448
+ const current = globalThis.String(model.scrubberValue).padStart(3, '0');
1539
1449
  return __foldkitBrandViewResult((`${current} / ${total}`), "@foldkit/devtools/overlay.js#scrubberPositionLabel");
1540
1450
  };
1541
- const scrubberView = (model) => __foldkitBrandViewResult((h.block(bindings.ScrubberSliderBinding.embedView({
1451
+ const scrubberView = (model) => __foldkitBrandViewResult((h.submodel({
1542
1452
  slotId: model.scrubberSlider.id,
1543
1453
  model: model.scrubberSlider,
1454
+ view: Slider.view,
1544
1455
  viewInputs: {
1545
1456
  value: model.scrubberValue,
1546
1457
  ariaLabel: 'Session scrubber',
@@ -1564,12 +1475,12 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1564
1475
  ]),
1565
1476
  h.span([
1566
1477
  h.Class('dt-scrubber-position text-2xs text-dt-muted font-mono shrink-0 tabular-nums'),
1567
- ], [
1568
- scrubberPositionLabel(model.scrubberValue, model.entries.length),
1569
- ]),
1478
+ ], [scrubberPositionLabel(model)]),
1570
1479
  ])), "@foldkit/devtools/overlay.js#toView~3"),
1571
1480
  },
1572
- }))), "@foldkit/devtools/overlay.js#scrubberView");
1481
+ toParentMessage: message => __foldkitBrandViewResult((Message.GotScrubberSliderMessage({ message })), "@foldkit/devtools/overlay.js#toParentMessage~7"),
1482
+ })), "@foldkit/devtools/overlay.js#scrubberView");
1483
+ // FOOTER
1573
1484
  const isScrubberVisible = mode === 'TimeTravel';
1574
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';
1575
1486
  const GEAR_INNER = 'M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z';
@@ -1624,38 +1535,40 @@ const buildOverlayView = (position, mode, shadow, maybeBanner, bindings, h) => {
1624
1535
  h.Class('dt-footer flex items-center gap-3 px-3 py-2 border-t shrink-0'),
1625
1536
  ], [
1626
1537
  settingsToggleView(model.screen),
1627
- ...Array.filter([scrubberView(model)], () => __foldkitBrandViewResult((isScrubberVisible), "@foldkit/devtools/overlay.js#anonymous~109")),
1538
+ ...OptionExt.when(isScrubberVisible, scrubberView(model)).pipe(Option.toArray),
1628
1539
  ])), "@foldkit/devtools/overlay.js#footerView");
1540
+ // PANEL
1629
1541
  const messagesScreenView = (model) => {
1630
- const blockFilterViews = Array.filter([blockFilterView(model)], () => __foldkitBrandViewResult((Array.isReadonlyArrayNonEmpty(model.blockTags)), "@foldkit/devtools/overlay.js#anonymous~110"));
1631
- const scrollToTopPillViews = Array.filter([scrollToTopPillView()], () => __foldkitBrandViewResult((!model.isFollowingTop), "@foldkit/devtools/overlay.js#anonymous~111"));
1542
+ const maybeSubmodelFilterView = OptionExt.when(Array.isReadonlyArrayNonEmpty(model.submodelTags), submodelFilterView(model));
1543
+ const maybeScrollToTopPillView = OptionExt.when(!model.isFollowingTop, scrollToTopPillView());
1632
1544
  return __foldkitBrandViewResult((h.div([h.Class('flex flex-1 min-h-0 dt-content')], [
1633
1545
  h.div([h.Class('flex flex-col min-h-0 dt-message-pane')], [
1634
- ...blockFilterViews,
1635
- ...scrollToTopPillViews,
1546
+ ...Option.toArray(maybeSubmodelFilterView),
1547
+ ...Option.toArray(maybeScrollToTopPillView),
1636
1548
  messageListView(model),
1637
1549
  ]),
1638
1550
  inspectorPaneView(model),
1639
1551
  ])), "@foldkit/devtools/overlay.js#messagesScreenView");
1640
1552
  };
1641
- const contentView = (model) => __foldkitBrandViewResult((Match.value(model.screen).pipe(Match.withReturnType(), Match.when('Messages', () => __foldkitBrandViewResult((messagesScreenView(model)), "@foldkit/devtools/overlay.js#anonymous~112")), Match.when('Settings', () => __foldkitBrandViewResult((settingsScreenView(model.isFlattened)), "@foldkit/devtools/overlay.js#anonymous~113")), 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");
1642
1554
  const panelView = (model) => __foldkitBrandViewResult((h.div([
1643
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])),
1644
1556
  ], [
1645
1557
  ...Option.map(maybeBanner, banner => __foldkitBrandViewResult((h.div([
1646
1558
  h.Class('px-3 py-2 border-b text-sm text-dt-muted font-mono shrink-0 leading-snug'),
1647
- ], [banner])), "@foldkit/devtools/overlay.js#anonymous~114")).pipe(Option.toArray),
1559
+ ], [banner])), "@foldkit/devtools/overlay.js#anonymous~91")).pipe(Option.toArray),
1648
1560
  headerView(model),
1649
1561
  contentView(model),
1650
1562
  footerView(model),
1651
1563
  ])), "@foldkit/devtools/overlay.js#panelView");
1652
1564
  const interactionBlocker = () => __foldkitBrandViewResult((h.div([h.Class('dt-interaction-blocker')])), "@foldkit/devtools/overlay.js#interactionBlocker");
1653
- return __foldkitBrandViewResult((model => __foldkitBrandViewResult((h.div([], [
1654
- ...Array.filter([interactionBlocker()], () => __foldkitBrandViewResult((model.isPaused && mode === 'TimeTravel'), "@foldkit/devtools/overlay.js#anonymous~116")),
1655
- ...Array.filter([panelView(model)], () => __foldkitBrandViewResult((model.isOpen), "@foldkit/devtools/overlay.js#anonymous~117")),
1656
- badgeView(model.isOpen, model.isPaused),
1657
- ])), "@foldkit/devtools/overlay.js#anonymous~115")), "@foldkit/devtools/overlay.js#buildOverlayView");
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),
1568
+ badgeView(model),
1569
+ ])), "@foldkit/devtools/overlay.js#anonymous~92")), "@foldkit/devtools/overlay.js#buildOverlayView");
1658
1570
  };
1571
+ // CREATE
1659
1572
  const VIEW_TRANSITION_NAME = 'foldkit-devtools';
1660
1573
  const VIEW_TRANSITION_STYLE_ID = 'foldkit-devtools-view-transition';
1661
1574
  /**
@@ -1734,38 +1647,72 @@ const createShadowContainer = () => {
1734
1647
  return __foldkitBrandViewResult(({ container, shadow }), "@foldkit/devtools/overlay.js#createShadowContainer");
1735
1648
  };
1736
1649
  export const createOverlay = (store, position, mode, maybeBanner) => __foldkitBrandViewResult((Effect.gen(function* () {
1737
- const { container, shadow } = yield* Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((createShadowContainer()), "@foldkit/devtools/overlay.js#anonymous~120")), 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(() => {
1738
1651
  createdShadowContainer.shadow.host.remove();
1739
1652
  document.getElementById(VIEW_TRANSITION_STYLE_ID)?.remove();
1740
- })), "@foldkit/devtools/overlay.js#anonymous~121"));
1653
+ })), "@foldkit/devtools/overlay.js#anonymous~96"));
1741
1654
  container.id = '__foldkit_devtools_overlay__';
1742
- const ServicesLayer = Layer.mergeAll(Layer.succeed(StoreService, store), Layer.succeed(ShadowRootService, shadow), BrowserKeyValueStore.layerLocalStorage);
1743
1655
  const flags = Effect.gen(function* () {
1744
- const store = yield* StoreService;
1745
1656
  const storeState = yield* SubscriptionRef.get(store.stateRef);
1746
1657
  const { isOpen, isFlattened } = yield* readPersistedState;
1747
1658
  return __foldkitBrandViewResult(({
1748
- position,
1749
- mode,
1750
- maybeBanner,
1751
1659
  isOpen,
1752
1660
  isMobile: window.matchMedia(MOBILE_BREAKPOINT_QUERY).matches,
1753
1661
  isFlattened,
1754
1662
  ...toDisplayState(storeState),
1755
- }), "@foldkit/devtools/overlay.js#anonymous~123");
1663
+ }), "@foldkit/devtools/overlay.js#anonymous~98");
1756
1664
  });
1757
- const program = Program.makeElement({
1758
- 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,
1759
1707
  Flags,
1760
1708
  flags,
1709
+ init,
1710
+ update: makeUpdate(store, shadow, mode),
1711
+ view: makeView(position, mode, shadow, maybeBanner),
1761
1712
  container,
1713
+ subscriptions: makeOverlaySubscriptions(store, shadow),
1762
1714
  devTools: false,
1763
1715
  freezeModel: false,
1764
1716
  });
1765
- const AppLayer = Layer.mergeAll(Tabs.layer, Listbox.layer, Slider.layer);
1766
- const overlay = program.provide({
1767
- services: AppLayer,
1768
- runtime: ServicesLayer,
1769
- });
1770
- yield* Effect.forkScoped(overlay.start());
1717
+ yield* Effect.forkScoped(overlayRuntime.start());
1771
1718
  })), "@foldkit/devtools/overlay.js#createOverlay");