ropav 0.11.1 → 0.12.1

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 (77) hide show
  1. package/AGENTS.md +150 -0
  2. package/README.md +5 -1
  3. package/dist/components/autocomplete/autocomplete-clear-button.js +1 -1
  4. package/dist/components/autocomplete/autocomplete-root.js +3 -0
  5. package/dist/components/checkbox/checkbox-root.js +6 -1
  6. package/dist/components/combo-box/combo-box-root.js +1 -0
  7. package/dist/components/date-picker/date-picker-root.js +1 -0
  8. package/dist/components/date-range-picker/date-range-picker-root.js +1 -0
  9. package/dist/components/form/form-root.js +7 -1
  10. package/dist/components/radio/radio-root.js +4 -1
  11. package/dist/components/scroll-shadow/scroll-shadow-root.js +2 -10
  12. package/dist/components/scroll-shadow/use-scroll-shadow.d.ts +10 -0
  13. package/dist/components/scroll-shadow/use-scroll-shadow.js +34 -2
  14. package/dist/components/search-field/search-field-group.js +21 -1
  15. package/dist/components/select/index.d.ts +3 -2
  16. package/dist/components/select/index.js +2 -1
  17. package/dist/components/select/select-clear-button.d.ts +21 -0
  18. package/dist/components/select/select-clear-button.js +66 -0
  19. package/dist/components/select/select-root.d.ts +2 -1
  20. package/dist/components/select/select-root.js +16 -1
  21. package/dist/components/select/select.context.d.ts +11 -0
  22. package/dist/components/select/select.types.d.ts +3 -0
  23. package/dist/components/switch/switch-root.js +6 -1
  24. package/dist/components/table/table-row.js +3 -2
  25. package/dist/components/table/use-grid-keyboard.js +2 -3
  26. package/dist/components/table/use-table-collection.d.ts +0 -11
  27. package/dist/components/table/use-table-collection.js +1 -17
  28. package/dist/components/tabs/tabs-root.js +5 -1
  29. package/dist/components/tabs/tabs.types.d.ts +6 -0
  30. package/dist/components/toast/index.d.ts +1 -1
  31. package/dist/components/toast/index.js +3 -3
  32. package/dist/components/toast/toast-default-content.js +26 -4
  33. package/dist/components/toast/toast-indicator.js +8 -2
  34. package/dist/components/toast/toast-provider.js +53 -5
  35. package/dist/components/toast/toast-queue.d.ts +60 -5
  36. package/dist/components/toast/toast-queue.js +85 -27
  37. package/dist/components/toast/toast-root.js +67 -14
  38. package/dist/components/toast/toast.constants.d.ts +17 -1
  39. package/dist/components/toast/toast.constants.js +18 -2
  40. package/dist/components/toast/toast.context.d.ts +6 -0
  41. package/dist/components/toast/toast.types.d.ts +19 -0
  42. package/dist/composables/use-checkbox-group-state.js +2 -0
  43. package/dist/composables/use-color-field-state.js +1 -0
  44. package/dist/composables/use-combo-box-state.d.ts +2 -0
  45. package/dist/composables/use-combo-box-state.js +3 -1
  46. package/dist/composables/use-date-field-state.js +1 -0
  47. package/dist/composables/use-date-picker-state.d.ts +2 -0
  48. package/dist/composables/use-date-picker-state.js +1 -0
  49. package/dist/composables/use-date-range-picker-state.d.ts +2 -0
  50. package/dist/composables/use-date-range-picker-state.js +2 -0
  51. package/dist/composables/use-description.js +1 -0
  52. package/dist/composables/use-form-validation-state.d.ts +48 -5
  53. package/dist/composables/use-form-validation-state.js +76 -7
  54. package/dist/composables/use-list-keyboard.d.ts +1 -1
  55. package/dist/composables/use-list-keyboard.js +4 -5
  56. package/dist/composables/use-measured-height.d.ts +18 -10
  57. package/dist/composables/use-measured-height.js +53 -15
  58. package/dist/composables/use-number-field-state.js +1 -0
  59. package/dist/composables/use-overlay-position.js +7 -4
  60. package/dist/composables/use-radio-group-state.js +2 -0
  61. package/dist/composables/use-select-state.d.ts +10 -0
  62. package/dist/composables/use-select-state.js +7 -0
  63. package/dist/composables/use-select.d.ts +7 -0
  64. package/dist/composables/use-select.js +6 -0
  65. package/dist/composables/use-text-field.js +1 -0
  66. package/dist/composables/use-toast-region.d.ts +18 -4
  67. package/dist/composables/use-toast-region.js +128 -6
  68. package/dist/composables/use-toast.d.ts +1 -1
  69. package/dist/composables/use-toast.js +4 -3
  70. package/dist/composables/use-toolbar.js +3 -1
  71. package/dist/composables/use-typeahead.js +3 -0
  72. package/dist/index.js +6 -5
  73. package/dist/ropav.min.css +1 -1
  74. package/dist/utils/focus.d.ts +13 -0
  75. package/dist/utils/focus.js +18 -1
  76. package/dist/version.js +1 -1
  77. package/package.json +5 -4
