@fluixi/compiler 1.0.0-alpha.93 → 1.0.0-alpha.94

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 (90) hide show
  1. package/dist/analyze/intrinsics.cjs +13 -1
  2. package/dist/analyze/intrinsics.d.cts +14 -0
  3. package/dist/analyze/intrinsics.d.ts +14 -0
  4. package/dist/analyze/intrinsics.d.ts.map +1 -1
  5. package/dist/analyze/intrinsics.js +17 -0
  6. package/dist/analyze/intrinsics.mjs +13 -1
  7. package/dist/analyze/static-graph.cjs +1 -1
  8. package/dist/analyze/static-graph.mjs +1 -1
  9. package/dist/{babel-RJHJQVEM.mjs → babel-RJFQVFJW.mjs} +4 -4
  10. package/dist/{chunk-56QSOVVL.mjs → chunk-DP2QDWWH.mjs} +1 -1
  11. package/dist/{chunk-R7PPFBCL.mjs → chunk-E2RWTIYE.mjs} +21 -15
  12. package/dist/{chunk-OD53TMER.mjs → chunk-HCCBEJEZ.mjs} +13 -1
  13. package/dist/{chunk-TJIH7TLX.mjs → chunk-HIZU7WI2.mjs} +1 -1
  14. package/dist/{chunk-U7HCFLZ2.mjs → chunk-ZR2QHTEX.mjs} +356 -24
  15. package/dist/codegen/backends/imperative.cjs +1 -1
  16. package/dist/codegen/backends/imperative.d.ts.map +1 -1
  17. package/dist/codegen/backends/imperative.js +2 -1
  18. package/dist/codegen/backends/imperative.mjs +1 -1
  19. package/dist/frontend/babel/build-ir-lit.cjs +352 -22
  20. package/dist/frontend/babel/build-ir-lit.mjs +352 -22
  21. package/dist/frontend/babel/build-ir.cjs +352 -22
  22. package/dist/frontend/babel/build-ir.mjs +352 -22
  23. package/dist/frontend/babel/index.cjs +353 -23
  24. package/dist/frontend/babel/index.mjs +353 -23
  25. package/dist/frontend/babel/lower-template.cjs +352 -22
  26. package/dist/frontend/babel/lower-template.mjs +352 -22
  27. package/dist/frontend/babel/plugin.cjs +352 -22
  28. package/dist/frontend/babel/plugin.mjs +352 -22
  29. package/dist/index.cjs +321 -22
  30. package/dist/index.mjs +333 -22
  31. package/dist/integrations.cjs +1174 -49
  32. package/dist/integrations.d.ts.map +1 -1
  33. package/dist/integrations.js +44 -2
  34. package/dist/integrations.mjs +205 -19
  35. package/dist/lower/compile-template.cjs +315 -21
  36. package/dist/lower/compile-template.d.cts +13 -0
  37. package/dist/lower/compile-template.d.ts +13 -0
  38. package/dist/lower/compile-template.d.ts.map +1 -1
  39. package/dist/lower/compile-template.js +3 -0
  40. package/dist/lower/compile-template.mjs +327 -21
  41. package/dist/lower/entities.cjs +288 -0
  42. package/dist/lower/entities.d.cts +1 -0
  43. package/dist/lower/entities.d.ts +2 -0
  44. package/dist/lower/entities.d.ts.map +1 -0
  45. package/dist/lower/entities.js +54 -0
  46. package/dist/lower/entities.mjs +267 -0
  47. package/dist/lower/jsx.cjs +104 -47
  48. package/dist/lower/jsx.d.cts +8 -0
  49. package/dist/lower/jsx.d.ts +8 -0
  50. package/dist/lower/jsx.d.ts.map +1 -1
  51. package/dist/lower/jsx.js +92 -2
  52. package/dist/lower/jsx.mjs +104 -47
  53. package/dist/lower/template.cjs +293 -20
  54. package/dist/lower/template.d.ts.map +1 -1
  55. package/dist/lower/template.js +35 -19
  56. package/dist/lower/template.mjs +293 -20
  57. package/dist/resolve/builtins.cjs +1 -1
  58. package/dist/resolve/builtins.mjs +1 -1
  59. package/dist/resolve/component-globals.cjs +6 -1
  60. package/dist/resolve/component-globals.js +2 -2
  61. package/dist/resolve/component-globals.mjs +6 -1
  62. package/dist/resolve/write-globals.cjs +6 -1
  63. package/dist/resolve/write-globals.mjs +6 -1
  64. package/dist/{server-fns-ZFRDIQ2X.mjs → server-fns-JLSTKWPS.mjs} +4 -4
  65. package/dist/{server-functions-CTDXX67X.mjs → server-functions-BGY3RD4R.mjs} +3 -3
  66. package/dist/transform/index.cjs +956 -33
  67. package/dist/transform/index.mjs +974 -47
  68. package/dist/transform/props.mjs +19 -14
  69. package/dist/transform/server-fns.mjs +19 -14
  70. package/dist/transform/styles.cjs +588 -0
  71. package/dist/transform/styles.d.cts +211 -0
  72. package/dist/transform/styles.d.ts +212 -0
  73. package/dist/transform/styles.d.ts.map +1 -0
  74. package/dist/transform/styles.js +714 -0
  75. package/dist/transform/styles.mjs +653 -0
  76. package/dist/transform/templates.cjs +955 -32
  77. package/dist/transform/templates.d.cts +13 -0
  78. package/dist/transform/templates.d.ts +13 -0
  79. package/dist/transform/templates.d.ts.map +1 -1
  80. package/dist/transform/templates.js +49 -12
  81. package/dist/transform/templates.mjs +973 -46
  82. package/dist/{transform-QWWQDCXE.mjs → transform-GBP6Y4UI.mjs} +601 -17
  83. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  84. package/dist/vite-styles.cjs +180 -0
  85. package/dist/vite-styles.d.cts +59 -0
  86. package/dist/vite-styles.d.ts +60 -0
  87. package/dist/vite-styles.d.ts.map +1 -0
  88. package/dist/vite-styles.js +198 -0
  89. package/dist/vite-styles.mjs +159 -0
  90. package/package.json +4 -3
