@univerjs/docs 1.3.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,38 @@
1
+ import { _ as __decorateParam, c as defaultPluginWorkerConfig, g as __decorate, l as name, o as DOCS_WORKER_PLUGIN_CONFIG_KEY, t as startDocsLayoutWorker, u as version, v as _defineProperty } from "./worker-Dny9WctR.js";
2
+ import { IConfigService, Inject, Injector, Plugin, merge } from "@univerjs/core";
3
+
4
+ // src/worker.ts
5
+ /**
6
+ * Copyright 2023-present DreamNum Co., Ltd.
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */
20
+ let UniverDocsWorkerPlugin = class UniverDocsWorkerPlugin extends Plugin {
21
+ constructor(_config = defaultPluginWorkerConfig, _injector, _configService) {
22
+ super();
23
+ this._config = _config;
24
+ this._injector = _injector;
25
+ this._configService = _configService;
26
+ const { ...rest } = merge({}, defaultPluginWorkerConfig, this._config);
27
+ this._configService.setConfig(DOCS_WORKER_PLUGIN_CONFIG_KEY, rest);
28
+ }
29
+ onStarting() {
30
+ this.disposeWithMe(startDocsLayoutWorker());
31
+ }
32
+ };
33
+ _defineProperty(UniverDocsWorkerPlugin, "pluginName", "UNIVER_DOCS_WORKER_PLUGIN");
34
+ _defineProperty(UniverDocsWorkerPlugin, "packageName", name);
35
+ _defineProperty(UniverDocsWorkerPlugin, "version", version);
36
+ UniverDocsWorkerPlugin = __decorate([__decorateParam(1, Inject(Injector)), __decorateParam(2, IConfigService)], UniverDocsWorkerPlugin);
37
+
38
+ export { UniverDocsWorkerPlugin };
package/lib/facade.js CHANGED
@@ -3,7 +3,7 @@ import { FBaseInitialable, FEnum, FUniver } from "@univerjs/core/facade";
3
3
  import { CreateHeaderFooterCommand, DeleteDocumentSectionBreakCommand, HeaderFooterType, InsertDocumentColumnBreakCommand, InsertDocumentSectionBreakCommand, InsertTextCommand, RichTextEditingMutation, SetDocumentNameCommand, SetDocumentPermissionCommand, SetDocumentPermissionsCommand, SetSectionHeaderFooterLinkCommand, UpdateDocumentParagraphStyleCommand, UpdateDocumentSectionCommand, canEditDocumentTargets, createSectionColumnProperties, generateParagraphs, getDocumentEntityParentPermissionObjectIds, getDocumentEntityPermissionObjectId, getDocumentParagraphParentPermissionObjectIds, getDocumentParagraphPermissionObjectId, getDocumentPermissionValue, getDocumentSectionPermissionObjectId, getEffectiveSectionPageSetup, getSectionContentWidth, getTopLevelSectionBreaks } from "@univerjs/docs";
4
4
  import { UnitAction } from "@univerjs/protocol";
5
5
 
