@momoi-labs/kiso-react 0.24.0 → 0.26.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.
@@ -5,7 +5,7 @@ declare function AlertDialog({ ...props }: React.ComponentProps<typeof AlertDial
5
5
  declare function AlertDialogTrigger({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>): React.JSX.Element;
6
6
  declare function AlertDialogPortal({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>): React.JSX.Element;
7
7
  declare function AlertDialogOverlay({ className, onMouseDown, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>): React.JSX.Element;
8
- declare function AlertDialogContent({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Content>): React.JSX.Element;
8
+ declare function AlertDialogContent({ className, children, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Content>): React.JSX.Element;
9
9
  declare function AlertDialogHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
10
10
  declare function AlertDialogFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
11
11
  declare function AlertDialogTitle({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Title>): React.JSX.Element;
@@ -4,6 +4,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  import { clsx as cn } from "clsx";
5
5
  import { AlertDialog as AlertDialogPrimitive } from "radix-ui";
6
6
  import { Button } from "./button.js";
7
+ import { PanelShadow } from "./panel-shadow.js";
7
8
  function AlertDialog({ ...props }) {
8
9
  return _jsx(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", ...props });
9
10
  }
@@ -21,8 +22,8 @@ function AlertDialogOverlay({ className, onMouseDown, ...props }) {
21
22
  event.preventDefault();
22
23
  }, className: cn("kiso-react-overlay", className), ...props }));
23
24
  }
24
- function AlertDialogContent({ className, ...props }) {
25
- return (_jsxs(AlertDialogPortal, { children: [_jsx(AlertDialogOverlay, {}), _jsx(AlertDialogPrimitive.Content, { "aria-modal": "true", "data-slot": "alert-dialog-content", className: cn("kiso-react-dialog marked", className), ...props })] }));
25
+ function AlertDialogContent({ className, children, ...props }) {
26
+ return (_jsxs(AlertDialogPortal, { children: [_jsx(AlertDialogOverlay, {}), _jsxs(AlertDialogPrimitive.Content, { "aria-modal": "true", "data-slot": "alert-dialog-content", className: cn("kiso-react-dialog marked", className), ...props, children: [_jsx(PanelShadow, {}), children] })] }));
26
27
  }
27
28
  function AlertDialogHeader({ className, ...props }) {
28
29
  return (_jsx("div", { "data-slot": "alert-dialog-header", className: cn("dialog-header", className), ...props }));
@@ -4,7 +4,7 @@ import { Header } from "./header.js";
4
4
  declare function AppShell({ className, variant, ...props }: React.ComponentProps<"div"> & {
5
5
  variant?: "default" | "inset";
6
6
  }): React.JSX.Element;
7
- declare function AppShellMain({ className, ...props }: React.ComponentProps<"main">): React.JSX.Element;
7
+ declare function AppShellMain({ className, children, ...props }: React.ComponentProps<"main">): React.JSX.Element;
8
8
  declare function AppShellPanel({ className, ...props }: React.ComponentProps<"aside">): React.JSX.Element;
9
9
  declare function AppShellPanelToggle({ className, placement, children, "aria-label": label, ...props }: React.ComponentProps<typeof Button> & {
10
10
  placement?: "header" | "floating";
package/dist/app-shell.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // Adapted from shadcn/ui new-york-v4. See ../SHADCN-LICENSE.
2
2
  "use client";
3
3
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { PanelShadow } from "./panel-shadow.js";
4
5
  import * as React from "react";
5
6
  import { clsx as cn } from "clsx";
6
7
  import { Ellipsis, Menu, PanelLeftClose, PanelLeftOpen, PanelRight } from "lucide-react";
@@ -17,8 +18,8 @@ function AppShell({ className, variant, ...props }) {
17
18
  }
18
19
  /* `grow` carries the `min-width: 0` the main column needs so a wide table or
19
20
  log line cannot push the sidebar off the screen. */
20
- function AppShellMain({ className, ...props }) {
21
- return (_jsx("main", { "data-slot": "app-shell-main", className: cn("grow", className), ...props }));
21
+ function AppShellMain({ className, children, ...props }) {
22
+ return (_jsxs("main", { "data-slot": "app-shell-main", className: cn("grow", className), ...props, children: [_jsx(PanelShadow, {}), children] }));
22
23
  }
23
24
  function AppShellPanel({ className, ...props }) {
24
25
  return _jsx("aside", { "data-slot": "app-shell-panel", className: cn("app-shell-panel", className), ...props });
package/dist/card.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- declare function Card({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
2
+ declare function Card({ className, children, ...props }: React.ComponentProps<"div">): React.JSX.Element;
3
3
  declare function CardHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
4
4
  declare function CardTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
5
5
  declare function CardDescription({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
package/dist/card.js CHANGED
@@ -1,7 +1,8 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { PanelShadow } from "./panel-shadow.js";
2
3
  import { clsx as cn } from "clsx";
3
- function Card({ className, ...props }) {
4
- return (_jsx("div", { "data-slot": "card", className: cn("card", className), ...props }));
4
+ function Card({ className, children, ...props }) {
5
+ return (_jsxs("div", { "data-slot": "card", className: cn("card", className), ...props, children: [_jsx(PanelShadow, {}), children] }));
5
6
  }
6
7
  function CardHeader({ className, ...props }) {
7
8
  return (_jsx("div", { "data-slot": "card-header", className: cn("card-header", className), ...props }));
@@ -12,6 +12,8 @@ export type ChartSeries = {
12
12
  export declare const chartStrokes: readonly [undefined, "8 4", "2 3", "8 3 2 3", "12 3 2 3 2 3"];
13
13
  export declare const chartSlot: (series: ChartSeries, index: number) => number;
14
14
  export declare const chartColor: (slot: number) => string;
15
+ export type DiagramSeries = number | "neutral";
16
+ export declare const seriesColor: (series: DiagramSeries) => string;
15
17
  export declare const measured: (value: number | null | undefined) => value is number;
16
18
  export declare function validateChart(data: readonly ChartSample[], series: readonly ChartSeries[]): void;
17
19
  export type ChartSummaryStat = "min" | "max" | "avg" | "current" | "p50" | "p75" | "p90" | "p95" | "p99";
@@ -15,6 +15,7 @@ export const chartColor = (slot) => {
15
15
  const shift = extra >= gapHues.length && extra % 2 ? 0.08 : 0;
16
16
  return `light-dark(oklch(${0.55 - shift} 0.13 ${hue}), oklch(${0.8 + shift} 0.12 ${hue}))`;
17
17
  };
18
+ export const seriesColor = (series) => series === "neutral" ? "var(--color-muted-foreground)" : chartColor(series);
18
19
  export const measured = (value) => typeof value === "number" && Number.isFinite(value);
19
20
  export function validateChart(data, series) {
20
21
  if (series.length < 1)
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { PanelShadow } from "./panel-shadow.js";
3
4
  import { cloneElement, createElement, isValidElement, useState } from "react";
4
5
  import { clsx as cn } from "clsx";
5
6
  import { Check, Copy } from "lucide-react";
@@ -144,5 +145,5 @@ export function CodeBlock({ code, highlight, title, terminal = false, lineNumber
144
145
  body.push(line(folded));
145
146
  index = to - 1;
146
147
  }
147
- return (_jsxs("figure", { className: cn("code-block", className), "data-slot": "code-block", "data-terminal": terminal || undefined, style: { "--code-block-digits": String(lines.length).length }, ...props, children: [(title != null || terminal || copy) && _jsxs(Header, { className: "code-block-header", children: [terminal && _jsx(TerminalIcon, {}), title != null && _jsx("span", { className: "code-block-title", children: title }), copy && _jsx(CopyButton, { code: code, label: copy })] }), _jsx("pre", { children: _jsx("code", { children: body }) })] }));
148
+ return (_jsxs("figure", { className: cn("code-block", className), "data-slot": "code-block", "data-terminal": terminal || undefined, style: { "--code-block-digits": String(lines.length).length }, ...props, children: [_jsx(PanelShadow, {}), (title != null || terminal || copy) && _jsxs(Header, { className: "code-block-header", children: [terminal && _jsx(TerminalIcon, {}), title != null && _jsx("span", { className: "code-block-title", children: title }), copy && _jsx(CopyButton, { code: code, label: copy })] }), _jsx("pre", { children: _jsx("code", { children: body }) })] }));
148
149
  }
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ export type ComboboxOption = {
3
+ value: string;
4
+ label: string;
5
+ description?: string;
6
+ /** Short text on the right of the label, such as a type or a unit. */
7
+ note?: string;
8
+ group?: string;
9
+ };
10
+ export type ComboboxProps = Omit<React.ComponentProps<"input">, "value" | "defaultValue" | "onChange" | "size" | "role"> & {
11
+ options: readonly ComboboxOption[];
12
+ /** The picked option value, or null when the text names no option. */
13
+ value?: string | null;
14
+ defaultValue?: string | null;
15
+ onValueChange?: (value: string | null) => void;
16
+ /** The text in the input. */
17
+ query?: string;
18
+ defaultQuery?: string;
19
+ onQueryChange?: (query: string) => void;
20
+ /** Replace the match rule. The default matches the label and the description. */
21
+ filter?: (option: ComboboxOption, query: string) => boolean;
22
+ /** Shown when no option matches. */
23
+ emptyText?: React.ReactNode | ((query: string) => React.ReactNode);
24
+ /** The product is resolving options. The list shows this state, not stale options. */
25
+ loading?: boolean;
26
+ loadingText?: string;
27
+ controlSize?: "sm" | "md" | "lg" | "xl";
28
+ /** Accessible name of the list. Defaults to the input's label text. */
29
+ listLabel?: string;
30
+ /** Show the input text and option labels in the mono font, for identifiers such as setting names. */
31
+ mono?: boolean;
32
+ };
33
+ export declare function defaultComboboxFilter(option: ComboboxOption, query: string): boolean;
34
+ /** A searchable single choice for a long list. The product owns loading and validation. */
35
+ export declare function Combobox({ id: providedId, className, options, value: valueProp, defaultValue, onValueChange, query: queryProp, defaultQuery, onQueryChange, filter, emptyText, loading, loadingText, controlSize, listLabel, mono, disabled, onFocus, onBlur, onClick, onKeyDown, ...props }: ComboboxProps): React.JSX.Element;
@@ -0,0 +1,131 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { clsx as cn } from "clsx";
5
+ import { Popover as PopoverPrimitive } from "radix-ui";
6
+ import { Spinner } from "./spinner.js";
7
+ export function defaultComboboxFilter(option, query) {
8
+ const q = query.trim().toLowerCase();
9
+ if (!q)
10
+ return true;
11
+ return option.label.toLowerCase().includes(q) || !!option.description?.toLowerCase().includes(q);
12
+ }
13
+ function useControllable(controlled, initial, onChange) {
14
+ const [own, setOwn] = React.useState(initial);
15
+ const isControlled = controlled !== undefined;
16
+ const value = isControlled ? controlled : own;
17
+ const set = React.useCallback((next) => {
18
+ if (!isControlled)
19
+ setOwn(next);
20
+ onChange?.(next);
21
+ }, [isControlled, onChange]);
22
+ return [value, set];
23
+ }
24
+ /** A searchable single choice for a long list. The product owns loading and validation. */
25
+ export function Combobox({ id: providedId, className, options, value: valueProp, defaultValue = null, onValueChange, query: queryProp, defaultQuery, onQueryChange, filter = defaultComboboxFilter, emptyText = (q) => (q.trim() ? `Nothing matches "${q.trim()}".` : "No options."), loading = false, loadingText = "Loading options", controlSize, listLabel, mono = false, disabled, onFocus, onBlur, onClick, onKeyDown, ...props }) {
26
+ const generatedId = React.useId();
27
+ const id = providedId ?? generatedId;
28
+ const listId = `${id}-list`;
29
+ const labelOf = (v) => options.find(option => option.value === v)?.label ?? "";
30
+ const [value, setValue] = useControllable(valueProp, defaultValue, onValueChange);
31
+ const [query, setQuery] = useControllable(queryProp, defaultQuery ?? labelOf(valueProp !== undefined ? valueProp : defaultValue), onQueryChange);
32
+ const [open, setOpen] = React.useState(false);
33
+ const [active, setActive] = React.useState(0);
34
+ const anchor = React.useRef(null);
35
+ const listRef = React.useRef(null);
36
+ const input = React.useRef(null);
37
+ // A picked option shows its label. While the text equals that label, the whole list stays visible.
38
+ const showAll = value !== null && query === labelOf(value);
39
+ const matches = React.useMemo(() => (showAll ? [...options] : options.filter(option => filter(option, query))), [options, filter, query, showAll]);
40
+ // Group in order of first appearance, so each group label shows once.
41
+ const groups = React.useMemo(() => {
42
+ const byName = new Map();
43
+ for (const option of matches) {
44
+ const key = option.group ?? "";
45
+ byName.set(key, [...(byName.get(key) ?? []), option]);
46
+ }
47
+ return [...byName.entries()];
48
+ }, [matches]);
49
+ const flat = groups.flatMap(([, items]) => items);
50
+ const visible = open && !disabled;
51
+ const current = Math.min(active, flat.length - 1);
52
+ const ready = !loading && flat.length > 0;
53
+ const optionId = (index) => `${id}-option-${index}`;
54
+ // Keep an uncontrolled text in step with a value the product sets or clears.
55
+ const lastValue = React.useRef(value);
56
+ React.useEffect(() => {
57
+ const previous = lastValue.current;
58
+ if (value === previous)
59
+ return;
60
+ lastValue.current = value;
61
+ if (value !== null && query !== labelOf(value))
62
+ setQuery(labelOf(value));
63
+ else if (value === null && previous !== null && query === labelOf(previous))
64
+ setQuery("");
65
+ }, [value]); // eslint-disable-line react-hooks/exhaustive-deps
66
+ React.useEffect(() => {
67
+ if (visible && ready)
68
+ listRef.current?.querySelector(`#${CSS.escape(optionId(current))}`)?.scrollIntoView({ block: "nearest" });
69
+ }, [visible, ready, current]); // eslint-disable-line react-hooks/exhaustive-deps
70
+ function show() {
71
+ if (open || disabled)
72
+ return;
73
+ const at = flat.findIndex(option => option.value === value);
74
+ setActive(Math.max(0, at));
75
+ setOpen(true);
76
+ }
77
+ function pick(option) {
78
+ setValue(option.value);
79
+ setQuery(option.label);
80
+ setOpen(false);
81
+ input.current?.focus();
82
+ }
83
+ function typed(text) {
84
+ setQuery(text);
85
+ const exact = options.find(option => option.label === text.trim());
86
+ if ((exact?.value ?? null) !== value)
87
+ setValue(exact?.value ?? null);
88
+ setActive(0);
89
+ setOpen(true);
90
+ }
91
+ function keys(event) {
92
+ onKeyDown?.(event);
93
+ if (event.defaultPrevented || event.nativeEvent.isComposing)
94
+ return;
95
+ const last = flat.length - 1;
96
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
97
+ event.preventDefault();
98
+ if (!visible)
99
+ return show();
100
+ setActive(Math.max(0, Math.min(last, current + (event.key === "ArrowDown" ? 1 : -1))));
101
+ }
102
+ else if ((event.key === "Home" || event.key === "End") && visible && ready) {
103
+ event.preventDefault();
104
+ setActive(event.key === "Home" ? 0 : last);
105
+ }
106
+ else if (event.key === "Enter" && visible && ready) {
107
+ event.preventDefault();
108
+ pick(flat[current]);
109
+ }
110
+ else if (event.key === "Escape" && visible) {
111
+ event.preventDefault();
112
+ event.stopPropagation();
113
+ setOpen(false);
114
+ }
115
+ }
116
+ let index = -1;
117
+ return (_jsxs(PopoverPrimitive.Root, { open: visible, onOpenChange: next => { if (!next)
118
+ setOpen(false); }, children: [_jsx(PopoverPrimitive.Anchor, { asChild: true, children: _jsx("div", { ref: anchor, "data-slot": "combobox", "data-mono": mono || undefined, className: cn("combobox", className), children: _jsx("input", { ...props, ref: input, id: id, type: "text", role: "combobox", className: cn("input", mono && "mono"), "data-control-size": controlSize ?? props["data-control-size"], autoComplete: "off", spellCheck: false, disabled: disabled, "aria-autocomplete": "list", "aria-expanded": visible, "aria-controls": visible ? listId : undefined, "aria-activedescendant": visible && ready ? optionId(current) : undefined, "aria-busy": loading || undefined, value: query, onChange: event => typed(event.target.value), onFocus: event => { onFocus?.(event); show(); }, onClick: event => { onClick?.(event); show(); }, onBlur: event => { onBlur?.(event); setOpen(false); }, onKeyDown: keys }) }) }), _jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Content, { "data-slot": "combobox-content", className: "menu combobox-content kiso-react-floating", "data-mono": mono || undefined, role: "presentation", side: "bottom", align: "start", sideOffset: 4, collisionPadding: 8, onOpenAutoFocus: event => event.preventDefault(), onCloseAutoFocus: event => event.preventDefault(), onMouseDown: event => event.preventDefault(), onInteractOutside: event => { if (anchor.current?.contains(event.target))
119
+ event.preventDefault(); }, children: _jsx("div", { ref: listRef, id: listId, role: "listbox", "aria-label": listLabel ?? (input.current?.labels?.[0]?.textContent || undefined), "aria-busy": loading || undefined, children: loading ? (_jsxs("div", { className: "combobox-message", role: "status", children: [_jsx(Spinner, { size: "sm" }), loadingText] })) : !flat.length ? (_jsx("div", { className: "combobox-message", role: "status", children: typeof emptyText === "function" ? emptyText(query) : emptyText })) : groups.map(([group, items]) => {
120
+ const rendered = items.map(option => {
121
+ index += 1;
122
+ const at = index;
123
+ return (_jsxs("div", { id: optionId(at), role: "option", "aria-selected": at === current, "data-current": option.value === value || undefined, className: "combobox-option", onPointerMove: () => { if (at !== current)
124
+ setActive(at); }, onClick: () => pick(option), children: [_jsxs("span", { className: "combobox-option-head", children: [_jsx("span", { className: "combobox-option-label", children: option.label }), option.note && _jsx("span", { className: "combobox-option-note", children: option.note })] }), option.description && _jsx("span", { className: "combobox-option-description", children: option.description })] }, option.value));
125
+ });
126
+ if (!group)
127
+ return _jsx(React.Fragment, { children: rendered }, "");
128
+ const groupId = `${id}-group-${encodeURIComponent(group).replace(/%/g, "")}`;
129
+ return (_jsxs("div", { role: "group", "aria-labelledby": groupId, children: [_jsx("div", { id: groupId, className: "combobox-group-label t-caps", children: group }), rendered] }, group));
130
+ }) }) }) })] }));
131
+ }
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { PanelShadow } from "./panel-shadow.js";
3
4
  import * as React from "react";
4
5
  import { clsx as cn } from "clsx";
5
6
  import { Search } from "lucide-react";
@@ -42,7 +43,7 @@ function CommandPalette({ className, label = "Command palette", children, ...pro
42
43
  }, onEscapeKeyDown: (event) => {
43
44
  if (composing.current || event.isComposing || event.keyCode === 229)
44
45
  event.preventDefault();
45
- }, "data-slot": "command-palette-content", className: cn("palette kiso-react-palette", className), children: [_jsx(VisuallyHidden.Root, { asChild: true, children: _jsx(DialogPrimitive.Title, { children: label }) }), _jsx(CommandPaletteContext.Provider, { value: { composing, activeId, setActiveId, listId, listRef }, children: children })] })] }) }));
46
+ }, "data-slot": "command-palette-content", className: cn("palette kiso-react-palette", className), children: [_jsx(PanelShadow, {}), _jsx(VisuallyHidden.Root, { asChild: true, children: _jsx(DialogPrimitive.Title, { children: label }) }), _jsx(CommandPaletteContext.Provider, { value: { composing, activeId, setActiveId, listId, listRef }, children: children })] })] }) }));
46
47
  }
