@nvidia-elements/core 2.4.1 → 2.5.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.
Files changed (135) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/NOTICE.md +1 -222
  3. package/dist/accordion/accordion2.js +4 -4
  4. package/dist/alert/alert-group2.js +1 -1
  5. package/dist/alert/alert2.js +1 -1
  6. package/dist/avatar/avatar-group2.js +1 -1
  7. package/dist/avatar/avatar2.js +1 -1
  8. package/dist/badge/badge2.js +1 -1
  9. package/dist/breadcrumb/breadcrumb2.js +1 -1
  10. package/dist/bundle.d.ts +2 -0
  11. package/dist/bundles/index.d.ts +41 -0
  12. package/dist/bundles/index.js +6 -6
  13. package/dist/button/button2.js +1 -1
  14. package/dist/button-group/button-group2.js +1 -1
  15. package/dist/card/card2.js +4 -4
  16. package/dist/chat-message/chat-message2.js +1 -1
  17. package/dist/checkbox/checkbox-group2.js +1 -1
  18. package/dist/checkbox/checkbox2.js +1 -1
  19. package/dist/color/color2.js +1 -1
  20. package/dist/combobox/combobox2.js +1 -1
  21. package/dist/copy-button/copy-button2.js +1 -1
  22. package/dist/custom-elements-jsx.d.ts +21 -0
  23. package/dist/custom-elements-vue.d.ts +21 -0
  24. package/dist/custom-elements.json +362 -0
  25. package/dist/data.html.json +40 -0
  26. package/dist/data.snippets.json +18 -18
  27. package/dist/date/date2.js +1 -1
  28. package/dist/datetime/datetime2.js +1 -1
  29. package/dist/dialog/dialog-footer2.js +1 -1
  30. package/dist/dialog/dialog-header2.js +1 -1
  31. package/dist/dialog/dialog2.js +1 -1
  32. package/dist/divider/divider2.js +1 -1
  33. package/dist/dot/dot2.js +1 -1
  34. package/dist/drawer/drawer-content2.js +1 -1
  35. package/dist/drawer/drawer-footer2.js +1 -1
  36. package/dist/drawer/drawer-header2.js +1 -1
  37. package/dist/drawer/drawer2.js +1 -1
  38. package/dist/dropdown/dropdown-footer2.js +1 -1
  39. package/dist/dropdown/dropdown-header2.js +1 -1
  40. package/dist/dropdown/dropdown2.js +1 -1
  41. package/dist/dropdown-group/dropdown-group.js +1 -1
  42. package/dist/dropzone/dropzone2.js +1 -1
  43. package/dist/file/file2.js +1 -1
  44. package/dist/format-bytes/format-bytes2.js +1 -1
  45. package/dist/format-datetime/format-datetime2.js +1 -1
  46. package/dist/format-number/format-number2.js +1 -1
  47. package/dist/format-relative-time/format-relative-time2.js +1 -1
  48. package/dist/format-truncate/define.d.ts +6 -0
  49. package/dist/format-truncate/define.js +7 -0
  50. package/dist/format-truncate/define.js.map +1 -0
  51. package/dist/format-truncate/format-truncate.d.ts +41 -0
  52. package/dist/format-truncate/format-truncate.examples.js +6 -0
  53. package/dist/format-truncate/format-truncate.examples.js.map +1 -0
  54. package/dist/format-truncate/format-truncate.examples.json +70 -0
  55. package/dist/format-truncate/format-truncate.js +6 -0
  56. package/dist/format-truncate/format-truncate.js.map +1 -0
  57. package/dist/format-truncate/format-truncate2.js +118 -0
  58. package/dist/format-truncate/format-truncate2.js.map +1 -0
  59. package/dist/format-truncate/index.d.ts +1 -0
  60. package/dist/format-truncate/index.js +2 -0
  61. package/dist/format-truncate/utils.d.ts +14 -0
  62. package/dist/format-truncate/utils.js +114 -0
  63. package/dist/format-truncate/utils.js.map +1 -0
  64. package/dist/forms/control/control2.js +1 -1
  65. package/dist/forms/control-group/control-group2.js +1 -1
  66. package/dist/forms/control-message/control-message2.js +1 -1
  67. package/dist/gauge/gauge.d.ts +2 -0
  68. package/dist/gauge/gauge.examples.js.map +1 -1
  69. package/dist/gauge/gauge.examples.json +1 -1
  70. package/dist/gauge/gauge.js +1 -1
  71. package/dist/gauge/gauge.js.map +1 -1
  72. package/dist/gauge/gauge2.js +68 -31
  73. package/dist/gauge/gauge2.js.map +1 -1
  74. package/dist/grid/cell/cell2.js +1 -1
  75. package/dist/grid/column/column2.js +1 -1
  76. package/dist/grid/footer/footer2.js +1 -1
  77. package/dist/grid/grid2.js +1 -1
  78. package/dist/grid/header/header2.js +1 -1
  79. package/dist/grid/placeholder/placeholder2.js +1 -1
  80. package/dist/grid/row/row2.js +1 -1
  81. package/dist/icon/icon2.js +2 -2
  82. package/dist/icon-button/icon-button2.js +1 -1
  83. package/dist/index.js +1 -1
  84. package/dist/input/input-group2.js +1 -1
  85. package/dist/input/input2.js +1 -1
  86. package/dist/internal/services/global.service.js +1 -1
  87. package/dist/logo/logo2.js +1 -1
  88. package/dist/menu/menu-item2.js +1 -1
  89. package/dist/menu/menu2.js +1 -1
  90. package/dist/month/month2.js +1 -1
  91. package/dist/notification/notification-group2.js +1 -1
  92. package/dist/notification/notification2.js +1 -1
  93. package/dist/page/page-panel/page-panel-content2.js +1 -1
  94. package/dist/page/page-panel/page-panel-footer2.js +1 -1
  95. package/dist/page/page-panel/page-panel-header2.js +1 -1
  96. package/dist/page/page-panel/page-panel2.js +1 -1
  97. package/dist/page/page2.js +1 -1
  98. package/dist/page-header/page-header2.js +1 -1
  99. package/dist/page-loader/page-loader2.js +1 -1
  100. package/dist/pagination/pagination2.js +1 -1
  101. package/dist/panel/panel2.js +4 -4
  102. package/dist/password/password2.js +1 -1
  103. package/dist/preferences-input/preferences-input2.js +1 -1
  104. package/dist/progress-bar/progress-bar2.js +1 -1
  105. package/dist/progress-ring/progress-ring2.js +1 -1
  106. package/dist/progressive-filter-chip/progressive-filter-chip2.js +1 -1
  107. package/dist/pulse/pulse2.js +1 -1
  108. package/dist/radio/radio-group2.js +1 -1
  109. package/dist/radio/radio2.js +1 -1
  110. package/dist/range/range2.js +1 -1
  111. package/dist/resize-handle/resize-handle2.js +1 -1
  112. package/dist/search/search2.js +1 -1
  113. package/dist/select/select2.js +1 -1
  114. package/dist/skeleton/skeleton2.js +1 -1
  115. package/dist/sort-button/sort-button2.js +1 -1
  116. package/dist/sparkline/sparkline2.js +1 -1
  117. package/dist/star-rating/star-rating2.js +1 -1
  118. package/dist/steps/steps2.js +2 -2
  119. package/dist/switch/switch-group2.js +1 -1
  120. package/dist/switch/switch2.js +1 -1
  121. package/dist/tabs/tabs-group2.js +1 -1
  122. package/dist/tabs/tabs2.js +2 -2
  123. package/dist/tag/tag2.js +1 -1
  124. package/dist/textarea/textarea2.js +1 -1
  125. package/dist/time/time2.js +1 -1
  126. package/dist/toast/toast2.js +1 -1
  127. package/dist/toggletip/toggletip-footer2.js +1 -1
  128. package/dist/toggletip/toggletip-header2.js +1 -1
  129. package/dist/toggletip/toggletip2.js +1 -1
  130. package/dist/toolbar/toolbar2.js +1 -1
  131. package/dist/tooltip/tooltip2.js +1 -1
  132. package/dist/tree/tree-node2.js +1 -1
  133. package/dist/tree/tree2.js +1 -1
  134. package/dist/week/week2.js +1 -1
  135. package/package.json +14 -2
