@esportsplus/template 0.26.0 → 0.26.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.
@@ -1,4 +1,4 @@
1
- import { read, root, set, signal } from '@esportsplus/reactivity';
1
+ import { root } from '@esportsplus/reactivity';
2
2
  import { EMPTY_FRAGMENT } from '../constants.js';
3
3
  import { append } from '../utilities/fragment.js';
4
4
  import { cloneNode, firstChild, lastChild } from '../utilities/node.js';
@@ -9,7 +9,6 @@ class ArraySlot {
9
9
  marker;
10
10
  nodes = [];
11
11
  template;
12
- trigger = signal(false);
13
12
  constructor(anchor, array, template) {
14
13
  let fragment = this.fragment = cloneNode.call(EMPTY_FRAGMENT);
15
14
  this.array = array;
@@ -46,7 +45,6 @@ class ArraySlot {
46
45
  });
47
46
  }
48
47
  get length() {
49
- read(this.trigger);
50
48
  return this.nodes.length;
51
49
  }
52
50
  set length(n) {
@@ -59,7 +57,6 @@ class ArraySlot {
59
57
  else {
60
58
  this.splice(n);
61
59
  }
62
- set(this.trigger, !!this.trigger.value);
63
60
  }
64
61
  anchor(index = this.nodes.length - 1) {
65
62
  let node = this.nodes[index];
@@ -70,20 +67,17 @@ class ArraySlot {
70
67
  }
71
68
  clear() {
72
69
  remove(...this.nodes.splice(0));
73
- set(this.trigger, !!this.trigger.value);
74
70
  }
75
71
  pop() {
76
72
  let group = this.nodes.pop();
77
73
  if (group) {
78
74
  remove(group);
79
- set(this.trigger, !!this.trigger.value);
80
75
  }
81
76
  }
82
77
  push(items) {
83
78
  let anchor = this.anchor();
84
79
  this.nodes.push(...items.map(this.template));
85
80
  anchor.after(this.fragment);
86
- set(this.trigger, !!this.trigger.value);
87
81
  }
88
82
  render() {
89
83
  if (this.nodes.length) {
@@ -96,23 +90,19 @@ class ArraySlot {
96
90
  let group = this.nodes.shift();
97
91
  if (group) {
98
92
  remove(group);
99
- set(this.trigger, !!this.trigger.value);
100
93
  }
101
94
  }
102
95
  splice(start, stop = this.nodes.length, ...items) {
103
96
  if (!items.length) {
104
97
  remove(...this.nodes.splice(start, stop));
105
- set(this.trigger, !!this.trigger.value);
106
98
  return;
107
99
  }
108
100
  remove(...this.nodes.splice(start, stop, ...items.map(this.template)));
109
101
  this.anchor(start - 1).after(this.fragment);
110
- set(this.trigger, !!this.trigger.value);
111
102
  }
112
103
  unshift(items) {
113
104
  this.nodes.unshift(...items.map(this.template));
114
105
  this.marker.after(this.fragment);
115
- set(this.trigger, !!this.trigger.value);
116
106
  }
117
107
  }
118
108
  export default (anchor, renderable) => {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "ICJR",
3
3
  "dependencies": {
4
4
  "@esportsplus/queue": "^0.1.0",
5
- "@esportsplus/reactivity": "^0.17.2",
5
+ "@esportsplus/reactivity": "^0.18.0",
6
6
  "@esportsplus/tasks": "^0.2.1",
7
7
  "@esportsplus/utilities": "^0.22.2"
8
8
  },
@@ -14,7 +14,7 @@
14
14
  "private": false,
15
15
  "type": "module",
16
16
  "types": "./build/index.d.ts",
17
- "version": "0.26.0",
17
+ "version": "0.26.2",
18
18
  "scripts": {
19
19
  "build": "tsc && tsc-alias",
20
20
  "-": "-"
package/src/slot/array.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { read, root, set, signal, ReactiveArray } from '@esportsplus/reactivity';
1
+ import { root, ReactiveArray } from '@esportsplus/reactivity';
2
2
  import { EMPTY_FRAGMENT } from '~/constants';
3
3
  import { RenderableReactive, SlotGroup } from '~/types';
4
4
  import { append } from '~/utilities/fragment';
@@ -12,7 +12,6 @@ class ArraySlot<T> {
12
12
  marker: Element;
13
13
  nodes: SlotGroup[] = [];
14
14
  template: (...args: Parameters< RenderableReactive<T>['template'] >) => SlotGroup;
15
- trigger = signal(false);
16
15
 
17
16
 
18
17
  constructor(anchor: Element, array: ReactiveArray<T>, template: RenderableReactive<T>['template']) {
@@ -59,7 +58,6 @@ class ArraySlot<T> {
59
58
 
60
59
 
61
60
  get length() {
62
- read(this.trigger);
63
61
  return this.nodes.length;
64
62
  }
65
63
 
@@ -73,8 +71,6 @@ class ArraySlot<T> {
73
71
  else {
74
72
  this.splice(n);
75
73
  }
76
-
77
- set(this.trigger, !!this.trigger.value);
78
74
  }
79
75
 
80
76
 
@@ -90,7 +86,7 @@ class ArraySlot<T> {
90
86
 
91
87
  clear() {
92
88
  remove(...this.nodes.splice(0));
93
- set(this.trigger, !!this.trigger.value);
89
+
94
90
  }
95
91
 
96
92
  pop() {
@@ -98,7 +94,6 @@ class ArraySlot<T> {
98
94
 
99
95
  if (group) {
100
96
  remove(group);
101
- set(this.trigger, !!this.trigger.value);
102
97
  }
103
98
  }
104
99
 
@@ -108,7 +103,6 @@ class ArraySlot<T> {
108
103
  this.nodes.push( ...items.map(this.template) );
109
104
 
110
105
  anchor.after(this.fragment);
111
- set(this.trigger, !!this.trigger.value);
112
106
  }
113
107
 
114
108
  render() {
@@ -125,28 +119,22 @@ class ArraySlot<T> {
125
119
 
126
120
  if (group) {
127
121
  remove(group);
128
- set(this.trigger, !!this.trigger.value);
129
122
  }
130
123
  }
131
124
 
132
125
  splice(start: number, stop: number = this.nodes.length, ...items: T[]) {
133
126
  if (!items.length) {
134
127
  remove(...this.nodes.splice(start, stop));
135
- set(this.trigger, !!this.trigger.value);
136
128
  return;
137
129
  }
138
130
 
139
131
  remove( ...this.nodes.splice(start, stop, ...items.map(this.template)) );
140
132
  this.anchor(start - 1).after(this.fragment);
141
-
142
- set(this.trigger, !!this.trigger.value);
143
133
  }
144
134
 
145
135
  unshift(items: T[]) {
146
136
  this.nodes.unshift(...items.map(this.template));
147
137
  this.marker.after(this.fragment);
148
-
149
- set(this.trigger, !!this.trigger.value);
150
138
  }
151
139
  }
152
140