Skip to content

Commit fe4801a

Browse files
author
Rob Dodson
committed
Add Plunker preview buttons to all Creating Elements examples
1 parent 80d5010 commit fe4801a

43 files changed

Lines changed: 347 additions & 69 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

_includes/samples/tk-binding-to-elements.html renamed to _includes/samples/age-slider.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
<link rel="import" href="/samples/components/tk-binding-to-elements.html">
1+
<link rel="import" href="/samples/components/age-slider/age-slider.html">
22

33
<!-- <link rel="import" href="/elements/demo-tabs.html"> -->
44

5-
<demo-tabs selected="0">
5+
<demo-tabs selected="0"
6+
demoSrc="/samples/components/age-slider/manifest.json">
67
<demo-tab heading="age-slider.html">
78
{% highlight html %}
8-
{% include_external samples/components/tk-binding-to-elements.html %}
9+
{% include_external samples/components/age-slider/age-slider.html %}
910
{% endhighlight %}
1011
</demo-tab>
1112
<demo-tab heading="index.html">

_includes/samples/tk-element-property-public.html renamed to _includes/samples/color-picker.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
<link rel="import" href="/samples/components/tk-element-property-public.html">
1+
<link rel="import" href="/samples/components/color-picker/color-picker.html">
22

33
<!-- <link rel="import" href="/elements/demo-tabs.html"> -->
44

5-
<demo-tabs selected="0">
5+
<demo-tabs selected="0"
6+
demoSrc="/samples/components/color-picker/manifest.json">
67
<demo-tab heading="color-picker.html">
78
{% highlight html %}
8-
{% include_external samples/components/tk-element-property-public.html %}
9+
{% include_external samples/components/color-picker/color-picker.html %}
910
{% endhighlight %}
1011
</demo-tab>
1112
<demo-tab heading="index.html">

_includes/samples/tk-node-finding.html renamed to _includes/samples/editable-color-picker.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
<link rel="import" href="/samples/components/tk-node-finding.html">
1+
<link rel="import" href="/samples/components/editable-color-picker/editable-color-picker.html">
22

33
<!-- <link rel="import" href="/elements/demo-tabs.html"> -->
44

5-
<demo-tabs selected="0">
5+
<demo-tabs selected="0"
6+
demoSrc="/samples/components/editable-color-picker/manifest.json">
67
<demo-tab heading="editable-color-picker.html">
78
{% highlight html %}
8-
{% include_external samples/components/tk-node-finding.html %}
9+
{% include_external samples/components/editable-color-picker/editable-color-picker.html %}
910
{% endhighlight %}
1011
</demo-tab>
1112
<demo-tab heading="index.html">

_includes/samples/tk-element-databinding-color.html renamed to _includes/samples/fav-color.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
<link rel="import" href="/samples/components/tk-element-databinding-color.html">
1+
<link rel="import" href="/samples/components/fav-color/fav-color.html">
22

33
<!-- <link rel="import" href="/elements/demo-tabs.html"> -->
44

5-
<demo-tabs selected="0">
5+
<demo-tabs selected="0"
6+
demoSrc="/samples/components/fav-color/manifest.json">
67
<demo-tab heading="fav-color.html">
78
{% highlight html %}
8-
{% include_external samples/components/tk-element-databinding-color.html %}
9+
{% include_external samples/components/fav-color/fav-color.html %}
910
{% endhighlight %}
1011
</demo-tab>
1112
<demo-tab heading="index.html">

_includes/samples/tk-element-databinding.html renamed to _includes/samples/name-tag.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
<link rel="import" href="/samples/components/tk-element-databinding.html">
1+
<link rel="import" href="/samples/components/name-tag/name-tag.html">
22

33
<!-- <link rel="import" href="/elements/demo-tabs.html"> -->
44

5-
<demo-tabs selected="0">
5+
<demo-tabs selected="0"
6+
demoSrc="/samples/components/name-tag/manifest.json">
67
<demo-tab heading="name-tag.html">
78
{% highlight html %}
8-
{% include_external samples/components/tk-element-databinding.html %}
9+
{% include_external samples/components/name-tag/name-tag.html %}
910
{% endhighlight %}
1011
</demo-tab>
1112
<demo-tab heading="index.html">
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
<link rel="import" href="/samples/components/tk-element-proto.html">
1+
<link rel="import" href="/samples/components/proto-element/proto-element.html">
22

33
<!-- <link rel="import" href="/elements/demo-tabs.html"> -->
44

5-
<demo-tabs selected="0">
5+
<demo-tabs selected="0"
6+
demoSrc="/samples/components/proto-element/manifest.json">
67
<demo-tab heading="proto-element.html">
78
{% highlight html %}
8-
{% include_external samples/components/tk-element-proto.html %}
9+
{% include_external samples/components/proto-element/proto-element.html %}
910
{% endhighlight %}
1011
</demo-tab>
1112
<demo-tab heading="index.html">
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
<link rel="import" href="/samples/components/tk-element-created.html">
1+
<link rel="import" href="/samples/components/ready-element/ready-element.html">
22

