@nvidia-elements/core 2.23.3 → 2.23.5

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 (274) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/accordion/accordion2.js +49 -49
  3. package/dist/accordion/accordion2.js.map +1 -1
  4. package/dist/alert/alert-group2.js +22 -21
  5. package/dist/alert/alert-group2.js.map +1 -1
  6. package/dist/alert/alert2.js +29 -28
  7. package/dist/alert/alert2.js.map +1 -1
  8. package/dist/avatar/avatar-group2.js +9 -9
  9. package/dist/avatar/avatar-group2.js.map +1 -1
  10. package/dist/avatar/avatar2.js +12 -11
  11. package/dist/avatar/avatar2.js.map +1 -1
  12. package/dist/badge/badge2.js +27 -26
  13. package/dist/badge/badge2.js.map +1 -1
  14. package/dist/breadcrumb/breadcrumb2.js +17 -17
  15. package/dist/breadcrumb/breadcrumb2.js.map +1 -1
  16. package/dist/bundles/index.js +6 -6
  17. package/dist/button/button2.js +12 -12
  18. package/dist/button/button2.js.map +1 -1
  19. package/dist/button-group/button-group2.js +18 -18
  20. package/dist/button-group/button-group2.js.map +1 -1
  21. package/dist/card/card2.js +28 -28
  22. package/dist/card/card2.js.map +1 -1
  23. package/dist/chat-message/chat-message2.js +15 -14
  24. package/dist/chat-message/chat-message2.js.map +1 -1
  25. package/dist/checkbox/checkbox-group2.js +8 -8
  26. package/dist/checkbox/checkbox-group2.js.map +1 -1
  27. package/dist/checkbox/checkbox2.js +8 -8
  28. package/dist/checkbox/checkbox2.js.map +1 -1
  29. package/dist/color/color2.js +21 -21
  30. package/dist/color/color2.js.map +1 -1
  31. package/dist/combobox/combobox2.js +37 -37
  32. package/dist/combobox/combobox2.js.map +1 -1
  33. package/dist/copy-button/copy-button.d.ts +1 -1
  34. package/dist/copy-button/copy-button2.js +21 -21
  35. package/dist/copy-button/copy-button2.js.map +1 -1
  36. package/dist/custom-elements.json +0 -76
  37. package/dist/data.snippets.json +27 -27
  38. package/dist/date/date2.js +19 -19
  39. package/dist/date/date2.js.map +1 -1
  40. package/dist/datetime/datetime2.js +19 -19
  41. package/dist/datetime/datetime2.js.map +1 -1
  42. package/dist/dialog/dialog-footer2.js +7 -7
  43. package/dist/dialog/dialog-footer2.js.map +1 -1
  44. package/dist/dialog/dialog-header2.js +7 -7
  45. package/dist/dialog/dialog-header2.js.map +1 -1
  46. package/dist/dialog/dialog.js +1 -1
  47. package/dist/dialog/dialog.js.map +1 -1
  48. package/dist/dialog/dialog2.js +25 -25
  49. package/dist/dialog/dialog2.js.map +1 -1
  50. package/dist/divider/divider2.js +12 -12
  51. package/dist/divider/divider2.js.map +1 -1
  52. package/dist/dot/dot2.js +17 -16
  53. package/dist/dot/dot2.js.map +1 -1
  54. package/dist/drag-handle/drag-handle2.js +12 -12
  55. package/dist/drag-handle/drag-handle2.js.map +1 -1
  56. package/dist/drawer/drawer-content2.js +7 -7
  57. package/dist/drawer/drawer-content2.js.map +1 -1
  58. package/dist/drawer/drawer-footer2.js +7 -7
  59. package/dist/drawer/drawer-footer2.js.map +1 -1
  60. package/dist/drawer/drawer-header2.js +7 -7
  61. package/dist/drawer/drawer-header2.js.map +1 -1
  62. package/dist/drawer/drawer.js +1 -1
  63. package/dist/drawer/drawer.js.map +1 -1
  64. package/dist/drawer/drawer2.js +21 -21
  65. package/dist/drawer/drawer2.js.map +1 -1
  66. package/dist/dropdown/dropdown-footer2.js +7 -7
  67. package/dist/dropdown/dropdown-footer2.js.map +1 -1
  68. package/dist/dropdown/dropdown-header2.js +7 -7
  69. package/dist/dropdown/dropdown-header2.js.map +1 -1
  70. package/dist/dropdown/dropdown2.js +21 -21
  71. package/dist/dropdown/dropdown2.js.map +1 -1
  72. package/dist/dropdown-group/dropdown-group.js +10 -10
  73. package/dist/dropdown-group/dropdown-group.js.map +1 -1
  74. package/dist/dropzone/dropzone2.js +19 -19
  75. package/dist/dropzone/dropzone2.js.map +1 -1
  76. package/dist/file/file2.js +8 -8
  77. package/dist/file/file2.js.map +1 -1
  78. package/dist/format-bytes/format-bytes2.js +13 -13
  79. package/dist/format-bytes/format-bytes2.js.map +1 -1
  80. package/dist/format-datetime/format-datetime2.js +14 -14
  81. package/dist/format-datetime/format-datetime2.js.map +1 -1
  82. package/dist/format-number/format-number2.js +20 -20
  83. package/dist/format-number/format-number2.js.map +1 -1
  84. package/dist/format-relative-time/format-relative-time2.js +11 -11
  85. package/dist/format-relative-time/format-relative-time2.js.map +1 -1
  86. package/dist/format-truncate/format-truncate2.js +21 -21
  87. package/dist/format-truncate/format-truncate2.js.map +1 -1
  88. package/dist/forms/control/control2.js +30 -29
  89. package/dist/forms/control/control2.js.map +1 -1
  90. package/dist/forms/control-group/control-group2.js +19 -18
  91. package/dist/forms/control-group/control-group2.js.map +1 -1
  92. package/dist/forms/control-message/control-message2.js +15 -15
  93. package/dist/forms/control-message/control-message2.js.map +1 -1
  94. package/dist/gauge/gauge2.js +20 -20
  95. package/dist/gauge/gauge2.js.map +1 -1
  96. package/dist/ghost/ghost2.js +10 -10
  97. package/dist/ghost/ghost2.js.map +1 -1
  98. package/dist/grid/cell/cell2.js +9 -9
  99. package/dist/grid/cell/cell2.js.map +1 -1
  100. package/dist/grid/column/column2.js +16 -16
  101. package/dist/grid/column/column2.js.map +1 -1
  102. package/dist/grid/footer/footer2.js +12 -12
  103. package/dist/grid/footer/footer2.js.map +1 -1
  104. package/dist/grid/grid2.js +30 -30
  105. package/dist/grid/grid2.js.map +1 -1
  106. package/dist/grid/header/header2.js +20 -20
  107. package/dist/grid/header/header2.js.map +1 -1
  108. package/dist/grid/placeholder/placeholder2.js +9 -9
  109. package/dist/grid/placeholder/placeholder2.js.map +1 -1
  110. package/dist/grid/row/row2.js +15 -15
  111. package/dist/grid/row/row2.js.map +1 -1
  112. package/dist/icon/icon2.js +40 -40
  113. package/dist/icon/icon2.js.map +1 -1
  114. package/dist/icon-button/icon-button2.js +17 -17
  115. package/dist/icon-button/icon-button2.js.map +1 -1
  116. package/dist/iframe/iframe2.js +7 -7
  117. package/dist/iframe/iframe2.js.map +1 -1
  118. package/dist/index.js +1 -1
  119. package/dist/input/input-group2.js +8 -8
  120. package/dist/input/input-group2.js.map +1 -1
  121. package/dist/input/input2.js +10 -10
  122. package/dist/input/input2.js.map +1 -1
  123. package/dist/internal/controllers/state-expanded.controller.js +1 -1
  124. package/dist/internal/controllers/state-expanded.controller.js.map +1 -1
  125. package/dist/internal/controllers/state-highlighted.controller.js +1 -1
  126. package/dist/internal/controllers/state-highlighted.controller.js.map +1 -1
  127. package/dist/internal/controllers/state-scroll.controller.js +1 -1
  128. package/dist/internal/controllers/state-scroll.controller.js.map +1 -1
  129. package/dist/internal/controllers/state-selected.controller.js +1 -1
  130. package/dist/internal/controllers/state-selected.controller.js.map +1 -1
  131. package/dist/internal/controllers/type-anchor.controller.js +1 -1
  132. package/dist/internal/controllers/type-anchor.controller.js.map +1 -1
  133. package/dist/internal/controllers/type-closable.controller.js +1 -1
  134. package/dist/internal/controllers/type-closable.controller.js.map +1 -1
  135. package/dist/internal/controllers/type-expandable.controller.js +1 -1
  136. package/dist/internal/controllers/type-expandable.controller.js.map +1 -1
  137. package/dist/internal/controllers/type-native-popover.controller.js +6 -6
  138. package/dist/internal/controllers/type-native-popover.controller.js.map +1 -1
  139. package/dist/internal/controllers/type-popover.controller.examples.js.map +1 -1
  140. package/dist/internal/controllers/type-selectable.controller.js +1 -1
  141. package/dist/internal/controllers/type-selectable.controller.js.map +1 -1
  142. package/dist/internal/index.d.ts +0 -1
  143. package/dist/internal/index.js +57 -61
  144. package/dist/internal/index.js.map +1 -1
  145. package/dist/internal/styles/index.d.ts +0 -1
  146. package/dist/internal/styles/index.js +5 -15
  147. package/dist/internal/styles/index.js.map +1 -1
  148. package/dist/internal/utils/a11y.d.ts +0 -3
  149. package/dist/internal/utils/a11y.js +6 -9
  150. package/dist/internal/utils/a11y.js.map +1 -1
  151. package/dist/joystick/joystick2.js +19 -19
  152. package/dist/joystick/joystick2.js.map +1 -1
  153. package/dist/logo/logo2.js +14 -13
  154. package/dist/logo/logo2.js.map +1 -1
  155. package/dist/menu/menu-group2.js +20 -20
  156. package/dist/menu/menu-group2.js.map +1 -1
  157. package/dist/menu/menu-item2.js +11 -11
  158. package/dist/menu/menu-item2.js.map +1 -1
  159. package/dist/menu/menu2.js +14 -14
  160. package/dist/menu/menu2.js.map +1 -1
  161. package/dist/month/month2.js +19 -19
  162. package/dist/month/month2.js.map +1 -1
  163. package/dist/notification/notification-group2.js +13 -13
  164. package/dist/notification/notification-group2.js.map +1 -1
  165. package/dist/notification/notification2.js +31 -31
  166. package/dist/notification/notification2.js.map +1 -1
  167. package/dist/page/page-panel/page-panel-content2.js +7 -7
  168. package/dist/page/page-panel/page-panel-content2.js.map +1 -1
  169. package/dist/page/page-panel/page-panel-footer2.js +9 -9
  170. package/dist/page/page-panel/page-panel-footer2.js.map +1 -1
  171. package/dist/page/page-panel/page-panel-header2.js +9 -9
  172. package/dist/page/page-panel/page-panel-header2.js.map +1 -1
  173. package/dist/page/page-panel/page-panel2.js +15 -15
  174. package/dist/page/page-panel/page-panel2.js.map +1 -1
  175. package/dist/page/page2.js +13 -13
  176. package/dist/page/page2.js.map +1 -1
  177. package/dist/page-header/page-header2.js +10 -10
  178. package/dist/page-header/page-header2.js.map +1 -1
  179. package/dist/page-loader/page-loader2.js +13 -13
  180. package/dist/page-loader/page-loader2.js.map +1 -1
  181. package/dist/pagination/pagination2.js +34 -34
  182. package/dist/pagination/pagination2.js.map +1 -1
  183. package/dist/panel/panel2.js +36 -36
  184. package/dist/panel/panel2.js.map +1 -1
  185. package/dist/password/password2.js +19 -19
  186. package/dist/password/password2.js.map +1 -1
  187. package/dist/preferences-input/preferences-input.d.ts +1 -1
  188. package/dist/preferences-input/preferences-input2.js +25 -25
  189. package/dist/preferences-input/preferences-input2.js.map +1 -1
  190. package/dist/progress-bar/progress-bar2.js +13 -13
  191. package/dist/progress-bar/progress-bar2.js.map +1 -1
  192. package/dist/progress-dot/progress-dot2.js +15 -15
  193. package/dist/progress-dot/progress-dot2.js.map +1 -1
  194. package/dist/progress-ring/progress-ring2.js +20 -20
  195. package/dist/progress-ring/progress-ring2.js.map +1 -1
  196. package/dist/progressive-filter-chip/progressive-filter-chip2.js +28 -28
  197. package/dist/progressive-filter-chip/progressive-filter-chip2.js.map +1 -1
  198. package/dist/pulse/pulse2.js +15 -15
  199. package/dist/pulse/pulse2.js.map +1 -1
  200. package/dist/radio/radio-group2.js +8 -8
  201. package/dist/radio/radio-group2.js.map +1 -1
  202. package/dist/radio/radio2.js +8 -8
  203. package/dist/radio/radio2.js.map +1 -1
  204. package/dist/range/range2.js +16 -16
  205. package/dist/range/range2.js.map +1 -1
  206. package/dist/resize-handle/resize-handle2.js +17 -17
  207. package/dist/resize-handle/resize-handle2.js.map +1 -1
  208. package/dist/search/search2.js +20 -20
  209. package/dist/search/search2.js.map +1 -1
  210. package/dist/select/select2.js +32 -32
  211. package/dist/select/select2.js.map +1 -1
  212. package/dist/skeleton/skeleton2.js +14 -14
  213. package/dist/skeleton/skeleton2.js.map +1 -1
  214. package/dist/sort-button/sort-button.d.ts +1 -1
  215. package/dist/sort-button/sort-button2.js +16 -16
  216. package/dist/sort-button/sort-button2.js.map +1 -1
  217. package/dist/sparkline/sparkline2.js +45 -44
  218. package/dist/sparkline/sparkline2.js.map +1 -1
  219. package/dist/star-rating/star-rating2.js +14 -14
  220. package/dist/star-rating/star-rating2.js.map +1 -1
  221. package/dist/steps/steps2.js +32 -32
  222. package/dist/steps/steps2.js.map +1 -1
  223. package/dist/switch/switch-group2.js +8 -8
  224. package/dist/switch/switch-group2.js.map +1 -1
  225. package/dist/switch/switch2.js +8 -8
  226. package/dist/switch/switch2.js.map +1 -1
  227. package/dist/tabs/tabs-group2.js +18 -18
  228. package/dist/tabs/tabs-group2.js.map +1 -1
  229. package/dist/tabs/tabs-item-group2.js +9 -9
  230. package/dist/tabs/tabs-item-group2.js.map +1 -1
  231. package/dist/tabs/tabs2.js +28 -28
  232. package/dist/tabs/tabs2.js.map +1 -1
  233. package/dist/tag/tag2.js +19 -18
  234. package/dist/tag/tag2.js.map +1 -1
  235. package/dist/textarea/textarea2.js +9 -9
  236. package/dist/textarea/textarea2.js.map +1 -1
  237. package/dist/time/time2.js +19 -19
  238. package/dist/time/time2.js.map +1 -1
  239. package/dist/toast/toast2.js +28 -28
  240. package/dist/toast/toast2.js.map +1 -1
  241. package/dist/toggletip/toggletip-footer2.js +7 -7
  242. package/dist/toggletip/toggletip-footer2.js.map +1 -1
  243. package/dist/toggletip/toggletip-header2.js +7 -7
  244. package/dist/toggletip/toggletip-header2.js.map +1 -1
  245. package/dist/toggletip/toggletip2.js +23 -23
  246. package/dist/toggletip/toggletip2.js.map +1 -1
  247. package/dist/toolbar/toolbar2.js +20 -19
  248. package/dist/toolbar/toolbar2.js.map +1 -1
  249. package/dist/tooltip/tooltip2.js +20 -20
  250. package/dist/tooltip/tooltip2.js.map +1 -1
  251. package/dist/tree/tree-node2.js +39 -39
  252. package/dist/tree/tree-node2.js.map +1 -1
  253. package/dist/tree/tree2.js +20 -20
  254. package/dist/tree/tree2.js.map +1 -1
  255. package/dist/week/week2.js +19 -19
  256. package/dist/week/week2.js.map +1 -1
  257. package/dist/workspace/panel/panel2.js +14 -14
  258. package/dist/workspace/panel/panel2.js.map +1 -1
  259. package/dist/workspace/panel-content/panel-content2.js +7 -7
  260. package/dist/workspace/panel-content/panel-content2.js.map +1 -1
  261. package/dist/workspace/panel-footer/panel-footer2.js +9 -9
  262. package/dist/workspace/panel-footer/panel-footer2.js.map +1 -1
  263. package/dist/workspace/panel-header/panel-header2.js +16 -16
  264. package/dist/workspace/panel-header/panel-header2.js.map +1 -1
  265. package/dist/workspace/workspace2.js +97 -97
  266. package/dist/workspace/workspace2.js.map +1 -1
  267. package/package.json +2 -2
  268. package/dist/internal/decorators/scoped-registry.d.ts +0 -2
  269. package/dist/internal/decorators/scoped-registry.js +0 -36
  270. package/dist/internal/decorators/scoped-registry.js.map +0 -1
  271. package/dist/internal/styles/base.js +0 -5
  272. package/dist/internal/styles/base.js.map +0 -1
  273. package/dist/internal/styles/interaction-state.js +0 -5
  274. package/dist/internal/styles/interaction-state.js.map +0 -1
