modern-canvas 0.10.0 → 0.10.1
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 +50 -7
- package/dist/index.d.cts +13 -3
- package/dist/index.d.mts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +28 -28
- package/dist/index.mjs +50 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5759,6 +5759,47 @@ class Children {
|
|
|
5759
5759
|
}
|
|
5760
5760
|
}
|
|
5761
5761
|
|
|
5762
|
+
class Meta extends CoreObject {
|
|
5763
|
+
constructor(parent) {
|
|
5764
|
+
super();
|
|
5765
|
+
this.parent = parent;
|
|
5766
|
+
return new Proxy(this, {
|
|
5767
|
+
get: (target, prop, receiver) => {
|
|
5768
|
+
if (Reflect.has(target, prop)) {
|
|
5769
|
+
return Reflect.get(target, prop, receiver);
|
|
5770
|
+
}
|
|
5771
|
+
return target.getProperty(String(prop));
|
|
5772
|
+
},
|
|
5773
|
+
set: (target, prop, value, receiver) => {
|
|
5774
|
+
if (Reflect.has(target, prop)) {
|
|
5775
|
+
return Reflect.set(target, prop, value, receiver);
|
|
5776
|
+
}
|
|
5777
|
+
target.setProperty(String(prop), value);
|
|
5778
|
+
return true;
|
|
5779
|
+
},
|
|
5780
|
+
deleteProperty: (target, prop) => {
|
|
5781
|
+
if (Reflect.has(target, prop)) {
|
|
5782
|
+
return Reflect.deleteProperty(target, prop);
|
|
5783
|
+
}
|
|
5784
|
+
target.setProperty(String(prop), void 0);
|
|
5785
|
+
return true;
|
|
5786
|
+
}
|
|
5787
|
+
});
|
|
5788
|
+
}
|
|
5789
|
+
getPropertyDeclarations() {
|
|
5790
|
+
const declarations = /* @__PURE__ */ new Map();
|
|
5791
|
+
this._properties.forEach((_value, key) => {
|
|
5792
|
+
declarations.set(key, {
|
|
5793
|
+
internalKey: `____${key}`
|
|
5794
|
+
});
|
|
5795
|
+
});
|
|
5796
|
+
return declarations;
|
|
5797
|
+
}
|
|
5798
|
+
getPropertyDeclaration(key) {
|
|
5799
|
+
return { internalKey: `____${key}` };
|
|
5800
|
+
}
|
|
5801
|
+
}
|
|
5802
|
+
|
|
5762
5803
|
var __defProp$L = Object.defineProperty;
|
|
5763
5804
|
var __getOwnPropDesc$J = Object.getOwnPropertyDescriptor;
|
|
5764
5805
|
var __decorateClass$T = (decorators, target, key, kind) => {
|
|
@@ -5777,6 +5818,13 @@ function getNodeIid(key) {
|
|
|
5777
5818
|
return iid;
|
|
5778
5819
|
}
|
|
5779
5820
|
exports.Node = class Node extends CoreObject {
|
|
5821
|
+
_meta = new Meta(this);
|
|
5822
|
+
get meta() {
|
|
5823
|
+
return this._meta;
|
|
5824
|
+
}
|
|
5825
|
+
set meta(value) {
|
|
5826
|
+
this._meta.resetProperties().setProperties(value);
|
|
5827
|
+
}
|
|
5780
5828
|
_readyed = false;
|
|
5781
5829
|
constructor(properties, nodes = []) {
|
|
5782
5830
|
super();
|
|
@@ -5799,9 +5847,7 @@ exports.Node = class Node extends CoreObject {
|
|
|
5799
5847
|
...restProperties
|
|
5800
5848
|
} = properties;
|
|
5801
5849
|
if (meta) {
|
|
5802
|
-
|
|
5803
|
-
this.meta[key] = meta[key];
|
|
5804
|
-
}
|
|
5850
|
+
this.meta = meta;
|
|
5805
5851
|
}
|
|
5806
5852
|
super.setProperties(restProperties);
|
|
5807
5853
|
}
|
|
@@ -6258,7 +6304,7 @@ exports.Node = class Node extends CoreObject {
|
|
|
6258
6304
|
...super.toJSON(),
|
|
6259
6305
|
children: this.children.length ? [...this.children.map((child) => child.toJSON())] : void 0,
|
|
6260
6306
|
meta: {
|
|
6261
|
-
...this.meta,
|
|
6307
|
+
...this.meta.toJSON(),
|
|
6262
6308
|
inCanvasIs: this.is
|
|
6263
6309
|
}
|
|
6264
6310
|
});
|
|
@@ -6281,9 +6327,6 @@ __decorateClass$T([
|
|
|
6281
6327
|
__decorateClass$T([
|
|
6282
6328
|
modernIdoc.property({ fallback: modernIdoc.idGenerator() })
|
|
6283
6329
|
], exports.Node.prototype, "name", 2);
|
|
6284
|
-
__decorateClass$T([
|
|
6285
|
-
modernIdoc.property({ default: () => ({}) })
|
|
6286
|
-
], exports.Node.prototype, "meta", 2);
|
|
6287
6330
|
__decorateClass$T([
|
|
6288
6331
|
modernIdoc.property({ internal: true, fallback: "inherit" })
|
|
6289
6332
|
], exports.Node.prototype, "processMode", 2);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Font, Fonts } from 'modern-font';
|
|
2
|
-
import { ObservableEvents, Observable, ReactivableEvents, Reactivable, Color as Color$1, RawWeakMap as RawWeakMap$1, LinearGradient, RadialGradient, Hex8Color, NormalizedFill, Fill, NormalizedBackground, Background, NormalizedForeground, Foreground, NormalizedOutline, Outline, NormalizedShadow, Shadow, NormalizedShape, Shape, FullStyle, Text as Text$1, TextContent, Style, ImageFillCropRect } from 'modern-idoc';
|
|
2
|
+
import { ObservableEvents, Observable, ReactivableEvents, Reactivable, Color as Color$1, RawWeakMap as RawWeakMap$1, LinearGradient, RadialGradient, Hex8Color, PropertyDeclaration, NormalizedFill, Fill, NormalizedBackground, Background, NormalizedForeground, Foreground, NormalizedOutline, Outline, NormalizedShadow, Shadow, NormalizedShape, Shape, FullStyle, Text as Text$1, TextContent, Style, ImageFillCropRect } from 'modern-idoc';
|
|
3
3
|
export { Color as ColorValue } from 'modern-idoc';
|
|
4
4
|
import { AnimationItem } from 'lottie-web';
|
|
5
5
|
import { Colord, RgbaColor, HslaColor, HsvaColor } from 'colord';
|
|
@@ -1650,6 +1650,14 @@ declare class Children<T extends Node = Node> {
|
|
|
1650
1650
|
toJSON(): T[];
|
|
1651
1651
|
}
|
|
1652
1652
|
|
|
1653
|
+
declare class Meta extends CoreObject {
|
|
1654
|
+
parent: Node;
|
|
1655
|
+
[key: string]: any;
|
|
1656
|
+
getPropertyDeclarations(): Map<string, PropertyDeclaration>;
|
|
1657
|
+
getPropertyDeclaration(key: string): PropertyDeclaration | undefined;
|
|
1658
|
+
constructor(parent: Node);
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1653
1661
|
interface NodeEvents extends CoreObjectEvents, InputEvents {
|
|
1654
1662
|
treeEnter: [tree: SceneTree];
|
|
1655
1663
|
treeEntered: [tree: SceneTree];
|
|
@@ -1694,13 +1702,15 @@ declare class Node extends CoreObject {
|
|
|
1694
1702
|
readonly is: string;
|
|
1695
1703
|
id: string;
|
|
1696
1704
|
name: string;
|
|
1697
|
-
meta: Record<string, any>;
|
|
1698
1705
|
processMode: ProcessMode;
|
|
1699
1706
|
processSortMode: ProcessSortMode;
|
|
1700
1707
|
renderMode: RenderMode;
|
|
1701
1708
|
inputMode: InputMode;
|
|
1702
1709
|
internalMode: InternalMode;
|
|
1703
1710
|
mask?: Maskable;
|
|
1711
|
+
protected _meta: Meta;
|
|
1712
|
+
get meta(): Meta;
|
|
1713
|
+
set meta(value: Record<string, any>);
|
|
1704
1714
|
protected _readyed: boolean;
|
|
1705
1715
|
constructor(properties?: Partial<NodeProperties>, nodes?: Node[]);
|
|
1706
1716
|
setProperties(properties?: Record<string, any>): this;
|
|
@@ -2118,7 +2128,7 @@ declare class BaseElement2DText extends CoreObject {
|
|
|
2118
2128
|
draw(): void;
|
|
2119
2129
|
}
|
|
2120
2130
|
|
|
2121
|
-
interface BaseElement2DEvents extends Node2DEvents {
|
|
2131
|
+
interface BaseElement2DEvents extends Node2DEvents, RectangulableEvents {
|
|
2122
2132
|
updateStyleProperty: [key: string, value: any, oldValue: any];
|
|
2123
2133
|
}
|
|
2124
2134
|
interface BaseElement2DProperties extends Node2DProperties {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Font, Fonts } from 'modern-font';
|
|
2
|
-
import { ObservableEvents, Observable, ReactivableEvents, Reactivable, Color as Color$1, RawWeakMap as RawWeakMap$1, LinearGradient, RadialGradient, Hex8Color, NormalizedFill, Fill, NormalizedBackground, Background, NormalizedForeground, Foreground, NormalizedOutline, Outline, NormalizedShadow, Shadow, NormalizedShape, Shape, FullStyle, Text as Text$1, TextContent, Style, ImageFillCropRect } from 'modern-idoc';
|
|
2
|
+
import { ObservableEvents, Observable, ReactivableEvents, Reactivable, Color as Color$1, RawWeakMap as RawWeakMap$1, LinearGradient, RadialGradient, Hex8Color, PropertyDeclaration, NormalizedFill, Fill, NormalizedBackground, Background, NormalizedForeground, Foreground, NormalizedOutline, Outline, NormalizedShadow, Shadow, NormalizedShape, Shape, FullStyle, Text as Text$1, TextContent, Style, ImageFillCropRect } from 'modern-idoc';
|
|
3
3
|
export { Color as ColorValue } from 'modern-idoc';
|
|
4
4
|
import { AnimationItem } from 'lottie-web';
|
|
5
5
|
import { Colord, RgbaColor, HslaColor, HsvaColor } from 'colord';
|
|
@@ -1650,6 +1650,14 @@ declare class Children<T extends Node = Node> {
|
|
|
1650
1650
|
toJSON(): T[];
|
|
1651
1651
|
}
|
|
1652
1652
|
|
|
1653
|
+
declare class Meta extends CoreObject {
|
|
1654
|
+
parent: Node;
|
|
1655
|
+
[key: string]: any;
|
|
1656
|
+
getPropertyDeclarations(): Map<string, PropertyDeclaration>;
|
|
1657
|
+
getPropertyDeclaration(key: string): PropertyDeclaration | undefined;
|
|
1658
|
+
constructor(parent: Node);
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1653
1661
|
interface NodeEvents extends CoreObjectEvents, InputEvents {
|
|
1654
1662
|
treeEnter: [tree: SceneTree];
|
|
1655
1663
|
treeEntered: [tree: SceneTree];
|
|
@@ -1694,13 +1702,15 @@ declare class Node extends CoreObject {
|
|
|
1694
1702
|
readonly is: string;
|
|
1695
1703
|
id: string;
|
|
1696
1704
|
name: string;
|
|
1697
|
-
meta: Record<string, any>;
|
|
1698
1705
|
processMode: ProcessMode;
|
|
1699
1706
|
processSortMode: ProcessSortMode;
|
|
1700
1707
|
renderMode: RenderMode;
|
|
1701
1708
|
inputMode: InputMode;
|
|
1702
1709
|
internalMode: InternalMode;
|
|
1703
1710
|
mask?: Maskable;
|
|
1711
|
+
protected _meta: Meta;
|
|
1712
|
+
get meta(): Meta;
|
|
1713
|
+
set meta(value: Record<string, any>);
|
|
1704
1714
|
protected _readyed: boolean;
|
|
1705
1715
|
constructor(properties?: Partial<NodeProperties>, nodes?: Node[]);
|
|
1706
1716
|
setProperties(properties?: Record<string, any>): this;
|
|
@@ -2118,7 +2128,7 @@ declare class BaseElement2DText extends CoreObject {
|
|
|
2118
2128
|
draw(): void;
|
|
2119
2129
|
}
|
|
2120
2130
|
|
|
2121
|
-
interface BaseElement2DEvents extends Node2DEvents {
|
|
2131
|
+
interface BaseElement2DEvents extends Node2DEvents, RectangulableEvents {
|
|
2122
2132
|
updateStyleProperty: [key: string, value: any, oldValue: any];
|
|
2123
2133
|
}
|
|
2124
2134
|
interface BaseElement2DProperties extends Node2DProperties {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Font, Fonts } from 'modern-font';
|
|
2
|
-
import { ObservableEvents, Observable, ReactivableEvents, Reactivable, Color as Color$1, RawWeakMap as RawWeakMap$1, LinearGradient, RadialGradient, Hex8Color, NormalizedFill, Fill, NormalizedBackground, Background, NormalizedForeground, Foreground, NormalizedOutline, Outline, NormalizedShadow, Shadow, NormalizedShape, Shape, FullStyle, Text as Text$1, TextContent, Style, ImageFillCropRect } from 'modern-idoc';
|
|
2
|
+
import { ObservableEvents, Observable, ReactivableEvents, Reactivable, Color as Color$1, RawWeakMap as RawWeakMap$1, LinearGradient, RadialGradient, Hex8Color, PropertyDeclaration, NormalizedFill, Fill, NormalizedBackground, Background, NormalizedForeground, Foreground, NormalizedOutline, Outline, NormalizedShadow, Shadow, NormalizedShape, Shape, FullStyle, Text as Text$1, TextContent, Style, ImageFillCropRect } from 'modern-idoc';
|
|
3
3
|
export { Color as ColorValue } from 'modern-idoc';
|
|
4
4
|
import { AnimationItem } from 'lottie-web';
|
|
5
5
|
import { Colord, RgbaColor, HslaColor, HsvaColor } from 'colord';
|
|
@@ -1650,6 +1650,14 @@ declare class Children<T extends Node = Node> {
|
|
|
1650
1650
|
toJSON(): T[];
|
|
1651
1651
|
}
|
|
1652
1652
|
|
|
1653
|
+
declare class Meta extends CoreObject {
|
|
1654
|
+
parent: Node;
|
|
1655
|
+
[key: string]: any;
|
|
1656
|
+
getPropertyDeclarations(): Map<string, PropertyDeclaration>;
|
|
1657
|
+
getPropertyDeclaration(key: string): PropertyDeclaration | undefined;
|
|
1658
|
+
constructor(parent: Node);
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1653
1661
|
interface NodeEvents extends CoreObjectEvents, InputEvents {
|
|
1654
1662
|
treeEnter: [tree: SceneTree];
|
|
1655
1663
|
treeEntered: [tree: SceneTree];
|
|
@@ -1694,13 +1702,15 @@ declare class Node extends CoreObject {
|
|
|
1694
1702
|
readonly is: string;
|
|
1695
1703
|
id: string;
|
|
1696
1704
|
name: string;
|
|
1697
|
-
meta: Record<string, any>;
|
|
1698
1705
|
processMode: ProcessMode;
|
|
1699
1706
|
processSortMode: ProcessSortMode;
|
|
1700
1707
|
renderMode: RenderMode;
|
|
1701
1708
|
inputMode: InputMode;
|
|
1702
1709
|
internalMode: InternalMode;
|
|
1703
1710
|
mask?: Maskable;
|
|
1711
|
+
protected _meta: Meta;
|
|
1712
|
+
get meta(): Meta;
|
|
1713
|
+
set meta(value: Record<string, any>);
|
|
1704
1714
|
protected _readyed: boolean;
|
|
1705
1715
|
constructor(properties?: Partial<NodeProperties>, nodes?: Node[]);
|
|
1706
1716
|
setProperties(properties?: Record<string, any>): this;
|
|
@@ -2118,7 +2128,7 @@ declare class BaseElement2DText extends CoreObject {
|
|
|
2118
2128
|
draw(): void;
|
|
2119
2129
|
}
|
|
2120
2130
|
|
|
2121
|
-
interface BaseElement2DEvents extends Node2DEvents {
|
|
2131
|
+
interface BaseElement2DEvents extends Node2DEvents, RectangulableEvents {
|
|
2122
2132
|
updateStyleProperty: [key: string, value: any, oldValue: any];
|
|
2123
2133
|
}
|
|
2124
2134
|
interface BaseElement2DProperties extends Node2DProperties {
|