polymer-rails 0.3.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/polymer/polymer-micro.html +528 -21
- data/app/assets/javascripts/polymer/polymer-mini.html +1304 -27
- data/app/assets/javascripts/polymer/polymer.html +3771 -51
- data/app/assets/javascripts/webcomponentsjs/webcomponents-lite.js +44 -14
- data/app/assets/javascripts/webcomponentsjs/webcomponents.js +7106 -0
- data/lib/polymer-rails/version.rb +1 -1
- metadata +4 -64
- data/app/assets/javascripts/polymer/src/lib/annotations/annotations.html +0 -262
- data/app/assets/javascripts/polymer/src/lib/annotations/demo/app-chrome.html +0 -60
- data/app/assets/javascripts/polymer/src/lib/array-observe.html +0 -118
- data/app/assets/javascripts/polymer/src/lib/array-splice.html +0 -262
- data/app/assets/javascripts/polymer/src/lib/async.html +0 -68
- data/app/assets/javascripts/polymer/src/lib/base.html +0 -117
- data/app/assets/javascripts/polymer/src/lib/bind/accessors.html +0 -223
- data/app/assets/javascripts/polymer/src/lib/bind/demo/app-chrome.html +0 -28
- data/app/assets/javascripts/polymer/src/lib/bind/demo/app.html +0 -29
- data/app/assets/javascripts/polymer/src/lib/bind/demo/src/annotations-bind-demo.html +0 -76
- data/app/assets/javascripts/polymer/src/lib/bind/demo/src/bind-demo.html +0 -83
- data/app/assets/javascripts/polymer/src/lib/bind/effects.html +0 -80
- data/app/assets/javascripts/polymer/src/lib/case-map.html +0 -46
- data/app/assets/javascripts/polymer/src/lib/collection.html +0 -179
- data/app/assets/javascripts/polymer/src/lib/css-parse.html +0 -131
- data/app/assets/javascripts/polymer/src/lib/debounce.html +0 -69
- data/app/assets/javascripts/polymer/src/lib/dom-api.html +0 -467
- data/app/assets/javascripts/polymer/src/lib/dom-module.html +0 -68
- data/app/assets/javascripts/polymer/src/lib/event-api.html +0 -92
- data/app/assets/javascripts/polymer/src/lib/expr/focus.html +0 -22
- data/app/assets/javascripts/polymer/src/lib/expr/gestures.html +0 -1
- data/app/assets/javascripts/polymer/src/lib/expr/log.html +0 -21
- data/app/assets/javascripts/polymer/src/lib/expr/sinspect.html +0 -235
- data/app/assets/javascripts/polymer/src/lib/expr/style-auditor.html +0 -123
- data/app/assets/javascripts/polymer/src/lib/expr/style-protector.html +0 -52
- data/app/assets/javascripts/polymer/src/lib/gestures.html +0 -284
- data/app/assets/javascripts/polymer/src/lib/lang.html +0 -21
- data/app/assets/javascripts/polymer/src/lib/module.html +0 -56
- data/app/assets/javascripts/polymer/src/lib/polymer-bootstrap.html +0 -78
- data/app/assets/javascripts/polymer/src/lib/resolve-url.html +0 -82
- data/app/assets/javascripts/polymer/src/lib/settings.html +0 -52
- data/app/assets/javascripts/polymer/src/lib/style-defaults.html +0 -32
- data/app/assets/javascripts/polymer/src/lib/style-transformer.html +0 -185
- data/app/assets/javascripts/polymer/src/lib/style-util.html +0 -77
- data/app/assets/javascripts/polymer/src/lib/template/templatizer.html +0 -132
- data/app/assets/javascripts/polymer/src/lib/template/x-array-selector.html +0 -178
- data/app/assets/javascripts/polymer/src/lib/template/x-autobind.html +0 -80
- data/app/assets/javascripts/polymer/src/lib/template/x-if.html +0 -115
- data/app/assets/javascripts/polymer/src/lib/template/x-repeat.html +0 -510
- data/app/assets/javascripts/polymer/src/lib/template/x-template.html +0 -39
- data/app/assets/javascripts/polymer/src/lib/x-style.html +0 -115
- data/app/assets/javascripts/polymer/src/micro/attributes.html +0 -180
- data/app/assets/javascripts/polymer/src/micro/constructor.html +0 -74
- data/app/assets/javascripts/polymer/src/micro/extends.html +0 -79
- data/app/assets/javascripts/polymer/src/micro/mixins.html +0 -40
- data/app/assets/javascripts/polymer/src/micro/properties.html +0 -96
- data/app/assets/javascripts/polymer/src/micro/tag.html +0 -28
- data/app/assets/javascripts/polymer/src/mini/ready.html +0 -180
- data/app/assets/javascripts/polymer/src/mini/shadow.html +0 -41
- data/app/assets/javascripts/polymer/src/mini/shady.html +0 -365
- data/app/assets/javascripts/polymer/src/mini/template.html +0 -56
- data/app/assets/javascripts/polymer/src/polymer-lib.html +0 -15
- data/app/assets/javascripts/polymer/src/standard/annotations.html +0 -198
- data/app/assets/javascripts/polymer/src/standard/configure.html +0 -160
- data/app/assets/javascripts/polymer/src/standard/effects.html +0 -215
- data/app/assets/javascripts/polymer/src/standard/events.html +0 -127
- data/app/assets/javascripts/polymer/src/standard/notify-path.html +0 -260
- data/app/assets/javascripts/polymer/src/standard/resolveUrl.html +0 -27
- data/app/assets/javascripts/polymer/src/standard/styling.html +0 -157
- data/app/assets/javascripts/polymer/src/standard/utils.html +0 -158
- data/app/assets/javascripts/polymer/src/standard/x-styling.html +0 -300
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polymer-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Chaplinsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -120,68 +120,8 @@ files:
|
|
120
120
|
- app/assets/javascripts/polymer/polymer-micro.html
|
121
121
|
- app/assets/javascripts/polymer/polymer-mini.html
|
122
122
|
- app/assets/javascripts/polymer/polymer.html
|
123
|
-
- app/assets/javascripts/polymer/src/lib/annotations/annotations.html
|
124
|
-
- app/assets/javascripts/polymer/src/lib/annotations/demo/app-chrome.html
|
125
|
-
- app/assets/javascripts/polymer/src/lib/array-observe.html
|
126
|
-
- app/assets/javascripts/polymer/src/lib/array-splice.html
|
127
|
-
- app/assets/javascripts/polymer/src/lib/async.html
|
128
|
-
- app/assets/javascripts/polymer/src/lib/base.html
|
129
|
-
- app/assets/javascripts/polymer/src/lib/bind/accessors.html
|
130
|
-
- app/assets/javascripts/polymer/src/lib/bind/demo/app-chrome.html
|
131
|
-
- app/assets/javascripts/polymer/src/lib/bind/demo/app.html
|
132
|
-
- app/assets/javascripts/polymer/src/lib/bind/demo/src/annotations-bind-demo.html
|
133
|
-
- app/assets/javascripts/polymer/src/lib/bind/demo/src/bind-demo.html
|
134
|
-
- app/assets/javascripts/polymer/src/lib/bind/effects.html
|
135
|
-
- app/assets/javascripts/polymer/src/lib/case-map.html
|
136
|
-
- app/assets/javascripts/polymer/src/lib/collection.html
|
137
|
-
- app/assets/javascripts/polymer/src/lib/css-parse.html
|
138
|
-
- app/assets/javascripts/polymer/src/lib/debounce.html
|
139
|
-
- app/assets/javascripts/polymer/src/lib/dom-api.html
|
140
|
-
- app/assets/javascripts/polymer/src/lib/dom-module.html
|
141
|
-
- app/assets/javascripts/polymer/src/lib/event-api.html
|
142
|
-
- app/assets/javascripts/polymer/src/lib/expr/focus.html
|
143
|
-
- app/assets/javascripts/polymer/src/lib/expr/gestures.html
|
144
|
-
- app/assets/javascripts/polymer/src/lib/expr/log.html
|
145
|
-
- app/assets/javascripts/polymer/src/lib/expr/sinspect.html
|
146
|
-
- app/assets/javascripts/polymer/src/lib/expr/style-auditor.html
|
147
|
-
- app/assets/javascripts/polymer/src/lib/expr/style-protector.html
|
148
|
-
- app/assets/javascripts/polymer/src/lib/gestures.html
|
149
|
-
- app/assets/javascripts/polymer/src/lib/lang.html
|
150
|
-
- app/assets/javascripts/polymer/src/lib/module.html
|
151
|
-
- app/assets/javascripts/polymer/src/lib/polymer-bootstrap.html
|
152
|
-
- app/assets/javascripts/polymer/src/lib/resolve-url.html
|
153
|
-
- app/assets/javascripts/polymer/src/lib/settings.html
|
154
|
-
- app/assets/javascripts/polymer/src/lib/style-defaults.html
|
155
|
-
- app/assets/javascripts/polymer/src/lib/style-transformer.html
|
156
|
-
- app/assets/javascripts/polymer/src/lib/style-util.html
|
157
|
-
- app/assets/javascripts/polymer/src/lib/template/templatizer.html
|
158
|
-
- app/assets/javascripts/polymer/src/lib/template/x-array-selector.html
|
159
|
-
- app/assets/javascripts/polymer/src/lib/template/x-autobind.html
|
160
|
-
- app/assets/javascripts/polymer/src/lib/template/x-if.html
|
161
|
-
- app/assets/javascripts/polymer/src/lib/template/x-repeat.html
|
162
|
-
- app/assets/javascripts/polymer/src/lib/template/x-template.html
|
163
|
-
- app/assets/javascripts/polymer/src/lib/x-style.html
|
164
|
-
- app/assets/javascripts/polymer/src/micro/attributes.html
|
165
|
-
- app/assets/javascripts/polymer/src/micro/constructor.html
|
166
|
-
- app/assets/javascripts/polymer/src/micro/extends.html
|
167
|
-
- app/assets/javascripts/polymer/src/micro/mixins.html
|
168
|
-
- app/assets/javascripts/polymer/src/micro/properties.html
|
169
|
-
- app/assets/javascripts/polymer/src/micro/tag.html
|
170
|
-
- app/assets/javascripts/polymer/src/mini/ready.html
|
171
|
-
- app/assets/javascripts/polymer/src/mini/shadow.html
|
172
|
-
- app/assets/javascripts/polymer/src/mini/shady.html
|
173
|
-
- app/assets/javascripts/polymer/src/mini/template.html
|
174
|
-
- app/assets/javascripts/polymer/src/polymer-lib.html
|
175
|
-
- app/assets/javascripts/polymer/src/standard/annotations.html
|
176
|
-
- app/assets/javascripts/polymer/src/standard/configure.html
|
177
|
-
- app/assets/javascripts/polymer/src/standard/effects.html
|
178
|
-
- app/assets/javascripts/polymer/src/standard/events.html
|
179
|
-
- app/assets/javascripts/polymer/src/standard/notify-path.html
|
180
|
-
- app/assets/javascripts/polymer/src/standard/resolveUrl.html
|
181
|
-
- app/assets/javascripts/polymer/src/standard/styling.html
|
182
|
-
- app/assets/javascripts/polymer/src/standard/utils.html
|
183
|
-
- app/assets/javascripts/polymer/src/standard/x-styling.html
|
184
123
|
- app/assets/javascripts/webcomponentsjs/webcomponents-lite.js
|
124
|
+
- app/assets/javascripts/webcomponentsjs/webcomponents.js
|
185
125
|
- lib/generators/polymer/component/component_generator.rb
|
186
126
|
- lib/generators/polymer/component/templates/component.css.erb
|
187
127
|
- lib/generators/polymer/component/templates/component.html.erb
|
@@ -217,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
157
|
version: '0'
|
218
158
|
requirements: []
|
219
159
|
rubyforge_project:
|
220
|
-
rubygems_version: 2.
|
160
|
+
rubygems_version: 2.4.5
|
221
161
|
signing_key:
|
222
162
|
specification_version: 4
|
223
163
|
summary: Use of web components with polymer with rails
|
@@ -1,262 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
@license
|
3
|
-
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
4
|
-
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
5
|
-
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
6
|
-
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
7
|
-
Code distributed by Google as part of the polymer project is also
|
8
|
-
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
9
|
-
-->
|
10
|
-
<link rel="import" href="../module.html">
|
11
|
-
<link rel="import" href="../case-map.html">
|
12
|
-
|
13
|
-
<script>
|
14
|
-
/**
|
15
|
-
* Scans a template to produce an annotation list that that associates
|
16
|
-
* metadata culled from markup with tree locations
|
17
|
-
* metadata and information to associate the metadata with nodes in an instance.
|
18
|
-
*
|
19
|
-
* Supported expressions include:
|
20
|
-
*
|
21
|
-
* Double-mustache annotations in text content. The annotation must be the only
|
22
|
-
* content in the tag, compound expressions are not supported.
|
23
|
-
*
|
24
|
-
* <[tag]>{{annotation}}<[tag]>
|
25
|
-
*
|
26
|
-
* Double-escaped annotations in an attribute, either {{}} or [[]].
|
27
|
-
*
|
28
|
-
* <[tag] someAttribute="{{annotation}}" another="[[annotation]]"><[tag]>
|
29
|
-
*
|
30
|
-
* `on-` style event declarations.
|
31
|
-
*
|
32
|
-
* <[tag] on-<event-name>="annotation"><[tag]>
|
33
|
-
*
|
34
|
-
* Note that the `annotations` feature does not implement any behaviors
|
35
|
-
* associated with these expressions, it only captures the data.
|
36
|
-
*
|
37
|
-
* Generated data-structure:
|
38
|
-
*
|
39
|
-
* [
|
40
|
-
* {
|
41
|
-
* id: '<id>',
|
42
|
-
* events: [
|
43
|
-
* {
|
44
|
-
* name: '<name>'
|
45
|
-
* value: '<annotation>'
|
46
|
-
* }, ...
|
47
|
-
* ],
|
48
|
-
* bindings: [
|
49
|
-
* {
|
50
|
-
* kind: ['text'|'attribute'],
|
51
|
-
* mode: ['{'|'['],
|
52
|
-
* name: '<name>'
|
53
|
-
* value: '<annotation>'
|
54
|
-
* }, ...
|
55
|
-
* ],
|
56
|
-
* // TODO(sjmiles): this is annotation-parent, not node-parent
|
57
|
-
* parent: <reference to parent annotation object>,
|
58
|
-
* index: <integer index in parent's childNodes collection>
|
59
|
-
* },
|
60
|
-
* ...
|
61
|
-
* ]
|
62
|
-
*
|
63
|
-
* @class Template feature
|
64
|
-
*/
|
65
|
-
|
66
|
-
// null-array (shared empty array to avoid null-checks)
|
67
|
-
Polymer.nar = [];
|
68
|
-
|
69
|
-
Polymer.Annotations = {
|
70
|
-
|
71
|
-
// preprocess-time
|
72
|
-
|
73
|
-
// construct and return a list of annotation records
|
74
|
-
// by scanning `template`'s content
|
75
|
-
//
|
76
|
-
parseAnnotations: function(template) {
|
77
|
-
var list = [];
|
78
|
-
var content = template._content || template.content;
|
79
|
-
this._parseNodeAnnotations(content, list);
|
80
|
-
return list;
|
81
|
-
},
|
82
|
-
|
83
|
-
// add annotations gleaned from subtree at `node` to `list`
|
84
|
-
_parseNodeAnnotations: function(node, list) {
|
85
|
-
return node.nodeType === Node.TEXT_NODE ?
|
86
|
-
this._parseTextNodeAnnotation(node, list) :
|
87
|
-
// TODO(sjmiles): are there other nodes we may encounter
|
88
|
-
// that are not TEXT_NODE but also not ELEMENT?
|
89
|
-
this._parseElementAnnotations(node, list);
|
90
|
-
},
|
91
|
-
|
92
|
-
// add annotations gleaned from TextNode `node` to `list`
|
93
|
-
_parseTextNodeAnnotation: function(node, list) {
|
94
|
-
var v = node.textContent, escape = v.slice(0, 2);
|
95
|
-
if (escape === '{{' || escape === '[[') {
|
96
|
-
// NOTE: use a space here so the textNode remains; some browsers
|
97
|
-
// (IE) evacipate an empty textNode.
|
98
|
-
node.textContent = ' ';
|
99
|
-
var annote = {
|
100
|
-
bindings: [{
|
101
|
-
kind: 'text',
|
102
|
-
mode: escape[0],
|
103
|
-
value: v.slice(2, -2)
|
104
|
-
}]
|
105
|
-
};
|
106
|
-
list.push(annote);
|
107
|
-
return annote;
|
108
|
-
}
|
109
|
-
},
|
110
|
-
|
111
|
-
// add annotations gleaned from Element `node` to `list`
|
112
|
-
_parseElementAnnotations: function(element, list) {
|
113
|
-
var annote = {
|
114
|
-
bindings: [],
|
115
|
-
events: []
|
116
|
-
};
|
117
|
-
this._parseChildNodesAnnotations(element, annote, list);
|
118
|
-
// TODO(sjmiles): is this for non-ELEMENT nodes? If so, we should
|
119
|
-
// change the contract of this method, or filter these out above.
|
120
|
-
if (element.attributes) {
|
121
|
-
this._parseNodeAttributeAnnotations(element, annote, list);
|
122
|
-
// TODO(sorvell): ad hoc callback for doing work on elements while
|
123
|
-
// leveraging annotator's tree walk.
|
124
|
-
// Consider adding an node callback registry and moving specific
|
125
|
-
// processing out of this module.
|
126
|
-
if (this.prepElement) {
|
127
|
-
this.prepElement(element);
|
128
|
-
}
|
129
|
-
}
|
130
|
-
if (annote.bindings.length || annote.events.length || annote.id) {
|
131
|
-
list.push(annote);
|
132
|
-
}
|
133
|
-
return annote;
|
134
|
-
},
|
135
|
-
|
136
|
-
// add annotations gleaned from children of `root` to `list`, `root`'s
|
137
|
-
// `annote` is supplied as it is the annote.parent of added annotations
|
138
|
-
_parseChildNodesAnnotations: function(root, annote, list, callback) {
|
139
|
-
if (root.firstChild) {
|
140
|
-
for (var i=0, node=root.firstChild; node; node=node.nextSibling, i++){
|
141
|
-
if (node.localName === 'template') {
|
142
|
-
// TODO(sjmiles): simply altering the .content reference didn't
|
143
|
-
// work (there was some confusion, might need verification)
|
144
|
-
var content = document.createDocumentFragment();
|
145
|
-
content.appendChild(node.content);
|
146
|
-
// TODO(sjmiles): using `nar` to avoid unnecessary allocation;
|
147
|
-
// in general the handling of these arrays needs some cleanup
|
148
|
-
// in this module
|
149
|
-
list.push({
|
150
|
-
bindings: Polymer.nar,
|
151
|
-
events: Polymer.nar,
|
152
|
-
templateContent: content,
|
153
|
-
parent: annote,
|
154
|
-
index: i
|
155
|
-
});
|
156
|
-
}
|
157
|
-
//
|
158
|
-
var childAnnotation = this._parseNodeAnnotations(node, list, callback);
|
159
|
-
if (childAnnotation) {
|
160
|
-
childAnnotation.parent = annote;
|
161
|
-
childAnnotation.index = i;
|
162
|
-
}
|
163
|
-
}
|
164
|
-
}
|
165
|
-
},
|
166
|
-
|
167
|
-
// add annotation data from attributes to the `annotation` for node `node`
|
168
|
-
// TODO(sjmiles): the distinction between an `annotation` and
|
169
|
-
// `annotation data` is not as clear as it could be
|
170
|
-
// Walk attributes backwards, since removeAttribute can be vetoed by
|
171
|
-
// IE in certain cases (e.g. <input value="foo">), resulting in the
|
172
|
-
// attribute staying in the attributes list
|
173
|
-
_parseNodeAttributeAnnotations: function(node, annotation) {
|
174
|
-
for (var i=node.attributes.length-1, a; (a=node.attributes[i]); i--) {
|
175
|
-
var n = a.name, v = a.value;
|
176
|
-
// id
|
177
|
-
if (n === 'id') {
|
178
|
-
annotation.id = v;
|
179
|
-
}
|
180
|
-
// events (on-*)
|
181
|
-
else if (n.slice(0, 3) === 'on-') {
|
182
|
-
node.removeAttribute(n);
|
183
|
-
annotation.events.push({
|
184
|
-
name: n.slice(3),
|
185
|
-
value: v
|
186
|
-
});
|
187
|
-
}
|
188
|
-
// bindings (other attributes)
|
189
|
-
else {
|
190
|
-
var b = this._parseNodeAttributeAnnotation(node, n, v);
|
191
|
-
if (b) {
|
192
|
-
annotation.bindings.push(b);
|
193
|
-
}
|
194
|
-
}
|
195
|
-
}
|
196
|
-
},
|
197
|
-
|
198
|
-
// construct annotation data from a generic attribute, or undefined
|
199
|
-
_parseNodeAttributeAnnotation: function(node, n, v) {
|
200
|
-
var mode = '', escape = v.slice(0, 2), name = n;
|
201
|
-
if (escape === '{{' || escape === '[[') {
|
202
|
-
// Mode (one-way or two)
|
203
|
-
mode = escape[0];
|
204
|
-
v = v.slice(2, -2);
|
205
|
-
// Negate
|
206
|
-
var not = false;
|
207
|
-
if (v[0] == '!') {
|
208
|
-
v = v.substring(1);
|
209
|
-
not = true;
|
210
|
-
}
|
211
|
-
// Attribute or property
|
212
|
-
var kind = 'property';
|
213
|
-
if (n[n.length-1] == '$') {
|
214
|
-
name = n.slice(0, -1);
|
215
|
-
kind = 'attribute';
|
216
|
-
}
|
217
|
-
// Custom notification event
|
218
|
-
var notifyEvent, colon;
|
219
|
-
if (mode == '{' && (colon = v.indexOf('::')) > 0) {
|
220
|
-
notifyEvent = v.substring(colon + 2);
|
221
|
-
v = v.substring(0, colon);
|
222
|
-
}
|
223
|
-
// Remove annotation
|
224
|
-
node.removeAttribute(n);
|
225
|
-
// Case hackery: attributes are lower-case, but bind targets
|
226
|
-
// (properties) are case sensitive. Gambit is to map dash-case to
|
227
|
-
// camel-case: `foo-bar` becomes `fooBar`.
|
228
|
-
// Attribute bindings are excepted.
|
229
|
-
if (kind === 'property') {
|
230
|
-
name = Polymer.CaseMap.dashToCamelCase(name);
|
231
|
-
}
|
232
|
-
return {
|
233
|
-
kind: kind,
|
234
|
-
mode: mode,
|
235
|
-
name: name,
|
236
|
-
value: v,
|
237
|
-
negate: not,
|
238
|
-
event: notifyEvent
|
239
|
-
};
|
240
|
-
}
|
241
|
-
},
|
242
|
-
|
243
|
-
// instance-time
|
244
|
-
|
245
|
-
_localSubTree: function(node, host) {
|
246
|
-
return (node === host) ? node.childNodes :
|
247
|
-
(node.lightChildren || node.childNodes);
|
248
|
-
},
|
249
|
-
|
250
|
-
findAnnotatedNode: function(root, annote) {
|
251
|
-
// recursively ascend tree until we hit root
|
252
|
-
var parent = annote.parent &&
|
253
|
-
Polymer.Annotations.findAnnotatedNode(root, annote.parent);
|
254
|
-
// unwind the stack, returning the indexed node at each level
|
255
|
-
return !parent ? root :
|
256
|
-
Polymer.Annotations._localSubTree(parent, root)[annote.index];
|
257
|
-
}
|
258
|
-
|
259
|
-
};
|
260
|
-
|
261
|
-
|
262
|
-
</script>
|
@@ -1,60 +0,0 @@
|
|
1
|
-
<!doctype html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
|
5
|
-
<script src="../../../../perf-lib/perf.js"></script>
|
6
|
-
|
7
|
-
<title>Template Test</title>
|
8
|
-
|
9
|
-
<meta charset="utf-8">
|
10
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
11
|
-
|
12
|
-
<link rel="import" href="../../lang.html">
|
13
|
-
<link rel="import" href="../../module.html">
|
14
|
-
|
15
|
-
<link rel="import" href="../annotations.html">
|
16
|
-
|
17
|
-
<style>
|
18
|
-
pre {
|
19
|
-
font-family: monospace;
|
20
|
-
font-size: 11px;
|
21
|
-
}
|
22
|
-
</style>
|
23
|
-
|
24
|
-
</head>
|
25
|
-
<body>
|
26
|
-
|
27
|
-
<script>console.perf();</script>
|
28
|
-
|
29
|
-
<template>
|
30
|
-
|
31
|
-
<span id="foo" attribute="{{path}}" oneway="[[otherpath]]" style:="{{specialStyle}}">{{text}}</span>
|
32
|
-
|
33
|
-
</template>
|
34
|
-
|
35
|
-
<pre></pre>
|
36
|
-
|
37
|
-
<script>
|
38
|
-
|
39
|
-
using('Annotations', function(Annotations) {
|
40
|
-
|
41
|
-
var template = document.querySelector('template');
|
42
|
-
var list = Annotations.parseAnnotations(template);
|
43
|
-
console.log(list);
|
44
|
-
|
45
|
-
var out = document.querySelector('pre');
|
46
|
-
out.textContent = JSON.stringify(list, function(key, value) {
|
47
|
-
if (key === 'parent') {
|
48
|
-
return '<parent reference>';
|
49
|
-
}
|
50
|
-
return value;
|
51
|
-
}, ' ');
|
52
|
-
|
53
|
-
});
|
54
|
-
|
55
|
-
</script>
|
56
|
-
|
57
|
-
<script>console.perfEnd();</script>
|
58
|
-
|
59
|
-
</body>
|
60
|
-
</html>
|
@@ -1,118 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
@license
|
3
|
-
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
4
|
-
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
5
|
-
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
6
|
-
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
7
|
-
Code distributed by Google as part of the polymer project is also
|
8
|
-
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
9
|
-
-->
|
10
|
-
<link rel="import" href="debounce.html">
|
11
|
-
|
12
|
-
<script>
|
13
|
-
|
14
|
-
(function() {
|
15
|
-
|
16
|
-
var callbacks = new WeakMap();
|
17
|
-
|
18
|
-
function observe(array, cb) {
|
19
|
-
if (Array.observe) {
|
20
|
-
var ncb = function(changes) {
|
21
|
-
changes = changes.filter(function(o) { return o.type == 'splice'; });
|
22
|
-
if (changes.length) {
|
23
|
-
cb(changes);
|
24
|
-
}
|
25
|
-
};
|
26
|
-
callbacks.set(cb, ncb);
|
27
|
-
Array.observe(array, ncb);
|
28
|
-
} else {
|
29
|
-
if (!array.__polymerObservable) {
|
30
|
-
makeObservable(array);
|
31
|
-
}
|
32
|
-
callbacks.get(array).push(cb);
|
33
|
-
}
|
34
|
-
}
|
35
|
-
|
36
|
-
function unobserve(array, cb) {
|
37
|
-
if (Array.observe) {
|
38
|
-
var ncb = callbacks.get(cb);
|
39
|
-
callbacks.delete(cb);
|
40
|
-
Array.unobserve(array, ncb);
|
41
|
-
} else {
|
42
|
-
var cbs = callbacks.get(array);
|
43
|
-
var idx = cbs.indexOf(cb);
|
44
|
-
if (idx >= 0) {
|
45
|
-
cbs.splice(idx, 1);
|
46
|
-
}
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
function makeObservable(array) {
|
51
|
-
var splices = [];
|
52
|
-
var debounce;
|
53
|
-
var orig = {
|
54
|
-
push: array.push,
|
55
|
-
pop: array.pop,
|
56
|
-
splice: array.splice,
|
57
|
-
shift: array.shift,
|
58
|
-
unshift: array.unshift,
|
59
|
-
sort: array.sort
|
60
|
-
};
|
61
|
-
var addSplice = function(index, added, removed) {
|
62
|
-
splices.push({
|
63
|
-
index: index,
|
64
|
-
addedCount: added,
|
65
|
-
removed: removed,
|
66
|
-
object: array,
|
67
|
-
type: 'splice'
|
68
|
-
});
|
69
|
-
};
|
70
|
-
callbacks.set(array, []);
|
71
|
-
array.push = function() {
|
72
|
-
debounce = Polymer.Debounce(debounce, fin);
|
73
|
-
addSplice(array.length, 1, []);
|
74
|
-
return orig.push.apply(this, arguments);
|
75
|
-
};
|
76
|
-
array.pop = function() {
|
77
|
-
debounce = Polymer.Debounce(debounce, fin);
|
78
|
-
addSplice(array.length - 1, 0, array.slice(-1));
|
79
|
-
return orig.pop.apply(this, arguments);
|
80
|
-
};
|
81
|
-
array.splice = function(start, deleteCount) {
|
82
|
-
debounce = Polymer.Debounce(debounce, fin);
|
83
|
-
addSplice(start, arguments.length - 2, array.slice(start, start + deleteCount));
|
84
|
-
return orig.splice.apply(this, arguments);
|
85
|
-
};
|
86
|
-
array.shift = function() {
|
87
|
-
debounce = Polymer.Debounce(debounce, fin);
|
88
|
-
addSplice(0, 0, [array[0]]);
|
89
|
-
return orig.shift.apply(this, arguments);
|
90
|
-
};
|
91
|
-
array.unshift = function() {
|
92
|
-
debounce = Polymer.Debounce(debounce, fin);
|
93
|
-
addSplice(0, 1, []);
|
94
|
-
return orig.unshift.apply(this, arguments);
|
95
|
-
};
|
96
|
-
array.sort = function() {
|
97
|
-
debounce = Polymer.Debounce(debounce, fin);
|
98
|
-
console.warn('[ArrayObserve]: sort not observable');
|
99
|
-
return orig.sort.apply(this, arguments);
|
100
|
-
};
|
101
|
-
var fin = function() {
|
102
|
-
var cbs = callbacks.get(array);
|
103
|
-
for (var i=0; i<cbs.length; i++) {
|
104
|
-
cbs[i](splices);
|
105
|
-
}
|
106
|
-
splices = [];
|
107
|
-
};
|
108
|
-
array.__polymerObservable = true;
|
109
|
-
}
|
110
|
-
|
111
|
-
Polymer.ArrayObserve = {
|
112
|
-
observe: observe,
|
113
|
-
unobserve: unobserve
|
114
|
-
};
|
115
|
-
|
116
|
-
})();
|
117
|
-
|
118
|
-
</script>
|