-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(components): components can now pass data to the slots
- Loading branch information
1 parent
fd884ea
commit 4edb22e
Showing
20 changed files
with
377 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
{{ $slots.heading }} | ||
{{ $slots.main }} | ||
{{ $slots.heading() }} | ||
{{ $slots.main() }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
(function (template, ctx) { | ||
let out = '' | ||
out += template.renderWithState('components-named-slots/alert', {}, { 'heading': (function (template, ctx) { | ||
return function (props) { | ||
let out = '' | ||
ctx.newFrame() | ||
ctx.setOnFrame('props', props) | ||
out += ' This is title' | ||
out += '\n' | ||
ctx.removeFrame() | ||
return out | ||
} | ||
})(template, ctx), 'main': (function (template, ctx) { | ||
return function (props) { | ||
let out = '' | ||
ctx.newFrame() | ||
ctx.setOnFrame('props', props) | ||
out += ' This is then body' | ||
out += '\n' | ||
ctx.removeFrame() | ||
return out | ||
} | ||
})(template, ctx) }) | ||
return out | ||
})(template, ctx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
{{ title }} | ||
{{ $slots.main }} | ||
{{ $slots.main() }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
(function (template, ctx) { | ||
let out = '' | ||
out += template.renderWithState('components-props/alert', { 'title': 'H1' }, { 'main': (function (template, ctx) { | ||
return function (props) { | ||
let out = '' | ||
ctx.newFrame() | ||
ctx.setOnFrame('props', props) | ||
out += 'Hello world' | ||
out += '\n' | ||
ctx.removeFrame() | ||
return out | ||
} | ||
})(template, ctx) }) | ||
return out | ||
})(template, ctx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Top level username is {{ username || 'Guest' }} | ||
{{ $slots.title({ username: 'nikk' }) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
(function (template, ctx) { | ||
let out = '' | ||
out += template.renderWithState('components-slot-props/alert', {}, { 'title': (function (template, ctx) { | ||
return function (props) { | ||
let out = '' | ||
ctx.newFrame() | ||
ctx.setOnFrame('props', props) | ||
out += ' Hello ' | ||
out += `${ctx.escape(ctx.resolve('props').username)}` | ||
out += '\n' | ||
ctx.removeFrame() | ||
return out | ||
} | ||
})(template, ctx) }) | ||
return out | ||
})(template, ctx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@component('components-slot-props/alert') | ||
@slot('title') | ||
Hello {{ props.username }} | ||
@endslot | ||
@endcomponent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"username": "virk" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Top level username is Guest | ||
Hello nikk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{{ $slots.main }} | ||
{{ $slots.main() }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
(function (template, ctx) { | ||
let out = '' | ||
out += template.renderWithState('components-state/alert', {}, { 'main': (function (template, ctx) { | ||
return function (props) { | ||
let out = '' | ||
ctx.newFrame() | ||
ctx.setOnFrame('props', props) | ||
out += ' Hello ' | ||
out += `${ctx.escape(ctx.resolve('username'))}` | ||
out += '\n' | ||
ctx.removeFrame() | ||
return out | ||
} | ||
})(template, ctx) }) | ||
return out | ||
})(template, ctx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{{ $slots.main }} | ||
{{ $slots.main() }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
(function (template, ctx) { | ||
let out = '' | ||
out += template.renderWithState('components/alert', {}, { 'main': (function (template, ctx) { | ||
return function (props) { | ||
let out = '' | ||
ctx.newFrame() | ||
ctx.setOnFrame('props', props) | ||
out += ' Hello world' | ||
out += '\n' | ||
ctx.removeFrame() | ||
return out | ||
} | ||
})(template, ctx) }) | ||
return out | ||
})(template, ctx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ Assertion.use((chai, utils) => { | |
} | ||
}) | ||
|
||
cli.run('test/edge.spec.ts') | ||
cli.run('test/*.spec.ts') |
Oops, something went wrong.