@univerjs/find-replace 0.1.0-beta.2 → 0.1.0-beta.3

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/index.css ADDED
@@ -0,0 +1 @@
1
+ .univer-find-replace-expand-container{margin-top:16px;text-align:center}
@@ -14,4 +14,9 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { IOperation } from '@univerjs/core';
17
- export declare const ToggleFindReplaceDialogOperation: IOperation;
17
+ export declare const OpenFindDialogOperation: IOperation;
18
+ export declare const OpenReplaceDialogOperation: IOperation;
19
+ export declare const ToggleReplaceDialogOperation: IOperation;
20
+ export declare const CloseFindReplaceDialogOperation: IOperation;
21
+ export declare const GoToNextMatchOperation: IOperation;
22
+ export declare const GoToPreviousMatchOperation: IOperation;
@@ -13,11 +13,25 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Disposable } from '@univerjs/core';
17
- import { IMenuService } from '@univerjs/ui';
16
+ import { ICommandService, IContextService, LocaleService, RxDisposable } from '@univerjs/core';
17
+ import { ComponentManager, IDialogService, IFocusService, IMenuService, IShortcutService } from '@univerjs/ui';
18
18
  import { Injector } from '@wendellhu/redi';
19
- export declare class FindReplaceController extends Disposable {
19
+ import { IFindReplaceService } from '../services/find-replace.service';
20
+ export declare class FindReplaceController extends RxDisposable {
20
21
  private readonly _menuService;
22
+ private readonly _shortcutService;
23
+ private readonly _commandService;
24
+ private readonly _findReplaceService;
25
+ private readonly _dialogService;
26
+ private readonly _contextService;
27
+ private readonly _focusService;
28
+ private readonly _localeService;
29
+ private readonly _componentManager;
21
30
  private readonly _injector;
22
- constructor(_menuService: IMenuService, _injector: Injector);
31
+ constructor(_menuService: IMenuService, _shortcutService: IShortcutService, _commandService: ICommandService, _findReplaceService: IFindReplaceService, _dialogService: IDialogService, _contextService: IContextService, _focusService: IFocusService, _localeService: LocaleService, _componentManager: ComponentManager, _injector: Injector);
32
+ private _initOperations;
33
+ private _initUI;
34
+ private _initShortcuts;
35
+ private _openPanel;
36
+ private _closePanel;
23
37
  }
@@ -0,0 +1,21 @@
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
+ */
16
+ import { type IShortcutItem } from '@univerjs/ui';
17
+ export declare const OpenFindDialogShortcutItem: IShortcutItem;
18
+ export declare const OpenReplaceDialogShortcutItem: IShortcutItem;
19
+ export declare const CloseFRDialogShortcutItem: IShortcutItem;
20
+ export declare const GoToNextFindMatchShortcutItem: IShortcutItem;
21
+ export declare const GoToPreviousFindMatchShortcutItem: IShortcutItem;
@@ -14,3 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export { UniverFindReplacePlugin } from './plugin';
17
+ export type { IFindComplete, IFindMatch, IFindQuery, IFindReplaceProvider } from './services/find-replace.service';
18
+ export { FindModel, IFindReplaceService } from './services/find-replace.service';
@@ -0,0 +1,32 @@
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
+ */
16
+ declare const locale: {
17
+ univer: {
18
+ 'find-replace': {
19
+ dialog: {
20
+ title: string;
21
+ find: string;
22
+ replace: string;
23
+ 'replace-all': string;
24
+ 'find-range': string;
25
+ 'find-placeholder': string;
26
+ 'advanced-finding': string;
27
+ 'replace-placeholder': string;
28
+ };
29
+ };
30
+ };
31
+ };
32
+ export default locale;
@@ -0,0 +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
+ */
16
+ export { default as enUS } from './en-US';
17
+ export { default as zhCN } from './zh-CN';
@@ -0,0 +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
+ */
16
+ import { type default as enUS } from './en-US';
17
+ declare const locale: typeof enUS;
18
+ export default locale;
@@ -13,10 +13,11 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Plugin } from '@univerjs/core';
17
- import type { Injector } from '@wendellhu/redi';
16
+ import { LocaleService, Plugin } from '@univerjs/core';
17
+ import { type Injector } from '@wendellhu/redi';
18
18
  export declare class UniverFindReplacePlugin extends Plugin {
19
19
  protected readonly _injector: Injector;
20
- constructor(_injector: Injector);
20
+ private readonly _localeService;
21
+ constructor(_injector: Injector, _localeService: LocaleService);
21
22
  onStarting(injector: Injector): void;
22
23
  }
@@ -0,0 +1,19 @@
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
+ */
16
+ /**
17
+ * If find replace feature is activated.
18
+ */
19
+ export declare const FIND_REPLACE_ACTIVATED = "FIND_REPLACE_ACTIVATED";
@@ -13,11 +13,137 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const IFindReplaceService: import("@wendellhu/redi").IdentifierDecorator<IFindReplaceService>;
16
+ import { Disposable, ILogService, IUniverInstanceService } from '@univerjs/core';
17
+ import type { IDisposable } from '@wendellhu/redi';
18
+ import { Injector } from '@wendellhu/redi';
19
+ import type { Observable } from 'rxjs';
20
+ export type FindProgressFn = () => void;
21
+ export interface IFindComplete<T extends IFindMatch = IFindMatch> {
22
+ results: T[];
23
+ }
24
+ export interface IFindMatch<T = unknown> {
25
+ provider: string;
26
+ unitId: string;
27
+ range: T;
28
+ }
29
+ export declare abstract class FindModel extends Disposable {
30
+ abstract readonly unitId: string;
31
+ abstract getMatches(): IFindMatch[];
32
+ abstract moveToNextMatch(loop?: boolean): IFindMatch | null;
33
+ abstract moveToPreviousMatch(loop?: boolean): IFindMatch | null;
34
+ }
17
35
  /**
18
- *
36
+ * A provider should be implemented by a business to provide the find results.
37
+ */
38
+ export interface IFindReplaceProvider {
39
+ find(query: IFindQuery): Promise<FindModel[]>;
40
+ cancel(): void;
41
+ }
42
+ /**
43
+ * This service works as a core of the find & replace feature.
19
44
  */
