@scrawl-board/board 0.1.0-beta.4 → 0.1.0-beta.6
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 +34 -1
- package/dist/browser.js +301 -46
- package/dist/core.d.ts +12 -0
- package/dist/core.js +18 -2
- package/dist/index.d.ts +93 -4
- package/dist/index.js +715 -60
- package/dist/react.d.ts +81 -4
- package/dist/react.js +715 -60
- package/dist/styles.css +62 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -495,9 +495,21 @@ declare const HIGHLIGHT_COLORS: {
|
|
|
495
495
|
};
|
|
496
496
|
declare const NOTE_COLORS: {
|
|
497
497
|
readonly yellow: "#FDE68A";
|
|
498
|
+
readonly amber: "#FCD34D";
|
|
499
|
+
readonly orange: "#FDBA74";
|
|
500
|
+
readonly peach: "#FED7AA";
|
|
501
|
+
readonly red: "#FCA5A5";
|
|
502
|
+
readonly rose: "#FECACA";
|
|
498
503
|
readonly pink: "#FBCFE8";
|
|
504
|
+
readonly magenta: "#F9A8D4";
|
|
505
|
+
readonly purple: "#D8B4FE";
|
|
506
|
+
readonly lavender: "#E9D5FF";
|
|
499
507
|
readonly blue: "#BFDBFE";
|
|
508
|
+
readonly cornflower: "#93C5FD";
|
|
509
|
+
readonly sky: "#7DD3FC";
|
|
510
|
+
readonly cyan: "#BAE6FD";
|
|
500
511
|
readonly green: "#BBF7D0";
|
|
512
|
+
readonly mint: "#86EFAC";
|
|
501
513
|
};
|
|
502
514
|
/**
|
|
503
515
|
* One collaborator's vote on a note. One per person; toggling removes it.
|
|
@@ -1215,6 +1227,7 @@ interface BoardSnapshot {
|
|
|
1215
1227
|
readonly zoom: number;
|
|
1216
1228
|
readonly readOnly: boolean;
|
|
1217
1229
|
readonly selection: readonly string[];
|
|
1230
|
+
readonly focusedItem: FocusedItem | null;
|
|
1218
1231
|
readonly strokeCount: number;
|
|
1219
1232
|
readonly objectCount: number;
|
|
1220
1233
|
readonly canUndo: boolean;
|
|
@@ -1225,6 +1238,27 @@ interface BoardSnapshot {
|
|
|
1225
1238
|
readonly collaboration: CollaborationSnapshot;
|
|
1226
1239
|
};
|
|
1227
1240
|
}
|
|
1241
|
+
/**
|
|
1242
|
+
* `selection` collapsed into the one thing a selected-object toolbar needs:
|
|
1243
|
+
* what's selected, its lock state, and where to anchor above it. `null`
|
|
1244
|
+
* when nothing is selected, or when the selection mixes types/objects that
|
|
1245
|
+
* don't resolve to a single focus (anything but one object, or several
|
|
1246
|
+
* strokes sharing a `clusterId` — a multi-stroke shape).
|
|
1247
|
+
*
|
|
1248
|
+
* Raw lock fields, not a derived `canUnlock` — this API has no notion of
|
|
1249
|
+
* "the local user" to judge that against (see `canUnlockItem` in `../core`,
|
|
1250
|
+
* which takes a `userId` the Host already owns). A Custom object's lock
|
|
1251
|
+
* shape doesn't carry a holder name, so it always reports `locked: false`
|
|
1252
|
+
* here, matching the engine's own internal selection-badge behavior.
|
|
1253
|
+
*/
|
|
1254
|
+
interface FocusedItem {
|
|
1255
|
+
readonly type: "stroke" | "note" | "text" | "table" | "image" | "timer" | "custom";
|
|
1256
|
+
readonly id: string;
|
|
1257
|
+
readonly locked: boolean;
|
|
1258
|
+
readonly lockedBy?: string;
|
|
1259
|
+
readonly lockedByName?: string;
|
|
1260
|
+
readonly screenPosition?: ScreenPoint;
|
|
1261
|
+
}
|
|
1228
1262
|
interface BoardControllerError {
|
|
1229
1263
|
source: "controller" | "renderer" | "persistence" | "collaboration";
|
|
1230
1264
|
code: string;
|
|
@@ -1591,6 +1625,17 @@ interface BoardController {
|
|
|
1591
1625
|
add(input: BoardObjectInput): string;
|
|
1592
1626
|
update(id: string, patch: BoardObjectPatch): void;
|
|
1593
1627
|
remove(ids: readonly string[]): void;
|
|
1628
|
+
/**
|
|
1629
|
+
* Clone each given object as a new, unlocked copy offset by a small
|
|
1630
|
+
* fixed cascade (matching the Duplicate affordance's established Host
|
|
1631
|
+
* convention), as one undoable step. Order-preserving: `result[i]` is
|
|
1632
|
+
* the clone of `ids[i]`. Strokes that share a `clusterId` among the
|
|
1633
|
+
* given ids get a single fresh shared `clusterId` in the result, so
|
|
1634
|
+
* duplicating a whole multi-stroke shape (e.g. an arrow's shaft + head)
|
|
1635
|
+
* keeps it one shape — pass every member's id together, not just one.
|
|
1636
|
+
* Unknown ids are silently skipped, matching `remove`'s convention.
|
|
1637
|
+
*/
|
|
1638
|
+
duplicate(ids: readonly string[]): readonly string[];
|
|
1594
1639
|
table: {
|
|
1595
1640
|
addRow(tableId: string): void;
|
|
1596
1641
|
addCol(tableId: string): void;
|
|
@@ -1796,7 +1841,7 @@ interface DefaultBoardChromeProps {
|
|
|
1796
1841
|
*/
|
|
1797
1842
|
icons?: Partial<Record<BuiltInTool, ReactNode>>;
|
|
1798
1843
|
}
|
|
1799
|
-
type DefaultUIRegion = "tools" | "history" | "view" | "style" | "search" | "import" | "export" | "inlineEditing" | "styleShelf";
|
|
1844
|
+
type DefaultUIRegion = "tools" | "history" | "view" | "style" | "search" | "import" | "export" | "inlineEditing" | "styleShelf" | "focusedItemToolbar";
|
|
1800
1845
|
/** Props for the toolbar/topBar/stylePanel/contextMenu slots. */
|
|
1801
1846
|
interface BoardSlotProps {
|
|
1802
1847
|
controller: BoardController;
|
|
@@ -1849,12 +1894,56 @@ interface MultiplayerCursorsProps {
|
|
|
1849
1894
|
*/
|
|
1850
1895
|
declare function MultiplayerCursors({ controller, onSelectUser, onJumpToUser }: MultiplayerCursorsProps): react.JSX.Element | null;
|
|
1851
1896
|
|
|
1897
|
+
interface FocusedItemToolbarProps {
|
|
1898
|
+
controller: BoardController;
|
|
1899
|
+
snapshot: BoardSnapshot;
|
|
1900
|
+
}
|
|
1901
|
+
/**
|
|
1902
|
+
* Floating toolbar above the focused note, shape, or text block — Colour,
|
|
1903
|
+
* Size (note/text) or Width (shape), Lock/Unlock, Duplicate, Delete.
|
|
1904
|
+
* Table/image/timer/custom objects and plain (non-shape) ink strokes never
|
|
1905
|
+
* get a toolbar here — out of scope for this destination.
|
|
1906
|
+
*
|
|
1907
|
+
* Lock/Unlock carries no per-user ownership gating: nothing else in this
|
|
1908
|
+
* SDK enforces lock ownership either (`content.update` never checks
|
|
1909
|
+
* `locked`, and the engine's own internal unlock check has no way for a
|
|
1910
|
+
* Host to ever supply a real user id) — locking is advisory UI state
|
|
1911
|
+
* throughout, and this toolbar matches that rather than inventing an
|
|
1912
|
+
* enforcement story alone.
|
|
1913
|
+
*
|
|
1914
|
+
* A shape can be several strokes sharing one `clusterId` (e.g. an arrow's
|
|
1915
|
+
* shaft + head) — every action here applies to the whole cluster. Resolved
|
|
1916
|
+
* via `query.all()` + `clusterId`, not `snapshot.selection`: a canvas click
|
|
1917
|
+
* on one member selects every member internally, but the public selection
|
|
1918
|
+
* bridge only ever reports one id (`FocusedItem.id` is singular by design),
|
|
1919
|
+
* so reconstructing the cluster from the document is the reliable path
|
|
1920
|
+
* regardless of how the selection was made.
|
|
1921
|
+
*
|
|
1922
|
+
* A focused note also gets drag-to-resize corner handles — notes have no
|
|
1923
|
+
* gizmo of their own (the native selection gizmo is ink-stroke/shape-only),
|
|
1924
|
+
* so this is that capability's default-ui-owned equivalent. Proportional
|
|
1925
|
+
* (always-square) resize from the note's own centre, clamped to
|
|
1926
|
+
* `[MIN_SIZE, MAX_SIZE]`, independent of which corner is grabbed.
|
|
1927
|
+
*/
|
|
1928
|
+
declare function FocusedItemToolbar({ controller, snapshot }: FocusedItemToolbarProps): react.JSX.Element | null;
|
|
1929
|
+
|
|
1852
1930
|
interface StyleShelfProps {
|
|
1853
1931
|
controller: BoardController;
|
|
1854
1932
|
snapshot: BoardSnapshot;
|
|
1933
|
+
/**
|
|
1934
|
+
* Root-relative screen point (e.g. the active tool button's own position)
|
|
1935
|
+
* to anchor above instead of the default: centred over the whole
|
|
1936
|
+
* `.scrawl-board__tools` toolbar. `DefaultBoardChrome` supplies this
|
|
1937
|
+
* automatically; omit it when rendering `StyleShelf` standalone (its own
|
|
1938
|
+
* layout has no toolbar button to anchor to) to keep the centred default.
|
|
1939
|
+
*/
|
|
1940
|
+
anchor?: {
|
|
1941
|
+
x: number;
|
|
1942
|
+
y: number;
|
|
1943
|
+
};
|
|
1855
1944
|
}
|
|
1856
1945
|
/** Contextual per-tool style controls — visible while a styleable tool is active. */
|
|
1857
|
-
declare function StyleShelf({ controller, snapshot }: StyleShelfProps): react.JSX.Element | null;
|
|
1946
|
+
declare function StyleShelf({ controller, snapshot, anchor }: StyleShelfProps): react.JSX.Element | null;
|
|
1858
1947
|
|
|
1859
1948
|
type ThemeStyle = CSSProperties & Record<`--scrawl-${string}`, string | number | undefined>;
|
|
1860
1949
|
interface ScrawlProviderProps {
|
|
@@ -1922,5 +2011,5 @@ type ScrawlBoardProps = {
|
|
|
1922
2011
|
};
|
|
1923
2012
|
declare function ScrawlBoard({ documentId, initialDocument, onReady, className, style }: ScrawlBoardProps): react.JSX.Element;
|
|
1924
2013
|
|
|
1925
|
-
export { ASSET_CACHE_BYTES_DEFAULT, ASSET_CACHE_BYTES_MAX, ASSET_CACHE_BYTES_MIN, ASSET_EXPORT_MAX_DECODED_MEGAPIXELS, ASSET_EXPORT_MAX_ENCODED_BYTES, ASSET_MAX_CONCURRENT_RESOLUTIONS, ASSET_MAX_DECODED_MEGAPIXELS, ASSET_MAX_DIMENSION_PX, ASSET_MAX_ENCODED_BYTES, ASSET_REF_MAX_BYTES, ASSET_REF_PATTERN, AddImageCommand, AddNoteCommand, AddStrokesCommand, AddTableCommand, AddTextCommand, AddTimerCommand, AssetResolutionError, BEACON_INSET, BoardDocument, CURRENT_DOCUMENT_SCHEMA_VERSION, ClusterStore, DefaultBoardChrome, DeleteImageCommand, DeleteNoteCommand, DeleteStrokesCommand, DeleteTableCommand, DeleteTextCommand, DeleteTimerCommand, DocumentRecoveryError, END_TAPER, ERASE_THRESHOLD, EraseCommand, FOG_COLOR, HIGHLIGHT_COLORS, History, IDENTITY, INK_COLORS, InlineEditors, LockItemsCommand, MIN_WIDTH_FACTOR, MultiplayerCursors, NOTE_COLORS, NOTE_DEFAULT_SIZE, NOTE_DEFAULT_Z, NOTE_MAX_Z, NOTE_MIN_Z, NOTE_PEEL_STEP, SDK_DEVELOPMENT_VERSION, SDK_PACKAGE_NAME, STAMPS, STAMP_SIZE, SUPPORTED_ASSET_MEDIA_TYPES, Scrawl, ScrawlBoard, ScrawlCanvas, ScrawlDefaultUI, ScrawlPortal, ScrawlProvider, SpatialIndex, StyleShelf, TABLE_DEFAULT_CELL_HEIGHT, TABLE_DEFAULT_CELL_WIDTH, TABLE_DEFAULT_FONT_SIZE, TEXT_DEFAULT_SIZE, TIMER_DEFAULT_DURATION_MS, TIMER_DEFAULT_SIZE, TIMER_PRESETS_MS, TransformCommand, UpdateImageCommand, UpdateNoteCommand, UpdateTableCommand, UpdateTextCommand, UpdateTimerCommand, apply, applyItemLock, assetRef, avgScale, canUnlockItem, changeToOps, clampAssetCacheBytes, cloneCustomObject, cloneImage, cloneNote, cloneStroke, cloneTable, cloneText, cloneTimer, createBoardController, createLocalBoard, documentId, documentToSVG, formatTimer, invert, isAssetRef, isIdentity, isStampKind, loadDocumentBytes, measureTable, measureTextBlock, migrateDocument, mul, pauseTimer, placePresenceBeacon, resolveScrawlTheme, ribbonEdges, rotationAbout, scalingAbout, scrawlThemePresets, searchBoard, serializeDocument, serializeLock, serializeStroke, setTimerDuration, stampDataUrl, startTimer, strokeId, timerExpired, timerRemaining, toggleTimer, translation, useScrawlController, useScrawlSnapshot, useScrawlTheme, validateScrawlTheme };
|
|
1926
|
-
export type { ApplyOpsResult, AssetDiagnostic, AssetIngestRequest, AssetIngestResult, AssetIngestor, AssetKind, AssetPurpose, AssetRef, AssetResolutionErrorCode, AssetResolveRequest, AssetResolveResult, AssetResolver, BBox, BoardController, BoardControllerError, BoardEventMap, BoardKeyInput, BoardObject, BoardObjectInput, BoardObjectPatch, BoardPoint, BoardPointerInput, BoardScene, BoardSlotProps, BoardSnapshot, BoardStroke, BoardStyle, BoardThemeOptions, BoardView, BuiltInTool, ClusterIdFactory, CollaborationAdapter, CollaborationReceiver, CollaborationSession, CollaborationSnapshot, CollaboratorIdentity, Command, CommandKind, CommentMarker, ControllerOp, CreateBoardControllerOptions, CurrentSerializedDocument, CurrentSerializedStroke, CustomBoardObject, CustomObjectAddInput, CustomObjectDefinition, CustomTool, CustomToolDefinition, DeepReadonly, DefaultBoardChromeProps, DefaultUIRegion, DefaultUISlot, DefaultUISlots, DialogSlotProps, DocumentChange, DocumentContext, DocumentId, DocumentLoadResult, DocumentRecoveryCode, ExtensionCommand, ExtensionDiagnostic, ExtensionHitResult, ExtensionId, ExtensionRequirement, ImageBlock, InlineEditorsProps, InputModifiers, JsonObject, JsonValue, KitchenTimer, LoadResult, LocalBoard, LocalBoardOptions, LocalBoardSnapshot, LockHolder, LockTarget, Lockable, Mat2x3, MultiplayerCursorsProps, NoteVote, ObjectDescribeContext, ObjectIntent, ObjectType, Op, OpCollection, PersistenceAdapter, PersistenceDiagnostic, PersistenceSnapshot, PresenceCursor, PresencePlacement, PresenceUser, PresenceView, QueryableBoardObject, ReadonlyBoardDocument, ReadonlyCustomObject, ReadonlyDocumentChange, RibbonEdgePoint, SceneEllipse, SceneGroup, SceneImage, ScenePath, SceneRect, SceneText, ScrawlBoardProps, ScrawlCanvasProps, ScrawlDefaultUIProps, ScrawlDensity, ScrawlExtension, ScrawlGridMode, ScrawlProps, ScrawlProviderProps, ScrawlResolvedTheme, ScrawlSurfaceTexture, ScrawlTheme, ScrawlThemeDiagnostic, ScrawlThemePreset, ScreenPoint, ScreenRect, SearchHit, SearchHitKind, SearchableBoard, SearchableComment, SerializedBoardDocument, SerializedBoardStroke, SerializedPoint, SerializedStroke, StampKind, StickyNote, Stroke, StrokeId, StrokePoint, StrokeTool, StyleShelfProps, SupportedAssetMediaType, TableBlock, TextBlock, ToolCancelReason, ToolCapabilities, ToolCursor, ToolId, ViewportInset };
|
|
2014
|
+
export { ASSET_CACHE_BYTES_DEFAULT, ASSET_CACHE_BYTES_MAX, ASSET_CACHE_BYTES_MIN, ASSET_EXPORT_MAX_DECODED_MEGAPIXELS, ASSET_EXPORT_MAX_ENCODED_BYTES, ASSET_MAX_CONCURRENT_RESOLUTIONS, ASSET_MAX_DECODED_MEGAPIXELS, ASSET_MAX_DIMENSION_PX, ASSET_MAX_ENCODED_BYTES, ASSET_REF_MAX_BYTES, ASSET_REF_PATTERN, AddImageCommand, AddNoteCommand, AddStrokesCommand, AddTableCommand, AddTextCommand, AddTimerCommand, AssetResolutionError, BEACON_INSET, BoardDocument, CURRENT_DOCUMENT_SCHEMA_VERSION, ClusterStore, DefaultBoardChrome, DeleteImageCommand, DeleteNoteCommand, DeleteStrokesCommand, DeleteTableCommand, DeleteTextCommand, DeleteTimerCommand, DocumentRecoveryError, END_TAPER, ERASE_THRESHOLD, EraseCommand, FOG_COLOR, FocusedItemToolbar, HIGHLIGHT_COLORS, History, IDENTITY, INK_COLORS, InlineEditors, LockItemsCommand, MIN_WIDTH_FACTOR, MultiplayerCursors, NOTE_COLORS, NOTE_DEFAULT_SIZE, NOTE_DEFAULT_Z, NOTE_MAX_Z, NOTE_MIN_Z, NOTE_PEEL_STEP, SDK_DEVELOPMENT_VERSION, SDK_PACKAGE_NAME, STAMPS, STAMP_SIZE, SUPPORTED_ASSET_MEDIA_TYPES, Scrawl, ScrawlBoard, ScrawlCanvas, ScrawlDefaultUI, ScrawlPortal, ScrawlProvider, SpatialIndex, StyleShelf, TABLE_DEFAULT_CELL_HEIGHT, TABLE_DEFAULT_CELL_WIDTH, TABLE_DEFAULT_FONT_SIZE, TEXT_DEFAULT_SIZE, TIMER_DEFAULT_DURATION_MS, TIMER_DEFAULT_SIZE, TIMER_PRESETS_MS, TransformCommand, UpdateImageCommand, UpdateNoteCommand, UpdateTableCommand, UpdateTextCommand, UpdateTimerCommand, apply, applyItemLock, assetRef, avgScale, canUnlockItem, changeToOps, clampAssetCacheBytes, cloneCustomObject, cloneImage, cloneNote, cloneStroke, cloneTable, cloneText, cloneTimer, createBoardController, createLocalBoard, documentId, documentToSVG, formatTimer, invert, isAssetRef, isIdentity, isStampKind, loadDocumentBytes, measureTable, measureTextBlock, migrateDocument, mul, pauseTimer, placePresenceBeacon, resolveScrawlTheme, ribbonEdges, rotationAbout, scalingAbout, scrawlThemePresets, searchBoard, serializeDocument, serializeLock, serializeStroke, setTimerDuration, stampDataUrl, startTimer, strokeId, timerExpired, timerRemaining, toggleTimer, translation, useScrawlController, useScrawlSnapshot, useScrawlTheme, validateScrawlTheme };
|
|
2015
|
+
export type { ApplyOpsResult, AssetDiagnostic, AssetIngestRequest, AssetIngestResult, AssetIngestor, AssetKind, AssetPurpose, AssetRef, AssetResolutionErrorCode, AssetResolveRequest, AssetResolveResult, AssetResolver, BBox, BoardController, BoardControllerError, BoardEventMap, BoardKeyInput, BoardObject, BoardObjectInput, BoardObjectPatch, BoardPoint, BoardPointerInput, BoardScene, BoardSlotProps, BoardSnapshot, BoardStroke, BoardStyle, BoardThemeOptions, BoardView, BuiltInTool, ClusterIdFactory, CollaborationAdapter, CollaborationReceiver, CollaborationSession, CollaborationSnapshot, CollaboratorIdentity, Command, CommandKind, CommentMarker, ControllerOp, CreateBoardControllerOptions, CurrentSerializedDocument, CurrentSerializedStroke, CustomBoardObject, CustomObjectAddInput, CustomObjectDefinition, CustomTool, CustomToolDefinition, DeepReadonly, DefaultBoardChromeProps, DefaultUIRegion, DefaultUISlot, DefaultUISlots, DialogSlotProps, DocumentChange, DocumentContext, DocumentId, DocumentLoadResult, DocumentRecoveryCode, ExtensionCommand, ExtensionDiagnostic, ExtensionHitResult, ExtensionId, ExtensionRequirement, FocusedItem, FocusedItemToolbarProps, ImageBlock, InlineEditorsProps, InputModifiers, JsonObject, JsonValue, KitchenTimer, LoadResult, LocalBoard, LocalBoardOptions, LocalBoardSnapshot, LockHolder, LockTarget, Lockable, Mat2x3, MultiplayerCursorsProps, NoteVote, ObjectDescribeContext, ObjectIntent, ObjectType, Op, OpCollection, PersistenceAdapter, PersistenceDiagnostic, PersistenceSnapshot, PresenceCursor, PresencePlacement, PresenceUser, PresenceView, QueryableBoardObject, ReadonlyBoardDocument, ReadonlyCustomObject, ReadonlyDocumentChange, RibbonEdgePoint, SceneEllipse, SceneGroup, SceneImage, ScenePath, SceneRect, SceneText, ScrawlBoardProps, ScrawlCanvasProps, ScrawlDefaultUIProps, ScrawlDensity, ScrawlExtension, ScrawlGridMode, ScrawlProps, ScrawlProviderProps, ScrawlResolvedTheme, ScrawlSurfaceTexture, ScrawlTheme, ScrawlThemeDiagnostic, ScrawlThemePreset, ScreenPoint, ScreenRect, SearchHit, SearchHitKind, SearchableBoard, SearchableComment, SerializedBoardDocument, SerializedBoardStroke, SerializedPoint, SerializedStroke, StampKind, StickyNote, Stroke, StrokeId, StrokePoint, StrokeTool, StyleShelfProps, SupportedAssetMediaType, TableBlock, TextBlock, ToolCancelReason, ToolCapabilities, ToolCursor, ToolId, ViewportInset };
|