@esportsplus/template 0.24.0 → 0.25.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.
@@ -13,10 +13,10 @@ class ArraySlot {
13
13
  let fragment = this.fragment = cloneNode.call(EMPTY_FRAGMENT);
14
14
  this.array = array;
15
15
  this.marker = anchor;
16
- this.template = function (data) {
16
+ this.template = function (data, i) {
17
17
  let dispose, frag = root((d) => {
18
18
  dispose = d;
19
- return template(data);
19
+ return template(data, i);
20
20
  }), group = {
21
21
  head: firstChild.call(frag),
22
22
  tail: lastChild.call(frag)
@@ -105,7 +105,7 @@ class ArraySlot {
105
105
  }
106
106
  }
107
107
  export default (anchor, renderable) => {
108
- let { array, template } = renderable, slot = new ArraySlot(anchor, array, template);
108
+ let array = renderable.array, slot = new ArraySlot(anchor, array, renderable.template);
109
109
  if (array.length) {
110
110
  root(() => {
111
111
  slot.nodes = array.map(slot.template);
package/build/types.d.ts CHANGED
@@ -24,7 +24,7 @@ type Renderable<T> = DocumentFragment | Effect<T> | Node | NodeList | Primitive
24
24
  type RenderableReactive<T> = Readonly<{
25
25
  [RENDERABLE]: typeof RENDERABLE_HTML_REACTIVE_ARRAY;
26
26
  array: ReactiveArray<T>;
27
- template: (value: T) => ReturnType<typeof html>;
27
+ template: (value: T, i: number) => ReturnType<typeof html>;
28
28
  }>;
29
29
  type SlotGroup = {
30
30
  head: Element;
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "private": false,
15
15
  "type": "module",
16
16
  "types": "./build/index.d.ts",
17
- "version": "0.24.0",
17
+ "version": "0.25.0",
18
18
  "scripts": {
19
19
  "build": "tsc && tsc-alias",
20
20
  "-": "-"
package/src/slot/array.ts CHANGED
@@ -19,11 +19,11 @@ class ArraySlot<T> {
19
19
 
20
20
  this.array = array;
21
21
  this.marker = anchor;
22
- this.template = function (data) {
22
+ this.template = function (data, i) {
23
23
  let dispose: VoidFunction,
24
24
  frag = root((d) => {
25
25
  dispose = d;
26
- return template(data);
26
+ return template(data, i);
27
27
  }),
28
28
  group = {
29
29
  head: firstChild.call(frag),
@@ -138,8 +138,8 @@ class ArraySlot<T> {
138
138
 
139
139
 
140
140
  export default <T>(anchor: Element, renderable: RenderableReactive<T>) => {
141
- let { array, template } = renderable,
142
- slot = new ArraySlot(anchor, array, template);
141
+ let array = renderable.array,
142
+ slot = new ArraySlot(anchor, array, renderable.template);
143
143
 
144
144
  if (array.length) {
145
145
  root(() => {
package/src/types.ts CHANGED
@@ -34,7 +34,7 @@ type Renderable<T> = DocumentFragment | Effect<T> | Node | NodeList | Primitive
34
34
  type RenderableReactive<T> = Readonly<{
35
35
  [RENDERABLE]: typeof RENDERABLE_HTML_REACTIVE_ARRAY;
36
36
  array: ReactiveArray<T>;
37
- template: (value: T) => ReturnType<typeof html>;
37
+ template: (value: T, i: number) => ReturnType<typeof html>;
38
38
  }>;
39
39
 
40
40
  type SlotGroup = {