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
258
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.3 to 0.5.4-experimental.20250114-7c09c35

lib/types/docs/data-model/rich-text-builder.d.ts

3

lib/types/common/error.d.ts

@@ -19,1 +19,4 @@ /**

}
export declare class CanceledError extends Error {
constructor();
}

7

lib/types/docs/data-model/document-data-model.d.ts

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

import { BehaviorSubject } from 'rxjs';
import { UnitModel, UniverInstanceType } from '../../common/unit';
import { SliceBodyType } from './text-x/utils';
import { Nullable } from '../../shared';

@@ -8,2 +5,5 @@ import { IDocumentBody, IDocumentData, IDocumentRenderConfig, IDocumentStyle, IDrawings, IListData } from '../../types/interfaces/i-document-data';

import { JSONXActions } from './json-x/json-x';
import { BehaviorSubject } from 'rxjs';
import { UnitModel, UniverInstanceType } from '../../common/unit';
import { SliceBodyType } from './text-x/utils';
export declare const DEFAULT_DOC: {

@@ -50,2 +50,3 @@ id: string;

footerModelMap: Map<string, DocumentDataModel>;
change$: BehaviorSubject<number>;
constructor(snapshot: Partial<IDocumentData>);

@@ -52,0 +53,0 @@ dispose(): void;

import { addCustomDecorationTextX, deleteCustomDecorationTextX } from './custom-decoration';
import { copyCustomRange, getCustomRangesInterestsWithSelection, isIntersecting } from './custom-range';
import { isSegmentIntersects, makeSelection, normalizeSelection } from './selection';
import { addCustomRangeTextX, deleteCustomRangeTextX, deleteSelectionTextX } from './text-x-utils';
import { addCustomRangeTextX, deleteCustomRangeTextX, deleteSelectionTextX, retainSelectionTextX } from './text-x-utils';
export declare class BuildTextUtils {

@@ -22,2 +22,4 @@ static customRange: {

delete: typeof deleteSelectionTextX;
replaceTextRuns: (params: import('./text-x-utils').IReplaceSelectionTextXParams) => false | import('../text-x').TextX;
retain: typeof retainSelectionTextX;
};

@@ -24,0 +26,0 @@ static range: {

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

import { IAccessor } from '@wendellhu/redi';
import { ITextRange, ITextRangeParam } from '../../../../sheets/typedef';

@@ -14,3 +13,3 @@ import { CustomRangeType, IDocumentBody } from '../../../../types/interfaces';

}
export declare function deleteCustomRangeTextX(accessor: IAccessor, params: IDeleteCustomRangeParam): false | TextXSelection;
export declare function deleteCustomRangeTextX(params: IDeleteCustomRangeParam): false | TextXSelection;
export interface IAddCustomRangeTextXParam {

@@ -29,2 +28,3 @@ ranges: ITextRange[];

export declare function deleteSelectionTextX(selections: ITextRange[], body: IDocumentBody, memoryCursor?: number, insertBody?: Nullable<IDocumentBody>, keepBullet?: boolean): Array<TextXAction>;
export declare function retainSelectionTextX(selections: ITextRange[], body: IDocumentBody, memoryCursor?: number): TextXAction[];
export interface IReplaceSelectionTextXParams {

@@ -43,1 +43,2 @@ /**

export declare const replaceSelectionTextX: (params: IReplaceSelectionTextXParams) => false | TextX;
export declare const replaceSelectionTextRuns: (params: IReplaceSelectionTextXParams) => false | TextX;

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

import { ICustomDecoration, IDocumentBody } from '../../../types/interfaces/i-document-data';
import { ICustomDecoration, IDocumentBody, ITextRun } from '../../../types/interfaces/i-document-data';
import { IRetainAction } from './action-types';

@@ -8,2 +8,49 @@ import { UpdateDocsAttributeType } from '../../../shared/command-enum';

}
export declare function getTextRunSlice(body: IDocumentBody, startOffset: number, endOffset: number, returnEmptyTextRuns?: boolean): ITextRun[] | undefined;
export declare function getTableSlice(body: IDocumentBody, startOffset: number, endOffset: number): {
startIndex: number;
endIndex: number;
tableId: string;
}[];
export declare function getParagraphsSlice(body: IDocumentBody, startOffset: number, endOffset: number): {
startIndex: number;
paragraphStyle?: import('../../..').IParagraphStyle;
bullet?: import('../../..').IBullet;
}[] | undefined;
export declare function getSectionBreakSlice(body: IDocumentBody, startOffset: number, endOffset: number): {
startIndex: number;
pageNumberStart?: number;
pageSize?: import('../../..').ISize;
pageOrient?: import('../../..').PageOrientType;
documentFlavor?: import('../../..').DocumentFlavor;
marginHeader?: number;
marginFooter?: number;
renderConfig?: import('../../..').IDocumentRenderConfig;
marginTop?: number;
marginBottom?: number;
marginRight?: number;
marginLeft?: number;
charSpace?: number;
linePitch?: number;
gridType?: import('../../..').GridType;
columnProperties?: import('../../..').ISectionColumnProperties[];
columnSeparatorType?: import('../../..').ColumnSeparatorType;
contentDirection?: import('../../..').TextDirection;
sectionType?: import('../../..').SectionType;
sectionTypeNext?: import('../../..').SectionType;
textDirection?: import('../../..').TextDirectionType;
defaultHeaderId?: string;
defaultFooterId?: string;
evenPageHeaderId?: string;
evenPageFooterId?: string;
firstPageHeaderId?: string;
firstPageFooterId?: string;
useFirstPageHeaderFooter?: import('../../..').BooleanNumber;
evenAndOddHeaders?: import('../../..').BooleanNumber;
}[] | undefined;
export declare function getCustomBlockSlice(body: IDocumentBody, startOffset: number, endOffset: number): {
startIndex: number;
blockType?: import('../../..').BlockType;
blockId: string;
}[] | undefined;
export declare function getBodySlice(body: IDocumentBody, startOffset: number, endOffset: number, returnEmptyArray?: boolean, type?: SliceBodyType): IDocumentBody;

@@ -10,0 +57,0 @@ export declare function normalizeBody(body: IDocumentBody): IDocumentBody;

@@ -24,3 +24,3 @@ import { Nullable } from '../shared';

* ```ts
* const blob = UniverApi.newBlob(blob);
* const blob = univerAPI.newBlob(blob);
* const newBlob = blob.copyBlob();

@@ -37,3 +37,3 @@ * console.log(newBlob);

* ```ts
* const blob = UniverApi.newBlob(blob);
* const blob = univerAPI.newBlob(blob);
* const newBlob = blob.getBlob();

@@ -44,7 +44,7 @@ * ```

/**
* get the blob as a string
* Get the blob as a string.
* @returns
* @example
* ```ts
* const blob = UniverApi.newBlob(blob);
* const blob = univerAPI.newBlob(blob);
* const newBlob = blob.getDataAsString();

@@ -56,3 +56,3 @@ * console.log(newBlob);

/**
* get the blob as a string
* Get the blob as a string.
* @param charset the charset

@@ -62,3 +62,3 @@ * @returns the blob content as a string

* ```ts
* const blob = UniverApi.newBlob(blob);
* const blob = univerAPI.newBlob(blob);
* const newBlob = blob.getDataAsString('iso-8859-1');

@@ -74,3 +74,3 @@ * console.log(newBlob);

* ```ts
* const blob = UniverApi.newBlob(blob);
* const blob = univerAPI.newBlob(blob);
* const newBlob = blob.getBytes();

@@ -87,3 +87,3 @@ * console.log(newBlob);

* ```ts
* const blob = UniverApi.newBlob();
* const blob = univerAPI.newBlob();
* const bytes = new Uint8Array(10);

@@ -100,3 +100,3 @@ * blob.setBytes(bytes);

* ```ts
* const blob = UniverApi.newBlob();
* const blob = univerAPI.newBlob();
* blob.setDataFromString('Hello, World!');

@@ -113,3 +113,3 @@ * ```

* ```ts
* const blob = UniverApi.newBlob();
* const blob = univerAPI.newBlob();
* blob.setDataFromString('Hello, World!', 'text/plain');

@@ -124,3 +124,3 @@ * ```

* ```ts
* const blob = UniverApi.newBlob(blob);
* const blob = univerAPI.newBlob(blob);
* const newBlob = blob.getContentType();

@@ -137,3 +137,3 @@ * console.log(newBlob);

* ```ts
* const blob = UniverApi.newBlob(blob);
* const blob = univerAPI.newBlob(blob);
* const newBlob = blob.setContentType('text/plain');

@@ -140,0 +140,0 @@ * console.log(newBlob);

import { UniverInstanceType } from '../common/unit';
import { CommandType } from '../services/command/command.service';
import { LifecycleStages } from '../services/lifecycle/lifecycle';
import { BaselineOffset, BooleanNumber, HorizontalAlign, TextDecoration, TextDirection, VerticalAlign } from '../types/enum';
import { DataValidationErrorStyle } from '../types/enum/data-validation-error-style';

@@ -13,9 +15,58 @@ import { DataValidationOperator } from '../types/enum/data-validation-operator';

constructor();
/**
* Defines different types of Univer instances
*/
get UniverInstanceType(): typeof UniverInstanceType;
/**
* Represents different stages in the lifecycle
*/
get LifecycleStages(): typeof LifecycleStages;
/**
* Different types of data validation
*/
get DataValidationType(): typeof DataValidationType;
/**
* Different error display styles
*/
get DataValidationErrorStyle(): typeof DataValidationErrorStyle;
/**
* Different validation rendering modes
*/
get DataValidationRenderMode(): typeof DataValidationRenderMode;
/**
* Different validation operators
*/
get DataValidationOperator(): typeof DataValidationOperator;
/**
* Different validation states
*/
get DataValidationStatus(): typeof DataValidationStatus;
/**
* Different types of commands
*/
get CommandType(): typeof CommandType;
/**
* Different baseline offsets for text baseline positioning
*/
get BaselineOffset(): typeof BaselineOffset;
/**
* Boolean number representations
*/
get BooleanNumber(): typeof BooleanNumber;
/**
* Different horizontal text alignment options
*/
get HorizontalAlign(): typeof HorizontalAlign;
/**
* Different text decoration styles
*/
get TextDecoration(): typeof TextDecoration;
/**
* Different text direction options
*/
get TextDirection(): typeof TextDirection;
/**
* Different vertical text alignment options
*/
get VerticalAlign(): typeof VerticalAlign;
}
import { UniverInstanceType } from '../common/unit';
import { CommandType } from '../services/command/command.service';
import { LifecycleStages } from '../services/lifecycle/lifecycle';
import { IWorkbookData } from '../sheets/typedef';
import { IDocumentData } from '../types/interfaces';
export interface ISheetCreateParam {
unitId: string;
type: UniverInstanceType.UNIVER_SHEET;
data: IWorkbookData;
import { FDoc } from './f-doc';
/**
* Base interface for all event parameters
* @interface IEventBase
*/
export interface IEventBase {
/** Flag to cancel the event if supported */
cancel?: boolean;
}
export interface IDocumentCreateParam {
/**
* Event interface triggered when a document is created
* @interface IDocCreatedParam
* @augments {IEventBase}
*/
export interface IDocCreatedParam extends IEventBase {
/** Unique identifier of the document unit */
unitId: string;
/** Type identifier for document instances */
type: UniverInstanceType.UNIVER_DOC;
data: IDocumentData;
/** The created document instance */
doc: FDoc;
/** Reference to the document unit */
unit: FDoc;
}
export interface ILifeCycleChangedParam {
/**
* Event interface triggered when a document is disposed
* @interface IDocDisposedEvent
* @augments {IEventBase}
*/
export interface IDocDisposedEvent extends IEventBase {
/** Unique identifier of the disposed document unit */
unitId: string;
/** Type identifier for document instances */
unitType: UniverInstanceType.UNIVER_DOC;
/** Final state snapshot of the disposed document */
snapshot: IDocumentData;
}
/**
* Event interface for lifecycle stage changes
* @interface ILifeCycleChangedEvent
* @augments {IEventBase}
*/
export interface ILifeCycleChangedEvent extends IEventBase {
/** Current stage of the lifecycle */
stage: LifecycleStages;
}
export interface IEventBase {
cancel?: boolean;
/**
* Event interface for command execution
* @interface ICommandEvent
* @augments {IEventBase}
*/
export interface ICommandEvent extends IEventBase {
/** Parameters passed to the command */
params: any;
/** Unique identifier of the command */
id: string;
/** Type of the command */
type: CommandType;
}
export type IUnitCreateEvent = IEventBase & (ISheetCreateParam | IDocumentCreateParam);
export type ILifeCycleChangedEvent = IEventBase & ILifeCycleChangedParam;
export declare class FEventName {

@@ -28,7 +69,121 @@ static _instance: FEventName | null;

constructor();
get UnitCreated(): "UnitCreated";
/**
* Event fired when a document is created
* @see {@link IDocCreatedParam}
* @example
* ```ts
* univerAPI.addEvent(univerAPI.event.DocCreated, (params) => {
* const { unitId, type, doc, unit } = params;
* console.log('doc created', params);
* });
* ```
*/
get DocCreated(): "DocCreated";
/**
* Event fired when a document is disposed
* @see {@link IDocDisposedEvent}
* @example
* ```ts
* univerAPI.addEvent(univerAPI.event.DocDisposed, (params) => {
* const { unitId, unitType, snapshot } = params;
* console.log('doc disposed', params);
* });
* ```
*/
get DocDisposed(): "DocDisposed";
/**
* Event fired when life cycle is changed
* @see {@link ILifeCycleChangedEvent}
* @example
* ```ts
* univerAPI.addEvent(univerAPI.event.LifeCycleChanged, (params) => {
* const { stage } = params;
* console.log('life cycle changed', params);
* });
* ```
*/
get LifeCycleChanged(): "LifeCycleChanged";
/**
* Event fired when a redo command is executed
* @see {@link ICommandEvent}
* @example
* ```ts
* univerAPI.addEvent(univerAPI.event.Redo, (event) => {
* const { params, id, type } = event;
* console.log('command executed', event);
* });
* ```
*/
get Redo(): "Redo";
/**
* Event fired when an undo command is executed
* @see {@link ICommandEvent}
* @example
* ```ts
* univerAPI.addEvent(univerAPI.event.Undo, (event) => {
* const { params, id, type } = event;
* console.log('command executed', event);
* });
* ```
*/
get Undo(): "Undo";
/**
* Event fired before a redo command is executed
* @see {@link ICommandEvent}
* @example
* ```ts
* univerAPI.addEvent(univerAPI.event.BeforeRedo, (event) => {
* const { params, id, type } = event;
* console.log('command executed', event);
* });
* ```
*/
get BeforeRedo(): "BeforeRedo";
/**
* Event fired before an undo command is executed
* @see {@link ICommandEvent}
* @example
* ```ts
* univerAPI.addEvent(univerAPI.event.BeforeUndo, (event) => {
* const { params, id, type } = event;
* console.log('command executed', event);
* });
* ```
*/
get BeforeUndo(): "BeforeUndo";
/**
* Event fired when a command is executed
* @see {@link ICommandEvent}
* @example
* ```ts
* univerAPI.addEvent(univerAPI.event.CommandExecuted, (event) => {
* const { params, id, type } = event;
* console.log('command executed', event);
* });
* ```
*/
get CommandExecuted(): "CommandExecuted";
/**
* Event fired before a command is executed
* @see {@link ICommandEvent}
* @example
* ```ts
* univerAPI.addEvent(univerAPI.event.BeforeCommandExecute, (event) => {
* const { params, id, type } = event;
* console.log('command executed', event);
* });
* ```
*/
get BeforeCommandExecute(): "BeforeCommandExecute";
}
export interface IEventParamConfig {
LifeCycleChanged: ILifeCycleChangedEvent;
DocDisposed: IDocDisposedEvent;
DocCreated: IDocCreatedParam;
Redo: ICommandEvent;
Undo: ICommandEvent;
BeforeRedo: ICommandEvent;
BeforeUndo: ICommandEvent;
CommandExecuted: ICommandEvent;
BeforeCommandExecute: ICommandEvent;
}
import { IDisposable, Injector } from '../common/di';
import { CommandListener, IExecutionOptions, ICommandService } from '../services/command/command.service';
import { LifecycleStages } from '../services/lifecycle/lifecycle';
import { IDocumentData, IParagraphStyle, ITextDecoration, ITextStyle } from '../types/interfaces';
import { IEventParamConfig, FEventName } from './f-event';
import { Registry } from '../common/registry';
import { ParagraphStyleBuilder, ParagraphStyleValue, RichTextBuilder, RichTextValue, TextDecorationBuilder, TextStyleBuilder, TextStyleValue } from '../docs/data-model/rich-text-builder';
import { IUniverInstanceService } from '../services/instance/instance.service';

@@ -14,2 +17,3 @@ import { LifecycleService } from '../services/lifecycle/lifecycle.service';

import { FUserManager } from './f-usermanager';
import { FUtil } from './f-util';
export declare class FUniver extends FBaseInitialable {

@@ -22,5 +26,3 @@ protected readonly _injector: Injector;

* Create an FUniver instance, if the injector is not provided, it will create a new Univer instance.
*
* @static
*
* @param {Univer | Injector} wrapped - The Univer instance or injector instance.

@@ -30,8 +32,9 @@ * @returns {FUniver} - The FUniver instance.

static newAPI(wrapped: Univer | Injector): FUniver;
private _eventRegistry;
private _ensureEventRegistry;
protected _eventRegistry: Map<string, Registry<(param: any) => void>>;
protected _ensureEventRegistry(event: string): Registry<(param: any) => void>;
constructor(_injector: Injector, _commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _lifecycleService: LifecycleService);
private _initUnitEvent;
protected _eventListend(key: string): Registry<(param: any) => void> | undefined;
/**
* Dispose the UniverSheet by the `unitId`. The UniverSheet would be unload from the application.
*
* @param unitId The unit id of the UniverSheet.

@@ -43,3 +46,2 @@ * @returns Whether the Univer instance is disposed successfully.

* Get the current lifecycle stage.
*
* @returns {LifecycleStages} - The current lifecycle stage.

@@ -50,3 +52,2 @@ */

* Undo an editing on the currently focused document.
*
* @returns {Promise<boolean>} undo result

@@ -57,3 +58,2 @@ */

* Redo an editing on the currently focused document.
*
* @returns {Promise<boolean>} redo result

@@ -98,15 +98,5 @@ */

getHooks(): FHooks;
/**
* Create a new blob.
*
* @returns {FBlob} The new blob instance
* @example
* ```ts
* const blob = UniverApi.newBlob();
* ```
*/
newBlob(): FBlob;
newColor(): ColorBuilder;
get Enum(): FEnum;
get Event(): FEventName;
get Util(): FUtil;
/**

@@ -128,3 +118,3 @@ * Add an event listener

* @param event {string} key of event
* @param params {any} parmas of event
* @param params {any} params of event
* @returns {boolean} should cancel

@@ -137,3 +127,88 @@ * @example

protected fireEvent<T extends keyof IEventParamConfig>(event: T, params: IEventParamConfig[T]): boolean | undefined;
/**
* Get the callback map corresponding to the event
* @param event
* @returns {number} The number of callbacks
*/
protected hasEventCallback(event: keyof IEventParamConfig): boolean;
getUserManager(): FUserManager;
/**
* Create a new blob.
* @returns {FBlob} The new blob instance
* @example
* ```ts
* const blob = univerApi.newBlob();
* ```
*/
newBlob(): FBlob;
/**
* Create a new color.
* @returns {ColorBuilder} The new color instance
* @example
* ```ts
* const color = univerApi.newColor();
* ```
*/
newColor(): ColorBuilder;
/**
* Create a new rich text.
* @param data
* @returns {RichTextBuilder} The new rich text instance
* @example
* ```ts
* const richText = univerApi.newRichText();
* ```
*/
newRichText(data?: IDocumentData): RichTextBuilder;
/**
* Create a new rich text value.
* @param data - The rich text data
* @returns {RichTextValue} The new rich text value instance
* @example
* ```ts
* const richTextValue = univerApi.newRichTextValue();
* ```
*/
newRichTextValue(data: IDocumentData): RichTextValue;
/**
* Create a new paragraph style.
* @param style - The paragraph style
* @returns {ParagraphStyleBuilder} The new paragraph style instance
* @example
* ```ts
* const paragraphStyle = univerApi.newParagraphStyle();
* ```
*/
newParagraphStyle(style?: IParagraphStyle): ParagraphStyleBuilder;
/**
* Create a new paragraph style value.
* @param style - The paragraph style
* @returns {ParagraphStyleValue} The new paragraph style value instance
* @example
* ```ts
* const paragraphStyleValue = univerApi.newParagraphStyleValue();
* ```
*/
newParagraphStyleValue(style?: IParagraphStyle): ParagraphStyleValue;
/**
* Create a new text style.
* @param style - The text style
* @returns {TextStyleBuilder} The new text style instance
* @example
* ```ts
* const textStyle = univerApi.newTextStyle();
* ```
*/
newTextStyle(style?: ITextStyle): TextStyleBuilder;
/**
* Create a new text style value.
* @param style - The text style
* @returns {TextStyleValue} The new text style value instance
* @example
* ```ts
* const textStyleValue = univerApi.newTextStyleValue();
* ```
*/
newTextStyleValue(style?: ITextStyle): TextStyleValue;
newTextDecoration(decoration?: ITextDecoration): TextDecorationBuilder;
}

@@ -9,9 +9,10 @@ import { IUser, UserManagerService } from '../services/user-manager/user-manager.service';

/**
* Get current user info
* Get current user info.
* @returns {IUser} Current user info.
* @example
* ```typescript
* univerAPI.getUserManager().getCurrentUser();
* ```
* univerAPI.getUserManager().getCurrentUser()
* ```
*/
getCurrentUser(): IUser;
}

@@ -1,25 +0,18 @@

/**
* 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.
*/
import { Rectangle, Tools } from '../shared';
export declare class FUtil {
static Range: {
new (): Range;
prototype: Range;
readonly START_TO_START: 0;
readonly START_TO_END: 1;
readonly END_TO_END: 2;
readonly END_TO_START: 3;
};
static _instance: FUtil | null;
static get(): FUtil;
static extend(source: any): void;
/**
* Rectangle utils, including range operations likes merge, subtract, split
*/
get rectangle(): typeof Rectangle;
/**
* Number format utils, including parse and strigify about date, price, etc
*/
get numfmt(): import('../shared/types/numfmt.type').INumfmt;
/**
* common tools
*/
get tools(): typeof Tools;
}

@@ -23,3 +23,4 @@ /**

export { shallowEqual } from './common/equal';
export { CustomCommandExecutionError } from './common/error';
export { ParagraphStyleBuilder, ParagraphStyleValue, RichTextBuilder, RichTextValue, TextDecorationBuilder, TextStyleBuilder, TextStyleValue } from './docs/data-model/rich-text-builder';
export { CanceledError, CustomCommandExecutionError } from './common/error';
export { throttle } from './common/function';

@@ -37,2 +38,3 @@ export type { IAsyncInterceptor, ICellInterceptor, IComposeInterceptors, IInterceptor, InterceptorHandler } from './common/interceptor';

export { FEnum } from './facade/f-enum';
export { FUtil } from './facade/f-util';
export { isNumeric, isSafeNumeric } from './common/number';

@@ -56,4 +58,3 @@ export { Registry, RegistryAsMap } from './common/registry';

export type { TPriority } from './docs/data-model/text-x/text-x';
export { composeBody, getBodySlice, SliceBodyType } from './docs/data-model/text-x/utils';
export { getCustomDecorationSlice, getCustomRangeSlice, normalizeBody } from './docs/data-model/text-x/utils';
export { composeBody, getBodySlice, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeSlice, getParagraphsSlice, getSectionBreakSlice, getTableSlice, getTextRunSlice, normalizeBody, SliceBodyType, } from './docs/data-model/text-x/utils';
export { EventState, EventSubject, fromEventSubject, type IEventObserver } from './observer/observable';

@@ -60,0 +61,0 @@ export { AuthzIoLocalService } from './services/authz-io/authz-io-local.service';

@@ -26,2 +26,3 @@ /**

export declare const FOCUSING_FX_BAR_EDITOR = "FOCUSING_FX_BAR_EDITOR";
/** The focusing state of the cell editor. */
export declare const FOCUSING_UNIVER_EDITOR = "FOCUSING_UNIVER_EDITOR";

@@ -28,0 +29,0 @@ export declare const FOCUSING_EDITOR_STANDALONE = "FOCUSING_EDITOR_INPUT_FORMULA";

import { Observable } from 'rxjs';
import { Nullable } from '../../shared/types';
/**
* The type of image data source
*/
export declare enum ImageSourceType {
/**
* The image source is a URL, for example: https://avatars.githubusercontent.com/u/61444807?s=48&v=4
*/
URL = "URL",
/**
* The image source is a UUID, this ID is generated by the Univer image hosting service. For specific generation rules, please refer to the Univer image hosting service API documentation.
*/
UUID = "UUID",
/**
* The image source is BASE64, for example: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB7ZJ...
*/
BASE64 = "BASE64"

@@ -7,0 +19,0 @@ }

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

import { ITransformState } from '../types/interfaces/i-document-data';
import { ITransformState } from '../types/interfaces/i-drawing';
import { Nullable } from './types';

@@ -3,0 +3,0 @@ export declare const MOVE_BUFFER_VALUE = 2;

@@ -33,3 +33,3 @@ /**

export { LRUHelper, LRUMap } from './lru/lru-map';
export { numfmt } from './numfmt';
export { type INumfmtLocalTag, numfmt } from './numfmt';
export * from './object-matrix';

@@ -36,0 +36,0 @@ export { queryObjectMatrix } from './object-matrix-query';

@@ -1,3 +0,3 @@

import { INumfmt } from './types/numfmt.type';
import { INumfmt, LocaleTag } from './types/numfmt.type';
declare const numfmt: INumfmt;
export { numfmt };
export { LocaleTag as INumfmtLocalTag, numfmt };
import { Nullable } from './types';
import { IRange, IRectLTRB } from '../sheets/typedef';
/**
* This class provides a set of methods to calculate `IRange`.
* This class provides a set of methods to calculate and manipulate rectangular ranges (IRange).
* A range represents a rectangular area in a grid, defined by start/end rows and columns.
* @example
* ```typescript
* // Example range representing cells from A1 to C3
* const range: IRange = {
* startRow: 0,
* startColumn: 0,
* endRow: 2,
* endColumn: 2,
* rangeType: RANGE_TYPE.NORMAL
* };
* ```
*/
export declare class Rectangle {
/**
* Creates a deep copy of an IRange object
* @param src
* @example
* ```typescript
* const original = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
* const copy = Rectangle.clone(original);
* // copy = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 }
* ```
*/
static clone(src: IRange): IRange;
/**
* Checks if two ranges are equal by comparing their properties
* @param src
* @param target
* @example
* ```typescript
* const range1 = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
* const range2 = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
* const areEqual = Rectangle.equals(range1, range2); // true
* ```
*/
static equals(src: IRange, target: IRange): boolean;
/**
* Check intersects of normal range(RANGE_TYPE.NORMAL)
* For other types of ranges, please consider using the intersects method.
* Quickly checks if two normal ranges intersect. For specialized range types,
* use the intersects() method instead.
* @param rangeA
* @param rangeB
* @returns boolean
* @example
* ```typescript
* const range1 = { startRow: 0, startColumn: 0, endRow: 2, endColumn: 2 };
* const range2 = { startRow: 1, startColumn: 1, endRow: 3, endColumn: 3 };
* const doIntersect = Rectangle.simpleRangesIntersect(range1, range2); // true
* ```
*/
static simpleRangesIntersect(rangeA: IRange, rangeB: IRange): boolean;
/**
* Checks if two ranges intersect, handling special range types (ROW, COLUMN)
* @param src
* @param target
* @example
* ```typescript
* const rowRange = {
* startRow: 0, endRow: 2,
* startColumn: NaN, endColumn: NaN,
* rangeType: RANGE_TYPE.ROW
* };
* const colRange = {
* startRow: NaN, endRow: NaN,
* startColumn: 0, endColumn: 2,
* rangeType: RANGE_TYPE.COLUMN
* };
* const doIntersect = Rectangle.intersects(rowRange, colRange); // true
* ```
*/
static intersects(src: IRange, target: IRange): boolean;
/**
*
* @deprecated use `getIntersectRange` instead. This method does not handle NaN and does not return the correct rangeType
* Gets the intersection range between two ranges
* @param src
* @param target
* @deprecated use `getIntersectRange` instead
* @example
* ```typescript
* const range1 = { startRow: 0, startColumn: 0, endRow: 2, endColumn: 2 };
* const range2 = { startRow: 1, startColumn: 1, endRow: 3, endColumn: 3 };
* const intersection = Rectangle.getIntersects(range1, range2);
* // intersection = { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 }
* ```
*/
static getIntersects(src: IRange, target: IRange): Nullable<IRange>;
/**
* Checks if one range completely contains another range
* @param src
* @param target
* @example
* ```typescript
* const outer = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
* const inner = { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 };
* const contains = Rectangle.contains(outer, inner); // true
* ```
*/
static contains(src: IRange, target: IRange): boolean;
/**
* Checks if one range strictly contains another range (not equal)
* @param src
* @param target
* @example
* ```typescript
* const outer = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
* const same = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
* const realContains = Rectangle.realContain(outer, same); // false
* ```
*/
static realContain(src: IRange, target: IRange): boolean;
/**
* Creates a union range that encompasses all input ranges
* @param {...any} ranges
* @example
* ```typescript
* const range1 = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
* const range2 = { startRow: 2, startColumn: 2, endRow: 3, endColumn: 3 };
* const union = Rectangle.union(range1, range2);
* // union = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 }
* ```
*/
static union(...ranges: IRange[]): IRange;
/**
* Creates a union range considering special range types (ROW, COLUMN)
* @param {...any} ranges
* @example
* ```typescript
* const rowRange = {
* startRow: 0, endRow: 2,
* rangeType: RANGE_TYPE.ROW
* };
* const normalRange = {
* startRow: 1, startColumn: 1,
* endRow: 3, endColumn: 3
* };
* const union = Rectangle.realUnion(rowRange, normalRange);
* // Result will have NaN for columns due to ROW type
* ```
*/
static realUnion(...ranges: IRange[]): IRange;
/**
* Converts an absolute range to a relative range based on an origin range
* @param range
* @param originRange
* @example
* ```typescript
* const range = { startRow: 5, startColumn: 5, endRow: 7, endColumn: 7 };
* const origin = { startRow: 3, startColumn: 3, endRow: 8, endColumn: 8 };
* const relative = Rectangle.getRelativeRange(range, origin);
* // relative = { startRow: 2, startColumn: 2, endRow: 2, endColumn: 2 }
* ```
*/
static getRelativeRange: (range: IRange, originRange: IRange) => IRange;
/**
* Converts a relative range back to an absolute range based on origin
* @param relativeRange
* @param originRange
* @param absoluteRange
* @example
* ```typescript
* const relative = { startRow: 2, startColumn: 2, endRow: 2, endColumn: 2 };
* const origin = { startRow: 3, startColumn: 3, endRow: 8, endColumn: 8 };
* const absolute = Rectangle.getPositionRange(relative, origin);
* // absolute = { startRow: 5, startColumn: 5, endRow: 7, endColumn: 7 }
* ```
*/
static getPositionRange: (relativeRange: IRange, originRange: IRange, absoluteRange?: IRange) => IRange;
/**
* Moves a range horizontally by a specified step and optionally extends it
* @param range
* @param step
* @param length
* @example
* ```typescript
* const range = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
* const moved = Rectangle.moveHorizontal(range, 2, 1);
* // moved = { startRow: 0, startColumn: 2, endRow: 1, endColumn: 4 }
* ```
*/
static moveHorizontal: (range: IRange, step?: number, length?: number) => IRange;
/**
* Moves a range vertically by a specified step and optionally extends it
* @param range
* @param step
* @param length
* @example
* ```typescript
* const range = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
* const moved = Rectangle.moveVertical(range, 2, 1);
* // moved = { startRow: 2, startColumn: 0, endRow: 4, endColumn: 1 }
* ```
*/
static moveVertical: (range: IRange, step?: number, length?: number) => IRange;
/**
* Moves a range by specified offsets in both directions
* @param range
* @param offsetX
* @param offsetY
* @example
* ```typescript
* const range = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
* const moved = Rectangle.moveOffset(range, 2, 3);
* // moved = { startRow: 3, startColumn: 2, endRow: 4, endColumn: 3 }
* ```
*/
static moveOffset: (range: IRange, offsetX: number, offsetY: number) => IRange;
/**
* Subtract range2 from range1, the result is is horizontal first then vertical
* @param {IRange} range1 The source range
* @param {IRange} range2 The range to be subtracted
* @returns {IRange[]} Returns the array of ranges, which are the result not intersected with range1
* Subtracts one range from another, returning the remaining areas as separate ranges
* @param range1
* @param range2
* @example
* ```typescript
* const range1 = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
* const range2 = { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 };
* const result = Rectangle.subtract(range1, range2);
* // Results in up to 4 ranges representing the non-overlapping areas
* ```
*/
static subtract(range1: IRange, range2: IRange): IRange[];
/**
* Combine smaller rectangles into larger ones
* Merges overlapping or adjacent ranges into larger ranges
* @param ranges
* @returns
* @example
* ```typescript
* const ranges = [
* { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 },
* { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 }
* ];
* const merged = Rectangle.mergeRanges(ranges);
* // Combines overlapping ranges into larger ones
* ```
*/
static mergeRanges(ranges: IRange[]): IRange[];
/**
* Splits overlapping ranges into a grid of non-overlapping ranges
* @param ranges
* @example
* ```typescript
* const ranges = [
* { startRow: 0, startColumn: 0, endRow: 2, endColumn: 2 },
* { startRow: 1, startColumn: 1, endRow: 3, endColumn: 3 }
* ];
* const grid = Rectangle.splitIntoGrid(ranges);
* // Splits into non-overlapping grid sections
* ```
*/
static splitIntoGrid(ranges: IRange[]): IRange[];
/**
* Subtracts multiple ranges from multiple ranges
* @param ranges1
* @param ranges2
* @example
* ```typescript
* const ranges1 = [{ startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 }];
* const ranges2 = [
* { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 },
* { startRow: 2, startColumn: 2, endRow: 3, endColumn: 3 }
* ];
* const result = Rectangle.subtractMulti(ranges1, ranges2);
* // Returns remaining non-overlapping areas
* ```
*/
static subtractMulti(ranges1: IRange[], ranges2: IRange[]): IRange[];
/**
* Checks if two rectangles defined by left, top, right, bottom coordinates intersect
* @param rect1
* @param rect2
* @example
* ```typescript
* const rect1 = { left: 0, top: 0, right: 10, bottom: 10 };
* const rect2 = { left: 5, top: 5, right: 15, bottom: 15 };
* const intersects = Rectangle.hasIntersectionBetweenTwoRect(rect1, rect2); // true
* ```
*/
static hasIntersectionBetweenTwoRect(rect1: IRectLTRB, rect2: IRectLTRB): boolean;
/**
* Gets the intersection area between two rectangles defined by LTRB coordinates
* @param rect1
* @param rect2
* @example
* ```typescript
* const rect1 = { left: 0, top: 0, right: 10, bottom: 10 };
* const rect2 = { left: 5, top: 5, right: 15, bottom: 15 };
* const intersection = Rectangle.getIntersectionBetweenTwoRect(rect1, rect2);
* // Returns { left: 5, top: 5, right: 10, bottom: 10, width: 5, height: 5 }
* ```
*/
static getIntersectionBetweenTwoRect(rect1: IRectLTRB, rect2: IRectLTRB): Required<IRectLTRB> | null;
/**
* Sorts an array of ranges by startRow, then by startColumn
* @param ranges
* @example
* ```typescript
* const ranges = [
* { startRow: 1, startColumn: 0, endRow: 2, endColumn: 1 },
* { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 }
* ];
* const sorted = Rectangle.sort(ranges);
* // Ranges will be sorted by startRow first, then startColumn
* ```
*/
static sort(ranges: IRange[]): IRange[];
}

@@ -184,3 +184,3 @@ /**

}
type LocaleTag = 'zh-CN' | 'zh' | 'zh-TW' | 'cs' | 'da' | 'nl' | 'en' | 'fi' | 'fr' | 'de' | 'el' | 'hu' | 'is' | 'id' | 'it' | 'ja' | 'ko' | 'nb' | 'pl' | 'pt' | 'ru' | 'sk' | 'es' | 'sv' | 'th' | 'tr';
export type LocaleTag = 'zh-CN' | 'zh-TW' | 'cs' | 'da' | 'nl' | 'en' | 'fi' | 'fr' | 'de' | 'el' | 'hu' | 'is' | 'id' | 'it' | 'ja' | 'ko' | 'nb' | 'pl' | 'pt' | 'ru' | 'sk' | 'es' | 'sv' | 'th' | 'tr' | 'vi';
export interface ParsedReturnType {

@@ -187,0 +187,0 @@ /**

import { IObjectArrayPrimitiveType } from '../shared/object-matrix';
import { Nullable } from '../shared/types';
import { IStyleData } from '../types/interfaces';
import { IColumnData, IRange, IWorksheetData } from './typedef';
import { CustomData, IColumnData, IRange, IWorksheetData } from './typedef';
/**

@@ -72,2 +72,4 @@ * Manage configuration information of all columns, get column width, column length, set column width, etc.

getColumnOrCreate(columnPos: number): Partial<IColumnData>;
setCustomMetadata(index: number, custom: CustomData | undefined): void;
getCustomMetadata(index: number): CustomData | undefined;
}
import { Nullable } from '../shared/types';
import { IStyleData } from '../types/interfaces';
import { CustomData, IRange, IRowData, IWorksheetData } from './typedef';
import { SheetViewModel } from './view-model';
import { IObjectArrayPrimitiveType } from '../shared/object-matrix';
import { IRange, IRowData, IWorksheetData } from './typedef';
/**

@@ -71,2 +71,4 @@ * Manage configuration information of all rows, get row height, row length, set row height, etc.

getSize(): number;
setCustomMetadata(index: number, custom: CustomData | undefined): void;
getCustomMetadata(index: number): CustomData | undefined;
}

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

resources?: IResources;
/**
* User stored custom fields
*/
custom?: CustomData;
}

@@ -110,2 +114,6 @@ /**

rightToLeft: BooleanNumber;
/**
* User stored custom fields
*/
custom?: CustomData;
}

@@ -112,0 +120,0 @@ export type CustomData = Nullable<Record<string, any>>;

import { Observable } from 'rxjs';
import { Nullable } from '../shared';
import { IRangeType, IWorkbookData, IWorksheetData } from './typedef';
import { CustomData, IRangeType, IWorkbookData, IWorksheetData } from './typedef';
import { UnitModel, UniverInstanceType } from '../common/unit';

@@ -126,2 +126,12 @@ import { ILogService } from '../services/log/log.service';

private _parseWorksheetSnapshots;
/**
* Get custom metadata of workbook
* @returns {CustomData | undefined} custom metadata
*/
getCustomMetadata(): CustomData | undefined;
/**
* Set custom metadata of workbook
* @param {CustomData | undefined} custom custom metadata
*/
setCustomMetadata(custom: CustomData | undefined): void;
}

