@foldkit/ui 0.168.0 → 0.169.0-canary.7ee214268c60

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 (45) hide show
  1. package/dist/anchor/anchor.d.ts +9 -8
  2. package/dist/anchor/anchor.d.ts.map +1 -1
  3. package/dist/anchor/anchor.js +16 -15
  4. package/dist/combobox/multi.d.ts +2 -1
  5. package/dist/combobox/multi.d.ts.map +1 -1
  6. package/dist/combobox/multi.js +2 -1
  7. package/dist/combobox/shared.d.ts.map +1 -1
  8. package/dist/combobox/shared.js +13 -8
  9. package/dist/combobox/single.d.ts +2 -1
  10. package/dist/combobox/single.d.ts.map +1 -1
  11. package/dist/combobox/single.js +2 -1
  12. package/dist/datePicker/index.d.ts +5 -0
  13. package/dist/datePicker/index.d.ts.map +1 -1
  14. package/dist/dragAndDrop/public.d.ts +2 -0
  15. package/dist/dragAndDrop/public.d.ts.map +1 -1
  16. package/dist/dragAndDrop/public.js +1 -0
  17. package/dist/dragAndDrop/test.d.ts +65 -0
  18. package/dist/dragAndDrop/test.d.ts.map +1 -0
  19. package/dist/dragAndDrop/test.js +49 -0
  20. package/dist/hoverIntent/hoverIntent.d.ts +2 -2
  21. package/dist/listbox/multi.d.ts +16 -13
  22. package/dist/listbox/multi.d.ts.map +1 -1
  23. package/dist/listbox/multi.js +2 -1
  24. package/dist/listbox/public.d.ts +1 -1
  25. package/dist/listbox/public.d.ts.map +1 -1
  26. package/dist/listbox/shared.d.ts +16 -11
  27. package/dist/listbox/shared.d.ts.map +1 -1
  28. package/dist/listbox/shared.js +50 -37
  29. package/dist/listbox/single.d.ts +16 -13
  30. package/dist/listbox/single.d.ts.map +1 -1
  31. package/dist/listbox/single.js +2 -1
  32. package/dist/menu/index.d.ts +18 -12
  33. package/dist/menu/index.d.ts.map +1 -1
  34. package/dist/menu/index.js +49 -35
  35. package/dist/menu/public.d.ts +1 -1
  36. package/dist/menu/public.d.ts.map +1 -1
  37. package/dist/popover/index.d.ts +19 -3
  38. package/dist/popover/index.d.ts.map +1 -1
  39. package/dist/popover/index.js +23 -17
  40. package/dist/popover/public.d.ts +1 -1
  41. package/dist/popover/public.d.ts.map +1 -1
  42. package/dist/test/apps/disabledButton.d.ts +4 -4
  43. package/dist/toast/index.d.ts +28 -28
  44. package/dist/tooltip/tooltip.d.ts +2 -2
  45. package/package.json +4 -4
@@ -69,6 +69,7 @@ export const Message = defineMessageUnion({
69
69
  CompletedRestoreInert: {},
70
70
  CompletedScrollIntoView: {},
71
71
  CompletedClickItem: {},
72
+ ClickedButton: {},
72
73
  IgnoredMouseClick: {},
73
74
  SuppressedSpaceScroll: {},
74
75
  CompletedAnchorMenu: {},
@@ -275,16 +276,21 @@ export const update = (model, message) => {
275
276
  SuppressedSpaceScroll: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#SuppressedSpaceScroll")),
276
277
  CompletedAnchorMenu: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#CompletedAnchorMenu")),
277
278
  CompletedPortalMenuBackdrop: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#CompletedPortalMenuBackdrop")),
278
- Opened: ({ maybeActiveItemIndex }) => __foldkitBrandViewResult((openMenu(modifyFields(model, {
279
- maybeActiveItemIndex: () => __foldkitBrandViewResult((maybeActiveItemIndex), "@foldkit/ui/menu/index.js#maybeActiveItemIndex~2"),
280
- activationTrigger: () => __foldkitBrandViewResult((Option.match(maybeActiveItemIndex, {
281
- onNone: () => __foldkitBrandViewResult(('Pointer'), "@foldkit/ui/menu/index.js#onNone"),
282
- onSome: () => __foldkitBrandViewResult(('Keyboard'), "@foldkit/ui/menu/index.js#onSome"),
283
- })), "@foldkit/ui/menu/index.js#activationTrigger"),
284
- searchQuery: () => __foldkitBrandViewResult((''), "@foldkit/ui/menu/index.js#searchQuery~2"),
285
- searchVersion: () => __foldkitBrandViewResult((0), "@foldkit/ui/menu/index.js#searchVersion~2"),
286
- maybeLastPointerPosition: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/menu/index.js#maybeLastPointerPosition~2"),
287
- }))), "@foldkit/ui/menu/index.js#Opened"),
279
+ Opened: ({ maybeActiveItemIndex }) => {
280
+ if (model.isOpen) {
281
+ return __foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#Opened");
282
+ }
283
+ return __foldkitBrandViewResult((openMenu(modifyFields(model, {
284
+ maybeActiveItemIndex: () => __foldkitBrandViewResult((maybeActiveItemIndex), "@foldkit/ui/menu/index.js#maybeActiveItemIndex~2"),
285
+ activationTrigger: () => __foldkitBrandViewResult((Option.match(maybeActiveItemIndex, {
286
+ onNone: () => __foldkitBrandViewResult(('Pointer'), "@foldkit/ui/menu/index.js#onNone"),
287
+ onSome: () => __foldkitBrandViewResult(('Keyboard'), "@foldkit/ui/menu/index.js#onSome"),
288
+ })), "@foldkit/ui/menu/index.js#activationTrigger"),
289
+ searchQuery: () => __foldkitBrandViewResult((''), "@foldkit/ui/menu/index.js#searchQuery~2"),
290
+ searchVersion: () => __foldkitBrandViewResult((0), "@foldkit/ui/menu/index.js#searchVersion~2"),
291
+ maybeLastPointerPosition: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/menu/index.js#maybeLastPointerPosition~2"),
292
+ }))), "@foldkit/ui/menu/index.js#Opened");
293
+ },
288
294
  Closed: () => __foldkitBrandViewResult((closeMenu(model, closeWithFocusCommands)), "@foldkit/ui/menu/index.js#Closed"),
289
295
  BlurredItems: () => {
290
296
  if (Option.exists(model.maybeLastButtonPointerType, Equal.equals('mouse'))) {
@@ -400,6 +406,25 @@ export const update = (model, message) => {
400
406
  maybeLastButtonPointerType: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/menu/index.js#maybeLastButtonPointerType~4"),
401
407
  }),
402
408
  }), "@foldkit/ui/menu/index.js#IgnoredMouseClick")),
