svelte-common 4.19.1 → 4.19.4
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/README.md +2 -1
- package/package.json +4 -4
- package/src/components/Tab.svelte +9 -0
- package/src/components/Tabs.svelte +9 -0
- package/src/index.svelte +6 -2
- package/src/sorting.mjs +11 -7
package/README.md
CHANGED
|
@@ -66,8 +66,9 @@ Synchronizes store value with node "aria-sort" attribute.
|
|
|
66
66
|
|
|
67
67
|
### Parameters
|
|
68
68
|
|
|
69
|
-
* `th`
|
|
69
|
+
* `th`  
|
|
70
70
|
* `store`  
|
|
71
|
+
* `the` **[Node](https://developer.mozilla.org/docs/Web/API/Node/nextSibling)** header node
|
|
71
72
|
* `to` **WritableStore** keep in sync with sorting properties
|
|
72
73
|
|
|
73
74
|
## sorter
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-common",
|
|
3
|
-
"version": "4.19.
|
|
3
|
+
"version": "4.19.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -39,15 +39,15 @@
|
|
|
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.
|
|
42
|
+
"@sveltejs/vite-plugin-svelte": "^1.0.4",
|
|
43
43
|
"ava": "^4.3.3",
|
|
44
44
|
"documentation": "^14.0.0",
|
|
45
|
-
"mf-styling": "^1.7.
|
|
45
|
+
"mf-styling": "^1.7.11",
|
|
46
46
|
"npm-pkgbuild": "^10.14.8",
|
|
47
47
|
"semantic-release": "^19.0.5",
|
|
48
48
|
"stylelint": "^14.11.0",
|
|
49
49
|
"stylelint-config-standard": "^28.0.0",
|
|
50
|
-
"svelte": "^3.
|
|
50
|
+
"svelte": "^3.50.0",
|
|
51
51
|
"testcafe": "^2.0.0",
|
|
52
52
|
"vite": "^3.0.9"
|
|
53
53
|
},
|
package/src/index.svelte
CHANGED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
import Collapse from "./components/Collapse.svelte";
|
|
15
15
|
import Modal from "./components/Modal.svelte";
|
|
16
16
|
import Peer from "./components/Peer.svelte";
|
|
17
|
+
import Tabs from "./components/Tabs.svelte";
|
|
18
|
+
import Tab from "./components/Tab.svelte";
|
|
17
19
|
|
|
18
20
|
export {
|
|
19
21
|
Bytes,
|
|
@@ -30,7 +32,9 @@
|
|
|
30
32
|
SessionDetails,
|
|
31
33
|
ServerDetails,
|
|
32
34
|
ServiceWorkerDetails,
|
|
33
|
-
ServiceWorkerRegistrationDetails
|
|
35
|
+
ServiceWorkerRegistrationDetails,
|
|
36
|
+
Tabs,
|
|
37
|
+
Tab
|
|
34
38
|
};
|
|
35
39
|
|
|
36
40
|
export {
|
|
@@ -50,6 +54,6 @@
|
|
|
50
54
|
SORT_ASCENDING,
|
|
51
55
|
SORT_DESCENDING
|
|
52
56
|
} from "./sorting.mjs";
|
|
53
|
-
export { filter } from "./filter.mjs";
|
|
57
|
+
export { filter } from "./filter.mjs";
|
|
54
58
|
export { initializeServiceWorker } from "./service-worker.mjs";
|
|
55
59
|
</script>
|
package/src/sorting.mjs
CHANGED
|
@@ -20,7 +20,7 @@ export function toggleOrderBy(orderBy) {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* Add sortable toggle button
|
|
23
|
+
* Add sortable toggle button to a node.
|
|
24
24
|
* Synchronizes store value with node "aria-sort" attribute.
|
|
25
25
|
* @param {Node} the header node
|
|
26
26
|
* @param {WritableStore} to keep in sync with sorting properties
|
|
@@ -31,11 +31,8 @@ export function sortable(th, store) {
|
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
const button = document.createElement("button");
|
|
34
|
-
button.setAttribute("aria-label", `
|
|
35
|
-
|
|
36
|
-
//img.setAttribute("alt", "sorting order indicator");
|
|
37
|
-
|
|
38
|
-
button.appendChild(img);
|
|
34
|
+
button.setAttribute("aria-label", `toggle sort of ${th.id}`);
|
|
35
|
+
button.setAttribute("class", "alter-sorting");
|
|
39
36
|
|
|
40
37
|
button.onclick = () => {
|
|
41
38
|
const orderBy = {};
|
|
@@ -87,6 +84,7 @@ export function sorter(sortBy, getters = {}) {
|
|
|
87
84
|
return (a, b) => {
|
|
88
85
|
let av = getter(a);
|
|
89
86
|
let bv = getter(b);
|
|
87
|
+
|
|
90
88
|
if (av === undefined) {
|
|
91
89
|
return -rev;
|
|
92
90
|
}
|
|
@@ -96,11 +94,17 @@ export function sorter(sortBy, getters = {}) {
|
|
|
96
94
|
|
|
97
95
|
switch (typeof av) {
|
|
98
96
|
case "string":
|
|
99
|
-
|
|
97
|
+
switch (typeof bv) {
|
|
98
|
+
case "number":
|
|
99
|
+
case "string":
|
|
100
|
+
return av.localeCompare(bv);
|
|
101
|
+
}
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
if (av instanceof Date) {
|
|
103
105
|
av = av.getTime();
|
|
106
|
+
}
|
|
107
|
+
if (bv instanceof Date) {
|
|
104
108
|
bv = bv.getTime();
|
|
105
109
|
}
|
|
106
110
|
|