unpoly-rails 3.1.1 → 3.2.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.
- checksums.yaml +4 -4
- data/assets/unpoly/unpoly.es6.js +392 -347
- data/assets/unpoly/unpoly.es6.min.js +1 -1
- data/assets/unpoly/unpoly.js +328 -284
- data/assets/unpoly/unpoly.min.js +1 -1
- data/lib/unpoly/rails/version.rb +1 -1
- metadata +2 -2
data/assets/unpoly/unpoly.js
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
/***/ (() => {
|
6
6
|
|
7
7
|
window.up = {
|
8
|
-
version: '3.
|
8
|
+
version: '3.2.0'
|
9
9
|
};
|
10
10
|
|
11
11
|
|
@@ -721,6 +721,11 @@ up.util = (function () {
|
|
721
721
|
let unicodeEscape = (char) => "\\u" + char.charCodeAt(0).toString(16).padStart(4, '0');
|
722
722
|
return string.replace(/[^\x00-\x7F]/g, unicodeEscape);
|
723
723
|
}
|
724
|
+
function variant(source, changes = {}) {
|
725
|
+
let variant = Object.create(source);
|
726
|
+
Object.assign(variant, changes);
|
727
|
+
return variant;
|
728
|
+
}
|
724
729
|
return {
|
725
730
|
parseURL,
|
726
731
|
normalizeURL,
|
@@ -818,6 +823,7 @@ up.util = (function () {
|
|
818
823
|
negate,
|
819
824
|
memoizeMethod,
|
820
825
|
safeStringifyJSON,
|
826
|
+
variant,
|
821
827
|
};
|
822
828
|
})();
|
823
829
|
|
@@ -1586,10 +1592,7 @@ up.Record = class Record {
|
|
1586
1592
|
return u.pick(source, this.keys());
|
1587
1593
|
}
|
1588
1594
|
[u.copy.key]() {
|
1589
|
-
return
|
1590
|
-
}
|
1591
|
-
variant(changes = {}) {
|
1592
|
-
return new this.constructor(u.merge(this.attributes(), changes));
|
1595
|
+
return u.variant(this);
|
1593
1596
|
}
|
1594
1597
|
[u.isEqual.key](other) {
|
1595
1598
|
return (this.constructor === other.constructor) && u.isEqual(this.attributes(), other.attributes());
|
@@ -1761,9 +1764,6 @@ up.Change = class Change {
|
|
1761
1764
|
constructor(options) {
|
1762
1765
|
this.options = options;
|
1763
1766
|
}
|
1764
|
-
cannotMatch(reason) {
|
1765
|
-
throw new up.CannotMatch(reason);
|
1766
|
-
}
|
1767
1767
|
execute() {
|
1768
1768
|
throw new up.NotImplemented();
|
1769
1769
|
}
|
@@ -1778,6 +1778,9 @@ up.Change = class Change {
|
|
1778
1778
|
return newValue;
|
1779
1779
|
}
|
1780
1780
|
}
|
1781
|
+
deriveFailOptions() {
|
1782
|
+
return up.RenderOptions.deriveFailOptions(this.options);
|
1783
|
+
}
|
1781
1784
|
};
|
1782
1785
|
|
1783
1786
|
|
@@ -1794,33 +1797,34 @@ up.Change.Addition = class Addition extends up.Change {
|
|
1794
1797
|
this.acceptLayer = options.acceptLayer;
|
1795
1798
|
this.dismissLayer = options.dismissLayer;
|
1796
1799
|
this.eventPlans = options.eventPlans || [];
|
1800
|
+
this.response = options.meta?.response;
|
1797
1801
|
}
|
1798
1802
|
handleLayerChangeRequests() {
|
1799
1803
|
if (this.layer.isOverlay()) {
|
1800
1804
|
this.tryAcceptLayerFromServer();
|
1801
1805
|
this.abortWhenLayerClosed();
|
1802
|
-
this.layer.tryAcceptForLocation();
|
1806
|
+
this.layer.tryAcceptForLocation(this.responseOption());
|
1803
1807
|
this.abortWhenLayerClosed();
|
1804
1808
|
this.tryDismissLayerFromServer();
|
1805
1809
|
this.abortWhenLayerClosed();
|
1806
|
-
this.layer.tryDismissForLocation();
|
1810
|
+
this.layer.tryDismissForLocation(this.responseOption());
|
1807
1811
|
this.abortWhenLayerClosed();
|
1808
1812
|
}
|
1809
1813
|
this.layer.asCurrent(() => {
|
1810
1814
|
for (let eventPlan of this.eventPlans) {
|
1811
|
-
up.emit(eventPlan);
|
1815
|
+
up.emit({ ...eventPlan, ...this.responseOption() });
|
1812
1816
|
this.abortWhenLayerClosed();
|
1813
1817
|
}
|
1814
1818
|
});
|
1815
1819
|
}
|
1816
1820
|
tryAcceptLayerFromServer() {
|
1817
1821
|
if (u.isDefined(this.acceptLayer) && this.layer.isOverlay()) {
|
1818
|
-
this.layer.accept(this.acceptLayer);
|
1822
|
+
this.layer.accept(this.acceptLayer, this.responseOption());
|
1819
1823
|
}
|
1820
1824
|
}
|
1821
1825
|
tryDismissLayerFromServer() {
|
1822
1826
|
if (u.isDefined(this.dismissLayer) && this.layer.isOverlay()) {
|
1823
|
-
this.layer.dismiss(this.dismissLayer);
|
1827
|
+
this.layer.dismiss(this.dismissLayer, this.responseOption());
|
1824
1828
|
}
|
1825
1829
|
}
|
1826
1830
|
abortWhenLayerClosed() {
|
@@ -1847,6 +1851,9 @@ up.Change.Addition = class Addition extends up.Change {
|
|
1847
1851
|
this.setTime(options);
|
1848
1852
|
this.setETag(options);
|
1849
1853
|
}
|
1854
|
+
responseOption() {
|
1855
|
+
return { response: this.response };
|
1856
|
+
}
|
1850
1857
|
};
|
1851
1858
|
|
1852
1859
|
|
@@ -1903,6 +1910,10 @@ up.RenderJob = (_a = class RenderJob {
|
|
1903
1910
|
let onRequest = (request) => this.handleAbortOption(request);
|
1904
1911
|
this.change = new up.Change.FromURL({ ...this.options, onRequest });
|
1905
1912
|
}
|
1913
|
+
else if (this.options.response) {
|
1914
|
+
this.change = new up.Change.FromResponse(this.options);
|
1915
|
+
this.handleAbortOption(null);
|
1916
|
+
}
|
1906
1917
|
else {
|
1907
1918
|
this.change = new up.Change.FromContent(this.options);
|
1908
1919
|
this.handleAbortOption(null);
|
@@ -2036,7 +2047,7 @@ up.Change.OpenLayer = class OpenLayer extends up.Change.Addition {
|
|
2036
2047
|
this.content = responseDoc.select(this.target);
|
2037
2048
|
}
|
2038
2049
|
if (!this.content || this.baseLayer.isClosed()) {
|
2039
|
-
throw
|
2050
|
+
throw new up.CannotMatch();
|
2040
2051
|
}
|
2041
2052
|
onApplicable();
|
2042
2053
|
up.puts('up.render()', `Opening element "${this.target}" in new overlay`);
|
@@ -2352,7 +2363,7 @@ up.Change.UpdateLayer = (_a = class UpdateLayer extends up.Change.Addition {
|
|
2352
2363
|
return true;
|
2353
2364
|
}
|
2354
2365
|
else if (!step.maybe) {
|
2355
|
-
throw
|
2366
|
+
throw new up.CannotMatch();
|
2356
2367
|
}
|
2357
2368
|
});
|
2358
2369
|
this.resolveOldNesting();
|
@@ -2368,7 +2379,7 @@ up.Change.UpdateLayer = (_a = class UpdateLayer extends up.Change.Addition {
|
|
2368
2379
|
return true;
|
2369
2380
|
}
|
2370
2381
|
else if (!step.maybe) {
|
2371
|
-
throw
|
2382
|
+
throw new up.CannotMatch();
|
2372
2383
|
}
|
2373
2384
|
});
|
2374
2385
|
this.resolveOldNesting();
|
@@ -2471,6 +2482,7 @@ up.Change.CloseLayer = class CloseLayer extends up.Change.Removal {
|
|
2471
2482
|
this.origin = options.origin;
|
2472
2483
|
this.value = options.value;
|
2473
2484
|
this.preventable = options.preventable ?? true;
|
2485
|
+
this.response = options.response;
|
2474
2486
|
}
|
2475
2487
|
execute() {
|
2476
2488
|
if (!this.layer.isOpen()) {
|
@@ -2512,7 +2524,8 @@ up.Change.CloseLayer = class CloseLayer extends up.Change.Removal {
|
|
2512
2524
|
return up.event.build(name, {
|
2513
2525
|
layer: this.layer,
|
2514
2526
|
value: this.value,
|
2515
|
-
origin: this.origin
|
2527
|
+
origin: this.origin,
|
2528
|
+
response: this.response,
|
2516
2529
|
});
|
2517
2530
|
}
|
2518
2531
|
handleFocus(formerParent) {
|
@@ -2528,142 +2541,6 @@ up.Change.CloseLayer = class CloseLayer extends up.Change.Removal {
|
|
2528
2541
|
/* 31 */
|
2529
2542
|
/***/ (() => {
|
2530
2543
|
|
2531
|
-
var _a;
|
2532
|
-
const u = up.util;
|
2533
|
-
up.Change.FromContent = (_a = class FromContent extends up.Change {
|
2534
|
-
constructor(options) {
|
2535
|
-
super(options);
|
2536
|
-
this.layers = u.filter(up.layer.getAll(this.options), this.isRenderableLayer);
|
2537
|
-
this.origin = this.options.origin;
|
2538
|
-
this.preview = this.options.preview;
|
2539
|
-
this.mode = this.options.mode;
|
2540
|
-
if (this.origin) {
|
2541
|
-
this.originLayer = up.layer.get(this.origin);
|
2542
|
-
}
|
2543
|
-
}
|
2544
|
-
isRenderableLayer(layer) {
|
2545
|
-
return (layer === 'new') || layer.isOpen();
|
2546
|
-
}
|
2547
|
-
getPlans() {
|
2548
|
-
var _a;
|
2549
|
-
let plans = [];
|
2550
|
-
if (this.options.fragment) {
|
2551
|
-
(_a = this.options).target || (_a.target = this.getResponseDoc().rootSelector());
|
2552
|
-
}
|
2553
|
-
this.expandIntoPlans(plans, this.layers, this.options.target);
|
2554
|
-
this.expandIntoPlans(plans, this.layers, this.options.fallback);
|
2555
|
-
return plans;
|
2556
|
-
}
|
2557
|
-
expandIntoPlans(plans, layers, targets) {
|
2558
|
-
for (let layer of layers) {
|
2559
|
-
for (let target of this.expandTargets(targets, layer)) {
|
2560
|
-
const props = { ...this.options, target, layer, defaultPlacement: this.defaultPlacement() };
|
2561
|
-
const change = layer === 'new' ? new up.Change.OpenLayer(props) : new up.Change.UpdateLayer(props);
|
2562
|
-
plans.push(change);
|
2563
|
-
}
|
2564
|
-
}
|
2565
|
-
}
|
2566
|
-
expandTargets(targets, layer) {
|
2567
|
-
return up.fragment.expandTargets(targets, { layer, mode: this.mode, origin: this.origin });
|
2568
|
-
}
|
2569
|
-
execute() {
|
2570
|
-
if (this.options.preload) {
|
2571
|
-
return Promise.resolve();
|
2572
|
-
}
|
2573
|
-
return this.seekPlan(this.executePlan.bind(this)) || this.cannotMatchPostflightTarget();
|
2574
|
-
}
|
2575
|
-
executePlan(matchedPlan) {
|
2576
|
-
let result = matchedPlan.execute(this.getResponseDoc(), this.onPlanApplicable.bind(this, matchedPlan));
|
2577
|
-
result.options = this.options;
|
2578
|
-
return result;
|
2579
|
-
}
|
2580
|
-
onPlanApplicable(plan) {
|
2581
|
-
let primaryPlan = this.getPlans()[0];
|
2582
|
-
if (plan !== primaryPlan) {
|
2583
|
-
up.puts('up.render()', 'Could not match primary target "%s". Updating a fallback target "%s".', primaryPlan.target, plan.target);
|
2584
|
-
}
|
2585
|
-
}
|
2586
|
-
getResponseDoc() {
|
2587
|
-
if (this.preview)
|
2588
|
-
return;
|
2589
|
-
const docOptions = u.pick(this.options, [
|
2590
|
-
'target',
|
2591
|
-
'content',
|
2592
|
-
'fragment',
|
2593
|
-
'document',
|
2594
|
-
'html',
|
2595
|
-
'cspNonces',
|
2596
|
-
'origin',
|
2597
|
-
]);
|
2598
|
-
up.migrate.handleResponseDocOptions?.(docOptions);
|
2599
|
-
if (this.defaultPlacement() === 'content') {
|
2600
|
-
docOptions.target = this.firstExpandedTarget(docOptions.target);
|
2601
|
-
}
|
2602
|
-
return new up.ResponseDoc(docOptions);
|
2603
|
-
}
|
2604
|
-
defaultPlacement() {
|
2605
|
-
if (!this.options.document && !this.options.fragment) {
|
2606
|
-
return 'content';
|
2607
|
-
}
|
2608
|
-
}
|
2609
|
-
firstExpandedTarget(target) {
|
2610
|
-
return this.expandTargets(target || ':main', this.layers[0])[0];
|
2611
|
-
}
|
2612
|
-
getPreflightProps(opts = {}) {
|
2613
|
-
const getPlanProps = plan => plan.getPreflightProps();
|
2614
|
-
return this.seekPlan(getPlanProps) || opts.optional || this.cannotMatchPreflightTarget();
|
2615
|
-
}
|
2616
|
-
cannotMatchPreflightTarget() {
|
2617
|
-
this.cannotMatchTarget('Could not find target in current page');
|
2618
|
-
}
|
2619
|
-
cannotMatchPostflightTarget() {
|
2620
|
-
this.cannotMatchTarget('Could not find common target in current page and response');
|
2621
|
-
}
|
2622
|
-
cannotMatchTarget(reason) {
|
2623
|
-
if (this.getPlans().length) {
|
2624
|
-
const planTargets = u.uniq(u.map(this.getPlans(), 'target'));
|
2625
|
-
const humanizedLayerOption = up.layer.optionToString(this.options.layer);
|
2626
|
-
up.fail(reason + " (tried selectors %o in %s)", planTargets, humanizedLayerOption);
|
2627
|
-
}
|
2628
|
-
else if (this.layers.length) {
|
2629
|
-
if (this.options.failPrefixForced) {
|
2630
|
-
up.fail('No target selector given for failed responses (https://unpoly.com/failed-responses)');
|
2631
|
-
}
|
2632
|
-
else {
|
2633
|
-
up.fail('No target selector given');
|
2634
|
-
}
|
2635
|
-
}
|
2636
|
-
else {
|
2637
|
-
up.fail('Layer %o does not exist', this.options.layer);
|
2638
|
-
}
|
2639
|
-
}
|
2640
|
-
seekPlan(fn) {
|
2641
|
-
for (let plan of this.getPlans()) {
|
2642
|
-
try {
|
2643
|
-
return fn(plan);
|
2644
|
-
}
|
2645
|
-
catch (error) {
|
2646
|
-
if (!(error instanceof up.CannotMatch)) {
|
2647
|
-
throw error;
|
2648
|
-
}
|
2649
|
-
}
|
2650
|
-
}
|
2651
|
-
}
|
2652
|
-
},
|
2653
|
-
(() => {
|
2654
|
-
u.memoizeMethod(_a.prototype, [
|
2655
|
-
'getPlans',
|
2656
|
-
'getResponseDoc',
|
2657
|
-
'getPreflightProps',
|
2658
|
-
]);
|
2659
|
-
})(),
|
2660
|
-
_a);
|
2661
|
-
|
2662
|
-
|
2663
|
-
/***/ }),
|
2664
|
-
/* 32 */
|
2665
|
-
/***/ (() => {
|
2666
|
-
|
2667
2544
|
var _a;
|
2668
2545
|
const u = up.util;
|
2669
2546
|
up.Change.FromURL = (_a = class FromURL extends up.Change {
|
@@ -2688,9 +2565,6 @@ up.Change.FromURL = (_a = class FromURL extends up.Change {
|
|
2688
2565
|
}
|
2689
2566
|
return u.always(this.request, responseOrError => this.onRequestSettled(responseOrError));
|
2690
2567
|
}
|
2691
|
-
deriveFailOptions() {
|
2692
|
-
return up.RenderOptions.deriveFailOptions(this.options);
|
2693
|
-
}
|
2694
2568
|
newPageReason() {
|
2695
2569
|
if (u.isCrossOrigin(this.options.url)) {
|
2696
2570
|
return 'Loading cross-origin content in new page';
|
@@ -2724,7 +2598,41 @@ up.Change.FromURL = (_a = class FromURL extends up.Change {
|
|
2724
2598
|
}
|
2725
2599
|
}
|
2726
2600
|
onRequestSettledWithResponse(response) {
|
2727
|
-
this.response
|
2601
|
+
return new up.Change.FromResponse({ ...this.options, response }).execute();
|
2602
|
+
}
|
2603
|
+
onRequestSettledWithError(error) {
|
2604
|
+
if (error instanceof up.Offline) {
|
2605
|
+
this.request.emit('up:fragment:offline', {
|
2606
|
+
callback: this.options.onOffline,
|
2607
|
+
renderOptions: this.options,
|
2608
|
+
retry: (retryOptions) => up.render({ ...this.options, ...retryOptions }),
|
2609
|
+
log: ['Cannot load fragment from %s: %s', this.request.description, error.reason],
|
2610
|
+
});
|
2611
|
+
}
|
2612
|
+
throw error;
|
2613
|
+
}
|
2614
|
+
},
|
2615
|
+
(() => {
|
2616
|
+
u.memoizeMethod(_a.prototype, [
|
2617
|
+
'getRequestAttrs',
|
2618
|
+
]);
|
2619
|
+
})(),
|
2620
|
+
_a);
|
2621
|
+
|
2622
|
+
|
2623
|
+
/***/ }),
|
2624
|
+
/* 32 */
|
2625
|
+
/***/ (() => {
|
2626
|
+
|
2627
|
+
var _a;
|
2628
|
+
const u = up.util;
|
2629
|
+
up.Change.FromResponse = (_a = class FromResponse extends up.Change {
|
2630
|
+
constructor(options) {
|
2631
|
+
super(options);
|
2632
|
+
this.response = options.response;
|
2633
|
+
this.request = this.response.request;
|
2634
|
+
}
|
2635
|
+
execute() {
|
2728
2636
|
if (up.fragment.config.skipResponse(this.loadedEventProps())) {
|
2729
2637
|
this.skip();
|
2730
2638
|
}
|
@@ -2736,40 +2644,12 @@ up.Change.FromURL = (_a = class FromURL extends up.Change {
|
|
2736
2644
|
skip: () => this.skip()
|
2737
2645
|
});
|
2738
2646
|
}
|
2739
|
-
let fail = u.evalOption(this.options.fail, this.response) ?? !response.ok;
|
2647
|
+
let fail = u.evalOption(this.options.fail, this.response) ?? !this.response.ok;
|
2740
2648
|
if (fail) {
|
2741
2649
|
throw this.updateContentFromResponse(this.deriveFailOptions());
|
2742
2650
|
}
|
2743
2651
|
return this.updateContentFromResponse(this.options);
|
2744
2652
|
}
|
2745
|
-
compilerPassMeta() {
|
2746
|
-
return u.pick(this.loadedEventProps(), [
|
2747
|
-
'revalidating',
|
2748
|
-
'response'
|
2749
|
-
]);
|
2750
|
-
}
|
2751
|
-
loadedEventProps() {
|
2752
|
-
const { expiredResponse } = this.options;
|
2753
|
-
return {
|
2754
|
-
request: this.request,
|
2755
|
-
response: this.response,
|
2756
|
-
renderOptions: this.options,
|
2757
|
-
revalidating: !!expiredResponse,
|
2758
|
-
expiredResponse,
|
2759
|
-
};
|
2760
|
-
}
|
2761
|
-
onRequestSettledWithError(error) {
|
2762
|
-
if (error instanceof up.Offline) {
|
2763
|
-
this.request.emit('up:fragment:offline', {
|
2764
|
-
callback: this.options.onOffline,
|
2765
|
-
response: this.response,
|
2766
|
-
renderOptions: this.options,
|
2767
|
-
retry: (retryOptions) => up.render({ ...this.options, ...retryOptions }),
|
2768
|
-
log: ['Cannot load fragment from %s: %s', this.request.description, error.reason],
|
2769
|
-
});
|
2770
|
-
}
|
2771
|
-
throw error;
|
2772
|
-
}
|
2773
2653
|
skip() {
|
2774
2654
|
up.puts('up.render()', 'Skipping ' + this.response.description);
|
2775
2655
|
this.options.target = ':none';
|
@@ -2818,6 +2698,22 @@ up.Change.FromURL = (_a = class FromURL extends up.Change {
|
|
2818
2698
|
}
|
2819
2699
|
return renderResult;
|
2820
2700
|
}
|
2701
|
+
loadedEventProps() {
|
2702
|
+
const { expiredResponse } = this.options;
|
2703
|
+
return {
|
2704
|
+
request: this.request,
|
2705
|
+
response: this.response,
|
2706
|
+
renderOptions: this.options,
|
2707
|
+
revalidating: !!expiredResponse,
|
2708
|
+
expiredResponse,
|
2709
|
+
};
|
2710
|
+
}
|
2711
|
+
compilerPassMeta() {
|
2712
|
+
return u.pick(this.loadedEventProps(), [
|
2713
|
+
'revalidating',
|
2714
|
+
'response'
|
2715
|
+
]);
|
2716
|
+
}
|
2821
2717
|
augmentOptionsFromResponse(renderOptions) {
|
2822
2718
|
const responseURL = this.response.url;
|
2823
2719
|
let serverLocation = responseURL;
|
@@ -2844,7 +2740,7 @@ up.Change.FromURL = (_a = class FromURL extends up.Change {
|
|
2844
2740
|
renderOptions.acceptLayer = this.response.acceptLayer;
|
2845
2741
|
renderOptions.dismissLayer = this.response.dismissLayer;
|
2846
2742
|
renderOptions.document = this.response.text;
|
2847
|
-
if (
|
2743
|
+
if (this.response.none) {
|
2848
2744
|
renderOptions.target = ':none';
|
2849
2745
|
}
|
2850
2746
|
renderOptions.context = u.merge(renderOptions.context, this.response.context);
|
@@ -2855,7 +2751,6 @@ up.Change.FromURL = (_a = class FromURL extends up.Change {
|
|
2855
2751
|
},
|
2856
2752
|
(() => {
|
2857
2753
|
u.memoizeMethod(_a.prototype, [
|
2858
|
-
'getRequestAttrs',
|
2859
2754
|
'loadedEventProps',
|
2860
2755
|
]);
|
2861
2756
|
})(),
|
@@ -2866,6 +2761,144 @@ up.Change.FromURL = (_a = class FromURL extends up.Change {
|
|
2866
2761
|
/* 33 */
|
2867
2762
|
/***/ (() => {
|
2868
2763
|
|
2764
|
+
var _a;
|
2765
|
+
const u = up.util;
|
2766
|
+
up.Change.FromContent = (_a = class FromContent extends up.Change {
|
2767
|
+
constructor(options) {
|
2768
|
+
super(options);
|
2769
|
+
this.layers = u.filter(up.layer.getAll(this.options), this.isRenderableLayer);
|
2770
|
+
this.origin = this.options.origin;
|
2771
|
+
this.preview = this.options.preview;
|
2772
|
+
this.mode = this.options.mode;
|
2773
|
+
if (this.origin) {
|
2774
|
+
this.originLayer = up.layer.get(this.origin);
|
2775
|
+
}
|
2776
|
+
}
|
2777
|
+
isRenderableLayer(layer) {
|
2778
|
+
return (layer === 'new') || layer.isOpen();
|
2779
|
+
}
|
2780
|
+
getPlans() {
|
2781
|
+
var _a;
|
2782
|
+
let plans = [];
|
2783
|
+
if (this.options.fragment) {
|
2784
|
+
(_a = this.options).target || (_a.target = this.getResponseDoc().rootSelector());
|
2785
|
+
}
|
2786
|
+
this.expandIntoPlans(plans, this.layers, this.options.target);
|
2787
|
+
this.expandIntoPlans(plans, this.layers, this.options.fallback);
|
2788
|
+
return plans;
|
2789
|
+
}
|
2790
|
+
expandIntoPlans(plans, layers, targets) {
|
2791
|
+
for (let layer of layers) {
|
2792
|
+
for (let target of this.expandTargets(targets, layer)) {
|
2793
|
+
const props = { ...this.options, target, layer, defaultPlacement: this.defaultPlacement() };
|
2794
|
+
const change = layer === 'new' ? new up.Change.OpenLayer(props) : new up.Change.UpdateLayer(props);
|
2795
|
+
plans.push(change);
|
2796
|
+
}
|
2797
|
+
}
|
2798
|
+
}
|
2799
|
+
expandTargets(targets, layer) {
|
2800
|
+
return up.fragment.expandTargets(targets, { layer, mode: this.mode, origin: this.origin });
|
2801
|
+
}
|
2802
|
+
execute() {
|
2803
|
+
if (this.options.preload) {
|
2804
|
+
return Promise.resolve();
|
2805
|
+
}
|
2806
|
+
return this.seekPlan(this.executePlan.bind(this)) || this.cannotMatchPostflightTarget();
|
2807
|
+
}
|
2808
|
+
executePlan(matchedPlan) {
|
2809
|
+
let result = matchedPlan.execute(this.getResponseDoc(), this.onPlanApplicable.bind(this, matchedPlan));
|
2810
|
+
result.options = this.options;
|
2811
|
+
return result;
|
2812
|
+
}
|
2813
|
+
onPlanApplicable(plan) {
|
2814
|
+
let primaryPlan = this.getPlans()[0];
|
2815
|
+
if (plan !== primaryPlan) {
|
2816
|
+
up.puts('up.render()', 'Could not match primary target "%s". Updating a fallback target "%s".', primaryPlan.target, plan.target);
|
2817
|
+
}
|
2818
|
+
}
|
2819
|
+
getResponseDoc() {
|
2820
|
+
if (this.preview)
|
2821
|
+
return;
|
2822
|
+
const docOptions = u.pick(this.options, [
|
2823
|
+
'target',
|
2824
|
+
'content',
|
2825
|
+
'fragment',
|
2826
|
+
'document',
|
2827
|
+
'html',
|
2828
|
+
'cspNonces',
|
2829
|
+
'origin',
|
2830
|
+
]);
|
2831
|
+
up.migrate.handleResponseDocOptions?.(docOptions);
|
2832
|
+
if (this.defaultPlacement() === 'content') {
|
2833
|
+
docOptions.target = this.firstExpandedTarget(docOptions.target);
|
2834
|
+
}
|
2835
|
+
return new up.ResponseDoc(docOptions);
|
2836
|
+
}
|
2837
|
+
defaultPlacement() {
|
2838
|
+
if (!this.options.document && !this.options.fragment) {
|
2839
|
+
return 'content';
|
2840
|
+
}
|
2841
|
+
}
|
2842
|
+
firstExpandedTarget(target) {
|
2843
|
+
return this.expandTargets(target || ':main', this.layers[0])[0];
|
2844
|
+
}
|
2845
|
+
getPreflightProps(opts = {}) {
|
2846
|
+
const getPlanProps = plan => plan.getPreflightProps();
|
2847
|
+
return this.seekPlan(getPlanProps) || opts.optional || this.cannotMatchPreflightTarget();
|
2848
|
+
}
|
2849
|
+
cannotMatchPreflightTarget() {
|
2850
|
+
this.cannotMatchTarget('Could not find target in current page');
|
2851
|
+
}
|
2852
|
+
cannotMatchPostflightTarget() {
|
2853
|
+
this.cannotMatchTarget('Could not find common target in current page and response');
|
2854
|
+
}
|
2855
|
+
cannotMatchTarget(reason) {
|
2856
|
+
let message;
|
2857
|
+
if (this.getPlans().length) {
|
2858
|
+
const planTargets = u.uniq(u.map(this.getPlans(), 'target'));
|
2859
|
+
const humanizedLayerOption = up.layer.optionToString(this.options.layer);
|
2860
|
+
message = [reason + " (tried selectors %o in %s)", planTargets, humanizedLayerOption];
|
2861
|
+
}
|
2862
|
+
else if (this.layers.length) {
|
2863
|
+
if (this.options.failPrefixForced) {
|
2864
|
+
message = 'No target selector given for failed responses (https://unpoly.com/failed-responses)';
|
2865
|
+
}
|
2866
|
+
else {
|
2867
|
+
message = 'No target selector given';
|
2868
|
+
}
|
2869
|
+
}
|
2870
|
+
else {
|
2871
|
+
message = 'Could not find a layer to render in. You may have passed a non-existing layer reference, or a detached element.';
|
2872
|
+
}
|
2873
|
+
throw new up.CannotMatch(message);
|
2874
|
+
}
|
2875
|
+
seekPlan(fn) {
|
2876
|
+
for (let plan of this.getPlans()) {
|
2877
|
+
try {
|
2878
|
+
return fn(plan);
|
2879
|
+
}
|
2880
|
+
catch (error) {
|
2881
|
+
if (!(error instanceof up.CannotMatch)) {
|
2882
|
+
throw error;
|
2883
|
+
}
|
2884
|
+
}
|
2885
|
+
}
|
2886
|
+
}
|
2887
|
+
},
|
2888
|
+
(() => {
|
2889
|
+
u.memoizeMethod(_a.prototype, [
|
2890
|
+
'getPlans',
|
2891
|
+
'getResponseDoc',
|
2892
|
+
'getPreflightProps',
|
2893
|
+
]);
|
2894
|
+
})(),
|
2895
|
+
_a);
|
2896
|
+
|
2897
|
+
|
2898
|
+
/***/ }),
|
2899
|
+
/* 34 */
|
2900
|
+
/***/ (() => {
|
2901
|
+
|
2869
2902
|
const u = up.util;
|
2870
2903
|
up.CompilerPass = class CompilerPass {
|
2871
2904
|
constructor(root, compilers, { layer, data, dataMap, meta }) {
|
@@ -2974,7 +3007,7 @@ up.CompilerPass = class CompilerPass {
|
|
2974
3007
|
|
2975
3008
|
|
2976
3009
|
/***/ }),
|
2977
|
-
/*
|
3010
|
+
/* 35 */
|
2978
3011
|
/***/ (() => {
|
2979
3012
|
|
2980
3013
|
const u = up.util;
|
@@ -3085,7 +3118,7 @@ up.CSSTransition = class CSSTransition {
|
|
3085
3118
|
|
3086
3119
|
|
3087
3120
|
/***/ }),
|
3088
|
-
/*
|
3121
|
+
/* 36 */
|
3089
3122
|
/***/ (() => {
|
3090
3123
|
|
3091
3124
|
const u = up.util;
|
@@ -3127,7 +3160,7 @@ up.DestructorPass = class DestructorPass {
|
|
3127
3160
|
|
3128
3161
|
|
3129
3162
|
/***/ }),
|
3130
|
-
/*
|
3163
|
+
/* 37 */
|
3131
3164
|
/***/ (() => {
|
3132
3165
|
|
3133
3166
|
const u = up.util;
|
@@ -3226,7 +3259,7 @@ up.EventEmitter = class EventEmitter extends up.Record {
|
|
3226
3259
|
|
3227
3260
|
|
3228
3261
|
/***/ }),
|
3229
|
-
/*
|
3262
|
+
/* 38 */
|
3230
3263
|
/***/ (() => {
|
3231
3264
|
|
3232
3265
|
const u = up.util;
|
@@ -3328,7 +3361,7 @@ up.EventListener = class EventListener extends up.Record {
|
|
3328
3361
|
|
3329
3362
|
|
3330
3363
|
/***/ }),
|
3331
|
-
/*
|
3364
|
+
/* 39 */
|
3332
3365
|
/***/ (() => {
|
3333
3366
|
|
3334
3367
|
const u = up.util;
|
@@ -3400,7 +3433,7 @@ up.EventListenerGroup = class EventListenerGroup extends up.Record {
|
|
3400
3433
|
|
3401
3434
|
|
3402
3435
|
/***/ }),
|
3403
|
-
/*
|
3436
|
+
/* 40 */
|
3404
3437
|
/***/ (() => {
|
3405
3438
|
|
3406
3439
|
const u = up.util;
|
@@ -3516,7 +3549,7 @@ up.FieldWatcher = class FieldWatcher {
|
|
3516
3549
|
|
3517
3550
|
|
3518
3551
|
/***/ }),
|
3519
|
-
/*
|
3552
|
+
/* 41 */
|
3520
3553
|
/***/ (() => {
|
3521
3554
|
|
3522
3555
|
const u = up.util;
|
@@ -3690,7 +3723,7 @@ up.FormValidator = class FormValidator {
|
|
3690
3723
|
|
3691
3724
|
|
3692
3725
|
/***/ }),
|
3693
|
-
/*
|
3726
|
+
/* 42 */
|
3694
3727
|
/***/ (() => {
|
3695
3728
|
|
3696
3729
|
up.FocusCapsule = class FocusCapsule {
|
@@ -3720,7 +3753,7 @@ up.FocusCapsule = class FocusCapsule {
|
|
3720
3753
|
|
3721
3754
|
|
3722
3755
|
/***/ }),
|
3723
|
-
/*
|
3756
|
+
/* 43 */
|
3724
3757
|
/***/ (() => {
|
3725
3758
|
|
3726
3759
|
const u = up.util;
|
@@ -3784,7 +3817,7 @@ up.FragmentProcessor = class FragmentProcessor extends up.Record {
|
|
3784
3817
|
|
3785
3818
|
|
3786
3819
|
/***/ }),
|
3787
|
-
/*
|
3820
|
+
/* 44 */
|
3788
3821
|
/***/ (() => {
|
3789
3822
|
|
3790
3823
|
const DESCENDANT_SELECTOR = /^([^ >+(]+) (.+)$/;
|
@@ -3827,7 +3860,7 @@ up.FragmentFinder = class FragmentFinder {
|
|
3827
3860
|
|
3828
3861
|
|
3829
3862
|
/***/ }),
|
3830
|
-
/*
|
3863
|
+
/* 45 */
|
3831
3864
|
/***/ (() => {
|
3832
3865
|
|
3833
3866
|
const u = up.util;
|
@@ -3911,7 +3944,7 @@ up.FragmentFocus = class FragmentFocus extends up.FragmentProcessor {
|
|
3911
3944
|
|
3912
3945
|
|
3913
3946
|
/***/ }),
|
3914
|
-
/*
|
3947
|
+
/* 46 */
|
3915
3948
|
/***/ (() => {
|
3916
3949
|
|
3917
3950
|
const e = up.element;
|
@@ -4018,7 +4051,7 @@ up.FragmentPolling = class FragmentPolling {
|
|
4018
4051
|
|
4019
4052
|
|
4020
4053
|
/***/ }),
|
4021
|
-
/*
|
4054
|
+
/* 47 */
|
4022
4055
|
/***/ (() => {
|
4023
4056
|
|
4024
4057
|
const u = up.util;
|
@@ -4082,7 +4115,7 @@ up.FragmentScrolling = class FragmentScrolling extends up.FragmentProcessor {
|
|
4082
4115
|
|
4083
4116
|
|
4084
4117
|
/***/ }),
|
4085
|
-
/*
|
4118
|
+
/* 48 */
|
4086
4119
|
/***/ (() => {
|
4087
4120
|
|
4088
4121
|
const e = up.element;
|
@@ -4305,7 +4338,7 @@ up.Layer = class Layer extends up.Record {
|
|
4305
4338
|
|
4306
4339
|
|
4307
4340
|
/***/ }),
|
4308
|
-
/*
|
4341
|
+
/* 49 */
|
4309
4342
|
/***/ (() => {
|
4310
4343
|
|
4311
4344
|
const e = up.element;
|
@@ -4496,20 +4529,20 @@ up.Layer.Overlay = class Overlay extends up.Layer {
|
|
4496
4529
|
}
|
4497
4530
|
return this.on(eventTypes, event => {
|
4498
4531
|
event.preventDefault();
|
4499
|
-
closeFn.call(this, event);
|
4532
|
+
closeFn.call(this, event, { response: event.response });
|
4500
4533
|
});
|
4501
4534
|
}
|
4502
|
-
tryAcceptForLocation() {
|
4503
|
-
this.tryCloseForLocation(this.acceptLocation, this.accept);
|
4535
|
+
tryAcceptForLocation(options) {
|
4536
|
+
this.tryCloseForLocation(this.acceptLocation, this.accept, options);
|
4504
4537
|
}
|
4505
|
-
tryDismissForLocation() {
|
4506
|
-
this.tryCloseForLocation(this.dismissLocation, this.dismiss);
|
4538
|
+
tryDismissForLocation(options) {
|
4539
|
+
this.tryCloseForLocation(this.dismissLocation, this.dismiss, options);
|
4507
4540
|
}
|
4508
|
-
tryCloseForLocation(urlPattern, closeFn) {
|
4541
|
+
tryCloseForLocation(urlPattern, closeFn, options) {
|
4509
4542
|
let location, resolution;
|
4510
4543
|
if (urlPattern && (location = this.location) && (resolution = urlPattern.recognize(location))) {
|
4511
4544
|
const closeValue = { ...resolution, location };
|
4512
|
-
closeFn.call(this, closeValue);
|
4545
|
+
closeFn.call(this, closeValue, options);
|
4513
4546
|
}
|
4514
4547
|
}
|
4515
4548
|
teardownHandlers() {
|
@@ -4580,7 +4613,7 @@ up.Layer.Overlay = class Overlay extends up.Layer {
|
|
4580
4613
|
|
4581
4614
|
|
4582
4615
|
/***/ }),
|
4583
|
-
/*
|
4616
|
+
/* 50 */
|
4584
4617
|
/***/ (() => {
|
4585
4618
|
|
4586
4619
|
up.Layer.OverlayWithTether = class OverlayWithTether extends up.Layer.Overlay {
|
@@ -4617,7 +4650,7 @@ up.Layer.OverlayWithTether = class OverlayWithTether extends up.Layer.Overlay {
|
|
4617
4650
|
|
4618
4651
|
|
4619
4652
|
/***/ }),
|
4620
|
-
/*
|
4653
|
+
/* 51 */
|
4621
4654
|
/***/ (() => {
|
4622
4655
|
|
4623
4656
|
var _a;
|
@@ -4655,7 +4688,7 @@ up.Layer.OverlayWithViewport = (_a = class OverlayWithViewport extends up.Layer.
|
|
4655
4688
|
|
4656
4689
|
|
4657
4690
|
/***/ }),
|
4658
|
-
/*
|
4691
|
+
/* 52 */
|
4659
4692
|
/***/ (() => {
|
4660
4693
|
|
4661
4694
|
var _a;
|
@@ -4701,7 +4734,7 @@ up.Layer.Root = (_a = class Root extends up.Layer {
|
|
4701
4734
|
|
4702
4735
|
|
4703
4736
|
/***/ }),
|
4704
|
-
/*
|
4737
|
+
/* 53 */
|
4705
4738
|
/***/ (() => {
|
4706
4739
|
|
4707
4740
|
var _a;
|
@@ -4712,7 +4745,7 @@ up.Layer.Modal = (_a = class Modal extends up.Layer.OverlayWithViewport {
|
|
4712
4745
|
|
4713
4746
|
|
4714
4747
|
/***/ }),
|
4715
|
-
/*
|
4748
|
+
/* 54 */
|
4716
4749
|
/***/ (() => {
|
4717
4750
|
|
4718
4751
|
var _a;
|
@@ -4723,7 +4756,7 @@ up.Layer.Popup = (_a = class Popup extends up.Layer.OverlayWithTether {
|
|
4723
4756
|
|
4724
4757
|
|
4725
4758
|
/***/ }),
|
4726
|
-
/*
|
4759
|
+
/* 55 */
|
4727
4760
|
/***/ (() => {
|
4728
4761
|
|
4729
4762
|
var _a;
|
@@ -4734,7 +4767,7 @@ up.Layer.Drawer = (_a = class Drawer extends up.Layer.OverlayWithViewport {
|
|
4734
4767
|
|
4735
4768
|
|
4736
4769
|
/***/ }),
|
4737
|
-
/*
|
4770
|
+
/* 56 */
|
4738
4771
|
/***/ (() => {
|
4739
4772
|
|
4740
4773
|
var _a;
|
@@ -4745,7 +4778,7 @@ up.Layer.Cover = (_a = class Cover extends up.Layer.OverlayWithViewport {
|
|
4745
4778
|
|
4746
4779
|
|
4747
4780
|
/***/ }),
|
4748
|
-
/*
|
4781
|
+
/* 57 */
|
4749
4782
|
/***/ (() => {
|
4750
4783
|
|
4751
4784
|
const u = up.util;
|
@@ -4835,7 +4868,7 @@ up.LayerLookup = class LayerLookup {
|
|
4835
4868
|
|
4836
4869
|
|
4837
4870
|
/***/ }),
|
4838
|
-
/*
|
4871
|
+
/* 58 */
|
4839
4872
|
/***/ (() => {
|
4840
4873
|
|
4841
4874
|
const u = up.util;
|
@@ -4948,7 +4981,7 @@ up.LayerStack = class LayerStack extends Array {
|
|
4948
4981
|
|
4949
4982
|
|
4950
4983
|
/***/ }),
|
4951
|
-
/*
|
4984
|
+
/* 59 */
|
4952
4985
|
/***/ (() => {
|
4953
4986
|
|
4954
4987
|
up.LinkFeedbackURLs = class LinkFeedbackURLs {
|
@@ -4979,7 +5012,7 @@ up.LinkFeedbackURLs = class LinkFeedbackURLs {
|
|
4979
5012
|
|
4980
5013
|
|
4981
5014
|
/***/ }),
|
4982
|
-
/*
|
5015
|
+
/* 60 */
|
4983
5016
|
/***/ (() => {
|
4984
5017
|
|
4985
5018
|
const u = up.util;
|
@@ -5047,7 +5080,7 @@ up.LinkPreloader = class LinkPreloader {
|
|
5047
5080
|
|
5048
5081
|
|
5049
5082
|
/***/ }),
|
5050
|
-
/*
|
5083
|
+
/* 61 */
|
5051
5084
|
/***/ (() => {
|
5052
5085
|
|
5053
5086
|
const u = up.util;
|
@@ -5143,7 +5176,7 @@ up.MotionController = class MotionController {
|
|
5143
5176
|
|
5144
5177
|
|
5145
5178
|
/***/ }),
|
5146
|
-
/*
|
5179
|
+
/* 62 */
|
5147
5180
|
/***/ (() => {
|
5148
5181
|
|
5149
5182
|
const u = up.util;
|
@@ -5235,7 +5268,7 @@ up.NonceableCallback = class NonceableCallback {
|
|
5235
5268
|
|
5236
5269
|
|
5237
5270
|
/***/ }),
|
5238
|
-
/*
|
5271
|
+
/* 63 */
|
5239
5272
|
/***/ (() => {
|
5240
5273
|
|
5241
5274
|
const u = up.util;
|
@@ -5312,7 +5345,7 @@ up.OptionsParser = class OptionsParser {
|
|
5312
5345
|
|
5313
5346
|
|
5314
5347
|
/***/ }),
|
5315
|
-
/*
|
5348
|
+
/* 64 */
|
5316
5349
|
/***/ (() => {
|
5317
5350
|
|
5318
5351
|
const e = up.element;
|
@@ -5380,7 +5413,7 @@ up.OverlayFocus = class OverlayFocus {
|
|
5380
5413
|
|
5381
5414
|
|
5382
5415
|
/***/ }),
|
5383
|
-
/*
|
5416
|
+
/* 65 */
|
5384
5417
|
/***/ (() => {
|
5385
5418
|
|
5386
5419
|
const u = up.util;
|
@@ -5611,7 +5644,7 @@ up.Params = class Params {
|
|
5611
5644
|
|
5612
5645
|
|
5613
5646
|
/***/ }),
|
5614
|
-
/*
|
5647
|
+
/* 66 */
|
5615
5648
|
/***/ (() => {
|
5616
5649
|
|
5617
5650
|
const e = up.element;
|
@@ -5661,7 +5694,7 @@ up.ProgressBar = class ProgressBar {
|
|
5661
5694
|
|
5662
5695
|
|
5663
5696
|
/***/ }),
|
5664
|
-
/*
|
5697
|
+
/* 67 */
|
5665
5698
|
/***/ (() => {
|
5666
5699
|
|
5667
5700
|
const u = up.util;
|
@@ -5710,14 +5743,15 @@ up.RenderOptions = (function () {
|
|
5710
5743
|
]);
|
5711
5744
|
const CONTENT_KEYS = [
|
5712
5745
|
'url',
|
5746
|
+
'response',
|
5713
5747
|
'content',
|
5714
5748
|
'fragment',
|
5715
|
-
'document'
|
5749
|
+
'document',
|
5716
5750
|
];
|
5717
5751
|
const LATE_KEYS = [
|
5718
5752
|
'history',
|
5719
5753
|
'focus',
|
5720
|
-
'scroll'
|
5754
|
+
'scroll',
|
5721
5755
|
];
|
5722
5756
|
function navigateDefaults(options) {
|
5723
5757
|
if (options.navigate) {
|
@@ -5784,7 +5818,7 @@ up.RenderOptions = (function () {
|
|
5784
5818
|
|
5785
5819
|
|
5786
5820
|
/***/ }),
|
5787
|
-
/*
|
5821
|
+
/* 68 */
|
5788
5822
|
/***/ (() => {
|
5789
5823
|
|
5790
5824
|
up.RenderResult = class RenderResult extends up.Record {
|
@@ -5812,7 +5846,7 @@ up.RenderResult = class RenderResult extends up.Record {
|
|
5812
5846
|
|
5813
5847
|
|
5814
5848
|
/***/ }),
|
5815
|
-
/*
|
5849
|
+
/* 69 */
|
5816
5850
|
/***/ (() => {
|
5817
5851
|
|
5818
5852
|
var _a;
|
@@ -5884,13 +5918,15 @@ up.Request = (_a = class Request extends up.Record {
|
|
5884
5918
|
return this._xhr ?? (this._xhr = new XMLHttpRequest());
|
5885
5919
|
}
|
5886
5920
|
get fragments() {
|
5887
|
-
if (
|
5921
|
+
if (this._fragments) {
|
5922
|
+
return this._fragments;
|
5923
|
+
}
|
5924
|
+
else if (this.target) {
|
5888
5925
|
let steps = up.fragment.parseTargetSteps(this.target);
|
5889
5926
|
let selectors = u.map(steps, 'selector');
|
5890
5927
|
let lookupOpts = { origin: this.origin, layer: this.layer };
|
5891
|
-
|
5928
|
+
return u.compact(u.map(selectors, (selector) => up.fragment.get(selector, lookupOpts)));
|
5892
5929
|
}
|
5893
|
-
return this._fragments;
|
5894
5930
|
}
|
5895
5931
|
set fragments(value) {
|
5896
5932
|
this._fragments = value;
|
@@ -6147,7 +6183,7 @@ up.Request = (_a = class Request extends up.Record {
|
|
6147
6183
|
|
6148
6184
|
|
6149
6185
|
/***/ }),
|
6150
|
-
/*
|
6186
|
+
/* 70 */
|
6151
6187
|
/***/ (() => {
|
6152
6188
|
|
6153
6189
|
const u = up.util;
|
@@ -6237,6 +6273,7 @@ up.Request.Cache = class Cache {
|
|
6237
6273
|
if (value instanceof up.Response) {
|
6238
6274
|
if (options.force || this.isCacheCompatible(existingRequest, newRequest)) {
|
6239
6275
|
newRequest.fromCache = true;
|
6276
|
+
value = u.variant(value, { request: newRequest });
|
6240
6277
|
newRequest.respondWith(value);
|
6241
6278
|
u.delegate(newRequest, ['expired', 'state'], () => existingRequest);
|
6242
6279
|
}
|
@@ -6286,7 +6323,7 @@ up.Request.Cache = class Cache {
|
|
6286
6323
|
|
6287
6324
|
|
6288
6325
|
/***/ }),
|
6289
|
-
/*
|
6326
|
+
/* 71 */
|
6290
6327
|
/***/ (() => {
|
6291
6328
|
|
6292
6329
|
const u = up.util;
|
@@ -6394,7 +6431,7 @@ up.Request.Queue = class Queue {
|
|
6394
6431
|
|
6395
6432
|
|
6396
6433
|
/***/ }),
|
6397
|
-
/*
|
6434
|
+
/* 72 */
|
6398
6435
|
/***/ (() => {
|
6399
6436
|
|
6400
6437
|
const u = up.util;
|
@@ -6433,7 +6470,7 @@ up.Request.FormRenderer = class FormRenderer {
|
|
6433
6470
|
|
6434
6471
|
|
6435
6472
|
/***/ }),
|
6436
|
-
/*
|
6473
|
+
/* 73 */
|
6437
6474
|
/***/ (() => {
|
6438
6475
|
|
6439
6476
|
var _a;
|
@@ -6505,7 +6542,7 @@ up.Request.XHRRenderer = (_a = class XHRRenderer {
|
|
6505
6542
|
|
6506
6543
|
|
6507
6544
|
/***/ }),
|
6508
|
-
/*
|
6545
|
+
/* 74 */
|
6509
6546
|
/***/ (() => {
|
6510
6547
|
|
6511
6548
|
const u = up.util;
|
@@ -6540,6 +6577,12 @@ up.Response = class Response extends up.Record {
|
|
6540
6577
|
get ok() {
|
6541
6578
|
return !u.evalOption(this.fail ?? up.network.config.fail, this);
|
6542
6579
|
}
|
6580
|
+
get none() {
|
6581
|
+
return !this.text;
|
6582
|
+
}
|
6583
|
+
isCacheable() {
|
6584
|
+
return this.ok && !this.none;
|
6585
|
+
}
|
6543
6586
|
header(name) {
|
6544
6587
|
return this.headers[name] || this.xhr?.getResponseHeader(name);
|
6545
6588
|
}
|
@@ -6580,7 +6623,7 @@ up.Response = class Response extends up.Record {
|
|
6580
6623
|
|
6581
6624
|
|
6582
6625
|
/***/ }),
|
6583
|
-
/*
|
6626
|
+
/* 75 */
|
6584
6627
|
/***/ (() => {
|
6585
6628
|
|
6586
6629
|
var _a;
|
@@ -6660,7 +6703,7 @@ up.ResponseDoc = (_a = class ResponseDoc {
|
|
6660
6703
|
|
6661
6704
|
|
6662
6705
|
/***/ }),
|
6663
|
-
/*
|
6706
|
+
/* 76 */
|
6664
6707
|
/***/ (() => {
|
6665
6708
|
|
6666
6709
|
const e = up.element;
|
@@ -6754,7 +6797,7 @@ up.RevealMotion = class RevealMotion {
|
|
6754
6797
|
|
6755
6798
|
|
6756
6799
|
/***/ }),
|
6757
|
-
/*
|
6800
|
+
/* 77 */
|
6758
6801
|
/***/ (() => {
|
6759
6802
|
|
6760
6803
|
const u = up.util;
|
@@ -6795,7 +6838,7 @@ up.Selector = class Selector {
|
|
6795
6838
|
|
6796
6839
|
|
6797
6840
|
/***/ }),
|
6798
|
-
/*
|
6841
|
+
/* 78 */
|
6799
6842
|
/***/ (() => {
|
6800
6843
|
|
6801
6844
|
const u = up.util;
|
@@ -6915,7 +6958,7 @@ up.Tether = class Tether {
|
|
6915
6958
|
|
6916
6959
|
|
6917
6960
|
/***/ }),
|
6918
|
-
/*
|
6961
|
+
/* 79 */
|
6919
6962
|
/***/ (() => {
|
6920
6963
|
|
6921
6964
|
const u = up.util;
|
@@ -6995,7 +7038,7 @@ up.URLPattern = class URLPattern {
|
|
6995
7038
|
|
6996
7039
|
|
6997
7040
|
/***/ }),
|
6998
|
-
/*
|
7041
|
+
/* 80 */
|
6999
7042
|
/***/ (() => {
|
7000
7043
|
|
7001
7044
|
up.framework = (function () {
|
@@ -7079,7 +7122,7 @@ up.boot = up.framework.boot;
|
|
7079
7122
|
|
7080
7123
|
|
7081
7124
|
/***/ }),
|
7082
|
-
/*
|
7125
|
+
/* 81 */
|
7083
7126
|
/***/ (() => {
|
7084
7127
|
|
7085
7128
|
up.event = (function () {
|
@@ -7182,7 +7225,7 @@ up.emit = up.event.emit;
|
|
7182
7225
|
|
7183
7226
|
|
7184
7227
|
/***/ }),
|
7185
|
-
/*
|
7228
|
+
/* 82 */
|
7186
7229
|
/***/ (() => {
|
7187
7230
|
|
7188
7231
|
up.protocol = (function () {
|
@@ -7323,7 +7366,7 @@ up.protocol = (function () {
|
|
7323
7366
|
|
7324
7367
|
|
7325
7368
|
/***/ }),
|
7326
|
-
/*
|
7369
|
+
/* 83 */
|
7327
7370
|
/***/ (() => {
|
7328
7371
|
|
7329
7372
|
up.log = (function () {
|
@@ -7408,7 +7451,7 @@ up.warn = up.log.warn;
|
|
7408
7451
|
|
7409
7452
|
|
7410
7453
|
/***/ }),
|
7411
|
-
/*
|
7454
|
+
/* 84 */
|
7412
7455
|
/***/ (() => {
|
7413
7456
|
|
7414
7457
|
up.syntax = (function () {
|
@@ -7558,7 +7601,7 @@ up.hello = up.syntax.hello;
|
|
7558
7601
|
|
7559
7602
|
|
7560
7603
|
/***/ }),
|
7561
|
-
/*
|
7604
|
+
/* 85 */
|
7562
7605
|
/***/ (() => {
|
7563
7606
|
|
7564
7607
|
up.history = (function () {
|
@@ -7694,10 +7737,10 @@ up.history = (function () {
|
|
7694
7737
|
|
7695
7738
|
|
7696
7739
|
/***/ }),
|
7697
|
-
/*
|
7740
|
+
/* 86 */
|
7698
7741
|
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
|
7699
7742
|
|
7700
|
-
__webpack_require__(
|
7743
|
+
__webpack_require__(87);
|
7701
7744
|
const u = up.util;
|
7702
7745
|
const e = up.element;
|
7703
7746
|
up.fragment = (function () {
|
@@ -8224,7 +8267,7 @@ u.delegate(up, ['context'], () => up.layer.current);
|
|
8224
8267
|
|
8225
8268
|
|
8226
8269
|
/***/ }),
|
8227
|
-
/*
|
8270
|
+
/* 87 */
|
8228
8271
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
8229
8272
|
|
8230
8273
|
"use strict";
|
@@ -8233,10 +8276,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
8233
8276
|
|
8234
8277
|
|
8235
8278
|
/***/ }),
|
8236
|
-
/*
|
8279
|
+
/* 88 */
|
8237
8280
|
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
|
8238
8281
|
|
8239
|
-
__webpack_require__(
|
8282
|
+
__webpack_require__(89);
|
8240
8283
|
up.viewport = (function () {
|
8241
8284
|
const u = up.util;
|
8242
8285
|
const e = up.element;
|
@@ -8556,7 +8599,7 @@ up.reveal = up.viewport.reveal;
|
|
8556
8599
|
|
8557
8600
|
|
8558
8601
|
/***/ }),
|
8559
|
-
/*
|
8602
|
+
/* 89 */
|
8560
8603
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
8561
8604
|
|
8562
8605
|
"use strict";
|
@@ -8565,7 +8608,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
8565
8608
|
|
8566
8609
|
|
8567
8610
|
/***/ }),
|
8568
|
-
/*
|
8611
|
+
/* 90 */
|
8569
8612
|
/***/ (() => {
|
8570
8613
|
|
8571
8614
|
up.motion = (function () {
|
@@ -8820,10 +8863,10 @@ up.animate = up.motion.animate;
|
|
8820
8863
|
|
8821
8864
|
|
8822
8865
|
/***/ }),
|
8823
|
-
/*
|
8866
|
+
/* 91 */
|
8824
8867
|
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
|
8825
8868
|
|
8826
|
-
__webpack_require__(
|
8869
|
+
__webpack_require__(92);
|
8827
8870
|
const u = up.util;
|
8828
8871
|
up.network = (function () {
|
8829
8872
|
const config = new up.Config(() => ({
|
@@ -8891,19 +8934,19 @@ up.network = (function () {
|
|
8891
8934
|
cache.put(request);
|
8892
8935
|
request.onLoading = () => cache.put(request);
|
8893
8936
|
}
|
8894
|
-
u.always(request, function (
|
8895
|
-
let expireCache =
|
8937
|
+
u.always(request, function (responseOrError) {
|
8938
|
+
let expireCache = responseOrError.expireCache ?? request.expireCache ?? u.evalOption(config.expireCache, request, responseOrError);
|
8896
8939
|
if (expireCache) {
|
8897
8940
|
cache.expire(expireCache, { except: request });
|
8898
8941
|
}
|
8899
|
-
let evictCache =
|
8942
|
+
let evictCache = responseOrError.evictCache ?? request.evictCache ?? u.evalOption(config.evictCache, request, responseOrError);
|
8900
8943
|
if (evictCache) {
|
8901
8944
|
cache.evict(evictCache, { except: request });
|
8902
8945
|
}
|
8903
8946
|
if (cache.get(request)) {
|
8904
8947
|
cache.put(request);
|
8905
8948
|
}
|
8906
|
-
if (!
|
8949
|
+
if (!responseOrError.isCacheable?.()) {
|
8907
8950
|
cache.evict(request);
|
8908
8951
|
}
|
8909
8952
|
});
|
@@ -8927,7 +8970,7 @@ up.network = (function () {
|
|
8927
8970
|
}
|
8928
8971
|
function registerAliasForRedirect(request, response) {
|
8929
8972
|
if (request.cache && response.url && request.url !== response.url) {
|
8930
|
-
const newRequest =
|
8973
|
+
const newRequest = u.variant(request, {
|
8931
8974
|
method: response.method,
|
8932
8975
|
url: response.url
|
8933
8976
|
});
|
@@ -8966,7 +9009,7 @@ up.cache = up.network.cache;
|
|
8966
9009
|
|
8967
9010
|
|
8968
9011
|
/***/ }),
|
8969
|
-
/*
|
9012
|
+
/* 92 */
|
8970
9013
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
8971
9014
|
|
8972
9015
|
"use strict";
|
@@ -8975,10 +9018,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
8975
9018
|
|
8976
9019
|
|
8977
9020
|
/***/ }),
|
8978
|
-
/*
|
9021
|
+
/* 93 */
|
8979
9022
|
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
|
8980
9023
|
|
8981
|
-
__webpack_require__(
|
9024
|
+
__webpack_require__(94);
|
8982
9025
|
const u = up.util;
|
8983
9026
|
const e = up.element;
|
8984
9027
|
up.layer = (function () {
|
@@ -9122,7 +9165,7 @@ up.layer = (function () {
|
|
9122
9165
|
return e.callbackAttr(link, attr, { exposedKeys: ['layer'] });
|
9123
9166
|
}
|
9124
9167
|
function closeCallbackAttr(link, attr) {
|
9125
|
-
return e.callbackAttr(link, attr, { exposedKeys: ['layer', 'value'] });
|
9168
|
+
return e.callbackAttr(link, attr, { exposedKeys: ['layer', 'value', 'response'] });
|
9126
9169
|
}
|
9127
9170
|
function reset() {
|
9128
9171
|
config.reset();
|
@@ -9219,7 +9262,7 @@ up.layer = (function () {
|
|
9219
9262
|
|
9220
9263
|
|
9221
9264
|
/***/ }),
|
9222
|
-
/*
|
9265
|
+
/* 94 */
|
9223
9266
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
9224
9267
|
|
9225
9268
|
"use strict";
|
@@ -9228,10 +9271,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
9228
9271
|
|
9229
9272
|
|
9230
9273
|
/***/ }),
|
9231
|
-
/*
|
9274
|
+
/* 95 */
|
9232
9275
|
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
|
9233
9276
|
|
9234
|
-
__webpack_require__(
|
9277
|
+
__webpack_require__(96);
|
9235
9278
|
up.link = (function () {
|
9236
9279
|
const u = up.util;
|
9237
9280
|
const e = up.element;
|
@@ -9239,7 +9282,7 @@ up.link = (function () {
|
|
9239
9282
|
let lastMousedownTarget = null;
|
9240
9283
|
const LINKS_WITH_LOCAL_HTML = ['a[up-content]', 'a[up-fragment]', 'a[up-document]'];
|
9241
9284
|
const LINKS_WITH_REMOTE_HTML = ['a[href]', '[up-href]'];
|
9242
|
-
const ATTRIBUTES_SUGGESTING_FOLLOW = ['[up-follow]', '[up-target]', '[up-layer]', '[up-transition]', '[up-preload]', '[up-instant]'];
|
9285
|
+
const ATTRIBUTES_SUGGESTING_FOLLOW = ['[up-follow]', '[up-target]', '[up-layer]', '[up-transition]', '[up-preload]', '[up-instant]', '[up-href]'];
|
9243
9286
|
function combineFollowableSelectors(elementSelectors, attributeSelectors) {
|
9244
9287
|
return u.flatMap(elementSelectors, elementSelector => attributeSelectors.map(attrSelector => elementSelector + attrSelector));
|
9245
9288
|
}
|
@@ -9526,7 +9569,7 @@ up.follow = up.link.follow;
|
|
9526
9569
|
|
9527
9570
|
|
9528
9571
|
/***/ }),
|
9529
|
-
/*
|
9572
|
+
/* 96 */
|
9530
9573
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
9531
9574
|
|
9532
9575
|
"use strict";
|
@@ -9535,7 +9578,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
9535
9578
|
|
9536
9579
|
|
9537
9580
|
/***/ }),
|
9538
|
-
/*
|
9581
|
+
/* 97 */
|
9539
9582
|
/***/ (() => {
|
9540
9583
|
|
9541
9584
|
up.form = (function () {
|
@@ -9550,7 +9593,7 @@ up.form = (function () {
|
|
9550
9593
|
submitButtonSelectors: ['input[type=submit]', 'input[type=image]', 'button[type=submit]', 'button:not([type])'],
|
9551
9594
|
watchInputEvents: ['input', 'change'],
|
9552
9595
|
watchInputDelay: 0,
|
9553
|
-
watchChangeEvents:
|
9596
|
+
watchChangeEvents: ['change'],
|
9554
9597
|
}));
|
9555
9598
|
function fullSubmitSelector() {
|
9556
9599
|
return config.submitSelectors.join(',');
|
@@ -9929,7 +9972,7 @@ up.validate = up.form.validate;
|
|
9929
9972
|
|
9930
9973
|
|
9931
9974
|
/***/ }),
|
9932
|
-
/*
|
9975
|
+
/* 98 */
|
9933
9976
|
/***/ (() => {
|
9934
9977
|
|
9935
9978
|
up.feedback = (function () {
|
@@ -10046,7 +10089,7 @@ up.feedback = (function () {
|
|
10046
10089
|
|
10047
10090
|
|
10048
10091
|
/***/ }),
|
10049
|
-
/*
|
10092
|
+
/* 99 */
|
10050
10093
|
/***/ (() => {
|
10051
10094
|
|
10052
10095
|
up.radio = (function () {
|
@@ -10123,7 +10166,7 @@ up.radio = (function () {
|
|
10123
10166
|
|
10124
10167
|
|
10125
10168
|
/***/ }),
|
10126
|
-
/*
|
10169
|
+
/* 100 */
|
10127
10170
|
/***/ (() => {
|
10128
10171
|
|
10129
10172
|
(function () {
|
@@ -10272,15 +10315,16 @@ __webpack_require__(82);
|
|
10272
10315
|
__webpack_require__(83);
|
10273
10316
|
__webpack_require__(84);
|
10274
10317
|
__webpack_require__(85);
|
10275
|
-
__webpack_require__(
|
10276
|
-
__webpack_require__(
|
10318
|
+
__webpack_require__(86);
|
10319
|
+
__webpack_require__(88);
|
10277
10320
|
__webpack_require__(90);
|
10278
|
-
__webpack_require__(
|
10279
|
-
__webpack_require__(
|
10280
|
-
__webpack_require__(
|
10321
|
+
__webpack_require__(91);
|
10322
|
+
__webpack_require__(93);
|
10323
|
+
__webpack_require__(95);
|
10281
10324
|
__webpack_require__(97);
|
10282
10325
|
__webpack_require__(98);
|
10283
10326
|
__webpack_require__(99);
|
10327
|
+
__webpack_require__(100);
|
10284
10328
|
up.framework.onEvaled();
|
10285
10329
|
|
10286
10330
|
})();
|