@mpen/jsxhtml 0.2.2 → 0.4.0

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.
Files changed (169) hide show
  1. package/dist/classnames.d.ts +11 -0
  2. package/dist/classnames.test.d.ts +1 -0
  3. package/dist/css-escape.d.ts +25 -0
  4. package/dist/custom/C.d.ts +6 -0
  5. package/dist/custom/Checkbox.d.ts +5 -0
  6. package/dist/custom/ColorInput.d.ts +5 -0
  7. package/dist/custom/DateInput.d.ts +5 -0
  8. package/dist/custom/DocType.d.ts +6 -0
  9. package/dist/custom/EmailInput.d.ts +5 -0
  10. package/dist/custom/Empty.d.ts +4 -0
  11. package/dist/custom/FileInput.d.ts +5 -0
  12. package/dist/custom/HtmlDocument.d.ts +5 -0
  13. package/dist/custom/NumberInput.d.ts +5 -0
  14. package/dist/custom/PasswordInput.d.ts +5 -0
  15. package/dist/custom/RadioButton.d.ts +5 -0
  16. package/dist/custom/RangeInput.d.ts +5 -0
  17. package/dist/custom/RawHtml.d.ts +6 -0
  18. package/dist/custom/SearchInput.d.ts +5 -0
  19. package/dist/custom/TelephoneInput.d.ts +5 -0
  20. package/dist/custom/TextInput.d.ts +5 -0
  21. package/dist/custom/TimeInput.d.ts +5 -0
  22. package/dist/custom/UrlInput.d.ts +5 -0
  23. package/dist/custom/WeekInput.d.ts +5 -0
  24. package/dist/custom/index.d.ts +20 -0
  25. package/dist/custom-components.d.ts +1 -23
  26. package/dist/htmlspec/IntrinsicElements.d.ts +568 -147
  27. package/dist/htmlspec/attributes/AriaAttributes.d.ts +11 -0
  28. package/dist/htmlspec/attributes/ElementAttributes.d.ts +28 -0
  29. package/dist/htmlspec/attributes/EventHandlers.d.ts +102 -0
  30. package/dist/htmlspec/attributes/GlobalAttributes.d.ts +11 -0
  31. package/dist/htmlspec/{GlobalAttributes.d.ts → attributes/StandardGlobalAttributes.d.ts} +26 -37
  32. package/dist/htmlspec/attributes/index.d.ts +7 -0
  33. package/dist/htmlspec/elements/a.d.ts +71 -0
  34. package/dist/htmlspec/elements/abbr.d.ts +4 -0
  35. package/dist/htmlspec/elements/address.d.ts +4 -0
  36. package/dist/htmlspec/elements/area.d.ts +66 -0
  37. package/dist/htmlspec/elements/article.d.ts +4 -0
  38. package/dist/htmlspec/elements/aside.d.ts +4 -0
  39. package/dist/htmlspec/elements/audio.d.ts +45 -0
  40. package/dist/htmlspec/elements/b.d.ts +4 -0
  41. package/dist/htmlspec/elements/base.d.ts +18 -0
  42. package/dist/htmlspec/elements/bdi.d.ts +4 -0
  43. package/dist/htmlspec/elements/bdo.d.ts +4 -0
  44. package/dist/htmlspec/elements/blockquote.d.ts +8 -0
  45. package/dist/htmlspec/elements/body.d.ts +92 -0
  46. package/dist/htmlspec/elements/br.d.ts +4 -0
  47. package/dist/htmlspec/elements/button.d.ts +103 -0
  48. package/dist/htmlspec/elements/canvas.d.ts +13 -0
  49. package/dist/htmlspec/elements/caption.d.ts +4 -0
  50. package/dist/htmlspec/elements/cite.d.ts +4 -0
  51. package/dist/htmlspec/elements/code.d.ts +4 -0
  52. package/dist/htmlspec/elements/col.d.ts +9 -0
  53. package/dist/htmlspec/elements/colgroup.d.ts +9 -0
  54. package/dist/htmlspec/elements/data.d.ts +9 -0
  55. package/dist/htmlspec/elements/datalist.d.ts +4 -0
  56. package/dist/htmlspec/elements/dd.d.ts +4 -0
  57. package/dist/htmlspec/elements/del.d.ts +12 -0
  58. package/dist/htmlspec/elements/details.d.ts +12 -0
  59. package/dist/htmlspec/elements/dfn.d.ts +4 -0
  60. package/dist/htmlspec/elements/dialog.d.ts +17 -0
  61. package/dist/htmlspec/elements/div.d.ts +4 -0
  62. package/dist/htmlspec/elements/dl.d.ts +4 -0
  63. package/dist/htmlspec/elements/dt.d.ts +4 -0
  64. package/dist/htmlspec/elements/element-types.d.ts +1 -0
  65. package/dist/htmlspec/elements/em.d.ts +4 -0
  66. package/dist/htmlspec/elements/embed.d.ts +21 -0
  67. package/dist/htmlspec/elements/fencedframe.d.ts +23 -0
  68. package/dist/htmlspec/elements/fieldset.d.ts +16 -0
  69. package/dist/htmlspec/elements/figcaption.d.ts +4 -0
  70. package/dist/htmlspec/elements/figure.d.ts +4 -0
  71. package/dist/htmlspec/elements/footer.d.ts +4 -0
  72. package/dist/htmlspec/elements/form.d.ts +61 -0
  73. package/dist/htmlspec/elements/h1.d.ts +4 -0
  74. package/dist/htmlspec/elements/h2.d.ts +4 -0
  75. package/dist/htmlspec/elements/h3.d.ts +4 -0
  76. package/dist/htmlspec/elements/h4.d.ts +4 -0
  77. package/dist/htmlspec/elements/h5.d.ts +4 -0
  78. package/dist/htmlspec/elements/h6.d.ts +4 -0
  79. package/dist/htmlspec/elements/head.d.ts +4 -0
  80. package/dist/htmlspec/elements/header.d.ts +4 -0
  81. package/dist/htmlspec/elements/hgroup.d.ts +4 -0
  82. package/dist/htmlspec/elements/hr.d.ts +4 -0
  83. package/dist/htmlspec/elements/html.d.ts +8 -0
  84. package/dist/htmlspec/elements/i.d.ts +4 -0
  85. package/dist/htmlspec/elements/iframe.d.ts +82 -0
  86. package/dist/htmlspec/elements/img.d.ts +90 -0
  87. package/dist/htmlspec/elements/index.d.ts +114 -0
  88. package/dist/htmlspec/elements/input.d.ts +189 -0
  89. package/dist/htmlspec/elements/ins.d.ts +12 -0
  90. package/dist/htmlspec/elements/kbd.d.ts +4 -0
  91. package/dist/htmlspec/elements/label.d.ts +8 -0
  92. package/dist/htmlspec/elements/legend.d.ts +4 -0
  93. package/dist/htmlspec/elements/li.d.ts +19 -0
  94. package/dist/htmlspec/elements/link.d.ts +77 -0
  95. package/dist/htmlspec/elements/main.d.ts +4 -0
  96. package/dist/htmlspec/elements/map.d.ts +8 -0
  97. package/dist/htmlspec/elements/mark.d.ts +4 -0
  98. package/dist/htmlspec/elements/menu.d.ts +4 -0
  99. package/dist/htmlspec/elements/meta.d.ts +24 -0
  100. package/dist/htmlspec/elements/meter.d.ts +29 -0
  101. package/dist/htmlspec/elements/nav.d.ts +4 -0
  102. package/dist/htmlspec/elements/noscript.d.ts +4 -0
  103. package/dist/htmlspec/elements/object.d.ts +29 -0
  104. package/dist/htmlspec/elements/ol.d.ts +24 -0
  105. package/dist/htmlspec/elements/optgroup.d.ts +12 -0
  106. package/dist/htmlspec/elements/option.d.ts +21 -0
  107. package/dist/htmlspec/elements/output.d.ts +16 -0
  108. package/dist/htmlspec/elements/p.d.ts +4 -0
  109. package/dist/htmlspec/elements/picture.d.ts +4 -0
  110. package/dist/htmlspec/elements/pre.d.ts +4 -0
  111. package/dist/htmlspec/elements/progress.d.ts +13 -0
  112. package/dist/htmlspec/elements/q.d.ts +8 -0
  113. package/dist/htmlspec/elements/rp.d.ts +4 -0
  114. package/dist/htmlspec/elements/rt.d.ts +4 -0
  115. package/dist/htmlspec/elements/ruby.d.ts +4 -0
  116. package/dist/htmlspec/elements/s.d.ts +4 -0
  117. package/dist/htmlspec/elements/samp.d.ts +4 -0
  118. package/dist/htmlspec/elements/script.d.ts +57 -0
  119. package/dist/htmlspec/elements/search.d.ts +4 -0
  120. package/dist/htmlspec/elements/section.d.ts +4 -0
  121. package/dist/htmlspec/elements/select.d.ts +37 -0
  122. package/dist/htmlspec/elements/selectedcontent.d.ts +7 -0
  123. package/dist/htmlspec/elements/slot.d.ts +8 -0
  124. package/dist/htmlspec/elements/small.d.ts +4 -0
  125. package/dist/htmlspec/elements/source.d.ts +33 -0
  126. package/dist/htmlspec/elements/span.d.ts +4 -0
  127. package/dist/htmlspec/elements/strong.d.ts +4 -0
  128. package/dist/htmlspec/elements/style.d.ts +21 -0
  129. package/dist/htmlspec/elements/sub.d.ts +4 -0
  130. package/dist/htmlspec/elements/summary.d.ts +4 -0
  131. package/dist/htmlspec/elements/sup.d.ts +4 -0
  132. package/dist/htmlspec/elements/table.d.ts +4 -0
  133. package/dist/htmlspec/elements/tbody.d.ts +4 -0
  134. package/dist/htmlspec/elements/td.d.ts +17 -0
  135. package/dist/htmlspec/elements/template.d.ts +29 -0
  136. package/dist/htmlspec/elements/textarea.d.ts +66 -0
  137. package/dist/htmlspec/elements/tfoot.d.ts +4 -0
  138. package/dist/htmlspec/elements/th.d.ts +31 -0
  139. package/dist/htmlspec/elements/thead.d.ts +4 -0
  140. package/dist/htmlspec/elements/time.d.ts +8 -0
  141. package/dist/htmlspec/elements/title.d.ts +4 -0
  142. package/dist/htmlspec/elements/tr.d.ts +4 -0
  143. package/dist/htmlspec/elements/track.d.ts +31 -0
  144. package/dist/htmlspec/elements/u.d.ts +4 -0
  145. package/dist/htmlspec/elements/ul.d.ts +12 -0
  146. package/dist/htmlspec/elements/var.d.ts +4 -0
  147. package/dist/htmlspec/elements/video.d.ts +66 -0
  148. package/dist/htmlspec/elements/wbr.d.ts +4 -0
  149. package/dist/index.cjs +144 -7
  150. package/dist/index.d.ts +1 -0
  151. package/dist/index.mjs +114 -9
  152. package/dist/internal/dev.d.ts +1 -0
  153. package/dist/internal/kitchen-sink-dev.d.ts +7 -0
  154. package/dist/internal/kitchen-sink.d.ts +2 -0
  155. package/dist/internal/log.d.ts +2 -0
  156. package/dist/internal/type-assert.d.ts +39 -0
  157. package/dist/jsx-dev-runtime.cjs +3 -2
  158. package/dist/jsx-dev-runtime.mjs +2 -3
  159. package/dist/{jsx-runtime-DpEMYmD9.js → jsx-runtime-BQPDXeiv.js} +675 -32
  160. package/dist/{jsx-runtime-CsQM2fQb.js → jsx-runtime-DlHYwToA.js} +672 -33
  161. package/dist/jsx-runtime.cjs +3 -1
  162. package/dist/jsx-runtime.mjs +1 -1
  163. package/dist/jsx-types.d.ts +6 -24
  164. package/dist/jsx.d.ts +3 -2
  165. package/dist/jsx.test.d.ts +1 -0
  166. package/dist/template-strings.d.ts +12 -0
  167. package/dist/template-strings.test.d.ts +6 -0
  168. package/package.json +93 -82
  169. package/dist/htmlspec/AnchorElement.d.ts +0 -83
