unpoly-rails 2.0.1 → 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 +18 -0
- data/README.md +2 -1
- data/dist/unpoly-migrate.js +36 -5
- data/dist/unpoly-migrate.min.js +1 -1
- data/dist/unpoly.css +8 -0
- data/dist/unpoly.js +244 -118
- data/dist/unpoly.min.css +1 -1
- data/dist/unpoly.min.js +6 -6
- 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: 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
@@ -8,6 +8,24 @@ If you're upgrading from an older Unpoly version you should load [`unpoly-migrat
|
|
8
8
|
You may browse a formatted and hyperlinked version of this file at <https://unpoly.com/changes>.
|
9
9
|
|
10
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
|
+
|
11
29
|
2.0.1
|
12
30
|
-----
|
13
31
|
|
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) {
|
@@ -513,7 +513,7 @@ Returns the first descendant element matching the given selector.
|
|
513
513
|
}
|
514
514
|
};
|
515
515
|
|
516
|
-
up.migrate.
|
516
|
+
up.migrate.preprocessRenderOptions = function(options) {
|
517
517
|
var i, len, prop, ref, results;
|
518
518
|
up.migrate.handleHistoryOption(options);
|
519
519
|
ref = ['target', 'origin'];
|
@@ -588,7 +588,8 @@ Returns the first descendant element matching the given selector.
|
|
588
588
|
parser.boolean('closable');
|
589
589
|
parser.booleanOrString('reveal');
|
590
590
|
parser.boolean('resetScroll');
|
591
|
-
|
591
|
+
parser.boolean('restoreScroll');
|
592
|
+
return parser.booleanOrString('historyVisible');
|
592
593
|
};
|
593
594
|
|
594
595
|
|
@@ -701,9 +702,14 @@ Returns the first descendant element matching the given selector.
|
|
701
702
|
};
|
702
703
|
|
703
704
|
up.migrate.handleLayerConfig = function(config) {
|
704
|
-
return up.migrate.fixKey(config, '
|
705
|
+
return up.migrate.fixKey(config, 'historyVisible', 'history');
|
705
706
|
};
|
706
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
|
+
|
707
713
|
}).call(this);
|
708
714
|
|
709
715
|
/***
|
@@ -1098,7 +1104,7 @@ This feature is now deprecated.
|
|
1098
1104
|
|
1099
1105
|
}).call(this);
|
1100
1106
|
(function() {
|
1101
|
-
var preloadDelayMoved, u,
|
1107
|
+
var disableProgressBarIfCustomIndicator, mayHaveCustomIndicator, preloadDelayMoved, progressBarDefault, u,
|
1102
1108
|
slice = [].slice;
|
1103
1109
|
|
1104
1110
|
u = up.util;
|
@@ -1252,6 +1258,31 @@ This feature is now deprecated.
|
|
1252
1258
|
return !this.ok;
|
1253
1259
|
};
|
1254
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
|
+
|
1255
1286
|
}).call(this);
|
1256
1287
|
|
1257
1288
|
/***
|
data/dist/unpoly-migrate.min.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
(function(){up.framework.startExtension()}).call(this),function(){var u,p,e,t,r,a,n,i,o,l,c,s,d,m,g=[].slice;u=up.util,up.migrate=(p=new up.Config(function(){return{logLevel:"warn"}}),c=function(e,t,r){var a;return a=function(){return d("Property { %s } has been renamed to { %s } (found in %o)",t,r,e)},Object.defineProperty(e,t,{get:function(){return a(),this[r]},set:function(e){return a(),this[r]=e}})},a=function(e,t,r){if(u.isDefined(e[t]))return d("Property { %s } has been renamed to { %s } (found in %o)",t,r,e),u.renameKey(e,t,r)},o={},i=function(e,t){return o[e]=t},t=function(e){var t;return(t=o[e])?(d("Event "+e+" has been renamed to "+t),t):e},r=function(e){return u.uniq(u.map(e,t))},l=function(e,t){return Object.defineProperty(up,e,{get:function(){return d("up."+e+" has been renamed to up."+t),up[t]}})},m={},d=function(e){var t,r,a,n;if(a=e,t=2<=arguments.length?g.call(arguments,1):[],r=u.sprintf.apply(u,[a].concat(g.call(t))),!m[r])return m[r]=!0,(n=up.log)[p.logLevel].apply(n,["DEPRECATION",a].concat(g.call(t)))},e=function(e,t){return d(e+" has been deprecated. Use "+t+" instead.")},n=function(e){var t,r;return r=Promise.resolve(),t=r.then,r.then=function(){return d(e+" is now a sync function"),t.apply(this,arguments)},r},s=function(){return p.reset()},up.on("up:framework:reset",s),{deprecated:e,renamedPackage:l,renamedProperty:c,formerlyAsync:n,renamedEvent:i,fixEventTypes:r,fixKey:a,warn:d,loaded:!0,config:p})}.call(this),function(){var a=[].slice;up.util.only=function(e){var t,r;return r=e,t=2<=arguments.length?a.call(arguments,1):[],up.migrate.deprecated("up.util.only(object, ...keys)","up.util.pick(object, keys)"),up.util.pick(r,t)},up.util.except=function(e){var t,r;return r=e,t=2<=arguments.length?a.call(arguments,1):[],up.migrate.deprecated("up.util.except(object, ...keys)","up.util.omit(object, keys)"),up.util.omit(r,t)},up.util.parseUrl=function(){var e,t;return e=1<=arguments.length?a.call(arguments,0):[],up.migrate.warn("up.util.parseUrl() has been renamed to up.util.parseURL()"),(t=up.util).parseURL.apply(t,e)},up.util.any=function(){var e;return e=1<=arguments.length?a.call(arguments,0):[],up.migrate.warn("up.util.any() has been renamed to up.util.some()"),some.apply(null,e)},up.util.all=function(){var e,t;return e=1<=arguments.length?a.call(arguments,0):[],up.migrate.warn("up.util.all() has been renamed to up.util.every()"),(t=up.util).every.apply(t,e)},up.util.detect=function(){var e,t;return e=1<=arguments.length?a.call(arguments,0):[],up.migrate.warn("up.util.detect() has been renamed to up.util.find()"),(t=up.util).find.apply(t,e)},up.util.select=function(){var e,t;return e=1<=arguments.length?a.call(arguments,0):[],up.migrate.warn("up.util.select() has been renamed to up.util.filter()"),(t=up.util).filter.apply(t,e)},up.util.setTimer=function(){var e,t;return e=1<=arguments.length?a.call(arguments,0):[],up.migrate.warn("up.util.setTimer() has been renamed to up.util.timer()"),(t=up.util).timer.apply(t,e)},up.util.escapeHtml=function(){var e,t;return e=1<=arguments.length?a.call(arguments,0):[],up.migrate.deprecated("up.util.escapeHtml","up.util.escapeHTML"),(t=up.util).escapeHTML.apply(t,e)},up.util.selectorForElement=function(){var e,t;return e=1<=arguments.length?a.call(arguments,0):[],up.migrate.warn("up.util.selectorForElement() has been renamed to up.fragment.toTarget()"),(t=up.fragment).toTarget.apply(t,e)},up.util.nextFrame=function(){var e,t;return e=1<=arguments.length?a.call(arguments,0):[],up.migrate.warn("up.util.nextFrame() has been renamed to up.util.task()"),(t=up.util).task.apply(t,e)}}.call(this),function(){var r=[].slice;up.element.first=function(){var e,t;return e=1<=arguments.length?r.call(arguments,0):[],up.migrate.deprecated("up.element.first()","up.element.get()"),(t=up.element).get.apply(t,e)},up.element.createFromHtml=function(){var e,t;return e=1<=arguments.length?r.call(arguments,0):[],up.migrate.deprecated("up.element.createFromHtml","up.element.createFromHTML"),(t=up.element).createFromHTML.apply(t,e)}}.call(this),function(){var t=[].slice;up.migrate.renamedPackage("bus","event"),up.event.nobodyPrevents=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],up.migrate.deprecated("up.event.nobodyPrevents(type)","!up.emit(type).defaultPrevented"),!up.emit.apply(up,e).defaultPrevented}}.call(this),function(){var p,o;o=up.util,p=up.element,up.migrate.postCompile=function(e,t){var r,a,n,u,p,i;if(n=t.keep){for(up.migrate.warn("The { keep: true } option for up.compiler() has been removed. Have the compiler set [up-keep] attribute instead."),i=o.isString(n)?n:"",p=[],a=0,u=e.length;a<u;a++)r=e[a],p.push(r.setAttribute("up-keep",i));return p}},up.migrate.targetMacro=function(a,n,u){return up.macro("["+a+"]",function(e){var t,r;return r=o.copy(n),(t=e.getAttribute(a))?r["up-target"]=t:r["up-follow"]="",p.setMissingAttrs(e,r),e.removeAttribute(a),"function"==typeof u?u():void 0})}}.call(this),function(){up.migrate.renamedProperty(up.form.config,"fields","fieldSelectors"),up.migrate.renamedProperty(up.form.config,"submitButtons","submitButtonSelectors")}.call(this),function(){var p,r=[].slice;p=up.util,up.migrate.renamedPackage("flow","fragment"),up.migrate.renamedPackage("dom","fragment"),up.migrate.renamedProperty(up.fragment.config,"fallbacks","mainTargets"),up.migrate.handleResponseDocOptions=function(e){return up.migrate.fixKey(e,"html","document")},up.replace=function(e,t,r){return up.migrate.deprecated("up.replace(target, url)","up.navigate(target, { url })"),up.navigate(p.merge(r,{target:e,url:t}))},up.extract=function(e,t,r){return up.migrate.deprecated("up.extract(target, document)","up.navigate(target, { document })"),up.navigate(p.merge(r,{target:e,document:t}))},up.fragment.first=function(){var e,t;return e=1<=arguments.length?r.call(arguments,0):[],up.migrate.deprecated("up.fragment.first()","up.fragment.get()"),(t=up.fragment).get.apply(t,e)},up.first=up.fragment.first,up.migrate.handleScrollOptions=function(e){if(p.isUndefined(e.scroll)&&(p.isString(e.reveal)?(up.migrate.deprecated("Option { reveal: '"+e.reveal+"' }","{ scroll: '"+e.reveal+"' }"),e.scroll=e.reveal):!0===e.reveal?(up.migrate.deprecated("Option { reveal: true }","{ scroll: 'target' }"),e.scroll="target"):!1===e.reveal&&(up.migrate.deprecated("Option { reveal: false }","{ scroll: false }"),e.scroll=!1),p.isDefined(e.resetScroll)&&(up.migrate.deprecated("Option { resetScroll: true }","{ scroll: 'reset' }"),e.scroll="teset"),p.isDefined(e.restoreScroll)))return up.migrate.deprecated("Option { restoreScroll: true }","{ scroll: 'restore' }"),e.scroll="restore"},up.migrate.handleHistoryOption=function(e){if(p.isString(e.history)&&"auto"!==e.history)return up.migrate.warn("Passing a URL as { history } option is deprecated. Pass it as { location } instead."),e.location=e.history,e.history="auto"},up.migrate.handleRenderOptions=function(e){var t,r,a,n,u;for(up.migrate.handleHistoryOption(e),u=[],t=0,r=(n=["target","origin"]).length;t<r;t++)a=n[t],p.isJQuery(e[a])?(up.migrate.warn("Passing a jQuery collection as { %s } is deprecated. Pass it as a native element instead.",a),u.push(e[a]=up.element.get(e[a]))):u.push(void 0);return u}}.call(this),function(){up.migrate.renamedProperty(up.history.config,"popTargets","restoreTargets"),up.history.url=function(){return up.migrate.deprecated("up.history.url()","up.history.location"),up.history.location},up.migrate.renamedEvent("up:history:push","up:location:changed"),up.migrate.renamedEvent("up:history:pushed","up:location:changed"),up.migrate.renamedEvent("up:history:restore","up:location:changed"),up.migrate.renamedEvent("up:history:restored","up:location:changed"),up.migrate.renamedEvent("up:history:replaced","up:location:changed")}.call(this),function(){up.migrate.renamedPackage("navigation","feedback"),up.migrate.renamedProperty(up.feedback.config,"navs","navSelectors")}.call(this),function(){up.migrate.parseFollowOptions=function(e){return e.string("flavor"),e.string("width"),e.string("height"),e["boolean"]("closable"),e.booleanOrString("reveal"),e["boolean"]("resetScroll"),e["boolean"]("restoreScroll")},up.migrate.targetMacro("up-dash",{"up-preload":"","up-instant":""},function(){return up.migrate.deprecated("a[up-dash]","up.link.config.instantSelectors or up.link.config.preloadSelectors")})}.call(this),function(){up.migrate.handleLayerOptions=function(e){var t,r,a,n;for(up.migrate.fixKey(e,"flavor","mode"),up.migrate.fixKey(e,"closable","dismissable"),up.migrate.fixKey(e,"closeLabel","dismissLabel"),r=0,a=(n=["width","maxWidth","height"]).length;r<a;r++)e[t=n[r]]&&up.migrate.warn("Layer option { "+t+" } has been removed. Use { size } or { class } instead.");if(e.sticky&&up.migrate.warn("Layer option { sticky } has been removed. Give links an [up-peel=false] attribute to prevent layer dismissal on click."),e.template&&up.migrate.warn("Layer option { template } has been removed. Use { class } or modify the layer HTML on up:layer:open."),"page"===e.layer&&(up.migrate.warn("Option { layer: 'page' } has been renamed to { layer: 'root' }."),e.layer="root"),"modal"===e.layer||"popup"===e.layer)return up.migrate.warn("Option { layer: '"+e.layer+"' } has been removed. Did you mean { layer: 'overlay' }?"),e.layer="overlay"},up.migrate.handleTetherOptions=function(e){var t,r,a;if(r=(a=e.position.split("-"))[0],t=a[1])return up.migrate.warn("The position value %o is deprecated. Use %o instead.",e.position,{position:r,align:t}),e.position=r,e.align=t},up.migrate.registerLayerCloser=function(r){return r.registerClickCloser("up-close",function(e,t){return up.migrate.deprecated("[up-close]","[up-dismiss]"),r.dismiss(e,t)})},up.migrate.handleLayerConfig=function(e){return up.migrate.fixKey(e,"history","historyVisible")}}.call(this),function(){var e,a;a=up.util,e=new Error("up.modal.flavors has been removed without direct replacement. You may give new layers a { class } or modify layer elements on up:layer:open."),up.modal=a.literal({visit:function(e,t){return null==t&&(t={}),up.migrate.deprecated("up.modal.visit(url)",'up.layer.open({ url, mode: "modal" })'),up.layer.open(a.merge(t,{url:e,mode:"modal"}))},follow:function(e,t){return null==t&&(t={}),up.migrate.deprecated("up.modal.follow(link)",'up.follow(link, { layer: "modal" })'),up.follow(e,a.merge(t,{layer:"modal"}))},extract:function(e,t,r){return null==r&&(r={}),up.migrate.deprecated("up.modal.extract(target, document)",'up.layer.open({ document, mode: "modal" })'),up.layer.open(a.merge(r,{target:e,html:t,layer:"modal"}))},close:function(e){return null==e&&(e={}),up.migrate.deprecated("up.modal.close()","up.layer.dismiss()"),up.layer.dismiss(null,e),up.migrate.formerlyAsync("up.layer.dismiss()")},url:function(){return up.migrate.deprecated("up.modal.url()","up.layer.location"),up.layer.location},coveredUrl:function(){var e;return up.migrate.deprecated("up.modal.coveredUrl()","up.layer.parent.location"),null!=(e=up.layer.parent)?e.location:void 0},get_config:function(){return up.migrate.deprecated("up.modal.config","up.layer.config.modal"),up.layer.config.modal},contains:function(e){return up.migrate.deprecated("up.modal.contains()","up.layer.contains()"),up.layer.contains(e)},isOpen:function(){return up.migrate.deprecated("up.modal.isOpen()","up.layer.isOverlay()"),up.layer.isOverlay()},get_flavors:function(){throw e},flavor:function(){throw e}}),up.migrate.renamedEvent("up:modal:open","up:layer:open"),up.migrate.renamedEvent("up:modal:opened","up:layer:opened"),up.migrate.renamedEvent("up:modal:close","up:layer:dismiss"),up.migrate.renamedEvent("up:modal:closed","up:layer:dismissed"),up.migrate.targetMacro("up-modal",{"up-layer":"new modal"},function(){return up.migrate.deprecated("a[up-modal]",'a[up-layer="new modal"]')}),up.migrate.targetMacro("up-drawer",{"up-layer":"new drawer"},function(){return up.migrate.deprecated("a[up-drawer]",'a[up-layer="new drawer"]')})}.call(this),function(){var r;r=up.util,up.element,up.popup=r.literal({attach:function(e,t){return null==t&&(t={}),e=up.fragment.get(e),up.migrate.deprecated("up.popup.attach(origin)","up.layer.open({ origin, layer: 'popup' })"),up.layer.open(r.merge(t,{origin:e,layer:"popup"}))},close:function(e){return null==e&&(e={}),up.migrate.deprecated("up.popup.close()","up.layer.dismiss()"),up.layer.dismiss(null,e)},url:function(){return up.migrate.deprecated("up.popup.url()","up.layer.location"),up.layer.location},coveredUrl:function(){var e;return up.migrate.deprecated("up.popup.coveredUrl()","up.layer.parent.location"),null!=(e=up.layer.parent)?e.location:void 0},get_config:function(){return up.migrate.deprecated("up.popup.config","up.layer.config.popup"),up.layer.config.popup},contains:function(e){return up.migrate.deprecated("up.popup.contains()","up.layer.contains()"),up.layer.contains(e)},isOpen:function(){return up.migrate.deprecated("up.popup.isOpen()","up.layer.isOverlay()"),up.layer.isOverlay()},sync:function(){return up.migrate.deprecated("up.popup.sync()","up.layer.sync()"),up.layer.sync()}}),up.migrate.renamedEvent("up:popup:open","up:layer:open"),up.migrate.renamedEvent("up:popup:opened","up:layer:opened"),up.migrate.renamedEvent("up:popup:close","up:layer:dismiss"),up.migrate.renamedEvent("up:popup:closed","up:layer:dismissed"),up.migrate.targetMacro("up-popup",{"up-layer":"new popup"},function(){return up.migrate.deprecated("[up-popup]",'[up-layer="new popup"]')})}.call(this),function(){up.tooltip=up.macro("[up-tooltip]",function(e){return up.migrate.warn("[up-tooltip] has been deprecated. A [title] was set instead."),up.element.setMissingAttr(e,"title",e.getAttribute("up-tooltip"))})}.call(this),function(){var t,r=[].slice;up.util,up.migrate.renamedPackage("proxy","network"),up.migrate.renamedEvent("up:proxy:load","up:request:load"),up.migrate.renamedEvent("up:proxy:received","up:request:loaded"),up.migrate.renamedEvent("up:proxy:loaded","up:request:loaded"),up.migrate.renamedEvent("up:proxy:fatal","up:request:fatal"),up.migrate.renamedEvent("up:proxy:aborted","up:request:aborted"),up.migrate.renamedEvent("up:proxy:slow","up:request:late"),up.migrate.renamedEvent("up:proxy:recover","up:request:recover"),t=function(){return up.migrate.deprecated("up.proxy.config.preloadDelay","up.link.config.preloadDelay")},Object.defineProperty(up.network.config,"preloadDelay",{get:function(){return t(),up.link.config.preloadDelay},set:function(e){return t(),up.link.config.preloadDelay=e}}),up.migrate.renamedProperty(up.network.config,"maxRequests","concurrency"),up.migrate.renamedProperty(up.network.config,"slowDelay","badResponseTime"),up.migrate.handleRequestOptions=function(e){return up.migrate.fixKey(e,"data","params")},up.ajax=function(){var e,t;return e=1<=arguments.length?r.call(arguments,0):[],up.migrate.deprecated("up.ajax()","up.request()"),t=function(e){return e.text},up.request.apply(up,e).then(t)},up.network.clear=function(){return up.migrate.deprecated("up.proxy.clear()","up.cache.clear()"),up.cache.clear()},up.network.preload=function(){var e,t;return e=1<=arguments.length?r.call(arguments,0):[],up.migrate.deprecated("up.proxy.preload(link)","up.link.preload(link)"),(t=up.link).preload.apply(t,e)},up.Request.prototype.navigate=function(){return up.migrate.deprecated("up.Request#navigate()","up.Request#loadPage()"),this.loadPage()},up.Response.prototype.isSuccess=function(){return up.migrate.deprecated("up.Response#isSuccess()","up.Response#ok"),this.ok},up.Response.prototype.isError=function(){return up.migrate.deprecated("up.Response#isError()","!up.Response#ok"),!this.ok}}.call(this),function(){up.migrate.renamedProperty(up.radio.config,"hungry","hungrySelectors")}.call(this),function(){var r=[].slice;up.migrate.renamedPackage("layout","viewport"),up.migrate.renamedProperty(up.viewport.config,"viewports","viewportSelectors"),up.migrate.renamedProperty(up.viewport.config,"snap","revealSnap"),up.viewport.closest=function(){var e,t;return e=1<=arguments.length?r.call(arguments,0):[],up.migrate.deprecated("up.viewport.closest()","up.viewport.get()"),(t=up.viewport).get.apply(t,e)}}.call(this),function(){up.framework.stopExtension()}.call(this),function(){}.call(this);
|
1
|
+
(function(){up.framework.startExtension()}).call(this),function(){var u,p,e,t,r,a,n,i,o,l,c,s,d,m,g=[].slice;u=up.util,up.migrate=(p=new up.Config(function(){return{logLevel:"warn"}}),c=function(e,t,r){var a;return a=function(){return d("Property { %s } has been renamed to { %s } (found in %o)",t,r,e)},Object.defineProperty(e,t,{get:function(){return a(),this[r]},set:function(e){return a(),this[r]=e}})},a=function(e,t,r){if(u.isDefined(e[t]))return d("Property { %s } has been renamed to { %s } (found in %o)",t,r,e),u.renameKey(e,t,r)},o={},i=function(e,t){return o[e]=t},t=function(e){var t;return(t=o[e])?(d("Event "+e+" has been renamed to "+t),t):e},r=function(e){return u.uniq(u.map(e,t))},l=function(e,t){return Object.defineProperty(up,e,{get:function(){return d("up."+e+" has been renamed to up."+t),up[t]}})},m={},d=function(e){var t,r,a,n;if(a=e,t=2<=arguments.length?g.call(arguments,1):[],r=u.sprintf.apply(u,[a].concat(g.call(t))),!m[r])return m[r]=!0,(n=up.log)[p.logLevel].apply(n,["unpoly-migrate",a].concat(g.call(t)))},e=function(e,t){return d(e+" has been deprecated. Use "+t+" instead.")},n=function(e){var t,r;return r=Promise.resolve(),t=r.then,r.then=function(){return d(e+" is now a sync function"),t.apply(this,arguments)},r},s=function(){return p.reset()},up.on("up:framework:reset",s),{deprecated:e,renamedPackage:l,renamedProperty:c,formerlyAsync:n,renamedEvent:i,fixEventTypes:r,fixKey:a,warn:d,loaded:!0,config:p})}.call(this),function(){var a=[].slice;up.util.only=function(e){var t,r;return r=e,t=2<=arguments.length?a.call(arguments,1):[],up.migrate.deprecated("up.util.only(object, ...keys)","up.util.pick(object, keys)"),up.util.pick(r,t)},up.util.except=function(e){var t,r;return r=e,t=2<=arguments.length?a.call(arguments,1):[],up.migrate.deprecated("up.util.except(object, ...keys)","up.util.omit(object, keys)"),up.util.omit(r,t)},up.util.parseUrl=function(){var e,t;return e=1<=arguments.length?a.call(arguments,0):[],up.migrate.warn("up.util.parseUrl() has been renamed to up.util.parseURL()"),(t=up.util).parseURL.apply(t,e)},up.util.any=function(){var e;return e=1<=arguments.length?a.call(arguments,0):[],up.migrate.warn("up.util.any() has been renamed to up.util.some()"),some.apply(null,e)},up.util.all=function(){var e,t;return e=1<=arguments.length?a.call(arguments,0):[],up.migrate.warn("up.util.all() has been renamed to up.util.every()"),(t=up.util).every.apply(t,e)},up.util.detect=function(){var e,t;return e=1<=arguments.length?a.call(arguments,0):[],up.migrate.warn("up.util.detect() has been renamed to up.util.find()"),(t=up.util).find.apply(t,e)},up.util.select=function(){var e,t;return e=1<=arguments.length?a.call(arguments,0):[],up.migrate.warn("up.util.select() has been renamed to up.util.filter()"),(t=up.util).filter.apply(t,e)},up.util.setTimer=function(){var e,t;return e=1<=arguments.length?a.call(arguments,0):[],up.migrate.warn("up.util.setTimer() has been renamed to up.util.timer()"),(t=up.util).timer.apply(t,e)},up.util.escapeHtml=function(){var e,t;return e=1<=arguments.length?a.call(arguments,0):[],up.migrate.deprecated("up.util.escapeHtml","up.util.escapeHTML"),(t=up.util).escapeHTML.apply(t,e)},up.util.selectorForElement=function(){var e,t;return e=1<=arguments.length?a.call(arguments,0):[],up.migrate.warn("up.util.selectorForElement() has been renamed to up.fragment.toTarget()"),(t=up.fragment).toTarget.apply(t,e)},up.util.nextFrame=function(){var e,t;return e=1<=arguments.length?a.call(arguments,0):[],up.migrate.warn("up.util.nextFrame() has been renamed to up.util.task()"),(t=up.util).task.apply(t,e)}}.call(this),function(){var r=[].slice;up.element.first=function(){var e,t;return e=1<=arguments.length?r.call(arguments,0):[],up.migrate.deprecated("up.element.first()","up.element.get()"),(t=up.element).get.apply(t,e)},up.element.createFromHtml=function(){var e,t;return e=1<=arguments.length?r.call(arguments,0):[],up.migrate.deprecated("up.element.createFromHtml","up.element.createFromHTML"),(t=up.element).createFromHTML.apply(t,e)}}.call(this),function(){var t=[].slice;up.migrate.renamedPackage("bus","event"),up.event.nobodyPrevents=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],up.migrate.deprecated("up.event.nobodyPrevents(type)","!up.emit(type).defaultPrevented"),!up.emit.apply(up,e).defaultPrevented}}.call(this),function(){var p,o;o=up.util,p=up.element,up.migrate.postCompile=function(e,t){var r,a,n,u,p,i;if(n=t.keep){for(up.migrate.warn("The { keep: true } option for up.compiler() has been removed. Have the compiler set [up-keep] attribute instead."),i=o.isString(n)?n:"",p=[],a=0,u=e.length;a<u;a++)r=e[a],p.push(r.setAttribute("up-keep",i));return p}},up.migrate.targetMacro=function(a,n,u){return up.macro("["+a+"]",function(e){var t,r;return r=o.copy(n),(t=e.getAttribute(a))?r["up-target"]=t:r["up-follow"]="",p.setMissingAttrs(e,r),e.removeAttribute(a),"function"==typeof u?u():void 0})}}.call(this),function(){up.migrate.renamedProperty(up.form.config,"fields","fieldSelectors"),up.migrate.renamedProperty(up.form.config,"submitButtons","submitButtonSelectors")}.call(this),function(){var p,r=[].slice;p=up.util,up.migrate.renamedPackage("flow","fragment"),up.migrate.renamedPackage("dom","fragment"),up.migrate.renamedProperty(up.fragment.config,"fallbacks","mainTargets"),up.migrate.handleResponseDocOptions=function(e){return up.migrate.fixKey(e,"html","document")},up.replace=function(e,t,r){return up.migrate.deprecated("up.replace(target, url)","up.navigate(target, { url })"),up.navigate(p.merge(r,{target:e,url:t}))},up.extract=function(e,t,r){return up.migrate.deprecated("up.extract(target, document)","up.navigate(target, { document })"),up.navigate(p.merge(r,{target:e,document:t}))},up.fragment.first=function(){var e,t;return e=1<=arguments.length?r.call(arguments,0):[],up.migrate.deprecated("up.fragment.first()","up.fragment.get()"),(t=up.fragment).get.apply(t,e)},up.first=up.fragment.first,up.migrate.handleScrollOptions=function(e){if(p.isUndefined(e.scroll)&&(p.isString(e.reveal)?(up.migrate.deprecated("Option { reveal: '"+e.reveal+"' }","{ scroll: '"+e.reveal+"' }"),e.scroll=e.reveal):!0===e.reveal?(up.migrate.deprecated("Option { reveal: true }","{ scroll: 'target' }"),e.scroll="target"):!1===e.reveal&&(up.migrate.deprecated("Option { reveal: false }","{ scroll: false }"),e.scroll=!1),p.isDefined(e.resetScroll)&&(up.migrate.deprecated("Option { resetScroll: true }","{ scroll: 'reset' }"),e.scroll="teset"),p.isDefined(e.restoreScroll)))return up.migrate.deprecated("Option { restoreScroll: true }","{ scroll: 'restore' }"),e.scroll="restore"},up.migrate.handleHistoryOption=function(e){if(p.isString(e.history)&&"auto"!==e.history)return up.migrate.warn("Passing a URL as { history } option is deprecated. Pass it as { location } instead."),e.location=e.history,e.history="auto"},up.migrate.preprocessRenderOptions=function(e){var t,r,a,n,u;for(up.migrate.handleHistoryOption(e),u=[],t=0,r=(n=["target","origin"]).length;t<r;t++)a=n[t],p.isJQuery(e[a])?(up.migrate.warn("Passing a jQuery collection as { %s } is deprecated. Pass it as a native element instead.",a),u.push(e[a]=up.element.get(e[a]))):u.push(void 0);return u}}.call(this),function(){up.migrate.renamedProperty(up.history.config,"popTargets","restoreTargets"),up.history.url=function(){return up.migrate.deprecated("up.history.url()","up.history.location"),up.history.location},up.migrate.renamedEvent("up:history:push","up:location:changed"),up.migrate.renamedEvent("up:history:pushed","up:location:changed"),up.migrate.renamedEvent("up:history:restore","up:location:changed"),up.migrate.renamedEvent("up:history:restored","up:location:changed"),up.migrate.renamedEvent("up:history:replaced","up:location:changed")}.call(this),function(){up.migrate.renamedPackage("navigation","feedback"),up.migrate.renamedProperty(up.feedback.config,"navs","navSelectors")}.call(this),function(){up.migrate.parseFollowOptions=function(e){return e.string("flavor"),e.string("width"),e.string("height"),e["boolean"]("closable"),e.booleanOrString("reveal"),e["boolean"]("resetScroll"),e["boolean"]("restoreScroll"),e.booleanOrString("historyVisible")},up.migrate.targetMacro("up-dash",{"up-preload":"","up-instant":""},function(){return up.migrate.deprecated("a[up-dash]","up.link.config.instantSelectors or up.link.config.preloadSelectors")})}.call(this),function(){up.migrate.handleLayerOptions=function(e){var t,r,a,n;for(up.migrate.fixKey(e,"flavor","mode"),up.migrate.fixKey(e,"closable","dismissable"),up.migrate.fixKey(e,"closeLabel","dismissLabel"),r=0,a=(n=["width","maxWidth","height"]).length;r<a;r++)e[t=n[r]]&&up.migrate.warn("Layer option { "+t+" } has been removed. Use { size } or { class } instead.");if(e.sticky&&up.migrate.warn("Layer option { sticky } has been removed. Give links an [up-peel=false] attribute to prevent layer dismissal on click."),e.template&&up.migrate.warn("Layer option { template } has been removed. Use { class } or modify the layer HTML on up:layer:open."),"page"===e.layer&&(up.migrate.warn("Option { layer: 'page' } has been renamed to { layer: 'root' }."),e.layer="root"),"modal"===e.layer||"popup"===e.layer)return up.migrate.warn("Option { layer: '"+e.layer+"' } has been removed. Did you mean { layer: 'overlay' }?"),e.layer="overlay"},up.migrate.handleTetherOptions=function(e){var t,r,a;if(r=(a=e.position.split("-"))[0],t=a[1])return up.migrate.warn("The position value %o is deprecated. Use %o instead.",e.position,{position:r,align:t}),e.position=r,e.align=t},up.migrate.registerLayerCloser=function(r){return r.registerClickCloser("up-close",function(e,t){return up.migrate.deprecated("[up-close]","[up-dismiss]"),r.dismiss(e,t)})},up.migrate.handleLayerConfig=function(e){return up.migrate.fixKey(e,"historyVisible","history")},up.util.getter(up.Layer.prototype,"historyVisible",function(){return up.migrate.deprecated("up.Layer#historyVisible","up.Layer#history"),this.history})}.call(this),function(){var e,a;a=up.util,e=new Error("up.modal.flavors has been removed without direct replacement. You may give new layers a { class } or modify layer elements on up:layer:open."),up.modal=a.literal({visit:function(e,t){return null==t&&(t={}),up.migrate.deprecated("up.modal.visit(url)",'up.layer.open({ url, mode: "modal" })'),up.layer.open(a.merge(t,{url:e,mode:"modal"}))},follow:function(e,t){return null==t&&(t={}),up.migrate.deprecated("up.modal.follow(link)",'up.follow(link, { layer: "modal" })'),up.follow(e,a.merge(t,{layer:"modal"}))},extract:function(e,t,r){return null==r&&(r={}),up.migrate.deprecated("up.modal.extract(target, document)",'up.layer.open({ document, mode: "modal" })'),up.layer.open(a.merge(r,{target:e,html:t,layer:"modal"}))},close:function(e){return null==e&&(e={}),up.migrate.deprecated("up.modal.close()","up.layer.dismiss()"),up.layer.dismiss(null,e),up.migrate.formerlyAsync("up.layer.dismiss()")},url:function(){return up.migrate.deprecated("up.modal.url()","up.layer.location"),up.layer.location},coveredUrl:function(){var e;return up.migrate.deprecated("up.modal.coveredUrl()","up.layer.parent.location"),null!=(e=up.layer.parent)?e.location:void 0},get_config:function(){return up.migrate.deprecated("up.modal.config","up.layer.config.modal"),up.layer.config.modal},contains:function(e){return up.migrate.deprecated("up.modal.contains()","up.layer.contains()"),up.layer.contains(e)},isOpen:function(){return up.migrate.deprecated("up.modal.isOpen()","up.layer.isOverlay()"),up.layer.isOverlay()},get_flavors:function(){throw e},flavor:function(){throw e}}),up.migrate.renamedEvent("up:modal:open","up:layer:open"),up.migrate.renamedEvent("up:modal:opened","up:layer:opened"),up.migrate.renamedEvent("up:modal:close","up:layer:dismiss"),up.migrate.renamedEvent("up:modal:closed","up:layer:dismissed"),up.migrate.targetMacro("up-modal",{"up-layer":"new modal"},function(){return up.migrate.deprecated("a[up-modal]",'a[up-layer="new modal"]')}),up.migrate.targetMacro("up-drawer",{"up-layer":"new drawer"},function(){return up.migrate.deprecated("a[up-drawer]",'a[up-layer="new drawer"]')})}.call(this),function(){var r;r=up.util,up.element,up.popup=r.literal({attach:function(e,t){return null==t&&(t={}),e=up.fragment.get(e),up.migrate.deprecated("up.popup.attach(origin)","up.layer.open({ origin, layer: 'popup' })"),up.layer.open(r.merge(t,{origin:e,layer:"popup"}))},close:function(e){return null==e&&(e={}),up.migrate.deprecated("up.popup.close()","up.layer.dismiss()"),up.layer.dismiss(null,e)},url:function(){return up.migrate.deprecated("up.popup.url()","up.layer.location"),up.layer.location},coveredUrl:function(){var e;return up.migrate.deprecated("up.popup.coveredUrl()","up.layer.parent.location"),null!=(e=up.layer.parent)?e.location:void 0},get_config:function(){return up.migrate.deprecated("up.popup.config","up.layer.config.popup"),up.layer.config.popup},contains:function(e){return up.migrate.deprecated("up.popup.contains()","up.layer.contains()"),up.layer.contains(e)},isOpen:function(){return up.migrate.deprecated("up.popup.isOpen()","up.layer.isOverlay()"),up.layer.isOverlay()},sync:function(){return up.migrate.deprecated("up.popup.sync()","up.layer.sync()"),up.layer.sync()}}),up.migrate.renamedEvent("up:popup:open","up:layer:open"),up.migrate.renamedEvent("up:popup:opened","up:layer:opened"),up.migrate.renamedEvent("up:popup:close","up:layer:dismiss"),up.migrate.renamedEvent("up:popup:closed","up:layer:dismissed"),up.migrate.targetMacro("up-popup",{"up-layer":"new popup"},function(){return up.migrate.deprecated("[up-popup]",'[up-layer="new popup"]')})}.call(this),function(){up.tooltip=up.macro("[up-tooltip]",function(e){return up.migrate.warn("[up-tooltip] has been deprecated. A [title] was set instead."),up.element.setMissingAttr(e,"title",e.getAttribute("up-tooltip"))})}.call(this),function(){var e,t,r,a,n,u=[].slice;n=up.util,up.migrate.renamedPackage("proxy","network"),up.migrate.renamedEvent("up:proxy:load","up:request:load"),up.migrate.renamedEvent("up:proxy:received","up:request:loaded"),up.migrate.renamedEvent("up:proxy:loaded","up:request:loaded"),up.migrate.renamedEvent("up:proxy:fatal","up:request:fatal"),up.migrate.renamedEvent("up:proxy:aborted","up:request:aborted"),up.migrate.renamedEvent("up:proxy:slow","up:request:late"),up.migrate.renamedEvent("up:proxy:recover","up:request:recover"),r=function(){return up.migrate.deprecated("up.proxy.config.preloadDelay","up.link.config.preloadDelay")},Object.defineProperty(up.network.config,"preloadDelay",{get:function(){return r(),up.link.config.preloadDelay},set:function(e){return r(),up.link.config.preloadDelay=e}}),up.migrate.renamedProperty(up.network.config,"maxRequests","concurrency"),up.migrate.renamedProperty(up.network.config,"slowDelay","badResponseTime"),up.migrate.handleRequestOptions=function(e){return up.migrate.fixKey(e,"data","params")},up.ajax=function(){var e,t;return e=1<=arguments.length?u.call(arguments,0):[],up.migrate.deprecated("up.ajax()","up.request()"),t=function(e){return e.text},up.request.apply(up,e).then(t)},up.network.clear=function(){return up.migrate.deprecated("up.proxy.clear()","up.cache.clear()"),up.cache.clear()},up.network.preload=function(){var e,t;return e=1<=arguments.length?u.call(arguments,0):[],up.migrate.deprecated("up.proxy.preload(link)","up.link.preload(link)"),(t=up.link).preload.apply(t,e)},up.Request.prototype.navigate=function(){return up.migrate.deprecated("up.Request#navigate()","up.Request#loadPage()"),this.loadPage()},up.Response.prototype.isSuccess=function(){return up.migrate.deprecated("up.Response#isSuccess()","up.Response#ok"),this.ok},up.Response.prototype.isError=function(){return up.migrate.deprecated("up.Response#isError()","!up.Response#ok"),!this.ok},t=function(){var e;return e=up.EventListener.allNonDefault(document),n.find(e,function(e){return"up:request:late"===e.eventType})},a=up.network.config.progressBar,(e=function(){return up.network.config.progressBar=function(){return t()?(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."),!1):a}})(),up.on("up:framework:reset",e)}.call(this),function(){up.migrate.renamedProperty(up.radio.config,"hungry","hungrySelectors")}.call(this),function(){var r=[].slice;up.migrate.renamedPackage("layout","viewport"),up.migrate.renamedProperty(up.viewport.config,"viewports","viewportSelectors"),up.migrate.renamedProperty(up.viewport.config,"snap","revealSnap"),up.viewport.closest=function(){var e,t;return e=1<=arguments.length?r.call(arguments,0):[],up.migrate.deprecated("up.viewport.closest()","up.viewport.get()"),(t=up.viewport).get.apply(t,e)}}.call(this),function(){up.framework.stopExtension()}.call(this),function(){}.call(this);
|
data/dist/unpoly.css
CHANGED
@@ -124,6 +124,14 @@ a[up-content], a[up-fragment], a[up-document], [up-href], [up-clickable], [up-ac
|
|
124
124
|
cursor: pointer; }
|
125
125
|
.up-request-loader {
|
126
126
|
display: none; }
|
127
|
+
|
128
|
+
up-progress-bar {
|
129
|
+
position: fixed;
|
130
|
+
top: 0;
|
131
|
+
left: 0;
|
132
|
+
z-index: 999999999;
|
133
|
+
height: 3px;
|
134
|
+
background-color: #007bff; }
|
127
135
|
up-bounds {
|
128
136
|
position: absolute; }
|
129
137
|
|
data/dist/unpoly.js
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
(function() {
|
7
7
|
window.up = {
|
8
|
-
version: "2.0
|
8
|
+
version: "2.1.0"
|
9
9
|
};
|
10
10
|
|
11
11
|
}).call(this);
|
@@ -661,7 +661,7 @@ to not include another library in your asset bundle.
|
|
661
661
|
@stable
|
662
662
|
*/
|
663
663
|
isJQuery = function(object) {
|
664
|
-
return
|
664
|
+
return up.browser.canJQuery() && object instanceof jQuery;
|
665
665
|
};
|
666
666
|
|
667
667
|
/***
|
@@ -2157,10 +2157,8 @@ Internet Explorer 10 or lower
|
|
2157
2157
|
*/
|
2158
2158
|
|
2159
2159
|
(function() {
|
2160
|
-
var slice = [].slice;
|
2161
|
-
|
2162
2160
|
up.browser = (function() {
|
2163
|
-
var assertConfirmed,
|
2161
|
+
var assertConfirmed, canFormatLog, canJQuery, canPassiveEventListener, canPromise, canPushState, getJQuery, isIE11, isSupported, loadPage, popCookie, submitForm, u;
|
2164
2162
|
u = up.util;
|
2165
2163
|
|
2166
2164
|
/***
|
@@ -2241,6 +2239,10 @@ Internet Explorer 10 or lower
|
|
2241
2239
|
}
|
2242
2240
|
return value;
|
2243
2241
|
};
|
2242
|
+
getJQuery = function() {
|
2243
|
+
canJQuery() || up.fail("jQuery must be published as window.jQuery");
|
2244
|
+
return jQuery;
|
2245
|
+
};
|
2244
2246
|
|
2245
2247
|
/***
|
2246
2248
|
@return {Promise}
|
@@ -2270,12 +2272,6 @@ Internet Explorer 10 or lower
|
|
2270
2272
|
isSupported = function() {
|
2271
2273
|
return canPromise();
|
2272
2274
|
};
|
2273
|
-
callJQuery = function() {
|
2274
|
-
var args;
|
2275
|
-
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
2276
|
-
canJQuery() || up.fail("jQuery must be published as window.jQuery");
|
2277
|
-
return jQuery.apply(null, args);
|
2278
|
-
};
|
2279
2275
|
return u.literal({
|
2280
2276
|
loadPage: loadPage,
|
2281
2277
|
submitForm: submitForm,
|
@@ -2286,7 +2282,7 @@ Internet Explorer 10 or lower
|
|
2286
2282
|
assertConfirmed: assertConfirmed,
|
2287
2283
|
isSupported: isSupported,
|
2288
2284
|
popCookie: popCookie,
|
2289
|
-
|
2285
|
+
get_jQuery: getJQuery,
|
2290
2286
|
isIE11: isIE11
|
2291
2287
|
});
|
2292
2288
|
})();
|
@@ -4603,17 +4599,23 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
4603
4599
|
};
|
4604
4600
|
|
4605
4601
|
OpenLayer.prototype.buildLayer = function() {
|
4606
|
-
|
4602
|
+
var beforeNew, buildOptions;
|
4603
|
+
buildOptions = u.merge(this.options, {
|
4607
4604
|
opening: true
|
4608
|
-
})
|
4605
|
+
});
|
4606
|
+
beforeNew = (function(_this) {
|
4607
|
+
return function(optionsWithLayerDefaults) {
|
4608
|
+
return _this.options = up.RenderOptions.finalize(optionsWithLayerDefaults);
|
4609
|
+
};
|
4610
|
+
})(this);
|
4611
|
+
return up.layer.build(buildOptions, beforeNew);
|
4609
4612
|
};
|
4610
4613
|
|
4611
4614
|
OpenLayer.prototype.handleHistory = function() {
|
4612
|
-
if (this.layer.
|
4613
|
-
this.layer.
|
4615
|
+
if (this.layer.history === 'auto') {
|
4616
|
+
this.layer.history = up.fragment.hasAutoHistory(this.content);
|
4614
4617
|
}
|
4615
4618
|
this.layer.parent.saveHistory();
|
4616
|
-
this.options.history = true;
|
4617
4619
|
return this.layer.updateHistory(this.options);
|
4618
4620
|
};
|
4619
4621
|
|
@@ -4679,6 +4681,7 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
4679
4681
|
|
4680
4682
|
function UpdateLayer(options) {
|
4681
4683
|
this.executeStep = bind(this.executeStep, this);
|
4684
|
+
options = up.RenderOptions.finalize(options);
|
4682
4685
|
UpdateLayer.__super__.constructor.call(this, options);
|
4683
4686
|
this.layer = options.layer;
|
4684
4687
|
this.target = options.target;
|
@@ -4721,7 +4724,9 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
4721
4724
|
if (this.options.history === 'auto') {
|
4722
4725
|
this.options.history = this.hasAutoHistory();
|
4723
4726
|
}
|
4724
|
-
|
4727
|
+
if (this.options.history) {
|
4728
|
+
this.layer.updateHistory(this.options);
|
4729
|
+
}
|
4725
4730
|
this.handleLayerChangeRequests();
|
4726
4731
|
swapPromises = this.steps.map(this.executeStep);
|
4727
4732
|
Promise.all(swapPromises).then((function(_this) {
|
@@ -5599,20 +5604,13 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
5599
5604
|
return [attributes.eventType, attributes.selector, attributes.callback.upUid].join('|');
|
5600
5605
|
};
|
5601
5606
|
|
5602
|
-
EventListener.
|
5603
|
-
var
|
5604
|
-
if (map = element.upEventListeners) {
|
5607
|
+
EventListener.allNonDefault = function(element) {
|
5608
|
+
var listeners, map;
|
5609
|
+
if (map = element.upEventListeners || {}) {
|
5605
5610
|
listeners = u.values(map);
|
5606
|
-
|
5607
|
-
|
5608
|
-
|
5609
|
-
if (!listener.isDefault) {
|
5610
|
-
results.push(listener.unbind());
|
5611
|
-
} else {
|
5612
|
-
results.push(void 0);
|
5613
|
-
}
|
5614
|
-
}
|
5615
|
-
return results;
|
5611
|
+
return u.reject(listeners, 'isDefault');
|
5612
|
+
} else {
|
5613
|
+
return [];
|
5616
5614
|
}
|
5617
5615
|
};
|
5618
5616
|
|
@@ -6341,8 +6339,8 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
6341
6339
|
|
6342
6340
|
If a layer does not have visible history, its desendant layers cannot have history either.
|
6343
6341
|
|
6344
|
-
@property up.Layer#
|
6345
|
-
@param {boolean}
|
6342
|
+
@property up.Layer#history
|
6343
|
+
@param {boolean} history
|
6346
6344
|
@stable
|
6347
6345
|
*/
|
6348
6346
|
|
@@ -6380,7 +6378,7 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
6380
6378
|
*/
|
6381
6379
|
|
6382
6380
|
Layer.prototype.keys = function() {
|
6383
|
-
return ['element', 'stack', '
|
6381
|
+
return ['element', 'stack', 'history', 'mode', 'context', 'lastScrollTops'];
|
6384
6382
|
};
|
6385
6383
|
|
6386
6384
|
Layer.prototype.defaults = function() {
|
@@ -6942,9 +6940,6 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
6942
6940
|
};
|
6943
6941
|
|
6944
6942
|
Layer.prototype.updateHistory = function(options) {
|
6945
|
-
if (!options.history) {
|
6946
|
-
return;
|
6947
|
-
}
|
6948
6943
|
if (u.isString(options.title)) {
|
6949
6944
|
this.title = options.title;
|
6950
6945
|
}
|
@@ -6957,11 +6952,11 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
6957
6952
|
/***
|
6958
6953
|
This layer's window title.
|
6959
6954
|
|
6960
|
-
If the [frontmost layer](/up.layer.front) does not have [visible history](/up.Layer.prototype.
|
6955
|
+
If the [frontmost layer](/up.layer.front) does not have [visible history](/up.Layer.prototype.history),
|
6961
6956
|
the browser window will show the title of an ancestor layer.
|
6962
6957
|
This property will return the title the layer would use if it had visible history.
|
6963
6958
|
|
6964
|
-
If this layer does not [affect browser history](/up.Layer.prototype.
|
6959
|
+
If this layer does not [affect browser history](/up.Layer.prototype.history), this property will
|
6965
6960
|
still return the title the layer would otherwise use.
|
6966
6961
|
|
6967
6962
|
When this layer opens a child layer with visible history, the browser window will change to the child
|
@@ -6992,7 +6987,7 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
6992
6987
|
/***
|
6993
6988
|
This layer's location URL.
|
6994
6989
|
|
6995
|
-
If the layer has [no visible history](/up.Layer.prototype.
|
6990
|
+
If the layer has [no visible history](/up.Layer.prototype.history), this property
|
6996
6991
|
still returns the URL of the content in the overlay. In this case
|
6997
6992
|
the browser's address bar will show the location of an ancestor layer.
|
6998
6993
|
|
@@ -7030,7 +7025,7 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
7030
7025
|
});
|
7031
7026
|
|
7032
7027
|
Layer.prototype.isHistoryVisible = function() {
|
7033
|
-
return this.
|
7028
|
+
return this.history && (this.isRoot() || this.parent.isHistoryVisible());
|
7034
7029
|
};
|
7035
7030
|
|
7036
7031
|
Layer.prototype.showsLiveHistory = function() {
|
@@ -9215,6 +9210,62 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
9215
9210
|
|
9216
9211
|
})(up.Class);
|
9217
9212
|
|
9213
|
+
}).call(this);
|
9214
|
+
(function() {
|
9215
|
+
var TRANSITION_DELAY, e;
|
9216
|
+
|
9217
|
+
e = up.element;
|
9218
|
+
|
9219
|
+
TRANSITION_DELAY = 300;
|
9220
|
+
|
9221
|
+
up.ProgressBar = (function() {
|
9222
|
+
function ProgressBar() {
|
9223
|
+
this.step = 0;
|
9224
|
+
this.element = e.affix(document.body, 'up-progress-bar');
|
9225
|
+
this.element.style.transition = "width " + TRANSITION_DELAY + "ms ease-out";
|
9226
|
+
this.moveTo(0);
|
9227
|
+
up.element.paint(this.element);
|
9228
|
+
this.width = 31;
|
9229
|
+
this.nextStep();
|
9230
|
+
}
|
9231
|
+
|
9232
|
+
ProgressBar.prototype.nextStep = function() {
|
9233
|
+
var diff, nextStepDelay;
|
9234
|
+
if (this.width < 80) {
|
9235
|
+
if (Math.random() < 0.15) {
|
9236
|
+
diff = 7 + 5 * Math.random();
|
9237
|
+
} else {
|
9238
|
+
diff = 1.5 + 0.5 * Math.random();
|
9239
|
+
}
|
9240
|
+
} else {
|
9241
|
+
diff = 0.13 * (100 - width) * Math.random();
|
9242
|
+
}
|
9243
|
+
this.moveTo(this.width + diff);
|
9244
|
+
this.step++;
|
9245
|
+
nextStepDelay = TRANSITION_DELAY + this.step * 40;
|
9246
|
+
return this.timeout = setTimeout(this.nextStep.bind(this), nextStepDelay);
|
9247
|
+
};
|
9248
|
+
|
9249
|
+
ProgressBar.prototype.moveTo = function(width) {
|
9250
|
+
this.width = width;
|
9251
|
+
return this.element.style.width = width + "vw";
|
9252
|
+
};
|
9253
|
+
|
9254
|
+
ProgressBar.prototype.destroy = function() {
|
9255
|
+
clearTimeout(this.timeout);
|
9256
|
+
return e.remove(this.element);
|
9257
|
+
};
|
9258
|
+
|
9259
|
+
ProgressBar.prototype.conclude = function() {
|
9260
|
+
clearTimeout(this.timeout);
|
9261
|
+
this.moveTo(100);
|
9262
|
+
return setTimeout(this.destroy.bind(this), TRANSITION_DELAY);
|
9263
|
+
};
|
9264
|
+
|
9265
|
+
return ProgressBar;
|
9266
|
+
|
9267
|
+
})();
|
9268
|
+
|
9218
9269
|
}).call(this);
|
9219
9270
|
(function() {
|
9220
9271
|
var u,
|
@@ -9257,7 +9308,7 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
9257
9308
|
u = up.util;
|
9258
9309
|
|
9259
9310
|
up.RenderOptions = (function() {
|
9260
|
-
var CONTENT_KEYS, GLOBAL_DEFAULTS, PREFLIGHT_KEYS, PRELOAD_OVERRIDES, SHARED_KEYS, assertContentGiven, deriveFailOptions, failOverrides, navigateDefaults, preloadOverrides, preprocess;
|
9311
|
+
var CONTENT_KEYS, GLOBAL_DEFAULTS, LATE_KEYS, PREFLIGHT_KEYS, PRELOAD_OVERRIDES, SHARED_KEYS, assertContentGiven, deriveFailOptions, failOverrides, finalize, navigateDefaults, preloadOverrides, preprocess;
|
9261
9312
|
GLOBAL_DEFAULTS = {
|
9262
9313
|
hungry: true,
|
9263
9314
|
keep: true,
|
@@ -9270,9 +9321,10 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
9270
9321
|
confirm: false,
|
9271
9322
|
feedback: false
|
9272
9323
|
};
|
9273
|
-
PREFLIGHT_KEYS = ['url', 'method', 'origin', 'headers', 'params', 'cache', 'solo', 'confirm', 'feedback', 'origin', 'baseLayer', 'fail'];
|
9274
|
-
SHARED_KEYS = PREFLIGHT_KEYS.concat(['keep', 'hungry', 'history', 'source', 'saveScroll', '
|
9324
|
+
PREFLIGHT_KEYS = ['url', 'method', 'origin', 'headers', 'params', 'cache', 'clearCache', 'fallback', 'solo', 'confirm', 'feedback', 'origin', 'baseLayer', 'fail'];
|
9325
|
+
SHARED_KEYS = PREFLIGHT_KEYS.concat(['keep', 'hungry', 'history', 'source', 'saveScroll', 'navigate']);
|
9275
9326
|
CONTENT_KEYS = ['url', 'content', 'fragment', 'document'];
|
9327
|
+
LATE_KEYS = ['history', 'focus', 'scroll'];
|
9276
9328
|
navigateDefaults = function(options) {
|
9277
9329
|
if (options.navigate) {
|
9278
9330
|
return up.fragment.config.navigateOptions;
|
@@ -9284,12 +9336,17 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
9284
9336
|
}
|
9285
9337
|
};
|
9286
9338
|
preprocess = function(options) {
|
9287
|
-
var base,
|
9288
|
-
if (typeof (base = up.migrate).
|
9289
|
-
base.
|
9339
|
+
var base, defaults;
|
9340
|
+
if (typeof (base = up.migrate).preprocessRenderOptions === "function") {
|
9341
|
+
base.preprocessRenderOptions(options);
|
9290
9342
|
}
|
9291
|
-
|
9292
|
-
return
|
9343
|
+
defaults = u.merge(GLOBAL_DEFAULTS, navigateDefaults(options));
|
9344
|
+
return u.merge(u.omit(defaults, LATE_KEYS), {
|
9345
|
+
defaults: defaults
|
9346
|
+
}, options, preloadOverrides(options));
|
9347
|
+
};
|
9348
|
+
finalize = function(preprocessedOptions, lateDefaults) {
|
9349
|
+
return u.merge(preprocessedOptions.defaults, lateDefaults, preprocessedOptions);
|
9293
9350
|
};
|
9294
9351
|
assertContentGiven = function(options) {
|
9295
9352
|
if (!u.some(CONTENT_KEYS, function(contentKey) {
|
@@ -9314,17 +9371,24 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
9314
9371
|
return overrides;
|
9315
9372
|
};
|
9316
9373
|
deriveFailOptions = function(preprocessedOptions) {
|
9317
|
-
|
9318
|
-
result = u.merge(u.pick(preprocessedOptions, SHARED_KEYS), failOverrides(preprocessedOptions));
|
9319
|
-
return preprocess(result);
|
9374
|
+
return u.merge(preprocessedOptions.defaults, u.pick(preprocessedOptions, SHARED_KEYS), failOverrides(preprocessedOptions));
|
9320
9375
|
};
|
9321
9376
|
return {
|
9322
9377
|
preprocess: preprocess,
|
9378
|
+
finalize: finalize,
|
9323
9379
|
assertContentGiven: assertContentGiven,
|
9324
9380
|
deriveFailOptions: deriveFailOptions
|
9325
9381
|
};
|
9326
9382
|
})();
|
9327
9383
|
|
9384
|
+
}).call(this);
|
9385
|
+
(function() {
|
9386
|
+
|
9387
|
+
|
9388
|
+
}).call(this);
|
9389
|
+
(function() {
|
9390
|
+
|
9391
|
+
|
9328
9392
|
}).call(this);
|
9329
9393
|
(function() {
|
9330
9394
|
var e, u,
|
@@ -9572,7 +9636,7 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
9572
9636
|
/***
|
9573
9637
|
The element that triggered the request.
|
9574
9638
|
|
9575
|
-
For example, when this request was triggered by a click on a link, the
|
9639
|
+
For example, when this request was triggered by a click on a link, the link
|
9576
9640
|
element is set as the `{ origin }`.
|
9577
9641
|
|
9578
9642
|
To prevent memory leaks, this property is removed shortly after the response is received.
|
@@ -11400,12 +11464,21 @@ Unpoly's own events are documented in their respective modules, for example:
|
|
11400
11464
|
u = up.util;
|
11401
11465
|
e = up.element;
|
11402
11466
|
reset = function() {
|
11403
|
-
var element, i, len, ref, results;
|
11467
|
+
var element, i, len, listener, ref, results;
|
11404
11468
|
ref = [window, document, e.root, document.body];
|
11405
11469
|
results = [];
|
11406
11470
|
for (i = 0, len = ref.length; i < len; i++) {
|
11407
11471
|
element = ref[i];
|
11408
|
-
results.push(
|
11472
|
+
results.push((function() {
|
11473
|
+
var j, len1, ref1, results1;
|
11474
|
+
ref1 = up.EventListener.allNonDefault(element);
|
11475
|
+
results1 = [];
|
11476
|
+
for (j = 0, len1 = ref1.length; j < len1; j++) {
|
11477
|
+
listener = ref1[j];
|
11478
|
+
results1.push(listener.unbind());
|
11479
|
+
}
|
11480
|
+
return results1;
|
11481
|
+
})());
|
11409
11482
|
}
|
11410
11483
|
return results;
|
11411
11484
|
};
|
@@ -12375,6 +12448,11 @@ There are existing implementations for various web frameworks:
|
|
12375
12448
|
See the documentation for [`input[up-validate]`](/input-up-validate) for more information
|
12376
12449
|
on how server-side validation works in Unpoly.
|
12377
12450
|
|
12451
|
+
The server is free to respond with any HTTP status code, regardless of the validation result.
|
12452
|
+
Unpoly will always consider a validation request to be successful, even if the
|
12453
|
+
server responds with a non-200 status code. This is in contrast to [regular form submissions](/form-up-submit),
|
12454
|
+
[where a non-200 status code will often update a different element](/server-errors).
|
12455
|
+
|
12378
12456
|
\#\#\# Example
|
12379
12457
|
|
12380
12458
|
Assume we have an auto-validating form field:
|
@@ -13563,7 +13641,7 @@ The `up.history` module helps you work with the browser history.
|
|
13563
13641
|
/***
|
13564
13642
|
Returns a normalized URL for the current browser location.
|
13565
13643
|
|
13566
|
-
Note that if the current [layer](/up.layer) does not have [visible history](/up.Layer.prototype.
|
13644
|
+
Note that if the current [layer](/up.layer) does not have [visible history](/up.Layer.prototype.history),
|
13567
13645
|
the browser's address bar will show the location of an ancestor layer.
|
13568
13646
|
To get the location of the current layer, use `up.layer.location`.
|
13569
13647
|
|
@@ -13664,7 +13742,7 @@ The `up.history` module helps you work with the browser history.
|
|
13664
13742
|
- The user uses the back or forward buttons in their browser UI.
|
13665
13743
|
- Programmatic calls to `up.history.push()`.
|
13666
13744
|
|
13667
|
-
When a [layer](/up.layer) has no [visible history](/up.Layer.prototype.
|
13745
|
+
When a [layer](/up.layer) has no [visible history](/up.Layer.prototype.history), following a link
|
13668
13746
|
will not cause the browser's address bar to be updated. In this case no `up:location:changed` event will be emitted.
|
13669
13747
|
However, a `up:layer:location:changed` will be emitted even if the address bar did not change.
|
13670
13748
|
|
@@ -13731,7 +13809,7 @@ The `up.history` module helps you work with the browser history.
|
|
13731
13809
|
emit = function() {
|
13732
13810
|
var args, historyLayer;
|
13733
13811
|
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
13734
|
-
historyLayer = u.find(up.layer.stack.reversed(), '
|
13812
|
+
historyLayer = u.find(up.layer.stack.reversed(), 'history');
|
13735
13813
|
return historyLayer.emit.apply(historyLayer, args);
|
13736
13814
|
};
|
13737
13815
|
up.on('up:app:boot', function() {
|
@@ -13926,14 +14004,14 @@ The `up.history` module helps you work with the browser history.
|
|
13926
14004
|
return {
|
13927
14005
|
badTargetClasses: [/^up-/],
|
13928
14006
|
navigateOptions: {
|
13929
|
-
focus: 'auto',
|
13930
|
-
scroll: 'auto',
|
13931
14007
|
solo: true,
|
13932
14008
|
feedback: true,
|
14009
|
+
cache: 'auto',
|
13933
14010
|
fallback: true,
|
14011
|
+
focus: 'auto',
|
14012
|
+
scroll: 'auto',
|
13934
14013
|
history: 'auto',
|
13935
|
-
peel: true
|
13936
|
-
cache: 'auto'
|
14014
|
+
peel: true
|
13937
14015
|
},
|
13938
14016
|
matchAroundOrigin: true,
|
13939
14017
|
runScripts: false,
|
@@ -14266,9 +14344,6 @@ The `up.history` module helps you work with the browser history.
|
|
14266
14344
|
|
14267
14345
|
If set to `false`, the history will remain unchanged.
|
14268
14346
|
|
14269
|
-
[Overlays](/up.layer) will only change the browser URL and window title if the overlay
|
14270
|
-
has [visible history](/up.layer.historyVisible), even when `{ history: true }` is passed.
|
14271
|
-
|
14272
14347
|
@param {string} [options.title]
|
14273
14348
|
An explicit document title to use after rendering.
|
14274
14349
|
|
@@ -15125,7 +15200,7 @@ The `up.history` module helps you work with the browser history.
|
|
15125
15200
|
so you don't usually need to pass a URL when reloading.
|
15126
15201
|
|
15127
15202
|
To reload from another URL, pass a `{ url }` option or set an `[up-source]` attribute
|
15128
|
-
on the element or its ancestors.
|
15203
|
+
on the element being reloaded or its ancestors.
|
15129
15204
|
|
15130
15205
|
\#\#\# Skipping updates when nothing changed
|
15131
15206
|
|
@@ -15609,10 +15684,6 @@ The `up.history` module helps you work with the browser history.
|
|
15609
15684
|
});
|
15610
15685
|
})();
|
15611
15686
|
|
15612
|
-
up.replace = up.fragment.replace;
|
15613
|
-
|
15614
|
-
up.extract = up.fragment.extract;
|
15615
|
-
|
15616
15687
|
up.reload = up.fragment.reload;
|
15617
15688
|
|
15618
15689
|
up.destroy = up.fragment.destroy;
|
@@ -17289,7 +17360,7 @@ You can define custom animations using `up.transition()` and
|
|
17289
17360
|
up.network = (function() {
|
17290
17361
|
|
17291
17362
|
/***
|
17292
|
-
|
17363
|
+
Sets default options for this package.
|
17293
17364
|
|
17294
17365
|
@property up.network.config
|
17295
17366
|
|
@@ -17339,6 +17410,9 @@ You can define custom animations using `up.transition()` and
|
|
17339
17410
|
@param {number} [config.badResponseTime=400]
|
17340
17411
|
How long the proxy waits until emitting the [`up:request:late` event](/up:request:late).
|
17341
17412
|
|
17413
|
+
Requests exceeding this response time will also cause a [progress bar](/up.network.config#config.progressBar)
|
17414
|
+
to appear at the top edge of the screen.
|
17415
|
+
|
17342
17416
|
This metric is *not* considered for the decision to
|
17343
17417
|
[reduce requests](/up.network.shouldReduceRequests).
|
17344
17418
|
|
@@ -17400,9 +17474,25 @@ You can define custom animations using `up.transition()` and
|
|
17400
17474
|
}
|
17401
17475
|
}
|
17402
17476
|
|
17477
|
+
@param {boolean|Function(): boolean} [config.progressBar]
|
17478
|
+
Whether to show a progress bar for [late requests](/up:request:late).
|
17479
|
+
|
17480
|
+
The progress bar is implemented as a single `<up-progress-bar>` element.
|
17481
|
+
Unpoly will automatically insert and remove this element as requests
|
17482
|
+
are [late](/up:request:late) or [recovered](/up:request:recover).
|
17483
|
+
|
17484
|
+
The default appearance is a simple blue bar at the top edge of the screen.
|
17485
|
+
You may customize the style using CSS:
|
17486
|
+
|
17487
|
+
```css
|
17488
|
+
up-progress-bar {
|
17489
|
+
background-color: red;
|
17490
|
+
}
|
17491
|
+
```
|
17492
|
+
|
17403
17493
|
@stable
|
17404
17494
|
*/
|
17405
|
-
var abortRequests, cache, config, handleCaching, isBusy, isIdle, isSafeMethod, makeRequest, mimicLocalRequest, parseRequestOptions, queue, queueRequest, registerAliasForRedirect, reset, shouldReduceRequests, useCachedRequest;
|
17495
|
+
var abortRequests, cache, config, handleCaching, isBusy, isIdle, isSafeMethod, makeRequest, mimicLocalRequest, onLate, onRecover, parseRequestOptions, progressBar, queue, queueRequest, registerAliasForRedirect, reset, shouldReduceRequests, useCachedRequest;
|
17406
17496
|
config = new up.Config(function() {
|
17407
17497
|
return {
|
17408
17498
|
concurrency: 4,
|
@@ -17418,11 +17508,13 @@ You can define custom animations using `up.transition()` and
|
|
17418
17508
|
clearCache: function(request, _response) {
|
17419
17509
|
return !request.isSafe();
|
17420
17510
|
},
|
17421
|
-
requestMetaKeys: ['target', 'failTarget', 'mode', 'failMode', 'context', 'failContext']
|
17511
|
+
requestMetaKeys: ['target', 'failTarget', 'mode', 'failMode', 'context', 'failContext'],
|
17512
|
+
progressBar: true
|
17422
17513
|
};
|
17423
17514
|
});
|
17424
17515
|
queue = new up.Request.Queue();
|
17425
17516
|
cache = new up.Request.Cache();
|
17517
|
+
progressBar = null;
|
17426
17518
|
|
17427
17519
|
/***
|
17428
17520
|
Returns an earlier request [matching](/up.network.config#config.requestMetaKeys) the given request options.
|
@@ -17528,7 +17620,11 @@ You can define custom animations using `up.transition()` and
|
|
17528
17620
|
abortRequests();
|
17529
17621
|
queue.reset();
|
17530
17622
|
config.reset();
|
17531
|
-
|
17623
|
+
cache.clear();
|
17624
|
+
if (progressBar != null) {
|
17625
|
+
progressBar.destroy();
|
17626
|
+
}
|
17627
|
+
return progressBar = null;
|
17532
17628
|
};
|
17533
17629
|
|
17534
17630
|
/***
|
@@ -17865,10 +17961,12 @@ You can define custom animations using `up.transition()` and
|
|
17865
17961
|
This event is [emitted](/up.emit) when [AJAX requests](/up.request)
|
17866
17962
|
are taking long to finish.
|
17867
17963
|
|
17868
|
-
By default Unpoly will wait
|
17869
|
-
before emitting `up:request:late`. You
|
17964
|
+
By default Unpoly will wait 400 ms for an AJAX request to finish
|
17965
|
+
before emitting `up:request:late`. You may configure this delay like this:
|
17870
17966
|
|
17871
|
-
|
17967
|
+
```js
|
17968
|
+
up.network.config.badResponseTime = 1000 // milliseconds
|
17969
|
+
```
|
17872
17970
|
|
17873
17971
|
Once all responses have been received, an [`up:request:recover`](/up:request:recover)
|
17874
17972
|
will be emitted.
|
@@ -17876,34 +17974,40 @@ You can define custom animations using `up.transition()` and
|
|
17876
17974
|
Note that if additional requests are made while Unpoly is already busy
|
17877
17975
|
waiting, **no** additional `up:request:late` events will be triggered.
|
17878
17976
|
|
17879
|
-
\#\#\#
|
17977
|
+
\#\#\# Loading indicators
|
17978
|
+
|
17979
|
+
By default the `up:request:late` event will cause a [progress bar](/up.network.config#config.progressBar)
|
17980
|
+
to appear at the top edge of the screen.
|
17880
17981
|
|
17881
|
-
|
17882
|
-
and [`up:request:recover`](/up:request:recover) events to implement a
|
17883
|
-
that appears during
|
17884
|
-
and disappears once the response has been received:
|
17982
|
+
If you don't like the default progress bar, you can [listen](/up.on) to the `up:request:late`
|
17983
|
+
and [`up:request:recover`](/up:request:recover) events to implement a custom
|
17984
|
+
loading indicator that appears during long-running requests.
|
17885
17985
|
|
17886
|
-
|
17986
|
+
To build a custom loading indicator, please an element like this in your application layout:
|
17887
17987
|
|
17888
|
-
|
17988
|
+
```html
|
17989
|
+
<loading-indicator>Please wait!</loading-indicator>
|
17990
|
+
```
|
17889
17991
|
|
17890
|
-
|
17891
|
-
|
17892
|
-
hide = () => { up.element.hide(element) }
|
17992
|
+
Now add a [compiler](/up.compiler) that hides the `<loading-indicator>` element
|
17993
|
+
while there are no long-running requests:
|
17893
17994
|
|
17894
|
-
|
17995
|
+
```js
|
17996
|
+
// Disable the default progress bar
|
17997
|
+
up.network.config.progressBar = false
|
17895
17998
|
|
17896
|
-
|
17897
|
-
|
17898
|
-
|
17899
|
-
]
|
17900
|
-
})
|
17999
|
+
up.compiler('loading-indicator', function(indicator) {
|
18000
|
+
function show() { up.element.show(indicator) }
|
18001
|
+
function hide() { up.element.hide(indicator) }
|
17901
18002
|
|
17902
|
-
|
17903
|
-
to prevent the spinner from flickering on and off.
|
17904
|
-
You can change (or remove) this delay like this:
|
18003
|
+
hide()
|
17905
18004
|
|
17906
|
-
|
18005
|
+
return [
|
18006
|
+
up.on('up:request:late', show),
|
18007
|
+
up.on('up:request:recover', hide)
|
18008
|
+
]
|
18009
|
+
})
|
18010
|
+
```
|
17907
18011
|
|
17908
18012
|
@event up:request:late
|
17909
18013
|
@stable
|
@@ -17992,6 +18096,16 @@ You can define custom animations using `up.transition()` and
|
|
17992
18096
|
isSafeMethod = function(method) {
|
17993
18097
|
return u.contains(['GET', 'OPTIONS', 'HEAD'], u.normalizeMethod(method));
|
17994
18098
|
};
|
18099
|
+
onLate = function() {
|
18100
|
+
if (u.evalOption(config.progressBar)) {
|
18101
|
+
return progressBar = new up.ProgressBar();
|
18102
|
+
}
|
18103
|
+
};
|
18104
|
+
onRecover = function() {
|
18105
|
+
return progressBar != null ? progressBar.conclude() : void 0;
|
18106
|
+
};
|
18107
|
+
up.on('up:request:late', onLate);
|
18108
|
+
up.on('up:request:recover', onRecover);
|
17995
18109
|
up.on('up:framework:reset', reset);
|
17996
18110
|
return {
|
17997
18111
|
request: makeRequest,
|
@@ -18149,7 +18263,7 @@ You can define custom animations using `up.transition()` and
|
|
18149
18263
|
@param {string} config.overlay.dismissAriaLabel
|
18150
18264
|
The accessibility label for the dismiss icon in the top-right corner.
|
18151
18265
|
|
18152
|
-
@param {string|boolean} config.overlay.
|
18266
|
+
@param {string|boolean} config.overlay.history='auto'
|
18153
18267
|
Whether the layer's location or title will be visible in the browser's
|
18154
18268
|
address bar and window title.
|
18155
18269
|
|
@@ -18190,7 +18304,7 @@ You can define custom animations using `up.transition()` and
|
|
18190
18304
|
},
|
18191
18305
|
root: {
|
18192
18306
|
mainTargets: ['[up-main~=root]'],
|
18193
|
-
|
18307
|
+
history: true
|
18194
18308
|
},
|
18195
18309
|
overlay: {
|
18196
18310
|
mainTargets: ['[up-main~=overlay]'],
|
@@ -18199,7 +18313,7 @@ You can define custom animations using `up.transition()` and
|
|
18199
18313
|
dismissLabel: '×',
|
18200
18314
|
dismissAriaLabel: 'Dismiss dialog',
|
18201
18315
|
dismissable: true,
|
18202
|
-
|
18316
|
+
history: 'auto'
|
18203
18317
|
},
|
18204
18318
|
cover: {
|
18205
18319
|
mainTargets: ['[up-main~=cover]']
|
@@ -18311,7 +18425,7 @@ You can define custom animations using `up.transition()` and
|
|
18311
18425
|
normalizeLayerOptions: false
|
18312
18426
|
}));
|
18313
18427
|
};
|
18314
|
-
build = function(options) {
|
18428
|
+
build = function(options, beforeNew) {
|
18315
18429
|
var Class, configs, handleDeprecatedConfig, mode;
|
18316
18430
|
mode = options.mode;
|
18317
18431
|
Class = config[mode].Class;
|
@@ -18323,6 +18437,9 @@ You can define custom animations using `up.transition()` and
|
|
18323
18437
|
mode: mode,
|
18324
18438
|
stack: stack
|
18325
18439
|
}], [options]));
|
18440
|
+
if (beforeNew) {
|
18441
|
+
options = beforeNew(options);
|
18442
|
+
}
|
18326
18443
|
return new Class(options);
|
18327
18444
|
};
|
18328
18445
|
openCallbackAttr = function(link, attr) {
|
@@ -18389,7 +18506,7 @@ You can define custom animations using `up.transition()` and
|
|
18389
18506
|
|
18390
18507
|
Passing `true` or `false` will enable or disable all dismiss controls.
|
18391
18508
|
|
18392
|
-
@param {boolean|string} [options.
|
18509
|
+
@param {boolean|string} [options.history]
|
18393
18510
|
Whether history of the overlay content is visible.
|
18394
18511
|
|
18395
18512
|
If set to `true` the overlay location and title will be shown in browser UI.
|
@@ -18556,7 +18673,7 @@ You can define custom animations using `up.transition()` and
|
|
18556
18673
|
This event is emitted after a layer's [location property](/up.Layer.prototype.location)
|
18557
18674
|
has changed value.
|
18558
18675
|
|
18559
|
-
This event is also emitted when a layer [without visible history](/up.Layer.prototype.
|
18676
|
+
This event is also emitted when a layer [without visible history](/up.Layer.prototype.history)
|
18560
18677
|
has reached a new location.
|
18561
18678
|
|
18562
18679
|
@param {string} event.location
|
@@ -18659,7 +18776,7 @@ You can define custom animations using `up.transition()` and
|
|
18659
18776
|
|
18660
18777
|
See [overlay classes](/customizing-overlays#overlay-classes).
|
18661
18778
|
|
18662
|
-
@param [up-history
|
18779
|
+
@param [up-history]
|
18663
18780
|
Whether history of the overlay content is visible.
|
18664
18781
|
|
18665
18782
|
If set to `true` the overlay location and title will be shown in browser UI.
|
@@ -19107,11 +19224,11 @@ You can define custom animations using `up.transition()` and
|
|
19107
19224
|
Whether fragment updates within the [current layer](/up.layer.current)
|
19108
19225
|
can affect browser history and window title.
|
19109
19226
|
|
19110
|
-
This is a shortcut for `up.layer.current.
|
19111
|
-
See `up.Layer#
|
19227
|
+
This is a shortcut for `up.layer.current.history`.
|
19228
|
+
See `up.Layer#history` for more documentation.
|
19112
19229
|
|
19113
|
-
@property up.layer.
|
19114
|
-
@param {boolean}
|
19230
|
+
@property up.layer.history
|
19231
|
+
@param {boolean} history
|
19115
19232
|
@stable
|
19116
19233
|
*/
|
19117
19234
|
|
@@ -19147,7 +19264,7 @@ You can define custom animations using `up.transition()` and
|
|
19147
19264
|
If no context has been set an empty object is returned.
|
19148
19265
|
@experimental
|
19149
19266
|
*/
|
19150
|
-
u.delegate(api, ['accept', 'dismiss', 'isRoot', 'isOverlay', 'isFront', 'on', 'off', 'emit', 'parent', '
|
19267
|
+
u.delegate(api, ['accept', 'dismiss', 'isRoot', 'isOverlay', 'isFront', 'on', 'off', 'emit', 'parent', 'history', 'location', 'mode', 'context', 'element', 'contains', 'size', 'affix'], function() {
|
19151
19268
|
return stack.current;
|
19152
19269
|
});
|
19153
19270
|
return api;
|
@@ -19185,8 +19302,8 @@ the targeted fragments and discard the rest:
|
|
19185
19302
|
|
19186
19303
|
![Unpoly page flow](/images/tutorial/fragment_flow_unpoly.svg){:width="620" class="picture has_border is_sepia has_padding"}
|
19187
19304
|
|
19188
|
-
With this model, following links feels smooth. All
|
19189
|
-
Pages also load much faster since the DOM, CSS and
|
19305
|
+
With this model, following links feels smooth. All DOM state outside the updated fragment is preserved.
|
19306
|
+
Pages also load much faster since the DOM, CSS and JavaScript environments do not need to be
|
19190
19307
|
destroyed and recreated for every request.
|
19191
19308
|
|
19192
19309
|
|
@@ -19244,7 +19361,7 @@ new page is loading.
|
|
19244
19361
|
lastMousedownTarget = null;
|
19245
19362
|
LINKS_WITH_LOCAL_HTML = ['a[up-content]', 'a[up-fragment]', 'a[up-document]'];
|
19246
19363
|
LINKS_WITH_REMOTE_HTML = ['a[href]', '[up-href]'];
|
19247
|
-
ATTRIBUTES_SUGGESTING_FOLLOW = ['[up-follow]', '[up-target]', '[up-layer]', '[up-transition]', '[up-preload]'];
|
19364
|
+
ATTRIBUTES_SUGGESTING_FOLLOW = ['[up-follow]', '[up-target]', '[up-layer]', '[up-transition]', '[up-preload]', '[up-instant]'];
|
19248
19365
|
combineFollowableSelectors = function(elementSelectors, attributeSelectors) {
|
19249
19366
|
return u.flatMap(elementSelectors, function(elementSelector) {
|
19250
19367
|
return attributeSelectors.map(function(attributeSelector) {
|
@@ -19532,7 +19649,7 @@ new page is loading.
|
|
19532
19649
|
parser.string('dismissEvent');
|
19533
19650
|
parser.string('acceptLocation');
|
19534
19651
|
parser.string('dismissLocation');
|
19535
|
-
parser.booleanOrString('
|
19652
|
+
parser.booleanOrString('history');
|
19536
19653
|
parser.booleanOrString('focus');
|
19537
19654
|
parser.boolean('saveScroll');
|
19538
19655
|
parser.booleanOrString('scroll');
|
@@ -19942,10 +20059,13 @@ new page is loading.
|
|
19942
20059
|
@param [up-method='get']
|
19943
20060
|
The HTTP method to use for the request.
|
19944
20061
|
|
19945
|
-
Common values are `get`, `post`, `put`, `patch` and `delete`.
|
20062
|
+
Common values are `get`, `post`, `put`, `patch` and `delete`. The value is case insensitive.
|
19946
20063
|
|
19947
20064
|
The HTTP method may also be passed as an `[data-method]` attribute.
|
19948
20065
|
|
20066
|
+
By default, methods other than `get` or `post` will be converted into a `post` request, and carry
|
20067
|
+
their original method as a configurable [`_method` parameter](/up.protocol.config#config.methodParam).
|
20068
|
+
|
19949
20069
|
@param [up-params]
|
19950
20070
|
A JSON object with additional [parameters](/up.Params) that should be sent as the request's
|
19951
20071
|
[query string](https://en.wikipedia.org/wiki/Query_string) or payload.
|
@@ -20010,9 +20130,6 @@ new page is loading.
|
|
20010
20130
|
|
20011
20131
|
If set to `false`, the history will remain unchanged.
|
20012
20132
|
|
20013
|
-
[Overlays](/up.layer) will only change the browser URL and window title if the overlay
|
20014
|
-
has [visible history](/up.layer.historyVisible), even when `[up-history=true]` is set.
|
20015
|
-
|
20016
20133
|
@param [up-title]
|
20017
20134
|
An explicit document title to use after rendering.
|
20018
20135
|
|
@@ -20714,8 +20831,17 @@ The `up.form` module helps you work with non-trivial forms.
|
|
20714
20831
|
@function up.validate
|
20715
20832
|
@param {string|Element|jQuery} field
|
20716
20833
|
The form field to validate.
|
20834
|
+
@param {Object} [options]
|
20835
|
+
Additional [submit options](/up.submit#options) that should be used for
|
20836
|
+
submitting the form for validation.
|
20837
|
+
|
20838
|
+
You may pass this `options` object to supplement or override the defaults
|
20839
|
+
from `up.submit()`.
|
20717
20840
|
@param {string|Element|jQuery} [options.target]
|
20718
20841
|
The element that will be [updated](/up.render) with the validation results.
|
20842
|
+
|
20843
|
+
By default the closest [validate target](/up.form.config#config.validateTargets)
|
20844
|
+
around the given `field` is updated.
|
20719
20845
|
@return {Promise}
|
20720
20846
|
A promise that fulfills when the server-side
|
20721
20847
|
validation is received and the form was updated.
|
@@ -21800,7 +21926,7 @@ Once the response is received the URL will change to `/bar` and the `up-active`
|
|
21800
21926
|
When no [overlay](/up.layer) is open, the current location is the URL displayed
|
21801
21927
|
in the browser's address bar. When the link in question is placed in an overlay,
|
21802
21928
|
the current location is the location of that overlay, even if that
|
21803
|
-
overlay doesn't have [visible history](/up.Layer.prototype.
|
21929
|
+
overlay doesn't have [visible history](/up.Layer.prototype.history).
|
21804
21930
|
|
21805
21931
|
A link matches the current location (and is marked as `.up-current`) if it matches either:
|
21806
21932
|
|