409
+ ClickedButton: () => {
410
+ if (Option.exists(model.maybeLastButtonPointerType, Equal.equals('mouse'))) {
411
+ return __foldkitBrandViewResult(({
412
+ model: modifyFields(model, {
413
+ maybeLastButtonPointerType: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/menu/index.js#maybeLastButtonPointerType~5"),
414
+ }),
415
+ }), "@foldkit/ui/menu/index.js#ClickedButton");
416
+ }
417
+ if (model.isOpen) {
418
+ return __foldkitBrandViewResult((closeMenu(model, closeWithFocusCommands)), "@foldkit/ui/menu/index.js#ClickedButton");
419
+ }
420
+ return __foldkitBrandViewResult((openMenu(modifyFields(model, {
421
+ maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/menu/index.js#maybeActiveItemIndex~8"),
422
+ activationTrigger: () => __foldkitBrandViewResult(('Pointer'), "@foldkit/ui/menu/index.js#activationTrigger~5"),
423
+ searchQuery: () => __foldkitBrandViewResult((''), "@foldkit/ui/menu/index.js#searchQuery~6"),
424
+ searchVersion: () => __foldkitBrandViewResult((0), "@foldkit/ui/menu/index.js#searchVersion~5"),
425
+ maybeLastPointerPosition: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/menu/index.js#maybeLastPointerPosition~5"),
426
+ }))), "@foldkit/ui/menu/index.js#ClickedButton");
427
+ },
403
428
  })), "@foldkit/ui/menu/index.js#update");
404
429
  };
405
430
  /** The anchor-positioning Mount this Menu renders on its panel. The panel is
@@ -440,7 +465,8 @@ export const PortalMenuBackdrop = Mount.define('PortalMenuBackdrop', {
440
465
  })), "@foldkit/ui/menu/index.js#execute~10"),
441
466
  });
442
467
  /** Programmatically opens the Menu, updating the Model and returning focus and
443
- * modal Commands. Use this in domain-event handlers. */
468
+ * modal Commands. When it is already open, returns the Model unchanged with
469
+ * no Commands. Use this in domain-event handlers. */
444
470
  export const open = (model) => __foldkitBrandViewResult((update(model, Message.Opened({ maybeActiveItemIndex: Option.none() }))), "@foldkit/ui/menu/index.js#open");
445
471
  /** Programmatically closes the menu. If it is open, returns the closed Model
446
472
  * with focus and modal Commands. If it is already closed, returns the Model
@@ -456,7 +482,7 @@ const internalView = () =>
456
482
  /* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */
457
483
  __foldkitBrandViewResult((menuViewImpl), "@foldkit/ui/menu/index.js#internalView");
458
484
  const menuViewImpl = defineView((model, viewInputs, h) => {
459
- const { id, isOpen, animation: { transitionState }, maybeActiveItemIndex, searchQuery, maybeLastButtonPointerType, } = model;
485
+ const { id, isOpen, animation: { transitionState }, maybeActiveItemIndex, searchQuery, } = model;
460
486
  const { items, itemToConfig, isItemDisabled, itemToSearchText = (item) => __foldkitBrandViewResult((item), "@foldkit/ui/menu/index.js#anonymous~19"), isButtonDisabled, buttonContent, buttonClassName, buttonAttributes = [], itemsClassName, itemsAttributes = [], itemsScrollClassName, itemsScrollAttributes = [], backdropClassName, backdropAttributes = [], className, attributes = [], itemGroupKey, groupToHeading, groupClassName, groupAttributes = [], separatorClassName, separatorAttributes = [], anchor = {}, ariaLabel, ariaLabelledBy, } = viewInputs;
461
487
  const dispatchSelectedItem = (item, index) => __foldkitBrandViewResult((Message.SelectedItem({ index, item })), "@foldkit/ui/menu/index.js#dispatchSelectedItem");
462
488
  const isLeaving = transitionState === 'LeaveStart' || transitionState === 'LeaveAnimating';
@@ -497,31 +523,19 @@ const menuViewImpl = defineView((model, viewInputs, h) => {
497
523
  screenY,
498
524
  timeStamp,
499
525
  }))), "@foldkit/ui/menu/index.js#handleButtonPointerDown");
500
- const handleButtonClick = () => {
501
- const isMouse = Option.exists(maybeLastButtonPointerType, type => __foldkitBrandViewResult((type === 'mouse'), "@foldkit/ui/menu/index.js#anonymous~29"));
502
- if (isMouse) {
503
- return __foldkitBrandViewResult((Message.IgnoredMouseClick()), "@foldkit/ui/menu/index.js#handleButtonClick");
504
- }
505
- else if (isOpen) {
506
- return __foldkitBrandViewResult((Message.Closed()), "@foldkit/ui/menu/index.js#handleButtonClick");
507
- }
508
- else {
509
- return __foldkitBrandViewResult((Message.Opened({ maybeActiveItemIndex: Option.none() })), "@foldkit/ui/menu/index.js#handleButtonClick");
510
- }
511
- };
512
526
  const handleSpaceKeyUp = (key) => __foldkitBrandViewResult((OptionExt.when(key === ' ', Message.SuppressedSpaceScroll())), "@foldkit/ui/menu/index.js#handleSpaceKeyUp");
