@tldraw/editor 3.11.0-canary.ab0adf58d28b → 3.11.0-canary.afac70b2330e

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/dist-cjs/index.d.ts +16 -8
  3. package/dist-cjs/index.js +1 -1
  4. package/dist-cjs/index.js.map +2 -2
  5. package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js +4 -4
  6. package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js.map +2 -2
  7. package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js +37 -25
  8. package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js.map +2 -2
  9. package/dist-cjs/lib/config/createTLStore.js +2 -1
  10. package/dist-cjs/lib/config/createTLStore.js.map +2 -2
  11. package/dist-cjs/lib/constants.js +1 -1
  12. package/dist-cjs/lib/constants.js.map +2 -2
  13. package/dist-cjs/lib/editor/Editor.js +18 -10
  14. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  15. package/dist-cjs/lib/exports/exportToSvg.js.map +1 -1
  16. package/dist-cjs/lib/hooks/useLocalStore.js +3 -0
  17. package/dist-cjs/lib/hooks/useLocalStore.js.map +2 -2
  18. package/dist-cjs/lib/utils/sync/LocalIndexedDb.js +8 -0
  19. package/dist-cjs/lib/utils/sync/LocalIndexedDb.js.map +2 -2
  20. package/dist-cjs/version.js +3 -3
  21. package/dist-cjs/version.js.map +1 -1
  22. package/dist-esm/index.d.mts +16 -8
  23. package/dist-esm/index.mjs +4 -2
  24. package/dist-esm/index.mjs.map +2 -2
  25. package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs +4 -4
  26. package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs.map +2 -2
  27. package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs +37 -25
  28. package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs.map +2 -2
  29. package/dist-esm/lib/config/createTLStore.mjs +2 -1
  30. package/dist-esm/lib/config/createTLStore.mjs.map +2 -2
  31. package/dist-esm/lib/constants.mjs +1 -1
  32. package/dist-esm/lib/constants.mjs.map +2 -2
  33. package/dist-esm/lib/editor/Editor.mjs +18 -10
  34. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  35. package/dist-esm/lib/exports/exportToSvg.mjs.map +1 -1
  36. package/dist-esm/lib/hooks/useLocalStore.mjs +3 -0
  37. package/dist-esm/lib/hooks/useLocalStore.mjs.map +2 -2
  38. package/dist-esm/lib/utils/sync/LocalIndexedDb.mjs +8 -0
  39. package/dist-esm/lib/utils/sync/LocalIndexedDb.mjs.map +2 -2
  40. package/dist-esm/version.mjs +3 -3
  41. package/dist-esm/version.mjs.map +1 -1
  42. package/package.json +7 -7
  43. package/src/index.ts +4 -1
  44. package/src/lib/components/default-components/DefaultShapeIndicator.tsx +4 -4
  45. package/src/lib/components/default-components/DefaultShapeIndicators.tsx +51 -28
  46. package/src/lib/config/createTLStore.ts +1 -0
  47. package/src/lib/constants.ts +1 -1
  48. package/src/lib/editor/Editor.ts +20 -11
  49. package/src/lib/exports/exportToSvg.tsx +1 -1
  50. package/src/lib/hooks/useLocalStore.ts +3 -0
  51. package/src/lib/utils/sync/LocalIndexedDb.ts +9 -0
  52. package/src/version.ts +3 -3
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/config/createTLStore.ts"],
4
- "sourcesContent": ["import { Signal } from '@tldraw/state'\nimport { HistoryEntry, MigrationSequence, SerializedStore, Store, StoreSchema } from '@tldraw/store'\nimport {\n\tSchemaPropsInfo,\n\tTLAssetStore,\n\tTLRecord,\n\tTLStore,\n\tTLStoreProps,\n\tTLStoreSnapshot,\n\tcreateTLSchema,\n} from '@tldraw/tlschema'\nimport { FileHelpers, assert } from '@tldraw/utils'\nimport { Editor } from '../editor/Editor'\nimport { TLEditorSnapshot, loadSnapshot } from './TLEditorSnapshot'\nimport { TLAnyBindingUtilConstructor, checkBindings } from './defaultBindings'\nimport { TLAnyShapeUtilConstructor, checkShapesAndAddCore } from './defaultShapes'\n\n/** @public */\nexport interface TLStoreBaseOptions {\n\t/** The initial data for the store. */\n\tinitialData?: SerializedStore<TLRecord>\n\n\t/** A snapshot of initial data to migrate and load into the store. */\n\tsnapshot?: Partial<TLEditorSnapshot> | TLStoreSnapshot\n\n\t/** The default name for the store. */\n\tdefaultName?: string\n\n\t/** How should this store upload & resolve assets? */\n\tassets?: TLAssetStore\n\n\t/** Called when the store is connected to an {@link Editor}. */\n\tonMount?(editor: Editor): void | (() => void)\n}\n\n/** @public */\nexport type TLStoreSchemaOptions =\n\t| {\n\t\t\tschema?: StoreSchema<TLRecord, TLStoreProps>\n\t }\n\t| {\n\t\t\tshapeUtils?: readonly TLAnyShapeUtilConstructor[]\n\t\t\tmigrations?: readonly MigrationSequence[]\n\t\t\tbindingUtils?: readonly TLAnyBindingUtilConstructor[]\n\t }\n\n/** @public */\nexport type TLStoreOptions = TLStoreBaseOptions & {\n\tid?: string\n\t/** Collaboration options for the store. */\n\tcollaboration?: {\n\t\tstatus: Signal<'online' | 'offline'> | null\n\t\tmode?: Signal<'readonly' | 'readwrite'> | null\n\t}\n} & TLStoreSchemaOptions\n\n/** @public */\nexport type TLStoreEventInfo = HistoryEntry<TLRecord>\n\nconst defaultAssetResolve: NonNullable<TLAssetStore['resolve']> = (asset) => asset.props.src\n\n/** @public */\nexport const inlineBase64AssetStore: TLAssetStore = {\n\tupload: async (_, file) => {\n\t\treturn { src: await FileHelpers.blobToDataUrl(file) }\n\t},\n}\n\n/**\n * A helper for creating a TLStore schema from either an object with shapeUtils, bindingUtils, and\n * migrations, or a schema.\n *\n * @param opts - Options for creating the schema.\n *\n * @public\n */\nexport function createTLSchemaFromUtils(\n\topts: TLStoreSchemaOptions\n): StoreSchema<TLRecord, TLStoreProps> {\n\tif ('schema' in opts && opts.schema) return opts.schema\n\n\treturn createTLSchema({\n\t\tshapes:\n\t\t\t'shapeUtils' in opts && opts.shapeUtils\n\t\t\t\t? utilsToMap(checkShapesAndAddCore(opts.shapeUtils))\n\t\t\t\t: undefined,\n\t\tbindings:\n\t\t\t'bindingUtils' in opts && opts.bindingUtils\n\t\t\t\t? utilsToMap(checkBindings(opts.bindingUtils))\n\t\t\t\t: undefined,\n\t\tmigrations: 'migrations' in opts ? opts.migrations : undefined,\n\t})\n}\n\n/**\n * A helper for creating a TLStore.\n *\n * @param opts - Options for creating the store.\n *\n * @public\n */\nexport function createTLStore({\n\tinitialData,\n\tdefaultName = '',\n\tid,\n\tassets = inlineBase64AssetStore,\n\tonMount,\n\tcollaboration,\n\t...rest\n}: TLStoreOptions = {}): TLStore {\n\tconst schema = createTLSchemaFromUtils(rest)\n\n\tconst store = new Store({\n\t\tid,\n\t\tschema,\n\t\tinitialData,\n\t\tprops: {\n\t\t\tdefaultName,\n\t\t\tassets: {\n\t\t\t\tupload: assets.upload,\n\t\t\t\tresolve: assets.resolve ?? defaultAssetResolve,\n\t\t\t},\n\t\t\tonMount: (editor) => {\n\t\t\t\tassert(editor instanceof Editor)\n\t\t\t\tonMount?.(editor)\n\t\t\t},\n\t\t\tcollaboration,\n\t\t},\n\t})\n\n\tif (rest.snapshot) {\n\t\tif (initialData) throw new Error('Cannot provide both initialData and snapshot')\n\t\tloadSnapshot(store, rest.snapshot, { forceOverwriteSessionState: true })\n\t}\n\n\treturn store\n}\n\nfunction utilsToMap<T extends SchemaPropsInfo & { type: string }>(utils: T[]) {\n\treturn Object.fromEntries(\n\t\tutils.map((s): [string, SchemaPropsInfo] => [\n\t\t\ts.type,\n\t\t\t{\n\t\t\t\tprops: s.props,\n\t\t\t\tmigrations: s.migrations,\n\t\t\t},\n\t\t])\n\t)\n}\n"],
5
- "mappings": "AACA,SAA2D,aAA0B;AACrF;AAAA,EAOC;AAAA,OACM;AACP,SAAS,aAAa,cAAc;AACpC,SAAS,cAAc;AACvB,SAA2B,oBAAoB;AAC/C,SAAsC,qBAAqB;AAC3D,SAAoC,6BAA6B;AA4CjE,MAAM,sBAA4D,CAAC,UAAU,MAAM,MAAM;AAGlF,MAAM,yBAAuC;AAAA,EACnD,QAAQ,OAAO,GAAG,SAAS;AAC1B,WAAO,EAAE,KAAK,MAAM,YAAY,cAAc,IAAI,EAAE;AAAA,EACrD;AACD;AAUO,SAAS,wBACf,MACsC;AACtC,MAAI,YAAY,QAAQ,KAAK,OAAQ,QAAO,KAAK;AAEjD,SAAO,eAAe;AAAA,IACrB,QACC,gBAAgB,QAAQ,KAAK,aAC1B,WAAW,sBAAsB,KAAK,UAAU,CAAC,IACjD;AAAA,IACJ,UACC,kBAAkB,QAAQ,KAAK,eAC5B,WAAW,cAAc,KAAK,YAAY,CAAC,IAC3C;AAAA,IACJ,YAAY,gBAAgB,OAAO,KAAK,aAAa;AAAA,EACtD,CAAC;AACF;AASO,SAAS,cAAc;AAAA,EAC7B;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,GAAG;AACJ,IAAoB,CAAC,GAAY;AAChC,QAAM,SAAS,wBAAwB,IAAI;AAE3C,QAAM,QAAQ,IAAI,MAAM;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,MACN;AAAA,MACA,QAAQ;AAAA,QACP,QAAQ,OAAO;AAAA,QACf,SAAS,OAAO,WAAW;AAAA,MAC5B;AAAA,MACA,SAAS,CAAC,WAAW;AACpB,eAAO,kBAAkB,MAAM;AAC/B,kBAAU,MAAM;AAAA,MACjB;AAAA,MACA;AAAA,IACD;AAAA,EACD,CAAC;AAED,MAAI,KAAK,UAAU;AAClB,QAAI,YAAa,OAAM,IAAI,MAAM,8CAA8C;AAC/E,iBAAa,OAAO,KAAK,UAAU,EAAE,4BAA4B,KAAK,CAAC;AAAA,EACxE;AAEA,SAAO;AACR;AAEA,SAAS,WAAyD,OAAY;AAC7E,SAAO,OAAO;AAAA,IACb,MAAM,IAAI,CAAC,MAAiC;AAAA,MAC3C,EAAE;AAAA,MACF;AAAA,QACC,OAAO,EAAE;AAAA,QACT,YAAY,EAAE;AAAA,MACf;AAAA,IACD,CAAC;AAAA,EACF;AACD;",
4
+ "sourcesContent": ["import { Signal } from '@tldraw/state'\nimport { HistoryEntry, MigrationSequence, SerializedStore, Store, StoreSchema } from '@tldraw/store'\nimport {\n\tSchemaPropsInfo,\n\tTLAssetStore,\n\tTLRecord,\n\tTLStore,\n\tTLStoreProps,\n\tTLStoreSnapshot,\n\tcreateTLSchema,\n} from '@tldraw/tlschema'\nimport { FileHelpers, assert } from '@tldraw/utils'\nimport { Editor } from '../editor/Editor'\nimport { TLEditorSnapshot, loadSnapshot } from './TLEditorSnapshot'\nimport { TLAnyBindingUtilConstructor, checkBindings } from './defaultBindings'\nimport { TLAnyShapeUtilConstructor, checkShapesAndAddCore } from './defaultShapes'\n\n/** @public */\nexport interface TLStoreBaseOptions {\n\t/** The initial data for the store. */\n\tinitialData?: SerializedStore<TLRecord>\n\n\t/** A snapshot of initial data to migrate and load into the store. */\n\tsnapshot?: Partial<TLEditorSnapshot> | TLStoreSnapshot\n\n\t/** The default name for the store. */\n\tdefaultName?: string\n\n\t/** How should this store upload & resolve assets? */\n\tassets?: TLAssetStore\n\n\t/** Called when the store is connected to an {@link Editor}. */\n\tonMount?(editor: Editor): void | (() => void)\n}\n\n/** @public */\nexport type TLStoreSchemaOptions =\n\t| {\n\t\t\tschema?: StoreSchema<TLRecord, TLStoreProps>\n\t }\n\t| {\n\t\t\tshapeUtils?: readonly TLAnyShapeUtilConstructor[]\n\t\t\tmigrations?: readonly MigrationSequence[]\n\t\t\tbindingUtils?: readonly TLAnyBindingUtilConstructor[]\n\t }\n\n/** @public */\nexport type TLStoreOptions = TLStoreBaseOptions & {\n\tid?: string\n\t/** Collaboration options for the store. */\n\tcollaboration?: {\n\t\tstatus: Signal<'online' | 'offline'> | null\n\t\tmode?: Signal<'readonly' | 'readwrite'> | null\n\t}\n} & TLStoreSchemaOptions\n\n/** @public */\nexport type TLStoreEventInfo = HistoryEntry<TLRecord>\n\nconst defaultAssetResolve: NonNullable<TLAssetStore['resolve']> = (asset) => asset.props.src\n\n/** @public */\nexport const inlineBase64AssetStore: TLAssetStore = {\n\tupload: async (_, file) => {\n\t\treturn { src: await FileHelpers.blobToDataUrl(file) }\n\t},\n}\n\n/**\n * A helper for creating a TLStore schema from either an object with shapeUtils, bindingUtils, and\n * migrations, or a schema.\n *\n * @param opts - Options for creating the schema.\n *\n * @public\n */\nexport function createTLSchemaFromUtils(\n\topts: TLStoreSchemaOptions\n): StoreSchema<TLRecord, TLStoreProps> {\n\tif ('schema' in opts && opts.schema) return opts.schema\n\n\treturn createTLSchema({\n\t\tshapes:\n\t\t\t'shapeUtils' in opts && opts.shapeUtils\n\t\t\t\t? utilsToMap(checkShapesAndAddCore(opts.shapeUtils))\n\t\t\t\t: undefined,\n\t\tbindings:\n\t\t\t'bindingUtils' in opts && opts.bindingUtils\n\t\t\t\t? utilsToMap(checkBindings(opts.bindingUtils))\n\t\t\t\t: undefined,\n\t\tmigrations: 'migrations' in opts ? opts.migrations : undefined,\n\t})\n}\n\n/**\n * A helper for creating a TLStore.\n *\n * @param opts - Options for creating the store.\n *\n * @public\n */\nexport function createTLStore({\n\tinitialData,\n\tdefaultName = '',\n\tid,\n\tassets = inlineBase64AssetStore,\n\tonMount,\n\tcollaboration,\n\t...rest\n}: TLStoreOptions = {}): TLStore {\n\tconst schema = createTLSchemaFromUtils(rest)\n\n\tconst store = new Store({\n\t\tid,\n\t\tschema,\n\t\tinitialData,\n\t\tprops: {\n\t\t\tdefaultName,\n\t\t\tassets: {\n\t\t\t\tupload: assets.upload,\n\t\t\t\tresolve: assets.resolve ?? defaultAssetResolve,\n\t\t\t\tremove: assets.remove ?? (() => Promise.resolve()),\n\t\t\t},\n\t\t\tonMount: (editor) => {\n\t\t\t\tassert(editor instanceof Editor)\n\t\t\t\tonMount?.(editor)\n\t\t\t},\n\t\t\tcollaboration,\n\t\t},\n\t})\n\n\tif (rest.snapshot) {\n\t\tif (initialData) throw new Error('Cannot provide both initialData and snapshot')\n\t\tloadSnapshot(store, rest.snapshot, { forceOverwriteSessionState: true })\n\t}\n\n\treturn store\n}\n\nfunction utilsToMap<T extends SchemaPropsInfo & { type: string }>(utils: T[]) {\n\treturn Object.fromEntries(\n\t\tutils.map((s): [string, SchemaPropsInfo] => [\n\t\t\ts.type,\n\t\t\t{\n\t\t\t\tprops: s.props,\n\t\t\t\tmigrations: s.migrations,\n\t\t\t},\n\t\t])\n\t)\n}\n"],
5
+ "mappings": "AACA,SAA2D,aAA0B;AACrF;AAAA,EAOC;AAAA,OACM;AACP,SAAS,aAAa,cAAc;AACpC,SAAS,cAAc;AACvB,SAA2B,oBAAoB;AAC/C,SAAsC,qBAAqB;AAC3D,SAAoC,6BAA6B;AA4CjE,MAAM,sBAA4D,CAAC,UAAU,MAAM,MAAM;AAGlF,MAAM,yBAAuC;AAAA,EACnD,QAAQ,OAAO,GAAG,SAAS;AAC1B,WAAO,EAAE,KAAK,MAAM,YAAY,cAAc,IAAI,EAAE;AAAA,EACrD;AACD;AAUO,SAAS,wBACf,MACsC;AACtC,MAAI,YAAY,QAAQ,KAAK,OAAQ,QAAO,KAAK;AAEjD,SAAO,eAAe;AAAA,IACrB,QACC,gBAAgB,QAAQ,KAAK,aAC1B,WAAW,sBAAsB,KAAK,UAAU,CAAC,IACjD;AAAA,IACJ,UACC,kBAAkB,QAAQ,KAAK,eAC5B,WAAW,cAAc,KAAK,YAAY,CAAC,IAC3C;AAAA,IACJ,YAAY,gBAAgB,OAAO,KAAK,aAAa;AAAA,EACtD,CAAC;AACF;AASO,SAAS,cAAc;AAAA,EAC7B;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,GAAG;AACJ,IAAoB,CAAC,GAAY;AAChC,QAAM,SAAS,wBAAwB,IAAI;AAE3C,QAAM,QAAQ,IAAI,MAAM;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,MACN;AAAA,MACA,QAAQ;AAAA,QACP,QAAQ,OAAO;AAAA,QACf,SAAS,OAAO,WAAW;AAAA,QAC3B,QAAQ,OAAO,WAAW,MAAM,QAAQ,QAAQ;AAAA,MACjD;AAAA,MACA,SAAS,CAAC,WAAW;AACpB,eAAO,kBAAkB,MAAM;AAC/B,kBAAU,MAAM;AAAA,MACjB;AAAA,MACA;AAAA,IACD;AAAA,EACD,CAAC;AAED,MAAI,KAAK,UAAU;AAClB,QAAI,YAAa,OAAM,IAAI,MAAM,8CAA8C;AAC/E,iBAAa,OAAO,KAAK,UAAU,EAAE,4BAA4B,KAAK,CAAC;AAAA,EACxE;AAEA,SAAO;AACR;AAEA,SAAS,WAAyD,OAAY;AAC7E,SAAO,OAAO;AAAA,IACb,MAAM,IAAI,CAAC,MAAiC;AAAA,MAC3C,EAAE;AAAA,MACF;AAAA,QACC,OAAO,EAAE;AAAA,QACT,YAAY,EAAE;AAAA,MACf;AAAA,IACD,CAAC;AAAA,EACF;AACD;",
6
6
  "names": []
