basalt-ui 2.13.3 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/MIGRATING.md +36 -12
  3. package/dist/agent/chat/thread-feed-row.d.ts.map +1 -1
  4. package/dist/agent/chat/thread-feed-row.js +2 -2
  5. package/dist/agent/chat/thread-message.d.ts.map +1 -1
  6. package/dist/agent/chat/thread-message.js +2 -2
  7. package/dist/agent/chat/thread-outcome-card.js +2 -2
  8. package/dist/charts/DualPanel.d.ts.map +1 -1
  9. package/dist/charts/DualPanel.js +1 -0
  10. package/dist/charts/compile.d.ts.map +1 -1
  11. package/dist/charts/compile.js +3 -2
  12. package/dist/charts/cursor.d.ts +10 -6
  13. package/dist/charts/cursor.d.ts.map +1 -1
  14. package/dist/charts/cursor.js +20 -13
  15. package/dist/charts/legend.d.ts +5 -4
  16. package/dist/charts/legend.d.ts.map +1 -1
  17. package/dist/charts/legend.js +3 -3
  18. package/dist/charts/panel.d.ts +2 -0
  19. package/dist/charts/panel.d.ts.map +1 -1
  20. package/dist/charts/panel.js +1 -0
  21. package/dist/commands/notifications/center.d.ts.map +1 -1
  22. package/dist/commands/notifications/center.js +2 -11
  23. package/dist/controls/control-name.d.ts +27 -0
  24. package/dist/controls/control-name.d.ts.map +1 -0
  25. package/dist/controls/control-name.js +11 -0
  26. package/dist/controls/enum-filter.d.ts +3 -6
  27. package/dist/controls/enum-filter.d.ts.map +1 -1
  28. package/dist/controls/enum-filter.js +8 -4
  29. package/dist/controls/filter-base.d.ts +30 -0
  30. package/dist/controls/filter-base.d.ts.map +1 -0
  31. package/dist/controls/filter-base.js +0 -0
  32. package/dist/controls/filter-pill.d.ts +3 -1
  33. package/dist/controls/filter-pill.d.ts.map +1 -1
  34. package/dist/controls/filter-pill.js +2 -0
  35. package/dist/controls/filter-sheet.d.ts +0 -32
  36. package/dist/controls/filter-sheet.d.ts.map +1 -1
  37. package/dist/controls/filter-sheet.js +1 -28
  38. package/dist/controls/glyphs.d.ts +12 -0
  39. package/dist/controls/glyphs.d.ts.map +1 -1
  40. package/dist/controls/glyphs.js +23 -2
  41. package/dist/controls/index.d.ts +2 -1
  42. package/dist/controls/index.d.ts.map +1 -1
  43. package/dist/controls/multi-select-filter.d.ts +8 -3
  44. package/dist/controls/multi-select-filter.d.ts.map +1 -1
  45. package/dist/controls/multi-select-filter.js +27 -10
  46. package/dist/controls/number-filter.d.ts +3 -12
  47. package/dist/controls/number-filter.d.ts.map +1 -1
  48. package/dist/controls/number-filter.js +17 -6
  49. package/dist/controls/panel-row.d.ts +5 -8
  50. package/dist/controls/panel-row.d.ts.map +1 -1
  51. package/dist/controls/panel-row.js +3 -0
  52. package/dist/controls/range-filter.d.ts +14 -14
  53. package/dist/controls/range-filter.d.ts.map +1 -1
  54. package/dist/controls/range-filter.js +18 -41
  55. package/dist/controls/search-filter.d.ts +5 -2
  56. package/dist/controls/search-filter.d.ts.map +1 -1
  57. package/dist/controls/search-filter.js +74 -40
  58. package/dist/controls/select-filter.d.ts +2 -15
  59. package/dist/controls/select-filter.d.ts.map +1 -1
  60. package/dist/controls/sync-button.d.ts +0 -6
  61. package/dist/controls/sync-button.d.ts.map +1 -1
  62. package/dist/controls/sync-button.js +6 -36
  63. package/dist/controls/toggle-filter.d.ts +2 -2
  64. package/dist/controls/toggle-filter.d.ts.map +1 -1
  65. package/dist/controls/toggle-filter.js +3 -2
  66. package/dist/controls/view-tabs.d.ts +3 -4
  67. package/dist/controls/view-tabs.d.ts.map +1 -1
  68. package/dist/controls/view-tabs.js +24 -5
  69. package/dist/format/date.d.ts +43 -10
  70. package/dist/format/date.d.ts.map +1 -1
  71. package/dist/format/date.js +109 -18
  72. package/dist/format/index.d.ts +12 -11
  73. package/dist/format/index.d.ts.map +1 -1
  74. package/dist/format/index.js +11 -2
  75. package/dist/format/measure.d.ts +9 -9
  76. package/dist/format/measure.d.ts.map +1 -1
  77. package/dist/format/measure.js +19 -8
  78. package/dist/format/number.d.ts +35 -27
  79. package/dist/format/number.d.ts.map +1 -1
  80. package/dist/format/number.js +41 -20
  81. package/dist/format/shared.d.ts +38 -7
  82. package/dist/format/shared.d.ts.map +1 -1
  83. package/dist/format/shared.js +61 -13
  84. package/dist/provider/index.d.ts +13 -1
  85. package/dist/provider/index.d.ts.map +1 -1
  86. package/dist/provider/index.js +8 -0
  87. package/llms.txt +35 -14
  88. package/package.json +1 -1
  89. package/src/agent/chat/thread-feed-row.tsx +2 -2
  90. package/src/agent/chat/thread-message.tsx +2 -2
  91. package/src/agent/chat/thread-outcome-card.tsx +2 -2
  92. package/src/charts/DualPanel.tsx +1 -0
  93. package/src/charts/compile.ts +3 -2
  94. package/src/charts/cursor.ts +44 -27
  95. package/src/charts/legend.tsx +9 -6
  96. package/src/charts/panel.tsx +3 -0
  97. package/src/commands/notifications/center.tsx +2 -14
  98. package/src/controls/control-name.ts +33 -0
  99. package/src/controls/enum-filter.tsx +29 -27
  100. package/src/controls/filter-base.ts +31 -0
  101. package/src/controls/filter-pill.tsx +4 -0
  102. package/src/controls/filter-sheet.tsx +0 -56
  103. package/src/controls/glyphs.tsx +45 -2
  104. package/src/controls/index.ts +2 -1
  105. package/src/controls/multi-select-filter.tsx +67 -43
  106. package/src/controls/number-filter.tsx +47 -47
  107. package/src/controls/panel-row.tsx +7 -8
  108. package/src/controls/range-filter.tsx +54 -78
  109. package/src/controls/search-filter.tsx +107 -54
  110. package/src/controls/select-filter.tsx +2 -18
  111. package/src/controls/sync-button.tsx +7 -40
  112. package/src/controls/toggle-filter.tsx +9 -7
  113. package/src/controls/view-tabs.tsx +41 -21
  114. package/src/format/date.ts +189 -36
  115. package/src/format/index.ts +12 -11
  116. package/src/format/measure.ts +29 -18
  117. package/src/format/number.ts +76 -37
  118. package/src/format/shared.ts +116 -25
  119. package/src/provider/index.tsx +23 -0
  120. package/dist/agent/chat/relative-time.d.ts +0 -27
  121. package/dist/agent/chat/relative-time.d.ts.map +0 -1
  122. package/dist/agent/chat/relative-time.js +0 -27
  123. package/src/agent/chat/relative-time.ts +0 -55
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Shared low-level pieces of `basalt-ui/format` — the em-dash sentinel and the memoized
3
- * `Intl.NumberFormat` cache every number formatter in this module reuses. Moved here (out of
4
- * `src/charts/utils/format.ts`, C5 consolidation) so the subpath is the single implementation;
5
- * 2.0's chart layer imports it directly (`docs/V2-SPEC.md` § 9).
2
+ * Shared low-level pieces of `basalt-ui/format`: the {@link NON_FINITE} sentinel, the default
3
+ * locale / time zone ({@link defineFormat}), the memoized `Intl` caches and the number-input
4
+ * guard every formatter in this module reuses. The subpath is the single implementation; the chart
5
+ * layer imports it directly (`docs/V2-SPEC.md` § 9).
6
6
  */
