@k2b/ui 0.59.0 → 0.60.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.
- package/dist/browser/actions/CommandList.js +67 -74
- package/dist/browser/actions/CommandList.js.map +1 -1
- package/dist/browser/actions/ContextMenu.js +11 -2
- package/dist/browser/actions/ContextMenu.js.map +1 -1
- package/dist/browser/actions/Dropdown.js +187 -169
- package/dist/browser/actions/Dropdown.js.map +1 -1
- package/dist/browser/actions/GestureMenu.js +18 -7
- package/dist/browser/actions/GestureMenu.js.map +1 -1
- package/dist/browser/actions/SelectionAction.js +232 -0
- package/dist/browser/actions/SelectionAction.js.map +1 -0
- package/dist/browser/actions/command-items.js.map +1 -1
- package/dist/browser/actions/index.js +1 -0
- package/dist/browser/actions/index.js.map +1 -1
- package/dist/browser/actions/menu-sheet-open.js +19 -0
- package/dist/browser/actions/menu-sheet-open.js.map +1 -0
- package/dist/browser/charts/core/line-details.js +2 -2
- package/dist/browser/charts/core/line-details.js.map +1 -1
- package/dist/browser/charts/core/render.js +2 -1
- package/dist/browser/charts/core/render.js.map +1 -1
- package/dist/browser/chat/ChatActivityWords.js +142 -0
- package/dist/browser/chat/ChatActivityWords.js.map +1 -0
- package/dist/browser/chat/ChatComposer.js +540 -515
- package/dist/browser/chat/ChatComposer.js.map +1 -1
- package/dist/browser/chat/ChatComposerQuotes.js +56 -0
- package/dist/browser/chat/ChatComposerQuotes.js.map +1 -0
- package/dist/browser/chat/ChatPrimitives.js +281 -245
- package/dist/browser/chat/ChatPrimitives.js.map +1 -1
- package/dist/browser/chat/index.js +4 -1
- package/dist/browser/chat/index.js.map +1 -1
- package/dist/browser/content/ActivityList.js +789 -0
- package/dist/browser/content/ActivityList.js.map +1 -0
- package/dist/browser/content/DataTableTools.js +3 -0
- package/dist/browser/content/DataTableTools.js.map +1 -1
- package/dist/browser/content/Lightbox.js +2 -0
- package/dist/browser/content/Lightbox.js.map +1 -1
- package/dist/browser/content/MessageQuote.js +57 -0
- package/dist/browser/content/MessageQuote.js.map +1 -0
- package/dist/browser/content/MessageRow.js +413 -391
- package/dist/browser/content/MessageRow.js.map +1 -1
- package/dist/browser/content/VirtualFeed.js +29 -2
- package/dist/browser/content/VirtualFeed.js.map +1 -1
- package/dist/browser/content/activity-messages.js +47 -0
- package/dist/browser/content/activity-messages.js.map +1 -0
- package/dist/browser/content/activity-timeline.js +144 -0
- package/dist/browser/content/activity-timeline.js.map +1 -0
- package/dist/browser/content/chart-time-calendar.js +12 -18
- package/dist/browser/content/chart-time-calendar.js.map +1 -1
- package/dist/browser/content/find-text.js +47 -0
- package/dist/browser/content/find-text.js.map +1 -0
- package/dist/browser/content/index.js +1 -0
- package/dist/browser/content/index.js.map +1 -1
- package/dist/browser/content/quote-messages.js +25 -0
- package/dist/browser/content/quote-messages.js.map +1 -0
- package/dist/browser/feedback/dialog-core.js +118 -14
- package/dist/browser/feedback/dialog-core.js.map +1 -1
- package/dist/browser/feedback/dialog-frame-motion.js +274 -0
- package/dist/browser/feedback/dialog-frame-motion.js.map +1 -0
- package/dist/browser/feedback/prompt-sheet-view.js +2 -1
- package/dist/browser/feedback/prompt-sheet-view.js.map +1 -1
- package/dist/browser/feedback/prompts.js +49 -53
- package/dist/browser/feedback/prompts.js.map +1 -1
- package/dist/browser/hover-card.js +6 -0
- package/dist/browser/hover-card.js.map +1 -0
- package/dist/browser/inputs/AutocompleteEditor.js +2 -1
- package/dist/browser/inputs/AutocompleteEditor.js.map +1 -1
- package/dist/browser/inputs/AutocompleteSelect.js +3 -12
- package/dist/browser/inputs/AutocompleteSelect.js.map +1 -1
- package/dist/browser/inputs/ChoiceList.js +131 -127
- package/dist/browser/inputs/ChoiceList.js.map +1 -1
- package/dist/browser/inputs/Combobox.js +6 -15
- package/dist/browser/inputs/Combobox.js.map +1 -1
- package/dist/browser/inputs/MultiSelectInput.js +7 -16
- package/dist/browser/inputs/MultiSelectInput.js.map +1 -1
- package/dist/browser/inputs/PeriodPicker.js +475 -252
- package/dist/browser/inputs/PeriodPicker.js.map +1 -1
- package/dist/browser/inputs/RichSelect.js +431 -431
- package/dist/browser/inputs/RichSelect.js.map +1 -1
- package/dist/browser/inputs/Select.js +3 -12
- package/dist/browser/inputs/Select.js.map +1 -1
- package/dist/browser/inputs/SelectChip.js +1 -0
- package/dist/browser/inputs/SelectChip.js.map +1 -1
- package/dist/browser/inputs/TimeInput.js +181 -0
- package/dist/browser/inputs/TimeInput.js.map +1 -0
- package/dist/browser/inputs/choice.js.map +1 -1
- package/dist/browser/inputs/date-picker.js +2 -1
- package/dist/browser/inputs/date-picker.js.map +1 -1
- package/dist/browser/inputs/file-drop.js +2 -0
- package/dist/browser/inputs/file-drop.js.map +1 -1
- package/dist/browser/inputs/index.js +1 -0
- package/dist/browser/inputs/index.js.map +1 -1
- package/dist/browser/inputs/input-messages.js +20 -2
- package/dist/browser/inputs/input-messages.js.map +1 -1
- package/dist/browser/inputs/period-picker-messages.js +20 -2
- package/dist/browser/inputs/period-picker-messages.js.map +1 -1
- package/dist/browser/inputs/period.js +83 -0
- package/dist/browser/inputs/period.js.map +1 -1
- package/dist/browser/inputs/time-input.js +93 -0
- package/dist/browser/inputs/time-input.js.map +1 -0
- package/dist/browser/internal/exit-motion.js +23 -0
- package/dist/browser/internal/exit-motion.js.map +1 -0
- package/dist/browser/internal/option-description.js +47 -0
- package/dist/browser/internal/option-description.js.map +1 -0
- package/dist/browser/internal/scroll-places.js +15 -0
- package/dist/browser/internal/scroll-places.js.map +1 -0
- package/dist/browser/layout/AppWorkspace.js +572 -495
- package/dist/browser/layout/AppWorkspace.js.map +1 -1
- package/dist/browser/layout/BottomSheet.js +2 -14
- package/dist/browser/layout/BottomSheet.js.map +1 -1
- package/dist/browser/layout/Navigation.js +7 -2
- package/dist/browser/layout/Navigation.js.map +1 -1
- package/dist/browser/layout/SidebarSwitcher.js +28 -37
- package/dist/browser/layout/SidebarSwitcher.js.map +1 -1
- package/dist/browser/layout/app-workspace-controller.js +5 -1
- package/dist/browser/layout/app-workspace-controller.js.map +1 -1
- package/dist/browser/layout/bottom-sheet-load.js +17 -0
- package/dist/browser/layout/bottom-sheet-load.js.map +1 -0
- package/dist/browser/layout/bottom-sheet-options.js +27 -0
- package/dist/browser/layout/bottom-sheet-options.js.map +1 -0
- package/dist/browser/layout/index.js +2 -1
- package/dist/browser/layout/index.js.map +1 -1
- package/dist/browser/layout/sheet-motion.js +10 -11
- package/dist/browser/layout/sheet-motion.js.map +1 -1
- package/dist/browser/layout/sidebar-scroll-memory.js +30 -0
- package/dist/browser/layout/sidebar-scroll-memory.js.map +1 -1
- package/dist/browser/surfaces/AvatarStack.js +59 -43
- package/dist/browser/surfaces/AvatarStack.js.map +1 -1
- package/dist/browser/surfaces/LinkCard.js.map +1 -1
- package/dist/browser/surfaces/Section.js +4 -2
- package/dist/browser/surfaces/Section.js.map +1 -1
- package/dist/browser/surfaces/StatCell.js +56 -28
- package/dist/browser/surfaces/StatCell.js.map +1 -1
- package/dist/browser/surfaces/StatGrid.js +17 -8
- package/dist/browser/surfaces/StatGrid.js.map +1 -1
- package/dist/browser/surfaces/index.js.map +1 -1
- package/dist/ssr/actions/CommandList.js +23 -26
- package/dist/ssr/actions/CommandList.js.map +1 -1
- package/dist/ssr/actions/ContextMenu.js +8 -2
- package/dist/ssr/actions/ContextMenu.js.map +1 -1
- package/dist/ssr/actions/Dropdown.js +79 -55
- package/dist/ssr/actions/Dropdown.js.map +1 -1
- package/dist/ssr/actions/GestureMenu.js +18 -7
- package/dist/ssr/actions/GestureMenu.js.map +1 -1
- package/dist/ssr/actions/SelectionAction.js +212 -0
- package/dist/ssr/actions/SelectionAction.js.map +1 -0
- package/dist/ssr/actions/command-items.js.map +1 -1
- package/dist/ssr/actions/index.js +1 -0
- package/dist/ssr/actions/index.js.map +1 -1
- package/dist/ssr/actions/menu-sheet-open.js +19 -0
- package/dist/ssr/actions/menu-sheet-open.js.map +1 -0
- package/dist/ssr/charts/core/line-details.js +2 -2
- package/dist/ssr/charts/core/line-details.js.map +1 -1
- package/dist/ssr/charts/core/render.js +2 -1
- package/dist/ssr/charts/core/render.js.map +1 -1
- package/dist/ssr/chat/ChatActivityWords.js +126 -0
- package/dist/ssr/chat/ChatActivityWords.js.map +1 -0
- package/dist/ssr/chat/ChatComposer.js +24 -3
- package/dist/ssr/chat/ChatComposer.js.map +1 -1
- package/dist/ssr/chat/ChatComposerQuotes.js +26 -0
- package/dist/ssr/chat/ChatComposerQuotes.js.map +1 -0
- package/dist/ssr/chat/ChatPrimitives.js +53 -47
- package/dist/ssr/chat/ChatPrimitives.js.map +1 -1
- package/dist/ssr/chat/index.js +4 -1
- package/dist/ssr/chat/index.js.map +1 -1
- package/dist/ssr/content/ActivityList.js +553 -0
- package/dist/ssr/content/ActivityList.js.map +1 -0
- package/dist/ssr/content/DataTableTools.js +3 -0
- package/dist/ssr/content/DataTableTools.js.map +1 -1
- package/dist/ssr/content/Lightbox.js +2 -0
- package/dist/ssr/content/Lightbox.js.map +1 -1
- package/dist/ssr/content/MessageQuote.js +36 -0
- package/dist/ssr/content/MessageQuote.js.map +1 -0
- package/dist/ssr/content/MessageRow.js +112 -95
- package/dist/ssr/content/MessageRow.js.map +1 -1
- package/dist/ssr/content/VirtualFeed.js +29 -2
- package/dist/ssr/content/VirtualFeed.js.map +1 -1
- package/dist/ssr/content/activity-messages.js +47 -0
- package/dist/ssr/content/activity-messages.js.map +1 -0
- package/dist/ssr/content/activity-timeline.js +144 -0
- package/dist/ssr/content/activity-timeline.js.map +1 -0
- package/dist/ssr/content/chart-time-calendar.js +12 -18
- package/dist/ssr/content/chart-time-calendar.js.map +1 -1
- package/dist/ssr/content/find-text.js +47 -0
- package/dist/ssr/content/find-text.js.map +1 -0
- package/dist/ssr/content/index.js +1 -0
- package/dist/ssr/content/index.js.map +1 -1
- package/dist/ssr/content/quote-messages.js +25 -0
- package/dist/ssr/content/quote-messages.js.map +1 -0
- package/dist/ssr/feedback/dialog-core.js +118 -14
- package/dist/ssr/feedback/dialog-core.js.map +1 -1
- package/dist/ssr/feedback/dialog-frame-motion.js +274 -0
- package/dist/ssr/feedback/dialog-frame-motion.js.map +1 -0
- package/dist/ssr/feedback/prompt-sheet-view.js +2 -1
- package/dist/ssr/feedback/prompt-sheet-view.js.map +1 -1
- package/dist/ssr/feedback/prompts.js +16 -16
- package/dist/ssr/feedback/prompts.js.map +1 -1
- package/dist/ssr/hover-card.js +6 -0
- package/dist/ssr/hover-card.js.map +1 -0
- package/dist/ssr/inputs/AutocompleteEditor.js +2 -1
- package/dist/ssr/inputs/AutocompleteEditor.js.map +1 -1
- package/dist/ssr/inputs/AutocompleteSelect.js +3 -8
- package/dist/ssr/inputs/AutocompleteSelect.js.map +1 -1
- package/dist/ssr/inputs/ChoiceList.js +25 -25
- package/dist/ssr/inputs/ChoiceList.js.map +1 -1
- package/dist/ssr/inputs/Combobox.js +4 -9
- package/dist/ssr/inputs/Combobox.js.map +1 -1
- package/dist/ssr/inputs/MultiSelectInput.js +4 -9
- package/dist/ssr/inputs/MultiSelectInput.js.map +1 -1
- package/dist/ssr/inputs/PeriodPicker.js +241 -46
- package/dist/ssr/inputs/PeriodPicker.js.map +1 -1
- package/dist/ssr/inputs/RichSelect.js +135 -121
- package/dist/ssr/inputs/RichSelect.js.map +1 -1
- package/dist/ssr/inputs/Select.js +3 -8
- package/dist/ssr/inputs/Select.js.map +1 -1
- package/dist/ssr/inputs/SelectChip.js +1 -0
- package/dist/ssr/inputs/SelectChip.js.map +1 -1
- package/dist/ssr/inputs/TimeInput.js +145 -0
- package/dist/ssr/inputs/TimeInput.js.map +1 -0
- package/dist/ssr/inputs/choice.js.map +1 -1
- package/dist/ssr/inputs/date-picker.js +2 -1
- package/dist/ssr/inputs/date-picker.js.map +1 -1
- package/dist/ssr/inputs/file-drop.js +2 -0
- package/dist/ssr/inputs/file-drop.js.map +1 -1
- package/dist/ssr/inputs/index.js +1 -0
- package/dist/ssr/inputs/index.js.map +1 -1
- package/dist/ssr/inputs/input-messages.js +20 -2
- package/dist/ssr/inputs/input-messages.js.map +1 -1
- package/dist/ssr/inputs/period-picker-messages.js +20 -2
- package/dist/ssr/inputs/period-picker-messages.js.map +1 -1
- package/dist/ssr/inputs/period.js +83 -0
- package/dist/ssr/inputs/period.js.map +1 -1
- package/dist/ssr/inputs/time-input.js +93 -0
- package/dist/ssr/inputs/time-input.js.map +1 -0
- package/dist/ssr/internal/exit-motion.js +23 -0
- package/dist/ssr/internal/exit-motion.js.map +1 -0
- package/dist/ssr/internal/option-description.js +27 -0
- package/dist/ssr/internal/option-description.js.map +1 -0
- package/dist/ssr/internal/scroll-places.js +15 -0
- package/dist/ssr/internal/scroll-places.js.map +1 -0
- package/dist/ssr/layout/AppWorkspace.js +191 -121
- package/dist/ssr/layout/AppWorkspace.js.map +1 -1
- package/dist/ssr/layout/BottomSheet.js +2 -14
- package/dist/ssr/layout/BottomSheet.js.map +1 -1
- package/dist/ssr/layout/Navigation.js +7 -2
- package/dist/ssr/layout/Navigation.js.map +1 -1
- package/dist/ssr/layout/SidebarSwitcher.js +8 -13
- package/dist/ssr/layout/SidebarSwitcher.js.map +1 -1
- package/dist/ssr/layout/app-workspace-controller.js +5 -1
- package/dist/ssr/layout/app-workspace-controller.js.map +1 -1
- package/dist/ssr/layout/bottom-sheet-load.js +17 -0
- package/dist/ssr/layout/bottom-sheet-load.js.map +1 -0
- package/dist/ssr/layout/bottom-sheet-options.js +27 -0
- package/dist/ssr/layout/bottom-sheet-options.js.map +1 -0
- package/dist/ssr/layout/index.js +2 -1
- package/dist/ssr/layout/index.js.map +1 -1
- package/dist/ssr/layout/sheet-motion.js +10 -11
- package/dist/ssr/layout/sheet-motion.js.map +1 -1
- package/dist/ssr/layout/sidebar-scroll-memory.js +30 -0
- package/dist/ssr/layout/sidebar-scroll-memory.js.map +1 -1
- package/dist/ssr/surfaces/AvatarStack.js +56 -40
- package/dist/ssr/surfaces/AvatarStack.js.map +1 -1
- package/dist/ssr/surfaces/LinkCard.js.map +1 -1
- package/dist/ssr/surfaces/Section.js +4 -2
- package/dist/ssr/surfaces/Section.js.map +1 -1
- package/dist/ssr/surfaces/StatCell.js +24 -12
- package/dist/ssr/surfaces/StatCell.js.map +1 -1
- package/dist/ssr/surfaces/StatGrid.js +12 -6
- package/dist/ssr/surfaces/StatGrid.js.map +1 -1
- package/dist/ssr/surfaces/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/actions/Dropdown.d.ts +10 -0
- package/dist/types/actions/SelectionAction.d.ts +34 -0
- package/dist/types/actions/command-items.d.ts +5 -0
- package/dist/types/actions/index.d.ts +2 -0
- package/dist/types/actions/menu-sheet-open.d.ts +13 -0
- package/dist/types/charts/core/line-details.d.ts +1 -1
- package/dist/types/chat/ChatActivityWords.d.ts +31 -0
- package/dist/types/chat/ChatComposer.d.ts +17 -1
- package/dist/types/chat/ChatComposerQuotes.d.ts +10 -0
- package/dist/types/chat/ChatPrimitives.d.ts +17 -1
- package/dist/types/chat/index.d.ts +6 -2
- package/dist/types/content/ActivityList.d.ts +166 -0
- package/dist/types/content/DataTableTools.d.ts +2 -0
- package/dist/types/content/MessageQuote.d.ts +9 -0
- package/dist/types/content/MessageRow.d.ts +5 -0
- package/dist/types/content/VirtualFeed.d.ts +6 -0
- package/dist/types/content/activity-messages.d.ts +22 -0
- package/dist/types/content/activity-timeline.d.ts +52 -0
- package/dist/types/content/chart-time-calendar.d.ts +6 -0
- package/dist/types/content/find-text.d.ts +10 -0
- package/dist/types/content/index.d.ts +1 -0
- package/dist/types/content/quote-messages.d.ts +6 -0
- package/dist/types/feedback/dialog-core.d.ts +2 -0
- package/dist/types/feedback/dialog-frame-motion.d.ts +37 -0
- package/dist/types/feedback/prompts.d.ts +5 -0
- package/dist/types/hover-card.d.ts +5 -0
- package/dist/types/inputs/ChoiceList.d.ts +12 -5
- package/dist/types/inputs/Combobox.d.ts +5 -0
- package/dist/types/inputs/MultiSelectInput.d.ts +1 -0
- package/dist/types/inputs/PeriodPicker.d.ts +10 -0
- package/dist/types/inputs/RichSelect.d.ts +5 -0
- package/dist/types/inputs/Select.d.ts +1 -0
- package/dist/types/inputs/SelectChip.d.ts +5 -0
- package/dist/types/inputs/TimeInput.d.ts +16 -0
- package/dist/types/inputs/choice.d.ts +6 -1
- package/dist/types/inputs/index.d.ts +2 -0
- package/dist/types/inputs/input-messages.d.ts +9 -0
- package/dist/types/inputs/period-picker-messages.d.ts +9 -0
- package/dist/types/inputs/period.d.ts +41 -0
- package/dist/types/inputs/time-input.d.ts +43 -0
- package/dist/types/internal/exit-motion.d.ts +10 -0
- package/dist/types/internal/option-description.d.ts +20 -0
- package/dist/types/internal/scroll-places.d.ts +2 -0
- package/dist/types/layout/AppWorkspace.d.ts +10 -0
- package/dist/types/layout/BottomSheet.d.ts +1 -14
- package/dist/types/layout/SidebarSwitcher.d.ts +5 -0
- package/dist/types/layout/bottom-sheet-load.d.ts +9 -0
- package/dist/types/layout/bottom-sheet-options.d.ts +18 -0
- package/dist/types/layout/index.d.ts +3 -2
- package/dist/types/layout/sheet-motion.d.ts +0 -5
- package/dist/types/layout/sidebar-scroll-memory.d.ts +6 -0
- package/dist/types/surfaces/LinkCard.d.ts +2 -1
- package/dist/types/surfaces/StatCell.d.ts +7 -2
- package/dist/types/surfaces/StatGrid.d.ts +15 -3
- package/dist/types/surfaces/index.d.ts +1 -1
- package/package.json +12 -5
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The motion of one dialog element's frame while it stays open: a level that replaces another morphs the frame from
|
|
3
|
+
* the old size to the new one in the same place, without stacking. The old content fades out, the frame changes size
|
|
4
|
+
* over `--k2b-motion-morph` with `--k2b-ease-morph`, and the new content fades in, set at its final size from the
|
|
5
|
+
* first frame so it never rewraps; the frame clips meanwhile. Anything that interrupts a change turns around from the
|
|
6
|
+
* values the eye sees; the endings of the interrupted change are dropped, not run. Reduced motion swaps in one frame.
|
|
7
|
+
*
|
|
8
|
+
* The frame's own size is animated, a named exception to "transform and opacity only" (see the motion guide): the
|
|
9
|
+
* frame stands alone above the page, so nothing beside it moves.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { restoreScroll } from "../internal/scroll-places";
|
|
13
|
+
export { afterExitTransitions } from "../internal/exit-motion";
|
|
14
|
+
|
|
15
|
+
/** Shares of the morph: the old content fades out in the first 80 of 280 ms, the new one waits 110 ms, then fades in 140 ms. */
|
|
16
|
+
const LEAVE_SHARE = 80 / 280;
|
|
17
|
+
const ARRIVE_DELAY_SHARE = 110 / 280;
|
|
18
|
+
const ARRIVE_SHARE = 140 / 280;
|
|
19
|
+
const STYLE_HELD = ["position", "inset", "width", "height", "flex"];
|
|
20
|
+
export const createFrameMotion = dialog => {
|
|
21
|
+
// Exists before its first message: a region inserted and filled at once is often not read.
|
|
22
|
+
const live = document.createElement("div");
|
|
23
|
+
live.className = "k2b-sr-only";
|
|
24
|
+
live.setAttribute("aria-live", "polite");
|
|
25
|
+
live.dataset.k2bDialogLive = "";
|
|
26
|
+
dialog.prepend(live);
|
|
27
|
+
// A region that was just inserted is read only once the accessibility tree knows it: its first message waits a frame.
|
|
28
|
+
let fresh = true;
|
|
29
|
+
requestAnimationFrame(() => {
|
|
30
|
+
fresh = false;
|
|
31
|
+
});
|
|
32
|
+
let frame;
|
|
33
|
+
const fades = new Map();
|
|
34
|
+
|
|
35
|
+
/** A time token in milliseconds; the stylesheet may hand it over as `280ms` or, registered, as `0.28s`. */
|
|
36
|
+
const token = name => {
|
|
37
|
+
const value = getComputedStyle(dialog).getPropertyValue(name).trim();
|
|
38
|
+
const amount = Number.parseFloat(value) || 0;
|
|
39
|
+
return value.endsWith("ms") ? amount : value.endsWith("s") ? amount * 1000 : amount;
|
|
40
|
+
};
|
|
41
|
+
const curve = (name, fallback) => getComputedStyle(dialog).getPropertyValue(name).trim() || fallback;
|
|
42
|
+
const animatable = () => typeof dialog.animate === "function";
|
|
43
|
+
|
|
44
|
+
/** Where the frame stays put while it changes size: centred by the stylesheet, a sheet on the bottom edge, or placed. */
|
|
45
|
+
const anchor = () => {
|
|
46
|
+
if (dialog.style.position === "fixed") return "fixed";
|
|
47
|
+
if (!dialog.classList.contains("k2b-bottom-sheet-frame")) return "center";
|
|
48
|
+
const asDialog = dialog.classList.contains("is-adaptive") && typeof matchMedia === "function" && matchMedia("(min-width: 48rem)").matches;
|
|
49
|
+
return asDialog ? "center" : "bottom";
|
|
50
|
+
};
|
|
51
|
+
/** What the eye sees now, including a size or place that is still moving. */
|
|
52
|
+
const seen = () => ({
|
|
53
|
+
width: dialog.offsetWidth,
|
|
54
|
+
height: dialog.offsetHeight,
|
|
55
|
+
top: Number.parseFloat(getComputedStyle(dialog).top) || 0
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
/** Its exact laid-out size: `offsetWidth` rounds, and a content a fraction narrower can wrap differently. */
|
|
59
|
+
const laidOut = element => {
|
|
60
|
+
const {
|
|
61
|
+
width,
|
|
62
|
+
height
|
|
63
|
+
} = getComputedStyle(element);
|
|
64
|
+
return {
|
|
65
|
+
width,
|
|
66
|
+
height
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
/** Out of the flow, at the size it has now, so it neither moves nor takes room while it fades. */
|
|
70
|
+
const hold = element => {
|
|
71
|
+
const {
|
|
72
|
+
width,
|
|
73
|
+
height
|
|
74
|
+
} = laidOut(element);
|
|
75
|
+
element.style.position = "absolute";
|
|
76
|
+
element.style.inset = "0 auto auto 0";
|
|
77
|
+
element.style.width = width;
|
|
78
|
+
element.style.height = height;
|
|
79
|
+
element.inert = true;
|
|
80
|
+
element.setAttribute("aria-hidden", "true");
|
|
81
|
+
};
|
|
82
|
+
const unhold = element => {
|
|
83
|
+
for (const property of STYLE_HELD) element.style.removeProperty(property);
|
|
84
|
+
element.inert = false;
|
|
85
|
+
element.removeAttribute("aria-hidden");
|
|
86
|
+
};
|
|
87
|
+
/** At its final size while the frame moves around it. */
|
|
88
|
+
const pin = element => {
|
|
89
|
+
const {
|
|
90
|
+
width,
|
|
91
|
+
height
|
|
92
|
+
} = laidOut(element);
|
|
93
|
+
element.style.width = width;
|
|
94
|
+
element.style.height = height;
|
|
95
|
+
element.style.flex = "none";
|
|
96
|
+
};
|
|
97
|
+
const fade = (element, to, duration, delay, done) => {
|
|
98
|
+
const running = fades.get(element);
|
|
99
|
+
// A fade that is under way turns around from its current value; only content that was hidden starts at 0.
|
|
100
|
+
const from = running ? Number(getComputedStyle(element).opacity) : to === 1 ? 0 : 1;
|
|
101
|
+
running?.animation.cancel();
|
|
102
|
+
fades.delete(element);
|
|
103
|
+
if (!duration || !animatable()) {
|
|
104
|
+
done();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const animation = element.animate([{
|
|
108
|
+
opacity: from
|
|
109
|
+
}, {
|
|
110
|
+
opacity: to
|
|
111
|
+
}], {
|
|
112
|
+
duration,
|
|
113
|
+
delay: running ? 0 : delay,
|
|
114
|
+
easing: "linear",
|
|
115
|
+
fill: "both"
|
|
116
|
+
});
|
|
117
|
+
fades.set(element, {
|
|
118
|
+
animation,
|
|
119
|
+
to,
|
|
120
|
+
done
|
|
121
|
+
});
|
|
122
|
+
animation.onfinish = () => {
|
|
123
|
+
if (fades.get(element)?.animation !== animation) return;
|
|
124
|
+
fades.delete(element);
|
|
125
|
+
done();
|
|
126
|
+
animation.cancel();
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
const endFrame = () => {
|
|
130
|
+
frame?.cancel();
|
|
131
|
+
frame = undefined;
|
|
132
|
+
delete dialog.dataset.k2bFrameMotion;
|
|
133
|
+
};
|
|
134
|
+
let started;
|
|
135
|
+
/** The frame scrolls its contents itself, as unstructured content does. */
|
|
136
|
+
const scrolled = () => dialog.scrollTop > 0 || dialog.scrollLeft > 0;
|
|
137
|
+
const begin = (leaving, back) => {
|
|
138
|
+
started = {
|
|
139
|
+
from: seen(),
|
|
140
|
+
anchor: anchor(),
|
|
141
|
+
leaving,
|
|
142
|
+
scrolled: scrolled()
|
|
143
|
+
};
|
|
144
|
+
endFrame();
|
|
145
|
+
hold(leaving);
|
|
146
|
+
// The frame clips from now on: the held content, larger than the new one, must not give it a scrollbar while the
|
|
147
|
+
// new content is measured and pinned (a classic scrollbar would narrow it until the old content has gone). A frame
|
|
148
|
+
// that scrolls itself swaps at once and keeps its scroll place instead.
|
|
149
|
+
if (!started.scrolled) dialog.dataset.k2bFrameMotion = "";
|
|
150
|
+
if (!back) return;
|
|
151
|
+
// The shown level stays the dialog's last child, as sheets and tone rules expect; the closed one moves before it,
|
|
152
|
+
// with the scroll places the dialog core kept for it.
|
|
153
|
+
dialog.insertBefore(leaving, live.nextSibling);
|
|
154
|
+
restoreScroll(leaving);
|
|
155
|
+
};
|
|
156
|
+
const announce = role => {
|
|
157
|
+
const texts = attribute => (dialog.getAttribute(attribute) ?? "").split(/\s+/).map(id => id ? (document.getElementById(id)?.textContent ?? "").trim() : "").filter(Boolean);
|
|
158
|
+
const name = dialog.getAttribute("aria-label") ?? texts("aria-labelledby").join(" ");
|
|
159
|
+
const sentence = role === "alertdialog" ? texts("aria-describedby").join(" ") : "";
|
|
160
|
+
live.textContent = "";
|
|
161
|
+
const say = () => {
|
|
162
|
+
live.textContent = [name, sentence].filter(Boolean).join(" ");
|
|
163
|
+
};
|
|
164
|
+
requestAnimationFrame(() => fresh ? requestAnimationFrame(say) : say());
|
|
165
|
+
};
|
|
166
|
+
const arrive = (arriving, left) => {
|
|
167
|
+
const change = started;
|
|
168
|
+
started = undefined;
|
|
169
|
+
if (!change) return;
|
|
170
|
+
const {
|
|
171
|
+
from,
|
|
172
|
+
leaving
|
|
173
|
+
} = change;
|
|
174
|
+
unhold(arriving);
|
|
175
|
+
// Only this change's two contents share the frame: one that still fades out from an earlier change is gone now
|
|
176
|
+
// (one that comes back turns its fade around below).
|
|
177
|
+
for (const [element, {
|
|
178
|
+
animation,
|
|
179
|
+
to,
|
|
180
|
+
done
|
|
181
|
+
}] of fades) if (to === 0 && element !== leaving && element !== arriving) {
|
|
182
|
+
fades.delete(element);
|
|
183
|
+
animation.cancel();
|
|
184
|
+
done();
|
|
185
|
+
}
|
|
186
|
+
const leave = () => {
|
|
187
|
+
unhold(leaving);
|
|
188
|
+
left();
|
|
189
|
+
};
|
|
190
|
+
const duration = animatable() ? token("--k2b-motion-morph") : 0;
|
|
191
|
+
// Between a sheet and a centred dialog there is no shared edge to morph from. A frame that scrolls itself swaps at
|
|
192
|
+
// once too: its contents stand in its scrolled space, which a moving size would cut or shift.
|
|
193
|
+
if (!duration || anchor() !== change.anchor || change.scrolled || scrolled()) {
|
|
194
|
+
delete dialog.dataset.k2bFrameMotion;
|
|
195
|
+
fade(leaving, 0, 0, 0, leave);
|
|
196
|
+
fade(arriving, 1, 0, 0, () => {});
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const to = seen();
|
|
200
|
+
pin(arriving);
|
|
201
|
+
// The new level's own size limits would cut the old size at the first frame: the motion sets both sizes itself.
|
|
202
|
+
const size = geometry => ({
|
|
203
|
+
width: `${geometry.width}px`,
|
|
204
|
+
height: `${geometry.height}px`,
|
|
205
|
+
minWidth: "0",
|
|
206
|
+
minHeight: "0",
|
|
207
|
+
maxWidth: "none",
|
|
208
|
+
maxHeight: "none",
|
|
209
|
+
...(change.anchor === "center" ? {
|
|
210
|
+
top: `${geometry.top}px`
|
|
211
|
+
} : {})
|
|
212
|
+
});
|
|
213
|
+
dialog.dataset.k2bFrameMotion = "";
|
|
214
|
+
const animation = dialog.animate([size(from), size(to)], {
|
|
215
|
+
duration,
|
|
216
|
+
easing: curve("--k2b-ease-morph", "ease-out")
|
|
217
|
+
});
|
|
218
|
+
frame = animation;
|
|
219
|
+
// The new content keeps its final size until the frame has arrived there too, so it never rewraps; its fade
|
|
220
|
+
// ends earlier (at 250 of 280 ms).
|
|
221
|
+
animation.onfinish = () => {
|
|
222
|
+
if (frame !== animation) return;
|
|
223
|
+
endFrame();
|
|
224
|
+
for (const property of ["width", "height", "flex"]) arriving.style.removeProperty(property);
|
|
225
|
+
// A sheet measures its rests again at the frame's new size.
|
|
226
|
+
dialog.dispatchEvent(new Event("k2b-frame-resize"));
|
|
227
|
+
};
|
|
228
|
+
fade(leaving, 0, duration * LEAVE_SHARE, 0, leave);
|
|
229
|
+
fade(arriving, 1, duration * ARRIVE_SHARE, duration * ARRIVE_DELAY_SHARE, () => {});
|
|
230
|
+
};
|
|
231
|
+
const stop = () => {
|
|
232
|
+
started = undefined;
|
|
233
|
+
endFrame();
|
|
234
|
+
const pending = [...fades.values()];
|
|
235
|
+
fades.clear();
|
|
236
|
+
for (const {
|
|
237
|
+
animation,
|
|
238
|
+
done
|
|
239
|
+
} of pending) {
|
|
240
|
+
animation.cancel();
|
|
241
|
+
done();
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
const freeze = () => {
|
|
245
|
+
started = undefined;
|
|
246
|
+
// What the eye sees stays: the running values become the frame's and the contents' own styles.
|
|
247
|
+
if (frame) {
|
|
248
|
+
frame.commitStyles();
|
|
249
|
+
frame.cancel();
|
|
250
|
+
frame = undefined;
|
|
251
|
+
}
|
|
252
|
+
const pending = [...fades.values()];
|
|
253
|
+
fades.clear();
|
|
254
|
+
for (const {
|
|
255
|
+
animation
|
|
256
|
+
} of pending) {
|
|
257
|
+
animation.commitStyles();
|
|
258
|
+
animation.cancel();
|
|
259
|
+
}
|
|
260
|
+
return () => {
|
|
261
|
+
for (const {
|
|
262
|
+
done
|
|
263
|
+
} of pending) done();
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
return {
|
|
267
|
+
begin,
|
|
268
|
+
arrive,
|
|
269
|
+
announce,
|
|
270
|
+
stop,
|
|
271
|
+
freeze
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
//# sourceMappingURL=dialog-frame-motion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["feedback/dialog-frame-motion.ts"],"sourcesContent":["/**\n * The motion of one dialog element's frame while it stays open: a level that replaces another morphs the frame from\n * the old size to the new one in the same place, without stacking. The old content fades out, the frame changes size\n * over `--k2b-motion-morph` with `--k2b-ease-morph`, and the new content fades in, set at its final size from the\n * first frame so it never rewraps; the frame clips meanwhile. Anything that interrupts a change turns around from the\n * values the eye sees; the endings of the interrupted change are dropped, not run. Reduced motion swaps in one frame.\n *\n * The frame's own size is animated, a named exception to \"transform and opacity only\" (see the motion guide): the\n * frame stands alone above the page, so nothing beside it moves.\n */\n\nimport { restoreScroll } from \"../internal/scroll-places\";\n\nexport { afterExitTransitions } from \"../internal/exit-motion\";\n\n/** Shares of the morph: the old content fades out in the first 80 of 280 ms, the new one waits 110 ms, then fades in 140 ms. */\nconst LEAVE_SHARE = 80 / 280;\nconst ARRIVE_DELAY_SHARE = 110 / 280;\nconst ARRIVE_SHARE = 140 / 280;\n\ntype Anchor = \"center\" | \"bottom\" | \"fixed\";\ntype Fade = { animation: Animation; to: 0 | 1; done: () => void };\n\nexport type FrameMotion = {\n /**\n * Before a level replaces the shown one: remembers the frame as the eye sees it and takes `leaving` out of the flow,\n * visible and inert, at its present size.\n */\n begin: (leaving: HTMLElement, back?: boolean) => void;\n /**\n * A level that replaces another keeps the same `<dialog>`, so a screen reader does not reliably say its new name.\n * The live region inside the dialog does (`announce()` regions sit outside a modal dialog and are silent there): the\n * shown level's name, and for an `alertdialog` its sentence too.\n */\n announce: (role: \"dialog\" | \"alertdialog\") => void;\n /**\n * After `arriving` is shown and its frame presentation applied: morphs the frame to its size and fades the contents.\n * `left` runs once `leaving` has faded out (hide a lower level, or dispose a closed one).\n */\n arrive: (arriving: HTMLElement, left: () => void) => void;\n /** Ends every motion now and runs the pending endings, for a frame that leaves the document. */\n stop: () => void;\n /**\n * For a frame that closes and fades out: keeps the size, place and contents exactly as the eye sees them now, and\n * returns the pending endings to run once the frame has left.\n */\n freeze: () => () => void;\n};\n\nconst STYLE_HELD = [\"position\", \"inset\", \"width\", \"height\", \"flex\"] as const;\n\nexport const createFrameMotion = (dialog: HTMLDialogElement): FrameMotion => {\n // Exists before its first message: a region inserted and filled at once is often not read.\n const live = document.createElement(\"div\");\n live.className = \"k2b-sr-only\";\n live.setAttribute(\"aria-live\", \"polite\");\n live.dataset.k2bDialogLive = \"\";\n dialog.prepend(live);\n // A region that was just inserted is read only once the accessibility tree knows it: its first message waits a frame.\n let fresh = true;\n requestAnimationFrame(() => {\n fresh = false;\n });\n let frame: Animation | undefined;\n const fades = new Map<HTMLElement, Fade>();\n\n /** A time token in milliseconds; the stylesheet may hand it over as `280ms` or, registered, as `0.28s`. */\n const token = (name: string) => {\n const value = getComputedStyle(dialog).getPropertyValue(name).trim();\n const amount = Number.parseFloat(value) || 0;\n return value.endsWith(\"ms\") ? amount : value.endsWith(\"s\") ? amount * 1000 : amount;\n };\n const curve = (name: string, fallback: string) => getComputedStyle(dialog).getPropertyValue(name).trim() || fallback;\n const animatable = () => typeof dialog.animate === \"function\";\n\n /** Where the frame stays put while it changes size: centred by the stylesheet, a sheet on the bottom edge, or placed. */\n const anchor = (): Anchor => {\n if (dialog.style.position === \"fixed\") return \"fixed\";\n if (!dialog.classList.contains(\"k2b-bottom-sheet-frame\")) return \"center\";\n const asDialog =\n dialog.classList.contains(\"is-adaptive\") && typeof matchMedia === \"function\" && matchMedia(\"(min-width: 48rem)\").matches;\n return asDialog ? \"center\" : \"bottom\";\n };\n /** What the eye sees now, including a size or place that is still moving. */\n const seen = () => ({\n width: dialog.offsetWidth,\n height: dialog.offsetHeight,\n top: Number.parseFloat(getComputedStyle(dialog).top) || 0,\n });\n\n /** Its exact laid-out size: `offsetWidth` rounds, and a content a fraction narrower can wrap differently. */\n const laidOut = (element: HTMLElement) => {\n const { width, height } = getComputedStyle(element);\n return { width, height };\n };\n /** Out of the flow, at the size it has now, so it neither moves nor takes room while it fades. */\n const hold = (element: HTMLElement) => {\n const { width, height } = laidOut(element);\n element.style.position = \"absolute\";\n element.style.inset = \"0 auto auto 0\";\n element.style.width = width;\n element.style.height = height;\n element.inert = true;\n element.setAttribute(\"aria-hidden\", \"true\");\n };\n const unhold = (element: HTMLElement) => {\n for (const property of STYLE_HELD) element.style.removeProperty(property);\n element.inert = false;\n element.removeAttribute(\"aria-hidden\");\n };\n /** At its final size while the frame moves around it. */\n const pin = (element: HTMLElement) => {\n const { width, height } = laidOut(element);\n element.style.width = width;\n element.style.height = height;\n element.style.flex = \"none\";\n };\n\n const fade = (element: HTMLElement, to: 0 | 1, duration: number, delay: number, done: () => void) => {\n const running = fades.get(element);\n // A fade that is under way turns around from its current value; only content that was hidden starts at 0.\n const from = running ? Number(getComputedStyle(element).opacity) : to === 1 ? 0 : 1;\n running?.animation.cancel();\n fades.delete(element);\n if (!duration || !animatable()) {\n done();\n return;\n }\n const animation = element.animate([{ opacity: from }, { opacity: to }], {\n duration,\n delay: running ? 0 : delay,\n easing: \"linear\",\n fill: \"both\",\n });\n fades.set(element, { animation, to, done });\n animation.onfinish = () => {\n if (fades.get(element)?.animation !== animation) return;\n fades.delete(element);\n done();\n animation.cancel();\n };\n };\n\n const endFrame = () => {\n frame?.cancel();\n frame = undefined;\n delete dialog.dataset.k2bFrameMotion;\n };\n\n let started: { from: ReturnType<typeof seen>; anchor: Anchor; leaving: HTMLElement; scrolled: boolean } | undefined;\n /** The frame scrolls its contents itself, as unstructured content does. */\n const scrolled = () => dialog.scrollTop > 0 || dialog.scrollLeft > 0;\n\n const begin: FrameMotion[\"begin\"] = (leaving, back) => {\n started = { from: seen(), anchor: anchor(), leaving, scrolled: scrolled() };\n endFrame();\n hold(leaving);\n // The frame clips from now on: the held content, larger than the new one, must not give it a scrollbar while the\n // new content is measured and pinned (a classic scrollbar would narrow it until the old content has gone). A frame\n // that scrolls itself swaps at once and keeps its scroll place instead.\n if (!started.scrolled) dialog.dataset.k2bFrameMotion = \"\";\n if (!back) return;\n // The shown level stays the dialog's last child, as sheets and tone rules expect; the closed one moves before it,\n // with the scroll places the dialog core kept for it.\n dialog.insertBefore(leaving, live.nextSibling);\n restoreScroll(leaving);\n };\n\n const announce: FrameMotion[\"announce\"] = (role) => {\n const texts = (attribute: string) =>\n (dialog.getAttribute(attribute) ?? \"\")\n .split(/\\s+/)\n .map((id) => (id ? (document.getElementById(id)?.textContent ?? \"\").trim() : \"\"))\n .filter(Boolean);\n const name = dialog.getAttribute(\"aria-label\") ?? texts(\"aria-labelledby\").join(\" \");\n const sentence = role === \"alertdialog\" ? texts(\"aria-describedby\").join(\" \") : \"\";\n live.textContent = \"\";\n const say = () => {\n live.textContent = [name, sentence].filter(Boolean).join(\" \");\n };\n requestAnimationFrame(() => (fresh ? requestAnimationFrame(say) : say()));\n };\n\n const arrive: FrameMotion[\"arrive\"] = (arriving, left) => {\n const change = started;\n started = undefined;\n if (!change) return;\n const { from, leaving } = change;\n unhold(arriving);\n // Only this change's two contents share the frame: one that still fades out from an earlier change is gone now\n // (one that comes back turns its fade around below).\n for (const [element, { animation, to, done }] of fades)\n if (to === 0 && element !== leaving && element !== arriving) {\n fades.delete(element);\n animation.cancel();\n done();\n }\n const leave = () => {\n unhold(leaving);\n left();\n };\n const duration = animatable() ? token(\"--k2b-motion-morph\") : 0;\n // Between a sheet and a centred dialog there is no shared edge to morph from. A frame that scrolls itself swaps at\n // once too: its contents stand in its scrolled space, which a moving size would cut or shift.\n if (!duration || anchor() !== change.anchor || change.scrolled || scrolled()) {\n delete dialog.dataset.k2bFrameMotion;\n fade(leaving, 0, 0, 0, leave);\n fade(arriving, 1, 0, 0, () => {});\n return;\n }\n const to = seen();\n pin(arriving);\n // The new level's own size limits would cut the old size at the first frame: the motion sets both sizes itself.\n const size = (geometry: typeof from) => ({\n width: `${geometry.width}px`,\n height: `${geometry.height}px`,\n minWidth: \"0\",\n minHeight: \"0\",\n maxWidth: \"none\",\n maxHeight: \"none\",\n ...(change.anchor === \"center\" ? { top: `${geometry.top}px` } : {}),\n });\n dialog.dataset.k2bFrameMotion = \"\";\n const animation = dialog.animate([size(from), size(to)], { duration, easing: curve(\"--k2b-ease-morph\", \"ease-out\") });\n frame = animation;\n // The new content keeps its final size until the frame has arrived there too, so it never rewraps; its fade\n // ends earlier (at 250 of 280 ms).\n animation.onfinish = () => {\n if (frame !== animation) return;\n endFrame();\n for (const property of [\"width\", \"height\", \"flex\"] as const) arriving.style.removeProperty(property);\n // A sheet measures its rests again at the frame's new size.\n dialog.dispatchEvent(new Event(\"k2b-frame-resize\"));\n };\n fade(leaving, 0, duration * LEAVE_SHARE, 0, leave);\n fade(arriving, 1, duration * ARRIVE_SHARE, duration * ARRIVE_DELAY_SHARE, () => {});\n };\n\n const stop = () => {\n started = undefined;\n endFrame();\n const pending = [...fades.values()];\n fades.clear();\n for (const { animation, done } of pending) {\n animation.cancel();\n done();\n }\n };\n\n const freeze = () => {\n started = undefined;\n // What the eye sees stays: the running values become the frame's and the contents' own styles.\n if (frame) {\n frame.commitStyles();\n frame.cancel();\n frame = undefined;\n }\n const pending = [...fades.values()];\n fades.clear();\n for (const { animation } of pending) {\n animation.commitStyles();\n animation.cancel();\n }\n return () => {\n for (const { done } of pending) done();\n };\n };\n\n return { begin, arrive, announce, stop, freeze };\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,aAAa,QAAQ,2BAA2B;AAEzD,SAAS,oBAAoB,QAAQ,yBAAyB;;AAE9D;AACA,MAAM,WAAW,GAAG,EAAE,GAAG,GAAG;AAC5B,MAAM,kBAAkB,GAAG,GAAG,GAAG,GAAG;AACpC,MAAM,YAAY,GAAG,GAAG,GAAG,GAAG;AA+B9B,MAAM,UAAU,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAU;AAE5E,OAAO,MAAM,iBAAiB,GAAI,MAAyB,IAAkB;EAC3E;EACA,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC;EAC1C,IAAI,CAAC,SAAS,GAAG,aAAa;EAC9B,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC;EACx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#__PURE__*/_$template(`<button type=button class=k2b-bottom-sheet
|
|
|
12
12
|
import { onCleanup, onMount } from "solid-js";
|
|
13
13
|
import { suppressTextSelection } from "../internal/text-selection";
|
|
14
14
|
import { resolveUiMessages } from "../intl/messages";
|
|
15
|
-
import {
|
|
15
|
+
import { sheetInitialFocus } from "../layout/bottom-sheet-options";
|
|
16
|
+
import { attachSheetMotion } from "../layout/sheet-motion";
|
|
16
17
|
import { dialogCore } from "./dialog-core";
|
|
17
18
|
|
|
18
19
|
// The phone presentation of prompts: loaded only when a prompt opens on a phone, so a page that never shows one as a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["feedback/prompt-sheet-view.tsx"],"sourcesContent":["import { type JSX, onCleanup, onMount } from \"solid-js\";\nimport { suppressTextSelection } from \"../internal/text-selection\";\nimport { resolveUiMessages } from \"../intl/messages\";\nimport { attachSheetMotion, type SheetMotion
|
|
1
|
+
{"version":3,"names":[],"sources":["feedback/prompt-sheet-view.tsx"],"sourcesContent":["import { type JSX, onCleanup, onMount } from \"solid-js\";\nimport { suppressTextSelection } from \"../internal/text-selection\";\nimport { resolveUiMessages } from \"../intl/messages\";\nimport { sheetInitialFocus } from \"../layout/bottom-sheet-options\";\nimport { attachSheetMotion, type SheetMotion } from \"../layout/sheet-motion\";\nimport { type DialogRender, dialogCore, type OpenDialogOptions } from \"./dialog-core\";\n\n// The phone presentation of prompts: loaded only when a prompt opens on a phone, so a page that never shows one as a\n// sheet carries none of it.\n\nfunction PromptSheet(props: { children: JSX.Element; canDismiss: boolean; dismiss: () => void | Promise<void> }) {\n let handle: HTMLButtonElement | undefined;\n let motion: SheetMotion | undefined;\n let releaseTextSelection: (() => void) | undefined;\n onMount(() => {\n const panel = handle?.parentElement;\n const frame = panel?.closest<HTMLElement>(\".k2b-bottom-sheet-frame\");\n if (!handle || !panel || !frame) return;\n const own = attachSheetMotion({\n frame,\n panel,\n handle,\n detents: false,\n canDismiss: () => props.canDismiss,\n dismiss: props.dismiss,\n });\n motion = own;\n // dialogCore opens the dialog in the same task, after this; the sheet measures itself open before the first frame.\n queueMicrotask(() => own.open());\n });\n onCleanup(() => {\n releaseTextSelection?.();\n motion?.dispose();\n });\n const release = () => {\n releaseTextSelection?.();\n releaseTextSelection = undefined;\n };\n return (\n <>\n <button\n ref={handle}\n type=\"button\"\n class=\"k2b-bottom-sheet__handle\"\n aria-label={resolveUiMessages().close}\n disabled={!props.canDismiss}\n onPointerDown={(event) => {\n if (!event.isPrimary || event.button !== 0) return;\n release();\n releaseTextSelection = suppressTextSelection(event.pointerId);\n }}\n onPointerUp={release}\n onPointerCancel={release}\n onClick={() => {\n // The press after a drag never gets here: the sheet's motion swallows that click.\n if (motion) motion.press();\n else void props.dismiss();\n }}\n >\n <span aria-hidden=\"true\" />\n </button>\n {props.children}\n </>\n );\n}\n\n/** Opens the prompt as a bottom sheet; dismissing it, by its handle or a drag, takes the prompt's own dismiss path. */\nexport const openPromptSheet = <T,>(render: DialogRender<T>, options: OpenDialogOptions): Promise<T | undefined> =>\n dialogCore.open<T>(\n (close, context) => (\n <PromptSheet canDismiss={options.cancelBehavior !== \"ignore\"} dismiss={() => context.requestDismiss()}>\n {render(close, context)}\n </PromptSheet>\n ),\n {\n ...options,\n panelClassName: `${options.panelClassName ?? \"k2b-dialog\"} k2b-bottom-sheet-frame k2b-prompt-sheet`,\n contentClassName: `${options.contentClassName ?? \"\"} k2b-bottom-sheet-viewport`.trim(),\n initialFocus: options.initialFocus ?? sheetInitialFocus,\n },\n );\n"],"mappings":";;;;;;;;;;;AAAA,SAAmB,SAAS,EAAE,OAAO,QAAQ,UAAU;AACvD,SAAS,qBAAqB,QAAQ,4BAA4B;AAClE,SAAS,iBAAiB,QAAQ,kBAAkB;AACpD,SAAS,iBAAiB,QAAQ,gCAAgC;AAClE,SAAS,iBAAiB,QAA0B,wBAAwB;AAC5E,SAA4B,UAAU,QAAgC,eAAe;;AAErF;AACA;;AAEA,SAAS,WAAW,CAAC,KAA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3B,CAAC,KAAK,CAAC,UAAU;MAAA;MAAA;MAAA;IAAA;MAAA;MAAA;IAAA;IAAA;IAAA;EAAA,mBAgB5B,KAAK,CAAC,QAAQ;AAGrB;;AAEA;AACA,OAAO,MAAM,eAAe,GAAG,CAAK,MAAuB,EAAE,OAA0B,KACrF,UAAU,CAAC,IAAI,CACb,CAAC,KAAK,EAAE,OAAO,uBACZ,WAAW;EAAA,IAAC,UAAU;IAAA,OAAE,OAAO,CAAC,cAAc,KAAK,QAAQ;EAAA;EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC;EAAA;IAAA,OAClG,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC;EAAA;AAAA,EAE1B,EACD;EACE,GAAG,OAAO;EACV,cAAc,EAAE,GAAG,OAAO,CAAC,cAAc,IAAI,YAAY,0CAA0C;EACnG,gBAAgB,EAAE,GAAG,OAAO,CAAC,gBAAgB,IAAI,EAAE,4BAA4B,CAAC,IAAI,CAAC,CAAC;EACtF,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI;AACxC,CACF,CAAC;AAAC","ignoreList":[]}
|
|
@@ -27,10 +27,9 @@ var _tmpl$ = /*#__PURE__*/_$template(`<p>`),
|
|
|
27
27
|
_tmpl$10 = /*#__PURE__*/_$template(`<span class=k2b-prompt-search__preview>`),
|
|
28
28
|
_tmpl$11 = /*#__PURE__*/_$template(`<button type=button role=option><!$><!/><span class=k2b-prompt-search__copy><strong></strong><!$><!/>`),
|
|
29
29
|
_tmpl$12 = /*#__PURE__*/_$template(`<i aria-hidden=true>`),
|
|
30
|
-
_tmpl$13 = /*#__PURE__*/_$template(`<
|
|
31
|
-
_tmpl$14 = /*#__PURE__*/_$template(`<div class=k2b-
|
|
32
|
-
_tmpl$15 = /*#__PURE__*/_$template(`<div class=k2b-dialog__panel
|
|
33
|
-
_tmpl$16 = /*#__PURE__*/_$template(`<div class="k2b-dialog__panel k2b-dialog__stack"><!$><!/><div class=k2b-dialog__content>`);
|
|
30
|
+
_tmpl$13 = /*#__PURE__*/_$template(`<div class=k2b-prompt-copy>`),
|
|
31
|
+
_tmpl$14 = /*#__PURE__*/_$template(`<div class=k2b-dialog__panel><!$><!/><div class=k2b-dialog__body></div><footer class=k2b-dialog__actions><button type=button class=k2b-button>`),
|
|
32
|
+
_tmpl$15 = /*#__PURE__*/_$template(`<div class="k2b-dialog__panel k2b-dialog__stack"><!$><!/><div class=k2b-dialog__content>`);
|
|
34
33
|
import { mutation, timed } from "@k2b/stdlib/solid";
|
|
35
34
|
import { createEffect, createMemo, createSignal, createUniqueId, For, onCleanup, Show } from "solid-js";
|
|
36
35
|
import { createStore } from "solid-js/store";
|
|
@@ -44,6 +43,7 @@ import { resolveSelectMessages } from "../inputs/select-messages";
|
|
|
44
43
|
import { TagsInput } from "../inputs/TagsInput";
|
|
45
44
|
import { TextInput } from "../inputs/TextInput";
|
|
46
45
|
import { KeyedFor } from "../internal/keyed-for";
|
|
46
|
+
import { optionDescription } from "../internal/option-description";
|
|
47
47
|
import { resolveUiMessages } from "../intl/messages";
|
|
48
48
|
import { dialogCore } from "./dialog-core";
|
|
49
49
|
import { DialogHeader, promptButtonVariant, promptTone, sharedPrompts } from "./prompt-confirm";
|
|
@@ -444,6 +444,8 @@ const openSearchPrompt = (resolver, options) => dialogCore.open(close => {
|
|
|
444
444
|
const minQueryLength = options?.minQueryLength ?? 0;
|
|
445
445
|
const debounceMs = options?.debounceMs ?? 180;
|
|
446
446
|
const searchMutation = mutation.create({
|
|
447
|
+
// The newest query wins over a search still in flight.
|
|
448
|
+
concurrency: "replace",
|
|
447
449
|
onBefore: requestQuery => ({
|
|
448
450
|
requestQuery
|
|
449
451
|
}),
|
|
@@ -651,16 +653,10 @@ const openSearchPrompt = (resolver, options) => dialogCore.open(close => {
|
|
|
651
653
|
}
|
|
652
654
|
}), _el$38, _co$8);
|
|
653
655
|
_$insert(_el$34, () => item().label);
|
|
654
|
-
_$insert(_el$33,
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
children: description => (() => {
|
|
659
|
-
var _el$40 = _$getNextElement(_tmpl$13);
|
|
660
|
-
_$insert(_el$40, description);
|
|
661
|
-
return _el$40;
|
|
662
|
-
})()
|
|
663
|
-
}), _el$36, _co$7);
|
|
656
|
+
_$insert(_el$33, () => optionDescription(() => ({
|
|
657
|
+
description: item().desc,
|
|
658
|
+
descriptionVisual: item().descriptionVisual
|
|
659
|
+
})), _el$36, _co$7);
|
|
664
660
|
_$effect(_p$ => {
|
|
665
661
|
var _v$9 = optionId(index()),
|
|
666
662
|
_v$0 = activeIndex() === index(),
|
|
@@ -732,9 +728,9 @@ const promptText = (content, defaultValue, options) => prompts.form({
|
|
|
732
728
|
message: {
|
|
733
729
|
type: "info",
|
|
734
730
|
content: () => (() => {
|
|
735
|
-
var _el$
|
|
736
|
-
_$insert(_el$
|
|
737
|
-
return _el$
|
|
731
|
+
var _el$40 = _$getNextElement(_tmpl$13);
|
|
732
|
+
_$insert(_el$40, content);
|
|
733
|
+
return _el$40;
|
|
738
734
|
})()
|
|
739
735
|
},
|
|
740
736
|
value: {
|
|
@@ -750,9 +746,9 @@ const promptNumber = (content, defaultValue, options) => prompts.form({
|
|
|
750
746
|
message: {
|
|
751
747
|
type: "info",
|
|
752
748
|
content: () => (() => {
|
|
753
|
-
var _el$
|
|
754
|
-
_$insert(_el$
|
|
755
|
-
return _el$
|
|
749
|
+
var _el$41 = _$getNextElement(_tmpl$13);
|
|
750
|
+
_$insert(_el$41, content);
|
|
751
|
+
return _el$41;
|
|
756
752
|
})()
|
|
757
753
|
},
|
|
758
754
|
value: {
|
|
@@ -765,13 +761,13 @@ const promptNumber = (content, defaultValue, options) => prompts.form({
|
|
|
765
761
|
}
|
|
766
762
|
}).then(result => result?.value ?? null);
|
|
767
763
|
const openAlert = (content, options, celebrate) => openPrompt(close => (() => {
|
|
768
|
-
var _el$
|
|
769
|
-
_el$
|
|
770
|
-
[_el$
|
|
771
|
-
_el$
|
|
772
|
-
_el$
|
|
773
|
-
_el$
|
|
774
|
-
_$insert(_el$
|
|
764
|
+
var _el$42 = _$getNextElement(_tmpl$14),
|
|
765
|
+
_el$46 = _el$42.firstChild,
|
|
766
|
+
[_el$47, _co$9] = _$getNextMarker(_el$46.nextSibling),
|
|
767
|
+
_el$43 = _el$47.nextSibling,
|
|
768
|
+
_el$44 = _el$43.nextSibling,
|
|
769
|
+
_el$45 = _el$44.firstChild;
|
|
770
|
+
_$insert(_el$42, _$createComponent(DialogHeader, {
|
|
775
771
|
get title() {
|
|
776
772
|
return options?.title || resolveUiMessages().info;
|
|
777
773
|
},
|
|
@@ -783,13 +779,13 @@ const openAlert = (content, options, celebrate) => openPrompt(close => (() => {
|
|
|
783
779
|
},
|
|
784
780
|
celebrate: celebrate,
|
|
785
781
|
close: () => close()
|
|
786
|
-
}), _el$
|
|
787
|
-
_$insert(_el$
|
|
788
|
-
_el$
|
|
789
|
-
_$insert(_el$
|
|
790
|
-
_$effect(() => _$setAttribute(_el$
|
|
782
|
+
}), _el$47, _co$9);
|
|
783
|
+
_$insert(_el$43, content);
|
|
784
|
+
_el$45.$$click = () => close();
|
|
785
|
+
_$insert(_el$45, () => options?.confirmText || resolveUiMessages().ok);
|
|
786
|
+
_$effect(() => _$setAttribute(_el$45, "data-variant", promptButtonVariant(options?.variant)));
|
|
791
787
|
_$runHydrationEvents();
|
|
792
|
-
return _el$
|
|
788
|
+
return _el$42;
|
|
793
789
|
})(), options, resolveUiMessages().info);
|
|
794
790
|
|
|
795
791
|
// The same object as `sharedPrompts`, which `PanelDialog` uses for its discard question: replacing `prompts.confirm`
|
|
@@ -831,11 +827,11 @@ export const prompts = Object.assign(sharedPrompts, {
|
|
|
831
827
|
});
|
|
832
828
|
if (options?.surface === "bare" && options.header === false) return body;
|
|
833
829
|
return (() => {
|
|
834
|
-
var _el$
|
|
835
|
-
_el$
|
|
836
|
-
[_el$
|
|
837
|
-
_el$
|
|
838
|
-
_$insert(_el$
|
|
830
|
+
var _el$48 = _$getNextElement(_tmpl$15),
|
|
831
|
+
_el$50 = _el$48.firstChild,
|
|
832
|
+
[_el$51, _co$0] = _$getNextMarker(_el$50.nextSibling),
|
|
833
|
+
_el$49 = _el$51.nextSibling;
|
|
834
|
+
_$insert(_el$48, _$createComponent(Show, {
|
|
839
835
|
get when() {
|
|
840
836
|
return options?.header !== false;
|
|
841
837
|
},
|
|
@@ -853,22 +849,22 @@ export const prompts = Object.assign(sharedPrompts, {
|
|
|
853
849
|
close: () => dismiss()
|
|
854
850
|
});
|
|
855
851
|
}
|
|
856
|
-
}), _el$
|
|
857
|
-
_$insert(_el$
|
|
858
|
-
return _el$
|
|
852
|
+
}), _el$51, _co$0);
|
|
853
|
+
_$insert(_el$49, body);
|
|
854
|
+
return _el$48;
|
|
859
855
|
})();
|
|
860
856
|
}, options, resolveUiMessages().dialog,
|
|
861
857
|
// Without its header a custom dialog draws its own chrome and keeps the dialog frame.
|
|
862
858
|
options?.header !== false),
|
|
863
859
|
search: openSearchPrompt,
|
|
864
860
|
error: (content, options) => openPrompt(close => (() => {
|
|
865
|
-
var _el$
|
|
866
|
-
_el$
|
|
867
|
-
[_el$
|
|
868
|
-
_el$
|
|
869
|
-
_el$
|
|
870
|
-
_el$
|
|
871
|
-
_$insert(_el$
|
|
861
|
+
var _el$52 = _$getNextElement(_tmpl$14),
|
|
862
|
+
_el$56 = _el$52.firstChild,
|
|
863
|
+
[_el$57, _co$1] = _$getNextMarker(_el$56.nextSibling),
|
|
864
|
+
_el$53 = _el$57.nextSibling,
|
|
865
|
+
_el$54 = _el$53.nextSibling,
|
|
866
|
+
_el$55 = _el$54.firstChild;
|
|
867
|
+
_$insert(_el$52, _$createComponent(DialogHeader, {
|
|
872
868
|
get title() {
|
|
873
869
|
return options?.title ?? resolveUiMessages().error;
|
|
874
870
|
},
|
|
@@ -877,12 +873,12 @@ export const prompts = Object.assign(sharedPrompts, {
|
|
|
877
873
|
},
|
|
878
874
|
tone: "danger",
|
|
879
875
|
close: close
|
|
880
|
-
}), _el$
|
|
881
|
-
_$insert(_el$
|
|
882
|
-
_el$
|
|
883
|
-
_$insert(_el$
|
|
876
|
+
}), _el$57, _co$1);
|
|
877
|
+
_$insert(_el$53, content);
|
|
878
|
+
_el$55.$$click = () => close();
|
|
879
|
+
_$insert(_el$55, () => options?.confirmText || resolveUiMessages().close);
|
|
884
880
|
_$runHydrationEvents();
|
|
885
|
-
return _el$
|
|
881
|
+
return _el$52;
|
|
886
882
|
})(), {
|
|
887
883
|
...options,
|
|
888
884
|
variant: "danger"
|