@univerjs/uniscript 0.1.0-alpha.1 → 0.1.0-alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE.txt +178 -0
- package/lib/cjs/index.js +9 -863
- package/lib/es/index.js +365 -0
- package/lib/index.css +1 -9
- package/lib/types/commands/operations/panel.operation.d.ts +15 -1
- package/lib/types/controllers/menu.d.ts +15 -1
- package/lib/types/controllers/uniscript.controller.d.ts +15 -1
- package/lib/types/facade/facade.d.ts +15 -1
- package/lib/types/facade/sheet/f-range.d.ts +15 -1
- package/lib/types/facade/sheet/f-selection.d.ts +15 -1
- package/lib/types/facade/sheet/f-workbook.d.ts +15 -1
- package/lib/types/facade/sheet/f-worksheet.d.ts +15 -1
- package/lib/types/index.d.ts +17 -2
- package/lib/types/locale/en-US.d.ts +15 -1
- package/lib/types/locale/index.d.ts +15 -1
- package/lib/types/locale/zh-CN.d.ts +26 -2
- package/lib/types/plugin.d.ts +18 -4
- package/lib/types/services/command/batch-command.service.d.ts +16 -1
- package/lib/types/services/script-editor.service.d.ts +15 -1
- package/lib/types/services/script-execution.service.d.ts +15 -1
- package/lib/types/services/script-panel.service.d.ts +15 -1
- package/lib/types/views/components/ScriptEditorPanel.d.ts +15 -1
- package/lib/umd/index.js +9 -0
- package/package.json +35 -28
- package/LICENSE +0 -21
- package/lib/cjs/locale/en-US.js +0 -36
- package/lib/cjs/locale/zh-CN.js +0 -26
- package/lib/esm/index.js +0 -855
- package/lib/esm/locale/en-US.js +0 -15
- package/lib/esm/locale/zh-CN.js +0 -5
- package/lib/types/commands/operations/panel.operation.d.ts.map +0 -1
- package/lib/types/controllers/menu.d.ts.map +0 -1
- package/lib/types/controllers/uniscript.controller.d.ts.map +0 -1
- package/lib/types/facade/facade.d.ts.map +0 -1
- package/lib/types/facade/sheet/f-range.d.ts.map +0 -1
- package/lib/types/facade/sheet/f-selection.d.ts.map +0 -1
- package/lib/types/facade/sheet/f-workbook.d.ts.map +0 -1
- package/lib/types/facade/sheet/f-worksheet.d.ts.map +0 -1
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/locale/en-US.d.ts.map +0 -1
- package/lib/types/locale/index.d.ts.map +0 -1
- package/lib/types/locale/zh-CN.d.ts.map +0 -1
- package/lib/types/models/model.d.ts +0 -1
- package/lib/types/models/model.d.ts.map +0 -1
- package/lib/types/plugin.d.ts.map +0 -1
- package/lib/types/services/command/batch-command.service.d.ts.map +0 -1
- package/lib/types/services/script-editor.service.d.ts.map +0 -1
- package/lib/types/services/script-execution.service.d.ts.map +0 -1
- package/lib/types/services/script-panel.service.d.ts.map +0 -1
- package/lib/types/views/components/ScriptEditorPanel.d.ts.map +0 -1
- package/lib/types/views/parts/render.part.d.ts +0 -1
- package/lib/types/views/parts/render.part.d.ts.map +0 -1
package/lib/types/plugin.d.ts
CHANGED
@@ -1,14 +1,28 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
1
16
|
import { LocaleService, Plugin, PluginType } from '@univerjs/core';
|
2
17
|
import { Injector } from '@wendellhu/redi';
|
3
18
|
import type { IScriptEditorServiceConfig } from './services/script-editor.service';
|
4
|
-
export interface
|
19
|
+
export interface IUniscriptConfig extends IScriptEditorServiceConfig {
|
5
20
|
}
|
6
|
-
export declare class
|
21
|
+
export declare class UniverUniscriptPlugin extends Plugin {
|
7
22
|
private readonly _config;
|
8
23
|
protected _injector: Injector;
|
9
24
|
private readonly _localeService;
|
10
25
|
static type: PluginType;
|
11
|
-
constructor(_config:
|
26
|
+
constructor(_config: IUniscriptConfig, _injector: Injector, _localeService: LocaleService);
|
12
27
|
onStarting(injector: Injector): void;
|
13
28
|
}
|
14
|
-
//# sourceMappingURL=plugin.d.ts.map
|
@@ -1,10 +1,25 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
1
16
|
import type { CommandListener, ICommand, ICommandService, IExecutionOptions } from '@univerjs/core';
|
2
17
|
import type { IDisposable } from '@wendellhu/redi';
|
3
18
|
export declare class BatchCommandService implements ICommandService {
|
19
|
+
beforeCommandExecuted(listener: CommandListener): IDisposable;
|
4
20
|
registerCommand(command: ICommand<object, boolean>): IDisposable;
|
5
21
|
registerAsMultipleCommand(command: ICommand<object, boolean>): IDisposable;
|
6
22
|
executeCommand<P extends object = object, R = boolean>(id: string, params?: P | undefined, options?: IExecutionOptions | undefined): Promise<R>;
|
7
23
|
syncExecuteCommand<P extends object = object, R = boolean>(id: string, params?: P | undefined, options?: IExecutionOptions | undefined): R;
|
8
24
|
onCommandExecuted(listener: CommandListener): IDisposable;
|
9
25
|
}
|
10
|
-
//# sourceMappingURL=batch-command.service.d.ts.map
|
@@ -1,3 +1,18 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
1
16
|
import { Disposable } from '@univerjs/core';
|
2
17
|
export interface IScriptEditorServiceConfig {
|
3
18
|
getWorkerUrl(moduleID: string, label: string): string;
|
@@ -10,4 +25,3 @@ export declare class ScriptEditorService extends Disposable {
|
|
10
25
|
constructor(_config: IScriptEditorServiceConfig);
|
11
26
|
requireVscodeEditor(): void;
|
12
27
|
}
|
13
|
-
//# sourceMappingURL=script-editor.service.d.ts.map
|
@@ -1,3 +1,18 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
1
16
|
import { Disposable, ILogService } from '@univerjs/core';
|
2
17
|
import { Injector } from '@wendellhu/redi';
|
3
18
|
/**
|
@@ -9,4 +24,3 @@ export declare class UniscriptExecutionService extends Disposable {
|
|
9
24
|
constructor(_logService: ILogService, _injector: Injector);
|
10
25
|
execute(code: string): Promise<boolean>;
|
11
26
|
}
|
12
|
-
//# sourceMappingURL=script-execution.service.d.ts.map
|
@@ -1,3 +1,18 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
1
16
|
import { Disposable } from '@univerjs/core';
|
2
17
|
export declare class ScriptPanelService extends Disposable {
|
3
18
|
private _open$;
|
@@ -7,4 +22,3 @@ export declare class ScriptPanelService extends Disposable {
|
|
7
22
|
open(): void;
|
8
23
|
close(): void;
|
9
24
|
}
|
10
|
-
//# sourceMappingURL=script-panel.service.d.ts.map
|
@@ -1,3 +1,17 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
1
16
|
import React from 'react';
|
2
17
|
export declare function ScriptEditorPanel(): React.JSX.Element;
|
3
|
-
//# sourceMappingURL=ScriptEditorPanel.d.ts.map
|
package/lib/umd/index.js
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
(function(a,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/ui"),require("rxjs"),require("react"),require("@univerjs/design"),require("@wendellhu/redi/react-bindings"),require("monaco-editor"),require("@univerjs/sheets")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@wendellhu/redi","@univerjs/ui","rxjs","react","@univerjs/design","@wendellhu/redi/react-bindings","monaco-editor","@univerjs/sheets"],c):(a=typeof globalThis<"u"?globalThis:a||self,c(a.UniverUniscript={},a.UniverCore,a["@wendellhu/redi"],a.UniverUi,a.rxjs,a.React,a.UniverDesign,a["@wendellhu/redi/react-bindings"],a.monaco,a.UniverSheets))})(this,function(a,c,l,_,M,h,C,d,Y,T){"use strict";var Te=Object.defineProperty;var Ne=(a,c,l)=>c in a?Te(a,c,{enumerable:!0,configurable:!0,writable:!0,value:l}):a[c]=l;var b=(a,c,l)=>(Ne(a,typeof c!="symbol"?c+"":c,l),l);var R;const K={"script-panel":{title:"Uniscript",tooltip:{"menu-button":"Toggle Uniscript Panel"},panel:{execute:"Execute Script"}}},N={"script-panel":{title:"Uniscript",tooltip:{"menu-button":"打开收起 Uniscript 面板"},panel:{execute:"执行 Uniscript"}}};class F extends c.Disposable{constructor(){super(...arguments);b(this,"_open$",new M.BehaviorSubject(!1));b(this,"open$",this._open$.pipe(M.distinctUntilChanged()))}get isOpen(){return this._open$.getValue()}dispose(){this._open$.next(!1),this._open$.complete()}open(){this._open$.next(!0)}close(){this._open$.next(!1)}}const W="ScriptPanel",L={type:c.CommandType.OPERATION,id:"univer.operation.toggle-script-panel",handler:t=>{const e=t.get(F),s=t.get(_.ISidebarService);return e.isOpen?(e.close(),s.close()):(e.open(),s.open({header:{title:"script-panel.title"},children:{label:W},width:600})),!0}};var A={exports:{}},m={};/**
|
2
|
+
* @license React
|
3
|
+
* react-jsx-runtime.production.min.js
|
4
|
+
*
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
6
|
+
*
|
7
|
+
* This source code is licensed under the MIT license found in the
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
9
|
+
*/var Q=h,X=Symbol.for("react.element"),Z=Symbol.for("react.fragment"),ee=Object.prototype.hasOwnProperty,te=Q.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,re={key:!0,ref:!0,__self:!0,__source:!0};function q(t,e,s){var r,n={},i=null,o=null;s!==void 0&&(i=""+s),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)ee.call(e,r)&&!re.hasOwnProperty(r)&&(n[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)n[r]===void 0&&(n[r]=e[r]);return{$$typeof:X,type:t,key:i,ref:o,props:n,_owner:te.current}}m.Fragment=Z,m.jsx=q,m.jsxs=q,A.exports=m;var f=A.exports;class y extends c.Disposable{constructor(e){super(),this._config=e}requireVscodeEditor(){window.MonacoEnvironment||(window.MonacoEnvironment={getWorkerUrl:this._config.getWorkerUrl})}}var ne=Object.defineProperty,se=Object.getOwnPropertyDescriptor,ie=(t,e,s,r)=>{for(var n=r>1?void 0:r?se(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(n=(r?o(e,s,n):o(n))||n);return r&&n&&ne(e,s,n),n},k=(t,e)=>(s,r)=>e(s,r,t);let S=class{constructor(t,e,s,r,n){this._workbook=t,this._worksheet=e,this._range=s,this._injector=r,this._commandService=n}getRow(){return this._range.startRow}getColumn(){return this._range.startColumn}getWidth(){return this._range.endColumn-this._range.startColumn+1}getHeight(){return this._range.endRow-this._range.startRow+1}getValue(){var t;return((t=this._worksheet.getCell(this._range.startRow,this._range.startColumn))==null?void 0:t.v)??null}setBackgroundColor(t){this._commandService.executeCommand(T.SetStyleCommand.id,{workbookId:this._workbook.getUnitId(),worksheetId:this._worksheet.getSheetId(),range:this._range,style:{type:"bg",value:{rgb:t}}})}};S=ie([k(3,l.Inject(l.Injector)),k(4,c.ICommandService)],S);var oe=Object.defineProperty,ce=Object.getOwnPropertyDescriptor,ae=(t,e,s,r)=>{for(var n=r>1?void 0:r?ce(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(n=(r?o(e,s,n):o(n))||n);return r&&n&&oe(e,s,n),n},le=(t,e)=>(s,r)=>e(s,r,t);let U=class{constructor(t,e,s,r){this._workbook=t,this._worksheet=e,this._selections=s,this._injector=r}getActiveRange(){const t=this._selections.find(e=>!!e.primary);return t?this._injector.createInstance(S,this._workbook,this._worksheet,t.range):null}};U=ae([le(3,l.Inject(l.Injector))],U);var ue=Object.defineProperty,pe=Object.getOwnPropertyDescriptor,_e=(t,e,s,r)=>{for(var n=r>1?void 0:r?pe(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(n=(r?o(e,s,n):o(n))||n);return r&&n&&ue(e,s,n),n},z=(t,e)=>(s,r)=>e(s,r,t);let E=class{constructor(t,e,s,r){this._workbook=t,this._worksheet=e,this._injector=s,this._selectionManagerService=r}getSelection(){const t=this._selectionManagerService.getSelections();return t?this._injector.createInstance(U,this._workbook,this._worksheet,t):null}getRange(t,e){const s={startRow:t,endRow:t,startColumn:e,endColumn:e};return this._injector.createInstance(S,this._workbook,this._worksheet,s)}};E=_e([z(2,l.Inject(l.Injector)),z(3,l.Inject(T.SelectionManagerService))],E);var ve=Object.defineProperty,he=Object.getOwnPropertyDescriptor,de=(t,e,s,r)=>{for(var n=r>1?void 0:r?he(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(n=(r?o(e,s,n):o(n))||n);return r&&n&&ve(e,s,n),n},fe=(t,e)=>(s,r)=>e(s,r,t);let x=class{constructor(t,e){this._workbook=t,this._injector=e}getActiveSheet(){const t=this._workbook.getActiveSheet();return t?this._injector.createInstance(E,this._workbook,t):null}};x=de([fe(1,l.Inject(l.Injector))],x);var ge=Object.defineProperty,me=Object.getOwnPropertyDescriptor,Se=(t,e,s,r)=>{for(var n=r>1?void 0:r?me(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(n=(r?o(e,s,n):o(n))||n);return r&&n&&ge(e,s,n),n},V=(t,e)=>(s,r)=>e(s,r,t);let j=class{constructor(t,e){this._injector=t,this._univerInstanceService=e}static newInstance(t){return t.createInstance(j)}getCurrentSheet(){const t=this._univerInstanceService.getCurrentUniverSheetInstance();return t?this._injector.createInstance(x,t):null}};j=Se([V(0,l.Inject(l.Injector)),V(1,c.IUniverInstanceService)],j);var je=Object.defineProperty,we=Object.getOwnPropertyDescriptor,Pe=(t,e,s,r)=>{for(var n=r>1?void 0:r?we(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(n=(r?o(e,s,n):o(n))||n);return r&&n&&je(e,s,n),n},B=(t,e)=>(s,r)=>e(s,r,t);let w=class extends c.Disposable{constructor(t,e){super(),this._logService=t,this._injector=e}async execute(t){this._logService.log("[UniscriptExecutionService]","executing Uniscript...");const e=j.newInstance(this._injector),s=new Function("Univer",`(() => {${t}})()`);try{return s(e),!0}catch(r){return this._logService.error(r),!1}}};w=Pe([B(0,c.ILogService),B(1,l.Inject(l.Injector))],w);const P={scriptEditorPanel:"univer-script-editor-panel",scriptEditorContent:"univer-script-editor-content"};function Oe(){const t=h.useRef(null),e=h.useRef(null),s=h.useRef(null),r=d.useDependency(c.LocaleService),n=d.useDependency(w),i=d.useDependency(_.IShortcutService),o=d.useDependency(y),H=d.useDependency(_.IMessageService);h.useEffect(()=>{const g=e.current,u=t.current;let v=null,I=null;if(g&&u){o.requireVscodeEditor();const $=s.current=Y.editor.create(g,{value:"",language:"javascript"});I=new ResizeObserver(()=>{let J=requestIdleCallback(()=>{if(!J)return;const{height:$e,width:Me}=u.getBoundingClientRect();$.layout({width:Me,height:$e}),J=void 0})}),I.observe(u);let p;v=new c.DisposableCollection,v.add($.onDidFocusEditorWidget(()=>{p=i.forceEscape()})),v.add($.onDidBlurEditorWidget(()=>{p==null||p.dispose(),p=void 0})),v.add(c.toDisposable(()=>p==null?void 0:p.dispose()))}return()=>{I&&u&&I.unobserve(u),v==null||v.dispose()}},[]);const Re=h.useCallback(()=>{var u;const g=(u=s.current)==null?void 0:u.getModel();g&&n.execute(g.getValue()).then(()=>{H.show({content:"Execution completed",type:C.MessageType.Success})}).catch(()=>{H.show({content:"Execution failed",type:C.MessageType.Error})})},[n]);return f.jsxs("div",{className:P.scriptEditorPanel,children:[f.jsx("div",{className:P.scriptEditorContent,ref:t,children:f.jsx("div",{className:P.scriptEditorContainer,ref:e})}),f.jsx("div",{className:P.scriptEditorActions,children:f.jsx(C.Button,{type:"primary",size:"small",onClick:Re,children:r.t("script-panel.panel.execute")})})]})}function Ie(){return{id:L.id,title:"toggle-script-panel",tooltip:"script-panel.tooltip.menu-button",icon:"CodeSingle",type:_.MenuItemType.BUTTON,positions:[_.MenuPosition.TOOLBAR_START]}}var be=Object.defineProperty,Ce=Object.getOwnPropertyDescriptor,ye=(t,e,s,r)=>{for(var n=r>1?void 0:r?Ce(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(n=(r?o(e,s,n):o(n))||n);return r&&n&&be(e,s,n),n},D=(t,e)=>(s,r)=>e(s,r,t);let O=class extends c.Disposable{constructor(t,e,s){super(),this.disposeWithMe(t.addMenuItem(Ie())),this.disposeWithMe(s.register(W,Oe)),this.disposeWithMe(e.registerCommand(L))}};O=ye([c.OnLifecycle(c.LifecycleStages.Steady,O),D(0,_.IMenuService),D(1,c.ICommandService),D(2,l.Inject(_.ComponentManager))],O);var Ue=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,xe=(t,e,s,r)=>{for(var n=r>1?void 0:r?Ee(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(n=(r?o(e,s,n):o(n))||n);return r&&n&&Ue(e,s,n),n},G=(t,e)=>(s,r)=>e(s,r,t);const De="uniscript";a.UniverUniscriptPlugin=(R=class extends c.Plugin{constructor(e,s,r){super(De),this._config=e,this._injector=s,this._localeService=r}onStarting(e){[[O],[y,{useFactory:()=>e.createInstance(y,this._config)}],[F],[w]].forEach(r=>e.add(r)),this._localeService.load({zhCN:N})}},b(R,"type",c.PluginType.Univer),R),a.UniverUniscriptPlugin=xe([G(1,l.Inject(l.Injector)),G(2,l.Inject(c.LocaleService))],a.UniverUniscriptPlugin),a.enUS=K,a.zhCN=N,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
@@ -1,32 +1,28 @@
|
|
1
1
|
{
|
2
2
|
"name": "@univerjs/uniscript",
|
3
|
-
"version": "0.1.0-alpha.
|
3
|
+
"version": "0.1.0-alpha.2",
|
4
4
|
"description": "UI component library for building exceptional Univer.",
|
5
5
|
"keywords": [],
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
7
|
-
"license": "
|
7
|
+
"license": "Apache-2.0",
|
8
8
|
"main": "./lib/cjs/index.js",
|
9
|
-
"module": "./lib/
|
9
|
+
"module": "./lib/es/index.js",
|
10
10
|
"types": "./lib/types/index.d.ts",
|
11
11
|
"publishConfig": {
|
12
12
|
"access": "public"
|
13
13
|
},
|
14
14
|
"exports": {
|
15
15
|
".": {
|
16
|
-
"import": "./lib/
|
16
|
+
"import": "./lib/es/index.js",
|
17
17
|
"require": "./lib/cjs/index.js",
|
18
18
|
"types": "./lib/types/index.d.ts"
|
19
19
|
},
|
20
20
|
"./*": {
|
21
|
-
"import": "./lib/
|
21
|
+
"import": "./lib/es/*",
|
22
22
|
"require": "./lib/cjs/*",
|
23
23
|
"types": "./lib/types/index.d.ts"
|
24
24
|
},
|
25
|
-
"./
|
26
|
-
"import": "./lib/esm/locale/*.js",
|
27
|
-
"require": "./lib/cjs/locale/*.js",
|
28
|
-
"types": "./lib/types/index.d.ts"
|
29
|
-
}
|
25
|
+
"./lib/*": "./lib/*"
|
30
26
|
},
|
31
27
|
"directories": {
|
32
28
|
"lib": "lib"
|
@@ -34,33 +30,44 @@
|
|
34
30
|
"files": [
|
35
31
|
"lib"
|
36
32
|
],
|
33
|
+
"sideEffects": [
|
34
|
+
"**/*.css"
|
35
|
+
],
|
37
36
|
"private": false,
|
38
|
-
"dependencies": {
|
39
|
-
"@wendellhu/redi": "^0.12.11",
|
40
|
-
"rxjs": "^7.8.1",
|
41
|
-
"@univerjs/sheets": "0.1.0-alpha.1",
|
42
|
-
"@univerjs/ui": "0.1.0-alpha.1",
|
43
|
-
"@univerjs/design": "0.1.0-alpha.1",
|
44
|
-
"@univerjs/core": "0.1.0-alpha.1",
|
45
|
-
"@univerjs/sheets-ui": "0.1.0-alpha.1"
|
46
|
-
},
|
47
37
|
"devDependencies": {
|
48
|
-
"@types/react": "^18.2.
|
49
|
-
"@
|
50
|
-
"
|
38
|
+
"@types/react": "^18.2.42",
|
39
|
+
"@vitejs/plugin-react": "^4.2.1",
|
40
|
+
"@vitest/coverage-istanbul": "^1.0.2",
|
41
|
+
"@wendellhu/redi": "^0.12.12",
|
51
42
|
"less": "^4.2.0",
|
52
|
-
"
|
53
|
-
"
|
54
|
-
"
|
43
|
+
"monaco-editor": "0.45.0",
|
44
|
+
"rxjs": "^7.8.1",
|
45
|
+
"typescript": "^5.3.3",
|
46
|
+
"vite": "^5.0.7",
|
47
|
+
"vite-plugin-dts": "^3.6.4",
|
48
|
+
"vite-plugin-externals": "^0.6.2",
|
49
|
+
"vitest": "^1.0.2",
|
50
|
+
"@univerjs/design": "0.1.0-alpha.2",
|
51
|
+
"@univerjs/sheets": "0.1.0-alpha.2",
|
52
|
+
"@univerjs/core": "0.1.0-alpha.2",
|
53
|
+
"@univerjs/sheets-ui": "0.1.0-alpha.2",
|
54
|
+
"@univerjs/ui": "0.1.0-alpha.2"
|
55
55
|
},
|
56
56
|
"peerDependencies": {
|
57
|
-
"
|
58
|
-
"
|
57
|
+
"@wendellhu/redi": ">=0.12.12",
|
58
|
+
"monaco-editor": ">=0.44.0",
|
59
|
+
"react": ">=16.9.0",
|
60
|
+
"rxjs": ">=7.0.0",
|
61
|
+
"@univerjs/core": "0.1.0-alpha.2",
|
62
|
+
"@univerjs/design": "0.1.0-alpha.2",
|
63
|
+
"@univerjs/sheets-ui": "0.1.0-alpha.2",
|
64
|
+
"@univerjs/sheets": "0.1.0-alpha.2",
|
65
|
+
"@univerjs/ui": "0.1.0-alpha.2"
|
59
66
|
},
|
60
67
|
"scripts": {
|
61
68
|
"test": "vitest run",
|
62
69
|
"test:watch": "vitest",
|
63
70
|
"coverage": "vitest run --coverage",
|
64
|
-
"
|
71
|
+
"build": "tsc && vite build"
|
65
72
|
}
|
66
73
|
}
|
package/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2020-present, DreamNum
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
package/lib/cjs/locale/en-US.js
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
-
};
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
|
20
|
-
// src/locale/en-US.ts
|
21
|
-
var en_US_exports = {};
|
22
|
-
__export(en_US_exports, {
|
23
|
-
default: () => en_US_default
|
24
|
-
});
|
25
|
-
module.exports = __toCommonJS(en_US_exports);
|
26
|
-
var en_US_default = {
|
27
|
-
"script-panel": {
|
28
|
-
title: "Uniscript",
|
29
|
-
tooltip: {
|
30
|
-
"menu-button": "Toggle Uniscript Panel"
|
31
|
-
},
|
32
|
-
panel: {
|
33
|
-
execute: "Execute Script"
|
34
|
-
}
|
35
|
-
}
|
36
|
-
};
|
package/lib/cjs/locale/zh-CN.js
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
-
};
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
|
20
|
-
// src/locale/zh-CN.ts
|
21
|
-
var zh_CN_exports = {};
|
22
|
-
__export(zh_CN_exports, {
|
23
|
-
default: () => zh_CN_default
|
24
|
-
});
|
25
|
-
module.exports = __toCommonJS(zh_CN_exports);
|
26
|
-
var zh_CN_default = {};
|