7
7
 
8
8
  /**
@@ -12,43 +12,134 @@
12
12
  */
13
13
  export const NON_FINITE = '—'
14
14
 
15
- /** Options every number formatter here accepts. */
15
+ /** Options every number/measure formatter accepts. */
16
16
  export type LocaleOption = {
17
- /** BCP-47 tag. Default `undefined` — the runtime's own locale. */
18
- locale?: string
17
+ /** BCP-47 tag. Default: the {@link defineFormat} default, else the runtime's own locale. */
18
+ locale?: string | undefined
19
+ }
20
+
21
+ export type FormatDefaults = {
22
+ /** BCP-47 tag every formatter uses when a call passes none. */
23
+ locale?: string | undefined
24
+ /** IANA time zone every date formatter uses when a call passes none. */
25
+ timeZone?: string | undefined
19
26
  }
20
27
 
21
28
  /**
22
- * `Intl.NumberFormat` construction is the expensive half of formatting and a chart formats one
23
- * label per tick per frame, so instances are memoized on their own arguments. The key is the
24
- * serialized options because that is exactly what identifies an instance.
29
+ * `Intl` construction is the expensive half of formatting, so instances are memoized per RESOLVED
30
+ * locale (call locale, else the default) — a changed default can never serve a stale instance.
25
31
  */
