@univerjs/core 0.1.0-alpha.2 → 0.1.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/lib/cjs/index.js +5 -5
  3. package/lib/es/index.js +2578 -2509
  4. package/lib/types/basics/plugin-holder.d.ts +30 -0
  5. package/lib/types/basics/univer-doc.d.ts +7 -11
  6. package/lib/types/basics/univer-sheet.d.ts +7 -21
  7. package/lib/types/basics/univer-slide.d.ts +6 -19
  8. package/lib/types/basics/univer.d.ts +18 -13
  9. package/lib/types/common/memory-cursor.d.ts +1 -0
  10. package/lib/types/{shared/gen-name.d.ts → common/shims.d.ts} +1 -8
  11. package/lib/types/docs/data-model/index.d.ts +1 -0
  12. package/lib/types/docs/data-model/preset-list-type.d.ts +50 -0
  13. package/lib/types/index.d.ts +2 -1
  14. package/lib/types/plugin/plugin.d.ts +4 -3
  15. package/lib/types/services/command/command.service.d.ts +3 -3
  16. package/lib/types/services/instance/instance.service.d.ts +4 -4
  17. package/lib/types/services/log/log.service.d.ts +8 -6
  18. package/lib/types/shared/color/color-kit.d.ts +64 -0
  19. package/lib/types/shared/color/color.d.ts +17 -3
  20. package/lib/types/shared/common.d.ts +1 -3
  21. package/lib/types/shared/index.d.ts +1 -3
  22. package/lib/types/shared/locale.d.ts +1 -4
  23. package/lib/types/shared/object-matrix.d.ts +30 -28
  24. package/lib/types/shared/rectangle.d.ts +1 -0
  25. package/lib/types/shared/sort-rules.d.ts +2 -2
  26. package/lib/types/shared/tools.d.ts +0 -5
  27. package/lib/types/sheets/column-manager.d.ts +7 -8
  28. package/lib/types/sheets/range.d.ts +4 -4
  29. package/lib/types/sheets/row-manager.d.ts +7 -7
  30. package/lib/types/sheets/styles.d.ts +4 -6
  31. package/lib/types/sheets/workbook.d.ts +10 -14
  32. package/lib/types/sheets/worksheet.d.ts +1 -1
  33. package/lib/types/types/enum/border-style-types.d.ts +6 -1
  34. package/lib/types/types/enum/text-style.d.ts +3 -3
  35. package/lib/types/types/interfaces/i-document-data.d.ts +3 -2
  36. package/lib/types/types/interfaces/i-range.d.ts +13 -11
  37. package/lib/types/types/interfaces/i-style-data.d.ts +17 -0
  38. package/lib/types/types/interfaces/i-worksheet-data.d.ts +4 -5
  39. package/lib/umd/index.js +5 -5
  40. package/package.json +4 -4
  41. package/lib/types/shared/color/color-builder.d.ts +0 -35
  42. package/lib/types/shared/object-array.d.ts +0 -110
@@ -0,0 +1,30 @@
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 { Injector } from '@wendellhu/redi';
17
+ import type { Plugin, PluginCtor } from '../plugin/plugin';
18
+ import { LifecycleStages } from '../services/lifecycle/lifecycle';
19
+ import type { LifecycleInitializerService, LifecycleService } from '../services/lifecycle/lifecycle.service';
20
+ import { Disposable } from '../shared/lifecycle';
21
+ export declare abstract class PluginHolder extends Disposable {
22
+ protected abstract get _lifecycleService(): LifecycleService;
23
+ protected abstract get _lifecycleInitializerService(): LifecycleInitializerService;
24
+ protected abstract get _injector(): Injector;
25
+ protected _started: boolean;
26
+ addPlugins(plugins: Array<[PluginCtor<any>, any]>): void;
27
+ protected _takePluginsThroughLifecycle(plugins: Plugin[], skipStarting?: boolean): void;
28
+ protected _pluginsRunLifecycle(plugins: Plugin[], lifecycle: LifecycleStages): void;
29
+ protected _initPlugin<T extends Plugin>(plugin: PluginCtor<T>, options: any): Plugin;
30
+ }
@@ -15,20 +15,16 @@
15
15
  */
