unpoly-rails 2.0.0.pre.rc10 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of unpoly-rails might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +145 -49
- data/README.md +2 -1
- data/dist/unpoly-migrate.js +138 -24
- data/dist/unpoly-migrate.min.js +1 -1
- data/dist/unpoly.css +8 -0
- data/dist/unpoly.js +1437 -816
- data/dist/unpoly.min.css +1 -1
- data/dist/unpoly.min.js +6 -6
- data/lib/unpoly/rails/engine.rb +22 -16
- data/lib/unpoly/rails/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 498fefa239aae0cf36380af1a27d56a032a5fe3732268fdadc9961dd144af2d0
|
4
|
+
data.tar.gz: 21a984c788247f8bc5f68fc752ef18f48e5eb226a5c85d079473879f49791559
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ae83c5e9224620e5b594730b6baa488b5891dc2ec14351b071b079abfcab5e3eb01ffa2d0a288e984b7d1d20a00bdab19353a6f87120673682c0033dd21276e
|
7
|
+
data.tar.gz: 030fc977340f6979e7f25727ad91d0d4aeae773b8aeeb54ccbed4f946ffd1b1017a7c22c6d1496fc42a1a69d150949c2356d1c236d4e9827238b975c942173ef
|
data/CHANGELOG.md
CHANGED
@@ -3,67 +3,163 @@ Changelog
|
|
3
3
|
|
4
4
|
Changes to this project will be documented in this file.
|
5
5
|
|
6
|
+
If you're upgrading from an older Unpoly version you should load [`unpoly-migrate.js`](https://unpoly.com/changes/upgrading) to enable deprecated APIs.
|
7
|
+
|
6
8
|
You may browse a formatted and hyperlinked version of this file at <https://unpoly.com/changes>.
|
7
9
|
|
8
10
|
|
11
|
+
2.1.0
|
12
|
+
-----
|
13
|
+
|
14
|
+
- Unpoly now shows a [progress bar](/up.network.config#config.progressBar) that appears for [late requests](/up:request:late).
|
15
|
+
- For new layers, the `[up-history-visible]` and `[up-history]` options have been unified into a single `[up-history]` option. This reverts to the old behavior of Unpoly 1.0. The separation into two options was introduced in Unpoly 2.0, but turned out to be confusing to users.
|
16
|
+
- [Layer configuration](/up.layer.config) may now set mode-specific defaults for [`{ scroll }`](/scroll-option) and [`{ focus }`](/focus-option). These take precendence to defaults in [`up.fragment.config.navigateOptions`](/up.fragment.config#config.navigateOptions).
|
17
|
+
- Links with an [`[up-instant]`](/a-up-instant) attribute are now followed automatically, even if they don't also have an [`[up-follow]`](/a-up-follow) attribute.
|
18
|
+
|
19
|
+
|
20
|
+
1.0.1
|
21
|
+
-----
|
22
|
+
|
23
|
+
This is a maintenance release for Unpoly 1. Expect little to no additional changes for this legacy version. New features will only be added to Unpoly 2.
|
24
|
+
|
25
|
+
- `up.request()` will now send Unpoly's version number as an `X-Up-Version` request header. Since `X-Up-Target` is optional in Unpoly 2, server-side integration libraries can look for `X-Up-Version` to reliably detect a fragment update for both Unpoly 1 and 2.
|
26
|
+
- Fix a bug where the Unpoly banner would still be printed to the development console when `up.log.config.banner = false` is set. (fix by @adam12)
|
27
|
+
|
28
|
+
|
29
|
+
2.0.1
|
30
|
+
-----
|
31
|
+
|
32
|
+
This bugfix release addresses some issues user reported when upgrading to Unpoly 2:
|
33
|
+
|
34
|
+
- Fix a bug where [`unpoly-migrate.js`](https://unpoly.com/changes/upgrading) would crash when loaded.
|
35
|
+
- Fix a bug where transitions would crash when some { scroll } options were also used (#187)
|
36
|
+
- Users can now now change the spacing between a popup overlay and the opening link by giving `<up-popup>` a CSS margin.
|
37
|
+
|
38
|
+
|
9
39
|
2.0.0
|
10
40
|
-----
|
11
41
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
-
|
23
|
-
-
|
24
|
-
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
-
|
29
|
-
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
- up.
|
36
|
-
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
-
|
42
|
-
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
-
|
47
|
-
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
-
|
42
|
+
Unpoly 2 ships with many new features and API improvements, unlocking many use cases that were not possible with Unpoly 1.
|
43
|
+
|
44
|
+
For an in-depth guide to all changes, see our [Unpoly 2 presentation](http://triskweline.de/unpoly2-slides/) (150 slides).
|
45
|
+
|
46
|
+
If you're upgrading from an older Unpoly version you should load [`unpoly-migrate.js`](https://unpoly.com/changes/upgrading) to enable deprecated APIs. Also see below for an [overview of breaking changes](#overview-of-breaking-changes).
|
47
|
+
|
48
|
+
### Change overview
|
49
|
+
|
50
|
+
#### Less need for boilerplate configuration
|
51
|
+
|
52
|
+
- Fragment links often replace the primary content element of your application layout. For this purpose you can now define [default targets](/up-main) that are automatically updated when no target selector is given.
|
53
|
+
- Unpoly can be configured to [handle all links and forms](/handling-everything), without any `[up-...]` attributes.
|
54
|
+
- We have examined many real-world Unpoly apps for repetitive configuration and made these options the new default.
|
55
|
+
|
56
|
+
#### New Layer API
|
57
|
+
|
58
|
+
- A new [layer API](/up.layer) replaces modals and popups.
|
59
|
+
- Layers can be stacked infinitely.
|
60
|
+
- Layers are fully isolated, meaning a screen in one layer will not accidentally see elements or events from another layer. For instance, [fragment links](/up.link) will only update elements from the [current layer](/up.layer.current) unless you [explicitly target another layer](/layer-option).
|
61
|
+
- A variety of [overlay modes](/layer-terminology) are supported, such as modal dialogs, popup overlays or drawers. You may [customize their appearance and behavior](/customizing-overlays).
|
62
|
+
|
63
|
+
#### Subinteractions
|
64
|
+
|
65
|
+
- Overlays allow you to break up a complex screen into [subinteractions](/subinteractions).
|
66
|
+
- Subinteractions take place in overlays and may span one or many pages. The original screen remains open in the background.
|
67
|
+
- Once the subinteraction is *done*, the overlay is [closed](/closing-overlays) and a result value is communicated back to the parent layer.
|
68
|
+
|
69
|
+
#### Navigation intent
|
70
|
+
|
71
|
+
- You can now define whether a framgent update constitutes a user navigation. Switching screens needs other defaults than updating a tiny box.
|
72
|
+
- User navigation aborts earlier requests, fixing race conditions on slow connections.
|
73
|
+
|
74
|
+
#### Accessibility
|
75
|
+
|
76
|
+
- New overlays are focused automatically and trap focus in a cycle. Closing the overlay re-focuses the link that opened it.
|
77
|
+
- Focus is automatically managed when rendering major new content. A new [`[up-focus]` attribute](/focus-option) allows
|
78
|
+
you to explicitely move the user's focus as you update fragments.
|
79
|
+
- Keyboard navigation is supported everywhere.
|
80
|
+
- Focus, selection and scroll positions are preserved within an updated fragment.
|
81
|
+
|
82
|
+
#### Reworked Bootstrap integration
|
83
|
+
|
84
|
+
- The Bootstrap integration is now minimal and as unopinionated as possible. Little to no Bootstrap CSS is overridden.
|
85
|
+
- Bootstrap versions 3, 4 and 5 are now supported.
|
86
|
+
|
87
|
+
#### Quality of live improvements
|
88
|
+
|
89
|
+
- Unpoly now ships with a bandwidth-friendly [polling implementation](/up-poll) that handles many edge cases.
|
90
|
+
- The position of a clicked link is considered when deciding which element to replace. If possible, Unpoly will update an selector in the vicinity of the link that triggered the fragment update. This helps with multiple self-contained components (with the same selector) on the same page.
|
91
|
+
- The [log](/up.log) output is more much more compact and has a calmer formatting.
|
92
|
+
- New fragments are no longer revealed by default. Instead Unpoly scrolls to the top when the [main target](/up-main) has changed, but does not scroll otherwise.
|
93
|
+
- History is no longer changed by default. Instead Unpoly updates history only when a [main target](/up-main) has changed.
|
94
|
+
- All scroll-related options have been unified in a single [`[up-scroll]` attribute](/scroll-option).
|
95
|
+
- Many optimizations have been made to preserve bandwidth on slow connections. For example, Unpoly stops [preloading](/up-preload) and [polling](/up-poll) whenthe connection has high latency or low throughput.
|
96
|
+
- The client-side cache can be carefully managed by both the client and server.
|
97
|
+
- Unpoly 1 had many functions for updating fragments (`up.replace()`, `up.extract()`, `up.modal.extract()`, etc.). Unpoly 2 has unified these into a single function `up.render()`.
|
98
|
+
- Event handlers to `up:link:follow`, `up:form:submit` etc. may change the render options for the coming fragment update.
|
99
|
+
- Added more options to handle [unexpected server responses](/server-errors), including the new `up:fragment:loaded` event.
|
100
|
+
|
101
|
+
#### Extended server protocol
|
102
|
+
|
103
|
+
The optional server protocol has been extended with additional headers that the server may use to interact with the frontend. For example:
|
104
|
+
|
105
|
+
- The server may [emit events on the frontend](/X-Up-Events).
|
106
|
+
- The server may [close overlays](/X-Up-Accept).
|
107
|
+
- The server may [change the render target](/X-Up-Target) for a fragment update.
|
108
|
+
|
109
|
+
See `up.protocol` for a full list of features.
|
110
|
+
|
111
|
+
If you are using Ruby on Rails, the new protocol is already implemented by the [`unpoly-rails`](https://rubygems.org/gems/unpoly-rails) gem.
|
112
|
+
|
113
|
+
If you are using Elixir / Phoenix, the new protocol is already implemented by the [`ex_unpoly`](https://hex.pm/packages/ex_unpoly) package.
|
114
|
+
|
115
|
+
|
116
|
+
### Overview of breaking changes
|
117
|
+
|
118
|
+
Please use [`unpoly-migrate.js`](/changes/upgrading) for a very smooth upgrade process from Unpoly 0.x or 1.x to Unpoly 2.0.
|
119
|
+
|
120
|
+
By loading <code>unpoly-migrate.js</code>, calls to most old APIs will be forwarded to the new version. A deprecation notice will be logged to your browser console. This way you can upgrade Unpoly, revive your application with a few changes, then replace deprecated API calls under green tests.
|
121
|
+
|
122
|
+
There's a short list of changes that we cannot fix with aliases.
|
123
|
+
|
124
|
+
#### Overlays (modals, popups) have different HTML
|
125
|
+
|
126
|
+
But it's similar. E.g. `<div class="modal">` becomes `<up-modal>`.
|
127
|
+
|
128
|
+
#### Unpoly only sees the current layer
|
129
|
+
|
130
|
+
You can target other layers with `{ layer: 'any' }`.
|
131
|
+
|
132
|
+
#### Async functions no longer wait for animations
|
133
|
+
|
134
|
+
You might or might not notice. In cases where you absolutely do need to wait, an `{ onFinished }` callback can be used.
|
135
|
+
|
136
|
+
#### Tooltips are no longer built-in
|
137
|
+
|
138
|
+
But there are a million better libraries.
|
139
|
+
|
140
|
+
|
141
|
+
### Unpoly 1 maintenance
|
142
|
+
|
143
|
+
With the release of Unpoly we're ending maintenance of Unpoly 1. Expect little to no changes to Unpoly 1 in the future. GitHub issues that have been fixed in Unpoly 2 will be closed.
|
144
|
+
|
145
|
+
The legacy documentation for Unpoly 1.x has been archived to <https://v1.unpoly.com>.
|
146
|
+
|
60
147
|
|
61
148
|
|
62
149
|
1.0.0
|
63
150
|
-----
|
64
151
|
|
65
|
-
|
152
|
+
For six years Unpoly has been released under a 0.x version number. To establish the maturity and stability of the project, we're releasing today's version as 1.0.0.
|
153
|
+
|
154
|
+
There are only three changes from 0.62.1:
|
155
|
+
|
156
|
+
- Fix a bug where `up.util.escapeHTML()`` would not escape single quotes.
|
157
|
+
- Unpoly will no longer wait a JavaScript execution task to boot after `DOMContentLoaded`. This may improve the stability of test suites that previously interacted with the page too soon.
|
158
|
+
- You may now disable the Unpoly banner in the development console with `up.log.config.banner = false`. (change by @hfjallemark).
|
159
|
+
|
160
|
+
This is the last release of the 0.x API line. We're tracking its code in the [`1.x-stable`](https://github.com/unpoly/unpoly/tree/1.x-stable), but expect little to no changes in the future.
|
66
161
|
|
162
|
+
The next release will be [Unpoly 2](https://triskweline.de/unpoly2-slides). It will include major (but mostly backwards compatible) renovations to its API, unlocking many use cases that were not possible with Unpoly 1.
|
67
163
|
|
68
164
|
|
69
165
|
0.62.1
|
data/README.md
CHANGED
@@ -14,7 +14,8 @@ If you're looking for the code of Unpoly 0.x or 1.0, use the [`1.x-stable`](http
|
|
14
14
|
Getting started
|
15
15
|
---------------
|
16
16
|
|
17
|
-
- See [unpoly.com](https://unpoly.com) for
|
17
|
+
- See [unpoly.com](https://unpoly.com) for guides and documentation.
|
18
|
+
- See [installation instructions](https://unpoly.com/install) for many different package managers and languages.
|
18
19
|
- See [`CHANGELOG.md`](https://github.com/unpoly/unpoly/blob/master/CHANGELOG.md) for notable changes.
|
19
20
|
- See [`README_RAILS.md`](https://github.com/unpoly/unpoly/blob/master/README_RAILS.md) documentation of the Rails bindings.
|
20
21
|
|
data/dist/unpoly-migrate.js
CHANGED
@@ -73,7 +73,7 @@
|
|
73
73
|
formattedMessage = u.sprintf.apply(u, [message].concat(slice.call(args)));
|
74
74
|
if (!warnedMessages[formattedMessage]) {
|
75
75
|
warnedMessages[formattedMessage] = true;
|
76
|
-
return (ref = up.log)[config.logLevel].apply(ref, ['
|
76
|
+
return (ref = up.log)[config.logLevel].apply(ref, ['unpoly-migrate', message].concat(slice.call(args)));
|
77
77
|
}
|
78
78
|
};
|
79
79
|
deprecated = function(deprecatedExpression, replacementExpression) {
|
@@ -300,6 +300,43 @@ Returns the first descendant element matching the given selector.
|
|
300
300
|
return !event.defaultPrevented;
|
301
301
|
};
|
302
302
|
|
303
|
+
}).call(this);
|
304
|
+
(function() {
|
305
|
+
var e, u;
|
306
|
+
|
307
|
+
u = up.util;
|
308
|
+
|
309
|
+
e = up.element;
|
310
|
+
|
311
|
+
up.migrate.postCompile = function(elements, compiler) {
|
312
|
+
var element, i, keepValue, len, results, value;
|
313
|
+
if (keepValue = compiler.keep) {
|
314
|
+
up.migrate.warn('The { keep: true } option for up.compiler() has been removed. Have the compiler set [up-keep] attribute instead.');
|
315
|
+
value = u.isString(keepValue) ? keepValue : '';
|
316
|
+
results = [];
|
317
|
+
for (i = 0, len = elements.length; i < len; i++) {
|
318
|
+
element = elements[i];
|
319
|
+
results.push(element.setAttribute('up-keep', value));
|
320
|
+
}
|
321
|
+
return results;
|
322
|
+
}
|
323
|
+
};
|
324
|
+
|
325
|
+
up.migrate.targetMacro = function(queryAttr, fixedResultAttrs, callback) {
|
326
|
+
return up.macro("[" + queryAttr + "]", function(link) {
|
327
|
+
var optionalTarget, resultAttrs;
|
328
|
+
resultAttrs = u.copy(fixedResultAttrs);
|
329
|
+
if (optionalTarget = link.getAttribute(queryAttr)) {
|
330
|
+
resultAttrs['up-target'] = optionalTarget;
|
331
|
+
} else {
|
332
|
+
resultAttrs['up-follow'] = '';
|
333
|
+
}
|
334
|
+
e.setMissingAttrs(link, resultAttrs);
|
335
|
+
link.removeAttribute(queryAttr);
|
336
|
+
return typeof callback === "function" ? callback() : void 0;
|
337
|
+
});
|
338
|
+
};
|
339
|
+
|
303
340
|
}).call(this);
|
304
341
|
|
305
342
|
/***
|
@@ -476,7 +513,7 @@ Returns the first descendant element matching the given selector.
|
|
476
513
|
}
|
477
514
|
};
|
478
515
|
|
479
|
-
up.migrate.
|
516
|
+
up.migrate.preprocessRenderOptions = function(options) {
|
480
517
|
var i, len, prop, ref, results;
|
481
518
|
up.migrate.handleHistoryOption(options);
|
482
519
|
ref = ['target', 'origin'];
|
@@ -538,6 +575,11 @@ Returns the first descendant element matching the given selector.
|
|
538
575
|
up.migrate.renamedProperty(up.feedback.config, 'navs', 'navSelectors');
|
539
576
|
|
540
577
|
}).call(this);
|
578
|
+
|
579
|
+
/***
|
580
|
+
@module up.link
|
581
|
+
*/
|
582
|
+
|
541
583
|
(function() {
|
542
584
|
up.migrate.parseFollowOptions = function(parser) {
|
543
585
|
parser.string('flavor');
|
@@ -546,9 +588,46 @@ Returns the first descendant element matching the given selector.
|
|
546
588
|
parser.boolean('closable');
|
547
589
|
parser.booleanOrString('reveal');
|
548
590
|
parser.boolean('resetScroll');
|
549
|
-
|
591
|
+
parser.boolean('restoreScroll');
|
592
|
+
return parser.booleanOrString('historyVisible');
|
550
593
|
};
|
551
594
|
|
595
|
+
|
596
|
+
/***
|
597
|
+
[Follows](/up.follow) this link as fast as possible.
|
598
|
+
|
599
|
+
This is done by:
|
600
|
+
|
601
|
+
- [Following the link through AJAX](/a-up-follow) instead of a full page load
|
602
|
+
- [Preloading the link's destination URL](/a-up-preload)
|
603
|
+
- [Triggering the link on `mousedown`](/a-up-instant) instead of on `click`
|
604
|
+
|
605
|
+
\#\#\# Example
|
606
|
+
|
607
|
+
Use `[up-dash]` like this:
|
608
|
+
|
609
|
+
<a href="/users" up-dash=".main">User list</a>
|
610
|
+
|
611
|
+
This is shorthand for:
|
612
|
+
|
613
|
+
<a href="/users" up-target=".main" up-instant up-preload>User list</a>
|
614
|
+
|
615
|
+
@selector a[up-dash]
|
616
|
+
@param [up-dash='body']
|
617
|
+
The CSS selector to replace
|
618
|
+
|
619
|
+
Inside the CSS selector you may refer to this link as `&` ([like in Sass](https://sass-lang.com/documentation/file.SASS_REFERENCE.html#parent-selector)).
|
620
|
+
@deprecated
|
621
|
+
To accelerate all links use `up.link.config.instantSelectors` and `up.link.config.preloadSelectors`.
|
622
|
+
*/
|
623
|
+
|
624
|
+
up.migrate.targetMacro('up-dash', {
|
625
|
+
'up-preload': '',
|
626
|
+
'up-instant': ''
|
627
|
+
}, function() {
|
628
|
+
return up.migrate.deprecated('a[up-dash]', 'up.link.config.instantSelectors or up.link.config.preloadSelectors');
|
629
|
+
});
|
630
|
+
|
552
631
|
}).call(this);
|
553
632
|
|
554
633
|
/***
|
@@ -623,9 +702,14 @@ Returns the first descendant element matching the given selector.
|
|
623
702
|
};
|
624
703
|
|
625
704
|
up.migrate.handleLayerConfig = function(config) {
|
626
|
-
return up.migrate.fixKey(config, '
|
705
|
+
return up.migrate.fixKey(config, 'historyVisible', 'history');
|
627
706
|
};
|
628
707
|
|
708
|
+
up.util.getter(up.Layer.prototype, 'historyVisible', function() {
|
709
|
+
up.migrate.deprecated('up.Layer#historyVisible', 'up.Layer#history');
|
710
|
+
return this.history;
|
711
|
+
});
|
712
|
+
|
629
713
|
}).call(this);
|
630
714
|
|
631
715
|
/***
|
@@ -826,10 +910,10 @@ Returns the first descendant element matching the given selector.
|
|
826
910
|
@param {string} up-modal
|
827
911
|
The CSS selector that will be extracted from the response and displayed in a modal dialog.
|
828
912
|
@deprecated
|
829
|
-
Use `a[up-layer=modal]` instead.
|
913
|
+
Use `a[up-layer="new modal"]` instead.
|
830
914
|
*/
|
831
915
|
|
832
|
-
up.
|
916
|
+
up.migrate.targetMacro('up-modal', {
|
833
917
|
'up-layer': 'new modal'
|
834
918
|
}, function() {
|
835
919
|
return up.migrate.deprecated('a[up-modal]', 'a[up-layer="new modal"]');
|
@@ -846,16 +930,21 @@ Returns the first descendant element matching the given selector.
|
|
846
930
|
@param {string} up-drawer
|
847
931
|
The CSS selector that will be extracted from the response and displayed in a modal dialog.
|
848
932
|
@deprecated
|
849
|
-
Use `a[up-layer=drawer]` instead.
|
933
|
+
Use `a[up-layer="new drawer"]` instead.
|
850
934
|
*/
|
851
935
|
|
852
|
-
up.
|
936
|
+
up.migrate.targetMacro('up-drawer', {
|
853
937
|
'up-layer': 'new drawer'
|
854
938
|
}, function() {
|
855
939
|
return up.migrate.deprecated('a[up-drawer]', 'a[up-layer="new drawer"]');
|
856
940
|
});
|
857
941
|
|
858
942
|
}).call(this);
|
943
|
+
|
944
|
+
/***
|
945
|
+
@module up.layer
|
946
|
+
*/
|
947
|
+
|
859
948
|
(function() {
|
860
949
|
var e, u;
|
861
950
|
|
@@ -987,7 +1076,7 @@ Returns the first descendant element matching the given selector.
|
|
987
1076
|
|
988
1077
|
up.migrate.renamedEvent('up:popup:closed', 'up:layer:dismissed');
|
989
1078
|
|
990
|
-
up.
|
1079
|
+
up.migrate.targetMacro('up-popup', {
|
991
1080
|
'up-layer': 'new popup'
|
992
1081
|
}, function() {
|
993
1082
|
return up.migrate.deprecated('[up-popup]', '[up-layer="new popup"]');
|
@@ -1015,7 +1104,7 @@ This feature is now deprecated.
|
|
1015
1104
|
|
1016
1105
|
}).call(this);
|
1017
1106
|
(function() {
|
1018
|
-
var preloadDelayMoved, u,
|
1107
|
+
var disableProgressBarIfCustomIndicator, mayHaveCustomIndicator, preloadDelayMoved, progressBarDefault, u,
|
1019
1108
|
slice = [].slice;
|
1020
1109
|
|
1021
1110
|
u = up.util;
|
@@ -1060,15 +1149,6 @@ This feature is now deprecated.
|
|
1060
1149
|
|
1061
1150
|
up.migrate.renamedProperty(up.network.config, 'slowDelay', 'badResponseTime');
|
1062
1151
|
|
1063
|
-
up.migrate.handleNetworkPreloadArgs = function() {
|
1064
|
-
var args, ref;
|
1065
|
-
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
1066
|
-
if (u.isElementish(args[0])) {
|
1067
|
-
up.migrate.warn('up.proxy.preload(link) has been renamed to up.link.preload(link)');
|
1068
|
-
return (ref = up.link).preload.apply(ref, args);
|
1069
|
-
}
|
1070
|
-
};
|
1071
|
-
|
1072
1152
|
up.migrate.handleRequestOptions = function(options) {
|
1073
1153
|
return up.migrate.fixKey(options, 'data', 'params');
|
1074
1154
|
};
|
@@ -1081,11 +1161,13 @@ This feature is now deprecated.
|
|
1081
1161
|
|
1082
1162
|
\#\#\# Example
|
1083
1163
|
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1164
|
+
```
|
1165
|
+
up.ajax('/search', { params: { query: 'sunshine' } }).then(function(text) {
|
1166
|
+
console.log('The response text is %o', text)
|
1167
|
+
}).catch(function() {
|
1168
|
+
console.error('The request failed')
|
1169
|
+
})
|
1170
|
+
```
|
1089
1171
|
|
1090
1172
|
@function up.ajax
|
1091
1173
|
@param {string} [url]
|
@@ -1124,6 +1206,13 @@ This feature is now deprecated.
|
|
1124
1206
|
return up.cache.clear();
|
1125
1207
|
};
|
1126
1208
|
|
1209
|
+
up.network.preload = function() {
|
1210
|
+
var args, ref;
|
1211
|
+
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
1212
|
+
up.migrate.deprecated('up.proxy.preload(link)', 'up.link.preload(link)');
|
1213
|
+
return (ref = up.link).preload.apply(ref, args);
|
1214
|
+
};
|
1215
|
+
|
1127
1216
|
|
1128
1217
|
/***
|
1129
1218
|
@class up.Request
|
@@ -1169,6 +1258,31 @@ This feature is now deprecated.
|
|
1169
1258
|
return !this.ok;
|
1170
1259
|
};
|
1171
1260
|
|
1261
|
+
mayHaveCustomIndicator = function() {
|
1262
|
+
var listeners;
|
1263
|
+
listeners = up.EventListener.allNonDefault(document);
|
1264
|
+
return u.find(listeners, function(listener) {
|
1265
|
+
return listener.eventType === 'up:request:late';
|
1266
|
+
});
|
1267
|
+
};
|
1268
|
+
|
1269
|
+
progressBarDefault = up.network.config.progressBar;
|
1270
|
+
|
1271
|
+
disableProgressBarIfCustomIndicator = function() {
|
1272
|
+
return up.network.config.progressBar = function() {
|
1273
|
+
if (mayHaveCustomIndicator()) {
|
1274
|
+
up.migrate.warn('Disabled the default progress bar as may have built a custom loading indicator with your up:request:late listener. Please set up.network.config.progressBar to true or false.');
|
1275
|
+
return false;
|
1276
|
+
} else {
|
1277
|
+
return progressBarDefault;
|
1278
|
+
}
|
1279
|
+
};
|
1280
|
+
};
|
1281
|
+
|
1282
|
+
disableProgressBarIfCustomIndicator();
|
1283
|
+
|
1284
|
+
up.on('up:framework:reset', disableProgressBarIfCustomIndicator);
|
1285
|
+
|
1172
1286
|
}).call(this);
|
1173
1287
|
|
1174
1288
|
/***
|