dom-expressions 0.32.13 → 0.32.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.
- package/package.json +5 -5
- package/src/client.js +7 -0
- package/src/constants.d.ts +2 -0
- package/src/constants.js +279 -1
- package/src/jsx.d.ts +4 -0
- package/src/server.d.ts +1 -1
- package/src/server.js +9 -3
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.16",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"readmeFilename": "README.md",
|
|
12
12
|
"sideEffects": false,
|
|
13
13
|
"scripts": {
|
|
14
|
-
"test": "jest",
|
|
15
|
-
"test:coverage": "jest --coverage",
|
|
14
|
+
"test": "jest --no-cache",
|
|
15
|
+
"test:coverage": "jest --coverage --no-cache",
|
|
16
16
|
"report:coverage": "cat ./coverage/lcov.info | ../../node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"devalue": "^2.0.1"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"babel-plugin-jsx-dom-expressions": "^0.32.
|
|
23
|
+
"babel-plugin-jsx-dom-expressions": "^0.32.16"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "e8f40d02a9e46bf37be05662a7bcb19bd42126b1"
|
|
26
26
|
}
|
package/src/client.js
CHANGED
|
@@ -13,6 +13,7 @@ export {
|
|
|
13
13
|
ChildProperties,
|
|
14
14
|
PropAliases,
|
|
15
15
|
Aliases,
|
|
16
|
+
DOMElements,
|
|
16
17
|
SVGElements,
|
|
17
18
|
SVGNamespace,
|
|
18
19
|
DelegatedEvents
|
|
@@ -315,6 +316,12 @@ function eventHandler(e) {
|
|
|
315
316
|
}
|
|
316
317
|
});
|
|
317
318
|
|
|
319
|
+
// cancel html streaming
|
|
320
|
+
if (sharedConfig.registry && !sharedConfig.done) {
|
|
321
|
+
sharedConfig.done = true;
|
|
322
|
+
document.querySelectorAll("[id^=pl-]").forEach(elem => elem.remove());
|
|
323
|
+
}
|
|
324
|
+
|
|
318
325
|
while (node !== null) {
|
|
319
326
|
const handler = node[key];
|
|
320
327
|
if (handler && !node.disabled) {
|
package/src/constants.d.ts
CHANGED
package/src/constants.js
CHANGED
|
@@ -160,6 +160,283 @@ const SVGNamespace = {
|
|
|
160
160
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
161
161
|
};
|
|
162
162
|
|
|
163
|
+
const DOMElements = new Set([
|
|
164
|
+
"html",
|
|
165
|
+
"base",
|
|
166
|
+
"head",
|
|
167
|
+
"link",
|
|
168
|
+
"meta",
|
|
169
|
+
"style",
|
|
170
|
+
"title",
|
|
171
|
+
"body",
|
|
172
|
+
"address",
|
|
173
|
+
"article",
|
|
174
|
+
"aside",
|
|
175
|
+
"footer",
|
|
176
|
+
"header",
|
|
177
|
+
"main",
|
|
178
|
+
"nav",
|
|
179
|
+
"section",
|
|
180
|
+
"body",
|
|
181
|
+
"blockquote",
|
|
182
|
+
"dd",
|
|
183
|
+
"div",
|
|
184
|
+
"dl",
|
|
185
|
+
"dt",
|
|
186
|
+
"figcaption",
|
|
187
|
+
"figure",
|
|
188
|
+
"hr",
|
|
189
|
+
"li",
|
|
190
|
+
"ol",
|
|
191
|
+
"p",
|
|
192
|
+
"pre",
|
|
193
|
+
"ul",
|
|
194
|
+
"a",
|
|
195
|
+
"abbr",
|
|
196
|
+
"b",
|
|
197
|
+
"bdi",
|
|
198
|
+
"bdo",
|
|
199
|
+
"br",
|
|
200
|
+
"cite",
|
|
201
|
+
"code",
|
|
202
|
+
"data",
|
|
203
|
+
"dfn",
|
|
204
|
+
"em",
|
|
205
|
+
"i",
|
|
206
|
+
"kbd",
|
|
207
|
+
"mark",
|
|
208
|
+
"q",
|
|
209
|
+
"rp",
|
|
210
|
+
"rt",
|
|
211
|
+
"ruby",
|
|
212
|
+
"s",
|
|
213
|
+
"samp",
|
|
214
|
+
"small",
|
|
215
|
+
"span",
|
|
216
|
+
"strong",
|
|
217
|
+
"sub",
|
|
218
|
+
"sup",
|
|
219
|
+
"time",
|
|
220
|
+
"u",
|
|
221
|
+
"var",
|
|
222
|
+
"wbr",
|
|
223
|
+
"area",
|
|
224
|
+
"audio",
|
|
225
|
+
"img",
|
|
226
|
+
"map",
|
|
227
|
+
"track",
|
|
228
|
+
"video",
|
|
229
|
+
"embed",
|
|
230
|
+
"iframe",
|
|
231
|
+
"object",
|
|
232
|
+
"param",
|
|
233
|
+
"picture",
|
|
234
|
+
"portal",
|
|
235
|
+
"source",
|
|
236
|
+
"svg",
|
|
237
|
+
"math",
|
|
238
|
+
"canvas",
|
|
239
|
+
"noscript",
|
|
240
|
+
"script",
|
|
241
|
+
"del",
|
|
242
|
+
"ins",
|
|
243
|
+
"caption",
|
|
244
|
+
"col",
|
|
245
|
+
"colgroup",
|
|
246
|
+
"table",
|
|
247
|
+
"tbody",
|
|
248
|
+
"td",
|
|
249
|
+
"tfoot",
|
|
250
|
+
"th",
|
|
251
|
+
"thead",
|
|
252
|
+
"tr",
|
|
253
|
+
"button",
|
|
254
|
+
"datalist",
|
|
255
|
+
"fieldset",
|
|
256
|
+
"form",
|
|
257
|
+
"input",
|
|
258
|
+
"label",
|
|
259
|
+
"legend",
|
|
260
|
+
"meter",
|
|
261
|
+
"optgroup",
|
|
262
|
+
"option",
|
|
263
|
+
"output",
|
|
264
|
+
"progress",
|
|
265
|
+
"select",
|
|
266
|
+
"textarea",
|
|
267
|
+
"details",
|
|
268
|
+
"dialog",
|
|
269
|
+
"menu",
|
|
270
|
+
"summary",
|
|
271
|
+
"details",
|
|
272
|
+
"slot",
|
|
273
|
+
"template",
|
|
274
|
+
"acronym",
|
|
275
|
+
"applet",
|
|
276
|
+
"basefont",
|
|
277
|
+
"bgsound",
|
|
278
|
+
"big",
|
|
279
|
+
"blink",
|
|
280
|
+
"center",
|
|
281
|
+
"content",
|
|
282
|
+
"dir",
|
|
283
|
+
"font",
|
|
284
|
+
"frame",
|
|
285
|
+
"frameset",
|
|
286
|
+
"hgroup",
|
|
287
|
+
"image",
|
|
288
|
+
"keygen",
|
|
289
|
+
"marquee",
|
|
290
|
+
"menuitem",
|
|
291
|
+
"nobr",
|
|
292
|
+
"noembed",
|
|
293
|
+
"noframes",
|
|
294
|
+
"plaintext",
|
|
295
|
+
"rb",
|
|
296
|
+
"rtc",
|
|
297
|
+
"shadow",
|
|
298
|
+
"spacer",
|
|
299
|
+
"strike",
|
|
300
|
+
"tt",
|
|
301
|
+
"xmp",
|
|
302
|
+
"a",
|
|
303
|
+
"abbr",
|
|
304
|
+
"acronym",
|
|
305
|
+
"address",
|
|
306
|
+
"applet",
|
|
307
|
+
"area",
|
|
308
|
+
"article",
|
|
309
|
+
"aside",
|
|
310
|
+
"audio",
|
|
311
|
+
"b",
|
|
312
|
+
"base",
|
|
313
|
+
"basefont",
|
|
314
|
+
"bdi",
|
|
315
|
+
"bdo",
|
|
316
|
+
"bgsound",
|
|
317
|
+
"big",
|
|
318
|
+
"blink",
|
|
319
|
+
"blockquote",
|
|
320
|
+
"body",
|
|
321
|
+
"br",
|
|
322
|
+
"button",
|
|
323
|
+
"canvas",
|
|
324
|
+
"caption",
|
|
325
|
+
"center",
|
|
326
|
+
"cite",
|
|
327
|
+
"code",
|
|
328
|
+
"col",
|
|
329
|
+
"colgroup",
|
|
330
|
+
"content",
|
|
331
|
+
"data",
|
|
332
|
+
"datalist",
|
|
333
|
+
"dd",
|
|
334
|
+
"del",
|
|
335
|
+
"details",
|
|
336
|
+
"dfn",
|
|
337
|
+
"dialog",
|
|
338
|
+
"dir",
|
|
339
|
+
"div",
|
|
340
|
+
"dl",
|
|
341
|
+
"dt",
|
|
342
|
+
"em",
|
|
343
|
+
"embed",
|
|
344
|
+
"fieldset",
|
|
345
|
+
"figcaption",
|
|
346
|
+
"figure",
|
|
347
|
+
"font",
|
|
348
|
+
"footer",
|
|
349
|
+
"form",
|
|
350
|
+
"frame",
|
|
351
|
+
"frameset",
|
|
352
|
+
"head",
|
|
353
|
+
"header",
|
|
354
|
+
"hgroup",
|
|
355
|
+
"hr",
|
|
356
|
+
"html",
|
|
357
|
+
"i",
|
|
358
|
+
"iframe",
|
|
359
|
+
"image",
|
|
360
|
+
"img",
|
|
361
|
+
"input",
|
|
362
|
+
"ins",
|
|
363
|
+
"kbd",
|
|
364
|
+
"keygen",
|
|
365
|
+
"label",
|
|
366
|
+
"legend",
|
|
367
|
+
"li",
|
|
368
|
+
"link",
|
|
369
|
+
"main",
|
|
370
|
+
"map",
|
|
371
|
+
"mark",
|
|
372
|
+
"marquee",
|
|
373
|
+
"menu",
|
|
374
|
+
"menuitem",
|
|
375
|
+
"meta",
|
|
376
|
+
"meter",
|
|
377
|
+
"nav",
|
|
378
|
+
"nobr",
|
|
379
|
+
"noembed",
|
|
380
|
+
"noframes",
|
|
381
|
+
"noscript",
|
|
382
|
+
"object",
|
|
383
|
+
"ol",
|
|
384
|
+
"optgroup",
|
|
385
|
+
"option",
|
|
386
|
+
"output",
|
|
387
|
+
"p",
|
|
388
|
+
"param",
|
|
389
|
+
"picture",
|
|
390
|
+
"plaintext",
|
|
391
|
+
"portal",
|
|
392
|
+
"pre",
|
|
393
|
+
"progress",
|
|
394
|
+
"q",
|
|
395
|
+
"rb",
|
|
396
|
+
"rp",
|
|
397
|
+
"rt",
|
|
398
|
+
"rtc",
|
|
399
|
+
"ruby",
|
|
400
|
+
"s",
|
|
401
|
+
"samp",
|
|
402
|
+
"script",
|
|
403
|
+
"section",
|
|
404
|
+
"select",
|
|
405
|
+
"shadow",
|
|
406
|
+
"slot",
|
|
407
|
+
"small",
|
|
408
|
+
"source",
|
|
409
|
+
"spacer",
|
|
410
|
+
"span",
|
|
411
|
+
"strike",
|
|
412
|
+
"strong",
|
|
413
|
+
"style",
|
|
414
|
+
"sub",
|
|
415
|
+
"summary",
|
|
416
|
+
"sup",
|
|
417
|
+
"table",
|
|
418
|
+
"tbody",
|
|
419
|
+
"td",
|
|
420
|
+
"template",
|
|
421
|
+
"textarea",
|
|
422
|
+
"tfoot",
|
|
423
|
+
"th",
|
|
424
|
+
"thead",
|
|
425
|
+
"time",
|
|
426
|
+
"title",
|
|
427
|
+
"tr",
|
|
428
|
+
"track",
|
|
429
|
+
"tt",
|
|
430
|
+
"u",
|
|
431
|
+
"ul",
|
|
432
|
+
"var",
|
|
433
|
+
"video",
|
|
434
|
+
"wbr",
|
|
435
|
+
"xmp",
|
|
436
|
+
"input",
|
|
437
|
+
]);
|
|
438
|
+
|
|
439
|
+
|
|
163
440
|
export {
|
|
164
441
|
BooleanAttributes,
|
|
165
442
|
Properties,
|
|
@@ -168,5 +445,6 @@ export {
|
|
|
168
445
|
Aliases,
|
|
169
446
|
DelegatedEvents,
|
|
170
447
|
SVGElements,
|
|
171
|
-
SVGNamespace
|
|
448
|
+
SVGNamespace,
|
|
449
|
+
DOMElements
|
|
172
450
|
};
|
package/src/jsx.d.ts
CHANGED
|
@@ -24,6 +24,9 @@ export namespace JSX {
|
|
|
24
24
|
// empty, libs can define requirements downstream
|
|
25
25
|
}
|
|
26
26
|
type LibraryManagedAttributes<Component, Props> = Props;
|
|
27
|
+
interface ElementAttributesProperty {
|
|
28
|
+
// empty, libs can define requirements downstream
|
|
29
|
+
}
|
|
27
30
|
interface ElementChildrenAttribute {
|
|
28
31
|
children: {};
|
|
29
32
|
}
|
|
@@ -1997,6 +2000,7 @@ export namespace JSX {
|
|
|
1997
2000
|
| "treegrid"
|
|
1998
2001
|
| "treeitem";
|
|
1999
2002
|
autocapitalize?: HTMLAutocapitalize;
|
|
2003
|
+
slot?: string;
|
|
2000
2004
|
color?: string;
|
|
2001
2005
|
itemprop?: string;
|
|
2002
2006
|
itemscope?: boolean;
|
package/src/server.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export function ssr(template: string[] | string, ...nodes: any[]): { t: string }
|
|
|
33
33
|
export function resolveSSRNode(node: any): string;
|
|
34
34
|
export function ssrClassList(value: { [k: string]: boolean }): string;
|
|
35
35
|
export function ssrStyle(value: { [k: string]: string }): string;
|
|
36
|
-
export function ssrSpread(
|
|
36
|
+
export function ssrSpread(props: any, isSVG: boolean, skipChildren: boolean): string;
|
|
37
37
|
export function ssrBoolean(key: string, value: boolean): string;
|
|
38
38
|
export function ssrHydrationKey(): string;
|
|
39
39
|
export function escape(html: string): string;
|
package/src/server.js
CHANGED
|
@@ -3,7 +3,7 @@ import { sharedConfig } from "rxcore";
|
|
|
3
3
|
import devalue from "devalue";
|
|
4
4
|
export { createComponent } from "rxcore";
|
|
5
5
|
|
|
6
|
-
const REPLACE_SCRIPT = `function $df(e,
|
|
6
|
+
const REPLACE_SCRIPT = `function $df(e,t,d,l){d=document.getElementById(e),(l=document.getElementById("pl-"+e))&&l.replaceWith(...d.childNodes),d.remove(),_$HY.set(e,t||null)}`;
|
|
7
7
|
const FRAGMENT_REPLACE = /<!\[([\d-]+)\]>/;
|
|
8
8
|
|
|
9
9
|
export function renderToString(code, options = {}) {
|
|
@@ -295,6 +295,7 @@ export function ssrSpread(props, isSVG, skipChildren) {
|
|
|
295
295
|
// TODO: figure out how to handle props.children
|
|
296
296
|
const keys = Object.keys(props);
|
|
297
297
|
let result = "";
|
|
298
|
+
let classResolved;
|
|
298
299
|
for (let i = 0; i < keys.length; i++) {
|
|
299
300
|
const prop = keys[i];
|
|
300
301
|
if (prop === "children") {
|
|
@@ -304,8 +305,13 @@ export function ssrSpread(props, isSVG, skipChildren) {
|
|
|
304
305
|
const value = props[prop];
|
|
305
306
|
if (prop === "style") {
|
|
306
307
|
result += `style="${ssrStyle(value)}"`;
|
|
307
|
-
} else if (prop === "classList") {
|
|
308
|
-
|
|
308
|
+
} else if (prop === "class" || prop === "className" || prop === "classList") {
|
|
309
|
+
if (classResolved) continue;
|
|
310
|
+
let n;
|
|
311
|
+
result += `class="${(n = props.class) ? n + " " : ""}${
|
|
312
|
+
(n = props.className) ? n + " " : ""
|
|
313
|
+
}${ssrClassList(props.classList)}"`;
|
|
314
|
+
classResolved = true;
|
|
309
315
|
} else if (BooleanAttributes.has(prop)) {
|
|
310
316
|
if (value) result += prop;
|
|
311
317
|
else continue;
|