@esportsplus/template 0.28.0 → 0.28.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.
@@ -52,13 +52,13 @@ function list(ctx, element, id, name, state, value) {
52
52
  continue;
53
53
  }
54
54
  dynamic.add(part);
55
- hot[part] = null;
55
+ hot[part] = true;
56
56
  }
57
57
  }
58
58
  let cold = store[id];
59
59
  if (cold !== undefined) {
60
60
  for (let part in cold) {
61
- if (hot[part] === undefined) {
61
+ if (hot[part] === true) {
62
62
  continue;
63
63
  }
64
64
  dynamic.delete(part);
@@ -20,18 +20,18 @@ class EffectSlot {
20
20
  scheduled = false;
21
21
  textnode = null;
22
22
  constructor(anchor, fn) {
23
- let dispose = fn.length ? () => this.dispose() : undefined, slot = this;
23
+ let dispose = fn.length ? () => this.dispose() : undefined, value;
24
24
  this.anchor = anchor;
25
- this.disposer = effect(function () {
26
- let value = read(fn(dispose));
27
- if (!slot.disposer) {
28
- slot.update(value);
25
+ this.disposer = effect(() => {
26
+ value = read(fn(dispose));
27
+ if (!this.disposer) {
28
+ this.update(value);
29
29
  }
30
- else if (!slot.scheduled) {
31
- slot.scheduled = true;
30
+ else if (!this.scheduled) {
31
+ this.scheduled = true;
32
32
  raf(() => {
33
- slot.scheduled = false;
34
- slot.update(this.value);
33
+ this.scheduled = false;
34
+ this.update(value);
35
35
  });
36
36
  }
37
37
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "ICJR",
3
3
  "dependencies": {
4
4
  "@esportsplus/queue": "^0.2.0",
5
- "@esportsplus/reactivity": "^0.21.0",
5
+ "@esportsplus/reactivity": "^0.22.0",
6
6
  "@esportsplus/utilities": "^0.25.0"
7
7
  },
8
8
  "devDependencies": {
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "type": "module",
19
19
  "types": "./build/index.d.ts",
20
- "version": "0.28.0",
20
+ "version": "0.28.1",
21
21
  "scripts": {
22
22
  "build": "tsc && tsc-alias",
23
23
  "-": "-"
package/src/attributes.ts CHANGED
@@ -79,7 +79,7 @@ function list(
79
79
  }
80
80
  }
81
81
  else {
82
- let hot: Attributes = {};
82
+ let hot: Record<PropertyKey, true> = {};
83
83
 
84
84
  if (value && typeof value === 'string') {
85
85
  let part: string,
@@ -93,15 +93,15 @@ function list(
93
93
  }
94
94
 
95
95
  dynamic.add(part);
96
- hot[part] = null;
96
+ hot[part] = true;
97
97
  }
98
98
  }
99
99
 
100
- let cold = store[id] as Attributes | undefined;
100
+ let cold = store[id] as Record<PropertyKey, true> | undefined;
101
101
 
102
102
  if (cold !== undefined) {
103
103
  for (let part in cold) {
104
- if (hot[part] === undefined) {
104
+ if (hot[part] === true) {
105
105
  continue;
106
106
  }
107
107
 
@@ -30,21 +30,21 @@ class EffectSlot {
30
30
 
31
31
  constructor(anchor: Element, fn: (dispose?: VoidFunction) => Renderable<any>) {
32
32
  let dispose = fn.length ? () => this.dispose() : undefined,
33
- slot = this;
33
+ value: unknown;
34
34
 
35
35
  this.anchor = anchor;
36
- this.disposer = effect(function () {
37
- let value = read( fn(dispose) );
36
+ this.disposer = effect(() => {
37
+ value = read( fn(dispose) );
38
38
 
39
- if (!slot.disposer) {
40
- slot.update(value);
39
+ if (!this.disposer) {
40
+ this.update(value);
41
41
  }
42
- else if (!slot.scheduled) {
43
- slot.scheduled = true;
42
+ else if (!this.scheduled) {
43
+ this.scheduled = true;
44
44
 
45
45
  raf(() => {
46
- slot.scheduled = false;
47
- slot.update(this.value);
46
+ this.scheduled = false;
47
+ this.update(value);
48
48
  });
49
49
  }
50
50
  });