svelte-common 6.5.6 → 6.6.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 (2) hide show
  1. package/package.json +2 -2
  2. package/src/pagination.mjs +12 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-common",
3
- "version": "6.5.6",
3
+ "version": "6.6.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -53,7 +53,7 @@
53
53
  "c8": "^8.0.1",
54
54
  "documentation": "^14.0.2",
55
55
  "mf-styling": "^3.0.2",
56
- "npm-pkgbuild": "^11.10.11",
56
+ "npm-pkgbuild": "^11.10.12",
57
57
  "semantic-release": "^21.0.7",
58
58
  "stylelint": "^15.10.2",
59
59
  "stylelint-config-standard": "^34.0.0",
@@ -53,9 +53,15 @@ export class Pagination {
53
53
  if (data?.subscribe) {
54
54
  this.#unsubscribeData = data.subscribe(newData => {
55
55
  this.#data = newData;
56
+ if (this.page > this.numberOfPages) {
57
+ this.page = this.numberOfPages;
58
+ }
56
59
  });
57
60
  } else {
58
61
  this.#data = data;
62
+ if (this.page > this.numberOfPages) {
63
+ this.page = this.numberOfPages;
64
+ }
59
65
  }
60
66
 
61
67
  this.fireSubscriptions();
@@ -153,12 +159,14 @@ export class Pagination {
153
159
  nav.setAttribute("aria-label", "pagination");
154
160
 
155
161
  nav.onkeyup = event => {
162
+ const step = event.altKey ? 10 : 1;
163
+
156
164
  switch (event.key) {
157
165
  case "ArrowLeft":
158
- this.page = this.page - 1;
166
+ this.page = this.page - step;
159
167
  break;
160
168
  case "ArrowRight":
161
- this.page = this.page + 1;
169
+ this.page = this.page + step;
162
170
  break;
163
171
  }
164
172
  };
@@ -254,8 +262,8 @@ export function* navigationItems(
254
262
  break;
255
263
  }
256
264
  }
257
-
258
- /*
265
+
266
+ /*
259
267
  const pageJumps = [
260
268
  { maxPages: 10, stepping: [1] },
261
269
  { maxPages: 100, stepping: [1, 10] },