pagy 5.7.1 → 5.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f7ef3c45fb44b6427e511d09b5f19594fb13cfc7cc9f251e87dd48a6e9ecc85
4
- data.tar.gz: 82d248fcb0d28951940fde7bdbe07a01aa027fd24b67b52d08ba33a1c3520dc9
3
+ metadata.gz: 38c707df42d0be0b796b5f5127521dc98876c36ddd2f59f4b15b58cdcbb39365
4
+ data.tar.gz: 67297b4ade3bb8c07e56c2a9640fd9fbec48b7f3bb3c59c690bc4c78051a396b
5
5
  SHA512:
6
- metadata.gz: 356a47a45a5390f236488e02e434e4eb0672be73a0933dd5dd2505c2641d9f340eb4cb4a8bf081add014bc96d335d5febc80537f1ac480e25fba2598ad092d6a
7
- data.tar.gz: ad0f24ec5e7acd68d39a4984b0b4e424d1707ceab71a14f67c081afab792facd931424a2f97cfe1ae7cde4dd87a61a50cb60ecc65a374809bed7be248afda6a8
6
+ metadata.gz: f5e068d8a5e139859dabf10e281bf83eb2245f439b145559d0ee50e63632d4c8de6edf16c7aa9140aa8c0a39453e596f6e84c5e65714866d08ea1887cf9106db
7
+ data.tar.gz: 0cfa89dcde19e35efa752aaf8374fe2335576c6a7ac25b5453a7b513e07e50f7057f169cac1835298ddf2774d6a5db0e7c4684803983d16130720b77a692da7a
data/lib/config/pagy.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Pagy initializer file (5.7.1)
3
+ # Pagy initializer file (5.7.2)
4
4
  # Customize only what you really need and notice that the core Pagy works also without any of the following lines.
5
5
  # Should you just cherry pick part of this file, please maintain the require-order of the extras
