@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
@@ -458,7 +458,7 @@ function emitComponent(name, props, children, used, templates, at) {
458
458
  }
459
459
  let obj = `{ ${bodies.map(([name2, body]) => `get ${propKey(name2)}() { return ${body}; }`).join(", ")} }`;
460
460
  if (bodies.some(([, body]) => /\bthis\b/.test(body))) {
461
- const thunks = bodies.map(([name2, body]) => `${JSON.stringify(name2)}: () => ${body}`);
461
+ const thunks = bodies.map(([name2, body]) => `${JSON.stringify(name2)}: () => (${body})`);
462
462
  const getters = bodies.map(([name2]) => `get ${propKey(name2)}() { return _$t[${JSON.stringify(name2)}](); }`);
463
463
  obj = `((_$t) => ({ ${getters.join(", ")} }))({ ${thunks.join(", ")} })`;
464
464
  }
@@ -653,6 +653,271 @@ function cleanTemplateText(value) {
653
653
  return out;
654
654
  }
655
655
 
656
+ // src/lower/entities.ts
657
+ var NAMED = {
658
+ quot: 34,
659
+ amp: 38,
660
+ apos: 39,
661
+ lt: 60,
662
+ gt: 62,
663
+ nbsp: 160,
664
+ iexcl: 161,
665
+ cent: 162,
666
+ pound: 163,
667
+ curren: 164,
668
+ yen: 165,
669
+ brvbar: 166,
670
+ sect: 167,
671
+ uml: 168,
672
+ copy: 169,
673
+ ordf: 170,
674
+ laquo: 171,
675
+ not: 172,
676
+ shy: 173,
677
+ reg: 174,
678
+ macr: 175,
679
+ deg: 176,
680
+ plusmn: 177,
681
+ sup2: 178,
682
+ sup3: 179,
683
+ acute: 180,
684
+ micro: 181,
685
+ para: 182,
686
+ middot: 183,
687
+ cedil: 184,
688
+ sup1: 185,
689
+ ordm: 186,
690
+ raquo: 187,
691
+ frac14: 188,
692
+ frac12: 189,
693
+ frac34: 190,
694
+ iquest: 191,
695
+ Agrave: 192,
696
+ Aacute: 193,
697
+ Acirc: 194,
698
+ Atilde: 195,
699
+ Auml: 196,
700
+ Aring: 197,
701
+ AElig: 198,
702
+ Ccedil: 199,
703
+ Egrave: 200,
704
+ Eacute: 201,
705
+ Ecirc: 202,
706
+ Euml: 203,
707
+ Igrave: 204,
708
+ Iacute: 205,
709
+ Icirc: 206,
710
+ Iuml: 207,
711
+ ETH: 208,
712
+ Ntilde: 209,
713
+ Ograve: 210,
714
+ Oacute: 211,
715
+ Ocirc: 212,
716
+ Otilde: 213,
717
+ Ouml: 214,
718
+ times: 215,
719
+ Oslash: 216,
720
+ Ugrave: 217,
721
+ Uacute: 218,
722
+ Ucirc: 219,
723
+ Uuml: 220,
724
+ Yacute: 221,
725
+ THORN: 222,
726
+ szlig: 223,
727
+ agrave: 224,
728
+ aacute: 225,
729
+ acirc: 226,
730
+ atilde: 227,
731
+ auml: 228,
732
+ aring: 229,
733
+ aelig: 230,
734
+ ccedil: 231,
735
+ egrave: 232,
736
+ eacute: 233,
737
+ ecirc: 234,
738
+ euml: 235,
739
+ igrave: 236,
740
+ iacute: 237,
741
+ icirc: 238,
742
+ iuml: 239,
743
+ eth: 240,
744
+ ntilde: 241,
745
+ ograve: 242,
746
+ oacute: 243,
747
+ ocirc: 244,
748
+ otilde: 245,
749
+ ouml: 246,
750
+ divide: 247,
751
+ oslash: 248,
752
+ ugrave: 249,
753
+ uacute: 250,
754
+ ucirc: 251,
755
+ uuml: 252,
756
+ yacute: 253,
757
+ thorn: 254,
758
+ yuml: 255,
759
+ OElig: 338,
760
+ oelig: 339,
761
+ Scaron: 352,
762
+ scaron: 353,
763
+ Yuml: 376,
764
+ fnof: 402,
765
+ circ: 710,
766
+ tilde: 732,
767
+ Alpha: 913,
768
+ Beta: 914,
769
+ Gamma: 915,
770
+ Delta: 916,
771
+ Epsilon: 917,
772
+ Zeta: 918,
773
+ Eta: 919,
774
+ Theta: 920,
775
+ Iota: 921,
776
+ Kappa: 922,
777
+ Lambda: 923,
778
+ Mu: 924,
779
+ Nu: 925,
780
+ Xi: 926,
781
+ Omicron: 927,
782
+ Pi: 928,
783
+ Rho: 929,
784
+ Sigma: 931,
785
+ Tau: 932,
786
+ Upsilon: 933,
787
+ Phi: 934,
788
+ Chi: 935,
789
+ Psi: 936,
790
+ Omega: 937,
791
+ alpha: 945,
792
+ beta: 946,
793
+ gamma: 947,
794
+ delta: 948,
795
+ epsilon: 949,
796
+ zeta: 950,
797
+ eta: 951,
798
+ theta: 952,
799
+ iota: 953,
800
+ kappa: 954,
801
+ lambda: 955,
802
+ mu: 956,
803
+ nu: 957,
804
+ xi: 958,
805
+ omicron: 959,
806
+ pi: 960,
807
+ rho: 961,
808
+ sigmaf: 962,
809
+ sigma: 963,
810
+ tau: 964,
811
+ upsilon: 965,
812
+ phi: 966,
813
+ chi: 967,
814
+ psi: 968,
815
+ omega: 969,
816
+ thetasym: 977,
817
+ upsih: 978,
818
+ piv: 982,
819
+ ensp: 8194,
820
+ emsp: 8195,
821
+ thinsp: 8201,
822
+ zwnj: 8204,
823
+ zwj: 8205,
824
+ lrm: 8206,
825
+ rlm: 8207,
826
+ ndash: 8211,
827
+ mdash: 8212,
828
+ lsquo: 8216,
829
+ rsquo: 8217,
830
+ sbquo: 8218,
831
+ ldquo: 8220,
832
+ rdquo: 8221,
833
+ bdquo: 8222,
834
+ dagger: 8224,
835
+ Dagger: 8225,
836
+ bull: 8226,
837
+ hellip: 8230,
838
+ permil: 8240,
839
+ prime: 8242,
840
+ Prime: 8243,
841
+ lsaquo: 8249,
842
+ rsaquo: 8250,
843
+ oline: 8254,
844
+ frasl: 8260,
845
+ euro: 8364,
846
+ image: 8465,
847
+ weierp: 8472,
848
+ real: 8476,
849
+ trade: 8482,
850
+ alefsym: 8501,
851
+ larr: 8592,
852
+ uarr: 8593,
853
+ rarr: 8594,
854
+ darr: 8595,
855
+ harr: 8596,
856
+ crarr: 8629,
857
+ lArr: 8656,
858
+ uArr: 8657,
859
+ rArr: 8658,
860
+ dArr: 8659,
861
+ hArr: 8660,
862
+ forall: 8704,
863
+ part: 8706,
864
+ exist: 8707,
865
+ empty: 8709,
866
+ nabla: 8711,
867
+ isin: 8712,
868
+ notin: 8713,
869
+ ni: 8715,
870
+ prod: 8719,
871
+ sum: 8721,
872
+ minus: 8722,
873
+ lowast: 8727,
874
+ radic: 8730,
875
+ prop: 8733,
876
+ infin: 8734,
877
+ ang: 8736,
878
+ and: 8743,
879
+ or: 8744,
880
+ cap: 8745,
881
+ cup: 8746,
882
+ int: 8747,
883
+ there4: 8756,
884
+ sim: 8764,
885
+ cong: 8773,
886
+ asymp: 8776,
887
+ ne: 8800,
888
+ equiv: 8801,
889
+ le: 8804,
890
+ ge: 8805,
891
+ sub: 8834,
892
+ sup: 8835,
893
+ nsub: 8836,
894
+ sube: 8838,
895
+ supe: 8839,
896
+ oplus: 8853,
897
+ otimes: 8855,
898
+ perp: 8869,
899
+ sdot: 8901,
900
+ lceil: 8968,
901
+ rceil: 8969,
902
+ lfloor: 8970,
903
+ rfloor: 8971,
904
+ lang: 9001,
905
+ rang: 9002,
906
+ loz: 9674,
907
+ spades: 9824,
908
+ clubs: 9827,
909
+ hearts: 9829,
910
+ diams: 9830
911
+ };
912
+ var REFERENCE = /&(?:#[xX]([0-9a-fA-F]{1,6})|#([0-9]{1,7})|([a-zA-Z][a-zA-Z0-9]{1,31}));/g;
913
+ function decodeEntities(value) {
914
+ if (!value.includes("&")) return value;
915
+ return value.replace(REFERENCE, (match, hex, dec, name) => {
916
+ const code = hex ? parseInt(hex, 16) : dec ? parseInt(dec, 10) : Object.prototype.hasOwnProperty.call(NAMED, name) ? NAMED[name] : void 0;
917
+ return code !== void 0 && code <= 1114111 ? String.fromCodePoint(code) : match;
918
+ });
919
+ }
920
+
656
921
  // src/lower/template.ts
657
922
  var DELEGATED = /* @__PURE__ */ new Set([
658
923
  "click",
@@ -739,7 +1004,7 @@ var Lowerer = class {
739
1004
  switch (node.kind) {
740
1005
  case "Text": {
741
1006
  if (node.raw) return { kind: "text", value: node.value };
742
- const cleaned = cleanTemplateText(node.value);
1007
+ const cleaned = decodeEntities(cleanTemplateText(node.value));
743
1008
  return cleaned ? { kind: "text", value: cleaned } : null;
744
1009
  }
745
1010
  case "Comment":
@@ -775,7 +1040,7 @@ var Lowerer = class {
775
1040
  kind: "element",
776
1041
  tag: el.tag,
777
1042
  svg: el.namespace === "svg",
778
- props: this.lowerAttributes(el.attributes),
1043
+ props: this.lowerAttributes(el.attributes, true),
779
1044
  children,
780
1045
  static: false,
781
1046
  ...at ? { at } : {}
@@ -888,13 +1153,22 @@ var Lowerer = class {
888
1153
  return clone.kind === "Element" ? this.lowerElement(clone) : this.lowerComponent(clone);
889
1154
  }
890
1155
  // --- attributes ---------------------------------------------------------
891
- lowerAttributes(attrs) {
1156
+ /**
1157
+ * `element`: a DOM element, where each class:/style: value that moves is its own accessor.
1158
+ * A component gets the object as before, rebuilt whole when any value moves.
1159
+ */
1160
+ lowerAttributes(attrs, element = false) {
1161
+ let anyReactive = false;
1162
+ const entry = (name, h) => {
1163
+ anyReactive ||= h.reactive;
1164
+ if (!element || !h.reactive) return `${JSON.stringify(name)}: ${h.code}`;
1165
+ const accessor = `() => ${paren(h.code, "arrowBody")}`;
1166
+ return `${JSON.stringify(name)}: ${h.at ? markHole(accessor, h.at.line, h.at.column) : accessor}`;
1167
+ };
892
1168
  const props = [];
893
1169
  const classEntries = [];
894
- let classReactive = false;
895
1170
  let classAt;
896
1171
  const styleEntries = [];
897
- let styleReactive = false;
898
1172
  let styleAt;
899
1173
  const usePairs = [];
900
1174
  for (const a of attrs) {
@@ -934,15 +1208,13 @@ var Lowerer = class {
934
1208
  break;
935
1209
  case "ClassDirective": {
936
1210
  const h = this.hole(a.hole);
937
- classEntries.push(`${JSON.stringify(a.name)}: ${h.code}`);
938
- classReactive = classReactive || h.reactive;
1211
+ classEntries.push(entry(a.name, h));
939
1212
  classAt ??= h.at;
940
1213
  break;
941
1214
  }
942
1215
  case "StyleDirective": {
943
1216
  const h = this.hole(a.hole);
944
- styleEntries.push(`${JSON.stringify(a.name)}: ${h.code}`);
945
- styleReactive = styleReactive || h.reactive;
1217
+ styleEntries.push(entry(a.name, h));
946
1218
  styleAt ??= h.at;
947
1219
  break;
948
1220
  }
@@ -962,18 +1234,19 @@ var Lowerer = class {
962
1234
  name: "classList",
963
1235
  kind: "attr",
964
1236
  expr: `{ ${classEntries.join(", ")} }`,
965
- reactive: classReactive,
1237
+ reactive: !element && anyReactive,
966
1238
  ...classAt ? { at: classAt } : {}
967
1239
  });
968
1240
  }
969
1241
  if (styleEntries.length > 0) {
970
- props.push({
971
- name: "style",
972
- kind: "attr",
973
- expr: `{ ${styleEntries.join(", ")} }`,
974
- reactive: styleReactive,
975
- ...styleAt ? { at: styleAt } : {}
976
- });
1242
+ const entries = `{ ${styleEntries.join(", ")} }`;
1243
+ const base = props.findIndex((p) => p.name === "style");
1244
+ if (base === -1) props.push({ name: "style", kind: "attr", expr: entries, reactive: !element && anyReactive, ...styleAt ? { at: styleAt } : {} });
1245
+ else {
1246
+ const prop = props[base];
1247
+ const value = prop.expr === void 0 ? JSON.stringify(prop.literal) : prop.reactive ? `() => ${paren(prop.expr, "arrowBody")}` : prop.expr;
1248
+ props[base] = { name: "style", kind: "attr", expr: `[${value}, ${entries}]`, reactive: false, ...prop.at ? { at: prop.at } : {} };
1249
+ }
977
1250
  }
978
1251
  if (usePairs.length > 0) {
979
1252
  props.push({ name: "use", kind: "attr", expr: `[${usePairs.join(", ")}]` });
@@ -1062,7 +1335,7 @@ var Lowerer = class {
1062
1335
  return base;
1063
1336
  }
1064
1337
  if (v.kind === "static") {
1065
- base.literal = v.value;
1338
+ base.literal = decodeEntities(v.value);
1066
1339
  return base;
1067
1340
  }
1068
1341
  if (v.kind === "hole") {
@@ -1075,7 +1348,7 @@ var Lowerer = class {
1075
1348
  let reactive = false;
1076
1349
  let at;
1077
1350
  const body = v.parts.map((p) => {
1078
- if ("text" in p) return escapeTemplate(p.text);
1351
+ if ("text" in p) return escapeTemplate(decodeEntities(p.text));
1079
1352
  const h = this.hole(p.hole);
1080
1353
  reactive = reactive || h.reactive;
1081
1354
  at ??= h.at;
@@ -1391,9 +1664,12 @@ function attrExprCode(attr, ctx) {
1391
1664
  }
1392
1665
  return null;
1393
1666
  }
1394
- function buildProps(attrs, ctx) {
1667
+ function buildProps(attrs, ctx, element = false) {
1395
1668
  const props = [];
1396
1669
  const usePairs = [];
1670
+ const classEntries = [];
1671
+ const styleEntries = [];
1672
+ let styleAt;
1397
1673
  for (const a of attrs) {
1398
1674
  if (a.type === "JSXSpreadAttribute") {
1399
1675
  props.push({ name: "", kind: "spread", expr: ctx.code(a.argument) });
@@ -1409,6 +1685,27 @@ function buildProps(attrs, ctx) {
1409
1685
  usePairs.push(opts != null ? `[${dir}, () => ${paren(opts, "arrowBody")}]` : `[${dir}]`);
1410
1686
  continue;
1411
1687
  }
1688
+ if (element && (ns === "class" || ns === "style")) {
1689
+ const key = JSON.stringify(a.name.name.name);
1690
+ const v = a.value;
1691
+ let value;
1692
+ if (v == null) value = "true";
1693
+ else if (isString(v)) value = JSON.stringify(literalOf(v));
1694
+ else if (v.type === "JSXExpressionContainer" && v.expression?.type !== "JSXEmptyExpression") {
1695
+ value = keyValue(v.expression, ctx);
1696
+ if (ns === "style") styleAt ??= posOf(v.expression, ctx);
1697
+ } else continue;
1698
+ (ns === "class" ? classEntries : styleEntries).push(`${key}: ${value}`);
1699
+ continue;
1700
+ }
1701
+ if (element && a.name.type === "JSXIdentifier" && a.name.name === "style" && a.value?.type === "JSXExpressionContainer") {
1702
+ const entries = objectEntries(a.value.expression, ctx);
1703
+ if (entries) {
1704
+ styleEntries.unshift(...entries);
1705
+ styleAt = posOf(a.value.expression, ctx);
1706
+ continue;
1707
+ }
1708
+ }
1412
1709
  if (ns === "oncapture") {
1413
1710
  const evt = a.name.name.name.toLowerCase();
1414
1711
  const h = attrExprCode(a, ctx) ?? "undefined";
@@ -1417,9 +1714,37 @@ function buildProps(attrs, ctx) {
1417
1714
  }
1418
1715
  props.push(buildAttr(a, ctx));
1419
1716
  }
1717
+ if (classEntries.length > 0) props.push({ name: "classList", kind: "attr", expr: `{ ${classEntries.join(", ")} }`, reactive: false });
1718
+ if (styleEntries.length > 0) {
1719
+ const entries = `{ ${styleEntries.join(", ")} }`;
1720
+ const base = props.findIndex((p) => p.name === "style" && p.kind === "attr");
1721
+ if (base === -1) props.push({ name: "style", kind: "attr", expr: entries, reactive: false, ...styleAt ? { at: styleAt } : {} });
1722
+ else {
1723
+ const prop = props[base];
1724
+ const value = prop.literal !== void 0 ? JSON.stringify(prop.literal) : prop.reactive ? `() => ${paren(prop.expr, "arrowBody")}` : prop.expr;
1725
+ props[base] = { name: "style", kind: "attr", expr: `[${value}, ${entries}]`, reactive: false, ...prop.at ? { at: prop.at } : {} };
1726
+ }
1727
+ }
1420
1728
  if (usePairs.length > 0) props.push({ name: "use", kind: "attr", expr: `[${usePairs.join(", ")}]` });
1421
1729
  return props;
1422
1730
  }
1731
+ function keyValue(expr, ctx) {
1732
+ const code = ctx.code(expr);
1733
+ if (!isReactive(expr)) return code;
1734
+ const accessor = `() => ${paren(code, "arrowBody")}`;
1735
+ const at = posOf(expr, ctx);
1736
+ return at ? markHole(accessor, at.line, at.column) : accessor;
1737
+ }
1738
+ function objectEntries(expr, ctx) {
1739
+ if (expr?.type !== "ObjectExpression") return null;
1740
+ const entries = [];
1741
+ for (const p of expr.properties) {
1742
+ if (p.type !== "ObjectProperty") return null;
1743
+ const key = p.computed ? `[${ctx.code(p.key)}]` : p.key.type === "Identifier" ? JSON.stringify(p.key.name) : JSON.stringify(String(p.key.value));
1744
+ entries.push(`${key}: ${keyValue(p.value, ctx)}`);
1745
+ }
1746
+ return entries;
1747
+ }
1423
1748
  function buildChildren(children, ctx) {
1424
1749
  const out = [];
1425
1750
  for (let i = 0; i < children.length; i++) {
@@ -1447,6 +1772,7 @@ function buildChildren(children, ctx) {
1447
1772
  });
1448
1773
  }
1449
1774
  } else if (child.type === "JSXElement" || child.type === "JSXFragment") {
1775
+ if (ctx.dropStyles?.has(child.start)) continue;
1450
1776
  out.push(buildNode(child, ctx));
1451
1777
  } else if (child.type === "JSXSpreadChild") {
1452
1778
  out.push({ kind: "expr", code: ctx.code(child.expression), reactive: false });
@@ -1516,13 +1842,17 @@ function buildElement(node, ctx, handled) {
1516
1842
  const children = each ? [each] : buildChildren(node.children, ctx);
1517
1843
  if (tag === CONTAINER2) return children.length === 1 ? children[0] : { kind: "fragment", children };
1518
1844
  const at = ctx.sourceFile && node.loc?.start ? { file: ctx.sourceFile, line: node.loc.start.line, column: node.loc.start.column } : void 0;
1519
- return { kind: "element", tag, svg: SVG_TAGS.has(tag), props: buildProps(attributes, ctx), children, static: false, ...at ? { at } : {} };
1845
+ const props = buildProps(attributes, ctx, true);
1846
+ const scope = ctx.scopes?.find((s) => node.start >= s.start && node.end <= s.end);
1847
+ if (scope) props.unshift({ name: "data-fx-s", kind: "attr", literal: scope.value });
1848
+ return { kind: "element", tag, svg: SVG_TAGS.has(tag), props, children, static: false, ...at ? { at } : {} };
1520
1849
  }
1521
1850
  function buildNode(node, ctx) {
1522
1851
  if (node.type === "JSXFragment") {
1523
1852
  return { kind: "fragment", children: buildChildren(node.children, ctx) };
1524
1853
  }
1525
1854
  if (directive(node, "if")) return buildIf(node, null, ctx);
1855
+ if (ctx.dropStyles?.has(node.start)) return { kind: "fragment", children: [] };
1526
1856
  const { tag, component } = tagInfo(node.openingElement.name, ctx);
1527
1857
  if (!component) return buildElement(node, ctx, []);
1528
1858
  const props = buildProps(node.openingElement.attributes, ctx);