@lukekaalim/act-web 3.4.0-alpha.1 → 3.4.0-alpha.3
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.
- package/CHANGELOG.md +16 -0
- package/package.json +2 -2
- package/props.ts +6 -0
- package/scheduler.ts +42 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @lukekaalim/act-web
|
|
2
2
|
|
|
3
|
+
## 3.4.0-alpha.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ccb3900: Reconciler should apply all changes in the correct order, and not skip any.
|
|
8
|
+
- Reconciler does send out a Render command once it completes all pending renders (called a "ThreadStack")
|
|
9
|
+
Scheduler has been updated to perform some updates in Sync.
|
|
10
|
+
- Updated dependencies [ccb3900]
|
|
11
|
+
- @lukekaalim/act-recon@3.0.0-alpha.3
|
|
12
|
+
|
|
13
|
+
## 3.4.0-alpha.2
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- Add support for data-\* attributes on HTML elements
|
|
18
|
+
|
|
3
19
|
## 3.4.0-alpha.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lukekaalim/act-web",
|
|
3
|
-
"version": "3.4.0-alpha.
|
|
3
|
+
"version": "3.4.0-alpha.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "mod.ts",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@lukekaalim/act": "^3.1.0",
|
|
8
|
-
"@lukekaalim/act-recon": "^3.0.0-alpha.
|
|
8
|
+
"@lukekaalim/act-recon": "^3.0.0-alpha.3",
|
|
9
9
|
"@lukekaalim/act-backstage": "^3.0.0-alpha.0"
|
|
10
10
|
}
|
|
11
11
|
}
|
package/props.ts
CHANGED
|
@@ -64,6 +64,12 @@ export const setHTMLElementProps = (
|
|
|
64
64
|
setEventProp(node as any, eventName, next, prev);
|
|
65
65
|
return true;
|
|
66
66
|
}
|
|
67
|
+
if (name.startsWith('data-')) {
|
|
68
|
+
if (next === undefined)
|
|
69
|
+
node.removeAttribute(name);
|
|
70
|
+
else
|
|
71
|
+
node.setAttribute(name, next as string);
|
|
72
|
+
}
|
|
67
73
|
switch (name) {
|
|
68
74
|
case 'ref':
|
|
69
75
|
(next as any).current = node;
|
package/scheduler.ts
CHANGED
|
@@ -1,26 +1,53 @@
|
|
|
1
|
-
import { createId } from "@lukekaalim/act";
|
|
2
1
|
import { Scheduler } from "@lukekaalim/act-recon";
|
|
3
2
|
|
|
4
3
|
export const createDOMScheduler = (): Scheduler => {
|
|
5
|
-
const workMap = new Map();
|
|
6
4
|
let id: number | null = null;
|
|
7
|
-
|
|
5
|
+
let callbackFunc = () => console.error(`DOMScheduler got callback before callback function was configured`)
|
|
6
|
+
let synccall_available = false;
|
|
7
|
+
let synccall_requested = false;
|
|
8
|
+
const time_budget = 100;
|
|
9
|
+
|
|
10
|
+
const onTimeout = () => {
|
|
11
|
+
const start = performance.now();
|
|
8
12
|
id = null;
|
|
9
|
-
for (const [,callback] of workMap)
|
|
10
|
-
callback();
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
synccall_available = true;
|
|
15
|
+
// at least 1 call
|
|
16
|
+
callbackFunc();
|
|
17
|
+
|
|
18
|
+
// if callback func re-requested a call,
|
|
19
|
+
// do the rest in sync
|
|
20
|
+
while (synccall_requested) {
|
|
21
|
+
synccall_requested = false;
|
|
22
|
+
const now = performance.now();
|
|
23
|
+
|
|
24
|
+
if (now - start >= time_budget) {
|
|
25
|
+
synccall_available = false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
callbackFunc();
|
|
29
|
+
}
|
|
30
|
+
synccall_available = false;
|
|
31
|
+
}
|
|
32
|
+
|
|
14
33
|
return {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
34
|
+
setCallbackFunc(newCallbackFunc) {
|
|
35
|
+
callbackFunc = newCallbackFunc;
|
|
36
|
+
},
|
|
37
|
+
isCallbackPending() {
|
|
38
|
+
return id !== null;
|
|
39
|
+
},
|
|
40
|
+
requestCallback() {
|
|
41
|
+
if (synccall_available) {
|
|
42
|
+
synccall_requested = true;
|
|
43
|
+
}
|
|
44
|
+
else if (!id) {
|
|
45
|
+
id = window.setTimeout(onTimeout, 0);
|
|
46
|
+
}
|
|
21
47
|
},
|
|
22
|
-
|
|
23
|
-
|
|
48
|
+
cancelCallback() {
|
|
49
|
+
if (id !== null)
|
|
50
|
+
window.clearTimeout(id);
|
|
24
51
|
},
|
|
25
52
|
}
|
|
26
53
|
}
|