@scrawl-board/board 0.1.0-beta.1 → 0.1.0-beta.3

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/react.d.ts CHANGED
@@ -371,8 +371,13 @@ interface StrokePoint extends BoardPoint {
371
371
  */
372
372
  erase?: number;
373
373
  }
374
- /** Which drawing tool made a stroke; undefined means marker (back-compat). */
375
- type StrokeTool = "marker" | "highlighter";
374
+ /**
375
+ * Which drawing tool made a stroke; undefined means marker (back-compat).
376
+ * `"shape"` (rect/ellipse/line/arrow/polygon/star/heart) renders at its
377
+ * exact configured width with no pressure variance or end taper — a
378
+ * geometric outline, not an expressive ink mark.
379
+ */
380
+ type StrokeTool = "marker" | "highlighter" | "shape";
376
381
  interface Stroke extends Lockable {
377
382
  id: string;
378
383
  color: string;
@@ -685,6 +690,27 @@ interface BoardView {
685
690
  y: number;
686
691
  zoom: number;
687
692
  }
693
+ /**
694
+ * The rendered board surface's color, reference grid, and shape stroke
695
+ * width — the subset of {@link ScrawlTheme} that reaches the rendering
696
+ * engine directly (everything else is UI-chrome-only, applied as CSS). Any
697
+ * field left unset keeps its current value.
698
+ */
699
+ interface BoardThemeOptions {
700
+ /** The board/canvas background color — distinct from UI chrome panels. */
701
+ surface?: string;
702
+ /** `"flat"` (default): a plain, uniform board surface. `"textured"`: a subtle "melamine" micro-noise + satin sheen, like a physical whiteboard. */
703
+ surfaceTexture?: "flat" | "textured";
704
+ /** `"none"` (default) keeps the board a plain surface; `"line"`/`"dot"` draw a zoom-adaptive reference grid. */
705
+ gridMode?: "none" | "line" | "dot";
706
+ gridColor?: string;
707
+ /** Grid spacing in board units at 100% zoom. Ignored when `gridMode` is `"none"`. */
708
+ gridSpacing?: number;
709
+ /** On-screen grid line/dot width in CSS pixels — stays this width at any zoom, since the grid is a reference aid, not content. */
710
+ gridLineWidth?: number;
711
+ /** Shape (rectangle, ellipse, arrow, ...) border width, in board units — scales with zoom like ink, since it's part of the drawn content. */
712
+ shapeStrokeWidth?: number;
713
+ }
688
714
  /**
689
715
  * A Host-owned comment, summarized for Board-side search and marker
690
716
  * rendering. Comments are not Document content — they carry no undo
@@ -895,12 +921,7 @@ interface CreateBoardControllerOptions {
895
921
  * changes via `boardTheme.set` below — a headless/browser-tier Host that
896
922
  * doesn't use the React theme system can set this directly instead.
897
923
  */
898
- boardTheme?: {
899
- surface?: string;
900
- gridMode?: "none" | "line" | "dot";
901
- gridColor?: string;
902
- gridSpacing?: number;
903
- };
924
+ boardTheme?: BoardThemeOptions;
904
925
  }
