@univerjs/uniscript 0.20.1 → 0.21.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/index.js +417 -1
- package/lib/cjs/locale/ca-ES.js +16 -1
- package/lib/cjs/locale/en-US.js +31 -1
- package/lib/cjs/locale/es-ES.js +16 -1
- package/lib/cjs/locale/fa-IR.js +16 -1
- package/lib/cjs/locale/fr-FR.js +16 -1
- package/lib/cjs/locale/ja-JP.js +16 -1
- package/lib/cjs/locale/ko-KR.js +16 -1
- package/lib/cjs/locale/ru-RU.js +16 -1
- package/lib/cjs/locale/sk-SK.js +16 -1
- package/lib/cjs/locale/vi-VN.js +16 -1
- package/lib/cjs/locale/zh-CN.js +16 -1
- package/lib/cjs/locale/zh-TW.js +16 -1
- package/lib/es/index.js +403 -1
- package/lib/es/locale/ca-ES.js +15 -1
- package/lib/es/locale/en-US.js +30 -1
- package/lib/es/locale/es-ES.js +15 -1
- package/lib/es/locale/fa-IR.js +15 -1
- package/lib/es/locale/fr-FR.js +15 -1
- package/lib/es/locale/ja-JP.js +15 -1
- package/lib/es/locale/ko-KR.js +15 -1
- package/lib/es/locale/ru-RU.js +15 -1
- package/lib/es/locale/sk-SK.js +15 -1
- package/lib/es/locale/vi-VN.js +15 -1
- package/lib/es/locale/zh-CN.js +15 -1
- package/lib/es/locale/zh-TW.js +15 -1
- package/lib/index.js +403 -1
- package/lib/locale/ca-ES.js +15 -1
- package/lib/locale/en-US.js +30 -1
- package/lib/locale/es-ES.js +15 -1
- package/lib/locale/fa-IR.js +15 -1
- package/lib/locale/fr-FR.js +15 -1
- package/lib/locale/ja-JP.js +15 -1
- package/lib/locale/ko-KR.js +15 -1
- package/lib/locale/ru-RU.js +15 -1
- package/lib/locale/sk-SK.js +15 -1
- package/lib/locale/vi-VN.js +15 -1
- package/lib/locale/zh-CN.js +15 -1
- package/lib/locale/zh-TW.js +15 -1
- package/lib/umd/index.js +1 -1
- package/package.json +9 -9
package/lib/es/index.js
CHANGED
|
@@ -1 +1,403 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CommandType, Disposable, DisposableCollection, ICommandService, IConfigService, ILogService, Inject, Injector, LocaleService, Plugin, ThemeService, UniverInstanceType, createIdentifier, merge, toDisposable } from "@univerjs/core";
|
|
2
|
+
import { ComponentManager, IMenuManagerService, IMessageService, IShortcutService, ISidebarService, MenuItemType, RibbonOthersGroup, getMenuHiddenObservable, useDependency } from "@univerjs/ui";
|
|
3
|
+
import { BehaviorSubject, distinctUntilChanged } from "rxjs";
|
|
4
|
+
import { RangeProtectionPermissionEditPoint, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission } from "@univerjs/sheets";
|
|
5
|
+
import { getCurrentRangeDisable$ } from "@univerjs/sheets-ui";
|
|
6
|
+
import { Button, MessageType } from "@univerjs/design";
|
|
7
|
+
import { editor } from "monaco-editor";
|
|
8
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
9
|
+
import { FUniver } from "@univerjs/core/facade";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
|
|
12
|
+
//#region \0@oxc-project+runtime@0.124.0/helpers/typeof.js
|
|
13
|
+
function _typeof(o) {
|
|
14
|
+
"@babel/helpers - typeof";
|
|
15
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
16
|
+
return typeof o;
|
|
17
|
+
} : function(o) {
|
|
18
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
19
|
+
}, _typeof(o);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region \0@oxc-project+runtime@0.124.0/helpers/toPrimitive.js
|
|
24
|
+
function toPrimitive(t, r) {
|
|
25
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
26
|
+
var e = t[Symbol.toPrimitive];
|
|
27
|
+
if (void 0 !== e) {
|
|
28
|
+
var i = e.call(t, r || "default");
|
|
29
|
+
if ("object" != _typeof(i)) return i;
|
|
30
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
31
|
+
}
|
|
32
|
+
return ("string" === r ? String : Number)(t);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region \0@oxc-project+runtime@0.124.0/helpers/toPropertyKey.js
|
|
37
|
+
function toPropertyKey(t) {
|
|
38
|
+
var i = toPrimitive(t, "string");
|
|
39
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region \0@oxc-project+runtime@0.124.0/helpers/defineProperty.js
|
|
44
|
+
function _defineProperty(e, r, t) {
|
|
45
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
46
|
+
value: t,
|
|
47
|
+
enumerable: !0,
|
|
48
|
+
configurable: !0,
|
|
49
|
+
writable: !0
|
|
50
|
+
}) : e[r] = t, e;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/services/script-panel.service.ts
|
|
55
|
+
/**
|
|
56
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
57
|
+
*
|
|
58
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
59
|
+
* you may not use this file except in compliance with the License.
|
|
60
|
+
* You may obtain a copy of the License at
|
|
61
|
+
*
|
|
62
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
63
|
+
*
|
|
64
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
65
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
66
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
67
|
+
* See the License for the specific language governing permissions and
|
|
68
|
+
* limitations under the License.
|
|
69
|
+
*/
|
|
70
|
+
var ScriptPanelService = class extends Disposable {
|
|
71
|
+
constructor(..._args) {
|
|
72
|
+
super(..._args);
|
|
73
|
+
_defineProperty(this, "_open$", new BehaviorSubject(false));
|
|
74
|
+
_defineProperty(this, "open$", this._open$.pipe(distinctUntilChanged()));
|
|
75
|
+
}
|
|
76
|
+
get isOpen() {
|
|
77
|
+
return this._open$.getValue();
|
|
78
|
+
}
|
|
79
|
+
dispose() {
|
|
80
|
+
super.dispose();
|
|
81
|
+
this._open$.next(false);
|
|
82
|
+
this._open$.complete();
|
|
83
|
+
}
|
|
84
|
+
open() {
|
|
85
|
+
this._open$.next(true);
|
|
86
|
+
}
|
|
87
|
+
close() {
|
|
88
|
+
this._open$.next(false);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/commands/operations/panel.operation.ts
|
|
94
|
+
const ScriptPanelComponentName = "ScriptPanel";
|
|
95
|
+
const ToggleScriptPanelOperation = {
|
|
96
|
+
type: CommandType.OPERATION,
|
|
97
|
+
id: "univer.operation.toggle-script-panel",
|
|
98
|
+
handler: (accessor) => {
|
|
99
|
+
const scriptPanelService = accessor.get(ScriptPanelService);
|
|
100
|
+
const sidebarService = accessor.get(ISidebarService);
|
|
101
|
+
if (scriptPanelService.isOpen) {
|
|
102
|
+
scriptPanelService.close();
|
|
103
|
+
sidebarService.close();
|
|
104
|
+
} else {
|
|
105
|
+
scriptPanelService.open();
|
|
106
|
+
sidebarService.open({
|
|
107
|
+
header: { title: "script-panel.title" },
|
|
108
|
+
children: { label: ScriptPanelComponentName },
|
|
109
|
+
width: 600
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region package.json
|
|
118
|
+
var name = "@univerjs/uniscript";
|
|
119
|
+
var version = "0.21.0";
|
|
120
|
+
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/config/config.ts
|
|
123
|
+
const UNISCRIPT_PLUGIN_CONFIG_KEY = "uniscript.config";
|
|
124
|
+
const configSymbol = Symbol(UNISCRIPT_PLUGIN_CONFIG_KEY);
|
|
125
|
+
const defaultPluginConfig = {};
|
|
126
|
+
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/menu/menu.ts
|
|
129
|
+
function UniscriptMenuItemFactory(accessor) {
|
|
130
|
+
return {
|
|
131
|
+
id: ToggleScriptPanelOperation.id,
|
|
132
|
+
title: "toggle-script-panel",
|
|
133
|
+
tooltip: "script-panel.tooltip.menu-button",
|
|
134
|
+
icon: "CodeIcon",
|
|
135
|
+
type: MenuItemType.BUTTON,
|
|
136
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
137
|
+
disabled$: getCurrentRangeDisable$(accessor, {
|
|
138
|
+
workbookTypes: [WorkbookEditablePermission],
|
|
139
|
+
worksheetTypes: [
|
|
140
|
+
WorksheetEditPermission,
|
|
141
|
+
WorksheetSetCellStylePermission,
|
|
142
|
+
WorksheetSetCellValuePermission
|
|
143
|
+
],
|
|
144
|
+
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
145
|
+
})
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/menu/schema.ts
|
|
151
|
+
const menuSchema = { [RibbonOthersGroup.OTHERS]: { [ToggleScriptPanelOperation.id]: {
|
|
152
|
+
order: 0,
|
|
153
|
+
menuItemFactory: UniscriptMenuItemFactory
|
|
154
|
+
} } };
|
|
155
|
+
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region \0@oxc-project+runtime@0.124.0/helpers/decorateParam.js
|
|
158
|
+
function __decorateParam(paramIndex, decorator) {
|
|
159
|
+
return function(target, key) {
|
|
160
|
+
decorator(target, key, paramIndex);
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region \0@oxc-project+runtime@0.124.0/helpers/decorate.js
|
|
166
|
+
function __decorate(decorators, target, key, desc) {
|
|
167
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
168
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
169
|
+
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;
|
|
170
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/services/script-editor.service.ts
|
|
175
|
+
let ScriptEditorService = class ScriptEditorService extends Disposable {
|
|
176
|
+
constructor(_configService) {
|
|
177
|
+
super();
|
|
178
|
+
this._configService = _configService;
|
|
179
|
+
_defineProperty(this, "_editorInstance", null);
|
|
180
|
+
}
|
|
181
|
+
dispose() {
|
|
182
|
+
super.dispose();
|
|
183
|
+
if (this._editorInstance) this._editorInstance.dispose();
|
|
184
|
+
}
|
|
185
|
+
setEditorInstance(editor) {
|
|
186
|
+
this._editorInstance = editor;
|
|
187
|
+
return toDisposable(() => this._editorInstance = null);
|
|
188
|
+
}
|
|
189
|
+
getEditorInstance() {
|
|
190
|
+
return this._editorInstance;
|
|
191
|
+
}
|
|
192
|
+
requireVscodeEditor() {
|
|
193
|
+
if (!window.MonacoEnvironment) {
|
|
194
|
+
const config = this._configService.getConfig(UNISCRIPT_PLUGIN_CONFIG_KEY);
|
|
195
|
+
window.MonacoEnvironment = { getWorkerUrl: config === null || config === void 0 ? void 0 : config.getWorkerUrl };
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
ScriptEditorService = __decorate([__decorateParam(0, IConfigService)], ScriptEditorService);
|
|
200
|
+
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/services/script-execution.service.ts
|
|
203
|
+
/**
|
|
204
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
205
|
+
*
|
|
206
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
207
|
+
* you may not use this file except in compliance with the License.
|
|
208
|
+
* You may obtain a copy of the License at
|
|
209
|
+
*
|
|
210
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
211
|
+
*
|
|
212
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
213
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
214
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
215
|
+
* See the License for the specific language governing permissions and
|
|
216
|
+
* limitations under the License.
|
|
217
|
+
*/
|
|
218
|
+
const IUniscriptExecutionService = createIdentifier("univer.uniscript.execution-service");
|
|
219
|
+
let UniscriptExecutionService = class UniscriptExecutionService extends Disposable {
|
|
220
|
+
constructor(_logService, _injector) {
|
|
221
|
+
super();
|
|
222
|
+
this._logService = _logService;
|
|
223
|
+
this._injector = _injector;
|
|
224
|
+
}
|
|
225
|
+
async execute(code) {
|
|
226
|
+
this._logService.log("[UniscriptExecutionService]", "executing Uniscript...");
|
|
227
|
+
const apiInstance = FUniver.newAPI(this._injector);
|
|
228
|
+
const scriptFunction = new Function("univerAPI", `(() => {${code}})()`);
|
|
229
|
+
try {
|
|
230
|
+
scriptFunction(apiInstance);
|
|
231
|
+
return true;
|
|
232
|
+
} catch (e) {
|
|
233
|
+
this._logService.error(e);
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
UniscriptExecutionService = __decorate([__decorateParam(0, ILogService), __decorateParam(1, Inject(Injector))], UniscriptExecutionService);
|
|
239
|
+
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region src/views/components/ScriptEditorPanel.tsx
|
|
242
|
+
function ScriptEditorPanel() {
|
|
243
|
+
const editorContentRef = useRef(null);
|
|
244
|
+
const editorContainerRef = useRef(null);
|
|
245
|
+
const monacoEditorRef = useRef(null);
|
|
246
|
+
const localeService = useDependency(LocaleService);
|
|
247
|
+
const shortcutService = useDependency(IShortcutService);
|
|
248
|
+
const editorService = useDependency(ScriptEditorService);
|
|
249
|
+
const themeService = useDependency(ThemeService);
|
|
250
|
+
useEffect(() => {
|
|
251
|
+
const containerElement = editorContainerRef.current;
|
|
252
|
+
const contentElement = editorContentRef.current;
|
|
253
|
+
let disposableCollection = null;
|
|
254
|
+
let resizeObserver = null;
|
|
255
|
+
if (containerElement && contentElement) {
|
|
256
|
+
editorService.requireVscodeEditor();
|
|
257
|
+
const monacoEditor = monacoEditorRef.current = editor.create(containerElement, {
|
|
258
|
+
value: "",
|
|
259
|
+
language: "javascript",
|
|
260
|
+
theme: themeService.darkMode ? "vs-dark" : "vs-light"
|
|
261
|
+
});
|
|
262
|
+
resizeObserver = new ResizeObserver(() => {
|
|
263
|
+
let timer = requestIdleCallback(() => {
|
|
264
|
+
if (!timer) return;
|
|
265
|
+
const { height, width } = contentElement.getBoundingClientRect();
|
|
266
|
+
monacoEditor.layout({
|
|
267
|
+
width,
|
|
268
|
+
height
|
|
269
|
+
});
|
|
270
|
+
timer = void 0;
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
resizeObserver.observe(contentElement);
|
|
274
|
+
let terminateEscaping;
|
|
275
|
+
disposableCollection = new DisposableCollection();
|
|
276
|
+
disposableCollection.add(editorService.setEditorInstance(monacoEditor));
|
|
277
|
+
disposableCollection.add(monacoEditor.onDidFocusEditorWidget(() => {
|
|
278
|
+
terminateEscaping = shortcutService.forceEscape();
|
|
279
|
+
}));
|
|
280
|
+
disposableCollection.add(monacoEditor.onDidBlurEditorWidget(() => {
|
|
281
|
+
terminateEscaping === null || terminateEscaping === void 0 || terminateEscaping.dispose();
|
|
282
|
+
terminateEscaping = void 0;
|
|
283
|
+
}));
|
|
284
|
+
disposableCollection.add(toDisposable(() => terminateEscaping === null || terminateEscaping === void 0 ? void 0 : terminateEscaping.dispose()));
|
|
285
|
+
}
|
|
286
|
+
return () => {
|
|
287
|
+
if (resizeObserver && contentElement) resizeObserver.unobserve(contentElement);
|
|
288
|
+
disposableCollection === null || disposableCollection === void 0 || disposableCollection.dispose();
|
|
289
|
+
};
|
|
290
|
+
}, [editorService, shortcutService]);
|
|
291
|
+
const startExecution = useExecution(monacoEditorRef);
|
|
292
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
293
|
+
className: "univer-h-full",
|
|
294
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
295
|
+
ref: editorContentRef,
|
|
296
|
+
className: "univer-h-[calc(100%-60px)] univer-w-full univer-overflow-hidden",
|
|
297
|
+
children: /* @__PURE__ */ jsx("div", { ref: editorContainerRef })
|
|
298
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
299
|
+
className: "univer-mt-2.5",
|
|
300
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
301
|
+
variant: "primary",
|
|
302
|
+
onClick: startExecution,
|
|
303
|
+
children: localeService.t("script-panel.panel.execute")
|
|
304
|
+
})
|
|
305
|
+
})]
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
function useExecution(monacoEditorRef) {
|
|
309
|
+
const scriptService = useDependency(IUniscriptExecutionService);
|
|
310
|
+
const messageService = useDependency(IMessageService);
|
|
311
|
+
const localeService = useDependency(LocaleService);
|
|
312
|
+
return useCallback(() => {
|
|
313
|
+
var _monacoEditorRef$curr;
|
|
314
|
+
const model = (_monacoEditorRef$curr = monacoEditorRef.current) === null || _monacoEditorRef$curr === void 0 ? void 0 : _monacoEditorRef$curr.getModel();
|
|
315
|
+
if (model) scriptService.execute(model.getValue()).then(() => {
|
|
316
|
+
messageService.show({
|
|
317
|
+
content: localeService.t("uniscript.message.success"),
|
|
318
|
+
type: MessageType.Success
|
|
319
|
+
});
|
|
320
|
+
}).catch(() => {
|
|
321
|
+
messageService.show({
|
|
322
|
+
content: localeService.t("uniscript.message.failed"),
|
|
323
|
+
type: MessageType.Error
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
}, [
|
|
327
|
+
localeService,
|
|
328
|
+
messageService,
|
|
329
|
+
monacoEditorRef,
|
|
330
|
+
scriptService
|
|
331
|
+
]);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
//#endregion
|
|
335
|
+
//#region src/controllers/uniscript.controller.ts
|
|
336
|
+
/**
|
|
337
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
338
|
+
*
|
|
339
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
340
|
+
* you may not use this file except in compliance with the License.
|
|
341
|
+
* You may obtain a copy of the License at
|
|
342
|
+
*
|
|
343
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
344
|
+
*
|
|
345
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
346
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
347
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
348
|
+
* See the License for the specific language governing permissions and
|
|
349
|
+
* limitations under the License.
|
|
350
|
+
*/
|
|
351
|
+
let UniscriptController = class UniscriptController extends Disposable {
|
|
352
|
+
constructor(_menuManagerService, commandService, componentManager) {
|
|
353
|
+
super();
|
|
354
|
+
this._menuManagerService = _menuManagerService;
|
|
355
|
+
this._menuManagerService.mergeMenu(menuSchema);
|
|
356
|
+
this.disposeWithMe(componentManager.register(ScriptPanelComponentName, ScriptEditorPanel));
|
|
357
|
+
this.disposeWithMe(commandService.registerCommand(ToggleScriptPanelOperation));
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
UniscriptController = __decorate([
|
|
361
|
+
__decorateParam(0, IMenuManagerService),
|
|
362
|
+
__decorateParam(1, ICommandService),
|
|
363
|
+
__decorateParam(2, Inject(ComponentManager))
|
|
364
|
+
], UniscriptController);
|
|
365
|
+
|
|
366
|
+
//#endregion
|
|
367
|
+
//#region src/plugin.ts
|
|
368
|
+
let UniverUniscriptPlugin = class UniverUniscriptPlugin extends Plugin {
|
|
369
|
+
constructor(_config = defaultPluginConfig, _injector, _configService) {
|
|
370
|
+
super();
|
|
371
|
+
this._config = _config;
|
|
372
|
+
this._injector = _injector;
|
|
373
|
+
this._configService = _configService;
|
|
374
|
+
const { menu, ...rest } = merge({}, defaultPluginConfig, this._config);
|
|
375
|
+
if (menu) this._configService.setConfig("menu", menu, { merge: true });
|
|
376
|
+
this._configService.setConfig(UNISCRIPT_PLUGIN_CONFIG_KEY, rest);
|
|
377
|
+
}
|
|
378
|
+
onStarting() {
|
|
379
|
+
const injector = this._injector;
|
|
380
|
+
[
|
|
381
|
+
[UniscriptController],
|
|
382
|
+
[ScriptEditorService],
|
|
383
|
+
[ScriptPanelService]
|
|
384
|
+
].forEach((d) => injector.add(d));
|
|
385
|
+
this.registerExecution();
|
|
386
|
+
}
|
|
387
|
+
onSteady() {
|
|
388
|
+
this._injector.get(UniscriptController);
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Allows being overridden, replacing with a new UniscriptExecutionService.
|
|
392
|
+
*/
|
|
393
|
+
registerExecution() {
|
|
394
|
+
this._injector.add([IUniscriptExecutionService, { useClass: UniscriptExecutionService }]);
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
_defineProperty(UniverUniscriptPlugin, "pluginName", "UNIVER_UNISCRIPT_PLUGIN");
|
|
398
|
+
_defineProperty(UniverUniscriptPlugin, "packageName", name);
|
|
399
|
+
_defineProperty(UniverUniscriptPlugin, "version", version);
|
|
400
|
+
UniverUniscriptPlugin = __decorate([__decorateParam(1, Inject(Injector)), __decorateParam(2, IConfigService)], UniverUniscriptPlugin);
|
|
401
|
+
|
|
402
|
+
//#endregion
|
|
403
|
+
export { IUniscriptExecutionService, ScriptEditorService, ToggleScriptPanelOperation, UniverUniscriptPlugin };
|
package/lib/es/locale/ca-ES.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/locale/ca-ES.ts
|
|
2
|
+
const locale = {
|
|
3
|
+
"script-panel": {
|
|
4
|
+
title: "Uniscript",
|
|
5
|
+
tooltip: { "menu-button": "Mostra/Oculta el panell Uniscript" },
|
|
6
|
+
panel: { execute: "Executa l'script" }
|
|
7
|
+
},
|
|
8
|
+
uniscript: { message: {
|
|
9
|
+
success: "Execució correcta",
|
|
10
|
+
failed: "Execució fallida"
|
|
11
|
+
} }
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { locale as default };
|
package/lib/es/locale/en-US.js
CHANGED
|
@@ -1 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/locale/en-US.ts
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
const locale = {
|
|
18
|
+
"script-panel": {
|
|
19
|
+
title: "Uniscript",
|
|
20
|
+
tooltip: { "menu-button": "Toggle Uniscript Panel" },
|
|
21
|
+
panel: { execute: "Execute Script" }
|
|
22
|
+
},
|
|
23
|
+
uniscript: { message: {
|
|
24
|
+
success: "Execution Success",
|
|
25
|
+
failed: "Execution Failed"
|
|
26
|
+
} }
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { locale as default };
|
package/lib/es/locale/es-ES.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/locale/es-ES.ts
|
|
2
|
+
const locale = {
|
|
3
|
+
"script-panel": {
|
|
4
|
+
title: "Uniscript",
|
|
5
|
+
tooltip: { "menu-button": "Mostrar/Ocultar panel de Uniscript" },
|
|
6
|
+
panel: { execute: "Ejecutar script" }
|
|
7
|
+
},
|
|
8
|
+
uniscript: { message: {
|
|
9
|
+
success: "Ejecución exitosa",
|
|
10
|
+
failed: "Ejecución fallida"
|
|
11
|
+
} }
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { locale as default };
|
package/lib/es/locale/fa-IR.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/locale/fa-IR.ts
|
|
2
|
+
const locale = {
|
|
3
|
+
"script-panel": {
|
|
4
|
+
title: "Uniscript",
|
|
5
|
+
tooltip: { "menu-button": "نمایش/مخفی کردن پنل Uniscript" },
|
|
6
|
+
panel: { execute: "اجرای اسکریپت" }
|
|
7
|
+
},
|
|
8
|
+
uniscript: { message: {
|
|
9
|
+
success: "اجرای موفق",
|
|
10
|
+
failed: "اجرای ناموفق"
|
|
11
|
+
} }
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { locale as default };
|
package/lib/es/locale/fr-FR.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/locale/fr-FR.ts
|
|
2
|
+
const locale = {
|
|
3
|
+
"script-panel": {
|
|
4
|
+
title: "Uniscript",
|
|
5
|
+
tooltip: { "menu-button": "Basculer le panneau Uniscript" },
|
|
6
|
+
panel: { execute: "Exécuter le script" }
|
|
7
|
+
},
|
|
8
|
+
uniscript: { message: {
|
|
9
|
+
success: "Exécution réussie",
|
|
10
|
+
failed: "Échec de l'exécution"
|
|
11
|
+
} }
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { locale as default };
|
package/lib/es/locale/ja-JP.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/locale/ja-JP.ts
|
|
2
|
+
const locale = {
|
|
3
|
+
"script-panel": {
|
|
4
|
+
title: "Uniscript",
|
|
5
|
+
tooltip: { "menu-button": "Uniscriptパネルを切り替え" },
|
|
6
|
+
panel: { execute: "スクリプトを実行" }
|
|
7
|
+
},
|
|
8
|
+
uniscript: { message: {
|
|
9
|
+
success: "実行に成功しました",
|
|
10
|
+
failed: "実行に失敗しました"
|
|
11
|
+
} }
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { locale as default };
|
package/lib/es/locale/ko-KR.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/locale/ko-KR.ts
|
|
2
|
+
const locale = {
|
|
3
|
+
"script-panel": {
|
|
4
|
+
title: "Uniscript",
|
|
5
|
+
tooltip: { "menu-button": "Uniscript 패널 전환" },
|
|
6
|
+
panel: { execute: "스크립트 실행" }
|
|
7
|
+
},
|
|
8
|
+
uniscript: { message: {
|
|
9
|
+
success: "실행 성공",
|
|
10
|
+
failed: "실행 실패"
|
|
11
|
+
} }
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { locale as default };
|
package/lib/es/locale/ru-RU.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/locale/ru-RU.ts
|
|
2
|
+
const locale = {
|
|
3
|
+
"script-panel": {
|
|
4
|
+
title: "Юнискрипт",
|
|
5
|
+
tooltip: { "menu-button": "Переключить панель Юнискрипт" },
|
|
6
|
+
panel: { execute: "Выполнить скрипт" }
|
|
7
|
+
},
|
|
8
|
+
uniscript: { message: {
|
|
9
|
+
success: "Выполнение успешно",
|
|
10
|
+
failed: "Выполнение не удалось"
|
|
11
|
+
} }
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { locale as default };
|
package/lib/es/locale/sk-SK.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/locale/sk-SK.ts
|
|
2
|
+
const locale = {
|
|
3
|
+
"script-panel": {
|
|
4
|
+
title: "Uniscript",
|
|
5
|
+
tooltip: { "menu-button": "Prepnúť panel Uniscript" },
|
|
6
|
+
panel: { execute: "Spustiť skript" }
|
|
7
|
+
},
|
|
8
|
+
uniscript: { message: {
|
|
9
|
+
success: "Spustenie úspešné",
|
|
10
|
+
failed: "Spustenie zlyhalo"
|
|
11
|
+
} }
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { locale as default };
|
package/lib/es/locale/vi-VN.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/locale/vi-VN.ts
|
|
2
|
+
const locale = {
|
|
3
|
+
"script-panel": {
|
|
4
|
+
title: "Uniscript",
|
|
5
|
+
tooltip: { "menu-button": "Mở/Thu gọn bảng điều khiển Uniscript" },
|
|
6
|
+
panel: { execute: "Thực thi Uniscript" }
|
|
7
|
+
},
|
|
8
|
+
uniscript: { message: {
|
|
9
|
+
success: "Thực thi thành công",
|
|
10
|
+
failed: "Thực thi thất bại"
|
|
11
|
+
} }
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { locale as default };
|
package/lib/es/locale/zh-CN.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/locale/zh-CN.ts
|
|
2
|
+
const locale = {
|
|
3
|
+
"script-panel": {
|
|
4
|
+
title: "Uniscript",
|
|
5
|
+
tooltip: { "menu-button": "打开收起 Uniscript 面板" },
|
|
6
|
+
panel: { execute: "执行 Uniscript" }
|
|
7
|
+
},
|
|
8
|
+
uniscript: { message: {
|
|
9
|
+
success: "执行成功",
|
|
10
|
+
failed: "执行失败"
|
|
11
|
+
} }
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { locale as default };
|
package/lib/es/locale/zh-TW.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/locale/zh-TW.ts
|
|
2
|
+
const locale = {
|
|
3
|
+
"script-panel": {
|
|
4
|
+
title: "Uniscript",
|
|
5
|
+
tooltip: { "menu-button": "打開收起 Uniscript 面板" },
|
|
6
|
+
panel: { execute: "執行 Uniscript" }
|
|
7
|
+
},
|
|
8
|
+
uniscript: { message: {
|
|
9
|
+
success: "執行成功",
|
|
10
|
+
failed: "執行失敗"
|
|
11
|
+
} }
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { locale as default };
|