Skip to content

Commit 6f9ffa5

Browse files
committed
refactor: merge resume single node helpers into single api
1 parent ffb5316 commit 6f9ffa5

File tree

49 files changed

+234
-399
lines changed
  • packages/runtime-tags/src
    • __tests__/fixtures
      • assign-to-owner-closure/__snapshots__/html.expected
      • async-deep-recursive/__snapshots__/html.expected/tags
      • basic-conditional-counter/__snapshots__/html.expected
      • basic-converge-in-if/__snapshots__/html.expected
      • basic-execution-order/__snapshots__/html.expected
      • basic-inert-collapsible-tree/__snapshots__/html.expected/tags
      • basic-nested-for/__snapshots__/html.expected
      • basic-nested-scope-for/__snapshots__/html.expected
      • basic-nested-scope-if/__snapshots__/html.expected
      • basic-push-pop-list/__snapshots__/html.expected
      • basic-shared-node-ref/__snapshots__/html.expected
      • batched-updates-cleanup/__snapshots__/html.expected
      • cleanup-n-child-if-deep/__snapshots__/html.expected
      • cleanup-single-child-for-deep/__snapshots__/html.expected
      • cleanup-single-child-for-shallow/__snapshots__/html.expected
      • cleanup-single-child-if-deep/__snapshots__/html.expected
      • cleanup-single-child-if-same-scope/__snapshots__/html.expected
      • cleanup-single-child-if-shallow/__snapshots__/html.expected
      • conditional-table-row/__snapshots__/html.expected
      • controllable-select-mutated-option/__snapshots__/html.expected
      • create-and-clear-rows-loop-in/__snapshots__/html.expected
      • dollar-global-client/__snapshots__/html.expected
      • for-by/__snapshots__/html.expected
      • for-destructure/__snapshots__/html.expected
      • for-event-handler/__snapshots__/html.expected
      • for-tag-single-node-only-child-in-parent/__snapshots__/html.expected
      • for-tag-with-state/__snapshots__/html.expected
      • hoist-custom-tag-var/__snapshots__/html.expected
      • hoist-custom-tag-var-many/__snapshots__/html.expected
      • hoist-dynamic-tag-var-many/__snapshots__/html.expected
      • hoist-native-tag-var/__snapshots__/html.expected
      • hoist-native-tag-var-many/__snapshots__/html.expected
      • lifecycle-tag-conditional/__snapshots__/html.expected
      • move-and-clear-children/__snapshots__/html.expected
      • move-and-clear-top-level/__snapshots__/html.expected
      • nested-for-if-stateful/__snapshots__/html.expected
      • no-render-content-subtree/__snapshots__/html.expected
      • remove-and-add-rows/__snapshots__/html.expected
      • toggle-first-child/__snapshots__/html.expected
      • toggle-nested/__snapshots__/html.expected
      • toggle-nested-2/__snapshots__/html.expected
      • toggle-nested-3/__snapshots__/html.expected
      • toggle-only-child/__snapshots__/html.expected
      • toggle-only-child-with-marker/__snapshots__/html.expected
      • toggle-stateful-component/__snapshots__/html.expected
    • html
    • translator/core

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+234
-399
lines changed

packages/runtime-tags/src/__tests__/fixtures/assign-to-owner-closure/__snapshots__/html.expected/template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as _$ from "@marko/runtime-tags/debug/html";
22
export default _$.createTemplate("__tests__/template.marko", input => {
33
const $scope0_id = _$.nextScopeId();
44
let hide = undefined;
5-
_$.resumeSingleNodeConditional(() => {
5+
_$.resumeConditional(() => {
66
if (!hide) {
77
const $scope1_id = _$.nextScopeId();
88
_$.write(`<button></button>${_$.markResumeNode($scope1_id, "#button/0")}`);
@@ -12,7 +12,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
1212
}, "__tests__/template.marko", "2:2");
1313
return 0;
1414
}
15-
}, $scope0_id, "#text/0");
15+
}, $scope0_id, "#text/0", 1, /* state: hide */1, 0, 1);
1616
_$.writeScope($scope0_id, {}, "__tests__/template.marko", 0);
1717
_$.resumeClosestBranch($scope0_id);
1818
});