513
- const resolveActiveIndex = keyToIndex('ArrowDown', 'ArrowUp', items.length, Option.getOrElse(maybeActiveItemIndex, () => __foldkitBrandViewResult((0), "@foldkit/ui/menu/index.js#anonymous~30")), isDisabled);
527
+ const resolveActiveIndex = keyToIndex('ArrowDown', 'ArrowUp', items.length, Option.getOrElse(maybeActiveItemIndex, () => __foldkitBrandViewResult((0), "@foldkit/ui/menu/index.js#anonymous~29")), isDisabled);
514
528
  const searchForKey = (key) => {
515
529
  const nextQuery = searchQuery + key;
516
530
  const maybeTargetIndex = resolveTypeaheadMatch(items, nextQuery, maybeActiveItemIndex, isDisabled, itemToSearchText, String.isNonEmpty(searchQuery));
517
531
  return __foldkitBrandViewResult((Option.some(Message.Searched({ key, maybeTargetIndex }))), "@foldkit/ui/menu/index.js#searchForKey");
518
532
  };
519
- const handleItemsKeyDown = (key) => __foldkitBrandViewResult((Match.value(key).pipe(Match.when('Escape', () => __foldkitBrandViewResult((Option.some(Message.Closed())), "@foldkit/ui/menu/index.js#anonymous~31")), Match.when('Enter', () => __foldkitBrandViewResult((Option.map(maybeActiveItemIndex, index => __foldkitBrandViewResult((Message.RequestedItemClick({ index })), "@foldkit/ui/menu/index.js#anonymous~33"))), "@foldkit/ui/menu/index.js#anonymous~32")), Match.when(' ', () => __foldkitBrandViewResult((String.isNonEmpty(searchQuery)
533
+ const handleItemsKeyDown = (key) => __foldkitBrandViewResult((Match.value(key).pipe(Match.when('Escape', () => __foldkitBrandViewResult((Option.some(Message.Closed())), "@foldkit/ui/menu/index.js#anonymous~30")), Match.when('Enter', () => __foldkitBrandViewResult((Option.map(maybeActiveItemIndex, index => __foldkitBrandViewResult((Message.RequestedItemClick({ index })), "@foldkit/ui/menu/index.js#anonymous~32"))), "@foldkit/ui/menu/index.js#anonymous~31")), Match.when(' ', () => __foldkitBrandViewResult((String.isNonEmpty(searchQuery)
520
534
  ? searchForKey(' ')
521
- : Option.map(maybeActiveItemIndex, index => __foldkitBrandViewResult((Message.RequestedItemClick({ index })), "@foldkit/ui/menu/index.js#anonymous~35"))), "@foldkit/ui/menu/index.js#anonymous~34")), Match.whenOr('ArrowDown', 'ArrowUp', 'Home', 'End', 'PageUp', 'PageDown', () => __foldkitBrandViewResult((Option.some(Message.ActivatedItem({
535
+ : Option.map(maybeActiveItemIndex, index => __foldkitBrandViewResult((Message.RequestedItemClick({ index })), "@foldkit/ui/menu/index.js#anonymous~34"))), "@foldkit/ui/menu/index.js#anonymous~33")), Match.whenOr('ArrowDown', 'ArrowUp', 'Home', 'End', 'PageUp', 'PageDown', () => __foldkitBrandViewResult((Option.some(Message.ActivatedItem({
522
536
  index: resolveActiveIndex(key),
523
537
  activationTrigger: 'Keyboard',
524
- }))), "@foldkit/ui/menu/index.js#anonymous~36")), Match.when(isPrintableKey, () => __foldkitBrandViewResult((searchForKey(key)), "@foldkit/ui/menu/index.js#anonymous~37")), Match.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/menu/index.js#anonymous~38")))), "@foldkit/ui/menu/index.js#handleItemsKeyDown");
538
+ }))), "@foldkit/ui/menu/index.js#anonymous~35")), Match.when(isPrintableKey, () => __foldkitBrandViewResult((searchForKey(key)), "@foldkit/ui/menu/index.js#anonymous~36")), Match.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/menu/index.js#anonymous~37")))), "@foldkit/ui/menu/index.js#handleItemsKeyDown");
525
539
  const handleItemsPointerUp = (screenX, screenY, pointerType, timeStamp) => __foldkitBrandViewResult((OptionExt.when(pointerType === 'mouse', Message.ReleasedPointerOnItems({ screenX, screenY, timeStamp }))), "@foldkit/ui/menu/index.js#handleItemsPointerUp");
526
540
  const resolveButtonLabel = () => {
527
541
  if (Predicate.isNotUndefined(ariaLabel)) {
@@ -548,7 +562,7 @@ const menuViewImpl = defineView((model, viewInputs, h) => {
548
562
  h.OnPointerDown(handleButtonPointerDown),
549
563
  h.OnKeyDownPreventDefault(handleButtonKeyDown),
550
564
  h.OnKeyUpPreventDefault(handleSpaceKeyUp),
551
- h.OnClick(handleButtonClick()),
565
+ h.OnClick(Message.ClickedButton()),
552
566
  ]),
553
567
  ...(isVisible
554
568
  ? [
@@ -587,7 +601,7 @@ const menuViewImpl = defineView((model, viewInputs, h) => {
587
601
  ...itemsAttributes,
588
602
  ];
589
603
  const menuItems = Array.map(items, (item, index) => {
590
- const isActiveItem = Option.exists(maybeActiveItemIndex, activeIndex => __foldkitBrandViewResult((activeIndex === index), "@foldkit/ui/menu/index.js#anonymous~40"));
604
+ const isActiveItem = Option.exists(maybeActiveItemIndex, activeIndex => __foldkitBrandViewResult((activeIndex === index), "@foldkit/ui/menu/index.js#anonymous~39"));
591
605
  const isDisabledItem = isDisabled(index);
592
606
  const itemConfig = itemToConfig(item, {
593
607
  isActive: isActiveItem,
@@ -611,13 +625,13 @@ const menuViewImpl = defineView((model, viewInputs, h) => {
611
625
  index,
612
626
  screenX,
613
627
  screenY,
614
- }))), "@foldkit/ui/menu/index.js#anonymous~41")),
628
+ }))), "@foldkit/ui/menu/index.js#anonymous~40")),
615
629
  ]),
616
- h.OnPointerLeave(pointerType => __foldkitBrandViewResult((OptionExt.when(pointerType !== 'touch', Message.DeactivatedItem())), "@foldkit/ui/menu/index.js#anonymous~42")),
630
+ h.OnPointerLeave(pointerType => __foldkitBrandViewResult((OptionExt.when(pointerType !== 'touch', Message.DeactivatedItem())), "@foldkit/ui/menu/index.js#anonymous~41")),
617
631
  ]
618
632
  : []),
619
633
  ...(itemConfig.className ? [h.Class(itemConfig.className)] : []),
620
- ], [itemConfig.content])), "@foldkit/ui/menu/index.js#anonymous~39");
634
+ ], [itemConfig.content])), "@foldkit/ui/menu/index.js#anonymous~38");
621
635
  });
