mirror of
https://github.com/marko-js/marko.git
synced 2026-02-01 16:07:13 +00:00
chore: add tests for rest-spread
This commit is contained in:
parent
c5c8778b38
commit
572a5d9dea
@ -0,0 +1,8 @@
|
||||
{
|
||||
"vars": {
|
||||
"props": {
|
||||
"$_": "o",
|
||||
"$init": "m"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
# Render
|
||||
@ -0,0 +1,5 @@
|
||||
# Render
|
||||
# Mutations
|
||||
```
|
||||
INSERT #text
|
||||
```
|
||||
@ -0,0 +1,8 @@
|
||||
export const $template = "";
|
||||
export const $walks = "";
|
||||
export const $setup = () => {};
|
||||
import * as _ from "@marko/runtime-tags/debug/dom";
|
||||
const $input_option__script = _._script("__tests__/tags/child.marko_0_input_option", $scope => console.log($scope.input_option));
|
||||
export const $input_option = /* @__PURE__ */_._const("input_option", $input_option__script);
|
||||
export const $input = ($scope, input) => $input_option($scope, input.option);
|
||||
export default /* @__PURE__ */_._template("__tests__/tags/child.marko", $template, $walks, $setup, $input);
|
||||
@ -0,0 +1,10 @@
|
||||
export const $template = _child_template;
|
||||
export const $walks = /* <child> */`/${_child_walks}&`;
|
||||
import { $setup as _child, $input_option as _child_input_option, $template as _child_template, $walks as _child_walks } from "./child.marko";
|
||||
export function $setup($scope) {
|
||||
_child($scope["#childScope/0"]);
|
||||
}
|
||||
export const $input_option = ($scope, input_option) => _child_input_option($scope["#childScope/0"], input_option);
|
||||
export const $input = ($scope, input) => $input_option($scope, input.option);
|
||||
import * as _ from "@marko/runtime-tags/debug/dom";
|
||||
export default /* @__PURE__ */_._template("__tests__/tags/wrap.marko", $template, $walks, $setup, $input);
|
||||
@ -0,0 +1,4 @@
|
||||
// size: 72 (min) 63 (brotli)
|
||||
(_._script("a0", ($scope) => console.log($scope.c)),
|
||||
_._content_resume("c0", "1", "b"),
|
||||
init());
|
||||
@ -0,0 +1,12 @@
|
||||
export const $template = _wrap_template;
|
||||
export const $walks = /* <wrap> */`/${_wrap_walks}&`;
|
||||
import { $setup as _wrap, $input_option as _wrap_input_option, $template as _wrap_template, $walks as _wrap_walks } from "./tags/wrap.marko";
|
||||
import * as _ from "@marko/runtime-tags/debug/dom";
|
||||
const $option_content = _._content_resume("__tests__/template.marko_1_content", "1", /* over(1) */"b");
|
||||
export function $setup($scope) {
|
||||
_wrap($scope["#childScope/0"]);
|
||||
_wrap_input_option($scope["#childScope/0"], _.attrTag({
|
||||
content: $option_content($scope)
|
||||
}));
|
||||
}
|
||||
export default /* @__PURE__ */_._template("__tests__/template.marko", $template, $walks, $setup);
|
||||
@ -0,0 +1,10 @@
|
||||
import * as _ from "@marko/runtime-tags/debug/html";
|
||||
export default _._template("__tests__/tags/child.marko", input => {
|
||||
const $scope0_id = _._scope_id();
|
||||
_._script($scope0_id, "__tests__/tags/child.marko_0_input_option");
|
||||
_._scope($scope0_id, {
|
||||
input_option: input.option
|
||||
}, "__tests__/tags/child.marko", 0, {
|
||||
input_option: ["input.option"]
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,11 @@
|
||||
import _child from "./child.marko";
|
||||
import * as _ from "@marko/runtime-tags/debug/html";
|
||||
export default _._template("__tests__/tags/wrap.marko", input => {
|
||||
const $scope0_reason = _._scope_reason();
|
||||
const $scope0_id = _._scope_id();
|
||||
const $childScope = _._peek_scope_id();
|
||||
_child(input);
|
||||
_._serialize_if($scope0_reason, /* input.option */0) && _._scope($scope0_id, {
|
||||
"#childScope/0": _._serialize_if($scope0_reason, /* input.option */0) && _._existing_scope($childScope)
|
||||
}, "__tests__/tags/wrap.marko", 0);
|
||||
});
|
||||
@ -0,0 +1,13 @@
|
||||
import * as _ from "@marko/runtime-tags/debug/html";
|
||||
import _wrap from "./tags/wrap.marko";
|
||||
export default _._template("__tests__/template.marko", input => {
|
||||
const $scope0_id = _._scope_id();
|
||||
_wrap({
|
||||
option: _.attrTag({
|
||||
content: _._content_resume("__tests__/template.marko_1_content", () => {
|
||||
const $scope1_id = _._scope_id();
|
||||
_._html("1");
|
||||
}, $scope0_id)
|
||||
})
|
||||
});
|
||||
});
|
||||
@ -0,0 +1 @@
|
||||
# Render
|
||||
@ -0,0 +1,26 @@
|
||||
# Render
|
||||
```html
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
WALKER_RUNTIME("M")("_");
|
||||
M._.r = [_ => (_.b = [0, 2,
|
||||
{
|
||||
input_option: _.a = {
|
||||
content: _.c = {},
|
||||
*[Symbol.iterator]()
|
||||
{
|
||||
yield this
|
||||
}
|
||||
}
|
||||
}], _.a.content = _._[
|
||||
"__tests__/template.marko_1_content"
|
||||
](_.c), _.b),
|
||||
"__tests__/tags/child.marko_0_input_option 3"
|
||||
];
|
||||
M._.w()
|
||||
</script>
|
||||
</head>
|
||||
<body />
|
||||
</html>
|
||||
```
|
||||
@ -0,0 +1 @@
|
||||
# Render End
|
||||
@ -0,0 +1,40 @@
|
||||
# Write
|
||||
```html
|
||||
<script>WALKER_RUNTIME("M")("_");M._.r=[_=>(_.b=[0,2,{input_option:_.a={content:_.c={},*[Symbol.iterator](){yield this}}}],_.a.content=_._["__tests__/template.marko_1_content"](_.c),_.b),"__tests__/tags/child.marko_0_input_option 3"];M._.w()</script>
|
||||
```
|
||||
|
||||
# Render End
|
||||
```html
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
WALKER_RUNTIME("M")("_");
|
||||
M._.r = [_ => (_.b = [0, 2,
|
||||
{
|
||||
input_option: _.a = {
|
||||
content: _.c = {},
|
||||
*[Symbol.iterator]()
|
||||
{
|
||||
yield this
|
||||
}
|
||||
}
|
||||
}], _.a.content = _._[
|
||||
"__tests__/template.marko_1_content"
|
||||
](_.c), _.b),
|
||||
"__tests__/tags/child.marko_0_input_option 3"
|
||||
];
|
||||
M._.w()
|
||||
</script>
|
||||
</head>
|
||||
<body />
|
||||
</html>
|
||||
```
|
||||
|
||||
# Mutations
|
||||
```
|
||||
INSERT html
|
||||
INSERT html/head
|
||||
INSERT html/head/script
|
||||
INSERT html/head/script/#text
|
||||
INSERT html/body
|
||||
```
|
||||
@ -0,0 +1 @@
|
||||
<script>console.log(input.option)</script>
|
||||
@ -0,0 +1 @@
|
||||
child ...input
|
||||
@ -0,0 +1,2 @@
|
||||
wrap
|
||||
@option -- 1
|
||||
@ -0,0 +1 @@
|
||||
export const steps = [{}];
|
||||
@ -0,0 +1,5 @@
|
||||
{
|
||||
"vars": {
|
||||
"props": {}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
# Render
|
||||
```html
|
||||
<div
|
||||
id="known"
|
||||
>
|
||||
<input
|
||||
class="foo"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
id="dynamic"
|
||||
>
|
||||
<input
|
||||
class="bar"
|
||||
/>
|
||||
</div>
|
||||
```
|
||||
@ -0,0 +1,22 @@
|
||||
# Render
|
||||
```html
|
||||
<div
|
||||
id="known"
|
||||
>
|
||||
<input
|
||||
class="foo"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
id="dynamic"
|
||||
>
|
||||
<input
|
||||
class="bar"
|
||||
/>
|
||||
</div>
|
||||
```
|
||||
|
||||
# Mutations
|
||||
```
|
||||
INSERT div0, div1
|
||||
```
|
||||
@ -0,0 +1,11 @@
|
||||
export const $template = "<input>";
|
||||
export const $walks = /* get, over(1) */" b";
|
||||
export const $setup = () => {};
|
||||
import * as _ from "@marko/runtime-tags/debug/dom";
|
||||
export const $input_class = ($scope, input_class) => _._attr_class($scope["#input/0"], input_class);
|
||||
export const $input_value = ($scope, input_value) => _._attr($scope["#input/0"], "value", input_value);
|
||||
export const $input = ($scope, input) => {
|
||||
$input_class($scope, input.class);
|
||||
$input_value($scope, input.value);
|
||||
};
|
||||
export default /* @__PURE__ */_._template("__tests__/tags/child.marko", $template, $walks, $setup, $input);
|
||||
@ -0,0 +1,14 @@
|
||||
export const $template = _child_template;
|
||||
export const $walks = /* <child> */`/${_child_walks}&`;
|
||||
import { $setup as _child, $input_class as _child_input_class, $input_value as _child_input_value, $template as _child_template, $walks as _child_walks } from "./child.marko";
|
||||
export function $setup($scope) {
|
||||
_child($scope["#childScope/0"]);
|
||||
}
|
||||
export const $input_class = ($scope, input_class) => _child_input_class($scope["#childScope/0"], input_class);
|
||||
export const $input_value = ($scope, input_value) => _child_input_value($scope["#childScope/0"], input_value);
|
||||
export const $input = ($scope, input) => {
|
||||
$input_class($scope, input.class);
|
||||
$input_value($scope, input.value);
|
||||
};
|
||||
import * as _ from "@marko/runtime-tags/debug/dom";
|
||||
export default /* @__PURE__ */_._template("__tests__/tags/wrap.marko", $template, $walks, $setup, $input);
|
||||
@ -0,0 +1 @@
|
||||
// size: 0
|
||||
@ -0,0 +1,16 @@
|
||||
export const $template = `<div id=known>${_wrap_template}</div><div id=dynamic><!></div>`;
|
||||
export const $walks = /* next(1), <wrap>, out(1), next(1), replace, out(1) */`D/${_wrap_walks}&lD%l`;
|
||||
import wrapTag from "./tags/wrap.marko";
|
||||
const Wrap = wrapTag;
|
||||
import { $setup as _wrap, $input_class as _wrap_input_class, $input_value as _wrap_input_value, $template as _wrap_template, $walks as _wrap_walks } from "./tags/wrap.marko";
|
||||
import * as _ from "@marko/runtime-tags/debug/dom";
|
||||
const $dynamicTag = /* @__PURE__ */_._dynamic_tag("#text/1");
|
||||
export function $setup($scope) {
|
||||
_wrap($scope["#childScope/0"]);
|
||||
_wrap_input_class($scope["#childScope/0"], "foo");
|
||||
_wrap_input_value($scope["#childScope/0"]);
|
||||
$dynamicTag($scope, Wrap, () => ({
|
||||
class: "bar"
|
||||
}));
|
||||
}
|
||||
export default /* @__PURE__ */_._template("__tests__/template.marko", $template, $walks, $setup);
|
||||
@ -0,0 +1,7 @@
|
||||
import * as _ from "@marko/runtime-tags/debug/html";
|
||||
export default _._template("__tests__/tags/child.marko", input => {
|
||||
const $scope0_reason = _._scope_reason();
|
||||
const $scope0_id = _._scope_id();
|
||||
_._html(`<input${_._attr_class(input.class)}${_._attr("value", input.value)}>${_._el_resume($scope0_id, "#input/0", _._serialize_guard($scope0_reason, /* input.class, input.value */0))}`);
|
||||
_._serialize_if($scope0_reason, /* input.class, input.value */0) && _._scope($scope0_id, {}, "__tests__/tags/child.marko", 0);
|
||||
});
|
||||
@ -0,0 +1,12 @@
|
||||
import _child from "./child.marko";
|
||||
import * as _ from "@marko/runtime-tags/debug/html";
|
||||
export default _._template("__tests__/tags/wrap.marko", input => {
|
||||
const $scope0_reason = _._scope_reason();
|
||||
const $scope0_id = _._scope_id();
|
||||
const $childScope = _._peek_scope_id();
|
||||
_._set_serialize_reason(_._serialize_guard($scope0_reason, /* input.class, input.value */0));
|
||||
_child(input);
|
||||
_._serialize_if($scope0_reason, /* input.class, input.value */0) && _._scope($scope0_id, {
|
||||
"#childScope/0": _._serialize_if($scope0_reason, /* input.class, input.value */0) && _._existing_scope($childScope)
|
||||
}, "__tests__/tags/wrap.marko", 0);
|
||||
});
|
||||
@ -0,0 +1,16 @@
|
||||
import wrapTag from "./tags/wrap.marko";
|
||||
const Wrap = wrapTag;
|
||||
import * as _ from "@marko/runtime-tags/debug/html";
|
||||
import _wrap from "./tags/wrap.marko";
|
||||
export default _._template("__tests__/template.marko", input => {
|
||||
const $scope0_id = _._scope_id();
|
||||
_._html("<div id=known>");
|
||||
_wrap({
|
||||
class: "foo"
|
||||
});
|
||||
_._html("</div><div id=dynamic>");
|
||||
_._dynamic_tag($scope0_id, "#text/1", Wrap, {
|
||||
class: "bar"
|
||||
}, 0, 0, 0);
|
||||
_._html("</div>");
|
||||
});
|
||||
@ -0,0 +1,17 @@
|
||||
# Render
|
||||
```html
|
||||
<div
|
||||
id="known"
|
||||
>
|
||||
<input
|
||||
class="foo"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
id="dynamic"
|
||||
>
|
||||
<input
|
||||
class="bar"
|
||||
/>
|
||||
</div>
|
||||
```
|
||||
@ -0,0 +1,22 @@
|
||||
# Render
|
||||
```html
|
||||
<html>
|
||||
<head />
|
||||
<body>
|
||||
<div
|
||||
id="known"
|
||||
>
|
||||
<input
|
||||
class="foo"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
id="dynamic"
|
||||
>
|
||||
<input
|
||||
class="bar"
|
||||
/>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
@ -0,0 +1,17 @@
|
||||
# Render End
|
||||
```html
|
||||
<div
|
||||
id="known"
|
||||
>
|
||||
<input
|
||||
class="foo"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
id="dynamic"
|
||||
>
|
||||
<input
|
||||
class="bar"
|
||||
/>
|
||||
</div>
|
||||
```
|
||||
@ -0,0 +1,38 @@
|
||||
# Write
|
||||
```html
|
||||
<div id=known><input class=foo></div><div id=dynamic><input class=bar></div>
|
||||
```
|
||||
|
||||
# Render End
|
||||
```html
|
||||
<html>
|
||||
<head />
|
||||
<body>
|
||||
<div
|
||||
id="known"
|
||||
>
|
||||
<input
|
||||
class="foo"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
id="dynamic"
|
||||
>
|
||||
<input
|
||||
class="bar"
|
||||
/>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
# Mutations
|
||||
```
|
||||
INSERT html
|
||||
INSERT html/head
|
||||
INSERT html/body
|
||||
INSERT html/body/div0
|
||||
INSERT html/body/div0/input
|
||||
INSERT html/body/div1
|
||||
INSERT html/body/div1/input
|
||||
```
|
||||
@ -0,0 +1 @@
|
||||
<input class=input.class value=input.value>
|
||||
@ -0,0 +1 @@
|
||||
<child ...input/>
|
||||
@ -0,0 +1,10 @@
|
||||
import wrapTag from "<wrap>";
|
||||
static const Wrap = wrapTag
|
||||
|
||||
<div#known>
|
||||
<wrap class="foo" />
|
||||
</div>
|
||||
|
||||
<div#dynamic>
|
||||
<${Wrap} class="bar" />
|
||||
</div>
|
||||
@ -0,0 +1 @@
|
||||
export const steps = [{}];
|
||||
@ -0,0 +1,17 @@
|
||||
{
|
||||
"vars": {
|
||||
"props": {
|
||||
"$_": "r",
|
||||
"$init": "m",
|
||||
"$$for_content__item__script": "t",
|
||||
"$$for_content__item": "_",
|
||||
"$$for_content__$params": "o",
|
||||
"$$for": "e",
|
||||
"$$Mathrandomspandiv_content__foo": "n",
|
||||
"$$for_content__dynamicTag": "s",
|
||||
"$$for_content__$temp": "a",
|
||||
"$$Mathrandomspandiv_content__input_foo": "c",
|
||||
"$$_classspandiv_content__input_foo": "i"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
# Render `{"class":"success","data-rest":1}`
|
||||
|
||||
```html
|
||||
<span
|
||||
class="success"
|
||||
data-foo="1"
|
||||
data-one="2"
|
||||
data-rest="1"
|
||||
>
|
||||
<span
|
||||
value="1"
|
||||
>
|
||||
One
|
||||
</span>
|
||||
<span
|
||||
value="1"
|
||||
>
|
||||
Two
|
||||
</span>
|
||||
</span>
|
||||
```
|
||||
@ -0,0 +1,32 @@
|
||||
# Render `{"class":"success","data-rest":1}`
|
||||
|
||||
```html
|
||||
<span
|
||||
class="success"
|
||||
data-foo="1"
|
||||
data-one="2"
|
||||
data-rest="1"
|
||||
>
|
||||
<!---->
|
||||
<!---->
|
||||
<span
|
||||
value="1"
|
||||
>
|
||||
One
|
||||
</span>
|
||||
<span
|
||||
value="1"
|
||||
>
|
||||
Two
|
||||
</span>
|
||||
<!---->
|
||||
<!---->
|
||||
</span>
|
||||
<!---->
|
||||
<!---->
|
||||
```
|
||||
|
||||
# Mutations
|
||||
```
|
||||
INSERT #text, span, #comment0, #comment1
|
||||
```
|
||||
@ -0,0 +1,23 @@
|
||||
export const $template = "<!><!><!>";
|
||||
export const $walks = /* over(1), replace, over(2) */"b%c";
|
||||
export const $setup = () => {};
|
||||
import * as _ from "@marko/runtime-tags/debug/dom";
|
||||
const $for_content__item__script = _._script("__tests__/tags/child.marko_1_item", $scope => _._attrs_script($scope, "#span/0"));
|
||||
const $for_content__item = /* @__PURE__ */_._const("item", $scope => {
|
||||
_._attrs($scope, "#span/0", $scope.item);
|
||||
$for_content__item__script($scope);
|
||||
});
|
||||
const $for_content__dynamicTag = /* @__PURE__ */_._dynamic_tag("#text/1");
|
||||
const $for_content__desc = ($scope, desc) => $for_content__dynamicTag($scope, desc);
|
||||
const $for_content__$params = ($scope, $params2) => $for_content__$temp($scope, $params2?.[0]);
|
||||
const $for_content__$temp = ($scope, $temp) => {
|
||||
(({
|
||||
desc,
|
||||
...item
|
||||
}) => $for_content__item($scope, item))($temp);
|
||||
$for_content__desc($scope, $temp.desc);
|
||||
};
|
||||
const $for = /* @__PURE__ */_._for_of("#text/0", "<span><!></span>", /* get, next(1), replace, out(1) */" D%l", 0, $for_content__$params);
|
||||
export const $foo = ($scope, foo) => $for($scope, [foo]);
|
||||
export const $input = ($scope, input) => $foo($scope, input.foo);
|
||||
export default /* @__PURE__ */_._template("__tests__/tags/child.marko", $template, $walks, $setup, $input);
|
||||
@ -0,0 +1,31 @@
|
||||
export const $template = " <!><!>";
|
||||
export const $walks = /* over(1), replace, over(2) */"b%c";
|
||||
export const $setup = () => {};
|
||||
import { $setup as _child, $foo as _child_input_foo, $template as _child_template, $walks as _child_walks } from "./child.marko";
|
||||
import * as _ from "@marko/runtime-tags/debug/dom";
|
||||
_._resume_dynamic_tag();
|
||||
const $_classspandiv_content__setup = $scope => {
|
||||
_child($scope["#childScope/0"]);
|
||||
$_classspandiv_content__input_foo($scope);
|
||||
};
|
||||
const $_classspandiv_content__input_foo = /* @__PURE__ */_._closure_get("input_foo", $scope => _child_input_foo($scope["#childScope/0"], $scope._.input_foo));
|
||||
const $_classspandiv_content = _._content_resume("__tests__/tags/wrap.marko_1_content", `<!>${_child_template}<!>`, /* over(1), <child>, over(1) */`b/${_child_walks}&b`, $_classspandiv_content__setup);
|
||||
const $dynamicTag = /* @__PURE__ */_._dynamic_tag("#text/0", $_classspandiv_content);
|
||||
const $_class__OR__rest = /* @__PURE__ */_._or(6, $scope => $dynamicTag($scope, $scope._class ? 'span' : 'div', () => ({
|
||||
...$scope.rest,
|
||||
class: $scope._class
|
||||
})));
|
||||
export const $_class = /* @__PURE__ */_._const("_class", $_class__OR__rest);
|
||||
export const $rest = /* @__PURE__ */_._const("rest", $_class__OR__rest);
|
||||
export const $input = ($scope, input) => {
|
||||
(({
|
||||
class: $class,
|
||||
foo,
|
||||
...rest
|
||||
}) => $rest($scope, rest))(input);
|
||||
$input_foo($scope, input.foo);
|
||||
$_class($scope, input.class);
|
||||
};
|
||||
const $input_foo__closure = /* @__PURE__ */_._closure($_classspandiv_content__input_foo);
|
||||
export const $input_foo = /* @__PURE__ */_._const("input_foo", $input_foo__closure);
|
||||
export default /* @__PURE__ */_._template("__tests__/tags/wrap.marko", $template, $walks, $setup, $input);
|
||||
@ -0,0 +1,29 @@
|
||||
// size: 470 (min) 277 (brotli)
|
||||
const $for_content__item__script = _._script("a0", ($scope) =>
|
||||
_._attrs_script($scope, "a"),
|
||||
),
|
||||
$for_content__item = _._const(5, ($scope) => {
|
||||
(_._attrs($scope, "a", $scope.f), $for_content__item__script($scope));
|
||||
}),
|
||||
$for_content__dynamicTag = _._dynamic_tag(1),
|
||||
$for_content__$params = ($scope, $params2) =>
|
||||
$for_content__$temp($scope, $params2?.[0]),
|
||||
$for_content__$temp = ($scope, $temp) => {
|
||||
((({ desc: desc, ...item }) => {
|
||||
$for_content__item($scope, item);
|
||||
})($temp),
|
||||
(($scope, desc) => {
|
||||
$for_content__dynamicTag($scope, desc);
|
||||
})($scope, $temp.desc));
|
||||
},
|
||||
$for = _._for_of(0, "<span><!></span>", " D%l", 0, $for_content__$params);
|
||||
_._resume_dynamic_tag();
|
||||
const $_classspandiv_content__input_foo = _._closure_get(3, ($scope) =>
|
||||
(($scope, foo) => $for($scope, [foo]))($scope.a, $scope._.d),
|
||||
);
|
||||
(_._content_resume("b0", "<!><!><!><!><!>", "b/b%c&b", ($scope) => {
|
||||
($scope.a, $_classspandiv_content__input_foo($scope));
|
||||
}),
|
||||
_._content_resume("c0", "Two", "b"),
|
||||
_._content_resume("c1", "One", "b"),
|
||||
init());
|
||||
@ -0,0 +1,34 @@
|
||||
export const $template = `${_wrap_template}<!>`;
|
||||
export const $walks = /* <wrap>, over(1) */`/${_wrap_walks}&b`;
|
||||
import { $setup as _wrap, $input_foo as _wrap_input_foo, $_class as _wrap_input_class, $rest as _wrap_input_$rest, $template as _wrap_template, $walks as _wrap_walks } from "./tags/wrap.marko";
|
||||
import * as _ from "@marko/runtime-tags/debug/dom";
|
||||
const $desc_content2 = _._content_resume("__tests__/template.marko_2_content", "Two", /* over(1) */"b");
|
||||
const $desc_content = _._content_resume("__tests__/template.marko_1_content", "One", /* over(1) */"b");
|
||||
export function $setup($scope) {
|
||||
_wrap($scope["#childScope/0"]);
|
||||
_wrap_input_foo($scope["#childScope/0"], (_.attrTags(_.attrTag({
|
||||
value: 1,
|
||||
desc: _.attrTag({
|
||||
content: $desc_content($scope)
|
||||
})
|
||||
}), {
|
||||
value: 1,
|
||||
desc: _.attrTag({
|
||||
content: $desc_content2($scope)
|
||||
})
|
||||
})));
|
||||
}
|
||||
export const $input = /* @__PURE__ */_._const("input", $scope => {
|
||||
const $wrap_input_spread = {
|
||||
"data-one": 2,
|
||||
"data-foo": 1,
|
||||
...$scope.input
|
||||
};
|
||||
_wrap_input_class($scope["#childScope/0"], $wrap_input_spread.class);
|
||||
_wrap_input_$rest($scope["#childScope/0"], (({
|
||||
class: $class,
|
||||
foo,
|
||||
...rest
|
||||
}) => rest)($wrap_input_spread));
|
||||
});
|
||||
export default /* @__PURE__ */_._template("__tests__/template.marko", $template, $walks, $setup, $input);
|
||||
@ -0,0 +1,24 @@
|
||||
import * as _ from "@marko/runtime-tags/debug/html";
|
||||
export default _._template("__tests__/tags/child.marko", input => {
|
||||
const $scope0_reason = _._scope_reason();
|
||||
const $scope0_id = _._scope_id();
|
||||
const {
|
||||
foo
|
||||
} = input;
|
||||
_._for_of(foo, ({
|
||||
desc,
|
||||
...item
|
||||
}) => {
|
||||
const $scope1_id = _._scope_id();
|
||||
_._html(`<span${_._attrs(item, "#span/0", $scope1_id, "span")}>`);
|
||||
_._dynamic_tag($scope1_id, "#text/1", desc, {}, 0, 0, _._serialize_guard($scope0_reason, /* input.foo */0));
|
||||
_._html(`</span>${_._el_resume($scope1_id, "#span/0")}`);
|
||||
_._script($scope1_id, "__tests__/tags/child.marko_1_item");
|
||||
_._scope($scope1_id, {
|
||||
item
|
||||
}, "__tests__/tags/child.marko", "2:2", {
|
||||
item: "2:17"
|
||||
});
|
||||
}, 0, $scope0_id, "#text/0", _._serialize_guard($scope0_reason, /* input.foo */0), _._serialize_guard($scope0_reason, /* input.foo */0), _._serialize_guard($scope0_reason, /* input.foo */0), 0, 1);
|
||||
_._serialize_if($scope0_reason, /* input.foo */0) && _._scope($scope0_id, {}, "__tests__/tags/child.marko", 0);
|
||||
});
|
||||
@ -0,0 +1,41 @@
|
||||
import * as _ from "@marko/runtime-tags/debug/html";
|
||||
import _child from "./child.marko";
|
||||
export default _._template("__tests__/tags/wrap.marko", input => {
|
||||
const $scope0_reason = _._scope_reason();
|
||||
const $scope0_id = _._scope_id();
|
||||
const $input_foo__closures = new Set();
|
||||
const {
|
||||
class: _class,
|
||||
foo,
|
||||
...rest
|
||||
} = input;
|
||||
_._html(" ");
|
||||
_._dynamic_tag($scope0_id, "#text/0", _class ? 'span' : 'div', {
|
||||
...rest,
|
||||
class: _class
|
||||
}, _._content_resume("__tests__/tags/wrap.marko_1_content", () => {
|
||||
const $scope1_id = _._scope_id();
|
||||
const $scope1_reason = _._scope_reason();
|
||||
const $childScope = _._peek_scope_id();
|
||||
_._set_serialize_reason(_._serialize_guard($scope0_reason, /* input.foo */1));
|
||||
_child({
|
||||
foo: input.foo
|
||||
});
|
||||
_._subscribe($input_foo__closures, _._scope($scope1_id, {
|
||||
_: _._scope_with_id($scope0_id),
|
||||
"#childScope/0": _._serialize_if($scope0_reason, /* input.foo */1) && _._existing_scope($childScope),
|
||||
"ClosureSignalIndex:input_foo": _._serialize_if($scope0_reason, /* input.foo */1) && 0
|
||||
}, "__tests__/tags/wrap.marko", "2:4"));
|
||||
_._resume_branch($scope1_id);
|
||||
}, $scope0_id), 0, _._serialize_guard($scope0_reason, /* input.class, rest */0));
|
||||
_._scope($scope0_id, {
|
||||
input_foo: input.foo,
|
||||
_class: _._serialize_if($scope0_reason, /* rest */3) && _class,
|
||||
rest: _._serialize_if($scope0_reason, /* input.class */2) && rest,
|
||||
"ClosureScopes:input_foo": _._serialize_if($scope0_reason, /* input.foo */1) && $input_foo__closures
|
||||
}, "__tests__/tags/wrap.marko", 0, {
|
||||
input_foo: ["input.foo"],
|
||||
_class: "1:17",
|
||||
rest: "1:33"
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,36 @@
|
||||
import * as _ from "@marko/runtime-tags/debug/html";
|
||||
import _wrap from "./tags/wrap.marko";
|
||||
export default _._template("__tests__/template.marko", input => {
|
||||
const $scope0_reason = _._scope_reason();
|
||||
const $scope0_id = _._scope_id();
|
||||
const $childScope = _._peek_scope_id();
|
||||
_._set_serialize_reason({
|
||||
/* input.class, rest */0: _._serialize_guard($scope0_reason, /* input */0),
|
||||
/* input.class */2: _._serialize_guard($scope0_reason, /* input */0)
|
||||
});
|
||||
_wrap({
|
||||
"data-one": 2,
|
||||
"data-foo": 1,
|
||||
...input,
|
||||
foo: _.attrTags(_.attrTag({
|
||||
value: 1,
|
||||
desc: _.attrTag({
|
||||
content: _._content_resume("__tests__/template.marko_1_content", () => {
|
||||
const $scope1_id = _._scope_id();
|
||||
_._html("One");
|
||||
}, $scope0_id)
|
||||
})
|
||||
}), {
|
||||
value: 1,
|
||||
desc: _.attrTag({
|
||||
content: _._content_resume("__tests__/template.marko_2_content", () => {
|
||||
const $scope2_id = _._scope_id();
|
||||
_._html("Two");
|
||||
}, $scope0_id)
|
||||
})
|
||||
})
|
||||
});
|
||||
_._serialize_if($scope0_reason, /* input */0) && _._scope($scope0_id, {
|
||||
"#childScope/0": _._serialize_if($scope0_reason, /* input */0) && _._existing_scope($childScope)
|
||||
}, "__tests__/template.marko", 0);
|
||||
});
|
||||
@ -0,0 +1,21 @@
|
||||
# Render `{"class":"success","data-rest":1}`
|
||||
|
||||
```html
|
||||
<span
|
||||
class="success"
|
||||
data-foo="1"
|
||||
data-one="2"
|
||||
data-rest="1"
|
||||
>
|
||||
<span
|
||||
value="1"
|
||||
>
|
||||
One
|
||||
</span>
|
||||
<span
|
||||
value="1"
|
||||
>
|
||||
Two
|
||||
</span>
|
||||
</span>
|
||||
```
|
||||
@ -0,0 +1,79 @@
|
||||
# Render `{"class":"success","data-rest":1}`
|
||||
|
||||
```html
|
||||
<html>
|
||||
<head />
|
||||
<body>
|
||||
<span
|
||||
class="success"
|
||||
data-foo="1"
|
||||
data-one="2"
|
||||
data-rest="1"
|
||||
>
|
||||
<span
|
||||
value="1"
|
||||
>
|
||||
One
|
||||
</span>
|
||||
<!--M_*6 #span/0-->
|
||||
<span
|
||||
value="1"
|
||||
>
|
||||
Two
|
||||
</span>
|
||||
<!--M_*8 #span/0-->
|
||||
</span>
|
||||
<script>
|
||||
WALKER_RUNTIME("M")("_");
|
||||
M._.r = [_ => (_.i = [0, 1, _.e = {
|
||||
input_foo: _.c = {
|
||||
value: 1,
|
||||
desc: _.a = {
|
||||
content: _.j = {},
|
||||
*[Symbol.iterator]()
|
||||
{
|
||||
yield this
|
||||
}
|
||||
},
|
||||
*[(_.b = [, _.h = {
|
||||
value: 1,
|
||||
desc: _.d = {
|
||||
*[Symbol.iterator]()
|
||||
{
|
||||
yield this
|
||||
}
|
||||
}
|
||||
}], Symbol.iterator)]()
|
||||
{
|
||||
yield* _.b
|
||||
}
|
||||
}
|
||||
}, 1, _.l = {
|
||||
_: _.e
|
||||
}, 1,
|
||||
{
|
||||
item: _.g = {
|
||||
value: 1,
|
||||
*[(_.f = [, _.h], Symbol.iterator)]()
|
||||
{
|
||||
yield* _.f
|
||||
}
|
||||
}
|
||||
}, 1,
|
||||
{
|
||||
item:
|
||||
{
|
||||
value: 1
|
||||
}
|
||||
}], _.b[0] = _.c, _.f[0] = _.g, _.a.content = _._[
|
||||
"__tests__/template.marko_1_content"
|
||||
](_.j), _.d.content = _._[
|
||||
"__tests__/template.marko_2_content"
|
||||
](_.j), (_.k = new Set).add(_.l), _.i),
|
||||
"__tests__/tags/child.marko_1_item 6 8"
|
||||
];
|
||||
M._.w()
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
@ -0,0 +1,20 @@
|
||||
# Render End
|
||||
```html
|
||||
<span
|
||||
class="success"
|
||||
data-foo="1"
|
||||
data-one="2"
|
||||
data-rest="1"
|
||||
>
|
||||
<span
|
||||
value="1"
|
||||
>
|
||||
One
|
||||
</span>
|
||||
<span
|
||||
value="1"
|
||||
>
|
||||
Two
|
||||
</span>
|
||||
</span>
|
||||
```
|
||||
@ -0,0 +1,99 @@
|
||||
# Write
|
||||
```html
|
||||
<span data-one=2 data-foo=1 data-rest=1 class=success><span value=1>One</span><!--M_*6 #span/0--><span value=1>Two</span><!--M_*8 #span/0--></span><script>WALKER_RUNTIME("M")("_");M._.r=[_=>(_.i=[0,1,_.e={input_foo:_.c={value:1,desc:_.a={content:_.j={},*[Symbol.iterator](){yield this}},*[(_.b=[,_.h={value:1,desc:_.d={*[Symbol.iterator](){yield this}}}],Symbol.iterator)](){yield*_.b}}},1,_.l={_:_.e},1,{item:_.g={value:1,*[(_.f=[,_.h],Symbol.iterator)](){yield*_.f}}},1,{item:{value:1}}],_.b[0]=_.c,_.f[0]=_.g,_.a.content=_._["__tests__/template.marko_1_content"](_.j),_.d.content=_._["__tests__/template.marko_2_content"](_.j),(_.k=new Set).add(_.l),_.i),"__tests__/tags/child.marko_1_item 6 8"];M._.w()</script>
|
||||
```
|
||||
|
||||
# Render End
|
||||
```html
|
||||
<html>
|
||||
<head />
|
||||
<body>
|
||||
<span
|
||||
class="success"
|
||||
data-foo="1"
|
||||
data-one="2"
|
||||
data-rest="1"
|
||||
>
|
||||
<span
|
||||
value="1"
|
||||
>
|
||||
One
|
||||
</span>
|
||||
<!--M_*6 #span/0-->
|
||||
<span
|
||||
value="1"
|
||||
>
|
||||
Two
|
||||
</span>
|
||||
<!--M_*8 #span/0-->
|
||||
</span>
|
||||
<script>
|
||||
WALKER_RUNTIME("M")("_");
|
||||
M._.r = [_ => (_.i = [0, 1, _.e = {
|
||||
input_foo: _.c = {
|
||||
value: 1,
|
||||
desc: _.a = {
|
||||
content: _.j = {},
|
||||
*[Symbol.iterator]()
|
||||
{
|
||||
yield this
|
||||
}
|
||||
},
|
||||
*[(_.b = [, _.h = {
|
||||
value: 1,
|
||||
desc: _.d = {
|
||||
*[Symbol.iterator]()
|
||||
{
|
||||
yield this
|
||||
}
|
||||
}
|
||||
}], Symbol.iterator)]()
|
||||
{
|
||||
yield* _.b
|
||||
}
|
||||
}
|
||||
}, 1, _.l = {
|
||||
_: _.e
|
||||
}, 1,
|
||||
{
|
||||
item: _.g = {
|
||||
value: 1,
|
||||
*[(_.f = [, _.h], Symbol.iterator)]()
|
||||
{
|
||||
yield* _.f
|
||||
}
|
||||
}
|
||||
}, 1,
|
||||
{
|
||||
item:
|
||||
{
|
||||
value: 1
|
||||
}
|
||||
}], _.b[0] = _.c, _.f[0] = _.g, _.a.content = _._[
|
||||
"__tests__/template.marko_1_content"
|
||||
](_.j), _.d.content = _._[
|
||||
"__tests__/template.marko_2_content"
|
||||
](_.j), (_.k = new Set).add(_.l), _.i),
|
||||
"__tests__/tags/child.marko_1_item 6 8"
|
||||
];
|
||||
M._.w()
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
# Mutations
|
||||
```
|
||||
INSERT html
|
||||
INSERT html/head
|
||||
INSERT html/body
|
||||
INSERT html/body/span
|
||||
INSERT html/body/span/span0
|
||||
INSERT html/body/span/span0/#text
|
||||
INSERT html/body/span/#comment0
|
||||
INSERT html/body/span/span1
|
||||
INSERT html/body/span/span1/#text
|
||||
INSERT html/body/span/#comment1
|
||||
INSERT html/body/script
|
||||
INSERT html/body/script/#text
|
||||
```
|
||||
@ -0,0 +1,4 @@
|
||||
<const/{ foo }=input>
|
||||
<for|{ desc, ...item }| of=foo>
|
||||
<span ...item><${desc}/></span>
|
||||
</for>
|
||||
@ -0,0 +1,4 @@
|
||||
<const/{ class: _class, foo, ...rest }=input>
|
||||
<${_class ? 'span' : 'div'} ...rest class=_class>
|
||||
<child foo=input.foo />
|
||||
</>
|
||||
@ -0,0 +1,4 @@
|
||||
<wrap data-one=2 data-foo=1 ...input>
|
||||
<@foo value=1><@desc>One</></>
|
||||
<@foo value=1><@desc>Two</></>
|
||||
</wrap>
|
||||
@ -0,0 +1 @@
|
||||
export const steps = [{ class: "success", ["data-rest"]: 1 }];
|
||||
Loading…
x
Reference in New Issue
Block a user