@nvidia-elements/core 2.19.0 → 2.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/_virtual/_rolldown/runtime.js +17 -0
- package/dist/accordion/accordion2.js +60 -57
- package/dist/accordion/accordion2.js.map +1 -1
- package/dist/alert/alert-group2.js +1 -1
- package/dist/alert/alert2.js +37 -31
- package/dist/alert/alert2.js.map +1 -1
- package/dist/avatar/avatar-group2.js +1 -1
- package/dist/avatar/avatar2.js +1 -1
- package/dist/badge/badge.d.ts +0 -6
- package/dist/badge/badge2.js +31 -36
- package/dist/badge/badge2.js.map +1 -1
- package/dist/breadcrumb/breadcrumb2.js +1 -1
- package/dist/bundle.d.ts +2 -0
- package/dist/bundles/index.d.ts +153 -27
- package/dist/bundles/index.js +9 -9
- 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/color.d.ts +2 -0
- package/dist/color/color2.js +7 -4
- package/dist/color/color2.js.map +1 -1
- package/dist/combobox/combobox.d.ts +2 -0
- package/dist/combobox/combobox2.js +14 -6
- package/dist/combobox/combobox2.js.map +1 -1
- package/dist/copy-button/copy-button2.js +26 -23
- package/dist/copy-button/copy-button2.js.map +1 -1
- package/dist/custom-elements-jsx.d.ts +166 -4
- package/dist/custom-elements-vue.d.ts +160 -4
- package/dist/custom-elements.json +1239 -220
- package/dist/data.html.json +117 -10
- package/dist/date/date.d.ts +2 -0
- package/dist/date/date2.js +7 -4
- package/dist/date/date2.js.map +1 -1
- package/dist/datetime/datetime.d.ts +2 -0
- package/dist/datetime/datetime2.js +7 -4
- package/dist/datetime/datetime2.js.map +1 -1
- package/dist/dialog/dialog-footer2.js +1 -1
- package/dist/dialog/dialog-header2.js +1 -1
- package/dist/dialog/dialog2.js +27 -27
- package/dist/dialog/dialog2.js.map +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 +27 -27
- package/dist/drawer/drawer2.js.map +1 -1
- package/dist/dropdown/dropdown-footer2.js +1 -1
- package/dist/dropdown/dropdown-header2.js +1 -1
- package/dist/dropdown/dropdown2.js +23 -23
- package/dist/dropdown/dropdown2.js.map +1 -1
- package/dist/dropdown-group/dropdown-group.js +1 -1
- package/dist/dropzone/dropzone2.js +28 -22
- package/dist/dropzone/dropzone2.js.map +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/control.d.ts +3 -0
- package/dist/forms/control/control2.js +34 -31
- package/dist/forms/control/control2.js.map +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 +26 -21
- package/dist/gauge/gauge2.js.map +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 +5 -6
- package/dist/input/input-group2.js +1 -1
- package/dist/input/input2.js +1 -1
- package/dist/internal/index.d.ts +1 -2
- package/dist/internal/index.js +150 -33
- package/dist/internal/index.js.map +1 -0
- package/dist/internal/types/index.d.ts +1 -1
- package/dist/internal/types/index.js.map +1 -1
- package/dist/joystick/define.d.ts +6 -0
- package/dist/joystick/define.js +7 -0
- package/dist/joystick/define.js.map +1 -0
- package/dist/joystick/index.d.ts +1 -0
- package/dist/joystick/index.js +2 -0
- package/dist/joystick/joystick.d.ts +126 -0
- package/dist/joystick/joystick.examples.js +6 -0
- package/dist/joystick/joystick.examples.js.map +1 -0
- package/dist/joystick/joystick.examples.json +107 -0
- package/dist/joystick/joystick.js +6 -0
- package/dist/joystick/joystick.js.map +1 -0
- package/dist/joystick/joystick2.js +347 -0
- package/dist/joystick/joystick2.js.map +1 -0
- 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/month.d.ts +2 -0
- package/dist/month/month2.js +7 -4
- package/dist/month/month2.js.map +1 -1
- package/dist/notification/notification-group2.js +1 -1
- package/dist/notification/notification2.js +38 -32
- package/dist/notification/notification2.js.map +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-panel.d.ts +0 -7
- package/dist/page/page-panel/page-panel2.js +18 -20
- package/dist/page/page-panel/page-panel2.js.map +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 +45 -38
- package/dist/pagination/pagination2.js.map +1 -1
- package/dist/panel/panel2.js +43 -38
- package/dist/panel/panel2.js.map +1 -1
- package/dist/password/password.d.ts +2 -0
- package/dist/password/password2.js +10 -4
- package/dist/password/password2.js.map +1 -1
- package/dist/preferences-input/preferences-input2.js +32 -27
- package/dist/preferences-input/preferences-input2.js.map +1 -1
- package/dist/progress-bar/progress-bar2.js +1 -1
- package/dist/progress-dot/progress-dot2.js +17 -17
- package/dist/progress-dot/progress-dot2.js.map +1 -1
- package/dist/progress-ring/progress-ring2.js +27 -22
- package/dist/progress-ring/progress-ring2.js.map +1 -1
- package/dist/progressive-filter-chip/progressive-filter-chip2.js +30 -30
- package/dist/progressive-filter-chip/progressive-filter-chip2.js.map +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 +17 -17
- package/dist/resize-handle/resize-handle2.js.map +1 -1
- package/dist/search/search2.js +1 -1
- package/dist/select/select2.js +44 -41
- package/dist/select/select2.js.map +1 -1
- package/dist/skeleton/skeleton2.js +1 -1
- package/dist/sort-button/sort-button2.js +20 -20
- package/dist/sort-button/sort-button2.js.map +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 +19 -19
- package/dist/tag/tag2.js.map +1 -1
- package/dist/textarea/textarea2.js +1 -1
- package/dist/time/time.d.ts +2 -0
- package/dist/time/time2.js +7 -4
- package/dist/time/time2.js.map +1 -1
- package/dist/toast/toast2.js +35 -29
- package/dist/toast/toast2.js.map +1 -1
- package/dist/toggletip/toggletip-footer2.js +1 -1
- package/dist/toggletip/toggletip-header2.js +1 -1
- package/dist/toggletip/toggletip2.js +25 -25
- package/dist/toggletip/toggletip2.js.map +1 -1
- package/dist/toolbar/toolbar2.js +1 -1
- package/dist/tooltip/tooltip2.js +1 -1
- package/dist/tree/tree-node2.js +45 -45
- package/dist/tree/tree-node2.js.map +1 -1
- package/dist/tree/tree2.js +1 -1
- package/dist/week/week.d.ts +2 -0
- package/dist/week/week2.js +7 -4
- package/dist/week/week2.js.map +1 -1
- package/package.json +14 -2
- package/dist/internal/controllers/i18n.controller.d.ts +0 -19
- package/dist/internal/controllers/i18n.controller.examples.js +0 -6
- package/dist/internal/controllers/i18n.controller.examples.js.map +0 -1
- package/dist/internal/controllers/i18n.controller.examples.json +0 -16
- package/dist/internal/controllers/i18n.controller.js +0 -38
- package/dist/internal/controllers/i18n.controller.js.map +0 -1
- package/dist/internal/services/i18n.service.d.ts +0 -64
- package/dist/internal/services/i18n.service.js +0 -73
- package/dist/internal/services/i18n.service.js.map +0 -1
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
import { audit as e } from "../internal/controllers/audit.controller.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import c from "../
|
|
10
|
-
import
|
|
11
|
-
import u from "./toggletip.js";
|
|
12
|
-
import d from "
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
2
|
+
import { appendRootNodeStyle as t } from "../internal/utils/dom.js";
|
|
3
|
+
import { attachInternals as n } from "../internal/utils/a11y.js";
|
|
4
|
+
import { TypeNativePopoverController as r } from "../internal/controllers/type-native-popover.controller.js";
|
|
5
|
+
import { scopedRegistry as i } from "../internal/decorators/scoped-registry.js";
|
|
6
|
+
import { useStyles as a } from "../internal/styles/index.js";
|
|
7
|
+
import { popoverStyles as o } from "../internal/styles/popover2.js";
|
|
8
|
+
import s from "../_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/decorate.js";
|
|
9
|
+
import { IconButton as c } from "../icon-button/icon-button2.js";
|
|
10
|
+
import l from "./toggletip.js";
|
|
11
|
+
import u from "./toggletip.global.js";
|
|
12
|
+
import { LitElement as d, html as f } from "lit";
|
|
13
|
+
import { property as p } from "lit/decorators/property.js";
|
|
14
|
+
import { I18nController as m } from "@nvidia-elements/foundations/internal/i18n";
|
|
15
15
|
import { query as h } from "lit/decorators/query.js";
|
|
16
16
|
//#region src/toggletip/toggletip.ts
|
|
17
|
-
var g = class extends
|
|
17
|
+
var g = { close: "close" }, _ = class extends d {
|
|
18
18
|
constructor(...e) {
|
|
19
|
-
super(...e), this.position = "top", this.alignment = "center", this.closable = !1, this.arrow = !0, this.popoverType = "auto", this.typeNativePopoverController = new
|
|
19
|
+
super(...e), this.position = "top", this.alignment = "center", this.closable = !1, this.arrow = !0, this.popoverType = "auto", this.typeNativePopoverController = new r(this), this.#e = new m(this, g), this.i18n = this.#e.i18n;
|
|
20
20
|
}
|
|
21
21
|
static {
|
|
22
|
-
this.styles =
|
|
22
|
+
this.styles = a([o, l]);
|
|
23
23
|
}
|
|
24
24
|
static {
|
|
25
25
|
this.metadata = {
|
|
26
26
|
tag: "nve-toggletip",
|
|
27
|
-
version: "2.
|
|
27
|
+
version: "2.20.0"
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
static {
|
|
31
|
-
this.elementDefinitions = { [
|
|
31
|
+
this.elementDefinitions = { [c.metadata.tag]: c };
|
|
32
32
|
}
|
|
33
33
|
#e;
|
|
34
34
|
render() {
|
|
35
|
-
return
|
|
35
|
+
return f`<div internal-host><slot name="header"></slot>${this.closable ? f`<nve-icon-button part="icon-button" exportparts="icon:icon-button-icon" @click="${this.hidePopover}" icon-name="cancel" container="flat" size="sm" .ariaLabel="${this.i18n.close}"></nve-icon-button>` : ""}<div id="content" part="_content"><slot></slot></div><slot name="footer"></slot></div>${this.arrow ? f`<div class="arrow"></div>` : ""}`;
|
|
36
36
|
}
|
|
37
37
|
connectedCallback() {
|
|
38
|
-
super.connectedCallback(),
|
|
38
|
+
super.connectedCallback(), n(this), this._internals.role = "toggletip", t(this, u);
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
-
|
|
41
|
+
s([p({ type: String })], _.prototype, "anchor", void 0), s([p({ type: String })], _.prototype, "trigger", void 0), s([p({
|
|
42
42
|
type: String,
|
|
43
43
|
reflect: !0
|
|
44
|
-
})],
|
|
44
|
+
})], _.prototype, "position", void 0), s([p({
|
|
45
45
|
type: String,
|
|
46
46
|
reflect: !0
|
|
47
|
-
})],
|
|
47
|
+
})], _.prototype, "alignment", void 0), s([p({
|
|
48
48
|
type: Boolean,
|
|
49
49
|
reflect: !0,
|
|
50
50
|
attribute: "behavior-trigger"
|
|
51
|
-
})],
|
|
51
|
+
})], _.prototype, "behaviorTrigger", void 0), s([p({ type: Boolean })], _.prototype, "closable", void 0), s([p({ type: Boolean })], _.prototype, "arrow", void 0), s([h(".arrow")], _.prototype, "popoverArrow", void 0), s([p({ type: Object })], _.prototype, "i18n", void 0), _ = s([i(), e({ excessiveInstanceLimit: 50 })], _);
|
|
52
52
|
//#endregion
|
|
53
|
-
export {
|
|
53
|
+
export { _ as Toggletip };
|
|
54
54
|
|
|
55
55
|
//# sourceMappingURL=toggletip2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggletip2.js","names":[],"sources":["../../src/toggletip/toggletip.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { query } from 'lit/decorators/query.js';\nimport { IconButton } from '@nvidia-elements/core/icon-button';\nimport type { PopoverAlign, PopoverPosition, PopoverType } from '@nvidia-elements/core/internal';\nimport {\n attachInternals,\n audit,\n excessiveInstanceLimit,\n
|
|
1
|
+
{"version":3,"file":"toggletip2.js","names":[],"sources":["../../src/toggletip/toggletip.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { query } from 'lit/decorators/query.js';\nimport { IconButton } from '@nvidia-elements/core/icon-button';\nimport type { PopoverAlign, PopoverPosition, PopoverType } from '@nvidia-elements/core/internal';\nimport {\n attachInternals,\n audit,\n excessiveInstanceLimit,\n popoverStyles,\n TypeNativePopoverController,\n useStyles,\n appendRootNodeStyle,\n scopedRegistry\n} from '@nvidia-elements/core/internal';\nimport { I18nController, type I18nDefaults } from '@nvidia-elements/foundations/internal/i18n';\nimport styles from './toggletip.css?inline';\nimport globalStyles from './toggletip.global.css?inline';\n\nconst i18nDefaults = {\n close: 'close'\n} satisfies I18nDefaults;\n\n/**\n * @element nve-toggletip\n * @description Generic toggletip element for rendering a variety of different interactive content. [MDN Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API)\n * @documentation https://nvidia.github.io/elements/docs/elements/toggletip/\n * @since 0.38.0\n * @entrypoint \\@nvidia-elements/core/toggletip\n * @event beforetoggle - Dispatched on a popover just before showing or hiding. [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/beforetoggle_event)\n * @event toggle - Dispatched on a popover element just after showing or hiding. [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/toggle_event)\n * @event open - Dispatched when the toggletip opens.\n * @event close - Dispatched when the toggletip closes.\n * @slot - default slot for toggletip content\n * @cssprop --arrow-transform\n * @cssprop --border\n * @cssprop --border-radius\n * @cssprop --background\n * @cssprop --color\n * @cssprop --padding\n * @cssprop --font-size\n * @cssprop --font-weight\n * @cssprop --box-shadow\n * @cssprop --width\n * @cssprop --min-width\n * @cssprop --gap\n * @cssprop --animation-duration - Duration of toggletip open/close animations\n * @csspart icon-button - The close icon button element\n\n * @aria https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/\n *\n */\n@scopedRegistry()\n@audit({ excessiveInstanceLimit })\nexport class Toggletip extends LitElement {\n static styles = useStyles([popoverStyles, styles]);\n\n static readonly metadata = {\n tag: 'nve-toggletip',\n version: '0.0.0'\n };\n\n static elementDefinitions = {\n [IconButton.metadata.tag]: IconButton\n };\n\n /**\n * (optional) By default the popover automatically anchors itself relative to the trigger element.\n * Pass an optional custom anchor element as an idref string within the same render root or a HTMLElement DOM reference.\n */\n @property({ type: String }) anchor: string | HTMLElement;\n\n /**\n * @deprecated Use the popover API instead.\n * The trigger defines what element triggers an `open` interaction event.\n * A trigger can accept a idref string within the same render root or a HTMLElement DOM reference.\n */\n @property({ type: String }) trigger: string | HTMLElement;\n\n /**\n * Sets the side position of the popover relative to the provided anchor element.\n */\n @property({ type: String, reflect: true }) position: PopoverPosition = 'top';\n\n /**\n * Sets the alignment of the popover relative to the provided anchor element.\n * If an arrow exists the alginment will be relative to the arrow against the anchor.\n */\n @property({ type: String, reflect: true }) alignment: PopoverAlign = 'center';\n\n /**\n * @deprecated Use the popover API instead.\n * Determines if popover visibility behavior should be automatically controlled by the trigger.\n */\n @property({ type: Boolean, reflect: true, attribute: 'behavior-trigger' }) behaviorTrigger: boolean;\n\n /**\n * Determines if a close button should render within toggletip.\n */\n @property({ type: Boolean }) closable = false;\n\n /**\n * Determines if the component renders an arrow.\n */\n @property({ type: Boolean }) arrow = true;\n\n /** @private */\n @query('.arrow') popoverArrow: HTMLElement;\n\n /** @private */\n readonly popoverType: PopoverType = 'auto';\n\n protected typeNativePopoverController = new TypeNativePopoverController<Toggletip>(this);\n\n #i18nController: I18nController<this> = new I18nController<this>(this, i18nDefaults);\n\n /**\n * Updates internal string values for internationalization.\n */\n @property({ type: Object }) i18n = this.#i18nController.i18n;\n\n /** @private */\n declare _internals: ElementInternals;\n\n render() {\n return html`\n <div internal-host>\n <slot name=\"header\"></slot>\n ${this.closable ? html`<nve-icon-button part=\"icon-button\" exportparts=\"icon:icon-button-icon\" @click=${this.hidePopover} icon-name=\"cancel\" container=\"flat\" size=\"sm\" .ariaLabel=${this.i18n.close}></nve-icon-button>` : ''}\n <div id=\"content\" part=\"_content\">\n <slot></slot>\n </div>\n <slot name=\"footer\"></slot>\n </div>\n ${this.arrow ? html`<div class=\"arrow\"></div>` : ''}\n `;\n }\n\n connectedCallback() {\n super.connect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A,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,WAAW;AAAmB,CAAC,CAAA,GAAA,EAAA,WAAA,mBAAA,KAAA,CAAA,GAKxE,EAAA,CAAA,EAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GAK1B,EAAA,CAAA,EAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,GAAA,EAAA,WAAA,SAAA,KAAA,CAAA,GAG1B,EAAA,CAAA,EAAM,QAAQ,CAAA,GAAA,EAAA,WAAA,gBAAA,KAAA,CAAA,GAYd,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GAnE3B,IAAA,EAAA,CAAA,EAAe,GACf,EAAM,EAAE,wBAAA,GAAuB,CAAC,CAAA,GAAA,CAAA"}
|
package/dist/toolbar/toolbar2.js
CHANGED
package/dist/tooltip/tooltip2.js
CHANGED
package/dist/tree/tree-node2.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { audit as e } from "../internal/controllers/audit.controller.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import h from "../
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import
|
|
21
|
-
import b from "
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
2
|
+
import { isFocusable as t } from "../internal/utils/focus.js";
|
|
3
|
+
import { getFlattenedFocusableItems as n } from "../internal/utils/dom.js";
|
|
4
|
+
import { attachInternals as r } from "../internal/utils/a11y.js";
|
|
5
|
+
import { stateExpanded as i } from "../internal/controllers/state-expanded.controller.js";
|
|
6
|
+
import { stateHighlighted as a } from "../internal/controllers/state-highlighted.controller.js";
|
|
7
|
+
import { stateSelected as o } from "../internal/controllers/state-selected.controller.js";
|
|
8
|
+
import { typeAnchor as s } from "../internal/controllers/type-anchor.controller.js";
|
|
9
|
+
import { TypeExpandableController as c } from "../internal/controllers/type-expandable.controller.js";
|
|
10
|
+
import { TypeSelectableController as l } from "../internal/controllers/type-selectable.controller.js";
|
|
11
|
+
import { typeSSR as u } from "../internal/controllers/type-ssr.controller.js";
|
|
12
|
+
import { hostAttr as d } from "../internal/decorators/host-attr.js";
|
|
13
|
+
import { scopedRegistry as f } from "../internal/decorators/scoped-registry.js";
|
|
14
|
+
import { useStyles as p } from "../internal/styles/index.js";
|
|
15
|
+
import m from "../_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/decorate.js";
|
|
16
|
+
import { Icon as h } from "../icon/icon2.js";
|
|
17
|
+
import { IconButton as g } from "../icon-button/icon-button2.js";
|
|
18
|
+
import { updateNodeSelection as _ } from "./utils.js";
|
|
19
|
+
import { Checkbox as v } from "../checkbox/checkbox2.js";
|
|
20
|
+
import y from "./tree-node.js";
|
|
21
|
+
import { LitElement as b, html as x, nothing as S } from "lit";
|
|
22
|
+
import { property as C } from "lit/decorators/property.js";
|
|
23
|
+
import { I18nController as w } from "@nvidia-elements/foundations/internal/i18n";
|
|
24
24
|
import { state as T } from "lit/decorators/state.js";
|
|
25
25
|
import { queryAssignedElements as E } from "lit/decorators/query-assigned-elements.js";
|
|
26
26
|
import { TypeCommandController as D } from "@nvidia-elements/forms/internal";
|
|
27
27
|
//#region src/tree/tree-node.ts
|
|
28
|
-
var O = class extends
|
|
28
|
+
var O = { expand: "expand" }, k = class extends b {
|
|
29
29
|
constructor(...e) {
|
|
30
|
-
super(...e), this.command = "", this.commandfor = null, this.commandForElement = null, this.expanded = !1, this.selected = !1, this.expandable = !1, this.highlighted = !1, this.#e = new
|
|
30
|
+
super(...e), this.command = "", this.commandfor = null, this.commandForElement = null, this.expanded = !1, this.selected = !1, this.expandable = !1, this.highlighted = !1, this.#e = new w(this, O), this.i18n = this.#e.i18n, this.slot = "nodes", this.indeterminate = !1, this.behaviorExpand = !1, this.behaviorSelect = !1, this.#n = new c(this), this.#r = new l(this), this.#i = new D(this, { events: [] }), this.#c = (e) => {
|
|
31
31
|
let t = this.selectable && e.code === "Space", n = this.#a && (e.code === "ArrowLeft" || e.code === "ArrowRight");
|
|
32
32
|
e.target === this && (t || n) && e.preventDefault();
|
|
33
33
|
}, this.#u = (e) => {
|
|
@@ -47,25 +47,25 @@ var O = class extends x {
|
|
|
47
47
|
static {
|
|
48
48
|
this.metadata = {
|
|
49
49
|
tag: "nve-tree-node",
|
|
50
|
-
version: "2.
|
|
50
|
+
version: "2.20.0",
|
|
51
51
|
parents: ["nve-tree", "nve-tree-node"]
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
static {
|
|
55
55
|
this.elementDefinitions = {
|
|
56
|
-
[_.metadata.tag]: _,
|
|
57
56
|
[g.metadata.tag]: g,
|
|
58
|
-
[
|
|
57
|
+
[h.metadata.tag]: h,
|
|
58
|
+
[v.metadata.tag]: v
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
static {
|
|
62
|
-
this.styles =
|
|
62
|
+
this.styles = p([y]);
|
|
63
63
|
}
|
|
64
64
|
render() {
|
|
65
|
-
return
|
|
65
|
+
return x`<div internal-host @slotchange="${this.#o}"><div part="_node">${this.#a ? x`<nve-icon-button part="icon-button" exportparts="icon:icon-button-icon" @pointerup="${this.#f}" role="presentation" tabindex="-1" size="sm" container="inline" nofocus><nve-icon part="icon" name="caret" direction="${this.expanded ? "down" : "right"}" size="sm"></nve-icon></nve-icon-button>` : S} ${this.selectable === "multi" ? x`<nve-checkbox part="checkbox" nofocus><input type="checkbox" @change="${this.#h}" .checked="${this.selected}" .indeterminate="${this.indeterminate}" .ariaLabel="${this.i18n.expand}" tabindex="-1"></nve-checkbox>` : S}<div tabindex="0" part="_node-header"><div class="node-title" @click="${this.#d}"><slot name="prefix" part="_prefix"></slot><slot></slot><slot name="suffix" part="_suffix"></slot></div><slot name="content" part="_content"></slot></div></div><div role="group" part="_nodes"><slot name="nodes"></slot></div></div>`;
|
|
66
66
|
}
|
|
67
67
|
connectedCallback() {
|
|
68
|
-
super.connectedCallback(),
|
|
68
|
+
super.connectedCallback(), r(this), this._internals.role = "treeitem", this.addEventListener("keydown", this.#c), this.addEventListener("keyup", this.#u), this.#o();
|
|
69
69
|
}
|
|
70
70
|
disconnectedCallback() {
|
|
71
71
|
super.disconnectedCallback(), this.removeEventListener("keydown", this.#c), this.removeEventListener("keyup", this.#u);
|
|
@@ -90,10 +90,10 @@ var O = class extends x {
|
|
|
90
90
|
}
|
|
91
91
|
#u;
|
|
92
92
|
#d(e) {
|
|
93
|
-
let
|
|
94
|
-
this.#a && !this.selectable && !
|
|
93
|
+
let r = n(e.currentTarget).length;
|
|
94
|
+
this.#a && !this.selectable && !r && this.#f(), this.selectable && (!r || e.target.localName === "a") && this.#p();
|
|
95
95
|
let i = e.composedPath();
|
|
96
|
-
!i.slice(0, i.indexOf(e.currentTarget)).some((e) => e instanceof Element &&
|
|
96
|
+
!i.slice(0, i.indexOf(e.currentTarget)).some((e) => e instanceof Element && t(e)) && !e.defaultPrevented && this.#i.invoke();
|
|
97
97
|
}
|
|
98
98
|
#f() {
|
|
99
99
|
this.#n.toggle();
|
|
@@ -107,28 +107,28 @@ var O = class extends x {
|
|
|
107
107
|
#h() {
|
|
108
108
|
this.#r.toggle(), this.behaviorSelect && (this.nodes.forEach((e) => {
|
|
109
109
|
e.selected = this.selected, e.indeterminate = !1;
|
|
110
|
-
}), this.#t.nodes.forEach((e) =>
|
|
110
|
+
}), this.#t.nodes.forEach((e) => _(e)));
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
|
-
|
|
113
|
+
m([C({ type: String })], k.prototype, "command", void 0), m([C({
|
|
114
114
|
type: String,
|
|
115
115
|
reflect: !0
|
|
116
|
-
})],
|
|
116
|
+
})], k.prototype, "commandfor", void 0), m([C({ attribute: !1 })], k.prototype, "commandForElement", void 0), m([C({
|
|
117
117
|
type: Boolean,
|
|
118
118
|
reflect: !0
|
|
119
|
-
})],
|
|
119
|
+
})], k.prototype, "expanded", void 0), m([C({
|
|
120
120
|
type: Boolean,
|
|
121
121
|
reflect: !0
|
|
122
|
-
})],
|
|
122
|
+
})], k.prototype, "selected", void 0), m([C({ type: Boolean })], k.prototype, "expandable", void 0), m([C({ type: String })], k.prototype, "selectable", void 0), m([C({ type: Boolean })], k.prototype, "highlighted", void 0), m([C({ type: Object })], k.prototype, "i18n", void 0), m([d()], k.prototype, "slot", void 0), m([E({ slot: "nodes" })], k.prototype, "nodes", void 0), m([T()], k.prototype, "indeterminate", void 0), m([T()], k.prototype, "behaviorExpand", void 0), m([T()], k.prototype, "behaviorSelect", void 0), k = m([
|
|
123
123
|
e(),
|
|
124
|
-
|
|
125
|
-
c(),
|
|
124
|
+
u({ log: !1 }),
|
|
126
125
|
s(),
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
o(),
|
|
127
|
+
i(),
|
|
128
|
+
f(),
|
|
129
|
+
a()
|
|
130
|
+
], k);
|
|
131
131
|
//#endregion
|
|
132
|
-
export {
|
|
132
|
+
export { k as TreeNode };
|
|
133
133
|
|
|
134
134
|
//# sourceMappingURL=tree-node2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-node2.js","names":[],"sources":["../../src/tree/tree-node.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { LitElement, html, nothing } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { state } from 'lit/decorators/state.js';\nimport { queryAssignedElements } from 'lit/decorators/query-assigned-elements.js';\nimport {\n I18nController,\n TypeExpandableController,\n TypeSelectableController,\n attachInternals,\n audit,\n getFlattenedFocusableItems,\n hostAttr,\n isFocusable,\n scopedRegistry,\n stateExpanded,\n stateHighlighted,\n stateSelected,\n typeAnchor,\n typeSSR,\n useStyles\n} from '@nvidia-elements/core/internal';\nimport { IconButton } from '@nvidia-elements/core/icon-button';\nimport { Icon } from '@nvidia-elements/core/icon';\nimport { Checkbox } from '@nvidia-elements/core/checkbox';\nimport { TypeCommandController } from '@nvidia-elements/forms/internal';\nimport type { Tree } from './tree.js';\nimport styles from './tree-node.css?inline';\nimport { updateNodeSelection } from './utils.js';\n\n/**\n * @element nve-tree-node\n * @description A tree view widget presents a hierarchical list. Any item in the hierarchy may have child items, and items that have children can expand or collapse to show or hide the children.\n * @documentation https://nvidia.github.io/elements/docs/elements/tree/\n * @since 1.2.0\n * @entrypoint \\@nvidia-elements/core/tree\n * @event open - Dispatched when the node opens.\n * @event close - Dispatched when the node closes.\n * @event select - Dispatched when the node selection state changes.\n * @command --select - use to select the node\n * @command --deselect - use to deselect the node\n * @command --toggle-select - use to toggle the node selection state\n * @command --open - use to open the node\n * @command --close - use to close the node\n * @command --toggle - use to toggle open / closed state of the node\n * @slot - Use default slot for basic text content or nested <nve-tree-node> elements.\n * @slot prefix - Use for prefix content before the node title.\n * @slot suffix - Use for suffix content after the node title.\n * @slot content - Use only for extended long form content containing interactive elements or form inputs.\n * @cssprop --color\n * @cssprop --border-radius\n * @cssprop --font-size\n * @cssprop --min-height\n * @cssprop --text-wrap\n * @cssprop --font-weight\n * @cssprop --width\n\n * @csspart icon-button - The icon button element\n * @csspart icon - The icon element\n * @csspart checkbox - The checkbox element\n\n * @aria https://www.w3.org/WAI/ARIA/apg/patterns/treeview/\n *\n */\n@audit()\n@typeSSR({ log: false }) // warning about ssr mismatch disabled as tree node will never be a 1:1 match in ssr due to performance constraints and slot complexity\n@typeAnchor()\n@stateSelected()\n@stateExpanded()\n@scopedRegistry()\n@stateHighlighted()\nexport class TreeNode extends LitElement {\n /** Command to invoke on a node title click or Enter on its header. */\n @property({ type: String }) command = '';\n\n /** ID of the element that receives the command. */\n @property({ type: String, reflect: true }) commandfor: string | null = null;\n\n /** Direct command target, taking precedence over commandfor. */\n @property({ attribute: false }) commandForElement: HTMLElement | null = null;\n\n /**\n * Determines if node is in an expanded state.\n */\n @property({ type: Boolean, reflect: true }) expanded = false;\n\n /**\n * Determines whether if node is in a selected state.\n */\n @property({ type: Boolean, reflect: true }) selected = false;\n\n /**\n * Determines whether a node can be expandable. Expandable by default if slotted nodes exist.\n */\n @property({ type: Boolean }) expandable = false;\n\n /**\n * Determines whether a node can be in a selected state. Nodes can be in a single or multi select state.\n */\n @property({ type: String }) selectable: 'single' | 'multi';\n\n /**\n * Determines the highlighted state of the element. Highlighted states serve non-interactive selections where nodes may relate to other selected portions of the UI.\n */\n @property({ type: Boolean }) highlighted = false;\n\n #i18nController: I18nController<this> = new I18nController<this>(this);\n\n /**\n * Updates internal string values for internationalization.\n */\n @property({ type: Object }) i18n = this.#i18nController.i18n;\n\n /** @private */\n @hostAttr() slot = 'nodes';\n\n get #tree() {\n return this.closest<Tree>('nve-tree');\n }\n\n /**\n * Returns the slotted child tree nodes.\n */\n @queryAssignedElements({ slot: 'nodes' }) readonly nodes!: TreeNode[];\n\n /** @private */\n @state() indeterminate = false;\n\n /** @private */\n @state() behaviorExpand = false;\n\n /** @private */\n @state() behaviorSelect = false;\n\n #typeExpandableController = new TypeExpandableController(this);\n\n #typeSelectableController = new TypeSelectableController(this);\n\n #typeCommandController = new TypeCommandController(this, { events: [] });\n\n get #isExpandable() {\n return this.expandable || this.expanded || !!this.nodes?.length;\n }\n\n static metadata = {\n tag: 'nve-tree-node',\n version: '0.0.0',\n parents: ['nve-tree', 'nve-tree-node']\n };\n\n static elementDefinitions = {\n [IconButton.metadata.tag]: IconButton,\n [Icon.metadata.tag]: Icon,\n [Checkbox.metadata.tag]: Checkbox\n };\n\n static styles = useStyles([styles]);\n\n declare _internals: ElementInternals;\n\n /* eslint-disable @nvidia-elements/lint/no-missing-control-label */\n render() {\n return html`\n <div internal-host @slotchange=${this.#nodeUpdate}>\n <div part=\"_node\">\n ${\n this.#isExpandable\n ? html`\n <nve-icon-button part=\"icon-button\" exportparts=\"icon:icon-button-icon\" @pointerup=${this.#toggleExpand} role=\"presentation\" tabindex=\"-1\" size=\"sm\" container=\"inline\" nofocus>\n <nve-icon part=\"icon\" name=\"caret\" direction=${this.expanded ? 'down' : 'right'} size=\"sm\"></nve-icon>\n </nve-icon-button>`\n : nothing\n }\n ${\n this.selectable === 'multi'\n ? html`\n <nve-checkbox part=\"checkbox\" nofocus>\n <input type=\"checkbox\" @change=${this.#toggleMultiSelection} .checked=${this.selected} .indeterminate=${this.indeterminate} .ariaLabel=${this.i18n.expand} tabindex=\"-1\" />\n </nve-checkbox>`\n : nothing\n }\n <div tabindex=\"0\" part=\"_node-header\">\n <div class=\"node-title\" @click=${this.#nodeHeaderClick}>\n <slot name=\"prefix\" part=\"_prefix\"></slot>\n <slot></slot>\n <slot name=\"suffix\" part=\"_suffix\"></slot>\n </div>\n <slot name=\"content\" part=\"_content\"></slot>\n </div>\n </div>\n <div role=\"group\" part=\"_nodes\"><slot name=\"nodes\"></slot></div>\n </div>\n `;\n }\n\n connectedCallback() {\n super.connectedCallback();\n attachInternals(this);\n this._internals.role = 'treeitem';\n this.addEventListener('keydown', this.#onKeydown);\n this.addEventListener('keyup', this.#onKeyup);\n this.#nodeUpdate();\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('keydown', this.#onKeydown);\n this.removeEventListener('keyup', this.#onKeyup);\n }\n\n /** opens and sets the expanded state automatically if behaviorExpand is true */\n open() {\n this.#typeExpandableController.open();\n }\n\n /** closes and sets the expanded state automatically if behaviorExpand is true */\n close() {\n this.#typeExpandableController.close();\n }\n\n #nodeUpdate() {\n this.requestUpdate();\n this.#toggleExpandableState();\n }\n\n #toggleExpandableState() {\n this.#isExpandable ? this._internals.states.add('is-expandable') : this._internals.states.delete('is-expandable');\n }\n\n #onKeydown = (e: KeyboardEvent) => {\n const isSelectionKey = this.selectable && e.code === 'Space';\n const isExpansionKey = this.#isExpandable && (e.code === 'ArrowLeft' || e.code === 'ArrowRight');\n\n if (e.target === this && (isSelectionKey || isExpansionKey)) {\n e.preventDefault();\n }\n };\n\n #invokeFromKeyboard(e: KeyboardEvent) {\n if (e.code !== 'Enter' || e.defaultPrevented || e.repeat) {\n return;\n }\n const origin = e.composedPath()[0];\n const header = this.shadowRoot?.querySelector('[part=\"_node-header\"]');\n if (origin === header || origin === this) {\n this.#typeCommandController.invoke();\n }\n }\n\n #onKeyup = (e: KeyboardEvent) => {\n this.#invokeFromKeyboard(e);\n if (this.#isExpandable && e.code === 'ArrowLeft' && e.target === this) {\n this.close();\n }\n\n if (this.#isExpandable && e.code === 'ArrowRight' && e.target === this) {\n this.open();\n }\n\n if (e.code === 'Space' && e.target === this && this.selectable) {\n this.#toggleSelection();\n }\n };\n\n #nodeHeaderClick(e: Event) {\n const hasFocusableElements = getFlattenedFocusableItems(e.currentTarget as HTMLElement).length;\n if (this.#isExpandable && !this.selectable && !hasFocusableElements) {\n this.#toggleExpand();\n }\n\n if (this.selectable && (!hasFocusableElements || (e.target as HTMLElement).localName === 'a')) {\n this.#toggleSelection();\n }\n\n const path = e.composedPath();\n const hasInteractiveTarget = path\n .slice(0, path.indexOf(e.currentTarget as HTMLElement))\n .some(target => target instanceof Element && isFocusable(target));\n if (!hasInteractiveTarget && !e.defaultPrevented) {\n this.#typeCommandController.invoke();\n }\n }\n\n #toggleExpand() {\n this.#typeExpandableController.toggle();\n }\n\n #toggleSelection() {\n if (this.selectable === 'single') {\n this.#toggleSingleSelection();\n }\n\n if (this.selectable === 'multi') {\n this.#toggleMultiSelection();\n }\n }\n\n #toggleSingleSelection() {\n this.#typeSelectableController.toggle();\n if (this.behaviorSelect) {\n this.#tree!.nodes.filter(n => n !== this).forEach(n => (n.selected = false));\n }\n }\n\n #toggleMultiSelection() {\n this.#typeSelectableController.toggle();\n\n if (this.behaviorSelect) {\n this.nodes.forEach(n => {\n n.selected = this.selected;\n n.indeterminate = false;\n });\n this.#tree!.nodes.forEach(node => updateNodeSelection(node));\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEO,IAAM,IAAN,cAAuB,EAAW;;EAkL3B,aAhL0B,KAAA,UAAA,IAGiC,KAAA,aAAA,MAGC,KAAA,oBAAA,MAKjB,KAAA,WAAA,IAKA,KAAA,WAAA,IAKb,KAAA,aAAA,IAUC,KAAA,cAAA,IAEH,KAAA,KAAA,IAAI,EAAqB,IAAI,GAKlC,KAAA,OAAA,KAAK,GAAgB,MAGrC,KAAA,OAAA,SAYM,KAAA,gBAAA,IAGC,KAAA,iBAAA,IAGA,KAAA,iBAAA,IAEE,KAAA,KAAA,IAAI,EAAyB,IAAI,GAEjC,KAAA,KAAA,IAAI,EAAyB,IAAI,GAEpC,KAAA,KAAA,IAAI,EAAsB,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,GA2FzD,KAAA,MAAA,MAAqB;GACjC,IAAM,IAAiB,KAAK,cAAc,EAAE,SAAS,SAC/C,IAAiB,KAAK,OAAkB,EAAE,SAAS,eAAe,EAAE,SAAS;GAEnF,AAAI,EAAE,WAAW,SAAS,KAAkB,MAC1C,EAAE,eAAe;EAErB,GAaY,KAAA,MAAA,MAAqB;GAU/B,AATA,KAAK,GAAoB,CAAC,GACtB,KAAK,MAAiB,EAAE,SAAS,eAAe,EAAE,WAAW,QAC/D,KAAK,MAAM,GAGT,KAAK,MAAiB,EAAE,SAAS,gBAAgB,EAAE,WAAW,QAChE,KAAK,KAAK,GAGR,EAAE,SAAS,WAAW,EAAE,WAAW,QAAQ,KAAK,cAClD,KAAK,GAAiB;EAE1B;;CA5JA;CAUA,IAAI,KAAQ;EACV,OAAO,KAAK,QAAc,UAAU;CACtC;CAgBA;CAEA;CAEA;CAEA,IAAI,KAAgB;EAClB,OAAO,KAAK,cAAc,KAAK,YAAY,CAAC,CAAC,KAAK,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rightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { LitElement, html, nothing } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { state } from 'lit/decorators/state.js';\nimport { queryAssignedElements } from 'lit/decorators/query-assigned-elements.js';\nimport {\n TypeExpandableController,\n TypeSelectableController,\n attachInternals,\n audit,\n getFlattenedFocusableItems,\n hostAttr,\n isFocusable,\n scopedRegistry,\n stateExpanded,\n stateHighlighted,\n stateSelected,\n typeAnchor,\n typeSSR,\n useStyles\n} from '@nvidia-elements/core/internal';\nimport { I18nController, type I18nDefaults } from '@nvidia-elements/foundations/internal/i18n';\nimport { IconButton } from '@nvidia-elements/core/icon-button';\nimport { Icon } from '@nvidia-elements/core/icon';\nimport { Checkbox } from '@nvidia-elements/core/checkbox';\nimport { TypeCommandController } from '@nvidia-elements/forms/internal';\nimport type { Tree } from './tree.js';\nimport styles from './tree-node.css?inline';\nimport { updateNodeSelection } from './utils.js';\n\nconst i18nDefaults = {\n expand: 'expand'\n} satisfies I18nDefaults;\n\n/**\n * @element nve-tree-node\n * @description A tree view widget presents a hierarchical list. Any item in the hierarchy may have child items, and items that have children can expand or collapse to show or hide the children.\n * @documentation https://nvidia.github.io/elements/docs/elements/tree/\n * @since 1.2.0\n * @entrypoint \\@nvidia-elements/core/tree\n * @event open - Dispatched when the node opens.\n * @event close - Dispatched when the node closes.\n * @event select - Dispatched when the node selection state changes.\n * @command --select - use to select the node\n * @command --deselect - use to deselect the node\n * @command --toggle-select - use to toggle the node selection state\n * @command --open - use to open the node\n * @command --close - use to close the node\n * @command --toggle - use to toggle open / closed state of the node\n * @slot - Use default slot for basic text content or nested <nve-tree-node> elements.\n * @slot prefix - Use for prefix content before the node title.\n * @slot suffix - Use for suffix content after the node title.\n * @slot content - Use only for extended long form content containing interactive elements or form inputs.\n * @cssprop --color\n * @cssprop --border-radius\n * @cssprop --font-size\n * @cssprop --min-height\n * @cssprop --text-wrap\n * @cssprop --font-weight\n * @cssprop --width\n\n * @csspart icon-button - The icon button element\n * @csspart icon - The icon element\n * @csspart checkbox - The checkbox element\n\n * @aria https://www.w3.org/WAI/ARIA/apg/patterns/treeview/\n *\n */\n@audit()\n@typeSSR({ log: false }) // warning about ssr mismatch disabled as tree node will never be a 1:1 match in ssr due to performance constraints and slot complexity\n@typeAnchor()\n@stateSelected()\n@stateExpanded()\n@scopedRegistry()\n@stateHighlighted()\nexport class TreeNode extends LitElement {\n /** Command to invoke on a node title click or Enter on its header. */\n @property({ type: String }) command = '';\n\n /** ID of the element that receives the command. */\n @property({ type: String, reflect: true }) commandfor: string | null = null;\n\n /** Direct command target, taking precedence over commandfor. */\n @property({ attribute: false }) commandForElement: HTMLElement | null = null;\n\n /**\n * Determines if node is in an expanded state.\n */\n @property({ type: Boolean, reflect: true }) expanded = false;\n\n /**\n * Determines whether if node is in a selected state.\n */\n @property({ type: Boolean, reflect: true }) selected = false;\n\n /**\n * Determines whether a node can be expandable. Expandable by default if slotted nodes exist.\n */\n @property({ type: Boolean }) expandable = false;\n\n /**\n * Determines whether a node can be in a selected state. Nodes can be in a single or multi select state.\n */\n @property({ type: String }) selectable: 'single' | 'multi';\n\n /**\n * Determines the highlighted state of the element. Highlighted states serve non-interactive selections where nodes may relate to other selected portions of the UI.\n */\n @property({ type: Boolean }) highlighted = false;\n\n #i18nController: I18nController<this> = new I18nController<this>(this, i18nDefaults);\n\n /**\n * Updates internal string values for internationalization.\n */\n @property({ type: Object }) i18n = this.#i18nController.i18n;\n\n /** @private */\n @hostAttr() slot = 'nodes';\n\n get #tree() {\n return this.closest<Tree>('nve-tree');\n }\n\n /**\n * Returns the slotted child tree nodes.\n */\n @queryAssignedElements({ slot: 'nodes' }) readonly nodes!: TreeNode[];\n\n /** @private */\n @state() indeterminate = false;\n\n /** @private */\n @state() behaviorExpand = false;\n\n /** @private */\n @state() behaviorSelect = false;\n\n #typeExpandableController = new TypeExpandableController(this);\n\n #typeSelectableController = new TypeSelectableController(this);\n\n #typeCommandController = new TypeCommandController(this, { events: [] });\n\n get #isExpandable() {\n return this.expandable || this.expanded || !!this.nodes?.length;\n }\n\n static metadata = {\n tag: 'nve-tree-node',\n version: '0.0.0',\n parents: ['nve-tree', 'nve-tree-node']\n };\n\n static elementDefinitions = {\n [IconButton.metadata.tag]: IconButton,\n [Icon.metadata.tag]: Icon,\n [Checkbox.metadata.tag]: Checkbox\n };\n\n static styles = useStyles([styles]);\n\n declare _internals: ElementInternals;\n\n /* eslint-disable @nvidia-elements/lint/no-missing-control-label */\n render() {\n return html`\n <div internal-host @slotchange=${this.#nodeUpdate}>\n <div part=\"_node\">\n ${\n this.#isExpandable\n ? html`\n <nve-icon-button part=\"icon-button\" exportparts=\"icon:icon-button-icon\" @pointerup=${this.#toggleExpand} role=\"presentation\" tabindex=\"-1\" size=\"sm\" container=\"inline\" nofocus>\n <nve-icon part=\"icon\" name=\"caret\" direction=${this.expanded ? 'down' : 'right'} size=\"sm\"></nve-icon>\n </nve-icon-button>`\n : nothing\n }\n ${\n this.selectable === 'multi'\n ? html`\n <nve-checkbox part=\"checkbox\" nofocus>\n <input type=\"checkbox\" @change=${this.#toggleMultiSelection} .checked=${this.selected} .indeterminate=${this.indeterminate} .ariaLabel=${this.i18n.expand} tabindex=\"-1\" />\n </nve-checkbox>`\n : nothing\n }\n <div tabindex=\"0\" part=\"_node-header\">\n <div class=\"node-title\" @click=${this.#nodeHeaderClick}>\n <slot name=\"prefix\" part=\"_prefix\"></slot>\n <slot></slot>\n <slot name=\"suffix\" part=\"_suffix\"></slot>\n </div>\n <slot name=\"content\" part=\"_content\"></slot>\n </div>\n </div>\n <div role=\"group\" part=\"_nodes\"><slot name=\"nodes\"></slot></div>\n </div>\n `;\n }\n\n connectedCallback() {\n super.connectedCallback();\n attachInternals(this);\n this._internals.role = 'treeitem';\n this.addEventListener('keydown', this.#onKeydown);\n this.addEventListener('keyup', this.#onKeyup);\n this.#nodeUpdate();\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('keydown', this.#onKeydown);\n this.removeEventListener('keyup', this.#onKeyup);\n }\n\n /** opens and sets the expanded state automatically if behaviorExpand is true */\n open() {\n this.#typeExpandableController.open();\n }\n\n /** closes and sets the expanded state automatically if behaviorExpand is true */\n close() {\n this.#typeExpandableController.close();\n }\n\n #nodeUpdate() {\n this.requestUpdate();\n this.#toggleExpandableState();\n }\n\n #toggleExpandableState() {\n this.#isExpandable ? this._internals.states.add('is-expandable') : this._internals.states.delete('is-expandable');\n }\n\n #onKeydown = (e: KeyboardEvent) => {\n const isSelectionKey = this.selectable && e.code === 'Space';\n const isExpansionKey = this.#isExpandable && (e.code === 'ArrowLeft' || e.code === 'ArrowRight');\n\n if (e.target === this && (isSelectionKey || isExpansionKey)) {\n e.preventDefault();\n }\n };\n\n #invokeFromKeyboard(e: KeyboardEvent) {\n if (e.code !== 'Enter' || e.defaultPrevented || e.repeat) {\n return;\n }\n const origin = e.composedPath()[0];\n const header = this.shadowRoot?.querySelector('[part=\"_node-header\"]');\n if (origin === header || origin === this) {\n this.#typeCommandController.invoke();\n }\n }\n\n #onKeyup = (e: KeyboardEvent) => {\n this.#invokeFromKeyboard(e);\n if (this.#isExpandable && e.code === 'ArrowLeft' && e.target === this) {\n this.close();\n }\n\n if (this.#isExpandable && e.code === 'ArrowRight' && e.target === this) {\n this.open();\n }\n\n if (e.code === 'Space' && e.target === this && this.selectable) {\n this.#toggleSelection();\n }\n };\n\n #nodeHeaderClick(e: Event) {\n const hasFocusableElements = getFlattenedFocusableItems(e.currentTarget as HTMLElement).length;\n if (this.#isExpandable && !this.selectable && !hasFocusableElements) {\n this.#toggleExpand();\n }\n\n if (this.selectable && (!hasFocusableElements || (e.target as HTMLElement).localName === 'a')) {\n this.#toggleSelection();\n }\n\n const path = e.composedPath();\n const hasInteractiveTarget = path\n .slice(0, path.indexOf(e.currentTarget as HTMLElement))\n .some(target => target instanceof Element && isFocusable(target));\n if (!hasInteractiveTarget && !e.defaultPrevented) {\n this.#typeCommandController.invoke();\n }\n }\n\n #toggleExpand() {\n this.#typeExpandableController.toggle();\n }\n\n #toggleSelection() {\n if (this.selectable === 'single') {\n this.#toggleSingleSelection();\n }\n\n if (this.selectable === 'multi') {\n this.#toggleMultiSelection();\n }\n }\n\n #toggleSingleSelection() {\n this.#typeSelectableController.toggle();\n if (this.behaviorSelect) {\n this.#tree!.nodes.filter(n => n !== this).forEach(n => (n.selected = false));\n }\n }\n\n #toggleMultiSelection() {\n this.#typeSelectableController.toggle();\n\n if (this.behaviorSelect) {\n this.nodes.forEach(n => {\n n.selected = this.selected;\n n.indeterminate = false;\n });\n this.#tree!.nodes.forEach(node => updateNodeSelection(node));\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAM,IAAe,EACnB,QAAQ,SACV,GA2Ca,IAAN,cAAuB,EAAW;;EAkL3B,aAhL0B,KAAA,UAAA,IAGiC,KAAA,aAAA,MAGC,KAAA,oBAAA,MAKjB,KAAA,WAAA,IAKA,KAAA,WAAA,IAKb,KAAA,aAAA,IAUC,KAAA,cAAA,IAEH,KAAA,KAAA,IAAI,EAAqB,MAAM,CAAY,GAKhD,KAAA,OAAA,KAAK,GAAgB,MAGrC,KAAA,OAAA,SAYM,KAAA,gBAAA,IAGC,KAAA,iBAAA,IAGA,KAAA,iBAAA,IAEE,KAAA,KAAA,IAAI,EAAyB,IAAI,GAEjC,KAAA,KAAA,IAAI,EAAyB,IAAI,GAEpC,KAAA,KAAA,IAAI,EAAsB,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,GA2FzD,KAAA,MAAA,MAAqB;GACjC,IAAM,IAAiB,KAAK,cAAc,EAAE,SAAS,SAC/C,IAAiB,KAAK,OAAkB,EAAE,SAAS,eAAe,EAAE,SAAS;GAEnF,AAAI,EAAE,WAAW,SAAS,KAAkB,MAC1C,EAAE,eAAe;EAErB,GAaY,KAAA,MAAA,MAAqB;GAU/B,AATA,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AAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,iBAAA,KAAA,CAAA,GAGN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,kBAAA,KAAA,CAAA,GAGN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,kBAAA,KAAA,CAAA;CApER,EAAM;CACN,EAAQ,EAAE,KAAK,GAAM,CAAC;CACtB,EAAW;CACX,EAAc;CACd,EAAc;CACd,EAAe;CACf,EAAiB"}
|
package/dist/tree/tree2.js
CHANGED
package/dist/week/week.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ContainerElement } from '@nvidia-elements/core/internal';
|
|
2
2
|
import { Control } from '@nvidia-elements/core/forms';
|
|
3
3
|
import { IconButton } from '@nvidia-elements/core/icon-button';
|
|
4
|
+
import type { I18nDefaults } from '@nvidia-elements/foundations/internal/i18n';
|
|
4
5
|
/**
|
|
5
6
|
* @element nve-week
|
|
6
7
|
* @description A week picker is a control that enables users to choose a week value.
|
|
@@ -18,6 +19,7 @@ import { IconButton } from '@nvidia-elements/core/icon-button';
|
|
|
18
19
|
* @aria https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/week
|
|
19
20
|
*/
|
|
20
21
|
export declare class Week extends Control implements ContainerElement {
|
|
22
|
+
protected get i18nDefaults(): I18nDefaults;
|
|
21
23
|
/**
|
|
22
24
|
* Reduces the visual container for a minimal borderless appearance while preserving whitespace bounds.
|
|
23
25
|
* Use when embedding within another container such as a toolbar.
|
package/dist/week/week2.js
CHANGED
|
@@ -8,7 +8,10 @@ import o from "./week.js";
|
|
|
8
8
|
import { html as s } from "lit";
|
|
9
9
|
import { property as c } from "lit/decorators/property.js";
|
|
10
10
|
//#region src/week/week.ts
|
|
11
|
-
var l = class extends r {
|
|
11
|
+
var l = { expand: "expand" }, u = class extends r {
|
|
12
|
+
get i18nDefaults() {
|
|
13
|
+
return l;
|
|
14
|
+
}
|
|
12
15
|
static {
|
|
13
16
|
this.styles = t([
|
|
14
17
|
...r.styles,
|
|
@@ -19,7 +22,7 @@ var l = class extends r {
|
|
|
19
22
|
static {
|
|
20
23
|
this.metadata = {
|
|
21
24
|
tag: "nve-week",
|
|
22
|
-
version: "2.
|
|
25
|
+
version: "2.20.0"
|
|
23
26
|
};
|
|
24
27
|
}
|
|
25
28
|
static {
|
|
@@ -32,8 +35,8 @@ var l = class extends r {
|
|
|
32
35
|
n([c({
|
|
33
36
|
type: String,
|
|
34
37
|
reflect: !0
|
|
35
|
-
})],
|
|
38
|
+
})], u.prototype, "container", void 0), u = n([e()], u);
|
|
36
39
|
//#endregion
|
|
37
|
-
export {
|
|
40
|
+
export { u as Week };
|
|
38
41
|
|
|
39
42
|
//# sourceMappingURL=week2.js.map
|
package/dist/week/week2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"week2.js","names":[],"sources":["../../src/week/week.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport type { ContainerElement } from '@nvidia-elements/core/internal';\nimport { scopedRegistry, useStyles } from '@nvidia-elements/core/internal';\nimport { Control } from '@nvidia-elements/core/forms';\nimport { IconButton } from '@nvidia-elements/core/icon-button';\nimport { inputStyles } from '@nvidia-elements/core/input';\nimport styles from './week.css?inline';\n\n/**\n * @element nve-week\n * @description A week picker is a control that enables users to choose a week value.\n * @documentation https://nvidia.github.io/elements/docs/elements/week/\n * @since 0.3.0\n * @entrypoint \\@nvidia-elements/core/week\n * @cssprop --padding\n * @cssprop --font-size\n * @cssprop --height\n * @cssprop --background\n * @cssprop --border-radius\n * @cssprop --border\n * @cssprop --cursor\n * @csspart icon-button - The calendar icon button element\n * @aria https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/week\n */\n@scopedRegistry()\nexport class Week extends Control implements ContainerElement {\n /**\n * Reduces the visual container for a minimal borderless appearance while preserving whitespace bounds.\n * Use when embedding within another container such as a toolbar.\n */\n @property({ type: String, reflect: true }) container?: 'flat';\n\n static styles = useStyles([...Control.styles, inputStyles, styles]);\n\n static readonly metadata = {\n tag: 'nve-week',\n version: '0.0.0'\n };\n\n static elementDefinitions = {\n [IconButton.metadata.tag]: IconButton\n };\n\n protected get suffixContent() {\n return html`<nve-icon-button exportparts=\"icon:icon-button-icon\" part=\"icon-button\" .ariaLabel=${this.i18n.expand} icon-name=\"calendar\" container=\"inline\" @click=${this.showPicker}></nve-icon-button>`;\n }\n}\n"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"week2.js","names":[],"sources":["../../src/week/week.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport type { ContainerElement } from '@nvidia-elements/core/internal';\nimport { scopedRegistry, useStyles } from '@nvidia-elements/core/internal';\nimport { Control } from '@nvidia-elements/core/forms';\nimport { IconButton } from '@nvidia-elements/core/icon-button';\nimport { inputStyles } from '@nvidia-elements/core/input';\nimport type { I18nDefaults } from '@nvidia-elements/foundations/internal/i18n';\nimport styles from './week.css?inline';\n\nconst i18nDefaults = {\n expand: 'expand'\n} satisfies I18nDefaults;\n\n/**\n * @element nve-week\n * @description A week picker is a control that enables users to choose a week value.\n * @documentation https://nvidia.github.io/elements/docs/elements/week/\n * @since 0.3.0\n * @entrypoint \\@nvidia-elements/core/week\n * @cssprop --padding\n * @cssprop --font-size\n * @cssprop --height\n * @cssprop --background\n * @cssprop --border-radius\n * @cssprop --border\n * @cssprop --cursor\n * @csspart icon-button - The calendar icon button element\n * @aria https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/week\n */\n@scopedRegistry()\nexport class Week extends Control implements ContainerElement {\n protected override get i18nDefaults(): I18nDefaults {\n return i18nDefaults;\n }\n\n /**\n * Reduces the visual container for a minimal borderless appearance while preserving whitespace bounds.\n * Use when embedding within another container such as a toolbar.\n */\n @property({ type: String, reflect: true }) container?: 'flat';\n\n static styles = useStyles([...Control.styles, inputStyles, styles]);\n\n static readonly metadata = {\n tag: 'nve-week',\n version: '0.0.0'\n };\n\n static elementDefinitions = {\n [IconButton.metadata.tag]: IconButton\n };\n\n protected get suffixContent() {\n return html`<nve-icon-button exportparts=\"icon:icon-button-icon\" part=\"icon-button\" .ariaLabel=${this.i18n.expand} icon-name=\"calendar\" container=\"inline\" @click=${this.showPicker}></nve-icon-button>`;\n }\n}\n"],"mappings":";;;;;;;;;;AAaA,IAAM,IAAe,EACnB,QAAQ,SACV,GAmBa,IAAN,cAAmB,EAAoC;CAC5D,IAAuB,eAA6B;EAClD,OAAO;CACT;;EAQgB,KAAA,SAAA,EAAU;GAAC,GAAG,EAAQ;GAAQ;GAAa;EAAM,CAAC;;;EAEvC,KAAA,WAAA;GACzB,KAAK;GACL,SAAS;EACX;;;EAE4B,KAAA,qBAAA,GACzB,EAAW,SAAS,MAAM,EAC7B;;CAEA,IAAc,gBAAgB;EAC5B,OAAO,CAAI,uFAAsF,KAAK,KAAK,OAAO,oDAAkD,KAAK,WAAW;CACtL;AACF;AAhBG,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,aAAA,KAAA,CAAA,GAV1C,IAAA,EAAA,CAAA,EAAe,CAAA,GAAA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nvidia-elements/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.20.0",
|
|
4
4
|
"release": {
|
|
5
5
|
"extends": "../../release.config.js"
|
|
6
6
|
},
|
|
@@ -526,6 +526,18 @@
|
|
|
526
526
|
"types": "./dist/input/define.d.ts",
|
|
527
527
|
"default": "./dist/input/define.js"
|
|
528
528
|
},
|
|
529
|
+
"./joystick": {
|
|
530
|
+
"types": "./dist/joystick/index.d.ts",
|
|
531
|
+
"default": "./dist/joystick/index.js"
|
|
532
|
+
},
|
|
533
|
+
"./joystick/index.js": {
|
|
534
|
+
"types": "./dist/joystick/index.d.ts",
|
|
535
|
+
"default": "./dist/joystick/index.js"
|
|
536
|
+
},
|
|
537
|
+
"./joystick/define.js": {
|
|
538
|
+
"types": "./dist/joystick/define.d.ts",
|
|
539
|
+
"default": "./dist/joystick/define.js"
|
|
540
|
+
},
|
|
529
541
|
"./logo": {
|
|
530
542
|
"types": "./dist/logo/index.d.ts",
|
|
531
543
|
"default": "./dist/logo/index.js"
|
|
@@ -999,7 +1011,7 @@
|
|
|
999
1011
|
}
|
|
1000
1012
|
},
|
|
1001
1013
|
"dependencies": {
|
|
1002
|
-
"@nvidia-elements/foundations": "^1.0
|
|
1014
|
+
"@nvidia-elements/foundations": "^1.1.0",
|
|
1003
1015
|
"@nvidia-elements/forms": "^2.0.10",
|
|
1004
1016
|
"lit": "^3.3.3",
|
|
1005
1017
|
"lit-html": "^3.3.3"
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ReactiveController, ReactiveElement } from 'lit';
|
|
2
|
-
import type { I18nStrings } from '../services/i18n.service.js';
|
|
3
|
-
export declare function i18n<T extends I18n>(): ClassDecorator;
|
|
4
|
-
export type I18n = ReactiveElement & {
|
|
5
|
-
i18n: Partial<I18nStrings> & {
|
|
6
|
-
__set?: boolean;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
export declare class I18nController<T extends I18n> implements ReactiveController {
|
|
10
|
-
#private;
|
|
11
|
-
private host;
|
|
12
|
-
get i18n(): Partial<I18nStrings & {
|
|
13
|
-
__set: boolean;
|
|
14
|
-
}>;
|
|
15
|
-
constructor(host: T);
|
|
16
|
-
hostConnected(): void;
|
|
17
|
-
hostDisconnected(): void;
|
|
18
|
-
hostUpdate(): void;
|
|
19
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.controller.examples.js","names":[],"sources":["../../../src/internal/controllers/i18n.controller.examples.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { I18nController } from '@nvidia-elements/core/internal';\nimport { I18nService } from '@nvidia-elements/core';\nimport '@nvidia-elements/core/card/define.js';\nimport '@nvidia-elements/core/button/define.js';\n\nexport default {\n title: 'Internal/Controllers'\n}\n\nclass I18nItem extends LitElement {\n #i18nController: I18nController<this> = new I18nController<this>(this);\n @property({ type: Object }) i18n = this.#i18nController.i18n;\n\n render() {\n return html`<nve-card><pre style=\"padding: 24px\">${JSON.stringify(this.i18n, null, 2)}</pre></nve-card>`\n }\n}\ncustomElements.get('i18n-item') || customElements.define('i18n-item', I18nItem);\n\nclass I18nDemo extends LitElement {\n render() {\n return html`\n <div nve-layout=\"column gap:md\">\n <div nve-layout=\"row gap:sm\">\n <nve-button @click=${() => this.#english()}>English</nve-button>\n <nve-button @click=${() => this.#french()}>French</nve-button>\n </div>\n \n <div nve-layout=\"grid span-items:6 gap:sm\">\n <i18n-item .i18n=${{ \"close\": \"dismiss task failure warning\" }}></i18n-item>\n <i18n-item></i18n-item>\n </div>\n </div>\n `\n }\n\n createRenderRoot() {\n return this;\n }\n\n #french() {\n I18nService.update({\n close: 'fermer',\n expand: 'étendre',\n sort: 'classer',\n show: 'montrer',\n hide: 'cacher',\n loading: 'bourrage'\n });\n }\n\n #english() {\n I18nService.update({\n close: 'close',\n expand: 'expand',\n sort: 'sort',\n show: 'show',\n hide: 'hide',\n loading: 'loading'\n });\n }\n}\ncustomElements.get('i18n-demo') || customElements.define('i18n-demo', I18nDemo);\n\n/**\n * @summary Internationalization controller with dynamic language switching between English and French.\n * @tags test-case\n */\nexport const I18nControllerDemo = {\n render: () => html`<i18n-demo></i18n-demo>`\n}\n"],"mappings":";AAGA,IAAA,IAAe"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"entrypoint": "@nvidia-elements/core/internal/controllers/i18n.controller.examples.json",
|
|
3
|
-
"items": [
|
|
4
|
-
{
|
|
5
|
-
"id": "internal-controllers-i18n.controller-i18n-controller-demo",
|
|
6
|
-
"name": "I18nControllerDemo",
|
|
7
|
-
"template": "<i18n-demo></i18n-demo>\n",
|
|
8
|
-
"summary": "Internationalization controller with dynamic language switching between English and French.",
|
|
9
|
-
"description": "",
|
|
10
|
-
"composition": false,
|
|
11
|
-
"tags": [
|
|
12
|
-
"test-case"
|
|
13
|
-
]
|
|
14
|
-
}
|
|
15
|
-
]
|
|
16
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { I18nService as e } from "../services/i18n.service.js";
|
|
2
|
-
//#region src/internal/controllers/i18n.controller.ts
|
|
3
|
-
function t() {
|
|
4
|
-
return (e) => e.addInitializer((e) => new n(e));
|
|
5
|
-
}
|
|
6
|
-
var n = class {
|
|
7
|
-
get i18n() {
|
|
8
|
-
return {
|
|
9
|
-
...e.i18n,
|
|
10
|
-
...this.host.i18n,
|
|
11
|
-
__set: !1
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
#e = {};
|
|
15
|
-
constructor(e) {
|
|
16
|
-
this.host = e, this.host.addController(this);
|
|
17
|
-
}
|
|
18
|
-
hostConnected() {
|
|
19
|
-
globalThis.document.addEventListener("NVE_ELEMENTS_I18N_UPDATE", this.#t);
|
|
20
|
-
}
|
|
21
|
-
hostDisconnected() {
|
|
22
|
-
globalThis.document.removeEventListener("NVE_ELEMENTS_I18N_UPDATE", this.#t);
|
|
23
|
-
}
|
|
24
|
-
hostUpdate() {
|
|
25
|
-
this.host.i18n.__set === void 0 && (this.#e = this.host.i18n, this.#t());
|
|
26
|
-
}
|
|
27
|
-
#t = () => {
|
|
28
|
-
this.host.i18n = {
|
|
29
|
-
...e.i18n,
|
|
30
|
-
...this.#e,
|
|
31
|
-
__set: !0
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
//#endregion
|
|
36
|
-
export { n as I18nController, t as i18n };
|
|
37
|
-
|
|
38
|
-
//# sourceMappingURL=i18n.controller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.controller.js","names":[],"sources":["../../../src/internal/controllers/i18n.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 type { I18nStrings } from '../services/i18n.service.js';\nimport { I18nService } from '../services/i18n.service.js';\n\nexport function i18n<T extends I18n>(): ClassDecorator {\n return (target: LegacyDecoratorTarget) => target.addInitializer!((instance: T) => new I18nController(instance));\n}\n\nexport type I18n = ReactiveElement & { i18n: Partial<I18nStrings> & { __set?: boolean } };\n\nexport class I18nController<T extends I18n> implements ReactiveController {\n get i18n(): Partial<I18nStrings & { __set: boolean }> {\n return { ...I18nService.i18n, ...this.host.i18n, __set: false };\n }\n\n #overrides: Partial<I18nStrings> = {};\n\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n hostConnected() {\n globalThis.document.addEventListener('NVE_ELEMENTS_I18N_UPDATE', this.#update);\n }\n\n hostDisconnected() {\n globalThis.document.removeEventListener('NVE_ELEMENTS_I18N_UPDATE', this.#update);\n }\n\n hostUpdate() {\n if (this.host.i18n.__set === undefined) {\n // if the host lacks a set, an override exists; merging before render keeps it in the same update cycle\n this.#overrides = this.host.i18n;\n this.#update();\n }\n }\n\n #update = () => {\n this.host.i18n = { ...I18nService.i18n, ...this.#overrides, __set: true };\n };\n}\n"],"mappings":";;AAQA,SAAgB,IAAuC;CACrD,QAAQ,MAAkC,EAAO,gBAAiB,MAAgB,IAAI,EAAe,CAAQ,CAAC;AAChH;AAIA,IAAa,IAAb,MAA0E;CACxE,IAAI,OAAkD;EACpD,OAAO;GAAE,GAAG,EAAY;GAAM,GAAG,KAAK,KAAK;GAAM,OAAO;EAAM;CAChE;CAEA,KAAmC,CAAC;CAEpC,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAA,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EACd,WAAW,SAAS,iBAAiB,4BAA4B,KAAK,EAAO;CAC/E;CAEA,mBAAmB;EACjB,WAAW,SAAS,oBAAoB,4BAA4B,KAAK,EAAO;CAClF;CAEA,aAAa;EACX,AAAI,KAAK,KAAK,KAAK,UAAU,KAAA,MAE3B,KAAK,KAAa,KAAK,KAAK,MAC5B,KAAK,GAAQ;CAEjB;CAEA,WAAgB;EACd,KAAK,KAAK,OAAO;GAAE,GAAG,EAAY;GAAM,GAAG,KAAK;GAAY,OAAO;EAAK;CAC1E;AACF"}
|