@nvidia-elements/core 2.4.1 → 2.5.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 +7 -0
- package/dist/accordion/accordion2.js +4 -4
- package/dist/alert/alert-group2.js +1 -1
- package/dist/alert/alert2.js +1 -1
- package/dist/avatar/avatar-group2.js +1 -1
- package/dist/avatar/avatar2.js +1 -1
- package/dist/badge/badge2.js +1 -1
- package/dist/breadcrumb/breadcrumb2.js +1 -1
- package/dist/bundle.d.ts +2 -0
- package/dist/bundles/index.d.ts +39 -0
- package/dist/bundles/index.js +6 -6
- package/dist/button/button2.js +1 -1
- package/dist/button-group/button-group2.js +1 -1
- package/dist/card/card2.js +4 -4
- package/dist/chat-message/chat-message2.js +1 -1
- package/dist/checkbox/checkbox-group2.js +1 -1
- package/dist/checkbox/checkbox2.js +1 -1
- package/dist/color/color2.js +1 -1
- package/dist/combobox/combobox2.js +1 -1
- package/dist/copy-button/copy-button2.js +1 -1
- package/dist/custom-elements-jsx.d.ts +21 -0
- package/dist/custom-elements-vue.d.ts +21 -0
- package/dist/custom-elements.json +362 -0
- package/dist/data.html.json +40 -0
- package/dist/data.snippets.json +45 -45
- package/dist/date/date2.js +1 -1
- package/dist/datetime/datetime2.js +1 -1
- package/dist/dialog/dialog-footer2.js +1 -1
- package/dist/dialog/dialog-header2.js +1 -1
- package/dist/dialog/dialog2.js +1 -1
- package/dist/divider/divider2.js +1 -1
- package/dist/dot/dot2.js +1 -1
- package/dist/drawer/drawer-content2.js +1 -1
- package/dist/drawer/drawer-footer2.js +1 -1
- package/dist/drawer/drawer-header2.js +1 -1
- package/dist/drawer/drawer2.js +1 -1
- package/dist/dropdown/dropdown-footer2.js +1 -1
- package/dist/dropdown/dropdown-header2.js +1 -1
- package/dist/dropdown/dropdown2.js +1 -1
- package/dist/dropdown-group/dropdown-group.js +1 -1
- package/dist/dropzone/dropzone2.js +1 -1
- package/dist/file/file2.js +1 -1
- package/dist/format-bytes/format-bytes2.js +1 -1
- package/dist/format-datetime/format-datetime2.js +1 -1
- package/dist/format-number/format-number2.js +1 -1
- package/dist/format-relative-time/format-relative-time2.js +1 -1
- package/dist/format-truncate/define.d.ts +6 -0
- package/dist/format-truncate/define.js +7 -0
- package/dist/format-truncate/define.js.map +1 -0
- package/dist/format-truncate/format-truncate.d.ts +41 -0
- package/dist/format-truncate/format-truncate.examples.js +6 -0
- package/dist/format-truncate/format-truncate.examples.js.map +1 -0
- package/dist/format-truncate/format-truncate.examples.json +70 -0
- package/dist/format-truncate/format-truncate.js +6 -0
- package/dist/format-truncate/format-truncate.js.map +1 -0
- package/dist/format-truncate/format-truncate2.js +118 -0
- package/dist/format-truncate/format-truncate2.js.map +1 -0
- package/dist/format-truncate/index.d.ts +1 -0
- package/dist/format-truncate/index.js +2 -0
- package/dist/format-truncate/utils.d.ts +14 -0
- package/dist/format-truncate/utils.js +114 -0
- package/dist/format-truncate/utils.js.map +1 -0
- package/dist/forms/control/control2.js +1 -1
- package/dist/forms/control-group/control-group2.js +1 -1
- package/dist/forms/control-message/control-message2.js +1 -1
- package/dist/gauge/gauge2.js +1 -1
- package/dist/grid/cell/cell2.js +1 -1
- package/dist/grid/column/column2.js +1 -1
- package/dist/grid/footer/footer2.js +1 -1
- package/dist/grid/grid2.js +1 -1
- package/dist/grid/header/header2.js +1 -1
- package/dist/grid/placeholder/placeholder2.js +1 -1
- package/dist/grid/row/row2.js +1 -1
- package/dist/icon/icon2.js +2 -2
- package/dist/icon-button/icon-button2.js +1 -1
- package/dist/index.js +1 -1
- package/dist/input/input-group2.js +1 -1
- package/dist/input/input2.js +1 -1
- package/dist/internal/services/global.service.js +1 -1
- package/dist/logo/logo2.js +1 -1
- package/dist/menu/menu-item2.js +1 -1
- package/dist/menu/menu2.js +1 -1
- package/dist/month/month2.js +1 -1
- package/dist/notification/notification-group2.js +1 -1
- package/dist/notification/notification2.js +1 -1
- package/dist/page/page-panel/page-panel-content2.js +1 -1
- package/dist/page/page-panel/page-panel-footer2.js +1 -1
- package/dist/page/page-panel/page-panel-header2.js +1 -1
- package/dist/page/page-panel/page-panel2.js +1 -1
- package/dist/page/page2.js +1 -1
- package/dist/page-header/page-header2.js +1 -1
- package/dist/page-loader/page-loader2.js +1 -1
- package/dist/pagination/pagination2.js +1 -1
- package/dist/panel/panel2.js +4 -4
- package/dist/password/password2.js +1 -1
- package/dist/preferences-input/preferences-input2.js +1 -1
- package/dist/progress-bar/progress-bar2.js +1 -1
- package/dist/progress-ring/progress-ring2.js +1 -1
- package/dist/progressive-filter-chip/progressive-filter-chip2.js +1 -1
- package/dist/pulse/pulse2.js +1 -1
- package/dist/radio/radio-group2.js +1 -1
- package/dist/radio/radio2.js +1 -1
- package/dist/range/range2.js +1 -1
- package/dist/resize-handle/resize-handle2.js +1 -1
- package/dist/search/search2.js +1 -1
- package/dist/select/select2.js +1 -1
- package/dist/skeleton/skeleton2.js +1 -1
- package/dist/sort-button/sort-button2.js +1 -1
- package/dist/sparkline/sparkline2.js +1 -1
- package/dist/star-rating/star-rating2.js +1 -1
- package/dist/steps/steps2.js +2 -2
- package/dist/switch/switch-group2.js +1 -1
- package/dist/switch/switch2.js +1 -1
- package/dist/tabs/tabs-group2.js +1 -1
- package/dist/tabs/tabs2.js +2 -2
- package/dist/tag/tag2.js +1 -1
- package/dist/textarea/textarea2.js +1 -1
- package/dist/time/time2.js +1 -1
- package/dist/toast/toast2.js +1 -1
- package/dist/toggletip/toggletip-footer2.js +1 -1
- package/dist/toggletip/toggletip-header2.js +1 -1
- package/dist/toggletip/toggletip2.js +1 -1
- package/dist/toolbar/toolbar2.js +1 -1
- package/dist/tooltip/tooltip2.js +1 -1
- package/dist/tree/tree-node2.js +1 -1
- package/dist/tree/tree2.js +1 -1
- package/dist/week/week2.js +1 -1
- package/package.json +14 -2
package/dist/data.snippets.json
CHANGED
|
@@ -71,6 +71,24 @@
|
|
|
71
71
|
"description": "Basic inline search",
|
|
72
72
|
"body": "<nve-search>\n <input type=\"search\" aria-label=\"${2:search}\" placeholder=\"${3:search}\">\n</nve-search>\n"
|
|
73
73
|
},
|
|
74
|
+
"Page Header": {
|
|
75
|
+
"srcFile": "page-header.snippets.html",
|
|
76
|
+
"prefix": [
|
|
77
|
+
"page-header"
|
|
78
|
+
],
|
|
79
|
+
"type": "pattern",
|
|
80
|
+
"description": "Basic page-header layout.",
|
|
81
|
+
"body": "<nve-page-header slot=\"header\">\n <nve-logo slot=\"prefix\" size=\"sm\">NV</nve-logo>\n <h2 slot=\"prefix\">${1:NVIDIA}</h2>\n</nve-page-header>\n"
|
|
82
|
+
},
|
|
83
|
+
"Page Header with Links": {
|
|
84
|
+
"srcFile": "page-header.snippets.html",
|
|
85
|
+
"prefix": [
|
|
86
|
+
"page-header-with-links"
|
|
87
|
+
],
|
|
88
|
+
"type": "pattern",
|
|
89
|
+
"description": "Basic page-header layout with links.",
|
|
90
|
+
"body": "<nve-page-header slot=\"header\">\n <nve-logo slot=\"prefix\" size=\"sm\">NV</nve-logo>\n <h2 slot=\"prefix\">${1:NVIDIA}</h2>\n <nve-button selected container=\"flat\"><a href=\"#\">${2:Link 1}</a></nve-button>\n <nve-button container=\"flat\"><a href=\"#\">${3:Link 2}</a></nve-button>\n</nve-page-header>\n"
|
|
91
|
+
},
|
|
74
92
|
"Page": {
|
|
75
93
|
"srcFile": "page.snippets.html",
|
|
76
94
|
"prefix": [
|
|
@@ -116,24 +134,6 @@
|
|
|
116
134
|
"description": "Basic page subheader using toolbar.",
|
|
117
135
|
"body": "<nve-toolbar slot=\"subheader\">\n <h2 nve-text=\"emphasis heading sm\">${1:Subheader}</h2>\n</nve-toolbar>\n"
|
|
118
136
|
},
|
|
119
|
-
"Page Header": {
|
|
120
|
-
"srcFile": "page-header.snippets.html",
|
|
121
|
-
"prefix": [
|
|
122
|
-
"page-header"
|
|
123
|
-
],
|
|
124
|
-
"type": "pattern",
|
|
125
|
-
"description": "Basic page-header layout.",
|
|
126
|
-
"body": "<nve-page-header slot=\"header\">\n <nve-logo slot=\"prefix\" size=\"sm\">NV</nve-logo>\n <h2 slot=\"prefix\">${1:NVIDIA}</h2>\n</nve-page-header>\n"
|
|
127
|
-
},
|
|
128
|
-
"Page Header with Links": {
|
|
129
|
-
"srcFile": "page-header.snippets.html",
|
|
130
|
-
"prefix": [
|
|
131
|
-
"page-header-with-links"
|
|
132
|
-
],
|
|
133
|
-
"type": "pattern",
|
|
134
|
-
"description": "Basic page-header layout with links.",
|
|
135
|
-
"body": "<nve-page-header slot=\"header\">\n <nve-logo slot=\"prefix\" size=\"sm\">NV</nve-logo>\n <h2 slot=\"prefix\">${1:NVIDIA}</h2>\n <nve-button selected container=\"flat\"><a href=\"#\">${2:Link 1}</a></nve-button>\n <nve-button container=\"flat\"><a href=\"#\">${3:Link 2}</a></nve-button>\n</nve-page-header>\n"
|
|
136
|
-
},
|
|
137
137
|
"Input Group": {
|
|
138
138
|
"srcFile": "input.snippets.html",
|
|
139
139
|
"prefix": [
|
|
@@ -188,33 +188,6 @@
|
|
|
188
188
|
"description": "Dialog is a component that appears above main content. A modal dialog is used to display critical information that requires users attention.",
|
|
189
189
|
"body": "<nve-dialog size=\"${6:md}\" closable>\n <nve-dialog-header>\n <h3 nve-text=\"heading semibold\">${1:Title}</h3>\n </nve-dialog-header>\n <p nve-text=\"body\">${2:Content}</p>\n <nve-dialog-footer>\n <nve-button>${3:Cancel}</nve-button>\n <nve-button interaction=\"${4:emphasis}\">${5:OK}</nve-button>\n </nve-dialog-footer>\n</nve-dialog>\n$0\n"
|
|
190
190
|
},
|
|
191
|
-
"Card": {
|
|
192
|
-
"srcFile": "card.snippets.html",
|
|
193
|
-
"prefix": [
|
|
194
|
-
"card"
|
|
195
|
-
],
|
|
196
|
-
"type": "pattern",
|
|
197
|
-
"description": "Basic Card with header and footer",
|
|
198
|
-
"body": "<nve-card>\n <nve-card-header>\n <div>\n <h2>${1:Title}</h2>\n <p>${2:Sub Title}</p>\n </div>\n </nve-card-header>\n <nve-card-content>\n ${3:\n <p>card content</p>\n }\n </nve-card-content>\n <nve-card-footer>\n <nve-button style=\"margin-left: auto\">Action</nve-button>\n </nve-card-footer>\n</nve-card>\n"
|
|
199
|
-
},
|
|
200
|
-
"Media Card": {
|
|
201
|
-
"srcFile": "card.snippets.html",
|
|
202
|
-
"prefix": [
|
|
203
|
-
"media-card"
|
|
204
|
-
],
|
|
205
|
-
"type": "pattern",
|
|
206
|
-
"description": "Basic media Card with card content and card footer",
|
|
207
|
-
"body": "<nve-card style=\"height: 100%; width: 100%;\">\n <img alt=\"example visualization for media card demo\" loading=\"lazy\" style=\"width: 100%; height: 100%; object-fit: cover;\">\n <nve-card-content>\n ${1:\n <p>•︎•︎•︎ •︎•︎•︎ •︎•︎•︎</p>\n }\n </nve-card-content>\n <nve-card-footer>\n <div nve-layout=\"grid span-items:6 gap:xs\">\n <nve-button>${2:•︎•︎•︎•︎•︎•︎}</nve-button>\n <nve-button>${3:•︎•︎•︎•︎•︎•︎}</nve-button>\n </div>\n </nve-card-footer>\n</nve-card>\n"
|
|
208
|
-
},
|
|
209
|
-
"Media Card Grid": {
|
|
210
|
-
"srcFile": "card.snippets.html",
|
|
211
|
-
"prefix": [
|
|
212
|
-
"media-card-grid"
|
|
213
|
-
],
|
|
214
|
-
"type": "pattern",
|
|
215
|
-
"description": "Grid layout with 3 media cards",
|
|
216
|
-
"body": "<section nve-layout=\"grid span-items:4 gap:md\">\n <nve-card style=\"height: 100%; width: 100%;\">\n <img alt=\"example visualization for media card 1\" loading=\"lazy\" style=\"width: 100%; height: 100%; object-fit: cover;\">\n <nve-card-content>\n ${1:\n <p>•︎•︎•︎ •︎•︎•︎ •︎•︎•︎</p>\n }\n </nve-card-content>\n <nve-card-footer>\n <div nve-layout=\"grid span-items:6 gap:xs\">\n <nve-button>${2:•︎•︎•︎•︎•︎•︎}</nve-button>\n <nve-button>${3:•︎•︎•︎•︎•︎•︎}</nve-button>\n </div>\n </nve-card-footer>\n </nve-card>\n\n <nve-card style=\"height: 100%; width: 100%;\">\n <img alt=\"example visualization for media card 2\" loading=\"lazy\" style=\"width: 100%; height: 100%; object-fit: cover;\">\n <nve-card-content>\n ${4:\n <p>•︎•︎•︎ •︎•︎•︎ •︎•︎•︎</p>\n }\n </nve-card-content>\n <nve-card-footer>\n <div nve-layout=\"grid span-items:6 gap:xs\">\n <nve-button>${5:•︎•︎•︎•︎•︎•︎}</nve-button>\n <nve-button>${6:•︎•︎•︎•︎•︎•︎}</nve-button>\n </div>\n </nve-card-footer>\n </nve-card>\n\n <nve-card style=\"height: 100%; width: 100%;\">\n <img alt=\"example visualization for media card 3\" loading=\"lazy\" style=\"width: 100%; height: 100%; object-fit: cover;\">\n <nve-card-content>\n ${7:\n <p>•︎•︎•︎ •︎•︎•︎ •︎•︎•︎</p>\n }\n </nve-card-content>\n <nve-card-footer>\n <div nve-layout=\"grid span-items:6 gap:xs\">\n <nve-button>${8:•︎•︎•︎•︎•︎•︎}</nve-button>\n <nve-button>${9:•︎•︎•︎•︎•︎•︎}</nve-button>\n </div>\n </nve-card-footer>\n </nve-card>\n</section>\n"
|
|
217
|
-
},
|
|
218
191
|
"Button Group": {
|
|
219
192
|
"srcFile": "button-group.snippets.html",
|
|
220
193
|
"prefix": [
|
|
@@ -251,6 +224,33 @@
|
|
|
251
224
|
"description": "Simple vertical button group with three icon buttons.",
|
|
252
225
|
"body": "<nve-button-group orientation=\"vertical\">\n <nve-icon-button icon-name=\"${1:copy}\"></nve-icon-button>\n <nve-icon-button icon-name=\"${2:add-comment}\"></nve-icon-button>\n <nve-icon-button icon-name=\"${3:download}\"></nve-icon-button>\n</nve-button-group>\n"
|
|
253
226
|
},
|
|
227
|
+
"Card": {
|
|
228
|
+
"srcFile": "card.snippets.html",
|
|
229
|
+
"prefix": [
|
|
230
|
+
"card"
|
|
231
|
+
],
|
|
232
|
+
"type": "pattern",
|
|
233
|
+
"description": "Basic Card with header and footer",
|
|
234
|
+
"body": "<nve-card>\n <nve-card-header>\n <div>\n <h2>${1:Title}</h2>\n <p>${2:Sub Title}</p>\n </div>\n </nve-card-header>\n <nve-card-content>\n ${3:\n <p>card content</p>\n }\n </nve-card-content>\n <nve-card-footer>\n <nve-button style=\"margin-left: auto\">Action</nve-button>\n </nve-card-footer>\n</nve-card>\n"
|
|
235
|
+
},
|
|
236
|
+
"Media Card": {
|
|
237
|
+
"srcFile": "card.snippets.html",
|
|
238
|
+
"prefix": [
|
|
239
|
+
"media-card"
|
|
240
|
+
],
|
|
241
|
+
"type": "pattern",
|
|
242
|
+
"description": "Basic media Card with card content and card footer",
|
|
243
|
+
"body": "<nve-card style=\"height: 100%; width: 100%;\">\n <img alt=\"example visualization for media card demo\" loading=\"lazy\" style=\"width: 100%; height: 100%; object-fit: cover;\">\n <nve-card-content>\n ${1:\n <p>•︎•︎•︎ •︎•︎•︎ •︎•︎•︎</p>\n }\n </nve-card-content>\n <nve-card-footer>\n <div nve-layout=\"grid span-items:6 gap:xs\">\n <nve-button>${2:•︎•︎•︎•︎•︎•︎}</nve-button>\n <nve-button>${3:•︎•︎•︎•︎•︎•︎}</nve-button>\n </div>\n </nve-card-footer>\n</nve-card>\n"
|
|
244
|
+
},
|
|
245
|
+
"Media Card Grid": {
|
|
246
|
+
"srcFile": "card.snippets.html",
|
|
247
|
+
"prefix": [
|
|
248
|
+
"media-card-grid"
|
|
249
|
+
],
|
|
250
|
+
"type": "pattern",
|
|
251
|
+
"description": "Grid layout with 3 media cards",
|
|
252
|
+
"body": "<section nve-layout=\"grid span-items:4 gap:md\">\n <nve-card style=\"height: 100%; width: 100%;\">\n <img alt=\"example visualization for media card 1\" loading=\"lazy\" style=\"width: 100%; height: 100%; object-fit: cover;\">\n <nve-card-content>\n ${1:\n <p>•︎•︎•︎ •︎•︎•︎ •︎•︎•︎</p>\n }\n </nve-card-content>\n <nve-card-footer>\n <div nve-layout=\"grid span-items:6 gap:xs\">\n <nve-button>${2:•︎•︎•︎•︎•︎•︎}</nve-button>\n <nve-button>${3:•︎•︎•︎•︎•︎•︎}</nve-button>\n </div>\n </nve-card-footer>\n </nve-card>\n\n <nve-card style=\"height: 100%; width: 100%;\">\n <img alt=\"example visualization for media card 2\" loading=\"lazy\" style=\"width: 100%; height: 100%; object-fit: cover;\">\n <nve-card-content>\n ${4:\n <p>•︎•︎•︎ •︎•︎•︎ •︎•︎•︎</p>\n }\n </nve-card-content>\n <nve-card-footer>\n <div nve-layout=\"grid span-items:6 gap:xs\">\n <nve-button>${5:•︎•︎•︎•︎•︎•︎}</nve-button>\n <nve-button>${6:•︎•︎•︎•︎•︎•︎}</nve-button>\n </div>\n </nve-card-footer>\n </nve-card>\n\n <nve-card style=\"height: 100%; width: 100%;\">\n <img alt=\"example visualization for media card 3\" loading=\"lazy\" style=\"width: 100%; height: 100%; object-fit: cover;\">\n <nve-card-content>\n ${7:\n <p>•︎•︎•︎ •︎•︎•︎ •︎•︎•︎</p>\n }\n </nve-card-content>\n <nve-card-footer>\n <div nve-layout=\"grid span-items:6 gap:xs\">\n <nve-button>${8:•︎•︎•︎•︎•︎•︎}</nve-button>\n <nve-button>${9:•︎•︎•︎•︎•︎•︎}</nve-button>\n </div>\n </nve-card-footer>\n </nve-card>\n</section>\n"
|
|
253
|
+
},
|
|
254
254
|
"Alert Group": {
|
|
255
255
|
"srcFile": "alert.snippets.html",
|
|
256
256
|
"prefix": [
|
package/dist/date/date2.js
CHANGED
package/dist/dialog/dialog2.js
CHANGED
package/dist/divider/divider2.js
CHANGED
package/dist/dot/dot2.js
CHANGED
package/dist/drawer/drawer2.js
CHANGED
package/dist/file/file2.js
CHANGED
|
@@ -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 @@
|
|
|
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.0"
|
|
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
|