6
6
 
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ // The Pagy object
3
+ const Pagy = {
4
+ version: "5.7.2",
5
+ // Scan for "data-pagy-json" elements, parse their JSON content and call their init functions
6
+ init(arg) {
7
+ const target = arg instanceof Element ? arg : document;
8
+ const elements = target.querySelectorAll("[data-pagy-json]");
9
+ const warn = (el, err) => console.warn("Pagy.init() skipped element: %o\n%s", el, err);
10
+ for (const element of elements) {
11
+ const json = element.getAttribute("data-pagy-json");
12
+ try {
13
+ const [keyword, ...args] = JSON.parse(json);
14
+ if (keyword === "nav") {
15
+ Pagy.initNav(element, args);
16
+ }
17
+ else if (keyword === "combo") {
18
+ Pagy.initCombo(element, args);
19
+ }
20
+ else if (keyword === "selector") {
21
+ Pagy.initSelector(element, args);
22
+ }
23
+ else {
24
+ warn(element, `Illegal PagyJSON keyword: expected "nav"|"combo"|"selector", got "${keyword}"`);
25
+ }
26
+ }
27
+ catch (err) {
28
+ warn(element, err);
29
+ }
30
+ }
31
+ },
32
+ // Init the *_nav_js helpers
33
+ initNav(el, [tags, sequels, labelSequels, trimParam]) {
34
+ const container = el.parentElement ?? el;
35
+ const widths = Object.getOwnPropertyNames(sequels).map(w => parseInt(w)).sort((a, b) => b - a);
36
+ let lastWidth = -1;
37
+ const fillIn = (link, page, label) => link.replace(/__pagy_page__/g, page).replace(/__pagy_label__/g, label);
38
+ (el.pagyRender = function () {
39
+ const width = widths.find(w => w < container.clientWidth) || 0;
40
+ if (width === lastWidth) {
41
+ return;
42
+ } // no change: abort
43
+ let html = tags.before;
44
+ const series = sequels[width.toString()];
45
+ const labels = labelSequels?.[width.toString()] ?? series.map(l => l.toString());
46
+ for (const i in series) {
47
+ const item = series[i];
48
+ const label = labels[i];
49
+ if (typeof trimParam === "string" && item === 1) {
50
+ html += Pagy.trim(fillIn(tags.link, item.toString(), label), trimParam);
51
+ }
52
+ else if (typeof item === "number") {
53
+ html += fillIn(tags.link, item.toString(), label);
54
+ }
55
+ else if (item === "gap") {
56
+ html += tags.gap;
57
+ }
58
+ else { // active page
59
+ html += fillIn(tags.active, item, label);
60
+ }
61
+ }
62
+ html += tags.after; // eslint-disable-line align-assignments/align-assignments
63
+ el.innerHTML = "";
64
+ el.insertAdjacentHTML("afterbegin", html);
65
+ lastWidth = width;
66
+ })();
67
+ if (el.classList.contains("pagy-rjs")) {
68
+ Pagy.rjsObserver.observe(container);
69
+ }
70
+ },
71
+ // The observer instance for responsive navs
72
+ rjsObserver: new ResizeObserver(entries => {
73
+ entries.filter(e => e.contentBoxSize)
74
+ .forEach(e => e.target.querySelectorAll(".pagy-rjs")
75
+ .forEach(rjs => rjs.pagyRender()));
76
+ }),
77
+ // Init the *_combo_nav_js helpers
78
+ initCombo(el, [link, trimParam]) {
79
+ Pagy.initInput(el, inputValue => [inputValue, link.replace(/__pagy_page__/, inputValue)], trimParam);
80
+ },
81
+ // Init the items_selector_js helper
82
+ initSelector(el, [from, link, trimParam]) {
83
+ Pagy.initInput(el, inputValue => {
84
+ const page = Math.max(Math.ceil(from / parseInt(inputValue)), 1).toString();
85
+ const html = link.replace(/__pagy_page__/, page).replace(/__pagy_items__/, inputValue);
86
+ return [page, html];
87
+ }, trimParam);
88
+ },
89
+ // Init the input element
90
+ initInput(el, getVars, trimParam) {
91
+ const input = el.querySelector("input");
92
+ const initial = input.value;
93
+ const action = function () {
94
+ if (input.value === initial) {
95
+ return;
96
+ } // not changed
97
+ const [min, val, max] = [input.min, input.value, input.max].map(n => parseInt(n) || 0);
98
+ if (val < min || val > max) { // reset invalid/out-of-range
99
+ input.value = initial;
100
+ input.select();
101
+ return;
102
+ }
103
+ let [page, html] = getVars(input.value); // eslint-disable-line prefer-const
104
+ if (typeof trimParam === "string" && page === "1") {
105
+ html = Pagy.trim(html, trimParam);
106
+ }
107
+ el.insertAdjacentHTML("afterbegin", html);
108
+ el.querySelector("a").click();
109
+ };
110
+ ["change", "focus"].forEach(e => input.addEventListener(e, input.select)); // auto-select
111
+ input.addEventListener("focusout", action); // trigger action
112
+ input.addEventListener("keypress", e => { if (e.key === "Enter") {
113
+ action();
114
+ } }); // trigger action
115
+ },
116
+ // Trim the ${page-param}=1 params in links
117
+ trim: (link, param) => link.replace(new RegExp(`[?&]${param}=1\\b(?!&)|\\b${param}=1&`), "")
118
+ };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2NhbiBmb3IgXCJkYXRhLXBhZ3ktanNvblwiIGVsZW1lbnRzLCBwYXJzZSB0aGVpciBKU09OIGNvbnRlbnQgYW5kIGNhbGwgdGhlaXIgaW5pdCBmdW5jdGlvbnNcbiAgICBpbml0KGFyZz86RWxlbWVudHxuZXZlcikge1xuICAgICAgICBjb25zdCB0YXJnZXQgICA9IGFyZyBpbnN0YW5jZW9mIEVsZW1lbnQgPyBhcmcgOiBkb2N1bWVudDtcbiAgICAgICAgY29uc3QgZWxlbWVudHMgPSB0YXJnZXQucXVlcnlTZWxlY3RvckFsbChcIltkYXRhLXBhZ3ktanNvbl1cIik7XG4gICAgICAgIGNvbnN0IHdhcm4gICAgID0gKGVsOkVsZW1lbnQsIGVycjp1bmtub3duKSA9PiBjb25zb2xlLndhcm4oXCJQYWd5LmluaXQoKSBza2lwcGVkIGVsZW1lbnQ6ICVvXFxuJXNcIiwgZWwsIGVycik7XG4gICAgICAgIGZvciAoY29uc3QgZWxlbWVudCBvZiBlbGVtZW50cykge1xuICAgICAgICAgICAgY29uc3QganNvbiA9IGVsZW1lbnQuZ2V0QXR0cmlidXRlKFwiZGF0YS1wYWd5LWpzb25cIikgYXMgc3RyaW5nO1xuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICBjb25zdCBba2V5d29yZCwgLi4uYXJnc10gPSBKU09OLnBhcnNlKGpzb24pIGFzIFBhZ3lKU09OO1xuICAgICAgICAgICAgICAgIGlmIChrZXl3b3JkID09PSBcIm5hdlwiKSB7XG4gICAgICAgICAgICAgICAgICAgIFBhZ3kuaW5pdE5hdihlbGVtZW50IGFzIE5hdkVsZW1lbnQsIGFyZ3MgYXMgTmF2QXJncyk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChrZXl3b3JkID09PSBcImNvbWJvXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgUGFneS5pbml0Q29tYm8oZWxlbWVudCwgYXJncyBhcyBDb21ib0FyZ3MpO1xuICAgICAgICAgIC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F9fL2csIGxhYmVsKTtcbiAgICAgICAgKGVsLnBhZ3lSZW5kZXIgPSBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIGNvbnN0IHdpZHRoID0gd2lkdGhzLmZpbmQodyA9PiB3IDwgY29udGFpbmVyLmNsaWVudFdpZHRoKSB8fCAwO1xuICAgICAgICAgICAgaWYgKHdpZHRoID09PSBsYXN0V2lkdGgpIHsgcmV0dXJuIH0gLy8gbm8gY2hhbmdlOiBhYm9ydFxuICAgICAgICAgICAgbGV0IGh0bWwgICAgID0gdGFncy5iZWZvcmU7XG4gICAgICAgICAgICBjb25zdCBzZXJpZXMgPSBzZXF1ZWxzW3dpZHRoLnRvU3RyaW5nKCldO1xuICAgICAgICAgICAgY29uc3QgbGFiZWxzID0gbGFiZWxTZXF1ZWxzPy5bd2lkdGgudG9TdHJpbmcoKV0gPz8gc2VyaWVzLm1hcChsID0+IGwudG9TdHJpbmcoKSk7XG4gICAgICAgICAgICBmb3IgKGNvbnN0IGkgaW4gc2VyaWVzKSB7XG4gICAgICAgICAgICAgICAgY29uc3QgaXRlbSAgPSBzZXJpZXNbaV07XG4gICAgICAgICAgICAgICAgY29uc3QgbGFiZWwgPSBsYWJlbHNbaV07XG4gICAgICAgICAgICAgICAgaWYgKHR5cGVvZiB0cmltUGFyYW0gPT09IFwic3RyaW5nXCIgJiYgaXRlbSA9PT0gMSkge1xuICAgICAgICAgICAgICAgICAgICBodG1sICs9IFBhZ3kudHJpbShmaWxsSW4odGFncy5saW5rLCBpdGVtLnRvU3RyaW5nKCksIGxhYmVsKSwgdHJpbVBhcmFtKTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiBpdGVtID09PSBcIm51bWJlclwiKSB7XG4gICAgICAgICAgICAgICAgICAgIGh0bWwgKz0gZmlsbEluKHRhZ3MubGluaywgaXRlbS50b1N0cmluZygpLCBsYWJlbCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpdGVtID09PSBcImdhcFwiKSB7XG4gICAgICAgICAgICAgICAgICAgIGh0bWwgKz0gdGFncy5nYXA7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHsgLy8gYWN0aXZlIHBhZ2VcbiAgICAgICAgICAgICAgICAgICAgaHRtbCArPSBmaWxsSW4odGFncy5hY3RpdmUsIGl0ZW0sIGxhYmVsKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBodG1sICs9IHRhZ3MuYWZ0ZXI7ICAgLy8gZXNsaW50LWRpc2FibGUtbGluZSBhbGlnbi1hc3NpZ25tZW50cy9hbGlnbi1hc3NpZ25tZW50c1xuICAgICAgICAgICAgZWwuaW5uZXJIVE1MID0gXCJcIjtcbiAgICAgICAgICAgIGVsLmluc2VydEFkamFjZW50SFRNTChcImFmdGVyYmVnaW5cIiwgaHRtbCk7XG4gICAgICAgICAgICBsYXN0V2lkdGggPSB3aWR0aDtcbiAgICAgICAgfSkoKTtcbiAgICAgICAgaWYgKGVsLmNsYXNzTGlzdC5jb250YWlucyhcInBhZ3ktcmpzXCIpKSB7IFBhZ3kucmpzT2JzZXJ2ZXIub2JzZXJ2ZShjb250YWluZXIpIH1cbiAgICB9LFxuXG4gICAgLy8gVGhlIG9ic2VydmVyIGluc3RhbmNlIGZvciByZXNwb25zaXZlIG5hdnNcbiAgICByanNPYnNlcnZlcjogbmV3IFJlc2l6ZU9ic2VydmVyKGVudHJpZXMgPT4ge1xuICAgICAgICBlbnRyaWVzLmZpbHRlcihlID0+IGUuY29udGVudEJveFNpemUpXG4gICAgICAgICAgICAgICAuZm9yRWFjaChlID0+IGUudGFyZ2V0LnF1ZXJ5U2VsZWN0b3JBbGw8TmF2RWxlbWVudD4oXCIucGFneS1yanNcIilcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuZm9yRWFjaChyanMgPT4gcmpzLnBhZ3lSZW5kZXIoKSkpO1xuICAgIH0pLFxuXG4gICAgLy8gSW5pdCB0aGUgKl9j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vLyBhdXRvLXNlbGVjdFxuICAgICAgICBpbnB1dC5hZGRFdmVudExpc3RlbmVyKFwiZm9jdXNvdXRcIiwgYWN0aW9uKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB0cmlnZ2VyIGFjdGlvblxuICAgICAgICBpbnB1dC5hZGRFdmVudExpc3RlbmVyKFwia2V5cHJlc3NcIiwgZSA9PiB7IGlmIChlLmtleSA9PT0gXCJFbnRlclwiKSB7IGFjdGlvbigpIH0gfSk7IC8vIHRyaWdnZXIgYWN0aW9uXG4gICAgfSxcblxuICAgIC8vIFRyaW0gdGhlICR7cGFnZS1wYXJhbX09MSBwYXJhbXMgaW4gbGlua3NcbiAgICB0cmltOiAobGluazpzdHJpbmcsIHBhcmFtOnN0cmluZykgPT4gbGluay5yZXBsYWNlKG5ldyBSZWdFeHAoYFs/Jl0ke3BhcmFtfT0xXFxcXGIoPyEmKXxcXFxcYiR7cGFyYW19PTEmYCksIFwiXCIpXG59O1xuXG4vLyBUb3BsZXZlbCB2YXIgKG5lZWRlZCBmb3IgZ2VuZXJhdGluZyB0aGUgcHJvZHVjdGlvbiBmaWxlKVxud2luZG93LlBhZ3kgPSBQYWd5O1xuIl19
@@ -1,3 +1 @@
1
- "use strict";function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _iterableToArrayLimit(a,b){var c=null==a?null:"undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(null!=c){var d,e,f=[],g=!0,h=!1;try{for(c=c.call(a);!(g=(d=c.next()).done)&&(f.push(d.value),!(b&&f.length===b));g=!0);}catch(a){h=!0,e=a}finally{try{g||null==c["return"]||c["return"]()}finally{if(h)throw e}}return f}}function _toArray(a){return _arrayWithHoles(a)||_iterableToArray(a)||_unsupportedIterableToArray(a)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}function _arrayWithHoles(a){if(Array.isArray(a))return a}function _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c["return"]||c["return"]()}finally{if(h)throw f}}}}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}var Pagy={version:"5.7.1",init:function init(a){var b,c=a instanceof Element?a:document,d=c.querySelectorAll("[data-pagy-json]"),e=function(a,b){return console.warn("Pagy.init() skipped element: %o\n%s",a,b)},f=_createForOfIteratorHelper(d);try{for(f.s();!(b=f.n()).done;){var g=b.value,h=g.getAttribute("data-pagy-json");try{var i=JSON.parse(h),j=_toArray(i),k=j[0],l=j.slice(1);"nav"===k?Pagy.initNav(g,l):"combo_nav"===k?Pagy.initComboNav(g,l):"items_selector"===k?Pagy.initItemsSelector(g,l):e(g,"Illegal PagyJSON keyword: expected \"nav\"|\"combo_nav\"|\"items_selector\" got \"".concat(k,"\""))}catch(a){e(g,a)}}}catch(a){f.e(a)}finally{f.f()}},initNav:function initNav(a,b){var c,d=_slicedToArray(b,4),e=d[0],f=d[1],g=d[2],h=d[3],container=null!==(c=a.parentElement)&&void 0!==c?c:a,j=Object.getOwnPropertyNames(f).map(function(a){return parseInt(a)}).sort(function(c,a){return a-c}),k=-1,l=function(a,b,c){return a.replace(/__pagy_page__/g,b).replace(/__pagy_label__/g,c)};(a.pagyRender=function(){var b,c=j.find(function(a){return a<container.clientWidth})||0;if(c!==k){var d=e.before,m=f[c.toString()],n=null!==(b=null===g||void 0===g?void 0:g[c.toString()])&&void 0!==b?b:m.map(function(a){return a.toString()});for(var q in m){var o=m[q],p=n[q];d+="string"==typeof h&&1===o?Pagy.trim(l(e.link,o.toString(),p),h):"number"==typeof o?l(e.link,o.toString(),p):"gap"===o?e.gap:l(e.active,o,p)}d+=e.after,a.innerHTML="",a.insertAdjacentHTML("afterbegin",d),k=c}})(),a.classList.contains("pagy-rjs")&&Pagy.rjsObserver.observe(container)},rjsObserver:new ResizeObserver(function(a){a.filter(function(a){return a.contentBoxSize}).forEach(function(a){return a.target.querySelectorAll(".pagy-rjs").forEach(function(a){return a.pagyRender()})})}),initComboNav:function initComboNav(a,b){var c=_slicedToArray(b,2),d=c[0],e=c[1];Pagy.initInput(a,function(a){return[a,d.replace(/__pagy_page__/,a)]},e)},initItemsSelector:function initItemsSelector(a,b){var c=_slicedToArray(b,3),d=c[0],e=c[1],f=c[2];Pagy.initInput(a,function(a){var b=Math.max(Math.ceil(d/parseInt(a)),1).toString(),c=e.replace(/__pagy_page__/,b).replace(/__pagy_items__/,a);return[b,c]},f)},initInput:function initInput(a,b,c){var d=a.querySelector("input"),e=d.value,f=function(){if(d.value!==e){var f=[d.min,d.value,d.max].map(function(a){return parseInt(a)||0}),g=_slicedToArray(f,3),h=g[0],i=g[1],j=g[2];if(i<h||i>j)return d.value=e,void d.select();var k=b(d.value),l=_slicedToArray(k,2),m=l[0],n=l[1];"string"==typeof c&&"1"===m&&(n=Pagy.trim(n,c)),a.insertAdjacentHTML("afterbegin",n),a.querySelector("a").click()}};["change","focus"].forEach(function(a){return d.addEventListener(a,d.select)}),d.addEventListener("focusout",f),d.addEventListener("keypress",function(a){"Enter"===a.key&&f()})},trim:function trim(a,b){return a.replace(new RegExp("[?&]".concat(b,"=1\\b(?!&)|\\b").concat(b,"=1&")),"")}};
2
-
3
- //# sourceMappingURL=pagy.js.map
1
+ !function(){function t(t){if(Array.isArray(t))return t}function n(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}function e(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function r(r,i){return t(r)||n(r)||e()}var i={version:"5.7.2",init:function(r){var a,o=(r instanceof Element?r:document).querySelectorAll("[data-pagy-json]"),c=function(t,n){return console.warn("Pagy.init() skipped element: %o\n%s",t,n)},u=!0,l=!1,f=void 0;try{for(var p,s=o[Symbol.iterator]();!(u=(p=s.next()).done);u=!0){var v=p.value,g=v.getAttribute("data-pagy-json");try{var y=t(a=JSON.parse(g))||n(a)||e(),d=y[0],m=y.slice(1);"nav"===d?i.initNav(v,m):"combo"===d?i.initCombo(v,m):"selector"===d?i.initSelector(v,m):c(v,'Illegal PagyJSON keyword: expected "nav"|"combo"|"selector", got "'.concat(d,'"'))}catch(t){c(v,t)}}}catch(t){l=!0,f=t}finally{try{u||null==s.return||s.return()}finally{if(l)throw f}}},initNav:function(t,n){var e,a=r(n),o=a[0],c=a[1],u=a[2],l=a[3],f=null!==(e=t.parentElement)&&void 0!==e?e:t,p=Object.getOwnPropertyNames(c).map((function(t){return parseInt(t)})).sort((function(t,n){return n-t})),s=-1,v=function(t,n,e){return t.replace(/__pagy_page__/g,n).replace(/__pagy_label__/g,e)};(t.pagyRender=function(){var n=p.find((function(t){return t<f.clientWidth}))||0;if(n!==s){var e,r=o.before,a=c[n.toString()],g=null!==(e=null==u?void 0:u[n.toString()])&&void 0!==e?e:a.map((function(t){return t.toString()}));for(var y in a){var d=a[y],m=g[y];r+="string"==typeof l&&1===d?i.trim(v(o.link,d.toString(),m),l):"number"==typeof d?v(o.link,d.toString(),m):"gap"===d?o.gap:v(o.active,d,m)}r+=o.after,t.innerHTML="",t.insertAdjacentHTML("afterbegin",r),s=n}})(),t.classList.contains("pagy-rjs")&&i.rjsObserver.observe(f)},rjsObserver:new ResizeObserver((function(t){t.filter((function(t){return t.contentBoxSize})).forEach((function(t){return t.target.querySelectorAll(".pagy-rjs").forEach((function(t){return t.pagyRender()}))}))})),initCombo:function(t,n){var e=r(n),a=e[0],o=e[1];i.initInput(t,(function(t){return[t,a.replace(/__pagy_page__/,t)]}),o)},initSelector:function(t,n){var e=r(n),a=e[0],o=e[1],c=e[2];i.initInput(t,(function(t){var n=Math.max(Math.ceil(a/parseInt(t)),1).toString();return[n,o.replace(/__pagy_page__/,n).replace(/__pagy_items__/,t)]}),c)},initInput:function(t,n,e){var a=t.querySelector("input"),o=a.value,c=function(){if(a.value!==o){var c=r([a.min,a.value,a.max].map((function(t){return parseInt(t)||0}))),u=c[0],l=c[1],f=c[2];if(l<u||l>f)return a.value=o,void a.select();var p=r(n(a.value)),s=p[0],v=p[1];"string"==typeof e&&"1"===s&&(v=i.trim(v,e)),t.insertAdjacentHTML("afterbegin",v),t.querySelector("a").click()}};["change","focus"].forEach((function(t){return a.addEventListener(t,a.select)})),a.addEventListener("focusout",c),a.addEventListener("keypress",(function(t){"Enter"===t.key&&c()}))},trim:function(t,n){return t.replace(new RegExp("[?&]".concat(n,"=1\\b(?!&)|\\b").concat(n,"=1&")),"")}};window.Pagy=i}();
@@ -29,7 +29,7 @@ class Pagy # :nodoc:
29
29
  html << %(</ul></nav>)
30
30
  end
31
31
 
32
- # Javascript pagination for bootstrap: it returns a nav and a JSON tag used by the Pagy.nav javascript
32
+ # Javascript pagination for bootstrap: it returns a nav and a JSON tag used by the pagy.js file
33
33
  def pagy_bootstrap_nav_js(pagy, pagy_id: nil, link_extra: '', **vars)
34
34
  sequels = pagy.sequels(**vars)
35
35
  p_id = %( id="#{pagy_id}") if pagy_id
@@ -44,7 +44,7 @@ class Pagy # :nodoc:
44
44
  pagy_json_attr(pagy, :nav, tags, sequels, pagy.label_sequels(sequels))}></nav>)
