svelte-common 4.19.6 → 4.19.7

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": "4.19.6",
3
+ "version": "4.19.7",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -42,7 +42,7 @@
42
42
  "@sveltejs/vite-plugin-svelte": "^1.0.5",
43
43
  "ava": "^4.3.3",
44
44
  "documentation": "^14.0.0",
45
- "mf-styling": "^1.7.13",
45
+ "mf-styling": "^1.7.14",
46
46
  "npm-pkgbuild": "^10.14.8",
47
47
  "semantic-release": "^19.0.5",
48
48
  "stylelint": "^14.11.0",
package/src/sorting.mjs CHANGED
@@ -20,13 +20,13 @@ export function toggleOrderBy(orderBy) {
20
20
  }
21
21
 
22
22
  /**
23
- * Add sortable toggle button to a node.
24
- * Synchronizes store value with node "aria-sort" attribute.
23
+ * Add sortable toggle button to a th node.
24
+ * Synchronizes store value with th nodes "aria-sort" attribute.
25
25
  * @param {Node} the header node
26
26
  * @param {WritableStore} to keep in sync with sorting properties
27
27
  */
28
28
  export function sortable(th, store) {
29
- store.subscribe(orderBy =>
29
+ const storeSubscription = store.subscribe(orderBy =>
30
30
  th.setAttribute("aria-sort", orderBy[th.id] || SORT_NONE)
31
31
  );
32
32
 
@@ -37,7 +37,6 @@ export function sortable(th, store) {
37
37
  const button = document.createElement("button");
38
38
  button.setAttribute("aria-label", `toggle sort of ${th.id}`);
39
39
  button.setAttribute("class", "alter-sorting");
40
-
41
40
  button.onclick = () => {
42
41
  const orderBy = {};
43
42
 
@@ -63,6 +62,12 @@ export function sortable(th, store) {
63
62
  };
64
63
 
65
64
  th.appendChild(button);
65
+
66
+ return {
67
+ destroy() {
68
+ storeSubscription();
69
+ }
70
+ };
66
71
  }
67
72
 
68
73
  /**
package/src/util.mjs CHANGED
@@ -96,7 +96,10 @@ function liveDuration(seconds) {
96
96
  */
97
97
 
98
98
  /**
99
- * Create a store where all the object keys are prefixed.
99
+ * Create a derived store where all the object keys are prefixed.
100
+ * ```
101
+ * { a: 1, b: 2 } -> { prefix_a: 1 prefix_b: 2 }
102
+ * ```
100
103
  * @param {WriteableStore} store
101
104
  * @param {string} prefix
102
105
  * @returns {WriteableStore}