@@ -1,9 +1,9 @@
1
1
  import { typeSSR as e } from "../internal/controllers/type-ssr.controller.js";
2
- import { useStyles as t } from "../internal/styles/index.js";
3
- import n from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorate.js";
4
- import r from "./format-number.js";
5
- import { LitElement as i, html as a } from "lit";
6
- import { property as o } from "lit/decorators/property.js";
2
+ import t from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorate.js";
3
+ import n from "./format-number.js";
4
+ import { LitElement as r, html as i } from "lit";
5
+ import { property as a } from "lit/decorators/property.js";
6
+ import { useStyles as o } from "@nvidia-elements/foundations/internal/styles";
7
7
  // src/format-number/format-number.ts
8
8
  var s = [
9
9
  ["currency", "currency"],
@@ -18,17 +18,17 @@ var s = [
18
18
  ["minimumFractionDigits", "minimumFractionDigits"],
19
19
  ["maximumFractionDigits", "maximumFractionDigits"],
20
20
  ["minimumIntegerDigits", "minimumIntegerDigits"]
21
- ], l = class extends i {
21
+ ], l = class extends r {
22
22
  constructor(...e) {
23
23
  super(...e), this.formatStyle = "decimal";
24
24
  }
25
25
  static {
26
- this.styles = t([r]);
26
+ this.styles = o([n]);
27
27
  }
28
28
  static {
29
29
  this.metadata = {
30
30
  tag: "nve-format-number",
31
- version: "2.23.3"
31
+ version: "2.23.5"
32
32
  };
33
33
  }
34
34
  get #e() {
@@ -67,43 +67,43 @@ var s = [
67
67
  }
68
68
  }
69
69
  render() {
70
- return a`<data internal-host value="${this.#e}">${this.#i}<slot @slotchange="${this.#a}" hidden></slot></data>`;
70
+ return i`<data internal-host value="${this.#e}">${this.#i}<slot @slotchange="${this.#a}" hidden></slot></data>`;
71
71
  }
72
72
  #a() {
73
73
  this.requestUpdate();
74
74
  }
75
75
  };
76
- n([o({ type: String })], l.prototype, "number", void 0), n([o({ type: String })], l.prototype, "locale", void 0), n([o({
76
+ t([a({ type: String })], l.prototype, "number", void 0), t([a({ type: String })], l.prototype, "locale", void 0), t([a({
77
77
  type: String,
78
78
  attribute: "format-style"
79
- })], l.prototype, "formatStyle", void 0), n([o({ type: String })], l.prototype, "currency", void 0), n([o({
79
+ })], l.prototype, "formatStyle", void 0), t([a({ type: String })], l.prototype, "currency", void 0), t([a({
80
80
  type: String,
81
81
  attribute: "currency-sign"
82
- })], l.prototype, "currencySign", void 0), n([o({
82
+ })], l.prototype, "currencySign", void 0), t([a({
83
83
  type: String,
84
84
  attribute: "currency-display"
85
- })], l.prototype, "currencyDisplay", void 0), n([o({ type: String })], l.prototype, "unit", void 0), n([o({
85
+ })], l.prototype, "currencyDisplay", void 0), t([a({ type: String })], l.prototype, "unit", void 0), t([a({
86
86
  type: String,
87
87
  attribute: "unit-display"
88
- })], l.prototype, "unitDisplay", void 0), n([o({ type: String })], l.prototype, "notation", void 0), n([o({
88
+ })], l.prototype, "unitDisplay", void 0), t([a({ type: String })], l.prototype, "notation", void 0), t([a({
89
89
  type: String,
90
90
  attribute: "compact-display"
91
- })], l.prototype, "compactDisplay", void 0), n([o({
91
+ })], l.prototype, "compactDisplay", void 0), t([a({
92
92
  type: String,
93
93
  attribute: "sign-display"
94
- })], l.prototype, "signDisplay", void 0), n([o({
94
+ })], l.prototype, "signDisplay", void 0), t([a({
95
95
  type: String,
96
96
  attribute: "use-grouping"
97
- })], l.prototype, "useGrouping", void 0), n([o({
97
+ })], l.prototype, "useGrouping", void 0), t([a({
98
98
  type: Number,
99
99
  attribute: "minimum-fraction-digits"
100
- })], l.prototype, "minimumFractionDigits", void 0), n([o({
100
+ })], l.prototype, "minimumFractionDigits", void 0), t([a({
101
101
  type: Number,
102
102
  attribute: "maximum-fraction-digits"
103
- })], l.prototype, "maximumFractionDigits", void 0), n([o({
103
+ })], l.prototype, "maximumFractionDigits", void 0), t([a({
104
104
  type: Number,
105
105
  attribute: "minimum-integer-digits"
106
- })], l.prototype, "minimumIntegerDigits", void 0), l = n([e()], l);
106
+ })], l.prototype, "minimumIntegerDigits", void 0), l = t([e()], l);
107
107
  export { l as FormatNumber };
108
108
 
