mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
feat: tag params ssr tags-to-class (resume still not working)
This commit is contained in:
parent
db4a3e805b
commit
efef711c93
@ -86,7 +86,11 @@ patchDynamicTag(
|
||||
if (renderer5) {
|
||||
renderer5(input, out);
|
||||
} else {
|
||||
renderBody5(out, ...input.value);
|
||||
if (Array.isArray(input?.value)) {
|
||||
renderBody5(out, ...input.value);
|
||||
} else {
|
||||
renderBody5(out);
|
||||
}
|
||||
}
|
||||
|
||||
const componentsContext = ___getComponentsContext(out);
|
||||
|
||||
@ -6,6 +6,8 @@ import { x as _marko_escapeXml } from "marko/src/runtime/html/helpers/escape-xml
|
||||
import _marko_tags_compat from "marko/src/runtime/helpers/tags-compat-html.js";
|
||||
import _tagsLayout from "./components/tags-layout.marko";
|
||||
import _marko_dynamic_tag from "marko/src/runtime/helpers/dynamic-tag.js";
|
||||
import _initComponents from "marko/src/core-tags/components/init-components-tag.js";
|
||||
import _marko_tag from "marko/src/runtime/helpers/render-tag.js";
|
||||
import _marko_renderer from "marko/src/runtime/components/renderer.js";
|
||||
const _marko_component = {
|
||||
onCreate() {
|
||||
@ -30,6 +32,7 @@ _marko_template._ = _marko_renderer(function (input, out, _componentDef, _compon
|
||||
out.w(_marko_escapeXml(baseCount * state.multiplier));
|
||||
out.w("</button>");
|
||||
}, null, null, _componentDef, "0");
|
||||
_marko_tag(_initComponents, {}, out, _componentDef, "3");
|
||||
}, {
|
||||
t: _marko_componentType,
|
||||
d: true
|
||||
|
||||
@ -4,6 +4,8 @@ const _marko_componentType = "packages/translator-interop/src/__tests__/fixtures
|
||||
export default _marko_template;
|
||||
import { x as _marko_escapeXml } from "marko/src/runtime/html/helpers/escape-xml.js";
|
||||
import _marko_dynamic_tag from "marko/src/runtime/helpers/dynamic-tag.js";
|
||||
import _initComponents from "marko/src/core-tags/components/init-components-tag.js";
|
||||
import _marko_tag from "marko/src/runtime/helpers/render-tag.js";
|
||||
import _marko_renderer from "marko/src/runtime/components/renderer.js";
|
||||
const _marko_component = {
|
||||
onCreate() {
|
||||
@ -22,6 +24,7 @@ _marko_template._ = _marko_renderer(function (input, out, _componentDef, _compon
|
||||
out.w("<div>");
|
||||
_marko_dynamic_tag(out, input.renderBody, null, null, [state.count, "hello"], null, _componentDef, "2");
|
||||
out.w("</div>");
|
||||
_marko_tag(_initComponents, {}, out, _componentDef, "3");
|
||||
}, {
|
||||
t: _marko_componentType,
|
||||
d: true
|
||||
|
||||
@ -5,9 +5,7 @@ const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => {
|
||||
const _scope0_id = _nextScopeId();
|
||||
const multiplier = 1;
|
||||
const _dynamicScope = _dynamicTag(_classLayout, {}, /* @__PURE__ */_createRenderer(({
|
||||
value: [{
|
||||
value: [baseCount, message]
|
||||
}]
|
||||
value: [baseCount, message]
|
||||
}) => {
|
||||
const _scope1_id = _nextScopeId();
|
||||
_write(`<h1>${_escapeXML(message)}${_markResumeNode(_scope1_id, "#text/0")}</h1><button id=tags>${_escapeXML(multiplier)}${_markResumeNode(_scope1_id, "#text/2")} * <!>${_escapeXML(baseCount)}${_markResumeNode(_scope1_id, "#text/3")} = <!>${_escapeXML(multiplier * baseCount)}${_markResumeNode(_scope1_id, "#text/4")}</button>${_markResumeNode(_scope1_id, "#button/1")}`);
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
# Write
|
||||
<!M[1><script>(M$h=[]).push((b,s)=>({1:{}}),[])</script>
|
||||
<!M[1><script>(M$h=[]).push((b,s,h,j,k)=>(k={1:h={baseCount:0,_:j={multiplier:1,"#text/0(":b("@marko/tags-compat-5-to-6")(b("packages/translator-interop/src/__tests__/fixtures/interop-tag-params-tags-to-class/components/class-layout.marko"),!0)}},2:{m5c:"s0"}},j["#text/0!"]=h,k),[])</script>
|
||||
|
||||
|
||||
# Emit error
|
||||
TypeError: Cannot read properties of null (reading 'isSync')
|
||||
# Write
|
||||
<!--M#s0--><button id=class>0</button><div><!--F#2--><h1>hello<!M*1 #text/0></h1><button id=tags>1<!M*1 #text/2> * <!>0<!M*1 #text/3> = <!>0<!M*1 #text/4></button><!M*1 #button/1><script>M$h.push((b,s)=>({1:s[1]}),[1,"packages/translator-interop/src/__tests__/fixtures/interop-tag-params-tags-to-class/template.marko_1_multiplier",1,"packages/translator-interop/src/__tests__/fixtures/interop-tag-params-tags-to-class/template.marko_1_multiplier/subscriber",])</script><!--F/--></div><!--M/--><script>$MC=(window.$MC||[]).concat({"g":{"componentIdToScopeId":{"s0-2":1}},"w":[["s0",0,{},{"f":3}]],"t":["packages/translator-interop/src/__tests__/fixtures/interop-tag-params-tags-to-class/components/class-layout.marko"]})</script><!M]0 #text/0><script>M$h.push((b,s)=>({0:s[1]._}),[])</script>
|
||||
|
||||
|
||||
# Render "End"
|
||||
@ -13,7 +13,47 @@
|
||||
<body>
|
||||
<!--M[1-->
|
||||
<script>
|
||||
(M$h=[]).push((b,s)=>({1:{}}),[])
|
||||
(M$h=[]).push((b,s,h,j,k)=>(k={1:h={baseCount:0,_:j={multiplier:1,"#text/0(":b("@marko/tags-compat-5-to-6")(b("packages/translator-interop/src/__tests__/fixtures/interop-tag-params-tags-to-class/components/class-layout.marko"),!0)}},2:{m5c:"s0"}},j["#text/0!"]=h,k),[])
|
||||
</script>
|
||||
<!--M#s0-->
|
||||
<button
|
||||
id="class"
|
||||
>
|
||||
0
|
||||
</button>
|
||||
<div>
|
||||
<!--F#2-->
|
||||
<h1>
|
||||
hello
|
||||
<!--M*1 #text/0-->
|
||||
</h1>
|
||||
<button
|
||||
id="tags"
|
||||
>
|
||||
1
|
||||
<!--M*1 #text/2-->
|
||||
*
|
||||
<!---->
|
||||
0
|
||||
<!--M*1 #text/3-->
|
||||
=
|
||||
<!---->
|
||||
0
|
||||
<!--M*1 #text/4-->
|
||||
</button>
|
||||
<!--M*1 #button/1-->
|
||||
<script>
|
||||
M$h.push((b,s)=>({1:s[1]}),[1,"packages/translator-interop/src/__tests__/fixtures/interop-tag-params-tags-to-class/template.marko_1_multiplier",1,"packages/translator-interop/src/__tests__/fixtures/interop-tag-params-tags-to-class/template.marko_1_multiplier/subscriber",])
|
||||
</script>
|
||||
<!--F/-->
|
||||
</div>
|
||||
<!--M/-->
|
||||
<script>
|
||||
$MC=(window.$MC||[]).concat({"g":{"componentIdToScopeId":{"s0-2":1}},"w":[["s0",0,{},{"f":3}]],"t":["packages/translator-interop/src/__tests__/fixtures/interop-tag-params-tags-to-class/components/class-layout.marko"]})
|
||||
</script>
|
||||
<!--M]0 #text/0-->
|
||||
<script>
|
||||
M$h.push((b,s)=>({0:s[1]._}),[])
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -27,4 +67,33 @@ inserted #document/html0/body1
|
||||
inserted #document/html0/body1/#comment0
|
||||
inserted #document/html0/body1/script1
|
||||
inserted #document/html0/body1/script1/#text0
|
||||
inserted #document/html0/body1/#comment2
|
||||
inserted #document/html0/body1/button3
|
||||
inserted #document/html0/body1/button3/#text0
|
||||
inserted #document/html0/body1/div4
|
||||
inserted #document/html0/body1/div4/#comment0
|
||||
inserted #document/html0/body1/div4/h11
|
||||
inserted #document/html0/body1/div4/h11/#text0
|
||||
inserted #document/html0/body1/div4/h11/#comment1
|
||||
inserted #document/html0/body1/div4/button2
|
||||
inserted #document/html0/body1/div4/button2/#text0
|
||||
inserted #document/html0/body1/div4/button2/#comment1
|
||||
inserted #document/html0/body1/div4/button2/#text2
|
||||
inserted #document/html0/body1/div4/button2/#comment3
|
||||
inserted #document/html0/body1/div4/button2/#text4
|
||||
inserted #document/html0/body1/div4/button2/#comment5
|
||||
inserted #document/html0/body1/div4/button2/#text6
|
||||
inserted #document/html0/body1/div4/button2/#comment7
|
||||
inserted #document/html0/body1/div4/button2/#text8
|
||||
inserted #document/html0/body1/div4/button2/#comment9
|
||||
inserted #document/html0/body1/div4/#comment3
|
||||
inserted #document/html0/body1/div4/script4
|
||||
inserted #document/html0/body1/div4/script4/#text0
|
||||
inserted #document/html0/body1/div4/#comment5
|
||||
inserted #document/html0/body1/#comment5
|
||||
inserted #document/html0/body1/script6
|
||||
inserted #document/html0/body1/script6/#text0
|
||||
inserted #document/html0/body1/#comment7
|
||||
inserted #document/html0/body1/script8
|
||||
inserted #document/html0/body1/script8/#text0
|
||||
```
|
||||
@ -15,5 +15,4 @@ function clickTags(container: Element) {
|
||||
(container.querySelector("#tags") as HTMLButtonElement).click();
|
||||
}
|
||||
|
||||
export const skip_ssr = true;
|
||||
export const skip_resume = true;
|
||||
|
||||
@ -144,16 +144,7 @@ function translateHTML(tag: t.NodePath<t.MarkoTag>) {
|
||||
callRuntime(
|
||||
"createRenderer",
|
||||
t.arrowFunctionExpression(
|
||||
renderBodyProp.params.length
|
||||
? [
|
||||
t.objectPattern([
|
||||
t.objectProperty(
|
||||
t.identifier("value"),
|
||||
t.arrayPattern(renderBodyProp.params)
|
||||
),
|
||||
]),
|
||||
]
|
||||
: [],
|
||||
renderBodyProp.params,
|
||||
renderBodyProp.body
|
||||
)
|
||||
)
|
||||
|
||||
@ -145,16 +145,7 @@ export default {
|
||||
callRuntime(
|
||||
"createRenderer",
|
||||
t.arrowFunctionExpression(
|
||||
renderBodyProp.params.length
|
||||
? [
|
||||
t.objectPattern([
|
||||
t.objectProperty(
|
||||
t.identifier("value"),
|
||||
t.arrayPattern(renderBodyProp.params)
|
||||
),
|
||||
]),
|
||||
]
|
||||
: [],
|
||||
renderBodyProp.params,
|
||||
toFirstExpressionOrBlock(renderBodyProp.body)
|
||||
)
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user