@leafer/core 1.4.1 → 1.5.0
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/lib/core.cjs +14 -14
- package/lib/core.cjs.map +1 -1
- package/lib/core.esm.js +14 -14
- package/lib/core.esm.js.map +1 -1
- package/lib/core.esm.min.js +1 -1
- package/lib/core.esm.min.js.map +1 -1
- package/lib/core.min.cjs +1 -1
- package/lib/core.min.cjs.map +1 -1
- package/package.json +17 -17
- package/src/index.ts +1 -1
- package/types/index.d.ts +1 -1
package/lib/core.cjs
CHANGED
|
@@ -3637,7 +3637,12 @@ const Resource = {
|
|
|
3637
3637
|
return R.map[key];
|
|
3638
3638
|
},
|
|
3639
3639
|
remove(key) {
|
|
3640
|
-
|
|
3640
|
+
const r = R.map[key];
|
|
3641
|
+
if (r) {
|
|
3642
|
+
if (r.destroy)
|
|
3643
|
+
r.destroy();
|
|
3644
|
+
delete R.map[key];
|
|
3645
|
+
}
|
|
3641
3646
|
},
|
|
3642
3647
|
loadImage(key, format) {
|
|
3643
3648
|
return new Promise((resolve, reject) => {
|
|
@@ -3663,6 +3668,7 @@ const Resource = {
|
|
|
3663
3668
|
const R = Resource;
|
|
3664
3669
|
|
|
3665
3670
|
const ImageManager = {
|
|
3671
|
+
maxRecycled: 100,
|
|
3666
3672
|
recycledList: [],
|
|
3667
3673
|
patternTasker: new TaskProcessor(),
|
|
3668
3674
|
get(config) {
|
|
@@ -3679,13 +3685,8 @@ const ImageManager = {
|
|
|
3679
3685
|
},
|
|
3680
3686
|
clearRecycled() {
|
|
3681
3687
|
const list = I.recycledList;
|
|
3682
|
-
if (list.length >
|
|
3683
|
-
list.forEach(image =>
|
|
3684
|
-
if (!image.use && image.url) {
|
|
3685
|
-
Resource.remove(image.url);
|
|
3686
|
-
image.destroy();
|
|
3687
|
-
}
|
|
3688
|
-
});
|
|
3688
|
+
if (list.length > I.maxRecycled) {
|
|
3689
|
+
list.forEach(image => (!image.use && image.url) && Resource.remove(image.url));
|
|
3689
3690
|
list.length = 0;
|
|
3690
3691
|
}
|
|
3691
3692
|
},
|
|
@@ -4071,12 +4072,11 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4071
4072
|
if (defaultValue === undefined) {
|
|
4072
4073
|
property.get = function () { return this[computedKey]; };
|
|
4073
4074
|
}
|
|
4074
|
-
else if (typeof defaultValue === '
|
|
4075
|
-
const { clone } = DataHelper;
|
|
4075
|
+
else if (typeof defaultValue === 'function') {
|
|
4076
4076
|
property.get = function () {
|
|
4077
4077
|
let v = this[computedKey];
|
|
4078
4078
|
if (v === undefined)
|
|
4079
|
-
this[computedKey] = v =
|
|
4079
|
+
this[computedKey] = v = defaultValue(this.__leaf);
|
|
4080
4080
|
return v;
|
|
4081
4081
|
};
|
|
4082
4082
|
}
|
|
@@ -5723,10 +5723,10 @@ exports.Leaf = class Leaf {
|
|
|
5723
5723
|
static changeAttr(attrName, defaultValue, fn) {
|
|
5724
5724
|
fn ? this.addAttr(attrName, defaultValue, fn) : defineDataProcessor(this.prototype, attrName, defaultValue);
|
|
5725
5725
|
}
|
|
5726
|
-
static addAttr(attrName, defaultValue, fn) {
|
|
5726
|
+
static addAttr(attrName, defaultValue, fn, helpValue) {
|
|
5727
5727
|
if (!fn)
|
|
5728
5728
|
fn = boundsType;
|
|
5729
|
-
fn(defaultValue)(this.prototype, attrName);
|
|
5729
|
+
fn(defaultValue, helpValue)(this.prototype, attrName);
|
|
5730
5730
|
}
|
|
5731
5731
|
__emitLifeEvent(type) {
|
|
5732
5732
|
if (this.hasEvent(type))
|
|
@@ -6053,7 +6053,7 @@ class LeafLevelList {
|
|
|
6053
6053
|
}
|
|
6054
6054
|
}
|
|
6055
6055
|
|
|
6056
|
-
const version = "1.
|
|
6056
|
+
const version = "1.5.0";
|
|
6057
6057
|
|
|
6058
6058
|
exports.AlignHelper = AlignHelper;
|
|
6059
6059
|
exports.AroundHelper = AroundHelper;
|