@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
@@ -475,7 +475,7 @@ function emitComponent(name, props, children, used, templates, at) {
475
475
  }
476
476
  let obj = `{ ${bodies.map(([name2, body]) => `get ${propKey(name2)}() { return ${body}; }`).join(", ")} }`;
477
477
  if (bodies.some(([, body]) => /\bthis\b/.test(body))) {
478
- const thunks = bodies.map(([name2, body]) => `${JSON.stringify(name2)}: () => ${body}`);
478
+ const thunks = bodies.map(([name2, body]) => `${JSON.stringify(name2)}: () => (${body})`);
479
479
  const getters = bodies.map(([name2]) => `get ${propKey(name2)}() { return _$t[${JSON.stringify(name2)}](); }`);
480
480
  obj = `((_$t) => ({ ${getters.join(", ")} }))({ ${thunks.join(", ")} })`;
481
481
  }
@@ -614,6 +614,271 @@ function cleanTemplateText(value) {
614
614
  return out;
615
615
  }
616
616
 
617
+ // src/lower/entities.ts
618
+ var NAMED = {
619
+ quot: 34,
620
+ amp: 38,
621
+ apos: 39,
622
+ lt: 60,
623
+ gt: 62,
624
+ nbsp: 160,
625
+ iexcl: 161,
626
+ cent: 162,
627
+ pound: 163,
628
+ curren: 164,
629
+ yen: 165,
630
+ brvbar: 166,
631
+ sect: 167,
632
+ uml: 168,
633
+ copy: 169,
634
+ ordf: 170,
635
+ laquo: 171,
636
+ not: 172,
637
+ shy: 173,
638
+ reg: 174,
639
+ macr: 175,
640
+ deg: 176,
641
+ plusmn: 177,
642
+ sup2: 178,
643
+ sup3: 179,
644
+ acute: 180,
645
+ micro: 181,
646
+ para: 182,
647
+ middot: 183,
648
+ cedil: 184,
649
+ sup1: 185,
650
+ ordm: 186,
651
+ raquo: 187,
652
+ frac14: 188,
653
+ frac12: 189,
654
+ frac34: 190,
655
+ iquest: 191,
656
+ Agrave: 192,
657
+ Aacute: 193,
658
+ Acirc: 194,
659
+ Atilde: 195,
660
+ Auml: 196,
661
+ Aring: 197,
662
+ AElig: 198,
663
+ Ccedil: 199,
664
+ Egrave: 200,
665
+ Eacute: 201,
666
+ Ecirc: 202,
667
+ Euml: 203,
668
+ Igrave: 204,
669
+ Iacute: 205,
670
+ Icirc: 206,
671
+ Iuml: 207,
672
+ ETH: 208,
673
+ Ntilde: 209,
674
+ Ograve: 210,
675
+ Oacute: 211,
676
+ Ocirc: 212,
677
+ Otilde: 213,
678
+ Ouml: 214,
679
+ times: 215,
680
+ Oslash: 216,
681
+ Ugrave: 217,
682
+ Uacute: 218,
683
+ Ucirc: 219,
684
+ Uuml: 220,
685
+ Yacute: 221,
686
+ THORN: 222,
687
+ szlig: 223,
688
+ agrave: 224,
689
+ aacute: 225,
690
+ acirc: 226,
691
+ atilde: 227,
692
+ auml: 228,
693
+ aring: 229,
694
+ aelig: 230,
695
+ ccedil: 231,
696
+ egrave: 232,
697
+ eacute: 233,
698
+ ecirc: 234,
699
+ euml: 235,
700
+ igrave: 236,
701
+ iacute: 237,
702
+ icirc: 238,
703
+ iuml: 239,
704
+ eth: 240,
705
+ ntilde: 241,
706
+ ograve: 242,
707
+ oacute: 243,
708
+ ocirc: 244,
709
+ otilde: 245,
710
+ ouml: 246,
711
+ divide: 247,
712
+ oslash: 248,
713
+ ugrave: 249,
714
+ uacute: 250,
715
+ ucirc: 251,
716
+ uuml: 252,
717
+ yacute: 253,
718
+ thorn: 254,
719
+ yuml: 255,
720
+ OElig: 338,
721
+ oelig: 339,
722
+ Scaron: 352,
723
+ scaron: 353,
724
+ Yuml: 376,
725
+ fnof: 402,
726
+ circ: 710,
727
+ tilde: 732,
728
+ Alpha: 913,
729
+ Beta: 914,
730
+ Gamma: 915,
731
+ Delta: 916,
732
+ Epsilon: 917,
733
+ Zeta: 918,
734
+ Eta: 919,
735
+ Theta: 920,
736
+ Iota: 921,
737
+ Kappa: 922,
738
+ Lambda: 923,
739
+ Mu: 924,
740
+ Nu: 925,
741
+ Xi: 926,
742
+ Omicron: 927,
743
+ Pi: 928,
744
+ Rho: 929,
745
+ Sigma: 931,
746
+ Tau: 932,
747
+ Upsilon: 933,
748
+ Phi: 934,
749
+ Chi: 935,
750
+ Psi: 936,
751
+ Omega: 937,
752
+ alpha: 945,
753
+ beta: 946,
754
+ gamma: 947,
755
+ delta: 948,
756
+ epsilon: 949,
757
+ zeta: 950,
758
+ eta: 951,
759
+ theta: 952,
760
+ iota: 953,
761
+ kappa: 954,
762
+ lambda: 955,
763
+ mu: 956,
764
+ nu: 957,
765
+ xi: 958,
766
+ omicron: 959,
767
+ pi: 960,
768
+ rho: 961,
769
+ sigmaf: 962,
770
+ sigma: 963,
771
+ tau: 964,
772
+ upsilon: 965,
773
+ phi: 966,
774
+ chi: 967,
775
+ psi: 968,
776
+ omega: 969,
777
+ thetasym: 977,
778
+ upsih: 978,
779
+ piv: 982,
780
+ ensp: 8194,
781
+ emsp: 8195,
782
+ thinsp: 8201,
783
+ zwnj: 8204,
784
+ zwj: 8205,
785
+ lrm: 8206,
786
+ rlm: 8207,
787
+ ndash: 8211,
788
+ mdash: 8212,
789
+ lsquo: 8216,
790
+ rsquo: 8217,
791
+ sbquo: 8218,
792
+ ldquo: 8220,
793
+ rdquo: 8221,
794
+ bdquo: 8222,
795
+ dagger: 8224,
796
+ Dagger: 8225,
797
+ bull: 8226,
798
+ hellip: 8230,
799
+ permil: 8240,
800
+ prime: 8242,
801
+ Prime: 8243,
802
+ lsaquo: 8249,
803
+ rsaquo: 8250,
804
+ oline: 8254,
805
+ frasl: 8260,
806
+ euro: 8364,
807
+ image: 8465,
808
+ weierp: 8472,
809
+ real: 8476,
810
+ trade: 8482,
811
+ alefsym: 8501,
812
+ larr: 8592,
813
+ uarr: 8593,
814
+ rarr: 8594,
815
+ darr: 8595,
816
+ harr: 8596,
817
+ crarr: 8629,
818
+ lArr: 8656,
819
+ uArr: 8657,
820
+ rArr: 8658,
821
+ dArr: 8659,
822
+ hArr: 8660,
823
+ forall: 8704,
824
+ part: 8706,
825
+ exist: 8707,
826
+ empty: 8709,
827
+ nabla: 8711,
828
+ isin: 8712,
829
+ notin: 8713,
830
+ ni: 8715,
831
+ prod: 8719,
832
+ sum: 8721,
833
+ minus: 8722,
834
+ lowast: 8727,
835
+ radic: 8730,
836
+ prop: 8733,
837
+ infin: 8734,
838
+ ang: 8736,
839
+ and: 8743,
840
+ or: 8744,
841
+ cap: 8745,
842
+ cup: 8746,
843
+ int: 8747,
844
+ there4: 8756,
845
+ sim: 8764,
846
+ cong: 8773,
847
+ asymp: 8776,
848
+ ne: 8800,
849
+ equiv: 8801,
850
+ le: 8804,
851
+ ge: 8805,
852
+ sub: 8834,
853
+ sup: 8835,
854
+ nsub: 8836,
855
+ sube: 8838,
856
+ supe: 8839,
857
+ oplus: 8853,
858
+ otimes: 8855,
859
+ perp: 8869,
860
+ sdot: 8901,
861
+ lceil: 8968,
862
+ rceil: 8969,
863
+ lfloor: 8970,
864
+ rfloor: 8971,
865
+ lang: 9001,
866
+ rang: 9002,
867
+ loz: 9674,
868
+ spades: 9824,
869
+ clubs: 9827,
870
+ hearts: 9829,
871
+ diams: 9830
872
+ };
873
+ var REFERENCE = /&(?:#[xX]([0-9a-fA-F]{1,6})|#([0-9]{1,7})|([a-zA-Z][a-zA-Z0-9]{1,31}));/g;
874
+ function decodeEntities(value) {
875
+ if (!value.includes("&")) return value;
876
+ return value.replace(REFERENCE, (match, hex, dec, name) => {
877
+ const code = hex ? parseInt(hex, 16) : dec ? parseInt(dec, 10) : Object.prototype.hasOwnProperty.call(NAMED, name) ? NAMED[name] : void 0;
878
+ return code !== void 0 && code <= 1114111 ? String.fromCodePoint(code) : match;
879
+ });
880
+ }
881
+
617
882
  // src/lower/template.ts
618
883
  var DELEGATED = /* @__PURE__ */ new Set([
619
884
  "click",
@@ -700,7 +965,7 @@ var Lowerer = class {
700
965
  switch (node.kind) {
701
966
  case "Text": {
702
967
  if (node.raw) return { kind: "text", value: node.value };
703
- const cleaned = cleanTemplateText(node.value);
968
+ const cleaned = decodeEntities(cleanTemplateText(node.value));
704
969
  return cleaned ? { kind: "text", value: cleaned } : null;
705
970
  }
706
971
  case "Comment":
@@ -736,7 +1001,7 @@ var Lowerer = class {
736
1001
  kind: "element",
737
1002
  tag: el.tag,
738
1003
  svg: el.namespace === "svg",
739
- props: this.lowerAttributes(el.attributes),
1004
+ props: this.lowerAttributes(el.attributes, true),
740
1005
  children,
741
1006
  static: false,
742
1007
  ...at ? { at } : {}
@@ -849,13 +1114,22 @@ var Lowerer = class {
849
1114
  return clone.kind === "Element" ? this.lowerElement(clone) : this.lowerComponent(clone);
850
1115
  }
851
1116
  // --- attributes ---------------------------------------------------------
852
- lowerAttributes(attrs) {
1117
+ /**
1118
+ * `element`: a DOM element, where each class:/style: value that moves is its own accessor.
1119
+ * A component gets the object as before, rebuilt whole when any value moves.
1120
+ */
1121
+ lowerAttributes(attrs, element = false) {
1122
+ let anyReactive = false;
1123
+ const entry = (name, h) => {
1124
+ anyReactive ||= h.reactive;
1125
+ if (!element || !h.reactive) return `${JSON.stringify(name)}: ${h.code}`;
1126
+ const accessor = `() => ${paren(h.code, "arrowBody")}`;
1127
+ return `${JSON.stringify(name)}: ${h.at ? markHole(accessor, h.at.line, h.at.column) : accessor}`;
1128
+ };
853
1129
  const props = [];
854
1130
  const classEntries = [];
855
- let classReactive = false;
856
1131
  let classAt;
857
1132
  const styleEntries = [];
858
- let styleReactive = false;
859
1133
  let styleAt;
860
1134
  const usePairs = [];
861
1135
  for (const a of attrs) {
@@ -895,15 +1169,13 @@ var Lowerer = class {
895
1169
  break;
896
1170
  case "ClassDirective": {
897
1171
  const h = this.hole(a.hole);
898
- classEntries.push(`${JSON.stringify(a.name)}: ${h.code}`);
899
- classReactive = classReactive || h.reactive;
1172
+ classEntries.push(entry(a.name, h));
900
1173
  classAt ??= h.at;
901
1174
  break;
902
1175
  }
903
1176
  case "StyleDirective": {
904
1177
  const h = this.hole(a.hole);
905
- styleEntries.push(`${JSON.stringify(a.name)}: ${h.code}`);
906
- styleReactive = styleReactive || h.reactive;
1178
+ styleEntries.push(entry(a.name, h));
907
1179
  styleAt ??= h.at;
908
1180
  break;
909
1181
  }
@@ -923,18 +1195,19 @@ var Lowerer = class {
923
1195
  name: "classList",
924
1196
  kind: "attr",
925
1197
  expr: `{ ${classEntries.join(", ")} }`,
926
- reactive: classReactive,
1198
+ reactive: !element && anyReactive,
927
1199
  ...classAt ? { at: classAt } : {}
928
1200
  });
929
1201
  }
930
1202
  if (styleEntries.length > 0) {
931
- props.push({
932
- name: "style",
933
- kind: "attr",
934
- expr: `{ ${styleEntries.join(", ")} }`,
935
- reactive: styleReactive,
936
- ...styleAt ? { at: styleAt } : {}
937
- });
1203
+ const entries = `{ ${styleEntries.join(", ")} }`;
1204
+ const base = props.findIndex((p) => p.name === "style");
1205
+ if (base === -1) props.push({ name: "style", kind: "attr", expr: entries, reactive: !element && anyReactive, ...styleAt ? { at: styleAt } : {} });
1206
+ else {
1207
+ const prop = props[base];
1208
+ const value = prop.expr === void 0 ? JSON.stringify(prop.literal) : prop.reactive ? `() => ${paren(prop.expr, "arrowBody")}` : prop.expr;
1209
+ props[base] = { name: "style", kind: "attr", expr: `[${value}, ${entries}]`, reactive: false, ...prop.at ? { at: prop.at } : {} };
1210
+ }
938
1211
  }
939
1212
  if (usePairs.length > 0) {
940
1213
  props.push({ name: "use", kind: "attr", expr: `[${usePairs.join(", ")}]` });
@@ -1023,7 +1296,7 @@ var Lowerer = class {
1023
1296
  return base;
1024
1297
  }
1025
1298
  if (v.kind === "static") {
1026
- base.literal = v.value;
1299
+ base.literal = decodeEntities(v.value);
1027
1300
  return base;
1028
1301
  }
1029
1302
  if (v.kind === "hole") {
@@ -1036,7 +1309,7 @@ var Lowerer = class {
1036
1309
  let reactive = false;
1037
1310
  let at;
1038
1311
  const body = v.parts.map((p) => {
1039
- if ("text" in p) return escapeTemplate(p.text);
1312
+ if ("text" in p) return escapeTemplate(decodeEntities(p.text));
1040
1313
  const h = this.hole(p.hole);
1041
1314
  reactive = reactive || h.reactive;
1042
1315
  at ??= h.at;
@@ -1317,9 +1590,12 @@ function attrExprCode(attr, ctx) {
1317
1590
  }
1318
1591
  return null;
1319
1592
  }
1320
- function buildProps(attrs, ctx) {
1593
+ function buildProps(attrs, ctx, element = false) {
1321
1594
  const props = [];
1322
1595
  const usePairs = [];
1596
+ const classEntries = [];
1597
+ const styleEntries = [];
1598
+ let styleAt;
1323
1599
  for (const a of attrs) {
1324
1600
  if (a.type === "JSXSpreadAttribute") {
1325
1601
  props.push({ name: "", kind: "spread", expr: ctx.code(a.argument) });
@@ -1335,6 +1611,27 @@ function buildProps(attrs, ctx) {
1335
1611
  usePairs.push(opts != null ? `[${dir}, () => ${paren(opts, "arrowBody")}]` : `[${dir}]`);
1336
1612
  continue;
1337
1613
  }
1614
+ if (element && (ns === "class" || ns === "style")) {
1615
+ const key = JSON.stringify(a.name.name.name);
1616
+ const v = a.value;
1617
+ let value;
1618
+ if (v == null) value = "true";
1619
+ else if (isString(v)) value = JSON.stringify(literalOf(v));
1620
+ else if (v.type === "JSXExpressionContainer" && v.expression?.type !== "JSXEmptyExpression") {
1621
+ value = keyValue(v.expression, ctx);
1622
+ if (ns === "style") styleAt ??= posOf(v.expression, ctx);
1623
+ } else continue;
1624
+ (ns === "class" ? classEntries : styleEntries).push(`${key}: ${value}`);
1625
+ continue;
1626
+ }
1627
+ if (element && a.name.type === "JSXIdentifier" && a.name.name === "style" && a.value?.type === "JSXExpressionContainer") {
1628
+ const entries = objectEntries(a.value.expression, ctx);
1629
+ if (entries) {
1630
+ styleEntries.unshift(...entries);
1631
+ styleAt = posOf(a.value.expression, ctx);
1632
+ continue;
1633
+ }
1634
+ }
1338
1635
  if (ns === "oncapture") {
1339
1636
  const evt = a.name.name.name.toLowerCase();
1340
1637
  const h = attrExprCode(a, ctx) ?? "undefined";
@@ -1343,9 +1640,37 @@ function buildProps(attrs, ctx) {
1343
1640
  }
1344
1641
  props.push(buildAttr(a, ctx));
1345
1642
  }
1643
+ if (classEntries.length > 0) props.push({ name: "classList", kind: "attr", expr: `{ ${classEntries.join(", ")} }`, reactive: false });
1644
+ if (styleEntries.length > 0) {
1645
+ const entries = `{ ${styleEntries.join(", ")} }`;
1646
+ const base = props.findIndex((p) => p.name === "style" && p.kind === "attr");
1647
+ if (base === -1) props.push({ name: "style", kind: "attr", expr: entries, reactive: false, ...styleAt ? { at: styleAt } : {} });
1648
+ else {
1649
+ const prop = props[base];
1650
+ const value = prop.literal !== void 0 ? JSON.stringify(prop.literal) : prop.reactive ? `() => ${paren(prop.expr, "arrowBody")}` : prop.expr;
1651
+ props[base] = { name: "style", kind: "attr", expr: `[${value}, ${entries}]`, reactive: false, ...prop.at ? { at: prop.at } : {} };
1652
+ }
1653
+ }
1346
1654
  if (usePairs.length > 0) props.push({ name: "use", kind: "attr", expr: `[${usePairs.join(", ")}]` });
1347
1655
  return props;
1348
1656
  }
1657
+ function keyValue(expr, ctx) {
1658
+ const code = ctx.code(expr);
1659
+ if (!isReactive(expr)) return code;
1660
+ const accessor = `() => ${paren(code, "arrowBody")}`;
1661
+ const at = posOf(expr, ctx);
1662
+ return at ? markHole(accessor, at.line, at.column) : accessor;
1663
+ }
1664
+ function objectEntries(expr, ctx) {
1665
+ if (expr?.type !== "ObjectExpression") return null;
1666
+ const entries = [];
1667
+ for (const p of expr.properties) {
1668
+ if (p.type !== "ObjectProperty") return null;
1669
+ const key = p.computed ? `[${ctx.code(p.key)}]` : p.key.type === "Identifier" ? JSON.stringify(p.key.name) : JSON.stringify(String(p.key.value));
1670
+ entries.push(`${key}: ${keyValue(p.value, ctx)}`);
1671
+ }
1672
+ return entries;
1673
+ }
1349
1674
  function buildChildren(children, ctx) {
1350
1675
  const out = [];
1351
1676
  for (let i = 0; i < children.length; i++) {
@@ -1373,6 +1698,7 @@ function buildChildren(children, ctx) {
1373
1698
  });
1374
1699
  }
1375
1700
  } else if (child.type === "JSXElement" || child.type === "JSXFragment") {
1701
+ if (ctx.dropStyles?.has(child.start)) continue;
1376
1702
  out.push(buildNode(child, ctx));
1377
1703
  } else if (child.type === "JSXSpreadChild") {
1378
1704
  out.push({ kind: "expr", code: ctx.code(child.expression), reactive: false });
@@ -1442,13 +1768,17 @@ function buildElement(node, ctx, handled) {
1442
1768
  const children = each ? [each] : buildChildren(node.children, ctx);
1443
1769
  if (tag === CONTAINER2) return children.length === 1 ? children[0] : { kind: "fragment", children };
1444
1770
  const at = ctx.sourceFile && node.loc?.start ? { file: ctx.sourceFile, line: node.loc.start.line, column: node.loc.start.column } : void 0;
1445
- return { kind: "element", tag, svg: SVG_TAGS.has(tag), props: buildProps(attributes, ctx), children, static: false, ...at ? { at } : {} };
1771
+ const props = buildProps(attributes, ctx, true);
1772
+ const scope = ctx.scopes?.find((s) => node.start >= s.start && node.end <= s.end);
1773
+ if (scope) props.unshift({ name: "data-fx-s", kind: "attr", literal: scope.value });
1774
+ return { kind: "element", tag, svg: SVG_TAGS.has(tag), props, children, static: false, ...at ? { at } : {} };
1446
1775
  }
1447
1776
  function buildNode(node, ctx) {
1448
1777
  if (node.type === "JSXFragment") {
1449
1778
  return { kind: "fragment", children: buildChildren(node.children, ctx) };
1450
1779
  }
1451
1780
  if (directive(node, "if")) return buildIf(node, null, ctx);
1781
+ if (ctx.dropStyles?.has(node.start)) return { kind: "fragment", children: [] };
1452
1782
  const { tag, component } = tagInfo(node.openingElement.name, ctx);
1453
1783
  if (!component) return buildElement(node, ctx, []);
1454
1784
  const props = buildProps(node.openingElement.attributes, ctx);