svelte-common 6.2.7 → 6.3.0

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 +10 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-common",
3
- "version": "6.2.7",
3
+ "version": "6.3.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -52,7 +52,7 @@
52
52
  "ava": "^5.3.1",
53
53
  "c8": "^8.0.0",
54
54
  "documentation": "^14.0.2",
55
- "mf-styling": "^2.1.0",
55
+ "mf-styling": "^3.0.0",
56
56
  "npm-pkgbuild": "^11.8.14",
57
57
  "semantic-release": "^21.0.7",
58
58
  "stylelint": "^15.10.1",
@@ -73,9 +73,15 @@ export class Pagination {
73
73
  * @param {number} n
74
74
  */
75
75
  set page(n) {
76
- if (this.#page !== n && n >= 1 && n <= this.numberOfPages) {
77
- this.#page = n;
78
- this.#subscriptions.forEach(subscription => subscription(this));
76
+ if(n < 0) {
77
+ n = this.numberOfPages + n + 1;
78
+ }
79
+
80
+ if (this.#page !== n) {
81
+ if (n >= 1 && n <= this.numberOfPages) {
82
+ this.#page = n;
83
+ this.#subscriptions.forEach(subscription => subscription(this));
84
+ }
79
85
  }
80
86
  }
81
87
 
@@ -165,6 +171,7 @@ export class Pagination {
165
171
  } else {
166
172
  a.onclick = e => {
167
173
  e.preventDefault();
174
+ e.stopPropagation();
168
175
  this.page = targetPage;
169
176
  };
170
177
  }