unpoly-rails 2.0.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of unpoly-rails might be problematic. Click here for more details.

Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/README.md +472 -50
  4. data/{dist → assets/unpoly}/unpoly-bootstrap3.css +1 -0
  5. data/assets/unpoly/unpoly-bootstrap3.js +54 -0
  6. data/{dist → assets/unpoly}/unpoly-bootstrap3.min.css +1 -0
  7. data/assets/unpoly/unpoly-bootstrap3.min.js +1 -0
  8. data/{dist → assets/unpoly}/unpoly-bootstrap4.css +1 -0
  9. data/assets/unpoly/unpoly-bootstrap4.js +54 -0
  10. data/{dist → assets/unpoly}/unpoly-bootstrap4.min.css +1 -0
  11. data/assets/unpoly/unpoly-bootstrap4.min.js +1 -0
  12. data/{dist → assets/unpoly}/unpoly-bootstrap5.css +1 -0
  13. data/assets/unpoly/unpoly-bootstrap5.js +56 -0
  14. data/{dist → assets/unpoly}/unpoly-bootstrap5.min.css +1 -0
  15. data/assets/unpoly/unpoly-bootstrap5.min.js +1 -0
  16. data/assets/unpoly/unpoly-migrate.js +1281 -0
  17. data/assets/unpoly/unpoly-migrate.min.js +1 -0
  18. data/{dist → assets/unpoly}/unpoly.css +23 -6
  19. data/assets/unpoly/unpoly.es5.js +23195 -0
  20. data/assets/unpoly/unpoly.es5.min.js +1 -0
  21. data/assets/unpoly/unpoly.js +21457 -0
  22. data/assets/unpoly/unpoly.min.css +10 -0
  23. data/assets/unpoly/unpoly.min.js +1 -0
  24. data/lib/unpoly-rails.rb +12 -12
  25. data/lib/unpoly/rails/controller.rb +1 -1
  26. data/lib/unpoly/rails/engine.rb +13 -20
  27. data/lib/unpoly/rails/request_echo_headers.rb +1 -1
  28. data/lib/unpoly/rails/version.rb +1 -1
  29. metadata +52 -26
  30. data/CHANGELOG.md +0 -2345
  31. data/README_RAILS.md +0 -418
  32. data/dist/unpoly-bootstrap3.js +0 -16
  33. data/dist/unpoly-bootstrap3.min.js +0 -1
  34. data/dist/unpoly-bootstrap4.js +0 -16
  35. data/dist/unpoly-bootstrap4.min.js +0 -1
  36. data/dist/unpoly-bootstrap5.js +0 -14
  37. data/dist/unpoly-bootstrap5.min.js +0 -1
  38. data/dist/unpoly-migrate.js +0 -1306
  39. data/dist/unpoly-migrate.min.js +0 -1
  40. data/dist/unpoly.js +0 -22134
  41. data/dist/unpoly.min.css +0 -1
  42. data/dist/unpoly.min.js +0 -6
  43. data/lib/unpoly/tasks.rb +0 -55