7
7
  }
@@ -4,7 +4,7 @@ const DEFAULT_CAMERA_OPTIONS = {
4
4
  wheelBehavior: "pan",
5
5
  panSpeed: 1,
6
6
  zoomSpeed: 1,
7
- zoomSteps: [0.1, 0.25, 0.5, 1, 2, 4, 8]
7
+ zoomSteps: [0.05, 0.1, 0.25, 0.5, 1, 2, 4, 8]
8
8
  };
9
9
  const DEFAULT_ANIMATION_OPTIONS = {
10
10
  duration: 0,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/lib/constants.ts"],
4
- "sourcesContent": ["import { TLCameraOptions } from './editor/types/misc-types'\nimport { EASINGS } from './primitives/easings'\n\n/** @internal */\nexport const DEFAULT_CAMERA_OPTIONS: TLCameraOptions = {\n\tisLocked: false,\n\twheelBehavior: 'pan',\n\tpanSpeed: 1,\n\tzoomSpeed: 1,\n\tzoomSteps: [0.1, 0.25, 0.5, 1, 2, 4, 8],\n}\n\n/** @internal */\nexport const DEFAULT_ANIMATION_OPTIONS = {\n\tduration: 0,\n\teasing: EASINGS.easeInOutCubic,\n}\n\n/**\n * Negative pointer ids are reserved for internal use.\n *\n * @internal */\nexport const INTERNAL_POINTER_IDS = {\n\tCAMERA_MOVE: -10,\n} as const\n\n/** @public */\nexport const SIDES = ['top', 'right', 'bottom', 'left'] as const\n\nexport const LEFT_MOUSE_BUTTON = 0\nexport const RIGHT_MOUSE_BUTTON = 2\nexport const MIDDLE_MOUSE_BUTTON = 1\nexport const STYLUS_ERASER_BUTTON = 5\n\nexport const ZOOM_TO_FIT_PADDING = 128\n"],
5
- "mappings": "AACA,SAAS,eAAe;AAGjB,MAAM,yBAA0C;AAAA,EACtD,UAAU;AAAA,EACV,eAAe;AAAA,EACf,UAAU;AAAA,EACV,WAAW;AAAA,EACX,WAAW,CAAC,KAAK,MAAM,KAAK,GAAG,GAAG,GAAG,CAAC;AACvC;AAGO,MAAM,4BAA4B;AAAA,EACxC,UAAU;AAAA,EACV,QAAQ,QAAQ;AACjB;AAMO,MAAM,uBAAuB;AAAA,EACnC,aAAa;AACd;AAGO,MAAM,QAAQ,CAAC,OAAO,SAAS,UAAU,MAAM;AAE/C,MAAM,oBAAoB;AAC1B,MAAM,qBAAqB;AAC3B,MAAM,sBAAsB;AAC5B,MAAM,uBAAuB;AAE7B,MAAM,sBAAsB;",
4
+ "sourcesContent": ["import { TLCameraOptions } from './editor/types/misc-types'\nimport { EASINGS } from './primitives/easings'\n\n/** @internal */\nexport const DEFAULT_CAMERA_OPTIONS: TLCameraOptions = {\n\tisLocked: false,\n\twheelBehavior: 'pan',\n\tpanSpeed: 1,\n\tzoomSpeed: 1,\n\tzoomSteps: [0.05, 0.1, 0.25, 0.5, 1, 2, 4, 8],\n}\n\n/** @internal */\nexport const DEFAULT_ANIMATION_OPTIONS = {\n\tduration: 0,\n\teasing: EASINGS.easeInOutCubic,\n}\n\n/**\n * Negative pointer ids are reserved for internal use.\n *\n * @internal */\nexport const INTERNAL_POINTER_IDS = {\n\tCAMERA_MOVE: -10,\n} as const\n\n/** @public */\nexport const SIDES = ['top', 'right', 'bottom', 'left'] as const\n\nexport const LEFT_MOUSE_BUTTON = 0\nexport const RIGHT_MOUSE_BUTTON = 2\nexport const MIDDLE_MOUSE_BUTTON = 1\nexport const STYLUS_ERASER_BUTTON = 5\n\nexport const ZOOM_TO_FIT_PADDING = 128\n"],
5
+ "mappings": "AACA,SAAS,eAAe;AAGjB,MAAM,yBAA0C;AAAA,EACtD,UAAU;AAAA,EACV,eAAe;AAAA,EACf,UAAU;AAAA,EACV,WAAW;AAAA,EACX,WAAW,CAAC,MAAM,KAAK,MAAM,KAAK,GAAG,GAAG,GAAG,CAAC;AAC7C;AAGO,MAAM,4BAA4B;AAAA,EACxC,UAAU;AAAA,EACV,QAAQ,QAAQ;AACjB;AAMO,MAAM,uBAAuB;AAAA,EACnC,aAAa;AACd;AAGO,MAAM,QAAQ,CAAC,OAAO,SAAS,UAAU,MAAM;AAE/C,MAAM,oBAAoB;AAC1B,MAAM,qBAAqB;AAC3B,MAAM,sBAAsB;AAC5B,MAAM,uBAAuB;AAE7B,MAAM,sBAAsB;",
6
6
  "names": []
7
7
  }
