diff --git a/.github/ISSUE_TEMPLATE/Code.yml b/.github/ISSUE_TEMPLATE/Code.yml index 234119463..933871692 100644 --- a/.github/ISSUE_TEMPLATE/Code.yml +++ b/.github/ISSUE_TEMPLATE/Code.yml @@ -19,7 +19,7 @@ body: attributes: label: 👀 Before submitting... options: - - label: I upgraded to pagy version 9.1.0 + - label: I upgraded to pagy version 9.1.1 required: true - label: I searched through the [Documentation](https://ddnexus.github.io/pagy/) required: true diff --git a/.github/latest_release_body.md b/.github/latest_release_body.md index d08209ed5..a7aa38221 100644 --- a/.github/latest_release_body.md +++ b/.github/latest_release_body.md @@ -6,10 +6,10 @@ - See the [Changelog](https://ddnexus.github.io/pagy/changelog) for possible breaking changes -### Changes in 9.1.0 +### Changes in 9.1.1 -- Add Dzongkha (dz locale) (#741) +- Simplify calendar code [CHANGELOG](https://ddnexus.github.io/pagy/changelog) diff --git a/.github/workflows/ruby-test.yml b/.github/workflows/ruby-test.yml index aa8316581..318cddca9 100644 --- a/.github/workflows/ruby-test.yml +++ b/.github/workflows/ruby-test.yml @@ -45,7 +45,10 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ['3.1', '3.2', '3.3'] + # Tired to fix dependencies problem of other projects + # zeitwerk 2.7+ is used by the last rails and it requires ruby 3.2 + # ruby-version: ['3.1', '3.2', '3.3'] + ruby-version: ['3.2', '3.3'] fail-fast: false steps: - uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c7e6cb3b..34e8fd517 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,10 @@ If you upgrade from version `< 9.0.0` see the following: - None
+## Version 9.1.1 + +- Simplify calendar code + ## Version 9.1.0 - Add Dzongkha (dz locale) (#741) diff --git a/Gemfile b/Gemfile index 37e24682e..04cc904cd 100644 --- a/Gemfile +++ b/Gemfile @@ -37,8 +37,6 @@ group :playground do # activerecord/sqlite3_adapter.rb probably useless) constraint !!! # https://github.com/rails/rails/blame/v7.1.3.4/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L14 gem 'sqlite3', '~> 1.4.0' - # Required because 2.7 requires ruby 3.2 and we are still testing 3.1 - gem 'zeitwerk', '< 2.7' end # group :performance do diff --git a/Gemfile.lock b/Gemfile.lock index 021735e32..4ceb6c0d3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,34 +1,34 @@ PATH remote: gem specs: - pagy (9.1.0) + pagy (9.1.1) GEM remote: https://rubygems.org/ specs: - actioncable (7.2.1.1) - actionpack (= 7.2.1.1) - activesupport (= 7.2.1.1) + actioncable (7.2.1.2) + actionpack (= 7.2.1.2) + activesupport (= 7.2.1.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.2.1.1) - actionpack (= 7.2.1.1) - activejob (= 7.2.1.1) - activerecord (= 7.2.1.1) - activestorage (= 7.2.1.1) - activesupport (= 7.2.1.1) + actionmailbox (7.2.1.2) + actionpack (= 7.2.1.2) + activejob (= 7.2.1.2) + activerecord (= 7.2.1.2) + activestorage (= 7.2.1.2) + activesupport (= 7.2.1.2) mail (>= 2.8.0) - actionmailer (7.2.1.1) - actionpack (= 7.2.1.1) - actionview (= 7.2.1.1) - activejob (= 7.2.1.1) - activesupport (= 7.2.1.1) + actionmailer (7.2.1.2) + actionpack (= 7.2.1.2) + actionview (= 7.2.1.2) + activejob (= 7.2.1.2) + activesupport (= 7.2.1.2) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.2.1.1) - actionview (= 7.2.1.1) - activesupport (= 7.2.1.1) + actionpack (7.2.1.2) + actionview (= 7.2.1.2) + activesupport (= 7.2.1.2) nokogiri (>= 1.8.5) racc rack (>= 2.2.4, < 3.2) @@ -37,35 +37,35 @@ GEM rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (7.2.1.1) - actionpack (= 7.2.1.1) - activerecord (= 7.2.1.1) - activestorage (= 7.2.1.1) - activesupport (= 7.2.1.1) + actiontext (7.2.1.2) + actionpack (= 7.2.1.2) + activerecord (= 7.2.1.2) + activestorage (= 7.2.1.2) + activesupport (= 7.2.1.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.2.1.1) - activesupport (= 7.2.1.1) + actionview (7.2.1.2) + activesupport (= 7.2.1.2) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.2.1.1) - activesupport (= 7.2.1.1) + activejob (7.2.1.2) + activesupport (= 7.2.1.2) globalid (>= 0.3.6) - activemodel (7.2.1.1) - activesupport (= 7.2.1.1) - activerecord (7.2.1.1) - activemodel (= 7.2.1.1) - activesupport (= 7.2.1.1) + activemodel (7.2.1.2) + activesupport (= 7.2.1.2) + activerecord (7.2.1.2) + activemodel (= 7.2.1.2) + activesupport (= 7.2.1.2) timeout (>= 0.4.0) - activestorage (7.2.1.1) - actionpack (= 7.2.1.1) - activejob (= 7.2.1.1) - activerecord (= 7.2.1.1) - activesupport (= 7.2.1.1) + activestorage (7.2.1.2) + actionpack (= 7.2.1.2) + activejob (= 7.2.1.2) + activerecord (= 7.2.1.2) + activesupport (= 7.2.1.2) marcel (~> 1.0) - activesupport (7.2.1.1) + activesupport (7.2.1.2) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) @@ -115,7 +115,7 @@ GEM irb (1.14.1) rdoc (>= 4.0.0) reline (>= 0.4.2) - json (2.7.2) + json (2.7.4) language_server-protocol (3.17.0.3) listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) @@ -124,7 +124,7 @@ GEM ffi-compiler (~> 1.0) rake (~> 13.0) logger (1.6.1) - loofah (2.22.0) + loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -153,7 +153,7 @@ GEM timeout net-smtp (0.5.0) net-protocol - nio4r (2.7.3) + nio4r (2.7.4) nokogiri (1.16.7-x86_64-darwin) racc (~> 1.4) nokogiri (1.16.7-x86_64-linux) @@ -183,20 +183,20 @@ GEM rackup (2.1.0) rack (>= 3) webrick (~> 1.8) - rails (7.2.1.1) - actioncable (= 7.2.1.1) - actionmailbox (= 7.2.1.1) - actionmailer (= 7.2.1.1) - actionpack (= 7.2.1.1) - actiontext (= 7.2.1.1) - actionview (= 7.2.1.1) - activejob (= 7.2.1.1) - activemodel (= 7.2.1.1) - activerecord (= 7.2.1.1) - activestorage (= 7.2.1.1) - activesupport (= 7.2.1.1) + rails (7.2.1.2) + actioncable (= 7.2.1.2) + actionmailbox (= 7.2.1.2) + actionmailer (= 7.2.1.2) + actionpack (= 7.2.1.2) + actiontext (= 7.2.1.2) + actionview (= 7.2.1.2) + activejob (= 7.2.1.2) + activemodel (= 7.2.1.2) + activerecord (= 7.2.1.2) + activestorage (= 7.2.1.2) + activesupport (= 7.2.1.2) bundler (>= 1.15.0) - railties (= 7.2.1.1) + railties (= 7.2.1.2) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -204,9 +204,9 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.2.1.1) - actionpack (= 7.2.1.1) - activesupport (= 7.2.1.1) + railties (7.2.1.2) + actionpack (= 7.2.1.2) + activesupport (= 7.2.1.2) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) @@ -284,7 +284,7 @@ GEM websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.18) + zeitwerk (2.7.1) PLATFORMS x86_64-darwin-21 @@ -318,7 +318,6 @@ DEPENDENCIES sinatra sinatra-contrib sqlite3 (~> 1.4.0) - zeitwerk (< 2.7) BUNDLED WITH 2.5.11 diff --git a/README.md b/README.md index 402598f9a..8e2ff3a76 100644 --- a/README.md +++ b/README.md @@ -282,7 +282,7 @@ See also the [How To Page](https://ddnexus.github.io/pagy/docs/how-to) -[](https://github.com/ddnexus/pagy/commits?author=ddnexus)[](https://github.com/ddnexus/pagy/commits?author=benkoshy)[](https://github.com/ddnexus/pagy/commits?author=grosser)[](https://github.com/ddnexus/pagy/commits?author=Earlopain)[](https://github.com/ddnexus/pagy/commits?author=workgena)[](https://github.com/ddnexus/pagy/commits?author=espen)[](https://github.com/ddnexus/pagy/commits?author=enzinia)[](https://github.com/ddnexus/pagy/commits?author=sunny)[](https://github.com/ddnexus/pagy/commits?author=molfar)[](https://github.com/ddnexus/pagy/commits?author=bquorning)[](https://github.com/ddnexus/pagy/commits?author=djpremier)[](https://github.com/ddnexus/pagy/commits?author=747)[](https://github.com/ddnexus/pagy/commits?author=tersor)[](https://github.com/ddnexus/pagy/commits?author=thomasklemm)[](https://github.com/ddnexus/pagy/commits?author=gamafranco)[](https://github.com/ddnexus/pagy/commits?author=tiagotex)[](https://github.com/ddnexus/pagy/commits?author=wimdavies)[](https://github.com/ddnexus/pagy/commits?author=renshuki)[](https://github.com/ddnexus/pagy/commits?author=berniechiu)[](https://github.com/ddnexus/pagy/commits?author=ashmaroli)[](https://github.com/ddnexus/pagy/commits?author=cseelus)[](https://github.com/ddnexus/pagy/commits?author=sabljak)[](https://github.com/ddnexus/pagy/commits?author=petergoldstein)[](https://github.com/ddnexus/pagy/commits?author=rainerborene)[](https://github.com/ddnexus/pagy/commits?author=rbngzlv)[](https://github.com/ddnexus/pagy/commits?author=simonneutert)[](https://github.com/ddnexus/pagy/commits?author=artplan1)[](https://github.com/ddnexus/pagy/commits?author=serghost)[](https://github.com/ddnexus/pagy/commits?author=Tolchi)[](https://github.com/ddnexus/pagy/commits?author=rogermarlow)[](https://github.com/ddnexus/pagy/commits?author=yenshirak)[](https://github.com/ddnexus/pagy/commits?author=rafaelmontas)[](https://github.com/ddnexus/pagy/commits?author=rafaeelaudibert)[](https://github.com/ddnexus/pagy/commits?author=pedrocarmona)[](https://github.com/ddnexus/pagy/commits?author=olleolleolle)[](https://github.com/ddnexus/pagy/commits?author=olieidel)[](https://github.com/ddnexus/pagy/commits?author=okuramasafumi)[](https://github.com/ddnexus/pagy/commits?author=WilliamHorel)[](https://github.com/ddnexus/pagy/commits?author=woller)[](https://github.com/ddnexus/pagy/commits?author=sk8higher)[](https://github.com/ddnexus/pagy/commits?author=muhammadnawzad)[](https://github.com/ddnexus/pagy/commits?author=ronald)[](https://github.com/ddnexus/pagy/commits?author=achmiral)[](https://github.com/ddnexus/pagy/commits?author=mauro-ni)[](https://github.com/ddnexus/pagy/commits?author=borama)[](https://github.com/ddnexus/pagy/commits?author=creativetags)[](https://github.com/ddnexus/pagy/commits?author=mcary)[](https://github.com/ddnexus/pagy/commits?author=marckohlbrugge)[](https://github.com/ddnexus/pagy/commits?author=fluser)[](https://github.com/ddnexus/pagy/commits?author=maful)[](https://github.com/ddnexus/pagy/commits?author=AngelGuerra)[](https://github.com/ddnexus/pagy/commits?author=tr4b4nt)[](https://github.com/ddnexus/pagy/commits?author=tiejianluo)[](https://github.com/ddnexus/pagy/commits?author=szTheory)[](https://github.com/ddnexus/pagy/commits?author=smoothdvd)[](https://github.com/ddnexus/pagy/commits?author=rhodes-david)[](https://github.com/ddnexus/pagy/commits?author=radinreth)[](https://github.com/ddnexus/pagy/commits?author=pranavbabu)[](https://github.com/ddnexus/pagy/commits?author=okliv)[](https://github.com/ddnexus/pagy/commits?author=nedimdz)[](https://github.com/ddnexus/pagy/commits?author=msdundar)[](https://github.com/ddnexus/pagy/commits?author=m-abdurrehman)[](https://github.com/ddnexus/pagy/commits?author=dwieringa)[](https://github.com/ddnexus/pagy/commits?author=jyuvaraj03)[](https://github.com/ddnexus/pagy/commits?author=YutoYasunaga)[](https://github.com/ddnexus/pagy/commits?author=iamyujinwon)[](https://github.com/ddnexus/pagy/commits?author=yhk1038)[](https://github.com/ddnexus/pagy/commits?author=ya-s-u)[](https://github.com/ddnexus/pagy/commits?author=yshmarov)[](https://github.com/ddnexus/pagy/commits?author=thattimc)[](https://github.com/ddnexus/pagy/commits?author=thomaschauffour)[](https://github.com/ddnexus/pagy/commits?author=snkashis)[](https://github.com/ddnexus/pagy/commits?author=sliminas)[](https://github.com/ddnexus/pagy/commits?author=Federico-G)[](https://github.com/ddnexus/pagy/commits?author=egimenos)[](https://github.com/ddnexus/pagy/commits?author=elliotlarson)[](https://github.com/ddnexus/pagy/commits?author=hungdiep97)[](https://github.com/ddnexus/pagy/commits?author=davidwessman)[](https://github.com/ddnexus/pagy/commits?author=david-a-wheeler)[](https://github.com/ddnexus/pagy/commits?author=daniel-rikowski)[](https://github.com/ddnexus/pagy/commits?author=connie-feng)[](https://github.com/ddnexus/pagy/commits?author=MrMoins)[](https://github.com/ddnexus/pagy/commits?author=excid3)[](https://github.com/ddnexus/pagy/commits?author=cellvinchung)[](https://github.com/ddnexus/pagy/commits?author=brunoocasali)[](https://github.com/ddnexus/pagy/commits?author=branson-simplethread)[](https://github.com/ddnexus/pagy/commits?author=BrandonKlotz)[](https://github.com/ddnexus/pagy/commits?author=benjaminwols)[](https://github.com/ddnexus/pagy/commits?author=Atul9)[](https://github.com/ddnexus/pagy/commits?author=amenon)[](https://github.com/ddnexus/pagy/commits?author=artinboghosian)[](https://github.com/ddnexus/pagy/commits?author=antonzaharia)[](https://github.com/ddnexus/pagy/commits?author=PyrinAndrii)[](https://github.com/ddnexus/pagy/commits?author=andrew)[](https://github.com/ddnexus/pagy/commits?author=AliOsm)[](https://github.com/ddnexus/pagy/commits?author=AbelToy)[](https://github.com/ddnexus/pagy/commits?author=LuukvH)[](https://github.com/ddnexus/pagy/commits?author=loed-idzinga)[](https://github.com/ddnexus/pagy/commits?author=epeirce)[](https://github.com/ddnexus/pagy/commits?author=kobusjoubert) +[](https://github.com/ddnexus/pagy/commits?author=ddnexus)[](https://github.com/ddnexus/pagy/commits?author=benkoshy)[](https://github.com/ddnexus/pagy/commits?author=grosser)[](https://github.com/ddnexus/pagy/commits?author=Earlopain)[](https://github.com/ddnexus/pagy/commits?author=workgena)[](https://github.com/ddnexus/pagy/commits?author=espen)[](https://github.com/ddnexus/pagy/commits?author=enzinia)[](https://github.com/ddnexus/pagy/commits?author=sunny)[](https://github.com/ddnexus/pagy/commits?author=molfar)[](https://github.com/ddnexus/pagy/commits?author=bquorning)[](https://github.com/ddnexus/pagy/commits?author=djpremier)[](https://github.com/ddnexus/pagy/commits?author=747)[](https://github.com/ddnexus/pagy/commits?author=tersor)[](https://github.com/ddnexus/pagy/commits?author=thomasklemm)[](https://github.com/ddnexus/pagy/commits?author=gamafranco)[](https://github.com/ddnexus/pagy/commits?author=tiagotex)[](https://github.com/ddnexus/pagy/commits?author=wimdavies)[](https://github.com/ddnexus/pagy/commits?author=renshuki)[](https://github.com/ddnexus/pagy/commits?author=berniechiu)[](https://github.com/ddnexus/pagy/commits?author=ashmaroli)[](https://github.com/ddnexus/pagy/commits?author=cseelus)[](https://github.com/ddnexus/pagy/commits?author=sabljak)[](https://github.com/ddnexus/pagy/commits?author=petergoldstein)[](https://github.com/ddnexus/pagy/commits?author=rainerborene)[](https://github.com/ddnexus/pagy/commits?author=rbngzlv)[](https://github.com/ddnexus/pagy/commits?author=simonneutert)[](https://github.com/ddnexus/pagy/commits?author=artplan1)[](https://github.com/ddnexus/pagy/commits?author=serghost)[](https://github.com/ddnexus/pagy/commits?author=Tolchi)[](https://github.com/ddnexus/pagy/commits?author=rogermarlow)[](https://github.com/ddnexus/pagy/commits?author=yenshirak)[](https://github.com/ddnexus/pagy/commits?author=rafaelmontas)[](https://github.com/ddnexus/pagy/commits?author=rafaeelaudibert)[](https://github.com/ddnexus/pagy/commits?author=pedrocarmona)[](https://github.com/ddnexus/pagy/commits?author=olleolleolle)[](https://github.com/ddnexus/pagy/commits?author=olieidel)[](https://github.com/ddnexus/pagy/commits?author=okuramasafumi)[](https://github.com/ddnexus/pagy/commits?author=WilliamHorel)[](https://github.com/ddnexus/pagy/commits?author=woller)[](https://github.com/ddnexus/pagy/commits?author=sk8higher)[](https://github.com/ddnexus/pagy/commits?author=muhammadnawzad)[](https://github.com/ddnexus/pagy/commits?author=ronald)[](https://github.com/ddnexus/pagy/commits?author=achmiral)[](https://github.com/ddnexus/pagy/commits?author=mauro-ni)[](https://github.com/ddnexus/pagy/commits?author=borama)[](https://github.com/ddnexus/pagy/commits?author=creativetags)[](https://github.com/ddnexus/pagy/commits?author=mcary)[](https://github.com/ddnexus/pagy/commits?author=marckohlbrugge)[](https://github.com/ddnexus/pagy/commits?author=fluser)[](https://github.com/ddnexus/pagy/commits?author=maful)[](https://github.com/ddnexus/pagy/commits?author=AngelGuerra)[](https://github.com/ddnexus/pagy/commits?author=tr4b4nt)[](https://github.com/ddnexus/pagy/commits?author=tiejianluo)[](https://github.com/ddnexus/pagy/commits?author=szTheory)[](https://github.com/ddnexus/pagy/commits?author=smoothdvd)[](https://github.com/ddnexus/pagy/commits?author=rhodes-david)[](https://github.com/ddnexus/pagy/commits?author=radinreth)[](https://github.com/ddnexus/pagy/commits?author=pranavbabu)[](https://github.com/ddnexus/pagy/commits?author=okliv)[](https://github.com/ddnexus/pagy/commits?author=nedimdz)[](https://github.com/ddnexus/pagy/commits?author=msdundar)[](https://github.com/ddnexus/pagy/commits?author=m-abdurrehman)[](https://github.com/ddnexus/pagy/commits?author=dwieringa)[](https://github.com/ddnexus/pagy/commits?author=jyuvaraj03)[](https://github.com/ddnexus/pagy/commits?author=YutoYasunaga)[](https://github.com/ddnexus/pagy/commits?author=iamyujinwon)[](https://github.com/ddnexus/pagy/commits?author=yhk1038)[](https://github.com/ddnexus/pagy/commits?author=ya-s-u)[](https://github.com/ddnexus/pagy/commits?author=yshmarov)[](https://github.com/ddnexus/pagy/commits?author=thattimc)[](https://github.com/ddnexus/pagy/commits?author=thomaschauffour)[](https://github.com/ddnexus/pagy/commits?author=snkashis)[](https://github.com/ddnexus/pagy/commits?author=sliminas)[](https://github.com/ddnexus/pagy/commits?author=LuukvH)[](https://github.com/ddnexus/pagy/commits?author=Federico-G)[](https://github.com/ddnexus/pagy/commits?author=egimenos)[](https://github.com/ddnexus/pagy/commits?author=elliotlarson)[](https://github.com/ddnexus/pagy/commits?author=hungdiep97)[](https://github.com/ddnexus/pagy/commits?author=davidwessman)[](https://github.com/ddnexus/pagy/commits?author=david-a-wheeler)[](https://github.com/ddnexus/pagy/commits?author=daniel-rikowski)[](https://github.com/ddnexus/pagy/commits?author=connie-feng)[](https://github.com/ddnexus/pagy/commits?author=MrMoins)[](https://github.com/ddnexus/pagy/commits?author=excid3)[](https://github.com/ddnexus/pagy/commits?author=cellvinchung)[](https://github.com/ddnexus/pagy/commits?author=brunoocasali)[](https://github.com/ddnexus/pagy/commits?author=branson-simplethread)[](https://github.com/ddnexus/pagy/commits?author=BrandonKlotz)[](https://github.com/ddnexus/pagy/commits?author=benjaminwols)[](https://github.com/ddnexus/pagy/commits?author=Atul9)[](https://github.com/ddnexus/pagy/commits?author=amenon)[](https://github.com/ddnexus/pagy/commits?author=artinboghosian)[](https://github.com/ddnexus/pagy/commits?author=antonzaharia)[](https://github.com/ddnexus/pagy/commits?author=PyrinAndrii)[](https://github.com/ddnexus/pagy/commits?author=andrew)[](https://github.com/ddnexus/pagy/commits?author=AliOsm)[](https://github.com/ddnexus/pagy/commits?author=AbelToy)[](https://github.com/ddnexus/pagy/commits?author=loed-idzinga)[](https://github.com/ddnexus/pagy/commits?author=epeirce)[](https://github.com/ddnexus/pagy/commits?author=kobusjoubert)
diff --git a/bun.lockb b/bun.lockb index b1b2671b5..7c863aef6 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/docs/api/ARIA.md b/docs/api/ARIA.md index 5f7c5d9dd..a96e932ff 100644 --- a/docs/api/ARIA.md +++ b/docs/api/ARIA.md @@ -2,6 +2,7 @@ title: ARIA Attributes categories: - Feature +order: 110 --- # ARIA Attributes diff --git a/docs/api/backend.md b/docs/api/backend.md index efdb0baca..6d1b6f120 100644 --- a/docs/api/backend.md +++ b/docs/api/backend.md @@ -5,6 +5,7 @@ categories: - Module - Backend description: This module provides the base functionality for the backend. +order: 100 --- # Pagy::Backend diff --git a/docs/api/calendar/index.yml b/docs/api/calendar/index.yml index b2c0be95a..da97f1b6a 100644 --- a/docs/api/calendar/index.yml +++ b/docs/api/calendar/index.yml @@ -1,2 +1,2 @@ -order: -10 +order: 90 image: none diff --git a/docs/api/javascript/index.yml b/docs/api/javascript/index.yml index b2c0be95a..eb32644df 100644 --- a/docs/api/javascript/index.yml +++ b/docs/api/javascript/index.yml @@ -1,2 +1,2 @@ -order: -10 +order: 105 image: none diff --git a/docs/api/pagy.md b/docs/api/pagy.md index 45103b356..7cc4a1e17 100644 --- a/docs/api/pagy.md +++ b/docs/api/pagy.md @@ -3,6 +3,7 @@ title: Pagy categories: - Core - Class +order: 100 --- # Pagy diff --git a/docs/extras/calendar.md b/docs/extras/calendar.md index 474c23e52..dfa6e518e 100644 --- a/docs/extras/calendar.md +++ b/docs/extras/calendar.md @@ -356,7 +356,7 @@ option `fit_time: true` to avoid the error and get the url to the page closest t Each page link in the calendar navs is conveniently labeled with the specific `Time` period it refers to. You can change the time format to your needs by setting the `:format` variable to a standard `strftime` format. (See -the [Pagy::Calendar variables](/docs/api/calendar.md#variables)) +the [Pagy::Calendar::Unit variables](/docs/api/calendar/units.md#variables)) You can also get the [label method](/docs/api/calendar.md#methods) with e.g.: `@calendar[:month].label`, which might be useful to use in your UI. diff --git a/e2e/snapshots.js b/e2e/snapshots.js index 575c2b253..1deef103c 100644 --- a/e2e/snapshots.js +++ b/e2e/snapshots.js @@ -283,7 +283,7 @@ module.exports = { "6": "Displaying items 981-1000 of 1000 in total" } }, - "__version": "13.15.0", + "__version": "13.15.1", "[repro] Test helpers": { "[repro] Test #nav": { "1": "

@records: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20

", diff --git a/gem/apps/calendar.ru b/gem/apps/calendar.ru index d1f4bbcf9..3f32f70d5 100644 --- a/gem/apps/calendar.ru +++ b/gem/apps/calendar.ru @@ -15,7 +15,7 @@ # DOC # https://ddnexus.github.io/pagy/playground/#5-calendar-app -VERSION = '9.1.0' +VERSION = '9.1.1' # Gemfile require 'bundler/inline' diff --git a/gem/apps/demo.ru b/gem/apps/demo.ru index f95cee871..f54ca2d72 100644 --- a/gem/apps/demo.ru +++ b/gem/apps/demo.ru @@ -18,7 +18,7 @@ # DOC # https://ddnexus.github.io/pagy/playground/#3-demo-app -VERSION = '9.1.0' +VERSION = '9.1.1' require 'bundler/inline' require 'bundler' diff --git a/gem/apps/rails.ru b/gem/apps/rails.ru index 506188519..eb882425c 100644 --- a/gem/apps/rails.ru +++ b/gem/apps/rails.ru @@ -15,7 +15,7 @@ # DOC # https://ddnexus.github.io/pagy/playground/#2-rails-app -VERSION = '9.1.0' +VERSION = '9.1.1' # Gemfile require 'bundler/inline' diff --git a/gem/apps/repro.ru b/gem/apps/repro.ru index cceb5e979..80e3ef348 100644 --- a/gem/apps/repro.ru +++ b/gem/apps/repro.ru @@ -15,7 +15,7 @@ # DOC # https://ddnexus.github.io/pagy/playground/#1-repro-app -VERSION = '9.1.0' +VERSION = '9.1.1' require 'bundler/inline' require 'bundler' diff --git a/gem/bin/pagy b/gem/bin/pagy index 087f9b69d..93d32830b 100755 --- a/gem/bin/pagy +++ b/gem/bin/pagy @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -VERSION = '9.1.0' +VERSION = '9.1.1' APPS = %w[repro rails demo calendar keyset_ar keyset_s].freeze LINUX = RbConfig::CONFIG['host_os'].include?('linux') HOST = '0.0.0.0' diff --git a/gem/config/pagy.rb b/gem/config/pagy.rb index 72010788a..6a55dbd3c 100644 --- a/gem/config/pagy.rb +++ b/gem/config/pagy.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Pagy initializer file (9.1.0) +# Pagy initializer file (9.1.1) # Customize only what you really need and notice that the core Pagy works also without any of the following lines. # Should you just cherry pick part of this file, please maintain the require-order of the extras diff --git a/gem/javascripts/pagy.min.js b/gem/javascripts/pagy.min.js index 588bb5c2d..f9276080e 100644 --- a/gem/javascripts/pagy.min.js +++ b/gem/javascripts/pagy.min.js @@ -1,4 +1,4 @@ -window.Pagy=(()=>{const j=new ResizeObserver((B)=>B.forEach((D)=>D.target.querySelectorAll(".pagy-rjs").forEach((E)=>E.pagyRender()))),x=(B,[D,E,z,G])=>{const F=B.parentElement??B,K=Object.keys(E).map((H)=>parseInt(H)).sort((H,M)=>M-H);let L=-1;const T=(H,M,R)=>H.replace(/__pagy_page__/g,M).replace(/__pagy_label__/g,R);if((B.pagyRender=function(){const H=K.find((Q)=>QQ.toString());R.forEach((Q,J)=>{const $=X[J];let U;if(typeof Q==="number")U=T(D.a,Q.toString(),$);else if(Q==="gap")U=D.gap;else U=T(D.current,Q,$);M+=typeof G==="string"&&Q==1?Z(U,G):U}),M+=D.after,B.innerHTML="",B.insertAdjacentHTML("afterbegin",M),L=H})(),B.classList.contains("pagy-rjs"))j.observe(F)},A=(B,[D,E])=>Y(B,(z)=>[z,D.replace(/__pagy_page__/,z)],E),C=(B,[D,E,z])=>{Y(B,(G)=>{const F=Math.max(Math.ceil(D/parseInt(G)),1).toString(),K=E.replace(/__pagy_page__/,F).replace(/__pagy_limit__/,G);return[F,K]},z)},Y=(B,D,E)=>{const z=B.querySelector("input"),G=B.querySelector("a"),F=z.value,K=function(){if(z.value===F)return;const[L,T,H]=[z.min,z.value,z.max].map((X)=>parseInt(X)||0);if(TH){z.value=F,z.select();return}let[M,R]=D(z.value);if(typeof E==="string"&&M==="1")R=Z(R,E);G.href=R,G.click()};["change","focus"].forEach((L)=>z.addEventListener(L,()=>z.select())),z.addEventListener("focusout",K),z.addEventListener("keypress",(L)=>{if(L.key==="Enter")K()})},Z=(B,D)=>B.replace(new RegExp(`[?&]${D}=1\\b(?!&)|\\b${D}=1&`),"");return{version:"9.1.0",init(B){const E=(B instanceof Element?B:document).querySelectorAll("[data-pagy]");for(let z of E)try{const G=Uint8Array.from(atob(z.getAttribute("data-pagy")),(L)=>L.charCodeAt(0)),[F,...K]=JSON.parse(new TextDecoder().decode(G));if(F==="nav")x(z,K);else if(F==="combo")A(z,K);else if(F==="selector")C(z,K);else console.warn("Skipped Pagy.init() for: %o\nUnknown keyword '%s'",z,F)}catch(G){console.warn("Skipped Pagy.init() for: %o\n%s",z,G)}}}})(); +window.Pagy=(()=>{const j=new ResizeObserver((B)=>B.forEach((D)=>D.target.querySelectorAll(".pagy-rjs").forEach((E)=>E.pagyRender()))),x=(B,[D,E,z,G])=>{const F=B.parentElement??B,K=Object.keys(E).map((H)=>parseInt(H)).sort((H,M)=>M-H);let L=-1;const T=(H,M,R)=>H.replace(/__pagy_page__/g,M).replace(/__pagy_label__/g,R);if((B.pagyRender=function(){const H=K.find((Q)=>QQ.toString());R.forEach((Q,J)=>{const $=X[J];let U;if(typeof Q==="number")U=T(D.a,Q.toString(),$);else if(Q==="gap")U=D.gap;else U=T(D.current,Q,$);M+=typeof G==="string"&&Q==1?Z(U,G):U}),M+=D.after,B.innerHTML="",B.insertAdjacentHTML("afterbegin",M),L=H})(),B.classList.contains("pagy-rjs"))j.observe(F)},A=(B,[D,E])=>Y(B,(z)=>[z,D.replace(/__pagy_page__/,z)],E),C=(B,[D,E,z])=>{Y(B,(G)=>{const F=Math.max(Math.ceil(D/parseInt(G)),1).toString(),K=E.replace(/__pagy_page__/,F).replace(/__pagy_limit__/,G);return[F,K]},z)},Y=(B,D,E)=>{const z=B.querySelector("input"),G=B.querySelector("a"),F=z.value,K=function(){if(z.value===F)return;const[L,T,H]=[z.min,z.value,z.max].map((X)=>parseInt(X)||0);if(TH){z.value=F,z.select();return}let[M,R]=D(z.value);if(typeof E==="string"&&M==="1")R=Z(R,E);G.href=R,G.click()};["change","focus"].forEach((L)=>z.addEventListener(L,()=>z.select())),z.addEventListener("focusout",K),z.addEventListener("keypress",(L)=>{if(L.key==="Enter")K()})},Z=(B,D)=>B.replace(new RegExp(`[?&]${D}=1\\b(?!&)|\\b${D}=1&`),"");return{version:"9.1.1",init(B){const E=(B instanceof Element?B:document).querySelectorAll("[data-pagy]");for(let z of E)try{const G=Uint8Array.from(atob(z.getAttribute("data-pagy")),(L)=>L.charCodeAt(0)),[F,...K]=JSON.parse(new TextDecoder().decode(G));if(F==="nav")x(z,K);else if(F==="combo")A(z,K);else if(F==="selector")C(z,K);else console.warn("Skipped Pagy.init() for: %o\nUnknown keyword '%s'",z,F)}catch(G){console.warn("Skipped Pagy.init() for: %o\n%s",z,G)}}}})(); -//# debugId=66A02CDC8780B4A264756E2164756E21 +//# debugId=E5B9B54DD869AFD664756E2164756E21 //# sourceMappingURL=pagy.min.js.map diff --git a/gem/javascripts/pagy.min.js.map b/gem/javascripts/pagy.min.js.map index 0abf74b8c..fbb933071 100644 --- a/gem/javascripts/pagy.min.js.map +++ b/gem/javascripts/pagy.min.js.map @@ -2,9 +2,9 @@ "version": 3, "sources": ["../../src/pagy.ts"], "sourcesContent": [ - "type NavArgs = readonly [Tokens, Sequels, null | LabelSequels, string?]\ntype ComboArgs = readonly [string, string?]\ntype SelectorArgs = readonly [number, string, string?]\ntype JsonArgs = ['nav', NavArgs] | ['combo', ComboArgs] | ['selector', SelectorArgs]\n\ninterface Tokens {\n readonly before:string\n readonly a:string\n readonly current:string\n readonly gap:string\n readonly after:string\n}\ninterface Sequels {readonly [width:string]:(string | number)[]}\ninterface LabelSequels {readonly [width:string]:string[]}\ninterface NavElement extends Element {pagyRender():void}\n\nconst Pagy = (() => {\n // The observer instance for responsive navs\n const rjsObserver = new ResizeObserver(\n entries => entries.forEach(e => e.target.querySelectorAll(\".pagy-rjs\")\n .forEach(el => el.pagyRender())));\n // Init the *_nav_js helpers\n const initNav = (el:NavElement, [tokens, sequels, labelSequels, trimParam]:NavArgs) => {\n const container = el.parentElement ?? el;\n const widths = Object.keys(sequels).map(w => parseInt(w)).sort((a, b) => b - a);\n let lastWidth = -1;\n const fillIn = (a:string, page:string, label:string):string =>\n a.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 = tokens.before; // already trimmed in html\n const series = sequels[width.toString()];\n const labels = labelSequels?.[width.toString()] ?? series.map(l => l.toString());\n series.forEach((item, i) => {\n const label = labels[i];\n let filled;\n if (typeof item === \"number\") {\n filled = fillIn(tokens.a, item.toString(), label);\n } else if (item === \"gap\") {\n filled = tokens.gap;\n } else { // active page\n filled = fillIn(tokens.current, item, label);\n }\n html += (typeof trimParam === \"string\" && item == 1) ? trim(filled, trimParam) : filled;\n });\n html += tokens.after;\n el.innerHTML = \"\";\n el.insertAdjacentHTML(\"afterbegin\", html);\n lastWidth = width;\n })();\n if (el.classList.contains(\"pagy-rjs\")) { rjsObserver.observe(container) }\n };\n\n // Init the *_combo_nav_js helpers\n const initCombo = (el:Element, [url_token, trimParam]:ComboArgs) =>\n initInput(el, inputValue => [inputValue, url_token.replace(/__pagy_page__/, inputValue)], trimParam);\n\n // Init the limit_selector_js helper\n const initSelector = (el:Element, [from, url_token, trimParam]:SelectorArgs) => {\n initInput(el, inputValue => {\n const page = Math.max(Math.ceil(from / parseInt(inputValue)), 1).toString();\n const url = url_token.replace(/__pagy_page__/, page).replace(/__pagy_limit__/, inputValue);\n return [page, url];\n }, trimParam);\n };\n\n // Init the input element\n const initInput = (el:Element, getVars:(v:string) => [string, string], trimParam?:string) => {\n const input = el.querySelector(\"input\") as HTMLInputElement;\n const link = el.querySelector(\"a\") as HTMLAnchorElement;\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, url] = getVars(input.value); // eslint-disable-line prefer-const\n if (typeof trimParam === \"string\" && page === \"1\") { url = trim(url, trimParam) }\n link.href = url;\n link.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 const trim = (a:string, param:string) =>\n a.replace(new RegExp(`[?&]${param}=1\\\\b(?!&)|\\\\b${param}=1&`), \"\");\n\n // Public interface\n return {\n version: \"9.1.0\",\n\n // Scan for elements with a \"data-pagy\" attribute and call their init functions with the decoded args\n init(arg?:Element) {\n const target = arg instanceof Element ? arg : document;\n const elements = target.querySelectorAll(\"[data-pagy]\");\n for (const el of elements) {\n try {\n const uint8array = Uint8Array.from(atob(el.getAttribute(\"data-pagy\") as string), c => c.charCodeAt(0));\n const [keyword, ...args] = JSON.parse((new TextDecoder()).decode(uint8array)) as JsonArgs; // base64-utf8 -> JSON -> Array\n if (keyword === \"nav\") {\n initNav(el as NavElement, args as unknown as NavArgs);\n } else if (keyword === \"combo\") {\n initCombo(el, args as unknown as ComboArgs);\n } else if (keyword === \"selector\") {\n initSelector(el, args as unknown as SelectorArgs);\n } else {\n console.warn(\"Skipped Pagy.init() for: %o\\nUnknown keyword '%s'\", el, keyword);\n }\n } catch (err) { console.warn(\"Skipped Pagy.init() for: %o\\n%s\", el, err) }\n }\n }\n };\n})();\n\nexport default Pagy;\n" + "type NavArgs = readonly [Tokens, Sequels, null | LabelSequels, string?]\ntype ComboArgs = readonly [string, string?]\ntype SelectorArgs = readonly [number, string, string?]\ntype JsonArgs = ['nav', NavArgs] | ['combo', ComboArgs] | ['selector', SelectorArgs]\n\ninterface Tokens {\n readonly before:string\n readonly a:string\n readonly current:string\n readonly gap:string\n readonly after:string\n}\ninterface Sequels {readonly [width:string]:(string | number)[]}\ninterface LabelSequels {readonly [width:string]:string[]}\ninterface NavElement extends Element {pagyRender():void}\n\nconst Pagy = (() => {\n // The observer instance for responsive navs\n const rjsObserver = new ResizeObserver(\n entries => entries.forEach(e => e.target.querySelectorAll(\".pagy-rjs\")\n .forEach(el => el.pagyRender())));\n // Init the *_nav_js helpers\n const initNav = (el:NavElement, [tokens, sequels, labelSequels, trimParam]:NavArgs) => {\n const container = el.parentElement ?? el;\n const widths = Object.keys(sequels).map(w => parseInt(w)).sort((a, b) => b - a);\n let lastWidth = -1;\n const fillIn = (a:string, page:string, label:string):string =>\n a.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 = tokens.before; // already trimmed in html\n const series = sequels[width.toString()];\n const labels = labelSequels?.[width.toString()] ?? series.map(l => l.toString());\n series.forEach((item, i) => {\n const label = labels[i];\n let filled;\n if (typeof item === \"number\") {\n filled = fillIn(tokens.a, item.toString(), label);\n } else if (item === \"gap\") {\n filled = tokens.gap;\n } else { // active page\n filled = fillIn(tokens.current, item, label);\n }\n html += (typeof trimParam === \"string\" && item == 1) ? trim(filled, trimParam) : filled;\n });\n html += tokens.after;\n el.innerHTML = \"\";\n el.insertAdjacentHTML(\"afterbegin\", html);\n lastWidth = width;\n })();\n if (el.classList.contains(\"pagy-rjs\")) { rjsObserver.observe(container) }\n };\n\n // Init the *_combo_nav_js helpers\n const initCombo = (el:Element, [url_token, trimParam]:ComboArgs) =>\n initInput(el, inputValue => [inputValue, url_token.replace(/__pagy_page__/, inputValue)], trimParam);\n\n // Init the limit_selector_js helper\n const initSelector = (el:Element, [from, url_token, trimParam]:SelectorArgs) => {\n initInput(el, inputValue => {\n const page = Math.max(Math.ceil(from / parseInt(inputValue)), 1).toString();\n const url = url_token.replace(/__pagy_page__/, page).replace(/__pagy_limit__/, inputValue);\n return [page, url];\n }, trimParam);\n };\n\n // Init the input element\n const initInput = (el:Element, getVars:(v:string) => [string, string], trimParam?:string) => {\n const input = el.querySelector(\"input\") as HTMLInputElement;\n const link = el.querySelector(\"a\") as HTMLAnchorElement;\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, url] = getVars(input.value); // eslint-disable-line prefer-const\n if (typeof trimParam === \"string\" && page === \"1\") { url = trim(url, trimParam) }\n link.href = url;\n link.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 const trim = (a:string, param:string) =>\n a.replace(new RegExp(`[?&]${param}=1\\\\b(?!&)|\\\\b${param}=1&`), \"\");\n\n // Public interface\n return {\n version: \"9.1.1\",\n\n // Scan for elements with a \"data-pagy\" attribute and call their init functions with the decoded args\n init(arg?:Element) {\n const target = arg instanceof Element ? arg : document;\n const elements = target.querySelectorAll(\"[data-pagy]\");\n for (const el of elements) {\n try {\n const uint8array = Uint8Array.from(atob(el.getAttribute(\"data-pagy\") as string), c => c.charCodeAt(0));\n const [keyword, ...args] = JSON.parse((new TextDecoder()).decode(uint8array)) as JsonArgs; // base64-utf8 -> JSON -> Array\n if (keyword === \"nav\") {\n initNav(el as NavElement, args as unknown as NavArgs);\n } else if (keyword === \"combo\") {\n initCombo(el, args as unknown as ComboArgs);\n } else if (keyword === \"selector\") {\n initSelector(el, args as unknown as SelectorArgs);\n } else {\n console.warn(\"Skipped Pagy.init() for: %o\\nUnknown keyword '%s'\", el, keyword);\n }\n } catch (err) { console.warn(\"Skipped Pagy.init() for: %o\\n%s\", el, err) }\n }\n }\n };\n})();\n\nexport default Pagy;\n" ], "mappings": "AAgBA,IAAM,GAAQ,IAAM,CAElB,MAAM,EAAc,IAAI,eACpB,KAAW,EAAQ,QAAQ,KAAK,EAAE,OAAO,iBAA6B,WAAW,EAC/C,QAAQ,KAAM,EAAG,WAAW,CAAC,CAAC,CAAC,EAE/D,EAAU,CAAC,GAAgB,EAAQ,EAAS,EAAc,KAAuB,CACrF,MAAM,EAAY,EAAG,eAAiB,EAChC,EAAY,OAAO,KAAK,CAAO,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,EAAG,IAAM,EAAI,CAAC,EACjF,IAAI,EAAc,GAClB,MAAM,EAAY,CAAC,EAAU,EAAa,IACtC,EAAE,QAAQ,iBAAkB,CAAI,EAAE,QAAQ,kBAAmB,CAAK,EAwBtE,IAvBC,EAAG,mBAAsB,EAAG,CAC3B,MAAM,EAAQ,EAAO,KAAK,KAAK,EAAI,EAAU,WAAW,GAAK,EAC7D,GAAI,IAAU,EAAa,OAC3B,IAAI,EAAW,EAAO,OACtB,MAAM,EAAS,EAAQ,EAAM,SAAS,GAChC,EAAS,IAAe,EAAM,SAAS,IAAM,EAAO,IAAI,KAAK,EAAE,SAAS,CAAC,EAC/E,EAAO,QAAQ,CAAC,EAAM,IAAM,CAC1B,MAAM,EAAQ,EAAO,GACrB,IAAI,EACJ,UAAW,IAAS,SAClB,EAAS,EAAO,EAAO,EAAG,EAAK,SAAS,EAAG,CAAK,UACvC,IAAS,MAClB,EAAS,EAAO,QAEhB,GAAS,EAAO,EAAO,QAAS,EAAM,CAAK,EAE7C,UAAgB,IAAc,UAAY,GAAQ,EAAK,EAAK,EAAQ,CAAS,EAAI,EAClF,EACD,GAAe,EAAO,MACtB,EAAG,UAAY,GACf,EAAG,mBAAmB,aAAc,CAAI,EACxC,EAAY,IACX,EACC,EAAG,UAAU,SAAS,UAAU,EAAK,EAAY,QAAQ,CAAS,GAIlE,EAAY,CAAC,GAAa,EAAW,KACvC,EAAU,EAAI,KAAc,CAAC,EAAY,EAAU,QAAQ,gBAAiB,CAAU,CAAC,EAAG,CAAS,EAGjG,EAAe,CAAC,GAAa,EAAM,EAAW,KAA4B,CAC9E,EAAU,EAAI,KAAc,CAC1B,MAAM,EAAO,KAAK,IAAI,KAAK,KAAK,EAAO,SAAS,CAAU,CAAC,EAAG,CAAC,EAAE,SAAS,EACpE,EAAO,EAAU,QAAQ,gBAAiB,CAAI,EAAE,QAAQ,iBAAkB,CAAU,EAC1F,MAAO,CAAC,EAAM,CAAG,GAChB,CAAS,GAIR,EAAY,CAAC,EAAY,EAAwC,IAAsB,CAC3F,MAAM,EAAU,EAAG,cAAc,OAAO,EAClC,EAAU,EAAG,cAAc,GAAG,EAC9B,EAAU,EAAM,MAChB,UAAmB,EAAG,CAC1B,GAAI,EAAM,QAAU,EAAW,OAC/B,MAAO,EAAK,EAAK,GAAO,CAAC,EAAM,IAAK,EAAM,MAAO,EAAM,GAAG,EAAE,IAAI,KAAK,SAAS,CAAC,GAAK,CAAC,EACrF,GAAI,EAAM,GAAO,EAAM,EAAK,CAC1B,EAAM,MAAQ,EACd,EAAM,OAAO,EACb,OAEF,IAAK,EAAM,GAAO,EAAQ,EAAM,KAAK,EACrC,UAAW,IAAc,UAAY,IAAS,IAAO,EAAM,EAAK,EAAK,CAAS,EAC9E,EAAK,KAAO,EACZ,EAAK,MAAM,GAEb,CAAC,SAAU,OAAO,EAAE,QAAQ,KAAK,EAAM,iBAAiB,EAAG,IAAM,EAAM,OAAO,CAAC,CAAC,EAChF,EAAM,iBAAiB,WAAY,CAAM,EACzC,EAAM,iBAAiB,WAAY,KAAK,CAAE,GAAI,EAAE,MAAQ,QAAW,EAAO,EAAK,GAI3E,EAAO,CAAC,EAAU,IACpB,EAAE,QAAQ,IAAI,OAAO,OAAO,kBAAsB,MAAU,EAAG,EAAE,EAGrE,MAAO,CACL,QAAS,QAGT,IAAI,CAAC,EAAc,CAEjB,MAAM,GADW,aAAe,QAAU,EAAM,UACxB,iBAAiB,aAAa,EACtD,QAAW,KAAM,EACf,GAAI,CACF,MAAM,EAAqB,WAAW,KAAK,KAAK,EAAG,aAAa,WAAW,CAAW,EAAG,KAAK,EAAE,WAAW,CAAC,CAAC,GACtG,KAAY,GAAQ,KAAK,MAAO,IAAI,YAAY,EAAG,OAAO,CAAU,CAAC,EAC5E,GAAI,IAAY,MACd,EAAQ,EAAkB,CAA0B,UAC3C,IAAY,QACrB,EAAU,EAAI,CAA4B,UACjC,IAAY,WACrB,EAAa,EAAI,CAA+B,MAEhD,SAAQ,KAAK,oDAAqD,EAAI,CAAO,QAExE,EAAP,CAAc,QAAQ,KAAK,kCAAmC,EAAI,CAAG,GAG7E,IACC", - "debugId": "66A02CDC8780B4A264756E2164756E21", + "debugId": "E5B9B54DD869AFD664756E2164756E21", "names": [] } \ No newline at end of file diff --git a/gem/javascripts/pagy.mjs b/gem/javascripts/pagy.mjs index c494c420c..e6a2e104b 100644 --- a/gem/javascripts/pagy.mjs +++ b/gem/javascripts/pagy.mjs @@ -73,7 +73,7 @@ const Pagy = (() => { }; const trim = (a, param) => a.replace(new RegExp(`[?&]${param}=1\\b(?!&)|\\b${param}=1&`), ""); return { - version: "9.1.0", + version: "9.1.1", init(arg) { const target = arg instanceof Element ? arg : document; const elements = target.querySelectorAll("[data-pagy]"); diff --git a/gem/lib/pagy.rb b/gem/lib/pagy.rb index 270c9be00..8fe912276 100644 --- a/gem/lib/pagy.rb +++ b/gem/lib/pagy.rb @@ -6,7 +6,7 @@ # Top superclass: it should define only what's common to all the subclasses class Pagy - VERSION = '9.1.0' + VERSION = '9.1.1' # Core default: constant for easy access, but mutable for customizable defaults DEFAULT = { count_args: [:all], # rubocop:disable Style/MutableConstant diff --git a/gem/lib/pagy/calendar.rb b/gem/lib/pagy/calendar.rb index 8742dc1a0..ec24f1f02 100644 --- a/gem/lib/pagy/calendar.rb +++ b/gem/lib/pagy/calendar.rb @@ -26,8 +26,8 @@ def create(unit, **vars) end # Return calendar, from, to - def init(conf, period, params) - new.send(:init, conf, period, params) + def init(...) + new.send(:init, ...) end end @@ -47,18 +47,20 @@ def init(conf, period, params) @period = period @params = params @page_param = conf[:pagy][:page_param] || DEFAULT[:page_param] - @units.each do |unit| # set all the :page_param vars for later deletion - unit_page_param = :"#{unit}_#{@page_param}" - conf[unit][:page_param] = unit_page_param - conf[unit][:page] = @params[unit_page_param] - end + # set all the :page_param vars for later deletion + @units.each { |unit| conf[unit][:page_param] = :"#{unit}_#{@page_param}" } calendar = {} object = nil @units.each_with_index do |unit, index| params_to_delete = @units[(index + 1), @units.size].map { |sub| conf[sub][:page_param] } + [@page_param] - conf[unit][:params] = lambda { |up| up.except(*params_to_delete.map(&:to_s)) } # rubocop:disable Style/Lambda + conf[unit][:params] = ->(up) { up.except(*params_to_delete.map(&:to_s)) } conf[unit][:period] = object&.send(:active_period) || @period - calendar[unit] = object = Calendar.send(:create, unit, **conf[unit]) + conf[unit][:page] = @params[:"#{unit}_#{@page_param}"] # requested page + # :nocov: + conf[unit][:counts] = yield(unit, conf[unit][:period]) if block_given? # nocov doesn't need to fail block_given? + # :nocov: + calendar[unit] = object \ + = Calendar.send(:create, unit, **conf[unit]) end [replace(calendar), object.from, object.to] end diff --git a/gem/lib/pagy/extras/calendar.rb b/gem/lib/pagy/extras/calendar.rb index 4b409363c..9353459a9 100644 --- a/gem/lib/pagy/extras/calendar.rb +++ b/gem/lib/pagy/extras/calendar.rb @@ -19,12 +19,9 @@ def pagy_calendar(collection, conf) conf[:pagy] ||= {} unless conf.key?(:active) && !conf[:active] - calendar, from, to = Calendar.send(:init, conf, pagy_calendar_period(collection), params) - if respond_to?(:pagy_calendar_counts) - calendar.each_key do |unit| - calendar[unit].vars[:counts] = pagy_calendar_counts(collection, unit, *calendar[unit].vars[:period]) - end - end + calendar, from, to = Calendar.send(:init, conf, pagy_calendar_period(collection), params) do |unit, period| + pagy_calendar_counts(collection, unit, *period) if respond_to?(:pagy_calendar_counts) + end collection = pagy_calendar_filter(collection, from, to) end pagy, results = send(conf[:pagy][:backend] || :pagy, collection, **conf[:pagy]) # use backend: :pagy when omitted @@ -54,14 +51,14 @@ def pagy_anchor(pagy, anchor_string: nil) left, right = %(#{text}) diff --git a/gem/pagy.gemspec b/gem/pagy.gemspec index 9b4677be4..893b43997 100644 --- a/gem/pagy.gemspec +++ b/gem/pagy.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'pagy' - s.version = '9.1.0' + s.version = '9.1.1' s.authors = ['Domizio Demichelis'] s.email = ['dd.nexus@gmail.com'] s.summary = 'The best pagination ruby gem' diff --git a/package.json b/package.json index ceb928efd..9ee822080 100644 --- a/package.json +++ b/package.json @@ -5,20 +5,20 @@ "type": "module", "devDependencies": { "@cypress/snapshot": "^2.1.7", - "@types/node": "22.7.6", - "cypress": "13.15.0", + "@types/node": "22.8.2", + "cypress": "13.15.1", "cypress-html-validate": "6.1.0", "eslint-plugin-cypress": "4.0.0", "eslint-plugin-promise": "7.1.0", "html-validate": "8.24.2", "start-server-and-test": "2.0.8", - "@eslint/js": "9.12.0", + "@eslint/js": "9.13.0", "@types/eslint__js": "^8.42.3", - "eslint": "9.12.0", + "eslint": "9.13.0", "eslint-plugin-align-assignments": "^1.1.2", "retypeapp-linux-x64": "3.6.0", "typescript": "5.6.3", - "typescript-eslint": "8.10.0" + "typescript-eslint": "8.12.1" }, "workspaces": ["e2e"] } diff --git a/retype.yml b/retype.yml index f125a08bf..79cb2b2d1 100644 --- a/retype.yml +++ b/retype.yml @@ -8,7 +8,7 @@ url: https://ddnexus.github.io/pagy branding: title: Pagy - label: 9.1.0 + label: 9.1.1 colors: label: text: "#FFFFFF" diff --git a/src/pagy.ts b/src/pagy.ts index 95e2c98fd..c91590d1f 100644 --- a/src/pagy.ts +++ b/src/pagy.ts @@ -94,7 +94,7 @@ const Pagy = (() => { // Public interface return { - version: "9.1.0", + version: "9.1.1", // Scan for elements with a "data-pagy" attribute and call their init functions with the decoded args init(arg?:Element) {