dom-expressions 0.32.0 → 0.32.4
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/package.json +2 -2
- package/src/client.d.ts +1 -1
- package/src/client.js +3 -2
- package/src/jsx.d.ts +2 -0
- package/src/server.d.ts +3 -2
- package/src/server.js +16 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dom-expressions",
|
|
3
3
|
"description": "A Fine-Grained Runtime for Performant DOM Rendering",
|
|
4
|
-
"version": "0.32.
|
|
4
|
+
"version": "0.32.4",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"babel-plugin-jsx-dom-expressions": "^0.32.0"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "fb410f2b94e8069bf0b5ec737ce1a2a6a1aba7a2"
|
|
26
26
|
}
|
package/src/client.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export function spread<T>(
|
|
|
30
30
|
export function assign(node: Element, props: any, isSVG?: Boolean, skipChildren?: Boolean): void;
|
|
31
31
|
export function setAttribute(node: Element, name: string, value: string): void;
|
|
32
32
|
export function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
|
|
33
|
-
export function innerHTML(node: Element, content: string);
|
|
33
|
+
export function innerHTML(node: Element, content: string): void;
|
|
34
34
|
export function addEventListener(
|
|
35
35
|
node: Element,
|
|
36
36
|
name: string,
|
package/src/client.js
CHANGED
|
@@ -373,7 +373,8 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
373
373
|
return current;
|
|
374
374
|
}
|
|
375
375
|
if (array.length === 0) {
|
|
376
|
-
cleanChildren(parent, current, marker);
|
|
376
|
+
current = cleanChildren(parent, current, marker);
|
|
377
|
+
if (multi) return current;
|
|
377
378
|
} else if (Array.isArray(current)) {
|
|
378
379
|
if (current.length === 0) {
|
|
379
380
|
appendNodes(parent, array, marker);
|
|
@@ -384,7 +385,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
384
385
|
}
|
|
385
386
|
current = array;
|
|
386
387
|
} else if (value instanceof Node) {
|
|
387
|
-
if (sharedConfig.context)
|
|
388
|
+
if (sharedConfig.context && current && current.length)
|
|
388
389
|
return (current = value.parentNode ? (multi ? [value] : value) : current);
|
|
389
390
|
if (Array.isArray(current)) {
|
|
390
391
|
if (multi) return (current = cleanChildren(parent, current, marker, value));
|
package/src/jsx.d.ts
CHANGED
|
@@ -2085,6 +2085,8 @@ export namespace JSX {
|
|
|
2085
2085
|
}
|
|
2086
2086
|
interface DetailsHtmlAttributes<T> extends HTMLAttributes<T> {
|
|
2087
2087
|
open?: boolean;
|
|
2088
|
+
onToggle?: EventHandlerUnion<T, Event>;
|
|
2089
|
+
ontoggle?: EventHandlerUnion<T, Event>;
|
|
2088
2090
|
}
|
|
2089
2091
|
interface DialogHtmlAttributes<T> extends HTMLAttributes<T> {
|
|
2090
2092
|
open?: boolean;
|
package/src/server.d.ts
CHANGED
|
@@ -18,8 +18,8 @@ export function renderToStream<T>(
|
|
|
18
18
|
options?: {
|
|
19
19
|
nonce?: string;
|
|
20
20
|
renderId?: string;
|
|
21
|
-
onCompleteShell?: () => void;
|
|
22
|
-
onCompleteAll?: () => void;
|
|
21
|
+
onCompleteShell?: (info: { write: (v: string) => void }) => void;
|
|
22
|
+
onCompleteAll?: (info: { write: (v: string) => void }) => void;
|
|
23
23
|
}
|
|
24
24
|
): {
|
|
25
25
|
pipe: (writable: { write: (v: string) => void }) => void;
|
|
@@ -47,6 +47,7 @@ export function generateHydrationScript(options: { nonce?: string; eventNames?:
|
|
|
47
47
|
|
|
48
48
|
// deprecated
|
|
49
49
|
export type LegacyResults = {
|
|
50
|
+
write: (text: string) => void;
|
|
50
51
|
startWriting: () => void;
|
|
51
52
|
};
|
|
52
53
|
export function pipeToWritable<T>(
|
package/src/server.js
CHANGED
|
@@ -96,7 +96,12 @@ export function renderToStream(code, options = {}) {
|
|
|
96
96
|
const checkEnd = () => {
|
|
97
97
|
if (!registry.size && !completed) {
|
|
98
98
|
writeTasks();
|
|
99
|
-
onCompleteAll &&
|
|
99
|
+
onCompleteAll &&
|
|
100
|
+
onCompleteAll({
|
|
101
|
+
write(v) {
|
|
102
|
+
!completed && buffer.write(v);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
100
105
|
writable && writable.end();
|
|
101
106
|
completed = true;
|
|
102
107
|
}
|
|
@@ -182,7 +187,12 @@ export function renderToStream(code, options = {}) {
|
|
|
182
187
|
buffer.write(html);
|
|
183
188
|
tasks.length = 0;
|
|
184
189
|
scheduled = false;
|
|
185
|
-
onCompleteShell &&
|
|
190
|
+
onCompleteShell &&
|
|
191
|
+
onCompleteShell({
|
|
192
|
+
write(v) {
|
|
193
|
+
!completed && buffer.write(v);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
186
196
|
});
|
|
187
197
|
|
|
188
198
|
return {
|
|
@@ -444,8 +454,9 @@ function serializeSet(registry, key, value) {
|
|
|
444
454
|
*/
|
|
445
455
|
export function pipeToNodeWritable(code, writable, options = {}) {
|
|
446
456
|
if (options.onReady) {
|
|
447
|
-
options.onCompleteShell = () => {
|
|
457
|
+
options.onCompleteShell = ({ write }) => {
|
|
448
458
|
options.onReady({
|
|
459
|
+
write,
|
|
449
460
|
startWriting() {
|
|
450
461
|
stream.pipe(writable);
|
|
451
462
|
}
|
|
@@ -462,8 +473,9 @@ export function pipeToNodeWritable(code, writable, options = {}) {
|
|
|
462
473
|
*/
|
|
463
474
|
export function pipeToWritable(code, writable, options = {}) {
|
|
464
475
|
if (options.onReady) {
|
|
465
|
-
options.onCompleteShell = () => {
|
|
476
|
+
options.onCompleteShell = ({ write }) => {
|
|
466
477
|
options.onReady({
|
|
478
|
+
write,
|
|
467
479
|
startWriting() {
|
|
468
480
|
stream.pipeTo(writable);
|
|
469
481
|
}
|