basalt-ui 2.13.3 → 2.15.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 +66 -0
- package/MIGRATING.md +42 -12
- package/agent/agents/basalt-design-reviewer.md +83 -0
- package/agent/rules/basalt-batteries.md +1 -2
- package/agent/rules/basalt-charts.md +1 -1
- package/agent/rules/basalt-controls.md +3 -3
- package/agent/rules/basalt-mantine.md +1 -2
- package/agent/rules/basalt-state.md +1 -2
- package/agent/rules/basalt-tokens.md +1 -3
- package/agent/skills/basalt-design/SKILL.md +26 -8
- package/agent/templates/AGENTS-block.md.tpl +7 -0
- package/configs/oxlint-plugin.js +39 -2
- package/configs/oxlint-plugin.test.ts +48 -0
- 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 +7 -6
- 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/cli/board-freshness.d.ts +25 -0
- package/dist/cli/board-freshness.d.ts.map +1 -0
- package/dist/cli/board-freshness.js +88 -0
- package/dist/cli/doctor.d.ts +2 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +3 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +9 -3
- package/dist/cli/index.d.ts +15 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +57 -7
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +6 -1
- package/dist/cli/shot/board.d.ts +5 -0
- package/dist/cli/shot/board.d.ts.map +1 -0
- package/dist/cli/shot/board.js +96 -0
- package/dist/cli/shot/capture.d.ts +59 -0
- package/dist/cli/shot/capture.d.ts.map +1 -0
- package/dist/cli/shot/capture.js +473 -0
- package/dist/cli/shot/index.d.ts +45 -0
- package/dist/cli/shot/index.d.ts.map +1 -0
- package/dist/cli/shot/index.js +289 -0
- package/dist/cli/shot/measure.d.ts +28 -0
- package/dist/cli/shot/measure.d.ts.map +1 -0
- package/dist/cli/shot/measure.js +176 -0
- package/dist/cli/shot/playwright.d.ts +101 -0
- package/dist/cli/shot/playwright.d.ts.map +1 -0
- package/dist/cli/shot/playwright.js +60 -0
- package/dist/cli/shot/serve.d.ts +6 -0
- package/dist/cli/shot/serve.d.ts.map +1 -0
- package/dist/cli/shot/serve.js +33 -0
- package/dist/cli/shot/types.d.ts +97 -0
- package/dist/cli/shot/types.d.ts.map +1 -0
- package/dist/cli/shot/types.js +17 -0
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +2 -1
- 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/index.d.ts +13 -1
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +8 -0
- package/dist/surfaces.d.ts +2 -0
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +2 -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 +11 -8
- package/src/charts/panel.tsx +3 -0
- package/src/cli/board-freshness.ts +132 -0
- package/src/cli/doctor.ts +10 -1
- package/src/cli/help.ts +14 -2
- package/src/cli/index.ts +80 -10
- package/src/cli/init.ts +8 -1
- package/src/cli/shot/board.ts +154 -0
- package/src/cli/shot/capture.ts +650 -0
- package/src/cli/shot/index.ts +362 -0
- package/src/cli/shot/measure.ts +225 -0
- package/src/cli/shot/playwright.ts +152 -0
- package/src/cli/shot/serve.ts +35 -0
- package/src/cli/shot/types.ts +91 -0
- package/src/cli/sync.ts +2 -1
- 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/index.tsx +23 -0
- package/src/surfaces.ts +5 -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
package/dist/format/shared.js
CHANGED
|
@@ -1,21 +1,65 @@
|
|
|
1
1
|
const NON_FINITE = "\u2014";
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
const numberCaches = /* @__PURE__ */ new Map();
|
|
3
|
+
const dateCaches = /* @__PURE__ */ new Map();
|
|
4
|
+
let defaults = {};
|
|
5
|
+
function defineFormat(next = {}) {
|
|
6
|
+
const merged = {
|
|
7
|
+
locale: next.locale ?? defaults.locale,
|
|
8
|
+
timeZone: next.timeZone ?? defaults.timeZone
|
|
9
|
+
};
|
|
10
|
+
if (merged.locale === defaults.locale && merged.timeZone === defaults.timeZone) return;
|
|
11
|
+
defaults = merged;
|
|
12
|
+
numberCaches.clear();
|
|
13
|
+
dateCaches.clear();
|
|
14
|
+
}
|
|
15
|
+
function resetFormatDefaults() {
|
|
16
|
+
defaults = {};
|
|
17
|
+
numberCaches.clear();
|
|
18
|
+
dateCaches.clear();
|
|
19
|
+
}
|
|
20
|
+
function optionsKey(options) {
|
|
21
|
+
let key = "";
|
|
22
|
+
for (const [name, value] of Object.entries(options).sort(([a], [b]) => a < b ? -1 : 1)) {
|
|
23
|
+
key += `${name}=${String(value)};`;
|
|
24
|
+
}
|
|
25
|
+
return key;
|
|
26
|
+
}
|
|
27
|
+
function memoize(caches, locale, options, create) {
|
|
28
|
+
const localeKey = locale ?? "";
|
|
29
|
+
let cache = caches.get(localeKey);
|
|
30
|
+
if (cache === void 0) {
|
|
31
|
+
cache = /* @__PURE__ */ new Map();
|
|
32
|
+
caches.set(localeKey, cache);
|
|
33
|
+
}
|
|
34
|
+
const key = optionsKey(options);
|
|
35
|
+
const cached = cache.get(key);
|
|
6
36
|
if (cached !== void 0) return cached;
|
|
7
|
-
const created =
|
|
8
|
-
|
|
37
|
+
const created = create();
|
|
38
|
+
cache.set(key, created);
|
|
9
39
|
return created;
|
|
10
40
|
}
|
|
11
|
-
|
|
41
|
+
function numberFormat(locale, options) {
|
|
42
|
+
const resolved = locale ?? defaults.locale;
|
|
43
|
+
return memoize(numberCaches, resolved, options, () => new Intl.NumberFormat(resolved, options));
|
|
44
|
+
}
|
|
12
45
|
function dateFormat(locale, options) {
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return
|
|
46
|
+
const resolved = locale ?? defaults.locale;
|
|
47
|
+
const withZone = options.timeZone === void 0 && defaults.timeZone !== void 0 ? { ...options, timeZone: defaults.timeZone } : options;
|
|
48
|
+
return memoize(dateCaches, resolved, withZone, () => new Intl.DateTimeFormat(resolved, withZone));
|
|
49
|
+
}
|
|
50
|
+
function isFiniteNumber(value) {
|
|
51
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
52
|
+
}
|
|
53
|
+
function scaleThousands(value, digits, maxUnit) {
|
|
54
|
+
let scaled = value;
|
|
55
|
+
let unit = 0;
|
|
56
|
+
while (unit < maxUnit) {
|
|
57
|
+
const factor = 10 ** (unit === 0 ? 0 : digits);
|
|
58
|
+
if (Math.round(Math.abs(scaled) * factor) / factor < 1e3) break;
|
|
59
|
+
scaled /= 1e3;
|
|
60
|
+
unit += 1;
|
|
61
|
+
}
|
|
62
|
+
return { scaled, unit };
|
|
19
63
|
}
|
|
20
64
|
function toDate(value) {
|
|
21
65
|
const date = value instanceof Date ? value : new Date(value);
|
|
@@ -24,6 +68,10 @@ function toDate(value) {
|
|
|
24
68
|
export {
|
|
25
69
|
NON_FINITE,
|
|
26
70
|
dateFormat,
|
|
71
|
+
defineFormat,
|
|
72
|
+
isFiniteNumber,
|
|
27
73
|
numberFormat,
|
|
74
|
+
resetFormatDefaults,
|
|
75
|
+
scaleThousands,
|
|
28
76
|
toDate
|
|
29
77
|
};
|
package/dist/provider/index.d.ts
CHANGED
|
@@ -53,6 +53,18 @@ type BasaltProviderCommonProps = {
|
|
|
53
53
|
* action wiring mounts.
|
|
54
54
|
*/
|
|
55
55
|
spotlight?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Default BCP-47 locale for every `basalt-ui/format` formatter that gets no per-call `locale`
|
|
58
|
+
* (`integer(1112)` → `1,112` under `en-US`). App-level config, static for the provider's
|
|
59
|
+
* lifetime: it sets ONE module-global default per process (formatters are plain functions, not
|
|
60
|
+
* hooks) and a per-call `locale` is the override. An unset prop LEAVES the current default in
|
|
61
|
+
* place (it never resets it), and changing the prop at runtime does not re-render formatted
|
|
62
|
+
* children.
|
|
63
|
+
*/
|
|
64
|
+
locale?: string;
|
|
65
|
+
/** Default IANA time zone for the date/time formatters; same lifecycle as `locale`. Unset leaves
|
|
66
|
+
* the current default (initially the runtime's zone). */
|
|
67
|
+
timeZone?: string;
|
|
56
68
|
} & Omit<MantineProviderProps, 'children' | 'theme' | 'defaultColorScheme' | 'cssVariablesResolver'>;
|
|
57
69
|
/**
|
|
58
70
|
* Two modes, never both: pass a `createBasaltRouter` `router` and the provider mounts it, or pass
|
|
@@ -103,6 +115,6 @@ export declare function composeInjectedCss(base: string, fontsCss: string, radiu
|
|
|
103
115
|
* closes the gap between hydration and the next client paint.
|
|
104
116
|
*/
|
|
105
117
|
export declare function useHostAttribute(): void;
|
|
106
|
-
export declare function BasaltProvider({ theme, telemetry, fallback, injectPalette, paletteOptions, defaultColorScheme, nonce, sizeClassHint, navCommandLabel, spotlight, router: mountedRouter, children, ...rest }: BasaltProviderProps): import("react").JSX.Element;
|
|
118
|
+
export declare function BasaltProvider({ theme, telemetry, fallback, injectPalette, paletteOptions, defaultColorScheme, nonce, sizeClassHint, navCommandLabel, spotlight, locale, timeZone, router: mountedRouter, children, ...rest }: BasaltProviderProps): import("react").JSX.Element;
|
|
107
119
|
export {};
|
|
108
120
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/provider/index.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAMzD,OAAO,EAAE,SAAS,EAAwD,MAAM,OAAO,CAAA;AACvF,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/provider/index.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAMzD,OAAO,EAAE,SAAS,EAAwD,MAAM,OAAO,CAAA;AACvF,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAUtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAUxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,KAAK,EAAE,YAAY,EAAuB,MAAM,iBAAiB,CAAA;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAI/D,KAAK,yBAAyB,GAAG;IAC/B,qFAAqF;IACrF,KAAK,CAAC,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAA;IACrC;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,yGAAyG;IACzG,QAAQ,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE,OAAO,K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KAAK,EAAE,iBAAiB;IAKpC,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa;IAIrD,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI;IAczD,MAAM,IAAI,SAAS;CAO7B;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,MAAM,CAER;AAYD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAmBvC;AAuOD,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,SAAS,EACT,QAAQ,EACR,aAAoB,EACpB,cAAc,EACd,kBAA2B,EAC3B,KAAK,EACL,aAAyB,EACzB,eAAe,EACf,SAAgB,EAChB,MAAM,EACN,QAAQ,EACR,MAAM,EAAE,aAAa,EACrB,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,mBAAmB,+BAsErB"}
|
package/dist/provider/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import { buildPaletteData } from "../tokens/palette.js";
|
|
|
14
14
|
import { useMediaQuery } from "../common/use-media-query.js";
|
|
15
15
|
import { registerColorSchemeSetter } from "../commands/shell-bridge.js";
|
|
16
16
|
import { useIsomorphicLayoutEffect } from "../common/isomorphic-layout-effect.js";
|
|
17
|
+
import { defineFormat } from "../format/shared.js";
|
|
17
18
|
import { PageTitle } from "../shell/page-title.js";
|
|
18
19
|
import { SizeClassHintContext } from "../shell/use-size-class.js";
|
|
19
20
|
import {
|
|
@@ -272,12 +273,19 @@ function BasaltProvider({
|
|
|
272
273
|
sizeClassHint = "compact",
|
|
273
274
|
navCommandLabel,
|
|
274
275
|
spotlight = true,
|
|
276
|
+
locale,
|
|
277
|
+
timeZone,
|
|
275
278
|
router: mountedRouter,
|
|
276
279
|
children,
|
|
277
280
|
...rest
|
|
278
281
|
}) {
|
|
279
282
|
useDuplicateProviderGuard();
|
|
280
283
|
useHostAttribute();
|
|
284
|
+
const appliedFormat = useRef({});
|
|
285
|
+
if (appliedFormat.current.locale !== locale || appliedFormat.current.timeZone !== timeZone) {
|
|
286
|
+
appliedFormat.current = { locale, timeZone };
|
|
287
|
+
defineFormat({ locale, timeZone });
|
|
288
|
+
}
|
|
281
289
|
const sink = telemetry ?? (process.env.NODE_ENV === "production" ? void 0 : devConsoleSink);
|
|
282
290
|
const sinkRef = useRef(sink);
|
|
283
291
|
useEffect(() => {
|
package/dist/surfaces.d.ts
CHANGED
|
@@ -379,6 +379,8 @@ export declare const RULE_NAMES: readonly RuleName[];
|
|
|
379
379
|
* SKILL_NAMES.includes('basalt-design') // true
|
|
380
380
|
*/
|
|
381
381
|
export declare const SKILL_NAMES: readonly SkillName[];
|
|
382
|
+
/** The shipped subagents (`agent/agents/<name>.md`), installed at `.claude/agents/`. */
|
|
383
|
+
export declare const AGENT_NAMES: readonly ["basalt-design-reviewer"];
|
|
382
384
|
/**
|
|
383
385
|
* Headless SURFACES keys whose Mantine-free guarantee is enforced by the `basalt/token-layer-
|
|
384
386
|
* boundary` oxlint plugin rule (`configs/oxlint-plugin.js`) instead of a `forbiddenImports`
|
package/dist/surfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surfaces.d.ts","sourceRoot":"","sources":["../src/surfaces.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAI9C;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,WAAW,CAAA;AAE3F;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,mkBA2BtB,CAAA;AAEV,+FAA+F;AAC/F,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,mBAA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,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACzC,OAAO,CAET"}
|
package/dist/surfaces.js
CHANGED
|
@@ -420,11 +420,13 @@ const SKILL_NAMES = [
|
|
|
420
420
|
Object.values(SURFACES).filter((s) => s.kind === "doctrine").flatMap((s) => [...s.skill])
|
|
421
421
|
)
|
|
422
422
|
];
|
|
423
|
+
const AGENT_NAMES = ["basalt-design-reviewer"];
|
|
423
424
|
const TOKEN_LAYER_BOUNDARY_SURFACES = /* @__PURE__ */ new Set(["./charts", "./tokens"]);
|
|
424
425
|
function hasTokenLayerBoundaryRegistered(rules) {
|
|
425
426
|
return rules?.["basalt/token-layer-boundary"] === "error";
|
|
426
427
|
}
|
|
427
428
|
export {
|
|
429
|
+
AGENT_NAMES,
|
|
428
430
|
PLUGIN_RULE_ID_LIST,
|
|
429
431
|
RULE_NAMES,
|
|
430
432
|
SKILL_NAMES,
|
package/llms.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# basalt-ui v2.
|
|
1
|
+
# basalt-ui v2.15.0
|
|
2
2
|
# Opinionated framework for Mantine-based React apps — theme, app shell, TanStack Charts, toolchain presets
|
|
3
3
|
#
|
|
4
4
|
# Entry points: use the exact import specifier below; do not guess.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# A subpath's `Install:` line is its required peers; `OptionalPeers:` are import()-only, install on use.
|
|
14
14
|
|
|
15
15
|
Package: basalt-ui
|
|
16
|
-
Version: 2.
|
|
16
|
+
Version: 2.15.0
|
|
17
17
|
|
|
18
18
|
## basalt-ui
|
|
19
19
|
Import: import { ... } from 'basalt-ui'
|
|
@@ -32,6 +32,8 @@ Signature: BasaltProvider(props: BasaltProviderProps): JSX.Element
|
|
|
32
32
|
sizeClassHint?: "compact" | "medium" | "expanded"
|
|
33
33
|
navCommandLabel?: (item: FlatNavItem) => string
|
|
34
34
|
spotlight?: boolean
|
|
35
|
+
locale?: string
|
|
36
|
+
timeZone?: string
|
|
35
37
|
router: BasaltRouter
|
|
36
38
|
children: ReactNode
|
|
37
39
|
Signature: BasaltShell(props: BasaltShellProps<G, T>): JSX.Element
|
|
@@ -516,13 +518,23 @@ OptionalPeers: vite-plugin-pwa@^1.3.0
|
|
|
516
518
|
Import: import { ... } from 'basalt-ui/format'
|
|
517
519
|
Description: integer/money/percent/durationClock/relativeTime/weekday/km/kcal — Intl-backed, Mantine-free, React-free formatting; the chart layer formats through the same implementation
|
|
518
520
|
Layer: headless
|
|
521
|
+
Signature: bytes(value: Numeric, options: BytesOptions): string
|
|
522
|
+
Signature: compact(value: Numeric, options: CompactOptions): string
|
|
523
|
+
Signature: date(value: DateInput, options: DateOptions): string
|
|
524
|
+
Signature: dateTime(value: DateInput, options: DateOptions): string
|
|
525
|
+
Signature: defineFormat(next: FormatDefaults): void
|
|
526
|
+
locale?: string
|
|
527
|
+
timeZone?: string
|
|
528
|
+
Signature: delta(value: Numeric, options: DeltaOptions): string
|
|
529
|
+
Signature: duration(seconds: number | null | undefined, options: DurationOptions): string
|
|
519
530
|
Signature: durationClock(seconds: number): string
|
|
520
|
-
Signature: integer(value:
|
|
521
|
-
Signature: kcal(value:
|
|
522
|
-
Signature: km(meters:
|
|
523
|
-
Signature: money(value:
|
|
524
|
-
Signature: percent(value:
|
|
525
|
-
Signature: relativeTime(value:
|
|
531
|
+
Signature: integer(value: Numeric, options: LocaleOption): string
|
|
532
|
+
Signature: kcal(value: Numeric, options: KcalOptions): string
|
|
533
|
+
Signature: km(meters: Numeric, options: KmOptions): string
|
|
534
|
+
Signature: money(value: Numeric, options: MoneyOptions): string
|
|
535
|
+
Signature: percent(value: Numeric, options: PercentOptions): string
|
|
536
|
+
Signature: relativeTime(value: DateInput, options: RelativeTimeOptions): string
|
|
537
|
+
Signature: time(value: DateInput, options: DateOptions): string
|
|
526
538
|
Signature: weekday(value: string | number | Date, options: WeekdayOptions): string
|
|
527
539
|
|
|
528
540
|
## basalt-ui/forms
|
|
@@ -809,9 +821,11 @@ Signature: MultiSelectFilter(props: MultiSelectFilterProps<T>): ReactNode
|
|
|
809
821
|
value?: never
|
|
810
822
|
onChange?: never
|
|
811
823
|
size?: never
|
|
812
|
-
field: FieldHandle<MultiField<T>>
|
|
813
824
|
label: string
|
|
814
825
|
icon?: ReactNode
|
|
826
|
+
clearable?: boolean
|
|
827
|
+
disabled?: boolean
|
|
828
|
+
field: FieldHandle<MultiField<T>>
|
|
815
829
|
noun?: string
|
|
816
830
|
options?: readonly FilterOption[]
|
|
817
831
|
counts?: Record<string, number>
|
|
@@ -822,21 +836,23 @@ Signature: NumberFilter(props: NumberFilterProps): ReactNode
|
|
|
822
836
|
value?: never
|
|
823
837
|
onChange?: never
|
|
824
838
|
size?: never
|
|
825
|
-
field: FieldHandle<NumberField>
|
|
826
839
|
label: string
|
|
827
840
|
icon?: ReactNode
|
|
828
|
-
options?: readonly NumberFilterOption[]
|
|
829
|
-
step?: number
|
|
830
841
|
clearable?: boolean
|
|
842
|
+
disabled?: boolean
|
|
843
|
+
field: FieldHandle<NumberField>
|
|
844
|
+
options?: readonly FilterOption<number>[]
|
|
845
|
+
step?: number
|
|
831
846
|
Signature: RangeFilter(props: RangeFilterProps<P, C>): ReactNode
|
|
832
847
|
className?: string
|
|
833
848
|
style?: CSSProperties
|
|
834
849
|
value?: never
|
|
835
850
|
onChange?: never
|
|
836
851
|
size?: never
|
|
837
|
-
field: FieldHandle<RangeField<P, C>>
|
|
838
852
|
icon?: ReactNode
|
|
853
|
+
disabled?: boolean
|
|
839
854
|
label?: string
|
|
855
|
+
field: FieldHandle<RangeField<P, C>>
|
|
840
856
|
customPicker?: ComponentType<RangeCustomPickerProps>
|
|
841
857
|
Signature: SearchFilter(props: SearchFilterProps): ReactNode
|
|
842
858
|
className?: string
|
|
@@ -844,9 +860,11 @@ Signature: SearchFilter(props: SearchFilterProps): ReactNode
|
|
|
844
860
|
value?: never
|
|
845
861
|
onChange?: never
|
|
846
862
|
size?: never
|
|
863
|
+
disabled?: boolean
|
|
847
864
|
field: FieldHandle<StringField>
|
|
848
865
|
placeholder?: string
|
|
849
866
|
label?: string
|
|
867
|
+
clearable?: boolean
|
|
850
868
|
Signature: SelectFilter(props: SelectFilterEnumProps<T>): ReactNode
|
|
851
869
|
className?: string
|
|
852
870
|
style?: CSSProperties
|
|
@@ -856,6 +874,7 @@ Signature: SelectFilter(props: SelectFilterEnumProps<T>): ReactNode
|
|
|
856
874
|
label: string
|
|
857
875
|
icon?: ReactNode
|
|
858
876
|
clearable?: boolean
|
|
877
|
+
disabled?: boolean
|
|
859
878
|
field: FieldHandle<EnumField<T>>
|
|
860
879
|
options?: readonly FilterOption[]
|
|
861
880
|
Signature: SyncButton(props: SyncButtonProps): ReactNode
|
|
@@ -873,15 +892,17 @@ Signature: ToggleFilter(props: ToggleFilterProps): ReactNode
|
|
|
873
892
|
value?: never
|
|
874
893
|
onChange?: never
|
|
875
894
|
size?: never
|
|
876
|
-
field: FieldHandle<BooleanField>
|
|
877
895
|
label: string
|
|
878
896
|
icon?: ReactNode
|
|
897
|
+
disabled?: boolean
|
|
898
|
+
field: FieldHandle<BooleanField>
|
|
879
899
|
Signature: ViewTabs(props: ViewTabsProps<T>): ReactNode
|
|
880
900
|
className?: string
|
|
881
901
|
style?: CSSProperties
|
|
882
902
|
value?: never
|
|
883
903
|
onChange?: never
|
|
884
904
|
size?: never
|
|
905
|
+
disabled?: boolean
|
|
885
906
|
field: FieldHandle<EnumField<T>>
|
|
886
907
|
options?: readonly ViewTabsOption<T>[]
|
|
887
908
|
label?: string
|
package/package.json
CHANGED
|
@@ -43,11 +43,11 @@ import { BasaltStickToBottom } from '../stick-to-bottom'
|
|
|
43
43
|
import { cx } from '../../common/props'
|
|
44
44
|
import type { BasaltProps, SlotStylesProps } from '../../common/props'
|
|
45
45
|
import { assertRequiredProps } from '../../common/validate'
|
|
46
|
+
import { relativeTime } from '../../format'
|
|
46
47
|
import { VX } from '../../tokens'
|
|
47
48
|
import type { ComposerProps, ComposerSubmit } from './composer'
|
|
48
49
|
import { Composer } from './composer'
|
|
49
50
|
import type { MessageAffordances } from './message-affordances'
|
|
50
|
-
import { formatRelativeTime } from './relative-time'
|
|
51
51
|
import { ThreadTranscript } from './thread-message'
|
|
52
52
|
import { resolveRowHeight } from './virtualize'
|
|
53
53
|
import type { RowHeightProps, VirtualizeProps } from './virtualize'
|
|
@@ -309,7 +309,7 @@ export function ThreadFeedRow(props: ThreadFeedRowProps): JSX.Element {
|
|
|
309
309
|
flexShrink: 0,
|
|
310
310
|
}}
|
|
311
311
|
>
|
|
312
|
-
{
|
|
312
|
+
{relativeTime(thread.updatedAt)}
|
|
313
313
|
</Text>
|
|
314
314
|
<ChevronGlyph expanded={expanded} />
|
|
315
315
|
</Group>
|
|
@@ -53,10 +53,10 @@ import type { BasaltProps } from '../../common/props'
|
|
|
53
53
|
import { assertRequiredProps } from '../../common/validate'
|
|
54
54
|
import { Markdown } from '../../content/markdown'
|
|
55
55
|
import { CopyAction } from '../../content/copy-action'
|
|
56
|
+
import { relativeTime } from '../../format'
|
|
56
57
|
import { VX } from '../../tokens'
|
|
57
58
|
import { DEFAULT_AFFORDANCES } from './message-affordances'
|
|
58
59
|
import type { MessageAffordances } from './message-affordances'
|
|
59
|
-
import { formatRelativeTime } from './relative-time'
|
|
60
60
|
import { ToolChip } from './tool-chip'
|
|
61
61
|
import { resolveVirtualize } from './virtualize'
|
|
62
62
|
import type { VirtualizeOptions, VirtualizeProps } from './virtualize'
|
|
@@ -345,7 +345,7 @@ function MessageAffordanceRow({
|
|
|
345
345
|
const timestampLabel =
|
|
346
346
|
timestampMode === 'absolute'
|
|
347
347
|
? new Date(message.createdAt).toLocaleString()
|
|
348
|
-
:
|
|
348
|
+
: relativeTime(message.createdAt)
|
|
349
349
|
|
|
350
350
|
return (
|
|
351
351
|
<Group
|
|
@@ -25,8 +25,8 @@ import type { AgentThread, ThreadStatus } from '../thread'
|
|
|
25
25
|
import { assertRequiredProps } from '../../common/validate'
|
|
26
26
|
import { cx } from '../../common/props'
|
|
27
27
|
import type { BasaltProps } from '../../common/props'
|
|
28
|
+
import { relativeTime } from '../../format'
|
|
28
29
|
import { alpha, VX } from '../../tokens'
|
|
29
|
-
import { formatRelativeTime } from './relative-time'
|
|
30
30
|
|
|
31
31
|
// ── Status badge — shown ONLY for states that need a glance (attention/error). ────
|
|
32
32
|
// done/pending/streaming stay badge-free: a settled feed shouldn't be a wall of green chips —
|
|
@@ -113,7 +113,7 @@ function OutcomeBody({ thread }: { thread: AgentThread }): JSX.Element {
|
|
|
113
113
|
<Text
|
|
114
114
|
style={{ fontFamily: 'var(--basalt-font-mono)', fontSize: VX.text.micro, color: VX.faint }}
|
|
115
115
|
>
|
|
116
|
-
{
|
|
116
|
+
{relativeTime(thread.updatedAt)}
|
|
117
117
|
</Text>
|
|
118
118
|
</Stack>
|
|
119
119
|
)
|
package/src/charts/DualPanel.tsx
CHANGED
package/src/charts/compile.ts
CHANGED
|
@@ -23,7 +23,7 @@ import type {
|
|
|
23
23
|
StoredChartSpec,
|
|
24
24
|
} from '@tanstack/charts/types/core'
|
|
25
25
|
import { SHORT_CHART_HEIGHT } from './box'
|
|
26
|
-
import {
|
|
26
|
+
import { compact } from '../format/number'
|
|
27
27
|
import { VX } from '../tokens'
|
|
28
28
|
import type { ContainerClass } from '../tokens/size-classes'
|
|
29
29
|
import { cursorBinding, followerOptions, quietWhileFollowing } from './cursor'
|
|
@@ -119,7 +119,7 @@ const labelsInside = (cls: ContainerClass, height: number): boolean =>
|
|
|
119
119
|
cls === 'compact' && height > 0 && height < SHORT_CHART_HEIGHT
|
|
120
120
|
|
|
121
121
|
export function defaultNumberFormat(v: number): string {
|
|
122
|
-
return
|
|
122
|
+
return compact(v, { digits: Math.abs(v) >= 1000 ? 1 : 2 })
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
|
@@ -917,6 +917,7 @@ export function compileCartesian<T, X extends ChartX>(
|
|
|
917
917
|
group: input.cursorGroup,
|
|
918
918
|
chartId: input.chartId,
|
|
919
919
|
keys: model.values,
|
|
920
|
+
extent: model.extent,
|
|
920
921
|
mode: input.cursorResolution ?? 'nearest',
|
|
921
922
|
pin: input.coarse === true,
|
|
922
923
|
}),
|
package/src/charts/cursor.ts
CHANGED
|
@@ -128,33 +128,47 @@ export function isForeign(group: string | undefined, chartId: string): boolean {
|
|
|
128
128
|
const valueX = (state: CursorState): ChartValue | undefined =>
|
|
129
129
|
state?.anchor === 'value' ? state.value.x : undefined
|
|
130
130
|
|
|
131
|
-
/**
|
|
131
|
+
/**
|
|
132
|
+
* Snaps a foreign x value onto this chart's own x values; `null` = no snap (a string x). A value
|
|
133
|
+
* outside the rendered x extent (`extent`; a caller with none gets the keys' own) resolves to
|
|
134
|
+
* `undefined`: the chart claims no datum at an x it does not cover, so it draws neither crosshair
|
|
135
|
+
* nor dots. The edges are inside. Only keys inside the extent are candidates, so a snap never lands
|
|
136
|
+
* on a datum the chart does not render; with none inside, a snapping mode resolves to `undefined`.
|
|
137
|
+
*/
|
|
132
138
|
function snapper(
|
|
133
139
|
keys: readonly ChartX[],
|
|
134
140
|
mode: CursorResolution,
|
|
141
|
+
extent?: readonly [number, number],
|
|
135
142
|
): ((x: ChartValue) => ChartValue | undefined) | null {
|
|
136
143
|
const first = keys[0]
|
|
137
|
-
if (
|
|
138
|
-
const isDate = first instanceof Date
|
|
144
|
+
if (typeof first === 'string') return null
|
|
139
145
|
const ts = keys
|
|
140
146
|
.map((k) => (k instanceof Date ? k.getTime() : (k as number)))
|
|
141
147
|
.toSorted((a, b) => a - b)
|
|
148
|
+
const [lo, hi] = extent ?? [ts[0], ts.at(-1)]
|
|
149
|
+
if (lo === undefined || hi === undefined) return null
|
|
150
|
+
const inside = ts.filter((k) => k >= lo && k <= hi)
|
|
151
|
+
// No keys to read the x type from (an extent-only chart): either type is compared by its time.
|
|
152
|
+
const isDate = first === undefined ? undefined : first instanceof Date
|
|
142
153
|
return (x) => {
|
|
143
154
|
// Charts whose x value types differ never sync (the 1.x `DomainKind` partition).
|
|
144
|
-
if (isDate !== x instanceof Date) return undefined
|
|
145
|
-
if (!
|
|
155
|
+
if (isDate !== undefined && isDate !== x instanceof Date) return undefined
|
|
156
|
+
if (!(x instanceof Date) && typeof x !== 'number') return undefined
|
|
157
|
+
const t = x instanceof Date ? x.getTime() : x
|
|
158
|
+
if (t < lo || t > hi) return undefined
|
|
146
159
|
if (mode === 'exact') return x
|
|
147
|
-
const
|
|
148
|
-
|
|
160
|
+
const last = inside.length - 1
|
|
161
|
+
if (last < 0) return undefined
|
|
162
|
+
let i = inside.findLastIndex((k) => k <= t)
|
|
149
163
|
if (
|
|
150
164
|
mode === 'nearest' &&
|
|
151
|
-
i <
|
|
152
|
-
(i < 0 || (
|
|
165
|
+
i < last &&
|
|
166
|
+
(i < 0 || (inside[i + 1] as number) - t < t - (inside[i] as number))
|
|
153
167
|
)
|
|
154
168
|
i += 1
|
|
155
|
-
const snapped =
|
|
169
|
+
const snapped = inside[Math.max(i, 0)] as number
|
|
156
170
|
if (snapped === t) return x
|
|
157
|
-
return
|
|
171
|
+
return x instanceof Date ? new Date(snapped) : snapped
|
|
158
172
|
}
|
|
159
173
|
}
|
|
160
174
|
|
|
@@ -201,6 +215,15 @@ function snappedState(state: NonNullable<CursorState>, x: ChartValue | undefined
|
|
|
201
215
|
return { ...state, value: { ...state.value, x } }
|
|
202
216
|
}
|
|
203
217
|
|
|
218
|
+
export type CursorViewOptions = {
|
|
219
|
+
group: string | undefined
|
|
220
|
+
chartId: string
|
|
221
|
+
keys: readonly ChartX[]
|
|
222
|
+
mode: CursorResolution
|
|
223
|
+
/** The x extent the chart renders (`xDomain`, else the data's); default: the keys' own. */
|
|
224
|
+
extent?: readonly [number, number] | undefined
|
|
225
|
+
}
|
|
226
|
+
|
|
204
227
|
/**
|
|
205
228
|
* Each chart's view of its group's controller. Two jobs:
|
|
206
229
|
* - stamp what this chart publishes with its id (ownership, above);
|
|
@@ -212,13 +235,9 @@ function snappedState(state: NonNullable<CursorState>, x: ChartValue | undefined
|
|
|
212
235
|
* is dropped a microtask after its last subscription ends, or after its creation if nothing
|
|
213
236
|
* subscribed by then.
|
|
214
237
|
*/
|
|
215
|
-
export function chartCursorView(
|
|
216
|
-
group
|
|
217
|
-
|
|
218
|
-
keys: readonly ChartX[],
|
|
219
|
-
mode: CursorResolution,
|
|
220
|
-
): ChartCursorController {
|
|
221
|
-
const config: Snap = { snap: snapper(keys, mode), memo: new WeakMap() }
|
|
238
|
+
export function chartCursorView(opts: CursorViewOptions): ChartCursorController {
|
|
239
|
+
const { group, chartId } = opts
|
|
240
|
+
const config: Snap = { snap: snapper(opts.keys, opts.mode, opts.extent), memo: new WeakMap() }
|
|
222
241
|
if (isServer()) return makeView(group, chartId, () => config)
|
|
223
242
|
const id = `${group ?? 'default'}\u0000${chartId}`
|
|
224
243
|
const existing = views.get(id)
|
|
@@ -310,17 +329,15 @@ export const quietWhileFollowing: ChartTooltipExtension = {
|
|
|
310
329
|
},
|
|
311
330
|
}
|
|
312
331
|
|
|
313
|
-
export function cursorBinding(
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
pin: boolean
|
|
320
|
-
}): ChartCursorBinding {
|
|
332
|
+
export function cursorBinding(
|
|
333
|
+
opts: CursorViewOptions & {
|
|
334
|
+
/** Activation pins and unpins the cursor — on for a coarse pointer (§ 9.6: tap to pin). */
|
|
335
|
+
pin: boolean
|
|
336
|
+
},
|
|
337
|
+
): ChartCursorBinding {
|
|
321
338
|
return {
|
|
322
339
|
use: cursorHost,
|
|
323
|
-
controller: chartCursorView(opts
|
|
340
|
+
controller: chartCursorView(opts),
|
|
324
341
|
mode: 'focus',
|
|
325
342
|
match: 'x',
|
|
326
343
|
pin: opts.pin,
|
package/src/charts/legend.tsx
CHANGED
|
@@ -21,10 +21,12 @@ export type LegendMode = 'dots' | 'chips' | 'auto'
|
|
|
21
21
|
const ROLE_ORDER = ['series', 'overlay', 'reference'] as const
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* The pitch between dots-mode entries: 8px under the old 38, to pay for the 14px line key so the
|
|
25
|
+
* four-entry legend still fits one row at 390px. `--vx-hit-gap` caps each coarse-pointer hit area
|
|
26
|
+
* at the entry plus 2px and this gap (`styles.css`), so neighbours never overlap; the trade is that
|
|
27
|
+
* a dots-mode hit target is 8 + 2 + 30 = 40px, not 44.
|
|
26
28
|
*/
|
|
27
|
-
const DOTS_GAP =
|
|
29
|
+
const DOTS_GAP = 30
|
|
28
30
|
|
|
29
31
|
/** The entries a series list derives, in display order (by role when `groups`). */
|
|
30
32
|
export function legendEntries<T>(
|
|
@@ -107,13 +109,14 @@ const swatchFill = (s: SwatchStyle): string =>
|
|
|
107
109
|
s.colorNegative ? `linear-gradient(90deg, ${s.color} 50%, ${s.colorNegative} 50%)` : s.color
|
|
108
110
|
|
|
109
111
|
/**
|
|
110
|
-
* A line series' key: a
|
|
111
|
-
*
|
|
112
|
-
*
|
|
112
|
+
* A line series' key: a stroke with its dash, compact below 480px of CHART width (a container
|
|
113
|
+
* query, not the viewport) and wide from 480px. Both are at least 14px with two or more clear
|
|
114
|
+
* dashes: a shorter key reads as two dots. A dashed swatch has BUTT caps: a round cap grows each
|
|
115
|
+
* dash by half the stroke width per end and would close the gap.
|
|
113
116
|
*/
|
|
114
117
|
export const LINE_SWATCH = {
|
|
115
|
-
compact: { width:
|
|
116
|
-
wide: { width:
|
|
118
|
+
compact: { width: 14, dash: '4 3' },
|
|
119
|
+
wide: { width: 16, dash: '4 3' },
|
|
117
120
|
} as const
|
|
118
121
|
|
|
119
122
|
function LineSwatch({ s, compact }: { s: SwatchStyle; compact: boolean }): ReactElement {
|
package/src/charts/panel.tsx
CHANGED
|
@@ -51,6 +51,8 @@ export type PaneBuilder = (ctx: PaneContext) => {
|
|
|
51
51
|
export type PanelPlan<T> = {
|
|
52
52
|
/** Every x value the cursor can land on, for snapping a foreign cursor. */
|
|
53
53
|
keys: readonly ChartX[]
|
|
54
|
+
/** The x extent the shared scale renders; absent, the keys' own. */
|
|
55
|
+
extent?: readonly [number, number] | undefined
|
|
54
56
|
top: PaneBuilder
|
|
55
57
|
bottom: PaneBuilder
|
|
56
58
|
/** The top pane's share of the grid, 0..1. */
|
|
@@ -215,6 +217,7 @@ function panelDefinition<T, X extends ChartX>(
|
|
|
215
217
|
group: cursorGroup,
|
|
216
218
|
chartId,
|
|
217
219
|
keys: plan.keys,
|
|
220
|
+
extent: plan.extent,
|
|
218
221
|
mode: cursorResolution,
|
|
219
222
|
pin: ctx.coarse,
|
|
220
223
|
}),
|