@tldraw/editor 4.4.0-canary.15cff7ea86f8 → 4.4.0-canary.23ea0acc258e
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-cjs/index.d.ts +163 -11
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js +184 -0
- package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js.map +7 -0
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js +29 -14
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js +3 -1
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js +13 -1
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js.map +2 -2
- package/dist-cjs/lib/editor/managers/ScribbleManager/ScribbleManager.js +359 -89
- package/dist-cjs/lib/editor/managers/ScribbleManager/ScribbleManager.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js +29 -0
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/options.js +1 -0
- package/dist-cjs/lib/options.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +163 -11
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs +164 -0
- package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs.map +7 -0
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +29 -14
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs +3 -1
- package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs +13 -1
- package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/ScribbleManager/ScribbleManager.mjs +359 -89
- package/dist-esm/lib/editor/managers/ScribbleManager/ScribbleManager.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +29 -0
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/options.mjs +1 -0
- package/dist-esm/lib/options.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +6 -0
- package/package.json +7 -7
- package/src/index.ts +2 -0
- package/src/lib/components/default-components/CanvasShapeIndicators.tsx +217 -0
- package/src/lib/components/default-components/DefaultCanvas.tsx +15 -1
- package/src/lib/components/default-components/DefaultShapeIndicator.tsx +6 -1
- package/src/lib/components/default-components/DefaultShapeIndicators.tsx +16 -1
- package/src/lib/editor/managers/ScribbleManager/ScribbleManager.ts +471 -106
- package/src/lib/editor/shapes/ShapeUtil.ts +44 -0
- package/src/lib/options.ts +7 -0
- package/src/version.ts +3 -3
- package/src/lib/editor/managers/ScribbleManager/ScribbleManager.test.ts +0 -621
package/dist-cjs/index.d.ts
CHANGED
|
@@ -900,6 +900,7 @@ export declare const defaultTldrawOptions: {
|
|
|
900
900
|
readonly handleRadius: 12;
|
|
901
901
|
readonly hitTestMargin: 8;
|
|
902
902
|
readonly laserDelayMs: 1200;
|
|
903
|
+
readonly laserFadeoutMs: 500;
|
|
903
904
|
readonly longPressDurationMs: 500;
|
|
904
905
|
readonly maxExportDelayMs: 5000;
|
|
905
906
|
readonly maxFilesAtOnce: 100;
|
|
@@ -5339,27 +5340,98 @@ export declare interface ScribbleItem {
|
|
|
5339
5340
|
/** @public */
|
|
5340
5341
|
export declare class ScribbleManager {
|
|
5341
5342
|
private editor;
|
|
5342
|
-
|
|
5343
|
-
state: "paused" | "running";
|
|
5343
|
+
private sessions;
|
|
5344
5344
|
constructor(editor: Editor);
|
|
5345
|
+
/**
|
|
5346
|
+
* Start a new session for grouping scribbles.
|
|
5347
|
+
* Returns a session ID that can be used with other session methods.
|
|
5348
|
+
*
|
|
5349
|
+
* @param options - Session configuration
|
|
5350
|
+
* @returns Session ID
|
|
5351
|
+
* @public
|
|
5352
|
+
*/
|
|
5353
|
+
startSession(options?: ScribbleSessionOptions): string;
|
|
5354
|
+
/**
|
|
5355
|
+
* Add a scribble to a session.
|
|
5356
|
+
*
|
|
5357
|
+
* @param sessionId - The session ID
|
|
5358
|
+
* @param scribble - Partial scribble properties
|
|
5359
|
+
* @param scribbleId - Optional scribble ID
|
|
5360
|
+
* @public
|
|
5361
|
+
*/
|
|
5362
|
+
addScribbleToSession(sessionId: string, scribble: Partial<TLScribble>, scribbleId?: string): ScribbleItem;
|
|
5363
|
+
/**
|
|
5364
|
+
* Add a point to a scribble in a session.
|
|
5365
|
+
*
|
|
5366
|
+
* @param sessionId - The session ID
|
|
5367
|
+
* @param scribbleId - The scribble ID
|
|
5368
|
+
* @param x - X coordinate
|
|
5369
|
+
* @param y - Y coordinate
|
|
5370
|
+
* @param z - Z coordinate (pressure)
|
|
5371
|
+
* @public
|
|
5372
|
+
*/
|
|
5373
|
+
addPointToSession(sessionId: string, scribbleId: string, x: number, y: number, z?: number): ScribbleItem;
|
|
5374
|
+
/**
|
|
5375
|
+
* Extend a session, resetting its idle timeout.
|
|
5376
|
+
*
|
|
5377
|
+
* @param sessionId - The session ID
|
|
5378
|
+
* @public
|
|
5379
|
+
*/
|
|
5380
|
+
extendSession(sessionId: string): void;
|
|
5381
|
+
/**
|
|
5382
|
+
* Stop a session, triggering fade-out.
|
|
5383
|
+
*
|
|
5384
|
+
* @param sessionId - The session ID
|
|
5385
|
+
* @public
|
|
5386
|
+
*/
|
|
5387
|
+
stopSession(sessionId: string): void;
|
|
5388
|
+
/**
|
|
5389
|
+
* Clear all scribbles in a session immediately.
|
|
5390
|
+
*
|
|
5391
|
+
* @param sessionId - The session ID
|
|
5392
|
+
* @public
|
|
5393
|
+
*/
|
|
5394
|
+
clearSession(sessionId: string): void;
|
|
5395
|
+
/**
|
|
5396
|
+
* Check if a session is active.
|
|
5397
|
+
*
|
|
5398
|
+
* @param sessionId - The session ID
|
|
5399
|
+
* @public
|
|
5400
|
+
*/
|
|
5401
|
+
isSessionActive(sessionId: string): boolean;
|
|
5402
|
+
/**
|
|
5403
|
+
* Add a scribble using the default self-consuming behavior.
|
|
5404
|
+
* Creates an implicit session for the scribble.
|
|
5405
|
+
*
|
|
5406
|
+
* @param scribble - Partial scribble properties
|
|
5407
|
+
* @param id - Optional scribble id
|
|
5408
|
+
* @returns The created scribble item
|
|
5409
|
+
* @public
|
|
5410
|
+
*/
|
|
5345
5411
|
addScribble(scribble: Partial<TLScribble>, id?: string): ScribbleItem;
|
|
5346
|
-
reset(): void;
|
|
5347
5412
|
/**
|
|
5348
|
-
*
|
|
5413
|
+
* Add a point to a scribble. Searches all sessions.
|
|
5414
|
+
*
|
|
5415
|
+
* @param id - The scribble id
|
|
5416
|
+
* @param x - X coordinate
|
|
5417
|
+
* @param y - Y coordinate
|
|
5418
|
+
* @param z - Z coordinate (pressure)
|
|
5419
|
+
* @public
|
|
5420
|
+
*/
|
|
5421
|
+
addPoint(id: string, x: number, y: number, z?: number): ScribbleItem;
|
|
5422
|
+
/**
|
|
5423
|
+
* Stop a scribble. Searches all sessions.
|
|
5349
5424
|
*
|
|
5425
|
+
* @param id - The scribble id
|
|
5350
5426
|
* @public
|
|
5351
5427
|
*/
|
|
5352
|
-
stop(id:
|
|
5428
|
+
stop(id: string): ScribbleItem;
|
|
5353
5429
|
/**
|
|
5354
|
-
*
|
|
5430
|
+
* Stop and remove all sessions.
|
|
5355
5431
|
*
|
|
5356
|
-
* @param id - The id of the scribble to add a point to.
|
|
5357
|
-
* @param x - The x coordinate of the point.
|
|
5358
|
-
* @param y - The y coordinate of the point.
|
|
5359
|
-
* @param z - The z coordinate of the point.
|
|
5360
5432
|
* @public
|
|
5361
5433
|
*/
|
|
5362
|
-
|
|
5434
|
+
reset(): void;
|
|
5363
5435
|
/**
|
|
5364
5436
|
* Update on each animation frame.
|
|
5365
5437
|
*
|
|
@@ -5367,6 +5439,44 @@ export declare class ScribbleManager {
|
|
|
5367
5439
|
* @public
|
|
5368
5440
|
*/
|
|
5369
5441
|
tick(elapsed: number): void;
|
|
5442
|
+
private resetIdleTimeout;
|
|
5443
|
+
private clearIdleTimeout;
|
|
5444
|
+
private tickSession;
|
|
5445
|
+
private tickSessionItems;
|
|
5446
|
+
private tickPersistentItem;
|
|
5447
|
+
private tickSelfConsumingItem;
|
|
5448
|
+
private tickGroupedFade;
|
|
5449
|
+
}
|
|
5450
|
+
|
|
5451
|
+
/** @public */
|
|
5452
|
+
export declare interface ScribbleSessionOptions {
|
|
5453
|
+
/** Session id. Auto-generated if not provided. */
|
|
5454
|
+
id?: string;
|
|
5455
|
+
/**
|
|
5456
|
+
* Whether scribbles self-consume (shrink from start) while drawing.
|
|
5457
|
+
* - true: scribbles eat their own tail as you draw (default, used for eraser/select)
|
|
5458
|
+
* - false: scribbles persist until session stops (used for laser)
|
|
5459
|
+
*/
|
|
5460
|
+
selfConsume?: boolean;
|
|
5461
|
+
/**
|
|
5462
|
+
* How long to wait after last activity before auto-stopping the session.
|
|
5463
|
+
* Only applies when selfConsume is false.
|
|
5464
|
+
*/
|
|
5465
|
+
idleTimeoutMs?: number;
|
|
5466
|
+
/**
|
|
5467
|
+
* How scribbles fade when stopping.
|
|
5468
|
+
* - 'individual': each scribble fades on its own (default)
|
|
5469
|
+
* - 'grouped': all scribbles fade together as one sequence
|
|
5470
|
+
*/
|
|
5471
|
+
fadeMode?: 'grouped' | 'individual';
|
|
5472
|
+
/**
|
|
5473
|
+
* Easing for grouped fade.
|
|
5474
|
+
*/
|
|
5475
|
+
fadeEasing?: 'ease-in' | 'linear';
|
|
5476
|
+
/**
|
|
5477
|
+
* Duration of the fade in milliseconds.
|
|
5478
|
+
*/
|
|
5479
|
+
fadeDurationMs?: number;
|
|
5370
5480
|
}
|
|
5371
5481
|
|
|
5372
5482
|
/** @public */
|
|
@@ -5469,6 +5579,31 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
5469
5579
|
* @public
|
|
5470
5580
|
*/
|
|
5471
5581
|
abstract indicator(shape: Shape): any;
|
|
5582
|
+
/**
|
|
5583
|
+
* Whether to use the legacy React-based indicator rendering.
|
|
5584
|
+
*
|
|
5585
|
+
* Override this to return `false` if your shape implements {@link ShapeUtil.getIndicatorPath}
|
|
5586
|
+
* for canvas-based indicator rendering.
|
|
5587
|
+
*
|
|
5588
|
+
* @returns `true` to use SVG indicators (default), `false` to use canvas indicators.
|
|
5589
|
+
* @public
|
|
5590
|
+
*/
|
|
5591
|
+
useLegacyIndicator(): boolean;
|
|
5592
|
+
/**
|
|
5593
|
+
* Get a Path2D for rendering the shape's indicator on the canvas.
|
|
5594
|
+
*
|
|
5595
|
+
* When implemented, this is used instead of {@link ShapeUtil.indicator} for more
|
|
5596
|
+
* efficient canvas-based indicator rendering. Shapes that return `undefined` will
|
|
5597
|
+
* fall back to SVG-based rendering via {@link ShapeUtil.indicator}.
|
|
5598
|
+
*
|
|
5599
|
+
* For complex indicators that need clipping (e.g., arrows with labels), return an
|
|
5600
|
+
* object with `path`, `clipPath`, and `additionalPaths` properties.
|
|
5601
|
+
*
|
|
5602
|
+
* @param shape - The shape.
|
|
5603
|
+
* @returns A Path2D to stroke, or an object with clipping info, or undefined to use SVG fallback.
|
|
5604
|
+
* @public
|
|
5605
|
+
*/
|
|
5606
|
+
getIndicatorPath(shape: Shape): TLIndicatorPath | undefined;
|
|
5472
5607
|
/**
|
|
5473
5608
|
* Get the font faces that should be rendered in the document in order for this shape to render
|
|
5474
5609
|
* correctly.
|
|
@@ -6836,6 +6971,12 @@ export declare interface TldrawOptions {
|
|
|
6836
6971
|
readonly flattenImageBoundsExpand: number;
|
|
6837
6972
|
readonly flattenImageBoundsPadding: number;
|
|
6838
6973
|
readonly laserDelayMs: number;
|
|
6974
|
+
/**
|
|
6975
|
+
* How long (in milliseconds) to fade all laser scribbles after the session ends.
|
|
6976
|
+
* The total points across all scribbles will be removed proportionally over this duration.
|
|
6977
|
+
* Defaults to 500ms (0.5 seconds).
|
|
6978
|
+
*/
|
|
6979
|
+
readonly laserFadeoutMs: number;
|
|
6839
6980
|
readonly maxExportDelayMs: number;
|
|
6840
6981
|
readonly tooltipDelayMs: number;
|
|
6841
6982
|
/**
|
|
@@ -7399,6 +7540,17 @@ export declare interface TLImageExportOptions extends TLSvgExportOptions {
|
|
|
7399
7540
|
format?: TLExportType;
|
|
7400
7541
|
}
|
|
7401
7542
|
|
|
7543
|
+
/**
|
|
7544
|
+
* Return type for {@link ShapeUtil.getIndicatorPath}. Can be either a simple Path2D
|
|
7545
|
+
* or an object with additional rendering info like clip paths for complex indicators.
|
|
7546
|
+
* @public
|
|
7547
|
+
*/
|
|
7548
|
+
export declare type TLIndicatorPath = {
|
|
7549
|
+
additionalPaths?: Path2D[];
|
|
7550
|
+
clipPath?: Path2D;
|
|
7551
|
+
path: Path2D;
|
|
7552
|
+
} | Path2D;
|
|
7553
|
+
|
|
7402
7554
|
/** @public */
|
|
7403
7555
|
export declare type TLInterruptEvent = (info: TLInterruptEventInfo) => void;
|
|
7404
7556
|
|
package/dist-cjs/index.js
CHANGED
|
@@ -377,7 +377,7 @@ var import_uniq = require("./lib/utils/uniq");
|
|
|
377
377
|
var import_window_open = require("./lib/utils/window-open");
|
|
378
378
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
379
379
|
"@tldraw/editor",
|
|
380
|
-
"4.4.0-canary.
|
|
380
|
+
"4.4.0-canary.23ea0acc258e",
|
|
381
381
|
"cjs"
|
|
382
382
|
);
|
|
383
383
|
//# sourceMappingURL=index.js.map
|
package/dist-cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\nimport 'core-js/stable/array/at.js'\nimport 'core-js/stable/array/flat-map.js'\nimport 'core-js/stable/array/flat.js'\nimport 'core-js/stable/string/at.js'\nimport 'core-js/stable/string/replace-all.js'\n\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state-react'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/store'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/tlschema'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/utils'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/validate'\n\nexport { DefaultBackground } from './lib/components/default-components/DefaultBackground'\nexport { DefaultBrush, type TLBrushProps } from './lib/components/default-components/DefaultBrush'\nexport {\n\tDefaultCanvas,\n\ttype TLCanvasComponentProps,\n} from './lib/components/default-components/DefaultCanvas'\nexport {\n\tDefaultCollaboratorHint,\n\ttype TLCollaboratorHintProps,\n} from './lib/components/default-components/DefaultCollaboratorHint'\nexport {\n\tDefaultCursor,\n\ttype TLCursorProps,\n} from './lib/components/default-components/DefaultCursor'\nexport {\n\tDefaultErrorFallback,\n\ttype TLErrorFallbackComponent,\n} from './lib/components/default-components/DefaultErrorFallback'\nexport { DefaultGrid, type TLGridProps } from './lib/components/default-components/DefaultGrid'\nexport {\n\tDefaultHandle,\n\ttype TLHandleProps,\n} from './lib/components/default-components/DefaultHandle'\nexport {\n\tDefaultHandles,\n\ttype TLHandlesProps,\n} from './lib/components/default-components/DefaultHandles'\nexport {\n\tDefaultScribble,\n\ttype TLScribbleProps,\n} from './lib/components/default-components/DefaultScribble'\nexport {\n\tDefaultSelectionBackground,\n\ttype TLSelectionBackgroundProps,\n} from './lib/components/default-components/DefaultSelectionBackground'\nexport {\n\tDefaultSelectionForeground,\n\ttype TLSelectionForegroundProps,\n} from './lib/components/default-components/DefaultSelectionForeground'\nexport { type TLShapeErrorFallbackComponent } from './lib/components/default-components/DefaultShapeErrorFallback'\nexport {\n\tDefaultShapeIndicator,\n\ttype TLShapeIndicatorProps,\n} from './lib/components/default-components/DefaultShapeIndicator'\nexport { type TLShapeIndicatorErrorFallbackComponent } from './lib/components/default-components/DefaultShapeIndicatorErrorFallback'\nexport {\n\tDefaultShapeIndicators,\n\ttype TLShapeIndicatorsProps,\n} from './lib/components/default-components/DefaultShapeIndicators'\nexport {\n\tDefaultShapeWrapper,\n\ttype TLShapeWrapperProps,\n} from './lib/components/default-components/DefaultShapeWrapper'\nexport {\n\tDefaultSnapIndicator,\n\ttype TLSnapIndicatorProps,\n} from './lib/components/default-components/DefaultSnapIndictor'\nexport { DefaultSpinner } from './lib/components/default-components/DefaultSpinner'\nexport { DefaultSvgDefs } from './lib/components/default-components/DefaultSvgDefs'\nexport {\n\tErrorBoundary,\n\tOptionalErrorBoundary,\n\ttype TLErrorBoundaryProps,\n} from './lib/components/ErrorBoundary'\nexport { HTMLContainer, type HTMLContainerProps } from './lib/components/HTMLContainer'\nexport { MenuClickCapture } from './lib/components/MenuClickCapture'\nexport { SVGContainer, type SVGContainerProps } from './lib/components/SVGContainer'\nexport {\n\tcreateTLSchemaFromUtils,\n\tcreateTLStore,\n\tinlineBase64AssetStore,\n\ttype TLStoreBaseOptions,\n\ttype TLStoreEventInfo,\n\ttype TLStoreOptions,\n\ttype TLStoreSchemaOptions,\n} from './lib/config/createTLStore'\nexport { createTLUser, useTldrawUser, type TLUser } from './lib/config/createTLUser'\nexport { type TLAnyBindingUtilConstructor } from './lib/config/defaultBindings'\nexport { coreShapes, type TLAnyShapeUtilConstructor } from './lib/config/defaultShapes'\nexport {\n\tgetSnapshot,\n\tloadSnapshot,\n\ttype TLEditorSnapshot,\n\ttype TLLoadSnapshotOptions,\n} from './lib/config/TLEditorSnapshot'\nexport {\n\tcreateSessionStateSnapshotSignal,\n\textractSessionStateFromLegacySnapshot,\n\tloadSessionStateSnapshotIntoStore,\n\tTAB_ID,\n\ttype TLLoadSessionStateSnapshotOptions,\n\ttype TLSessionStateSnapshot,\n} from './lib/config/TLSessionStateSnapshot'\nexport {\n\tdefaultUserPreferences,\n\tgetFreshUserPreferences,\n\tgetUserPreferences,\n\tsetUserPreferences,\n\tUSER_COLORS,\n\tuserTypeValidator,\n\ttype TLUserPreferences,\n} from './lib/config/TLUserPreferences'\nexport { DEFAULT_ANIMATION_OPTIONS, DEFAULT_CAMERA_OPTIONS, SIDES } from './lib/constants'\nexport {\n\tBindingUtil,\n\ttype BindingOnChangeOptions,\n\ttype BindingOnCreateOptions,\n\ttype BindingOnDeleteOptions,\n\ttype BindingOnShapeChangeOptions,\n\ttype BindingOnShapeDeleteOptions,\n\ttype BindingOnShapeIsolateOptions,\n\ttype TLBindingUtilConstructor,\n} from './lib/editor/bindings/BindingUtil'\nexport {\n\tEditor,\n\ttype TLEditorOptions,\n\ttype TLEditorRunOptions,\n\ttype TLRenderingShape,\n\ttype TLResizeShapeOptions,\n} from './lib/editor/Editor'\nexport { ClickManager, type TLClickState } from './lib/editor/managers/ClickManager/ClickManager'\nexport { EdgeScrollManager } from './lib/editor/managers/EdgeScrollManager/EdgeScrollManager'\nexport {\n\tFontManager,\n\ttype TLFontFace,\n\ttype TLFontFaceSource,\n} from './lib/editor/managers/FontManager/FontManager'\nexport { HistoryManager } from './lib/editor/managers/HistoryManager/HistoryManager'\nexport { InputsManager } from './lib/editor/managers/InputsManager/InputsManager'\nexport {\n\tScribbleManager,\n\ttype ScribbleItem,\n} from './lib/editor/managers/ScribbleManager/ScribbleManager'\nexport {\n\tBoundsSnaps,\n\ttype BoundsSnapGeometry,\n\ttype BoundsSnapPoint,\n} from './lib/editor/managers/SnapManager/BoundsSnaps'\nexport { HandleSnaps, type HandleSnapGeometry } from './lib/editor/managers/SnapManager/HandleSnaps'\nexport {\n\tSnapManager,\n\ttype GapsSnapIndicator,\n\ttype PointsSnapIndicator,\n\ttype SnapData,\n\ttype SnapIndicator,\n} from './lib/editor/managers/SnapManager/SnapManager'\nexport { SpatialIndexManager } from './lib/editor/managers/SpatialIndexManager/SpatialIndexManager'\nexport {\n\tTextManager,\n\ttype TLMeasureTextOpts,\n\ttype TLMeasureTextSpanOpts,\n} from './lib/editor/managers/TextManager/TextManager'\nexport { TickManager } from './lib/editor/managers/TickManager/TickManager'\nexport { UserPreferencesManager } from './lib/editor/managers/UserPreferencesManager/UserPreferencesManager'\nexport { BaseBoxShapeUtil, type TLBaseBoxShape } from './lib/editor/shapes/BaseBoxShapeUtil'\nexport { GroupShapeUtil } from './lib/editor/shapes/group/GroupShapeUtil'\nexport {\n\tShapeUtil,\n\ttype TLCropInfo,\n\ttype TLDragShapesInInfo,\n\ttype TLDragShapesOutInfo,\n\ttype TLDragShapesOverInfo,\n\ttype TLDropShapesOverInfo,\n\ttype TLEditStartInfo,\n\ttype TLGeometryOpts,\n\ttype TLHandleDragInfo,\n\ttype TLResizeInfo,\n\ttype TLResizeMode,\n\ttype TLShapeUtilCanBeLaidOutOpts,\n\ttype TLShapeUtilCanBindOpts,\n\ttype TLShapeUtilCanvasSvgDef,\n\ttype TLShapeUtilConstructor,\n} from './lib/editor/shapes/ShapeUtil'\nexport {\n\tgetPerfectDashProps,\n\ttype PerfectDashTerminal,\n} from './lib/editor/shapes/shared/getPerfectDashProps'\nexport { resizeBox, type ResizeBoxOptions } from './lib/editor/shapes/shared/resizeBox'\nexport { resizeScaled } from './lib/editor/shapes/shared/resizeScaled'\nexport { BaseBoxShapeTool } from './lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool'\nexport { maybeSnapToGrid } from './lib/editor/tools/BaseBoxShapeTool/children/Pointing'\nexport { StateNode, type TLStateNodeConstructor } from './lib/editor/tools/StateNode'\nexport { type TLContent } from './lib/editor/types/clipboard-types'\nexport { type TLEventMap, type TLEventMapHandler } from './lib/editor/types/emit-types'\nexport {\n\tEVENT_NAME_MAP,\n\ttype TLBaseEventInfo,\n\ttype TLCancelEvent,\n\ttype TLCancelEventInfo,\n\ttype TLClickEvent,\n\ttype TLClickEventInfo,\n\ttype TLCLickEventName,\n\ttype TLCompleteEvent,\n\ttype TLCompleteEventInfo,\n\ttype TLEnterEventHandler,\n\ttype TLEventHandlers,\n\ttype TLEventInfo,\n\ttype TLEventName,\n\ttype TLExitEventHandler,\n\ttype TLInterruptEvent,\n\ttype TLInterruptEventInfo,\n\ttype TLKeyboardEvent,\n\ttype TLKeyboardEventInfo,\n\ttype TLKeyboardEventName,\n\ttype TLPinchEvent,\n\ttype TLPinchEventInfo,\n\ttype TLPinchEventName,\n\ttype TLPointerEvent,\n\ttype TLPointerEventInfo,\n\ttype TLPointerEventName,\n\ttype TLPointerEventTarget,\n\ttype TLTickEvent,\n\ttype TLTickEventInfo,\n\ttype TLWheelEvent,\n\ttype TLWheelEventInfo,\n\ttype UiEvent,\n\ttype UiEventType,\n} from './lib/editor/types/event-types'\nexport {\n\ttype TLBaseExternalContent,\n\ttype TLEmbedExternalContent,\n\ttype TLErrorExternalContentSource,\n\ttype TLExcalidrawExternalContent,\n\ttype TLExcalidrawExternalContentSource,\n\ttype TLExternalAsset,\n\ttype TLExternalContent,\n\ttype TLExternalContentSource,\n\ttype TLFileExternalAsset,\n\ttype TLFileReplaceExternalContent,\n\ttype TLFilesExternalContent,\n\ttype TLSvgTextExternalContent,\n\ttype TLTextExternalContent,\n\ttype TLTextExternalContentSource,\n\ttype TLTldrawExternalContent,\n\ttype TLTldrawExternalContentSource,\n\ttype TLUrlExternalAsset,\n\ttype TLUrlExternalContent,\n} from './lib/editor/types/external-content'\nexport {\n\ttype TLHistoryBatchOptions,\n\ttype TLHistoryDiff,\n\ttype TLHistoryEntry,\n\ttype TLHistoryMark,\n} from './lib/editor/types/history-types'\nexport {\n\ttype OptionalKeys,\n\ttype RequiredKeys,\n\ttype TLCameraConstraints,\n\ttype TLCameraMoveOptions,\n\ttype TLCameraOptions,\n\ttype TLExportType,\n\ttype TLGetShapeAtPointOptions,\n\ttype TLImageExportOptions,\n\ttype TLSvgExportOptions,\n\ttype TLUpdatePointerOptions,\n} from './lib/editor/types/misc-types'\nexport {\n\ttype TLAdjacentDirection,\n\ttype TLResizeHandle,\n\ttype TLSelectionHandle,\n} from './lib/editor/types/selection-types'\nexport {\n\tuseDelaySvgExport,\n\tuseSvgExportContext,\n\ttype SvgExportContext,\n\ttype SvgExportDef,\n} from './lib/editor/types/SvgExportContext'\nexport { getSvgAsImage } from './lib/exports/getSvgAsImage'\nexport { tlenv, tlenvReactive } from './lib/globals/environment'\nexport { tlmenus } from './lib/globals/menus'\nexport { tltime } from './lib/globals/time'\nexport {\n\tContainerProvider,\n\tuseContainer,\n\tuseContainerIfExists,\n\ttype ContainerProviderProps,\n} from './lib/hooks/useContainer'\nexport { getCursor } from './lib/hooks/useCursor'\nexport {\n\tEditorContext,\n\tEditorProvider,\n\tuseEditor,\n\tuseMaybeEditor,\n\ttype EditorProviderProps,\n} from './lib/hooks/useEditor'\nexport { useEditorComponents } from './lib/hooks/useEditorComponents'\nexport type { TLEditorComponents } from './lib/hooks/useEditorComponents'\nexport { useEvent, useReactiveEvent } from './lib/hooks/useEvent'\nexport { useGlobalMenuIsOpen } from './lib/hooks/useGlobalMenuIsOpen'\nexport { useShallowArrayIdentity, useShallowObjectIdentity } from './lib/hooks/useIdentity'\nexport { useIsCropping } from './lib/hooks/useIsCropping'\nexport { useIsDarkMode } from './lib/hooks/useIsDarkMode'\nexport { useIsEditing } from './lib/hooks/useIsEditing'\nexport { useLocalStore } from './lib/hooks/useLocalStore'\nexport { usePassThroughMouseOverEvents } from './lib/hooks/usePassThroughMouseOverEvents'\nexport { usePassThroughWheelEvents } from './lib/hooks/usePassThroughWheelEvents'\nexport { usePeerIds } from './lib/hooks/usePeerIds'\nexport { usePresence } from './lib/hooks/usePresence'\nexport { useRefState } from './lib/hooks/useRefState'\nexport {\n\tsanitizeId,\n\tsuffixSafeId,\n\tuseSharedSafeId,\n\tuseUniqueSafeId,\n\ttype SafeId,\n} from './lib/hooks/useSafeId'\nexport { useSelectionEvents } from './lib/hooks/useSelectionEvents'\nexport { useTLSchemaFromUtils, useTLStore } from './lib/hooks/useTLStore'\nexport { useTransform } from './lib/hooks/useTransform'\nexport { useViewportHeight } from './lib/hooks/useViewportHeight'\nexport {\n\tLicenseManager,\n\ttype InvalidLicenseKeyResult,\n\ttype InvalidLicenseReason,\n\ttype LicenseFromKeyResult,\n\ttype LicenseInfo,\n\ttype LicenseState,\n\ttype ValidLicenseKeyResult,\n} from './lib/license/LicenseManager'\nexport { LICENSE_TIMEOUT } from './lib/license/LicenseProvider'\nexport { defaultTldrawOptions, type TldrawOptions } from './lib/options'\nexport {\n\tBox,\n\tROTATE_CORNER_TO_SELECTION_CORNER,\n\trotateSelectionHandle,\n\ttype BoxLike,\n\ttype RotateCorner,\n\ttype SelectionCorner,\n\ttype SelectionEdge,\n\ttype SelectionHandle,\n} from './lib/primitives/Box'\nexport { EASINGS } from './lib/primitives/easings'\nexport { Arc2d } from './lib/primitives/geometry/Arc2d'\nexport { Circle2d } from './lib/primitives/geometry/Circle2d'\nexport { CubicBezier2d } from './lib/primitives/geometry/CubicBezier2d'\nexport { CubicSpline2d } from './lib/primitives/geometry/CubicSpline2d'\nexport { Edge2d } from './lib/primitives/geometry/Edge2d'\nexport { Ellipse2d } from './lib/primitives/geometry/Ellipse2d'\nexport { getVerticesCountForArcLength } from './lib/primitives/geometry/geometry-constants'\nexport {\n\tGeometry2d,\n\tGeometry2dFilters,\n\tTransformedGeometry2d,\n\ttype Geometry2dOptions,\n\ttype TransformedGeometry2dOptions,\n} from './lib/primitives/geometry/Geometry2d'\nexport { Group2d } from './lib/primitives/geometry/Group2d'\nexport { Point2d } from './lib/primitives/geometry/Point2d'\nexport { Polygon2d } from './lib/primitives/geometry/Polygon2d'\nexport { Polyline2d } from './lib/primitives/geometry/Polyline2d'\nexport { Rectangle2d } from './lib/primitives/geometry/Rectangle2d'\nexport { Stadium2d } from './lib/primitives/geometry/Stadium2d'\nexport {\n\tintersectCircleCircle,\n\tintersectCirclePolygon,\n\tintersectCirclePolyline,\n\tintersectLineSegmentCircle,\n\tintersectLineSegmentLineSegment,\n\tintersectLineSegmentPolygon,\n\tintersectLineSegmentPolyline,\n\tintersectPolygonBounds,\n\tintersectPolygonPolygon,\n\tlinesIntersect,\n\tpolygonIntersectsPolyline,\n\tpolygonsIntersect,\n} from './lib/primitives/intersect'\nexport { Mat, type MatLike, type MatModel } from './lib/primitives/Mat'\nexport {\n\tangleDistance,\n\tapproximately,\n\tareAnglesCompatible,\n\taverage,\n\tcanonicalizeRotation,\n\tcenterOfCircleFromThreePoints,\n\tclamp,\n\tclampRadians,\n\tclockwiseAngleDist,\n\tcounterClockwiseAngleDist,\n\tdegreesToRadians,\n\tgetArcMeasure,\n\tgetPointInArcT,\n\tgetPointOnCircle,\n\tgetPointsOnArc,\n\tgetPolygonVertices,\n\tHALF_PI,\n\tisSafeFloat,\n\tperimeterOfEllipse,\n\tPI,\n\tPI2,\n\tpointInPolygon,\n\tprecise,\n\tradiansToDegrees,\n\trangeIntersection,\n\tshortAngleDist,\n\tSIN,\n\tsnapAngle,\n\ttoDomPrecision,\n\ttoFixed,\n\ttoPrecision,\n} from './lib/primitives/utils'\nexport { Vec, type VecLike } from './lib/primitives/Vec'\nexport {\n\tErrorScreen,\n\tLoadingScreen,\n\tTldrawEditor,\n\tuseOnMount,\n\ttype LoadingScreenProps,\n\ttype TldrawEditorBaseProps,\n\ttype TldrawEditorProps,\n\ttype TldrawEditorStoreProps,\n\ttype TldrawEditorWithoutStoreProps,\n\ttype TldrawEditorWithStoreProps,\n\ttype TLOnMountHandler,\n} from './lib/TldrawEditor'\nexport { dataUrlToFile, getDefaultCdnBaseUrl } from './lib/utils/assets'\nexport { clampToBrowserMaxCanvasSize, type CanvasMaxSize } from './lib/utils/browserCanvasMaxSize'\nexport {\n\tcreateDebugValue,\n\tdebugFlags,\n\tfeatureFlags,\n\ttype DebugFlag,\n\ttype DebugFlagDef,\n\ttype DebugFlagDefaults,\n} from './lib/utils/debug-flags'\nexport {\n\tcreateDeepLinkString,\n\tparseDeepLinkString,\n\ttype TLDeepLink,\n\ttype TLDeepLinkOptions,\n} from './lib/utils/deepLinks'\nexport {\n\tactiveElementShouldCaptureKeys,\n\tloopToHtmlElement,\n\tpreventDefault,\n\treleasePointerCapture,\n\tsetPointerCapture,\n\tstopEventPropagation,\n} from './lib/utils/dom'\nexport { EditorAtom } from './lib/utils/EditorAtom'\nexport { getIncrementedName } from './lib/utils/getIncrementedName'\nexport { getPointerInfo } from './lib/utils/getPointerInfo'\nexport { getSvgPathFromPoints } from './lib/utils/getSvgPathFromPoints'\nexport { hardResetEditor } from './lib/utils/hardResetEditor'\nexport { isAccelKey } from './lib/utils/keyboard'\nexport { normalizeWheel } from './lib/utils/normalizeWheel'\nexport { refreshPage } from './lib/utils/refreshPage'\nexport { getDroppedShapesToNewParents, kickoutOccludedShapes } from './lib/utils/reparenting'\nexport {\n\tgetFontsFromRichText,\n\ttype RichTextFontVisitor,\n\ttype RichTextFontVisitorState,\n\ttype TiptapEditor,\n\ttype TiptapNode,\n\ttype TLTextOptions,\n} from './lib/utils/richText'\nexport {\n\tapplyRotationToSnapshotShapes,\n\tgetRotationSnapshot,\n\ttype TLRotationSnapshot,\n} from './lib/utils/rotation'\nexport { runtime, setRuntimeOverrides } from './lib/utils/runtime'\nexport {\n\tReadonlySharedStyleMap,\n\tSharedStyleMap,\n\ttype SharedStyle,\n} from './lib/utils/SharedStylesMap'\nexport { hardReset } from './lib/utils/sync/hardReset'\nexport { LocalIndexedDb, Table, type StoreName } from './lib/utils/sync/LocalIndexedDb'\nexport { type TLStoreWithStatus } from './lib/utils/sync/StoreWithStatus'\nexport { uniq } from './lib/utils/uniq'\nexport { openWindow } from './lib/utils/window-open'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_L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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA6C;AAC7C,gBAAO;AACP,sBAAO;AACP,kBAAO;AACP,IAAAA,aAAO;AACP,yBAAO;AAGP,0BAAc,0BARd;AAUA,0BAAc,gCAVd;AAYA,0BAAc,0BAZd;AAcA,0BAAc,6BAdd;AAgBA,0BAAc,0BAhBd;AAkBA,0BAAc,6BAlBd;AAoBA,+BAAkC;AAClC,0BAAgD;AAChD,2BAGO;AACP,qCAGO;AACP,2BAGO;AACP,kCAGO;AACP,yBAA8C;AAC9C,2BAGO;AACP,4BAGO;AACP,6BAGO;AACP,wCAGO;AACP,wCAGO;AAEP,mCAGO;AAEP,oCAGO;AACP,iCAGO;AACP,iCAGO;AACP,4BAA+B;AAC/B,4BAA+B;AAC/B,2BAIO;AACP,2BAAuD;AACvD,8BAAiC;AACjC,0BAAqD;AACrD,2BAQO;AACP,0BAAyD;AAEzD,2BAA2D;AAC3D,8BAKO;AACP,oCAOO;AACP,+BAQO;AACP,uBAAyE;AACzE,yBASO;AACP,oBAMO;AACP,0BAAgD;AAChD,+BAAkC;AAClC,yBAIO;AACP,4BAA+B;AAC/B,2BAA8B;AAC9B,
|
|
4
|
+
"sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\nimport 'core-js/stable/array/at.js'\nimport 'core-js/stable/array/flat-map.js'\nimport 'core-js/stable/array/flat.js'\nimport 'core-js/stable/string/at.js'\nimport 'core-js/stable/string/replace-all.js'\n\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/state-react'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/store'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/tlschema'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/utils'\n// eslint-disable-next-line local/no-export-star\nexport * from '@tldraw/validate'\n\nexport { DefaultBackground } from './lib/components/default-components/DefaultBackground'\nexport { DefaultBrush, type TLBrushProps } from './lib/components/default-components/DefaultBrush'\nexport {\n\tDefaultCanvas,\n\ttype TLCanvasComponentProps,\n} from './lib/components/default-components/DefaultCanvas'\nexport {\n\tDefaultCollaboratorHint,\n\ttype TLCollaboratorHintProps,\n} from './lib/components/default-components/DefaultCollaboratorHint'\nexport {\n\tDefaultCursor,\n\ttype TLCursorProps,\n} from './lib/components/default-components/DefaultCursor'\nexport {\n\tDefaultErrorFallback,\n\ttype TLErrorFallbackComponent,\n} from './lib/components/default-components/DefaultErrorFallback'\nexport { DefaultGrid, type TLGridProps } from './lib/components/default-components/DefaultGrid'\nexport {\n\tDefaultHandle,\n\ttype TLHandleProps,\n} from './lib/components/default-components/DefaultHandle'\nexport {\n\tDefaultHandles,\n\ttype TLHandlesProps,\n} from './lib/components/default-components/DefaultHandles'\nexport {\n\tDefaultScribble,\n\ttype TLScribbleProps,\n} from './lib/components/default-components/DefaultScribble'\nexport {\n\tDefaultSelectionBackground,\n\ttype TLSelectionBackgroundProps,\n} from './lib/components/default-components/DefaultSelectionBackground'\nexport {\n\tDefaultSelectionForeground,\n\ttype TLSelectionForegroundProps,\n} from './lib/components/default-components/DefaultSelectionForeground'\nexport { type TLShapeErrorFallbackComponent } from './lib/components/default-components/DefaultShapeErrorFallback'\nexport {\n\tDefaultShapeIndicator,\n\ttype TLShapeIndicatorProps,\n} from './lib/components/default-components/DefaultShapeIndicator'\nexport { type TLShapeIndicatorErrorFallbackComponent } from './lib/components/default-components/DefaultShapeIndicatorErrorFallback'\nexport {\n\tDefaultShapeIndicators,\n\ttype TLShapeIndicatorsProps,\n} from './lib/components/default-components/DefaultShapeIndicators'\nexport {\n\tDefaultShapeWrapper,\n\ttype TLShapeWrapperProps,\n} from './lib/components/default-components/DefaultShapeWrapper'\nexport {\n\tDefaultSnapIndicator,\n\ttype TLSnapIndicatorProps,\n} from './lib/components/default-components/DefaultSnapIndictor'\nexport { DefaultSpinner } from './lib/components/default-components/DefaultSpinner'\nexport { DefaultSvgDefs } from './lib/components/default-components/DefaultSvgDefs'\nexport {\n\tErrorBoundary,\n\tOptionalErrorBoundary,\n\ttype TLErrorBoundaryProps,\n} from './lib/components/ErrorBoundary'\nexport { HTMLContainer, type HTMLContainerProps } from './lib/components/HTMLContainer'\nexport { MenuClickCapture } from './lib/components/MenuClickCapture'\nexport { SVGContainer, type SVGContainerProps } from './lib/components/SVGContainer'\nexport {\n\tcreateTLSchemaFromUtils,\n\tcreateTLStore,\n\tinlineBase64AssetStore,\n\ttype TLStoreBaseOptions,\n\ttype TLStoreEventInfo,\n\ttype TLStoreOptions,\n\ttype TLStoreSchemaOptions,\n} from './lib/config/createTLStore'\nexport { createTLUser, useTldrawUser, type TLUser } from './lib/config/createTLUser'\nexport { type TLAnyBindingUtilConstructor } from './lib/config/defaultBindings'\nexport { coreShapes, type TLAnyShapeUtilConstructor } from './lib/config/defaultShapes'\nexport {\n\tgetSnapshot,\n\tloadSnapshot,\n\ttype TLEditorSnapshot,\n\ttype TLLoadSnapshotOptions,\n} from './lib/config/TLEditorSnapshot'\nexport {\n\tcreateSessionStateSnapshotSignal,\n\textractSessionStateFromLegacySnapshot,\n\tloadSessionStateSnapshotIntoStore,\n\tTAB_ID,\n\ttype TLLoadSessionStateSnapshotOptions,\n\ttype TLSessionStateSnapshot,\n} from './lib/config/TLSessionStateSnapshot'\nexport {\n\tdefaultUserPreferences,\n\tgetFreshUserPreferences,\n\tgetUserPreferences,\n\tsetUserPreferences,\n\tUSER_COLORS,\n\tuserTypeValidator,\n\ttype TLUserPreferences,\n} from './lib/config/TLUserPreferences'\nexport { DEFAULT_ANIMATION_OPTIONS, DEFAULT_CAMERA_OPTIONS, SIDES } from './lib/constants'\nexport {\n\tBindingUtil,\n\ttype BindingOnChangeOptions,\n\ttype BindingOnCreateOptions,\n\ttype BindingOnDeleteOptions,\n\ttype BindingOnShapeChangeOptions,\n\ttype BindingOnShapeDeleteOptions,\n\ttype BindingOnShapeIsolateOptions,\n\ttype TLBindingUtilConstructor,\n} from './lib/editor/bindings/BindingUtil'\nexport {\n\tEditor,\n\ttype TLEditorOptions,\n\ttype TLEditorRunOptions,\n\ttype TLRenderingShape,\n\ttype TLResizeShapeOptions,\n} from './lib/editor/Editor'\nexport { ClickManager, type TLClickState } from './lib/editor/managers/ClickManager/ClickManager'\nexport { EdgeScrollManager } from './lib/editor/managers/EdgeScrollManager/EdgeScrollManager'\nexport {\n\tFontManager,\n\ttype TLFontFace,\n\ttype TLFontFaceSource,\n} from './lib/editor/managers/FontManager/FontManager'\nexport { HistoryManager } from './lib/editor/managers/HistoryManager/HistoryManager'\nexport { InputsManager } from './lib/editor/managers/InputsManager/InputsManager'\nexport {\n\tScribbleManager,\n\ttype ScribbleItem,\n\ttype ScribbleSessionOptions,\n} from './lib/editor/managers/ScribbleManager/ScribbleManager'\nexport {\n\tBoundsSnaps,\n\ttype BoundsSnapGeometry,\n\ttype BoundsSnapPoint,\n} from './lib/editor/managers/SnapManager/BoundsSnaps'\nexport { HandleSnaps, type HandleSnapGeometry } from './lib/editor/managers/SnapManager/HandleSnaps'\nexport {\n\tSnapManager,\n\ttype GapsSnapIndicator,\n\ttype PointsSnapIndicator,\n\ttype SnapData,\n\ttype SnapIndicator,\n} from './lib/editor/managers/SnapManager/SnapManager'\nexport { SpatialIndexManager } from './lib/editor/managers/SpatialIndexManager/SpatialIndexManager'\nexport {\n\tTextManager,\n\ttype TLMeasureTextOpts,\n\ttype TLMeasureTextSpanOpts,\n} from './lib/editor/managers/TextManager/TextManager'\nexport { TickManager } from './lib/editor/managers/TickManager/TickManager'\nexport { UserPreferencesManager } from './lib/editor/managers/UserPreferencesManager/UserPreferencesManager'\nexport { BaseBoxShapeUtil, type TLBaseBoxShape } from './lib/editor/shapes/BaseBoxShapeUtil'\nexport { GroupShapeUtil } from './lib/editor/shapes/group/GroupShapeUtil'\nexport {\n\tShapeUtil,\n\ttype TLCropInfo,\n\ttype TLDragShapesInInfo,\n\ttype TLDragShapesOutInfo,\n\ttype TLDragShapesOverInfo,\n\ttype TLDropShapesOverInfo,\n\ttype TLEditStartInfo,\n\ttype TLGeometryOpts,\n\ttype TLHandleDragInfo,\n\ttype TLIndicatorPath,\n\ttype TLResizeInfo,\n\ttype TLResizeMode,\n\ttype TLShapeUtilCanBeLaidOutOpts,\n\ttype TLShapeUtilCanBindOpts,\n\ttype TLShapeUtilCanvasSvgDef,\n\ttype TLShapeUtilConstructor,\n} from './lib/editor/shapes/ShapeUtil'\nexport {\n\tgetPerfectDashProps,\n\ttype PerfectDashTerminal,\n} from './lib/editor/shapes/shared/getPerfectDashProps'\nexport { resizeBox, type ResizeBoxOptions } from './lib/editor/shapes/shared/resizeBox'\nexport { resizeScaled } from './lib/editor/shapes/shared/resizeScaled'\nexport { BaseBoxShapeTool } from './lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool'\nexport { maybeSnapToGrid } from './lib/editor/tools/BaseBoxShapeTool/children/Pointing'\nexport { StateNode, type TLStateNodeConstructor } from './lib/editor/tools/StateNode'\nexport { type TLContent } from './lib/editor/types/clipboard-types'\nexport { type TLEventMap, type TLEventMapHandler } from './lib/editor/types/emit-types'\nexport {\n\tEVENT_NAME_MAP,\n\ttype TLBaseEventInfo,\n\ttype TLCancelEvent,\n\ttype TLCancelEventInfo,\n\ttype TLClickEvent,\n\ttype TLClickEventInfo,\n\ttype TLCLickEventName,\n\ttype TLCompleteEvent,\n\ttype TLCompleteEventInfo,\n\ttype TLEnterEventHandler,\n\ttype TLEventHandlers,\n\ttype TLEventInfo,\n\ttype TLEventName,\n\ttype TLExitEventHandler,\n\ttype TLInterruptEvent,\n\ttype TLInterruptEventInfo,\n\ttype TLKeyboardEvent,\n\ttype TLKeyboardEventInfo,\n\ttype TLKeyboardEventName,\n\ttype TLPinchEvent,\n\ttype TLPinchEventInfo,\n\ttype TLPinchEventName,\n\ttype TLPointerEvent,\n\ttype TLPointerEventInfo,\n\ttype TLPointerEventName,\n\ttype TLPointerEventTarget,\n\ttype TLTickEvent,\n\ttype TLTickEventInfo,\n\ttype TLWheelEvent,\n\ttype TLWheelEventInfo,\n\ttype UiEvent,\n\ttype UiEventType,\n} from './lib/editor/types/event-types'\nexport {\n\ttype TLBaseExternalContent,\n\ttype TLEmbedExternalContent,\n\ttype TLErrorExternalContentSource,\n\ttype TLExcalidrawExternalContent,\n\ttype TLExcalidrawExternalContentSource,\n\ttype TLExternalAsset,\n\ttype TLExternalContent,\n\ttype TLExternalContentSource,\n\ttype TLFileExternalAsset,\n\ttype TLFileReplaceExternalContent,\n\ttype TLFilesExternalContent,\n\ttype TLSvgTextExternalContent,\n\ttype TLTextExternalContent,\n\ttype TLTextExternalContentSource,\n\ttype TLTldrawExternalContent,\n\ttype TLTldrawExternalContentSource,\n\ttype TLUrlExternalAsset,\n\ttype TLUrlExternalContent,\n} from './lib/editor/types/external-content'\nexport {\n\ttype TLHistoryBatchOptions,\n\ttype TLHistoryDiff,\n\ttype TLHistoryEntry,\n\ttype TLHistoryMark,\n} from './lib/editor/types/history-types'\nexport {\n\ttype OptionalKeys,\n\ttype RequiredKeys,\n\ttype TLCameraConstraints,\n\ttype TLCameraMoveOptions,\n\ttype TLCameraOptions,\n\ttype TLExportType,\n\ttype TLGetShapeAtPointOptions,\n\ttype TLImageExportOptions,\n\ttype TLSvgExportOptions,\n\ttype TLUpdatePointerOptions,\n} from './lib/editor/types/misc-types'\nexport {\n\ttype TLAdjacentDirection,\n\ttype TLResizeHandle,\n\ttype TLSelectionHandle,\n} from './lib/editor/types/selection-types'\nexport {\n\tuseDelaySvgExport,\n\tuseSvgExportContext,\n\ttype SvgExportContext,\n\ttype SvgExportDef,\n} from './lib/editor/types/SvgExportContext'\nexport { getSvgAsImage } from './lib/exports/getSvgAsImage'\nexport { tlenv, tlenvReactive } from './lib/globals/environment'\nexport { tlmenus } from './lib/globals/menus'\nexport { tltime } from './lib/globals/time'\nexport {\n\tContainerProvider,\n\tuseContainer,\n\tuseContainerIfExists,\n\ttype ContainerProviderProps,\n} from './lib/hooks/useContainer'\nexport { getCursor } from './lib/hooks/useCursor'\nexport {\n\tEditorContext,\n\tEditorProvider,\n\tuseEditor,\n\tuseMaybeEditor,\n\ttype EditorProviderProps,\n} from './lib/hooks/useEditor'\nexport { useEditorComponents } from './lib/hooks/useEditorComponents'\nexport type { TLEditorComponents } from './lib/hooks/useEditorComponents'\nexport { useEvent, useReactiveEvent } from './lib/hooks/useEvent'\nexport { useGlobalMenuIsOpen } from './lib/hooks/useGlobalMenuIsOpen'\nexport { useShallowArrayIdentity, useShallowObjectIdentity } from './lib/hooks/useIdentity'\nexport { useIsCropping } from './lib/hooks/useIsCropping'\nexport { useIsDarkMode } from './lib/hooks/useIsDarkMode'\nexport { useIsEditing } from './lib/hooks/useIsEditing'\nexport { useLocalStore } from './lib/hooks/useLocalStore'\nexport { usePassThroughMouseOverEvents } from './lib/hooks/usePassThroughMouseOverEvents'\nexport { usePassThroughWheelEvents } from './lib/hooks/usePassThroughWheelEvents'\nexport { usePeerIds } from './lib/hooks/usePeerIds'\nexport { usePresence } from './lib/hooks/usePresence'\nexport { useRefState } from './lib/hooks/useRefState'\nexport {\n\tsanitizeId,\n\tsuffixSafeId,\n\tuseSharedSafeId,\n\tuseUniqueSafeId,\n\ttype SafeId,\n} from './lib/hooks/useSafeId'\nexport { useSelectionEvents } from './lib/hooks/useSelectionEvents'\nexport { useTLSchemaFromUtils, useTLStore } from './lib/hooks/useTLStore'\nexport { useTransform } from './lib/hooks/useTransform'\nexport { useViewportHeight } from './lib/hooks/useViewportHeight'\nexport {\n\tLicenseManager,\n\ttype InvalidLicenseKeyResult,\n\ttype InvalidLicenseReason,\n\ttype LicenseFromKeyResult,\n\ttype LicenseInfo,\n\ttype LicenseState,\n\ttype ValidLicenseKeyResult,\n} from './lib/license/LicenseManager'\nexport { LICENSE_TIMEOUT } from './lib/license/LicenseProvider'\nexport { defaultTldrawOptions, type TldrawOptions } from './lib/options'\nexport {\n\tBox,\n\tROTATE_CORNER_TO_SELECTION_CORNER,\n\trotateSelectionHandle,\n\ttype BoxLike,\n\ttype RotateCorner,\n\ttype SelectionCorner,\n\ttype SelectionEdge,\n\ttype SelectionHandle,\n} from './lib/primitives/Box'\nexport { EASINGS } from './lib/primitives/easings'\nexport { Arc2d } from './lib/primitives/geometry/Arc2d'\nexport { Circle2d } from './lib/primitives/geometry/Circle2d'\nexport { CubicBezier2d } from './lib/primitives/geometry/CubicBezier2d'\nexport { CubicSpline2d } from './lib/primitives/geometry/CubicSpline2d'\nexport { Edge2d } from './lib/primitives/geometry/Edge2d'\nexport { Ellipse2d } from './lib/primitives/geometry/Ellipse2d'\nexport { getVerticesCountForArcLength } from './lib/primitives/geometry/geometry-constants'\nexport {\n\tGeometry2d,\n\tGeometry2dFilters,\n\tTransformedGeometry2d,\n\ttype Geometry2dOptions,\n\ttype TransformedGeometry2dOptions,\n} from './lib/primitives/geometry/Geometry2d'\nexport { Group2d } from './lib/primitives/geometry/Group2d'\nexport { Point2d } from './lib/primitives/geometry/Point2d'\nexport { Polygon2d } from './lib/primitives/geometry/Polygon2d'\nexport { Polyline2d } from './lib/primitives/geometry/Polyline2d'\nexport { Rectangle2d } from './lib/primitives/geometry/Rectangle2d'\nexport { Stadium2d } from './lib/primitives/geometry/Stadium2d'\nexport {\n\tintersectCircleCircle,\n\tintersectCirclePolygon,\n\tintersectCirclePolyline,\n\tintersectLineSegmentCircle,\n\tintersectLineSegmentLineSegment,\n\tintersectLineSegmentPolygon,\n\tintersectLineSegmentPolyline,\n\tintersectPolygonBounds,\n\tintersectPolygonPolygon,\n\tlinesIntersect,\n\tpolygonIntersectsPolyline,\n\tpolygonsIntersect,\n} from './lib/primitives/intersect'\nexport { Mat, type MatLike, type MatModel } from './lib/primitives/Mat'\nexport {\n\tangleDistance,\n\tapproximately,\n\tareAnglesCompatible,\n\taverage,\n\tcanonicalizeRotation,\n\tcenterOfCircleFromThreePoints,\n\tclamp,\n\tclampRadians,\n\tclockwiseAngleDist,\n\tcounterClockwiseAngleDist,\n\tdegreesToRadians,\n\tgetArcMeasure,\n\tgetPointInArcT,\n\tgetPointOnCircle,\n\tgetPointsOnArc,\n\tgetPolygonVertices,\n\tHALF_PI,\n\tisSafeFloat,\n\tperimeterOfEllipse,\n\tPI,\n\tPI2,\n\tpointInPolygon,\n\tprecise,\n\tradiansToDegrees,\n\trangeIntersection,\n\tshortAngleDist,\n\tSIN,\n\tsnapAngle,\n\ttoDomPrecision,\n\ttoFixed,\n\ttoPrecision,\n} from './lib/primitives/utils'\nexport { Vec, type VecLike } from './lib/primitives/Vec'\nexport {\n\tErrorScreen,\n\tLoadingScreen,\n\tTldrawEditor,\n\tuseOnMount,\n\ttype LoadingScreenProps,\n\ttype TldrawEditorBaseProps,\n\ttype TldrawEditorProps,\n\ttype TldrawEditorStoreProps,\n\ttype TldrawEditorWithoutStoreProps,\n\ttype TldrawEditorWithStoreProps,\n\ttype TLOnMountHandler,\n} from './lib/TldrawEditor'\nexport { dataUrlToFile, getDefaultCdnBaseUrl } from './lib/utils/assets'\nexport { clampToBrowserMaxCanvasSize, type CanvasMaxSize } from './lib/utils/browserCanvasMaxSize'\nexport {\n\tcreateDebugValue,\n\tdebugFlags,\n\tfeatureFlags,\n\ttype DebugFlag,\n\ttype DebugFlagDef,\n\ttype DebugFlagDefaults,\n} from './lib/utils/debug-flags'\nexport {\n\tcreateDeepLinkString,\n\tparseDeepLinkString,\n\ttype TLDeepLink,\n\ttype TLDeepLinkOptions,\n} from './lib/utils/deepLinks'\nexport {\n\tactiveElementShouldCaptureKeys,\n\tloopToHtmlElement,\n\tpreventDefault,\n\treleasePointerCapture,\n\tsetPointerCapture,\n\tstopEventPropagation,\n} from './lib/utils/dom'\nexport { EditorAtom } from './lib/utils/EditorAtom'\nexport { getIncrementedName } from './lib/utils/getIncrementedName'\nexport { getPointerInfo } from './lib/utils/getPointerInfo'\nexport { getSvgPathFromPoints } from './lib/utils/getSvgPathFromPoints'\nexport { hardResetEditor } from './lib/utils/hardResetEditor'\nexport { isAccelKey } from './lib/utils/keyboard'\nexport { normalizeWheel } from './lib/utils/normalizeWheel'\nexport { refreshPage } from './lib/utils/refreshPage'\nexport { getDroppedShapesToNewParents, kickoutOccludedShapes } from './lib/utils/reparenting'\nexport {\n\tgetFontsFromRichText,\n\ttype RichTextFontVisitor,\n\ttype RichTextFontVisitorState,\n\ttype TiptapEditor,\n\ttype TiptapNode,\n\ttype TLTextOptions,\n} from './lib/utils/richText'\nexport {\n\tapplyRotationToSnapshotShapes,\n\tgetRotationSnapshot,\n\ttype TLRotationSnapshot,\n} from './lib/utils/rotation'\nexport { runtime, setRuntimeOverrides } from './lib/utils/runtime'\nexport {\n\tReadonlySharedStyleMap,\n\tSharedStyleMap,\n\ttype SharedStyle,\n} from './lib/utils/SharedStylesMap'\nexport { hardReset } from './lib/utils/sync/hardReset'\nexport { LocalIndexedDb, Table, type StoreName } from './lib/utils/sync/LocalIndexedDb'\nexport { type TLStoreWithStatus } from './lib/utils/sync/StoreWithStatus'\nexport { uniq } from './lib/utils/uniq'\nexport { openWindow } from './lib/utils/window-open'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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AACxB,mBAAsB;AACtB,sBAAyB;AACzB,2BAA8B;AAC9B,2BAA8B;AAC9B,oBAAuB;AACvB,uBAA0B;AAC1B,gCAA6C;AAC7C,wBAMO;AACP,qBAAwB;AACxB,qBAAwB;AACxB,uBAA0B;AAC1B,wBAA2B;AAC3B,yBAA4B;AAC5B,uBAA0B;AAC1B,uBAaO;AACP,iBAAiD;AACjD,IAAAC,gBAgCO;AACP,iBAAkC;AAClC,0BAYO;AACP,oBAAoD;AACpD,kCAAgE;AAChE,yBAOO;AACP,uBAKO;AACP,iBAOO;AACP,wBAA2B;AAC3B,gCAAmC;AACnC,4BAA+B;AAC/B,kCAAqC;AACrC,6BAAgC;AAChC,sBAA2B;AAC3B,4BAA+B;AAC/B,yBAA4B;AAC5B,yBAAoE;AACpE,sBAOO;AACP,sBAIO;AACP,qBAA6C;AAC7C,6BAIO;AACP,uBAA0B;AAC1B,4BAAsD;AAEtD,kBAAqB;AACrB,yBAA2B;AAAA,IAE3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
6
|
"names": ["import_at", "import_utils"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var CanvasShapeIndicators_exports = {};
|
|
20
|
+
__export(CanvasShapeIndicators_exports, {
|
|
21
|
+
CanvasShapeIndicators: () => CanvasShapeIndicators
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(CanvasShapeIndicators_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_state_react = require("@tldraw/state-react");
|
|
26
|
+
var import_store = require("@tldraw/store");
|
|
27
|
+
var import_utils = require("@tldraw/utils");
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
var import_useEditor = require("../../hooks/useEditor");
|
|
30
|
+
var import_useIsDarkMode = require("../../hooks/useIsDarkMode");
|
|
31
|
+
const indicatorPathCache = (0, import_store.createComputedCache)(
|
|
32
|
+
"indicatorPath",
|
|
33
|
+
(editor, shape) => {
|
|
34
|
+
const util = editor.getShapeUtil(shape);
|
|
35
|
+
return util.getIndicatorPath(shape);
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
const getIndicatorPath = (editor, shape) => {
|
|
39
|
+
return indicatorPathCache.get(editor, shape.id);
|
|
40
|
+
};
|
|
41
|
+
function renderShapeIndicator(ctx, editor, shapeId, renderingShapeIds) {
|
|
42
|
+
if (!renderingShapeIds.has(shapeId)) return false;
|
|
43
|
+
const shape = editor.getShape(shapeId);
|
|
44
|
+
if (!shape || shape.isLocked) return false;
|
|
45
|
+
const pageTransform = editor.getShapePageTransform(shape);
|
|
46
|
+
if (!pageTransform) return false;
|
|
47
|
+
const indicatorPath = getIndicatorPath(editor, shape);
|
|
48
|
+
if (!indicatorPath) return false;
|
|
49
|
+
ctx.save();
|
|
50
|
+
ctx.transform(
|
|
51
|
+
pageTransform.a,
|
|
52
|
+
pageTransform.b,
|
|
53
|
+
pageTransform.c,
|
|
54
|
+
pageTransform.d,
|
|
55
|
+
pageTransform.e,
|
|
56
|
+
pageTransform.f
|
|
57
|
+
);
|
|
58
|
+
renderIndicatorPath(ctx, indicatorPath);
|
|
59
|
+
ctx.restore();
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
function renderIndicatorPath(ctx, indicatorPath) {
|
|
63
|
+
if (indicatorPath instanceof Path2D) {
|
|
64
|
+
ctx.stroke(indicatorPath);
|
|
65
|
+
} else {
|
|
66
|
+
const { path, clipPath, additionalPaths } = indicatorPath;
|
|
67
|
+
if (clipPath) {
|
|
68
|
+
ctx.save();
|
|
69
|
+
ctx.clip(clipPath, "evenodd");
|
|
70
|
+
ctx.stroke(path);
|
|
71
|
+
ctx.restore();
|
|
72
|
+
} else {
|
|
73
|
+
ctx.stroke(path);
|
|
74
|
+
}
|
|
75
|
+
if (additionalPaths) {
|
|
76
|
+
for (const additionalPath of additionalPaths) {
|
|
77
|
+
ctx.stroke(additionalPath);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const CanvasShapeIndicators = (0, import_react.memo)(function CanvasShapeIndicators2({
|
|
83
|
+
hideAll,
|
|
84
|
+
showAll,
|
|
85
|
+
renderHints = true
|
|
86
|
+
}) {
|
|
87
|
+
const editor = (0, import_useEditor.useEditor)();
|
|
88
|
+
const canvasRef = (0, import_react.useRef)(null);
|
|
89
|
+
if (hideAll && showAll) throw Error("You cannot set both hideAll and showAll props to true");
|
|
90
|
+
const rSelectedColor = (0, import_react.useRef)(null);
|
|
91
|
+
const isDarkMode = (0, import_useIsDarkMode.useIsDarkMode)();
|
|
92
|
+
(0, import_react.useEffect)(() => {
|
|
93
|
+
const timer = editor.timers.setTimeout(() => {
|
|
94
|
+
rSelectedColor.current = null;
|
|
95
|
+
}, 0);
|
|
96
|
+
return () => clearTimeout(timer);
|
|
97
|
+
}, [isDarkMode, editor]);
|
|
98
|
+
const $renderData = (0, import_state_react.useComputed)(
|
|
99
|
+
"indicator render data",
|
|
100
|
+
() => {
|
|
101
|
+
const renderingShapeIds = new Set(editor.getRenderingShapes().map((s) => s.id));
|
|
102
|
+
let idsToDisplay;
|
|
103
|
+
if (showAll) {
|
|
104
|
+
idsToDisplay = renderingShapeIds;
|
|
105
|
+
} else if (hideAll) {
|
|
106
|
+
idsToDisplay = /* @__PURE__ */ new Set();
|
|
107
|
+
} else {
|
|
108
|
+
idsToDisplay = /* @__PURE__ */ new Set();
|
|
109
|
+
const instanceState = editor.getInstanceState();
|
|
110
|
+
const isChangingStyle = instanceState.isChangingStyle;
|
|
111
|
+
const isIdleOrEditing = editor.isInAny("select.idle", "select.editing_shape");
|
|
112
|
+
const isInSelectState = editor.isInAny(
|
|
113
|
+
"select.brushing",
|
|
114
|
+
"select.scribble_brushing",
|
|
115
|
+
"select.pointing_shape",
|
|
116
|
+
"select.pointing_selection",
|
|
117
|
+
"select.pointing_handle"
|
|
118
|
+
);
|
|
119
|
+
if (!isChangingStyle && (isIdleOrEditing || isInSelectState)) {
|
|
120
|
+
for (const id of editor.getSelectedShapeIds()) {
|
|
121
|
+
idsToDisplay.add(id);
|
|
122
|
+
}
|
|
123
|
+
if (isIdleOrEditing && instanceState.isHoveringCanvas && !instanceState.isCoarsePointer) {
|
|
124
|
+
const hovered = editor.getHoveredShapeId();
|
|
125
|
+
if (hovered) idsToDisplay.add(hovered);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const hintingShapeIds = renderHints ? (0, import_utils.dedupe)(editor.getHintingShapeIds()) : [];
|
|
130
|
+
return {
|
|
131
|
+
idsToDisplay,
|
|
132
|
+
renderingShapeIds,
|
|
133
|
+
hintingShapeIds
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
{ isEqual: import_utils.isEqual },
|
|
137
|
+
[editor, showAll, hideAll, renderHints]
|
|
138
|
+
);
|
|
139
|
+
(0, import_state_react.useQuickReactor)(
|
|
140
|
+
"canvas indicators render",
|
|
141
|
+
() => {
|
|
142
|
+
const canvas = canvasRef.current;
|
|
143
|
+
if (!canvas) return;
|
|
144
|
+
const ctx = canvas.getContext("2d");
|
|
145
|
+
if (!ctx) return;
|
|
146
|
+
const { idsToDisplay, renderingShapeIds, hintingShapeIds } = $renderData.get();
|
|
147
|
+
const { w, h } = editor.getViewportScreenBounds();
|
|
148
|
+
const dpr = window.devicePixelRatio || 1;
|
|
149
|
+
const { x: cx, y: cy, z: zoom } = editor.getCamera();
|
|
150
|
+
const canvasWidth = Math.ceil(w * dpr);
|
|
151
|
+
const canvasHeight = Math.ceil(h * dpr);
|
|
152
|
+
if (canvas.width !== canvasWidth || canvas.height !== canvasHeight) {
|
|
153
|
+
canvas.width = canvasWidth;
|
|
154
|
+
canvas.height = canvasHeight;
|
|
155
|
+
canvas.style.width = `${w}px`;
|
|
156
|
+
canvas.style.height = `${h}px`;
|
|
157
|
+
}
|
|
158
|
+
ctx.resetTransform();
|
|
159
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
160
|
+
ctx.scale(dpr, dpr);
|
|
161
|
+
ctx.scale(zoom, zoom);
|
|
162
|
+
ctx.translate(cx, cy);
|
|
163
|
+
if (!rSelectedColor.current) {
|
|
164
|
+
rSelectedColor.current = getComputedStyle(canvas).getPropertyValue("--tl-color-selected");
|
|
165
|
+
}
|
|
166
|
+
ctx.strokeStyle = rSelectedColor.current;
|
|
167
|
+
ctx.lineCap = "round";
|
|
168
|
+
ctx.lineJoin = "round";
|
|
169
|
+
ctx.lineWidth = 1.5 / zoom;
|
|
170
|
+
for (const shapeId of idsToDisplay) {
|
|
171
|
+
renderShapeIndicator(ctx, editor, shapeId, renderingShapeIds);
|
|
172
|
+
}
|
|
173
|
+
if (hintingShapeIds.length > 0) {
|
|
174
|
+
ctx.lineWidth = 2.5 / zoom;
|
|
175
|
+
for (const shapeId of hintingShapeIds) {
|
|
176
|
+
renderShapeIndicator(ctx, editor, shapeId, renderingShapeIds);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
[editor, $renderData]
|
|
181
|
+
);
|
|
182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("canvas", { ref: canvasRef, className: "tl-canvas-indicators" });
|
|
183
|
+
});
|
|
184
|
+
//# sourceMappingURL=CanvasShapeIndicators.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/lib/components/default-components/CanvasShapeIndicators.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useComputed, useQuickReactor } from '@tldraw/state-react'\nimport { createComputedCache } from '@tldraw/store'\nimport { TLShape, TLShapeId } from '@tldraw/tlschema'\nimport { dedupe, isEqual } from '@tldraw/utils'\nimport { memo, useEffect, useRef } from 'react'\nimport { Editor } from '../../editor/Editor'\nimport { TLIndicatorPath } from '../../editor/shapes/ShapeUtil'\nimport { useEditor } from '../../hooks/useEditor'\nimport { useIsDarkMode } from '../../hooks/useIsDarkMode'\n\n/** @public */\nexport interface TLCanvasShapeIndicatorsProps {\n\t/** Whether to hide all of the indicators */\n\thideAll?: boolean\n\t/** Whether to show all of the indicators */\n\tshowAll?: boolean\n\t/** Whether to render hinted shape indicators */\n\trenderHints?: boolean\n}\n\nconst indicatorPathCache = createComputedCache(\n\t'indicatorPath',\n\t(editor: Editor, shape: TLShape) => {\n\t\tconst util = editor.getShapeUtil(shape)\n\t\treturn util.getIndicatorPath(shape)\n\t}\n)\n\nconst getIndicatorPath = (editor: Editor, shape: TLShape) => {\n\treturn indicatorPathCache.get(editor, shape.id)\n}\n\nfunction renderShapeIndicator(\n\tctx: CanvasRenderingContext2D,\n\teditor: Editor,\n\tshapeId: TLShapeId,\n\trenderingShapeIds: Set<TLShapeId>\n): boolean {\n\tif (!renderingShapeIds.has(shapeId)) return false\n\n\tconst shape = editor.getShape(shapeId)\n\tif (!shape || shape.isLocked) return false\n\n\tconst pageTransform = editor.getShapePageTransform(shape)\n\tif (!pageTransform) return false\n\n\tconst indicatorPath = getIndicatorPath(editor, shape)\n\tif (!indicatorPath) return false\n\n\tctx.save()\n\tctx.transform(\n\t\tpageTransform.a,\n\t\tpageTransform.b,\n\t\tpageTransform.c,\n\t\tpageTransform.d,\n\t\tpageTransform.e,\n\t\tpageTransform.f\n\t)\n\trenderIndicatorPath(ctx, indicatorPath)\n\tctx.restore()\n\n\treturn true\n}\n\nfunction renderIndicatorPath(ctx: CanvasRenderingContext2D, indicatorPath: TLIndicatorPath) {\n\tif (indicatorPath instanceof Path2D) {\n\t\tctx.stroke(indicatorPath)\n\t} else {\n\t\tconst { path, clipPath, additionalPaths } = indicatorPath\n\n\t\tif (clipPath) {\n\t\t\tctx.save()\n\t\t\tctx.clip(clipPath, 'evenodd')\n\t\t\tctx.stroke(path)\n\t\t\tctx.restore()\n\t\t} else {\n\t\t\tctx.stroke(path)\n\t\t}\n\n\t\tif (additionalPaths) {\n\t\t\tfor (const additionalPath of additionalPaths) {\n\t\t\t\tctx.stroke(additionalPath)\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** @public @react */\nexport const CanvasShapeIndicators = memo(function CanvasShapeIndicators({\n\thideAll,\n\tshowAll,\n\trenderHints = true,\n}: TLCanvasShapeIndicatorsProps) {\n\tconst editor = useEditor()\n\tconst canvasRef = useRef<HTMLCanvasElement>(null)\n\n\tif (hideAll && showAll) throw Error('You cannot set both hideAll and showAll props to true')\n\n\t// Cache the selected color to avoid getComputedStyle on every render\n\tconst rSelectedColor = useRef<string | null>(null)\n\tconst isDarkMode = useIsDarkMode()\n\n\tuseEffect(() => {\n\t\tconst timer = editor.timers.setTimeout(() => {\n\t\t\trSelectedColor.current = null\n\t\t}, 0)\n\t\treturn () => clearTimeout(timer)\n\t}, [isDarkMode, editor])\n\n\tconst $renderData = useComputed(\n\t\t'indicator render data',\n\t\t() => {\n\t\t\tconst renderingShapeIds = new Set(editor.getRenderingShapes().map((s) => s.id))\n\n\t\t\t// Compute ids to display\n\t\t\tlet idsToDisplay: Set<TLShapeId>\n\t\t\tif (showAll) {\n\t\t\t\tidsToDisplay = renderingShapeIds\n\t\t\t} else if (hideAll) {\n\t\t\t\tidsToDisplay = new Set()\n\t\t\t} else {\n\t\t\t\tidsToDisplay = new Set<TLShapeId>()\n\t\t\t\tconst instanceState = editor.getInstanceState()\n\t\t\t\tconst isChangingStyle = instanceState.isChangingStyle\n\t\t\t\tconst isIdleOrEditing = editor.isInAny('select.idle', 'select.editing_shape')\n\t\t\t\tconst isInSelectState = editor.isInAny(\n\t\t\t\t\t'select.brushing',\n\t\t\t\t\t'select.scribble_brushing',\n\t\t\t\t\t'select.pointing_shape',\n\t\t\t\t\t'select.pointing_selection',\n\t\t\t\t\t'select.pointing_handle'\n\t\t\t\t)\n\n\t\t\t\tif (!isChangingStyle && (isIdleOrEditing || isInSelectState)) {\n\t\t\t\t\tfor (const id of editor.getSelectedShapeIds()) {\n\t\t\t\t\t\tidsToDisplay.add(id)\n\t\t\t\t\t}\n\t\t\t\t\tif (isIdleOrEditing && instanceState.isHoveringCanvas && !instanceState.isCoarsePointer) {\n\t\t\t\t\t\tconst hovered = editor.getHoveredShapeId()\n\t\t\t\t\t\tif (hovered) idsToDisplay.add(hovered)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Compute hinting shape ids\n\t\t\tconst hintingShapeIds = renderHints ? dedupe(editor.getHintingShapeIds()) : []\n\n\t\t\treturn {\n\t\t\t\tidsToDisplay,\n\t\t\t\trenderingShapeIds,\n\t\t\t\thintingShapeIds,\n\t\t\t}\n\t\t},\n\t\t{ isEqual: isEqual },\n\t\t[editor, showAll, hideAll, renderHints]\n\t)\n\n\tuseQuickReactor(\n\t\t'canvas indicators render',\n\t\t() => {\n\t\t\tconst canvas = canvasRef.current\n\t\t\tif (!canvas) return\n\n\t\t\tconst ctx = canvas.getContext('2d')\n\t\t\tif (!ctx) return\n\n\t\t\tconst { idsToDisplay, renderingShapeIds, hintingShapeIds } = $renderData.get()\n\n\t\t\tconst { w, h } = editor.getViewportScreenBounds()\n\t\t\tconst dpr = window.devicePixelRatio || 1\n\t\t\tconst { x: cx, y: cy, z: zoom } = editor.getCamera()\n\n\t\t\tconst canvasWidth = Math.ceil(w * dpr)\n\t\t\tconst canvasHeight = Math.ceil(h * dpr)\n\n\t\t\tif (canvas.width !== canvasWidth || canvas.height !== canvasHeight) {\n\t\t\t\tcanvas.width = canvasWidth\n\t\t\t\tcanvas.height = canvasHeight\n\t\t\t\tcanvas.style.width = `${w}px`\n\t\t\t\tcanvas.style.height = `${h}px`\n\t\t\t}\n\n\t\t\tctx.resetTransform()\n\t\t\tctx.clearRect(0, 0, canvas.width, canvas.height)\n\n\t\t\tctx.scale(dpr, dpr)\n\t\t\tctx.scale(zoom, zoom)\n\t\t\tctx.translate(cx, cy)\n\n\t\t\t// Use cached color, only call getComputedStyle when cache is empty\n\t\t\tif (!rSelectedColor.current) {\n\t\t\t\trSelectedColor.current = getComputedStyle(canvas).getPropertyValue('--tl-color-selected')\n\t\t\t}\n\n\t\t\tctx.strokeStyle = rSelectedColor.current\n\t\t\tctx.lineCap = 'round'\n\t\t\tctx.lineJoin = 'round'\n\n\t\t\t// Draw selected/hovered indicators (1.5px stroke)\n\t\t\tctx.lineWidth = 1.5 / zoom\n\t\t\tfor (const shapeId of idsToDisplay) {\n\t\t\t\trenderShapeIndicator(ctx, editor, shapeId, renderingShapeIds)\n\t\t\t}\n\n\t\t\t// Draw hinted indicators with a thicker stroke (2.5px)\n\t\t\tif (hintingShapeIds.length > 0) {\n\t\t\t\tctx.lineWidth = 2.5 / zoom\n\t\t\t\tfor (const shapeId of hintingShapeIds) {\n\t\t\t\t\trenderShapeIndicator(ctx, editor, shapeId, renderingShapeIds)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[editor, $renderData]\n\t)\n\n\treturn <canvas ref={canvasRef} className=\"tl-canvas-indicators\" />\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;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UAAI,YAAY,MAAM;AACtB,iBAAW,WAAW,cAAc;AACnC,6BAAqB,KAAK,QAAQ,SAAS,iBAAiB;AAAA,MAC7D;AAGA,UAAI,gBAAgB,SAAS,GAAG;AAC/B,YAAI,YAAY,MAAM;AACtB,mBAAW,WAAW,iBAAiB;AACtC,+BAAqB,KAAK,QAAQ,SAAS,iBAAiB;AAAA,QAC7D;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAC,QAAQ,WAAW;AAAA,EACrB;AAEA,SAAO,4CAAC,YAAO,KAAK,WAAW,WAAU,wBAAuB;AACjE,CAAC;",
|
|
6
|
+
"names": ["CanvasShapeIndicators"]
|
|
7
|
+
}
|
|
@@ -58,6 +58,7 @@ var import_GeometryDebuggingView = require("../GeometryDebuggingView");
|
|
|
58
58
|
var import_LiveCollaborators = require("../LiveCollaborators");
|
|
59
59
|
var import_MenuClickCapture = require("../MenuClickCapture");
|
|
60
60
|
var import_Shape = require("../Shape");
|
|
61
|
+
var import_CanvasShapeIndicators = require("./CanvasShapeIndicators");
|
|
61
62
|
function DefaultCanvas({ className }) {
|
|
62
63
|
const editor = (0, import_useEditor.useEditor)();
|
|
63
64
|
const { SelectionBackground, Background, SvgDefs, ShapeIndicators } = (0, import_useEditorComponents.useEditorComponents)();
|
|
@@ -153,19 +154,22 @@ function DefaultCanvas({ className }) {
|
|
|
153
154
|
SelectionBackground && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectionBackgroundWrapper, {}),
|
|
154
155
|
hideShapes ? null : debugSvg ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShapesWithSVGs, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShapesToDisplay, {})
|
|
155
156
|
] }),
|
|
156
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
157
|
-
|
|
158
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
157
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tl-overlays", children: [
|
|
158
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_CanvasShapeIndicators.CanvasShapeIndicators, {}),
|
|
159
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ref: rHtmlLayer2, className: "tl-html-layer", children: [
|
|
160
|
+
debugGeometry ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GeometryDebuggingView.GeometryDebuggingView, {}) : null,
|
|
161
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BrushWrapper, {}),
|
|
162
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScribbleWrapper, {}),
|
|
163
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ZoomBrushWrapper, {}),
|
|
164
|
+
ShapeIndicators && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShapeIndicators, {}),
|
|
165
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(HintedShapeIndicator, {}),
|
|
166
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SnapIndicatorWrapper, {}),
|
|
167
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectionForegroundWrapper, {}),
|
|
168
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(HandlesWrapper, {}),
|
|
169
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(OverlaysWrapper, {}),
|
|
170
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_LiveCollaborators.LiveCollaborators, {})
|
|
171
|
+
] })
|
|
172
|
+
] }),
|
|
169
173
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MovingCameraHitTestBlocker, {})
|
|
170
174
|
]
|
|
171
175
|
}
|
|
@@ -358,7 +362,18 @@ function ShapesToDisplay() {
|
|
|
358
362
|
function HintedShapeIndicator() {
|
|
359
363
|
const editor = (0, import_useEditor.useEditor)();
|
|
360
364
|
const { ShapeIndicator } = (0, import_useEditorComponents.useEditorComponents)();
|
|
361
|
-
const ids = (0, import_state_react.useValue)(
|
|
365
|
+
const ids = (0, import_state_react.useValue)(
|
|
366
|
+
"hinting shape ids without canvas indicator",
|
|
367
|
+
() => {
|
|
368
|
+
return (0, import_utils.dedupe)(editor.getHintingShapeIds()).filter((id) => {
|
|
369
|
+
const shape = editor.getShape(id);
|
|
370
|
+
if (!shape) return false;
|
|
371
|
+
const util = editor.getShapeUtil(shape);
|
|
372
|
+
return util.useLegacyIndicator();
|
|
373
|
+
});
|
|
374
|
+
},
|
|
375
|
+
[editor]
|
|
376
|
+
);
|
|
362
377
|
if (!ids.length) return null;
|
|
363
378
|
if (!ShapeIndicator) return null;
|
|
364
379
|
return ids.map((id) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShapeIndicator, { className: "tl-user-indicator__hint", shapeId: id }, id + "_hinting"));
|