@univerjs/engine-render 1.0.0-beta.1 → 1.0.0-beta.2

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.
@@ -31,5 +31,6 @@ export * from './text-rotation';
31
31
  export * from './tools';
32
32
  export * from './transform';
33
33
  export type { ITransformerConfig } from './transformer-config';
34
+ export { DEFAULT_TRANSFORMER_CONFIG } from './transformer-config';
34
35
  export * from './vector2';
35
36
  export * from './zoom';
@@ -68,3 +68,30 @@ export interface ITransformerConfig {
68
68
  zeroTop?: number;
69
69
  moveBoundaryEnabled?: boolean;
70
70
  }
71
+ export declare const DEFAULT_TRANSFORMER_CONFIG: {
72
+ resizeEnabled: true;
73
+ rotateEnabled: true;
74
+ rotateAnchorOffset: number;
75
+ rotateAnchorPosition: "bottom";
76
+ rotateLineEnabled: false;
77
+ rotateSize: number;
78
+ rotateCornerRadius: number;
79
+ rotateFill: string;
80
+ rotateStroke: string;
81
+ rotateStrokeWidth: number;
82
+ rotateIconEnabled: true;
83
+ rotateIconStroke: string;
84
+ rotateIconStrokeWidth: number;
85
+ borderEnabled: true;
86
+ borderStroke: string;
87
+ borderStrokeWidth: number;
88
+ borderSpacing: number;
89
+ anchorFill: string;
90
+ anchorStroke: string;
91
+ anchorStrokeWidth: number;
92
+ anchorSize: number;
93
+ anchorCornerRadius: number;
94
+ anchorStyle: "canva";
95
+ keepRatio: true;
96
+ moveBoundaryEnabled: true;
97
+ };
@@ -13,11 +13,25 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { Nullable } from '@univerjs/core';
16
+ import type { IColumnGroup, Nullable } from '@univerjs/core';
17
17
  import type { IDocumentSkeletonColumnGroup, IDocumentSkeletonPage } from '../../../../basics/i-document-skeleton-cached';
18
18
  import type { ISectionBreakConfig } from '../../../../basics/interfaces';
19
19
  import type { DataStreamTreeNode } from '../../view-model/data-stream-tree-node';
20
20
  import type { DocumentViewModel } from '../../view-model/document-view-model';
21
21
  import type { ILayoutContext } from '../tools';
22
+ interface IColumnGroupLayoutColumn {
23
+ columnId: string;
24
+ left: number;
25
+ top: number;
26
+ width: number;
27
+ }
28
+ interface IColumnGroupLayout {
29
+ mode: 'horizontal' | 'stack';
30
+ width: number;
31
+ height: number;
32
+ columns: IColumnGroupLayoutColumn[];
33
+ }
22
34
  export declare function createColumnGroupSkeleton(ctx: ILayoutContext, curPage: IDocumentSkeletonPage, viewModel: DocumentViewModel, columnGroupNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig): Nullable<IDocumentSkeletonColumnGroup>;
23
35
  export declare function appendColumnGroupBlockLine(page: IDocumentSkeletonPage, columnGroup: IDocumentSkeletonColumnGroup): boolean;
