dom-expressions 0.34.0 → 0.34.1

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 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.34.0",
4
+ "version": "0.34.1",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -23,8 +23,8 @@
23
23
  "csstype": "^3.0"
24
24
  },
25
25
  "devDependencies": {
26
- "babel-plugin-jsx-dom-expressions": "^0.34.0",
26
+ "babel-plugin-jsx-dom-expressions": "^0.34.1",
27
27
  "csstype": "^3.1.0"
28
28
  },
29
- "gitHead": "4a2f5a8af46437c71b0c30a5242213fc87669515"
29
+ "gitHead": "5e49406921a4fde147b9b64edbfa8fc8c096fbda"
30
30
  }
package/src/client.d.ts CHANGED
@@ -67,4 +67,4 @@ export function getAssets(): string;
67
67
  export function Assets(props: { children?: JSX.Element }): JSX.Element;
68
68
  export function HydrationScript(): JSX.Element;
69
69
  export function NoHydration(props: { children?: JSX.Element }): JSX.Element;
70
- export function getHydrationScript(): string;
70
+ export function generateHydrationScript(): string;
package/src/client.js CHANGED
@@ -223,6 +223,7 @@ export function hydrate(code, element, options = {}) {
223
223
  export function getNextElement(template) {
224
224
  let node, key;
225
225
  if (!sharedConfig.context || !(node = sharedConfig.registry.get((key = getHydrationKey())))) {
226
+ if ("_DX_DEV_" && !template) throw new Error("Unrecoverable Hydration Mismatch. No template for key: " + key);
226
227
  return template.cloneNode(true);
227
228
  }
228
229
  if (sharedConfig.completed) sharedConfig.completed.add(node);
@@ -462,7 +463,11 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
462
463
  if (unwrap) {
463
464
  while (typeof item === "function") item = item();
464
465
  dynamic =
465
- normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic;
466
+ normalizeIncomingArray(
467
+ normalized,
468
+ Array.isArray(item) ? item : [item],
469
+ Array.isArray(prev) ? prev : [prev]
470
+ ) || dynamic;
466
471
  } else {
467
472
  normalized.push(item);
468
473
  dynamic = true;
package/src/jsx-h.d.ts CHANGED
@@ -283,9 +283,10 @@ export namespace JSX {
283
283
  onanimationiteration?: EventHandlerUnion<T, AnimationEvent>;
284
284
  ontransitionend?: EventHandlerUnion<T, TransitionEvent>;
285
285
  }
286
-
286
+
287
287
  interface CSSProperties extends csstype.PropertiesHyphen {
288
288
  // Override
289
+ [key: `—${string}`]: string | number | undefined
289
290
  }
290
291
 
291
292
  type HTMLAutocapitalize = "off" | "none" | "on" | "sentences" | "words" | "characters";
@@ -527,6 +528,77 @@ export namespace JSX {
527
528
  "aria-valuenow"?: number | string;
528
529
  /** Defines the human readable text alternative of aria-valuenow for a range widget. */
529
530
  "aria-valuetext"?: string;
531
+ role?: FunctionMaybe<
532
+ | "alert"
533
+ | "alertdialog"
534
+ | "application"
535
+ | "article"
536
+ | "banner"
537
+ | "button"
538
+ | "cell"
539
+ | "checkbox"
540
+ | "columnheader"
541
+ | "combobox"
542
+ | "complementary"
543
+ | "contentinfo"
544
+ | "definition"
545
+ | "dialog"
546
+ | "directory"
547
+ | "document"
548
+ | "feed"
549
+ | "figure"
550
+ | "form"
551
+ | "grid"
552
+ | "gridcell"
553
+ | "group"
554
+ | "heading"
555
+ | "img"
556
+ | "link"
557
+ | "list"
558
+ | "listbox"
559
+ | "listitem"
560
+ | "log"
561
+ | "main"
562
+ | "marquee"
563
+ | "math"
564
+ | "menu"
565
+ | "menubar"
566
+ | "menuitem"
567
+ | "menuitemcheckbox"
568
+ | "menuitemradio"
569
+ | "meter"
570
+ | "navigation"
571
+ | "none"
572
+ | "note"
573
+ | "option"
574
+ | "presentation"
575
+ | "progressbar"
576
+ | "radio"
577
+ | "radiogroup"
578
+ | "region"
579
+ | "row"
580
+ | "rowgroup"
581
+ | "rowheader"
582
+ | "scrollbar"
583
+ | "search"
584
+ | "searchbox"
585
+ | "separator"
586
+ | "slider"
587
+ | "spinbutton"
588
+ | "status"
589
+ | "switch"
590
+ | "tab"
591
+ | "table"
592
+ | "tablist"
593
+ | "tabpanel"
594
+ | "term"
595
+ | "textbox"
596
+ | "timer"
597
+ | "toolbar"
598
+ | "tooltip"
599
+ | "tree"
600
+ | "treegrid"
601
+ | "treeitem">;
530
602
  }
531
603
 
532
604
  interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
@@ -552,77 +624,6 @@ export namespace JSX {
552
624
  resource?: FunctionMaybe<string>;
553
625
  typeof?: FunctionMaybe<string>;
554
626
  vocab?: FunctionMaybe<string>;
555
- role?: FunctionMaybe<
556
- | "alert"
557
- | "alertdialog"
558
- | "application"
559
- | "article"
560
- | "banner"
561
- | "button"
562
- | "cell"
563
- | "checkbox"
564
- | "columnheader"
565
- | "combobox"
566
- | "complementary"
567
- | "contentinfo"
568
- | "definition"
569
- | "dialog"
570
- | "directory"
571
- | "document"
572
- | "feed"
573
- | "figure"
574
- | "form"
575
- | "grid"
576
- | "gridcell"
577
- | "group"
578
- | "heading"
579
- | "img"
580
- | "link"
581
- | "list"
582
- | "listbox"
583
- | "listitem"
584
- | "log"
585
- | "main"
586
- | "marquee"
587
- | "math"
588
- | "menu"
589
- | "menubar"
590
- | "menuitem"
591
- | "menuitemcheckbox"
592
- | "menuitemradio"
593
- | "meter"
594
- | "navigation"
595
- | "none"
596
- | "note"
597
- | "option"
598
- | "presentation"
599
- | "progressbar"
600
- | "radio"
601
- | "radiogroup"
602
- | "region"
603
- | "row"
604
- | "rowgroup"
605
- | "rowheader"
606
- | "scrollbar"
607
- | "search"
608
- | "searchbox"
609
- | "separator"
610
- | "slider"
611
- | "spinbutton"
612
- | "status"
613
- | "switch"
614
- | "tab"
615
- | "table"
616
- | "tablist"
617
- | "tabpanel"
618
- | "term"
619
- | "textbox"
620
- | "timer"
621
- | "toolbar"
622
- | "tooltip"
623
- | "tree"
624
- | "treegrid"
625
- | "treeitem">;
626
627
  autocapitalize?: FunctionMaybe<HTMLAutocapitalize>;
627
628
  slot?: FunctionMaybe<string>;
628
629
  color?: FunctionMaybe<string>;
@@ -1082,7 +1083,7 @@ export namespace JSX {
1082
1083
  | "defer xMidYMax slice"
1083
1084
  | "defer xMaxYMax slice";
1084
1085
  type SVGUnits = "userSpaceOnUse" | "objectBoundingBox";
1085
- interface CoreSVGAttributes<T> extends DOMAttributes<T> {
1086
+ interface CoreSVGAttributes<T> extends AriaAttributes, DOMAttributes<T> {
1086
1087
  id?: FunctionMaybe<string>;
1087
1088
  lang?: FunctionMaybe<string>;
1088
1089
  tabIndex?: FunctionMaybe<number | string>;
package/src/jsx.d.ts CHANGED
@@ -285,6 +285,7 @@ export namespace JSX {
285
285
 
286
286
  interface CSSProperties extends csstype.PropertiesHyphen {
287
287
  // Override
288
+ [key: `—${string}`]: string | number | undefined
288
289
  }
289
290
 
290
291
  type HTMLAutocapitalize = "off" | "none" | "on" | "sentences" | "words" | "characters";
@@ -526,40 +527,6 @@ export namespace JSX {
526
527
  "aria-valuenow"?: number | string;
527
528
  /** Defines the human readable text alternative of aria-valuenow for a range widget. */
528
529
  "aria-valuetext"?: string;
529
- }
530
-
531
- // TODO: Should we allow this?
532
- // type ClassKeys = `class:${string}`;
533
- // type CSSKeys = Exclude<keyof csstype.PropertiesHyphen, `-${string}`>;
534
-
535
- // type CSSAttributes = {
536
- // [key in CSSKeys as `style:${key}`]: csstype.PropertiesHyphen[key];
537
- // };
538
-
539
- interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
540
- // [key: ClassKeys]: boolean;
541
- accessKey?: string;
542
- class?: string;
543
- contenteditable?: boolean | "inherit";
544
- contextmenu?: string;
545
- dir?: HTMLDir;
546
- draggable?: boolean;
547
- hidden?: boolean;
548
- id?: string;
549
- lang?: string;
550
- spellcheck?: boolean;
551
- style?: CSSProperties | string;
552
- tabindex?: number | string;
553
- title?: string;
554
- translate?: "yes" | "no";
555
- about?: string;
556
- datatype?: string;
557
- inlist?: any;
558
- prefix?: string;
559
- property?: string;
560
- resource?: string;
561
- typeof?: string;
562
- vocab?: string;
563
530
  role?:
564
531
  | "alert"
565
532
  | "alertdialog"
@@ -631,6 +598,40 @@ export namespace JSX {
631
598
  | "tree"
632
599
  | "treegrid"
633
600
  | "treeitem";
601
+ }
602
+
603
+ // TODO: Should we allow this?
604
+ // type ClassKeys = `class:${string}`;
605
+ // type CSSKeys = Exclude<keyof csstype.PropertiesHyphen, `-${string}`>;
606
+
607
+ // type CSSAttributes = {
608
+ // [key in CSSKeys as `style:${key}`]: csstype.PropertiesHyphen[key];
609
+ // };
610
+
611
+ interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
612
+ // [key: ClassKeys]: boolean;
613
+ accessKey?: string;
614
+ class?: string;
615
+ contenteditable?: boolean | "inherit";
616
+ contextmenu?: string;
617
+ dir?: HTMLDir;
618
+ draggable?: boolean;
619
+ hidden?: boolean;
620
+ id?: string;
621
+ lang?: string;
622
+ spellcheck?: boolean;
623
+ style?: CSSProperties | string;
624
+ tabindex?: number | string;
625
+ title?: string;
626
+ translate?: "yes" | "no";
627
+ about?: string;
628
+ datatype?: string;
629
+ inlist?: any;
630
+ prefix?: string;
631
+ property?: string;
632
+ resource?: string;
633
+ typeof?: string;
634
+ vocab?: string;
634
635
  autocapitalize?: HTMLAutocapitalize;
635
636
  slot?: string;
636
637
  color?: string;
@@ -1090,7 +1091,7 @@ export namespace JSX {
1090
1091
  | "defer xMidYMax slice"
1091
1092
  | "defer xMaxYMax slice";
1092
1093
  type SVGUnits = "userSpaceOnUse" | "objectBoundingBox";
1093
- interface CoreSVGAttributes<T> extends DOMAttributes<T> {
1094
+ interface CoreSVGAttributes<T> extends AriaAttributes, DOMAttributes<T> {
1094
1095
  id?: string;
1095
1096
  lang?: string;
1096
1097
  tabIndex?: number | string;
package/src/server.js CHANGED
@@ -290,8 +290,9 @@ export function ssrElement(tag, props, children, needsId) {
290
290
  let classResolved;
291
291
  for (let i = 0; i < keys.length; i++) {
292
292
  const prop = keys[i];
293
- if (ChildProperties.has(prop) && children === undefined) {
294
- children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
293
+ if (ChildProperties.has(prop)) {
294
+ if (children === undefined)
295
+ children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
295
296
  continue;
296
297
  }
297
298
  const value = props[prop];