47
48
  function CommandPaletteInput({ className, onKeyDown, onCompositionStart, onCompositionEnd, ...props }) {
48
49
  const { composing, activeId, setActiveId, listId, listRef } = useCommandPalette();
@@ -0,0 +1,116 @@
1
+ export type DiagramEdgeLine = "solid" | "dashed" | "dotted";
2
+ export type DiagramEdgeTone = "neutral" | "success" | "danger";
3
+ export type DiagramEdgeRoute = "side" | "down" | "drop";
4
+ export type DiagramCrossings = "none" | "hop" | "gap";
5
+ export type DiagramLabels = "auto" | "horizontal" | "vertical";
6
+ export type DiagramEdgeShape = "orthogonal" | "curve" | "straight" | "sketch";
7
+ export type DiagramArrow = "triangle" | "chevron" | "stealth" | "dot" | "sketch" | "none";
8
+ export type EdgeLook = {
9
+ line?: DiagramEdgeLine;
10
+ tone?: DiagramEdgeTone;
11
+ series?: number;
12
+ flow?: boolean;
13
+ shape?: DiagramEdgeShape;
14
+ head?: DiagramArrow;
15
+ };
16
+ export type EdgeSpec = EdgeLook & {
17
+ key: string;
18
+ from: string[];
19
+ to: string;
20
+ label?: string;
21
+ route?: DiagramEdgeRoute;
22
+ };
23
+ export type Pt = [number, number];
24
+ export type Box = {
25
+ id: string;
26
+ left: number;
27
+ right: number;
28
+ top: number;
29
+ bottom: number;
30
+ width: number;
31
+ height: number;
32
+ x: number;
33
+ y: number;
34
+ };
35
+ export type Frame = {
36
+ left: number;
37
+ right: number;
38
+ top: number;
39
+ bottom: number;
40
+ radius: number;
41
+ };
42
+ export type Measured = {
43
+ edge: EdgeSpec;
44
+ target: Box;
45
+ sources: Box[];
46
+ };
47
+ type RouteLabel = {
48
+ text: string;
49
+ /** The segment the label belongs to. */
50
+ run: number;
51
+ /** Where along a horizontal run the label centres, 0 to 1. */
52
+ along?: number;
53
+ /** Width a flat label may take before it stacks. */
54
+ room?: number;
55
+ /** Distance from the run's start the label keeps clear of, past a split. */
56
+ from?: number;
57
+ };
58
+ export type Route = {
59
+ key: string;
60
+ points: Pt[];
61
+ arrow: boolean;
62
+ look: EdgeLook;
63
+ ends?: [string, string];
64
+ label?: RouteLabel;
65
+ dot?: Pt;
66
+ };
67
+ export type Rect = {
68
+ key: string;
69
+ x: number;
70
+ y: number;
71
+ width: number;
72
+ height: number;
73
+ };
74
+ export type Drawn = {
75
+ /** `arrow` says whether the path gets a head, `head` which one. `knock`
76
+ is drawn just before the path, in the card colour, to break the lines
77
+ it crosses. */
78
+ paths: (EdgeLook & {
79
+ key: string;
80
+ d: string;
81
+ arrow: boolean;
82
+ head: DiagramArrow;
83
+ knock?: string;
84
+ })[];
85
+ labels: {
86
+ key: string;
87
+ x: number;
88
+ y: number;
89
+ lines: string[];
90
+ anchor?: "start";
91
+ rotate?: boolean;
92
+ middle?: boolean;
93
+ plate?: Rect;
94
+ }[];
95
+ plates: Rect[];
96
+ dots: (EdgeLook & {
97
+ key: string;
98
+ x: number;
99
+ y: number;
100
+ })[];
101
+ };
102
+ export declare const RADIUS = 8;
103
+ export declare const TRACK = 6;
104
+ export declare const look: (edge: EdgeSpec) => EdgeLook;
105
+ export type DiagramFlow = "right" | "down" | "grid";
106
+ export declare function route(measured: Measured[], nodes: Box[], flow: DiagramFlow, frames?: Box[]): Route[];
107
+ export type DrawStyle = {
108
+ shape?: DiagramEdgeShape;
109
+ arrow?: DiagramArrow;
110
+ boxes?: Map<string, Box>;
111
+ };
112
+ export declare function draw(routes: Route[], frames: Frame[], crossings: DiagramCrossings, labels: DiagramLabels, measure: (text: string) => {
113
+ width: number;
114
+ height: number;
115
+ }, style?: DrawStyle): Drawn;
116
+ export {};