@@ -5,3 +5,3 @@ import { IInterceptor } from '../common/interceptor';

import { Styles } from './styles';
import { ICellData, ICellDataForSheetInterceptor, ICellDataWithSpanAndDisplay, IFreeze, IRange, ISelectionCell, IWorksheetData, CellModeEnum } from './typedef';
import { CustomData, ICellData, ICellDataForSheetInterceptor, ICellDataWithSpanAndDisplay, IFreeze, IRange, ISelectionCell, IWorksheetData, CellModeEnum } from './typedef';
import { DocumentDataModel } from '../docs';

@@ -395,2 +395,12 @@ import { BooleanNumber, CellValueType, HorizontalAlign, TextDirection, VerticalAlign, WrapStrategy } from '../types/enum';

getCellDocumentModelWithFormula(cell: ICellData): Nullable<IDocumentLayoutObject>;
/**
* Get custom metadata of worksheet
* @returns {CustomData | undefined} custom metadata
*/
getCustomMetadata(): CustomData | undefined;
/**
* Set custom metadata of workbook
* @param {CustomData | undefined} custom custom metadata
*/
setCustomMetadata(custom: CustomData | undefined): void;
}

@@ -397,0 +407,0 @@ /**

@@ -130,2 +130,11 @@ import { BooleanNumber, HorizontalAlign, TextDirection, VerticalAlign, WrapStrategy } from '../enum';

n: null;
/**
* border
*/
bd: {
b: null;
l: null;
r: null;
t: null;
};
};