45
45
  end
46
46
 
47
- # Javascript combo pagination for bootstrap: it returns a nav and a JSON tag used by the Pagy.combo_nav javascript
47
+ # Javascript combo pagination for bootstrap: it returns a nav and a JSON tag used by the pagy.js file
48
48
  def pagy_bootstrap_combo_nav_js(pagy, pagy_id: nil, link_extra: '')
49
49
  p_id = %( id="#{pagy_id}") if pagy_id
50
50
  link = pagy_link_proc(pagy, link_extra: link_extra)
@@ -55,7 +55,7 @@ class Pagy # :nodoc:
55
55
  p_pages.to_s.length + 1}rem;">)
56
56
 
57
57
  %(<nav#{p_id} class="pagy-bootstrap-combo-nav-js pagination" aria-label="pager"><div class="btn-group" role="group" #{
58
- pagy_json_attr pagy, :combo_nav, pagy_marked_link(link)}>#{
58
+ pagy_json_attr pagy, :combo, pagy_marked_link(link)}>#{
59
59
  if (p_prev = pagy.prev)
60
60
  link.call p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous" class="prev btn btn-primary"'
61
61
  else
@@ -7,7 +7,7 @@ class Pagy # :nodoc:
7
7
  # Frontend modules are specially optimized for performance.
