@univerjs/drawing 1.0.0-rc.0 → 1.0.1

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/lib/cjs/index.js CHANGED
@@ -1,34 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- //#region \0rolldown/runtime.js
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
- key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) {
14
- __defProp(to, key, {
15
- get: ((k) => from[k]).bind(null, key),
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- }
19
- }
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
- value: mod,
25
- enumerable: true
26
- }) : target, mod));
27
-
28
- //#endregion
29
2
  let _univerjs_core = require("@univerjs/core");
30
- let ot_json1 = require("ot-json1");
31
- ot_json1 = __toESM(ot_json1);
32
3
  let rxjs = require("rxjs");
33
4
 
34
5
  //#region src/basics/config.ts
@@ -50,7 +21,7 @@ let rxjs = require("rxjs");
50
21
  const DRAWING_IMAGE_WIDTH_LIMIT = 500;
51
22
  const DRAWING_IMAGE_HEIGHT_LIMIT = 500;
52
23
  const DRAWING_IMAGE_COUNT_LIMIT = 10;
53
- let DRAWING_IMAGE_ALLOW_SIZE = 5 * 1024 * 1024;
24
+ let DRAWING_IMAGE_ALLOW_SIZE = 5242880;
54
25
  function setDrawingImageAllowSize(size) {
55
26
  DRAWING_IMAGE_ALLOW_SIZE = size;
56
27
  }
