@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 +16 -15
- package/build/utilities.d.ts +2 -1
- package/build/utilities.js +4 -3
- package/package.json +4 -4
- package/src/slot.ts +17 -15
- package/src/utilities.ts +5 -2
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
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
});
|
|
96
|
+
}
|
|
97
|
+
scheduled = false;
|
|
98
|
+
if (cleanup.length) {
|
|
99
|
+
schedule();
|
|
100
|
+
}
|
|
100
101
|
}
|
|
101
102
|
class Slot {
|
|
102
103
|
marker;
|
package/build/utilities.d.ts
CHANGED
|
@@ -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 };
|
package/build/utilities.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { raf as
|
|
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
|
|
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
|
|
5
|
-
"@esportsplus/reactivity": "^0.12.
|
|
6
|
-
"@esportsplus/tasks": "^0.2.
|
|
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.
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
microtask.add(task);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function task() {
|
|
118
|
+
let fns;
|
|
117
119
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
|
-
|
|
127
|
+
}
|
|
125
128
|
|
|
126
|
-
|
|
129
|
+
scheduled = false;
|
|
127
130
|
|
|
128
|
-
|
|
129
|
-
|
|
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
|
|
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
|
|
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,
|