@react-fabric/draw 1.0.0-beta.55 → 1.0.0-beta.58

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.
@@ -207,7 +207,7 @@ var DrawCanvas = function DrawCanvas(_ref) {
207
207
  while (1) switch (_context2.prev = _context2.next) {
208
208
  case 0:
209
209
  currentPage = editorRef === null || editorRef === void 0 ? void 0 : editorRef.getCurrentPageId();
210
- pages = Object.keys((_editorRef$store$getS = editorRef === null || editorRef === void 0 ? void 0 : editorRef.store.getSnapshot().store) !== null && _editorRef$store$getS !== void 0 ? _editorRef$store$getS : {}).filter(function (key) {
210
+ pages = Object.keys((_editorRef$store$getS = editorRef === null || editorRef === void 0 ? void 0 : editorRef.store.getStoreSnapshot().store) !== null && _editorRef$store$getS !== void 0 ? _editorRef$store$getS : {}).filter(function (key) {
211
211
  return key.startsWith("page:");
212
212
  });
213
213
  pageSnapshots = [];
@@ -230,7 +230,7 @@ var DrawCanvas = function DrawCanvas(_ref) {
230
230
  case 3:
231
231
  shapes = editorRef === null || editorRef === void 0 ? void 0 : editorRef.getCurrentPageShapeIds();
232
232
  _context.next = 6;
233
- return editorRef === null || editorRef === void 0 ? void 0 : editorRef.getSvg(_toConsumableArray(shapes), {
233
+ return editorRef === null || editorRef === void 0 ? void 0 : editorRef.getSvgElement(_toConsumableArray(shapes), {
234
234
  scale: 1,
235
235
  background: true
236
236
  });
@@ -244,7 +244,7 @@ var DrawCanvas = function DrawCanvas(_ref) {
244
244
  _context.t1 = pg;
245
245
  _context.t2 = editorRef === null || editorRef === void 0 ? void 0 : editorRef.getCurrentPage().name;
246
246
  _context.next = 13;
247
- return getSvgAsDataUrl(svg);
247
+ return getSvgAsDataUrl(svg.svg);
248
248
  case 13:
249
249
  _context.t3 = _context.sent;
250
250
  _context.t4 = {
@@ -39,7 +39,6 @@ var Pointing = /*#__PURE__*/function (_StateNode) {
39
39
  var originPagePoint = _this.editor.inputs.originPagePoint;
40
40
  var id = tldraw.createShapeId();
41
41
  _this.markId = "creating:".concat(id);
42
- _this.editor.mark(_this.markId);
43
42
  _this.editor.createShapes([{
44
43
  id: id,
45
44
  type: "avatar",
@@ -56,6 +55,7 @@ var Pointing = /*#__PURE__*/function (_StateNode) {
56
55
  target: "selection",
57
56
  handle: "bottom_right",
58
57
  isCreating: true,
58
+ creatingMarkId: _this.markId,
59
59
  creationCursorOffset: {
60
60
  x: 1,
61
61
  y: 1
@@ -207,7 +207,7 @@ var DrawCanvas = function DrawCanvas(_ref) {
207
207
  while (1) switch (_context2.prev = _context2.next) {
208
208
  case 0:
209
209
  currentPage = editorRef === null || editorRef === void 0 ? void 0 : editorRef.getCurrentPageId();
210
- pages = Object.keys((_editorRef$store$getS = editorRef === null || editorRef === void 0 ? void 0 : editorRef.store.getSnapshot().store) !== null && _editorRef$store$getS !== void 0 ? _editorRef$store$getS : {}).filter(function (key) {
210
+ pages = Object.keys((_editorRef$store$getS = editorRef === null || editorRef === void 0 ? void 0 : editorRef.store.getStoreSnapshot().store) !== null && _editorRef$store$getS !== void 0 ? _editorRef$store$getS : {}).filter(function (key) {
211
211
  return key.startsWith("page:");
212
212
  });
213
213
  pageSnapshots = [];
@@ -230,7 +230,7 @@ var DrawCanvas = function DrawCanvas(_ref) {
230
230
  case 3:
231
231
  shapes = editorRef === null || editorRef === void 0 ? void 0 : editorRef.getCurrentPageShapeIds();
232
232
  _context.next = 6;
233
- return editorRef === null || editorRef === void 0 ? void 0 : editorRef.getSvg(_toConsumableArray(shapes), {
233
+ return editorRef === null || editorRef === void 0 ? void 0 : editorRef.getSvgElement(_toConsumableArray(shapes), {
234
234
  scale: 1,
235
235
  background: true
236
236
  });
@@ -244,7 +244,7 @@ var DrawCanvas = function DrawCanvas(_ref) {
244
244
  _context.t1 = pg;
245
245
  _context.t2 = editorRef === null || editorRef === void 0 ? void 0 : editorRef.getCurrentPage().name;
246
246
  _context.next = 13;
247
- return getSvgAsDataUrl(svg);
247
+ return getSvgAsDataUrl(svg.svg);
248
248
  case 13:
249
249
  _context.t3 = _context.sent;
250
250
  _context.t4 = {
@@ -39,7 +39,6 @@ var Pointing = /*#__PURE__*/function (_StateNode) {
39
39
  var originPagePoint = _this.editor.inputs.originPagePoint;
40
40
  var id = createShapeId();
41
41
  _this.markId = "creating:".concat(id);
42
- _this.editor.mark(_this.markId);
43
42
  _this.editor.createShapes([{
44
43
  id: id,
45
44
  type: "avatar",
@@ -56,6 +55,7 @@ var Pointing = /*#__PURE__*/function (_StateNode) {
56
55
  target: "selection",
57
56
  handle: "bottom_right",
58
57
  isCreating: true,
58
+ creatingMarkId: _this.markId,
59
59
  creationCursorOffset: {
60
60
  x: 1,
61
61
  y: 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-fabric/draw",
3
- "version": "1.0.0-beta.55",
3
+ "version": "1.0.0-beta.58",
4
4
  "description": "RUF: TLDraw canvas",
5
5
  "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
6
  "license": "MIT",
@@ -33,26 +33,26 @@
33
33
  "watch": "npm-run-all -p watch:rollup watch:dts"
34
34
  },
35
35
  "dependencies": {
36
- "@react-fabric/core": "^1.0.0-beta.55",
37
- "@react-fabric/utilities": "^1.0.0-beta.52",
38
- "@tldraw/assets": "^3.13.1",
39
- "@tldraw/editor": "^3.13.1",
40
- "@tldraw/tldraw": "^3.13.1",
41
- "classnames": "^2.5.1",
42
- "dom-to-image": "^2.6.0"
36
+ "@react-fabric/core": "^1.0.0-beta.58",
37
+ "@react-fabric/utilities": "^1.0.0-beta.58",
38
+ "@tldraw/assets": "~4.1.2",
39
+ "@tldraw/editor": "~4.1.2",
40
+ "@tldraw/tldraw": "~4.1.2",
41
+ "classnames": "~2.5.1",
42
+ "dom-to-image": "~2.6.0"
43
43
  },
44
44
  "peerDependencies": {
45
- "i18next": "^25.2.1",
46
- "react": "^19.0.0",
47
- "react-dom": "^19.0.0",
48
- "react-i18next": "^15.5.2"
45
+ "i18next": "~25.6.0",
46
+ "react": "~19.2.0",
47
+ "react-dom": "~19.2.0",
48
+ "react-i18next": "~16.2.1"
49
49
  },
50
50
  "devDependencies": {
51
- "@types/dom-to-image": "^2.6.7"
51
+ "@types/dom-to-image": "~2.6.7"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=18.12.0",
55
55
  "npm": ">=8.19.0"
56
56
  },
57
- "gitHead": "c8454798fb7546174ee8c7ea10e491c5e903e789"
57
+ "gitHead": "7e66f8c498e37a40e410ecafff2ea6b31505dc1a"
58
58
  }
@@ -204,7 +204,7 @@ export const DrawCanvas: FC<DrawProps> = ({
204
204
  exportPages: async () => {
205
205
  const currentPage = editorRef?.getCurrentPageId();
206
206
  const pages = Object.keys(
207
- editorRef?.store.getSnapshot().store ?? {},
207
+ editorRef?.store.getStoreSnapshot().store ?? {},
208
208
  ).filter((key) => key.startsWith("page:"));
209
209
  const pageSnapshots: KeyValue[] = [];
210
210
  while (pages.length) {
@@ -219,7 +219,7 @@ export const DrawCanvas: FC<DrawProps> = ({
219
219
  editorRef?.setCurrentPage(pg);
220
220
  });
221
221
  const shapes: AnyObject = editorRef?.getCurrentPageShapeIds();
222
- const svg = await editorRef?.getSvg([...shapes], {
222
+ const svg = await editorRef?.getSvgElement([...shapes], {
223
223
  scale: 1,
224
224
  background: true,
225
225
  });
@@ -227,7 +227,7 @@ export const DrawCanvas: FC<DrawProps> = ({
227
227
  pageSnapshots.push({
228
228
  id: pg,
229
229
  name: editorRef?.getCurrentPage().name,
230
- content: { image: await getSvgAsDataUrl(svg) },
230
+ content: { image: await getSvgAsDataUrl(svg.svg) },
231
231
  });
232
232
  }
233
233
  currentPage && editorRef?.setCurrentPage(currentPage);
@@ -56,8 +56,6 @@ export class Pointing extends StateNode {
56
56
 
57
57
  this.markId = `creating:${id}`;
58
58
 
59
- this.editor.mark(this.markId);
60
-
61
59
  this.editor
62
60
  .createShapes<AvatarShape>([
63
61
  {
@@ -80,6 +78,7 @@ export class Pointing extends StateNode {
80
78
  target: "selection",
81
79
  handle: "bottom_right",
82
80
  isCreating: true,
81
+ creatingMarkId: this.markId,
83
82
  creationCursorOffset: { x: 1, y: 1 },
84
83
  onInteractionEnd: "avatar",
85
84
  });