@foldkit/ui 0.150.0 → 0.151.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/animation/update.d.ts +10 -9
  2. package/dist/animation/update.d.ts.map +1 -1
  3. package/dist/animation/update.js +27 -35
  4. package/dist/calendar/index.d.ts +100 -11
  5. package/dist/calendar/index.d.ts.map +1 -1
  6. package/dist/calendar/index.js +66 -80
  7. package/dist/checkbox/index.d.ts +3 -4
  8. package/dist/checkbox/index.d.ts.map +1 -1
  9. package/dist/checkbox/index.js +3 -4
  10. package/dist/combobox/multi.d.ts +40 -51
  11. package/dist/combobox/multi.d.ts.map +1 -1
  12. package/dist/combobox/multi.js +19 -16
  13. package/dist/combobox/shared.d.ts +20 -20
  14. package/dist/combobox/shared.d.ts.map +1 -1
  15. package/dist/combobox/shared.js +134 -128
  16. package/dist/combobox/single.d.ts +38 -51
  17. package/dist/combobox/single.d.ts.map +1 -1
  18. package/dist/combobox/single.js +21 -17
  19. package/dist/datePicker/index.d.ts +182 -15
  20. package/dist/datePicker/index.d.ts.map +1 -1
  21. package/dist/datePicker/index.js +37 -54
  22. package/dist/dialog/index.d.ts +45 -7
  23. package/dist/dialog/index.d.ts.map +1 -1
  24. package/dist/dialog/index.js +54 -49
  25. package/dist/disclosure/index.d.ts +3 -4
  26. package/dist/disclosure/index.d.ts.map +1 -1
  27. package/dist/disclosure/index.js +3 -4
  28. package/dist/dragAndDrop/index.d.ts +96 -7
  29. package/dist/dragAndDrop/index.d.ts.map +1 -1
  30. package/dist/dragAndDrop/index.js +49 -61
  31. package/dist/fileDrop/index.d.ts +26 -11
  32. package/dist/fileDrop/index.d.ts.map +1 -1
  33. package/dist/fileDrop/index.js +16 -23
  34. package/dist/listbox/multi.d.ts +39 -52
  35. package/dist/listbox/multi.d.ts.map +1 -1
  36. package/dist/listbox/multi.js +9 -7
  37. package/dist/listbox/shared.d.ts +14 -22
  38. package/dist/listbox/shared.d.ts.map +1 -1
  39. package/dist/listbox/shared.js +113 -114
  40. package/dist/listbox/single.d.ts +40 -55
  41. package/dist/listbox/single.d.ts.map +1 -1
  42. package/dist/listbox/single.js +8 -7
  43. package/dist/menu/index.d.ts +131 -37
  44. package/dist/menu/index.d.ts.map +1 -1
  45. package/dist/menu/index.js +111 -120
  46. package/dist/popover/index.d.ts +71 -10
  47. package/dist/popover/index.d.ts.map +1 -1
  48. package/dist/popover/index.js +80 -73
  49. package/dist/radioGroup/index.d.ts +31 -19
  50. package/dist/radioGroup/index.d.ts.map +1 -1
  51. package/dist/radioGroup/index.js +18 -18
  52. package/dist/slider/index.d.ts +44 -13
  53. package/dist/slider/index.d.ts.map +1 -1
  54. package/dist/slider/index.js +33 -38
  55. package/dist/switch/index.d.ts +3 -4
  56. package/dist/switch/index.d.ts.map +1 -1
  57. package/dist/switch/index.js +3 -4
  58. package/dist/tabs/index.d.ts +31 -17
  59. package/dist/tabs/index.d.ts.map +1 -1
  60. package/dist/tabs/index.js +17 -17
  61. package/dist/test/apps/disabledButton.d.ts +17 -17
  62. package/dist/test/apps/disabledButton.d.ts.map +1 -1
  63. package/dist/test/apps/disabledButton.js +6 -4
  64. package/dist/toast/index.d.ts +96 -100
  65. package/dist/toast/index.d.ts.map +1 -1
  66. package/dist/toast/update.d.ts +97 -100
  67. package/dist/toast/update.d.ts.map +1 -1
  68. package/dist/toast/update.js +60 -58
  69. package/dist/tooltip/index.d.ts +2 -1
  70. package/dist/tooltip/index.d.ts.map +1 -1
  71. package/dist/tooltip/index.js +1 -1
  72. package/dist/tooltip/tooltip.d.ts +5 -10
  73. package/dist/tooltip/tooltip.d.ts.map +1 -1
  74. package/dist/tooltip/tooltip.js +45 -48
  75. package/dist/virtualList/index.d.ts +30 -29
  76. package/dist/virtualList/index.d.ts.map +1 -1
  77. package/dist/virtualList/index.js +21 -21
  78. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
- import { Array, Effect, Equal, Match as M, Option, Predicate, Schema as S, String as Str, pipe, } from 'effect';
2
+ import { Array, Effect, Equal, Match as M, Number, Option, Predicate, Schema as S, String as Str, pipe, } from 'effect';
3
3
  import * as Command from 'foldkit/command';
4
4
  import * as Dom from 'foldkit/dom';
5
5
  import { defineMessageUnion } from 'foldkit/message';
@@ -187,47 +187,50 @@ export const DetectMovementOrAnimationEnd = Command.define('DetectMovementOrAnim
187
187
  }))))), "@foldkit/ui/listbox/shared.js#execute~8"),
188
188
  });
