@nvidia-elements/core 2.21.0 → 2.21.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 +6 -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 +2 -2
- package/dist/bundles/index.js +12 -12
- 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/combobox.d.ts +1 -0
- package/dist/combobox/combobox2.js +80 -70
- package/dist/combobox/combobox2.js.map +1 -1
- package/dist/copy-button/copy-button2.js +1 -1
- package/dist/custom-elements-jsx.d.ts +1 -1
- package/dist/custom-elements-vue.d.ts +1 -1
- package/dist/custom-elements.json +3 -3
- package/dist/data.html.json +1 -1
- 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.js +1 -1
- package/dist/dropdown/dropdown.js.map +1 -1
- package/dist/dropdown/dropdown2.js +2 -2
- package/dist/dropdown/dropdown2.js.map +1 -1
- package/dist/dropdown-group/dropdown-group.d.ts +1 -1
- package/dist/dropdown-group/dropdown-group.examples.js.map +1 -1
- package/dist/dropdown-group/dropdown-group.examples.json +11 -0
- package/dist/dropdown-group/dropdown-group.js +55 -25
- package/dist/dropdown-group/dropdown-group.js.map +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 +35 -34
- package/dist/format-truncate/format-truncate2.js.map +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-button2.js +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/type-native-popover.controller.d.ts +0 -1
- package/dist/internal/controllers/type-native-popover.controller.js.map +1 -1
- package/dist/internal/controllers/type-native-popover.utils.d.ts +0 -1
- package/dist/internal/controllers/type-native-popover.utils.js +1 -1
- package/dist/internal/controllers/type-native-popover.utils.js.map +1 -1
- package/dist/internal/styles/popover.js +1 -1
- package/dist/internal/styles/popover.js.map +1 -1
- package/dist/joystick/joystick2.js +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 +45 -32
- package/dist/select/select2.js.map +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/tabs-item-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-header2.js +1 -1
- package/dist/toggletip/toggletip.js +1 -1
- package/dist/toggletip/toggletip.js.map +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 +43 -8
|
@@ -9,7 +9,7 @@ import { property as u } from "lit/decorators/property.js";
|
|
|
9
9
|
// src/format-truncate/format-truncate.ts
|
|
10
10
|
var d = class extends c {
|
|
11
11
|
constructor(...e) {
|
|
12
|
-
super(...e), this.position = "start", this.strategy = "character", this.bias = "end", this.preserve = 6, this.#
|
|
12
|
+
super(...e), this.position = "start", this.strategy = "character", this.bias = "end", this.preserve = 6, this.#r = Infinity, this.#u = () => {
|
|
13
13
|
this.requestUpdate();
|
|
14
14
|
};
|
|
15
15
|
}
|
|
@@ -19,71 +19,76 @@ var d = class extends c {
|
|
|
19
19
|
static {
|
|
20
20
|
this.metadata = {
|
|
21
21
|
tag: "nve-format-truncate",
|
|
22
|
-
version: "2.21.
|
|
22
|
+
version: "2.21.1"
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
#e;
|
|
26
26
|
#t;
|
|
27
|
+
#n;
|
|
28
|
+
#r;
|
|
27
29
|
connectedCallback() {
|
|
28
|
-
super.connectedCallback(), e(this), this.#
|
|
30
|
+
super.connectedCallback(), e(this), this.#r = Infinity, this.#l(), this.requestUpdate();
|
|
29
31
|
}
|
|
30
32
|
disconnectedCallback() {
|
|
31
|
-
super.disconnectedCallback(), this.#t?.disconnect();
|
|
33
|
+
super.disconnectedCallback(), this.#t?.disconnect(), this.#n !== void 0 && this.ownerDocument.defaultView?.cancelAnimationFrame(this.#n), this.#n = void 0;
|
|
32
34
|
}
|
|
33
35
|
connectedMoveCallback() {
|
|
34
|
-
this.#
|
|
36
|
+
this.#r = Infinity, this.#l(), this.requestUpdate();
|
|
35
37
|
}
|
|
36
38
|
render() {
|
|
37
|
-
let e = this.#
|
|
38
|
-
return t === e ? this.removeAttribute("title") : this.title = e, l`<span internal-host aria-hidden="true">${t}</span><span sizing-host aria-hidden="true">${e}</span><slot @slotchange="${this.#
|
|
39
|
+
let e = this.#i, t = this.#a(e);
|
|
40
|
+
return t === e ? this.removeAttribute("title") : this.title !== e && (this.title = e), l`<span internal-host aria-hidden="true">${t}</span><span sizing-host aria-hidden="true">${e}</span><slot @slotchange="${this.#u}"></slot>`;
|
|
39
41
|
}
|
|
40
|
-
get #
|
|
42
|
+
get #i() {
|
|
41
43
|
let e = this.shadowRoot?.querySelector("slot:not([name])");
|
|
42
44
|
if (e) return a(e.assignedNodes({ flatten: !0 }));
|
|
43
|
-
let t = Array.from(this.childNodes ?? []).filter(
|
|
45
|
+
let t = Array.from(this.childNodes ?? []).filter(p);
|
|
44
46
|
return t.length ? a(t) : i(this.textContent ?? "");
|
|
45
47
|
}
|
|
46
|
-
#
|
|
47
|
-
let t = this.#
|
|
48
|
+
#a(e) {
|
|
49
|
+
let t = this.#o();
|
|
48
50
|
return o(e, {
|
|
49
51
|
position: this.position,
|
|
50
52
|
strategy: this.strategy,
|
|
51
53
|
bias: this.bias,
|
|
52
54
|
preserve: this.preserve,
|
|
53
|
-
availableWidth: this.#
|
|
55
|
+
availableWidth: this.#r,
|
|
54
56
|
measureText: t
|
|
55
57
|
});
|
|
56
58
|
}
|
|
57
|
-
|
|
58
|
-
let e = this.ownerDocument?.defaultView;
|
|
59
|
-
return !e || !this.shadowRoot?.querySelector("[internal-host]") ? Infinity : f(this, e);
|
|
60
|
-
}
|
|
61
|
-
#a() {
|
|
62
|
-
let e = this.ownerDocument?.defaultView, t = this.#s;
|
|
59
|
+
#o() {
|
|
60
|
+
let e = this.ownerDocument?.defaultView, t = this.#c;
|
|
63
61
|
if (!e || !t) return () => 0;
|
|
64
62
|
let n = e.getComputedStyle(this);
|
|
65
63
|
t.font = n.font;
|
|
66
|
-
let r =
|
|
67
|
-
return (e) => this.#
|
|
64
|
+
let r = f(n.letterSpacing), i = f(n.wordSpacing), a = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
65
|
+
return (e) => this.#s(e, {
|
|
68
66
|
context: t,
|
|
69
67
|
letterSpacing: r,
|
|
70
68
|
wordSpacing: i,
|
|
71
69
|
graphemeSegmenter: a
|
|
72
70
|
});
|
|
73
71
|
}
|
|
74
|
-
#
|
|
72
|
+
#s(e, { context: t, letterSpacing: n, wordSpacing: r, graphemeSegmenter: i }) {
|
|
75
73
|
let a = i.segment(e), o = Array.from(e.matchAll(/\s/gu)).length;
|
|
76
74
|
return t.measureText(e).width + Math.max(0, Array.from(a).length - 1) * n + o * r;
|
|
77
75
|
}
|
|
78
|
-
get #
|
|
76
|
+
get #c() {
|
|
79
77
|
return this.#e === void 0 && (this.#e = this.ownerDocument?.createElement("canvas").getContext("2d") ?? null), this.#e;
|
|
80
78
|
}
|
|
81
|
-
#
|
|
82
|
-
typeof ResizeObserver < "u" && (this.#t ??= new ResizeObserver(() => {
|
|
83
|
-
|
|
79
|
+
#l() {
|
|
80
|
+
typeof ResizeObserver < "u" && (this.#t ??= new ResizeObserver((e) => {
|
|
81
|
+
let t = e[0];
|
|
82
|
+
if (this.isConnected && t) {
|
|
83
|
+
this.#r = t.contentRect.width;
|
|
84
|
+
let e = this.ownerDocument.defaultView;
|
|
85
|
+
e && this.#n === void 0 && (this.#n = e.requestAnimationFrame(() => {
|
|
86
|
+
this.#n = void 0, this.isConnected && this.requestUpdate();
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
84
89
|
}), this.#t.disconnect(), this.#t.observe(this));
|
|
85
90
|
}
|
|
86
|
-
#
|
|
91
|
+
#u;
|
|
87
92
|
};
|
|
88
93
|
r([u({
|
|
89
94
|
type: String,
|
|
@@ -98,18 +103,14 @@ r([u({
|
|
|
98
103
|
type: Number,
|
|
99
104
|
reflect: !0
|
|
100
105
|
})], d.prototype, "preserve", void 0), d = r([t()], d);
|
|
101
|
-
function f(e
|
|
102
|
-
let n = t.getComputedStyle(e);
|
|
103
|
-
return Math.max(0, e.getBoundingClientRect().width - p(n.borderInlineStartWidth) - p(n.borderInlineEndWidth) - p(n.paddingInlineStart) - p(n.paddingInlineEnd));
|
|
104
|
-
}
|
|
105
|
-
function p(e) {
|
|
106
|
+
function f(e) {
|
|
106
107
|
let t = Number.parseFloat(e);
|
|
107
108
|
return Number.isFinite(t) ? t : 0;
|
|
108
109
|
}
|
|
109
|
-
function
|
|
110
|
-
return !
|
|
110
|
+
function p(e) {
|
|
111
|
+
return !m(e) || !e.getAttribute("slot");
|
|
111
112
|
}
|
|
112
|
-
function
|
|
113
|
+
function m(e) {
|
|
113
114
|
return e.nodeType === 1;
|
|
114
115
|
}
|
|
115
116
|
export { d as FormatTruncate };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-truncate2.js","names":["styles","_decorate","__decorate","format_truncate_default","FormatTruncate","LitElement","_args","#onSlotChange","useStyles","attachInternals","#observeAvailableWidth","#resizeObserver","text","#slottedText","truncatedText","#renderText","slot","normalizeTruncateText","nodes","isDefaultSlotNode","normalizeTruncateString","measureText","#createTextMeasurer","truncateText","#availableWidth","view","getContentWidth","context","#textMeasurementContext","computedStyles","letterSpacing","cssPixelValue","wordSpacing","graphemeSegmenter","#measureText","graphemeSegments","whitespaceCount","#measurementContext","property","typeSSR","element","parsed","value","isElementNode","node"],"sources":["../../src/format-truncate/format-truncate.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { TemplateResult } from 'lit';\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { attachInternals, useStyles, typeSSR } from '@nvidia-elements/core/internal';\nimport { normalizeTruncateString, normalizeTruncateText, truncateText } from './utils.js';\nimport styles from './format-truncate.css?inline';\n\n/**\n * @element nve-format-truncate\n * @description Truncates text at its start, center, or end while preserving the full text for assistive technology.\n * @documentation https://nvidia.github.io/elements/docs/elements/format-truncate/\n * @since 0.0.0\n * @entrypoint \\@nvidia-elements/core/format-truncate\n * @slot - Text to truncate. The component flattens, trims, and normalizes mixed text and element nodes.\n * @beta\n */\n@typeSSR()\nexport class FormatTruncate extends LitElement {\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-format-truncate',\n version: '0.0.0'\n };\n\n /**\n * Location of the ellipsis. Use start or end to preserve one edge, or center to preserve both edges.\n */\n @property({ type: String, reflect: true }) position: 'start' | 'center' | 'end' = 'start';\n\n /**\n * Text unit used for center truncation. Character preserves graphemes, word preserves words, and path preserves path segments.\n */\n @property({ type: String, reflect: true }) strategy: 'character' | 'word' | 'path' = 'character';\n\n /**\n * Edge favored by center truncation. The favored edge keeps at least the configured number of units.\n */\n @property({ type: String, reflect: true }) bias: 'start' | 'end' = 'end';\n\n /**\n * Number of strategy units retained at the biased edge during center truncation.\n */\n @property({ type: Number, reflect: true }) preserve = 6;\n\n /** @private */\n declare _internals: ElementInternals;\n\n #measurementContext?: CanvasRenderingContext2D | null;\n #resizeObserver?: ResizeObserver;\n\n override connectedCallback(): void {\n super.connectedCallback();\n attachInternals(this);\n this.#observeAvailableWidth();\n this.requestUpdate();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.#resizeObserver?.disconnect();\n }\n\n connectedMoveCallback(): void {\n this.#observeAvailableWidth();\n this.requestUpdate();\n }\n\n override render(): TemplateResult {\n const text = this.#slottedText;\n const truncatedText = this.#renderText(text);\n\n if (truncatedText !== text) this.title = text;\n else this.removeAttribute('title');\n\n return html`<span internal-host aria-hidden=\"true\">${truncatedText}</span><span sizing-host aria-hidden=\"true\">${text}</span><slot @slotchange=${this.#onSlotChange}></slot>`;\n }\n\n get #slottedText(): string {\n const slot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot:not([name])');\n if (slot) return normalizeTruncateText(slot.assignedNodes({ flatten: true }));\n\n const nodes = Array.from(this.childNodes ?? []).filter(isDefaultSlotNode);\n return nodes.length ? normalizeTruncateText(nodes) : normalizeTruncateString(this.textContent ?? '');\n }\n\n #renderText(text: string): string {\n const measureText = this.#createTextMeasurer();\n\n return truncateText(text, {\n position: this.position,\n strategy: this.strategy,\n bias: this.bias,\n preserve: this.preserve,\n availableWidth: this.#availableWidth,\n measureText\n });\n }\n\n get #availableWidth(): number {\n const view = this.ownerDocument?.defaultView;\n if (!view || !this.shadowRoot?.querySelector('[internal-host]')) return Number.POSITIVE_INFINITY;\n\n return getContentWidth(this, view);\n }\n\n #createTextMeasurer(): (text: string) => number {\n const view = this.ownerDocument?.defaultView;\n const context = this.#textMeasurementContext;\n if (!view || !context) return () => 0;\n\n const computedStyles = view.getComputedStyle(this);\n context.font = computedStyles.font;\n\n const letterSpacing = cssPixelValue(computedStyles.letterSpacing);\n const wordSpacing = cssPixelValue(computedStyles.wordSpacing);\n const graphemeSegmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme' });\n\n return text => this.#measureText(text, { context, letterSpacing, wordSpacing, graphemeSegmenter });\n }\n\n #measureText(\n text: string,\n {\n context,\n letterSpacing,\n wordSpacing,\n graphemeSegmenter\n }: {\n context: CanvasRenderingContext2D;\n letterSpacing: number;\n wordSpacing: number;\n graphemeSegmenter: Intl.Segmenter;\n }\n ): number {\n const graphemeSegments = graphemeSegmenter.segment(text);\n const whitespaceCount = Array.from(text.matchAll(/\\s/gu)).length;\n\n return (\n context.measureText(text).width +\n Math.max(0, Array.from(graphemeSegments).length - 1) * letterSpacing +\n whitespaceCount * wordSpacing\n );\n }\n\n get #textMeasurementContext(): CanvasRenderingContext2D | null {\n if (this.#measurementContext === undefined) {\n this.#measurementContext = this.ownerDocument?.createElement('canvas').getContext('2d') ?? null;\n }\n\n return this.#measurementContext;\n }\n\n #observeAvailableWidth(): void {\n if (typeof ResizeObserver === 'undefined') return;\n\n this.#resizeObserver ??= new ResizeObserver(() => {\n if (this.isConnected) this.requestUpdate();\n });\n this.#resizeObserver.disconnect();\n this.#resizeObserver.observe(this);\n }\n\n #onSlotChange = (): void => {\n this.requestUpdate();\n };\n}\n\nfunction getContentWidth(element: HTMLElement, view: Window): number {\n const computedStyles = view.getComputedStyle(element);\n return Math.max(\n 0,\n element.getBoundingClientRect().width -\n cssPixelValue(computedStyles.borderInlineStartWidth) -\n cssPixelValue(computedStyles.borderInlineEndWidth) -\n cssPixelValue(computedStyles.paddingInlineStart) -\n cssPixelValue(computedStyles.paddingInlineEnd)\n );\n}\n\nfunction cssPixelValue(value: string): number {\n const parsed = Number.parseFloat(value);\n return Number.isFinite(parsed) ? parsed : 0;\n}\n\nfunction isDefaultSlotNode(node: Node): boolean {\n return !isElementNode(node) || !node.getAttribute('slot');\n}\n\nfunction isElementNode(node: Node): node is Element {\n return node.nodeType === 1;\n}\n"],"mappings":";;;;;;;;;AAoBO,IAAMI,IAAN,cAA6BC,EAAW;;EAkJjB,A,aAvIsD,KAAA,WAAA,SAKG,KAAA,WAAA,aAKlB,KAAA,OAAA,OAKb,KAAA,WAAA,GAwH1B,KAAAE,WAAA;GAC1B,KAAK,cAAc;EACrB;;;EAnJgB,KAAA,SAAAC,EAAU,CAACR,CAAM,CAAC;;;EAEP,KAAA,WAAA;GACzB,KAAK;GACL,SAAS;EACX;;CAyBA;CACA;CAEA,oBAAmC;EAIjC,AAHA,MAAM,kBAAkB,GACxBS,EAAgB,IAAI,GACpB,KAAKC,GAAuB,GAC5B,KAAK,cAAc;CACrB;CAEA,uBAAsC;EAEpC,AADA,MAAM,qBAAqB,GAC3B,KAAKC,IAAiB,WAAW;CACnC;CAEA,wBAA8B;EAE5B,AADA,KAAKD,GAAuB,GAC5B,KAAK,cAAc;CACrB;CAEA,SAAkC;EAChC,IAAME,IAAO,KAAKC,IACZC,IAAgB,KAAKC,GAAYH,CAAI;EAK3C,OAHIE,MAAkBF,IACjB,KAAK,gBAAgB,OAAO,IADL,KAAK,QAAQA,GAGlC,CAAI,0CAA0CE,EAAc,8CAA8CF,EAAK,4BAA2B,KAAKL,GAAc;CAC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EAAe,gBAAgB,CACjD;AACF;AAEA,SAASE,EAAc,GAAuB;CAC5C,IAAMU,IAAS,OAAO,WAAWC,CAAK;CACtC,OAAO,OAAO,SAASD,CAAM,IAAIA,IAAS;AAC5C;AAEA,SAAStB,EAAkB,GAAqB;CAC9C,OAAO,CAACwB,EAAcC,CAAI,KAAK,CAACA,EAAK,aAAa,MAAM;AAC1D;AAEA,SAASD,EAAc,GAA6B;CAClD,OAAOC,EAAK,aAAa;AAC3B"}
|
|
1
|
+
{"version":3,"file":"format-truncate2.js","names":["styles","_decorate","__decorate","format_truncate_default","FormatTruncate","LitElement","_args","#availableWidth","#onSlotChange","useStyles","attachInternals","#observeAvailableWidth","#resizeObserver","#resizeFrame","text","#slottedText","truncatedText","#renderText","slot","normalizeTruncateText","nodes","isDefaultSlotNode","normalizeTruncateString","measureText","#createTextMeasurer","truncateText","view","context","#textMeasurementContext","computedStyles","letterSpacing","cssPixelValue","wordSpacing","graphemeSegmenter","#measureText","graphemeSegments","whitespaceCount","#measurementContext","entry","entries","property","typeSSR","parsed","value","isElementNode","node"],"sources":["../../src/format-truncate/format-truncate.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { TemplateResult } from 'lit';\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { attachInternals, useStyles, typeSSR } from '@nvidia-elements/core/internal';\nimport { normalizeTruncateString, normalizeTruncateText, truncateText } from './utils.js';\nimport styles from './format-truncate.css?inline';\n\n/**\n * @element nve-format-truncate\n * @description Truncates text at its start, center, or end while preserving the full text for assistive technology.\n * @documentation https://nvidia.github.io/elements/docs/elements/format-truncate/\n * @since 0.0.0\n * @entrypoint \\@nvidia-elements/core/format-truncate\n * @slot - Text to truncate. The component flattens, trims, and normalizes mixed text and element nodes.\n * @beta\n */\n@typeSSR()\nexport class FormatTruncate extends LitElement {\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-format-truncate',\n version: '0.0.0'\n };\n\n /**\n * Location of the ellipsis. Use start or end to preserve one edge, or center to preserve both edges.\n */\n @property({ type: String, reflect: true }) position: 'start' | 'center' | 'end' = 'start';\n\n /**\n * Text unit used for center truncation. Character preserves graphemes, word preserves words, and path preserves path segments.\n */\n @property({ type: String, reflect: true }) strategy: 'character' | 'word' | 'path' = 'character';\n\n /**\n * Edge favored by center truncation. The favored edge keeps at least the configured number of units.\n */\n @property({ type: String, reflect: true }) bias: 'start' | 'end' = 'end';\n\n /**\n * Number of strategy units retained at the biased edge during center truncation.\n */\n @property({ type: Number, reflect: true }) preserve = 6;\n\n /** @private */\n declare _internals: ElementInternals;\n\n #measurementContext?: CanvasRenderingContext2D | null;\n #resizeObserver?: ResizeObserver;\n #resizeFrame?: number;\n #availableWidth = Number.POSITIVE_INFINITY;\n\n override connectedCallback(): void {\n super.connectedCallback();\n attachInternals(this);\n this.#availableWidth = Number.POSITIVE_INFINITY;\n this.#observeAvailableWidth();\n this.requestUpdate();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.#resizeObserver?.disconnect();\n if (this.#resizeFrame !== undefined) this.ownerDocument.defaultView?.cancelAnimationFrame(this.#resizeFrame);\n this.#resizeFrame = undefined;\n }\n\n connectedMoveCallback(): void {\n this.#availableWidth = Number.POSITIVE_INFINITY;\n this.#observeAvailableWidth();\n this.requestUpdate();\n }\n\n override render(): TemplateResult {\n const text = this.#slottedText;\n const truncatedText = this.#renderText(text);\n\n if (truncatedText !== text) {\n if (this.title !== text) this.title = text;\n } else this.removeAttribute('title');\n\n return html`<span internal-host aria-hidden=\"true\">${truncatedText}</span><span sizing-host aria-hidden=\"true\">${text}</span><slot @slotchange=${this.#onSlotChange}></slot>`;\n }\n\n get #slottedText(): string {\n const slot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot:not([name])');\n if (slot) return normalizeTruncateText(slot.assignedNodes({ flatten: true }));\n\n const nodes = Array.from(this.childNodes ?? []).filter(isDefaultSlotNode);\n return nodes.length ? normalizeTruncateText(nodes) : normalizeTruncateString(this.textContent ?? '');\n }\n\n #renderText(text: string): string {\n const measureText = this.#createTextMeasurer();\n\n return truncateText(text, {\n position: this.position,\n strategy: this.strategy,\n bias: this.bias,\n preserve: this.preserve,\n availableWidth: this.#availableWidth,\n measureText\n });\n }\n\n #createTextMeasurer(): (text: string) => number {\n const view = this.ownerDocument?.defaultView;\n const context = this.#textMeasurementContext;\n if (!view || !context) return () => 0;\n\n const computedStyles = view.getComputedStyle(this);\n context.font = computedStyles.font;\n\n const letterSpacing = cssPixelValue(computedStyles.letterSpacing);\n const wordSpacing = cssPixelValue(computedStyles.wordSpacing);\n const graphemeSegmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme' });\n\n return text => this.#measureText(text, { context, letterSpacing, wordSpacing, graphemeSegmenter });\n }\n\n #measureText(\n text: string,\n {\n context,\n letterSpacing,\n wordSpacing,\n graphemeSegmenter\n }: {\n context: CanvasRenderingContext2D;\n letterSpacing: number;\n wordSpacing: number;\n graphemeSegmenter: Intl.Segmenter;\n }\n ): number {\n const graphemeSegments = graphemeSegmenter.segment(text);\n const whitespaceCount = Array.from(text.matchAll(/\\s/gu)).length;\n\n return (\n context.measureText(text).width +\n Math.max(0, Array.from(graphemeSegments).length - 1) * letterSpacing +\n whitespaceCount * wordSpacing\n );\n }\n\n get #textMeasurementContext(): CanvasRenderingContext2D | null {\n if (this.#measurementContext === undefined) {\n this.#measurementContext = this.ownerDocument?.createElement('canvas').getContext('2d') ?? null;\n }\n\n return this.#measurementContext;\n }\n\n #observeAvailableWidth(): void {\n if (typeof ResizeObserver === 'undefined') return;\n\n this.#resizeObserver ??= new ResizeObserver(entries => {\n const entry = entries[0];\n if (this.isConnected && entry) {\n // Content-box measurements avoid synchronous geometry reads between sibling Lit updates.\n this.#availableWidth = entry.contentRect.width;\n const view = this.ownerDocument.defaultView;\n if (view && this.#resizeFrame === undefined) {\n this.#resizeFrame = view.requestAnimationFrame(() => {\n this.#resizeFrame = undefined;\n if (this.isConnected) this.requestUpdate();\n });\n }\n }\n });\n this.#resizeObserver.disconnect();\n this.#resizeObserver.observe(this);\n }\n\n #onSlotChange = (): void => {\n this.requestUpdate();\n };\n}\n\nfunction cssPixelValue(value: string): number {\n const parsed = Number.parseFloat(value);\n return Number.isFinite(parsed) ? parsed : 0;\n}\n\nfunction isDefaultSlotNode(node: Node): boolean {\n return !isElementNode(node) || !node.getAttribute('slot');\n}\n\nfunction isElementNode(node: Node): node is Element {\n return node.nodeType === 1;\n}\n"],"mappings":";;;;;;;;;AAoBO,IAAMI,IAAN,cAA6BC,EAAW;;EA6JjB,A,aAlJsD,KAAA,WAAA,SAKG,KAAA,WAAA,aAKlB,KAAA,OAAA,OAKb,KAAA,WAAA,GAQpC,KAAAE,KAAA,UA2HU,KAAAC,WAAA;GAC1B,KAAK,cAAc;EACrB;;;EA9JgB,KAAA,SAAAC,EAAU,CAACT,CAAM,CAAC;;;EAEP,KAAA,WAAA;GACzB,KAAK;GACL,SAAS;EACX;;CAyBA;CACA;CACA;CACA;CAEA,oBAAmC;EAKjC,AAJA,MAAM,kBAAkB,GACxBU,EAAgB,IAAI,GACpB,KAAKH,KAAkB,UACvB,KAAKI,GAAuB,GAC5B,KAAK,cAAc;CACrB;CAEA,uBAAsC;EAIpC,AAHA,MAAM,qBAAqB,GAC3B,KAAKC,IAAiB,WAAW,GAC7B,KAAKC,OAAiB,KAAA,KAAW,KAAK,cAAc,aAAa,qBAAqB,KAAKA,EAAY,GAC3G,KAAKA,KAAe,KAAA;CACtB;CAEA,wBAA8B;EAG5B,AAFA,KAAKN,KAAkB,UACvB,KAAKI,GAAuB,GAC5B,KAAK,cAAc;CACrB;CAEA,SAAkC;EAChC,IAAMG,IAAO,KAAKC,IACZC,IAAgB,KAAKC,GAAYH,CAAI;EAM3C,OAJIE,MAAkBF,IAEf,KAAK,gBAAgB,OAAO,IAD7B,KAAK,UAAUA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C,CAAK;CACtC,OAAO,OAAO,SAASD,CAAM,IAAIA,IAAS;AAC5C;AAEA,SAASrB,EAAkB,GAAqB;CAC9C,OAAO,CAACuB,EAAcC,CAAI,KAAK,CAACA,EAAK,aAAa,MAAM;AAC1D;AAEA,SAASD,EAAc,GAA6B;CAClD,OAAOC,EAAK,aAAa;AAC3B"}
|
package/dist/gauge/gauge2.js
CHANGED
package/dist/grid/cell/cell2.js
CHANGED
package/dist/grid/grid2.js
CHANGED
package/dist/grid/row/row2.js
CHANGED
package/dist/icon/icon2.js
CHANGED
|
@@ -16,7 +16,7 @@ var f = class n extends o {
|
|
|
16
16
|
static {
|
|
17
17
|
this.metadata = {
|
|
18
18
|
tag: "nve-icon",
|
|
19
|
-
version: "2.21.
|
|
19
|
+
version: "2.21.1"
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
static {
|
|
@@ -103,7 +103,7 @@ a([l({
|
|
|
103
103
|
})], f.prototype, "name", void 0), a([d()], f.prototype, "svg", void 0);
|
|
104
104
|
function p(e) {
|
|
105
105
|
if (typeof globalThis.customElements?.get == "function") {
|
|
106
|
-
let t = n(e.metadata.version), i = n("2.21.
|
|
106
|
+
let t = n(e.metadata.version), i = n("2.21.1");
|
|
107
107
|
t.minor <= i.minor && t.major <= i.major && (e._icons = {
|
|
108
108
|
...e._icons,
|
|
109
109
|
...r
|
package/dist/iframe/iframe2.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { getThemeTokens as e } from "./internal/utils/dom.js";
|
|
|
2
2
|
import { statusIcons as t } from "./internal/types/index.js";
|
|
3
3
|
import { internal_exports as n } from "./internal/index.js";
|
|
4
4
|
// src/index.ts
|
|
5
|
-
var r = "2.21.
|
|
5
|
+
var r = "2.21.1", i = "@nvidia-elements", a = n.I18nService;
|
|
6
6
|
export { a as I18nService, i as SCOPE, r as VERSION, e as getThemeTokens, t as statusIcons };
|
|
7
7
|
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
package/dist/input/input2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-native-popover.controller.js","names":["TypeNativePopoverController","#nativeTriggers","root","popoverTargetTriggers","commandForTriggers","interestForTriggers","host","showPopover","source","options","getHostAnchor","getHostTrigger","attachInternals","#updateLegacyTriggers","#setupLegacyTriggers","#setupModalLightDismiss","#onBeforeToggle","#onToggle","#onCommand","#onInterest","#onLoseInterest","#observers","observer","#onPointerDown","#onPointerUp","#removeHintTrigger","#clearInterestTimeout","#clearCloseTimeout","#closeTimeout","#interestTimeout","raw","value","#legacyHostTrigger","r","trigger","#previousLegacyTrigger","#clearLegacyTrigger","#hintTrigger","#setupHintTrigger","#setupPopoverTargetTrigger","#onHintMouseEnter","#onHintMouseLeave","generateId","open","focusElement","target","#setCloseTimeout","#toggleFocus","interestDelayStart","#parseInterestDelay","#pointerdownWithinModal","clickOutsideElementBounds","hasOpenPopover"],"sources":["../../../src/internal/controllers/type-native-popover.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 { clickOutsideElementBounds, generateId } from '../utils/dom.js';\nimport { attachInternals } from '../utils/a11y.js';\nimport { focusElement } from '../utils/focus.js';\nimport { getHostAnchor, getHostTrigger, hasOpenPopover } from './type-native-popover.utils.js';\nimport type { InterestEvent, PopoverType } from '../types/index.js';\n\nexport interface NativePopover extends ReactiveElement {\n anchor?: HTMLElement | string;\n closeTimeout?: number;\n popoverType?: PopoverType;\n modal?: boolean;\n popoverDismissible?: boolean;\n _activeTrigger?: HTMLElement;\n _internals?: ElementInternals;\n\n /** @deprecated */\n trigger?: HTMLElement | string;\n /** @deprecated */\n openDelay?: number;\n /** @deprecated */\n behaviorTrigger?: boolean;\n}\n\n/**\n * https://open-ui.org/components/popup.research.explainer\n */\nexport class TypeNativePopoverController<T extends NativePopover> implements ReactiveController {\n get #nativeTriggers(): HTMLElement[] {\n const root = this.host.getRootNode() as HTMLElement;\n const popoverTargetTriggers = Array.from(\n root.querySelectorAll(`[popovertarget=\"${CSS.escape ? CSS.escape(this.host.id) : this.host.id}\"]`)\n ) as HTMLElement[];\n\n const commandForTriggers = Array.from(\n root.querySelectorAll(`[commandfor=\"${CSS.escape ? CSS.escape(this.host.id) : this.host.id}\"]`)\n ) as HTMLElement[];\n\n const interestForTriggers = Array.from(\n root.querySelectorAll(`[interestfor=\"${CSS.escape ? CSS.escape(this.host.id) : this.host.id}\"]`)\n ) as HTMLElement[];\n\n return [...popoverTargetTriggers, ...commandForTriggers, ...interestForTriggers];\n }\n\n constructor(private host: T) {\n this.host.addController(this);\n\n const showPopover = this.host.showPopover;\n this.host.showPopover = (options?: ShowPopoverOptions) => {\n if (this.host.isConnected) {\n // provide legacy fallback for source anchor or trigger if not provided, this can happen if the popover is dynamically created in the DOM without the use of the standard popover api or legacy trigger based api\n let source: HTMLElement | Element | null = options?.source ?? null;\n if (!source) {\n if (this.host.anchor) {\n source = getHostAnchor(this.host);\n } else if (this.host.trigger) {\n source = getHostTrigger(this.host, this.host.trigger);\n } else {\n source = globalThis.document.activeElement;\n }\n }\n\n showPopover.call(this.host, { source: source as HTMLElement });\n }\n };\n }\n\n async hostConnected() {\n attachInternals(this.host);\n this.host.popover = this.host.popoverType ?? null;\n await this.host.updateComplete;\n if (!this.host.isConnected) return;\n\n this.host.setAttribute('nve-popover', '');\n this.#updateLegacyTriggers();\n this.#setupLegacyTriggers(); // eslint-disable-line @typescript-eslint/no-floating-promises\n this.#setupModalLightDismiss();\n this.host.inert = this.host.matches(':not(:popover-open)') && !!this.#nativeTriggers.length;\n\n this.host.addEventListener('beforetoggle', this.#onBeforeToggle);\n this.host.addEventListener('toggle', this.#onToggle as EventListener);\n this.host.addEventListener('command', this.#onCommand as EventListener);\n this.host.addEventListener('interest', this.#onInterest as EventListener);\n this.host.addEventListener('loseinterest', this.#onLoseInterest as EventListener);\n }\n\n #interestTimeout: ReturnType<typeof setTimeout> | null = null;\n #closeTimeout: ReturnType<typeof setTimeout> | null = null;\n #observers: MutationObserver[] = [];\n #previousLegacyTrigger: HTMLButtonElement | null = null;\n #hintTrigger: HTMLButtonElement | null = null;\n\n async hostUpdated() {\n this.host.popover = this.host.popoverType ?? null;\n this.#updateLegacyTriggers();\n }\n\n hostDisconnected() {\n this.#observers.forEach(observer => observer.disconnect());\n this.#observers.length = 0;\n this.host.removeEventListener('beforetoggle', this.#onBeforeToggle);\n this.host.removeEventListener('toggle', this.#onToggle as EventListener);\n this.host.removeEventListener('command', this.#onCommand as EventListener);\n this.host.removeEventListener('interest', this.#onInterest as EventListener);\n this.host.removeEventListener('loseinterest', this.#onLoseInterest as EventListener);\n this.host.removeEventListener('pointerdown', this.#onPointerDown);\n this.host.removeEventListener('pointerup', this.#onPointerUp);\n this.#removeHintTrigger();\n this.#clearInterestTimeout();\n this.#clearCloseTimeout();\n }\n\n #setCloseTimeout() {\n this.#clearCloseTimeout();\n if (this.host.closeTimeout) {\n this.#closeTimeout = setTimeout(() => this.host.hidePopover(), this.host.closeTimeout);\n }\n }\n\n #clearCloseTimeout() {\n if (this.#closeTimeout) {\n clearTimeout(this.#closeTimeout);\n this.#closeTimeout = null;\n }\n }\n\n #clearInterestTimeout() {\n if (this.#interestTimeout) {\n clearTimeout(this.#interestTimeout);\n this.#interestTimeout = null;\n }\n }\n\n #parseInterestDelay(): number {\n const style = getComputedStyle(this.host);\n const raw = (style as unknown as { interestDelayStart: string }).interestDelayStart;\n if (!raw) {\n return 0;\n }\n const value = parseFloat(raw);\n return raw.endsWith('ms') ? value : value * 1000;\n }\n\n #pointerdownWithinModal = false;\n\n #setupModalLightDismiss() {\n this.host.removeEventListener('pointerdown', this.#onPointerDown);\n this.host.removeEventListener('pointerup', this.#onPointerUp);\n this.host.addEventListener('pointerdown', this.#onPointerDown);\n this.host.addEventListener('pointerup', this.#onPointerUp);\n }\n\n get #legacyHostTrigger(): HTMLElement | null {\n return this.host.trigger ? (getHostTrigger(this.host, this.host.trigger) as HTMLButtonElement) : null;\n }\n\n /**\n * @deprecated Legacy behavior that allows popovers to show as open by default when using the legacy trigger based api\n */\n async #setupLegacyTriggers() {\n await new Promise(r => requestAnimationFrame(r));\n\n // setup host hidden updates for legacy triggers\n const observer = new MutationObserver(() => {\n if (this.host.isConnected && !this.host.hidden && !this.host.matches(':popover-open')) {\n this.host.showPopover();\n }\n\n if (this.host.isConnected && this.host.hidden && this.host.matches(':popover-open')) {\n this.host.hidePopover();\n }\n });\n observer.observe(this.host, { attributes: true, attributeFilter: ['hidden'] });\n this.#observers.push(observer);\n\n // determine if popover is open by default\n if (\n this.host.isConnected &&\n !this.#nativeTriggers.length &&\n !this.host.hidden &&\n !this.host.matches(':popover-open')\n ) {\n this.host.popover = 'manual';\n this.host.showPopover();\n }\n }\n\n /**\n * @deprecated Legacy behavior that allows popovers to show as open by default when using the legacy trigger based api\n */\n #updateLegacyTriggers() {\n const trigger = this.#legacyHostTrigger as HTMLButtonElement;\n\n if (this.#previousLegacyTrigger && this.#previousLegacyTrigger !== trigger) {\n this.#clearLegacyTrigger(this.#previousLegacyTrigger);\n }\n\n if (this.#hintTrigger && this.#hintTrigger !== trigger) {\n this.#removeHintTrigger();\n }\n\n if (!trigger) {\n this.#previousLegacyTrigger = null;\n return;\n }\n\n if (this.host.popoverType === 'hint') {\n this.#setupHintTrigger(trigger);\n } else {\n this.#setupPopoverTargetTrigger(trigger);\n }\n this.#previousLegacyTrigger = trigger;\n }\n\n #setupHintTrigger(trigger: HTMLButtonElement) {\n if (this.#hintTrigger === trigger) return;\n\n trigger.addEventListener('mouseenter', this.#onHintMouseEnter);\n trigger.addEventListener('mouseleave', this.#onHintMouseLeave);\n trigger.addEventListener('focusout', this.#onHintMouseLeave);\n this.#hintTrigger = trigger;\n }\n\n #setupPopoverTargetTrigger(trigger: HTMLButtonElement) {\n this.#removeHintTrigger();\n this.host.id = this.host.id ? this.host.id : generateId();\n trigger.popoverTargetElement = this.host;\n trigger.setAttribute('popovertarget', this.host.id);\n }\n\n #toggleFocus(open: boolean, target: HTMLElement) {\n if (open) {\n // only focus popover if not the active element and not containing the active element already\n if ((this.host.getRootNode() as Document).activeElement !== this.host && !this.host.shadowRoot!.activeElement) {\n focusElement(this.host);\n }\n } else {\n focusElement(target);\n }\n }\n\n #clearLegacyTrigger(trigger: HTMLButtonElement) {\n trigger.popoverTargetElement = null;\n trigger.removeAttribute('popovertarget');\n if (this.#hintTrigger === trigger) {\n this.#removeHintTrigger();\n }\n }\n\n #removeHintTrigger() {\n this.#hintTrigger?.removeEventListener('mouseenter', this.#onHintMouseEnter);\n this.#hintTrigger?.removeEventListener('mouseleave', this.#onHintMouseLeave);\n this.#hintTrigger?.removeEventListener('focusout', this.#onHintMouseLeave);\n this.#hintTrigger = null;\n }\n\n #onBeforeToggle = (e: ToggleEvent) => {\n if (e.newState === 'open') {\n this.host._internals!.states.add('transition-start');\n }\n };\n\n #onToggle = (e: ToggleEvent) => {\n if (this.host.behaviorTrigger) {\n this.host.hidden = e.newState === 'closed';\n }\n\n if (e.newState === 'open' && this.host.closeTimeout) {\n this.#setCloseTimeout();\n }\n\n if (e.newState === 'closed') {\n this.#clearInterestTimeout();\n this.#clearCloseTimeout();\n }\n\n this.host.inert = this.host.matches(':not(:popover-open)');\n\n if (this.host.modal) {\n this.#toggleFocus(e.newState === 'open', e.target as HTMLElement);\n }\n\n this.host.dispatchEvent(\n new CustomEvent(e.newState === 'open' && e.oldState !== 'open' ? 'open' : 'close', {\n bubbles: true,\n composed: true,\n detail: { trigger: e.source }\n })\n );\n };\n\n #onCommand = (e: CommandEvent) => {\n if (e.command === 'toggle-popover') {\n this.host.togglePopover({ source: e.source as HTMLElement });\n }\n\n if (e.command === 'hide-popover') {\n this.host.hidePopover();\n this.#clearInterestTimeout();\n }\n\n if (e.command === 'show-popover') {\n this.host.showPopover({ source: e.source as HTMLElement });\n }\n };\n\n #onInterest = (e: InterestEvent) => {\n const isCustomElement = e.source?.localName.includes('-');\n if (isCustomElement) {\n const interestDelayStart = this.host.openDelay ?? this.#parseInterestDelay();\n if (interestDelayStart) {\n this.#interestTimeout = setTimeout(() => {\n if (this.host.isConnected) {\n this.host.showPopover({ source: e.source as HTMLElement });\n }\n }, interestDelayStart);\n } else {\n this.host.showPopover({ source: e.source as HTMLElement });\n }\n }\n };\n\n #onLoseInterest = (e: InterestEvent) => {\n const isCustomElement = e.source?.localName.includes('-');\n if (isCustomElement) {\n this.host.hidePopover();\n }\n\n this.#clearInterestTimeout();\n };\n\n #onPointerDown = (e: PointerEvent) => {\n if (this.host.modal && this.host.matches(':popover-open')) {\n this.#pointerdownWithinModal = clickOutsideElementBounds(e, this.host);\n }\n };\n\n #onPointerUp = (e: PointerEvent) => {\n if (\n this.#pointerdownWithinModal &&\n this.host.popoverDismissible &&\n this.host.modal &&\n this.host.matches(':popover-open') &&\n !hasOpenPopover(this.host) &&\n clickOutsideElementBounds(e, this.host)\n ) {\n this.host.hidePopover();\n }\n };\n\n #onHintMouseEnter = (e: MouseEvent) => {\n this.host.showPopover({ source: e.currentTarget as HTMLElement });\n };\n\n #onHintMouseLeave = () => {\n this.host.hidePopover();\n };\n}\n"],"mappings":";;;;;AA8BA,IAAaA,IAAb,MAAgG;CAC9F,IAAIC,KAAiC;EACnC,IAAMC,IAAO,KAAK,KAAK,YAAY,GAC7BC,IAAwB,MAAM,KAClCD,EAAK,iBAAiB,mBAAmB,IAAI,SAAS,IAAI,OAAO,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,GAAG,GAAG,CACnG,GAEME,IAAqB,MAAM,KAC/BF,EAAK,iBAAiB,gBAAgB,IAAI,SAAS,IAAI,OAAO,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,GAAG,GAAG,CAChG,GAEMG,IAAsB,MAAM,KAChCH,EAAK,iBAAiB,iBAAiB,IAAI,SAAS,IAAI,OAAO,KAAK,KAAK,EAAE,IAAI,KAAK,K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1
|
+
{"version":3,"file":"type-native-popover.controller.js","names":["TypeNativePopoverController","#nativeTriggers","root","popoverTargetTriggers","commandForTriggers","interestForTriggers","host","showPopover","source","options","getHostAnchor","getHostTrigger","attachInternals","#updateLegacyTriggers","#setupLegacyTriggers","#setupModalLightDismiss","#onBeforeToggle","#onToggle","#onCommand","#onInterest","#onLoseInterest","#observers","observer","#onPointerDown","#onPointerUp","#removeHintTrigger","#clearInterestTimeout","#clearCloseTimeout","#closeTimeout","#interestTimeout","raw","value","#legacyHostTrigger","r","trigger","#previousLegacyTrigger","#clearLegacyTrigger","#hintTrigger","#setupHintTrigger","#setupPopoverTargetTrigger","#onHintMouseEnter","#onHintMouseLeave","generateId","open","focusElement","target","#setCloseTimeout","#toggleFocus","interestDelayStart","#parseInterestDelay","#pointerdownWithinModal","clickOutsideElementBounds","hasOpenPopover"],"sources":["../../../src/internal/controllers/type-native-popover.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 { clickOutsideElementBounds, generateId } from '../utils/dom.js';\nimport { attachInternals } from '../utils/a11y.js';\nimport { focusElement } from '../utils/focus.js';\nimport { getHostAnchor, getHostTrigger, hasOpenPopover } from './type-native-popover.utils.js';\nimport type { InterestEvent, PopoverType } from '../types/index.js';\n\nexport interface NativePopover extends ReactiveElement {\n anchor?: HTMLElement | string;\n closeTimeout?: number;\n popoverType?: PopoverType;\n modal?: boolean;\n popoverDismissible?: boolean;\n _internals?: ElementInternals;\n\n /** @deprecated */\n trigger?: HTMLElement | string;\n /** @deprecated */\n openDelay?: number;\n /** @deprecated */\n behaviorTrigger?: boolean;\n}\n\n/**\n * https://open-ui.org/components/popup.research.explainer\n */\nexport class TypeNativePopoverController<T extends NativePopover> implements ReactiveController {\n get #nativeTriggers(): HTMLElement[] {\n const root = this.host.getRootNode() as HTMLElement;\n const popoverTargetTriggers = Array.from(\n root.querySelectorAll(`[popovertarget=\"${CSS.escape ? CSS.escape(this.host.id) : this.host.id}\"]`)\n ) as HTMLElement[];\n\n const commandForTriggers = Array.from(\n root.querySelectorAll(`[commandfor=\"${CSS.escape ? CSS.escape(this.host.id) : this.host.id}\"]`)\n ) as HTMLElement[];\n\n const interestForTriggers = Array.from(\n root.querySelectorAll(`[interestfor=\"${CSS.escape ? CSS.escape(this.host.id) : this.host.id}\"]`)\n ) as HTMLElement[];\n\n return [...popoverTargetTriggers, ...commandForTriggers, ...interestForTriggers];\n }\n\n constructor(private host: T) {\n this.host.addController(this);\n\n const showPopover = this.host.showPopover;\n this.host.showPopover = (options?: ShowPopoverOptions) => {\n if (this.host.isConnected) {\n // provide legacy fallback for source anchor or trigger if not provided, this can happen if the popover is dynamically created in the DOM without the use of the standard popover api or legacy trigger based api\n let source: HTMLElement | Element | null = options?.source ?? null;\n if (!source) {\n if (this.host.anchor) {\n source = getHostAnchor(this.host);\n } else if (this.host.trigger) {\n source = getHostTrigger(this.host, this.host.trigger);\n } else {\n source = globalThis.document.activeElement;\n }\n }\n\n showPopover.call(this.host, { source: source as HTMLElement });\n }\n };\n }\n\n async hostConnected() {\n attachInternals(this.host);\n this.host.popover = this.host.popoverType ?? null;\n await this.host.updateComplete;\n if (!this.host.isConnected) return;\n\n this.host.setAttribute('nve-popover', '');\n this.#updateLegacyTriggers();\n this.#setupLegacyTriggers(); // eslint-disable-line @typescript-eslint/no-floating-promises\n this.#setupModalLightDismiss();\n this.host.inert = this.host.matches(':not(:popover-open)') && !!this.#nativeTriggers.length;\n\n this.host.addEventListener('beforetoggle', this.#onBeforeToggle);\n this.host.addEventListener('toggle', this.#onToggle as EventListener);\n this.host.addEventListener('command', this.#onCommand as EventListener);\n this.host.addEventListener('interest', this.#onInterest as EventListener);\n this.host.addEventListener('loseinterest', this.#onLoseInterest as EventListener);\n }\n\n #interestTimeout: ReturnType<typeof setTimeout> | null = null;\n #closeTimeout: ReturnType<typeof setTimeout> | null = null;\n #observers: MutationObserver[] = [];\n #previousLegacyTrigger: HTMLButtonElement | null = null;\n #hintTrigger: HTMLButtonElement | null = null;\n\n async hostUpdated() {\n this.host.popover = this.host.popoverType ?? null;\n this.#updateLegacyTriggers();\n }\n\n hostDisconnected() {\n this.#observers.forEach(observer => observer.disconnect());\n this.#observers.length = 0;\n this.host.removeEventListener('beforetoggle', this.#onBeforeToggle);\n this.host.removeEventListener('toggle', this.#onToggle as EventListener);\n this.host.removeEventListener('command', this.#onCommand as EventListener);\n this.host.removeEventListener('interest', this.#onInterest as EventListener);\n this.host.removeEventListener('loseinterest', this.#onLoseInterest as EventListener);\n this.host.removeEventListener('pointerdown', this.#onPointerDown);\n this.host.removeEventListener('pointerup', this.#onPointerUp);\n this.#removeHintTrigger();\n this.#clearInterestTimeout();\n this.#clearCloseTimeout();\n }\n\n #setCloseTimeout() {\n this.#clearCloseTimeout();\n if (this.host.closeTimeout) {\n this.#closeTimeout = setTimeout(() => this.host.hidePopover(), this.host.closeTimeout);\n }\n }\n\n #clearCloseTimeout() {\n if (this.#closeTimeout) {\n clearTimeout(this.#closeTimeout);\n this.#closeTimeout = null;\n }\n }\n\n #clearInterestTimeout() {\n if (this.#interestTimeout) {\n clearTimeout(this.#interestTimeout);\n this.#interestTimeout = null;\n }\n }\n\n #parseInterestDelay(): number {\n const style = getComputedStyle(this.host);\n const raw = (style as unknown as { interestDelayStart: string }).interestDelayStart;\n if (!raw) {\n return 0;\n }\n const value = parseFloat(raw);\n return raw.endsWith('ms') ? value : value * 1000;\n }\n\n #pointerdownWithinModal = false;\n\n #setupModalLightDismiss() {\n this.host.removeEventListener('pointerdown', this.#onPointerDown);\n this.host.removeEventListener('pointerup', this.#onPointerUp);\n this.host.addEventListener('pointerdown', this.#onPointerDown);\n this.host.addEventListener('pointerup', this.#onPointerUp);\n }\n\n get #legacyHostTrigger(): HTMLElement | null {\n return this.host.trigger ? (getHostTrigger(this.host, this.host.trigger) as HTMLButtonElement) : null;\n }\n\n /**\n * @deprecated Legacy behavior that allows popovers to show as open by default when using the legacy trigger based api\n */\n async #setupLegacyTriggers() {\n await new Promise(r => requestAnimationFrame(r));\n\n // setup host hidden updates for legacy triggers\n const observer = new MutationObserver(() => {\n if (this.host.isConnected && !this.host.hidden && !this.host.matches(':popover-open')) {\n this.host.showPopover();\n }\n\n if (this.host.isConnected && this.host.hidden && this.host.matches(':popover-open')) {\n this.host.hidePopover();\n }\n });\n observer.observe(this.host, { attributes: true, attributeFilter: ['hidden'] });\n this.#observers.push(observer);\n\n // determine if popover is open by default\n if (\n this.host.isConnected &&\n !this.#nativeTriggers.length &&\n !this.host.hidden &&\n !this.host.matches(':popover-open')\n ) {\n this.host.popover = 'manual';\n this.host.showPopover();\n }\n }\n\n /**\n * @deprecated Legacy behavior that allows popovers to show as open by default when using the legacy trigger based api\n */\n #updateLegacyTriggers() {\n const trigger = this.#legacyHostTrigger as HTMLButtonElement;\n\n if (this.#previousLegacyTrigger && this.#previousLegacyTrigger !== trigger) {\n this.#clearLegacyTrigger(this.#previousLegacyTrigger);\n }\n\n if (this.#hintTrigger && this.#hintTrigger !== trigger) {\n this.#removeHintTrigger();\n }\n\n if (!trigger) {\n this.#previousLegacyTrigger = null;\n return;\n }\n\n if (this.host.popoverType === 'hint') {\n this.#setupHintTrigger(trigger);\n } else {\n this.#setupPopoverTargetTrigger(trigger);\n }\n this.#previousLegacyTrigger = trigger;\n }\n\n #setupHintTrigger(trigger: HTMLButtonElement) {\n if (this.#hintTrigger === trigger) return;\n\n trigger.addEventListener('mouseenter', this.#onHintMouseEnter);\n trigger.addEventListener('mouseleave', this.#onHintMouseLeave);\n trigger.addEventListener('focusout', this.#onHintMouseLeave);\n this.#hintTrigger = trigger;\n }\n\n #setupPopoverTargetTrigger(trigger: HTMLButtonElement) {\n this.#removeHintTrigger();\n this.host.id = this.host.id ? this.host.id : generateId();\n trigger.popoverTargetElement = this.host;\n trigger.setAttribute('popovertarget', this.host.id);\n }\n\n #toggleFocus(open: boolean, target: HTMLElement) {\n if (open) {\n // only focus popover if not the active element and not containing the active element already\n if ((this.host.getRootNode() as Document).activeElement !== this.host && !this.host.shadowRoot!.activeElement) {\n focusElement(this.host);\n }\n } else {\n focusElement(target);\n }\n }\n\n #clearLegacyTrigger(trigger: HTMLButtonElement) {\n trigger.popoverTargetElement = null;\n trigger.removeAttribute('popovertarget');\n if (this.#hintTrigger === trigger) {\n this.#removeHintTrigger();\n }\n }\n\n #removeHintTrigger() {\n this.#hintTrigger?.removeEventListener('mouseenter', this.#onHintMouseEnter);\n this.#hintTrigger?.removeEventListener('mouseleave', this.#onHintMouseLeave);\n this.#hintTrigger?.removeEventListener('focusout', this.#onHintMouseLeave);\n this.#hintTrigger = null;\n }\n\n #onBeforeToggle = (e: ToggleEvent) => {\n if (e.newState === 'open') {\n this.host._internals!.states.add('transition-start');\n }\n };\n\n #onToggle = (e: ToggleEvent) => {\n if (this.host.behaviorTrigger) {\n this.host.hidden = e.newState === 'closed';\n }\n\n if (e.newState === 'open' && this.host.closeTimeout) {\n this.#setCloseTimeout();\n }\n\n if (e.newState === 'closed') {\n this.#clearInterestTimeout();\n this.#clearCloseTimeout();\n }\n\n this.host.inert = this.host.matches(':not(:popover-open)');\n\n if (this.host.modal) {\n this.#toggleFocus(e.newState === 'open', e.target as HTMLElement);\n }\n\n this.host.dispatchEvent(\n new CustomEvent(e.newState === 'open' && e.oldState !== 'open' ? 'open' : 'close', {\n bubbles: true,\n composed: true,\n detail: { trigger: e.source }\n })\n );\n };\n\n #onCommand = (e: CommandEvent) => {\n if (e.command === 'toggle-popover') {\n this.host.togglePopover({ source: e.source as HTMLElement });\n }\n\n if (e.command === 'hide-popover') {\n this.host.hidePopover();\n this.#clearInterestTimeout();\n }\n\n if (e.command === 'show-popover') {\n this.host.showPopover({ source: e.source as HTMLElement });\n }\n };\n\n #onInterest = (e: InterestEvent) => {\n const isCustomElement = e.source?.localName.includes('-');\n if (isCustomElement) {\n const interestDelayStart = this.host.openDelay ?? this.#parseInterestDelay();\n if (interestDelayStart) {\n this.#interestTimeout = setTimeout(() => {\n if (this.host.isConnected) {\n this.host.showPopover({ source: e.source as HTMLElement });\n }\n }, interestDelayStart);\n } else {\n this.host.showPopover({ source: e.source as HTMLElement });\n }\n }\n };\n\n #onLoseInterest = (e: InterestEvent) => {\n const isCustomElement = e.source?.localName.includes('-');\n if (isCustomElement) {\n this.host.hidePopover();\n }\n\n this.#clearInterestTimeout();\n };\n\n #onPointerDown = (e: PointerEvent) => {\n if (this.host.modal && this.host.matches(':popover-open')) {\n this.#pointerdownWithinModal = clickOutsideElementBounds(e, this.host);\n }\n };\n\n #onPointerUp = (e: PointerEvent) => {\n if (\n this.#pointerdownWithinModal &&\n this.host.popoverDismissible &&\n this.host.modal &&\n this.host.matches(':popover-open') &&\n !hasOpenPopover(this.host) &&\n clickOutsideElementBounds(e, this.host)\n ) {\n this.host.hidePopover();\n }\n };\n\n #onHintMouseEnter = (e: MouseEvent) => {\n this.host.showPopover({ source: e.currentTarget as HTMLElement });\n };\n\n #onHintMouseLeave = () => {\n this.host.hidePopover();\n };\n}\n"],"mappings":";;;;;AA6BA,IAAaA,IAAb,MAAgG;CAC9F,IAAIC,KAAiC;EACnC,IAAMC,IAAO,KAAK,KAAK,YAAY,GAC7BC,IAAwB,MAAM,KAClCD,EAAK,iBAAiB,mBAAmB,IAAI,SAAS,IAAI,OAAO,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,GAAG,GAAG,CACnG,GAEME,IAAqB,MAAM,KAC/BF,EAAK,iBAAiB,gBAAgB,IAAI,SAAS,IAAI,OAAO,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,GAAG,GAAG,CAChG,GAEMG,IAAsB,MAAM,KAChCH,EAAK,iBAAiB,iBAAiB,IAAI,SAAS,IAAI,OAAO,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,GAAG,GAAG,CACjG;EAEA,OAAO;GAAC,GAAGC;GAAuB,GAAGC;GA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2
2
|
export declare function getHostTrigger(element: HTMLElement, trigger: HTMLElement | string): HTMLButtonElement;
|
|
3
3
|
export declare function getHostAnchor(host: HTMLElement & {
|
|
4
4
|
anchor?: HTMLElement | string;
|
|
5
|
-
_activeTrigger?: HTMLElement;
|
|
6
5
|
}): HTMLElement;
|
|
7
6
|
export declare function hasOpenPopover(host: HTMLElement): boolean;
|
|
@@ -6,7 +6,7 @@ function r(e, t) {
|
|
|
6
6
|
return typeof t == "string" ? n(e.parentNode).filter((e) => e?.id !== "").find((e) => e.id === t) ?? globalThis.document.body : t;
|
|
7
7
|
}
|
|
8
8
|
function i(r) {
|
|
9
|
-
let i = r.anchor
|
|
9
|
+
let i = r.anchor;
|
|
10
10
|
if (typeof i == "string" && i?.length) {
|
|
11
11
|
let a = n(r.parentNode).find((e) => e.id === i);
|
|
12
12
|
return a || e.warn(t(i)), a ?? globalThis.document.body;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-native-popover.utils.js","names":["getHostTrigger","trigger","getFlattenedDOMTree","element","el","getHostAnchor","anchor","host","match","LogService","getIdMatchNotFoundWarning","hasOpenPopover"],"sources":["../../../src/internal/controllers/type-native-popover.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { LogService } from '../services/log.service.js';\nimport { getIdMatchNotFoundWarning } from '../utils/audit-logs.js';\nimport { generateId, getFlattenedDOMTree, getAnchorNames, appendAnchorName } from '../utils/dom.js';\n\nexport function associateAnchor(host: HTMLElement, anchor: HTMLElement) {\n const anchorNames = getAnchorNames(anchor);\n let anchorId = anchorNames.find(name => name.startsWith('--_'));\n if (!anchorId) {\n anchorId = `--${anchor.id && !anchor.id.includes(':') ? `_${anchor.id}` : generateId()}`;\n appendAnchorName(anchor, anchorId);\n }\n host.style.positionAnchor = anchorId;\n}\n\nexport function getHostTrigger(element: HTMLElement, trigger: HTMLElement | string) {\n if (typeof trigger === 'string') {\n return (\n (getFlattenedDOMTree(element.parentNode as HTMLElement)\n .filter(el => el?.id !== '')\n .find(el => el.id === trigger) as HTMLButtonElement) ?? globalThis.document.body\n );\n } else {\n return trigger as HTMLButtonElement;\n }\n}\n\nexport function getHostAnchor(host: HTMLElement & { anchor?: HTMLElement | string
|
|
1
|
+
{"version":3,"file":"type-native-popover.utils.js","names":["getHostTrigger","trigger","getFlattenedDOMTree","element","el","getHostAnchor","anchor","host","match","LogService","getIdMatchNotFoundWarning","hasOpenPopover"],"sources":["../../../src/internal/controllers/type-native-popover.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { LogService } from '../services/log.service.js';\nimport { getIdMatchNotFoundWarning } from '../utils/audit-logs.js';\nimport { generateId, getFlattenedDOMTree, getAnchorNames, appendAnchorName } from '../utils/dom.js';\n\nexport function associateAnchor(host: HTMLElement, anchor: HTMLElement) {\n const anchorNames = getAnchorNames(anchor);\n let anchorId = anchorNames.find(name => name.startsWith('--_'));\n if (!anchorId) {\n anchorId = `--${anchor.id && !anchor.id.includes(':') ? `_${anchor.id}` : generateId()}`;\n appendAnchorName(anchor, anchorId);\n }\n host.style.positionAnchor = anchorId;\n}\n\nexport function getHostTrigger(element: HTMLElement, trigger: HTMLElement | string) {\n if (typeof trigger === 'string') {\n return (\n (getFlattenedDOMTree(element.parentNode as HTMLElement)\n .filter(el => el?.id !== '')\n .find(el => el.id === trigger) as HTMLButtonElement) ?? globalThis.document.body\n );\n } else {\n return trigger as HTMLButtonElement;\n }\n}\n\nexport function getHostAnchor(host: HTMLElement & { anchor?: HTMLElement | string }) {\n const anchor = host.anchor;\n\n if (typeof anchor === 'string' && anchor?.length) {\n const match = getFlattenedDOMTree(host.parentNode as HTMLElement).find(el => el.id === anchor);\n\n if (!match) {\n LogService.warn(getIdMatchNotFoundWarning(anchor));\n }\n\n return match ?? globalThis.document.body;\n } else if (anchor && anchor !== globalThis.document.body) {\n return anchor as HTMLElement;\n } else {\n return globalThis.document.body;\n }\n}\n\nexport function hasOpenPopover(host: HTMLElement) {\n return !!getFlattenedDOMTree(host).filter(e => e.popover && e.matches(':popover-open')).length;\n}\n"],"mappings":";;;;AAiBA,SAAgBA,EAAe,GAAsB,GAA+B;CAQhF,OAPE,OAAOC,KAAY,WAElBC,EAAoBC,EAAQ,UAAyB,CAAC,CACpD,QAAO,MAAMC,GAAI,OAAO,EAAE,CAAC,CAC3B,MAAK,MAAMA,EAAG,OAAOH,CAAO,KAA2B,WAAW,SAAS,OAGzEA;AAEX;AAEA,SAAgBI,EAAc,GAAuD;CACnF,IAAMC,IAASC,EAAK;CAEpB,IAAI,OAAOD,KAAW,YAAYA,GAAQ,QAAQ;EAChD,IAAME,IAAQN,EAAoBK,EAAK,UAAyB,CAAC,CAAC,MAAK,MAAMH,EAAG,OAAOE,CAAM;EAM7F,OAJKE,KACHC,EAAW,KAAKC,EAA0BJ,CAAM,CAAC,GAG5CE,KAAS,WAAW,SAAS;CACtC;CAGE,OAHSF,KAAUA,MAAW,WAAW,SAAS,OAC3CA,IAEA,WAAW,SAAS;AAE/B;AAEA,SAAgBK,EAAe,GAAmB;CAChD,OAAO,CAAC,CAACT,EAAoBK,CAAI,CAAC,CAAC,QAAO,MAAK,EAAE,WAAW,EAAE,QAAQ,eAAe,CAAC,CAAC,CAAC;AAC1F"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// 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([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}
|
|
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\"]:not(:dir(rtl))) .arrow,:host([position=\"top\"][alignment=\"start\"]:dir(rtl)) .arrow{position-area:bottom right;translate:-50% 50%}:host([position=\"top\"][alignment=\"start\"]:not(:dir(rtl))) .arrow,:host([position=\"top\"][alignment=\"end\"]:dir(rtl)) .arrow{position-area:bottom left;translate:50% 50%}:host([position=\"bottom\"]) .arrow{position-area:top;translate:0% -50%}:host([position=\"bottom\"][alignment=\"end\"]:not(:dir(rtl))) .arrow,:host([position=\"bottom\"][alignment=\"start\"]:dir(rtl)) .arrow{position-area:top right;translate:-50% -50%}:host([position=\"bottom\"][alignment=\"start\"]:not(:dir(rtl))) .arrow,:host([position=\"bottom\"][alignment=\"end\"]:dir(rtl)) .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\"]:not(:dir(rtl))),:host([position=\"top\"][alignment=\"end\"]:dir(rtl)){position-area:top left}:host([position=\"top\"][alignment=\"end\"]:not(:dir(rtl))),:host([position=\"top\"][alignment=\"start\"]:dir(rtl)){position-area:top right}:host([position=\"top\"][alignment=\"start\"]:not(:dir(rtl))),:host([position=\"top\"][alignment=\"end\"]:dir(rtl)){position-area:top span-right}:host([position=\"top\"][alignment=\"end\"]:not(:dir(rtl))),:host([position=\"top\"][alignment=\"start\"]:dir(rtl)){position-area:top span-left}:host([position=\"bottom\"]){position-area:bottom center}:host([position=\"bottom\"][alignment=\"start\"]:not(:dir(rtl))),:host([position=\"bottom\"][alignment=\"end\"]:dir(rtl)){position-area:bottom span-right}:host([position=\"bottom\"][alignment=\"end\"]:not(:dir(rtl))),:host([position=\"bottom\"][alignment=\"start\"]:dir(rtl)){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}:host([popover][modal]):before{content:\" \";display:block;inset:0;z-index:99;position:fixed}";
|
|
3
3
|
export { e as default };
|
|
4
4
|
|
|
5
5
|
//# sourceMappingURL=popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","names":["popover_default"],"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
|
|
1
|
+
{"version":3,"file":"popover.js","names":["popover_default"],"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']:not(:dir(rtl))) .arrow,\n :host([position='top'][alignment='start']:dir(rtl)) .arrow {\n position-area: bottom right;\n translate: -50% 50%;\n }\n\n :host([position='top'][alignment='start']:not(:dir(rtl))) .arrow,\n :host([position='top'][alignment='end']:dir(rtl)) .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']:not(:dir(rtl))) .arrow,\n :host([position='bottom'][alignment='start']:dir(rtl)) .arrow {\n position-area: top right;\n translate: -50% -50%;\n }\n\n :host([position='bottom'][alignment='start']:not(:dir(rtl))) .arrow,\n :host([position='bottom'][alignment='end']:dir(rtl)) .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']:not(:dir(rtl))),\n :host([position='top'][alignment='end']:dir(rtl)) {\n position-area: top left;\n }\n\n :host([position='top'][alignment='end']:not(:dir(rtl))),\n :host([position='top'][alignment='start']:dir(rtl)) {\n position-area: top right;\n }\n\n :host([position='top'][alignment='start']:not(:dir(rtl))),\n :host([position='top'][alignment='end']:dir(rtl)) {\n position-area: top span-right;\n }\n\n :host([position='top'][alignment='end']:not(:dir(rtl))),\n :host([position='top'][alignment='start']:dir(rtl)) {\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']:not(:dir(rtl))),\n :host([position='bottom'][alignment='end']:dir(rtl)) {\n position-area: bottom span-right;\n }\n\n :host([position='bottom'][alignment='end']:not(:dir(rtl))),\n :host([position='bottom'][alignment='start']:dir(rtl)) {\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:host([popover][modal])::before {\n content: ' ';\n display: block;\n inset: 0;\n z-index: 99;\n position: fixed;\n}\n"],"mappings":""}
|
package/dist/logo/logo2.js
CHANGED