@@ -3237,7 +3237,13 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
3237
3237
  if (this.getIsReadonly()) return this;
3238
3238
  const ids = typeof assets[0] === "string" ? assets : assets.map((a) => a.id);
3239
3239
  if (ids.length <= 0) return this;
3240
- this.run(() => this.store.remove(ids), { history: "ignore" });
3240
+ this.run(
3241
+ () => {
3242
+ this.store.props.assets.remove?.(ids);
3243
+ this.store.remove(ids);
3244
+ },
3245
+ { history: "ignore" }
3246
+ );
3241
3247
  return this;
3242
3248
  }
3243
3249
  /**
@@ -4803,17 +4809,18 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
4803
4809
  *
4804
4810
  * @example
4805
4811
  * ```ts
4806
- * editor.stackShapes([box1, box2], 'horizontal', 32)
4807
- * editor.stackShapes(editor.getSelectedShapeIds(), 'horizontal', 32)
4812
+ * editor.stackShapes([box1, box2], 'horizontal')
4813
+ * editor.stackShapes(editor.getSelectedShapeIds(), 'horizontal')
4808
4814
  * ```
4809
4815
  *
4810
4816
  * @param shapes - The shapes (or shape ids) to stack.
4811
4817
  * @param operation - Whether to stack horizontally or vertically.
4812
- * @param gap - The gap to leave between shapes.
4818
+ * @param gap - The gap to leave between shapes. By default, uses the editor's `adjacentShapeMargin` option.
4813
4819
  *
4814
4820
  * @public
4815
4821
  */
