unpoly-rails 2.0.0.pre.rc9 → 2.0.0.pre.rc10
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 +2 -3
- data/dist/unpoly.js +210 -107
- data/dist/unpoly.min.js +6 -6
- data/lib/unpoly/rails/engine.rb +22 -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: 7bd5baa3c26dc137e7944861528cbacbd458d842c20ed3864e07840161a62662
|
4
|
+
data.tar.gz: cbcf34505f475b8cbd062ab16081f49b98d904c027d0dfbd7c2a50c1871e0a09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f679fc7972c6149277d204609026039daa94a4f802dfc5fbb2ec5f4926c926b2f9befa524a3e6b5fc7c1c8b63388733a230b0e7059eea172dc9b5afeea2add21
|
7
|
+
data.tar.gz: 122e0706cee0950c164dc5bf6aefc693edffa0e40218ae95037a13dacb7a1f911a9a5c04871c2e05b739a1cc47c958598ae384ed57a75bffad3c05124f872252
|
data/README.md
CHANGED
@@ -35,6 +35,7 @@ Install dependencies for tests:
|
|
35
35
|
|
36
36
|
- Install Ruby 2.3.8
|
37
37
|
- Install Bundler by running `gem install bundler`
|
38
|
+
- Install Node.js (required for building the library)
|
38
39
|
- `cd` into `spec_app`
|
39
40
|
- Install dependencies by running `bundle install`
|
40
41
|
|
@@ -52,11 +53,9 @@ To run RSpec tests for the `unpoly-rails` gem:
|
|
52
53
|
|
53
54
|
### Making a new release
|
54
55
|
|
55
|
-
We are currently feeding
|
56
|
+
We are currently feeding two release channels:
|
56
57
|
|
57
|
-
- Manual download from GitHub
|
58
58
|
- npm
|
59
|
-
- Bower (which is based on Git and version tags)
|
60
59
|
- Rubygems (as the `unpoly-rails` gem)
|
61
60
|
|
62
61
|
We always release to all channel simultaneously.
|
data/dist/unpoly.js
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
(function() {
|
7
7
|
window.up = {
|
8
|
-
version: "2.0.0-
|
8
|
+
version: "2.0.0-rc10"
|
9
9
|
};
|
10
10
|
|
11
11
|
}).call(this);
|
@@ -2239,7 +2239,7 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
2239
2239
|
var slice = [].slice;
|
2240
2240
|
|
2241
2241
|
up.element = (function() {
|
2242
|
-
var CSS_LENGTH_PROPS, MATCH_FN_NAME, SINGLETON_PATTERN, SINGLETON_TAG_NAMES, affix, all, ancestor, around, attributeSelector, booleanAttr, booleanOrStringAttr, callbackAttr, closest, closestAttr, computedStyle, computedStyleNumber, concludeCSSTransition, createDocumentFromHTML, createFromHTML, createFromSelector, cssLength, elementTagName, extractFromStyleObject, first, fixedToAbsolute, getList, getOne, getRoot, hasCSSTransition, hide, idSelector, inlineStyle, insertBefore, isDetached, isInSubtree, isSingleton, isSingletonSelector, isVisible, jsonAttr, matches, metaContent, normalizeStyleValueForWrite, numberAttr, paint, remove, replace, setAttrs, setInlineStyle, setMissingAttr, setMissingAttrs, setTemporaryAttrs, setTemporaryStyle, show, stringAttr, subtree, toSelector, toggle, toggleAttr, toggleClass, trueAttributeSelector, u, unwrap, upAttrs, valueToList, wrapChildren;
|
2242
|
+
var CSS_LENGTH_PROPS, MATCH_FN_NAME, SINGLETON_PATTERN, SINGLETON_TAG_NAMES, affix, all, ancestor, around, attributeSelector, booleanAttr, booleanOrStringAttr, callbackAttr, classSelector, closest, closestAttr, computedStyle, computedStyleNumber, concludeCSSTransition, createDocumentFromHTML, createFromHTML, createFromSelector, cssLength, elementTagName, extractFromStyleObject, first, fixedToAbsolute, getList, getOne, getRoot, hasCSSTransition, hide, idSelector, inlineStyle, insertBefore, isDetached, isInSubtree, isSingleton, isSingletonSelector, isVisible, jsonAttr, matches, metaContent, normalizeStyleValueForWrite, numberAttr, paint, remove, replace, setAttrs, setInlineStyle, setMissingAttr, setMissingAttrs, setTemporaryAttrs, setTemporaryStyle, show, stringAttr, subtree, toSelector, toggle, toggleAttr, toggleClass, trueAttributeSelector, u, unwrap, upAttrs, valueToList, wrapChildren;
|
2243
2243
|
u = up.util;
|
2244
2244
|
MATCH_FN_NAME = up.browser.isIE11() ? 'msMatchesSelector' : 'matches';
|
2245
2245
|
|
@@ -2521,12 +2521,8 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
2521
2521
|
[this WHATWG mailing list post](http://lists.w3.org/Archives/Public/public-whatwg-archive/2014Apr/0094.html).
|
2522
2522
|
|
2523
2523
|
@function up.element.show
|
2524
|
-
<<<<<<< HEAD:lib/assets/javascripts/unpoly/element.coffee
|
2525
|
-
@stable
|
2526
|
-
=======
|
2527
2524
|
@param {Element} element
|
2528
|
-
@
|
2529
|
-
>>>>>>> 0d20e224... Adjust docs:lib/assets/javascripts/unpoly/element.coffee.erb
|
2525
|
+
@stable
|
2530
2526
|
*/
|
2531
2527
|
show = function(element) {
|
2532
2528
|
return element.style.display = '';
|
@@ -2916,6 +2912,15 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
2916
2912
|
}
|
2917
2913
|
};
|
2918
2914
|
|
2915
|
+
/***
|
2916
|
+
@function up.element.classSelector
|
2917
|
+
@internal
|
2918
|
+
*/
|
2919
|
+
classSelector = function(klass) {
|
2920
|
+
klass = klass.replace(/:/g, '\\:');
|
2921
|
+
return "." + klass;
|
2922
|
+
};
|
2923
|
+
|
2919
2924
|
/***
|
2920
2925
|
Always creates a full document with a <html> root, even if the given `html`
|
2921
2926
|
is only a fragment.
|
@@ -3449,6 +3454,7 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
3449
3454
|
affix: affix,
|
3450
3455
|
toSelector: toSelector,
|
3451
3456
|
idSelector: idSelector,
|
3457
|
+
classSelector: classSelector,
|
3452
3458
|
isSingleton: isSingleton,
|
3453
3459
|
isSingletonSelector: isSingletonSelector,
|
3454
3460
|
attributeSelector: attributeSelector,
|
@@ -6266,66 +6272,45 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
6266
6272
|
|
6267
6273
|
|
6268
6274
|
/***
|
6269
|
-
|
6270
|
-
|
6271
|
-
Available layer modes are:
|
6275
|
+
Whether fragment updates within this layer can affect browser history and window title.
|
6272
6276
|
|
6273
|
-
|
6274
|
-
- `'modal'`
|
6275
|
-
- `'popup'`
|
6276
|
-
- `'drawer'`
|
6277
|
-
- `'cover'`
|
6277
|
+
If a layer does not have visible history, its desendant layers cannot have history either.
|
6278
6278
|
|
6279
|
-
@property up.Layer#
|
6280
|
-
@param {
|
6281
|
-
@stable
|
6279
|
+
@property up.Layer#historyVisible
|
6280
|
+
@param {boolean} historyVisible
|
6282
6281
|
*/
|
6283
6282
|
|
6284
6283
|
|
6285
6284
|
/***
|
6286
|
-
|
6285
|
+
This layer's mode which governs its appearance and behavior.
|
6287
6286
|
|
6288
|
-
@
|
6289
|
-
|
6287
|
+
@see layer-terminology
|
6288
|
+
|
6289
|
+
@property up.Layer#mode
|
6290
|
+
@param {string} mode
|
6291
|
+
@stable
|
6290
6292
|
*/
|
6291
6293
|
|
6292
6294
|
|
6293
6295
|
/***
|
6294
|
-
This layer's context
|
6295
|
-
|
6296
|
-
Think of *context* as [session storage](/https://makandracards.com/makandra/32865), but specific to a [layer](/up.layer)
|
6297
|
-
rather than specific to an entire browser tab.
|
6298
|
-
|
6299
|
-
You may access the context object's properties like a regular JavaScript object.
|
6296
|
+
This layer's [context](/context).
|
6300
6297
|
|
6301
6298
|
\#\#\# Example
|
6302
6299
|
|
6300
|
+
You may access the context properties like a regular JavaScript object.
|
6301
|
+
|
6303
6302
|
```js
|
6304
6303
|
let layer = up.layer.current
|
6305
6304
|
layer.context.message = 'Please select a contact'
|
6306
6305
|
console.log(layer.context) // logs "{ message: 'Please select a contact' }"
|
6307
6306
|
```
|
6308
6307
|
|
6309
|
-
\#\#\# Accessing the context from the server
|
6310
|
-
|
6311
|
-
The context is is sent as an `X-Up-Context` header along with every
|
6312
|
-
[request](/up.request) to the server. The server may also update the updating
|
6313
|
-
layer's context by including an `X-Up-Context` header in its response.
|
6314
|
-
|
6315
6308
|
@property up.Layer#context
|
6316
6309
|
@param {Object} context
|
6317
|
-
|
6318
|
-
*/
|
6319
|
-
|
6320
|
-
|
6321
|
-
/***
|
6322
|
-
Whether fragment updates within this layer will affect [browser history](/up.history).
|
6323
|
-
|
6324
|
-
If a layer does not have visible history, its desendant layers cannot have history either.
|
6310
|
+
The context object.
|
6325
6311
|
|
6326
|
-
|
6327
|
-
@
|
6328
|
-
@stable
|
6312
|
+
If no context has been set an empty object is returned.
|
6313
|
+
@experimental
|
6329
6314
|
*/
|
6330
6315
|
|
6331
6316
|
Layer.prototype.keys = function() {
|
@@ -9348,6 +9333,23 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
9348
9333
|
*/
|
9349
9334
|
|
9350
9335
|
|
9336
|
+
/***
|
9337
|
+
The [hash component](https://en.wikipedia.org/wiki/URI_fragment) of this request's URL.
|
9338
|
+
|
9339
|
+
The `{ hash }` property is automatically extracted from the given URL:
|
9340
|
+
|
9341
|
+
```js
|
9342
|
+
let request = up.request({ url: '/path#section' })
|
9343
|
+
request.url // => '/path'
|
9344
|
+
request.hash // => '#section'
|
9345
|
+
```
|
9346
|
+
|
9347
|
+
@property up.Request#hash
|
9348
|
+
@param {string} hash
|
9349
|
+
@stable
|
9350
|
+
*/
|
9351
|
+
|
9352
|
+
|
9351
9353
|
/***
|
9352
9354
|
[Parameters](/up.Params) that should be sent as the request's payload.
|
9353
9355
|
|
@@ -9358,7 +9360,9 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
9358
9360
|
|
9359
9361
|
|
9360
9362
|
/***
|
9361
|
-
The CSS selector
|
9363
|
+
The CSS selector targeted by this request.
|
9364
|
+
|
9365
|
+
The selector will be sent as an `X-Up-Target` header.
|
9362
9366
|
|
9363
9367
|
@property up.Request#target
|
9364
9368
|
@param {string} target
|
@@ -9367,7 +9371,10 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
9367
9371
|
|
9368
9372
|
|
9369
9373
|
/***
|
9370
|
-
The CSS selector
|
9374
|
+
The CSS selector targeted by this request in case the server responds
|
9375
|
+
with an [error code](/server-errors).
|
9376
|
+
|
9377
|
+
The selector will be sent as an `X-Up-Fail-Target` header.
|
9371
9378
|
|
9372
9379
|
@property up.Request#failTarget
|
9373
9380
|
@param {string} failTarget
|
@@ -9378,7 +9385,7 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
9378
9385
|
/***
|
9379
9386
|
An object of additional HTTP headers.
|
9380
9387
|
|
9381
|
-
|
9388
|
+
Unpoly will by default send a number of custom request headers.
|
9382
9389
|
See `up.protocol` and `up.network.config.metaKeys` for details.
|
9383
9390
|
|
9384
9391
|
@property up.Request#headers
|
@@ -9414,25 +9421,67 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
9414
9421
|
|
9415
9422
|
|
9416
9423
|
/***
|
9417
|
-
|
9424
|
+
The [context](/contact) of the layer targeted by this request.
|
9425
|
+
|
9426
|
+
The context object will be sent as an `X-Up-Context` header.
|
9418
9427
|
|
9419
9428
|
@property up.Request#context
|
9420
9429
|
@param {Object} context
|
9421
|
-
@
|
9430
|
+
@experimental
|
9422
9431
|
*/
|
9423
9432
|
|
9424
9433
|
|
9425
9434
|
/***
|
9426
|
-
|
9435
|
+
The [context](/contact) of the layer targeted by this request in case the server responds with an [error code](/server-errors).
|
9436
|
+
|
9437
|
+
The context object will be sent as an `X-Up-Fail-Context` header.
|
9427
9438
|
|
9428
9439
|
@property up.Request#failContext
|
9429
9440
|
@param {Object} failContext
|
9430
|
-
@
|
9441
|
+
@experimental
|
9431
9442
|
*/
|
9432
9443
|
|
9433
9444
|
|
9434
9445
|
/***
|
9435
|
-
|
9446
|
+
The [layer](/up.layer) targeted by this request.
|
9447
|
+
|
9448
|
+
To prevent memory leaks, this property is removed shortly after the response is received.
|
9449
|
+
|
9450
|
+
@property up.Request#layer
|
9451
|
+
@param {up.Layer} layer
|
9452
|
+
@experimental
|
9453
|
+
*/
|
9454
|
+
|
9455
|
+
|
9456
|
+
/***
|
9457
|
+
The [layer](/up.layer) targeted by this request in case the server responds with an [error code](/server-errors).
|
9458
|
+
|
9459
|
+
To prevent memory leaks, this property is removed shortly after the response is received.
|
9460
|
+
|
9461
|
+
@property up.Request#failLayer
|
9462
|
+
@param {up.Layer} layer
|
9463
|
+
@experimental
|
9464
|
+
*/
|
9465
|
+
|
9466
|
+
|
9467
|
+
/***
|
9468
|
+
The element that triggered the request.
|
9469
|
+
|
9470
|
+
For example, when this request was triggered by a click on a link, the lonk
|
9471
|
+
element is set as the `{ origin }`.
|
9472
|
+
|
9473
|
+
To prevent memory leaks, this property is removed shortly after the response is received.
|
9474
|
+
|
9475
|
+
@property up.Request#origin
|
9476
|
+
@param {Element} origin
|
9477
|
+
@experimental
|
9478
|
+
*/
|
9479
|
+
|
9480
|
+
|
9481
|
+
/***
|
9482
|
+
The [mode](/up.Layer.prototype.mode) of the layer targeted by this request.
|
9483
|
+
|
9484
|
+
The value will be sent as an `X-Up-Mode` header.
|
9436
9485
|
|
9437
9486
|
@property up.Request#mode
|
9438
9487
|
@param {string} mode
|
@@ -9441,7 +9490,9 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
9441
9490
|
|
9442
9491
|
|
9443
9492
|
/***
|
9444
|
-
|
9493
|
+
The [mode](/up.Layer.prototype.mode) of the layer targeted by this request in case the server responds with an [error code](/server-errors).
|
9494
|
+
|
9495
|
+
The value will be sent as an `X-Up-Fail-Mode` header.
|
9445
9496
|
|
9446
9497
|
@property up.Request#failMode
|
9447
9498
|
@param {string} failMode
|
@@ -9450,7 +9501,7 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
9450
9501
|
|
9451
9502
|
|
9452
9503
|
/***
|
9453
|
-
|
9504
|
+
The format in which the [request params](/up.Layer.prototype.params) will be encoded.
|
9454
9505
|
|
9455
9506
|
@property up.Request#contentType
|
9456
9507
|
@param {string} contentType
|
@@ -9459,13 +9510,22 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
9459
9510
|
|
9460
9511
|
|
9461
9512
|
/***
|
9462
|
-
|
9513
|
+
The payload that the request will encode into its body.
|
9514
|
+
|
9515
|
+
By default Unpoly will build a payload from the given `{ params }` option.
|
9463
9516
|
|
9464
9517
|
@property up.Request#payload
|
9465
9518
|
@param {string} payload
|
9466
9519
|
@stable
|
9467
9520
|
*/
|
9468
9521
|
|
9522
|
+
|
9523
|
+
/***
|
9524
|
+
@property up.Request#preload
|
9525
|
+
@param {boolean} preload
|
9526
|
+
@experimental
|
9527
|
+
*/
|
9528
|
+
|
9469
9529
|
Request.prototype.keys = function() {
|
9470
9530
|
return ['method', 'url', 'hash', 'params', 'target', 'failTarget', 'headers', 'timeout', 'preload', 'cache', 'clearCache', 'layer', 'mode', 'context', 'failLayer', 'failMode', 'failContext', 'origin', 'solo', 'queueTime', 'wrapMethod', 'contentType', 'payload', 'onQueued'];
|
9471
9531
|
};
|
@@ -10299,6 +10359,14 @@ It complements [native `Element` methods](https://www.w3schools.com/jsref/dom_ob
|
|
10299
10359
|
@experimental
|
10300
10360
|
*/
|
10301
10361
|
|
10362
|
+
|
10363
|
+
/***
|
10364
|
+
Changes to the current [context](/context) as [set by the server](/X-Up-Context).
|
10365
|
+
|
10366
|
+
@property up.Response#context
|
10367
|
+
@experimental
|
10368
|
+
*/
|
10369
|
+
|
10302
10370
|
Response.prototype.keys = function() {
|
10303
10371
|
return ['method', 'url', 'text', 'status', 'request', 'xhr', 'target', 'title', 'acceptLayer', 'dismissLayer', 'eventPlans', 'context', 'clearCache', 'headers'];
|
10304
10372
|
};
|
@@ -11688,7 +11756,11 @@ document.addEventListener('up:modal:open', (event) => {
|
|
11688
11756
|
This hyperlink will emit an `user:select` event when clicked:
|
11689
11757
|
|
11690
11758
|
```
|
11691
|
-
<a href='/users/5
|
11759
|
+
<a href='/users/5'
|
11760
|
+
up-emit='user:select'
|
11761
|
+
up-emit-props='{ "id": 5, "firstName": "Alice" }'>
|
11762
|
+
Alice
|
11763
|
+
</a>
|
11692
11764
|
|
11693
11765
|
<script>
|
11694
11766
|
up.on('a', 'user:select', function(event) {
|
@@ -11703,6 +11775,7 @@ document.addEventListener('up:modal:open', (event) => {
|
|
11703
11775
|
The type of the event to be emitted.
|
11704
11776
|
@param [up-emit-props='{}']
|
11705
11777
|
The event properties, serialized as JSON.
|
11778
|
+
@stable
|
11706
11779
|
*/
|
11707
11780
|
executeEmitAttr = function(event, element) {
|
11708
11781
|
var eventProps, eventType, forkedEvent;
|
@@ -11771,7 +11844,7 @@ There are existing implementations for various web frameworks:
|
|
11771
11844
|
- [Roda](https://github.com/adam12/roda-unpoly)
|
11772
11845
|
- [Rack](https://github.com/adam12/rack-unpoly) (Sinatra, Padrino, Hanami, Cuba, ...)
|
11773
11846
|
- [Phoenix](https://elixirforum.com/t/unpoly-a-framework-like-turbolinks/3614/15) (Elixir)
|
11774
|
-
- [PHP](https://github.com/
|
11847
|
+
- [PHP](https://github.com/webstronauts/php-unpoly) (Symfony, Laravel, Stack)
|
11775
11848
|
|
11776
11849
|
@module up.protocol
|
11777
11850
|
*/
|
@@ -12050,7 +12123,7 @@ There are existing implementations for various web frameworks:
|
|
12050
12123
|
};
|
12051
12124
|
|
12052
12125
|
/***
|
12053
|
-
This request header contains the targeted layer's [context](/
|
12126
|
+
This request header contains the targeted layer's [context](/context), serialized as JSON.
|
12054
12127
|
|
12055
12128
|
The user may choose to not send this header by configuring
|
12056
12129
|
`up.network.config.requestMetaKeys`.
|
@@ -12091,11 +12164,11 @@ There are existing implementations for various web frameworks:
|
|
12091
12164
|
the request was in flight will get overridden by the server-provided context.
|
12092
12165
|
|
12093
12166
|
@header X-Up-Context
|
12094
|
-
@
|
12167
|
+
@experimental
|
12095
12168
|
*/
|
12096
12169
|
|
12097
12170
|
/***
|
12098
|
-
This request header contains the [context](/
|
12171
|
+
This request header contains the [context](/context) of the layer
|
12099
12172
|
targeted for a failed fragment update, serialized as JSON.
|
12100
12173
|
|
12101
12174
|
A fragment update is considered *failed* if the server responds with a
|
@@ -12114,7 +12187,7 @@ There are existing implementations for various web frameworks:
|
|
12114
12187
|
```
|
12115
12188
|
|
12116
12189
|
@header X-Up-Fail-Context
|
12117
|
-
@
|
12190
|
+
@experimental
|
12118
12191
|
*/
|
12119
12192
|
|
12120
12193
|
/***
|
@@ -13549,9 +13622,11 @@ In an Unpoly app, every page has an URL.
|
|
13549
13622
|
register = function() {
|
13550
13623
|
window.history.scrollRestoration = 'manual';
|
13551
13624
|
window.addEventListener('popstate', pop);
|
13552
|
-
|
13553
|
-
|
13554
|
-
|
13625
|
+
if (up.protocol.initialRequestMethod() === 'GET') {
|
13626
|
+
return replace(currentLocation(), {
|
13627
|
+
event: false
|
13628
|
+
});
|
13629
|
+
}
|
13555
13630
|
};
|
13556
13631
|
if (typeof jasmine !== "undefined" && jasmine !== null) {
|
13557
13632
|
return register();
|
@@ -13614,31 +13689,33 @@ In an Unpoly app, every page has an URL.
|
|
13614
13689
|
})();
|
13615
13690
|
|
13616
13691
|
}).call(this);
|
13692
|
+
(function() {
|
13693
|
+
var e, u,
|
13694
|
+
slice = [].slice;
|
13617
13695
|
|
13618
|
-
|
13619
|
-
Fragment update API
|
13620
|
-
===================
|
13621
|
-
|
13622
|
-
The `up.fragment` module exposes a high-level Javascript API to [update](/up.replace) or
|
13623
|
-
[destroy](/up.destroy) page fragments.
|
13624
|
-
|
13625
|
-
Fragments are [compiled](/up.compiler) elements that can be updated from a server URL.
|
13626
|
-
They also exist on a layer (page, modal, popup).
|
13696
|
+
u = up.util;
|
13627
13697
|
|
13628
|
-
|
13629
|
-
is built from `up.fragment` functions. You may use them to extend Unpoly from your
|
13630
|
-
[custom Javascript](/up.syntax).
|
13698
|
+
e = up.element;
|
13631
13699
|
|
13632
|
-
@module up.fragment
|
13633
|
-
*/
|
13634
13700
|
|
13635
|
-
|
13636
|
-
|
13701
|
+
/***
|
13702
|
+
Fragment update API
|
13703
|
+
===================
|
13704
|
+
|
13705
|
+
The `up.fragment` module exposes a high-level Javascript API to [update](/up.replace) or
|
13706
|
+
[destroy](/up.destroy) page fragments.
|
13707
|
+
|
13708
|
+
Fragments are [compiled](/up.compiler) elements that can be updated from a server URL.
|
13709
|
+
They also exist on a layer (page, modal, popup).
|
13710
|
+
|
13711
|
+
Most of Unpoly's functionality (like [fragment links](/up.link) or [modals](/up.modal))
|
13712
|
+
is built from `up.fragment` functions. You may use them to extend Unpoly from your
|
13713
|
+
[custom Javascript](/up.syntax).
|
13714
|
+
|
13715
|
+
@module up.fragment
|
13716
|
+
*/
|
13637
13717
|
|
13638
13718
|
up.fragment = (function() {
|
13639
|
-
var CSS_HAS_SUFFIX_PATTERN, closest, config, contains, destroy, e, emitFragmentDestroyed, emitFragmentInserted, emitFragmentKeep, emitFragmentKept, emitFromKeepPlan, expandTargets, failKey, getAll, getDumb, getSmart, getSubtree, hasAutoHistory, hello, isDestroying, isGoodClassForTarget, isNotDestroying, markFragmentAsDestroying, matches, navigate, parseSelector, parseTargetAndOptions, reload, render, renderLocalContent, renderRemoteContent, reset, resolveOriginReference, sourceOf, successKey, timeOf, toTarget, u, visit;
|
13640
|
-
u = up.util;
|
13641
|
-
e = up.element;
|
13642
13719
|
|
13643
13720
|
/***
|
13644
13721
|
Configures defaults for fragment updates.
|
@@ -13712,6 +13789,7 @@ is built from `up.fragment` functions. You may use them to extend Unpoly from yo
|
|
13712
13789
|
|
13713
13790
|
@stable
|
13714
13791
|
*/
|
13792
|
+
var CSS_HAS_SUFFIX_PATTERN, closest, config, contains, destroy, emitFragmentDestroyed, emitFragmentInserted, emitFragmentKeep, emitFragmentKept, emitFromKeepPlan, expandTargets, failKey, getAll, getDumb, getSmart, getSubtree, hasAutoHistory, hello, isDestroying, isGoodClassForTarget, isNotDestroying, markFragmentAsDestroying, matches, navigate, parseSelector, parseTargetAndOptions, reload, render, renderLocalContent, renderRemoteContent, reset, resolveOriginReference, sourceOf, successKey, timeOf, toTarget, visit;
|
13715
13793
|
config = new up.Config(function() {
|
13716
13794
|
return {
|
13717
13795
|
badTargetClasses: [/^up-/],
|
@@ -13732,13 +13810,8 @@ is built from `up.fragment` functions. You may use them to extend Unpoly from yo
|
|
13732
13810
|
autoScroll: ['hash', 'layer-if-main']
|
13733
13811
|
};
|
13734
13812
|
});
|
13735
|
-
|
13736
|
-
|
13737
|
-
return up.layer.config.any.mainTargets;
|
13738
|
-
},
|
13739
|
-
set: function(value) {
|
13740
|
-
return up.layer.config.any.mainTargets = value;
|
13741
|
-
}
|
13813
|
+
u.delegate(config, 'mainTargets', function() {
|
13814
|
+
return up.layer.config.any;
|
13742
13815
|
});
|
13743
13816
|
reset = function() {
|
13744
13817
|
return config.reset();
|
@@ -14071,7 +14144,7 @@ is built from `up.fragment` functions. You may use them to extend Unpoly from yo
|
|
14071
14144
|
This is only relevant when updating a layer that is not the [frontmost layer](/up.layer.front).
|
14072
14145
|
|
14073
14146
|
@param {Object} [options.context]
|
14074
|
-
An object that will be merged into the [context](/
|
14147
|
+
An object that will be merged into the [context](/context) of the current layer once the fragment is rendered.
|
14075
14148
|
|
14076
14149
|
@param {boolean} [options.keep=true]
|
14077
14150
|
Whether [`[up-keep]`](/up-keep) elements will be preserved in the updated fragment.
|
@@ -14931,7 +15004,7 @@ is built from `up.fragment` functions. You may use them to extend Unpoly from yo
|
|
14931
15004
|
element.className = 'klass'
|
14932
15005
|
selector = up.fragment.toTarget(element) // returns '.klass'
|
14933
15006
|
|
14934
|
-
@function up.
|
15007
|
+
@function up.fragment.toTarget
|
14935
15008
|
@param {string|Element|jQuery}
|
14936
15009
|
The element for which to create a selector.
|
14937
15010
|
@stable
|
@@ -14954,7 +15027,7 @@ is built from `up.fragment` functions. You may use them to extend Unpoly from yo
|
|
14954
15027
|
selector = '';
|
14955
15028
|
for (i = 0, len = goodClasses.length; i < len; i++) {
|
14956
15029
|
klass = goodClasses[i];
|
14957
|
-
selector +=
|
15030
|
+
selector += e.classSelector(klass);
|
14958
15031
|
}
|
14959
15032
|
return selector;
|
14960
15033
|
} else {
|
@@ -15260,6 +15333,24 @@ is built from `up.fragment` functions. You may use them to extend Unpoly from yo
|
|
15260
15333
|
|
15261
15334
|
up.visit = up.fragment.visit;
|
15262
15335
|
|
15336
|
+
|
15337
|
+
/***
|
15338
|
+
Returns the current [context](/context).
|
15339
|
+
|
15340
|
+
This is aliased as `up.layer.context`.
|
15341
|
+
|
15342
|
+
@property up.context
|
15343
|
+
@param {Object} context
|
15344
|
+
The context object.
|
15345
|
+
|
15346
|
+
If no context has been set an empty object is returned.
|
15347
|
+
@experimental
|
15348
|
+
*/
|
15349
|
+
|
15350
|
+
u.delegate(up, 'context', function() {
|
15351
|
+
return up.layer.current;
|
15352
|
+
});
|
15353
|
+
|
15263
15354
|
}).call(this);
|
15264
15355
|
|
15265
15356
|
/***
|
@@ -17973,7 +18064,7 @@ You can define custom animations using `up.transition()` and
|
|
17973
18064
|
How the overlay may be [dismissed](/closing-overlays) by the user.
|
17974
18065
|
|
17975
18066
|
Supported values are `'key'`, `'outside'` and `'button'`.
|
17976
|
-
See [
|
18067
|
+
See [customizing dismiss controls](/closing-overlays#customizing-dismiss-controls)
|
17977
18068
|
for details.
|
17978
18069
|
|
17979
18070
|
You may enable multiple dismiss controls by passing an array or
|
@@ -18222,7 +18313,7 @@ You can define custom animations using `up.transition()` and
|
|
18222
18313
|
@param [up-dismissable]
|
18223
18314
|
How the overlay may be [dismissed](/closing-overlays) by the user.
|
18224
18315
|
|
18225
|
-
See [
|
18316
|
+
See [customizing dismiss controls](/closing-overlays#customizing-dismiss-controls)
|
18226
18317
|
for details.
|
18227
18318
|
|
18228
18319
|
You may enable multiple dismiss controls by passing a space-separated string.
|
@@ -18652,23 +18743,35 @@ You can define custom animations using `up.transition()` and
|
|
18652
18743
|
@param {string} location
|
18653
18744
|
@stable
|
18654
18745
|
*/
|
18746
|
+
|
18747
|
+
/***
|
18748
|
+
The [current layer](/up.layer.current)'s mode which governs its appearance and behavior.
|
18749
|
+
|
18750
|
+
@see layer-terminology
|
18751
|
+
|
18752
|
+
@property up.layer.mode
|
18753
|
+
@param {string} mode
|
18754
|
+
@stable
|
18755
|
+
*/
|
18756
|
+
|
18757
|
+
/***
|
18758
|
+
The [context](/context) of the [current layer](/up.layer.current).
|
18759
|
+
|
18760
|
+
This is aliased as `up.context`.
|
18761
|
+
|
18762
|
+
@property up.layer.context
|
18763
|
+
@param {string} context
|
18764
|
+
The context object.
|
18765
|
+
|
18766
|
+
If no context has been set an empty object is returned.
|
18767
|
+
@experimental
|
18768
|
+
*/
|
18655
18769
|
u.delegate(api, ['accept', 'dismiss', 'isRoot', 'isOverlay', 'isFront', 'on', 'off', 'emit', 'parent', 'historyVisible', 'location', 'mode', 'context', 'element', 'contains', 'size', 'affix'], function() {
|
18656
18770
|
return stack.current;
|
18657
18771
|
});
|
18658
18772
|
return api;
|
18659
18773
|
})();
|
18660
18774
|
|
18661
|
-
|
18662
|
-
/***
|
18663
|
-
TODO: Docs
|
18664
|
-
@property up.context
|
18665
|
-
@pram {Object} context
|
18666
|
-
*/
|
18667
|
-
|
18668
|
-
u.getter(up, 'context', function() {
|
18669
|
-
return up.layer.context;
|
18670
|
-
});
|
18671
|
-
|
18672
18775
|
}).call(this);
|
18673
18776
|
|
18674
18777
|
/***
|
@@ -19573,7 +19676,7 @@ new page is loading.
|
|
19573
19676
|
This is only relevant when updating a layer that is not the [frontmost layer](/up.layer.front).
|
19574
19677
|
|
19575
19678
|
@param [up-context]
|
19576
|
-
A JSON object that will be merged into the [context](/
|
19679
|
+
A JSON object that will be merged into the [context](/context)
|
19577
19680
|
of the current layer once the fragment is rendered.
|
19578
19681
|
|
19579
19682
|
@param [up-keep='true']
|