New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@univerjs/core

Package Overview
Dependencies
Maintainers
0
Versions
272
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@univerjs/core - npm Package Compare versions

Comparing version 0.5.2 to 0.5.3

lib/types/facade/f-enum.d.ts

19

lib/types/common/interceptor.d.ts

@@ -8,2 +8,3 @@ import { Nullable } from '../shared/types';

export interface IInterceptor<M, C> {
id?: string;
priority?: number;

@@ -30,3 +31,10 @@ handler: InterceptorHandler<M, C>;

constructor(interceptorPoints: P);
fetchThroughInterceptors<T, C>(name: IInterceptor<T, C>): (initValue: Nullable<T>, initContext: C) => Nullable<T>;
/**
* Get the interceptors.
* @param name Name of the intercepted point.
* @param filter A callback function to filter the interceptors.
* @returns It will return a composed interceptor function. If you will perform the interceptor repeatedly,
* you should cache the result instead of calling this function multiple times.
*/
fetchThroughInterceptors<T, C>(name: IInterceptor<T, C>, filter?: (interceptor: IInterceptor<any, any>) => boolean): (initValue: Nullable<T>, initContext: C) => Nullable<T>;
intercept<T extends IInterceptor<any, any>>(name: T, interceptor: T): () => boolean;

@@ -52,3 +60,10 @@ getInterceptPoints(): P;

constructor(asyncInterceptorPoints: P);
fetchThroughAsyncInterceptors<T, C>(name: IAsyncInterceptor<T, C>): (initialValue: Nullable<T>, context: C) => Promise<Nullable<T>>;
/**
* Get the interceptors.
* @param name Name of the intercepted point.
* @param filter A callback function to filter the interceptors.
* @returns It will return a composed interceptor function. If you will perform the interceptor repeatedly,
* you should cache the result instead of calling this function multiple times.
*/
fetchThroughAsyncInterceptors<T, C>(name: IAsyncInterceptor<T, C>, filter?: (interceptor: IAsyncInterceptor<any, any>) => boolean): (initialValue: Nullable<T>, context: C) => Promise<Nullable<T>>;
interceptAsync<T extends IAsyncInterceptor<any, any>>(name: T, interceptor: T): Promise<() => boolean>;

@@ -55,0 +70,0 @@ getInterceptPoints(): P;

31

lib/types/facade/f-base.d.ts

@@ -0,17 +1,4 @@

import { Injector } from '@wendellhu/redi';
import { Disposable } from '../shared';
/**
* Copyright 2023-present DreamNum Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* `FBase` is a base class for all facade classes.

@@ -21,7 +8,13 @@ * It provides a way to extend classes with static and instance methods.

*/
export declare abstract class FBase {
private static _constructorQueue;
constructor();
_initialize(): void;
export declare abstract class FBase extends Disposable {
static extend(source: any): void;
}
declare const InitializerSymbol: unique symbol;
export declare class FBaseInitialable extends Disposable {
protected _injector: Injector;
private [InitializerSymbol];
constructor(_injector: Injector);
_initialize(injector: Injector): void;
static extend(source: any): void;
}
export {};
import { IDisposable, Injector } from '../common/di';
import { CommandListener, IExecutionOptions, ICommandService } from '../services/command/command.service';
import { LifecycleStages } from '../services/lifecycle/lifecycle';
import { IEventParamConfig, FEventName } from './f-event';
import { IUniverInstanceService } from '../services/instance/instance.service';
import { LifecycleService } from '../services/lifecycle/lifecycle.service';
import { ColorBuilder } from '../shared';
import { Univer } from '../univer';
import { FBase } from './f-base';
import { FBaseInitialable } from './f-base';
import { FBlob } from './f-blob';
import { FEnum } from './f-enum';
import { FHooks } from './f-hooks';
import { FUserManager } from './f-usermanager';
export declare class FUniver extends FBase {
export declare class FUniver extends FBaseInitialable {
protected readonly _injector: Injector;
protected readonly _commandService: ICommandService;
protected readonly _univerInstanceService: IUniverInstanceService;
protected readonly _lifecycleService: LifecycleService;
/**

@@ -23,3 +28,5 @@ * Create an FUniver instance, if the injector is not provided, it will create a new Univer instance.

static newAPI(wrapped: Univer | Injector): FUniver;
constructor(_injector: Injector, _commandService: ICommandService, _univerInstanceService: IUniverInstanceService);
private _eventRegistry;
private _ensureEventRegistry;
constructor(_injector: Injector, _commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _lifecycleService: LifecycleService);
/**

@@ -52,3 +59,3 @@ * Dispose the UniverSheet by the `unitId`. The UniverSheet would be unload from the application.

* Register a callback that will be triggered before invoking a command.
*
* @deprecated use `addEvent(univerAPI.event.BeforeCommandExecute, () => {})` instead.
* @param {CommandListener} callback The callback.

@@ -60,3 +67,3 @@ * @returns {IDisposable} The disposable instance.

* Register a callback that will be triggered when a command is invoked.
*
* @deprecated use `addEvent(univerAPI.event.CommandExecuted, () => {})` instead.
* @param {CommandListener} callback The callback.

@@ -84,3 +91,3 @@ * @returns {IDisposable} The disposable instance.

* Get hooks.
*
* @deprecated use `addEvent` instead.
* @returns {FHooks} FHooks instance

@@ -99,3 +106,30 @@ */

newBlob(): FBlob;
newColor(): ColorBuilder;
get Enum(): FEnum;
get Event(): FEventName;
/**
* Add an event listener
* @param event key of event
* @param callback callback when event triggered
* @returns {Disposable} The Disposable instance, for remove the listener
* @example
* ```ts
* univerAPI.addEvent(univerAPI.event.UnitCreated, (params) => {
* console.log('unit created', params);
* });
* ```
*/
addEvent(event: keyof IEventParamConfig, callback: (params: IEventParamConfig[typeof event]) => void): IDisposable;
/**
* Fire an event, used in internal only.
* @param event {string} key of event
* @param params {any} parmas of event
* @returns {boolean} should cancel
* @example
* ```ts
* this.fireEvent(univerAPI.event.UnitCreated, params);
* ```
*/
protected fireEvent<T extends keyof IEventParamConfig>(event: T, params: IEventParamConfig[T]): boolean | undefined;
getUserManager(): FUserManager;
}

@@ -11,5 +11,7 @@ import { IUser, UserManagerService } from '../services/user-manager/user-manager.service';

* @example
* `univerAPI.getUserManager().getCurrentUser()`
* ```
* univerAPI.getUserManager().getCurrentUser()
* ```
*/
getCurrentUser(): IUser;
}

@@ -30,6 +30,8 @@ /**

export { mixinClass } from './common/mixin';
export { FBase } from './facade/f-base';
export { FBase, FBaseInitialable } from './facade/f-base';
export { FUniver } from './facade/f-univer';
export { FHooks } from './facade/f-hooks';
export { FBlob, type IFBlobSource } from './facade/f-blob';
export { FEventName, type IEventBase, type IEventParamConfig } from './facade/f-event';
export { FEnum } from './facade/f-enum';
export { isNumeric, isSafeNumeric } from './common/number';

@@ -36,0 +38,0 @@ export { Registry, RegistryAsMap } from './common/registry';

@@ -58,3 +58,3 @@ import { Observable, BehaviorSubject } from 'rxjs';

readonly id: "univer.command.undo";
handler(accessor: IAccessor): Promise<boolean>;
handler(accessor: IAccessor): boolean;
dispose(): void;

@@ -66,3 +66,3 @@ dispatchToHandlers(): Promise<boolean>;

readonly id: "univer.command.redo";
handler(accessor: IAccessor): Promise<boolean>;
handler(accessor: IAccessor): boolean;
dispose(): void;

@@ -69,0 +69,0 @@ dispatchToHandlers(): Promise<boolean>;

@@ -213,2 +213,9 @@ import { IResources } from '../services/resource-manager/type';

}
export interface IFontRenderExtension {
leftOffset?: number;
rightOffset?: number;
topOffset?: number;
downOffset?: number;
isSkip?: boolean;
}
export interface ICellDataForSheetInterceptor extends ICellData {

@@ -227,9 +234,4 @@ interceptorStyle?: Nullable<IStyleData>;

linkId?: string;
fontRenderExtension?: {
leftOffset?: number;
rightOffset?: number;
topOffset?: number;
downOffset?: number;
isSkip?: boolean;
};
fontRenderExtension?: IFontRenderExtension;
themeStyle?: Nullable<IStyleData>;
}

@@ -241,5 +243,17 @@ export declare function isICellData(value: any): value is ICellData;

export interface IFreeze {
/**
* count of fixed cols
*/
xSplit: number;
/**
* count of fixed rows
*/
ySplit: number;
/**
* scrollable start row
*/
startRow: number;
/**
* scrollable start column
*/
startColumn: number;

@@ -246,0 +260,0 @@ }

import { IDisposable } from '../common/di';
import { IInterceptor, InterceptorEffectEnum } from '../common/interceptor';
import { Nullable } from '../shared/types';
import { ICellData, ICellDataForSheetInterceptor } from './typedef';
import { InterceptorEffectEnum } from '../common/interceptor';
import { Disposable } from '../shared/lifecycle';
/**
* A cell content interceptor is used to intercept the cell content. It can change or completely replace the cell content.
*
* @internal
*/
export interface ICellContentInterceptor {
getCell: (row: number, col: number, effect: InterceptorEffectEnum) => Nullable<ICellDataForSheetInterceptor>;
getCell: (row: number, col: number, effect: InterceptorEffectEnum, key?: string, filter?: (interceptor: IInterceptor<any, any>) => boolean) => Nullable<ICellDataForSheetInterceptor>;
}
/**
* @internal
*/
export interface IRowFilteredInterceptor {
getRowFiltered(row: number): boolean;
}
export interface IRowFilteredInterceptor {
}
export interface IRowVisibleInterceptor {

@@ -18,18 +26,5 @@ }

}
export interface ISheetViewModel {
registerCellContentInterceptor: (interceptor: ICellContentInterceptor) => IDisposable;
registerRowFilteredInterceptor: (interceptor: IRowFilteredInterceptor) => IDisposable;
registerRowVisibleInterceptor: (interceptor: IRowVisibleInterceptor) => IDisposable;
registerColVisibleInterceptor: (interceptor: IColVisibleInterceptor) => IDisposable;
getCell: (row: number, col: number) => Nullable<ICellDataForSheetInterceptor>;
}
/**
* @internal
*/
export interface IRowFilteredInterceptor {
getRowFiltered(row: number): boolean;
}
/**
* @internal
*/
export declare class SheetViewModel extends Disposable {

@@ -42,2 +37,3 @@ private readonly getRawCell;

getCell(row: number, col: number): Nullable<ICellDataForSheetInterceptor>;
getCell(row: number, col: number, key: string, filter: (interceptor: IInterceptor<any, any>) => boolean): Nullable<ICellDataForSheetInterceptor>;
getCellValueOnly(row: number, col: number): Nullable<ICellDataForSheetInterceptor>;

@@ -44,0 +40,0 @@ getCellStyleOnly(row: number, col: number): Nullable<ICellDataForSheetInterceptor>;

@@ -0,1 +1,2 @@

import { IInterceptor } from '../common/interceptor';
import { Nullable, ObjectMatrix } from '../shared';

@@ -231,2 +232,3 @@ import { IPaddingData, IStyleData, ITextRotation } from '../types/interfaces';

getCellRaw(row: number, col: number): Nullable<ICellData>;
getCellWithFilteredInterceptors(row: number, col: number, key: string, filter: (interceptor: IInterceptor<any, any>) => boolean): Nullable<ICellDataForSheetInterceptor>;
getRowFiltered(row: number): boolean;

@@ -233,0 +235,0 @@ /**

{
"name": "@univerjs/core",
"version": "0.5.2",
"version": "0.5.3",
"private": false,

@@ -52,4 +52,4 @@ "description": "Core library for Univer.",

"dependencies": {
"@univerjs/protocol": "0.1.39",
"@wendellhu/redi": "0.16.2",
"@univerjs/protocol": "0.1.40",
"@wendellhu/redi": "0.17.0",
"dayjs": "^1.11.13",

@@ -71,19 +71,6 @@ "fast-diff": "1.3.0",

"typescript": "^5.7.2",
"vite": "^6.0.3",
"vite": "^6.0.6",
"vitest": "^2.1.8",
"@univerjs-infra/shared": "0.5.2"
"@univerjs-infra/shared": "0.5.3"
},
"space": {
".": {
"import": "./lib/es/index.js",
"require": "./lib/cjs/index.js",
"types": "./lib/types/index.d.ts"
},
"./*": {
"import": "./lib/es/*",
"require": "./lib/cjs/*",
"types": "./lib/types/index.d.ts"
},
"./lib/*": "./lib/*"
},
"scripts": {

@@ -90,0 +77,0 @@ "test": "vitest run",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc