Skip to content

Commit b37a077

Browse files
Rename test component
1 parent a3e475f commit b37a077

14 files changed

+88
-79
lines changed

docs/test.html

+27-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<div class="container-lg">
4747
<div class="row">
4848
<div class="col-lg-8">
49-
<h1 class="display-1 fw-bold mb-4">Demo</h1>
49+
<h1 class="display-1 fw-bold mb-4">Playground</h1>
5050
<div class="wrapper">
5151
<div class="demo my-demo" something="alocal">
5252
<h1>anObjectDefault</h1>
@@ -191,6 +191,32 @@ <h4>Child</h4>
191191
<h5>YIELD CHILD INSIDE TEST.html</h5>
192192
SLOT CHILD INSIDE TEST.html
193193
</div>
194+
<div class="wrapper">
195+
<div class="parent">
196+
{"name":{"filled":true,"rendered":false,"tag":"fill:name","attrs":{},"content":["Slot parent"],"source":"Slot parent","locals":{}}}
197+
<div class="parent-content">I'm parent</div>
198+
<div class="parent-yield">
199+
<h1>Parent yield</h1>
200+
<div class="child">
201+
{"name":{"filled":true,"rendered":false,"tag":"fill:name","attrs":{},"content":["Slot child"],"source":"Slot child","locals":{}}}
202+
<div class="child-content">I'm child</div>
203+
<div class="child-yield">
204+
<h1>Child yield</h1>
205+
</div>
206+
<div class="child-slot">Slot child</div>
207+
</div>
208+
</div>
209+
<div class="parent-slot">Slot parent</div>
210+
</div>
211+
{"name":{"filled":true,"rendered":false,"tag":"fill:name","attrs":{},"content":["\n ",{"tag":"div","attrs":{"class":"parent2-child2-slot"},"content":["\n parent2-child2 slot\n "]},"\n "],"source":"\n
212+
<div class="\&quot;parent2-child2-slot\&quot;">\n parent2-child2 slot\n</div>
213+
\n ","locals":{}},"myslot":{"filled":true,"rendered":true,"tag":"fill:myslot","attrs":{},"content":["\n SLOT CHILD INSIDE TEST.html\n "],"source":"\n SLOT CHILD INSIDE TEST.html\n ","locals":{}}}
214+
215+
216+
yes is filled
217+
<div class="parent2-child2-slot">parent2-child2 slot</div>
218+
<div class="parent2-child2-yield">parent2-child2 yield</div>
219+
</div>
194220
</div>
195221
</div>
196222
</div>

docs/test2.html

-26
This file was deleted.

examples/dist/test.html

+27-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<div class="container-lg">
4747
<div class="row">
4848
<div class="col-lg-8">
49-
<h1 class="display-1 fw-bold mb-4">Demo</h1>
49+
<h1 class="display-1 fw-bold mb-4">Playground</h1>
5050
<div class="wrapper">
5151
<div class="demo my-demo" something="alocal">
5252
<h1>anObjectDefault</h1>
@@ -191,6 +191,32 @@ <h4>Child</h4>
191191
<h5>YIELD CHILD INSIDE TEST.html</h5>
192192
SLOT CHILD INSIDE TEST.html
193193
</div>
194+
<div class="wrapper">
195+
<div class="parent">
196+
{"name":{"filled":true,"rendered":false,"tag":"fill:name","attrs":{},"content":["Slot parent"],"source":"Slot parent","locals":{}}}
197+
<div class="parent-content">I'm parent</div>
198+
<div class="parent-yield">
199+
<h1>Parent yield</h1>
200+
<div class="child">
201+
{"name":{"filled":true,"rendered":false,"tag":"fill:name","attrs":{},"content":["Slot child"],"source":"Slot child","locals":{}}}
202+
<div class="child-content">I'm child</div>
203+
<div class="child-yield">
204+
<h1>Child yield</h1>
205+
</div>
206+
<div class="child-slot">Slot child</div>
207+
</div>
208+
</div>
209+
<div class="parent-slot">Slot parent</div>
210+
</div>
211+
{"name":{"filled":true,"rendered":false,"tag":"fill:name","attrs":{},"content":["\n ",{"tag":"div","attrs":{"class":"parent2-child2-slot"},"content":["\n parent2-child2 slot\n "]},"\n "],"source":"\n
212+
<div class="\&quot;parent2-child2-slot\&quot;">\n parent2-child2 slot\n</div>
213+
\n ","locals":{}},"myslot":{"filled":true,"rendered":true,"tag":"fill:myslot","attrs":{},"content":["\n SLOT CHILD INSIDE TEST.html\n "],"source":"\n SLOT CHILD INSIDE TEST.html\n ","locals":{}}}
214+
215+
216+
yes is filled
217+
<div class="parent2-child2-slot">parent2-child2 slot</div>
218+
<div class="parent2-child2-yield">parent2-child2 yield</div>
219+
</div>
194220
</div>
195221
</div>
196222
</div>

examples/dist/test2.html

-26
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
<x-parent>
1+
<x-test.parent>
22
<h5>YIELD PARENT IN CHILD-PARENT.html</h5>
33
{{ alocal }}
44
<fill:myslot>
55
SLOT PARENT INSIDE CHILD-PARENT.html
66
</fill:myslot>
7-
</x-parent>
7+
</x-test.parent>
88

9-
<x-child>
9+
<x-test.child>
1010
<h5>YIELD CHILD INSIDE CHILD-PARENT.html</h5>
1111
<fill:myslot>
1212
SLOT CHILD INSIDE CHILD-PARENT.html
1313
</fill:myslot>
14-
</x-child>
14+
</x-test.child>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

examples/src/components/parent2-child2.html examples/src/components/test/parent2-child2.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<div class="wrapper">
2-
<x-parent2>
2+
<x-test.parent2>
33
<h1>Parent yield</h1>
44

5-
<x-child2>
5+
<x-test.child2>
66

77
<h1>Child yield</h1>
88

99
<fill:name>Slot child</fill:name>
1010

11-
</x-child2>
11+
</x-test.child2>
1212

1313
<fill:name>Slot parent</fill:name>
1414

15-
</x-parent2>
15+
</x-test.parent2>
1616

1717
{{ $slots }}
1818

File renamed without changes.

examples/src/pages/test.html

+18-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<x-page>
22
<div class="row">
33
<div class="col-lg-8">
4-
<h1 class="display-1 fw-bold mb-4">Demo</h1>
4+
<h1 class="display-1 fw-bold mb-4">Playground</h1>
55

66
<x-test
77
aStringOverride="My override string changed"
@@ -25,22 +25,34 @@ <h1 class="display-1 fw-bold mb-4">Demo</h1>
2525

2626
<hr>
2727

28-
<x-child-parent alocal="Test"></x-child-parent>
28+
<x-test.child-parent alocal="Test"></x-test.child-parent>
2929

30-
<x-parent>
30+
<x-test.parent>
3131
<h5>YIELD PARENT IN TEST.html</h5>
3232
{{ alocal }}
3333
<fill:myslot>
3434
SLOT PARENT INSIDE TEST.html
3535
</fill:myslot>
36-
</x-parent>
36+
</x-test.parent>
3737

38-
<x-child>
38+
<x-test.child>
3939
<h5>YIELD CHILD INSIDE TEST.html</h5>
4040
<fill:myslot>
4141
SLOT CHILD INSIDE TEST.html
4242
</fill:myslot>
43-
</x-child>
43+
</x-test.child>
44+
45+
<x-test.parent2-child2>
46+
<div class="parent2-child2-yield">
47+
parent2-child2 yield
48+
</div>
49+
50+
<fill:name>
51+
<div class="parent2-child2-slot">
52+
parent2-child2 slot
53+
</div>
54+
</fill:name>
55+
</x-test.parent2-child2>
4456
</div>
4557
</div>
4658
</x-page>

examples/src/pages/test2.html

-11
This file was deleted.

src/locals.js

+8
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ module.exports = (currentNode, nextNode, filledSlots, options) => {
5959
// Merge with global
6060
attributes = merge(options.expressions.locals, attributes);
6161

62+
// There is no way to know here what are locals
63+
// and what attributes passed to component
64+
65+
// Convert attribute names to camelCase
66+
// each(attributes, (value, key, attrs) => {
67+
// attrs[camelCase(key)] = value;
68+
// });
69+
6270
// Retrieve default locals from <script props> and merge with attributes
6371
const {locals} = scriptDataLocals(nextNode, {localsAttr: options.localsAttr, removeScriptLocals: true, locals: {...attributes, $slots: filledSlots}});
6472

0 commit comments

Comments
 (0)