unpoly-rails 2.5.3 → 2.6.0
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.
Potentially problematic release.
This version of unpoly-rails might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/assets/unpoly/unpoly.es5.js +354 -188
- data/assets/unpoly/unpoly.es5.min.js +1 -1
- data/assets/unpoly/unpoly.js +342 -182
- data/assets/unpoly/unpoly.min.js +1 -1
- data/lib/unpoly/rails/version.rb +1 -1
- metadata +2 -2
data/assets/unpoly/unpoly.es5.js
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
@module up
|
9
9
|
*/
|
10
10
|
window.up = {
|
11
|
-
version: '2.
|
11
|
+
version: '2.6.0'
|
12
12
|
};
|
13
13
|
|
14
14
|
|
@@ -2167,7 +2167,36 @@ up.error = (function () {
|
|
2167
2167
|
var message = error.message;
|
2168
2168
|
up.emit(window, 'error', { message: message, error: error, log: false });
|
2169
2169
|
}
|
2170
|
+
/*-
|
2171
|
+
Throws a [JavaScript error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)
|
2172
|
+
with the given message.
|
2173
|
+
|
2174
|
+
The message may contain [substitution marks](https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions).
|
2175
|
+
|
2176
|
+
### Examples
|
2177
|
+
|
2178
|
+
up.fail('Division by zero')
|
2179
|
+
up.fail('Unexpected result %o', result)
|
2180
|
+
|
2181
|
+
@function up.fail
|
2182
|
+
@param {string} message
|
2183
|
+
A message with details about the error.
|
2184
|
+
|
2185
|
+
The message can contain [substitution marks](https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions)
|
2186
|
+
like `%s` or `%o`.
|
2187
|
+
@param {Array<string>} vars...
|
2188
|
+
A list of variables to replace any substitution marks in the error message.
|
2189
|
+
@internal
|
2190
|
+
*/
|
2191
|
+
function fail() {
|
2192
|
+
var args = [];
|
2193
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
2194
|
+
args[_i] = arguments[_i];
|
2195
|
+
}
|
2196
|
+
throw up.error.failed(args);
|
2197
|
+
}
|
2170
2198
|
return {
|
2199
|
+
fail: fail,
|
2171
2200
|
failed: failed,
|
2172
2201
|
aborted: aborted,
|
2173
2202
|
invalidSelector: invalidSelector,
|
@@ -2176,6 +2205,7 @@ up.error = (function () {
|
|
2176
2205
|
emitGlobal: emitGlobal
|
2177
2206
|
};
|
2178
2207
|
})();
|
2208
|
+
up.fail = up.error.fail;
|
2179
2209
|
|
2180
2210
|
|
2181
2211
|
/***/ }),
|
@@ -2837,11 +2867,11 @@ up.element = (function () {
|
|
2837
2867
|
The [text content](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent) of the created element.
|
2838
2868
|
@param {Object} [attrs.content]
|
2839
2869
|
The [inner HTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML) of the created element.
|
2840
|
-
@param {Object} [attrs.style]
|
2870
|
+
@param {Object|string} [attrs.style]
|
2841
2871
|
An object of CSS properties that will be set as the inline style
|
2842
|
-
of the created element.
|
2872
|
+
of the created element. The given object may use kebab-case or camelCase keys.
|
2843
2873
|
|
2844
|
-
|
2874
|
+
You may also pass a string with semicolon-separated styles.
|
2845
2875
|
@return {Element}
|
2846
2876
|
The created element.
|
2847
2877
|
@stable
|
@@ -2949,7 +2979,7 @@ up.element = (function () {
|
|
2949
2979
|
An object of attributes to set on the created element.
|
2950
2980
|
@param {Object} attrs.text
|
2951
2981
|
The [text content](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent) of the created element.
|
2952
|
-
@param {Object} attrs.style
|
2982
|
+
@param {Object|string} attrs.style
|
2953
2983
|
An object of CSS properties that will be set as the inline style
|
2954
2984
|
of the created element.
|
2955
2985
|
|
@@ -3466,11 +3496,16 @@ up.element = (function () {
|
|
3466
3496
|
@stable
|
3467
3497
|
*/
|
3468
3498
|
function setInlineStyle(element, props) {
|
3469
|
-
|
3470
|
-
|
3471
|
-
|
3472
|
-
|
3473
|
-
style
|
3499
|
+
if (u.isString(props)) {
|
3500
|
+
element.setAttribute('style', props);
|
3501
|
+
}
|
3502
|
+
else {
|
3503
|
+
var style = element.style;
|
3504
|
+
for (var key in props) {
|
3505
|
+
var value = props[key];
|
3506
|
+
value = normalizeStyleValueForWrite(key, value);
|
3507
|
+
style[key] = value;
|
3508
|
+
}
|
3474
3509
|
}
|
3475
3510
|
}
|
3476
3511
|
function normalizeStyleValueForWrite(key, value) {
|
@@ -4633,8 +4668,16 @@ up.Change.UpdateLayer = /** @class */ (function (_super) {
|
|
4633
4668
|
up.fragment.markAsDestroying(step.oldElement);
|
4634
4669
|
}, afterInsert: function () {
|
4635
4670
|
_this.responseDoc.finalizeElement(step.newElement);
|
4671
|
+
step.keepPlans.forEach(_this.reviveKeepable);
|
4672
|
+
// In the case of [up-keep] descendants, keepable elements are now transferred
|
4673
|
+
// to step.newElement, leaving a clone in their old DOM Position.
|
4674
|
+
// up.hello() is aware of step.keepPlans and will not compile kept elements a second time.
|
4636
4675
|
up.hello(step.newElement, step);
|
4637
4676
|
}, beforeDetach: function () {
|
4677
|
+
// In the case of [up-keep] descendants, keepable elements have been replaced
|
4678
|
+
// with a clone in step.oldElement. However, since that clone was never compiled,
|
4679
|
+
// it does not have destructors registered. Hence we will not clean the clone
|
4680
|
+
// unnecessarily.
|
4638
4681
|
up.syntax.clean(step.oldElement, { layer: _this.layer });
|
4639
4682
|
}, afterDetach: function () {
|
4640
4683
|
e.remove(step.oldElement); // clean up jQuery data
|
@@ -4762,9 +4805,10 @@ up.Change.UpdateLayer = /** @class */ (function (_super) {
|
|
4762
4805
|
if (step.keep) {
|
4763
4806
|
for (var _i = 0, _a = step.oldElement.querySelectorAll('[up-keep]'); _i < _a.length; _i++) {
|
4764
4807
|
var keepable = _a[_i];
|
4765
|
-
var
|
4766
|
-
if (
|
4808
|
+
var keepPlan = this.findKeepPlan(__assign(__assign({}, step), { oldElement: keepable, descendantsOnly: true }));
|
4809
|
+
if (keepPlan) {
|
4767
4810
|
// plan.oldElement is now keepable
|
4811
|
+
this.hibernateKeepable(keepPlan);
|
4768
4812
|
// Replace keepable with its clone so it looks good in a transition between
|
4769
4813
|
// oldElement and newElement. Note that keepable will still point to the same element
|
4770
4814
|
// after the replacement, which is now detached.
|
@@ -4772,8 +4816,8 @@ up.Change.UpdateLayer = /** @class */ (function (_super) {
|
|
4772
4816
|
e.replace(keepable, keepableClone);
|
4773
4817
|
// Since we're going to swap the entire oldElement and newElement containers afterwards,
|
4774
4818
|
// replace the matching element with keepable so it will eventually return to the DOM.
|
4775
|
-
e.replace(
|
4776
|
-
keepPlans.push(
|
4819
|
+
e.replace(keepPlan.newElement, keepable);
|
4820
|
+
keepPlans.push(keepPlan);
|
4777
4821
|
}
|
4778
4822
|
}
|
4779
4823
|
}
|
@@ -4795,6 +4839,19 @@ up.Change.UpdateLayer = /** @class */ (function (_super) {
|
|
4795
4839
|
}
|
4796
4840
|
}
|
4797
4841
|
};
|
4842
|
+
UpdateLayer.prototype.hibernateKeepable = function (keepPlan) {
|
4843
|
+
var viewports = up.viewport.subtree(keepPlan.oldElement);
|
4844
|
+
keepPlan.revivers = viewports.map(function (viewport) {
|
4845
|
+
var scrollTop = viewport.scrollTop, scrollLeft = viewport.scrollLeft;
|
4846
|
+
return function () { return u.assign(viewport, { scrollTop: scrollTop, scrollLeft: scrollLeft }); };
|
4847
|
+
});
|
4848
|
+
};
|
4849
|
+
UpdateLayer.prototype.reviveKeepable = function (keepPlan) {
|
4850
|
+
for (var _i = 0, _a = keepPlan.revivers; _i < _a.length; _i++) {
|
4851
|
+
var reviver = _a[_i];
|
4852
|
+
reviver();
|
4853
|
+
}
|
4854
|
+
};
|
4798
4855
|
UpdateLayer.prototype.matchPreflight = function () {
|
4799
4856
|
if (this.matchedPreflight) {
|
4800
4857
|
return;
|
@@ -4966,7 +5023,7 @@ up.Change.CloseLayer = /** @class */ (function (_super) {
|
|
4966
5023
|
// The close event is emitted on the layer that is about to close.
|
4967
5024
|
return this.layer.emit(this.buildEvent("up:layer:".concat(this.verb)), {
|
4968
5025
|
callback: this.layer.callback("on".concat(u.upperCaseFirst(this.verb))),
|
4969
|
-
log: "Will ".concat(this.verb, " ").concat(this.layer)
|
5026
|
+
log: ["Will ".concat(this.verb, " ").concat(this.layer, " with value %o"), this.value]
|
4970
5027
|
});
|
4971
5028
|
};
|
4972
5029
|
CloseLayer.prototype.emitClosedEvent = function (formerParent) {
|
@@ -4984,7 +5041,7 @@ up.Change.CloseLayer = /** @class */ (function (_super) {
|
|
4984
5041
|
baseLayer: formerParent,
|
4985
5042
|
callback: this.layer.callback("on".concat(verbPastUpperCaseFirst)),
|
4986
5043
|
ensureBubbles: true,
|
4987
|
-
log: "".concat(verbPastUpperCaseFirst, " ").concat(this.layer)
|
5044
|
+
log: ["".concat(verbPastUpperCaseFirst, " ").concat(this.layer, " with value %o"), this.value]
|
4988
5045
|
});
|
4989
5046
|
};
|
4990
5047
|
CloseLayer.prototype.buildEvent = function (name) {
|
@@ -6588,6 +6645,117 @@ up.FragmentFocus = /** @class */ (function (_super) {
|
|
6588
6645
|
/* 33 */
|
6589
6646
|
/***/ (function() {
|
6590
6647
|
|
6648
|
+
var e = up.element;
|
6649
|
+
var u = up.util;
|
6650
|
+
up.FragmentPolling = /** @class */ (function () {
|
6651
|
+
function FragmentPolling(fragment) {
|
6652
|
+
this.options = {};
|
6653
|
+
this.state = 'initialized';
|
6654
|
+
this.setFragment(fragment);
|
6655
|
+
}
|
6656
|
+
FragmentPolling.forFragment = function (fragment) {
|
6657
|
+
return fragment.upPolling || (fragment.upPolling = new this(fragment));
|
6658
|
+
};
|
6659
|
+
FragmentPolling.prototype.onPollAttributeObserved = function () {
|
6660
|
+
this.start();
|
6661
|
+
};
|
6662
|
+
FragmentPolling.prototype.onFragmentDestroyed = function () {
|
6663
|
+
// The element may come back (when it is swapped) or or may not come back (when it is destroyed).
|
6664
|
+
// If it does come back, `onPollAttributeObserved()` will restart the polling.
|
6665
|
+
this.stop();
|
6666
|
+
};
|
6667
|
+
FragmentPolling.prototype.start = function () {
|
6668
|
+
if (this.state !== 'started') {
|
6669
|
+
this.state = 'started';
|
6670
|
+
this.scheduleReload();
|
6671
|
+
}
|
6672
|
+
};
|
6673
|
+
FragmentPolling.prototype.stop = function () {
|
6674
|
+
if (this.state === 'started') {
|
6675
|
+
clearTimeout(this.reloadTimer);
|
6676
|
+
this.state = 'stopped';
|
6677
|
+
}
|
6678
|
+
};
|
6679
|
+
FragmentPolling.prototype.forceStart = function (options) {
|
6680
|
+
u.assign(this.options, options);
|
6681
|
+
this.forceStarted = true;
|
6682
|
+
this.start();
|
6683
|
+
};
|
6684
|
+
FragmentPolling.prototype.forceStop = function () {
|
6685
|
+
this.stop();
|
6686
|
+
this.forceStarted = false;
|
6687
|
+
};
|
6688
|
+
FragmentPolling.prototype.scheduleReload = function (delay) {
|
6689
|
+
var _this = this;
|
6690
|
+
if (delay === void 0) { delay = this.getInterval(); }
|
6691
|
+
this.reloadTimer = setTimeout(function () { return _this.reload(); }, delay);
|
6692
|
+
};
|
6693
|
+
FragmentPolling.prototype.reload = function () {
|
6694
|
+
var _this = this;
|
6695
|
+
// The setTimeout(doReload) callback might already be scheduled
|
6696
|
+
// before the polling stopped.
|
6697
|
+
if (this.state !== 'started') {
|
6698
|
+
return;
|
6699
|
+
}
|
6700
|
+
if (up.radio.shouldPoll(this.fragment)) {
|
6701
|
+
var reloadOptions = {
|
6702
|
+
url: this.options.url,
|
6703
|
+
guardEvent: up.event.build('up:fragment:poll', { log: 'Polling fragment' })
|
6704
|
+
};
|
6705
|
+
u.always(up.reload(this.fragment, reloadOptions), function (result) { return _this.onReloaded(result); });
|
6706
|
+
}
|
6707
|
+
else {
|
6708
|
+
up.puts('[up-poll]', 'Polling is disabled');
|
6709
|
+
// Reconsider after 10 seconds at most
|
6710
|
+
var reconsiderDisabledDelay = Math.min(10 * 1000, this.getInterval());
|
6711
|
+
this.scheduleReload(reconsiderDisabledDelay);
|
6712
|
+
}
|
6713
|
+
};
|
6714
|
+
FragmentPolling.prototype.onReloaded = function (result) {
|
6715
|
+
var _a;
|
6716
|
+
// Transfer this instance to the new fragment.
|
6717
|
+
// We can remove this in case we don't implement forced start/stop.
|
6718
|
+
var newFragment = (_a = result === null || result === void 0 ? void 0 : result.fragments) === null || _a === void 0 ? void 0 : _a[0];
|
6719
|
+
if (newFragment) {
|
6720
|
+
// No need to scheduleReload() in this branch:
|
6721
|
+
// (1) Either the new fragment also has an [up-poll] and we have already
|
6722
|
+
// started in #onPollAttributeObserved().
|
6723
|
+
// (2) Or we are force-started and we will start in #onFragmentSwapped().
|
6724
|
+
this.onFragmentSwapped(newFragment);
|
6725
|
+
}
|
6726
|
+
else {
|
6727
|
+
this.scheduleReload();
|
6728
|
+
}
|
6729
|
+
};
|
6730
|
+
FragmentPolling.prototype.onFragmentSwapped = function (newFragment) {
|
6731
|
+
// Transfer this polling to the new instance
|
6732
|
+
newFragment.upPolling = this;
|
6733
|
+
delete this.fragment.upPolling;
|
6734
|
+
this.setFragment(newFragment);
|
6735
|
+
if (this.state === 'stopped' && this.forceStarted) {
|
6736
|
+
// When polling was started programmatically through up.fragment.startPolling()
|
6737
|
+
// we don't require the updated fragment to have an [up-poll] attribute to
|
6738
|
+
// continue polling.
|
6739
|
+
this.start();
|
6740
|
+
}
|
6741
|
+
};
|
6742
|
+
FragmentPolling.prototype.setFragment = function (newFragment) {
|
6743
|
+
var _this = this;
|
6744
|
+
this.fragment = newFragment;
|
6745
|
+
up.destructor(newFragment, function () { return _this.onFragmentDestroyed(); });
|
6746
|
+
};
|
6747
|
+
FragmentPolling.prototype.getInterval = function () {
|
6748
|
+
var _a, _b;
|
6749
|
+
return (_b = (_a = this.options.interval) !== null && _a !== void 0 ? _a : e.numberAttr(this.fragment, 'up-interval')) !== null && _b !== void 0 ? _b : up.radio.config.pollInterval;
|
6750
|
+
};
|
6751
|
+
return FragmentPolling;
|
6752
|
+
}());
|
6753
|
+
|
6754
|
+
|
6755
|
+
/***/ }),
|
6756
|
+
/* 34 */
|
6757
|
+
/***/ (function() {
|
6758
|
+
|
6591
6759
|
var __extends = (this && this.__extends) || (function () {
|
6592
6760
|
var extendStatics = function (d, b) {
|
6593
6761
|
extendStatics = Object.setPrototypeOf ||
|
@@ -6694,7 +6862,7 @@ up.FragmentScrolling = /** @class */ (function (_super) {
|
|
6694
6862
|
|
6695
6863
|
|
6696
6864
|
/***/ }),
|
6697
|
-
/*
|
6865
|
+
/* 35 */
|
6698
6866
|
/***/ (function() {
|
6699
6867
|
|
6700
6868
|
var u = up.util;
|
@@ -6737,7 +6905,7 @@ up.HTMLWrapper = /** @class */ (function () {
|
|
6737
6905
|
|
6738
6906
|
|
6739
6907
|
/***/ }),
|
6740
|
-
/*
|
6908
|
+
/* 36 */
|
6741
6909
|
/***/ (function() {
|
6742
6910
|
|
6743
6911
|
var __extends = (this && this.__extends) || (function () {
|
@@ -7499,7 +7667,7 @@ up.Layer = /** @class */ (function (_super) {
|
|
7499
7667
|
|
7500
7668
|
|
7501
7669
|
/***/ }),
|
7502
|
-
/*
|
7670
|
+
/* 37 */
|
7503
7671
|
/***/ (function() {
|
7504
7672
|
|
7505
7673
|
var __extends = (this && this.__extends) || (function () {
|
@@ -7687,12 +7855,6 @@ up.Layer.Overlay = /** @class */ (function (_super) {
|
|
7687
7855
|
this.createDismissElement(this.getBoxElement());
|
7688
7856
|
}
|
7689
7857
|
if (this.supportsDismissMethod('outside')) {
|
7690
|
-
this.unbindParentClicked = this.parent.on('up:click', function (event, element) {
|
7691
|
-
// When our origin is clicked again, halt the click event
|
7692
|
-
// We achieve this by halting the click event.
|
7693
|
-
var originClicked = _this.origin && _this.origin.contains(element);
|
7694
|
-
_this.onOutsideClicked(event, originClicked);
|
7695
|
-
});
|
7696
7858
|
// If this overlay has its own viewport, a click outside the frame will hit
|
7697
7859
|
// the viewport and not the parent element.
|
7698
7860
|
if (this.viewportElement) {
|
@@ -7703,6 +7865,18 @@ up.Layer.Overlay = /** @class */ (function (_super) {
|
|
7703
7865
|
}
|
7704
7866
|
});
|
7705
7867
|
}
|
7868
|
+
else {
|
7869
|
+
// Only bind to the parent if there's not already a viewport.
|
7870
|
+
// This prevents issues with other overlay libs appending elements to document.body,
|
7871
|
+
// but overlaying this overlay with a huge z-index. Clicking such a foreign overlay
|
7872
|
+
// would close this layer, as Unpoly considers it to be on the root layer (our parent).2
|
7873
|
+
this.unbindParentClicked = this.parent.on('up:click', function (event, element) {
|
7874
|
+
// When our origin is clicked again, halt the click event
|
7875
|
+
// We achieve this by halting the click event.
|
7876
|
+
var originClicked = _this.origin && _this.origin.contains(element);
|
7877
|
+
_this.onOutsideClicked(event, originClicked);
|
7878
|
+
});
|
7879
|
+
}
|
7706
7880
|
}
|
7707
7881
|
if (this.supportsDismissMethod('key')) {
|
7708
7882
|
this.unbindEscapePressed = up.event.onEscape(function (event) { return _this.onEscapePressed(event); });
|
@@ -7725,7 +7899,7 @@ up.Layer.Overlay = /** @class */ (function (_super) {
|
|
7725
7899
|
if (halt) {
|
7726
7900
|
up.event.halt(event);
|
7727
7901
|
}
|
7728
|
-
this.dismiss(':outside');
|
7902
|
+
this.dismiss(':outside', { origin: event.target });
|
7729
7903
|
};
|
7730
7904
|
Overlay.prototype.onEscapePressed = function (event) {
|
7731
7905
|
// All overlays listen to the Escape key being pressed, but only the front layer
|
@@ -7752,7 +7926,7 @@ up.Layer.Overlay = /** @class */ (function (_super) {
|
|
7752
7926
|
// Since we're defining this handler on up.Overlay, we will not prevent
|
7753
7927
|
// a link from being followed on the root layer.
|
7754
7928
|
up.event.halt(event);
|
7755
|
-
var origin = event.target
|
7929
|
+
var origin = e.closest(event.target, selector);
|
7756
7930
|
var value = e.jsonAttr(origin, attribute);
|
7757
7931
|
var closeOptions = { origin: origin };
|
7758
7932
|
var parser = new up.OptionsParser(closeOptions, origin);
|
@@ -7890,7 +8064,7 @@ up.Layer.Overlay = /** @class */ (function (_super) {
|
|
7890
8064
|
|
7891
8065
|
|
7892
8066
|
/***/ }),
|
7893
|
-
/*
|
8067
|
+
/* 38 */
|
7894
8068
|
/***/ (function() {
|
7895
8069
|
|
7896
8070
|
var __extends = (this && this.__extends) || (function () {
|
@@ -7955,7 +8129,7 @@ up.Layer.OverlayWithTether = /** @class */ (function (_super) {
|
|
7955
8129
|
|
7956
8130
|
|
7957
8131
|
/***/ }),
|
7958
|
-
/*
|
8132
|
+
/* 39 */
|
7959
8133
|
/***/ (function() {
|
7960
8134
|
|
7961
8135
|
var __extends = (this && this.__extends) || (function () {
|
@@ -8027,7 +8201,7 @@ up.Layer.OverlayWithViewport = (_a = /** @class */ (function (_super) {
|
|
8027
8201
|
|
8028
8202
|
|
8029
8203
|
/***/ }),
|
8030
|
-
/*
|
8204
|
+
/* 40 */
|
8031
8205
|
/***/ (function() {
|
8032
8206
|
|
8033
8207
|
var __extends = (this && this.__extends) || (function () {
|
@@ -8121,7 +8295,7 @@ up.Layer.Root = (_a = /** @class */ (function (_super) {
|
|
8121
8295
|
|
8122
8296
|
|
8123
8297
|
/***/ }),
|
8124
|
-
/*
|
8298
|
+
/* 41 */
|
8125
8299
|
/***/ (function() {
|
8126
8300
|
|
8127
8301
|
var __extends = (this && this.__extends) || (function () {
|
@@ -8152,7 +8326,7 @@ up.Layer.Modal = (_a = /** @class */ (function (_super) {
|
|
8152
8326
|
|
8153
8327
|
|
8154
8328
|
/***/ }),
|
8155
|
-
/*
|
8329
|
+
/* 42 */
|
8156
8330
|
/***/ (function() {
|
8157
8331
|
|
8158
8332
|
var __extends = (this && this.__extends) || (function () {
|
@@ -8183,7 +8357,7 @@ up.Layer.Popup = (_a = /** @class */ (function (_super) {
|
|
8183
8357
|
|
8184
8358
|
|
8185
8359
|
/***/ }),
|
8186
|
-
/*
|
8360
|
+
/* 43 */
|
8187
8361
|
/***/ (function() {
|
8188
8362
|
|
8189
8363
|
var __extends = (this && this.__extends) || (function () {
|
@@ -8214,7 +8388,7 @@ up.Layer.Drawer = (_a = /** @class */ (function (_super) {
|
|
8214
8388
|
|
8215
8389
|
|
8216
8390
|
/***/ }),
|
8217
|
-
/*
|
8391
|
+
/* 44 */
|
8218
8392
|
/***/ (function() {
|
8219
8393
|
|
8220
8394
|
var __extends = (this && this.__extends) || (function () {
|
@@ -8245,7 +8419,7 @@ up.Layer.Cover = (_a = /** @class */ (function (_super) {
|
|
8245
8419
|
|
8246
8420
|
|
8247
8421
|
/***/ }),
|
8248
|
-
/*
|
8422
|
+
/* 45 */
|
8249
8423
|
/***/ (function() {
|
8250
8424
|
|
8251
8425
|
var __assign = (this && this.__assign) || function () {
|
@@ -8370,7 +8544,7 @@ up.LayerLookup = /** @class */ (function () {
|
|
8370
8544
|
|
8371
8545
|
|
8372
8546
|
/***/ }),
|
8373
|
-
/*
|
8547
|
+
/* 46 */
|
8374
8548
|
/***/ (function() {
|
8375
8549
|
|
8376
8550
|
var __extends = (this && this.__extends) || (function () {
|
@@ -8575,7 +8749,7 @@ up.LayerStack = /** @class */ (function (_super) {
|
|
8575
8749
|
|
8576
8750
|
|
8577
8751
|
/***/ }),
|
8578
|
-
/*
|
8752
|
+
/* 47 */
|
8579
8753
|
/***/ (function() {
|
8580
8754
|
|
8581
8755
|
up.LinkFeedbackURLs = /** @class */ (function () {
|
@@ -8610,7 +8784,7 @@ up.LinkFeedbackURLs = /** @class */ (function () {
|
|
8610
8784
|
|
8611
8785
|
|
8612
8786
|
/***/ }),
|
8613
|
-
/*
|
8787
|
+
/* 48 */
|
8614
8788
|
/***/ (function() {
|
8615
8789
|
|
8616
8790
|
var u = up.util;
|
@@ -8691,7 +8865,7 @@ up.LinkPreloader = /** @class */ (function () {
|
|
8691
8865
|
|
8692
8866
|
|
8693
8867
|
/***/ }),
|
8694
|
-
/*
|
8868
|
+
/* 49 */
|
8695
8869
|
/***/ (function() {
|
8696
8870
|
|
8697
8871
|
var __assign = (this && this.__assign) || function () {
|
@@ -8944,7 +9118,7 @@ up.MotionController = /** @class */ (function () {
|
|
8944
9118
|
|
8945
9119
|
|
8946
9120
|
/***/ }),
|
8947
|
-
/*
|
9121
|
+
/* 50 */
|
8948
9122
|
/***/ (function() {
|
8949
9123
|
|
8950
9124
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
@@ -9075,7 +9249,7 @@ up.NonceableCallback = /** @class */ (function () {
|
|
9075
9249
|
|
9076
9250
|
|
9077
9251
|
/***/ }),
|
9078
|
-
/*
|
9252
|
+
/* 51 */
|
9079
9253
|
/***/ (function() {
|
9080
9254
|
|
9081
9255
|
var __assign = (this && this.__assign) || function () {
|
@@ -9153,7 +9327,7 @@ up.OptionsParser = /** @class */ (function () {
|
|
9153
9327
|
|
9154
9328
|
|
9155
9329
|
/***/ }),
|
9156
|
-
/*
|
9330
|
+
/* 52 */
|
9157
9331
|
/***/ (function() {
|
9158
9332
|
|
9159
9333
|
var e = up.element;
|
@@ -9247,7 +9421,7 @@ up.OverlayFocus = /** @class */ (function () {
|
|
9247
9421
|
|
9248
9422
|
|
9249
9423
|
/***/ }),
|
9250
|
-
/*
|
9424
|
+
/* 53 */
|
9251
9425
|
/***/ (function() {
|
9252
9426
|
|
9253
9427
|
var u = up.util;
|
@@ -9844,7 +10018,7 @@ up.Params = /** @class */ (function () {
|
|
9844
10018
|
|
9845
10019
|
|
9846
10020
|
/***/ }),
|
9847
|
-
/*
|
10021
|
+
/* 54 */
|
9848
10022
|
/***/ (function() {
|
9849
10023
|
|
9850
10024
|
var e = up.element;
|
@@ -9902,7 +10076,7 @@ up.ProgressBar = /** @class */ (function () {
|
|
9902
10076
|
|
9903
10077
|
|
9904
10078
|
/***/ }),
|
9905
|
-
/*
|
10079
|
+
/* 55 */
|
9906
10080
|
/***/ (function() {
|
9907
10081
|
|
9908
10082
|
var u = up.util;
|
@@ -10041,7 +10215,7 @@ up.RenderOptions = (function () {
|
|
10041
10215
|
|
10042
10216
|
|
10043
10217
|
/***/ }),
|
10044
|
-
/*
|
10218
|
+
/* 56 */
|
10045
10219
|
/***/ (function() {
|
10046
10220
|
|
10047
10221
|
var __extends = (this && this.__extends) || (function () {
|
@@ -10102,7 +10276,7 @@ up.RenderResult = /** @class */ (function (_super) {
|
|
10102
10276
|
|
10103
10277
|
|
10104
10278
|
/***/ }),
|
10105
|
-
/*
|
10279
|
+
/* 57 */
|
10106
10280
|
/***/ (function() {
|
10107
10281
|
|
10108
10282
|
var __extends = (this && this.__extends) || (function () {
|
@@ -10168,8 +10342,18 @@ up.Request = /** @class */ (function (_super) {
|
|
10168
10342
|
// Normalize a first time to get a normalized cache key.
|
10169
10343
|
_this.normalizeForCaching();
|
10170
10344
|
if (!options.basic) {
|
10171
|
-
|
10172
|
-
|
10345
|
+
var layerLookupOptions = { origin: _this.origin };
|
10346
|
+
// Calling up.layer.get() will give us:
|
10347
|
+
//
|
10348
|
+
// (1) Resolution of strings like 'current' to an up.Layer instance
|
10349
|
+
// (2) Default of origin's layer
|
10350
|
+
// (3) Default of up.layer.current
|
10351
|
+
//
|
10352
|
+
// up.layer.get('new') will return 'new' unchanged, but I'm not sure
|
10353
|
+
// if any code actually calls up.request({ ..., layer: 'new' }).
|
10354
|
+
// In up.Change.OpenLayer we connect requests to the base layer we're stacking upon.
|
10355
|
+
_this.layer = up.layer.get(_this.layer, layerLookupOptions);
|
10356
|
+
_this.failLayer = up.layer.get(_this.failLayer || _this.layer, layerLookupOptions);
|
10173
10357
|
_this.context || (_this.context = _this.layer.context || {}); // @layer might be "new", so we default to {}
|
10174
10358
|
_this.failContext || (_this.failContext = _this.failLayer.context || {}); // @failLayer might be "new", so we default to {}
|
10175
10359
|
_this.mode || (_this.mode = _this.layer.mode);
|
@@ -10724,7 +10908,7 @@ up.Request.tester = function (condition) {
|
|
10724
10908
|
|
10725
10909
|
|
10726
10910
|
/***/ }),
|
10727
|
-
/*
|
10911
|
+
/* 58 */
|
10728
10912
|
/***/ (function() {
|
10729
10913
|
|
10730
10914
|
var __extends = (this && this.__extends) || (function () {
|
@@ -10791,7 +10975,7 @@ up.Request.Cache = /** @class */ (function (_super) {
|
|
10791
10975
|
|
10792
10976
|
|
10793
10977
|
/***/ }),
|
10794
|
-
/*
|
10978
|
+
/* 59 */
|
10795
10979
|
/***/ (function() {
|
10796
10980
|
|
10797
10981
|
var u = up.util;
|
@@ -10945,7 +11129,7 @@ up.Request.Queue = /** @class */ (function () {
|
|
10945
11129
|
|
10946
11130
|
|
10947
11131
|
/***/ }),
|
10948
|
-
/*
|
11132
|
+
/* 60 */
|
10949
11133
|
/***/ (function() {
|
10950
11134
|
|
10951
11135
|
var u = up.util;
|
@@ -10998,7 +11182,7 @@ up.Request.FormRenderer = /** @class */ (function () {
|
|
10998
11182
|
|
10999
11183
|
|
11000
11184
|
/***/ }),
|
11001
|
-
/*
|
11185
|
+
/* 61 */
|
11002
11186
|
/***/ (function() {
|
11003
11187
|
|
11004
11188
|
var CONTENT_TYPE_URL_ENCODED = 'application/x-www-form-urlencoded';
|
@@ -11106,7 +11290,7 @@ up.Request.XHRRenderer = /** @class */ (function () {
|
|
11106
11290
|
|
11107
11291
|
|
11108
11292
|
/***/ }),
|
11109
|
-
/*
|
11293
|
+
/* 62 */
|
11110
11294
|
/***/ (function() {
|
11111
11295
|
|
11112
11296
|
var __extends = (this && this.__extends) || (function () {
|
@@ -11324,7 +11508,7 @@ up.Response = /** @class */ (function (_super) {
|
|
11324
11508
|
|
11325
11509
|
|
11326
11510
|
/***/ }),
|
11327
|
-
/*
|
11511
|
+
/* 63 */
|
11328
11512
|
/***/ (function() {
|
11329
11513
|
|
11330
11514
|
var u = up.util;
|
@@ -11433,7 +11617,7 @@ up.ResponseDoc = /** @class */ (function () {
|
|
11433
11617
|
|
11434
11618
|
|
11435
11619
|
/***/ }),
|
11436
|
-
/*
|
11620
|
+
/* 64 */
|
11437
11621
|
/***/ (function() {
|
11438
11622
|
|
11439
11623
|
var e = up.element;
|
@@ -11555,7 +11739,7 @@ up.RevealMotion = /** @class */ (function () {
|
|
11555
11739
|
|
11556
11740
|
|
11557
11741
|
/***/ }),
|
11558
|
-
/*
|
11742
|
+
/* 65 */
|
11559
11743
|
/***/ (function() {
|
11560
11744
|
|
11561
11745
|
var u = up.util;
|
@@ -11635,7 +11819,7 @@ up.ScrollMotion = /** @class */ (function () {
|
|
11635
11819
|
|
11636
11820
|
|
11637
11821
|
/***/ }),
|
11638
|
-
/*
|
11822
|
+
/* 66 */
|
11639
11823
|
/***/ (function() {
|
11640
11824
|
|
11641
11825
|
var e = up.element;
|
@@ -11689,7 +11873,7 @@ up.Selector = /** @class */ (function () {
|
|
11689
11873
|
|
11690
11874
|
|
11691
11875
|
/***/ }),
|
11692
|
-
/*
|
11876
|
+
/* 67 */
|
11693
11877
|
/***/ (function() {
|
11694
11878
|
|
11695
11879
|
var u = up.util;
|
@@ -11724,7 +11908,7 @@ up.store.Memory = /** @class */ (function () {
|
|
11724
11908
|
|
11725
11909
|
|
11726
11910
|
/***/ }),
|
11727
|
-
/*
|
11911
|
+
/* 68 */
|
11728
11912
|
/***/ (function() {
|
11729
11913
|
|
11730
11914
|
var __extends = (this && this.__extends) || (function () {
|
@@ -11812,7 +11996,7 @@ up.store.Session = /** @class */ (function (_super) {
|
|
11812
11996
|
|
11813
11997
|
|
11814
11998
|
/***/ }),
|
11815
|
-
/*
|
11999
|
+
/* 69 */
|
11816
12000
|
/***/ (function() {
|
11817
12001
|
|
11818
12002
|
var u = up.util;
|
@@ -11974,7 +12158,7 @@ up.Tether = /** @class */ (function () {
|
|
11974
12158
|
|
11975
12159
|
|
11976
12160
|
/***/ }),
|
11977
|
-
/*
|
12161
|
+
/* 70 */
|
11978
12162
|
/***/ (function() {
|
11979
12163
|
|
11980
12164
|
var u = up.util;
|
@@ -12068,7 +12252,7 @@ up.URLPattern = /** @class */ (function () {
|
|
12068
12252
|
|
12069
12253
|
|
12070
12254
|
/***/ }),
|
12071
|
-
/*
|
12255
|
+
/* 71 */
|
12072
12256
|
/***/ (function() {
|
12073
12257
|
|
12074
12258
|
/*-
|
@@ -12279,7 +12463,7 @@ up.boot = up.framework.boot;
|
|
12279
12463
|
|
12280
12464
|
|
12281
12465
|
/***/ }),
|
12282
|
-
/*
|
12466
|
+
/* 72 */
|
12283
12467
|
/***/ (function() {
|
12284
12468
|
|
12285
12469
|
/*-
|
@@ -12872,7 +13056,7 @@ up.emit = up.event.emit;
|
|
12872
13056
|
|
12873
13057
|
|
12874
13058
|
/***/ }),
|
12875
|
-
/*
|
13059
|
+
/* 73 */
|
12876
13060
|
/***/ (function() {
|
12877
13061
|
|
12878
13062
|
/*-
|
@@ -13671,7 +13855,7 @@ up.protocol = (function () {
|
|
13671
13855
|
|
13672
13856
|
|
13673
13857
|
/***/ }),
|
13674
|
-
/*
|
13858
|
+
/* 74 */
|
13675
13859
|
/***/ (function() {
|
13676
13860
|
|
13677
13861
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
@@ -13850,37 +14034,6 @@ up.log = (function () {
|
|
13850
14034
|
setEnabled(false);
|
13851
14035
|
}
|
13852
14036
|
/*-
|
13853
|
-
Throws a [JavaScript error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)
|
13854
|
-
with the given message.
|
13855
|
-
|
13856
|
-
The message will also be printed to the error log. Also a notification will be shown at the bottom of the screen.
|
13857
|
-
|
13858
|
-
The message may contain [substitution marks](https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions).
|
13859
|
-
|
13860
|
-
### Examples
|
13861
|
-
|
13862
|
-
up.fail('Division by zero')
|
13863
|
-
up.fail('Unexpected result %o', result)
|
13864
|
-
|
13865
|
-
@function up.fail
|
13866
|
-
@param {string} message
|
13867
|
-
A message with details about the error.
|
13868
|
-
|
13869
|
-
The message can contain [substitution marks](https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions)
|
13870
|
-
like `%s` or `%o`.
|
13871
|
-
@param {Array<string>} vars...
|
13872
|
-
A list of variables to replace any substitution marks in the error message.
|
13873
|
-
@experimental
|
13874
|
-
*/
|
13875
|
-
function fail() {
|
13876
|
-
var args = [];
|
13877
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
13878
|
-
args[_i] = arguments[_i];
|
13879
|
-
}
|
13880
|
-
printToError.apply(void 0, __spreadArray(['error'], args, false));
|
13881
|
-
throw up.error.failed(args);
|
13882
|
-
}
|
13883
|
-
/*-
|
13884
14037
|
Registers an empty rejection handler in case the given promise
|
13885
14038
|
rejects with an AbortError or a failed up.Response.
|
13886
14039
|
|
@@ -13916,18 +14069,16 @@ up.log = (function () {
|
|
13916
14069
|
config: config,
|
13917
14070
|
enable: enable,
|
13918
14071
|
disable: disable,
|
13919
|
-
fail: fail,
|
13920
14072
|
muteUncriticalRejection: muteUncriticalRejection,
|
13921
14073
|
isEnabled: function () { return config.enabled; },
|
13922
14074
|
};
|
13923
14075
|
})();
|
13924
14076
|
up.puts = up.log.puts;
|
13925
14077
|
up.warn = up.log.warn;
|
13926
|
-
up.fail = up.log.fail;
|
13927
14078
|
|
13928
14079
|
|
13929
14080
|
/***/ }),
|
13930
|
-
/*
|
14081
|
+
/* 75 */
|
13931
14082
|
/***/ (function() {
|
13932
14083
|
|
13933
14084
|
/*-
|
@@ -14253,7 +14404,6 @@ up.syntax = (function () {
|
|
14253
14404
|
isDefault: up.framework.evaling,
|
14254
14405
|
priority: 0,
|
14255
14406
|
batch: false,
|
14256
|
-
keep: false,
|
14257
14407
|
jQuery: false
|
14258
14408
|
});
|
14259
14409
|
return u.assign(callback, options);
|
@@ -14449,7 +14599,7 @@ up.data = up.syntax.data;
|
|
14449
14599
|
|
14450
14600
|
|
14451
14601
|
/***/ }),
|
14452
|
-
/*
|
14602
|
+
/* 76 */
|
14453
14603
|
/***/ (function() {
|
14454
14604
|
|
14455
14605
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
@@ -14766,9 +14916,6 @@ up.history = (function () {
|
|
14766
14916
|
return historyLayer.emit.apply(historyLayer, args);
|
14767
14917
|
}
|
14768
14918
|
function register() {
|
14769
|
-
// Supported by all browser except IE:
|
14770
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/History/scrollRestoration
|
14771
|
-
window.history.scrollRestoration = 'manual';
|
14772
14919
|
window.addEventListener('popstate', onPop);
|
14773
14920
|
// Unpoly replaces the initial page state so it can later restore it when the user
|
14774
14921
|
// goes back to that initial URL. However, if the initial request was a POST,
|
@@ -14843,7 +14990,7 @@ up.history = (function () {
|
|
14843
14990
|
|
14844
14991
|
|
14845
14992
|
/***/ }),
|
14846
|
-
/*
|
14993
|
+
/* 77 */
|
14847
14994
|
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
14848
14995
|
|
14849
14996
|
var __assign = (this && this.__assign) || function () {
|
@@ -14857,7 +15004,7 @@ var __assign = (this && this.__assign) || function () {
|
|
14857
15004
|
};
|
14858
15005
|
return __assign.apply(this, arguments);
|
14859
15006
|
};
|
14860
|
-
__webpack_require__(
|
15007
|
+
__webpack_require__(78);
|
14861
15008
|
var u = up.util;
|
14862
15009
|
var e = up.element;
|
14863
15010
|
/*-
|
@@ -15715,7 +15862,7 @@ up.fragment = (function () {
|
|
15715
15862
|
var keepPlans = options.keepPlans || [];
|
15716
15863
|
var skip = keepPlans.map(function (plan) {
|
15717
15864
|
emitFragmentKept(plan);
|
15718
|
-
return plan.oldElement;
|
15865
|
+
return plan.oldElement; // the kept element
|
15719
15866
|
});
|
15720
15867
|
up.syntax.compile(element, { skip: skip, layer: options.layer });
|
15721
15868
|
emitFragmentInserted(element, options);
|
@@ -16696,13 +16843,13 @@ u.delegate(up, 'context', function () { return up.layer.current; });
|
|
16696
16843
|
|
16697
16844
|
|
16698
16845
|
/***/ }),
|
16699
|
-
/*
|
16846
|
+
/* 78 */
|
16700
16847
|
/***/ (function() {
|
16701
16848
|
|
16702
16849
|
|
16703
16850
|
|
16704
16851
|
/***/ }),
|
16705
|
-
/*
|
16852
|
+
/* 79 */
|
16706
16853
|
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
16707
16854
|
|
16708
16855
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
@@ -16714,7 +16861,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
16714
16861
|
}
|
16715
16862
|
return to.concat(ar || Array.prototype.slice.call(from));
|
16716
16863
|
};
|
16717
|
-
__webpack_require__(
|
16864
|
+
__webpack_require__(80);
|
16718
16865
|
/*-
|
16719
16866
|
Scrolling viewports
|
16720
16867
|
===================
|
@@ -16828,8 +16975,8 @@ up.viewport = (function () {
|
|
16828
16975
|
The container element to scroll.
|
16829
16976
|
@param {number} scrollPos
|
16830
16977
|
The absolute number of pixels to set the scroll position to.
|
16831
|
-
@param {string}[options.behavior='
|
16832
|
-
When set to `'
|
16978
|
+
@param {string}[options.behavior='instant']
|
16979
|
+
When set to `'instant'`, this will immediately scroll to the new position.
|
16833
16980
|
|
16834
16981
|
When set to `'smooth'`, this will scroll smoothly to the new position.
|
16835
16982
|
@param {number}[options.speed]
|
@@ -16902,8 +17049,8 @@ up.viewport = (function () {
|
|
16902
17049
|
|
16903
17050
|
Defaults to `up.viewport.config.revealTop`.
|
16904
17051
|
|
16905
|
-
@param {string}[options.behavior='
|
16906
|
-
When set to `'
|
17052
|
+
@param {string}[options.behavior='instant']
|
17053
|
+
When set to `'instant'`, this will immediately scroll to the new position.
|
16907
17054
|
|
16908
17055
|
When set to `'smooth'`, this will scroll smoothly to the new position.
|
16909
17056
|
|
@@ -17009,7 +17156,7 @@ up.viewport = (function () {
|
|
17009
17156
|
/*-
|
17010
17157
|
[Reveals](/up.reveal) an element matching the given `#hash` anchor.
|
17011
17158
|
|
17012
|
-
Other than the default behavior found in browsers, `up.revealHash` works with
|
17159
|
+
Other than the default behavior found in browsers, `up.revealHash()` works with
|
17013
17160
|
[multiple viewports](/up-viewport) and honors [fixed elements](/up-fixed-top) obstructing the user's
|
17014
17161
|
view of the viewport.
|
17015
17162
|
|
@@ -17593,13 +17740,13 @@ up.reveal = up.viewport.reveal;
|
|
17593
17740
|
|
17594
17741
|
|
17595
17742
|
/***/ }),
|
17596
|
-
/*
|
17743
|
+
/* 80 */
|
17597
17744
|
/***/ (function() {
|
17598
17745
|
|
17599
17746
|
|
17600
17747
|
|
17601
17748
|
/***/ }),
|
17602
|
-
/*
|
17749
|
+
/* 81 */
|
17603
17750
|
/***/ (function() {
|
17604
17751
|
|
17605
17752
|
var __assign = (this && this.__assign) || function () {
|
@@ -18353,10 +18500,10 @@ up.animate = up.motion.animate;
|
|
18353
18500
|
|
18354
18501
|
|
18355
18502
|
/***/ }),
|
18356
|
-
/*
|
18503
|
+
/* 82 */
|
18357
18504
|
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
18358
18505
|
|
18359
|
-
__webpack_require__(
|
18506
|
+
__webpack_require__(83);
|
18360
18507
|
var u = up.util;
|
18361
18508
|
/*-
|
18362
18509
|
Network requests
|
@@ -19249,13 +19396,13 @@ up.cache = up.network.cache;
|
|
19249
19396
|
|
19250
19397
|
|
19251
19398
|
/***/ }),
|
19252
|
-
/*
|
19399
|
+
/* 83 */
|
19253
19400
|
/***/ (function() {
|
19254
19401
|
|
19255
19402
|
|
19256
19403
|
|
19257
19404
|
/***/ }),
|
19258
|
-
/*
|
19405
|
+
/* 84 */
|
19259
19406
|
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
19260
19407
|
|
19261
19408
|
var __assign = (this && this.__assign) || function () {
|
@@ -19314,7 +19461,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
19314
19461
|
}
|
19315
19462
|
return to.concat(ar || Array.prototype.slice.call(from));
|
19316
19463
|
};
|
19317
|
-
__webpack_require__(
|
19464
|
+
__webpack_require__(85);
|
19318
19465
|
var u = up.util;
|
19319
19466
|
var e = up.element;
|
19320
19467
|
/*-
|
@@ -19456,6 +19603,11 @@ up.layer = (function () {
|
|
19456
19603
|
If set to `true`, the overlay will always render history.
|
19457
19604
|
If set to `false`, the overlay will never render history.
|
19458
19605
|
|
19606
|
+
@param {string} [config.overlay.class]
|
19607
|
+
An HTML class for the overlay's container element.
|
19608
|
+
|
19609
|
+
See [overlay classes](/customizing-overlays#overlay-classes).
|
19610
|
+
|
19459
19611
|
@param {object} config.modal
|
19460
19612
|
Defaults for [modal overlays](/layer-terminology).
|
19461
19613
|
|
@@ -20323,6 +20475,8 @@ up.layer = (function () {
|
|
20323
20475
|
@event up:layer:accept
|
20324
20476
|
@param {up.Layer} event.layer
|
20325
20477
|
The layer that is about to close.
|
20478
|
+
@param {Element} [event.value]
|
20479
|
+
The overlay's [acceptance value](/closing-overlays#overlay-result-values).
|
20326
20480
|
@param {Element} [event.origin]
|
20327
20481
|
The element that is causing the layer to close.
|
20328
20482
|
@param event.preventDefault()
|
@@ -20339,6 +20493,8 @@ up.layer = (function () {
|
|
20339
20493
|
@event up:layer:accepted
|
20340
20494
|
@param {up.Layer} event.layer
|
20341
20495
|
The layer that was closed.
|
20496
|
+
@param {Element} [event.value]
|
20497
|
+
The overlay's [acceptance value](/closing-overlays#overlay-result-values).
|
20342
20498
|
@param {Element} [event.origin]
|
20343
20499
|
The element that has caused the layer to close.
|
20344
20500
|
@stable
|
@@ -20362,6 +20518,8 @@ up.layer = (function () {
|
|
20362
20518
|
@event up:layer:dismiss
|
20363
20519
|
@param {up.Layer} event.layer
|
20364
20520
|
The layer that is about to close.
|
20521
|
+
@param {Element} [event.value]
|
20522
|
+
The overlay's [dismissal value](/closing-overlays#overlay-result-values).
|
20365
20523
|
@param {Element} [event.origin]
|
20366
20524
|
The element that is causing the layer to close.
|
20367
20525
|
@param event.preventDefault()
|
@@ -20378,6 +20536,8 @@ up.layer = (function () {
|
|
20378
20536
|
@event up:layer:dismissed
|
20379
20537
|
@param {up.Layer} event.layer
|
20380
20538
|
The layer that was closed.
|
20539
|
+
@param {Element} [event.value]
|
20540
|
+
The overlay's [dismissal value](/closing-overlays#overlay-result-values).
|
20381
20541
|
@param {Element} [event.origin]
|
20382
20542
|
The element that has caused the layer to close.
|
20383
20543
|
@stable
|
@@ -20583,13 +20743,13 @@ up.layer = (function () {
|
|
20583
20743
|
|
20584
20744
|
|
20585
20745
|
/***/ }),
|
20586
|
-
/*
|
20746
|
+
/* 85 */
|
20587
20747
|
/***/ (function() {
|
20588
20748
|
|
20589
20749
|
|
20590
20750
|
|
20591
20751
|
/***/ }),
|
20592
|
-
/*
|
20752
|
+
/* 86 */
|
20593
20753
|
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
20594
20754
|
|
20595
20755
|
var __assign = (this && this.__assign) || function () {
|
@@ -20612,7 +20772,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
20612
20772
|
}
|
20613
20773
|
return to.concat(ar || Array.prototype.slice.call(from));
|
20614
20774
|
};
|
20615
|
-
__webpack_require__(
|
20775
|
+
__webpack_require__(87);
|
20616
20776
|
/*-
|
20617
20777
|
Linking to fragments
|
20618
20778
|
====================
|
@@ -21591,12 +21751,6 @@ up.link = (function () {
|
|
21591
21751
|
A JSON object that will be merged into the [context](/context)
|
21592
21752
|
of the current layer once the fragment is rendered.
|
21593
21753
|
|
21594
|
-
@param [up-keep='true']
|
21595
|
-
Whether [`[up-keep]`](/up-keep) elements will be preserved in the updated fragment.
|
21596
|
-
|
21597
|
-
@param [up-hungry='true']
|
21598
|
-
Whether [`[up-hungry]`](/up-hungry) elements outside the updated fragment will also be updated.
|
21599
|
-
|
21600
21754
|
@param [up-scroll='auto']
|
21601
21755
|
How to scroll after the new fragment was rendered.
|
21602
21756
|
|
@@ -21771,13 +21925,13 @@ up.follow = up.link.follow;
|
|
21771
21925
|
|
21772
21926
|
|
21773
21927
|
/***/ }),
|
21774
|
-
/*
|
21928
|
+
/* 87 */
|
21775
21929
|
/***/ (function() {
|
21776
21930
|
|
21777
21931
|
|
21778
21932
|
|
21779
21933
|
/***/ }),
|
21780
|
-
/*
|
21934
|
+
/* 88 */
|
21781
21935
|
/***/ (function() {
|
21782
21936
|
|
21783
21937
|
var __assign = (this && this.__assign) || function () {
|
@@ -21827,7 +21981,7 @@ up.form = (function () {
|
|
21827
21981
|
up.form.config.submitSelectors.push('form')
|
21828
21982
|
```
|
21829
21983
|
|
21830
|
-
Individual forms may opt out with an `[up-submit=
|
21984
|
+
Individual forms may opt out with an `[up-submit=false]` attribute.
|
21831
21985
|
You may configure additional exceptions in `config.noSubmitSelectors`.
|
21832
21986
|
|
21833
21987
|
@param {Array<string>} [config.noSubmitSelectors]
|
@@ -23090,7 +23244,7 @@ up.validate = up.form.validate;
|
|
23090
23244
|
|
23091
23245
|
|
23092
23246
|
/***/ }),
|
23093
|
-
/*
|
23247
|
+
/* 89 */
|
23094
23248
|
/***/ (function() {
|
23095
23249
|
|
23096
23250
|
/*-
|
@@ -23527,7 +23681,7 @@ up.feedback = (function () {
|
|
23527
23681
|
|
23528
23682
|
|
23529
23683
|
/***/ }),
|
23530
|
-
/*
|
23684
|
+
/* 90 */
|
23531
23685
|
/***/ (function() {
|
23532
23686
|
|
23533
23687
|
/*-
|
@@ -23543,7 +23697,6 @@ This package contains functionality to passively receive updates from the server
|
|
23543
23697
|
*/
|
23544
23698
|
up.radio = (function () {
|
23545
23699
|
var u = up.util;
|
23546
|
-
var e = up.element;
|
23547
23700
|
/*-
|
23548
23701
|
Configures defaults for passive updates.
|
23549
23702
|
|
@@ -23561,7 +23714,7 @@ up.radio = (function () {
|
|
23561
23714
|
@param {boolean|string|Function(Element)} [config.pollEnabled=true]
|
23562
23715
|
Whether Unpoly will follow instructions to poll fragments, like the `[up-poll]` attribute.
|
23563
23716
|
|
23564
|
-
When set to `'auto'` Unpoly will
|
23717
|
+
When set to `'auto'` Unpoly will skip polling updates while one of the following applies:
|
23565
23718
|
|
23566
23719
|
- The browser tab is in the foreground
|
23567
23720
|
- The fragment's layer is the [frontmost layer](/up.layer.front).
|
@@ -23573,6 +23726,9 @@ up.radio = (function () {
|
|
23573
23726
|
|
23574
23727
|
You may also pass a function that accepts the polling fragment and returns `true`, `false` or `'auto'`.
|
23575
23728
|
|
23729
|
+
When an update is skipped due to polling being disabled,
|
23730
|
+
Unpoly will try to poll again after the configured interval.
|
23731
|
+
|
23576
23732
|
@stable
|
23577
23733
|
*/
|
23578
23734
|
var config = new up.Config(function () { return ({
|
@@ -23606,65 +23762,33 @@ up.radio = (function () {
|
|
23606
23762
|
/*-
|
23607
23763
|
Starts [polling](/up-poll) the given element.
|
23608
23764
|
|
23765
|
+
The given element does not need an `[up-poll]` attribute.
|
23766
|
+
|
23609
23767
|
@function up.radio.startPolling
|
23610
|
-
@param {Element
|
23768
|
+
@param {Element} fragment
|
23611
23769
|
The fragment to reload periodically.
|
23612
23770
|
@param {number} options.interval
|
23613
23771
|
The reload interval in milliseconds.
|
23614
23772
|
|
23615
23773
|
Defaults to `up.radio.config.pollInterval`.
|
23774
|
+
@param {string} options.url
|
23775
|
+
Defaults to the element's closest `[up-source]` attribute.
|
23616
23776
|
@stable
|
23617
23777
|
*/
|
23618
23778
|
function startPolling(fragment, options) {
|
23619
|
-
var _a, _b;
|
23620
23779
|
if (options === void 0) { options = {}; }
|
23621
|
-
|
23622
|
-
var stopped = false;
|
23623
|
-
var lastRequest = null;
|
23624
|
-
options.onQueued = function (request) { return lastRequest = request; };
|
23625
|
-
function doReload() {
|
23626
|
-
// The setTimeout(doReload) callback might already be scheduled
|
23627
|
-
// before the polling stopped.
|
23628
|
-
if (stopped) {
|
23629
|
-
return;
|
23630
|
-
}
|
23631
|
-
if (shouldPoll(fragment)) {
|
23632
|
-
u.always(up.reload(fragment, options), doSchedule);
|
23633
|
-
}
|
23634
|
-
else {
|
23635
|
-
up.puts('[up-poll]', 'Polling is disabled');
|
23636
|
-
// Reconsider after 10 seconds at most
|
23637
|
-
doSchedule(Math.min(10 * 1000, interval));
|
23638
|
-
}
|
23639
|
-
}
|
23640
|
-
function doSchedule(delay) {
|
23641
|
-
if (delay === void 0) { delay = interval; }
|
23642
|
-
// The up.reload().then(doSchedule) callback might already be
|
23643
|
-
// registered before the polling stopped.
|
23644
|
-
if (stopped) {
|
23645
|
-
return;
|
23646
|
-
}
|
23647
|
-
setTimeout(doReload, delay);
|
23648
|
-
}
|
23649
|
-
function destructor() {
|
23650
|
-
stopped = true; // Don't execute already-scheduled callbacks
|
23651
|
-
lastRequest === null || lastRequest === void 0 ? void 0 : lastRequest.abort(); // Abort any pending request
|
23652
|
-
}
|
23653
|
-
// up.radio.stopPolling() will emit up:poll:stop to signal cancelation.
|
23654
|
-
up.on(fragment, 'up:poll:stop', destructor);
|
23655
|
-
doSchedule();
|
23656
|
-
return destructor;
|
23780
|
+
up.FragmentPolling.forFragment(fragment).forceStart(options);
|
23657
23781
|
}
|
23658
23782
|
/*-
|
23659
23783
|
Stops [polling](/up-poll) the given element.
|
23660
23784
|
|
23661
23785
|
@function up.radio.stopPolling
|
23662
|
-
@param {Element
|
23786
|
+
@param {Element} fragment
|
23663
23787
|
The fragment to stop reloading.
|
23664
23788
|
@stable
|
23665
23789
|
*/
|
23666
23790
|
function stopPolling(element) {
|
23667
|
-
up.
|
23791
|
+
up.FragmentPolling.forFragment(element).forceStop();
|
23668
23792
|
}
|
23669
23793
|
function shouldPoll(fragment) {
|
23670
23794
|
var _a, _b;
|
@@ -23716,7 +23840,17 @@ up.radio = (function () {
|
|
23716
23840
|
</div>
|
23717
23841
|
```
|
23718
23842
|
|
23719
|
-
### Skipping updates
|
23843
|
+
### Skipping updates on the client
|
23844
|
+
|
23845
|
+
Client-side code may skip an update by preventing an `up:fragment:poll` event
|
23846
|
+
on the polling fragment.
|
23847
|
+
|
23848
|
+
Unpoly will also choose to skip updates under certain conditions,
|
23849
|
+
e.g. when the browser tab is in the background. See `up.radio.config.pollEnabled` for details.
|
23850
|
+
|
23851
|
+
When an update is skipped, Unpoly will try to poll again after the configured interval.
|
23852
|
+
|
23853
|
+
### Skipping updates on the server
|
23720
23854
|
|
23721
23855
|
When polling a fragment periodically we want to avoid rendering unchanged content.
|
23722
23856
|
This saves <b>CPU time</b> and reduces the <b>bandwidth cost</b> for a
|
@@ -23725,26 +23859,57 @@ up.radio = (function () {
|
|
23725
23859
|
To achieve this we timestamp your fragments with an `[up-time]` attribute to indicate
|
23726
23860
|
when the underlying data was last changed. See `[up-time]` for a detailed example.
|
23727
23861
|
|
23862
|
+
If the server has no more recent changes, it may skip the update by responding
|
23863
|
+
with an HTTP status `304 Not Modified`.
|
23864
|
+
|
23865
|
+
When an update is skipped, Unpoly will try to poll again after the configured interval.
|
23866
|
+
|
23867
|
+
### Stopping polling
|
23868
|
+
|
23869
|
+
- The fragment from the server response no longer has an `[up-poll]` attribute.
|
23870
|
+
- Client-side code has called `up.radio.stopPolling()` with the polling element.
|
23871
|
+
- Polling was [disabled globally](/up.radio.config#config.pollEnabled).
|
23872
|
+
|
23728
23873
|
@selector [up-poll]
|
23729
23874
|
@param [up-interval]
|
23730
23875
|
The reload interval in milliseconds.
|
23731
23876
|
|
23732
23877
|
Defaults to `up.radio.config.pollInterval`.
|
23878
|
+
@param [up-source]
|
23879
|
+
The URL from which to reload the fragment.
|
23880
|
+
|
23881
|
+
Defaults to the closest `[up-source]` attribute of an ancestor element.
|
23733
23882
|
@stable
|
23734
23883
|
*/
|
23735
|
-
up.compiler('[up-poll]',
|
23884
|
+
up.compiler('[up-poll]', function (fragment) {
|
23885
|
+
up.FragmentPolling.forFragment(fragment).onPollAttributeObserved();
|
23886
|
+
});
|
23887
|
+
/*-
|
23888
|
+
This event is emitted before a [polling](/up-poll) fragment is reloaded from the server.
|
23889
|
+
|
23890
|
+
Listener may prevent the `up:fragment:poll` event to prevent the fragment from being reloaded.
|
23891
|
+
Preventing the event will only skip a single update. It will *not* stop future polling.
|
23892
|
+
|
23893
|
+
@event up:fragment:poll
|
23894
|
+
@param {Element} event.target
|
23895
|
+
The polling fragment.
|
23896
|
+
@param event.preventDefault()
|
23897
|
+
Event listeners may call this method to prevent the fragment from being reloaded.
|
23898
|
+
@experimental
|
23899
|
+
*/
|
23736
23900
|
up.on('up:framework:reset', reset);
|
23737
23901
|
return {
|
23738
23902
|
config: config,
|
23739
23903
|
hungrySelector: hungrySelector,
|
23740
23904
|
startPolling: startPolling,
|
23741
|
-
stopPolling: stopPolling
|
23905
|
+
stopPolling: stopPolling,
|
23906
|
+
shouldPoll: shouldPoll,
|
23742
23907
|
};
|
23743
23908
|
})();
|
23744
23909
|
|
23745
23910
|
|
23746
23911
|
/***/ }),
|
23747
|
-
/*
|
23912
|
+
/* 91 */
|
23748
23913
|
/***/ (function() {
|
23749
23914
|
|
23750
23915
|
/*
|
@@ -23884,15 +24049,16 @@ __webpack_require__(73);
|
|
23884
24049
|
__webpack_require__(74);
|
23885
24050
|
__webpack_require__(75);
|
23886
24051
|
__webpack_require__(76);
|
23887
|
-
__webpack_require__(
|
23888
|
-
__webpack_require__(
|
24052
|
+
__webpack_require__(77);
|
24053
|
+
__webpack_require__(79);
|
23889
24054
|
__webpack_require__(81);
|
23890
|
-
__webpack_require__(
|
23891
|
-
__webpack_require__(
|
23892
|
-
__webpack_require__(
|
24055
|
+
__webpack_require__(82);
|
24056
|
+
__webpack_require__(84);
|
24057
|
+
__webpack_require__(86);
|
23893
24058
|
__webpack_require__(88);
|
23894
24059
|
__webpack_require__(89);
|
23895
24060
|
__webpack_require__(90);
|
24061
|
+
__webpack_require__(91);
|
23896
24062
|
up.framework.onEvaled();
|
23897
24063
|
|
23898
24064
|
}();
|