@univerjs/docs 1.3.0 → 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.
- package/lib/cjs/facade.js +14 -28
- package/lib/cjs/index.js +191 -1432
- package/lib/cjs/worker-BkTyL8zs.js +1293 -0
- package/lib/cjs/worker.js +44 -0
- package/lib/es/facade.js +14 -28
- package/lib/es/index.js +70 -1311
- package/lib/es/worker-Dny9WctR.js +1186 -0
- package/lib/es/worker.js +38 -0
- package/lib/facade.js +14 -28
- package/lib/index.js +70 -1311
- package/lib/types/config/config.d.ts +4 -0
- package/lib/types/index.d.ts +6 -2
- package/lib/types/layout-worker/index.d.ts +1 -5
- package/lib/types/layout-worker/worker.d.ts +1 -1
- package/lib/types/services/doc-interceptor/doc-interceptor.service.d.ts +1 -1
- package/lib/types/services/doc-state-change-manager.service.d.ts +1 -1
- package/lib/types/services/permission/document-permission.d.ts +1 -1
- package/lib/types/worker.d.ts +27 -0
- package/lib/umd/index.js +2 -2
- package/lib/worker-Dny9WctR.js +1186 -0
- package/lib/worker.js +38 -0
- package/package.json +15 -10
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_worker = require("./worker-BkTyL8zs.js");
|
|
3
|
+
let _univerjs_core = require("@univerjs/core");
|
|
4
|
+
|
|
5
|
+
// src/worker.ts
|
|
6
|
+
/**
|
|
7
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
8
|
+
*
|
|
9
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
* you may not use this file except in compliance with the License.
|
|
11
|
+
* You may obtain a copy of the License at
|
|
12
|
+
*
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
* See the License for the specific language governing permissions and
|
|
19
|
+
* limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
let UniverDocsWorkerPlugin = class UniverDocsWorkerPlugin extends _univerjs_core.Plugin {
|
|
22
|
+
constructor(_config = require_worker.defaultPluginWorkerConfig, _injector, _configService) {
|
|
23
|
+
super();
|
|
24
|
+
this._config = _config;
|
|
25
|
+
this._injector = _injector;
|
|
26
|
+
this._configService = _configService;
|
|
27
|
+
const { ...rest } = (0, _univerjs_core.merge)({}, require_worker.defaultPluginWorkerConfig, this._config);
|
|
28
|
+
this._configService.setConfig(require_worker.DOCS_WORKER_PLUGIN_CONFIG_KEY, rest);
|
|
29
|
+
}
|
|
30
|
+
onStarting() {
|
|
31
|
+
this.disposeWithMe(require_worker.startDocsLayoutWorker());
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
require_worker._defineProperty(UniverDocsWorkerPlugin, "pluginName", "UNIVER_DOCS_WORKER_PLUGIN");
|
|
35
|
+
require_worker._defineProperty(UniverDocsWorkerPlugin, "packageName", require_worker.name);
|
|
36
|
+
require_worker._defineProperty(UniverDocsWorkerPlugin, "version", require_worker.version);
|
|
37
|
+
UniverDocsWorkerPlugin = require_worker.__decorate([require_worker.__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), require_worker.__decorateParam(2, _univerjs_core.IConfigService)], UniverDocsWorkerPlugin);
|
|
38
|
+
|
|
39
|
+
Object.defineProperty(exports, "UniverDocsWorkerPlugin", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () {
|
|
42
|
+
return UniverDocsWorkerPlugin;
|
|
43
|
+
}
|
|
44
|
+
});
|
package/lib/es/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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 };
|