@torpor/view 0.3.3 → 0.3.4

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.
package/dist/compile.js CHANGED
@@ -1728,7 +1728,11 @@ function buildTemplate(template, map, imports, b, options) {
1728
1728
  if (/\$batch\b/.test(script)) imports.add("$batch");
1729
1729
  let currentIndex = 0;
1730
1730
  let current = template.components[0];
1731
+ let status = makeStatus(imports, map, current, options);
1732
+ let first = true;
1731
1733
  for (let chunk of template.script) if (chunk.script === "/* @params */") {
1734
+ if (!first) status = makeStatus(imports, map, current, options);
1735
+ first = false;
1732
1736
  let params = [
1733
1737
  `${current.markup ? "$parent" : "_$parent"}: ParentNode`,
1734
1738
  `${current.markup ? "$anchor" : "_$anchor"}: Node | null`,
@@ -1744,7 +1748,6 @@ function buildTemplate(template, map, imports, b, options) {
1744
1748
  b.append("");
1745
1749
  } else if (chunk.script === "/* @render */") {
1746
1750
  if (current.markup) {
1747
- let status = makeStatus(imports, map, current, options);
1748
1751
  b.append("");
1749
1752
  b.append("/* User interface */");
1750
1753
  buildFragmentText(current.markup, status, b);
@@ -1753,7 +1756,6 @@ function buildTemplate(template, map, imports, b, options) {
1753
1756
  }
1754
1757
  } else if (chunk.script === "/* @head */") {
1755
1758
  if (current.head) {
1756
- let status = makeStatus(imports, map, current, options);
1757
1759
  b.append("");
1758
1760
  b.append("/* Head */");
1759
1761
  status.inHead = true;
@@ -1764,10 +1766,7 @@ function buildTemplate(template, map, imports, b, options) {
1764
1766
  b.append("/**/ });");
1765
1767
  currentIndex += 1;
1766
1768
  current = template.components[currentIndex];
1767
- } else {
1768
- let status = makeStatus(imports, map, current, options);
1769
- addMappedText("", chunk.script, "", chunk.range, status, b);
1770
- }
1769
+ } else addMappedText("", chunk.script, "", chunk.range, status, b);
1771
1770
  }
1772
1771
  function makeStatus(imports, map, current, options) {
1773
1772
  return {