unpoly-rails 3.7.1 → 3.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84170dbbaa56e9d08bf7c57b22a3e9a96b04def816ba544e5c254d69bb5ba651
4
- data.tar.gz: cd9e91cd923091e80ba9be59fb62176c3c8f156c8af2f49f1fa7d7cdc77cd0ab
3
+ metadata.gz: 97f7900161912597e3c72a6bbc352e9b2029787a30598d695aafd7aa0087386a
4
+ data.tar.gz: 94f3822ae12651165ce9b17eb2b2831c54f72514603ca29ca2a34395c7b68170
5
5
  SHA512:
6
- metadata.gz: 06c702b46d1e913493f0407f786772bfb65acdf088aab8f82238cee646a38125d8ef401e5255b5f5ada2994102b63416b21cac7f07f27fb5850671509d79f951
7
- data.tar.gz: c79fca122281fd2c14919504cdf7050c73a3e673ab2c7eab45891cd5b3f944b809b3f0c0cf79db5b362cd1f44f81b61321846a275c8c89108865469da4492503
6
+ metadata.gz: 5b171287414f24deb0e0b9b8f4f7704f4c548efe351893e4cb433bd449abc366cf341a4b006b3db0d4258f5aabdc6313c8adeccad38a768708ca1619d70c3861
7
+ data.tar.gz: 9e7e704439f679ffc6a35cb46408f1dbd7c34bf55cc915cfa2033233c006c6c0fc075c715be83378cd8409728269913918903cf35124638bb9d558fac42a82f9
@@ -5,7 +5,7 @@
5
5
  /***/ (() => {
6
6
 
7
7
  window.up = {
8
- version: '3.7.1'
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
- for (let abortableElement of this._abortableElements()) {
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);
@@ -3855,10 +3841,14 @@ up.FormValidator = class FormValidator {
3855
3841
  this._honorAbort();
3856
3842
  }
3857
3843
  _honorAbort() {
3858
- up.fragment.onAborted(this._form, { around: true }, ({ target }) => this._unscheduleSolutionsWithin(target));
3844
+ up.fragment.onAborted(this._form, (event) => this._onAborted(event));
3859
3845
  }
3860
- _unscheduleSolutionsWithin(container) {
3861
- this._dirtySolutions = u.reject(this._dirtySolutions, ({ element }) => container.contains(element));
3846
+ _onAborted(event) {
3847
+ if (this._dirtySolutions.length) {
3848
+ this._dirtySolutions = [];
3849
+ this._nextRenderPromise.reject(new up.Aborted(event.reason));
3850
+ this._resetNextRenderPromise();
3851
+ }
3862
3852
  }
3863
3853
  _resetNextRenderPromise() {
3864
3854
  this._nextRenderPromise = u.newDeferred();
@@ -3940,11 +3930,11 @@ up.FormValidator = class FormValidator {
3940
3930
  _scheduleNextRender() {
3941
3931
  let solutionDelays = this._dirtySolutions.map((solution) => solution.renderOptions.delay);
3942
3932
  let shortestDelay = Math.min(...solutionDelays) || 0;
3943
- this._unscheduleNextRender();
3944
- this._nextRenderTimer = u.timer(shortestDelay, () => this._renderDirtySolutions());
3945
- }
3946
- _unscheduleNextRender() {
3947
3933
  clearTimeout(this._nextRenderTimer);
3934
+ this._nextRenderTimer = u.timer(shortestDelay, () => {
3935
+ this._nextRenderTimer = null;
3936
+ this._renderDirtySolutions();
3937
+ });
3948
3938
  }
3949
3939
  _renderDirtySolutions() {
3950
3940
  up.error.muteUncriticalRejection(this._doRenderDirtySolutions());
@@ -3952,10 +3942,12 @@ up.FormValidator = class FormValidator {
3952
3942
  _doRenderDirtySolutions() {
3953
3943
  var _a;
3954
3944
  return __awaiter(this, void 0, void 0, function* () {
3955
- this._dirtySolutions = u.filter(this._dirtySolutions, ({ element, origin }) => up.fragment.isAlive(element) && up.fragment.isAlive(origin));
3956
- if (!this._dirtySolutions.length || this._rendering) {
3945
+ if (!this._dirtySolutions.length)
3946
+ return;
3947
+ if (this._rendering)
3948
+ return;
3949
+ if (this._nextRenderTimer)
3957
3950
  return;
3958
- }
3959
3951
  let dirtySolutions = this._dirtySolutions;
3960
3952
  this._dirtySolutions = [];
3961
3953
  let dirtyOrigins = u.map(dirtySolutions, 'origin');
@@ -3969,6 +3961,7 @@ up.FormValidator = class FormValidator {
3969
3961
  options.origin = this._form;
3970
3962
  (_a = options.focus) !== null && _a !== void 0 ? _a : (options.focus = 'keep');
3971
3963
  options.failOptions = false;
3964
+ options.defaultMaybe = true;
3972
3965
  options.params = up.Params.merge(options.params, ...u.map(dirtyRenderOptionsList, 'params'));
3973
3966
  options.headers = u.merge(...u.map(dirtyRenderOptionsList, 'headers'));
3974
3967
  this._addValidateHeader(options.headers, dirtyNames);
@@ -8681,14 +8674,16 @@ up.fragment = (function () {
8681
8674
  return u.parseTokens(target, { separator: 'comma' });
8682
8675
  }
8683
8676
  function parseTargetSteps(target, options = {}) {
8677
+ var _a;
8684
8678
  let defaultPlacement = options.defaultPlacement || 'swap';
8679
+ let defaultMaybe = (_a = options.defaultMaybe) !== null && _a !== void 0 ? _a : false;
8685
8680
  let steps = [];
8686
8681
  let simpleSelectors = splitTarget(target);
8687
8682
  for (let selector of simpleSelectors) {
8688
8683
  if (selector === ':none')
8689
8684
  continue;
8690
8685
  let placement = defaultPlacement;
8691
- let maybe = false;
8686
+ let maybe = defaultMaybe;
8692
8687
  selector = selector.replace(/\b::?(before|after)\b/, (_match, customPlacement) => {
8693
8688
  placement = customPlacement;
8694
8689
  return '';
@@ -8728,8 +8723,8 @@ up.fragment = (function () {
8728
8723
  return request.fromCache && u.evalAutoOption(options.revalidate, config.autoRevalidate, response);
8729
8724
  }
8730
8725
  function targetForSteps(steps) {
8731
- let requiredSteps = u.reject(steps, 'maybe');
8732
- let selectors = u.map(requiredSteps, 'selector');
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');
8733
8728
  return selectors.join(', ') || ':none';
8734
8729
  }
8735
8730
  function isContainedByRivalStep(steps, candidateStep) {
@@ -8765,13 +8760,11 @@ up.fragment = (function () {
8765
8760
  let testFnWithAbortable = (request) => request.abortable && testFn(request);
8766
8761
  up.network.abort(testFnWithAbortable, Object.assign(Object.assign({}, options), { reason }));
8767
8762
  for (let element of elements) {
8768
- up.emit(element, 'up:fragment:aborted', { newLayer, log: false });
8763
+ up.emit(element, 'up:fragment:aborted', { reason, newLayer, log: false });
8769
8764
  }
8770
8765
  }
8771
- function onAborted(fragment, ...args) {
8772
- let callback = u.extractCallback(args);
8773
- let options = u.extractOptions(args);
8774
- 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);
8775
8768
  let unsubscribe = up.on('up:fragment:aborted', { guard }, callback);
8776
8769
  up.destructor(fragment, unsubscribe);
8777
8770
  return unsubscribe;
@@ -10185,11 +10178,8 @@ up.form = (function () {
10185
10178
  return config.selector('submitButtonSelectors');
10186
10179
  }
10187
10180
  const submit = up.mockable((form, options) => {
10188
- return buildSubmitJob(form, options).execute();
10181
+ return up.render(submitOptions(form, options));
10189
10182
  });
10190
- function buildSubmitJob(form, options) {
10191
- return new up.RenderJob(submitOptions(form, options));
10192
- }
10193
10183
  function submitOptions(form, options, parserOptions) {
10194
10184
  form = getForm(form);
10195
10185
  options = u.options(options);
@@ -10206,9 +10196,6 @@ up.form = (function () {
10206
10196
  parser.include(up.link.followOptions);
10207
10197
  return options;
10208
10198
  }
10209
- function getPreflightFragments(form) {
10210
- return buildSubmitJob(form).getPreflightFragments();
10211
- }
10212
10199
  function watchOptions(field, options, parserOptions = {}) {
10213
10200
  var _a;
10214
10201
  options = u.options(options);
@@ -10333,11 +10320,8 @@ up.form = (function () {
10333
10320
  }
10334
10321
  }
10335
10322
  function autosubmit(target, options = {}) {
10336
- var _a;
10337
- const form = getForm(target);
10338
- (_a = options.abortable) !== null && _a !== void 0 ? _a : (options.abortable = [form, ...getPreflightFragments(form)]);
10339
- const onChange = (_value, _name, renderOptions) => submit(target, renderOptions);
10340
- return watch(target, options, onChange);
10323
+ const onChange = (_diff, renderOptions) => submit(target, renderOptions);
10324
+ return watch(target, { options, batch: true }, onChange);
10341
10325
  }
10342
10326
  function getGroupSelectors() {
10343
10327
  var _a, _b;