189
189
  export const makeUpdate = (handleSelectedItem) => {
190
- const withUpdateReturn = M.withReturnType();
191
190
  const foldAnimationOutMessage = M.type().pipe(M.withReturnType(), M.tagsExhaustive({
192
- StartedLeaveAnimating: () => __foldkitBrandViewResult((model => __foldkitBrandViewResult(([
191
+ StartedLeaveAnimating: () => __foldkitBrandViewResult((model => (__foldkitBrandViewResult(({
193
192
  model,
194
- [DetectMovementOrAnimationEnd({ id: model.id })],
195
- ]), "@foldkit/ui/listbox/shared.js#anonymous")), "@foldkit/ui/listbox/shared.js#StartedLeaveAnimating"),
196
- TransitionedOut: () => __foldkitBrandViewResult((model => __foldkitBrandViewResult(([model, []]), "@foldkit/ui/listbox/shared.js#anonymous~2")), "@foldkit/ui/listbox/shared.js#TransitionedOut"),
193
+ commands: [DetectMovementOrAnimationEnd({ id: model.id })],
194
+ }), "@foldkit/ui/listbox/shared.js#anonymous"))), "@foldkit/ui/listbox/shared.js#StartedLeaveAnimating"),
195
+ TransitionedOut: () => __foldkitBrandViewResult((model => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/listbox/shared.js#anonymous~2"))), "@foldkit/ui/listbox/shared.js#TransitionedOut"),
197
196
  }));
198
197
  const foldAnimation = Update.foldChild({
199
198
  update: animationUpdate,
200
199
  read: (model) => __foldkitBrandViewResult((Option.some(model.animation)), "@foldkit/ui/listbox/shared.js#read"),
201
200
  write: (model, nextAnimation) => __foldkitBrandViewResult((constrainedEvo(model, { animation: () => __foldkitBrandViewResult((nextAnimation), "@foldkit/ui/listbox/shared.js#animation") })), "@foldkit/ui/listbox/shared.js#write"),
202
201
  toParentMessage: message => __foldkitBrandViewResult((Message.GotAnimationMessage({ message })), "@foldkit/ui/listbox/shared.js#toParentMessage"),
203
- toParentOutMessage: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/listbox/shared.js#toParentOutMessage"),
204
202
  foldOutMessage: foldAnimationOutMessage,
205
203
  });
206
204
  const openListbox = (baseModel, openCommands) => {
207
205
  if (baseModel.isAnimated) {
208
- const [nextModel, animationCommands] = foldAnimation(baseModel, AnimationMessage.Showed());
209
- return __foldkitBrandViewResult(([
210
- constrainedEvo(nextModel, { isOpen: () => __foldkitBrandViewResult((true), "@foldkit/ui/listbox/shared.js#isOpen~2") }),
211
- [...openCommands, ...animationCommands],
212
- Option.none(),
213
- ]), "@foldkit/ui/listbox/shared.js#openListbox");
206
+ return __foldkitBrandViewResult((Update.combine(baseModel, [
207
+ stepModel => (__foldkitBrandViewResult(({
208
+ model: stepModel,
209
+ commands: openCommands,
210
+ }), "@foldkit/ui/listbox/shared.js#anonymous~3")),
211
+ foldAnimation(AnimationMessage.Showed()),
212
+ stepModel => (__foldkitBrandViewResult(({
213
+ model: constrainedEvo(stepModel, { isOpen: () => __foldkitBrandViewResult((true), "@foldkit/ui/listbox/shared.js#isOpen~2") }),
214
+ }), "@foldkit/ui/listbox/shared.js#anonymous~4")),
215
+ ])), "@foldkit/ui/listbox/shared.js#openListbox");
214
216
  }
215
- return __foldkitBrandViewResult(([
216
- constrainedEvo(baseModel, { isOpen: () => __foldkitBrandViewResult((true), "@foldkit/ui/listbox/shared.js#isOpen~3") }),
217
- openCommands,
218
- Option.none(),
219
- ]), "@foldkit/ui/listbox/shared.js#openListbox");
217
+ return __foldkitBrandViewResult(({
218
+ model: constrainedEvo(baseModel, { isOpen: () => __foldkitBrandViewResult((true), "@foldkit/ui/listbox/shared.js#isOpen~3") }),
219
+ commands: openCommands,
220
+ }), "@foldkit/ui/listbox/shared.js#openListbox");
220
221
  };
221
- const closeListbox = (baseModel, commands, maybeOutMessage = Option.none()) => {
222
+ const closeListbox = (baseModel, commands) => {
222
223
  if (!baseModel.isOpen) {
223
- return __foldkitBrandViewResult(([baseModel, [], maybeOutMessage]), "@foldkit/ui/listbox/shared.js#closeListbox");
224
+ return __foldkitBrandViewResult(({ model: baseModel }), "@foldkit/ui/listbox/shared.js#closeListbox");
224
225
  }
225
226
  const closed = closedModel(baseModel);
226
227
  if (baseModel.isAnimated) {
227
- const [nextModel, animationCommands] = foldAnimation(closed, AnimationMessage.Hid());
228
- return __foldkitBrandViewResult(([nextModel, [...commands, ...animationCommands], maybeOutMessage]), "@foldkit/ui/listbox/shared.js#closeListbox");
228
+ return __foldkitBrandViewResult((Update.combine(closed, [
229
+ stepModel => (__foldkitBrandViewResult(({ model: stepModel, commands }), "@foldkit/ui/listbox/shared.js#anonymous~5")),
230
+ foldAnimation(AnimationMessage.Hid()),
231
+ ])), "@foldkit/ui/listbox/shared.js#closeListbox");
229
232
  }
230
- return __foldkitBrandViewResult(([closed, commands, maybeOutMessage]), "@foldkit/ui/listbox/shared.js#closeListbox");
233
+ return __foldkitBrandViewResult(({ model: closed, commands }), "@foldkit/ui/listbox/shared.js#closeListbox");
231
234
  };
232
235
  const internalUpdate = (model, message) => {
233
236
  const maybeLockScroll = OptionExt.when(model.isModal, LockScroll());
@@ -244,11 +247,20 @@ export const makeUpdate = (handleSelectedItem) => {
244
247
  focusButton,
245
248
  ...Array.getSomes([maybeUnlockScroll, maybeRestoreInert]),
246
249
  ];
247
- const closeWithoutFocusCommands = Array.getSomes([
248
- maybeUnlockScroll,
249
- maybeRestoreInert,
250
- ]);
251
- return __foldkitBrandViewResult((M.value(message).pipe(withUpdateReturn, M.tag('CompletedLockScroll', 'CompletedUnlockScroll', 'CompletedInertOthers', 'CompletedRestoreInert', 'CompletedFocusButton', 'CompletedFocusItems', 'CompletedScrollIntoView', 'CompletedClickItem', 'SuppressedSpaceScroll', 'SuppressedItemCommit', 'CompletedAnchorListbox', 'CompletedPortalListboxBackdrop', () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/listbox/shared.js#anonymous~3")), M.tagsExhaustive({
250
+ const closeWithoutFocusCommands = Array.getSomes([maybeUnlockScroll, maybeRestoreInert]);
251
+ return __foldkitBrandViewResult((Message.match(message, {
252
+ CompletedLockScroll: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/listbox/shared.js#CompletedLockScroll")),
253
+ CompletedUnlockScroll: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/listbox/shared.js#CompletedUnlockScroll")),
254
+ CompletedInertOthers: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/listbox/shared.js#CompletedInertOthers")),
255
+ CompletedRestoreInert: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/listbox/shared.js#CompletedRestoreInert")),
256
+ CompletedFocusButton: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/listbox/shared.js#CompletedFocusButton")),
257
+ CompletedFocusItems: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/listbox/shared.js#CompletedFocusItems")),
258
+ CompletedScrollIntoView: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/listbox/shared.js#CompletedScrollIntoView")),
259
+ CompletedClickItem: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/listbox/shared.js#CompletedClickItem")),
260
+ SuppressedSpaceScroll: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/listbox/shared.js#SuppressedSpaceScroll")),
261
+ SuppressedItemCommit: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/listbox/shared.js#SuppressedItemCommit")),
262
+ CompletedAnchorListbox: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/listbox/shared.js#CompletedAnchorListbox")),
263
+ CompletedPortalListboxBackdrop: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/listbox/shared.js#CompletedPortalListboxBackdrop")),
252
264
  Opened: ({ maybeActiveItemIndex }) => __foldkitBrandViewResult((openListbox(constrainedEvo(model, {
253
265
  maybeActiveItemIndex: () => __foldkitBrandViewResult((maybeActiveItemIndex), "@foldkit/ui/listbox/shared.js#maybeActiveItemIndex~2"),
254
266
  activationTrigger: () => __foldkitBrandViewResult((Option.match(maybeActiveItemIndex, {
@@ -262,75 +274,64 @@ export const makeUpdate = (handleSelectedItem) => {
262
274
  Closed: () => __foldkitBrandViewResult((closeListbox(model, closeWithFocusCommands)), "@foldkit/ui/listbox/shared.js#Closed"),
263
275
  BlurredItems: () => {
264
276
  if (Option.exists(model.maybeLastButtonPointerType, Equal.equals('mouse'))) {
265
- return __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/listbox/shared.js#BlurredItems");
277
+ return __foldkitBrandViewResult(({ model }), "@foldkit/ui/listbox/shared.js#BlurredItems");
266
278
  }
267
279
  return __foldkitBrandViewResult((closeListbox(model, closeWithoutFocusCommands)), "@foldkit/ui/listbox/shared.js#BlurredItems");
268
280
  },
269
- ActivatedItem: ({ index, activationTrigger }) => __foldkitBrandViewResult(([
270
- constrainedEvo(model, {
281
+ ActivatedItem: ({ index, activationTrigger }) => (__foldkitBrandViewResult(({
282
+ model: constrainedEvo(model, {
271
283
  maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.some(index)), "@foldkit/ui/listbox/shared.js#maybeActiveItemIndex~3"),
272
284
  activationTrigger: () => __foldkitBrandViewResult((activationTrigger), "@foldkit/ui/listbox/shared.js#activationTrigger~2"),
273
285
  }),
274
- activationTrigger === 'Keyboard'
286
+ commands: activationTrigger === 'Keyboard'
275
287
  ? [ScrollIntoView({ id: model.id, index })]
276
288
  : [],
277
- Option.none(),
278
- ]), "@foldkit/ui/listbox/shared.js#ActivatedItem"),
289
+ }), "@foldkit/ui/listbox/shared.js#ActivatedItem")),
279
290
  MovedPointerOverItem: ({ index, screenX, screenY }) => {
280
- const isSamePosition = Option.exists(model.maybeLastPointerPosition, position => __foldkitBrandViewResult((position.screenX === screenX && position.screenY === screenY), "@foldkit/ui/listbox/shared.js#anonymous~4"));
291
+ const isSamePosition = Option.exists(model.maybeLastPointerPosition, position => __foldkitBrandViewResult((position.screenX === screenX && position.screenY === screenY), "@foldkit/ui/listbox/shared.js#anonymous~6"));
281
292
  if (isSamePosition) {
282
- return __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/listbox/shared.js#MovedPointerOverItem");
293
+ return __foldkitBrandViewResult(({ model }), "@foldkit/ui/listbox/shared.js#MovedPointerOverItem");
283
294
  }
284
- return __foldkitBrandViewResult(([
285
- constrainedEvo(model, {
295
+ return __foldkitBrandViewResult(({
296
+ model: constrainedEvo(model, {
286
297
  maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.some(index)), "@foldkit/ui/listbox/shared.js#maybeActiveItemIndex~4"),
287
298
  activationTrigger: () => __foldkitBrandViewResult(('Pointer'), "@foldkit/ui/listbox/shared.js#activationTrigger~3"),
288
299
  maybeLastPointerPosition: () => __foldkitBrandViewResult((Option.some({ screenX, screenY })), "@foldkit/ui/listbox/shared.js#maybeLastPointerPosition~3"),
289
300
  }),
290
- [],
291
- Option.none(),
292
- ]), "@foldkit/ui/listbox/shared.js#MovedPointerOverItem");
301
+ }), "@foldkit/ui/listbox/shared.js#MovedPointerOverItem");
293
302
  },
294
303
  DeactivatedItem: () => __foldkitBrandViewResult((model.activationTrigger === 'Pointer'
295
- ? [
296
- constrainedEvo(model, {
304
+ ? {
305
+ model: constrainedEvo(model, {
297
306
  maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/listbox/shared.js#maybeActiveItemIndex~5"),
298
307
  }),
299
- [],
300
- Option.none(),
301
- ]
302
- : [model, [], Option.none()]), "@foldkit/ui/listbox/shared.js#DeactivatedItem"),
308
+ }
309
+ : { model }), "@foldkit/ui/listbox/shared.js#DeactivatedItem"),
303
310
  SelectedItem: ({ item }) => __foldkitBrandViewResult((handleSelectedItem(model, item, {
304
- closeWithFocus: (closeModel, maybeOutMessage = Option.none()) => __foldkitBrandViewResult((closeListbox(closeModel, closeWithFocusCommands, maybeOutMessage)), "@foldkit/ui/listbox/shared.js#closeWithFocus"),
305
- closeWithoutFocus: (closeModel, maybeOutMessage = Option.none()) => __foldkitBrandViewResult((closeListbox(closeModel, closeWithoutFocusCommands, maybeOutMessage)), "@foldkit/ui/listbox/shared.js#closeWithoutFocus"),
311
+ closeWithFocus: (closeModel, outMessage) => __foldkitBrandViewResult((pipe(closeListbox(closeModel, closeWithFocusCommands), Update.withOutMessage(outMessage))), "@foldkit/ui/listbox/shared.js#closeWithFocus"),
312
+ closeWithoutFocus: (closeModel, outMessage) => __foldkitBrandViewResult((pipe(closeListbox(closeModel, closeWithoutFocusCommands), Update.withOutMessage(outMessage))), "@foldkit/ui/listbox/shared.js#closeWithoutFocus"),
306
313
  })), "@foldkit/ui/listbox/shared.js#SelectedItem"),
307
- RequestedItemClick: ({ index }) => __foldkitBrandViewResult(([
314
+ RequestedItemClick: ({ index }) => (__foldkitBrandViewResult(({
308
315
  model,
309
- [ClickItem({ id: model.id, index })],
310
- Option.none(),
311
- ]), "@foldkit/ui/listbox/shared.js#RequestedItemClick"),
316
+ commands: [ClickItem({ id: model.id, index })],
317
+ }), "@foldkit/ui/listbox/shared.js#RequestedItemClick")),
312
318
  Searched: ({ key, maybeTargetIndex }) => {
313
319
  const nextSearchQuery = model.searchQuery + key;
314
- const nextSearchVersion = model.searchVersion + 1;
315
- return __foldkitBrandViewResult(([
316
- constrainedEvo(model, {
320
+ const nextSearchVersion = Number.increment(model.searchVersion);
321
+ return __foldkitBrandViewResult(({
322
+ model: constrainedEvo(model, {
317
323
  searchQuery: () => __foldkitBrandViewResult((nextSearchQuery), "@foldkit/ui/listbox/shared.js#searchQuery~3"),
318
324
  searchVersion: () => __foldkitBrandViewResult((nextSearchVersion), "@foldkit/ui/listbox/shared.js#searchVersion~3"),
319
- maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.orElse(maybeTargetIndex, () => __foldkitBrandViewResult((model.maybeActiveItemIndex), "@foldkit/ui/listbox/shared.js#anonymous~5"))), "@foldkit/ui/listbox/shared.js#maybeActiveItemIndex~6"),
325
+ maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.orElse(maybeTargetIndex, () => __foldkitBrandViewResult((model.maybeActiveItemIndex), "@foldkit/ui/listbox/shared.js#anonymous~7"))), "@foldkit/ui/listbox/shared.js#maybeActiveItemIndex~6"),
320
326
  }),
321
- [DelayClearSearch({ version: nextSearchVersion })],
322
- Option.none(),
323
- ]), "@foldkit/ui/listbox/shared.js#Searched");
327
+ commands: [DelayClearSearch({ version: nextSearchVersion })],
328
+ }), "@foldkit/ui/listbox/shared.js#Searched");
324
329
  },
325
330
  CompletedDelayClearSearch: ({ version }) => {
326
331
  if (version !== model.searchVersion) {
327
- return __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/listbox/shared.js#CompletedDelayClearSearch");
332
+ return __foldkitBrandViewResult(({ model }), "@foldkit/ui/listbox/shared.js#CompletedDelayClearSearch");
328
333
  }
329
- return __foldkitBrandViewResult(([
330
- constrainedEvo(model, { searchQuery: () => __foldkitBrandViewResult((''), "@foldkit/ui/listbox/shared.js#searchQuery~4") }),
331
- [],
332
- Option.none(),
333
- ]), "@foldkit/ui/listbox/shared.js#CompletedDelayClearSearch");
334
+ return __foldkitBrandViewResult(({ model: constrainedEvo(model, { searchQuery: () => __foldkitBrandViewResult((''), "@foldkit/ui/listbox/shared.js#searchQuery~4") }) }), "@foldkit/ui/listbox/shared.js#CompletedDelayClearSearch");
334
335
  },
335
336
  GotAnimationMessage: ({ message: animationMessage }) => __foldkitBrandViewResult((foldAnimation(model, animationMessage)), "@foldkit/ui/listbox/shared.js#GotAnimationMessage"),
336
337
  PressedPointerOnButton: ({ pointerType, button }) => {
@@ -338,17 +339,17 @@ export const makeUpdate = (handleSelectedItem) => {
338
339
  maybeLastButtonPointerType: () => __foldkitBrandViewResult((Option.some(pointerType)), "@foldkit/ui/listbox/shared.js#maybeLastButtonPointerType~2"),
339
340
  });
340
341
  if (pointerType !== 'mouse' || button !== LEFT_MOUSE_BUTTON) {
341
- return __foldkitBrandViewResult(([withPointerType, [], Option.none()]), "@foldkit/ui/listbox/shared.js#PressedPointerOnButton");
342
+ return __foldkitBrandViewResult(({ model: withPointerType }), "@foldkit/ui/listbox/shared.js#PressedPointerOnButton");
342
343
  }
343
344
  if (model.isOpen) {
344
- const [closed, commands] = closeListbox(withPointerType, closeWithFocusCommands);
345
- return __foldkitBrandViewResult(([
346
- constrainedEvo(closed, {
347
- maybeLastButtonPointerType: () => __foldkitBrandViewResult((Option.some(pointerType)), "@foldkit/ui/listbox/shared.js#maybeLastButtonPointerType~3"),
348
- }),
349
- commands,
350
- Option.none(),
351
- ]), "@foldkit/ui/listbox/shared.js#PressedPointerOnButton");
345
+ return __foldkitBrandViewResult((Update.combine(withPointerType, [
346
+ stepModel => __foldkitBrandViewResult((closeListbox(stepModel, closeWithFocusCommands)), "@foldkit/ui/listbox/shared.js#anonymous~8"),
347
+ stepModel => (__foldkitBrandViewResult(({
348
+ model: constrainedEvo(stepModel, {
349
+ maybeLastButtonPointerType: () => __foldkitBrandViewResult((Option.some(pointerType)), "@foldkit/ui/listbox/shared.js#maybeLastButtonPointerType~3"),
350
+ }),
351
+ }), "@foldkit/ui/listbox/shared.js#anonymous~9")),
352
+ ])), "@foldkit/ui/listbox/shared.js#PressedPointerOnButton");
352
353
  }
353
354
  return __foldkitBrandViewResult((openListbox(constrainedEvo(withPointerType, {
354
355
  maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/listbox/shared.js#maybeActiveItemIndex~7"),
@@ -358,14 +359,12 @@ export const makeUpdate = (handleSelectedItem) => {
358
359
  maybeLastPointerPosition: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/listbox/shared.js#maybeLastPointerPosition~4"),
359
360
  }), openCommands)), "@foldkit/ui/listbox/shared.js#PressedPointerOnButton");
360
361
  },
361
- IgnoredMouseClick: () => __foldkitBrandViewResult(([
362
- constrainedEvo(model, {
362
+ IgnoredMouseClick: () => (__foldkitBrandViewResult(({
363
+ model: constrainedEvo(model, {
363
364
  maybeLastButtonPointerType: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/listbox/shared.js#maybeLastButtonPointerType~4"),
364
365
  }),
365
- [],
366
- Option.none(),
367
- ]), "@foldkit/ui/listbox/shared.js#IgnoredMouseClick"),
368
- }))), "@foldkit/ui/listbox/shared.js#internalUpdate");
366
+ }), "@foldkit/ui/listbox/shared.js#IgnoredMouseClick")),
367
+ })), "@foldkit/ui/listbox/shared.js#internalUpdate");
369
368
  };
370
369
  return __foldkitBrandViewResult((internalUpdate), "@foldkit/ui/listbox/shared.js#makeUpdate");
371
370
  };
@@ -388,42 +387,42 @@ export const AnchorListbox = Mount.define('AnchorListbox', { buttonId: S.String,
388
387
  buttonId,
389
388
  anchor,
390
389
  focusAfterPosition: true,
391
- })), "@foldkit/ui/listbox/shared.js#anonymous~9")), cleanup => __foldkitBrandViewResult((Effect.sync(cleanup)), "@foldkit/ui/listbox/shared.js#anonymous~10"));
392
- return __foldkitBrandViewResult((Message.CompletedAnchorListbox()), "@foldkit/ui/listbox/shared.js#anonymous~8");
393
- })), "@foldkit/ui/listbox/shared.js#anonymous~7")), "@foldkit/ui/listbox/shared.js#anonymous~6"));
390
+ })), "@foldkit/ui/listbox/shared.js#anonymous~13")), cleanup => __foldkitBrandViewResult((Effect.sync(cleanup)), "@foldkit/ui/listbox/shared.js#anonymous~14"));
391
+ return __foldkitBrandViewResult((Message.CompletedAnchorListbox()), "@foldkit/ui/listbox/shared.js#anonymous~12");
392
+ })), "@foldkit/ui/listbox/shared.js#anonymous~11")), "@foldkit/ui/listbox/shared.js#anonymous~10"));
394
393
  /** The backdrop-portaling Mount this Listbox renders. Exposed so Scene tests can
395
394
  * call `Scene.Mount.resolve(PortalListboxBackdrop, CompletedPortalListboxBackdrop())` to
396
395
  * acknowledge the mount produced by the rendered backdrop. */
