@avs/go-react 0.12.71731 → 0.13.71740
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/demo/node_modules/.vite/deps/@polymer_iron-resizable-behavior_iron-resizable-behavior__js.js +2321 -0
- package/demo/node_modules/.vite/deps/@polymer_iron-resizable-behavior_iron-resizable-behavior__js.js.map +7 -0
- package/demo/node_modules/.vite/deps/@polymer_polymer_lib_legacy_class__js.js +13 -0
- package/demo/node_modules/.vite/deps/@polymer_polymer_lib_legacy_class__js.js.map +7 -0
- package/demo/node_modules/.vite/deps/@polymer_polymer_lib_utils_mixin__js.js +8 -0
- package/demo/node_modules/.vite/deps/@polymer_polymer_lib_utils_mixin__js.js.map +7 -0
- package/demo/node_modules/.vite/deps/@polymer_polymer_lib_utils_render-status__js.js +12 -0
- package/demo/node_modules/.vite/deps/@polymer_polymer_lib_utils_render-status__js.js.map +7 -0
- package/demo/node_modules/.vite/deps/@polymer_polymer_polymer-element__js.js +15 -0
- package/demo/node_modules/.vite/deps/@polymer_polymer_polymer-element__js.js.map +7 -0
- package/demo/node_modules/.vite/deps/_metadata.json +103 -0
- package/demo/node_modules/.vite/deps/chunk-6HI7N2AN.js +267 -0
- package/demo/node_modules/.vite/deps/chunk-6HI7N2AN.js.map +7 -0
- package/demo/node_modules/.vite/deps/chunk-BHAOVVTR.js +4597 -0
- package/demo/node_modules/.vite/deps/chunk-BHAOVVTR.js.map +7 -0
- package/demo/node_modules/.vite/deps/chunk-BSA4YZO6.js +83 -0
- package/demo/node_modules/.vite/deps/chunk-BSA4YZO6.js.map +7 -0
- package/demo/node_modules/.vite/deps/chunk-BUSYA2B4.js +8 -0
- package/demo/node_modules/.vite/deps/chunk-BUSYA2B4.js.map +7 -0
- package/demo/node_modules/.vite/deps/chunk-CWUEONQP.js +991 -0
- package/demo/node_modules/.vite/deps/chunk-CWUEONQP.js.map +7 -0
- package/demo/node_modules/.vite/deps/chunk-I2HDYNON.js +46 -0
- package/demo/node_modules/.vite/deps/chunk-I2HDYNON.js.map +7 -0
- package/demo/node_modules/.vite/deps/chunk-MXBCLPIN.js +5 -0
- package/demo/node_modules/.vite/deps/chunk-MXBCLPIN.js.map +7 -0
- package/demo/node_modules/.vite/deps/chunk-PRUGAEYJ.js +4871 -0
- package/demo/node_modules/.vite/deps/chunk-PRUGAEYJ.js.map +7 -0
- package/demo/node_modules/.vite/deps/chunk-QQPVW2K2.js +62 -0
- package/demo/node_modules/.vite/deps/chunk-QQPVW2K2.js.map +7 -0
- package/demo/node_modules/.vite/deps/package.json +3 -0
- package/demo/node_modules/.vite/deps/react-dom.js +6 -0
- package/demo/node_modules/.vite/deps/react-dom.js.map +7 -0
- package/demo/node_modules/.vite/deps/react-dom_client.js +20193 -0
- package/demo/node_modules/.vite/deps/react-dom_client.js.map +7 -0
- package/demo/node_modules/.vite/deps/react.js +5 -0
- package/demo/node_modules/.vite/deps/react.js.map +7 -0
- package/demo/node_modules/.vite/deps/react_jsx-dev-runtime.js +265 -0
- package/demo/node_modules/.vite/deps/react_jsx-dev-runtime.js.map +7 -0
- package/demo/node_modules/.vite/deps/react_jsx-runtime.js +276 -0
- package/demo/node_modules/.vite/deps/react_jsx-runtime.js.map +7 -0
- package/demo/node_modules/.vite/deps/three.js +41878 -0
- package/demo/node_modules/.vite/deps/three.js.map +7 -0
- package/demo/public/hydrogen.json +1 -1
- package/demo/src/App.tsx +17 -17
- package/package.json +3 -3
- package/src/AvsGoDataViz.jsx +2 -0
package/demo/node_modules/.vite/deps/@polymer_iron-resizable-behavior_iron-resizable-behavior__js.js
ADDED
|
@@ -0,0 +1,2321 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PolymerElement
|
|
3
|
+
} from "./chunk-BSA4YZO6.js";
|
|
4
|
+
import {
|
|
5
|
+
Class,
|
|
6
|
+
CustomStyleInterface,
|
|
7
|
+
Debouncer,
|
|
8
|
+
GestureEventListeners,
|
|
9
|
+
LegacyElementMixin,
|
|
10
|
+
calculateSplices,
|
|
11
|
+
cssBuild,
|
|
12
|
+
disableRuntime,
|
|
13
|
+
dom,
|
|
14
|
+
enqueueDebouncer,
|
|
15
|
+
flush,
|
|
16
|
+
getComputedStyleValue,
|
|
17
|
+
nativeCssVariables,
|
|
18
|
+
nativeShadow,
|
|
19
|
+
updateNativeProperties
|
|
20
|
+
} from "./chunk-BHAOVVTR.js";
|
|
21
|
+
import "./chunk-QQPVW2K2.js";
|
|
22
|
+
import {
|
|
23
|
+
ElementMixin,
|
|
24
|
+
PropertyEffects,
|
|
25
|
+
cssFromModules,
|
|
26
|
+
fastDomIf,
|
|
27
|
+
legacyOptimizations,
|
|
28
|
+
legacyWarnings,
|
|
29
|
+
matches,
|
|
30
|
+
microTask,
|
|
31
|
+
root,
|
|
32
|
+
strictTemplatePolicy,
|
|
33
|
+
suppressTemplateNotifications,
|
|
34
|
+
timeOut,
|
|
35
|
+
translate,
|
|
36
|
+
useShadow,
|
|
37
|
+
wrap
|
|
38
|
+
} from "./chunk-PRUGAEYJ.js";
|
|
39
|
+
import {
|
|
40
|
+
dedupingMixin
|
|
41
|
+
} from "./chunk-I2HDYNON.js";
|
|
42
|
+
import "./chunk-MXBCLPIN.js";
|
|
43
|
+
import "./chunk-BUSYA2B4.js";
|
|
44
|
+
|
|
45
|
+
// ../../../node_modules/@polymer/polymer/lib/legacy/polymer-fn.js
|
|
46
|
+
var Polymer = function(info) {
|
|
47
|
+
let klass;
|
|
48
|
+
if (typeof info === "function") {
|
|
49
|
+
klass = info;
|
|
50
|
+
} else {
|
|
51
|
+
klass = Polymer.Class(info);
|
|
52
|
+
}
|
|
53
|
+
if (info._legacyForceObservedAttributes) {
|
|
54
|
+
klass.prototype._legacyForceObservedAttributes = info._legacyForceObservedAttributes;
|
|
55
|
+
}
|
|
56
|
+
customElements.define(
|
|
57
|
+
klass.is,
|
|
58
|
+
/** @type {!HTMLElement} */
|
|
59
|
+
klass
|
|
60
|
+
);
|
|
61
|
+
return klass;
|
|
62
|
+
};
|
|
63
|
+
Polymer.Class = Class;
|
|
64
|
+
|
|
65
|
+
// ../../../node_modules/@polymer/polymer/lib/mixins/mutable-data.js
|
|
66
|
+
function mutablePropertyChange(inst, property, value, old, mutableData) {
|
|
67
|
+
let isObject;
|
|
68
|
+
if (mutableData) {
|
|
69
|
+
isObject = typeof value === "object" && value !== null;
|
|
70
|
+
if (isObject) {
|
|
71
|
+
old = inst.__dataTemp[property];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
let shouldChange = old !== value && (old === old || value === value);
|
|
75
|
+
if (isObject && shouldChange) {
|
|
76
|
+
inst.__dataTemp[property] = value;
|
|
77
|
+
}
|
|
78
|
+
return shouldChange;
|
|
79
|
+
}
|
|
80
|
+
var MutableData = dedupingMixin((superClass) => {
|
|
81
|
+
class MutableData2 extends superClass {
|
|
82
|
+
/**
|
|
83
|
+
* Overrides `PropertyEffects` to provide option for skipping
|
|
84
|
+
* strict equality checking for Objects and Arrays.
|
|
85
|
+
*
|
|
86
|
+
* This method pulls the value to dirty check against from the `__dataTemp`
|
|
87
|
+
* cache (rather than the normal `__data` cache) for Objects. Since the temp
|
|
88
|
+
* cache is cleared at the end of a turn, this implementation allows
|
|
89
|
+
* side-effects of deep object changes to be processed by re-setting the
|
|
90
|
+
* same object (using the temp cache as an in-turn backstop to prevent
|
|
91
|
+
* cycles due to 2-way notification).
|
|
92
|
+
*
|
|
93
|
+
* @param {string} property Property name
|
|
94
|
+
* @param {*} value New property value
|
|
95
|
+
* @param {*} old Previous property value
|
|
96
|
+
* @return {boolean} Whether the property should be considered a change
|
|
97
|
+
* @protected
|
|
98
|
+
*/
|
|
99
|
+
_shouldPropertyChange(property, value, old) {
|
|
100
|
+
return mutablePropertyChange(this, property, value, old, true);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return MutableData2;
|
|
104
|
+
});
|
|
105
|
+
var OptionalMutableData = dedupingMixin((superClass) => {
|
|
106
|
+
class OptionalMutableData2 extends superClass {
|
|
107
|
+
/** @nocollapse */
|
|
108
|
+
static get properties() {
|
|
109
|
+
return {
|
|
110
|
+
/**
|
|
111
|
+
* Instance-level flag for configuring the dirty-checking strategy
|
|
112
|
+
* for this element. When true, Objects and Arrays will skip dirty
|
|
113
|
+
* checking, otherwise strict equality checking will be used.
|
|
114
|
+
*/
|
|
115
|
+
mutableData: Boolean
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Overrides `PropertyEffects` to provide option for skipping
|
|
120
|
+
* strict equality checking for Objects and Arrays.
|
|
121
|
+
*
|
|
122
|
+
* When `this.mutableData` is true on this instance, this method
|
|
123
|
+
* pulls the value to dirty check against from the `__dataTemp` cache
|
|
124
|
+
* (rather than the normal `__data` cache) for Objects. Since the temp
|
|
125
|
+
* cache is cleared at the end of a turn, this implementation allows
|
|
126
|
+
* side-effects of deep object changes to be processed by re-setting the
|
|
127
|
+
* same object (using the temp cache as an in-turn backstop to prevent
|
|
128
|
+
* cycles due to 2-way notification).
|
|
129
|
+
*
|
|
130
|
+
* @param {string} property Property name
|
|
131
|
+
* @param {*} value New property value
|
|
132
|
+
* @param {*} old Previous property value
|
|
133
|
+
* @return {boolean} Whether the property should be considered a change
|
|
134
|
+
* @protected
|
|
135
|
+
*/
|
|
136
|
+
_shouldPropertyChange(property, value, old) {
|
|
137
|
+
return mutablePropertyChange(this, property, value, old, this.mutableData);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return OptionalMutableData2;
|
|
141
|
+
});
|
|
142
|
+
MutableData._mutablePropertyChange = mutablePropertyChange;
|
|
143
|
+
|
|
144
|
+
// ../../../node_modules/@polymer/polymer/lib/utils/templatize.js
|
|
145
|
+
var newInstance = null;
|
|
146
|
+
function HTMLTemplateElementExtension() {
|
|
147
|
+
return newInstance;
|
|
148
|
+
}
|
|
149
|
+
HTMLTemplateElementExtension.prototype = Object.create(HTMLTemplateElement.prototype, {
|
|
150
|
+
constructor: {
|
|
151
|
+
value: HTMLTemplateElementExtension,
|
|
152
|
+
writable: true
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
var DataTemplate = PropertyEffects(HTMLTemplateElementExtension);
|
|
156
|
+
var MutableDataTemplate = MutableData(DataTemplate);
|
|
157
|
+
function upgradeTemplate(template, constructor) {
|
|
158
|
+
newInstance = template;
|
|
159
|
+
Object.setPrototypeOf(template, constructor.prototype);
|
|
160
|
+
new constructor();
|
|
161
|
+
newInstance = null;
|
|
162
|
+
}
|
|
163
|
+
var templateInstanceBase = PropertyEffects(class {
|
|
164
|
+
});
|
|
165
|
+
function showHideChildren(hide, children) {
|
|
166
|
+
for (let i = 0; i < children.length; i++) {
|
|
167
|
+
let n = children[i];
|
|
168
|
+
if (Boolean(hide) != Boolean(n.__hideTemplateChildren__)) {
|
|
169
|
+
if (n.nodeType === Node.TEXT_NODE) {
|
|
170
|
+
if (hide) {
|
|
171
|
+
n.__polymerTextContent__ = n.textContent;
|
|
172
|
+
n.textContent = "";
|
|
173
|
+
} else {
|
|
174
|
+
n.textContent = n.__polymerTextContent__;
|
|
175
|
+
}
|
|
176
|
+
} else if (n.localName === "slot") {
|
|
177
|
+
if (hide) {
|
|
178
|
+
n.__polymerReplaced__ = document.createComment("hidden-slot");
|
|
179
|
+
wrap(wrap(n).parentNode).replaceChild(n.__polymerReplaced__, n);
|
|
180
|
+
} else {
|
|
181
|
+
const replace = n.__polymerReplaced__;
|
|
182
|
+
if (replace) {
|
|
183
|
+
wrap(wrap(replace).parentNode).replaceChild(n, replace);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
} else if (n.style) {
|
|
187
|
+
if (hide) {
|
|
188
|
+
n.__polymerDisplay__ = n.style.display;
|
|
189
|
+
n.style.display = "none";
|
|
190
|
+
} else {
|
|
191
|
+
n.style.display = n.__polymerDisplay__;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
n.__hideTemplateChildren__ = hide;
|
|
196
|
+
if (n._showHideChildren) {
|
|
197
|
+
n._showHideChildren(hide);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
var TemplateInstanceBase = class extends templateInstanceBase {
|
|
202
|
+
constructor(props) {
|
|
203
|
+
super();
|
|
204
|
+
this._configureProperties(props);
|
|
205
|
+
this.root = this._stampTemplate(this.__dataHost);
|
|
206
|
+
let children = [];
|
|
207
|
+
this.children = /** @type {!NodeList} */
|
|
208
|
+
children;
|
|
209
|
+
for (let n = this.root.firstChild; n; n = n.nextSibling) {
|
|
210
|
+
children.push(n);
|
|
211
|
+
n.__templatizeInstance = this;
|
|
212
|
+
}
|
|
213
|
+
if (this.__templatizeOwner && this.__templatizeOwner.__hideTemplateChildren__) {
|
|
214
|
+
this._showHideChildren(true);
|
|
215
|
+
}
|
|
216
|
+
let options = this.__templatizeOptions;
|
|
217
|
+
if (props && options.instanceProps || !options.instanceProps) {
|
|
218
|
+
this._enableProperties();
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Configure the given `props` by calling `_setPendingProperty`. Also
|
|
223
|
+
* sets any properties stored in `__hostProps`.
|
|
224
|
+
* @private
|
|
225
|
+
* @param {Object} props Object of property name-value pairs to set.
|
|
226
|
+
* @return {void}
|
|
227
|
+
*/
|
|
228
|
+
_configureProperties(props) {
|
|
229
|
+
let options = this.__templatizeOptions;
|
|
230
|
+
if (options.forwardHostProp) {
|
|
231
|
+
for (let hprop in this.__hostProps) {
|
|
232
|
+
this._setPendingProperty(hprop, this.__dataHost["_host_" + hprop]);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
for (let iprop in props) {
|
|
236
|
+
this._setPendingProperty(iprop, props[iprop]);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Forwards a host property to this instance. This method should be
|
|
241
|
+
* called on instances from the `options.forwardHostProp` callback
|
|
242
|
+
* to propagate changes of host properties to each instance.
|
|
243
|
+
*
|
|
244
|
+
* Note this method enqueues the change, which are flushed as a batch.
|
|
245
|
+
*
|
|
246
|
+
* @param {string} prop Property or path name
|
|
247
|
+
* @param {*} value Value of the property to forward
|
|
248
|
+
* @return {void}
|
|
249
|
+
*/
|
|
250
|
+
forwardHostProp(prop, value) {
|
|
251
|
+
if (this._setPendingPropertyOrPath(prop, value, false, true)) {
|
|
252
|
+
this.__dataHost._enqueueClient(this);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Override point for adding custom or simulated event handling.
|
|
257
|
+
*
|
|
258
|
+
* @override
|
|
259
|
+
* @param {!Node} node Node to add event listener to
|
|
260
|
+
* @param {string} eventName Name of event
|
|
261
|
+
* @param {function(!Event):void} handler Listener function to add
|
|
262
|
+
* @return {void}
|
|
263
|
+
*/
|
|
264
|
+
_addEventListenerToNode(node, eventName, handler) {
|
|
265
|
+
if (this._methodHost && this.__templatizeOptions.parentModel) {
|
|
266
|
+
this._methodHost._addEventListenerToNode(node, eventName, (e) => {
|
|
267
|
+
e.model = this;
|
|
268
|
+
handler(e);
|
|
269
|
+
});
|
|
270
|
+
} else {
|
|
271
|
+
let templateHost = this.__dataHost.__dataHost;
|
|
272
|
+
if (templateHost) {
|
|
273
|
+
templateHost._addEventListenerToNode(node, eventName, handler);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Shows or hides the template instance top level child elements. For
|
|
279
|
+
* text nodes, `textContent` is removed while "hidden" and replaced when
|
|
280
|
+
* "shown."
|
|
281
|
+
* @param {boolean} hide Set to true to hide the children;
|
|
282
|
+
* set to false to show them.
|
|
283
|
+
* @return {void}
|
|
284
|
+
* @protected
|
|
285
|
+
*/
|
|
286
|
+
_showHideChildren(hide) {
|
|
287
|
+
showHideChildren(hide, this.children);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Overrides default property-effects implementation to intercept
|
|
291
|
+
* textContent bindings while children are "hidden" and cache in
|
|
292
|
+
* private storage for later retrieval.
|
|
293
|
+
*
|
|
294
|
+
* @override
|
|
295
|
+
* @param {!Node} node The node to set a property on
|
|
296
|
+
* @param {string} prop The property to set
|
|
297
|
+
* @param {*} value The value to set
|
|
298
|
+
* @return {void}
|
|
299
|
+
* @protected
|
|
300
|
+
*/
|
|
301
|
+
_setUnmanagedPropertyToNode(node, prop, value) {
|
|
302
|
+
if (node.__hideTemplateChildren__ && node.nodeType == Node.TEXT_NODE && prop == "textContent") {
|
|
303
|
+
node.__polymerTextContent__ = value;
|
|
304
|
+
} else {
|
|
305
|
+
super._setUnmanagedPropertyToNode(node, prop, value);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Find the parent model of this template instance. The parent model
|
|
310
|
+
* is either another templatize instance that had option `parentModel: true`,
|
|
311
|
+
* or else the host element.
|
|
312
|
+
*
|
|
313
|
+
* @return {!Polymer_PropertyEffects} The parent model of this instance
|
|
314
|
+
*/
|
|
315
|
+
get parentModel() {
|
|
316
|
+
let model = this.__parentModel;
|
|
317
|
+
if (!model) {
|
|
318
|
+
let options;
|
|
319
|
+
model = this;
|
|
320
|
+
do {
|
|
321
|
+
model = model.__dataHost.__dataHost;
|
|
322
|
+
} while ((options = model.__templatizeOptions) && !options.parentModel);
|
|
323
|
+
this.__parentModel = model;
|
|
324
|
+
}
|
|
325
|
+
return model;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Stub of HTMLElement's `dispatchEvent`, so that effects that may
|
|
329
|
+
* dispatch events safely no-op.
|
|
330
|
+
*
|
|
331
|
+
* @param {Event} event Event to dispatch
|
|
332
|
+
* @return {boolean} Always true.
|
|
333
|
+
* @override
|
|
334
|
+
*/
|
|
335
|
+
dispatchEvent(event) {
|
|
336
|
+
return true;
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
TemplateInstanceBase.prototype.__dataHost;
|
|
340
|
+
TemplateInstanceBase.prototype.__templatizeOptions;
|
|
341
|
+
TemplateInstanceBase.prototype._methodHost;
|
|
342
|
+
TemplateInstanceBase.prototype.__templatizeOwner;
|
|
343
|
+
TemplateInstanceBase.prototype.__hostProps;
|
|
344
|
+
var MutableTemplateInstanceBase = MutableData(
|
|
345
|
+
// This cast shouldn't be neccessary, but Closure doesn't understand that
|
|
346
|
+
// TemplateInstanceBase is a constructor function.
|
|
347
|
+
/** @type {function(new:TemplateInstanceBase)} */
|
|
348
|
+
TemplateInstanceBase
|
|
349
|
+
);
|
|
350
|
+
function findMethodHost(template) {
|
|
351
|
+
let templateHost = template.__dataHost;
|
|
352
|
+
return templateHost && templateHost._methodHost || templateHost;
|
|
353
|
+
}
|
|
354
|
+
function createTemplatizerClass(template, templateInfo, options) {
|
|
355
|
+
let templatizerBase = options.mutableData ? MutableTemplateInstanceBase : TemplateInstanceBase;
|
|
356
|
+
if (templatize.mixin) {
|
|
357
|
+
templatizerBase = templatize.mixin(templatizerBase);
|
|
358
|
+
}
|
|
359
|
+
let klass = class extends templatizerBase {
|
|
360
|
+
};
|
|
361
|
+
klass.prototype.__templatizeOptions = options;
|
|
362
|
+
klass.prototype._bindTemplate(template);
|
|
363
|
+
addNotifyEffects(klass, template, templateInfo, options);
|
|
364
|
+
return klass;
|
|
365
|
+
}
|
|
366
|
+
function addPropagateEffects(target, templateInfo, options, methodHost) {
|
|
367
|
+
let userForwardHostProp = options.forwardHostProp;
|
|
368
|
+
if (userForwardHostProp && templateInfo.hasHostProps) {
|
|
369
|
+
const isTemplate = target.localName == "template";
|
|
370
|
+
let klass = templateInfo.templatizeTemplateClass;
|
|
371
|
+
if (!klass) {
|
|
372
|
+
if (isTemplate) {
|
|
373
|
+
let templatizedBase = options.mutableData ? MutableDataTemplate : DataTemplate;
|
|
374
|
+
class TemplatizedTemplate extends templatizedBase {
|
|
375
|
+
}
|
|
376
|
+
klass = templateInfo.templatizeTemplateClass = TemplatizedTemplate;
|
|
377
|
+
} else {
|
|
378
|
+
const templatizedBase = target.constructor;
|
|
379
|
+
class TemplatizedTemplateExtension extends templatizedBase {
|
|
380
|
+
}
|
|
381
|
+
klass = templateInfo.templatizeTemplateClass = TemplatizedTemplateExtension;
|
|
382
|
+
}
|
|
383
|
+
let hostProps = templateInfo.hostProps;
|
|
384
|
+
for (let prop in hostProps) {
|
|
385
|
+
klass.prototype._addPropertyEffect(
|
|
386
|
+
"_host_" + prop,
|
|
387
|
+
klass.prototype.PROPERTY_EFFECT_TYPES.PROPAGATE,
|
|
388
|
+
{ fn: createForwardHostPropEffect(prop, userForwardHostProp) }
|
|
389
|
+
);
|
|
390
|
+
klass.prototype._createNotifyingProperty("_host_" + prop);
|
|
391
|
+
}
|
|
392
|
+
if (legacyWarnings && methodHost) {
|
|
393
|
+
warnOnUndeclaredProperties(templateInfo, options, methodHost);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
if (target.__dataProto) {
|
|
397
|
+
Object.assign(target.__data, target.__dataProto);
|
|
398
|
+
}
|
|
399
|
+
if (isTemplate) {
|
|
400
|
+
upgradeTemplate(target, klass);
|
|
401
|
+
target.__dataTemp = {};
|
|
402
|
+
target.__dataPending = null;
|
|
403
|
+
target.__dataOld = null;
|
|
404
|
+
target._enableProperties();
|
|
405
|
+
} else {
|
|
406
|
+
Object.setPrototypeOf(target, klass.prototype);
|
|
407
|
+
const hostProps = templateInfo.hostProps;
|
|
408
|
+
for (let prop in hostProps) {
|
|
409
|
+
prop = "_host_" + prop;
|
|
410
|
+
if (prop in target) {
|
|
411
|
+
const val = target[prop];
|
|
412
|
+
delete target[prop];
|
|
413
|
+
target.__data[prop] = val;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
function createForwardHostPropEffect(hostProp, userForwardHostProp) {
|
|
420
|
+
return function forwardHostProp(template, prop, props) {
|
|
421
|
+
userForwardHostProp.call(
|
|
422
|
+
template.__templatizeOwner,
|
|
423
|
+
prop.substring("_host_".length),
|
|
424
|
+
props[prop]
|
|
425
|
+
);
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
function addNotifyEffects(klass, template, templateInfo, options) {
|
|
429
|
+
let hostProps = templateInfo.hostProps || {};
|
|
430
|
+
for (let iprop in options.instanceProps) {
|
|
431
|
+
delete hostProps[iprop];
|
|
432
|
+
let userNotifyInstanceProp = options.notifyInstanceProp;
|
|
433
|
+
if (userNotifyInstanceProp) {
|
|
434
|
+
klass.prototype._addPropertyEffect(
|
|
435
|
+
iprop,
|
|
436
|
+
klass.prototype.PROPERTY_EFFECT_TYPES.NOTIFY,
|
|
437
|
+
{ fn: createNotifyInstancePropEffect(iprop, userNotifyInstanceProp) }
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
if (options.forwardHostProp && template.__dataHost) {
|
|
442
|
+
for (let hprop in hostProps) {
|
|
443
|
+
if (!templateInfo.hasHostProps) {
|
|
444
|
+
templateInfo.hasHostProps = true;
|
|
445
|
+
}
|
|
446
|
+
klass.prototype._addPropertyEffect(
|
|
447
|
+
hprop,
|
|
448
|
+
klass.prototype.PROPERTY_EFFECT_TYPES.NOTIFY,
|
|
449
|
+
{ fn: createNotifyHostPropEffect() }
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
function createNotifyInstancePropEffect(instProp, userNotifyInstanceProp) {
|
|
455
|
+
return function notifyInstanceProp(inst, prop, props) {
|
|
456
|
+
userNotifyInstanceProp.call(
|
|
457
|
+
inst.__templatizeOwner,
|
|
458
|
+
inst,
|
|
459
|
+
prop,
|
|
460
|
+
props[prop]
|
|
461
|
+
);
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
function createNotifyHostPropEffect() {
|
|
465
|
+
return function notifyHostProp(inst, prop, props) {
|
|
466
|
+
inst.__dataHost._setPendingPropertyOrPath("_host_" + prop, props[prop], true, true);
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
function templatize(template, owner, options) {
|
|
470
|
+
if (strictTemplatePolicy && !findMethodHost(template)) {
|
|
471
|
+
throw new Error("strictTemplatePolicy: template owner not trusted");
|
|
472
|
+
}
|
|
473
|
+
options = /** @type {!TemplatizeOptions} */
|
|
474
|
+
options || {};
|
|
475
|
+
if (template.__templatizeOwner) {
|
|
476
|
+
throw new Error("A <template> can only be templatized once");
|
|
477
|
+
}
|
|
478
|
+
template.__templatizeOwner = owner;
|
|
479
|
+
const ctor = owner ? owner.constructor : TemplateInstanceBase;
|
|
480
|
+
let templateInfo = ctor._parseTemplate(template);
|
|
481
|
+
let baseClass = templateInfo.templatizeInstanceClass;
|
|
482
|
+
if (!baseClass) {
|
|
483
|
+
baseClass = createTemplatizerClass(template, templateInfo, options);
|
|
484
|
+
templateInfo.templatizeInstanceClass = baseClass;
|
|
485
|
+
}
|
|
486
|
+
const methodHost = findMethodHost(template);
|
|
487
|
+
addPropagateEffects(template, templateInfo, options, methodHost);
|
|
488
|
+
let klass = class TemplateInstance extends baseClass {
|
|
489
|
+
};
|
|
490
|
+
klass.prototype._methodHost = methodHost;
|
|
491
|
+
klass.prototype.__dataHost = /** @type {!DataTemplate} */
|
|
492
|
+
template;
|
|
493
|
+
klass.prototype.__templatizeOwner = /** @type {!Object} */
|
|
494
|
+
owner;
|
|
495
|
+
klass.prototype.__hostProps = templateInfo.hostProps;
|
|
496
|
+
klass = /** @type {function(new:TemplateInstanceBase)} */
|
|
497
|
+
klass;
|
|
498
|
+
return klass;
|
|
499
|
+
}
|
|
500
|
+
function warnOnUndeclaredProperties(templateInfo, options, methodHost) {
|
|
501
|
+
const declaredProps = methodHost.constructor._properties;
|
|
502
|
+
const { propertyEffects } = templateInfo;
|
|
503
|
+
const { instanceProps } = options;
|
|
504
|
+
for (let prop in propertyEffects) {
|
|
505
|
+
if (!declaredProps[prop] && !(instanceProps && instanceProps[prop])) {
|
|
506
|
+
const effects = propertyEffects[prop];
|
|
507
|
+
for (let i = 0; i < effects.length; i++) {
|
|
508
|
+
const { part } = effects[i].info;
|
|
509
|
+
if (!(part.signature && part.signature.static)) {
|
|
510
|
+
console.warn(`Property '${prop}' used in template but not declared in 'properties'; attribute will not be observed.`);
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
function modelForElement(template, node) {
|
|
518
|
+
let model;
|
|
519
|
+
while (node) {
|
|
520
|
+
if (model = node.__dataHost ? node : node.__templatizeInstance) {
|
|
521
|
+
if (model.__dataHost != template) {
|
|
522
|
+
node = model.__dataHost;
|
|
523
|
+
} else {
|
|
524
|
+
return model;
|
|
525
|
+
}
|
|
526
|
+
} else {
|
|
527
|
+
node = wrap(node).parentNode;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
return null;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// ../../../node_modules/@polymer/polymer/lib/utils/hide-template-controls.js
|
|
534
|
+
var elementsHidden = false;
|
|
535
|
+
function hideElementsGlobally() {
|
|
536
|
+
if (legacyOptimizations && !useShadow) {
|
|
537
|
+
if (!elementsHidden) {
|
|
538
|
+
elementsHidden = true;
|
|
539
|
+
const style = document.createElement("style");
|
|
540
|
+
style.textContent = "dom-bind,dom-if,dom-repeat{display:none;}";
|
|
541
|
+
document.head.appendChild(style);
|
|
542
|
+
}
|
|
543
|
+
return true;
|
|
544
|
+
}
|
|
545
|
+
return false;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
// ../../../node_modules/@polymer/polymer/lib/elements/dom-bind.js
|
|
549
|
+
var domBindBase = GestureEventListeners(
|
|
550
|
+
OptionalMutableData(
|
|
551
|
+
PropertyEffects(HTMLElement)
|
|
552
|
+
)
|
|
553
|
+
);
|
|
554
|
+
var DomBind = class extends domBindBase {
|
|
555
|
+
static get observedAttributes() {
|
|
556
|
+
return ["mutable-data"];
|
|
557
|
+
}
|
|
558
|
+
constructor() {
|
|
559
|
+
super();
|
|
560
|
+
if (strictTemplatePolicy) {
|
|
561
|
+
throw new Error(`strictTemplatePolicy: dom-bind not allowed`);
|
|
562
|
+
}
|
|
563
|
+
this.root = null;
|
|
564
|
+
this.$ = null;
|
|
565
|
+
this.__children = null;
|
|
566
|
+
}
|
|
567
|
+
/* eslint-disable no-unused-vars */
|
|
568
|
+
/**
|
|
569
|
+
* @override
|
|
570
|
+
* @param {string} name Name of attribute that changed
|
|
571
|
+
* @param {?string} old Old attribute value
|
|
572
|
+
* @param {?string} value New attribute value
|
|
573
|
+
* @param {?string} namespace Attribute namespace.
|
|
574
|
+
* @return {void}
|
|
575
|
+
*/
|
|
576
|
+
attributeChangedCallback(name, old, value, namespace) {
|
|
577
|
+
this.mutableData = true;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* @override
|
|
581
|
+
* @return {void}
|
|
582
|
+
*/
|
|
583
|
+
connectedCallback() {
|
|
584
|
+
if (!hideElementsGlobally()) {
|
|
585
|
+
this.style.display = "none";
|
|
586
|
+
}
|
|
587
|
+
this.render();
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* @override
|
|
591
|
+
* @return {void}
|
|
592
|
+
*/
|
|
593
|
+
disconnectedCallback() {
|
|
594
|
+
this.__removeChildren();
|
|
595
|
+
}
|
|
596
|
+
__insertChildren() {
|
|
597
|
+
wrap(wrap(this).parentNode).insertBefore(this.root, this);
|
|
598
|
+
}
|
|
599
|
+
__removeChildren() {
|
|
600
|
+
if (this.__children) {
|
|
601
|
+
for (let i = 0; i < this.__children.length; i++) {
|
|
602
|
+
this.root.appendChild(this.__children[i]);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Forces the element to render its content. This is typically only
|
|
608
|
+
* necessary to call if HTMLImports with the async attribute are used.
|
|
609
|
+
* @return {void}
|
|
610
|
+
*/
|
|
611
|
+
render() {
|
|
612
|
+
let template;
|
|
613
|
+
if (!this.__children) {
|
|
614
|
+
template = /** @type {?HTMLTemplateElement} */
|
|
615
|
+
template || this.querySelector("template");
|
|
616
|
+
if (!template) {
|
|
617
|
+
let observer = new MutationObserver(() => {
|
|
618
|
+
template = /** @type {HTMLTemplateElement} */
|
|
619
|
+
this.querySelector("template");
|
|
620
|
+
if (template) {
|
|
621
|
+
observer.disconnect();
|
|
622
|
+
this.render();
|
|
623
|
+
} else {
|
|
624
|
+
throw new Error("dom-bind requires a <template> child");
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
observer.observe(this, { childList: true });
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
this.root = this._stampTemplate(
|
|
631
|
+
/** @type {!HTMLTemplateElement} */
|
|
632
|
+
template
|
|
633
|
+
);
|
|
634
|
+
this.$ = this.root.$;
|
|
635
|
+
this.__children = [];
|
|
636
|
+
for (let n = this.root.firstChild; n; n = n.nextSibling) {
|
|
637
|
+
this.__children[this.__children.length] = n;
|
|
638
|
+
}
|
|
639
|
+
this._enableProperties();
|
|
640
|
+
}
|
|
641
|
+
this.__insertChildren();
|
|
642
|
+
this.dispatchEvent(new CustomEvent("dom-change", {
|
|
643
|
+
bubbles: true,
|
|
644
|
+
composed: true
|
|
645
|
+
}));
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
customElements.define("dom-bind", DomBind);
|
|
649
|
+
|
|
650
|
+
// ../../../node_modules/@polymer/polymer/lib/elements/dom-repeat.js
|
|
651
|
+
var domRepeatBase = OptionalMutableData(PolymerElement);
|
|
652
|
+
var DomRepeat = class extends domRepeatBase {
|
|
653
|
+
// Not needed to find template; can be removed once the analyzer
|
|
654
|
+
// can find the tag name from customElements.define call
|
|
655
|
+
static get is() {
|
|
656
|
+
return "dom-repeat";
|
|
657
|
+
}
|
|
658
|
+
static get template() {
|
|
659
|
+
return null;
|
|
660
|
+
}
|
|
661
|
+
static get properties() {
|
|
662
|
+
return {
|
|
663
|
+
/**
|
|
664
|
+
* An array containing items determining how many instances of the template
|
|
665
|
+
* to stamp and that that each template instance should bind to.
|
|
666
|
+
*/
|
|
667
|
+
items: {
|
|
668
|
+
type: Array
|
|
669
|
+
},
|
|
670
|
+
/**
|
|
671
|
+
* The name of the variable to add to the binding scope for the array
|
|
672
|
+
* element associated with a given template instance.
|
|
673
|
+
*/
|
|
674
|
+
as: {
|
|
675
|
+
type: String,
|
|
676
|
+
value: "item"
|
|
677
|
+
},
|
|
678
|
+
/**
|
|
679
|
+
* The name of the variable to add to the binding scope with the index
|
|
680
|
+
* of the instance in the sorted and filtered list of rendered items.
|
|
681
|
+
* Note, for the index in the `this.items` array, use the value of the
|
|
682
|
+
* `itemsIndexAs` property.
|
|
683
|
+
*/
|
|
684
|
+
indexAs: {
|
|
685
|
+
type: String,
|
|
686
|
+
value: "index"
|
|
687
|
+
},
|
|
688
|
+
/**
|
|
689
|
+
* The name of the variable to add to the binding scope with the index
|
|
690
|
+
* of the instance in the `this.items` array. Note, for the index of
|
|
691
|
+
* this instance in the sorted and filtered list of rendered items,
|
|
692
|
+
* use the value of the `indexAs` property.
|
|
693
|
+
*/
|
|
694
|
+
itemsIndexAs: {
|
|
695
|
+
type: String,
|
|
696
|
+
value: "itemsIndex"
|
|
697
|
+
},
|
|
698
|
+
/**
|
|
699
|
+
* A function that should determine the sort order of the items. This
|
|
700
|
+
* property should either be provided as a string, indicating a method
|
|
701
|
+
* name on the element's host, or else be an actual function. The
|
|
702
|
+
* function should match the sort function passed to `Array.sort`.
|
|
703
|
+
* Using a sort function has no effect on the underlying `items` array.
|
|
704
|
+
*/
|
|
705
|
+
sort: {
|
|
706
|
+
type: Function,
|
|
707
|
+
observer: "__sortChanged"
|
|
708
|
+
},
|
|
709
|
+
/**
|
|
710
|
+
* A function that can be used to filter items out of the view. This
|
|
711
|
+
* property should either be provided as a string, indicating a method
|
|
712
|
+
* name on the element's host, or else be an actual function. The
|
|
713
|
+
* function should match the sort function passed to `Array.filter`.
|
|
714
|
+
* Using a filter function has no effect on the underlying `items` array.
|
|
715
|
+
*/
|
|
716
|
+
filter: {
|
|
717
|
+
type: Function,
|
|
718
|
+
observer: "__filterChanged"
|
|
719
|
+
},
|
|
720
|
+
/**
|
|
721
|
+
* When using a `filter` or `sort` function, the `observe` property
|
|
722
|
+
* should be set to a space-separated list of the names of item
|
|
723
|
+
* sub-fields that should trigger a re-sort or re-filter when changed.
|
|
724
|
+
* These should generally be fields of `item` that the sort or filter
|
|
725
|
+
* function depends on.
|
|
726
|
+
*/
|
|
727
|
+
observe: {
|
|
728
|
+
type: String,
|
|
729
|
+
observer: "__observeChanged"
|
|
730
|
+
},
|
|
731
|
+
/**
|
|
732
|
+
* When using a `filter` or `sort` function, the `delay` property
|
|
733
|
+
* determines a debounce time in ms after a change to observed item
|
|
734
|
+
* properties that must pass before the filter or sort is re-run.
|
|
735
|
+
* This is useful in rate-limiting shuffling of the view when
|
|
736
|
+
* item changes may be frequent.
|
|
737
|
+
*/
|
|
738
|
+
delay: Number,
|
|
739
|
+
/**
|
|
740
|
+
* Count of currently rendered items after `filter` (if any) has been applied.
|
|
741
|
+
* If "chunking mode" is enabled, `renderedItemCount` is updated each time a
|
|
742
|
+
* set of template instances is rendered.
|
|
743
|
+
*
|
|
744
|
+
*/
|
|
745
|
+
renderedItemCount: {
|
|
746
|
+
type: Number,
|
|
747
|
+
notify: !suppressTemplateNotifications,
|
|
748
|
+
readOnly: true
|
|
749
|
+
},
|
|
750
|
+
/**
|
|
751
|
+
* When greater than zero, defines an initial count of template instances
|
|
752
|
+
* to render after setting the `items` array, before the next paint, and
|
|
753
|
+
* puts the `dom-repeat` into "chunking mode". The remaining items (and
|
|
754
|
+
* any future items as a result of pushing onto the array) will be created
|
|
755
|
+
* and rendered incrementally at each animation frame thereof until all
|
|
756
|
+
* instances have been rendered.
|
|
757
|
+
*/
|
|
758
|
+
initialCount: {
|
|
759
|
+
type: Number
|
|
760
|
+
},
|
|
761
|
+
/**
|
|
762
|
+
* When `initialCount` is used, this property defines a frame rate (in
|
|
763
|
+
* fps) to target by throttling the number of instances rendered each
|
|
764
|
+
* frame to not exceed the budget for the target frame rate. The
|
|
765
|
+
* framerate is effectively the number of `requestAnimationFrame`s that
|
|
766
|
+
* it tries to allow to actually fire in a given second. It does this
|
|
767
|
+
* by measuring the time between `rAF`s and continuously adjusting the
|
|
768
|
+
* number of items created each `rAF` to maintain the target framerate.
|
|
769
|
+
* Setting this to a higher number allows lower latency and higher
|
|
770
|
+
* throughput for event handlers and other tasks, but results in a
|
|
771
|
+
* longer time for the remaining items to complete rendering.
|
|
772
|
+
*/
|
|
773
|
+
targetFramerate: {
|
|
774
|
+
type: Number,
|
|
775
|
+
value: 20
|
|
776
|
+
},
|
|
777
|
+
_targetFrameTime: {
|
|
778
|
+
type: Number,
|
|
779
|
+
computed: "__computeFrameTime(targetFramerate)"
|
|
780
|
+
},
|
|
781
|
+
/**
|
|
782
|
+
* When the global `suppressTemplateNotifications` setting is used, setting
|
|
783
|
+
* `notifyDomChange: true` will enable firing `dom-change` events on this
|
|
784
|
+
* element.
|
|
785
|
+
*/
|
|
786
|
+
notifyDomChange: {
|
|
787
|
+
type: Boolean
|
|
788
|
+
},
|
|
789
|
+
/**
|
|
790
|
+
* When chunking is enabled via `initialCount` and the `items` array is
|
|
791
|
+
* set to a new array, this flag controls whether the previously rendered
|
|
792
|
+
* instances are reused or not.
|
|
793
|
+
*
|
|
794
|
+
* When `true`, any previously rendered template instances are updated in
|
|
795
|
+
* place to their new item values synchronously in one shot, and then any
|
|
796
|
+
* further items (if any) are chunked out. When `false`, the list is
|
|
797
|
+
* returned back to its `initialCount` (any instances over the initial
|
|
798
|
+
* count are discarded) and the remainder of the list is chunked back in.
|
|
799
|
+
* Set this to `true` to avoid re-creating the list and losing scroll
|
|
800
|
+
* position, although note that when changing the list to completely
|
|
801
|
+
* different data the render thread will be blocked until all existing
|
|
802
|
+
* instances are updated to their new data.
|
|
803
|
+
*/
|
|
804
|
+
reuseChunkedInstances: {
|
|
805
|
+
type: Boolean
|
|
806
|
+
}
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
static get observers() {
|
|
810
|
+
return ["__itemsChanged(items.*)"];
|
|
811
|
+
}
|
|
812
|
+
constructor() {
|
|
813
|
+
super();
|
|
814
|
+
this.__instances = [];
|
|
815
|
+
this.__renderDebouncer = null;
|
|
816
|
+
this.__itemsIdxToInstIdx = {};
|
|
817
|
+
this.__chunkCount = null;
|
|
818
|
+
this.__renderStartTime = null;
|
|
819
|
+
this.__itemsArrayChanged = false;
|
|
820
|
+
this.__shouldMeasureChunk = false;
|
|
821
|
+
this.__shouldContinueChunking = false;
|
|
822
|
+
this.__chunkingId = 0;
|
|
823
|
+
this.__sortFn = null;
|
|
824
|
+
this.__filterFn = null;
|
|
825
|
+
this.__observePaths = null;
|
|
826
|
+
this.__ctor = null;
|
|
827
|
+
this.__isDetached = true;
|
|
828
|
+
this.template = null;
|
|
829
|
+
this._templateInfo;
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* @override
|
|
833
|
+
* @return {void}
|
|
834
|
+
*/
|
|
835
|
+
disconnectedCallback() {
|
|
836
|
+
super.disconnectedCallback();
|
|
837
|
+
this.__isDetached = true;
|
|
838
|
+
for (let i = 0; i < this.__instances.length; i++) {
|
|
839
|
+
this.__detachInstance(i);
|
|
840
|
+
}
|
|
841
|
+
if (this.__chunkingId) {
|
|
842
|
+
cancelAnimationFrame(this.__chunkingId);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* @override
|
|
847
|
+
* @return {void}
|
|
848
|
+
*/
|
|
849
|
+
connectedCallback() {
|
|
850
|
+
super.connectedCallback();
|
|
851
|
+
if (!hideElementsGlobally()) {
|
|
852
|
+
this.style.display = "none";
|
|
853
|
+
}
|
|
854
|
+
if (this.__isDetached) {
|
|
855
|
+
this.__isDetached = false;
|
|
856
|
+
let wrappedParent = wrap(wrap(this).parentNode);
|
|
857
|
+
for (let i = 0; i < this.__instances.length; i++) {
|
|
858
|
+
this.__attachInstance(i, wrappedParent);
|
|
859
|
+
}
|
|
860
|
+
if (this.__chunkingId) {
|
|
861
|
+
this.__render();
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
__ensureTemplatized() {
|
|
866
|
+
if (!this.__ctor) {
|
|
867
|
+
const thisAsTemplate = (
|
|
868
|
+
/** @type {!HTMLTemplateElement} */
|
|
869
|
+
/** @type {!HTMLElement} */
|
|
870
|
+
this
|
|
871
|
+
);
|
|
872
|
+
let template = this.template = thisAsTemplate._templateInfo ? thisAsTemplate : (
|
|
873
|
+
/** @type {!HTMLTemplateElement} */
|
|
874
|
+
this.querySelector("template")
|
|
875
|
+
);
|
|
876
|
+
if (!template) {
|
|
877
|
+
let observer = new MutationObserver(() => {
|
|
878
|
+
if (this.querySelector("template")) {
|
|
879
|
+
observer.disconnect();
|
|
880
|
+
this.__render();
|
|
881
|
+
} else {
|
|
882
|
+
throw new Error("dom-repeat requires a <template> child");
|
|
883
|
+
}
|
|
884
|
+
});
|
|
885
|
+
observer.observe(this, { childList: true });
|
|
886
|
+
return false;
|
|
887
|
+
}
|
|
888
|
+
let instanceProps = {};
|
|
889
|
+
instanceProps[this.as] = true;
|
|
890
|
+
instanceProps[this.indexAs] = true;
|
|
891
|
+
instanceProps[this.itemsIndexAs] = true;
|
|
892
|
+
this.__ctor = templatize(template, this, {
|
|
893
|
+
mutableData: this.mutableData,
|
|
894
|
+
parentModel: true,
|
|
895
|
+
instanceProps,
|
|
896
|
+
/**
|
|
897
|
+
* @this {DomRepeat}
|
|
898
|
+
* @param {string} prop Property to set
|
|
899
|
+
* @param {*} value Value to set property to
|
|
900
|
+
*/
|
|
901
|
+
forwardHostProp: function(prop, value) {
|
|
902
|
+
let i$ = this.__instances;
|
|
903
|
+
for (let i = 0, inst; i < i$.length && (inst = i$[i]); i++) {
|
|
904
|
+
inst.forwardHostProp(prop, value);
|
|
905
|
+
}
|
|
906
|
+
},
|
|
907
|
+
/**
|
|
908
|
+
* @this {DomRepeat}
|
|
909
|
+
* @param {Object} inst Instance to notify
|
|
910
|
+
* @param {string} prop Property to notify
|
|
911
|
+
* @param {*} value Value to notify
|
|
912
|
+
*/
|
|
913
|
+
notifyInstanceProp: function(inst, prop, value) {
|
|
914
|
+
if (matches(this.as, prop)) {
|
|
915
|
+
let idx = inst[this.itemsIndexAs];
|
|
916
|
+
if (prop == this.as) {
|
|
917
|
+
this.items[idx] = value;
|
|
918
|
+
}
|
|
919
|
+
let path = translate(this.as, `${JSCompiler_renameProperty("items", this)}.${idx}`, prop);
|
|
920
|
+
this.notifyPath(path, value);
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
return true;
|
|
926
|
+
}
|
|
927
|
+
__getMethodHost() {
|
|
928
|
+
return this.__dataHost._methodHost || this.__dataHost;
|
|
929
|
+
}
|
|
930
|
+
__functionFromPropertyValue(functionOrMethodName) {
|
|
931
|
+
if (typeof functionOrMethodName === "string") {
|
|
932
|
+
let methodName = functionOrMethodName;
|
|
933
|
+
let obj = this.__getMethodHost();
|
|
934
|
+
return function() {
|
|
935
|
+
return obj[methodName].apply(obj, arguments);
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
return functionOrMethodName;
|
|
939
|
+
}
|
|
940
|
+
__sortChanged(sort) {
|
|
941
|
+
this.__sortFn = this.__functionFromPropertyValue(sort);
|
|
942
|
+
if (this.items) {
|
|
943
|
+
this.__debounceRender(this.__render);
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
__filterChanged(filter) {
|
|
947
|
+
this.__filterFn = this.__functionFromPropertyValue(filter);
|
|
948
|
+
if (this.items) {
|
|
949
|
+
this.__debounceRender(this.__render);
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
__computeFrameTime(rate) {
|
|
953
|
+
return Math.ceil(1e3 / rate);
|
|
954
|
+
}
|
|
955
|
+
__observeChanged() {
|
|
956
|
+
this.__observePaths = this.observe && this.observe.replace(".*", ".").split(" ");
|
|
957
|
+
}
|
|
958
|
+
__handleObservedPaths(path) {
|
|
959
|
+
if (this.__sortFn || this.__filterFn) {
|
|
960
|
+
if (!path) {
|
|
961
|
+
this.__debounceRender(this.__render, this.delay);
|
|
962
|
+
} else if (this.__observePaths) {
|
|
963
|
+
let paths = this.__observePaths;
|
|
964
|
+
for (let i = 0; i < paths.length; i++) {
|
|
965
|
+
if (path.indexOf(paths[i]) === 0) {
|
|
966
|
+
this.__debounceRender(this.__render, this.delay);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
__itemsChanged(change) {
|
|
973
|
+
if (this.items && !Array.isArray(this.items)) {
|
|
974
|
+
console.warn("dom-repeat expected array for `items`, found", this.items);
|
|
975
|
+
}
|
|
976
|
+
if (!this.__handleItemPath(change.path, change.value)) {
|
|
977
|
+
if (change.path === "items") {
|
|
978
|
+
this.__itemsArrayChanged = true;
|
|
979
|
+
}
|
|
980
|
+
this.__debounceRender(this.__render);
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
/**
|
|
984
|
+
* @param {function(this:DomRepeat)} fn Function to debounce.
|
|
985
|
+
* @param {number=} delay Delay in ms to debounce by.
|
|
986
|
+
*/
|
|
987
|
+
__debounceRender(fn, delay = 0) {
|
|
988
|
+
this.__renderDebouncer = Debouncer.debounce(
|
|
989
|
+
this.__renderDebouncer,
|
|
990
|
+
delay > 0 ? timeOut.after(delay) : microTask,
|
|
991
|
+
fn.bind(this)
|
|
992
|
+
);
|
|
993
|
+
enqueueDebouncer(this.__renderDebouncer);
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* Forces the element to render its content. Normally rendering is
|
|
997
|
+
* asynchronous to a provoking change. This is done for efficiency so
|
|
998
|
+
* that multiple changes trigger only a single render. The render method
|
|
999
|
+
* should be called if, for example, template rendering is required to
|
|
1000
|
+
* validate application state.
|
|
1001
|
+
* @return {void}
|
|
1002
|
+
*/
|
|
1003
|
+
render() {
|
|
1004
|
+
this.__debounceRender(this.__render);
|
|
1005
|
+
flush();
|
|
1006
|
+
}
|
|
1007
|
+
__render() {
|
|
1008
|
+
if (!this.__ensureTemplatized()) {
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
let items = this.items || [];
|
|
1012
|
+
const isntIdxToItemsIdx = this.__sortAndFilterItems(items);
|
|
1013
|
+
const limit = this.__calculateLimit(isntIdxToItemsIdx.length);
|
|
1014
|
+
this.__updateInstances(items, limit, isntIdxToItemsIdx);
|
|
1015
|
+
if (this.initialCount && (this.__shouldMeasureChunk || this.__shouldContinueChunking)) {
|
|
1016
|
+
cancelAnimationFrame(this.__chunkingId);
|
|
1017
|
+
this.__chunkingId = requestAnimationFrame(() => {
|
|
1018
|
+
this.__chunkingId = null;
|
|
1019
|
+
this.__continueChunking();
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1022
|
+
this._setRenderedItemCount(this.__instances.length);
|
|
1023
|
+
if (!suppressTemplateNotifications || this.notifyDomChange) {
|
|
1024
|
+
this.dispatchEvent(new CustomEvent("dom-change", {
|
|
1025
|
+
bubbles: true,
|
|
1026
|
+
composed: true
|
|
1027
|
+
}));
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
__sortAndFilterItems(items) {
|
|
1031
|
+
let isntIdxToItemsIdx = new Array(items.length);
|
|
1032
|
+
for (let i = 0; i < items.length; i++) {
|
|
1033
|
+
isntIdxToItemsIdx[i] = i;
|
|
1034
|
+
}
|
|
1035
|
+
if (this.__filterFn) {
|
|
1036
|
+
isntIdxToItemsIdx = isntIdxToItemsIdx.filter((i, idx, array) => this.__filterFn(items[i], idx, array));
|
|
1037
|
+
}
|
|
1038
|
+
if (this.__sortFn) {
|
|
1039
|
+
isntIdxToItemsIdx.sort((a, b) => this.__sortFn(items[a], items[b]));
|
|
1040
|
+
}
|
|
1041
|
+
return isntIdxToItemsIdx;
|
|
1042
|
+
}
|
|
1043
|
+
__calculateLimit(filteredItemCount) {
|
|
1044
|
+
let limit = filteredItemCount;
|
|
1045
|
+
const currentCount = this.__instances.length;
|
|
1046
|
+
if (this.initialCount) {
|
|
1047
|
+
let newCount;
|
|
1048
|
+
if (!this.__chunkCount || this.__itemsArrayChanged && !this.reuseChunkedInstances) {
|
|
1049
|
+
limit = Math.min(filteredItemCount, this.initialCount);
|
|
1050
|
+
newCount = Math.max(limit - currentCount, 0);
|
|
1051
|
+
this.__chunkCount = newCount || 1;
|
|
1052
|
+
} else {
|
|
1053
|
+
newCount = Math.min(
|
|
1054
|
+
Math.max(filteredItemCount - currentCount, 0),
|
|
1055
|
+
this.__chunkCount
|
|
1056
|
+
);
|
|
1057
|
+
limit = Math.min(currentCount + newCount, filteredItemCount);
|
|
1058
|
+
}
|
|
1059
|
+
this.__shouldMeasureChunk = newCount === this.__chunkCount;
|
|
1060
|
+
this.__shouldContinueChunking = limit < filteredItemCount;
|
|
1061
|
+
this.__renderStartTime = performance.now();
|
|
1062
|
+
}
|
|
1063
|
+
this.__itemsArrayChanged = false;
|
|
1064
|
+
return limit;
|
|
1065
|
+
}
|
|
1066
|
+
__continueChunking() {
|
|
1067
|
+
if (this.__shouldMeasureChunk) {
|
|
1068
|
+
const renderTime = performance.now() - this.__renderStartTime;
|
|
1069
|
+
const ratio = this._targetFrameTime / renderTime;
|
|
1070
|
+
this.__chunkCount = Math.round(this.__chunkCount * ratio) || 1;
|
|
1071
|
+
}
|
|
1072
|
+
if (this.__shouldContinueChunking) {
|
|
1073
|
+
this.__debounceRender(this.__render);
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
__updateInstances(items, limit, isntIdxToItemsIdx) {
|
|
1077
|
+
const itemsIdxToInstIdx = this.__itemsIdxToInstIdx = {};
|
|
1078
|
+
let instIdx;
|
|
1079
|
+
for (instIdx = 0; instIdx < limit; instIdx++) {
|
|
1080
|
+
let inst = this.__instances[instIdx];
|
|
1081
|
+
let itemIdx = isntIdxToItemsIdx[instIdx];
|
|
1082
|
+
let item = items[itemIdx];
|
|
1083
|
+
itemsIdxToInstIdx[itemIdx] = instIdx;
|
|
1084
|
+
if (inst) {
|
|
1085
|
+
inst._setPendingProperty(this.as, item);
|
|
1086
|
+
inst._setPendingProperty(this.indexAs, instIdx);
|
|
1087
|
+
inst._setPendingProperty(this.itemsIndexAs, itemIdx);
|
|
1088
|
+
inst._flushProperties();
|
|
1089
|
+
} else {
|
|
1090
|
+
this.__insertInstance(item, instIdx, itemIdx);
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
for (let i = this.__instances.length - 1; i >= instIdx; i--) {
|
|
1094
|
+
this.__detachAndRemoveInstance(i);
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
__detachInstance(idx) {
|
|
1098
|
+
let inst = this.__instances[idx];
|
|
1099
|
+
const wrappedRoot = wrap(inst.root);
|
|
1100
|
+
for (let i = 0; i < inst.children.length; i++) {
|
|
1101
|
+
let el = inst.children[i];
|
|
1102
|
+
wrappedRoot.appendChild(el);
|
|
1103
|
+
}
|
|
1104
|
+
return inst;
|
|
1105
|
+
}
|
|
1106
|
+
__attachInstance(idx, parent) {
|
|
1107
|
+
let inst = this.__instances[idx];
|
|
1108
|
+
parent.insertBefore(inst.root, this);
|
|
1109
|
+
}
|
|
1110
|
+
__detachAndRemoveInstance(idx) {
|
|
1111
|
+
this.__detachInstance(idx);
|
|
1112
|
+
this.__instances.splice(idx, 1);
|
|
1113
|
+
}
|
|
1114
|
+
__stampInstance(item, instIdx, itemIdx) {
|
|
1115
|
+
let model = {};
|
|
1116
|
+
model[this.as] = item;
|
|
1117
|
+
model[this.indexAs] = instIdx;
|
|
1118
|
+
model[this.itemsIndexAs] = itemIdx;
|
|
1119
|
+
return new this.__ctor(model);
|
|
1120
|
+
}
|
|
1121
|
+
__insertInstance(item, instIdx, itemIdx) {
|
|
1122
|
+
const inst = this.__stampInstance(item, instIdx, itemIdx);
|
|
1123
|
+
let beforeRow = this.__instances[instIdx + 1];
|
|
1124
|
+
let beforeNode = beforeRow ? beforeRow.children[0] : this;
|
|
1125
|
+
wrap(wrap(this).parentNode).insertBefore(inst.root, beforeNode);
|
|
1126
|
+
this.__instances[instIdx] = inst;
|
|
1127
|
+
return inst;
|
|
1128
|
+
}
|
|
1129
|
+
// Implements extension point from Templatize mixin
|
|
1130
|
+
/**
|
|
1131
|
+
* Shows or hides the template instance top level child elements. For
|
|
1132
|
+
* text nodes, `textContent` is removed while "hidden" and replaced when
|
|
1133
|
+
* "shown."
|
|
1134
|
+
* @param {boolean} hidden Set to true to hide the children;
|
|
1135
|
+
* set to false to show them.
|
|
1136
|
+
* @return {void}
|
|
1137
|
+
* @protected
|
|
1138
|
+
*/
|
|
1139
|
+
_showHideChildren(hidden) {
|
|
1140
|
+
for (let i = 0; i < this.__instances.length; i++) {
|
|
1141
|
+
this.__instances[i]._showHideChildren(hidden);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
// Called as a side effect of a host items.<key>.<path> path change,
|
|
1145
|
+
// responsible for notifying item.<path> changes to inst for key
|
|
1146
|
+
__handleItemPath(path, value) {
|
|
1147
|
+
let itemsPath = path.slice(6);
|
|
1148
|
+
let dot = itemsPath.indexOf(".");
|
|
1149
|
+
let itemsIdx = dot < 0 ? itemsPath : itemsPath.substring(0, dot);
|
|
1150
|
+
if (itemsIdx == parseInt(itemsIdx, 10)) {
|
|
1151
|
+
let itemSubPath = dot < 0 ? "" : itemsPath.substring(dot + 1);
|
|
1152
|
+
this.__handleObservedPaths(itemSubPath);
|
|
1153
|
+
let instIdx = this.__itemsIdxToInstIdx[itemsIdx];
|
|
1154
|
+
let inst = this.__instances[instIdx];
|
|
1155
|
+
if (inst) {
|
|
1156
|
+
let itemPath = this.as + (itemSubPath ? "." + itemSubPath : "");
|
|
1157
|
+
inst._setPendingPropertyOrPath(itemPath, value, false, true);
|
|
1158
|
+
inst._flushProperties();
|
|
1159
|
+
}
|
|
1160
|
+
return true;
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
1164
|
+
* Returns the item associated with a given element stamped by
|
|
1165
|
+
* this `dom-repeat`.
|
|
1166
|
+
*
|
|
1167
|
+
* Note, to modify sub-properties of the item,
|
|
1168
|
+
* `modelForElement(el).set('item.<sub-prop>', value)`
|
|
1169
|
+
* should be used.
|
|
1170
|
+
*
|
|
1171
|
+
* @param {!HTMLElement} el Element for which to return the item.
|
|
1172
|
+
* @return {*} Item associated with the element.
|
|
1173
|
+
*/
|
|
1174
|
+
itemForElement(el) {
|
|
1175
|
+
let instance = this.modelForElement(el);
|
|
1176
|
+
return instance && instance[this.as];
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* Returns the inst index for a given element stamped by this `dom-repeat`.
|
|
1180
|
+
* If `sort` is provided, the index will reflect the sorted order (rather
|
|
1181
|
+
* than the original array order).
|
|
1182
|
+
*
|
|
1183
|
+
* @param {!HTMLElement} el Element for which to return the index.
|
|
1184
|
+
* @return {?number} Row index associated with the element (note this may
|
|
1185
|
+
* not correspond to the array index if a user `sort` is applied).
|
|
1186
|
+
*/
|
|
1187
|
+
indexForElement(el) {
|
|
1188
|
+
let instance = this.modelForElement(el);
|
|
1189
|
+
return instance && instance[this.indexAs];
|
|
1190
|
+
}
|
|
1191
|
+
/**
|
|
1192
|
+
* Returns the template "model" associated with a given element, which
|
|
1193
|
+
* serves as the binding scope for the template instance the element is
|
|
1194
|
+
* contained in. A template model
|
|
1195
|
+
* should be used to manipulate data associated with this template instance.
|
|
1196
|
+
*
|
|
1197
|
+
* Example:
|
|
1198
|
+
*
|
|
1199
|
+
* let model = modelForElement(el);
|
|
1200
|
+
* if (model.index < 10) {
|
|
1201
|
+
* model.set('item.checked', true);
|
|
1202
|
+
* }
|
|
1203
|
+
*
|
|
1204
|
+
* @param {!HTMLElement} el Element for which to return a template model.
|
|
1205
|
+
* @return {TemplateInstanceBase} Model representing the binding scope for
|
|
1206
|
+
* the element.
|
|
1207
|
+
*/
|
|
1208
|
+
modelForElement(el) {
|
|
1209
|
+
return modelForElement(this.template, el);
|
|
1210
|
+
}
|
|
1211
|
+
};
|
|
1212
|
+
customElements.define(DomRepeat.is, DomRepeat);
|
|
1213
|
+
|
|
1214
|
+
// ../../../node_modules/@polymer/polymer/lib/elements/dom-if.js
|
|
1215
|
+
var DomIfBase = class extends PolymerElement {
|
|
1216
|
+
// Not needed to find template; can be removed once the analyzer
|
|
1217
|
+
// can find the tag name from customElements.define call
|
|
1218
|
+
static get is() {
|
|
1219
|
+
return "dom-if";
|
|
1220
|
+
}
|
|
1221
|
+
static get template() {
|
|
1222
|
+
return null;
|
|
1223
|
+
}
|
|
1224
|
+
static get properties() {
|
|
1225
|
+
return {
|
|
1226
|
+
/**
|
|
1227
|
+
* Fired whenever DOM is added or removed/hidden by this template (by
|
|
1228
|
+
* default, rendering occurs lazily). To force immediate rendering, call
|
|
1229
|
+
* `render`.
|
|
1230
|
+
*
|
|
1231
|
+
* @event dom-change
|
|
1232
|
+
*/
|
|
1233
|
+
/**
|
|
1234
|
+
* A boolean indicating whether this template should stamp.
|
|
1235
|
+
*/
|
|
1236
|
+
if: {
|
|
1237
|
+
type: Boolean,
|
|
1238
|
+
observer: "__debounceRender"
|
|
1239
|
+
},
|
|
1240
|
+
/**
|
|
1241
|
+
* When true, elements will be removed from DOM and discarded when `if`
|
|
1242
|
+
* becomes false and re-created and added back to the DOM when `if`
|
|
1243
|
+
* becomes true. By default, stamped elements will be hidden but left
|
|
1244
|
+
* in the DOM when `if` becomes false, which is generally results
|
|
1245
|
+
* in better performance.
|
|
1246
|
+
*/
|
|
1247
|
+
restamp: {
|
|
1248
|
+
type: Boolean,
|
|
1249
|
+
observer: "__debounceRender"
|
|
1250
|
+
},
|
|
1251
|
+
/**
|
|
1252
|
+
* When the global `suppressTemplateNotifications` setting is used, setting
|
|
1253
|
+
* `notifyDomChange: true` will enable firing `dom-change` events on this
|
|
1254
|
+
* element.
|
|
1255
|
+
*/
|
|
1256
|
+
notifyDomChange: {
|
|
1257
|
+
type: Boolean
|
|
1258
|
+
}
|
|
1259
|
+
};
|
|
1260
|
+
}
|
|
1261
|
+
constructor() {
|
|
1262
|
+
super();
|
|
1263
|
+
this.__renderDebouncer = null;
|
|
1264
|
+
this._lastIf = false;
|
|
1265
|
+
this.__hideTemplateChildren__ = false;
|
|
1266
|
+
this.__template;
|
|
1267
|
+
this._templateInfo;
|
|
1268
|
+
}
|
|
1269
|
+
__debounceRender() {
|
|
1270
|
+
this.__renderDebouncer = Debouncer.debounce(
|
|
1271
|
+
this.__renderDebouncer,
|
|
1272
|
+
microTask,
|
|
1273
|
+
() => this.__render()
|
|
1274
|
+
);
|
|
1275
|
+
enqueueDebouncer(this.__renderDebouncer);
|
|
1276
|
+
}
|
|
1277
|
+
/**
|
|
1278
|
+
* @override
|
|
1279
|
+
* @return {void}
|
|
1280
|
+
*/
|
|
1281
|
+
disconnectedCallback() {
|
|
1282
|
+
super.disconnectedCallback();
|
|
1283
|
+
const parent = wrap(this).parentNode;
|
|
1284
|
+
if (!parent || parent.nodeType == Node.DOCUMENT_FRAGMENT_NODE && !wrap(parent).host) {
|
|
1285
|
+
this.__teardownInstance();
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
/**
|
|
1289
|
+
* @override
|
|
1290
|
+
* @return {void}
|
|
1291
|
+
*/
|
|
1292
|
+
connectedCallback() {
|
|
1293
|
+
super.connectedCallback();
|
|
1294
|
+
if (!hideElementsGlobally()) {
|
|
1295
|
+
this.style.display = "none";
|
|
1296
|
+
}
|
|
1297
|
+
if (this.if) {
|
|
1298
|
+
this.__debounceRender();
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
/**
|
|
1302
|
+
* Ensures a template has been assigned to `this.__template`. If it has not
|
|
1303
|
+
* yet been, it querySelectors for it in its children and if it does not yet
|
|
1304
|
+
* exist (e.g. in parser-generated case), opens a mutation observer and
|
|
1305
|
+
* waits for it to appear (returns false if it has not yet been found,
|
|
1306
|
+
* otherwise true). In the `removeNestedTemplates` case, the "template" will
|
|
1307
|
+
* be the `dom-if` element itself.
|
|
1308
|
+
*
|
|
1309
|
+
* @return {boolean} True when a template has been found, false otherwise
|
|
1310
|
+
*/
|
|
1311
|
+
__ensureTemplate() {
|
|
1312
|
+
if (!this.__template) {
|
|
1313
|
+
const thisAsTemplate = (
|
|
1314
|
+
/** @type {!HTMLTemplateElement} */
|
|
1315
|
+
/** @type {!HTMLElement} */
|
|
1316
|
+
this
|
|
1317
|
+
);
|
|
1318
|
+
let template = thisAsTemplate._templateInfo ? thisAsTemplate : (
|
|
1319
|
+
/** @type {!HTMLTemplateElement} */
|
|
1320
|
+
wrap(thisAsTemplate).querySelector("template")
|
|
1321
|
+
);
|
|
1322
|
+
if (!template) {
|
|
1323
|
+
let observer = new MutationObserver(() => {
|
|
1324
|
+
if (wrap(this).querySelector("template")) {
|
|
1325
|
+
observer.disconnect();
|
|
1326
|
+
this.__render();
|
|
1327
|
+
} else {
|
|
1328
|
+
throw new Error("dom-if requires a <template> child");
|
|
1329
|
+
}
|
|
1330
|
+
});
|
|
1331
|
+
observer.observe(this, { childList: true });
|
|
1332
|
+
return false;
|
|
1333
|
+
}
|
|
1334
|
+
this.__template = template;
|
|
1335
|
+
}
|
|
1336
|
+
return true;
|
|
1337
|
+
}
|
|
1338
|
+
/**
|
|
1339
|
+
* Ensures a an instance of the template has been created and inserted. This
|
|
1340
|
+
* method may return false if the template has not yet been found or if
|
|
1341
|
+
* there is no `parentNode` to insert the template into (in either case,
|
|
1342
|
+
* connection or the template-finding mutation observer firing will queue
|
|
1343
|
+
* another render, causing this method to be called again at a more
|
|
1344
|
+
* appropriate time).
|
|
1345
|
+
*
|
|
1346
|
+
* Subclasses should implement the following methods called here:
|
|
1347
|
+
* - `__hasInstance`
|
|
1348
|
+
* - `__createAndInsertInstance`
|
|
1349
|
+
* - `__getInstanceNodes`
|
|
1350
|
+
*
|
|
1351
|
+
* @return {boolean} True if the instance was created, false otherwise.
|
|
1352
|
+
*/
|
|
1353
|
+
__ensureInstance() {
|
|
1354
|
+
let parentNode = wrap(this).parentNode;
|
|
1355
|
+
if (!this.__hasInstance()) {
|
|
1356
|
+
if (!parentNode) {
|
|
1357
|
+
return false;
|
|
1358
|
+
}
|
|
1359
|
+
if (!this.__ensureTemplate()) {
|
|
1360
|
+
return false;
|
|
1361
|
+
}
|
|
1362
|
+
this.__createAndInsertInstance(parentNode);
|
|
1363
|
+
} else {
|
|
1364
|
+
let children = this.__getInstanceNodes();
|
|
1365
|
+
if (children && children.length) {
|
|
1366
|
+
let lastChild = wrap(this).previousSibling;
|
|
1367
|
+
if (lastChild !== children[children.length - 1]) {
|
|
1368
|
+
for (let i = 0, n; i < children.length && (n = children[i]); i++) {
|
|
1369
|
+
wrap(parentNode).insertBefore(n, this);
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
return true;
|
|
1375
|
+
}
|
|
1376
|
+
/**
|
|
1377
|
+
* Forces the element to render its content. Normally rendering is
|
|
1378
|
+
* asynchronous to a provoking change. This is done for efficiency so
|
|
1379
|
+
* that multiple changes trigger only a single render. The render method
|
|
1380
|
+
* should be called if, for example, template rendering is required to
|
|
1381
|
+
* validate application state.
|
|
1382
|
+
*
|
|
1383
|
+
* @return {void}
|
|
1384
|
+
*/
|
|
1385
|
+
render() {
|
|
1386
|
+
flush();
|
|
1387
|
+
}
|
|
1388
|
+
/**
|
|
1389
|
+
* Performs the key rendering steps:
|
|
1390
|
+
* 1. Ensure a template instance has been stamped (when true)
|
|
1391
|
+
* 2. Remove the template instance (when false and restamp:true)
|
|
1392
|
+
* 3. Sync the hidden state of the instance nodes with the if/restamp state
|
|
1393
|
+
* 4. Fires the `dom-change` event when necessary
|
|
1394
|
+
*
|
|
1395
|
+
* @return {void}
|
|
1396
|
+
*/
|
|
1397
|
+
__render() {
|
|
1398
|
+
if (this.if) {
|
|
1399
|
+
if (!this.__ensureInstance()) {
|
|
1400
|
+
return;
|
|
1401
|
+
}
|
|
1402
|
+
} else if (this.restamp) {
|
|
1403
|
+
this.__teardownInstance();
|
|
1404
|
+
}
|
|
1405
|
+
this._showHideChildren();
|
|
1406
|
+
if ((!suppressTemplateNotifications || this.notifyDomChange) && this.if != this._lastIf) {
|
|
1407
|
+
this.dispatchEvent(new CustomEvent("dom-change", {
|
|
1408
|
+
bubbles: true,
|
|
1409
|
+
composed: true
|
|
1410
|
+
}));
|
|
1411
|
+
this._lastIf = this.if;
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
// Ideally these would be annotated as abstract methods in an abstract class,
|
|
1415
|
+
// but closure compiler is finnicky
|
|
1416
|
+
/* eslint-disable valid-jsdoc */
|
|
1417
|
+
/**
|
|
1418
|
+
* Abstract API to be implemented by subclass: Returns true if a template
|
|
1419
|
+
* instance has been created and inserted.
|
|
1420
|
+
*
|
|
1421
|
+
* @protected
|
|
1422
|
+
* @return {boolean} True when an instance has been created.
|
|
1423
|
+
*/
|
|
1424
|
+
__hasInstance() {
|
|
1425
|
+
}
|
|
1426
|
+
/**
|
|
1427
|
+
* Abstract API to be implemented by subclass: Returns the child nodes stamped
|
|
1428
|
+
* from a template instance.
|
|
1429
|
+
*
|
|
1430
|
+
* @protected
|
|
1431
|
+
* @return {Array<Node>} Array of child nodes stamped from the template
|
|
1432
|
+
* instance.
|
|
1433
|
+
*/
|
|
1434
|
+
__getInstanceNodes() {
|
|
1435
|
+
}
|
|
1436
|
+
/**
|
|
1437
|
+
* Abstract API to be implemented by subclass: Creates an instance of the
|
|
1438
|
+
* template and inserts it into the given parent node.
|
|
1439
|
+
*
|
|
1440
|
+
* @protected
|
|
1441
|
+
* @param {Node} parentNode The parent node to insert the instance into
|
|
1442
|
+
* @return {void}
|
|
1443
|
+
*/
|
|
1444
|
+
__createAndInsertInstance(parentNode) {
|
|
1445
|
+
}
|
|
1446
|
+
// eslint-disable-line no-unused-vars
|
|
1447
|
+
/**
|
|
1448
|
+
* Abstract API to be implemented by subclass: Removes nodes created by an
|
|
1449
|
+
* instance of a template and any associated cleanup.
|
|
1450
|
+
*
|
|
1451
|
+
* @protected
|
|
1452
|
+
* @return {void}
|
|
1453
|
+
*/
|
|
1454
|
+
__teardownInstance() {
|
|
1455
|
+
}
|
|
1456
|
+
/**
|
|
1457
|
+
* Abstract API to be implemented by subclass: Shows or hides any template
|
|
1458
|
+
* instance childNodes based on the `if` state of the element and its
|
|
1459
|
+
* `__hideTemplateChildren__` property.
|
|
1460
|
+
*
|
|
1461
|
+
* @protected
|
|
1462
|
+
* @return {void}
|
|
1463
|
+
*/
|
|
1464
|
+
_showHideChildren() {
|
|
1465
|
+
}
|
|
1466
|
+
/* eslint-enable valid-jsdoc */
|
|
1467
|
+
};
|
|
1468
|
+
var DomIfFast = class extends DomIfBase {
|
|
1469
|
+
constructor() {
|
|
1470
|
+
super();
|
|
1471
|
+
this.__instance = null;
|
|
1472
|
+
this.__syncInfo = null;
|
|
1473
|
+
}
|
|
1474
|
+
/**
|
|
1475
|
+
* Implementation of abstract API needed by DomIfBase.
|
|
1476
|
+
*
|
|
1477
|
+
* @override
|
|
1478
|
+
* @return {boolean} True when an instance has been created.
|
|
1479
|
+
*/
|
|
1480
|
+
__hasInstance() {
|
|
1481
|
+
return Boolean(this.__instance);
|
|
1482
|
+
}
|
|
1483
|
+
/**
|
|
1484
|
+
* Implementation of abstract API needed by DomIfBase.
|
|
1485
|
+
*
|
|
1486
|
+
* @override
|
|
1487
|
+
* @return {Array<Node>} Array of child nodes stamped from the template
|
|
1488
|
+
* instance.
|
|
1489
|
+
*/
|
|
1490
|
+
__getInstanceNodes() {
|
|
1491
|
+
return this.__instance.templateInfo.childNodes;
|
|
1492
|
+
}
|
|
1493
|
+
/**
|
|
1494
|
+
* Implementation of abstract API needed by DomIfBase.
|
|
1495
|
+
*
|
|
1496
|
+
* Stamps the template by calling `_stampTemplate` on the `__dataHost` of this
|
|
1497
|
+
* element and then inserts the resulting nodes into the given `parentNode`.
|
|
1498
|
+
*
|
|
1499
|
+
* @override
|
|
1500
|
+
* @param {Node} parentNode The parent node to insert the instance into
|
|
1501
|
+
* @return {void}
|
|
1502
|
+
*/
|
|
1503
|
+
__createAndInsertInstance(parentNode) {
|
|
1504
|
+
const host = this.__dataHost || this;
|
|
1505
|
+
if (strictTemplatePolicy) {
|
|
1506
|
+
if (!this.__dataHost) {
|
|
1507
|
+
throw new Error("strictTemplatePolicy: template owner not trusted");
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
const templateInfo = host._bindTemplate(
|
|
1511
|
+
/** @type {!HTMLTemplateElement} */
|
|
1512
|
+
this.__template,
|
|
1513
|
+
true
|
|
1514
|
+
);
|
|
1515
|
+
templateInfo.runEffects = (runEffects, changedProps, hasPaths) => {
|
|
1516
|
+
let syncInfo = this.__syncInfo;
|
|
1517
|
+
if (this.if) {
|
|
1518
|
+
if (syncInfo) {
|
|
1519
|
+
this.__syncInfo = null;
|
|
1520
|
+
this._showHideChildren();
|
|
1521
|
+
changedProps = Object.assign(syncInfo.changedProps, changedProps);
|
|
1522
|
+
}
|
|
1523
|
+
runEffects(changedProps, hasPaths);
|
|
1524
|
+
} else {
|
|
1525
|
+
if (this.__instance) {
|
|
1526
|
+
if (!syncInfo) {
|
|
1527
|
+
syncInfo = this.__syncInfo = { runEffects, changedProps: {} };
|
|
1528
|
+
}
|
|
1529
|
+
if (hasPaths) {
|
|
1530
|
+
for (const p in changedProps) {
|
|
1531
|
+
const rootProp = root(p);
|
|
1532
|
+
syncInfo.changedProps[rootProp] = this.__dataHost[rootProp];
|
|
1533
|
+
}
|
|
1534
|
+
} else {
|
|
1535
|
+
Object.assign(syncInfo.changedProps, changedProps);
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
};
|
|
1540
|
+
this.__instance = host._stampTemplate(
|
|
1541
|
+
/** @type {!HTMLTemplateElement} */
|
|
1542
|
+
this.__template,
|
|
1543
|
+
templateInfo
|
|
1544
|
+
);
|
|
1545
|
+
wrap(parentNode).insertBefore(this.__instance, this);
|
|
1546
|
+
}
|
|
1547
|
+
/**
|
|
1548
|
+
* Run effects for any properties that changed while the `if` was false.
|
|
1549
|
+
*
|
|
1550
|
+
* @return {void}
|
|
1551
|
+
*/
|
|
1552
|
+
__syncHostProperties() {
|
|
1553
|
+
const syncInfo = this.__syncInfo;
|
|
1554
|
+
if (syncInfo) {
|
|
1555
|
+
this.__syncInfo = null;
|
|
1556
|
+
syncInfo.runEffects(syncInfo.changedProps, false);
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
/**
|
|
1560
|
+
* Implementation of abstract API needed by DomIfBase.
|
|
1561
|
+
*
|
|
1562
|
+
* Remove the instance and any nodes it created. Uses the `__dataHost`'s
|
|
1563
|
+
* runtime `_removeBoundDom` method.
|
|
1564
|
+
*
|
|
1565
|
+
* @override
|
|
1566
|
+
* @return {void}
|
|
1567
|
+
*/
|
|
1568
|
+
__teardownInstance() {
|
|
1569
|
+
const host = this.__dataHost || this;
|
|
1570
|
+
if (this.__instance) {
|
|
1571
|
+
host._removeBoundDom(this.__instance);
|
|
1572
|
+
this.__instance = null;
|
|
1573
|
+
this.__syncInfo = null;
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
/**
|
|
1577
|
+
* Implementation of abstract API needed by DomIfBase.
|
|
1578
|
+
*
|
|
1579
|
+
* Shows or hides the template instance top level child nodes. For
|
|
1580
|
+
* text nodes, `textContent` is removed while "hidden" and replaced when
|
|
1581
|
+
* "shown."
|
|
1582
|
+
*
|
|
1583
|
+
* @override
|
|
1584
|
+
* @return {void}
|
|
1585
|
+
* @protected
|
|
1586
|
+
* @suppress {visibility}
|
|
1587
|
+
*/
|
|
1588
|
+
_showHideChildren() {
|
|
1589
|
+
const hidden = this.__hideTemplateChildren__ || !this.if;
|
|
1590
|
+
if (this.__instance && Boolean(this.__instance.__hidden) !== hidden) {
|
|
1591
|
+
this.__instance.__hidden = hidden;
|
|
1592
|
+
showHideChildren(hidden, this.__instance.templateInfo.childNodes);
|
|
1593
|
+
}
|
|
1594
|
+
if (!hidden) {
|
|
1595
|
+
this.__syncHostProperties();
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
};
|
|
1599
|
+
var DomIfLegacy = class extends DomIfBase {
|
|
1600
|
+
constructor() {
|
|
1601
|
+
super();
|
|
1602
|
+
this.__ctor = null;
|
|
1603
|
+
this.__instance = null;
|
|
1604
|
+
this.__invalidProps = null;
|
|
1605
|
+
}
|
|
1606
|
+
/**
|
|
1607
|
+
* Implementation of abstract API needed by DomIfBase.
|
|
1608
|
+
*
|
|
1609
|
+
* @override
|
|
1610
|
+
* @return {boolean} True when an instance has been created.
|
|
1611
|
+
*/
|
|
1612
|
+
__hasInstance() {
|
|
1613
|
+
return Boolean(this.__instance);
|
|
1614
|
+
}
|
|
1615
|
+
/**
|
|
1616
|
+
* Implementation of abstract API needed by DomIfBase.
|
|
1617
|
+
*
|
|
1618
|
+
* @override
|
|
1619
|
+
* @return {Array<Node>} Array of child nodes stamped from the template
|
|
1620
|
+
* instance.
|
|
1621
|
+
*/
|
|
1622
|
+
__getInstanceNodes() {
|
|
1623
|
+
return this.__instance.children;
|
|
1624
|
+
}
|
|
1625
|
+
/**
|
|
1626
|
+
* Implementation of abstract API needed by DomIfBase.
|
|
1627
|
+
*
|
|
1628
|
+
* Stamps the template by creating a new instance of the templatized
|
|
1629
|
+
* constructor (which is created lazily if it does not yet exist), and then
|
|
1630
|
+
* inserts its resulting `root` doc fragment into the given `parentNode`.
|
|
1631
|
+
*
|
|
1632
|
+
* @override
|
|
1633
|
+
* @param {Node} parentNode The parent node to insert the instance into
|
|
1634
|
+
* @return {void}
|
|
1635
|
+
*/
|
|
1636
|
+
__createAndInsertInstance(parentNode) {
|
|
1637
|
+
if (!this.__ctor) {
|
|
1638
|
+
this.__ctor = templatize(
|
|
1639
|
+
/** @type {!HTMLTemplateElement} */
|
|
1640
|
+
this.__template,
|
|
1641
|
+
this,
|
|
1642
|
+
{
|
|
1643
|
+
// dom-if templatizer instances require `mutable: true`, as
|
|
1644
|
+
// `__syncHostProperties` relies on that behavior to sync objects
|
|
1645
|
+
mutableData: true,
|
|
1646
|
+
/**
|
|
1647
|
+
* @param {string} prop Property to forward
|
|
1648
|
+
* @param {*} value Value of property
|
|
1649
|
+
* @this {DomIfLegacy}
|
|
1650
|
+
*/
|
|
1651
|
+
forwardHostProp: function(prop, value) {
|
|
1652
|
+
if (this.__instance) {
|
|
1653
|
+
if (this.if) {
|
|
1654
|
+
this.__instance.forwardHostProp(prop, value);
|
|
1655
|
+
} else {
|
|
1656
|
+
this.__invalidProps = this.__invalidProps || /* @__PURE__ */ Object.create(null);
|
|
1657
|
+
this.__invalidProps[root(prop)] = true;
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
);
|
|
1663
|
+
}
|
|
1664
|
+
this.__instance = new this.__ctor();
|
|
1665
|
+
wrap(parentNode).insertBefore(this.__instance.root, this);
|
|
1666
|
+
}
|
|
1667
|
+
/**
|
|
1668
|
+
* Implementation of abstract API needed by DomIfBase.
|
|
1669
|
+
*
|
|
1670
|
+
* Removes the instance and any nodes it created.
|
|
1671
|
+
*
|
|
1672
|
+
* @override
|
|
1673
|
+
* @return {void}
|
|
1674
|
+
*/
|
|
1675
|
+
__teardownInstance() {
|
|
1676
|
+
if (this.__instance) {
|
|
1677
|
+
let c$ = this.__instance.children;
|
|
1678
|
+
if (c$ && c$.length) {
|
|
1679
|
+
let parent = wrap(c$[0]).parentNode;
|
|
1680
|
+
if (parent) {
|
|
1681
|
+
parent = wrap(parent);
|
|
1682
|
+
for (let i = 0, n; i < c$.length && (n = c$[i]); i++) {
|
|
1683
|
+
parent.removeChild(n);
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
this.__invalidProps = null;
|
|
1688
|
+
this.__instance = null;
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
/**
|
|
1692
|
+
* Forwards any properties that changed while the `if` was false into the
|
|
1693
|
+
* template instance and flushes it.
|
|
1694
|
+
*
|
|
1695
|
+
* @return {void}
|
|
1696
|
+
*/
|
|
1697
|
+
__syncHostProperties() {
|
|
1698
|
+
let props = this.__invalidProps;
|
|
1699
|
+
if (props) {
|
|
1700
|
+
this.__invalidProps = null;
|
|
1701
|
+
for (let prop in props) {
|
|
1702
|
+
this.__instance._setPendingProperty(prop, this.__dataHost[prop]);
|
|
1703
|
+
}
|
|
1704
|
+
this.__instance._flushProperties();
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
/**
|
|
1708
|
+
* Implementation of abstract API needed by DomIfBase.
|
|
1709
|
+
*
|
|
1710
|
+
* Shows or hides the template instance top level child elements. For
|
|
1711
|
+
* text nodes, `textContent` is removed while "hidden" and replaced when
|
|
1712
|
+
* "shown."
|
|
1713
|
+
*
|
|
1714
|
+
* @override
|
|
1715
|
+
* @protected
|
|
1716
|
+
* @return {void}
|
|
1717
|
+
* @suppress {visibility}
|
|
1718
|
+
*/
|
|
1719
|
+
_showHideChildren() {
|
|
1720
|
+
const hidden = this.__hideTemplateChildren__ || !this.if;
|
|
1721
|
+
if (this.__instance && Boolean(this.__instance.__hidden) !== hidden) {
|
|
1722
|
+
this.__instance.__hidden = hidden;
|
|
1723
|
+
this.__instance._showHideChildren(hidden);
|
|
1724
|
+
}
|
|
1725
|
+
if (!hidden) {
|
|
1726
|
+
this.__syncHostProperties();
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
};
|
|
1730
|
+
var DomIf = fastDomIf ? DomIfFast : DomIfLegacy;
|
|
1731
|
+
customElements.define(DomIf.is, DomIf);
|
|
1732
|
+
|
|
1733
|
+
// ../../../node_modules/@polymer/polymer/lib/elements/array-selector.js
|
|
1734
|
+
var ArraySelectorMixin = dedupingMixin((superClass) => {
|
|
1735
|
+
let elementBase = ElementMixin(superClass);
|
|
1736
|
+
class ArraySelectorMixin2 extends elementBase {
|
|
1737
|
+
static get properties() {
|
|
1738
|
+
return {
|
|
1739
|
+
/**
|
|
1740
|
+
* An array containing items from which selection will be made.
|
|
1741
|
+
*/
|
|
1742
|
+
items: {
|
|
1743
|
+
type: Array
|
|
1744
|
+
},
|
|
1745
|
+
/**
|
|
1746
|
+
* When `true`, multiple items may be selected at once (in this case,
|
|
1747
|
+
* `selected` is an array of currently selected items). When `false`,
|
|
1748
|
+
* only one item may be selected at a time.
|
|
1749
|
+
*/
|
|
1750
|
+
multi: {
|
|
1751
|
+
type: Boolean,
|
|
1752
|
+
value: false
|
|
1753
|
+
},
|
|
1754
|
+
/**
|
|
1755
|
+
* When `multi` is true, this is an array that contains any selected.
|
|
1756
|
+
* When `multi` is false, this is the currently selected item, or `null`
|
|
1757
|
+
* if no item is selected.
|
|
1758
|
+
* @type {?Object|?Array<!Object>}
|
|
1759
|
+
*/
|
|
1760
|
+
selected: { type: Object, notify: true },
|
|
1761
|
+
/**
|
|
1762
|
+
* When `multi` is false, this is the currently selected item, or `null`
|
|
1763
|
+
* if no item is selected.
|
|
1764
|
+
* @type {?Object}
|
|
1765
|
+
*/
|
|
1766
|
+
selectedItem: { type: Object, notify: true },
|
|
1767
|
+
/**
|
|
1768
|
+
* When `true`, calling `select` on an item that is already selected
|
|
1769
|
+
* will deselect the item.
|
|
1770
|
+
*/
|
|
1771
|
+
toggle: { type: Boolean, value: false }
|
|
1772
|
+
};
|
|
1773
|
+
}
|
|
1774
|
+
static get observers() {
|
|
1775
|
+
return ["__updateSelection(multi, items.*)"];
|
|
1776
|
+
}
|
|
1777
|
+
constructor() {
|
|
1778
|
+
super();
|
|
1779
|
+
this.__lastItems = null;
|
|
1780
|
+
this.__lastMulti = null;
|
|
1781
|
+
this.__selectedMap = null;
|
|
1782
|
+
}
|
|
1783
|
+
__updateSelection(multi, itemsInfo) {
|
|
1784
|
+
let path = itemsInfo.path;
|
|
1785
|
+
if (path == JSCompiler_renameProperty("items", this)) {
|
|
1786
|
+
let newItems = itemsInfo.base || [];
|
|
1787
|
+
let lastItems = this.__lastItems;
|
|
1788
|
+
let lastMulti = this.__lastMulti;
|
|
1789
|
+
if (multi !== lastMulti) {
|
|
1790
|
+
this.clearSelection();
|
|
1791
|
+
}
|
|
1792
|
+
if (lastItems) {
|
|
1793
|
+
let splices = calculateSplices(newItems, lastItems);
|
|
1794
|
+
this.__applySplices(splices);
|
|
1795
|
+
}
|
|
1796
|
+
this.__lastItems = newItems;
|
|
1797
|
+
this.__lastMulti = multi;
|
|
1798
|
+
} else if (itemsInfo.path == `${JSCompiler_renameProperty("items", this)}.splices`) {
|
|
1799
|
+
this.__applySplices(itemsInfo.value.indexSplices);
|
|
1800
|
+
} else {
|
|
1801
|
+
let part = path.slice(`${JSCompiler_renameProperty("items", this)}.`.length);
|
|
1802
|
+
let idx = parseInt(part, 10);
|
|
1803
|
+
if (part.indexOf(".") < 0 && part == idx) {
|
|
1804
|
+
this.__deselectChangedIdx(idx);
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
__applySplices(splices) {
|
|
1809
|
+
let selected = this.__selectedMap;
|
|
1810
|
+
for (let i = 0; i < splices.length; i++) {
|
|
1811
|
+
let s = splices[i];
|
|
1812
|
+
selected.forEach((idx, item) => {
|
|
1813
|
+
if (idx < s.index) {
|
|
1814
|
+
} else if (idx >= s.index + s.removed.length) {
|
|
1815
|
+
selected.set(item, idx + s.addedCount - s.removed.length);
|
|
1816
|
+
} else {
|
|
1817
|
+
selected.set(item, -1);
|
|
1818
|
+
}
|
|
1819
|
+
});
|
|
1820
|
+
for (let j = 0; j < s.addedCount; j++) {
|
|
1821
|
+
let idx = s.index + j;
|
|
1822
|
+
if (selected.has(this.items[idx])) {
|
|
1823
|
+
selected.set(this.items[idx], idx);
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
this.__updateLinks();
|
|
1828
|
+
let sidx = 0;
|
|
1829
|
+
selected.forEach((idx, item) => {
|
|
1830
|
+
if (idx < 0) {
|
|
1831
|
+
if (this.multi) {
|
|
1832
|
+
this.splice(JSCompiler_renameProperty("selected", this), sidx, 1);
|
|
1833
|
+
} else {
|
|
1834
|
+
this.selected = this.selectedItem = null;
|
|
1835
|
+
}
|
|
1836
|
+
selected.delete(item);
|
|
1837
|
+
} else {
|
|
1838
|
+
sidx++;
|
|
1839
|
+
}
|
|
1840
|
+
});
|
|
1841
|
+
}
|
|
1842
|
+
__updateLinks() {
|
|
1843
|
+
this.__dataLinkedPaths = {};
|
|
1844
|
+
if (this.multi) {
|
|
1845
|
+
let sidx = 0;
|
|
1846
|
+
this.__selectedMap.forEach((idx) => {
|
|
1847
|
+
if (idx >= 0) {
|
|
1848
|
+
this.linkPaths(
|
|
1849
|
+
`${JSCompiler_renameProperty("items", this)}.${idx}`,
|
|
1850
|
+
`${JSCompiler_renameProperty("selected", this)}.${sidx++}`
|
|
1851
|
+
);
|
|
1852
|
+
}
|
|
1853
|
+
});
|
|
1854
|
+
} else {
|
|
1855
|
+
this.__selectedMap.forEach((idx) => {
|
|
1856
|
+
this.linkPaths(
|
|
1857
|
+
JSCompiler_renameProperty("selected", this),
|
|
1858
|
+
`${JSCompiler_renameProperty("items", this)}.${idx}`
|
|
1859
|
+
);
|
|
1860
|
+
this.linkPaths(
|
|
1861
|
+
JSCompiler_renameProperty("selectedItem", this),
|
|
1862
|
+
`${JSCompiler_renameProperty("items", this)}.${idx}`
|
|
1863
|
+
);
|
|
1864
|
+
});
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
/**
|
|
1868
|
+
* Clears the selection state.
|
|
1869
|
+
* @override
|
|
1870
|
+
* @return {void}
|
|
1871
|
+
*/
|
|
1872
|
+
clearSelection() {
|
|
1873
|
+
this.__dataLinkedPaths = {};
|
|
1874
|
+
this.__selectedMap = /* @__PURE__ */ new Map();
|
|
1875
|
+
this.selected = this.multi ? [] : null;
|
|
1876
|
+
this.selectedItem = null;
|
|
1877
|
+
}
|
|
1878
|
+
/**
|
|
1879
|
+
* Returns whether the item is currently selected.
|
|
1880
|
+
*
|
|
1881
|
+
* @override
|
|
1882
|
+
* @param {*} item Item from `items` array to test
|
|
1883
|
+
* @return {boolean} Whether the item is selected
|
|
1884
|
+
*/
|
|
1885
|
+
isSelected(item) {
|
|
1886
|
+
return this.__selectedMap.has(item);
|
|
1887
|
+
}
|
|
1888
|
+
/**
|
|
1889
|
+
* Returns whether the item is currently selected.
|
|
1890
|
+
*
|
|
1891
|
+
* @override
|
|
1892
|
+
* @param {number} idx Index from `items` array to test
|
|
1893
|
+
* @return {boolean} Whether the item is selected
|
|
1894
|
+
*/
|
|
1895
|
+
isIndexSelected(idx) {
|
|
1896
|
+
return this.isSelected(this.items[idx]);
|
|
1897
|
+
}
|
|
1898
|
+
__deselectChangedIdx(idx) {
|
|
1899
|
+
let sidx = this.__selectedIndexForItemIndex(idx);
|
|
1900
|
+
if (sidx >= 0) {
|
|
1901
|
+
let i = 0;
|
|
1902
|
+
this.__selectedMap.forEach((idx2, item) => {
|
|
1903
|
+
if (sidx == i++) {
|
|
1904
|
+
this.deselect(item);
|
|
1905
|
+
}
|
|
1906
|
+
});
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
__selectedIndexForItemIndex(idx) {
|
|
1910
|
+
let selected = this.__dataLinkedPaths[`${JSCompiler_renameProperty("items", this)}.${idx}`];
|
|
1911
|
+
if (selected) {
|
|
1912
|
+
return parseInt(selected.slice(`${JSCompiler_renameProperty("selected", this)}.`.length), 10);
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
/**
|
|
1916
|
+
* Deselects the given item if it is already selected.
|
|
1917
|
+
*
|
|
1918
|
+
* @override
|
|
1919
|
+
* @param {*} item Item from `items` array to deselect
|
|
1920
|
+
* @return {void}
|
|
1921
|
+
*/
|
|
1922
|
+
deselect(item) {
|
|
1923
|
+
let idx = this.__selectedMap.get(item);
|
|
1924
|
+
if (idx >= 0) {
|
|
1925
|
+
this.__selectedMap.delete(item);
|
|
1926
|
+
let sidx;
|
|
1927
|
+
if (this.multi) {
|
|
1928
|
+
sidx = this.__selectedIndexForItemIndex(idx);
|
|
1929
|
+
}
|
|
1930
|
+
this.__updateLinks();
|
|
1931
|
+
if (this.multi) {
|
|
1932
|
+
this.splice(JSCompiler_renameProperty("selected", this), sidx, 1);
|
|
1933
|
+
} else {
|
|
1934
|
+
this.selected = this.selectedItem = null;
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
/**
|
|
1939
|
+
* Deselects the given index if it is already selected.
|
|
1940
|
+
*
|
|
1941
|
+
* @override
|
|
1942
|
+
* @param {number} idx Index from `items` array to deselect
|
|
1943
|
+
* @return {void}
|
|
1944
|
+
*/
|
|
1945
|
+
deselectIndex(idx) {
|
|
1946
|
+
this.deselect(this.items[idx]);
|
|
1947
|
+
}
|
|
1948
|
+
/**
|
|
1949
|
+
* Selects the given item. When `toggle` is true, this will automatically
|
|
1950
|
+
* deselect the item if already selected.
|
|
1951
|
+
*
|
|
1952
|
+
* @override
|
|
1953
|
+
* @param {*} item Item from `items` array to select
|
|
1954
|
+
* @return {void}
|
|
1955
|
+
*/
|
|
1956
|
+
select(item) {
|
|
1957
|
+
this.selectIndex(this.items.indexOf(item));
|
|
1958
|
+
}
|
|
1959
|
+
/**
|
|
1960
|
+
* Selects the given index. When `toggle` is true, this will automatically
|
|
1961
|
+
* deselect the item if already selected.
|
|
1962
|
+
*
|
|
1963
|
+
* @override
|
|
1964
|
+
* @param {number} idx Index from `items` array to select
|
|
1965
|
+
* @return {void}
|
|
1966
|
+
*/
|
|
1967
|
+
selectIndex(idx) {
|
|
1968
|
+
let item = this.items[idx];
|
|
1969
|
+
if (!this.isSelected(item)) {
|
|
1970
|
+
if (!this.multi) {
|
|
1971
|
+
this.__selectedMap.clear();
|
|
1972
|
+
}
|
|
1973
|
+
this.__selectedMap.set(item, idx);
|
|
1974
|
+
this.__updateLinks();
|
|
1975
|
+
if (this.multi) {
|
|
1976
|
+
this.push(JSCompiler_renameProperty("selected", this), item);
|
|
1977
|
+
} else {
|
|
1978
|
+
this.selected = this.selectedItem = item;
|
|
1979
|
+
}
|
|
1980
|
+
} else if (this.toggle) {
|
|
1981
|
+
this.deselectIndex(idx);
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
return ArraySelectorMixin2;
|
|
1986
|
+
});
|
|
1987
|
+
var baseArraySelector = ArraySelectorMixin(PolymerElement);
|
|
1988
|
+
var ArraySelector = class extends baseArraySelector {
|
|
1989
|
+
// Not needed to find template; can be removed once the analyzer
|
|
1990
|
+
// can find the tag name from customElements.define call
|
|
1991
|
+
static get is() {
|
|
1992
|
+
return "array-selector";
|
|
1993
|
+
}
|
|
1994
|
+
static get template() {
|
|
1995
|
+
return null;
|
|
1996
|
+
}
|
|
1997
|
+
};
|
|
1998
|
+
customElements.define(ArraySelector.is, ArraySelector);
|
|
1999
|
+
|
|
2000
|
+
// ../../../node_modules/@webcomponents/shadycss/entrypoints/custom-style-interface.js
|
|
2001
|
+
var customStyleInterface = new CustomStyleInterface();
|
|
2002
|
+
if (!window.ShadyCSS) {
|
|
2003
|
+
window.ShadyCSS = {
|
|
2004
|
+
/**
|
|
2005
|
+
* @param {!HTMLTemplateElement} template
|
|
2006
|
+
* @param {string} elementName
|
|
2007
|
+
* @param {string=} elementExtends
|
|
2008
|
+
*/
|
|
2009
|
+
prepareTemplate(template, elementName, elementExtends) {
|
|
2010
|
+
},
|
|
2011
|
+
// eslint-disable-line no-unused-vars
|
|
2012
|
+
/**
|
|
2013
|
+
* @param {!HTMLTemplateElement} template
|
|
2014
|
+
* @param {string} elementName
|
|
2015
|
+
*/
|
|
2016
|
+
prepareTemplateDom(template, elementName) {
|
|
2017
|
+
},
|
|
2018
|
+
// eslint-disable-line no-unused-vars
|
|
2019
|
+
/**
|
|
2020
|
+
* @param {!HTMLTemplateElement} template
|
|
2021
|
+
* @param {string} elementName
|
|
2022
|
+
* @param {string=} elementExtends
|
|
2023
|
+
*/
|
|
2024
|
+
prepareTemplateStyles(template, elementName, elementExtends) {
|
|
2025
|
+
},
|
|
2026
|
+
// eslint-disable-line no-unused-vars
|
|
2027
|
+
/**
|
|
2028
|
+
* @param {Element} element
|
|
2029
|
+
* @param {Object=} properties
|
|
2030
|
+
*/
|
|
2031
|
+
styleSubtree(element, properties) {
|
|
2032
|
+
customStyleInterface.processStyles();
|
|
2033
|
+
updateNativeProperties(element, properties);
|
|
2034
|
+
},
|
|
2035
|
+
/**
|
|
2036
|
+
* @param {Element} element
|
|
2037
|
+
*/
|
|
2038
|
+
styleElement(element) {
|
|
2039
|
+
customStyleInterface.processStyles();
|
|
2040
|
+
},
|
|
2041
|
+
/**
|
|
2042
|
+
* @param {Object=} properties
|
|
2043
|
+
*/
|
|
2044
|
+
styleDocument(properties) {
|
|
2045
|
+
customStyleInterface.processStyles();
|
|
2046
|
+
updateNativeProperties(document.body, properties);
|
|
2047
|
+
},
|
|
2048
|
+
/**
|
|
2049
|
+
* @param {Element} element
|
|
2050
|
+
* @param {string} property
|
|
2051
|
+
* @return {string}
|
|
2052
|
+
*/
|
|
2053
|
+
getComputedStyleValue(element, property) {
|
|
2054
|
+
return getComputedStyleValue(element, property);
|
|
2055
|
+
},
|
|
2056
|
+
flushCustomStyles() {
|
|
2057
|
+
},
|
|
2058
|
+
nativeCss: nativeCssVariables,
|
|
2059
|
+
nativeShadow,
|
|
2060
|
+
cssBuild,
|
|
2061
|
+
disableRuntime
|
|
2062
|
+
};
|
|
2063
|
+
}
|
|
2064
|
+
window.ShadyCSS.CustomStyleInterface = customStyleInterface;
|
|
2065
|
+
|
|
2066
|
+
// ../../../node_modules/@polymer/polymer/lib/elements/custom-style.js
|
|
2067
|
+
var attr = "include";
|
|
2068
|
+
var CustomStyleInterface2 = window.ShadyCSS.CustomStyleInterface;
|
|
2069
|
+
var CustomStyle = class extends HTMLElement {
|
|
2070
|
+
constructor() {
|
|
2071
|
+
super();
|
|
2072
|
+
this._style = null;
|
|
2073
|
+
CustomStyleInterface2.addCustomStyle(this);
|
|
2074
|
+
}
|
|
2075
|
+
/**
|
|
2076
|
+
* Returns the light-DOM `<style>` child this element wraps. Upon first
|
|
2077
|
+
* call any style modules referenced via the `include` attribute will be
|
|
2078
|
+
* concatenated to this element's `<style>`.
|
|
2079
|
+
*
|
|
2080
|
+
* @export
|
|
2081
|
+
* @return {HTMLStyleElement} This element's light-DOM `<style>`
|
|
2082
|
+
*/
|
|
2083
|
+
getStyle() {
|
|
2084
|
+
if (this._style) {
|
|
2085
|
+
return this._style;
|
|
2086
|
+
}
|
|
2087
|
+
const style = (
|
|
2088
|
+
/** @type {HTMLStyleElement} */
|
|
2089
|
+
this.querySelector("style")
|
|
2090
|
+
);
|
|
2091
|
+
if (!style) {
|
|
2092
|
+
return null;
|
|
2093
|
+
}
|
|
2094
|
+
this._style = style;
|
|
2095
|
+
const include = style.getAttribute(attr);
|
|
2096
|
+
if (include) {
|
|
2097
|
+
style.removeAttribute(attr);
|
|
2098
|
+
style.textContent = cssFromModules(include) + style.textContent;
|
|
2099
|
+
}
|
|
2100
|
+
if (this.ownerDocument !== window.document) {
|
|
2101
|
+
window.document.head.appendChild(this);
|
|
2102
|
+
}
|
|
2103
|
+
return this._style;
|
|
2104
|
+
}
|
|
2105
|
+
};
|
|
2106
|
+
window.customElements.define("custom-style", CustomStyle);
|
|
2107
|
+
|
|
2108
|
+
// ../../../node_modules/@polymer/polymer/lib/legacy/mutable-data-behavior.js
|
|
2109
|
+
var mutablePropertyChange2;
|
|
2110
|
+
(() => {
|
|
2111
|
+
mutablePropertyChange2 = MutableData._mutablePropertyChange;
|
|
2112
|
+
})();
|
|
2113
|
+
|
|
2114
|
+
// ../../../node_modules/@polymer/polymer/polymer-legacy.js
|
|
2115
|
+
var Base = LegacyElementMixin(HTMLElement).prototype;
|
|
2116
|
+
|
|
2117
|
+
// ../../../node_modules/@polymer/iron-resizable-behavior/iron-resizable-behavior.js
|
|
2118
|
+
var ORPHANS = /* @__PURE__ */ new Set();
|
|
2119
|
+
var IronResizableBehavior = {
|
|
2120
|
+
properties: {
|
|
2121
|
+
/**
|
|
2122
|
+
* The closest ancestor element that implements `IronResizableBehavior`.
|
|
2123
|
+
*/
|
|
2124
|
+
_parentResizable: {
|
|
2125
|
+
type: Object,
|
|
2126
|
+
observer: "_parentResizableChanged"
|
|
2127
|
+
},
|
|
2128
|
+
/**
|
|
2129
|
+
* True if this element is currently notifying its descendant elements of
|
|
2130
|
+
* resize.
|
|
2131
|
+
*/
|
|
2132
|
+
_notifyingDescendant: {
|
|
2133
|
+
type: Boolean,
|
|
2134
|
+
value: false
|
|
2135
|
+
}
|
|
2136
|
+
},
|
|
2137
|
+
listeners: {
|
|
2138
|
+
"iron-request-resize-notifications": "_onIronRequestResizeNotifications"
|
|
2139
|
+
},
|
|
2140
|
+
created: function() {
|
|
2141
|
+
this._interestedResizables = [];
|
|
2142
|
+
this._boundNotifyResize = this.notifyResize.bind(this);
|
|
2143
|
+
this._boundOnDescendantIronResize = this._onDescendantIronResize.bind(this);
|
|
2144
|
+
},
|
|
2145
|
+
attached: function() {
|
|
2146
|
+
this._requestResizeNotifications();
|
|
2147
|
+
},
|
|
2148
|
+
detached: function() {
|
|
2149
|
+
if (this._parentResizable) {
|
|
2150
|
+
this._parentResizable.stopResizeNotificationsFor(this);
|
|
2151
|
+
} else {
|
|
2152
|
+
ORPHANS.delete(this);
|
|
2153
|
+
window.removeEventListener("resize", this._boundNotifyResize);
|
|
2154
|
+
}
|
|
2155
|
+
this._parentResizable = null;
|
|
2156
|
+
},
|
|
2157
|
+
/**
|
|
2158
|
+
* Can be called to manually notify a resizable and its descendant
|
|
2159
|
+
* resizables of a resize change.
|
|
2160
|
+
*/
|
|
2161
|
+
notifyResize: function() {
|
|
2162
|
+
if (!this.isAttached) {
|
|
2163
|
+
return;
|
|
2164
|
+
}
|
|
2165
|
+
this._interestedResizables.forEach(function(resizable) {
|
|
2166
|
+
if (this.resizerShouldNotify(resizable)) {
|
|
2167
|
+
this._notifyDescendant(resizable);
|
|
2168
|
+
}
|
|
2169
|
+
}, this);
|
|
2170
|
+
this._fireResize();
|
|
2171
|
+
},
|
|
2172
|
+
/**
|
|
2173
|
+
* Used to assign the closest resizable ancestor to this resizable
|
|
2174
|
+
* if the ancestor detects a request for notifications.
|
|
2175
|
+
*/
|
|
2176
|
+
assignParentResizable: function(parentResizable) {
|
|
2177
|
+
if (this._parentResizable) {
|
|
2178
|
+
this._parentResizable.stopResizeNotificationsFor(this);
|
|
2179
|
+
}
|
|
2180
|
+
this._parentResizable = parentResizable;
|
|
2181
|
+
if (parentResizable && parentResizable._interestedResizables.indexOf(this) === -1) {
|
|
2182
|
+
parentResizable._interestedResizables.push(this);
|
|
2183
|
+
parentResizable._subscribeIronResize(this);
|
|
2184
|
+
}
|
|
2185
|
+
},
|
|
2186
|
+
/**
|
|
2187
|
+
* Used to remove a resizable descendant from the list of descendants
|
|
2188
|
+
* that should be notified of a resize change.
|
|
2189
|
+
*/
|
|
2190
|
+
stopResizeNotificationsFor: function(target) {
|
|
2191
|
+
var index = this._interestedResizables.indexOf(target);
|
|
2192
|
+
if (index > -1) {
|
|
2193
|
+
this._interestedResizables.splice(index, 1);
|
|
2194
|
+
this._unsubscribeIronResize(target);
|
|
2195
|
+
}
|
|
2196
|
+
},
|
|
2197
|
+
/**
|
|
2198
|
+
* Subscribe this element to listen to iron-resize events on the given target.
|
|
2199
|
+
*
|
|
2200
|
+
* Preferred over target.listen because the property renamer does not
|
|
2201
|
+
* understand to rename when the target is not specifically "this"
|
|
2202
|
+
*
|
|
2203
|
+
* @param {!HTMLElement} target Element to listen to for iron-resize events.
|
|
2204
|
+
*/
|
|
2205
|
+
_subscribeIronResize: function(target) {
|
|
2206
|
+
target.addEventListener("iron-resize", this._boundOnDescendantIronResize);
|
|
2207
|
+
},
|
|
2208
|
+
/**
|
|
2209
|
+
* Unsubscribe this element from listening to to iron-resize events on the
|
|
2210
|
+
* given target.
|
|
2211
|
+
*
|
|
2212
|
+
* Preferred over target.unlisten because the property renamer does not
|
|
2213
|
+
* understand to rename when the target is not specifically "this"
|
|
2214
|
+
*
|
|
2215
|
+
* @param {!HTMLElement} target Element to listen to for iron-resize events.
|
|
2216
|
+
*/
|
|
2217
|
+
_unsubscribeIronResize: function(target) {
|
|
2218
|
+
target.removeEventListener(
|
|
2219
|
+
"iron-resize",
|
|
2220
|
+
this._boundOnDescendantIronResize
|
|
2221
|
+
);
|
|
2222
|
+
},
|
|
2223
|
+
/**
|
|
2224
|
+
* This method can be overridden to filter nested elements that should or
|
|
2225
|
+
* should not be notified by the current element. Return true if an element
|
|
2226
|
+
* should be notified, or false if it should not be notified.
|
|
2227
|
+
*
|
|
2228
|
+
* @param {HTMLElement} element A candidate descendant element that
|
|
2229
|
+
* implements `IronResizableBehavior`.
|
|
2230
|
+
* @return {boolean} True if the `element` should be notified of resize.
|
|
2231
|
+
*/
|
|
2232
|
+
resizerShouldNotify: function(element) {
|
|
2233
|
+
return true;
|
|
2234
|
+
},
|
|
2235
|
+
_onDescendantIronResize: function(event) {
|
|
2236
|
+
if (this._notifyingDescendant) {
|
|
2237
|
+
event.stopPropagation();
|
|
2238
|
+
return;
|
|
2239
|
+
}
|
|
2240
|
+
if (!useShadow) {
|
|
2241
|
+
this._fireResize();
|
|
2242
|
+
}
|
|
2243
|
+
},
|
|
2244
|
+
_fireResize: function() {
|
|
2245
|
+
this.fire("iron-resize", null, { node: this, bubbles: false });
|
|
2246
|
+
},
|
|
2247
|
+
_onIronRequestResizeNotifications: function(event) {
|
|
2248
|
+
var target = (
|
|
2249
|
+
/** @type {!EventTarget} */
|
|
2250
|
+
dom(event).rootTarget
|
|
2251
|
+
);
|
|
2252
|
+
if (target === this) {
|
|
2253
|
+
return;
|
|
2254
|
+
}
|
|
2255
|
+
target.assignParentResizable(this);
|
|
2256
|
+
this._notifyDescendant(target);
|
|
2257
|
+
event.stopPropagation();
|
|
2258
|
+
},
|
|
2259
|
+
_parentResizableChanged: function(parentResizable) {
|
|
2260
|
+
if (parentResizable) {
|
|
2261
|
+
window.removeEventListener("resize", this._boundNotifyResize);
|
|
2262
|
+
}
|
|
2263
|
+
},
|
|
2264
|
+
_notifyDescendant: function(descendant) {
|
|
2265
|
+
if (!this.isAttached) {
|
|
2266
|
+
return;
|
|
2267
|
+
}
|
|
2268
|
+
this._notifyingDescendant = true;
|
|
2269
|
+
descendant.notifyResize();
|
|
2270
|
+
this._notifyingDescendant = false;
|
|
2271
|
+
},
|
|
2272
|
+
_requestResizeNotifications: function() {
|
|
2273
|
+
if (!this.isAttached) {
|
|
2274
|
+
return;
|
|
2275
|
+
}
|
|
2276
|
+
if (document.readyState === "loading") {
|
|
2277
|
+
var _requestResizeNotifications = this._requestResizeNotifications.bind(this);
|
|
2278
|
+
document.addEventListener(
|
|
2279
|
+
"readystatechange",
|
|
2280
|
+
function readystatechanged() {
|
|
2281
|
+
document.removeEventListener("readystatechange", readystatechanged);
|
|
2282
|
+
_requestResizeNotifications();
|
|
2283
|
+
}
|
|
2284
|
+
);
|
|
2285
|
+
} else {
|
|
2286
|
+
this._findParent();
|
|
2287
|
+
if (!this._parentResizable) {
|
|
2288
|
+
ORPHANS.forEach(function(orphan) {
|
|
2289
|
+
if (orphan !== this) {
|
|
2290
|
+
orphan._findParent();
|
|
2291
|
+
}
|
|
2292
|
+
}, this);
|
|
2293
|
+
window.addEventListener("resize", this._boundNotifyResize);
|
|
2294
|
+
this.notifyResize();
|
|
2295
|
+
} else {
|
|
2296
|
+
this._parentResizable._interestedResizables.forEach(function(resizable) {
|
|
2297
|
+
if (resizable !== this) {
|
|
2298
|
+
resizable._findParent();
|
|
2299
|
+
}
|
|
2300
|
+
}, this);
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
},
|
|
2304
|
+
_findParent: function() {
|
|
2305
|
+
this.assignParentResizable(null);
|
|
2306
|
+
this.fire(
|
|
2307
|
+
"iron-request-resize-notifications",
|
|
2308
|
+
null,
|
|
2309
|
+
{ node: this, bubbles: true, cancelable: true }
|
|
2310
|
+
);
|
|
2311
|
+
if (!this._parentResizable) {
|
|
2312
|
+
ORPHANS.add(this);
|
|
2313
|
+
} else {
|
|
2314
|
+
ORPHANS.delete(this);
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2317
|
+
};
|
|
2318
|
+
export {
|
|
2319
|
+
IronResizableBehavior
|
|
2320
|
+
};
|
|
2321
|
+
//# sourceMappingURL=@polymer_iron-resizable-behavior_iron-resizable-behavior__js.js.map
|