svelte-common 4.19.8 → 4.19.10

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 +29 -15
  2. package/src/sorting.mjs +10 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-common",
3
- "version": "4.19.8",
3
+ "version": "4.19.10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -24,7 +24,7 @@
24
24
  "start": "vite",
25
25
  "test": "npm run test:ava && npm run test:cafe",
26
26
  "test:cafe": "testcafe $BROWSER:headless tests/cafe/*.js -s build/test --page-request-timeout 3000 --app-init-delay 3000 --app \"vite preview\"",
27
- "test:ava": "ava --timeout 2m tests/*.mjs",
27
+ "test:ava": "ava --timeout 2m tests/*-ava.mjs tests/*-ava-node.mjs",
28
28
  "docs": "documentation readme --section=API ./src/**/*.mjs",
29
29
  "lint": "npm run lint:css && npm run lint:docs",
30
30
  "lint:docs": "documentation lint ./src/**/*.mjs",
@@ -33,26 +33,26 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "svelte-command": "^1.1.24",
36
- "svelte-entitlement": "^1.2.30"
36
+ "svelte-entitlement": "^1.2.36"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@semantic-release/commit-analyzer": "^9.0.2",
40
40
  "@semantic-release/exec": "^6.0.3",
41
41
  "@semantic-release/release-notes-generator": "^10.0.3",
42
- "@sveltejs/vite-plugin-svelte": "^1.0.5",
43
- "ava": "^4.3.3",
42
+ "@sveltejs/vite-plugin-svelte": "^1.3.1",
43
+ "ava": "^5.1.0",
44
44
  "documentation": "^14.0.0",
45
- "mf-styling": "^1.7.14",
46
- "npm-pkgbuild": "^10.14.8",
45
+ "mf-styling": "^1.7.23",
46
+ "npm-pkgbuild": "^10.15.17",
47
47
  "semantic-release": "^19.0.5",
48
- "stylelint": "^14.11.0",
49
- "stylelint-config-standard": "^28.0.0",
50
- "svelte": "^3.50.0",
51
- "testcafe": "^2.0.0",
52
- "vite": "^3.1.0"
48
+ "stylelint": "^14.15.0",
49
+ "stylelint-config-standard": "^29.0.0",
50
+ "svelte": "^3.53.1",
51
+ "testcafe": "^2.1.0",
52
+ "vite": "^3.2.4"
53
53
  },
54
54
  "optionalDependencies": {
55
- "mf-hosting": "^1.7.3"
55
+ "mf-hosting": "^1.7.8"
56
56
  },
57
57
  "repository": {
58
58
  "type": "git",
@@ -77,10 +77,24 @@
77
77
  [
78
78
  "@semantic-release/exec",
79
79
  {
80
- "publishCmd": "npx npm-pkgbuild --available --continue --verbose"
80
+ "publishCmd": "npx npm-pkgbuild --available --continue"
81
81
  }
82
82
  ],
83
- "@semantic-release/github"
83
+ [
84
+ "@semantic-release/github",
85
+ {
86
+ "assets": [
87
+ {
88
+ "path": "dist/*.deb",
89
+ "label": "Debian Package"
90
+ },
91
+ {
92
+ "path": "dist/*.pkg.*",
93
+ "label": "Arch Linux Package"
94
+ }
95
+ ]
96
+ }
97
+ ]
84
98
  ]
85
99
  },
86
100
  "template": {
package/src/sorting.mjs CHANGED
@@ -9,6 +9,8 @@ export const orderByCycle = {
9
9
  [SORT_DESCENDING]: SORT_ASCENDING
10
10
  };
11
11
 
12
+ const ARIA_SORT = "aria-sort";
13
+
12
14
  /**
13
15
  * Deliver next value in the order by cycle.
14
16
  * SORT_NONE -> SORT_ASCENDING -> SORT_DESCENDING -> SORT_NONE ...
@@ -21,17 +23,17 @@ export function toggleOrderBy(orderBy) {
21
23
 
22
24
  /**
23
25
  * Add sortable toggle button to a th node.
24
- * Synchronizes store value with th nodes "aria-sort" attribute.
26
+ * Synchronizes store value with the nodes "aria-sort" attribute.
25
27
  * @param {Node} the header node
26
28
  * @param {WritableStore} to keep in sync with sorting properties
27
29
  */
28
30
  export function sortable(th, store) {
29
31
  const storeSubscription = store.subscribe(orderBy =>
30
- th.setAttribute("aria-sort", orderBy[th.id] || SORT_NONE)
32
+ th.setAttribute(ARIA_SORT, orderBy[th.id] || SORT_NONE)
31
33
  );
32
34
 
33
- if (!th.getAttribute("aria-sort")) {
34
- th.setAttribute("aria-sort", SORT_NONE);
35
+ if (!th.getAttribute(ARIA_SORT)) {
36
+ th.setAttribute(ARIA_SORT, SORT_NONE);
35
37
  }
36
38
 
37
39
  const button = document.createElement("button");
@@ -40,16 +42,16 @@ export function sortable(th, store) {
40
42
  button.onclick = () => {
41
43
  const orderBy = {};
42
44
 
43
- th.setAttribute("aria-sort", toggleOrderBy(th.getAttribute("aria-sort")));
45
+ th.setAttribute(ARIA_SORT, toggleOrderBy(th.getAttribute(ARIA_SORT)));
44
46
 
45
47
  for (const peer of th.parentElement.children) {
46
- let sort = peer.getAttribute("aria-sort");
48
+ let sort = peer.getAttribute(ARIA_SORT);
47
49
 
48
50
  if (sort) {
49
51
  if (peer !== th) {
50
52
  if (sort !== SORT_NONE) {
51
53
  sort = SORT_NONE;
52
- peer.setAttribute("aria-sort", sort);
54
+ peer.setAttribute(ARIA_SORT, sort);
53
55
  }
54
56
  }
55
57
 
@@ -93,7 +95,7 @@ export function sorter(sortBy, getters = {}) {
93
95
  let bv = getter(b);
94
96
 
95
97
  if (av === undefined) {
96
- return -rev;
98
+ return bv === undefined ? 0 : -rev;
97
99
  }
98
100
  if (bv === undefined) {
99
101
  return rev;