397
396
  export const PortalListboxBackdrop = Mount.define('PortalListboxBackdrop', Message.CompletedPortalListboxBackdrop)(element => __foldkitBrandViewResult((Effect.gen(function* () {
398
- yield* Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((portalToContainingRoot(element)), "@foldkit/ui/listbox/shared.js#anonymous~13")), cleanup => __foldkitBrandViewResult((Effect.sync(cleanup)), "@foldkit/ui/listbox/shared.js#anonymous~14"));
399
- return __foldkitBrandViewResult((Message.CompletedPortalListboxBackdrop()), "@foldkit/ui/listbox/shared.js#anonymous~12");
400
- })), "@foldkit/ui/listbox/shared.js#anonymous~11"));
397
+ yield* Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((portalToContainingRoot(element)), "@foldkit/ui/listbox/shared.js#anonymous~17")), cleanup => __foldkitBrandViewResult((Effect.sync(cleanup)), "@foldkit/ui/listbox/shared.js#anonymous~18"));
398
+ return __foldkitBrandViewResult((Message.CompletedPortalListboxBackdrop()), "@foldkit/ui/listbox/shared.js#anonymous~16");
399
+ })), "@foldkit/ui/listbox/shared.js#anonymous~15"));
401
400
  export const makeView = (behavior) => {
402
401
  const impl = defineView((model, viewInputs, h) => {
403
402
  const { id, isOpen, orientation, animation: { transitionState }, maybeActiveItemIndex, searchQuery, maybeLastButtonPointerType, } = model;
404
403
  const { items, itemToConfig, isItemDisabled, isButtonDisabled, buttonContent, buttonClassName, buttonAttributes = [], itemsClassName, itemsAttributes = [], itemsScrollClassName, itemsScrollAttributes = [], backdropClassName, backdropAttributes = [], className, attributes = [], itemGroupKey, groupToHeading, groupClassName, groupAttributes = [], separatorClassName, separatorAttributes = [], anchor = {}, name, form, isDisabled, isReadOnly = false, isInvalid, ariaLabel, ariaLabelledBy, selectedValues, } = viewInputs;
405
- const itemToValue = viewInputs.itemToValue ?? ((item) => __foldkitBrandViewResult((String(item)), "@foldkit/ui/listbox/shared.js#anonymous~16"));
404
+ const itemToValue = viewInputs.itemToValue ?? ((item) => __foldkitBrandViewResult((String(item)), "@foldkit/ui/listbox/shared.js#anonymous~20"));
406
405
  const isValueSelected = (itemValue) => __foldkitBrandViewResult((Array.contains(selectedValues, itemValue)), "@foldkit/ui/listbox/shared.js#isValueSelected");
407
- const itemToSearchText = viewInputs.itemToSearchText ?? ((item) => __foldkitBrandViewResult((itemToValue(item)), "@foldkit/ui/listbox/shared.js#anonymous~17"));
406
+ const itemToSearchText = viewInputs.itemToSearchText ?? ((item) => __foldkitBrandViewResult((itemToValue(item)), "@foldkit/ui/listbox/shared.js#anonymous~21"));
408
407
  const isLeaving = transitionState === 'LeaveStart' || transitionState === 'LeaveAnimating';
409
408
  const isVisible = isOpen || isLeaving;
410
409
  const animationAttributes = M.value(transitionState).pipe(M.when('EnterStart', () => __foldkitBrandViewResult(([
411
410
  h.DataAttribute('closed', ''),
412
411
  h.DataAttribute('enter', ''),
413
412
  h.DataAttribute('transition', ''),
414
- ]), "@foldkit/ui/listbox/shared.js#anonymous~18")), M.when('EnterAnimating', () => __foldkitBrandViewResult(([
413
+ ]), "@foldkit/ui/listbox/shared.js#anonymous~22")), M.when('EnterAnimating', () => __foldkitBrandViewResult(([
415
414
  h.DataAttribute('enter', ''),
416
415
  h.DataAttribute('transition', ''),
417
- ]), "@foldkit/ui/listbox/shared.js#anonymous~19")), M.when('LeaveStart', () => __foldkitBrandViewResult(([
416
+ ]), "@foldkit/ui/listbox/shared.js#anonymous~23")), M.when('LeaveStart', () => __foldkitBrandViewResult(([
418
417
  h.DataAttribute('leave', ''),
419
418
  h.DataAttribute('transition', ''),
420
- ]), "@foldkit/ui/listbox/shared.js#anonymous~20")), M.when('LeaveAnimating', () => __foldkitBrandViewResult(([
419
+ ]), "@foldkit/ui/listbox/shared.js#anonymous~24")), M.when('LeaveAnimating', () => __foldkitBrandViewResult(([
421
420
  h.DataAttribute('closed', ''),
422
421
  h.DataAttribute('leave', ''),
423
422
  h.DataAttribute('transition', ''),
424
- ]), "@foldkit/ui/listbox/shared.js#anonymous~21")), M.orElse(() => __foldkitBrandViewResult(([]), "@foldkit/ui/listbox/shared.js#anonymous~22")));
423
+ ]), "@foldkit/ui/listbox/shared.js#anonymous~25")), M.orElse(() => __foldkitBrandViewResult(([]), "@foldkit/ui/listbox/shared.js#anonymous~26")));
425
424
  const isItemDisabledByIndex = (index) => __foldkitBrandViewResult((Predicate.isNotUndefined(isItemDisabled) &&
426
- pipe(items, Array.get(index), Option.exists(item => __foldkitBrandViewResult((isItemDisabled(item, index)), "@foldkit/ui/listbox/shared.js#anonymous~23")))), "@foldkit/ui/listbox/shared.js#isItemDisabledByIndex");
425
+ pipe(items, Array.get(index), Option.exists(item => __foldkitBrandViewResult((isItemDisabled(item, index)), "@foldkit/ui/listbox/shared.js#anonymous~27")))), "@foldkit/ui/listbox/shared.js#isItemDisabledByIndex");
427
426
  const isButtonEffectivelyDisabled = isDisabled || isButtonDisabled;
