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