@univerjs/docs-ui 0.24.0 → 0.25.0-insiders.20260608-e4336f7

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 (142) hide show
  1. package/lib/cjs/facade.js +23 -152
  2. package/lib/cjs/index.js +4431 -1743
  3. package/lib/cjs/locale/ar-SA.js +124 -0
  4. package/lib/cjs/locale/ca-ES.js +11 -10
  5. package/lib/cjs/locale/de-DE.js +124 -0
  6. package/lib/cjs/locale/en-US.js +11 -10
  7. package/lib/cjs/locale/es-ES.js +11 -10
  8. package/lib/cjs/locale/fa-IR.js +11 -10
  9. package/lib/cjs/locale/fr-FR.js +11 -10
  10. package/lib/cjs/locale/id-ID.js +124 -0
  11. package/lib/cjs/locale/it-IT.js +124 -0
  12. package/lib/cjs/locale/ja-JP.js +11 -10
  13. package/lib/cjs/locale/ko-KR.js +11 -10
  14. package/lib/cjs/locale/pl-PL.js +124 -0
  15. package/lib/cjs/locale/pt-BR.js +124 -0
  16. package/lib/cjs/locale/ru-RU.js +13 -12
  17. package/lib/cjs/locale/sk-SK.js +11 -10
  18. package/lib/cjs/locale/vi-VN.js +22 -21
  19. package/lib/cjs/locale/zh-CN.js +11 -10
  20. package/lib/cjs/locale/zh-HK.js +124 -0
  21. package/lib/cjs/locale/zh-TW.js +22 -21
  22. package/lib/es/facade.js +25 -147
  23. package/lib/es/index.js +4397 -1716
  24. package/lib/es/locale/ar-SA.js +123 -0
  25. package/lib/es/locale/ca-ES.js +11 -10
  26. package/lib/es/locale/de-DE.js +123 -0
  27. package/lib/es/locale/en-US.js +11 -10
  28. package/lib/es/locale/es-ES.js +11 -10
  29. package/lib/es/locale/fa-IR.js +11 -10
  30. package/lib/es/locale/fr-FR.js +11 -10
  31. package/lib/es/locale/id-ID.js +123 -0
  32. package/lib/es/locale/it-IT.js +123 -0
  33. package/lib/es/locale/ja-JP.js +11 -10
  34. package/lib/es/locale/ko-KR.js +11 -10
  35. package/lib/es/locale/pl-PL.js +123 -0
  36. package/lib/es/locale/pt-BR.js +123 -0
  37. package/lib/es/locale/ru-RU.js +13 -12
  38. package/lib/es/locale/sk-SK.js +11 -10
  39. package/lib/es/locale/vi-VN.js +22 -21
  40. package/lib/es/locale/zh-CN.js +11 -10
  41. package/lib/es/locale/zh-HK.js +123 -0
  42. package/lib/es/locale/zh-TW.js +22 -21
  43. package/lib/facade.js +25 -147
  44. package/lib/index.css +240 -26
  45. package/lib/index.js +4397 -1716
  46. package/lib/locale/ar-SA.js +123 -0
  47. package/lib/locale/ca-ES.js +11 -10
  48. package/lib/locale/de-DE.js +123 -0
  49. package/lib/locale/en-US.js +11 -10
  50. package/lib/locale/es-ES.js +11 -10
  51. package/lib/locale/fa-IR.js +11 -10
  52. package/lib/locale/fr-FR.js +11 -10
  53. package/lib/locale/id-ID.js +123 -0
  54. package/lib/locale/it-IT.js +123 -0
  55. package/lib/locale/ja-JP.js +11 -10
  56. package/lib/locale/ko-KR.js +11 -10
  57. package/lib/locale/pl-PL.js +123 -0
  58. package/lib/locale/pt-BR.js +123 -0
  59. package/lib/locale/ru-RU.js +13 -12
  60. package/lib/locale/sk-SK.js +11 -10
  61. package/lib/locale/vi-VN.js +22 -21
  62. package/lib/locale/zh-CN.js +11 -10
  63. package/lib/locale/zh-HK.js +123 -0
  64. package/lib/locale/zh-TW.js +22 -21
  65. package/lib/types/commands/commands/doc-block-move.command.d.ts +40 -0
  66. package/lib/types/commands/commands/doc-delete.command.d.ts +3 -2
  67. package/lib/types/commands/commands/doc-page-setup.command.d.ts +2 -0
  68. package/lib/types/commands/commands/inline-format.command.d.ts +2 -1
  69. package/lib/types/commands/commands/list.command.d.ts +1 -0
  70. package/lib/types/commands/util.d.ts +1 -2
  71. package/lib/types/components/float-toolbar/FloatToolbar.d.ts +1 -1
  72. package/lib/types/components/float-toolbar/FloatToolbar.stories.d.ts +1 -1
  73. package/lib/types/components/list-type-picker/Picker.d.ts +3 -3
  74. package/lib/types/components/paragraph-menu/index.d.ts +24 -2
  75. package/lib/types/components/side-menu/SideMenu.stories.d.ts +4 -4
  76. package/lib/types/controllers/render-controllers/doc-contextmenu.render-controller.d.ts +8 -2
  77. package/lib/types/controllers/render-controllers/doc.render-controller.d.ts +8 -2
  78. package/lib/types/controllers/render-controllers/zoom.render-controller.d.ts +3 -3
  79. package/lib/types/facade/f-document.d.ts +12 -26
  80. package/lib/types/facade/index.d.ts +2 -3
  81. package/lib/types/index.d.ts +7 -5
  82. package/lib/types/{types/delete-direction.d.ts → locale/ar-SA.d.ts} +3 -4
  83. package/lib/types/locale/de-DE.d.ts +18 -0
  84. package/lib/types/locale/en-US.d.ts +117 -110
  85. package/lib/types/locale/id-ID.d.ts +18 -0
  86. package/lib/types/locale/it-IT.d.ts +18 -0
  87. package/lib/types/locale/pl-PL.d.ts +18 -0
  88. package/lib/types/locale/pt-BR.d.ts +18 -0
  89. package/lib/types/locale/zh-HK.d.ts +18 -0
  90. package/lib/types/menu/menu.d.ts +9 -1
  91. package/lib/types/menu/paragraph-menu.d.ts +21 -2
  92. package/lib/types/menu/schema.d.ts +1 -0
  93. package/lib/types/services/clipboard/clipboard.service.d.ts +5 -1
  94. package/lib/types/services/clipboard/html-to-udm/converter.d.ts +12 -0
  95. package/lib/types/services/clipboard/html-to-udm/paste-plugins/type.d.ts +1 -0
  96. package/lib/types/services/clipboard/internal-fragment.d.ts +30 -0
  97. package/lib/types/services/doc-event-manager.service.d.ts +19 -1
  98. package/lib/types/services/doc-ime-state-change-interceptor.service.d.ts +23 -0
  99. package/lib/types/services/doc-paragraph-menu.service.d.ts +51 -3
  100. package/lib/types/services/doc-popup-manager.service.d.ts +2 -2
  101. package/lib/types/services/docs-render.service.d.ts +2 -1
  102. package/lib/types/services/editor/editor.d.ts +1 -0
  103. package/lib/types/services/selection/convert-text-range.d.ts +1 -0
  104. package/lib/types/services/selection/doc-selection-render.service.d.ts +4 -0
  105. package/lib/types/views/count-bar/CountBar.d.ts +1 -1
  106. package/lib/types/views/count-bar/ZoomSlider.d.ts +1 -1
  107. package/lib/types/views/doc-footer/DocFooter.d.ts +1 -1
  108. package/lib/types/views/header-footer/panel/DocHeaderFooterOptions.d.ts +1 -1
  109. package/lib/types/views/header-footer/panel/DocHeaderFooterPanel.d.ts +1 -1
  110. package/lib/types/views/page-settings/index.d.ts +5 -3
  111. package/lib/types/views/paragraph-setting/Setting.d.ts +1 -1
  112. package/lib/types/views/paragraph-setting/index.d.ts +1 -1
  113. package/lib/types/views/rich-text-editor/hooks/use-editor.d.ts +2 -1
  114. package/lib/types/views/rich-text-editor/index.d.ts +1 -1
  115. package/lib/types/views/side-menu/index.d.ts +1 -1
  116. package/lib/types/views/table/create/TableCreate.d.ts +1 -1
  117. package/lib/umd/facade.js +1 -1
  118. package/lib/umd/index.js +37 -10
  119. package/lib/umd/locale/ar-SA.js +1 -0
  120. package/lib/umd/locale/ca-ES.js +1 -1
  121. package/lib/umd/locale/de-DE.js +1 -0
  122. package/lib/umd/locale/en-US.js +1 -1
  123. package/lib/umd/locale/es-ES.js +1 -1
  124. package/lib/umd/locale/fa-IR.js +1 -1
  125. package/lib/umd/locale/fr-FR.js +1 -1
  126. package/lib/umd/locale/id-ID.js +1 -0
  127. package/lib/umd/locale/it-IT.js +1 -0
  128. package/lib/umd/locale/ja-JP.js +1 -1
  129. package/lib/umd/locale/ko-KR.js +1 -1
  130. package/lib/umd/locale/pl-PL.js +1 -0
  131. package/lib/umd/locale/pt-BR.js +1 -0
  132. package/lib/umd/locale/ru-RU.js +1 -1
  133. package/lib/umd/locale/sk-SK.js +1 -1
  134. package/lib/umd/locale/vi-VN.js +1 -1
  135. package/lib/umd/locale/zh-CN.js +1 -1
  136. package/lib/umd/locale/zh-HK.js +1 -0
  137. package/lib/umd/locale/zh-TW.js +1 -1
  138. package/package.json +13 -13
  139. package/LICENSE +0 -176
  140. package/lib/types/commands/commands/core-editing.command.d.ts +0 -58
  141. package/lib/types/facade/f-univer.d.ts +0 -52
  142. package/lib/types/services/doc-state-change-manager.service.d.ts +0 -50
