@univerjs/action-recorder 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.
Files changed (62) hide show
  1. package/lib/cjs/index.js +19 -37
  2. package/lib/cjs/locale/ar-SA.js +1 -2
  3. package/lib/cjs/locale/ca-ES.js +1 -2
  4. package/lib/cjs/locale/de-DE.js +1 -2
  5. package/lib/cjs/locale/en-US.js +1 -2
  6. package/lib/cjs/locale/es-ES.js +1 -2
  7. package/lib/cjs/locale/fa-IR.js +1 -2
  8. package/lib/cjs/locale/fr-FR.js +1 -2
  9. package/lib/cjs/locale/id-ID.js +1 -2
  10. package/lib/cjs/locale/it-IT.js +1 -2
  11. package/lib/cjs/locale/ja-JP.js +1 -2
  12. package/lib/cjs/locale/ko-KR.js +1 -2
  13. package/lib/cjs/locale/pl-PL.js +1 -2
  14. package/lib/cjs/locale/pt-BR.js +1 -2
  15. package/lib/cjs/locale/ru-RU.js +1 -2
  16. package/lib/cjs/locale/sk-SK.js +1 -2
  17. package/lib/cjs/locale/vi-VN.js +1 -2
  18. package/lib/cjs/locale/zh-CN.js +1 -2
  19. package/lib/cjs/locale/zh-HK.js +1 -2
  20. package/lib/cjs/locale/zh-TW.js +1 -2
  21. package/lib/es/index.js +19 -37
  22. package/lib/es/locale/ar-SA.js +1 -2
  23. package/lib/es/locale/ca-ES.js +1 -2
  24. package/lib/es/locale/de-DE.js +1 -2
  25. package/lib/es/locale/en-US.js +1 -2
  26. package/lib/es/locale/es-ES.js +1 -2
  27. package/lib/es/locale/fa-IR.js +1 -2
  28. package/lib/es/locale/fr-FR.js +1 -2
  29. package/lib/es/locale/id-ID.js +1 -2
  30. package/lib/es/locale/it-IT.js +1 -2
  31. package/lib/es/locale/ja-JP.js +1 -2
  32. package/lib/es/locale/ko-KR.js +1 -2
  33. package/lib/es/locale/pl-PL.js +1 -2
  34. package/lib/es/locale/pt-BR.js +1 -2
  35. package/lib/es/locale/ru-RU.js +1 -2
  36. package/lib/es/locale/sk-SK.js +1 -2
  37. package/lib/es/locale/vi-VN.js +1 -2
  38. package/lib/es/locale/zh-CN.js +1 -2
  39. package/lib/es/locale/zh-HK.js +1 -2
  40. package/lib/es/locale/zh-TW.js +1 -2
  41. package/lib/index.js +19 -37
  42. package/lib/locale/ar-SA.js +1 -2
  43. package/lib/locale/ca-ES.js +1 -2
  44. package/lib/locale/de-DE.js +1 -2
  45. package/lib/locale/en-US.js +1 -2
  46. package/lib/locale/es-ES.js +1 -2
  47. package/lib/locale/fa-IR.js +1 -2
  48. package/lib/locale/fr-FR.js +1 -2
  49. package/lib/locale/id-ID.js +1 -2
  50. package/lib/locale/it-IT.js +1 -2
  51. package/lib/locale/ja-JP.js +1 -2
  52. package/lib/locale/ko-KR.js +1 -2
  53. package/lib/locale/pl-PL.js +1 -2
  54. package/lib/locale/pt-BR.js +1 -2
  55. package/lib/locale/ru-RU.js +1 -2
  56. package/lib/locale/sk-SK.js +1 -2
  57. package/lib/locale/vi-VN.js +1 -2
  58. package/lib/locale/zh-CN.js +1 -2
  59. package/lib/locale/zh-HK.js +1 -2
  60. package/lib/locale/zh-TW.js +1 -2
  61. package/lib/umd/index.js +1 -1
  62. package/package.json +13 -13
@@ -1,4 +1,4 @@
1
- //#region src/locale/id-ID.ts
1
+ // src/locale/id-ID.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "Merekam...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/it-IT.ts
1
+ // src/locale/it-IT.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "Registrazione...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/ja-JP.ts
1
+ // src/locale/ja-JP.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "記録中...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/ko-KR.ts
1
+ // src/locale/ko-KR.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "기록 중...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/pl-PL.ts
1
+ // src/locale/pl-PL.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "Nagrywanie...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/pt-BR.ts
1
+ // src/locale/pt-BR.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "Gravando...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/ru-RU.ts
1
+ // src/locale/ru-RU.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "Запись...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/sk-SK.ts
1
+ // src/locale/sk-SK.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "Nahrávanie...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/vi-VN.ts
1
+ // src/locale/vi-VN.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "Đang ghi...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/zh-CN.ts
1
+ // src/locale/zh-CN.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "录制中...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/zh-HK.ts
1
+ // src/locale/zh-HK.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "錄製中...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/zh-TW.ts
1
+ // src/locale/zh-TW.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "錄製中...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
package/lib/index.js CHANGED
@@ -9,15 +9,14 @@ import { RecordIcon } from "@univerjs/icons";
9
9
  import { useCallback } from "react";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
 
12
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
12
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/decorateParam.js
13
13
  function __decorateParam(paramIndex, decorator) {
14
14
  return function(target, key) {
15
15
  decorator(target, key, paramIndex);
16
16
  };
17
17
  }
18
18
 