@@ -132,0 +141,0 @@ export declare const DEFAULT_SLIDE: {

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

import { IAbsoluteTransform, ISize } from '../../shared/shape';
import { Nullable } from '../../shared/types';
import { ISize } from '../../shared/shape';
import { BooleanNumber, CellValueType, HorizontalAlign, LocaleType, TextDirection, VerticalAlign, WrapStrategy } from '../enum';
import { IDrawingParam } from './i-drawing';
import { IMention } from './i-mention';

@@ -845,51 +845,1 @@ import { IColorStyle, IStyleBase } from './i-style-data';

}
/** @deprecated */
export declare enum ArrangeTypeEnum {
forward = 0,
backward = 1,
front = 2,
back = 3
}
/** @deprecated */
export declare enum DrawingTypeEnum {
UNRECOGNIZED = -1,
DRAWING_IMAGE = 0,
DRAWING_SHAPE = 1,
DRAWING_CHART = 2,
DRAWING_TABLE = 3,
DRAWING_SMART_ART = 4,
DRAWING_VIDEO = 5,
DRAWING_GROUP = 6,
DRAWING_UNIT = 7,
DRAWING_DOM = 8
}
/** @deprecated */
export type DrawingType = DrawingTypeEnum | number;
/** @deprecated */
export interface IDrawingSpace {
unitId: string;
subUnitId: string;
}
/** @deprecated */
export interface IDrawingSearch extends IDrawingSpace {
drawingId: string;
}
/** @deprecated */
export interface IRotationSkewFlipTransform {
angle?: number;
skewX?: number;
skewY?: number;
flipX?: boolean;
flipY?: boolean;
}
/** @deprecated */
export interface ITransformState extends IAbsoluteTransform, IRotationSkewFlipTransform {
}
/** @deprecated */
export interface IDrawingParam extends IDrawingSearch {
drawingType: DrawingType;
transform?: Nullable<ITransformState>;
transforms?: Nullable<ITransformState[]>;
isMultiTransform?: BooleanNumber;
groupId?: string;
}