8
8
  # The resulting code may not look very elegant, but produces the best benchmarks
9
9
  module BulmaExtra
10
- # Pagination for Bulma: it returns the html with the series of links to the pages
10
+ # Pagination for bulma: it returns the html with the series of links to the pages
11
11
  def pagy_bulma_nav(pagy, pagy_id: nil, link_extra: '', **vars)
12
12
  p_id = %( id="#{pagy_id}") if pagy_id
13
13
  link = pagy_link_proc(pagy, link_extra: link_extra)
@@ -30,6 +30,7 @@ class Pagy # :nodoc:
30
30
  html << %(</ul></nav>)
31
31
  end
32
32
 
33
+ # Javascript pagination for bulma: it returns a nav and a JSON tag used by the Pagy.nav javascript
33
34
  def pagy_bulma_nav_js(pagy, pagy_id: nil, link_extra: '', **vars)
34
35
  sequels = pagy.sequels(**vars)
35
36
  p_id = %( id="#{pagy_id}") if pagy_id
@@ -47,7 +48,7 @@ class Pagy # :nodoc:
47
48
  pagy_json_attr(pagy, :nav, tags, sequels, pagy.label_sequels(sequels))}></nav>)
48
49
  end
49
50
 
50
- # Javascript combo pagination for Bulma: it returns a nav and a JSON tag used by the Pagy.combo_nav javascript
51
+ # Javascript combo pagination for bulma: it returns a nav and a JSON tag used by the pagy.js file
51
52
  def pagy_bulma_combo_nav_js(pagy, pagy_id: nil, link_extra: '')