package/lib/cjs/facade.js CHANGED
@@ -1,135 +1,38 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
1
  let _univerjs_core = require("@univerjs/core");
3
- let _univerjs_core_facade = require("@univerjs/core/facade");
4
2
  let _univerjs_docs_ui = require("@univerjs/docs-ui");
3
+ let _univerjs_docs_facade = require("@univerjs/docs/facade");
5
4
  let _univerjs_engine_render = require("@univerjs/engine-render");
6
5
 
7
- //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
8
- function _typeof(o) {
9
- "@babel/helpers - typeof";
10
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
11
- return typeof o;
12
- } : function(o) {
13
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
14
- }, _typeof(o);
15
- }
16
-
17
- //#endregion
18
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
19
- function toPrimitive(t, r) {
20
- if ("object" != _typeof(t) || !t) return t;
21
- var e = t[Symbol.toPrimitive];
22
- if (void 0 !== e) {
23
- var i = e.call(t, r || "default");
24
- if ("object" != _typeof(i)) return i;
25
- throw new TypeError("@@toPrimitive must return a primitive value.");
26
- }
27
- return ("string" === r ? String : Number)(t);
28
- }
29
-
30
- //#endregion
31
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
32
- function toPropertyKey(t) {
33
- var i = toPrimitive(t, "string");
34
- return "symbol" == _typeof(i) ? i : i + "";
35
- }
36
-
37
- //#endregion
38
- //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
39
- function _defineProperty(e, r, t) {
40
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
41
- value: t,
42
- enumerable: !0,
43
- configurable: !0,
44
- writable: !0
45
- }) : e[r] = t, e;
46
- }
47
-
48
- //#endregion
49
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
50
- function __decorateParam(paramIndex, decorator) {
51
- return function(target, key) {
52
- decorator(target, key, paramIndex);
53
- };
54
- }
55
-
56
- //#endregion
57
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
58
- function __decorate(decorators, target, key, desc) {
59
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
60
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
61
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
62
- return c > 3 && r && Object.defineProperty(target, key, r), r;
63
- }
64
-
65
- //#endregion
66
6
  //#region src/facade/f-document.ts