19
- //#endregion
20
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
19
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/decorate.js
21
20
  function __decorate(decorators, target, key, desc) {
22
21
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
23
22
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -25,8 +24,7 @@ function __decorate(decorators, target, key, desc) {
25
24
  return c > 3 && r && Object.defineProperty(target, key, r), r;
26
25
  }
27
26
 
28
- //#endregion
29
- //#region src/services/replay.service.ts
27
+ // src/services/replay.service.ts
30
28
  let ActionReplayService = class ActionReplayService extends Disposable {
31
29
  constructor(_messageService, _instanceService, _localFileService, _logService, _commandService) {
32
30
  super();
@@ -118,8 +116,7 @@ function randomBetween200And1k() {
118
116
  return Math.floor(Math.random() * 800) + 200;
119
117
  }
120
118
 
121
- //#endregion
122
- //#region src/commands/commands/replay.command.ts
119
+ // src/commands/commands/replay.command.ts
123
120
  const ReplayLocalRecordCommand = {
124
121
  id: "action-recorder.command.replay-local-records",
125
122
  type: CommandType.COMMAND,
@@ -157,8 +154,7 @@ const ReplayLocalRecordOnActiveCommand = {
157
154
  }
158
155
  };
159
156
 
160
- //#endregion
161
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
157
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/typeof.js
162
158
  function _typeof(o) {
163
159
  "@babel/helpers - typeof";
164
160
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -168,8 +164,7 @@ function _typeof(o) {
168
164
  }, _typeof(o);
169
165
  }
170
166
 
171
- //#endregion
172
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
167
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/toPrimitive.js
173
168
  function toPrimitive(t, r) {
174
169
  if ("object" != _typeof(t) || !t) return t;
175
170
  var e = t[Symbol.toPrimitive];
@@ -181,15 +176,13 @@ function toPrimitive(t, r) {
181
176
  return ("string" === r ? String : Number)(t);
182
177
  }
183
178
 
184
- //#endregion
185
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
179
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/toPropertyKey.js
186
180
  function toPropertyKey(t) {
187
181
  var i = toPrimitive(t, "string");
188
182
  return "symbol" == _typeof(i) ? i : i + "";
189
183
  }
190
184
 
191
- //#endregion
192
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
185
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/defineProperty.js
193
186
  function _defineProperty(e, r, t) {
194
187
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
195
188
  value: t,
@@ -199,8 +192,7 @@ function _defineProperty(e, r, t) {
199
192
  }) : e[r] = t, e;
200
193
  }
201
194
 
202
- //#endregion
203
- //#region src/services/action-recorder.service.ts
195
+ // src/services/action-recorder.service.ts
204
196
  let ActionRecorderService = class ActionRecorderService extends Disposable {
205
197
  get recording() {
206
198
  return this._recording$.getValue();
@@ -290,8 +282,7 @@ ActionRecorderService = __decorate([
290
282
  __decorateParam(3, IUniverInstanceService)
291
283
  ], ActionRecorderService);
292
284
 
293
- //#endregion
294
- //#region src/commands/operations/operation.ts
285
+ // src/commands/operations/operation.ts
295
286
  const OpenRecordPanelOperation = {
296
287
  id: "action-recorder.operation.open-panel",
297
288
  type: CommandType.OPERATION,
@@ -309,8 +300,7 @@ const CloseRecordPanelOperation = {
309
300
  }
310
301
  };
311
302
 
312
- //#endregion
313
- //#region src/menu/action-recorder.menu.ts
303
+ // src/menu/action-recorder.menu.ts
314
304
  const RECORD_MENU_ITEM_ID = "RECORD_MENU_ITEM";
315
305
  function RecordMenuItemFactory() {
316
306
  return {
@@ -371,19 +361,16 @@ const menuSchema = { [RibbonOthersGroup.OTHERS]: { [RECORD_MENU_ITEM_ID]: {
371
361
  }
372
362
  } } };
373
363
 
374
- //#endregion
375
- //#region package.json
364
+ // package.json
376
365
  var name = "@univerjs/action-recorder";
377
- var version = "1.3.0";
366
+ var version = "1.4.0";
378
367
 
379
- //#endregion
380
- //#region src/config/config.ts
368
+ // src/config/config.ts
381
369
  const ACTION_RECORDER_PLUGIN_CONFIG_KEY = "action-recorder.config";
382
370
  const configSymbol = Symbol(ACTION_RECORDER_PLUGIN_CONFIG_KEY);
383
371
  const defaultPluginConfig = {};
384
372
 
385
- //#endregion
386
- //#region src/commands/commands/record.command.ts
373
+ // src/commands/commands/record.command.ts
387
374
  const StartRecordingActionCommand = {
388
375
  id: "action-recorder.command.start-recording",
389
376
  type: CommandType.COMMAND,
@@ -409,8 +396,7 @@ const StopRecordingActionCommand = {
409
396
  }
410
397
  };
411
398
 
412
- //#endregion
413
- //#region src/views/components/RecorderPanel.tsx
399
+ // src/views/components/RecorderPanel.tsx
414
400
  function RecorderPanel() {
415
401
  const s = useDependency(ActionRecorderService);
416
402
  if (!useObservable(s.panelOpened$)) return null;
@@ -472,8 +458,7 @@ function RecordPanelImpl() {
472
458
  });
473
459
  }
474
460
 
475
- //#endregion
476
- //#region src/controllers/action-recorder.controller.ts
461
+ // src/controllers/action-recorder.controller.ts
477
462
  /**
478
463
  * Copyright 2023-present DreamNum Co., Ltd.
479
464
  *
@@ -583,8 +568,7 @@ ActionRecorderController = __decorate([
583
568
  __decorateParam(4, Inject(Injector))
584
569
  ], ActionRecorderController);
585
570
 
586
- //#endregion
587
- //#region src/controllers/components.controller.ts
571
+ // src/controllers/components.controller.ts
588
572
  /**
589
573
  * Copyright 2023-present DreamNum Co., Ltd.
590
574
  *
@@ -613,8 +597,7 @@ let ComponentsController = class ComponentsController extends Disposable {
613
597
  };
614
598
  ComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager)), __decorateParam(1, Inject(IconManager))], ComponentsController);
615
599
 
616
- //#endregion
617
- //#region src/plugin.ts
600
+ // src/plugin.ts
618
601
  let UniverActionRecorderPlugin = class UniverActionRecorderPlugin extends Plugin {
619
602
  constructor(_config = defaultPluginConfig, _injector, _configService) {
620
603
  super();
@@ -644,5 +627,4 @@ _defineProperty(UniverActionRecorderPlugin, "packageName", name);
644
627
  _defineProperty(UniverActionRecorderPlugin, "version", version);
645
628
  UniverActionRecorderPlugin = __decorate([__decorateParam(1, Inject(Injector)), __decorateParam(2, IConfigService)], UniverActionRecorderPlugin);
646
629
 
647
- //#endregion
648
630
  export { menuSchema as ActionRecorderMenuSchema, ActionRecorderService, ActionReplayService, UniverActionRecorderPlugin };
@@ -1,4 +1,4 @@
1
- //#region src/locale/ar-SA.ts
1
+ // src/locale/ar-SA.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "جارٍ التسجيل...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/ca-ES.ts
1
+ // src/locale/ca-ES.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "S'està enregistrant...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/de-DE.ts
1
+ // src/locale/de-DE.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "Aufnahme läuft...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/en-US.ts
1
+ // src/locale/en-US.ts
2
2
  /**
3
3
  * Copyright 2023-present DreamNum Co., Ltd.
4
4
  *
@@ -33,5 +33,4 @@ const locale = { "action-recorder": {
33
33
  }
34
34
  } };
35
35
 
36
- //#endregion
37
36
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/es-ES.ts
1
+ // src/locale/es-ES.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "Grabando...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/fa-IR.ts
1
+ // src/locale/fa-IR.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "در حال ضبط...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/fr-FR.ts
1
+ // src/locale/fr-FR.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "Enregistrement...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/id-ID.ts
1
+ // src/locale/id-ID.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "Merekam...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/it-IT.ts
1
+ // src/locale/it-IT.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "Registrazione...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/ja-JP.ts
1
+ // src/locale/ja-JP.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "記録中...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/ko-KR.ts
1
+ // src/locale/ko-KR.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "기록 중...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/pl-PL.ts
1
+ // src/locale/pl-PL.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "Nagrywanie...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/pt-BR.ts
1
+ // src/locale/pt-BR.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "Gravando...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/ru-RU.ts
1
+ // src/locale/ru-RU.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "Запись...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/sk-SK.ts
1
+ // src/locale/sk-SK.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "Nahrávanie...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/vi-VN.ts
1
+ // src/locale/vi-VN.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "Đang ghi...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/zh-CN.ts
1
+ // src/locale/zh-CN.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "录制中...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/zh-HK.ts
1
+ // src/locale/zh-HK.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "錄製中...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
@@ -1,4 +1,4 @@
1
- //#region src/locale/zh-TW.ts
1
+ // src/locale/zh-TW.ts
2
2
  const locale = { "action-recorder": {
3
3
  panel: {
4
4
  recording: "錄製中...",
@@ -18,5 +18,4 @@ const locale = { "action-recorder": {
18
18
  }
19
19
  } };
20
20
 
21
- //#endregion
22
21
  export { locale as default };
package/lib/umd/index.js CHANGED
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/ui"),require("@univerjs/core"),require("@univerjs/design"),require("@univerjs/sheets"),require("rxjs"),require("@univerjs/sheets-filter"),require("@univerjs/sheets-ui"),require("react"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/ui`,`@univerjs/core`,`@univerjs/design`,`@univerjs/sheets`,`rxjs`,`@univerjs/sheets-filter`,`@univerjs/sheets-ui`,`react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverActionRecorder={},e.UniverUi,e.UniverCore,e.UniverDesign,e.UniverSheets,e.rxjs,e.UniverSheetsFilter,e.UniverSheetsUi,e.React,e.React))})(this,function(e,t,n,r,i,a,o,s,c,l){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function u(e,t){return function(n,r){t(n,r,e)}}function d(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let f=class extends n.Disposable{constructor(e,t,n,r,i){super(),this._messageService=e,this._instanceService=t,this._localFileService=n,this._logService=r,this._commandService=i}async replayLocalJSON(e=`default`){let t=await this._localFileService.openFile({multiple:!1,accept:`.json`});if(t.length!==1)return!1;let n=t[0];try{return this.replayCommands(JSON.parse(await n.text()),{mode:e})}catch{return this._messageService.show({type:r.MessageType.Error,content:`Failed to replay commands from local file ${n.name}.`}),!1}}async replayCommands(e,t){var n;let r=(n=this._instanceService.getFocusedUnit())==null?void 0:n.getUnitId();r||this._logService.error(`[ReplayService]`,`no focused unit to replay commands`);let{mode:i}=t||{};for(let t of e){let{id:e,params:n}=t,s=n;if(s){if(s.unitId!==void 0&&(s.unitId=r),i===`name`&&s.subUnitId!==`undefined`){var a;let e=(a=this._instanceService.getFocusedUnit().getSheetBySheetName(s.subUnitId))==null?void 0:a.getSheetId();e?s.subUnitId=e:this._logService.error(`[ReplayService]`,`failed to find subunit by subUnitName = ${s.subUnitId}`)}if(i===`active`&&s.subUnitId!==`undefined`){var o;let e=(o=this._instanceService.getFocusedUnit().getActiveSheet())==null?void 0:o.getSheetId();e?s.subUnitId=e:this._logService.error(`[ReplayService]`,`failed to find active subunit`)}if(!await this._commandService.executeCommand(e,n))return!1}else if(!await this._commandService.executeCommand(e))return!1}return!0}async replayCommandsWithDelay(e){var t;let r=(t=this._instanceService.getFocusedUnit())==null?void 0:t.getUnitId();r||this._logService.error(`[ReplayService]`,`no focused unit to replay commands`);for(let t of e){await(0,n.awaitTime)(p());let{id:e,params:i}=t;if(i){if(i.unitId!==void 0&&(i.unitId=r),!await this._commandService.executeCommand(e,i))return!1}else if(!await this._commandService.executeCommand(e))return!1}return!0}};f=d([u(0,t.IMessageService),u(1,n.IUniverInstanceService),u(2,t.ILocalFileService),u(3,n.ILogService),u(4,n.ICommandService)],f);function p(){return Math.floor(Math.random()*800)+200}let m={id:`action-recorder.command.replay-local-records`,type:n.CommandType.COMMAND,handler:async e=>{let n=await e.get(f).replayLocalJSON();return n&&e.get(t.IMessageService).show({type:r.MessageType.Success,content:`Successfully replayed local records`}),n}},h={id:`action-recorder.command.replay-local-records-name`,type:n.CommandType.COMMAND,handler:async e=>{let n=await e.get(f).replayLocalJSON(`name`);return n&&e.get(t.IMessageService).show({type:r.MessageType.Success,content:`Successfully replayed local records`}),n}},g={id:`action-recorder.command.replay-local-records-active`,type:n.CommandType.COMMAND,handler:async e=>{let n=await e.get(f).replayLocalJSON(`active`);return n&&e.get(t.IMessageService).show({type:r.MessageType.Success,content:`Successfully replayed local records`}),n}};function _(e){"@babel/helpers - typeof";return _=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},_(e)}function v(e,t){if(_(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(_(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function y(e){var t=v(e,`string`);return _(t)==`symbol`?t:t+``}function b(e,t,n){return(t=y(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let x=class extends n.Disposable{get recording(){return this._recording$.getValue()}get _recorded(){return this._recorded$.getValue()}get _recordedCommands(){return this._recordedCommands$.getValue()}constructor(e,t,n,r){super(),this._commandSrv=e,this._logService=t,this._localFileService=n,this._instanceService=r,b(this,`_shouldRecordCommands`,/* @__PURE__ */ new Set),b(this,`_panelOpened$`,new a.BehaviorSubject(!1)),b(this,`panelOpened$`,this._panelOpened$.asObservable()),b(this,`_recorder`,null),b(this,`_recording$`,new a.BehaviorSubject(!1)),b(this,`recording$`,this._recording$.asObservable()),b(this,`_recorded$`,new a.BehaviorSubject([])),b(this,`_recordedCommands$`,new a.BehaviorSubject([])),b(this,`recordedCommands$`,this._recordedCommands$.asObservable())}registerRecordedCommand(e){if(e.type===n.CommandType.MUTATION)throw Error(`[CommandRecorderService] Cannot record mutation commands.`);this._shouldRecordCommands.add(e.id)}togglePanel(e){this._panelOpened$.next(e),e===!1&&this.stopRecording()}startRecording(e=!1){this._recorder=this._commandSrv.onCommandExecuted(t=>{if(this._shouldRecordCommands.has(t.id)){var r;let o=this._recorded,s=this._recordedCommands,c={...t},l=(r=this._instanceService.getFocusedUnit())==null?void 0:r.getUnitId(),{unitId:u=l,subUnitId:d}=c==null?void 0:c.params;if(e&&u&&d){var a;let e=(a=this._instanceService.getUnit(u).getSheetBySheetId(d))==null?void 0:a.getName();c={...c,params:{...c.params,subUnitId:e}}}c.id===i.SetSelectionsOperation.id&&o.length>0&&o[o.length-1].id===i.SetSelectionsOperation.id?o[o.length-1]=c:(o.push(c),this._recorded$.next(o),c.type===n.CommandType.COMMAND&&(s.push(c),this._recordedCommands$.next(s)))}}),this._recording$.next(!0)}stopRecording(){var e;(e=this._recorder)==null||e.dispose(),this._recorder=null,this._recorded$.next([]),this._recordedCommands$.next([]),this._recording$.next(!1)}completeRecording(){let e=this._recorded.slice();this._localFileService.downloadFile(new Blob([JSON.stringify(e,null,2)]),`recorded-commands.json`),this._logService.error(`Recorded commands:`,e),this.stopRecording()}};x=d([u(0,n.ICommandService),u(1,n.ILogService),u(2,t.ILocalFileService),u(3,n.IUniverInstanceService)],x);let S={id:`action-recorder.operation.open-panel`,type:n.CommandType.OPERATION,handler(e){return e.get(x).togglePanel(!0),!0}},C={id:`action-recorder.operation.close-panel`,type:n.CommandType.OPERATION,handler(e){return e.get(x).togglePanel(!1),!0}},w=`RECORD_MENU_ITEM`;function T(){return{id:w,type:t.MenuItemType.SUBITEMS,icon:`RecordIcon`,tooltip:`action-recorder.menu.title`}}function E(e){let n=e.get(x);return{id:S.id,title:`action-recorder.menu.record`,type:t.MenuItemType.BUTTON,disabled$:n.panelOpened$}}function D(){return{id:m.id,title:`action-recorder.menu.replay-local`,type:t.MenuItemType.BUTTON}}function O(){return{id:h.id,title:`action-recorder.menu.replay-local-name`,type:t.MenuItemType.BUTTON}}function k(){return{id:g.id,title:`action-recorder.menu.replay-local-active`,type:t.MenuItemType.BUTTON}}let A={[t.RibbonOthersGroup.OTHERS]:{[w]:{order:1,menuItemFactory:T,[S.id]:{order:1,menuItemFactory:E},[m.id]:{order:2,menuItemFactory:D},[h.id]:{order:3,menuItemFactory:O},[g.id]:{order:4,menuItemFactory:k}}}};var j=`@univerjs/action-recorder`,M=`1.3.0`;let N={},P={id:`action-recorder.command.start-recording`,type:n.CommandType.COMMAND,handler:(e,t)=>(e.get(x).startRecording(!!(t!=null&&t.replaceId)),!0)},F={id:`action-recorder.command.complete-recording`,type:n.CommandType.COMMAND,handler:e=>(e.get(x).completeRecording(),!0)},I={id:`action-recorder.command.stop-recording`,type:n.CommandType.COMMAND,handler:e=>(e.get(x).completeRecording(),!0)};function L({ref:e,...t}){let{preserveStrokeWidth:n,icon:r,id:i,className:a,extend:o,...s}=t,l=`univerjs-icon univerjs-icon-${i} ${a||``}`.trim(),u=`_${(0,c.useId)()}`,d=(0,c.useRef)(null);return(0,c.useImperativeHandle)(e,()=>d.current),(0,c.useLayoutEffect)(()=>{if(n&&d.current&&d.current.localName===r.tag)return V(d.current)},[n,r]),R(r,`${i}`,{defIds:r.defIds,idSuffix:u},{ref:d,className:l,...s},o)}function R(e,t,n,r,i){return(0,c.createElement)(e.tag,{key:t,...z(e,n,i),...r},(B(e,n).children||[]).map((r,a)=>R(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function z(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),n!=null&&n.colorChannel1&&r.stroke===`colorChannel1`&&(r.stroke=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0||(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))})),r}function B(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function V(e){let t=e.viewBox.baseVal,n=Math.max(t.width,t.height);if(!Number.isFinite(n)||n<=0||t.width<=0||t.height<=0)return()=>void 0;let r=16/n,i=Array.from(e.querySelectorAll(`circle, ellipse, line, path, polygon, polyline, rect, text, textPath, tspan, use`)).flatMap(e=>{let t=getComputedStyle(e),n=Number.parseFloat(t.strokeWidth);return t.stroke===`none`||Number.parseFloat(t.strokeOpacity)===0||t.vectorEffect===`non-scaling-stroke`||!Number.isFinite(n)||n<=0?[]:[{element:e,hadStyleAttribute:e.hasAttribute(`style`),originalStrokeWidth:n,strokeWidth:H(e.style,`stroke-width`)}]}).map(e=>({appliedStrokeWidth:null,element:e.element,hadStyleAttribute:e.hadStyleAttribute,isReleased:!1,originalStrokeWidth:e.originalStrokeWidth,strokeWidth:e.strokeWidth}));if(i.length===0)return()=>void 0;let a=(e,n)=>{if(t.width<=0||t.height<=0||e<=0||n<=0)return;let a=Math.min(e/t.width,n/t.height);!Number.isFinite(a)||a<=0||i.forEach(e=>{if(e.isReleased)return;if(e.appliedStrokeWidth!==null&&(e.element.style.getPropertyValue(`stroke-width`)!==e.appliedStrokeWidth||e.element.style.getPropertyPriority(`stroke-width`)!==e.strokeWidth.priority)){e.appliedStrokeWidth=null,e.isReleased=!0;return}let t=e.originalStrokeWidth*r/a,n=`${Number(t.toFixed(12))}px`;e.element.style.setProperty(`stroke-width`,n,e.strokeWidth.priority),e.appliedStrokeWidth=n})},o=e.getBoundingClientRect();a(o.width,o.height);let s=typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{if(t.some(t=>t.target===e)){let t=e.getBoundingClientRect();a(t.width,t.height)}});return s==null||s.observe(e),()=>{s==null||s.disconnect(),i.forEach(e=>{e.appliedStrokeWidth!==null&&(U(e.element.style,`stroke-width`,e.appliedStrokeWidth,e.strokeWidth.priority,e.strokeWidth),!e.hadStyleAttribute&&e.element.style.length===0&&e.element.removeAttribute(`style`))})}}function H(e,t){return{priority:e.getPropertyPriority(t),value:e.getPropertyValue(t)}}function U(e,t,n,r,i){e.getPropertyValue(t)===n&&e.getPropertyPriority(t)===r&&(i.value?e.setProperty(t,i.value,i.priority):e.removeProperty(t))}L.displayName=`UniverIcon`;let W={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 16`,width:`1em`,height:`1em`},children:[{tag:`g`,attrs:{fill:`currentColor`,clipPath:`url(#record-icon_clip0_1559_19)`},children:[{tag:`path`,attrs:{d:`M7.60303 10C8.7076 10 9.60303 9.10457 9.60303 8C9.60303 6.89543 8.7076 6 7.60303 6C6.49846 6 5.60303 6.89543 5.60303 8C5.60303 9.10457 6.49846 10 7.60303 10Z`}},{tag:`path`,attrs:{d:`M1.66943 5.29023C1.66941 3.85426 2.83349 2.69017 4.26946 2.69019L10.9362 2.69026C12.3192 2.69028 13.45 3.77008 13.5315 5.13259L14.5692 4.55638C15.3024 4.14929 16.2032 4.67947 16.2032 5.51809V10.4819C16.2032 11.3205 15.3024 11.8507 14.5692 11.4436L13.5315 10.8674C13.45 12.2299 12.3192 13.3097 10.9362 13.3097H4.26953C2.83361 13.3097 1.66956 12.1457 1.66953 10.7098L1.66943 5.29023ZM13.5362 9.49743L15.0032 10.312V5.68799L13.5362 6.50254V9.49743ZM4.26945 3.89019C3.49623 3.89018 2.86942 4.517 2.86943 5.29021L2.86953 10.7098C2.86955 11.483 3.49634 12.1097 4.26953 12.1097H10.9362C11.7094 12.1097 12.3362 11.4829 12.3362 10.7097V5.29026C12.3362 4.51707 11.7094 3.89027 10.9362 3.89026L4.26945 3.89019Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},{tag:`defs`,attrs:{},children:[{tag:`clipPath`,attrs:{id:`record-icon_clip0_1559_19`},children:[{tag:`path`,attrs:{fill:`white`,d:`M0 0H16V16H0z`,transform:`translate(.94)`}}]}]}],defIds:[`record-icon_clip0_1559_19`]},G=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(L,Object.assign({},e,{id:`record-icon`,ref:t,icon:W}))});G.displayName=`RecordIcon`;function K(){let e=(0,t.useDependency)(x);return(0,t.useObservable)(e.panelOpened$)?/* @__PURE__ */ (0,l.jsx)(q,{}):null}function q(){let e=(0,t.useDependency)(n.ICommandService),i=(0,t.useDependency)(n.LocaleService),a=(0,t.useDependency)(x),o=(0,t.useObservable)(a.recording$),s=(0,t.useObservable)(a.recordedCommands$),u=(s==null?void 0:s.length)??0,d=(0,c.useCallback)(()=>{o||e.executeCommand(C.id)},[e,o]),f=(0,c.useCallback)(t=>{o||e.executeCommand(P.id,{replaceId:t})},[e,o]),p=(0,c.useCallback)(()=>{o&&e.executeCommand(F.id)},[e,o]),m=(0,c.useCallback)(()=>{o&&e.executeCommand(I.id)},[e,o]),h=o?u===0?i.t(`action-recorder.panel.recording`):`${u}: ${s[u-1].id}`:i.t(`action-recorder.panel.startRecording`);return/* @__PURE__ */ (0,l.jsxs)(`div`,{className:`univer-fixed univer-bottom-20 univer-left-1/2 univer-z-[1000] univer-flex univer-h-16 univer-w-[512px] -univer-translate-x-1/2 univer-items-center univer-rounded-lg univer-bg-gray-0 univer-px-5 univer-shadow-lg`,children:[/* @__PURE__ */ (0,l.jsx)(`div`,{className:`univer-mr-2 univer-size-5 univer-shrink-0 univer-grow-0 univer-text-xl`,children:/* @__PURE__ */ (0,l.jsx)(G,{})}),/* @__PURE__ */ (0,l.jsx)(`div`,{className:`univer-flex-1 univer-text-sm`,children:h}),/* @__PURE__ */ (0,l.jsxs)(`div`,{className:`univer-flex univer-w-64 univer-shrink-0 univer-grow-0 univer-justify-between`,children:[/* @__PURE__ */ (0,l.jsx)(r.Button,{className:`univer-w-20`,onClick:o?m:d,children:i.t(o?`action-recorder.panel.cancel`:`action-recorder.panel.close`)}),/* @__PURE__ */ (0,l.jsx)(r.Button,{className:`univer-w-20`,variant:`primary`,onClick:o?p:()=>f(),children:i.t(o?`action-recorder.panel.save`:`action-recorder.panel.start`)}),!o&&/* @__PURE__ */ (0,l.jsx)(r.Button,{variant:`primary`,onClick:()=>f(!0),children:i.t(`action-recorder.panel.startWithId`)})]})]})}let J=class extends n.Disposable{constructor(e,t,n,r,i){super(),this._commandSrv=e,this._uiPartsSrv=t,this._menuManagerService=n,this._actionRecorderService=r,this._injector=i,this._initCommands(),this._initUI(),this._initSheetsCommands(),this._initDocsCommands()}_initCommands(){[P,I,F,S,C,m,h,g].forEach(e=>this._commandSrv.registerCommand(e))}_initUI(){this._uiPartsSrv.registerComponent(t.BuiltInUIPart.GLOBAL,()=>(0,t.connectInjector)(K,this._injector)),this._menuManagerService.mergeMenu(A)}_initSheetsCommands(){[i.CopySheetCommand,i.DeleteRangeMoveLeftCommand,i.DeleteRangeMoveUpCommand,i.DeltaColumnWidthCommand,i.DeltaRowHeightCommand,i.InsertSheetCommand,i.InsertColAfterCommand,i.InsertColBeforeCommand,i.InsertRowAfterCommand,i.InsertRowBeforeCommand,i.RemoveSheetCommand,i.SetStyleCommand,i.AddWorksheetMergeCommand,i.AddWorksheetMergeAllCommand,i.AddWorksheetMergeVerticalCommand,i.AddWorksheetMergeHorizontalCommand,i.SetFrozenCommand,i.CancelFrozenCommand,i.SetHorizontalTextAlignCommand,i.SetOverlineCommand,s.SetRangeBoldCommand,s.SetRangeFontFamilyCommand,s.SetRangeFontSizeCommand,s.SetRangeItalicCommand,s.SetRangeStrickThroughCommand,s.SetRangeSubscriptCommand,s.SetRangeSuperscriptCommand,s.SetRangeTextColorCommand,s.SetRangeUnderlineCommand,i.SetRangeValuesCommand,i.SetStrikeThroughCommand,i.SetTextColorCommand,i.SetTextRotationCommand,i.SetTextWrapCommand,i.SetVerticalTextAlignCommand,s.SheetCopyCommand,s.SheetCutCommand,s.SheetPasteBesidesBorderCommand,s.SheetPasteColWidthCommand,s.SheetPasteCommand,s.SheetPasteFormatCommand,s.SheetPasteShortKeyCommand,s.SheetPasteValueCommand,i.AutoFillCommand,i.RefillCommand,i.SetWorksheetActivateCommand,i.SetWorksheetActiveOperation,i.SetSelectionsOperation,o.SetSheetFilterRangeCommand,o.SetSheetsFilterCriteriaCommand,o.RemoveSheetFilterCommand].forEach(e=>this._actionRecorderService.registerRecordedCommand(e))}_initDocsCommands(){}};J=d([u(0,n.ICommandService),u(1,t.IUIPartsService),u(2,t.IMenuManagerService),u(3,(0,n.Inject)(x)),u(4,(0,n.Inject)(n.Injector))],J);let Y=class extends n.Disposable{constructor(e,t){super(),this._componentManager=e,this._iconManager=t,this._registerIcons()}_registerIcons(){this.disposeWithMe(this._iconManager.register({RecordIcon:G}))}};Y=d([u(0,(0,n.Inject)(t.ComponentManager)),u(1,(0,n.Inject)(t.IconManager))],Y);let X=class extends n.Plugin{constructor(e=N,t,r){super(),this._config=e,this._injector=t,this._configService=r;let{menu:i,...a}=(0,n.merge)({},N,this._config);i&&this._configService.setConfig(`menu`,i,{merge:!0}),this._configService.setConfig(`action-recorder.config`,a)}onStarting(){this._injector.add([Y]),this._injector.get(Y),(this._config.replayOnly?[[f]]:[[x],[f],[J]]).forEach(e=>this._injector.add(e))}onSteady(){this._config.replayOnly||this._injector.get(J)}};b(X,`pluginName`,`UNIVER_ACTION_RECORDER_PLUGIN`),b(X,`packageName`,j),b(X,`version`,M),X=d([u(1,(0,n.Inject)(n.Injector)),u(2,n.IConfigService)],X),e.ActionRecorderMenuSchema=A,Object.defineProperty(e,"ActionRecorderService",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"ActionReplayService",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"UniverActionRecorderPlugin",{enumerable:!0,get:function(){return X}})});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/ui"),require("@univerjs/core"),require("@univerjs/design"),require("@univerjs/sheets"),require("rxjs"),require("@univerjs/sheets-filter"),require("@univerjs/sheets-ui"),require("react"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/ui`,`@univerjs/core`,`@univerjs/design`,`@univerjs/sheets`,`rxjs`,`@univerjs/sheets-filter`,`@univerjs/sheets-ui`,`react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverActionRecorder={},e.UniverUi,e.UniverCore,e.UniverDesign,e.UniverSheets,e.rxjs,e.UniverSheetsFilter,e.UniverSheetsUi,e.React,e.React))})(this,function(e,t,n,r,i,a,o,s,c,l){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function u(e,t){return function(n,r){t(n,r,e)}}function d(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let f=class extends n.Disposable{constructor(e,t,n,r,i){super(),this._messageService=e,this._instanceService=t,this._localFileService=n,this._logService=r,this._commandService=i}async replayLocalJSON(e=`default`){let t=await this._localFileService.openFile({multiple:!1,accept:`.json`});if(t.length!==1)return!1;let n=t[0];try{return this.replayCommands(JSON.parse(await n.text()),{mode:e})}catch{return this._messageService.show({type:r.MessageType.Error,content:`Failed to replay commands from local file ${n.name}.`}),!1}}async replayCommands(e,t){var n;let r=(n=this._instanceService.getFocusedUnit())==null?void 0:n.getUnitId();r||this._logService.error(`[ReplayService]`,`no focused unit to replay commands`);let{mode:i}=t||{};for(let t of e){let{id:e,params:n}=t,s=n;if(s){if(s.unitId!==void 0&&(s.unitId=r),i===`name`&&s.subUnitId!==`undefined`){var a;let e=(a=this._instanceService.getFocusedUnit().getSheetBySheetName(s.subUnitId))==null?void 0:a.getSheetId();e?s.subUnitId=e:this._logService.error(`[ReplayService]`,`failed to find subunit by subUnitName = ${s.subUnitId}`)}if(i===`active`&&s.subUnitId!==`undefined`){var o;let e=(o=this._instanceService.getFocusedUnit().getActiveSheet())==null?void 0:o.getSheetId();e?s.subUnitId=e:this._logService.error(`[ReplayService]`,`failed to find active subunit`)}if(!await this._commandService.executeCommand(e,n))return!1}else if(!await this._commandService.executeCommand(e))return!1}return!0}async replayCommandsWithDelay(e){var t;let r=(t=this._instanceService.getFocusedUnit())==null?void 0:t.getUnitId();r||this._logService.error(`[ReplayService]`,`no focused unit to replay commands`);for(let t of e){await(0,n.awaitTime)(p());let{id:e,params:i}=t;if(i){if(i.unitId!==void 0&&(i.unitId=r),!await this._commandService.executeCommand(e,i))return!1}else if(!await this._commandService.executeCommand(e))return!1}return!0}};f=d([u(0,t.IMessageService),u(1,n.IUniverInstanceService),u(2,t.ILocalFileService),u(3,n.ILogService),u(4,n.ICommandService)],f);function p(){return Math.floor(Math.random()*800)+200}let m={id:`action-recorder.command.replay-local-records`,type:n.CommandType.COMMAND,handler:async e=>{let n=await e.get(f).replayLocalJSON();return n&&e.get(t.IMessageService).show({type:r.MessageType.Success,content:`Successfully replayed local records`}),n}},h={id:`action-recorder.command.replay-local-records-name`,type:n.CommandType.COMMAND,handler:async e=>{let n=await e.get(f).replayLocalJSON(`name`);return n&&e.get(t.IMessageService).show({type:r.MessageType.Success,content:`Successfully replayed local records`}),n}},g={id:`action-recorder.command.replay-local-records-active`,type:n.CommandType.COMMAND,handler:async e=>{let n=await e.get(f).replayLocalJSON(`active`);return n&&e.get(t.IMessageService).show({type:r.MessageType.Success,content:`Successfully replayed local records`}),n}};function _(e){"@babel/helpers - typeof";return _=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},_(e)}function v(e,t){if(_(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(_(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function y(e){var t=v(e,`string`);return _(t)==`symbol`?t:t+``}function b(e,t,n){return(t=y(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let x=class extends n.Disposable{get recording(){return this._recording$.getValue()}get _recorded(){return this._recorded$.getValue()}get _recordedCommands(){return this._recordedCommands$.getValue()}constructor(e,t,n,r){super(),this._commandSrv=e,this._logService=t,this._localFileService=n,this._instanceService=r,b(this,`_shouldRecordCommands`,/* @__PURE__ */ new Set),b(this,`_panelOpened$`,new a.BehaviorSubject(!1)),b(this,`panelOpened$`,this._panelOpened$.asObservable()),b(this,`_recorder`,null),b(this,`_recording$`,new a.BehaviorSubject(!1)),b(this,`recording$`,this._recording$.asObservable()),b(this,`_recorded$`,new a.BehaviorSubject([])),b(this,`_recordedCommands$`,new a.BehaviorSubject([])),b(this,`recordedCommands$`,this._recordedCommands$.asObservable())}registerRecordedCommand(e){if(e.type===n.CommandType.MUTATION)throw Error(`[CommandRecorderService] Cannot record mutation commands.`);this._shouldRecordCommands.add(e.id)}togglePanel(e){this._panelOpened$.next(e),e===!1&&this.stopRecording()}startRecording(e=!1){this._recorder=this._commandSrv.onCommandExecuted(t=>{if(this._shouldRecordCommands.has(t.id)){var r;let o=this._recorded,s=this._recordedCommands,c={...t},l=(r=this._instanceService.getFocusedUnit())==null?void 0:r.getUnitId(),{unitId:u=l,subUnitId:d}=c==null?void 0:c.params;if(e&&u&&d){var a;let e=(a=this._instanceService.getUnit(u).getSheetBySheetId(d))==null?void 0:a.getName();c={...c,params:{...c.params,subUnitId:e}}}c.id===i.SetSelectionsOperation.id&&o.length>0&&o[o.length-1].id===i.SetSelectionsOperation.id?o[o.length-1]=c:(o.push(c),this._recorded$.next(o),c.type===n.CommandType.COMMAND&&(s.push(c),this._recordedCommands$.next(s)))}}),this._recording$.next(!0)}stopRecording(){var e;(e=this._recorder)==null||e.dispose(),this._recorder=null,this._recorded$.next([]),this._recordedCommands$.next([]),this._recording$.next(!1)}completeRecording(){let e=this._recorded.slice();this._localFileService.downloadFile(new Blob([JSON.stringify(e,null,2)]),`recorded-commands.json`),this._logService.error(`Recorded commands:`,e),this.stopRecording()}};x=d([u(0,n.ICommandService),u(1,n.ILogService),u(2,t.ILocalFileService),u(3,n.IUniverInstanceService)],x);let S={id:`action-recorder.operation.open-panel`,type:n.CommandType.OPERATION,handler(e){return e.get(x).togglePanel(!0),!0}},C={id:`action-recorder.operation.close-panel`,type:n.CommandType.OPERATION,handler(e){return e.get(x).togglePanel(!1),!0}},w=`RECORD_MENU_ITEM`;function T(){return{id:w,type:t.MenuItemType.SUBITEMS,icon:`RecordIcon`,tooltip:`action-recorder.menu.title`}}function E(e){let n=e.get(x);return{id:S.id,title:`action-recorder.menu.record`,type:t.MenuItemType.BUTTON,disabled$:n.panelOpened$}}function D(){return{id:m.id,title:`action-recorder.menu.replay-local`,type:t.MenuItemType.BUTTON}}function O(){return{id:h.id,title:`action-recorder.menu.replay-local-name`,type:t.MenuItemType.BUTTON}}function k(){return{id:g.id,title:`action-recorder.menu.replay-local-active`,type:t.MenuItemType.BUTTON}}let A={[t.RibbonOthersGroup.OTHERS]:{[w]:{order:1,menuItemFactory:T,[S.id]:{order:1,menuItemFactory:E},[m.id]:{order:2,menuItemFactory:D},[h.id]:{order:3,menuItemFactory:O},[g.id]:{order:4,menuItemFactory:k}}}};var j=`@univerjs/action-recorder`,M=`1.4.0`;let N={},P={id:`action-recorder.command.start-recording`,type:n.CommandType.COMMAND,handler:(e,t)=>(e.get(x).startRecording(!!(t!=null&&t.replaceId)),!0)},F={id:`action-recorder.command.complete-recording`,type:n.CommandType.COMMAND,handler:e=>(e.get(x).completeRecording(),!0)},I={id:`action-recorder.command.stop-recording`,type:n.CommandType.COMMAND,handler:e=>(e.get(x).completeRecording(),!0)};function L({ref:e,...t}){let{preserveStrokeWidth:n,icon:r,id:i,className:a,extend:o,...s}=t,l=`univerjs-icon univerjs-icon-${i} ${a||``}`.trim(),u=`_${(0,c.useId)()}`,d=(0,c.useRef)(null);return(0,c.useImperativeHandle)(e,()=>d.current),(0,c.useLayoutEffect)(()=>{if(n&&d.current&&d.current.localName===r.tag)return V(d.current)},[n,r]),R(r,`${i}`,{defIds:r.defIds,idSuffix:u},{ref:d,className:l,...s},o)}function R(e,t,n,r,i){return(0,c.createElement)(e.tag,{key:t,...z(e,n,i),...r},(B(e,n).children||[]).map((r,a)=>R(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function z(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),n!=null&&n.colorChannel1&&r.stroke===`colorChannel1`&&(r.stroke=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0||(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))})),r}function B(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function V(e){let t=e.viewBox.baseVal,n=Math.max(t.width,t.height);if(!Number.isFinite(n)||n<=0||t.width<=0||t.height<=0)return()=>void 0;let r=16/n,i=Array.from(e.querySelectorAll(`circle, ellipse, line, path, polygon, polyline, rect, text, textPath, tspan, use`)).flatMap(e=>{let t=getComputedStyle(e),n=Number.parseFloat(t.strokeWidth);return t.stroke===`none`||Number.parseFloat(t.strokeOpacity)===0||t.vectorEffect===`non-scaling-stroke`||!Number.isFinite(n)||n<=0?[]:[{element:e,hadStyleAttribute:e.hasAttribute(`style`),originalStrokeWidth:n,strokeWidth:H(e.style,`stroke-width`)}]}).map(e=>({appliedStrokeWidth:null,element:e.element,hadStyleAttribute:e.hadStyleAttribute,isReleased:!1,originalStrokeWidth:e.originalStrokeWidth,strokeWidth:e.strokeWidth}));if(i.length===0)return()=>void 0;let a=(e,n)=>{if(t.width<=0||t.height<=0||e<=0||n<=0)return;let a=Math.min(e/t.width,n/t.height);!Number.isFinite(a)||a<=0||i.forEach(e=>{if(e.isReleased)return;if(e.appliedStrokeWidth!==null&&(e.element.style.getPropertyValue(`stroke-width`)!==e.appliedStrokeWidth||e.element.style.getPropertyPriority(`stroke-width`)!==e.strokeWidth.priority)){e.appliedStrokeWidth=null,e.isReleased=!0;return}let t=e.originalStrokeWidth*r/a,n=`${Number(t.toFixed(12))}px`;e.element.style.setProperty(`stroke-width`,n,e.strokeWidth.priority),e.appliedStrokeWidth=n})},o=e.getBoundingClientRect();a(o.width,o.height);let s=typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{if(t.some(t=>t.target===e)){let t=e.getBoundingClientRect();a(t.width,t.height)}});return s==null||s.observe(e),()=>{s==null||s.disconnect(),i.forEach(e=>{e.appliedStrokeWidth!==null&&(U(e.element.style,`stroke-width`,e.appliedStrokeWidth,e.strokeWidth.priority,e.strokeWidth),!e.hadStyleAttribute&&e.element.style.length===0&&e.element.removeAttribute(`style`))})}}function H(e,t){return{priority:e.getPropertyPriority(t),value:e.getPropertyValue(t)}}function U(e,t,n,r,i){e.getPropertyValue(t)===n&&e.getPropertyPriority(t)===r&&(i.value?e.setProperty(t,i.value,i.priority):e.removeProperty(t))}L.displayName=`UniverIcon`;let W={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 16`,width:`1em`,height:`1em`},children:[{tag:`g`,attrs:{fill:`currentColor`,clipPath:`url(#record-icon_clip0_1559_19)`},children:[{tag:`path`,attrs:{d:`M7.60303 10C8.7076 10 9.60303 9.10457 9.60303 8C9.60303 6.89543 8.7076 6 7.60303 6C6.49846 6 5.60303 6.89543 5.60303 8C5.60303 9.10457 6.49846 10 7.60303 10Z`}},{tag:`path`,attrs:{d:`M1.66943 5.29023C1.66941 3.85426 2.83349 2.69017 4.26946 2.69019L10.9362 2.69026C12.3192 2.69028 13.45 3.77008 13.5315 5.13259L14.5692 4.55638C15.3024 4.14929 16.2032 4.67947 16.2032 5.51809V10.4819C16.2032 11.3205 15.3024 11.8507 14.5692 11.4436L13.5315 10.8674C13.45 12.2299 12.3192 13.3097 10.9362 13.3097H4.26953C2.83361 13.3097 1.66956 12.1457 1.66953 10.7098L1.66943 5.29023ZM13.5362 9.49743L15.0032 10.312V5.68799L13.5362 6.50254V9.49743ZM4.26945 3.89019C3.49623 3.89018 2.86942 4.517 2.86943 5.29021L2.86953 10.7098C2.86955 11.483 3.49634 12.1097 4.26953 12.1097H10.9362C11.7094 12.1097 12.3362 11.4829 12.3362 10.7097V5.29026C12.3362 4.51707 11.7094 3.89027 10.9362 3.89026L4.26945 3.89019Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},{tag:`defs`,attrs:{},children:[{tag:`clipPath`,attrs:{id:`record-icon_clip0_1559_19`},children:[{tag:`path`,attrs:{fill:`white`,d:`M0 0H16V16H0z`,transform:`translate(.94)`}}]}]}],defIds:[`record-icon_clip0_1559_19`]},G=(0,c.forwardRef)(function(e,t){return(0,c.createElement)(L,Object.assign({},e,{id:`record-icon`,ref:t,icon:W}))});G.displayName=`RecordIcon`;function K(){let e=(0,t.useDependency)(x);return(0,t.useObservable)(e.panelOpened$)?/* @__PURE__ */ (0,l.jsx)(q,{}):null}function q(){let e=(0,t.useDependency)(n.ICommandService),i=(0,t.useDependency)(n.LocaleService),a=(0,t.useDependency)(x),o=(0,t.useObservable)(a.recording$),s=(0,t.useObservable)(a.recordedCommands$),u=(s==null?void 0:s.length)??0,d=(0,c.useCallback)(()=>{o||e.executeCommand(C.id)},[e,o]),f=(0,c.useCallback)(t=>{o||e.executeCommand(P.id,{replaceId:t})},[e,o]),p=(0,c.useCallback)(()=>{o&&e.executeCommand(F.id)},[e,o]),m=(0,c.useCallback)(()=>{o&&e.executeCommand(I.id)},[e,o]),h=o?u===0?i.t(`action-recorder.panel.recording`):`${u}: ${s[u-1].id}`:i.t(`action-recorder.panel.startRecording`);return/* @__PURE__ */ (0,l.jsxs)(`div`,{className:`univer-fixed univer-bottom-20 univer-left-1/2 univer-z-[1000] univer-flex univer-h-16 univer-w-[512px] -univer-translate-x-1/2 univer-items-center univer-rounded-lg univer-bg-gray-0 univer-px-5 univer-shadow-lg`,children:[/* @__PURE__ */ (0,l.jsx)(`div`,{className:`univer-mr-2 univer-size-5 univer-shrink-0 univer-grow-0 univer-text-xl`,children:/* @__PURE__ */ (0,l.jsx)(G,{})}),/* @__PURE__ */ (0,l.jsx)(`div`,{className:`univer-flex-1 univer-text-sm`,children:h}),/* @__PURE__ */ (0,l.jsxs)(`div`,{className:`univer-flex univer-w-64 univer-shrink-0 univer-grow-0 univer-justify-between`,children:[/* @__PURE__ */ (0,l.jsx)(r.Button,{className:`univer-w-20`,onClick:o?m:d,children:i.t(o?`action-recorder.panel.cancel`:`action-recorder.panel.close`)}),/* @__PURE__ */ (0,l.jsx)(r.Button,{className:`univer-w-20`,variant:`primary`,onClick:o?p:()=>f(),children:i.t(o?`action-recorder.panel.save`:`action-recorder.panel.start`)}),!o&&/* @__PURE__ */ (0,l.jsx)(r.Button,{variant:`primary`,onClick:()=>f(!0),children:i.t(`action-recorder.panel.startWithId`)})]})]})}let J=class extends n.Disposable{constructor(e,t,n,r,i){super(),this._commandSrv=e,this._uiPartsSrv=t,this._menuManagerService=n,this._actionRecorderService=r,this._injector=i,this._initCommands(),this._initUI(),this._initSheetsCommands(),this._initDocsCommands()}_initCommands(){[P,I,F,S,C,m,h,g].forEach(e=>this._commandSrv.registerCommand(e))}_initUI(){this._uiPartsSrv.registerComponent(t.BuiltInUIPart.GLOBAL,()=>(0,t.connectInjector)(K,this._injector)),this._menuManagerService.mergeMenu(A)}_initSheetsCommands(){[i.CopySheetCommand,i.DeleteRangeMoveLeftCommand,i.DeleteRangeMoveUpCommand,i.DeltaColumnWidthCommand,i.DeltaRowHeightCommand,i.InsertSheetCommand,i.InsertColAfterCommand,i.InsertColBeforeCommand,i.InsertRowAfterCommand,i.InsertRowBeforeCommand,i.RemoveSheetCommand,i.SetStyleCommand,i.AddWorksheetMergeCommand,i.AddWorksheetMergeAllCommand,i.AddWorksheetMergeVerticalCommand,i.AddWorksheetMergeHorizontalCommand,i.SetFrozenCommand,i.CancelFrozenCommand,i.SetHorizontalTextAlignCommand,i.SetOverlineCommand,s.SetRangeBoldCommand,s.SetRangeFontFamilyCommand,s.SetRangeFontSizeCommand,s.SetRangeItalicCommand,s.SetRangeStrickThroughCommand,s.SetRangeSubscriptCommand,s.SetRangeSuperscriptCommand,s.SetRangeTextColorCommand,s.SetRangeUnderlineCommand,i.SetRangeValuesCommand,i.SetStrikeThroughCommand,i.SetTextColorCommand,i.SetTextRotationCommand,i.SetTextWrapCommand,i.SetVerticalTextAlignCommand,s.SheetCopyCommand,s.SheetCutCommand,s.SheetPasteBesidesBorderCommand,s.SheetPasteColWidthCommand,s.SheetPasteCommand,s.SheetPasteFormatCommand,s.SheetPasteShortKeyCommand,s.SheetPasteValueCommand,i.AutoFillCommand,i.RefillCommand,i.SetWorksheetActivateCommand,i.SetWorksheetActiveOperation,i.SetSelectionsOperation,o.SetSheetFilterRangeCommand,o.SetSheetsFilterCriteriaCommand,o.RemoveSheetFilterCommand].forEach(e=>this._actionRecorderService.registerRecordedCommand(e))}_initDocsCommands(){}};J=d([u(0,n.ICommandService),u(1,t.IUIPartsService),u(2,t.IMenuManagerService),u(3,(0,n.Inject)(x)),u(4,(0,n.Inject)(n.Injector))],J);let Y=class extends n.Disposable{constructor(e,t){super(),this._componentManager=e,this._iconManager=t,this._registerIcons()}_registerIcons(){this.disposeWithMe(this._iconManager.register({RecordIcon:G}))}};Y=d([u(0,(0,n.Inject)(t.ComponentManager)),u(1,(0,n.Inject)(t.IconManager))],Y);let X=class extends n.Plugin{constructor(e=N,t,r){super(),this._config=e,this._injector=t,this._configService=r;let{menu:i,...a}=(0,n.merge)({},N,this._config);i&&this._configService.setConfig(`menu`,i,{merge:!0}),this._configService.setConfig(`action-recorder.config`,a)}onStarting(){this._injector.add([Y]),this._injector.get(Y),(this._config.replayOnly?[[f]]:[[x],[f],[J]]).forEach(e=>this._injector.add(e))}onSteady(){this._config.replayOnly||this._injector.get(J)}};b(X,`pluginName`,`UNIVER_ACTION_RECORDER_PLUGIN`),b(X,`packageName`,j),b(X,`version`,M),X=d([u(1,(0,n.Inject)(n.Injector)),u(2,n.IConfigService)],X),e.ActionRecorderMenuSchema=A,Object.defineProperty(e,"ActionRecorderService",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"ActionReplayService",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"UniverActionRecorderPlugin",{enumerable:!0,get:function(){return X}})});