@nvidia-elements/core 2.6.0 → 2.7.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 +20 -0
- package/dist/accordion/accordion2.js +4 -4
- package/dist/alert/alert-group2.js +1 -1
- package/dist/alert/alert2.js +1 -1
- package/dist/avatar/avatar-group2.js +1 -1
- package/dist/avatar/avatar2.js +1 -1
- package/dist/badge/badge2.js +1 -1
- package/dist/breadcrumb/breadcrumb2.js +1 -1
- package/dist/bundles/index.d.ts +1 -0
- package/dist/bundles/index.js +5 -5
- 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.json +588 -184
- package/dist/data.snippets.json +36 -36
- 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/format-truncate2.js +1 -1
- package/dist/forms/control/control2.js +1 -1
- package/dist/forms/control-group/control-group2.js +1 -1
- package/dist/forms/control-message/control-message2.js +1 -1
- package/dist/gauge/gauge2.js +1 -1
- package/dist/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/index.js +1 -1
- package/dist/input/input-group2.js +1 -1
- package/dist/input/input2.js +1 -1
- package/dist/internal/controllers/gesture.controller.d.ts +65 -0
- package/dist/internal/controllers/gesture.controller.examples.js +6 -0
- package/dist/internal/controllers/gesture.controller.examples.js.map +1 -0
- package/dist/internal/controllers/gesture.controller.examples.json +16 -0
- package/dist/internal/controllers/gesture.controller.js +235 -0
- package/dist/internal/controllers/gesture.controller.js.map +1 -0
- package/dist/internal/controllers/keynav-spatial.controller.d.ts +24 -0
- package/dist/internal/controllers/keynav-spatial.controller.js +75 -0
- package/dist/internal/controllers/keynav-spatial.controller.js.map +1 -0
- package/dist/internal/index.d.ts +2 -1
- package/dist/internal/index.js +30 -29
- 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/page.js +1 -1
- package/dist/page/page.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 +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-bar.js.map +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-handle.d.ts +1 -0
- package/dist/resize-handle/resize-handle2.js +42 -23
- package/dist/resize-handle/resize-handle2.js.map +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 +23 -1
- package/dist/internal/controllers/type-touch.controller.d.ts +0 -22
- package/dist/internal/controllers/type-touch.controller.examples.js +0 -6
- package/dist/internal/controllers/type-touch.controller.examples.js.map +0 -1
- package/dist/internal/controllers/type-touch.controller.examples.json +0 -16
- package/dist/internal/controllers/type-touch.controller.js +0 -58
- package/dist/internal/controllers/type-touch.controller.js.map +0 -1
package/dist/data.snippets.json
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
+
"Toolbar with Progressive Filter Chip": {
|
|
3
|
+
"srcFile": "toolbar.snippets.html",
|
|
4
|
+
"prefix": [
|
|
5
|
+
"toolbar-with-progressive-filter-chip"
|
|
6
|
+
],
|
|
7
|
+
"type": "pattern",
|
|
8
|
+
"description": "Toolbar with progressive-filter-chip",
|
|
9
|
+
"body": "<div style=\"width: 100%;\">\n <nve-toolbar container=\"flat\" style=\"width: 100%;\">\n <nve-icon-button readonly icon-name=\"filter\" container=\"flat\" slot=\"prefix\"></nve-icon-button>\n <nve-progressive-filter-chip closable>\n <select aria-label=\"dataset\">\n <option selected>${1:status}</option>\n <option>${2:workload}</option>\n </select>\n <select aria-label=\"condition\">\n <option selected>${3:filter by}</option>\n <option>${4:sort by}</option>\n </select>\n <select multiple aria-label=\"filter\">\n <option selected>${5:progress}</option>\n <option>${6:pending}</option>\n <option>${7:success}</option>\n <option>${8:failed}</option>\n </select>\n </nve-progressive-filter-chip>\n <nve-combobox container=\"flat\" style=\"flex-grow: 1; min-width: 150px;\">\n <input type=\"search\" placeholder=\"${9:Add Filter}\">\n <datalist>\n <option value=\"${10:Status}\"></option>\n <option value=\"${11:Priority}\"></option>\n <option value=\"${12:Date}\"></option>\n <option value=\"${13:Session}\"></option>\n <option value=\"${14:Configuration}\"></option>\n <option value=\"${15:Contains}\"></option>\n </datalist>\n </nve-combobox>\n <nve-icon-button container=\"flat\" aria-label=\"clear filters\" icon-name=\"cancel\" slot=\"suffix\"></nve-icon-button>\n <nve-button slot=\"suffix\">${16:Save Filters}</nve-button>\n </nve-toolbar>\n</div>\n"
|
|
10
|
+
},
|
|
2
11
|
"Tabs": {
|
|
3
12
|
"srcFile": "tabs.snippets.html",
|
|
4
13
|
"prefix": [
|
|
@@ -35,15 +44,6 @@
|
|
|
35
44
|
"description": "Tabs group with slot-matched panels controlled by tab item commands.",
|
|
36
45
|
"body": "<nve-tabs-group id=\"${1:tab-group}\">\n <nve-tabs>\n <nve-tabs-item selected command=\"--toggle\" commandfor=\"${1:tab-group}\" value=\"${2:overview}\">${3:Overview}</nve-tabs-item>\n <nve-tabs-item command=\"--toggle\" commandfor=\"${1:tab-group}\" value=\"${4:details}\">${5:Details}</nve-tabs-item>\n <nve-tabs-item command=\"--toggle\" commandfor=\"${1:tab-group}\" value=\"${6:settings}\">${7:Settings}</nve-tabs-item>\n </nve-tabs>\n <div slot=\"${2:overview}\">${8:Overview content}</div>\n <div slot=\"${4:details}\">${9:Details content}</div>\n <div slot=\"${6:settings}\">${10:Settings content}</div>\n</nve-tabs-group>\n$0\n"
|
|
37
46
|
},
|
|
38
|
-
"Toolbar with Progressive Filter Chip": {
|
|
39
|
-
"srcFile": "toolbar.snippets.html",
|
|
40
|
-
"prefix": [
|
|
41
|
-
"toolbar-with-progressive-filter-chip"
|
|
42
|
-
],
|
|
43
|
-
"type": "pattern",
|
|
44
|
-
"description": "Toolbar with progressive-filter-chip",
|
|
45
|
-
"body": "<div style=\"width: 100%;\">\n <nve-toolbar container=\"flat\" style=\"width: 100%;\">\n <nve-icon-button readonly icon-name=\"filter\" container=\"flat\" slot=\"prefix\"></nve-icon-button>\n <nve-progressive-filter-chip closable>\n <select aria-label=\"dataset\">\n <option selected>${1:status}</option>\n <option>${2:workload}</option>\n </select>\n <select aria-label=\"condition\">\n <option selected>${3:filter by}</option>\n <option>${4:sort by}</option>\n </select>\n <select multiple aria-label=\"filter\">\n <option selected>${5:progress}</option>\n <option>${6:pending}</option>\n <option>${7:success}</option>\n <option>${8:failed}</option>\n </select>\n </nve-progressive-filter-chip>\n <nve-combobox container=\"flat\" style=\"flex-grow: 1; min-width: 150px;\">\n <input type=\"search\" placeholder=\"${9:Add Filter}\">\n <datalist>\n <option value=\"${10:Status}\"></option>\n <option value=\"${11:Priority}\"></option>\n <option value=\"${12:Date}\"></option>\n <option value=\"${13:Session}\"></option>\n <option value=\"${14:Configuration}\"></option>\n <option value=\"${15:Contains}\"></option>\n </datalist>\n </nve-combobox>\n <nve-icon-button container=\"flat\" aria-label=\"clear filters\" icon-name=\"cancel\" slot=\"suffix\"></nve-icon-button>\n <nve-button slot=\"suffix\">${16:Save Filters}</nve-button>\n </nve-toolbar>\n</div>\n"
|
|
46
|
-
},
|
|
47
47
|
"Steps": {
|
|
48
48
|
"srcFile": "steps.snippets.html",
|
|
49
49
|
"prefix": [
|
|
@@ -251,33 +251,6 @@
|
|
|
251
251
|
"description": "Simple vertical button group with three icon buttons.",
|
|
252
252
|
"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
253
|
},
|
|
254
|
-
"Accordion": {
|
|
255
|
-
"srcFile": "accordion.snippets.html",
|
|
256
|
-
"prefix": [
|
|
257
|
-
"accordion"
|
|
258
|
-
],
|
|
259
|
-
"type": "pattern",
|
|
260
|
-
"description": "Basic accordion with title and content slot.",
|
|
261
|
-
"body": "<nve-accordion behavior-expand container=\"${1:flat}\">\n <nve-accordion-header>\n <div>${2:Title}</div>\n </nve-accordion-header>\n\n <nve-accordion-content> ${3:Content} </nve-accordion-content>\n</nve-accordion>\n$0\n"
|
|
262
|
-
},
|
|
263
|
-
"Accordion with Actions": {
|
|
264
|
-
"srcFile": "accordion.snippets.html",
|
|
265
|
-
"prefix": [
|
|
266
|
-
"accordion-actions"
|
|
267
|
-
],
|
|
268
|
-
"type": "pattern",
|
|
269
|
-
"description": "Accordion with action buttons in header.",
|
|
270
|
-
"body": "<nve-accordion behavior-expand container=\"${1:flat}\">\n <nve-accordion-header>\n <div>${2:Title}</div>\n\n <nve-icon-button container=\"flat\" icon-name=\"${3:add}\" size=\"sm\" slot=\"suffix\"></nve-icon-button>\n <nve-icon-button container=\"flat\" icon-name=\"${4:delete}\" size=\"sm\" slot=\"suffix\"></nve-icon-button>\n </nve-accordion-header>\n\n <nve-accordion-content> ${5:Content} </nve-accordion-content>\n</nve-accordion>\n$0\n"
|
|
271
|
-
},
|
|
272
|
-
"Accorion Group": {
|
|
273
|
-
"srcFile": "accordion.snippets.html",
|
|
274
|
-
"prefix": [
|
|
275
|
-
"accordion-group"
|
|
276
|
-
],
|
|
277
|
-
"type": "pattern",
|
|
278
|
-
"description": "Accordion group with two accordion children.",
|
|
279
|
-
"body": "<nve-accordion-group behavior-expand-single container=\"${1:flat}\">\n <nve-accordion>\n <nve-accordion-header>\n <div>${2:Title}</div>\n </nve-accordion-header>\n\n <nve-accordion-content> ${3:Content} </nve-accordion-content>\n </nve-accordion>\n\n <nve-accordion>\n <nve-accordion-header>\n <div>${4:Title}</div>\n </nve-accordion-header>\n\n <nve-accordion-content> ${5:Content} </nve-accordion-content>\n </nve-accordion>\n\n <nve-accordion>\n <nve-accordion-header>\n <div>${6:Title}</div>\n </nve-accordion-header>\n\n <nve-accordion-content> ${7:Content} </nve-accordion-content>\n </nve-accordion>\n</nve-accordion-group>\n$0\n"
|
|
280
|
-
},
|
|
281
254
|
"Alert Group": {
|
|
282
255
|
"srcFile": "alert.snippets.html",
|
|
283
256
|
"prefix": [
|
|
@@ -304,5 +277,32 @@
|
|
|
304
277
|
"type": "pattern",
|
|
305
278
|
"description": "Alert text and preformatted code output.",
|
|
306
279
|
"body": "<nve-alert-group status=\"danger\">\n <nve-alert>\n Session Paused:\n <div slot=\"content\" nve-layout=\"column gap:sm align:stretch\">\n <p nve-text=\"body sm\">Failed to verify drives. <a href=\"#\" nve-text=\"link\">Check Status</a></p>\n <nve-divider style=\"--color: var(--nve-sys-text-muted-color)\"></nve-divider>\n <pre nve-text=\"code sm\" style=\"background: transparent !important; margin: 0;\">10:06:01 AM [verify] update /virtual:/verify/\n10:06:11 AM [build] update /virtual:/build/\n10:06:22 AM [error] update /virtual:/error/ - failed to connect to remote\n </pre>\n </div>\n </nve-alert>\n</nve-alert-group>\n$0\n"
|
|
280
|
+
},
|
|
281
|
+
"Accordion": {
|
|
282
|
+
"srcFile": "accordion.snippets.html",
|
|
283
|
+
"prefix": [
|
|
284
|
+
"accordion"
|
|
285
|
+
],
|
|
286
|
+
"type": "pattern",
|
|
287
|
+
"description": "Basic accordion with title and content slot.",
|
|
288
|
+
"body": "<nve-accordion behavior-expand container=\"${1:flat}\">\n <nve-accordion-header>\n <div>${2:Title}</div>\n </nve-accordion-header>\n\n <nve-accordion-content> ${3:Content} </nve-accordion-content>\n</nve-accordion>\n$0\n"
|
|
289
|
+
},
|
|
290
|
+
"Accordion with Actions": {
|
|
291
|
+
"srcFile": "accordion.snippets.html",
|
|
292
|
+
"prefix": [
|
|
293
|
+
"accordion-actions"
|
|
294
|
+
],
|
|
295
|
+
"type": "pattern",
|
|
296
|
+
"description": "Accordion with action buttons in header.",
|
|
297
|
+
"body": "<nve-accordion behavior-expand container=\"${1:flat}\">\n <nve-accordion-header>\n <div>${2:Title}</div>\n\n <nve-icon-button container=\"flat\" icon-name=\"${3:add}\" size=\"sm\" slot=\"suffix\"></nve-icon-button>\n <nve-icon-button container=\"flat\" icon-name=\"${4:delete}\" size=\"sm\" slot=\"suffix\"></nve-icon-button>\n </nve-accordion-header>\n\n <nve-accordion-content> ${5:Content} </nve-accordion-content>\n</nve-accordion>\n$0\n"
|
|
298
|
+
},
|
|
299
|
+
"Accorion Group": {
|
|
300
|
+
"srcFile": "accordion.snippets.html",
|
|
301
|
+
"prefix": [
|
|
302
|
+
"accordion-group"
|
|
303
|
+
],
|
|
304
|
+
"type": "pattern",
|
|
305
|
+
"description": "Accordion group with two accordion children.",
|
|
306
|
+
"body": "<nve-accordion-group behavior-expand-single container=\"${1:flat}\">\n <nve-accordion>\n <nve-accordion-header>\n <div>${2:Title}</div>\n </nve-accordion-header>\n\n <nve-accordion-content> ${3:Content} </nve-accordion-content>\n </nve-accordion>\n\n <nve-accordion>\n <nve-accordion-header>\n <div>${4:Title}</div>\n </nve-accordion-header>\n\n <nve-accordion-content> ${5:Content} </nve-accordion-content>\n </nve-accordion>\n\n <nve-accordion>\n <nve-accordion-header>\n <div>${6:Title}</div>\n </nve-accordion-header>\n\n <nve-accordion-content> ${7:Content} </nve-accordion-content>\n </nve-accordion>\n</nve-accordion-group>\n$0\n"
|
|
307
307
|
}
|
|
308
308
|
}
|
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
package/dist/gauge/gauge2.js
CHANGED
package/dist/gauge/gauge2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gauge2.js","names":["#i18nController","#geometry","#paintedProgress","#normalizedThumb","#angleAtProgress","#pathAtProgress","#progressAnimation","#stopProgressAnimation","#targetProgress","#animateProgress","#normalizedValues","#animationTiming","#progressFrame","#pointAtAngle"],"sources":["../../src/gauge/gauge.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { PropertyValues } from 'lit';\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport type { Size, SupportStatus } from '@nvidia-elements/core/internal';\nimport { attachInternals, I18nController, useStyles } from '@nvidia-elements/core/internal';\nimport styles from './gauge.css?inline';\n\nconst GAUGE_GEOMETRY = {\n default: {\n center: 64,\n path: 'M 27.23 100.77 A 52 52 0 1 1 100.77 100.77',\n radius: 52,\n startAngle: 135,\n sweepAngle: 270,\n surfaceHeight: 128,\n viewBox: '8.53 8.53 110.93 95.7'\n },\n half: {\n center: 64,\n path: 'M 12 64 A 52 52 0 0 1 116 64',\n radius: 52,\n startAngle: 180,\n sweepAngle: 180,\n surfaceHeight: 64,\n viewBox: '8.53 8.53 110.93 58.93'\n }\n} as const;\n\ntype GaugeGeometry = (typeof GAUGE_GEOMETRY)[keyof typeof GAUGE_GEOMETRY];\n\nconst thumbStyle = (thumb: 'dot' | 'needle', progressAngle: number, geometry: GaugeGeometry) => ({\n [`--_${thumb}-angle`]: `${progressAngle}deg`,\n [`--_${thumb}-origin`]: `${geometry.center}px ${geometry.center}px`,\n [`--_${thumb}-start-angle`]: `${geometry.startAngle}deg`\n});\n\n/**\n * @element nve-gauge\n * @description Use a gauge to show system resource usage.\n * @documentation https://nvidia.github.io/elements/docs/elements/gauge/\n * @since 2.0.4\n * @entrypoint \\@nvidia-elements/core/gauge\n * @slot - Content to display in the gauge center.\n * @cssprop --track-width\n * @cssprop --accent-color\n * @cssprop --background\n * @cssprop --needle-background\n * @cssprop --track-background\n * @cssprop --thumb-background\n * @cssprop --color\n * @cssprop --width\n * @cssprop --height\n * @cssprop --font-size\n * @cssprop --gap\n * @aria https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/progressbar_role\n * @stable false\n */\nexport class Gauge extends LitElement {\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-gauge',\n version: '0.0.0'\n };\n\n /** @private */\n declare _internals: ElementInternals;\n\n /** The current `value` of the gauge. */\n @property({ type: Number }) value = 0;\n\n /** The `max` value of the gauge that the `value` is proportionally scaled to. */\n @property({ type: Number }) max? = 100;\n\n /** Four visual treatments represent the `status` of tasks. */\n @property({ type: String, reflect: true }) status?: SupportStatus | 'neutral' = 'neutral';\n\n /** Determines the gauge shape. Set `half` for a compact semi-circular arc. */\n @property({ type: String, reflect: true }) shape?: 'half';\n\n /** Controls the value indicator. Set `dot` for only the end dot or `needle` for a pointer. */\n @property({ type: String, reflect: true }) thumb: 'fill' | 'dot' | 'needle' = 'fill';\n\n /** T-shirt `size` of the gauge. */\n @property({ type: String, reflect: true }) size?: Size;\n\n #i18nController: I18nController<this> = new I18nController<this>(this);\n\n /** Enables updating internal string values for internationalization. */\n @property({ type: Object }) i18n = this.#i18nController.i18n;\n\n /** Progress the gauge paints, which eases toward the value instead of jumping to it. */\n #paintedProgress = 0;\n\n #progressAnimation?: Animation;\n\n #progressFrame = 0;\n\n #normalizedValues() {\n const sourceMax = this.max;\n const max = sourceMax !== undefined && Number.isFinite(sourceMax) && sourceMax > 0 ? sourceMax : 100;\n const value = Number.isFinite(this.value) ? Math.min(Math.max(this.value, 0), max) : 0;\n return { value, max };\n }\n\n render() {\n const geometry = this.#geometry();\n const progress = this.#paintedProgress;\n const thumb = this.#normalizedThumb();\n const progressAngle = this.#angleAtProgress(geometry, progress);\n const fillPath = this.#pathAtProgress(geometry, progress);\n const showFill = thumb === 'fill';\n const showDot = progress > 0 && (thumb === 'fill' || thumb === 'dot');\n\n return html`\n <div internal-host>\n <svg viewBox=${geometry.viewBox} role=\"presentation\" aria-hidden=\"true\">\n <defs>\n <mask id=\"background-mask\" maskUnits=\"userSpaceOnUse\" x=\"0\" y=\"0\" width=\"128\" height=${geometry.surfaceHeight}>\n <path d=${geometry.path} class=\"background\"></path>\n </mask>\n <mask id=\"fill-mask\" maskUnits=\"userSpaceOnUse\" x=\"0\" y=\"0\" width=\"128\" height=${geometry.surfaceHeight}>\n <path d=${fillPath} class=\"gauge\" ?empty=${progress <= 0}></path>\n </mask>\n </defs>\n <foreignObject width=\"128\" height=${geometry.surfaceHeight} mask=\"url(#background-mask)\">\n <div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"background-surface\"></div>\n </foreignObject>\n <foreignObject class=\"fill-layer\" width=\"128\" height=${geometry.surfaceHeight} mask=\"url(#fill-mask)\"\n ?hidden=${!showFill || progress <= 0}>\n <div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"fill-surface\"></div>\n </foreignObject>\n <circle class=\"fill-dot-end\" cx=${geometry.center + geometry.radius} cy=${geometry.center}\n ?hidden=${!showDot}\n style=${styleMap(thumbStyle('dot', progressAngle, geometry))}>\n </circle>\n <g class=\"needle\"\n ?hidden=${thumb !== 'needle'}\n style=${styleMap(thumbStyle('needle', progressAngle, geometry))}>\n <line class=\"needle-line\" x1=${geometry.center} y1=${geometry.center} x2=${geometry.center + 40} y2=${geometry.center}></line>\n <circle class=\"needle-hub\" cx=${geometry.center} cy=${geometry.center}></circle>\n </g>\n </svg>\n <slot></slot>\n </div>\n `;\n }\n\n connectedCallback() {\n super.connectedCallback();\n attachInternals(this);\n this._internals.role = 'progressbar';\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n\n // settle the value, otherwise reattaching paints the frame the animation was cancelled on\n if (this.#progressAnimation) {\n this.#stopProgressAnimation();\n this.#paintedProgress = this.#targetProgress();\n this.requestUpdate();\n }\n }\n\n willUpdate(props: PropertyValues<this>) {\n super.willUpdate(props);\n\n if (props.has('value') || props.has('max')) {\n this.#animateProgress();\n }\n }\n\n updated(props: PropertyValues<this>) {\n super.updated(props);\n const { value, max } = this.#normalizedValues();\n this._internals.ariaValueNow = `${value}`;\n this._internals.ariaValueMax = `${max}`;\n const { status } = this;\n const statusLabel =\n status !== undefined && status !== 'neutral' && status !== 'accent' ? this.i18n[status] : undefined;\n this._internals.ariaLabel = statusLabel ?? this.i18n.information ?? null;\n }\n\n #targetProgress() {\n const { value, max } = this.#normalizedValues();\n return (value / max) * 100;\n }\n\n /**\n * Eases the painted progress toward the value with the duration and easing declared in css, so\n * that `prefers-reduced-motion` and a `--_animation-duration` override both settle immediately.\n */\n #animateProgress() {\n const target = this.#targetProgress();\n const timing = this.hasUpdated ? this.#animationTiming() : undefined;\n\n this.#stopProgressAnimation();\n\n if (!timing || target === this.#paintedProgress) {\n this.#paintedProgress = target;\n return;\n }\n\n const from = this.#paintedProgress;\n // keyframeless animations only keep time, leaving every painted frame to `render`\n const animation = this.animate(null, timing);\n const paint = (progress: number) => {\n this.#paintedProgress = from + (target - from) * progress;\n this.requestUpdate();\n };\n const paintFrame = () => {\n paint(animation.effect?.getComputedTiming().progress ?? 0);\n\n if (animation.playState === 'running') {\n this.#progressFrame = requestAnimationFrame(paintFrame);\n }\n };\n\n animation.finished.then(\n () => {\n // a value that changes on the frame this settles already started the next animation\n if (this.#progressAnimation === animation) {\n this.#stopProgressAnimation();\n paint(1);\n }\n },\n () => undefined\n );\n\n this.#progressAnimation = animation;\n this.#progressFrame = requestAnimationFrame(paintFrame);\n }\n\n #stopProgressAnimation() {\n // only a browser render starts an animation, so server rendering never reaches these apis\n if (this.#progressAnimation) {\n cancelAnimationFrame(this.#progressFrame);\n this.#progressAnimation.cancel();\n this.#progressAnimation = undefined;\n }\n }\n\n #animationTiming() {\n const gaugeStyles = getComputedStyle(this);\n const duration = gaugeStyles.getPropertyValue('--_animation-duration').trim();\n const milliseconds = parseFloat(duration) * (duration.endsWith('ms') ? 1 : 1000);\n const easing = gaugeStyles.getPropertyValue('--nve-ref-animation-easing-100').trim();\n\n return milliseconds > 0 ? { duration: milliseconds, easing: easing || 'linear' } : undefined;\n }\n\n #angleAtProgress(geometry: GaugeGeometry, progress: number) {\n return geometry.startAngle + geometry.sweepAngle * (progress / 100);\n }\n\n #pathAtProgress(geometry: GaugeGeometry, progress: number) {\n const start = this.#pointAtAngle(geometry, geometry.startAngle);\n const sweepAngle = geometry.sweepAngle * (progress / 100);\n const end = this.#pointAtAngle(geometry, geometry.startAngle + sweepAngle);\n const largeArcFlag = sweepAngle > 180 ? 1 : 0;\n return `M ${start.x} ${start.y} A ${geometry.radius} ${geometry.radius} 0 ${largeArcFlag} 1 ${end.x} ${end.y}`;\n }\n\n #pointAtAngle(geometry: GaugeGeometry, angle: number) {\n const radians = (angle * Math.PI) / 180;\n return {\n x: geometry.center + geometry.radius * Math.cos(radians),\n y: geometry.center + geometry.radius * Math.sin(radians)\n };\n }\n\n #geometry() {\n return this.shape === 'half' ? GAUGE_GEOMETRY.half : GAUGE_GEOMETRY.default;\n }\n\n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Progress","#normalizedThumb","#angleAtProgress","#pathAtProgress","#progressAnimation","#stopProgressAnimation","#targetProgress","#animateProgress","#normalizedValues","#animationTiming","#progressFrame","#pointAtAngle"],"sources":["../../src/gauge/gauge.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { PropertyValues } from 'lit';\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport type { Size, SupportStatus } from '@nvidia-elements/core/internal';\nimport { attachInternals, I18nController, useStyles } from '@nvidia-elements/core/internal';\nimport styles from './gauge.css?inline';\n\nconst GAUGE_GEOMETRY = {\n default: {\n center: 64,\n path: 'M 27.23 100.77 A 52 52 0 1 1 100.77 100.77',\n radius: 52,\n startAngle: 135,\n sweepAngle: 270,\n surfaceHeight: 128,\n viewBox: '8.53 8.53 110.93 95.7'\n },\n half: {\n center: 64,\n path: 'M 12 64 A 52 52 0 0 1 116 64',\n radius: 52,\n startAngle: 180,\n sweepAngle: 180,\n surfaceHeight: 64,\n viewBox: '8.53 8.53 110.93 58.93'\n }\n} as const;\n\ntype GaugeGeometry = (typeof GAUGE_GEOMETRY)[keyof typeof GAUGE_GEOMETRY];\n\nconst thumbStyle = (thumb: 'dot' | 'needle', progressAngle: number, geometry: GaugeGeometry) => ({\n [`--_${thumb}-angle`]: `${progressAngle}deg`,\n [`--_${thumb}-origin`]: `${geometry.center}px ${geometry.center}px`,\n [`--_${thumb}-start-angle`]: `${geometry.startAngle}deg`\n});\n\n/**\n * @element nve-gauge\n * @description Use a gauge to show system resource usage.\n * @documentation https://nvidia.github.io/elements/docs/elements/gauge/\n * @since 2.0.4\n * @entrypoint \\@nvidia-elements/core/gauge\n * @slot - Content to display in the gauge center.\n * @cssprop --track-width\n * @cssprop --accent-color\n * @cssprop --background\n * @cssprop --needle-background\n * @cssprop --track-background\n * @cssprop --thumb-background\n * @cssprop --color\n * @cssprop --width\n * @cssprop --height\n * @cssprop --font-size\n * @cssprop --gap\n * @aria https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/progressbar_role\n * @stable false\n */\nexport class Gauge extends LitElement {\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-gauge',\n version: '0.0.0'\n };\n\n /** @private */\n declare _internals: ElementInternals;\n\n /** The current `value` of the gauge. */\n @property({ type: Number }) value = 0;\n\n /** The `max` value of the gauge that the `value` is proportionally scaled to. */\n @property({ type: Number }) max? = 100;\n\n /** Four visual treatments represent the `status` of tasks. */\n @property({ type: String, reflect: true }) status?: SupportStatus | 'neutral' = 'neutral';\n\n /** Determines the gauge shape. Set `half` for a compact semi-circular arc. */\n @property({ type: String, reflect: true }) shape?: 'half';\n\n /** Controls the value indicator. Set `dot` for only the end dot or `needle` for a pointer. */\n @property({ type: String, reflect: true }) thumb: 'fill' | 'dot' | 'needle' = 'fill';\n\n /** T-shirt `size` of the gauge. */\n @property({ type: String, reflect: true }) size?: Size;\n\n #i18nController: I18nController<this> = new I18nController<this>(this);\n\n /** Enables updating internal string values for internationalization. */\n @property({ type: Object }) i18n = this.#i18nController.i18n;\n\n /** Progress the gauge paints, which eases toward the value instead of jumping to it. */\n #paintedProgress = 0;\n\n #progressAnimation?: Animation;\n\n #progressFrame = 0;\n\n #normalizedValues() {\n const sourceMax = this.max;\n const max = sourceMax !== undefined && Number.isFinite(sourceMax) && sourceMax > 0 ? sourceMax : 100;\n const value = Number.isFinite(this.value) ? Math.min(Math.max(this.value, 0), max) : 0;\n return { value, max };\n }\n\n render() {\n const geometry = this.#geometry();\n const progress = this.#paintedProgress;\n const thumb = this.#normalizedThumb();\n const progressAngle = this.#angleAtProgress(geometry, progress);\n const fillPath = this.#pathAtProgress(geometry, progress);\n const showFill = thumb === 'fill';\n const showDot = progress > 0 && (thumb === 'fill' || thumb === 'dot');\n\n return html`\n <div internal-host>\n <svg viewBox=${geometry.viewBox} role=\"presentation\" aria-hidden=\"true\">\n <defs>\n <mask id=\"background-mask\" maskUnits=\"userSpaceOnUse\" x=\"0\" y=\"0\" width=\"128\" height=${geometry.surfaceHeight}>\n <path d=${geometry.path} class=\"background\"></path>\n </mask>\n <mask id=\"fill-mask\" maskUnits=\"userSpaceOnUse\" x=\"0\" y=\"0\" width=\"128\" height=${geometry.surfaceHeight}>\n <path d=${fillPath} class=\"gauge\" ?empty=${progress <= 0}></path>\n </mask>\n </defs>\n <foreignObject width=\"128\" height=${geometry.surfaceHeight} mask=\"url(#background-mask)\">\n <div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"background-surface\"></div>\n </foreignObject>\n <foreignObject class=\"fill-layer\" width=\"128\" height=${geometry.surfaceHeight} mask=\"url(#fill-mask)\"\n ?hidden=${!showFill || progress <= 0}>\n <div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"fill-surface\"></div>\n </foreignObject>\n <circle class=\"fill-dot-end\" cx=${geometry.center + geometry.radius} cy=${geometry.center}\n ?hidden=${!showDot}\n style=${styleMap(thumbStyle('dot', progressAngle, geometry))}>\n </circle>\n <g class=\"needle\"\n ?hidden=${thumb !== 'needle'}\n style=${styleMap(thumbStyle('needle', progressAngle, geometry))}>\n <line class=\"needle-line\" x1=${geometry.center} y1=${geometry.center} x2=${geometry.center + 40} y2=${geometry.center}></line>\n <circle class=\"needle-hub\" cx=${geometry.center} cy=${geometry.center}></circle>\n </g>\n </svg>\n <slot></slot>\n </div>\n `;\n }\n\n connectedCallback() {\n super.connectedCallback();\n attachInternals(this);\n this._internals.role = 'progressbar';\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n\n // settle the value, otherwise reattaching paints the frame where the animation stopped\n if (this.#progressAnimation) {\n this.#stopProgressAnimation();\n this.#paintedProgress = this.#targetProgress();\n this.requestUpdate();\n }\n }\n\n willUpdate(props: PropertyValues<this>) {\n super.willUpdate(props);\n\n if (props.has('value') || props.has('max')) {\n this.#animateProgress();\n }\n }\n\n updated(props: PropertyValues<this>) {\n super.updated(props);\n const { value, max } = this.#normalizedValues();\n this._internals.ariaValueNow = `${value}`;\n this._internals.ariaValueMax = `${max}`;\n const { status } = this;\n const statusLabel =\n status !== undefined && status !== 'neutral' && status !== 'accent' ? this.i18n[status] : undefined;\n this._internals.ariaLabel = statusLabel ?? this.i18n.information ?? null;\n }\n\n #targetProgress() {\n const { value, max } = this.#normalizedValues();\n return (value / max) * 100;\n }\n\n /**\n * Eases the painted progress toward the value with the duration and easing declared in css, so\n * that `prefers-reduced-motion` and a `--_animation-duration` override both settle immediately.\n */\n #animateProgress() {\n const target = this.#targetProgress();\n const timing = this.hasUpdated ? this.#animationTiming() : undefined;\n\n this.#stopProgressAnimation();\n\n if (!timing || target === this.#paintedProgress) {\n this.#paintedProgress = target;\n return;\n }\n\n const from = this.#paintedProgress;\n // keyframeless animations only keep time, leaving every painted frame to `render`\n const animation = this.animate(null, timing);\n const paint = (progress: number) => {\n this.#paintedProgress = from + (target - from) * progress;\n this.requestUpdate();\n };\n const paintFrame = () => {\n paint(animation.effect?.getComputedTiming().progress ?? 0);\n\n if (animation.playState === 'running') {\n this.#progressFrame = requestAnimationFrame(paintFrame);\n }\n };\n\n animation.finished.then(\n () => {\n // a value that changes on the frame this settles already started the next animation\n if (this.#progressAnimation === animation) {\n this.#stopProgressAnimation();\n paint(1);\n }\n },\n () => undefined\n );\n\n this.#progressAnimation = animation;\n this.#progressFrame = requestAnimationFrame(paintFrame);\n }\n\n #stopProgressAnimation() {\n // only a browser render starts an animation, so server rendering never reaches these apis\n if (this.#progressAnimation) {\n cancelAnimationFrame(this.#progressFrame);\n this.#progressAnimation.cancel();\n this.#progressAnimation = undefined;\n }\n }\n\n #animationTiming() {\n const gaugeStyles = getComputedStyle(this);\n const duration = gaugeStyles.getPropertyValue('--_animation-duration').trim();\n const milliseconds = parseFloat(duration) * (duration.endsWith('ms') ? 1 : 1000);\n const easing = gaugeStyles.getPropertyValue('--nve-ref-animation-easing-100').trim();\n\n return milliseconds > 0 ? { duration: milliseconds, easing: easing || 'linear' } : undefined;\n }\n\n #angleAtProgress(geometry: GaugeGeometry, progress: number) {\n return geometry.startAngle + geometry.sweepAngle * (progress / 100);\n }\n\n #pathAtProgress(geometry: GaugeGeometry, progress: number) {\n const start = this.#pointAtAngle(geometry, geometry.startAngle);\n const sweepAngle = geometry.sweepAngle * (progress / 100);\n const end = this.#pointAtAngle(geometry, geometry.startAngle + sweepAngle);\n const largeArcFlag = sweepAngle > 180 ? 1 : 0;\n return `M ${start.x} ${start.y} A ${geometry.radius} ${geometry.radius} 0 ${largeArcFlag} 1 ${end.x} ${end.y}`;\n }\n\n #pointAtAngle(geometry: GaugeGeometry, angle: number) {\n const radians = (angle * Math.PI) / 180;\n return {\n x: geometry.center + geometry.radius * Math.cos(radians),\n y: geometry.center + geometry.radius * Math.sin(radians)\n };\n }\n\n #geometry() {\n return this.shape === 'half' ? GAUGE_GEOMETRY.half : GAUGE_GEOMETRY.default;\n }\n\n #normalizedThumb() {\n return this.thumb === 'dot' || this.thumb === 'needle' ? this.thumb : 'fill';\n }\n}\n"],"mappings":";;;;;;;;;AAWA,IAAM,IAAiB;CACrB,SAAS;EACP,QAAQ;EACR,MAAM;EACN,QAAQ;EACR,YAAY;EACZ,YAAY;EACZ,eAAe;EACf,SAAS;CACX;CACA,MAAM;EACJ,QAAQ;EACR,MAAM;EACN,QAAQ;EACR,YAAY;EACZ,YAAY;EACZ,eAAe;EACf,SAAS;CACX;AACF,GAIM,KAAc,GAAyB,GAAuB,OAA6B;EAC9F,MAAM,EAAM,UAAU,GAAG,EAAc;EACvC,MAAM,EAAM,WAAW,GAAG,EAAS,OAAO,KAAK,EAAS,OAAO;EAC/D,MAAM,EAAM,gBAAgB,GAAG,EAAS,WAAW;AACtD,IAuBa,IAAb,cAA2B,EAAW;;4BAYA,cAGD,mBAG6C,wBAMF,kBAKtC,IAAI,EAAqB,IAAI,eAGlC,KAAKA,GAAgB,gBAGrC,aAIF;;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AAA,EAAA,WAAA,SAAA,KAAA,CAAA,MAGzB,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,OAAA,KAAA,CAAA,MAGzB,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,UAAA,KAAA,CAAA,MAGxC,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,SAAA,KAAA,CAAA,MAGxC,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,SAAA,KAAA,CAAA,MAGxC,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,MAKxC,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA"}
|
package/dist/grid/cell/cell2.js
CHANGED
package/dist/grid/grid2.js
CHANGED
package/dist/grid/row/row2.js
CHANGED
package/dist/icon/icon2.js
CHANGED
|
@@ -16,7 +16,7 @@ var f = class e extends o {
|
|
|
16
16
|
static {
|
|
17
17
|
this.metadata = {
|
|
18
18
|
tag: "nve-icon",
|
|
19
|
-
version: "2.
|
|
19
|
+
version: "2.7.0"
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
static {
|
|
@@ -103,7 +103,7 @@ a([l({
|
|
|
103
103
|
})], f.prototype, "name", void 0), a([d()], f.prototype, "svg", void 0);
|
|
104
104
|
function p(t) {
|
|
105
105
|
if (typeof globalThis.customElements?.get == "function") {
|
|
106
|
-
let n = e(t.metadata.version), i = e("2.
|
|
106
|
+
let n = e(t.metadata.version), i = e("2.7.0");
|
|
107
107
|
n.minor <= i.minor && n.major <= i.major && (t._icons = {
|
|
108
108
|
...t._icons,
|
|
109
109
|
...r
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { I18nService as e } from "./internal/services/i18n.service.js";
|
|
|
2
2
|
import { getThemeTokens as t } from "./internal/utils/dom.js";
|
|
3
3
|
import { statusIcons as n } from "./internal/types/index.js";
|
|
4
4
|
//#region src/index.ts
|
|
5
|
-
var r = "2.
|
|
5
|
+
var r = "2.7.0", i = "@nvidia-elements";
|
|
6
6
|
//#endregion
|
|
7
7
|
export { e as I18nService, i as SCOPE, r as VERSION, t as getThemeTokens, n as statusIcons };
|
|
8
8
|
|