6
- //#region src/facade/f-document-permission.ts
6
+ // src/facade/f-document-permission.ts
7
7
  /**
8
8
  * Command-backed permissions for one Document unit.
9
9
  * @hideconstructor
@@ -213,8 +213,7 @@ var FDocumentObjectPermission = class {
213
213
  }
214
214
  };
215
215
 
216
- //#endregion
217
- //#region src/facade/utils.ts
216
+ // src/facade/utils.ts
218
217
  function cloneParagraphStyle(paragraphStyle) {
219
218
  return paragraphStyle == null ? paragraphStyle : JSON.parse(JSON.stringify(paragraphStyle));
220
219
  }
@@ -302,16 +301,14 @@ function stripBlockTokens(text) {
302
301
  return Array.from(text).map((char) => char === DataStreamTreeTokenType.PARAGRAPH ? "\n" : char).filter((char) => char !== DataStreamTreeTokenType.BLOCK_START && char !== DataStreamTreeTokenType.BLOCK_END && char !== DataStreamTreeTokenType.SECTION_BREAK).join("").replace(/\n$/, "");
303
302
  }
304
303
 
305
- //#endregion
306
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
304
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/decorateParam.js
307
305
  function __decorateParam(paramIndex, decorator) {
308
306
  return function(target, key) {
309
307
  decorator(target, key, paramIndex);
310
308
  };
311
309
  }
312
310
 
313
- //#endregion
314
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
311
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/decorate.js
315
312
  function __decorate(decorators, target, key, desc) {
316
313
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
317
314
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -319,8 +316,7 @@ function __decorate(decorators, target, key, desc) {
319
316
  return c > 3 && r && Object.defineProperty(target, key, r), r;
320
317
  }
321
318
 
322
- //#endregion
323
- //#region src/facade/f-document-text-range.ts
319
+ // src/facade/f-document-text-range.ts
324
320
  let FDocumentTextRange = class FDocumentTextRange extends FBaseInitialable {
325
321
  constructor(_document, _startOffset, _endOffset, _segmentId, _injector, _commandService) {
326
322
  super(_injector);
@@ -484,8 +480,7 @@ function isDeepEqual(left, right) {
484
480
  return JSON.stringify(left) === JSON.stringify(right);
485
481
  }
486
482
 
487
- //#endregion
488
- //#region src/facade/f-document-paragraph.ts
483
+ // src/facade/f-document-paragraph.ts
489
484
  let FDocumentParagraph = class FDocumentParagraph extends FBaseInitialable {
490
485
  constructor(_document, _paragraphId, _segmentId = "", _injector, _commandService, _permissionService) {
491
486
  super(_injector);
@@ -870,8 +865,7 @@ function isParagraphFacade(value) {
870
865
  return typeof value.getId === "function" && typeof value.getSegmentId === "function" && typeof value.getInfo === "function" && typeof value.getRange === "function";
871
866
  }
872
867
 
873
- //#endregion
874
- //#region src/facade/f-document-section.ts
868
+ // src/facade/f-document-section.ts
875
869
  function validatePageSetup(pageSetup) {
876
870
  const { pageNumberStart, pageSize, pageOrient, marginTop, marginBottom, marginLeft, marginRight } = pageSetup;
877
871
  if (pageNumberStart != null && (!Number.isInteger(pageNumberStart) || pageNumberStart < 1)) throw new RangeError("Section page number start must be a positive integer.");
@@ -1452,8 +1446,7 @@ let FDocumentSection = class FDocumentSection {
1452
1446
  };
1453
1447
  FDocumentSection = __decorate([__decorateParam(2, ICommandService), __decorateParam(3, IPermissionService)], FDocumentSection);
1454
1448
 
1455
- //#endregion
1456
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
1449
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/typeof.js
1457
1450
  function _typeof(o) {
1458
1451
  "@babel/helpers - typeof";
1459
1452
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -1463,8 +1456,7 @@ function _typeof(o) {
1463
1456
  }, _typeof(o);
1464
1457
  }
1465
1458
 
1466
- //#endregion
1467
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
1459
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/toPrimitive.js
1468
1460
  function toPrimitive(t, r) {
1469
1461
  if ("object" != _typeof(t) || !t) return t;
1470
1462
  var e = t[Symbol.toPrimitive];
@@ -1476,15 +1468,13 @@ function toPrimitive(t, r) {
1476
1468
  return ("string" === r ? String : Number)(t);
1477
1469
  }
1478
1470
 
1479
- //#endregion
1480
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
1471
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/toPropertyKey.js
1481
1472
  function toPropertyKey(t) {
1482
1473
  var i = toPrimitive(t, "string");
1483
1474
  return "symbol" == _typeof(i) ? i : i + "";
1484
1475
  }
1485
1476
 
1486
- //#endregion
1487
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
1477
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/defineProperty.js
1488
1478
  function _defineProperty(e, r, t) {
1489
1479
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
1490
1480
  value: t,
@@ -1494,8 +1484,7 @@ function _defineProperty(e, r, t) {
1494
1484
  }) : e[r] = t, e;
1495
1485
  }
1496
1486
 
1497
- //#endregion
1498
- //#region src/facade/f-document.ts
1487
+ // src/facade/f-document.ts
1499
1488
  let FDocument = class FDocument extends FBaseInitialable {
1500
1489
  constructor(_documentDataModel, _injector, _univerInstanceService, _resourceLoaderService, _commandService, _permissionService) {
1501
1490
  super(_injector);
@@ -2264,8 +2253,7 @@ FDocument = __decorate([
2264
2253
  __decorateParam(5, IPermissionService)
2265
2254
  ], FDocument);
2266
2255
 
2267
- //#endregion
2268
- //#region src/facade/f-univer.ts
2256
+ // src/facade/f-univer.ts
2269
2257
  var FUniverDocsMixin = class extends FUniver {
2270
2258
  createDocument(data, options) {
2271
2259
  const document = this._injector.get(IUniverInstanceService).createUnit(UniverInstanceType.UNIVER_DOC, data, options);
@@ -2284,8 +2272,7 @@ var FUniverDocsMixin = class extends FUniver {
2284
2272
  };
2285
2273
  FUniver.extend(FUniverDocsMixin);
2286
2274
 
2287
- //#endregion
2288
- //#region src/facade/f-enum.ts
2275
+ // src/facade/f-enum.ts
2289
2276
  /**
2290
2277
  * Copyright 2023-present DreamNum Co., Ltd.
2291
2278
  *
@@ -2314,5 +2301,4 @@ var FDocsEnumMixin = class extends FEnum {
2314
2301
  };
2315
2302
  FEnum.extend(FDocsEnumMixin);
2316
2303
 
2317
- //#endregion
2318
2304
  export { DocsSectionUnsupportedDocumentFlavorError, FDocsEnumMixin, FDocument, FDocumentObjectPermission, FDocumentParagraph, FDocumentPermission, FDocumentSection, FDocumentTextRange, isParagraphFacade, stripBlockTokens };