From 8a04c4ce3ba4047fb609d01ac04f7b9728cd7cd2 Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Sat, 4 Jul 2015 11:16:12 +0100 Subject: [PATCH] Adding in named yield proposal --- active/0000-named-yields.md | 69 +++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 active/0000-named-yields.md diff --git a/active/0000-named-yields.md b/active/0000-named-yields.md new file mode 100644 index 0000000000..79845ab29c --- /dev/null +++ b/active/0000-named-yields.md @@ -0,0 +1,69 @@ +- Start Date: 2015-07-04 +- RFC PR: (leave this empty) +- Ember Issue: (leave this empty) + +# Summary + +This RFC adds in named yields into components to match the slots proposal for web components; It allows authors to add named areas to place content into their components. + +# Motivation + +Components are more than just dumb boxes, creating components that are more than just content is currently difficult. +So in the modal component case allowing the user of the component to be able to specify what is within the title of the modal. + +# Detailed design + +templates/components/my-thing.md +``` +
+
{{yield thing}}
+
{{yield}}
+
+``` + +templates/application.md +``` +Look at my great thing: + + + Text +
Some text 2
+ +

Some text 1

+
+``` + +The rendered DOM would look similar to this: +``` + +
+

Some text 1

+
Text
+
+
+``` + +## Distribution + +Should loosely match the definition here: https://github.com/w3c/webcomponents/blob/gh-pages/proposals/Slots-Proposal.md + +- Is the node text or missing a slot attribute + - Send to **default yield** +- If the slot attribute matches a named yield + - Send node to **specified yield** +- Else + - Discard node + + +# Drawbacks + +- Slots is still a proposal + +# Alternatives + +The alternatives are letting all component users redefine structure in their templates repeatedly as currently is happening. + +# Unresolved questions + +The JavaScript distribution API is stalling slots however I feel this isn't required for Ember. +