109
109
  //# sourceMappingURL=format-number2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-number2.js","names":["styles","_decorate","__decorate","format_number_default","STRING_KEYS","NUMBER_KEYS","FormatNumber","LitElement","_args","useStyles","#rawValue","#resolvedLocale","#parsedNumber","raw","numericValue","#formatOptions","options","prop","key","value","#formattedNumber","#onSlotChange","property","typeSSR"],"sources":["../../src/format-number/format-number.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { useStyles, typeSSR } from '@nvidia-elements/core/internal';\nimport styles from './format-number.css?inline';\n\nexport type FormatNumberStyle = 'decimal' | 'currency' | 'percent' | 'unit';\nexport type CurrencyDisplayOption = 'symbol' | 'code' | 'name' | 'narrowSymbol';\nexport type CurrencySignOption = 'standard' | 'accounting';\nexport type NotationOption = 'standard' | 'scientific' | 'engineering' | 'compact';\nexport type CompactDisplayOption = 'short' | 'long';\nexport type UnitDisplayOption = 'short' | 'long' | 'narrow';\nexport type SignDisplayOption = 'auto' | 'never' | 'always' | 'exceptZero';\n\nconst STRING_KEYS: [keyof FormatNumber, string][] = [\n ['currency', 'currency'],\n ['currencyDisplay', 'currencyDisplay'],\n ['currencySign', 'currencySign'],\n ['notation', 'notation'],\n ['compactDisplay', 'compactDisplay'],\n ['unit', 'unit'],\n ['unitDisplay', 'unitDisplay'],\n ['signDisplay', 'signDisplay']\n];\n\nconst NUMBER_KEYS: [keyof FormatNumber, string][] = [\n ['minimumFractionDigits', 'minimumFractionDigits'],\n ['maximumFractionDigits', 'maximumFractionDigits'],\n ['minimumIntegerDigits', 'minimumIntegerDigits']\n];\n\n/**\n * @element nve-format-number\n * @description A localized number formatter for currencies, percentages, units, and compact notation, backed by Intl.NumberFormat.\n * Provide a `currency` attribute when `formatStyle` is `currency`, and a `unit` attribute when `formatStyle` is `unit`.\n * @documentation https://nvidia.github.io/elements/docs/elements/format-number/\n * @since 0.0.0\n * @entrypoint \\@nvidia-elements/core/format-number\n * @slot - Numeric string to format (such as 1234567 or 1234.56). Serves as fallback before hydration.\n * @aria https://developer.mozilla.org/en-US/docs/Web/HTML/Element/data\n */\n@typeSSR()\nexport class FormatNumber extends LitElement {\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-format-number',\n version: '0.0.0'\n };\n\n /**\n * Optional numeric string for values supplied by JavaScript or bound data.\n * By default, the component formats the element's text content, which also serves as the SSR fallback.\n * When both are present, this property takes precedence.\n */\n @property({ type: String }) number?: string;\n\n /**\n * Language tag (such as en-US, de-DE). Defaults to document.documentElement.lang or browser default.\n */\n @property({ type: String }) locale?: string;\n\n /**\n * Formatting style: 'decimal' | 'currency' | 'percent' | 'unit'.\n */\n @property({ type: String, attribute: 'format-style' }) formatStyle: FormatNumberStyle = 'decimal';\n\n /**\n * ISO 4217 currency code (such as USD or EUR). Required when formatStyle is currency.\n */\n @property({ type: String }) currency?: string;\n\n /**\n * Currency sign style: 'standard' | 'accounting'.\n */\n @property({ type: String, attribute: 'currency-sign' }) currencySign?: CurrencySignOption;\n\n /**\n * Currency display style: 'symbol' | 'code' | 'name' | 'narrowSymbol'.\n */\n @property({ type: String, attribute: 'currency-display' }) currencyDisplay?: CurrencyDisplayOption;\n\n /**\n * Unit identifier (such as kilometer or byte). Required when formatStyle is unit.\n */\n @property({ type: String }) unit?: string;\n\n /**\n * Unit display style: 'short' | 'long' | 'narrow'.\n */\n @property({ type: String, attribute: 'unit-display' }) unitDisplay?: UnitDisplayOption;\n\n /**\n * Number notation: 'standard' | 'scientific' | 'engineering' | 'compact'.\n */\n @property({ type: String }) notation?: NotationOption;\n\n /**\n * Compact notation display: 'short' | 'long'. Only applies when notation is compact.\n */\n @property({ type: String, attribute: 'compact-display' }) compactDisplay?: CompactDisplayOption;\n\n /**\n * Sign display: 'auto' | 'never' | 'always' | 'exceptZero'.\n */\n @property({ type: String, attribute: 'sign-display' }) signDisplay?: SignDisplayOption;\n\n /**\n * Grouping separators: 'auto' | 'always' | 'min2' | 'true' | 'false'.\n */\n @property({ type: String, attribute: 'use-grouping' })\n useGrouping?: 'auto' | 'always' | 'min2' | 'true' | 'false' | boolean;\n\n /**\n * Pad fraction output to at least this many digits (0-100).\n */\n @property({ type: Number, attribute: 'minimum-fraction-digits' }) minimumFractionDigits?: number;\n\n /**\n * Round fraction output to at most this many digits (0-100).\n */\n @property({ type: Number, attribute: 'maximum-fraction-digits' }) maximumFractionDigits?: number;\n\n /**\n * Pad integer output to at least this many digits (1-21).\n */\n @property({ type: Number, attribute: 'minimum-integer-digits' }) minimumIntegerDigits?: number;\n\n get #rawValue(): string {\n return this.number ?? this.textContent?.trim() ?? '';\n }\n\n get #resolvedLocale(): string | undefined {\n return this.locale ?? (globalThis.document?.documentElement?.lang || undefined);\n }\n\n get #parsedNumber(): number | null {\n const raw = this.#rawValue;\n if (!raw) return null;\n\n const numericValue = Number(raw);\n if (Number.isFinite(numericValue)) return numericValue;\n\n return null;\n }\n\n get #formatOptions(): Intl.NumberFormatOptions {\n const options: Intl.NumberFormatOptions = { style: this.formatStyle };\n\n for (const [prop, key] of STRING_KEYS) {\n const value = this[prop] as string | undefined;\n if (value !== undefined) (options as Record<string, unknown>)[key] = value;\n }\n\n for (const [prop, key] of NUMBER_KEYS) {\n const value = this[prop] as number | undefined;\n if (value !== undefined) (options as Record<string, unknown>)[key] = value;\n }\n\n if (this.useGrouping !== undefined) {\n const grouping = this.useGrouping === 'false' ? false : this.useGrouping === 'true' ? true : this.useGrouping;\n (options as Record<string, unknown>).useGrouping = grouping;\n }\n\n return options;\n }\n\n get #formattedNumber(): string {\n const raw = this.#rawValue;\n if (!raw) return '';\n\n const numericValue = this.#parsedNumber;\n if (numericValue === null) return raw;\n\n try {\n return new Intl.NumberFormat(this.#resolvedLocale, this.#formatOptions).format(numericValue);\n } catch {\n return raw;\n }\n }\n\n render() {\n return html`<data internal-host value=${this.#rawValue}>${this.#formattedNumber}<slot @slotchange=${this.#onSlotChange} hidden></slot></data>`;\n }\n\n #onSlotChange() {\n this.requestUpdate();\n }\n}\n"],"mappings":";;;;;;;AAgBA,IAAMI,IAA8C;CAClD,CAAC,YAAY,UAAU;CACvB,CAAC,mBAAmB,iBAAiB;CACrC,CAAC,gBAAgB,cAAc;CAC/B,CAAC,YAAY,UAAU;CACvB,CAAC,kBAAkB,gBAAgB;CACnC,CAAC,QAAQ,MAAM;CACf,CAAC,eAAe,aAAa;CAC7B,CAAC,eAAe,aAAa;AAC/B,GAEMC,IAA8C;CAClD,CAAC,yBAAyB,uBAAuB;CACjD,CAAC,yBAAyB,uBAAuB;CACjD,CAAC,wBAAwB,sBAAsB;AACjD,GAaaC,IAAN,cAA2BC,EAAW;;EAuB6C,A,aAAA,KAAA,cAAA;;;EAtBxE,KAAA,SAAAE,EAAU,CAACT,CAAM,CAAC;;;EAEP,KAAA,WAAA;GACzB,KAAK;GACL,SAAS;EACX;;CAgFA,IAAIU,KAAoB;EACtB,OAAO,KAAK,UAAU,KAAK,aAAa,KAAK,KAAK;CACpD;CAEA,IAAIC,KAAsC;EACxC,OAAO,KAAK,WAAW,WAAW,UAAU,iBAAiB,QAAQ,KAAA;CACvE;CAEA,IAAIC,KAA+B;EACjC,IAAMC,IAAM,KAAKH;EACjB,IAAI,CAACG,GAAK,OAAO;EAEjB,IAAMC,IAAe,OAAOD,CAAG;EAG/B,OAFI,OAAO,SAASC,CAAY,IAAUA,IAEnC;CACT;CAEA,IAAIC,KAA2C;EAC7C,IAAMC,IAAoC,EAAE,OAAO,KAAK,YAAY;EAEpE,KAAK,IAAM,CAACC,GAAMC,MAAQd,GAAa;GACrC,IAAMe,IAAQ,KAAKF;GACnB,AAAIE,MAA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","#resolvedLocale","#parsedNumber","raw","numericValue","#formatOptions","options","prop","key","value","#formattedNumber","#onSlotChange","property","typeSSR"],"sources":["../../src/format-number/format-number.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { typeSSR } from '@nvidia-elements/core/internal';\nimport { useStyles } from '@nvidia-elements/foundations/internal/styles';\nimport styles from './format-number.css?inline';\n\nexport type FormatNumberStyle = 'decimal' | 'currency' | 'percent' | 'unit';\nexport type CurrencyDisplayOption = 'symbol' | 'code' | 'name' | 'narrowSymbol';\nexport type CurrencySignOption = 'standard' | 'accounting';\nexport type NotationOption = 'standard' | 'scientific' | 'engineering' | 'compact';\nexport type CompactDisplayOption = 'short' | 'long';\nexport type UnitDisplayOption = 'short' | 'long' | 'narrow';\nexport type SignDisplayOption = 'auto' | 'never' | 'always' | 'exceptZero';\n\nconst STRING_KEYS: [keyof FormatNumber, string][] = [\n ['currency', 'currency'],\n ['currencyDisplay', 'currencyDisplay'],\n ['currencySign', 'currencySign'],\n ['notation', 'notation'],\n ['compactDisplay', 'compactDisplay'],\n ['unit', 'unit'],\n ['unitDisplay', 'unitDisplay'],\n ['signDisplay', 'signDisplay']\n];\n\nconst NUMBER_KEYS: [keyof FormatNumber, string][] = [\n ['minimumFractionDigits', 'minimumFractionDigits'],\n ['maximumFractionDigits', 'maximumFractionDigits'],\n ['minimumIntegerDigits', 'minimumIntegerDigits']\n];\n\n/**\n * @element nve-format-number\n * @description A localized number formatter for currencies, percentages, units, and compact notation, backed by Intl.NumberFormat.\n * Provide a `currency` attribute when `formatStyle` is `currency`, and a `unit` attribute when `formatStyle` is `unit`.\n * @documentation https://nvidia.github.io/elements/docs/elements/format-number/\n * @since 0.0.0\n * @entrypoint \\@nvidia-elements/core/format-number\n * @slot - Numeric string to format (such as 1234567 or 1234.56). Serves as fallback before hydration.\n * @aria https://developer.mozilla.org/en-US/docs/Web/HTML/Element/data\n */\n@typeSSR()\nexport class FormatNumber extends LitElement {\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-format-number',\n version: '0.0.0'\n };\n\n /**\n * Optional numeric string for values supplied by JavaScript or bound data.\n * By default, the component formats the element's text content, which also serves as the SSR fallback.\n * When both are present, this property takes precedence.\n */\n @property({ type: String }) number?: string;\n\n /**\n * Language tag (such as en-US, de-DE). Defaults to document.documentElement.lang or browser default.\n */\n @property({ type: String }) locale?: string;\n\n /**\n * Formatting style: 'decimal' | 'currency' | 'percent' | 'unit'.\n */\n @property({ type: String, attribute: 'format-style' }) formatStyle: FormatNumberStyle = 'decimal';\n\n /**\n * ISO 4217 currency code (such as USD or EUR). Required when formatStyle is currency.\n */\n @property({ type: String }) currency?: string;\n\n /**\n * Currency sign style: 'standard' | 'accounting'.\n */\n @property({ type: String, attribute: 'currency-sign' }) currencySign?: CurrencySignOption;\n\n /**\n * Currency display style: 'symbol' | 'code' | 'name' | 'narrowSymbol'.\n */\n @property({ type: String, attribute: 'currency-display' }) currencyDisplay?: CurrencyDisplayOption;\n\n /**\n * Unit identifier (such as kilometer or byte). Required when formatStyle is unit.\n */\n @property({ type: String }) unit?: string;\n\n /**\n * Unit display style: 'short' | 'long' | 'narrow'.\n */\n @property({ type: String, attribute: 'unit-display' }) unitDisplay?: UnitDisplayOption;\n\n /**\n * Number notation: 'standard' | 'scientific' | 'engineering' | 'compact'.\n */\n @property({ type: String }) notation?: NotationOption;\n\n /**\n * Compact notation display: 'short' | 'long'. Only applies when notation is compact.\n */\n @property({ type: String, attribute: 'compact-display' }) compactDisplay?: CompactDisplayOption;\n\n /**\n * Sign display: 'auto' | 'never' | 'always' | 'exceptZero'.\n */\n @property({ type: String, attribute: 'sign-display' }) signDisplay?: SignDisplayOption;\n\n /**\n * Grouping separators: 'auto' | 'always' | 'min2' | 'true' | 'false'.\n */\n @property({ type: String, attribute: 'use-grouping' })\n useGrouping?: 'auto' | 'always' | 'min2' | 'true' | 'false' | boolean;\n\n /**\n * Pad fraction output to at least this many digits (0-100).\n */\n @property({ type: Number, attribute: 'minimum-fraction-digits' }) minimumFractionDigits?: number;\n\n /**\n * Round fraction output to at most this many digits (0-100).\n */\n @property({ type: Number, attribute: 'maximum-fraction-digits' }) maximumFractionDigits?: number;\n\n /**\n * Pad integer output to at least this many digits (1-21).\n */\n @property({ type: Number, attribute: 'minimum-integer-digits' }) minimumIntegerDigits?: number;\n\n get #rawValue(): string {\n return this.number ?? this.textContent?.trim() ?? '';\n }\n\n get #resolvedLocale(): string | undefined {\n return this.locale ?? (globalThis.document?.documentElement?.lang || undefined);\n }\n\n get #parsedNumber(): number | null {\n const raw = this.#rawValue;\n if (!raw) return null;\n\n const numericValue = Number(raw);\n if (Number.isFinite(numericValue)) return numericValue;\n\n return null;\n }\n\n get #formatOptions(): Intl.NumberFormatOptions {\n const options: Intl.NumberFormatOptions = { style: this.formatStyle };\n\n for (const [prop, key] of STRING_KEYS) {\n const value = this[prop] as string | undefined;\n if (value !== undefined) (options as Record<string, unknown>)[key] = value;\n }\n\n for (const [prop, key] of NUMBER_KEYS) {\n const value = this[prop] as number | undefined;\n if (value !== undefined) (options as Record<string, unknown>)[key] = value;\n }\n\n if (this.useGrouping !== undefined) {\n const grouping = this.useGrouping === 'false' ? false : this.useGrouping === 'true' ? true : this.useGrouping;\n (options as Record<string, unknown>).useGrouping = grouping;\n }\n\n return options;\n }\n\n get #formattedNumber(): string {\n const raw = this.#rawValue;\n if (!raw) return '';\n\n const numericValue = this.#parsedNumber;\n if (numericValue === null) return raw;\n\n try {\n return new Intl.NumberFormat(this.#resolvedLocale, this.#formatOptions).format(numericValue);\n } catch {\n return raw;\n }\n }\n\n render() {\n return html`<data internal-host value=${this.#rawValue}>${this.#formattedNumber}<slot @slotchange=${this.#onSlotChange} hidden></slot></data>`;\n }\n\n #onSlotChange() {\n this.requestUpdate();\n }\n}\n"],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Ae,CAAC,CAAA,GAAAhB,EAAA,WAAA,eAAA,KAAA,CAAA,GAKpDL,EAAA,CAAAqB,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAAhB,EAAA,WAAA,YAAA,KAAA,CAAA,GAKzBL,EAAA,CAAAqB,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAkB,CAAC,CAAA,GAAAhB,EAAA,WAAA,kBAAA,KAAA,CAAA,GAKvDL,EAAA,CAAAqB,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAe,CAAC,CAAA,GAAAhB,EAAA,WAAA,eAAA,KAAA,CAAA,GAKpDL,EAAA,CAAAqB,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAe,CAAC,CAAA,GAAAhB,EAAA,WAAA,eAAA,KAAA,CAAA,GAMpDL,EAAA,CAAAqB,EAAS;CAAE,MAAM;CAAQ,WAAW;AAA0B,CAAC,CAAA,GAAAhB,EAAA,WAAA,yBAAA,KAAA,CAAA,GAK/DL,EAAA,CAAAqB,EAAS;CAAE,MAAM;CAAQ,WAAW;AAA0B,CAAC,CAAA,GAAAhB,EAAA,WAAA,yBAAA,KAAA,CAAA,GAK/DL,EAAA,CAAAqB,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAyB,CAAC,CAAA,GAAAhB,EAAA,WAAA,wBAAA,KAAA,CAAA,GArFhE,IAAAL,EAAA,CAAAsB,EAAQ,CAAA,GAAAjB,CAAA"}
@@ -1,9 +1,9 @@
1
1
  import { typeSSR as e } from "../internal/controllers/type-ssr.controller.js";
2
- import { useStyles as t } from "../internal/styles/index.js";
3
- import n from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorate.js";
4
- import r from "./format-relative-time.js";
5
- import { LitElement as i, html as a } from "lit";
6
- import { property as o } from "lit/decorators/property.js";
2
+ import t from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorate.js";
3
+ import n from "./format-relative-time.js";
4
+ import { LitElement as r, html as i } from "lit";
5
+ import { property as a } from "lit/decorators/property.js";
6
+ import { useStyles as o } from "@nvidia-elements/foundations/internal/styles";
7
7
  // src/format-relative-time/format-relative-time.ts
8
8
  var s = {
9
9
  second: 1e3,
@@ -42,17 +42,17 @@ var s = {
42
42
  unit: "year",
43
43
  max: Infinity
44
44
  }
45
- ], l = class extends i {
45
+ ], l = class extends r {
46
46
  constructor(...e) {
47
47
  super(...e), this.numeric = "always", this.formatStyle = "long", this.unit = "auto", this.sync = !1;
48
48
  }
49
49
  static {
50
- this.styles = t([r]);
50
+ this.styles = o([n]);
51
51
  }
52
52
  static {
53
53
  this.metadata = {
54
54
  tag: "nve-format-relative-time",
55
- version: "2.23.3"
55
+ version: "2.23.5"
56
56
  };
57
57
  }
58
58
  #e;
@@ -124,16 +124,16 @@ var s = {
124
124
  e.has("sync") && (this.sync ? this.#c() : this.#l());
125
125
  }
126
126
  render() {
127
- return a`<time internal-host datetime="${this.#t}">${this.#o}<slot @slotchange="${this.#u}" hidden></slot></time>`;
127
+ return i`<time internal-host datetime="${this.#t}">${this.#o}<slot @slotchange="${this.#u}" hidden></slot></time>`;
128
128
  }
129
129
  #u() {
130
130
  this.requestUpdate();
131
131
  }
132
132
  };