4816
4822
  stackShapes(shapes, operation, gap) {
4823
+ const _gap = gap ?? this.options.adjacentShapeMargin;
4817
4824
  const ids = typeof shapes[0] === "string" ? shapes : shapes.map((s) => s.id);
4818
4825
  if (this.getIsReadonly()) return this;
4819
4826
  const shapesToStackFirstPass = compact(ids.map((id) => this.getShape(id)));
@@ -4849,7 +4856,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
4849
4856
  allBounds.push(commonPageBounds);
4850
4857
  }
4851
4858
  const len = shapeClustersToStack.length;
4852
- if (gap === 0 && len < 3 || len < 2) return this;
4859
+ if (_gap === 0 && len < 3 || len < 2) return this;
4853
4860
  let val;
4854
4861
  let min;
4855
4862
  let max;
@@ -4866,7 +4873,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
4866
4873
  dim = "height";
4867
4874
  }
4868
4875
  let shapeGap = 0;
4869
- if (gap === 0) {
4876
+ if (_gap === 0) {
4870
4877
  const gaps = {};
4871
4878
  shapeClustersToStack.sort((a, b) => a.pageBounds[min] - b.pageBounds[min]);
4872
4879
  for (let i = 0; i < len - 1; i++) {
@@ -4894,7 +4901,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
4894
4901
  shapeGap /= totalCount;
4895
4902
  }
4896
4903
  } else {
4897
- shapeGap = gap;
4904
+ shapeGap = _gap;
4898
4905
  }
4899
4906
  const changes = [];
4900
4907
  let v = shapeClustersToStack[0].pageBounds[max];
@@ -4922,16 +4929,17 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
4922
4929
  *
4923
4930
  * @example
4924
4931
  * ```ts
4925
- * editor.packShapes([box1, box2], 32)
4932
+ * editor.packShapes([box1, box2])
4926
4933
  * editor.packShapes(editor.getSelectedShapeIds(), 32)
4927
4934
  * ```
4928
4935
  *
4929
4936
  *
4930
4937
  * @param shapes - The shapes (or shape ids) to pack.
4931
- * @param gap - The padding to apply to the packed shapes. Defaults to 16.
4938
+ * @param gap - The padding to apply to the packed shapes. Defaults to the editor's `adjacentShapeMargin` option.
4932
4939
  */
4933
- packShapes(shapes, gap) {
4940
+ packShapes(shapes, _gap) {
4934
4941
  if (this.getIsReadonly()) return this;
4942
+ const gap = _gap ?? this.options.adjacentShapeMargin;
4935
4943
  const ids = typeof shapes[0] === "string" ? shapes : shapes.map((s) => s.id);
4936
4944
  const shapesToPackFirstPass = compact(ids.map((id) => this.getShape(id)));
4937
4945
  const shapeClustersToPack = [];