modern-canvas 0.6.1 → 0.6.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/dist/index.cjs +25 -23
- package/dist/index.d.cts +1 -2
- package/dist/index.d.mts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +26 -26
- package/dist/index.mjs +26 -24
- 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
|
}
|
|
@@ -6009,7 +6006,9 @@ exports.Node = class Node extends CoreObject {
|
|
|
6009
6006
|
this._children.back.push(node);
|
|
6010
6007
|
break;
|
|
6011
6008
|
}
|
|
6012
|
-
node.internalMode
|
|
6009
|
+
if (node.internalMode !== internalMode) {
|
|
6010
|
+
node.internalMode = internalMode;
|
|
6011
|
+
}
|
|
6013
6012
|
node.setParent(this);
|
|
6014
6013
|
this.emit("appendChild", node);
|
|
6015
6014
|
return node;
|
|
@@ -6037,7 +6036,9 @@ exports.Node = class Node extends CoreObject {
|
|
|
6037
6036
|
this.emit("appendChild", node);
|
|
6038
6037
|
}
|
|
6039
6038
|
}
|
|
6040
|
-
node.internalMode
|
|
6039
|
+
if (node.internalMode !== internalMode) {
|
|
6040
|
+
node.internalMode = internalMode;
|
|
6041
|
+
}
|
|
6041
6042
|
return this;
|
|
6042
6043
|
}
|
|
6043
6044
|
removeChild(child) {
|
|
@@ -6100,16 +6101,16 @@ exports.Node = class Node extends CoreObject {
|
|
|
6100
6101
|
}
|
|
6101
6102
|
clone() {
|
|
6102
6103
|
return new this.constructor(
|
|
6103
|
-
this.
|
|
6104
|
+
this.toJSON(),
|
|
6104
6105
|
this._children.internal
|
|
6105
6106
|
);
|
|
6106
6107
|
}
|
|
6107
6108
|
toJSON() {
|
|
6108
|
-
return {
|
|
6109
|
+
return modernIdoc.clearUndef({
|
|
6109
6110
|
...super.toJSON(),
|
|
6110
6111
|
is: this.is,
|
|
6111
|
-
children: [...this._children.map((child) => child.toJSON())]
|
|
6112
|
-
};
|
|
6112
|
+
children: this._children.length ? [...this._children.map((child) => child.toJSON())] : void 0
|
|
6113
|
+
});
|
|
6113
6114
|
}
|
|
6114
6115
|
static parse(value) {
|
|
6115
6116
|
if (Array.isArray(value)) {
|
|
@@ -9314,7 +9315,7 @@ __decorateClass$o([
|
|
|
9314
9315
|
modernIdoc.property()
|
|
9315
9316
|
], BaseElement2DShape.prototype, "viewBox");
|
|
9316
9317
|
__decorateClass$o([
|
|
9317
|
-
modernIdoc.property(
|
|
9318
|
+
modernIdoc.property()
|
|
9318
9319
|
], BaseElement2DShape.prototype, "paths");
|
|
9319
9320
|
|
|
9320
9321
|
class BaseElement2DStyle extends Resource {
|
|
@@ -9862,19 +9863,20 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
|
|
|
9862
9863
|
}
|
|
9863
9864
|
}
|
|
9864
9865
|
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()
|
|
9866
|
+
const notEmptyObjectOrUndef = (obj) => {
|
|
9867
|
+
return Object.keys(obj).length > 0 ? obj : void 0;
|
|
9877
9868
|
};
|
|
9869
|
+
return modernIdoc.clearUndef({
|
|
9870
|
+
...super.toJSON(),
|
|
9871
|
+
style: notEmptyObjectOrUndef(this.style.toJSON()),
|
|
9872
|
+
background: notEmptyObjectOrUndef(this.background.toJSON()),
|
|
9873
|
+
shape: notEmptyObjectOrUndef(this.shape.toJSON()),
|
|
9874
|
+
fill: notEmptyObjectOrUndef(this.fill.toJSON()),
|
|
9875
|
+
outline: notEmptyObjectOrUndef(this.outline.toJSON()),
|
|
9876
|
+
text: notEmptyObjectOrUndef(this.text.toJSON()),
|
|
9877
|
+
foreground: notEmptyObjectOrUndef(this.foreground.toJSON()),
|
|
9878
|
+
shadow: notEmptyObjectOrUndef(this.shadow.toJSON())
|
|
9879
|
+
});
|
|
9878
9880
|
}
|
|
9879
9881
|
};
|
|
9880
9882
|
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;
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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;
|