133
- n([o({ type: String })], l.prototype, "date", void 0), n([o({ type: String })], l.prototype, "locale", void 0), n([o({ type: String })], l.prototype, "numeric", void 0), n([o({
133
+ t([a({ type: String })], l.prototype, "date", void 0), t([a({ type: String })], l.prototype, "locale", void 0), t([a({ type: String })], l.prototype, "numeric", void 0), t([a({
134
134
  type: String,
135
135
  attribute: "format-style"
136
- })], l.prototype, "formatStyle", void 0), n([o({ type: String })], l.prototype, "unit", void 0), n([o({ type: Boolean })], l.prototype, "sync", void 0), l = n([e()], l);
136
+ })], l.prototype, "formatStyle", void 0), t([a({ type: String })], l.prototype, "unit", void 0), t([a({ type: Boolean })], l.prototype, "sync", void 0), l = t([e()], l);
137
137
  export { l as FormatRelativeTime };
138
138
 
139
139
  //# sourceMappingURL=format-relative-time2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-relative-time2.js","names":["styles","_decorate","__decorate","format_relative_time_default","UNIT_DIVISORS","THRESHOLDS","FormatRelativeTime","LitElement","_args","useStyles","#dateValue","#resolvedLocale","absDiff","diffMs","sign","value","unit","max","#computeUnit","#computeExplicitUnit","#formattedRelativeTime","iso","target","resolvedUnit","#resolveValueAndUnit","#stopSync","#timer","#startSync","#getSyncInterval","changed","#onSlotChange","property","typeSSR"],"sources":["../../src/format-relative-time/format-relative-time.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { useStyles, typeSSR } from '@nvidia-elements/core/internal';\nimport styles from './format-relative-time.css?inline';\n\ntype TimeUnitOption = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\n\nconst UNIT_DIVISORS: Record<TimeUnitOption, number> = {\n second: 1000,\n minute: 60000,\n hour: 3600000,\n day: 86400000,\n week: 604800000,\n month: 2592000000,\n year: 31536000000\n};\n\nconst THRESHOLDS: { unit: TimeUnitOption; max: number }[] = [\n { unit: 'second', max: 60 },\n { unit: 'minute', max: 60 },\n { unit: 'hour', max: 24 },\n { unit: 'day', max: 7 },\n { unit: 'week', max: 4 },\n { unit: 'month', max: 12 },\n { unit: 'year', max: Number.POSITIVE_INFINITY }\n];\n\n/**\n * @element nve-format-relative-time\n * @description Formats a date/time value as localized relative text using the Intl.RelativeTimeFormat API. Renders inside a semantic time element.\n * Options mirror the Intl.RelativeTimeFormat API. When unit is 'auto', the component selects the best unit based on the time difference.\n * @documentation https://nvidia.github.io/elements/docs/elements/format-relative-time/\n * @since 0.0.0\n * @entrypoint \\@nvidia-elements/core/format-relative-time\n * @slot - Date string to format (such as 2023-07-28T04:20:17.434Z). Serves as fallback before hydration.\n * @aria https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time\n */\n@typeSSR()\nexport class FormatRelativeTime extends LitElement {\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-format-relative-time',\n version: '0.0.0'\n };\n\n /**\n * Optional date string for values supplied by JavaScript or bound data.\n * By default, the component formats the element's text content, which also serves as the SSR fallback.\n * When both are present, this property takes precedence.\n */\n @property({ type: String }) date?: string;\n\n /**\n * Language tag (such as en-US, de-DE). Defaults to document.documentElement.lang or browser default.\n */\n @property({ type: String }) locale?: string;\n\n /**\n * Numeric formatting: 'always' | 'auto'. When 'auto', enables natural language forms such as 'yesterday' instead of '1 day ago'.\n */\n @property({ type: String }) numeric: 'always' | 'auto' = 'always';\n\n /**\n * Formatting length: 'long' | 'short' | 'narrow'. Controls verbosity (such as '3 days ago' vs '3d ago'). Maps to Intl.RelativeTimeFormat style option.\n */\n @property({ type: String, attribute: 'format-style' }) formatStyle: 'long' | 'short' | 'narrow' = 'long';\n\n /**\n * Time unit: 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year' | 'auto'. Use 'auto' to let the component select the most appropriate unit based on the time difference.\n */\n @property({ type: String }) unit: 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year' | 'auto' = 'auto';\n\n /**\n * When present, auto-updates the displayed relative time at appropriate intervals.\n */\n @property({ type: Boolean }) sync = false;\n\n #timer?: ReturnType<typeof setTimeout>;\n\n get #dateValue(): string {\n return this.date ?? this.textContent?.trim() ?? '';\n }\n\n get #resolvedLocale(): string | undefined {\n return this.locale ?? (globalThis.document?.documentElement?.lang || undefined);\n }\n\n #computeUnit(diffMs: number): { value: number; unit: Intl.RelativeTimeFormatUnit } {\n const absDiff = Math.abs(diffMs);\n const sign = diffMs < 0 ? -1 : 1;\n\n for (const { unit, max } of THRESHOLDS) {\n const value = Math.round(absDiff / UNIT_DIVISORS[unit]);\n if (value < max) return { value: sign * value, unit };\n }\n return { value: sign * Math.round(absDiff / UNIT_DIVISORS.year), unit: 'year' };\n }\n\n #computeExplicitUnit(diffMs: number, unit: TimeUnitOption): number {\n return Math.round(diffMs / UNIT_DIVISORS[unit]);\n }\n\n #resolveValueAndUnit(diffMs: number): { value: number; unit: Intl.RelativeTimeFormatUnit } {\n if (this.unit === 'auto') {\n return this.#computeUnit(diffMs);\n }\n return { unit: this.unit, value: this.#computeExplicitUnit(diffMs, this.unit) };\n }\n\n get #formattedRelativeTime(): string {\n const iso = this.#dateValue;\n if (!iso) return '';\n\n const target = new Date(iso);\n if (isNaN(target.getTime())) {\n return iso;\n }\n\n const { value, unit: resolvedUnit } = this.#resolveValueAndUnit(target.getTime() - Date.now());\n\n try {\n return new Intl.RelativeTimeFormat(this.#resolvedLocale, {\n numeric: this.numeric,\n style: this.formatStyle\n }).format(value, resolvedUnit);\n } catch {\n return iso;\n }\n }\n\n #getSyncInterval(): number {\n const iso = this.#dateValue;\n if (!iso) return 60000;\n\n const absDiff = Math.abs(new Date(iso).getTime() - Date.now());\n if (absDiff < 60000) return 10000;\n if (absDiff < 3600000) return 30000;\n if (absDiff < 86400000) return 300000;\n return 3600000;\n }\n\n #startSync() {\n this.#stopSync();\n if (!this.sync) return;\n\n this.#timer = setTimeout(() => {\n this.requestUpdate();\n this.#startSync();\n }, this.#getSyncInterval());\n }\n\n #stopSync() {\n if (this.#timer !== undefined) {\n clearTimeout(this.#timer);\n this.#timer = undefined;\n }\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (this.sync) this.#startSync();\n }\n\n disconnectedCallback() {\n this.#stopSync();\n super.disconnectedCallback();\n }\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('sync')) {\n if (this.sync) {\n this.#startSync();\n } else {\n this.#stopSync();\n }\n }\n }\n\n render() {\n return html`<time internal-host datetime=${this.#dateValue}>${this.#formattedRelativeTime}<slot @slotchange=${this.#onSlotChange} hidden></slot></time>`;\n }\n\n #onSlotChange() {\n this.requestUpdate();\n }\n}\n"],"mappings":";;;;;;;AAUA,IAAMI,IAAgD;CACpD,QAAQ;CACR,QAAQ;CACR,MAAM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;CAGrB;CAEA,SAAS;EACP,OAAO,CAAI,iCAAgC,KAAKf,GAAW,IAAG,KAAKU,GAAuB,qBAAoB,KAAKU,GAAc;CACnI;CAEA,KAAgB;EACd,KAAK,cAAc;CACrB;AACF;AAvIG7B,EAAA,CAAA8B,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAAzB,EAAA,WAAA,QAAA,KAAA,CAAA,GAKzBL,EAAA,CAAA8B,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAAzB,EAAA,WAAA,UAAA,KAAA,CAAA,GAKzBL,EAAA,CAAA8B,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAAzB,EAAA,WAAA,WAAA,KAAA,CAAA,GAKzBL,EAAA,CAAA8B,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAe,CAAC,CAAA,GAAAzB,EAAA,WAAA,eAAA,KAAA,CAAA,GAKpDL,EAAA,CAAA8B,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAAzB,EAAA,WAAA,QAAA,KAAA,CAAA,GAKzBL,EAAA,CAAA8B,EAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,GAAAzB,EAAA,WAAA,QAAA,KAAA,CAAA,GAvC5B,IAAAL,EAAA,CAAA+B,EAAQ,CAAA,GAAA1B,CAAA"}
1
+ {"version":3,"file":"format-relative-time2.js","names":["styles","_decorate","__decorate","format_relative_time_default","UNIT_DIVISORS","THRESHOLDS","FormatRelativeTime","LitElement","_args","useStyles","#dateValue","#resolvedLocale","absDiff","diffMs","sign","value","unit","max","#computeUnit","#computeExplicitUnit","#formattedRelativeTime","iso","target","resolvedUnit","#resolveValueAndUnit","#stopSync","#timer","#startSync","#getSyncInterval","changed","#onSlotChange","property","typeSSR"],"sources":["../../src/format-relative-time/format-relative-time.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { typeSSR } from '@nvidia-elements/core/internal';\nimport { useStyles } from '@nvidia-elements/foundations/internal/styles';\nimport styles from './format-relative-time.css?inline';\n\ntype TimeUnitOption = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\n\nconst UNIT_DIVISORS: Record<TimeUnitOption, number> = {\n second: 1000,\n minute: 60000,\n hour: 3600000,\n day: 86400000,\n week: 604800000,\n month: 2592000000,\n year: 31536000000\n};\n\nconst THRESHOLDS: { unit: TimeUnitOption; max: number }[] = [\n { unit: 'second', max: 60 },\n { unit: 'minute', max: 60 },\n { unit: 'hour', max: 24 },\n { unit: 'day', max: 7 },\n { unit: 'week', max: 4 },\n { unit: 'month', max: 12 },\n { unit: 'year', max: Number.POSITIVE_INFINITY }\n];\n\n/**\n * @element nve-format-relative-time\n * @description Formats a date/time value as localized relative text using the Intl.RelativeTimeFormat API. Renders inside a semantic time element.\n * Options mirror the Intl.RelativeTimeFormat API. When unit is 'auto', the component selects the best unit based on the time difference.\n * @documentation https://nvidia.github.io/elements/docs/elements/format-relative-time/\n * @since 0.0.0\n * @entrypoint \\@nvidia-elements/core/format-relative-time\n * @slot - Date string to format (such as 2023-07-28T04:20:17.434Z). Serves as fallback before hydration.\n * @aria https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time\n */\n@typeSSR()\nexport class FormatRelativeTime extends LitElement {\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-format-relative-time',\n version: '0.0.0'\n };\n\n /**\n * Optional date string for values supplied by JavaScript or bound data.\n * By default, the component formats the element's text content, which also serves as the SSR fallback.\n * When both are present, this property takes precedence.\n */\n @property({ type: String }) date?: string;\n\n /**\n * Language tag (such as en-US, de-DE). Defaults to document.documentElement.lang or browser default.\n */\n @property({ type: String }) locale?: string;\n\n /**\n * Numeric formatting: 'always' | 'auto'. When 'auto', enables natural language forms such as 'yesterday' instead of '1 day ago'.\n */\n @property({ type: String }) numeric: 'always' | 'auto' = 'always';\n\n /**\n * Formatting length: 'long' | 'short' | 'narrow'. Controls verbosity (such as '3 days ago' vs '3d ago'). Maps to Intl.RelativeTimeFormat style option.\n */\n @property({ type: String, attribute: 'format-style' }) formatStyle: 'long' | 'short' | 'narrow' = 'long';\n\n /**\n * Time unit: 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year' | 'auto'. Use 'auto' to let the component select the most appropriate unit based on the time difference.\n */\n @property({ type: String }) unit: 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year' | 'auto' = 'auto';\n\n /**\n * When present, auto-updates the displayed relative time at appropriate intervals.\n */\n @property({ type: Boolean }) sync = false;\n\n #timer?: ReturnType<typeof setTimeout>;\n\n get #dateValue(): string {\n return this.date ?? this.textContent?.trim() ?? '';\n }\n\n get #resolvedLocale(): string | undefined {\n return this.locale ?? (globalThis.document?.documentElement?.lang || undefined);\n }\n\n #computeUnit(diffMs: number): { value: number; unit: Intl.RelativeTimeFormatUnit } {\n const absDiff = Math.abs(diffMs);\n const sign = diffMs < 0 ? -1 : 1;\n\n for (const { unit, max } of THRESHOLDS) {\n const value = Math.round(absDiff / UNIT_DIVISORS[unit]);\n if (value < max) return { value: sign * value, unit };\n }\n return { value: sign * Math.round(absDiff / UNIT_DIVISORS.year), unit: 'year' };\n }\n\n #computeExplicitUnit(diffMs: number, unit: TimeUnitOption): number {\n return Math.round(diffMs / UNIT_DIVISORS[unit]);\n }\n\n #resolveValueAndUnit(diffMs: number): { value: number; unit: Intl.RelativeTimeFormatUnit } {\n if (this.unit === 'auto') {\n return this.#computeUnit(diffMs);\n }\n return { unit: this.unit, value: this.#computeExplicitUnit(diffMs, this.unit) };\n }\n\n get #formattedRelativeTime(): string {\n const iso = this.#dateValue;\n if (!iso) return '';\n\n const target = new Date(iso);\n if (isNaN(target.getTime())) {\n return iso;\n }\n\n const { value, unit: resolvedUnit } = this.#resolveValueAndUnit(target.getTime() - Date.now());\n\n try {\n return new Intl.RelativeTimeFormat(this.#resolvedLocale, {\n numeric: this.numeric,\n style: this.formatStyle\n }).format(value, resolvedUnit);\n } catch {\n return iso;\n }\n }\n\n #getSyncInterval(): number {\n const iso = this.#dateValue;\n if (!iso) return 60000;\n\n const absDiff = Math.abs(new Date(iso).getTime() - Date.now());\n if (absDiff < 60000) return 10000;\n if (absDiff < 3600000) return 30000;\n if (absDiff < 86400000) return 300000;\n return 3600000;\n }\n\n #startSync() {\n this.#stopSync();\n if (!this.sync) return;\n\n this.#timer = setTimeout(() => {\n this.requestUpdate();\n this.#startSync();\n }, this.#getSyncInterval());\n }\n\n #stopSync() {\n if (this.#timer !== undefined) {\n clearTimeout(this.#timer);\n this.#timer = undefined;\n }\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (this.sync) this.#startSync();\n }\n\n disconnectedCallback() {\n this.#stopSync();\n super.disconnectedCallback();\n }\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('sync')) {\n if (this.sync) {\n this.#startSync();\n } else {\n this.#stopSync();\n }\n }\n }\n\n render() {\n return html`<time internal-host datetime=${this.#dateValue}>${this.#formattedRelativeTime}<slot @slotchange=${this.#onSlotChange} hidden></slot></time>`;\n }\n\n #onSlotChange() {\n this.requestUpdate();\n }\n}\n"],"mappings":";;;;;;;AAWA,IAAMI,IAAgD;CACpD,QAAQ;CACR,QAAQ;CACR,MAAM;CACN,KAAK;CACL,MAAM;CACN,OAAO;CACP,MAAM;AACR,GAEMC,IAAsD;CAC1D;EAAE,MAAM;EAAU,KAAK;CAAG;CAC1B;EAAE,MAAM;EAAU,KAAK;CAAG;CAC1B;EAAE,MAAM;EAAQ,KAAK;CAAG;CACxB;EAAE,MAAM;EAAO,KAAK;CAAE;CACtB;EAAE,MAAM;EAAQ,KAAK;CAAE;CACvB;EAAE,MAAM;EAAS,KAAK;CAAG;CACzB;EAAE,MAAM;EAAQ,KAAK;CAAyB;AAChD,GAaaC,IAAN,cAAiCC,EAAW;;EAsCb,A,aAfqB,KAAA,UAAA,UAK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AAC,CAAA,GAAAzB,EAAA,WAAA,WAAA,KAAA,CAAA,GAKzBL,EAAA,CAAA8B,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAe,CAAC,CAAA,GAAAzB,EAAA,WAAA,eAAA,KAAA,CAAA,GAKpDL,EAAA,CAAA8B,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAAzB,EAAA,WAAA,QAAA,KAAA,CAAA,GAKzBL,EAAA,CAAA8B,EAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,GAAAzB,EAAA,WAAA,QAAA,KAAA,CAAA,GAvC5B,IAAAL,EAAA,CAAA+B,EAAQ,CAAA,GAAA1B,CAAA"}
@@ -1,25 +1,25 @@
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.155.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";
1
+ import { typeSSR as e } from "../internal/controllers/type-ssr.controller.js";
2
+ import t from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorate.js";
3
+ import { normalizeTruncateString as n, normalizeTruncateText as r, truncateText as i } from "./utils.js";
4
+ import a from "./format-truncate.js";
5
+ import { attachInternals as o } from "@nvidia-elements/foundations/internal/a11y";
6
+ import { LitElement as s, html as c } from "lit";
7
+ import { property as l } from "lit/decorators/property.js";
8
+ import { useStyles as u } from "@nvidia-elements/foundations/internal/styles";
9
9
  // src/format-truncate/format-truncate.ts
