@yft-design/engine 0.0.55 → 0.0.56
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.
- package/dist/core/psdEffects.d.ts +10 -1
- package/dist/index.js +47 -47
- package/dist/model/textTransform.d.ts +5 -0
- package/dist/render/SourceManager.d.ts +6 -1
- package/dist/render/TextRenderer.d.ts +4 -0
- package/dist/render/imageEffects.d.ts +3 -2
- package/dist/render/patternSource.d.ts +8 -0
- package/dist/render/psdEffectPainter.d.ts +3 -1
- package/package.json +1 -1
|
@@ -4,6 +4,11 @@ export declare const textTransformKindOf: (raw: {
|
|
|
4
4
|
textTransform?: unknown;
|
|
5
5
|
type?: unknown;
|
|
6
6
|
}) => TextTransformKind | null;
|
|
7
|
+
export declare const DEFORMED_TEXT_KINDS: ReadonlySet<TextTransformKind>;
|
|
8
|
+
export declare const isDeformedTextRaw: (raw: {
|
|
9
|
+
textTransform?: unknown;
|
|
10
|
+
type?: unknown;
|
|
11
|
+
}) => boolean;
|
|
7
12
|
export type WarpTransformKind = 'arch' | 'waist' | 'flag';
|
|
8
13
|
export declare const warpTextKindOf: (raw: {
|
|
9
14
|
textTransform?: unknown;
|
|
@@ -2,6 +2,7 @@ import { AnimatedNode, MaskNode, type SceneNode } from '../model/scene';
|
|
|
2
2
|
import type { EngineDocument } from '../model/document';
|
|
3
3
|
import { type AnimatedSourceDecoder } from '../decoders/animatedImage';
|
|
4
4
|
import { GLTextureCache } from './GLTextureCache';
|
|
5
|
+
import { type PatternSourceReadiness } from './patternSource';
|
|
5
6
|
export interface SourceHost {
|
|
6
7
|
readonly gl: WebGL2RenderingContext;
|
|
7
8
|
readonly textures: GLTextureCache;
|
|
@@ -9,9 +10,11 @@ export interface SourceHost {
|
|
|
9
10
|
requestRenderAll: () => void;
|
|
10
11
|
decodeAnimated?: AnimatedSourceDecoder | null;
|
|
11
12
|
}
|
|
12
|
-
export declare class SourceManager {
|
|
13
|
+
export declare class SourceManager implements PatternSourceReadiness {
|
|
13
14
|
private readonly host;
|
|
14
15
|
private readonly patternSources;
|
|
16
|
+
private readonly patternLoads;
|
|
17
|
+
private readonly patternFailed;
|
|
15
18
|
private readonly gifSprites;
|
|
16
19
|
private readonly animatedNodes;
|
|
17
20
|
private readonly pendingImageNodes;
|
|
@@ -29,6 +32,8 @@ export declare class SourceManager {
|
|
|
29
32
|
private readonly dynamicClipMasks;
|
|
30
33
|
releaseAnimatedNode(node: AnimatedNode): void;
|
|
31
34
|
loadPatternSources(nodes: SceneNode[]): Promise<void>;
|
|
35
|
+
private loadPatternSource;
|
|
36
|
+
patternSourcesReady(srcs: readonly string[]): boolean;
|
|
32
37
|
patternTexture(src: string): {
|
|
33
38
|
tex: WebGLTexture;
|
|
34
39
|
w: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Mat } from '../core/mat2d';
|
|
2
2
|
import type { PsdTextWarpParams } from '../core/warpMesh';
|
|
3
3
|
import type { SceneNode, TextNode } from '../model/scene';
|
|
4
|
+
import type { PatternSourceReadiness } from './patternSource';
|
|
4
5
|
import { GlyphAtlas } from './GlyphAtlas';
|
|
5
6
|
import { QuadBatch } from './QuadBatch';
|
|
6
7
|
import { type WarpKind } from './warpText';
|
|
@@ -17,7 +18,10 @@ export declare class TextRenderer {
|
|
|
17
18
|
private scrollBakes;
|
|
18
19
|
private highlightBakes;
|
|
19
20
|
private pathBgBakes;
|
|
21
|
+
private patternSources;
|
|
20
22
|
constructor(gl: WebGL2RenderingContext, batch: QuadBatch, glyphAtlas: GlyphAtlas);
|
|
23
|
+
attachPatternSources(patterns: PatternSourceReadiness | null): void;
|
|
24
|
+
private patternSourcesPending;
|
|
21
25
|
invalidateNodeBakes(node: SceneNode): void;
|
|
22
26
|
renderWarpedText(node: TextNode, kind: WarpKind): void;
|
|
23
27
|
renderPsdWarpedText(node: TextNode, params: PsdTextWarpParams): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { GradientDecl } from '../core/gradient';
|
|
2
|
-
import type { PsdBevelDecl, PsdDropShadowDecl,
|
|
2
|
+
import type { PsdBevelDecl, PsdDropShadowDecl, PsdFillDecl, PsdInnerShadowDecl, PsdStrokeDecl } from '../core/psdEffects';
|
|
3
|
+
import { type PatternImageResolver } from './patternSource';
|
|
3
4
|
import { type SceneNode, type SourceRect, type TextNode } from '../model/scene';
|
|
4
5
|
export declare const STROKE_BAKE_PIXEL_BUDGET = 600000;
|
|
5
6
|
export declare const strokeSupersampleCap: (node: SceneNode) => number;
|
|
@@ -17,7 +18,7 @@ export interface PsdShadowBake {
|
|
|
17
18
|
}
|
|
18
19
|
export declare const bakePsdShadow: (node: SceneNode, decls: PsdDropShadowDecl[], source: CanvasImageSource, rasterScale?: number, sourceRect?: SourceRect | null) => PsdShadowBake | null;
|
|
19
20
|
export declare const makeStrokeGradientSampler: (decl: GradientDecl, dimsW: number, dimsH: number, padT: number) => ((x: number, y: number) => [number, number, number, number]) | null;
|
|
20
|
-
export declare const bakePsdSolidFill: (node: SceneNode, decl:
|
|
21
|
+
export declare const bakePsdSolidFill: (node: SceneNode, decl: PsdFillDecl, source: CanvasImageSource, rasterScale?: number, sourceRect?: SourceRect | null, patternImageOf?: PatternImageResolver) => HTMLCanvasElement | null;
|
|
21
22
|
export declare const bakePathEffectShadow: (node: SceneNode, decls: PsdDropShadowDecl[]) => PsdShadowBake | null;
|
|
22
23
|
export declare const buildPathFxSource: (node: SceneNode, rs?: number) => HTMLCanvasElement | null;
|
|
23
24
|
export declare const bakePsdInnerShadow: (node: SceneNode, decl: PsdInnerShadowDecl, source: CanvasImageSource, rasterScale?: number, sourceRect?: SourceRect | null) => HTMLCanvasElement | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type PatternImageResolver = (src: string) => CanvasImageSource | null;
|
|
2
|
+
export interface PatternSourceReadiness {
|
|
3
|
+
patternSourcesReady(srcs: readonly string[]): boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const registerPatternImage: (src: string, img: HTMLImageElement) => void;
|
|
6
|
+
export declare const registeredPatternImage: (src: string) => HTMLImageElement | null;
|
|
7
|
+
export declare const defaultPatternImageOf: PatternImageResolver;
|
|
8
|
+
export declare const clearRegisteredPatternImages: () => void;
|
|
@@ -2,6 +2,7 @@ import { TextNode, type SceneNode } from '../model/scene';
|
|
|
2
2
|
import { type PuzzleBox } from './puzzleClamp';
|
|
3
3
|
import { SettleScheduler } from './settleScheduler';
|
|
4
4
|
import type { SharedGpuPainters } from './sharedGpuPainters';
|
|
5
|
+
import type { PatternSourceReadiness } from './patternSource';
|
|
5
6
|
import type { FrameState, SceneRendererHost } from './SceneRenderer';
|
|
6
7
|
export declare const FX_BAKE_BUDGET_MS = 6;
|
|
7
8
|
export { FX_SETTLE_MS } from './settleScheduler';
|
|
@@ -15,7 +16,8 @@ export declare class PsdEffectPainter {
|
|
|
15
16
|
private readonly settle;
|
|
16
17
|
private readonly blendComposite;
|
|
17
18
|
private readonly cpuTexes;
|
|
18
|
-
|
|
19
|
+
private readonly patterns;
|
|
20
|
+
constructor(host: SceneRendererHost, frame: FrameState, gpu: SharedGpuPainters, getPuzzleBox: () => PuzzleBox | null, settle?: SettleScheduler, blendComposite?: (mode: number, draw: () => void) => void, patterns?: PatternSourceReadiness | null);
|
|
19
21
|
noteVptScaleChange(): void;
|
|
20
22
|
render(node: SceneNode, phase: 'below' | 'above'): void;
|
|
21
23
|
private renderPsdBakeQuads;
|