52
53
  p_id = %( id="#{pagy_id}") if pagy_id
53
54
  link = pagy_link_proc(pagy, link_extra: link_extra)
@@ -58,7 +59,7 @@ class Pagy # :nodoc:
58
59
 
59
60
  html = %(<nav#{p_id} class="pagy-bulma-combo-nav-js" aria-label="pagination">)
60
61
  %(#{html}<div class="field is-grouped is-grouped-centered" role="group" #{
61
- pagy_json_attr pagy, :combo_nav, pagy_marked_link(link)}>#{
62
+ pagy_json_attr pagy, :combo, pagy_marked_link(link)}>#{
62
63
  if (p_prev = pagy.prev)
63
64
  %(<p class="control">#{link.call p_prev, pagy_t('pagy.nav.prev'), 'class="button" aria-label="previous page"'}</p>)
64
65
  else
@@ -26,7 +26,7 @@ class Pagy # :nodoc:
26
26
  html << %(</ul></nav>)
27
27
  end
28
28
 
29
- # Javascript pagination for foundation: it returns a nav and a JSON tag used by the Pagy.nav javascript
29
+ # Javascript pagination for foundation: it returns a nav and a JSON tag used by the pagy.js file
30
30
  def pagy_foundation_nav_js(pagy, pagy_id: nil, link_extra: '', **vars)
31
31
  sequels = pagy.sequels(**vars)
32
32
  p_id = %( id="#{pagy_id}") if pagy_id
@@ -41,7 +41,7 @@ class Pagy # :nodoc:
41
41
  pagy_json_attr(pagy, :nav, tags, sequels, pagy.label_sequels(sequels))}></nav>)
42
42
  end
43
43
 
44
- # Javascript combo pagination for Foundation: it returns a nav and a JSON tag used by the Pagy.combo_nav javascript
44
+ # Javascript combo pagination for Foundation: it returns a nav and a JSON tag used by the pagy.js file
45
45
  def pagy_foundation_combo_nav_js(pagy, pagy_id: nil, link_extra: '')
46
46
  p_id = %( id="#{pagy_id}") if pagy_id
47
47
  link = pagy_link_proc(pagy, link_extra: link_extra)
