@yft-design/engine 0.0.29 → 0.0.31

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.
@@ -1,5 +1,3 @@
1
- import type { EngineDocument } from './document';
2
- import { SceneNode } from './scene';
3
1
  interface PathBackgroundSpec {
4
2
  path: string;
5
3
  fill?: string;
@@ -7,12 +5,4 @@ interface PathBackgroundSpec {
7
5
  height: number;
8
6
  }
9
7
  export declare const pathBackgroundSpecOf: (raw: Record<string, unknown>) => PathBackgroundSpec | null;
10
- export declare const syncPathBackgroundNode: (document: EngineDocument, host: SceneNode) => boolean;
11
- export declare const ensurePathBackgroundNode: (document: EngineDocument, host: SceneNode) => SceneNode | null;
12
- export declare const synthesizePathBackgroundNodes: (document: EngineDocument) => number;
13
- export declare const syncAfterPropWrite: (document: EngineDocument, node: SceneNode) => void;
14
- export declare const repositionPathBackgroundNode: (document: EngineDocument, host: SceneNode) => void;
15
- export declare const attachPathBackgroundController: (document: EngineDocument, options?: {
16
- requestRender?: () => void;
17
- }) => (() => void);
18
8
  export {};
@@ -148,6 +148,7 @@ export declare class TextNode extends SceneNode {
148
148
  };
149
149
  get aCoords(): CornerPoints;
150
150
  get inkACoords(): CornerPoints;
151
+ private get textInkACoords();
151
152
  get contentTopY(): number;
152
153
  cursorCoord(flatIndex: number): {
153
154
  x: number;
@@ -247,6 +248,7 @@ export declare class GroupNode extends SceneNode {
247
248
  y: number;
248
249
  };
249
250
  containsPoint(x: number, y: number, hitBand?: number): boolean;
251
+ get inkACoords(): CornerPoints;
250
252
  childAtPoint(x: number, y: number, hitBand?: number): SceneNode | null;
251
253
  containsDeep(node: SceneNode): boolean;
252
254
  adoptChild(child: SceneNode, index?: number): void;
@@ -258,6 +260,7 @@ export declare class TableNode extends GroupNode {
258
260
  private _layout;
259
261
  private readonly _childFactory;
260
262
  private _placedShift;
263
+ get inkACoords(): CornerPoints;
261
264
  selectedCells: CellPosition[];
262
265
  cellAnchor: CellPosition | null;
263
266
  cellRange: CellSelectionRange | null;
@@ -358,6 +361,7 @@ export declare class MaskNode extends SceneNode {
358
361
  }
359
362
  export declare class PuzzleNode extends GroupNode {
360
363
  constructor(raw: SerializedNode, childFactory: (raw: SerializedNode) => SceneNode | null);
364
+ get inkACoords(): CornerPoints;
361
365
  private reconcileIncompleteLayout;
362
366
  private reconcileOverlappingChildren;
363
367
  get layoutParams(): {
@@ -0,0 +1,3 @@
1
+ import type { CornerPoints } from '../core/mat2d';
2
+ import type { TextNode } from './scene';
3
+ export declare const withTextDecorationBounds: (node: TextNode, base: CornerPoints) => CornerPoints;
@@ -29,6 +29,19 @@ export declare const verticalLineInkRun: (line: TextLineLayout, style: TextStyle
29
29
  end: number;
30
30
  };
31
31
  export declare const GENERIC_FONTS: Set<string>;
32
+ export declare const aggregateLineInk: (layout: TextLayout, style: TextStyleProps, options?: {
33
+ vertical?: boolean;
34
+ inkMeasure?: InkMeasureFn;
35
+ align?: unknown;
36
+ }) => {
37
+ lo: number;
38
+ hi: number;
39
+ firstTop: number;
40
+ } | null;
41
+ export declare const anchorInkRange: (lo: number, hi: number, boxWidth: number, align: unknown) => {
42
+ lo: number;
43
+ hi: number;
44
+ };
32
45
  export interface TextStyleProps {
33
46
  fontFamily: string;
34
47
  fontSize: number;
@@ -1,5 +1,23 @@
1
+ import type { TextLayout } from './textLayout';
1
2
  export type TextTransformKind = 'arc' | 'circle' | 'waist' | 'flag' | 'arch' | 'scroll';
2
3
  export declare const textTransformKindOf: (raw: {
3
4
  textTransform?: unknown;
4
5
  type?: unknown;
5
6
  }) => TextTransformKind | null;
7
+ export type WarpTransformKind = 'arch' | 'waist' | 'flag';
8
+ export declare const warpTextKindOf: (raw: {
9
+ textTransform?: unknown;
10
+ type?: unknown;
11
+ warpStrength?: unknown;
12
+ }) => WarpTransformKind | null;
13
+ export interface WarpInkExtent {
14
+ left: number;
15
+ right: number;
16
+ top: number;
17
+ bottom: number;
18
+ }
19
+ export declare const computeWarpInkExtent: (kind: WarpTransformKind, layout: TextLayout, raw: Record<string, unknown>, ink: {
20
+ lo: number;
21
+ hi: number;
22
+ firstTop: number;
23
+ }, contentTopY: number) => WarpInkExtent | null;
@@ -14,6 +14,7 @@ export declare class TextRenderer {
14
14
  private textDashBakes;
15
15
  private scrollBakes;
16
16
  private highlightBakes;
17
+ private pathBgBakes;
17
18
  constructor(gl: WebGL2RenderingContext, batch: QuadBatch, glyphAtlas: GlyphAtlas);
18
19
  invalidateNodeBakes(node: SceneNode): void;
19
20
  renderWarpedText(node: TextNode, kind: WarpKind): void;
@@ -22,6 +23,7 @@ export declare class TextRenderer {
22
23
  private renderArcGlyphs;
23
24
  renderTextGlyphs(node: TextNode, zoomX: number): void;
24
25
  private renderScrollText;
26
+ renderTextPathBackground(node: TextNode, zoomX: number): void;
25
27
  private renderTextBackgrounds;
26
28
  private renderTextDecorations;
27
29
  private textHasDashStroke;
@@ -36,6 +36,12 @@ export interface HighlightDrawOp {
36
36
  }
37
37
  export interface HighlightPlan {
38
38
  ops: HighlightDrawOp[];
39
+ inkBounds: {
40
+ left: number;
41
+ top: number;
42
+ right: number;
43
+ bottom: number;
44
+ };
39
45
  padX: number;
40
46
  padY: number;
41
47
  }
@@ -0,0 +1,23 @@
1
+ import type { TextNode } from '../model/scene';
2
+ export interface TextPathBackgroundPlan {
3
+ path: string;
4
+ fill: string;
5
+ bounds: {
6
+ left: number;
7
+ top: number;
8
+ right: number;
9
+ bottom: number;
10
+ };
11
+ scaleX: number;
12
+ scaleY: number;
13
+ logicalW: number;
14
+ logicalH: number;
15
+ sigBase: string;
16
+ }
17
+ export declare const planTextPathBackground: (node: TextNode) => TextPathBackgroundPlan | null;
18
+ export interface BakedTextPathBackground {
19
+ canvas: HTMLCanvasElement;
20
+ logicalW: number;
21
+ logicalH: number;
22
+ }
23
+ export declare const bakeTextPathBackground: (plan: TextPathBackgroundPlan, bucket: number) => BakedTextPathBackground | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yft-design/engine",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
4
4
  "description": "yft-design 的 WebGL2 画布引擎:接受 fabric toObject 格式 JSON,输出 GL 画布 / 位图(任意倍率 FBO 读回)/ SVG(纯数据序列化器)",
5
5
  "repository": {
6
6
  "type": "git",