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

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 (93) hide show
  1. package/LICENSE +1 -1
  2. package/dist/analyze/intrinsics.cjs +13 -1
  3. package/dist/analyze/intrinsics.d.cts +14 -0
  4. package/dist/analyze/intrinsics.d.ts +14 -0
  5. package/dist/analyze/intrinsics.d.ts.map +1 -1
  6. package/dist/analyze/intrinsics.js +17 -0
  7. package/dist/analyze/intrinsics.mjs +13 -1
  8. package/dist/analyze/static-graph.cjs +1 -1
  9. package/dist/analyze/static-graph.mjs +1 -1
  10. package/dist/{babel-RJHJQVEM.mjs → babel-V33QLJBF.mjs} +4 -4
  11. package/dist/{chunk-56QSOVVL.mjs → chunk-62F2LLBM.mjs} +1 -1
  12. package/dist/{chunk-R7PPFBCL.mjs → chunk-7GNSGUHK.mjs} +4 -83
  13. package/dist/{chunk-U7HCFLZ2.mjs → chunk-B64LVPTU.mjs} +356 -24
  14. package/dist/{chunk-OD53TMER.mjs → chunk-C3AK5PBV.mjs} +13 -1
  15. package/dist/{chunk-TJIH7TLX.mjs → chunk-GLFUPZ27.mjs} +1 -1
  16. package/dist/chunk-HUABRVWB.mjs +92 -0
  17. package/dist/chunk-XCWP7WJG.mjs +584 -0
  18. package/dist/codegen/backends/imperative.cjs +1 -1
  19. package/dist/codegen/backends/imperative.d.ts.map +1 -1
  20. package/dist/codegen/backends/imperative.js +2 -1
  21. package/dist/codegen/backends/imperative.mjs +1 -1
  22. package/dist/frontend/babel/build-ir-lit.cjs +352 -22
  23. package/dist/frontend/babel/build-ir-lit.mjs +352 -22
  24. package/dist/frontend/babel/build-ir.cjs +352 -22
  25. package/dist/frontend/babel/build-ir.mjs +352 -22
  26. package/dist/frontend/babel/index.cjs +353 -23
  27. package/dist/frontend/babel/index.mjs +353 -23
  28. package/dist/frontend/babel/lower-template.cjs +352 -22
  29. package/dist/frontend/babel/lower-template.mjs +352 -22
  30. package/dist/frontend/babel/plugin.cjs +352 -22
  31. package/dist/frontend/babel/plugin.mjs +352 -22
  32. package/dist/index.cjs +321 -22
  33. package/dist/index.mjs +333 -22
  34. package/dist/integrations.cjs +1240 -56
  35. package/dist/integrations.d.ts.map +1 -1
  36. package/dist/integrations.js +62 -9
  37. package/dist/integrations.mjs +257 -26
  38. package/dist/lower/compile-template.cjs +315 -21
  39. package/dist/lower/compile-template.d.cts +13 -0
  40. package/dist/lower/compile-template.d.ts +13 -0
  41. package/dist/lower/compile-template.d.ts.map +1 -1
  42. package/dist/lower/compile-template.js +3 -0
  43. package/dist/lower/compile-template.mjs +327 -21
  44. package/dist/lower/entities.cjs +288 -0
  45. package/dist/lower/entities.d.cts +1 -0
  46. package/dist/lower/entities.d.ts +2 -0
  47. package/dist/lower/entities.d.ts.map +1 -0
  48. package/dist/lower/entities.js +54 -0
  49. package/dist/lower/entities.mjs +267 -0
  50. package/dist/lower/jsx.cjs +104 -47
  51. package/dist/lower/jsx.d.cts +8 -0
  52. package/dist/lower/jsx.d.ts +8 -0
  53. package/dist/lower/jsx.d.ts.map +1 -1
  54. package/dist/lower/jsx.js +92 -2
  55. package/dist/lower/jsx.mjs +104 -47
  56. package/dist/lower/template.cjs +293 -20
  57. package/dist/lower/template.d.ts.map +1 -1
  58. package/dist/lower/template.js +35 -19
  59. package/dist/lower/template.mjs +293 -20
  60. package/dist/resolve/builtins.cjs +1 -1
  61. package/dist/resolve/builtins.mjs +1 -1
  62. package/dist/resolve/component-globals.cjs +6 -1
  63. package/dist/resolve/component-globals.js +2 -2
  64. package/dist/resolve/component-globals.mjs +6 -1
  65. package/dist/resolve/write-globals.cjs +6 -1
  66. package/dist/resolve/write-globals.mjs +6 -1
  67. package/dist/{server-fns-ZFRDIQ2X.mjs → server-fns-N3SDJXA7.mjs} +5 -4
  68. package/dist/{server-functions-CTDXX67X.mjs → server-functions-LVS66Q4R.mjs} +3 -3
  69. package/dist/transform/index.cjs +973 -33
  70. package/dist/transform/index.mjs +991 -47
  71. package/dist/transform/props.mjs +19 -14
  72. package/dist/transform/server-fns.mjs +19 -14
  73. package/dist/transform/styles.cjs +606 -0
  74. package/dist/transform/styles.d.cts +237 -0
  75. package/dist/transform/styles.d.ts +238 -0
  76. package/dist/transform/styles.d.ts.map +1 -0
  77. package/dist/transform/styles.js +743 -0
  78. package/dist/transform/styles.mjs +671 -0
  79. package/dist/transform/templates.cjs +972 -32
  80. package/dist/transform/templates.d.cts +13 -0
  81. package/dist/transform/templates.d.ts +13 -0
  82. package/dist/transform/templates.d.ts.map +1 -1
  83. package/dist/transform/templates.js +49 -12
  84. package/dist/transform/templates.mjs +990 -46
  85. package/dist/{transform-QWWQDCXE.mjs → transform-P4AETYV4.mjs} +49 -16
  86. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  87. package/dist/vite-styles.cjs +223 -0
  88. package/dist/vite-styles.d.cts +68 -0
  89. package/dist/vite-styles.d.ts +69 -0
  90. package/dist/vite-styles.d.ts.map +1 -0
  91. package/dist/vite-styles.js +241 -0
  92. package/dist/vite-styles.mjs +214 -0
  93. package/package.json +5 -4
