modern-canvas 0.1.1 → 0.1.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.
- package/README.md +1 -0
- package/dist/index.cjs +45 -72
- package/dist/index.d.cts +14 -58
- package/dist/index.d.mts +14 -58
- package/dist/index.d.ts +14 -58
- package/dist/index.js +40 -40
- package/dist/index.mjs +47 -73
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Visibility, Overflow,
|
|
1
|
+
import { Visibility, Overflow, IDOCTextStyleDeclaration, IDOCTransformStyleDeclaration } from 'modern-idoc';
|
|
2
2
|
import { AnyColor, Colord } from 'colord';
|
|
3
3
|
import { AnimationItem } from 'lottie-web';
|
|
4
|
-
import { MeasureResult } from 'modern-text';
|
|
4
|
+
import { TextOptions, Text, MeasureResult } from 'modern-text';
|
|
5
5
|
import { Font } from 'modern-font';
|
|
6
6
|
|
|
7
7
|
interface CssFunctionArg {
|
|
@@ -1846,7 +1846,7 @@ declare class CanvasContext {
|
|
|
1846
1846
|
toBatchables(): CanvasBatchable[];
|
|
1847
1847
|
}
|
|
1848
1848
|
|
|
1849
|
-
interface Style2DOptions extends Partial<Style2DBackgroundProperties>, Partial<Style2DFilterProperties>, Partial<
|
|
1849
|
+
interface Style2DOptions extends Partial<Style2DBackgroundProperties>, Partial<Style2DFilterProperties>, Partial<Style2DTextProperties>, Partial<Style2DTransformProperties> {
|
|
1850
1850
|
shadowColor?: string;
|
|
1851
1851
|
shadowOffsetX?: number;
|
|
1852
1852
|
shadowOffsetY?: number;
|
|
@@ -1855,7 +1855,7 @@ interface Style2DOptions extends Partial<Style2DBackgroundProperties>, Partial<S
|
|
|
1855
1855
|
borderRadius?: number;
|
|
1856
1856
|
overflow?: Overflow;
|
|
1857
1857
|
}
|
|
1858
|
-
interface Style2D extends Style2DBackgroundExtend, Style2DFilterExtend,
|
|
1858
|
+
interface Style2D extends Style2DBackgroundExtend, Style2DFilterExtend, Style2DTextExtend, Style2DTransformExtend {
|
|
1859
1859
|
}
|
|
1860
1860
|
declare class Style2D extends _Object {
|
|
1861
1861
|
shadowColor: string;
|
|
@@ -1900,45 +1900,8 @@ declare class Style2DFilterModule extends Style2DModule {
|
|
|
1900
1900
|
declare function getComputedFilter(this: Style2D): Style2DFilter;
|
|
1901
1901
|
declare function getComputedFilterColorMatrix(this: Style2D): ColorMatrix;
|
|
1902
1902
|
|
|
1903
|
-
interface
|
|
1904
|
-
offsetPath?: string;
|
|
1905
|
-
offsetAnchor?: string | number;
|
|
1906
|
-
offsetDistance?: string | number;
|
|
1907
|
-
offsetPosition?: string | number;
|
|
1908
|
-
}
|
|
1909
|
-
interface Style2DOffsetExtend extends Style2DOffsetProperties {
|
|
1910
|
-
getComputedOffset: typeof getComputedOffset;
|
|
1911
|
-
}
|
|
1912
|
-
declare module '../Style2D' {
|
|
1913
|
-
interface Style2DOptions extends Partial<Style2DOffsetProperties> {
|
|
1914
|
-
}
|
|
1915
|
-
interface Style2D extends Style2DOffsetProperties {
|
|
1916
|
-
getComputedOffset: typeof getComputedOffset;
|
|
1917
|
-
}
|
|
1918
|
-
}
|
|
1919
|
-
declare class Style2DOffsetModule extends Style2DModule {
|
|
1920
|
-
install(Style2D: new () => Style2D): void;
|
|
1921
|
-
}
|
|
1922
|
-
declare function getComputedOffset(this: Style2D): void;
|
|
1923
|
-
|
|
1924
|
-
interface Style2DTextProperties {
|
|
1925
|
-
color: string;
|
|
1926
|
-
fontSize: number;
|
|
1927
|
-
fontWeight: FontWeight;
|
|
1928
|
-
fontFamily: string;
|
|
1929
|
-
fontStyle: FontStyle;
|
|
1930
|
-
fontKerning: FontKerning;
|
|
1931
|
-
textWrap: TextWrap;
|
|
1932
|
-
textAlign: TextAlign;
|
|
1933
|
-
verticalAlign: VerticalAlign;
|
|
1934
|
-
textTransform: TextTransform;
|
|
1935
|
-
textDecoration: TextDecoration | null;
|
|
1936
|
-
textStrokeWidth: number;
|
|
1937
|
-
textStrokeColor: string;
|
|
1903
|
+
interface Style2DTextProperties extends IDOCTextStyleDeclaration {
|
|
1938
1904
|
direction: 'inherit' | 'ltr' | 'rtl';
|
|
1939
|
-
lineHeight: number;
|
|
1940
|
-
letterSpacing: number;
|
|
1941
|
-
writingMode: WritingMode;
|
|
1942
1905
|
}
|
|
1943
1906
|
interface Style2DTextExtend extends Style2DTextProperties {
|
|
1944
1907
|
}
|
|
@@ -1946,16 +1909,7 @@ declare class Style2DTextModule extends Style2DModule {
|
|
|
1946
1909
|
install(Style2D: new () => Style2D): void;
|
|
1947
1910
|
}
|
|
1948
1911
|
|
|
1949
|
-
interface Style2DTransformProperties {
|
|
1950
|
-
left: number;
|
|
1951
|
-
top: number;
|
|
1952
|
-
width: number;
|
|
1953
|
-
height: number;
|
|
1954
|
-
rotate: number;
|
|
1955
|
-
scaleX: number;
|
|
1956
|
-
scaleY: number;
|
|
1957
|
-
transform?: string;
|
|
1958
|
-
transformOrigin: string;
|
|
1912
|
+
interface Style2DTransformProperties extends IDOCTransformStyleDeclaration {
|
|
1959
1913
|
}
|
|
1960
1914
|
interface Style2DTransformExtend extends Style2DTransformProperties {
|
|
1961
1915
|
getComputedTransform: typeof getComputedTransform;
|
|
@@ -2113,11 +2067,9 @@ declare class Lottie2D extends Node2D {
|
|
|
2113
2067
|
protected _drawContent(): void;
|
|
2114
2068
|
}
|
|
2115
2069
|
|
|
2116
|
-
interface Text2DOptions extends Node2DOptions {
|
|
2070
|
+
interface Text2DOptions extends Node2DOptions, Omit<TextOptions, 'style'> {
|
|
2117
2071
|
pixelRatio?: number;
|
|
2118
2072
|
split?: boolean;
|
|
2119
|
-
content?: IDOCTextContent;
|
|
2120
|
-
effects?: Partial<IDOCStyleDeclaration>[];
|
|
2121
2073
|
}
|
|
2122
2074
|
/**
|
|
2123
2075
|
* @example
|
|
@@ -2132,12 +2084,16 @@ interface Text2DOptions extends Node2DOptions {
|
|
|
2132
2084
|
declare class Text2D extends Node2D {
|
|
2133
2085
|
pixelRatio: number;
|
|
2134
2086
|
split: boolean;
|
|
2135
|
-
content:
|
|
2136
|
-
effects?:
|
|
2087
|
+
content: TextOptions['content'];
|
|
2088
|
+
effects?: TextOptions['effects'];
|
|
2089
|
+
measureDom?: TextOptions['measureDom'];
|
|
2090
|
+
fonts?: TextOptions['fonts'];
|
|
2091
|
+
text: Text;
|
|
2137
2092
|
readonly texture: Texture<HTMLCanvasElement>;
|
|
2138
2093
|
protected _subTextsCount: number;
|
|
2139
2094
|
constructor(options?: Text2DOptions);
|
|
2140
2095
|
protected _onUpdateProperty(key: PropertyKey, value: any, oldValue: any): void;
|
|
2096
|
+
protected _updateText(): void;
|
|
2141
2097
|
protected _onUpdateStyleProperty(key: PropertyKey, value: any, oldValue: any): void;
|
|
2142
2098
|
protected _getSubTexts(): Text2D[];
|
|
2143
2099
|
protected _updateSubTexts(): void;
|
|
@@ -3112,4 +3068,4 @@ interface RenderOptions {
|
|
|
3112
3068
|
}
|
|
3113
3069
|
declare function render(options: RenderOptions): Promise<HTMLCanvasElement>;
|
|
3114
3070
|
|
|
3115
|
-
export { Animation2D, type AnimationOptions, type AssetHandler, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, type AudioWaveformOptions, type Batchable2D, BlurEffect, Bounds, type BoundsData, type CanvasBatchable, CanvasContext, CanvasItem, type CanvasItemOptions, Circle, Color, ColorAdjustEffect, ColorFilterEffect, type ColorFilterEffectOptions, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, type ColorValue, type CssFunction, type CssFunctionArg, type Cursor, type CustomNodeOptions, DEG_TO_RAD, DEVICE_PIXEL_RATIO, type Easing, Effect, type EffectContext, EffectMaterial, type EffectMode, type EffectOptions, Ellipse, EmbossEffect, Engine, type EngineOptions, EventEmitter, type EventListener, type EventListenerOptions, type EventListenerValue, type FilledGraphics, FontLoader, Geometry, type GeometryOptions, GifLoader, GlitchEffect, GodrayEffect, Graphics2D, HTMLAudio, HTMLAudioContext, HTMLSound, type IAudioContext, type IAudioNode, IN_BROWSER, type IPlayOptions, Image2D, type Image2DOptions, Image2DResource, type ImageFrame, ImageTexture, type ImageTextureOptions, IndexBuffer, type IndexBufferOptions, Input, InternalMode, JsonLoader, KawaseEffect, type Keyframe, LeftEraseEffect, type LineCap, type LineJoin, type LineStyle, Loader, Lottie2D, LottieLoader, type LottieOptions, MainLoop, type MainLoopEventMap, type MaskColor, type MaskData, MaskEffect, type MaskEffectOptions, type MaskObject, type MaskRect, type Maskable, Material, type MaterialOptions, Matrix, Matrix2, Matrix3, Matrix4, type MatrixLike, type MatrixOperateOutput, MouseInputEvent, Node, Node2D, type Node2DOptions, type NodeEventMap, type NodeOptions, type NormalizedKeyframe, PI, PI_2, Path2D, type Path2DCall, type Path2DCallMethod, type Path2DShape, PixelateEffect, PixelsTexture, type PlatformAudio, type PlatformSound, Point, type PointData, type PointLike, PointerInputEvent, Polygon, Projection2D, type PropertyDeclaration, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Rectangle, Reference, type ReferenceEventMap, type RenderCall, type RenderOptions, RenderStack, type Renderable, Renderer, Resource, type ResourceEventMap, RoundedRectangle, SUPPORTS_AUDIO_CONTEXT, SUPPORTS_CLICK_EVENTS, SUPPORTS_CREATE_IMAGE_BITMAP, SUPPORTS_IMAGE_BITMAP, SUPPORTS_MOUSE_EVENTS, SUPPORTS_OFFLINE_AUDIO_CONTEXT, SUPPORTS_POINTER_EVENTS, SUPPORTS_RESIZE_OBSERVER, SUPPORTS_TOUCH_EVENTS, SUPPORTS_WEBGL2, SUPPORTS_WEBKIT_AUDIO_CONTEXT, SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, SUPPORTS_WEB_AUDIO, SUPPORTS_WHEEL_EVENTS, SVGPath, type SVGPathDefine, type SVGPathDefineCommand, SceneTree, type SceneTreeEventMap, type Shape, type ShapeBuildCommand, Star, type StrokedGraphics, Style2D, type Style2DBackgroundExtend, Style2DBackgroundModule, type Style2DBackgroundProperties, type Style2DFilter, type Style2DFilterExtend, type Style2DFilterKey, Style2DFilterModule, type Style2DFilterProperties, Style2DModule, type
|
|
3071
|
+
export { Animation2D, type AnimationOptions, type AssetHandler, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, type AudioWaveformOptions, type Batchable2D, BlurEffect, Bounds, type BoundsData, type CanvasBatchable, CanvasContext, CanvasItem, type CanvasItemOptions, Circle, Color, ColorAdjustEffect, ColorFilterEffect, type ColorFilterEffectOptions, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, type ColorValue, type CssFunction, type CssFunctionArg, type Cursor, type CustomNodeOptions, DEG_TO_RAD, DEVICE_PIXEL_RATIO, type Easing, Effect, type EffectContext, EffectMaterial, type EffectMode, type EffectOptions, Ellipse, EmbossEffect, Engine, type EngineOptions, EventEmitter, type EventListener, type EventListenerOptions, type EventListenerValue, type FilledGraphics, FontLoader, Geometry, type GeometryOptions, GifLoader, GlitchEffect, GodrayEffect, Graphics2D, HTMLAudio, HTMLAudioContext, HTMLSound, type IAudioContext, type IAudioNode, IN_BROWSER, type IPlayOptions, Image2D, type Image2DOptions, Image2DResource, type ImageFrame, ImageTexture, type ImageTextureOptions, IndexBuffer, type IndexBufferOptions, Input, InternalMode, JsonLoader, KawaseEffect, type Keyframe, LeftEraseEffect, type LineCap, type LineJoin, type LineStyle, Loader, Lottie2D, LottieLoader, type LottieOptions, MainLoop, type MainLoopEventMap, type MaskColor, type MaskData, MaskEffect, type MaskEffectOptions, type MaskObject, type MaskRect, type Maskable, Material, type MaterialOptions, Matrix, Matrix2, Matrix3, Matrix4, type MatrixLike, type MatrixOperateOutput, MouseInputEvent, Node, Node2D, type Node2DOptions, type NodeEventMap, type NodeOptions, type NormalizedKeyframe, PI, PI_2, Path2D, type Path2DCall, type Path2DCallMethod, type Path2DShape, PixelateEffect, PixelsTexture, type PlatformAudio, type PlatformSound, Point, type PointData, type PointLike, PointerInputEvent, Polygon, Projection2D, type PropertyDeclaration, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Rectangle, Reference, type ReferenceEventMap, type RenderCall, type RenderOptions, RenderStack, type Renderable, Renderer, Resource, type ResourceEventMap, RoundedRectangle, SUPPORTS_AUDIO_CONTEXT, SUPPORTS_CLICK_EVENTS, SUPPORTS_CREATE_IMAGE_BITMAP, SUPPORTS_IMAGE_BITMAP, SUPPORTS_MOUSE_EVENTS, SUPPORTS_OFFLINE_AUDIO_CONTEXT, SUPPORTS_POINTER_EVENTS, SUPPORTS_RESIZE_OBSERVER, SUPPORTS_TOUCH_EVENTS, SUPPORTS_WEBGL2, SUPPORTS_WEBKIT_AUDIO_CONTEXT, SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, SUPPORTS_WEB_AUDIO, SUPPORTS_WHEEL_EVENTS, SVGPath, type SVGPathDefine, type SVGPathDefineCommand, SceneTree, type SceneTreeEventMap, type Shape, type ShapeBuildCommand, Star, type StrokedGraphics, Style2D, type Style2DBackgroundExtend, Style2DBackgroundModule, type Style2DBackgroundProperties, type Style2DFilter, type Style2DFilterExtend, type Style2DFilterKey, Style2DFilterModule, type Style2DFilterProperties, Style2DModule, type Style2DOptions, type Style2DTextExtend, Style2DTextModule, type Style2DTextProperties, type Style2DTransformExtend, Style2DTransformModule, type Style2DTransformProperties, Text2D, type Text2DOptions, TextLoader, Texture, type TextureFilterMode, TextureLoader, type TexturePixelsSource, type TextureSource, type TextureWrapMode, Ticker, TiltShiftEffect, Timer, type TimerEventMap, type TimerOptions, type TimingFunctions, Transform2D, type Transform2DObject, Triangle, TwistEffect, UIInputEvent, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, type VectorLike, type VectorOperateOutput, VertexAttribute, type VertexAttributeOptions, VertexBuffer, type VertexBufferOptions, Video2D, type Video2DOptions, VideoLoader, VideoTexture, type VideoTextureOptions, type VideoTextureSource, Viewport, type ViewportFramebuffer, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, type WebGLBufferMeta, WebGLBufferModule, type WebGLBufferOptions, type WebGLBufferTarget, type WebGLBufferUsage, type WebGLDrawMode, type WebGLDrawOptions, type WebGLExtensions, type WebGLFramebufferMeta, WebGLFramebufferModule, type WebGLFramebufferOptions, WebGLMaskModule, WebGLModule, type WebGLProgramMeta, WebGLProgramModule, type WebGLProgramOptions, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, type WebGLTarget, type WebGLTextureFilterMode, type WebGLTextureLocation, type WebGLTextureMeta, WebGLTextureModule, type WebGLTextureOptions, type WebGLTextureSource, type WebGLTextureTarget, type WebGLTextureWrapMode, WebGLVertexArrayModule, type WebGLVertexArrayObjectMeta, type WebGLVertexArrayObjectOptions, type WebGLVertexAttrib, type WebGLVertexAttribType, type WebGLViewport, WebGLViewportModule, WebSound, WheelInputEvent, ZoomBlurEffect, _Object, type _ObjectEventMap, assets, buildAdaptiveBezier, buildAdaptiveQuadratic, buildArc, buildArcTo, buildArcToSvg, buildCircle, buildLine, buildPolygon, buildRectangle, buildTriangle, clamp, closePointEps, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curveEps, curves, customNode, customNodes, defaultOptions, defineProperty, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, getDeclarations, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCssFunctions, parseCssProperty, property, protectedProperty, render, squaredDistanceToLineSegment, timingFunctions, uid };
|