basalt-ui 2.13.2 → 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.
- package/CHANGELOG.md +34 -0
- package/MIGRATING.md +40 -12
- package/dist/agent/chat/thread-feed-row.d.ts.map +1 -1
- package/dist/agent/chat/thread-feed-row.js +2 -2
- package/dist/agent/chat/thread-message.d.ts.map +1 -1
- package/dist/agent/chat/thread-message.js +2 -2
- package/dist/agent/chat/thread-outcome-card.js +2 -2
- package/dist/charts/DualPanel.d.ts.map +1 -1
- package/dist/charts/DualPanel.js +1 -0
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +3 -2
- package/dist/charts/cursor.d.ts +10 -6
- package/dist/charts/cursor.d.ts.map +1 -1
- package/dist/charts/cursor.js +20 -13
- package/dist/charts/legend.d.ts +5 -4
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +3 -3
- package/dist/charts/panel.d.ts +2 -0
- package/dist/charts/panel.d.ts.map +1 -1
- package/dist/charts/panel.js +1 -0
- package/dist/commands/notifications/center.d.ts.map +1 -1
- package/dist/commands/notifications/center.js +2 -11
- package/dist/controls/control-name.d.ts +27 -0
- package/dist/controls/control-name.d.ts.map +1 -0
- package/dist/controls/control-name.js +11 -0
- package/dist/controls/enum-filter.d.ts +3 -6
- package/dist/controls/enum-filter.d.ts.map +1 -1
- package/dist/controls/enum-filter.js +8 -4
- package/dist/controls/filter-base.d.ts +30 -0
- package/dist/controls/filter-base.d.ts.map +1 -0
- package/dist/controls/filter-base.js +0 -0
- package/dist/controls/filter-pill.d.ts +3 -1
- package/dist/controls/filter-pill.d.ts.map +1 -1
- package/dist/controls/filter-pill.js +2 -0
- package/dist/controls/filter-sheet.d.ts +0 -32
- package/dist/controls/filter-sheet.d.ts.map +1 -1
- package/dist/controls/filter-sheet.js +1 -28
- package/dist/controls/glyphs.d.ts +12 -0
- package/dist/controls/glyphs.d.ts.map +1 -1
- package/dist/controls/glyphs.js +23 -2
- package/dist/controls/index.d.ts +2 -1
- package/dist/controls/index.d.ts.map +1 -1
- package/dist/controls/multi-select-filter.d.ts +8 -3
- package/dist/controls/multi-select-filter.d.ts.map +1 -1
- package/dist/controls/multi-select-filter.js +27 -10
- package/dist/controls/number-filter.d.ts +3 -12
- package/dist/controls/number-filter.d.ts.map +1 -1
- package/dist/controls/number-filter.js +17 -6
- package/dist/controls/panel-row.d.ts +5 -8
- package/dist/controls/panel-row.d.ts.map +1 -1
- package/dist/controls/panel-row.js +3 -0
- package/dist/controls/range-filter.d.ts +14 -14
- package/dist/controls/range-filter.d.ts.map +1 -1
- package/dist/controls/range-filter.js +18 -41
- package/dist/controls/search-filter.d.ts +5 -2
- package/dist/controls/search-filter.d.ts.map +1 -1
- package/dist/controls/search-filter.js +74 -40
- package/dist/controls/select-filter.d.ts +2 -15
- package/dist/controls/select-filter.d.ts.map +1 -1
- package/dist/controls/sync-button.d.ts +0 -6
- package/dist/controls/sync-button.d.ts.map +1 -1
- package/dist/controls/sync-button.js +6 -36
- package/dist/controls/toggle-filter.d.ts +2 -2
- package/dist/controls/toggle-filter.d.ts.map +1 -1
- package/dist/controls/toggle-filter.js +3 -2
- package/dist/controls/view-tabs.d.ts +3 -4
- package/dist/controls/view-tabs.d.ts.map +1 -1
- package/dist/controls/view-tabs.js +24 -5
- package/dist/format/date.d.ts +43 -10
- package/dist/format/date.d.ts.map +1 -1
- package/dist/format/date.js +109 -18
- package/dist/format/index.d.ts +12 -11
- package/dist/format/index.d.ts.map +1 -1
- package/dist/format/index.js +11 -2
- package/dist/format/measure.d.ts +9 -9
- package/dist/format/measure.d.ts.map +1 -1
- package/dist/format/measure.js +19 -8
- package/dist/format/number.d.ts +35 -27
- package/dist/format/number.d.ts.map +1 -1
- package/dist/format/number.js +41 -20
- package/dist/format/shared.d.ts +38 -7
- package/dist/format/shared.d.ts.map +1 -1
- package/dist/format/shared.js +61 -13
- package/dist/provider/create-router.d.ts +9 -4
- package/dist/provider/create-router.d.ts.map +1 -1
- package/dist/provider/create-router.js +1 -19
- package/dist/provider/error-fallback.module.css +4 -15
- package/dist/provider/error-fallback.module.css.d.ts +0 -1
- package/dist/provider/fallback.module.css +37 -0
- package/dist/provider/fallback.module.css.d.ts +11 -0
- package/dist/provider/index.d.ts +13 -1
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +10 -1
- package/dist/provider/route-defaults.d.ts +10 -0
- package/dist/provider/route-defaults.d.ts.map +1 -0
- package/dist/provider/route-defaults.js +25 -0
- package/dist/provider/route-defaults.module.css +39 -0
- package/dist/provider/route-defaults.module.css.d.ts +10 -0
- package/llms.txt +35 -14
- package/package.json +1 -1
- package/src/agent/chat/thread-feed-row.tsx +2 -2
- package/src/agent/chat/thread-message.tsx +2 -2
- package/src/agent/chat/thread-outcome-card.tsx +2 -2
- package/src/charts/DualPanel.tsx +1 -0
- package/src/charts/compile.ts +3 -2
- package/src/charts/cursor.ts +44 -27
- package/src/charts/legend.tsx +9 -6
- package/src/charts/panel.tsx +3 -0
- package/src/commands/notifications/center.tsx +2 -14
- package/src/controls/control-name.ts +33 -0
- package/src/controls/enum-filter.tsx +29 -27
- package/src/controls/filter-base.ts +31 -0
- package/src/controls/filter-pill.tsx +4 -0
- package/src/controls/filter-sheet.tsx +0 -56
- package/src/controls/glyphs.tsx +45 -2
- package/src/controls/index.ts +2 -1
- package/src/controls/multi-select-filter.tsx +67 -43
- package/src/controls/number-filter.tsx +47 -47
- package/src/controls/panel-row.tsx +7 -8
- package/src/controls/range-filter.tsx +54 -78
- package/src/controls/search-filter.tsx +107 -54
- package/src/controls/select-filter.tsx +2 -18
- package/src/controls/sync-button.tsx +7 -40
- package/src/controls/toggle-filter.tsx +9 -7
- package/src/controls/view-tabs.tsx +41 -21
- package/src/format/date.ts +189 -36
- package/src/format/index.ts +12 -11
- package/src/format/measure.ts +29 -18
- package/src/format/number.ts +76 -37
- package/src/format/shared.ts +116 -25
- package/src/provider/create-router.tsx +2 -36
- package/src/provider/error-fallback.module.css +4 -15
- package/src/provider/error-fallback.module.css.d.ts +0 -1
- package/src/provider/fallback.module.css +37 -0
- package/src/provider/fallback.module.css.d.ts +11 -0
- package/src/provider/index.tsx +25 -1
- package/src/provider/route-defaults.module.css +39 -0
- package/src/provider/route-defaults.module.css.d.ts +10 -0
- package/src/provider/route-defaults.tsx +39 -0
- package/dist/agent/chat/relative-time.d.ts +0 -27
- package/dist/agent/chat/relative-time.d.ts.map +0 -1
- package/dist/agent/chat/relative-time.js +0 -27
- package/src/agent/chat/relative-time.ts +0 -55
|
@@ -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
|
-
}
|