16
16
  import { Injector } from '@wendellhu/redi';
17
17
  import { DocumentDataModel } from '../docs/data-model/document-data-model';
18
- import type { Plugin, PluginCtor } from '../plugin/plugin';
19
- import { LifecycleInitializerService } from '../services/lifecycle/lifecycle.service';
20
- import { Disposable } from '../shared/lifecycle';
18
+ import { LifecycleInitializerService, LifecycleService } from '../services/lifecycle/lifecycle.service';
21
19
  import type { IDocumentData } from '../types/interfaces/i-document-data';
20
+ import { PluginHolder } from './plugin-holder';
22
21
  /**
23
22
  * Externally provided UniverDoc root instance
24
23
  */
25
- export declare class UniverDoc extends Disposable {
26
- private readonly _injector;
27
- private readonly _initService;
28
- private readonly _pluginStore;
29
- constructor(_injector: Injector, _initService: LifecycleInitializerService);
30
- start(): void;
31
- ready(): void;
24
+ export declare class UniverDoc extends PluginHolder {
25
+ protected readonly _injector: Injector;
26
+ protected readonly _lifecycleService: LifecycleService;
27
+ protected readonly _lifecycleInitializerService: LifecycleInitializerService;
28
+ constructor(_injector: Injector, _lifecycleService: LifecycleService, _lifecycleInitializerService: LifecycleInitializerService);
32
29
  createDoc(docData: Partial<IDocumentData>): DocumentDataModel;
33
- addPlugin<T extends Plugin>(pluginCtor: PluginCtor<T>, options: any): void;
34
30
  }
@@ -15,31 +15,17 @@
15
15
  */
16
16
  import type { IDisposable } from '@wendellhu/redi';
17
17
  import { Injector } from '@wendellhu/redi';
18
- import type { Plugin, PluginCtor } from '../plugin/plugin';
19
- import { LifecycleInitializerService } from '../services/lifecycle/lifecycle.service';
20
- import { Disposable } from '../shared/lifecycle';
18
+ import { LifecycleInitializerService, LifecycleService } from '../services/lifecycle/lifecycle.service';
21
19
  import { Workbook } from '../sheets/workbook';
22
20
  import type { IWorkbookData } from '../types/interfaces/i-workbook-data';
21
+ import { PluginHolder } from './plugin-holder';
23
22
  /**
24
23
  * Externally provided UniverSheet root instance
25
24
  */
26
- export declare class UniverSheet extends Disposable implements IDisposable {
27
- private readonly _injector;
28
- private readonly _initService;
29
- private readonly _pluginStore;
30
- constructor(_injector: Injector, _initService: LifecycleInitializerService);
31
- start(): void;
32
- ready(): void;
25
+ export declare class UniverSheet extends PluginHolder implements IDisposable {
26
+ protected readonly _injector: Injector;
27
+ protected readonly _lifecycleService: LifecycleService;
28
+ protected readonly _lifecycleInitializerService: LifecycleInitializerService;
29
+ constructor(_injector: Injector, _lifecycleService: LifecycleService, _lifecycleInitializerService: LifecycleInitializerService);
33
30
  createSheet(workbookConfig: Partial<IWorkbookData>): Workbook;
34
- dispose(): void;
35
- /**
36
- * Add a plugin into UniverSheet. UniverSheet should add dependencies exposed from this plugin to its DI system.
37
- *
38
- * @param plugin constructor of the plugin class
39
- * @param options options to this plugin
40
- *
41
- * @internal
42
- */
43
- addPlugin<T extends Plugin>(plugin: PluginCtor<T>, options: any): void;
44
- private _initDependencies;
45
31
  }
@@ -14,30 +14,17 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Injector } from '@wendellhu/redi';
17
- import type { Plugin, PluginCtor } from '../plugin/plugin';
18
17
  import { LifecycleInitializerService, LifecycleService } from '../services/lifecycle/lifecycle.service';
19
- import { Disposable } from '../shared/lifecycle';
20
18
  import { Slide } from '../slides/domain/slide-model';
21
19
  import type { ISlideData } from '../types/interfaces/i-slide-data';
20
+ import { PluginHolder } from './plugin-holder';
22
21
  /**
23
22
  * Externally provided UniverSlide root instance
24
23
  */
25
- export declare class UniverSlide extends Disposable {
26
- private readonly _injector;
27
- private readonly _lifecycleService;
28
- private readonly _initializerService;
29
- private readonly _pluginStore;
30
- constructor(_injector: Injector, _lifecycleService: LifecycleService, _initializerService: LifecycleInitializerService);
31
- start(): void;
32
- ready(): void;
24
+ export declare class UniverSlide extends PluginHolder {
25
+ protected readonly _injector: Injector;
26
+ protected readonly _lifecycleService: LifecycleService;
27
+ protected readonly _lifecycleInitializerService: LifecycleInitializerService;
28
+ constructor(_injector: Injector, _lifecycleService: LifecycleService, _lifecycleInitializerService: LifecycleInitializerService);
33
29
  createSlide(data: Partial<ISlideData>): Slide;
34
- /**
35
- * Add a plugin into UniverSlide. UniverSlide should add dependencies exposed from this plugin to its DI system.
36
- *
37
- * @param plugin constructor of the plugin class
38
- * @param options options to this plugin
39
- *
40
- * @internal
41
- */
42
- addPlugin<T extends Plugin>(plugin: PluginCtor<T>, options: any): void;
43
30
  }
@@ -16,26 +16,25 @@
16
16
  import { Injector } from '@wendellhu/redi';
17
17
  import type { DocumentDataModel } from '../docs/data-model/document-data-model';
18
18
  import type { Plugin, PluginCtor } from '../plugin/plugin';
19
+ import { LifecycleInitializerService, LifecycleService } from '../services/lifecycle/lifecycle.service';
19
20
  import type { Workbook } from '../sheets/workbook';
20
21
  import type { Slide } from '../slides/domain/slide-model';
21
22
  import type { LocaleType } from '../types/enum/locale-type';
22
23
  import type { IDocumentData, ISlideData, IUniverData, IWorkbookData } from '../types/interfaces';
23
- /**
24
- * Univer.
25
- */
26
- export declare class Univer {
27
- private readonly _rootInjector;
24
+ import { PluginHolder } from './plugin-holder';
25
+ export declare class Univer extends PluginHolder {
26
+ protected readonly _injector: Injector;
28
27
  private readonly _univerPluginStore;
29
28
  private readonly _univerPluginRegistry;
30
29
  private _univerSheet;
31
30
  private _univerDoc;
32
31
  private _univerSlide;
33
32
  private get _univerInstanceService();
33
+ protected get _lifecycleService(): LifecycleService;
34
+ protected get _lifecycleInitializerService(): LifecycleInitializerService;
34
35
  constructor(univerData?: Partial<IUniverData>);
35
36
  __getInjector(): Injector;
36
37
  dispose(): void;
37
- /** Register a plugin into univer. */
38
- registerPlugin<T extends Plugin>(plugin: PluginCtor<T>, configs?: any): void;
39
38
  setLocale(locale: LocaleType): void;
40
39
  /**
41
40
  * Create a univer sheet instance with internal dependency injection.
@@ -44,12 +43,18 @@ export declare class Univer {
44
43
  createUniverDoc(config: Partial<IDocumentData>): DocumentDataModel;
45
44
  createUniverSlide(config: Partial<ISlideData>): Slide;
46
45
  private _initDependencies;
47
- private _tryStart;
46
+ /**
47
+ * Initialize modules provided by Univer-type plugins.
48
+ */
49
+ private _tryProgressToStart;
48
50
  private _tryProgressToReady;
51
+ /** Register a plugin into univer. */
52
+ registerPlugin<T extends Plugin>(plugin: PluginCtor<T>, config?: any): void;
53
+ private _initLazyPluginsTimer?;
54
+ private _scheduleInitPluginAfterStarted;
55
+ private _flushLazyPlugins;
49
56
  private _registerUniverPlugin;
50
- private _registerUniverSheets;
51
- private _registerUniverDocs;
52
- private _registerUniverSlides;
53
- private _initializePluginsForDoc;
54
- private _initializePluginsForSlide;
57
+ private _registerSheetsPlugin;
58
+ private _registerDocsPlugin;
59
+ private _registerSlidesPlugin;
55
60
  }
@@ -17,4 +17,5 @@ export declare class MemoryCursor {
17
17
  cursor: number;
18
18
  reset(): this;
19
19
  moveCursor(pos: number): void;
20
+ moveCursorTo(pos: number): void;
20
21
  }
@@ -13,11 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare class GenName {
17
- private _include;
18
- private _count;
19
- constructor();
20
- checked(name: string): boolean;
21
- onlyName(name: string): string;
22
- sheetName(name?: string): string;
23
- }
16
+ export declare function installShims(): void;
@@ -14,4 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export * from './document-data-model';
17
+ export * from './preset-list-type';
17
18
  export * from './types';
@@ -0,0 +1,50 @@
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 { BulletAlignment, GlyphType } from '../../types/interfaces/i-document-data';
17
+ export declare enum PresetListType {
18
+ BULLET_LIST = "BULLET_LIST",
19
+ ORDER_LIST = "ORDER_LIST"
20
+ }
21
+ export declare const PRESET_LIST_TYPE: {
22
+ BULLET_LIST: {
23
+ listType: PresetListType;
24
+ nestingLevel: {
25
+ bulletAlignment: BulletAlignment;
26
+ glyphFormat: string;
27
+ textStyle: {
28
+ fs: number;
29
+ };
30
+ startNumber: number;
31
+ glyphSymbol: string;
32
+ hanging: number;
33
+ indentStart: number;
34
+ }[];
35
+ };
36
+ ORDER_LIST: {
37
+ listType: PresetListType;
38
+ nestingLevel: {
39
+ bulletAlignment: BulletAlignment;
40
+ glyphFormat: string;
41
+ textStyle: {
42
+ fs: number;
43
+ };
44
+ startNumber: number;
45
+ glyphType: GlyphType;
46
+ hanging: number;
47
+ indentStart: number;
48
+ }[];
49
+ };
50
+ };
@@ -30,7 +30,7 @@ export { ContextService, IContextService } from './services/context/context.serv
30
30
  export { ErrorService, type IError } from './services/error/error.service';
31
31
  export type { IOffset, IScale, ISize, ITransformState } from './services/floating-object/floating-object-interfaces';
32
32
  export { DEFAULT_DOCUMENT_SUB_COMPONENT_ID, FloatingObjectManagerService, type IFloatingObjectManagerParam, type IFloatingObjectManagerSearchItemParam, IFloatingObjectManagerService, } from './services/floating-object/floating-object-manager.service';
33
- export { DocumentType, IUniverInstanceService } from './services/instance/instance.service';
33
+ export { IUniverInstanceService, UniverInstanceType } from './services/instance/instance.service';
34
34
  export { LifecycleStages, OnLifecycle, runOnLifecycle } from './services/lifecycle/lifecycle';
35
35
  export { LifecycleService } from './services/lifecycle/lifecycle.service';
36
36
  export { ILocalStorageService } from './services/local-storage/local-storage.service';
@@ -45,6 +45,7 @@ export { type IUndoRedoCommandInfos, type IUndoRedoItem, IUndoRedoService, type
45
45
  export * from './shared';
46
46
  export type { IComposeInterceptors, IInterceptor, InterceptorHandler } from './common/interceptor';
47
47
  export { composeInterceptors, createInterceptorKey, InterceptorManager } from './common/interceptor';
48
+ export type { PluginCtor } from './plugin/plugin';
48
49
  export { Range } from './sheets/range';
49
50
  export { deserializeRangeWithSheet, getAbsoluteRefTypeWithSingleString, getAbsoluteRefTypeWitString, serializeRange, serializeRangeToRefString, serializeRangeWithSheet, serializeRangeWithSpreadsheet, } from './sheets/reference';
50
51
  export { Styles } from './sheets/styles';
@@ -40,14 +40,14 @@ export declare abstract class Plugin {
40
40
  getPluginName(): string;
41
41
  }
42
42
  interface IPluginRegistryItem {
43
- plugin: typeof Plugin;
43
+ plugin: PluginCtor<Plugin>;
44
44
  options: any;
45
45
  }
46
46
  /**
47
47
  * Store plugin instances.
48
48
  */
49
49
  export declare class PluginStore {
50
- private readonly plugins;
50
+ private readonly _plugins;
51
51
  addPlugin(plugin: Plugin): void;
52
52
  removePlugins(): Plugin[];
53
53
  forEachPlugin(callback: (plugin: Plugin) => void): void;
@@ -56,8 +56,9 @@ export declare class PluginStore {
56
56
  * Store plugin registry items.
57
57
  */
58
58
  export declare class PluginRegistry {
59
- private readonly pluginsRegisteredByBusiness;
59
+ private readonly _pluginsRegisteredByBusiness;
60
60
  registerPlugin(pluginCtor: PluginCtor<any>, options: any): void;
61
61
  getRegisterPlugins(type: PluginType): [IPluginRegistryItem];
62
+ clearPluginsOfType(type: PluginType): void;
62
63
  }
63
64
  export {};
@@ -95,9 +95,9 @@ export interface IOperationInfo<T extends object = object> {
95
95
  params: T;
96
96
  }
97
97
  export interface IExecutionOptions {
98
- /** This mutation should only be executed on the local machine. */
99
- local?: boolean;
100
- /** From collaboration peers. */
98
+ /** This mutation should only be executed on the local machine, and not synced to replicas. */
99
+ onlyLocal?: boolean;
100
+ /** This command is from collaboration peers. */
101
101
  fromCollab?: boolean;
102
102
  [key: PropertyKey]: string | number | boolean | undefined;
103
103
  }
@@ -21,7 +21,7 @@ import { Workbook } from '../../sheets/workbook';
21
21
  import { Slide } from '../../slides/domain/slide-model';
22
22
  import type { IDocumentData, ISlideData, IWorkbookData } from '../../types/interfaces';
23
23
  import { IContextService } from '../context/context.service';
24
- export declare const enum DocumentType {
24
+ export declare const enum UniverInstanceType {
25
25
  UNKNOWN = 0,
26
26
  DOC = 1,
27
27
  SHEET = 2,
@@ -68,15 +68,15 @@ export interface IUniverInstanceService {
68
68
  getAllUniverSheetsInstance(): Workbook[];
69
69
  getAllUniverDocsInstance(): DocumentDataModel[];
70
70
  getAllUniverSlidesInstance(): Slide[];
71
- getDocumentType(unitID: string): DocumentType;
71
+ getDocumentType(unitId: string): UniverInstanceType;
72
72
  disposeDocument(unitId: string): boolean;
73
73
  }
74
74
  export declare const IUniverInstanceService: import("@wendellhu/redi").IdentifierDecorator<IUniverInstanceService>;
75
75
  export declare class UniverInstanceService extends Disposable implements IUniverInstanceService {
76
76
  private readonly _handler;
77
77
  private readonly _contextService;
78
- private readonly _focused$;
79
78
  private _focused;
79
+ private readonly _focused$;
80
80
  readonly focused$: Observable<Nullable<string>>;
81
81
  private readonly _currentSheet$;
82
82
  readonly currentSheet$: Observable<Nullable<Workbook>>;
@@ -122,6 +122,6 @@ export declare class UniverInstanceService extends Disposable implements IUniver
122
122
  getCurrentUniverSlideInstance(): Slide;
123
123
  focusUniverInstance(id: string | null): void;
124
124
  getFocusedUniverInstance(): Workbook | DocumentDataModel | Slide | null;
125
- getDocumentType(unitID: string): DocumentType;
125
+ getDocumentType(unitId: string): UniverInstanceType;
126
126
  disposeDocument(unitId: string): boolean;
127
127
  }
@@ -20,17 +20,19 @@ export declare enum LogLevel {
20
20
  WARN = 2,
21
21
  VERBOSE = 3
22
22
  }
23
+ type ArgsType = any[];
23
24
  export interface ILogService {
24
- log(...args: any[]): void;
25
- warn(...args: any[]): void;
26
- error(...args: any[]): void;
25
+ log(...args: ArgsType): void;
26
+ warn(...args: ArgsType): void;
27
+ error(...args: ArgsType): void;
27
28
  setLogLevel(enabled: LogLevel): void;
28
29
  }
29
30
  export declare const ILogService: import("@wendellhu/redi").IdentifierDecorator<ILogService>;
30
31
  export declare class DesktopLogService extends Disposable implements ILogService {
31
32
  private _logLevel;
32
- log(...args: any[]): void;
33
- warn(...args: any[]): void;
34
- error(...args: any[]): void;
33
+ log(...args: ArgsType): void;
34
+ warn(...args: ArgsType): void;
35
+ error(...args: ArgsType): void;
35
36
  setLogLevel(logLevel: LogLevel): void;
36
37
  }
38
+ export {};
@@ -0,0 +1,64 @@
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
+ interface IRgbColor {
17
+ b: number;
18
+ g: number;
19
+ r: number;
20
+ a?: number;
21
+ }
22
+ interface IHslColor {
23
+ h: number;
24
+ l: number;
25
+ s: number;
26
+ a?: number;
27
+ }
28
+ interface IHsvColor {
29
+ h: number;
30
+ s: number;
31
+ v: number;
32
+ a?: number;
33
+ }
34
+ type Color = IRgbColor | IHslColor | IHsvColor;
35
+ export declare const RGB_PAREN = "rgb(";
36
+ export declare const RGBA_PAREN = "rgba(";
37
+ export declare const COLORS: {
38
+ [key: string]: number[];
39
+ };
40
+ export declare class ColorKit {
41
+ private _color;
42
+ private _rgbColor;
43
+ private _isValid;
44
+ static mix(color1: string | Color | ColorKit, color2: string | Color | ColorKit, amount: number): ColorKit;
45
+ static getContrastRatio(foreground: string | Color | ColorKit, background: string | Color | ColorKit): number;
46
+ constructor(color: string | Color | ColorKit | undefined);
47
+ get isValid(): boolean;
48
+ toRgb(): IRgbColor;
49
+ toRgbString(): string;
50
+ toString(): string;
51
+ toHexString(allowShort?: boolean): string;
52
+ toHsv(): IHsvColor;
53
+ toHsl(): IHslColor;
54
+ lighten(amount?: number): ColorKit;
55
+ darken(amount?: number): ColorKit;
56
+ setAlpha(value: number): ColorKit;
57
+ getLuminance(): number;
58
+ getBrightness(): number;
59
+ getAlpha(): number;
60
+ isDark(): boolean;
61
+ isLight(): boolean;
62
+ private _setNullColor;
63
+ }
64
+ export {};
@@ -14,9 +14,23 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { Nullable } from '../../common/type-utils';
17
- import type { ThemeColors, ThemeColorType } from '../../types/enum';
18
- import { ColorType } from '../../types/enum';
19
- import { ColorBuilder } from './color-builder';
17
+ import { ColorType, ThemeColors, ThemeColorType } from '../../types/enum';
18
+ export declare class ColorBuilder {
19
+ private _themeValue;
20
+ private _themeColors;
21
+ private _themeTint;
22
+ private _rgbValue;
23
+ private _colorType;
24
+ constructor();
25
+ asRgbColor(): RgbColor;
26
+ asThemeColor(): ThemeColor;
27
+ build(): Nullable<Color>;
28
+ setRgbColor(cssString: string): ColorBuilder;
29
+ setThemeColors(value: ThemeColors): void;
30
+ setThemeTint(value: number): void;
31
+ setThemeColor(theme: ThemeColorType): ColorBuilder;
32
+ getColorType(): ColorType;
33
+ }
20
34
  export declare class Color {
21
35
  protected _builder: ColorBuilder;
22
36
  constructor(builder: ColorBuilder);
@@ -25,9 +25,6 @@ export declare function isEmptyCell(cell: Nullable<ICellData>): boolean;
25
25
  export declare function getColorStyle(color: Nullable<IColorStyle>): Nullable<string>;
26
26
  export declare function isFormulaString(value: any): boolean;
27
27
  export declare function isFormulaId(value: any): boolean;
28
- /**
29
- * move to Styles.getStyleByCell
30
- */
31
28
  /**
32
29
  * Convert rich text json to DOM
33
30
  * @param p
@@ -41,3 +38,4 @@ export declare function handleJsonToDom(p: IDocumentData): string;
41
38
  export declare function handleStyleToString(style: IStyleData, isCell?: boolean): string;
42
39
  export declare function getBorderStyleType(type: string): number;
43
40
  export declare function getDocsUpdateBody(model: IDocumentData, segmentId?: string): import("../types/interfaces").IDocumentBody | undefined;
41
+ export declare function isValidRange(range: IRange): boolean;
@@ -16,18 +16,16 @@
16
16
  export * from './array-search';
17
17
  export * from './blob';
18
18
  export * from './color/color';
19
- export * from './color/color-builder';
19
+ export { ColorKit, COLORS, RGB_PAREN, RGBA_PAREN } from './color/color-kit';
20
20
  export * from './command-enum';
21
21
  export * from './common';
22
22
  export * from './compare';
23
23
  export * from './doc-tool';
24
- export * from './gen-name';
25
24
  export * from './generate';
26
25
  export * from './hash-algorithm';
27
26
  export * from './lifecycle';
28
27
  export * from './locale';
29
28
  export * from './lru/index';
30
- export * from './object-array';
31
29
  export * from './object-matrix';
32
30
  export * from './permission';
33
31
  export * from './rectangle';
@@ -14,10 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export interface ILanguagePack {
17
- [key: string]: string | Array<{
18
- name: string;
19
- value: string;
20
- }> | ILanguagePack;
17
+ [key: string]: string | ILanguagePack | ILanguagePack[];
21
18
  }
22
19
  export interface ILocales {
23
20
  [key: string]: ILanguagePack;
@@ -14,38 +14,42 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { IRange } from '../types/interfaces/i-range';
17
- import type { PredicateFunction } from './object-array';
18
- import { ObjectArray } from './object-array';
19
17
  import type { Nullable } from './types';
20
18
  /**
21
19
  * Object Matrix Primitive Type
22
20
  */
23
- export interface ObjectMatrixPrimitiveType<T> {
24
- [key: number]: {
25
- [key: number]: T;
26
- };
21
+ export interface IObjectMatrixPrimitiveType<T> {
22
+ [key: number]: IObjectArrayPrimitiveType<T>;
27
23
  }
24
+ export interface IObjectArrayPrimitiveType<T> {
25
+ [key: number]: T;
26
+ }
27
+ export declare function getArrayLength<T>(o: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): number;
28
+ export declare function insertMatrixArray<T>(index: number, value: T, o: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): void;
29
+ export declare function spliceArray<T>(start: number, count: number, o: IObjectArrayPrimitiveType<T>): void;
30
+ export declare function concatMatrixArray<T>(source: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>, target: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>;
31
+ export declare function sliceMatrixArray<T>(start: number, end: number, matrixArray: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>;
32
+ export declare function moveMatrixArray<T>(fromIndex: number, count: number, toIndex: number, o: IObjectArrayPrimitiveType<T> | IObjectMatrixPrimitiveType<T>): void;
28
33
  /**
29
34
  * A two-dimensional array represented by a two-level deep object and provides an array-like API
30
35
  *
31
36
  * @beta
32
37
  */
33
38
  export declare class ObjectMatrix<T> {
34
- private _option;
35
39
  private _matrix;
36
- constructor(matrix?: ObjectMatrixPrimitiveType<T>);
40
+ constructor(matrix?: IObjectMatrixPrimitiveType<T>);
37
41
  static MakeObjectMatrixSize<T>(size: number): ObjectMatrix<T>;
38
- getMatrix(): ObjectMatrixPrimitiveType<T>;
39
- forEach(callback: PredicateFunction<ObjectArray<T>>): ObjectMatrix<T>;
40
- forRow(callback: (row: number, cols: number[]) => Nullable<boolean>): void;
42
+ getMatrix(): IObjectMatrixPrimitiveType<T>;
43
+ forEach(callback: (row: number, objectArray: IObjectArrayPrimitiveType<T>) => Nullable<boolean>): ObjectMatrix<T>;
44
+ forRow(callback: (row: number, cols: number[]) => Nullable<boolean>): ObjectMatrix<T>;
41
45
  forValue(callback: (row: number, col: number, value: T) => Nullable<boolean>): ObjectMatrix<T>;
42
46
  swapRow(src: number, target: number): void;
43
- getRow(rowIndex: number): Nullable<ObjectArray<T>>;
44
- getRowOrCreate(rowIndex: number): ObjectArray<T>;
47
+ getRow(rowIndex: number): Nullable<IObjectArrayPrimitiveType<T>>;
48
+ getRowOrCreate(rowIndex: number): IObjectArrayPrimitiveType<T>;
45
49
  reset(): void;
46
50
  hasValue(): boolean;
47
- getValue(row: number, column: number): Nullable<T>;
48
- setValue(row: number, column: number, value: Nullable<T>): void;
51
+ getValue(row: number, column: number): T;
52
+ setValue(row: number, column: number, value: T): void;
49
53
  /**
50
54
  * !!
51
55
  * Please +1 ‘!’, who fell into this pit.
@@ -53,18 +57,9 @@ export declare class ObjectMatrix<T> {
53
57
  */
54
58
  deleteValue(row: number, column: number): void;
55
59
  realDeleteValue(row: number, column: number): void;
56
- spliceRows(start: number, count: number): ObjectMatrix<T>;
57
- sliceRows(start: number, count: number): ObjectMatrix<T>;
58
- pushRow(row: ObjectArray<T>): void;
60
+ setRow(rowNumber: number, row: IObjectArrayPrimitiveType<T>): void;
59
61
  moveRows(start: number, count: number, target: number): void;
60
62
  moveColumns(start: number, count: number, target: number): void;
61
- insertRow(rowIndex: number, row: ObjectArray<T>): void;
62
- insertRowCount(rowIndex: number, rowCount: number): void;
63
- insertRows(rowIndex: number, matrix: ObjectMatrix<T>): void;
64
- spliceColumns(start: number, count: number): ObjectMatrix<T>;
65
- sliceColumns(start: number, count: number): ObjectMatrix<T>;
66
- insertColumns(columnIndex: number, columnData: ObjectMatrix<T>): void;
67
- insertColumnCount(columnIndex: number, columnCount: number): void;
68
63
  /**
69
64
  * Return a fragment of the original data matrix. Note that the returned matrix's row matrix would start from
70
65
  * 0 not `startRow`. Neither does its column matrix. If you want to get the original matrix, use `getSlice`.
@@ -93,9 +88,16 @@ export declare class ObjectMatrix<T> {
93
88
  getRange(): IRange;
94
89
  toNativeArray(): T[];
95
90
  toArray(): T[][];
96
- toJSON(): ObjectMatrixPrimitiveType<T>;
97
- getData(): ObjectMatrixPrimitiveType<T>;
98
- getArrayData(): ObjectMatrixPrimitiveType<T>;
91
+ /**
92
+ * @deprecated Use getMatrix as a substitute.
93
+ */
94
+ toJSON(): IObjectMatrixPrimitiveType<T>;
95
+ clone(): IObjectMatrixPrimitiveType<T>;
96
+ /**
97
+ * @deprecated Use clone as a substitute.
98
+ */
99
+ getData(): IObjectMatrixPrimitiveType<T>;
100
+ getArrayData(): IObjectMatrixPrimitiveType<T>;
99
101
  getDataRange(): IRange;
100
102
  getDiscreteRanges(): IRange[];
101
103
  merge(newObject: ObjectMatrix<T>): void;
@@ -31,4 +31,5 @@ export declare class Rectangle {
31
31
  static moveHorizontal: (range: IRange, step?: number, length?: number) => IRange;
32
32
  static moveVertical: (range: IRange, step?: number, length?: number) => IRange;
33
33
  static moveOffset: (range: IRange, offsetX: number, offsetY: number) => IRange;
34
+ static subtract(range1: IRange, range2: IRange): IRange[];
34
35
  }