@@ -19,7 +19,7 @@ var l = class extends r {
19
19
  static {
20
20
  this.metadata = {
21
21
  tag: "nve-datetime",
22
- version: "2.4.1"
22
+ version: "2.5.1"
23
23
  };
24
24
  }
25
25
  static {
@@ -11,7 +11,7 @@ var o = class extends i {
11
11
  static {
12
12
  this.metadata = {
13
13
  tag: "nve-dialog-footer",
14
- version: "2.4.1",
14
+ version: "2.5.1",
15
15
  parents: ["nve-dialog"]
16
16
  };
17
17
  }
@@ -11,7 +11,7 @@ var o = class extends i {
11
11
  static {
12
12
  this.metadata = {
13
13
  tag: "nve-dialog-header",
14
- version: "2.4.1",
14
+ version: "2.5.1",
15
15
  parents: ["nve-dialog"]
16
16
  };
17
17
  }
@@ -30,7 +30,7 @@ var h = class extends f {
30
30
  static {
31
31
  this.metadata = {
32
32
  tag: "nve-dialog",
33
- version: "2.4.1"
33
+ version: "2.5.1"
34
34
  };
35
35
  }
36
36
  static {
@@ -15,7 +15,7 @@ var s = class extends i {
15
15
  static {
16
16
  this.metadata = {
17
17
  tag: "nve-divider",
18
- version: "2.4.1"
18
+ version: "2.5.1"
19
19
  };
20
20
  }
21
21
  render() {
package/dist/dot/dot2.js CHANGED
@@ -16,7 +16,7 @@ var l = class extends o {
16
16
  static {
17
17
  this.metadata = {
18
18
  tag: "nve-dot",
19
- version: "2.4.1"
19
+ version: "2.5.1"
20
20
  };
21
21
  }
22
22
  render() {
@@ -11,7 +11,7 @@ var o = class extends i {
11
11
  static {
12
12
  this.metadata = {
13
13
  tag: "nve-drawer-content",
14
- version: "2.4.1",
14
+ version: "2.5.1",
15
15
  parents: ["nve-drawer"]
16
16
  };
17
17
  }
@@ -11,7 +11,7 @@ var o = class extends i {
11
11
  static {
12
12
  this.metadata = {
13
13
  tag: "nve-drawer-footer",
14
- version: "2.4.1",
14
+ version: "2.5.1",
15
15
  parents: ["nve-drawer"]
16
16
  };
17
17
  }
@@ -11,7 +11,7 @@ var o = class extends i {
11
11
  static {
12
12
  this.metadata = {
13
13
  tag: "nve-drawer-header",
14
- version: "2.4.1",
14
+ version: "2.5.1",
15
15
  parents: ["nve-drawer"]
16
16
  };
17
17
  }
@@ -30,7 +30,7 @@ var p = class extends u {
30
30
  static {
31
31
  this.metadata = {
32
32
  tag: "nve-drawer",
33
- version: "2.4.1"
33
+ version: "2.5.1"
34
34
  };
35
35
  }
36
36
  static {
@@ -11,7 +11,7 @@ var o = class extends i {
11
11
  static {
12
12
  this.metadata = {
13
13
  tag: "nve-dropdown-footer",
14
- version: "2.4.1",
14
+ version: "2.5.1",
15
15
  parents: ["nve-dropdown"]
16
16
  };
17
17
  }
@@ -11,7 +11,7 @@ var o = class extends i {
11
11
  static {
12
12
  this.metadata = {
13
13
  tag: "nve-dropdown-header",
14
- version: "2.4.1",
14
+ version: "2.5.1",
15
15
  parents: ["nve-dropdown"]
16
16
  };
17
17
  }
@@ -21,7 +21,7 @@ var p = class extends l {
21
21
  static {
22
22
  this.metadata = {
23
23
  tag: "nve-dropdown",
24
- version: "2.4.1"
24
+ version: "2.5.1"
25
25
  };
26
26
  }
27
27
  static {
@@ -14,7 +14,7 @@ var d = class extends c {
14
14
  static {
15
15
  this.metadata = {
16
16
  tag: "nve-dropdown-group",
17
- version: "2.4.1",
17
+ version: "2.5.1",
18
18
  children: ["nve-dropdown"]
19
19
  };
20
20
  }
@@ -20,7 +20,7 @@ var g = class extends m(d) {
20
20
  static {
21
21
  this.metadata = {
22
22
  tag: "nve-dropzone",
23
- version: "2.4.1",
23
+ version: "2.5.1",
24
24
  validators: [l, c],
25
25
  valueSchema: {
26
26
  type: "array",
@@ -11,7 +11,7 @@ var a = class extends n {
11
11
  static {
12
12
  this.metadata = {
13
13
  tag: "nve-file",
14
- version: "2.4.1"
14
+ version: "2.5.1"
15
15
  };
16
16
  }
17
17
  connectedCallback() {
@@ -95,7 +95,7 @@ var g = class extends a {
95
95
  static {
96
96
  this.metadata = {
97
97
  tag: "nve-format-bytes",
98
- version: "2.4.1"
98
+ version: "2.5.1"
99
99
  };
100
100
  }
101
101
  get #e() {
@@ -13,7 +13,7 @@ var c = class extends a {
13
13
  static {
14
14
  this.metadata = {
15
15
  tag: "nve-format-datetime",
16
- version: "2.4.1"
16
+ version: "2.5.1"
17
17
  };
18
18
  }
19
19
  get #e() {
@@ -29,7 +29,7 @@ var c = [
29
29
  static {
30
30
  this.metadata = {
31
31
  tag: "nve-format-number",
32
- version: "2.4.1"
32
+ version: "2.5.1"
33
33
  };
34
34
  }
35
35
  get #e() {
@@ -53,7 +53,7 @@ var c = {
53
53
  static {
54
54
  this.metadata = {
55
55
  tag: "nve-format-relative-time",
56
- version: "2.4.1"
56
+ version: "2.5.1"
57
57
  };
58
58
  }
59
59
  #e;
@@ -0,0 +1,6 @@
1
+ import { FormatTruncate } from '@nvidia-elements/core/format-truncate';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'nve-format-truncate': FormatTruncate;
5
+ }
6
+ }
@@ -0,0 +1,7 @@
1
+ import { define as e } from "../internal/utils/dom.js";
2
+ import { FormatTruncate as t } from "./format-truncate2.js";
3
+ //#region src/format-truncate/define.ts
4
+ e(t);
5
+ //#endregion
6
+
7
+ //# sourceMappingURL=define.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define.js","names":[],"sources":["../../src/format-truncate/define.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { define } from '@nvidia-elements/core/internal';\nimport { FormatTruncate } from '@nvidia-elements/core/format-truncate';\n\ndefine(FormatTruncate);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nve-format-truncate': FormatTruncate;\n }\n}\n"],"mappings":";;;AAMA,EAAO,CAAc"}
@@ -0,0 +1,41 @@
1
+ import type { TemplateResult } from 'lit';
2
+ import { LitElement } from 'lit';
3
+ /**
4
+ * @element nve-format-truncate
5
+ * @description Truncates text at its start, center, or end while preserving the full text for assistive technology.
6
+ * @documentation https://nvidia.github.io/elements/docs/elements/format-truncate/
7
+ * @since 0.0.0
8
+ * @entrypoint \@nvidia-elements/core/format-truncate
9
+ * @slot - Text to truncate. The component flattens, trims, and normalizes mixed text and element nodes.
10
+ * @beta
11
+ */
12
+ export declare class FormatTruncate extends LitElement {
13
+ #private;
14
+ static styles: import("lit").CSSResult[];
15
+ static readonly metadata: {
16
+ tag: string;
17
+ version: string;
18
+ };
19
+ /**
20
+ * Location of the ellipsis. Use start or end to preserve one edge, or center to preserve both edges.
21
+ */
22
+ position: 'start' | 'center' | 'end';
23
+ /**
24
+ * Text unit used for center truncation. Character preserves graphemes, word preserves words, and path preserves path segments.
25
+ */
26
+ strategy: 'character' | 'word' | 'path';
27
+ /**
28
+ * Edge favored by center truncation. The favored edge keeps at least the configured number of units.
29
+ */
30
+ bias: 'start' | 'end';
31
+ /**
32
+ * Number of strategy units retained at the biased edge during center truncation.
33
+ */
34
+ preserve: number;
35
+ /** @private */
36
+ _internals: ElementInternals;
37
+ connectedCallback(): void;
38
+ disconnectedCallback(): void;
39
+ connectedMoveCallback(): void;
40
+ render(): TemplateResult;
41
+ }
@@ -0,0 +1,6 @@
1
+ //#region src/format-truncate/format-truncate.examples.ts
2
+ var e = "";
3
+ //#endregion
4
+ export { e as default };
5
+
6
+ //# sourceMappingURL=format-truncate.examples.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-truncate.examples.js","names":[],"sources":["../../src/format-truncate/format-truncate.examples.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 '@nvidia-elements/core/format-truncate/define.js';\n\nexport default {\n title: 'Elements/FormatTruncate',\n component: 'nve-format-truncate'\n};\n\n/**\n * @summary Start, center, and end positions keep the most useful part of constrained text. Choose the position that matches how users distinguish each value.\n */\nexport const Default = {\n render: () => html`\n <div nve-layout=\"column gap:sm\" style=\"max-width: 16rem\">\n <nve-format-truncate position=\"start\">training-pipeline-2026-08-05-production</nve-format-truncate>\n <nve-format-truncate position=\"center\">training-pipeline-2026-08-05-production</nve-format-truncate>\n <nve-format-truncate position=\"end\">training-pipeline-2026-08-05-production</nve-format-truncate>\n </div>\n `\n};\n\n/**\n * @summary Inherited heading, body, and code styles keep truncated text aligned with surrounding typography. Place the component inside semantic text elements to preserve their visual hierarchy.\n * @tags test-case\n */\nexport const Typography = {\n render: () => html`\n <div nve-layout=\"column gap:lg align:stretch\" style=\"max-width: 16rem\">\n <h2 nve-text=\"heading lg\"><nve-format-truncate position=\"center\">training-pipeline-2026-08-05-production</nve-format-truncate></h2>\n <p nve-text=\"body\"><nve-format-truncate position=\"center\">training-pipeline-2026-08-05-production</nve-format-truncate></p>\n <code nve-text=\"code sm muted\"><nve-format-truncate position=\"center\">training-pipeline-2026-08-05-production</nve-format-truncate></code>\n </div>\n `\n};\n\n/**\n * @summary Center truncation bias keeps units from either the start or end. Use end bias for shared suffixes and start bias for identifiers with meaningful endings.\n * @tags test-case\n */\nexport const Bias = {\n render: () => html`\n <div nve-layout=\"column gap:sm\" style=\"max-width: 16rem\">\n <nve-format-truncate position=\"center\" bias=\"start\" preserve=\"10\">sha256:1234567890abcdef1234567890abcdef</nve-format-truncate>\n <nve-format-truncate position=\"center\" bias=\"end\" preserve=\"10\">sha256:1234567890abcdef1234567890abcdef</nve-format-truncate>\n </div>\n `\n};\n\n/**\n * @summary Character, word, and path strategies preserve complete graphemes or meaningful text units. Match the strategy to identifiers, labels, or file paths.\n * @tags test-case\n */\nexport const Strategy = {\n render: () => html`\n <div nve-layout=\"column gap:sm\" style=\"max-width: 16rem\">\n <nve-format-truncate position=\"center\" strategy=\"character\" preserve=\"8\">experiment-👩🏽‍💻-0123456789abcdef</nve-format-truncate>\n <nve-format-truncate position=\"center\" strategy=\"word\" preserve=\"3\">NVIDIA autonomous vehicle training pipeline production run</nve-format-truncate>\n <nve-format-truncate position=\"center\" strategy=\"path\" preserve=\"2\">/models/checkpoints/production/model.bin</nve-format-truncate>\n </div>\n `\n};\n\n\n/**\n * @summary Truncate applies inline to adjacent text nodes.\n * @tags test-case\n */\nexport const Inline = {\n render: () => html`\n <div nve-layout=\"row gap:sm\" style=\"max-width: 16rem\">\n <nve-format-truncate position=\"start\">training-pipeline-2026-08-05-production</nve-format-truncate>\n <nve-format-truncate position=\"center\">training-pipeline-2026-08-05-production</nve-format-truncate>\n <nve-format-truncate position=\"end\">training-pipeline-2026-08-05-production</nve-format-truncate>\n </div>\n `\n};\n\n/**\n * @summary Truncate applies inline to heading text nodes.\n * @tags test-case\n */\nexport const Headings = {\n render: () => html`\n <div nve-layout=\"column gap:sm\">\n <h2 nve-text=\"heading lg\" style=\"width: 100%; max-width: 16rem\"><nve-format-truncate position=\"center\">training-pipeline-2026-08-05-production</nve-format-truncate></h2>\n <h2 nve-text=\"heading\" style=\"width: 100%; max-width: 16rem\"><nve-format-truncate position=\"center\">training-pipeline-2026-08-05-production</nve-format-truncate></h2>\n <h2 nve-text=\"heading sm\" style=\"width: 100%; max-width: 16rem\"><nve-format-truncate position=\"center\">training-pipeline-2026-08-05-production</nve-format-truncate></h2>\n </div>\n `\n};\n"],"mappings":";AAGA,IAAA,IAAS"}
@@ -0,0 +1,70 @@
1
+ {
2
+ "element": "nve-format-truncate",
3
+ "entrypoint": "@nvidia-elements/core/format-truncate/format-truncate.examples.json",
4
+ "items": [
5
+ {
6
+ "id": "format-truncate",
7
+ "name": "Default",
8
+ "template": "<div nve-layout=\"column gap:sm\" style=\"max-width: 16rem\">\n <nve-format-truncate position=\"start\">training-pipeline-2026-08-05-production</nve-format-truncate>\n <nve-format-truncate position=\"center\">training-pipeline-2026-08-05-production</nve-format-truncate>\n <nve-format-truncate position=\"end\">training-pipeline-2026-08-05-production</nve-format-truncate>\n</div>\n",
9
+ "summary": "Start, center, and end positions keep the most useful part of constrained text. Choose the position that matches how users distinguish each value.",
10
+ "description": "",
11
+ "composition": false,
12
+ "tags": []
13
+ },
14
+ {
15
+ "id": "format-truncate-typography",
16
+ "name": "Typography",
17
+ "template": "<div nve-layout=\"column gap:lg align:stretch\" style=\"max-width: 16rem\">\n <h2 nve-text=\"heading lg\">\n <nve-format-truncate position=\"center\">training-pipeline-2026-08-05-production</nve-format-truncate>\n </h2>\n <p nve-text=\"body\">\n <nve-format-truncate position=\"center\">training-pipeline-2026-08-05-production</nve-format-truncate>\n </p>\n <code nve-text=\"code sm muted\"\n ><nve-format-truncate position=\"center\">training-pipeline-2026-08-05-production</nve-format-truncate></code\n >\n</div>\n",
18
+ "summary": "Inherited heading, body, and code styles keep truncated text aligned with surrounding typography. Place the component inside semantic text elements to preserve their visual hierarchy.",
19
+ "description": "",
20
+ "composition": false,
21
+ "tags": [
22
+ "test-case"
23
+ ]
24
+ },
25
+ {
26
+ "id": "format-truncate-bias",
27
+ "name": "Bias",
28
+ "template": "<div nve-layout=\"column gap:sm\" style=\"max-width: 16rem\">\n <nve-format-truncate position=\"center\" bias=\"start\" preserve=\"10\"\n >sha256:1234567890abcdef1234567890abcdef</nve-format-truncate\n >\n <nve-format-truncate position=\"center\" bias=\"end\" preserve=\"10\"\n >sha256:1234567890abcdef1234567890abcdef</nve-format-truncate\n >\n</div>\n",
29
+ "summary": "Center truncation bias keeps units from either the start or end. Use end bias for shared suffixes and start bias for identifiers with meaningful endings.",
30
+ "description": "",
31
+ "composition": false,
32
+ "tags": [
33
+ "test-case"
34
+ ]
35
+ },
36
+ {
37
+ "id": "format-truncate-strategy",
38
+ "name": "Strategy",
39
+ "template": "<div nve-layout=\"column gap:sm\" style=\"max-width: 16rem\">\n <nve-format-truncate position=\"center\" strategy=\"character\" preserve=\"8\"\n >experiment-👩🏽‍💻-0123456789abcdef</nve-format-truncate\n >\n <nve-format-truncate position=\"center\" strategy=\"word\" preserve=\"3\"\n >NVIDIA autonomous vehicle training pipeline production run</nve-format-truncate\n >\n <nve-format-truncate position=\"center\" strategy=\"path\" preserve=\"2\"\n >/models/checkpoints/production/model.bin</nve-format-truncate\n >\n</div>\n",
40
+ "summary": "Character, word, and path strategies preserve complete graphemes or meaningful text units. Match the strategy to identifiers, labels, or file paths.",
41
+ "description": "",
42
+ "composition": false,
43
+ "tags": [
44
+ "test-case"
45
+ ]
46
+ },
47
+ {
48
+ "id": "format-truncate-inline",
49
+ "name": "Inline",
50
+ "template": "<div nve-layout=\"row gap:sm\" style=\"max-width: 16rem\">\n <nve-format-truncate position=\"start\">training-pipeline-2026-08-05-production</nve-format-truncate>\n <nve-format-truncate position=\"center\">training-pipeline-2026-08-05-production</nve-format-truncate>\n <nve-format-truncate position=\"end\">training-pipeline-2026-08-05-production</nve-format-truncate>\n</div>\n",
51
+ "summary": "Truncate applies inline to adjacent text nodes.",
52
+ "description": "",
53
+ "composition": false,
54
+ "tags": [
55
+ "test-case"
56
+ ]
57
+ },
58
+ {
59
+ "id": "format-truncate-headings",
60
+ "name": "Headings",
61
+ "template": "<div nve-layout=\"column gap:sm\">\n <h2 nve-text=\"heading lg\" style=\"width: 100%; max-width: 16rem\">\n <nve-format-truncate position=\"center\">training-pipeline-2026-08-05-production</nve-format-truncate>\n </h2>\n <h2 nve-text=\"heading\" style=\"width: 100%; max-width: 16rem\">\n <nve-format-truncate position=\"center\">training-pipeline-2026-08-05-production</nve-format-truncate>\n </h2>\n <h2 nve-text=\"heading sm\" style=\"width: 100%; max-width: 16rem\">\n <nve-format-truncate position=\"center\">training-pipeline-2026-08-05-production</nve-format-truncate>\n </h2>\n</div>\n",
62
+ "summary": "Truncate applies inline to heading text nodes.",
63
+ "description": "",
64
+ "composition": false,
65
+ "tags": [
66
+ "test-case"
67
+ ]
68
+ }
69
+ ]
70
+ }
@@ -0,0 +1,6 @@
1
+ //#region src/format-truncate/format-truncate.css?inline
2
+ var e = ":host{position:relative;display:inline-block;max-inline-size:100%;min-inline-size:0}span{text-wrap:nowrap}[sizing-host]{display:block;opacity:0}[internal-host]{position:absolute;inset:0;overflow:hidden}slot{display:initial;position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}";
3
+ //#endregion
4
+ export { e as default };
5
+
6
+ //# sourceMappingURL=format-truncate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-truncate.js","names":[],"sources":["../../src/format-truncate/format-truncate.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 position: relative;\n display: inline-block;\n max-inline-size: 100%;\n min-inline-size: 0;\n}\n\nspan {\n text-wrap: nowrap;\n}\n\n[sizing-host] {\n display: block;\n opacity: 0;\n}\n\n[internal-host] {\n position: absolute;\n inset: 0;\n overflow: hidden;\n}\n\nslot {\n display: initial;\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n"],"mappings":""}
@@ -0,0 +1,118 @@
1
+ import { attachInternals as e } from "../internal/utils/a11y.js";
2
+ import { typeSSR as t } from "../internal/controllers/type-ssr.controller.js";
3
+ import { useStyles as n } from "../internal/styles/index.js";
4
+ import r from "../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
5
+ import { normalizeTruncateString as i, normalizeTruncateText as a, truncateText as o } from "./utils.js";
6
+ import s from "./format-truncate.js";
7
+ import { LitElement as c, html as l } from "lit";
8
+ import { property as u } from "lit/decorators/property.js";
9
+ //#region src/format-truncate/format-truncate.ts
10
+ var d = class extends c {
11
+ constructor(...e) {
12
+ super(...e), this.position = "start", this.strategy = "character", this.bias = "end", this.preserve = 6, this.#l = () => {
13
+ this.requestUpdate();
14
+ };
15
+ }
16
+ static {
17
+ this.styles = n([s]);
18
+ }
19
+ static {
20
+ this.metadata = {
21
+ tag: "nve-format-truncate",
22
+ version: "2.5.1"
23
+ };
24
+ }
25
+ #e;
26
+ #t;
27
+ connectedCallback() {
28
+ super.connectedCallback(), e(this), this.#c(), this.requestUpdate();
29
+ }
30
+ disconnectedCallback() {
31
+ super.disconnectedCallback(), this.#t?.disconnect();
32
+ }
33
+ connectedMoveCallback() {
34
+ this.#c(), this.requestUpdate();
35
+ }
36
+ render() {
37
+ let e = this.#n, t = this.#r(e);
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.#l}"></slot>`;
39
+ }
40
+ get #n() {
41
+ let e = this.shadowRoot?.querySelector("slot:not([name])");
42
+ if (e) return a(e.assignedNodes({ flatten: !0 }));
43
+ let t = Array.from(this.childNodes ?? []).filter(m);
44
+ return t.length ? a(t) : i(this.textContent ?? "");
45
+ }
46
+ #r(e) {
47
+ let t = this.#a();
48
+ return o(e, {
49
+ position: this.position,
50
+ strategy: this.strategy,
51
+ bias: this.bias,
52
+ preserve: this.preserve,
53
+ availableWidth: this.#i,
54
+ measureText: t
55
+ });
56
+ }
57
+ get #i() {
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;
63
+ if (!e || !t) return () => 0;
64
+ let n = e.getComputedStyle(this);
65
+ t.font = n.font;
66
+ let r = p(n.letterSpacing), i = p(n.wordSpacing), a = new Intl.Segmenter(void 0, { granularity: "grapheme" });
67
+ return (e) => this.#o(e, {
68
+ context: t,
69
+ letterSpacing: r,
70
+ wordSpacing: i,
71
+ graphemeSegmenter: a
72
+ });
73
+ }
74
+ #o(e, { context: t, letterSpacing: n, wordSpacing: r, graphemeSegmenter: i }) {
75
+ let a = i.segment(e), o = Array.from(e.matchAll(/\s/gu)).length;
76
+ return t.measureText(e).width + Math.max(0, Array.from(a).length - 1) * n + o * r;
77
+ }
78
+ get #s() {
79
+ return this.#e === void 0 && (this.#e = this.ownerDocument?.createElement("canvas").getContext("2d") ?? null), this.#e;
80
+ }
81
+ #c() {
82
+ typeof ResizeObserver > "u" || (this.#t ??= new ResizeObserver(() => {
83
+ this.isConnected && this.requestUpdate();
84
+ }), this.#t.disconnect(), this.#t.observe(this));
85
+ }
86
+ #l;
87
+ };
88
+ r([u({
89
+ type: String,
90
+ reflect: !0
91
+ })], d.prototype, "position", void 0), r([u({
92
+ type: String,
93
+ reflect: !0
94
+ })], d.prototype, "strategy", void 0), r([u({
95
+ type: String,
96
+ reflect: !0
97
+ })], d.prototype, "bias", void 0), r([u({
98
+ type: Number,
99
+ reflect: !0
100
+ })], d.prototype, "preserve", void 0), d = r([t()], d);
101
+ function f(e, t) {
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
+ let t = Number.parseFloat(e);
107
+ return Number.isFinite(t) ? t : 0;
108
+ }
109
+ function m(e) {
110
+ return !h(e) || !e.getAttribute("slot");
111
+ }
112
+ function h(e) {
113
+ return e.nodeType === 1;
114
+ }
115
+ //#endregion
116
+ export { d as FormatTruncate };
117
+
118
+ //# sourceMappingURL=format-truncate2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-truncate2.js","names":["#observeAvailableWidth","#resizeObserver","#slottedText","#renderText","#onSlotChange","#createTextMeasurer","#availableWidth","#textMeasurementContext","#measureText","#measurementContext"],"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,IAAA,IAAA,cAA6B,EAAW;;+BAWqC,yBAKG,yBAKlB,uBAKb,mBAwH1B;GAC1B,KAAK,cAAc;EACrB;;;gBAnJgB,EAAU,CAAC,CAAM,CAAC;;;kBAEP;GACzB,KAAK;GACL,SAAS;EACX;;CAyBA;CACA;CAEA,oBAAmC;EAIjC,AAHA,MAAM,kBAAkB,GACxB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AA;AAwJT,SAAS,EAAgB,GAAsB,GAAsB;CACnE,IAAM,IAAiB,EAAK,iBAAiB,CAAO;CACpD,OAAO,KAAK,IACV,GACA,EAAQ,sBAAsB,CAAC,CAAC,QAC9B,EAAc,EAAe,sBAAsB,IACnD,EAAc,EAAe,oBAAoB,IACjD,EAAc,EAAe,kBAAkB,IAC/C,EAAc,EAAe,gBAAgB,CACjD;AACF;AAEA,SAAS,EAAc,GAAuB;CAC5C,IAAM,IAAS,OAAO,WAAW,CAAK;CACtC,OAAO,OAAO,SAAS,CAAM,IAAI,IAAS;AAC5C;AAEA,SAAS,EAAkB,GAAqB;CAC9C,OAAO,CAAC,EAAc,CAAI,KAAK,CAAC,EAAK,aAAa,MAAM;AAC1D;AAEA,SAAS,EAAc,GAA6B;CAClD,OAAO,EAAK,aAAa;AAC3B"}
@@ -0,0 +1 @@
1
+ export * from './format-truncate.js';
@@ -0,0 +1,2 @@
1
+ import { FormatTruncate as e } from "./format-truncate2.js";
2
+ export { e as FormatTruncate };
@@ -0,0 +1,14 @@
1
+ type TruncatePosition = 'start' | 'center' | 'end';
2
+ type TruncateStrategy = 'character' | 'word' | 'path';
3
+ type TruncateBias = 'start' | 'end';
4
+ export declare function normalizeTruncateText(nodes: Iterable<Node>): string;
5
+ export declare function normalizeTruncateString(text: string): string;
6
+ export declare function truncateText(text: string, { position, strategy, bias, preserve, availableWidth, measureText }: {
7
+ position: TruncatePosition;
8
+ strategy: TruncateStrategy;
9
+ bias: TruncateBias;
10
+ preserve: number;
11
+ availableWidth: number;
12
+ measureText: (value: string) => number;
13
+ }): string;
14
+ export {};