@univerjs/core 1.0.0-alpha.7 → 1.0.0-alpha.8

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 (34) hide show
  1. package/lib/cjs/facade.js +6 -138
  2. package/lib/cjs/index.js +272 -462
  3. package/lib/es/facade.js +8 -134
  4. package/lib/es/index.js +271 -459
  5. package/lib/facade.js +8 -134
  6. package/lib/index.js +271 -459
  7. package/lib/types/bases/index.d.ts +1 -1
  8. package/lib/types/bases/typedef.d.ts +23 -0
  9. package/lib/types/docs/data-model/paragraph-style.d.ts +7 -1
  10. package/lib/types/docs/data-model/rich-text-builder.d.ts +11 -1
  11. package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +1 -1
  12. package/lib/types/docs/data-model/text-x/utils.d.ts +1 -0
  13. package/lib/types/docs/data-model/types.d.ts +0 -2
  14. package/lib/types/facade/f-univer.d.ts +1 -22
  15. package/lib/types/facade/index.d.ts +0 -1
  16. package/lib/types/services/context/context.d.ts +0 -2
  17. package/lib/types/services/instance/instance.service.d.ts +0 -8
  18. package/lib/types/shared/common.d.ts +0 -5
  19. package/lib/types/shared/object-matrix.d.ts +0 -14
  20. package/lib/types/shared/rectangle.d.ts +0 -15
  21. package/lib/types/shared/tools.d.ts +0 -2
  22. package/lib/types/sheets/sheet-skeleton.d.ts +2 -6
  23. package/lib/types/sheets/typedef.d.ts +0 -14
  24. package/lib/types/sheets/workbook.d.ts +0 -2
  25. package/lib/types/sheets/worksheet.d.ts +0 -6
  26. package/lib/types/types/const/page-size.d.ts +2 -0
  27. package/lib/types/types/enum/theme-color-type.d.ts +0 -4
  28. package/lib/types/types/interfaces/i-cell-custom-render.d.ts +0 -2
  29. package/lib/types/types/interfaces/i-document-data.d.ts +93 -12
  30. package/lib/types/types/interfaces/i-style-data.d.ts +43 -0
  31. package/lib/umd/facade.js +1 -1
  32. package/lib/umd/index.js +21 -21
  33. package/package.json +4 -4
  34. package/lib/types/facade/f-hooks.d.ts +0 -74
package/lib/cjs/index.js CHANGED
@@ -152,7 +152,7 @@ function installShims() {
152
152
  }
153
153
 
154
154
  //#endregion