packages/runtime-tags/src/__tests__/fixtures/async-deep-recursive/__snapshots__/html.expected/tags/recurse.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as _$ from "@marko/runtime-tags/debug/html";
22
const $content = (input, $serialize) => {
33
const $scope0_id = _$.nextScopeId();
44
const $input_level_closures = new Set();
5-
_$.resumeSingleNodeConditional(() => {
5+
_$.resumeConditional(() => {
66
if (input.level) {
77
const $scope1_id = _$.nextScopeId();
88
_$.write(`<div${_$.attr("data-level", input.level)}>`);
@@ -38,7 +38,7 @@ const $content = (input, $serialize) => {
3838
}, "__tests__/tags/recurse.marko", "1:1");
3939
return 0;
4040
}
41-
}, $scope0_id, "#text/0", _$.serializeGuard($serialize, /* input.level */0), _$.serializeGuard($serialize, /* input.level */0));
41+
}, $scope0_id, "#text/0", _$.serializeGuard($serialize, /* input.level */0), _$.serializeGuard($serialize, /* input.level */0), 0, 1);
4242
_$.writeScope($scope0_id, {
4343
input_level: input.level,
4444
"ClosureScopes:input_level": _$.serializeIf($serialize, /* input.level */0) && $input_level_closures

packages/runtime-tags/src/__tests__/fixtures/basic-conditional-counter/__snapshots__/html.expected/template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
44
let show = true;
55
let count = 0;
66
_$.write(`<button class=inc></button>${_$.markResumeNode($scope0_id, "#button/0")}<button class=toggle></button>${_$.markResumeNode($scope0_id, "#button/1")}`);
7-
_$.resumeSingleNodeConditional(() => {
7+
_$.resumeConditional(() => {
88
if (show) {
99
const $scope1_id = _$.nextScopeId();
1010
_$.write(`<span>${_$.escapeXML(count)}${_$.markResumeNode($scope1_id, "#text/0")}</span>`);
@@ -13,7 +13,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
1313
}, "__tests__/template.marko", "5:2");
1414
return 0;
1515
}
16-
}, $scope0_id, "#text/2");
16+
}, $scope0_id, "#text/2", 1, /* state: show */1, 0, 1);
1717
_$.writeEffect($scope0_id, "__tests__/template.marko_0_show");
1818
_$.writeEffect($scope0_id, "__tests__/template.marko_0_count");
1919
_$.writeScope($scope0_id, {

packages/runtime-tags/src/__tests__/fixtures/basic-converge-in-if/__snapshots__/html.expected/template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
33
const $scope0_id = _$.nextScopeId();
44
let a = 0;
55
let b = 0;
6-
_$.resumeSingleNodeConditional(() => {
6+
_$.resumeConditional(() => {
77
if (true) {
88
const $scope1_id = _$.nextScopeId();
99
_$.write(`${_$.escapeXML(a + b)}${_$.markResumeNode($scope1_id, "#text/0")}`);
@@ -12,7 +12,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
1212
}, "__tests__/template.marko", "3:2");
1313
return 0;
1414
}
15-
}, $scope0_id, "#text/0", 1, 0);
15+
}, $scope0_id, "#text/0", 1, 0, 0, 1);
1616
_$.writeScope($scope0_id, {
1717
a,
1818
b

packages/runtime-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/html.expected/template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
66
};
77
let show = true;
88
_$.write(`<button>hide</button>${_$.markResumeNode($scope0_id, "#button/0")}`);
9-
_$.resumeSingleNodeConditional(() => {
9+
_$.resumeConditional(() => {
1010
if (show) {
1111
const $scope1_id = _$.nextScopeId();
1212
_$.write(`${_$.escapeXML(message.text)}${_$.markResumeNode($scope1_id, "#text/0")}`);
@@ -15,7 +15,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
1515
}, "__tests__/template.marko", "8:2");
1616
return 0;
1717
}
18-
}, $scope0_id, "#text/1");
18+
}, $scope0_id, "#text/1", 1, /* state: show */1, 0, 1);
1919
_$.writeEffect($scope0_id, "__tests__/template.marko_0");
2020
_$.writeScope($scope0_id, {
2121
message_text: message?.text

packages/runtime-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/html.expected/tags/comments.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import * as _$ from "@marko/runtime-tags/debug/html";
22
const $content = (input, $serialize) => {
33
const $scope0_id = _$.nextScopeId();
44
_$.write("<ul>");
5-
_$.resumeSingleNodeForOf(input.comments, (comment, i) => {
5+
_$.resumeForOf(input.comments, (comment, i) => {
66
const $scope1_id = _$.nextScopeId();
77
const id = `${input.path || "c"}-${i}`;
88
let open = true;
99
_$.write(`<li${_$.attr("id", id)}${_$.attr("hidden", !open)}><span>${_$.escapeXML(comment.text)}${_$.markResumeNode($scope1_id, "#text/1", _$.serializeGuard($serialize, /* input.comments */1))}</span><button>${_$.escapeXML(open ? "[-]" : "[+]")}${_$.markResumeNode($scope1_id, "#text/3")}</button>${_$.markResumeNode($scope1_id, "#button/2")}`);
10-
_$.resumeSingleNodeConditional(() => {
10+
_$.resumeConditional(() => {
1111
if (comment.comments) {
1212
const $scope2_id = _$.nextScopeId();
1313
const $childScope = _$.peekNextScopeId();
@@ -21,7 +21,7 @@ const $content = (input, $serialize) => {
2121
}, "__tests__/tags/comments.marko", "10:8");
2222
return 0;
2323
}
24-
}, $scope1_id, "#text/4", _$.serializeGuard($serialize, /* input.comments,input.path */0), _$.serializeGuard($serialize, /* input.comments */1));
24+
}, $scope1_id, "#text/4", _$.serializeGuard($serialize, /* input.comments,input.path */0), _$.serializeGuard($serialize, /* input.comments */1), 0, 1);
2525
_$.write(`</li>${_$.markResumeNode($scope1_id, "#li/0")}`);
2626
_$.writeEffect($scope1_id, "__tests__/tags/comments.marko_1_open");
2727
_$.writeScope($scope1_id, {
@@ -36,7 +36,7 @@ const $content = (input, $serialize) => {
3636
id: "3:12",
3737
open: "4:10"
3838
});
39-
}, 0, $scope0_id, "#ul/0", _$.serializeGuard($serialize, /* input.comments,input.path */0), _$.serializeGuard($serialize, /* input.comments */1), "</ul>");
39+
}, 0, $scope0_id, "#ul/0", _$.serializeGuard($serialize, /* input.comments,input.path */0), _$.serializeGuard($serialize, /* input.comments */1), "</ul>", 1);
4040
_$.serializeGuard($serialize, /* input.comments */1) && _$.writeScope($scope0_id, {
4141
input_path: input.path
4242
}, "__tests__/tags/comments.marko", 0, {

packages/runtime-tags/src/__tests__/fixtures/basic-nested-for/__snapshots__/html.expected/template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
66
_$.write(`<button>Push</button>${_$.markResumeNode($scope0_id, "#button/0")}`);
77
_$.resumeForOf(items, outer => {
88
const $scope1_id = _$.nextScopeId();
9-
_$.resumeSingleNodeForOf(items, inner => {
9+
_$.resumeForOf(items, inner => {
1010
const $scope2_id = _$.nextScopeId();
1111
const $childScope = _$.peekNextScopeId();
1212
_child({
@@ -16,7 +16,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
1616
_: _$.ensureScopeWithId($scope1_id),
1717
"#childScope/0": _$.writeExistingScope($childScope)
1818
}, "__tests__/template.marko", "5:4");
19-
}, 0, $scope1_id, "#text/0");
19+
}, 0, $scope1_id, "#text/0", /* state: items */1, /* state: items */1, 0, 1);
2020
_$.writeScope($scope1_id, {
2121
outer,
2222
_: _$.ensureScopeWithId($scope0_id)

packages/runtime-tags/src/__tests__/fixtures/basic-nested-scope-for/__snapshots__/html.expected/template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as _$ from "@marko/runtime-tags/debug/html";
22
export default _$.createTemplate("__tests__/template.marko", input => {
33
const $scope0_id = _$.nextScopeId();
44
let selected = 0;
5-
_$.resumeSingleNodeForOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], num => {
5+
_$.resumeForOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], num => {
66
const $scope1_id = _$.nextScopeId();
77
_$.write(`<button${_$.attr("data-selected", selected === num)}${_$.attr("data-multiple", num % selected === 0)}>${_$.escapeXML(num)}</button>${_$.markResumeNode($scope1_id, "#button/0")}`);
88
_$.writeEffect($scope1_id, "__tests__/template.marko_1_num");
@@ -12,6 +12,6 @@ export default _$.createTemplate("__tests__/template.marko", input => {
1212
}, "__tests__/template.marko", "3:2", {
1313
num: "3:6"
1414
});
15-
}, 0, $scope0_id, "#text/0", /* state: selected */1, 0);
15+
}, 0, $scope0_id, "#text/0", /* state: selected */1, 0, 0, 1);
1616
_$.resumeClosestBranch($scope0_id);
1717
});

packages/runtime-tags/src/__tests__/fixtures/basic-nested-scope-if/__snapshots__/html.expected/template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
33
const $scope0_id = _$.nextScopeId();
44
let clickCount = 0;
55
_$.write("<div>");
6-
_$.resumeSingleNodeConditional(() => {
6+
_$.resumeConditional(() => {
77
if (clickCount < 3) {
88
const $scope1_id = _$.nextScopeId();
99
_$.write(`<button>${_$.escapeXML(clickCount)}${_$.markResumeNode($scope1_id, "#text/1")}</button>${_$.markResumeNode($scope1_id, "#button/0")}`);
@@ -20,7 +20,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
2020
}, "__tests__/template.marko", "8:4");
2121
return 1;
2222
}
23-
}, $scope0_id, "#text/0");
23+
}, $scope0_id, "#text/0", 1, /* state: clickCount */1, 0, 1);
2424
_$.write("</div>");
2525
_$.writeScope($scope0_id, {
2626
clickCount

packages/runtime-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/html.expected/template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ export default _$.createTemplate("__tests__/template.marko", input => {
44
let id = 0;
55
let items = [];
66
_$.write("<div>");
7-
_$.resumeSingleNodeForOf(items, item => {
7+
_$.resumeForOf(items, item => {
88
const $scope1_id = _$.nextScopeId();
99
_$.write(`${_$.escapeXML(item)}${_$.markResumeNode($scope1_id, "#text/0")}`);
1010
_$.writeScope($scope1_id, {}, "__tests__/template.marko", "5:4");
11-
}, 0, $scope0_id, "#text/0");
11+
}, 0, $scope0_id, "#text/0", /* state: items */1, /* state: items */1, 0, 1);
1212
_$.write(`<button id=add>Add</button>${_$.markResumeNode($scope0_id, "#button/1")}<button id=remove>Remove</button>${_$.markResumeNode($scope0_id, "#button/2")}</div>`);
1313
_$.writeEffect($scope0_id, "__tests__/template.marko_0_items");
1414
_$.writeEffect($scope0_id, "__tests__/template.marko_0_id_items");

packages/runtime-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/html.expected/template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ export default _$.createTemplate("__tests__/template.marko", input => {
44
let open = true;
55
let list = [1, 2, 3];
66
_$.write(`<ul${_$.attr("hidden", !open)}>`);
7-
_$.resumeSingleNodeForOf(list, x => {
7+
_$.resumeForOf(list, x => {
88
const $scope1_id = _$.nextScopeId();
99
_$.write(`<li>${_$.escapeXML(x)}${_$.markResumeNode($scope1_id, "#text/0")}</li>`);
1010
_$.writeScope($scope1_id, {}, "__tests__/template.marko", "4:4");
1111
}, function (x) {
1212
return x;
13-
}, $scope0_id, "#ul/0", /* state: list */1, /* state: open, list */1, "</ul>");
13+
}, $scope0_id, "#ul/0", /* state: list */1, /* state: open, list */1, "</ul>", 1);
1414
_$.write(`<button id=toggle>Toggle</button>${_$.markResumeNode($scope0_id, "#button/1")}<button id=reverse>Reverse</button>${_$.markResumeNode($scope0_id, "#button/2")}`);
1515
_$.writeEffect($scope0_id, "__tests__/template.marko_0_list");
1616
_$.writeEffect($scope0_id, "__tests__/template.marko_0_open");

packages/runtime-tags/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/html.expected/template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
44
let show = true;
55
let message = "hi";
66
_$.write(`<button></button>${_$.markResumeNode($scope0_id, "#button/0")}`);
7-
_$.resumeSingleNodeConditional(() => {
7+
_$.resumeConditional(() => {
88
if (show) {
99
const $scope1_id = _$.nextScopeId();
1010
_$.write(`<span>${_$.escapeXML(message)}${_$.markResumeNode($scope1_id, "#text/0")}</span>`);
@@ -13,7 +13,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
1313
}, "__tests__/template.marko", "4:2");
1414
return 0;
1515
}
16-
}, $scope0_id, "#text/1");
16+
}, $scope0_id, "#text/1", 1, /* state: show */1, 0, 1);
1717
_$.writeEffect($scope0_id, "__tests__/template.marko_0_show");
1818
_$.writeScope($scope0_id, {
1919
show,

packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-deep/__snapshots__/html.expected/template.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ export default _$.createTemplate("__tests__/template.marko", input => {
1111
el().innerHTML += '\n' + msg;
1212
}, "__tests__/template.marko_0/write", $scope0_id);
1313
_$.write(`<button id=outer>Toggle Outer</button>${_$.markResumeNode($scope0_id, "#button/0")}<button id=middle>Toggle Middle</button>${_$.markResumeNode($scope0_id, "#button/1")}<button id=inner>Toggle Inner</button>${_$.markResumeNode($scope0_id, "#button/2")}<pre></pre>${_$.markResumeNode($scope0_id, "#pre/3")}`);
14-
_$.resumeSingleNodeConditional(() => {
14+
_$.resumeConditional(() => {
1515
if (showOuter) {
1616
const $scope1_id = _$.nextScopeId();
1717
_$.write("<div>");
1818
_child({
1919
write: write,
2020
name: "Outer"
2121
});
22-
_$.resumeSingleNodeConditional(() => {
22+
_$.resumeConditional(() => {
2323
if (showMiddle) {
2424
const $scope2_id = _$.nextScopeId();
2525
_$.write("<div>");
@@ -45,14 +45,14 @@ export default _$.createTemplate("__tests__/template.marko", input => {
4545
}, "__tests__/template.marko", "14:6"));
4646
return 0;
4747
}
48-
}, $scope1_id, "#text/1");
48+
}, $scope1_id, "#text/1", 1, /* state: showMiddle */1, 0, 1);
4949
_$.write("</div>");
5050
_$.writeScope($scope1_id, {
5151
_: _$.ensureScopeWithId($scope0_id)
5252
}, "__tests__/template.marko", "11:2");
5353
return 0;
5454
}
55-
}, $scope0_id, "#text/4");
55+
}, $scope0_id, "#text/4", 1, /* state: showOuter */1, 0, 1);
5656
_$.writeEffect($scope0_id, "__tests__/template.marko_0_showInner");
5757
_$.writeEffect($scope0_id, "__tests__/template.marko_0_showMiddle");
5858
_$.writeEffect($scope0_id, "__tests__/template.marko_0_showOuter");

packages/runtime-tags/src/__tests__/fixtures/cleanup-single-child-for-deep/__snapshots__/html.expected/template.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ export default _$.createTemplate("__tests__/template.marko", input => {
88
el().innerHTML += '\n' + msg;
99
}, "__tests__/template.marko_0/write", $scope0_id);
1010
_$.write(`<button>Toggle</button>${_$.markResumeNode($scope0_id, "#button/0")}<div></div>${_$.markResumeNode($scope0_id, "#div/1")}`);
11-
_$.resumeSingleNodeForOf(items, outerItem => {
11+
_$.resumeForOf(items, outerItem => {
1212
const $scope1_id = _$.nextScopeId();
1313
_$.write("<div>");
1414
const $childScope = _$.peekNextScopeId();
1515
_child({
1616
write: write,
1717
name: `${outerItem}`
1818
}, 1);
19-
_$.resumeSingleNodeForOf(items, middleItem => {
19+
_$.resumeForOf(items, middleItem => {
2020
const $scope2_id = _$.nextScopeId();
2121
_$.write("<div>");
2222
const $childScope2 = _$.peekNextScopeId();
@@ -29,7 +29,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
2929
_: _$.ensureScopeWithId($scope1_id),
3030
"#childScope/0": _$.writeExistingScope($childScope2)
3131
}, "__tests__/template.marko", "10:6");
32-
}, 0, $scope1_id, "#text/1");
32+
}, 0, $scope1_id, "#text/1", /* state: items */1, /* state: items */1, 0, 1);
3333
_$.write("</div>");
3434
_$.writeScope($scope1_id, {
3535
outerItem,
@@ -38,7 +38,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
3838
}, "__tests__/template.marko", "7:2", {
3939
outerItem: "7:6"
4040
});
41-
}, 0, $scope0_id, "#text/2");
41+
}, 0, $scope0_id, "#text/2", /* state: items */1, /* state: items */1, 0, 1);
4242
_$.writeEffect($scope0_id, "__tests__/template.marko_0_items");
4343
_$.writeScope($scope0_id, {
4444
items,

packages/runtime-tags/src/__tests__/fixtures/cleanup-single-child-for-shallow/__snapshots__/html.expected/template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
88
el().innerHTML += '\n' + msg;
99
}, "__tests__/template.marko_0/write", $scope0_id);
1010
_$.write(`<button>Toggle</button>${_$.markResumeNode($scope0_id, "#button/0")}<div></div>${_$.markResumeNode($scope0_id, "#div/1")}`);
11-
_$.resumeSingleNodeForOf(items, item => {
11+
_$.resumeForOf(items, item => {
1212
const $scope1_id = _$.nextScopeId();
1313
const $childScope = _$.peekNextScopeId();
1414
_child({
@@ -18,7 +18,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
1818
_$.writeScope($scope1_id, {
1919
"#childScope/0": _$.writeExistingScope($childScope)
2020
}, "__tests__/template.marko", "7:2");
21-
}, 0, $scope0_id, "#text/2");
21+
}, 0, $scope0_id, "#text/2", /* state: items */1, /* state: items */1, 0, 1);
2222
_$.writeEffect($scope0_id, "__tests__/template.marko_0_items");
2323
_$.writeScope($scope0_id, {
2424
items,

packages/runtime-tags/src/__tests__/fixtures/cleanup-single-child-if-deep/__snapshots__/html.expected/template.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@ export default _$.createTemplate("__tests__/template.marko", input => {
1111
el().innerHTML += '\n' + msg;
1212
}, "__tests__/template.marko_0/write", $scope0_id);
1313
_$.write(`<button id=outer>Toggle Outer</button>${_$.markResumeNode($scope0_id, "#button/0")}<button id=middle>Toggle Middle</button>${_$.markResumeNode($scope0_id, "#button/1")}<button id=inner>Toggle Inner</button>${_$.markResumeNode($scope0_id, "#button/2")}<pre></pre>${_$.markResumeNode($scope0_id, "#pre/3")}`);
14-
_$.resumeSingleNodeConditional(() => {
14+
_$.resumeConditional(() => {
1515
if (showOuter) {
1616
const $scope1_id = _$.nextScopeId();
1717
_$.write("<div>");
1818
_child({
1919
write: write,
2020
name: "Outer"
2121
});
22-
_$.resumeSingleNodeConditional(() => {
22+
_$.resumeConditional(() => {
2323
if (showMiddle) {
2424
const $scope2_id = _$.nextScopeId();
2525
_$.write("<div>");
2626
_child({
2727
write: write,
2828
name: "Middle"
2929
});
30-
_$.resumeSingleNodeConditional(() => {
30+
_$.resumeConditional(() => {
3131
if (showInner) {
3232
const $scope3_id = _$.nextScopeId();
3333
_child({
@@ -37,22 +37,22 @@ export default _$.createTemplate("__tests__/template.marko", input => {
3737
_$.writeScope($scope3_id, {}, "__tests__/template.marko", "17:10");
3838
return 0;
3939
}
40-
}, $scope2_id, "#text/1");
40+
}, $scope2_id, "#text/1", 1, /* state: showInner */1, 0, 1);
4141
_$.write("</div>");
4242
_$.writeSubscribe($showInner_closures, _$.writeScope($scope2_id, {
4343
_: _$.ensureScopeWithId($scope1_id),
4444
"ClosureSignalIndex:showInner": 0
4545
}, "__tests__/template.marko", "14:6"));
4646
return 0;
4747
}
48-
}, $scope1_id, "#text/1");
48+
}, $scope1_id, "#text/1", 1, /* state: showMiddle */1, 0, 1);
4949
_$.write("</div>");
5050
_$.writeScope($scope1_id, {
5151
_: _$.ensureScopeWithId($scope0_id)
5252
}, "__tests__/template.marko", "11:2");
5353
return 0;
5454
}
55-
}, $scope0_id, "#text/4");
55+
}, $scope0_id, "#text/4", 1, /* state: showOuter */1, 0, 1);
5656
_$.writeEffect($scope0_id, "__tests__/template.marko_0_showInner");
5757
_$.writeEffect($scope0_id, "__tests__/template.marko_0_showMiddle");
5858
_$.writeEffect($scope0_id, "__tests__/template.marko_0_showOuter");

packages/runtime-tags/src/__tests__/fixtures/cleanup-single-child-if-same-scope/__snapshots__/html.expected/template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
44
let show = true;
55
const el = _$.nodeRef();
66
_$.write(`<button>Toggle</button>${_$.markResumeNode($scope0_id, "#button/0")}<pre></pre>${_$.markResumeNode($scope0_id, "#pre/1")}`);
7-
_$.resumeSingleNodeConditional(() => {
7+
_$.resumeConditional(() => {
88
if (show) {
99
const $scope1_id = _$.nextScopeId();
1010
_$.write("<div>child</div>");
@@ -14,7 +14,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
1414
}, "__tests__/template.marko", "6:2");
1515
return 0;
1616
}
17-
}, $scope0_id, "#text/2");
17+
}, $scope0_id, "#text/2", 1, /* state: show */1, 0, 1);
1818
_$.writeEffect($scope0_id, "__tests__/template.marko_0_show");
1919
_$.writeScope($scope0_id, {
2020
show

0 commit comments

Comments
 (0)