@streamscloud/kit 0.0.1-1770820176986 → 0.0.1-1770839905472
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/dist/core/toastr/toaster-host.svelte.d.ts +4 -2
- package/dist/core/toastr/toaster-host.svelte.js +7 -6
- package/dist/core/toastr/toastr.svelte.js +5 -6
- package/dist/ui/image/cmp.image.svelte +2 -2
- package/dist/ui/image/cmp.image.svelte.d.ts +1 -1
- package/dist/ui/loading/cmp.loading.svelte +82 -0
- package/dist/ui/loading/cmp.loading.svelte.d.ts +9 -0
- package/dist/ui/loading/index.d.ts +1 -0
- package/dist/ui/loading/index.js +1 -0
- package/dist/ui/proportional-container/cmp.proportional-container.svelte +25 -0
- package/dist/ui/proportional-container/cmp.proportional-container.svelte.d.ts +8 -0
- package/dist/ui/proportional-container/index.d.ts +1 -0
- package/dist/ui/proportional-container/index.js +1 -0
- package/package.json +9 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { AppTheme } from '../theme';
|
|
2
2
|
import { mount, tick } from 'svelte';
|
|
3
|
-
import { Toaster } from 'svelte-sonner';
|
|
4
3
|
export class ToasterHost {
|
|
5
|
-
static
|
|
4
|
+
static _toast = null;
|
|
6
5
|
static _mountPromise = null;
|
|
7
6
|
static async ensure() {
|
|
8
|
-
if (this.
|
|
9
|
-
return;
|
|
7
|
+
if (this._toast) {
|
|
8
|
+
return this._toast;
|
|
10
9
|
}
|
|
11
10
|
if (this._mountPromise) {
|
|
12
11
|
return this._mountPromise;
|
|
13
12
|
}
|
|
14
13
|
if (typeof document === 'undefined') {
|
|
15
|
-
|
|
14
|
+
throw new Error('ToasterHost requires a browser environment');
|
|
16
15
|
}
|
|
17
16
|
this._mountPromise = (async () => {
|
|
17
|
+
const { Toaster, toast } = await import('svelte-sonner');
|
|
18
18
|
const container = document.createElement('div');
|
|
19
19
|
container.id = 'toastr-container';
|
|
20
20
|
document.body.appendChild(container);
|
|
@@ -33,7 +33,8 @@ export class ToasterHost {
|
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
await tick();
|
|
36
|
-
this.
|
|
36
|
+
this._toast = toast;
|
|
37
|
+
return toast;
|
|
37
38
|
})();
|
|
38
39
|
return this._mountPromise;
|
|
39
40
|
}
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import { ToasterHost } from './toaster-host.svelte';
|
|
2
|
-
import { toast } from 'svelte-sonner';
|
|
3
2
|
export class Toastr {
|
|
4
3
|
static async error(message, options) {
|
|
5
|
-
await ToasterHost.ensure();
|
|
4
|
+
const toast = await ToasterHost.ensure();
|
|
6
5
|
toast.error(message, patchOptions(options));
|
|
7
6
|
}
|
|
8
7
|
static async success(message, options) {
|
|
9
|
-
await ToasterHost.ensure();
|
|
8
|
+
const toast = await ToasterHost.ensure();
|
|
10
9
|
toast.success(message, patchOptions(options));
|
|
11
10
|
}
|
|
12
11
|
static async warning(message, options) {
|
|
13
|
-
await ToasterHost.ensure();
|
|
12
|
+
const toast = await ToasterHost.ensure();
|
|
14
13
|
toast.warning(message, patchOptions(options));
|
|
15
14
|
}
|
|
16
15
|
static async info(message, options) {
|
|
17
|
-
await ToasterHost.ensure();
|
|
16
|
+
const toast = await ToasterHost.ensure();
|
|
18
17
|
toast.info(message, patchOptions(options));
|
|
19
18
|
}
|
|
20
19
|
static async promise(promise, messages) {
|
|
21
|
-
await ToasterHost.ensure();
|
|
20
|
+
const toast = await ToasterHost.ensure();
|
|
22
21
|
toast.promise(promise, messages);
|
|
23
22
|
}
|
|
24
23
|
}
|
|
@@ -6,11 +6,11 @@ let hasError = $state(false);
|
|
|
6
6
|
const imageState = $derived(calculateImageState(src, hasError, showStubOnError));
|
|
7
7
|
const onLoad = () => {
|
|
8
8
|
hasError = false;
|
|
9
|
-
on?.load(true);
|
|
9
|
+
on?.load?.(true);
|
|
10
10
|
};
|
|
11
11
|
const onLoadError = () => {
|
|
12
12
|
hasError = true;
|
|
13
|
-
on?.load(false);
|
|
13
|
+
on?.load?.(false);
|
|
14
14
|
};
|
|
15
15
|
</script>
|
|
16
16
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script lang="ts">import { onMount } from 'svelte';
|
|
2
|
+
let { positionFixedCenter = false, positionAbsoluteCenter = false, blocking = false, timeout = 0 } = $props();
|
|
3
|
+
let visible = $state(false);
|
|
4
|
+
onMount(() => {
|
|
5
|
+
setTimeout(() => (visible = true), timeout);
|
|
6
|
+
});
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
{#if visible && blocking}
|
|
10
|
+
<div class="loading-ring-overlay" class:loading-ring-overlay--fixed={positionFixedCenter}></div>
|
|
11
|
+
{/if}
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
class="la-ball-clip-rotate"
|
|
15
|
+
class:la-ball-clip-rotate--absolute-center={positionAbsoluteCenter}
|
|
16
|
+
class:la-ball-clip-rotate--fixed-center={positionFixedCenter}
|
|
17
|
+
class:la-ball-clip-rotate--visible={visible}>
|
|
18
|
+
<div class="la-ball-clip-rotate__spin"></div>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<style>.loading-ring-overlay {
|
|
22
|
+
position: absolute;
|
|
23
|
+
inset: 0;
|
|
24
|
+
background-color: rgba(0, 0, 0, 0.3);
|
|
25
|
+
z-index: 999;
|
|
26
|
+
}
|
|
27
|
+
.loading-ring-overlay--fixed {
|
|
28
|
+
position: fixed;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.la-ball-clip-rotate {
|
|
32
|
+
--_loading--font-size: var(--loading--font-size, 1rem);
|
|
33
|
+
--_loading--spinner-color: var(--loading--spinner-color, light-dark(#144ab0, #5a8dec));
|
|
34
|
+
font-size: var(--_loading--font-size);
|
|
35
|
+
color: var(--_loading--spinner-color);
|
|
36
|
+
display: block;
|
|
37
|
+
opacity: 0;
|
|
38
|
+
width: 2em;
|
|
39
|
+
height: 2em;
|
|
40
|
+
z-index: 10;
|
|
41
|
+
}
|
|
42
|
+
.la-ball-clip-rotate--visible {
|
|
43
|
+
opacity: 1;
|
|
44
|
+
}
|
|
45
|
+
.la-ball-clip-rotate--absolute-center {
|
|
46
|
+
position: absolute;
|
|
47
|
+
top: 50%;
|
|
48
|
+
left: 50%;
|
|
49
|
+
transform: translate(-50%, -50%);
|
|
50
|
+
}
|
|
51
|
+
.la-ball-clip-rotate--fixed-center {
|
|
52
|
+
position: fixed;
|
|
53
|
+
top: 50%;
|
|
54
|
+
left: 50%;
|
|
55
|
+
transform: translate(-50%, -50%);
|
|
56
|
+
z-index: 1;
|
|
57
|
+
}
|
|
58
|
+
.la-ball-clip-rotate__spin {
|
|
59
|
+
position: relative;
|
|
60
|
+
box-sizing: border-box;
|
|
61
|
+
display: inline-block;
|
|
62
|
+
float: none;
|
|
63
|
+
border: 0.125em solid currentColor;
|
|
64
|
+
width: 2em;
|
|
65
|
+
height: 2em;
|
|
66
|
+
background: transparent;
|
|
67
|
+
border-bottom-color: transparent;
|
|
68
|
+
border-radius: 100%;
|
|
69
|
+
animation: ball-clip-rotate 0.75s linear infinite;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@keyframes ball-clip-rotate {
|
|
73
|
+
0% {
|
|
74
|
+
transform: rotate(0deg);
|
|
75
|
+
}
|
|
76
|
+
50% {
|
|
77
|
+
transform: rotate(180deg);
|
|
78
|
+
}
|
|
79
|
+
100% {
|
|
80
|
+
transform: rotate(360deg);
|
|
81
|
+
}
|
|
82
|
+
}</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Loading } from './cmp.loading.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Loading } from './cmp.loading.svelte';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">let { ratio, children } = $props();
|
|
2
|
+
export {};
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<div class="proportional-container" style:--proportional-container--ratio={ratio}>
|
|
6
|
+
<div class="proportional-container__placer">
|
|
7
|
+
{@render children?.()}
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<style>.proportional-container {
|
|
12
|
+
--_proportional-container--ratio: var(--proportional-container--ratio, 1);
|
|
13
|
+
--_proportional-container--height: var(--proportional-container--height, auto);
|
|
14
|
+
--_proportional-container--width: var(--proportional-container--width, 100%);
|
|
15
|
+
width: var(--_proportional-container--width);
|
|
16
|
+
max-width: 100%;
|
|
17
|
+
height: var(--_proportional-container--height);
|
|
18
|
+
max-height: 100%;
|
|
19
|
+
aspect-ratio: var(--_proportional-container--ratio);
|
|
20
|
+
position: relative;
|
|
21
|
+
}
|
|
22
|
+
.proportional-container__placer {
|
|
23
|
+
position: absolute;
|
|
24
|
+
inset: 0;
|
|
25
|
+
}</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ProportionalContainer } from './cmp.proportional-container.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ProportionalContainer } from './cmp.proportional-container.svelte';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamscloud/kit",
|
|
3
|
-
"version": "0.0.1-
|
|
3
|
+
"version": "0.0.1-1770839905472",
|
|
4
4
|
"author": "StreamsCloud",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -88,6 +88,14 @@
|
|
|
88
88
|
"types": "./dist/ui/image/index.d.ts",
|
|
89
89
|
"svelte": "./dist/ui/image/index.js"
|
|
90
90
|
},
|
|
91
|
+
"./loading": {
|
|
92
|
+
"types": "./dist/ui/loading/index.d.ts",
|
|
93
|
+
"svelte": "./dist/ui/loading/index.js"
|
|
94
|
+
},
|
|
95
|
+
"./proportional-container": {
|
|
96
|
+
"types": "./dist/ui/proportional-container/index.d.ts",
|
|
97
|
+
"svelte": "./dist/ui/proportional-container/index.js"
|
|
98
|
+
},
|
|
91
99
|
"./core/media": {
|
|
92
100
|
"types": "./dist/core/media/index.d.ts",
|
|
93
101
|
"svelte": "./dist/core/media/index.js"
|