155
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
155
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
156
156
  function _typeof(o) {
157
157
  "@babel/helpers - typeof";
158
158
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -163,7 +163,7 @@ function _typeof(o) {
163
163
  }
164
164
 
165
165
  //#endregion
166
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
166
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
167
167
  function toPrimitive(t, r) {
168
168
  if ("object" != _typeof(t) || !t) return t;
169
169
  var e = t[Symbol.toPrimitive];
@@ -176,14 +176,14 @@ function toPrimitive(t, r) {
176
176
  }
177
177
 
178
178
  //#endregion
179
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
179
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
180
180
  function toPropertyKey(t) {
181
181
  var i = toPrimitive(t, "string");
182
182
  return "symbol" == _typeof(i) ? i : i + "";
183
183
  }
184
184
 
185
185
  //#endregion
186
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
186
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
187
187
  function _defineProperty(e, r, t) {
188
188
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
189
189
  value: t,
@@ -712,76 +712,6 @@ var Tools = class Tools {
712
712
  if (isIE11) return "IE11";
713
713
  return "Unknown browser";
714
714
  }
715
- /** @deprecated This method is deprecated, please use `import { merge } from '@univerjs/core` instead */
716
- static deepMerge(target, ...sources) {
717
- sources.forEach((item) => item && deepItem(item));
718
- function isDangerousKey(key) {
719
- return key === "__proto__" || key === "constructor" || key === "prototype";
720
- }
721
- function deepArray(array, to) {
722
- array.forEach((value, key) => {
723
- if (typeof key === "string" && isDangerousKey(key)) return;
724
- if (Tools.isArray(value)) {
725
- var _to$key;
726
- const origin = (_to$key = to[key]) !== null && _to$key !== void 0 ? _to$key : [];
727
- to[key] = origin;
728
- deepArray(value, origin);
729
- return;
730
- }
731
- if (Tools.isObject(value)) {
732
- var _to$key2;
733
- const origin = (_to$key2 = to[key]) !== null && _to$key2 !== void 0 ? _to$key2 : {};
734
- to[key] = origin;
735
- deepObject(value, origin);
736
- return;
737
- }
738
- to[key] = value;
739
- });
740
- }
741
- function deepObject(object, to) {
742
- Object.keys(object).forEach((key) => {
743
- if (isDangerousKey(key)) return;
744
- const value = object[key];
745
- if (Tools.isObject(value)) {
746
- var _to$key3;
747
- const origin = (_to$key3 = to[key]) !== null && _to$key3 !== void 0 ? _to$key3 : {};
748
- to[key] = origin;
749
- deepObject(value, origin);
750
- return;
751
- }
752
- if (Tools.isArray(value)) {
753
- var _to$key4;
754
- const origin = (_to$key4 = to[key]) !== null && _to$key4 !== void 0 ? _to$key4 : [];
755
- to[key] = origin;
756
- deepArray(value, origin);
757
- return;
758
- }
759
- to[key] = value;
760
- });
761
- }
762
- function deepItem(item) {
763
- Object.keys(item).forEach((key) => {
764
- if (isDangerousKey(key)) return;
765
- const value = item[key];
766
- if (Tools.isArray(value)) {
767
- var _target$key;
768
- const origin = (_target$key = target[key]) !== null && _target$key !== void 0 ? _target$key : [];
769
- target[key] = origin;
770
- deepArray(value, origin);
771
- return;
772
- }
773
- if (Tools.isObject(value)) {
774
- var _target$key2;
775
- const origin = (_target$key2 = target[key]) !== null && _target$key2 !== void 0 ? _target$key2 : {};
776
- target[key] = origin;
777
- deepObject(value, origin);
778
- return;
779
- }
780
- target[key] = value;
781
- });
782
- }
783
- return target;
784
- }
785
715
  static diffValue(one, two) {
786
716
  return isValueEqual(one, two);
787
717
  }
@@ -1681,8 +1611,6 @@ let CellValueType = /* @__PURE__ */ function(CellValueType) {
1681
1611
  */
1682
1612
  /**
1683
1613
  * Theme color type enum
1684
- *
1685
- * @deprecated
1686
1614
  */
1687
1615
  let ThemeColorType = /* @__PURE__ */ function(ThemeColorType) {
1688
1616
  /**
@@ -1710,8 +1638,6 @@ let ThemeColorType = /* @__PURE__ */ function(ThemeColorType) {
1710
1638
  }({});
1711
1639
  /**
1712
1640
  * Preset theme names.
1713
- *
1714
- * @deprecated
1715
1641
  */
1716
1642
  let ThemeColors = /* @__PURE__ */ function(ThemeColors) {
1717
1643
  ThemeColors["OFFICE"] = "Office";
@@ -1743,7 +1669,7 @@ let ThemeColors = /* @__PURE__ */ function(ThemeColors) {
1743
1669
  //#endregion
1744
1670
  //#region package.json
1745
1671
  var name = "@univerjs/core";
1746
- var version = "1.0.0-alpha.7";
1672
+ var version = "1.0.0-alpha.8";
1747
1673
 
1748
1674
  //#endregion
1749
1675
  //#region src/common/array.ts
@@ -2091,7 +2017,7 @@ function hashLogContent(...args) {
2091
2017
  }
2092
2018
 
2093
2019
  //#endregion
2094
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
2020
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
2095
2021
  function __decorateParam(paramIndex, decorator) {
2096
2022
  return function(target, key) {
2097
2023
  decorator(target, key, paramIndex);
@@ -2099,7 +2025,7 @@ function __decorateParam(paramIndex, decorator) {
2099
2025
  }
2100
2026
 
2101
2027
  //#endregion
2102
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
2028
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
2103
2029
  function __decorate(decorators, target, key, desc) {
2104
2030
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2105
2031
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -3402,12 +3328,13 @@ var ColorKit = class ColorKit {
3402
3328
  const rgb2 = new ColorKit(color2).toRgb();
3403
3329
  const alpha1 = (_rgb1$a = rgb1.a) !== null && _rgb1$a !== void 0 ? _rgb1$a : 1;
3404
3330
  const alpha2 = (_rgb2$a = rgb2.a) !== null && _rgb2$a !== void 0 ? _rgb2$a : 1;
3405
- return new ColorKit({
3331
+ const rgba = {
3406
3332
  r: (rgb2.r - rgb1.r) * amount + rgb1.r,
3407
3333
  g: (rgb2.g - rgb1.g) * amount + rgb1.g,
3408
3334
  b: (rgb2.b - rgb1.b) * amount + rgb1.b,
3409
3335
  a: (alpha2 - alpha1) * amount + alpha1
3410
- });
3336
+ };
3337
+ return new ColorKit(rgba);
3411
3338
  }
3412
3339
  static getContrastRatio(foreground, background) {
3413
3340
  const lumA = new ColorKit(foreground).getLuminance();
@@ -3903,57 +3830,6 @@ let DOC_RANGE_TYPE = /* @__PURE__ */ function(DOC_RANGE_TYPE) {
3903
3830
  DOC_RANGE_TYPE["TEXT"] = "TEXT";
3904
3831
  return DOC_RANGE_TYPE;
3905
3832
  }({});
3906
- /**
3907
- * Determines whether the cell(row, column) is within the range of the merged cells.
3908
- * @deprecated please use worksheet.getCellInfoInMergeData instead
3909
- */
3910
- function getCellInfoInMergeData(row, column, mergeData) {
3911
- let isMerged = false;
3912
- let isMergedMainCell = false;
3913
- let newEndRow = row;
3914
- let newEndColumn = column;
3915
- let mergeRow = row;
3916
- let mergeColumn = column;
3917
- if (mergeData == null) return {
3918
- actualRow: row,
3919
- actualColumn: column,
3920
- isMergedMainCell,
3921
- isMerged,
3922
- endRow: newEndRow,
3923
- endColumn: newEndColumn,
3924
- startRow: mergeRow,
3925
- startColumn: mergeColumn
3926
- };
3927
- for (let i = 0; i < mergeData.length; i++) {
3928
- const { startRow: startRowMarge, endRow: endRowMarge, startColumn: startColumnMarge, endColumn: endColumnMarge } = mergeData[i];
3929
- if (row === startRowMarge && column === startColumnMarge) {
3930
- newEndRow = endRowMarge;
3931
- newEndColumn = endColumnMarge;
3932
- mergeRow = startRowMarge;
3933
- mergeColumn = startColumnMarge;
3934
- isMergedMainCell = true;
3935
- break;
3936
- }
3937
- if (row >= startRowMarge && row <= endRowMarge && column >= startColumnMarge && column <= endColumnMarge) {
3938
- newEndRow = endRowMarge;
3939
- newEndColumn = endColumnMarge;
3940
- mergeRow = startRowMarge;
3941
- mergeColumn = startColumnMarge;
3942
- isMerged = true;
3943
- break;
3944
- }
3945
- }
3946
- return {
3947
- actualRow: row,
3948
- actualColumn: column,
3949
- isMergedMainCell,
3950
- isMerged,
3951
- endRow: newEndRow,
3952
- endColumn: newEndColumn,
3953
- startRow: mergeRow,
3954
- startColumn: mergeColumn
3955
- };
3956
- }
3957
3833
  let CellModeEnum = /* @__PURE__ */ function(CellModeEnum) {
3958
3834
  CellModeEnum["Raw"] = "raw";
3959
3835
  CellModeEnum["Intercepted"] = "intercepted";
@@ -8041,24 +7917,15 @@ var ObjectMatrix = class ObjectMatrix {
8041
7917
  const objectArray = this.getRowOrCreate(row);
8042
7918
  objectArray[column] = value;
8043
7919
  }
8044
- /**
8045
- * !!
8046
- * Please +1 ‘!’, who fell into this pit.
8047
- * @deprecated use `realDelete` or `splice`
8048
- */
8049
- deleteValue(row, column) {
7920
+ realDeleteValue(row, column) {
8050
7921
  var _this$_matrix2;
8051
7922
  (_this$_matrix2 = this._matrix) === null || _this$_matrix2 === void 0 || (_this$_matrix2 = _this$_matrix2[row]) === null || _this$_matrix2 === void 0 || delete _this$_matrix2[column];
8052
- }
8053
- realDeleteValue(row, column) {
8054
- var _this$_matrix3;
8055
- (_this$_matrix3 = this._matrix) === null || _this$_matrix3 === void 0 || (_this$_matrix3 = _this$_matrix3[row]) === null || _this$_matrix3 === void 0 || delete _this$_matrix3[column];
8056
7923
  if (this.getRow(row)) {
8057
7924
  const objectArray = this.getRow(row);
8058
7925
  if (objectArray == null) return;
8059
7926
  if (Object.keys(objectArray).length === 0) {
8060
- var _this$_matrix4;
8061
- (_this$_matrix4 = this._matrix) === null || _this$_matrix4 === void 0 || delete _this$_matrix4[row];
7927
+ var _this$_matrix3;
7928
+ (_this$_matrix3 = this._matrix) === null || _this$_matrix3 === void 0 || delete _this$_matrix3[row];
8062
7929
  }
8063
7930
  }
8064
7931
  }
@@ -8257,23 +8124,10 @@ var ObjectMatrix = class ObjectMatrix {
8257
8124
  });
8258
8125
  return array;
8259
8126
  }
8260
- /**
8261
- * @deprecated Use getMatrix as a substitute.
8262
- */
8263
- toJSON() {
8264
- return this._matrix;
8265
- }
8266
8127
  clone() {
8267
8128
  const json = JSON.stringify(this._matrix);
8268
8129
  return JSON.parse(json);
8269
8130
  }
8270
- /**
8271
- * @deprecated Use clone as a substitute.
8272
- */
8273
- getData() {
8274
- const json = JSON.stringify(this._matrix);
8275
- return JSON.parse(json);
8276
- }
8277
8131
  getArrayData() {
8278
8132
  let startRow = 0;
8279
8133
  let startColumn = 0;
@@ -8295,7 +8149,7 @@ var ObjectMatrix = class ObjectMatrix {
8295
8149
  objectMatrix.setValue(rowIndex - startRow, columnIndex - startColumn, value);
8296
8150
  });
8297
8151
  });
8298
- return objectMatrix.getData();
8152
+ return objectMatrix.clone();
8299
8153
  }
8300
8154
  /**
8301
8155
  * the function can only be used in all the row and column are positive integer
@@ -8441,10 +8295,6 @@ function convertCellToRange(cellInfo) {
8441
8295
  endX
8442
8296
  };
8443
8297
  }
8444
- /**
8445
- * @deprecated use `convertCellToRange` instead
8446
- */
8447
- const makeCellToSelection = convertCellToRange;
8448
8298
  function makeCellRangeToRangeData(cellInfo) {
8449
8299
  if (!cellInfo) return;
8450
8300
  const { actualRow, actualColumn, isMerged, isMergedMainCell, startRow: mergeStartRow, startColumn: mergeStartColumn, endRow: mergeEndRow, endColumn: mergeEndColumn } = cellInfo;
@@ -9328,7 +9178,10 @@ function mergeLocales(...locales) {
9328
9178
 
9329
9179
  //#endregion
9330
9180
  //#region src/shared/lru/lru-map.ts
9331
- let _Symbol$iterator, _Symbol$iterator2, _Symbol$iterator3, _Symbol$iterator4;
9181
+ let _Symbol$iterator;
9182
+ let _Symbol$iterator2;
9183
+ let _Symbol$iterator3;
9184
+ let _Symbol$iterator4;
9332
9185
  const NEWER = Symbol("newer");
9333
9186
  const OLDER = Symbol("older");
9334
9187
  _Symbol$iterator = Symbol.iterator;
@@ -9833,6 +9686,11 @@ let CustomRangeType = /* @__PURE__ */ function(CustomRangeType) {
9833
9686
  CustomRangeType[CustomRangeType["DELTED"] = 9999] = "DELTED";
9834
9687
  return CustomRangeType;
9835
9688
  }({});
9689
+ let DocxBreakType = /* @__PURE__ */ function(DocxBreakType) {
9690
+ DocxBreakType["COLUMN"] = "column";
9691
+ DocxBreakType["TEXT_WRAPPING"] = "textWrapping";
9692
+ return DocxBreakType;
9693
+ }({});
9836
9694
  let CustomDecorationType = /* @__PURE__ */ function(CustomDecorationType) {
9837
9695
  CustomDecorationType[CustomDecorationType["COMMENT"] = 0] = "COMMENT";
9838
9696
  CustomDecorationType[CustomDecorationType["DELETED"] = 9999] = "DELETED";
@@ -9865,9 +9723,10 @@ let GridType = /* @__PURE__ */ function(GridType) {
9865
9723
  let SectionType = /* @__PURE__ */ function(SectionType) {
9866
9724
  SectionType[SectionType["SECTION_TYPE_UNSPECIFIED"] = 0] = "SECTION_TYPE_UNSPECIFIED";
9867
9725
  SectionType[SectionType["CONTINUOUS"] = 1] = "CONTINUOUS";
9868
- SectionType[SectionType["NEXT_PAGE"] = 2] = "NEXT_PAGE";
9869
- SectionType[SectionType["EVEN_PAGE"] = 3] = "EVEN_PAGE";
9870
- SectionType[SectionType["ODD_PAGE"] = 4] = "ODD_PAGE";
9726
+ SectionType[SectionType["NEXT_COLUMN"] = 2] = "NEXT_COLUMN";
9727
+ SectionType[SectionType["NEXT_PAGE"] = 3] = "NEXT_PAGE";
9728
+ SectionType[SectionType["EVEN_PAGE"] = 4] = "EVEN_PAGE";
9729
+ SectionType[SectionType["ODD_PAGE"] = 5] = "ODD_PAGE";
9871
9730
  return SectionType;
9872
9731
  }({});
9873
9732
  /**
@@ -9912,15 +9771,25 @@ let WrapTextType = /* @__PURE__ */ function(WrapTextType) {
9912
9771
  return WrapTextType;
9913
9772
  }({});
9914
9773
  /**
9915
- * The possible layouts of a [PositionedObject]
9774
+ * Controls how a positioned object participates in document text layout.
9775
+ *
9776
+ * `WRAP_NONE` does not by itself determine whether the object is in front of or behind text. Drawing data uses
9777
+ * `behindDoc` for that stacking choice.
9916
9778
  */
9917
9779
  let PositionedObjectLayoutType = /* @__PURE__ */ function(PositionedObjectLayoutType) {
9780
+ /** Places the object in the text flow like a character and lets it affect the containing line's metrics. */
9918
9781
  PositionedObjectLayoutType[PositionedObjectLayoutType["INLINE"] = 0] = "INLINE";
9782
+ /** Floats the object without reflowing text. The object and text can overlap. */
9919
9783
  PositionedObjectLayoutType[PositionedObjectLayoutType["WRAP_NONE"] = 1] = "WRAP_NONE";
9784
+ /** Floats the object and wraps text around the custom polygon defined by its wrap path. */
9920
9785
  PositionedObjectLayoutType[PositionedObjectLayoutType["WRAP_POLYGON"] = 2] = "WRAP_POLYGON";
9786
+ /** Floats the object and wraps text around its rectangular bounds. */
9921
9787
  PositionedObjectLayoutType[PositionedObjectLayoutType["WRAP_SQUARE"] = 3] = "WRAP_SQUARE";
9788
+ /** Floats the object and allows text to flow through eligible open regions in its wrap contour. */
9922
9789
  PositionedObjectLayoutType[PositionedObjectLayoutType["WRAP_THROUGH"] = 4] = "WRAP_THROUGH";
9790
+ /** Floats the object and wraps text closely around its contour instead of its rectangular bounds. */
9923
9791
  PositionedObjectLayoutType[PositionedObjectLayoutType["WRAP_TIGHT"] = 5] = "WRAP_TIGHT";
9792
+ /** Floats the object in a horizontal band, leaving text only above and below it. */
9924
9793
  PositionedObjectLayoutType[PositionedObjectLayoutType["WRAP_TOP_AND_BOTTOM"] = 6] = "WRAP_TOP_AND_BOTTOM";
9925
9794
  return PositionedObjectLayoutType;
9926
9795
  }({});
@@ -10558,6 +10427,8 @@ const MODERN_DOCUMENT_WIDTH = {
10558
10427
  ["wide"]: PAGE_SIZE["A3"].width
10559
10428
  };
10560
10429
  const MODERN_DOCUMENT_DEFAULT_MARGIN = 50 / .75;
10430
+ /** Default margin for a paginated Traditional document, in 96-DPI layout pixels. */
10431
+ const TRADITIONAL_DOCUMENT_DEFAULT_MARGIN = 72;
10561
10432
 
10562
10433
  //#endregion
10563
10434
  //#region src/sheets/range.ts
@@ -10746,7 +10617,7 @@ var Range = class Range {
10746
10617
  */
10747
10618
  getObjectValues(options = {}) {
10748
10619
  const { startRow, endRow, startColumn, endColumn } = this._range;
10749
- const values = this._worksheet.getCellMatrix().getFragment(startRow, endRow, startColumn, endColumn).getData();
10620
+ const values = this._worksheet.getCellMatrix().getFragment(startRow, endRow, startColumn, endColumn).clone();
10750
10621
  if (options.isIncludeStyle) {
10751
10622
  const style = this._deps.getStyles();
10752
10623
  for (let r = 0; r <= endRow - startRow; r++) for (let c = 0; c <= endColumn - startColumn; c++) {
@@ -11502,52 +11373,6 @@ var Rectangle = class Rectangle {
11502
11373
  }).length > 0);
11503
11374
  }
11504
11375
  /**
11505
- * Gets the intersection range between two ranges
11506
- * @param src
11507
- * @param target
11508
- * @deprecated use `getIntersectRange` instead
11509
- * @example
11510
- * ```typescript
11511
- * const range1 = { startRow: 0, startColumn: 0, endRow: 2, endColumn: 2 };
11512
- * const range2 = { startRow: 1, startColumn: 1, endRow: 3, endColumn: 3 };
11513
- * const intersection = Rectangle.getIntersects(range1, range2);
11514
- * // intersection = { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 }
11515
- * ```
11516
- */
11517
- static getIntersects(src, target) {
11518
- const currentStartRow = src.startRow;
11519
- const currentEndRow = src.endRow;
11520
- const currentStartColumn = src.startColumn;
11521
- const currentEndColumn = src.endColumn;
11522
- const incomingStartRow = target.startRow;
11523
- const incomingEndRow = target.endRow;
11524
- const incomingStartColumn = target.startColumn;
11525
- const incomingEndColumn = target.endColumn;
11526
- let startColumn;
11527
- let startRow;
11528
- let endColumn;
11529
- let endRow;
11530
- if (incomingStartRow <= currentEndRow) if (incomingStartRow >= currentStartRow) startRow = incomingStartRow;
11531
- else startRow = currentStartRow;
11532
- else return null;
11533
- if (incomingEndRow >= currentStartRow) if (incomingEndRow >= currentEndRow) endRow = currentEndRow;
11534
- else endRow = incomingEndRow;
11535
- else return null;
11536
- if (incomingStartColumn <= currentEndColumn) if (incomingStartColumn > currentStartColumn) startColumn = incomingStartColumn;
11537
- else startColumn = currentStartColumn;
11538
- else return null;
11539
- if (incomingEndColumn >= currentStartColumn) if (incomingEndColumn >= currentEndColumn) endColumn = currentEndColumn;
11540
- else endColumn = incomingEndColumn;
11541
- else return null;
11542
- return {
11543
- startRow,
11544
- endRow,
11545
- startColumn,
11546
- endColumn,
11547
- rangeType: 0
11548
- };
11549
- }
11550
- /**
11551
11376
  * Checks if one range completely contains another range
11552
11377
  * @param src
11553
11378
  * @param target
@@ -12996,7 +12821,8 @@ const blackLuminance = getLuminance(black.r, black.g, black.b);
12996
12821
  * @returns The inverted color.
12997
12822
  */
12998
12823
  function invertNormalizedColorByHSL(color) {
12999
- const originalContrast = getContrastRatio(whiteLuminance, getLuminance(color[0], color[1], color[2]));
12824
+ const originalLuminance = getLuminance(color[0], color[1], color[2]);
12825
+ const originalContrast = getContrastRatio(whiteLuminance, originalLuminance);
13000
12826
  const hsl = rgbToHsl(color);
13001
12827
  let l = 1 - hsl[2];
13002
12828
  let newColor, newLuminance, newContrast;
@@ -13479,10 +13305,6 @@ let DataStreamTreeTokenType = /* @__PURE__ */ function(DataStreamTreeTokenType)
13479
13305
  DataStreamTreeTokenType["SPACE"] = " ";
13480
13306
  return DataStreamTreeTokenType;
13481
13307
  }({});
13482
- /** Wrap your stream in a pair of custom range tokens. */
13483
- function makeCustomRangeStream(stream) {
13484
- return `${stream}`;
13485
- }
13486
13308
 
13487
13309
  //#endregion
13488
13310
  //#region src/docs/data-model/text-x/build-utils/range-interval.ts
@@ -15828,7 +15650,7 @@ function composeBody(thisBody, otherBody, coverType = 0) {
15828
15650
  const { startIndex: thisStart } = thisParagraph;
15829
15651
  const { startIndex: otherStart } = otherParagraph;
15830
15652
  if (thisStart === otherStart) {
15831
- paragraphs.push(Tools.deepMerge(thisParagraph, otherParagraph));
15653
+ paragraphs.push((0, lodash_es.merge)(thisParagraph, otherParagraph));
15832
15654
  thisIndex++;
15833
15655
  otherIndex++;
15834
15656
  } else if (thisStart < otherStart) {
@@ -16271,7 +16093,7 @@ function transformBlockRanges(thisBlockRanges, otherBlockRanges, priority) {
16271
16093
  if (!otherBlockRanges.length) return [];
16272
16094
  return otherBlockRanges.map((otherBlockRange) => {
16273
16095
  const thisBlockRange = thisBlockRanges.find((blockRange) => blockRange.blockId === otherBlockRange.blockId);
16274
- return thisBlockRange && priority ? Tools.deepMerge(otherBlockRange, thisBlockRange) : otherBlockRange;
16096
+ return thisBlockRange && priority ? (0, lodash_es.merge)(otherBlockRange, thisBlockRange) : otherBlockRange;
16275
16097
  });
16276
16098
  }
16277
16099
 
@@ -16914,16 +16736,37 @@ var DocumentDataModel = class DocumentDataModel extends DocumentDataModelSimple
16914
16736
  //#region src/docs/data-model/paragraph-style.ts
16915
16737
  function _definedStyle(style) {
16916
16738
  if (style == null) return {};
16917
- return Object.fromEntries(Object.entries(style).filter(([, value]) => value != null));
16739
+ const definedStyle = Tools.deepClone(style);
16740
+ Tools.removeNull(definedStyle);
16741
+ return definedStyle;
16742
+ }
16743
+ function _resolveNamedParagraphStyle(styles, styleId) {
16744
+ if (!styles || !styleId) return {};
16745
+ const visiting = /* @__PURE__ */ new Set();
16746
+ const resolve = (currentStyleId) => {
16747
+ if (visiting.has(currentStyleId)) return {};
16748
+ const style = styles[currentStyleId];
16749
+ if (!style || style.type !== 1) return {};
16750
+ visiting.add(currentStyleId);
16751
+ const base = style.basedOn ? resolve(style.basedOn) : {};
16752
+ visiting.delete(currentStyleId);
16753
+ return {
16754
+ ...base,
16755
+ ..._definedStyle(style.paragraphStyle)
16756
+ };
16757
+ };
16758
+ return resolve(styleId);
16918
16759
  }
16919
16760
  function resolveDocumentParagraphStyle(documentStyle, paragraphStyle, options = {}) {
16920
- var _options$useLegacyMod;
16761
+ var _options$useLegacyMod, _definedParagraphStyl;
16762
+ const legacyStyle = ((_options$useLegacyMod = options.useLegacyModernDefaults) !== null && _options$useLegacyMod !== void 0 ? _options$useLegacyMod : (documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.documentFlavor) === 2) ? {
16763
+ lineSpacing: DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING,
16764
+ spaceAbove: { v: 0 },
16765
+ spaceBelow: { v: 12 }
16766
+ } : {};
16921
16767
  const documentDefaults = {
16922
- ...((_options$useLegacyMod = options.useLegacyModernDefaults) !== null && _options$useLegacyMod !== void 0 ? _options$useLegacyMod : (documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.documentFlavor) === 2) ? {
16923
- lineSpacing: DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING,
16924
- spaceAbove: { v: 0 },
16925
- spaceBelow: { v: 12 }
16926
- } : {},
16768
+ ...(documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.documentFlavor) === 1 ? { widowControl: 1 } : {},
16769
+ ...legacyStyle,
16927
16770
  ..._definedStyle(documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.defaultParagraphStyle)
16928
16771
  };
16929
16772
  if (options.excludeDocumentOuterSpacing) {
@@ -16931,10 +16774,13 @@ function resolveDocumentParagraphStyle(documentStyle, paragraphStyle, options =
16931
16774
  delete documentDefaults.spaceBelow;
16932
16775
  }
16933
16776
  const definedParagraphStyle = _definedStyle(paragraphStyle);
16934
- const namedStyle = definedParagraphStyle.namedStyleType == null ? null : NAMED_STYLE_SPACE_MAP[definedParagraphStyle.namedStyleType];
16777
+ const referencedParagraphStyle = _resolveNamedParagraphStyle(options.styles, options.paragraphStyleId);
16778
+ const namedStyleType = (_definedParagraphStyl = definedParagraphStyle.namedStyleType) !== null && _definedParagraphStyl !== void 0 ? _definedParagraphStyl : referencedParagraphStyle.namedStyleType;
16779
+ const namedStyle = namedStyleType == null ? null : NAMED_STYLE_SPACE_MAP[namedStyleType];
16935
16780
  return Tools.deepClone({
16936
16781
  ...documentDefaults,
16937
16782
  ...namedStyle,
16783
+ ...referencedParagraphStyle,
16938
16784
  ...definedParagraphStyle
16939
16785
  });
16940
16786
  }
@@ -21046,8 +20892,6 @@ const FOCUSING_SHEET = "FOCUSING_SHEET";
21046
20892
  const FOCUSING_DOC = "FOCUSING_DOC";
21047
20893
  const FOCUSING_SLIDE = "FOCUSING_SLIDE";
21048
20894
  const FOCUSING_BOARD = "FOCUSING_BOARD";
21049
- /** @deprecated */
21050
- const FOCUSING_EDITOR_BUT_HIDDEN = "FOCUSING_EDITOR_BUT_HIDDEN";
21051
20895
  const EDITOR_ACTIVATED = "EDITOR_ACTIVATED";
21052
20896
  const FOCUSING_EDITOR_INPUT_FORMULA = "FOCUSING_EDITOR_INPUT_FORMULA";
21053
20897
  /** The focusing state of the formula editor (Fx bar). */
@@ -21440,198 +21284,6 @@ function convertTextRotation(textRotation) {
21440
21284
  };
21441
21285
  }
21442
21286
 
21443
- //#endregion
21444
- //#region src/sheets/clone.ts
21445
- /**
21446
- * Fast clone for primitive values and simple objects.
21447
- * Avoids type checking overhead when we know the structure.
21448
- */
21449
- function cloneValue(value) {
21450
- if (value === null || value === void 0) return value;
21451
- if (typeof value !== "object") return value;
21452
- if (Array.isArray(value)) {
21453
- const len = value.length;
21454
- const result = new Array(len);
21455
- for (let i = 0; i < len; i++) result[i] = cloneValue(value[i]);
21456
- return result;
21457
- }
21458
- const result = {};
21459
- const keys = Object.keys(value);
21460
- for (let i = 0, len = keys.length; i < len; i++) {
21461
- const key = keys[i];
21462
- result[key] = cloneValue(value[key]);
21463
- }
21464
- return result;
21465
- }
21466
- /**
21467
- * Fast clone for ICellData. Optimized for the known structure.
21468
- * @param cell - The cell data to clone
21469
- * @returns A deep clone of the cell data
21470
- */
21471
- function cloneCellData(cell) {
21472
- if (cell === null || cell === void 0) return cell;
21473
- const result = {};
21474
- if (cell.p !== void 0) result.p = cell.p === null ? null : cloneValue(cell.p);
21475
- if (cell.s !== void 0) if (cell.s === null || typeof cell.s === "string") result.s = cell.s;
21476
- else result.s = cloneValue(cell.s);
21477
- if (cell.v !== void 0) result.v = cell.v;
21478
- if (cell.t !== void 0) result.t = cell.t;
21479
- if (cell.f !== void 0) result.f = cell.f;
21480
- if (cell.ref !== void 0) result.ref = cell.ref;
21481
- if (cell.xf !== void 0) result.xf = cell.xf;
21482
- if (cell.si !== void 0) result.si = cell.si;
21483
- if (cell.custom !== void 0) result.custom = cell.custom === null ? null : cloneValue(cell.custom);
21484
- return result;
21485
- }
21486
- /**
21487
- * Fast clone for ICellDataWithSpanAndDisplay. Optimized for the known structure.
21488
- * This extends cloneCellData with additional span and display properties.
21489
- * @param cell - The cell data with span and display info to clone
21490
- * @returns A deep clone of the cell data
21491
- */
21492
- function cloneCellDataWithSpanAndDisplay(cell) {
21493
- if (cell === null || cell === void 0) return cell;
21494
- const result = {};
21495
- if (cell.p !== void 0) result.p = cell.p === null ? null : cloneValue(cell.p);
21496
- if (cell.s !== void 0) if (cell.s === null || typeof cell.s === "string") result.s = cell.s;
21497
- else result.s = cloneValue(cell.s);
21498
- if (cell.v !== void 0) result.v = cell.v;
21499
- if (cell.t !== void 0) result.t = cell.t;
21500
- if (cell.f !== void 0) result.f = cell.f;
21501
- if (cell.ref !== void 0) result.ref = cell.ref;
21502
- if (cell.xf !== void 0) result.xf = cell.xf;
21503
- if (cell.si !== void 0) result.si = cell.si;
21504
- if (cell.custom !== void 0) result.custom = cell.custom === null ? null : cloneValue(cell.custom);
21505
- if (cell.rowSpan !== void 0) result.rowSpan = cell.rowSpan;
21506
- if (cell.colSpan !== void 0) result.colSpan = cell.colSpan;
21507
- if (cell.displayV !== void 0) result.displayV = cell.displayV;
21508
- return result;
21509
- }
21510
- /**
21511
- * Fast clone for cell data matrix. Optimized for sparse matrix structure.
21512
- * @param cellData - The cell data matrix to clone
21513
- * @returns A deep clone of the cell data matrix
21514
- */
21515
- function cloneCellDataMatrix(cellData) {
21516
- const result = {};
21517
- const rowKeys = Object.keys(cellData);
21518
- for (let i = 0, rowLen = rowKeys.length; i < rowLen; i++) {
21519
- const rowKey = rowKeys[i];
21520
- const rowNum = Number(rowKey);
21521
- const rowData = cellData[rowNum];
21522
- if (rowData === void 0) continue;
21523
- const clonedRow = {};
21524
- const colKeys = Object.keys(rowData);
21525
- for (let j = 0, colLen = colKeys.length; j < colLen; j++) {
21526
- const colKey = colKeys[j];
21527
- const colNum = Number(colKey);
21528
- const cell = rowData[colNum];
21529
- if (cell !== void 0 && cell !== null) clonedRow[colNum] = cloneCellData(cell);
21530
- }
21531
- result[rowNum] = clonedRow;
21532
- }
21533
- return result;
21534
- }
21535
- /**
21536
- * Fast clone for row/column data arrays (sparse arrays stored as objects).
21537
- * @param data - The row or column data to clone
21538
- * @returns A deep clone of the row or column data
21539
- */
21540
- function cloneRowColumnData(data) {
21541
- const result = {};
21542
- const keys = Object.keys(data);
21543
- for (let i = 0, len = keys.length; i < len; i++) {
21544
- const key = keys[i];
21545
- const idx = Number(key);
21546
- const item = data[idx];
21547
- if (item === void 0) continue;
21548
- const cloned = {};
21549
- if ("h" in item && item.h !== void 0) cloned.h = item.h;
21550
- if ("ia" in item && item.ia !== void 0) cloned.ia = item.ia;
21551
- if ("ah" in item && item.ah !== void 0) cloned.ah = item.ah;
21552
- if ("hd" in item && item.hd !== void 0) cloned.hd = item.hd;
21553
- if ("w" in item && item.w !== void 0) cloned.w = item.w;
21554
- if ("s" in item && item.s !== void 0) if (item.s === null || typeof item.s === "string") cloned.s = item.s;
21555
- else cloned.s = cloneValue(item.s);
21556
- if ("custom" in item && item.custom !== void 0) cloned.custom = item.custom === null ? null : cloneValue(item.custom);
21557
- result[idx] = cloned;
21558
- }
21559
- return result;
21560
- }
21561
- /**
21562
- * Fast clone for IRange array (merge data).
21563
- * @param ranges - The array of ranges to clone
21564
- * @returns A shallow clone of the ranges (IRange contains only primitive values)
21565
- */
21566
- function cloneMergeData(ranges) {
21567
- const len = ranges.length;
21568
- const result = new Array(len);
21569
- for (let i = 0; i < len; i++) {
21570
- const range = ranges[i];
21571
- result[i] = {
21572
- startRow: range.startRow,
21573
- startColumn: range.startColumn,
21574
- endRow: range.endRow,
21575
- endColumn: range.endColumn,
21576
- rangeType: range.rangeType,
21577
- startAbsoluteRefType: range.startAbsoluteRefType,
21578
- endAbsoluteRefType: range.endAbsoluteRefType
21579
- };
21580
- }
21581
- return result;
21582
- }
21583
- /**
21584
- * Optimized deep clone specifically for IWorksheetData.
21585
- * This is significantly faster than generic deepClone because:
21586
- * 1. No recursive type checking - we know the structure
21587
- * 2. Direct property access instead of Object.keys iteration for known properties
21588
- * 3. Specialized handlers for cellData matrix (the largest data)
21589
- * 4. Primitive values copied directly without cloning
21590
- *
21591
- * @param worksheet - The worksheet data to clone
21592
- * @returns A deep clone of the worksheet data
21593
- */
21594
- function cloneWorksheetData(worksheet) {
21595
- const result = {
21596
- id: worksheet.id,
21597
- name: worksheet.name,
21598
- tabColor: worksheet.tabColor,
21599
- hidden: worksheet.hidden,
21600
- rowCount: worksheet.rowCount,
21601
- columnCount: worksheet.columnCount,
21602
- zoomRatio: worksheet.zoomRatio,
21603
- scrollTop: worksheet.scrollTop,
21604
- scrollLeft: worksheet.scrollLeft,
21605
- defaultColumnWidth: worksheet.defaultColumnWidth,
21606
- defaultRowHeight: worksheet.defaultRowHeight,
21607
- showGridlines: worksheet.showGridlines,
21608
- rightToLeft: worksheet.rightToLeft,
21609
- freeze: {
21610
- xSplit: worksheet.freeze.xSplit,
21611
- ySplit: worksheet.freeze.ySplit,
21612
- startRow: worksheet.freeze.startRow,
21613
- startColumn: worksheet.freeze.startColumn
21614
- },
21615
- rowHeader: {
21616
- width: worksheet.rowHeader.width,
21617
- hidden: worksheet.rowHeader.hidden
21618
- },
21619
- columnHeader: {
21620
- height: worksheet.columnHeader.height,
21621
- hidden: worksheet.columnHeader.hidden
21622
- },
21623
- mergeData: cloneMergeData(worksheet.mergeData),
21624
- cellData: cloneCellDataMatrix(worksheet.cellData),
21625
- rowData: cloneRowColumnData(worksheet.rowData),
21626
- columnData: cloneRowColumnData(worksheet.columnData)
21627
- };
21628
- if (worksheet.gridlinesColor !== void 0) result.gridlinesColor = worksheet.gridlinesColor;
21629
- if (worksheet.defaultStyle !== void 0) if (worksheet.defaultStyle === null || typeof worksheet.defaultStyle === "string") result.defaultStyle = worksheet.defaultStyle;
21630
- else result.defaultStyle = cloneValue(worksheet.defaultStyle);
21631
- if (worksheet.custom !== void 0) result.custom = worksheet.custom === null ? null : cloneValue(worksheet.custom);
21632
- return result;
21633
- }
21634
-
21635
21287
  //#endregion
21636
21288
  //#region src/sheets/column-manager.ts
21637
21289
  /**
@@ -22359,7 +22011,7 @@ const DEFAULT_CELL_DOCUMENT_MODEL_OPTION = {
22359
22011
  /**
22360
22012
  * The model of a Worksheet.
22361
22013
  */
22362
- var Worksheet = class Worksheet {
22014
+ var Worksheet = class {
22363
22015
  constructor(unitId, snapshot, _styles) {
22364
22016
  var _this$_snapshot$id;
22365
22017
  this.unitId = unitId;
@@ -22628,16 +22280,6 @@ var Worksheet = class Worksheet {
22628
22280
  return this._snapshot.name;
22629
22281
  }
22630
22282
  /**
22631
- * Returns WorkSheet Clone Object
22632
- * @returns WorkSheet Clone Object
22633
- * @deprecated
22634
- */
22635
- clone() {
22636
- const { _snapshot: _config } = this;
22637
- const copy = cloneWorksheetData(_config);
22638
- return new Worksheet(this.unitId, copy, this._styles);
22639
- }
22640
- /**
22641
22283
  * Get the merged cell list of the sheet.
22642
22284
  * @returns {IRange[]} merged cell list
22643
22285
  */
@@ -23424,10 +23066,6 @@ let Workbook = class Workbook extends UnitModel {
23424
23066
  getSnapshot() {
23425
23067
  return this._snapshot;
23426
23068
  }
23427
- /** @deprecated use use name property instead */
23428
- getName() {
23429
- return this._snapshot.name;
23430
- }
23431
23069
  setName(name) {
23432
23070
  this._name$.next(name);
23433
23071
  this._snapshot.name = name;
@@ -23775,22 +23413,10 @@ let UniverInstanceService = class UniverInstanceService extends Disposable {
23775
23413
  var _this$_unitCreateOpti;
23776
23414
  return (_this$_unitCreateOpti = this._unitCreateOptions.get(unitId)) !== null && _this$_unitCreateOpti !== void 0 ? _this$_unitCreateOpti : null;
23777
23415
  }
23778
- getUniverSheetInstance(unitId) {
23779
- return this.getUnit(unitId, _univerjs_protocol.UniverType.UNIVER_SHEET);
23780
- }
23781
23416
  getAllUnitsForType(type) {
23782
23417
  var _this$_unitsByType$ge;
23783
23418
  return (_this$_unitsByType$ge = this._unitsByType.get(type)) !== null && _this$_unitsByType$ge !== void 0 ? _this$_unitsByType$ge : [];
23784
23419
  }
23785
- changeDoc(unitId, doc) {
23786
- const allDocs = this.getAllUnitsForType(_univerjs_protocol.UniverType.UNIVER_DOC);
23787
- const oldDoc = allDocs.find((doc) => doc.getUnitId() === unitId);
23788
- if (oldDoc != null) {
23789
- const index = allDocs.indexOf(oldDoc);
23790
- allDocs.splice(index, 1);
23791
- }
23792
- this.__addUnit(doc);
23793
- }
23794
23420
  get focused() {
23795
23421
  var _this$_getUnitById2;
23796
23422
  const id = this._focused$.getValue();
@@ -25217,6 +24843,198 @@ function delayAnimationFrame(frames = 1) {
25217
24843
  });
25218
24844
  }
25219
24845
 
24846
+ //#endregion
24847
+ //#region src/sheets/clone.ts
24848
+ /**
24849
+ * Fast clone for primitive values and simple objects.
24850
+ * Avoids type checking overhead when we know the structure.
24851
+ */
24852
+ function cloneValue(value) {
24853
+ if (value === null || value === void 0) return value;
24854
+ if (typeof value !== "object") return value;
24855
+ if (Array.isArray(value)) {
24856
+ const len = value.length;
24857
+ const result = new Array(len);
24858
+ for (let i = 0; i < len; i++) result[i] = cloneValue(value[i]);
24859
+ return result;
24860
+ }
24861
+ const result = {};
24862
+ const keys = Object.keys(value);
24863
+ for (let i = 0, len = keys.length; i < len; i++) {
24864
+ const key = keys[i];
24865
+ result[key] = cloneValue(value[key]);
24866
+ }
24867
+ return result;
24868
+ }
24869
+ /**
24870
+ * Fast clone for ICellData. Optimized for the known structure.
24871
+ * @param cell - The cell data to clone
24872
+ * @returns A deep clone of the cell data
24873
+ */
24874
+ function cloneCellData(cell) {
24875
+ if (cell === null || cell === void 0) return cell;
24876
+ const result = {};
24877
+ if (cell.p !== void 0) result.p = cell.p === null ? null : cloneValue(cell.p);
24878
+ if (cell.s !== void 0) if (cell.s === null || typeof cell.s === "string") result.s = cell.s;
24879
+ else result.s = cloneValue(cell.s);
24880
+ if (cell.v !== void 0) result.v = cell.v;
24881
+ if (cell.t !== void 0) result.t = cell.t;
24882
+ if (cell.f !== void 0) result.f = cell.f;
24883
+ if (cell.ref !== void 0) result.ref = cell.ref;
24884
+ if (cell.xf !== void 0) result.xf = cell.xf;
24885
+ if (cell.si !== void 0) result.si = cell.si;
24886
+ if (cell.custom !== void 0) result.custom = cell.custom === null ? null : cloneValue(cell.custom);
24887
+ return result;
24888
+ }
24889
+ /**
24890
+ * Fast clone for ICellDataWithSpanAndDisplay. Optimized for the known structure.
24891
+ * This extends cloneCellData with additional span and display properties.
24892
+ * @param cell - The cell data with span and display info to clone
24893
+ * @returns A deep clone of the cell data
24894
+ */
24895
+ function cloneCellDataWithSpanAndDisplay(cell) {
24896
+ if (cell === null || cell === void 0) return cell;
24897
+ const result = {};
24898
+ if (cell.p !== void 0) result.p = cell.p === null ? null : cloneValue(cell.p);
24899
+ if (cell.s !== void 0) if (cell.s === null || typeof cell.s === "string") result.s = cell.s;
24900
+ else result.s = cloneValue(cell.s);
24901
+ if (cell.v !== void 0) result.v = cell.v;
24902
+ if (cell.t !== void 0) result.t = cell.t;
24903
+ if (cell.f !== void 0) result.f = cell.f;
24904
+ if (cell.ref !== void 0) result.ref = cell.ref;
24905
+ if (cell.xf !== void 0) result.xf = cell.xf;
24906
+ if (cell.si !== void 0) result.si = cell.si;
24907
+ if (cell.custom !== void 0) result.custom = cell.custom === null ? null : cloneValue(cell.custom);
24908
+ if (cell.rowSpan !== void 0) result.rowSpan = cell.rowSpan;
24909
+ if (cell.colSpan !== void 0) result.colSpan = cell.colSpan;
24910
+ if (cell.displayV !== void 0) result.displayV = cell.displayV;
24911
+ return result;
24912
+ }
24913
+ /**
24914
+ * Fast clone for cell data matrix. Optimized for sparse matrix structure.
24915
+ * @param cellData - The cell data matrix to clone
24916
+ * @returns A deep clone of the cell data matrix
24917
+ */
24918
+ function cloneCellDataMatrix(cellData) {
24919
+ const result = {};
24920
+ const rowKeys = Object.keys(cellData);
24921
+ for (let i = 0, rowLen = rowKeys.length; i < rowLen; i++) {
24922
+ const rowKey = rowKeys[i];
24923
+ const rowNum = Number(rowKey);
24924
+ const rowData = cellData[rowNum];
24925
+ if (rowData === void 0) continue;
24926
+ const clonedRow = {};
24927
+ const colKeys = Object.keys(rowData);
24928
+ for (let j = 0, colLen = colKeys.length; j < colLen; j++) {
24929
+ const colKey = colKeys[j];
24930
+ const colNum = Number(colKey);
24931
+ const cell = rowData[colNum];
24932
+ if (cell !== void 0 && cell !== null) clonedRow[colNum] = cloneCellData(cell);
24933
+ }
24934
+ result[rowNum] = clonedRow;
24935
+ }
24936
+ return result;
24937
+ }
24938
+ /**
24939
+ * Fast clone for row/column data arrays (sparse arrays stored as objects).
24940
+ * @param data - The row or column data to clone
24941
+ * @returns A deep clone of the row or column data
24942
+ */
24943
+ function cloneRowColumnData(data) {
24944
+ const result = {};
24945
+ const keys = Object.keys(data);
24946
+ for (let i = 0, len = keys.length; i < len; i++) {
24947
+ const key = keys[i];
24948
+ const idx = Number(key);
24949
+ const item = data[idx];
24950
+ if (item === void 0) continue;
24951
+ const cloned = {};
24952
+ if ("h" in item && item.h !== void 0) cloned.h = item.h;
24953
+ if ("ia" in item && item.ia !== void 0) cloned.ia = item.ia;
24954
+ if ("ah" in item && item.ah !== void 0) cloned.ah = item.ah;
24955
+ if ("hd" in item && item.hd !== void 0) cloned.hd = item.hd;
24956
+ if ("w" in item && item.w !== void 0) cloned.w = item.w;
24957
+ if ("s" in item && item.s !== void 0) if (item.s === null || typeof item.s === "string") cloned.s = item.s;
24958
+ else cloned.s = cloneValue(item.s);
24959
+ if ("custom" in item && item.custom !== void 0) cloned.custom = item.custom === null ? null : cloneValue(item.custom);
24960
+ result[idx] = cloned;
24961
+ }
24962
+ return result;
24963
+ }
24964
+ /**
24965
+ * Fast clone for IRange array (merge data).
24966
+ * @param ranges - The array of ranges to clone
24967
+ * @returns A shallow clone of the ranges (IRange contains only primitive values)
24968
+ */
24969
+ function cloneMergeData(ranges) {
24970
+ const len = ranges.length;
24971
+ const result = new Array(len);
24972
+ for (let i = 0; i < len; i++) {
24973
+ const range = ranges[i];
24974
+ result[i] = {
24975
+ startRow: range.startRow,
24976
+ startColumn: range.startColumn,
24977
+ endRow: range.endRow,
24978
+ endColumn: range.endColumn,
24979
+ rangeType: range.rangeType,
24980
+ startAbsoluteRefType: range.startAbsoluteRefType,
24981
+ endAbsoluteRefType: range.endAbsoluteRefType
24982
+ };
24983
+ }
24984
+ return result;
24985
+ }
24986
+ /**
24987
+ * Optimized deep clone specifically for IWorksheetData.
24988
+ * This is significantly faster than generic deepClone because:
24989
+ * 1. No recursive type checking - we know the structure
24990
+ * 2. Direct property access instead of Object.keys iteration for known properties
24991
+ * 3. Specialized handlers for cellData matrix (the largest data)
24992
+ * 4. Primitive values copied directly without cloning
24993
+ *
24994
+ * @param worksheet - The worksheet data to clone
24995
+ * @returns A deep clone of the worksheet data
24996
+ */
24997
+ function cloneWorksheetData(worksheet) {
24998
+ const result = {
24999
+ id: worksheet.id,
25000
+ name: worksheet.name,
25001
+ tabColor: worksheet.tabColor,
25002
+ hidden: worksheet.hidden,
25003
+ rowCount: worksheet.rowCount,
25004
+ columnCount: worksheet.columnCount,
25005
+ zoomRatio: worksheet.zoomRatio,
25006
+ scrollTop: worksheet.scrollTop,
25007
+ scrollLeft: worksheet.scrollLeft,
25008
+ defaultColumnWidth: worksheet.defaultColumnWidth,
25009
+ defaultRowHeight: worksheet.defaultRowHeight,
25010
+ showGridlines: worksheet.showGridlines,
25011
+ rightToLeft: worksheet.rightToLeft,
25012
+ freeze: {
25013
+ xSplit: worksheet.freeze.xSplit,
25014
+ ySplit: worksheet.freeze.ySplit,
25015
+ startRow: worksheet.freeze.startRow,
25016
+ startColumn: worksheet.freeze.startColumn
25017
+ },
25018
+ rowHeader: {
25019
+ width: worksheet.rowHeader.width,
25020
+ hidden: worksheet.rowHeader.hidden
25021
+ },
25022
+ columnHeader: {
25023
+ height: worksheet.columnHeader.height,
25024
+ hidden: worksheet.columnHeader.hidden
25025
+ },
25026
+ mergeData: cloneMergeData(worksheet.mergeData),
25027
+ cellData: cloneCellDataMatrix(worksheet.cellData),
25028
+ rowData: cloneRowColumnData(worksheet.rowData),
25029
+ columnData: cloneRowColumnData(worksheet.columnData)
25030
+ };
25031
+ if (worksheet.gridlinesColor !== void 0) result.gridlinesColor = worksheet.gridlinesColor;
25032
+ if (worksheet.defaultStyle !== void 0) if (worksheet.defaultStyle === null || typeof worksheet.defaultStyle === "string") result.defaultStyle = worksheet.defaultStyle;
25033
+ else result.defaultStyle = cloneValue(worksheet.defaultStyle);
25034
+ if (worksheet.custom !== void 0) result.custom = worksheet.custom === null ? null : cloneValue(worksheet.custom);
25035
+ return result;
25036
+ }
25037
+
25220
25038
  //#endregion
25221
25039
  //#region src/skeleton.ts
25222
25040
  let Skeleton = class Skeleton extends Disposable {
@@ -25329,12 +25147,6 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
25329
25147
  }
25330
25148
  resetCache() {}
25331
25149
  /**
25332
- * @deprecated should never expose a property that is provided by another module!
25333
- */
25334
- getWorksheetConfig() {
25335
- return this._worksheetData;
25336
- }
25337
- /**
25338
25150
  * Get which Workbook and Worksheet this skeleton is attached to.
25339
25151
  * @returns [unitId, sheetId]
25340
25152
  */
@@ -26642,6 +26454,7 @@ exports.DocumentBlockRangeType = DocumentBlockRangeType;
26642
26454
  exports.DocumentBlockType = DocumentBlockType;
26643
26455
  exports.DocumentDataModel = DocumentDataModel;
26644
26456
  exports.DocumentFlavor = DocumentFlavor;
26457
+ exports.DocxBreakType = DocxBreakType;
26645
26458
  exports.DrawingTypeEnum = DrawingTypeEnum;
26646
26459
  exports.EDITOR_ACTIVATED = EDITOR_ACTIVATED;
26647
26460
  exports.EXTENSION_NAMES = EXTENSION_NAMES;
@@ -26652,7 +26465,6 @@ exports.FOCUSING_BOARD = FOCUSING_BOARD;
26652
26465
  exports.FOCUSING_COMMENT_EDITOR = FOCUSING_COMMENT_EDITOR;
26653
26466
  exports.FOCUSING_COMMON_DRAWINGS = FOCUSING_COMMON_DRAWINGS;
26654
26467
  exports.FOCUSING_DOC = FOCUSING_DOC;
26655
- exports.FOCUSING_EDITOR_BUT_HIDDEN = FOCUSING_EDITOR_BUT_HIDDEN;
26656
26468
  exports.FOCUSING_EDITOR_INPUT_FORMULA = FOCUSING_EDITOR_INPUT_FORMULA;
26657
26469
  exports.FOCUSING_EDITOR_STANDALONE = FOCUSING_EDITOR_STANDALONE;
26658
26470
  exports.FOCUSING_FX_BAR_EDITOR = FOCUSING_FX_BAR_EDITOR;
@@ -26885,6 +26697,7 @@ exports.Styles = Styles;
26885
26697
  exports.TEXT_DECORATION_KEYS = TEXT_DECORATION_KEYS;
26886
26698
  exports.TEXT_ROTATION_KEYS = TEXT_ROTATION_KEYS;
26887
26699
  exports.THEME_COLORS = THEME_COLORS;
26700
+ exports.TRADITIONAL_DOCUMENT_DEFAULT_MARGIN = TRADITIONAL_DOCUMENT_DEFAULT_MARGIN;
26888
26701
  exports.TabStopAlignment = TabStopAlignment;
26889
26702
  exports.TableAlignmentType = TableAlignmentType;
26890
26703
  exports.TableLayoutType = TableLayoutType;
@@ -27024,7 +26837,6 @@ exports.getBodySliceForSplitTextXAction = getBodySliceForSplitTextXAction;
27024
26837
  exports.getBodySliceForTextXAction = getBodySliceForTextXAction;
27025
26838
  exports.getBorderStyleType = getBorderStyleType;
27026
26839
  exports.getCellCoordByIndexSimple = getCellCoordByIndexSimple;
27027
- exports.getCellInfoInMergeData = getCellInfoInMergeData;
27028
26840
  exports.getCellValueType = getCellValueType;
27029
26841
  exports.getCellWithCoordByIndexCore = getCellWithCoordByIndexCore;
27030
26842
  exports.getColorStyle = getColorStyle;
@@ -27141,8 +26953,6 @@ Object.defineProperty(exports, 'isValueDependencyItem', {
27141
26953
  exports.isWhiteColor = isWhiteColor;
27142
26954
  exports.makeArray = makeArray;
27143
26955
  exports.makeCellRangeToRangeData = makeCellRangeToRangeData;
27144
- exports.makeCellToSelection = makeCellToSelection;
27145
- exports.makeCustomRangeStream = makeCustomRangeStream;
27146
26956
  exports.mapObjectMatrix = mapObjectMatrix;
27147
26957
  Object.defineProperty(exports, 'merge', {
27148
26958
  enumerable: true,