622
636
  const renderGroupedItems = () => {
623
637
  if (!itemGroupKey) {
@@ -626,7 +640,7 @@ const menuViewImpl = defineView((model, viewInputs, h) => {
626
640
  const segments = groupContiguous(menuItems, (_, index) => __foldkitBrandViewResult((Array.get(items, index).pipe(Option.match({
627
641
  onNone: () => __foldkitBrandViewResult((''), "@foldkit/ui/menu/index.js#onNone~3"),
628
642
  onSome: item => __foldkitBrandViewResult((itemGroupKey(item, index)), "@foldkit/ui/menu/index.js#onSome~3"),
629
- }))), "@foldkit/ui/menu/index.js#anonymous~43"));
643
+ }))), "@foldkit/ui/menu/index.js#anonymous~42"));
630
644
  return __foldkitBrandViewResult((Array.flatMap(segments, (segment, segmentIndex) => {
631
645
  const maybeHeading = Option.fromNullishOr(groupToHeading && groupToHeading(segment.key));
632
646
  const headingId = `${id}-heading-${segment.key}`;
@@ -660,7 +674,7 @@ const menuViewImpl = defineView((model, viewInputs, h) => {
660
674
  ]),
661
675
  ]
662
676
  : [];
663
- return __foldkitBrandViewResult(([...separator, groupElement]), "@foldkit/ui/menu/index.js#anonymous~44");
677
+ return __foldkitBrandViewResult(([...separator, groupElement]), "@foldkit/ui/menu/index.js#anonymous~43");
664
678
  })), "@foldkit/ui/menu/index.js#renderGroupedItems");
665
679
  };