20
45
  export interface IFindReplaceService {
46
+ readonly stateUpdates$: Observable<Partial<IFindReplaceState>>;
47
+ readonly state$: Observable<IFindReplaceState>;
48
+ /**
49
+ * Register a find replace provider to the service. The provider is the actual bearer to
50
+ * perform the find in different kinds of documents or different environments.
51
+ *
52
+ * @param provider the find replace provider
53
+ */
54
+ registerFindReplaceProvider(provider: IFindReplaceProvider): IDisposable;
55
+ /**
56
+ * Start a find & replace session.
57
+ *
58
+ * @returns if the find & replace session is created and user could start find replace
59
+ */
60
+ start(): boolean;
61
+ end(): boolean;
62
+ revealReplace(): void;
63
+ changeFindString(value: string): void;
64
+ moveToNextMatch(): void;
65
+ moveToPreviousMatch(): void;
66
+ replace(): boolean;
67
+ replaceAll(): boolean;
68
+ }
69
+ export declare const IFindReplaceService: import("@wendellhu/redi").IdentifierDecorator<IFindReplaceService>;
70
+ /**
71
+ * The find query object with finding options.
72
+ */
73
+ export interface IFindQuery {
74
+ text: string;
75
+ isRegex?: boolean;
76
+ ignoreCase?: boolean;
77
+ /** Other possible options set by business. */
78
+ [key: string]: boolean | string | number | undefined;
79
+ }
80
+ /**
81
+ * This class stores find replace results and provides methods to perform replace or something.
82
+ */
83
+ export declare class FindReplaceModel extends Disposable {
84
+ private readonly _state;
85
+ private readonly _providers;
86
+ private readonly _logService;
87
+ private readonly _univerInstanceService;
88
+ private _matchPositionFindModel?;
89
+ private _findModels;
90
+ private _matches;
91
+ private _positionModel;
92
+ constructor(_state: FindReplaceState, _providers: Set<IFindReplaceProvider>, _logService: ILogService, _univerInstanceService: IUniverInstanceService);
93
+ find(): Promise<IFindComplete>;
94
+ moveToNextMatch(): void;
95
+ moveToPreviousMatch(): void;
96
+ private _moveToInitialMatch;
97
+ private _cancelFinding;
98
+ }
99
+ export interface IFindReplaceState {
100
+ revealed: boolean;
101
+ /** The string user inputs in the input box. */
102
+ findString: string;
103
+ replaceString?: string;
104
+ /** Indicates if is in replacing mode. */
105
+ replaceRevealed: boolean;
106
+ /** The currently focused match's index (1-based). */
107
+ matchesPosition: number;
108
+ matchesCount: number;
109
+ }
110
+ /**
111
+ * This class stores find replace options state. These state are stored
112
+ * here instead of the React component so we can change state from
113
+ * operations.
114
+ */
115
+ export declare class FindReplaceState {
116
+ private readonly _stateUpdates$;
117
+ readonly stateUpdates$: Observable<Partial<IFindReplaceState>>;
118
+ private readonly _state$;
119
+ readonly state$: Observable<IFindReplaceState>;
120
+ get state(): IFindReplaceState;
121
+ private _findString;
122
+ private _revealed;
123
+ private _replaceRevealed;
124
+ private _matchesPosition;
125
+ private _matchesCount;
126
+ get findString(): string;
127
+ changeState(changes: Partial<IFindReplaceState>): void;
21
128
  }