428
427
  const nextKey = orientation === 'Horizontal' ? 'ArrowRight' : 'ArrowDown';
429
428
  const previousKey = orientation === 'Horizontal' ? 'ArrowLeft' : 'ArrowUp';
@@ -438,20 +437,20 @@ export const makeView = (behavior) => {
438
437
  const isNavigationKey = (key) => __foldkitBrandViewResult((Array.contains(navigationKeys, key)), "@foldkit/ui/listbox/shared.js#isNavigationKey");
439
438
  const firstEnabledIndex = findFirstEnabledIndex(items.length, 0, isItemDisabledByIndex)(0, 1);
440
439
  const lastEnabledIndex = findFirstEnabledIndex(items.length, 0, isItemDisabledByIndex)(items.length - 1, -1);
441
- const selectedItemIndex = pipe(selectedValues, Array.head, Option.flatMap(selectedValue => __foldkitBrandViewResult((Array.findFirstIndex(items, item => __foldkitBrandViewResult((itemToValue(item) === selectedValue), "@foldkit/ui/listbox/shared.js#anonymous~25"))), "@foldkit/ui/listbox/shared.js#anonymous~24")));
440
+ const selectedItemIndex = pipe(selectedValues, Array.head, Option.flatMap(selectedValue => __foldkitBrandViewResult((Array.findFirstIndex(items, item => __foldkitBrandViewResult((itemToValue(item) === selectedValue), "@foldkit/ui/listbox/shared.js#anonymous~29"))), "@foldkit/ui/listbox/shared.js#anonymous~28")));
442
441
  const handleButtonKeyDown = (key) => {
443
442
  if (isOpen) {
444
443
  return __foldkitBrandViewResult((handleItemsKeyDown(key)), "@foldkit/ui/listbox/shared.js#handleButtonKeyDown");
445
444
  }
446
445
  return __foldkitBrandViewResult((M.value(key).pipe(M.whenOr('Enter', ' ', 'ArrowDown', () => __foldkitBrandViewResult((Option.some(Message.Opened({
447
- maybeActiveItemIndex: Option.orElse(selectedItemIndex, () => __foldkitBrandViewResult((Option.some(firstEnabledIndex)), "@foldkit/ui/listbox/shared.js#anonymous~27")),
448
- }))), "@foldkit/ui/listbox/shared.js#anonymous~26")), M.when('ArrowUp', () => __foldkitBrandViewResult((Option.some(Message.Opened({
449
- maybeActiveItemIndex: Option.orElse(selectedItemIndex, () => __foldkitBrandViewResult((Option.some(lastEnabledIndex)), "@foldkit/ui/listbox/shared.js#anonymous~29")),
450
- }))), "@foldkit/ui/listbox/shared.js#anonymous~28")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/listbox/shared.js#anonymous~30")))), "@foldkit/ui/listbox/shared.js#handleButtonKeyDown");
446
+ maybeActiveItemIndex: Option.orElse(selectedItemIndex, () => __foldkitBrandViewResult((Option.some(firstEnabledIndex)), "@foldkit/ui/listbox/shared.js#anonymous~31")),
447
+ }))), "@foldkit/ui/listbox/shared.js#anonymous~30")), M.when('ArrowUp', () => __foldkitBrandViewResult((Option.some(Message.Opened({
448
+ maybeActiveItemIndex: Option.orElse(selectedItemIndex, () => __foldkitBrandViewResult((Option.some(lastEnabledIndex)), "@foldkit/ui/listbox/shared.js#anonymous~33")),
449
+ }))), "@foldkit/ui/listbox/shared.js#anonymous~32")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/listbox/shared.js#anonymous~34")))), "@foldkit/ui/listbox/shared.js#handleButtonKeyDown");
451
450
  };