@@ -52,7 +52,7 @@ class Pagy # :nodoc:
52
52
  p_pages.to_s.length + 1}rem; padding: 0 0.3rem; margin: 0 0.3rem;">)
53
53
 
54
54
  %(<nav#{p_id} class="pagy-foundation-combo-nav-js" aria-label="Pagination"><div class="input-group" #{
55
- pagy_json_attr pagy, :combo_nav, pagy_marked_link(link)}>#{
55
+ pagy_json_attr pagy, :combo, pagy_marked_link(link)}>#{
56
56
  if (p_prev = pagy.prev)
57
57
  link.call p_prev, pagy_t('pagy.nav.prev'),
58
58
  'style="margin-bottom: 0" aria-label="previous" class="prev button primary"'
@@ -39,7 +39,7 @@ class Pagy # :nodoc:
39
39
  link = pagy_marked_link(pagy_link_proc(pagy, link_extra: link_extra))
40
40
  p_vars[:items] = p_items # restore the items
41
41
 
42
- html = +%(<span#{p_id} class="pagy-items-selector-js" #{pagy_json_attr pagy, :items_selector, pagy.from, link}>)
42
+ html = +%(<span#{p_id} class="pagy-items-selector-js" #{pagy_json_attr pagy, :selector, pagy.from, link}>)
43
43
  input = %(<input type="number" min="1" max="#{p_vars[:max_items]}" value="#{
44
44
  p_items}" style="padding: 0; text-align: center; width: #{p_items.to_s.length + 1}rem;">)
45
45
  html << pagy_t('pagy.items_selector_js', item_name: item_name || pagy_t(i18n_key || p_vars[:i18n_key], count: p_items),
@@ -26,7 +26,7 @@ class Pagy # :nodoc:
26
26
  html << %(</ul></div>)
27
27
  end
28
28
 
29
- # Javascript pagination for materialize: it returns a nav and a JSON tag used by the Pagy.nav javascript
29
+ # Javascript pagination for materialize: it returns a nav and a JSON tag used by the pagy.js file
30
30
  def pagy_materialize_nav_js(pagy, pagy_id: nil, link_extra: '', **vars)
31
31
  sequels = pagy.sequels(**vars)
32
32
  p_id = %( id="#{pagy_id}") if pagy_id
@@ -42,7 +42,7 @@ class Pagy # :nodoc:
42
42
  pagy_json_attr(pagy, :nav, tags, sequels, pagy.label_sequels(sequels))}></div>)
43
43
  end
44
44
 
45
- # Javascript combo pagination for materialize: it returns a nav and a JSON tag used by the Pagy.combo_nav javascript
45
+ # Javascript combo pagination for materialize: it returns a nav and a JSON tag used by the pagy.js file
46
46
  def pagy_materialize_combo_nav_js(pagy, pagy_id: nil, link_extra: '')
47
47
  p_id = %( id="#{pagy_id}") if pagy_id
48
48
  link = pagy_link_proc(pagy, link_extra: link_extra)
@@ -54,7 +54,7 @@ class Pagy # :nodoc:
54
54
 
55
55
  html = %(<ul#{p_id} class="pagy-materialize-combo-nav-js pagination chip" role="navigation")
56
56
  %(#{html} aria-label="pager" style="padding-right: 0" #{
57
- pagy_json_attr pagy, :combo_nav, pagy_marked_link(link)}>#{
57
+ pagy_json_attr pagy, :combo, pagy_marked_link(link)}>#{
58
58
  pagy_materialize_prev_html pagy, link, style}<li class="pagy-combo-input">#{
59
59
  pagy_t 'pagy.combo_nav_js', page_input: input, count: p_page, pages: p_pages}</li>#{
60
60
  pagy_materialize_next_html pagy, link, style}</ul>)
@@ -7,7 +7,7 @@ class Pagy # :nodoc:
7
7
  # Frontend modules are specially optimized for performance.
8
8
  # The resulting code may not look very elegant, but produces the best benchmarks
9
9
  module NavsExtra
10
- # Javascript pagination: it returns a nav and a JSON tag used by the Pagy.nav javascript
10
+ # Javascript pagination: it returns a nav and a JSON tag used by the pagy.js file
11
11
  def pagy_nav_js(pagy, pagy_id: nil, link_extra: '', **vars)
12
12
  sequels = pagy.sequels(**vars)
13
13
  p_id = %( id="#{pagy_id}") if pagy_id
@@ -22,7 +22,7 @@ class Pagy # :nodoc:
22
22
  pagy_json_attr(pagy, :nav, tags, sequels, pagy.label_sequels(sequels))}></nav>)
23
23
  end
24
24
 
25
- # Javascript combo pagination: it returns a nav and a JSON tag used by the Pagy.combo_nav javascript
25
+ # Javascript combo pagination: it returns a nav and a JSON tag used by the pagy.js file
26
26
  def pagy_combo_nav_js(pagy, pagy_id: nil, link_extra: '')
27
27
  p_id = %( id="#{pagy_id}") if pagy_id
28
28
  link = pagy_link_proc(pagy, link_extra: link_extra)
@@ -32,7 +32,7 @@ class Pagy # :nodoc:
32
32
  p_page}" style="padding: 0; text-align: center; width: #{p_pages.to_s.length + 1}rem;">)
33
33
 
34
34
  %(<nav#{p_id} class="pagy-combo-nav-js pagination" aria-label="pager" #{
35
- pagy_json_attr pagy, :combo_nav, pagy_marked_link(link)}>#{
35
+ pagy_json_attr pagy, :combo, pagy_marked_link(link)}>#{
36
36
  pagy_nav_prev_html pagy, link
37
37
  }<span class="pagy-combo-input" style="margin: 0 0.6rem;">#{
38
38
  pagy_t 'pagy.combo_nav_js', page_input: input, count: p_page, pages: p_pages
@@ -26,7 +26,7 @@ class Pagy # :nodoc:
26
26
  html << %(</div>)
27
27
  end
28
28
 