@@ -676,7 +676,7 @@ function emitComponent(name, props, children, used, templates, at) {
676
676
  }
677
677
  let obj = `{ ${bodies.map(([name2, body]) => `get ${propKey(name2)}() { return ${body}; }`).join(", ")} }`;
678
678
  if (bodies.some(([, body]) => /\bthis\b/.test(body))) {
679
- const thunks = bodies.map(([name2, body]) => `${JSON.stringify(name2)}: () => ${body}`);
679
+ const thunks = bodies.map(([name2, body]) => `${JSON.stringify(name2)}: () => (${body})`);
680
680
  const getters = bodies.map(([name2]) => `get ${propKey(name2)}() { return _$t[${JSON.stringify(name2)}](); }`);
681
681
  obj = `((_$t) => ({ ${getters.join(", ")} }))({ ${thunks.join(", ")} })`;
682
682
  }
@@ -822,6 +822,271 @@ function cleanTemplateText(value) {
822
822
  return out;
823
823
  }
824
824
 
825
+ // src/lower/entities.ts
826
+ var NAMED = {
827
+ quot: 34,
828
+ amp: 38,
829
+ apos: 39,
830
+ lt: 60,
831
+ gt: 62,
832
+ nbsp: 160,
833
+ iexcl: 161,
834
+ cent: 162,
835
+ pound: 163,
836
+ curren: 164,
837
+ yen: 165,
838
+ brvbar: 166,
839
+ sect: 167,
840
+ uml: 168,
841
+ copy: 169,
842
+ ordf: 170,
843
+ laquo: 171,
844
+ not: 172,
845
+ shy: 173,
846
+ reg: 174,
847
+ macr: 175,
848
+ deg: 176,
849
+ plusmn: 177,
850
+ sup2: 178,
851
+ sup3: 179,
852
+ acute: 180,
853
+ micro: 181,
854
+ para: 182,
855
+ middot: 183,
856
+ cedil: 184,
857
+ sup1: 185,
858
+ ordm: 186,
859
+ raquo: 187,
860
+ frac14: 188,
861
+ frac12: 189,
862
+ frac34: 190,
863
+ iquest: 191,
864
+ Agrave: 192,
865
+ Aacute: 193,
866
+ Acirc: 194,
867
+ Atilde: 195,
868
+ Auml: 196,
869
+ Aring: 197,
870
+ AElig: 198,
871
+ Ccedil: 199,
872
+ Egrave: 200,
873
+ Eacute: 201,
874
+ Ecirc: 202,
875
+ Euml: 203,
876
+ Igrave: 204,
877
+ Iacute: 205,
878
+ Icirc: 206,
879
+ Iuml: 207,
880
+ ETH: 208,
881
+ Ntilde: 209,
882
+ Ograve: 210,
883
+ Oacute: 211,
884
+ Ocirc: 212,
885
+ Otilde: 213,
886
+ Ouml: 214,
887
+ times: 215,
888
+ Oslash: 216,
889
+ Ugrave: 217,
890
+ Uacute: 218,
891
+ Ucirc: 219,
892
+ Uuml: 220,
893
+ Yacute: 221,
894
+ THORN: 222,
895
+ szlig: 223,
896
+ agrave: 224,
897
+ aacute: 225,
898
+ acirc: 226,
899
+ atilde: 227,
900
+ auml: 228,
901
+ aring: 229,
902
+ aelig: 230,
903
+ ccedil: 231,
904
+ egrave: 232,
905
+ eacute: 233,
906
+ ecirc: 234,
907
+ euml: 235,
908
+ igrave: 236,
909
+ iacute: 237,
910
+ icirc: 238,
911
+ iuml: 239,
912
+ eth: 240,
913
+ ntilde: 241,
914
+ ograve: 242,
915
+ oacute: 243,
916
+ ocirc: 244,
917
+ otilde: 245,
918
+ ouml: 246,
919
+ divide: 247,
920
+ oslash: 248,
921
+ ugrave: 249,
922
+ uacute: 250,
923
+ ucirc: 251,
924
+ uuml: 252,
925
+ yacute: 253,
926
+ thorn: 254,
927
+ yuml: 255,
928
+ OElig: 338,
929
+ oelig: 339,
930
+ Scaron: 352,
931
+ scaron: 353,
932
+ Yuml: 376,
933
+ fnof: 402,
934
+ circ: 710,
935
+ tilde: 732,
936
+ Alpha: 913,
937
+ Beta: 914,
938
+ Gamma: 915,
939
+ Delta: 916,
940
+ Epsilon: 917,
941
+ Zeta: 918,
942
+ Eta: 919,
943
+ Theta: 920,
944
+ Iota: 921,
945
+ Kappa: 922,
946
+ Lambda: 923,
947
+ Mu: 924,
948
+ Nu: 925,
949
+ Xi: 926,
950
+ Omicron: 927,
951
+ Pi: 928,
952
+ Rho: 929,
953
+ Sigma: 931,
954
+ Tau: 932,
955
+ Upsilon: 933,
956
+ Phi: 934,
957
+ Chi: 935,
958
+ Psi: 936,
959
+ Omega: 937,
960
+ alpha: 945,
961
+ beta: 946,
962
+ gamma: 947,
963
+ delta: 948,
964
+ epsilon: 949,
965
+ zeta: 950,
966
+ eta: 951,
967
+ theta: 952,
968
+ iota: 953,
969
+ kappa: 954,
970
+ lambda: 955,
971
+ mu: 956,
972
+ nu: 957,
973
+ xi: 958,
974
+ omicron: 959,
975
+ pi: 960,
976
+ rho: 961,
977
+ sigmaf: 962,
978
+ sigma: 963,
979
+ tau: 964,
980
+ upsilon: 965,
981
+ phi: 966,
982
+ chi: 967,
983
+ psi: 968,
984
+ omega: 969,
985
+ thetasym: 977,
986
+ upsih: 978,
987
+ piv: 982,
988
+ ensp: 8194,
989
+ emsp: 8195,
990
+ thinsp: 8201,
991
+ zwnj: 8204,
992
+ zwj: 8205,
993
+ lrm: 8206,
994
+ rlm: 8207,
995
+ ndash: 8211,
996
+ mdash: 8212,
997
+ lsquo: 8216,
998
+ rsquo: 8217,
999
+ sbquo: 8218,
1000
+ ldquo: 8220,
1001
+ rdquo: 8221,
1002
+ bdquo: 8222,
1003
+ dagger: 8224,
1004
+ Dagger: 8225,
1005
+ bull: 8226,
1006
+ hellip: 8230,
1007
+ permil: 8240,
1008
+ prime: 8242,
1009
+ Prime: 8243,
1010
+ lsaquo: 8249,
1011
+ rsaquo: 8250,
1012
+ oline: 8254,
1013
+ frasl: 8260,
1014
+ euro: 8364,
1015
+ image: 8465,
1016
+ weierp: 8472,
1017
+ real: 8476,
1018
+ trade: 8482,
1019
+ alefsym: 8501,
1020
+ larr: 8592,
1021
+ uarr: 8593,
1022
+ rarr: 8594,
1023
+ darr: 8595,
1024
+ harr: 8596,
1025
+ crarr: 8629,
1026
+ lArr: 8656,
1027
+ uArr: 8657,
1028
+ rArr: 8658,
1029
+ dArr: 8659,
1030
+ hArr: 8660,
1031
+ forall: 8704,
1032
+ part: 8706,
1033
+ exist: 8707,
1034
+ empty: 8709,
1035
+ nabla: 8711,
1036
+ isin: 8712,
1037
+ notin: 8713,
1038
+ ni: 8715,
1039
+ prod: 8719,
1040
+ sum: 8721,
1041
+ minus: 8722,
1042
+ lowast: 8727,
1043
+ radic: 8730,
1044
+ prop: 8733,
1045
+ infin: 8734,
1046
+ ang: 8736,
1047
+ and: 8743,
1048
+ or: 8744,
1049
+ cap: 8745,
1050
+ cup: 8746,
1051
+ int: 8747,
1052
+ there4: 8756,
1053
+ sim: 8764,
1054
+ cong: 8773,
1055
+ asymp: 8776,
1056
+ ne: 8800,
1057
+ equiv: 8801,
1058
+ le: 8804,
1059
+ ge: 8805,
1060
+ sub: 8834,
1061
+ sup: 8835,
1062
+ nsub: 8836,
1063
+ sube: 8838,
1064
+ supe: 8839,
1065
+ oplus: 8853,
1066
+ otimes: 8855,
1067
+ perp: 8869,
1068
+ sdot: 8901,
1069
+ lceil: 8968,
1070
+ rceil: 8969,
1071
+ lfloor: 8970,
1072
+ rfloor: 8971,
1073
+ lang: 9001,
1074
+ rang: 9002,
1075
+ loz: 9674,
1076
+ spades: 9824,
1077
+ clubs: 9827,
1078
+ hearts: 9829,
1079
+ diams: 9830
1080
+ };
1081
+ var REFERENCE = /&(?:#[xX]([0-9a-fA-F]{1,6})|#([0-9]{1,7})|([a-zA-Z][a-zA-Z0-9]{1,31}));/g;
1082
+ function decodeEntities(value) {
1083
+ if (!value.includes("&")) return value;
1084
+ return value.replace(REFERENCE, (match, hex, dec, name) => {
1085
+ const code = hex ? parseInt(hex, 16) : dec ? parseInt(dec, 10) : Object.prototype.hasOwnProperty.call(NAMED, name) ? NAMED[name] : void 0;
1086
+ return code !== void 0 && code <= 1114111 ? String.fromCodePoint(code) : match;
1087
+ });
1088
+ }
1089
+
825
1090
  // src/lower/template.ts
826
1091
  var DELEGATED = /* @__PURE__ */ new Set([
827
1092
  "click",
@@ -908,7 +1173,7 @@ var Lowerer = class {
908
1173
  switch (node.kind) {
909
1174
  case "Text": {
910
1175
  if (node.raw) return { kind: "text", value: node.value };
911
- const cleaned = cleanTemplateText(node.value);
1176
+ const cleaned = decodeEntities(cleanTemplateText(node.value));
912
1177
  return cleaned ? { kind: "text", value: cleaned } : null;
913
1178
  }
914
1179
  case "Comment":
@@ -944,7 +1209,7 @@ var Lowerer = class {
944
1209
  kind: "element",
945
1210
  tag: el.tag,
946
1211
  svg: el.namespace === "svg",
947
- props: this.lowerAttributes(el.attributes),
1212
+ props: this.lowerAttributes(el.attributes, true),
948
1213
  children,
949
1214
  static: false,
950
1215
  ...at ? { at } : {}
@@ -1057,13 +1322,22 @@ var Lowerer = class {
1057
1322
  return clone.kind === "Element" ? this.lowerElement(clone) : this.lowerComponent(clone);
1058
1323
  }
1059
1324
  // --- attributes ---------------------------------------------------------
1060
- lowerAttributes(attrs) {
1325
+ /**
1326
+ * `element`: a DOM element, where each class:/style: value that moves is its own accessor.
1327
+ * A component gets the object as before, rebuilt whole when any value moves.
1328
+ */
1329
+ lowerAttributes(attrs, element = false) {
1330
+ let anyReactive = false;
1331
+ const entry = (name, h) => {
1332
+ anyReactive ||= h.reactive;
1333
+ if (!element || !h.reactive) return `${JSON.stringify(name)}: ${h.code}`;
1334
+ const accessor = `() => ${paren(h.code, "arrowBody")}`;
1335
+ return `${JSON.stringify(name)}: ${h.at ? markHole(accessor, h.at.line, h.at.column) : accessor}`;
1336
+ };
1061
1337
  const props = [];
1062
1338
  const classEntries = [];
1063
- let classReactive = false;
1064
1339
  let classAt;
1065
1340
  const styleEntries = [];
1066
- let styleReactive = false;
1067
1341
  let styleAt;
1068
1342
  const usePairs = [];
1069
1343
  for (const a of attrs) {
@@ -1103,15 +1377,13 @@ var Lowerer = class {
1103
1377
  break;
1104
1378
  case "ClassDirective": {
1105
1379
  const h = this.hole(a.hole);
1106
- classEntries.push(`${JSON.stringify(a.name)}: ${h.code}`);
1107
- classReactive = classReactive || h.reactive;
1380
+ classEntries.push(entry(a.name, h));
1108
1381
  classAt ??= h.at;
1109
1382
  break;
1110
1383
  }
1111
1384
  case "StyleDirective": {
1112
1385
  const h = this.hole(a.hole);
1113
- styleEntries.push(`${JSON.stringify(a.name)}: ${h.code}`);
1114
- styleReactive = styleReactive || h.reactive;
1386
+ styleEntries.push(entry(a.name, h));
1115
1387
  styleAt ??= h.at;
1116
1388
  break;
1117
1389
  }
@@ -1131,18 +1403,19 @@ var Lowerer = class {
1131
1403
  name: "classList",
1132
1404
  kind: "attr",
1133
1405
  expr: `{ ${classEntries.join(", ")} }`,
1134
- reactive: classReactive,
1406
+ reactive: !element && anyReactive,
1135
1407
  ...classAt ? { at: classAt } : {}
1136
1408
  });
1137
1409
  }
1138
1410
  if (styleEntries.length > 0) {
1139
- props.push({
1140
- name: "style",
1141
- kind: "attr",
1142
- expr: `{ ${styleEntries.join(", ")} }`,
1143
- reactive: styleReactive,
1144
- ...styleAt ? { at: styleAt } : {}
1145
- });
1411
+ const entries = `{ ${styleEntries.join(", ")} }`;
1412
+ const base = props.findIndex((p) => p.name === "style");
1413
+ if (base === -1) props.push({ name: "style", kind: "attr", expr: entries, reactive: !element && anyReactive, ...styleAt ? { at: styleAt } : {} });
1414
+ else {
1415
+ const prop = props[base];
1416
+ const value = prop.expr === void 0 ? JSON.stringify(prop.literal) : prop.reactive ? `() => ${paren(prop.expr, "arrowBody")}` : prop.expr;
1417
+ props[base] = { name: "style", kind: "attr", expr: `[${value}, ${entries}]`, reactive: false, ...prop.at ? { at: prop.at } : {} };
1418
+ }
1146
1419
  }
1147
1420
  if (usePairs.length > 0) {
1148
1421
  props.push({ name: "use", kind: "attr", expr: `[${usePairs.join(", ")}]` });
@@ -1231,7 +1504,7 @@ var Lowerer = class {
1231
1504
  return base;
1232
1505
  }
1233
1506
  if (v.kind === "static") {
1234
- base.literal = v.value;
1507
+ base.literal = decodeEntities(v.value);
1235
1508
  return base;
1236
1509
  }
1237
1510
  if (v.kind === "hole") {
@@ -1244,7 +1517,7 @@ var Lowerer = class {
1244
1517
  let reactive = false;
1245
1518
  let at;
1246
1519
  const body = v.parts.map((p) => {
1247
- if ("text" in p) return escapeTemplate(p.text);
1520
+ if ("text" in p) return escapeTemplate(decodeEntities(p.text));
1248
1521
  const h = this.hole(p.hole);
1249
1522
  reactive = reactive || h.reactive;
1250
1523
  at ??= h.at;
@@ -1560,9 +1833,12 @@ function attrExprCode(attr, ctx) {
1560
1833
  }
1561
1834
  return null;
1562
1835
  }
1563
- function buildProps(attrs, ctx) {
1836
+ function buildProps(attrs, ctx, element = false) {
1564
1837
  const props = [];
1565
1838
  const usePairs = [];
1839
+ const classEntries = [];
1840
+ const styleEntries = [];
1841
+ let styleAt;
1566
1842
  for (const a of attrs) {
1567
1843
  if (a.type === "JSXSpreadAttribute") {
1568
1844
  props.push({ name: "", kind: "spread", expr: ctx.code(a.argument) });
@@ -1578,6 +1854,27 @@ function buildProps(attrs, ctx) {
1578
1854
  usePairs.push(opts != null ? `[${dir}, () => ${paren(opts, "arrowBody")}]` : `[${dir}]`);
1579
1855
  continue;
1580
1856
  }
1857
+ if (element && (ns === "class" || ns === "style")) {
1858
+ const key = JSON.stringify(a.name.name.name);
1859
+ const v = a.value;
1860
+ let value;
1861
+ if (v == null) value = "true";
1862
+ else if (isString(v)) value = JSON.stringify(literalOf(v));
1863
+ else if (v.type === "JSXExpressionContainer" && v.expression?.type !== "JSXEmptyExpression") {
1864
+ value = keyValue(v.expression, ctx);
1865
+ if (ns === "style") styleAt ??= posOf(v.expression, ctx);
1866
+ } else continue;
1867
+ (ns === "class" ? classEntries : styleEntries).push(`${key}: ${value}`);
1868
+ continue;
1869
+ }
1870
+ if (element && a.name.type === "JSXIdentifier" && a.name.name === "style" && a.value?.type === "JSXExpressionContainer") {
1871
+ const entries = objectEntries(a.value.expression, ctx);
1872
+ if (entries) {
1873
+ styleEntries.unshift(...entries);
1874
+ styleAt = posOf(a.value.expression, ctx);
1875
+ continue;
1876
+ }
1877
+ }
1581
1878
  if (ns === "oncapture") {
1582
1879
  const evt = a.name.name.name.toLowerCase();
1583
1880
  const h = attrExprCode(a, ctx) ?? "undefined";
@@ -1586,9 +1883,37 @@ function buildProps(attrs, ctx) {
1586
1883
  }
1587
1884
  props.push(buildAttr(a, ctx));
1588
1885
  }
1886
+ if (classEntries.length > 0) props.push({ name: "classList", kind: "attr", expr: `{ ${classEntries.join(", ")} }`, reactive: false });
1887
+ if (styleEntries.length > 0) {
1888
+ const entries = `{ ${styleEntries.join(", ")} }`;
1889
+ const base = props.findIndex((p) => p.name === "style" && p.kind === "attr");
1890
+ if (base === -1) props.push({ name: "style", kind: "attr", expr: entries, reactive: false, ...styleAt ? { at: styleAt } : {} });
1891
+ else {
1892
+ const prop = props[base];
1893
+ const value = prop.literal !== void 0 ? JSON.stringify(prop.literal) : prop.reactive ? `() => ${paren(prop.expr, "arrowBody")}` : prop.expr;
1894
+ props[base] = { name: "style", kind: "attr", expr: `[${value}, ${entries}]`, reactive: false, ...prop.at ? { at: prop.at } : {} };
1895
+ }
1896
+ }
1589
1897
  if (usePairs.length > 0) props.push({ name: "use", kind: "attr", expr: `[${usePairs.join(", ")}]` });
1590
1898
  return props;
1591
1899
  }
1900
+ function keyValue(expr, ctx) {
1901
+ const code = ctx.code(expr);
1902
+ if (!isReactive(expr)) return code;
1903
+ const accessor = `() => ${paren(code, "arrowBody")}`;
1904
+ const at = posOf(expr, ctx);
1905
+ return at ? markHole(accessor, at.line, at.column) : accessor;
1906
+ }
1907
+ function objectEntries(expr, ctx) {
1908
+ if (expr?.type !== "ObjectExpression") return null;
1909
+ const entries = [];
1910
+ for (const p of expr.properties) {
1911
+ if (p.type !== "ObjectProperty") return null;
1912
+ const key = p.computed ? `[${ctx.code(p.key)}]` : p.key.type === "Identifier" ? JSON.stringify(p.key.name) : JSON.stringify(String(p.key.value));
1913
+ entries.push(`${key}: ${keyValue(p.value, ctx)}`);
1914
+ }
1915
+ return entries;
1916
+ }
1592
1917
  function buildChildren(children, ctx) {
1593
1918
  const out = [];
1594
1919
  for (let i = 0; i < children.length; i++) {
@@ -1616,6 +1941,7 @@ function buildChildren(children, ctx) {
1616
1941
  });
1617
1942
  }
1618
1943
  } else if (child.type === "JSXElement" || child.type === "JSXFragment") {
1944
+ if (ctx.dropStyles?.has(child.start)) continue;
1619
1945
  out.push(buildNode(child, ctx));
1620
1946
  } else if (child.type === "JSXSpreadChild") {
1621
1947
  out.push({ kind: "expr", code: ctx.code(child.expression), reactive: false });
@@ -1685,13 +2011,17 @@ function buildElement(node, ctx, handled) {
1685
2011
  const children = each ? [each] : buildChildren(node.children, ctx);
1686
2012
  if (tag === CONTAINER2) return children.length === 1 ? children[0] : { kind: "fragment", children };
1687
2013
  const at = ctx.sourceFile && node.loc?.start ? { file: ctx.sourceFile, line: node.loc.start.line, column: node.loc.start.column } : void 0;
1688
- return { kind: "element", tag, svg: SVG_TAGS.has(tag), props: buildProps(attributes, ctx), children, static: false, ...at ? { at } : {} };
2014
+ const props = buildProps(attributes, ctx, true);
2015
+ const scope = ctx.scopes?.find((s) => node.start >= s.start && node.end <= s.end);
2016
+ if (scope) props.unshift({ name: "data-fx-s", kind: "attr", literal: scope.value });
2017
+ return { kind: "element", tag, svg: SVG_TAGS.has(tag), props, children, static: false, ...at ? { at } : {} };
1689
2018
  }
1690
2019
  function buildNode(node, ctx) {
1691
2020
  if (node.type === "JSXFragment") {
1692
2021
  return { kind: "fragment", children: buildChildren(node.children, ctx) };
1693
2022
  }
1694
2023
  if (directive(node, "if")) return buildIf(node, null, ctx);
2024
+ if (ctx.dropStyles?.has(node.start)) return { kind: "fragment", children: [] };
1695
2025
  const { tag, component } = tagInfo(node.openingElement.name, ctx);
1696
2026
  if (!component) return buildElement(node, ctx, []);
1697
2027
  const props = buildProps(node.openingElement.attributes, ctx);