36
+ export declare function calculateColumnGroupLayout(source: IColumnGroup, availableWidth: number, columnHeights: number[]): IColumnGroupLayout;
37
+ export {};
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { IColorStyle, Nullable } from '@univerjs/core';
17
+ export declare function getColorStyleForCanvas(color: Nullable<IColorStyle>): Nullable<string>;
@@ -82,6 +82,7 @@ export declare class SpreadsheetSkeleton extends SheetSkeleton {
82
82
  private _handleBorderMatrix;
83
83
  private _showGridlines;
84
84
  private _gridlinesColor;
85
+ private _defaultGridlinesColor;
85
86
  private _scene;
86
87
  constructor(worksheet: Worksheet, _styles: Styles, _localeService: LocaleService, _contextService: IContextService, _configService: IConfigService, _injector: Injector);
87
88
  registerGetCellHeight(): void;
@@ -102,6 +103,7 @@ export declare class SpreadsheetSkeleton extends SheetSkeleton {
102
103
  get incrementalFontRenderRanges(): IRange[];
103
104
  get showGridlines(): BooleanNumber;
104
105
  get gridlinesColor(): string | undefined;
106
+ get defaultGridlinesColor(): string;
105
107
  dispose(): void;
106
108
  setOverflowCache(value: ObjectMatrix<IRange>): void;
107
109
  getFont(rowIndex: number, columnIndex: number): Nullable<IFontCacheItem>;
@@ -21,6 +21,8 @@ export interface IUniverRenderingContextOptions {
21
21
  export declare class UniverRenderingContext2D implements CanvasRenderingContext2D {
22
22
  __mode: string;
23
23
  private _transformCache;
24
+ private _bitmapMutationId;
25
+ private _bitmapMutationTrackingDepth;
24
26
  readonly canvas: HTMLCanvasElement;
25
27
  _context: CanvasRenderingContext2D;
26
28
  private _systemType;
@@ -31,6 +33,8 @@ export declare class UniverRenderingContext2D implements CanvasRenderingContext2
31
33
  private _id;
32
34
  getId(): string;
33
35
  setId(id: string): void;
36
+ detectBitmapMutation(callback: () => void): boolean;
37
+ private _markBitmapMutation;
34
38
  isContextLost(): boolean;
35
39
  get globalAlpha(): number;
36
40
  set globalAlpha(val: number);
@@ -78,7 +78,7 @@ export declare class RenderManagerService extends Disposable implements IRenderM
78
78
  * @returns Dependency[]
79
79
  */
80
80
  private _getRenderDepsByType;
81
- private _initDarkModeListener;
81
+ private _initThemeListener;
82
82
  /**
83
83
  * create renderUnit & init deps from renderDependencies
84
84
  * @param unitId
@@ -56,6 +56,7 @@ export declare class Scene extends Disposable {
56
56
  private _layers;
57
57
  private _viewports;
58
58
  private _preserveEngineOnRender;
59
+ private _hasPostRenderCanvasMutation;
59
60
  private _scrollbarDragViewport;
60
61
  private _isScrollbarSeeking;
61
62
  private _isScrollbarPreviewDirty;
@@ -235,6 +236,7 @@ export declare class Scene extends Disposable {
235
236
  private _shouldDeferScrollbarSeekRender;
236
237
  private _recordRenderedViewportScrollPositions;
237
238
  private _recordFullRenderDuration;
239
+ private _notifyAfterRender;
238
240
  render(parentCtx?: UniverRenderingContext): void;
239
241
  requestRender(parentCtx?: UniverRenderingContext): Promise<unknown>;
240
242
  /**
@@ -32,13 +32,11 @@ export declare class DumbCanvasColorService implements ICanvasColorService {
32
32
  export declare class CanvasColorService extends Disposable implements ICanvasColorService {
33
33
  private readonly _themeService;
34
34
  private readonly _darkModeCache;
35
- private readonly _resolvedColorCache;
35
+ private readonly _resolvedThemeColors;
36
36
  private _invertAlgo;
37
37
  constructor(_themeService: ThemeService);
38
38
  getRenderColor(inputColor: string): string;
39
- private _resolveColor;
40
- private _resolveThemeColor;
39
+ private _cacheThemeColors;
41
40
  }
42
- export declare function getDarkRenderColorOverride(color: string): string | null;
43
41
  export declare function hexToRgb(_hex: string): RGBColorType;
44
42
  export declare function rgbToHex(rgbColor: RGBColorType): string;
@@ -84,6 +84,8 @@ export declare class ScrollBar extends Disposable {
84
84
  private _thumbActiveBackgroundColor;
85
85
  private _trackBackgroundColor;
86
86
  private _trackBorderColor;
87
+ private _trackBackgroundOpacity;
88
+ private _trackBorderOpacity;
87
89
  /**
88
90
  * The thickness of a scrolling track
89
91
  * ThumbSize = trackSize - thumbMargin * 2
@@ -33,8 +33,10 @@ export interface IShapeProps extends IObjectFullState, ISize, IOffset, IScale {
33
33
  visible?: boolean;
34
34
  paintFirst?: PaintFirst;
35
35
  stroke?: Nullable<string | CanvasGradient>;
36
+ strokeOpacity?: number;
36
37
  strokeScaleEnabled?: boolean;
37
38
  fill?: Nullable<string | CanvasGradient>;
39
+ fillOpacity?: number;
38
40
  fillAfterStrokeEnabled?: boolean;
39
41
  hitStrokeWidth?: number | string;
40
42
  strokeLineJoin?: LineJoin;
@@ -65,8 +67,10 @@ export declare abstract class Shape<T extends IShapeProps> extends BaseObject {
65
67
  private _globalCompositeOperation;
66
68
  private _paintFirst;
67
69
  private _stroke;
70
+ private _strokeOpacity?;
68
71
  private _strokeScaleEnabled;
69
72
  private _fill;
73
+ private _fillOpacity?;
70
74
  private _fillAfterStrokeEnabled;
71
75
  private _hitStrokeWidth;
72
76
  private _strokeLineJoin;
@@ -91,8 +95,10 @@ export declare abstract class Shape<T extends IShapeProps> extends BaseObject {
91
95
  get globalCompositeOperation(): string;
92
96
  get paintFirst(): PaintFirst;
93
97
  get stroke(): Nullable<string | CanvasGradient>;
98
+ get strokeOpacity(): number | undefined;
94
99
  get strokeScaleEnabled(): boolean;
95
100
  get fill(): Nullable<string | CanvasGradient>;
101
+ get fillOpacity(): number | undefined;
96
102
  get fillAfterStrokeEnabled(): boolean;
97
103
  get hitStrokeWidth(): string | number;
98
104
  get strokeLineJoin(): LineJoin;