@@ -50,13 +50,18 @@ var switch_root_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PU
50
50
  const styles = computed(() => switchVariants({ size: props.size }));
51
51
  const validation = useFormValidationState({
52
52
  isInvalid: () => props.isInvalid,
53
+ isRequired: () => props.isRequired,
53
54
  name: () => props.name,
55
+ requiredControl: "checkbox",
54
56
  validate: () => props.validate,
55
57
  validationBehavior: () => props.validationBehavior,
56
58
  value: () => state.value
57
59
  });
58
60
  provideFieldErrorContext({ validation: validation.displayValidation });
59
- const { context: fieldIds, describedBy } = useFieldIds({ slots: ["description", "errorMessage"] });
61
+ const { context: fieldIds, describedBy } = useFieldIds({
62
+ labelElementType: "span",
63
+ slots: ["description", "errorMessage"]
64
+ });
60
65
  provideFieldIdsContext(fieldIds);
61
66
  const resolvedDescribedBy = computed(() => {
62
67
  const ids = [describedBy.value, props.ariaDescribedby].filter(Boolean);
@@ -1,10 +1,11 @@
1
1
  import { dataAttr } from "../../utils/assertion.js";
2
2
  import { useId as useId$1 } from "../../composables/use-id.js";
3
3
  import { useInteractionStates } from "../../composables/use-interaction-states.js";
4
+ import { isNestedControl } from "../../utils/focus.js";
4
5
  import { useVirtualizerItem } from "../virtualizer/use-virtualizer-item.js";
5
6
  import { visuallyHiddenStyle } from "../../utils/visually-hidden.js";
6
7
  import { provideTableRowContext, useTableGridContext, useTableVirtualizerContext } from "./table.context.js";
7
- import { createTableRegistry, isTableCellControl, tableCellId } from "./use-table-collection.js";
8
+ import { createTableRegistry, tableCellId } from "./use-table-collection.js";
8
9
  import { computed, createDynamicComponent, createIf, createSlot, defineVaporComponent, extend, on, renderEffect, setDynamicProps, setStaticTemplateRef, shallowRef, template, unref, watch } from "vue";
9
10
  //#region src/components/table/table-row.vue?vue&type=script&setup=true&vapor=true&lang.ts
10
11
  var t0 = template("<div>");
@@ -155,7 +156,7 @@ var table_row_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PURE
155
156
  });
