@esportsplus/template 0.15.14 → 0.15.16

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.

Potentially problematic release.


This version of @esportsplus/template might be problematic. Click here for more details.

package/build/slot.js CHANGED
@@ -2,9 +2,9 @@ import { effect, root } from '@esportsplus/reactivity';
2
2
  import { isArray, isFunction, isInstanceOf, isObject } from '@esportsplus/utilities';
3
3
  import { RENDERABLE, RENDERABLE_REACTIVE, SLOT_CLEANUP } from './constants.js';
4
4
  import { hydrate } from './html/index.js';
5
- import { firstChild, nextSibling, nodeValue, raf, text } from './utilities.js';
5
+ import { firstChild, microtask, nextSibling, nodeValue, raf, text } from './utilities.js';
6
6
  import queue from '@esportsplus/queue';
7
- let cleanup = queue(), scheduled = false;
7
+ let cleanup = queue(1024), scheduled = false;
8
8
  function after(anchor, groups) {
9
9
  for (let i = 0, n = groups.length; i < n; i++) {
10
10
  let group = groups[i];
@@ -82,21 +82,22 @@ function schedule() {
82
82
  return;
83
83
  }
84
84
  scheduled = true;
85
- raf.add(() => {
86
- try {
87
- let fns;
88
- while (fns = cleanup.next()) {
89
- for (let i = 0, n = fns.length; i < n; i++) {
90
- fns[i]();
91
- }
85
+ microtask.add(task);
86
+ }
87
+ function task() {
88
+ let fns;
89
+ while (fns = cleanup.next()) {
90
+ for (let i = 0, n = fns.length; i < n; i++) {
91
+ try {
92
+ fns[i]();
92
93
  }
94
+ catch { }
93
95
  }
94
- catch (e) { }
95
- scheduled = false;
96
- if (cleanup.length) {
97
- schedule();
98
- }
99
- });
96
+ }
97
+ scheduled = false;
98
+ if (cleanup.length) {
99
+ schedule();
100
+ }
100
101
  }
101
102
  class Slot {
102
103
  marker;
@@ -21,6 +21,7 @@ declare const nodeValue: (v: any) => void;
21
21
  declare const parentElement: () => any;
22
22
  declare const parentNode: () => any;
23
23
  declare const fragment: (html: string) => DocumentFragment;
24
+ declare const microtask: import("@esportsplus/tasks/build/factory").Scheduler;
24
25
  declare const raf: import("@esportsplus/tasks/build/factory").Scheduler;
25
26
  declare const text: (value: string) => E;
26
- export { addEventListener, className, cloneNode, firstChild, firstElementChild, fragment, innerHTML, nextElementSibling, nextSibling, nodeValue, parentElement, parentNode, prepend, raf, removeAttribute, removeEventListener, setAttribute, text };
27
+ export { addEventListener, className, cloneNode, firstChild, firstElementChild, fragment, innerHTML, microtask, nextElementSibling, nextSibling, nodeValue, parentElement, parentNode, prepend, raf, removeAttribute, removeEventListener, setAttribute, text };
@@ -1,4 +1,4 @@
1
- import { raf as tasks } from '@esportsplus/tasks';
1
+ import { micro as m, raf as r } from '@esportsplus/tasks';
2
2
  let prototype, template = document.createElement('template'), t = document.createTextNode('');
3
3
  prototype = Element.prototype;
4
4
  const addEventListener = prototype.addEventListener;
@@ -23,7 +23,8 @@ const fragment = (html) => {
23
23
  template = cloneNode.call(template);
24
24
  return content;
25
25
  };
26
- const raf = tasks();
26
+ const microtask = m();
27
+ const raf = r();
27
28
  const text = (value) => {
28
29
  let element = cloneNode.call(t);
29
30
  if (value !== '') {
@@ -31,4 +32,4 @@ const text = (value) => {
31
32
  }
32
33
  return element;
33
34
  };
34
- export { addEventListener, className, cloneNode, firstChild, firstElementChild, fragment, innerHTML, nextElementSibling, nextSibling, nodeValue, parentElement, parentNode, prepend, raf, removeAttribute, removeEventListener, setAttribute, text };
35
+ export { addEventListener, className, cloneNode, firstChild, firstElementChild, fragment, innerHTML, microtask, nextElementSibling, nextSibling, nodeValue, parentElement, parentNode, prepend, raf, removeAttribute, removeEventListener, setAttribute, text };
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "author": "ICJR",
3
3
  "dependencies": {
4
- "@esportsplus/queue": "^0.0.1",
5
- "@esportsplus/reactivity": "^0.12.1",
6
- "@esportsplus/tasks": "^0.2.0",
4
+ "@esportsplus/queue": "^0.1.0",
5
+ "@esportsplus/reactivity": "^0.12.3",
6
+ "@esportsplus/tasks": "^0.2.1",
7
7
  "@esportsplus/utilities": "^0.21.1"
8
8
  },
9
9
  "devDependencies": {
@@ -14,7 +14,7 @@
14
14
  "private": false,
15
15
  "type": "module",
16
16
  "types": "./build/index.d.ts",
17
- "version": "0.15.14",
17
+ "version": "0.15.16",
18
18
  "scripts": {
19
19
  "build": "tsc && tsc-alias",
20
20
  "-": "-"
package/src/slot.ts CHANGED
@@ -3,11 +3,11 @@ import { isArray, isFunction, isInstanceOf, isObject } from '@esportsplus/utili
3
3
  import { RENDERABLE, RENDERABLE_REACTIVE, SLOT_CLEANUP } from './constants';
4
4
  import { hydrate } from './html';
5
5
  import { Element, Elements, RenderableReactive, RenderableTemplate } from './types';
6
- import { firstChild, nextSibling, nodeValue, raf, text } from './utilities'
6
+ import { firstChild, microtask, nextSibling, nodeValue, raf, text } from './utilities'
7
7
  import queue from '@esportsplus/queue';
8
8
 
9
9
 
10
- let cleanup = queue<VoidFunction[]>(),
10
+ let cleanup = queue<VoidFunction[]>(1024),
11
11
  scheduled = false;
12
12
 
13
13
 
@@ -111,24 +111,26 @@ function schedule() {
111
111
 
112
112
  scheduled = true;
113
113
 
114
- raf.add(() => {
115
- try {
116
- let fns;
114
+ microtask.add(task);
115
+ }
116
+
117
+ function task() {
118
+ let fns;
117
119
 
118
- while (fns = cleanup.next()) {
119
- for (let i = 0, n = fns.length; i < n; i++) {
120
- fns[i]();
121
- }
120
+ while (fns = cleanup.next()) {
121
+ for (let i = 0, n = fns.length; i < n; i++) {
122
+ try {
123
+ fns[i]();
122
124
  }
125
+ catch { }
123
126
  }
124
- catch(e) { }
127
+ }
125
128
 
126
- scheduled = false;
129
+ scheduled = false;
127
130
 
128
- if (cleanup.length) {
129
- schedule();
130
- }
131
- });
131
+ if (cleanup.length) {
132
+ schedule();
133
+ }
132
134
  }
133
135
 
134
136
 
package/src/utilities.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { raf as tasks } from '@esportsplus/tasks';
1
+ import { micro as m, raf as r } from '@esportsplus/tasks';
2
2
  import { Element as E } from './types';
3
3
 
4
4
 
@@ -54,7 +54,9 @@ const fragment = (html: string) => {
54
54
  return content;
55
55
  };
56
56
 
57
- const raf = tasks();
57
+ const microtask = m();
58
+
59
+ const raf = r();
58
60
 
59
61
  const text = (value: string) => {
60
62
  let element = cloneNode.call(t);
@@ -72,6 +74,7 @@ export {
72
74
  className, cloneNode,
73
75
  firstChild, firstElementChild, fragment,
74
76
  innerHTML,
77
+ microtask,
75
78
  nextElementSibling, nextSibling, nodeValue,
76
79
  parentElement, parentNode, prepend,
77
80
  raf, removeAttribute, removeEventListener,