@k2b/ui 0.64.0 → 0.65.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/base.css +3 -6
- package/dist/browser/actions/ContextMenu.js +1 -3
- package/dist/browser/actions/ContextMenu.js.map +1 -1
- package/dist/browser/actions/Dropdown.js +15 -69
- package/dist/browser/actions/Dropdown.js.map +1 -1
- package/dist/browser/actions/SortableList.js +1 -1
- package/dist/browser/actions/SortableList.js.map +1 -1
- package/dist/browser/actions/ViewTabs.js +5 -9
- package/dist/browser/actions/ViewTabs.js.map +1 -1
- package/dist/browser/actions/drag-and-drop.js +1 -1
- package/dist/browser/actions/drag-and-drop.js.map +1 -1
- package/dist/browser/actions/index.js.map +1 -1
- package/dist/browser/actions/menu-sheet.js +18 -80
- package/dist/browser/actions/menu-sheet.js.map +1 -1
- package/dist/browser/content/DataTable.js +197 -285
- package/dist/browser/content/DataTable.js.map +1 -1
- package/dist/browser/content/MessageRow.js +139 -115
- package/dist/browser/content/MessageRow.js.map +1 -1
- package/dist/browser/content/ProgressPath.js +25 -30
- package/dist/browser/content/ProgressPath.js.map +1 -1
- package/dist/browser/content/index.js +0 -2
- package/dist/browser/content/index.js.map +1 -1
- package/dist/browser/feedback/dialog-core.js +0 -11
- package/dist/browser/feedback/dialog-core.js.map +1 -1
- package/dist/browser/internal/field.js +2 -2
- package/dist/browser/internal/field.js.map +1 -1
- package/dist/browser/intl/messages.js +1 -1
- package/dist/browser/intl/messages.js.map +1 -1
- package/dist/browser/layout/AppWorkspace.js +8 -16
- package/dist/browser/layout/AppWorkspace.js.map +1 -1
- package/dist/browser/layout/Breadcrumbs.js +42 -188
- package/dist/browser/layout/Breadcrumbs.js.map +1 -1
- package/dist/browser/layout/DetailPanel.js +205 -209
- package/dist/browser/layout/DetailPanel.js.map +1 -1
- package/dist/browser/layout/PanelDialog.js +88 -176
- package/dist/browser/layout/PanelDialog.js.map +1 -1
- package/dist/browser/layout/app-workspace-controller.js +5 -12
- package/dist/browser/layout/app-workspace-controller.js.map +1 -1
- package/dist/browser/layout/app-workspace-state.js +2 -2
- package/dist/browser/layout/app-workspace-state.js.map +1 -1
- package/dist/browser/layout/index.js +0 -2
- package/dist/browser/layout/index.js.map +1 -1
- package/dist/browser/layout/workspace-messages.js +2 -12
- package/dist/browser/layout/workspace-messages.js.map +1 -1
- package/dist/browser/surfaces/NoticeCard.js +57 -69
- package/dist/browser/surfaces/NoticeCard.js.map +1 -1
- package/dist/browser/surfaces/Placeholder.js +5 -17
- package/dist/browser/surfaces/Placeholder.js.map +1 -1
- package/dist/browser/surfaces/Section.js +7 -22
- package/dist/browser/surfaces/Section.js.map +1 -1
- package/dist/browser/surfaces/StatusBadge.js +1 -5
- package/dist/browser/surfaces/StatusBadge.js.map +1 -1
- package/dist/browser/surfaces/index.js +0 -4
- package/dist/browser/surfaces/index.js.map +1 -1
- package/dist/ssr/actions/ContextMenu.js +1 -3
- package/dist/ssr/actions/ContextMenu.js.map +1 -1
- package/dist/ssr/actions/Dropdown.js +15 -69
- package/dist/ssr/actions/Dropdown.js.map +1 -1
- package/dist/ssr/actions/SortableList.js +1 -1
- package/dist/ssr/actions/SortableList.js.map +1 -1
- package/dist/ssr/actions/ViewTabs.js +5 -9
- package/dist/ssr/actions/ViewTabs.js.map +1 -1
- package/dist/ssr/actions/drag-and-drop.js +1 -1
- package/dist/ssr/actions/drag-and-drop.js.map +1 -1
- package/dist/ssr/actions/index.js.map +1 -1
- package/dist/ssr/actions/menu-sheet.js +10 -62
- package/dist/ssr/actions/menu-sheet.js.map +1 -1
- package/dist/ssr/content/DataTable.js +54 -64
- package/dist/ssr/content/DataTable.js.map +1 -1
- package/dist/ssr/content/MessageRow.js +30 -10
- package/dist/ssr/content/MessageRow.js.map +1 -1
- package/dist/ssr/content/ProgressPath.js +8 -14
- package/dist/ssr/content/ProgressPath.js.map +1 -1
- package/dist/ssr/content/index.js +0 -2
- package/dist/ssr/content/index.js.map +1 -1
- package/dist/ssr/feedback/dialog-core.js +0 -11
- package/dist/ssr/feedback/dialog-core.js.map +1 -1
- package/dist/ssr/internal/field.js +2 -2
- package/dist/ssr/internal/field.js.map +1 -1
- package/dist/ssr/intl/messages.js +1 -1
- package/dist/ssr/intl/messages.js.map +1 -1
- package/dist/ssr/layout/AppWorkspace.js +8 -16
- package/dist/ssr/layout/AppWorkspace.js.map +1 -1
- package/dist/ssr/layout/Breadcrumbs.js +26 -140
- package/dist/ssr/layout/Breadcrumbs.js.map +1 -1
- package/dist/ssr/layout/DetailPanel.js +68 -70
- package/dist/ssr/layout/DetailPanel.js.map +1 -1
- package/dist/ssr/layout/PanelDialog.js +8 -82
- package/dist/ssr/layout/PanelDialog.js.map +1 -1
- package/dist/ssr/layout/app-workspace-controller.js +5 -12
- package/dist/ssr/layout/app-workspace-controller.js.map +1 -1
- package/dist/ssr/layout/app-workspace-state.js +2 -2
- package/dist/ssr/layout/app-workspace-state.js.map +1 -1
- package/dist/ssr/layout/index.js +0 -2
- package/dist/ssr/layout/index.js.map +1 -1
- package/dist/ssr/layout/workspace-messages.js +2 -12
- package/dist/ssr/layout/workspace-messages.js.map +1 -1
- package/dist/ssr/surfaces/NoticeCard.js +5 -7
- package/dist/ssr/surfaces/NoticeCard.js.map +1 -1
- package/dist/ssr/surfaces/Placeholder.js +4 -15
- package/dist/ssr/surfaces/Placeholder.js.map +1 -1
- package/dist/ssr/surfaces/Section.js +4 -7
- package/dist/ssr/surfaces/Section.js.map +1 -1
- package/dist/ssr/surfaces/StatusBadge.js +1 -5
- package/dist/ssr/surfaces/StatusBadge.js.map +1 -1
- package/dist/ssr/surfaces/index.js +0 -4
- package/dist/ssr/surfaces/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/actions/Dropdown.d.ts +1 -35
- package/dist/types/actions/ViewTabs.d.ts +2 -3
- package/dist/types/actions/index.d.ts +1 -1
- package/dist/types/actions/menu-sheet.d.ts +1 -3
- package/dist/types/content/DataTable.d.ts +0 -19
- package/dist/types/content/MessageRow.d.ts +11 -0
- package/dist/types/content/ProgressPath.d.ts +6 -12
- package/dist/types/content/index.d.ts +0 -2
- package/dist/types/feedback/dialog-core.d.ts +0 -5
- package/dist/types/layout/AppWorkspace.d.ts +2 -10
- package/dist/types/layout/Breadcrumbs.d.ts +5 -10
- package/dist/types/layout/PanelDialog.d.ts +0 -19
- package/dist/types/layout/app-workspace-state.d.ts +2 -2
- package/dist/types/layout/index.d.ts +1 -5
- package/dist/types/layout/workspace-messages.d.ts +0 -5
- package/dist/types/surfaces/NoticeCard.d.ts +4 -6
- package/dist/types/surfaces/Placeholder.d.ts +0 -7
- package/dist/types/surfaces/Section.d.ts +2 -8
- package/dist/types/surfaces/StatusBadge.d.ts +1 -2
- package/dist/types/surfaces/index.d.ts +1 -9
- package/package.json +2 -7
- package/dist/browser/actions/menu-sheet-messages.js +0 -26
- package/dist/browser/actions/menu-sheet-messages.js.map +0 -1
- package/dist/browser/actions/menu-submenu-panel.js +0 -392
- package/dist/browser/actions/menu-submenu-panel.js.map +0 -1
- package/dist/browser/content/FileName.js +0 -68
- package/dist/browser/content/FileName.js.map +0 -1
- package/dist/browser/content/TaskRow.js +0 -129
- package/dist/browser/content/TaskRow.js.map +0 -1
- package/dist/browser/content/progress-path-messages.js +0 -22
- package/dist/browser/content/progress-path-messages.js.map +0 -1
- package/dist/browser/feedback/dialog-foot.js +0 -45
- package/dist/browser/feedback/dialog-foot.js.map +0 -1
- package/dist/browser/internal/renders-something.js +0 -3
- package/dist/browser/internal/renders-something.js.map +0 -1
- package/dist/browser/layout/FloatingPill.js +0 -33
- package/dist/browser/layout/FloatingPill.js.map +0 -1
- package/dist/browser/layout/StatusRow.js +0 -174
- package/dist/browser/layout/StatusRow.js.map +0 -1
- package/dist/browser/layout/panel-dialog-error.js +0 -44
- package/dist/browser/layout/panel-dialog-error.js.map +0 -1
- package/dist/browser/layout/panel-sheet-handle.js +0 -86
- package/dist/browser/layout/panel-sheet-handle.js.map +0 -1
- package/dist/browser/layout-check.js +0 -232
- package/dist/browser/layout-check.js.map +0 -1
- package/dist/browser/surfaces/Area.js +0 -205
- package/dist/browser/surfaces/Area.js.map +0 -1
- package/dist/browser/surfaces/FactGroup.js +0 -148
- package/dist/browser/surfaces/FactGroup.js.map +0 -1
- package/dist/browser/surfaces/FieldGrid.js +0 -34
- package/dist/browser/surfaces/FieldGrid.js.map +0 -1
- package/dist/browser/surfaces/RowGroup.js +0 -82
- package/dist/browser/surfaces/RowGroup.js.map +0 -1
- package/dist/browser/surfaces/flat-block-messages.js +0 -37
- package/dist/browser/surfaces/flat-block-messages.js.map +0 -1
- package/dist/ssr/actions/menu-sheet-messages.js +0 -26
- package/dist/ssr/actions/menu-sheet-messages.js.map +0 -1
- package/dist/ssr/actions/menu-submenu-panel.js +0 -295
- package/dist/ssr/actions/menu-submenu-panel.js.map +0 -1
- package/dist/ssr/content/FileName.js +0 -46
- package/dist/ssr/content/FileName.js.map +0 -1
- package/dist/ssr/content/TaskRow.js +0 -95
- package/dist/ssr/content/TaskRow.js.map +0 -1
- package/dist/ssr/content/progress-path-messages.js +0 -22
- package/dist/ssr/content/progress-path-messages.js.map +0 -1
- package/dist/ssr/feedback/dialog-foot.js +0 -45
- package/dist/ssr/feedback/dialog-foot.js.map +0 -1
- package/dist/ssr/internal/renders-something.js +0 -3
- package/dist/ssr/internal/renders-something.js.map +0 -1
- package/dist/ssr/layout/FloatingPill.js +0 -16
- package/dist/ssr/layout/FloatingPill.js.map +0 -1
- package/dist/ssr/layout/StatusRow.js +0 -93
- package/dist/ssr/layout/StatusRow.js.map +0 -1
- package/dist/ssr/layout/panel-dialog-error.js +0 -28
- package/dist/ssr/layout/panel-dialog-error.js.map +0 -1
- package/dist/ssr/layout/panel-sheet-handle.js +0 -66
- package/dist/ssr/layout/panel-sheet-handle.js.map +0 -1
- package/dist/ssr/layout-check.js +0 -232
- package/dist/ssr/layout-check.js.map +0 -1
- package/dist/ssr/surfaces/Area.js +0 -147
- package/dist/ssr/surfaces/Area.js.map +0 -1
- package/dist/ssr/surfaces/FactGroup.js +0 -106
- package/dist/ssr/surfaces/FactGroup.js.map +0 -1
- package/dist/ssr/surfaces/FieldGrid.js +0 -22
- package/dist/ssr/surfaces/FieldGrid.js.map +0 -1
- package/dist/ssr/surfaces/RowGroup.js +0 -60
- package/dist/ssr/surfaces/RowGroup.js.map +0 -1
- package/dist/ssr/surfaces/flat-block-messages.js +0 -37
- package/dist/ssr/surfaces/flat-block-messages.js.map +0 -1
- package/dist/types/actions/menu-sheet-messages.d.ts +0 -11
- package/dist/types/actions/menu-submenu-panel.d.ts +0 -27
- package/dist/types/content/FileName.d.ts +0 -23
- package/dist/types/content/TaskRow.d.ts +0 -33
- package/dist/types/content/progress-path-messages.d.ts +0 -8
- package/dist/types/feedback/dialog-foot.d.ts +0 -9
- package/dist/types/internal/renders-something.d.ts +0 -2
- package/dist/types/layout/FloatingPill.d.ts +0 -20
- package/dist/types/layout/StatusRow.d.ts +0 -54
- package/dist/types/layout/panel-dialog-error.d.ts +0 -9
- package/dist/types/layout/panel-sheet-handle.d.ts +0 -8
- package/dist/types/layout-check.d.ts +0 -52
- package/dist/types/surfaces/Area.d.ts +0 -38
- package/dist/types/surfaces/FactGroup.d.ts +0 -33
- package/dist/types/surfaces/FieldGrid.d.ts +0 -14
- package/dist/types/surfaces/RowGroup.d.ts +0 -20
- package/dist/types/surfaces/flat-block-messages.d.ts +0 -16
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
import { memo as _$memo } from "solid-js/web";
|
|
2
|
-
import { ssr as _$ssr } from "solid-js/web";
|
|
3
|
-
import { createComponent as _$createComponent } from "solid-js/web";
|
|
4
|
-
import { ssrAttribute as _$ssrAttribute } from "solid-js/web";
|
|
5
|
-
import { escape as _$escape } from "solid-js/web";
|
|
6
|
-
var _tmpl$ = ["<div id=\"", "\" popover=\"manual\" role=\"menu\"", " class=\"k2b-dropdown__menu k2b-dropdown__submenu\"", ">", "</div>"],
|
|
7
|
-
_tmpl$2 = ["<div role=\"none\" class=\"k2b-dropdown__subgroup\"><button", " type=\"button\"", " tabindex=\"-1\" class=\"", "\"", " aria-haspopup=\"menu\"", "", ">", "<i class=\"ti ti-chevron-right k2b-dropdown__more\" aria-hidden=\"true\"></i></button>", "</div>"];
|
|
8
|
-
import { createEffect, createRoot, createSignal, createUniqueId, on, onCleanup, onMount, Show } from "solid-js";
|
|
9
|
-
import { inheritUiScope } from "../internal/portal-scope";
|
|
10
|
-
import { focusMenuRow, focusRowSegment } from "./menu-rows";
|
|
11
|
-
|
|
12
|
-
/** How long the pointer rests on a row before its submenu opens, or another row's closes it (K16). */
|
|
13
|
-
const DELAY = 150;
|
|
14
|
-
/** How long a move towards an open submenu keeps it open while the pointer crosses other rows. */
|
|
15
|
-
const CORRIDOR_DELAY = 300;
|
|
16
|
-
/** A menu, its submenu, and one more: deeper entries are not offered (K16). */
|
|
17
|
-
const MAX_DEPTH = 3;
|
|
18
|
-
|
|
19
|
-
/** The least room a menu keeps from the viewport's edge, as every menu does. */
|
|
20
|
-
const EDGE = 8;
|
|
21
|
-
const GAP = 4;
|
|
22
|
-
/**
|
|
23
|
-
* Where a submenu stands: beside its row, its first row level with it, on the side that has room; without room on
|
|
24
|
-
* either side it keeps to the viewport. Too low, it rises until its last row is level with its row's bottom.
|
|
25
|
-
*/
|
|
26
|
-
export const placeSubmenu = (row, parent, menu, viewport, rtl = false) => {
|
|
27
|
-
// Two objects side by side, 4 px apart as a menu stands from its trigger: their edges never meet (one line, one owner).
|
|
28
|
-
const right = parent.right + GAP;
|
|
29
|
-
const left = parent.left - menu.width - GAP;
|
|
30
|
-
const fitsRight = right + menu.width <= viewport.width - EDGE;
|
|
31
|
-
const fitsLeft = left >= EDGE;
|
|
32
|
-
const side = rtl ? fitsLeft || !fitsRight ? "left" : "right" : fitsRight || !fitsLeft ? "right" : "left";
|
|
33
|
-
const x = side === "right" ? right : left;
|
|
34
|
-
// The menu's 1 px edge stands above the row, so its first row lines up with the row that opened it.
|
|
35
|
-
let top = row.top - 1;
|
|
36
|
-
if (top + menu.height > viewport.height - EDGE) top = row.bottom + 1 - menu.height;
|
|
37
|
-
return {
|
|
38
|
-
left: Math.max(EDGE, Math.min(x, viewport.width - menu.width - EDGE)),
|
|
39
|
-
top: Math.max(EDGE, Math.min(top, viewport.height - menu.height - EDGE)),
|
|
40
|
-
side
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
const sign = (p, a, b) => (p.x - b.x) * (a.y - b.y) - (a.x - b.x) * (p.y - b.y);
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Whether `to` lies in the corridor from `from` to the submenu: the triangle between the earlier pointer position and
|
|
47
|
-
* the submenu's near edge. A pointer moving through it is on its way to the submenu.
|
|
48
|
-
*/
|
|
49
|
-
const inCorridor = (from, to, menu) => {
|
|
50
|
-
const edge = from.x <= menu.left ? menu.left : from.x >= menu.right ? menu.right : undefined;
|
|
51
|
-
if (edge === undefined) return false;
|
|
52
|
-
const top = {
|
|
53
|
-
x: edge,
|
|
54
|
-
y: menu.top - EDGE
|
|
55
|
-
};
|
|
56
|
-
const bottom = {
|
|
57
|
-
x: edge,
|
|
58
|
-
y: menu.bottom + EDGE
|
|
59
|
-
};
|
|
60
|
-
const d1 = sign(to, from, top);
|
|
61
|
-
const d2 = sign(to, top, bottom);
|
|
62
|
-
const d3 = sign(to, bottom, from);
|
|
63
|
-
const negative = d1 < 0 || d2 < 0 || d3 < 0;
|
|
64
|
-
const positive = d1 > 0 || d2 > 0 || d3 > 0;
|
|
65
|
-
return !(negative && positive);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
/** The actions and choices of a menu and its submenus, without sections or submenu rows. */
|
|
69
|
-
const flatEntries = items => items.flatMap(item => "items" in item ? flatEntries(item.items) : "submenu" in item ? flatEntries(item.submenu) : [item]);
|
|
70
|
-
|
|
71
|
-
/** The entries of the submenu `panel` that take focus, without those of a submenu open inside it. */
|
|
72
|
-
const ownEntries = panel => Array.from(panel.querySelectorAll(":is([role='menuitem'], [role='menuitemcheckbox'], [role='menuitemradio']):not([aria-disabled='true'])")).filter(entry => entry.closest(".k2b-dropdown__submenu") === panel);
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* One level of a menu: which of its rows has its submenu open. The pointer and the focus on the level's rows decide:
|
|
76
|
-
* after the pointer rests on a row, that row's submenu opens or the open one closes; a move towards the open submenu
|
|
77
|
-
* closes nothing; focus on another row closes it at once.
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
|
-
const levels = new WeakMap();
|
|
81
|
-
|
|
82
|
-
/** The level of the rows under `menu`, created with its first submenu row; it listens on the element around them. */
|
|
83
|
-
const levelOf = (menu, row) => {
|
|
84
|
-
const known = levels.get(menu);
|
|
85
|
-
if (known) return known;
|
|
86
|
-
const [open, setOpen] = createRoot(() => createSignal());
|
|
87
|
-
let timer;
|
|
88
|
-
let last;
|
|
89
|
-
let before;
|
|
90
|
-
let hovered;
|
|
91
|
-
const clear = () => {
|
|
92
|
-
clearTimeout(timer);
|
|
93
|
-
timer = undefined;
|
|
94
|
-
};
|
|
95
|
-
// In the submenu, nothing pending changes it; back on any row of this level, that row counts again.
|
|
96
|
-
const hold = () => {
|
|
97
|
-
clear();
|
|
98
|
-
hovered = undefined;
|
|
99
|
-
};
|
|
100
|
-
const set = next => {
|
|
101
|
-
clear();
|
|
102
|
-
hovered = undefined;
|
|
103
|
-
setOpen(() => next);
|
|
104
|
-
};
|
|
105
|
-
const level = {
|
|
106
|
-
open,
|
|
107
|
-
set,
|
|
108
|
-
hold
|
|
109
|
-
};
|
|
110
|
-
levels.set(menu, level);
|
|
111
|
-
// The rows of this level, not those of a submenu inside it.
|
|
112
|
-
const host = row.parentElement?.closest(".k2b-dropdown__submenu, [role='menu'], [role='dialog'], [role='listbox']");
|
|
113
|
-
const own = host?.classList.contains("k2b-dropdown__submenu") ? host : null;
|
|
114
|
-
const rowOf = target => {
|
|
115
|
-
const entry = target instanceof Element ? target.closest("[role^='menuitem']") : null;
|
|
116
|
-
return entry && entry.closest(".k2b-dropdown__submenu") === own ? entry : undefined;
|
|
117
|
-
};
|
|
118
|
-
host?.addEventListener("pointermove", event => {
|
|
119
|
-
// The browser repeats a move when the layout changes under a resting pointer; only a real move counts, so a
|
|
120
|
-
// submenu closed with the keyboard does not open again under it.
|
|
121
|
-
if (last && last.x === event.clientX && last.y === event.clientY) return;
|
|
122
|
-
before = last;
|
|
123
|
-
last = {
|
|
124
|
-
x: event.clientX,
|
|
125
|
-
y: event.clientY
|
|
126
|
-
};
|
|
127
|
-
const entry = rowOf(event.target);
|
|
128
|
-
if (event.pointerType === "touch" || !entry || entry === hovered) return;
|
|
129
|
-
hovered = entry;
|
|
130
|
-
clear();
|
|
131
|
-
const current = open();
|
|
132
|
-
if (current === entry) return;
|
|
133
|
-
const panel = current ? document.getElementById(`${current.id}-menu`) : null;
|
|
134
|
-
const towards = Boolean(panel && before && inCorridor(before, last, panel.getBoundingClientRect()));
|
|
135
|
-
timer = setTimeout(() => setOpen(() => entry), towards ? CORRIDOR_DELAY : DELAY);
|
|
136
|
-
});
|
|
137
|
-
// Leaving the menu, or the menu closing, ends anything pending; a closed menu keeps no submenu open.
|
|
138
|
-
host?.addEventListener("pointerleave", () => {
|
|
139
|
-
clear();
|
|
140
|
-
hovered = undefined;
|
|
141
|
-
});
|
|
142
|
-
host?.addEventListener("toggle", event => {
|
|
143
|
-
if (event.newState === "closed") set(undefined);
|
|
144
|
-
});
|
|
145
|
-
host?.addEventListener("focusin", event => {
|
|
146
|
-
const entry = rowOf(event.target);
|
|
147
|
-
if (entry && open() && entry !== open()) set(undefined);
|
|
148
|
-
});
|
|
149
|
-
return level;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* An open submenu beside its row. It shows in the top layer, owns its keys, and closes with the menu around it, a
|
|
154
|
-
* change of the window's size, or a scroll outside it.
|
|
155
|
-
*/
|
|
156
|
-
function SubmenuPanel(props) {
|
|
157
|
-
let panel;
|
|
158
|
-
// Read once: `level` comes from the <Show> around the panel, whose value is gone by the time the panel cleans up.
|
|
159
|
-
const level = props.level;
|
|
160
|
-
const row = props.row;
|
|
161
|
-
const rtl = () => getComputedStyle(row).direction === "rtl";
|
|
162
|
-
const place = () => {
|
|
163
|
-
if (!panel.isConnected) return;
|
|
164
|
-
const host = row.closest("[role='menu'], [role='dialog'], [role='listbox']") ?? row;
|
|
165
|
-
const at = placeSubmenu(row.getBoundingClientRect(), host.getBoundingClientRect(), panel.getBoundingClientRect(), {
|
|
166
|
-
width: window.innerWidth,
|
|
167
|
-
height: window.innerHeight
|
|
168
|
-
}, rtl());
|
|
169
|
-
panel.style.left = `${at.left}px`;
|
|
170
|
-
panel.style.top = `${at.top}px`;
|
|
171
|
-
panel.dataset.side = at.side;
|
|
172
|
-
};
|
|
173
|
-
const onKey = event => {
|
|
174
|
-
const items = ownEntries(panel);
|
|
175
|
-
if (focusMenuRow(items, event.key) || focusRowSegment(items, event.key)) {
|
|
176
|
-
event.preventDefault();
|
|
177
|
-
event.stopPropagation();
|
|
178
|
-
} else if (event.key === "Escape" || event.key === (rtl() ? "ArrowRight" : "ArrowLeft")) {
|
|
179
|
-
// Only this level closes; the menu around it stays, as the browser's own Escape would close it.
|
|
180
|
-
event.preventDefault();
|
|
181
|
-
event.stopPropagation();
|
|
182
|
-
props.hide();
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
// The menu around it closing, the window changing size, or a scroll outside it closes it too: it would come loose
|
|
186
|
-
// from its row.
|
|
187
|
-
const host = row.parentElement?.closest("[popover]");
|
|
188
|
-
const closed = event => {
|
|
189
|
-
if (event.type === "scroll" && event.target instanceof Node && panel.contains(event.target)) return;
|
|
190
|
-
if (event.type !== "toggle" || event.newState === "closed") level.set(undefined);
|
|
191
|
-
};
|
|
192
|
-
host?.addEventListener("toggle", closed);
|
|
193
|
-
window.addEventListener("resize", closed);
|
|
194
|
-
window.addEventListener("scroll", closed, true);
|
|
195
|
-
onCleanup(() => {
|
|
196
|
-
host?.removeEventListener("toggle", closed);
|
|
197
|
-
window.removeEventListener("resize", closed);
|
|
198
|
-
window.removeEventListener("scroll", closed, true);
|
|
199
|
-
// Closed by the pointer resting elsewhere or by a resize, with the keyboard inside: the focus goes back to its row
|
|
200
|
-
// rather than to the page.
|
|
201
|
-
// Another row's submenu opening takes the focus to that row instead, so the move does not close it again.
|
|
202
|
-
if (panel.contains(document.activeElement)) (level.open() ?? row).focus();
|
|
203
|
-
});
|
|
204
|
-
return _$ssr(_tmpl$, `${_$escape(props.id, true)}-menu`, _$ssrAttribute("aria-label", _$escape(props.label, true), false), _$ssrAttribute("data-depth", _$escape(props.depth, true), false), _$escape(_$createComponent(props.Items, {
|
|
205
|
-
get items() {
|
|
206
|
-
return props.items;
|
|
207
|
-
},
|
|
208
|
-
get close() {
|
|
209
|
-
return props.close;
|
|
210
|
-
},
|
|
211
|
-
get depth() {
|
|
212
|
-
return props.depth;
|
|
213
|
-
}
|
|
214
|
-
})));
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/** A row with "▸" that opens its submenu beside it, or in a phone sheet in the sheet's place (K16). */
|
|
218
|
-
export function SubmenuRow(props) {
|
|
219
|
-
const menu = props.menu;
|
|
220
|
-
// A list box cannot open a menu: there the entries stand under the row's name, as a section's do.
|
|
221
|
-
if (menu.role === "option") return _$createComponent(props.Items, {
|
|
222
|
-
get items() {
|
|
223
|
-
return [{
|
|
224
|
-
sectionLabel: props.item.label,
|
|
225
|
-
items: flatEntries(props.item.submenu)
|
|
226
|
-
}];
|
|
227
|
-
},
|
|
228
|
-
get close() {
|
|
229
|
-
return menu.close;
|
|
230
|
-
},
|
|
231
|
-
role: "option"
|
|
232
|
-
});
|
|
233
|
-
const id = `k2b-submenu-${createUniqueId().replace(/[^a-zA-Z0-9_-]/g, "-")}`;
|
|
234
|
-
// A fourth level is not offered (K16): its row stays, but cannot open.
|
|
235
|
-
const disabled = () => Boolean(props.item.disabled) || menu.depth >= MAX_DEPTH;
|
|
236
|
-
const [level, setLevel] = createSignal();
|
|
237
|
-
let focusFirst = false;
|
|
238
|
-
const open = () => level()?.open() === row;
|
|
239
|
-
let row;
|
|
240
|
-
onMount(() => {
|
|
241
|
-
if (!menu.drill) setLevel(levelOf(menu, row));
|
|
242
|
-
});
|
|
243
|
-
const show = moveFocus => {
|
|
244
|
-
if (disabled()) return;
|
|
245
|
-
if (menu.drill) return menu.drill(props.item, row);
|
|
246
|
-
focusFirst = moveFocus;
|
|
247
|
-
// Already open: the keyboard goes into it now.
|
|
248
|
-
const panel = document.getElementById(`${id}-menu`);
|
|
249
|
-
if (panel && moveFocus) focusMenuRow(ownEntries(panel), "Home");
|
|
250
|
-
level()?.set(row);
|
|
251
|
-
};
|
|
252
|
-
const onRowKey = event => {
|
|
253
|
-
if (event.key !== (getComputedStyle(row).direction === "rtl" ? "ArrowLeft" : "ArrowRight")) return;
|
|
254
|
-
event.preventDefault();
|
|
255
|
-
event.stopPropagation();
|
|
256
|
-
show(true);
|
|
257
|
-
};
|
|
258
|
-
// The row and its submenu stand together in an element without a role, as a menu holds only its entries.
|
|
259
|
-
return _$ssr(_tmpl$2, _$ssrAttribute("id", _$escape(id, true), false), _$ssrAttribute("role", _$escape(menu.role, true), false), `k2b-dropdown__item k2b-dropdown__item--submenu ${_$escape(props.item.class ?? "", true)}`, _$ssrAttribute("aria-label", _$escape(props.item.ariaLabel, true), false), _$ssrAttribute("aria-expanded", _$escape(open(), true), false) + _$ssrAttribute("aria-controls", open() ? `${_$escape(id, true)}-menu` : _$escape(undefined, true), false) + _$ssrAttribute("aria-disabled", disabled() ? "true" : _$escape(undefined, true), false), _$ssrAttribute("disabled", disabled(), true) + _$ssrAttribute("data-open", open() ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("data-danger", props.item.variant === "danger" ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("data-accent", props.item.variant === "accent" ? "true" : _$escape(undefined, true), false), _$escape(props.content({
|
|
260
|
-
...props.item,
|
|
261
|
-
children: props.item.label
|
|
262
|
-
})), _$escape(_$createComponent(Show, {
|
|
263
|
-
get when() {
|
|
264
|
-
return _$memo(() => !!open())() && level();
|
|
265
|
-
},
|
|
266
|
-
children: current => _$createComponent(SubmenuPanel, {
|
|
267
|
-
id: id,
|
|
268
|
-
row: row,
|
|
269
|
-
get label() {
|
|
270
|
-
return props.item.label;
|
|
271
|
-
},
|
|
272
|
-
get items() {
|
|
273
|
-
return props.item.submenu;
|
|
274
|
-
},
|
|
275
|
-
get depth() {
|
|
276
|
-
return menu.depth + 1;
|
|
277
|
-
},
|
|
278
|
-
get close() {
|
|
279
|
-
return menu.close;
|
|
280
|
-
},
|
|
281
|
-
get level() {
|
|
282
|
-
return current();
|
|
283
|
-
},
|
|
284
|
-
focusFirst: focusFirst,
|
|
285
|
-
get Items() {
|
|
286
|
-
return props.Items;
|
|
287
|
-
},
|
|
288
|
-
hide: () => {
|
|
289
|
-
current().set(undefined);
|
|
290
|
-
row.focus();
|
|
291
|
-
}
|
|
292
|
-
})
|
|
293
|
-
})));
|
|
294
|
-
}
|
|
295
|
-
//# sourceMappingURL=menu-submenu-panel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["actions/menu-submenu-panel.tsx"],"sourcesContent":["import { type Accessor, createEffect, createRoot, createSignal, createUniqueId, type JSX, on, onCleanup, onMount, Show } from \"solid-js\";\nimport { inheritUiScope } from \"../internal/portal-scope\";\nimport type {\n DropdownAction,\n DropdownChoice,\n DropdownItem,\n DropdownItems,\n DropdownSubmenu,\n itemContent,\n MenuContextValue,\n} from \"./Dropdown\";\nimport { focusMenuRow, focusRowSegment } from \"./menu-rows\";\n\n/** How long the pointer rests on a row before its submenu opens, or another row's closes it (K16). */\nconst DELAY = 150;\n/** How long a move towards an open submenu keeps it open while the pointer crosses other rows. */\nconst CORRIDOR_DELAY = 300;\n/** A menu, its submenu, and one more: deeper entries are not offered (K16). */\nconst MAX_DEPTH = 3;\n\n/** The least room a menu keeps from the viewport's edge, as every menu does. */\nconst EDGE = 8;\nconst GAP = 4;\ntype Box = Pick<DOMRect, \"left\" | \"top\" | \"right\" | \"bottom\">;\n\n/**\n * Where a submenu stands: beside its row, its first row level with it, on the side that has room; without room on\n * either side it keeps to the viewport. Too low, it rises until its last row is level with its row's bottom.\n */\nexport const placeSubmenu = (\n row: Box,\n parent: Pick<DOMRect, \"left\" | \"right\">,\n menu: { width: number; height: number },\n viewport: { width: number; height: number },\n rtl = false,\n): { left: number; top: number; side: \"left\" | \"right\" } => {\n // Two objects side by side, 4 px apart as a menu stands from its trigger: their edges never meet (one line, one owner).\n const right = parent.right + GAP;\n const left = parent.left - menu.width - GAP;\n const fitsRight = right + menu.width <= viewport.width - EDGE;\n const fitsLeft = left >= EDGE;\n const side: \"left\" | \"right\" = rtl ? (fitsLeft || !fitsRight ? \"left\" : \"right\") : fitsRight || !fitsLeft ? \"right\" : \"left\";\n const x = side === \"right\" ? right : left;\n // The menu's 1 px edge stands above the row, so its first row lines up with the row that opened it.\n let top = row.top - 1;\n if (top + menu.height > viewport.height - EDGE) top = row.bottom + 1 - menu.height;\n return {\n left: Math.max(EDGE, Math.min(x, viewport.width - menu.width - EDGE)),\n top: Math.max(EDGE, Math.min(top, viewport.height - menu.height - EDGE)),\n side,\n };\n};\n\ntype Point = { x: number; y: number };\n\nconst sign = (p: Point, a: Point, b: Point) => (p.x - b.x) * (a.y - b.y) - (a.x - b.x) * (p.y - b.y);\n\n/**\n * Whether `to` lies in the corridor from `from` to the submenu: the triangle between the earlier pointer position and\n * the submenu's near edge. A pointer moving through it is on its way to the submenu.\n */\nconst inCorridor = (from: Point, to: Point, menu: Box): boolean => {\n const edge = from.x <= menu.left ? menu.left : from.x >= menu.right ? menu.right : undefined;\n if (edge === undefined) return false;\n const top = { x: edge, y: menu.top - EDGE };\n const bottom = { x: edge, y: menu.bottom + EDGE };\n const d1 = sign(to, from, top);\n const d2 = sign(to, top, bottom);\n const d3 = sign(to, bottom, from);\n const negative = d1 < 0 || d2 < 0 || d3 < 0;\n const positive = d1 > 0 || d2 > 0 || d3 > 0;\n return !(negative && positive);\n};\n\n/** The actions and choices of a menu and its submenus, without sections or submenu rows. */\nconst flatEntries = (items: readonly DropdownItem[]): (DropdownAction | DropdownChoice)[] =>\n items.flatMap((item) => (\"items\" in item ? flatEntries(item.items) : \"submenu\" in item ? flatEntries(item.submenu) : [item]));\n\n/** The entries of the submenu `panel` that take focus, without those of a submenu open inside it. */\nconst ownEntries = (panel: HTMLElement): HTMLElement[] =>\n Array.from(\n panel.querySelectorAll<HTMLElement>(\n \":is([role='menuitem'], [role='menuitemcheckbox'], [role='menuitemradio']):not([aria-disabled='true'])\",\n ),\n ).filter((entry) => entry.closest(\".k2b-dropdown__submenu\") === panel);\n\n/**\n * One level of a menu: which of its rows has its submenu open. The pointer and the focus on the level's rows decide:\n * after the pointer rests on a row, that row's submenu opens or the open one closes; a move towards the open submenu\n * closes nothing; focus on another row closes it at once.\n */\ntype MenuLevel = {\n open: Accessor<HTMLElement | undefined>;\n /** Opens a row's submenu, or closes the open one with `undefined`, at once. */\n set: (row: HTMLElement | undefined) => void;\n /** The pointer reached the open submenu: nothing pending changes it. */\n hold: () => void;\n};\n\nconst levels = new WeakMap<MenuContextValue, MenuLevel>();\n\n/** The level of the rows under `menu`, created with its first submenu row; it listens on the element around them. */\nconst levelOf = (menu: MenuContextValue, row: HTMLElement): MenuLevel => {\n const known = levels.get(menu);\n if (known) return known;\n const [open, setOpen] = createRoot(() => createSignal<HTMLElement>());\n let timer: ReturnType<typeof setTimeout> | undefined;\n let last: Point | undefined;\n let before: Point | undefined;\n let hovered: Element | undefined;\n const clear = () => {\n clearTimeout(timer);\n timer = undefined;\n };\n // In the submenu, nothing pending changes it; back on any row of this level, that row counts again.\n const hold = () => {\n clear();\n hovered = undefined;\n };\n const set = (next: HTMLElement | undefined) => {\n clear();\n hovered = undefined;\n setOpen(() => next);\n };\n const level: MenuLevel = { open, set, hold };\n levels.set(menu, level);\n // The rows of this level, not those of a submenu inside it.\n const host = row.parentElement?.closest<HTMLElement>(\".k2b-dropdown__submenu, [role='menu'], [role='dialog'], [role='listbox']\");\n const own = host?.classList.contains(\"k2b-dropdown__submenu\") ? host : null;\n const rowOf = (target: EventTarget | null) => {\n const entry = target instanceof Element ? target.closest(\"[role^='menuitem']\") : null;\n return entry && entry.closest(\".k2b-dropdown__submenu\") === own ? entry : undefined;\n };\n host?.addEventListener(\"pointermove\", (event) => {\n // The browser repeats a move when the layout changes under a resting pointer; only a real move counts, so a\n // submenu closed with the keyboard does not open again under it.\n if (last && last.x === event.clientX && last.y === event.clientY) return;\n before = last;\n last = { x: event.clientX, y: event.clientY };\n const entry = rowOf(event.target);\n if (event.pointerType === \"touch\" || !entry || entry === hovered) return;\n hovered = entry;\n clear();\n const current = open();\n if (current === entry) return;\n const panel = current ? document.getElementById(`${current.id}-menu`) : null;\n const towards = Boolean(panel && before && inCorridor(before, last, panel.getBoundingClientRect()));\n timer = setTimeout(() => setOpen(() => entry as HTMLElement), towards ? CORRIDOR_DELAY : DELAY);\n });\n // Leaving the menu, or the menu closing, ends anything pending; a closed menu keeps no submenu open.\n host?.addEventListener(\"pointerleave\", () => {\n clear();\n hovered = undefined;\n });\n host?.addEventListener(\"toggle\", (event) => {\n if ((event as ToggleEvent).newState === \"closed\") set(undefined);\n });\n host?.addEventListener(\"focusin\", (event) => {\n const entry = rowOf(event.target);\n if (entry && open() && entry !== open()) set(undefined);\n });\n return level;\n};\n\n/**\n * An open submenu beside its row. It shows in the top layer, owns its keys, and closes with the menu around it, a\n * change of the window's size, or a scroll outside it.\n */\nfunction SubmenuPanel(props: {\n id: string;\n row: HTMLButtonElement;\n label: string;\n items: readonly DropdownItem[];\n depth: number;\n close: (restoreFocus?: boolean) => void;\n level: MenuLevel;\n /** Whether the keyboard opened it, so its first entry takes the focus. */\n focusFirst: boolean;\n hide: () => void;\n Items: typeof DropdownItems;\n}): JSX.Element {\n let panel!: HTMLDivElement;\n // Read once: `level` comes from the <Show> around the panel, whose value is gone by the time the panel cleans up.\n const level = props.level;\n const row = props.row;\n const rtl = () => getComputedStyle(row).direction === \"rtl\";\n const place = () => {\n if (!panel.isConnected) return;\n const host = row.closest<HTMLElement>(\"[role='menu'], [role='dialog'], [role='listbox']\") ?? row;\n const at = placeSubmenu(\n row.getBoundingClientRect(),\n host.getBoundingClientRect(),\n panel.getBoundingClientRect(),\n { width: window.innerWidth, height: window.innerHeight },\n rtl(),\n );\n panel.style.left = `${at.left}px`;\n panel.style.top = `${at.top}px`;\n panel.dataset.side = at.side;\n };\n const onKey = (event: KeyboardEvent) => {\n const items = ownEntries(panel);\n if (focusMenuRow(items, event.key) || focusRowSegment(items, event.key)) {\n event.preventDefault();\n event.stopPropagation();\n } else if (event.key === \"Escape\" || event.key === (rtl() ? \"ArrowRight\" : \"ArrowLeft\")) {\n // Only this level closes; the menu around it stays, as the browser's own Escape would close it.\n event.preventDefault();\n event.stopPropagation();\n props.hide();\n }\n };\n // The menu around it closing, the window changing size, or a scroll outside it closes it too: it would come loose\n // from its row.\n const host = row.parentElement?.closest<HTMLElement>(\"[popover]\");\n const closed = (event: Event) => {\n if (event.type === \"scroll\" && event.target instanceof Node && panel.contains(event.target)) return;\n if (event.type !== \"toggle\" || (event as ToggleEvent).newState === \"closed\") level.set(undefined);\n };\n host?.addEventListener(\"toggle\", closed);\n window.addEventListener(\"resize\", closed);\n window.addEventListener(\"scroll\", closed, true);\n onCleanup(() => {\n host?.removeEventListener(\"toggle\", closed);\n window.removeEventListener(\"resize\", closed);\n window.removeEventListener(\"scroll\", closed, true);\n // Closed by the pointer resting elsewhere or by a resize, with the keyboard inside: the focus goes back to its row\n // rather than to the page.\n // Another row's submenu opening takes the focus to that row instead, so the move does not close it again.\n if (panel.contains(document.activeElement)) (level.open() ?? row).focus();\n });\n return (\n <div\n ref={(element) => {\n panel = element;\n inheritUiScope(element, row);\n queueMicrotask(() => {\n if (!element.isConnected) return;\n if (typeof element.showPopover === \"function\") element.showPopover();\n place();\n if (props.focusFirst) focusMenuRow(ownEntries(element), \"Home\");\n });\n }}\n id={`${props.id}-menu`}\n popover=\"manual\"\n role=\"menu\"\n aria-label={props.label}\n class=\"k2b-dropdown__menu k2b-dropdown__submenu\"\n data-depth={props.depth}\n on:keydown={onKey}\n onPointerEnter={() => level.hold()}\n onPointerDown={(event) => event.stopPropagation()}\n >\n <props.Items items={props.items} close={props.close} depth={props.depth} />\n </div>\n );\n}\n\n/** A row with \"▸\" that opens its submenu beside it, or in a phone sheet in the sheet's place (K16). */\nexport function SubmenuRow(props: {\n item: DropdownSubmenu;\n /** The level's menu: handed in, so this module needs nothing of the menu's code at run time. */\n menu: MenuContextValue;\n Items: typeof DropdownItems;\n content: typeof itemContent;\n}): JSX.Element {\n const menu = props.menu;\n // A list box cannot open a menu: there the entries stand under the row's name, as a section's do.\n if (menu.role === \"option\")\n return (\n <props.Items items={[{ sectionLabel: props.item.label, items: flatEntries(props.item.submenu) }]} close={menu.close} role=\"option\" />\n );\n const id = `k2b-submenu-${createUniqueId().replace(/[^a-zA-Z0-9_-]/g, \"-\")}`;\n // A fourth level is not offered (K16): its row stays, but cannot open.\n const disabled = () => Boolean(props.item.disabled) || menu.depth >= MAX_DEPTH;\n const [level, setLevel] = createSignal<MenuLevel>();\n let focusFirst = false;\n const open = () => level()?.open() === row;\n let row!: HTMLButtonElement;\n onMount(() => {\n if (!menu.drill) setLevel(levelOf(menu, row));\n });\n const show = (moveFocus: boolean) => {\n if (disabled()) return;\n if (menu.drill) return menu.drill(props.item, row);\n focusFirst = moveFocus;\n // Already open: the keyboard goes into it now.\n const panel = document.getElementById(`${id}-menu`);\n if (panel && moveFocus) focusMenuRow(ownEntries(panel), \"Home\");\n level()?.set(row);\n };\n const onRowKey = (event: KeyboardEvent) => {\n if (event.key !== (getComputedStyle(row).direction === \"rtl\" ? \"ArrowLeft\" : \"ArrowRight\")) return;\n event.preventDefault();\n event.stopPropagation();\n show(true);\n };\n // The row and its submenu stand together in an element without a role, as a menu holds only its entries.\n return (\n <div role=\"none\" class=\"k2b-dropdown__subgroup\">\n <button\n ref={row}\n id={id}\n type=\"button\"\n role={menu.role}\n tabIndex={-1}\n class={`k2b-dropdown__item k2b-dropdown__item--submenu ${props.item.class ?? \"\"}`}\n aria-label={props.item.ariaLabel}\n aria-haspopup=\"menu\"\n aria-expanded={open()}\n aria-controls={open() ? `${id}-menu` : undefined}\n aria-disabled={disabled() ? \"true\" : undefined}\n disabled={disabled()}\n data-open={open() ? \"true\" : undefined}\n data-danger={props.item.variant === \"danger\" ? \"true\" : undefined}\n data-accent={props.item.variant === \"accent\" ? \"true\" : undefined}\n on:keydown={onRowKey}\n onClick={(event) => {\n event.preventDefault();\n event.stopPropagation();\n // Enter and Space click with no pointer: the keyboard goes into the submenu, a pointer stays where it is.\n show(event.detail === 0);\n }}\n >\n {props.content({ ...props.item, children: props.item.label })}\n <i class=\"ti ti-chevron-right k2b-dropdown__more\" aria-hidden=\"true\" />\n </button>\n <Show when={open() && level()}>\n {(current) => (\n <SubmenuPanel\n id={id}\n row={row}\n label={props.item.label}\n items={props.item.submenu}\n depth={menu.depth + 1}\n close={menu.close}\n level={current()}\n focusFirst={focusFirst}\n Items={props.Items}\n hide={() => {\n current().set(undefined);\n row.focus();\n }}\n />\n )}\n </Show>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAwB,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAY,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,QAAQ,UAAU;AACxI,SAAS,cAAc,QAAQ,0BAA0B;AAUzD,SAAS,YAAY,EAAE,eAAe,QAAQ,aAAa;;AAE3D;AACA,MAAM,KAAK,GAAG,GAAG;AACjB;AACA,MAAM,cAAc,GAAG,GAAG;AAC1B;AACA,MAAM,SAAS,GAAG,CAAC;;AAEnB;AACA,MAAM,IAAI,GAAG,CAAC;AACd,MAAM,GAAG,GAAG,CAAC;AAGb;AACA;AACA;A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AAE,OAAO,CAAC,CAAC;MAAA;MAChB,UAAU,EAAE,UAAU;MAAA,IACtB,KAAK;QAAA,OAAE,KAAK,CAAC,KAAK;MAAA;MAClB,IAAI,EAAE,MAAM;QACV,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC;QACxB,GAAG,CAAC,KAAK,CAAC,CAAC;MACb;IAAC;EAEJ;AAIT","ignoreList":[]}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { ssrElement as _$ssrElement } from "solid-js/web";
|
|
2
|
-
import { mergeProps as _$mergeProps } from "solid-js/web";
|
|
3
|
-
import { ssr as _$ssr } from "solid-js/web";
|
|
4
|
-
import { escape as _$escape } from "solid-js/web";
|
|
5
|
-
var _tmpl$ = ["<span class=\"k2b-sr-only\">", "</span>"],
|
|
6
|
-
_tmpl$2 = ["<span class=\"k2b-file-name__stem\" aria-hidden=\"true\">", "</span>"],
|
|
7
|
-
_tmpl$3 = ["<span class=\"k2b-file-name__ext\" aria-hidden=\"true\">", "</span>"];
|
|
8
|
-
import { splitProps } from "solid-js";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* A file name split before its ending: `{ stem: "Report 2026", ext: ".pdf" }`. A name without a dot, a hidden file
|
|
12
|
-
* such as `.env`, or a name that ends in a dot has no ending. A long ending (more than ten characters after the dot)
|
|
13
|
-
* counts as part of the name, so a dotted title does not read as a file type.
|
|
14
|
-
*/
|
|
15
|
-
export const splitFileName = name => {
|
|
16
|
-
const dot = name.lastIndexOf(".");
|
|
17
|
-
if (dot <= 0 || dot === name.length - 1 || name.length - dot - 1 > 10) return {
|
|
18
|
-
stem: name,
|
|
19
|
-
ext: ""
|
|
20
|
-
};
|
|
21
|
-
return {
|
|
22
|
-
stem: name.slice(0, dot),
|
|
23
|
-
ext: name.slice(dot)
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* A file name on one line that shortens before its ending (K15): `Quarterly rep….pdf`. The ending always stays, and
|
|
28
|
-
* the whole name is the hint on hover and the text a screen reader reads: the visible stem and ending are two flex
|
|
29
|
-
* items, which accessible names join with a space ("Notes .txt"), so they are hidden from assistive technology and
|
|
30
|
-
* the whole name stands beside them as screen-reader text. The screen-reader text is out of the flow, so the layout
|
|
31
|
-
* stays as it was.
|
|
32
|
-
*/
|
|
33
|
-
export function FileName(props) {
|
|
34
|
-
const [local, rest] = splitProps(props, ["name", "class"]);
|
|
35
|
-
const parts = () => splitFileName(local.name);
|
|
36
|
-
return _$ssrElement("span", _$mergeProps(rest, {
|
|
37
|
-
get ["class"]() {
|
|
38
|
-
return local.class ? `k2b-file-name ${local.class}` : "k2b-file-name";
|
|
39
|
-
},
|
|
40
|
-
get title() {
|
|
41
|
-
return local.name;
|
|
42
|
-
}
|
|
43
|
-
}), [_$ssr(_tmpl$, _$escape(local.name)), _$ssr(_tmpl$2, _$escape(parts().stem)), parts().ext ? _$ssr(_tmpl$3, _$escape(parts().ext)) : _$escape(null)], false);
|
|
44
|
-
}
|
|
45
|
-
export default FileName;
|
|
46
|
-
//# sourceMappingURL=FileName.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["content/FileName.tsx"],"sourcesContent":["import { type JSX, splitProps } from \"solid-js\";\n\n/**\n * A file name split before its ending: `{ stem: \"Report 2026\", ext: \".pdf\" }`. A name without a dot, a hidden file\n * such as `.env`, or a name that ends in a dot has no ending. A long ending (more than ten characters after the dot)\n * counts as part of the name, so a dotted title does not read as a file type.\n */\nexport const splitFileName = (name: string): { stem: string; ext: string } => {\n const dot = name.lastIndexOf(\".\");\n if (dot <= 0 || dot === name.length - 1 || name.length - dot - 1 > 10) return { stem: name, ext: \"\" };\n return { stem: name.slice(0, dot), ext: name.slice(dot) };\n};\n\nexport type FileNameProps = Omit<JSX.HTMLAttributes<HTMLSpanElement>, \"children\"> & {\n /** The whole name, ending included. */\n name: string;\n};\n\n/**\n * A file name on one line that shortens before its ending (K15): `Quarterly rep….pdf`. The ending always stays, and\n * the whole name is the hint on hover and the text a screen reader reads: the visible stem and ending are two flex\n * items, which accessible names join with a space (\"Notes .txt\"), so they are hidden from assistive technology and\n * the whole name stands beside them as screen-reader text. The screen-reader text is out of the flow, so the layout\n * stays as it was.\n */\nexport function FileName(props: FileNameProps): JSX.Element {\n const [local, rest] = splitProps(props, [\"name\", \"class\"]);\n const parts = () => splitFileName(local.name);\n return (\n <span {...rest} class={local.class ? `k2b-file-name ${local.class}` : \"k2b-file-name\"} title={local.name}>\n <span class=\"k2b-sr-only\">{local.name}</span>\n <span class=\"k2b-file-name__stem\" aria-hidden=\"true\">\n {parts().stem}\n </span>\n {parts().ext ? (\n <span class=\"k2b-file-name__ext\" aria-hidden=\"true\">\n {parts().ext}\n </span>\n ) : null}\n </span>\n );\n}\n\nexport default FileName;\n"],"mappings":";;;;;;;AAAA,SAAmB,UAAU,QAAQ,UAAU;;AAE/C;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM,aAAa,GAAI,IAAY,IAAoC;EAC5E,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;EACjC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,EAAE,EAAE,OAAO;IAAE,IAAI,EAAE,IAAI;IAAE,GAAG,EAAE;EAAG,CAAC;EACrG,OAAO;IAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;IAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG;EAAE,CAAC;AAC3D,CAAC;AAOD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS,QAAQ,CAAC,KAAoB,EAAe;EAC1D,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;EAC1D,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC;EAC7C,yCACY,IAAI;IAAA;MAAA,OAAS,KAAK,CAAC,KAAK,GAAG,iBAAiB,KAAK,CAAC,KAAK,EAAE,GAAG,eAAe;IAAA;IAAA,IAAE,KAAK;MAAA,OAAE,KAAK,CAAC,IAAI;IAAA;EAAA,4BAC3E,KAAK,CAAC,IAAI,4BAElC,KAAK,CAAC,CAAC,CAAC,IAAI,IAEd,KAAK,CAAC,CAAC,CAAC,GAAG,2BAEP,KAAK,CAAC,CAAC,CAAC,GAAG,cAEZ,IAAI;AAGd;AAEA,eAAe,QAAQ","ignoreList":[]}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { createComponent as _$createComponent } from "solid-js/web";
|
|
2
|
-
import { ssr as _$ssr } from "solid-js/web";
|
|
3
|
-
import { escape as _$escape } from "solid-js/web";
|
|
4
|
-
import { memo as _$memo } from "solid-js/web";
|
|
5
|
-
var _tmpl$ = ["<span class=\"k2b-count-chip\">", "</span>"],
|
|
6
|
-
_tmpl$2 = ["<span class=\"k2b-task-row__detail\">", "</span>"],
|
|
7
|
-
_tmpl$3 = ["<span class=\"k2b-task-row__body\"><i class=\"", "\" aria-hidden=\"true\"></i><span class=\"k2b-task-row__copy\"><span class=\"k2b-task-row__line\">", "<span class=\"k2b-task-row__text\">", "</span></span>", "</span><span class=\"k2b-task-row__action\">", "</span>", "</span>"];
|
|
8
|
-
import { createSignal, Show } from "solid-js";
|
|
9
|
-
import { Dynamic, isServer } from "solid-js/web";
|
|
10
|
-
import { Tooltip } from "../feedback/Tooltip";
|
|
11
|
-
/**
|
|
12
|
-
* A task that only has a date, such as items waiting for pickup until a day: the kind as a symbol, the count as a
|
|
13
|
-
* chip, one sentence and, at the end, the action word. The whole row is one link or button. What needs someone now
|
|
14
|
-
* and has a consequence is a notice cell instead (K10), not a task row.
|
|
15
|
-
* @example <TaskRow icon="ti ti-package-export" count={3} text="Unsold items are ready for pickup" detail="until Dec 12, 2026" action="Prepare handover" href="/handover" />
|
|
16
|
-
*/
|
|
17
|
-
export function TaskRow(props) {
|
|
18
|
-
let row;
|
|
19
|
-
let body;
|
|
20
|
-
let sentence;
|
|
21
|
-
// The full sentence shows as a hint only while it is cut; it is measured when a pointer or the keyboard arrives.
|
|
22
|
-
const [cut, setCut] = createSignal(false);
|
|
23
|
-
const measure = () => setCut(Boolean(sentence && sentence.scrollWidth > sentence.clientWidth + 1));
|
|
24
|
-
const link = () => props.href !== undefined && !props.disabled;
|
|
25
|
-
const element = () => props.href !== undefined ? "a" : "button";
|
|
26
|
-
return _$createComponent(Dynamic, {
|
|
27
|
-
get component() {
|
|
28
|
-
return element();
|
|
29
|
-
},
|
|
30
|
-
get ["class"]() {
|
|
31
|
-
return _$memo(() => !!props.class)() ? `k2b-task-row ${props.class}` : "k2b-task-row";
|
|
32
|
-
},
|
|
33
|
-
get href() {
|
|
34
|
-
return _$memo(() => !!link())() ? props.href : undefined;
|
|
35
|
-
},
|
|
36
|
-
get type() {
|
|
37
|
-
return element() === "button" ? "button" : undefined;
|
|
38
|
-
},
|
|
39
|
-
get disabled() {
|
|
40
|
-
return _$memo(() => element() === "button")() ? props.disabled : undefined;
|
|
41
|
-
},
|
|
42
|
-
get role() {
|
|
43
|
-
return props.disabled && element() === "a" ? "link" : undefined;
|
|
44
|
-
},
|
|
45
|
-
get ["aria-disabled"]() {
|
|
46
|
-
return props.disabled && element() === "a" ? "true" : undefined;
|
|
47
|
-
},
|
|
48
|
-
get ["aria-label"]() {
|
|
49
|
-
return props.label;
|
|
50
|
-
},
|
|
51
|
-
get ["data-detail"]() {
|
|
52
|
-
return props.detail !== undefined ? "" : undefined;
|
|
53
|
-
},
|
|
54
|
-
get title() {
|
|
55
|
-
return isServer ? props.text : undefined;
|
|
56
|
-
},
|
|
57
|
-
onClick: event => {
|
|
58
|
-
if (props.disabled) {
|
|
59
|
-
event.preventDefault();
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
props.onClick?.(event);
|
|
63
|
-
},
|
|
64
|
-
"on:pointerenter": measure,
|
|
65
|
-
"on:focusin": measure,
|
|
66
|
-
get children() {
|
|
67
|
-
return _$ssr(_tmpl$3, `${_$escape(props.icon, true)} k2b-task-row__icon`, _$escape(_$createComponent(Show, {
|
|
68
|
-
get when() {
|
|
69
|
-
return props.count;
|
|
70
|
-
},
|
|
71
|
-
get children() {
|
|
72
|
-
return _$ssr(_tmpl$, _$escape(props.count));
|
|
73
|
-
}
|
|
74
|
-
})), _$escape(props.text), _$escape(_$createComponent(Show, {
|
|
75
|
-
get when() {
|
|
76
|
-
return props.detail !== undefined;
|
|
77
|
-
},
|
|
78
|
-
get children() {
|
|
79
|
-
return _$ssr(_tmpl$2, _$escape(props.detail));
|
|
80
|
-
}
|
|
81
|
-
})), _$escape(props.action), _$escape(_$createComponent(Tooltip, {
|
|
82
|
-
get content() {
|
|
83
|
-
return props.text;
|
|
84
|
-
},
|
|
85
|
-
target: () => body,
|
|
86
|
-
focusTarget: () => row,
|
|
87
|
-
get disabled() {
|
|
88
|
-
return !cut();
|
|
89
|
-
}
|
|
90
|
-
})));
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
export default TaskRow;
|
|
95
|
-
//# sourceMappingURL=TaskRow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["content/TaskRow.tsx"],"sourcesContent":["import { createSignal, type JSX, Show } from \"solid-js\";\nimport { Dynamic, isServer } from \"solid-js/web\";\nimport { Tooltip } from \"../feedback/Tooltip\";\n\nexport type TaskRowProps = {\n /** Tabler icon class for the kind of task, such as `ti ti-package-export`. Decorative: the sentence names the task. */\n icon: string;\n /** How many things the task covers, as a chip before the sentence. Zero shows no chip; the sentence says it in words. */\n count?: number;\n /** The task in one sentence, such as \"3 unsold items are ready for pickup\". One line; a longer one ends in an ellipsis. */\n text: string;\n /** A quiet second line, such as the date the task is due. The row is then 52 px instead of 40 px. */\n detail?: JSX.Element;\n /** The action word at the end, such as \"Prepare handover\". It is never cut; the sentence gives way first. */\n action: string;\n /** Where the row leads. The row is then a link. */\n href?: string;\n /** What the row does when there is no `href`. The row is then a button. */\n onClick?: (event: MouseEvent) => void;\n /** The task cannot be started now. The row stays in place, reads as unavailable and does nothing. */\n disabled?: boolean;\n /**\n * The accessible name, when the visible text alone does not say what happens. Defaults to the row's text. Start it\n * with the visible sentence and action word, so people who speak a visible word can still reach the row.\n */\n label?: string;\n class?: string;\n};\n\n/**\n * A task that only has a date, such as items waiting for pickup until a day: the kind as a symbol, the count as a\n * chip, one sentence and, at the end, the action word. The whole row is one link or button. What needs someone now\n * and has a consequence is a notice cell instead (K10), not a task row.\n * @example <TaskRow icon=\"ti ti-package-export\" count={3} text=\"Unsold items are ready for pickup\" detail=\"until Dec 12, 2026\" action=\"Prepare handover\" href=\"/handover\" />\n */\nexport function TaskRow(props: TaskRowProps): JSX.Element {\n let row: HTMLElement | undefined;\n let body: HTMLSpanElement | undefined;\n let sentence: HTMLSpanElement | undefined;\n // The full sentence shows as a hint only while it is cut; it is measured when a pointer or the keyboard arrives.\n const [cut, setCut] = createSignal(false);\n const measure = () => setCut(Boolean(sentence && sentence.scrollWidth > sentence.clientWidth + 1));\n const link = () => props.href !== undefined && !props.disabled;\n const element = () => (props.href !== undefined ? \"a\" : \"button\");\n\n return (\n <Dynamic\n component={element()}\n ref={(node: HTMLElement) => {\n row = node;\n }}\n class={props.class ? `k2b-task-row ${props.class}` : \"k2b-task-row\"}\n href={link() ? props.href : undefined}\n type={element() === \"button\" ? \"button\" : undefined}\n disabled={element() === \"button\" ? props.disabled : undefined}\n role={props.disabled && element() === \"a\" ? \"link\" : undefined}\n aria-disabled={props.disabled && element() === \"a\" ? \"true\" : undefined}\n aria-label={props.label}\n data-detail={props.detail !== undefined ? \"\" : undefined}\n // The no-JavaScript hint; once hydrated, the shared tooltip shows the sentence, and only while it is cut.\n title={isServer ? props.text : undefined}\n onClick={(event: MouseEvent) => {\n if (props.disabled) {\n event.preventDefault();\n return;\n }\n props.onClick?.(event);\n }}\n on:pointerenter={measure}\n on:focusin={measure}\n >\n <span ref={body} class=\"k2b-task-row__body\">\n <i class={`${props.icon} k2b-task-row__icon`} aria-hidden=\"true\" />\n <span class=\"k2b-task-row__copy\">\n <span class=\"k2b-task-row__line\">\n <Show when={props.count}>\n <span class=\"k2b-count-chip\">{props.count}</span>\n </Show>\n <span ref={sentence} class=\"k2b-task-row__text\">\n {props.text}\n </span>\n </span>\n <Show when={props.detail !== undefined}>\n <span class=\"k2b-task-row__detail\">{props.detail}</span>\n </Show>\n </span>\n <span class=\"k2b-task-row__action\">{props.action}</span>\n {/* Inside the row, so a container that divides its rows (`k2b-divided`) sees only rows. The row keeps the\n focus; the hint is hidden from its name, which already holds the sentence. */}\n <Tooltip content={props.text} target={() => body} focusTarget={() => row} disabled={!cut()} />\n </span>\n </Dynamic>\n );\n}\n\nexport default TaskRow;\n"],"mappings":";;;;;;;AAAA,SAAS,YAAY,EAAY,IAAI,QAAQ,UAAU;AACvD,SAAS,OAAO,EAAE,QAAQ,QAAQ,cAAc;AAChD,SAAS,OAAO,QAAQ,qBAAqB;AA2B7C;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS,OAAO,CAAC,KAAmB,EAAe;EACxD,IAAI,GAA4B;EAChC,IAAI,IAAiC;EACrC,IAAI,QAAqC;EACzC;EACA,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC;EACzC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,QAAQ,IAAI,QAAQ,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;EAClG,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,QAAQ;EAC9D,MAAM,OAAO,GAAG,MAAO,KAAK,CAA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CAAC,KAAK;QAAA;QAAA;UAAA,8BACS,KAAK,CAAC,KAAK;QAAA;MAAA,cAGxC,KAAK,CAAC,IAAI,8BAGd,IAAI;QAAA,IAAC,IAAI;UAAA,OAAE,KAAK,CAAC,MAAM,KAAK,SAAS;QAAA;QAAA;UAAA,+BACA,KAAK,CAAC,MAAM;QAAA;MAAA,cAGhB,KAAK,CAAC,MAAM,8BAG/C,OAAO;QAAA,IAAC,OAAO;UAAA,OAAE,KAAK,CAAC,IAAI;QAAA;QAAE,MAAM,EAAE,MAAM,IAAI;QAAE,WAAW,EAAE,MAAM,GAAG;QAAA,IAAE,QAAQ;UAAA,OAAE,CAAC,GAAG,CAAC,CAAC;QAAA;MAAA;IAAA;EAAA;AAIlG;AAEA,eAAe,OAAO","ignoreList":[]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { i18n } from "@k2b/stdlib";
|
|
2
|
-
import { useLocale } from "../intl/locale";
|
|
3
|
-
|
|
4
|
-
// The word for the current stage lives with the path, not in the common catalog every component loads.
|
|
5
|
-
const progressPathMessages = i18n.define({
|
|
6
|
-
baseLocale: "en",
|
|
7
|
-
messages: {
|
|
8
|
-
en: {
|
|
9
|
-
current: "current step"
|
|
10
|
-
},
|
|
11
|
-
de: {
|
|
12
|
-
current: "aktueller Schritt"
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
/** Resolved from the inherited render locale. */
|
|
17
|
-
export const useProgressPathMessages = () => {
|
|
18
|
-
const locale = useLocale();
|
|
19
|
-
return () => progressPathMessages.resolve([locale()]).t;
|
|
20
|
-
};
|
|
21
|
-
export const checkProgressPathMessages = () => progressPathMessages.check();
|
|
22
|
-
//# sourceMappingURL=progress-path-messages.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["content/progress-path-messages.ts"],"sourcesContent":["import { i18n } from \"@k2b/stdlib\";\nimport { useLocale } from \"../intl/locale\";\n\n// The word for the current stage lives with the path, not in the common catalog every component loads.\nconst progressPathMessages = i18n.define({\n baseLocale: \"en\",\n messages: {\n en: { current: \"current step\" },\n de: { current: \"aktueller Schritt\" },\n },\n});\n\nexport type ProgressPathMessages = ReturnType<(typeof progressPathMessages)[\"resolve\"]>[\"t\"];\n\n/** Resolved from the inherited render locale. */\nexport const useProgressPathMessages = (): (() => ProgressPathMessages) => {\n const locale = useLocale();\n return () => progressPathMessages.resolve([locale()]).t;\n};\n\nexport const checkProgressPathMessages = () => progressPathMessages.check();\n"],"mappings":"AAAA,SAAS,IAAI,QAAQ,aAAa;AAClC,SAAS,SAAS,QAAQ,gBAAgB;;AAE1C;AACA,MAAM,oBAAoB,GAAG,IAAI,CAAC,MAAM,CAAC;EACvC,UAAU,EAAE,IAAI;EAChB,QAAQ,EAAE;IACR,EAAE,EAAE;MAAE,OAAO,EAAE;IAAe,CAAC;IAC/B,EAAE,EAAE;MAAE,OAAO,EAAE;IAAoB;EACrC;AACF,CAAC,CAAC;AAIF;AACA,OAAO,MAAM,uBAAuB,GAAG,MAAoC;EACzE,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC;EAC1B,OAAO,MAAM,oBAAoB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzD,CAAC;AAED,OAAO,MAAM,yBAAyB,GAAG,MAAM,oBAAoB,CAAC,KAAK,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { DIALOG_LIFT } from "./dialog-core";
|
|
2
|
-
|
|
3
|
-
/** The least room a lifted frame keeps above it, as the frame's own budget keeps at the viewport's edge. */
|
|
4
|
-
const EDGE = 8;
|
|
5
|
-
|
|
6
|
-
/** A frame centered by its stylesheet, which grows down by half of any new height: a sheet or a placed window does not. */
|
|
7
|
-
const centered = frame => {
|
|
8
|
-
if (frame.style.inset || frame.hasAttribute("data-k2b-follow-content") || frame.hasAttribute("data-k2b-frame-motion")) return false;
|
|
9
|
-
const transform = getComputedStyle(frame).transform;
|
|
10
|
-
return Boolean(transform && transform !== "none" && new DOMMatrixReadOnly(transform).m42 < -0.5);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Keeps a dialog's footer where it is whenever the frame's height changes while it is open, such as when an error
|
|
15
|
-
* shows above the footer (K16): a centered frame grows down by half of the new height, so it moves up by that much
|
|
16
|
-
* and grows upwards only; it shrinks from the top as well. It never moves past the top edge: a frame at its full
|
|
17
|
-
* height scrolls its body instead. A frame that follows its content folds from its top edge on its own, a placed
|
|
18
|
-
* window keeps its place, and a sheet keeps its bottom anyway. A new window size centers the frame again.
|
|
19
|
-
* Returns a function that stops it.
|
|
20
|
-
*/
|
|
21
|
-
export const holdDialogFoot = footer => {
|
|
22
|
-
const frame = footer.closest("dialog");
|
|
23
|
-
if (!frame || typeof ResizeObserver === "undefined") return;
|
|
24
|
-
// The first measure of an open frame is where the footer stands; opening is no change.
|
|
25
|
-
let height;
|
|
26
|
-
const observer = new ResizeObserver(() => {
|
|
27
|
-
const next = frame.offsetHeight;
|
|
28
|
-
const delta = height === undefined || !frame.open ? 0 : next - height;
|
|
29
|
-
height = frame.open ? next : undefined;
|
|
30
|
-
// Only the level on show holds its footer; a level hidden below another one changes nothing.
|
|
31
|
-
if (Math.abs(delta) < 0.5 || !frame.open || !footer.isConnected || footer.offsetParent === null || !centered(frame)) return;
|
|
32
|
-
const half = delta / 2;
|
|
33
|
-
const shift = half > 0 ? Math.min(half, Math.max(0, frame.getBoundingClientRect().top - EDGE)) : half;
|
|
34
|
-
const lift = Math.max(0, (Number.parseFloat(frame.style.getPropertyValue(DIALOG_LIFT)) || 0) + shift);
|
|
35
|
-
if (lift < 0.5) frame.style.removeProperty(DIALOG_LIFT);else frame.style.setProperty(DIALOG_LIFT, `${Math.round(lift)}px`);
|
|
36
|
-
});
|
|
37
|
-
const recenter = () => frame.style.removeProperty(DIALOG_LIFT);
|
|
38
|
-
observer.observe(frame);
|
|
39
|
-
window.addEventListener("resize", recenter);
|
|
40
|
-
return () => {
|
|
41
|
-
observer.disconnect();
|
|
42
|
-
window.removeEventListener("resize", recenter);
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
//# sourceMappingURL=dialog-foot.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["feedback/dialog-foot.ts"],"sourcesContent":["import { DIALOG_LIFT } from \"./dialog-core\";\n\n/** The least room a lifted frame keeps above it, as the frame's own budget keeps at the viewport's edge. */\nconst EDGE = 8;\n\n/** A frame centered by its stylesheet, which grows down by half of any new height: a sheet or a placed window does not. */\nconst centered = (frame: HTMLElement): boolean => {\n if (frame.style.inset || frame.hasAttribute(\"data-k2b-follow-content\") || frame.hasAttribute(\"data-k2b-frame-motion\")) return false;\n const transform = getComputedStyle(frame).transform;\n return Boolean(transform && transform !== \"none\" && new DOMMatrixReadOnly(transform).m42 < -0.5);\n};\n\n/**\n * Keeps a dialog's footer where it is whenever the frame's height changes while it is open, such as when an error\n * shows above the footer (K16): a centered frame grows down by half of the new height, so it moves up by that much\n * and grows upwards only; it shrinks from the top as well. It never moves past the top edge: a frame at its full\n * height scrolls its body instead. A frame that follows its content folds from its top edge on its own, a placed\n * window keeps its place, and a sheet keeps its bottom anyway. A new window size centers the frame again.\n * Returns a function that stops it.\n */\nexport const holdDialogFoot = (footer: HTMLElement): (() => void) | undefined => {\n const frame = footer.closest(\"dialog\");\n if (!frame || typeof ResizeObserver === \"undefined\") return;\n // The first measure of an open frame is where the footer stands; opening is no change.\n let height: number | undefined;\n const observer = new ResizeObserver(() => {\n const next = frame.offsetHeight;\n const delta = height === undefined || !frame.open ? 0 : next - height;\n height = frame.open ? next : undefined;\n // Only the level on show holds its footer; a level hidden below another one changes nothing.\n if (Math.abs(delta) < 0.5 || !frame.open || !footer.isConnected || footer.offsetParent === null || !centered(frame)) return;\n const half = delta / 2;\n const shift = half > 0 ? Math.min(half, Math.max(0, frame.getBoundingClientRect().top - EDGE)) : half;\n const lift = Math.max(0, (Number.parseFloat(frame.style.getPropertyValue(DIALOG_LIFT)) || 0) + shift);\n if (lift < 0.5) frame.style.removeProperty(DIALOG_LIFT);\n else frame.style.setProperty(DIALOG_LIFT, `${Math.round(lift)}px`);\n });\n const recenter = () => frame.style.removeProperty(DIALOG_LIFT);\n observer.observe(frame);\n window.addEventListener(\"resize\", recenter);\n return () => {\n observer.disconnect();\n window.removeEventListener(\"resize\", recenter);\n };\n};\n"],"mappings":"AAAA,SAAS,WAAW,QAAQ,eAAe;;AAE3C;AACA,MAAM,IAAI,GAAG,CAAC;;AAEd;AACA,MAAM,QAAQ,GAAI,KAAkB,IAAc;EAChD,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,YAAY,CAAC,yBAAyB,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,uBAAuB,CAAC,EAAE,OAAO,KAAK;EACnI,MAAM,SAAS,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC,SAAS;EACnD,OAAO,OAAO,CAAC,SAAS,IAAI,SAAS,KAAK,MAAM,IAAI,IAAI,iBAAiB,CAAC,SAAS,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC;AAClG,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM,cAAc,GAAI,MAAmB,IAA+B;EAC/E,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;EACtC,IAAI,CAAC,KAAK,IAAI,OAAO,cAAc,KAAK,WAAW,EAAE;EACrD;EACA,IAAI,MAA0B;EAC9B,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC,MAAM;IACxC,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY;IAC/B,MAAM,KAAK,GAAG,MAAM,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,MAAM;IACrE,MAAM,GAAG,KAAK,CA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|
|
1
|
-
/** Whether resolved children render something; a Show whose condition is false, or a boolean, renders nothing. */
|
|
2
|
-
export const rendersSomething = nodes => nodes.some(node => node != null && typeof node !== "boolean" && node !== "");
|
|
3
|
-
//# sourceMappingURL=renders-something.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["internal/renders-something.ts"],"sourcesContent":["/** Whether resolved children render something; a Show whose condition is false, or a boolean, renders nothing. */\nexport const rendersSomething = (nodes: unknown[]): boolean =>\n nodes.some((node) => node != null && typeof node !== \"boolean\" && node !== \"\");\n"],"mappings":"AAAA;AACA,OAAO,MAAM,gBAAgB,GAAI,KAAgB,IAC/C,KAAK,CAAC,IAAI,CAAE,IAAI,IAAK,IAAI,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,EAAE,CAAC","ignoreList":[]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ssr as _$ssr } from "solid-js/web";
|
|
2
|
-
import { ssrAttribute as _$ssrAttribute } from "solid-js/web";
|
|
3
|
-
import { escape as _$escape } from "solid-js/web";
|
|
4
|
-
var _tmpl$ = ["<div class=\"", "\" role=\"group\"", ">", "</div>"],
|
|
5
|
-
_tmpl$2 = "<span class=\"k2b-floating-pill__separator\" aria-hidden=\"true\"></span>";
|
|
6
|
-
/**
|
|
7
|
-
* The floating pill of a reading column (K6, K16): views and actions of a column that has neither head nor status
|
|
8
|
-
* row, such as a note. Place it as the first child of `AppWorkspace.Main width="reading"`. It stays at the column's
|
|
9
|
-
* top end while the text scrolls below it, and takes no room from the text. It is a `k2b-pill`, so its look, size,
|
|
10
|
-
* and round controls are the ones of every floating pill.
|
|
11
|
-
*/
|
|
12
|
-
const FloatingPill = props => _$ssr(_tmpl$, `k2b-pill k2b-floating-pill${props.class ? ` ${_$escape(props.class, true)}` : ""}`, _$ssrAttribute("aria-label", _$escape(props.label, true), false), _$escape(props.children));
|
|
13
|
-
FloatingPill.Separator = () => _$ssr(_tmpl$2);
|
|
14
|
-
export { FloatingPill };
|
|
15
|
-
export default FloatingPill;
|
|
16
|
-
//# sourceMappingURL=FloatingPill.js.map
|