svelte-common 6.19.35 → 6.19.37
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 +5 -5
- package/src/components/Duration.svelte +1 -1
- package/src/index.svelte +0 -2
- package/src/util.mjs +0 -49
- package/types/util.d.mts +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-common",
|
|
3
|
-
"version": "6.19.
|
|
3
|
+
"version": "6.19.37",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"preview": "vite preview"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"pacc": "^6.
|
|
52
|
+
"pacc": "^6.3.0",
|
|
53
53
|
"svelte-command": "^3.0.47",
|
|
54
54
|
"svelte-entitlement": "^2.0.55"
|
|
55
55
|
},
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@semantic-release/github": "^12.0.2",
|
|
61
61
|
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
62
62
|
"@sveltejs/vite-plugin-svelte": "^6.2.1",
|
|
63
|
-
"@types/node": "^25.0.
|
|
63
|
+
"@types/node": "^25.0.2",
|
|
64
64
|
"@typescript-eslint/types": "^8.49.0",
|
|
65
65
|
"ava": "^6.4.1",
|
|
66
66
|
"c8": "^10.1.3",
|
|
@@ -71,13 +71,13 @@
|
|
|
71
71
|
"semantic-release": "^25.0.2",
|
|
72
72
|
"stylelint": "^16.26.1",
|
|
73
73
|
"stylelint-config-standard": "^39.0.1",
|
|
74
|
-
"svelte": "^5.
|
|
74
|
+
"svelte": "^5.46.0",
|
|
75
75
|
"typescript": "^5.9.3",
|
|
76
76
|
"vite": "^7.2.7",
|
|
77
77
|
"vite-plugin-compression2": "^2.4.0"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
|
-
"svelte": "^5.
|
|
80
|
+
"svelte": "^5.46.0"
|
|
81
81
|
},
|
|
82
82
|
"optionalDependencies": {
|
|
83
83
|
"mf-hosting-cloudflare": "^1.0.9",
|
package/src/index.svelte
CHANGED
package/src/util.mjs
CHANGED
|
@@ -24,54 +24,6 @@ export function formatBytes(bytes, decimals = 2) {
|
|
|
24
24
|
|
|
25
25
|
const byteSizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
|
26
26
|
|
|
27
|
-
const durationsISO = [
|
|
28
|
-
[86400, "D"],
|
|
29
|
-
[3600, "H"],
|
|
30
|
-
[60, "M"],
|
|
31
|
-
[1, "S"]
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
export function formatDurationISO(seconds) {
|
|
35
|
-
let out = "P";
|
|
36
|
-
let t = false;
|
|
37
|
-
|
|
38
|
-
for (const d of durationsISO) {
|
|
39
|
-
if (seconds < 86400 && !t) {
|
|
40
|
-
out += "T";
|
|
41
|
-
t = true;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const n = Math.floor(seconds / Number(d[0]));
|
|
45
|
-
if (n > 0) {
|
|
46
|
-
out += `${n}${d[1]}`;
|
|
47
|
-
seconds -= n * Number(d[0]);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return out;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const durations = [
|
|
55
|
-
[604800, "w"],
|
|
56
|
-
[86400, "d"],
|
|
57
|
-
[3600, "h"],
|
|
58
|
-
[60, "m"],
|
|
59
|
-
[1, "s"]
|
|
60
|
-
];
|
|
61
|
-
|
|
62
|
-
export function formatDuration(seconds) {
|
|
63
|
-
const out = [];
|
|
64
|
-
for (const d of durations) {
|
|
65
|
-
const n = Math.floor(seconds / Number(d[0]));
|
|
66
|
-
if (n > 0) {
|
|
67
|
-
out.push(`${n}${d[1]}`);
|
|
68
|
-
seconds -= n * Number(d[0]);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return out.join(" ");
|
|
73
|
-
}
|
|
74
|
-
|
|
75
27
|
export function formatSecondsSinceEpoch(sse) {
|
|
76
28
|
if (sse === undefined) {
|
|
77
29
|
return "-";
|
|
@@ -82,7 +34,6 @@ export function formatSecondsSinceEpoch(sse) {
|
|
|
82
34
|
/*
|
|
83
35
|
import { readable } from 'svelte/store';
|
|
84
36
|
|
|
85
|
-
|
|
86
37
|
function liveDuration(seconds) {
|
|
87
38
|
const time = readable(new Date(), set => {
|
|
88
39
|
const interval = setInterval(() => {
|
package/types/util.d.mts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export function formatBytes(bytes: any, decimals?: number): string;
|
|
2
|
-
export function formatDurationISO(seconds: any): string;
|
|
3
|
-
export function formatDuration(seconds: any): string;
|
|
4
2
|
export function formatSecondsSinceEpoch(sse: any): string;
|
|
5
3
|
/**
|
|
6
4
|
* Create a derived store where all the object keys are prefixed.
|