modern-canvas 0.6.1 → 0.6.3
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 +27 -26
- package/dist/index.d.cts +2 -3
- package/dist/index.d.mts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +26 -26
- package/dist/index.mjs +28 -27
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -340,7 +340,7 @@ class CoreObject extends EventEmitter {
|
|
|
340
340
|
this._updatingPromise = this._enqueueUpdate();
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
|
|
343
|
+
toJSON() {
|
|
344
344
|
const json = {};
|
|
345
345
|
this._properties.forEach((value, key) => {
|
|
346
346
|
if (value === void 0) {
|
|
@@ -358,9 +358,6 @@ class CoreObject extends EventEmitter {
|
|
|
358
358
|
});
|
|
359
359
|
return json;
|
|
360
360
|
}
|
|
361
|
-
toJSON() {
|
|
362
|
-
return this.toPropsJSON();
|
|
363
|
-
}
|
|
364
361
|
clone() {
|
|
365
362
|
return new this.constructor(this.toJSON());
|
|
366
363
|
}
|
|
@@ -5660,6 +5657,7 @@ function getNodeIid(key) {
|
|
|
5660
5657
|
return iid;
|
|
5661
5658
|
}
|
|
5662
5659
|
exports.Node = class Node extends CoreObject {
|
|
5660
|
+
meta = {};
|
|
5663
5661
|
_readyed = false;
|
|
5664
5662
|
constructor(properties, nodes = []) {
|
|
5665
5663
|
super();
|
|
@@ -6009,7 +6007,9 @@ exports.Node = class Node extends CoreObject {
|
|
|
6009
6007
|
this._children.back.push(node);
|
|
6010
6008
|
break;
|
|
6011
6009
|
}
|
|
6012
|
-
node.internalMode
|
|
6010
|
+
if (node.internalMode !== internalMode) {
|
|
6011
|
+
node.internalMode = internalMode;
|
|
6012
|
+
}
|
|
6013
6013
|
node.setParent(this);
|
|
6014
6014
|
this.emit("appendChild", node);
|
|
6015
6015
|
return node;
|
|
@@ -6037,7 +6037,9 @@ exports.Node = class Node extends CoreObject {
|
|
|
6037
6037
|
this.emit("appendChild", node);
|
|
6038
6038
|
}
|
|
6039
6039
|
}
|
|
6040
|
-
node.internalMode
|
|
6040
|
+
if (node.internalMode !== internalMode) {
|
|
6041
|
+
node.internalMode = internalMode;
|
|
6042
|
+
}
|
|
6041
6043
|
return this;
|
|
6042
6044
|
}
|
|
6043
6045
|
removeChild(child) {
|
|
@@ -6100,16 +6102,17 @@ exports.Node = class Node extends CoreObject {
|
|
|
6100
6102
|
}
|
|
6101
6103
|
clone() {
|
|
6102
6104
|
return new this.constructor(
|
|
6103
|
-
this.
|
|
6105
|
+
this.toJSON(),
|
|
6104
6106
|
this._children.internal
|
|
6105
6107
|
);
|
|
6106
6108
|
}
|
|
6107
6109
|
toJSON() {
|
|
6108
|
-
return {
|
|
6110
|
+
return modernIdoc.clearUndef({
|
|
6109
6111
|
...super.toJSON(),
|
|
6110
6112
|
is: this.is,
|
|
6111
|
-
children: [...this._children.map((child) => child.toJSON())]
|
|
6112
|
-
|
|
6113
|
+
children: this._children.length ? [...this._children.map((child) => child.toJSON())] : void 0,
|
|
6114
|
+
meta: Object.keys(this.meta).length ? { ...this.meta } : void 0
|
|
6115
|
+
});
|
|
6113
6116
|
}
|
|
6114
6117
|
static parse(value) {
|
|
6115
6118
|
if (Array.isArray(value)) {
|
|
@@ -6140,9 +6143,6 @@ __decorateClass$Q([
|
|
|
6140
6143
|
__decorateClass$Q([
|
|
6141
6144
|
modernIdoc.property({ fallback: "default" })
|
|
6142
6145
|
], exports.Node.prototype, "internalMode", 2);
|
|
6143
|
-
__decorateClass$Q([
|
|
6144
|
-
modernIdoc.property({ default: () => ({}) })
|
|
6145
|
-
], exports.Node.prototype, "meta", 2);
|
|
6146
6146
|
__decorateClass$Q([
|
|
6147
6147
|
modernIdoc.property({ protected: true })
|
|
6148
6148
|
], exports.Node.prototype, "mask", 2);
|
|
@@ -9314,7 +9314,7 @@ __decorateClass$o([
|
|
|
9314
9314
|
modernIdoc.property()
|
|
9315
9315
|
], BaseElement2DShape.prototype, "viewBox");
|
|
9316
9316
|
__decorateClass$o([
|
|
9317
|
-
modernIdoc.property(
|
|
9317
|
+
modernIdoc.property()
|
|
9318
9318
|
], BaseElement2DShape.prototype, "paths");
|
|
9319
9319
|
|
|
9320
9320
|
class BaseElement2DStyle extends Resource {
|
|
@@ -9862,19 +9862,20 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
|
|
|
9862
9862
|
}
|
|
9863
9863
|
}
|
|
9864
9864
|
toJSON() {
|
|
9865
|
-
|
|
9866
|
-
|
|
9867
|
-
...this.toPropsJSON(),
|
|
9868
|
-
children: [...this._children.map((child) => child.toJSON())],
|
|
9869
|
-
style: this.style.toJSON(),
|
|
9870
|
-
background: this.background.toJSON(),
|
|
9871
|
-
shape: this.shape.toJSON(),
|
|
9872
|
-
fill: this.fill.toJSON(),
|
|
9873
|
-
outline: this.outline.toJSON(),
|
|
9874
|
-
text: this.text.toJSON(),
|
|
9875
|
-
foreground: this.foreground.toJSON(),
|
|
9876
|
-
shadow: this.shadow.toJSON()
|
|
9865
|
+
const notEmptyObjectOrUndef = (obj) => {
|
|
9866
|
+
return Object.keys(obj).length > 0 ? obj : void 0;
|
|
9877
9867
|
};
|
|
9868
|
+
return modernIdoc.clearUndef({
|
|
9869
|
+
...super.toJSON(),
|
|
9870
|
+
style: notEmptyObjectOrUndef(this.style.toJSON()),
|
|
9871
|
+
background: notEmptyObjectOrUndef(this.background.toJSON()),
|
|
9872
|
+
shape: notEmptyObjectOrUndef(this.shape.toJSON()),
|
|
9873
|
+
fill: notEmptyObjectOrUndef(this.fill.toJSON()),
|
|
9874
|
+
outline: notEmptyObjectOrUndef(this.outline.toJSON()),
|
|
9875
|
+
text: notEmptyObjectOrUndef(this.text.toJSON()),
|
|
9876
|
+
foreground: notEmptyObjectOrUndef(this.foreground.toJSON()),
|
|
9877
|
+
shadow: notEmptyObjectOrUndef(this.shadow.toJSON())
|
|
9878
|
+
});
|
|
9878
9879
|
}
|
|
9879
9880
|
};
|
|
9880
9881
|
exports.BaseElement2D = __decorateClass$l([
|
package/dist/index.d.cts
CHANGED
|
@@ -104,7 +104,6 @@ declare class CoreObject extends EventEmitter implements Required<ReactiveObject
|
|
|
104
104
|
resetProperties(): this;
|
|
105
105
|
onUpdateProperty(key: string, newValue: unknown, oldValue: unknown, declaration: PropertyDeclaration): void;
|
|
106
106
|
requestUpdate(key?: string, newValue?: unknown, oldValue?: unknown, declaration?: PropertyDeclaration): void;
|
|
107
|
-
toPropsJSON(): Record<string, any>;
|
|
108
107
|
toJSON(): Record<string, any>;
|
|
109
108
|
clone(): this;
|
|
110
109
|
free(): void;
|
|
@@ -1644,8 +1643,8 @@ declare class Node extends CoreObject {
|
|
|
1644
1643
|
processSortMode: ProcessSortMode;
|
|
1645
1644
|
renderMode: RenderMode;
|
|
1646
1645
|
internalMode: InternalMode;
|
|
1647
|
-
meta: Record<string, any>;
|
|
1648
1646
|
mask?: Maskable;
|
|
1647
|
+
readonly meta: Record<string, any>;
|
|
1649
1648
|
protected _readyed: boolean;
|
|
1650
1649
|
constructor(properties?: Partial<NodeProperties>, nodes?: Node[]);
|
|
1651
1650
|
setProperties(properties?: Record<string, any>): this;
|
|
@@ -1965,7 +1964,7 @@ declare class BaseElement2DShape extends CoreObject {
|
|
|
1965
1964
|
preset: NormalizedShape['preset'];
|
|
1966
1965
|
svg: NormalizedShape['svg'];
|
|
1967
1966
|
viewBox: NormalizedShape['viewBox'];
|
|
1968
|
-
paths:
|
|
1967
|
+
paths: NormalizedShape['paths'];
|
|
1969
1968
|
protected _path2DSet: Path2DSet;
|
|
1970
1969
|
constructor(parent: BaseElement2D);
|
|
1971
1970
|
setProperties(properties?: Shape): this;
|
package/dist/index.d.mts
CHANGED
|
@@ -104,7 +104,6 @@ declare class CoreObject extends EventEmitter implements Required<ReactiveObject
|
|
|
104
104
|
resetProperties(): this;
|
|
105
105
|
onUpdateProperty(key: string, newValue: unknown, oldValue: unknown, declaration: PropertyDeclaration): void;
|
|
106
106
|
requestUpdate(key?: string, newValue?: unknown, oldValue?: unknown, declaration?: PropertyDeclaration): void;
|
|
107
|
-
toPropsJSON(): Record<string, any>;
|
|
108
107
|
toJSON(): Record<string, any>;
|
|
109
108
|
clone(): this;
|
|
110
109
|
free(): void;
|
|
@@ -1644,8 +1643,8 @@ declare class Node extends CoreObject {
|
|
|
1644
1643
|
processSortMode: ProcessSortMode;
|
|
1645
1644
|
renderMode: RenderMode;
|
|
1646
1645
|
internalMode: InternalMode;
|
|
1647
|
-
meta: Record<string, any>;
|
|
1648
1646
|
mask?: Maskable;
|
|
1647
|
+
readonly meta: Record<string, any>;
|
|
1649
1648
|
protected _readyed: boolean;
|
|
1650
1649
|
constructor(properties?: Partial<NodeProperties>, nodes?: Node[]);
|
|
1651
1650
|
setProperties(properties?: Record<string, any>): this;
|
|
@@ -1965,7 +1964,7 @@ declare class BaseElement2DShape extends CoreObject {
|
|
|
1965
1964
|
preset: NormalizedShape['preset'];
|
|
1966
1965
|
svg: NormalizedShape['svg'];
|
|
1967
1966
|
viewBox: NormalizedShape['viewBox'];
|
|
1968
|
-
paths:
|
|
1967
|
+
paths: NormalizedShape['paths'];
|
|
1969
1968
|
protected _path2DSet: Path2DSet;
|
|
1970
1969
|
constructor(parent: BaseElement2D);
|
|
1971
1970
|
setProperties(properties?: Shape): this;
|
package/dist/index.d.ts
CHANGED
|
@@ -104,7 +104,6 @@ declare class CoreObject extends EventEmitter implements Required<ReactiveObject
|
|
|
104
104
|
resetProperties(): this;
|
|
105
105
|
onUpdateProperty(key: string, newValue: unknown, oldValue: unknown, declaration: PropertyDeclaration): void;
|
|
106
106
|
requestUpdate(key?: string, newValue?: unknown, oldValue?: unknown, declaration?: PropertyDeclaration): void;
|
|
107
|
-
toPropsJSON(): Record<string, any>;
|
|
108
107
|
toJSON(): Record<string, any>;
|
|
109
108
|
clone(): this;
|
|
110
109
|
free(): void;
|
|
@@ -1644,8 +1643,8 @@ declare class Node extends CoreObject {
|
|
|
1644
1643
|
processSortMode: ProcessSortMode;
|
|
1645
1644
|
renderMode: RenderMode;
|
|
1646
1645
|
internalMode: InternalMode;
|
|
1647
|
-
meta: Record<string, any>;
|
|
1648
1646
|
mask?: Maskable;
|
|
1647
|
+
readonly meta: Record<string, any>;
|
|
1649
1648
|
protected _readyed: boolean;
|
|
1650
1649
|
constructor(properties?: Partial<NodeProperties>, nodes?: Node[]);
|
|
1651
1650
|
setProperties(properties?: Record<string, any>): this;
|
|
@@ -1965,7 +1964,7 @@ declare class BaseElement2DShape extends CoreObject {
|
|
|
1965
1964
|
preset: NormalizedShape['preset'];
|
|
1966
1965
|
svg: NormalizedShape['svg'];
|
|
1967
1966
|
viewBox: NormalizedShape['viewBox'];
|
|
1968
|
-
paths:
|
|
1967
|
+
paths: NormalizedShape['paths'];
|
|
1969
1968
|
protected _path2DSet: Path2DSet;
|
|
1970
1969
|
constructor(parent: BaseElement2D);
|
|
1971
1970
|
setProperties(properties?: Shape): this;
|