unpoly-rails 0.61.1 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of unpoly-rails might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +56 -1
- data/Gemfile +0 -1
- data/Gemfile.lock +1 -7
- data/README.md +7 -6
- data/Rakefile +10 -1
- data/dist/unpoly.js +85 -55
- data/dist/unpoly.min.js +4 -4
- data/lib/assets/javascripts/unpoly/classes/body_shifter.coffee +21 -12
- data/lib/assets/javascripts/unpoly/classes/follow_variant.coffee +11 -3
- data/lib/assets/javascripts/unpoly/classes/params.coffee.erb +1 -0
- data/lib/assets/javascripts/unpoly/classes/request.coffee +1 -0
- data/lib/assets/javascripts/unpoly/element.coffee.erb +8 -5
- data/lib/assets/javascripts/unpoly/event.coffee.erb +1 -1
- data/lib/assets/javascripts/unpoly/form.coffee.erb +16 -1
- data/lib/assets/javascripts/unpoly/fragment.coffee.erb +1 -0
- data/lib/assets/javascripts/unpoly/framework.coffee +7 -9
- data/lib/assets/javascripts/unpoly/log.coffee +7 -2
- data/lib/assets/javascripts/unpoly/modal.coffee.erb +2 -0
- data/lib/assets/javascripts/unpoly/motion.coffee.erb +1 -1
- data/lib/assets/javascripts/unpoly/protocol.coffee +2 -0
- data/lib/assets/javascripts/unpoly/syntax.coffee.erb +2 -3
- data/lib/assets/javascripts/unpoly/util.coffee.erb +2 -1
- data/lib/unpoly/rails/version.rb +1 -1
- data/package.json +1 -1
- data/spec_app/Gemfile +0 -1
- data/spec_app/Gemfile.lock +1 -7
- data/spec_app/app/views/compiler_test/timestamp.erb +1 -0
- data/spec_app/app/views/css_test/modal.erb +1 -1
- data/spec_app/app/views/css_test/popup.erb +1 -1
- data/spec_app/spec/javascripts/up/fragment_spec.js.coffee +27 -1
- data/spec_app/spec/javascripts/up/link_spec.js.coffee +7 -2
- data/spec_app/spec/javascripts/up/modal_spec.js.coffee +23 -1
- data/spec_app/spec/javascripts/up/popup_spec.js.coffee +2 -1
- data/spec_app/spec/javascripts/up/proxy_spec.js.coffee +8 -0
- data/spec_app/spec/javascripts/up/util_spec.js.coffee +14 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f41bd14a88026cca1b4d98253d557b3c7f03eb9a92a079b5892dcf81c16f703
|
4
|
+
data.tar.gz: 1e81428e2a3ee05a77b82792f3835f55891a0b845e4fe0b05e0fafb9b3a19291
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 653e3343531c9254fc318dbd951d1bd5fa7a4a0f997e627f7d3dc8350a64c4471879d8ab458f9cb90abf67b466e9590b674b143a7cc331780d4663ee8ff792a6
|
7
|
+
data.tar.gz: 30bfba350545b36fa5201b9072bea60fe61883e86c352c21ec3d4ef6f432b7b4413bcebedf4046e50dd8731fa46e21cb79f7278ec2d51bb26d72ef579ae2aa95
|
data/CHANGELOG.md
CHANGED
@@ -5,11 +5,66 @@ Changes to this project will be documented in this file.
|
|
5
5
|
|
6
6
|
You may browse a formatted and hyperlinked version of this file at <https://unpoly.com/changes>.
|
7
7
|
|
8
|
+
1.0.1
|
9
|
+
-----
|
10
|
+
|
11
|
+
This is a maintenance release for Unpoly 1. Expect little to no additional changes for this legacy version. New features will only be added to Unpoly 2.
|
12
|
+
|
13
|
+
- `up.request()` will now send Unpoly's version number as an `X-Up-Version` request header. Since `X-Up-Target` is optional in Unpoly 2, server-side integration libraries can look for `X-Up-Version` to reliably detect a fragment update for both Unpoly 1 and 2.
|
14
|
+
- Fix a bug where the Unpoly banner would still be printed to the development console when `up.log.config.banner = false` is set. (fix by @adam12)
|
15
|
+
|
16
|
+
|
17
|
+
1.0.0
|
18
|
+
-----
|
19
|
+
|
20
|
+
For six years Unpoly has been released under a 0.x version number. To establish the maturity and stability of the project, we're releasing today's version as 1.0.0.
|
21
|
+
|
22
|
+
There are only three changes from 0.62.1:
|
23
|
+
|
24
|
+
- Fix a bug where `up.util.escapeHTML()` would not escape single quotes.
|
25
|
+
- Unpoly will no longer wait a JavaScript execution task to boot after `DOMContentLoaded`. This may improve the stability of test suites that previously interacted with the page too soon.
|
26
|
+
- You may now disable the Unpoly banner in the development console with `up.log.config.banner = false`. (change by @hfjallemark).
|
27
|
+
|
28
|
+
This is the last release of the 0.x API line. We're tracking its code in the [`1.x-stable`](https://github.com/unpoly/unpoly/tree/1.x-stable), but expect little to no changes in the future.
|
29
|
+
|
30
|
+
The next release will be [Unpoly 2](https://triskweline.de/unpoly2-slides). It will include major (but mostly backwards compatible) renovations to its API, unlocking many use cases that were not possible with Unpoly 1.
|
31
|
+
|
32
|
+
|
33
|
+
0.62.1
|
34
|
+
------
|
35
|
+
|
36
|
+
This is another maintenance release while we're finishing [the next major version of Unpoly](https://groups.google.com/forum/#!topic/unpoly/FDdVjxbjNLg).
|
37
|
+
|
38
|
+
Community members were involved in every change of this release:
|
39
|
+
|
40
|
+
- [`up.submit()`](/up.submit) has a new options `{ params }`. It may be used to pass extra form [parameters](/up.Params) that will be submitted in addition to the parameters from the form. (fix by @robinvdvleuten)
|
41
|
+
- [`a[up-modal]`](/a-up-modal) will now honor an [`[up-cache]`](/a-up-target#up-cache) attribute on the same link. (fix by @adam12)
|
42
|
+
- Prevent destructor function from being called twice if [`up.destroy()`](/up.destroy) is called twice with the same element (reported by @kratob)
|
43
|
+
- On devices that don't show a vertical scrollbar, users can no longer scroll the underlying page while a [modal overlay](/up.modal) is open. (reported by @msurdi)
|
44
|
+
|
45
|
+
|
46
|
+
0.62.0
|
47
|
+
------
|
48
|
+
|
49
|
+
This release backports a number of accessibility improvements from [the next major version of Unpoly](https://groups.google.com/forum/#!topic/unpoly/FDdVjxbjNLg).
|
50
|
+
We encourage everyone to upgrade to this release in order to better support users with visual impairments.
|
51
|
+
|
52
|
+
The following changes are included:
|
53
|
+
|
54
|
+
- Links with an [`[up-instant]`](/a-up-instant) attribute can now be followed with the keyboard.
|
55
|
+
- Fragments that are being [destroyed](/up.destroy) now get an [`[aria-hidden=true]`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-hidden_attribute)
|
56
|
+
attribute while its disappearance is being animated. When a fragment is being swapped with a new version, the old fragment version is also
|
57
|
+
given `[aria-hidden=true]` while it's disappearing.
|
58
|
+
- [Modal dialogs](/up.modal) now get an [`[aria-modal=true]`](https://a11ysupport.io/tech/aria/aria-modal_attribute) attribute.
|
59
|
+
|
60
|
+
The next major version of Unpoly will include additional accessibility improvements. In particular the
|
61
|
+
new modal ("layer") implementation will implement all best practices for accessible dialogs.
|
62
|
+
|
8
63
|
|
9
64
|
0.61.1
|
10
65
|
------
|
11
66
|
|
12
|
-
This is a maintenance release while we're getting ready for the next major version of Unpoly.
|
67
|
+
This is a maintenance release while we're getting ready for [the next major version of Unpoly](https://groups.google.com/forum/#!topic/unpoly/FDdVjxbjNLg).
|
13
68
|
|
14
69
|
- Fix a bug where [`up.destroy()`](/up.destroy) wouldn't clean up the global jQuery cache. This is only relevant when using Unpoly together with jQuery.
|
15
70
|
- Fields outside a <form> are now recognized when they have a matching [form] attribute (fixes #85)
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -8,11 +8,9 @@ GEM
|
|
8
8
|
execjs (2.7.0)
|
9
9
|
hike (1.2.3)
|
10
10
|
json (1.8.2)
|
11
|
-
libv8 (3.16.14.11)
|
12
11
|
multi_json (1.10.1)
|
13
12
|
rack (1.6.0)
|
14
13
|
rake (10.4.2)
|
15
|
-
ref (1.0.5)
|
16
14
|
sass (3.4.11)
|
17
15
|
sprockets (2.12.3)
|
18
16
|
hike (~> 1.2)
|
@@ -22,9 +20,6 @@ GEM
|
|
22
20
|
sprockets-standalone (1.2.1)
|
23
21
|
rake
|
24
22
|
sprockets (~> 2.0)
|
25
|
-
therubyracer (0.12.1)
|
26
|
-
libv8 (~> 3.16.14.0)
|
27
|
-
ref
|
28
23
|
tilt (1.4.1)
|
29
24
|
uglifier (2.7.0)
|
30
25
|
execjs (>= 0.3.0)
|
@@ -38,8 +33,7 @@ DEPENDENCIES
|
|
38
33
|
rack
|
39
34
|
sass
|
40
35
|
sprockets-standalone
|
41
|
-
therubyracer
|
42
36
|
uglifier
|
43
37
|
|
44
38
|
BUNDLED WITH
|
45
|
-
1.
|
39
|
+
1.17.3
|
data/README.md
CHANGED
@@ -31,8 +31,9 @@ Overview:
|
|
31
31
|
|
32
32
|
Install dependencies for tests:
|
33
33
|
|
34
|
-
- Install Ruby 2.
|
34
|
+
- Install Ruby 2.3.8
|
35
35
|
- Install Bundler by running `gem install bundler`
|
36
|
+
- Install Node.js (required for building the library)
|
36
37
|
- `cd` into `spec_app`
|
37
38
|
- Install dependencies by running `bundle install`
|
38
39
|
|
@@ -50,11 +51,9 @@ To run RSpec tests for the `unpoly-rails` gem:
|
|
50
51
|
|
51
52
|
### Making a new release
|
52
53
|
|
53
|
-
We are currently feeding
|
54
|
+
We are currently feeding the following release channels:
|
54
55
|
|
55
|
-
- Manual download from GitHub
|
56
56
|
- npm
|
57
|
-
- Bower (which is based on Git and version tags)
|
58
57
|
- Rubygems (as the `unpoly-rails` gem)
|
59
58
|
|
60
59
|
We always release to all channel simultaneously.
|
@@ -64,6 +63,7 @@ To prepare a new version:
|
|
64
63
|
1. Edit `lib/unpoly/rails/version.rb` and bump the version number. Use [semantic versioning](http://semver.org/).
|
65
64
|
2. Add an entry to `CHANGELOG.md`
|
66
65
|
3. Commit and push the version bump and `CHANGELOG.md`
|
66
|
+
4. Merge the relevant `CHANGEOG.md` entries to the `master` branch (since [unpoly.com](https://unpoly.com) builds from there)
|
67
67
|
|
68
68
|
Now we can release a new version. **This requires your to be logged into Rubygems and npm**:
|
69
69
|
|
@@ -78,8 +78,9 @@ If you have done this process a few times and know what you're doing, you can ca
|
|
78
78
|
|
79
79
|
After you have published all release channels, remember to:
|
80
80
|
|
81
|
-
1.
|
82
|
-
2.
|
81
|
+
1. Deploy to [unpoly.com](https://unpoly.com/)
|
82
|
+
2. Deploy to [v1.unpoly.com](https://unpoly.com/)
|
83
|
+
3. Send a message to the [E-mail group](https://groups.google.com/group/unpoly) with the title "Unpoly X.Y.Z released". You can copy the relevant CHANGELOG part from [here](http://localhost:4567/changes_google_groups).
|
83
84
|
|
84
85
|
|
85
86
|
Credits
|
data/Rakefile
CHANGED
@@ -99,7 +99,7 @@ namespace :publish do
|
|
99
99
|
|
100
100
|
desc 'Release new version to all package managers'
|
101
101
|
task :release do
|
102
|
-
Rake::Task['
|
102
|
+
Rake::Task['rubygems:publish'].invoke
|
103
103
|
Rake::Task['npm:publish'].invoke
|
104
104
|
end
|
105
105
|
|
@@ -117,6 +117,15 @@ namespace :publish do
|
|
117
117
|
|
118
118
|
end
|
119
119
|
|
120
|
+
namespace :rubygems do
|
121
|
+
|
122
|
+
task :publish do
|
123
|
+
puts 'Publishing to rubygems.org. If this seems to hang, enter your 2FA token.'
|
124
|
+
Rake::Task['release'].invoke
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
|
120
129
|
namespace :npm do
|
121
130
|
|
122
131
|
task :bump_version do
|
data/dist/unpoly.js
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
(function() {
|
7
7
|
window.up = {
|
8
|
-
version: "0.
|
8
|
+
version: "1.0.1"
|
9
9
|
};
|
10
10
|
|
11
11
|
}).call(this);
|
@@ -1305,7 +1305,8 @@ to not include another library in your asset bundle.
|
|
1305
1305
|
"&": "&",
|
1306
1306
|
"<": "<",
|
1307
1307
|
">": ">",
|
1308
|
-
'"': '"'
|
1308
|
+
'"': '"',
|
1309
|
+
"'": '''
|
1309
1310
|
};
|
1310
1311
|
|
1311
1312
|
/***
|
@@ -1317,7 +1318,7 @@ to not include another library in your asset bundle.
|
|
1317
1318
|
@stable
|
1318
1319
|
*/
|
1319
1320
|
escapeHtml = function(string) {
|
1320
|
-
return string.replace(/[&<>"]/g, function(char) {
|
1321
|
+
return string.replace(/[&<>"']/g, function(char) {
|
1321
1322
|
return ESCAPE_HTML_ENTITY_MAP[char];
|
1322
1323
|
});
|
1323
1324
|
};
|
@@ -2519,6 +2520,7 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
2519
2520
|
[this WHATWG mailing list post](http://lists.w3.org/Archives/Public/public-whatwg-archive/2014Apr/0094.html).
|
2520
2521
|
|
2521
2522
|
@function up.element.show
|
2523
|
+
@param {Element} element
|
2522
2524
|
@experimental
|
2523
2525
|
*/
|
2524
2526
|
show = function(element) {
|
@@ -2557,8 +2559,10 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
2557
2559
|
@param {Element} element
|
2558
2560
|
The element for which to add or remove the class.
|
2559
2561
|
@param {String} className
|
2560
|
-
|
2561
|
-
@param {
|
2562
|
+
The class which should be added or removed.
|
2563
|
+
@param {Boolean} [newPresent]
|
2564
|
+
Pass `true` to add the class to the element or `false` to remove it.
|
2565
|
+
|
2562
2566
|
If omitted, the class will be added if missing and removed if present.
|
2563
2567
|
@experimental
|
2564
2568
|
*/
|
@@ -2771,11 +2775,11 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
2771
2775
|
element.className // returns 'klass'
|
2772
2776
|
|
2773
2777
|
@function up.element.affix
|
2774
|
-
@
|
2778
|
+
@param {Element} parent
|
2775
2779
|
The parent to which to attach the created element.
|
2776
|
-
@
|
2780
|
+
@param {string} selector
|
2777
2781
|
The CSS selector from which to create an element.
|
2778
|
-
@
|
2782
|
+
@param {Object} attrs
|
2779
2783
|
An object of attributes to set on the created element.
|
2780
2784
|
@param {Object} attrs.text
|
2781
2785
|
The [text content](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent) of the created element.
|
@@ -3428,32 +3432,32 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
3428
3432
|
}
|
3429
3433
|
|
3430
3434
|
BodyShifter.prototype.shift = function() {
|
3431
|
-
var anchor, body, bodyRightPadding, bodyRightShift, elementRight, elementRightShift, i, len, overflowElement, ref, results, scrollbarWidth;
|
3432
|
-
|
3433
|
-
return;
|
3434
|
-
}
|
3435
|
-
body = document.body;
|
3435
|
+
var anchor, body, bodyRightPadding, bodyRightShift, elementRight, elementRightShift, i, len, overflowElement, ref, results, rootHadVerticalScrollbar, scrollbarWidth;
|
3436
|
+
rootHadVerticalScrollbar = up.viewport.rootHasVerticalScrollbar();
|
3436
3437
|
overflowElement = up.viewport.rootOverflowElement();
|
3437
|
-
scrollbarWidth = up.viewport.scrollbarWidth();
|
3438
|
-
bodyRightPadding = e.styleNumber(body, 'paddingRight');
|
3439
|
-
bodyRightShift = scrollbarWidth + bodyRightPadding;
|
3440
|
-
this.unshiftFns.push(e.setTemporaryStyle(body, {
|
3441
|
-
paddingRight: bodyRightShift
|
3442
|
-
}));
|
3443
3438
|
this.unshiftFns.push(e.setTemporaryStyle(overflowElement, {
|
3444
3439
|
overflowY: 'hidden'
|
3445
3440
|
}));
|
3446
|
-
|
3447
|
-
|
3448
|
-
|
3449
|
-
|
3450
|
-
|
3451
|
-
|
3452
|
-
|
3453
|
-
|
3454
|
-
|
3441
|
+
if (rootHadVerticalScrollbar) {
|
3442
|
+
body = document.body;
|
3443
|
+
scrollbarWidth = up.viewport.scrollbarWidth();
|
3444
|
+
bodyRightPadding = e.styleNumber(body, 'paddingRight');
|
3445
|
+
bodyRightShift = scrollbarWidth + bodyRightPadding;
|
3446
|
+
this.unshiftFns.push(e.setTemporaryStyle(body, {
|
3447
|
+
paddingRight: bodyRightShift
|
3448
|
+
}));
|
3449
|
+
ref = up.viewport.anchoredRight();
|
3450
|
+
results = [];
|
3451
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
3452
|
+
anchor = ref[i];
|
3453
|
+
elementRight = e.styleNumber(anchor, 'right');
|
3454
|
+
elementRightShift = scrollbarWidth + elementRight;
|
3455
|
+
results.push(this.unshiftFns.push(e.setTemporaryStyle(anchor, {
|
3456
|
+
right: elementRightShift
|
3457
|
+
})));
|
3458
|
+
}
|
3459
|
+
return results;
|
3455
3460
|
}
|
3456
|
-
return results;
|
3457
3461
|
};
|
3458
3462
|
|
3459
3463
|
BodyShifter.prototype.unshift = function() {
|
@@ -4692,8 +4696,9 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
4692
4696
|
|
4693
4697
|
FollowVariant.prototype.onClick = function(event, link) {
|
4694
4698
|
if (up.link.shouldProcessEvent(event, link)) {
|
4695
|
-
if (e.matches(link, '[up-instant]')) {
|
4696
|
-
|
4699
|
+
if (e.matches(link, '[up-instant]') && link.upInstantSupported) {
|
4700
|
+
up.event.halt(event);
|
4701
|
+
link.upInstantSupported = false;
|
4697
4702
|
} else {
|
4698
4703
|
up.event.consumeAction(event);
|
4699
4704
|
return this.followLink(link);
|
@@ -4705,6 +4710,7 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
4705
4710
|
|
4706
4711
|
FollowVariant.prototype.onMousedown = function(event, link) {
|
4707
4712
|
if (up.link.shouldProcessEvent(event, link)) {
|
4713
|
+
link.upInstantSupported = true;
|
4708
4714
|
up.event.consumeAction(event);
|
4709
4715
|
return this.followLink(link);
|
4710
4716
|
}
|
@@ -5356,18 +5362,19 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
5356
5362
|
if (u.isMissing(raw)) {
|
5357
5363
|
|
5358
5364
|
} else if (raw instanceof this.constructor) {
|
5359
|
-
|
5365
|
+
(ref = this.entries).push.apply(ref, raw.entries);
|
5360
5366
|
} else if (u.isArray(raw)) {
|
5361
|
-
|
5367
|
+
(ref1 = this.entries).push.apply(ref1, raw);
|
5362
5368
|
} else if (u.isString(raw)) {
|
5363
|
-
|
5369
|
+
this.addAllFromQuery(raw);
|
5364
5370
|
} else if (u.isFormData(raw)) {
|
5365
|
-
|
5371
|
+
this.addAllFromFormData(raw);
|
5366
5372
|
} else if (u.isObject(raw)) {
|
5367
|
-
|
5373
|
+
this.addAllFromObject(raw);
|
5368
5374
|
} else {
|
5369
|
-
|
5375
|
+
up.fail("Unsupport params type: %o", raw);
|
5370
5376
|
}
|
5377
|
+
return this;
|
5371
5378
|
};
|
5372
5379
|
|
5373
5380
|
Params.prototype.addAllFromObject = function(object) {
|
@@ -5965,6 +5972,7 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
5965
5972
|
xhrPayload = xhrParams.toFormData();
|
5966
5973
|
}
|
5967
5974
|
pc = up.protocol.config;
|
5975
|
+
xhrHeaders[pc.versionHeader] = up.version;
|
5968
5976
|
if (_this.target) {
|
5969
5977
|
xhrHeaders[pc.targetHeader] = _this.target;
|
5970
5978
|
}
|
@@ -6827,13 +6835,11 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
6827
6835
|
});
|
6828
6836
|
isBooting = false;
|
6829
6837
|
return up.event.onReady(function() {
|
6830
|
-
|
6831
|
-
|
6832
|
-
|
6833
|
-
|
6834
|
-
|
6835
|
-
log: 'User application booted'
|
6836
|
-
});
|
6838
|
+
up.emit('up:app:boot', {
|
6839
|
+
log: 'Booting user application'
|
6840
|
+
});
|
6841
|
+
return up.emit('up:app:booted', {
|
6842
|
+
log: 'User application booted'
|
6837
6843
|
});
|
6838
6844
|
});
|
6839
6845
|
} else {
|
@@ -6960,7 +6966,7 @@ There are some advantages to using `up.on()`:
|
|
6960
6966
|
for [event delegation](https://davidwalsh.name/event-delegate):
|
6961
6967
|
|
6962
6968
|
var form = document.querySelector('form')
|
6963
|
-
|
6969
|
+
up.on(form, 'click', 'a', function(event, link) {
|
6964
6970
|
console.log("Click on a link %o within %o", link, form)
|
6965
6971
|
})
|
6966
6972
|
|
@@ -7572,6 +7578,7 @@ an existing cookie should be deleted.
|
|
7572
7578
|
Configures strings used in the optional [server protocol](/up.protocol).
|
7573
7579
|
|
7574
7580
|
@property up.protocol.config
|
7581
|
+
@param {String} [config.versionHeader='X-Up-Version']
|
7575
7582
|
@param {String} [config.targetHeader='X-Up-Target']
|
7576
7583
|
@param {String} [config.failTargetHeader='X-Up-Fail-Target']
|
7577
7584
|
@param {String} [config.locationHeader='X-Up-Location']
|
@@ -7615,6 +7622,7 @@ an existing cookie should be deleted.
|
|
7615
7622
|
@experimental
|
7616
7623
|
*/
|
7617
7624
|
config = new up.Config({
|
7625
|
+
versionHeader: 'X-Up-Version',
|
7618
7626
|
targetHeader: 'X-Up-Target',
|
7619
7627
|
failTargetHeader: 'X-Up-Fail-Target',
|
7620
7628
|
locationHeader: 'X-Up-Location',
|
@@ -7697,12 +7705,15 @@ The output can be configured using the [`up.log.config`](/up.log.config) propert
|
|
7697
7705
|
prints to the developer console.
|
7698
7706
|
@param {string} [options.prefix='[UP] ']
|
7699
7707
|
A string to prepend to Unpoly's logging messages so you can distinguish it from your own messages.
|
7708
|
+
@param {boolean} [options.banner=true]
|
7709
|
+
Print the Unpoly banner to the developer console.
|
7700
7710
|
@stable
|
7701
7711
|
*/
|
7702
7712
|
config = new up.Config({
|
7703
7713
|
prefix: '[UP] ',
|
7704
7714
|
enabled: sessionStore.get('enabled'),
|
7705
|
-
collapse: false
|
7715
|
+
collapse: false,
|
7716
|
+
banner: true
|
7706
7717
|
});
|
7707
7718
|
reset = function() {
|
7708
7719
|
return config.reset();
|
@@ -7888,6 +7899,9 @@ The output can be configured using the [`up.log.config`](/up.log.config) propert
|
|
7888
7899
|
};
|
7889
7900
|
printBanner = function() {
|
7890
7901
|
var banner;
|
7902
|
+
if (!config.banner) {
|
7903
|
+
return;
|
7904
|
+
}
|
7891
7905
|
banner = " __ _____ ___ ___ / /_ __\n" + ("/ // / _ \\/ _ \\/ _ \\/ / // / " + up.version + "\n") + "\\___/_//_/ .__/\\___/_/\\_. / \n" + " / / / /\n" + "\n";
|
7892
7906
|
if (config.enabled) {
|
7893
7907
|
banner += "Call `up.log.disable()` to disable logging for this session.";
|
@@ -7896,7 +7910,7 @@ The output can be configured using the [`up.log.config`](/up.log.config) propert
|
|
7896
7910
|
}
|
7897
7911
|
return console.log(banner);
|
7898
7912
|
};
|
7899
|
-
up.on('up:
|
7913
|
+
up.on('up:app:boot', printBanner);
|
7900
7914
|
up.on('up:framework:reset', reset);
|
7901
7915
|
setEnabled = function(value) {
|
7902
7916
|
sessionStore.set('enabled', value);
|
@@ -8430,15 +8444,14 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
|
|
8430
8444
|
var cleanables;
|
8431
8445
|
cleanables = e.subtree(fragment, '.up-can-clean');
|
8432
8446
|
return u.each(cleanables, function(cleanable) {
|
8433
|
-
var destructor, destructors, i, len
|
8434
|
-
if (destructors = cleanable
|
8435
|
-
results = [];
|
8447
|
+
var destructor, destructors, i, len;
|
8448
|
+
if (destructors = u.pluckKey(cleanable, 'upDestructors')) {
|
8436
8449
|
for (i = 0, len = destructors.length; i < len; i++) {
|
8437
8450
|
destructor = destructors[i];
|
8438
|
-
|
8451
|
+
destructor();
|
8439
8452
|
}
|
8440
|
-
return results;
|
8441
8453
|
}
|
8454
|
+
return cleanable.classList.remove('up-can-clean');
|
8442
8455
|
});
|
8443
8456
|
};
|
8444
8457
|
|
@@ -10638,7 +10651,8 @@ is built from `up.fragment` functions. You may use them to extend Unpoly from yo
|
|
10638
10651
|
@stable
|
10639
10652
|
*/
|
10640
10653
|
markElementAsDestroying = function(element) {
|
10641
|
-
|
10654
|
+
element.classList.add('up-destroying');
|
10655
|
+
return element.setAttribute('aria-hidden', 'true');
|
10642
10656
|
};
|
10643
10657
|
|
10644
10658
|
/***
|
@@ -10834,7 +10848,7 @@ You can define custom animations using [`up.transition()`](/up.transition) and
|
|
10834
10848
|
|
10835
10849
|
You can pass additional options:
|
10836
10850
|
|
10837
|
-
up.animate('warning', '
|
10851
|
+
up.animate('.warning', 'fade-in', {
|
10838
10852
|
delay: 1000,
|
10839
10853
|
duration: 250,
|
10840
10854
|
easing: 'linear'
|
@@ -13051,6 +13065,9 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
13051
13065
|
If set to `'auto'` (default), Unpoly will try to find a match in the form's layer.
|
13052
13066
|
@param {string} [options.failLayer='auto']
|
13053
13067
|
The name of the layer that ought to be updated if the server sends a non-200 status code.
|
13068
|
+
@param {Object|FormData|string|Array|up.Params} [options.params]
|
13069
|
+
Extra form [parameters](/up.Params) that will be submitted in addition to
|
13070
|
+
the parameters from the form.
|
13054
13071
|
@return {Promise}
|
13055
13072
|
A promise for the successful form submission.
|
13056
13073
|
@stable
|
@@ -13100,7 +13117,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
13100
13117
|
if (options.failLayer == null) {
|
13101
13118
|
options.failLayer = form.getAttribute('up-fail-layer');
|
13102
13119
|
}
|
13103
|
-
options.params = up.Params.fromForm(form);
|
13120
|
+
options.params = up.Params.fromForm(form).addAll(options.params);
|
13104
13121
|
options = u.merge(options, up.motion.animateOptions(options, form));
|
13105
13122
|
if (options.validate) {
|
13106
13123
|
options.headers || (options.headers = {});
|
@@ -13822,6 +13839,15 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
13822
13839
|
|
13823
13840
|
<input name="query" up-observe="showSuggestions(value)">
|
13824
13841
|
|
13842
|
+
Note that the parameter name in the markup must be called `value` or it will not work.
|
13843
|
+
The parameter name can be called whatever you want in the JavaScript, however.
|
13844
|
+
|
13845
|
+
Also note that the function must be declared on the `window` object to work, like so:
|
13846
|
+
|
13847
|
+
window.showSuggestions = function(selectedValue) {
|
13848
|
+
console.log(`Called showSuggestions() with ${selectedValue}`);
|
13849
|
+
}
|
13850
|
+
|
13825
13851
|
\#\#\# Callback context
|
13826
13852
|
|
13827
13853
|
The script given to `[up-observe]` runs with the following context:
|
@@ -14807,6 +14833,7 @@ or function.
|
|
14807
14833
|
var closeElement, contentElement, dialogStyles, html, modalElement;
|
14808
14834
|
html = templateHtml();
|
14809
14835
|
state.modalElement = modalElement = e.createFromHtml(html);
|
14836
|
+
modalElement.setAttribute('aria-modal', 'true');
|
14810
14837
|
modalElement.setAttribute('up-flavor', state.flavor);
|
14811
14838
|
if (u.isPresent(state.position)) {
|
14812
14839
|
modalElement.setAttribute('up-position', state.position);
|
@@ -15028,6 +15055,9 @@ or function.
|
|
15028
15055
|
if (options.failLayer == null) {
|
15029
15056
|
options.failLayer = (ref12 = link.getAttribute('up-fail-layer')) != null ? ref12 : 'auto';
|
15030
15057
|
}
|
15058
|
+
if (options.cache == null) {
|
15059
|
+
options.cache = e.booleanAttr(link, 'up-cache');
|
15060
|
+
}
|
15031
15061
|
animateOptions = up.motion.animateOptions(options, link, {
|
15032
15062
|
duration: flavorDefault('openDuration', options.flavor),
|
15033
15063
|
easing: flavorDefault('openEasing', options.flavor)
|