@@ -1,4 +1,36 @@
1
- /*! @fluixi/compiler v1.0.0-alpha.93 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/compiler v1.0.0-alpha.94 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
+
3
+ // ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.6.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
4
+ var comma = ",".charCodeAt(0);
5
+ var semicolon = ";".charCodeAt(0);
6
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
7
+ var intToChar = new Uint8Array(64);
8
+ var charToInt = new Uint8Array(128);
9
+ for (let i = 0; i < chars.length; i++) {
10
+ const c = chars.charCodeAt(i);
11
+ intToChar[i] = c;
12
+ charToInt[c] = i;
13
+ }
14
+ var bufLength = 1024 * 16;
15
+
16
+ // src/transform/styles.ts
17
+ var SCOPE_ATTR = "data-fx-s";
18
+ function applyTemplateStyles(ir, t) {
19
+ const walk2 = (node) => {
20
+ const children = node.children;
21
+ if (children) {
22
+ for (let i = children.length - 1; i >= 0; i--) {
23
+ const child = children[i];
24
+ if (child.kind === "element" && child.tag === "style" && t.owner) children.splice(i, 1);
25
+ else walk2(child);
26
+ }
27
+ }
28
+ if (t.scope && node.kind === "element" && node.tag !== "style" && node.props && !node.props.some((p) => p.name === SCOPE_ATTR)) {
29
+ node.props.unshift({ name: SCOPE_ATTR, kind: "attr", literal: t.scope });
30
+ }
31
+ };
32
+ walk2(ir);
33
+ }
2
34
 
3
35
  // src/optimize/analyze-static.ts
4
36
  function propReason(prop) {
@@ -649,7 +681,7 @@ function emitComponent(name, props, children, used, templates, at) {
649
681
  }
650
682
  let obj = `{ ${bodies.map(([name2, body]) => `get ${propKey(name2)}() { return ${body}; }`).join(", ")} }`;
651
683
  if (bodies.some(([, body]) => /\bthis\b/.test(body))) {
652
- const thunks = bodies.map(([name2, body]) => `${JSON.stringify(name2)}: () => ${body}`);
684
+ const thunks = bodies.map(([name2, body]) => `${JSON.stringify(name2)}: () => (${body})`);
653
685
  const getters = bodies.map(([name2]) => `get ${propKey(name2)}() { return _$t[${JSON.stringify(name2)}](); }`);
654
686
  obj = `((_$t) => ({ ${getters.join(", ")} }))({ ${thunks.join(", ")} })`;
655
687
  }
@@ -850,6 +882,271 @@ function cleanTemplateText(value) {
850
882
  return out;
851
883
  }
852
884
 
885
+ // src/lower/entities.ts
886
+ var NAMED = {
887
+ quot: 34,
888
+ amp: 38,
889
+ apos: 39,
890
+ lt: 60,
891
+ gt: 62,
892
+ nbsp: 160,
893
+ iexcl: 161,
894
+ cent: 162,
895
+ pound: 163,
896
+ curren: 164,
897
+ yen: 165,
898
+ brvbar: 166,
899
+ sect: 167,
900
+ uml: 168,
901
+ copy: 169,
902
+ ordf: 170,
903
+ laquo: 171,
904
+ not: 172,
905
+ shy: 173,
906
+ reg: 174,
907
+ macr: 175,
908
+ deg: 176,
909
+ plusmn: 177,
910
+ sup2: 178,
911
+ sup3: 179,
912
+ acute: 180,
913
+ micro: 181,
914
+ para: 182,
915
+ middot: 183,
916
+ cedil: 184,
917
+ sup1: 185,
918
+ ordm: 186,
919
+ raquo: 187,
920
+ frac14: 188,
921
+ frac12: 189,
922
+ frac34: 190,
923
+ iquest: 191,
924
+ Agrave: 192,
925
+ Aacute: 193,
926
+ Acirc: 194,
927
+ Atilde: 195,
928
+ Auml: 196,
929
+ Aring: 197,
930
+ AElig: 198,
931
+ Ccedil: 199,
932
+ Egrave: 200,
933
+ Eacute: 201,
934
+ Ecirc: 202,
935
+ Euml: 203,
936
+ Igrave: 204,
937
+ Iacute: 205,
938
+ Icirc: 206,
939
+ Iuml: 207,
940
+ ETH: 208,
941
+ Ntilde: 209,
942
+ Ograve: 210,
943
+ Oacute: 211,
944
+ Ocirc: 212,
945
+ Otilde: 213,
946
+ Ouml: 214,
947
+ times: 215,
948
+ Oslash: 216,
949
+ Ugrave: 217,
950
+ Uacute: 218,
951
+ Ucirc: 219,
952
+ Uuml: 220,
953
+ Yacute: 221,
954
+ THORN: 222,
955
+ szlig: 223,
956
+ agrave: 224,
957
+ aacute: 225,
958
+ acirc: 226,
959
+ atilde: 227,
960
+ auml: 228,
961
+ aring: 229,
962
+ aelig: 230,
963
+ ccedil: 231,
964
+ egrave: 232,
965
+ eacute: 233,
966
+ ecirc: 234,
967
+ euml: 235,
968
+ igrave: 236,
969
+ iacute: 237,
970
+ icirc: 238,
971
+ iuml: 239,
972
+ eth: 240,
973
+ ntilde: 241,
974
+ ograve: 242,
975
+ oacute: 243,
976
+ ocirc: 244,
977
+ otilde: 245,
978
+ ouml: 246,
979
+ divide: 247,
980
+ oslash: 248,
981
+ ugrave: 249,
982
+ uacute: 250,
983
+ ucirc: 251,
984
+ uuml: 252,
985
+ yacute: 253,
986
+ thorn: 254,
987
+ yuml: 255,
988
+ OElig: 338,
989
+ oelig: 339,
990
+ Scaron: 352,
991
+ scaron: 353,
992
+ Yuml: 376,
993
+ fnof: 402,
994
+ circ: 710,
995
+ tilde: 732,
996
+ Alpha: 913,
997
+ Beta: 914,
998
+ Gamma: 915,
999
+ Delta: 916,
1000
+ Epsilon: 917,
1001
+ Zeta: 918,
1002
+ Eta: 919,
1003
+ Theta: 920,
1004
+ Iota: 921,
1005
+ Kappa: 922,
1006
+ Lambda: 923,
1007
+ Mu: 924,
1008
+ Nu: 925,
1009
+ Xi: 926,
1010
+ Omicron: 927,
1011
+ Pi: 928,
1012
+ Rho: 929,
1013
+ Sigma: 931,
1014
+ Tau: 932,
1015
+ Upsilon: 933,
1016
+ Phi: 934,
1017
+ Chi: 935,
1018
+ Psi: 936,
1019
+ Omega: 937,
1020
+ alpha: 945,
1021
+ beta: 946,
1022
+ gamma: 947,
1023
+ delta: 948,
1024
+ epsilon: 949,
1025
+ zeta: 950,
1026
+ eta: 951,
1027
+ theta: 952,
1028
+ iota: 953,
1029
+ kappa: 954,
1030
+ lambda: 955,
1031
+ mu: 956,
1032
+ nu: 957,
1033
+ xi: 958,
1034
+ omicron: 959,
1035
+ pi: 960,
1036
+ rho: 961,
1037
+ sigmaf: 962,
1038
+ sigma: 963,
1039
+ tau: 964,
1040
+ upsilon: 965,
1041
+ phi: 966,
1042
+ chi: 967,
1043
+ psi: 968,
1044
+ omega: 969,
1045
+ thetasym: 977,
1046
+ upsih: 978,
1047
+ piv: 982,
1048
+ ensp: 8194,
1049
+ emsp: 8195,
1050
+ thinsp: 8201,
1051
+ zwnj: 8204,
1052
+ zwj: 8205,
1053
+ lrm: 8206,
1054
+ rlm: 8207,
1055
+ ndash: 8211,
1056
+ mdash: 8212,
1057
+ lsquo: 8216,
1058
+ rsquo: 8217,
1059
+ sbquo: 8218,
1060
+ ldquo: 8220,
1061
+ rdquo: 8221,
1062
+ bdquo: 8222,
1063
+ dagger: 8224,
1064
+ Dagger: 8225,
1065
+ bull: 8226,
1066
+ hellip: 8230,
1067
+ permil: 8240,
1068
+ prime: 8242,
1069
+ Prime: 8243,
1070
+ lsaquo: 8249,
1071
+ rsaquo: 8250,
1072
+ oline: 8254,
1073
+ frasl: 8260,
1074
+ euro: 8364,
1075
+ image: 8465,
1076
+ weierp: 8472,
1077
+ real: 8476,
1078
+ trade: 8482,
1079
+ alefsym: 8501,
1080
+ larr: 8592,
1081
+ uarr: 8593,
1082
+ rarr: 8594,
1083
+ darr: 8595,
1084
+ harr: 8596,
1085
+ crarr: 8629,
1086
+ lArr: 8656,
1087
+ uArr: 8657,
1088
+ rArr: 8658,
1089
+ dArr: 8659,
1090
+ hArr: 8660,
1091
+ forall: 8704,
1092
+ part: 8706,
1093
+ exist: 8707,
1094
+ empty: 8709,
1095
+ nabla: 8711,
1096
+ isin: 8712,
1097
+ notin: 8713,
1098
+ ni: 8715,
1099
+ prod: 8719,
1100
+ sum: 8721,
1101
+ minus: 8722,
1102
+ lowast: 8727,
1103
+ radic: 8730,
1104
+ prop: 8733,
1105
+ infin: 8734,
1106
+ ang: 8736,
1107
+ and: 8743,
1108
+ or: 8744,
1109
+ cap: 8745,
1110
+ cup: 8746,
1111
+ int: 8747,
1112
+ there4: 8756,
1113
+ sim: 8764,
1114
+ cong: 8773,
1115
+ asymp: 8776,
1116
+ ne: 8800,
1117
+ equiv: 8801,
1118
+ le: 8804,
1119
+ ge: 8805,
1120
+ sub: 8834,
1121
+ sup: 8835,
1122
+ nsub: 8836,
1123
+ sube: 8838,
1124
+ supe: 8839,
1125
+ oplus: 8853,
1126
+ otimes: 8855,
1127
+ perp: 8869,
1128
+ sdot: 8901,
1129
+ lceil: 8968,
1130
+ rceil: 8969,
1131
+ lfloor: 8970,
1132
+ rfloor: 8971,
1133
+ lang: 9001,
1134
+ rang: 9002,
1135
+ loz: 9674,
1136
+ spades: 9824,
1137
+ clubs: 9827,
1138
+ hearts: 9829,
1139
+ diams: 9830
1140
+ };
1141
+ var REFERENCE = /&(?:#[xX]([0-9a-fA-F]{1,6})|#([0-9]{1,7})|([a-zA-Z][a-zA-Z0-9]{1,31}));/g;
1142
+ function decodeEntities(value) {
1143
+ if (!value.includes("&")) return value;
1144
+ return value.replace(REFERENCE, (match, hex, dec, name) => {
1145
+ const code = hex ? parseInt(hex, 16) : dec ? parseInt(dec, 10) : Object.prototype.hasOwnProperty.call(NAMED, name) ? NAMED[name] : void 0;
1146
+ return code !== void 0 && code <= 1114111 ? String.fromCodePoint(code) : match;
1147
+ });
1148
+ }
1149
+
853
1150
  // src/lower/template.ts
854
1151
  var DELEGATED = /* @__PURE__ */ new Set([
855
1152
  "click",
@@ -936,7 +1233,7 @@ var Lowerer = class {
936
1233
  switch (node.kind) {
937
1234
  case "Text": {
938
1235
  if (node.raw) return { kind: "text", value: node.value };
939
- const cleaned = cleanTemplateText(node.value);
1236
+ const cleaned = decodeEntities(cleanTemplateText(node.value));
940
1237
  return cleaned ? { kind: "text", value: cleaned } : null;
941
1238
  }
942
1239
  case "Comment":
@@ -972,7 +1269,7 @@ var Lowerer = class {
972
1269
  kind: "element",
973
1270
  tag: el.tag,
974
1271
  svg: el.namespace === "svg",
975
- props: this.lowerAttributes(el.attributes),
1272
+ props: this.lowerAttributes(el.attributes, true),
976
1273
  children,
977
1274
  static: false,
978
1275
  ...at ? { at } : {}
@@ -1085,13 +1382,22 @@ var Lowerer = class {
1085
1382
  return clone.kind === "Element" ? this.lowerElement(clone) : this.lowerComponent(clone);
1086
1383
  }
1087
1384
  // --- attributes ---------------------------------------------------------
1088
- lowerAttributes(attrs) {
1385
+ /**
1386
+ * `element`: a DOM element, where each class:/style: value that moves is its own accessor.
1387
+ * A component gets the object as before, rebuilt whole when any value moves.
1388
+ */
1389
+ lowerAttributes(attrs, element = false) {
1390
+ let anyReactive = false;
1391
+ const entry = (name, h) => {
1392
+ anyReactive ||= h.reactive;
1393
+ if (!element || !h.reactive) return `${JSON.stringify(name)}: ${h.code}`;
1394
+ const accessor = `() => ${paren(h.code, "arrowBody")}`;
1395
+ return `${JSON.stringify(name)}: ${h.at ? markHole(accessor, h.at.line, h.at.column) : accessor}`;
1396
+ };
1089
1397
  const props = [];
1090
1398
  const classEntries = [];
1091
- let classReactive = false;
1092
1399
  let classAt;
1093
1400
  const styleEntries = [];
1094
- let styleReactive = false;
1095
1401
  let styleAt;
1096
1402
  const usePairs = [];
1097
1403
  for (const a of attrs) {
@@ -1131,15 +1437,13 @@ var Lowerer = class {
1131
1437
  break;
1132
1438
  case "ClassDirective": {
1133
1439
  const h = this.hole(a.hole);
1134
- classEntries.push(`${JSON.stringify(a.name)}: ${h.code}`);
1135
- classReactive = classReactive || h.reactive;
1440
+ classEntries.push(entry(a.name, h));
1136
1441
  classAt ??= h.at;
1137
1442
  break;
1138
1443
  }
1139
1444
  case "StyleDirective": {
1140
1445
  const h = this.hole(a.hole);
1141
- styleEntries.push(`${JSON.stringify(a.name)}: ${h.code}`);
1142
- styleReactive = styleReactive || h.reactive;
1446
+ styleEntries.push(entry(a.name, h));
1143
1447
  styleAt ??= h.at;
1144
1448
  break;
1145
1449
  }
@@ -1159,18 +1463,19 @@ var Lowerer = class {
1159
1463
  name: "classList",
1160
1464
  kind: "attr",
1161
1465
  expr: `{ ${classEntries.join(", ")} }`,
1162
- reactive: classReactive,
1466
+ reactive: !element && anyReactive,
1163
1467
  ...classAt ? { at: classAt } : {}
1164
1468
  });
1165
1469
  }
1166
1470
  if (styleEntries.length > 0) {
1167
- props.push({
1168
- name: "style",
1169
- kind: "attr",
1170
- expr: `{ ${styleEntries.join(", ")} }`,
1171
- reactive: styleReactive,
1172
- ...styleAt ? { at: styleAt } : {}
1173
- });
1471
+ const entries = `{ ${styleEntries.join(", ")} }`;
1472
+ const base = props.findIndex((p) => p.name === "style");
1473
+ if (base === -1) props.push({ name: "style", kind: "attr", expr: entries, reactive: !element && anyReactive, ...styleAt ? { at: styleAt } : {} });
1474
+ else {
1475
+ const prop = props[base];
1476
+ const value = prop.expr === void 0 ? JSON.stringify(prop.literal) : prop.reactive ? `() => ${paren(prop.expr, "arrowBody")}` : prop.expr;
1477
+ props[base] = { name: "style", kind: "attr", expr: `[${value}, ${entries}]`, reactive: false, ...prop.at ? { at: prop.at } : {} };
1478
+ }
1174
1479
  }
1175
1480
  if (usePairs.length > 0) {
1176
1481
  props.push({ name: "use", kind: "attr", expr: `[${usePairs.join(", ")}]` });
@@ -1259,7 +1564,7 @@ var Lowerer = class {
1259
1564
  return base;
1260
1565
  }
1261
1566
  if (v.kind === "static") {
1262
- base.literal = v.value;
1567
+ base.literal = decodeEntities(v.value);
1263
1568
  return base;
1264
1569
  }
1265
1570
  if (v.kind === "hole") {
@@ -1272,7 +1577,7 @@ var Lowerer = class {
1272
1577
  let reactive = false;
1273
1578
  let at;
1274
1579
  const body = v.parts.map((p) => {
1275
- if ("text" in p) return escapeTemplate(p.text);
1580
+ if ("text" in p) return escapeTemplate(decodeEntities(p.text));
1276
1581
  const h = this.hole(p.hole);
1277
1582
  reactive = reactive || h.reactive;
1278
1583
  at ??= h.at;
@@ -1319,6 +1624,7 @@ function compilePieces(pieces, holes, options = {}) {
1319
1624
  ...options.sourceFile ? { sourceFile: options.sourceFile } : {},
1320
1625
  ...options.positionAt ? { positionAt: options.positionAt } : {}
1321
1626
  });
1627
+ if (options.templateStyles) applyTemplateStyles(ir, options.templateStyles);
1322
1628
  analyzeStatic(ir);
1323
1629
  resolveComponentSources(ir, {
1324
1630
  resolver: createComponentResolver(options.resolve ?? []),
@@ -0,0 +1,288 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/lower/entities.ts
21
+ var entities_exports = {};
22
+ __export(entities_exports, {
23
+ decodeEntities: () => decodeEntities
24
+ });
25
+ module.exports = __toCommonJS(entities_exports);
26
+ var NAMED = {
27
+ quot: 34,
28
+ amp: 38,
29
+ apos: 39,
30
+ lt: 60,
31
+ gt: 62,
32
+ nbsp: 160,
33
+ iexcl: 161,
34
+ cent: 162,
35
+ pound: 163,
36
+ curren: 164,
37
+ yen: 165,
38
+ brvbar: 166,
39
+ sect: 167,
40
+ uml: 168,
41
+ copy: 169,
42
+ ordf: 170,
43
+ laquo: 171,
44
+ not: 172,
45
+ shy: 173,
46
+ reg: 174,
47
+ macr: 175,
48
+ deg: 176,
49
+ plusmn: 177,
50
+ sup2: 178,
51
+ sup3: 179,
52
+ acute: 180,
53
+ micro: 181,
54
+ para: 182,
55
+ middot: 183,
56
+ cedil: 184,
57
+ sup1: 185,
58
+ ordm: 186,
59
+ raquo: 187,
60
+ frac14: 188,
61
+ frac12: 189,
62
+ frac34: 190,
63
+ iquest: 191,
64
+ Agrave: 192,
65
+ Aacute: 193,
66
+ Acirc: 194,
67
+ Atilde: 195,
68
+ Auml: 196,
69
+ Aring: 197,
70
+ AElig: 198,
71
+ Ccedil: 199,
72
+ Egrave: 200,
73
+ Eacute: 201,
74
+ Ecirc: 202,
75
+ Euml: 203,
76
+ Igrave: 204,
77
+ Iacute: 205,
78
+ Icirc: 206,
79
+ Iuml: 207,
80
+ ETH: 208,
81
+ Ntilde: 209,
82
+ Ograve: 210,
83
+ Oacute: 211,
84
+ Ocirc: 212,
85
+ Otilde: 213,
86
+ Ouml: 214,
87
+ times: 215,
88
+ Oslash: 216,
89
+ Ugrave: 217,
90
+ Uacute: 218,
91
+ Ucirc: 219,
92
+ Uuml: 220,
93
+ Yacute: 221,
94
+ THORN: 222,
95
+ szlig: 223,
96
+ agrave: 224,
97
+ aacute: 225,
98
+ acirc: 226,
99
+ atilde: 227,
100
+ auml: 228,
101
+ aring: 229,
102
+ aelig: 230,
103
+ ccedil: 231,
104
+ egrave: 232,
105
+ eacute: 233,
106
+ ecirc: 234,
107
+ euml: 235,
108
+ igrave: 236,
109
+ iacute: 237,
110
+ icirc: 238,
111
+ iuml: 239,
112
+ eth: 240,
113
+ ntilde: 241,
114
+ ograve: 242,
115
+ oacute: 243,
116
+ ocirc: 244,
117
+ otilde: 245,
118
+ ouml: 246,
119
+ divide: 247,
120
+ oslash: 248,
121
+ ugrave: 249,
122
+ uacute: 250,
123
+ ucirc: 251,
124
+ uuml: 252,
125
+ yacute: 253,
126
+ thorn: 254,
127
+ yuml: 255,
128
+ OElig: 338,
129
+ oelig: 339,
130
+ Scaron: 352,
131
+ scaron: 353,
132
+ Yuml: 376,
133
+ fnof: 402,
134
+ circ: 710,
135
+ tilde: 732,
136
+ Alpha: 913,
137
+ Beta: 914,
138
+ Gamma: 915,
139
+ Delta: 916,
140
+ Epsilon: 917,
141
+ Zeta: 918,
142
+ Eta: 919,
143
+ Theta: 920,
144
+ Iota: 921,
145
+ Kappa: 922,
146
+ Lambda: 923,
147
+ Mu: 924,
148
+ Nu: 925,
149
+ Xi: 926,
150
+ Omicron: 927,
151
+ Pi: 928,
152
+ Rho: 929,
153
+ Sigma: 931,
154
+ Tau: 932,
155
+ Upsilon: 933,
156
+ Phi: 934,
157
+ Chi: 935,
158
+ Psi: 936,
159
+ Omega: 937,
160
+ alpha: 945,
161
+ beta: 946,
162
+ gamma: 947,
163
+ delta: 948,
164
+ epsilon: 949,
165
+ zeta: 950,
166
+ eta: 951,
167
+ theta: 952,
168
+ iota: 953,
169
+ kappa: 954,
170
+ lambda: 955,
171
+ mu: 956,
172
+ nu: 957,
173
+ xi: 958,
174
+ omicron: 959,
175
+ pi: 960,
176
+ rho: 961,
177
+ sigmaf: 962,
178
+ sigma: 963,
179
+ tau: 964,
180
+ upsilon: 965,
181
+ phi: 966,
182
+ chi: 967,
183
+ psi: 968,
184
+ omega: 969,
185
+ thetasym: 977,
186
+ upsih: 978,
187
+ piv: 982,
188
+ ensp: 8194,
189
+ emsp: 8195,
190
+ thinsp: 8201,
191
+ zwnj: 8204,
192
+ zwj: 8205,
193
+ lrm: 8206,
194
+ rlm: 8207,
195
+ ndash: 8211,
196
+ mdash: 8212,
197
+ lsquo: 8216,
198
+ rsquo: 8217,
199
+ sbquo: 8218,
200
+ ldquo: 8220,
201
+ rdquo: 8221,
202
+ bdquo: 8222,
203
+ dagger: 8224,
204
+ Dagger: 8225,
205
+ bull: 8226,
206
+ hellip: 8230,
207
+ permil: 8240,
208
+ prime: 8242,
209
+ Prime: 8243,
210
+ lsaquo: 8249,
211
+ rsaquo: 8250,
212
+ oline: 8254,
213
+ frasl: 8260,
214
+ euro: 8364,
215
+ image: 8465,
216
+ weierp: 8472,
217
+ real: 8476,
218
+ trade: 8482,
219
+ alefsym: 8501,
220
+ larr: 8592,
221
+ uarr: 8593,
222
+ rarr: 8594,
223
+ darr: 8595,
224
+ harr: 8596,
225
+ crarr: 8629,
226
+ lArr: 8656,
227
+ uArr: 8657,
228
+ rArr: 8658,
229
+ dArr: 8659,
230
+ hArr: 8660,
231
+ forall: 8704,
232
+ part: 8706,
233
+ exist: 8707,
234
+ empty: 8709,
235
+ nabla: 8711,
236
+ isin: 8712,
237
+ notin: 8713,
238
+ ni: 8715,
239
+ prod: 8719,
240
+ sum: 8721,
241
+ minus: 8722,
242
+ lowast: 8727,
243
+ radic: 8730,
244
+ prop: 8733,
245
+ infin: 8734,
246
+ ang: 8736,
247
+ and: 8743,
248
+ or: 8744,
249
+ cap: 8745,
250
+ cup: 8746,
251
+ int: 8747,
252
+ there4: 8756,
253
+ sim: 8764,
254
+ cong: 8773,
255
+ asymp: 8776,
256
+ ne: 8800,
257
+ equiv: 8801,
258
+ le: 8804,
259
+ ge: 8805,
260
+ sub: 8834,
261
+ sup: 8835,
262
+ nsub: 8836,
263
+ sube: 8838,
264
+ supe: 8839,
265
+ oplus: 8853,
266
+ otimes: 8855,
267
+ perp: 8869,
268
+ sdot: 8901,
269
+ lceil: 8968,
270
+ rceil: 8969,
271
+ lfloor: 8970,
272
+ rfloor: 8971,
273
+ lang: 9001,
274
+ rang: 9002,
275
+ loz: 9674,
276
+ spades: 9824,
277
+ clubs: 9827,
278
+ hearts: 9829,
279
+ diams: 9830
280
+ };
281
+ var REFERENCE = /&(?:#[xX]([0-9a-fA-F]{1,6})|#([0-9]{1,7})|([a-zA-Z][a-zA-Z0-9]{1,31}));/g;
282
+ function decodeEntities(value) {
283
+ if (!value.includes("&")) return value;
284
+ return value.replace(REFERENCE, (match, hex, dec, name) => {
285
+ const code = hex ? parseInt(hex, 16) : dec ? parseInt(dec, 10) : Object.prototype.hasOwnProperty.call(NAMED, name) ? NAMED[name] : void 0;
286
+ return code !== void 0 && code <= 1114111 ? String.fromCodePoint(code) : match;
287
+ });
288
+ }
@@ -0,0 +1 @@
1
+ export declare function decodeEntities(value: string): string;
@@ -0,0 +1,2 @@
1
+ export declare function decodeEntities(value: string): string;
2
+ //# sourceMappingURL=entities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../src/lower/entities.ts"],"names":[],"mappings":"AAgDA,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMpD"}