666
680
  const backdrop = h.keyed('div')(`${id}-backdrop`, [
@@ -1,4 +1,4 @@
1
- export { init, create, buttonId, Model, Message, OutMessage, type Selected, type SelectedItem, AnchorMenu, PortalMenuBackdrop, type CompletedDelayClearSearch, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusItems, FocusButton, ScrollIntoView, ClickItem, DelayClearSearch, DetectMovementOrAnimationEnd, type Opened, type Closed, type BlurredItems, type ActivatedItem, type DeactivatedItem, type MovedPointerOverItem, type RequestedItemClick, type Searched, type PressedPointerOnButton, type ReleasedPointerOnItems, type IgnoredMouseClick, type SuppressedSpaceScroll, } from './index.js';
1
+ export { init, create, buttonId, Model, Message, OutMessage, type Selected, type SelectedItem, AnchorMenu, PortalMenuBackdrop, type CompletedDelayClearSearch, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusItems, FocusButton, ScrollIntoView, ClickItem, DelayClearSearch, DetectMovementOrAnimationEnd, type Opened, type Closed, type BlurredItems, type ActivatedItem, type DeactivatedItem, type MovedPointerOverItem, type RequestedItemClick, type Searched, type PressedPointerOnButton, type ReleasedPointerOnItems, type ClickedButton, type IgnoredMouseClick, type SuppressedSpaceScroll, } from './index.js';
2
2
  export type { ActivationTrigger, InitConfig, ViewInputs, ItemConfig, GroupHeading, Bundle, } from './index.js';
3
3
  export type { AnchorConfig } from '../anchor/index.js';
4
4
  //# sourceMappingURL=public.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/menu/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,KAAK,EACL,OAAO,EACP,UAAU,EACV,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,UAAU,EACV,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,4BAA4B,EAC5B,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,QAAQ,EACb,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,MAAM,GACP,MAAM,YAAY,CAAA;AAEnB,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/menu/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,KAAK,EACL,OAAO,EACP,UAAU,EACV,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,UAAU,EACV,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,4BAA4B,EAC5B,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,QAAQ,EACb,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,MAAM,GACP,MAAM,YAAY,CAAA;AAEnB,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA"}
@@ -35,6 +35,7 @@ export declare const Message: import("foldkit/message").MessageUnion<{
35
35
  readonly CompletedUnlockScroll: {};
36
36
  readonly CompletedInertOthers: {};
37
37
  readonly CompletedRestoreInert: {};
38
+ readonly ClickedButton: {};
38
39
  readonly IgnoredMouseClick: {};
39
40
  readonly SuppressedSpaceScroll: {};
40
41
  readonly CompletedAnchorPopover: {};
@@ -56,6 +57,8 @@ export type RequestedOpen = typeof Message.RequestedOpen.Type;
56
57
  export type RequestedClose = typeof Message.RequestedClose.Type;
57
58
  export type BlurredPanel = typeof Message.BlurredPanel.Type;
58
59
  export type PressedPointerOnButton = typeof Message.PressedPointerOnButton.Type;
60
+ /** A click on the Popover trigger button. */
61
+ export type ClickedButton = typeof Message.ClickedButton.Type;
59
62
  export type IgnoredMouseClick = typeof Message.IgnoredMouseClick.Type;
60
63
  export type SuppressedSpaceScroll = typeof Message.SuppressedSpaceScroll.Type;
61
64
  export type Message = typeof Message.Type;
@@ -69,7 +72,15 @@ export declare const OutMessage: import("foldkit/message").MessageUnion<{
69
72
  export type OutMessage = typeof OutMessage.Type;
70
73
  export type Opened = typeof OutMessage.Opened.Type;
71
74
  export type Closed = typeof OutMessage.Closed.Type;
72
- /** Configuration for creating a popover model with `init`. `isAnimated` enables animation coordination (default `false`). `isModal` locks page scroll and inerts other elements when open (default `false`). `contentFocus` hands focus ownership to the consumer. The panel is not focusable and does not close on blur, so the consumer must focus a descendant on open and close the popover on its own blur rules (default `false`). */
75
+ /** Configuration for creating a Popover Model with `init`.
76
+ *
77
+ * `isAnimated` enables animation coordination. `isModal` locks page scroll
78
+ * and marks other elements inert while the Popover is open. Both default to
79
+ * `false`.
80
+ *
81
+ * With `contentFocus: true`, the panel has no tab stop and focus leaving
82
+ * it does not close the Popover. Focus a descendant when opening and
83
+ * handle focus leaving the content in the application. Defaults to `false`. */
73
84
  export type InitConfig = Readonly<{
74
85
  id: string;
75
86
  isAnimated?: boolean;
@@ -166,6 +177,8 @@ export declare const update: (model: Model, message: Message) => Readonly<{
166
177
  readonly _tag: "PressedPointerOnButton";
167
178
  readonly pointerType: string;
168
179
  readonly button: number;
180
+ } | {
181
+ readonly _tag: "ClickedButton";
169
182
  } | {
170
183
  readonly _tag: "IgnoredMouseClick";
171
184
  } | {
@@ -237,7 +250,8 @@ export declare const PortalPopoverBackdrop: Mount.MountDefinitionNoArgs<"PortalP
237
250
  readonly _tag: "CompletedPortalPopoverBackdrop";
238
251
  }>;
239
252
  /** Programmatically opens the Popover, updating the Model and returning
240
- * focus and modal Commands plus an `Opened` OutMessage. */
253
+ * focus and modal Commands plus an `Opened` OutMessage. When it is already
254
+ * open, it is a no-op: no Commands and no OutMessage. */
241
255
  export declare const open: (model: Model) => UpdateReturn;
242
256
  /** Programmatically closes the popover. When it was open, updates the Model
243
257
  * and returns focus and modal Commands plus a `Closed` OutMessage. When it
@@ -248,7 +262,7 @@ export declare const close: (model: Model) => UpdateReturn;
248
262
  * - `button`: attribute bundle for the trigger button.
249
263
  * - `panel`: attribute bundle for the floating panel. Includes the
250
264
  * anchor Mount that positions the panel via Floating UI, ARIA
251
- * linkage to the button, and panel keydown/blur handlers.
265
+ * linkage to the button, and panel keydown and focus-leave handlers.
252
266
  * - `backdrop`: attribute bundle for the modal backdrop. Includes the
253
267
  * portal Mount that moves the backdrop to document.body. Inside a
254
268
  * `<dialog>`, it moves the backdrop to directly before the element it
@@ -303,6 +317,8 @@ export declare const view: import("foldkit/submodel").View<{
303
317
  readonly _tag: "PressedPointerOnButton";
304
318
  readonly pointerType: string;
305
319
  readonly button: number;
320
+ } | {
321
+ readonly _tag: "ClickedButton";
306
322
  } | {
307
323
  readonly _tag: "IgnoredMouseClick";
308
324
  } | {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAGN,MAAM,EAEN,MAAM,EAEP,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAE1C,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAmB,MAAM,cAAc,CAAA;AAE9E,OAAO,KAAK,KAAK,MAAM,eAAe,CAAA;AAGtC,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA;AAExC,OAAO,EAAE,YAAY,EAA+B,MAAM,oBAAoB,CAAA;AAe9E,qGAAqG;AACrG,eAAO,MAAM,KAAK;;;;;;;;;;;;;EAQhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,+DAA+D;AAC/D,eAAO,MAAM,OAAO;;;;;QAKhB,WAAW;QACX,MAAM;;;;;;;;;;;;;QAYe,OAAO;;;;;;;;;;;EAC9B,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,OAAO,OAAO,CAAC,aAAa,CAAC,IAA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E,OAAO,CAAA;CACnB,CAAC,CAAA;AAEF,qFAAqF;AACrF,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,YAAY,CAAA;IACpB,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;IACpC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAC,CAAA;AAEF,6EAA6E;AAC7E,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAVP,YAAY;YACZ,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI;iBACvB,OAAO;oBACJ,MAAM;mBACP,MAAM;gBACT,MAAM;qBACD,MAAM;GAuJxB,CAAA"}
@@ -43,6 +43,7 @@ export const Message = defineMessageUnion({
43
43
  CompletedUnlockScroll: {},
44
44
  CompletedInertOthers: {},
45
45
  CompletedRestoreInert: {},
46
+ ClickedButton: {},
46
47
  IgnoredMouseClick: {},
47
48
  SuppressedSpaceScroll: {},
48
49
  CompletedAnchorPopover: {},
@@ -174,6 +175,9 @@ export const update = (model, message) => {
174
175
  ];
175
176
  const closeWithoutFocusCommands = Array.getSomes([maybeUnlockScroll, maybeRestoreInert]);
176
177
  const openPopover = (baseModel) => {
178
+ if (baseModel.isOpen) {
179
+ return __foldkitBrandViewResult(({ model: baseModel }), "@foldkit/ui/popover/index.js#openPopover");
180
+ }
177
181
  if (model.isAnimated) {
178
182
  const popoverOpen = Update.combine(baseModel, [
179
183
  stepModel => (__foldkitBrandViewResult(({ model: stepModel, commands: openCommands }), "@foldkit/ui/popover/index.js#anonymous~3")),
@@ -253,6 +257,19 @@ export const update = (model, message) => {
253
257
  SuppressedSpaceScroll: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/popover/index.js#SuppressedSpaceScroll")),
254
258
  CompletedAnchorPopover: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/popover/index.js#CompletedAnchorPopover")),
255
259
  CompletedPortalPopoverBackdrop: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/popover/index.js#CompletedPortalPopoverBackdrop")),
260
+ ClickedButton: () => {
261
+ if (Option.exists(model.maybeLastButtonPointerType, Equal.equals('mouse'))) {
262
+ return __foldkitBrandViewResult(({
263
+ model: modifyFields(model, {
264
+ maybeLastButtonPointerType: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/popover/index.js#maybeLastButtonPointerType~5"),
265
+ }),
266
+ }), "@foldkit/ui/popover/index.js#ClickedButton");
267
+ }
268
+ if (model.isOpen) {
269
+ return __foldkitBrandViewResult((closePopover(model, closeWithFocusCommands)), "@foldkit/ui/popover/index.js#ClickedButton");
270
+ }
271
+ return __foldkitBrandViewResult((openPopover(model)), "@foldkit/ui/popover/index.js#ClickedButton");
272
+ },
256
273
  })), "@foldkit/ui/popover/index.js#update");
257
274
  };
258
275
  /** The anchor-positioning Mount this Popover renders on its panel. Exposed so
@@ -291,7 +308,8 @@ export const PortalPopoverBackdrop = Mount.define('PortalPopoverBackdrop', {
291
308
  })), "@foldkit/ui/popover/index.js#execute~7"),
292
309
  });
293
310
  /** Programmatically opens the Popover, updating the Model and returning
294
- * focus and modal Commands plus an `Opened` OutMessage. */
311
+ * focus and modal Commands plus an `Opened` OutMessage. When it is already
312
+ * open, it is a no-op: no Commands and no OutMessage. */
295
313
  export const open = (model) => __foldkitBrandViewResult((update(model, Message.RequestedOpen())), "@foldkit/ui/popover/index.js#open");
296
314
  /** Programmatically closes the popover. When it was open, updates the Model
297
315
  * and returns focus and modal Commands plus a `Closed` OutMessage. When it
@@ -299,7 +317,7 @@ export const open = (model) => __foldkitBrandViewResult((update(model, Message.R
299
317
  export const close = (model) => __foldkitBrandViewResult((update(model, Message.RequestedClose())), "@foldkit/ui/popover/index.js#close");
300
318
  /** Renders a headless popover with a trigger button and a floating panel. */
301
319
  export const view = defineView((model, viewInputs, h) => {
302
- const { id, isOpen, contentFocus, animation: { transitionState }, maybeLastButtonPointerType, } = model;
320
+ const { id, isOpen, contentFocus, animation: { transitionState }, } = model;
303
321
  const { anchor, toView, isDisabled, focusSelector, arrowPadding, ariaLabel, ariaLabelledBy, } = viewInputs;
304
322
  const isLeaving = transitionState === 'LeaveStart' || transitionState === 'LeaveAnimating';
305
323
  const isVisible = isOpen || isLeaving;
@@ -320,20 +338,8 @@ export const view = defineView((model, viewInputs, h) => {
320
338
  ]), "@foldkit/ui/popover/index.js#anonymous~18")), Match.orElse(() => __foldkitBrandViewResult(([]), "@foldkit/ui/popover/index.js#anonymous~19")));
321
339
  const handleButtonKeyDown = (key) => __foldkitBrandViewResult((Match.value(key).pipe(Match.whenOr('Enter', ' ', 'ArrowDown', () => __foldkitBrandViewResult((Option.some(isOpen ? Message.RequestedClose() : Message.RequestedOpen())), "@foldkit/ui/popover/index.js#anonymous~20")), Match.when('Escape', () => __foldkitBrandViewResult((OptionExt.when(isOpen, Message.RequestedClose())), "@foldkit/ui/popover/index.js#anonymous~21")), Match.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/popover/index.js#anonymous~22")))), "@foldkit/ui/popover/index.js#handleButtonKeyDown");
322
340
  const handleButtonPointerDown = (pointerType, button) => __foldkitBrandViewResult((Option.some(Message.PressedPointerOnButton({ pointerType, button }))), "@foldkit/ui/popover/index.js#handleButtonPointerDown");
323
- const handleButtonClick = () => {
324
- const isMouse = Option.exists(maybeLastButtonPointerType, type => __foldkitBrandViewResult((type === 'mouse'), "@foldkit/ui/popover/index.js#anonymous~23"));
325
- if (isMouse) {
326
- return __foldkitBrandViewResult((Message.IgnoredMouseClick()), "@foldkit/ui/popover/index.js#handleButtonClick");
327
- }
328
- else if (isOpen) {
329
- return __foldkitBrandViewResult((Message.RequestedClose()), "@foldkit/ui/popover/index.js#handleButtonClick");
330
- }
331
- else {
332
- return __foldkitBrandViewResult((Message.RequestedOpen()), "@foldkit/ui/popover/index.js#handleButtonClick");
333
- }
334
- };
335
341
  const handleSpaceKeyUp = (key) => __foldkitBrandViewResult((OptionExt.when(key === ' ', Message.SuppressedSpaceScroll())), "@foldkit/ui/popover/index.js#handleSpaceKeyUp");
336
- const handlePanelKeyDown = (key) => __foldkitBrandViewResult((Match.value(key).pipe(Match.when('Escape', () => __foldkitBrandViewResult((Option.some(Message.RequestedClose())), "@foldkit/ui/popover/index.js#anonymous~24")), Match.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/popover/index.js#anonymous~25")))), "@foldkit/ui/popover/index.js#handlePanelKeyDown");
342
+ const handlePanelKeyDown = (key) => __foldkitBrandViewResult((Match.value(key).pipe(Match.when('Escape', () => __foldkitBrandViewResult((Option.some(Message.RequestedClose())), "@foldkit/ui/popover/index.js#anonymous~23")), Match.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/popover/index.js#anonymous~24")))), "@foldkit/ui/popover/index.js#handlePanelKeyDown");
337
343
  const resolveButtonLabel = () => {
338
344
  if (Predicate.isNotUndefined(ariaLabel)) {
339
345
  return __foldkitBrandViewResult(([h.AriaLabel(ariaLabel)]), "@foldkit/ui/popover/index.js#resolveButtonLabel");
@@ -358,7 +364,7 @@ export const view = defineView((model, viewInputs, h) => {
358
364
  h.OnPointerDown(handleButtonPointerDown),
359
365
  h.OnKeyDownPreventDefault(handleButtonKeyDown),
360
366
  h.OnKeyUpPreventDefault(handleSpaceKeyUp),
361
- h.OnClick(handleButtonClick()),
367
+ h.OnClick(Message.ClickedButton()),
362
368
  ]),
363
369
  ...(isVisible
364
370
  ? [
@@ -383,7 +389,7 @@ export const view = defineView((model, viewInputs, h) => {
383
389
  ? []
384
390
  : [
385
391
  h.OnKeyDownPreventDefault(handlePanelKeyDown),
386
- ...(contentFocus ? [] : [h.OnBlur(Message.BlurredPanel())]),
392
+ ...(contentFocus ? [] : [h.OnFocusLeave(Message.BlurredPanel())]),
387
393
  ]),
388
394
  ];
389
395
  const backdropAttributes = [
@@ -1,4 +1,4 @@
1
- export { init, update, open, close, view, buttonId, arrowId, Model, Message, OutMessage, type Opened, type Closed, type RequestedOpen, type RequestedClose, AnchorPopover, PortalPopoverBackdrop, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusPanel, FocusButton, DetectMovementOrAnimationEnd, type BlurredPanel, type PressedPointerOnButton, type IgnoredMouseClick, type SuppressedSpaceScroll, } from './index.js';
1
+ export { init, update, open, close, view, buttonId, arrowId, Model, Message, OutMessage, type Opened, type Closed, type RequestedOpen, type RequestedClose, AnchorPopover, PortalPopoverBackdrop, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusPanel, FocusButton, DetectMovementOrAnimationEnd, type BlurredPanel, type PressedPointerOnButton, type ClickedButton, type IgnoredMouseClick, type SuppressedSpaceScroll, } from './index.js';
2
2
  export type { InitConfig, ViewInputs, RenderInfo } from './index.js';
3
3
  export type { AnchorConfig } from '../anchor/index.js';
4
4
  //# sourceMappingURL=public.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/popover/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,KAAK,EACL,OAAO,EACP,UAAU,EACV,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,aAAa,EACb,qBAAqB,EACrB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,4BAA4B,EAC5B,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,YAAY,CAAA;AAEnB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEpE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/popover/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,KAAK,EACL,OAAO,EACP,UAAU,EACV,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,aAAa,EACb,qBAAqB,EACrB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,4BAA4B,EAC5B,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,YAAY,CAAA;AAEnB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEpE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA"}
@@ -71,10 +71,6 @@ export declare const update: (model: Model, message: Message) => Readonly<{
71
71
  } | {
72
72
  readonly _tag: "GotDialogMessage";
73
73
  readonly message: {
74
- readonly _tag: "RequestedClose";
75
- } | {
76
- readonly _tag: "RequestedOpen";
77
- } | {
78
74
  readonly _tag: "CompletedCloseDialog";
79
75
  } | {
80
76
  readonly _tag: "CompletedReleaseDialogResources";
@@ -95,6 +91,10 @@ export declare const update: (model: Model, message: Message) => Readonly<{
95
91
  } | {
96
92
  readonly _tag: "Showed";
97
93
  };
94
+ } | {
95
+ readonly _tag: "RequestedClose";
96
+ } | {
97
+ readonly _tag: "RequestedOpen";
98
98
  } | {
99
99
  readonly _tag: "SucceededAcquireResources";
100
100
  } | {
@@ -314,6 +314,10 @@ export declare const make: <A, I>(payloadSchema: Schema.Codec<A, I>) => {
314
314
  readonly threshold: number;
315
315
  }>;
316
316
  }, message: {
317
+ readonly _tag: "DismissedAll";
318
+ } | {
319
+ readonly _tag: "PressedEscape";
320
+ } | {
317
321
  readonly _tag: "Added";
318
322
  readonly entry: {
319
323
  readonly id: string;
@@ -392,10 +396,6 @@ export declare const make: <A, I>(payloadSchema: Schema.Codec<A, I>) => {
392
396
  readonly _tag: "ReleasedSwipePointer";
393
397
  readonly pointerId: number;
394
398
  readonly clientX: number;
395
- } | {
396
- readonly _tag: "DismissedAll";
397
- } | {
398
- readonly _tag: "PressedEscape";
399
399
  }) => Readonly<{
400
400
  model: {
401
401
  readonly id: string;
@@ -437,6 +437,10 @@ export declare const make: <A, I>(payloadSchema: Schema.Codec<A, I>) => {
437
437
  }>;
438
438
  };
439
439
  commands?: import("foldkit/update").Commands<{
440
+ readonly _tag: "DismissedAll";
441
+ } | {
442
+ readonly _tag: "PressedEscape";
443
+ } | {
440
444
  readonly _tag: "Added";
441
445
  readonly entry: {
442
446
  readonly id: string;
@@ -515,10 +519,6 @@ export declare const make: <A, I>(payloadSchema: Schema.Codec<A, I>) => {
515
519
  readonly _tag: "ReleasedSwipePointer";
516
520
  readonly pointerId: number;
517
521
  readonly clientX: number;
518
- } | {
519
- readonly _tag: "DismissedAll";
520
- } | {
521
- readonly _tag: "PressedEscape";
522
522
  }, never>;
523
523
  outMessage?: {
524
524
  readonly _tag: "DismissedToast";
@@ -609,6 +609,10 @@ export declare const make: <A, I>(payloadSchema: Schema.Codec<A, I>) => {
609
609
  }>;
610
610
  };
611
611
  commands?: import("foldkit/update").Commands<{
612
+ readonly _tag: "DismissedAll";
613
+ } | {
614
+ readonly _tag: "PressedEscape";
615
+ } | {
612
616
  readonly _tag: "Added";
613
617
  readonly entry: {
614
618
  readonly id: string;
@@ -687,10 +691,6 @@ export declare const make: <A, I>(payloadSchema: Schema.Codec<A, I>) => {
687
691
  readonly _tag: "ReleasedSwipePointer";
688
692
  readonly pointerId: number;
689
693
  readonly clientX: number;
690
- } | {
691
- readonly _tag: "DismissedAll";
692
- } | {
693
- readonly _tag: "PressedEscape";
694
694
  }, never>;
695
695
  outMessage?: {
696
696
  readonly _tag: "DismissedToast";
@@ -776,6 +776,10 @@ export declare const make: <A, I>(payloadSchema: Schema.Codec<A, I>) => {
776
776
  }>;
777
777
  };
778
778
  commands?: import("foldkit/update").Commands<{
779
+ readonly _tag: "DismissedAll";
780
+ } | {
781
+ readonly _tag: "PressedEscape";
782
+ } | {
779
783
  readonly _tag: "Added";
780
784
  readonly entry: {
781
785
  readonly id: string;
@@ -854,10 +858,6 @@ export declare const make: <A, I>(payloadSchema: Schema.Codec<A, I>) => {
854
858
  readonly _tag: "ReleasedSwipePointer";
855
859
  readonly pointerId: number;
856
860
  readonly clientX: number;
857
- } | {
858
- readonly _tag: "DismissedAll";
859
- } | {
860
- readonly _tag: "PressedEscape";
861
861
  }, never>;
862
862
  outMessage?: {
863
863
  readonly _tag: "DismissedToast";
@@ -943,6 +943,10 @@ export declare const make: <A, I>(payloadSchema: Schema.Codec<A, I>) => {
943
943
  }>;
944
944
  };
945
945
  commands?: import("foldkit/update").Commands<{
946
+ readonly _tag: "DismissedAll";
947
+ } | {
948
+ readonly _tag: "PressedEscape";
949
+ } | {
946
950
  readonly _tag: "Added";
947
951
  readonly entry: {
948
952
  readonly id: string;
@@ -1021,10 +1025,6 @@ export declare const make: <A, I>(payloadSchema: Schema.Codec<A, I>) => {
1021
1025
  readonly _tag: "ReleasedSwipePointer";
1022
1026
  readonly pointerId: number;
1023
1027
  readonly clientX: number;
1024
- } | {
1025
- readonly _tag: "DismissedAll";
1026
- } | {
1027
- readonly _tag: "PressedEscape";
1028
1028
  }, never>;
1029
1029
  outMessage?: {
1030
1030
  readonly _tag: "DismissedToast";
@@ -1071,6 +1071,10 @@ export declare const make: <A, I>(payloadSchema: Schema.Codec<A, I>) => {
1071
1071
  readonly threshold: number;
1072
1072
  }>;
1073
1073
  }, {
1074
+ readonly _tag: "DismissedAll";
1075
+ } | {
1076
+ readonly _tag: "PressedEscape";
1077
+ } | {
1074
1078
  readonly _tag: "Added";
1075
1079
  readonly entry: {
1076
1080
  readonly id: string;
@@ -1149,10 +1153,6 @@ export declare const make: <A, I>(payloadSchema: Schema.Codec<A, I>) => {
1149
1153
  readonly _tag: "ReleasedSwipePointer";
1150
1154
  readonly pointerId: number;
1151
1155
  readonly clientX: number;
1152
- } | {
1153
- readonly _tag: "DismissedAll";
1154
- } | {
1155
- readonly _tag: "PressedEscape";
1156
1156
  }, {
1157
1157
  readonly isSwipeEnabled: boolean;
1158
1158
  readonly isAnyDragging: boolean;
@@ -1198,6 +1198,10 @@ export declare const make: <A, I>(payloadSchema: Schema.Codec<A, I>) => {
1198
1198
  readonly threshold: number;
1199
1199
  }>;
1200
1200
  }, {
1201
+ readonly _tag: "DismissedAll";
1202
+ } | {
1203
+ readonly _tag: "PressedEscape";
1204
+ } | {
1201
1205
  readonly _tag: "Added";
1202
1206
  readonly entry: {
1203
1207
  readonly id: string;
@@ -1276,10 +1280,6 @@ export declare const make: <A, I>(payloadSchema: Schema.Codec<A, I>) => {
1276
1280
  readonly _tag: "ReleasedSwipePointer";
1277
1281
  readonly pointerId: number;
1278
1282
  readonly clientX: number;
1279
- } | {
1280
- readonly _tag: "DismissedAll";
1281
- } | {
1282
- readonly _tag: "PressedEscape";
1283
1283
  }, {
1284
1284
  readonly isSwipeEnabled: boolean;
1285
1285
  readonly isAnyDragging: boolean;
@@ -103,8 +103,6 @@ export declare const view: import("foldkit/submodel").View<{
103
103
  readonly pendingShowVersion: number;
104
104
  readonly maybeLastPointerType: Option.Option<string>;
105
105
  }, {
106
- readonly _tag: "PressedEscape";
107
- } | {
108
106
  readonly _tag: "CompletedWaitBeforeShowing";
109
107
  readonly version: number;
110
108
  } | {
@@ -117,6 +115,8 @@ export declare const view: import("foldkit/submodel").View<{
117
115
  readonly _tag: "FocusedTrigger";
118
116
  } | {
119
117
  readonly _tag: "LeftTrigger";
118
+ } | {
119
+ readonly _tag: "PressedEscape";
120
120
  } | {
121
121
  readonly _tag: "PressedPointerOnTrigger";
122
122
  readonly pointerType: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foldkit/ui",
3
- "version": "0.168.0",
3
+ "version": "0.169.0-canary.7ee214268c60",
4
4
  "description": "Headless, accessible UI components for Foldkit",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -134,16 +134,16 @@
134
134
  ],
135
135
  "peerDependencies": {
136
136
  "effect": "4.0.0",
137
- "foldkit": ">=0.167.0"
137
+ "foldkit": "0.169.0-canary.7ee214268c60"
138
138
  },
139
139
  "dependencies": {
140
140
  "@floating-ui/dom": "^1.8.0"
141
141
  },
142
142
  "devDependencies": {
143
143
  "@effect/vitest": "4.0.0",
144
- "@foldkit/vite-plugin": "0.27.1",
144
+ "@foldkit/vite-plugin": "0.28.0-canary.7ee214268c60",
145
145
  "effect": "4.0.0",
146
- "foldkit": "0.168.0",
146
+ "foldkit": "0.169.0-canary.7ee214268c60",
147
147
  "happy-dom": "^20.14.5",
148
148
  "rimraf": "^6.1.3",
149
149
  "typescript": "^7.0.2",