├── .gitignore
├── .travis.yml
├── .versions
├── LICENSE
├── README.md
├── dist
├── bindPolyfill.js
└── webcomponents.js
├── lib
└── registerElement.coffee
├── package.js
├── test
├── componentRendered.coffee
└── mockup
│ ├── component.coffee
│ ├── component.css
│ └── component.html
└── versions.json
/.gitignore:
--------------------------------------------------------------------------------
1 | .build*
2 | *.swo
3 | *.swp
4 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "0.10"
4 | before_install:
5 | - "curl -L http://git.io/ejPSng | /bin/sh"
6 |
--------------------------------------------------------------------------------
/.versions:
--------------------------------------------------------------------------------
1 | base64@1.0.3
2 | binary-heap@1.0.3
3 | blaze@2.1.2
4 | blaze-tools@1.0.3
5 | callback-hook@1.0.3
6 | check@1.0.5
7 | coffeescript@1.0.6
8 | ddp@1.1.0
9 | deps@1.0.7
10 | ejson@1.0.6
11 | geojson-utils@1.0.3
12 | html-tools@1.0.4
13 | htmljs@1.0.4
14 | id-map@1.0.3
15 | jquery@1.11.3_2
16 | json@1.0.3
17 | local-test:numtel:webcomponent@0.0.6
18 | logging@1.0.7
19 | meteor@1.1.6
20 | minifiers@1.1.5
21 | minimongo@1.0.8
22 | mongo@1.1.0
23 | numtel:webcomponent@0.0.6
24 | observe-sequence@1.0.6
25 | ordered-dict@1.0.3
26 | random@1.0.3
27 | reactive-dict@1.1.0
28 | reactive-var@1.0.5
29 | retry@1.0.3
30 | session@1.1.0
31 | spacebars-compiler@1.0.6
32 | templating@1.1.1
33 | test-helpers@1.0.4
34 | tinytest@1.0.5
35 | tracker@1.0.7
36 | underscore@1.0.3
37 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 ben@latenightsketches.com
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # numtel:webcomponent
2 |
3 | Turn any Meteor template into a new element on all modern browsers with help from Polymer's [webcomponents.js polyfill library](https://github.com/Polymer/webcomponentsjs)
4 |
5 | Last decade's iframes can finally be banished in favor of new WebComponents. Full stylesheet and DOM isolation without extra layers is native in some browsers already (Chrome, Firefox 34). The Polymer library brings WebComponent support to all modern browsers (IE 9+). [Learn more about WebComponents...](http://webcomponents.org/)
6 |
7 | ### Why use WebComponents when Meteor already has Spacebars?
8 |
9 | Spacebars already provides some of the features of WebComponents: attributes, child DOM.
10 | Beyond these features, a WebComponent provides CSS and DOM isolation in what is called a Shadow DOM.
11 | DOM isolation means that `querySelector()` or jQuery will not be able to directly find the elements.
12 | CSS isolation means that a rules on your page will not effect an element in your WebComponent's Shadow DOM (or vice-versa).
13 |
14 | Polymer's webcomponents.js library includes polyfills for all features except shadow DOM CSS isolation. To make up for this shortcoming, I have been working on a [shadow DOM CSS isolation polyfill](https://github.com/numtel/shadowstyles).
15 |
16 | ## Installation
17 |
18 | ```bash
19 | $ meteor add numtel:webcomponent
20 | ```
21 |
22 | ## Hello, World
23 |
24 | Imagine the familiar template:
25 |
26 | ```html
27 |
28 |
29 |
You've pressed the button {{counter}} times.
30 |
31 | ```
32 |
33 | This widget can be converted in to a WebComponent using its `registerElement` method:
34 |
35 | ```javascript
36 |
37 | // ...Default event handlers...
38 |
39 | Template.hello.registerElement('hello-counter');
40 | ```
41 |
42 | Then insert the new element anywhere in your application:
43 |
44 | ```html
45 |
46 | ```
47 |
48 | ## Implements
49 |
50 | #### Template.prototype.registerElement(name, options)
51 |
52 | `name` *String* - The name of the new element type to be created. Must include a hyphen. A reference to the element constructor will be added to `window` on the camel-cased version of this name.
53 |
54 | `options` *Object* - Optionally, specify the following options:
55 |
56 | Key | Type | Description
57 | ---------|----------|--------------------------
58 | `css` |`string` | Rules to add in a `'
25 | # Blaze Template must be wrapped as jQuery fails to find children
26 | # directly from the shadowRoot.
27 | shadowContent = styles + '