@scrawl-board/board 0.1.0-beta.10 → 0.1.0-beta.11
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/browser.d.ts +24 -1
- package/dist/browser.js +58 -7
- package/dist/index.d.ts +130 -9
- package/dist/index.js +1397 -630
- package/dist/react.d.ts +130 -9
- package/dist/react.js +1397 -630
- package/dist/styles.css +383 -94
- package/package.json +1 -1
package/dist/react.d.ts
CHANGED
|
@@ -1323,6 +1323,13 @@ interface BoardSnapshot {
|
|
|
1323
1323
|
readonly readOnly: boolean;
|
|
1324
1324
|
readonly selection: readonly string[];
|
|
1325
1325
|
readonly focusedItem: FocusedItem | null;
|
|
1326
|
+
/**
|
|
1327
|
+
* What an inline editor currently covers, as last set through
|
|
1328
|
+
* `view.setInlineEditing` — a text block (`{ id }`) or a table cell
|
|
1329
|
+
* (`{ id, row, col }`), else null. Chrome uses it to stay out of an open
|
|
1330
|
+
* editor's way.
|
|
1331
|
+
*/
|
|
1332
|
+
readonly inlineEditing: InlineEditingTarget | null;
|
|
1326
1333
|
readonly strokeCount: number;
|
|
1327
1334
|
readonly objectCount: number;
|
|
1328
1335
|
readonly canUndo: boolean;
|
|
@@ -1346,6 +1353,18 @@ interface BoardSnapshot {
|
|
|
1346
1353
|
* shape doesn't carry a holder name, so it always reports `locked: false`
|
|
1347
1354
|
* here, matching the engine's own internal selection-badge behavior.
|
|
1348
1355
|
*/
|
|
1356
|
+
/** Axis-aligned bounds in board space (y up). */
|
|
1357
|
+
interface BoardBounds {
|
|
1358
|
+
readonly minX: number;
|
|
1359
|
+
readonly minY: number;
|
|
1360
|
+
readonly maxX: number;
|
|
1361
|
+
readonly maxY: number;
|
|
1362
|
+
}
|
|
1363
|
+
interface InlineEditingTarget {
|
|
1364
|
+
readonly id: string;
|
|
1365
|
+
readonly row?: number;
|
|
1366
|
+
readonly col?: number;
|
|
1367
|
+
}
|
|
1349
1368
|
interface FocusedItem {
|
|
1350
1369
|
readonly type: "stroke" | "note" | "text" | "table" | "image" | "timer" | "rectangle" | "ellipse" | "group" | "line" | "arrow" | "polygon" | "star" | "heart" | "custom";
|
|
1351
1370
|
readonly id: string;
|
|
@@ -2138,10 +2157,14 @@ interface BoardController {
|
|
|
2138
2157
|
get(id: string): DeepReadonly<BoardObject> | undefined;
|
|
2139
2158
|
all(): readonly DeepReadonly<BoardObject>[];
|
|
2140
2159
|
search(query: string): readonly SearchHit[];
|
|
2160
|
+
/** An object's axis-aligned board-space bounds (y up), or undefined for an unknown id. */
|
|
2161
|
+
bounds(id: string): BoardBounds | undefined;
|
|
2141
2162
|
};
|
|
2142
2163
|
/** Host-owned comments, synced in for search and marker rendering only — see CommentMarker. */
|
|
2143
2164
|
readonly comments: {
|
|
2144
2165
|
sync(comments: readonly CommentMarker[]): void;
|
|
2166
|
+
/** The markers last passed to `sync`, in the order given. */
|
|
2167
|
+
list(): readonly CommentMarker[];
|
|
2145
2168
|
open(id: string): void;
|
|
2146
2169
|
setActive(id: string | null): void;
|
|
2147
2170
|
};
|
|
@@ -2311,6 +2334,62 @@ declare const scrawlThemePresets: Readonly<Record<ScrawlThemePreset, Readonly<Re
|
|
|
2311
2334
|
declare function validateScrawlTheme(theme: ScrawlTheme | Record<string, unknown>): ScrawlThemeDiagnostic[];
|
|
2312
2335
|
declare function resolveScrawlTheme(preset?: ScrawlThemePreset, theme?: ScrawlTheme | Record<string, unknown>): ScrawlResolvedTheme;
|
|
2313
2336
|
|
|
2337
|
+
/** Access levels, shown as View / Edit / Admin. Map your backend's roles onto these. */
|
|
2338
|
+
type BoardRole = "viewer" | "editor" | "admin";
|
|
2339
|
+
interface BoardMember {
|
|
2340
|
+
id: string;
|
|
2341
|
+
name: string;
|
|
2342
|
+
email?: string;
|
|
2343
|
+
avatarUrl?: string;
|
|
2344
|
+
online?: boolean;
|
|
2345
|
+
role: BoardRole;
|
|
2346
|
+
}
|
|
2347
|
+
interface BoardRoleChange {
|
|
2348
|
+
memberId: string;
|
|
2349
|
+
role: BoardRole;
|
|
2350
|
+
}
|
|
2351
|
+
interface BoardPermissions {
|
|
2352
|
+
members: readonly BoardMember[];
|
|
2353
|
+
/** Marks "(you)" and keeps your own access level from being changed here. */
|
|
2354
|
+
currentUserId?: string;
|
|
2355
|
+
/** Whether "Manage permissions" is offered at all — your rule, from your backend. */
|
|
2356
|
+
canManage: boolean;
|
|
2357
|
+
/**
|
|
2358
|
+
* Called with every pending change when Save is pressed. Resolve once your
|
|
2359
|
+
* backend accepted them; reject to show the error and keep them pending.
|
|
2360
|
+
* Nothing changes until your backend says so — update `members` afterwards.
|
|
2361
|
+
*/
|
|
2362
|
+
onSave(changes: readonly BoardRoleChange[]): Promise<void>;
|
|
2363
|
+
}
|
|
2364
|
+
type BoardActivityKind = "added" | "removed" | "updated" | "commented" | "shared" | "exported";
|
|
2365
|
+
interface BoardActivityEntry {
|
|
2366
|
+
id: string;
|
|
2367
|
+
kind: BoardActivityKind;
|
|
2368
|
+
/** e.g. "Added a sticky note". */
|
|
2369
|
+
title: string;
|
|
2370
|
+
actorName?: string;
|
|
2371
|
+
/** When it happened (ms since epoch or ISO string). */
|
|
2372
|
+
at: number | string;
|
|
2373
|
+
/** Board point to jump to, if the action has a place on the board. */
|
|
2374
|
+
location?: BoardPoint;
|
|
2375
|
+
}
|
|
2376
|
+
interface BoardActivityFeed {
|
|
2377
|
+
/** Newest first. Omit to show this session's own actions instead. */
|
|
2378
|
+
entries?: readonly BoardActivityEntry[];
|
|
2379
|
+
unreadCount?: number;
|
|
2380
|
+
onMarkAllRead?(): void;
|
|
2381
|
+
}
|
|
2382
|
+
interface BoardCommentFeed {
|
|
2383
|
+
unreadCount?: number;
|
|
2384
|
+
onMarkAllRead?(): void;
|
|
2385
|
+
}
|
|
2386
|
+
interface BoardMenuItem {
|
|
2387
|
+
id: string;
|
|
2388
|
+
label: string;
|
|
2389
|
+
icon?: ReactNode;
|
|
2390
|
+
onSelect(): void;
|
|
2391
|
+
}
|
|
2392
|
+
|
|
2314
2393
|
interface CommentAuthor {
|
|
2315
2394
|
name: string;
|
|
2316
2395
|
color?: string;
|
|
@@ -2331,6 +2410,26 @@ interface DefaultBoardChromeProps {
|
|
|
2331
2410
|
icons?: Partial<Record<BuiltInTool, ReactNode>>;
|
|
2332
2411
|
/** Name (and pin colour) shown on comments left through the default comment UI. Defaults to "You". */
|
|
2333
2412
|
commentAuthor?: CommentAuthor;
|
|
2413
|
+
/**
|
|
2414
|
+
* Sharing is the Host's own (links, permissions, backends), so the board
|
|
2415
|
+
* actions only offer a Share button when this is supplied.
|
|
2416
|
+
*/
|
|
2417
|
+
onShare?(): void;
|
|
2418
|
+
/**
|
|
2419
|
+
* Your backend's activity feed for the Recent Activity drawer. Without
|
|
2420
|
+
* `entries`, the drawer lists this session's own board actions.
|
|
2421
|
+
*/
|
|
2422
|
+
activity?: BoardActivityFeed;
|
|
2423
|
+
/** Unread state for the Comments drawer's badge and "Mark all as read". */
|
|
2424
|
+
commentFeed?: BoardCommentFeed;
|
|
2425
|
+
/**
|
|
2426
|
+
* Members and access levels from your backend, for the permissions drawer
|
|
2427
|
+
* (offered in the More menu when `canManage`). The SDK never changes a role
|
|
2428
|
+
* itself: Save calls `onSave`, and your backend decides.
|
|
2429
|
+
*/
|
|
2430
|
+
permissions?: BoardPermissions;
|
|
2431
|
+
/** Extra More-menu actions your app provides (board settings, version history, duplicate…). */
|
|
2432
|
+
menuItems?: readonly BoardMenuItem[];
|
|
2334
2433
|
}
|
|
2335
2434
|
|
|
2336
2435
|
/**
|
|
@@ -2339,7 +2438,7 @@ interface DefaultBoardChromeProps {
|
|
|
2339
2438
|
* Turn either off when the Host handles `comment-draft-request`/
|
|
2340
2439
|
* `comment-open-request` or `import-request` itself.
|
|
2341
2440
|
*/
|
|
2342
|
-
type DefaultUIRegion = "tools" | "history" | "view" | "style" | "search" | "import" | "export" | "inlineEditing" | "styleShelf" | "focusedItemToolbar" | "emptyState" | "pages" | "comments" | "images";
|
|
2441
|
+
type DefaultUIRegion = "tools" | "history" | "view" | "style" | "search" | "import" | "export" | "inlineEditing" | "styleShelf" | "focusedItemToolbar" | "emptyState" | "pages" | "comments" | "images" | "activity";
|
|
2343
2442
|
/** Props for the toolbar/topBar/stylePanel/contextMenu slots. */
|
|
2344
2443
|
interface BoardSlotProps {
|
|
2345
2444
|
controller: BoardController;
|
|
@@ -2367,7 +2466,7 @@ interface DefaultUISlots {
|
|
|
2367
2466
|
*/
|
|
2368
2467
|
contextMenu?: ComponentType<BoardSlotProps> | null;
|
|
2369
2468
|
}
|
|
2370
|
-
declare function DefaultBoardChrome({ controller, snapshot, renderPortal, className, style, regions, slots, icons, commentAuthor }: DefaultBoardChromeProps): react.JSX.Element;
|
|
2469
|
+
declare function DefaultBoardChrome({ controller, snapshot, renderPortal, className, style, regions, slots, icons, commentAuthor, onShare, activity, commentFeed, permissions, menuItems }: DefaultBoardChromeProps): react.JSX.Element;
|
|
2371
2470
|
|
|
2372
2471
|
interface InlineEditorsProps {
|
|
2373
2472
|
controller: BoardController;
|
|
@@ -2400,9 +2499,11 @@ interface FocusedItemToolbarProps {
|
|
|
2400
2499
|
* Floating toolbar above the focused note, shape, text block, or semantic
|
|
2401
2500
|
* Rectangle/Ellipse — Colour, Size (note/text) or Width (shape), Fill/Stroke
|
|
2402
2501
|
* (Rectangle/Ellipse), Lock/Unlock, Duplicate, Delete. Images (photos and
|
|
2403
|
-
* placed emoji/icons) get Lock/Duplicate/Delete only —
|
|
2404
|
-
* already
|
|
2405
|
-
*
|
|
2502
|
+
* placed emoji/icons) and tables get Lock/Duplicate/Delete only — each
|
|
2503
|
+
* already has its own resize affordance (the native gizmo for images, edge
|
|
2504
|
+
* handles for tables), and a table's row/column actions live in its cell
|
|
2505
|
+
* editor. Timer/custom objects and plain (non-shape) ink strokes never get a
|
|
2506
|
+
* toolbar here — out of scope for this destination.
|
|
2406
2507
|
*
|
|
2407
2508
|
* Rectangle/Ellipse (Phase 2) are a second, parallel "shape" concept from
|
|
2408
2509
|
* the legacy ink-stroke shape below: both draw from the same toolbar
|
|
@@ -2496,6 +2597,16 @@ interface ScrawlProps extends Omit<CreateBoardControllerOptions, "canvas"> {
|
|
|
2496
2597
|
* SDK's default UI). See DefaultBoardChromeProps.icons.
|
|
2497
2598
|
*/
|
|
2498
2599
|
icons?: Partial<Record<BuiltInTool, ReactNode>>;
|
|
2600
|
+
/** Offer a Share button in the default UI's board actions — see DefaultBoardChromeProps.onShare. */
|
|
2601
|
+
onShare?(): void;
|
|
2602
|
+
/** Your backend's activity feed — see DefaultBoardChromeProps.activity. */
|
|
2603
|
+
activity?: BoardActivityFeed;
|
|
2604
|
+
/** Unread state for the Comments drawer — see DefaultBoardChromeProps.commentFeed. */
|
|
2605
|
+
commentFeed?: BoardCommentFeed;
|
|
2606
|
+
/** Members and access levels from your backend — see DefaultBoardChromeProps.permissions. */
|
|
2607
|
+
permissions?: BoardPermissions;
|
|
2608
|
+
/** Extra More-menu actions — see DefaultBoardChromeProps.menuItems. */
|
|
2609
|
+
menuItems?: readonly BoardMenuItem[];
|
|
2499
2610
|
}
|
|
2500
2611
|
/**
|
|
2501
2612
|
* The fastest path to an embedded Board: creates and owns a
|
|
@@ -2508,7 +2619,7 @@ interface ScrawlProps extends Omit<CreateBoardControllerOptions, "canvas"> {
|
|
|
2508
2619
|
* field except `canvas` (pass `canvas={null}` for a headless board, or an
|
|
2509
2620
|
* existing `<canvas>` element to control its identity yourself).
|
|
2510
2621
|
*/
|
|
2511
|
-
declare function Scrawl({ children, preset, theme, portalContainer, className, style, onReady, onError, onThemeDiagnostic, canvas: suppliedCanvas, icons, ...options }: ScrawlProps): react.JSX.Element;
|
|
2622
|
+
declare function Scrawl({ children, preset, theme, portalContainer, className, style, onReady, onError, onThemeDiagnostic, canvas: suppliedCanvas, icons, onShare, activity, commentFeed, permissions, menuItems, ...options }: ScrawlProps): react.JSX.Element;
|
|
2512
2623
|
interface ScrawlCanvasProps {
|
|
2513
2624
|
element?: HTMLCanvasElement;
|
|
2514
2625
|
className?: string;
|
|
@@ -2527,8 +2638,18 @@ interface ScrawlDefaultUIProps {
|
|
|
2527
2638
|
icons?: Partial<Record<BuiltInTool, ReactNode>>;
|
|
2528
2639
|
/** Author shown on comments left through the default comment UI — see DefaultBoardChromeProps.commentAuthor. */
|
|
2529
2640
|
commentAuthor?: CommentAuthor;
|
|
2530
|
-
|
|
2531
|
-
|
|
2641
|
+
/** Supply to offer a Share button in the board actions — see DefaultBoardChromeProps.onShare. */
|
|
2642
|
+
onShare?(): void;
|
|
2643
|
+
/** Your backend's activity feed — see DefaultBoardChromeProps.activity. */
|
|
2644
|
+
activity?: BoardActivityFeed;
|
|
2645
|
+
/** Unread state for the Comments drawer — see DefaultBoardChromeProps.commentFeed. */
|
|
2646
|
+
commentFeed?: BoardCommentFeed;
|
|
2647
|
+
/** Members and access levels from your backend — see DefaultBoardChromeProps.permissions. */
|
|
2648
|
+
permissions?: BoardPermissions;
|
|
2649
|
+
/** Extra More-menu actions — see DefaultBoardChromeProps.menuItems. */
|
|
2650
|
+
menuItems?: readonly BoardMenuItem[];
|
|
2651
|
+
}
|
|
2652
|
+
declare function ScrawlDefaultUI({ className, style, regions, slots, icons, commentAuthor, onShare, activity, commentFeed, permissions, menuItems }: ScrawlDefaultUIProps): react.JSX.Element;
|
|
2532
2653
|
declare function ScrawlPortal({ children }: {
|
|
2533
2654
|
children: ReactNode;
|
|
2534
2655
|
}): react.ReactPortal | null;
|
|
@@ -2578,4 +2699,4 @@ type ScrawlBoardProps = {
|
|
|
2578
2699
|
declare function ScrawlBoard({ documentId, initialDocument, onReady, className, style }: ScrawlBoardProps): react.JSX.Element;
|
|
2579
2700
|
|
|
2580
2701
|
export { AssetResolutionError, DefaultBoardChrome, FocusedItemToolbar, InlineEditors, MultiplayerCursors, SUPPORTED_ASSET_MEDIA_TYPES, Scrawl, ScrawlBoard, ScrawlCanvas, ScrawlDefaultUI, ScrawlPortal, ScrawlProvider, StyleShelf, assetRef, clampAssetCacheBytes, cloneCustomObject, isAssetRef, resolveScrawlTheme, scrawlThemePresets, useCollaborationStatus, usePersistenceStatus, usePresence, useScrawlController, useScrawlSnapshot, useScrawlTheme, validateScrawlTheme };
|
|
2581
|
-
export type { AssetDiagnostic, AssetExportFailure, AssetIngestRequest, AssetIngestResult, AssetIngestor, AssetKind, AssetPurpose, AssetRef, AssetResolutionErrorCode, AssetResolveRequest, AssetResolveResult, AssetResolver, BoardController, BoardKeyInput, BoardNotebook, BoardPage, BoardPointerInput, BoardScene, BoardSection, BoardSlotProps, BoardSnapshot, BoardStyle, BoardThemeOptions, CollaborationSnapshot, CommentAuthor, CommentMarker, CreateBoardControllerOptions, CustomBoardObject, CustomObjectAddInput, CustomObjectDefinition, CustomTool, CustomToolDefinition, DefaultBoardChromeProps, DefaultUIRegion, DefaultUISlot, DefaultUISlots, DialogSlotProps, ExportDocumentSVGOptions, ExportDocumentSVGResult, ExtensionCommand, ExtensionDiagnostic, ExtensionHitResult, ExtensionId, ExtensionRequirement, FocusedItem, FocusedItemToolbarProps, InlineEditorsProps, InputModifiers, JsonObject, JsonValue, LocalBoard, LocalBoardSnapshot, LocalPresence, 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, SearchHit, SearchHitKind, SearchableComment, StyleShelfProps, SupportedAssetMediaType, ToolCancelReason, ToolCapabilities, ToolCursor, ToolId };
|
|
2702
|
+
export type { AssetDiagnostic, AssetExportFailure, AssetIngestRequest, AssetIngestResult, AssetIngestor, AssetKind, AssetPurpose, AssetRef, AssetResolutionErrorCode, AssetResolveRequest, AssetResolveResult, AssetResolver, BoardActivityEntry, BoardActivityFeed, BoardActivityKind, BoardBounds, BoardCommentFeed, BoardController, BoardKeyInput, BoardMember, BoardMenuItem, BoardNotebook, BoardPage, BoardPermissions, BoardPoint, BoardPointerInput, BoardRole, BoardRoleChange, BoardScene, BoardSection, BoardSlotProps, BoardSnapshot, BoardStyle, BoardThemeOptions, CollaborationSnapshot, CommentAuthor, CommentMarker, CreateBoardControllerOptions, CustomBoardObject, CustomObjectAddInput, CustomObjectDefinition, CustomTool, CustomToolDefinition, DefaultBoardChromeProps, DefaultUIRegion, DefaultUISlot, DefaultUISlots, DialogSlotProps, ExportDocumentSVGOptions, ExportDocumentSVGResult, ExtensionCommand, ExtensionDiagnostic, ExtensionHitResult, ExtensionId, ExtensionRequirement, FocusedItem, FocusedItemToolbarProps, InlineEditorsProps, InputModifiers, JsonObject, JsonValue, LocalBoard, LocalBoardSnapshot, LocalPresence, 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, SearchHit, SearchHitKind, SearchableComment, StyleShelfProps, SupportedAssetMediaType, ToolCancelReason, ToolCapabilities, ToolCursor, ToolId };
|