unpoly-rails 2.2.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of unpoly-rails might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +25 -0
- data/assets/unpoly/unpoly-migrate.js +39 -14
- data/assets/unpoly/unpoly-migrate.min.js +1 -1
- data/assets/unpoly/unpoly.es5.js +746 -298
- data/assets/unpoly/unpoly.es5.min.js +1 -1
- data/assets/unpoly/unpoly.js +738 -309
- data/assets/unpoly/unpoly.min.js +1 -1
- data/lib/unpoly/rails/change.rb +13 -0
- 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: 91c3f510e29295809e0304db849e1853897d8f14fbe6b363519458dca5c0294a
|
4
|
+
data.tar.gz: 43a927f3a2946f63e02c2676514eeee7d5689750e38de4528d6d140e1be2a47e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 501d2a3533c6c3225fd702d6ce4de682c0359d13f9e8063c1390c547ec8782afb0f70597e9b768ce945b69fde2b72c21a1bcc099c13b15d7107207201ebd5300
|
7
|
+
data.tar.gz: 513bbe7a3764942a35696d3ea5d7335fff289b914732a1b17bbe31f5da896ca7979f263e8fa000373641dd939f1a2e1bb2c26cf6b5290325fc24598b2cff8a3a
|
data/README.md
CHANGED
@@ -242,6 +242,31 @@ Only rendering when needed saves <b>CPU time</b> on your server, which spends mo
|
|
242
242
|
This also reduces the <b>bandwidth cost</b> for a request/response exchange to **~1 KB**.
|
243
243
|
|
244
244
|
|
245
|
+
### Allowing callbacks with a strict CSP
|
246
|
+
|
247
|
+
When your Content Security Policy disallows `eval()`, Unpoly cannot directly run callbacks HTML attributes. This affects `[up-]` attributes like `[up-on-loaded]` or `[up-on-accepted]`. See [Unpoly's CSP guide](https://unpoly.com/csp) for details.
|
248
|
+
|
249
|
+
The following callback would crash the fragment update with an error like `Uncaught EvalError: call to Function() blocked by CSP`:
|
250
|
+
|
251
|
+
```ruby
|
252
|
+
link_to 'Click me', '/path, 'up-follow': true, 'up-on-loaded': "alert()"
|
253
|
+
```
|
254
|
+
|
255
|
+
Unpoly lets your work around this by prefixing your callback with your response's [CSP nonce](https://content-security-policy.com/nonce/):
|
256
|
+
|
257
|
+
```ruby
|
258
|
+
link_to 'Click me', '/path', 'up-follow': true, 'up-on-loaded': 'nonce-kO52Iphm8BAVrcdGcNYjIA== alert()')
|
259
|
+
```
|
260
|
+
|
261
|
+
To keep your callbacks compact, you may use the `up.safe_callback` helper for this:
|
262
|
+
|
263
|
+
```ruby
|
264
|
+
link_to 'Click me', '/path, 'up-follow': true, 'up-on-loaded': up.safe_callback("alert()")
|
265
|
+
```
|
266
|
+
|
267
|
+
For this to work you must also include the `<meta name="csp-nonce">` tag in the `<head>` of your initial page. Rails has a [`csp_meta_tag`](https://api.rubyonrails.org/classes/ActionView/Helpers/CspHelper.html#method-i-csp_meta_tag) helper for that purpose.
|
268
|
+
|
269
|
+
|
245
270
|
### Working with context
|
246
271
|
|
247
272
|
Calling `up.context` will return the [context](https://unpoly.com/up.context) object of the targeted layer.
|
@@ -253,6 +253,30 @@ up.util.times = function (count, block) {
|
|
253
253
|
/* 3 */
|
254
254
|
/***/ (function() {
|
255
255
|
|
256
|
+
up.browser.loadPage = function () {
|
257
|
+
var _a;
|
258
|
+
var args = [];
|
259
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
260
|
+
args[_i] = arguments[_i];
|
261
|
+
}
|
262
|
+
up.migrate.deprecated('up.browser.loadPage', 'up.network.loadPage');
|
263
|
+
return (_a = up.network).loadPage.apply(_a, args);
|
264
|
+
};
|
265
|
+
up.browser.isSupported = function () {
|
266
|
+
var _a;
|
267
|
+
var args = [];
|
268
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
269
|
+
args[_i] = arguments[_i];
|
270
|
+
}
|
271
|
+
up.migrate.deprecated('up.browser.isSupported', 'up.framework.isSupported');
|
272
|
+
return (_a = up.framework).isSupported.apply(_a, args);
|
273
|
+
};
|
274
|
+
|
275
|
+
|
276
|
+
/***/ }),
|
277
|
+
/* 4 */
|
278
|
+
/***/ (function() {
|
279
|
+
|
256
280
|
/*-
|
257
281
|
@module up.element
|
258
282
|
*/
|
@@ -294,7 +318,7 @@ up.element.createFromHtml = function () {
|
|
294
318
|
|
295
319
|
|
296
320
|
/***/ }),
|
297
|
-
/*
|
321
|
+
/* 5 */
|
298
322
|
/***/ (function() {
|
299
323
|
|
300
324
|
/*-
|
@@ -333,7 +357,7 @@ up.event.nobodyPrevents = function () {
|
|
333
357
|
|
334
358
|
|
335
359
|
/***/ }),
|
336
|
-
/*
|
360
|
+
/* 6 */
|
337
361
|
/***/ (function() {
|
338
362
|
|
339
363
|
var u = up.util;
|
@@ -369,7 +393,7 @@ up.migrate.targetMacro = function (queryAttr, fixedResultAttrs, callback) {
|
|
369
393
|
|
370
394
|
|
371
395
|
/***/ }),
|
372
|
-
/*
|
396
|
+
/* 7 */
|
373
397
|
/***/ (function() {
|
374
398
|
|
375
399
|
/*-
|
@@ -380,7 +404,7 @@ up.migrate.renamedProperty(up.form.config, 'submitButtons', 'submitButtonSelecto
|
|
380
404
|
|
381
405
|
|
382
406
|
/***/ }),
|
383
|
-
/*
|
407
|
+
/* 8 */
|
384
408
|
/***/ (function() {
|
385
409
|
|
386
410
|
var __assign = (this && this.__assign) || function () {
|
@@ -550,7 +574,7 @@ up.migrate.preprocessRenderOptions = function (options) {
|
|
550
574
|
|
551
575
|
|
552
576
|
/***/ }),
|
553
|
-
/*
|
577
|
+
/* 9 */
|
554
578
|
/***/ (function() {
|
555
579
|
|
556
580
|
/*-
|
@@ -577,7 +601,7 @@ up.migrate.renamedEvent('up:history:replaced', 'up:location:changed');
|
|
577
601
|
|
578
602
|
|
579
603
|
/***/ }),
|
580
|
-
/*
|
604
|
+
/* 10 */
|
581
605
|
/***/ (function() {
|
582
606
|
|
583
607
|
/*-
|
@@ -588,7 +612,7 @@ up.migrate.renamedProperty(up.feedback.config, 'navs', 'navSelectors');
|
|
588
612
|
|
589
613
|
|
590
614
|
/***/ }),
|
591
|
-
/*
|
615
|
+
/* 11 */
|
592
616
|
/***/ (function() {
|
593
617
|
|
594
618
|
/*-
|
@@ -635,7 +659,7 @@ up.migrate.targetMacro('up-dash', { 'up-preload': '', 'up-instant': '' }, functi
|
|
635
659
|
|
636
660
|
|
637
661
|
/***/ }),
|
638
|
-
/*
|
662
|
+
/* 12 */
|
639
663
|
/***/ (function() {
|
640
664
|
|
641
665
|
/*-
|
@@ -702,7 +726,7 @@ up.util.getter(up.Layer.prototype, 'historyVisible', function () {
|
|
702
726
|
|
703
727
|
|
704
728
|
/***/ }),
|
705
|
-
/*
|
729
|
+
/* 13 */
|
706
730
|
/***/ (function() {
|
707
731
|
|
708
732
|
/*-
|
@@ -894,7 +918,7 @@ up.migrate.targetMacro('up-drawer', { 'up-layer': 'new drawer' }, function () {
|
|
894
918
|
|
895
919
|
|
896
920
|
/***/ }),
|
897
|
-
/*
|
921
|
+
/* 14 */
|
898
922
|
/***/ (function() {
|
899
923
|
|
900
924
|
/*-
|
@@ -1021,7 +1045,7 @@ up.migrate.targetMacro('up-popup', { 'up-layer': 'new popup' }, function () { re
|
|
1021
1045
|
|
1022
1046
|
|
1023
1047
|
/***/ }),
|
1024
|
-
/*
|
1048
|
+
/* 15 */
|
1025
1049
|
/***/ (function() {
|
1026
1050
|
|
1027
1051
|
/*-
|
@@ -1040,7 +1064,7 @@ up.macro('[up-tooltip]', function (opener) {
|
|
1040
1064
|
|
1041
1065
|
|
1042
1066
|
/***/ }),
|
1043
|
-
/*
|
1067
|
+
/* 16 */
|
1044
1068
|
/***/ (function() {
|
1045
1069
|
|
1046
1070
|
var u = up.util;
|
@@ -1180,7 +1204,7 @@ up.on('up:framework:reset', disableProgressBarIfCustomIndicator);
|
|
1180
1204
|
|
1181
1205
|
|
1182
1206
|
/***/ }),
|
1183
|
-
/*
|
1207
|
+
/* 17 */
|
1184
1208
|
/***/ (function() {
|
1185
1209
|
|
1186
1210
|
/*-
|
@@ -1190,7 +1214,7 @@ up.migrate.renamedProperty(up.radio.config, 'hungry', 'hungrySelectors');
|
|
1190
1214
|
|
1191
1215
|
|
1192
1216
|
/***/ }),
|
1193
|
-
/*
|
1217
|
+
/* 18 */
|
1194
1218
|
/***/ (function() {
|
1195
1219
|
|
1196
1220
|
/*-
|
@@ -1272,6 +1296,7 @@ __webpack_require__(14);
|
|
1272
1296
|
__webpack_require__(15);
|
1273
1297
|
__webpack_require__(16);
|
1274
1298
|
__webpack_require__(17);
|
1299
|
+
__webpack_require__(18);
|
1275
1300
|
up.framework.stopExtension();
|
1276
1301
|
|
1277
1302
|
}();
|
@@ -1 +1 @@
|
|
1
|
-
!function(){var e={700:function(){up.element.first=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.deprecated("up.element.first()","up.element.get()"),(e=up.element).get.apply(e,r)},up.element.createFromHtml=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.deprecated("up.element.createFromHtml","up.element.createFromHTML"),(e=up.element).createFromHTML.apply(e,r)}},394:function(){up.migrate.renamedPackage("bus","event"),up.event.nobodyPrevents=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];up.migrate.deprecated("up.event.nobodyPrevents(type)","!up.emit(type).defaultPrevented");var t=up.emit.apply(up,e);return!t.defaultPrevented}},729:function(){up.migrate.renamedPackage("navigation","feedback"),up.migrate.renamedProperty(up.feedback.config,"navs","navSelectors")},305:function(){up.migrate.renamedProperty(up.form.config,"fields","fieldSelectors"),up.migrate.renamedProperty(up.form.config,"submitButtons","submitButtonSelectors")},354:function(){var e=this&&this.__assign||function(){return(e=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e}).apply(this,arguments)},r=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(r,t,a){return up.migrate.deprecated("up.replace(target, url)","up.navigate(target, { url })"),up.navigate(e(e({},a),{target:r,url:t}))},up.extract=function(r,t,a){return up.migrate.deprecated("up.extract(target, document)","up.navigate(target, { document })"),up.navigate(e(e({},a),{target:r,document:t}))},up.fragment.first=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.deprecated("up.fragment.first()","up.fragment.get()"),(e=up.fragment).get.apply(e,r)},up.first=up.fragment.first,up.migrate.handleScrollOptions=function(e){r.isUndefined(e.scroll)&&(r.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),r.isDefined(e.resetScroll)&&(up.migrate.deprecated("Option { resetScroll: true }","{ scroll: 'reset' }"),e.scroll="teset"),r.isDefined(e.restoreScroll)&&(up.migrate.deprecated("Option { restoreScroll: true }","{ scroll: 'restore' }"),e.scroll="restore"))},up.migrate.handleHistoryOption=function(e){r.isString(e.history)&&"auto"!==e.history&&(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){up.migrate.handleHistoryOption(e);for(var t=0,a=["target","origin"];t<a.length;t++){var n=a[t];r.isJQuery(e[n])&&(up.migrate.warn("Passing a jQuery collection as { %s } is deprecated. Pass it as a native element instead.",n),e[n]=up.element.get(e[n]))}}},869: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")},905:function(){up.migrate.handleLayerOptions=function(e){up.migrate.fixKey(e,"flavor","mode"),up.migrate.fixKey(e,"closable","dismissable"),up.migrate.fixKey(e,"closeLabel","dismissLabel");for(var r=0,t=["width","maxWidth","height"];r<t.length;r++){var a=t[r];e[a]&&up.migrate.warn("Layer option { "+a+" } has been removed. Use { size } or { class } instead.")}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||(up.migrate.warn("Option { layer: '"+e.layer+"' } has been removed. Did you mean { layer: 'overlay' }?"),e.layer="overlay")},up.migrate.handleTetherOptions=function(e){var r=e.position.split("-"),t=r[0],a=r[1];a&&(up.migrate.warn("The position value %o is deprecated. Use %o instead.",e.position,{position:t,align:a}),e.position=t,e.align=a)},up.migrate.registerLayerCloser=function(e){return e.registerClickCloser("up-close",(function(r,t){up.migrate.deprecated("[up-close]","[up-dismiss]"),e.dismiss(r,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}))},969:function(){up.migrate.parseFollowOptions=function(e){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")}))},992:function(){var e=this&&this.__spreadArray||function(e,r){for(var t=0,a=r.length,n=e.length;t<a;t++,n++)e[n]=r[t];return e},r=up.util;up.migrate=function(){var t=new up.Config((function(){return{logLevel:"warn"}})),a={};function n(e){var r=a[e];return r?(u("Event "+e+" has been renamed to "+r),r):e}var p={};function u(a){for(var n,u=[],o=1;o<arguments.length;o++)u[o-1]=arguments[o];var i=r.sprintf.apply(r,e([a],u));p[i]||(p[i]=!0,(n=up.log)[t.logLevel].apply(n,e(["unpoly-migrate",a],u)))}return up.on("up:framework:reset",(function(){t.reset()})),{deprecated:function(e,r){u(e+" has been deprecated. Use "+r+" instead.")},renamedPackage:function(e,r){Object.defineProperty(up,e,{get:function(){return u("up."+e+" has been renamed to up."+r),up[r]}})},renamedProperty:function(e,r,t){var a=function(){return u("Property { %s } has been renamed to { %s } (found in %o)",r,t,e)};return Object.defineProperty(e,r,{get:function(){return a(),this[t]},set:function(e){a(),this[t]=e}})},formerlyAsync:function(e){var r=Promise.resolve(),t=r.then;return r.then=function(){return u(e+" is now a sync function"),t.apply(this,arguments)},r},renamedEvent:function(e,r){a[e]=r},fixEventTypes:function(e){return r.uniq(r.map(e,n))},fixKey:function(e,t,a){r.isDefined(e[t])&&(u("Property { %s } has been renamed to { %s } (found in %o)",t,a,e),r.renameKey(e,t,a))},warn:u,loaded:!0,config:t}}()},413:function(){var e=this&&this.__assign||function(){return(e=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e}).apply(this,arguments)},r=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={visit:function(r,t){return void 0===t&&(t={}),up.migrate.deprecated("up.modal.visit(url)",'up.layer.open({ url, mode: "modal" })'),up.layer.open(e(e({},t),{url:r,mode:"modal"}))},follow:function(r,t){return void 0===t&&(t={}),up.migrate.deprecated("up.modal.follow(link)",'up.follow(link, { layer: "modal" })'),up.follow(r,e(e({},t),{layer:"modal"}))},extract:function(r,t,a){return void 0===a&&(a={}),up.migrate.deprecated("up.modal.extract(target, document)",'up.layer.open({ document, mode: "modal" })'),up.layer.open(e(e({},a),{target:r,html:t,layer:"modal"}))},close:function(e){return void 0===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)||void 0===e?void 0:e.location},get config(){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(){throw r},flavor:function(){throw r}},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"]')}))},885:function(){var e=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");var 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){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(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];up.migrate.deprecated("up.ajax()","up.request()");var t=function(e){return e.text};return up.request.apply(up,e).then(t)},up.network.clear=function(){up.migrate.deprecated("up.proxy.clear()","up.cache.clear()"),up.cache.clear()},up.network.preload=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.deprecated("up.proxy.preload(link)","up.link.preload(link)"),(e=up.link).preload.apply(e,r)},up.Request.prototype.navigate=function(){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};var t=up.network.config.progressBar;function a(){up.network.config.progressBar=function(){return r=up.EventListener.allNonDefault(document),e.find(r,(function(e){return"up:request:late"===e.eventType}))?(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):t;var r}}a(),up.on("up:framework:reset",a)},69:function(){var e=this&&this.__assign||function(){return(e=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e}).apply(this,arguments)};up.popup={attach:function(r,t){return void 0===t&&(t={}),r=up.fragment.get(r),up.migrate.deprecated("up.popup.attach(origin)","up.layer.open({ origin, layer: 'popup' })"),up.layer.open(e(e({},t),{origin:r,layer:"popup"}))},close:function(e){return void 0===e&&(e={}),up.migrate.deprecated("up.popup.close()","up.layer.dismiss()"),up.layer.dismiss(null,e),up.migrate.formerlyAsync("up.layer.dismiss()")},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)||void 0===e?void 0:e.location},get config(){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"]')}))},228:function(){up.migrate.renamedProperty(up.radio.config,"hungry","hungrySelectors")},629:function(){var e=up.util,r=up.element;up.migrate.postCompile=function(r,t){var a;if(a=t.keep){up.migrate.warn("The { keep: true } option for up.compiler() has been removed. Have the compiler set [up-keep] attribute instead.");for(var n=e.isString(a)?a:"",p=0,u=r;p<u.length;p++)u[p].setAttribute("up-keep",n)}},up.migrate.targetMacro=function(t,a,n){up.macro("["+t+"]",(function(p){var u,o=e.copy(a);(u=p.getAttribute(t))?o["up-target"]=u:o["up-follow"]="",r.setMissingAttrs(p,o),p.removeAttribute(t),null==n||n()}))}},197:function(){up.macro("[up-tooltip]",(function(e){up.migrate.warn("[up-tooltip] has been deprecated. A [title] was set instead."),up.element.setMissingAttr(e,"title",e.getAttribute("up-tooltip"))}))},480:function(){up.util.only=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return up.migrate.deprecated("up.util.only(object, ...keys)","up.util.pick(object, keys)"),up.util.pick(e,r)},up.util.except=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return up.migrate.deprecated("up.util.except(object, ...keys)","up.util.omit(object, keys)"),up.util.omit(e,r)},up.util.parseUrl=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.warn("up.util.parseUrl() has been renamed to up.util.parseURL()"),(e=up.util).parseURL.apply(e,r)},up.util.any=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.warn("up.util.any() has been renamed to up.util.some()"),(e=up.util).some.apply(e,r)},up.util.all=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.warn("up.util.all() has been renamed to up.util.every()"),(e=up.util).every.apply(e,r)},up.util.detect=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.warn("up.util.detect() has been renamed to up.util.find()"),(e=up.util).find.apply(e,r)},up.util.select=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.warn("up.util.select() has been renamed to up.util.filter()"),(e=up.util).filter.apply(e,r)},up.util.setTimer=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.warn("up.util.setTimer() has been renamed to up.util.timer()"),(e=up.util).timer.apply(e,r)},up.util.escapeHtml=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.deprecated("up.util.escapeHtml","up.util.escapeHTML"),(e=up.util).escapeHTML.apply(e,r)},up.util.selectorForElement=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.warn("up.util.selectorForElement() has been renamed to up.fragment.toTarget()"),(e=up.fragment).toTarget.apply(e,r)},up.util.nextFrame=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.warn("up.util.nextFrame() has been renamed to up.util.task()"),(e=up.util).task.apply(e,r)},up.util.times=function(e,r){for(var t=0;t<e;t++)r()}},338:function(){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(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.deprecated("up.viewport.closest()","up.viewport.get()"),(e=up.viewport).get.apply(e,r)}}},r={};function t(a){var n=r[a];if(void 0!==n)return n.exports;var p=r[a]={exports:{}};return e[a].call(p.exports,p,p.exports,t),p.exports}up.framework.startExtension(),t(992),t(480),t(700),t(394),t(629),t(305),t(354),t(869),t(729),t(969),t(905),t(413),t(69),t(197),t(885),t(228),t(338),up.framework.stopExtension()}();
|
1
|
+
!function(){var e={294:function(){up.browser.loadPage=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.deprecated("up.browser.loadPage","up.network.loadPage"),(e=up.network).loadPage.apply(e,r)},up.browser.isSupported=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.deprecated("up.browser.isSupported","up.framework.isSupported"),(e=up.framework).isSupported.apply(e,r)}},700:function(){up.element.first=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.deprecated("up.element.first()","up.element.get()"),(e=up.element).get.apply(e,r)},up.element.createFromHtml=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.deprecated("up.element.createFromHtml","up.element.createFromHTML"),(e=up.element).createFromHTML.apply(e,r)}},394:function(){up.migrate.renamedPackage("bus","event"),up.event.nobodyPrevents=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];up.migrate.deprecated("up.event.nobodyPrevents(type)","!up.emit(type).defaultPrevented");var t=up.emit.apply(up,e);return!t.defaultPrevented}},729:function(){up.migrate.renamedPackage("navigation","feedback"),up.migrate.renamedProperty(up.feedback.config,"navs","navSelectors")},305:function(){up.migrate.renamedProperty(up.form.config,"fields","fieldSelectors"),up.migrate.renamedProperty(up.form.config,"submitButtons","submitButtonSelectors")},354:function(){var e=this&&this.__assign||function(){return(e=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e}).apply(this,arguments)},r=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(r,t,a){return up.migrate.deprecated("up.replace(target, url)","up.navigate(target, { url })"),up.navigate(e(e({},a),{target:r,url:t}))},up.extract=function(r,t,a){return up.migrate.deprecated("up.extract(target, document)","up.navigate(target, { document })"),up.navigate(e(e({},a),{target:r,document:t}))},up.fragment.first=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.deprecated("up.fragment.first()","up.fragment.get()"),(e=up.fragment).get.apply(e,r)},up.first=up.fragment.first,up.migrate.handleScrollOptions=function(e){r.isUndefined(e.scroll)&&(r.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),r.isDefined(e.resetScroll)&&(up.migrate.deprecated("Option { resetScroll: true }","{ scroll: 'reset' }"),e.scroll="teset"),r.isDefined(e.restoreScroll)&&(up.migrate.deprecated("Option { restoreScroll: true }","{ scroll: 'restore' }"),e.scroll="restore"))},up.migrate.handleHistoryOption=function(e){r.isString(e.history)&&"auto"!==e.history&&(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){up.migrate.handleHistoryOption(e);for(var t=0,a=["target","origin"];t<a.length;t++){var n=a[t];r.isJQuery(e[n])&&(up.migrate.warn("Passing a jQuery collection as { %s } is deprecated. Pass it as a native element instead.",n),e[n]=up.element.get(e[n]))}}},869: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")},905:function(){up.migrate.handleLayerOptions=function(e){up.migrate.fixKey(e,"flavor","mode"),up.migrate.fixKey(e,"closable","dismissable"),up.migrate.fixKey(e,"closeLabel","dismissLabel");for(var r=0,t=["width","maxWidth","height"];r<t.length;r++){var a=t[r];e[a]&&up.migrate.warn("Layer option { "+a+" } has been removed. Use { size } or { class } instead.")}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||(up.migrate.warn("Option { layer: '"+e.layer+"' } has been removed. Did you mean { layer: 'overlay' }?"),e.layer="overlay")},up.migrate.handleTetherOptions=function(e){var r=e.position.split("-"),t=r[0],a=r[1];a&&(up.migrate.warn("The position value %o is deprecated. Use %o instead.",e.position,{position:t,align:a}),e.position=t,e.align=a)},up.migrate.registerLayerCloser=function(e){return e.registerClickCloser("up-close",(function(r,t){up.migrate.deprecated("[up-close]","[up-dismiss]"),e.dismiss(r,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}))},969:function(){up.migrate.parseFollowOptions=function(e){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")}))},992:function(){var e=this&&this.__spreadArray||function(e,r){for(var t=0,a=r.length,n=e.length;t<a;t++,n++)e[n]=r[t];return e},r=up.util;up.migrate=function(){var t=new up.Config((function(){return{logLevel:"warn"}})),a={};function n(e){var r=a[e];return r?(u("Event "+e+" has been renamed to "+r),r):e}var p={};function u(a){for(var n,u=[],o=1;o<arguments.length;o++)u[o-1]=arguments[o];var i=r.sprintf.apply(r,e([a],u));p[i]||(p[i]=!0,(n=up.log)[t.logLevel].apply(n,e(["unpoly-migrate",a],u)))}return up.on("up:framework:reset",(function(){t.reset()})),{deprecated:function(e,r){u(e+" has been deprecated. Use "+r+" instead.")},renamedPackage:function(e,r){Object.defineProperty(up,e,{get:function(){return u("up."+e+" has been renamed to up."+r),up[r]}})},renamedProperty:function(e,r,t){var a=function(){return u("Property { %s } has been renamed to { %s } (found in %o)",r,t,e)};return Object.defineProperty(e,r,{get:function(){return a(),this[t]},set:function(e){a(),this[t]=e}})},formerlyAsync:function(e){var r=Promise.resolve(),t=r.then;return r.then=function(){return u(e+" is now a sync function"),t.apply(this,arguments)},r},renamedEvent:function(e,r){a[e]=r},fixEventTypes:function(e){return r.uniq(r.map(e,n))},fixKey:function(e,t,a){r.isDefined(e[t])&&(u("Property { %s } has been renamed to { %s } (found in %o)",t,a,e),r.renameKey(e,t,a))},warn:u,loaded:!0,config:t}}()},413:function(){var e=this&&this.__assign||function(){return(e=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e}).apply(this,arguments)},r=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={visit:function(r,t){return void 0===t&&(t={}),up.migrate.deprecated("up.modal.visit(url)",'up.layer.open({ url, mode: "modal" })'),up.layer.open(e(e({},t),{url:r,mode:"modal"}))},follow:function(r,t){return void 0===t&&(t={}),up.migrate.deprecated("up.modal.follow(link)",'up.follow(link, { layer: "modal" })'),up.follow(r,e(e({},t),{layer:"modal"}))},extract:function(r,t,a){return void 0===a&&(a={}),up.migrate.deprecated("up.modal.extract(target, document)",'up.layer.open({ document, mode: "modal" })'),up.layer.open(e(e({},a),{target:r,html:t,layer:"modal"}))},close:function(e){return void 0===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)||void 0===e?void 0:e.location},get config(){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(){throw r},flavor:function(){throw r}},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"]')}))},885:function(){var e=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");var 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){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(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];up.migrate.deprecated("up.ajax()","up.request()");var t=function(e){return e.text};return up.request.apply(up,e).then(t)},up.network.clear=function(){up.migrate.deprecated("up.proxy.clear()","up.cache.clear()"),up.cache.clear()},up.network.preload=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.deprecated("up.proxy.preload(link)","up.link.preload(link)"),(e=up.link).preload.apply(e,r)},up.Request.prototype.navigate=function(){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};var t=up.network.config.progressBar;function a(){up.network.config.progressBar=function(){return r=up.EventListener.allNonDefault(document),e.find(r,(function(e){return"up:request:late"===e.eventType}))?(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):t;var r}}a(),up.on("up:framework:reset",a)},69:function(){var e=this&&this.__assign||function(){return(e=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e}).apply(this,arguments)};up.popup={attach:function(r,t){return void 0===t&&(t={}),r=up.fragment.get(r),up.migrate.deprecated("up.popup.attach(origin)","up.layer.open({ origin, layer: 'popup' })"),up.layer.open(e(e({},t),{origin:r,layer:"popup"}))},close:function(e){return void 0===e&&(e={}),up.migrate.deprecated("up.popup.close()","up.layer.dismiss()"),up.layer.dismiss(null,e),up.migrate.formerlyAsync("up.layer.dismiss()")},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)||void 0===e?void 0:e.location},get config(){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"]')}))},228:function(){up.migrate.renamedProperty(up.radio.config,"hungry","hungrySelectors")},629:function(){var e=up.util,r=up.element;up.migrate.postCompile=function(r,t){var a;if(a=t.keep){up.migrate.warn("The { keep: true } option for up.compiler() has been removed. Have the compiler set [up-keep] attribute instead.");for(var n=e.isString(a)?a:"",p=0,u=r;p<u.length;p++)u[p].setAttribute("up-keep",n)}},up.migrate.targetMacro=function(t,a,n){up.macro("["+t+"]",(function(p){var u,o=e.copy(a);(u=p.getAttribute(t))?o["up-target"]=u:o["up-follow"]="",r.setMissingAttrs(p,o),p.removeAttribute(t),null==n||n()}))}},197:function(){up.macro("[up-tooltip]",(function(e){up.migrate.warn("[up-tooltip] has been deprecated. A [title] was set instead."),up.element.setMissingAttr(e,"title",e.getAttribute("up-tooltip"))}))},480:function(){up.util.only=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return up.migrate.deprecated("up.util.only(object, ...keys)","up.util.pick(object, keys)"),up.util.pick(e,r)},up.util.except=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return up.migrate.deprecated("up.util.except(object, ...keys)","up.util.omit(object, keys)"),up.util.omit(e,r)},up.util.parseUrl=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.warn("up.util.parseUrl() has been renamed to up.util.parseURL()"),(e=up.util).parseURL.apply(e,r)},up.util.any=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.warn("up.util.any() has been renamed to up.util.some()"),(e=up.util).some.apply(e,r)},up.util.all=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.warn("up.util.all() has been renamed to up.util.every()"),(e=up.util).every.apply(e,r)},up.util.detect=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.warn("up.util.detect() has been renamed to up.util.find()"),(e=up.util).find.apply(e,r)},up.util.select=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.warn("up.util.select() has been renamed to up.util.filter()"),(e=up.util).filter.apply(e,r)},up.util.setTimer=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.warn("up.util.setTimer() has been renamed to up.util.timer()"),(e=up.util).timer.apply(e,r)},up.util.escapeHtml=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.deprecated("up.util.escapeHtml","up.util.escapeHTML"),(e=up.util).escapeHTML.apply(e,r)},up.util.selectorForElement=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.warn("up.util.selectorForElement() has been renamed to up.fragment.toTarget()"),(e=up.fragment).toTarget.apply(e,r)},up.util.nextFrame=function(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.warn("up.util.nextFrame() has been renamed to up.util.task()"),(e=up.util).task.apply(e,r)},up.util.times=function(e,r){for(var t=0;t<e;t++)r()}},338:function(){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(){for(var e,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return up.migrate.deprecated("up.viewport.closest()","up.viewport.get()"),(e=up.viewport).get.apply(e,r)}}},r={};function t(a){var n=r[a];if(void 0!==n)return n.exports;var p=r[a]={exports:{}};return e[a].call(p.exports,p,p.exports,t),p.exports}up.framework.startExtension(),t(992),t(480),t(294),t(700),t(394),t(629),t(305),t(354),t(869),t(729),t(969),t(905),t(413),t(69),t(197),t(885),t(228),t(338),up.framework.stopExtension()}();
|
data/assets/unpoly/unpoly.es5.js
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
@module up
|
9
9
|
*/
|
10
10
|
window.up = {
|
11
|
-
version: '2.
|
11
|
+
version: '2.3.0'
|
12
12
|
};
|
13
13
|
|
14
14
|
|
@@ -1238,7 +1238,7 @@ up.util = (function () {
|
|
1238
1238
|
|
1239
1239
|
@function up.util.pickBy
|
1240
1240
|
@param {Object} object
|
1241
|
-
@param {Function
|
1241
|
+
@param {Function(string, string, object): boolean} tester
|
1242
1242
|
A function that will be called with each property.
|
1243
1243
|
|
1244
1244
|
The arguments are the property value, key and the entire object.
|
@@ -2070,7 +2070,7 @@ up.util = (function () {
|
|
2070
2070
|
renameKeys: renameKeys,
|
2071
2071
|
timestamp: secondsSinceEpoch,
|
2072
2072
|
allSettled: allSettled,
|
2073
|
-
negate: negate
|
2073
|
+
negate: negate,
|
2074
2074
|
};
|
2075
2075
|
})();
|
2076
2076
|
|
@@ -2155,48 +2155,16 @@ up.migrate = { config: {} };
|
|
2155
2155
|
/***/ (function() {
|
2156
2156
|
|
2157
2157
|
/*-
|
2158
|
-
Browser
|
2159
|
-
|
2160
|
-
|
2161
|
-
Unpoly supports all modern browsers.
|
2162
|
-
|
2163
|
-
### Chrome, Firefox, Edge, Safari
|
2164
|
-
|
2165
|
-
Full support.
|
2166
|
-
|
2167
|
-
### Internet Explorer 11
|
2168
|
-
|
2169
|
-
Full support with a `Promise` polyfill like [es6-promise](https://github.com/stefanpenner/es6-promise) (2.4 KB).\
|
2170
|
-
Support may be removed when Microsoft retires IE11 in [June 2022](https://blogs.windows.com/windowsexperience/2021/05/19/the-future-of-internet-explorer-on-windows-10-is-in-microsoft-edge/).
|
2171
|
-
|
2172
|
-
### Internet Explorer 10 or lower
|
2158
|
+
Browser interface
|
2159
|
+
=================
|
2173
2160
|
|
2174
|
-
|
2175
|
-
leaving you with a classic server-side application.
|
2161
|
+
We tunnel some browser APIs through this module for easier mocking in tests.
|
2176
2162
|
|
2177
2163
|
@module up.browser
|
2178
2164
|
*/
|
2179
2165
|
up.browser = (function () {
|
2180
2166
|
var u = up.util;
|
2181
2167
|
/*-
|
2182
|
-
Makes a full-page request, replacing the entire browser environment with a new page from the server response.
|
2183
|
-
|
2184
|
-
Also see `up.Request#loadPage()`.
|
2185
|
-
|
2186
|
-
@function up.browser.loadPage
|
2187
|
-
@param {string} options.url
|
2188
|
-
The URL to load.
|
2189
|
-
@param {string} [options.method='get']
|
2190
|
-
The method for the request.
|
2191
|
-
|
2192
|
-
Methods other than GET or POST will be [wrapped](/up.protocol.config#config.methodParam) in a POST request.
|
2193
|
-
@param {Object|Array|FormData|string} [options.params]
|
2194
|
-
@experimental
|
2195
|
-
*/
|
2196
|
-
function loadPage(requestsAttrs) {
|
2197
|
-
new up.Request(requestsAttrs).loadPage();
|
2198
|
-
}
|
2199
|
-
/*-
|
2200
2168
|
Submits the given form with a full page load.
|
2201
2169
|
|
2202
2170
|
For mocking in specs.
|
@@ -2210,6 +2178,11 @@ up.browser = (function () {
|
|
2210
2178
|
function isIE11() {
|
2211
2179
|
return 'ActiveXObject' in window; // this is undefined, but the key is set
|
2212
2180
|
}
|
2181
|
+
function isEdge18() {
|
2182
|
+
// Edge 18: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19582
|
2183
|
+
// Edge 92: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36 Edg/92.0.902.78
|
2184
|
+
return u.contains(navigator.userAgent, ' Edge/');
|
2185
|
+
}
|
2213
2186
|
/*-
|
2214
2187
|
Returns whether this browser supports manipulation of the current URL
|
2215
2188
|
via [`history.pushState`](https://developer.mozilla.org/en-US/docs/Web/API/History/pushState).
|
@@ -2259,6 +2232,17 @@ up.browser = (function () {
|
|
2259
2232
|
function canJQuery() {
|
2260
2233
|
return !!window.jQuery;
|
2261
2234
|
}
|
2235
|
+
var canEval = u.memoize(function () {
|
2236
|
+
try {
|
2237
|
+
// Don't use eval() which would prevent minifiers from compressing local variables.
|
2238
|
+
return new Function('return true')();
|
2239
|
+
}
|
2240
|
+
catch (_a) {
|
2241
|
+
// With a strict CSP this will be an error like:
|
2242
|
+
// Uncaught EvalError: call to Function() blocked by CSP
|
2243
|
+
return false;
|
2244
|
+
}
|
2245
|
+
});
|
2262
2246
|
// IE11: Use the browser.cookies API instead.
|
2263
2247
|
function popCookie(name) {
|
2264
2248
|
var _a;
|
@@ -2288,42 +2272,19 @@ up.browser = (function () {
|
|
2288
2272
|
}
|
2289
2273
|
return true;
|
2290
2274
|
}
|
2291
|
-
/*-
|
2292
|
-
Returns whether Unpoly supports the current browser.
|
2293
|
-
|
2294
|
-
If this returns `false` Unpoly will prevent itself from booting
|
2295
|
-
and ignores all registered [event handlers](/up.on) and [compilers](/up.compiler).
|
2296
|
-
This leaves you with a classic server-side application.
|
2297
|
-
This is usually a better fallback than loading incompatible Javascript and causing
|
2298
|
-
many errors on load.
|
2299
|
-
|
2300
|
-
@function up.browser.isSupported
|
2301
|
-
@stable
|
2302
|
-
*/
|
2303
|
-
function isSupported() {
|
2304
|
-
return !supportIssue();
|
2305
|
-
}
|
2306
|
-
function supportIssue() {
|
2307
|
-
if (!canPromise()) {
|
2308
|
-
return "Browser doesn't support promises";
|
2309
|
-
}
|
2310
|
-
if (document.compatMode === 'BackCompat') {
|
2311
|
-
return 'Browser is in quirks mode (missing DOCTYPE?)';
|
2312
|
-
}
|
2313
|
-
}
|
2314
2275
|
return {
|
2315
|
-
loadPage: loadPage,
|
2316
2276
|
submitForm: submitForm,
|
2317
2277
|
canPushState: canPushState,
|
2318
2278
|
canFormatLog: canFormatLog,
|
2319
2279
|
canPassiveEventListener: canPassiveEventListener,
|
2320
2280
|
canJQuery: canJQuery,
|
2281
|
+
canPromise: canPromise,
|
2282
|
+
canEval: canEval,
|
2321
2283
|
assertConfirmed: assertConfirmed,
|
2322
|
-
isSupported: isSupported,
|
2323
|
-
supportIssue: supportIssue,
|
2324
2284
|
popCookie: popCookie,
|
2325
2285
|
get jQuery() { return getJQuery(); },
|
2326
|
-
isIE11: isIE11
|
2286
|
+
isIE11: isIE11,
|
2287
|
+
isEdge18: isEdge18,
|
2327
2288
|
};
|
2328
2289
|
})();
|
2329
2290
|
|
@@ -3323,11 +3284,12 @@ up.element = (function () {
|
|
3323
3284
|
}
|
3324
3285
|
}
|
3325
3286
|
function callbackAttr(link, attr, exposedKeys) {
|
3287
|
+
var _a;
|
3326
3288
|
if (exposedKeys === void 0) { exposedKeys = []; }
|
3327
3289
|
var code = link.getAttribute(attr);
|
3328
3290
|
if (code) {
|
3329
3291
|
// Allow callbacks to refer to an exposed property directly instead of through `event.value`.
|
3330
|
-
var callback_1 =
|
3292
|
+
var callback_1 = (_a = up.NonceableCallback.fromString(code)).toFunction.apply(_a, __spreadArray(['event'], exposedKeys));
|
3331
3293
|
// Emulate the behavior of the `onclick` attribute,
|
3332
3294
|
// where `this` refers to the clicked element.
|
3333
3295
|
return function (event) {
|
@@ -4299,7 +4261,7 @@ up.Change.OpenLayer = /** @class */ (function (_super) {
|
|
4299
4261
|
// We assume that the server will respond with our target.
|
4300
4262
|
return this.target;
|
4301
4263
|
};
|
4302
|
-
OpenLayer.prototype.execute = function (responseDoc) {
|
4264
|
+
OpenLayer.prototype.execute = function (responseDoc, onApplicable) {
|
4303
4265
|
var _this = this;
|
4304
4266
|
if (this.target === ':none') {
|
4305
4267
|
this.content = document.createElement('up-none');
|
@@ -4310,6 +4272,7 @@ up.Change.OpenLayer = /** @class */ (function (_super) {
|
|
4310
4272
|
if (!this.content || this.baseLayer.isClosed()) {
|
4311
4273
|
throw this.notApplicable();
|
4312
4274
|
}
|
4275
|
+
onApplicable();
|
4313
4276
|
up.puts('up.render()', "Opening element \"" + this.target + "\" in new overlay");
|
4314
4277
|
this.options.title = this.improveHistoryValue(this.options.title, responseDoc.getTitle());
|
4315
4278
|
if (this.emitOpenEvent().defaultPrevented) {
|
@@ -4533,12 +4496,13 @@ up.Change.UpdateLayer = /** @class */ (function (_super) {
|
|
4533
4496
|
this.matchPreflight();
|
4534
4497
|
return u.map(this.steps, 'selector').join(', ') || ':none';
|
4535
4498
|
};
|
4536
|
-
UpdateLayer.prototype.execute = function (responseDoc) {
|
4499
|
+
UpdateLayer.prototype.execute = function (responseDoc, onApplicable) {
|
4537
4500
|
var _this = this;
|
4538
4501
|
this.responseDoc = responseDoc;
|
4539
4502
|
// For each step, find a step.alternative that matches in both the current page
|
4540
4503
|
// and the response document.
|
4541
4504
|
this.matchPostflight();
|
4505
|
+
onApplicable();
|
4542
4506
|
// Don't log @target since that does not include hungry elements
|
4543
4507
|
up.puts('up.render()', "Updating \"" + this.bestPreflightSelector() + "\" in " + this.layer);
|
4544
4508
|
this.options.title = this.improveHistoryValue(this.options.title, this.responseDoc.getTitle());
|
@@ -4961,7 +4925,7 @@ up.Change.CloseLayer = /** @class */ (function (_super) {
|
|
4961
4925
|
// because the layer is detached. We do not want to emit it on the parent layer where users
|
4962
4926
|
// might confuse it with an event for the parent layer itself. Since @layer.element
|
4963
4927
|
// is now detached, the event will no longer bubble up to the document where global
|
4964
|
-
// event listeners can receive it. So we
|
4928
|
+
// event listeners can receive it. So we explicitly emit the event a second time
|
4965
4929
|
// on the document.
|
4966
4930
|
return this.layer.emit(this.buildEvent("up:layer:" + verbPast), {
|
4967
4931
|
// Set up.layer.current to the parent of the closed layer, which is now likely
|
@@ -5087,18 +5051,25 @@ up.Change.FromContent = /** @class */ (function (_super) {
|
|
5087
5051
|
return up.fragment.expandTargets(targets, { layer: layer, mode: this.mode, origin: this.origin });
|
5088
5052
|
};
|
5089
5053
|
FromContent.prototype.execute = function () {
|
5090
|
-
var _this = this;
|
5091
5054
|
// Preloading from local content is a no-op.
|
5092
5055
|
if (this.options.preload) {
|
5093
5056
|
return Promise.resolve();
|
5094
5057
|
}
|
5095
|
-
|
5096
|
-
|
5058
|
+
return this.seekPlan(this.executePlan.bind(this)) || this.postflightTargetNotApplicable();
|
5059
|
+
};
|
5060
|
+
FromContent.prototype.executePlan = function (matchedPlan) {
|
5061
|
+
return matchedPlan.execute(this.getResponseDoc(), this.onPlanApplicable.bind(this, matchedPlan));
|
5062
|
+
};
|
5063
|
+
FromContent.prototype.onPlanApplicable = function (plan) {
|
5064
|
+
var primaryPlan = this.getPlans()[0];
|
5065
|
+
if (plan !== primaryPlan) {
|
5066
|
+
up.puts('up.render()', 'Could not match primary target (%s). Updating a fallback target (%s).', primaryPlan.target, plan.target);
|
5067
|
+
}
|
5097
5068
|
};
|
5098
5069
|
FromContent.prototype.getResponseDoc = function () {
|
5099
5070
|
var _a, _b;
|
5100
5071
|
if (!this.preview && !this.responseDoc) {
|
5101
|
-
var docOptions = u.pick(this.options, ['target', 'content', 'fragment', 'document', 'html']);
|
5072
|
+
var docOptions = u.pick(this.options, ['target', 'content', 'fragment', 'document', 'html', 'cspNonces']);
|
5102
5073
|
(_b = (_a = up.migrate).handleResponseDocOptions) === null || _b === void 0 ? void 0 : _b.call(_a, docOptions);
|
5103
5074
|
// If neither { document } nor { fragment } source is given, we assume { content }.
|
5104
5075
|
if (this.defaultPlacement() === 'content') {
|
@@ -5220,7 +5191,7 @@ up.Change.FromURL = /** @class */ (function (_super) {
|
|
5220
5191
|
var newPageReason = this.newPageReason();
|
5221
5192
|
if (newPageReason) {
|
5222
5193
|
up.puts('up.render()', newPageReason);
|
5223
|
-
up.
|
5194
|
+
up.network.loadPage(this.options);
|
5224
5195
|
// Prevent our caller from executing any further code, since we're already
|
5225
5196
|
// navigating away from this JavaScript environment.
|
5226
5197
|
return u.unresolvablePromise();
|
@@ -5287,17 +5258,21 @@ up.Change.FromURL = /** @class */ (function (_super) {
|
|
5287
5258
|
FromURL.prototype.isSuccessfulResponse = function () {
|
5288
5259
|
return (this.successOptions.fail === false) || this.response.ok;
|
5289
5260
|
};
|
5290
|
-
|
5291
|
-
|
5292
|
-
|
5293
|
-
}
|
5261
|
+
// buildEvent(type, props) {
|
5262
|
+
// const defaultProps = { request: this.request, response: this.response, renderOptions: this.options }
|
5263
|
+
// return up.event.build(type, u.merge(defaultProps, props))
|
5264
|
+
// }
|
5294
5265
|
FromURL.prototype.updateContentFromResponse = function (log, renderOptions) {
|
5295
5266
|
// Allow listeners to inspect the response and either prevent the fragment change
|
5296
5267
|
// or manipulate change options. An example for when this is useful is a maintenance
|
5297
5268
|
// page with its own layout, that cannot be loaded as a fragment and must be loaded
|
5298
5269
|
// with a full page load.
|
5299
|
-
|
5300
|
-
|
5270
|
+
this.request.assertEmitted('up:fragment:loaded', {
|
5271
|
+
callback: this.options.onLoaded,
|
5272
|
+
response: this.response,
|
5273
|
+
log: log,
|
5274
|
+
renderOptions: renderOptions,
|
5275
|
+
});
|
5301
5276
|
// The response might carry some updates for our change options,
|
5302
5277
|
// like a server-set location, or server-sent events.
|
5303
5278
|
this.augmentOptionsFromResponse(renderOptions);
|
@@ -5341,6 +5316,7 @@ up.Change.FromURL = /** @class */ (function (_super) {
|
|
5341
5316
|
// If the server has provided an update to our context via the X-Up-Context
|
5342
5317
|
// response header, merge it into our existing { context } option.
|
5343
5318
|
renderOptions.context = u.merge(renderOptions.context, this.response.context);
|
5319
|
+
renderOptions.cspNonces = this.response.cspNonces;
|
5344
5320
|
};
|
5345
5321
|
return FromURL;
|
5346
5322
|
}(up.Change));
|
@@ -5858,9 +5834,16 @@ var e = up.element;
|
|
5858
5834
|
up.EventListener = /** @class */ (function (_super) {
|
5859
5835
|
__extends(EventListener, _super);
|
5860
5836
|
function EventListener(attributes) {
|
5837
|
+
var _a;
|
5861
5838
|
var _this = _super.call(this, attributes) || this;
|
5862
5839
|
_this.key = _this.constructor.buildKey(attributes);
|
5863
|
-
_this.isDefault = up.framework.
|
5840
|
+
_this.isDefault = up.framework.evaling;
|
5841
|
+
// We don't usually run up.on() listeners before Unpoly has booted.
|
5842
|
+
// This is done so incompatible code is not called on browsers that don't support Unpoly.
|
5843
|
+
// Listeners that do need to run before Unpoly boots can pass { beforeBoot: true } to override.
|
5844
|
+
// We also default to { beforeBoot: true } for framework events that are emitted
|
5845
|
+
// before booting.
|
5846
|
+
(_a = _this.beforeBoot) !== null && _a !== void 0 ? _a : (_this.beforeBoot = _this.eventType.indexOf('up:framework:') === 0);
|
5864
5847
|
// Need to store the bound nativeCallback function because addEventListener()
|
5865
5848
|
// and removeEventListener() need to see the exact same reference.
|
5866
5849
|
_this.nativeCallback = _this.nativeCallback.bind(_this);
|
@@ -5876,7 +5859,8 @@ up.EventListener = /** @class */ (function (_super) {
|
|
5876
5859
|
'guard',
|
5877
5860
|
'baseLayer',
|
5878
5861
|
'passive',
|
5879
|
-
'once'
|
5862
|
+
'once',
|
5863
|
+
'beforeBoot',
|
5880
5864
|
];
|
5881
5865
|
};
|
5882
5866
|
EventListener.prototype.bind = function () {
|
@@ -5906,6 +5890,9 @@ up.EventListener = /** @class */ (function (_super) {
|
|
5906
5890
|
};
|
5907
5891
|
EventListener.prototype.nativeCallback = function (event) {
|
5908
5892
|
var _a;
|
5893
|
+
if (up.framework.beforeBoot && !this.beforeBoot) {
|
5894
|
+
return;
|
5895
|
+
}
|
5909
5896
|
// Once we drop IE11 support we can forward the { once } option
|
5910
5897
|
// to Element#addEventListener().
|
5911
5898
|
if (this.once) {
|
@@ -6023,7 +6010,8 @@ up.EventListenerGroup = /** @class */ (function (_super) {
|
|
6023
6010
|
'guard',
|
6024
6011
|
'baseLayer',
|
6025
6012
|
'passive',
|
6026
|
-
'once'
|
6013
|
+
'once',
|
6014
|
+
'beforeBoot',
|
6027
6015
|
];
|
6028
6016
|
};
|
6029
6017
|
EventListenerGroup.prototype.bind = function () {
|
@@ -8884,6 +8872,133 @@ up.MotionController = /** @class */ (function () {
|
|
8884
8872
|
/* 49 */
|
8885
8873
|
/***/ (function() {
|
8886
8874
|
|
8875
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
8876
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
8877
|
+
to[j] = from[i];
|
8878
|
+
return to;
|
8879
|
+
};
|
8880
|
+
var u = up.util;
|
8881
|
+
var e = up.element;
|
8882
|
+
up.NonceableCallback = /** @class */ (function () {
|
8883
|
+
function NonceableCallback(script, nonce) {
|
8884
|
+
this.script = script;
|
8885
|
+
this.nonce = nonce;
|
8886
|
+
}
|
8887
|
+
NonceableCallback.fromString = function (string) {
|
8888
|
+
var match = string.match(/^(nonce-([^\s]+)\s)?(.*)$/);
|
8889
|
+
return new this(match[3], match[2]);
|
8890
|
+
};
|
8891
|
+
/*-
|
8892
|
+
Replacement for `new Function()` that can take a nonce to work with a strict Content Security Policy.
|
8893
|
+
|
8894
|
+
It also prints an error when a strict CSP is active, but user supplies no nonce.
|
8895
|
+
|
8896
|
+
### Examples
|
8897
|
+
|
8898
|
+
```js
|
8899
|
+
new up.NonceableCallback('1 + 2', 'secret').toFunction()
|
8900
|
+
```
|
8901
|
+
|
8902
|
+
@function up.NonceableCallback#toFunction
|
8903
|
+
@internal
|
8904
|
+
*/
|
8905
|
+
NonceableCallback.prototype.toFunction = function () {
|
8906
|
+
var argNames = [];
|
8907
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
8908
|
+
argNames[_i] = arguments[_i];
|
8909
|
+
}
|
8910
|
+
if (up.browser.canEval()) {
|
8911
|
+
return new (Function.bind.apply(Function, __spreadArray(__spreadArray([void 0], argNames), [this.script])))();
|
8912
|
+
}
|
8913
|
+
else if (this.nonce) {
|
8914
|
+
// Don't return a bound function so callers can re-bind to a different this.
|
8915
|
+
var callbackThis_1 = this;
|
8916
|
+
return function () {
|
8917
|
+
var args = [];
|
8918
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
8919
|
+
args[_i] = arguments[_i];
|
8920
|
+
}
|
8921
|
+
return callbackThis_1.runAsNoncedFunction(this, argNames, args);
|
8922
|
+
};
|
8923
|
+
}
|
8924
|
+
else {
|
8925
|
+
return this.cannotRun.bind(this);
|
8926
|
+
}
|
8927
|
+
};
|
8928
|
+
NonceableCallback.prototype.toString = function () {
|
8929
|
+
return "nonce-" + this.nonce + " " + this.script;
|
8930
|
+
};
|
8931
|
+
NonceableCallback.prototype.cannotRun = function () {
|
8932
|
+
throw new Error("Your Content Security Policy disallows inline JavaScript (" + this.script + "). See https://unpoly.com/csp for solutions.");
|
8933
|
+
};
|
8934
|
+
NonceableCallback.prototype.runAsNoncedFunction = function (thisArg, argNames, args) {
|
8935
|
+
var wrappedScript = "\n try {\n up.noncedEval.value = (function(" + argNames.join(',') + ") {\n " + this.script + "\n }).apply(up.noncedEval.thisArg, up.noncedEval.args)\n } catch (error) {\n up.noncedEval.error = error\n }\n ";
|
8936
|
+
var script;
|
8937
|
+
try {
|
8938
|
+
up.noncedEval = { args: args, thisArg: thisArg };
|
8939
|
+
script = up.element.affix(document.body, 'script', { nonce: this.nonce, text: wrappedScript });
|
8940
|
+
if (up.noncedEval.error) {
|
8941
|
+
throw up.noncedEval.error;
|
8942
|
+
}
|
8943
|
+
else {
|
8944
|
+
return up.noncedEval.value;
|
8945
|
+
}
|
8946
|
+
}
|
8947
|
+
finally {
|
8948
|
+
up.noncedEval = undefined;
|
8949
|
+
if (script) {
|
8950
|
+
up.element.remove(script);
|
8951
|
+
}
|
8952
|
+
}
|
8953
|
+
};
|
8954
|
+
NonceableCallback.prototype.allowedBy = function (allowedNonces) {
|
8955
|
+
return this.nonce && u.contains(allowedNonces, this.nonce);
|
8956
|
+
};
|
8957
|
+
NonceableCallback.adoptNonces = function (element, allowedNonces) {
|
8958
|
+
var _this = this;
|
8959
|
+
if (!(allowedNonces === null || allowedNonces === void 0 ? void 0 : allowedNonces.length)) {
|
8960
|
+
return;
|
8961
|
+
}
|
8962
|
+
// Looking up a nonce requires a DOM query.
|
8963
|
+
// For performance reasons we only do this when we're actually rewriting
|
8964
|
+
// a nonce, and only once per response.
|
8965
|
+
var getPageNonce = u.memoize(up.protocol.cspNonce);
|
8966
|
+
u.each(up.protocol.config.nonceableAttributes, function (attribute) {
|
8967
|
+
var matches = e.subtree(element, "[" + attribute + "^=\"nonce-\"]");
|
8968
|
+
u.each(matches, function (match) {
|
8969
|
+
var attributeValue = match.getAttribute(attribute);
|
8970
|
+
var callback = _this.fromString(attributeValue);
|
8971
|
+
var warn = function (message) {
|
8972
|
+
var _a;
|
8973
|
+
var args = [];
|
8974
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
8975
|
+
args[_i - 1] = arguments[_i];
|
8976
|
+
}
|
8977
|
+
return (_a = up.log).warn.apply(_a, __spreadArray(['up.render()', "Cannot use callback [" + attribute + "=\"" + attributeValue + "\"]: " + message], args));
|
8978
|
+
};
|
8979
|
+
if (!callback.allowedBy(allowedNonces)) {
|
8980
|
+
// Don't rewrite a nonce that the browser would have rejected.
|
8981
|
+
return warn("Callback's CSP nonce (%o) does not match response header (%o)", callback.nonce, allowedNonces);
|
8982
|
+
}
|
8983
|
+
// Replace the nonce with that of the current page.
|
8984
|
+
// This will allow the handler to run via #toFunction().
|
8985
|
+
var pageNonce = getPageNonce();
|
8986
|
+
if (!pageNonce) {
|
8987
|
+
return warn("Current page's CSP nonce is unknown");
|
8988
|
+
}
|
8989
|
+
callback.nonce = pageNonce;
|
8990
|
+
match.setAttribute(attribute, callback.toString());
|
8991
|
+
});
|
8992
|
+
});
|
8993
|
+
};
|
8994
|
+
return NonceableCallback;
|
8995
|
+
}());
|
8996
|
+
|
8997
|
+
|
8998
|
+
/***/ }),
|
8999
|
+
/* 50 */
|
9000
|
+
/***/ (function() {
|
9001
|
+
|
8887
9002
|
var __assign = (this && this.__assign) || function () {
|
8888
9003
|
__assign = Object.assign || function(t) {
|
8889
9004
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
@@ -8959,7 +9074,7 @@ up.OptionsParser = /** @class */ (function () {
|
|
8959
9074
|
|
8960
9075
|
|
8961
9076
|
/***/ }),
|
8962
|
-
/*
|
9077
|
+
/* 51 */
|
8963
9078
|
/***/ (function() {
|
8964
9079
|
|
8965
9080
|
var e = up.element;
|
@@ -9053,7 +9168,7 @@ up.OverlayFocus = /** @class */ (function () {
|
|
9053
9168
|
|
9054
9169
|
|
9055
9170
|
/***/ }),
|
9056
|
-
/*
|
9171
|
+
/* 52 */
|
9057
9172
|
/***/ (function() {
|
9058
9173
|
|
9059
9174
|
var u = up.util;
|
@@ -9650,7 +9765,7 @@ up.Params = /** @class */ (function () {
|
|
9650
9765
|
|
9651
9766
|
|
9652
9767
|
/***/ }),
|
9653
|
-
/*
|
9768
|
+
/* 53 */
|
9654
9769
|
/***/ (function() {
|
9655
9770
|
|
9656
9771
|
var e = up.element;
|
@@ -9708,7 +9823,7 @@ up.ProgressBar = /** @class */ (function () {
|
|
9708
9823
|
|
9709
9824
|
|
9710
9825
|
/***/ }),
|
9711
|
-
/*
|
9826
|
+
/* 54 */
|
9712
9827
|
/***/ (function() {
|
9713
9828
|
|
9714
9829
|
var u = up.util;
|
@@ -9847,7 +9962,7 @@ up.RenderOptions = (function () {
|
|
9847
9962
|
|
9848
9963
|
|
9849
9964
|
/***/ }),
|
9850
|
-
/*
|
9965
|
+
/* 55 */
|
9851
9966
|
/***/ (function() {
|
9852
9967
|
|
9853
9968
|
var __extends = (this && this.__extends) || (function () {
|
@@ -9908,7 +10023,7 @@ up.RenderResult = /** @class */ (function (_super) {
|
|
9908
10023
|
|
9909
10024
|
|
9910
10025
|
/***/ }),
|
9911
|
-
/*
|
10026
|
+
/* 56 */
|
9912
10027
|
/***/ (function() {
|
9913
10028
|
|
9914
10029
|
var __extends = (this && this.__extends) || (function () {
|
@@ -10481,7 +10596,11 @@ up.Request = /** @class */ (function (_super) {
|
|
10481
10596
|
// This way listeners can observe event-related events on a given layer.
|
10482
10597
|
// This request has an optional { layer } attribute, which is used by
|
10483
10598
|
// EventEmitter.
|
10484
|
-
return up.EventEmitter.fromEmitArgs(args, {
|
10599
|
+
return up.EventEmitter.fromEmitArgs(args, {
|
10600
|
+
layer: this.layer,
|
10601
|
+
request: this,
|
10602
|
+
origin: this.origin
|
10603
|
+
});
|
10485
10604
|
};
|
10486
10605
|
Request.prototype.emit = function () {
|
10487
10606
|
var args = [];
|
@@ -10506,11 +10625,27 @@ up.Request = /** @class */ (function (_super) {
|
|
10506
10625
|
});
|
10507
10626
|
return Request;
|
10508
10627
|
}(up.Record));
|
10628
|
+
// A request is also a promise ("thenable") for its response.
|
10509
10629
|
u.delegate(up.Request.prototype, ['then', 'catch', 'finally'], function () { return this.deferred; });
|
10630
|
+
up.Request.tester = function (condition) {
|
10631
|
+
if (u.isFunction(condition)) {
|
10632
|
+
return condition;
|
10633
|
+
}
|
10634
|
+
else if (condition instanceof this) {
|
10635
|
+
return function (request) { return condition === request; };
|
10636
|
+
}
|
10637
|
+
else if (u.isString(condition)) {
|
10638
|
+
var pattern_1 = new up.URLPattern(condition);
|
10639
|
+
return function (request) { return pattern_1.test(request.url); };
|
10640
|
+
}
|
10641
|
+
else { // boolean, truthy/falsy values
|
10642
|
+
return function (_request) { return condition; };
|
10643
|
+
}
|
10644
|
+
};
|
10510
10645
|
|
10511
10646
|
|
10512
10647
|
/***/ }),
|
10513
|
-
/*
|
10648
|
+
/* 57 */
|
10514
10649
|
/***/ (function() {
|
10515
10650
|
|
10516
10651
|
var __extends = (this && this.__extends) || (function () {
|
@@ -10560,26 +10695,24 @@ up.Request.Cache = /** @class */ (function (_super) {
|
|
10560
10695
|
// candidates.push(request.variant(target: 'body'))
|
10561
10696
|
//
|
10562
10697
|
// u.findResult candidates, (candidate) => super(candidate)
|
10563
|
-
Cache.prototype.clear = function (
|
10698
|
+
Cache.prototype.clear = function (condition) {
|
10564
10699
|
var _this = this;
|
10565
|
-
if (
|
10566
|
-
|
10567
|
-
|
10568
|
-
|
10569
|
-
|
10570
|
-
|
10571
|
-
|
10572
|
-
|
10573
|
-
|
10574
|
-
_super.prototype.clear.call(this);
|
10575
|
-
}
|
10700
|
+
if (condition === void 0) { condition = true; }
|
10701
|
+
var tester = up.Request.tester(condition);
|
10702
|
+
this.each(function (key, request) {
|
10703
|
+
if (tester(request)) {
|
10704
|
+
// It is generally not a great idea to manipulate the list we're iterating over,
|
10705
|
+
// but the implementation of up.Cache#each copies keys before iterating.
|
10706
|
+
_this.store.remove(key);
|
10707
|
+
}
|
10708
|
+
});
|
10576
10709
|
};
|
10577
10710
|
return Cache;
|
10578
10711
|
}(up.Cache));
|
10579
10712
|
|
10580
10713
|
|
10581
10714
|
/***/ }),
|
10582
|
-
/*
|
10715
|
+
/* 58 */
|
10583
10716
|
/***/ (function() {
|
10584
10717
|
|
10585
10718
|
var u = up.util;
|
@@ -10685,13 +10818,14 @@ up.Request.Queue = /** @class */ (function () {
|
|
10685
10818
|
};
|
10686
10819
|
// Aborting a request will cause its promise to reject, which will also uncache it
|
10687
10820
|
Queue.prototype.abort = function (conditions) {
|
10688
|
-
var _this = this;
|
10689
10821
|
if (conditions === void 0) { conditions = true; }
|
10822
|
+
var tester = up.Request.tester(conditions);
|
10690
10823
|
var _loop_1 = function (list) {
|
10691
|
-
var
|
10692
|
-
|
10693
|
-
|
10694
|
-
|
10824
|
+
var abortableRequests = u.filter(list, tester);
|
10825
|
+
abortableRequests.forEach(function (abortableRequest) {
|
10826
|
+
abortableRequest.abort();
|
10827
|
+
// Avoid changing the list we're iterating over.
|
10828
|
+
u.remove(list, abortableRequest);
|
10695
10829
|
});
|
10696
10830
|
};
|
10697
10831
|
for (var _i = 0, _a = [this.currentRequests, this.queuedRequests]; _i < _a.length; _i++) {
|
@@ -10704,9 +10838,6 @@ up.Request.Queue = /** @class */ (function () {
|
|
10704
10838
|
var excusedCacheKey = excusedRequest.cacheKey();
|
10705
10839
|
this.abort(function (queuedRequest) { return (queuedRequest.cacheKey() !== excusedCacheKey) && u.evalOption(additionalConditions, queuedRequest); });
|
10706
10840
|
};
|
10707
|
-
Queue.prototype.requestMatches = function (request, conditions) {
|
10708
|
-
return (request === conditions) || u.evalOption(conditions, request);
|
10709
|
-
};
|
10710
10841
|
Queue.prototype.checkSlow = function () {
|
10711
10842
|
var currentSlow = this.isSlow();
|
10712
10843
|
if (this.emittedSlow !== currentSlow) {
|
@@ -10735,7 +10866,7 @@ up.Request.Queue = /** @class */ (function () {
|
|
10735
10866
|
|
10736
10867
|
|
10737
10868
|
/***/ }),
|
10738
|
-
/*
|
10869
|
+
/* 59 */
|
10739
10870
|
/***/ (function() {
|
10740
10871
|
|
10741
10872
|
var u = up.util;
|
@@ -10763,7 +10894,7 @@ up.Request.FormRenderer = /** @class */ (function () {
|
|
10763
10894
|
method = up.protocol.wrapMethod(method, this.params);
|
10764
10895
|
}
|
10765
10896
|
this.form = e.affix(document.body, 'form.up-request-loader', { method: method, action: action });
|
10766
|
-
// We only need an [enctype] attribute if the user has
|
10897
|
+
// We only need an [enctype] attribute if the user has explicitly
|
10767
10898
|
// requested one. If none is given, we can use the browser's default
|
10768
10899
|
// [enctype]. Binary values cannot be sent by this renderer anyway, so
|
10769
10900
|
// we don't need to default to multipart/form-data in this case.
|
@@ -10788,7 +10919,7 @@ up.Request.FormRenderer = /** @class */ (function () {
|
|
10788
10919
|
|
10789
10920
|
|
10790
10921
|
/***/ }),
|
10791
|
-
/*
|
10922
|
+
/* 60 */
|
10792
10923
|
/***/ (function() {
|
10793
10924
|
|
10794
10925
|
var CONTENT_TYPE_URL_ENCODED = 'application/x-www-form-urlencoded';
|
@@ -10896,7 +11027,7 @@ up.Request.XHRRenderer = /** @class */ (function () {
|
|
10896
11027
|
|
10897
11028
|
|
10898
11029
|
/***/ }),
|
10899
|
-
/*
|
11030
|
+
/* 61 */
|
10900
11031
|
/***/ (function() {
|
10901
11032
|
|
10902
11033
|
var __extends = (this && this.__extends) || (function () {
|
@@ -11080,6 +11211,13 @@ up.Response = /** @class */ (function (_super) {
|
|
11080
11211
|
enumerable: false,
|
11081
11212
|
configurable: true
|
11082
11213
|
});
|
11214
|
+
Object.defineProperty(Response.prototype, "cspNonces", {
|
11215
|
+
get: function () {
|
11216
|
+
return up.protocol.cspNoncesFromHeader(this.getHeader('Content-Security-Policy'));
|
11217
|
+
},
|
11218
|
+
enumerable: false,
|
11219
|
+
configurable: true
|
11220
|
+
});
|
11083
11221
|
Object.defineProperty(Response.prototype, "json", {
|
11084
11222
|
/*-
|
11085
11223
|
The response body parsed as a JSON string.
|
@@ -11107,7 +11245,7 @@ up.Response = /** @class */ (function (_super) {
|
|
11107
11245
|
|
11108
11246
|
|
11109
11247
|
/***/ }),
|
11110
|
-
/*
|
11248
|
+
/* 62 */
|
11111
11249
|
/***/ (function() {
|
11112
11250
|
|
11113
11251
|
var u = up.util;
|
@@ -11137,6 +11275,7 @@ up.ResponseDoc = /** @class */ (function () {
|
|
11137
11275
|
this.parseDocument(options) ||
|
11138
11276
|
this.parseFragment(options) ||
|
11139
11277
|
this.parseContent(options);
|
11278
|
+
this.cspNonces = options.cspNonces;
|
11140
11279
|
}
|
11141
11280
|
ResponseDoc.prototype.parseDocument = function (options) {
|
11142
11281
|
return this.parse(options.document, e.createDocumentFromHTML);
|
@@ -11205,6 +11344,8 @@ up.ResponseDoc = /** @class */ (function () {
|
|
11205
11344
|
ResponseDoc.prototype.finalizeElement = function (element) {
|
11206
11345
|
// Restore <noscript> tags so they become available to compilers.
|
11207
11346
|
this.noscriptWrapper.unwrap(element);
|
11347
|
+
// Rewrite per-request CSP nonces to match that of the current page.
|
11348
|
+
up.NonceableCallback.adoptNonces(element, this.cspNonces);
|
11208
11349
|
// Restore <script> so they will run.
|
11209
11350
|
this.scriptWrapper.unwrap(element);
|
11210
11351
|
};
|
@@ -11213,7 +11354,7 @@ up.ResponseDoc = /** @class */ (function () {
|
|
11213
11354
|
|
11214
11355
|
|
11215
11356
|
/***/ }),
|
11216
|
-
/*
|
11357
|
+
/* 63 */
|
11217
11358
|
/***/ (function() {
|
11218
11359
|
|
11219
11360
|
var e = up.element;
|
@@ -11251,7 +11392,7 @@ up.RevealMotion = /** @class */ (function () {
|
|
11251
11392
|
var newScrollTop = originalScrollTop;
|
11252
11393
|
if (this.top || (elementRect.height > viewportRect.height)) {
|
11253
11394
|
// Element is either larger than the viewport,
|
11254
|
-
// or the user has
|
11395
|
+
// or the user has explicitly requested for the element to align at top
|
11255
11396
|
// => Scroll the viewport so the first element row is the first viewport row
|
11256
11397
|
var diff = elementRect.top - viewportRect.top;
|
11257
11398
|
newScrollTop += diff;
|
@@ -11335,7 +11476,7 @@ up.RevealMotion = /** @class */ (function () {
|
|
11335
11476
|
|
11336
11477
|
|
11337
11478
|
/***/ }),
|
11338
|
-
/*
|
11479
|
+
/* 64 */
|
11339
11480
|
/***/ (function() {
|
11340
11481
|
|
11341
11482
|
var u = up.util;
|
@@ -11420,7 +11561,7 @@ up.ScrollMotion = /** @class */ (function () {
|
|
11420
11561
|
|
11421
11562
|
|
11422
11563
|
/***/ }),
|
11423
|
-
/*
|
11564
|
+
/* 65 */
|
11424
11565
|
/***/ (function() {
|
11425
11566
|
|
11426
11567
|
var e = up.element;
|
@@ -11474,7 +11615,7 @@ up.Selector = /** @class */ (function () {
|
|
11474
11615
|
|
11475
11616
|
|
11476
11617
|
/***/ }),
|
11477
|
-
/*
|
11618
|
+
/* 66 */
|
11478
11619
|
/***/ (function() {
|
11479
11620
|
|
11480
11621
|
var u = up.util;
|
@@ -11509,7 +11650,7 @@ up.store.Memory = /** @class */ (function () {
|
|
11509
11650
|
|
11510
11651
|
|
11511
11652
|
/***/ }),
|
11512
|
-
/*
|
11653
|
+
/* 67 */
|
11513
11654
|
/***/ (function() {
|
11514
11655
|
|
11515
11656
|
var __extends = (this && this.__extends) || (function () {
|
@@ -11597,7 +11738,7 @@ up.store.Session = /** @class */ (function (_super) {
|
|
11597
11738
|
|
11598
11739
|
|
11599
11740
|
/***/ }),
|
11600
|
-
/*
|
11741
|
+
/* 68 */
|
11601
11742
|
/***/ (function() {
|
11602
11743
|
|
11603
11744
|
var u = up.util;
|
@@ -11759,7 +11900,7 @@ up.Tether = /** @class */ (function () {
|
|
11759
11900
|
|
11760
11901
|
|
11761
11902
|
/***/ }),
|
11762
|
-
/*
|
11903
|
+
/* 69 */
|
11763
11904
|
/***/ (function() {
|
11764
11905
|
|
11765
11906
|
var u = up.util;
|
@@ -11787,7 +11928,17 @@ up.URLPattern = /** @class */ (function () {
|
|
11787
11928
|
if (!list.length) {
|
11788
11929
|
return;
|
11789
11930
|
}
|
11790
|
-
|
11931
|
+
list = list.map(function (url) {
|
11932
|
+
// If the current browser location is multiple directories deep (e.g. /foo/bar),
|
11933
|
+
// a leading asterisk would be normalized to /foo/*. So we prepend a slash.
|
11934
|
+
if (url[0] === '*') {
|
11935
|
+
url = '/' + url;
|
11936
|
+
}
|
11937
|
+
url = _this.normalizeURL(url);
|
11938
|
+
url = u.escapeRegExp(url);
|
11939
|
+
return url;
|
11940
|
+
});
|
11941
|
+
var reCode = list.join('|');
|
11791
11942
|
reCode = reCode.replace(/\\\*/g, '.*?');
|
11792
11943
|
reCode = reCode.replace(/(:|\\\$)([a-z][\w-]*)/ig, function (match, type, name) {
|
11793
11944
|
// It's \\$ instead of $ because we do u.escapeRegExp above
|
@@ -11843,14 +11994,32 @@ up.URLPattern = /** @class */ (function () {
|
|
11843
11994
|
|
11844
11995
|
|
11845
11996
|
/***/ }),
|
11846
|
-
/*
|
11997
|
+
/* 70 */
|
11847
11998
|
/***/ (function() {
|
11848
11999
|
|
11849
12000
|
/*-
|
12001
|
+
Framework initialization
|
12002
|
+
========================
|
12003
|
+
|
12004
|
+
The `up.framework` module lets you customize Unpoly's [initialization sequence](/install#initialization).
|
12005
|
+
|
12006
|
+
@see up.boot
|
12007
|
+
@see script[up-boot=manual]
|
12008
|
+
@see up.framework.isSupported
|
12009
|
+
|
11850
12010
|
@module up.framework
|
11851
12011
|
*/
|
11852
12012
|
up.framework = (function () {
|
11853
|
-
|
12013
|
+
// Event up.framework.readyState document.readyState
|
12014
|
+
// ------------------------------------------------------------------------------------------------------
|
12015
|
+
// Browser starts parsing HTML - loading
|
12016
|
+
// Unpoly script is running evaling loading (if sync) or interactive (if defered)
|
12017
|
+
// ... submodules are running evaling loading (if sync) or interactive (if defered)
|
12018
|
+
// User scripts are running configuring loading (if sync) or interactive (if defered)
|
12019
|
+
// DOMContentLoaded configuring => booting interactive
|
12020
|
+
// Initial page is compiling booting interactive
|
12021
|
+
// Document resources loaded booted complete
|
12022
|
+
var readyState = 'evaling'; // evaling => configuring => booting => booted
|
11854
12023
|
/*-
|
11855
12024
|
Resets Unpoly to the state when it was booted.
|
11856
12025
|
All custom event handlers, animations, etc. that have been registered
|
@@ -11871,64 +12040,172 @@ up.framework = (function () {
|
|
11871
12040
|
@internal
|
11872
12041
|
*/
|
11873
12042
|
/*-
|
11874
|
-
|
12043
|
+
Manually boots the Unpoly framework.
|
12044
|
+
|
12045
|
+
It is not usually necessary to call `up.boot()` yourself. When you load [Unpoly's JavaScript file](/install),
|
12046
|
+
Unpoly will automatically boot on [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded_event).
|
12047
|
+
There are only two cases when you would boot manually:
|
12048
|
+
|
12049
|
+
- When you load Unpoly with `<script async>`
|
12050
|
+
- When you explicitly ask to manually boot by loading Unpoly with [`<script up-boot="manual">`](/script-up-boot-manual).
|
11875
12051
|
|
11876
|
-
|
12052
|
+
Before you manually boot, Unpoly should be configured and compilers should be registered.
|
12053
|
+
Booting will cause Unpoly to [compile](/up.hello) the initial page.
|
11877
12054
|
|
11878
|
-
Unpoly will
|
12055
|
+
Unpoly will refuse to boot if the current browser is [not supported](/up.framework.isSupported).
|
11879
12056
|
This leaves you with a classic server-side application on legacy browsers.
|
11880
12057
|
|
11881
12058
|
@function up.boot
|
11882
|
-
@
|
12059
|
+
@experimental
|
11883
12060
|
*/
|
11884
12061
|
function boot() {
|
12062
|
+
if (readyState !== 'configuring') {
|
12063
|
+
// In an app with a lot of async script the user may attempt to boot us twice.
|
12064
|
+
console.error('Unpoly has already booted');
|
12065
|
+
return;
|
12066
|
+
}
|
11885
12067
|
// This is called synchronously after all Unpoly modules have been parsed
|
11886
12068
|
// and executed. We cannot delay booting until the DOM is ready, since by then
|
11887
12069
|
// all user-defined event listeners and compilers will have registered.
|
11888
12070
|
// Note that any non-async scripts after us will delay DOMContentLoaded.
|
11889
|
-
var supportIssue = up.
|
12071
|
+
var supportIssue = up.framework.supportIssue();
|
11890
12072
|
if (!supportIssue) {
|
11891
|
-
//
|
11892
|
-
//
|
11893
|
-
|
11894
|
-
// been registered. We need to know this state for when we up.reset() later.
|
11895
|
-
// - Run delayed initialization that could not run at load time due to
|
11896
|
-
// circular dependencies.
|
12073
|
+
// Change the state in case any user-provided compiler calls up.boot().
|
12074
|
+
// up.boot() is a no-op unless readyState === 'configuring'.
|
12075
|
+
readyState = 'booting';
|
11897
12076
|
up.emit('up:framework:boot', { log: false });
|
11898
|
-
|
11899
|
-
|
11900
|
-
|
11901
|
-
|
11902
|
-
|
11903
|
-
|
11904
|
-
|
11905
|
-
|
11906
|
-
|
11907
|
-
|
11908
|
-
|
12077
|
+
readyState = 'booted';
|
12078
|
+
}
|
12079
|
+
else {
|
12080
|
+
console.error("Unpoly cannot boot: %s", supportIssue);
|
12081
|
+
}
|
12082
|
+
}
|
12083
|
+
function mustBootManually() {
|
12084
|
+
var unpolyScript = document.currentScript;
|
12085
|
+
// If we're is loaded via <script async>, there are no guarantees
|
12086
|
+
// when we're called or when subsequent scripts that configure Unpoly
|
12087
|
+
// have executed
|
12088
|
+
if (unpolyScript === null || unpolyScript === void 0 ? void 0 : unpolyScript.async) {
|
12089
|
+
return true;
|
12090
|
+
}
|
12091
|
+
// If we're loaded with <script up-boot="manual"> the user explicitly
|
12092
|
+
// requested to boot Unpoly manually.
|
12093
|
+
if ((unpolyScript === null || unpolyScript === void 0 ? void 0 : unpolyScript.getAttribute('up-boot')) === 'manual') {
|
12094
|
+
return true;
|
12095
|
+
}
|
12096
|
+
// If we're loaded this late, someone loads us dynamically.
|
12097
|
+
// We don't know when subsequent scripts that configure Unpoly
|
12098
|
+
// have executed.
|
12099
|
+
if (document.readyState === 'complete') {
|
12100
|
+
return true;
|
12101
|
+
}
|
12102
|
+
}
|
12103
|
+
/*-
|
12104
|
+
Prevent Unpoly from booting automatically.
|
12105
|
+
|
12106
|
+
By default Unpoly [automatically boots](/install#initialization)
|
12107
|
+
on [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded_event).
|
12108
|
+
To prevent this, add an `[up-boot="manual"]` attribute to the `<script>` element
|
12109
|
+
that loads Unpoly:
|
12110
|
+
|
12111
|
+
```html
|
12112
|
+
<script src="unpoly.js" up-boot="manual"></script>
|
12113
|
+
```
|
12114
|
+
You may then call `up.boot()` to manually boot Unpoly at a later time.
|
12115
|
+
|
12116
|
+
### Browser support
|
12117
|
+
|
12118
|
+
To use this feature in Internet Explorer 11 you need a polyfill for `document.currentScript`.
|
12119
|
+
|
12120
|
+
@selector script[up-boot=manual]
|
12121
|
+
@experimental
|
12122
|
+
*/
|
12123
|
+
function onEvaled() {
|
12124
|
+
up.emit('up:framework:evaled', { log: false });
|
12125
|
+
if (mustBootManually()) {
|
12126
|
+
console.debug('Call up.boot() after you have configured Unpoly');
|
11909
12127
|
}
|
11910
12128
|
else {
|
11911
|
-
|
12129
|
+
// (1) On DOMContentLoaded we know that all non-[async] scripts have executed.
|
12130
|
+
// (2) Deferred scripts execute after the DOM was parsed (document.readyState === 'interactive'),
|
12131
|
+
// but before DOMContentLoaded. That's why we must *not* boot synchonously when
|
12132
|
+
// document.readyState === 'interactive'. We must wait until DOMContentLoaded, when we know that
|
12133
|
+
// subsequent users scripts have executed and (possibly) configured Unpoly.
|
12134
|
+
// (3) There are no guarantees when [async] scripts execute. These must boot Unpoly manually.
|
12135
|
+
document.addEventListener('DOMContentLoaded', boot);
|
11912
12136
|
}
|
12137
|
+
// After this line user scripts may run and configure Unpoly, add compilers, etc.
|
12138
|
+
readyState = 'configuring';
|
11913
12139
|
}
|
11914
12140
|
function startExtension() {
|
11915
|
-
|
12141
|
+
if (readyState !== 'configuring') {
|
12142
|
+
throw new Error('Unpoly extensions must be loaded before booting');
|
12143
|
+
}
|
12144
|
+
readyState = 'evaling';
|
11916
12145
|
}
|
11917
12146
|
function stopExtension() {
|
11918
|
-
|
12147
|
+
readyState = 'configuring';
|
12148
|
+
}
|
12149
|
+
/*-
|
12150
|
+
Returns whether Unpoly can boot in the current browser.
|
12151
|
+
|
12152
|
+
If this returns `false` Unpoly will prevent itself from [booting](/up.boot)
|
12153
|
+
and will not [compile](/up.compiler) the initial page.
|
12154
|
+
This leaves you with a classic server-side application.
|
12155
|
+
|
12156
|
+
### Browser support
|
12157
|
+
|
12158
|
+
Unpoly aims to supports all modern browsers.
|
12159
|
+
|
12160
|
+
#### Chrome, Firefox, Edge, Safari
|
12161
|
+
|
12162
|
+
Full support.
|
12163
|
+
|
12164
|
+
#### Internet Explorer 11
|
12165
|
+
|
12166
|
+
Full support with a `Promise` polyfill like [es6-promise](https://github.com/stefanpenner/es6-promise) (2.4 KB).\
|
12167
|
+
Support may be removed when Microsoft retires IE11 in [June 2022](https://blogs.windows.com/windowsexperience/2021/05/19/the-future-of-internet-explorer-on-windows-10-is-in-microsoft-edge/).
|
12168
|
+
|
12169
|
+
#### Internet Explorer 10 or lower
|
12170
|
+
|
12171
|
+
Unpoly will not boot or [run compilers](/up.compiler),
|
12172
|
+
leaving you with a classic server-side application.
|
12173
|
+
|
12174
|
+
@function up.framework.isSupported
|
12175
|
+
@stable
|
12176
|
+
*/
|
12177
|
+
function isSupported() {
|
12178
|
+
return !supportIssue();
|
12179
|
+
}
|
12180
|
+
function supportIssue() {
|
12181
|
+
if (!up.browser.canPromise()) {
|
12182
|
+
return "Browser doesn't support promises";
|
12183
|
+
}
|
12184
|
+
if (document.compatMode === 'BackCompat') {
|
12185
|
+
return 'Browser is in quirks mode (missing DOCTYPE?)';
|
12186
|
+
}
|
12187
|
+
if (up.browser.isEdge18()) {
|
12188
|
+
return 'Edge 18 or lower is unsupported';
|
12189
|
+
}
|
11919
12190
|
}
|
11920
12191
|
return {
|
12192
|
+
onEvaled: onEvaled,
|
11921
12193
|
boot: boot,
|
11922
12194
|
startExtension: startExtension,
|
11923
12195
|
stopExtension: stopExtension,
|
11924
12196
|
reset: emitReset,
|
11925
|
-
get
|
12197
|
+
get evaling() { return readyState === 'evaling'; },
|
12198
|
+
get booted() { return readyState === 'booted'; },
|
12199
|
+
get beforeBoot() { return readyState !== 'booting' && readyState !== 'booted'; },
|
12200
|
+
isSupported: isSupported,
|
12201
|
+
supportIssue: supportIssue,
|
11926
12202
|
};
|
11927
12203
|
})();
|
12204
|
+
up.boot = up.framework.boot;
|
11928
12205
|
|
11929
12206
|
|
11930
12207
|
/***/ }),
|
11931
|
-
/*
|
12208
|
+
/* 71 */
|
11932
12209
|
/***/ (function() {
|
11933
12210
|
|
11934
12211
|
/*-
|
@@ -11940,7 +12217,7 @@ This module contains functions to [emit](/up.emit) and [observe](/up.on) DOM eve
|
|
11940
12217
|
While the browser also has built-in functions to work with events,
|
11941
12218
|
you will find Unpoly's functions to be very concise and feature-rich.
|
11942
12219
|
|
11943
|
-
|
12220
|
+
### Events emitted by Unpoly
|
11944
12221
|
|
11945
12222
|
Most Unpoly features emit events that are prefixed with `up:`.
|
11946
12223
|
|
@@ -11981,6 +12258,7 @@ up.event = (function () {
|
|
11981
12258
|
|
11982
12259
|
- You may pass a selector for [event delegation](https://davidwalsh.name/event-delegate).
|
11983
12260
|
- The event target is automatically passed as a second argument.
|
12261
|
+
- Your event listener will not be called when Unpoly has not [booted](/up.boot) in an unsupported browser
|
11984
12262
|
- You may register a listener to multiple events by passing a space-separated list of event name (e.g. `"click mousedown"`)
|
11985
12263
|
- You may register a listener to multiple elements in a single `up.on()` call, by passing a [list](/up.util.isList) of elements.
|
11986
12264
|
- You use an [`[up-data]`](/up-data) attribute to [attach structured data](/up.on#attaching-structured-data)
|
@@ -12422,30 +12700,6 @@ up.event = (function () {
|
|
12422
12700
|
event.stopImmediatePropagation();
|
12423
12701
|
event.preventDefault();
|
12424
12702
|
}
|
12425
|
-
/*-
|
12426
|
-
Runs the given callback when the the initial HTML document has been completely loaded.
|
12427
|
-
|
12428
|
-
The callback is guaranteed to see the fully parsed DOM tree.
|
12429
|
-
This function does not wait for stylesheets, images or frames to finish loading.
|
12430
|
-
|
12431
|
-
If `up.event.onReady()` is called after the initial document was loaded,
|
12432
|
-
the given callback is run immediately.
|
12433
|
-
|
12434
|
-
@function up.event.onReady
|
12435
|
-
@param {Function} callback
|
12436
|
-
The function to call then the DOM tree is acessible.
|
12437
|
-
@experimental
|
12438
|
-
*/
|
12439
|
-
function onReady(callback) {
|
12440
|
-
// Values are "loading", "interactive" and "completed".
|
12441
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState
|
12442
|
-
if (document.readyState !== 'loading') {
|
12443
|
-
callback();
|
12444
|
-
}
|
12445
|
-
else {
|
12446
|
-
document.addEventListener('DOMContentLoaded', callback);
|
12447
|
-
}
|
12448
|
-
}
|
12449
12703
|
var keyModifiers = ['metaKey', 'shiftKey', 'ctrlKey', 'altKey'];
|
12450
12704
|
/*-
|
12451
12705
|
@function up.event.isUnmodified
|
@@ -12531,7 +12785,6 @@ up.event = (function () {
|
|
12531
12785
|
assertEmitted: assertEmitted,
|
12532
12786
|
onEscape: onEscape,
|
12533
12787
|
halt: halt,
|
12534
|
-
onReady: onReady,
|
12535
12788
|
isUnmodified: isUnmodified,
|
12536
12789
|
fork: fork,
|
12537
12790
|
keyModifiers: keyModifiers
|
@@ -12545,7 +12798,7 @@ up.emit = up.event.emit;
|
|
12545
12798
|
|
12546
12799
|
|
12547
12800
|
/***/ }),
|
12548
|
-
/*
|
12801
|
+
/* 72 */
|
12549
12802
|
/***/ (function() {
|
12550
12803
|
|
12551
12804
|
/*-
|
@@ -12564,7 +12817,7 @@ While the protocol can help you optimize performance and handle some edge cases,
|
|
12564
12817
|
implementing it is **entirely optional**. For instance, `unpoly.com` itself is a static site
|
12565
12818
|
that uses Unpoly on the frontend and doesn't even have an active server component.
|
12566
12819
|
|
12567
|
-
|
12820
|
+
### Existing implementations
|
12568
12821
|
|
12569
12822
|
You should be able to implement the protocol in a very short time.
|
12570
12823
|
|
@@ -12763,23 +13016,39 @@ up.protocol = (function () {
|
|
12763
13016
|
return extractHeader(xhr, 'clearCache', parseClearCacheValue);
|
12764
13017
|
}
|
12765
13018
|
/*-
|
12766
|
-
The server may send this optional response header
|
13019
|
+
The server may send this optional response header to control which previously cached responses should be [uncached](/up.cache.clear) after this response.
|
12767
13020
|
|
12768
|
-
|
13021
|
+
The value of this header is a [URL pattern](/url-patterns) matching responses that should be uncached.
|
13022
|
+
|
13023
|
+
For example, to uncache all responses to URLs starting with `/notes/`:
|
12769
13024
|
|
12770
13025
|
```http
|
12771
|
-
X-Up-Cache:
|
13026
|
+
X-Up-Clear-Cache: /notes/*
|
12772
13027
|
```
|
12773
13028
|
|
12774
|
-
|
12775
|
-
|
12776
|
-
|
13029
|
+
### Overriding the client-side default
|
13030
|
+
|
13031
|
+
If the server does not send an `X-Up-Clear-Cache` header, Unpoly will [clear the entire cache](/up.network.config#config.clearCache) after a non-GET request.
|
13032
|
+
|
13033
|
+
You may force Unpoly to *keep* the cache after a non-GET request:
|
13034
|
+
|
13035
|
+
```http
|
13036
|
+
X-Up-Clear-Cache: false
|
13037
|
+
```
|
13038
|
+
|
13039
|
+
You may also force Unpoly to *clear* the cache after a GET request:
|
13040
|
+
|
13041
|
+
```http
|
13042
|
+
X-Up-Clear-Cache: *
|
13043
|
+
```
|
13044
|
+
|
13045
|
+
@header X-Up-Clear-Cache
|
12777
13046
|
@stable
|
12778
13047
|
*/
|
12779
13048
|
/*-
|
12780
13049
|
This request header contains a timestamp of an existing fragment that is being [reloaded](/up.reload).
|
12781
13050
|
|
12782
|
-
The timestamp must be
|
13051
|
+
The timestamp must be explicitly set by the user as an `[up-time]` attribute on the fragment.
|
12783
13052
|
It should indicate the time when the fragment's underlying data was last changed.
|
12784
13053
|
|
12785
13054
|
See `[up-time]` for a detailed example.
|
@@ -13093,7 +13362,7 @@ up.protocol = (function () {
|
|
13093
13362
|
### Rendering content
|
13094
13363
|
|
13095
13364
|
The response may contain `text/html` content. If the root layer is targeted,
|
13096
|
-
the `X-Up-
|
13365
|
+
the `X-Up-Dismiss-Layer` header is ignored and the fragment is updated with
|
13097
13366
|
the response's HTML content.
|
13098
13367
|
|
13099
13368
|
If you know that an overlay will be closed don't want to render HTML,
|
@@ -13102,7 +13371,7 @@ up.protocol = (function () {
|
|
13102
13371
|
```http
|
13103
13372
|
HTTP/1.1 200 OK
|
13104
13373
|
Content-Type: text/html
|
13105
|
-
X-Up-
|
13374
|
+
X-Up-Dismiss-Layer: {"user_id": 1012}
|
13106
13375
|
X-Up-Target: :none
|
13107
13376
|
```
|
13108
13377
|
|
@@ -13224,11 +13493,27 @@ up.protocol = (function () {
|
|
13224
13493
|
<meta name='csrf-token' content='secret12345'>
|
13225
13494
|
```
|
13226
13495
|
|
13496
|
+
@param {string|Function(): string} [config.cspNonce]
|
13497
|
+
A [CSP script nonce](https://content-security-policy.com/nonce/)
|
13498
|
+
for the initial page that [booted](/up.boot) Unpoly.
|
13499
|
+
|
13500
|
+
The nonce let Unpoly run JavaScript in HTML attributes like
|
13501
|
+
[`[up-on-loaded]`](/a-up-follow#up-on-loaded) or [`[up-on-accepted]`](/a-up-layer-new#up-on-accepted).
|
13502
|
+
See [Working with a strict Content Security Policy](/csp).
|
13503
|
+
|
13504
|
+
The nonce can either be configured as a string or as function that returns the nonce.
|
13505
|
+
|
13506
|
+
Defaults to the `content` attribute of a `<meta>` tag named `csp-nonce`:
|
13507
|
+
|
13508
|
+
```
|
13509
|
+
<meta name='csrf-token' content='secret98765'>
|
13510
|
+
```
|
13511
|
+
|
13227
13512
|
@param {string} [config.methodParam='_method']
|
13228
13513
|
The name of request parameter containing the original request method when Unpoly needs to wrap
|
13229
13514
|
the method.
|
13230
13515
|
|
13231
|
-
Methods must be wrapped when making a [full page request](/up.
|
13516
|
+
Methods must be wrapped when making a [full page request](/up.network.loadPage) with a methods other
|
13232
13517
|
than GET or POST. In this case Unpoly will make a POST request with the original request method
|
13233
13518
|
in a form parameter named `_method`:
|
13234
13519
|
|
@@ -13246,7 +13531,9 @@ up.protocol = (function () {
|
|
13246
13531
|
methodParam: '_method',
|
13247
13532
|
csrfParam: function () { return e.metaContent('csrf-param'); },
|
13248
13533
|
csrfToken: function () { return e.metaContent('csrf-token'); },
|
13249
|
-
|
13534
|
+
cspNonce: function () { return e.metaContent('csp-nonce'); },
|
13535
|
+
csrfHeader: 'X-CSRF-Token',
|
13536
|
+
nonceableAttributes: ['up-observe', 'up-on-accepted', 'up-on-dismissed', 'up-on-loaded', 'up-on-finished', 'up-observe'],
|
13250
13537
|
}); });
|
13251
13538
|
function csrfHeader() {
|
13252
13539
|
return u.evalOption(config.csrfHeader);
|
@@ -13257,6 +13544,26 @@ up.protocol = (function () {
|
|
13257
13544
|
function csrfToken() {
|
13258
13545
|
return u.evalOption(config.csrfToken);
|
13259
13546
|
}
|
13547
|
+
function cspNonce() {
|
13548
|
+
return u.evalOption(config.cspNonce);
|
13549
|
+
}
|
13550
|
+
function cspNoncesFromHeader(cspHeader) {
|
13551
|
+
var nonces = [];
|
13552
|
+
if (cspHeader) {
|
13553
|
+
var parts = cspHeader.split(/\s*;\s*/);
|
13554
|
+
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
13555
|
+
var part = parts_1[_i];
|
13556
|
+
if (part.indexOf('script-src') === 0) {
|
13557
|
+
var noncePattern = /'nonce-([^']+)'/g;
|
13558
|
+
var match = void 0;
|
13559
|
+
while (match = noncePattern.exec(part)) {
|
13560
|
+
nonces.push(match[1]);
|
13561
|
+
}
|
13562
|
+
}
|
13563
|
+
}
|
13564
|
+
}
|
13565
|
+
return nonces;
|
13566
|
+
}
|
13260
13567
|
function wrapMethod(method, params) {
|
13261
13568
|
params.add(config.methodParam, method);
|
13262
13569
|
return 'POST';
|
@@ -13280,15 +13587,17 @@ up.protocol = (function () {
|
|
13280
13587
|
csrfHeader: csrfHeader,
|
13281
13588
|
csrfParam: csrfParam,
|
13282
13589
|
csrfToken: csrfToken,
|
13590
|
+
cspNonce: cspNonce,
|
13283
13591
|
initialRequestMethod: initialRequestMethod,
|
13284
13592
|
headerize: headerize,
|
13285
|
-
wrapMethod: wrapMethod
|
13593
|
+
wrapMethod: wrapMethod,
|
13594
|
+
cspNoncesFromHeader: cspNoncesFromHeader,
|
13286
13595
|
};
|
13287
13596
|
})();
|
13288
13597
|
|
13289
13598
|
|
13290
13599
|
/***/ }),
|
13291
|
-
/*
|
13600
|
+
/* 73 */
|
13292
13601
|
/***/ (function() {
|
13293
13602
|
|
13294
13603
|
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
@@ -13317,13 +13626,13 @@ up.log = (function () {
|
|
13317
13626
|
Configures the logging output on the developer console.
|
13318
13627
|
|
13319
13628
|
@property up.log.config
|
13320
|
-
@param {boolean} [
|
13629
|
+
@param {boolean} [config.enabled=false]
|
13321
13630
|
Whether Unpoly will print debugging information to the developer console.
|
13322
13631
|
|
13323
13632
|
Debugging information includes which elements are being [compiled](/up.syntax)
|
13324
13633
|
and which [events](/up.event) are being emitted.
|
13325
13634
|
Note that errors will always be printed, regardless of this setting.
|
13326
|
-
@param {boolean} [
|
13635
|
+
@param {boolean} [config.banner=true]
|
13327
13636
|
Print the Unpoly banner to the developer console.
|
13328
13637
|
@stable
|
13329
13638
|
*/
|
@@ -13401,7 +13710,7 @@ up.log = (function () {
|
|
13401
13710
|
console[stream].apply(console, __spreadArray([message], args));
|
13402
13711
|
}
|
13403
13712
|
}
|
13404
|
-
|
13713
|
+
function printBanner() {
|
13405
13714
|
if (!config.banner) {
|
13406
13715
|
return;
|
13407
13716
|
}
|
@@ -13427,8 +13736,8 @@ up.log = (function () {
|
|
13427
13736
|
else {
|
13428
13737
|
console.log(logo + text);
|
13429
13738
|
}
|
13430
|
-
}
|
13431
|
-
up.on('up:
|
13739
|
+
}
|
13740
|
+
up.on('up:framework:boot', printBanner);
|
13432
13741
|
up.on('up:framework:reset', reset);
|
13433
13742
|
function setEnabled(value) {
|
13434
13743
|
sessionStore.set('enabled', value);
|
@@ -13528,7 +13837,7 @@ up.log = (function () {
|
|
13528
13837
|
disable: disable,
|
13529
13838
|
fail: fail,
|
13530
13839
|
muteUncriticalRejection: muteUncriticalRejection,
|
13531
|
-
isEnabled: function () { return config.enabled; }
|
13840
|
+
isEnabled: function () { return config.enabled; },
|
13532
13841
|
};
|
13533
13842
|
})();
|
13534
13843
|
up.puts = up.log.puts;
|
@@ -13537,7 +13846,7 @@ up.fail = up.log.fail;
|
|
13537
13846
|
|
13538
13847
|
|
13539
13848
|
/***/ }),
|
13540
|
-
/*
|
13849
|
+
/* 74 */
|
13541
13850
|
/***/ (function() {
|
13542
13851
|
|
13543
13852
|
/*-
|
@@ -13795,7 +14104,7 @@ up.syntax = (function () {
|
|
13795
14104
|
args[_i] = arguments[_i];
|
13796
14105
|
}
|
13797
14106
|
var macro = buildCompiler(args);
|
13798
|
-
if (up.framework.
|
14107
|
+
if (up.framework.evaling) {
|
13799
14108
|
macro.priority = detectSystemMacroPriority(macro.selector) ||
|
13800
14109
|
up.fail('Unregistered priority for system macro %o', macro.selector);
|
13801
14110
|
}
|
@@ -13860,7 +14169,7 @@ up.syntax = (function () {
|
|
13860
14169
|
var _a = parseCompilerArgs(args), selector = _a[0], options = _a[1], callback = _a[2];
|
13861
14170
|
options = u.options(options, {
|
13862
14171
|
selector: selector,
|
13863
|
-
isDefault: up.framework.
|
14172
|
+
isDefault: up.framework.evaling,
|
13864
14173
|
priority: 0,
|
13865
14174
|
batch: false,
|
13866
14175
|
keep: false,
|
@@ -13869,6 +14178,9 @@ up.syntax = (function () {
|
|
13869
14178
|
return u.assign(callback, options);
|
13870
14179
|
}
|
13871
14180
|
function insertCompiler(queue, newCompiler) {
|
14181
|
+
if (up.framework.booted) {
|
14182
|
+
up.puts('up.compiler()', 'Compiler %s was registered after booting Unpoly. Compiler will run for future fragments.', newCompiler.selector);
|
14183
|
+
}
|
13872
14184
|
var existingCompiler;
|
13873
14185
|
var index = 0;
|
13874
14186
|
while ((existingCompiler = queue[index]) && (existingCompiler.priority >= newCompiler.priority)) {
|
@@ -14056,7 +14368,7 @@ up.data = up.syntax.data;
|
|
14056
14368
|
|
14057
14369
|
|
14058
14370
|
/***/ }),
|
14059
|
-
/*
|
14371
|
+
/* 75 */
|
14060
14372
|
/***/ (function() {
|
14061
14373
|
|
14062
14374
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
@@ -14335,7 +14647,7 @@ up.history = (function () {
|
|
14335
14647
|
replace(currentLocation(), { event: false });
|
14336
14648
|
}
|
14337
14649
|
}
|
14338
|
-
up.on('up:
|
14650
|
+
up.on('up:framework:boot', function () {
|
14339
14651
|
if ('jasmine' in window) {
|
14340
14652
|
// Can't delay this in tests.
|
14341
14653
|
register();
|
@@ -14400,7 +14712,7 @@ up.history = (function () {
|
|
14400
14712
|
|
14401
14713
|
|
14402
14714
|
/***/ }),
|
14403
|
-
/*
|
14715
|
+
/* 76 */
|
14404
14716
|
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
14405
14717
|
|
14406
14718
|
var __assign = (this && this.__assign) || function () {
|
@@ -14414,7 +14726,7 @@ var __assign = (this && this.__assign) || function () {
|
|
14414
14726
|
};
|
14415
14727
|
return __assign.apply(this, arguments);
|
14416
14728
|
};
|
14417
|
-
__webpack_require__(
|
14729
|
+
__webpack_require__(77);
|
14418
14730
|
var u = up.util;
|
14419
14731
|
var e = up.element;
|
14420
14732
|
/*-
|
@@ -14815,7 +15127,7 @@ up.fragment = (function () {
|
|
14815
15127
|
for the fragment.
|
14816
15128
|
|
14817
15129
|
@param {string|Element} [options.fragment]
|
14818
|
-
A string of HTML comprising *only* the new fragment.
|
15130
|
+
A string of HTML comprising *only* the new fragment's [outer HTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML).
|
14819
15131
|
|
14820
15132
|
The `{ target }` selector will be derived from the root element in the given
|
14821
15133
|
HTML:
|
@@ -14915,11 +15227,17 @@ up.fragment = (function () {
|
|
14915
15227
|
@param {boolean|string} [options.clearCache]
|
14916
15228
|
Whether existing [cache](/up.request#caching) entries will be [cleared](/up.cache.clear) with this request.
|
14917
15229
|
|
14918
|
-
|
15230
|
+
Defaults to the result of `up.network.config.clearCache`, which
|
15231
|
+
defaults to clearing the entire cache after a non-GET request.
|
14919
15232
|
|
14920
|
-
|
15233
|
+
To only uncache some requests, pass an [URL pattern](/url-patterns) that matches requests to uncache.
|
15234
|
+
You may also pass a function that accepts an existing `up.Request` and returns a boolean value.
|
14921
15235
|
|
14922
|
-
|
15236
|
+
@param {boolean|string|Function(request): boolean} [options.solo]
|
15237
|
+
With `{ solo: true }` Unpoly will [abort](/up.network.abort) all other requests before laoding the new fragment.
|
15238
|
+
|
15239
|
+
To only abort some requests, pass an [URL pattern](/url-patterns) that matches requests to abort.
|
15240
|
+
You may also pass a function that accepts an existing `up.Request` and returns a boolean value.
|
14923
15241
|
|
14924
15242
|
@param {Element|jQuery} [options.origin]
|
14925
15243
|
The element that triggered the change.
|
@@ -15106,12 +15424,19 @@ up.fragment = (function () {
|
|
15106
15424
|
to mutate options to the `up.render()` call that will process the server response.
|
15107
15425
|
|
15108
15426
|
@event up:fragment:loaded
|
15427
|
+
|
15109
15428
|
@param event.preventDefault()
|
15110
15429
|
Event listeners may call this method to prevent the fragment change.
|
15430
|
+
|
15111
15431
|
@param {up.Request} event.request
|
15112
15432
|
The original request to the server.
|
15433
|
+
|
15113
15434
|
@param {up.Response} event.response
|
15114
15435
|
The server response.
|
15436
|
+
|
15437
|
+
@param {Element} [event.origin]
|
15438
|
+
The link or form element that caused the fragment update.
|
15439
|
+
|
15115
15440
|
@param {Object} event.renderOptions
|
15116
15441
|
Options for the `up.render()` call that will process the server response.
|
15117
15442
|
@stable
|
@@ -15218,14 +15543,16 @@ up.fragment = (function () {
|
|
15218
15543
|
@stable
|
15219
15544
|
*/
|
15220
15545
|
/*-
|
15221
|
-
|
15546
|
+
Manually compiles a page fragment that has been inserted into the DOM
|
15222
15547
|
by external code.
|
15223
15548
|
|
15549
|
+
All registered [compilers](/up.compiler) and [macros](/up.macro) will be called
|
15550
|
+
with matches in the given `element`.
|
15551
|
+
|
15224
15552
|
**As long as you manipulate the DOM using Unpoly, you will never
|
15225
|
-
need to call
|
15553
|
+
need to call `up.hello()`.** You only need to use `up.hello()` if the
|
15226
15554
|
DOM is manipulated without Unpoly' involvement, e.g. by setting
|
15227
|
-
the `innerHTML` property
|
15228
|
-
`html`, `insertAfter` or `appendTo`:
|
15555
|
+
the `innerHTML` property:
|
15229
15556
|
|
15230
15557
|
```html
|
15231
15558
|
element = document.createElement('div')
|
@@ -15237,7 +15564,7 @@ up.fragment = (function () {
|
|
15237
15564
|
event.
|
15238
15565
|
|
15239
15566
|
@function up.hello
|
15240
|
-
@param {Element|jQuery}
|
15567
|
+
@param {Element|jQuery} element
|
15241
15568
|
@param {Element|jQuery} [options.origin]
|
15242
15569
|
@return {Element}
|
15243
15570
|
The compiled element
|
@@ -16178,7 +16505,7 @@ up.fragment = (function () {
|
|
16178
16505
|
selector = parseSelector(selector, element, options);
|
16179
16506
|
return selector.matches(element);
|
16180
16507
|
}
|
16181
|
-
up.on('up:
|
16508
|
+
up.on('up:framework:boot', function () {
|
16182
16509
|
var body = document.body;
|
16183
16510
|
body.setAttribute('up-source', up.history.location);
|
16184
16511
|
hello(body);
|
@@ -16237,13 +16564,13 @@ u.delegate(up, 'context', function () { return up.layer.current; });
|
|
16237
16564
|
|
16238
16565
|
|
16239
16566
|
/***/ }),
|
16240
|
-
/*
|
16567
|
+
/* 77 */
|
16241
16568
|
/***/ (function() {
|
16242
16569
|
|
16243
16570
|
|
16244
16571
|
|
16245
16572
|
/***/ }),
|
16246
|
-
/*
|
16573
|
+
/* 78 */
|
16247
16574
|
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
16248
16575
|
|
16249
16576
|
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
@@ -16251,7 +16578,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
16251
16578
|
to[j] = from[i];
|
16252
16579
|
return to;
|
16253
16580
|
};
|
16254
|
-
__webpack_require__(
|
16581
|
+
__webpack_require__(79);
|
16255
16582
|
/*-
|
16256
16583
|
Scrolling viewports
|
16257
16584
|
===================
|
@@ -16748,23 +17075,6 @@ up.viewport = (function () {
|
|
16748
17075
|
return up.fragment.toTarget(viewport);
|
16749
17076
|
}
|
16750
17077
|
/*-
|
16751
|
-
Returns a hash with scroll positions.
|
16752
|
-
|
16753
|
-
Each key in the hash is a viewport selector. The corresponding
|
16754
|
-
value is the viewport's top scroll position:
|
16755
|
-
|
16756
|
-
up.viewport.scrollTops()
|
16757
|
-
=> { '.main': 0, '.sidebar': 73 }
|
16758
|
-
|
16759
|
-
@function up.viewport.scrollTops
|
16760
|
-
@return Object<string, number>
|
16761
|
-
@internal
|
16762
|
-
*/
|
16763
|
-
function scrollTops(options) {
|
16764
|
-
if (options === void 0) { options = {}; }
|
16765
|
-
return u.mapObject(getAll(options), function (viewport) { return [scrollTopKey(viewport), viewport.scrollTop]; });
|
16766
|
-
}
|
16767
|
-
/*-
|
16768
17078
|
@function up.viewport.fixedElements
|
16769
17079
|
@internal
|
16770
17080
|
*/
|
@@ -16808,6 +17118,19 @@ up.viewport = (function () {
|
|
16808
17118
|
options.layer.lastScrollTops.set(url, tops);
|
16809
17119
|
}
|
16810
17120
|
}
|
17121
|
+
/*-
|
17122
|
+
Returns a hash with scroll positions.
|
17123
|
+
|
17124
|
+
Each key in the hash is a viewport selector. The corresponding
|
17125
|
+
value is the viewport's top scroll position:
|
17126
|
+
|
17127
|
+
getScrollTops()
|
17128
|
+
=> { '.main': 0, '.sidebar': 73 }
|
17129
|
+
|
17130
|
+
@function up.viewport.getScrollTops
|
17131
|
+
@return Object<string, number>
|
17132
|
+
@internal
|
17133
|
+
*/
|
16811
17134
|
function getScrollTops(viewports) {
|
16812
17135
|
return u.mapObject(viewports, function (viewport) { return [scrollTopKey(viewport), viewport.scrollTop]; });
|
16813
17136
|
}
|
@@ -17080,8 +17403,9 @@ up.viewport = (function () {
|
|
17080
17403
|
return value === null || value === void 0 ? void 0 : value.replace(/^#/, '');
|
17081
17404
|
}
|
17082
17405
|
var userScrolled = false;
|
17083
|
-
up.on('scroll', { once: true }, function () { return userScrolled = true; });
|
17084
|
-
up.on('up:
|
17406
|
+
up.on('scroll', { once: true, beforeBoot: true }, function () { return userScrolled = true; });
|
17407
|
+
up.on('up:framework:boot', function () {
|
17408
|
+
// When the initial URL contains an #anchor link, the browser will automatically
|
17085
17409
|
// reveal a matching fragment. We want to override that behavior with our own,
|
17086
17410
|
// so we can honor configured obstructions. Since we cannot disable the automatic
|
17087
17411
|
// browser behavior we need to ensure our code runs after it.
|
@@ -17089,7 +17413,7 @@ up.viewport = (function () {
|
|
17089
17413
|
// In Chrome, when reloading, the browser behavior happens before DOMContentLoaded.
|
17090
17414
|
// However, when we follow a link with an #anchor URL, the browser
|
17091
17415
|
// behavior happens *after* DOMContentLoaded. Hence we wait one more task.
|
17092
|
-
|
17416
|
+
u.task(function () {
|
17093
17417
|
// If the user has scrolled while the page was loading, we will
|
17094
17418
|
// not reset their scroll position by revealing the #anchor fragment.
|
17095
17419
|
if (!userScrolled) {
|
@@ -17117,16 +17441,14 @@ up.viewport = (function () {
|
|
17117
17441
|
rootOverflowElement: rootOverflowElement,
|
17118
17442
|
isRoot: isRoot,
|
17119
17443
|
scrollbarWidth: scrollbarWidth,
|
17120
|
-
scrollTops: scrollTops,
|
17121
17444
|
saveScroll: saveScroll,
|
17122
17445
|
restoreScroll: restoreScroll,
|
17123
17446
|
resetScroll: resetScroll,
|
17124
17447
|
anchoredRight: anchoredRight,
|
17125
|
-
fixedElements: fixedElements,
|
17126
17448
|
absolutize: absolutize,
|
17127
17449
|
focus: doFocus,
|
17128
17450
|
tryFocus: tryFocus,
|
17129
|
-
makeFocusable: makeFocusable
|
17451
|
+
makeFocusable: makeFocusable,
|
17130
17452
|
};
|
17131
17453
|
})();
|
17132
17454
|
up.focus = up.viewport.focus;
|
@@ -17135,13 +17457,13 @@ up.reveal = up.viewport.reveal;
|
|
17135
17457
|
|
17136
17458
|
|
17137
17459
|
/***/ }),
|
17138
|
-
/*
|
17460
|
+
/* 79 */
|
17139
17461
|
/***/ (function() {
|
17140
17462
|
|
17141
17463
|
|
17142
17464
|
|
17143
17465
|
/***/ }),
|
17144
|
-
/*
|
17466
|
+
/* 80 */
|
17145
17467
|
/***/ (function() {
|
17146
17468
|
|
17147
17469
|
var __assign = (this && this.__assign) || function () {
|
@@ -17709,7 +18031,7 @@ up.motion = (function () {
|
|
17709
18031
|
*/
|
17710
18032
|
function registerTransition(name, transition) {
|
17711
18033
|
var fn = findTransitionFn(transition);
|
17712
|
-
fn.isDefault = up.framework.
|
18034
|
+
fn.isDefault = up.framework.evaling;
|
17713
18035
|
namedTransitions[name] = fn;
|
17714
18036
|
}
|
17715
18037
|
/*-
|
@@ -17748,16 +18070,16 @@ up.motion = (function () {
|
|
17748
18070
|
*/
|
17749
18071
|
function registerAnimation(name, animation) {
|
17750
18072
|
var fn = findAnimationFn(animation);
|
17751
|
-
fn.isDefault = up.framework.
|
18073
|
+
fn.isDefault = up.framework.evaling;
|
17752
18074
|
namedAnimations[name] = fn;
|
17753
18075
|
}
|
17754
|
-
function
|
18076
|
+
up.on('up:framework:boot', function () {
|
17755
18077
|
// Explain to the user why animations aren't working.
|
17756
18078
|
// E.g. the user might have disabled animations in her OS.
|
17757
18079
|
if (!isEnabled()) {
|
17758
18080
|
up.puts('up.motion', 'Animations are disabled');
|
17759
18081
|
}
|
17760
|
-
}
|
18082
|
+
});
|
17761
18083
|
/*-
|
17762
18084
|
Returns whether the given animation option will cause the animation
|
17763
18085
|
to be skipped.
|
@@ -17874,7 +18196,6 @@ up.motion = (function () {
|
|
17874
18196
|
@see server-errors
|
17875
18197
|
@stable
|
17876
18198
|
*/
|
17877
|
-
up.on('up:framework:boot', warnIfDisabled);
|
17878
18199
|
up.on('up:framework:reset', reset);
|
17879
18200
|
return {
|
17880
18201
|
morph: morph,
|
@@ -17897,10 +18218,10 @@ up.animate = up.motion.animate;
|
|
17897
18218
|
|
17898
18219
|
|
17899
18220
|
/***/ }),
|
17900
|
-
/*
|
18221
|
+
/* 81 */
|
17901
18222
|
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
17902
18223
|
|
17903
|
-
__webpack_require__(
|
18224
|
+
__webpack_require__(82);
|
17904
18225
|
var u = up.util;
|
17905
18226
|
/*-
|
17906
18227
|
Network requests
|
@@ -18126,7 +18447,7 @@ up.network = (function () {
|
|
18126
18447
|
By default Unpoly automatically clears the entire cache whenever it processes
|
18127
18448
|
a request with an non-GET HTTP method. To customize this rule, use `up.network.config.clearCache`.
|
18128
18449
|
|
18129
|
-
The server may also clear the cache by sending an [`X-Up-Cache
|
18450
|
+
The server may also clear the cache by sending an [`X-Up-Clear-Cache`](/X-Up-Clear-Cache) header.
|
18130
18451
|
|
18131
18452
|
@function up.cache.clear
|
18132
18453
|
@param {string} [pattern]
|
@@ -18272,11 +18593,17 @@ up.network = (function () {
|
|
18272
18593
|
@param {boolean|string} [options.clearCache]
|
18273
18594
|
Whether to [clear](/up.cache.clear) the [cache](/up.cache.get) after this request.
|
18274
18595
|
|
18275
|
-
You may also pass a [URL pattern](/url-patterns) to only clear matching requests.
|
18276
|
-
|
18277
18596
|
Defaults to the result of `up.network.config.clearCache`, which
|
18278
18597
|
defaults to clearing the entire cache after a non-GET request.
|
18279
18598
|
|
18599
|
+
You may also pass a [URL pattern](/url-patterns) to only uncache matching responses.
|
18600
|
+
|
18601
|
+
@param {boolean|string|Function} [options.solo]
|
18602
|
+
With `{ solo: true }` Unpoly will [abort](/up.network.abort) all other requests before making this new request.
|
18603
|
+
|
18604
|
+
To only abort some requests, pass an [URL pattern](/url-patterns) that matches requests to abort.
|
18605
|
+
You may also pass a function that accepts an existing `up.Request` and returns a boolean value.
|
18606
|
+
|
18280
18607
|
@param {Object} [options.headers={}]
|
18281
18608
|
An object of additional HTTP headers.
|
18282
18609
|
|
@@ -18306,6 +18633,11 @@ up.network = (function () {
|
|
18306
18633
|
@param {string} [options.layer='current']
|
18307
18634
|
The [layer](/up.layer) this request is associated with.
|
18308
18635
|
|
18636
|
+
If this request is intended to update an existing fragment, this is that fragment's layer.
|
18637
|
+
|
18638
|
+
If this request is intended to [open an overlay](/opening-overlays),
|
18639
|
+
the associated layer is the future overlay's parent layer.
|
18640
|
+
|
18309
18641
|
@param {string} [options.failLayer='current']
|
18310
18642
|
The [layer](/up.layer) this request is associated with if the server [sends a HTTP status code](/server-errors).
|
18311
18643
|
|
@@ -18462,6 +18794,24 @@ up.network = (function () {
|
|
18462
18794
|
*/
|
18463
18795
|
var isIdle = u.negate(isBusy);
|
18464
18796
|
/*-
|
18797
|
+
Makes a full-page request, replacing the entire browser environment with a new page from the server response.
|
18798
|
+
|
18799
|
+
Also see `up.Request#loadPage()`.
|
18800
|
+
|
18801
|
+
@function up.network.loadPage
|
18802
|
+
@param {string} options.url
|
18803
|
+
The URL to load.
|
18804
|
+
@param {string} [options.method='get']
|
18805
|
+
The method for the request.
|
18806
|
+
|
18807
|
+
Methods other than GET or POST will be [wrapped](/up.protocol.config#config.methodParam) in a POST request.
|
18808
|
+
@param {Object|Array|FormData|string} [options.params]
|
18809
|
+
@experimental
|
18810
|
+
*/
|
18811
|
+
function loadPage(requestsAttrs) {
|
18812
|
+
new up.Request(requestsAttrs).loadPage();
|
18813
|
+
}
|
18814
|
+
/*-
|
18465
18815
|
Returns whether optional requests should be avoided where possible.
|
18466
18816
|
|
18467
18817
|
We assume the user wants to avoid requests if either of following applies:
|
@@ -18548,11 +18898,23 @@ up.network = (function () {
|
|
18548
18898
|
The event is emitted on the layer that caused the request.
|
18549
18899
|
|
18550
18900
|
@event up:request:aborted
|
18901
|
+
|
18551
18902
|
@param {up.Request} event.request
|
18552
18903
|
The aborted request.
|
18904
|
+
|
18553
18905
|
@param {up.Layer} [event.layer]
|
18554
|
-
The [layer](/up.layer)
|
18906
|
+
The [layer](/up.layer) this request is associated with.
|
18907
|
+
|
18908
|
+
If this request was intended to update an existing fragment, this is that fragment's layer.
|
18909
|
+
|
18910
|
+
If this request was intended to [open an overlay](/opening-overlays),
|
18911
|
+
the associated layer is the future overlay's parent layer.
|
18912
|
+
|
18913
|
+
@param {Element} [event.origin]
|
18914
|
+
The link or form element that caused the request.
|
18915
|
+
|
18555
18916
|
@param event.preventDefault()
|
18917
|
+
|
18556
18918
|
@experimental
|
18557
18919
|
*/
|
18558
18920
|
/*-
|
@@ -18631,7 +18993,14 @@ up.network = (function () {
|
|
18631
18993
|
@param {up.Request} event.request
|
18632
18994
|
The request to be sent.
|
18633
18995
|
@param {up.Layer} [event.layer]
|
18634
|
-
The [layer](/up.layer)
|
18996
|
+
The [layer](/up.layer) this request is associated with.
|
18997
|
+
|
18998
|
+
If this request is intended to update an existing fragment, this is that fragment's layer.
|
18999
|
+
|
19000
|
+
If this request is intended to [open an overlay](/opening-overlays),
|
19001
|
+
the associated layer is the future overlay's parent layer.
|
19002
|
+
@param {Element} [event.origin]
|
19003
|
+
The link or form element that caused the request.
|
18635
19004
|
@param event.preventDefault()
|
18636
19005
|
Event listeners may call this method to prevent the request from being sent.
|
18637
19006
|
@stable
|
@@ -18657,12 +19026,24 @@ up.network = (function () {
|
|
18657
19026
|
The event is emitted on the layer that caused the request.
|
18658
19027
|
|
18659
19028
|
@event up:request:loaded
|
19029
|
+
|
18660
19030
|
@param {up.Request} event.request
|
18661
19031
|
The request.
|
19032
|
+
|
18662
19033
|
@param {up.Response} event.response
|
18663
19034
|
The response that was received from the server.
|
19035
|
+
|
18664
19036
|
@param {up.Layer} [event.layer]
|
18665
|
-
The [layer](/up.layer)
|
19037
|
+
The [layer](/up.layer) this request is associated with.
|
19038
|
+
|
19039
|
+
If this request is intended to update an existing fragment, this is that fragment's layer.
|
19040
|
+
|
19041
|
+
If this request is intended to [open an overlay](/opening-overlays),
|
19042
|
+
the associated layer is the future overlay's parent layer.
|
19043
|
+
|
19044
|
+
@param {Element} [event.origin]
|
19045
|
+
The link or form element that caused the request.
|
19046
|
+
|
18666
19047
|
@stable
|
18667
19048
|
*/
|
18668
19049
|
/*-
|
@@ -18676,10 +19057,21 @@ up.network = (function () {
|
|
18676
19057
|
The event is emitted on the layer that caused the request.
|
18677
19058
|
|
18678
19059
|
@event up:request:fatal
|
19060
|
+
|
18679
19061
|
@param {up.Request} event.request
|
18680
|
-
The request.
|
19062
|
+
The failed request.
|
19063
|
+
|
18681
19064
|
@param {up.Layer} [event.layer]
|
18682
|
-
The [layer](/up.layer)
|
19065
|
+
The [layer](/up.layer) this request is associated with.
|
19066
|
+
|
19067
|
+
If this request was intended to update an existing fragment, this is that fragment's layer.
|
19068
|
+
|
19069
|
+
If this request was intended to [open an overlay](/opening-overlays),
|
19070
|
+
the associated layer is the future overlay's parent layer.
|
19071
|
+
|
19072
|
+
@param {Element} [event.origin]
|
19073
|
+
The link or form element that caused the request.
|
19074
|
+
|
18683
19075
|
@stable
|
18684
19076
|
*/
|
18685
19077
|
function isSafeMethod(method) {
|
@@ -18707,7 +19099,8 @@ up.network = (function () {
|
|
18707
19099
|
registerAliasForRedirect: registerAliasForRedirect,
|
18708
19100
|
queue: queue,
|
18709
19101
|
shouldReduceRequests: shouldReduceRequests,
|
18710
|
-
mimicLocalRequest: mimicLocalRequest
|
19102
|
+
mimicLocalRequest: mimicLocalRequest,
|
19103
|
+
loadPage: loadPage,
|
18711
19104
|
};
|
18712
19105
|
})();
|
18713
19106
|
up.request = up.network.request;
|
@@ -18715,13 +19108,13 @@ up.cache = up.network.cache;
|
|
18715
19108
|
|
18716
19109
|
|
18717
19110
|
/***/ }),
|
18718
|
-
/*
|
19111
|
+
/* 82 */
|
18719
19112
|
/***/ (function() {
|
18720
19113
|
|
18721
19114
|
|
18722
19115
|
|
18723
19116
|
/***/ }),
|
18724
|
-
/*
|
19117
|
+
/* 83 */
|
18725
19118
|
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
18726
19119
|
|
18727
19120
|
var __assign = (this && this.__assign) || function () {
|
@@ -18776,7 +19169,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
18776
19169
|
to[j] = from[i];
|
18777
19170
|
return to;
|
18778
19171
|
};
|
18779
|
-
__webpack_require__(
|
19172
|
+
__webpack_require__(84);
|
18780
19173
|
var u = up.util;
|
18781
19174
|
var e = up.element;
|
18782
19175
|
/*-
|
@@ -19478,6 +19871,8 @@ up.layer = (function () {
|
|
19478
19871
|
| `value` | The overlay's [acceptance value](/closing-overlays#overlay-result-values) |
|
19479
19872
|
| `event` | An `up:layer:accepted` event |
|
19480
19873
|
|
19874
|
+
With a strict Content Security Policy [additional rules apply](/csp).
|
19875
|
+
|
19481
19876
|
@param [up-on-dismissed]
|
19482
19877
|
A JavaScript snippet that is called when the overlay was [dismissed](/closing-overlays).
|
19483
19878
|
|
@@ -19490,6 +19885,8 @@ up.layer = (function () {
|
|
19490
19885
|
| `value` | The overlay's [dismissal value](/closing-overlays#overlay-result-values) |
|
19491
19886
|
| `event` | An `up:layer:dismissed` event |
|
19492
19887
|
|
19888
|
+
With a strict Content Security Policy [additional rules apply](/csp).
|
19889
|
+
|
19493
19890
|
@param [up-accept-event]
|
19494
19891
|
One or more space-separated event types that will cause this overlay to automatically be
|
19495
19892
|
[accepted](/closing-overlays) when a matching event occurs within the overlay.
|
@@ -19615,7 +20012,10 @@ up.layer = (function () {
|
|
19615
20012
|
up.on('up:fragment:destroyed', function () {
|
19616
20013
|
stack.sync();
|
19617
20014
|
});
|
19618
|
-
up.on('up:framework:
|
20015
|
+
up.on('up:framework:evaled', function () {
|
20016
|
+
// Due to circular dependencies we must delay initialization of the stack until all of
|
20017
|
+
// Unpoly's submodules have been evaled. We cannot delay initialization until up:framework:boot,
|
20018
|
+
// since by then user scripts have run and event listeners will no longer register as "default".
|
19619
20019
|
stack = new up.LayerStack();
|
19620
20020
|
});
|
19621
20021
|
up.on('up:framework:reset', reset);
|
@@ -19982,13 +20382,13 @@ up.layer = (function () {
|
|
19982
20382
|
|
19983
20383
|
|
19984
20384
|
/***/ }),
|
19985
|
-
/*
|
20385
|
+
/* 84 */
|
19986
20386
|
/***/ (function() {
|
19987
20387
|
|
19988
20388
|
|
19989
20389
|
|
19990
20390
|
/***/ }),
|
19991
|
-
/*
|
20391
|
+
/* 85 */
|
19992
20392
|
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
19993
20393
|
|
19994
20394
|
var __assign = (this && this.__assign) || function () {
|
@@ -20007,7 +20407,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
20007
20407
|
to[j] = from[i];
|
20008
20408
|
return to;
|
20009
20409
|
};
|
20010
|
-
__webpack_require__(
|
20410
|
+
__webpack_require__(86);
|
20011
20411
|
/*-
|
20012
20412
|
Linking to fragments
|
20013
20413
|
====================
|
@@ -20242,7 +20642,7 @@ up.link = (function () {
|
|
20242
20642
|
if (options.cache == null) {
|
20243
20643
|
options.cache = 'auto';
|
20244
20644
|
}
|
20245
|
-
options.basic = true;
|
20645
|
+
options.basic = true;
|
20246
20646
|
var request = new up.Request(options);
|
20247
20647
|
return request.willCache();
|
20248
20648
|
}
|
@@ -20297,6 +20697,13 @@ up.link = (function () {
|
|
20297
20697
|
You may pass this additional `options` object to supplement or override
|
20298
20698
|
options parsed from the link attributes.
|
20299
20699
|
|
20700
|
+
@param {boolean} [options.navigate=true]
|
20701
|
+
Whether this fragment update is considered [navigation](/navigation).
|
20702
|
+
|
20703
|
+
Setting this to `false` will disable most defaults, causing
|
20704
|
+
Unpoly to render a fragment without side-effects like updating history
|
20705
|
+
or scrolling.
|
20706
|
+
|
20300
20707
|
@return {Promise<up.RenderResult>}
|
20301
20708
|
A promise that will be fulfilled when the link destination
|
20302
20709
|
has been loaded and rendered.
|
@@ -20315,7 +20722,7 @@ up.link = (function () {
|
|
20315
20722
|
parser.json('params');
|
20316
20723
|
parser.booleanOrString('cache');
|
20317
20724
|
parser.booleanOrString('clearCache');
|
20318
|
-
parser.
|
20725
|
+
parser.booleanOrString('solo');
|
20319
20726
|
parser.string('contentType', { attr: ['enctype', 'up-content-type'] });
|
20320
20727
|
return options;
|
20321
20728
|
}
|
@@ -20508,7 +20915,7 @@ up.link = (function () {
|
|
20508
20915
|
}
|
20509
20916
|
function followURL(link, options) {
|
20510
20917
|
if (options === void 0) { options = {}; }
|
20511
|
-
var url = options.url || link.getAttribute('href') || link.getAttribute('
|
20918
|
+
var url = options.url || link.getAttribute('up-href') || link.getAttribute('href');
|
20512
20919
|
// Developers sometimes make a <a href="#"> to give a JavaScript interaction standard
|
20513
20920
|
// link behavior (like keyboard navigation or default styles). However, we don't want to
|
20514
20921
|
// consider this a link with remote content, and rather honor [up-content], [up-document]
|
@@ -20773,6 +21180,13 @@ up.link = (function () {
|
|
20773
21180
|
|
20774
21181
|
@selector a[up-follow]
|
20775
21182
|
|
21183
|
+
@param [up-navigate='true']
|
21184
|
+
Whether this fragment update is considered [navigation](/navigation).
|
21185
|
+
|
21186
|
+
Setting this to `false` will disable most defaults documented below,
|
21187
|
+
causing Unpoly to render a fragment without side-effects like updating history
|
21188
|
+
or scrolling.
|
21189
|
+
|
20776
21190
|
@param [href]
|
20777
21191
|
The URL to fetch from the server.
|
20778
21192
|
|
@@ -20784,7 +21198,7 @@ up.link = (function () {
|
|
20784
21198
|
|
20785
21199
|
If omitted a [main target](/up-main) will be rendered.
|
20786
21200
|
|
20787
|
-
@param [up-fallback]
|
21201
|
+
@param [up-fallback='true']
|
20788
21202
|
Specifies behavior if the [target selector](/up.render#options.target) is missing from the current page or the server response.
|
20789
21203
|
|
20790
21204
|
If set to a CSS selector, Unpoly will attempt to replace that selector instead.
|
@@ -20793,9 +21207,6 @@ up.link = (function () {
|
|
20793
21207
|
|
20794
21208
|
If set to `false` Unpoly will immediately reject the render promise.
|
20795
21209
|
|
20796
|
-
@param [up-navigate='true']
|
20797
|
-
Whether this fragment update is considered [navigation](/navigation).
|
20798
|
-
|
20799
21210
|
@param [up-method='get']
|
20800
21211
|
The HTTP method to use for the request.
|
20801
21212
|
|
@@ -20820,8 +21231,15 @@ up.link = (function () {
|
|
20820
21231
|
E.g. the `X-Up-Target` header includes the targeted CSS selector.
|
20821
21232
|
See `up.protocol` and `up.network.config.requestMetaKeys` for details.
|
20822
21233
|
|
21234
|
+
@param [up-content]
|
21235
|
+
A string for the fragment's new [inner HTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML).
|
21236
|
+
|
21237
|
+
If your HTML string also contains the fragment's [outer HTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML),
|
21238
|
+
consider the `[up-fragment]` attribute instead.
|
21239
|
+
|
20823
21240
|
@param [up-fragment]
|
20824
|
-
A string of HTML comprising *only* the new fragment
|
21241
|
+
A string of HTML comprising *only* the new fragment's
|
21242
|
+
[outer HTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML).
|
20825
21243
|
|
20826
21244
|
The `[up-target]` selector will be derived from the root element in the given
|
20827
21245
|
HTML:
|
@@ -20858,7 +21276,7 @@ up.link = (function () {
|
|
20858
21276
|
|
20859
21277
|
See [handling server errors](/server-errors) for details.
|
20860
21278
|
|
20861
|
-
@param [up-history]
|
21279
|
+
@param [up-history='auto']
|
20862
21280
|
Whether the browser URL and window title will be updated.
|
20863
21281
|
|
20864
21282
|
If set to `true`, the history will always be updated, using the title and URL from
|
@@ -20909,7 +21327,7 @@ up.link = (function () {
|
|
20909
21327
|
See [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-timing-function)
|
20910
21328
|
for a list of available timing functions.
|
20911
21329
|
|
20912
|
-
@param [up-cache]
|
21330
|
+
@param [up-cache='auto']
|
20913
21331
|
Whether to read from and write to the [cache](/up.request#caching).
|
20914
21332
|
|
20915
21333
|
With `[up-cache=true]` Unpoly will try to re-use a cached response before connecting
|
@@ -20919,6 +21337,8 @@ up.link = (function () {
|
|
20919
21337
|
With `[up-cache=auto]` Unpoly will use the cache only if `up.network.config.autoCache`
|
20920
21338
|
returns `true` for the request.
|
20921
21339
|
|
21340
|
+
With `[up-cache=false]` Unpoly will always make a network request.
|
21341
|
+
|
20922
21342
|
Also see [`up.request({ cache })`](/up.request#options.cache).
|
20923
21343
|
|
20924
21344
|
@param [up-clear-cache]
|
@@ -20929,6 +21349,11 @@ up.link = (function () {
|
|
20929
21349
|
|
20930
21350
|
Also see [`up.request({ clearCache })`](/up.request#options.clearCache) and `up.network.config.clearCache`.
|
20931
21351
|
|
21352
|
+
@param [up-solo='true']
|
21353
|
+
With `[up-solo=true]` Unpoly will [abort](/up.network.abort) all other requests before laoding the new fragment.
|
21354
|
+
|
21355
|
+
To only abort some requests, pass an [URL pattern](/url-patterns) that matches requests to abort.
|
21356
|
+
|
20932
21357
|
@param [up-layer='origin current']
|
20933
21358
|
The [layer](/up.layer) in which to match and render the fragment.
|
20934
21359
|
|
@@ -20937,7 +21362,7 @@ up.link = (function () {
|
|
20937
21362
|
To [open the fragment in a new overlay](/opening-overlays), pass `[up-layer=new]`.
|
20938
21363
|
In this case attributes for `a[up-layer=new]` may also be used.
|
20939
21364
|
|
20940
|
-
@param [up-peel]
|
21365
|
+
@param [up-peel='true']
|
20941
21366
|
Whether to close overlays obstructing the updated layer when the fragment is updated.
|
20942
21367
|
|
20943
21368
|
This is only relevant when updating a layer that is not the [frontmost layer](/up.layer.front).
|
@@ -20952,7 +21377,7 @@ up.link = (function () {
|
|
20952
21377
|
@param [up-hungry='true']
|
20953
21378
|
Whether [`[up-hungry]`](/up-hungry) elements outside the updated fragment will also be updated.
|
20954
21379
|
|
20955
|
-
@param [up-scroll]
|
21380
|
+
@param [up-scroll='auto']
|
20956
21381
|
How to scroll after the new fragment was rendered.
|
20957
21382
|
|
20958
21383
|
See [scroll option](/scroll-option) for a list of allowed values.
|
@@ -20962,7 +21387,7 @@ up.link = (function () {
|
|
20962
21387
|
|
20963
21388
|
Saved scroll positions can later be restored with [`[up-scroll=restore]`](/scroll-option#restoring-scroll-positions).
|
20964
21389
|
|
20965
|
-
@param [up-focus]
|
21390
|
+
@param [up-focus='auto']
|
20966
21391
|
What to focus after the new fragment was rendered.
|
20967
21392
|
|
20968
21393
|
See [focus option](/focus-option) for a list of allowed values.
|
@@ -20974,7 +21399,7 @@ up.link = (function () {
|
|
20974
21399
|
|
20975
21400
|
If the user does not confirm the render promise will reject and no fragments will be updated.
|
20976
21401
|
|
20977
|
-
@param [up-feedback]
|
21402
|
+
@param [up-feedback='true']
|
20978
21403
|
Whether to give the link an `.up-active` class
|
20979
21404
|
while loading and rendering content.
|
20980
21405
|
|
@@ -20984,10 +21409,14 @@ up.link = (function () {
|
|
20984
21409
|
|
20985
21410
|
The callback argument is a preventable `up:fragment:loaded` event.
|
20986
21411
|
|
21412
|
+
With a strict Content Security Policy [additional rules apply](/csp).
|
21413
|
+
|
20987
21414
|
@param [up-on-finished]
|
20988
21415
|
A JavaScript snippet that is called when all animations have concluded and
|
20989
21416
|
elements were removed from the DOM tree.
|
20990
21417
|
|
21418
|
+
With a strict Content Security Policy [additional rules apply](/csp).
|
21419
|
+
|
20991
21420
|
@stable
|
20992
21421
|
*/
|
20993
21422
|
up.on('up:click', fullFollowSelector, function (event, link) {
|
@@ -21118,13 +21547,13 @@ up.follow = up.link.follow;
|
|
21118
21547
|
|
21119
21548
|
|
21120
21549
|
/***/ }),
|
21121
|
-
/*
|
21550
|
+
/* 86 */
|
21122
21551
|
/***/ (function() {
|
21123
21552
|
|
21124
21553
|
|
21125
21554
|
|
21126
21555
|
/***/ }),
|
21127
|
-
/*
|
21556
|
+
/* 87 */
|
21128
21557
|
/***/ (function() {
|
21129
21558
|
|
21130
21559
|
var __assign = (this && this.__assign) || function () {
|
@@ -21171,7 +21600,7 @@ up.form = (function () {
|
|
21171
21600
|
You can configure Unpoly to handle *all* forms on a page without requiring an `[up-submit]` attribute:
|
21172
21601
|
|
21173
21602
|
```js
|
21174
|
-
up.form.config.submitSelectors.push('form'
|
21603
|
+
up.form.config.submitSelectors.push('form')
|
21175
21604
|
```
|
21176
21605
|
|
21177
21606
|
Individual forms may opt out with an `[up-submit=follow]` attribute.
|
@@ -21314,6 +21743,11 @@ up.form = (function () {
|
|
21314
21743
|
You may pass this additional `options` object to supplement or override
|
21315
21744
|
options parsed from the form attributes.
|
21316
21745
|
|
21746
|
+
@param {boolean} [options.navigate=true]
|
21747
|
+
Whether this fragment update is considered [navigation](/navigation).
|
21748
|
+
|
21749
|
+
Setting this to `false` will disable most defaults.
|
21750
|
+
|
21317
21751
|
@return {Promise<up.RenderResult>}
|
21318
21752
|
A promise that will be fulfilled when the server response was rendered.
|
21319
21753
|
|
@@ -21512,6 +21946,15 @@ up.form = (function () {
|
|
21512
21946
|
}
|
21513
21947
|
elements = e.list(elements);
|
21514
21948
|
var fields = u.flatMap(elements, findFields);
|
21949
|
+
var unnamedFields = u.reject(fields, 'name');
|
21950
|
+
if (unnamedFields.length) {
|
21951
|
+
// (1) We do not need to exclude the unnamed fields for up.FieldObserver, since that
|
21952
|
+
// parses values with up.Params.fromFields(), and that ignores unnamed fields.
|
21953
|
+
// (2) Only warn, don't crash. There are some legitimate cases for having unnamed
|
21954
|
+
// a mix of named and unnamed fields in a form, and we don't want to prevent
|
21955
|
+
// <form up-observe> in that case.
|
21956
|
+
up.warn('up.observe()', 'Will not observe fields without a [name]: %o', unnamedFields);
|
21957
|
+
}
|
21515
21958
|
var callback = u.extractCallback(args) || observeCallbackFromElement(elements[0]) || up.fail('up.observe: No change callback given');
|
21516
21959
|
var options = u.extractOptions(args);
|
21517
21960
|
options.delay = (_b = (_a = options.delay) !== null && _a !== void 0 ? _a : e.numberAttr(elements[0], 'up-delay')) !== null && _b !== void 0 ? _b : config.observeDelay;
|
@@ -21522,7 +21965,7 @@ up.form = (function () {
|
|
21522
21965
|
function observeCallbackFromElement(element) {
|
21523
21966
|
var rawCallback = element.getAttribute('up-observe');
|
21524
21967
|
if (rawCallback) {
|
21525
|
-
return
|
21968
|
+
return up.NonceableCallback.fromString(rawCallback).toFunction('value', 'name');
|
21526
21969
|
}
|
21527
21970
|
}
|
21528
21971
|
/*-
|
@@ -21867,7 +22310,7 @@ up.form = (function () {
|
|
21867
22310
|
@selector form[up-submit]
|
21868
22311
|
|
21869
22312
|
@params-note
|
21870
|
-
All attributes for `a[up-follow]` may
|
22313
|
+
All attributes for `a[up-follow]` may be used.
|
21871
22314
|
|
21872
22315
|
@stable
|
21873
22316
|
*/
|
@@ -22198,6 +22641,8 @@ up.form = (function () {
|
|
22198
22641
|
This is useful for observing text fields while the user is typing.
|
22199
22642
|
If you want to submit the form after a change see [`input[up-autosubmit]`](/input-up-autosubmit).
|
22200
22643
|
|
22644
|
+
With a strict Content Security Policy [additional rules apply](/csp).
|
22645
|
+
|
22201
22646
|
The programmatic variant of this is the [`up.observe()`](/up.observe) function.
|
22202
22647
|
|
22203
22648
|
### Example
|
@@ -22259,6 +22704,8 @@ up.form = (function () {
|
|
22259
22704
|
This is useful for observing text fields while the user is typing.
|
22260
22705
|
If you want to submit the form after a change see [`input[up-autosubmit]`](/input-up-autosubmit).
|
22261
22706
|
|
22707
|
+
With a strict Content Security Policy [additional rules apply](/csp).
|
22708
|
+
|
22262
22709
|
The programmatic variant of this is the [`up.observe()`](/up.observe) function.
|
22263
22710
|
|
22264
22711
|
### Example
|
@@ -22378,7 +22825,7 @@ up.validate = up.form.validate;
|
|
22378
22825
|
|
22379
22826
|
|
22380
22827
|
/***/ }),
|
22381
|
-
/*
|
22828
|
+
/* 88 */
|
22382
22829
|
/***/ (function() {
|
22383
22830
|
|
22384
22831
|
/*-
|
@@ -22817,7 +23264,7 @@ up.feedback = (function () {
|
|
22817
23264
|
|
22818
23265
|
|
22819
23266
|
/***/ }),
|
22820
|
-
/*
|
23267
|
+
/* 89 */
|
22821
23268
|
/***/ (function() {
|
22822
23269
|
|
22823
23270
|
/*-
|
@@ -23034,7 +23481,7 @@ up.radio = (function () {
|
|
23034
23481
|
|
23035
23482
|
|
23036
23483
|
/***/ }),
|
23037
|
-
/*
|
23484
|
+
/* 90 */
|
23038
23485
|
/***/ (function() {
|
23039
23486
|
|
23040
23487
|
/*
|
@@ -23173,16 +23620,17 @@ __webpack_require__(72);
|
|
23173
23620
|
__webpack_require__(73);
|
23174
23621
|
__webpack_require__(74);
|
23175
23622
|
__webpack_require__(75);
|
23176
|
-
__webpack_require__(
|
23177
|
-
__webpack_require__(
|
23623
|
+
__webpack_require__(76);
|
23624
|
+
__webpack_require__(78);
|
23178
23625
|
__webpack_require__(80);
|
23179
|
-
__webpack_require__(
|
23180
|
-
__webpack_require__(
|
23181
|
-
__webpack_require__(
|
23626
|
+
__webpack_require__(81);
|
23627
|
+
__webpack_require__(83);
|
23628
|
+
__webpack_require__(85);
|
23182
23629
|
__webpack_require__(87);
|
23183
23630
|
__webpack_require__(88);
|
23184
23631
|
__webpack_require__(89);
|
23185
|
-
|
23632
|
+
__webpack_require__(90);
|
23633
|
+
up.framework.onEvaled();
|
23186
23634
|
|
23187
23635
|
}();
|
23188
23636
|
/******/ })()
|