@mechane-ai/elements 0.36.0 → 0.38.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 (39) hide show
  1. package/README.md +8 -6
  2. package/dist/ai.js +3 -3
  3. package/dist/{chart-theme-Bwr9YSP1.js → categorical-values-BECG-J6R.js} +4 -54
  4. package/dist/{chart-frame-C0UBu4ku.js → chart-frame-CJFnI39T.js} +78 -93
  5. package/dist/{chart-input-Ccr2NJ6J.js → chart-input-DwAobO8Y.js} +2 -2
  6. package/dist/chart-navigation-CBIeNtJq.js +67 -0
  7. package/dist/charts/cartesian.js +631 -618
  8. package/dist/charts/distribution.js +298 -267
  9. package/dist/charts/graph.js +113 -122
  10. package/dist/charts/hierarchy.js +12 -12
  11. package/dist/charts/matrix.js +208 -200
  12. package/dist/charts/timeline.js +2 -2
  13. package/dist/charts.js +3 -3
  14. package/dist/{code-block-DT1TCkTC.js → code-block-aC0Htt4N.js} +33 -32
  15. package/dist/collections.js +597 -351
  16. package/dist/content/code.js +1 -1
  17. package/dist/content/diff.js +1 -1
  18. package/dist/content/markdown.js +1 -1
  19. package/dist/content.js +1 -1
  20. package/dist/elements.css +22 -2
  21. package/dist/feedback.js +1 -1
  22. package/dist/navigation/commands.js +4 -3
  23. package/dist/packages/charts/src/chart-data.d.ts +13 -3
  24. package/dist/packages/charts/src/chart-frame.d.ts +2 -5
  25. package/dist/packages/charts/src/chart-navigation.d.ts +19 -0
  26. package/dist/packages/charts/src/distribution/distribution-plot.d.ts +4 -2
  27. package/dist/packages/collections/src/collection-filters.d.ts +20 -0
  28. package/dist/packages/collections/src/data-table.d.ts +4 -6
  29. package/dist/packages/collections/src/index.d.ts +4 -0
  30. package/dist/packages/collections/src/use-collection-controls.d.ts +30 -0
  31. package/dist/packages/feedback/src/index.d.ts +2 -2
  32. package/dist/packages/feedback/src/notifications.d.ts +35 -0
  33. package/dist/packages/feedback/src/toast.d.ts +1 -1
  34. package/dist/packages/navigation/src/commands/command.d.ts +1 -0
  35. package/dist/plot-width-BQQS-mw9.js +67 -0
  36. package/dist/{src-D9DktxEq.js → src-DWjAoOyd.js} +1 -1
  37. package/dist/{src-DXdsMc_Z.js → src-nkgFDl-g.js} +246 -207
  38. package/package.json +1 -1
  39. package/dist/plot-width--OgdohB5.js +0 -18
@@ -1 +1 @@
1
- export { t as CodeBlock } from "../code-block-DT1TCkTC.js";
1
+ export { t as CodeBlock } from "../code-block-aC0Htt4N.js";
@@ -1,5 +1,5 @@
1
1
  import { D as e, _ as t, v as n } from "../src-C-Sx37kz.js";
2
- import { t as r } from "../code-block-DT1TCkTC.js";
2
+ import { t as r } from "../code-block-aC0Htt4N.js";
3
3
  import { t as i } from "../viewer-styles-DsFYri4K.js";
4
4
  import * as a from "@stylexjs/stylex";
5
5
  import { useEffect as o, useState as s } from "react";
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "../use-scroll-tab-index-Dxpdh4W7.js";
2
2
  import { t } from "../visible-motion-1GcUaEi4.js";
3
- import { t as n } from "../code-block-DT1TCkTC.js";
3
+ import { t as n } from "../code-block-aC0Htt4N.js";
4
4
  import { n as r, t as i } from "../content-link-B3ObdyZY.js";
5
5
  import { t as a } from "../viewer-styles-DsFYri4K.js";
6
6
  import * as o from "@stylexjs/stylex";
