@univerjs/core 0.2.4 → 0.2.5
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 +11 -9
- package/lib/es/index.js +5239 -3956
- package/lib/types/common/const.d.ts +1 -0
- package/lib/types/common/di.d.ts +17 -0
- package/lib/types/common/json.d.ts +18 -0
- package/lib/types/index.d.ts +4 -2
- package/lib/types/observer/observable.d.ts +2 -1
- package/lib/types/services/__tests__/index.d.ts +7 -7
- package/lib/types/services/authz-io/type.d.ts +1 -1
- package/lib/types/services/command/command.service.d.ts +2 -2
- package/lib/types/services/config/config.service.d.ts +1 -1
- package/lib/types/services/context/context.service.d.ts +1 -1
- package/lib/types/services/instance/instance.service.d.ts +2 -2
- package/lib/types/services/lifecycle/lifecycle.d.ts +1 -1
- package/lib/types/services/lifecycle/lifecycle.service.d.ts +1 -1
- package/lib/types/services/local-storage/local-storage.service.d.ts +1 -1
- package/lib/types/services/log/log.service.d.ts +1 -1
- package/lib/types/services/permission/type.d.ts +1 -1
- package/lib/types/services/plugin/plugin-override.d.ts +1 -1
- package/lib/types/services/plugin/plugin.d.ts +1 -1
- package/lib/types/services/plugin/plugin.service.d.ts +1 -1
- package/lib/types/services/resource-loader/type.d.ts +1 -1
- package/lib/types/services/resource-manager/type.d.ts +2 -2
- package/lib/types/services/snapshot/snapshot-server.service.d.ts +1 -1
- package/lib/types/services/undoredo/undoredo.service.d.ts +2 -2
- package/lib/types/shared/lifecycle.d.ts +1 -1
- package/lib/types/shared/lru/lru-map.d.ts +1 -1
- package/lib/types/shared/rxjs.d.ts +1 -1
- package/lib/types/sheets/view-model.d.ts +1 -1
- package/lib/types/univer.d.ts +1 -1
- package/lib/umd/index.js +11 -9
- package/package.json +4 -4
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export declare const DOCS_NORMAL_EDITOR_UNIT_ID_KEY = "__INTERNAL_EDITOR__DOCS_NORMAL";
|
|
17
17
|
export declare const DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY = "__INTERNAL_EDITOR__DOCS_FORMULA_BAR";
|
|
18
|
+
export declare const DOCS_ZEN_EDITOR_UNIT_ID_KEY = "__defaultDocumentZenEditorSpecialUnitId_20231218__";
|
|
18
19
|
export declare const DEFAULT_EMPTY_DOCUMENT_VALUE = "\r\n";
|
|
19
20
|
export declare function createInternalEditorID(id: string): string;
|
|
20
21
|
export declare function isInternalEditorID(id: string): boolean;
|
|
@@ -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 * from '@wendellhu/redi';
|
|
17
|
+
export * from '@wendellhu/redi/react-bindings';
|
|
@@ -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
|
+
export type Serializable = {
|
|
17
|
+
[property: string]: Serializable;
|
|
18
|
+
} | readonly Serializable[] | string | number | boolean | null;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
export type { Serializable } from './common/json';
|
|
16
17
|
export { DEFAULT_DOCUMENT_SUB_COMPONENT_ID } from './docs/data-model/subdocument';
|
|
17
18
|
export { type UnitType, UnitModel, UniverInstanceType } from './common/unit';
|
|
18
19
|
export { Registry, RegistryAsMap } from './common/registry';
|
|
@@ -22,7 +23,7 @@ export { isNumeric, isSafeNumeric } from './common/number';
|
|
|
22
23
|
export { isBooleanString } from './common/boolean';
|
|
23
24
|
export { dedupe, remove, rotate, groupBy, makeArray } from './common/array';
|
|
24
25
|
export { mergeSets } from './common/set';
|
|
25
|
-
export { DEFAULT_EMPTY_DOCUMENT_VALUE, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, createInternalEditorID, isInternalEditorID, } from './common/const';
|
|
26
|
+
export { DEFAULT_EMPTY_DOCUMENT_VALUE, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, createInternalEditorID, isInternalEditorID, } from './common/const';
|
|
26
27
|
export { throttle } from './common/function';
|
|
27
28
|
export { MemoryCursor } from './common/memory-cursor';
|
|
28
29
|
export { requestImmediateMacroTask } from './common/request-immediate-macro-task';
|
|
@@ -37,7 +38,7 @@ export type { TPriority } from './docs/data-model/text-x/text-x';
|
|
|
37
38
|
export { JSONX, JSON1 } from './docs/data-model/json-x/json-x';
|
|
38
39
|
export type { JSONXActions, JSONXPath } from './docs/data-model/json-x/json-x';
|
|
39
40
|
export { replaceInDocumentBody } from './docs/data-model/replacement';
|
|
40
|
-
export { type IEventObserver, EventState, EventSubject } from './observer/observable';
|
|
41
|
+
export { type IEventObserver, EventState, EventSubject, fromEventSubject } from './observer/observable';
|
|
41
42
|
export { Plugin } from './services/plugin/plugin';
|
|
42
43
|
export { PluginService, DependentOn } from './services/plugin/plugin.service';
|
|
43
44
|
export { type CommandListener, CommandService, CommandType, type ICommand, type ICommandInfo, ICommandService, type IExecutionOptions, type IMultiCommand, type IMutation, type IMutationCommonParams, type IMutationInfo, type IOperation, type IOperationInfo, NilCommand, sequenceExecute, sequenceExecuteAsync, } from './services/command/command.service';
|
|
@@ -110,3 +111,4 @@ export { normalizeBody, getCustomRangeSlice, getCustomDecorationSlice } from './
|
|
|
110
111
|
export { updateAttributeByDelete } from './docs/data-model/text-x/apply-utils/delete-apply';
|
|
111
112
|
export { updateAttributeByInsert } from './docs/data-model/text-x/apply-utils/insert-apply';
|
|
112
113
|
export { nameCharacterCheck } from './shared/name';
|
|
114
|
+
export * from './common/di';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Observer as RxObserver, Subscription, Subject } from 'rxjs';
|
|
1
|
+
import { Observer as RxObserver, Subscription, Observable, Subject } from 'rxjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A class serves as a medium between the observable and its observers
|
|
@@ -44,4 +44,5 @@ export declare class EventSubject<T> extends Subject<[T, EventState]> {
|
|
|
44
44
|
clearObservers(): void;
|
|
45
45
|
emitEvent(event: T): INotifyObserversReturn;
|
|
46
46
|
}
|
|
47
|
+
export declare function fromEventSubject<T>(subject$: EventSubject<T>): Observable<T>;
|
|
47
48
|
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ICommandService, Univer } from '@univerjs/core';
|
|
2
|
-
import { Dependency } from '
|
|
2
|
+
import { Dependency } from '../../common/di';
|
|
3
3
|
|
|
4
4
|
export declare const createTestBed: (dependencies?: Dependency[]) => {
|
|
5
5
|
univer: Univer;
|
|
6
6
|
get: {
|
|
7
|
-
<T>(id: import('@
|
|
8
|
-
<T>(id: import('@
|
|
9
|
-
<T>(id: import('@
|
|
10
|
-
<T>(id: import('@
|
|
11
|
-
<T>(id: import('@
|
|
12
|
-
<T>(id: import('@
|
|
7
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, lookUp?: import('@univerjs/core').LookUp): T;
|
|
8
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity: import("@univerjs/core").Quantity.MANY, lookUp?: import('@univerjs/core').LookUp): T[];
|
|
9
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity: import("@univerjs/core").Quantity.OPTIONAL, lookUp?: import('@univerjs/core').LookUp): T | null;
|
|
10
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity: import("@univerjs/core").Quantity.REQUIRED, lookUp?: import('@univerjs/core').LookUp): T;
|
|
11
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity?: import('@univerjs/core').Quantity, lookUp?: import('@univerjs/core').LookUp): T[] | T | null;
|
|
12
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantityOrLookup?: import('@univerjs/core').Quantity | import('@univerjs/core').LookUp, lookUp?: import('@univerjs/core').LookUp): T[] | T | null;
|
|
13
13
|
};
|
|
14
14
|
workbook: import('@univerjs/core').Workbook;
|
|
15
15
|
unitId: string;
|
|
@@ -17,4 +17,4 @@ export interface IAuthzIoService {
|
|
|
17
17
|
createCollaborator(config: ICreateCollaboratorRequest, context?: ILogContext): Promise<void>;
|
|
18
18
|
putCollaborators(config: IPutCollaboratorsRequest, context?: ILogContext): Promise<void>;
|
|
19
19
|
}
|
|
20
|
-
export declare const IAuthzIoService: import('@
|
|
20
|
+
export declare const IAuthzIoService: import('@univerjs/core').IdentifierDecorator<IAuthzIoService>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IAccessor, IDisposable, Injector } from '
|
|
1
|
+
import { IAccessor, IDisposable, Injector } from '../../common/di';
|
|
2
2
|
import { Disposable } from '../../shared/lifecycle';
|
|
3
3
|
import { IContextService } from '../context/context.service';
|
|
4
4
|
import { ILogService } from '../log/log.service';
|
|
@@ -111,7 +111,7 @@ export interface ICommandService {
|
|
|
111
111
|
*/
|
|
112
112
|
beforeCommandExecuted(listener: CommandListener): IDisposable;
|
|
113
113
|
}
|
|
114
|
-
export declare const ICommandService: import('
|
|
114
|
+
export declare const ICommandService: import('../../common/di').IdentifierDecorator<ICommandService>;
|
|
115
115
|
/**
|
|
116
116
|
* The registry of commands.
|
|
117
117
|
*/
|
|
@@ -3,7 +3,7 @@ import { Nullable } from '../../shared/types';
|
|
|
3
3
|
/**
|
|
4
4
|
* IConfig provides universal configuration for the whole application.
|
|
5
5
|
*/
|
|
6
|
-
export declare const IConfigService: import('
|
|
6
|
+
export declare const IConfigService: import('../../common/di').IdentifierDecorator<IConfigService>;
|
|
7
7
|
export interface IConfigService {
|
|
8
8
|
getConfig<T>(id: string, defaultValue: T): T;
|
|
9
9
|
getConfig<T>(id: string): Nullable<T>;
|
|
@@ -9,7 +9,7 @@ export interface IContextService {
|
|
|
9
9
|
setContextValue(key: string, value: boolean): void;
|
|
10
10
|
subscribeContextValue$(key: string): Observable<boolean>;
|
|
11
11
|
}
|
|
12
|
-
export declare const IContextService: import('
|
|
12
|
+
export declare const IContextService: import('../../common/di').IdentifierDecorator<IContextService>;
|
|
13
13
|
export declare class ContextService extends Disposable implements IContextService {
|
|
14
14
|
private _contextChanged$;
|
|
15
15
|
readonly contextChanged$: Observable<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IDisposable, Injector } from '@wendellhu/redi';
|
|
2
1
|
import { Observable } from 'rxjs';
|
|
2
|
+
import { IDisposable, Injector } from '../../common/di';
|
|
3
3
|
import { DocumentDataModel } from '../../docs/data-model/document-data-model';
|
|
4
4
|
import { Nullable } from '../../shared';
|
|
5
5
|
import { Disposable } from '../../shared/lifecycle';
|
|
@@ -47,7 +47,7 @@ export interface IUniverInstanceService {
|
|
|
47
47
|
/** @deprecated */
|
|
48
48
|
getCurrentUniverDocInstance(): Nullable<DocumentDataModel>;
|
|
49
49
|
}
|
|
50
|
-
export declare const IUniverInstanceService: import('
|
|
50
|
+
export declare const IUniverInstanceService: import('../../common/di').IdentifierDecorator<IUniverInstanceService>;
|
|
51
51
|
export declare class UniverInstanceService extends Disposable implements IUniverInstanceService {
|
|
52
52
|
private readonly _injector;
|
|
53
53
|
private readonly _contextService;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Injector } from '@wendellhu/redi';
|
|
2
1
|
import { Observable } from 'rxjs';
|
|
2
|
+
import { Injector } from '../../common/di';
|
|
3
3
|
import { Disposable } from '../../shared/lifecycle';
|
|
4
4
|
import { ILogService } from '../log/log.service';
|
|
5
5
|
import { LifecycleStages } from './lifecycle';
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export declare const ILocalStorageService: import('
|
|
16
|
+
export declare const ILocalStorageService: import('../../common/di').IdentifierDecorator<ILocalStorageService>;
|
|
17
17
|
export type LocalStorageValueTypes = string;
|
|
18
18
|
export interface ILocalStorageService {
|
|
19
19
|
getItem<T>(key: string): Promise<T | null>;
|
|
@@ -15,7 +15,7 @@ export interface ILogService {
|
|
|
15
15
|
error(...args: ArgsType): void;
|
|
16
16
|
setLogLevel(enabled: LogLevel): void;
|
|
17
17
|
}
|
|
18
|
-
export declare const ILogService: import('
|
|
18
|
+
export declare const ILogService: import('../../common/di').IdentifierDecorator<ILogService>;
|
|
19
19
|
export declare class DesktopLogService extends Disposable implements ILogService {
|
|
20
20
|
private _logLevel;
|
|
21
21
|
debug(...args: ArgsType): void;
|
|
@@ -40,4 +40,4 @@ export interface IPermissionService {
|
|
|
40
40
|
composePermission(permissionId: string[]): IPermissionPoint<unknown>[];
|
|
41
41
|
getAllPermissionPoint(): Map<string, Observable<IPermissionPoint<unknown>>>;
|
|
42
42
|
}
|
|
43
|
-
export declare const IPermissionService: import('
|
|
43
|
+
export declare const IPermissionService: import('../../common/di').IdentifierDecorator<IPermissionService>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dependency, DependencyIdentifier, DependencyItem } from '
|
|
1
|
+
import { Dependency, DependencyIdentifier, DependencyItem } from '../../common/di';
|
|
2
2
|
|
|
3
3
|
export type NullableDependencyPair<T> = [DependencyIdentifier<T>, DependencyItem<T> | null];
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDisposable, Injector } from '
|
|
1
|
+
import { IDisposable, Injector } from '../../common/di';
|
|
2
2
|
import { Disposable } from '../../shared/lifecycle';
|
|
3
3
|
import { UniverInstanceType } from '../../common/unit';
|
|
4
4
|
import { LifecycleInitializerService, LifecycleService } from '../lifecycle/lifecycle.service';
|
|
@@ -7,4 +7,4 @@ export interface IResourceLoaderService {
|
|
|
7
7
|
saveWorkbook: (workbook: Workbook) => IWorkbookData;
|
|
8
8
|
saveDoc: (doc: DocumentDataModel) => IDocumentData;
|
|
9
9
|
}
|
|
10
|
-
export declare const IResourceLoaderService: import('
|
|
10
|
+
export declare const IResourceLoaderService: import('../../common/di').IdentifierDecorator<IResourceLoaderService>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IDisposable } from '@wendellhu/redi';
|
|
2
1
|
import { Observable } from 'rxjs';
|
|
3
2
|
import { UniverInstanceType } from '@univerjs/core';
|
|
3
|
+
import { IDisposable } from '../../common/di';
|
|
4
4
|
import { IWorkbookData } from '../../types/interfaces/i-workbook-data';
|
|
5
5
|
|
|
6
6
|
type IBusinessName = 'SHEET' | 'DOC';
|
|
@@ -23,5 +23,5 @@ export interface IResourceManagerService {
|
|
|
23
23
|
loadResources: (unitId: string, resources: IWorkbookData['resources']) => void;
|
|
24
24
|
unloadResources(unitId: string): void;
|
|
25
25
|
}
|
|
26
|
-
export declare const IResourceManagerService: import('@
|
|
26
|
+
export declare const IResourceManagerService: import('@univerjs/core').IdentifierDecorator<IResourceManagerService>;
|
|
27
27
|
export {};
|
|
@@ -6,7 +6,7 @@ import { ILogContext } from '../log/context';
|
|
|
6
6
|
* or load snapshots. This service should be implemented by the host environment.
|
|
7
7
|
* And it shouldn't contain any business logic.
|
|
8
8
|
*/
|
|
9
|
-
export declare const ISnapshotServerService: import('
|
|
9
|
+
export declare const ISnapshotServerService: import('../../common/di').IdentifierDecorator<ISnapshotServerService>;
|
|
10
10
|
export interface ISnapshotServerService {
|
|
11
11
|
/** Load snapshot from a database. */
|
|
12
12
|
getUnitOnRev: (context: ILogContext, params: IGetUnitOnRevRequest) => Promise<IGetUnitOnRevResponse>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IAccessor, IDisposable } from '@wendellhu/redi';
|
|
2
1
|
import { Observable, BehaviorSubject } from 'rxjs';
|
|
2
|
+
import { IAccessor, IDisposable } from '../../common/di';
|
|
3
3
|
import { Disposable } from '../../shared/lifecycle';
|
|
4
4
|
import { IMutationInfo, CommandType, ICommandService } from '../command/command.service';
|
|
5
5
|
import { IContextService } from '../context/context.service';
|
|
@@ -44,7 +44,7 @@ export interface IUndoRedoCommandInfos {
|
|
|
44
44
|
undos: IMutationInfo[];
|
|
45
45
|
redos: IMutationInfo[];
|
|
46
46
|
}
|
|
47
|
-
export declare const IUndoRedoService: import('
|
|
47
|
+
export declare const IUndoRedoService: import('../../common/di').IdentifierDecorator<IUndoRedoService>;
|
|
48
48
|
export interface IUndoRedoStatus {
|
|
49
49
|
undos: number;
|
|
50
50
|
redos: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IDisposable } from '@wendellhu/redi';
|
|
2
1
|
import { Subscription, SubscriptionLike, Subject } from 'rxjs';
|
|
2
|
+
import { IDisposable } from '../common/di';
|
|
3
3
|
|
|
4
4
|
type DisposableLike = IDisposable | SubscriptionLike | (() => void);
|
|
5
5
|
export declare function toDisposable(disposable: IDisposable): IDisposable;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDisposable } from '
|
|
1
|
+
import { IDisposable } from '../common/di';
|
|
2
2
|
import { Nullable } from '../common/type-util';
|
|
3
3
|
import { Disposable } from '../shared/lifecycle';
|
|
4
4
|
import { ICellData, ICellDataForSheetInterceptor } from '../types/interfaces/i-cell-data';
|
package/lib/types/univer.d.ts
CHANGED