@visulima/pagination 5.0.0-alpha.12 → 5.0.0-alpha.13

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## @visulima/pagination [5.0.0-alpha.13](https://github.com/visulima/visulima/compare/@visulima/pagination@5.0.0-alpha.12...@visulima/pagination@5.0.0-alpha.13) (2026-06-04)
2
+
3
+ ### Bug Fixes
4
+
5
+ * **pagination:** 3 bug fixes ([bcc5dbf](https://github.com/visulima/visulima/commit/bcc5dbf91aac391b3df1d83d6a1850a7b4bdbcc2))
6
+
7
+ ### Miscellaneous Chores
8
+
9
+ * apply eslint + prettier autofixes across packages ([c1bb784](https://github.com/visulima/visulima/commit/c1bb7848a0d93d0dfe2960c77e3cda22239c79a0))
10
+
1
11
  ## @visulima/pagination [5.0.0-alpha.12](https://github.com/visulima/visulima/compare/@visulima/pagination@5.0.0-alpha.11...@visulima/pagination@5.0.0-alpha.12) (2026-05-27)
2
12
 
3
13
  ### Bug Fixes
package/LICENSE.md CHANGED
@@ -23,11 +23,14 @@ SOFTWARE.
23
23
  <!-- DEPENDENCIES -->
24
24
 
25
25
  # Licenses of bundled dependencies
26
+
26
27
  The published @visulima/pagination artifact additionally contains code with the following licenses:
27
28
  BSD-3-Clause
28
29
 
29
30
  # Bundled dependencies:
31
+
30
32
  ## qs-esm
33
+
31
34
  License: BSD-3-Clause
32
35
  By: Payload, Jordan Harband
33
36
  Repository: https://github.com/payloadcms/qs-esm.git
@@ -42,11 +45,9 @@ Repository: https://github.com/payloadcms/qs-esm.git
42
45
  >
43
46
  > 1. Redistributions of source code must retain the above copyright notice, this
44
47
  > list of conditions and the following disclaimer.
45
- >
46
48
  > 2. Redistributions in binary form must reproduce the above copyright notice,
47
49
  > this list of conditions and the following disclaimer in the documentation
48
50
  > and/or other materials provided with the distribution.
49
- >
50
51
  > 3. Neither the name of the copyright holder nor the names of its
51
52
  > contributors may be used to endorse or promote products derived from
52
53
  > this software without specific prior written permission.
package/dist/index.d.ts CHANGED
@@ -52,6 +52,11 @@ declare class Paginator<T = unknown> extends Array<T> implements Paginator$1<T>
52
52
  readonly perPage: number;
53
53
  currentPage: number;
54
54
  /**
55
+ * Ensure inherited Array methods (map/filter/slice/...) return plain Arrays
56
+ * instead of partially-constructed Paginator instances.
57
+ */
58
+ static override get [Symbol.species](): ArrayConstructor;
59
+ /**
55
60
  * The first page is always 1
56
61
  */
57
62
  readonly firstPage: number;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var o=Object.defineProperty;var t=(e,a)=>o(e,"name",{value:a,configurable:!0});import i from"./packem_shared/Paginator-Dj-l47Lc.js";import{createPaginationMetaSchemaObject as j,createPaginationSchemaObject as u}from"./packem_shared/createPaginationMetaSchemaObject-DGZPqai2.js";var c=Object.defineProperty,g=t((e,a)=>c(e,"name",{value:a,configurable:!0}),"e");const b=g((e,a,r,n)=>new i(r,a,e,...n),"paginate");export{i as Paginator,j as createPaginationMetaSchemaObject,u as createPaginationSchemaObject,b as paginate};
1
+ var o=Object.defineProperty;var t=(e,a)=>o(e,"name",{value:a,configurable:!0});import i from"./packem_shared/Paginator-BVAelAiS.js";import{createPaginationMetaSchemaObject as P,createPaginationSchemaObject as j}from"./packem_shared/createPaginationMetaSchemaObject-DGZPqai2.js";var c=Object.defineProperty,g=t((e,a)=>c(e,"name",{value:a,configurable:!0}),"e");const b=g((e,a,r,n)=>new i(r,a,e,...n),"paginate");export{i as Paginator,P as createPaginationMetaSchemaObject,j as createPaginationSchemaObject,b as paginate};
@@ -0,0 +1 @@
1
+ var g=Object.defineProperty;var i=(a,t)=>g(a,"name",{value:t,configurable:!0});var l=Object.defineProperty,h=i((a,t)=>l(a,"name",{value:t,configurable:!0}),"n");class u extends Array{static{i(this,"u")}constructor(t,r,s,...e){super(),this.totalNumber=t,this.perPage=r,this.currentPage=s,this.push(...e),this.totalNumber=t,this.rows=e,this.isEmpty=this.rows.length===0}totalNumber;perPage;currentPage;static{h(this,"Paginator")}static get[Symbol.species](){return Array}firstPage=1;isEmpty;qs={};rows;url="/";all(){return this.rows}baseUrl(t){return this.url=t,this}getMeta(){return{firstPage:this.firstPage,firstPageUrl:this.getUrl(1),lastPage:this.lastPage,lastPageUrl:this.getUrl(this.lastPage),nextPageUrl:this.getNextPageUrl(),page:this.currentPage,perPage:this.perPage,previousPageUrl:this.getPreviousPageUrl(),total:this.total}}getNextPageUrl(){return this.hasMorePages?this.getUrl(this.currentPage+1):null}getPreviousPageUrl(){return this.currentPage>1?this.getUrl(this.currentPage-1):null}getUrl(t){const r=new URLSearchParams;for(const[s,e]of Object.entries(this.qs))e!=null&&r.append(s,String(e));return r.append("page",String(Math.max(t,1))),`${this.url}?${r.toString()}`}getUrlsForRange(t,r){const s=[];for(let e=t;e<=r;e++)s.push({isActive:e===this.currentPage,page:e,url:this.getUrl(e)});return s}queryString(t){return this.qs=t,this}toJSON(){return{data:this.all(),meta:this.getMeta()}}get hasMorePages(){return this.lastPage>this.currentPage}get hasPages(){return this.lastPage!==1}get hasTotal(){return this.total>0}get lastPage(){const t=this.perPage>0?this.perPage:1;return Math.max(Math.ceil(this.total/t),1)}get total(){return this.totalNumber}}export{u as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/pagination",
3
- "version": "5.0.0-alpha.12",
3
+ "version": "5.0.0-alpha.13",
4
4
  "description": "Simple Pagination for Node.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -1 +0,0 @@
1
- var ot=Object.defineProperty;var P=(t,e)=>ot(t,"name",{value:e,configurable:!0});var nt=Object.defineProperty,B=P((t,e)=>nt(t,"name",{value:e,configurable:!0}),"e");const at=String.prototype.replace,lt=/%20/g,W={RFC1738:"RFC1738",RFC3986:"RFC3986"},K={RFC1738:B(function(t){return at.call(t,lt,"+")},"RFC1738"),RFC3986:B(function(t){return String(t)},"RFC3986")},it=W.RFC1738,G=W.RFC3986;var st=Object.defineProperty,d=P((t,e)=>st(t,"name",{value:e,configurable:!0}),"p");const I=Object.prototype.hasOwnProperty,j=Array.isArray,F=new WeakMap;var J=d(function(t,e){return F.set(t,e),t},"markOverflow");function U(t){return F.has(t)}P(U,"isOverflow");d(U,"isOverflow");var z=d(function(t){return F.get(t)},"getMaxIndex"),L=d(function(t,e){F.set(t,e)},"setMaxIndex");const m=(function(){const t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),ct=d(function(t){for(;t.length>1;){const e=t.pop(),o=e.obj[e.prop];if(j(o)){const r=[];for(let a=0;a<o.length;++a)typeof o[a]<"u"&&r.push(o[a]);e.obj[e.prop]=r}}},"compactQueue"),X=d(function(t,e){const o=e&&e.plainObjects?Object.create(null):{};for(let r=0;r<t.length;++r)typeof t[r]<"u"&&(o[r]=t[r]);return o},"arrayToObject");d(P(function t(e,o,r){if(!o)return e;if(typeof o!="object"){if(j(e))e.push(o);else if(e&&typeof e=="object")if(U(e)){var a=z(e)+1;e[a]=o,L(e,a)}else(r&&(r.plainObjects||r.allowPrototypes)||!I.call(Object.prototype,o))&&(e[o]=!0);else return[e,o];return e}if(!e||typeof e!="object"){if(U(o)){for(var s=Object.keys(o),p=r&&r.plainObjects?{__proto__:null,0:e}:{0:e},u=0;u<s.length;u++){var i=parseInt(s[u],10);p[i+1]=o[s[u]]}return J(p,z(o)+1)}return[e].concat(o)}let c=e;return j(e)&&!j(o)&&(c=X(e,r)),j(e)&&j(o)?(o.forEach(function(n,y){if(I.call(e,y)){const h=e[y];h&&typeof h=="object"&&n&&typeof n=="object"?e[y]=t(h,n,r):e.push(n)}else e[y]=n}),e):Object.keys(o).reduce(function(n,y){const h=o[y];return I.call(n,y)?n[y]=t(n[y],h,r):n[y]=h,n},c)},"f"),"merge");d(function(t,e){return Object.keys(e).reduce(function(o,r){return o[r]=e[r],o},t)},"assignSingleSource");d(function(t){const e=t.replace(/\+/g," ");try{return decodeURIComponent(e)}catch{return e}},"decode");const T=1024,ut=d(function(t,e,o,r){if(t.length===0)return t;let a=t;typeof t=="symbol"?a=Symbol.prototype.toString.call(t):typeof t!="string"&&(a=String(t));let s="";for(let p=0;p<a.length;p+=T){const u=a.length>=T?a.slice(p,p+T):a,i=[];for(let c=0;c<u.length;++c){let n=u.charCodeAt(c);if(n===45||n===46||n===95||n===126||n>=48&&n<=57||n>=65&&n<=90||n>=97&&n<=122||r===it&&(n===40||n===41)){i[i.length]=u.charAt(c);continue}if(n<128){i[i.length]=m[n];continue}if(n<2048){i[i.length]=m[192|n>>6]+m[128|n&63];continue}if(n<55296||n>=57344){i[i.length]=m[224|n>>12]+m[128|n>>6&63]+m[128|n&63];continue}c+=1,n=65536+((n&1023)<<10|u.charCodeAt(c)&1023),i[i.length]=m[240|n>>18]+m[128|n>>12&63]+m[128|n>>6&63]+m[128|n&63]}s+=i.join("")}return s},"encode");d(function(t){const e=[{obj:{o:t},prop:"o"}],o=[];for(let r=0;r<e.length;++r){const a=e[r],s=a.obj[a.prop],p=Object.keys(s);for(let u=0;u<p.length;++u){const i=p[u],c=s[i];typeof c=="object"&&c!==null&&o.indexOf(c)===-1&&(e.push({obj:s,prop:i}),o.push(c))}}return ct(e),t},"compact");d(function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},"isRegExp");const ft=d(function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},"isBuffer");d(function(t,e,o,r){if(U(t)){var a=z(t)+1;return t[a]=e,L(t,a),t}var s=[].concat(t,e);return s.length>o?J(X(s,{plainObjects:r}),s.length-1):s},"combine");const _=d(function(t,e){if(j(t)){const o=[];for(let r=0;r<t.length;r+=1)o.push(e(t[r]));return o}return e(t)},"maybeMap");var pt=Object.defineProperty,w=P((t,e)=>pt(t,"name",{value:e,configurable:!0}),"s");const yt=Object.prototype.hasOwnProperty,Y={brackets:w(function(t){return t+"[]"},"brackets"),comma:"comma",indices:w(function(t,e){return t+"["+e+"]"},"indices"),repeat:w(function(t){return t},"repeat")},b=Array.isArray,gt=Array.prototype.push,Z=w(function(t,e){gt.apply(t,b(e)?e:[e])},"pushToArray"),dt=Date.prototype.toISOString,$=G,f={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:ut,encodeValuesOnly:!1,format:$,formatter:K[$],indices:!1,serializeDate:w(function(t){return dt.call(t)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},ht=w(function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},"isNonNullishPrimitive"),M={},tt=w(function(t,e,o,r,a,s,p,u,i,c,n,y,h,v,E,x,k){let l=t,D=k,N=0,Q=!1;for(;(D=D.get(M))!==void 0&&!Q;){const g=D.get(t);if(N+=1,typeof g<"u"){if(g===N)throw new RangeError("Cyclic object value");Q=!0}typeof D.get(M)>"u"&&(N=0)}if(typeof c=="function"?l=c(e,l):l instanceof Date?l=h(l):o==="comma"&&b(l)&&(l=_(l,function(g){return g instanceof Date?h(g):g})),l===null){if(s)return i&&!x?i(e,f.encoder,"key",v):e;l=""}if(ht(l)||ft(l)){if(i){const g=x?e:i(e,f.encoder,"key",v);return[E(g)+"="+E(i(l,f.encoder,"value",v))]}return[E(e)+"="+E(String(l))]}const C=[];if(typeof l>"u")return C;let R;if(o==="comma"&&b(l))x&&i&&(l=_(l,i)),R=[{value:l.length>0?l.join(",")||null:void 0}];else if(b(c))R=c;else{const g=Object.keys(l);R=n?g.sort(n):g}const H=u?e.replace(/\./g,"%2E"):e,A=r&&b(l)&&l.length===1?H+"[]":H;if(a&&b(l)&&l.length===0)return A+"[]";for(let g=0;g<R.length;++g){const O=R[g],V=typeof O=="object"&&typeof O.value<"u"?O.value:l[O];if(p&&V===null)continue;const S=y&&u?O.replace(/\./g,"%2E"):O,rt=b(l)?typeof o=="function"?o(A,S):A:A+(y?"."+S:"["+S+"]");k.set(t,N);const q=new WeakMap;q.set(M,k),Z(C,tt(V,rt,o,r,a,s,p,u,o==="comma"&&x&&b(l)?null:i,c,n,y,h,v,E,x,q))}return C},"stringify"),mt=w(function(t){if(!t)return f;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=G;if(typeof t.format<"u"){if(!yt.call(K,t.format))throw new TypeError("Unknown format option provided.");e=t.format}const o=K[e];let r=f.filter;(typeof t.filter=="function"||b(t.filter))&&(r=t.filter);let a;if(t.arrayFormat in Y?a=t.arrayFormat:"indices"in t?a=t.indices?"indices":"repeat":a=f.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");const s=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:f.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:f.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:f.allowEmptyArrays,arrayFormat:a,commaRoundTrip:t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?f.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:f.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:f.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:f.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:f.encodeValuesOnly,filter:r,format:e,formatter:o,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:f.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:f.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:f.strictNullHandling}},"normalizeStringifyOptions");function et(t,e){let o=t;const r=mt(e);let a,s;typeof r.filter=="function"?(s=r.filter,o=s("",o)):b(r.filter)&&(s=r.filter,a=s);const p=[];if(typeof o!="object"||o===null)return"";const u=Y[r.arrayFormat],i=u==="comma"&&r.commaRoundTrip;a||(a=Object.keys(o)),r.sort&&a.sort(r.sort);const c=new WeakMap;for(let h=0;h<a.length;++h){const v=a[h];r.skipNulls&&o[v]===null||Z(p,tt(o[v],v,u,i,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,c))}const n=p.join(r.delimiter),y=r.addQueryPrefix===!0?"?":"";return n.length>0?y+n:""}P(et,"stringify");w(et,"stringify");var bt=Object.defineProperty,Pt=P((t,e)=>bt(t,"name",{value:e,configurable:!0}),"n");class vt extends Array{static{P(this,"g")}constructor(e,o,r,...a){super(...a),this.totalNumber=e,this.perPage=o,this.currentPage=r,this.totalNumber=e,this.rows=a,this.isEmpty=this.rows.length===0}totalNumber;perPage;currentPage;static{Pt(this,"Paginator")}firstPage=1;isEmpty;qs={};rows;url="/";all(){return this.rows}baseUrl(e){return this.url=e,this}getMeta(){return{firstPage:this.firstPage,firstPageUrl:this.getUrl(1),lastPage:this.lastPage,lastPageUrl:this.getUrl(this.lastPage),nextPageUrl:this.getNextPageUrl(),page:this.currentPage,perPage:this.perPage,previousPageUrl:this.getPreviousPageUrl(),total:this.total}}getNextPageUrl(){return this.hasMorePages?this.getUrl(this.currentPage+1):null}getPreviousPageUrl(){return this.currentPage>1?this.getUrl(this.currentPage-1):null}getUrl(e){const o=et({...this.qs,page:Math.max(e,1)});return`${this.url}?${o}`}getUrlsForRange(e,o){const r=[];for(let a=e;a<=o;a++)r.push({isActive:a===this.currentPage,page:a,url:this.getUrl(a)});return r}queryString(e){return this.qs=e,this}toJSON(){return{data:this.all(),meta:this.getMeta()}}get hasMorePages(){return this.lastPage>this.currentPage}get hasPages(){return this.lastPage!==1}get hasTotal(){return this.total>0}get lastPage(){return Math.max(Math.ceil(this.total/this.perPage),1)}get total(){return this.totalNumber}}export{vt as default};