pagy 43.4.4 → 43.5.1

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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/apps/calendar.ru +1 -1
  3. data/apps/demo.ru +2 -2
  4. data/apps/keynav+root_key.ru +1 -1
  5. data/apps/keynav.ru +3 -3
  6. data/apps/keyset.ru +3 -3
  7. data/apps/keyset_sequel.ru +2 -2
  8. data/apps/rails.ru +2 -2
  9. data/apps/repro.ru +3 -3
  10. data/config/pagy.rb +9 -18
  11. data/javascripts/pagy.js +20 -12
  12. data/javascripts/pagy.min.js +1 -1
  13. data/javascripts/pagy.mjs +18 -10
  14. data/lib/pagy/classes/calendar/calendar.rb +6 -8
  15. data/lib/pagy/classes/calendar/unit.rb +10 -10
  16. data/lib/pagy/classes/exceptions.rb +3 -3
  17. data/lib/pagy/classes/keyset/adapters/active_record.rb +0 -6
  18. data/lib/pagy/classes/keyset/adapters/sequel.rb +1 -7
  19. data/lib/pagy/classes/keyset/keynav.rb +6 -6
  20. data/lib/pagy/classes/keyset/keyset.rb +7 -8
  21. data/lib/pagy/classes/offset/countless.rb +5 -10
  22. data/lib/pagy/classes/offset/offset.rb +2 -1
  23. data/lib/pagy/classes/offset/search.rb +1 -1
  24. data/lib/pagy/classes/request.rb +4 -1
  25. data/lib/pagy/cli.rb +8 -21
  26. data/lib/pagy/console.rb +2 -0
  27. data/lib/pagy/deprecated.rb +84 -0
  28. data/lib/pagy/modules/abilities/configurable.rb +1 -7
  29. data/lib/pagy/modules/abilities/countable.rb +1 -2
  30. data/lib/pagy/modules/abilities/linkable.rb +6 -5
  31. data/lib/pagy/modules/abilities/rangeable.rb +1 -2
  32. data/lib/pagy/modules/console.rb +1 -1
  33. data/lib/pagy/modules/i18n/i18n.rb +1 -1
  34. data/lib/pagy/modules/searcher.rb +0 -1
  35. data/lib/pagy/next.rb +25 -0
  36. data/lib/pagy/tasks/sync.rb +1 -0
  37. data/lib/pagy/toolbox/helpers/anchor_tags.rb +0 -2
  38. data/lib/pagy/toolbox/helpers/bootstrap/input_nav_js.rb +0 -1
  39. data/lib/pagy/toolbox/helpers/bootstrap/previous_next_html.rb +0 -1
  40. data/lib/pagy/toolbox/helpers/bootstrap/series_nav.rb +0 -1
  41. data/lib/pagy/toolbox/helpers/bootstrap/series_nav_js.rb +0 -1
  42. data/lib/pagy/toolbox/helpers/bulma/input_nav_js.rb +0 -1
  43. data/lib/pagy/toolbox/helpers/bulma/previous_next_html.rb +0 -1
  44. data/lib/pagy/toolbox/helpers/bulma/series_nav.rb +0 -1
  45. data/lib/pagy/toolbox/helpers/bulma/series_nav_js.rb +0 -1
  46. data/lib/pagy/toolbox/helpers/headers_hash.rb +1 -1
  47. data/lib/pagy/toolbox/helpers/info_tag.rb +2 -2
  48. data/lib/pagy/toolbox/helpers/input_nav_js.rb +0 -1
  49. data/lib/pagy/toolbox/helpers/limit_tag_js.rb +3 -4
  50. data/lib/pagy/toolbox/helpers/loaders.rb +1 -1
  51. data/lib/pagy/toolbox/helpers/page_url.rb +0 -1
  52. data/lib/pagy/toolbox/helpers/series_nav.rb +0 -1
  53. data/lib/pagy/toolbox/helpers/series_nav_js.rb +0 -1
  54. data/lib/pagy/toolbox/helpers/support/a_lambda.rb +2 -3
  55. data/lib/pagy/toolbox/helpers/support/data_pagy_attribute.rb +0 -1
  56. data/lib/pagy/toolbox/helpers/support/nav_aria_label_attribute.rb +0 -2
  57. data/lib/pagy/toolbox/helpers/support/series.rb +2 -2
  58. data/lib/pagy/toolbox/helpers/support/wrap_input_nav_js.rb +1 -2
  59. data/lib/pagy/toolbox/helpers/support/wrap_series_nav.rb +1 -2
  60. data/lib/pagy/toolbox/helpers/support/wrap_series_nav_js.rb +3 -3
  61. data/lib/pagy/toolbox/helpers/urls_hash.rb +0 -1
  62. data/lib/pagy/toolbox/paginators/calendar.rb +1 -1
  63. data/lib/pagy/toolbox/paginators/countish.rb +0 -1
  64. data/lib/pagy/toolbox/paginators/countless.rb +0 -1
  65. data/lib/pagy/toolbox/paginators/elasticsearch_rails.rb +2 -3
  66. data/lib/pagy/toolbox/paginators/keynav_js.rb +0 -2
  67. data/lib/pagy/toolbox/paginators/keyset.rb +0 -1
  68. data/lib/pagy/toolbox/paginators/meilisearch.rb +0 -1
  69. data/lib/pagy/toolbox/paginators/method.rb +1 -1
  70. data/lib/pagy/toolbox/paginators/offset.rb +0 -1
  71. data/lib/pagy/toolbox/paginators/searchkick.rb +0 -1
  72. data/lib/pagy/toolbox/paginators/typesense_rails.rb +0 -1
  73. data/lib/pagy.rb +6 -16
  74. metadata +5 -4
  75. data/sig/pagy.rbs +0 -315
