@foldkit/devtools 0.168.0-canary.d8b5fc47e803 → 0.168.0-canary.e1bac2b2ac98

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