452
451
  const handleButtonPointerDown = (pointerType, button) => __foldkitBrandViewResult((Option.some(Message.PressedPointerOnButton({ pointerType, button }))), "@foldkit/ui/listbox/shared.js#handleButtonPointerDown");
453
452
  const handleButtonClick = () => {
454
- const isMouse = Option.exists(maybeLastButtonPointerType, type => __foldkitBrandViewResult((type === 'mouse'), "@foldkit/ui/listbox/shared.js#anonymous~31"));
453
+ const isMouse = Option.exists(maybeLastButtonPointerType, type => __foldkitBrandViewResult((type === 'mouse'), "@foldkit/ui/listbox/shared.js#anonymous~35"));
455
454
  if (isMouse) {
456
455
  return __foldkitBrandViewResult((Message.IgnoredMouseClick()), "@foldkit/ui/listbox/shared.js#handleButtonClick");
457
456
  }
@@ -464,7 +463,7 @@ export const makeView = (behavior) => {
464
463
  };
465
464
  const handleSpaceKeyUp = (key) => __foldkitBrandViewResult((OptionExt.when(key === ' ', Message.SuppressedSpaceScroll())), "@foldkit/ui/listbox/shared.js#handleSpaceKeyUp");
466
465
  const resolveActiveIndex = (key) => __foldkitBrandViewResult((Option.match(maybeActiveItemIndex, {
467
- onNone: () => __foldkitBrandViewResult((M.value(key).pipe(M.whenOr(previousKey, 'End', 'PageDown', () => __foldkitBrandViewResult((lastEnabledIndex), "@foldkit/ui/listbox/shared.js#anonymous~32")), M.orElse(() => __foldkitBrandViewResult((firstEnabledIndex), "@foldkit/ui/listbox/shared.js#anonymous~33")))), "@foldkit/ui/listbox/shared.js#onNone~2"),
466
+ onNone: () => __foldkitBrandViewResult((M.value(key).pipe(M.whenOr(previousKey, 'End', 'PageDown', () => __foldkitBrandViewResult((lastEnabledIndex), "@foldkit/ui/listbox/shared.js#anonymous~36")), M.orElse(() => __foldkitBrandViewResult((firstEnabledIndex), "@foldkit/ui/listbox/shared.js#anonymous~37")))), "@foldkit/ui/listbox/shared.js#onNone~2"),
468
467
  onSome: activeIndex => __foldkitBrandViewResult((keyToIndex(nextKey, previousKey, items.length, activeIndex, isItemDisabledByIndex)(key)), "@foldkit/ui/listbox/shared.js#onSome~2"),
469
468
  })), "@foldkit/ui/listbox/shared.js#resolveActiveIndex");
470
469
  const searchForKey = (key) => {
@@ -477,15 +476,15 @@ export const makeView = (behavior) => {
477
476
  return __foldkitBrandViewResult((Option.as(maybeActiveItemIndex, Message.SuppressedItemCommit())), "@foldkit/ui/listbox/shared.js#resolveCommitMessage");
478
477
  }
479
478
  else {
480
- return __foldkitBrandViewResult((Option.map(maybeActiveItemIndex, index => __foldkitBrandViewResult((Message.RequestedItemClick({ index })), "@foldkit/ui/listbox/shared.js#anonymous~34"))), "@foldkit/ui/listbox/shared.js#resolveCommitMessage");
479
+ return __foldkitBrandViewResult((Option.map(maybeActiveItemIndex, index => __foldkitBrandViewResult((Message.RequestedItemClick({ index })), "@foldkit/ui/listbox/shared.js#anonymous~38"))), "@foldkit/ui/listbox/shared.js#resolveCommitMessage");
481
480
  }
482
481
  };
483
- const handleItemsKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.when('Escape', () => __foldkitBrandViewResult((Option.some(Message.Closed())), "@foldkit/ui/listbox/shared.js#anonymous~35")), M.when('Enter', resolveCommitMessage), M.when(' ', () => __foldkitBrandViewResult((Str.isNonEmpty(searchQuery)
482
+ const handleItemsKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.when('Escape', () => __foldkitBrandViewResult((Option.some(Message.Closed())), "@foldkit/ui/listbox/shared.js#anonymous~39")), M.when('Enter', resolveCommitMessage), M.when(' ', () => __foldkitBrandViewResult((Str.isNonEmpty(searchQuery)
484
483
  ? searchForKey(' ')
485
- : resolveCommitMessage()), "@foldkit/ui/listbox/shared.js#anonymous~36")), M.when(isNavigationKey, () => __foldkitBrandViewResult((Option.some(Message.ActivatedItem({
484
+ : resolveCommitMessage()), "@foldkit/ui/listbox/shared.js#anonymous~40")), M.when(isNavigationKey, () => __foldkitBrandViewResult((Option.some(Message.ActivatedItem({
486
485
  index: resolveActiveIndex(key),
487
486
  activationTrigger: 'Keyboard',
488
- }))), "@foldkit/ui/listbox/shared.js#anonymous~37")), M.when(isPrintableKey, () => __foldkitBrandViewResult((searchForKey(key)), "@foldkit/ui/listbox/shared.js#anonymous~38")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/listbox/shared.js#anonymous~39")))), "@foldkit/ui/listbox/shared.js#handleItemsKeyDown");
487
+ }))), "@foldkit/ui/listbox/shared.js#anonymous~41")), M.when(isPrintableKey, () => __foldkitBrandViewResult((searchForKey(key)), "@foldkit/ui/listbox/shared.js#anonymous~42")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/listbox/shared.js#anonymous~43")))), "@foldkit/ui/listbox/shared.js#handleItemsKeyDown");
489
488
  const resolveButtonLabel = () => {
490
489
  if (Predicate.isNotUndefined(ariaLabel)) {
491
490
  return __foldkitBrandViewResult(([h.AriaLabel(ariaLabel)]), "@foldkit/ui/listbox/shared.js#resolveButtonLabel");
@@ -560,7 +559,7 @@ export const makeView = (behavior) => {
560
559
  ...itemsAttributes,
561
560
  ];
562
561
  const listboxItems = Array.map(items, (item, index) => {
563
- const isActiveItem = Option.exists(maybeActiveItemIndex, activeIndex => __foldkitBrandViewResult((activeIndex === index), "@foldkit/ui/listbox/shared.js#anonymous~41"));
562
+ const isActiveItem = Option.exists(maybeActiveItemIndex, activeIndex => __foldkitBrandViewResult((activeIndex === index), "@foldkit/ui/listbox/shared.js#anonymous~45"));
564
563
  const isDisabledItem = isItemDisabledByIndex(index);
565
564
  const isSelectedItem = isValueSelected(itemToValue(item));
566
565
  const itemConfig = itemToConfig(item, {
@@ -593,13 +592,13 @@ export const makeView = (behavior) => {
593
592
  index,
594
593
  screenX,
595
594
  screenY,
596
- }))), "@foldkit/ui/listbox/shared.js#anonymous~42")),
595
+ }))), "@foldkit/ui/listbox/shared.js#anonymous~46")),
597
596
  ]),
