@q9labsai/chalk-whiteboard 5.2.0 → 5.2.2
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/dist/assets.d.ts +13 -0
- package/dist/assets.js +10 -0
- package/dist/chunk-BN4VA2BS.js +20 -0
- package/dist/collab/view-limits.d.ts +1 -0
- package/dist/collab/view.d.ts +26 -0
- package/dist/embedded/chalk-whiteboard/Figtree-Regular.ttf +0 -0
- package/dist/embedded/chalk-whiteboard/Figtree-SemiBold.ttf +0 -0
- package/dist/embedded/chalk-whiteboard/asset-manifest.json +19 -4
- package/dist/embedded/chalk-whiteboard/chalk.css +44 -0
- package/dist/embedded/chalk-whiteboard/licenses/Figtree.txt +93 -0
- package/dist/embedded/chalk-whiteboard/renderer.js +1669 -1418
- package/dist/embedded/controller.d.ts +16 -14
- package/dist/embedded/index.d.ts +1 -1
- package/dist/embedded/index.js +127 -8
- package/dist/embedded/protocol.d.ts +86 -0
- package/dist/embedded/renderer-assets.d.ts +1 -0
- package/dist/embedded/renderer-bridge.d.ts +10 -0
- package/dist/embedded/renderer-entry.d.ts +2 -0
- package/dist/embedded/renderer.d.ts +0 -5
- package/dist/react/board/Board.d.ts +41 -0
- package/dist/react/board/BoardCursors.d.ts +23 -0
- package/dist/react/board/BoardIcon.d.ts +46 -0
- package/dist/react/board/BoardIsland.d.ts +22 -0
- package/dist/react/board/BoardMenu.d.ts +20 -0
- package/dist/react/board/BoardStyles.d.ts +2 -0
- package/dist/react/board/board-draw-policy.d.ts +10 -0
- package/dist/react/board/board-engine.d.ts +30 -0
- package/dist/react/board/board-history.d.ts +7 -0
- package/dist/react/board/board-model.d.ts +91 -0
- package/dist/react/board/board-toasts.d.ts +15 -0
- package/dist/react/board/board-view-versions.d.ts +1 -0
- package/dist/react/board/controls/ChalkMenu.d.ts +22 -0
- package/dist/react/board/controls/ChalkPopover.d.ts +13 -0
- package/dist/react/board/controls/ChalkTooltip.d.ts +5 -0
- package/dist/react/board/controls/index.d.ts +3 -0
- package/dist/react/board/useMediaQuery.d.ts +6 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.js +1811 -18
- package/package.json +19 -5
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type MutableRefObject } from "react";
|
|
2
|
+
import type { WhiteboardEngineHandle } from "../WhiteboardCanvas.js";
|
|
3
|
+
/** Reads the engine's stacks; never counts host mutations. */
|
|
4
|
+
export declare function useEngineHistory(root: MutableRefObject<HTMLElement | null>, engine: WhiteboardEngineHandle | null): {
|
|
5
|
+
canUndo: boolean;
|
|
6
|
+
canRedo: boolean;
|
|
7
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { WhiteboardView as ChalkWhiteboardView, WhiteboardViewBounds } from "../../collab/view.js";
|
|
2
|
+
import type { WhoCanDraw } from "./board-draw-policy.js";
|
|
3
|
+
/** design.md, "The board": every colour, size and key the board's own controls use. */
|
|
4
|
+
export type BoardSurface = "chalkboard" | "paper" | "dots";
|
|
5
|
+
export type IslandPlace = "bottom" | "top" | "left";
|
|
6
|
+
export type CallTheme = "light" | "dark";
|
|
7
|
+
export type PenColor = "ink" | "red" | "orange" | "green" | "blue" | "violet";
|
|
8
|
+
export type PenWidth = "thin" | "medium" | "thick";
|
|
9
|
+
export type ShapeTool = "rectangle" | "ellipse" | "diamond" | "arrow" | "line";
|
|
10
|
+
export type BoardTool = "selection" | "hand" | "pen" | "highlighter" | ShapeTool | "text" | "note" | "eraser" | "laser";
|
|
11
|
+
export declare const SURFACES: readonly {
|
|
12
|
+
readonly id: BoardSurface;
|
|
13
|
+
readonly label: string;
|
|
14
|
+
}[];
|
|
15
|
+
export declare const ISLAND_PLACES: readonly {
|
|
16
|
+
readonly id: IslandPlace;
|
|
17
|
+
readonly label: string;
|
|
18
|
+
}[];
|
|
19
|
+
export declare const DRAW_POLICIES: readonly {
|
|
20
|
+
readonly id: WhoCanDraw["policy"];
|
|
21
|
+
readonly label: string;
|
|
22
|
+
}[];
|
|
23
|
+
export declare const PEN_COLORS: readonly {
|
|
24
|
+
readonly id: PenColor;
|
|
25
|
+
readonly label: string;
|
|
26
|
+
}[];
|
|
27
|
+
export declare const NOTE_FILL: Record<PenColor, string>;
|
|
28
|
+
/** Note text is a hair off Ink's canonical colour, so it never turns light with the surface. */
|
|
29
|
+
export declare const NOTE_TEXT = "#1b1c1e";
|
|
30
|
+
export declare const NOTE_SIZE: {
|
|
31
|
+
readonly width: 170;
|
|
32
|
+
readonly height: 150;
|
|
33
|
+
};
|
|
34
|
+
/** A 4px corner, as in the mockup; the engine's default rounding is 32px. */
|
|
35
|
+
export declare const NOTE_ROUNDNESS: {
|
|
36
|
+
readonly type: 3;
|
|
37
|
+
readonly value: 4;
|
|
38
|
+
};
|
|
39
|
+
export declare const PEN_WIDTHS: readonly {
|
|
40
|
+
readonly id: PenWidth;
|
|
41
|
+
readonly label: string;
|
|
42
|
+
readonly units: number;
|
|
43
|
+
}[];
|
|
44
|
+
export declare const SHAPES: readonly {
|
|
45
|
+
readonly id: ShapeTool;
|
|
46
|
+
readonly label: string;
|
|
47
|
+
readonly key: string;
|
|
48
|
+
}[];
|
|
49
|
+
export declare const TOOL_KEYS: Readonly<Record<string, BoardTool>>;
|
|
50
|
+
export declare function personColor(index: number): string;
|
|
51
|
+
export declare function isDarkSurface(surface: BoardSurface, theme: CallTheme): boolean;
|
|
52
|
+
/** The surface's own ink, which is what Ink looks like on it. */
|
|
53
|
+
export declare function surfaceInk(surface: BoardSurface, theme: CallTheme): string;
|
|
54
|
+
/** The fill behind the drawing, also used as the background of an exported image. */
|
|
55
|
+
export declare function surfaceFill(surface: BoardSurface, theme: CallTheme): string;
|
|
56
|
+
export declare function selectionColor(surface: BoardSurface, theme: CallTheme): string;
|
|
57
|
+
export declare function penHex(color: PenColor, surface: BoardSurface, theme: CallTheme): string;
|
|
58
|
+
/** The highlighter has no Ink: it draws orange instead, four times as wide at 40% opacity. */
|
|
59
|
+
export declare function highlighterStyle(color: PenColor, width: PenWidth): {
|
|
60
|
+
readonly strokeColor: string;
|
|
61
|
+
readonly strokeWidth: number;
|
|
62
|
+
readonly opacity: number;
|
|
63
|
+
};
|
|
64
|
+
export declare function engineStrokeWidth(px: number, freehand: boolean): number;
|
|
65
|
+
export declare function widthUnits(width: PenWidth): number;
|
|
66
|
+
export declare const MIN_ZOOM = 0.1;
|
|
67
|
+
export declare const MAX_ZOOM = 4;
|
|
68
|
+
export declare function clampZoom(zoom: number): number;
|
|
69
|
+
export type Camera = {
|
|
70
|
+
readonly scrollX: number;
|
|
71
|
+
readonly scrollY: number;
|
|
72
|
+
readonly zoom: number;
|
|
73
|
+
};
|
|
74
|
+
export type Viewport = {
|
|
75
|
+
readonly width: number;
|
|
76
|
+
readonly height: number;
|
|
77
|
+
};
|
|
78
|
+
/** The part of the board this camera shows, in board coordinates. */
|
|
79
|
+
export declare function visibleView(camera: Camera, viewport: Viewport, bounds: WhiteboardViewBounds): Omit<ChalkWhiteboardView, "bring">;
|
|
80
|
+
/** Pan to someone else's view without changing the local zoom. */
|
|
81
|
+
export declare function cameraForView(view: Omit<ChalkWhiteboardView, "bring">, viewport: Viewport, zoom: number): Camera;
|
|
82
|
+
/** The camera after zooming to `zoom` around the viewport's centre. */
|
|
83
|
+
export declare function zoomAroundCentre(camera: Camera, viewport: Viewport, zoom: number): Camera;
|
|
84
|
+
export declare function sameCamera(left: Camera, right: Camera): boolean;
|
|
85
|
+
export declare function mixCamera(from: Camera, to: Camera, progress: number): Camera;
|
|
86
|
+
/** A critically damped spring step, exact for any frame time. Returns the new offset from the target and the new velocity. */
|
|
87
|
+
export declare function springStep(offset: number, velocity: number, rate: number, seconds: number): readonly [number, number];
|
|
88
|
+
export declare function readStored<T extends string>(key: string, allowed: readonly {
|
|
89
|
+
readonly id: T;
|
|
90
|
+
}[], fallback: T): T;
|
|
91
|
+
export declare function writeStored(key: string, value: string): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export type BoardToast = {
|
|
3
|
+
readonly message: ReactNode;
|
|
4
|
+
readonly icon?: ReactNode;
|
|
5
|
+
readonly type?: "info" | "success" | "warning" | "error";
|
|
6
|
+
readonly duration?: number;
|
|
7
|
+
readonly action?: {
|
|
8
|
+
readonly label: string;
|
|
9
|
+
readonly onClick: () => void;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/** Null drops the board lifetime’s toasts, including their action callbacks.
|
|
13
|
+
* Board events join the call's own toast stack, so they look, sit and time out like every other toast. */
|
|
14
|
+
export declare const BoardToastContext: import("react").Context<(toast: BoardToast | null) => void>;
|
|
15
|
+
export declare function useBoardToast(lifetime: object | null): (toast: BoardToast) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChalkWhiteboardViewVersions as ViewVersions } from "@q9labsai/chalk-client";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Menu } from "@base-ui/react/menu";
|
|
2
|
+
export { Menu as ChalkMenuPrimitive };
|
|
3
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
4
|
+
export interface ChalkMenuProps {
|
|
5
|
+
readonly trigger: ReactElement;
|
|
6
|
+
readonly onOpenChange?: (open: boolean) => void;
|
|
7
|
+
readonly children: ReactNode;
|
|
8
|
+
readonly side?: "top" | "bottom";
|
|
9
|
+
readonly className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function ChalkMenu({ trigger, children, side, className, onOpenChange }: ChalkMenuProps): import("react").JSX.Element;
|
|
12
|
+
export interface ChalkMenuItemProps {
|
|
13
|
+
readonly children: ReactNode;
|
|
14
|
+
readonly checked?: boolean;
|
|
15
|
+
readonly disabled?: boolean;
|
|
16
|
+
readonly onClick?: () => void;
|
|
17
|
+
readonly closeOnClick?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function ChalkMenuItem({ children, checked, disabled, onClick, closeOnClick }: ChalkMenuItemProps): import("react").JSX.Element;
|
|
20
|
+
export declare function ChalkMenuLabel({ children }: {
|
|
21
|
+
readonly children: ReactNode;
|
|
22
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Popover } from "@base-ui/react/popover";
|
|
2
|
+
export { Popover as ChalkPopoverPrimitive };
|
|
3
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
4
|
+
export declare function ChalkPopover({ trigger, children, label, className, alignOffset, tooltip, open, onOpenChange, }: {
|
|
5
|
+
readonly open?: boolean;
|
|
6
|
+
readonly onOpenChange?: (open: boolean) => void;
|
|
7
|
+
readonly trigger: ReactElement;
|
|
8
|
+
readonly children: ReactNode;
|
|
9
|
+
readonly label: string;
|
|
10
|
+
readonly className?: string;
|
|
11
|
+
readonly tooltip?: string;
|
|
12
|
+
readonly alignOffset?: number;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function useMediaQuery(query: string): boolean;
|
|
2
|
+
export declare function useIsMobile(): boolean;
|
|
3
|
+
export declare function useIsTablet(): boolean;
|
|
4
|
+
export declare function useIsDesktop(): boolean;
|
|
5
|
+
export declare function usePrefersReducedMotion(): boolean;
|
|
6
|
+
export declare function usePrefersDarkMode(): boolean;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -7,3 +7,6 @@ export type { RenderedMathSvg } from "./mathjax-renderer.js";
|
|
|
7
7
|
export type { AppState, BinaryFileData, BinaryFiles, Collaborator, CollaboratorPointer, ExcalidrawElement, ExcalidrawImperativeAPI, OrderedExcalidrawElement } from "../collab/index.js";
|
|
8
8
|
export { CANONICAL_INK } from "../collab/ink.js";
|
|
9
9
|
export { observeEngineHistory, type EngineHistoryState } from "./engine-history.js";
|
|
10
|
+
export { Board, type BoardProps } from "./board/Board.js";
|
|
11
|
+
export { BoardToastContext, type BoardToast } from "./board/board-toasts.js";
|
|
12
|
+
export * from "./board/controls/index.js";
|