@momoi-labs/kiso-react 0.25.0 → 0.27.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
  }
@@ -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();
@@ -1,6 +1,7 @@
1
1
  export type DiagramEdgeLine = "solid" | "dashed" | "dotted";
2
2
  export type DiagramEdgeTone = "neutral" | "success" | "danger";
3
3
  export type DiagramEdgeRoute = "side" | "down" | "drop";
4
+ export type DiagramEdgeSide = "top" | "right" | "bottom" | "left";
4
5
  export type DiagramCrossings = "none" | "hop" | "gap";
5
6
  export type DiagramLabels = "auto" | "horizontal" | "vertical";
6
7
  export type DiagramEdgeShape = "orthogonal" | "curve" | "straight" | "sketch";
@@ -19,6 +20,8 @@ export type EdgeSpec = EdgeLook & {
19
20
  to: string;
20
21
  label?: string;
21
22
  route?: DiagramEdgeRoute;
23
+ fromSide?: DiagramEdgeSide;
24
+ toSide?: DiagramEdgeSide;
22
25
  };
23
26
  export type Pt = [number, number];
24
27
  export type Box = {
@@ -48,7 +51,7 @@ type RouteLabel = {
48
51
  text: string;
49
52
  /** The segment the label belongs to. */
50
53
  run: number;
51
- /** Where along a horizontal run the label centres, 0 to 1. */
54
+ /** Where along its run the label centres, 0 to 1. */
52
55
  along?: number;
53
56
  /** Width a flat label may take before it stacks. */
54
57
  room?: number;
@@ -63,6 +66,7 @@ export type Route = {
63
66
  ends?: [string, string];
64
67
  label?: RouteLabel;
65
68
  dot?: Pt;
69
+ pinned?: boolean;
66
70
  };
67
71
  export type Rect = {
68
72
  key: string;
@@ -103,11 +107,13 @@ export declare const RADIUS = 8;
103
107
  export declare const TRACK = 6;
104
108
  export declare const look: (edge: EdgeSpec) => EdgeLook;
105
109
  export type DiagramFlow = "right" | "down" | "grid";
106
- export declare function route(measured: Measured[], nodes: Box[], flow: DiagramFlow, frames?: Box[]): Route[];
110
+ export declare function anchorOf(box: Box, side: DiagramEdgeSide): Pt;
111
+ export declare function route(measured: Measured[], nodes: Box[], flow: DiagramFlow, frames?: Box[], titles?: Box[]): Route[];
107
112
  export type DrawStyle = {
108
113
  shape?: DiagramEdgeShape;
109
114
  arrow?: DiagramArrow;
110
115
  boxes?: Map<string, Box>;
116
+ blocks?: Box[];
111
117
  };
112
118
  export declare function draw(routes: Route[], frames: Frame[], crossings: DiagramCrossings, labels: DiagramLabels, measure: (text: string) => {
113
119
  width: number;