598
- h.OnPointerLeave(pointerType => __foldkitBrandViewResult((OptionExt.when(pointerType !== 'touch', Message.DeactivatedItem())), "@foldkit/ui/listbox/shared.js#anonymous~43")),
597
+ h.OnPointerLeave(pointerType => __foldkitBrandViewResult((OptionExt.when(pointerType !== 'touch', Message.DeactivatedItem())), "@foldkit/ui/listbox/shared.js#anonymous~47")),
599
598
  ]
600
599
  : []),
601
600
  ...(itemConfig.className ? [h.Class(itemConfig.className)] : []),
602
- ], [itemConfig.content])), "@foldkit/ui/listbox/shared.js#anonymous~40");
601
+ ], [itemConfig.content])), "@foldkit/ui/listbox/shared.js#anonymous~44");
603
602
  });
604
603
  const renderGroupedItems = () => {
605
604
  if (!itemGroupKey) {
@@ -608,7 +607,7 @@ export const makeView = (behavior) => {
608
607
  const segments = groupContiguous(listboxItems, (_, index) => __foldkitBrandViewResult((Array.get(items, index).pipe(Option.match({
609
608
  onNone: () => __foldkitBrandViewResult((''), "@foldkit/ui/listbox/shared.js#onNone~4"),
610
609
  onSome: item => __foldkitBrandViewResult((itemGroupKey(item, index)), "@foldkit/ui/listbox/shared.js#onSome~4"),
611
- }))), "@foldkit/ui/listbox/shared.js#anonymous~44"));
610
+ }))), "@foldkit/ui/listbox/shared.js#anonymous~48"));
612
611
  return __foldkitBrandViewResult((Array.flatMap(segments, (segment, segmentIndex) => {
613
612
  const maybeHeading = Option.fromNullishOr(groupToHeading?.(segment.key));
614
613
  const headingId = `${id}-heading-${segment.key}`;
@@ -644,7 +643,7 @@ export const makeView = (behavior) => {
644
643
  ]),
645
644
  ]
646
645
  : [];
647
- return __foldkitBrandViewResult(([...separator, groupElement]), "@foldkit/ui/listbox/shared.js#anonymous~45");
646
+ return __foldkitBrandViewResult(([...separator, groupElement]), "@foldkit/ui/listbox/shared.js#anonymous~49");
648
647
  })), "@foldkit/ui/listbox/shared.js#renderGroupedItems");
