modern-canvas 0.4.11 → 0.4.13
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/index.cjs +81 -111
- package/dist/index.d.cts +14 -60
- package/dist/index.d.mts +14 -60
- package/dist/index.d.ts +14 -60
- package/dist/index.js +31 -31
- package/dist/index.mjs +82 -112
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Font } from 'modern-font';
|
|
|
2
2
|
import { AnimationItem } from 'lottie-web';
|
|
3
3
|
import { AnyColor, Colord } from 'colord';
|
|
4
4
|
import { Path2D, LineCap, LineJoin, LineStyle } from 'modern-path2d';
|
|
5
|
-
import {
|
|
5
|
+
import { StyleDeclaration, ImageSource, ImageSourceRect } from 'modern-idoc';
|
|
6
6
|
import { Node as Node$1, Direction } from 'yoga-layout/load';
|
|
7
7
|
import { TextOptions, Text, MeasureResult } from 'modern-text';
|
|
8
8
|
|
|
@@ -1672,6 +1672,8 @@ declare class Node extends CoreObject {
|
|
|
1672
1672
|
clearMeta(): void;
|
|
1673
1673
|
canProcess(): boolean;
|
|
1674
1674
|
canRender(): boolean;
|
|
1675
|
+
protected _update(changed: Map<PropertyKey, any>): void;
|
|
1676
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1675
1677
|
protected _onTreeEnter(tree: SceneTree): void;
|
|
1676
1678
|
protected _onTreeExit(oldTree: SceneTree): void;
|
|
1677
1679
|
protected _onParented(parent: Node): void;
|
|
@@ -1862,14 +1864,14 @@ declare class Transition extends Effect {
|
|
|
1862
1864
|
constructor(properties?: Partial<TransitionProperties>, children?: Node[]);
|
|
1863
1865
|
}
|
|
1864
1866
|
|
|
1865
|
-
interface BaseElement2DStyleProperties extends
|
|
1867
|
+
interface BaseElement2DStyleProperties extends Omit<StyleDeclaration, 'left' | 'top' | 'width' | 'height' | 'backgroundColor' | 'borderColor' | 'outlineColor'> {
|
|
1868
|
+
left: number;
|
|
1869
|
+
top: number;
|
|
1870
|
+
width: number;
|
|
1871
|
+
height: number;
|
|
1866
1872
|
backgroundColor: 'none' | ColorValue;
|
|
1867
|
-
maskImage: 'none' | string;
|
|
1868
1873
|
borderColor: 'none' | ColorValue;
|
|
1869
|
-
outlineWidth: number;
|
|
1870
|
-
outlineOffset: number;
|
|
1871
1874
|
outlineColor: 'none' | ColorValue;
|
|
1872
|
-
outlineStyle: string;
|
|
1873
1875
|
}
|
|
1874
1876
|
interface BaseElement2DStyle extends BaseElement2DStyleProperties {
|
|
1875
1877
|
}
|
|
@@ -1986,56 +1988,7 @@ declare class Element2D extends BaseElement2D {
|
|
|
1986
1988
|
protected _updateStyleProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1987
1989
|
}
|
|
1988
1990
|
|
|
1989
|
-
|
|
1990
|
-
type FlexDirection = 'column' | 'column-reverse' | 'row' | 'row-reverse';
|
|
1991
|
-
type FlexWrap = 'nowrap' | 'wrap' | 'Wrap-reverse';
|
|
1992
|
-
type Justify = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
|
|
1993
|
-
type Position = 'static' | 'relative' | 'absolute';
|
|
1994
|
-
type BoxSizing = 'border-box' | 'content-box';
|
|
1995
|
-
interface LayoutStyleDeclaration {
|
|
1996
|
-
alignContent: Align;
|
|
1997
|
-
alignItems: Align;
|
|
1998
|
-
alignSelf: Align;
|
|
1999
|
-
borderTop: string;
|
|
2000
|
-
borderLeft: string;
|
|
2001
|
-
borderRight: string;
|
|
2002
|
-
borderBottom: string;
|
|
2003
|
-
borderWidth: number;
|
|
2004
|
-
border: string;
|
|
2005
|
-
direction: 'inherit' | 'ltr' | 'rtl';
|
|
2006
|
-
display: 'none' | 'flex' | 'contents';
|
|
2007
|
-
flex: number;
|
|
2008
|
-
flexBasis: number | 'auto' | `${number}%`;
|
|
2009
|
-
flexDirection: FlexDirection;
|
|
2010
|
-
flexGrow: number;
|
|
2011
|
-
flexShrink: number;
|
|
2012
|
-
flexWrap: FlexWrap;
|
|
2013
|
-
height: number | 'auto' | `${number}%`;
|
|
2014
|
-
justifyContent: Justify;
|
|
2015
|
-
gap: number | `${number}%`;
|
|
2016
|
-
marginTop: number | 'auto' | `${number}%`;
|
|
2017
|
-
marginLeft: number | 'auto' | `${number}%`;
|
|
2018
|
-
marginRight: number | 'auto' | `${number}%`;
|
|
2019
|
-
marginBottom: number | 'auto' | `${number}%`;
|
|
2020
|
-
margin: number | 'auto' | `${number}%`;
|
|
2021
|
-
maxHeight: number | `${number}%`;
|
|
2022
|
-
maxWidth: number | `${number}%`;
|
|
2023
|
-
minHeight: number | `${number}%`;
|
|
2024
|
-
minWidth: number | `${number}%`;
|
|
2025
|
-
paddingTop: number | `${number}%`;
|
|
2026
|
-
paddingLeft: number | `${number}%`;
|
|
2027
|
-
paddingRight: number | `${number}%`;
|
|
2028
|
-
paddingBottom: number | `${number}%`;
|
|
2029
|
-
padding: number | `${number}%`;
|
|
2030
|
-
top: number | `${number}%`;
|
|
2031
|
-
bottom: number | `${number}%`;
|
|
2032
|
-
left: number | `${number}%`;
|
|
2033
|
-
right: number | `${number}%`;
|
|
2034
|
-
position: Position;
|
|
2035
|
-
boxSizing: BoxSizing;
|
|
2036
|
-
width: number | 'auto' | `${number}%`;
|
|
2037
|
-
}
|
|
2038
|
-
interface FlexElement2DStyleProperties extends BaseElement2DStyleProperties, LayoutStyleDeclaration {
|
|
1991
|
+
interface FlexElement2DStyleProperties extends BaseElement2DStyleProperties {
|
|
2039
1992
|
}
|
|
2040
1993
|
interface FlexElement2DStyle extends FlexElement2DStyleProperties {
|
|
2041
1994
|
}
|
|
@@ -2121,13 +2074,13 @@ declare class Graphics2D extends Node2D {
|
|
|
2121
2074
|
}
|
|
2122
2075
|
|
|
2123
2076
|
interface Image2DProperties extends Element2DProperties {
|
|
2124
|
-
src:
|
|
2125
|
-
srcRect:
|
|
2077
|
+
src: ImageSource;
|
|
2078
|
+
srcRect: ImageSourceRect;
|
|
2126
2079
|
gif: boolean;
|
|
2127
2080
|
}
|
|
2128
2081
|
declare class Image2D extends Element2D {
|
|
2129
2082
|
texture?: AnimatedTexture;
|
|
2130
|
-
srcRect:
|
|
2083
|
+
srcRect: ImageSourceRect;
|
|
2131
2084
|
src: string;
|
|
2132
2085
|
gif: boolean;
|
|
2133
2086
|
get currentFrameTexture(): Texture2D | undefined;
|
|
@@ -3058,9 +3011,10 @@ interface RenderOptions {
|
|
|
3058
3011
|
data: Record<string, any> | Node | (Node | Record<string, any>)[];
|
|
3059
3012
|
width: number;
|
|
3060
3013
|
height: number;
|
|
3014
|
+
debug?: boolean;
|
|
3061
3015
|
time?: number;
|
|
3062
3016
|
onBeforeRender?: (engine: Engine) => void | Promise<void>;
|
|
3063
3017
|
}
|
|
3064
3018
|
declare function render(options: RenderOptions): Promise<HTMLCanvasElement>;
|
|
3065
3019
|
|
|
3066
|
-
export {
|
|
3020
|
+
export { AnimatedTexture, Animation, type AnimationEffectMode, type AnimationProperties, type AssetHandler, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, type AudioWaveformProperties, BaseElement2D, type BaseElement2DEventMap, type BaseElement2DProperties, BaseElement2DStyle, type BaseElement2DStyleProperties, type Batchable2D, BlurEffect, type CSSFilterKey, type CSSFilters, type CanvasBatchable, CanvasContext, CanvasItem, CanvasItemEditor, type CanvasItemEventMap, type CanvasItemProperties, CanvasTexture, Color, ColorAdjustEffect, ColorFilterEffect, type ColorFilterEffectProperties, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, type ColorValue, type ComputedLayout, Control, type ControlEventMap, type ControlProperties, CoreObject, type CoreObjectEventMap, type CssFunction, type CssFunctionArg, type Cursor, DEG_TO_RAD, DEVICE_PIXEL_RATIO, type Easing, Effect, type EffectContext, EffectMaterial, type EffectMode, type EffectProperties, Element2D, type Element2DEventMap, type Element2DProperties, Element2DStyle, type Element2DStyleProperties, EmbossEffect, Engine, type EngineOptions, EventEmitter, type EventListener, type EventListenerOptions, type EventListenerValue, type FillDraw, type FlexBaseElement2DEventMap, FlexElement2D, type FlexElement2DProperties, FlexElement2DStyle, type FlexElement2DStyleProperties, FlexLayout, FontLoader, GIFLoader, Geometry, type GeometryOptions, GlitchEffect, GodrayEffect, Graphics2D, HTMLAudio, HTMLAudioContext, HTMLSound, type IAudioContext, type IAudioNode, IN_BROWSER, type IPlayOptions, Image2D, type Image2DProperties, type ImageFrame, ImageTexture, type ImageTextureOptions, IndexBuffer, type IndexBufferOptions, Input, InputEvent, type InputEventKey, type InputEventMap, type InternalMode, JSONLoader, KawaseTransition, type Keyframe, LeftEraseTransition, Loader, Lottie2D, type Lottie2DProperties, LottieLoader, MainLoop, type MainLoopEventMap, type MaskColor, type MaskData, MaskEffect, type MaskEffectProperties, type MaskObject, type MaskRect, type Maskable, Material, type MaterialOptions, Matrix, Matrix2, Matrix3, Matrix4, type MatrixLike, type MatrixOperateOutput, MouseInputEvent, Node, Node2D, type Node2DProperties, type NodeEventMap, type NodeProperties, type NormalizedKeyframe, PI, PI_2, PixelateEffect, PixelsTexture, type PlatformAudio, type PlatformSound, PointerInputEvent, type ProcessMode, Projection2D, type PropertyDeclaration, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Range, type RangeProperties, RawWeakMap, Rect2, type Rectangulable, type RectangulableEventMap, RefCounted, type RefCountedEventMap, type RenderMode, type RenderOptions, type Renderable, Renderer, Resource, type ResourceEventMap, Ruler, type RulerProperties, 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, Scaler, type ScalerEventMap, type ScalerProperties, SceneTree, type SceneTreeEventMap, ScrollBar, type ScrollBarProperties, ShadowEffect, type StrokeDraw, Text2D, type Text2DProperties, TextLoader, Texture2D, type Texture2DFilterMode, type Texture2DPixelsSource, type Texture2DSource, type Texture2DWrapMode, TextureLoader, TextureRect2D, type TextureRect2DProperties, Ticker, TiltShiftTransition, Timeline, type TimelineEventMap, TimelineNode, type TimelineNodeEventMap, type TimelineNodeProperties, type TimelineProperties, type TimingFunctions, Transform2D, type Transform2DObject, TransformRect2D, type TransformRect2DProperties, Transition, type TransitionProperties, TwistTransition, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, type VectorLike, type VectorOperateOutput, VertexAttribute, type VertexAttributeOptions, VertexBuffer, type VertexBufferOptions, Video2D, type Video2DProperties, VideoLoader, VideoTexture, type VideoTextureOptions, type VideoTextureSource, Viewport, type ViewportEventMap, 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, XScrollBar, type XScrollBarProperties, YScrollBar, type YScrollBarProperties, ZoomBlurEffect, assets, clamp, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curves, customNode, customNodes, defaultOptions, defineProperty, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, getDeclarations, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCSSFilter, parseCSSTransform, parseCSSTransformOrigin, parseCssFunctions, parseCssProperty, property, protectedProperty, render, timingFunctions, uid };
|