svelte-common 6.13.0 → 6.14.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-common",
3
- "version": "6.13.0",
3
+ "version": "6.14.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -49,28 +49,28 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "pacc": "^3.1.8",
52
- "svelte-command": "^3.0.1",
53
- "svelte-entitlement": "^2.0.0"
52
+ "svelte-command": "^3.0.2",
53
+ "svelte-entitlement": "^2.0.1"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@semantic-release/commit-analyzer": "^13.0.0",
57
57
  "@semantic-release/exec": "^6.0.3",
58
- "@semantic-release/github": "^10.1.3",
58
+ "@semantic-release/github": "^10.1.5",
59
59
  "@semantic-release/release-notes-generator": "^14.0.1",
60
60
  "@sveltejs/vite-plugin-svelte": "^3.1.1",
61
61
  "ava": "^6.1.3",
62
62
  "c8": "^10.1.2",
63
63
  "documentation": "^14.0.3",
64
- "mf-styling": "^3.1.7",
64
+ "mf-styling": "^3.1.8",
65
65
  "npm-pkgbuild": "^15.3.29",
66
66
  "semantic-release": "^24.0.0",
67
67
  "stylelint": "^16.8.1",
68
68
  "stylelint-config-standard": "^36.0.1",
69
- "svelte": "^5.0.0-next.210",
69
+ "svelte": "^5.0.0-next.222",
70
70
  "testcafe": "^3.6.2",
71
71
  "typescript": "^5.5.4",
72
72
  "vite": "^5.4.0",
73
- "vite-plugin-compression2": "^1.1.3"
73
+ "vite-plugin-compression2": "^1.2.0"
74
74
  },
75
75
  "peerDependencies": {
76
76
  "svelte": "^5.0.0-next.0"
package/src/filter.mjs CHANGED
@@ -109,7 +109,7 @@ function allOp(value, against, op) {
109
109
  return value.length ? numberOp(value, against, op) : true;
110
110
  case "object":
111
111
  if (value.length === 0) {
112
- return true;
112
+ return false;
113
113
  }
114
114
 
115
115
  if (against instanceof Date) {
@@ -15,11 +15,12 @@ export class Pagination {
15
15
  #data;
16
16
  #unsubscribeData;
17
17
  #filter;
18
+ #unsubscribeFilter;
18
19
  #sorter;
19
20
  #itemsPerPage = 20;
20
21
  #page = 1;
21
22
 
22
- constructor(data=[], options) {
23
+ constructor(data = [], options) {
23
24
  this.data = data;
24
25
 
25
26
  Object.assign(this, options);
@@ -30,9 +31,22 @@ export class Pagination {
30
31
  }
31
32
 
32
33
  set filter(filter) {
33
- this.#filter = filter;
34
- this.recalibrateCurrentPage();
35
- this.fireSubscriptions();
34
+ if (this.#unsubscribeFilter) {
35
+ this.#unsubscribeFilter();
36
+ this.#unsubscribeFilter = undefined;
37
+ }
38
+
39
+ const applyFilter = filter => {
40
+ this.#filter = filter;
41
+ this.recalibrateCurrentPage();
42
+ this.fireSubscriptions();
43
+ };
44
+
45
+ if (filter?.subscribe) {
46
+ this.#unsubscribeFilter = filter.subscribe(applyFilter);
47
+ } else {
48
+ applyFilter(filter);
49
+ }
36
50
  }
37
51
 
38
52
  get filter() {