33
<!-- <link rel="import" href="/elements/demo-tabs.html"> -->
44

5-
<demo-tabs selected="0">
5+
<demo-tabs selected="0"
6+
demoSrc="/samples/components/ready-element/manifest.json">
67
<demo-tab heading="ready-element.html">
78
{% highlight html %}
8-
{% include_external samples/components/tk-element-created.html %}
9+
{% include_external samples/components/ready-element/ready-element.html %}
910
{% endhighlight %}
1011
</demo-tab>
1112
<demo-tab heading="index.html">

bower.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"smoothscroll": "~0.0.2",
2525
"x-tag-imports": "x-tag/x-tag-imports",
2626
"marked": "*",
27-
"highlightjs": "*"
27+
"highlightjs": "*",
28+
"plunker-button": "robdodson/plunker-button#~0.3.0"
2829
}
2930
}

docs/start/creatingelements.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ detailed information on each of these features.
124124

125125
When you're creating a new element, you'll often need to expose a [public API](/docs/polymer/polymer.html#published-properties) so users can configure it. To define a public API, include a `<script>` tag that calls `{{site.project_title}}('your-tagname')`. The `{{site.project_title}}(...)` constructor is a convenience wrapper for [`document.registerElement`](/platform/custom-elements.html#documentregister), but also endows the element with special features like data binding and event mapping. Its first argument is the name of the element you're creating. The second argument (optional) is an object that defines your element's prototype.
126126

127-
{% include samples/tk-element-proto.html %}
127+
{% include samples/proto-element.html %}
128128

129129
### Adding lifecycle methods
130130

@@ -133,15 +133,15 @@ When you're creating a new element, you'll often need to expose a [public API](/
133133
When a custom element has been registered it calls its `created()` callback (if one has been defined). When {{site.project_title}} finishes its initialization, the `ready()` method is called.
134134
The `ready` callback is a great place to do constructor-like initialization work.
135135

136-
{% include samples/tk-element-created.html %}
136+
{% include samples/ready-element.html %}
137137

138138
Learn more about all of the [lifecycle callbacks](/docs/polymer/polymer.html#lifecyclemethods).
139139

140140
### Declarative data binding
141141

142142
Data binding is a great way to quickly propagate changes in your element and reduce boilerplate code. You can bind properties in your component using the "double-mustache" syntax (`{%raw%}{{}}{%endraw%}`). The `{%raw%}{{}}{%endraw%}` is replaced by the value of the property referenced between the brackets.
143143

144-
{% include samples/tk-element-databinding.html %}
144+
{% include samples/name-tag.html %}
145145

146146
Note: {{site.project_title}}'s data-binding is powered under the covers by a sub-library called [TemplateBinding](/docs/polymer/template.html), designed for other libraries to build on top of.
147147
{: .alert .alert-info}
@@ -150,13 +150,13 @@ Note: {{site.project_title}}'s data-binding is powered under the covers by a sub
150150

151151
You can use binding expressions in most HTML markup, except for tag names themselves. In the following example, we create a new property on our component named `color` whose value is bound to the value of the `color` style applied to the custom element. Bindings ensure that any time a property like `color` is changed, the new value will be propagated to all binding points.
152152

153-
{% include samples/tk-element-databinding-color.html %}
153+
{% include samples/fav-color.html %}
154154

155155
#### Binding between components and built-in elements {#bindingtobuiltin}
156156

157157
You can use bindings with built-in elements just like you would with Polymer elements. This is a great way to leverage existing APIs to build complex components. The following example demonstrates binding component properties to attributes of native input elements.
158158

159-
{% include samples/tk-binding-to-elements.html %}
159+
{% include samples/age-slider.html %}
160160

161161
**Note:** Giving `age` an initial value `25` gives {{site.project_title}}
162162
a hint that this property is an integer.
@@ -175,7 +175,7 @@ _Publish_ a property by listing it in the `attributes` attribute in your `<polym
175175
The following example defines two data-bound properties on the element, `owner` and `color`,
176176
and gives them default values:
177177

178-
{% include samples/tk-element-property-public.html %}
178+
{% include samples/color-picker.html %}
179179

180180
In this example the user overrides the defaults for `owner` and `color`
181181
by configuring the element with initial attribute values (e.g. `<color-picker owner="Scott" color="blue">`).
@@ -189,7 +189,7 @@ by configuring the element with initial attribute values (e.g. `<color-picker ow
189189

190190
The use of the `id` attribute has traditionally been discouraged as an anti-pattern because the document requires element IDs to be unique. Shadow DOM, on the other hand, is a self-contained document-like subtree; IDs in that subtree do not interact with IDs in other trees. This means the use of IDs in Shadow DOM is not only permissible, it's actually encouraged. Each {{site.project_title}} element generates a map of IDs to node references in the element's template. This map is accessible as `$` on the element and can be used to quickly select the node you wish to work with.
191191

192-
{% include samples/tk-node-finding.html %}
192+
{% include samples/editable-color-picker.html %}
193193

194194
[Learn more about automatic node finding](/docs/polymer/polymer.html#automatic-node-finding)
195195

elements/common_elements.vulcanized.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)