26
- const formatterCache = new Map<string, Intl.NumberFormat>()
32
+ const numberCaches = new Map<string, Map<string, Intl.NumberFormat>>()
33
+ const dateCaches = new Map<string, Map<string, Intl.DateTimeFormat>>()
27
34
 
28
- export function numberFormat(
35
+ let defaults: FormatDefaults = {}
36
+
37
+ /**
38
+ * Sets the locale / time zone every formatter in `basalt-ui/format` falls back to when a call
39
+ * passes none. Merges: only DEFINED fields are applied, `undefined` leaves the earlier value.
40
+ *
41
+ * The default is ONE module-global per process (formatters are plain functions, not hooks), so it
42
+ * is an app-wide setting, not a per-request one — a server rendering many locales passes `locale`
43
+ * per call instead. `BasaltProvider`'s `locale` / `timeZone` props call this.
44
+ */
45
+ export function defineFormat(next: FormatDefaults = {}): void {
46
+ const merged: FormatDefaults = {
47
+ locale: next.locale ?? defaults.locale,
48
+ timeZone: next.timeZone ?? defaults.timeZone,
49
+ }
50
+ if (merged.locale === defaults.locale && merged.timeZone === defaults.timeZone) return
51
+ defaults = merged
52
+ numberCaches.clear()
53
+ dateCaches.clear()
54
+ }
55
+
56
+ /** Clears the {@link defineFormat} defaults back to the runtime's own locale and zone. */
57
+ export function resetFormatDefaults(): void {
58
+ defaults = {}
59
+ numberCaches.clear()
60
+ dateCaches.clear()
61
+ }
62
+
63
+ /**
64
+ * Cache key: the options' own entries, sorted, joined — no serialization of the whole object per
65
+ * call (a chart formats one label per tick per frame). Option values here are primitives.
66
+ */
67
+ function optionsKey(options: object): string {
68
+ let key = ''
69
+ for (const [name, value] of Object.entries(options).sort(([a], [b]) => (a < b ? -1 : 1))) {
70
+ key += `${name}=${String(value)};`
71
+ }
72
+ return key
73
+ }
74
+
75
+ function memoize<T>(
76
+ caches: Map<string, Map<string, T>>,
29
77
  locale: string | undefined,
30
- options: Intl.NumberFormatOptions,
31
- ): Intl.NumberFormat {
32
- const key = `${locale ?? ''}|${JSON.stringify(options)}`
33
- const cached = formatterCache.get(key)
78
+ options: object,
79
+ create: () => T,
80
+ ): T {
81
+ const localeKey = locale ?? ''
82
+ let cache = caches.get(localeKey)
83
+ if (cache === undefined) {
84
+ cache = new Map()
85
+ caches.set(localeKey, cache)
86
+ }
87
+ const key = optionsKey(options)
88
+ const cached = cache.get(key)
34
89
  if (cached !== undefined) return cached
35
- const created = new Intl.NumberFormat(locale, options)
36
- formatterCache.set(key, created)
90
+ const created = create()
91
+ cache.set(key, created)
37
92
  return created
38
93
  }
39
94
 
40
- const dateFormatterCache = new Map<string, Intl.DateTimeFormat>()
95
+ export function numberFormat(
96
+ locale: string | undefined,
97
+ options: Intl.NumberFormatOptions,
98
+ ): Intl.NumberFormat {
99
+ const resolved = locale ?? defaults.locale
100
+ return memoize(numberCaches, resolved, options, () => new Intl.NumberFormat(resolved, options))
101
+ }
41
102
 
42
103
  export function dateFormat(
43
104
  locale: string | undefined,
44
105
  options: Intl.DateTimeFormatOptions,
45
106
  ): Intl.DateTimeFormat {
46
- const key = `${locale ?? ''}|${JSON.stringify(options)}`
47
- const cached = dateFormatterCache.get(key)
48
- if (cached !== undefined) return cached
49
- const created = new Intl.DateTimeFormat(locale, options)
50
- dateFormatterCache.set(key, created)
51
- return created
107
+ const resolved = locale ?? defaults.locale
108
+ const withZone =
109
+ options.timeZone === undefined && defaults.timeZone !== undefined
110
+ ? { ...options, timeZone: defaults.timeZone }
111
+ : options
112
+ return memoize(dateCaches, resolved, withZone, () => new Intl.DateTimeFormat(resolved, withZone))
113
+ }
114
+
115
+ /** What every number/measure formatter accepts. */
116
+ export type Numeric = number | null | undefined
117
+
118
+ /** True for a finite number; `null`, `undefined`, `NaN` and `±Infinity` are the inputs every
119
+ * number/measure formatter answers with {@link NON_FINITE}. */
120
+ export function isFiniteNumber(value: Numeric): value is number {
121
+ return typeof value === 'number' && Number.isFinite(value)
122
+ }
123
+
124
+ /**
125
+ * Scales `value` down by 1000 per step (up to `maxUnit`) and returns the step. Rounds FIRST, then
126
+ * promotes when the rounded magnitude reaches 1000 — `999.6` at step 0 is `1000` and belongs to
127
+ * the next unit, not `1,000 B`. Step 0 is whole numbers; higher steps round to `digits`.
128
+ */
129
+ export function scaleThousands(
130
+ value: number,
131
+ digits: number,
132
+ maxUnit: number,
133
+ ): { scaled: number; unit: number } {
134
+ let scaled = value
135
+ let unit = 0
136
+ while (unit < maxUnit) {
137
+ const factor = 10 ** (unit === 0 ? 0 : digits)
138
+ if (Math.round(Math.abs(scaled) * factor) / factor < 1000) break
139
+ scaled /= 1000
140
+ unit += 1
141
+ }
142
+ return { scaled, unit }
52
143
  }
53
144
 
54
145
  /** Coerces the flexible `Date | number | string` inputs this module's date formatters accept into
@@ -32,6 +32,8 @@ import { buildPaletteData } from '../tokens/palette'
32
32
  import { useMediaQuery } from '../common/use-media-query'
33
33
  import { registerColorSchemeSetter } from '../commands/shell-bridge'
34
34
  import { useIsomorphicLayoutEffect } from '../common/isomorphic-layout-effect'
35
+ import { defineFormat } from '../format/shared'
36
+ import type { FormatDefaults } from '../format/shared'
35
37
  import { PageTitle } from '../shell/page-title'
36
38
  import { SizeClassHintContext } from '../shell/use-size-class'
37
39
  import type { SizeClass } from '../shell/use-size-class'
@@ -98,6 +100,18 @@ type BasaltProviderCommonProps = {
98
100
  * action wiring mounts.
99
101
  */
100
102
  spotlight?: boolean
103
+ /**
104
+ * Default BCP-47 locale for every `basalt-ui/format` formatter that gets no per-call `locale`
105
+ * (`integer(1112)` → `1,112` under `en-US`). App-level config, static for the provider's
106
+ * lifetime: it sets ONE module-global default per process (formatters are plain functions, not
107
+ * hooks) and a per-call `locale` is the override. An unset prop LEAVES the current default in
108
+ * place (it never resets it), and changing the prop at runtime does not re-render formatted
109
+ * children.
110
+ */
111
+ locale?: string
112
+ /** Default IANA time zone for the date/time formatters; same lifecycle as `locale`. Unset leaves
113
+ * the current default (initially the runtime's zone). */
114
+ timeZone?: string
101
115
  } & Omit<MantineProviderProps, 'children' | 'theme' | 'defaultColorScheme' | 'cssVariablesResolver'>
