unpoly-rails 2.6.1 → 2.7.1.1
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-migrate.min.js +1 -1
- data/assets/unpoly/unpoly.css +2 -1
- data/assets/unpoly/unpoly.es5.js +55 -63
- data/assets/unpoly/unpoly.es5.min.js +1 -1
- data/assets/unpoly/unpoly.es6.js +24688 -0
- data/assets/unpoly/unpoly.js +50 -49
- data/assets/unpoly/unpoly.min.css +1 -1
- data/assets/unpoly/unpoly.min.js +1 -1
- data/lib/unpoly/rails/change.rb +8 -4
- data/lib/unpoly/rails/version.rb +1 -1
- metadata +3 -2
data/assets/unpoly/unpoly.js
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
@module up
|
9
9
|
*/
|
10
10
|
window.up = {
|
11
|
-
version: '2.
|
11
|
+
version: '2.7.1'
|
12
12
|
};
|
13
13
|
|
14
14
|
|
@@ -3641,8 +3641,6 @@ up.Cache = class Cache {
|
|
3641
3641
|
@param {number|Function(): number} [config.expiry]
|
3642
3642
|
The number of milliseconds after which a cache entry
|
3643
3643
|
will be discarded.
|
3644
|
-
@param {string} [config.logPrefix]
|
3645
|
-
A prefix for log entries printed by this cache object.
|
3646
3644
|
@param {Function(entry): string} [config.key]
|
3647
3645
|
A function that takes an argument and returns a string key
|
3648
3646
|
for storage. If omitted, `toString()` is called on the argument.
|
@@ -3679,12 +3677,6 @@ up.Cache = class Cache {
|
|
3679
3677
|
clear() {
|
3680
3678
|
this.store.clear();
|
3681
3679
|
}
|
3682
|
-
log(...args) {
|
3683
|
-
if (this.config.logPrefix) {
|
3684
|
-
args[0] = `[${this.config.logPrefix}] ${args[0]}`;
|
3685
|
-
up.puts('up.Cache', ...args);
|
3686
|
-
}
|
3687
|
-
}
|
3688
3680
|
keys() {
|
3689
3681
|
return this.store.keys();
|
3690
3682
|
}
|
@@ -3748,28 +3740,17 @@ up.Cache = class Cache {
|
|
3748
3740
|
return true;
|
3749
3741
|
}
|
3750
3742
|
}
|
3751
|
-
get(key
|
3743
|
+
get(key) {
|
3752
3744
|
const storeKey = this.normalizeStoreKey(key);
|
3753
3745
|
let entry = this.store.get(storeKey);
|
3754
3746
|
if (entry) {
|
3755
3747
|
if (this.isFresh(entry)) {
|
3756
|
-
if (!options.silent) {
|
3757
|
-
this.log("Cache hit for '%s'", key);
|
3758
|
-
}
|
3759
3748
|
return entry.value;
|
3760
3749
|
}
|
3761
3750
|
else {
|
3762
|
-
if (!options.silent) {
|
3763
|
-
this.log("Discarding stale cache entry for '%s'", key);
|
3764
|
-
}
|
3765
3751
|
this.remove(key);
|
3766
3752
|
}
|
3767
3753
|
}
|
3768
|
-
else {
|
3769
|
-
if (!options.silent) {
|
3770
|
-
this.log("Cache miss for '%s'", key);
|
3771
|
-
}
|
3772
|
-
}
|
3773
3754
|
}
|
3774
3755
|
};
|
3775
3756
|
|
@@ -4668,10 +4649,13 @@ up.Change.CloseLayer = class CloseLayer extends up.Change.Removal {
|
|
4668
4649
|
}
|
4669
4650
|
emitCloseEvent() {
|
4670
4651
|
// The close event is emitted on the layer that is about to close.
|
4671
|
-
|
4652
|
+
let event = this.layer.emit(this.buildEvent(`up:layer:${this.verb}`), {
|
4672
4653
|
callback: this.layer.callback(`on${u.upperCaseFirst(this.verb)}`),
|
4673
4654
|
log: [`Will ${this.verb} ${this.layer} with value %o`, this.value]
|
4674
4655
|
});
|
4656
|
+
// Allow an event listener to replace event.value with a new value.
|
4657
|
+
this.value = event.value;
|
4658
|
+
return event;
|
4675
4659
|
}
|
4676
4660
|
emitClosedEvent(formerParent) {
|
4677
4661
|
const verbPast = `${this.verb}ed`;
|
@@ -6839,7 +6823,7 @@ up.Layer = class Layer extends up.Record {
|
|
6839
6823
|
}
|
6840
6824
|
}
|
6841
6825
|
set location(location) {
|
6842
|
-
const previousLocation = this.
|
6826
|
+
const previousLocation = this.location;
|
6843
6827
|
location = up.history.normalizeURL(location);
|
6844
6828
|
if (previousLocation !== location) {
|
6845
6829
|
this.savedLocation = location;
|
@@ -9356,6 +9340,18 @@ up.Request = class Request extends up.Record {
|
|
9356
9340
|
this.state = 'new';
|
9357
9341
|
}
|
9358
9342
|
}
|
9343
|
+
/*-
|
9344
|
+
Returns the underlying `XMLHttpRequest` instance.
|
9345
|
+
|
9346
|
+
@property up.Request#xhr
|
9347
|
+
@param {XMLHttpRequest} xhr
|
9348
|
+
@stable
|
9349
|
+
*/
|
9350
|
+
get xhr() {
|
9351
|
+
// Initialize the xhr request on first access,
|
9352
|
+
// so listeners on up:request:send events have a chance to access the xhr.
|
9353
|
+
return this._xhr ?? (this._xhr = new XMLHttpRequest());
|
9354
|
+
}
|
9359
9355
|
followState(sourceRequest) {
|
9360
9356
|
u.delegate(this, ['deferred', 'state', 'preload'], () => sourceRequest);
|
9361
9357
|
}
|
@@ -9432,7 +9428,7 @@ up.Request = class Request extends up.Record {
|
|
9432
9428
|
}
|
9433
9429
|
this.state = 'loading';
|
9434
9430
|
// Convert from XHR's callback-based API to up.Request's promise-based API
|
9435
|
-
|
9431
|
+
new up.Request.XHRRenderer(this).buildAndSend({
|
9436
9432
|
onload: () => this.onXHRLoad(),
|
9437
9433
|
onerror: () => this.onXHRError(),
|
9438
9434
|
ontimeout: () => this.onXHRTimeout(),
|
@@ -9525,8 +9521,8 @@ up.Request = class Request extends up.Record {
|
|
9525
9521
|
abort() {
|
9526
9522
|
// setAbortedState() must be called before xhr.abort(), since xhr's event handlers
|
9527
9523
|
// will call setAbortedState() a second time, without a message.
|
9528
|
-
if (this.setAbortedState() && this.
|
9529
|
-
this.
|
9524
|
+
if (this.setAbortedState() && this._xhr) {
|
9525
|
+
this._xhr.abort();
|
9530
9526
|
}
|
9531
9527
|
}
|
9532
9528
|
setAbortedState(reason = ["Request to %s %s was aborted", this.method, this.url]) {
|
@@ -9912,40 +9908,39 @@ up.Request.XHRRenderer = class XHRRenderer {
|
|
9912
9908
|
this.request = request;
|
9913
9909
|
}
|
9914
9910
|
buildAndSend(handlers) {
|
9915
|
-
|
9911
|
+
const xhr = this.request.xhr;
|
9916
9912
|
// We copy params since we will modify them below.
|
9917
9913
|
// This would confuse API clients and cache key logic in up.network.
|
9918
9914
|
this.params = u.copy(this.request.params);
|
9919
9915
|
// IE11 explodes it we're setting an undefined timeout property
|
9920
9916
|
if (this.request.timeout) {
|
9921
|
-
|
9917
|
+
xhr.timeout = this.request.timeout;
|
9922
9918
|
}
|
9923
9919
|
// The XMLHttpRequest method must be opened before we can add headers to it.
|
9924
|
-
|
9925
|
-
// Add information about the response's intended use so the server may
|
9920
|
+
xhr.open(this.getMethod(), this.request.url);
|
9921
|
+
// Add information about the response's intended use, so the server may
|
9926
9922
|
// customize or shorten its response.
|
9927
9923
|
const metaProps = this.request.metaProps();
|
9928
9924
|
for (let key in metaProps) {
|
9929
|
-
this.addHeader(up.protocol.headerize(key), metaProps[key]);
|
9925
|
+
this.addHeader(xhr, up.protocol.headerize(key), metaProps[key]);
|
9930
9926
|
}
|
9931
9927
|
for (let header in this.request.headers) {
|
9932
|
-
this.addHeader(header, this.request.headers[header]);
|
9928
|
+
this.addHeader(xhr, header, this.request.headers[header]);
|
9933
9929
|
}
|
9934
9930
|
let csrfHeader, csrfToken;
|
9935
9931
|
if ((csrfHeader = this.request.csrfHeader()) && (csrfToken = this.request.csrfToken())) {
|
9936
|
-
this.addHeader(csrfHeader, csrfToken);
|
9932
|
+
this.addHeader(xhr, csrfHeader, csrfToken);
|
9937
9933
|
}
|
9938
|
-
this.addHeader(up.protocol.headerize('version'), up.version);
|
9934
|
+
this.addHeader(xhr, up.protocol.headerize('version'), up.version);
|
9939
9935
|
// The { contentType } will be missing in case of a FormData payload.
|
9940
9936
|
// In this case the browser will choose a content-type with MIME boundary,
|
9941
9937
|
// like: multipart/form-data; boundary=----WebKitFormBoundaryHkiKAbOweEFUtny8
|
9942
9938
|
let contentType = this.getContentType();
|
9943
9939
|
if (contentType) {
|
9944
|
-
this.addHeader('Content-Type', contentType);
|
9940
|
+
this.addHeader(xhr, 'Content-Type', contentType);
|
9945
9941
|
}
|
9946
|
-
u.assign(
|
9947
|
-
|
9948
|
-
return this.xhr;
|
9942
|
+
u.assign(xhr, handlers);
|
9943
|
+
xhr.send(this.getPayload());
|
9949
9944
|
}
|
9950
9945
|
getMethod() {
|
9951
9946
|
// By default HTTP methods other than `GET` or `POST` will be converted into a `POST`
|
@@ -9968,11 +9963,11 @@ up.Request.XHRRenderer = class XHRRenderer {
|
|
9968
9963
|
this.finalizePayload();
|
9969
9964
|
return this.payload;
|
9970
9965
|
}
|
9971
|
-
addHeader(header, value) {
|
9966
|
+
addHeader(xhr, header, value) {
|
9972
9967
|
if (u.isOptions(value) || u.isArray(value)) {
|
9973
9968
|
value = JSON.stringify(value);
|
9974
9969
|
}
|
9975
|
-
|
9970
|
+
xhr.setRequestHeader(header, value);
|
9976
9971
|
}
|
9977
9972
|
finalizePayload() {
|
9978
9973
|
if (this.payloadFinalized) {
|
@@ -10386,7 +10381,8 @@ up.RevealMotion = class RevealMotion {
|
|
10386
10381
|
elementRect.height += 2 * this.padding;
|
10387
10382
|
}
|
10388
10383
|
selectObstructions(selectors) {
|
10389
|
-
|
10384
|
+
let elements = up.fragment.all(selectors.join(','), { layer: this.obstructionsLayer });
|
10385
|
+
return u.filter(elements, e.isVisible);
|
10390
10386
|
}
|
10391
10387
|
substractObstructions(viewportRect) {
|
10392
10388
|
for (let obstruction of this.selectObstructions(this.topObstructions)) {
|
@@ -16464,8 +16460,9 @@ up.motion = (function () {
|
|
16464
16460
|
This event is emitted on an animating element by `up.motion.finish()` to
|
16465
16461
|
request the animation to instantly finish and skip to the last frame.
|
16466
16462
|
|
16467
|
-
|
16468
|
-
to settle
|
16463
|
+
Custom [animation](/up.animation) and [transition](/up.transition) functions are expected
|
16464
|
+
to instantly settle their promises when this event is observed on the
|
16465
|
+
animating element.
|
16469
16466
|
|
16470
16467
|
Animations started by `up.animate()` already handle this event.
|
16471
16468
|
|
@@ -18789,7 +18786,7 @@ up.layer = (function () {
|
|
18789
18786
|
@stable
|
18790
18787
|
*/
|
18791
18788
|
/*-
|
18792
|
-
This event is emitted before a layer is [accepted](/closing-overlays).
|
18789
|
+
This event is emitted *before* a layer is [accepted](/closing-overlays).
|
18793
18790
|
|
18794
18791
|
The event is emitted on the [element of the layer](/up.layer.element) that is about to close.
|
18795
18792
|
|
@@ -18798,6 +18795,8 @@ up.layer = (function () {
|
|
18798
18795
|
The layer that is about to close.
|
18799
18796
|
@param {Element} [event.value]
|
18800
18797
|
The overlay's [acceptance value](/closing-overlays#overlay-result-values).
|
18798
|
+
|
18799
|
+
Listeners may replace or mutate this value.
|
18801
18800
|
@param {Element} [event.origin]
|
18802
18801
|
The element that is causing the layer to close.
|
18803
18802
|
@param event.preventDefault()
|
@@ -18805,7 +18804,7 @@ up.layer = (function () {
|
|
18805
18804
|
@stable
|
18806
18805
|
*/
|
18807
18806
|
/*-
|
18808
|
-
This event is emitted after a layer was [accepted](/closing-overlays).
|
18807
|
+
This event is emitted *after* a layer was [accepted](/closing-overlays).
|
18809
18808
|
|
18810
18809
|
The event is emitted on the [layer's](/up.layer.element) when the close animation
|
18811
18810
|
is starting. If the layer has no close animaton and was already removed from the DOM,
|
@@ -18815,7 +18814,7 @@ up.layer = (function () {
|
|
18815
18814
|
@param {up.Layer} event.layer
|
18816
18815
|
The layer that was closed.
|
18817
18816
|
@param {Element} [event.value]
|
18818
|
-
The overlay's [acceptance value](/closing-overlays#overlay-result-values).
|
18817
|
+
The overlay's final [acceptance value](/closing-overlays#overlay-result-values).
|
18819
18818
|
@param {Element} [event.origin]
|
18820
18819
|
The element that has caused the layer to close.
|
18821
18820
|
@stable
|
@@ -18832,7 +18831,7 @@ up.layer = (function () {
|
|
18832
18831
|
@stable
|
18833
18832
|
*/
|
18834
18833
|
/*-
|
18835
|
-
This event is emitted before a layer is [dismissed](/closing-overlays).
|
18834
|
+
This event is emitted *before* a layer is [dismissed](/closing-overlays).
|
18836
18835
|
|
18837
18836
|
The event is emitted on the [element of the layer](/up.layer.element) that is about to close.
|
18838
18837
|
|
@@ -18841,6 +18840,8 @@ up.layer = (function () {
|
|
18841
18840
|
The layer that is about to close.
|
18842
18841
|
@param {Element} [event.value]
|
18843
18842
|
The overlay's [dismissal value](/closing-overlays#overlay-result-values).
|
18843
|
+
|
18844
|
+
Listeners may replace or mutate this value.
|
18844
18845
|
@param {Element} [event.origin]
|
18845
18846
|
The element that is causing the layer to close.
|
18846
18847
|
@param event.preventDefault()
|
@@ -18848,7 +18849,7 @@ up.layer = (function () {
|
|
18848
18849
|
@stable
|
18849
18850
|
*/
|
18850
18851
|
/*-
|
18851
|
-
This event is emitted after a layer was [dismissed](/closing-overlays).
|
18852
|
+
This event is emitted *after* a layer was [dismissed](/closing-overlays).
|
18852
18853
|
|
18853
18854
|
The event is emitted on the [layer's](/up.layer.element) when the close animation
|
18854
18855
|
is starting. If the layer has no close animaton and was already removed from the DOM,
|
@@ -18858,7 +18859,7 @@ up.layer = (function () {
|
|
18858
18859
|
@param {up.Layer} event.layer
|
18859
18860
|
The layer that was closed.
|
18860
18861
|
@param {Element} [event.value]
|
18861
|
-
The overlay's [dismissal value](/closing-overlays#overlay-result-values).
|
18862
|
+
The overlay's final [dismissal value](/closing-overlays#overlay-result-values).
|
18862
18863
|
@param {Element} [event.origin]
|
18863
18864
|
The element that has caused the layer to close.
|
18864
18865
|
@stable
|
@@ -6,7 +6,7 @@ up-bounds{position:absolute}.up-focusable-content:focus,.up-focusable-content:fo
|
|
6
6
|
|
7
7
|
.up-request-loader{display:none}up-progress-bar{position:fixed;top:0;left:0;z-index:999999999;height:3px;background-color:#007bff}
|
8
8
|
|
9
|
-
up-focus-trap{position:fixed;top:0;left:0;width:0;height:0}up-modal,up-drawer,up-cover,up-modal-backdrop,up-drawer-backdrop,up-modal-viewport,up-drawer-viewport,up-cover-viewport{top:0;left:0;bottom:0;right:0}up-modal-box,up-drawer-box{box-shadow:0 0 10px 1px rgba(0,0,0,0.3)}up-popup{box-shadow:0 0 4px rgba(0,0,0,0.3)}up-modal:focus,up-drawer:focus,up-cover:focus,up-modal-box:focus,up-drawer-box:focus,up-cover-box:focus,up-popup:focus,up-modal:focus-visible,up-drawer:focus-visible,up-cover:focus-visible,up-modal-box:focus-visible,up-drawer-box:focus-visible,up-cover-box:focus-visible,up-popup:focus-visible{outline:none}up-modal,up-drawer,up-cover{z-index:2000;position:fixed}up-modal-backdrop,up-drawer-backdrop{position:absolute;background:rgba(0,0,0,0.4)}up-modal-viewport,up-drawer-viewport,up-cover-viewport{position:absolute;overflow-y:scroll;overflow-x:hidden;overscroll-behavior:contain;display:flex;align-items:flex-start;justify-content:center}up-modal-box,up-drawer-box,up-cover-box,up-popup{position:relative;box-sizing:border-box;max-width:100%;background-color:#fff;padding:20px;overflow-x:hidden}up-modal-content,up-drawer-content,up-cover-content,up-popup-content{display:block}up-popup{z-index:1000}up-modal-dismiss,up-drawer-dismiss,up-cover-dismiss,up-popup-dismiss{color:#888;position:absolute;top:10px;right:10px;font-size:1.7rem;line-height:0.5}up-modal[nesting="0"] up-modal-viewport{padding:25px 15px}up-modal[nesting="1"] up-modal-viewport{padding:50px 30px}up-modal[nesting="2"] up-modal-viewport{padding:75px 45px}up-modal[nesting="3"] up-modal-viewport{padding:100px 60px}up-modal[nesting="4"] up-modal-viewport{padding:125px 75px}up-modal[size=small] up-modal-box{width:350px}up-modal[size=medium] up-modal-box{width:650px}up-modal[size=large] up-modal-box{width:1000px}up-modal[size=grow] up-modal-box{width:auto}up-modal[size=full] up-modal-box{width:100%}up-drawer-viewport{justify-content:flex-start}up-drawer[position=right] up-drawer-viewport{justify-content:flex-end}up-drawer-box{min-height:100vh}up-drawer[size=small] up-drawer-box{width:150px}up-drawer[size=medium] up-drawer-box{width:340px}up-drawer[size=large] up-drawer-box{width:600px}up-drawer[size=grow] up-drawer-box{width:auto}up-drawer[size=full] up-drawer-box{width:100%}up-cover-box{width:100%;min-height:100vh;padding:0}up-popup{padding:15px}up-popup[size=small]{width:180px}up-popup[size=medium]{width:300px}up-popup[size=large]{width:550px}up-popup[size=grow] up-popup{width:auto}up-popup[size=full] up-popup{width:100%}
|
9
|
+
up-focus-trap{position:fixed;top:0;left:0;width:0;height:0}up-modal,up-drawer,up-cover,up-modal-backdrop,up-drawer-backdrop,up-modal-viewport,up-drawer-viewport,up-cover-viewport{top:0;left:0;bottom:0;right:0}up-modal-box,up-drawer-box{box-shadow:0 0 10px 1px rgba(0,0,0,0.3)}up-popup{box-shadow:0 0 4px rgba(0,0,0,0.3)}up-modal:focus,up-drawer:focus,up-cover:focus,up-modal-box:focus,up-drawer-box:focus,up-cover-box:focus,up-popup:focus,up-modal:focus-visible,up-drawer:focus-visible,up-cover:focus-visible,up-modal-box:focus-visible,up-drawer-box:focus-visible,up-cover-box:focus-visible,up-popup:focus-visible{outline:none}up-modal,up-drawer,up-cover{z-index:2000;position:fixed}up-modal-backdrop,up-drawer-backdrop{position:absolute;background:rgba(0,0,0,0.4)}up-modal-viewport,up-drawer-viewport,up-cover-viewport{position:absolute;overflow-y:scroll;overflow-x:hidden;overscroll-behavior:contain;display:flex;align-items:flex-start;justify-content:center}up-modal-box,up-drawer-box,up-cover-box,up-popup{position:relative;box-sizing:border-box;max-width:100%;background-color:#fff;padding:20px;overflow-x:hidden}up-modal-content,up-drawer-content,up-cover-content,up-popup-content{display:block}up-popup{z-index:1000}up-modal-dismiss,up-drawer-dismiss,up-cover-dismiss,up-popup-dismiss{color:#888;position:absolute;top:10px;right:10px;font-size:1.7rem;line-height:0.5}up-modal[nesting="0"] up-modal-viewport{padding:25px 15px}up-modal[nesting="1"] up-modal-viewport{padding:50px 30px}up-modal[nesting="2"] up-modal-viewport{padding:75px 45px}up-modal[nesting="3"] up-modal-viewport{padding:100px 60px}up-modal[nesting="4"] up-modal-viewport{padding:125px 75px}up-modal[size=small] up-modal-box{width:350px}up-modal[size=medium] up-modal-box{width:650px}up-modal[size=large] up-modal-box{width:1000px}up-modal[size=grow] up-modal-box{width:auto}up-modal[size=full] up-modal-box{width:100%}up-drawer-viewport{justify-content:flex-start}up-drawer[position=right] up-drawer-viewport{justify-content:flex-end}up-drawer-box{min-height:100vh}up-drawer[size=small] up-drawer-box{width:150px}up-drawer[size=medium] up-drawer-box{width:340px}up-drawer[size=large] up-drawer-box{width:600px}up-drawer[size=grow] up-drawer-box{width:auto}up-drawer[size=full] up-drawer-box{width:100%}up-cover-box{width:100%;min-height:100vh;padding:0}up-popup{padding:15px;text-align:left}up-popup[size=small]{width:180px}up-popup[size=medium]{width:300px}up-popup[size=large]{width:550px}up-popup[size=grow] up-popup{width:auto}up-popup[size=full] up-popup{width:100%}
|
10
10
|
|
11
11
|
[up-href],[up-clickable]{cursor:pointer}
|
12
12
|
|