@converse/skeletor 0.0.3 → 0.0.6
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/README.md +70 -7
- package/dist/skeletor.js +508 -1048
- package/dist/skeletor.js.map +1 -1
- package/dist/skeletor.min.js +4 -93
- package/dist/skeletor.min.js.map +1 -1
- package/package.json +6 -7
- package/src/collection.js +1 -1
- package/src/drivers/indexeddb-getitems.js~ +1116 -0
- package/src/drivers/indexeddb.js~ +1115 -0
- package/src/storage.js +11 -8
- package/src/storage.js~ +13 -9
- package/CHANGES.md +0 -26
- package/dist/skeletor.js~ +0 -2291
- package/src/.events.js.swp +0 -0
- package/src/.helpers.js.swp +0 -0
- package/src/.history.js.swp +0 -0
- package/src/.model.js.swp +0 -0
- package/src/.overview.js.swp +0 -0
- package/src/.router.js.swp +0 -0
- package/src/.view.js.swp +0 -0
- package/src/collection.js~ +0 -737
- package/src/drivers/.sessionStorage.js.swp +0 -0
- package/src/drivers/sessionStorage.js~ +0 -316
- package/src/element-overview.js~ +0 -4
- package/src/element.js~ +0 -190
- package/src/events.js~ +0 -334
- package/src/helpers.js~ +0 -151
- package/src/history.js~ +0 -301
- package/src/htmlview.js~ +0 -14
- package/src/model.js~ +0 -439
- package/src/orderedlist.js~ +0 -88
- package/src/overview.js~ +0 -111
- package/src/router.js~ +0 -119
- package/src/vdomview.js~ +0 -15
- package/src/view.js~ +0 -283
package/dist/skeletor.js
CHANGED
|
@@ -1323,7 +1323,7 @@
|
|
|
1323
1323
|
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
|
1324
1324
|
*/
|
|
1325
1325
|
|
|
1326
|
-
function keysIn
|
|
1326
|
+
function keysIn(object) {
|
|
1327
1327
|
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
|
1328
1328
|
}
|
|
1329
1329
|
|
|
@@ -1360,7 +1360,7 @@
|
|
|
1360
1360
|
*/
|
|
1361
1361
|
|
|
1362
1362
|
var assignIn = createAssigner(function (object, source) {
|
|
1363
|
-
copyObject(source, keysIn
|
|
1363
|
+
copyObject(source, keysIn(source), object);
|
|
1364
1364
|
});
|
|
1365
1365
|
|
|
1366
1366
|
/** Used for built-in method references. */
|
|
@@ -1716,7 +1716,7 @@
|
|
|
1716
1716
|
|
|
1717
1717
|
/* Built-in method references that are verified to be native. */
|
|
1718
1718
|
|
|
1719
|
-
var Map
|
|
1719
|
+
var Map = getNative(root, 'Map');
|
|
1720
1720
|
|
|
1721
1721
|
/**
|
|
1722
1722
|
* Removes all key-value entries from the map.
|
|
@@ -1730,7 +1730,7 @@
|
|
|
1730
1730
|
this.size = 0;
|
|
1731
1731
|
this.__data__ = {
|
|
1732
1732
|
'hash': new Hash(),
|
|
1733
|
-
'map': new (Map
|
|
1733
|
+
'map': new (Map || ListCache)(),
|
|
1734
1734
|
'string': new Hash()
|
|
1735
1735
|
};
|
|
1736
1736
|
}
|
|
@@ -1903,7 +1903,7 @@
|
|
|
1903
1903
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
1904
1904
|
}
|
|
1905
1905
|
|
|
1906
|
-
var memoized = function
|
|
1906
|
+
var memoized = function () {
|
|
1907
1907
|
var args = arguments,
|
|
1908
1908
|
key = resolver ? resolver.apply(this, args) : args[0],
|
|
1909
1909
|
cache = memoized.cache;
|
|
@@ -2232,7 +2232,7 @@
|
|
|
2232
2232
|
if (protoProps && has(protoProps, 'constructor')) {
|
|
2233
2233
|
child = protoProps.constructor;
|
|
2234
2234
|
} else {
|
|
2235
|
-
child = function
|
|
2235
|
+
child = function () {
|
|
2236
2236
|
return parent.apply(this, arguments);
|
|
2237
2237
|
};
|
|
2238
2238
|
} // Add static properties to the constructor function, if supplied.
|
|
@@ -2376,7 +2376,7 @@
|
|
|
2376
2376
|
/** Used to detect maps, sets, and weakmaps. */
|
|
2377
2377
|
|
|
2378
2378
|
var dataViewCtorString = toSource(DataView),
|
|
2379
|
-
mapCtorString = toSource(Map
|
|
2379
|
+
mapCtorString = toSource(Map),
|
|
2380
2380
|
promiseCtorString = toSource(Promise$1),
|
|
2381
2381
|
setCtorString = toSource(Set),
|
|
2382
2382
|
weakMapCtorString = toSource(WeakMap$1);
|
|
@@ -2390,8 +2390,8 @@
|
|
|
2390
2390
|
|
|
2391
2391
|
var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
|
2392
2392
|
|
|
2393
|
-
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$1 || Map
|
|
2394
|
-
getTag = function
|
|
2393
|
+
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$1 || Map && getTag(new Map()) != mapTag$1 || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set && getTag(new Set()) != setTag$1 || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag$1) {
|
|
2394
|
+
getTag = function (value) {
|
|
2395
2395
|
var result = baseGetTag(value),
|
|
2396
2396
|
Ctor = result == objectTag$1 ? value.constructor : undefined,
|
|
2397
2397
|
ctorString = Ctor ? toSource(Ctor) : '';
|
|
@@ -2493,12 +2493,43 @@
|
|
|
2493
2493
|
return true;
|
|
2494
2494
|
}
|
|
2495
2495
|
|
|
2496
|
+
/** Used to match a single whitespace character. */
|
|
2497
|
+
var reWhitespace = /\s/;
|
|
2498
|
+
/**
|
|
2499
|
+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
2500
|
+
* character of `string`.
|
|
2501
|
+
*
|
|
2502
|
+
* @private
|
|
2503
|
+
* @param {string} string The string to inspect.
|
|
2504
|
+
* @returns {number} Returns the index of the last non-whitespace character.
|
|
2505
|
+
*/
|
|
2506
|
+
|
|
2507
|
+
function trimmedEndIndex(string) {
|
|
2508
|
+
var index = string.length;
|
|
2509
|
+
|
|
2510
|
+
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
|
2511
|
+
|
|
2512
|
+
return index;
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
/** Used to match leading whitespace. */
|
|
2516
|
+
|
|
2517
|
+
var reTrimStart = /^\s+/;
|
|
2518
|
+
/**
|
|
2519
|
+
* The base implementation of `_.trim`.
|
|
2520
|
+
*
|
|
2521
|
+
* @private
|
|
2522
|
+
* @param {string} string The string to trim.
|
|
2523
|
+
* @returns {string} Returns the trimmed string.
|
|
2524
|
+
*/
|
|
2525
|
+
|
|
2526
|
+
function baseTrim(string) {
|
|
2527
|
+
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') : string;
|
|
2528
|
+
}
|
|
2529
|
+
|
|
2496
2530
|
/** Used as references for various `Number` constants. */
|
|
2497
2531
|
|
|
2498
2532
|
var NAN = 0 / 0;
|
|
2499
|
-
/** Used to match leading and trailing whitespace. */
|
|
2500
|
-
|
|
2501
|
-
var reTrim = /^\s+|\s+$/g;
|
|
2502
2533
|
/** Used to detect bad signed hexadecimal string values. */
|
|
2503
2534
|
|
|
2504
2535
|
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
@@ -2553,7 +2584,7 @@
|
|
|
2553
2584
|
return value === 0 ? value : +value;
|
|
2554
2585
|
}
|
|
2555
2586
|
|
|
2556
|
-
value = value
|
|
2587
|
+
value = baseTrim(value);
|
|
2557
2588
|
var isBinary = reIsBinary.test(value);
|
|
2558
2589
|
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
2559
2590
|
}
|
|
@@ -2735,7 +2766,7 @@
|
|
|
2735
2766
|
// maps `{event: callback}`).
|
|
2736
2767
|
|
|
2737
2768
|
|
|
2738
|
-
const eventsApi = function
|
|
2769
|
+
const eventsApi = function (iteratee, events, name, callback, opts) {
|
|
2739
2770
|
let i = 0,
|
|
2740
2771
|
names;
|
|
2741
2772
|
|
|
@@ -2804,7 +2835,7 @@
|
|
|
2804
2835
|
}; // The reducing API that adds a callback to the `events` object.
|
|
2805
2836
|
|
|
2806
2837
|
|
|
2807
|
-
const onApi = function
|
|
2838
|
+
const onApi = function (events, name, callback, options) {
|
|
2808
2839
|
if (callback) {
|
|
2809
2840
|
const handlers = events[name] || (events[name] = []);
|
|
2810
2841
|
const context = options.context,
|
|
@@ -2824,7 +2855,7 @@
|
|
|
2824
2855
|
// `_listening` variable.
|
|
2825
2856
|
|
|
2826
2857
|
|
|
2827
|
-
const tryCatchOn = function
|
|
2858
|
+
const tryCatchOn = function (obj, name, callback, context) {
|
|
2828
2859
|
try {
|
|
2829
2860
|
obj.on(name, callback, context);
|
|
2830
2861
|
} catch (e) {
|
|
@@ -2866,7 +2897,7 @@
|
|
|
2866
2897
|
}; // The reducing API that removes a callback from the `events` object.
|
|
2867
2898
|
|
|
2868
2899
|
|
|
2869
|
-
const offApi = function
|
|
2900
|
+
const offApi = function (events, name, callback, options) {
|
|
2870
2901
|
if (!events) return;
|
|
2871
2902
|
const context = options.context,
|
|
2872
2903
|
listeners = options.listeners;
|
|
@@ -2936,7 +2967,7 @@
|
|
|
2936
2967
|
// `offer` unbinds the `onceWrapper` after it has been called.
|
|
2937
2968
|
|
|
2938
2969
|
|
|
2939
|
-
const onceMap = function
|
|
2970
|
+
const onceMap = function (map, name, callback, offer) {
|
|
2940
2971
|
if (callback) {
|
|
2941
2972
|
const _once = map[name] = once(function () {
|
|
2942
2973
|
offer(name, _once);
|
|
@@ -2965,7 +2996,7 @@
|
|
|
2965
2996
|
}; // Handles triggering the appropriate event callbacks.
|
|
2966
2997
|
|
|
2967
2998
|
|
|
2968
|
-
const triggerApi = function
|
|
2999
|
+
const triggerApi = function (objEvents, name, callback, args) {
|
|
2969
3000
|
if (objEvents) {
|
|
2970
3001
|
const events = objEvents[name];
|
|
2971
3002
|
let allEvents = objEvents.all;
|
|
@@ -2980,7 +3011,7 @@
|
|
|
2980
3011
|
// Backbone events have 3 arguments).
|
|
2981
3012
|
|
|
2982
3013
|
|
|
2983
|
-
const triggerEvents = function
|
|
3014
|
+
const triggerEvents = function (events, args) {
|
|
2984
3015
|
let ev,
|
|
2985
3016
|
i = -1;
|
|
2986
3017
|
const l = events.length,
|
|
@@ -3018,7 +3049,7 @@
|
|
|
3018
3049
|
// when all callbacks have been offed.
|
|
3019
3050
|
|
|
3020
3051
|
|
|
3021
|
-
const Listening = function
|
|
3052
|
+
const Listening = function (listener, obj) {
|
|
3022
3053
|
this.id = listener._listenId;
|
|
3023
3054
|
this.listener = listener;
|
|
3024
3055
|
this.obj = obj;
|
|
@@ -3134,7 +3165,7 @@
|
|
|
3134
3165
|
if (data instanceof ListCache) {
|
|
3135
3166
|
var pairs = data.__data__;
|
|
3136
3167
|
|
|
3137
|
-
if (!Map
|
|
3168
|
+
if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
3138
3169
|
pairs.push([key, value]);
|
|
3139
3170
|
this.size = ++data.size;
|
|
3140
3171
|
return this;
|
|
@@ -3201,7 +3232,7 @@
|
|
|
3201
3232
|
*/
|
|
3202
3233
|
|
|
3203
3234
|
function baseAssignIn(object, source) {
|
|
3204
|
-
return object && copyObject(source, keysIn
|
|
3235
|
+
return object && copyObject(source, keysIn(source), object);
|
|
3205
3236
|
}
|
|
3206
3237
|
|
|
3207
3238
|
/** Detect free variable `exports`. */
|
|
@@ -3444,7 +3475,7 @@
|
|
|
3444
3475
|
*/
|
|
3445
3476
|
|
|
3446
3477
|
function getAllKeysIn(object) {
|
|
3447
|
-
return baseGetAllKeys(object, keysIn
|
|
3478
|
+
return baseGetAllKeys(object, keysIn, getSymbolsIn);
|
|
3448
3479
|
}
|
|
3449
3480
|
|
|
3450
3481
|
/** Used for built-in method references. */
|
|
@@ -3927,7 +3958,7 @@
|
|
|
3927
3958
|
|
|
3928
3959
|
while (++index < length) {
|
|
3929
3960
|
var source = sources[index];
|
|
3930
|
-
var props = keysIn
|
|
3961
|
+
var props = keysIn(source);
|
|
3931
3962
|
var propsIndex = -1;
|
|
3932
3963
|
var propsLength = props.length;
|
|
3933
3964
|
|
|
@@ -4381,13 +4412,14 @@
|
|
|
4381
4412
|
|
|
4382
4413
|
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
4383
4414
|
return false;
|
|
4384
|
-
} //
|
|
4415
|
+
} // Check that cyclic values are equal.
|
|
4385
4416
|
|
|
4386
4417
|
|
|
4387
|
-
var
|
|
4418
|
+
var arrStacked = stack.get(array);
|
|
4419
|
+
var othStacked = stack.get(other);
|
|
4388
4420
|
|
|
4389
|
-
if (
|
|
4390
|
-
return
|
|
4421
|
+
if (arrStacked && othStacked) {
|
|
4422
|
+
return arrStacked == other && othStacked == array;
|
|
4391
4423
|
}
|
|
4392
4424
|
|
|
4393
4425
|
var index = -1,
|
|
@@ -4616,13 +4648,14 @@
|
|
|
4616
4648
|
if (!(isPartial ? key in other : hasOwnProperty$e.call(other, key))) {
|
|
4617
4649
|
return false;
|
|
4618
4650
|
}
|
|
4619
|
-
} //
|
|
4651
|
+
} // Check that cyclic values are equal.
|
|
4620
4652
|
|
|
4621
4653
|
|
|
4622
|
-
var
|
|
4654
|
+
var objStacked = stack.get(object);
|
|
4655
|
+
var othStacked = stack.get(other);
|
|
4623
4656
|
|
|
4624
|
-
if (
|
|
4625
|
-
return
|
|
4657
|
+
if (objStacked && othStacked) {
|
|
4658
|
+
return objStacked == other && othStacked == object;
|
|
4626
4659
|
}
|
|
4627
4660
|
|
|
4628
4661
|
var result = true;
|
|
@@ -5436,6 +5469,10 @@
|
|
|
5436
5469
|
var key = toKey(path[index]),
|
|
5437
5470
|
newValue = value;
|
|
5438
5471
|
|
|
5472
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
5473
|
+
return object;
|
|
5474
|
+
}
|
|
5475
|
+
|
|
5439
5476
|
if (index != lastIndex) {
|
|
5440
5477
|
var objValue = nested[key];
|
|
5441
5478
|
newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
|
@@ -5518,7 +5555,7 @@
|
|
|
5518
5555
|
});
|
|
5519
5556
|
|
|
5520
5557
|
// Backbone.js 1.4.0
|
|
5521
|
-
const Model = function
|
|
5558
|
+
const Model = function (attributes, options) {
|
|
5522
5559
|
let attrs = attributes || {};
|
|
5523
5560
|
options || (options = {});
|
|
5524
5561
|
this.preinitialize.apply(this, arguments);
|
|
@@ -5547,72 +5584,72 @@
|
|
|
5547
5584
|
cidPrefix: 'c',
|
|
5548
5585
|
// preinitialize is an empty function by default. You can override it with a function
|
|
5549
5586
|
// or object. preinitialize will run before any instantiation logic is run in the Model.
|
|
5550
|
-
preinitialize: function
|
|
5587
|
+
preinitialize: function () {},
|
|
5551
5588
|
// Initialize is an empty function by default. Override it with your own
|
|
5552
5589
|
// initialization logic.
|
|
5553
|
-
initialize: function
|
|
5590
|
+
initialize: function () {},
|
|
5554
5591
|
// Return a copy of the model's `attributes` object.
|
|
5555
|
-
toJSON: function
|
|
5592
|
+
toJSON: function (options) {
|
|
5556
5593
|
return clone(this.attributes);
|
|
5557
5594
|
},
|
|
5558
5595
|
// Proxy `Backbone.sync` by default -- but override this if you need
|
|
5559
5596
|
// custom syncing semantics for *this* particular model.
|
|
5560
|
-
sync: function
|
|
5597
|
+
sync: function (method, model, options) {
|
|
5561
5598
|
return getSyncMethod(this)(method, model, options);
|
|
5562
5599
|
},
|
|
5563
5600
|
// Get the value of an attribute.
|
|
5564
|
-
get: function
|
|
5601
|
+
get: function (attr) {
|
|
5565
5602
|
return this.attributes[attr];
|
|
5566
5603
|
},
|
|
5567
|
-
keys: function
|
|
5604
|
+
keys: function () {
|
|
5568
5605
|
return Object.keys(this.attributes);
|
|
5569
5606
|
},
|
|
5570
|
-
values: function
|
|
5607
|
+
values: function () {
|
|
5571
5608
|
return Object.values(this.attributes);
|
|
5572
5609
|
},
|
|
5573
|
-
pairs: function
|
|
5610
|
+
pairs: function () {
|
|
5574
5611
|
return this.entries();
|
|
5575
5612
|
},
|
|
5576
|
-
entries: function
|
|
5613
|
+
entries: function () {
|
|
5577
5614
|
return Object.entries(this.attributes);
|
|
5578
5615
|
},
|
|
5579
|
-
invert: function
|
|
5616
|
+
invert: function () {
|
|
5580
5617
|
return invert(this.attributes);
|
|
5581
5618
|
},
|
|
5582
|
-
pick: function
|
|
5619
|
+
pick: function (...args) {
|
|
5583
5620
|
if (args.length === 1 && Array.isArray(args[0])) {
|
|
5584
5621
|
args = args[0];
|
|
5585
5622
|
}
|
|
5586
5623
|
|
|
5587
5624
|
return pick(this.attributes, args);
|
|
5588
5625
|
},
|
|
5589
|
-
omit: function
|
|
5626
|
+
omit: function (...args) {
|
|
5590
5627
|
if (args.length === 1 && Array.isArray(args[0])) {
|
|
5591
5628
|
args = args[0];
|
|
5592
5629
|
}
|
|
5593
5630
|
|
|
5594
5631
|
return omit(this.attributes, args);
|
|
5595
5632
|
},
|
|
5596
|
-
isEmpty: function
|
|
5633
|
+
isEmpty: function () {
|
|
5597
5634
|
return isEmpty(this.attributes);
|
|
5598
5635
|
},
|
|
5599
5636
|
// Get the HTML-escaped value of an attribute.
|
|
5600
|
-
escape: function
|
|
5637
|
+
escape: function (attr) {
|
|
5601
5638
|
return escape(this.get(attr));
|
|
5602
5639
|
},
|
|
5603
5640
|
// Returns `true` if the attribute contains a value that is not null
|
|
5604
5641
|
// or undefined.
|
|
5605
|
-
has: function
|
|
5642
|
+
has: function (attr) {
|
|
5606
5643
|
return this.get(attr) != null;
|
|
5607
5644
|
},
|
|
5608
5645
|
// Special-cased proxy to lodash's `matches` method.
|
|
5609
|
-
matches: function
|
|
5646
|
+
matches: function (attrs) {
|
|
5610
5647
|
return !!iteratee(attrs)(this.attributes);
|
|
5611
5648
|
},
|
|
5612
5649
|
// Set a hash of model attributes on the object, firing `"change"`. This is
|
|
5613
5650
|
// the core primitive operation of a model, updating the data and notifying
|
|
5614
5651
|
// anyone who needs to know about the change in state. The heart of the beast.
|
|
5615
|
-
set: function
|
|
5652
|
+
set: function (key, val, options) {
|
|
5616
5653
|
if (key == null) return this; // Handle both `"key", value` and `{key: value}` -style arguments.
|
|
5617
5654
|
|
|
5618
5655
|
let attrs;
|
|
@@ -5685,13 +5722,13 @@
|
|
|
5685
5722
|
},
|
|
5686
5723
|
// Remove an attribute from the model, firing `"change"`. `unset` is a noop
|
|
5687
5724
|
// if the attribute doesn't exist.
|
|
5688
|
-
unset: function
|
|
5725
|
+
unset: function (attr, options) {
|
|
5689
5726
|
return this.set(attr, undefined, assignIn({}, options, {
|
|
5690
5727
|
unset: true
|
|
5691
5728
|
}));
|
|
5692
5729
|
},
|
|
5693
5730
|
// Clear all attributes on the model, firing `"change"`.
|
|
5694
|
-
clear: function
|
|
5731
|
+
clear: function (options) {
|
|
5695
5732
|
const attrs = {};
|
|
5696
5733
|
|
|
5697
5734
|
for (const key in this.attributes) attrs[key] = undefined;
|
|
@@ -5702,7 +5739,7 @@
|
|
|
5702
5739
|
},
|
|
5703
5740
|
// Determine if the model has changed since the last `"change"` event.
|
|
5704
5741
|
// If you specify an attribute name, determine if that attribute has changed.
|
|
5705
|
-
hasChanged: function
|
|
5742
|
+
hasChanged: function (attr) {
|
|
5706
5743
|
if (attr == null) return !isEmpty(this.changed);
|
|
5707
5744
|
return has(this.changed, attr);
|
|
5708
5745
|
},
|
|
@@ -5712,7 +5749,7 @@
|
|
|
5712
5749
|
// persisted to the server. Unset attributes will be set to undefined.
|
|
5713
5750
|
// You can also pass an attributes object to diff against the model,
|
|
5714
5751
|
// determining if there *would be* a change.
|
|
5715
|
-
changedAttributes: function
|
|
5752
|
+
changedAttributes: function (diff) {
|
|
5716
5753
|
if (!diff) return this.hasChanged() ? clone(this.changed) : false;
|
|
5717
5754
|
const old = this._changing ? this._previousAttributes : this.attributes;
|
|
5718
5755
|
const changed = {};
|
|
@@ -5729,18 +5766,18 @@
|
|
|
5729
5766
|
},
|
|
5730
5767
|
// Get the previous value of an attribute, recorded at the time the last
|
|
5731
5768
|
// `"change"` event was fired.
|
|
5732
|
-
previous: function
|
|
5769
|
+
previous: function (attr) {
|
|
5733
5770
|
if (attr == null || !this._previousAttributes) return null;
|
|
5734
5771
|
return this._previousAttributes[attr];
|
|
5735
5772
|
},
|
|
5736
5773
|
// Get all of the attributes of the model at the time of the previous
|
|
5737
5774
|
// `"change"` event.
|
|
5738
|
-
previousAttributes: function
|
|
5775
|
+
previousAttributes: function () {
|
|
5739
5776
|
return clone(this._previousAttributes);
|
|
5740
5777
|
},
|
|
5741
5778
|
// Fetch the model from the server, merging the response with the model's
|
|
5742
5779
|
// local attributes. Any changed attributes will trigger a "change" event.
|
|
5743
|
-
fetch: function
|
|
5780
|
+
fetch: function (options) {
|
|
5744
5781
|
options = assignIn({
|
|
5745
5782
|
parse: true
|
|
5746
5783
|
}, options);
|
|
@@ -5760,7 +5797,7 @@
|
|
|
5760
5797
|
// Set a hash of model attributes, and sync the model to the server.
|
|
5761
5798
|
// If the server returns an attributes hash that differs, the model's
|
|
5762
5799
|
// state will be `set` again.
|
|
5763
|
-
save: function
|
|
5800
|
+
save: function (key, val, options) {
|
|
5764
5801
|
// Handle both `"key", value` and `{key: value}` -style arguments.
|
|
5765
5802
|
let attrs;
|
|
5766
5803
|
|
|
@@ -5828,13 +5865,13 @@
|
|
|
5828
5865
|
// Destroy this model on the server if it was already persisted.
|
|
5829
5866
|
// Optimistically removes the model from its collection, if it has one.
|
|
5830
5867
|
// If `wait: true` is passed, waits for the server to respond before removal.
|
|
5831
|
-
destroy: function
|
|
5868
|
+
destroy: function (options) {
|
|
5832
5869
|
options = options ? clone(options) : {};
|
|
5833
5870
|
const model = this;
|
|
5834
5871
|
const success = options.success;
|
|
5835
5872
|
const wait = options.wait;
|
|
5836
5873
|
|
|
5837
|
-
const destroy = function
|
|
5874
|
+
const destroy = function () {
|
|
5838
5875
|
model.stopListening();
|
|
5839
5876
|
model.trigger('destroy', model, model.collection, options);
|
|
5840
5877
|
};
|
|
@@ -5860,7 +5897,7 @@
|
|
|
5860
5897
|
// Default URL for the model's representation on the server -- if you're
|
|
5861
5898
|
// using Backbone's restful methods, override this to change the endpoint
|
|
5862
5899
|
// that will be called.
|
|
5863
|
-
url: function
|
|
5900
|
+
url: function () {
|
|
5864
5901
|
const base = result(this, 'urlRoot') || result(this.collection, 'url') || urlError();
|
|
5865
5902
|
if (this.isNew()) return base;
|
|
5866
5903
|
const id = this.get(this.idAttribute);
|
|
@@ -5868,26 +5905,26 @@
|
|
|
5868
5905
|
},
|
|
5869
5906
|
// **parse** converts a response into the hash of attributes to be `set` on
|
|
5870
5907
|
// the model. The default implementation is just to pass the response along.
|
|
5871
|
-
parse: function
|
|
5908
|
+
parse: function (resp, options) {
|
|
5872
5909
|
return resp;
|
|
5873
5910
|
},
|
|
5874
5911
|
// Create a new model with identical attributes to this one.
|
|
5875
|
-
clone: function
|
|
5912
|
+
clone: function () {
|
|
5876
5913
|
return new this.constructor(this.attributes);
|
|
5877
5914
|
},
|
|
5878
5915
|
// A model is new if it has never been saved to the server, and lacks an id.
|
|
5879
|
-
isNew: function
|
|
5916
|
+
isNew: function () {
|
|
5880
5917
|
return !this.has(this.idAttribute);
|
|
5881
5918
|
},
|
|
5882
5919
|
// Check if the model is currently in a valid state.
|
|
5883
|
-
isValid: function
|
|
5920
|
+
isValid: function (options) {
|
|
5884
5921
|
return this._validate({}, assignIn({}, options, {
|
|
5885
5922
|
validate: true
|
|
5886
5923
|
}));
|
|
5887
5924
|
},
|
|
5888
5925
|
// Run validation against the next complete set of model attributes,
|
|
5889
5926
|
// returning `true` if all is well. Otherwise, fire an `"invalid"` event.
|
|
5890
|
-
_validate: function
|
|
5927
|
+
_validate: function (attrs, options) {
|
|
5891
5928
|
if (!options.validate || !this.validate) return true;
|
|
5892
5929
|
attrs = assignIn({}, this.attributes, attrs);
|
|
5893
5930
|
const error = this.validationError = this.validate(attrs, options) || null;
|
|
@@ -6869,8 +6906,22 @@
|
|
|
6869
6906
|
*/
|
|
6870
6907
|
|
|
6871
6908
|
function baseOrderBy(collection, iteratees, orders) {
|
|
6909
|
+
if (iteratees.length) {
|
|
6910
|
+
iteratees = arrayMap(iteratees, function (iteratee) {
|
|
6911
|
+
if (isArray(iteratee)) {
|
|
6912
|
+
return function (value) {
|
|
6913
|
+
return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
|
|
6914
|
+
};
|
|
6915
|
+
}
|
|
6916
|
+
|
|
6917
|
+
return iteratee;
|
|
6918
|
+
});
|
|
6919
|
+
} else {
|
|
6920
|
+
iteratees = [identity];
|
|
6921
|
+
}
|
|
6922
|
+
|
|
6872
6923
|
var index = -1;
|
|
6873
|
-
iteratees = arrayMap(iteratees
|
|
6924
|
+
iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
|
|
6874
6925
|
var result = baseMap(collection, function (value, key, collection) {
|
|
6875
6926
|
var criteria = arrayMap(iteratees, function (iteratee) {
|
|
6876
6927
|
return iteratee(value);
|
|
@@ -6905,15 +6956,15 @@
|
|
|
6905
6956
|
* var users = [
|
|
6906
6957
|
* { 'user': 'fred', 'age': 48 },
|
|
6907
6958
|
* { 'user': 'barney', 'age': 36 },
|
|
6908
|
-
* { 'user': 'fred', 'age':
|
|
6959
|
+
* { 'user': 'fred', 'age': 30 },
|
|
6909
6960
|
* { 'user': 'barney', 'age': 34 }
|
|
6910
6961
|
* ];
|
|
6911
6962
|
*
|
|
6912
6963
|
* _.sortBy(users, [function(o) { return o.user; }]);
|
|
6913
|
-
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred',
|
|
6964
|
+
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
|
|
6914
6965
|
*
|
|
6915
6966
|
* _.sortBy(users, ['user', 'age']);
|
|
6916
|
-
* // => objects for [['barney', 34], ['barney', 36], ['fred',
|
|
6967
|
+
* // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
|
|
6917
6968
|
*/
|
|
6918
6969
|
|
|
6919
6970
|
var sortBy = baseRest(function (collection, iteratees) {
|
|
@@ -6933,11 +6984,11 @@
|
|
|
6933
6984
|
});
|
|
6934
6985
|
|
|
6935
6986
|
// Backbone.js 1.4.0
|
|
6936
|
-
const
|
|
6987
|
+
const slice = Array.prototype.slice; // Create a new **Collection**, perhaps to contain a specific type of `model`.
|
|
6937
6988
|
// If a `comparator` is specified, the Collection will maintain
|
|
6938
6989
|
// its models in sort order, as they're added and removed.
|
|
6939
6990
|
|
|
6940
|
-
const Collection = function
|
|
6991
|
+
const Collection = function (models, options) {
|
|
6941
6992
|
options || (options = {});
|
|
6942
6993
|
this.preinitialize.apply(this, arguments);
|
|
6943
6994
|
if (options.model) this.model = options.model;
|
|
@@ -6962,7 +7013,7 @@
|
|
|
6962
7013
|
remove: false
|
|
6963
7014
|
}; // Splices `insert` into `array` at index `at`.
|
|
6964
7015
|
|
|
6965
|
-
const splice$1 = function
|
|
7016
|
+
const splice$1 = function (array, insert, at) {
|
|
6966
7017
|
at = Math.min(Math.max(at, 0), array.length);
|
|
6967
7018
|
const tail = Array(array.length - at);
|
|
6968
7019
|
const length = insert.length;
|
|
@@ -6982,31 +7033,31 @@
|
|
|
6982
7033
|
model: Model,
|
|
6983
7034
|
// preinitialize is an empty function by default. You can override it with a function
|
|
6984
7035
|
// or object. preinitialize will run before any instantiation logic is run in the Collection.
|
|
6985
|
-
preinitialize: function
|
|
7036
|
+
preinitialize: function () {},
|
|
6986
7037
|
// Initialize is an empty function by default. Override it with your own
|
|
6987
7038
|
// initialization logic.
|
|
6988
|
-
initialize: function
|
|
7039
|
+
initialize: function () {},
|
|
6989
7040
|
// The JSON representation of a Collection is an array of the
|
|
6990
7041
|
// models' attributes.
|
|
6991
|
-
toJSON: function
|
|
7042
|
+
toJSON: function (options) {
|
|
6992
7043
|
return this.map(function (model) {
|
|
6993
7044
|
return model.toJSON(options);
|
|
6994
7045
|
});
|
|
6995
7046
|
},
|
|
6996
7047
|
// Proxy `Backbone.sync` by default.
|
|
6997
|
-
sync: function
|
|
7048
|
+
sync: function (method, model, options) {
|
|
6998
7049
|
return getSyncMethod(this)(method, model, options);
|
|
6999
7050
|
},
|
|
7000
7051
|
// Add a model, or list of models to the set. `models` may be Backbone
|
|
7001
7052
|
// Models or raw JavaScript objects to be converted to Models, or any
|
|
7002
7053
|
// combination of the two.
|
|
7003
|
-
add: function
|
|
7054
|
+
add: function (models, options) {
|
|
7004
7055
|
return this.set(models, assignIn({
|
|
7005
7056
|
merge: false
|
|
7006
7057
|
}, options, addOptions));
|
|
7007
7058
|
},
|
|
7008
7059
|
// Remove a model, or a list of models from the set.
|
|
7009
|
-
remove: function
|
|
7060
|
+
remove: function (models, options) {
|
|
7010
7061
|
options = assignIn({}, options);
|
|
7011
7062
|
const singular = !Array.isArray(models);
|
|
7012
7063
|
models = singular ? [models] : models.slice();
|
|
@@ -7028,7 +7079,7 @@
|
|
|
7028
7079
|
// removing models that are no longer present, and merging models that
|
|
7029
7080
|
// already exist in the collection, as necessary. Similar to **Model#set**,
|
|
7030
7081
|
// the core operation for updating the data contained by the collection.
|
|
7031
|
-
set: function
|
|
7082
|
+
set: function (models, options) {
|
|
7032
7083
|
if (models == null) return;
|
|
7033
7084
|
options = assignIn({}, setOptions, options);
|
|
7034
7085
|
|
|
@@ -7144,7 +7195,7 @@
|
|
|
7144
7195
|
|
|
7145
7196
|
return singular ? models[0] : models;
|
|
7146
7197
|
},
|
|
7147
|
-
clearStore: async function
|
|
7198
|
+
clearStore: async function (options = {}, filter = o => o) {
|
|
7148
7199
|
await Promise.all(this.models.filter(filter).map(m => {
|
|
7149
7200
|
return new Promise(resolve => {
|
|
7150
7201
|
m.destroy(Object.assign(options, {
|
|
@@ -7163,7 +7214,7 @@
|
|
|
7163
7214
|
// you can reset the entire set with a new list of models, without firing
|
|
7164
7215
|
// any granular `add` or `remove` events. Fires `reset` when finished.
|
|
7165
7216
|
// Useful for bulk operations and optimizations.
|
|
7166
|
-
reset: function
|
|
7217
|
+
reset: function (models, options) {
|
|
7167
7218
|
options = options ? clone(options) : {};
|
|
7168
7219
|
|
|
7169
7220
|
for (let i = 0; i < this.models.length; i++) {
|
|
@@ -7181,146 +7232,146 @@
|
|
|
7181
7232
|
return models;
|
|
7182
7233
|
},
|
|
7183
7234
|
// Add a model to the end of the collection.
|
|
7184
|
-
push: function
|
|
7235
|
+
push: function (model, options) {
|
|
7185
7236
|
return this.add(model, assignIn({
|
|
7186
7237
|
at: this.length
|
|
7187
7238
|
}, options));
|
|
7188
7239
|
},
|
|
7189
7240
|
// Remove a model from the end of the collection.
|
|
7190
|
-
pop: function
|
|
7241
|
+
pop: function (options) {
|
|
7191
7242
|
const model = this.at(this.length - 1);
|
|
7192
7243
|
return this.remove(model, options);
|
|
7193
7244
|
},
|
|
7194
7245
|
// Add a model to the beginning of the collection.
|
|
7195
|
-
unshift: function
|
|
7246
|
+
unshift: function (model, options) {
|
|
7196
7247
|
return this.add(model, assignIn({
|
|
7197
7248
|
at: 0
|
|
7198
7249
|
}, options));
|
|
7199
7250
|
},
|
|
7200
7251
|
// Remove a model from the beginning of the collection.
|
|
7201
|
-
shift: function
|
|
7252
|
+
shift: function (options) {
|
|
7202
7253
|
const model = this.at(0);
|
|
7203
7254
|
return this.remove(model, options);
|
|
7204
7255
|
},
|
|
7205
7256
|
// Slice out a sub-array of models from the collection.
|
|
7206
|
-
slice: function
|
|
7207
|
-
return
|
|
7257
|
+
slice: function () {
|
|
7258
|
+
return slice.apply(this.models, arguments);
|
|
7208
7259
|
},
|
|
7209
|
-
filter: function
|
|
7260
|
+
filter: function (callback, thisArg) {
|
|
7210
7261
|
return this.models.filter(isFunction(callback) ? callback : m => m.matches(callback), thisArg);
|
|
7211
7262
|
},
|
|
7212
|
-
every: function
|
|
7263
|
+
every: function (pred) {
|
|
7213
7264
|
return every(this.models.map(m => m.attributes), pred);
|
|
7214
7265
|
},
|
|
7215
|
-
difference: function
|
|
7266
|
+
difference: function (values) {
|
|
7216
7267
|
return difference(this.models, values);
|
|
7217
7268
|
},
|
|
7218
|
-
max: function
|
|
7269
|
+
max: function () {
|
|
7219
7270
|
return Math.max.apply(Math, this.models);
|
|
7220
7271
|
},
|
|
7221
|
-
min: function
|
|
7272
|
+
min: function () {
|
|
7222
7273
|
return Math.min.apply(Math, this.models);
|
|
7223
7274
|
},
|
|
7224
|
-
drop: function
|
|
7275
|
+
drop: function (n = 1) {
|
|
7225
7276
|
return this.models.slice(n);
|
|
7226
7277
|
},
|
|
7227
|
-
some: function
|
|
7278
|
+
some: function (pred) {
|
|
7228
7279
|
return some(this.models.map(m => m.attributes), pred);
|
|
7229
7280
|
},
|
|
7230
|
-
sortBy: function
|
|
7281
|
+
sortBy: function (iteratee) {
|
|
7231
7282
|
return sortBy(this.models, isFunction(iteratee) ? iteratee : m => isString(iteratee) ? m.get(iteratee) : m.matches(iteratee));
|
|
7232
7283
|
},
|
|
7233
|
-
isEmpty: function
|
|
7284
|
+
isEmpty: function () {
|
|
7234
7285
|
return isEmpty(this.models);
|
|
7235
7286
|
},
|
|
7236
|
-
keyBy: function
|
|
7287
|
+
keyBy: function (iteratee) {
|
|
7237
7288
|
return keyBy(this.models, iteratee);
|
|
7238
7289
|
},
|
|
7239
|
-
each: function
|
|
7290
|
+
each: function (callback, thisArg) {
|
|
7240
7291
|
return this.forEach(callback, thisArg);
|
|
7241
7292
|
},
|
|
7242
|
-
forEach: function
|
|
7293
|
+
forEach: function (callback, thisArg) {
|
|
7243
7294
|
return this.models.forEach(callback, thisArg);
|
|
7244
7295
|
},
|
|
7245
|
-
includes: function
|
|
7296
|
+
includes: function (item) {
|
|
7246
7297
|
return this.models.includes(item);
|
|
7247
7298
|
},
|
|
7248
|
-
size: function
|
|
7299
|
+
size: function () {
|
|
7249
7300
|
return this.models.length;
|
|
7250
7301
|
},
|
|
7251
|
-
countBy: function
|
|
7302
|
+
countBy: function (f) {
|
|
7252
7303
|
return countBy(this.models, isFunction(f) ? f : m => isString(f) ? m.get(f) : m.matches(f));
|
|
7253
7304
|
},
|
|
7254
|
-
groupBy: function
|
|
7305
|
+
groupBy: function (pred) {
|
|
7255
7306
|
return groupBy(this.models, isFunction(pred) ? pred : m => isString(pred) ? m.get(pred) : m.matches(pred));
|
|
7256
7307
|
},
|
|
7257
|
-
indexOf: function
|
|
7308
|
+
indexOf: function (fromIndex) {
|
|
7258
7309
|
return indexOf(this.models, fromIndex);
|
|
7259
7310
|
},
|
|
7260
|
-
findLastIndex: function
|
|
7311
|
+
findLastIndex: function (pred, fromIndex) {
|
|
7261
7312
|
return findLastIndex(this.models, isFunction(pred) ? pred : m => isString(pred) ? m.get(pred) : m.matches(pred), fromIndex);
|
|
7262
7313
|
},
|
|
7263
|
-
lastIndexOf: function
|
|
7314
|
+
lastIndexOf: function (fromIndex) {
|
|
7264
7315
|
return lastIndexOf(this.models, fromIndex);
|
|
7265
7316
|
},
|
|
7266
|
-
findIndex: function
|
|
7317
|
+
findIndex: function (pred) {
|
|
7267
7318
|
return findIndex(this.models, isFunction(pred) ? pred : m => isString(pred) ? m.get(pred) : m.matches(pred));
|
|
7268
7319
|
},
|
|
7269
|
-
last: function
|
|
7320
|
+
last: function () {
|
|
7270
7321
|
const length = this.models == null ? 0 : this.models.length;
|
|
7271
7322
|
return length ? this.models[length - 1] : undefined;
|
|
7272
7323
|
},
|
|
7273
|
-
head: function
|
|
7324
|
+
head: function () {
|
|
7274
7325
|
return this.models[0];
|
|
7275
7326
|
},
|
|
7276
|
-
first: function
|
|
7327
|
+
first: function () {
|
|
7277
7328
|
return this.head();
|
|
7278
7329
|
},
|
|
7279
|
-
map: function
|
|
7330
|
+
map: function (cb, thisArg) {
|
|
7280
7331
|
return this.models.map(isFunction(cb) ? cb : m => isString(cb) ? m.get(cb) : m.matches(cb), thisArg);
|
|
7281
7332
|
},
|
|
7282
|
-
reduce: function
|
|
7333
|
+
reduce: function (callback, initialValue) {
|
|
7283
7334
|
return this.models.reduce(callback, initialValue || this.models[0]);
|
|
7284
7335
|
},
|
|
7285
|
-
reduceRight: function
|
|
7336
|
+
reduceRight: function (callback, initialValue) {
|
|
7286
7337
|
return this.models.reduceRight(callback, initialValue || this.models[0]);
|
|
7287
7338
|
},
|
|
7288
|
-
toArray: function
|
|
7339
|
+
toArray: function () {
|
|
7289
7340
|
return Array.from(this.models);
|
|
7290
7341
|
},
|
|
7291
7342
|
// Get a model from the set by id, cid, model object with id or cid
|
|
7292
7343
|
// properties, or an attributes object that is transformed through modelId.
|
|
7293
|
-
get: function
|
|
7344
|
+
get: function (obj) {
|
|
7294
7345
|
if (obj == null) return undefined;
|
|
7295
7346
|
return this._byId[obj] || this._byId[this.modelId(this._isModel(obj) ? obj.attributes : obj)] || obj.cid && this._byId[obj.cid];
|
|
7296
7347
|
},
|
|
7297
7348
|
// Returns `true` if the model is in the collection.
|
|
7298
|
-
has: function
|
|
7349
|
+
has: function (obj) {
|
|
7299
7350
|
return this.get(obj) != null;
|
|
7300
7351
|
},
|
|
7301
7352
|
// Get the model at the given index.
|
|
7302
|
-
at: function
|
|
7353
|
+
at: function (index) {
|
|
7303
7354
|
if (index < 0) index += this.length;
|
|
7304
7355
|
return this.models[index];
|
|
7305
7356
|
},
|
|
7306
7357
|
// Return models with matching attributes. Useful for simple cases of
|
|
7307
7358
|
// `filter`.
|
|
7308
|
-
where: function
|
|
7359
|
+
where: function (attrs, first) {
|
|
7309
7360
|
return this[first ? 'find' : 'filter'](attrs);
|
|
7310
7361
|
},
|
|
7311
7362
|
// Return the first model with matching attributes. Useful for simple cases
|
|
7312
7363
|
// of `find`.
|
|
7313
|
-
findWhere: function
|
|
7364
|
+
findWhere: function (attrs) {
|
|
7314
7365
|
return this.where(attrs, true);
|
|
7315
7366
|
},
|
|
7316
|
-
find: function
|
|
7367
|
+
find: function (predicate, fromIndex) {
|
|
7317
7368
|
const pred = isFunction(predicate) ? predicate : m => m.matches(predicate);
|
|
7318
7369
|
return this.models.find(pred, fromIndex);
|
|
7319
7370
|
},
|
|
7320
7371
|
// Force the collection to re-sort itself. You don't need to call this under
|
|
7321
7372
|
// normal circumstances, as the set will maintain sort order as each item
|
|
7322
7373
|
// is added.
|
|
7323
|
-
sort: function
|
|
7374
|
+
sort: function (options) {
|
|
7324
7375
|
let comparator = this.comparator;
|
|
7325
7376
|
if (!comparator) throw new Error('Cannot sort a set without a comparator');
|
|
7326
7377
|
options || (options = {});
|
|
@@ -7337,13 +7388,13 @@
|
|
|
7337
7388
|
return this;
|
|
7338
7389
|
},
|
|
7339
7390
|
// Pluck an attribute from each model in the collection.
|
|
7340
|
-
pluck: function
|
|
7391
|
+
pluck: function (attr) {
|
|
7341
7392
|
return this.map(attr + '');
|
|
7342
7393
|
},
|
|
7343
7394
|
// Fetch the default set of models for this collection, resetting the
|
|
7344
7395
|
// collection when they arrive. If `reset: true` is passed, the response
|
|
7345
7396
|
// data will be passed through the `reset` method instead of `set`.
|
|
7346
|
-
fetch: function
|
|
7397
|
+
fetch: function (options) {
|
|
7347
7398
|
options = assignIn({
|
|
7348
7399
|
parse: true
|
|
7349
7400
|
}, options);
|
|
@@ -7365,7 +7416,7 @@
|
|
|
7365
7416
|
// Create a new instance of a model in this collection. Add the model to the
|
|
7366
7417
|
// collection immediately, unless `wait: true` is passed, in which case we
|
|
7367
7418
|
// wait for the server to agree.
|
|
7368
|
-
create: function
|
|
7419
|
+
create: function (model, options) {
|
|
7369
7420
|
options = options ? clone(options) : {};
|
|
7370
7421
|
const wait = options.wait;
|
|
7371
7422
|
const return_promise = options.promise;
|
|
@@ -7408,42 +7459,44 @@
|
|
|
7408
7459
|
},
|
|
7409
7460
|
// **parse** converts a response into a list of models to be added to the
|
|
7410
7461
|
// collection. The default implementation is just to pass it through.
|
|
7411
|
-
parse: function
|
|
7462
|
+
parse: function (resp, options) {
|
|
7412
7463
|
return resp;
|
|
7413
7464
|
},
|
|
7414
7465
|
// Create a new collection with an identical list of models as this one.
|
|
7415
|
-
clone: function
|
|
7466
|
+
clone: function () {
|
|
7416
7467
|
return new this.constructor(this.models, {
|
|
7417
7468
|
model: this.model,
|
|
7418
7469
|
comparator: this.comparator
|
|
7419
7470
|
});
|
|
7420
7471
|
},
|
|
7421
7472
|
// Define how to uniquely identify models in the collection.
|
|
7422
|
-
modelId: function
|
|
7423
|
-
|
|
7473
|
+
modelId: function (attrs) {
|
|
7474
|
+
var _this$model$prototype;
|
|
7475
|
+
|
|
7476
|
+
return attrs[((_this$model$prototype = this.model.prototype) === null || _this$model$prototype === void 0 ? void 0 : _this$model$prototype.idAttribute) || 'id'];
|
|
7424
7477
|
},
|
|
7425
7478
|
// Get an iterator of all models in this collection.
|
|
7426
|
-
values: function
|
|
7479
|
+
values: function () {
|
|
7427
7480
|
return new CollectionIterator(this, ITERATOR_VALUES);
|
|
7428
7481
|
},
|
|
7429
7482
|
// Get an iterator of all model IDs in this collection.
|
|
7430
|
-
keys: function
|
|
7483
|
+
keys: function () {
|
|
7431
7484
|
return new CollectionIterator(this, ITERATOR_KEYS);
|
|
7432
7485
|
},
|
|
7433
7486
|
// Get an iterator of all [ID, model] tuples in this collection.
|
|
7434
|
-
entries: function
|
|
7487
|
+
entries: function () {
|
|
7435
7488
|
return new CollectionIterator(this, ITERATOR_KEYSVALUES);
|
|
7436
7489
|
},
|
|
7437
7490
|
// Private method to reset all internal state. Called when the collection
|
|
7438
7491
|
// is first initialized or reset.
|
|
7439
|
-
_reset: function
|
|
7492
|
+
_reset: function () {
|
|
7440
7493
|
this.length = 0;
|
|
7441
7494
|
this.models = [];
|
|
7442
7495
|
this._byId = {};
|
|
7443
7496
|
},
|
|
7444
7497
|
// Prepare a hash of attributes (or other model) to be added to this
|
|
7445
7498
|
// collection.
|
|
7446
|
-
_prepareModel: function
|
|
7499
|
+
_prepareModel: function (attrs, options) {
|
|
7447
7500
|
if (this._isModel(attrs)) {
|
|
7448
7501
|
if (!attrs.collection) attrs.collection = this;
|
|
7449
7502
|
return attrs;
|
|
@@ -7457,7 +7510,7 @@
|
|
|
7457
7510
|
return false;
|
|
7458
7511
|
},
|
|
7459
7512
|
// Internal method called by both remove and set.
|
|
7460
|
-
_removeModels: function
|
|
7513
|
+
_removeModels: function (models, options) {
|
|
7461
7514
|
const removed = [];
|
|
7462
7515
|
|
|
7463
7516
|
for (let i = 0; i < models.length; i++) {
|
|
@@ -7486,18 +7539,18 @@
|
|
|
7486
7539
|
},
|
|
7487
7540
|
// Method for checking whether an object should be considered a model for
|
|
7488
7541
|
// the purposes of adding to the collection.
|
|
7489
|
-
_isModel: function
|
|
7542
|
+
_isModel: function (model) {
|
|
7490
7543
|
return model instanceof Model;
|
|
7491
7544
|
},
|
|
7492
7545
|
// Internal method to create a model's ties to a collection.
|
|
7493
|
-
_addReference: function
|
|
7546
|
+
_addReference: function (model, options) {
|
|
7494
7547
|
this._byId[model.cid] = model;
|
|
7495
7548
|
const id = this.modelId(model.attributes);
|
|
7496
7549
|
if (id != null) this._byId[id] = model;
|
|
7497
7550
|
model.on('all', this._onModelEvent, this);
|
|
7498
7551
|
},
|
|
7499
7552
|
// Internal method to sever a model's ties to a collection.
|
|
7500
|
-
_removeReference: function
|
|
7553
|
+
_removeReference: function (model, options) {
|
|
7501
7554
|
delete this._byId[model.cid];
|
|
7502
7555
|
const id = this.modelId(model.attributes);
|
|
7503
7556
|
if (id != null) delete this._byId[id];
|
|
@@ -7508,7 +7561,7 @@
|
|
|
7508
7561
|
// Sets need to update their indexes when models change ids. All other
|
|
7509
7562
|
// events simply proxy through. "add" and "remove" events that originate
|
|
7510
7563
|
// in other collections are ignored.
|
|
7511
|
-
_onModelEvent: function
|
|
7564
|
+
_onModelEvent: function (event, model, collection, options) {
|
|
7512
7565
|
if (model) {
|
|
7513
7566
|
if ((event === 'add' || event === 'remove') && collection !== this) return;
|
|
7514
7567
|
if (event === 'destroy') this.remove(model, options);
|
|
@@ -7543,7 +7596,7 @@
|
|
|
7543
7596
|
// which can operate on Iterables.
|
|
7544
7597
|
|
|
7545
7598
|
|
|
7546
|
-
const CollectionIterator = function
|
|
7599
|
+
const CollectionIterator = function (collection, kind) {
|
|
7547
7600
|
this._collection = collection;
|
|
7548
7601
|
this._kind = kind;
|
|
7549
7602
|
this._index = 0;
|
|
@@ -7610,7 +7663,7 @@
|
|
|
7610
7663
|
// and URL fragments. If the browser supports neither (old IE, natch),
|
|
7611
7664
|
// falls back to polling.
|
|
7612
7665
|
|
|
7613
|
-
const History = function
|
|
7666
|
+
const History = function () {
|
|
7614
7667
|
this.handlers = [];
|
|
7615
7668
|
this.checkUrl = this.checkUrl.bind(this); // Ensure that `History` can be used outside of the browser.
|
|
7616
7669
|
|
|
@@ -7635,12 +7688,12 @@
|
|
|
7635
7688
|
// twenty times a second.
|
|
7636
7689
|
interval: 50,
|
|
7637
7690
|
// Are we at the app root?
|
|
7638
|
-
atRoot: function
|
|
7691
|
+
atRoot: function () {
|
|
7639
7692
|
const path = this.location.pathname.replace(/[^\/]$/, '$&/');
|
|
7640
7693
|
return path === this.root && !this.getSearch();
|
|
7641
7694
|
},
|
|
7642
7695
|
// Does the pathname match the root?
|
|
7643
|
-
matchRoot: function
|
|
7696
|
+
matchRoot: function () {
|
|
7644
7697
|
const path = this.decodeFragment(this.location.pathname);
|
|
7645
7698
|
const rootPath = path.slice(0, this.root.length - 1) + '/';
|
|
7646
7699
|
return rootPath === this.root;
|
|
@@ -7648,28 +7701,28 @@
|
|
|
7648
7701
|
// Unicode characters in `location.pathname` are percent encoded so they're
|
|
7649
7702
|
// decoded for comparison. `%25` should not be decoded since it may be part
|
|
7650
7703
|
// of an encoded parameter.
|
|
7651
|
-
decodeFragment: function
|
|
7704
|
+
decodeFragment: function (fragment) {
|
|
7652
7705
|
return decodeURI(fragment.replace(/%25/g, '%2525'));
|
|
7653
7706
|
},
|
|
7654
7707
|
// In IE6, the hash fragment and search params are incorrect if the
|
|
7655
7708
|
// fragment contains `?`.
|
|
7656
|
-
getSearch: function
|
|
7709
|
+
getSearch: function () {
|
|
7657
7710
|
const match = this.location.href.replace(/#.*/, '').match(/\?.+/);
|
|
7658
7711
|
return match ? match[0] : '';
|
|
7659
7712
|
},
|
|
7660
7713
|
// Gets the true hash value. Cannot use location.hash directly due to bug
|
|
7661
7714
|
// in Firefox where location.hash will always be decoded.
|
|
7662
|
-
getHash: function
|
|
7715
|
+
getHash: function (window) {
|
|
7663
7716
|
const match = (window || this).location.href.match(/#(.*)$/);
|
|
7664
7717
|
return match ? match[1] : '';
|
|
7665
7718
|
},
|
|
7666
7719
|
// Get the pathname and search params, without the root.
|
|
7667
|
-
getPath: function
|
|
7720
|
+
getPath: function () {
|
|
7668
7721
|
const path = this.decodeFragment(this.location.pathname + this.getSearch()).slice(this.root.length - 1);
|
|
7669
7722
|
return path.charAt(0) === '/' ? path.slice(1) : path;
|
|
7670
7723
|
},
|
|
7671
7724
|
// Get the cross-browser normalized URL fragment from the path or hash.
|
|
7672
|
-
getFragment: function
|
|
7725
|
+
getFragment: function (fragment) {
|
|
7673
7726
|
if (fragment == null) {
|
|
7674
7727
|
if (this._usePushState || !this._wantsHashChange) {
|
|
7675
7728
|
fragment = this.getPath();
|
|
@@ -7682,7 +7735,7 @@
|
|
|
7682
7735
|
},
|
|
7683
7736
|
// Start the hash change handling, returning `true` if the current URL matches
|
|
7684
7737
|
// an existing route, and `false` otherwise.
|
|
7685
|
-
start: function
|
|
7738
|
+
start: function (options) {
|
|
7686
7739
|
if (History.started) throw new Error('history has already been started');
|
|
7687
7740
|
History.started = true; // Figure out the initial configuration. Do we need an iframe?
|
|
7688
7741
|
// Is pushState desired ... is it available?
|
|
@@ -7748,7 +7801,7 @@
|
|
|
7748
7801
|
},
|
|
7749
7802
|
// Disable history, perhaps temporarily. Not useful in a real app,
|
|
7750
7803
|
// but possibly useful for unit testing Routers.
|
|
7751
|
-
stop: function
|
|
7804
|
+
stop: function () {
|
|
7752
7805
|
// Remove window listeners.
|
|
7753
7806
|
if (this._usePushState) {
|
|
7754
7807
|
removeEventListener('popstate', this.checkUrl, false);
|
|
@@ -7768,15 +7821,15 @@
|
|
|
7768
7821
|
},
|
|
7769
7822
|
// Add a route to be tested when the fragment changes. Routes added later
|
|
7770
7823
|
// may override previous routes.
|
|
7771
|
-
route: function route
|
|
7824
|
+
route: function (route, callback) {
|
|
7772
7825
|
this.handlers.unshift({
|
|
7773
|
-
route:
|
|
7826
|
+
route: route,
|
|
7774
7827
|
callback: callback
|
|
7775
7828
|
});
|
|
7776
7829
|
},
|
|
7777
7830
|
// Checks the current URL to see if it has changed, and if it has,
|
|
7778
7831
|
// calls `loadUrl`, normalizing across the hidden iframe.
|
|
7779
|
-
checkUrl: function
|
|
7832
|
+
checkUrl: function (e) {
|
|
7780
7833
|
let current = this.getFragment(); // If the user pressed the back button, the iframe's hash will have
|
|
7781
7834
|
// changed and we should use that for comparison.
|
|
7782
7835
|
|
|
@@ -7791,7 +7844,7 @@
|
|
|
7791
7844
|
// Attempt to load the current URL fragment. If a route succeeds with a
|
|
7792
7845
|
// match, returns `true`. If no defined routes matches the fragment,
|
|
7793
7846
|
// returns `false`.
|
|
7794
|
-
loadUrl: function
|
|
7847
|
+
loadUrl: function (fragment) {
|
|
7795
7848
|
// If the root doesn't match, no routes can match either.
|
|
7796
7849
|
if (!this.matchRoot()) return false;
|
|
7797
7850
|
fragment = this.fragment = this.getFragment(fragment);
|
|
@@ -7809,7 +7862,7 @@
|
|
|
7809
7862
|
// The options object can contain `trigger: true` if you wish to have the
|
|
7810
7863
|
// route callback be fired (not usually desirable), or `replace: true`, if
|
|
7811
7864
|
// you wish to modify the current URL without adding an entry to the history.
|
|
7812
|
-
navigate: function
|
|
7865
|
+
navigate: function (fragment, options) {
|
|
7813
7866
|
if (!History.started) return false;
|
|
7814
7867
|
if (!options || options === true) options = {
|
|
7815
7868
|
trigger: !!options
|
|
@@ -7859,7 +7912,7 @@
|
|
|
7859
7912
|
},
|
|
7860
7913
|
// Update the hash location, either replacing the current entry, or adding
|
|
7861
7914
|
// a new one to the browser history.
|
|
7862
|
-
_updateHash: function
|
|
7915
|
+
_updateHash: function (location, fragment, replace) {
|
|
7863
7916
|
if (replace) {
|
|
7864
7917
|
const href = location.href.replace(/(javascript:|#).*$/, '');
|
|
7865
7918
|
location.replace(href + '#' + fragment);
|
|
@@ -7911,7 +7964,7 @@
|
|
|
7911
7964
|
// Backbone.js 1.4.0
|
|
7912
7965
|
// matched. Creating a new one sets its `routes` hash, if not set statically.
|
|
7913
7966
|
|
|
7914
|
-
const Router = function
|
|
7967
|
+
const Router = function (options = {}) {
|
|
7915
7968
|
this.history = options.history || new History();
|
|
7916
7969
|
this.preinitialize.apply(this, arguments);
|
|
7917
7970
|
if (options.routes) this.routes = options.routes;
|
|
@@ -7931,18 +7984,18 @@
|
|
|
7931
7984
|
Object.assign(Router.prototype, Events, {
|
|
7932
7985
|
// preinitialize is an empty function by default. You can override it with a function
|
|
7933
7986
|
// or object. preinitialize will run before any instantiation logic is run in the Router.
|
|
7934
|
-
preinitialize: function
|
|
7987
|
+
preinitialize: function () {},
|
|
7935
7988
|
// Initialize is an empty function by default. Override it with your own
|
|
7936
7989
|
// initialization logic.
|
|
7937
|
-
initialize: function
|
|
7990
|
+
initialize: function () {},
|
|
7938
7991
|
// Manually bind a single named route to a callback. For example:
|
|
7939
7992
|
//
|
|
7940
7993
|
// this.route('search/:query/p:num', 'search', function(query, num) {
|
|
7941
7994
|
// ...
|
|
7942
7995
|
// });
|
|
7943
7996
|
//
|
|
7944
|
-
route: function route
|
|
7945
|
-
if (!isRegExp(
|
|
7997
|
+
route: function (route, name, callback) {
|
|
7998
|
+
if (!isRegExp(route)) route = this._routeToRegExp(route);
|
|
7946
7999
|
|
|
7947
8000
|
if (isFunction(name)) {
|
|
7948
8001
|
callback = name;
|
|
@@ -7950,8 +8003,8 @@
|
|
|
7950
8003
|
}
|
|
7951
8004
|
|
|
7952
8005
|
if (!callback) callback = this[name];
|
|
7953
|
-
this.history.route(
|
|
7954
|
-
const args = this._extractParameters(
|
|
8006
|
+
this.history.route(route, fragment => {
|
|
8007
|
+
const args = this._extractParameters(route, fragment);
|
|
7955
8008
|
|
|
7956
8009
|
if (this.execute(callback, args, name) !== false) {
|
|
7957
8010
|
this.trigger.apply(this, ['route:' + name].concat(args));
|
|
@@ -7963,18 +8016,18 @@
|
|
|
7963
8016
|
},
|
|
7964
8017
|
// Execute a route handler with the provided parameters. This is an
|
|
7965
8018
|
// excellent place to do pre-route setup or post-route cleanup.
|
|
7966
|
-
execute: function
|
|
8019
|
+
execute: function (callback, args, name) {
|
|
7967
8020
|
if (callback) callback.apply(this, args);
|
|
7968
8021
|
},
|
|
7969
8022
|
// Simple proxy to `history` to save a fragment into the history.
|
|
7970
|
-
navigate: function
|
|
8023
|
+
navigate: function (fragment, options) {
|
|
7971
8024
|
this.history.navigate(fragment, options);
|
|
7972
8025
|
return this;
|
|
7973
8026
|
},
|
|
7974
8027
|
// Bind all defined routes to `history`. We have to reverse the
|
|
7975
8028
|
// order of the routes here to support behavior where the most general
|
|
7976
8029
|
// routes can be defined at the bottom of the route map.
|
|
7977
|
-
_bindRoutes: function
|
|
8030
|
+
_bindRoutes: function () {
|
|
7978
8031
|
if (!this.routes) return;
|
|
7979
8032
|
this.routes = result(this, 'routes');
|
|
7980
8033
|
let route;
|
|
@@ -7986,7 +8039,7 @@
|
|
|
7986
8039
|
},
|
|
7987
8040
|
// Convert a route string into a regular expression, suitable for matching
|
|
7988
8041
|
// against the current location hash.
|
|
7989
|
-
_routeToRegExp: function
|
|
8042
|
+
_routeToRegExp: function (route) {
|
|
7990
8043
|
route = route.replace(escapeRegExp, '\\$&').replace(optionalParam, '(?:$1)?').replace(namedParam, function (match, optional) {
|
|
7991
8044
|
return optional ? match : '([^/?]+)';
|
|
7992
8045
|
}).replace(splatParam, '([^?]*?)');
|
|
@@ -7995,7 +8048,7 @@
|
|
|
7995
8048
|
// Given a route, and a URL fragment that it matches, return the array of
|
|
7996
8049
|
// extracted decoded parameters. Empty or unmatched parameters will be
|
|
7997
8050
|
// treated as `null` to normalize cross-browser behavior.
|
|
7998
|
-
_extractParameters: function
|
|
8051
|
+
_extractParameters: function (route, fragment) {
|
|
7999
8052
|
const params = route.exec(fragment).slice(1);
|
|
8000
8053
|
return params.map(function (param, i) {
|
|
8001
8054
|
// Don't decode the search params.
|
|
@@ -8007,966 +8060,373 @@
|
|
|
8007
8060
|
|
|
8008
8061
|
/**
|
|
8009
8062
|
* @license
|
|
8010
|
-
* Copyright
|
|
8011
|
-
*
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8063
|
+
* Copyright 2017 Google LLC
|
|
8064
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
8065
|
+
*/
|
|
8066
|
+
var t, i, s, e;
|
|
8067
|
+
|
|
8068
|
+
const o = globalThis.trustedTypes,
|
|
8069
|
+
l = o ? o.createPolicy("lit-html", {
|
|
8070
|
+
createHTML: t => t
|
|
8071
|
+
}) : void 0,
|
|
8072
|
+
n = `lit$${(Math.random() + "").slice(9)}$`,
|
|
8073
|
+
h = "?" + n,
|
|
8074
|
+
r = `<${h}>`,
|
|
8075
|
+
u = document,
|
|
8076
|
+
c = (t = "") => u.createComment(t),
|
|
8077
|
+
d = t => null === t || "object" != typeof t && "function" != typeof t,
|
|
8078
|
+
v = Array.isArray,
|
|
8079
|
+
a = t => {
|
|
8080
|
+
var i;
|
|
8081
|
+
return v(t) || "function" == typeof (null === (i = t) || void 0 === i ? void 0 : i[Symbol.iterator]);
|
|
8082
|
+
},
|
|
8083
|
+
f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
8084
|
+
_ = /-->/g,
|
|
8085
|
+
m = />/g,
|
|
8086
|
+
p = />|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,
|
|
8087
|
+
$ = /'/g,
|
|
8088
|
+
g = /"/g,
|
|
8089
|
+
y = /^(?:script|style|textarea)$/i,
|
|
8090
|
+
w = Symbol.for("lit-noChange"),
|
|
8091
|
+
A = Symbol.for("lit-nothing"),
|
|
8092
|
+
P = new WeakMap(),
|
|
8093
|
+
V = (t, i, s) => {
|
|
8094
|
+
var e, o;
|
|
8095
|
+
const l = null !== (e = null == s ? void 0 : s.renderBefore) && void 0 !== e ? e : i;
|
|
8096
|
+
let n = l._$litPart$;
|
|
8097
|
+
|
|
8098
|
+
if (void 0 === n) {
|
|
8099
|
+
const t = null !== (o = null == s ? void 0 : s.renderBefore) && void 0 !== o ? o : null;
|
|
8100
|
+
l._$litPart$ = n = new C(i.insertBefore(c(), t), t, void 0, s);
|
|
8101
|
+
}
|
|
8102
|
+
|
|
8103
|
+
return n.I(t), n;
|
|
8104
|
+
},
|
|
8105
|
+
E = u.createTreeWalker(u, 129, null, !1),
|
|
8106
|
+
M = (t, i) => {
|
|
8107
|
+
const s = t.length - 1,
|
|
8108
|
+
e = [];
|
|
8109
|
+
let o,
|
|
8110
|
+
h = 2 === i ? "<svg>" : "",
|
|
8111
|
+
u = f;
|
|
8112
|
+
|
|
8113
|
+
for (let i = 0; i < s; i++) {
|
|
8114
|
+
const s = t[i];
|
|
8115
|
+
let l,
|
|
8116
|
+
c,
|
|
8117
|
+
d = -1,
|
|
8118
|
+
v = 0;
|
|
8119
|
+
|
|
8120
|
+
for (; v < s.length && (u.lastIndex = v, c = u.exec(s), null !== c);) v = u.lastIndex, u === f ? "!--" === c[1] ? u = _ : void 0 !== c[1] ? u = m : void 0 !== c[2] ? (y.test(c[2]) && (o = RegExp("</" + c[2], "g")), u = p) : void 0 !== c[3] && (u = p) : u === p ? ">" === c[0] ? (u = null != o ? o : f, d = -1) : void 0 === c[1] ? d = -2 : (d = u.lastIndex - c[2].length, l = c[1], u = void 0 === c[3] ? p : '"' === c[3] ? g : $) : u === g || u === $ ? u = p : u === _ || u === m ? u = f : (u = p, o = void 0);
|
|
8121
|
+
|
|
8122
|
+
const a = u === p && t[i + 1].startsWith("/>") ? " " : "";
|
|
8123
|
+
h += u === f ? s + r : d >= 0 ? (e.push(l), s.slice(0, d) + "$lit$" + s.slice(d) + n + a) : s + n + (-2 === d ? (e.push(void 0), i) : a);
|
|
8124
|
+
}
|
|
8125
|
+
|
|
8126
|
+
const c = h + (t[s] || "<?>") + (2 === i ? "</svg>" : "");
|
|
8127
|
+
return [void 0 !== l ? l.createHTML(c) : c, e];
|
|
8024
8128
|
};
|
|
8025
8129
|
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
* http://polymer.github.io/AUTHORS.txt
|
|
8033
|
-
* The complete set of contributors may be found at
|
|
8034
|
-
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
8035
|
-
* Code distributed by Google as part of the polymer project is also
|
|
8036
|
-
* subject to an additional IP rights grant found at
|
|
8037
|
-
* http://polymer.github.io/PATENTS.txt
|
|
8038
|
-
*/
|
|
8039
|
-
|
|
8040
|
-
/**
|
|
8041
|
-
* True if the custom elements polyfill is in use.
|
|
8042
|
-
*/
|
|
8043
|
-
const isCEPolyfill = typeof window !== 'undefined' && window.customElements != null && window.customElements.polyfillWrapFlushCallback !== undefined;
|
|
8044
|
-
/**
|
|
8045
|
-
* Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from
|
|
8046
|
-
* `container`.
|
|
8047
|
-
*/
|
|
8048
|
-
|
|
8049
|
-
const removeNodes = (container, start, end = null) => {
|
|
8050
|
-
while (start !== end) {
|
|
8051
|
-
const n = start.nextSibling;
|
|
8052
|
-
container.removeChild(start);
|
|
8053
|
-
start = n;
|
|
8054
|
-
}
|
|
8055
|
-
};
|
|
8056
|
-
|
|
8057
|
-
/**
|
|
8058
|
-
* @license
|
|
8059
|
-
* Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
|
|
8060
|
-
* This code may only be used under the BSD style license found at
|
|
8061
|
-
* http://polymer.github.io/LICENSE.txt
|
|
8062
|
-
* The complete set of authors may be found at
|
|
8063
|
-
* http://polymer.github.io/AUTHORS.txt
|
|
8064
|
-
* The complete set of contributors may be found at
|
|
8065
|
-
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
8066
|
-
* Code distributed by Google as part of the polymer project is also
|
|
8067
|
-
* subject to an additional IP rights grant found at
|
|
8068
|
-
* http://polymer.github.io/PATENTS.txt
|
|
8069
|
-
*/
|
|
8070
|
-
|
|
8071
|
-
/**
|
|
8072
|
-
* A sentinel value that signals that a value was handled by a directive and
|
|
8073
|
-
* should not be written to the DOM.
|
|
8074
|
-
*/
|
|
8075
|
-
const noChange = {};
|
|
8076
|
-
/**
|
|
8077
|
-
* A sentinel value that signals a NodePart to fully clear its content.
|
|
8078
|
-
*/
|
|
8079
|
-
|
|
8080
|
-
const nothing = {};
|
|
8081
|
-
|
|
8082
|
-
/**
|
|
8083
|
-
* @license
|
|
8084
|
-
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
8085
|
-
* This code may only be used under the BSD style license found at
|
|
8086
|
-
* http://polymer.github.io/LICENSE.txt
|
|
8087
|
-
* The complete set of authors may be found at
|
|
8088
|
-
* http://polymer.github.io/AUTHORS.txt
|
|
8089
|
-
* The complete set of contributors may be found at
|
|
8090
|
-
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
8091
|
-
* Code distributed by Google as part of the polymer project is also
|
|
8092
|
-
* subject to an additional IP rights grant found at
|
|
8093
|
-
* http://polymer.github.io/PATENTS.txt
|
|
8094
|
-
*/
|
|
8095
|
-
|
|
8096
|
-
/**
|
|
8097
|
-
* An expression marker with embedded unique key to avoid collision with
|
|
8098
|
-
* possible text in templates.
|
|
8099
|
-
*/
|
|
8100
|
-
const marker = "{{lit-".concat(String(Math.random()).slice(2), "}}");
|
|
8101
|
-
/**
|
|
8102
|
-
* An expression marker used text-positions, multi-binding attributes, and
|
|
8103
|
-
* attributes with markup-like text values.
|
|
8104
|
-
*/
|
|
8105
|
-
|
|
8106
|
-
const nodeMarker = "<!--".concat(marker, "-->");
|
|
8107
|
-
const markerRegex = new RegExp("".concat(marker, "|").concat(nodeMarker));
|
|
8108
|
-
/**
|
|
8109
|
-
* Suffix appended to all bound attribute names.
|
|
8110
|
-
*/
|
|
8111
|
-
|
|
8112
|
-
const boundAttributeSuffix = '$lit$';
|
|
8113
|
-
/**
|
|
8114
|
-
* An updatable Template that tracks the location of dynamic parts.
|
|
8115
|
-
*/
|
|
8116
|
-
|
|
8117
|
-
class Template {
|
|
8118
|
-
constructor(result, element) {
|
|
8130
|
+
class N {
|
|
8131
|
+
constructor({
|
|
8132
|
+
strings: t,
|
|
8133
|
+
_$litType$: i
|
|
8134
|
+
}, s) {
|
|
8135
|
+
let e;
|
|
8119
8136
|
this.parts = [];
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
const
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
let index = -1;
|
|
8132
|
-
let partIndex = 0;
|
|
8133
|
-
const {
|
|
8134
|
-
strings,
|
|
8135
|
-
values: {
|
|
8136
|
-
length
|
|
8137
|
-
}
|
|
8138
|
-
} = result;
|
|
8139
|
-
|
|
8140
|
-
while (partIndex < length) {
|
|
8141
|
-
const node = walker.nextNode();
|
|
8142
|
-
|
|
8143
|
-
if (node === null) {
|
|
8144
|
-
// We've exhausted the content inside a nested template element.
|
|
8145
|
-
// Because we still have parts (the outer for-loop), we know:
|
|
8146
|
-
// - There is a template in the stack
|
|
8147
|
-
// - The walker will find a nextNode outside the template
|
|
8148
|
-
walker.currentNode = stack.pop();
|
|
8149
|
-
continue;
|
|
8150
|
-
}
|
|
8137
|
+
let l = 0,
|
|
8138
|
+
r = 0;
|
|
8139
|
+
const u = t.length - 1,
|
|
8140
|
+
d = this.parts,
|
|
8141
|
+
[v, a] = M(t, i);
|
|
8142
|
+
|
|
8143
|
+
if (this.el = N.createElement(v, s), E.currentNode = this.el.content, 2 === i) {
|
|
8144
|
+
const t = this.el.content,
|
|
8145
|
+
i = t.firstChild;
|
|
8146
|
+
i.remove(), t.append(...i.childNodes);
|
|
8147
|
+
}
|
|
8151
8148
|
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
if (
|
|
8158
|
-
const
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
for (let i = 0; i < length; i++) {
|
|
8170
|
-
if (endsWith(attributes[i].name, boundAttributeSuffix)) {
|
|
8171
|
-
count++;
|
|
8172
|
-
}
|
|
8173
|
-
}
|
|
8174
|
-
|
|
8175
|
-
while (count-- > 0) {
|
|
8176
|
-
// Get the template literal section leading up to the first
|
|
8177
|
-
// expression in this attribute
|
|
8178
|
-
const stringForPart = strings[partIndex]; // Find the attribute name
|
|
8179
|
-
|
|
8180
|
-
const name = lastAttributeNameRegex.exec(stringForPart)[2]; // Find the corresponding attribute
|
|
8181
|
-
// All bound attributes have had a suffix added in
|
|
8182
|
-
// TemplateResult#getHTML to opt out of special attribute
|
|
8183
|
-
// handling. To look up the attribute value we also need to add
|
|
8184
|
-
// the suffix.
|
|
8185
|
-
|
|
8186
|
-
const attributeLookupName = name.toLowerCase() + boundAttributeSuffix;
|
|
8187
|
-
const attributeValue = node.getAttribute(attributeLookupName);
|
|
8188
|
-
node.removeAttribute(attributeLookupName);
|
|
8189
|
-
const statics = attributeValue.split(markerRegex);
|
|
8190
|
-
this.parts.push({
|
|
8191
|
-
type: 'attribute',
|
|
8192
|
-
index,
|
|
8193
|
-
name,
|
|
8194
|
-
strings: statics
|
|
8149
|
+
for (; null !== (e = E.nextNode()) && d.length < u;) {
|
|
8150
|
+
if (1 === e.nodeType) {
|
|
8151
|
+
if (e.hasAttributes()) {
|
|
8152
|
+
const t = [];
|
|
8153
|
+
|
|
8154
|
+
for (const i of e.getAttributeNames()) if (i.endsWith("$lit$") || i.startsWith(n)) {
|
|
8155
|
+
const s = a[r++];
|
|
8156
|
+
|
|
8157
|
+
if (t.push(i), void 0 !== s) {
|
|
8158
|
+
const t = e.getAttribute(s.toLowerCase() + "$lit$").split(n),
|
|
8159
|
+
i = /([.?@])?(.*)/.exec(s);
|
|
8160
|
+
d.push({
|
|
8161
|
+
type: 1,
|
|
8162
|
+
index: l,
|
|
8163
|
+
name: i[2],
|
|
8164
|
+
strings: t,
|
|
8165
|
+
ctor: "." === i[1] ? I : "?" === i[1] ? L : "@" === i[1] ? R : H
|
|
8195
8166
|
});
|
|
8196
|
-
|
|
8197
|
-
|
|
8167
|
+
} else d.push({
|
|
8168
|
+
type: 6,
|
|
8169
|
+
index: l
|
|
8170
|
+
});
|
|
8198
8171
|
}
|
|
8199
8172
|
|
|
8200
|
-
|
|
8201
|
-
|
|
8202
|
-
walker.currentNode = node.content;
|
|
8203
|
-
}
|
|
8204
|
-
} else if (node.nodeType === 3
|
|
8205
|
-
/* Node.TEXT_NODE */
|
|
8206
|
-
) {
|
|
8207
|
-
const data = node.data;
|
|
8208
|
-
|
|
8209
|
-
if (data.indexOf(marker) >= 0) {
|
|
8210
|
-
const parent = node.parentNode;
|
|
8211
|
-
const strings = data.split(markerRegex);
|
|
8212
|
-
const lastIndex = strings.length - 1; // Generate a new text node for each literal section
|
|
8213
|
-
// These nodes are also used as the markers for node parts
|
|
8214
|
-
|
|
8215
|
-
for (let i = 0; i < lastIndex; i++) {
|
|
8216
|
-
let insert;
|
|
8217
|
-
let s = strings[i];
|
|
8218
|
-
|
|
8219
|
-
if (s === '') {
|
|
8220
|
-
insert = createMarker();
|
|
8221
|
-
} else {
|
|
8222
|
-
const match = lastAttributeNameRegex.exec(s);
|
|
8223
|
-
|
|
8224
|
-
if (match !== null && endsWith(match[2], boundAttributeSuffix)) {
|
|
8225
|
-
s = s.slice(0, match.index) + match[1] + match[2].slice(0, -boundAttributeSuffix.length) + match[3];
|
|
8226
|
-
}
|
|
8227
|
-
|
|
8228
|
-
insert = document.createTextNode(s);
|
|
8229
|
-
}
|
|
8230
|
-
|
|
8231
|
-
parent.insertBefore(insert, node);
|
|
8232
|
-
this.parts.push({
|
|
8233
|
-
type: 'node',
|
|
8234
|
-
index: ++index
|
|
8235
|
-
});
|
|
8236
|
-
} // If there's no text, we must insert a comment to mark our place.
|
|
8237
|
-
// Else, we can trust it will stick around after cloning.
|
|
8173
|
+
for (const i of t) e.removeAttribute(i);
|
|
8174
|
+
}
|
|
8238
8175
|
|
|
8176
|
+
if (y.test(e.tagName)) {
|
|
8177
|
+
const t = e.textContent.split(n),
|
|
8178
|
+
i = t.length - 1;
|
|
8239
8179
|
|
|
8240
|
-
|
|
8241
|
-
|
|
8242
|
-
nodesToRemove.push(node);
|
|
8243
|
-
} else {
|
|
8244
|
-
node.data = strings[lastIndex];
|
|
8245
|
-
} // We have a part for each match found
|
|
8180
|
+
if (i > 0) {
|
|
8181
|
+
e.textContent = o ? o.emptyScript : "";
|
|
8246
8182
|
|
|
8183
|
+
for (let s = 0; s < i; s++) e.append(t[s], c()), E.nextNode(), d.push({
|
|
8184
|
+
type: 2,
|
|
8185
|
+
index: ++l
|
|
8186
|
+
});
|
|
8247
8187
|
|
|
8248
|
-
|
|
8249
|
-
}
|
|
8250
|
-
} else if (node.nodeType === 8
|
|
8251
|
-
/* Node.COMMENT_NODE */
|
|
8252
|
-
) {
|
|
8253
|
-
if (node.data === marker) {
|
|
8254
|
-
const parent = node.parentNode; // Add a new marker node to be the startNode of the Part if any of
|
|
8255
|
-
// the following are true:
|
|
8256
|
-
// * We don't have a previousSibling
|
|
8257
|
-
// * The previousSibling is already the start of a previous part
|
|
8258
|
-
|
|
8259
|
-
if (node.previousSibling === null || index === lastPartIndex) {
|
|
8260
|
-
index++;
|
|
8261
|
-
parent.insertBefore(createMarker(), node);
|
|
8262
|
-
}
|
|
8263
|
-
|
|
8264
|
-
lastPartIndex = index;
|
|
8265
|
-
this.parts.push({
|
|
8266
|
-
type: 'node',
|
|
8267
|
-
index
|
|
8268
|
-
}); // If we don't have a nextSibling, keep this node so we have an end.
|
|
8269
|
-
// Else, we can remove it to save future costs.
|
|
8270
|
-
|
|
8271
|
-
if (node.nextSibling === null) {
|
|
8272
|
-
node.data = '';
|
|
8273
|
-
} else {
|
|
8274
|
-
nodesToRemove.push(node);
|
|
8275
|
-
index--;
|
|
8276
|
-
}
|
|
8277
|
-
|
|
8278
|
-
partIndex++;
|
|
8279
|
-
} else {
|
|
8280
|
-
let i = -1;
|
|
8281
|
-
|
|
8282
|
-
while ((i = node.data.indexOf(marker, i + 1)) !== -1) {
|
|
8283
|
-
// Comment node has a binding marker inside, make an inactive part
|
|
8284
|
-
// The binding won't work, but subsequent bindings will
|
|
8285
|
-
// TODO (justinfagnani): consider whether it's even worth it to
|
|
8286
|
-
// make bindings in comments work
|
|
8287
|
-
this.parts.push({
|
|
8288
|
-
type: 'node',
|
|
8289
|
-
index: -1
|
|
8290
|
-
});
|
|
8291
|
-
partIndex++;
|
|
8292
|
-
}
|
|
8188
|
+
e.append(t[i], c());
|
|
8293
8189
|
}
|
|
8294
8190
|
}
|
|
8295
|
-
|
|
8296
|
-
|
|
8191
|
+
} else if (8 === e.nodeType) if (e.data === h) d.push({
|
|
8192
|
+
type: 2,
|
|
8193
|
+
index: l
|
|
8194
|
+
});else {
|
|
8195
|
+
let t = -1;
|
|
8196
|
+
|
|
8197
|
+
for (; -1 !== (t = e.data.indexOf(n, t + 1));) d.push({
|
|
8198
|
+
type: 7,
|
|
8199
|
+
index: l
|
|
8200
|
+
}), t += n.length - 1;
|
|
8201
|
+
}
|
|
8297
8202
|
|
|
8298
|
-
|
|
8299
|
-
n.parentNode.removeChild(n);
|
|
8203
|
+
l++;
|
|
8300
8204
|
}
|
|
8301
8205
|
}
|
|
8302
8206
|
|
|
8303
|
-
|
|
8304
|
-
|
|
8305
|
-
|
|
8306
|
-
|
|
8307
|
-
return index >= 0 && str.slice(index) === suffix;
|
|
8308
|
-
};
|
|
8309
|
-
|
|
8310
|
-
const isTemplatePartActive = part => part.index !== -1; // Allows `document.createComment('')` to be renamed for a
|
|
8311
|
-
// small manual size-savings.
|
|
8312
|
-
|
|
8313
|
-
const createMarker = () => document.createComment('');
|
|
8314
|
-
/**
|
|
8315
|
-
* This regex extracts the attribute name preceding an attribute-position
|
|
8316
|
-
* expression. It does this by matching the syntax allowed for attributes
|
|
8317
|
-
* against the string literal directly preceding the expression, assuming that
|
|
8318
|
-
* the expression is in an attribute-value position.
|
|
8319
|
-
*
|
|
8320
|
-
* See attributes in the HTML spec:
|
|
8321
|
-
* https://www.w3.org/TR/html5/syntax.html#elements-attributes
|
|
8322
|
-
*
|
|
8323
|
-
* " \x09\x0a\x0c\x0d" are HTML space characters:
|
|
8324
|
-
* https://www.w3.org/TR/html5/infrastructure.html#space-characters
|
|
8325
|
-
*
|
|
8326
|
-
* "\0-\x1F\x7F-\x9F" are Unicode control characters, which includes every
|
|
8327
|
-
* space character except " ".
|
|
8328
|
-
*
|
|
8329
|
-
* So an attribute is:
|
|
8330
|
-
* * The name: any character except a control character, space character, ('),
|
|
8331
|
-
* ("), ">", "=", or "/"
|
|
8332
|
-
* * Followed by zero or more space characters
|
|
8333
|
-
* * Followed by "="
|
|
8334
|
-
* * Followed by zero or more space characters
|
|
8335
|
-
* * Followed by:
|
|
8336
|
-
* * Any character except space, ('), ("), "<", ">", "=", (`), or
|
|
8337
|
-
* * (") then any non-("), or
|
|
8338
|
-
* * (') then any non-(')
|
|
8339
|
-
*/
|
|
8207
|
+
static createElement(t, i) {
|
|
8208
|
+
const s = u.createElement("template");
|
|
8209
|
+
return s.innerHTML = t, s;
|
|
8210
|
+
}
|
|
8340
8211
|
|
|
8341
|
-
|
|
8342
|
-
/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;
|
|
8212
|
+
}
|
|
8343
8213
|
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
|
|
8348
|
-
|
|
8349
|
-
|
|
8350
|
-
|
|
8351
|
-
* The complete set of contributors may be found at
|
|
8352
|
-
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
8353
|
-
* Code distributed by Google as part of the polymer project is also
|
|
8354
|
-
* subject to an additional IP rights grant found at
|
|
8355
|
-
* http://polymer.github.io/PATENTS.txt
|
|
8356
|
-
*/
|
|
8357
|
-
/**
|
|
8358
|
-
* An instance of a `Template` that can be attached to the DOM and updated
|
|
8359
|
-
* with new values.
|
|
8360
|
-
*/
|
|
8214
|
+
function S(t, i, s = t, e) {
|
|
8215
|
+
var o, l, n, h;
|
|
8216
|
+
if (i === w) return i;
|
|
8217
|
+
let r = void 0 !== e ? null === (o = s.Σi) || void 0 === o ? void 0 : o[e] : s.Σo;
|
|
8218
|
+
const u = d(i) ? void 0 : i._$litDirective$;
|
|
8219
|
+
return (null == r ? void 0 : r.constructor) !== u && (null === (l = null == r ? void 0 : r.O) || void 0 === l || l.call(r, !1), void 0 === u ? r = void 0 : (r = new u(t), r.T(t, s, e)), void 0 !== e ? (null !== (n = (h = s).Σi) && void 0 !== n ? n : h.Σi = [])[e] = r : s.Σo = r), void 0 !== r && (i = S(t, r.S(t, i.values), r, e)), i;
|
|
8220
|
+
}
|
|
8361
8221
|
|
|
8362
|
-
class
|
|
8363
|
-
constructor(
|
|
8364
|
-
this.
|
|
8365
|
-
this.template = template;
|
|
8366
|
-
this.processor = processor;
|
|
8367
|
-
this.options = options;
|
|
8222
|
+
class k {
|
|
8223
|
+
constructor(t, i) {
|
|
8224
|
+
this.l = [], this.N = void 0, this.D = t, this.M = i;
|
|
8368
8225
|
}
|
|
8369
8226
|
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
-
|
|
8374
|
-
|
|
8375
|
-
|
|
8227
|
+
u(t) {
|
|
8228
|
+
var i;
|
|
8229
|
+
const {
|
|
8230
|
+
el: {
|
|
8231
|
+
content: s
|
|
8232
|
+
},
|
|
8233
|
+
parts: e
|
|
8234
|
+
} = this.D,
|
|
8235
|
+
o = (null !== (i = null == t ? void 0 : t.creationScope) && void 0 !== i ? i : u).importNode(s, !0);
|
|
8236
|
+
E.currentNode = o;
|
|
8237
|
+
let l = E.nextNode(),
|
|
8238
|
+
n = 0,
|
|
8239
|
+
h = 0,
|
|
8240
|
+
r = e[0];
|
|
8241
|
+
|
|
8242
|
+
for (; void 0 !== r;) {
|
|
8243
|
+
if (n === r.index) {
|
|
8244
|
+
let i;
|
|
8245
|
+
2 === r.type ? i = new C(l, l.nextSibling, this, t) : 1 === r.type ? i = new r.ctor(l, r.name, r.strings, this, t) : 6 === r.type && (i = new z(l, this, t)), this.l.push(i), r = e[++h];
|
|
8376
8246
|
}
|
|
8377
8247
|
|
|
8378
|
-
|
|
8248
|
+
n !== (null == r ? void 0 : r.index) && (l = E.nextNode(), n++);
|
|
8379
8249
|
}
|
|
8380
8250
|
|
|
8381
|
-
|
|
8382
|
-
if (part !== undefined) {
|
|
8383
|
-
part.commit();
|
|
8384
|
-
}
|
|
8385
|
-
}
|
|
8251
|
+
return o;
|
|
8386
8252
|
}
|
|
8387
8253
|
|
|
8388
|
-
|
|
8389
|
-
|
|
8390
|
-
// DOM fragment:
|
|
8391
|
-
// 1. Clone - create the instance fragment
|
|
8392
|
-
// 2. Adopt - adopt into the main document
|
|
8393
|
-
// 3. Process - find part markers and create parts
|
|
8394
|
-
// 4. Upgrade - upgrade custom elements
|
|
8395
|
-
// 5. Update - set node, attribute, property, etc., values
|
|
8396
|
-
// 6. Connect - connect to the document. Optional and outside of this
|
|
8397
|
-
// method.
|
|
8398
|
-
//
|
|
8399
|
-
// We have a few constraints on the ordering of these steps:
|
|
8400
|
-
// * We need to upgrade before updating, so that property values will pass
|
|
8401
|
-
// through any property setters.
|
|
8402
|
-
// * We would like to process before upgrading so that we're sure that the
|
|
8403
|
-
// cloned fragment is inert and not disturbed by self-modifying DOM.
|
|
8404
|
-
// * We want custom elements to upgrade even in disconnected fragments.
|
|
8405
|
-
//
|
|
8406
|
-
// Given these constraints, with full custom elements support we would
|
|
8407
|
-
// prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect
|
|
8408
|
-
//
|
|
8409
|
-
// But Safari does not implement CustomElementRegistry#upgrade, so we
|
|
8410
|
-
// can not implement that order and still have upgrade-before-update and
|
|
8411
|
-
// upgrade disconnected fragments. So we instead sacrifice the
|
|
8412
|
-
// process-before-upgrade constraint, since in Custom Elements v1 elements
|
|
8413
|
-
// must not modify their light DOM in the constructor. We still have issues
|
|
8414
|
-
// when co-existing with CEv0 elements like Polymer 1, and with polyfills
|
|
8415
|
-
// that don't strictly adhere to the no-modification rule because shadow
|
|
8416
|
-
// DOM, which may be created in the constructor, is emulated by being placed
|
|
8417
|
-
// in the light DOM.
|
|
8418
|
-
//
|
|
8419
|
-
// The resulting order is on native is: Clone, Adopt, Upgrade, Process,
|
|
8420
|
-
// Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade
|
|
8421
|
-
// in one step.
|
|
8422
|
-
//
|
|
8423
|
-
// The Custom Elements v1 polyfill supports upgrade(), so the order when
|
|
8424
|
-
// polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update,
|
|
8425
|
-
// Connect.
|
|
8426
|
-
const fragment = isCEPolyfill ? this.template.element.content.cloneNode(true) : document.importNode(this.template.element.content, true);
|
|
8427
|
-
const stack = [];
|
|
8428
|
-
const parts = this.template.parts; // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null
|
|
8429
|
-
|
|
8430
|
-
const walker = document.createTreeWalker(fragment, 133
|
|
8431
|
-
/* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */
|
|
8432
|
-
, null, false);
|
|
8433
|
-
let partIndex = 0;
|
|
8434
|
-
let nodeIndex = 0;
|
|
8435
|
-
let part;
|
|
8436
|
-
let node = walker.nextNode(); // Loop through all the nodes and parts of a template
|
|
8437
|
-
|
|
8438
|
-
while (partIndex < parts.length) {
|
|
8439
|
-
part = parts[partIndex];
|
|
8440
|
-
|
|
8441
|
-
if (!isTemplatePartActive(part)) {
|
|
8442
|
-
this.__parts.push(undefined);
|
|
8443
|
-
|
|
8444
|
-
partIndex++;
|
|
8445
|
-
continue;
|
|
8446
|
-
} // Progress the tree walker until we find our next part's node.
|
|
8447
|
-
// Note that multiple parts may share the same node (attribute parts
|
|
8448
|
-
// on a single element), so this loop may not run at all.
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
while (nodeIndex < part.index) {
|
|
8452
|
-
nodeIndex++;
|
|
8453
|
-
|
|
8454
|
-
if (node.nodeName === 'TEMPLATE') {
|
|
8455
|
-
stack.push(node);
|
|
8456
|
-
walker.currentNode = node.content;
|
|
8457
|
-
}
|
|
8458
|
-
|
|
8459
|
-
if ((node = walker.nextNode()) === null) {
|
|
8460
|
-
// We've exhausted the content inside a nested template element.
|
|
8461
|
-
// Because we still have parts (the outer for-loop), we know:
|
|
8462
|
-
// - There is a template in the stack
|
|
8463
|
-
// - The walker will find a nextNode outside the template
|
|
8464
|
-
walker.currentNode = stack.pop();
|
|
8465
|
-
node = walker.nextNode();
|
|
8466
|
-
}
|
|
8467
|
-
} // We've arrived at our part's node.
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
if (part.type === 'node') {
|
|
8471
|
-
const part = this.processor.handleTextExpression(this.options);
|
|
8472
|
-
part.insertAfterNode(node.previousSibling);
|
|
8473
|
-
|
|
8474
|
-
this.__parts.push(part);
|
|
8475
|
-
} else {
|
|
8476
|
-
this.__parts.push(...this.processor.handleAttributeExpressions(node, part.name, part.strings, this.options));
|
|
8477
|
-
}
|
|
8478
|
-
|
|
8479
|
-
partIndex++;
|
|
8480
|
-
}
|
|
8481
|
-
|
|
8482
|
-
if (isCEPolyfill) {
|
|
8483
|
-
document.adoptNode(fragment);
|
|
8484
|
-
customElements.upgrade(fragment);
|
|
8485
|
-
}
|
|
8254
|
+
v(t) {
|
|
8255
|
+
let i = 0;
|
|
8486
8256
|
|
|
8487
|
-
|
|
8257
|
+
for (const s of this.l) void 0 !== s && (void 0 !== s.strings ? (s.I(t, s, i), i += s.strings.length - 2) : s.I(t[i])), i++;
|
|
8488
8258
|
}
|
|
8489
8259
|
|
|
8490
8260
|
}
|
|
8491
8261
|
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
* This code may only be used under the BSD style license found at
|
|
8496
|
-
* http://polymer.github.io/LICENSE.txt
|
|
8497
|
-
* The complete set of authors may be found at
|
|
8498
|
-
* http://polymer.github.io/AUTHORS.txt
|
|
8499
|
-
* The complete set of contributors may be found at
|
|
8500
|
-
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
8501
|
-
* Code distributed by Google as part of the polymer project is also
|
|
8502
|
-
* subject to an additional IP rights grant found at
|
|
8503
|
-
* http://polymer.github.io/PATENTS.txt
|
|
8504
|
-
*/
|
|
8505
|
-
const commentMarker = " ".concat(marker, " ");
|
|
8506
|
-
/**
|
|
8507
|
-
* The return type of `html`, which holds a Template and the values from
|
|
8508
|
-
* interpolated expressions.
|
|
8509
|
-
*/
|
|
8510
|
-
|
|
8511
|
-
class TemplateResult {
|
|
8512
|
-
constructor(strings, values, type, processor) {
|
|
8513
|
-
this.strings = strings;
|
|
8514
|
-
this.values = values;
|
|
8515
|
-
this.type = type;
|
|
8516
|
-
this.processor = processor;
|
|
8517
|
-
}
|
|
8518
|
-
/**
|
|
8519
|
-
* Returns a string of HTML used to create a `<template>` element.
|
|
8520
|
-
*/
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
getHTML() {
|
|
8524
|
-
const l = this.strings.length - 1;
|
|
8525
|
-
let html = '';
|
|
8526
|
-
let isCommentBinding = false;
|
|
8527
|
-
|
|
8528
|
-
for (let i = 0; i < l; i++) {
|
|
8529
|
-
const s = this.strings[i]; // For each binding we want to determine the kind of marker to insert
|
|
8530
|
-
// into the template source before it's parsed by the browser's HTML
|
|
8531
|
-
// parser. The marker type is based on whether the expression is in an
|
|
8532
|
-
// attribute, text, or comment position.
|
|
8533
|
-
// * For node-position bindings we insert a comment with the marker
|
|
8534
|
-
// sentinel as its text content, like <!--{{lit-guid}}-->.
|
|
8535
|
-
// * For attribute bindings we insert just the marker sentinel for the
|
|
8536
|
-
// first binding, so that we support unquoted attribute bindings.
|
|
8537
|
-
// Subsequent bindings can use a comment marker because multi-binding
|
|
8538
|
-
// attributes must be quoted.
|
|
8539
|
-
// * For comment bindings we insert just the marker sentinel so we don't
|
|
8540
|
-
// close the comment.
|
|
8541
|
-
//
|
|
8542
|
-
// The following code scans the template source, but is *not* an HTML
|
|
8543
|
-
// parser. We don't need to track the tree structure of the HTML, only
|
|
8544
|
-
// whether a binding is inside a comment, and if not, if it appears to be
|
|
8545
|
-
// the first binding in an attribute.
|
|
8546
|
-
|
|
8547
|
-
const commentOpen = s.lastIndexOf('<!--'); // We're in comment position if we have a comment open with no following
|
|
8548
|
-
// comment close. Because <-- can appear in an attribute value there can
|
|
8549
|
-
// be false positives.
|
|
8550
|
-
|
|
8551
|
-
isCommentBinding = (commentOpen > -1 || isCommentBinding) && s.indexOf('-->', commentOpen + 1) === -1; // Check to see if we have an attribute-like sequence preceding the
|
|
8552
|
-
// expression. This can match "name=value" like structures in text,
|
|
8553
|
-
// comments, and attribute values, so there can be false-positives.
|
|
8554
|
-
|
|
8555
|
-
const attributeMatch = lastAttributeNameRegex.exec(s);
|
|
8556
|
-
|
|
8557
|
-
if (attributeMatch === null) {
|
|
8558
|
-
// We're only in this branch if we don't have a attribute-like
|
|
8559
|
-
// preceding sequence. For comments, this guards against unusual
|
|
8560
|
-
// attribute values like <div foo="<!--${'bar'}">. Cases like
|
|
8561
|
-
// <!-- foo=${'bar'}--> are handled correctly in the attribute branch
|
|
8562
|
-
// below.
|
|
8563
|
-
html += s + (isCommentBinding ? commentMarker : nodeMarker);
|
|
8564
|
-
} else {
|
|
8565
|
-
// For attributes we use just a marker sentinel, and also append a
|
|
8566
|
-
// $lit$ suffix to the name to opt-out of attribute-specific parsing
|
|
8567
|
-
// that IE and Edge do for style and certain SVG attributes.
|
|
8568
|
-
html += s.substr(0, attributeMatch.index) + attributeMatch[1] + attributeMatch[2] + boundAttributeSuffix + attributeMatch[3] + marker;
|
|
8569
|
-
}
|
|
8570
|
-
}
|
|
8571
|
-
|
|
8572
|
-
html += this.strings[l];
|
|
8573
|
-
return html;
|
|
8262
|
+
class C {
|
|
8263
|
+
constructor(t, i, s, e) {
|
|
8264
|
+
this.type = 2, this.N = void 0, this.A = t, this.B = i, this.M = s, this.options = e;
|
|
8574
8265
|
}
|
|
8575
8266
|
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
return template;
|
|
8267
|
+
setConnected(t) {
|
|
8268
|
+
var i;
|
|
8269
|
+
null === (i = this.P) || void 0 === i || i.call(this, t);
|
|
8580
8270
|
}
|
|
8581
8271
|
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
/**
|
|
8585
|
-
* @license
|
|
8586
|
-
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
8587
|
-
* This code may only be used under the BSD style license found at
|
|
8588
|
-
* http://polymer.github.io/LICENSE.txt
|
|
8589
|
-
* The complete set of authors may be found at
|
|
8590
|
-
* http://polymer.github.io/AUTHORS.txt
|
|
8591
|
-
* The complete set of contributors may be found at
|
|
8592
|
-
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
8593
|
-
* Code distributed by Google as part of the polymer project is also
|
|
8594
|
-
* subject to an additional IP rights grant found at
|
|
8595
|
-
* http://polymer.github.io/PATENTS.txt
|
|
8596
|
-
*/
|
|
8597
|
-
const isPrimitive = value => {
|
|
8598
|
-
return value === null || !(typeof value === 'object' || typeof value === 'function');
|
|
8599
|
-
};
|
|
8600
|
-
const isIterable = value => {
|
|
8601
|
-
return Array.isArray(value) || // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8602
|
-
!!(value && value[Symbol.iterator]);
|
|
8603
|
-
};
|
|
8604
|
-
/**
|
|
8605
|
-
* A Part that controls a location within a Node tree. Like a Range, NodePart
|
|
8606
|
-
* has start and end locations and can set and update the Nodes between those
|
|
8607
|
-
* locations.
|
|
8608
|
-
*
|
|
8609
|
-
* NodeParts support several value types: primitives, Nodes, TemplateResults,
|
|
8610
|
-
* as well as arrays and iterables of those types.
|
|
8611
|
-
*/
|
|
8612
|
-
|
|
8613
|
-
class NodePart {
|
|
8614
|
-
constructor(options) {
|
|
8615
|
-
this.value = undefined;
|
|
8616
|
-
this.__pendingValue = undefined;
|
|
8617
|
-
this.options = options;
|
|
8272
|
+
get parentNode() {
|
|
8273
|
+
return this.A.parentNode;
|
|
8618
8274
|
}
|
|
8619
|
-
/**
|
|
8620
|
-
* Appends this part into a container.
|
|
8621
|
-
*
|
|
8622
|
-
* This part must be empty, as its contents are not automatically moved.
|
|
8623
|
-
*/
|
|
8624
|
-
|
|
8625
8275
|
|
|
8626
|
-
|
|
8627
|
-
this.
|
|
8628
|
-
this.endNode = container.appendChild(createMarker());
|
|
8276
|
+
get startNode() {
|
|
8277
|
+
return this.A;
|
|
8629
8278
|
}
|
|
8630
|
-
/**
|
|
8631
|
-
* Inserts this part after the `ref` node (between `ref` and `ref`'s next
|
|
8632
|
-
* sibling). Both `ref` and its next sibling must be static, unchanging nodes
|
|
8633
|
-
* such as those that appear in a literal section of a template.
|
|
8634
|
-
*
|
|
8635
|
-
* This part must be empty, as its contents are not automatically moved.
|
|
8636
|
-
*/
|
|
8637
8279
|
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
this.startNode = ref;
|
|
8641
|
-
this.endNode = ref.nextSibling;
|
|
8280
|
+
get endNode() {
|
|
8281
|
+
return this.B;
|
|
8642
8282
|
}
|
|
8643
|
-
/**
|
|
8644
|
-
* Appends this part into a parent part.
|
|
8645
|
-
*
|
|
8646
|
-
* This part must be empty, as its contents are not automatically moved.
|
|
8647
|
-
*/
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
appendIntoPart(part) {
|
|
8651
|
-
part.__insert(this.startNode = createMarker());
|
|
8652
8283
|
|
|
8653
|
-
|
|
8284
|
+
I(t, i = this) {
|
|
8285
|
+
t = S(this, t, i), d(t) ? t === A || null == t || "" === t ? (this.H !== A && this.R(), this.H = A) : t !== this.H && t !== w && this.m(t) : void 0 !== t._$litType$ ? this._(t) : void 0 !== t.nodeType ? this.$(t) : a(t) ? this.g(t) : this.m(t);
|
|
8654
8286
|
}
|
|
8655
|
-
/**
|
|
8656
|
-
* Inserts this part after the `ref` part.
|
|
8657
|
-
*
|
|
8658
|
-
* This part must be empty, as its contents are not automatically moved.
|
|
8659
|
-
*/
|
|
8660
8287
|
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
ref.__insert(this.startNode = createMarker());
|
|
8664
|
-
|
|
8665
|
-
this.endNode = ref.endNode;
|
|
8666
|
-
ref.endNode = this.startNode;
|
|
8288
|
+
k(t, i = this.B) {
|
|
8289
|
+
return this.A.parentNode.insertBefore(t, i);
|
|
8667
8290
|
}
|
|
8668
8291
|
|
|
8669
|
-
|
|
8670
|
-
this.
|
|
8292
|
+
$(t) {
|
|
8293
|
+
this.H !== t && (this.R(), this.H = this.k(t));
|
|
8671
8294
|
}
|
|
8672
8295
|
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
while (isDirective(this.__pendingValue)) {
|
|
8679
|
-
const directive = this.__pendingValue;
|
|
8680
|
-
this.__pendingValue = noChange;
|
|
8681
|
-
directive(this);
|
|
8682
|
-
}
|
|
8683
|
-
|
|
8684
|
-
const value = this.__pendingValue;
|
|
8685
|
-
|
|
8686
|
-
if (value === noChange) {
|
|
8687
|
-
return;
|
|
8688
|
-
}
|
|
8296
|
+
m(t) {
|
|
8297
|
+
const i = this.A.nextSibling;
|
|
8298
|
+
null !== i && 3 === i.nodeType && (null === this.B ? null === i.nextSibling : i === this.B.previousSibling) ? i.data = t : this.$(u.createTextNode(t)), this.H = t;
|
|
8299
|
+
}
|
|
8689
8300
|
|
|
8690
|
-
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
|
|
8694
|
-
|
|
8695
|
-
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
this.value = nothing;
|
|
8702
|
-
this.clear();
|
|
8703
|
-
} else {
|
|
8704
|
-
// Fallback, will render the string representation
|
|
8705
|
-
this.__commitText(value);
|
|
8301
|
+
_(t) {
|
|
8302
|
+
var i;
|
|
8303
|
+
const {
|
|
8304
|
+
values: s,
|
|
8305
|
+
_$litType$: e
|
|
8306
|
+
} = t,
|
|
8307
|
+
o = "number" == typeof e ? this.C(t) : (void 0 === e.el && (e.el = N.createElement(e.h, this.options)), e);
|
|
8308
|
+
if ((null === (i = this.H) || void 0 === i ? void 0 : i.D) === o) this.H.v(s);else {
|
|
8309
|
+
const t = new k(o, this),
|
|
8310
|
+
i = t.u(this.options);
|
|
8311
|
+
t.v(s), this.$(i), this.H = t;
|
|
8706
8312
|
}
|
|
8707
8313
|
}
|
|
8708
8314
|
|
|
8709
|
-
|
|
8710
|
-
|
|
8315
|
+
C(t) {
|
|
8316
|
+
let i = P.get(t.strings);
|
|
8317
|
+
return void 0 === i && P.set(t.strings, i = new N(t)), i;
|
|
8711
8318
|
}
|
|
8712
8319
|
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8320
|
+
g(t) {
|
|
8321
|
+
v(this.H) || (this.H = [], this.R());
|
|
8322
|
+
const i = this.H;
|
|
8323
|
+
let s,
|
|
8324
|
+
e = 0;
|
|
8717
8325
|
|
|
8718
|
-
this.
|
|
8326
|
+
for (const o of t) e === i.length ? i.push(s = new C(this.k(c()), this.k(c()), this, this.options)) : s = i[e], s.I(o), e++;
|
|
8719
8327
|
|
|
8720
|
-
this.
|
|
8721
|
-
|
|
8722
|
-
this.value = value;
|
|
8328
|
+
e < i.length && (this.R(s && s.B.nextSibling, e), i.length = e);
|
|
8723
8329
|
}
|
|
8724
8330
|
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
value = value == null ? '' : value; // If `value` isn't already a string, we explicitly convert it here in case
|
|
8728
|
-
// it can't be implicitly converted - i.e. it's a symbol.
|
|
8729
|
-
|
|
8730
|
-
const valueAsString = typeof value === 'string' ? value : String(value);
|
|
8331
|
+
R(t = this.A.nextSibling, i) {
|
|
8332
|
+
var s;
|
|
8731
8333
|
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
// If we only have a single text node between the markers, we can just
|
|
8736
|
-
// set its value, rather than replacing it.
|
|
8737
|
-
// TODO(justinfagnani): Can we just check if this.value is primitive?
|
|
8738
|
-
node.data = valueAsString;
|
|
8739
|
-
} else {
|
|
8740
|
-
this.__commitNode(document.createTextNode(valueAsString));
|
|
8334
|
+
for (null === (s = this.P) || void 0 === s || s.call(this, !1, !0, i); t && t !== this.B;) {
|
|
8335
|
+
const i = t.nextSibling;
|
|
8336
|
+
t.remove(), t = i;
|
|
8741
8337
|
}
|
|
8742
|
-
|
|
8743
|
-
this.value = value;
|
|
8744
8338
|
}
|
|
8745
8339
|
|
|
8746
|
-
|
|
8747
|
-
const template = this.options.templateFactory(value);
|
|
8748
|
-
|
|
8749
|
-
if (this.value instanceof TemplateInstance && this.value.template === template) {
|
|
8750
|
-
this.value.update(value.values);
|
|
8751
|
-
} else {
|
|
8752
|
-
// Make sure we propagate the template processor from the TemplateResult
|
|
8753
|
-
// so that we use its syntax extension, etc. The template factory comes
|
|
8754
|
-
// from the render function options so that it can control template
|
|
8755
|
-
// caching and preprocessing.
|
|
8756
|
-
const instance = new TemplateInstance(template, value.processor, this.options);
|
|
8757
|
-
|
|
8758
|
-
const fragment = instance._clone();
|
|
8759
|
-
|
|
8760
|
-
instance.update(value.values);
|
|
8761
|
-
|
|
8762
|
-
this.__commitNode(fragment);
|
|
8340
|
+
}
|
|
8763
8341
|
|
|
8764
|
-
|
|
8765
|
-
|
|
8342
|
+
class H {
|
|
8343
|
+
constructor(t, i, s, e, o) {
|
|
8344
|
+
this.type = 1, this.H = A, this.N = void 0, this.V = void 0, this.element = t, this.name = i, this.M = e, this.options = o, s.length > 2 || "" !== s[0] || "" !== s[1] ? (this.H = Array(s.length - 1).fill(A), this.strings = s) : this.H = A;
|
|
8766
8345
|
}
|
|
8767
8346
|
|
|
8768
|
-
|
|
8769
|
-
|
|
8770
|
-
|
|
8771
|
-
// an Iterable, but it lets us recurse easily and efficiently update Arrays
|
|
8772
|
-
// of TemplateResults that will be commonly returned from expressions like:
|
|
8773
|
-
// array.map((i) => html`${i}`), by reusing existing TemplateInstances.
|
|
8774
|
-
// If _value is an array, then the previous render was of an
|
|
8775
|
-
// iterable and _value will contain the NodeParts from the previous
|
|
8776
|
-
// render. If _value is not an array, clear this part and make a new
|
|
8777
|
-
// array for NodeParts.
|
|
8778
|
-
if (!Array.isArray(this.value)) {
|
|
8779
|
-
this.value = [];
|
|
8780
|
-
this.clear();
|
|
8781
|
-
} // Lets us keep track of how many items we stamped so we can clear leftover
|
|
8782
|
-
// items from a previous render
|
|
8783
|
-
|
|
8784
|
-
|
|
8785
|
-
const itemParts = this.value;
|
|
8786
|
-
let partIndex = 0;
|
|
8787
|
-
let itemPart;
|
|
8788
|
-
|
|
8789
|
-
for (const item of value) {
|
|
8790
|
-
// Try to reuse an existing part
|
|
8791
|
-
itemPart = itemParts[partIndex]; // If no existing part, create a new one
|
|
8792
|
-
|
|
8793
|
-
if (itemPart === undefined) {
|
|
8794
|
-
itemPart = new NodePart(this.options);
|
|
8795
|
-
itemParts.push(itemPart);
|
|
8796
|
-
|
|
8797
|
-
if (partIndex === 0) {
|
|
8798
|
-
itemPart.appendIntoPart(this);
|
|
8799
|
-
} else {
|
|
8800
|
-
itemPart.insertAfterPart(itemParts[partIndex - 1]);
|
|
8801
|
-
}
|
|
8802
|
-
}
|
|
8347
|
+
get tagName() {
|
|
8348
|
+
return this.element.tagName;
|
|
8349
|
+
}
|
|
8803
8350
|
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8351
|
+
I(t, i = this, s, e) {
|
|
8352
|
+
const o = this.strings;
|
|
8353
|
+
let l = !1;
|
|
8354
|
+
if (void 0 === o) t = S(this, t, i, 0), l = !d(t) || t !== this.H && t !== w, l && (this.H = t);else {
|
|
8355
|
+
const e = t;
|
|
8356
|
+
let n, h;
|
|
8808
8357
|
|
|
8809
|
-
|
|
8810
|
-
// Truncate the parts array so _value reflects the current state
|
|
8811
|
-
itemParts.length = partIndex;
|
|
8812
|
-
this.clear(itemPart && itemPart.endNode);
|
|
8358
|
+
for (t = o[0], n = 0; n < o.length - 1; n++) h = S(this, e[s + n], i, n), h === w && (h = this.H[n]), l || (l = !d(h) || h !== this.H[n]), h === A ? t = A : t !== A && (t += (null != h ? h : "") + o[n + 1]), this.H[n] = h;
|
|
8813
8359
|
}
|
|
8360
|
+
l && !e && this.W(t);
|
|
8814
8361
|
}
|
|
8815
8362
|
|
|
8816
|
-
|
|
8817
|
-
|
|
8363
|
+
W(t) {
|
|
8364
|
+
t === A ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, null != t ? t : "");
|
|
8818
8365
|
}
|
|
8819
8366
|
|
|
8820
8367
|
}
|
|
8821
|
-
// from the options object, then options are supported. If not, then the third
|
|
8822
|
-
// argument to add/removeEventListener is interpreted as the boolean capture
|
|
8823
|
-
// value so we should only pass the `capture` property.
|
|
8824
|
-
|
|
8825
|
-
let eventOptionsSupported = false; // Wrap into an IIFE because MS Edge <= v41 does not support having try/catch
|
|
8826
|
-
// blocks right into the body of a module
|
|
8827
|
-
|
|
8828
|
-
(() => {
|
|
8829
|
-
try {
|
|
8830
|
-
const options = {
|
|
8831
|
-
get capture() {
|
|
8832
|
-
eventOptionsSupported = true;
|
|
8833
|
-
return false;
|
|
8834
|
-
}
|
|
8835
|
-
|
|
8836
|
-
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8837
8368
|
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
} catch (_e) {// event options not supported
|
|
8369
|
+
class I extends H {
|
|
8370
|
+
constructor() {
|
|
8371
|
+
super(...arguments), this.type = 3;
|
|
8842
8372
|
}
|
|
8843
|
-
})();
|
|
8844
|
-
|
|
8845
|
-
/**
|
|
8846
|
-
* @license
|
|
8847
|
-
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
8848
|
-
* This code may only be used under the BSD style license found at
|
|
8849
|
-
* http://polymer.github.io/LICENSE.txt
|
|
8850
|
-
* The complete set of authors may be found at
|
|
8851
|
-
* http://polymer.github.io/AUTHORS.txt
|
|
8852
|
-
* The complete set of contributors may be found at
|
|
8853
|
-
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
8854
|
-
* Code distributed by Google as part of the polymer project is also
|
|
8855
|
-
* subject to an additional IP rights grant found at
|
|
8856
|
-
* http://polymer.github.io/PATENTS.txt
|
|
8857
|
-
*/
|
|
8858
|
-
/**
|
|
8859
|
-
* The default TemplateFactory which caches Templates keyed on
|
|
8860
|
-
* result.type and result.strings.
|
|
8861
|
-
*/
|
|
8862
8373
|
|
|
8863
|
-
|
|
8864
|
-
|
|
8865
|
-
|
|
8866
|
-
if (templateCache === undefined) {
|
|
8867
|
-
templateCache = {
|
|
8868
|
-
stringsArray: new WeakMap(),
|
|
8869
|
-
keyString: new Map()
|
|
8870
|
-
};
|
|
8871
|
-
templateCaches.set(result.type, templateCache);
|
|
8374
|
+
W(t) {
|
|
8375
|
+
this.element[this.name] = t === A ? void 0 : t;
|
|
8872
8376
|
}
|
|
8873
8377
|
|
|
8874
|
-
|
|
8875
|
-
|
|
8876
|
-
if (template !== undefined) {
|
|
8877
|
-
return template;
|
|
8878
|
-
} // If the TemplateStringsArray is new, generate a key from the strings
|
|
8879
|
-
// This key is shared between all templates with identical content
|
|
8378
|
+
}
|
|
8880
8379
|
|
|
8380
|
+
class L extends H {
|
|
8381
|
+
constructor() {
|
|
8382
|
+
super(...arguments), this.type = 4;
|
|
8383
|
+
}
|
|
8881
8384
|
|
|
8882
|
-
|
|
8385
|
+
W(t) {
|
|
8386
|
+
t && t !== A ? this.element.setAttribute(this.name, "") : this.element.removeAttribute(this.name);
|
|
8387
|
+
}
|
|
8883
8388
|
|
|
8884
|
-
|
|
8389
|
+
}
|
|
8885
8390
|
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8391
|
+
class R extends H {
|
|
8392
|
+
constructor() {
|
|
8393
|
+
super(...arguments), this.type = 5;
|
|
8394
|
+
}
|
|
8889
8395
|
|
|
8890
|
-
|
|
8891
|
-
|
|
8396
|
+
I(t, i = this) {
|
|
8397
|
+
var s;
|
|
8398
|
+
if ((t = null !== (s = S(this, t, i, 0)) && void 0 !== s ? s : A) === w) return;
|
|
8399
|
+
const e = this.H,
|
|
8400
|
+
o = t === A && e !== A || t.capture !== e.capture || t.once !== e.once || t.passive !== e.passive,
|
|
8401
|
+
l = t !== A && (e === A || o);
|
|
8402
|
+
o && this.element.removeEventListener(this.name, this, e), l && this.element.addEventListener(this.name, this, t), this.H = t;
|
|
8403
|
+
}
|
|
8892
8404
|
|
|
8405
|
+
handleEvent(t) {
|
|
8406
|
+
var i, s;
|
|
8407
|
+
"function" == typeof this.H ? this.H.call(null !== (s = null === (i = this.options) || void 0 === i ? void 0 : i.host) && void 0 !== s ? s : this.element, t) : this.H.handleEvent(t);
|
|
8408
|
+
}
|
|
8893
8409
|
|
|
8894
|
-
templateCache.stringsArray.set(result.strings, template);
|
|
8895
|
-
return template;
|
|
8896
8410
|
}
|
|
8897
|
-
const templateCaches = new Map();
|
|
8898
8411
|
|
|
8899
|
-
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
* http://polymer.github.io/LICENSE.txt
|
|
8904
|
-
* The complete set of authors may be found at
|
|
8905
|
-
* http://polymer.github.io/AUTHORS.txt
|
|
8906
|
-
* The complete set of contributors may be found at
|
|
8907
|
-
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
8908
|
-
* Code distributed by Google as part of the polymer project is also
|
|
8909
|
-
* subject to an additional IP rights grant found at
|
|
8910
|
-
* http://polymer.github.io/PATENTS.txt
|
|
8911
|
-
*/
|
|
8912
|
-
const parts = new WeakMap();
|
|
8913
|
-
/**
|
|
8914
|
-
* Renders a template result or other value to a container.
|
|
8915
|
-
*
|
|
8916
|
-
* To update a container with new values, reevaluate the template literal and
|
|
8917
|
-
* call `render` with the new result.
|
|
8918
|
-
*
|
|
8919
|
-
* @param result Any value renderable by NodePart - typically a TemplateResult
|
|
8920
|
-
* created by evaluating a template tag like `html` or `svg`.
|
|
8921
|
-
* @param container A DOM parent to render to. The entire contents are either
|
|
8922
|
-
* replaced, or efficiently updated if the same result type was previous
|
|
8923
|
-
* rendered there.
|
|
8924
|
-
* @param options RenderOptions for the entire render tree rendered to this
|
|
8925
|
-
* container. Render options must *not* change between renders to the same
|
|
8926
|
-
* container, as those changes will not effect previously rendered DOM.
|
|
8927
|
-
*/
|
|
8928
|
-
|
|
8929
|
-
const render = (result, container, options) => {
|
|
8930
|
-
let part = parts.get(container);
|
|
8931
|
-
|
|
8932
|
-
if (part === undefined) {
|
|
8933
|
-
removeNodes(container, container.firstChild);
|
|
8934
|
-
parts.set(container, part = new NodePart(Object.assign({
|
|
8935
|
-
templateFactory
|
|
8936
|
-
}, options)));
|
|
8937
|
-
part.appendInto(container);
|
|
8938
|
-
}
|
|
8939
|
-
|
|
8940
|
-
part.setValue(result);
|
|
8941
|
-
part.commit();
|
|
8942
|
-
};
|
|
8412
|
+
class z {
|
|
8413
|
+
constructor(t, i, s) {
|
|
8414
|
+
this.element = t, this.type = 6, this.N = void 0, this.V = void 0, this.M = i, this.options = s;
|
|
8415
|
+
}
|
|
8943
8416
|
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
* This code may only be used under the BSD style license found at
|
|
8948
|
-
* http://polymer.github.io/LICENSE.txt
|
|
8949
|
-
* The complete set of authors may be found at
|
|
8950
|
-
* http://polymer.github.io/AUTHORS.txt
|
|
8951
|
-
* The complete set of contributors may be found at
|
|
8952
|
-
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
8953
|
-
* Code distributed by Google as part of the polymer project is also
|
|
8954
|
-
* subject to an additional IP rights grant found at
|
|
8955
|
-
* http://polymer.github.io/PATENTS.txt
|
|
8956
|
-
*/
|
|
8957
|
-
// This line will be used in regexes to search for lit-html usage.
|
|
8958
|
-
// TODO(justinfagnani): inject version number at build time
|
|
8417
|
+
I(t) {
|
|
8418
|
+
S(this, t);
|
|
8419
|
+
}
|
|
8959
8420
|
|
|
8960
|
-
if (typeof window !== 'undefined') {
|
|
8961
|
-
(window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.2.1');
|
|
8962
8421
|
}
|
|
8422
|
+
null === (i = (t = globalThis).litHtmlPlatformSupport) || void 0 === i || i.call(t, N, C), (null !== (s = (e = globalThis).litHtmlVersions) && void 0 !== s ? s : e.litHtmlVersions = []).push("2.0.0-rc.2");
|
|
8963
8423
|
|
|
8964
8424
|
// Backbone.js 1.4.0
|
|
8965
8425
|
const paddedLt = /^\s*</; // Caches a local reference to `Element.prototype` for faster access.
|
|
8966
8426
|
// if an existing element is not provided...
|
|
8967
8427
|
|
|
8968
8428
|
|
|
8969
|
-
const View = function
|
|
8429
|
+
const View = function (options) {
|
|
8970
8430
|
this.cid = uniqueId('view');
|
|
8971
8431
|
this._domEvents = [];
|
|
8972
8432
|
this.preinitialize.apply(this, arguments);
|
|
@@ -8985,27 +8445,27 @@
|
|
|
8985
8445
|
Object.assign(View.prototype, Events, {
|
|
8986
8446
|
// The default `tagName` of a View's element is `"div"`.
|
|
8987
8447
|
tagName: 'div',
|
|
8988
|
-
$: function
|
|
8448
|
+
$: function (selector) {
|
|
8989
8449
|
return this.el.querySelectorAll(selector);
|
|
8990
8450
|
},
|
|
8991
8451
|
// preinitialize is an empty function by default. You can override it with a function
|
|
8992
8452
|
// or object. preinitialize will run before any instantiation logic is run in the View
|
|
8993
|
-
preinitialize: function
|
|
8453
|
+
preinitialize: function () {},
|
|
8994
8454
|
// Initialize is an empty function by default. Override it with your own
|
|
8995
8455
|
// initialization logic.
|
|
8996
|
-
initialize: function
|
|
8456
|
+
initialize: function () {},
|
|
8997
8457
|
// **render** is the core function that your view should override, in order
|
|
8998
8458
|
// to populate its element (`this.el`), with the appropriate HTML. The
|
|
8999
8459
|
// convention is for **render** to always return `this`.
|
|
9000
|
-
render: function
|
|
8460
|
+
render: function () {
|
|
9001
8461
|
isFunction(this.beforeRender) && this.beforeRender();
|
|
9002
|
-
isFunction(this.toHTML) &&
|
|
8462
|
+
isFunction(this.toHTML) && V(this.toHTML(), this.el);
|
|
9003
8463
|
isFunction(this.afterRender) && this.afterRender();
|
|
9004
8464
|
return this;
|
|
9005
8465
|
},
|
|
9006
8466
|
// Remove this view by taking the element out of the DOM, and removing any
|
|
9007
8467
|
// applicable Backbone.Events listeners.
|
|
9008
|
-
remove: function
|
|
8468
|
+
remove: function () {
|
|
9009
8469
|
this._removeElement();
|
|
9010
8470
|
|
|
9011
8471
|
this.stopListening();
|
|
@@ -9014,13 +8474,13 @@
|
|
|
9014
8474
|
// Remove this view's element from the document and all event listeners
|
|
9015
8475
|
// attached to it. Exposed for subclasses using an alternative DOM
|
|
9016
8476
|
// manipulation API.
|
|
9017
|
-
_removeElement: function
|
|
8477
|
+
_removeElement: function () {
|
|
9018
8478
|
this.undelegateEvents();
|
|
9019
8479
|
if (this.el.parentNode) this.el.parentNode.removeChild(this.el);
|
|
9020
8480
|
},
|
|
9021
8481
|
// Change the view's element (`this.el` property) and re-delegate the
|
|
9022
8482
|
// view's events on the new element.
|
|
9023
|
-
setElement: function
|
|
8483
|
+
setElement: function (element) {
|
|
9024
8484
|
this.undelegateEvents();
|
|
9025
8485
|
|
|
9026
8486
|
this._setElement(element);
|
|
@@ -9031,7 +8491,7 @@
|
|
|
9031
8491
|
// Apply the `element` to the view. `element` can be a CSS selector,
|
|
9032
8492
|
// a string of HTML, or an Element node. If passed a NodeList or CSS
|
|
9033
8493
|
// selector, uses just the first match.
|
|
9034
|
-
_setElement: function
|
|
8494
|
+
_setElement: function (element) {
|
|
9035
8495
|
if (typeof element == 'string') {
|
|
9036
8496
|
if (paddedLt.test(element)) {
|
|
9037
8497
|
const el = document.createElement('div');
|
|
@@ -9059,7 +8519,7 @@
|
|
|
9059
8519
|
// pairs. Callbacks will be bound to the view, with `this` set properly.
|
|
9060
8520
|
// Uses event delegation for efficiency.
|
|
9061
8521
|
// Omitting the selector binds the event to `this.el`.
|
|
9062
|
-
delegateEvents: function
|
|
8522
|
+
delegateEvents: function (events) {
|
|
9063
8523
|
events || (events = result(this, 'events'));
|
|
9064
8524
|
if (!events) return this;
|
|
9065
8525
|
this.undelegateEvents();
|
|
@@ -9082,7 +8542,7 @@
|
|
|
9082
8542
|
// the event's `delegateTarget` property is set to it and the return the
|
|
9083
8543
|
// result of calling bound `listener` with the parameters given to the
|
|
9084
8544
|
// handler.
|
|
9085
|
-
delegate: function
|
|
8545
|
+
delegate: function (eventName, selector, listener) {
|
|
9086
8546
|
const root = this.el;
|
|
9087
8547
|
|
|
9088
8548
|
if (!root) {
|
|
@@ -9137,7 +8597,7 @@
|
|
|
9137
8597
|
// Clears all callbacks previously bound to the view by `delegateEvents`.
|
|
9138
8598
|
// You usually don't need to use this, but may wish to if you have multiple
|
|
9139
8599
|
// Backbone views attached to the same DOM element.
|
|
9140
|
-
undelegateEvents: function
|
|
8600
|
+
undelegateEvents: function () {
|
|
9141
8601
|
if (this.el) {
|
|
9142
8602
|
for (let i = 0, len = this._domEvents.length; i < len; i++) {
|
|
9143
8603
|
const item = this._domEvents[i];
|
|
@@ -9151,7 +8611,7 @@
|
|
|
9151
8611
|
},
|
|
9152
8612
|
// A finer-grained `undelegateEvents` for removing a single delegated event.
|
|
9153
8613
|
// `selector` and `listener` are both optional.
|
|
9154
|
-
undelegate: function
|
|
8614
|
+
undelegate: function (eventName, selector, listener) {
|
|
9155
8615
|
if (typeof selector === 'function') {
|
|
9156
8616
|
listener = selector;
|
|
9157
8617
|
selector = null;
|
|
@@ -9180,14 +8640,14 @@
|
|
|
9180
8640
|
},
|
|
9181
8641
|
// Produces a DOM element to be assigned to your view. Exposed for
|
|
9182
8642
|
// subclasses using an alternative DOM manipulation API.
|
|
9183
|
-
_createElement: function
|
|
8643
|
+
_createElement: function (tagName) {
|
|
9184
8644
|
return document.createElement(tagName);
|
|
9185
8645
|
},
|
|
9186
8646
|
// Ensure that the View has a DOM element to render into.
|
|
9187
8647
|
// If `this.el` is a string, pass it through `$()`, take the first
|
|
9188
8648
|
// matching element, and re-assign it to `el`. Otherwise, create
|
|
9189
8649
|
// an element from the `id`, `className` and `tagName` properties.
|
|
9190
|
-
_ensureElement: function
|
|
8650
|
+
_ensureElement: function () {
|
|
9191
8651
|
if (!this.el) {
|
|
9192
8652
|
const attrs = assignIn({}, result(this, 'attributes'));
|
|
9193
8653
|
if (this.id) attrs.id = result(this, 'id');
|
|
@@ -9201,7 +8661,7 @@
|
|
|
9201
8661
|
},
|
|
9202
8662
|
// Set attributes from a hash on this view's element. Exposed for
|
|
9203
8663
|
// subclasses using an alternative DOM manipulation API.
|
|
9204
|
-
_setAttributes: function
|
|
8664
|
+
_setAttributes: function (attrs) {
|
|
9205
8665
|
for (const attr in attrs) {
|
|
9206
8666
|
attr in this.el ? this.el[attr] = attrs[attr] : this.el.setAttribute(attr, attrs[attr]);
|
|
9207
8667
|
}
|