Skip to content

Commit

Permalink
Rename test component
Browse files Browse the repository at this point in the history
  • Loading branch information
thewebartisan7 committed Oct 25, 2022
1 parent a3e475f commit b37a077
Show file tree
Hide file tree
Showing 14 changed files with 88 additions and 79 deletions.
28 changes: 27 additions & 1 deletion docs/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<div class="container-lg">
<div class="row">
<div class="col-lg-8">
<h1 class="display-1 fw-bold mb-4">Demo</h1>
<h1 class="display-1 fw-bold mb-4">Playground</h1>
<div class="wrapper">
<div class="demo my-demo" something="alocal">
<h1>anObjectDefault</h1>
Expand Down Expand Up @@ -191,6 +191,32 @@ <h4>Child</h4>
<h5>YIELD CHILD INSIDE TEST.html</h5>
SLOT CHILD INSIDE TEST.html
</div>
<div class="wrapper">
<div class="parent">
{"name":{"filled":true,"rendered":false,"tag":"fill:name","attrs":{},"content":["Slot parent"],"source":"Slot parent","locals":{}}}
<div class="parent-content">I'm parent</div>
<div class="parent-yield">
<h1>Parent yield</h1>
<div class="child">
{"name":{"filled":true,"rendered":false,"tag":"fill:name","attrs":{},"content":["Slot child"],"source":"Slot child","locals":{}}}
<div class="child-content">I'm child</div>
<div class="child-yield">
<h1>Child yield</h1>
</div>
<div class="child-slot">Slot child</div>
</div>
</div>
<div class="parent-slot">Slot parent</div>
</div>
{"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
<div class="\&quot;parent2-child2-slot\&quot;">\n parent2-child2 slot\n</div>
\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":{}}}


yes is filled
<div class="parent2-child2-slot">parent2-child2 slot</div>
<div class="parent2-child2-yield">parent2-child2 yield</div>
</div>
</div>
</div>
</div>
Expand Down
26 changes: 0 additions & 26 deletions docs/test2.html

This file was deleted.

28 changes: 27 additions & 1 deletion examples/dist/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<div class="container-lg">
<div class="row">
<div class="col-lg-8">
<h1 class="display-1 fw-bold mb-4">Demo</h1>
<h1 class="display-1 fw-bold mb-4">Playground</h1>
<div class="wrapper">
<div class="demo my-demo" something="alocal">
<h1>anObjectDefault</h1>
Expand Down Expand Up @@ -191,6 +191,32 @@ <h4>Child</h4>
<h5>YIELD CHILD INSIDE TEST.html</h5>
SLOT CHILD INSIDE TEST.html
</div>
<div class="wrapper">
<div class="parent">
{"name":{"filled":true,"rendered":false,"tag":"fill:name","attrs":{},"content":["Slot parent"],"source":"Slot parent","locals":{}}}
<div class="parent-content">I'm parent</div>
<div class="parent-yield">
<h1>Parent yield</h1>
<div class="child">
{"name":{"filled":true,"rendered":false,"tag":"fill:name","attrs":{},"content":["Slot child"],"source":"Slot child","locals":{}}}
<div class="child-content">I'm child</div>
<div class="child-yield">
<h1>Child yield</h1>
</div>
<div class="child-slot">Slot child</div>
</div>
</div>
<div class="parent-slot">Slot parent</div>
</div>
{"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
<div class="\&quot;parent2-child2-slot\&quot;">\n parent2-child2 slot\n</div>
\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":{}}}


yes is filled
<div class="parent2-child2-slot">parent2-child2 slot</div>
<div class="parent2-child2-yield">parent2-child2 yield</div>
</div>
</div>
</div>
</div>
Expand Down
26 changes: 0 additions & 26 deletions examples/dist/test2.html

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<x-parent>
<x-test.parent>
<h5>YIELD PARENT IN CHILD-PARENT.html</h5>
{{ alocal }}
<fill:myslot>
SLOT PARENT INSIDE CHILD-PARENT.html
</fill:myslot>
</x-parent>
</x-test.parent>

<x-child>
<x-test.child>
<h5>YIELD CHILD INSIDE CHILD-PARENT.html</h5>
<fill:myslot>
SLOT CHILD INSIDE CHILD-PARENT.html
</fill:myslot>
</x-child>
</x-test.child>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<div class="wrapper">
<x-parent2>
<x-test.parent2>
<h1>Parent yield</h1>

<x-child2>
<x-test.child2>

<h1>Child yield</h1>

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

</x-child2>
</x-test.child2>

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

</x-parent2>
</x-test.parent2>

{{ $slots }}

Expand Down
File renamed without changes.
24 changes: 18 additions & 6 deletions examples/src/pages/test.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<x-page>
<div class="row">
<div class="col-lg-8">
<h1 class="display-1 fw-bold mb-4">Demo</h1>
<h1 class="display-1 fw-bold mb-4">Playground</h1>

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

<hr>

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

<x-parent>
<x-test.parent>
<h5>YIELD PARENT IN TEST.html</h5>
{{ alocal }}
<fill:myslot>
SLOT PARENT INSIDE TEST.html
</fill:myslot>
</x-parent>
</x-test.parent>

<x-child>
<x-test.child>
<h5>YIELD CHILD INSIDE TEST.html</h5>
<fill:myslot>
SLOT CHILD INSIDE TEST.html
</fill:myslot>
</x-child>
</x-test.child>

<x-test.parent2-child2>
<div class="parent2-child2-yield">
parent2-child2 yield
</div>

<fill:name>
<div class="parent2-child2-slot">
parent2-child2 slot
</div>
</fill:name>
</x-test.parent2-child2>
</div>
</div>
</x-page>
11 changes: 0 additions & 11 deletions examples/src/pages/test2.html

This file was deleted.

8 changes: 8 additions & 0 deletions src/locals.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ module.exports = (currentNode, nextNode, filledSlots, options) => {
// Merge with global
attributes = merge(options.expressions.locals, attributes);

// There is no way to know here what are locals
// and what attributes passed to component

// Convert attribute names to camelCase
// each(attributes, (value, key, attrs) => {
// attrs[camelCase(key)] = value;
// });

// Retrieve default locals from <script props> and merge with attributes
const {locals} = scriptDataLocals(nextNode, {localsAttr: options.localsAttr, removeScriptLocals: true, locals: {...attributes, $slots: filledSlots}});

Expand Down

0 comments on commit b37a077

Please sign in to comment.