905
926
  interface BoardController {
906
927
  readonly document: ReadonlyBoardDocument;
@@ -927,13 +948,8 @@ interface BoardController {
927
948
  redo(): void;
928
949
  };
929
950
  readonly boardTheme: {
930
- /** Live update of the board surface color/grid — the controller's identity stays fixed across theme changes. */
931
- set(theme: {
932
- surface?: string;
933
- gridMode?: "none" | "line" | "dot";
934
- gridColor?: string;
935
- gridSpacing?: number;
936
- }): void;
951
+ /** Live update of the board surface color/grid/shape-stroke-width — the controller's identity stays fixed across theme changes. */
952
+ set(theme: BoardThemeOptions): void;
937
953
  };
938
954
  readonly view: {
939
955
  fit(): void;
@@ -1032,37 +1048,82 @@ type LocalBoard = {
1032
1048
  type ScrawlThemePreset = "light" | "dark";
1033
1049
  type ScrawlDensity = "comfortable" | "compact";
1034
1050
  type ScrawlGridMode = "none" | "line" | "dot";
1051
+ type ScrawlSurfaceTexture = "flat" | "textured";
1052
+ /**
1053
+ * Every field is optional — anything you don't set falls back to the
1054
+ * chosen `preset` ("light" or "dark", see {@link resolveScrawlTheme}).
1055
+ * Overrides are semantic, board-local runtime configuration: they never
1056
+ * get written into the Document or into exports, so switching themes is
1057
+ * always non-destructive.
1058
+ */
1035
1059
  interface ScrawlTheme {
1060
+ /** UI chrome background — toolbar/panel base surface. Distinct from `boardSurface` (the canvas itself). */
1036
1061
  surface?: string;
1062
+ /** UI chrome background, one step up from `surface` — popovers, dropdowns, elevated panels. */
1037
1063
  surfaceRaised?: string;
1064
+ /** UI chrome background, one step down from `surface` — subtle fills, hover states. */
1038
1065
  surfaceMuted?: string;
1066
+ /** Primary UI text color. Checked for contrast against `surface`. */
1039
1067
  text?: string;
1068
+ /** Secondary/de-emphasized UI text color. Checked for contrast against `surface`. */
1040
1069
  textMuted?: string;
1070
+ /** Borders and dividers between UI chrome elements. */
1041
1071
  edge?: string;
1072
+ /**
1073
+ * Brand accent color. Drives the active/selected state of toolbar
1074
+ * controls (e.g. the active tool button): its icon/text render in this
1075
+ * color, and its background is automatically derived as a light tint of
1076
+ * it (via `color-mix`) — set this one token and both follow.
1077
+ */
1078
+ primary?: string;
1079
+ /** Focus ring color. Checked for contrast against `surface`. */
1042
1080
  focus?: string;
1081
+ /** Selection highlight color (e.g. selected list items, not board object selection). */
1043
1082
  selection?: string;
1083
+ /** Destructive/error state color (delete confirmations, error text). */
1044
1084
  danger?: string;
1085
+ /** Warning state color. */
1045
1086
  warning?: string;
1087
+ /** Success/confirmation state color. */
1046
1088
  success?: string;
1089
+ /** Font stack for UI chrome (toolbar labels, menus, dialogs). */
1047
1090
  uiFontFamily?: string;
1091
+ /** Font stack for board content and data (e.g. table cell text). */
1048
1092
  dataFontFamily?: string;
1093
+ /** Base UI font size in px. Range: 12–24. */
1049
1094
  baseFontSize?: number;
1095
+ /** Regular UI font weight. Range: 300–900. */
1050
1096
  regularWeight?: number;
1097
+ /** Emphasized UI font weight (headings, active states). Range: 300–900. */
1051
1098
  strongWeight?: number;
1099
+ /** Corner radius for small controls (buttons, inputs) in px. Range: 0–32. */
1052
1100
  controlRadius?: number;
1101
+ /** Corner radius for panels/dialogs in px. Range: 0–32. */
1053
1102
  panelRadius?: number;
1103
+ /** CSS `box-shadow` value for subtle elevation (e.g. toolbar). */
1054
1104
  elevationLow?: string;
1105
+ /** CSS `box-shadow` value for prominent elevation (e.g. modals). */
1055
1106
  elevationHigh?: string;
1107
+ /** UI transition duration in ms. Range: 0–500. */
1056
1108
  motionDuration?: number;
1109
+ /** CSS easing function for UI transitions. */
1057
1110
  motionEasing?: string;
1111
+ /** UI chrome spacing/sizing scale. */
1058
1112
  density?: ScrawlDensity;
1059
1113
  /** The rendered board/canvas surface color — distinct from `surface` (UI chrome panels). */
1060
1114
  boardSurface?: string;
1115
+ /** `"flat"` (default): a plain, uniform board surface. `"textured"`: a subtle "melamine" micro-noise + satin sheen, like a physical whiteboard. */
1116
+ boardSurfaceTexture?: ScrawlSurfaceTexture;
1061
1117
  /** `"none"` (default) keeps the board a plain surface; `"line"`/`"dot"` draw a zoom-adaptive reference grid. */
1062
1118
  gridMode?: ScrawlGridMode;
1119
+ /** Grid line/dot color. Ignored when `gridMode` is `"none"`. */
1063
1120
  gridColor?: string;
1064
1121
  /** Grid spacing in board units at 100% zoom. Ignored when `gridMode` is `"none"`. */
1065
1122
  gridSpacing?: number;
1123
+ /** On-screen grid line/dot width in CSS pixels. Range: 0.5–8. A reference aid, so unlike shape/ink strokes it stays this width at any zoom. */
1124
+ gridLineWidth?: number;
1125
+ /** Shape (rectangle, ellipse, arrow, ...) border width, in board units. Range: 0.01–5. Scales with zoom like ink, since it's part of the drawn content. */
1126
+ shapeStrokeWidth?: number;
1066
1127
  }
1067
1128
  type ResolvedScrawlTheme = Required<ScrawlTheme>;
1068
1129
  interface ScrawlThemeDiagnostic {
@@ -1087,6 +1148,19 @@ interface DefaultBoardChromeProps {
1087
1148
  style?: React.CSSProperties;
1088
1149
  regions?: Partial<Record<DefaultUIRegion, boolean>>;
1089
1150
  slots?: DefaultUISlots;
1151
+ /**
1152
+ * Swap in your own icon for a tool's primary toolbar button — pass any
1153
+ * icon from any library (`<Pencil />`, `<Icon icon="..." />`, an inline
1154
+ * `<svg>`, whatever). A tool with no entry here keeps its default text
1155
+ * label, so this is opt-in per tool, not all-or-nothing. Aria labeling
1156
+ * and the keyboard-shortcut tooltip stay text-based regardless, so the
1157
+ * board remains fully accessible even with icon-only buttons.
1158
+ *
1159
+ * Only affects the six primary toolbar buttons (select/marker/
1160
+ * highlighter/eraser/note/text) — the "more tools" overflow menu is a
1161
+ * native `<select>`, which can only render plain text `<option>`s.
1162
+ */
1163
+ icons?: Partial<Record<BuiltInTool, ReactNode>>;
1090
1164
  }
1091
1165
  type DefaultUIRegion = "tools" | "history" | "view" | "style" | "search" | "import" | "export" | "inlineEditing" | "styleShelf";
1092
1166
  /** Props for the toolbar/topBar/stylePanel/contextMenu slots. */
@@ -1116,7 +1190,7 @@ interface DefaultUISlots {
1116
1190
  */
1117
1191
  contextMenu?: ComponentType<BoardSlotProps> | null;
1118
1192
  }
1119
- declare function DefaultBoardChrome({ controller, snapshot, renderPortal, className, style, regions, slots }: DefaultBoardChromeProps): react.JSX.Element;
1193
+ declare function DefaultBoardChrome({ controller, snapshot, renderPortal, className, style, regions, slots, icons }: DefaultBoardChromeProps): react.JSX.Element;
1120
1194
 
1121
1195
  interface InlineEditorsProps {
1122
1196
  controller: BoardController;
@@ -1173,8 +1247,14 @@ interface ScrawlProps extends Omit<CreateBoardControllerOptions, "canvas"> {
1173
1247
  onThemeDiagnostic?: (diagnostic: ScrawlThemeDiagnostic) => void;
1174
1248
  /** Provide null for a headless Board, or an existing canvas to control its identity. */
1175
1249
  canvas?: HTMLCanvasElement | null;
1250
+ /**
1251
+ * Per-tool icon override for the default toolbar's primary buttons —
1252
+ * only applies when you don't supply `children` (i.e. you're using the
1253
+ * SDK's default UI). See DefaultBoardChromeProps.icons.
1254
+ */
1255
+ icons?: Partial<Record<BuiltInTool, ReactNode>>;
1176
1256
  }
1177
- declare function Scrawl({ children, preset, theme, portalContainer, className, style, onReady, onError, onThemeDiagnostic, canvas: suppliedCanvas, ...options }: ScrawlProps): react.JSX.Element;
1257
+ declare function Scrawl({ children, preset, theme, portalContainer, className, style, onReady, onError, onThemeDiagnostic, canvas: suppliedCanvas, icons, ...options }: ScrawlProps): react.JSX.Element;
1178
1258
  interface ScrawlCanvasProps {
1179
1259
  element?: HTMLCanvasElement;
1180
1260
  className?: string;
@@ -1189,8 +1269,10 @@ interface ScrawlDefaultUIProps {
1189
1269
  regions?: Partial<Record<DefaultUIRegion, boolean>>;
1190
1270
  /** Replace (component) or hide (null) a coarse region; omit for the SDK default. */
1191
1271
  slots?: DefaultUISlots;
1272
+ /** Per-tool icon override for the primary toolbar buttons — see DefaultBoardChromeProps.icons. */
1273
+ icons?: Partial<Record<BuiltInTool, ReactNode>>;
1192
1274
  }
1193
- declare function ScrawlDefaultUI({ className, style, regions, slots }: ScrawlDefaultUIProps): react.JSX.Element;
1275
+ declare function ScrawlDefaultUI({ className, style, regions, slots, icons }: ScrawlDefaultUIProps): react.JSX.Element;
1194
1276
  declare function ScrawlPortal({ children }: {
1195
1277
  children: ReactNode;
1196
1278
  }): react.ReactPortal | null;
@@ -1207,4 +1289,4 @@ type ScrawlBoardProps = {
1207
1289
  declare function ScrawlBoard({ documentId, initialDocument, onReady, className, style }: ScrawlBoardProps): react.JSX.Element;
1208
1290
 
1209
1291
  export { AssetResolutionError, DefaultBoardChrome, InlineEditors, MultiplayerCursors, SUPPORTED_ASSET_MEDIA_TYPES, Scrawl, ScrawlBoard, ScrawlCanvas, ScrawlDefaultUI, ScrawlPortal, ScrawlProvider, StyleShelf, assetRef, clampAssetCacheBytes, cloneCustomObject, isAssetRef, resolveScrawlTheme, scrawlThemePresets, useScrawlController, useScrawlSnapshot, useScrawlTheme, validateScrawlTheme };
1210
- export type { AssetDiagnostic, AssetIngestRequest, AssetIngestResult, AssetIngestor, AssetKind, AssetPurpose, AssetRef, AssetResolutionErrorCode, AssetResolveRequest, AssetResolveResult, AssetResolver, BoardController, BoardKeyInput, BoardPointerInput, BoardScene, BoardSlotProps, BoardSnapshot, BoardStyle, CommentMarker, CreateBoardControllerOptions, CustomBoardObject, CustomObjectAddInput, CustomObjectDefinition, CustomTool, CustomToolDefinition, DefaultBoardChromeProps, DefaultUIRegion, DefaultUISlot, DefaultUISlots, DialogSlotProps, ExtensionCommand, ExtensionDiagnostic, ExtensionHitResult, ExtensionId, ExtensionRequirement, InlineEditorsProps, InputModifiers, JsonObject, JsonValue, LocalBoard, LocalBoardSnapshot, Mat2x3, MultiplayerCursorsProps, ObjectDescribeContext, ObjectIntent, ObjectType, PresenceCursor, PresenceUser, PresenceView, QueryableBoardObject, ReadonlyCustomObject, SceneEllipse, SceneGroup, SceneImage, ScenePath, SceneRect, SceneText, ScrawlBoardProps, ScrawlCanvasProps, ScrawlDefaultUIProps, ScrawlDensity, ScrawlExtension, ScrawlGridMode, ScrawlProps, ScrawlProviderProps, ScrawlResolvedTheme, ScrawlTheme, ScrawlThemeDiagnostic, ScrawlThemePreset, StyleShelfProps, SupportedAssetMediaType, ToolCancelReason, ToolCapabilities, ToolCursor, ToolId };
1292
+ export type { AssetDiagnostic, AssetIngestRequest, AssetIngestResult, AssetIngestor, AssetKind, AssetPurpose, AssetRef, AssetResolutionErrorCode, AssetResolveRequest, AssetResolveResult, AssetResolver, BoardController, BoardKeyInput, BoardPointerInput, BoardScene, BoardSlotProps, BoardSnapshot, BoardStyle, BoardThemeOptions, CommentMarker, CreateBoardControllerOptions, CustomBoardObject, CustomObjectAddInput, CustomObjectDefinition, CustomTool, CustomToolDefinition, DefaultBoardChromeProps, DefaultUIRegion, DefaultUISlot, DefaultUISlots, DialogSlotProps, ExtensionCommand, ExtensionDiagnostic, ExtensionHitResult, ExtensionId, ExtensionRequirement, InlineEditorsProps, InputModifiers, JsonObject, JsonValue, LocalBoard, LocalBoardSnapshot, Mat2x3, MultiplayerCursorsProps, ObjectDescribeContext, ObjectIntent, ObjectType, PresenceCursor, PresenceUser, PresenceView, QueryableBoardObject, ReadonlyCustomObject, SceneEllipse, SceneGroup, SceneImage, ScenePath, SceneRect, SceneText, ScrawlBoardProps, ScrawlCanvasProps, ScrawlDefaultUIProps, ScrawlDensity, ScrawlExtension, ScrawlGridMode, ScrawlProps, ScrawlProviderProps, ScrawlResolvedTheme, ScrawlSurfaceTexture, ScrawlTheme, ScrawlThemeDiagnostic, ScrawlThemePreset, StyleShelfProps, SupportedAssetMediaType, ToolCancelReason, ToolCapabilities, ToolCursor, ToolId };