modern-canvas 0.4.12 → 0.4.14
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 +62 -100
- package/dist/index.d.cts +11 -60
- package/dist/index.d.mts +11 -60
- package/dist/index.d.ts +11 -60
- package/dist/index.js +31 -31
- package/dist/index.mjs +63 -101
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -8642,38 +8642,20 @@ class BaseElement2DStyle extends Resource {
|
|
|
8642
8642
|
return this._backgroundColor;
|
|
8643
8643
|
}
|
|
8644
8644
|
async loadBackgroundImage() {
|
|
8645
|
-
if (this.backgroundImage !== "none") {
|
|
8645
|
+
if (this.backgroundImage && this.backgroundImage !== "none") {
|
|
8646
8646
|
return await assets.texture.load(this.backgroundImage);
|
|
8647
8647
|
}
|
|
8648
8648
|
}
|
|
8649
8649
|
}
|
|
8650
|
-
const defaultStyles$
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
borderWidth: 0,
|
|
8660
|
-
borderRadius: 0,
|
|
8661
|
-
borderColor: "#000000",
|
|
8662
|
-
borderStyle: "none",
|
|
8663
|
-
outlineWidth: 0,
|
|
8664
|
-
outlineOffset: 0,
|
|
8665
|
-
outlineColor: "#000000",
|
|
8666
|
-
outlineStyle: "none",
|
|
8667
|
-
visibility: "visible",
|
|
8668
|
-
overflow: "visible",
|
|
8669
|
-
pointerEvents: "auto"
|
|
8670
|
-
};
|
|
8671
|
-
delete defaultStyles$2.top;
|
|
8672
|
-
delete defaultStyles$2.left;
|
|
8673
|
-
delete defaultStyles$2.width;
|
|
8674
|
-
delete defaultStyles$2.height;
|
|
8675
|
-
for (const key in defaultStyles$2) {
|
|
8676
|
-
defineProperty(BaseElement2DStyle, key, { default: defaultStyles$2[key] });
|
|
8650
|
+
const defaultStyles$1 = modernIdoc.getDefaultStyle();
|
|
8651
|
+
delete defaultStyles$1.top;
|
|
8652
|
+
delete defaultStyles$1.left;
|
|
8653
|
+
delete defaultStyles$1.width;
|
|
8654
|
+
delete defaultStyles$1.height;
|
|
8655
|
+
for (const key in defaultStyles$1) {
|
|
8656
|
+
defineProperty(BaseElement2DStyle, key, {
|
|
8657
|
+
default: defaultStyles$1[key]
|
|
8658
|
+
});
|
|
8677
8659
|
}
|
|
8678
8660
|
|
|
8679
8661
|
var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
|
|
@@ -9095,14 +9077,14 @@ class Element2DStyle extends BaseElement2DStyle {
|
|
|
9095
9077
|
this.setProperties(properties);
|
|
9096
9078
|
}
|
|
9097
9079
|
}
|
|
9098
|
-
const defaultStyles
|
|
9080
|
+
const defaultStyles = {
|
|
9099
9081
|
left: 0,
|
|
9100
9082
|
top: 0,
|
|
9101
9083
|
width: 0,
|
|
9102
9084
|
height: 0
|
|
9103
9085
|
};
|
|
9104
|
-
for (const key in defaultStyles
|
|
9105
|
-
defineProperty(Element2DStyle, key, { default: defaultStyles
|
|
9086
|
+
for (const key in defaultStyles) {
|
|
9087
|
+
defineProperty(Element2DStyle, key, { default: defaultStyles[key] });
|
|
9106
9088
|
}
|
|
9107
9089
|
|
|
9108
9090
|
var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
|
|
@@ -9135,19 +9117,19 @@ exports.Element2D = class Element2D extends exports.BaseElement2D {
|
|
|
9135
9117
|
super._updateStyleProperty(key, value, oldValue, declaration);
|
|
9136
9118
|
switch (key) {
|
|
9137
9119
|
case "left":
|
|
9138
|
-
this.position.x =
|
|
9120
|
+
this.position.x = Number(value);
|
|
9139
9121
|
this.requestRelayout();
|
|
9140
9122
|
break;
|
|
9141
9123
|
case "top":
|
|
9142
|
-
this.position.y =
|
|
9124
|
+
this.position.y = Number(value);
|
|
9143
9125
|
this.requestRelayout();
|
|
9144
9126
|
break;
|
|
9145
9127
|
case "width":
|
|
9146
|
-
this.size.width =
|
|
9128
|
+
this.size.width = Number(value);
|
|
9147
9129
|
this.requestRelayout();
|
|
9148
9130
|
break;
|
|
9149
9131
|
case "height":
|
|
9150
|
-
this.size.height =
|
|
9132
|
+
this.size.height = Number(value);
|
|
9151
9133
|
this.requestRelayout();
|
|
9152
9134
|
break;
|
|
9153
9135
|
}
|
|
@@ -9163,52 +9145,6 @@ class FlexElement2DStyle extends BaseElement2DStyle {
|
|
|
9163
9145
|
this.setProperties(properties);
|
|
9164
9146
|
}
|
|
9165
9147
|
}
|
|
9166
|
-
const defaultStyles = {
|
|
9167
|
-
alignContent: "stretch",
|
|
9168
|
-
alignItems: "stretch",
|
|
9169
|
-
alignSelf: "auto",
|
|
9170
|
-
borderTop: "none",
|
|
9171
|
-
borderLeft: "none",
|
|
9172
|
-
borderRight: "none",
|
|
9173
|
-
borderBottom: "none",
|
|
9174
|
-
borderWidth: 0,
|
|
9175
|
-
border: "none",
|
|
9176
|
-
direction: "inherit",
|
|
9177
|
-
display: "flex",
|
|
9178
|
-
flex: 0,
|
|
9179
|
-
flexBasis: "auto",
|
|
9180
|
-
flexDirection: "row",
|
|
9181
|
-
flexGrow: 0,
|
|
9182
|
-
flexShrink: 1,
|
|
9183
|
-
flexWrap: "nowrap",
|
|
9184
|
-
height: "auto",
|
|
9185
|
-
justifyContent: "flex-start",
|
|
9186
|
-
gap: 0,
|
|
9187
|
-
marginTop: 0,
|
|
9188
|
-
marginLeft: 0,
|
|
9189
|
-
marginRight: 0,
|
|
9190
|
-
marginBottom: 0,
|
|
9191
|
-
margin: 0,
|
|
9192
|
-
maxHeight: 0,
|
|
9193
|
-
maxWidth: 0,
|
|
9194
|
-
minHeight: 0,
|
|
9195
|
-
minWidth: 0,
|
|
9196
|
-
paddingTop: 0,
|
|
9197
|
-
paddingLeft: 0,
|
|
9198
|
-
paddingRight: 0,
|
|
9199
|
-
paddingBottom: 0,
|
|
9200
|
-
padding: 0,
|
|
9201
|
-
top: 0,
|
|
9202
|
-
bottom: 0,
|
|
9203
|
-
left: 0,
|
|
9204
|
-
right: 0,
|
|
9205
|
-
position: "static",
|
|
9206
|
-
boxSizing: "content-box",
|
|
9207
|
-
width: "auto"
|
|
9208
|
-
};
|
|
9209
|
-
for (const key in defaultStyles) {
|
|
9210
|
-
defineProperty(FlexElement2DStyle, key, { default: defaultStyles[key] });
|
|
9211
|
-
}
|
|
9212
9148
|
|
|
9213
9149
|
const alignMap = {
|
|
9214
9150
|
"auto": load.Align.Auto,
|
|
@@ -9298,13 +9234,19 @@ class FlexLayout {
|
|
|
9298
9234
|
updateStyleProperty(key, value, oldValue, declaration) {
|
|
9299
9235
|
switch (key) {
|
|
9300
9236
|
case "alignContent":
|
|
9301
|
-
this._node.setAlignContent(
|
|
9237
|
+
this._node.setAlignContent(
|
|
9238
|
+
value ? alignMap[value] : alignMap["flex-start"]
|
|
9239
|
+
);
|
|
9302
9240
|
break;
|
|
9303
9241
|
case "alignItems":
|
|
9304
|
-
this._node.setAlignItems(
|
|
9242
|
+
this._node.setAlignItems(
|
|
9243
|
+
value ? alignMap[value] : alignMap["flex-start"]
|
|
9244
|
+
);
|
|
9305
9245
|
break;
|
|
9306
9246
|
case "alignSelf":
|
|
9307
|
-
this._node.setAlignSelf(
|
|
9247
|
+
this._node.setAlignSelf(
|
|
9248
|
+
value ? alignMap[value] : alignMap["flex-start"]
|
|
9249
|
+
);
|
|
9308
9250
|
break;
|
|
9309
9251
|
case "aspectRatio":
|
|
9310
9252
|
this._node.setAspectRatio(value);
|
|
@@ -9325,10 +9267,14 @@ class FlexLayout {
|
|
|
9325
9267
|
this._node.setBorder(load.Edge.All, this._style.borderWidth);
|
|
9326
9268
|
break;
|
|
9327
9269
|
case "direction":
|
|
9328
|
-
this._node.setDirection(
|
|
9270
|
+
this._node.setDirection(
|
|
9271
|
+
value ? directionMap[value] : directionMap.inherit
|
|
9272
|
+
);
|
|
9329
9273
|
break;
|
|
9330
9274
|
case "display":
|
|
9331
|
-
this._node.setDisplay(
|
|
9275
|
+
this._node.setDisplay(
|
|
9276
|
+
value ? displayMap[value] : displayMap.flex
|
|
9277
|
+
);
|
|
9332
9278
|
break;
|
|
9333
9279
|
case "flex":
|
|
9334
9280
|
this._node.setFlex(this._style.flex);
|
|
@@ -9337,7 +9283,9 @@ class FlexLayout {
|
|
|
9337
9283
|
this._node.setFlexBasis(this._style.flexBasis);
|
|
9338
9284
|
break;
|
|
9339
9285
|
case "flexDirection":
|
|
9340
|
-
this._node.setFlexDirection(
|
|
9286
|
+
this._node.setFlexDirection(
|
|
9287
|
+
value ? flexDirectionMap[value] : flexDirectionMap.row
|
|
9288
|
+
);
|
|
9341
9289
|
break;
|
|
9342
9290
|
case "flexGrow":
|
|
9343
9291
|
this._node.setFlexGrow(this._style.flexGrow);
|
|
@@ -9346,37 +9294,41 @@ class FlexLayout {
|
|
|
9346
9294
|
this._node.setFlexShrink(this._style.flexShrink);
|
|
9347
9295
|
break;
|
|
9348
9296
|
case "flexWrap":
|
|
9349
|
-
this._node.setFlexWrap(
|
|
9297
|
+
this._node.setFlexWrap(
|
|
9298
|
+
value ? flexWrapMap[value] : flexWrapMap.wrap
|
|
9299
|
+
);
|
|
9350
9300
|
break;
|
|
9351
9301
|
case "height":
|
|
9352
9302
|
this._node.setHeight(this._style.height);
|
|
9353
9303
|
break;
|
|
9354
9304
|
case "justifyContent":
|
|
9355
|
-
this._node.setJustifyContent(
|
|
9305
|
+
this._node.setJustifyContent(
|
|
9306
|
+
value ? justifyMap[value] : justifyMap["flex-start"]
|
|
9307
|
+
);
|
|
9356
9308
|
break;
|
|
9357
9309
|
case "gap":
|
|
9358
|
-
this._node.setGap(load.Gutter.All,
|
|
9310
|
+
value !== void 0 && this._node.setGap(load.Gutter.All, value);
|
|
9359
9311
|
break;
|
|
9360
9312
|
case "marginTop":
|
|
9361
|
-
this._node.setMargin(load.Edge.Top,
|
|
9313
|
+
this._node.setMargin(load.Edge.Top, value);
|
|
9362
9314
|
break;
|
|
9363
9315
|
case "marginBottom":
|
|
9364
|
-
this._node.setMargin(load.Edge.Top,
|
|
9316
|
+
this._node.setMargin(load.Edge.Top, value);
|
|
9365
9317
|
break;
|
|
9366
9318
|
case "marginLeft":
|
|
9367
|
-
this._node.setMargin(load.Edge.Left,
|
|
9319
|
+
this._node.setMargin(load.Edge.Left, value);
|
|
9368
9320
|
break;
|
|
9369
9321
|
case "marginRight":
|
|
9370
|
-
this._node.setMargin(load.Edge.Top,
|
|
9322
|
+
this._node.setMargin(load.Edge.Top, value);
|
|
9371
9323
|
break;
|
|
9372
9324
|
case "margin":
|
|
9373
|
-
this._node.setMargin(load.Edge.All,
|
|
9325
|
+
this._node.setMargin(load.Edge.All, value);
|
|
9374
9326
|
break;
|
|
9375
9327
|
case "maxHeight":
|
|
9376
|
-
this._node.setMaxHeight(
|
|
9328
|
+
this._node.setMaxHeight(value);
|
|
9377
9329
|
break;
|
|
9378
9330
|
case "maxWidth":
|
|
9379
|
-
this._node.setMaxWidth(
|
|
9331
|
+
this._node.setMaxWidth(value);
|
|
9380
9332
|
break;
|
|
9381
9333
|
// setDirtiedFunc(dirtiedFunc: DirtiedFunction | null): void;
|
|
9382
9334
|
// setMeasureFunc(measureFunc: MeasureFunction | null): void;
|
|
@@ -9387,7 +9339,9 @@ class FlexLayout {
|
|
|
9387
9339
|
this._node.setMinWidth(this._style.minWidth);
|
|
9388
9340
|
break;
|
|
9389
9341
|
case "overflow":
|
|
9390
|
-
this._node.setOverflow(
|
|
9342
|
+
this._node.setOverflow(
|
|
9343
|
+
value ? overflowMap[value] : overflowMap.visible
|
|
9344
|
+
);
|
|
9391
9345
|
break;
|
|
9392
9346
|
case "paddingTop":
|
|
9393
9347
|
this._node.setPadding(load.Edge.Top, this._style.paddingTop);
|
|
@@ -9417,10 +9371,14 @@ class FlexLayout {
|
|
|
9417
9371
|
this._node.setPosition(load.Edge.Right, this._style.right);
|
|
9418
9372
|
break;
|
|
9419
9373
|
case "position":
|
|
9420
|
-
this._node.setPositionType(
|
|
9374
|
+
this._node.setPositionType(
|
|
9375
|
+
value ? positionTypeMap[value] : positionTypeMap.static
|
|
9376
|
+
);
|
|
9421
9377
|
break;
|
|
9422
9378
|
case "boxSizing":
|
|
9423
|
-
this._node.setBoxSizing(
|
|
9379
|
+
this._node.setBoxSizing(
|
|
9380
|
+
value ? boxSizingMap[value] : boxSizingMap["content-box"]
|
|
9381
|
+
);
|
|
9424
9382
|
break;
|
|
9425
9383
|
case "width":
|
|
9426
9384
|
this._node.setWidth(this._style.width);
|
|
@@ -10394,6 +10352,10 @@ exports.Animation = class Animation extends exports.TimelineNode {
|
|
|
10394
10352
|
_getDiffValue(name, previous, current, weight, context) {
|
|
10395
10353
|
let from;
|
|
10396
10354
|
let to;
|
|
10355
|
+
if (previous === "none")
|
|
10356
|
+
previous = void 0;
|
|
10357
|
+
if (current === "none")
|
|
10358
|
+
current = void 0;
|
|
10397
10359
|
if (previous === void 0 || current === void 0) {
|
|
10398
10360
|
if (previous !== void 0) {
|
|
10399
10361
|
from = parseCssProperty(name, String(previous), context);
|
package/dist/index.d.cts
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
|
|
|
@@ -1864,14 +1864,14 @@ declare class Transition extends Effect {
|
|
|
1864
1864
|
constructor(properties?: Partial<TransitionProperties>, children?: Node[]);
|
|
1865
1865
|
}
|
|
1866
1866
|
|
|
1867
|
-
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;
|
|
1868
1872
|
backgroundColor: 'none' | ColorValue;
|
|
1869
|
-
maskImage: 'none' | string;
|
|
1870
1873
|
borderColor: 'none' | ColorValue;
|
|
1871
|
-
outlineWidth: number;
|
|
1872
|
-
outlineOffset: number;
|
|
1873
1874
|
outlineColor: 'none' | ColorValue;
|
|
1874
|
-
outlineStyle: string;
|
|
1875
1875
|
}
|
|
1876
1876
|
interface BaseElement2DStyle extends BaseElement2DStyleProperties {
|
|
1877
1877
|
}
|
|
@@ -1988,56 +1988,7 @@ declare class Element2D extends BaseElement2D {
|
|
|
1988
1988
|
protected _updateStyleProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1989
1989
|
}
|
|
1990
1990
|
|
|
1991
|
-
|
|
1992
|
-
type FlexDirection = 'column' | 'column-reverse' | 'row' | 'row-reverse';
|
|
1993
|
-
type FlexWrap = 'nowrap' | 'wrap' | 'Wrap-reverse';
|
|
1994
|
-
type Justify = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
|
|
1995
|
-
type Position = 'static' | 'relative' | 'absolute';
|
|
1996
|
-
type BoxSizing = 'border-box' | 'content-box';
|
|
1997
|
-
interface LayoutStyleDeclaration {
|
|
1998
|
-
alignContent: Align;
|
|
1999
|
-
alignItems: Align;
|
|
2000
|
-
alignSelf: Align;
|
|
2001
|
-
borderTop: string;
|
|
2002
|
-
borderLeft: string;
|
|
2003
|
-
borderRight: string;
|
|
2004
|
-
borderBottom: string;
|
|
2005
|
-
borderWidth: number;
|
|
2006
|
-
border: string;
|
|
2007
|
-
direction: 'inherit' | 'ltr' | 'rtl';
|
|
2008
|
-
display: 'none' | 'flex' | 'contents';
|
|
2009
|
-
flex: number;
|
|
2010
|
-
flexBasis: number | 'auto' | `${number}%`;
|
|
2011
|
-
flexDirection: FlexDirection;
|
|
2012
|
-
flexGrow: number;
|
|
2013
|
-
flexShrink: number;
|
|
2014
|
-
flexWrap: FlexWrap;
|
|
2015
|
-
height: number | 'auto' | `${number}%`;
|
|
2016
|
-
justifyContent: Justify;
|
|
2017
|
-
gap: number | `${number}%`;
|
|
2018
|
-
marginTop: number | 'auto' | `${number}%`;
|
|
2019
|
-
marginLeft: number | 'auto' | `${number}%`;
|
|
2020
|
-
marginRight: number | 'auto' | `${number}%`;
|
|
2021
|
-
marginBottom: number | 'auto' | `${number}%`;
|
|
2022
|
-
margin: number | 'auto' | `${number}%`;
|
|
2023
|
-
maxHeight: number | `${number}%`;
|
|
2024
|
-
maxWidth: number | `${number}%`;
|
|
2025
|
-
minHeight: number | `${number}%`;
|
|
2026
|
-
minWidth: number | `${number}%`;
|
|
2027
|
-
paddingTop: number | `${number}%`;
|
|
2028
|
-
paddingLeft: number | `${number}%`;
|
|
2029
|
-
paddingRight: number | `${number}%`;
|
|
2030
|
-
paddingBottom: number | `${number}%`;
|
|
2031
|
-
padding: number | `${number}%`;
|
|
2032
|
-
top: number | `${number}%`;
|
|
2033
|
-
bottom: number | `${number}%`;
|
|
2034
|
-
left: number | `${number}%`;
|
|
2035
|
-
right: number | `${number}%`;
|
|
2036
|
-
position: Position;
|
|
2037
|
-
boxSizing: BoxSizing;
|
|
2038
|
-
width: number | 'auto' | `${number}%`;
|
|
2039
|
-
}
|
|
2040
|
-
interface FlexElement2DStyleProperties extends BaseElement2DStyleProperties, LayoutStyleDeclaration {
|
|
1991
|
+
interface FlexElement2DStyleProperties extends BaseElement2DStyleProperties {
|
|
2041
1992
|
}
|
|
2042
1993
|
interface FlexElement2DStyle extends FlexElement2DStyleProperties {
|
|
2043
1994
|
}
|
|
@@ -2123,13 +2074,13 @@ declare class Graphics2D extends Node2D {
|
|
|
2123
2074
|
}
|
|
2124
2075
|
|
|
2125
2076
|
interface Image2DProperties extends Element2DProperties {
|
|
2126
|
-
src:
|
|
2127
|
-
srcRect:
|
|
2077
|
+
src: ImageSource;
|
|
2078
|
+
srcRect: ImageSourceRect;
|
|
2128
2079
|
gif: boolean;
|
|
2129
2080
|
}
|
|
2130
2081
|
declare class Image2D extends Element2D {
|
|
2131
2082
|
texture?: AnimatedTexture;
|
|
2132
|
-
srcRect:
|
|
2083
|
+
srcRect: ImageSourceRect;
|
|
2133
2084
|
src: string;
|
|
2134
2085
|
gif: boolean;
|
|
2135
2086
|
get currentFrameTexture(): Texture2D | undefined;
|
|
@@ -3066,4 +3017,4 @@ interface RenderOptions {
|
|
|
3066
3017
|
}
|
|
3067
3018
|
declare function render(options: RenderOptions): Promise<HTMLCanvasElement>;
|
|
3068
3019
|
|
|
3069
|
-
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 };
|
package/dist/index.d.mts
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
|
|
|
@@ -1864,14 +1864,14 @@ declare class Transition extends Effect {
|
|
|
1864
1864
|
constructor(properties?: Partial<TransitionProperties>, children?: Node[]);
|
|
1865
1865
|
}
|
|
1866
1866
|
|
|
1867
|
-
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;
|
|
1868
1872
|
backgroundColor: 'none' | ColorValue;
|
|
1869
|
-
maskImage: 'none' | string;
|
|
1870
1873
|
borderColor: 'none' | ColorValue;
|
|
1871
|
-
outlineWidth: number;
|
|
1872
|
-
outlineOffset: number;
|
|
1873
1874
|
outlineColor: 'none' | ColorValue;
|
|
1874
|
-
outlineStyle: string;
|
|
1875
1875
|
}
|
|
1876
1876
|
interface BaseElement2DStyle extends BaseElement2DStyleProperties {
|
|
1877
1877
|
}
|
|
@@ -1988,56 +1988,7 @@ declare class Element2D extends BaseElement2D {
|
|
|
1988
1988
|
protected _updateStyleProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1989
1989
|
}
|
|
1990
1990
|
|
|
1991
|
-
|
|
1992
|
-
type FlexDirection = 'column' | 'column-reverse' | 'row' | 'row-reverse';
|
|
1993
|
-
type FlexWrap = 'nowrap' | 'wrap' | 'Wrap-reverse';
|
|
1994
|
-
type Justify = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
|
|
1995
|
-
type Position = 'static' | 'relative' | 'absolute';
|
|
1996
|
-
type BoxSizing = 'border-box' | 'content-box';
|
|
1997
|
-
interface LayoutStyleDeclaration {
|
|
1998
|
-
alignContent: Align;
|
|
1999
|
-
alignItems: Align;
|
|
2000
|
-
alignSelf: Align;
|
|
2001
|
-
borderTop: string;
|
|
2002
|
-
borderLeft: string;
|
|
2003
|
-
borderRight: string;
|
|
2004
|
-
borderBottom: string;
|
|
2005
|
-
borderWidth: number;
|
|
2006
|
-
border: string;
|
|
2007
|
-
direction: 'inherit' | 'ltr' | 'rtl';
|
|
2008
|
-
display: 'none' | 'flex' | 'contents';
|
|
2009
|
-
flex: number;
|
|
2010
|
-
flexBasis: number | 'auto' | `${number}%`;
|
|
2011
|
-
flexDirection: FlexDirection;
|
|
2012
|
-
flexGrow: number;
|
|
2013
|
-
flexShrink: number;
|
|
2014
|
-
flexWrap: FlexWrap;
|
|
2015
|
-
height: number | 'auto' | `${number}%`;
|
|
2016
|
-
justifyContent: Justify;
|
|
2017
|
-
gap: number | `${number}%`;
|
|
2018
|
-
marginTop: number | 'auto' | `${number}%`;
|
|
2019
|
-
marginLeft: number | 'auto' | `${number}%`;
|
|
2020
|
-
marginRight: number | 'auto' | `${number}%`;
|
|
2021
|
-
marginBottom: number | 'auto' | `${number}%`;
|
|
2022
|
-
margin: number | 'auto' | `${number}%`;
|
|
2023
|
-
maxHeight: number | `${number}%`;
|
|
2024
|
-
maxWidth: number | `${number}%`;
|
|
2025
|
-
minHeight: number | `${number}%`;
|
|
2026
|
-
minWidth: number | `${number}%`;
|
|
2027
|
-
paddingTop: number | `${number}%`;
|
|
2028
|
-
paddingLeft: number | `${number}%`;
|
|
2029
|
-
paddingRight: number | `${number}%`;
|
|
2030
|
-
paddingBottom: number | `${number}%`;
|
|
2031
|
-
padding: number | `${number}%`;
|
|
2032
|
-
top: number | `${number}%`;
|
|
2033
|
-
bottom: number | `${number}%`;
|
|
2034
|
-
left: number | `${number}%`;
|
|
2035
|
-
right: number | `${number}%`;
|
|
2036
|
-
position: Position;
|
|
2037
|
-
boxSizing: BoxSizing;
|
|
2038
|
-
width: number | 'auto' | `${number}%`;
|
|
2039
|
-
}
|
|
2040
|
-
interface FlexElement2DStyleProperties extends BaseElement2DStyleProperties, LayoutStyleDeclaration {
|
|
1991
|
+
interface FlexElement2DStyleProperties extends BaseElement2DStyleProperties {
|
|
2041
1992
|
}
|
|
2042
1993
|
interface FlexElement2DStyle extends FlexElement2DStyleProperties {
|
|
2043
1994
|
}
|
|
@@ -2123,13 +2074,13 @@ declare class Graphics2D extends Node2D {
|
|
|
2123
2074
|
}
|
|
2124
2075
|
|
|
2125
2076
|
interface Image2DProperties extends Element2DProperties {
|
|
2126
|
-
src:
|
|
2127
|
-
srcRect:
|
|
2077
|
+
src: ImageSource;
|
|
2078
|
+
srcRect: ImageSourceRect;
|
|
2128
2079
|
gif: boolean;
|
|
2129
2080
|
}
|
|
2130
2081
|
declare class Image2D extends Element2D {
|
|
2131
2082
|
texture?: AnimatedTexture;
|
|
2132
|
-
srcRect:
|
|
2083
|
+
srcRect: ImageSourceRect;
|
|
2133
2084
|
src: string;
|
|
2134
2085
|
gif: boolean;
|
|
2135
2086
|
get currentFrameTexture(): Texture2D | undefined;
|
|
@@ -3066,4 +3017,4 @@ interface RenderOptions {
|
|
|
3066
3017
|
}
|
|
3067
3018
|
declare function render(options: RenderOptions): Promise<HTMLCanvasElement>;
|
|
3068
3019
|
|
|
3069
|
-
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 };
|