29
- # Javascript pagination for semantic: it returns a nav and a JSON tag used by the Pagy.nav javascript
29
+ # Javascript pagination for semantic: it returns a nav and a JSON tag used by the pagy.js file
30
30
  def pagy_semantic_nav_js(pagy, pagy_id: nil, link_extra: '', **vars)
31
31
  sequels = pagy.sequels(**vars)
32
32
  p_id = %( id="#{pagy_id}") if pagy_id
@@ -41,7 +41,7 @@ class Pagy # :nodoc:
41
41
  pagy_json_attr(pagy, :nav, tags, sequels, pagy.label_sequels(sequels))}></div>)
42
42
  end
43
43
 
44
- # Combo pagination for semantic: it returns a nav and a JSON tag used by the Pagy.combo_nav javascript
44
+ # Combo pagination for semantic: it returns a nav and a JSON tag used by the pagy.js file
45
45
  def pagy_semantic_combo_nav_js(pagy, pagy_id: nil, link_extra: '')
46
46
  p_id = %( id="#{pagy_id}") if pagy_id
47
47
  link = pagy_link_proc(pagy, link_extra: %(class="item" #{link_extra}))
@@ -51,7 +51,7 @@ class Pagy # :nodoc:
51
51
  p_page}" style="padding: 0; text-align: center; width: #{p_pages.to_s.length + 1}rem; margin: 0 0.3rem">)
52
52
 
53
53
  %(<div#{p_id} class="pagy-semantic-combo-nav-js ui compact menu" role="navigation" #{
54
- pagy_json_attr pagy, :combo_nav, pagy_marked_link(link)}>#{
54
+ pagy_json_attr pagy, :combo, pagy_marked_link(link)}>#{
55
55
  pagy_semantic_prev_html pagy, link
56
56
  }<div class="pagy-combo-input item">#{
57
57
  pagy_t 'pagy.combo_nav_js', page_input: input, count: p_page, pages: p_pages
@@ -25,7 +25,7 @@ class Pagy # :nodoc:
25
25
  html << %(</ul>)
26
26
  end
27
27
 
28
- # Javascript pagination for uikit: it returns a nav and a JSON tag used by the Pagy.nav javascript
28
+ # Javascript pagination for uikit: it returns a nav and a JSON tag used by the pagy.js file
29
29
  def pagy_uikit_nav_js(pagy, pagy_id: nil, link_extra: '', **vars)
30
30
  sequels = pagy.sequels(**vars)
31
31
  p_id = %( id="#{pagy_id}") if pagy_id
@@ -40,7 +40,7 @@ class Pagy # :nodoc:
40
40
  pagy_json_attr(pagy, :nav, tags, sequels, pagy.label_sequels(sequels))}></ul>)
41
41
  end
42
42
 
43
- # Javascript combo pagination for uikit: it returns a nav and a JSON tag used by the Pagy.combo_nav javascript
43
+ # Javascript combo pagination for uikit: it returns a nav and a JSON tag used by the pagy.js file
44
44
  def pagy_uikit_combo_nav_js(pagy, pagy_id: nil, link_extra: '')
45
45
  p_id = %( id="#{pagy_id}") if pagy_id
46
46
  link = pagy_link_proc(pagy, link_extra: link_extra)
@@ -50,7 +50,7 @@ class Pagy # :nodoc:
50
50
  p_page}" style="text-align: center; width: #{p_pages.to_s.length + 1}rem;">)
51
51
 
52
52
  %(<ul#{p_id} class="pagy-uikit-combo-nav-js uk-button-group uk-pagination uk-flex-center" #{
53
- pagy_json_attr pagy, :combo_nav, pagy_marked_link(link)
53
+ pagy_json_attr pagy, :combo, pagy_marked_link(link)
54
54
  }>#{
55
55
  pagy_uikit_prev_html pagy, link
56
56
  }<li>#{
data/lib/pagy.rb CHANGED
@@ -5,7 +5,7 @@ require 'pathname'
5
5
 
6
6
  # Core class
7
7
  class Pagy
8
- VERSION = '5.7.1'
8
+ VERSION = '5.7.2'
9
9
 
10
10
  # Root pathname to get the path of Pagy files like templates or dictionaries
11
11
  def self.root
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagy
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.7.1
4
+ version: 5.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Domizio Demichelis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-08 00:00:00.000000000 Z
11
+ date: 2022-01-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Agnostic pagination in plain ruby. It does it all. Better.
14
14
  email:
@@ -19,8 +19,8 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - LICENSE.txt
21
21
  - lib/config/pagy.rb
22
+ - lib/javascripts/pagy-dev.js
22
23
  - lib/javascripts/pagy.js
23
- - lib/javascripts/pagy.js.map
24
24
  - lib/locales/ar.yml
25
25
  - lib/locales/bg.yml
