svelte-common 4.6.14 → 4.7.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": "4.6.14",
3
+ "version": "4.7.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,7 +32,7 @@
32
32
  "preview": "vite preview"
33
33
  },
34
34
  "dependencies": {
35
- "svelte-command": "^1.1.22",
35
+ "svelte-command": "^1.1.23",
36
36
  "svelte-entitlement": "^1.2.30"
37
37
  },
38
38
  "devDependencies": {
package/src/index.svelte CHANGED
@@ -44,5 +44,12 @@
44
44
  formatDurationISO,
45
45
  formatSecondsSinceEpoch
46
46
  } from "./util.mjs";
47
+ export {
48
+ toggleOrdeBy,
49
+ orderByCycle,
50
+ SORT_NONE,
51
+ SORT_ASCENDING,
52
+ SORT_DESCENDING
53
+ } from "./sorting.mjs";
47
54
  export { initializeServiceWorker } from "./service-worker.mjs";
48
55
  </script>
@@ -0,0 +1,16 @@
1
+ export const SORT_NONE = "none";
2
+ export const SORT_ASCENDING = "ascending";
3
+ export const SORT_DESCENDING = "descending";
4
+
5
+ export const orderByCycle = {
6
+ [SORT_NONE]: SORT_ASCENDING,
7
+ [SORT_ASCENDING]: SORT_DESCENDING,
8
+ [SORT_DESCENDING]: SORT_NONE
9
+ };
10
+
11
+ /**
12
+ * Deliver next value in the order by cycle.
13
+ * @param {string} orderBy
14
+ * @returns {string} new order either SORT_NONE, SORT_ASCENDING or SORT_DESCENDING
15
+ */
16
+ export function toggleOrdeBy(orderBy) { return orderByCycle[orderBy] || "none"; }