@@ -1316,29 +1316,43 @@ const entityMap = {
1316
1316
  ffl: "ffllig"
1317
1317
  };
1318
1318
 
1319
- function cc(names) {
1320
- if (typeof names === "string" || typeof names === "number") return "" + names;
1321
- let out = "";
1322
- if (Array.isArray(names)) {
1323
- for (let i = 0, tmp; i < names.length; i++) {
1324
- if ((tmp = cc(names[i])) !== "") {
1325
- out += (out && " ") + tmp;
1326
- }
1319
+ function pushClassNames(value, classes) {
1320
+ if (value == null || value === false || value === true) return;
1321
+ if (typeof value === "string") {
1322
+ if (value) classes.push(value);
1323
+ return;
1324
+ }
1325
+ if (typeof value === "number" || typeof value === "bigint") {
1326
+ classes.push(String(value));
1327
+ return;
1328
+ }
1329
+ if (Array.isArray(value)) {
1330
+ for (const item of value) {
1331
+ pushClassNames(item, classes);
1327
1332
  }
1328
- } else {
1329
- for (let k in names) {
1330
- if (names[k]) out += (out && " ") + k;
1333
+ return;
1334
+ }
1335
+ for (const key of Object.keys(value)) {
1336
+ if (value[key]) {
1337
+ classes.push(key);
1331
1338
  }
1332
1339
  }
1333
- return out;
1334
1340
  }
1335
1341
 
1336
- function isFunction(obj) {
1342
+ function classCat(...values) {
1343
+ const classes = [];
1344
+ for (const value of values) {
1345
+ pushClassNames(value, classes);
1346
+ }
1347
+ return classes.join(" ");
1348
+ }
1349
+
1350
+ function isFunction$1(obj) {
1337
1351
  return typeof obj === "function";
1338
1352
  }
1339
1353
 
1340
1354
  function isIterable(obj) {
1341
- return isObjectLike(obj) && isFunction(obj[Symbol.iterator]);
1355
+ return isObjectLike(obj) && isFunction$1(obj[Symbol.iterator]);
1342
1356
  }
1343
1357
 
1344
1358
  function isNumber(obj) {
@@ -1349,7 +1363,7 @@ function isObjectLike(obj) {
1349
1363
  return typeof obj === "object" && obj !== null;
1350
1364
  }
1351
1365
 
1352
- function isObject(obj) {
1366
+ function isObject$1(obj) {
1353
1367
  return obj != null && (typeof obj === "object" || typeof obj === "function");
1354
1368
  }
1355
1369
 
@@ -1359,7 +1373,7 @@ function isPlainObject(obj) {
1359
1373
  return proto === null || proto === Object.prototype;
1360
1374
  }
1361
1375
 
1362
- function isString(obj) {
1376
+ function isString$1(obj) {
1363
1377
  return typeof obj === "string";
1364
1378
  }
1365
1379
 
@@ -1414,7 +1428,7 @@ function styleObjectToString(styles) {
1414
1428
  }
1415
1429
 
1416
1430
  function entity(ch) {
1417
- return Object.hasOwn(entityMap, ch) ? `&${entityMap[ch]};` : `&#x${ch.codePointAt(0).toString(16)};`;
1431
+ return Object.prototype.hasOwnProperty.call(entityMap, ch) ? `&${entityMap[ch]};` : `&#x${ch.codePointAt(0).toString(16)};`;
1418
1432
  }
1419
1433
 
1420
1434
  function tagName(string) {
@@ -1426,15 +1440,15 @@ function attrName(string) {
1426
1440
  }
1427
1441
 
1428
1442
  function attrValue(value) {
1429
- if (isFunction(value)) {
1430
- value = `(${value}).call(this)`;
1443
+ if (isFunction$1(value)) {
1444
+ value = `(${value}).call(this,event)`;
1431
1445
  }
1432
1446
  return `"${String(value).replace(/"/gu, entity)}"`;
1433
1447
  }
1434
1448
 
1435
1449
  function attrKvPair(rawAttr, rawVal) {
1436
1450
  let escAttr = attrName(rawAttr);
1437
- if (/^data-/.test(rawAttr) && !isString(rawVal)) {
1451
+ if (/^data-/.test(rawAttr) && !isString$1(rawVal)) {
1438
1452
  rawVal = JSON.stringify(rawVal);
1439
1453
  }
1440
1454
  if (rawVal === true) {
@@ -1443,8 +1457,8 @@ function attrKvPair(rawAttr, rawVal) {
1443
1457
  if (rawVal === false || rawVal == null) {
1444
1458
  return null;
1445
1459
  }
1446
- if (rawAttr === "class" && !isString(rawVal)) {
1447
- rawVal = cc(rawVal);
1460
+ if (rawAttr === "class" && !isString$1(rawVal)) {
1461
+ rawVal = classCat(rawVal);
1448
1462
  }
1449
1463
  if (rawAttr === "style" && isPlainObject(rawVal)) {
1450
1464
  rawVal = styleObjectToString(rawVal);
@@ -1454,7 +1468,7 @@ function attrKvPair(rawAttr, rawVal) {
1454
1468
 
1455
1469
  function attrs(attributes) {
1456
1470
  if (attributes == null) return "";
1457
- if (isObject(attributes)) {
1471
+ if (isObject$1(attributes)) {
1458
1472
  attributes = Object.entries(attributes);
1459
1473
  }
1460
1474
  return attributes.map((([k, v]) => attrKvPair(k, v))).filter((x => x)).map((x => ` ${x}`)).join("");
@@ -1482,6 +1496,598 @@ function isJsxNode(x) {
1482
1496
  return x instanceof JsxNode;
1483
1497
  }
1484
1498
 
1499
+ /*! Adapted from https://github.com/mathiasbynens/CSS.escape/blob/4b25c283eaf4dd443f44a7096463e973d56dd1b2/css.escape.js */ function cssEscape(value) {
1500
+ const string = String(value);
1501
+ const length = string.length;
1502
+ let index = -1;
1503
+ let codeUnit;
1504
+ let result = "";
1505
+ const firstCodeUnit = string.charCodeAt(0);
1506
+ if (length === 1 && firstCodeUnit === 45) {
1507
+ return "\\" + string;
1508
+ }
1509
+ while (++index < length) {
1510
+ codeUnit = string.charCodeAt(index);
1511
+ if (codeUnit === 0) {
1512
+ result += "�";
1513
+ continue;
1514
+ }
1515
+ if (codeUnit >= 1 && codeUnit <= 31 || codeUnit === 127 || index === 0 && codeUnit >= 48 && codeUnit <= 57 || index === 1 && codeUnit >= 48 && codeUnit <= 57 && firstCodeUnit === 45) {
1516
+ result += "\\" + codeUnit.toString(16) + " ";
1517
+ continue;
1518
+ }
1519
+ if (codeUnit >= 128 || codeUnit === 45 || codeUnit === 95 || codeUnit >= 48 && codeUnit <= 57 || codeUnit >= 65 && codeUnit <= 90 || codeUnit >= 97 && codeUnit <= 122) {
1520
+ result += string.charAt(index);
1521
+ continue;
1522
+ }
1523
+ result += "\\" + string.charAt(index);
1524
+ }
1525
+ return result;
1526
+ }
1527
+
1528
+ function isFunction(obj) {
1529
+ return typeof obj === "function";
1530
+ }
1531
+
1532
+ function isString(obj) {
1533
+ return typeof obj === "string";
1534
+ }
1535
+
1536
+ function isStringLike(obj) {
1537
+ return typeof obj === "string" || obj instanceof String;
1538
+ }
1539
+
1540
+ function isNumberLike(obj) {
1541
+ return typeof obj === "number" || obj instanceof Number;
1542
+ }
1543
+
1544
+ function isBigInt(obj) {
1545
+ return typeof obj === "bigint";
1546
+ }
1547
+
1548
+ function isBoolean(obj) {
1549
+ return obj === true || obj === false;
1550
+ }
1551
+
1552
+ function isRegExp(obj) {
1553
+ return obj instanceof RegExp;
1554
+ }
1555
+
1556
+ function isArray(obj) {
1557
+ return Array.isArray(obj);
1558
+ }
1559
+
1560
+ function isObject(obj) {
1561
+ return obj !== null && typeof obj === "object";
1562
+ }
1563
+
1564
+ function isSymbol(obj) {
1565
+ return Object.prototype.toString.call(obj) === "[object Symbol]";
1566
+ }
1567
+
1568
+ function findFunction(lib, fn, maxDepth = 3) {
1569
+ let queue = [];
1570
+ let path = [];
1571
+ let seen = new Set;
1572
+ --maxDepth;
1573
+ for (;;) {
1574
+ if (lib[fn.name] === fn) {
1575
+ return [ ...path, fn.name ];
1576
+ }
1577
+ seen.add(lib);
1578
+ if (path.length < maxDepth) {
1579
+ for (let n of Object.getOwnPropertyNames(lib)) {
1580
+ if (n[0] !== "_" && n !== "prototype" && lib[n] && !seen.has(lib[n])) {
1581
+ queue.push([ [ ...path, n ], lib[n] ]);
1582
+ }
1583
+ }
1584
+ }
1585
+ if (!queue.length) {
1586
+ return null;
1587
+ }
1588
+ [path, lib] = queue.shift();
1589
+ }
1590
+ }
1591
+
1592
+ var nativeFuncs = new Map;
1593
+
1594
+ var isRaw = Symbol("isRaw");
1595
+
1596
+ var wellKnownSymbols;
1597
+
1598
+ function merge(target, ...sources) {
1599
+ for (let obj of sources) {
1600
+ if (obj) {
1601
+ for (let key of Object.keys(obj)) {
1602
+ if (obj[key] !== undefined) {
1603
+ target[key] = obj[key];
1604
+ }
1605
+ }
1606
+ }
1607
+ }
1608
+ return target;
1609
+ }
1610
+
1611
+ function jsSerialize(object, options) {
1612
+ return startSerialize(object, options).replace(/<\/(script)/gi, "<\\/$1");
1613
+ }
1614
+
1615
+ function startSerialize(object, options) {
1616
+ const counts = referenceCount(object);
1617
+ let c = 0;
1618
+ const dupes = [ ...counts ].filter((x => x[1] > 1)).sort(((a, b) => b[1] - a[1])).map((x => [ x[0], `$${c++}` ]));
1619
+ const refs = new Map(dupes);
1620
+ let ctx = {
1621
+ seen: new Set,
1622
+ refs,
1623
+ opts: Object.freeze(merge({
1624
+ compact: false,
1625
+ safe: true
1626
+ }, options))
1627
+ };
1628
+ let js = serializeAny(object, ctx);
1629
+ if (dupes.length) {
1630
+ let varDecl = dupes.map((x => x[1])).join(",");
1631
+ if (dupes.length > 1) {
1632
+ varDecl = `(${varDecl})`;
1633
+ }
1634
+ if (js.startsWith("{")) {
1635
+ js = `(${js})`;
1636
+ }
1637
+ return `(${varDecl}=>${js})()`;
1638
+ }
1639
+ return js;
1640
+ }
1641
+
1642
+ var STRING_REF_MIN_LENGTH = 12;
1643
+
1644
+ function referenceCount(object) {
1645
+ const m = new Map;
1646
+ function r(o) {
1647
+ let c = m.get(o);
1648
+ if (c) {
1649
+ m.set(o, c + 1);
1650
+ return;
1651
+ }
1652
+ if (isArray(o) || o instanceof Set) {
1653
+ m.set(o, 1);
1654
+ for (const v of o) {
1655
+ r(v);
1656
+ }
1657
+ } else if (isString(o)) {
1658
+ if (o.length >= STRING_REF_MIN_LENGTH) {
1659
+ m.set(o, 1);
1660
+ }
1661
+ } else if (o instanceof Map) {
1662
+ m.set(o, 1);
1663
+ for (const v of o.values()) {
1664
+ r(v);
1665
+ }
1666
+ } else if (isRegExp(o) || o instanceof Date || isSymbol(o) || isFunction(o)) {
1667
+ m.set(o, 1);
1668
+ } else if (isObject(o)) {
1669
+ m.set(o, 1);
1670
+ for (const k of Reflect.ownKeys(o)) {
1671
+ r(o[k]);
1672
+ }
1673
+ }
1674
+ }
1675
+ r(object);
1676
+ return m;
1677
+ }
1678
+
1679
+ function isNegativeZero(value) {
1680
+ return 1 / value === -Infinity;
1681
+ }
1682
+
1683
+ function serializeArray(obj, ctx) {
1684
+ const varName = ctx.refs.get(obj);
1685
+ const assign = varName ? `${varName}=` : "";
1686
+ if (obj.length === 0) {
1687
+ return `${assign}[]`;
1688
+ }
1689
+ let sb = [];
1690
+ let hasProp = false;
1691
+ let isSparse = false;
1692
+ for (let i = 0; i < obj.length; ++i) {
1693
+ if (obj.hasOwnProperty(i)) {
1694
+ hasProp = true;
1695
+ sb.push(serializeAny(obj[i], ctx));
1696
+ } else {
1697
+ isSparse = true;
1698
+ sb.push("");
1699
+ }
1700
+ }
1701
+ if (!hasProp) {
1702
+ return `${assign}new Array(${obj.length})`;
1703
+ }
1704
+ if (sb[sb.length - 1] === "") {
1705
+ sb.push("");
1706
+ }
1707
+ const inner = sb.join(",");
1708
+ if (varName) {
1709
+ if (isSparse) {
1710
+ let sb2 = [ `(${varName}=new Array(${obj.length})` ];
1711
+ for (let i = 0; i < obj.length; ++i) {
1712
+ if (obj.hasOwnProperty(i)) {
1713
+ sb2.push(`${varName}[${i}]=${serializeAny(obj[i], ctx)}`);
1714
+ }
1715
+ }
1716
+ sb2.push(`${varName})`);
1717
+ return sb2.join(",");
1718
+ }
1719
+ return `(${varName}=[],${varName}.push(${inner}),${varName})`;
1720
+ }
1721
+ return `[${inner}]`;
1722
+ }
1723
+
1724
+ function serializeSet(obj, ctx) {
1725
+ const varName = ctx.refs.get(obj);
1726
+ if (obj.size) {
1727
+ if (varName) {
1728
+ return `(${varName}=new Set,${varName}` + Array.from(obj).map((x => `.add(${serializeAny(x, ctx)})`)).join("") + ")";
1729
+ }
1730
+ return "new Set(" + serializeAny(Array.from(obj), ctx) + ")";
1731
+ }
1732
+ if (varName) {
1733
+ return `${varName}=new Set`;
1734
+ }
1735
+ return "new Set";
1736
+ }
1737
+
1738
+ function serializeMap(obj, ctx) {
1739
+ const varName = ctx.refs.get(obj);
1740
+ if (obj.size) {
1741
+ if (varName) {
1742
+ return `(${varName}=new Map,${varName}` + Array.from(obj).map((([k, v]) => `.set(${serializeAny(k, ctx)},${serializeAny(v, ctx)})`)).join("") + ")";
1743
+ }
1744
+ return "new Map(" + serializeAny(Array.from(obj), ctx) + ")";
1745
+ }
1746
+ if (varName) {
1747
+ return `${varName}=new Map`;
1748
+ }
1749
+ return "new Map";
1750
+ }
1751
+
1752
+ function serializeDate(obj, ctx) {
1753
+ if (ctx.opts.compact) {
1754
+ return `new Date(${obj.valueOf()})`;
1755
+ }
1756
+ const parts = [ obj.getUTCFullYear(), obj.getUTCMonth(), obj.getUTCDate() ];
1757
+ if (+obj % 864e5 !== 0) {
1758
+ parts.push(obj.getUTCHours(), obj.getUTCMinutes(), obj.getUTCSeconds());
1759
+ const ms = obj.getUTCMilliseconds();
1760
+ if (ms) {
1761
+ parts.push(ms);
1762
+ }
1763
+ }
1764
+ return `new Date(Date.UTC(${parts.join(",")}))`;
1765
+ }
1766
+
1767
+ function wrapSimpleRef(serialize) {
1768
+ return (obj, ctx) => {
1769
+ const js = serialize(obj, ctx);
1770
+ const varName = ctx.refs.get(obj);
1771
+ if (varName) {
1772
+ ctx.seen.add(obj);
1773
+ return `${varName}=${js}`;
1774
+ }
1775
+ return js;
1776
+ };
1777
+ }
1778
+
1779
+ function serializeAnySymbol(obj, ctx) {
1780
+ if (!wellKnownSymbols) {
1781
+ wellKnownSymbols = new Map(Object.getOwnPropertyNames(Symbol).filter((k => isSymbol(Symbol[k]))).map((k => [ Symbol[k], k ])));
1782
+ }
1783
+ let symbolName = wellKnownSymbols.get(obj);
1784
+ if (symbolName) {
1785
+ return `Symbol.${symbolName}`;
1786
+ }
1787
+ return serializeSymbol(obj, ctx);
1788
+ }
1789
+
1790
+ function serializeNativeFunction(obj, ctx) {
1791
+ let cachedPath = nativeFuncs.get(obj);
1792
+ if (cachedPath !== undefined) {
1793
+ return cachedPath;
1794
+ }
1795
+ const foundPath = findFunction(global, obj);
1796
+ if (foundPath === null) {
1797
+ throw new Error(`Could not determine fully-qualified name of native function '${obj.name}'`);
1798
+ }
1799
+ const joinedPath = foundPath.join(".");
1800
+ nativeFuncs.set(obj, joinedPath);
1801
+ return joinedPath;
1802
+ }
1803
+
1804
+ function serializeNonNativeFunction(obj, ctx) {
1805
+ return obj.toString();
1806
+ }
1807
+
1808
+ function serializeAnyFunction(obj, ctx) {
1809
+ if (/\{\s*\[native code]\s*}$/.test(obj.toString())) {
1810
+ return serializeNativeFunction(obj);
1811
+ }
1812
+ return serializeNonNativeFunction(obj);
1813
+ }
1814
+
1815
+ function serializeBoolean(obj, ctx) {
1816
+ if (obj) {
1817
+ return ctx.opts.compact ? "!0" : "true";
1818
+ }
1819
+ return ctx.opts.compact ? "!1" : "false";
1820
+ }
1821
+
1822
+ function serializeRegExp(obj, ctx) {
1823
+ return obj.toString();
1824
+ }
1825
+
1826
+ function serializeUndefined(obj, ctx) {
1827
+ return ctx.opts.compact ? "void 0" : "undefined";
1828
+ }
1829
+
1830
+ function serializeNull(obj, ctx) {
1831
+ return "null";
1832
+ }
1833
+
1834
+ function maybeFreeze(obj, js) {
1835
+ if (Object.isFrozen(obj)) {
1836
+ return `Object.freeze(${js})`;
1837
+ }
1838
+ if (Object.isSealed(obj)) {
1839
+ return `Object.seal(${js})`;
1840
+ }
1841
+ if (!Object.isExtensible(obj)) {
1842
+ return `Object.preventExtensions(${js})`;
1843
+ }
1844
+ return js;
1845
+ }
1846
+
1847
+ function serializeAnyObject(obj, ctx) {
1848
+ const tmp = serializeObject(obj, ctx);
1849
+ const name = ctx.refs.get(obj);
1850
+ if (name) {
1851
+ if (Reflect.ownKeys(obj).length) {
1852
+ return `(${name}={},${maybeFreeze(obj, `Object.assign(${name},${tmp})`)})`;
1853
+ }
1854
+ return `${name}=${maybeFreeze(obj, "{}")}`;
1855
+ }
1856
+ return maybeFreeze(obj, tmp);
1857
+ }
1858
+
1859
+ function serializeAny(obj, ctx) {
1860
+ if (ctx.seen.has(obj) && ctx.refs.has(obj)) {
1861
+ return ctx.refs.get(obj);
1862
+ }
1863
+ if (isArray(obj)) {
1864
+ ctx.seen.add(obj);
1865
+ return serializeArray(obj, ctx);
1866
+ }
1867
+ if (obj instanceof Set) {
1868
+ ctx.seen.add(obj);
1869
+ return serializeSet(obj, ctx);
1870
+ }
1871
+ if (obj instanceof Map) {
1872
+ ctx.seen.add(obj);
1873
+ return serializeMap(obj, ctx);
1874
+ }
1875
+ if (obj instanceof Date) {
1876
+ return wrapSimpleRef(serializeDate)(obj, ctx);
1877
+ }
1878
+ if (isSymbol(obj)) {
1879
+ return wrapSimpleRef(serializeAnySymbol)(obj, ctx);
1880
+ }
1881
+ if (isFunction(obj)) {
1882
+ return wrapSimpleRef(serializeAnyFunction)(obj, ctx);
1883
+ }
1884
+ if (isRegExp(obj)) {
1885
+ return wrapSimpleRef(serializeRegExp)(obj, ctx);
1886
+ }
1887
+ if (isNumberLike(obj)) {
1888
+ return serializeNumberLike(obj, ctx);
1889
+ }
1890
+ if (isBigInt(obj)) {
1891
+ return serializeBigInt(obj, ctx);
1892
+ }
1893
+ if (isBoolean(obj)) {
1894
+ return serializeBoolean(obj, ctx);
1895
+ }
1896
+ if (isStringLike(obj)) {
1897
+ return serializeStringLike(obj, ctx);
1898
+ }
1899
+ if (obj === undefined) {
1900
+ return serializeUndefined(obj, ctx);
1901
+ }
1902
+ if (obj === null) {
1903
+ return serializeNull();
1904
+ }
1905
+ if (isObject(obj)) {
1906
+ ctx.seen.add(obj);
1907
+ return serializeAnyObject(obj, ctx);
1908
+ }
1909
+ throw new Error("Could not serialize unknown type");
1910
+ }
1911
+
1912
+ function serializeNumberLike(obj, ctx) {
1913
+ const tmp = serializeNumber(Number(obj), ctx);
1914
+ if (obj instanceof Number) {
1915
+ return `new Number(${tmp})`;
1916
+ }
1917
+ return tmp;
1918
+ }
1919
+
1920
+ function serializeNumber(obj, ctx) {
1921
+ switch (obj) {
1922
+ case Math.E:
1923
+ return "Math.E";
1924
+
1925
+ case Math.LN2:
1926
+ return "Math.LN2";
1927
+
1928
+ case Math.LN10:
1929
+ return "Math.LN10";
1930
+
1931
+ case Math.LOG2E:
1932
+ return "Math.LOG2E";
1933
+
1934
+ case Math.PI:
1935
+ return "Math.PI";
1936
+
1937
+ case Math.SQRT1_2:
1938
+ return "Math.SQRT1_2";
1939
+
1940
+ case Math.SQRT2:
1941
+ return "Math.SQRT2";
1942
+
1943
+ case Number.EPSILON:
1944
+ return "Number.EPSILON";
1945
+
1946
+ case Infinity:
1947
+ return ctx.opts.compact ? "1/0" : "Infinity";
1948
+
1949
+ case -Infinity:
1950
+ return ctx.opts.compact ? "1/-0" : "-Infinity";
1951
+ }
1952
+ if (isNegativeZero(obj)) return "-0";
1953
+ if (ctx.opts.compact && Number.isInteger(obj) && obj >= 1e12) {
1954
+ return "0x" + obj.toString(16);
1955
+ }
1956
+ return String(obj);
1957
+ }
1958
+
1959
+ function serializeBigInt(obj, ctx) {
1960
+ if (ctx.opts.compact && obj >= 1000000000000n) {
1961
+ return "0x" + obj.toString(16) + "n";
1962
+ }
1963
+ return `${obj}n`;
1964
+ }
1965
+
1966
+ function serializeStringLike(obj, ctx) {
1967
+ const js = doSerializeStringLike(obj, ctx);
1968
+ if (obj.length >= STRING_REF_MIN_LENGTH) {
1969
+ const varName = ctx.refs.get(obj);
1970
+ if (varName) {
1971
+ ctx.seen.add(obj);
1972
+ return `${varName}=${js}`;
1973
+ }
1974
+ }
1975
+ return js;
1976
+ }
1977
+
1978
+ function doSerializeStringLike(obj, ctx) {
1979
+ const tmp = serializeString(String(obj), ctx);
1980
+ if (obj instanceof String) {
1981
+ return `new String(${tmp})`;
1982
+ }
1983
+ return tmp;
1984
+ }
1985
+
1986
+ function serializeString(obj, ctx) {
1987
+ return '"' + Array.from(obj).map((ch => {
1988
+ const cp = ch.codePointAt(0);
1989
+ switch (cp) {
1990
+ case 8:
1991
+ return "\\b";
1992
+
1993
+ case 12:
1994
+ return "\\f";
1995
+
1996
+ case 10:
1997
+ return "\\n";
1998
+
1999
+ case 13:
2000
+ return "\\r";
2001
+
2002
+ case 9:
2003
+ return "\\t";
2004
+
2005
+ case 11:
2006
+ return ctx.opts.safe ? "\\x0B" : "\\v";
2007
+
2008
+ case 34:
2009
+ return '\\"';
2010
+
2011
+ case 92:
2012
+ return "\\\\";
2013
+ }
2014
+ if (cp >= 32 && cp <= 126) {
2015
+ return ch;
2016
+ }
2017
+ if (cp <= 255) {
2018
+ return "\\x" + cp.toString(16).padStart(2, "0");
2019
+ }
2020
+ if (cp <= 65535) {
2021
+ return "\\u" + cp.toString(16).padStart(4, "0");
2022
+ }
2023
+ return "\\u{" + cp.toString(16) + "}";
2024
+ })).join("") + '"';
2025
+ }
2026
+
2027
+ function serializeObject(obj, ctx) {
2028
+ if (obj[isRaw]) {
2029
+ return obj.value;
2030
+ }
2031
+ if (isFunction(obj.toSource)) {
2032
+ return obj.toSource();
2033
+ }
2034
+ if (isFunction(obj.toJSON)) {
2035
+ return serializeAny(obj.toJSON(), ctx);
2036
+ }
2037
+ return serializePlainObject(obj, ctx);
2038
+ }
2039
+
2040
+ function serializePlainObject(obj, ctx) {
2041
+ let tmp = [];
2042
+ for (let key of Reflect.ownKeys(obj)) {
2043
+ tmp.push(serializePropertyName(key, ctx) + ":" + serializeAny(obj[key], ctx));
2044
+ }
2045
+ return "{" + tmp.join(",") + "}";
2046
+ }
2047
+
2048
+ jsSerialize.raw = function raw(jsCode) {
2049
+ return Object.create({
2050
+ [isRaw]: true,
2051
+ value: jsCode
2052
+ });
2053
+ };
2054
+
2055
+ function serializeSymbol(sym, ctx) {
2056
+ let key = Symbol.keyFor(sym);
2057
+ if (key === undefined) {
2058
+ let m = sym.toString().match(/^Symbol\((.+)\)$/);
2059
+ if (m) {
2060
+ return `Symbol(${serializeString(m[1], ctx)})`;
2061
+ }
2062
+ return `Symbol()`;
2063
+ } else {
2064
+ return `Symbol.for(${serializeString(key, ctx)})`;
2065
+ }
2066
+ }
2067
+
2068
+ var keywords = new Set([ "do", "if", "in", "for", "let", "new", "try", "var", "case", "else", "enum", "eval", "false", "null", "this", "true", "void", "with", "break", "catch", "class", "const", "super", "throw", "while", "yield", "delete", "export", "import", "public", "return", "static", "switch", "typeof", "default", "extends", "finally", "package", "private", "continue", "debugger", "function", "arguments", "interface", "protected", "implements", "instanceof" ]);
2069
+
2070
+ var propName = /^[$_a-zA-Z][$_a-zA-Z0-9]*$/;
2071
+
2072
+ function isSafePropName(name, ctx) {
2073
+ return (!ctx.opts.safe || !keywords.has(name)) && propName.test(name);
2074
+ }
2075
+
2076
+ function serializePropertyName(name, ctx) {
2077
+ if (isSymbol(name)) {
2078
+ return "[" + serializeSymbol(name, ctx) + "]";
2079
+ }
2080
+ if (isStringLike(name)) {
2081
+ if (isSafePropName(name, ctx)) {
2082
+ return name;
2083
+ }
2084
+ return serializeString(name, ctx);
2085
+ }
2086
+ throw new Error(`Cannot make property name`);
2087
+ }
2088
+
2089
+ var src_default = jsSerialize;
2090
+
1485
2091
  function mapIter(iterable, cb) {
1486
2092
  const out = [];
1487
2093
  let i = 0;
@@ -1531,7 +2137,7 @@ function scriptChild(el) {
1531
2137
  if (isJsxNode(el)) {
1532
2138
  throw new Error(`<script> cannot contain JSX nodes.`);
1533
2139
  }
1534
- return JSON.stringify(el);
2140
+ return src_default(el);
1535
2141
  }
1536
2142
 
1537
2143
  function styleChild(el) {
@@ -1542,19 +2148,19 @@ function styleChild(el) {
1542
2148
  return "";
1543
2149
  }
1544
2150
  if (isJsxNode(el)) {
1545
- throw new Error(`<sty;e> cannot contain JSX nodes.`);
2151
+ throw new Error(`<style> cannot contain JSX nodes.`);
1546
2152
  }
1547
- return CSS.escape(String(el));
2153
+ return cssEscape(String(el));
1548
2154
  }
1549
2155
 
1550
2156
  function flattenChildren(children, callback) {
1551
2157
  return Array.isArray(children) ? children.map(callback).join("") : callback(children);
1552
2158
  }
1553
2159
 
1554
- const isJsxComponent = isFunction;
2160
+ const isJsxComponent = isFunction$1;
1555
2161
 
1556
2162
  function isHtmlSafe(x) {
1557
- return isPlainObject(x) && isString(x.__html);
2163
+ return isPlainObject(x) && isString$1(x.__html);
1558
2164
  }
1559
2165
 
1560
2166
  function render(el) {
@@ -1567,7 +2173,7 @@ function render(el) {
1567
2173
  if (isHtmlSafe(el)) {
1568
2174
  return el.__html;
1569
2175
  }
1570
- if (isString(el)) {
2176
+ if (isString$1(el)) {
1571
2177
  return htmlContent(el);
1572
2178
  }
1573
2179
  if (isNumber(el)) {
@@ -1576,7 +2182,7 @@ function render(el) {
1576
2182
  if (Array.isArray(el)) {
1577
2183
  return el.map((x => render(x))).join("");
1578
2184
  }
1579
- if (isFunction(el)) {
2185
+ if (isFunction$1(el)) {
1580
2186
  return render(el());
1581
2187
  }
1582
2188
  if (isIterable(el)) {
@@ -1585,6 +2191,37 @@ function render(el) {
1585
2191
  throw new Error(`Unsupported type: ${getStringTag(el)}`);
1586
2192
  }
1587
2193
 
2194
+ class JsFrag {
2195
+ str;
2196
+ constructor(str) {
2197
+ this.str = str;
2198
+ }
2199
+ toString() {
2200
+ return this.str;
2201
+ }
2202
+ }
2203
+
2204
+ function escapeJs(obj) {
2205
+ if (obj instanceof JsFrag) {
2206
+ return obj;
2207
+ }
2208
+ return src_default(obj);
2209
+ }
2210
+
2211
+ function js(strings, ...values) {
2212
+ return new JsFrag(strings.reduce(((out, str, i) => out + str + (i < values.length ? escapeJs(values[i]) : "")), ""));
2213
+ }
2214
+
2215
+ class CssFrag {
2216
+ str;
2217
+ constructor(str) {
2218
+ this.str = str;
2219
+ }
2220
+ toString() {
2221
+ return this.str;
2222
+ }
2223
+ }
2224
+
1588
2225
  const voidElements = new Set([ "area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr" ]);
1589
2226
 
1590
2227
  class JsxElement extends JsxNode {
@@ -1613,10 +2250,10 @@ class JsxElement extends JsxNode {
1613
2250
  return `<${tag}${attrs$1}></${tag}>`;
1614
2251
  }
1615
2252
  if (normalizedTagName === "script") {
1616
- return `<${tag}${attrs$1}>${escapeScript(flattenChildren(children, scriptChild))}</${tag}>`;
2253
+ return `<${tag}${attrs$1}>${escapeScript(children instanceof JsFrag ? children.toString() : flattenChildren(children, scriptChild))}</${tag}>`;
1617
2254
  }
1618
2255
  if (normalizedTagName === "style") {
1619
- return `<${tag}${attrs$1}>${escapeStyle(flattenChildren(children, styleChild))}</${tag}>`;
2256
+ return `<${tag}${attrs$1}>${escapeStyle(children instanceof CssFrag ? children.toString() : flattenChildren(children, styleChild))}</${tag}>`;
1620
2257
  }
1621
2258
  return `<${tag}${attrs$1}>${flattenChildren(children, render)}</${tag}>`;
1622
2259
  }
@@ -1689,6 +2326,8 @@ class JsxFragment extends JsxNode {
1689
2326
  }
1690
2327
  }
1691
2328
 
2329
+ const JSX = {};
2330
+
1692
2331
  function jsx(tag, props, key, isStaticChildren, source, self) {
1693
2332
  if (isJsxComponent(tag)) {
1694
2333
  const node = tag(props);
@@ -1711,4 +2350,4 @@ function Fragment({children}) {
1711
2350
  return new JsxFragment(children);
1712
2351
  }
1713
2352
 
1714
- export { EMPTY as E, Fragment as F, JsxRawHtml as J, JsxDocType as a, jsx as b, JsxElement as c, JsxComment as d, JsxEmpty as e, flattenString as f, JsxFragment as g, JsxNode as h, isJsxNode as i, jsxs as j, isJsxComponent as k };
2353
+ export { EMPTY as E, Fragment as F, JsxDocType as J, jsxs as a, JsxRawHtml as b, js as c, JsxElement as d, JsxComment as e, flattenString as f, JsxEmpty as g, JsxFragment as h, isJsxNode as i, jsx as j, JsxNode as k, isJsxComponent as l, JSX as m };