data/sig/pagy.rbs DELETED
@@ -1,315 +0,0 @@
1
- # sig/pagy.rbs
2
-
3
- class Pagy
4
- VERSION: String
5
- ROOT: Pathname
6
- OPTIONS: options
7
-
8
- # @deprecated Use `Pagy::OPTIONS` instead
9
- def self.options: () -> options
10
-
11
- # @deprecated Use `sync(:javascript, ...)` instead
12
- def self.sync_javascript: (String destination, *String targets) -> void
13
-
14
- def self.sync: (Symbol resource, String destination, *String targets) -> void
15
- def self.dev_tools: (?wand_scale: Integer) -> String
16
- def self.translate_with_the_slower_i18n_gem!: () -> void
17
-
18
- class Offset < Pagy
19
- attr_reader offset: Integer
20
- attr_reader count: Integer
21
- attr_reader from: Integer
22
- attr_reader to: Integer
23
- attr_reader previous: Integer?
24
- attr_reader next: Integer?
25
- attr_reader last: Integer
26
-
27
- alias pages last
28
- end
29
-
30
- class Countish < Offset
31
- end
32
- class Countless < Offset
33
- attr_reader last: Integer?
34
- end
35
- class Keyset < Pagy
36
- class ActiveRecord < Keyset
37
- end
38
- class Sequel < Keyset
39
- end
40
- class Keynav < Keyset
41
- class ActiveRecord < Keyset
42
- end
43
- class Sequel < Keyset
44
- end
45
- end
46
-
47
- attr_reader records: Array[untyped]
48
- end
49
-
50
- class Calendar < ::Hash[Symbol, Calendar::Unit]
51
- def self.localize_with_rails_i18n_gem: (*Symbol locales) -> void
52
-
53
- def showtime: () -> ActiveSupport::TimeWithZone
54
- def url_at: (ActiveSupport::TimeWithZone time, **url_opts) -> String
55
-
56
- class Unit < Pagy
57
- attr_reader order: Symbol
58
- attr_reader from: ActiveSupport::TimeWithZone
59
- attr_reader to: ActiveSupport::TimeWithZone
60
- attr_reader previous: Integer?
61
- attr_reader last: Integer
62
- alias pages last
63
- end
64
-
65
- class Year < Unit
66
- end
67
- class Quarter < Unit
68
- end
69
- class Month < Unit
70
- end
71
- class Week < Unit
72
- end
73
- class Day < Unit
74
- end
75
- end
76
-
77
- class SearchBase < Offset
78
- end
79
-
80
- class ElasticsearchRails < SearchBase
81
- end
82
-
83
- class Meilisearch < SearchBase
84
- end
85
-
86
- class Searchkick < SearchBase
87
- end
88
-
89
- class TypesenseRails < SearchBase
90
- end
91
-
92
- module Search
93
- class Arguments < Array[untyped]
94
- end
95
-
96
- def pagy_search: (*untyped arguments, untyped) -> Search::Arguments
97
- end
98
-
99
- class Method
100
- interface _Collection
101
- def offset: (Integer offset) -> _Collection
102
- def limit: (Integer limit) -> _Collection
103
- end
104
-
105
-
106
- type collection = _Collection | Array[untyped]
107
-
108
- def pagy: (:offset, collection collection, **offset_opts options) -> [Offset, collection]
109
- | (:countless, collection collection, **countless_opts options) -> [Countless, collection]
110
- | (:countish, collection collection, **countish_opts options) -> [Countish, collection]
111
-
112
- | (:keyset, ::ActiveRecord::Relation[untyped] set, **keyset_opts options) -> [Keyset::ActiveRecord, Array[::ActiveRecord::Base[untyped]]]
113
- | (:keyset, ::Sequel::Dataset[untyped] set, **keyset_opts options) -> [Keyset::Sequel, Array[::Sequel::Model[untyped]]]
114
-
115
- | (:keynav_js, ::ActiveRecord::Relation[untyped] set, **keyset_opts options) -> [Keyset::Keynav::ActiveRecord, Array[::ActiveRecord::Base[untyped]]]
116
- | (:keynav_js, ::Sequel::Dataset[untyped] set, **keyset_opts options) -> [Keyset::Keynav::Sequel, Array[::Sequel::Model[untyped]]]
117
-
118
- | (:calendar, _Collection collection, **calendar_config) -> [Calendar, Offset, _Collection]
119
-
120
- | (:elasticsearch_rails, Search::Arguments, **search_opts options) -> [ElasticsearchRails, untyped]
121
- | (:elasticsearch_rails, untyped search, **search_opts options) -> ElasticsearchRails
122
-
123
- | (:meilisearch, Search::Arguments, **search_opts options) -> [Meilisearch, untyped]
124
- | (:meilisearch, untyped search, **search_opts options) -> Meilisearch
125
-
126
- | (:searchkick, Search::Arguments, **search_opts options) -> [Searchkick, untyped]
127
- | (:searchkick, untyped search, **search_opts options) -> Searchkick
128
-
129
- | (:typesense_rails, Search::Arguments, **search_opts options) -> [TypesenseRails, untyped]
130
- | (:typesense_rails, untyped search, **search_opts options) -> TypesenseRails
131
- end
132
-
133
- # Helper methods
134
- def data_hash: (**data_opts) -> pagy_data_hash
135
- def headers_hash: (**headers_opts) -> Hash[String, String]
136
- def urls_hash: (**url_opts) -> Hash[Symbol, String]
137
-
138
- def page_url: (:first | :current | :page | :previous | :next | :last | Integer page, **url_opts) -> String
139
- def next_tag: (String? text, **anchor_tags_opts) -> String
140
-
141
- module NumericHelpers
142
- def series_nav: (?Symbol? style, **series_nav_opts) -> String
143
- def series_nav_js: (?Symbol? style, **series_nav_js_opts) -> String
144
- def input_nav_js: (?Symbol? style, **nav_opts) -> String
145
-
146
- def previous_tag: (String? text, **anchor_tags_opts) -> String
147
- def limit_tag_js: (?id: String?, ?item_name: String?, **url_opts) -> String
148
- def info_tag: (?id: String?, ?item_name: String?) -> String
149
- end
150
-
151
- ##### OPTIONS #####
152
-
153
- type url_opts = {
154
- ?fragment: String,
155
- ?absolute: bool,
156
- ?path: String,
157
- ?querify: Proc,
158
- ?jsonapi: bool,
159
- ?root_key: String,
160
- ?page_key: String,
161
- ?limit_key: String,
162
- }
163
-
164
- ##### Paginator Options #####
165
-
166
- type paginator_opts = url_opts & {
167
- ?page: Integer,
168
- ?limit: Integer,
169
- ?max_pages: Integer,
170
- ?client_max_limit: Integer,
171
- ?request: _RackRequest | request_hash
172
- }
173
-
174
- type offset_opts = paginator_opts & {
175
- ?count: Integer,
176
- ?count_over: bool,
177
- ?raise_range_error: bool
178
- }
179
-
180
- type countish_opts = offset_opts & {
181
- ?ttl: Integer,
182
- ?epoch: Integer
183
- }
184
-
185
- type countless_opts = offset_opts & {
186
- ?headless: bool
187
- }
188
-
189
- type unit_opts = paginator_opts & {
190
- ?slots: Integer,
191
- ?compact: bool,
192
- ?format: String,
193
- ?order: Symbol
194
- }
195
-
196
- type calendar_config = {
197
- ?year: unit_opts,
198
- ?quarter: unit_opts,
199
- ?month: unit_opts,
200
- ?week: unit_opts,
201
- ?day: unit_opts,
202
- ?offset: offset_opts,
203
- ?disabled: bool
204
- }
205
-
206
- type keyset_opts = paginator_opts & {
207
- ?keyset: Hash[untyped, untyped],
208
- ?tuple_comparison: bool,
209
- ?pre_serialize: Proc
210
- }
211
-
212
- type search_opts = {
213
- ?search_method: Symbol
214
- }
215
-
216
- ##### Helper Options #####
217
-
218
- ### data_hash ###
219
- type pagy_data_key = :url_template | :first_url | :previous_url | :current_url
220
- | :page_url | :next_url | :last_url | :count | :page
221
- | :limit | :last | :in | :from | :to | :previous
222
- | :next | :options | Symbol
223
-
224
- # The return structure with optional keys (marked with ?)
225
- type pagy_data_hash = {
226
- ?url_template: String,
227
- ?first_url: String,
228
- ?previous_url: String,
229
- ?current_url: String,
230
- ?page_url: String,
231
- ?next_url: String,
232
- ?last_url: String,
233
- ?count: Integer,
234
- ?page: Integer,
235
- ?limit: Integer,
236
- ?last: Integer,
237
- ?in: Integer,
238
- ?from: Integer,
239
- ?to: Integer,
240
- ?previous: Integer,
241
- ?next: Integer,
242
- ?options: options
243
- } & Hash[Symbol, untyped] # Intersection allows for 'send' method results
244
-
245
- type data_opts = url_opts & {
246
- ?data_keys: Array[pagy_data_key]
247
- }
248
-
249
- type headers_opts = url_opts & {
250
- ?headers_map: Hash[Symbol, String]
251
- }
252
-
253
- ##### NumericUI Options #####
254
- type anchor_tags_opts = url_opts & {
255
- ?text: String,
256
- ?aria_label: String
257
- }
258
-
259
- type nav_opts = url_opts & {
260
- ?id: String,
261
- ?aria_label: String,
262
- ?item_name: String,
263
- ?style: :pagy | :bootstrap | :bulma,
264
- ?anchor_string: String
265
- }
266
-
267
- type series_nav_opts = nav_opts & {
268
- ?slots: Integer,
269
- ?compact: bool,
270
- }
271
-
272
- type series_nav_js_opts = series_nav_opts & {
273
- ?steps: Hash[Integer, Integer]
274
- }
275
-
276
- type options = url_opts & paginator_opts & offset_opts & countish_opts & countless_opts &
277
- unit_opts & keyset_opts & search_opts &
278
- anchor_tags_opts & nav_opts & data_opts & headers_opts & nav_opts & series_nav_opts & series_nav_js_opts
279
-
280
- ##### REQUEST #####
281
-
282
- interface _RackRequest
283
- def base_url: () -> String
284
- def path: () -> String
285
- def GET: () -> Hash[String, untyped]
286
- def POST: () -> Hash[String, untyped]
287
- def cookies: () -> Hash[String, String]
288
- end
289
-
290
- type request_hash = {
291
- base_url: String,
292
- path: String,
293
- params: Hash[String, untyped],
294
- ?cookie: String
295
- }
296
- end
297
-
298
- module ActiveRecord
299
- class Base[T]
300
- end
301
- class Relation[T]
302
- end
303
- end
304
-
305
- module ActiveSupport
306
- class TimeWithZone
307
- end
308
- end
309
-
310
- module Sequel
311
- class Dataset[T]
312
- end
313
- class Model[T]
314
- end
315
- end