unpoly-rails 3.2.0 → 3.2.2
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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/assets/unpoly/unpoly-bootstrap3.css +2 -2
- data/assets/unpoly/unpoly-bootstrap3.min.css +0 -1
- data/assets/unpoly/unpoly-bootstrap4.css +2 -2
- data/assets/unpoly/unpoly-bootstrap4.min.css +0 -1
- data/assets/unpoly/unpoly-bootstrap5.css +2 -2
- data/assets/unpoly/unpoly-bootstrap5.min.css +0 -1
- data/assets/unpoly/unpoly.css +108 -78
- data/assets/unpoly/unpoly.es6.js +78 -61
- data/assets/unpoly/unpoly.es6.min.js +1 -1
- data/assets/unpoly/unpoly.js +76 -59
- data/assets/unpoly/unpoly.min.css +1 -7
- data/assets/unpoly/unpoly.min.js +1 -1
- data/lib/unpoly/rails/version.rb +1 -1
- metadata +2 -2
data/assets/unpoly/unpoly.js
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
/***/ (() => {
|
6
6
|
|
7
7
|
window.up = {
|
8
|
-
version: '3.2.
|
8
|
+
version: '3.2.2'
|
9
9
|
};
|
10
10
|
|
11
11
|
|
@@ -833,10 +833,6 @@ up.util = (function () {
|
|
833
833
|
/***/ (() => {
|
834
834
|
|
835
835
|
up.error = (function () {
|
836
|
-
function emitGlobal(error) {
|
837
|
-
const { message } = error;
|
838
|
-
up.emit(window, 'error', { message, error, log: false });
|
839
|
-
}
|
840
836
|
function fail(...args) {
|
841
837
|
throw new up.Error(args);
|
842
838
|
}
|
@@ -844,17 +840,27 @@ up.error = (function () {
|
|
844
840
|
return (typeof error !== 'object') || ((error.name !== 'AbortError') && !(error instanceof up.RenderResult) && !(error instanceof up.Response));
|
845
841
|
}
|
846
842
|
function muteUncriticalRejection(promise) {
|
847
|
-
return promise.catch(
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
843
|
+
return promise.catch(rethrowCritical);
|
844
|
+
}
|
845
|
+
function muteUncriticalSync(block) {
|
846
|
+
try {
|
847
|
+
return block();
|
848
|
+
}
|
849
|
+
catch (e) {
|
850
|
+
rethrowCritical(e);
|
851
|
+
}
|
852
|
+
}
|
853
|
+
function rethrowCritical(value) {
|
854
|
+
if (isCritical(value)) {
|
855
|
+
throw value;
|
856
|
+
}
|
852
857
|
}
|
853
858
|
return {
|
854
859
|
fail,
|
855
|
-
|
860
|
+
rethrowCritical,
|
856
861
|
isCritical,
|
857
862
|
muteUncriticalRejection,
|
863
|
+
muteUncriticalSync,
|
858
864
|
};
|
859
865
|
})();
|
860
866
|
up.fail = up.error.fail;
|
@@ -935,9 +941,9 @@ up.element = (function () {
|
|
935
941
|
results.push(...root.querySelectorAll(selector));
|
936
942
|
return results;
|
937
943
|
}
|
938
|
-
function
|
944
|
+
function contains(root, selectorOrElement) {
|
939
945
|
const element = getOne(selectorOrElement);
|
940
|
-
return
|
946
|
+
return Node.prototype.contains.call(root, element);
|
941
947
|
}
|
942
948
|
function ancestor(element, selector) {
|
943
949
|
let parentElement = element.parentElement;
|
@@ -1179,7 +1185,7 @@ up.element = (function () {
|
|
1179
1185
|
}
|
1180
1186
|
}
|
1181
1187
|
function classSelector(klass) {
|
1182
|
-
klass = klass.replace(
|
1188
|
+
klass = klass.replace(/[^\w-]/g, '\\$&');
|
1183
1189
|
return `.${klass}`;
|
1184
1190
|
}
|
1185
1191
|
function createBrokenDocumentFromHTML(html) {
|
@@ -1434,7 +1440,7 @@ up.element = (function () {
|
|
1434
1440
|
}
|
1435
1441
|
return {
|
1436
1442
|
subtree,
|
1437
|
-
|
1443
|
+
contains,
|
1438
1444
|
closestAttr,
|
1439
1445
|
ancestor,
|
1440
1446
|
around,
|
@@ -1883,7 +1889,7 @@ up.RenderJob = (_a = class RenderJob {
|
|
1883
1889
|
if (result instanceof up.RenderResult) {
|
1884
1890
|
if (!result.none)
|
1885
1891
|
result.options.onRendered?.(result);
|
1886
|
-
result.finished.then(result.options.onFinished);
|
1892
|
+
result.finished.then(result.options.onFinished, u.noop);
|
1887
1893
|
return true;
|
1888
1894
|
}
|
1889
1895
|
}
|
@@ -2055,8 +2061,8 @@ up.Change.OpenLayer = class OpenLayer extends up.Change.Addition {
|
|
2055
2061
|
if (this.emitOpenEvent().defaultPrevented) {
|
2056
2062
|
throw new up.Aborted('Open event was prevented');
|
2057
2063
|
}
|
2058
|
-
this.baseLayer.peel();
|
2059
2064
|
this.layer = this.buildLayer();
|
2065
|
+
this.baseLayer.peel({ history: !this.layer.history });
|
2060
2066
|
up.layer.stack.push(this.layer);
|
2061
2067
|
this.layer.createElements(this.content);
|
2062
2068
|
this.layer.setupHandlers();
|
@@ -2190,7 +2196,7 @@ up.Change.UpdateLayer = (_a = class UpdateLayer extends up.Change.Addition {
|
|
2190
2196
|
up.viewport.saveFocus({ layer: this.layer });
|
2191
2197
|
}
|
2192
2198
|
if (this.options.peel) {
|
2193
|
-
this.layer.peel();
|
2199
|
+
this.layer.peel({ history: !this.hasHistory() });
|
2194
2200
|
}
|
2195
2201
|
if (this.options.abort !== false) {
|
2196
2202
|
up.fragment.abort(this.getFragments(), { reason: 'Fragment is being replaced' });
|
@@ -2483,6 +2489,7 @@ up.Change.CloseLayer = class CloseLayer extends up.Change.Removal {
|
|
2483
2489
|
this.value = options.value;
|
2484
2490
|
this.preventable = options.preventable ?? true;
|
2485
2491
|
this.response = options.response;
|
2492
|
+
this.history = options.history ?? true;
|
2486
2493
|
}
|
2487
2494
|
execute() {
|
2488
2495
|
if (!this.layer.isOpen()) {
|
@@ -2496,7 +2503,9 @@ up.Change.CloseLayer = class CloseLayer extends up.Change.Removal {
|
|
2496
2503
|
const { parent } = this.layer;
|
2497
2504
|
this.layer.peel();
|
2498
2505
|
this.layer.stack.remove(this.layer);
|
2499
|
-
|
2506
|
+
if (this.history) {
|
2507
|
+
parent.restoreHistory();
|
2508
|
+
}
|
2500
2509
|
this.handleFocus(parent);
|
2501
2510
|
this.layer.teardownHandlers();
|
2502
2511
|
this.layer.destroyElements(this.options);
|
@@ -2982,7 +2991,6 @@ up.CompilerPass = class CompilerPass {
|
|
2982
2991
|
catch (error) {
|
2983
2992
|
this.errors.push(error);
|
2984
2993
|
up.log.error('up.hello()', 'While compiling %o: %o', elementOrElements, error);
|
2985
|
-
up.error.emitGlobal(error);
|
2986
2994
|
}
|
2987
2995
|
}
|
2988
2996
|
destructorPresence(result) {
|
@@ -3153,7 +3161,6 @@ up.DestructorPass = class DestructorPass {
|
|
3153
3161
|
catch (error) {
|
3154
3162
|
this.errors.push(error);
|
3155
3163
|
up.log.error('up.destroy()', 'While destroying %o: %o', element, error);
|
3156
|
-
up.error.emitGlobal(error);
|
3157
3164
|
}
|
3158
3165
|
}
|
3159
3166
|
};
|
@@ -3322,6 +3329,9 @@ up.EventListener = class EventListener extends up.Record {
|
|
3322
3329
|
const data = up.syntax.data(element);
|
3323
3330
|
args.push(data);
|
3324
3331
|
}
|
3332
|
+
if (this.eventType === 'click' && element.disabled) {
|
3333
|
+
return;
|
3334
|
+
}
|
3325
3335
|
const applyCallback = this.callback.bind(element, ...args);
|
3326
3336
|
if (this.baseLayer) {
|
3327
3337
|
this.baseLayer.asCurrent(applyCallback);
|
@@ -4028,9 +4038,7 @@ up.FragmentPolling = class FragmentPolling {
|
|
4028
4038
|
}
|
4029
4039
|
onReloadFailure(reason) {
|
4030
4040
|
this.scheduleReload();
|
4031
|
-
|
4032
|
-
throw reason;
|
4033
|
-
}
|
4041
|
+
up.error.rethrowCritical(reason);
|
4034
4042
|
}
|
4035
4043
|
onFragmentSwapped(newFragment) {
|
4036
4044
|
this.stop();
|
@@ -4520,7 +4528,7 @@ up.Layer.Overlay = class Overlay extends up.Layer {
|
|
4520
4528
|
parser.string('easing');
|
4521
4529
|
parser.number('duration');
|
4522
4530
|
parser.string('confirm');
|
4523
|
-
closeFn(value, closeOptions);
|
4531
|
+
up.error.muteUncriticalSync(() => closeFn(value, closeOptions));
|
4524
4532
|
});
|
4525
4533
|
}
|
4526
4534
|
registerEventCloser(eventTypes, closeFn) {
|
@@ -4694,13 +4702,13 @@ up.Layer.OverlayWithViewport = (_a = class OverlayWithViewport extends up.Layer.
|
|
4694
4702
|
var _a;
|
4695
4703
|
const e = up.element;
|
4696
4704
|
up.Layer.Root = (_a = class Root extends up.Layer {
|
4705
|
+
get element() {
|
4706
|
+
return e.root;
|
4707
|
+
}
|
4697
4708
|
constructor(options) {
|
4698
4709
|
super(options);
|
4699
4710
|
this.setupHandlers();
|
4700
4711
|
}
|
4701
|
-
get element() {
|
4702
|
-
return e.root;
|
4703
|
-
}
|
4704
4712
|
getFirstSwappableElement() {
|
4705
4713
|
return document.body;
|
4706
4714
|
}
|
@@ -5852,26 +5860,6 @@ up.RenderResult = class RenderResult extends up.Record {
|
|
5852
5860
|
var _a;
|
5853
5861
|
const u = up.util;
|
5854
5862
|
up.Request = (_a = class Request extends up.Record {
|
5855
|
-
constructor(options) {
|
5856
|
-
super(options);
|
5857
|
-
this.params = new up.Params(this.params);
|
5858
|
-
if (this.wrapMethod == null) {
|
5859
|
-
this.wrapMethod = up.network.config.wrapMethod;
|
5860
|
-
}
|
5861
|
-
this.normalize();
|
5862
|
-
if ((this.target || this.layer || this.origin) && !options.basic) {
|
5863
|
-
const layerLookupOptions = { origin: this.origin };
|
5864
|
-
this.layer = up.layer.get(this.layer, layerLookupOptions);
|
5865
|
-
this.failLayer = up.layer.get(this.failLayer || this.layer, layerLookupOptions);
|
5866
|
-
this.context || (this.context = this.layer.context || {});
|
5867
|
-
this.failContext || (this.failContext = this.failLayer.context || {});
|
5868
|
-
this.mode || (this.mode = this.layer.mode);
|
5869
|
-
this.failMode || (this.failMode = this.failLayer.mode);
|
5870
|
-
}
|
5871
|
-
this.deferred = u.newDeferred();
|
5872
|
-
this.badResponseTime ?? (this.badResponseTime = u.evalOption(up.network.config.badResponseTime, this));
|
5873
|
-
this.addAutoHeaders();
|
5874
|
-
}
|
5875
5863
|
keys() {
|
5876
5864
|
return [
|
5877
5865
|
'method',
|
@@ -5914,6 +5902,26 @@ up.Request = (_a = class Request extends up.Record {
|
|
5914
5902
|
builtAt: new Date(),
|
5915
5903
|
};
|
5916
5904
|
}
|
5905
|
+
constructor(options) {
|
5906
|
+
super(options);
|
5907
|
+
this.params = new up.Params(this.params);
|
5908
|
+
if (this.wrapMethod == null) {
|
5909
|
+
this.wrapMethod = up.network.config.wrapMethod;
|
5910
|
+
}
|
5911
|
+
this.normalize();
|
5912
|
+
if ((this.target || this.layer || this.origin) && !options.basic) {
|
5913
|
+
const layerLookupOptions = { origin: this.origin };
|
5914
|
+
this.layer = up.layer.get(this.layer, layerLookupOptions);
|
5915
|
+
this.failLayer = up.layer.get(this.failLayer || this.layer, layerLookupOptions);
|
5916
|
+
this.context || (this.context = this.layer.context || {});
|
5917
|
+
this.failContext || (this.failContext = this.failLayer.context || {});
|
5918
|
+
this.mode || (this.mode = this.layer.mode);
|
5919
|
+
this.failMode || (this.failMode = this.failLayer.mode);
|
5920
|
+
}
|
5921
|
+
this.deferred = u.newDeferred();
|
5922
|
+
this.badResponseTime ?? (this.badResponseTime = u.evalOption(up.network.config.badResponseTime, this));
|
5923
|
+
this.addAutoHeaders();
|
5924
|
+
}
|
5917
5925
|
get xhr() {
|
5918
5926
|
return this._xhr ?? (this._xhr = new XMLHttpRequest());
|
5919
5927
|
}
|
@@ -7694,6 +7702,7 @@ up.history = (function () {
|
|
7694
7702
|
}
|
7695
7703
|
function onPop(event) {
|
7696
7704
|
trackCurrentLocation();
|
7705
|
+
let location = currentLocation();
|
7697
7706
|
emitLocationChanged({ location, reason: 'pop', log: `Navigated to history entry ${location}` });
|
7698
7707
|
up.viewport.saveFocus({ location: previousLocation });
|
7699
7708
|
up.viewport.saveScroll({ location: previousLocation });
|
@@ -7892,8 +7901,13 @@ up.fragment = (function () {
|
|
7892
7901
|
selector = buildSelector(selector, element, options);
|
7893
7902
|
return selector.subtree(element);
|
7894
7903
|
}
|
7895
|
-
function contains(
|
7896
|
-
|
7904
|
+
function contains(root, selectorOrElement) {
|
7905
|
+
if (u.isElement(selectorOrElement)) {
|
7906
|
+
return e.contains(root, selectorOrElement) && up.layer.get(root).contains(selectorOrElement);
|
7907
|
+
}
|
7908
|
+
else {
|
7909
|
+
return getSubtree(root, selectorOrElement).length > 0;
|
7910
|
+
}
|
7897
7911
|
}
|
7898
7912
|
function closest(element, selector, options) {
|
7899
7913
|
element = e.get(element);
|
@@ -8539,7 +8553,7 @@ up.viewport = (function () {
|
|
8539
8553
|
}
|
8540
8554
|
function focusedElementWithin(scopeElement) {
|
8541
8555
|
const focusedElement = document.activeElement;
|
8542
|
-
if (
|
8556
|
+
if (up.fragment.contains(scopeElement, focusedElement)) {
|
8543
8557
|
return focusedElement;
|
8544
8558
|
}
|
8545
8559
|
}
|
@@ -8801,8 +8815,11 @@ up.motion = (function () {
|
|
8801
8815
|
function translateCSS(dx, dy) {
|
8802
8816
|
return { transform: `translate(${dx}px, ${dy}px)` };
|
8803
8817
|
}
|
8818
|
+
function noTranslateCSS() {
|
8819
|
+
return { transform: null };
|
8820
|
+
}
|
8804
8821
|
function untranslatedBox(element) {
|
8805
|
-
e.setStyle(element,
|
8822
|
+
e.setStyle(element, noTranslateCSS());
|
8806
8823
|
return element.getBoundingClientRect();
|
8807
8824
|
}
|
8808
8825
|
function registerMoveAnimations(direction, boxToTransform) {
|
@@ -8817,7 +8834,7 @@ up.motion = (function () {
|
|
8817
8834
|
const box = untranslatedBox(element);
|
8818
8835
|
const transform = boxToTransform(box);
|
8819
8836
|
e.setStyle(element, transform);
|
8820
|
-
return animateNow(element,
|
8837
|
+
return animateNow(element, noTranslateCSS(), options);
|
8821
8838
|
});
|
8822
8839
|
}
|
8823
8840
|
registerMoveAnimations('top', function (box) {
|
@@ -9623,13 +9640,13 @@ up.form = (function () {
|
|
9623
9640
|
}
|
9624
9641
|
function submittingButton(form) {
|
9625
9642
|
const selector = submitButtonSelector();
|
9626
|
-
const focusedElement =
|
9627
|
-
if (focusedElement && focusedElement.
|
9628
|
-
|
9629
|
-
|
9630
|
-
|
9631
|
-
return e.get(form, selector);
|
9643
|
+
const focusedElement = document.activeElement;
|
9644
|
+
if (focusedElement && focusedElement.form === form) {
|
9645
|
+
if (focusedElement.matches(selector)) {
|
9646
|
+
return focusedElement;
|
9647
|
+
}
|
9632
9648
|
}
|
9649
|
+
return e.get(form, selector);
|
9633
9650
|
}
|
9634
9651
|
function submitButtonSelector() {
|
9635
9652
|
return config.submitButtonSelectors.join(',');
|
@@ -1,12 +1,6 @@
|
|
1
1
|
[hidden][hidden]{display:none !important}
|
2
|
-
|
3
2
|
up-wrapper{display:inline-block}
|
4
|
-
|
5
3
|
up-bounds{position:absolute}.up-focusable-content:focus,.up-focusable-content:focus-visible{outline:0}
|
6
|
-
|
7
4
|
.up-request-loader{display:none}up-progress-bar{position:fixed;top:0;left:0;z-index:999999999;height:3px;background-color:#007bff}
|
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;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
|
-
|
5
|
+
up-focus-trap{position:fixed;top:0;left:0;width:0;height:0}up-cover-viewport,up-drawer-viewport,up-modal-viewport,up-drawer-backdrop,up-modal-backdrop,up-cover,up-drawer,up-modal{top:0;left:0;bottom:0;right:0}up-drawer-box,up-modal-box{box-shadow:0 0 10px 1px rgba(0,0,0,.3)}up-popup{box-shadow:0 0 4px rgba(0,0,0,.3)}up-popup:focus,up-cover-box:focus,up-drawer-box:focus,up-modal-box:focus,up-cover:focus,up-drawer:focus,up-modal:focus,up-popup:focus-visible,up-cover-box:focus-visible,up-drawer-box:focus-visible,up-modal-box:focus-visible,up-cover:focus-visible,up-drawer:focus-visible,up-modal:focus-visible{outline:none}up-cover,up-drawer,up-modal{z-index:2000;position:fixed}up-drawer-backdrop,up-modal-backdrop{position:absolute;background:rgba(0,0,0,.4)}up-cover-viewport,up-drawer-viewport,up-modal-viewport{position:absolute;overflow-y:scroll;overflow-x:hidden;overscroll-behavior:contain;display:flex;align-items:flex-start;justify-content:center}up-popup,up-cover-box,up-drawer-box,up-modal-box{position:relative;box-sizing:border-box;max-width:100%;background-color:#fff;padding:20px;overflow-x:hidden}up-popup-content,up-cover-content,up-drawer-content,up-modal-content{display:block}up-popup{z-index:1000}up-popup-dismiss,up-cover-dismiss,up-drawer-dismiss,up-modal-dismiss{color:#888;position:absolute;top:10px;right:10px;font-size:1.7rem;line-height:.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%}
|
11
6
|
[up-href],[up-clickable]{cursor:pointer}
|
12
|
-
|