package/dist/content.js CHANGED
@@ -1 +1 @@
1
- export { o as JsonViewer, a as LogViewer, r as MediaViewer, i as MediaViewerPlaceholder, n as StackTrace, t as Trace } from "./src-D9DktxEq.js";
1
+ export { o as JsonViewer, a as LogViewer, r as MediaViewer, i as MediaViewerPlaceholder, n as StackTrace, t as Trace } from "./src-DWjAoOyd.js";
package/dist/elements.css CHANGED
@@ -664,8 +664,8 @@ html[dir=ltr],[data-sonner-toaster][dir=ltr]{--toast-icon-margin-start:-3px;--to
664
664
  -webkit-font-smoothing: antialiased;
665
665
  }
666
666
 
667
- .x1h7i4cw {
668
- -webkit-line-clamp: 2;
667
+ .xh0615m {
668
+ -webkit-line-clamp: 1;
669
669
  }
670
670
 
671
671
  .x1rh3ycu {
@@ -2446,6 +2446,10 @@ html[dir=ltr],[data-sonner-toaster][dir=ltr]{--toast-icon-margin-start:-3px;--to
2446
2446
  margin-bottom: var(--x1qq5i99);
2447
2447
  }
2448
2448
 
2449
+ .x1kk91vl {
2450
+ margin-bottom: var(--x1xijsos);
2451
+ }
2452
+
2449
2453
  .x1jfksii {
2450
2454
  margin-bottom: var(--xxhyxt);
2451
2455
  }
@@ -2530,6 +2534,10 @@ html[dir=ltr],[data-sonner-toaster][dir=ltr]{--toast-icon-margin-start:-3px;--to
2530
2534
  max-width: 100%;
2531
2535
  }
2532
2536
 
2537
+ .xazcve0 {
2538
+ max-width: 100px;
2539
+ }
2540
+
2533
2541
  .x16xn7b0 {
2534
2542
  max-width: 100vw;
2535
2543
  }
@@ -2574,6 +2582,10 @@ html[dir=ltr],[data-sonner-toaster][dir=ltr]{--toast-icon-margin-start:-3px;--to
2574
2582
  max-width: calc(100vw - 24px);
2575
2583
  }
2576
2584
 
2585
+ .xw7nakj {
2586
+ max-width: calc(100vw - 32px);
2587
+ }
2588
+
2577
2589
  .x1recik0 {
2578
2590
  max-width: calc(100vw - 48px);
2579
2591
  }
@@ -2870,6 +2882,10 @@ html[dir=ltr],[data-sonner-toaster][dir=ltr]{--toast-icon-margin-start:-3px;--to
2870
2882
  width: 24px;
2871
2883
  }
2872
2884
 
2885
+ .x1m258z3 {
2886
+ width: 320px;
2887
+ }
2888
+
2873
2889
  .x1td3qas {
2874
2890
  width: 32px;
2875
2891
  }
@@ -2918,6 +2934,10 @@ html[dir=ltr],[data-sonner-toaster][dir=ltr]{--toast-icon-margin-start:-3px;--to
2918
2934
  width: calc(var(--xyyn5jb) - var(--x1m0ogk9));
2919
2935
  }
2920
2936
 
2937
+ .xdl07me {
2938
+ width: clamp(120px, 40vw, 240px);
2939
+ }
2940
+
2921
2941
  .xeq5yr9 {
2922
2942
  width: fit-content;
2923
2943
  }
package/dist/feedback.js CHANGED
@@ -1 +1 @@
1
- export { t as AsyncRegion, l as ButtonPlaceholder, n as ContentReveal, m as EmptyState, u as FieldPlaceholder, r as LoadingScope, o as Meter, h as Notice, s as Progress, d as Skeleton, f as SkeletonText, p as Spinner, i as Toaster, a as toast } from "./src-DXdsMc_Z.js";
1
+ export { t as AsyncRegion, l as ButtonPlaceholder, n as ContentReveal, m as EmptyState, u as FieldPlaceholder, r as LoadingScope, o as Meter, h as Notice, s as Progress, d as Skeleton, f as SkeletonText, p as Spinner, i as Toaster, a as toast } from "./src-nkgFDl-g.js";
@@ -10,9 +10,10 @@ function c({ commands: e, target: t, isEnabled: n }) {
10
10
  let r = e.flatMap((e) => !n || e.isDisabled === !0 || e.shortcut === void 0 ? [] : [{
11
11
  hotkey: e.shortcut,
12
12
  callback: (n) => {
13
- if (n.defaultPrevented || n.repeat) return;
14
- let r = t !== null && "current" in t ? t.current : t, i = n.target instanceof Element ? n.target.closest("dialog[open], [role=\"dialog\"][aria-modal=\"true\"], [role=\"alertdialog\"]") : null;
15
- (i === null || r !== null && i.contains(r)) && (n.preventDefault(), n.stopPropagation(), e.onSelect());
13
+ if (n.defaultPrevented || n.repeat || e.shouldRun?.(n) === !1) return;
14
+ let r = t !== null && "current" in t ? t.current : t, i = (r?.ownerDocument ?? globalThis.document).querySelectorAll(":is(dialog[open], [role=\"dialog\"], [role=\"alertdialog\"], [role=\"menu\"], [role=\"listbox\"], [data-base-ui-popover-popup]):not([data-closed])");
15
+ for (let e of i) if (r === null || !e.contains(r)) return;
16
+ n.target instanceof Element && n.target.closest("input, textarea, select, [contenteditable]:not([contenteditable=\"false\"])") !== null || (n.preventDefault(), n.stopPropagation(), e.onSelect());
16
17
  },
17
18
  options: {
18
19
  requireReset: !0,
@@ -1,4 +1,14 @@
1
1
  import type { ReactNode } from 'react';
2
- export declare function ChartData({ children }: {
3
- readonly children: ReactNode;
4
- }): ReactNode;
2
+ export type ChartDataRow = {
3
+ readonly id: string | number;
4
+ readonly values: ReadonlyArray<string>;
5
+ };
6
+ export type ChartDataProps = {
7
+ readonly label: string;
8
+ readonly columns: ReadonlyArray<{
9
+ readonly id: string;
10
+ readonly label: string;
11
+ }>;
12
+ readonly rows: ReadonlyArray<ChartDataRow>;
13
+ };
14
+ export declare function ChartData({ label, columns, rows }: ChartDataProps): ReactNode;
@@ -39,10 +39,7 @@ export declare function ChartDatumButton({ label, isSelected, onSelect, children
39
39
  readonly onSelect?: (() => void) | undefined;
40
40
  readonly children: ReactNode;
41
41
  }): ReactNode;
42
- export declare function ChartReadout({ children }: {
42
+ export declare function ChartReadout({ children, id }: {
43
43
  readonly children: ReactNode;
44
- }): ReactNode;
45
- export declare function ChartDataDisclosure({ children, label, }: {
46
- readonly children: ReactNode;
47
- readonly label?: string | undefined;
44
+ readonly id?: string;
48
45
  }): ReactNode;
@@ -0,0 +1,19 @@
1
+ import type { HTMLAttributes } from 'react';
2
+ import type { ChartSelection } from './chart-frame.tsx';
3
+ type ChartNavigationItem = {
4
+ readonly id: string;
5
+ readonly label: string;
6
+ };
7
+ type ChartNavigationInput = {
8
+ readonly title: string;
9
+ readonly items: ReadonlyArray<ChartNavigationItem>;
10
+ readonly selection: ChartSelection | undefined;
11
+ };
12
+ export declare function useChartNavigation({ title, items, selection }: ChartNavigationInput): {
13
+ id: string;
14
+ props: HTMLAttributes<HTMLElement>;
15
+ activeId: string | undefined;
16
+ label: string | undefined;
17
+ inspect: (itemId: string) => void;
18
+ };
19
+ export {};
@@ -1,5 +1,5 @@
1
1
  import * as stylex from '@stylexjs/stylex';
2
- import type { ReactNode } from 'react';
2
+ import type { HTMLAttributes, ReactNode } from 'react';
3
3
  import type { NumericDomain } from './distribution-input.ts';
4
4
  export declare const distributionGeometry: {
5
5
  readonly height: 160;
@@ -139,6 +139,8 @@ export declare const distributionStyles: Readonly<{
139
139
  }>;
140
140
  }>;
141
141
  type NumericPlotProps = {
142
+ readonly navigation?: HTMLAttributes<HTMLElement>;
143
+ readonly onInspectValue?: (value: number) => void;
142
144
  readonly xDomain: NumericDomain;
143
145
  readonly yDomain: NumericDomain;
144
146
  readonly xLabel: string;
@@ -147,7 +149,7 @@ type NumericPlotProps = {
147
149
  readonly formatY: (value: number) => string;
148
150
  readonly children: (width: number) => ReactNode;
149
151
  };
150
- export declare function NumericPlot({ xDomain, yDomain, xLabel, yLabel, formatX, formatY, children, }: NumericPlotProps): ReactNode;
152
+ export declare function NumericPlot({ navigation, onInspectValue, xDomain, yDomain, xLabel, yLabel, formatX, formatY, children, }: NumericPlotProps): ReactNode;
151
153
  export declare function DomainLabels({ domain, formatValue, }: {
152
154
  readonly domain: NumericDomain;
153
155
  readonly formatValue: (value: number) => string;
@@ -0,0 +1,20 @@
1
+ import type { ComponentProps, ReactNode } from 'react';
2
+ import type { Badge } from '../../core/src/index.ts';
3
+ export type FilterOption = {
4
+ readonly value: string;
5
+ readonly label: string;
6
+ readonly icon?: ReactNode;
7
+ tone?: ComponentProps<typeof Badge>['tone'];
8
+ };
9
+ export type CollectionFilter = {
10
+ readonly id: string;
11
+ readonly label: string;
12
+ readonly icon?: ReactNode;
13
+ readonly value: string;
14
+ readonly defaultValue: string;
15
+ readonly options: ReadonlyArray<FilterOption>;
16
+ readonly onChange: (value: string) => void;
17
+ };
18
+ export declare function CollectionFilters({ groups }: {
19
+ groups: ReadonlyArray<CollectionFilter>;
20
+ }): import("react").JSX.Element;
@@ -1,5 +1,4 @@
1
1
  import type { ComponentProps, ReactNode } from 'react';
2
- type TableSizing = 'content' | 'fill';
3
2
  type RowSizing = 'fixed' | 'content';
4
3
  export type DataTableColumnRole = 'primary' | 'text' | 'status' | 'number' | 'timestamp' | 'actions';
5
4
  export type DataTableColumnLayout = {
@@ -14,15 +13,14 @@ export type DataTableColumn<Row> = DataTableColumnLayout & {
14
13
  readonly shouldTruncate?: boolean;
15
14
  readonly canSort?: boolean;
16
15
  };
17
- export type DataTablePlaceholderProps = {
16
+ export type DataTablePlaceholderProps = Pick<DataTableProps<object>, 'caption' | 'hideCaption' | 'hideHeaders' | 'rowSizing' | 'window' | 'footer'> & {
18
17
  readonly columns: ReadonlyArray<DataTableColumnLayout & {
18
+ readonly shouldTruncate?: boolean;
19
19
  readonly placeholder?: ReactNode;
20
20
  }>;
21
- readonly sizing?: TableSizing;
22
- readonly rowSizing?: RowSizing;
23
- readonly hideHeaders?: boolean;
21
+ readonly rows?: number;
24
22
  };
25
- export declare function DataTablePlaceholder({ columns: suppliedColumns, sizing, rowSizing, hideHeaders, }: DataTablePlaceholderProps): ReactNode;
23
+ export declare function DataTablePlaceholder({ columns, rows, hideCaption, ...props }: DataTablePlaceholderProps): ReactNode;
26
24
  export type DataTableTextProps = {
27
25
  readonly children: string;
28
26
  readonly secondary?: string | undefined;
@@ -13,3 +13,7 @@ export type { TimestampProps } from './timestamp.tsx';
13
13
  export { Timestamp } from './timestamp.tsx';
14
14
  export { Timeline } from './timeline.tsx';
15
15
  export type { TimelineProps, TimelineItemProps } from './timeline.tsx';
16
+ export { useCollectionControls } from './use-collection-controls.tsx';
17
+ export type { CollectionSearch, CollectionControlsProps } from './use-collection-controls.tsx';
18
+ export { CollectionFilters } from './collection-filters.tsx';
19
+ export type { CollectionFilter, FilterOption } from './collection-filters.tsx';
@@ -0,0 +1,30 @@
1
+ import type { KeyboardEvent, ReactNode } from 'react';
2
+ import type { CollectionFilter } from './collection-filters.tsx';
3
+ export type CollectionSearch = {
4
+ readonly value: string;
5
+ readonly onChange: (value: string) => void;
6
+ readonly onSubmit?: () => void;
7
+ readonly label?: string;
8
+ readonly placeholder?: string;
9
+ };
10
+ export type CollectionControlsProps = {
11
+ readonly search?: CollectionSearch;
12
+ readonly filters?: ReadonlyArray<CollectionFilter>;
13
+ readonly filterContent?: (close: () => void) => ReactNode;
14
+ readonly chips?: ReadonlyArray<{
15
+ readonly id: string;
16
+ readonly label: string;
17
+ readonly onRemove: () => void;
18
+ }>;
19
+ readonly viewActions?: ReactNode;
20
+ readonly display?: ReactNode;
21
+ };
22
+ export declare function useCollectionControls({ search, filters, filterContent, chips, viewActions, display, isPlaceholder, isReady, }: CollectionControlsProps & {
23
+ isPlaceholder?: boolean;
24
+ isReady: boolean;
25
+ }): {
26
+ openSearch: () => void;
27
+ onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
28
+ actions: import("react").JSX.Element | undefined;
29
+ chips: false | import("react").JSX.Element;
30
+ };
@@ -5,8 +5,8 @@ export type { ProgressProps, MeterProps } from './progress.tsx';
5
5
  export { Progress, Meter } from './progress.tsx';
6
6
  export type { SkeletonProps, SkeletonTextProps, SpinnerProps } from './skeleton.tsx';
7
7
  export { Skeleton, SkeletonText, Spinner } from './skeleton.tsx';
8
- export type { ExternalToast as ToastOptions } from 'sonner';
9
- export { toast } from 'sonner';
8
+ export type { ToastId, ToastAction, ToastOptions, LoadingToastOptions, DismissToastOptions } from './notifications.ts';
9
+ export { toast } from './notifications.ts';
10
10
  export type { ToasterProps } from './toast.tsx';
11
11
  export { Toaster } from './toast.tsx';
12
12
  export type { AsyncRegionProps, AsyncRegionState, ContentRevealProps, LoadingScopeProps } from './async-region.tsx';
@@ -0,0 +1,35 @@
1
+ import type { MouseEvent } from 'react';
2
+ export type ToastId = string | number;
3
+ export type ToastAction = {
4
+ readonly label: string;
5
+ readonly onClick: (event: MouseEvent<HTMLButtonElement>) => void;
6
+ };
7
+ export type ToastOptions = {
8
+ readonly title: string;
9
+ readonly description?: string;
10
+ readonly id?: ToastId;
11
+ readonly action?: ToastAction;
12
+ readonly toasterId?: string;
13
+ readonly shouldPersist?: boolean;
14
+ };
15
+ export type LoadingToastOptions = ToastOptions & {
16
+ readonly id: ToastId;
17
+ };
18
+ export type DismissToastOptions = {
19
+ readonly id: ToastId;
20
+ };
21
+ declare function success(input: ToastOptions): ToastId;
22
+ declare function error(input: ToastOptions): ToastId;
23
+ declare function info(input: ToastOptions): ToastId;
24
+ declare function warning(input: ToastOptions): ToastId;
25
+ declare function loading(input: LoadingToastOptions): ToastId;
26
+ declare function dismiss({ id }: DismissToastOptions): void;
27
+ export declare const toast: {
28
+ readonly success: typeof success;
29
+ readonly error: typeof error;
30
+ readonly info: typeof info;
31
+ readonly warning: typeof warning;
32
+ readonly loading: typeof loading;
33
+ readonly dismiss: typeof dismiss;
34
+ };
35
+ export {};
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { ToasterProps as SonnerToasterProps } from 'sonner';
3
- export type ToasterProps = Pick<SonnerToasterProps, 'id' | 'position' | 'hotkey' | 'expand' | 'duration' | 'visibleToasts' | 'closeButton' | 'offset' | 'mobileOffset' | 'dir' | 'swipeDirections' | 'containerAriaLabel'> & {
3
+ export type ToasterProps = Pick<SonnerToasterProps, 'id' | 'position' | 'hotkey' | 'expand' | 'visibleToasts' | 'closeButton' | 'offset' | 'mobileOffset' | 'dir' | 'swipeDirections' | 'containerAriaLabel'> & {
4
4
  readonly closeButtonAriaLabel?: string;
5
5
  };
6
6
  export declare function Toaster({ closeButton, closeButtonAriaLabel, offset, mobileOffset, ...props }: ToasterProps): ReactNode;
@@ -13,6 +13,7 @@ export type CommandAction = {
13
13
  readonly description?: string;
14
14
  readonly shortcut?: CommandShortcut;
15
15
  readonly isDisabled?: boolean;
16
+ readonly shouldRun?: (event: KeyboardEvent) => boolean;
16
17
  readonly onSelect: () => void;
17
18
  };
18
19
  export type CommandShortcutsOptions = {
@@ -0,0 +1,67 @@
1
+ import "@stylexjs/stylex";
2
+ import { useEffect as e, useState as t } from "react";
3
+ // packages/charts/src/chart-theme.ts
4
+ var n = {
5
+ plot: {
6
+ k7Eaqz: "xeuugli",
7
+ kVQacm: "xb3r6kr",
8
+ $$css: !0
9
+ },
10
+ svg: {
11
+ k1xSpc: "x1lliihq",
12
+ kzqmXN: "xh8yej3",
13
+ kVQacm: "x1rea2x4",
14
+ $$css: !0
15
+ },
16
+ axis: {
17
+ kjVXCG: "x13hfdr1",
18
+ kfJifR: "xnpr05h",
19
+ kREpy8: "x13efnbd",
20
+ $$css: !0
21
+ },
22
+ grid: {
23
+ kjVXCG: "x13hfdr1",
24
+ kfJifR: "xnpr05h",
25
+ k5rJSQ: "x1ntoi03",
26
+ kREpy8: "x13efnbd",
27
+ $$css: !0
28
+ },
29
+ label: {
30
+ kDwRjp: "x1q7gtio",
31
+ kMv6JI: "x1hz01jw",
32
+ kGuDYH: "xy8obcc",
33
+ k63SB2: "xj57cvi",
34
+ kcqcaj: "xss6m8b",
35
+ $$css: !0
36
+ },
37
+ mark: {
38
+ kfJifR: "xhr4kjn",
39
+ kREpy8: "x13efnbd",
40
+ $$css: !0
41
+ },
42
+ selected: {
43
+ kjVXCG: "x17y187c",
44
+ kfJifR: "xvlca1e",
45
+ kREpy8: "x13efnbd",
46
+ $$css: !0
47
+ },
48
+ inspectable: {
49
+ k3XXqK: "x1t137rt",
50
+ $$css: !0
51
+ }
52
+ }, r = 640;
53
+ function i() {
54
+ let [n, i] = t(null), [a, o] = t(r);
55
+ return e(() => {
56
+ if (n === null) return;
57
+ let e = new ResizeObserver(([e]) => {
58
+ e !== void 0 && e.contentRect.width > 0 && o(e.contentRect.width);
59
+ });
60
+ return e.observe(n), () => e.disconnect();
61
+ }, [n]), {
62
+ ref: i,
63
+ width: a,
64
+ element: n
65
+ };
66
+ }
67
+ export { n, i as t };
@@ -1,7 +1,7 @@
1
1
  import { D as e, _ as t, v as n, w as r } from "./src-C-Sx37kz.js";
2
2
  import { t as i } from "./use-scroll-tab-index-Dxpdh4W7.js";
3
3
  import { t as a } from "./viewer-styles-DsFYri4K.js";
4
- import { t as o } from "./code-block-DT1TCkTC.js";
4
+ import { t as o } from "./code-block-aC0Htt4N.js";
5
5
  import { t as s } from "./content-link-B3ObdyZY.js";
6
6
  import * as c from "@stylexjs/stylex";
7
7
  import { useCallback as l, useEffect as u, useLayoutEffect as d, useRef as f, useState as p } from "react";