@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
@@ -642,7 +642,7 @@ function emitComponent(name, props, children, used, templates, at) {
642
642
  }
643
643
  let obj = `{ ${bodies.map(([name2, body]) => `get ${propKey(name2)}() { return ${body}; }`).join(", ")} }`;
644
644
  if (bodies.some(([, body]) => /\bthis\b/.test(body))) {
645
- const thunks = bodies.map(([name2, body]) => `${JSON.stringify(name2)}: () => ${body}`);
645
+ const thunks = bodies.map(([name2, body]) => `${JSON.stringify(name2)}: () => (${body})`);
646
646
  const getters = bodies.map(([name2]) => `get ${propKey(name2)}() { return _$t[${JSON.stringify(name2)}](); }`);
647
647
  obj = `((_$t) => ({ ${getters.join(", ")} }))({ ${thunks.join(", ")} })`;
648
648
  }
@@ -790,6 +790,271 @@ function cleanTemplateText(value) {
790
790
  return out;
791
791
  }
792
792
 
793
+ // src/lower/entities.ts
794
+ var NAMED = {
795
+ quot: 34,
796
+ amp: 38,
797
+ apos: 39,
798
+ lt: 60,
799
+ gt: 62,
800
+ nbsp: 160,
801
+ iexcl: 161,
802
+ cent: 162,
803
+ pound: 163,
804
+ curren: 164,
805
+ yen: 165,
806
+ brvbar: 166,
807
+ sect: 167,
808
+ uml: 168,
809
+ copy: 169,
810
+ ordf: 170,
811
+ laquo: 171,
812
+ not: 172,
813
+ shy: 173,
814
+ reg: 174,
815
+ macr: 175,
816
+ deg: 176,
817
+ plusmn: 177,
818
+ sup2: 178,
819
+ sup3: 179,
820
+ acute: 180,
821
+ micro: 181,
822
+ para: 182,
823
+ middot: 183,
824
+ cedil: 184,
825
+ sup1: 185,
826
+ ordm: 186,
827
+ raquo: 187,
828
+ frac14: 188,
829
+ frac12: 189,
830
+ frac34: 190,
831
+ iquest: 191,
832
+ Agrave: 192,
833
+ Aacute: 193,
834
+ Acirc: 194,
835
+ Atilde: 195,
836
+ Auml: 196,
837
+ Aring: 197,
838
+ AElig: 198,
839
+ Ccedil: 199,
840
+ Egrave: 200,
841
+ Eacute: 201,
842
+ Ecirc: 202,
843
+ Euml: 203,
844
+ Igrave: 204,
845
+ Iacute: 205,
846
+ Icirc: 206,
847
+ Iuml: 207,
848
+ ETH: 208,
849
+ Ntilde: 209,
850
+ Ograve: 210,
851
+ Oacute: 211,
852
+ Ocirc: 212,
853
+ Otilde: 213,
854
+ Ouml: 214,
855
+ times: 215,
856
+ Oslash: 216,
857
+ Ugrave: 217,
858
+ Uacute: 218,
859
+ Ucirc: 219,
860
+ Uuml: 220,
861
+ Yacute: 221,
862
+ THORN: 222,
863
+ szlig: 223,
864
+ agrave: 224,
865
+ aacute: 225,
866
+ acirc: 226,
867
+ atilde: 227,
868
+ auml: 228,
869
+ aring: 229,
870
+ aelig: 230,
871
+ ccedil: 231,
872
+ egrave: 232,
873
+ eacute: 233,
874
+ ecirc: 234,
875
+ euml: 235,
876
+ igrave: 236,
877
+ iacute: 237,
878
+ icirc: 238,
879
+ iuml: 239,
880
+ eth: 240,
881
+ ntilde: 241,
882
+ ograve: 242,
883
+ oacute: 243,
884
+ ocirc: 244,
885
+ otilde: 245,
886
+ ouml: 246,
887
+ divide: 247,
888
+ oslash: 248,
889
+ ugrave: 249,
890
+ uacute: 250,
891
+ ucirc: 251,
892
+ uuml: 252,
893
+ yacute: 253,
894
+ thorn: 254,
895
+ yuml: 255,
896
+ OElig: 338,
897
+ oelig: 339,
898
+ Scaron: 352,
899
+ scaron: 353,
900
+ Yuml: 376,
901
+ fnof: 402,
902
+ circ: 710,
903
+ tilde: 732,
904
+ Alpha: 913,
905
+ Beta: 914,
906
+ Gamma: 915,
907
+ Delta: 916,
908
+ Epsilon: 917,
909
+ Zeta: 918,
910
+ Eta: 919,
911
+ Theta: 920,
912
+ Iota: 921,
913
+ Kappa: 922,
914
+ Lambda: 923,
915
+ Mu: 924,
916
+ Nu: 925,
917
+ Xi: 926,
918
+ Omicron: 927,
919
+ Pi: 928,
920
+ Rho: 929,
921
+ Sigma: 931,
922
+ Tau: 932,
923
+ Upsilon: 933,
924
+ Phi: 934,
925
+ Chi: 935,
926
+ Psi: 936,
927
+ Omega: 937,
928
+ alpha: 945,
929
+ beta: 946,
930
+ gamma: 947,
931
+ delta: 948,
932
+ epsilon: 949,
933
+ zeta: 950,
934
+ eta: 951,
935
+ theta: 952,
936
+ iota: 953,
937
+ kappa: 954,
938
+ lambda: 955,
939
+ mu: 956,
940
+ nu: 957,
941
+ xi: 958,
942
+ omicron: 959,
943
+ pi: 960,
944
+ rho: 961,
945
+ sigmaf: 962,
946
+ sigma: 963,
947
+ tau: 964,
948
+ upsilon: 965,
949
+ phi: 966,
950
+ chi: 967,
951
+ psi: 968,
952
+ omega: 969,
953
+ thetasym: 977,
954
+ upsih: 978,
955
+ piv: 982,
956
+ ensp: 8194,
957
+ emsp: 8195,
958
+ thinsp: 8201,
959
+ zwnj: 8204,
960
+ zwj: 8205,
961
+ lrm: 8206,
962
+ rlm: 8207,
963
+ ndash: 8211,
964
+ mdash: 8212,
965
+ lsquo: 8216,
966
+ rsquo: 8217,
967
+ sbquo: 8218,
968
+ ldquo: 8220,
969
+ rdquo: 8221,
970
+ bdquo: 8222,
971
+ dagger: 8224,
972
+ Dagger: 8225,
973
+ bull: 8226,
974
+ hellip: 8230,
975
+ permil: 8240,
976
+ prime: 8242,
977
+ Prime: 8243,
978
+ lsaquo: 8249,
979
+ rsaquo: 8250,
980
+ oline: 8254,
981
+ frasl: 8260,
982
+ euro: 8364,
983
+ image: 8465,
984
+ weierp: 8472,
985
+ real: 8476,
986
+ trade: 8482,
987
+ alefsym: 8501,
988
+ larr: 8592,
989
+ uarr: 8593,
990
+ rarr: 8594,
991
+ darr: 8595,
992
+ harr: 8596,
993
+ crarr: 8629,
994
+ lArr: 8656,
995
+ uArr: 8657,
996
+ rArr: 8658,
997
+ dArr: 8659,
998
+ hArr: 8660,
999
+ forall: 8704,
1000
+ part: 8706,
1001
+ exist: 8707,
1002
+ empty: 8709,
1003
+ nabla: 8711,
1004
+ isin: 8712,
1005
+ notin: 8713,
1006
+ ni: 8715,
1007
+ prod: 8719,
1008
+ sum: 8721,
1009
+ minus: 8722,
1010
+ lowast: 8727,
1011
+ radic: 8730,
1012
+ prop: 8733,
1013
+ infin: 8734,
1014
+ ang: 8736,
1015
+ and: 8743,
1016
+ or: 8744,
1017
+ cap: 8745,
1018
+ cup: 8746,
1019
+ int: 8747,
1020
+ there4: 8756,
1021
+ sim: 8764,
1022
+ cong: 8773,
1023
+ asymp: 8776,
1024
+ ne: 8800,
1025
+ equiv: 8801,
1026
+ le: 8804,
1027
+ ge: 8805,
1028
+ sub: 8834,
1029
+ sup: 8835,
1030
+ nsub: 8836,
1031
+ sube: 8838,
1032
+ supe: 8839,
1033
+ oplus: 8853,
1034
+ otimes: 8855,
1035
+ perp: 8869,
1036
+ sdot: 8901,
1037
+ lceil: 8968,
1038
+ rceil: 8969,
1039
+ lfloor: 8970,
1040
+ rfloor: 8971,
1041
+ lang: 9001,
1042
+ rang: 9002,
1043
+ loz: 9674,
1044
+ spades: 9824,
1045
+ clubs: 9827,
1046
+ hearts: 9829,
1047
+ diams: 9830
1048
+ };
1049
+ var REFERENCE = /&(?:#[xX]([0-9a-fA-F]{1,6})|#([0-9]{1,7})|([a-zA-Z][a-zA-Z0-9]{1,31}));/g;
1050
+ function decodeEntities(value) {
1051
+ if (!value.includes("&")) return value;
1052
+ return value.replace(REFERENCE, (match, hex, dec, name) => {
1053
+ const code = hex ? parseInt(hex, 16) : dec ? parseInt(dec, 10) : Object.prototype.hasOwnProperty.call(NAMED, name) ? NAMED[name] : void 0;
1054
+ return code !== void 0 && code <= 1114111 ? String.fromCodePoint(code) : match;
1055
+ });
1056
+ }
1057
+
793
1058
  // src/lower/template.ts
794
1059
  var DELEGATED = /* @__PURE__ */ new Set([
795
1060
  "click",
@@ -876,7 +1141,7 @@ var Lowerer = class {
876
1141
  switch (node.kind) {
877
1142
  case "Text": {
878
1143
  if (node.raw) return { kind: "text", value: node.value };
879
- const cleaned = cleanTemplateText(node.value);
1144
+ const cleaned = decodeEntities(cleanTemplateText(node.value));
880
1145
  return cleaned ? { kind: "text", value: cleaned } : null;
881
1146
  }
882
1147
  case "Comment":
@@ -912,7 +1177,7 @@ var Lowerer = class {
912
1177
  kind: "element",
913
1178
  tag: el.tag,
914
1179
  svg: el.namespace === "svg",
915
- props: this.lowerAttributes(el.attributes),
1180
+ props: this.lowerAttributes(el.attributes, true),
916
1181
  children,
917
1182
  static: false,
918
1183
  ...at ? { at } : {}
@@ -1025,13 +1290,22 @@ var Lowerer = class {
1025
1290
  return clone.kind === "Element" ? this.lowerElement(clone) : this.lowerComponent(clone);
1026
1291
  }
1027
1292
  // --- attributes ---------------------------------------------------------
1028
- lowerAttributes(attrs) {
1293
+ /**
1294
+ * `element`: a DOM element, where each class:/style: value that moves is its own accessor.
1295
+ * A component gets the object as before, rebuilt whole when any value moves.
1296
+ */
1297
+ lowerAttributes(attrs, element = false) {
1298
+ let anyReactive = false;
1299
+ const entry = (name, h) => {
1300
+ anyReactive ||= h.reactive;
1301
+ if (!element || !h.reactive) return `${JSON.stringify(name)}: ${h.code}`;
1302
+ const accessor = `() => ${paren(h.code, "arrowBody")}`;
1303
+ return `${JSON.stringify(name)}: ${h.at ? markHole(accessor, h.at.line, h.at.column) : accessor}`;
1304
+ };
1029
1305
  const props = [];
1030
1306
  const classEntries = [];
1031
- let classReactive = false;
1032
1307
  let classAt;
1033
1308
  const styleEntries = [];
1034
- let styleReactive = false;
1035
1309
  let styleAt;
1036
1310
  const usePairs = [];
1037
1311
  for (const a of attrs) {
@@ -1071,15 +1345,13 @@ var Lowerer = class {
1071
1345
  break;
1072
1346
  case "ClassDirective": {
1073
1347
  const h = this.hole(a.hole);
1074
- classEntries.push(`${JSON.stringify(a.name)}: ${h.code}`);
1075
- classReactive = classReactive || h.reactive;
1348
+ classEntries.push(entry(a.name, h));
1076
1349
  classAt ??= h.at;
1077
1350
  break;
1078
1351
  }
1079
1352
  case "StyleDirective": {
1080
1353
  const h = this.hole(a.hole);
1081
- styleEntries.push(`${JSON.stringify(a.name)}: ${h.code}`);
1082
- styleReactive = styleReactive || h.reactive;
1354
+ styleEntries.push(entry(a.name, h));
1083
1355
  styleAt ??= h.at;
1084
1356
  break;
1085
1357
  }
@@ -1099,18 +1371,19 @@ var Lowerer = class {
1099
1371
  name: "classList",
1100
1372
  kind: "attr",
1101
1373
  expr: `{ ${classEntries.join(", ")} }`,
1102
- reactive: classReactive,
1374
+ reactive: !element && anyReactive,
1103
1375
  ...classAt ? { at: classAt } : {}
1104
1376
  });
1105
1377
  }
1106
1378
  if (styleEntries.length > 0) {
1107
- props.push({
1108
- name: "style",
1109
- kind: "attr",
1110
- expr: `{ ${styleEntries.join(", ")} }`,
1111
- reactive: styleReactive,
1112
- ...styleAt ? { at: styleAt } : {}
1113
- });
1379
+ const entries = `{ ${styleEntries.join(", ")} }`;
1380
+ const base = props.findIndex((p) => p.name === "style");
1381
+ if (base === -1) props.push({ name: "style", kind: "attr", expr: entries, reactive: !element && anyReactive, ...styleAt ? { at: styleAt } : {} });
1382
+ else {
1383
+ const prop = props[base];
1384
+ const value = prop.expr === void 0 ? JSON.stringify(prop.literal) : prop.reactive ? `() => ${paren(prop.expr, "arrowBody")}` : prop.expr;
1385
+ props[base] = { name: "style", kind: "attr", expr: `[${value}, ${entries}]`, reactive: false, ...prop.at ? { at: prop.at } : {} };
1386
+ }
1114
1387
  }
1115
1388
  if (usePairs.length > 0) {
1116
1389
  props.push({ name: "use", kind: "attr", expr: `[${usePairs.join(", ")}]` });
@@ -1199,7 +1472,7 @@ var Lowerer = class {
1199
1472
  return base;
1200
1473
  }
1201
1474
  if (v.kind === "static") {
1202
- base.literal = v.value;
1475
+ base.literal = decodeEntities(v.value);
1203
1476
  return base;
1204
1477
  }
1205
1478
  if (v.kind === "hole") {
@@ -1212,7 +1485,7 @@ var Lowerer = class {
1212
1485
  let reactive = false;
1213
1486
  let at;
1214
1487
  const body = v.parts.map((p) => {
1215
- if ("text" in p) return escapeTemplate(p.text);
1488
+ if ("text" in p) return escapeTemplate(decodeEntities(p.text));
1216
1489
  const h = this.hole(p.hole);
1217
1490
  reactive = reactive || h.reactive;
1218
1491
  at ??= h.at;
@@ -1528,9 +1801,12 @@ function attrExprCode(attr, ctx) {
1528
1801
  }
1529
1802
  return null;
1530
1803
  }
1531
- function buildProps(attrs, ctx) {
1804
+ function buildProps(attrs, ctx, element = false) {
1532
1805
  const props = [];
1533
1806
  const usePairs = [];
1807
+ const classEntries = [];
1808
+ const styleEntries = [];
1809
+ let styleAt;
1534
1810
  for (const a of attrs) {
1535
1811
  if (a.type === "JSXSpreadAttribute") {
1536
1812
  props.push({ name: "", kind: "spread", expr: ctx.code(a.argument) });
@@ -1546,6 +1822,27 @@ function buildProps(attrs, ctx) {
1546
1822
  usePairs.push(opts != null ? `[${dir}, () => ${paren(opts, "arrowBody")}]` : `[${dir}]`);
1547
1823
  continue;
1548
1824
  }
1825
+ if (element && (ns === "class" || ns === "style")) {
1826
+ const key = JSON.stringify(a.name.name.name);
1827
+ const v = a.value;
1828
+ let value;
1829
+ if (v == null) value = "true";
1830
+ else if (isString(v)) value = JSON.stringify(literalOf(v));
1831
+ else if (v.type === "JSXExpressionContainer" && v.expression?.type !== "JSXEmptyExpression") {
1832
+ value = keyValue(v.expression, ctx);
1833
+ if (ns === "style") styleAt ??= posOf(v.expression, ctx);
1834
+ } else continue;
1835
+ (ns === "class" ? classEntries : styleEntries).push(`${key}: ${value}`);
1836
+ continue;
1837
+ }
1838
+ if (element && a.name.type === "JSXIdentifier" && a.name.name === "style" && a.value?.type === "JSXExpressionContainer") {
1839
+ const entries = objectEntries(a.value.expression, ctx);
1840
+ if (entries) {
1841
+ styleEntries.unshift(...entries);
1842
+ styleAt = posOf(a.value.expression, ctx);
1843
+ continue;
1844
+ }
1845
+ }
1549
1846
  if (ns === "oncapture") {
1550
1847
  const evt = a.name.name.name.toLowerCase();
1551
1848
  const h = attrExprCode(a, ctx) ?? "undefined";
@@ -1554,9 +1851,37 @@ function buildProps(attrs, ctx) {
1554
1851
  }
1555
1852
  props.push(buildAttr(a, ctx));
1556
1853
  }
1854
+ if (classEntries.length > 0) props.push({ name: "classList", kind: "attr", expr: `{ ${classEntries.join(", ")} }`, reactive: false });
1855
+ if (styleEntries.length > 0) {
1856
+ const entries = `{ ${styleEntries.join(", ")} }`;
1857
+ const base = props.findIndex((p) => p.name === "style" && p.kind === "attr");
1858
+ if (base === -1) props.push({ name: "style", kind: "attr", expr: entries, reactive: false, ...styleAt ? { at: styleAt } : {} });
1859
+ else {
1860
+ const prop = props[base];
1861
+ const value = prop.literal !== void 0 ? JSON.stringify(prop.literal) : prop.reactive ? `() => ${paren(prop.expr, "arrowBody")}` : prop.expr;
1862
+ props[base] = { name: "style", kind: "attr", expr: `[${value}, ${entries}]`, reactive: false, ...prop.at ? { at: prop.at } : {} };
1863
+ }
1864
+ }
1557
1865
  if (usePairs.length > 0) props.push({ name: "use", kind: "attr", expr: `[${usePairs.join(", ")}]` });
1558
1866
  return props;
1559
1867
  }
1868
+ function keyValue(expr, ctx) {
1869
+ const code = ctx.code(expr);
1870
+ if (!isReactive(expr)) return code;
1871
+ const accessor = `() => ${paren(code, "arrowBody")}`;
1872
+ const at = posOf(expr, ctx);
1873
+ return at ? markHole(accessor, at.line, at.column) : accessor;
1874
+ }
1875
+ function objectEntries(expr, ctx) {
1876
+ if (expr?.type !== "ObjectExpression") return null;
1877
+ const entries = [];
1878
+ for (const p of expr.properties) {
1879
+ if (p.type !== "ObjectProperty") return null;
1880
+ const key = p.computed ? `[${ctx.code(p.key)}]` : p.key.type === "Identifier" ? JSON.stringify(p.key.name) : JSON.stringify(String(p.key.value));
1881
+ entries.push(`${key}: ${keyValue(p.value, ctx)}`);
1882
+ }
1883
+ return entries;
1884
+ }
1560
1885
  function buildChildren(children, ctx) {
1561
1886
  const out = [];
1562
1887
  for (let i = 0; i < children.length; i++) {
@@ -1584,6 +1909,7 @@ function buildChildren(children, ctx) {
1584
1909
  });
1585
1910
  }
1586
1911
  } else if (child.type === "JSXElement" || child.type === "JSXFragment") {
1912
+ if (ctx.dropStyles?.has(child.start)) continue;
1587
1913
  out.push(buildNode(child, ctx));
1588
1914
  } else if (child.type === "JSXSpreadChild") {
1589
1915
  out.push({ kind: "expr", code: ctx.code(child.expression), reactive: false });
@@ -1653,13 +1979,17 @@ function buildElement(node, ctx, handled) {
1653
1979
  const children = each ? [each] : buildChildren(node.children, ctx);
1654
1980
  if (tag === CONTAINER2) return children.length === 1 ? children[0] : { kind: "fragment", children };
1655
1981
  const at = ctx.sourceFile && node.loc?.start ? { file: ctx.sourceFile, line: node.loc.start.line, column: node.loc.start.column } : void 0;
1656
- return { kind: "element", tag, svg: SVG_TAGS.has(tag), props: buildProps(attributes, ctx), children, static: false, ...at ? { at } : {} };
1982
+ const props = buildProps(attributes, ctx, true);
1983
+ const scope = ctx.scopes?.find((s) => node.start >= s.start && node.end <= s.end);
1984
+ if (scope) props.unshift({ name: "data-fx-s", kind: "attr", literal: scope.value });
1985
+ return { kind: "element", tag, svg: SVG_TAGS.has(tag), props, children, static: false, ...at ? { at } : {} };
1657
1986
  }
1658
1987
  function buildNode(node, ctx) {
1659
1988
  if (node.type === "JSXFragment") {
1660
1989
  return { kind: "fragment", children: buildChildren(node.children, ctx) };
1661
1990
  }
1662
1991
  if (directive(node, "if")) return buildIf(node, null, ctx);
1992
+ if (ctx.dropStyles?.has(node.start)) return { kind: "fragment", children: [] };
1663
1993
  const { tag, component } = tagInfo(node.openingElement.name, ctx);
1664
1994
  if (!component) return buildElement(node, ctx, []);
1665
1995
  const props = buildProps(node.openingElement.attributes, ctx);