Skip to content

Commit

Permalink
Updated builds and README
Browse files Browse the repository at this point in the history
  • Loading branch information
jonobr1 committed Dec 27, 2024
1 parent 9fab84e commit f367119
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 33 deletions.
44 changes: 28 additions & 16 deletions build/two.js
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ var Two = (() => {
canvas: "CanvasRenderer"
},
Version: "v0.8.15",
PublishDate: "2024-11-07T05:56:16.788Z",
PublishDate: "2024-12-27T23:16:37.528Z",
Identifier: "two-",
Resolution: 12,
AutoCalculateImportedMatrices: true,
Expand Down Expand Up @@ -1482,42 +1482,48 @@ var Two = (() => {

// src/collection.js
var Collection = class extends Array {
_events = new Events();
#events = new Events();
get _events() {
return this.#events;
}
set _events(e) {
this.#events = e;
}
get _bound() {
return this._events._bound;
return this.#events._bound;
}
set _bound(v) {
this._events._bound = v;
this.#events._bound = v;
}
addEventListener() {
return this._events.addEventListener.apply(this, arguments);
return this.#events.addEventListener.apply(this, arguments);
}
on() {
return this._events.on.apply(this, arguments);
return this.#events.on.apply(this, arguments);
}
bind() {
return this._events.bind.apply(this, arguments);
return this.#events.bind.apply(this, arguments);
}
removeEventListener() {
return this._events.removeEventListener.apply(this, arguments);
return this.#events.removeEventListener.apply(this, arguments);
}
off() {
return this._events.off.apply(this, arguments);
return this.#events.off.apply(this, arguments);
}
unbind() {
return this._events.unbind.apply(this, arguments);
return this.#events.unbind.apply(this, arguments);
}
dispatchEvent() {
return this._events.dispatchEvent.apply(this, arguments);
return this.#events.dispatchEvent.apply(this, arguments);
}
trigger() {
return this._events.trigger.apply(this, arguments);
return this.#events.trigger.apply(this, arguments);
}
listen() {
return this._events.listen.apply(this, arguments);
return this.#events.listen.apply(this, arguments);
}
ignore() {
return this._events.ignore.apply(this, arguments);
return this.#events.ignore.apply(this, arguments);
}
constructor() {
super();
Expand Down Expand Up @@ -1553,7 +1559,10 @@ var Two = (() => {
const spliced = super.splice.apply(this, arguments);
this.trigger(Events.Types.remove, spliced);
if (arguments.length > 2) {
const inserted = this.slice(arguments[0], arguments[0] + arguments.length - 2);
const inserted = this.slice(
arguments[0],
arguments[0] + arguments.length - 2
);
this.trigger(Events.Types.insert, inserted);
this.trigger(Events.Types.order);
}
Expand Down Expand Up @@ -2734,7 +2743,10 @@ var Two = (() => {

// src/children.js
var Children = class extends Collection {
ids = {};
#ids = {};
get ids() {
return this.#ids;
}
constructor(children) {
children = Array.isArray(children) ? children : Array.prototype.slice.call(arguments);
super(children);
Expand Down
2 changes: 1 addition & 1 deletion build/two.min.js

Large diffs are not rendered by default.

66 changes: 50 additions & 16 deletions build/two.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,24 @@ var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
var __accessCheck = (obj, member, msg) => {
if (!member.has(obj))
throw TypeError("Cannot " + msg);
};
var __privateGet = (obj, member, getter) => {
__accessCheck(obj, member, "read from private field");
return getter ? getter.call(obj) : member.get(obj);
};
var __privateAdd = (obj, member, value) => {
if (member.has(obj))
throw TypeError("Cannot add the same private member more than once");
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
};
var __privateSet = (obj, member, value, setter) => {
__accessCheck(obj, member, "write to private field");
setter ? setter.call(obj, value) : member.set(obj, value);
return value;
};

// src/utils/path-commands.js
var Commands = {
Expand Down Expand Up @@ -739,7 +757,7 @@ var Constants = {
canvas: "CanvasRenderer"
},
Version: "v0.8.15",
PublishDate: "2024-11-07T05:56:16.788Z",
PublishDate: "2024-12-27T23:16:37.528Z",
Identifier: "two-",
Resolution: 12,
AutoCalculateImportedMatrices: true,
Expand Down Expand Up @@ -1479,10 +1497,11 @@ function FlagScale() {
}

// src/collection.js
var _events;
var Collection = class extends Array {
constructor() {
super();
__publicField(this, "_events", new Events());
__privateAdd(this, _events, new Events());
if (arguments[0] && Array.isArray(arguments[0])) {
if (arguments[0].length > 0) {
this.push.apply(this, arguments[0]);
Expand All @@ -1491,41 +1510,47 @@ var Collection = class extends Array {
this.push.apply(this, arguments);
}
}
get _events() {
return __privateGet(this, _events);
}
set _events(e) {
__privateSet(this, _events, e);
}
get _bound() {
return this._events._bound;
return __privateGet(this, _events)._bound;
}
set _bound(v) {
this._events._bound = v;
__privateGet(this, _events)._bound = v;
}
addEventListener() {
return this._events.addEventListener.apply(this, arguments);
return __privateGet(this, _events).addEventListener.apply(this, arguments);
}
on() {
return this._events.on.apply(this, arguments);
return __privateGet(this, _events).on.apply(this, arguments);
}
bind() {
return this._events.bind.apply(this, arguments);
return __privateGet(this, _events).bind.apply(this, arguments);
}
removeEventListener() {
return this._events.removeEventListener.apply(this, arguments);
return __privateGet(this, _events).removeEventListener.apply(this, arguments);
}
off() {
return this._events.off.apply(this, arguments);
return __privateGet(this, _events).off.apply(this, arguments);
}
unbind() {
return this._events.unbind.apply(this, arguments);
return __privateGet(this, _events).unbind.apply(this, arguments);
}
dispatchEvent() {
return this._events.dispatchEvent.apply(this, arguments);
return __privateGet(this, _events).dispatchEvent.apply(this, arguments);
}
trigger() {
return this._events.trigger.apply(this, arguments);
return __privateGet(this, _events).trigger.apply(this, arguments);
}
listen() {
return this._events.listen.apply(this, arguments);
return __privateGet(this, _events).listen.apply(this, arguments);
}
ignore() {
return this._events.ignore.apply(this, arguments);
return __privateGet(this, _events).ignore.apply(this, arguments);
}
pop() {
const popped = super.pop.apply(this, arguments);
Expand All @@ -1551,7 +1576,10 @@ var Collection = class extends Array {
const spliced = super.splice.apply(this, arguments);
this.trigger(Events.Types.remove, spliced);
if (arguments.length > 2) {
const inserted = this.slice(arguments[0], arguments[0] + arguments.length - 2);
const inserted = this.slice(
arguments[0],
arguments[0] + arguments.length - 2
);
this.trigger(Events.Types.insert, inserted);
this.trigger(Events.Types.order);
}
Expand Down Expand Up @@ -1585,6 +1613,7 @@ var Collection = class extends Array {
return results;
}
};
_events = new WeakMap();

// src/effects/stop.js
var _Stop = class extends Element {
Expand Down Expand Up @@ -2731,15 +2760,19 @@ function FlagMatrix() {
}

// src/children.js
var _ids;
var Children = class extends Collection {
constructor(children) {
children = Array.isArray(children) ? children : Array.prototype.slice.call(arguments);
super(children);
__publicField(this, "ids", {});
__privateAdd(this, _ids, {});
this.attach(children);
this.on(Events.Types.insert, this.attach);
this.on(Events.Types.remove, this.detach);
}
get ids() {
return __privateGet(this, _ids);
}
attach(children) {
for (let i = 0; i < children.length; i++) {
const child = children[i];
Expand All @@ -2756,6 +2789,7 @@ var Children = class extends Collection {
return this;
}
};
_ids = new WeakMap();

// src/path.js
var min = Math.min;
Expand Down
1 change: 1 addition & 0 deletions wiki/changelog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file. The format

## Nightly

+ Made `Two.Collection._events` and `Two.Children.ids` not enumerated for more seamless invocation of `Array` methods like `Array.filter` and `Object` methods like `Object.keys`
+ Added static method `fromObject` to all `Two.Element` and descendant classes
+ Added method `copy` to all `Two.Element` and descendant classes
+ Added tests for `toObject` methods
Expand Down

0 comments on commit f367119

Please sign in to comment.