@nvidia-elements/core 2.16.0 → 2.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/accordion/accordion2.js +4 -4
- package/dist/alert/alert-group2.js +1 -1
- package/dist/alert/alert2.js +1 -1
- package/dist/avatar/avatar-group2.js +1 -1
- package/dist/avatar/avatar2.js +1 -1
- package/dist/badge/badge2.js +1 -1
- package/dist/breadcrumb/breadcrumb2.js +1 -1
- package/dist/bundles/index.d.ts +5 -0
- package/dist/bundles/index.js +7 -7
- package/dist/button/button2.js +1 -1
- package/dist/button-group/button-group2.js +1 -1
- package/dist/card/card2.js +4 -4
- package/dist/chat-message/chat-message2.js +1 -1
- package/dist/checkbox/checkbox-group2.js +1 -1
- package/dist/checkbox/checkbox2.js +1 -1
- package/dist/color/color2.js +1 -1
- package/dist/combobox/combobox2.js +1 -1
- package/dist/copy-button/copy-button2.js +1 -1
- package/dist/custom-elements-jsx.d.ts +3 -0
- package/dist/custom-elements-vue.d.ts +3 -0
- package/dist/custom-elements.json +99 -55
- package/dist/data.html.json +5 -0
- package/dist/date/date2.js +1 -1
- package/dist/datetime/datetime2.js +1 -1
- package/dist/dialog/dialog-footer2.js +1 -1
- package/dist/dialog/dialog-header2.js +1 -1
- package/dist/dialog/dialog2.js +1 -1
- package/dist/divider/divider2.js +1 -1
- package/dist/dot/dot2.js +1 -1
- package/dist/drag-handle/drag-handle2.js +1 -1
- package/dist/drawer/drawer-content2.js +1 -1
- package/dist/drawer/drawer-footer2.js +1 -1
- package/dist/drawer/drawer-header2.js +1 -1
- package/dist/drawer/drawer2.js +1 -1
- package/dist/dropdown/dropdown-footer2.js +1 -1
- package/dist/dropdown/dropdown-header2.js +1 -1
- package/dist/dropdown/dropdown.examples.js.map +1 -1
- package/dist/dropdown/dropdown.examples.json +12 -0
- package/dist/dropdown/dropdown2.js +1 -1
- package/dist/dropdown-group/dropdown-group.js +1 -1
- package/dist/dropzone/dropzone2.js +1 -1
- package/dist/file/file2.js +1 -1
- package/dist/format-bytes/format-bytes2.js +1 -1
- package/dist/format-datetime/format-datetime2.js +1 -1
- package/dist/format-number/format-number2.js +1 -1
- package/dist/format-relative-time/format-relative-time2.js +1 -1
- package/dist/format-truncate/format-truncate2.js +1 -1
- package/dist/forms/control/control2.js +1 -1
- package/dist/forms/control-group/control-group2.js +1 -1
- package/dist/forms/control-message/control-message2.js +1 -1
- package/dist/gauge/gauge2.js +1 -1
- package/dist/grid/cell/cell2.js +1 -1
- package/dist/grid/column/column2.js +1 -1
- package/dist/grid/footer/footer2.js +1 -1
- package/dist/grid/grid2.js +1 -1
- package/dist/grid/header/header2.js +1 -1
- package/dist/grid/placeholder/placeholder2.js +1 -1
- package/dist/grid/row/row2.js +1 -1
- package/dist/icon/icon2.js +2 -2
- package/dist/icon-button/icon-button.d.ts +5 -0
- package/dist/icon-button/icon-button2.js +3 -3
- package/dist/icon-button/icon-button2.js.map +1 -1
- package/dist/iframe/iframe2.js +1 -1
- package/dist/index.js +1 -1
- package/dist/input/input-group2.js +1 -1
- package/dist/input/input2.js +1 -1
- package/dist/internal/controllers/keynav-grid.controller.js +93 -62
- package/dist/internal/controllers/keynav-grid.controller.js.map +1 -1
- package/dist/internal/services/global.service.js +1 -1
- package/dist/internal/styles/popover.js +1 -1
- package/dist/internal/styles/popover.js.map +1 -1
- package/dist/internal/utils/events.d.ts +6 -1
- package/dist/internal/utils/events.js +22 -4
- package/dist/internal/utils/events.js.map +1 -1
- package/dist/logo/logo2.js +1 -1
- package/dist/menu/menu-group2.js +1 -1
- package/dist/menu/menu-item2.js +1 -1
- package/dist/menu/menu2.js +1 -1
- package/dist/month/month2.js +1 -1
- package/dist/notification/notification-group2.js +1 -1
- package/dist/notification/notification2.js +1 -1
- package/dist/page/page-panel/page-panel-content2.js +1 -1
- package/dist/page/page-panel/page-panel-footer2.js +1 -1
- package/dist/page/page-panel/page-panel-header2.js +1 -1
- package/dist/page/page-panel/page-panel2.js +1 -1
- package/dist/page/page2.js +1 -1
- package/dist/page-header/page-header2.js +1 -1
- package/dist/page-loader/page-loader2.js +1 -1
- package/dist/pagination/pagination2.js +1 -1
- package/dist/panel/panel2.js +4 -4
- package/dist/password/password2.js +1 -1
- package/dist/preferences-input/preferences-input2.js +1 -1
- package/dist/progress-bar/progress-bar2.js +1 -1
- package/dist/progress-dot/progress-dot2.js +1 -1
- package/dist/progress-ring/progress-ring2.js +1 -1
- package/dist/progressive-filter-chip/progressive-filter-chip2.js +1 -1
- package/dist/pulse/pulse2.js +1 -1
- package/dist/radio/radio-group2.js +1 -1
- package/dist/radio/radio2.js +1 -1
- package/dist/range/range2.js +1 -1
- package/dist/resize-handle/resize-handle2.js +1 -1
- package/dist/search/search2.js +1 -1
- package/dist/select/select2.js +1 -1
- package/dist/skeleton/skeleton2.js +1 -1
- package/dist/sort-button/sort-button2.js +1 -1
- package/dist/sparkline/sparkline2.js +1 -1
- package/dist/star-rating/star-rating2.js +1 -1
- package/dist/steps/steps2.js +2 -2
- package/dist/switch/switch-group2.js +1 -1
- package/dist/switch/switch2.js +1 -1
- package/dist/tabs/tabs-group2.js +1 -1
- package/dist/tabs/tabs2.js +2 -2
- package/dist/tag/tag2.js +1 -1
- package/dist/textarea/textarea2.js +1 -1
- package/dist/time/time2.js +1 -1
- package/dist/toast/toast2.js +1 -1
- package/dist/toggletip/toggletip-footer2.js +1 -1
- package/dist/toggletip/toggletip-header.js +1 -1
- package/dist/toggletip/toggletip-header.js.map +1 -1
- package/dist/toggletip/toggletip-header2.js +1 -1
- package/dist/toggletip/toggletip.examples.js.map +1 -1
- package/dist/toggletip/toggletip.examples.json +1 -1
- package/dist/toggletip/toggletip2.js +1 -1
- package/dist/toolbar/toolbar2.js +1 -1
- package/dist/tooltip/tooltip2.js +1 -1
- package/dist/tree/tree-node2.js +1 -1
- package/dist/tree/tree2.js +1 -1
- package/dist/week/week2.js +1 -1
- package/package.json +1 -1
|
@@ -1,63 +1,95 @@
|
|
|
1
1
|
import { GlobalStateService as e } from "../services/global.service.js";
|
|
2
|
-
import {
|
|
3
|
-
import { LogService as
|
|
4
|
-
import { focusElement as
|
|
5
|
-
import { KeynavCode as
|
|
2
|
+
import { throttle as t } from "../utils/events.js";
|
|
3
|
+
import { LogService as n } from "../services/log.service.js";
|
|
4
|
+
import { focusElement as r, getActiveElement as i, isSimpleFocusable as a, setActiveKeyListItem as o } from "../utils/focus.js";
|
|
5
|
+
import { KeynavCode as s, getFlattenedDOMTree as c, getFlattenedFocusableItems as l, hasInvalidDOMGrid as u, isContextMenuClick as d, validKeyNavigationCode as f } from "../utils/dom.js";
|
|
6
6
|
//#region src/internal/controllers/keynav-grid.controller.ts
|
|
7
|
-
function
|
|
8
|
-
return (e) => e.addInitializer((e) => new
|
|
7
|
+
function p() {
|
|
8
|
+
return (e) => e.addInitializer((e) => new m(e));
|
|
9
9
|
}
|
|
10
|
-
var
|
|
11
|
-
#e
|
|
10
|
+
var m = class {
|
|
11
|
+
#e;
|
|
12
12
|
#t;
|
|
13
|
-
|
|
13
|
+
#n;
|
|
14
|
+
#r = /* @__PURE__ */ new WeakSet();
|
|
15
|
+
#i = t(() => this.#c(), 500, { trailing: !0 });
|
|
16
|
+
get #a() {
|
|
14
17
|
return {
|
|
15
18
|
grid: this.host,
|
|
16
19
|
...this.host.keynavGridConfig
|
|
17
20
|
};
|
|
18
21
|
}
|
|
19
|
-
get #
|
|
20
|
-
let e = Array.from(this.#
|
|
21
|
-
return this.#
|
|
22
|
+
get #o() {
|
|
23
|
+
let e = Array.from(this.#a.rows);
|
|
24
|
+
return this.#a.columnRow && e.unshift(this.#a.columnRow), e;
|
|
22
25
|
}
|
|
23
|
-
get #
|
|
24
|
-
|
|
26
|
+
get #s() {
|
|
27
|
+
let { columns: e, cells: t } = this.#a;
|
|
28
|
+
return [...Array.from(e ?? []), ...Array.from(t)];
|
|
25
29
|
}
|
|
26
30
|
constructor(e) {
|
|
27
31
|
this.host = e, this.host.addController(this);
|
|
28
32
|
}
|
|
29
33
|
async hostConnected() {
|
|
30
|
-
await this.host.updateComplete, this.host.isConnected && (this.#t = this.#
|
|
34
|
+
await this.host.updateComplete, this.host.isConnected && (this.#t = this.#a.grid, this.#c(), this.#t.addEventListener("keyup", this.#m), this.#t.addEventListener("keydown", this.#f), this.#t.addEventListener("mouseup", this.#d), this.#e?.disconnect(), this.#e = new MutationObserver(this.#l), this.#e.observe(this.#t, {
|
|
35
|
+
childList: !0,
|
|
36
|
+
subtree: !0,
|
|
37
|
+
attributes: !0,
|
|
38
|
+
attributeFilter: ["tabindex"]
|
|
39
|
+
}));
|
|
31
40
|
}
|
|
32
41
|
hostDisconnected() {
|
|
33
|
-
this.#e
|
|
42
|
+
this.#e?.disconnect(), this.#e = void 0, this.#i.cancel(), this.#t?.removeEventListener("keyup", this.#m), this.#t?.removeEventListener("keydown", this.#f), this.#t?.removeEventListener("mouseup", this.#d), this.#t = void 0, this.#n = void 0;
|
|
34
43
|
}
|
|
35
|
-
#
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
#c() {
|
|
45
|
+
let e = this.#s, t = e.find((e) => e.tabIndex === 0) ?? (this.#n && e.includes(this.#n) ? this.#n : e[0]);
|
|
46
|
+
this.#n = t, this.#r = new WeakSet(e);
|
|
47
|
+
for (let n of e) {
|
|
48
|
+
let e = n === t ? "0" : "-1";
|
|
49
|
+
n.getAttribute("tabindex") !== e && n.setAttribute("tabindex", e);
|
|
39
50
|
}
|
|
40
51
|
}
|
|
41
|
-
#
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
52
|
+
#l = (e) => {
|
|
53
|
+
e.some((e) => {
|
|
54
|
+
if (e.type === "attributes") {
|
|
55
|
+
let t = e.target;
|
|
56
|
+
return t instanceof HTMLElement && this.#r.has(t) && t.getAttribute("tabindex") !== (t === this.#n ? "0" : "-1");
|
|
57
|
+
}
|
|
58
|
+
return [...e.addedNodes, ...e.removedNodes].some((e) => e.nodeType === Node.ELEMENT_NODE);
|
|
59
|
+
}) && this.#i();
|
|
60
|
+
};
|
|
61
|
+
#u() {
|
|
62
|
+
this.#l(this.#e?.takeRecords() ?? []), this.#i.flush();
|
|
63
|
+
}
|
|
64
|
+
#d = (e) => {
|
|
65
|
+
if (!d(e)) {
|
|
66
|
+
this.#u();
|
|
67
|
+
let t = e.composedPath()[0], n = this.#s.find((e) => e === t) ? t : null;
|
|
68
|
+
n && this.#p(e, n);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
#f = (t) => {
|
|
72
|
+
if (!f(t)) return;
|
|
73
|
+
this.#u();
|
|
74
|
+
let r = Array.from(this.#o), o = Array.from(this.#s);
|
|
75
|
+
if (e.state.env !== "production" && u(r)) {
|
|
76
|
+
n.warn("Invalid grid structure, all rows must have the same number of cells");
|
|
45
77
|
return;
|
|
46
78
|
}
|
|
47
|
-
if (
|
|
48
|
-
let { x: e, y:
|
|
79
|
+
if (a(i())) {
|
|
80
|
+
let { x: e, y: n } = _(o, r, {
|
|
49
81
|
code: t.code,
|
|
50
82
|
ctrlKey: t.ctrlKey,
|
|
51
83
|
dir: this.host.dir
|
|
52
|
-
}),
|
|
53
|
-
this.#
|
|
84
|
+
}), i = Array.from(c(r[n])).filter((e) => !!o.find((t) => t === e))[e];
|
|
85
|
+
this.#p(t, i), t.preventDefault();
|
|
54
86
|
}
|
|
55
|
-
}
|
|
56
|
-
#
|
|
57
|
-
|
|
58
|
-
let n =
|
|
59
|
-
|
|
60
|
-
let
|
|
87
|
+
};
|
|
88
|
+
#p(e, t) {
|
|
89
|
+
this.#n = t, o(this.#s, t);
|
|
90
|
+
let n = l(t), i = n.filter((e) => a(e));
|
|
91
|
+
i.length === 1 && n.length === 1 ? r(i[0]) : r(t);
|
|
92
|
+
let s = {
|
|
61
93
|
code: e instanceof KeyboardEvent ? e.code : null,
|
|
62
94
|
shiftKey: e.shiftKey,
|
|
63
95
|
activeItem: t
|
|
@@ -65,23 +97,22 @@ var g = class {
|
|
|
65
97
|
t.dispatchEvent(new CustomEvent("nve-key-change", {
|
|
66
98
|
bubbles: !0,
|
|
67
99
|
composed: !0,
|
|
68
|
-
detail:
|
|
100
|
+
detail: s
|
|
69
101
|
}));
|
|
70
102
|
}
|
|
71
|
-
#
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
#d = (e) => this.#a(e);
|
|
103
|
+
#m = (e) => {
|
|
104
|
+
if (e.code !== "Enter" && e.code !== "Escape") return;
|
|
105
|
+
this.#u();
|
|
106
|
+
let t = Array.from(this.#s).find((e) => e.tabIndex === 0);
|
|
107
|
+
e.code === "Escape" && t?.focus(), e.code === "Enter" && t === e.composedPath()[0] && l(t)[0]?.focus();
|
|
108
|
+
};
|
|
78
109
|
};
|
|
79
|
-
function
|
|
80
|
-
let n = t === "rtl" ?
|
|
81
|
-
return e ===
|
|
110
|
+
function h(e, t) {
|
|
111
|
+
let n = t === "rtl" ? s.ArrowRight : s.ArrowLeft, r = t === "rtl" ? s.ArrowLeft : s.ArrowRight;
|
|
112
|
+
return e === s.ArrowUp ? {
|
|
82
113
|
dx: 0,
|
|
83
114
|
dy: -1
|
|
84
|
-
} : e ===
|
|
115
|
+
} : e === s.ArrowDown ? {
|
|
85
116
|
dx: 0,
|
|
86
117
|
dy: 1
|
|
87
118
|
} : e === n ? {
|
|
@@ -90,42 +121,42 @@ function _(e, t) {
|
|
|
90
121
|
} : e === r ? {
|
|
91
122
|
dx: 1,
|
|
92
123
|
dy: 0
|
|
93
|
-
} : e ===
|
|
124
|
+
} : e === s.PageUp ? {
|
|
94
125
|
dx: 0,
|
|
95
126
|
dy: -4
|
|
96
|
-
} : e ===
|
|
127
|
+
} : e === s.PageDown ? {
|
|
97
128
|
dx: 0,
|
|
98
129
|
dy: 4
|
|
99
130
|
} : null;
|
|
100
131
|
}
|
|
101
|
-
function
|
|
102
|
-
let { x: r, y: i } = t, { columnCount: a, rowCount: o, ctrlKey:
|
|
103
|
-
return e ===
|
|
132
|
+
function g(e, t, n) {
|
|
133
|
+
let { x: r, y: i } = t, { columnCount: a, rowCount: o, ctrlKey: c } = n;
|
|
134
|
+
return e === s.End ? {
|
|
104
135
|
x: a,
|
|
105
|
-
y:
|
|
106
|
-
} : e ===
|
|
136
|
+
y: c ? o : i
|
|
137
|
+
} : e === s.Home ? {
|
|
107
138
|
x: 0,
|
|
108
|
-
y:
|
|
139
|
+
y: c ? 0 : i
|
|
109
140
|
} : {
|
|
110
141
|
x: r,
|
|
111
142
|
y: i
|
|
112
143
|
};
|
|
113
144
|
}
|
|
114
|
-
function
|
|
115
|
-
let r = e.find((e) => e.tabIndex === 0), i = t.find((e) =>
|
|
116
|
-
return d ? (
|
|
117
|
-
x:
|
|
118
|
-
y:
|
|
145
|
+
function _(e, t, n) {
|
|
146
|
+
let r = e.find((e) => e.tabIndex === 0), i = t.find((e) => c(e).find((e) => e === r)), a = Array.from(c(i)).filter((t) => !!e.find((e) => e === t)), o = t.length - 1, s = a.length - 1, l = a.indexOf(r), u = t.indexOf(i), d = h(n.code, n.dir);
|
|
147
|
+
return d ? (l = Math.max(0, Math.min(s, l + d.dx)), u = Math.max(0, Math.min(o, u + d.dy))) : {x: l, y: u} = g(n.code, {
|
|
148
|
+
x: l,
|
|
149
|
+
y: u
|
|
119
150
|
}, {
|
|
120
151
|
columnCount: s,
|
|
121
152
|
rowCount: o,
|
|
122
153
|
ctrlKey: n.ctrlKey
|
|
123
154
|
}), {
|
|
124
|
-
x:
|
|
125
|
-
y:
|
|
155
|
+
x: l,
|
|
156
|
+
y: u
|
|
126
157
|
};
|
|
127
158
|
}
|
|
128
159
|
//#endregion
|
|
129
|
-
export {
|
|
160
|
+
export { m as KeyNavigationGridController, _ as getNextKeyGridItem, p as keyNavigationGrid };
|
|
130
161
|
|
|
131
162
|
//# sourceMappingURL=keynav-grid.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keynav-grid.controller.js","names":[],"sources":["../../../src/internal/controllers/keynav-grid.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ReactiveController, ReactiveElement } from 'lit';\nimport type { LegacyDecoratorTarget } from '../types/index.js';\nimport { onChildListMutation, throttle } from '../utils/events.js';\nimport { GlobalStateService } from '../services/global.service.js';\nimport { LogService } from '../services/log.service.js';\nimport {\n validKeyNavigationCode,\n isContextMenuClick,\n getFlattenedDOMTree,\n getFlattenedFocusableItems,\n KeynavCode,\n hasInvalidDOMGrid\n} from '../utils/dom.js';\nimport {\n focusElement,\n getActiveElement,\n initializeKeyListItems,\n setActiveKeyListItem,\n isSimpleFocusable\n} from '../utils/focus.js';\n\nexport interface KeynavGridConfig {\n grid?: HTMLElement;\n columnRow?: HTMLElement;\n columns?: NodeListOf<HTMLElement> | HTMLElement[];\n rows: NodeListOf<HTMLElement> | HTMLElement[];\n cells: NodeListOf<HTMLElement> | HTMLElement[];\n}\n\nexport interface KeynavGridElement {\n keynavGridConfig: KeynavGridConfig;\n}\n\n/**\n * https://w3c.github.io/aria-practices/#gridNav_focus\n */\nexport function keyNavigationGrid<T extends ReactiveElement & KeynavGridElement>(): ClassDecorator {\n return (target: LegacyDecoratorTarget) =>\n target.addInitializer!((instance: T) => new KeyNavigationGridController(instance));\n}\n\nexport class KeyNavigationGridController<T extends ReactiveElement & KeynavGridElement> implements ReactiveController {\n #observers: MutationObserver[] = [];\n #grid?: HTMLElement;\n\n get #config() {\n return {\n grid: this.host,\n ...this.host.keynavGridConfig\n };\n }\n\n get #hostRows() {\n const rows = Array.from(this.#config.rows);\n\n if (this.#config.columnRow) {\n rows.unshift(this.#config.columnRow);\n }\n\n return rows;\n }\n\n get #hostCells() {\n return [...Array.from(this.#config.columns ?? []), ...Array.from(this.#config.cells)];\n }\n\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n async hostConnected() {\n await this.host.updateComplete;\n if (!this.host.isConnected) return;\n\n this.#grid = this.#config.grid;\n initializeKeyListItems(this.#hostCells);\n this.#grid.addEventListener('keyup', this.#onKeyUp);\n this.#grid.addEventListener('keydown', this.#onKeyDown);\n this.#grid.addEventListener('mouseup', this.#onMouseUp);\n this.#observers.push(\n onChildListMutation(\n this.host,\n throttle(() => initializeKeyListItems(this.#hostCells), 500)\n )\n );\n }\n\n hostDisconnected() {\n this.#observers.forEach(o => o?.disconnect());\n this.#observers.length = 0;\n this.#grid?.removeEventListener('keyup', this.#onKeyUp);\n this.#grid?.removeEventListener('keydown', this.#onKeyDown);\n this.#grid?.removeEventListener('mouseup', this.#onMouseUp);\n this.#grid = undefined;\n }\n\n #clickCell(e: MouseEvent) {\n if (!isContextMenuClick(e)) {\n const focusedElement = e.composedPath()[0] as HTMLElement;\n const activeCell = this.#hostCells.find(i => i === focusedElement) ? focusedElement : null;\n if (activeCell) {\n this.#setActiveCell(e, activeCell as HTMLElement);\n }\n }\n }\n\n #keynavCell(e: KeyboardEvent) {\n const rows = Array.from(this.#hostRows);\n const cells = Array.from(this.#hostCells);\n\n if (GlobalStateService.state.env !== 'production' && hasInvalidDOMGrid(rows)) {\n LogService.warn('Invalid grid structure, all rows must have the same number of cells');\n return;\n }\n\n if (validKeyNavigationCode(e) && isSimpleFocusable(getActiveElement() as Element)) {\n const { x, y } = getNextKeyGridItem(cells, rows, {\n code: e.code,\n ctrlKey: e.ctrlKey,\n dir: this.host.dir\n });\n\n const nextCell = Array.from(getFlattenedDOMTree(rows[y]!)).filter(c => !!cells.find(i => i === c))[\n x\n ] as HTMLElement;\n this.#setActiveCell(e, nextCell);\n e.preventDefault();\n }\n }\n\n #setActiveCell(e: KeyboardEvent | MouseEvent, activeCell: HTMLElement) {\n setActiveKeyListItem(this.#hostCells, activeCell);\n\n const items = getFlattenedFocusableItems(activeCell);\n const simpleItems = items.filter(i => isSimpleFocusable(i));\n\n if (simpleItems.length === 1 && items.length === 1) {\n focusElement(simpleItems[0]!);\n } else {\n focusElement(activeCell);\n }\n\n const detail = { code: e instanceof KeyboardEvent ? e.code : null, shiftKey: e.shiftKey, activeItem: activeCell };\n activeCell.dispatchEvent(new CustomEvent('nve-key-change', { bubbles: true, composed: true, detail }));\n }\n\n #updateCellActivation(e: KeyboardEvent) {\n const activeCell = Array.from(this.#hostCells).find(i => i.tabIndex === 0) as HTMLElement;\n if (e.code === 'Escape') {\n activeCell?.focus();\n }\n\n if (e.code === 'Enter' && activeCell === e.composedPath()[0]) {\n getFlattenedFocusableItems(activeCell as HTMLElement)[0]?.focus();\n }\n }\n\n #onKeyUp = (e: KeyboardEvent) => this.#updateCellActivation(e);\n\n #onKeyDown = (e: KeyboardEvent) => this.#keynavCell(e);\n\n #onMouseUp = (e: MouseEvent) => this.#clickCell(e);\n}\n\nfunction getGridDelta(code: KeynavCode | string, dir: string): { dx: number; dy: number } | null {\n const start = dir === 'rtl' ? KeynavCode.ArrowRight : KeynavCode.ArrowLeft;\n const end = dir === 'rtl' ? KeynavCode.ArrowLeft : KeynavCode.ArrowRight;\n\n if (code === KeynavCode.ArrowUp) return { dx: 0, dy: -1 };\n if (code === KeynavCode.ArrowDown) return { dx: 0, dy: 1 };\n if (code === start) return { dx: -1, dy: 0 };\n if (code === end) return { dx: 1, dy: 0 };\n if (code === KeynavCode.PageUp) return { dx: 0, dy: -4 };\n if (code === KeynavCode.PageDown) return { dx: 0, dy: 4 };\n return null;\n}\n\nfunction applyGridHomeEnd(\n code: KeynavCode | string,\n position: { x: number; y: number },\n bounds: { columnCount: number; rowCount: number; ctrlKey: boolean }\n) {\n const { x, y } = position;\n const { columnCount, rowCount, ctrlKey } = bounds;\n if (code === KeynavCode.End) {\n return { x: columnCount, y: ctrlKey ? rowCount : y };\n }\n\n if (code === KeynavCode.Home) {\n return { x: 0, y: ctrlKey ? 0 : y };\n }\n\n return { x, y };\n}\n\nexport function getNextKeyGridItem(\n cells: HTMLElement[],\n rows: HTMLElement[],\n config: { code: KeynavCode | string; ctrlKey: boolean; dir: string }\n) {\n const currentCell = cells.find(i => i.tabIndex === 0) as HTMLElement;\n const currentRow = rows.find(r => getFlattenedDOMTree(r).find(c => c === currentCell)) as HTMLElement;\n const currentRowCells = Array.from(getFlattenedDOMTree(currentRow)).filter(c => !!cells.find(i => i === c));\n const rowCount = rows.length - 1;\n const columnCount = currentRowCells.length - 1;\n\n let x = currentRowCells.indexOf(currentCell);\n let y = rows.indexOf(currentRow);\n\n const delta = getGridDelta(config.code, config.dir);\n if (delta) {\n x = Math.max(0, Math.min(columnCount, x + delta.dx));\n y = Math.max(0, Math.min(rowCount, y + delta.dy));\n } else {\n ({ x, y } = applyGridHomeEnd(config.code, { x, y }, { columnCount, rowCount, ctrlKey: config.ctrlKey }));\n }\n\n return { x, y };\n}\n"],"mappings":";;;;;;AAuCA,SAAgB,IAAmF;CACjG,QAAQ,MACN,EAAO,gBAAiB,MAAgB,IAAI,EAA4B,CAAQ,CAAC;AACrF;AAEA,IAAa,IAAb,MAAsH;CACpH,KAAiC,CAAC;CAClC;CAEA,IAAI,KAAU;EACZ,OAAO;GACL,MAAM,KAAK;GACX,GAAG,KAAK,KAAK;EACf;CACF;CAEA,IAAI,KAAY;EACd,IAAM,IAAO,MAAM,KAAK,KAAK,GAAQ,IAAI;EAMzC,OAJI,KAAK,GAAQ,aACf,EAAK,QAAQ,KAAK,GAAQ,SAAS,GAG9B;CACT;CAEA,IAAI,KAAa;EACf,OAAO,CAAC,GAAG,MAAM,KAAK,KAAK,GAAQ,WAAW,CAAC,CAAC,GAAG,GAAG,MAAM,KAAK,KAAK,GAAQ,KAAK,CAAC;CACtF;CAEA,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,MAAM,gBAAgB;EACpB,MAAM,KAAK,KAAK,gBACX,KAAK,KAAK,gBAEf,KAAK,KAAQ,KAAK,GAAQ,MAC1B,EAAuB,KAAK,EAAU,GACtC,KAAK,GAAM,iBA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AS,EAAW,WAAiB;EAAE,IAAI;EAAG,IAAI;CAAE,IACjD;AACT;AAEA,SAAS,EACP,GACA,GACA,GACA;CACA,IAAM,EAAE,MAAG,SAAM,GACX,EAAE,gBAAa,aAAU,eAAY;CAS3C,OARI,MAAS,EAAW,MACf;EAAE,GAAG;EAAa,GAAG,IAAU,IAAW;CAAE,IAGjD,MAAS,EAAW,OACf;EAAE,GAAG;EAAG,GAAG,IAAU,IAAI;CAAE,IAG7B;EAAE;EAAG;CAAE;AAChB;AAEA,SAAgB,EACd,GACA,GACA,GACA;CACA,IAAM,IAAc,EAAM,MAAK,MAAK,EAAE,aAAa,CAAC,GAC9C,IAAa,EAAK,MAAK,MAAK,EAAoB,CAAC,CAAC,CAAC,MAAK,MAAK,MAAM,CAAW,CAAC,GAC/E,IAAkB,MAAM,KAAK,EAAoB,CAAU,CAAC,CAAC,CAAC,QAAO,MAAK,CAAC,CAAC,EAAM,MAAK,MAAK,MAAM,CAAC,CAAC,GACpG,IAAW,EAAK,SAAS,GACzB,IAAc,EAAgB,SAAS,GAEzC,IAAI,EAAgB,QAAQ,CAAW,GACvC,IAAI,EAAK,QAAQ,CAAU,GAEzB,IAAQ,EAAa,EAAO,MAAM,EAAO,GAAG;CAQlD,OAPI,KACF,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,GAAa,IAAI,EAAM,EAAE,CAAC,GACnD,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,GAAU,IAAI,EAAM,EAAE,CAAC,KAE/C,eAAW,EAAiB,EAAO,MAAM;EAAE;EAAG;CAAE,GAAG;EAAE;EAAa;EAAU,SAAS,EAAO;CAAQ,CAAC,GAGjG;EAAE;EAAG;CAAE;AAChB"}
|
|
1
|
+
{"version":3,"file":"keynav-grid.controller.js","names":[],"sources":["../../../src/internal/controllers/keynav-grid.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ReactiveController, ReactiveElement } from 'lit';\nimport type { LegacyDecoratorTarget } from '../types/index.js';\nimport { throttle } from '../utils/events.js';\nimport { GlobalStateService } from '../services/global.service.js';\nimport { LogService } from '../services/log.service.js';\nimport {\n validKeyNavigationCode,\n isContextMenuClick,\n getFlattenedDOMTree,\n getFlattenedFocusableItems,\n KeynavCode,\n hasInvalidDOMGrid\n} from '../utils/dom.js';\nimport { focusElement, getActiveElement, setActiveKeyListItem, isSimpleFocusable } from '../utils/focus.js';\n\nexport interface KeynavGridConfig {\n grid?: HTMLElement;\n columnRow?: HTMLElement;\n columns?: NodeListOf<HTMLElement> | HTMLElement[];\n rows: NodeListOf<HTMLElement> | HTMLElement[];\n cells: NodeListOf<HTMLElement> | HTMLElement[];\n}\n\nexport interface KeynavGridElement {\n keynavGridConfig: KeynavGridConfig;\n}\n\n/**\n * https://w3c.github.io/aria-practices/#gridNav_focus\n */\nexport function keyNavigationGrid<T extends ReactiveElement & KeynavGridElement>(): ClassDecorator {\n return (target: LegacyDecoratorTarget) =>\n target.addInitializer!((instance: T) => new KeyNavigationGridController(instance));\n}\n\nexport class KeyNavigationGridController<T extends ReactiveElement & KeynavGridElement> implements ReactiveController {\n #observer?: MutationObserver;\n #grid?: HTMLElement;\n #activeCell?: HTMLElement;\n #cells = new WeakSet<HTMLElement>();\n #updateCells = throttle(() => this.#initializeCells(), 500, { trailing: true });\n\n get #config() {\n return {\n grid: this.host,\n ...this.host.keynavGridConfig\n };\n }\n\n get #hostRows() {\n const rows = Array.from(this.#config.rows);\n\n if (this.#config.columnRow) {\n rows.unshift(this.#config.columnRow);\n }\n\n return rows;\n }\n\n get #hostCells() {\n const { columns, cells } = this.#config;\n return [...Array.from(columns ?? []), ...Array.from(cells)];\n }\n\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n async hostConnected() {\n await this.host.updateComplete;\n if (!this.host.isConnected) return;\n\n this.#grid = this.#config.grid;\n this.#initializeCells();\n this.#grid.addEventListener('keyup', this.#onKeyUp);\n this.#grid.addEventListener('keydown', this.#onKeyDown);\n this.#grid.addEventListener('mouseup', this.#onMouseUp);\n this.#observer?.disconnect();\n this.#observer = new MutationObserver(this.#onMutations);\n this.#observer.observe(this.#grid, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['tabindex']\n });\n }\n\n hostDisconnected() {\n this.#observer?.disconnect();\n this.#observer = undefined;\n this.#updateCells.cancel();\n this.#grid?.removeEventListener('keyup', this.#onKeyUp);\n this.#grid?.removeEventListener('keydown', this.#onKeyDown);\n this.#grid?.removeEventListener('mouseup', this.#onMouseUp);\n this.#grid = undefined;\n this.#activeCell = undefined;\n }\n\n #initializeCells() {\n const cells = this.#hostCells;\n const activeCell =\n cells.find(cell => cell.tabIndex === 0) ??\n (this.#activeCell && cells.includes(this.#activeCell) ? this.#activeCell : cells[0]);\n this.#activeCell = activeCell;\n this.#cells = new WeakSet(cells);\n for (const cell of cells) {\n const tabIndex = cell === activeCell ? '0' : '-1';\n // Avoid observing our own unchanged writes after a DOM morph or key change.\n if (cell.getAttribute('tabindex') !== tabIndex) {\n cell.setAttribute('tabindex', tabIndex);\n }\n }\n }\n\n #onMutations = (mutations: MutationRecord[]) => {\n const changed = mutations.some(mutation => {\n if (mutation.type === 'attributes') {\n const cell = mutation.target;\n // Ignore nested controls and our own tabindex writes.\n return (\n cell instanceof HTMLElement &&\n this.#cells.has(cell) &&\n cell.getAttribute('tabindex') !== (cell === this.#activeCell ? '0' : '-1')\n );\n }\n return [...mutation.addedNodes, ...mutation.removedNodes].some(node => node.nodeType === Node.ELEMENT_NODE);\n });\n if (changed) this.#updateCells();\n };\n\n #flushCellUpdates() {\n // A key event can arrive before the observer delivers a synchronous DOM update.\n this.#onMutations(this.#observer?.takeRecords() ?? []);\n this.#updateCells.flush();\n }\n\n #onMouseUp = (e: MouseEvent) => {\n if (!isContextMenuClick(e)) {\n this.#flushCellUpdates();\n const focusedElement = e.composedPath()[0] as HTMLElement;\n const activeCell = this.#hostCells.find(i => i === focusedElement) ? focusedElement : null;\n if (activeCell) {\n this.#setActiveCell(e, activeCell);\n }\n }\n };\n\n #onKeyDown = (e: KeyboardEvent) => {\n if (!validKeyNavigationCode(e)) return;\n this.#flushCellUpdates();\n const rows = Array.from(this.#hostRows);\n const cells = Array.from(this.#hostCells);\n\n if (GlobalStateService.state.env !== 'production' && hasInvalidDOMGrid(rows)) {\n LogService.warn('Invalid grid structure, all rows must have the same number of cells');\n return;\n }\n\n if (isSimpleFocusable(getActiveElement() as Element)) {\n const { x, y } = getNextKeyGridItem(cells, rows, {\n code: e.code,\n ctrlKey: e.ctrlKey,\n dir: this.host.dir\n });\n\n const nextCell = Array.from(getFlattenedDOMTree(rows[y]!)).filter(c => !!cells.find(i => i === c))[\n x\n ] as HTMLElement;\n this.#setActiveCell(e, nextCell);\n e.preventDefault();\n }\n };\n\n #setActiveCell(e: KeyboardEvent | MouseEvent, activeCell: HTMLElement) {\n this.#activeCell = activeCell;\n setActiveKeyListItem(this.#hostCells, activeCell);\n\n const items = getFlattenedFocusableItems(activeCell);\n const simpleItems = items.filter(i => isSimpleFocusable(i));\n\n if (simpleItems.length === 1 && items.length === 1) {\n focusElement(simpleItems[0]!);\n } else {\n focusElement(activeCell);\n }\n\n const detail = { code: e instanceof KeyboardEvent ? e.code : null, shiftKey: e.shiftKey, activeItem: activeCell };\n activeCell.dispatchEvent(new CustomEvent('nve-key-change', { bubbles: true, composed: true, detail }));\n }\n\n #onKeyUp = (e: KeyboardEvent) => {\n if (e.code !== 'Enter' && e.code !== 'Escape') return;\n this.#flushCellUpdates();\n const activeCell = Array.from(this.#hostCells).find(i => i.tabIndex === 0) as HTMLElement;\n if (e.code === 'Escape') {\n activeCell?.focus();\n }\n\n if (e.code === 'Enter' && activeCell === e.composedPath()[0]) {\n getFlattenedFocusableItems(activeCell)[0]?.focus();\n }\n };\n}\n\nfunction getGridDelta(code: KeynavCode | string, dir: string): { dx: number; dy: number } | null {\n const start = dir === 'rtl' ? KeynavCode.ArrowRight : KeynavCode.ArrowLeft;\n const end = dir === 'rtl' ? KeynavCode.ArrowLeft : KeynavCode.ArrowRight;\n\n if (code === KeynavCode.ArrowUp) return { dx: 0, dy: -1 };\n if (code === KeynavCode.ArrowDown) return { dx: 0, dy: 1 };\n if (code === start) return { dx: -1, dy: 0 };\n if (code === end) return { dx: 1, dy: 0 };\n if (code === KeynavCode.PageUp) return { dx: 0, dy: -4 };\n if (code === KeynavCode.PageDown) return { dx: 0, dy: 4 };\n return null;\n}\n\nfunction applyGridHomeEnd(\n code: KeynavCode | string,\n position: { x: number; y: number },\n bounds: { columnCount: number; rowCount: number; ctrlKey: boolean }\n) {\n const { x, y } = position;\n const { columnCount, rowCount, ctrlKey } = bounds;\n if (code === KeynavCode.End) {\n return { x: columnCount, y: ctrlKey ? rowCount : y };\n }\n\n if (code === KeynavCode.Home) {\n return { x: 0, y: ctrlKey ? 0 : y };\n }\n\n return { x, y };\n}\n\nexport function getNextKeyGridItem(\n cells: HTMLElement[],\n rows: HTMLElement[],\n config: { code: KeynavCode | string; ctrlKey: boolean; dir: string }\n) {\n const currentCell = cells.find(i => i.tabIndex === 0) as HTMLElement;\n const currentRow = rows.find(r => getFlattenedDOMTree(r).find(c => c === currentCell)) as HTMLElement;\n const currentRowCells = Array.from(getFlattenedDOMTree(currentRow)).filter(c => !!cells.find(i => i === c));\n const rowCount = rows.length - 1;\n const columnCount = currentRowCells.length - 1;\n\n let x = currentRowCells.indexOf(currentCell);\n let y = rows.indexOf(currentRow);\n\n const delta = getGridDelta(config.code, config.dir);\n if (delta) {\n x = Math.max(0, Math.min(columnCount, x + delta.dx));\n y = Math.max(0, Math.min(rowCount, y + delta.dy));\n } else {\n ({ x, y } = applyGridHomeEnd(config.code, { x, y }, { columnCount, rowCount, ctrlKey: config.ctrlKey }));\n }\n\n return { x, y };\n}\n"],"mappings":";;;;;;AAiCA,SAAgB,IAAmF;CACjG,QAAQ,MACN,EAAO,gBAAiB,MAAgB,IAAI,E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AAO,MAAM,EAAO,GAAG;CAQlD,OAPI,KACF,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,GAAa,IAAI,EAAM,EAAE,CAAC,GACnD,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,GAAU,IAAI,EAAM,EAAE,CAAC,KAE/C,eAAW,EAAiB,EAAO,MAAM;EAAE;EAAG;CAAE,GAAG;EAAE;EAAa;EAAU,SAAS,EAAO;CAAQ,CAAC,GAGjG;EAAE;EAAG;CAAE;AAChB"}
|
|
@@ -19,7 +19,7 @@ var a = class {
|
|
|
19
19
|
i18nRegistry: {},
|
|
20
20
|
audit: {}
|
|
21
21
|
}
|
|
22
|
-
}, globalThis.NVE_ELEMENTS.state.versions = Array.from(/* @__PURE__ */ new Set([...globalThis.NVE_ELEMENTS.state.versions, "2.
|
|
22
|
+
}, globalThis.NVE_ELEMENTS.state.versions = Array.from(/* @__PURE__ */ new Set([...globalThis.NVE_ELEMENTS.state.versions, "2.17.1"])), globalThis.NVE_ELEMENTS.state.scopedRegistry ??= {}, globalThis.NVE_ELEMENTS.state.scopedRegistry["2.17.1"] = i(), globalThis.NVE_ELEMENTS.state.versions.length > 1 && globalThis.NVE_ELEMENTS.state.env !== "production" && console.warn(e(), `\n\n${JSON.stringify(globalThis.NVE_ELEMENTS.state.versions, null, 2)}`);
|
|
23
23
|
}
|
|
24
24
|
get state() {
|
|
25
25
|
return globalThis.NVE_ELEMENTS.state;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/internal/styles/popover.css?inline
|
|
2
|
-
var e = ":host{--animation-duration: var(--nve-ref-animation-duration-200);margin:calc(var(--nve-sys-layer-popover-offset) + calc(var(--nve-sys-layer-popover-arrow-offset) * 2));border:0;padding:0;background:none;position:fixed;overflow:visible;contain:initial;width:max-content;z-index:99;inset:revert;interest-delay-start:.5s}:host([popover]){opacity:0;pointer-events:none}:host(:state(transition-start)){transition-duration:var(--animation-duration);transition-timing-function:ease-in-out;transition-property:opacity,display,overlay,translate,transform;transition-behavior:allow-discrete}@supports not (container-type: anchored){:host{--animation-duration: 0}}:host(:popover-open){opacity:1;pointer-events:initial;@starting-style{opacity:0}}:host(:not([nve-popover])),:host([defer-hydration]){opacity:0!important;pointer-events:none!important}[internal-host]{width:var(--width);min-width:var(--min-width);font-family:inherit;display:flex;flex-direction:column;overflow:visible;white-space:nowrap;z-index:9999;border:0;margin:0;user-select:text}@supports (position-area: bottom){[internal-host]{position:relative}.arrow{position-area:bottom;translate:0% 50%}:host([position=\"top\"]) .arrow{position-area:bottom;translate:0% 50%}:host([position=\"top\"][alignment=\"end\"]) .arrow{position-area:bottom right;translate:-50% 50%}:host([position=\"top\"][alignment=\"start\"]) .arrow{position-area:bottom left;translate:50% 50%}:host([position=\"bottom\"]) .arrow{position-area:top;translate:0% -50%}:host([position=\"bottom\"][alignment=\"end\"]) .arrow{position-area:top right;translate:-50% -50%}:host([position=\"bottom\"][alignment=\"start\"]) .arrow{position-area:top left;translate:50% -50%}:host([position=\"left\"]) .arrow{position-area:right;translate:50% 0%}:host([position=\"left\"][alignment=\"end\"]) .arrow{position-area:bottom right;translate:50% -50%}:host([position=\"left\"][alignment=\"start\"]) .arrow{position-area:top right;translate:50% 50%}:host([position=\"right\"]) .arrow{position-area:left;translate:-50% 0%}:host([position=\"right\"][alignment=\"end\"]) .arrow{position-area:bottom left;translate:-50% -50%}:host([position=\"right\"][alignment=\"start\"]) .arrow{position-area:top left;translate:-50% 50%}:host([position=\"center\"]){position-area:center}:host{inset:auto!important;place-self:normal!important;position-anchor:auto!important}:host([position=\"top\"]){position-area:top center}:host([position=\"top\"][alignment=\"start\"]){position-area:top left}:host([position=\"top\"][alignment=\"end\"]){position-area:top right}:host([position=\"top\"][alignment=\"start\"]){position-area:top span-right}:host([position=\"top\"][alignment=\"end\"]){position-area:top span-left}:host([position=\"bottom\"]){position-area:bottom center}:host([position=\"bottom\"][alignment=\"start\"]){position-area:bottom span-right}:host([position=\"bottom\"][alignment=\"end\"]){position-area:bottom span-left}:host([position=\"left\"]){position-area:left center}:host([position=\"left\"][alignment=\"end\"]){position-area:left span-top}:host([position=\"left\"][alignment=\"start\"]){position-area:left span-bottom}:host([position=\"right\"]){position-area:right center}:host([position=\"right\"][alignment=\"end\"]){position-area:right span-top}:host([position=\"right\"][alignment=\"start\"]){position-area:right span-bottom}:host([position=\"top\"]){position-try-fallbacks:top,bottom,left,right}:host([position=\"bottom\"]){position-try-fallbacks:bottom,top,left,right}:host([position=\"left\"]){position-try-fallbacks:left,right,top,bottom}:host([position=\"right\"]){position-try-fallbacks:right,left,top,bottom}}:host([position=\"center\"][alignment=\"center\"]){position-area:unset!important;margin:auto!important;inset:0!important}@supports (not selector(::search-text)) and (position-area: bottom){.arrow{translate:0% -50%}:host([position=\"top\"]) .arrow{translate:0% -50%}:host([position=\"top\"][alignment=\"end\"]) .arrow{translate:-150% -50%}:host([position=\"top\"][alignment=\"start\"]) .arrow{translate:150% -50%}:host([position=\"bottom\"]) .arrow{translate:0% 50%}:host([position=\"bottom\"][alignment=\"end\"]) .arrow{translate:-150% 50%}:host([position=\"bottom\"][alignment=\"start\"]) .arrow{translate:150% 50%}:host([position=\"left\"]) .arrow{translate:-50% 0%}:host([position=\"left\"][alignment=\"end\"]) .arrow{translate:-50% -150%}:host([position=\"left\"][alignment=\"start\"]) .arrow{translate:-50% 150%}:host([position=\"right\"]) .arrow{translate:50% 0%}:host([position=\"right\"][alignment=\"end\"]) .arrow{translate:50% -150%}:host([position=\"right\"][alignment=\"start\"]) .arrow{translate:50% 150%}}:host([popover][modal]):before{content:\" \";display:block;inset:0;z-index:99;position:fixed}";
|
|
2
|
+
var e = ":host{--animation-duration: var(--nve-ref-animation-duration-200);margin:calc(var(--nve-sys-layer-popover-offset) + calc(var(--nve-sys-layer-popover-arrow-offset) * 2));border:0;padding:0;background:none;position:fixed;overflow:visible;contain:initial;width:max-content;z-index:99;inset:revert;interest-delay-start:.5s}:host([popover]){opacity:0;pointer-events:none}:host([popover]:not(:popover-open)){display:none!important}:host(:state(transition-start)){transition-duration:var(--animation-duration);transition-timing-function:ease-in-out;transition-property:opacity,display,overlay,translate,transform;transition-behavior:allow-discrete}@supports not (container-type: anchored){:host{--animation-duration: 0}}:host(:popover-open){opacity:1;pointer-events:initial;@starting-style{opacity:0}}:host(:not([nve-popover])),:host([defer-hydration]){opacity:0!important;pointer-events:none!important}[internal-host]{width:var(--width);min-width:var(--min-width);font-family:inherit;display:flex;flex-direction:column;overflow:visible;white-space:nowrap;z-index:9999;border:0;margin:0;user-select:text}@supports (position-area: bottom){[internal-host]{position:relative}.arrow{position-area:bottom;translate:0% 50%}:host([position=\"top\"]) .arrow{position-area:bottom;translate:0% 50%}:host([position=\"top\"][alignment=\"end\"]) .arrow{position-area:bottom right;translate:-50% 50%}:host([position=\"top\"][alignment=\"start\"]) .arrow{position-area:bottom left;translate:50% 50%}:host([position=\"bottom\"]) .arrow{position-area:top;translate:0% -50%}:host([position=\"bottom\"][alignment=\"end\"]) .arrow{position-area:top right;translate:-50% -50%}:host([position=\"bottom\"][alignment=\"start\"]) .arrow{position-area:top left;translate:50% -50%}:host([position=\"left\"]) .arrow{position-area:right;translate:50% 0%}:host([position=\"left\"][alignment=\"end\"]) .arrow{position-area:bottom right;translate:50% -50%}:host([position=\"left\"][alignment=\"start\"]) .arrow{position-area:top right;translate:50% 50%}:host([position=\"right\"]) .arrow{position-area:left;translate:-50% 0%}:host([position=\"right\"][alignment=\"end\"]) .arrow{position-area:bottom left;translate:-50% -50%}:host([position=\"right\"][alignment=\"start\"]) .arrow{position-area:top left;translate:-50% 50%}:host([position=\"center\"]){position-area:center}:host{inset:auto!important;place-self:normal!important;position-anchor:auto!important}:host([position=\"top\"]){position-area:top center}:host([position=\"top\"][alignment=\"start\"]){position-area:top left}:host([position=\"top\"][alignment=\"end\"]){position-area:top right}:host([position=\"top\"][alignment=\"start\"]){position-area:top span-right}:host([position=\"top\"][alignment=\"end\"]){position-area:top span-left}:host([position=\"bottom\"]){position-area:bottom center}:host([position=\"bottom\"][alignment=\"start\"]){position-area:bottom span-right}:host([position=\"bottom\"][alignment=\"end\"]){position-area:bottom span-left}:host([position=\"left\"]){position-area:left center}:host([position=\"left\"][alignment=\"end\"]){position-area:left span-top}:host([position=\"left\"][alignment=\"start\"]){position-area:left span-bottom}:host([position=\"right\"]){position-area:right center}:host([position=\"right\"][alignment=\"end\"]){position-area:right span-top}:host([position=\"right\"][alignment=\"start\"]){position-area:right span-bottom}:host([position=\"top\"]){position-try-fallbacks:top,bottom,left,right}:host([position=\"bottom\"]){position-try-fallbacks:bottom,top,left,right}:host([position=\"left\"]){position-try-fallbacks:left,right,top,bottom}:host([position=\"right\"]){position-try-fallbacks:right,left,top,bottom}}:host([position=\"center\"][alignment=\"center\"]){position-area:unset!important;margin:auto!important;inset:0!important}@supports (not selector(::search-text)) and (position-area: bottom){.arrow{translate:0% -50%}:host([position=\"top\"]) .arrow{translate:0% -50%}:host([position=\"top\"][alignment=\"end\"]) .arrow{translate:-150% -50%}:host([position=\"top\"][alignment=\"start\"]) .arrow{translate:150% -50%}:host([position=\"bottom\"]) .arrow{translate:0% 50%}:host([position=\"bottom\"][alignment=\"end\"]) .arrow{translate:-150% 50%}:host([position=\"bottom\"][alignment=\"start\"]) .arrow{translate:150% 50%}:host([position=\"left\"]) .arrow{translate:-50% 0%}:host([position=\"left\"][alignment=\"end\"]) .arrow{translate:-50% -150%}:host([position=\"left\"][alignment=\"start\"]) .arrow{translate:-50% 150%}:host([position=\"right\"]) .arrow{translate:50% 0%}:host([position=\"right\"][alignment=\"end\"]) .arrow{translate:50% -150%}:host([position=\"right\"][alignment=\"start\"]) .arrow{translate:50% 150%}}:host([popover][modal]):before{content:\" \";display:block;inset:0;z-index:99;position:fixed}";
|
|
3
3
|
//#endregion
|
|
4
4
|
export { e as default };
|
|
5
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","names":[],"sources":["../../../src/internal/styles/popover.css?inline"],"sourcesContent":["/* SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */\n/* SPDX-License-Identifier: Apache-2.0 */\n\n:host {\n --animation-duration: var(--nve-ref-animation-duration-200);\n margin: calc(var(--nve-sys-layer-popover-offset) + calc(var(--nve-sys-layer-popover-arrow-offset) * 2));\n border: 0;\n padding: 0;\n background: none;\n position: fixed;\n overflow: visible;\n contain: initial;\n width: max-content;\n z-index: 99;\n inset: revert;\n interest-delay-start: 0.5s;\n}\n\n:host([popover]) {\n opacity: 0;\n pointer-events: none;\n}\n\n/* apply transitions during beforetoggle event to prevent flash of unstyled popover on page load */\n:host(:state(transition-start)) {\n transition-duration: var(--animation-duration);\n transition-timing-function: ease-in-out;\n transition-property: opacity, display, overlay, translate, transform;\n transition-behavior: allow-discrete;\n}\n\n/** workaround for Safari / Firefox which do not respect transitions on implicit anchor positioning */\n@supports not (container-type: anchored) {\n :host {\n --animation-duration: 0;\n }\n}\n\n:host(:popover-open) {\n opacity: 1;\n pointer-events: initial;\n\n @starting-style {\n opacity: 0;\n }\n}\n\n/* lit SSR ensure popovers are not visible until hydration has happened */\n:host(:not([nve-popover])),\n:host([defer-hydration]) {\n opacity: 0 !important;\n pointer-events: none !important;\n}\n\n[internal-host] {\n width: var(--width);\n min-width: var(--min-width);\n font-family: inherit;\n display: flex;\n flex-direction: column;\n overflow: visible;\n white-space: nowrap;\n z-index: 9999;\n border: 0;\n margin: 0;\n user-select: text;\n}\n\n@supports (position-area: bottom) {\n [internal-host] {\n position: relative;\n }\n\n .arrow {\n position-area: bottom;\n translate: 0% 50%;\n }\n\n :host([position='top']) .arrow {\n position-area: bottom;\n translate: 0% 50%;\n }\n\n :host([position='top'][alignment='end']) .arrow {\n position-area: bottom right;\n translate: -50% 50%;\n }\n\n :host([position='top'][alignment='start']) .arrow {\n position-area: bottom left;\n translate: 50% 50%;\n }\n\n :host([position='bottom']) .arrow {\n position-area: top;\n translate: 0% -50%;\n }\n\n :host([position='bottom'][alignment='end']) .arrow {\n position-area: top right;\n translate: -50% -50%;\n }\n\n :host([position='bottom'][alignment='start']) .arrow {\n position-area: top left;\n translate: 50% -50%;\n }\n\n :host([position='left']) .arrow {\n position-area: right;\n translate: 50% 0%;\n }\n\n :host([position='left'][alignment='end']) .arrow {\n position-area: bottom right;\n translate: 50% -50%;\n }\n\n :host([position='left'][alignment='start']) .arrow {\n position-area: top right;\n translate: 50% 50%;\n }\n\n :host([position='right']) .arrow {\n position-area: left;\n translate: -50% 0%;\n }\n\n :host([position='right'][alignment='end']) .arrow {\n position-area: bottom left;\n translate: -50% -50%;\n }\n\n :host([position='right'][alignment='start']) .arrow {\n position-area: top left;\n translate: -50% 50%;\n }\n\n /** positioning */\n :host([position='center']) {\n position-area: center;\n }\n\n :host {\n inset: auto !important;\n place-self: normal !important;\n\n /*\n * This line is critical for shadow root positioning and auto anchor association\n * https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Anchor_positioning/Using#implicit_anchor_association\n */\n position-anchor: auto !important;\n }\n\n /** top */\n :host([position='top']) {\n position-area: top center;\n }\n\n :host([position='top'][alignment='start']) {\n position-area: top left;\n }\n\n :host([position='top'][alignment='end']) {\n position-area: top right;\n }\n\n :host([position='top'][alignment='start']) {\n position-area: top span-right;\n }\n\n :host([position='top'][alignment='end']) {\n position-area: top span-left;\n }\n\n /** bottom */\n :host([position='bottom']) {\n position-area: bottom center;\n }\n\n :host([position='bottom'][alignment='start']) {\n position-area: bottom span-right;\n }\n\n :host([position='bottom'][alignment='end']) {\n position-area: bottom span-left;\n }\n\n /** left */\n :host([position='left']) {\n position-area: left center;\n }\n\n :host([position='left'][alignment='end']) {\n position-area: left span-top;\n }\n\n :host([position='left'][alignment='start']) {\n position-area: left span-bottom;\n }\n\n /** right */\n :host([position='right']) {\n position-area: right center;\n }\n\n :host([position='right'][alignment='end']) {\n position-area: right span-top;\n }\n\n :host([position='right'][alignment='start']) {\n position-area: right span-bottom;\n }\n\n :host([position='top']) {\n position-try-fallbacks: top, bottom, left, right;\n }\n\n :host([position='bottom']) {\n position-try-fallbacks: bottom, top, left, right;\n }\n\n :host([position='left']) {\n position-try-fallbacks: left, right, top, bottom;\n }\n\n :host([position='right']) {\n position-try-fallbacks: right, left, top, bottom;\n }\n}\n\n:host([position='center'][alignment='center']) {\n position-area: unset !important;\n margin: auto !important;\n inset: 0 !important;\n}\n\n/*\n * Remove the following @supports block after Chrome 145 is stable.\n * This is to compensate for a change in Chrome 144 for how anchor positioning with transforms works.\n * https://developer.chrome.com/blog/chrome-144-beta#css_anchor_positioning_with_transforms\n * https://x.com/una/status/1995538970223018004\n * \n * The (not selector(::search-text)) selector is used to target Chrome 143 and below.\n */\n@supports (not selector(::search-text)) and (position-area: bottom) {\n .arrow {\n translate: 0% -50%;\n }\n\n :host([position='top']) .arrow {\n translate: 0% -50%;\n }\n\n :host([position='top'][alignment='end']) .arrow {\n translate: -150% -50%;\n }\n\n :host([position='top'][alignment='start']) .arrow {\n translate: 150% -50%;\n }\n\n :host([position='bottom']) .arrow {\n translate: 0% 50%;\n }\n\n :host([position='bottom'][alignment='end']) .arrow {\n translate: -150% 50%;\n }\n\n :host([position='bottom'][alignment='start']) .arrow {\n translate: 150% 50%;\n }\n\n :host([position='left']) .arrow {\n translate: -50% 0%;\n }\n\n :host([position='left'][alignment='end']) .arrow {\n translate: -50% -150%;\n }\n\n :host([position='left'][alignment='start']) .arrow {\n translate: -50% 150%;\n }\n\n :host([position='right']) .arrow {\n translate: 50% 0%;\n }\n\n :host([position='right'][alignment='end']) .arrow {\n translate: 50% -150%;\n }\n\n :host([position='right'][alignment='start']) .arrow {\n translate: 50% 150%;\n }\n}\n\n:host([popover][modal])::before {\n content: ' ';\n display: block;\n inset: 0;\n z-index: 99;\n position: fixed;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"popover.js","names":[],"sources":["../../../src/internal/styles/popover.css?inline"],"sourcesContent":["/* SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */\n/* SPDX-License-Identifier: Apache-2.0 */\n\n:host {\n --animation-duration: var(--nve-ref-animation-duration-200);\n margin: calc(var(--nve-sys-layer-popover-offset) + calc(var(--nve-sys-layer-popover-arrow-offset) * 2));\n border: 0;\n padding: 0;\n background: none;\n position: fixed;\n overflow: visible;\n contain: initial;\n width: max-content;\n z-index: 99;\n inset: revert;\n interest-delay-start: 0.5s;\n}\n\n:host([popover]) {\n opacity: 0;\n pointer-events: none;\n}\n\n/* Closed popovers must not retain layout boxes from host display styles. */\n:host([popover]:not(:popover-open)) {\n display: none !important;\n}\n\n/* apply transitions during beforetoggle event to prevent flash of unstyled popover on page load */\n:host(:state(transition-start)) {\n transition-duration: var(--animation-duration);\n transition-timing-function: ease-in-out;\n transition-property: opacity, display, overlay, translate, transform;\n transition-behavior: allow-discrete;\n}\n\n/** workaround for Safari / Firefox which do not respect transitions on implicit anchor positioning */\n@supports not (container-type: anchored) {\n :host {\n --animation-duration: 0;\n }\n}\n\n:host(:popover-open) {\n opacity: 1;\n pointer-events: initial;\n\n @starting-style {\n opacity: 0;\n }\n}\n\n/* lit SSR ensure popovers are not visible until hydration has happened */\n:host(:not([nve-popover])),\n:host([defer-hydration]) {\n opacity: 0 !important;\n pointer-events: none !important;\n}\n\n[internal-host] {\n width: var(--width);\n min-width: var(--min-width);\n font-family: inherit;\n display: flex;\n flex-direction: column;\n overflow: visible;\n white-space: nowrap;\n z-index: 9999;\n border: 0;\n margin: 0;\n user-select: text;\n}\n\n@supports (position-area: bottom) {\n [internal-host] {\n position: relative;\n }\n\n .arrow {\n position-area: bottom;\n translate: 0% 50%;\n }\n\n :host([position='top']) .arrow {\n position-area: bottom;\n translate: 0% 50%;\n }\n\n :host([position='top'][alignment='end']) .arrow {\n position-area: bottom right;\n translate: -50% 50%;\n }\n\n :host([position='top'][alignment='start']) .arrow {\n position-area: bottom left;\n translate: 50% 50%;\n }\n\n :host([position='bottom']) .arrow {\n position-area: top;\n translate: 0% -50%;\n }\n\n :host([position='bottom'][alignment='end']) .arrow {\n position-area: top right;\n translate: -50% -50%;\n }\n\n :host([position='bottom'][alignment='start']) .arrow {\n position-area: top left;\n translate: 50% -50%;\n }\n\n :host([position='left']) .arrow {\n position-area: right;\n translate: 50% 0%;\n }\n\n :host([position='left'][alignment='end']) .arrow {\n position-area: bottom right;\n translate: 50% -50%;\n }\n\n :host([position='left'][alignment='start']) .arrow {\n position-area: top right;\n translate: 50% 50%;\n }\n\n :host([position='right']) .arrow {\n position-area: left;\n translate: -50% 0%;\n }\n\n :host([position='right'][alignment='end']) .arrow {\n position-area: bottom left;\n translate: -50% -50%;\n }\n\n :host([position='right'][alignment='start']) .arrow {\n position-area: top left;\n translate: -50% 50%;\n }\n\n /** positioning */\n :host([position='center']) {\n position-area: center;\n }\n\n :host {\n inset: auto !important;\n place-self: normal !important;\n\n /*\n * This line is critical for shadow root positioning and auto anchor association\n * https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Anchor_positioning/Using#implicit_anchor_association\n */\n position-anchor: auto !important;\n }\n\n /** top */\n :host([position='top']) {\n position-area: top center;\n }\n\n :host([position='top'][alignment='start']) {\n position-area: top left;\n }\n\n :host([position='top'][alignment='end']) {\n position-area: top right;\n }\n\n :host([position='top'][alignment='start']) {\n position-area: top span-right;\n }\n\n :host([position='top'][alignment='end']) {\n position-area: top span-left;\n }\n\n /** bottom */\n :host([position='bottom']) {\n position-area: bottom center;\n }\n\n :host([position='bottom'][alignment='start']) {\n position-area: bottom span-right;\n }\n\n :host([position='bottom'][alignment='end']) {\n position-area: bottom span-left;\n }\n\n /** left */\n :host([position='left']) {\n position-area: left center;\n }\n\n :host([position='left'][alignment='end']) {\n position-area: left span-top;\n }\n\n :host([position='left'][alignment='start']) {\n position-area: left span-bottom;\n }\n\n /** right */\n :host([position='right']) {\n position-area: right center;\n }\n\n :host([position='right'][alignment='end']) {\n position-area: right span-top;\n }\n\n :host([position='right'][alignment='start']) {\n position-area: right span-bottom;\n }\n\n :host([position='top']) {\n position-try-fallbacks: top, bottom, left, right;\n }\n\n :host([position='bottom']) {\n position-try-fallbacks: bottom, top, left, right;\n }\n\n :host([position='left']) {\n position-try-fallbacks: left, right, top, bottom;\n }\n\n :host([position='right']) {\n position-try-fallbacks: right, left, top, bottom;\n }\n}\n\n:host([position='center'][alignment='center']) {\n position-area: unset !important;\n margin: auto !important;\n inset: 0 !important;\n}\n\n/*\n * Remove the following @supports block after Chrome 145 is stable.\n * This is to compensate for a change in Chrome 144 for how anchor positioning with transforms works.\n * https://developer.chrome.com/blog/chrome-144-beta#css_anchor_positioning_with_transforms\n * https://x.com/una/status/1995538970223018004\n * \n * The (not selector(::search-text)) selector is used to target Chrome 143 and below.\n */\n@supports (not selector(::search-text)) and (position-area: bottom) {\n .arrow {\n translate: 0% -50%;\n }\n\n :host([position='top']) .arrow {\n translate: 0% -50%;\n }\n\n :host([position='top'][alignment='end']) .arrow {\n translate: -150% -50%;\n }\n\n :host([position='top'][alignment='start']) .arrow {\n translate: 150% -50%;\n }\n\n :host([position='bottom']) .arrow {\n translate: 0% 50%;\n }\n\n :host([position='bottom'][alignment='end']) .arrow {\n translate: -150% 50%;\n }\n\n :host([position='bottom'][alignment='start']) .arrow {\n translate: 150% 50%;\n }\n\n :host([position='left']) .arrow {\n translate: -50% 0%;\n }\n\n :host([position='left'][alignment='end']) .arrow {\n translate: -50% -150%;\n }\n\n :host([position='left'][alignment='start']) .arrow {\n translate: -50% 150%;\n }\n\n :host([position='right']) .arrow {\n translate: 50% 0%;\n }\n\n :host([position='right'][alignment='end']) .arrow {\n translate: 50% -150%;\n }\n\n :host([position='right'][alignment='start']) .arrow {\n translate: 50% 150%;\n }\n}\n\n:host([popover][modal])::before {\n content: ' ';\n display: block;\n inset: 0;\n z-index: 99;\n position: fixed;\n}\n"],"mappings":""}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export declare function stopEvent(event: Event): void;
|
|
2
2
|
export declare function onChildListMutation(element: HTMLElement, fn: (mutation?: MutationRecord) => void, options?: MutationObserverInit): MutationObserver;
|
|
3
|
-
export declare function throttle(func: (...args:
|
|
3
|
+
export declare function throttle<Args extends unknown[]>(func: (...args: Args) => void, limit: number, { trailing }?: {
|
|
4
|
+
trailing?: boolean;
|
|
5
|
+
}): ((...args: Args) => void) & {
|
|
6
|
+
flush(): void;
|
|
7
|
+
cancel(): void;
|
|
8
|
+
};
|
|
4
9
|
export declare function debounce(func: (...args: unknown[]) => void, timeout?: number): (...args: unknown[]) => void;
|
|
@@ -11,11 +11,29 @@ function t(e, t, n = {}) {
|
|
|
11
11
|
...n
|
|
12
12
|
}), r;
|
|
13
13
|
}
|
|
14
|
-
function n(e, t) {
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
function n(e, t, { trailing: n = !1 } = {}) {
|
|
15
|
+
let r, i, a = (...o) => {
|
|
16
|
+
if (r !== void 0) {
|
|
17
|
+
n && (i = o);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
e(...o), r = setTimeout(() => {
|
|
21
|
+
if (r = void 0, i) {
|
|
22
|
+
let e = i;
|
|
23
|
+
i = void 0, a(...e);
|
|
24
|
+
}
|
|
25
|
+
}, t);
|
|
18
26
|
};
|
|
27
|
+
return Object.assign(a, {
|
|
28
|
+
flush() {
|
|
29
|
+
if (!i) return;
|
|
30
|
+
let t = i;
|
|
31
|
+
i = void 0, e(...t);
|
|
32
|
+
},
|
|
33
|
+
cancel() {
|
|
34
|
+
clearTimeout(r), r = void 0, i = void 0;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
19
37
|
}
|
|
20
38
|
function r(e, t = 0) {
|
|
21
39
|
let n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","names":[],"sources":["../../../src/internal/utils/events.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function stopEvent(event: Event) {\n event?.preventDefault();\n event?.stopPropagation();\n}\n\nexport function onChildListMutation(\n element: HTMLElement,\n fn: (mutation?: MutationRecord) => void,\n options: MutationObserverInit = {}\n) {\n const observer = new MutationObserver(mutations => {\n for (const mutation of mutations) {\n if (mutation.type === 'childList') {\n fn(mutation);\n }\n\n if (options.attributes && mutation.type === 'attributes') {\n fn(mutation);\n }\n }\n });\n observer.observe(element, { childList: true, ...options });\n return observer;\n}\n\nexport function throttle(func: (...args:
|
|
1
|
+
{"version":3,"file":"events.js","names":[],"sources":["../../../src/internal/utils/events.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function stopEvent(event: Event) {\n event?.preventDefault();\n event?.stopPropagation();\n}\n\nexport function onChildListMutation(\n element: HTMLElement,\n fn: (mutation?: MutationRecord) => void,\n options: MutationObserverInit = {}\n) {\n const observer = new MutationObserver(mutations => {\n for (const mutation of mutations) {\n if (mutation.type === 'childList') {\n fn(mutation);\n }\n\n if (options.attributes && mutation.type === 'attributes') {\n fn(mutation);\n }\n }\n });\n observer.observe(element, { childList: true, ...options });\n return observer;\n}\n\nexport function throttle<Args extends unknown[]>(\n func: (...args: Args) => void,\n limit: number,\n { trailing = false }: { trailing?: boolean } = {}\n) {\n let timer: ReturnType<typeof setTimeout> | undefined;\n let pending: Args | undefined;\n\n const throttled = (...args: Args): void => {\n if (timer !== undefined) {\n if (trailing) pending = args;\n return;\n }\n\n func(...args);\n timer = setTimeout(() => {\n timer = undefined;\n if (pending) {\n const nextArgs = pending;\n pending = undefined;\n throttled(...nextArgs);\n }\n }, limit);\n };\n\n return Object.assign(throttled, {\n flush() {\n if (!pending) return;\n const args = pending;\n pending = undefined;\n func(...args);\n },\n cancel() {\n clearTimeout(timer);\n timer = undefined;\n pending = undefined;\n }\n });\n}\n\nexport function debounce(func: (...args: unknown[]) => void, timeout = 0) {\n let timer: ReturnType<typeof setTimeout> | undefined;\n return (...args: unknown[]) => {\n clearTimeout(timer);\n /* istanbul ignore next */\n timer = setTimeout(() => {\n func(...args);\n }, timeout);\n };\n}\n"],"mappings":";AAGA,SAAgB,EAAU,GAAc;CAEtC,AADA,GAAO,eAAe,GACtB,GAAO,gBAAgB;AACzB;AAEA,SAAgB,EACd,GACA,GACA,IAAgC,CAAC,GACjC;CACA,IAAM,IAAW,IAAI,kBAAiB,MAAa;EACjD,KAAK,IAAM,KAAY,GAKrB,AAJI,EAAS,SAAS,eACpB,EAAG,CAAQ,GAGT,EAAQ,cAAc,EAAS,SAAS,gBAC1C,EAAG,CAAQ;CAGjB,CAAC;CAED,OADA,EAAS,QAAQ,GAAS;EAAE,WAAW;EAAM,GAAG;CAAQ,CAAC,GAClD;AACT;AAEA,SAAgB,EACd,GACA,GACA,EAAE,cAAW,OAAkC,CAAC,GAChD;CACA,IAAI,GACA,GAEE,KAAa,GAAG,MAAqB;EACzC,IAAI,MAAU,KAAA,GAAW;GACvB,AAAI,MAAU,IAAU;GACxB;EACF;EAGA,AADA,EAAK,GAAG,CAAI,GACZ,IAAQ,iBAAiB;GAEvB,IADA,IAAQ,KAAA,GACJ,GAAS;IACX,IAAM,IAAW;IAEjB,AADA,IAAU,KAAA,GACV,EAAU,GAAG,CAAQ;GACvB;EACF,GAAG,CAAK;CACV;CAEA,OAAO,OAAO,OAAO,GAAW;EAC9B,QAAQ;GACN,IAAI,CAAC,GAAS;GACd,IAAM,IAAO;GAEb,AADA,IAAU,KAAA,GACV,EAAK,GAAG,CAAI;EACd;EACA,SAAS;GAGP,AAFA,aAAa,CAAK,GAClB,IAAQ,KAAA,GACR,IAAU,KAAA;EACZ;CACF,CAAC;AACH;AAEA,SAAgB,EAAS,GAAoC,IAAU,GAAG;CACxE,IAAI;CACJ,QAAQ,GAAG,MAAoB;;EAG7B,AAFA,aAAa,CAAK,GAElB,IAAQ,iBAAiB;GACvB,EAAK,GAAG,CAAI;EACd,GAAG,CAAO;CACZ;AACF"}
|
package/dist/logo/logo2.js
CHANGED
package/dist/menu/menu-group2.js
CHANGED
package/dist/menu/menu-item2.js
CHANGED
package/dist/menu/menu2.js
CHANGED
package/dist/month/month2.js
CHANGED
package/dist/page/page2.js
CHANGED
package/dist/panel/panel2.js
CHANGED
|
@@ -21,7 +21,7 @@ var g = class extends f {
|
|
|
21
21
|
static {
|
|
22
22
|
this.metadata = {
|
|
23
23
|
tag: "nve-panel-header",
|
|
24
|
-
version: "2.
|
|
24
|
+
version: "2.17.1"
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
render() {
|
|
@@ -37,7 +37,7 @@ var g = class extends f {
|
|
|
37
37
|
static {
|
|
38
38
|
this.metadata = {
|
|
39
39
|
tag: "nve-panel-content",
|
|
40
|
-
version: "2.
|
|
40
|
+
version: "2.17.1"
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
render() {
|
|
@@ -50,7 +50,7 @@ var g = class extends f {
|
|
|
50
50
|
static {
|
|
51
51
|
this.metadata = {
|
|
52
52
|
tag: "nve-panel-footer",
|
|
53
|
-
version: "2.
|
|
53
|
+
version: "2.17.1"
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
render() {
|
|
@@ -69,7 +69,7 @@ var g = class extends f {
|
|
|
69
69
|
static {
|
|
70
70
|
this.metadata = {
|
|
71
71
|
tag: "nve-panel",
|
|
72
|
-
version: "2.
|
|
72
|
+
version: "2.17.1"
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
static {
|