-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
96 lines (78 loc) · 3.92 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!doctype html>
<html>
<head>
<title>ShadowComponent Documentation</title>
<script src="polyfills/webcomponents.min.js"></script>
<script src="shadow-import.js"></script>
<link href='style/style.css' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700' rel='stylesheet' type='text/css'>
<link href='style/typicons/typicons.min.css' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/styles/github.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<shadow-import tag="hero-section" href="examples/hero/components/hero-element/view.html"></shadow-import>
</head>
<body>
<header>
<span class="title">ShadowComponent Documentation</span>
<a title="Report a Bug or Issue" href="https://github.com/NateFerrero/shadow-import/issues/new"><span class="typcn typcn-warning"></span></a>
<a title="GitHub Project" href="https://github.com/NateFerrero/shadow-import"><span class="typcn typcn-social-github-circular"></span></a>
<a title="Follow me on Twitter" href="https://twitter.com/NateFerrero"><span class="typcn typcn-social-twitter"></span></a>
</header>
<hero-section background-color="#FF895A">
<h1><code><shadow-import></code></h1>
<p>Web Components for the rest of us.</p>
</hero-section>
<article>
<h1>Quick Start</h1>
<pre><code><head>
<script src="shadow-import/polyfills/webcomponents.min.js"></script>
<script src="shadow-import/shadow-import.js"></script>
<shadow-import tag="<i>tag-name</i>" href="<i>template-url</i>"></shadow-import>
</head>
<body>
<<i>tag-name</i>></<i>tag-name</i>>
</body>
</code></pre>
<h1>Creating a ShadowComponent</h1>
<h2><span class="typcn typcn-document"></span> my-component/view.html (this is the <code><i>template-url</i></code> imported above)</h2>
<pre><code><script src="component.js"></script>
<template>
<style>
:host {
/* add styles to the host tag here */
}
/* add all other styles for the HTML tag content here */
</style>
<!-- add HTML tag content here -->
</template>
</code></pre>
<h2><span class="typcn typcn-document"></span> my-component/component.js</h2>
<pre><code>ShadowComponent(function (cls, proto) {
proto.init = function () {
this.el.host; // refers to the host element (as imported, e.g.
// <tag-name></tag-name>)
this.el; // refers to the shadow root (contains the
// contents of <template></template>)
this.attrs; // manage attributes on the host element, usage:
// this.attrs.set(attrName, value)
// this.attrs.get(attrName, default)
// this.attrs.watch(attrName, function (newVal, oldVal) { ... })
this.content; // a DocumentFragment containing any content used in the tag,
// e.g. <tag-name><p>This content.</p></tag-name>
// To include this in your component, use:
// this.el.appendChild(this.content);
};
});
</code></pre>
</article>
<article>
<h1>Examples</h1>
<ul>
<li><a href="examples/hero/">Hero Element Example</a></li>
<li><a href="examples/color-input/">Multiple Templates Example</a></li>
<li><a href="examples/angular-demo">Angular.js Integration Example</a></li>
</ul>
</article>
</body>
</html>