649
648
  };
650
649
  const backdrop = h.keyed('div')(`${id}-backdrop`, [
@@ -680,7 +679,7 @@ export const makeView = (behavior) => {
680
679
  h.Name(name),
681
680
  h.Value(selectedValue),
682
681
  ...formAttribute,
683
- ])), "@foldkit/ui/listbox/shared.js#anonymous~46")),
682
+ ])), "@foldkit/ui/listbox/shared.js#anonymous~50")),
684
683
  })
685
684
  : [];
686
685
  const wrapperAttributes = [
@@ -697,9 +696,9 @@ export const makeView = (behavior) => {
697
696
  ]),
698
697
  ...hiddenInputs,
699
698
  ...(isVisible ? visibleContent : []),
700
- ])), "@foldkit/ui/listbox/shared.js#anonymous~15");
699
+ ])), "@foldkit/ui/listbox/shared.js#anonymous~19");
701
700
  });
702
701
  return __foldkitBrandViewResult((() =>
703
702
  /* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */
704
- __foldkitBrandViewResult((impl), "@foldkit/ui/listbox/shared.js#anonymous~47")), "@foldkit/ui/listbox/shared.js#makeView");
703
+ __foldkitBrandViewResult((impl), "@foldkit/ui/listbox/shared.js#anonymous~51")), "@foldkit/ui/listbox/shared.js#makeView");
705
704
  };
@@ -1,5 +1,5 @@
1
1
  import { Option, Schema as S } from 'effect';
2
- import type * as Command from 'foldkit/command';
2
+ import { type Update } from 'foldkit';
3
3
  import { type View as SubmodelView } from 'foldkit/submodel';
4
4
  import { type BaseInitConfig, type BaseViewInputsCommon, type ItemToValueInput, Message, OutMessage } from './shared.js';
5
5
  /** Schema for the single-select listbox's private interaction state (open/closed status, active item, activation trigger, typeahead search). The selection is owned by the parent and passed in via `ViewInputs.maybeSelectedValue`. */
@@ -29,7 +29,9 @@ export type Model = typeof Model.Type;
29
29
  export type InitConfig = BaseInitConfig;
30
30
  /** Creates an initial single-select listbox model from a config. Defaults to closed with no active item. */
31
31
  export declare const init: (config: InitConfig) => Model;