67
- let FDocument = class FDocument {
68
- constructor(_documentDataModel, _injector, _univerInstanceService, _commandService, _resourceManagerService, _renderManagerService) {
69
- this._documentDataModel = _documentDataModel;
70
- this._injector = _injector;
71
- this._univerInstanceService = _univerInstanceService;
72
- this._commandService = _commandService;
73
- this._resourceManagerService = _resourceManagerService;
74
- this._renderManagerService = _renderManagerService;
75
- _defineProperty(this, "id", void 0);
76
- this.id = this._documentDataModel.getUnitId();
77
- }
78
- getId() {
79
- return this._documentDataModel.getUnitId();
80
- }
81
- getName() {
82
- return this.getSnapshot().title || "";
83
- }
84
- getSnapshot() {
85
- const resources = this._resourceManagerService.getResourcesByType(this.id, _univerjs_core.UniverInstanceType.UNIVER_DOC);
86
- const snapshot = this._documentDataModel.getSnapshot();
87
- snapshot.resources = resources;
88
- return snapshot;
89
- }
90
- undo() {
91
- this._univerInstanceService.focusUnit(this.id);
92
- return this._commandService.executeCommand(_univerjs_core.UndoCommand.id);
93
- }
94
- redo() {
95
- this._univerInstanceService.focusUnit(this.id);
96
- return this._commandService.executeCommand(_univerjs_core.RedoCommand.id);
97
- }
98
- /**
99
- * Adds the specified text to the end of this text region.
100
- * @param text - The text to be added to the end of this text region.
101
- */
102
- appendText(text) {
103
- const unitId = this.id;
104
- const { body } = this.getSnapshot();
105
- if (!body) throw new Error("The document body is empty");
106
- const lastPosition = body.dataStream.length - 2;
107
- const activeRange = {
108
- startOffset: lastPosition,
109
- endOffset: lastPosition,
110
- collapsed: true,
111
- segmentId: ""
112
- };
113
- const { segmentId } = activeRange;
114
- return this._commandService.executeCommand(_univerjs_docs_ui.InsertCommand.id, {
115
- unitId,
116
- body: { dataStream: text },
117
- range: activeRange,
118
- segmentId
119
- });
120
- }
7
+ /**
8
+ * Copyright 2023-present DreamNum Co., Ltd.
9
+ *
10
+ * Licensed under the Apache License, Version 2.0 (the "License");
11
+ * you may not use this file except in compliance with the License.
12
+ * You may obtain a copy of the License at
13
+ *
14
+ * http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ var FDocumentUIMixin = class extends _univerjs_docs_facade.FDocument {
121
23
  /**
122
24
  * Sets the selection to a specified text range in the document.
123
25
  * @param startOffset - The starting offset of the selection in the document.
124
26
  * @param endOffset - The ending offset of the selection in the document.
125
27
  * @example
126
28
  * ```typescript
127
- * document.setSelection(10, 20);
29
+ * const fDocument = univerAPI.getActiveDocument();
30
+ * fDocument.setSelection(10, 20);
128
31
  * ```
129
32
  */
130
33
  setSelection(startOffset, endOffset) {
131
- var _this$_renderManagerS;
132
- const docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.getRenderById(this.getId())) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(_univerjs_docs_ui.DocSelectionRenderService);
34
+ var _renderManagerService;
35
+ const docSelectionRenderService = (_renderManagerService = this._injector.get(_univerjs_engine_render.IRenderManagerService).getRenderUnitById(this.getId())) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(_univerjs_docs_ui.DocSelectionRenderService);
133
36
  docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.removeAllRanges();
134
37
  docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.addDocRanges([{
135
38
  startOffset,
@@ -138,38 +41,6 @@ let FDocument = class FDocument {
138
41
  }], true);
139
42
  }
140
43
  };