102
116
 
103
117
  /**
@@ -482,12 +496,21 @@ export function BasaltProvider({
482
496
  sizeClassHint = 'compact',
483
497
  navCommandLabel,
484
498
  spotlight = true,
499
+ locale,
500
+ timeZone,
485
501
  router: mountedRouter,
486
502
  children,
487
503
  ...rest
488
504
  }: BasaltProviderProps) {
489
505
  useDuplicateProviderGuard()
490
506
  useHostAttribute()
507
+ // Applied during render so the first formatted child already sees it; only when a prop changed,
508
+ // and only the props received (an unset one leaves an earlier value or a manual `defineFormat`).
509
+ const appliedFormat = useRef<FormatDefaults>({})
510
+ if (appliedFormat.current.locale !== locale || appliedFormat.current.timeZone !== timeZone) {
511
+ appliedFormat.current = { locale, timeZone }
512
+ defineFormat({ locale, timeZone })
513
+ }
491
514
 
492
515
  // The sink is read through a ref, so an inline `telemetry` function does not re-subscribe.
493
516
  const sink = telemetry ?? (process.env.NODE_ENV === 'production' ? undefined : devConsoleSink)
@@ -1,27 +0,0 @@
1
- /**
2
- * formatRelativeTime — dependency-free relative-time formatting (no date-fns).
3
- *
4
- * Shared between `ThreadOutcomeCard` (inbox row timestamps) and `ThreadTranscript` (per-message
5
- * timestamps). 'en'-hardcoded for now — see the module-level note below for the deferred locale
6
- * seam.
7
- *
8
- * Internal to `agent-chat/` — not part of the public barrel.
9
- */
10
- /**
11
- * Formats an epoch-ms timestamp as a short relative string ("3 hours ago", "just now").
12
- *
13
- * A non-finite `timestamp` — `NaN`, `±Infinity`, or a non-number value that slipped past the
14
- * `ChatMessage.createdAt: number` type at runtime (an ISO string or `undefined`/`null` from a
15
- * hand-rolled `ThreadsStoreAdapter`, or from JSON-deserialized `localStorage` state) renders as an
16
- * empty string rather than reaching `Intl.RelativeTimeFormat.format`, which throws a `RangeError`
17
- * on any non-finite input. This is render-path code — one bad `createdAt` on one message must not
18
- * blank the whole transcript (the standing rule `spliceText`/`coalesceParts` already hold) — so it
19
- * degrades instead of throwing, and warns in dev, matching `mergePart`'s clamp-and-warn precedent
20
- * (`clampOffset` in `../agent/merge.ts`). The warning is NOT deduplicated, also matching that
21
- * precedent — but note the call sites differ: `clampOffset` runs once per wire event, whereas this
22
- * runs during render, once per message, so a single bad `createdAt` in a long transcript warns
23
- * once per message per render. That is loud on purpose (a `createdAt` that isn't a number is an
24
- * adapter bug worth fixing, not worth muting), and it costs nothing in production.
25
- */
26
- export declare function formatRelativeTime(timestamp: number): string;
27
- //# sourceMappingURL=relative-time.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"relative-time.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/relative-time.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgBH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAc5D"}
@@ -1,27 +0,0 @@
1
- const RELATIVE_TIME_FORMAT = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
2
- const RELATIVE_TIME_UNITS = [
3
- { unit: "year", ms: 31536e6 },
4
- { unit: "month", ms: 2628e6 },
5
- { unit: "week", ms: 6048e5 },
6
- { unit: "day", ms: 864e5 },
7
- { unit: "hour", ms: 36e5 },
8
- { unit: "minute", ms: 6e4 }
9
- ];
10
- function formatRelativeTime(timestamp) {
11
- if (!Number.isFinite(timestamp)) {
12
- if (process.env.NODE_ENV !== "production") {
13
- console.warn(
14
- `[basalt] formatRelativeTime: non-finite timestamp ${String(timestamp)} \u2014 rendering empty string`
15
- );
16
- }
17
- return "";
18
- }
19
- const diffMs = timestamp - Date.now();
20
- const absMs = Math.abs(diffMs);
21
- if (absMs < 6e4) return "just now";
22
- const unit = RELATIVE_TIME_UNITS.find(({ ms }) => absMs >= ms) ?? RELATIVE_TIME_UNITS.at(-1);
23
- return RELATIVE_TIME_FORMAT.format(Math.round(diffMs / unit.ms), unit.unit);
24
- }
25
- export {
26
- formatRelativeTime
27
- };
@@ -1,55 +0,0 @@
1
- /**
2
- * formatRelativeTime — dependency-free relative-time formatting (no date-fns).
3
- *
4
- * Shared between `ThreadOutcomeCard` (inbox row timestamps) and `ThreadTranscript` (per-message
5
- * timestamps). 'en'-hardcoded for now — see the module-level note below for the deferred locale
6
- * seam.
7
- *
8
- * Internal to `agent-chat/` — not part of the public barrel.
9
- */
10
-
11
- const RELATIVE_TIME_FORMAT = new Intl.RelativeTimeFormat('en', { numeric: 'auto' })
12
-
13
- const RELATIVE_TIME_UNITS: readonly {
14
- readonly unit: Intl.RelativeTimeFormatUnit
15
- readonly ms: number
16
- }[] = [
17
- { unit: 'year', ms: 31_536_000_000 },
18
- { unit: 'month', ms: 2_628_000_000 },
19
- { unit: 'week', ms: 604_800_000 },
20
- { unit: 'day', ms: 86_400_000 },
21
- { unit: 'hour', ms: 3_600_000 },
22
- { unit: 'minute', ms: 60_000 },
23
- ]
24
-
25
- /**
26
- * Formats an epoch-ms timestamp as a short relative string ("3 hours ago", "just now").
27
- *
28
- * A non-finite `timestamp` — `NaN`, `±Infinity`, or a non-number value that slipped past the
29
- * `ChatMessage.createdAt: number` type at runtime (an ISO string or `undefined`/`null` from a
30
- * hand-rolled `ThreadsStoreAdapter`, or from JSON-deserialized `localStorage` state) renders as an
31
- * empty string rather than reaching `Intl.RelativeTimeFormat.format`, which throws a `RangeError`
32
- * on any non-finite input. This is render-path code — one bad `createdAt` on one message must not
33
- * blank the whole transcript (the standing rule `spliceText`/`coalesceParts` already hold) — so it
34
- * degrades instead of throwing, and warns in dev, matching `mergePart`'s clamp-and-warn precedent
35
- * (`clampOffset` in `../agent/merge.ts`). The warning is NOT deduplicated, also matching that
36
- * precedent — but note the call sites differ: `clampOffset` runs once per wire event, whereas this
37
- * runs during render, once per message, so a single bad `createdAt` in a long transcript warns
38
- * once per message per render. That is loud on purpose (a `createdAt` that isn't a number is an
39
- * adapter bug worth fixing, not worth muting), and it costs nothing in production.
40
- */
41
- export function formatRelativeTime(timestamp: number): string {
42
- if (!Number.isFinite(timestamp)) {
43
- if (process.env.NODE_ENV !== 'production') {
44
- console.warn(
45
- `[basalt] formatRelativeTime: non-finite timestamp ${String(timestamp)} — rendering empty string`,
46
- )
47
- }
48
- return ''
49
- }
50
- const diffMs = timestamp - Date.now()
51
- const absMs = Math.abs(diffMs)
52
- if (absMs < 60_000) return 'just now'
53
- const unit = RELATIVE_TIME_UNITS.find(({ ms }) => absMs >= ms) ?? RELATIVE_TIME_UNITS.at(-1)!
54
- return RELATIVE_TIME_FORMAT.format(Math.round(diffMs / unit.ms), unit.unit)
55
- }