unpoly-rails 3.7.0.1 → 3.7.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/assets/unpoly/unpoly.es6.js +35 -48
- data/assets/unpoly/unpoly.es6.min.js +1 -1
- data/assets/unpoly/unpoly.js +34 -46
- data/assets/unpoly/unpoly.min.js +1 -1
- data/lib/unpoly/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 97f7900161912597e3c72a6bbc352e9b2029787a30598d695aafd7aa0087386a
|
|
4
|
+
data.tar.gz: 94f3822ae12651165ce9b17eb2b2831c54f72514603ca29ca2a34395c7b68170
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5b171287414f24deb0e0b9b8f4f7704f4c548efe351893e4cb433bd449abc366cf341a4b006b3db0d4258f5aabdc6313c8adeccad38a768708ca1619d70c3861
|
|
7
|
+
data.tar.gz: 9e7e704439f679ffc6a35cb46408f1dbd7c34bf55cc915cfa2033233c006c6c0fc075c715be83378cd8409728269913918903cf35124638bb9d558fac42a82f9
|
data/assets/unpoly/unpoly.es6.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/***/ (() => {
|
|
6
6
|
|
|
7
7
|
window.up = {
|
|
8
|
-
version: '3.7.
|
|
8
|
+
version: '3.7.2'
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
|
|
@@ -2003,9 +2003,6 @@ up.RenderJob = (_a = class RenderJob {
|
|
|
2003
2003
|
this._rendered = this._executePromise();
|
|
2004
2004
|
return this;
|
|
2005
2005
|
}
|
|
2006
|
-
getPreflightFragments() {
|
|
2007
|
-
return this._getChange().getPreflightProps().fragments;
|
|
2008
|
-
}
|
|
2009
2006
|
_executePromise() {
|
|
2010
2007
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2011
2008
|
try {
|
|
@@ -3704,9 +3701,7 @@ up.FieldWatcher = class FieldWatcher {
|
|
|
3704
3701
|
if (target !== this._root)
|
|
3705
3702
|
this._watchFieldsWithin(target);
|
|
3706
3703
|
});
|
|
3707
|
-
|
|
3708
|
-
this._unbindFns.push(up.fragment.onAborted(abortableElement, () => this._abort()));
|
|
3709
|
-
}
|
|
3704
|
+
this._unbindFns.push(up.fragment.onAborted(this._scope, () => this._abort()));
|
|
3710
3705
|
this._unbindFns.push(up.on(this._scope, 'reset', () => this._onFormReset()));
|
|
3711
3706
|
}
|
|
3712
3707
|
stop() {
|
|
@@ -3718,15 +3713,6 @@ up.FieldWatcher = class FieldWatcher {
|
|
|
3718
3713
|
let rootOptions = u.copy(this._options);
|
|
3719
3714
|
return up.form.watchOptions(field, rootOptions, { defaults: { event: 'input' } });
|
|
3720
3715
|
}
|
|
3721
|
-
_abortableElements() {
|
|
3722
|
-
var _a;
|
|
3723
|
-
if (this._abortable === false) {
|
|
3724
|
-
return [];
|
|
3725
|
-
}
|
|
3726
|
-
else {
|
|
3727
|
-
return u.wrapList((_a = this._abortable) !== null && _a !== void 0 ? _a : this._scope);
|
|
3728
|
-
}
|
|
3729
|
-
}
|
|
3730
3716
|
_watchFieldsWithin(container) {
|
|
3731
3717
|
for (let field of up.form.fields(container)) {
|
|
3732
3718
|
this._watchField(field);
|
|
@@ -3740,11 +3726,12 @@ up.FieldWatcher = class FieldWatcher {
|
|
|
3740
3726
|
this._scheduledValues = null;
|
|
3741
3727
|
}
|
|
3742
3728
|
_scheduleValues(values, fieldOptions) {
|
|
3743
|
-
clearTimeout(this._currentTimer);
|
|
3744
3729
|
this._scheduledValues = values;
|
|
3730
|
+
this._scheduledFieldOptions = fieldOptions;
|
|
3745
3731
|
let delay = fieldOptions.delay || 0;
|
|
3732
|
+
clearTimeout(this._currentTimer);
|
|
3746
3733
|
this._currentTimer = u.timer(delay, () => {
|
|
3747
|
-
this.
|
|
3734
|
+
this._currentTimer = null;
|
|
3748
3735
|
this._requestCallback();
|
|
3749
3736
|
});
|
|
3750
3737
|
}
|
|
@@ -3757,6 +3744,8 @@ up.FieldWatcher = class FieldWatcher {
|
|
|
3757
3744
|
return;
|
|
3758
3745
|
if (this._callbackRunning)
|
|
3759
3746
|
return;
|
|
3747
|
+
if (this._currentTimer)
|
|
3748
|
+
return;
|
|
3760
3749
|
if (!this._scope.isConnected)
|
|
3761
3750
|
return;
|
|
3762
3751
|
let fieldOptions = this._scheduledFieldOptions;
|
|
@@ -3852,10 +3841,14 @@ up.FormValidator = class FormValidator {
|
|
|
3852
3841
|
this._honorAbort();
|
|
3853
3842
|
}
|
|
3854
3843
|
_honorAbort() {
|
|
3855
|
-
up.fragment.onAborted(this._form,
|
|
3844
|
+
up.fragment.onAborted(this._form, (event) => this._onAborted(event));
|
|
3856
3845
|
}
|
|
3857
|
-
|
|
3858
|
-
|
|
3846
|
+
_onAborted(event) {
|
|
3847
|
+
if (this._dirtySolutions.length) {
|
|
3848
|
+
this._dirtySolutions = [];
|
|
3849
|
+
this._nextRenderPromise.reject(new up.Aborted(event.reason));
|
|
3850
|
+
this._resetNextRenderPromise();
|
|
3851
|
+
}
|
|
3859
3852
|
}
|
|
3860
3853
|
_resetNextRenderPromise() {
|
|
3861
3854
|
this._nextRenderPromise = u.newDeferred();
|
|
@@ -3937,11 +3930,11 @@ up.FormValidator = class FormValidator {
|
|
|
3937
3930
|
_scheduleNextRender() {
|
|
3938
3931
|
let solutionDelays = this._dirtySolutions.map((solution) => solution.renderOptions.delay);
|
|
3939
3932
|
let shortestDelay = Math.min(...solutionDelays) || 0;
|
|
3940
|
-
this._unscheduleNextRender();
|
|
3941
|
-
this._nextRenderTimer = u.timer(shortestDelay, () => this._renderDirtySolutions());
|
|
3942
|
-
}
|
|
3943
|
-
_unscheduleNextRender() {
|
|
3944
3933
|
clearTimeout(this._nextRenderTimer);
|
|
3934
|
+
this._nextRenderTimer = u.timer(shortestDelay, () => {
|
|
3935
|
+
this._nextRenderTimer = null;
|
|
3936
|
+
this._renderDirtySolutions();
|
|
3937
|
+
});
|
|
3945
3938
|
}
|
|
3946
3939
|
_renderDirtySolutions() {
|
|
3947
3940
|
up.error.muteUncriticalRejection(this._doRenderDirtySolutions());
|
|
@@ -3949,10 +3942,12 @@ up.FormValidator = class FormValidator {
|
|
|
3949
3942
|
_doRenderDirtySolutions() {
|
|
3950
3943
|
var _a;
|
|
3951
3944
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3952
|
-
|
|
3953
|
-
|
|
3945
|
+
if (!this._dirtySolutions.length)
|
|
3946
|
+
return;
|
|
3947
|
+
if (this._rendering)
|
|
3948
|
+
return;
|
|
3949
|
+
if (this._nextRenderTimer)
|
|
3954
3950
|
return;
|
|
3955
|
-
}
|
|
3956
3951
|
let dirtySolutions = this._dirtySolutions;
|
|
3957
3952
|
this._dirtySolutions = [];
|
|
3958
3953
|
let dirtyOrigins = u.map(dirtySolutions, 'origin');
|
|
@@ -3966,6 +3961,7 @@ up.FormValidator = class FormValidator {
|
|
|
3966
3961
|
options.origin = this._form;
|
|
3967
3962
|
(_a = options.focus) !== null && _a !== void 0 ? _a : (options.focus = 'keep');
|
|
3968
3963
|
options.failOptions = false;
|
|
3964
|
+
options.defaultMaybe = true;
|
|
3969
3965
|
options.params = up.Params.merge(options.params, ...u.map(dirtyRenderOptionsList, 'params'));
|
|
3970
3966
|
options.headers = u.merge(...u.map(dirtyRenderOptionsList, 'headers'));
|
|
3971
3967
|
this._addValidateHeader(options.headers, dirtyNames);
|
|
@@ -8678,14 +8674,16 @@ up.fragment = (function () {
|
|
|
8678
8674
|
return u.parseTokens(target, { separator: 'comma' });
|
|
8679
8675
|
}
|
|
8680
8676
|
function parseTargetSteps(target, options = {}) {
|
|
8677
|
+
var _a;
|
|
8681
8678
|
let defaultPlacement = options.defaultPlacement || 'swap';
|
|
8679
|
+
let defaultMaybe = (_a = options.defaultMaybe) !== null && _a !== void 0 ? _a : false;
|
|
8682
8680
|
let steps = [];
|
|
8683
8681
|
let simpleSelectors = splitTarget(target);
|
|
8684
8682
|
for (let selector of simpleSelectors) {
|
|
8685
8683
|
if (selector === ':none')
|
|
8686
8684
|
continue;
|
|
8687
8685
|
let placement = defaultPlacement;
|
|
8688
|
-
let maybe =
|
|
8686
|
+
let maybe = defaultMaybe;
|
|
8689
8687
|
selector = selector.replace(/\b::?(before|after)\b/, (_match, customPlacement) => {
|
|
8690
8688
|
placement = customPlacement;
|
|
8691
8689
|
return '';
|
|
@@ -8725,8 +8723,8 @@ up.fragment = (function () {
|
|
|
8725
8723
|
return request.fromCache && u.evalAutoOption(options.revalidate, config.autoRevalidate, response);
|
|
8726
8724
|
}
|
|
8727
8725
|
function targetForSteps(steps) {
|
|
8728
|
-
let
|
|
8729
|
-
let selectors = u.map(
|
|
8726
|
+
let bestSteps = steps.filter((step) => { var _a; return !step.maybe || ((_a = step.oldElement) === null || _a === void 0 ? void 0 : _a.isConnected); });
|
|
8727
|
+
let selectors = u.map(bestSteps, 'selector');
|
|
8730
8728
|
return selectors.join(', ') || ':none';
|
|
8731
8729
|
}
|
|
8732
8730
|
function isContainedByRivalStep(steps, candidateStep) {
|
|
@@ -8762,13 +8760,11 @@ up.fragment = (function () {
|
|
|
8762
8760
|
let testFnWithAbortable = (request) => request.abortable && testFn(request);
|
|
8763
8761
|
up.network.abort(testFnWithAbortable, Object.assign(Object.assign({}, options), { reason }));
|
|
8764
8762
|
for (let element of elements) {
|
|
8765
|
-
up.emit(element, 'up:fragment:aborted', { newLayer, log: false });
|
|
8763
|
+
up.emit(element, 'up:fragment:aborted', { reason, newLayer, log: false });
|
|
8766
8764
|
}
|
|
8767
8765
|
}
|
|
8768
|
-
function onAborted(fragment,
|
|
8769
|
-
let
|
|
8770
|
-
let options = u.extractOptions(args);
|
|
8771
|
-
let guard = (event) => event.target.contains(fragment) || (options.around && fragment.contains(event.target));
|
|
8766
|
+
function onAborted(fragment, callback) {
|
|
8767
|
+
let guard = (event) => event.target.contains(fragment);
|
|
8772
8768
|
let unsubscribe = up.on('up:fragment:aborted', { guard }, callback);
|
|
8773
8769
|
up.destructor(fragment, unsubscribe);
|
|
8774
8770
|
return unsubscribe;
|
|
@@ -10182,11 +10178,8 @@ up.form = (function () {
|
|
|
10182
10178
|
return config.selector('submitButtonSelectors');
|
|
10183
10179
|
}
|
|
10184
10180
|
const submit = up.mockable((form, options) => {
|
|
10185
|
-
return
|
|
10181
|
+
return up.render(submitOptions(form, options));
|
|
10186
10182
|
});
|
|
10187
|
-
function buildSubmitJob(form, options) {
|
|
10188
|
-
return new up.RenderJob(submitOptions(form, options));
|
|
10189
|
-
}
|
|
10190
10183
|
function submitOptions(form, options, parserOptions) {
|
|
10191
10184
|
form = getForm(form);
|
|
10192
10185
|
options = u.options(options);
|
|
@@ -10203,9 +10196,6 @@ up.form = (function () {
|
|
|
10203
10196
|
parser.include(up.link.followOptions);
|
|
10204
10197
|
return options;
|
|
10205
10198
|
}
|
|
10206
|
-
function getPreflightFragments(form) {
|
|
10207
|
-
return buildSubmitJob(form).getPreflightFragments();
|
|
10208
|
-
}
|
|
10209
10199
|
function watchOptions(field, options, parserOptions = {}) {
|
|
10210
10200
|
var _a;
|
|
10211
10201
|
options = u.options(options);
|
|
@@ -10330,11 +10320,8 @@ up.form = (function () {
|
|
|
10330
10320
|
}
|
|
10331
10321
|
}
|
|
10332
10322
|
function autosubmit(target, options = {}) {
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
(_a = options.abortable) !== null && _a !== void 0 ? _a : (options.abortable = [form, ...getPreflightFragments(form)]);
|
|
10336
|
-
const onChange = (_value, _name, renderOptions) => submit(target, renderOptions);
|
|
10337
|
-
return watch(target, options, onChange);
|
|
10323
|
+
const onChange = (_diff, renderOptions) => submit(target, renderOptions);
|
|
10324
|
+
return watch(target, { options, batch: true }, onChange);
|
|
10338
10325
|
}
|
|
10339
10326
|
function getGroupSelectors() {
|
|
10340
10327
|
var _a, _b;
|