32
- /** Processes a listbox message and returns the next model, commands, and optional OutMessage. Closes the listbox on selection (single-select behavior); emits a `Selected({ value })` OutMessage the parent stores as the selection. */
32
+ /** Processes a Listbox Message and returns the next Model, optional Commands,
33
+ * and an optional OutMessage. Selection closes the Listbox and emits
34
+ * `Selected({ value })` for the parent to store. */
33
35
  export declare const update: (model: {
34
36
  readonly id: string;
35
37
  readonly isOpen: boolean;
@@ -50,31 +52,29 @@ export declare const update: (model: {
50
52
  readonly screenY: number;
51
53
  }>;
52
54
  readonly maybeLastButtonPointerType: Option.Option<string>;
53
- }, message: Message) => readonly [{
54
- readonly id: string;
55
- readonly isOpen: boolean;
56
- readonly isAnimated: boolean;
57
- readonly isModal: boolean;
58
- readonly orientation: "Horizontal" | "Vertical";
59
- readonly animation: {
55
+ }, message: Message) => Readonly<{
56
+ model: {
60
57
  readonly id: string;
61
- readonly isShowing: boolean;
62
- readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
58
+ readonly isOpen: boolean;
59
+ readonly isAnimated: boolean;
60
+ readonly isModal: boolean;
61
+ readonly orientation: "Horizontal" | "Vertical";
62
+ readonly animation: {
63
+ readonly id: string;
64
+ readonly isShowing: boolean;
65
+ readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
66
+ };
67
+ readonly maybeActiveItemIndex: Option.Option<number>;
68
+ readonly activationTrigger: "Pointer" | "Keyboard";
69
+ readonly searchQuery: string;
70
+ readonly searchVersion: number;
71
+ readonly maybeLastPointerPosition: Option.Option<{
72
+ readonly screenX: number;
73
+ readonly screenY: number;
74
+ }>;
75
+ readonly maybeLastButtonPointerType: Option.Option<string>;
63
76
  };
64
- readonly maybeActiveItemIndex: Option.Option<number>;
65
- readonly activationTrigger: "Pointer" | "Keyboard";
66
- readonly searchQuery: string;
67
- readonly searchVersion: number;
68
- readonly maybeLastPointerPosition: Option.Option<{
69
- readonly screenX: number;
70
- readonly screenY: number;
71
- }>;
72
- readonly maybeLastButtonPointerType: Option.Option<string>;
73
- }, readonly Readonly<{
74
- name: string;
75
- args?: Record<string, unknown>;
76
- key?: string;
77
- effect: import("effect/Effect").Effect<{
77
+ commands?: Update.Commands<{
78
78
  readonly _tag: "IgnoredMouseClick";
79
79
  } | {
80
80
  readonly _tag: "SuppressedSpaceScroll";
@@ -146,14 +146,15 @@ export declare const update: (model: {
146
146
  readonly _tag: "CompletedAnchorListbox";
147
147
  } | {
148
148
  readonly _tag: "CompletedPortalListboxBackdrop";
149
- }, never, never>;
150
- }>[], Option.Option<Readonly<{
151
- readonly _tag: "Selected";
152
- readonly value: string;
153
- }>>];
149
+ }, never>;
150
+ outMessage?: Readonly<{
151
+ readonly _tag: "Selected";
152
+ readonly value: string;
153
+ }>;
154
+ }>;
154
155
  type UpdateReturn = ReturnType<typeof update>;
155
- /** Programmatically opens the listbox, updating the model and returning
156
- * focus and modal commands. Use this in domain-event handlers to open the listbox. */
156
+ /** Programmatically opens the Listbox, updating the Model and returning focus
157
+ * and modal Commands. Use this in domain-event handlers. */
157
158
  export declare const open: (model: Model) => UpdateReturn;
158
159
  /** Programmatically closes the listbox. If it is open, returns the closed Model
159
160
  * with focus and modal Commands. If it is already closed, returns the Model
@@ -171,6 +172,7 @@ export type ViewInputs<Item, Value extends string = string> = BaseViewInputsComm
171
172
  * form input submitted under `name`. */
172
173
  maybeSelectedValue: Option.Option<Value>;
173
174
  }> & ItemToValueInput<Item, Value>;
175
+ type BundleUpdateReturn<Value extends string> = Update.ReturnWithOutMessage<Model, Message, OutMessage<Value>>;
174
176
  /** The `view`, `update`, and programmatic helpers that `Listbox.create`
175
177
  * returns, bound to one `Item` and `Value` pair. Name it to annotate a
176
178
  * value that holds a created bundle, such as a field on a config object
@@ -178,26 +180,10 @@ export type ViewInputs<Item, Value extends string = string> = BaseViewInputsComm
178
180
  * `create` itself. */
179
181
  export type Bundle<Item = string, Value extends string = Item extends string ? Item : string> = Readonly<{
180
182
  view: SubmodelView<Model, Message, ViewInputs<Item, Value>>;
181
- update: (model: Model, message: Message) => readonly [
182
- Model,
183
- ReadonlyArray<Command.Command<Message>>,
184
- Option.Option<OutMessage<Value>>
185
- ];
186
- selectItem: (model: Model, item: Value) => readonly [
187
- Model,
188
- ReadonlyArray<Command.Command<Message>>,
189
- Option.Option<OutMessage<Value>>
190
- ];
191
- open: (model: Model) => readonly [
192
- Model,
193
- ReadonlyArray<Command.Command<Message>>,
194
- Option.Option<OutMessage<Value>>
195
- ];
196
- close: (model: Model) => readonly [
197
- Model,
198
- ReadonlyArray<Command.Command<Message>>,
199
- Option.Option<OutMessage<Value>>
200
- ];
183
+ update: (model: Model, message: Message) => BundleUpdateReturn<Value>;
184
+ selectItem: (model: Model, item: Value) => BundleUpdateReturn<Value>;
185
+ open: (model: Model) => BundleUpdateReturn<Value>;
186
+ close: (model: Model) => BundleUpdateReturn<Value>;
201
187
  }>;
202
188
  /** Pairs the single-select listbox's `view` and `update` (and programmatic
203
189
  * helpers) behind a single Item-typed entry point. Declaring the listbox
@@ -210,9 +196,8 @@ export type Bundle<Item = string, Value extends string = Item extends string ? I
210
196
  * // In view:
211
197
  * h.submodel({ view: ColorListbox.view, ... })
212
198
  *
213
- * // In update:
214
- * const [next, commands, maybeOutMessage] = ColorListbox.update(model, message)
215
- * // maybeOutMessage: Option<Listbox.OutMessage<Color>>
199
+ * // In the parent update, pass ColorListbox.update to Update.foldChild and
200
+ * // handle Listbox.OutMessage<Color> in foldOutMessage.
216
201
  * ```
217
202
  *
218
203
  * Two type params support object-typed items with an `itemToValue`
@@ -1 +1 @@
1
- {"version":3,"file":"single.d.ts","sourceRoot":"","sources":["../../src/listbox/single.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC5C,OAAO,KAAK,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,KAAK,IAAI,IAAI,YAAY,EAAc,MAAM,kBAAkB,CAAA;AAExE,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,OAAO,EACP,UAAU,EAIX,MAAM,aAAa,CAAA;AAIpB,wOAAwO;AACxO,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;EAEhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,mOAAmO;AACnO,MAAM,MAAM,UAAU,GA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