141
- FDocument = __decorate([
142
- __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
143
- __decorateParam(2, _univerjs_core.IUniverInstanceService),
144
- __decorateParam(3, _univerjs_core.ICommandService),
145
- __decorateParam(4, _univerjs_core.IResourceManagerService),
146
- __decorateParam(5, _univerjs_engine_render.IRenderManagerService)
147
- ], FDocument);
148
-
149
- //#endregion
150
- //#region src/facade/f-univer.ts
151
- var FUniverDocsUIMixin = class extends _univerjs_core_facade.FUniver {
152
- createUniverDoc(data) {
153
- const document = this._univerInstanceService.createUnit(_univerjs_core.UniverInstanceType.UNIVER_DOC, data);
154
- return this._injector.createInstance(FDocument, document);
155
- }
156
- getActiveDocument() {
157
- const document = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
158
- if (!document) return null;
159
- return this._injector.createInstance(FDocument, document);
160
- }
161
- getUniverDoc(id) {
162
- const document = this._univerInstanceService.getUniverDocInstance(id);
163
- if (!document) return null;
164
- return this._injector.createInstance(FDocument, document);
165
- }
166
- };
167
- _univerjs_core_facade.FUniver.extend(FUniverDocsUIMixin);
44
+ _univerjs_docs_facade.FDocument.extend(FDocumentUIMixin);
168
45
 
169
- //#endregion
170
- Object.defineProperty(exports, 'FDocument', {
171
- enumerable: true,
172
- get: function () {
173
- return FDocument;
174
- }
175
- });
46
+ //#endregion