@univerjs/core 0.6.10 → 0.7.0-beta.1

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.
@@ -36,6 +36,7 @@ declare class DocumentDataModelSimple extends UnitModel<IDocumentData, UniverIns
36
36
  getBulletPresetList(): Record<string, IListData>;
37
37
  updateDocumentId(unitId: string): void;
38
38
  updateDocumentRenderConfig(config: IDocumentRenderConfig): void;
39
+ getDocumentStyle(): IDocumentStyle;
39
40
  updateDocumentStyle(config: IDocumentStyle): void;
40
41
  updateDocumentDataMargin(data: IPaddingData): void;
41
42
  updateDocumentDataPageSize(width?: number, height?: number): void;
@@ -196,6 +196,7 @@ export declare class FUniver extends Disposable {
196
196
  * ```ts
197
197
  * const color = univerAPI.newColor();
198
198
  * ```
199
+ * @deprecated
199
200
  */
200
201
  newColor(): ColorBuilder;
201
202
  /**
@@ -79,7 +79,7 @@ export { IResourceLoaderService } from './services/resource-loader/type';
79
79
  export { ResourceManagerService } from './services/resource-manager/resource-manager.service';
80
80
  export type { IResourceHook, IResources } from './services/resource-manager/type';
81
81
  export { IResourceManagerService } from './services/resource-manager/type';
82
- export { type IStyleSheet, ThemeService } from './services/theme/theme.service';
82
+ export { ThemeService } from './services/theme/theme.service';
83
83
  export { type IUndoRedoCommandInfos, type IUndoRedoCommandInfosByInterceptor, type IUndoRedoItem, IUndoRedoService, type IUndoRedoStatus, LocalUndoRedoService, RedoCommand, RedoCommandId, UndoCommand, UndoCommandId, } from './services/undoredo/undoredo.service';
84
84
  export { createDefaultUser } from './services/user-manager/const';
85
85
  export { type IUser, UserManagerService } from './services/user-manager/user-manager.service';
@@ -1,13 +1,17 @@
1
1
  import { Observable } from 'rxjs';
2
+ import { defaultTheme } from '@univerjs/themes';
2
3
  import { Disposable } from '../../shared/lifecycle';
3
- export interface IStyleSheet {
4
- [key: string]: string;
5
- }
4
+ export type Theme = typeof defaultTheme;
6
5
  export declare class ThemeService extends Disposable {
6
+ private readonly _darkMode$;
7
+ readonly darkMode$: Observable<boolean>;
8
+ get darkMode(): boolean;
7
9
  private _currentTheme;
8
10
  private readonly _currentTheme$;
9
- readonly currentTheme$: Observable<IStyleSheet>;
11
+ readonly currentTheme$: Observable<Theme>;
10
12
  constructor();
11
- getCurrentTheme(): IStyleSheet;
12
- setTheme(theme: IStyleSheet): void;
13
+ getCurrentTheme(): Theme;
14
+ setTheme(theme: Theme): void;
15
+ setDarkMode(darkMode: boolean): void;
16
+ getColorFromTheme(color: string): string;
13
17
  }
@@ -1,5 +1,8 @@
1
- import { ColorType, ThemeColors, ThemeColorType } from '../../types/enum';
2
1
  import { Nullable } from '../types';
2
+ import { ColorType, ThemeColors, ThemeColorType } from '../../types/enum';
3
+ /**
4
+ * @deprecated
5
+ */
3
6
  export declare class ColorBuilder {
4
7
  private _themeValue;
5
8
  private _themeColors;
@@ -16,6 +19,9 @@ export declare class ColorBuilder {
16
19
  setThemeColor(theme: ThemeColorType): ColorBuilder;
17
20
  getColorType(): ColorType;
18
21
  }
22
+ /**
23
+ * @deprecated
24
+ */
19
25
  export declare class Color {
20
26
  protected _builder: ColorBuilder;
21
27
  constructor(builder: ColorBuilder);
@@ -205,10 +205,6 @@ export interface INumfmt {
205
205
  (value: string, opt?: Options): Formatter;
206
206
  format(pattern: string, value: ParseValue, opt?: Partial<Options>): string;
207
207
  round(value: number, places?: number): number;
208
- /**
209
- * @internal
210
- */
211
- parseLocale(tag: LocaleTag): void;
212
208
  getLocale(tag: LocaleTag): LocaleData | null;
213
209
  addLocale(data: Partial<LocaleData>, tag: LocaleTag): void;
214
210
  isDate(format: string): boolean;
@@ -1,42 +1,21 @@
1
- import { IDisposable } from '../common/di';
2
- import { IInterceptor, InterceptorEffectEnum } from '../common/interceptor';
3
- import { Nullable } from '../shared/types';
4
- import { ICellData, ICellDataForSheetInterceptor } from './typedef';
5
- import { Disposable } from '../shared/lifecycle';
6
1
  /**
7
- * A cell content interceptor is used to intercept the cell content. It can change or completely replace the cell content.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
8
3
  *
9
- * @internal
10
- */
11
- export interface ICellContentInterceptor {
12
- getCell: (row: number, col: number, effect: InterceptorEffectEnum, key?: string, filter?: (interceptor: IInterceptor<any, any>) => boolean) => Nullable<ICellDataForSheetInterceptor>;
13
- }
14
- /**
15
- * @internal
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.
16
15
  */
17
- export interface IRowFilteredInterceptor {
18
- getRowFiltered(row: number): boolean;
19
- }
20
16
  export interface IRowFilteredInterceptor {
21
17
  }
22
18
  export interface IRowVisibleInterceptor {
23
19
  }
24
20
  export interface IColVisibleInterceptor {
25
21
  }
26
- /**
27
- * @internal
28
- */
29
- export declare class SheetViewModel extends Disposable {
30
- private readonly getRawCell;
31
- private _cellContentInterceptor;
32
- private _rowFilteredInterceptor;
33
- constructor(getRawCell: (row: number, col: number) => Nullable<ICellData>);
34
- dispose(): void;
35
- getCell(row: number, col: number): Nullable<ICellDataForSheetInterceptor>;
36
- getCell(row: number, col: number, key: string, filter: (interceptor: IInterceptor<any, any>) => boolean): Nullable<ICellDataForSheetInterceptor>;
37
- getCellValueOnly(row: number, col: number): Nullable<ICellDataForSheetInterceptor>;
38
- getCellStyleOnly(row: number, col: number): Nullable<ICellDataForSheetInterceptor>;
39
- getRowFiltered(row: number): boolean;
40
- registerCellContentInterceptor(interceptor: ICellContentInterceptor): IDisposable;
41
- registerRowFilteredInterceptor(interceptor: IRowFilteredInterceptor): IDisposable;
42
- }
@@ -48,11 +48,6 @@ export declare class Worksheet {
48
48
  protected readonly _viewModel: SheetViewModel;
49
49
  protected _spanModel: SpanModel;
50
50
  constructor(unitId: string, snapshot: Partial<IWorksheetData>, _styles: Styles);
51
- /**
52
- * @internal
53
- * @param callback
54
- */
55
- __interceptViewModel(callback: (viewModel: SheetViewModel) => void): void;
56
51
  getSnapshot(): IWorksheetData;
57
52
  /**
58
53
  * Set the merge data of the sheet, all the merged cells will be rebuilt.
@@ -151,3 +151,4 @@ export declare const SHEET_EDITOR_UNITS: string[];
151
151
  export declare const NAMED_STYLE_MAP: Record<NamedStyleType, Nullable<ITextStyle>>;
152
152
  export declare const NAMED_STYLE_SPACE_MAP: Record<NamedStyleType, Nullable<IParagraphStyle>>;
153
153
  export declare const PRINT_CHART_COMPONENT_KEY = "univer-sheets-chart-print-chart";
154
+ export declare const DOC_DRAWING_PRINTING_COMPONENT_KEY = "univer-docs-drawing-printing";
@@ -15,4 +15,5 @@
15
15
  */
16
16
  export * from './const';
17
17
  export * from './extension-names';
18
+ export * from './page-size';
18
19
  export * from './theme-color-map';
@@ -0,0 +1,3 @@
1
+ import { ISize } from '../../shared';
2
+ import { PaperType } from '../interfaces';
3
+ export declare const PAGE_SIZE: Record<PaperType, Required<ISize>>;
@@ -15,6 +15,8 @@
15
15
  */
16
16
  /**
17
17
  * Theme color type enum
18
+ *
19
+ * @deprecated
18
20
  */
19
21
  export declare enum ThemeColorType {
20
22
  /**
@@ -39,6 +41,9 @@ export declare enum ThemeColorType {
39
41
  HYPERLINK = 10,
40
42
  FOLLOWED_HYPERLINK = 11
41
43
  }
44
+ /**
45
+ * @deprecated
46
+ */
42
47
  export declare enum ThemeColors {
43
48
  OFFICE = "Office",
44
49
  OFFICE_2007_2010 = "Office 2007-2010",
@@ -841,3 +841,17 @@ export declare enum PageOrientType {
841
841
  PORTRAIT = 0,
842
842
  LANDSCAPE = 1
843
843
  }
844
+ export declare enum PaperType {
845
+ Letter = "Letter",
846
+ Tabloid = "Tabloid",
847
+ Legal = "Legal",
848
+ Statement = "Statement",
849
+ Executive = "Executive",
850
+ Folio = "Folio",
851
+ A3 = "A3",
852
+ A4 = "A4",
853
+ A5 = "A5",
854
+ B4 = "B4",
855
+ B5 = "B5"
856
+ }
857
+ export declare const PAPER_TYPES: PaperType[];
@@ -1,9 +1,9 @@
1
+ import { Theme } from '@univerjs/themes';
1
2
  import { IDisposable, Injector } from './common/di';
2
3
  import { UnitModel, UnitType } from './common/unit';
3
4
  import { LogLevel } from './services/log/log.service';
4
5
  import { DependencyOverride } from './services/plugin/plugin-override';
5
6
  import { Plugin, PluginCtor } from './services/plugin/plugin.service';
6
- import { IStyleSheet } from './services/theme/theme.service';
7
7
  import { ILocales } from './shared';
8
8
  import { IWorkbookData } from './sheets/typedef';
9
9
  import { LocaleType } from './types/enum/locale-type';
@@ -12,10 +12,25 @@ import { DocumentDataModel } from './docs/data-model/document-data-model';
12
12
  import { Workbook } from './sheets/workbook';
13
13
  import { SlideDataModel } from './slides/slide-model';
14
14
  export interface IUniverConfig {
15
- theme: IStyleSheet;
16
- locale: LocaleType;
17
- locales: ILocales;
18
- logLevel: LogLevel;
15
+ /**
16
+ * The theme of the Univer instance, default using the default theme.
17
+ */
18
+ theme?: Theme;
19
+ /**
20
+ * The locale of the Univer instance.
21
+ */
22
+ locale?: LocaleType;
23
+ /**
24
+ * The locales to be used
25
+ */
26
+ locales?: ILocales;
27
+ /**
28
+ * The log level of the Univer instance.
29
+ */
30
+ logLevel?: LogLevel;
31
+ /**
32
+ * The override dependencies of the Univer instance.
33
+ */
19
34
  override?: DependencyOverride;
20
35
  }
21
36
  /**
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- (function(c,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("@univerjs/core"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","rxjs"],n):(c=typeof globalThis<"u"?globalThis:c||self,n(c.UniverCoreFacade={},c.UniverCore,c.rxjs))})(this,function(c,n,p){"use strict";var A=Object.defineProperty;var q=(c,n,p)=>n in c?A(c,n,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[n]=p;var h=(c,n,p)=>q(c,typeof n!="symbol"?n+"":n,p);class v extends n.Disposable{static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}}const C=Symbol("initializers");class j extends n.Disposable{constructor(t){super(),this._injector=t;const e=this,i=Object.getPrototypeOf(this)[C];i&&i.forEach(function(r){r.apply(e,[t])})}_initialize(t){}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{if(e==="_initialize"){let i=this.prototype[C];i||(i=[],this.prototype[C]=i),i.push(t.prototype._initialize)}else e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}}var P=Object.getOwnPropertyDescriptor,U=(a,t,e,i)=>{for(var r=i>1?void 0:i?P(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},B=(a,t)=>(e,i)=>t(e,i,a);c.FBlob=class extends v{constructor(t,e){super(),this._blob=t,this._injector=e}copyBlob(){return this._injector.createInstance(c.FBlob,this._blob)}getAs(t){const e=this.copyBlob();return e.setContentType(t),e}getDataAsString(t){return this._blob===null?Promise.resolve(""):t===void 0?this._blob.text():new Promise((e,i)=>{this._blob.arrayBuffer().then(r=>{const s=new TextDecoder(t).decode(r);e(s)}).catch(r=>{i(new Error(`Failed to read Blob as ArrayBuffer: ${r.message}`))})})}getBytes(){return this._blob?this._blob.arrayBuffer().then(t=>new Uint8Array(t)):Promise.reject(new Error("Blob is undefined or null."))}setBytes(t){return this._blob=new Blob([t]),this}setDataFromString(t,e){const i=e!=null?e:"text/plain",r=new Blob([t],{type:i});return this._blob=r,this}getContentType(){var t;return(t=this._blob)==null?void 0:t.type}setContentType(t){var e;return this._blob=(e=this._blob)==null?void 0:e.slice(0,this._blob.size,t),this}},c.FBlob=U([B(1,n.Inject(n.Injector))],c.FBlob);const y=class y{static get(){if(this._instance)return this._instance;const t=new y;return this._instance=t,t}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}constructor(){for(const t in y.prototype)this[t]=y.prototype[t]}get AbsoluteRefType(){return n.AbsoluteRefType}get UniverInstanceType(){return n.UniverInstanceType}get LifecycleStages(){return n.LifecycleStages}get DataValidationType(){return n.DataValidationType}get DataValidationErrorStyle(){return n.DataValidationErrorStyle}get DataValidationRenderMode(){return n.DataValidationRenderMode}get DataValidationOperator(){return n.DataValidationOperator}get DataValidationStatus(){return n.DataValidationStatus}get CommandType(){return n.CommandType}get BaselineOffset(){return n.BaselineOffset}get BooleanNumber(){return n.BooleanNumber}get HorizontalAlign(){return n.HorizontalAlign}get TextDecoration(){return n.TextDecoration}get TextDirection(){return n.TextDirection}get VerticalAlign(){return n.VerticalAlign}get WrapStrategy(){return n.WrapStrategy}get BorderType(){return n.BorderType}get BorderStyleTypes(){return n.BorderStyleTypes}get AutoFillSeries(){return n.AutoFillSeries}get ColorType(){return n.ColorType}get CommonHideTypes(){return n.CommonHideTypes}get CopyPasteType(){return n.CopyPasteType}get DeleteDirection(){return n.DeleteDirection}get DeveloperMetadataVisibility(){return n.DeveloperMetadataVisibility}get Dimension(){return n.Dimension}get Direction(){return n.Direction}get InterpolationPointType(){return n.InterpolationPointType}get LocaleType(){return n.LocaleType}get MentionType(){return n.MentionType}get ProtectionType(){return n.ProtectionType}get RelativeDate(){return n.RelativeDate}get SheetTypes(){return n.SheetTypes}get ThemeColorType(){return n.ThemeColorType}};h(y,"_instance");let f=y;const g=class g{static get(){if(this._instance)return this._instance;const t=new g;return this._instance=t,t}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}constructor(){for(const t in g.prototype)this[t]=g.prototype[t]}get DocCreated(){return"DocCreated"}get DocDisposed(){return"DocDisposed"}get LifeCycleChanged(){return"LifeCycleChanged"}get Redo(){return"Redo"}get Undo(){return"Undo"}get BeforeRedo(){return"BeforeRedo"}get BeforeUndo(){return"BeforeUndo"}get CommandExecuted(){return"CommandExecuted"}get BeforeCommandExecute(){return"BeforeCommandExecute"}};h(g,"_instance");let m=g;var I=Object.getOwnPropertyDescriptor,x=(a,t,e,i)=>{for(var r=i>1?void 0:i?I(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},w=(a,t)=>(e,i)=>t(e,i,a);c.FHooks=class extends v{constructor(t,e){super(),this._injector=t,this._lifecycleService=e}onStarting(t){return n.toDisposable(this._lifecycleService.lifecycle$.pipe(p.filter(e=>e===n.LifecycleStages.Starting)).subscribe(t))}onReady(t){return n.toDisposable(this._lifecycleService.lifecycle$.pipe(p.filter(e=>e===n.LifecycleStages.Ready)).subscribe(t))}onRendered(t){return n.toDisposable(this._lifecycleService.lifecycle$.pipe(p.filter(e=>e===n.LifecycleStages.Rendered)).subscribe(t))}onSteady(t){return n.toDisposable(this._lifecycleService.lifecycle$.pipe(p.filter(e=>e===n.LifecycleStages.Steady)).subscribe(t))}onBeforeUndo(t){return this._injector.get(n.ICommandService).beforeCommandExecuted(i=>{if(i.id===n.UndoCommand.id){const s=this._injector.get(n.IUndoRedoService).pitchTopUndoElement();s&&t(s)}})}onUndo(t){return this._injector.get(n.ICommandService).onCommandExecuted(i=>{if(i.id===n.UndoCommand.id){const s=this._injector.get(n.IUndoRedoService).pitchTopUndoElement();s&&t(s)}})}onBeforeRedo(t){return this._injector.get(n.ICommandService).beforeCommandExecuted(i=>{if(i.id===n.RedoCommand.id){const s=this._injector.get(n.IUndoRedoService).pitchTopRedoElement();s&&t(s)}})}onRedo(t){return this._injector.get(n.ICommandService).onCommandExecuted(i=>{if(i.id===n.RedoCommand.id){const s=this._injector.get(n.IUndoRedoService).pitchTopRedoElement();s&&t(s)}})}},c.FHooks=x([w(0,n.Inject(n.Injector)),w(1,n.Inject(n.LifecycleService))],c.FHooks);var H=Object.getOwnPropertyDescriptor,F=(a,t,e,i)=>{for(var r=i>1?void 0:i?H(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},V=(a,t)=>(e,i)=>t(e,i,a);let D=class extends j{constructor(a,t){super(t),this.doc=a}};D=F([V(1,n.Inject(n.Injector))],D);class ${constructor(){h(this,"_eventRegistry",new Map);h(this,"_eventHandlerMap",new Map);h(this,"_eventHandlerRegisted",new Map)}_ensureEventRegistry(t){return this._eventRegistry.has(t)||this._eventRegistry.set(t,new n.Registry),this._eventRegistry.get(t)}registerEventHandler(t,e){const i=this._eventHandlerMap.get(t);return i?i.add(e):this._eventHandlerMap.set(t,new Set([e])),this._ensureEventRegistry(t).getData().length&&this._initEventHandler(t),n.toDisposable(()=>{var r,s,o,d;(r=this._eventHandlerMap.get(t))==null||r.delete(e),(o=(s=this._eventHandlerRegisted.get(t))==null?void 0:s.get(e))==null||o.dispose(),(d=this._eventHandlerRegisted.get(t))==null||d.delete(e)})}removeEvent(t,e){const i=this._ensureEventRegistry(t);if(i.delete(e),i.getData().length===0){const r=this._eventHandlerRegisted.get(t);r==null||r.forEach(s=>s.dispose()),this._eventHandlerRegisted.delete(t)}}_initEventHandler(t){let e=this._eventHandlerRegisted.get(t);const i=this._eventHandlerMap.get(t);i&&(e||(e=new Map,this._eventHandlerRegisted.set(t,e),i==null||i.forEach(r=>{e==null||e.set(r,n.toDisposable(r()))})))}addEvent(t,e){return this._ensureEventRegistry(t).add(e),this._initEventHandler(t),n.toDisposable(()=>this.removeEvent(t,e))}fireEvent(t,e){var i;return(i=this._eventRegistry.get(t))==null||i.getData().forEach(r=>{r(e)}),e.cancel}}var M=Object.getOwnPropertyDescriptor,z=(a,t,e,i)=>{for(var r=i>1?void 0:i?M(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},O=(a,t)=>(e,i)=>t(e,i,a);let T=class extends v{constructor(a,t){super(),this._injector=a,this._userManagerService=t}getCurrentUser(){return this._userManagerService.getCurrentUser()}};T=z([O(0,n.Inject(n.Injector)),O(1,n.Inject(n.UserManagerService))],T);const b=class b{static get(){if(this._instance)return this._instance;const t=new b;return this._instance=t,t}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}get rectangle(){return n.Rectangle}get numfmt(){return n.numfmt}get tools(){return n.Tools}};h(b,"_instance");let _=b;var L=Object.getOwnPropertyDescriptor,N=(a,t,e,i)=>{for(var r=i>1?void 0:i?L(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},E=(a,t)=>(e,i)=>t(e,i,a);const R=Symbol("initializers");c.FUniver=class extends n.Disposable{constructor(e,i,r,s){super();h(this,"_eventRegistry",new $);h(this,"registerEventHandler",(e,i)=>this._eventRegistry.registerEventHandler(e,i));this._injector=e,this._commandService=i,this._univerInstanceService=r,this._lifecycleService=s,this.registerEventHandler(this.Event.LifeCycleChanged,()=>n.toDisposable(this._lifecycleService.lifecycle$.subscribe(d=>{this.fireEvent(this.Event.LifeCycleChanged,{stage:d})}))),this._initUnitEvent(this._injector),this._initBeforeCommandEvent(this._injector),this._initCommandEvent(this._injector),this._injector.onDispose(()=>{this.dispose()});const o=Object.getPrototypeOf(this)[R];if(o){const d=this;o.forEach(function(u){u.apply(d,[e])})}}static newAPI(e){const r=(e instanceof n.Univer?e.__getInjector():e).createInstance(c.FUniver);return new Proxy(r,{get(s,o){if(o in Object.prototype||typeof o=="symbol"||["toString","valueOf","toJSON","constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","inspect","then","catch","finally"].includes(String(o))||o in s)return Reflect.get(s,o);throw new TypeError(`[FUniver]: The method '${String(o)}' does not exist on the FUniver instance. This may occur if you haven't imported the required facade package or if you're calling an incorrect method. Please verify the method name and ensure all necessary modules are imported.`)}})}_initialize(e){}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(i=>{if(i==="_initialize"){let r=this.prototype[R];r||(r=[],this.prototype[R]=r),r.push(e.prototype._initialize)}else i!=="constructor"&&(this.prototype[i]=e.prototype[i])}),Object.getOwnPropertyNames(e).forEach(i=>{i!=="prototype"&&i!=="name"&&i!=="length"&&(this[i]=e[i])})}_initCommandEvent(e){const i=e.get(n.ICommandService);this.registerEventHandler(this.Event.Redo,()=>i.onCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id===n.RedoCommand.id){const l={id:s,type:o,params:d};this.fireEvent(this.Event.Redo,l)}})),this.registerEventHandler(this.Event.Undo,()=>i.onCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id===n.UndoCommand.id){const l={id:s,type:o,params:d};this.fireEvent(this.Event.Undo,l)}})),this.registerEventHandler(this.Event.CommandExecuted,()=>i.onCommandExecuted((r,s)=>{const{id:o,type:d,params:u}=r;if(r.id!==n.RedoCommand.id&&r.id!==n.UndoCommand.id){const S={id:o,type:d,params:u,options:s};this.fireEvent(this.Event.CommandExecuted,S)}}))}_initBeforeCommandEvent(e){const i=e.get(n.ICommandService);this.registerEventHandler(this.Event.BeforeRedo,()=>i.beforeCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id===n.RedoCommand.id){const l={id:s,type:o,params:d};if(this.fireEvent(this.Event.BeforeRedo,l),l.cancel)throw new n.CanceledError}})),this.registerEventHandler(this.Event.BeforeUndo,()=>i.beforeCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id===n.UndoCommand.id){const l={id:s,type:o,params:d};if(this.fireEvent(this.Event.BeforeUndo,l),l.cancel)throw new n.CanceledError}})),this.registerEventHandler(this.Event.BeforeCommandExecute,()=>i.beforeCommandExecuted((r,s)=>{const{id:o,type:d,params:u}=r;if(r.id!==n.RedoCommand.id&&r.id!==n.UndoCommand.id){const S={id:o,type:d,params:u,options:s};if(this.fireEvent(this.Event.BeforeCommandExecute,S),S.cancel)throw new n.CanceledError}}))}_initUnitEvent(e){const i=e.get(n.IUniverInstanceService);this.registerEventHandler(this.Event.DocDisposed,()=>i.unitDisposed$.subscribe(r=>{r.type===n.UniverInstanceType.UNIVER_DOC&&this.fireEvent(this.Event.DocDisposed,{unitId:r.getUnitId(),unitType:r.type,snapshot:r.getSnapshot()})})),this.registerEventHandler(this.Event.DocCreated,()=>i.unitAdded$.subscribe(r=>{if(r.type===n.UniverInstanceType.UNIVER_DOC){const s=r,o=e.createInstance(D,s);this.fireEvent(this.Event.DocCreated,{unitId:r.getUnitId(),type:r.type,doc:o,unit:o})}}))}disposeUnit(e){return this._univerInstanceService.disposeUnit(e)}getCurrentLifecycleStage(){return this._injector.get(n.LifecycleService).stage}undo(){return this._commandService.executeCommand(n.UndoCommand.id)}redo(){return this._commandService.executeCommand(n.RedoCommand.id)}onBeforeCommandExecute(e){return this._commandService.beforeCommandExecuted((i,r)=>{e(i,r)})}onCommandExecuted(e){return this._commandService.onCommandExecuted((i,r)=>{e(i,r)})}executeCommand(e,i,r){return this._commandService.executeCommand(e,i,r)}syncExecuteCommand(e,i,r){return this._commandService.syncExecuteCommand(e,i,r)}getHooks(){return this._injector.createInstance(c.FHooks)}get Enum(){return f.get()}get Event(){return m.get()}get Util(){return _.get()}addEvent(e,i){if(!e||!i)throw new Error("Cannot add empty event");return this._eventRegistry.addEvent(e,i)}fireEvent(e,i){return this._eventRegistry.fireEvent(e,i)}getUserManager(){return this._injector.createInstance(T)}newBlob(){return this._injector.createInstance(c.FBlob)}newColor(){return new n.ColorBuilder}newRichText(e){return n.RichTextBuilder.create(e)}newRichTextValue(e){return n.RichTextValue.create(e)}newParagraphStyle(e){return n.ParagraphStyleBuilder.create(e)}newParagraphStyleValue(e){return n.ParagraphStyleValue.create(e)}newTextStyle(e){return n.TextStyleBuilder.create(e)}newTextStyleValue(e){return n.TextStyleValue.create(e)}newTextDecoration(e){return new n.TextDecorationBuilder(e)}},c.FUniver=N([E(0,n.Inject(n.Injector)),E(1,n.ICommandService),E(2,n.IUniverInstanceService),E(3,n.Inject(n.LifecycleService))],c.FUniver),c.FBase=v,c.FBaseInitialable=j,c.FEnum=f,c.FEventName=m,c.FUtil=_,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
1
+ (function(c,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("@univerjs/core"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","rxjs"],n):(c=typeof globalThis<"u"?globalThis:c||self,n(c.UniverCoreFacade={},c.UniverCore,c.rxjs))})(this,function(c,n,p){"use strict";var A=Object.defineProperty;var q=(c,n,p)=>n in c?A(c,n,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[n]=p;var h=(c,n,p)=>q(c,typeof n!="symbol"?n+"":n,p);class v extends n.Disposable{static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}}const C=Symbol("initializers");class j extends n.Disposable{constructor(t){super(),this._injector=t;const e=this,i=Object.getPrototypeOf(this)[C];i&&i.forEach(function(r){r.apply(e,[t])})}_initialize(t){}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{if(e==="_initialize"){let i=this.prototype[C];i||(i=[],this.prototype[C]=i),i.push(t.prototype._initialize)}else e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}}var U=Object.getOwnPropertyDescriptor,O=(a,t,e,i)=>{for(var r=i>1?void 0:i?U(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},P=(a,t)=>(e,i)=>t(e,i,a);c.FBlob=class extends v{constructor(t,e){super(),this._blob=t,this._injector=e}copyBlob(){return this._injector.createInstance(c.FBlob,this._blob)}getAs(t){const e=this.copyBlob();return e.setContentType(t),e}getDataAsString(t){return this._blob===null?Promise.resolve(""):t===void 0?this._blob.text():new Promise((e,i)=>{this._blob.arrayBuffer().then(r=>{const s=new TextDecoder(t).decode(r);e(s)}).catch(r=>{i(new Error(`Failed to read Blob as ArrayBuffer: ${r.message}`))})})}getBytes(){return this._blob?this._blob.arrayBuffer().then(t=>new Uint8Array(t)):Promise.reject(new Error("Blob is undefined or null."))}setBytes(t){return this._blob=new Blob([t]),this}setDataFromString(t,e){const i=e!=null?e:"text/plain",r=new Blob([t],{type:i});return this._blob=r,this}getContentType(){var t;return(t=this._blob)==null?void 0:t.type}setContentType(t){var e;return this._blob=(e=this._blob)==null?void 0:e.slice(0,this._blob.size,t),this}},c.FBlob=O([P(1,n.Inject(n.Injector))],c.FBlob);const y=class y{static get(){if(this._instance)return this._instance;const t=new y;return this._instance=t,t}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}constructor(){for(const t in y.prototype)this[t]=y.prototype[t]}get AbsoluteRefType(){return n.AbsoluteRefType}get UniverInstanceType(){return n.UniverInstanceType}get LifecycleStages(){return n.LifecycleStages}get DataValidationType(){return n.DataValidationType}get DataValidationErrorStyle(){return n.DataValidationErrorStyle}get DataValidationRenderMode(){return n.DataValidationRenderMode}get DataValidationOperator(){return n.DataValidationOperator}get DataValidationStatus(){return n.DataValidationStatus}get CommandType(){return n.CommandType}get BaselineOffset(){return n.BaselineOffset}get BooleanNumber(){return n.BooleanNumber}get HorizontalAlign(){return n.HorizontalAlign}get TextDecoration(){return n.TextDecoration}get TextDirection(){return n.TextDirection}get VerticalAlign(){return n.VerticalAlign}get WrapStrategy(){return n.WrapStrategy}get BorderType(){return n.BorderType}get BorderStyleTypes(){return n.BorderStyleTypes}get AutoFillSeries(){return n.AutoFillSeries}get ColorType(){return n.ColorType}get CommonHideTypes(){return n.CommonHideTypes}get CopyPasteType(){return n.CopyPasteType}get DeleteDirection(){return n.DeleteDirection}get DeveloperMetadataVisibility(){return n.DeveloperMetadataVisibility}get Dimension(){return n.Dimension}get Direction(){return n.Direction}get InterpolationPointType(){return n.InterpolationPointType}get LocaleType(){return n.LocaleType}get MentionType(){return n.MentionType}get ProtectionType(){return n.ProtectionType}get RelativeDate(){return n.RelativeDate}get SheetTypes(){return n.SheetTypes}get ThemeColorType(){return n.ThemeColorType}};h(y,"_instance");let f=y;const g=class g{static get(){if(this._instance)return this._instance;const t=new g;return this._instance=t,t}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}constructor(){for(const t in g.prototype)this[t]=g.prototype[t]}get DocCreated(){return"DocCreated"}get DocDisposed(){return"DocDisposed"}get LifeCycleChanged(){return"LifeCycleChanged"}get Redo(){return"Redo"}get Undo(){return"Undo"}get BeforeRedo(){return"BeforeRedo"}get BeforeUndo(){return"BeforeUndo"}get CommandExecuted(){return"CommandExecuted"}get BeforeCommandExecute(){return"BeforeCommandExecute"}};h(g,"_instance");let m=g;var I=Object.getOwnPropertyDescriptor,x=(a,t,e,i)=>{for(var r=i>1?void 0:i?I(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},w=(a,t)=>(e,i)=>t(e,i,a);c.FHooks=class extends v{constructor(t,e){super(),this._injector=t,this._lifecycleService=e}onStarting(t){return n.toDisposable(this._lifecycleService.lifecycle$.pipe(p.filter(e=>e===n.LifecycleStages.Starting)).subscribe(t))}onReady(t){return n.toDisposable(this._lifecycleService.lifecycle$.pipe(p.filter(e=>e===n.LifecycleStages.Ready)).subscribe(t))}onRendered(t){return n.toDisposable(this._lifecycleService.lifecycle$.pipe(p.filter(e=>e===n.LifecycleStages.Rendered)).subscribe(t))}onSteady(t){return n.toDisposable(this._lifecycleService.lifecycle$.pipe(p.filter(e=>e===n.LifecycleStages.Steady)).subscribe(t))}onBeforeUndo(t){return this._injector.get(n.ICommandService).beforeCommandExecuted(i=>{if(i.id===n.UndoCommand.id){const s=this._injector.get(n.IUndoRedoService).pitchTopUndoElement();s&&t(s)}})}onUndo(t){return this._injector.get(n.ICommandService).onCommandExecuted(i=>{if(i.id===n.UndoCommand.id){const s=this._injector.get(n.IUndoRedoService).pitchTopUndoElement();s&&t(s)}})}onBeforeRedo(t){return this._injector.get(n.ICommandService).beforeCommandExecuted(i=>{if(i.id===n.RedoCommand.id){const s=this._injector.get(n.IUndoRedoService).pitchTopRedoElement();s&&t(s)}})}onRedo(t){return this._injector.get(n.ICommandService).onCommandExecuted(i=>{if(i.id===n.RedoCommand.id){const s=this._injector.get(n.IUndoRedoService).pitchTopRedoElement();s&&t(s)}})}},c.FHooks=x([w(0,n.Inject(n.Injector)),w(1,n.Inject(n.LifecycleService))],c.FHooks);var H=Object.getOwnPropertyDescriptor,F=(a,t,e,i)=>{for(var r=i>1?void 0:i?H(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},V=(a,t)=>(e,i)=>t(e,i,a);let D=class extends j{constructor(a,t){super(t),this.doc=a}};D=F([V(1,n.Inject(n.Injector))],D);class M{constructor(){h(this,"_eventRegistry",new Map);h(this,"_eventHandlerMap",new Map);h(this,"_eventHandlerRegisted",new Map)}_ensureEventRegistry(t){return this._eventRegistry.has(t)||this._eventRegistry.set(t,new n.Registry),this._eventRegistry.get(t)}registerEventHandler(t,e){const i=this._eventHandlerMap.get(t);return i?i.add(e):this._eventHandlerMap.set(t,new Set([e])),this._ensureEventRegistry(t).getData().length&&this._initEventHandler(t),n.toDisposable(()=>{var r,s,o,d;(r=this._eventHandlerMap.get(t))==null||r.delete(e),(o=(s=this._eventHandlerRegisted.get(t))==null?void 0:s.get(e))==null||o.dispose(),(d=this._eventHandlerRegisted.get(t))==null||d.delete(e)})}removeEvent(t,e){const i=this._ensureEventRegistry(t);if(i.delete(e),i.getData().length===0){const r=this._eventHandlerRegisted.get(t);r==null||r.forEach(s=>s.dispose()),this._eventHandlerRegisted.delete(t)}}_initEventHandler(t){let e=this._eventHandlerRegisted.get(t);const i=this._eventHandlerMap.get(t);i&&(e||(e=new Map,this._eventHandlerRegisted.set(t,e),i==null||i.forEach(r=>{e==null||e.set(r,n.toDisposable(r()))})))}addEvent(t,e){return this._ensureEventRegistry(t).add(e),this._initEventHandler(t),n.toDisposable(()=>this.removeEvent(t,e))}fireEvent(t,e){var i;return(i=this._eventRegistry.get(t))==null||i.getData().forEach(r=>{r(e)}),e.cancel}}var $=Object.getOwnPropertyDescriptor,z=(a,t,e,i)=>{for(var r=i>1?void 0:i?$(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},B=(a,t)=>(e,i)=>t(e,i,a);let T=class extends v{constructor(a,t){super(),this._injector=a,this._userManagerService=t}getCurrentUser(){return this._userManagerService.getCurrentUser()}};T=z([B(0,n.Inject(n.Injector)),B(1,n.Inject(n.UserManagerService))],T);const b=class b{static get(){if(this._instance)return this._instance;const t=new b;return this._instance=t,t}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}get rectangle(){return n.Rectangle}get numfmt(){return n.numfmt}get tools(){return n.Tools}};h(b,"_instance");let _=b;var L=Object.getOwnPropertyDescriptor,N=(a,t,e,i)=>{for(var r=i>1?void 0:i?L(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},E=(a,t)=>(e,i)=>t(e,i,a);const R=Symbol("initializers");c.FUniver=class extends n.Disposable{constructor(e,i,r,s){super();h(this,"_eventRegistry",new M);h(this,"registerEventHandler",(e,i)=>this._eventRegistry.registerEventHandler(e,i));this._injector=e,this._commandService=i,this._univerInstanceService=r,this._lifecycleService=s,this.registerEventHandler(this.Event.LifeCycleChanged,()=>n.toDisposable(this._lifecycleService.lifecycle$.subscribe(d=>{this.fireEvent(this.Event.LifeCycleChanged,{stage:d})}))),this._initUnitEvent(this._injector),this._initBeforeCommandEvent(this._injector),this._initCommandEvent(this._injector),this._injector.onDispose(()=>{this.dispose()});const o=Object.getPrototypeOf(this)[R];if(o){const d=this;o.forEach(function(u){u.apply(d,[e])})}}static newAPI(e){return(e instanceof n.Univer?e.__getInjector():e).createInstance(c.FUniver)}_initialize(e){}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(i=>{if(i==="_initialize"){let r=this.prototype[R];r||(r=[],this.prototype[R]=r),r.push(e.prototype._initialize)}else i!=="constructor"&&(this.prototype[i]=e.prototype[i])}),Object.getOwnPropertyNames(e).forEach(i=>{i!=="prototype"&&i!=="name"&&i!=="length"&&(this[i]=e[i])})}_initCommandEvent(e){const i=e.get(n.ICommandService);this.registerEventHandler(this.Event.Redo,()=>i.onCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id===n.RedoCommand.id){const l={id:s,type:o,params:d};this.fireEvent(this.Event.Redo,l)}})),this.registerEventHandler(this.Event.Undo,()=>i.onCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id===n.UndoCommand.id){const l={id:s,type:o,params:d};this.fireEvent(this.Event.Undo,l)}})),this.registerEventHandler(this.Event.CommandExecuted,()=>i.onCommandExecuted((r,s)=>{const{id:o,type:d,params:u}=r;if(r.id!==n.RedoCommand.id&&r.id!==n.UndoCommand.id){const S={id:o,type:d,params:u,options:s};this.fireEvent(this.Event.CommandExecuted,S)}}))}_initBeforeCommandEvent(e){const i=e.get(n.ICommandService);this.registerEventHandler(this.Event.BeforeRedo,()=>i.beforeCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id===n.RedoCommand.id){const l={id:s,type:o,params:d};if(this.fireEvent(this.Event.BeforeRedo,l),l.cancel)throw new n.CanceledError}})),this.registerEventHandler(this.Event.BeforeUndo,()=>i.beforeCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id===n.UndoCommand.id){const l={id:s,type:o,params:d};if(this.fireEvent(this.Event.BeforeUndo,l),l.cancel)throw new n.CanceledError}})),this.registerEventHandler(this.Event.BeforeCommandExecute,()=>i.beforeCommandExecuted((r,s)=>{const{id:o,type:d,params:u}=r;if(r.id!==n.RedoCommand.id&&r.id!==n.UndoCommand.id){const S={id:o,type:d,params:u,options:s};if(this.fireEvent(this.Event.BeforeCommandExecute,S),S.cancel)throw new n.CanceledError}}))}_initUnitEvent(e){const i=e.get(n.IUniverInstanceService);this.registerEventHandler(this.Event.DocDisposed,()=>i.unitDisposed$.subscribe(r=>{r.type===n.UniverInstanceType.UNIVER_DOC&&this.fireEvent(this.Event.DocDisposed,{unitId:r.getUnitId(),unitType:r.type,snapshot:r.getSnapshot()})})),this.registerEventHandler(this.Event.DocCreated,()=>i.unitAdded$.subscribe(r=>{if(r.type===n.UniverInstanceType.UNIVER_DOC){const s=r,o=e.createInstance(D,s);this.fireEvent(this.Event.DocCreated,{unitId:r.getUnitId(),type:r.type,doc:o,unit:o})}}))}disposeUnit(e){return this._univerInstanceService.disposeUnit(e)}getCurrentLifecycleStage(){return this._injector.get(n.LifecycleService).stage}undo(){return this._commandService.executeCommand(n.UndoCommand.id)}redo(){return this._commandService.executeCommand(n.RedoCommand.id)}onBeforeCommandExecute(e){return this._commandService.beforeCommandExecuted((i,r)=>{e(i,r)})}onCommandExecuted(e){return this._commandService.onCommandExecuted((i,r)=>{e(i,r)})}executeCommand(e,i,r){return this._commandService.executeCommand(e,i,r)}syncExecuteCommand(e,i,r){return this._commandService.syncExecuteCommand(e,i,r)}getHooks(){return this._injector.createInstance(c.FHooks)}get Enum(){return f.get()}get Event(){return m.get()}get Util(){return _.get()}addEvent(e,i){if(!e||!i)throw new Error("Cannot add empty event");return this._eventRegistry.addEvent(e,i)}fireEvent(e,i){return this._eventRegistry.fireEvent(e,i)}getUserManager(){return this._injector.createInstance(T)}newBlob(){return this._injector.createInstance(c.FBlob)}newColor(){return new n.ColorBuilder}newRichText(e){return n.RichTextBuilder.create(e)}newRichTextValue(e){return n.RichTextValue.create(e)}newParagraphStyle(e){return n.ParagraphStyleBuilder.create(e)}newParagraphStyleValue(e){return n.ParagraphStyleValue.create(e)}newTextStyle(e){return n.TextStyleBuilder.create(e)}newTextStyleValue(e){return n.TextStyleValue.create(e)}newTextDecoration(e){return new n.TextDecorationBuilder(e)}},c.FUniver=N([E(0,n.Inject(n.Injector)),E(1,n.ICommandService),E(2,n.IUniverInstanceService),E(3,n.Inject(n.LifecycleService))],c.FUniver),c.FBase=v,c.FBaseInitialable=j,c.FEnum=f,c.FEventName=m,c.FUtil=_,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});