@tldraw/editor 4.5.0-next.dc46682213a8 → 4.5.0
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 +26 -1
- package/dist-cjs/index.js +2 -1
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +123 -169
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/managers/HistoryManager/HistoryManager.js +15 -16
- package/dist-cjs/lib/editor/managers/HistoryManager/HistoryManager.js.map +3 -3
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +1 -1
- package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js +2 -3
- package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js.map +2 -2
- package/dist-cjs/lib/hooks/useCanvasEvents.js +3 -3
- package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js +1 -2
- package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js.map +2 -2
- package/dist-cjs/lib/utils/dom.js +8 -4
- package/dist-cjs/lib/utils/dom.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 +26 -1
- package/dist-esm/index.mjs +3 -1
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +123 -169
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/HistoryManager/HistoryManager.mjs +15 -16
- package/dist-esm/lib/editor/managers/HistoryManager/HistoryManager.mjs.map +3 -3
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +1 -1
- package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs +2 -3
- package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs.map +2 -2
- package/dist-esm/lib/hooks/useCanvasEvents.mjs +9 -4
- package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs +2 -3
- package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs.map +2 -2
- package/dist-esm/lib/utils/dom.mjs +8 -4
- package/dist-esm/lib/utils/dom.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +1 -0
- package/src/lib/editor/Editor.ts +169 -269
- package/src/lib/editor/managers/HistoryManager/HistoryManager.ts +6 -5
- package/src/lib/editor/shapes/ShapeUtil.ts +1 -1
- package/src/lib/editor/tools/BaseBoxShapeTool/children/Pointing.ts +3 -3
- package/src/lib/hooks/useCanvasEvents.ts +9 -5
- package/src/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.ts +2 -5
- package/src/lib/utils/dom.ts +16 -8
- package/src/version.ts +3 -3
package/dist-cjs/index.d.ts
CHANGED
|
@@ -1903,6 +1903,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1903
1903
|
* @public
|
|
1904
1904
|
*/
|
|
1905
1905
|
getZoomLevel(): number;
|
|
1906
|
+
/**
|
|
1907
|
+
* Get the scale factor used when creating or resizing shapes in dynamic size mode.
|
|
1908
|
+
*
|
|
1909
|
+
* @public
|
|
1910
|
+
*/
|
|
1911
|
+
getResizeScaleFactor(): number;
|
|
1906
1912
|
private _debouncedZoomLevel;
|
|
1907
1913
|
/**
|
|
1908
1914
|
* Get the debounced zoom level. When the camera is moving, this returns the zoom level
|
|
@@ -3236,6 +3242,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3236
3242
|
* @public
|
|
3237
3243
|
*/
|
|
3238
3244
|
bringToFront(shapes: TLShape[] | TLShapeId[]): this;
|
|
3245
|
+
/* Excluded from this release type: getShapeClusters */
|
|
3239
3246
|
/* Excluded from this release type: collectShapesViaArrowBindings */
|
|
3240
3247
|
/**
|
|
3241
3248
|
* Flip shape positions.
|
|
@@ -3327,6 +3334,22 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3327
3334
|
* @public
|
|
3328
3335
|
*/
|
|
3329
3336
|
stretchShapes(shapes: TLShape[] | TLShapeId[], operation: 'horizontal' | 'vertical'): this;
|
|
3337
|
+
/**
|
|
3338
|
+
* Resize and reposition a set of shapes so that their combined page bounds matches the given
|
|
3339
|
+
* target bounds.
|
|
3340
|
+
*
|
|
3341
|
+
* @example
|
|
3342
|
+
* ```ts
|
|
3343
|
+
* editor.resizeToBounds([box1, box2], { x: 0, y: 0, w: 500, h: 500 })
|
|
3344
|
+
* editor.resizeToBounds(editor.getSelectedShapeIds(), new Box(0, 0, 500, 500))
|
|
3345
|
+
* ```
|
|
3346
|
+
*
|
|
3347
|
+
* @param shapes - The shapes (or shape ids) to resize.
|
|
3348
|
+
* @param bounds - The target bounding box.
|
|
3349
|
+
*
|
|
3350
|
+
* @public
|
|
3351
|
+
*/
|
|
3352
|
+
resizeToBounds(shapes: TLShape[] | TLShapeId[], bounds: BoxLike): this;
|
|
3330
3353
|
/**
|
|
3331
3354
|
* Resize a shape.
|
|
3332
3355
|
*
|
|
@@ -4140,6 +4163,8 @@ export declare interface EditorProviderProps {
|
|
|
4140
4163
|
children: React_3.ReactNode;
|
|
4141
4164
|
}
|
|
4142
4165
|
|
|
4166
|
+
/* Excluded from this release type: elementShouldCaptureKeys */
|
|
4167
|
+
|
|
4143
4168
|
/** @public */
|
|
4144
4169
|
export declare class Ellipse2d extends Geometry2d {
|
|
4145
4170
|
config: Omit<Geometry2dOptions, 'isClosed'> & {
|
|
@@ -8083,7 +8108,7 @@ export declare interface TLShapeIndicatorsProps {
|
|
|
8083
8108
|
*/
|
|
8084
8109
|
export declare interface TLShapeUtilCanBeLaidOutOpts {
|
|
8085
8110
|
/** The type of action causing the layout. */
|
|
8086
|
-
type?: 'align' | 'distribute' | 'flip' | 'pack' | 'stack' | 'stretch';
|
|
8111
|
+
type?: 'align' | 'distribute' | 'flip' | 'pack' | 'resize_to_bounds' | 'stack' | 'stretch';
|
|
8087
8112
|
/** The other shapes being laid out */
|
|
8088
8113
|
shapes?: TLShape[];
|
|
8089
8114
|
}
|
package/dist-cjs/index.js
CHANGED
|
@@ -130,6 +130,7 @@ __export(index_exports, {
|
|
|
130
130
|
defaultTldrawOptions: () => import_options.defaultTldrawOptions,
|
|
131
131
|
defaultUserPreferences: () => import_TLUserPreferences.defaultUserPreferences,
|
|
132
132
|
degreesToRadians: () => import_utils2.degreesToRadians,
|
|
133
|
+
elementShouldCaptureKeys: () => import_dom.elementShouldCaptureKeys,
|
|
133
134
|
extractSessionStateFromLegacySnapshot: () => import_TLSessionStateSnapshot.extractSessionStateFromLegacySnapshot,
|
|
134
135
|
featureFlags: () => import_debug_flags.featureFlags,
|
|
135
136
|
getArcMeasure: () => import_utils2.getArcMeasure,
|
|
@@ -369,7 +370,7 @@ var import_LocalIndexedDb = require("./lib/utils/sync/LocalIndexedDb");
|
|
|
369
370
|
var import_uniq = require("./lib/utils/uniq");
|
|
370
371
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
371
372
|
"@tldraw/editor",
|
|
372
|
-
"4.5.0
|
|
373
|
+
"4.5.0",
|
|
373
374
|
"cjs"
|
|
374
375
|
);
|
|
375
376
|
//# 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'\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 { isAccelKey } from './lib/utils/keyboard'\nexport { normalizeWheel } from './lib/utils/normalizeWheel'\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 {\n\thardResetEditor,\n\topenWindow,\n\trefreshPage,\n\truntime,\n\tsetRuntimeOverrides,\n} 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'\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": "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
|
|
4
|
+
"sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\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\telementShouldCaptureKeys,\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 { isAccelKey } from './lib/utils/keyboard'\nexport { normalizeWheel } from './lib/utils/normalizeWheel'\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 {\n\thardResetEditor,\n\topenWindow,\n\trefreshPage,\n\truntime,\n\tsetRuntimeOverrides,\n} 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'\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;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;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;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;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA6C;AAG7C,0BAAc,0BAHd;AAKA,0BAAc,gCALd;AAOA,0BAAc,0BAPd;AASA,0BAAc,6BATd;AAWA,0BAAc,0BAXd;AAaA,0BAAc,6BAbd;AAeA,+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,6BAIO;AACP,yBAIO;AACP,yBAAqD;AACrD,yBAMO;AACP,iCAAoC;AACpC,yBAIO;AACP,yBAA4B;AAC5B,oCAAuC;AACvC,8BAAsD;AACtD,4BAA+B;AAC/B,uBAiBO;AACP,iCAGO;AACP,uBAAiD;AACjD,0BAA6B;AAC7B,8BAAiC;AACjC,sBAAgC;AAChC,uBAAuD;AAGvD,yBAiCO;AA4CP,8BAKO;AACP,2BAA8B;AAC9B,yBAAqC;AACrC,mBAAwB;AACxB,kBAAuB;AACvB,0BAKO;AACP,uBAA0B;AAC1B,uBAMO;AACP,iCAAoC;AAEpC,sBAA2C;AAC3C,iCAAoC;AACpC,yBAAkE;AAClE,2BAA8B;AAC9B,2BAA8B;AAC9B,0BAA6B;AAC7B,2BAA8B;AAC9B,2CAA8C;AAC9C,uCAA0C;AAC1C,wBAA2B;AAC3B,yBAA4B;AAC5B,yBAA4B;AAC5B,uBAMO;AACP,gCAAmC;AACnC,wBAAiD;AACjD,0BAA6B;AAC7B,+BAAkC;AAClC,4BAQO;AACP,6BAAgC;AAChC,qBAAyD;AACzD,iBASO;AACP,qBAAwB;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,IAAAA,gBAgCO;AACP,iBAAkC;AAClC,0BAYO;AACP,oBAAoD;AACpD,kCAAgE;AAChE,yBAOO;AACP,uBAKO;AACP,iBAQO;AACP,wBAA2B;AAC3B,gCAAmC;AACnC,4BAA+B;AAC/B,kCAAqC;AACrC,sBAA2B;AAC3B,4BAA+B;AAC/B,yBAAoE;AACpE,sBAOO;AACP,sBAIO;AACP,qBAMO;AACP,6BAIO;AACP,uBAA0B;AAC1B,4BAAsD;AAEtD,kBAAqB;AAAA,IAErB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
6
|
"names": ["import_utils"]
|
|
7
7
|
}
|
|
@@ -124,8 +124,8 @@ var import_TextManager = require("./managers/TextManager/TextManager");
|
|
|
124
124
|
var import_TickManager = require("./managers/TickManager/TickManager");
|
|
125
125
|
var import_UserPreferencesManager = require("./managers/UserPreferencesManager/UserPreferencesManager");
|
|
126
126
|
var import_RootState = require("./tools/RootState");
|
|
127
|
-
var __setMetaKeyTimeout_dec, __setCtrlKeyTimeout_dec, __setAltKeyTimeout_dec, __setShiftKeyTimeout_dec, _getIsReadonly_dec, _getIsFocused_dec, _getSharedOpacity_dec, _getSharedStyles_dec, __getSelectionSharedStyles_dec, __getBindingsIndexCache_dec, _getCurrentPageRenderingShapesSorted_dec, _getCurrentPageShapesSorted_dec, _getCurrentPageShapes_dec, _getCurrentPageBounds_dec, _getCulledShapes_dec, _getNotVisibleShapes_dec, __getShapeMaskedPageBoundsCache_dec, __getShapeMaskCache_dec, __getShapeClipPathCache_dec, __getShapePageBoundsCache_dec, __getShapePageTransformCache_dec, __getShapeHandlesCache_dec, __getAllAssetsQuery_dec, _getCurrentPageShapeIdsSorted_dec, _getCurrentPageId_dec, _getPages_dec, __getAllPagesQuery_dec, _getRenderingShapes_dec, _getCollaboratorsOnCurrentPage_dec, _getCollaborators_dec, __getCollaboratorsQuery_dec, _getViewportPageBounds_dec, _getViewportScreenCenter_dec, _getViewportScreenBounds_dec, _getEfficientZoomLevel_dec, __getAboveDebouncedZoomThreshold_dec, _getDebouncedZoomLevel_dec, _getZoomLevel_dec, _getCameraForFollowing_dec, _getViewportPageBoundsForFollowing_dec, _getCamera_dec, __unsafe_getCameraId_dec, _getErasingShapes_dec, _getErasingShapeIds_dec, _getHintingShape_dec, _getHintingShapeIds_dec, _getHoveredShape_dec, _getHoveredShapeId_dec, _getRichTextEditor_dec, _getEditingShape_dec, _getEditingShapeId_dec, _getFocusedGroup_dec, _getFocusedGroupId_dec, _getSelectionRotatedScreenBounds_dec, _getSelectionRotatedPageBounds_dec, _getSelectionRotation_dec, _getSelectionPageBounds_dec, _getOnlySelectedShape_dec, _getOnlySelectedShapeId_dec, _getCurrentPageShapesInReadingOrder_dec, _getSelectedShapes_dec, _getSelectedShapeIds_dec, __getCurrentPageStateId_dec, _getCurrentPageState_dec, __getPageStatesQuery_dec, _getPageStates_dec, _getInstanceState_dec, _getDocumentSettings_dec, _getCurrentToolId_dec, _getCurrentTool_dec, _getPath_dec, _canRedo_dec, _canUndo_dec, _getIsShapeHiddenCache_dec, _a, _init;
|
|
128
|
-
class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_dec = [import_state.computed], _canUndo_dec = [import_state.computed], _canRedo_dec = [import_state.computed], _getPath_dec = [import_state.computed], _getCurrentTool_dec = [import_state.computed], _getCurrentToolId_dec = [import_state.computed], _getDocumentSettings_dec = [import_state.computed], _getInstanceState_dec = [import_state.computed], _getPageStates_dec = [import_state.computed], __getPageStatesQuery_dec = [import_state.computed], _getCurrentPageState_dec = [import_state.computed], __getCurrentPageStateId_dec = [import_state.computed], _getSelectedShapeIds_dec = [import_state.computed], _getSelectedShapes_dec = [import_state.computed], _getCurrentPageShapesInReadingOrder_dec = [import_state.computed], _getOnlySelectedShapeId_dec = [import_state.computed], _getOnlySelectedShape_dec = [import_state.computed], _getSelectionPageBounds_dec = [import_state.computed], _getSelectionRotation_dec = [import_state.computed], _getSelectionRotatedPageBounds_dec = [import_state.computed], _getSelectionRotatedScreenBounds_dec = [import_state.computed], _getFocusedGroupId_dec = [import_state.computed], _getFocusedGroup_dec = [import_state.computed], _getEditingShapeId_dec = [import_state.computed], _getEditingShape_dec = [import_state.computed], _getRichTextEditor_dec = [import_state.computed], _getHoveredShapeId_dec = [import_state.computed], _getHoveredShape_dec = [import_state.computed], _getHintingShapeIds_dec = [import_state.computed], _getHintingShape_dec = [import_state.computed], _getErasingShapeIds_dec = [import_state.computed], _getErasingShapes_dec = [import_state.computed], __unsafe_getCameraId_dec = [import_state.computed], _getCamera_dec = [import_state.computed], _getViewportPageBoundsForFollowing_dec = [import_state.computed], _getCameraForFollowing_dec = [import_state.computed], _getZoomLevel_dec = [import_state.computed], _getDebouncedZoomLevel_dec = [import_state.computed], __getAboveDebouncedZoomThreshold_dec = [import_state.computed], _getEfficientZoomLevel_dec = [import_state.computed], _getViewportScreenBounds_dec = [import_state.computed], _getViewportScreenCenter_dec = [import_state.computed], _getViewportPageBounds_dec = [import_state.computed], __getCollaboratorsQuery_dec = [import_state.computed], _getCollaborators_dec = [import_state.computed], _getCollaboratorsOnCurrentPage_dec = [import_state.computed], _getRenderingShapes_dec = [import_state.computed], __getAllPagesQuery_dec = [import_state.computed], _getPages_dec = [import_state.computed], _getCurrentPageId_dec = [import_state.computed], _getCurrentPageShapeIdsSorted_dec = [import_state.computed], __getAllAssetsQuery_dec = [import_state.computed], __getShapeHandlesCache_dec = [import_state.computed], __getShapePageTransformCache_dec = [import_state.computed], __getShapePageBoundsCache_dec = [import_state.computed], __getShapeClipPathCache_dec = [import_state.computed], __getShapeMaskCache_dec = [import_state.computed], __getShapeMaskedPageBoundsCache_dec = [import_state.computed], _getNotVisibleShapes_dec = [import_state.computed], _getCulledShapes_dec = [import_state.computed], _getCurrentPageBounds_dec = [import_state.computed], _getCurrentPageShapes_dec = [import_state.computed], _getCurrentPageShapesSorted_dec = [import_state.computed], _getCurrentPageRenderingShapesSorted_dec = [import_state.computed], __getBindingsIndexCache_dec = [import_state.computed], __getSelectionSharedStyles_dec = [import_state.computed], _getSharedStyles_dec = [(0, import_state.computed)({ isEqual: (a, b) => a.equals(b) })], _getSharedOpacity_dec = [import_state.computed], _getIsFocused_dec = [import_state.computed], _getIsReadonly_dec = [import_state.computed], __setShiftKeyTimeout_dec = [import_utils.bind], __setAltKeyTimeout_dec = [import_utils.bind], __setCtrlKeyTimeout_dec = [import_utils.bind], __setMetaKeyTimeout_dec = [import_utils.bind], _a) {
|
|
127
|
+
var __setMetaKeyTimeout_dec, __setCtrlKeyTimeout_dec, __setAltKeyTimeout_dec, __setShiftKeyTimeout_dec, _getIsReadonly_dec, _getIsFocused_dec, _getSharedOpacity_dec, _getSharedStyles_dec, __getSelectionSharedStyles_dec, __getBindingsIndexCache_dec, _getCurrentPageRenderingShapesSorted_dec, _getCurrentPageShapesSorted_dec, _getCurrentPageShapes_dec, _getCurrentPageBounds_dec, _getCulledShapes_dec, _getNotVisibleShapes_dec, __getShapeMaskedPageBoundsCache_dec, __getShapeMaskCache_dec, __getShapeClipPathCache_dec, __getShapePageBoundsCache_dec, __getShapePageTransformCache_dec, __getShapeHandlesCache_dec, __getAllAssetsQuery_dec, _getCurrentPageShapeIdsSorted_dec, _getCurrentPageId_dec, _getPages_dec, __getAllPagesQuery_dec, _getRenderingShapes_dec, _getCollaboratorsOnCurrentPage_dec, _getCollaborators_dec, __getCollaboratorsQuery_dec, _getViewportPageBounds_dec, _getViewportScreenCenter_dec, _getViewportScreenBounds_dec, _getEfficientZoomLevel_dec, __getAboveDebouncedZoomThreshold_dec, _getDebouncedZoomLevel_dec, _getResizeScaleFactor_dec, _getZoomLevel_dec, _getCameraForFollowing_dec, _getViewportPageBoundsForFollowing_dec, _getCamera_dec, __unsafe_getCameraId_dec, _getErasingShapes_dec, _getErasingShapeIds_dec, _getHintingShape_dec, _getHintingShapeIds_dec, _getHoveredShape_dec, _getHoveredShapeId_dec, _getRichTextEditor_dec, _getEditingShape_dec, _getEditingShapeId_dec, _getFocusedGroup_dec, _getFocusedGroupId_dec, _getSelectionRotatedScreenBounds_dec, _getSelectionRotatedPageBounds_dec, _getSelectionRotation_dec, _getSelectionPageBounds_dec, _getOnlySelectedShape_dec, _getOnlySelectedShapeId_dec, _getCurrentPageShapesInReadingOrder_dec, _getSelectedShapes_dec, _getSelectedShapeIds_dec, __getCurrentPageStateId_dec, _getCurrentPageState_dec, __getPageStatesQuery_dec, _getPageStates_dec, _getInstanceState_dec, _getDocumentSettings_dec, _getCurrentToolId_dec, _getCurrentTool_dec, _getPath_dec, _canRedo_dec, _canUndo_dec, _getIsShapeHiddenCache_dec, _a, _init;
|
|
128
|
+
class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_dec = [import_state.computed], _canUndo_dec = [import_state.computed], _canRedo_dec = [import_state.computed], _getPath_dec = [import_state.computed], _getCurrentTool_dec = [import_state.computed], _getCurrentToolId_dec = [import_state.computed], _getDocumentSettings_dec = [import_state.computed], _getInstanceState_dec = [import_state.computed], _getPageStates_dec = [import_state.computed], __getPageStatesQuery_dec = [import_state.computed], _getCurrentPageState_dec = [import_state.computed], __getCurrentPageStateId_dec = [import_state.computed], _getSelectedShapeIds_dec = [import_state.computed], _getSelectedShapes_dec = [import_state.computed], _getCurrentPageShapesInReadingOrder_dec = [import_state.computed], _getOnlySelectedShapeId_dec = [import_state.computed], _getOnlySelectedShape_dec = [import_state.computed], _getSelectionPageBounds_dec = [import_state.computed], _getSelectionRotation_dec = [import_state.computed], _getSelectionRotatedPageBounds_dec = [import_state.computed], _getSelectionRotatedScreenBounds_dec = [import_state.computed], _getFocusedGroupId_dec = [import_state.computed], _getFocusedGroup_dec = [import_state.computed], _getEditingShapeId_dec = [import_state.computed], _getEditingShape_dec = [import_state.computed], _getRichTextEditor_dec = [import_state.computed], _getHoveredShapeId_dec = [import_state.computed], _getHoveredShape_dec = [import_state.computed], _getHintingShapeIds_dec = [import_state.computed], _getHintingShape_dec = [import_state.computed], _getErasingShapeIds_dec = [import_state.computed], _getErasingShapes_dec = [import_state.computed], __unsafe_getCameraId_dec = [import_state.computed], _getCamera_dec = [import_state.computed], _getViewportPageBoundsForFollowing_dec = [import_state.computed], _getCameraForFollowing_dec = [import_state.computed], _getZoomLevel_dec = [import_state.computed], _getResizeScaleFactor_dec = [import_state.computed], _getDebouncedZoomLevel_dec = [import_state.computed], __getAboveDebouncedZoomThreshold_dec = [import_state.computed], _getEfficientZoomLevel_dec = [import_state.computed], _getViewportScreenBounds_dec = [import_state.computed], _getViewportScreenCenter_dec = [import_state.computed], _getViewportPageBounds_dec = [import_state.computed], __getCollaboratorsQuery_dec = [import_state.computed], _getCollaborators_dec = [import_state.computed], _getCollaboratorsOnCurrentPage_dec = [import_state.computed], _getRenderingShapes_dec = [import_state.computed], __getAllPagesQuery_dec = [import_state.computed], _getPages_dec = [import_state.computed], _getCurrentPageId_dec = [import_state.computed], _getCurrentPageShapeIdsSorted_dec = [import_state.computed], __getAllAssetsQuery_dec = [import_state.computed], __getShapeHandlesCache_dec = [import_state.computed], __getShapePageTransformCache_dec = [import_state.computed], __getShapePageBoundsCache_dec = [import_state.computed], __getShapeClipPathCache_dec = [import_state.computed], __getShapeMaskCache_dec = [import_state.computed], __getShapeMaskedPageBoundsCache_dec = [import_state.computed], _getNotVisibleShapes_dec = [import_state.computed], _getCulledShapes_dec = [import_state.computed], _getCurrentPageBounds_dec = [import_state.computed], _getCurrentPageShapes_dec = [import_state.computed], _getCurrentPageShapesSorted_dec = [import_state.computed], _getCurrentPageRenderingShapesSorted_dec = [import_state.computed], __getBindingsIndexCache_dec = [import_state.computed], __getSelectionSharedStyles_dec = [import_state.computed], _getSharedStyles_dec = [(0, import_state.computed)({ isEqual: (a, b) => a.equals(b) })], _getSharedOpacity_dec = [import_state.computed], _getIsFocused_dec = [import_state.computed], _getIsReadonly_dec = [import_state.computed], __setShiftKeyTimeout_dec = [import_utils.bind], __setAltKeyTimeout_dec = [import_utils.bind], __setCtrlKeyTimeout_dec = [import_utils.bind], __setMetaKeyTimeout_dec = [import_utils.bind], _a) {
|
|
129
129
|
constructor({
|
|
130
130
|
store,
|
|
131
131
|
user,
|
|
@@ -2048,6 +2048,9 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
2048
2048
|
getZoomLevel() {
|
|
2049
2049
|
return this.getCamera().z;
|
|
2050
2050
|
}
|
|
2051
|
+
getResizeScaleFactor() {
|
|
2052
|
+
return this.user.getIsDynamicResizeMode() ? 1 / this.getZoomLevel() : 1;
|
|
2053
|
+
}
|
|
2051
2054
|
getDebouncedZoomLevel() {
|
|
2052
2055
|
if (this.options.debouncedZoom) {
|
|
2053
2056
|
if (this.getCameraState() === "idle") {
|
|
@@ -4988,6 +4991,53 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
4988
4991
|
if (changes) this.updateShapes(changes);
|
|
4989
4992
|
return this;
|
|
4990
4993
|
}
|
|
4994
|
+
/**
|
|
4995
|
+
* Shared clustering logic for layout methods. Resolves shapes, optionally filters to
|
|
4996
|
+
* axis-aligned shapes, checks canBeLaidOut, and groups shapes into clusters via arrow bindings.
|
|
4997
|
+
*
|
|
4998
|
+
* @internal
|
|
4999
|
+
*/
|
|
5000
|
+
getShapeClusters(shapes, type, opts) {
|
|
5001
|
+
const ids = typeof shapes[0] === "string" ? shapes : shapes.map((s) => s.id);
|
|
5002
|
+
let freshShapes = (0, import_utils.compact)(ids.map((id) => this.getShape(id)));
|
|
5003
|
+
if (opts?.filterAxisAligned) {
|
|
5004
|
+
freshShapes = freshShapes.filter(
|
|
5005
|
+
(s) => this.getShapePageTransform(s)?.rotation() % (import_utils2.PI / 2) === 0
|
|
5006
|
+
);
|
|
5007
|
+
}
|
|
5008
|
+
const clusters = [];
|
|
5009
|
+
const allBounds = [];
|
|
5010
|
+
const visited = /* @__PURE__ */ new Set();
|
|
5011
|
+
for (const shape of freshShapes) {
|
|
5012
|
+
if (visited.has(shape.id)) continue;
|
|
5013
|
+
visited.add(shape.id);
|
|
5014
|
+
const shapePageBounds = this.getShapePageBounds(shape);
|
|
5015
|
+
if (!shapePageBounds) continue;
|
|
5016
|
+
if (!this.getShapeUtil(shape).canBeLaidOut?.(shape, {
|
|
5017
|
+
type,
|
|
5018
|
+
shapes: freshShapes
|
|
5019
|
+
})) {
|
|
5020
|
+
continue;
|
|
5021
|
+
}
|
|
5022
|
+
const shapesMovingTogether = [shape];
|
|
5023
|
+
const boundsOfShapesMovingTogether = [shapePageBounds];
|
|
5024
|
+
this.collectShapesViaArrowBindings({
|
|
5025
|
+
bindings: this.getBindingsToShape(shape.id, "arrow"),
|
|
5026
|
+
initialShapes: freshShapes,
|
|
5027
|
+
resultShapes: shapesMovingTogether,
|
|
5028
|
+
resultBounds: boundsOfShapesMovingTogether,
|
|
5029
|
+
visited
|
|
5030
|
+
});
|
|
5031
|
+
const commonPageBounds = import_Box.Box.Common(boundsOfShapesMovingTogether);
|
|
5032
|
+
if (!commonPageBounds) continue;
|
|
5033
|
+
clusters.push({
|
|
5034
|
+
shapes: shapesMovingTogether,
|
|
5035
|
+
pageBounds: commonPageBounds
|
|
5036
|
+
});
|
|
5037
|
+
allBounds.push(commonPageBounds);
|
|
5038
|
+
}
|
|
5039
|
+
return { clusters, allBounds };
|
|
5040
|
+
}
|
|
4991
5041
|
/**
|
|
4992
5042
|
* @internal
|
|
4993
5043
|
*/
|
|
@@ -5098,40 +5148,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
5098
5148
|
*/
|
|
5099
5149
|
stackShapes(shapes, operation, gap) {
|
|
5100
5150
|
const _gap = gap ?? this.options.adjacentShapeMargin;
|
|
5101
|
-
const ids = typeof shapes[0] === "string" ? shapes : shapes.map((s) => s.id);
|
|
5102
5151
|
if (this.getIsReadonly()) return this;
|
|
5103
|
-
const
|
|
5104
|
-
const shapeClustersToStack = [];
|
|
5105
|
-
const allBounds = [];
|
|
5106
|
-
const visited = /* @__PURE__ */ new Set();
|
|
5107
|
-
for (const shape of shapesToStackFirstPass) {
|
|
5108
|
-
if (visited.has(shape.id)) continue;
|
|
5109
|
-
visited.add(shape.id);
|
|
5110
|
-
const shapePageBounds = this.getShapePageBounds(shape);
|
|
5111
|
-
if (!shapePageBounds) continue;
|
|
5112
|
-
if (!this.getShapeUtil(shape).canBeLaidOut?.(shape, {
|
|
5113
|
-
type: "stack",
|
|
5114
|
-
shapes: shapesToStackFirstPass
|
|
5115
|
-
})) {
|
|
5116
|
-
continue;
|
|
5117
|
-
}
|
|
5118
|
-
const shapesMovingTogether = [shape];
|
|
5119
|
-
const boundsOfShapesMovingTogether = [shapePageBounds];
|
|
5120
|
-
this.collectShapesViaArrowBindings({
|
|
5121
|
-
bindings: this.getBindingsToShape(shape.id, "arrow"),
|
|
5122
|
-
initialShapes: shapesToStackFirstPass,
|
|
5123
|
-
resultShapes: shapesMovingTogether,
|
|
5124
|
-
resultBounds: boundsOfShapesMovingTogether,
|
|
5125
|
-
visited
|
|
5126
|
-
});
|
|
5127
|
-
const commonPageBounds = import_Box.Box.Common(boundsOfShapesMovingTogether);
|
|
5128
|
-
if (!commonPageBounds) continue;
|
|
5129
|
-
shapeClustersToStack.push({
|
|
5130
|
-
shapes: shapesMovingTogether,
|
|
5131
|
-
pageBounds: commonPageBounds
|
|
5132
|
-
});
|
|
5133
|
-
allBounds.push(commonPageBounds);
|
|
5134
|
-
}
|
|
5152
|
+
const { clusters: shapeClustersToStack } = this.getShapeClusters(shapes, "stack");
|
|
5135
5153
|
const len = shapeClustersToStack.length;
|
|
5136
5154
|
if (_gap === 0 && len < 3 || len < 2) return this;
|
|
5137
5155
|
let val;
|
|
@@ -5217,40 +5235,11 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
5217
5235
|
packShapes(shapes, _gap) {
|
|
5218
5236
|
if (this.getIsReadonly()) return this;
|
|
5219
5237
|
const gap = _gap ?? this.options.adjacentShapeMargin;
|
|
5220
|
-
const
|
|
5221
|
-
const
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
for (const shape of shapesToPackFirstPass) {
|
|
5226
|
-
if (visited.has(shape.id)) continue;
|
|
5227
|
-
visited.add(shape.id);
|
|
5228
|
-
const shapePageBounds = this.getShapePageBounds(shape);
|
|
5229
|
-
if (!shapePageBounds) continue;
|
|
5230
|
-
if (!this.getShapeUtil(shape).canBeLaidOut?.(shape, {
|
|
5231
|
-
type: "pack",
|
|
5232
|
-
shapes: shapesToPackFirstPass
|
|
5233
|
-
})) {
|
|
5234
|
-
continue;
|
|
5235
|
-
}
|
|
5236
|
-
const shapesMovingTogether = [shape];
|
|
5237
|
-
const boundsOfShapesMovingTogether = [shapePageBounds];
|
|
5238
|
-
this.collectShapesViaArrowBindings({
|
|
5239
|
-
bindings: this.getBindingsToShape(shape.id, "arrow"),
|
|
5240
|
-
initialShapes: shapesToPackFirstPass,
|
|
5241
|
-
resultShapes: shapesMovingTogether,
|
|
5242
|
-
resultBounds: boundsOfShapesMovingTogether,
|
|
5243
|
-
visited
|
|
5244
|
-
});
|
|
5245
|
-
const commonPageBounds = import_Box.Box.Common(boundsOfShapesMovingTogether);
|
|
5246
|
-
if (!commonPageBounds) continue;
|
|
5247
|
-
shapeClustersToPack.push({
|
|
5248
|
-
shapes: shapesMovingTogether,
|
|
5249
|
-
pageBounds: commonPageBounds,
|
|
5250
|
-
nextPageBounds: commonPageBounds.clone()
|
|
5251
|
-
});
|
|
5252
|
-
allBounds.push(commonPageBounds);
|
|
5253
|
-
}
|
|
5238
|
+
const { clusters, allBounds } = this.getShapeClusters(shapes, "pack");
|
|
5239
|
+
const shapeClustersToPack = clusters.map((cluster) => ({
|
|
5240
|
+
...cluster,
|
|
5241
|
+
nextPageBounds: cluster.pageBounds.clone()
|
|
5242
|
+
}));
|
|
5254
5243
|
if (shapeClustersToPack.length < 2) return this;
|
|
5255
5244
|
let area = 0;
|
|
5256
5245
|
for (const { pageBounds } of shapeClustersToPack) {
|
|
@@ -5334,39 +5323,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
5334
5323
|
*/
|
|
5335
5324
|
alignShapes(shapes, operation) {
|
|
5336
5325
|
if (this.getIsReadonly()) return this;
|
|
5337
|
-
const
|
|
5338
|
-
const shapesToAlignFirstPass = (0, import_utils.compact)(ids.map((id) => this.getShape(id)));
|
|
5339
|
-
const shapeClustersToAlign = [];
|
|
5340
|
-
const allBounds = [];
|
|
5341
|
-
const visited = /* @__PURE__ */ new Set();
|
|
5342
|
-
for (const shape of shapesToAlignFirstPass) {
|
|
5343
|
-
if (visited.has(shape.id)) continue;
|
|
5344
|
-
visited.add(shape.id);
|
|
5345
|
-
const shapePageBounds = this.getShapePageBounds(shape);
|
|
5346
|
-
if (!shapePageBounds) continue;
|
|
5347
|
-
if (!this.getShapeUtil(shape).canBeLaidOut?.(shape, {
|
|
5348
|
-
type: "align",
|
|
5349
|
-
shapes: shapesToAlignFirstPass
|
|
5350
|
-
})) {
|
|
5351
|
-
continue;
|
|
5352
|
-
}
|
|
5353
|
-
const shapesMovingTogether = [shape];
|
|
5354
|
-
const boundsOfShapesMovingTogether = [shapePageBounds];
|
|
5355
|
-
this.collectShapesViaArrowBindings({
|
|
5356
|
-
bindings: this.getBindingsToShape(shape.id, "arrow"),
|
|
5357
|
-
initialShapes: shapesToAlignFirstPass,
|
|
5358
|
-
resultShapes: shapesMovingTogether,
|
|
5359
|
-
resultBounds: boundsOfShapesMovingTogether,
|
|
5360
|
-
visited
|
|
5361
|
-
});
|
|
5362
|
-
const commonPageBounds = import_Box.Box.Common(boundsOfShapesMovingTogether);
|
|
5363
|
-
if (!commonPageBounds) continue;
|
|
5364
|
-
shapeClustersToAlign.push({
|
|
5365
|
-
shapes: shapesMovingTogether,
|
|
5366
|
-
pageBounds: commonPageBounds
|
|
5367
|
-
});
|
|
5368
|
-
allBounds.push(commonPageBounds);
|
|
5369
|
-
}
|
|
5326
|
+
const { clusters: shapeClustersToAlign, allBounds } = this.getShapeClusters(shapes, "align");
|
|
5370
5327
|
if (shapeClustersToAlign.length < 2) return this;
|
|
5371
5328
|
const commonBounds = import_Box.Box.Common(allBounds);
|
|
5372
5329
|
const changes = [];
|
|
@@ -5428,39 +5385,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
5428
5385
|
*/
|
|
5429
5386
|
distributeShapes(shapes, operation) {
|
|
5430
5387
|
if (this.getIsReadonly()) return this;
|
|
5431
|
-
const
|
|
5432
|
-
const shapesToDistributeFirstPass = (0, import_utils.compact)(ids.map((id) => this.getShape(id)));
|
|
5433
|
-
const shapeClustersToDistribute = [];
|
|
5434
|
-
const allBounds = [];
|
|
5435
|
-
const visited = /* @__PURE__ */ new Set();
|
|
5436
|
-
for (const shape of shapesToDistributeFirstPass) {
|
|
5437
|
-
if (visited.has(shape.id)) continue;
|
|
5438
|
-
visited.add(shape.id);
|
|
5439
|
-
const shapePageBounds = this.getShapePageBounds(shape);
|
|
5440
|
-
if (!shapePageBounds) continue;
|
|
5441
|
-
if (!this.getShapeUtil(shape).canBeLaidOut?.(shape, {
|
|
5442
|
-
type: "distribute",
|
|
5443
|
-
shapes: shapesToDistributeFirstPass
|
|
5444
|
-
})) {
|
|
5445
|
-
continue;
|
|
5446
|
-
}
|
|
5447
|
-
const shapesMovingTogether = [shape];
|
|
5448
|
-
const boundsOfShapesMovingTogether = [shapePageBounds];
|
|
5449
|
-
this.collectShapesViaArrowBindings({
|
|
5450
|
-
bindings: this.getBindingsToShape(shape.id, "arrow"),
|
|
5451
|
-
initialShapes: shapesToDistributeFirstPass,
|
|
5452
|
-
resultShapes: shapesMovingTogether,
|
|
5453
|
-
resultBounds: boundsOfShapesMovingTogether,
|
|
5454
|
-
visited
|
|
5455
|
-
});
|
|
5456
|
-
const commonPageBounds = import_Box.Box.Common(boundsOfShapesMovingTogether);
|
|
5457
|
-
if (!commonPageBounds) continue;
|
|
5458
|
-
shapeClustersToDistribute.push({
|
|
5459
|
-
shapes: shapesMovingTogether,
|
|
5460
|
-
pageBounds: commonPageBounds
|
|
5461
|
-
});
|
|
5462
|
-
allBounds.push(commonPageBounds);
|
|
5463
|
-
}
|
|
5388
|
+
const { clusters: shapeClustersToDistribute } = this.getShapeClusters(shapes, "distribute");
|
|
5464
5389
|
if (shapeClustersToDistribute.length < 3) return this;
|
|
5465
5390
|
let val;
|
|
5466
5391
|
let min;
|
|
@@ -5482,6 +5407,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
5482
5407
|
const last2 = shapeClustersToDistribute.sort((a, b) => b.pageBounds[max] - a.pageBounds[max])[0];
|
|
5483
5408
|
if (first === last2) {
|
|
5484
5409
|
const excludedShapeIds = new Set(first.shapes.map((s) => s.id));
|
|
5410
|
+
const ids = typeof shapes[0] === "string" ? shapes : shapes.map((s) => s.id);
|
|
5485
5411
|
return this.distributeShapes(
|
|
5486
5412
|
ids.filter((id) => !excludedShapeIds.has(id)),
|
|
5487
5413
|
operation
|
|
@@ -5534,41 +5460,12 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
5534
5460
|
* @public
|
|
5535
5461
|
*/
|
|
5536
5462
|
stretchShapes(shapes, operation) {
|
|
5537
|
-
const ids = typeof shapes[0] === "string" ? shapes : shapes.map((s) => s.id);
|
|
5538
5463
|
if (this.getIsReadonly()) return this;
|
|
5539
|
-
const
|
|
5540
|
-
|
|
5464
|
+
const { clusters: shapeClustersToStretch, allBounds } = this.getShapeClusters(
|
|
5465
|
+
shapes,
|
|
5466
|
+
"stretch",
|
|
5467
|
+
{ filterAxisAligned: true }
|
|
5541
5468
|
);
|
|
5542
|
-
const shapeClustersToStretch = [];
|
|
5543
|
-
const allBounds = [];
|
|
5544
|
-
const visited = /* @__PURE__ */ new Set();
|
|
5545
|
-
for (const shape of shapesToStretchFirstPass) {
|
|
5546
|
-
if (visited.has(shape.id)) continue;
|
|
5547
|
-
visited.add(shape.id);
|
|
5548
|
-
const shapePageBounds = this.getShapePageBounds(shape);
|
|
5549
|
-
if (!shapePageBounds) continue;
|
|
5550
|
-
const shapesMovingTogether = [shape];
|
|
5551
|
-
const boundsOfShapesMovingTogether = [shapePageBounds];
|
|
5552
|
-
if (!this.getShapeUtil(shape).canBeLaidOut?.(shape, {
|
|
5553
|
-
type: "stretch"
|
|
5554
|
-
})) {
|
|
5555
|
-
continue;
|
|
5556
|
-
}
|
|
5557
|
-
this.collectShapesViaArrowBindings({
|
|
5558
|
-
bindings: this.getBindingsToShape(shape.id, "arrow"),
|
|
5559
|
-
initialShapes: shapesToStretchFirstPass,
|
|
5560
|
-
resultShapes: shapesMovingTogether,
|
|
5561
|
-
resultBounds: boundsOfShapesMovingTogether,
|
|
5562
|
-
visited
|
|
5563
|
-
});
|
|
5564
|
-
const commonPageBounds = import_Box.Box.Common(boundsOfShapesMovingTogether);
|
|
5565
|
-
if (!commonPageBounds) continue;
|
|
5566
|
-
shapeClustersToStretch.push({
|
|
5567
|
-
shapes: shapesMovingTogether,
|
|
5568
|
-
pageBounds: commonPageBounds
|
|
5569
|
-
});
|
|
5570
|
-
allBounds.push(commonPageBounds);
|
|
5571
|
-
}
|
|
5572
5469
|
if (shapeClustersToStretch.length < 2) return this;
|
|
5573
5470
|
const commonBounds = import_Box.Box.Common(allBounds);
|
|
5574
5471
|
let val;
|
|
@@ -5594,7 +5491,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
5594
5491
|
for (const shape of shapes2) {
|
|
5595
5492
|
const shapeLocalOffset = localOffset.clone();
|
|
5596
5493
|
const parentTransform = this.getShapeParentTransform(shape);
|
|
5597
|
-
if (parentTransform)
|
|
5494
|
+
if (parentTransform) shapeLocalOffset.rot(-parentTransform.rotation());
|
|
5598
5495
|
shapeLocalOffset.add(shape);
|
|
5599
5496
|
const changes = this.getChangesToTranslateShape(shape, shapeLocalOffset);
|
|
5600
5497
|
this.updateShape(changes);
|
|
@@ -5609,6 +5506,62 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
5609
5506
|
});
|
|
5610
5507
|
return this;
|
|
5611
5508
|
}
|
|
5509
|
+
/**
|
|
5510
|
+
* Resize and reposition a set of shapes so that their combined page bounds matches the given
|
|
5511
|
+
* target bounds.
|
|
5512
|
+
*
|
|
5513
|
+
* @example
|
|
5514
|
+
* ```ts
|
|
5515
|
+
* editor.resizeToBounds([box1, box2], { x: 0, y: 0, w: 500, h: 500 })
|
|
5516
|
+
* editor.resizeToBounds(editor.getSelectedShapeIds(), new Box(0, 0, 500, 500))
|
|
5517
|
+
* ```
|
|
5518
|
+
*
|
|
5519
|
+
* @param shapes - The shapes (or shape ids) to resize.
|
|
5520
|
+
* @param bounds - The target bounding box.
|
|
5521
|
+
*
|
|
5522
|
+
* @public
|
|
5523
|
+
*/
|
|
5524
|
+
resizeToBounds(shapes, bounds) {
|
|
5525
|
+
if (this.getIsReadonly()) return this;
|
|
5526
|
+
const targetBounds = import_Box.Box.From(bounds);
|
|
5527
|
+
const { clusters: shapeClusters, allBounds } = this.getShapeClusters(
|
|
5528
|
+
shapes,
|
|
5529
|
+
"resize_to_bounds",
|
|
5530
|
+
{ filterAxisAligned: true }
|
|
5531
|
+
);
|
|
5532
|
+
if (shapeClusters.length === 0) return this;
|
|
5533
|
+
const commonBounds = import_Box.Box.Common(allBounds);
|
|
5534
|
+
if (!commonBounds) return this;
|
|
5535
|
+
if (commonBounds.width === 0 || commonBounds.height === 0) return this;
|
|
5536
|
+
const scaleX = targetBounds.width / commonBounds.width;
|
|
5537
|
+
const scaleY = targetBounds.height / commonBounds.height;
|
|
5538
|
+
const scale = new import_Vec.Vec(scaleX, scaleY);
|
|
5539
|
+
shapeClusters.forEach(({ shapes: shapes2, pageBounds }) => {
|
|
5540
|
+
const localOffset = new import_Vec.Vec(
|
|
5541
|
+
targetBounds.minX - commonBounds.minX + (pageBounds.minX - commonBounds.minX) * (scaleX - 1),
|
|
5542
|
+
targetBounds.minY - commonBounds.minY + (pageBounds.minY - commonBounds.minY) * (scaleY - 1)
|
|
5543
|
+
);
|
|
5544
|
+
const scaleOrigin = new import_Vec.Vec(
|
|
5545
|
+
targetBounds.minX + (pageBounds.minX - commonBounds.minX) * scaleX,
|
|
5546
|
+
targetBounds.minY + (pageBounds.minY - commonBounds.minY) * scaleY
|
|
5547
|
+
);
|
|
5548
|
+
for (const shape of shapes2) {
|
|
5549
|
+
const shapeLocalOffset = localOffset.clone();
|
|
5550
|
+
const parentTransform = this.getShapeParentTransform(shape);
|
|
5551
|
+
if (parentTransform) shapeLocalOffset.rot(-parentTransform.rotation());
|
|
5552
|
+
shapeLocalOffset.add(shape);
|
|
5553
|
+
const changes = this.getChangesToTranslateShape(shape, shapeLocalOffset);
|
|
5554
|
+
this.updateShape(changes);
|
|
5555
|
+
this.resizeShape(shape.id, scale, {
|
|
5556
|
+
initialBounds: this.getShapeGeometry(shape).bounds,
|
|
5557
|
+
scaleOrigin,
|
|
5558
|
+
isAspectRatioLocked: this.getShapeUtil(shape).isAspectRatioLocked(shape),
|
|
5559
|
+
scaleAxisRotation: 0
|
|
5560
|
+
});
|
|
5561
|
+
}
|
|
5562
|
+
});
|
|
5563
|
+
return this;
|
|
5564
|
+
}
|
|
5612
5565
|
/**
|
|
5613
5566
|
* Resize a shape.
|
|
5614
5567
|
*
|
|
@@ -7968,6 +7921,7 @@ __decorateElement(_init, 1, "getCamera", _getCamera_dec, Editor);
|
|
|
7968
7921
|
__decorateElement(_init, 1, "getViewportPageBoundsForFollowing", _getViewportPageBoundsForFollowing_dec, Editor);
|
|
7969
7922
|
__decorateElement(_init, 1, "getCameraForFollowing", _getCameraForFollowing_dec, Editor);
|
|
7970
7923
|
__decorateElement(_init, 1, "getZoomLevel", _getZoomLevel_dec, Editor);
|
|
7924
|
+
__decorateElement(_init, 1, "getResizeScaleFactor", _getResizeScaleFactor_dec, Editor);
|
|
7971
7925
|
__decorateElement(_init, 1, "getDebouncedZoomLevel", _getDebouncedZoomLevel_dec, Editor);
|
|
7972
7926
|
__decorateElement(_init, 1, "_getAboveDebouncedZoomThreshold", __getAboveDebouncedZoomThreshold_dec, Editor);
|
|
7973
7927
|
__decorateElement(_init, 1, "getEfficientZoomLevel", _getEfficientZoomLevel_dec, Editor);
|