@@ -6,3 +6,4 @@ import { ISize } from '../../shared/shape';

import { ShapeType } from '../enum/prst-geom-type';
import { ICustomBlock, IDocumentData, ILists, ITransformState } from './i-document-data';
import { ICustomBlock, IDocumentData, ILists } from './i-document-data';
import { ITransformState } from './i-drawing';
import { IImageProperties } from './i-image-properties';

@@ -9,0 +10,0 @@ import { IPlaceholder } from './i-placeholder';

@@ -9,5 +9,17 @@ import { Nullable } from '../../shared/types';

export interface ITextDecoration {
/**
* show
*/
s: BooleanNumber;
/**
* color is follow the font color. the default value is TRUE, it's also TRUE if it is undefined. the cl has no effect when `c` is TRUE.
*/
c?: BooleanNumber;
/**
* color
*/
cl?: IColorStyle;
/**
* lineType
*/
t?: TextDecoration;

@@ -14,0 +26,0 @@ }

@@ -18,2 +18,3 @@ /**

export * from './i-document-data-interceptor';
export * from './i-drawing';
export * from './i-image-properties';

@@ -20,0 +21,0 @@ export * from './i-mention';

{
"name": "@univerjs/core",
"version": "0.5.3",
"version": "0.5.4-experimental.20250114-7c09c35",
"private": false,

@@ -70,5 +70,5 @@ "description": "Core library for Univer.",

"typescript": "^5.7.2",
"vite": "^6.0.6",
"vite": "^6.0.7",
"vitest": "^2.1.8",
"@univerjs-infra/shared": "0.5.3"
"@univerjs-infra/shared": "0.5.4"
},

@@ -75,0 +75,0 @@ "scripts": {

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