26
26
  - lib/locales/bs.yml
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/pagy.ts"],"names":[],"mappings":"8mEAsBA,GAAM,CAAA,IAAI,CAAG,CACT,OAAO,CAAE,OADA,CAIT,IAJS,eAIJ,CAJI,CAIgB,OACf,CAAM,CAAK,CAAG,WAAY,CAAA,OAAf,CAAyB,CAAzB,CAA+B,QAD3B,CAEf,CAAQ,CAAG,CAAM,CAAC,gBAAP,CAAwB,kBAAxB,CAFI,CAGf,CAAI,CAAO,SAAC,CAAD,CAAa,CAAb,QAA6B,CAAA,OAAO,CAAC,IAAR,CAAa,qCAAb,CAAoD,CAApD,CAAwD,CAAxD,CAA7B,CAHI,8BAIC,CAJD,MAIrB,2BAAgC,IAArB,CAAA,CAAqB,SACtB,CAAI,CAAG,CAAO,CAAC,YAAR,CAAqB,gBAArB,CADe,CA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Ab,CAAkE,EAAlE,CAA/B,CAvGG,CAAb","file":"pagy.js","sourcesContent":["// This file is the source that generates pagy.js, polyfilled with the `@babel/preset-env` `\"useBuiltIns\": \"entry\"`.\n// You can generate a custom targeted javascript file for the browsers you need by changing that settings in package.json,\n// then compile it with `npm run compile -w src`.\n\n// Args types and interfaces from data-pagy-json\ntype PagyJSON = readonly [\"nav\", ...NavArgs] | [\"combo_nav\", ...ComboNavArgs] | [\"items_selector\", ...ItemsSelectorArgs]\ntype NavArgs = readonly [NavTags, NavSequels, null|NavLabelSequels, string?]\ntype ComboNavArgs = readonly [string, string?]\ntype ItemsSelectorArgs = readonly [number, string, string?]\n\ninterface NavTags {\n readonly before: string\n readonly link: string\n readonly active: string\n readonly gap: string\n readonly after: string\n}\ninterface NavSequels { readonly [width:string]: (string|number|\"gap\")[] }\ninterface NavLabelSequels { readonly [width:string]: string[] }\ninterface Element { pagyRender(): void }\n\n// The Pagy object\nconst Pagy = {\n version: \"5.7.1\",\n\n // Scan for \"data-pagy-json\" elements, parse their JSON content and call their init functions\n init(arg?:Element|never) {\n const target = arg instanceof Element ? arg : document;\n const elements = target.querySelectorAll(\"[data-pagy-json]\");\n const warn = (el:Element, err:unknown) => console.warn(\"Pagy.init() skipped element: %o\\n%s\", el, err);\n for (const element of elements) {\n const json = element.getAttribute(\"data-pagy-json\") as string;\n try {\n const [keyword, ...args] = JSON.parse(json) as PagyJSON;\n if (keyword === \"nav\") {\n Pagy.initNav(element, args as NavArgs);\n } else if (keyword === \"combo_nav\") {\n Pagy.initComboNav(element, args as ComboNavArgs);\n } else if (keyword === \"items_selector\") {\n Pagy.initItemsSelector(element, args as ItemsSelectorArgs);\n } else {\n warn(element, `Illegal PagyJSON keyword: expected \"nav\"|\"combo_nav\"|\"items_selector\" got \"${keyword}\"`);\n }\n } catch (err) { warn(element, err) }\n }\n },\n\n // Init the *_nav_js helpers\n initNav(el:Element, [tags, sequels, labelSequels, trimParam]:NavArgs) {\n const container = el.parentElement ?? el;\n const widths = Object.getOwnPropertyNames(sequels).map(w => parseInt(w)).sort((a, b) => b - a);\n let lastWidth = -1;\n const fillIn = (link:string, page:string, label:string):string =>\n link.replace(/__pagy_page__/g, page).replace(/__pagy_label__/g, label);\n (el.pagyRender = function() {\n const width = widths.find(w => w < container.clientWidth) || 0;\n if (width === lastWidth) { return } // no change: abort\n let html = tags.before;\n const series = sequels[width.toString()];\n const labels = labelSequels?.[width.toString()] ?? series.map(l => l.toString());\n for (const i in series) {\n const item = series[i];\n const label = labels[i];\n if (typeof trimParam === \"string\" && item === 1) {\n html += Pagy.trim(fillIn(tags.link, item.toString(), label), trimParam);\n } else if (typeof item === \"number\") {\n html += fillIn(tags.link, item.toString(), label);\n } else if (item === \"gap\") {\n html += tags.gap;\n } else { // active page\n html += fillIn(tags.active, item, label);\n }\n }\n html += tags.after; // eslint-disable-line align-assignments/align-assignments\n el.innerHTML = \"\";\n el.insertAdjacentHTML(\"afterbegin\", html);\n lastWidth = width;\n })();\n if (el.classList.contains(\"pagy-rjs\")) { Pagy.rjsObserver.observe(container) }\n },\n\n // The observer instance for responsive navs\n rjsObserver: new ResizeObserver(entries => {\n entries.filter(e => e.contentBoxSize)\n .forEach(e => e.target.querySelectorAll(\".pagy-rjs\")\n .forEach(rjs => rjs.pagyRender()));\n }),\n\n // Init the *_combo_nav_js helpers\n initComboNav(el:Element, [link, trimParam]:ComboNavArgs) {\n Pagy.initInput(el, inputValue => [inputValue, link.replace(/__pagy_page__/, inputValue)], trimParam);\n },\n\n // Init the items_selector_js helper\n initItemsSelector(el:Element, [from, link, trimParam]:ItemsSelectorArgs) {\n Pagy.initInput(el, inputValue => {\n const page = Math.max(Math.ceil(from / parseInt(inputValue)), 1).toString();\n const html = link.replace(/__pagy_page__/, page).replace(/__pagy_items__/, inputValue);\n return [page, html];\n }, trimParam);\n },\n\n // Init the input element\n initInput(el:Element, getVars:(v:string)=>[string, string], trimParam?:string) {\n const input = el.querySelector(\"input\") as HTMLInputElement;\n const initial = input.value;\n const action = function() {\n if (input.value === initial) { return } // not changed\n const [min, val, max] = [input.min, input.value, input.max].map(n => parseInt(n) || 0);\n if (val < min || val > max) { // reset invalid/out-of-range\n input.value = initial;\n input.select();\n return;\n }\n let [page, html] = getVars(input.value); // eslint-disable-line prefer-const\n if (typeof trimParam === \"string\" && page === \"1\") { html = Pagy.trim(html, trimParam) }\n el.insertAdjacentHTML(\"afterbegin\", html);\n (el.querySelector(\"a\") as HTMLAnchorElement).click();\n };\n [\"change\", \"focus\"].forEach(e => input.addEventListener(e, input.select)); // auto-select\n input.addEventListener(\"focusout\", action); // trigger action\n input.addEventListener(\"keypress\", e => { if (e.key === \"Enter\") { action() } }); // trigger action\n },\n\n // Trim the ${page-param}=1 params in links\n trim: (link:string, param:string) => link.replace(new RegExp(`[?&]${param}=1\\\\b(?!&)|\\\\b${param}=1&`), \"\")\n};\n"]}