10
- var d = class extends c {
10
+ var d = class extends s {
11
11
  constructor(...e) {
12
12
  super(...e), this.position = "start", this.strategy = "character", this.bias = "end", this.preserve = 6, this.#r = Infinity, this.#u = () => {
13
13
  this.requestUpdate();
14
14
  };
15
15
  }
16
16
  static {
17
- this.styles = n([s]);
17
+ this.styles = u([a]);
18
18
  }
19
19
  static {
20
20
  this.metadata = {
21
21
  tag: "nve-format-truncate",
22
- version: "2.23.3"
22
+ version: "2.23.5"
23
23
  };
24
24
  }
25
25
  #e;
@@ -27,7 +27,7 @@ var d = class extends c {
27
27
  #n;
28
28
  #r;
29
29
  connectedCallback() {
30
- super.connectedCallback(), e(this), this.#r = Infinity, this.#l(), this.requestUpdate();
30
+ super.connectedCallback(), o(this), this.#r = Infinity, this.#l(), this.requestUpdate();
31
31
  }
32
32
  disconnectedCallback() {
33
33
  super.disconnectedCallback(), this.#t?.disconnect(), this.#n !== void 0 && this.ownerDocument.defaultView?.cancelAnimationFrame(this.#n), this.#n = void 0;
@@ -37,17 +37,17 @@ var d = class extends c {
37
37
  }
38
38
  render() {
39
39
  let e = this.#i, t = this.#a(e);
40
- return t === e ? this.removeAttribute("title") : this.title !== e && (this.title = e), l`<span internal-host aria-hidden="true">${t}</span><span sizing-host aria-hidden="true">${e}</span><slot @slotchange="${this.#u}"></slot>`;
40
+ return t === e ? this.removeAttribute("title") : this.title !== e && (this.title = e), c`<span internal-host aria-hidden="true">${t}</span><span sizing-host aria-hidden="true">${e}</span><slot @slotchange="${this.#u}"></slot>`;
41
41
  }
42
42
  get #i() {
43
43
  let e = this.shadowRoot?.querySelector("slot:not([name])");
44
- if (e) return a(e.assignedNodes({ flatten: !0 }));
44
+ if (e) return r(e.assignedNodes({ flatten: !0 }));
45
45
  let t = Array.from(this.childNodes ?? []).filter(p);
46
- return t.length ? a(t) : i(this.textContent ?? "");
46
+ return t.length ? r(t) : n(this.textContent ?? "");
47
47
  }
48
48
  #a(e) {
49
49
  let t = this.#o();
50
- return o(e, {
50
+ return i(e, {
51
51
  position: this.position,
52
52
  strategy: this.strategy,
53
53
  bias: this.bias,
@@ -90,19 +90,19 @@ var d = class extends c {
90
90
  }
91
91
  #u;
92
92
  };
93
- r([u({
93
+ t([l({
94
94
  type: String,
95
95
  reflect: !0
96
- })], d.prototype, "position", void 0), r([u({
96
+ })], d.prototype, "position", void 0), t([l({
97
97
  type: String,
98
98
  reflect: !0
99
- })], d.prototype, "strategy", void 0), r([u({
99
+ })], d.prototype, "strategy", void 0), t([l({
100
100
  type: String,
101
101
  reflect: !0
102
- })], d.prototype, "bias", void 0), r([u({
102
+ })], d.prototype, "bias", void 0), t([l({
103
103
  type: Number,
104
104
  reflect: !0
105
- })], d.prototype, "preserve", void 0), d = r([t()], d);
105
+ })], d.prototype, "preserve", void 0), d = t([e()], d);
106
106
  function f(e) {
107
107
  let t = Number.parseFloat(e);
108
108
  return Number.isFinite(t) ? t : 0;
@@ -1 +1 @@
1
- {"version":3,"file":"format-truncate2.js","names":["styles","_decorate","__decorate","format_truncate_default","FormatTruncate","LitElement","_args","#availableWidth","#onSlotChange","useStyles","attachInternals","#observeAvailableWidth","#resizeObserver","#resizeFrame","text","#slottedText","truncatedText","#renderText","slot","normalizeTruncateText","nodes","isDefaultSlotNode","normalizeTruncateString","measureText","#createTextMeasurer","truncateText","view","context","#textMeasurementContext","computedStyles","letterSpacing","cssPixelValue","wordSpacing","graphemeSegmenter","#measureText","graphemeSegments","whitespaceCount","#measurementContext","entry","entries","property","typeSSR","parsed","value","isElementNode","node"],"sources":["../../src/format-truncate/format-truncate.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { TemplateResult } from 'lit';\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { attachInternals, useStyles, typeSSR } from '@nvidia-elements/core/internal';\nimport { normalizeTruncateString, normalizeTruncateText, truncateText } from './utils.js';\nimport styles from './format-truncate.css?inline';\n\n/**\n * @element nve-format-truncate\n * @description Truncates text at its start, center, or end while preserving the full text for assistive technology.\n * @documentation https://nvidia.github.io/elements/docs/elements/format-truncate/\n * @since 0.0.0\n * @entrypoint \\@nvidia-elements/core/format-truncate\n * @slot - Text to truncate. The component flattens, trims, and normalizes mixed text and element nodes.\n * @beta\n */\n@typeSSR()\nexport class FormatTruncate extends LitElement {\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-format-truncate',\n version: '0.0.0'\n };\n\n /**\n * Location of the ellipsis. Use start or end to preserve one edge, or center to preserve both edges.\n */\n @property({ type: String, reflect: true }) position: 'start' | 'center' | 'end' = 'start';\n\n /**\n * Text unit used for center truncation. Character preserves graphemes, word preserves words, and path preserves path segments.\n */\n @property({ type: String, reflect: true }) strategy: 'character' | 'word' | 'path' = 'character';\n\n /**\n * Edge favored by center truncation. The favored edge keeps at least the configured number of units.\n */\n @property({ type: String, reflect: true }) bias: 'start' | 'end' = 'end';\n\n /**\n * Number of strategy units retained at the biased edge during center truncation.\n */\n @property({ type: Number, reflect: true }) preserve = 6;\n\n /** @private */\n declare _internals: ElementInternals;\n\n #measurementContext?: CanvasRenderingContext2D | null;\n #resizeObserver?: ResizeObserver;\n #resizeFrame?: number;\n #availableWidth = Number.POSITIVE_INFINITY;\n\n override connectedCallback(): void {\n super.connectedCallback();\n attachInternals(this);\n this.#availableWidth = Number.POSITIVE_INFINITY;\n this.#observeAvailableWidth();\n this.requestUpdate();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.#resizeObserver?.disconnect();\n if (this.#resizeFrame !== undefined) this.ownerDocument.defaultView?.cancelAnimationFrame(this.#resizeFrame);\n this.#resizeFrame = undefined;\n }\n\n connectedMoveCallback(): void {\n this.#availableWidth = Number.POSITIVE_INFINITY;\n this.#observeAvailableWidth();\n this.requestUpdate();\n }\n\n override render(): TemplateResult {\n const text = this.#slottedText;\n const truncatedText = this.#renderText(text);\n\n if (truncatedText !== text) {\n if (this.title !== text) this.title = text;\n } else this.removeAttribute('title');\n\n return html`<span internal-host aria-hidden=\"true\">${truncatedText}</span><span sizing-host aria-hidden=\"true\">${text}</span><slot @slotchange=${this.#onSlotChange}></slot>`;\n }\n\n get #slottedText(): string {\n const slot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot:not([name])');\n if (slot) return normalizeTruncateText(slot.assignedNodes({ flatten: true }));\n\n const nodes = Array.from(this.childNodes ?? []).filter(isDefaultSlotNode);\n return nodes.length ? normalizeTruncateText(nodes) : normalizeTruncateString(this.textContent ?? '');\n }\n\n #renderText(text: string): string {\n const measureText = this.#createTextMeasurer();\n\n return truncateText(text, {\n position: this.position,\n strategy: this.strategy,\n bias: this.bias,\n preserve: this.preserve,\n availableWidth: this.#availableWidth,\n measureText\n });\n }\n\n #createTextMeasurer(): (text: string) => number {\n const view = this.ownerDocument?.defaultView;\n const context = this.#textMeasurementContext;\n if (!view || !context) return () => 0;\n\n const computedStyles = view.getComputedStyle(this);\n context.font = computedStyles.font;\n\n const letterSpacing = cssPixelValue(computedStyles.letterSpacing);\n const wordSpacing = cssPixelValue(computedStyles.wordSpacing);\n const graphemeSegmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme' });\n\n return text => this.#measureText(text, { context, letterSpacing, wordSpacing, graphemeSegmenter });\n }\n\n #measureText(\n text: string,\n {\n context,\n letterSpacing,\n wordSpacing,\n graphemeSegmenter\n }: {\n context: CanvasRenderingContext2D;\n letterSpacing: number;\n wordSpacing: number;\n graphemeSegmenter: Intl.Segmenter;\n }\n ): number {\n const graphemeSegments = graphemeSegmenter.segment(text);\n const whitespaceCount = Array.from(text.matchAll(/\\s/gu)).length;\n\n return (\n context.measureText(text).width +\n Math.max(0, Array.from(graphemeSegments).length - 1) * letterSpacing +\n whitespaceCount * wordSpacing\n );\n }\n\n get #textMeasurementContext(): CanvasRenderingContext2D | null {\n if (this.#measurementContext === undefined) {\n this.#measurementContext = this.ownerDocument?.createElement('canvas').getContext('2d') ?? null;\n }\n\n return this.#measurementContext;\n }\n\n #observeAvailableWidth(): void {\n if (typeof ResizeObserver === 'undefined') return;\n\n this.#resizeObserver ??= new ResizeObserver(entries => {\n const entry = entries[0];\n if (this.isConnected && entry) {\n // Content-box measurements avoid synchronous geometry reads between sibling Lit updates.\n this.#availableWidth = entry.contentRect.width;\n const view = this.ownerDocument.defaultView;\n if (view && this.#resizeFrame === undefined) {\n this.#resizeFrame = view.requestAnimationFrame(() => {\n this.#resizeFrame = undefined;\n if (this.isConnected) this.requestUpdate();\n });\n }\n }\n });\n this.#resizeObserver.disconnect();\n this.#resizeObserver.observe(this);\n }\n\n #onSlotChange = (): void => {\n this.requestUpdate();\n };\n}\n\nfunction cssPixelValue(value: string): number {\n const parsed = Number.parseFloat(value);\n return Number.isFinite(parsed) ? parsed : 0;\n}\n\nfunction isDefaultSlotNode(node: Node): boolean {\n return !isElementNode(node) || !node.getAttribute('slot');\n}\n\nfunction isElementNode(node: Node): node is Element {\n return node.nodeType === 1;\n}\n"],"mappings":";;;;;;;;;AAoBO,IAAMI,IAAN,cAA6BC,EAAW;;EA6JjB,A,aAlJsD,KAAA,WAAA,SAKG,KAAA,WAAA,aAKlB,KAAA,OAAA,OAKb,KAAA,WAAA,GAQpC,KAAAE,KAAA,UA2HU,KAAAC,WAAA;GAC1B,KAAK,cAAc;EACrB;;;EA9JgB,KAAA,SAAAC,EAAU,CAACT,CAAM,CAAC;;;EAEP,KAAA,WAAA;GACzB,KAAK;GACL,SAAS;EACX;;CAyBA;CACA;CACA;CACA;CAEA,oBAAmC;EAKjC,AAJA,MAAM,kBAAkB,GACxBU,EAAgB,IAAI,GACpB,KAAKH,KAAkB,UACvB,KAAKI,GAAuB,GAC5B,KAAK,cAAc;CACrB;CAEA,uBAAsC;EAIpC,AAHA,MAAM,qBAAqB,GAC3B,KAAKC,IAAiB,WAAW,GAC7B,KAAKC,OAAiB,KAAA,KAAW,KAAK,cAAc,aAAa,qBAAqB,KAAKA,EAAY,GAC3G,KAAKA,KAAe,KAAA;CACtB;CAEA,wBAA8B;EAG5B,AAFA,KAAKN,KAAkB,UACvB,KAAKI,GAAuB,GAC5B,KAAK,cAAc;CACrB;CAEA,SAAkC;EAChC,IAAMG,IAAO,KA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AAAH,EAAA,CAAAwC,EAAQ,CAAA,GAAArC,CAAA;AAmKT,SAAS2B,EAAc,GAAuB;CAC5C,IAAMW,IAAS,OAAO,WAAWC,CAAK;CACtC,OAAO,OAAO,SAASD,CAAM,IAAIA,IAAS;AAC5C;AAEA,SAASrB,EAAkB,GAAqB;CAC9C,OAAO,CAACuB,EAAcC,CAAI,KAAK,CAACA,EAAK,aAAa,MAAM;AAC1D;AAEA,SAASD,EAAc,GAA6B;CAClD,OAAOC,EAAK,aAAa;AAC3B"}
1
+ {"version":3,"file":"format-truncate2.js","names":["styles","_decorate","__decorate","format_truncate_default","FormatTruncate","LitElement","_args","#availableWidth","#onSlotChange","useStyles","attachInternals","#observeAvailableWidth","#resizeObserver","#resizeFrame","text","#slottedText","truncatedText","#renderText","slot","normalizeTruncateText","nodes","isDefaultSlotNode","normalizeTruncateString","measureText","#createTextMeasurer","truncateText","view","context","#textMeasurementContext","computedStyles","letterSpacing","cssPixelValue","wordSpacing","graphemeSegmenter","#measureText","graphemeSegments","whitespaceCount","#measurementContext","entry","entries","property","typeSSR","parsed","value","isElementNode","node"],"sources":["../../src/format-truncate/format-truncate.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { TemplateResult } from 'lit';\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { typeSSR } from '@nvidia-elements/core/internal';\nimport { attachInternals } from '@nvidia-elements/foundations/internal/a11y';\nimport { useStyles } from '@nvidia-elements/foundations/internal/styles';\nimport { normalizeTruncateString, normalizeTruncateText, truncateText } from './utils.js';\nimport styles from './format-truncate.css?inline';\n\n/**\n * @element nve-format-truncate\n * @description Truncates text at its start, center, or end while preserving the full text for assistive technology.\n * @documentation https://nvidia.github.io/elements/docs/elements/format-truncate/\n * @since 0.0.0\n * @entrypoint \\@nvidia-elements/core/format-truncate\n * @slot - Text to truncate. The component flattens, trims, and normalizes mixed text and element nodes.\n * @beta\n */\n@typeSSR()\nexport class FormatTruncate extends LitElement {\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-format-truncate',\n version: '0.0.0'\n };\n\n /**\n * Location of the ellipsis. Use start or end to preserve one edge, or center to preserve both edges.\n */\n @property({ type: String, reflect: true }) position: 'start' | 'center' | 'end' = 'start';\n\n /**\n * Text unit used for center truncation. Character preserves graphemes, word preserves words, and path preserves path segments.\n */\n @property({ type: String, reflect: true }) strategy: 'character' | 'word' | 'path' = 'character';\n\n /**\n * Edge favored by center truncation. The favored edge keeps at least the configured number of units.\n */\n @property({ type: String, reflect: true }) bias: 'start' | 'end' = 'end';\n\n /**\n * Number of strategy units retained at the biased edge during center truncation.\n */\n @property({ type: Number, reflect: true }) preserve = 6;\n\n /** @private */\n declare _internals: ElementInternals;\n\n #measurementContext?: CanvasRenderingContext2D | null;\n #resizeObserver?: ResizeObserver;\n #resizeFrame?: number;\n #availableWidth = Number.POSITIVE_INFINITY;\n\n override connectedCallback(): void {\n super.connectedCallback();\n attachInternals(this);\n this.#availableWidth = Number.POSITIVE_INFINITY;\n this.#observeAvailableWidth();\n this.requestUpdate();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.#resizeObserver?.disconnect();\n if (this.#resizeFrame !== undefined) this.ownerDocument.defaultView?.cancelAnimationFrame(this.#resizeFrame);\n this.#resizeFrame = undefined;\n }\n\n connectedMoveCallback(): void {\n this.#availableWidth = Number.POSITIVE_INFINITY;\n this.#observeAvailableWidth();\n this.requestUpdate();\n }\n\n override render(): TemplateResult {\n const text = this.#slottedText;\n const truncatedText = this.#renderText(text);\n\n if (truncatedText !== text) {\n if (this.title !== text) this.title = text;\n } else this.removeAttribute('title');\n\n return html`<span internal-host aria-hidden=\"true\">${truncatedText}</span><span sizing-host aria-hidden=\"true\">${text}</span><slot @slotchange=${this.#onSlotChange}></slot>`;\n }\n\n get #slottedText(): string {\n const slot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot:not([name])');\n if (slot) return normalizeTruncateText(slot.assignedNodes({ flatten: true }));\n\n const nodes = Array.from(this.childNodes ?? []).filter(isDefaultSlotNode);\n return nodes.length ? normalizeTruncateText(nodes) : normalizeTruncateString(this.textContent ?? '');\n }\n\n #renderText(text: string): string {\n const measureText = this.#createTextMeasurer();\n\n return truncateText(text, {\n position: this.position,\n strategy: this.strategy,\n bias: this.bias,\n preserve: this.preserve,\n availableWidth: this.#availableWidth,\n measureText\n });\n }\n\n #createTextMeasurer(): (text: string) => number {\n const view = this.ownerDocument?.defaultView;\n const context = this.#textMeasurementContext;\n if (!view || !context) return () => 0;\n\n const computedStyles = view.getComputedStyle(this);\n context.font = computedStyles.font;\n\n const letterSpacing = cssPixelValue(computedStyles.letterSpacing);\n const wordSpacing = cssPixelValue(computedStyles.wordSpacing);\n const graphemeSegmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme' });\n\n return text => this.#measureText(text, { context, letterSpacing, wordSpacing, graphemeSegmenter });\n }\n\n #measureText(\n text: string,\n {\n context,\n letterSpacing,\n wordSpacing,\n graphemeSegmenter\n }: {\n context: CanvasRenderingContext2D;\n letterSpacing: number;\n wordSpacing: number;\n graphemeSegmenter: Intl.Segmenter;\n }\n ): number {\n const graphemeSegments = graphemeSegmenter.segment(text);\n const whitespaceCount = Array.from(text.matchAll(/\\s/gu)).length;\n\n return (\n context.measureText(text).width +\n Math.max(0, Array.from(graphemeSegments).length - 1) * letterSpacing +\n whitespaceCount * wordSpacing\n );\n }\n\n get #textMeasurementContext(): CanvasRenderingContext2D | null {\n if (this.#measurementContext === undefined) {\n this.#measurementContext = this.ownerDocument?.createElement('canvas').getContext('2d') ?? null;\n }\n\n return this.#measurementContext;\n }\n\n #observeAvailableWidth(): void {\n if (typeof ResizeObserver === 'undefined') return;\n\n this.#resizeObserver ??= new ResizeObserver(entries => {\n const entry = entries[0];\n if (this.isConnected && entry) {\n // Content-box measurements avoid synchronous geometry reads between sibling Lit updates.\n this.#availableWidth = entry.contentRect.width;\n const view = this.ownerDocument.defaultView;\n if (view && this.#resizeFrame === undefined) {\n this.#resizeFrame = view.requestAnimationFrame(() => {\n this.#resizeFrame = undefined;\n if (this.isConnected) this.requestUpdate();\n });\n }\n }\n });\n this.#resizeObserver.disconnect();\n this.#resizeObserver.observe(this);\n }\n\n #onSlotChange = (): void => {\n this.requestUpdate();\n };\n}\n\nfunction cssPixelValue(value: string): number {\n const parsed = Number.parseFloat(value);\n return Number.isFinite(parsed) ? parsed : 0;\n}\n\nfunction isDefaultSlotNode(node: Node): boolean {\n return !isElementNode(node) || !node.getAttribute('slot');\n}\n\nfunction isElementNode(node: Node): node is Element {\n return node.nodeType === 1;\n}\n"],"mappings":";;;;;;;;;AAsBO,IAAMI,IAAN,cAA6BC,EAAW;;EA6JjB,A,aAlJsD,KAAA,WAAA,SAKG,KAAA,WAAA,aAKlB,KAAA,OAAA,OAKb,KAAA,WAAA,GAQpC,KAAAE,KAAA,UA2HU,KAAAC,WAAA;GAC1B,KAAK,cAAc;EACrB;;;EA9JgB,KAAA,SAAAC,EAAU,CAACT,CAAM,CAAC;;;EAEP,KAAA,WAAA;GACzB,KAAK;GACL,SAAS;EACX;;CAyBA;CACA;CACA;CACA;CAEA,oBAAmC;EAKjC,AAJA,MAAM,kBAAkB,GACxBU,EAAgB,IAAI,GACpB,KAAKH,KAAkB,UACvB,KAAKI,GAAuB,GAC5B,KAAK,cAAc;CACrB;CAEA,uBAAsC;EAIpC,AAHA,MAAM,qBAAqB,GAC3B,KAAKC,IAAiB,WAAW,GAC7B,KAAKC,OAAiB,KAAA,KAAW,KAAK,cAAc,aAAa,qBAAqB,KAAKA,EAAY,GAC3G,KAAKA,KAAe,KAAA;CACtB;CAEA,wBAA8B;EAG5B,AAFA,KAAKN,KAAkB,UACvB,KAAKI,GAAuB,GAC5B,KAAK,cAAc;CACrB;CAEA,SAAkC;EAChC,IAAMG,IAAO,KAAKC,IACZC,IAAgB,KAAKC,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,CAAA,GAAArC,CAAA;AAmKT,SAAS2B,EAAc,GAAuB;CAC5C,IAAMW,IAAS,OAAO,WAAWC,CAAK;CACtC,OAAO,OAAO,SAASD,CAAM,IAAIA,IAAS;AAC5C;AAEA,SAASrB,EAAkB,GAAqB;CAC9C,OAAO,CAACuB,EAAcC,CAAI,KAAK,CAACA,EAAK,aAAa,MAAM;AAC1D;AAEA,SAASD,EAAc,GAA6B;CAClD,OAAOC,EAAK,aAAa;AAC3B"}
@@ -1,20 +1,21 @@
1
1
  import { appendRootNodeStyle as e, getAttributeListChanges as t } from "../../internal/utils/dom.js";
2
- import { associateAriaDescribedBy as n, associateDataList as r, associateLabel as i, attachInternals as a } from "../../internal/utils/a11y.js";
3
- import { typeSSR as o } from "../../internal/controllers/type-ssr.controller.js";
4
- import { hostAttr as s } from "../../internal/decorators/host-attr.js";
5
- import { useStyles as c } from "../../internal/styles/index.js";
6
- import l from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorate.js";
7
- import { inputQuery as u, setupControlStates as d, setupControlStatusStates as f, setupControlValidationStates as p } from "../utils/states.js";
8
- import { setupControlLayoutStates as m } from "../utils/layout.js";
9
- import h from "./control.global.js";
10
- import g from "./control.js";
11
- import { LitElement as _, html as v, isServer as y, nothing as b } from "lit";
12
- import { property as x } from "lit/decorators/property.js";
13
- import { I18nController as S } from "@nvidia-elements/foundations/internal/i18n";
2
+ import { typeSSR as n } from "../../internal/controllers/type-ssr.controller.js";
3
+ import { hostAttr as r } from "../../internal/decorators/host-attr.js";
4
+ import { associateAriaDescribedBy as i, associateDataList as a, associateLabel as o } from "../../internal/utils/a11y.js";
5
+ import s from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/decorate.js";
6
+ import { inputQuery as c, setupControlStates as l, setupControlStatusStates as u, setupControlValidationStates as d } from "../utils/states.js";
7
+ import { setupControlLayoutStates as f } from "../utils/layout.js";
8
+ import p from "./control.global.js";
9
+ import m from "./control.js";
10
+ import { attachInternals as h } from "@nvidia-elements/foundations/internal/a11y";
11
+ import { LitElement as g, html as _, isServer as v, nothing as y } from "lit";
12
+ import { property as b } from "lit/decorators/property.js";
13
+ import { I18nController as x } from "@nvidia-elements/foundations/internal/i18n";
14
+ import { useStyles as S } from "@nvidia-elements/foundations/internal/styles";
14
15
  // src/forms/control/control.ts
15
- var C = class extends _ {
16
+ var C = class extends g {
16
17
  constructor(...e) {
17
- super(...e), this.fitText = !1, this.fitContent = !1, this.#e = new S(this, this.i18nDefaults), this.i18n = this.#e.i18n, this.nveControl = "", this.#i = [], this._associateDatalist = !0, this.#a = () => {
18
+ super(...e), this.fitText = !1, this.fitContent = !1, this.#e = new x(this, this.i18nDefaults), this.i18n = this.#e.i18n, this.nveControl = "", this.#i = [], this._associateDatalist = !0, this.#a = () => {
18
19
  this.#f(), this.input && this.#i.length === 0 && this.#l();
19
20
  }, this.#u = () => {
20
21
  this.#f(), this.#p();
@@ -32,33 +33,33 @@ var C = class extends _ {
32
33
  }
33
34
  #r;
34
35
  get input() {
35
- if (!y && !this.#r) {
36
+ if (!v && !this.#r) {
36
37
  let e = this.querySelector("slot")?.assignedElements()?.find((e) => e.matches("input, select, selectmenu, textarea, [nve-control]")) ?? Array.from(this.shadowRoot.querySelector("slot")?.assignedElements({ flatten: !0 }) ?? []).find((e) => e.matches("input, select, selectmenu, textarea, [nve-control]"));
37
- this.#r = e || this.querySelector(u);
38
+ this.#r = e || this.querySelector(c);
38
39
  }
39
40
  return this.#r;
40
41
  }
41
42
  get prefixContent() {
42
- return b;
43
+ return y;
43
44
  }
44
45
  get suffixContent() {
45
- return b;
46
+ return y;
46
47
  }
47
48
  #i;
48
49
  static {
49
- this.styles = c([g]);
50
+ this.styles = S([m]);
50
51
  }
51
52
  static {
52
53
  this.metadata = {
53
54
  tag: "nve-control",
54
- version: "2.23.3"
55
+ version: "2.23.5"
55
56
  };
56
57
  }
57
58
  render() {
58
- return this.nveControl === "inline" ? v`<div internal-host part="_internal-host"><div input part="_input"><slot interaction-state></slot></div><slot name="label" part="_label"></slot><slot name="messages" part="_messages"></slot></div>` : v`<div internal-host part="_internal-host"><slot name="label" part="_label"></slot><div input part="_input">${this.prefixContent}<slot></slot>${this.suffixContent}</div><slot name="messages" part="_messages"></slot></div>`;
59
+ return this.nveControl === "inline" ? _`<div internal-host part="_internal-host"><div input part="_input"><slot interaction-state></slot></div><slot name="label" part="_label"></slot><slot name="messages" part="_messages"></slot></div>` : _`<div internal-host part="_internal-host"><slot name="label" part="_label"></slot><div input part="_input">${this.prefixContent}<slot></slot>${this.suffixContent}</div><slot name="messages" part="_messages"></slot></div>`;
59
60
  }
60
61
  connectedCallback() {
61
- super.connectedCallback(), a(this), e(this, h), this.shadowRoot.addEventListener("slotchange", this.#a);
62
+ super.connectedCallback(), h(this), e(this, p), this.shadowRoot.addEventListener("slotchange", this.#a);
62
63
  }
63
64
  disconnectedCallback() {
64
65
  super.disconnectedCallback(), this.shadowRoot.removeEventListener("slotchange", this.#a), this.shadowRoot.removeEventListener("slotchange", this.#u), this.#i.forEach((e) => e.disconnect()), this.#i.length = 0;
@@ -81,7 +82,7 @@ var C = class extends _ {
81
82
  return e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio");
82
83
  }
83
84
  #l() {
84
- this.#i.push(...p(this, this.#n), ...d(this), ...f(this, this.#n), m(this), t(this, ["hidden", "status"], () => this.#f())), this.#d(), this.#p(), this.shadowRoot.addEventListener("slotchange", this.#u);
85
+ this.#i.push(...d(this, this.#n), ...l(this), ...u(this, this.#n), f(this), t(this, ["hidden", "status"], () => this.#f())), this.#d(), this.#p(), this.shadowRoot.addEventListener("slotchange", this.#u);
85
86
  }
86
87
  #u;
87
88
  #d() {
@@ -91,7 +92,7 @@ var C = class extends _ {
91
92
  this.input && (this.toggleAttribute("multiple", this.input?.multiple), this.input?.hasAttribute("size") ? this.setAttribute("size", "") : this.removeAttribute("size"));
92
93
  }
93
94
  #p() {
94
- this.#m(), i(this.#t, this.input), n(Array.from(this.#n), this.input), this._associateDatalist && r(this.querySelector("datalist"), this.input);
95
+ this.#m(), o(this.#t, this.input), i(Array.from(this.#n), this.input), this._associateDatalist && a(this.querySelector("datalist"), this.input);
95
96
  }
96
97
  #m() {
97
98
  let e = this.querySelector("label") || this.shadowRoot.querySelector("slot").assignedNodes({ flatten: !0 }).find((e) => e.tagName === "LABEL");
@@ -103,21 +104,21 @@ var C = class extends _ {
103
104
  } catch {}
104
105
  }
105
106
  };
106
- l([x({ type: String })], C.prototype, "status", void 0), l([x({
107
+ s([b({ type: String })], C.prototype, "status", void 0), s([b({
107
108
  type: String,
108
109
  reflect: !0
109
- })], C.prototype, "layout", void 0), l([x({
110
+ })], C.prototype, "layout", void 0), s([b({
110
111
  type: Boolean,
111
112
  reflect: !0,
112
113
  attribute: "fit-text"
113
- })], C.prototype, "fitText", void 0), l([x({
114
+ })], C.prototype, "fitText", void 0), s([b({
114
115
  type: Boolean,
115
116
  reflect: !0,
116
117
  attribute: "fit-content"
117
- })], C.prototype, "fitContent", void 0), l([x({ type: Object })], C.prototype, "i18n", void 0), l([x({
118
+ })], C.prototype, "fitContent", void 0), s([b({ type: Object })], C.prototype, "i18n", void 0), s([b({
118
119
  type: String,
119
120
  reflect: !0
120
- })], C.prototype, "prominence", void 0), l([s({ attribute: "nve-control" })], C.prototype, "nveControl", void 0), C = l([o()], C);
121
+ })], C.prototype, "prominence", void 0), s([r({ attribute: "nve-control" })], C.prototype, "nveControl", void 0), C = s([n()], C);
121
122
  export { C as Control };
122
123
 
123
124
  //# sourceMappingURL=control2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"control2.js","names":["styles","globalStyles","_decorate","__decorate","control_global_default","control_default","Control","LitElement","_args","#i18nController","I18nController","#observers","#onRootSlotchange","#updateStyleStates","#setupInput","#onInputSlotchange","#updateAssociations","#label","#messages","isServer","#input","slotted","i","inputQuery","nothing","useStyles","attachInternals","appendRootNodeStyle","observer","#resetInputValue","input","#resetSelectValue","#isCheckedInput","hasDefaultSelection","option","setupControlValidationStates","setupControlStates","setupControlStatusStates","setupControlLayoutStates","getAttributeListChanges","#polyfillShowPicker","#assignLabel","associateLabel","associateAriaDescribedBy","associateDataList","label","property","hostAttr","typeSSR"],"sources":["../../../src/forms/control/control.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 { LitElement, html, nothing, isServer } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport {\n attachInternals,\n useStyles,\n associateLabel,\n associateAriaDescribedBy,\n associateDataList,\n appendRootNodeStyle,\n getAttributeListChanges,\n hostAttr,\n typeSSR\n} from '@nvidia-elements/core/internal';\nimport { I18nController, type I18nDefaults } from '@nvidia-elements/foundations/internal/i18n';\nimport type { ControlMessage } from '../control-message/control-message.js';\nimport {\n setupControlValidationStates,\n setupControlStates,\n setupControlStatusStates,\n inputQuery,\n type ControlStateCleanup\n} from '../utils/states.js';\nimport { setupControlLayoutStates } from '../utils/layout.js';\nimport globalStyles from './control.global.css?inline';\nimport styles from './control.css?inline';\n\ninterface ResettableControl {\n getAttribute: Element['getAttribute'];\n value: string;\n}\n\ntype ControlInput = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | ResettableControl;\n\n/**\n * @element nve-control\n * @description Wraps a form input with its associated label and validation messages, managing layout and accessibility associations.\n * @documentation https://nvidia.github.io/elements/docs/elements/control/\n * @since 0.3.0\n * @entrypoint \\@nvidia-elements/core/forms\n * @slot - Control input element\n * @slot label - Label element\n * @cssprop --cursor\n * @cssprop --accent-color\n * @cssprop --color\n * @cssprop --label-color\n * @cssprop --label-width\n * @cssprop --label-font-weight\n * @cssprop --label-font-size\n * @cssprop --control-width\n * @cssprop --control-height\n\n * @aria https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals\n * @package true\n */\n@typeSSR()\nexport class Control extends LitElement {\n /** Set current visual state for control. This overrides any validation states active. */\n @property({ type: String }) status: 'warning' | 'error' | 'success' | 'disabled';\n\n /** Set current control + label + control message layout. Layouts will collapse based on available container space. */\n @property({ type: String, reflect: true }) layout:\n | 'vertical'\n | 'vertical-inline'\n | 'horizontal'\n | 'horizontal-inline';\n\n /** Sets the input to match the width of the active text content of the control value. Only applicable to vertical input box type controls (input, select) */\n @property({ type: Boolean, reflect: true, attribute: 'fit-text' }) fitText = false;\n\n /** Sets the input to match native default content block */\n @property({ type: Boolean, reflect: true, attribute: 'fit-content' }) fitContent = false;\n\n /** Component-specific defaults supplied by a derived control. */\n protected get i18nDefaults(): I18nDefaults {\n return {};\n }\n\n #i18nController: I18nController<this> = new I18nController<this>(this, this.i18nDefaults);\n\n /** Enables internal string values to update for internationalization. */\n @property({ type: Object }) i18n = this.#i18nController.i18n;\n\n /** Set the visual prominence of the control */\n @property({ type: String, reflect: true }) prominence: 'muted';\n\n get #label() {\n return this.shadowRoot\n ?.querySelector<HTMLSlotElement>('slot[name=\"label\"]')\n ?.assignedElements({ flatten: true })?.[0] as HTMLLabelElement;\n }\n\n get #messages() {\n return (this.shadowRoot\n ?.querySelector<HTMLSlotElement>('slot[name=\"messages\"]')\n ?.assignedElements({ flatten: true }) ?? []) as ControlMessage[];\n }\n\n #input: HTMLInputElement;\n\n /** @private */\n get input(): HTMLInputElement {\n if (!isServer && !this.#input) {\n const slotted =\n this.querySelector('slot')\n ?.assignedElements()\n ?.find(i => i.matches(inputQuery)) ??\n Array.from(this.shadowRoot!.querySelector('slot')?.assignedElements({ flatten: true }) ?? []).find(i =>\n i.matches(inputQuery)\n );\n this.#input = (slotted ? slotted : this.querySelector(inputQuery)) as HTMLInputElement;\n }\n\n return this.#input;\n }\n\n /** @private */\n protected get prefixContent(): typeof nothing | TemplateResult {\n return nothing;\n }\n\n /** @private */\n protected get suffixContent(): typeof nothing | TemplateResult {\n return nothing;\n }\n\n @hostAttr({ attribute: 'nve-control' }) protected nveControl = '';\n\n /** @private */\n declare _internals: ElementInternals;\n\n #observers: (MutationObserver | ResizeObserver | ControlStateCleanup)[] = [];\n\n protected _associateDatalist = true;\n\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-control',\n version: '0.0.0'\n };\n\n render() {\n return this.nveControl !== 'inline'\n ? html`\n <div internal-host part=\"_internal-host\">\n <slot name=\"label\" part=\"_label\"></slot>\n <div input part=\"_input\">\n ${this.prefixContent}\n <slot></slot>\n ${this.suffixContent}\n </div>\n <slot name=\"messages\" part=\"_messages\"></slot>\n </div>\n `\n : html`\n <div internal-host part=\"_internal-host\">\n <div input part=\"_input\"><slot interaction-state></slot></div>\n <slot name=\"label\" part=\"_label\"></slot>\n <slot name=\"messages\" part=\"_messages\"></slot>\n </div>\n `;\n }\n\n connectedCallback() {\n super.connectedCallback();\n attachInternals(this);\n appendRootNodeStyle(this, globalStyles);\n this.shadowRoot!.addEventListener('slotchange', this.#onRootSlotchange);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.shadowRoot!.removeEventListener('slotchange', this.#onRootSlotchange);\n this.shadowRoot!.removeEventListener('slotchange', this.#onInputSlotchange);\n this.#observers.forEach(observer => observer.disconnect());\n this.#observers.length = 0;\n }\n\n #onRootSlotchange = () => {\n this.#updateStyleStates();\n\n if (this.input && this.#observers.length === 0) {\n this.#setupInput();\n }\n };\n\n /** Resets control value to initial attribute value and clears any active validation rules. */\n reset() {\n this.#resetInputValue(this.input);\n this.requestUpdate();\n this.dispatchEvent(new CustomEvent('reset', { bubbles: true, composed: true }));\n }\n\n #resetInputValue(input: ControlInput) {\n if (input instanceof HTMLSelectElement) {\n this.#resetSelectValue(input);\n return;\n }\n\n if (this.#isCheckedInput(input)) {\n input.checked = input.defaultChecked;\n input.indeterminate = false;\n return;\n }\n\n input.value =\n input instanceof HTMLInputElement || input instanceof HTMLTextAreaElement\n ? input.defaultValue\n : (input.getAttribute('value') ?? '');\n }\n\n #resetSelectValue(input: HTMLSelectElement) {\n const hasDefaultSelection = Array.from(input.options).some(option => option.defaultSelected);\n Array.from(input.options).forEach(option => (option.selected = option.defaultSelected));\n if (!input.multiple && !hasDefaultSelection) input.selectedIndex = 0;\n }\n\n #isCheckedInput(input: ControlInput): input is HTMLInputElement {\n return input instanceof HTMLInputElement && (input.type === 'checkbox' || input.type === 'radio');\n }\n\n #setupInput() {\n this.#observers.push(\n ...setupControlValidationStates(this, this.#messages),\n ...setupControlStates(this),\n ...setupControlStatusStates(this, this.#messages),\n setupControlLayoutStates(this),\n getAttributeListChanges(this, ['hidden', 'status'], () => this.#updateStyleStates())\n );\n\n this.#polyfillShowPicker();\n this.#updateAssociations();\n this.shadowRoot!.addEventListener('slotchange', this.#onInputSlotchange);\n }\n\n #onInputSlotchange = () => {\n this.#updateStyleStates();\n this.#updateAssociations();\n };\n\n #polyfillShowPicker() {\n if (!this.input.showPicker) {\n this.input.showPicker = () => this.input.focus();\n }\n }\n\n #updateStyleStates() {\n if (this.input) {\n this.toggleAttribute('multiple', this.input?.multiple);\n this.input?.hasAttribute('size') ? this.setAttribute('size', '') : this.removeAttribute('size');\n }\n }\n\n #updateAssociations() {\n this.#assignLabel();\n associateLabel(this.#label, this.input);\n associateAriaDescribedBy(Array.from(this.#messages), this.input);\n\n if (this._associateDatalist) {\n associateDataList(this.querySelector<HTMLDataListElement>('datalist')!, this.input);\n }\n }\n\n #assignLabel() {\n const label =\n this.querySelector('label') ||\n (this.shadowRoot!.querySelector('slot')!\n .assignedNodes({ flatten: true })\n .find((i: Node) => (i as HTMLElement).tagName === 'LABEL') as HTMLLabelElement);\n if (label) {\n label.slot = 'label';\n }\n }\n\n protected showPicker() {\n try {\n this.input.showPicker();\n } catch {\n //\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA2DO,IAAMM,IAAN,cAAsBC,EAAW;;EAoLX,A,aAxKkD,KAAA,UAAA,IAGM,KAAA,aAAA,IAO3C,KAAAE,KAAA,IAAIC,EAAqB,MAAM,KAAK,YAAY,GAGrD,KAAA,OAAA,KAAKD,GAAgB,M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A4C,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,WAAW;AAAW,CAAC,CAAA,GAAAxC,EAAA,WAAA,WAAA,KAAA,CAAA,GAGhEJ,EAAA,CAAA4C,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,WAAW;AAAc,CAAC,CAAA,GAAAxC,EAAA,WAAA,cAAA,KAAA,CAAA,GAUnEJ,EAAA,CAAA4C,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAAxC,EAAA,WAAA,QAAA,KAAA,CAAA,GAGzBJ,EAAA,CAAA4C,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAAxC,EAAA,WAAA,cAAA,KAAA,CAAA,GA0CxCJ,EAAA,CAAA6C,EAAS,EAAE,WAAW,cAAc,CAAC,CAAA,GAAAzC,EAAA,WAAA,cAAA,KAAA,CAAA,GAvEvC,IAAAJ,EAAA,CAAA8C,EAAQ,CAAA,GAAA1C,CAAA"}
1
+ {"version":3,"file":"control2.js","names":["styles","globalStyles","_decorate","__decorate","control_global_default","control_default","Control","LitElement","_args","#i18nController","I18nController","#observers","#onRootSlotchange","#updateStyleStates","#setupInput","#onInputSlotchange","#updateAssociations","#label","#messages","isServer","#input","slotted","i","inputQuery","nothing","useStyles","attachInternals","appendRootNodeStyle","observer","#resetInputValue","input","#resetSelectValue","#isCheckedInput","hasDefaultSelection","option","setupControlValidationStates","setupControlStates","setupControlStatusStates","setupControlLayoutStates","getAttributeListChanges","#polyfillShowPicker","#assignLabel","associateLabel","associateAriaDescribedBy","associateDataList","label","property","hostAttr","typeSSR"],"sources":["../../../src/forms/control/control.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 { LitElement, html, nothing, isServer } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport {\n associateLabel,\n associateAriaDescribedBy,\n associateDataList,\n appendRootNodeStyle,\n getAttributeListChanges,\n hostAttr,\n typeSSR\n} from '@nvidia-elements/core/internal';\nimport { attachInternals } from '@nvidia-elements/foundations/internal/a11y';\nimport { useStyles } from '@nvidia-elements/foundations/internal/styles';\nimport { I18nController, type I18nDefaults } from '@nvidia-elements/foundations/internal/i18n';\nimport type { ControlMessage } from '../control-message/control-message.js';\nimport {\n setupControlValidationStates,\n setupControlStates,\n setupControlStatusStates,\n inputQuery,\n type ControlStateCleanup\n} from '../utils/states.js';\nimport { setupControlLayoutStates } from '../utils/layout.js';\nimport globalStyles from './control.global.css?inline';\nimport styles from './control.css?inline';\n\ninterface ResettableControl {\n getAttribute: Element['getAttribute'];\n value: string;\n}\n\ntype ControlInput = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | ResettableControl;\n\n/**\n * @element nve-control\n * @description Wraps a form input with its associated label and validation messages, managing layout and accessibility associations.\n * @documentation https://nvidia.github.io/elements/docs/elements/control/\n * @since 0.3.0\n * @entrypoint \\@nvidia-elements/core/forms\n * @slot - Control input element\n * @slot label - Label element\n * @cssprop --cursor\n * @cssprop --accent-color\n * @cssprop --color\n * @cssprop --label-color\n * @cssprop --label-width\n * @cssprop --label-font-weight\n * @cssprop --label-font-size\n * @cssprop --control-width\n * @cssprop --control-height\n\n * @aria https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals\n * @package true\n */\n@typeSSR()\nexport class Control extends LitElement {\n /** Set current visual state for control. This overrides any validation states active. */\n @property({ type: String }) status: 'warning' | 'error' | 'success' | 'disabled';\n\n /** Set current control + label + control message layout. Layouts will collapse based on available container space. */\n @property({ type: String, reflect: true }) layout:\n | 'vertical'\n | 'vertical-inline'\n | 'horizontal'\n | 'horizontal-inline';\n\n /** Sets the input to match the width of the active text content of the control value. Only applicable to vertical input box type controls (input, select) */\n @property({ type: Boolean, reflect: true, attribute: 'fit-text' }) fitText = false;\n\n /** Sets the input to match native default content block */\n @property({ type: Boolean, reflect: true, attribute: 'fit-content' }) fitContent = false;\n\n /** Component-specific defaults supplied by a derived control. */\n protected get i18nDefaults(): I18nDefaults {\n return {};\n }\n\n #i18nController: I18nController<this> = new I18nController<this>(this, this.i18nDefaults);\n\n /** Enables internal string values to update for internationalization. */\n @property({ type: Object }) i18n = this.#i18nController.i18n;\n\n /** Set the visual prominence of the control */\n @property({ type: String, reflect: true }) prominence: 'muted';\n\n get #label() {\n return this.shadowRoot\n ?.querySelector<HTMLSlotElement>('slot[name=\"label\"]')\n ?.assignedElements({ flatten: true })?.[0] as HTMLLabelElement;\n }\n\n get #messages() {\n return (this.shadowRoot\n ?.querySelector<HTMLSlotElement>('slot[name=\"messages\"]')\n ?.assignedElements({ flatten: true }) ?? []) as ControlMessage[];\n }\n\n #input: HTMLInputElement;\n\n /** @private */\n get input(): HTMLInputElement {\n if (!isServer && !this.#input) {\n const slotted =\n this.querySelector('slot')\n ?.assignedElements()\n ?.find(i => i.matches(inputQuery)) ??\n Array.from(this.shadowRoot!.querySelector('slot')?.assignedElements({ flatten: true }) ?? []).find(i =>\n i.matches(inputQuery)\n );\n this.#input = (slotted ? slotted : this.querySelector(inputQuery)) as HTMLInputElement;\n }\n\n return this.#input;\n }\n\n /** @private */\n protected get prefixContent(): typeof nothing | TemplateResult {\n return nothing;\n }\n\n /** @private */\n protected get suffixContent(): typeof nothing | TemplateResult {\n return nothing;\n }\n\n @hostAttr({ attribute: 'nve-control' }) protected nveControl = '';\n\n /** @private */\n declare _internals: ElementInternals;\n\n #observers: (MutationObserver | ResizeObserver | ControlStateCleanup)[] = [];\n\n protected _associateDatalist = true;\n\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-control',\n version: '0.0.0'\n };\n\n render() {\n return this.nveControl !== 'inline'\n ? html`\n <div internal-host part=\"_internal-host\">\n <slot name=\"label\" part=\"_label\"></slot>\n <div input part=\"_input\">\n ${this.prefixContent}\n <slot></slot>\n ${this.suffixContent}\n </div>\n <slot name=\"messages\" part=\"_messages\"></slot>\n </div>\n `\n : html`\n <div internal-host part=\"_internal-host\">\n <div input part=\"_input\"><slot interaction-state></slot></div>\n <slot name=\"label\" part=\"_label\"></slot>\n <slot name=\"messages\" part=\"_messages\"></slot>\n </div>\n `;\n }\n\n connectedCallback() {\n super.connectedCallback();\n attachInternals(this);\n appendRootNodeStyle(this, globalStyles);\n this.shadowRoot!.addEventListener('slotchange', this.#onRootSlotchange);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.shadowRoot!.removeEventListener('slotchange', this.#onRootSlotchange);\n this.shadowRoot!.removeEventListener('slotchange', this.#onInputSlotchange);\n this.#observers.forEach(observer => observer.disconnect());\n this.#observers.length = 0;\n }\n\n #onRootSlotchange = () => {\n this.#updateStyleStates();\n\n if (this.input && this.#observers.length === 0) {\n this.#setupInput();\n }\n };\n\n /** Resets control value to initial attribute value and clears any active validation rules. */\n reset() {\n this.#resetInputValue(this.input);\n this.requestUpdate();\n this.dispatchEvent(new CustomEvent('reset', { bubbles: true, composed: true }));\n }\n\n #resetInputValue(input: ControlInput) {\n if (input instanceof HTMLSelectElement) {\n this.#resetSelectValue(input);\n return;\n }\n\n if (this.#isCheckedInput(input)) {\n input.checked = input.defaultChecked;\n input.indeterminate = false;\n return;\n }\n\n input.value =\n input instanceof HTMLInputElement || input instanceof HTMLTextAreaElement\n ? input.defaultValue\n : (input.getAttribute('value') ?? '');\n }\n\n #resetSelectValue(input: HTMLSelectElement) {\n const hasDefaultSelection = Array.from(input.options).some(option => option.defaultSelected);\n Array.from(input.options).forEach(option => (option.selected = option.defaultSelected));\n if (!input.multiple && !hasDefaultSelection) input.selectedIndex = 0;\n }\n\n #isCheckedInput(input: ControlInput): input is HTMLInputElement {\n return input instanceof HTMLInputElement && (input.type === 'checkbox' || input.type === 'radio');\n }\n\n #setupInput() {\n this.#observers.push(\n ...setupControlValidationStates(this, this.#messages),\n ...setupControlStates(this),\n ...setupControlStatusStates(this, this.#messages),\n setupControlLayoutStates(this),\n getAttributeListChanges(this, ['hidden', 'status'], () => this.#updateStyleStates())\n );\n\n this.#polyfillShowPicker();\n this.#updateAssociations();\n this.shadowRoot!.addEventListener('slotchange', this.#onInputSlotchange);\n }\n\n #onInputSlotchange = () => {\n this.#updateStyleStates();\n this.#updateAssociations();\n };\n\n #polyfillShowPicker() {\n if (!this.input.showPicker) {\n this.input.showPicker = () => this.input.focus();\n }\n }\n\n #updateStyleStates() {\n if (this.input) {\n this.toggleAttribute('multiple', this.input?.multiple);\n this.input?.hasAttribute('size') ? this.setAttribute('size', '') : this.removeAttribute('size');\n }\n }\n\n #updateAssociations() {\n this.#assignLabel();\n associateLabel(this.#label, this.input);\n associateAriaDescribedBy(Array.from(this.#messages), this.input);\n\n if (this._associateDatalist) {\n associateDataList(this.querySelector<HTMLDataListElement>('datalist')!, this.input);\n }\n }\n\n #assignLabel() {\n const label =\n this.querySelector('label') ||\n (this.shadowRoot!.querySelector('slot')!\n .assignedNodes({ flatten: true })\n .find((i: Node) => (i as HTMLElement).tagName === 'LABEL') as HTMLLabelElement);\n if (label) {\n label.slot = 'label';\n }\n }\n\n protected showPicker() {\n try {\n this.input.showPicker();\n } catch {\n //\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AA2DO,IAAMM,IAAN,cAAsBC,EAAW;;EAoLX,A,aAxKkD,KAAA,UAAA,IAGM,KAAA,aAAA,IAO3C,KAAAE,KAAA,IAAIC,EAAqB,MAAM,KAAK,YAAY,GAGrD,KAAA,OAAA,KAAKD,GAAgB,MA6CO,KAAA,aAAA,IAKW,KAAAE,KAAA,CAAC,GAE5C,KAAA,qBAAA,IA8CL,KAAAC,WAAA;GAGxB,AAFA,KAAKC,GAAmB,GAEpB,KAAK,SAAS,KAAKF,GAAW,WAAW,KAC3C,KAAKG,GAAY;EAErB,GAmD2B,KAAAC,WAAA;GAEzB,AADA,KAAKF,GAAmB,GACxB,KAAKG,GAAoB;EAC3B;;CArKA,IAAc,eAA6B;EACzC,OAAO,CAAC;CACV;CAEA;CAQA,IAAIC,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