@@ -1 +0,0 @@
1
- (function(){up.feedback.config.currentClasses.push("active"),up.feedback.config.navSelectors.push(".nav",".navbar"),up.form.config.validateTargets.unshift(".form-group:has(:origin)"),up.viewport.config.fixedTop.push(".navbar.fixed-top"),up.viewport.config.fixedBottom.push(".navbar.fixed-bottom"),up.viewport.config.anchoredRight.push(".navbar.fixed-top",".navbar.fixed-bottom"),up.fragment.config.badTargetClasses.push("row",/^col(-xs|-sm|-md|-lg|-xl)?(-\d+)?$/,/^[mp][tblrxy]?-\d+$/)}).call(this);
@@ -1,14 +0,0 @@
1
- (function() {
2
- up.feedback.config.currentClasses.push('active');
3
-
4
- up.feedback.config.navSelectors.push('.nav', '.navbar');
5
-
6
- up.viewport.config.fixedTop.push('.navbar.fixed-top');
7
-
8
- up.viewport.config.fixedBottom.push('.navbar.fixed-bottom');
9
-
10
- up.viewport.config.anchoredRight.push('.navbar.fixed-top', '.navbar.fixed-bottom');
11
-
12
- up.fragment.config.badTargetClasses.push('row', /^col(-xs|-sm|-md|-lg|-xl|-xxl)?(-\d+)?$/, /^[mp][tbsexy]?-\d+$/);
13
-
14
- }).call(this);
@@ -1 +0,0 @@
1
- (function(){up.feedback.config.currentClasses.push("active"),up.feedback.config.navSelectors.push(".nav",".navbar"),up.viewport.config.fixedTop.push(".navbar.fixed-top"),up.viewport.config.fixedBottom.push(".navbar.fixed-bottom"),up.viewport.config.anchoredRight.push(".navbar.fixed-top",".navbar.fixed-bottom"),up.fragment.config.badTargetClasses.push("row",/^col(-xs|-sm|-md|-lg|-xl|-xxl)?(-\d+)?$/,/^[mp][tbsexy]?-\d+$/)}).call(this);
@@ -1,1306 +0,0 @@
1
- (function() {
2
- up.framework.startExtension();
3
-
4
- }).call(this);
5
- (function() {
6
- var u,
7
- slice = [].slice;
8
-
9
- u = up.util;
10
-
11
-
12
- /***
13
- @module up.migrate
14
- */
15
-
16
- up.migrate = (function() {
17
- var config, deprecated, fixEventType, fixEventTypes, fixKey, formerlyAsync, renamedEvent, renamedEvents, renamedPackage, renamedProperty, reset, warn, warnedMessages;
18
- config = new up.Config(function() {
19
- return {
20
- logLevel: 'warn'
21
- };
22
- });
23
- renamedProperty = function(object, oldKey, newKey) {
24
- var warning;
25
- warning = function() {
26
- return warn('Property { %s } has been renamed to { %s } (found in %o)', oldKey, newKey, object);
27
- };
28
- return Object.defineProperty(object, oldKey, {
29
- get: function() {
30
- warning();
31
- return this[newKey];
32
- },
33
- set: function(newValue) {
34
- warning();
35
- return this[newKey] = newValue;
36
- }
37
- });
38
- };
39
- fixKey = function(object, oldKey, newKey) {
40
- if (u.isDefined(object[oldKey])) {
41
- warn('Property { %s } has been renamed to { %s } (found in %o)', oldKey, newKey, object);
42
- return u.renameKey(object, oldKey, newKey);
43
- }
44
- };
45
- renamedEvents = {};
46
- renamedEvent = function(oldType, newType) {
47
- return renamedEvents[oldType] = newType;
48
- };
49
- fixEventType = function(eventType) {
50
- var newEventType;
51
- if (newEventType = renamedEvents[eventType]) {
52
- warn("Event " + eventType + " has been renamed to " + newEventType);
53
- return newEventType;
54
- } else {
55
- return eventType;
56
- }
57
- };
58
- fixEventTypes = function(eventTypes) {
59
- return u.uniq(u.map(eventTypes, fixEventType));
60
- };
61
- renamedPackage = function(oldName, newName) {
62
- return Object.defineProperty(up, oldName, {
63
- get: function() {
64
- warn("up." + oldName + " has been renamed to up." + newName);
65
- return up[newName];
66
- }
67
- });
68
- };
69
- warnedMessages = {};
70
- warn = function() {
71
- var args, formattedMessage, message, ref;
72
- message = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
73
- formattedMessage = u.sprintf.apply(u, [message].concat(slice.call(args)));
74
- if (!warnedMessages[formattedMessage]) {
75
- warnedMessages[formattedMessage] = true;
76
- return (ref = up.log)[config.logLevel].apply(ref, ['DEPRECATION', message].concat(slice.call(args)));
77
- }
78
- };
79
- deprecated = function(deprecatedExpression, replacementExpression) {
80
- return warn(deprecatedExpression + " has been deprecated. Use " + replacementExpression + " instead.");
81
- };
82
- formerlyAsync = function(label) {
83
- var oldThen, promise;
84
- promise = Promise.resolve();
85
- oldThen = promise.then;
86
- promise.then = function() {
87
- warn(label + " is now a sync function");
88
- return oldThen.apply(this, arguments);
89
- };
90
- return promise;
91
- };
92
- reset = function() {
93
- return config.reset();
94
- };
95
- up.on('up:framework:reset', reset);
96
- return {
97
- deprecated: deprecated,
98
- renamedPackage: renamedPackage,
99
- renamedProperty: renamedProperty,
100
- formerlyAsync: formerlyAsync,
101
- renamedEvent: renamedEvent,
102
- fixEventTypes: fixEventTypes,
103
- fixKey: fixKey,
104
- warn: warn,
105
- loaded: true,
106
- config: config
107
- };
108
- })();
109
-
110
- }).call(this);
111
-
112
- /***
113
- @module up.util
114
- */
115
-
116
-
117
- /***
118
- Returns a copy of the given object that only contains
119
- the given keys.
120
-
121
- @function up.util.only
122
- @param {Object} object
123
- @param {Array} ...keys
124
- @deprecated
125
- Use `up.util.pick()` instead.
126
- */
127
-
128
- (function() {
129
- var slice = [].slice;
130
-
131
- up.util.only = function() {
132
- var keys, object;
133
- object = arguments[0], keys = 2 <= arguments.length ? slice.call(arguments, 1) : [];
134
- up.migrate.deprecated('up.util.only(object, ...keys)', 'up.util.pick(object, keys)');
135
- return up.util.pick(object, keys);
136
- };
137
-
138
-
139
- /***
140
- Returns a copy of the given object that contains all except
141
- the given keys.
142
-
143
- @function up.util.except
144
- @param {Object} object
145
- @param {Array} ...keys
146
- @deprecated
147
- Use `up.util.omit(object, keys)` (with an array argument) instead of `up.util.object(...keys)` (with rest arguments).
148
- */
149
-
150
- up.util.except = function() {
151
- var keys, object;
152
- object = arguments[0], keys = 2 <= arguments.length ? slice.call(arguments, 1) : [];
153
- up.migrate.deprecated('up.util.except(object, ...keys)', 'up.util.omit(object, keys)');
154
- return up.util.omit(object, keys);
155
- };
156
-
157
- up.util.parseUrl = function() {
158
- var args, ref;
159
- args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
160
- up.migrate.warn('up.util.parseUrl() has been renamed to up.util.parseURL()');
161
- return (ref = up.util).parseURL.apply(ref, args);
162
- };
163
-
164
- up.util.any = function() {
165
- var args;
166
- args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
167
- up.migrate.warn('up.util.any() has been renamed to up.util.some()');
168
- return some.apply(null, args);
169
- };
170
-
171
- up.util.all = function() {
172
- var args, ref;
173
- args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
174
- up.migrate.warn('up.util.all() has been renamed to up.util.every()');
175
- return (ref = up.util).every.apply(ref, args);
176
- };
177
-
178
- up.util.detect = function() {
179
- var args, ref;
180
- args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
181
- up.migrate.warn('up.util.detect() has been renamed to up.util.find()');
182
- return (ref = up.util).find.apply(ref, args);
183
- };
184
-
185
- up.util.select = function() {
186
- var args, ref;
187
- args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
188
- up.migrate.warn('up.util.select() has been renamed to up.util.filter()');
189
- return (ref = up.util).filter.apply(ref, args);
190
- };
191
-
192
- up.util.setTimer = function() {
193
- var args, ref;
194
- args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
195
- up.migrate.warn('up.util.setTimer() has been renamed to up.util.timer()');
196
- return (ref = up.util).timer.apply(ref, args);
197
- };
198
-
199
- up.util.escapeHtml = function() {
200
- var args, ref;
201
- args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
202
- up.migrate.deprecated('up.util.escapeHtml', 'up.util.escapeHTML');
203
- return (ref = up.util).escapeHTML.apply(ref, args);
204
- };
205
-
206
- up.util.selectorForElement = function() {
207
- var args, ref;
208
- args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
209
- up.migrate.warn('up.util.selectorForElement() has been renamed to up.fragment.toTarget()');
210
- return (ref = up.fragment).toTarget.apply(ref, args);
211
- };
212
-
213
- up.util.nextFrame = function() {
214
- var args, ref;
215
- args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
216
- up.migrate.warn('up.util.nextFrame() has been renamed to up.util.task()');
217
- return (ref = up.util).task.apply(ref, args);
218
- };
219
-
220
- }).call(this);
221
-
222
- /***
223
- @module up.element
224
- */
225
-
226
-
227
- /***
228
- Returns the first descendant element matching the given selector.
229
-
230
- @function up.element.first
231
- @param {Element} [parent=document]
232
- The parent element whose descendants to search.
233
-
234
- If omitted, all elements in the `document` will be searched.
235
- @param {string} selector
236
- The CSS selector to match.
237
- @return {Element|undefined|null}
238
- The first element matching the selector.
239
-
240
- Returns `null` or `undefined` if no element macthes.
241
- @deprecated
242
- Use `up.element.get()` instead.
243
- */
244
-
245
- (function() {
246
- var slice = [].slice;
247
-
248
- up.element.first = function() {
249
- var args, ref;
250
- args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
251
- up.migrate.deprecated('up.element.first()', 'up.element.get()');
252
- return (ref = up.element).get.apply(ref, args);
253
- };
254
-
255
- up.element.createFromHtml = function() {
256
- var args, ref;
257
- args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
258
- up.migrate.deprecated('up.element.createFromHtml', 'up.element.createFromHTML');
259
- return (ref = up.element).createFromHTML.apply(ref, args);
260
- };
261
-
262
- }).call(this);
263
-
264
- /***
265
- @module up.event
266
- */
267
-
268
- (function() {
269
- var slice = [].slice;
270
-
271
- up.migrate.renamedPackage('bus', 'event');
272
-
273
-
274
- /***
275
- [Emits an event](/up.emit) and returns whether no listener
276
- has prevented the default action.
277
-
278
- \#\#\# Example
279
-
280
- ```javascript
281
- if (up.event.nobodyPrevents('disk:erase')) {
282
- Disk.erase()
283
- })
284
- ```
285
-
286
- @function up.event.nobodyPrevents
287
- @param {string} eventType
288
- @param {Object} eventProps
289
- @return {boolean}
290
- whether no listener has prevented the default action
291
- @deprecated
292
- Use `!up.emit(type).defaultPrevented` instead.
293
- */
294
-
295
- up.event.nobodyPrevents = function() {
296
- var args, event;
297
- args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
298
- up.migrate.deprecated('up.event.nobodyPrevents(type)', '!up.emit(type).defaultPrevented');
299
- event = up.emit.apply(up, args);
300
- return !event.defaultPrevented;
301
- };
302
-
303
- }).call(this);
304
- (function() {
305
- var u;
306
-
307
- u = up.util;
308
-
309
- up.migrate.postCompile = function(elements, compiler) {
310
- var element, i, keepValue, len, results, value;
311
- if (keepValue = compiler.keep) {
312
- up.migrate.warn('The { keep: true } option for up.compiler() has been removed. Have the compiler set [up-keep] attribute instead.');
313
- value = u.isString(keepValue) ? keepValue : '';
314
- results = [];
315
- for (i = 0, len = elements.length; i < len; i++) {
316
- element = elements[i];
317
- results.push(element.setAttribute('up-keep', value));
318
- }
319
- return results;
320
- }
321
- };
322
-
323
- up.migrate.targetMacro = function(queryAttr, fixedResultAttrs, callback) {
324
- return up.macro("[" + queryAttr + "]", function(link) {
325
- var optionalTarget, resultAttrs;
326
- resultAttrs = u.copy(fixedResultAttrs);
327
- if (optionalTarget = link.getAttribute(queryAttr)) {
328
- resultAttrs['up-target'] = optionalTarget;
329
- } else {
330
- resultAttrs['up-follow'] = '';
331
- }
332
- e.setMissingAttrs(link, resultAttrs);
333
- link.removeAttribute(queryAttr);
334
- return typeof callback === "function" ? callback() : void 0;
335
- });
336
- };
337
-
338
- }).call(this);
339
-
340
- /***
341
- @module up.form
342
- */
343
-
344
- (function() {
345
- up.migrate.renamedProperty(up.form.config, 'fields', 'fieldSelectors');
346
-
347
- up.migrate.renamedProperty(up.form.config, 'submitButtons', 'submitButtonSelectors');
348
-
349
- }).call(this);
350
- (function() {
351
- var u,
352
- slice = [].slice;
353
-
354
- u = up.util;
355
-
356
-
357
- /***
358
- @module up.fragment
359
- */
360
-
361
- up.migrate.renamedPackage('flow', 'fragment');
362
-
363
- up.migrate.renamedPackage('dom', 'fragment');
364
-
365
- up.migrate.renamedProperty(up.fragment.config, 'fallbacks', 'mainTargets');
366
-
367
- up.migrate.handleResponseDocOptions = function(docOptions) {
368
- return up.migrate.fixKey(docOptions, 'html', 'document');
369
- };
370
-
371
-
372
- /***
373
- Replaces elements on the current page with corresponding elements
374
- from a new page fetched from the server.
375
-
376
- @function up.replace
377
- @param {string|Element|jQuery} target
378
- The CSS selector to update. You can also pass a DOM element or jQuery element
379
- here, in which case a selector will be inferred from the element's class and ID.
380
- @param {string} url
381
- The URL to fetch from the server.
382
- @param {Object} [options]
383
- See `options` for `up.render()`.
384
- @return {Promise}
385
- A promise that fulfills when the page has been updated.
386
- @deprecated
387
- Use `up.render()` or `up.navigate()` instead.
388
- */
389
-
390
- up.replace = function(target, url, options) {
391
- up.migrate.deprecated('up.replace(target, url)', 'up.navigate(target, { url })');
392
- return up.navigate(u.merge(options, {
393
- target: target,
394
- url: url
395
- }));
396
- };
397
-
398
-
399
- /***
400
- Updates a selector on the current page with the
401
- same selector from the given HTML string.
402
-
403
- \#\#\# Example
404
-
405
- Let's say your current HTML looks like this:
406
-
407
- <div class="one">old one</div>
408
- <div class="two">old two</div>
409
-
410
- We now replace the second `<div>`, using an HTML string
411
- as the source:
412
-
413
- html = '<div class="one">new one</div>' +
414
- '<div class="two">new two</div>';
415
-
416
- up.extract('.two', html)
417
-
418
- Unpoly looks for the selector `.two` in the strings and updates its
419
- contents in the current page. The current page now looks like this:
420
-
421
- <div class="one">old one</div>
422
- <div class="two">new two</div>
423
-
424
- Note how only `.two` has changed. The update for `.one` was
425
- discarded, since it didn't match the selector.
426
-
427
- @function up.extract
428
- @param {string|Element|jQuery} target
429
- @param {string} html
430
- @param {Object} [options]
431
- See options for [`up.render()`](/up.render).
432
- @return {Promise}
433
- A promise that will be fulfilled when the selector was updated.
434
- @deprecated
435
- Use `up.render()` or `up.navigate()` instead.
436
- */
437
-
438
- up.extract = function(target, document, options) {
439
- up.migrate.deprecated('up.extract(target, document)', 'up.navigate(target, { document })');
440
- return up.navigate(u.merge(options, {
441
- target: target,
442
- document: document
443
- }));
444
- };
445
-
446
-
447
- /***
448
- Returns the first element matching the given selector, but
449
- ignores elements that are being [destroyed](/up.destroy) or that are being
450
- removed by a [transition](/up.morph).
451
-
452
- Returns `undefined` if no element matches these conditions.
453
-
454
- @function up.fragment.first
455
- @param {Element|jQuery} [root=document]
456
- The root element for the search. Only the root's children will be matched.
457
-
458
- May be omitted to search through all elements in the `document`.
459
- @param {string} selector
460
- The selector to match
461
- @param {string} [options.layer='current']
462
- The the layer in which to find the element.
463
-
464
- @see layer-option
465
- @param {string|Element|jQuery} [options.origin]
466
- An second element or selector that can be referenced as `:origin` in the first selector:
467
- @return {Element|undefined}
468
- The first element that is neither a ghost or being destroyed,
469
- or `undefined` if no such element was found.
470
- @deprecated
471
- Use `up.fragment.get()` instead.
472
- */
473
-
474
- up.fragment.first = function() {
475
- var args, ref;
476
- args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
477
- up.migrate.deprecated('up.fragment.first()', 'up.fragment.get()');
478
- return (ref = up.fragment).get.apply(ref, args);
479
- };
480
-
481
- up.first = up.fragment.first;
482
-
483
- up.migrate.handleScrollOptions = function(options) {
484
- if (u.isUndefined(options.scroll)) {
485
- if (u.isString(options.reveal)) {
486
- up.migrate.deprecated("Option { reveal: '" + options.reveal + "' }", "{ scroll: '" + options.reveal + "' }");
487
- options.scroll = options.reveal;
488
- } else if (options.reveal === true) {
489
- up.migrate.deprecated('Option { reveal: true }', "{ scroll: 'target' }");
490
- options.scroll = 'target';
491
- } else if (options.reveal === false) {
492
- up.migrate.deprecated('Option { reveal: false }', "{ scroll: false }");
493
- options.scroll = false;
494
- }
495
- if (u.isDefined(options.resetScroll)) {
496
- up.migrate.deprecated('Option { resetScroll: true }', "{ scroll: 'reset' }");
497
- options.scroll = 'teset';
498
- }
499
- if (u.isDefined(options.restoreScroll)) {
500
- up.migrate.deprecated('Option { restoreScroll: true }', "{ scroll: 'restore' }");
501
- return options.scroll = 'restore';
502
- }
503
- }
504
- };
505
-
506
- up.migrate.handleHistoryOption = function(options) {
507
- if (u.isString(options.history) && options.history !== 'auto') {
508
- up.migrate.warn("Passing a URL as { history } option is deprecated. Pass it as { location } instead.");
509
- options.location = options.history;
510
- return options.history = 'auto';
511
- }
512
- };
513
-
514
- up.migrate.handleRenderOptions = function(options) {
515
- var i, len, prop, ref, results;
516
- up.migrate.handleHistoryOption(options);
517
- ref = ['target', 'origin'];
518
- results = [];
519
- for (i = 0, len = ref.length; i < len; i++) {
520
- prop = ref[i];
521
- if (u.isJQuery(options[prop])) {
522
- up.migrate.warn('Passing a jQuery collection as { %s } is deprecated. Pass it as a native element instead.', prop);
523
- results.push(options[prop] = up.element.get(options[prop]));
524
- } else {
525
- results.push(void 0);
526
- }
527
- }
528
- return results;
529
- };
530
-
531
- }).call(this);
532
-
533
- /***
534
- @module up.history
535
- */
536
-
537
- (function() {
538
- up.migrate.renamedProperty(up.history.config, 'popTargets', 'restoreTargets');
539
-
540
-
541
- /***
542
- Returns a normalized URL for the current history entry.
543
-
544
- @function up.history.url
545
- @return {string}
546
- @deprecated Use the `up.history.location` property instead.
547
- */
548
-
549
- up.history.url = function() {
550
- up.migrate.deprecated('up.history.url()', 'up.history.location');
551
- return up.history.location;
552
- };
553
-
554
- up.migrate.renamedEvent('up:history:push', 'up:location:changed');
555
-
556
- up.migrate.renamedEvent('up:history:pushed', 'up:location:changed');
557
-
558
- up.migrate.renamedEvent('up:history:restore', 'up:location:changed');
559
-
560
- up.migrate.renamedEvent('up:history:restored', 'up:location:changed');
561
-
562
- up.migrate.renamedEvent('up:history:replaced', 'up:location:changed');
563
-
564
- }).call(this);
565
-
566
- /***
567
- @module up.feedback
568
- */
569
-
570
- (function() {
571
- up.migrate.renamedPackage('navigation', 'feedback');
572
-
573
- up.migrate.renamedProperty(up.feedback.config, 'navs', 'navSelectors');
574
-
575
- }).call(this);
576
-
577
- /***
578
- @module up.link
579
- */
580
-
581
- (function() {
582
- up.migrate.parseFollowOptions = function(parser) {
583
- parser.string('flavor');
584
- parser.string('width');
585
- parser.string('height');
586
- parser.boolean('closable');
587
- parser.booleanOrString('reveal');
588
- parser.boolean('resetScroll');
589
- return parser.boolean('restoreScroll');
590
- };
591
-
592
-
593
- /***
594
- [Follows](/up.follow) this link as fast as possible.
595
-
596
- This is done by:
597
-
598
- - [Following the link through AJAX](/a-up-follow) instead of a full page load
599
- - [Preloading the link's destination URL](/a-up-preload)
600
- - [Triggering the link on `mousedown`](/a-up-instant) instead of on `click`
601
-
602
- \#\#\# Example
603
-
604
- Use `[up-dash]` like this:
605
-
606
- <a href="/users" up-dash=".main">User list</a>
607
-
608
- This is shorthand for:
609
-
610
- <a href="/users" up-target=".main" up-instant up-preload>User list</a>
611
-
612
- @selector a[up-dash]
613
- @param [up-dash='body']
614
- The CSS selector to replace
615
-
616
- Inside the CSS selector you may refer to this link as `&` ([like in Sass](https://sass-lang.com/documentation/file.SASS_REFERENCE.html#parent-selector)).
617
- @deprecated
618
- To accelerate all links use `up.link.config.instantSelectors` and `up.link.config.preloadSelectors`.
619
- */
620
-
621
- up.migrate.targetMacro('up-dash', {
622
- 'up-preload': '',
623
- 'up-instant': ''
624
- }, function() {
625
- return up.migrate.deprecated('a[up-dash]', 'up.link.config.instantSelectors or up.link.config.preloadSelectors');
626
- });
627
-
628
- }).call(this);
629
-
630
- /***
631
- @module up.layer
632
- */
633
-
634
- (function() {
635
- up.migrate.handleLayerOptions = function(options) {
636
- var dimensionKey, i, len, ref;
637
- up.migrate.fixKey(options, 'flavor', 'mode');
638
- up.migrate.fixKey(options, 'closable', 'dismissable');
639
- up.migrate.fixKey(options, 'closeLabel', 'dismissLabel');
640
- ref = ['width', 'maxWidth', 'height'];
641
- for (i = 0, len = ref.length; i < len; i++) {
642
- dimensionKey = ref[i];
643
- if (options[dimensionKey]) {
644
- up.migrate.warn("Layer option { " + dimensionKey + " } has been removed. Use { size } or { class } instead.");
645
- }
646
- }
647
- if (options.sticky) {
648
- up.migrate.warn('Layer option { sticky } has been removed. Give links an [up-peel=false] attribute to prevent layer dismissal on click.');
649
- }
650
- if (options.template) {
651
- up.migrate.warn('Layer option { template } has been removed. Use { class } or modify the layer HTML on up:layer:open.');
652
- }
653
- if (options.layer === 'page') {
654
- up.migrate.warn("Option { layer: 'page' } has been renamed to { layer: 'root' }.");
655
- options.layer = 'root';
656
- }
657
- if (options.layer === 'modal' || options.layer === 'popup') {
658
- up.migrate.warn("Option { layer: '" + options.layer + "' } has been removed. Did you mean { layer: 'overlay' }?");
659
- return options.layer = 'overlay';
660
- }
661
- };
662
-
663
- up.migrate.handleTetherOptions = function(options) {
664
- var align, position, ref;
665
- ref = options.position.split('-'), position = ref[0], align = ref[1];
666
- if (align) {
667
- up.migrate.warn('The position value %o is deprecated. Use %o instead.', options.position, {
668
- position: position,
669
- align: align
670
- });
671
- options.position = position;
672
- return options.align = align;
673
- }
674
- };
675
-
676
-
677
- /***
678
- When this element is clicked, closes a currently open overlay.
679
-
680
- Does nothing if no overlay is currently open.
681
-
682
- To make a link that closes the current overlay, but follows to
683
- a fallback destination on the root layer:
684
-
685
- <a href="/fallback" up-close>Okay</a>
686
-
687
- @selector a[up-close]
688
- @deprecated
689
- Use `a[up-dismiss]` instead.
690
- */
691
-
692
- up.migrate.registerLayerCloser = function(layer) {
693
- return layer.registerClickCloser('up-close', (function(_this) {
694
- return function(value, closeOptions) {
695
- up.migrate.deprecated('[up-close]', '[up-dismiss]');
696
- return layer.dismiss(value, closeOptions);
697
- };
698
- })(this));
699
- };
700
-
701
- up.migrate.handleLayerConfig = function(config) {
702
- return up.migrate.fixKey(config, 'history', 'historyVisible');
703
- };
704
-
705
- }).call(this);
706
-
707
- /***
708
- @module up.layer
709
- */
710
-
711
- (function() {
712
- var FLAVORS_ERROR, u;
713
-
714
- u = up.util;
715
-
716
- FLAVORS_ERROR = new Error('up.modal.flavors has been removed without direct replacement. You may give new layers a { class } or modify layer elements on up:layer:open.');
717
-
718
- up.modal = u.literal({
719
-
720
- /***
721
- Opens a modal overlay for the given URL.
722
-
723
- @function up.modal.visit
724
- @param {string} url
725
- The URL to load.
726
- @param {Object} options
727
- See options for `up.render()`.
728
- @deprecated
729
- Use `up.layer.open({ url, mode: "modal" })` instead.
730
- */
731
- visit: function(url, options) {
732
- if (options == null) {
733
- options = {};
734
- }
735
- up.migrate.deprecated('up.modal.visit(url)', 'up.layer.open({ url, mode: "modal" })');
736
- return up.layer.open(u.merge(options, {
737
- url: url,
738
- mode: 'modal'
739
- }));
740
- },
741
-
742
- /***
743
- Opens the given link's destination in a modal overlay.
744
-
745
- @function up.modal.follow
746
- @param {Element|jQuery|string} linkOrSelector
747
- The link to follow.
748
- @param {string} [options]
749
- See options for `up.render()`.
750
- @return {Promise}
751
- A promise that will be fulfilled when the modal has been opened.
752
- @deprecated
753
- Use `up.follow(link, { layer: "modal" })` instead.
754
- */
755
- follow: function(link, options) {
756
- if (options == null) {
757
- options = {};
758
- }
759
- up.migrate.deprecated('up.modal.follow(link)', 'up.follow(link, { layer: "modal" })');
760
- return up.follow(link, u.merge(options, {
761
- layer: 'modal'
762
- }));
763
- },
764
-
765
- /***
766
- [Extracts](/up.extract) the given CSS selector from the given HTML string and
767
- opens the results in a modal overlay.
768
-
769
- @function up.modal.extract
770
- @param {string} selector
771
- The CSS selector to extract from the HTML.
772
- @param {string} document
773
- The HTML containing the modal content.
774
- @param {Object} options
775
- See options for [`up.modal.follow()`](/up.modal.follow).
776
- @return {Promise}
777
- A promise that will be fulfilled when the modal has been opened.
778
- @deprecated
779
- Use `up.layer.open({ document, mode: "modal" })` instead.
780
- */
781
- extract: function(target, html, options) {
782
- if (options == null) {
783
- options = {};
784
- }
785
- up.migrate.deprecated('up.modal.extract(target, document)', 'up.layer.open({ document, mode: "modal" })');
786
- return up.layer.open(u.merge(options, {
787
- target: target,
788
- html: html,
789
- layer: 'modal'
790
- }));
791
- },
792
-
793
- /***
794
- Closes a currently open overlay.
795
-
796
- @function up.modal.close
797
- @param {Object} options
798
- @return {Promise}
799
- @deprecated
800
- Use `up.layer.dismiss()` instead.
801
- */
802
- close: function(options) {
803
- if (options == null) {
804
- options = {};
805
- }
806
- up.migrate.deprecated('up.modal.close()', 'up.layer.dismiss()');
807
- up.layer.dismiss(null, options);
808
- return up.migrate.formerlyAsync('up.layer.dismiss()');
809
- },
810
-
811
- /***
812
- Returns the location URL of the fragment displayed in the current overlay.
813
-
814
- @function up.modal.url
815
- @return {string}
816
- @deprecated
817
- Use `up.layer.location` instead.
818
- */
819
- url: function() {
820
- up.migrate.deprecated('up.modal.url()', 'up.layer.location');
821
- return up.layer.location;
822
- },
823
-
824
- /***
825
- Returns the location URL of the layer behind the current overlay.
826
-
827
- @function up.modal.coveredUrl
828
- @return {string}
829
- @deprecated
830
- Use `up.layer.parent.location` instead.
831
- */
832
- coveredUrl: function() {
833
- var ref;
834
- up.migrate.deprecated('up.modal.coveredUrl()', 'up.layer.parent.location');
835
- return (ref = up.layer.parent) != null ? ref.location : void 0;
836
- },
837
-
838
- /***
839
- Sets default options for future modal overlays.
840
-
841
- @property up.modal.config
842
- @deprecated
843
- Use `up.layer.config.modal` instead.
844
- */
845
- get_config: function() {
846
- up.migrate.deprecated('up.modal.config', 'up.layer.config.modal');
847
- return up.layer.config.modal;
848
- },
849
-
850
- /***
851
- Returns whether the given element or selector is contained
852
- within the current layer.
853
-
854
- @function up.modal.contains
855
- @param {string} elementOrSelector
856
- The element to test
857
- @return {boolean}
858
- @deprecated
859
- Use `up.layer.contains()` instead.
860
- */
861
- contains: function(element) {
862
- up.migrate.deprecated('up.modal.contains()', 'up.layer.contains()');
863
- return up.layer.contains(element);
864
- },
865
-
866
- /***
867
- Returns whether an overlay is currently open.
868
-
869
- @function up.modal.isOpen
870
- @return {boolean}
871
- @deprecated
872
- Use `up.layer.isOverlay()` instead.
873
- */
874
- isOpen: function() {
875
- up.migrate.deprecated('up.modal.isOpen()', 'up.layer.isOverlay()');
876
- return up.layer.isOverlay();
877
- },
878
- get_flavors: function() {
879
- throw FLAVORS_ERROR;
880
- },
881
- flavor: function() {
882
- throw FLAVORS_ERROR;
883
- }
884
- });
885
-
886
- up.migrate.renamedEvent('up:modal:open', 'up:layer:open');
887
-
888
- up.migrate.renamedEvent('up:modal:opened', 'up:layer:opened');
889
-
890
- up.migrate.renamedEvent('up:modal:close', 'up:layer:dismiss');
891
-
892
- up.migrate.renamedEvent('up:modal:closed', 'up:layer:dismissed');
893
-
894
-
895
- /***
896
- Clicking this link will load the destination via AJAX and open
897
- the given selector in a modal overlay.
898
-
899
- @selector a[up-modal]
900
- @params-note
901
- All attributes for `a[up-layer=new]` may also be used.
902
- @param {string} up-modal
903
- The CSS selector that will be extracted from the response and displayed in a modal dialog.
904
- @deprecated
905
- Use `a[up-layer="new modal"]` instead.
906
- */
907
-
908
- up.migrate.targetMacro('up-modal', {
909
- 'up-layer': 'new modal'
910
- }, function() {
911
- return up.migrate.deprecated('a[up-modal]', 'a[up-layer="new modal"]');
912
- });
913
-
914
-
915
- /***
916
- Clicking this link will load the destination via AJAX and open
917
- the given selector in a modal drawer that slides in from the edge of the screen.
918
-
919
- @selector a[up-drawer]
920
- @params-note
921
- All attributes for `a[up-layer=new]` may also be used.
922
- @param {string} up-drawer
923
- The CSS selector that will be extracted from the response and displayed in a modal dialog.
924
- @deprecated
925
- Use `a[up-layer="new drawer"]` instead.
926
- */
927
-
928
- up.migrate.targetMacro('up-drawer', {
929
- 'up-layer': 'new drawer'
930
- }, function() {
931
- return up.migrate.deprecated('a[up-drawer]', 'a[up-layer="new drawer"]');
932
- });
933
-
934
- }).call(this);
935
-
936
- /***
937
- @module up.layer
938
- */
939
-
940
- (function() {
941
- var e, u;
942
-
943
- u = up.util;
944
-
945
- e = up.element;
946
-
947
- up.popup = u.literal({
948
-
949
- /***
950
- Attaches a popup overlay to the given element or selector.
951
-
952
- @function up.popup.attach
953
- @param {Element|jQuery|string} anchor
954
- The element to which the popup will be attached.
955
- @param {Object} [options]
956
- See options for `up.render()`.
957
- @return {Promise}
958
- @deprecated
959
- Use `up.layer.open({ origin, layer: 'popup' })` instead.
960
- */
961
- attach: function(origin, options) {
962
- if (options == null) {
963
- options = {};
964
- }
965
- origin = up.fragment.get(origin);
966
- up.migrate.deprecated('up.popup.attach(origin)', "up.layer.open({ origin, layer: 'popup' })");
967
- return up.layer.open(u.merge(options, {
968
- origin: origin,
969
- layer: 'popup'
970
- }));
971
- },
972
-
973
- /***
974
- Closes a currently open overlay.
975
-
976
- @function up.popup.close
977
- @param {Object} options
978
- @return {Promise}
979
- @deprecated
980
- Use `up.layer.dismiss()` instead.
981
- */
982
- close: function(options) {
983
- if (options == null) {
984
- options = {};
985
- }
986
- up.migrate.deprecated('up.popup.close()', 'up.layer.dismiss()');
987
- return up.layer.dismiss(null, options);
988
- },
989
-
990
- /***
991
- Returns the location URL of the fragment displayed in the current overlay.
992
-
993
- @function up.popup.url
994
- @return {string}
995
- @deprecated
996
- Use `up.layer.location` instead.
997
- */
998
- url: function() {
999
- up.migrate.deprecated('up.popup.url()', 'up.layer.location');
1000
- return up.layer.location;
1001
- },
1002
-
1003
- /***
1004
- Returns the location URL of the layer behind the current overlay.
1005
-
1006
- @function up.popup.coveredUrl
1007
- @return {string}
1008
- @deprecated
1009
- Use `up.layer.parent.location` instead.
1010
- */
1011
- coveredUrl: function() {
1012
- var ref;
1013
- up.migrate.deprecated('up.popup.coveredUrl()', 'up.layer.parent.location');
1014
- return (ref = up.layer.parent) != null ? ref.location : void 0;
1015
- },
1016
-
1017
- /***
1018
- Sets default options for future popup overlays.
1019
-
1020
- @property up.popup.config
1021
- @deprecated
1022
- Use `up.layer.config.popup` instead.
1023
- */
1024
- get_config: function() {
1025
- up.migrate.deprecated('up.popup.config', 'up.layer.config.popup');
1026
- return up.layer.config.popup;
1027
- },
1028
-
1029
- /***
1030
- Returns whether the given element or selector is contained
1031
- within the current layer.
1032
-
1033
- @function up.popup.contains
1034
- @param {string} elementOrSelector
1035
- The element to test
1036
- @return {boolean}
1037
- @deprecated
1038
- Use `up.layer.contains()` instead.
1039
- */
1040
- contains: function(element) {
1041
- up.migrate.deprecated('up.popup.contains()', 'up.layer.contains()');
1042
- return up.layer.contains(element);
1043
- },
1044
-
1045
- /***
1046
- Returns whether an overlay is currently open.
1047
-
1048
- @function up.popup.isOpen
1049
- @return {boolean}
1050
- @deprecated
1051
- Use `up.layer.isOverlay()` instead.
1052
- */
1053
- isOpen: function() {
1054
- up.migrate.deprecated('up.popup.isOpen()', 'up.layer.isOverlay()');
1055
- return up.layer.isOverlay();
1056
- },
1057
- sync: function() {
1058
- up.migrate.deprecated('up.popup.sync()', 'up.layer.sync()');
1059
- return up.layer.sync();
1060
- }
1061
- });
1062
-
1063
- up.migrate.renamedEvent('up:popup:open', 'up:layer:open');
1064
-
1065
- up.migrate.renamedEvent('up:popup:opened', 'up:layer:opened');
1066
-
1067
- up.migrate.renamedEvent('up:popup:close', 'up:layer:dismiss');
1068
-
1069
- up.migrate.renamedEvent('up:popup:closed', 'up:layer:dismissed');
1070
-
1071
- up.link.targetMacro('up-popup', {
1072
- 'up-layer': 'new popup'
1073
- }, function() {
1074
- return up.migrate.deprecated('[up-popup]', '[up-layer="new popup"]');
1075
- });
1076
-
1077
- }).call(this);
1078
-
1079
- /***
1080
- Tooltips
1081
- ========
1082
-
1083
- Unpoly used to come with a basic tooltip implementation.
1084
- This feature is now deprecated.
1085
-
1086
- @module up.tooltip
1087
- */
1088
-
1089
- (function() {
1090
- up.tooltip = (function() {
1091
- return up.macro('[up-tooltip]', function(opener) {
1092
- up.migrate.warn('[up-tooltip] has been deprecated. A [title] was set instead.');
1093
- return up.element.setMissingAttr(opener, 'title', opener.getAttribute('up-tooltip'));
1094
- });
1095
- })();
1096
-
1097
- }).call(this);
1098
- (function() {
1099
- var preloadDelayMoved, u,
1100
- slice = [].slice;
1101
-
1102
- u = up.util;
1103
-
1104
-
1105
- /***
1106
- @module up.network
1107
- */
1108
-
1109
- up.migrate.renamedPackage('proxy', 'network');
1110
-
1111
- up.migrate.renamedEvent('up:proxy:load', 'up:request:load');
1112
-
1113
- up.migrate.renamedEvent('up:proxy:received', 'up:request:loaded');
1114
-
1115
- up.migrate.renamedEvent('up:proxy:loaded', 'up:request:loaded');
1116
-
1117
- up.migrate.renamedEvent('up:proxy:fatal', 'up:request:fatal');
1118
-
1119
- up.migrate.renamedEvent('up:proxy:aborted', 'up:request:aborted');
1120
-
1121
- up.migrate.renamedEvent('up:proxy:slow', 'up:request:late');
1122
-
1123
- up.migrate.renamedEvent('up:proxy:recover', 'up:request:recover');
1124
-
1125
- preloadDelayMoved = function() {
1126
- return up.migrate.deprecated('up.proxy.config.preloadDelay', 'up.link.config.preloadDelay');
1127
- };
1128
-
1129
- Object.defineProperty(up.network.config, 'preloadDelay', {
1130
- get: function() {
1131
- preloadDelayMoved();
1132
- return up.link.config.preloadDelay;
1133
- },
1134
- set: function(value) {
1135
- preloadDelayMoved();
1136
- return up.link.config.preloadDelay = value;
1137
- }
1138
- });
1139
-
1140
- up.migrate.renamedProperty(up.network.config, 'maxRequests', 'concurrency');
1141
-
1142
- up.migrate.renamedProperty(up.network.config, 'slowDelay', 'badResponseTime');
1143
-
1144
- up.migrate.handleRequestOptions = function(options) {
1145
- return up.migrate.fixKey(options, 'data', 'params');
1146
- };
1147
-
1148
-
1149
- /***
1150
- Makes an AJAX request to the given URL and caches the response.
1151
-
1152
- The function returns a promise that fulfills with the response text.
1153
-
1154
- \#\#\# Example
1155
-
1156
- ```
1157
- up.ajax('/search', { params: { query: 'sunshine' } }).then(function(text) {
1158
- console.log('The response text is %o', text)
1159
- }).catch(function() {
1160
- console.error('The request failed')
1161
- })
1162
- ```
1163
-
1164
- @function up.ajax
1165
- @param {string} [url]
1166
- The URL for the request.
1167
-
1168
- Instead of passing the URL as a string argument, you can also pass it as an `{ url }` option.
1169
- @param {Object} [options]
1170
- See options for `up.request()`.
1171
- @return {Promise<string>}
1172
- A promise for the response text.
1173
- @deprecated
1174
- Use `up.request()` instead.
1175
- */
1176
-
1177
- up.ajax = function() {
1178
- var args, pickResponseText;
1179
- args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
1180
- up.migrate.deprecated('up.ajax()', 'up.request()');
1181
- pickResponseText = function(response) {
1182
- return response.text;
1183
- };
1184
- return up.request.apply(up, args).then(pickResponseText);
1185
- };
1186
-
1187
-
1188
- /***
1189
- Removes all cache entries.
1190
-
1191
- @function up.proxy.clear
1192
- @deprecated
1193
- Use `up.cache.clear()` instead.
1194
- */
1195
-
1196
- up.network.clear = function() {
1197
- up.migrate.deprecated('up.proxy.clear()', 'up.cache.clear()');
1198
- return up.cache.clear();
1199
- };
1200
-
1201
- up.network.preload = function() {
1202
- var args, ref;
1203
- args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
1204
- up.migrate.deprecated('up.proxy.preload(link)', 'up.link.preload(link)');
1205
- return (ref = up.link).preload.apply(ref, args);
1206
- };
1207
-
1208
-
1209
- /***
1210
- @class up.Request
1211
- */
1212
-
1213
- up.Request.prototype.navigate = function() {
1214
- up.migrate.deprecated('up.Request#navigate()', 'up.Request#loadPage()');
1215
- return this.loadPage();
1216
- };
1217
-
1218
-
1219
- /***
1220
- @class up.Response
1221
- */
1222
-
1223
-
1224
- /***
1225
- Returns whether the server responded with a 2xx HTTP status.
1226
-
1227
- @function up.Response#isSuccess
1228
- @return {boolean}
1229
- @deprecated
1230
- Use `up.Response#ok` instead.
1231
- */
1232
-
1233
- up.Response.prototype.isSuccess = function() {
1234
- up.migrate.deprecated('up.Response#isSuccess()', 'up.Response#ok');
1235
- return this.ok;
1236
- };
1237
-
1238
-
1239
- /***
1240
- Returns whether the response was not [successful](/up.Response.prototype.ok).
1241
-
1242
- @function up.Response#isError
1243
- @return {boolean}
1244
- @deprecated
1245
- Use `!up.Response#ok` instead.
1246
- */
1247
-
1248
- up.Response.prototype.isError = function() {
1249
- up.migrate.deprecated('up.Response#isError()', '!up.Response#ok');
1250
- return !this.ok;
1251
- };
1252
-
1253
- }).call(this);
1254
-
1255
- /***
1256
- @module up.radio
1257
- */
1258
-
1259
- (function() {
1260
- up.migrate.renamedProperty(up.radio.config, 'hungry', 'hungrySelectors');
1261
-
1262
- }).call(this);
1263
-
1264
- /***
1265
- @module up.viewport
1266
- */
1267
-
1268
- (function() {
1269
- var slice = [].slice;
1270
-
1271
- up.migrate.renamedPackage('layout', 'viewport');
1272
-
1273
- up.migrate.renamedProperty(up.viewport.config, 'viewports', 'viewportSelectors');
1274
-
1275
- up.migrate.renamedProperty(up.viewport.config, 'snap', 'revealSnap');
1276
-
1277
-
1278
- /***
1279
- Returns the scrolling container for the given element.
1280
-
1281
- Returns the [document's scrolling element](/up.viewport.root)
1282
- if no closer viewport exists.
1283
-
1284
- @function up.viewport.get
1285
- @param {string|Element|jQuery} target
1286
- @return {Element}
1287
- @deprecated
1288
- Use `up.viewport.get()` instead.
1289
- */
1290
-
1291
- up.viewport.closest = function() {
1292
- var args, ref;
1293
- args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
1294
- up.migrate.deprecated('up.viewport.closest()', 'up.viewport.get()');
1295
- return (ref = up.viewport).get.apply(ref, args);
1296
- };
1297
-
1298
- }).call(this);
1299
- (function() {
1300
- up.framework.stopExtension();
1301
-
1302
- }).call(this);
1303
- (function() {
1304
-
1305
-
1306
- }).call(this);