22
- export interface IFindReplaceHookd {
129
+ export declare class FindReplaceService extends Disposable implements IFindReplaceService {
130
+ private readonly _injector;
131
+ private readonly _univerInstanceService;
132
+ private readonly _logService;
133
+ private readonly _providers;
134
+ private readonly _state;
135
+ private _model;
136
+ get stateUpdates$(): Observable<Partial<IFindReplaceState>>;
137
+ get state$(): Observable<IFindReplaceState>;
138
+ constructor(_injector: Injector, _univerInstanceService: IUniverInstanceService, _logService: ILogService);
139
+ changeFindString(value: string): void;
140
+ moveToNextMatch(): void;
141
+ moveToPreviousMatch(): void;
142
+ replace(): boolean;
143
+ replaceAll(): boolean;
144
+ revealReplace(): void;
145
+ disposeModel(): void;
146
+ start(): boolean;
147
+ end(): boolean;
148
+ registerFindReplaceProvider(provider: IFindReplaceProvider): IDisposable;
23
149
  }
@@ -0,0 +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
+ */
16
+ import React from 'react';
17
+ export declare function FindReplaceDialog(): React.JSX.Element;
@@ -0,0 +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
+ */
16
+ import type { Meta } from '@storybook/react';
17
+ import React from 'react';
18
+ declare const meta: Meta;
19
+ export default meta;
20
+ export declare const FindDialog: {
21
+ render(): React.JSX.Element;
22
+ };
23
+ export declare const ReplaceDialog: {
24
+ render(): React.JSX.Element;
25
+ };
package/lib/umd/index.js CHANGED
@@ -1 +1,9 @@
1
- (function(c,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@wendellhu/redi"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@wendellhu/redi","rxjs"],a):(c=typeof globalThis<"u"?globalThis:c||self,a(c.UniverFindReplace={},c.UniverCore,c["@wendellhu/redi"],c.rxjs))})(this,function(c,a,_,f){"use strict";var W=Object.defineProperty;var Y=(c,a,_)=>a in c?W(c,a,{enumerable:!0,configurable:!0,writable:!0,value:_}):c[a]=_;var d=(c,a,_)=>(Y(c,typeof a!="symbol"?a+"":a,_),_);var O=(t=>(t.VOID="void",t.TOOLBAR_START="uiToolbar.start",t.TOOLBAR_INSERT="uiToolbar.insert",t.TOOLBAR_FORMULAS="uiToolbar.formulas",t.TOOLBAR_DATA="uiToolbar.data",t.TOOLBAR_VIEW="uiToolbar.view",t.TOOLBAR_OTHERS="uiToolbar.others",t.CONTEXT_MENU="contextMenu",t))(O||{}),T=(t=>(t[t.TOOLBAR_HISTORY=0]="TOOLBAR_HISTORY",t[t.TOOLBAR_FORMAT=1]="TOOLBAR_FORMAT",t[t.TOOLBAR_LAYOUT=2]="TOOLBAR_LAYOUT",t[t.TOOLBAR_FORMULAS_INSERT=3]="TOOLBAR_FORMULAS_INSERT",t[t.TOOLBAR_FORMULAS_VIEW=4]="TOOLBAR_FORMULAS_VIEW",t[t.TOOLBAR_FILE=5]="TOOLBAR_FILE",t[t.TOOLBAR_OTHERS=6]="TOOLBAR_OTHERS",t[t.CONTEXT_MENU_FORMAT=7]="CONTEXT_MENU_FORMAT",t[t.CONTEXT_MENU_LAYOUT=8]="CONTEXT_MENU_LAYOUT",t[t.CONTEXT_MENU_DATA=9]="CONTEXT_MENU_DATA",t[t.CONTEXT_MENU_OTHERS=10]="CONTEXT_MENU_OTHERS",t))(T||{}),v=(t=>(t[t.BUTTON=0]="BUTTON",t[t.SELECTOR=1]="SELECTOR",t[t.BUTTON_SELECTOR=2]="BUTTON_SELECTOR",t[t.SUBITEMS=3]="SUBITEMS",t))(v||{});function E(t,e,i){return document.addEventListener(t,e,i),a.toDisposable(()=>document.removeEventListener(t,e,i))}class R{constructor(){d(this,"_containers",[])}registerContainer(e){if(this._containers.indexOf(e)===-1)return this._containers.push(e),a.toDisposable(()=>a.remove(this._containers,e));throw new Error("[LayoutService]: container already registered!")}checkElementInCurrentApplicationScope(e){return this._containers.some(i=>i.contains(e))}}const L=_.createIdentifier("univer.platform-service"),I={8:"Backspace",9:"Tab",13:"Enter",46:"Del",27:"Esc",32:"Space",37:"←",39:"",38:"↑",40:"↓",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",189:"-",187:"="};var h=(t=>(t[t.SHIFT=1024]="SHIFT",t[t.ALT=2048]="ALT",t[t.CTRL_COMMAND=4096]="CTRL_COMMAND",t[t.MAC_CTRL=8192]="MAC_CTRL",t))(h||{}),D=Object.defineProperty,B=Object.getOwnPropertyDescriptor,b=(t,e,i,s)=>{for(var r=s>1?void 0:s?B(e,i):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(r=(s?o(e,i,r):o(r))||r);return s&&r&&D(e,i,r),r},u=(t,e)=>(i,s)=>e(i,s,t);const y=_.createIdentifier("univer.shortcut");let m=class extends a.Disposable{constructor(e,i,s,r){super();d(this,"_shortCutMapping",new Map);d(this,"_commandIDMapping",new Map);d(this,"_shortcutChanged$",new f.Subject);d(this,"shortcutChanged$",this._shortcutChanged$.asObservable());d(this,"_forceEscaped",!1);d(this,"_disable",!1);this._commandService=e,this._platformService=i,this._contextService=s,this._layoutService=r,this.disposeWithMe(E("keydown",n=>{this._resolveKeyboardEvent(n)}))}setDisable(e){this._disable=e}getAllShortcuts(){return Array.from(this._shortCutMapping.values()).map(e=>Array.from(e.values())).flat()}registerShortcut(e){const i=this._getBindingFromItem(e),s=this._shortCutMapping.get(i);s?s.add(e):this._shortCutMapping.set(i,new Set([e]));const r=e.id,n=this._commandIDMapping.get(r);return n?n.add(e):this._commandIDMapping.set(r,new Set([e])),this._emitShortcutChanged(),a.toDisposable(()=>{var o,l,C,A;(o=this._shortCutMapping.get(i))==null||o.delete(e),((l=this._shortCutMapping.get(i))==null?void 0:l.size)===0&&this._shortCutMapping.delete(i),(C=this._commandIDMapping.get(r))==null||C.delete(e),((A=this._commandIDMapping.get(r))==null?void 0:A.size)===0&&this._commandIDMapping.delete(r),this._emitShortcutChanged()})}getShortcutDisplayOfCommand(e){const i=this._commandIDMapping.get(e);return i?this.getShortcutDisplay(i.values().next().value):null}getShortcutDisplay(e){const i=this._getBindingFromItem(e),s=i&h.CTRL_COMMAND,r=i&h.SHIFT,n=i&h.ALT,o=i&h.MAC_CTRL,l=I[i&255]??"<->";return this._platformService.isMac?`${s?"⌘":""}${r?"⇧":""}${n?"⌥":""}${o?"⌃":""}${l}`:`${s?"Ctrl+":""}${r?"Shift+":""}${n?"Alt+":""}${l}`}_emitShortcutChanged(){this._shortcutChanged$.next()}forceEscape(){return this._forceEscaped=!0,a.toDisposable(()=>this._forceEscaped=!1)}_resolveKeyboardEvent(e){if(this._forceEscaped||this._disable||this._layoutService&&!this._layoutService.checkElementInCurrentApplicationScope(e.target))return;this._dispatch(e)&&e.preventDefault()}_dispatch(e){const i=this._deriveBindingFromEvent(e);if(i===null)return!1;const s=this._shortCutMapping.get(i);if(s===void 0)return!1;const r=Array.from(s).sort((n,o)=>(o.priority??0)-(n.priority??0)).find(n=>{var o;return((o=n.preconditions)==null?void 0:o.call(n,this._contextService))??!0});return r?(this._commandService.executeCommand(r.id,r.staticParameters),!0):!1}_getBindingFromItem(e){return this._platformService.isMac&&e.mac?e.mac:this._platformService.isWindows&&e.win?e.win:this._platformService.isLinux&&e.linux?e.linux:e.binding}_deriveBindingFromEvent(e){const{shiftKey:i,metaKey:s,altKey:r,keyCode:n}=e;let o=n;return i&&(o|=h.SHIFT),r&&(o|=h.ALT),(this._platformService.isMac?s:e.ctrlKey)&&(o|=h.CTRL_COMMAND),this._platformService.isMac&&e.ctrlKey&&(o|=h.MAC_CTRL),o}};m=b([u(0,a.ICommandService),u(1,L),u(2,a.IContextService),u(3,_.Optional(R))],m);var M=Object.defineProperty,N=Object.getOwnPropertyDescriptor,P=(t,e,i,s)=>{for(var r=s>1?void 0:s?N(e,i):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(r=(s?o(e,i,r):o(r))||r);return s&&r&&M(e,i,r),r},U=(t,e)=>(i,s)=>e(i,s,t);const w=_.createIdentifier("univer.menu-service");let S=class extends a.Disposable{constructor(e){super();d(this,"_menuItemMap",new Map);d(this,"_menuByPositions",new Map);d(this,"_menuChanged$",new f.BehaviorSubject(void 0));d(this,"menuChanged$",this._menuChanged$.asObservable());this._shortcutService=e}dispose(){this._menuItemMap.clear(),this._menuChanged$.complete()}addMenuItem(e){if(this._menuItemMap.has(e.id))throw new Error(`Menu item with the same id ${e.id} has already been added!`);return this._menuItemMap.set(e.id,e),Array.isArray(e.positions)?e.positions.forEach(i=>this._appendMenuToPosition(e,i)):this._appendMenuToPosition(e,e.positions),this._menuChanged$.next(),a.toDisposable(()=>{if(this._menuItemMap.delete(e.id),Array.isArray(e.positions))e.positions.forEach(i=>{const s=this._menuByPositions.get(i);if(!s)return;const r=s.findIndex(n=>n[0]===e.id);r>-1&&s.splice(r,1)});else{const i=this._menuByPositions.get(e.positions);if(!i)return;const s=i.findIndex(r=>r[0]===e.id);s>-1&&i.splice(s,1)}this._menuChanged$.next()})}getMenuItems(e){if(this._menuByPositions.has(e)){const i=this._menuByPositions.get(e);if(i)return[...i.values()].map(s=>this._getDisplayMenuItems(s[1]))}return[]}getMenuItem(e){return this._menuItemMap.has(e)?this._menuItemMap.get(e):null}_getDisplayMenuItems(e){const i=this._shortcutService.getShortcutDisplayOfCommand(e.id);return i?{...e,shortcut:i}:e}_appendMenuToPosition(e,i){this._menuByPositions.has(i)||this._menuByPositions.set(i,[]);const s=this._menuByPositions.get(i);if(s.findIndex(r=>r[0]===e.id)>-1)throw new Error(`Menu item with the same id ${e.id} has already been added!`);s.push([e.id,e])}};S=P([U(0,y)],S);const F={type:a.CommandType.OPERATION,id:"ui.operation.toggle-find-replace-dialog",handler:t=>!0};function $(t){return{id:F.id,tooltip:"toolbar.find-replace",group:T.TOOLBAR_OTHERS,type:v.BUTTON,positions:[O.TOOLBAR_START]}}var x=Object.defineProperty,j=Object.getOwnPropertyDescriptor,H=(t,e,i,s)=>{for(var r=s>1?void 0:s?j(e,i):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(r=(s?o(e,i,r):o(r))||r);return s&&r&&x(e,i,r),r},g=(t,e)=>(i,s)=>e(i,s,t);let p=class extends a.Disposable{constructor(t,e){super(),this._menuService=t,this._injector=e,[$].forEach(i=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(i)))})}};p=H([a.OnLifecycle(a.LifecycleStages.Steady,p),g(0,w),g(1,_.Inject(_.Injector))],p);const X="FIND_REPLACE";class K extends a.Plugin{constructor(e){super(X),this._injector=e}onStarting(e){[[p]].forEach(i=>{e.add(i)})}}c.UniverFindReplacePlugin=K,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
1
+ (function(c,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/ui"),require("rxjs"),require("react"),require("@univerjs/design"),require("@wendellhu/redi/react-bindings")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@wendellhu/redi","@univerjs/ui","rxjs","react","@univerjs/design","@wendellhu/redi/react-bindings"],o):(c=typeof globalThis<"u"?globalThis:c||self,o(c.UniverFindReplace={},c.UniverCore,c["@wendellhu/redi"],c.UniverUi,c.rxjs,c.React,c.UniverDesign,c["@wendellhu/redi/react-bindings"]))})(this,function(c,o,v,h,O,p,_,T){"use strict";var Fe=Object.defineProperty;var be=(c,o,v)=>o in c?Fe(c,o,{enumerable:!0,configurable:!0,writable:!0,value:v}):c[o]=v;var u=(c,o,v)=>(be(c,typeof o!="symbol"?o+"":o,v),v);var g=function(){return g=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++){e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},g.apply(this,arguments)},H=function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r},E=p.forwardRef(function(t,e){var r=t.icon,i=t.id,n=t.className,a=t.extend,s=H(t,["icon","id","className","extend"]),l="univerjs-icon univerjs-icon-".concat(i," ").concat(n||"").trim(),m=p.useRef("_".concat(Q()));return D(r,"".concat(i),{defIds:r.defIds,idSuffix:m.current},g({ref:e,className:l},s),a)});function D(t,e,r,i,n){return p.createElement(t.tag,g(g({key:e},J(t,r,n)),i),(Y(t,r).children||[]).map(function(a,s){return D(a,"".concat(e,"-").concat(t.tag,"-").concat(s),r,void 0,n)}))}function J(t,e,r){var i=g({},t.attrs);r!=null&&r.colorChannel1&&i.fill==="colorChannel1"&&(i.fill=r.colorChannel1);var n=e.defIds;return!n||n.length===0||(t.tag==="use"&&i["xlink:href"]&&(i["xlink:href"]=i["xlink:href"]+e.idSuffix),Object.entries(i).forEach(function(a){var s=a[0],l=a[1];typeof l=="string"&&(i[s]=l.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),i}function Y(t,e){var r,i=e.defIds;return!i||i.length===0?t:t.tag==="defs"&&(!((r=t.children)===null||r===void 0)&&r.length)?g(g({},t),{children:t.children.map(function(n){return typeof n.attrs.id=="string"&&i&&i.indexOf(n.attrs.id)>-1?g(g({},n),{attrs:g(g({},n.attrs),{id:n.attrs.id+e.idSuffix})}):n})}):t}function Q(){return Math.random().toString(36).substring(2,8)}E.displayName="UniverIcon";var X={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_217_40",style:{"mask-type":"alpha"},width:17,height:17,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M.9.09h16v16H.9z"}}]},{tag:"g",attrs:{mask:"url(#mask0_217_40)"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.4 7.37a5.78 5.78 0 1110.31 3.58l2.49 2.48a.68.68 0 01-.97.96l-2.48-2.48A5.78 5.78 0 012.4 7.37zm5.77-4.42a4.42 4.42 0 100 8.84 4.42 4.42 0 000-8.84z",fillRule:"evenodd",clipRule:"evenodd"}}]}]},N=p.forwardRef(function(t,e){return p.createElement(E,Object.assign({},t,{id:"search-single-16",ref:e,icon:X}))});N.displayName="SearchSingle16";const Z=N;var $=Object.defineProperty,q=Object.getOwnPropertyDescriptor,U=(t,e,r,i)=>{for(var n=i>1?void 0:i?q(e,r):e,a=t.length-1,s;a>=0;a--)(s=t[a])&&(n=(i?s(e,r,n):s(n))||n);return i&&n&&$(e,r,n),n},y=(t,e)=>(r,i)=>e(r,i,t);class ee extends o.Disposable{}const x=v.createIdentifier("univer.find-replace.service");let j=class extends o.Disposable{constructor(e,r,i,n){super();u(this,"_matchPositionFindModel",null);u(this,"_findModels",[]);u(this,"_matches",[]);u(this,"_positionModel",null);this._state=e,this._providers=r,this._logService=i,this._univerInstanceService=n,this._state.stateUpdates$.subscribe(a=>{typeof a.findString<"u"&&(a.findString?this.find():this._cancelFinding())})}async find(){this._cancelFinding();const e=Array.from(this._providers),r=this._findModels=(await Promise.all(e.map(a=>a.find({text:this._state.findString})))).flat(),i=r.map(a=>a.getMatches()).flat();if(this._matches=i,!i.length)return{results:[]};const n=this._moveToInitialMatch(r,i);return this._state.changeState({matchesCount:i.length,matchesPosition:n+1}),{results:i}}moveToNextMatch(){if(!this._positionModel)return;const e=this._findModels.length===1,r=this._positionModel.moveToNextMatch(e);if(r){const i=this._matches.findIndex(n=>n===r);this._state.changeState({matchesPosition:i+1})}else{const i=this._findModels.findIndex(l=>l===this._positionModel),n=this._findModels[(i+1)%this._findModels.length],a=n.moveToNextMatch(),s=this._matches.findIndex(l=>l===a);this._positionModel=n,this._state.changeState({matchesPosition:s+1})}}moveToPreviousMatch(){if(!this._positionModel)return;const e=this._findModels.length===1,r=this._positionModel.moveToPreviousMatch(e);if(r){const i=this._matches.findIndex(n=>n===r);this._state.changeState({matchesPosition:i+1})}else{const i=this._findModels.findIndex(l=>l===this._positionModel),n=this._findModels[(i-1+this._findModels.length)%this._findModels.length],a=n.moveToPreviousMatch(),s=this._matches.findIndex(l=>l===a);this._positionModel=n,this._state.changeState({matchesPosition:s+1})}}_moveToInitialMatch(e,r){var l;const i=(l=this._univerInstanceService.getFocusedUniverInstance())==null?void 0:l.getUnitId();if(!i)return-1;const n=e.find(m=>m.unitId===i);if(n){this._positionModel=n;const m=n.moveToNextMatch();return r.findIndex(M=>M===m)}this._positionModel=e[0];const a=this._positionModel.moveToNextMatch();return this._matches.findIndex(m=>m===a)}_cancelFinding(){this._providers.forEach(e=>e.cancel()),this._state.changeState({matchesCount:0,matchesPosition:0})}};j=U([y(2,o.ILogService),y(3,o.IUniverInstanceService)],j);function A(){return{revealed:!0,findString:"",replaceRevealed:!1,matchesPosition:0,matchesCount:0}}class te{constructor(){u(this,"_stateUpdates$",new O.Subject);u(this,"stateUpdates$",this._stateUpdates$.asObservable());u(this,"_state$",new O.BehaviorSubject(A()));u(this,"state$",this._state$.asObservable());u(this,"_findString","");u(this,"_revealed",!1);u(this,"_replaceRevealed",!1);u(this,"_matchesPosition",0);u(this,"_matchesCount",0)}get state(){return this._state$.getValue()}get findString(){return this._findString}changeState(e){let r=!1;const i={};typeof e.findString<"u"&&e.findString!==this._findString&&(this._findString=e.findString,i.findString=this._findString,r=!0),typeof e.revealed<"u"&&e.revealed!==this._revealed&&(this._revealed=e.revealed,i.revealed=e.revealed,r=!0),typeof e.replaceRevealed<"u"&&e.replaceRevealed!==this._replaceRevealed&&(this._replaceRevealed=e.replaceRevealed,i.replaceRevealed=e.replaceRevealed,r=!0),typeof e.matchesCount<"u"&&e.matchesCount!==this._matchesCount&&(this._matchesCount=e.matchesCount,i.matchesCount=e.matchesCount,r=!0),typeof e.matchesPosition<"u"&&e.matchesPosition!==this._matchesPosition&&(this._matchesPosition=e.matchesPosition,i.matchesPosition=e.matchesPosition,r=!0),r&&(this._stateUpdates$.next(i),this._state$.next({findString:this._findString,revealed:this._revealed,replaceRevealed:this._replaceRevealed,matchesCount:this._matchesCount,matchesPosition:this._matchesPosition}))}}let F=class extends o.Disposable{constructor(e,r,i){super();u(this,"_providers",new Set);u(this,"_state",new te);u(this,"_model");this._injector=e,this._univerInstanceService=r,this._logService=i}get stateUpdates$(){return this._state.stateUpdates$}get state$(){return this._state.state$}changeFindString(e){this._state.changeState({findString:e})}moveToNextMatch(){var e;this._model&&((e=this._model)==null||e.moveToNextMatch())}moveToPreviousMatch(){var e;this._model&&((e=this._model)==null||e.moveToPreviousMatch())}replace(){return!0}replaceAll(){return!0}revealReplace(){this._state.changeState({replaceRevealed:!0})}disposeModel(){var e;(e=this._model)==null||e.dispose(),this._model=null}start(){if(this._providers.size===0)return!1;this._model=this._injector.createInstance(j,this._state,this._providers);const e=A();return e.revealed=!0,this._state.changeState(e),!0}end(){return this._state.changeState({revealed:!1,replaceRevealed:!1}),!0}registerFindReplaceProvider(e){return this._providers.add(e),o.toDisposable(()=>this._providers.delete(e))}};F=U([y(0,v.Inject(v.Injector)),y(1,o.IUniverInstanceService),y(2,o.ILogService)],F);const b={id:"ui.operation.open-find-dialog",type:o.CommandType.OPERATION,handler:t=>(t.get(x).start(),!0)},w={id:"ui.operation.open-replace-dialog",type:o.CommandType.OPERATION,handler:t=>(t.get(x).start(),!0)},ie={id:"ui.operation.toggle-replace-dialog",type:o.CommandType.OPERATION,handler:t=>(t.get(x),!0)},L={id:"ui.operation.close-find-replace-dialog",type:o.CommandType.OPERATION,handler:t=>!0},V={type:o.CommandType.OPERATION,id:"ui.operation.go-to-next-match",handler:t=>(t.get(x).moveToNextMatch(),!0)},B={type:o.CommandType.OPERATION,id:"ui.operation.go-to-previous-match",handler:t=>(t.get(x).moveToPreviousMatch(),!0)},R="FIND_REPLACE_ACTIVATED";var K={exports:{}},C={};/**
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 ne=p,re=Symbol.for("react.element"),ae=Symbol.for("react.fragment"),oe=Object.prototype.hasOwnProperty,se=ne.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ce={key:!0,ref:!0,__self:!0,__source:!0};function k(t,e,r){var i,n={},a=null,s=null;r!==void 0&&(a=""+r),e.key!==void 0&&(a=""+e.key),e.ref!==void 0&&(s=e.ref);for(i in e)oe.call(e,i)&&!ce.hasOwnProperty(i)&&(n[i]=e[i]);if(t&&t.defaultProps)for(i in e=t.defaultProps,e)n[i]===void 0&&(n[i]=e[i]);return{$$typeof:re,type:t,key:a,ref:s,props:n,_owner:se.current}}C.Fragment=ae,C.jsx=k,C.jsxs=k,K.exports=C;var f=K.exports;const G={findReplaceExpandContainer:"univer-find-replace-expand-container"};function le(){const t=T.useDependency(x),e=T.useDependency(o.LocaleService),r=T.useDependency(h.LayoutService),[i,n]=p.useState(""),[a,s]=p.useState(""),l=p.useRef(null),m=_.useObservable(t.state$,!0),{matchesCount:I,matchesPosition:M}=m,Ce=p.useCallback(()=>t.revealReplace(),[t]),Pe=p.useCallback(d=>t.changeFindString(d),[t]),Oe=p.useCallback(d=>{n(d),Pe(d)},[t]),z=p.useCallback(d=>{s(d)},[t]);p.useEffect(()=>{let d;return l.current&&(d=r.registerContainer(l.current)),()=>d==null?void 0:d.dispose()},[l.current]);function Te(){return f.jsxs(p.Fragment,{children:[f.jsx(_.InputWithSlot,{autoFocus:!0,placeholder:e.t("univer.find-replace.dialog.find-placeholder"),slot:f.jsx(_.Pager,{loop:!0,value:M,total:I,onChange:d=>{M===I&&d===1?t.moveToNextMatch():M===1&&d===I||d<M?t.moveToPreviousMatch():t.moveToNextMatch()}}),value:i,onChange:d=>Oe(d)}),f.jsx("div",{className:G.findReplaceExpandContainer,children:f.jsx(_.Button,{type:"text",size:"small",onClick:Ce,children:e.t("univer.find-replace.dialog.advanced-finding")})})]})}function je(){return f.jsxs(p.Fragment,{children:[f.jsx(_.FormLayout,{label:e.t("univer.find-replace.dialog.find"),children:f.jsx(_.Input,{placeholder:e.t("univer.find-replace.dialog.find-placeholder"),autoFocus:!0,value:i,onChange:d=>z(d)})}),f.jsx(_.FormLayout,{label:e.t("univer.find-replace.dialog.replace"),children:f.jsx(_.Input,{placeholder:e.t("univer.find-replace.dialog.replace-placeholder"),value:a,onChange:d=>z(d)})}),f.jsx(_.FormLayout,{label:e.t("univer.find-replace.dialog.find-range"),children:f.jsx(_.Select,{value:"123",onChange:()=>{}})}),f.jsx(_.Button,{type:"primary",children:e.t("univer.find-replace.dialog.find")}),f.jsx(_.Button,{children:e.t("univer.find-replace.dialog.replace")}),f.jsx(_.Button,{children:e.t("univer.find-replace.dialog.replace-all")})]})}return f.jsx("div",{className:G.findReplaceDialogContainer,ref:l,children:m.replaceRevealed?je():Te()})}function de(t){return{id:b.id,icon:"SearchIcon",tooltip:"toolbar.find-replace",group:h.MenuGroup.TOOLBAR_OTHERS,type:h.MenuItemType.BUTTON,positions:[h.MenuPosition.TOOLBAR_START],hidden$:h.getMenuHiddenObservable(t,o.UniverInstanceType.SHEET)}}const he={id:b.id,description:"shortcut.find-replace.open-find-dialog",binding:h.KeyCode.F|h.MetaKeys.CTRL_COMMAND,group:"4_find-replace",preconditions(t){return!t.getContextValue(R)}},ue={id:w.id,description:"shortcut.find-replace.open-replace-dialog",binding:h.KeyCode.H|h.MetaKeys.CTRL_COMMAND,group:"4_find-replace",preconditions(t){return!t.getContextValue(R)}},pe={id:L.id,description:"shortcut.find-replace.close-dialog",binding:h.KeyCode.ESC,group:"4_find-replace",priority:1e3,preconditions(t){return!!t.getContextValue(R)}},fe={id:V.id,description:"shortcut.find-replace.go-to-next-find-match",binding:h.KeyCode.ENTER,group:"4_find-replace",priority:1e3,preconditions(t){return!!t.getContextValue(R)}},ve={id:B.id,description:"shortcut.find-replace.go-to-previous-find-match",binding:h.KeyCode.ENTER|h.MetaKeys.SHIFT,group:"4_find-replace",priority:1e3,preconditions(t){return!!t.getContextValue(R)}};var _e=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,me=(t,e,r,i)=>{for(var n=i>1?void 0:i?ge(e,r):e,a=t.length-1,s;a>=0;a--)(s=t[a])&&(n=(i?s(e,r,n):s(n))||n);return i&&n&&_e(e,r,n),n},S=(t,e)=>(r,i)=>e(r,i,t);const W="DESKTOP_FIND_REPLACE_DIALOG";let P=class extends o.RxDisposable{constructor(t,e,r,i,n,a,s,l,m,I){super(),this._menuService=t,this._shortcutService=e,this._commandService=r,this._findReplaceService=i,this._dialogService=n,this._contextService=a,this._focusService=s,this._localeService=l,this._componentManager=m,this._injector=I,this._initOperations(),this._initUI(),this._initShortcuts()}_initOperations(){[L,b,w,ie,V,B].forEach(t=>{this.disposeWithMe(this._commandService.registerCommand(t))})}_initUI(){[de].forEach(t=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(t)))}),this.disposeWithMe(this._componentManager.register("FindReplaceDialog",le)),this.disposeWithMe(this._componentManager.register("SearchIcon",Z)),this._findReplaceService.stateUpdates$.pipe(O.takeUntil(this.dispose$)).subscribe(t=>{t.revealed===!0?this._openPanel():t.revealed===!1&&this._closePanel()})}_initShortcuts(){[ue,he,pe,ve,fe].forEach(t=>{this.disposeWithMe(this._shortcutService.registerShortcut(t))})}_openPanel(){this._dialogService.open({id:W,draggable:!0,width:350,title:{title:this._localeService.t("univer.find-replace.dialog.title")},children:{label:"FindReplaceDialog"},onClose:()=>this._closePanel()}),this._contextService.setContextValue(R,!0)}_closePanel(){this._dialogService.close(W),this._contextService.setContextValue(R,!1),this._focusService.forceFocus(),this._findReplaceService.end()}};P=me([o.OnLifecycle(o.LifecycleStages.Rendered,P),S(0,h.IMenuService),S(1,h.IShortcutService),S(2,o.ICommandService),S(3,x),S(4,h.IDialogService),S(5,o.IContextService),S(6,h.IFocusService),S(7,v.Inject(o.LocaleService)),S(8,v.Inject(h.ComponentManager)),S(9,v.Inject(v.Injector))],P);const Se={univer:{"find-replace":{dialog:{title:"查找",find:"查找",replace:"替换","replace-all":"替换全部","find-range":"查找范围","find-placeholder":"输入查找内容","advanced-finding":"替换 / 高级查找","replace-placeholder":"输入替换内容"}}}};var xe=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,Ie=(t,e,r,i)=>{for(var n=i>1?void 0:i?Re(e,r):e,a=t.length-1,s;a>=0;a--)(s=t[a])&&(n=(i?s(e,r,n):s(n))||n);return i&&n&&xe(e,r,n),n},Me=(t,e)=>(r,i)=>e(r,i,t);const ye="FIND_REPLACE";c.UniverFindReplacePlugin=class extends o.Plugin{constructor(e,r){super(ye),this._injector=e,this._localeService=r,this._localeService.load({zhCN:Se})}onStarting(e){[[P],[x,{useClass:F}]].forEach(r=>{e.add(r)})}},c.UniverFindReplacePlugin=Ie([Me(1,v.Inject(o.LocaleService))],c.UniverFindReplacePlugin),c.FindModel=ee,c.IFindReplaceService=x,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,16 +1,11 @@
1
1
  {
2
2
  "name": "@univerjs/find-replace",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0-beta.3",
4
+ "private": false,
4
5
  "description": "",
5
- "keywords": [],
6
6
  "author": "DreamNum <developer@univer.ai>",
7
7
  "license": "Apache-2.0",
8
- "main": "./lib/cjs/index.js",
9
- "module": "./lib/es/index.js",
10
- "types": "./lib/types/index.d.ts",
11
- "publishConfig": {
12
- "access": "public"
13
- },
8
+ "keywords": [],
14
9
  "exports": {
15
10
  ".": {
16
11
  "import": "./lib/es/index.js",
@@ -23,37 +18,52 @@
23
18
  "types": "./lib/types/index.d.ts"
24
19
  }
25
20
  },
21
+ "main": "./lib/cjs/index.js",
22
+ "module": "./lib/es/index.js",
23
+ "types": "./lib/types/index.d.ts",
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
26
27
  "directories": {
27
28
  "lib": "lib"
28
29
  },
29
30
  "files": [
30
31
  "lib"
31
32
  ],
32
- "private": false,
33
- "dependencies": {
34
- "@wendellhu/redi": "^0.12.13",
35
- "rxjs": "^7.8.1",
36
- "@univerjs/core": "0.1.0-beta.2",
37
- "@univerjs/ui": "0.1.0-beta.2"
38
- },
39
- "devDependencies": {
40
- "@vitest/coverage-istanbul": "^1.1.1",
41
- "typescript": "^5.3.3",
42
- "vite": "^5.0.10",
43
- "vite-plugin-dts": "^3.7.0",
44
- "vite-plugin-externals": "^0.6.2",
45
- "vitest": "^1.1.1"
33
+ "engines": {
34
+ "node": ">=16.0.0",
35
+ "npm": ">=8.0.0"
46
36
  },
47
37
  "peerDependencies": {
38
+ "@univerjs/icons": "^0.1.26",
48
39
  "@wendellhu/redi": ">=0.12.13",
40
+ "react": "^18.2.0",
49
41
  "rxjs": ">=7.0.0",
50
- "@univerjs/core": "0.1.0-beta.2",
51
- "@univerjs/ui": "0.1.0-beta.2"
42
+ "@univerjs/core": "0.1.0-beta.3",
43
+ "@univerjs/ui": "0.1.0-beta.3",
44
+ "@univerjs/design": "0.1.0-beta.3"
45
+ },
46
+ "dependencies": {
47
+ "@univerjs/icons": "^0.1.26"
48
+ },
49
+ "devDependencies": {
50
+ "@types/react": "^18.2.48",
51
+ "@wendellhu/redi": "^0.12.13",
52
+ "react": "^18.2.0",
53
+ "rxjs": "^7.8.1",
54
+ "typescript": "^5.3.3",
55
+ "vite": "^5.0.12",
56
+ "vitest": "^1.2.1",
57
+ "@univerjs/core": "0.1.0-beta.3",
58
+ "@univerjs/ui": "0.1.0-beta.3",
59
+ "@univerjs/shared": "0.1.0-beta.3",
60
+ "@univerjs/design": "0.1.0-beta.3"
52
61
  },
53
62
  "scripts": {
54
63
  "test": "vitest run",
55
64
  "test:watch": "vitest",
56
65
  "coverage": "vitest run --coverage",
66
+ "lint:types": "tsc --noEmit",
57
67
  "build": "tsc && vite build"
58
68
  }
59
69
  }