@@ -85,7 +56,7 @@ const SetDrawingSelectedOperation = {
85
56
  //#endregion
86
57
  //#region package.json
87
58
  var name = "@univerjs/drawing";
88
- var version = "1.0.0-rc.0";
59
+ var version = "1.0.1";
89
60
 
90
61
  //#endregion
91
62
  //#region src/config/config.ts
@@ -94,7 +65,7 @@ const configSymbol = Symbol(DRAWING_PLUGIN_CONFIG_KEY);
94
65
  const defaultPluginConfig = {};
95
66
 
96
67
  //#endregion
97
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
68
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
98
69
  function _typeof(o) {
99
70
  "@babel/helpers - typeof";
100
71
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -105,7 +76,7 @@ function _typeof(o) {
105
76
  }
106
77
 
107
78
  //#endregion
108
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
79
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
109
80
  function toPrimitive(t, r) {
110
81
  if ("object" != _typeof(t) || !t) return t;
111
82
  var e = t[Symbol.toPrimitive];
@@ -118,14 +89,14 @@ function toPrimitive(t, r) {
118
89
  }
119
90
 
120
91
  //#endregion
121
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
92
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
122
93
  function toPropertyKey(t) {
123
94
  var i = toPrimitive(t, "string");
124
95
  return "symbol" == _typeof(i) ? i : i + "";
125
96
  }
126
97
 
127
98
  //#endregion
128
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
99
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
129
100
  function _defineProperty(e, r, t) {
130
101
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
131
102
  value: t,
@@ -159,7 +130,7 @@ function hasOnlyEnumerableOwnProperties(value) {
159
130
  return Object.getOwnPropertyNames(value).every((key) => Object.prototype.propertyIsEnumerable.call(value, key));
160
131
  }
161
132
  function createJsonRemoveOp(path, value) {
162
- return ot_json1.type.writeCursor().writeAtPath(path, "r", value).get();
133
+ return _univerjs_core.JSON1.type.writeCursor().writeAtPath(path, "r", value).get();
163
134
  }
164
135
  function normalizeJsonDocument(value) {
165
136
  if (value === void 0) return;
@@ -179,12 +150,26 @@ function appendJsonUpdateOps(ops, path, newValue, oldValue, hasOldValue) {
179
150
  const hasNormalizedOldValue = hasOldValue && normalizedOldValue !== void 0;
180
151
  if (hasNormalizedOldValue && isJsonValueEqual(normalizedOldValue, normalizedNewValue)) return;
181
152
  if (hasNormalizedOldValue && isPlainObject(oldValue) && isPlainObject(newValue) && hasOnlyEnumerableOwnProperties(oldValue) && hasOnlyEnumerableOwnProperties(newValue)) {
182
- (/* @__PURE__ */ new Set([...Object.keys(oldValue), ...Object.keys(newValue)])).forEach((key) => appendJsonUpdateOps(ops, [...path, key], newValue[key], oldValue[key], Object.prototype.hasOwnProperty.call(oldValue, key) && oldValue[key] !== void 0));
153
+ for (const key of /* @__PURE__ */ new Set([...Object.keys(oldValue), ...Object.keys(newValue)])) appendJsonUpdateOps(ops, [...path, key], newValue[key], oldValue[key], Object.prototype.hasOwnProperty.call(oldValue, key) && oldValue[key] !== void 0);
183
154
  return;
184
155
  }
185
- const op = !hasNormalizedOldValue ? normalizedNewValue === void 0 ? null : ot_json1.insertOp(path, normalizedNewValue) : normalizedNewValue === void 0 ? createJsonRemoveOp(path, normalizedOldValue) : ot_json1.replaceOp(path, normalizedOldValue, normalizedNewValue);
156
+ const op = !hasNormalizedOldValue ? normalizedNewValue === void 0 ? null : _univerjs_core.JSON1.insertOp(path, normalizedNewValue) : normalizedNewValue === void 0 ? createJsonRemoveOp(path, normalizedOldValue) : _univerjs_core.JSON1.replaceOp(path, normalizedOldValue, normalizedNewValue);
186
157
  if (op && isNonEmptyOp(op)) ops.push(op);
187
158
  }
159
+ function assertSafeDrawingKeys(...keys) {
160
+ for (const key of keys) if (key === "__proto__" || key === "constructor" || key === "prototype") throw new Error("Invalid drawing key");
161
+ }
162
+ function getOwn(record, key) {
163
+ return record != null && Object.prototype.hasOwnProperty.call(record, key) ? record[key] : void 0;
164
+ }
165
+ function validateDrawingData(data) {
166
+ for (const subUnitId of Object.keys(data)) {
167
+ assertSafeDrawingKeys(subUnitId);
168
+ const subUnit = data[subUnitId];
169
+ if (subUnit === null || subUnit === void 0 ? void 0 : subUnit.data) Object.keys(subUnit.data).forEach((key) => assertSafeDrawingKeys(key));
170
+ if (subUnit === null || subUnit === void 0 ? void 0 : subUnit.order) subUnit.order.forEach((key) => assertSafeDrawingKeys(key));
171
+ }
172
+ }
188
173
  /**
189
174
  * unitId -> subUnitId -> drawingId -> drawingParam
190
175
  */
@@ -255,10 +240,10 @@ var UnitDrawingService = class {
255
240
  this.refreshTransformNotification(updateParams);
256
241
  }
257
242
  getDrawingDataForUnit(unitId) {
258
- return this.drawingManagerData[unitId] || {};
243
+ return getOwn(this.drawingManagerData, unitId) || {};
259
244
  }
260
245
  removeDrawingDataForUnit(unitId) {
261
- const subUnits = this.drawingManagerData[unitId];
246
+ const subUnits = getOwn(this.drawingManagerData, unitId);
262
247
  if (subUnits == null) return;
263
248
  delete this.drawingManagerData[unitId];
264
249
  const drawings = [];
@@ -276,11 +261,13 @@ var UnitDrawingService = class {
276
261
  if (drawings.length > 0) this.removeNotification(drawings);
277
262
  }
278
263
  registerDrawingData(unitId, data) {
264
+ assertSafeDrawingKeys(unitId);
265
+ validateDrawingData(data);
279
266
  this.drawingManagerData[unitId] = data;
280
267
  }
281
268
  initializeNotification(unitId) {
282
269
  const drawings = [];
283
- const data = this.drawingManagerData[unitId];
270
+ const data = getOwn(this.drawingManagerData, unitId);
284
271
  if (data == null) return;
285
272
  Object.keys(data).forEach((subUnitId) => {
286
273
  this._establishDrawingMap(unitId, subUnitId);
@@ -299,6 +286,9 @@ var UnitDrawingService = class {
299
286
  return this._getDrawingData(unitId, subUnitId);
300
287
  }
301
288
  setDrawingData(unitId, subUnitId, data) {
289
+ assertSafeDrawingKeys(unitId, subUnitId);
290
+ Object.keys(data).forEach((key) => assertSafeDrawingKeys(key));
291
+ this._establishDrawingMap(unitId, subUnitId);
302
292
  const unitData = this.drawingManagerData[unitId];
303
293
  const subUnitData = unitData[subUnitId];
304
294
  this._oldDrawingManagerData = {
@@ -324,8 +314,8 @@ var UnitDrawingService = class {
324
314
  ops.push(op);
325
315
  invertOps.push(invertOp);
326
316
  });
327
- const op = ops.reduce(ot_json1.type.compose, null);
328
- const invertOp = invertOps.reduce(ot_json1.type.compose, null);
317
+ const op = ops.reduce(_univerjs_core.JSON1.type.compose, null);
318
+ const invertOp = invertOps.reduce(_univerjs_core.JSON1.type.compose, null);
329
319
  const { unitId, subUnitId } = insertParams[0];
330
320
  return {
331
321
  undo: invertOp,
@@ -420,9 +410,9 @@ var UnitDrawingService = class {
420
410
  ops.unshift(op);
421
411
  invertOps.push(invertOp);
422
412
  });
423
- const op = ops.reduce(ot_json1.type.compose, null);
413
+ const op = ops.reduce(_univerjs_core.JSON1.type.compose, null);
424
414
  return {
425
- undo: invertOps.reduce(ot_json1.type.compose, null),
415
+ undo: invertOps.reduce(_univerjs_core.JSON1.type.compose, null),
426
416
  redo: op,
427
417
  unitId,
428
418
  subUnitId,
@@ -454,8 +444,8 @@ var UnitDrawingService = class {
454
444
  objects
455
445
  };
456
446
  }
457
- const op = ops.reduce(ot_json1.type.compose, null);
458
- const invertOp = invertOps.reduce(ot_json1.type.compose, null);
447
+ const op = ops.reduce(_univerjs_core.JSON1.type.compose, null);
448
+ const invertOp = invertOps.reduce(_univerjs_core.JSON1.type.compose, null);
459
449
  const { unitId, subUnitId } = updateParams[0];
460
450
  return {
461
451
  undo: invertOp,
@@ -492,9 +482,9 @@ var UnitDrawingService = class {
492
482
  groupParams.forEach((groupParam) => {
493
483
  ops.push(this._getGroupDrawingOp(groupParam));
494
484
  });
495
- const op = ops.reduce(ot_json1.type.compose, null);
485
+ const op = ops.reduce(_univerjs_core.JSON1.type.compose, null);
496
486
  return {
497
- undo: ot_json1.type.invertWithDoc(op, this.drawingManagerData),
487
+ undo: _univerjs_core.JSON1.type.invertWithDoc(op, this.drawingManagerData),
498
488
  redo: op,
499
489
  unitId,
500
490
  subUnitId,
@@ -507,9 +497,9 @@ var UnitDrawingService = class {
507
497
  groupParams.forEach((groupParam) => {
508
498
  ops.push(this._getUngroupDrawingOp(groupParam));
509
499
  });
510
- const op = ops.reduce(ot_json1.type.compose, null);
500
+ const op = ops.reduce(_univerjs_core.JSON1.type.compose, null);
511
501
  return {
512
- undo: ot_json1.type.invertWithDoc(op, this.drawingManagerData),
502
+ undo: _univerjs_core.JSON1.type.invertWithDoc(op, this.drawingManagerData),
513
503
  redo: op,
514
504
  unitId,
515
505
  subUnitId,
@@ -574,7 +564,7 @@ var UnitDrawingService = class {
574
564
  const { parent, children } = groupParam;
575
565
  const { unitId: groupUnitId, subUnitId: groupSubUnitId, drawingId: groupDrawingId } = parent;
576
566
  const ops = [];
577
- ops.push(ot_json1.insertOp([
567
+ ops.push(_univerjs_core.JSON1.insertOp([
578
568
  groupUnitId,
579
569
  groupSubUnitId,
580
570
  "data",
@@ -596,13 +586,13 @@ var UnitDrawingService = class {
596
586
  })));
597
587
  });
598
588
  if (maxChildIndex === Number.NEGATIVE_INFINITY) maxChildIndex = this._getDrawingOrder(groupUnitId, groupSubUnitId).length;
599
- ops.push(ot_json1.insertOp([
589
+ ops.push(_univerjs_core.JSON1.insertOp([
600
590
  groupUnitId,
601
591
  groupSubUnitId,
602
592
  "order",
603
593
  maxChildIndex
604
594
  ], groupDrawingId));
605
- return ops.reduce(ot_json1.type.compose, null);
595
+ return ops.reduce(_univerjs_core.JSON1.type.compose, null);
606
596
  }
607
597
  _getUngroupDrawingOp(groupParam) {
608
598
  const { parent, children } = groupParam;
@@ -616,24 +606,41 @@ var UnitDrawingService = class {
616
606
  drawingId
617
607
  })));
618
608
  });
619
- ops.push(ot_json1.removeOp([
609
+ ops.push(_univerjs_core.JSON1.removeOp([
620
610
  groupUnitId,
621
611
  groupSubUnitId,
622
612
  "data",
623
613
  groupDrawingId
624
614
  ], true));
625
- ops.push(ot_json1.removeOp([
615
+ ops.push(_univerjs_core.JSON1.removeOp([
626
616
  groupUnitId,
627
617
  groupSubUnitId,
628
618
  "order",
629
619
  this._getDrawingOrder(groupUnitId, groupSubUnitId).indexOf(groupDrawingId)
630
620
  ], true));
631
- return ops.reduce(ot_json1.type.compose, null);
621
+ return ops.reduce(_univerjs_core.JSON1.type.compose, null);
632
622
  }
633
623
  applyJson1(unitId, subUnitId, jsonOp) {
634
- this._establishDrawingMap(unitId, subUnitId);
635
- this._oldDrawingManagerData = { ...this.drawingManagerData };
636
- this.drawingManagerData = ot_json1.type.apply(this.drawingManagerData, jsonOp);
624
+ assertSafeDrawingKeys(unitId, subUnitId);
625
+ _univerjs_core.JSON1.type.checkValidOp(jsonOp);
626
+ const unitData = getOwn(this.drawingManagerData, unitId);
627
+ const data = {
628
+ ...this.drawingManagerData,
629
+ [unitId]: {
630
+ ...unitData,
631
+ [subUnitId]: getOwn(unitData, subUnitId) ?? {
632
+ data: {},
633
+ order: []
634
+ }
635
+ }
636
+ };
637
+ const nextData = _univerjs_core.JSON1.type.apply(data, jsonOp);
638
+ for (const id of Object.keys(nextData)) {
639
+ assertSafeDrawingKeys(id);
640
+ validateDrawingData(nextData[id]);
641
+ }
642
+ this._oldDrawingManagerData = this.drawingManagerData;
643
+ this.drawingManagerData = nextData;
637
644
  }
638
645
  featurePluginUpdateNotification(updateParams) {
639
646
  this._featurePluginUpdate$.next(updateParams);
@@ -699,6 +706,9 @@ var UnitDrawingService = class {
699
706
  return this._getDrawingOrder(unitId, subUnitId);
700
707
  }
701
708
  setDrawingOrder(unitId, subUnitId, order) {
709
+ assertSafeDrawingKeys(unitId, subUnitId);
710
+ order.forEach((key) => assertSafeDrawingKeys(key));
711
+ this._establishDrawingMap(unitId, subUnitId);
702
712
  this.drawingManagerData[unitId][subUnitId].order = order;
703
713
  }
704
714
  orderUpdateNotification(orderParams) {
@@ -716,7 +726,7 @@ var UnitDrawingService = class {
716
726
  drawingId
717
727
  });
718
728
  if (index === -1 || index === orders.length - 1) return;
719
- const op = ot_json1.moveOp([
729
+ const op = _univerjs_core.JSON1.moveOp([
720
730
  unitId,
721
731
  subUnitId,
722
732
  "order",
@@ -730,9 +740,9 @@ var UnitDrawingService = class {
730
740
  ops.push(op);
731
741
  if (!newIds.includes(orders[index + 1])) newIds.push(orders[index + 1]);
732
742
  });
733
- const op = ops.reduce(ot_json1.type.compose, null);
743
+ const op = ops.reduce(_univerjs_core.JSON1.type.compose, null);
734
744
  return {
735
- undo: ot_json1.type.invertWithDoc(op, this.drawingManagerData),
745
+ undo: _univerjs_core.JSON1.type.invertWithDoc(op, this.drawingManagerData),
736
746
  redo: op,
737
747
  unitId,
738
748
  subUnitId,
@@ -754,7 +764,7 @@ var UnitDrawingService = class {
754
764
  drawingId
755
765
  });
756
766
  if (index === -1 || index === 0) return;
757
- const op = ot_json1.moveOp([
767
+ const op = _univerjs_core.JSON1.moveOp([
758
768
  unitId,
759
769
  subUnitId,
760
770
  "order",
@@ -768,9 +778,9 @@ var UnitDrawingService = class {
768
778
  ops.push(op);
769
779
  if (!newIds.includes(orders[index - 1])) newIds.push(orders[index - 1]);
770
780
  });
771
- const op = ops.reduce(ot_json1.type.compose, null);
781
+ const op = ops.reduce(_univerjs_core.JSON1.type.compose, null);
772
782
  return {
773
- undo: ot_json1.type.invertWithDoc(op, this.drawingManagerData),
783
+ undo: _univerjs_core.JSON1.type.invertWithDoc(op, this.drawingManagerData),
774
784
  redo: op,
775
785
  unitId,
776
786
  subUnitId,
@@ -789,7 +799,7 @@ var UnitDrawingService = class {
789
799
  orderDrawingIds.forEach((orderDrawingId) => {
790
800
  const { drawingId } = orderDrawingId;
791
801
  const index = this._getDrawingCount(unitId, subUnitId) - 1;
792
- const op = ot_json1.moveOp([
802
+ const op = _univerjs_core.JSON1.moveOp([
793
803
  unitId,
794
804
  subUnitId,
795
805
  "order",
@@ -803,9 +813,9 @@ var UnitDrawingService = class {
803
813
  ops.push(op);
804
814
  if (!newIds.includes(orders[index])) newIds.push(orders[index]);
805
815
  });
806
- const op = ops.reduce(ot_json1.type.compose, null);
816
+ const op = ops.reduce(_univerjs_core.JSON1.type.compose, null);
807
817
  return {
808
- undo: ot_json1.type.invertWithDoc(op, this.drawingManagerData),
818
+ undo: _univerjs_core.JSON1.type.invertWithDoc(op, this.drawingManagerData),
809
819
  redo: op,
810
820
  unitId,
811
821
  subUnitId,
@@ -823,7 +833,7 @@ var UnitDrawingService = class {
823
833
  const ops = [];
824
834
  orderSearchParams.forEach((orderSearchParam) => {
825
835
  const { drawingId } = orderSearchParam;
826
- const op = ot_json1.moveOp([
836
+ const op = _univerjs_core.JSON1.moveOp([
827
837
  unitId,
828
838
  subUnitId,
829
839
  "order",
@@ -837,9 +847,9 @@ var UnitDrawingService = class {
837
847
  ops.push(op);
838
848
  if (!newIds.includes(orders[0])) newIds.push(orders[0]);
839
849
  });
840
- const op = ops.reduce(ot_json1.type.compose, null);
850
+ const op = ops.reduce(_univerjs_core.JSON1.type.compose, null);
841
851
  return {
842
- undo: ot_json1.type.invertWithDoc(op, this.drawingManagerData),
852
+ undo: _univerjs_core.JSON1.type.invertWithDoc(op, this.drawingManagerData),
843
853
  redo: op,
844
854
  unitId,
845
855
  subUnitId,
@@ -857,7 +867,7 @@ var UnitDrawingService = class {
857
867
  const currentIndex = orders.indexOf(drawingId);
858
868
  const targetIndex = (0, _univerjs_core.normalizeDrawingOrderIndex)(zOrder, orders.length);
859
869
  if (currentIndex < 0 || currentIndex === targetIndex) return null;
860
- const op = ot_json1.moveOp([
870
+ const op = _univerjs_core.JSON1.moveOp([
861
871
  unitId,
862
872
  subUnitId,
863
873
  "order",
@@ -868,7 +878,7 @@ var UnitDrawingService = class {
868
878
  "order",
869
879
  targetIndex
870
880
  ]);
871
- const invertOp = ot_json1.type.invertWithDoc(op, this.drawingManagerData);
881
+ const invertOp = _univerjs_core.JSON1.type.invertWithDoc(op, this.drawingManagerData);
872
882
  const affectedDrawingIds = orders.slice(Math.min(currentIndex, targetIndex), Math.max(currentIndex, targetIndex) + 1);
873
883
  return {
874
884
  undo: invertOp,
@@ -903,44 +913,45 @@ var UnitDrawingService = class {
903
913
  return this._getDrawingOrder(unitId, subUnitId).indexOf(drawingId);
904
914
  }
905
915
  _getCurrentBySearch(searchParam) {
906
- var _this$drawingManagerD;
916
+ var _getOwn;
907
917
  if (searchParam == null) return;
908
918
  const { unitId, subUnitId, drawingId } = searchParam;
909
- return (_this$drawingManagerD = this.drawingManagerData[unitId]) === null || _this$drawingManagerD === void 0 || (_this$drawingManagerD = _this$drawingManagerD[subUnitId]) === null || _this$drawingManagerD === void 0 || (_this$drawingManagerD = _this$drawingManagerD.data) === null || _this$drawingManagerD === void 0 ? void 0 : _this$drawingManagerD[drawingId];
919
+ return getOwn((_getOwn = getOwn(getOwn(this.drawingManagerData, unitId), subUnitId)) === null || _getOwn === void 0 ? void 0 : _getOwn.data, drawingId);
910
920
  }
911
921
  _getOldBySearch(searchParam) {
912
- var _this$_oldDrawingMana;
922
+ var _getOwn2;
913
923
  if (searchParam == null) return;
914
924
  const { unitId, subUnitId, drawingId } = searchParam;
915
- return (_this$_oldDrawingMana = this._oldDrawingManagerData[unitId]) === null || _this$_oldDrawingMana === void 0 || (_this$_oldDrawingMana = _this$_oldDrawingMana[subUnitId]) === null || _this$_oldDrawingMana === void 0 || (_this$_oldDrawingMana = _this$_oldDrawingMana.data) === null || _this$_oldDrawingMana === void 0 ? void 0 : _this$_oldDrawingMana[drawingId];
925
+ return getOwn((_getOwn2 = getOwn(getOwn(this._oldDrawingManagerData, unitId), subUnitId)) === null || _getOwn2 === void 0 ? void 0 : _getOwn2.data, drawingId);
916
926
  }
917
927
  _establishDrawingMap(unitId, subUnitId, drawingId) {
918
- var _this$drawingManagerD2;
919
- if (!this.drawingManagerData[unitId]) this.drawingManagerData[unitId] = {};
920
- if (!this.drawingManagerData[unitId][subUnitId]) this.drawingManagerData[unitId][subUnitId] = {
928
+ assertSafeDrawingKeys(unitId, subUnitId);
929
+ if (drawingId != null) assertSafeDrawingKeys(drawingId);
930
+ if (!getOwn(this.drawingManagerData, unitId)) this.drawingManagerData[unitId] = {};
931
+ if (!getOwn(this.drawingManagerData[unitId], subUnitId)) this.drawingManagerData[unitId][subUnitId] = {
921
932
  data: {},
922
933
  order: []
923
934
  };
924
935
  if (drawingId == null) return null;
925
- return (_this$drawingManagerD2 = this.drawingManagerData[unitId][subUnitId].data) === null || _this$drawingManagerD2 === void 0 ? void 0 : _this$drawingManagerD2[drawingId];
936
+ return getOwn(this.drawingManagerData[unitId][subUnitId].data, drawingId);
926
937
  }
927
938
  _addByParam(insertParam) {
928
939
  const { unitId, subUnitId, drawingId } = insertParam;
929
940
  this._establishDrawingMap(unitId, subUnitId, drawingId);
930
- const op = [ot_json1.insertOp([
941
+ const op = [_univerjs_core.JSON1.insertOp([
931
942
  unitId,
932
943
  subUnitId,
933
944
  "data",
934
945
  drawingId
935
- ], insertParam), ot_json1.insertOp([
946
+ ], insertParam), _univerjs_core.JSON1.insertOp([
936
947
  unitId,
937
948
  subUnitId,
938
949
  "order",
939
950
  this._getDrawingOrder(unitId, subUnitId).length
940
- ], drawingId)].reduce(ot_json1.type.compose, null);
951
+ ], drawingId)].reduce(_univerjs_core.JSON1.type.compose, null);
941
952
  return {
942
953
  op,
943
- invertOp: ot_json1.type.invertWithDoc(op, this.drawingManagerData)
954
+ invertOp: _univerjs_core.JSON1.type.invertWithDoc(op, this.drawingManagerData)
944
955
  };
945
956
  }
946
957
  _removeByParam(searchParam) {
@@ -953,20 +964,20 @@ var UnitDrawingService = class {
953
964
  op: [],
954
965
  invertOp: []
955
966
  };
956
- const op = [ot_json1.removeOp([
967
+ const op = [_univerjs_core.JSON1.removeOp([
957
968
  unitId,
958
969
  subUnitId,
959
970
  "data",
960
971
  drawingId
961
- ], true), ot_json1.removeOp([
972
+ ], true), _univerjs_core.JSON1.removeOp([
962
973
  unitId,
963
974
  subUnitId,
964
975
  "order",
965
976
  this._getDrawingOrder(unitId, subUnitId).indexOf(drawingId)
966
- ], true)].reduce(ot_json1.type.compose, null);
977
+ ], true)].reduce(_univerjs_core.JSON1.type.compose, null);
967
978
  return {
968
979
  op,
969
- invertOp: ot_json1.type.invertWithDoc(op, this.drawingManagerData)
980
+ invertOp: _univerjs_core.JSON1.type.invertWithDoc(op, this.drawingManagerData)
970
981
  };
971
982
  }
972
983
  _updateByParam(updateParam) {
@@ -981,10 +992,10 @@ var UnitDrawingService = class {
981
992
  op: [],
982
993
  invertOp: []
983
994
  };
984
- const op = ops.reduce(ot_json1.type.compose, null);
995
+ const op = ops.reduce(_univerjs_core.JSON1.type.compose, null);
985
996
  return {
986
997
  op,
987
- invertOp: ot_json1.type.invert(op)
998
+ invertOp: _univerjs_core.JSON1.type.invert(op)
988
999
  };
989
1000
  }
990
1001
  _getUpdateParamCompareOp(newParam, oldParam) {
@@ -1005,12 +1016,12 @@ var UnitDrawingService = class {
1005
1016
  return ops;
1006
1017
  }
1007
1018
  _getDrawingData(unitId, subUnitId) {
1008
- var _this$drawingManagerD3;
1009
- return ((_this$drawingManagerD3 = this.drawingManagerData[unitId]) === null || _this$drawingManagerD3 === void 0 || (_this$drawingManagerD3 = _this$drawingManagerD3[subUnitId]) === null || _this$drawingManagerD3 === void 0 ? void 0 : _this$drawingManagerD3.data) || {};
1019
+ var _getOwn3;
1020
+ return ((_getOwn3 = getOwn(getOwn(this.drawingManagerData, unitId), subUnitId)) === null || _getOwn3 === void 0 ? void 0 : _getOwn3.data) || {};
1010
1021
  }
1011
1022
  _getDrawingOrder(unitId, subUnitId) {
1012
- var _this$drawingManagerD4;
1013
- return ((_this$drawingManagerD4 = this.drawingManagerData[unitId]) === null || _this$drawingManagerD4 === void 0 || (_this$drawingManagerD4 = _this$drawingManagerD4[subUnitId]) === null || _this$drawingManagerD4 === void 0 ? void 0 : _this$drawingManagerD4.order) || [];
1023
+ var _getOwn4;
1024
+ return ((_getOwn4 = getOwn(getOwn(this.drawingManagerData, unitId), subUnitId)) === null || _getOwn4 === void 0 ? void 0 : _getOwn4.order) || [];
1014
1025
  }
1015
1026
  getDrawingVisible() {
1016
1027
  return this._visible;
@@ -1131,7 +1142,7 @@ var URLImageService = class extends _univerjs_core.Disposable {
1131
1142
  };
1132
1143
 
1133
1144
  //#endregion
1134
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
1145
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
1135
1146
  function __decorateParam(paramIndex, decorator) {
1136
1147
  return function(target, key) {
1137
1148
  decorator(target, key, paramIndex);
@@ -1139,7 +1150,7 @@ function __decorateParam(paramIndex, decorator) {
1139
1150
  }
1140
1151
 
1141
1152
  //#endregion
1142
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
1153
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
1143
1154
  function __decorate(decorators, target, key, desc) {
1144
1155
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1145
1156
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -1249,6 +1260,8 @@ const DRAWING_GROUPABLE_TYPES = [
1249
1260
  _univerjs_core.DrawingTypeEnum.DRAWING_IMAGE,
1250
1261
  _univerjs_core.DrawingTypeEnum.DRAWING_SHAPE,
1251
1262
  _univerjs_core.DrawingTypeEnum.DRAWING_CHART,
1263
+ _univerjs_core.DrawingTypeEnum.DRAWING_SLICER,
1264
+ _univerjs_core.DrawingTypeEnum.DRAWING_TIMELINE,
1252
1265
  _univerjs_core.DrawingTypeEnum.DRAWING_GROUP
1253
1266
  ];
1254
1267
  function isGroupableDrawingType(type) {