156
157
  const onClick = (event) => {
157
158
  if (isDisabled.value || selectionMode.value === "none") return;
158
- if (isTableCellControl(event.target)) return;
159
+ if (isNestedControl(event.target)) return;
159
160
  selection.select(rowKey.value, {
160
161
  isCtrlPressed: event.ctrlKey || event.metaKey,
161
162
  isShiftPressed: event.shiftKey
@@ -1,5 +1,4 @@
1
- import { focusableIn, getScrollParent, isScrollable } from "../../utils/focus.js";
2
- import { isTableCellControl } from "./use-table-collection.js";
1
+ import { focusableIn, getScrollParent, isNestedControl, isScrollable } from "../../utils/focus.js";
3
2
  import { computed, nextTick, shallowRef, toValue, watch } from "vue";
4
3
  //#region src/components/table/use-grid-keyboard.ts
5
4
  var NO_FOCUS = {
@@ -307,7 +306,7 @@ var useGridKeyboard = (options) => {
307
306
  const target = event.target;
308
307
  if (toValue(options.isDisabled)) return;
309
308
  if (!element || !(target instanceof Node) || !element.contains(target)) return;
310
- if (isTableCellControl(target)) return;
309
+ if (isNestedControl(target)) return;
311
310
  const from = focused.value;
312
311
  const isModified = event.ctrlKey || event.metaKey;
313
312
  const move = (next) => {
@@ -135,14 +135,3 @@ export declare const normalizeIdKey: (key: CollectionKey) => string;
135
135
  export declare const tableColumnHeaderId: (tableId: string, columnKey: CollectionKey) => string;
136
136
  /** The id a row header cell carries, which is what `aria-labelledby` on the row points at. */
137
137
  export declare const tableCellId: (tableId: string, rowKey: CollectionKey, columnKey: CollectionKey) => string;
138
- /**
139
- * Whether an event landed on a control inside a cell rather than on a part of the grid.
140
- *
141
- * React Aria never has to ask: its press hook stops propagation, so a button or a checkbox in a
142
- * cell never lets the row or the grid see the interaction. Nothing stops propagation here, so both
143
- * the row's click handler and the grid's key handler have to recognise the case themselves.
144
- *
145
- * The grid's own parts are told apart by their collection marker — a cell holding the roving tab
146
- * stop matches the focusable selector without being content.
147
- */
148
- export declare const isTableCellControl: (target: EventTarget | null) => boolean;
@@ -1,4 +1,3 @@
1
- import { FOCUSABLE_SELECTOR } from "../../utils/focus.js";
2
1
  import { useCollection } from "../../composables/use-collection.js";
3
2
  import { createTableCollection } from "../../utils/virtualizer-collection.js";
4
3
  import { computed, shallowRef } from "vue";
@@ -113,20 +112,5 @@ var normalizeIdKey = (key) => typeof key === "string" ? key.replace(/\s*/g, "")
113
112
  var tableColumnHeaderId = (tableId, columnKey) => `${tableId}-${normalizeIdKey(columnKey)}`;
114
113
  /** The id a row header cell carries, which is what `aria-labelledby` on the row points at. */
115
114
  var tableCellId = (tableId, rowKey, columnKey) => `${tableId}-${normalizeIdKey(rowKey)}-${normalizeIdKey(columnKey)}`;
116
- /**
117
- * Whether an event landed on a control inside a cell rather than on a part of the grid.
118
- *
119
- * React Aria never has to ask: its press hook stops propagation, so a button or a checkbox in a
120
- * cell never lets the row or the grid see the interaction. Nothing stops propagation here, so both
121
- * the row's click handler and the grid's key handler have to recognise the case themselves.
122
- *
123
- * The grid's own parts are told apart by their collection marker — a cell holding the roving tab
124
- * stop matches the focusable selector without being content.
125
- */
126
- var isTableCellControl = (target) => {
127
- if (!(target instanceof Element)) return false;
128
- const control = target.closest(FOCUSABLE_SELECTOR);
129
- return control != null && !control.hasAttribute("data-collection");
130
- };
131
115
  //#endregion
132
- export { createTableRegistry, createTableTree, isTableCellControl, normalizeIdKey, tableCellId, tableColumnHeaderId, useTableCollection };
116
+ export { createTableRegistry, createTableTree, normalizeIdKey, tableCellId, tableColumnHeaderId, useTableCollection };
@@ -12,6 +12,7 @@ var tabs_root_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PURE
12
12
  __name: "tabs-root",
13
13
  props: {
14
14
  class: {},
15
+ align: { default: void 0 },
15
16
  selectedKey: {},
16
17
  defaultSelectedKey: {},
17
18
  disabledKeys: {},
@@ -32,7 +33,10 @@ var tabs_root_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PURE
32
33
  const orientation = computed(() => props.orientation ?? "horizontal");
33
34
  const keyboardActivation = computed(() => props.keyboardActivation ?? "automatic");
34
35
  const isDisabled = computed(() => Boolean(props.isDisabled));
35
- const slots = computed(() => tabsVariants({ variant: props.variant }));
36
+ const slots = computed(() => tabsVariants({
37
+ align: props.align,
38
+ variant: props.variant
39
+ }));
36
40
  const state = useTabListState({
37
41
  defaultSelectedKey: props.defaultSelectedKey,
38
42
  disabledKeys: () => props.disabledKeys,
@@ -8,6 +8,12 @@ export type TabsOrientation = "horizontal" | "vertical";
8
8
  export type TabsKeyboardActivation = "automatic" | "manual";
9
9
  export interface TabsRootProps {
10
10
  class?: string;
11
+ /**
12
+ * Where a tab's label and icon sit inside the tab.
13
+ *
14
+ * @default "center"
15
+ */
16
+ align?: TabsVariants["align"];
11
17
  /** The selected tab, when the caller drives it. */
12
18
  selectedKey?: CollectionKey;
13
19
  /** The initially selected tab. Falls back to the first tab that is not disabled. */
@@ -8,7 +8,7 @@ import ToastRoot from "./toast-root.js";
8
8
  import ToastTitle from "./toast-title.js";
9
9
  export { ToastActionButton, ToastCloseButton, ToastContent, ToastDescription, ToastIndicator, ToastProvider, ToastRoot as Toast, ToastTitle, };
10
10
  export type { ToastActionButtonProps, ToastActionValue, ToastAddOptions, ToastCloseButtonProps, ToastContentProps, ToastContentValue, ToastDescriptionProps, ToastIndicatorProps, ToastOptions, ToastPromiseOptions, ToastProviderProps, ToastProviderSlotProps, ToastQueueOptions, ToastRenderable, ToastRootProps as ToastProps, ToastTitleProps, QueuedToast, } from "./toast.types.js";
11
- export { ToastQueue, createToastFunction, getQueuedToastCount, resetToastQueue, toast, toastQueue, useToastQueue, } from "./toast-queue.js";
11
+ export { ToastQueue, createToastFunction, createViewTransitionUpdate, getQueuedToastCount, resetToastQueue, toast, toastQueue, useToastQueue, } from "./toast-queue.js";
12
12
  export type { Timer } from "./toast-queue.js";
13
13
  export type { ToastFunction, UseToastQueueReturn } from "./toast-queue.js";
14
14
  export { DEFAULT_GAP, DEFAULT_MAX_VISIBLE_TOAST, DEFAULT_SCALE_FACTOR, DEFAULT_TOAST_TIMEOUT, DEFAULT_TOAST_WIDTH, } from "./toast.constants.js";
@@ -4,10 +4,10 @@ import toast_close_button_default from "./toast-close-button.js";
4
4
  import toast_content_default from "./toast-content.js";
5
5
  import toast_description_default from "./toast-description.js";
6
6
  import toast_indicator_default from "./toast-indicator.js";
7
+ import { DEFAULT_GAP, DEFAULT_MAX_VISIBLE_TOAST, DEFAULT_SCALE_FACTOR, DEFAULT_TOAST_TIMEOUT, DEFAULT_TOAST_WIDTH } from "./toast.constants.js";
7
8
  import toast_root_default from "./toast-root.js";
8
9
  import toast_title_default from "./toast-title.js";
9
- import { DEFAULT_GAP, DEFAULT_MAX_VISIBLE_TOAST, DEFAULT_SCALE_FACTOR, DEFAULT_TOAST_TIMEOUT, DEFAULT_TOAST_WIDTH } from "./toast.constants.js";
10
- import { ToastQueue, createToastFunction, getQueuedToastCount, resetToastQueue, toast, toastQueue, useToastQueue } from "./toast-queue.js";
10
+ import { ToastQueue, createToastFunction, createViewTransitionUpdate, getQueuedToastCount, resetToastQueue, toast, toastQueue, useToastQueue } from "./toast-queue.js";
11
11
  import toast_provider_default from "./toast-provider.js";
12
12
  import { toastVariants } from "@ropav/styles";
13
- export { DEFAULT_GAP, DEFAULT_MAX_VISIBLE_TOAST, DEFAULT_SCALE_FACTOR, DEFAULT_TOAST_TIMEOUT, DEFAULT_TOAST_WIDTH, toast_root_default as Toast, toast_action_button_default as ToastActionButton, toast_close_button_default as ToastCloseButton, toast_content_default as ToastContent, toast_description_default as ToastDescription, toast_indicator_default as ToastIndicator, toast_provider_default as ToastProvider, ToastQueue, toast_title_default as ToastTitle, createToastFunction, getQueuedToastCount, resetToastQueue, toast, toastQueue, toastVariants, useToastItemContext, useToastQueue, useToastRegionContext };
13
+ export { DEFAULT_GAP, DEFAULT_MAX_VISIBLE_TOAST, DEFAULT_SCALE_FACTOR, DEFAULT_TOAST_TIMEOUT, DEFAULT_TOAST_WIDTH, toast_root_default as Toast, toast_action_button_default as ToastActionButton, toast_close_button_default as ToastCloseButton, toast_content_default as ToastContent, toast_description_default as ToastDescription, toast_indicator_default as ToastIndicator, toast_provider_default as ToastProvider, ToastQueue, toast_title_default as ToastTitle, createToastFunction, createViewTransitionUpdate, getQueuedToastCount, resetToastQueue, toast, toastQueue, toastVariants, useToastItemContext, useToastQueue, useToastRegionContext };
@@ -8,7 +8,7 @@ import toast_indicator_default from "./toast-indicator.js";
8
8
  import toast_renderable_default from "./toast-renderable.js";
9
9
  import toast_root_default from "./toast-root.js";
10
10
  import toast_title_default from "./toast-title.js";
11
- import { computed, createComponent, createIf, defineVaporComponent, extend, unref } from "vue";
11
+ import { computed, createComponent, createIf, defineVaporComponent, extend, shallowRef, unref, watch } from "vue";
12
12
  //#region src/components/toast/toast-default-content.vue?vue&type=script&setup=true&vapor=true&lang.ts
13
13
  var toast_default_content_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PURE__*/ defineVaporComponent({
14
14
  __name: "toast-default-content",
@@ -21,6 +21,19 @@ var toast_default_content_vue_vue_type_script_setup_true_vapor_true_lang_default
21
21
  * because there is no room for a row.
22
22
  */
23
23
  const isMobile = useMediaQuery("(max-width: 768px)");
24
+ /**
25
+ * Which of the three indicators is showing. Tracked here rather than inside the indicator because
26
+ * the three are separate branches: settling a promise toast unmounts the spinner's instance and
27
+ * mounts a fresh one, which would have no memory of what it replaced.
28
+ */
29
+ const indicatorKind = computed(() => {
30
+ if (content.value.isLoading === true) return "loading";
31
+ return content.value.indicator === void 0 ? "default" : "custom";
32
+ });
33
+ const hasSwappedIndicator = shallowRef(false);
34
+ watch(indicatorKind, () => {
35
+ hasSwappedIndicator.value = true;
36
+ });
24
37
  const action = computed(() => {
25
38
  const value = content.value.actionProps;
26
39
  return value?.label == null ? void 0 : value;
@@ -38,18 +51,27 @@ var toast_default_content_vue_vue_type_script_setup_true_vapor_true_lang_default
38
51
  return [
39
52
  createIf(() => content.value.indicator !== null, () => {
40
53
  return createIf(() => content.value.isLoading === true, () => {
41
- return createComponent(toast_indicator_default, { variant: () => content.value.variant }, () => {
54
+ return createComponent(toast_indicator_default, {
55
+ "is-swapped": () => hasSwappedIndicator.value,
56
+ variant: () => content.value.variant
57
+ }, () => {
42
58
  return createComponent(spinner_root_default, {
43
59
  color: "current",
44
60
  size: "sm"
45
61
  });
46
62
  });
47
63
  }, () => createIf(() => content.value.indicator !== void 0, () => {
48
- return createComponent(toast_indicator_default, { variant: () => content.value.variant }, () => {
64
+ return createComponent(toast_indicator_default, {
65
+ "is-swapped": () => hasSwappedIndicator.value,
66
+ variant: () => content.value.variant
67
+ }, () => {
49
68
  return createComponent(toast_renderable_default, { value: () => content.value.indicator });
50
69
  });
51
70
  }, () => {
52
- return createComponent(toast_indicator_default, { variant: () => content.value.variant });
71
+ return createComponent(toast_indicator_default, {
72
+ "is-swapped": () => hasSwappedIndicator.value,
73
+ variant: () => content.value.variant
74
+ });
53
75
  }, 517), 261);
54
76
  }),
55
77
  createComponent(toast_content_default, null, extend(() => {
@@ -1,15 +1,17 @@
1
+ import { dataAttr } from "../../utils/assertion.js";
1
2
  import danger_icon_default from "../icons/danger-icon.js";
2
3
  import info_icon_default from "../icons/info-icon.js";
3
4
  import success_icon_default from "../icons/success-icon.js";
4
5
  import warning_icon_default from "../icons/warning-icon.js";
5
6
  import { useToastItemContext } from "./toast.context.js";
6
- import { computed, createDynamicComponent, createSlot, defineVaporComponent, renderEffect, setClass, setInsertionState, template } from "vue";
7
+ import { computed, createDynamicComponent, createSlot, defineVaporComponent, renderEffect, setAttr, setClass, setInsertionState, template, unref } from "vue";
7
8
  //#region src/components/toast/toast-indicator.vue?vue&type=script&setup=true&vapor=true&lang.ts
8
9
  var t0 = template("<div data-slot=toast-indicator>", 1);
9
10
  var toast_indicator_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PURE__*/ defineVaporComponent({
10
11
  __name: "toast-indicator",
11
12
  props: {
12
13
  class: {},
14
+ isSwapped: { type: Boolean },
13
15
  variant: {}
14
16
  },
15
17
  setup(__props) {
@@ -25,7 +27,11 @@ var toast_indicator_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@
25
27
  }
26
28
  });
27
29
  const n3 = t0();
28
- renderEffect(() => setClass(n3, ["rp-toast__indicator", props.class]));
30
+ renderEffect(() => {
31
+ const _props = props;
32
+ setClass(n3, ["rp-toast__indicator", _props.class]);
33
+ setAttr(n3, "data-swapped", unref(dataAttr)(_props.isSwapped));
34
+ });
29
35
  setInsertionState(n3);
30
36
  createSlot("default", null, () => {
31
37
  return createDynamicComponent(() => defaultIcon.value, { "data-slot": "toast-default-icon" });
@@ -1,11 +1,12 @@
1
+ import { dataAttr } from "../../utils/assertion.js";
1
2
  import { composeSlotClassName } from "../../utils/compose.js";
2
3
  import { useLocale } from "../../composables/use-locale.js";
3
4
  import { provideToastRegionContext } from "./toast.context.js";
5
+ import { DEFAULT_SCALE_FACTOR, EXIT_FALLBACK } from "./toast.constants.js";
4
6
  import { useToastRegion } from "../../composables/use-toast-region.js";
5
7
  import toast_default_content_default from "./toast-default-content.js";
6
- import { DEFAULT_SCALE_FACTOR } from "./toast.constants.js";
7
8
  import { toastQueue, useToastQueue } from "./toast-queue.js";
8
- import { VaporTeleport, child, computed, createComponent, createFor, createIf, createSlot, defineVaporComponent, on, renderEffect, setDynamicProps, setInsertionState, setStyle, setTemplateRefBinding, shallowRef, template, unref } from "vue";
9
+ import { VaporTeleport, child, computed, createComponent, createFor, createIf, createSlot, defineVaporComponent, on, onScopeDispose, renderEffect, setDynamicProps, setInsertionState, setStyle, setTemplateRefBinding, shallowRef, template, unref, watch } from "vue";
9
10
  import { toastVariants } from "@ropav/styles";
10
11
  //#region src/components/toast/toast-provider.vue?vue&type=script&setup=true&vapor=true&lang.ts
11
12
  var t0 = template("<li>");
@@ -16,6 +17,8 @@ var toast_provider_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@_
16
17
  ariaLabel: {},
17
18
  class: {},
18
19
  gap: { default: 12 },
20
+ hotkey: {},
21
+ isExpanded: { type: Boolean },
19
22
  maxVisibleToasts: {},
20
23
  placement: { default: "bottom" },
21
24
  portalContainer: {},
@@ -27,6 +30,43 @@ var toast_provider_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@_
27
30
  const props = __props;
28
31
  const queue = computed(() => props.queue ?? toastQueue);
29
32
  const { visibleToasts } = useToastQueue(queue);
33
+ /**
34
+ * Toasts the queue has let go of that are still on screen playing their exit.
35
+ *
36
+ * Held here rather than in the queue because it is a rendering concern: the queue's job ends when
37
+ * a toast is closed, and a caller reading `visibleToasts` should not be told about one that is
38
+ * only still there to finish animating.
39
+ */
40
+ const exiting = shallowRef([]);
41
+ /**
42
+ * Timeouts that let a held toast go even if it never reports its exit.
43
+ *
44
+ * A backstop rather than the length of the animation, which the toast itself waits out: the
45
+ * provider's slot is the caller's to fill, and a slot that renders its own markup instead of a
46
+ * `ToastRoot` has nothing that would ever report. Without this, every closed toast would stay in
47
+ * the list for the life of the page.
48
+ */
49
+ const exitFallbacks = /* @__PURE__ */ new Map();
50
+ const release = (key) => {
51
+ clearTimeout(exitFallbacks.get(key));
52
+ exitFallbacks.delete(key);
53
+ exiting.value = exiting.value.filter((entry) => entry.key !== key);
54
+ };
55
+ watch(visibleToasts, (next, previous) => {
56
+ if (!previous) return;
57
+ const live = new Set(next.map((entry) => entry.key));
58
+ const gone = previous.filter((entry) => !live.has(entry.key));
59
+ if (gone.length === 0) return;
60
+ exiting.value = [...exiting.value, ...gone];
61
+ for (const entry of gone) exitFallbacks.set(entry.key, setTimeout(() => release(entry.key), EXIT_FALLBACK));
62
+ });
63
+ onScopeDispose(() => {
64
+ for (const timeout of exitFallbacks.values()) clearTimeout(timeout);
65
+ exitFallbacks.clear();
66
+ });
67
+ const exitingKeys = computed(() => new Set(exiting.value.map((entry) => entry.key)));
68
+ /** Exiting toasts sit after the live ones; each one carries the slot it had through its own style. */
69
+ const renderedToasts = computed(() => [...visibleToasts.value, ...exiting.value]);
30
70
  const element = shallowRef(null);
31
71
  const setElement = (next) => {
32
72
  element.value = next ?? null;
@@ -34,6 +74,8 @@ var toast_provider_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@_
34
74
  const region = useToastRegion({
35
75
  ariaLabel: () => props.ariaLabel,
36
76
  elementRef: element,
77
+ hotkey: () => props.hotkey,
78
+ isExpanded: () => props.isExpanded,
37
79
  onPauseAll: () => queue.value.pauseAll(),
38
80
  onResumeAll: () => queue.value.resumeAll(),
39
81
  visibleToasts
@@ -49,9 +91,12 @@ var toast_provider_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@_
49
91
  const heights = shallowRef({});
50
92
  provideToastRegionContext({
51
93
  close: (key) => queue.value.close(key),
94
+ exitingKeys,
52
95
  gap: computed(() => props.gap),
53
96
  heightsByKey: computed(() => heights.value),
97
+ isExpanded: region.isExpanded,
54
98
  maxVisibleToasts: computed(() => props.maxVisibleToasts ?? queue.value.maxVisibleToasts ?? 3),
99
+ onExitFinished: release,
55
100
  onToastHeightChange: (key, height) => {
56
101
  if (heights.value[key] === height) return;
57
102
  heights.value = {
@@ -82,21 +127,23 @@ var toast_provider_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@_
82
127
  * semantics without taking part in the layout the stylesheet builds out of absolute positioning.
83
128
  */
84
129
  const CONTENTS_STYLE = { display: "contents" };
85
- return createIf(() => unref(visibleToasts).length > 0, () => {
130
+ return createIf(() => renderedToasts.value.length > 0, () => {
86
131
  return createComponent(VaporTeleport, { to: () => target.value }, () => {
87
132
  const n9 = t1();
88
133
  const n8 = child(n9);
89
134
  renderEffect(() => {
135
+ const _region = unref(region);
90
136
  setDynamicProps(n9, [{
91
137
  class: styles.value,
138
+ "data-expanded": unref(dataAttr)(_region.isExpanded.value),
92
139
  "data-slot": "toast-region",
93
140
  dir: unref(locale).direction,
94
141
  style: regionStyle.value
95
- }, unref(region).regionAttrs.value]);
142
+ }, _region.regionAttrs.value]);
96
143
  setStyle(n8, CONTENTS_STYLE);
97
144
  });
98
145
  setInsertionState(n8);
99
- createFor(() => unref(visibleToasts), (_for_item0) => {
146
+ createFor(() => renderedToasts.value, (_for_item0) => {
100
147
  const n7 = t0();
101
148
  renderEffect(() => setStyle(n7, CONTENTS_STYLE));
102
149
  setInsertionState(n7);
@@ -112,6 +159,7 @@ var toast_provider_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@_
112
159
  on(n9, "focusout", (e) => unref(region).onFocusout(e));
113
160
  on(n9, "pointerenter", (e) => unref(region).onPointerenter(e));
114
161
  on(n9, "pointerleave", (e) => unref(region).onPointerleave(e));
162
+ on(n9, "pointermove", (e) => unref(region).onPointermove(e));
115
163
  setTemplateRefBinding(n9, () => setElement);
116
164
  return n9;
117
165
  }, true);
@@ -12,6 +12,7 @@ export declare class Timer {
12
12
  private startTime;
13
13
  private timerId;
14
14
  constructor(callback: () => void, delay: number);
15
+ /** Starts the clock again on `delay`, whether or not it was already running. */
15
16
  reset(delay: number): void;
16
17
  pause(): void;
17
18
  resume(): void;
@@ -20,7 +21,7 @@ export declare class Timer {
20
21
  * The order toasts are shown in, and the clocks that close them.
21
22
  *
22
23
  * Ported from `react-stately`'s `ToastQueue`, merged with the wrapper that normally sits around
23
- * it. Upstream those are two classes because the wrapper had a primitive to wrap; writing both
24
+ * it. There those are two classes because the wrapper had a primitive to wrap; writing both
24
25
  * here means keeping them apart would be two paths doing one job. What the merge keeps from the
25
26
  * wrapper: the default timeout, the serialized view transition, and `maxVisibleToasts` as a hint
26
27
  * the region reads rather than a truncation.
@@ -37,10 +38,22 @@ export declare class ToastQueue<T = ToastContentValue> {
37
38
  /** Every toast currently held, newest first. */
38
39
  visibleToasts: QueuedToast<T>[];
39
40
  constructor(options?: ToastQueueOptions);
40
- /** Forgets any transitions still queued. For a test, since a chain outlives a mount. */
41
- readonly resetTransitions: () => void;
42
41
  /** Adds a toast and returns its key. */
43
42
  add(content: T, options?: ToastOptions): string;
43
+ /**
44
+ * Replaces a toast's content where it stands, keeping its key and its place in the stack.
45
+ * Returns `false` for a key the queue no longer holds.
46
+ *
47
+ * Options the caller leaves out are kept rather than resolved: a toast asked to stay until
48
+ * something closes it must not pick up the default life because its message changed. That is
49
+ * why this reads the keys that are *present* instead of their values — an explicit `undefined`
50
+ * is a caller clearing a handler, and an absent key is a caller not mentioning one.
51
+ *
52
+ * The entry is replaced rather than mutated so the toast re-renders. The list is shallow, so a
53
+ * toast whose fields changed underneath it is the same object as far as anything watching is
54
+ * concerned; a new one keyed the same patches the node it already has.
55
+ */
56
+ update(key: string, content: T, options?: ToastOptions): boolean;
44
57
  /** Closes one toast. Notifies even for a key that is no longer held. */
45
58
  close(key: string): void;
46
59
  /** Drops every toast at once. Deliberately does not run their `onClose` — nothing closed them. */
@@ -51,8 +64,42 @@ export declare class ToastQueue<T = ToastContentValue> {
51
64
  resumeAll(): void;
52
65
  /** Subscribes to changes in the visible toasts. Returns the unsubscribe. */
53
66
  subscribe(fn: () => void): () => void;
54
- private update;
67
+ private notify;
55
68
  }
69
+ /**
70
+ * A queue's own chain of view transitions, so its updates animate one after another. Hand the
71
+ * `wrapUpdate` it returns to a queue to animate that queue's toasts this way.
72
+ *
73
+ * Not what a queue does by default, and the reason is measured rather than assumed: a chain is
74
+ * serial, so under a burst each toast waits for every transition queued ahead of it — the fifth
75
+ * toast of five added 80ms apart took 1.5s to appear, against 0.37s when the stack animates
76
+ * itself. A transition also replaces the toast with a snapshot that answers no hit test, so the
77
+ * close and action buttons of the frontmost toast are unreachable for as long as it runs. Neither
78
+ * shows up as dropped frames; both are plainly visible to someone using the thing.
79
+ *
80
+ * It stays because it is the only way to get a genuine cross-fade between two different toasts,
81
+ * and because a caller who wants it should not have to rebuild the chain below. Each toast names
82
+ * itself for the transition through `view-transition-name`, which is what makes the capture
83
+ * per-toast; without it the document root would be the only captured element and every toast
84
+ * would cross-fade the whole page.
85
+ *
86
+ * The View Transitions API allows one active transition per document: starting a second while the
87
+ * first is still animating aborts the first, which surfaces as a rejection on `ready`. Each new
88
+ * transition is appended to the *end* of the chain rather than attached to whichever is currently
89
+ * active, so three mutations inside one microtask stay in order — which is what `toast.promise`
90
+ * does while the loading toast's own entry is still in flight.
91
+ *
92
+ * **One chain per queue, not one per document.** Sharing a single chain across every queue looks
93
+ * more faithful to an API that only runs one transition at a time, and it is wrong: with several
94
+ * regions on a page, a burst of toasts in one of them puts every other region's toast behind the
95
+ * whole burst, so a toast added elsewhere does not appear until seconds later. Independent chains
96
+ * let a second region interrupt instead — the superseded transition is skipped, which the catch
97
+ * below already handles, which is why a chain belongs to one queue and is built per caller.
98
+ */
99
+ export declare const createViewTransitionUpdate: () => {
100
+ reset: () => void;
101
+ wrapUpdate: (fn: () => void) => void;
102
+ };
56
103
  export interface UseToastQueueReturn<T = ToastContentValue> {
57
104
  /** The toasts the queue currently holds, newest first. */
58
105
  visibleToasts: ComputedRef<QueuedToast<T>[]>;
@@ -80,6 +127,14 @@ export interface ToastFunction {
80
127
  promise: <T>(promise: (() => Promise<T>) | Promise<T>, options: ToastPromiseOptions<T>) => string;
81
128
  resumeAll: () => void;
82
129
  success: (message: ToastRenderable, options?: Omit<ToastAddOptions, "variant">) => string;
130
+ /**
131
+ * Replaces a toast's message where it stands, and adds one if that toast has already gone.
132
+ * Returns the key either way.
133
+ *
134
+ * `timeout` and `onClose` are kept when they are not mentioned; everything else describes the
135
+ * new content and is replaced.
136
+ */
137
+ update: (key: string, message: ToastRenderable, options?: ToastAddOptions) => string;
83
138
  warning: (message: ToastRenderable, options?: Omit<ToastAddOptions, "variant">) => string;
84
139
  }
85
140
  export declare const createToastFunction: (queue: ToastQueue<ToastContentValue>) => ToastFunction;
@@ -93,5 +148,5 @@ export declare const toastQueue: ToastQueue<ToastContentValue>;
93
148
  export declare const toast: ToastFunction;
94
149
  /** How many toasts the default queue holds. For a test asserting it did not leak into the next. */
95
150
  export declare const getQueuedToastCount: () => number;
96
- /** Empties the default queue and the transition chain. For a test, since both outlive a mount. */
151
+ /** Empties the default queue. For a test, since the queue outlives a mount. */
97
152
  export declare const resetToastQueue: () => void;