@streamscloud/kit 0.0.1-1770808655497 → 0.0.1-1770820176986

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.
@@ -0,0 +1,9 @@
1
+ export declare class ImageHelper {
2
+ static checkIsVertical: (url: string) => Promise<boolean>;
3
+ static computeRatio: (src: string) => Promise<ImageSize | null>;
4
+ static getRatio: (metadata: ImageSize) => number;
5
+ }
6
+ export type ImageSize = {
7
+ width: number;
8
+ height: number;
9
+ };
@@ -0,0 +1,30 @@
1
+ export class ImageHelper {
2
+ static checkIsVertical = async (url) => {
3
+ const ratio = await ImageHelper.computeRatio(url);
4
+ if (!ratio) {
5
+ return false;
6
+ }
7
+ return ratio.height >= ratio.width;
8
+ };
9
+ static computeRatio = async (src) => {
10
+ const setRatio = (imageElement, resolveFn) => {
11
+ if (!imageElement || !imageElement.width) {
12
+ resolveFn(null);
13
+ }
14
+ else {
15
+ resolveFn({ width: imageElement.width, height: imageElement.height });
16
+ }
17
+ };
18
+ return new Promise((resolve) => {
19
+ const imageElement = new Image();
20
+ imageElement.onload = () => {
21
+ setRatio(imageElement, resolve);
22
+ };
23
+ imageElement.onerror = () => {
24
+ setRatio(null, resolve);
25
+ };
26
+ imageElement.src = src;
27
+ });
28
+ };
29
+ static getRatio = (metadata) => metadata.width / metadata.height;
30
+ }
@@ -0,0 +1,2 @@
1
+ export { ImageHelper } from './image-helper';
2
+ export type { ImageSize } from './image-helper';
@@ -0,0 +1 @@
1
+ export { ImageHelper } from './image-helper';
@@ -0,0 +1,225 @@
1
+ /* Document
2
+ * ========================================================================== */
3
+ /**
4
+ * 1. Correct the line height in all browsers.
5
+ * 2. Prevent adjustments of font size after orientation changes in iOS.
6
+ */
7
+ :where(html) {
8
+ line-height: 1.15; /* 1 */
9
+ -webkit-text-size-adjust: 100%; /* 2 */
10
+ text-size-adjust: 100%; /* 2 */
11
+ }
12
+
13
+ /* Sections
14
+ * ========================================================================== */
15
+ /**
16
+ * Correct the font size and margin on `h1` elements within `section` and
17
+ * `article` contexts in Chrome, Edge, Firefox, and Safari.
18
+ */
19
+ :where(h1) {
20
+ font-size: 2em;
21
+ margin-block-end: 0.67em;
22
+ margin-block-start: 0.67em;
23
+ }
24
+
25
+ /* Grouping content
26
+ * ========================================================================== */
27
+ /**
28
+ * Remove the margin on nested lists in Chrome, Edge, and Safari.
29
+ */
30
+ :where(dl, ol, ul) :where(dl, ol, ul) {
31
+ margin-block-end: 0;
32
+ margin-block-start: 0;
33
+ }
34
+
35
+ /**
36
+ * 1. Add the correct box sizing in Firefox.
37
+ * 2. Correct the inheritance of border color in Firefox.
38
+ */
39
+ :where(hr) {
40
+ box-sizing: content-box; /* 1 */
41
+ color: inherit; /* 2 */
42
+ height: 0; /* 1 */
43
+ }
44
+
45
+ /* Text-level semantics
46
+ * ========================================================================== */
47
+ /**
48
+ * Add the correct text decoration in Safari.
49
+ */
50
+ :where(abbr[title]) {
51
+ text-decoration: underline;
52
+ text-decoration: underline dotted;
53
+ }
54
+
55
+ /**
56
+ * Add the correct font weight in Chrome, Edge, and Safari.
57
+ */
58
+ :where(b, strong) {
59
+ font-weight: bolder;
60
+ }
61
+
62
+ /**
63
+ * 1. Correct the inheritance and scaling of font size in all browsers.
64
+ * 2. Correct the odd `em` font sizing in all browsers.
65
+ */
66
+ :where(code, kbd, pre, samp) {
67
+ font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; /* 1 */
68
+ font-size: 1em; /* 2 */
69
+ }
70
+
71
+ /**
72
+ * Add the correct font size in all browsers.
73
+ */
74
+ :where(small) {
75
+ font-size: 80%;
76
+ }
77
+
78
+ /* Tabular data
79
+ * ========================================================================== */
80
+ /**
81
+ * 1. Correct table border color in Chrome, Edge, and Safari.
82
+ * 2. Remove text indentation from table contents in Chrome, Edge, and Safari.
83
+ */
84
+ :where(table) {
85
+ border-color: currentColor; /* 1 */
86
+ text-indent: 0; /* 2 */
87
+ }
88
+
89
+ /* Forms
90
+ * ========================================================================== */
91
+ /**
92
+ * Remove the margin on controls in Safari.
93
+ */
94
+ :where(button, input, select) {
95
+ margin: 0;
96
+ }
97
+
98
+ /**
99
+ * Remove the inheritance of text transform in Firefox.
100
+ */
101
+ :where(button) {
102
+ text-transform: none;
103
+ }
104
+
105
+ /**
106
+ * Correct the inability to style buttons in iOS and Safari.
107
+ */
108
+ :where(button, input:is([type=button i], [type=reset i], [type=submit i])) {
109
+ -webkit-appearance: button;
110
+ }
111
+
112
+ /**
113
+ * Add the correct vertical alignment in Chrome, Edge, and Firefox.
114
+ */
115
+ :where(progress) {
116
+ vertical-align: baseline;
117
+ }
118
+
119
+ /**
120
+ * Remove the inheritance of text transform in Firefox.
121
+ */
122
+ :where(select) {
123
+ text-transform: none;
124
+ }
125
+
126
+ /**
127
+ * Remove the margin in Firefox and Safari.
128
+ */
129
+ :where(textarea) {
130
+ margin: 0;
131
+ }
132
+
133
+ /**
134
+ * 1. Correct the odd appearance in Chrome, Edge, and Safari.
135
+ * 2. Correct the outline style in Safari.
136
+ */
137
+ :where(input[type=search i]) {
138
+ -webkit-appearance: textfield; /* 1 */
139
+ outline-offset: -2px; /* 2 */
140
+ }
141
+
142
+ /**
143
+ * Correct the cursor style of increment and decrement buttons in Safari.
144
+ */
145
+ ::-webkit-inner-spin-button,
146
+ ::-webkit-outer-spin-button {
147
+ height: auto;
148
+ }
149
+
150
+ /**
151
+ * Correct the text style of placeholders in Chrome, Edge, and Safari.
152
+ */
153
+ ::-webkit-input-placeholder {
154
+ color: inherit;
155
+ opacity: 0.54;
156
+ }
157
+
158
+ /**
159
+ * Remove the inner padding in Chrome, Edge, and Safari on macOS.
160
+ */
161
+ ::-webkit-search-decoration {
162
+ -webkit-appearance: none;
163
+ }
164
+
165
+ /**
166
+ * 1. Correct the inability to style upload buttons in iOS and Safari.
167
+ * 2. Change font properties to `inherit` in Safari.
168
+ */
169
+ ::-webkit-file-upload-button {
170
+ -webkit-appearance: button; /* 1 */
171
+ font: inherit; /* 2 */
172
+ }
173
+
174
+ /**
175
+ * Remove the inner border and padding of focus outlines in Firefox.
176
+ */
177
+ :where(button, input:is([type=button i], [type=color i], [type=reset i], [type=submit i]))::-moz-focus-inner {
178
+ border-style: none;
179
+ padding: 0;
180
+ }
181
+
182
+ /**
183
+ * Restore the focus outline styles unset by the previous rule in Firefox.
184
+ */
185
+ :where(button, input:is([type=button i], [type=color i], [type=reset i], [type=submit i]))::-moz-focusring {
186
+ outline: 1px dotted ButtonText;
187
+ }
188
+
189
+ /**
190
+ * Remove the additional :invalid styles in Firefox.
191
+ */
192
+ :where(:-moz-ui-invalid) {
193
+ box-shadow: none;
194
+ }
195
+
196
+ /* Interactive
197
+ * ========================================================================== */
198
+ /*
199
+ * Add the correct styles in Safari.
200
+ */
201
+ :where(dialog) {
202
+ background-color: white;
203
+ border: solid;
204
+ color: black;
205
+ height: -moz-fit-content;
206
+ height: fit-content;
207
+ left: 0;
208
+ margin: auto;
209
+ padding: 1em;
210
+ position: absolute;
211
+ right: 0;
212
+ width: -moz-fit-content;
213
+ width: fit-content;
214
+ }
215
+
216
+ :where(dialog:not([open])) {
217
+ display: none;
218
+ }
219
+
220
+ /*
221
+ * Add the correct display in all browsers.
222
+ */
223
+ :where(summary) {
224
+ display: list-item;
225
+ }
@@ -0,0 +1,194 @@
1
+ /*
2
+ * Modern CSS Reset
3
+ * Based on Josh W. Comeau's reset with custom additions
4
+ */
5
+ /* 1. Use a more-intuitive box-sizing model */
6
+ html {
7
+ box-sizing: border-box;
8
+ }
9
+
10
+ *,
11
+ *::before,
12
+ *::after {
13
+ box-sizing: inherit;
14
+ border-width: 0;
15
+ border-style: solid;
16
+ }
17
+
18
+ /* 2. Remove default margin */
19
+ *:not(dialog) {
20
+ margin: 0;
21
+ }
22
+
23
+ /* 3. Enable keyword animations */
24
+ @media (prefers-reduced-motion: no-preference) {
25
+ html {
26
+ interpolate-size: allow-keywords;
27
+ }
28
+ }
29
+ /* 4. Add accessible line-height and improve text rendering */
30
+ body {
31
+ line-height: 1.5;
32
+ -webkit-font-smoothing: antialiased;
33
+ }
34
+
35
+ /* 5. Improve media defaults */
36
+ img,
37
+ picture,
38
+ video,
39
+ canvas,
40
+ svg {
41
+ display: block;
42
+ vertical-align: middle;
43
+ max-width: 100%;
44
+ }
45
+
46
+ img {
47
+ border: none;
48
+ height: auto;
49
+ }
50
+
51
+ video {
52
+ outline: none;
53
+ }
54
+
55
+ /* 6. Inherit fonts for form controls */
56
+ input,
57
+ button,
58
+ textarea,
59
+ select {
60
+ font: inherit;
61
+ }
62
+
63
+ /* 7. Avoid text overflows */
64
+ p,
65
+ h1,
66
+ h2,
67
+ h3,
68
+ h4,
69
+ h5,
70
+ h6 {
71
+ overflow-wrap: break-word;
72
+ }
73
+
74
+ /* 8. Improve line wrapping */
75
+ p {
76
+ text-wrap: pretty;
77
+ }
78
+
79
+ h1,
80
+ h2,
81
+ h3,
82
+ h4,
83
+ h5,
84
+ h6 {
85
+ text-wrap: balance;
86
+ }
87
+
88
+ /* ========================================
89
+ * Custom additions
90
+ * ======================================== */
91
+ /* Lists */
92
+ ul,
93
+ ol {
94
+ list-style: none;
95
+ padding: 0;
96
+ }
97
+
98
+ li {
99
+ list-style: inherit;
100
+ }
101
+
102
+ /* Input & Textarea */
103
+ input {
104
+ vertical-align: middle;
105
+ min-width: 0;
106
+ }
107
+ input::placeholder {
108
+ color: var(--input--placeholder--color, #c1c1c1) !important;
109
+ }
110
+ input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
111
+ -webkit-background-clip: text;
112
+ }
113
+ input::-webkit-outer-spin-button, input::-webkit-inner-spin-button {
114
+ -webkit-appearance: none;
115
+ margin: 0;
116
+ }
117
+ input[type=number] {
118
+ -moz-appearance: textfield;
119
+ }
120
+
121
+ textarea {
122
+ vertical-align: top;
123
+ resize: vertical;
124
+ --_cross-browser-scrollbar--thumb-color: var(--scrollbar--thumb-color, #7d7d7d);
125
+ --_cross-browser-scrollbar--track-color: var(--scrollbar--track-color, transparent);
126
+ }
127
+ textarea::-webkit-scrollbar {
128
+ width: 6px;
129
+ height: 6px;
130
+ }
131
+ textarea::-webkit-scrollbar-track {
132
+ background: var(--_cross-browser-scrollbar--track-color);
133
+ border-radius: 100vw;
134
+ }
135
+ textarea::-webkit-scrollbar-thumb {
136
+ background: var(--_cross-browser-scrollbar--thumb-color);
137
+ border-radius: 100vw;
138
+ }
139
+ @supports (scrollbar-color: transparent transparent) {
140
+ textarea {
141
+ scrollbar-color: var(--_cross-browser-scrollbar--thumb-color) var(--_cross-browser-scrollbar--track-color);
142
+ scrollbar-width: thin;
143
+ }
144
+ }
145
+ textarea::placeholder {
146
+ color: var(--input--placeholder--color, #c1c1c1) !important;
147
+ }
148
+
149
+ input:focus,
150
+ textarea:focus {
151
+ outline: none;
152
+ }
153
+
154
+ /* Button */
155
+ button,
156
+ input[type=submit] {
157
+ cursor: pointer;
158
+ -webkit-appearance: none;
159
+ background-color: transparent;
160
+ padding: 0;
161
+ text-align: left;
162
+ color: inherit;
163
+ }
164
+ button:focus,
165
+ input[type=submit]:focus {
166
+ outline: none;
167
+ }
168
+ button:disabled,
169
+ input[type=submit]:disabled {
170
+ cursor: default;
171
+ }
172
+
173
+ /* Details/Summary */
174
+ details summary {
175
+ list-style: none;
176
+ }
177
+ details summary::-webkit-details-marker {
178
+ display: none;
179
+ }
180
+ details > * {
181
+ box-sizing: border-box;
182
+ }
183
+
184
+ /* Links */
185
+ a {
186
+ color: inherit;
187
+ text-decoration: none;
188
+ transition: color linear 0.2s;
189
+ }
190
+
191
+ /* Table */
192
+ table {
193
+ border-collapse: collapse;
194
+ }
@@ -0,0 +1,26 @@
1
+ <script lang="ts">import RoundedImg from './cmp.image-rounded.svelte';
2
+ let { src, alt = '', ring = false, on } = $props();
3
+ </script>
4
+
5
+ <div class="round-img">
6
+ <div class="round-img__placer">
7
+ <RoundedImg src={src} alt={alt} ring={ring} on={on} />
8
+ </div>
9
+ </div>
10
+
11
+ <style>.round-img {
12
+ --_image--round--size: var(--image--round--size, 100%);
13
+ --image--rounded--inner--border-radius: 50%;
14
+ --image--rounded--outer--border-radius: 50%;
15
+ --image--rounded--image--border-radius: 50%;
16
+ --image--rounded--width: 100%;
17
+ --image--rounded--height: 100%;
18
+ display: inline-block;
19
+ width: var(--_image--round--size);
20
+ position: relative;
21
+ padding-bottom: var(--_image--round--size);
22
+ }
23
+ .round-img__placer {
24
+ position: absolute;
25
+ inset: 0;
26
+ }</style>
@@ -0,0 +1,11 @@
1
+ type Props = {
2
+ src: string | null | undefined;
3
+ alt?: string;
4
+ ring?: boolean;
5
+ on?: {
6
+ click: () => void;
7
+ };
8
+ };
9
+ declare const Cmp: import("svelte").Component<Props, {}, "">;
10
+ type Cmp = ReturnType<typeof Cmp>;
11
+ export default Cmp;
@@ -0,0 +1,62 @@
1
+ <script lang="ts">import Image from './cmp.image.svelte';
2
+ let { src, alt = '', ring = false, on } = $props();
3
+ </script>
4
+
5
+ <div class="rounded-img" class:rounded-img--stub={!src} class:rounded-img--no-ring={!ring}>
6
+ <div class="rounded-img__placer" onclick={() => on?.click()} onkeydown={() => ({})} role="none">
7
+ <Image src={src} alt={alt} showStubOnError={true} />
8
+ </div>
9
+ </div>
10
+
11
+ <style>.rounded-img {
12
+ --_image--rounded--size: var(--image--rounded--size, 100%);
13
+ --_image--rounded--width: var(--image--rounded--width, var(--_image--rounded--size));
14
+ --_image--rounded--height: var(--image--rounded--height, var(--_image--rounded--size));
15
+ --_image--rounded--image--border-radius: var(
16
+ --image--rounded--image--border-radius,
17
+ calc(var(--_image--rounded--inner--border-radius) - var(--_image--rounded--inner--border-width))
18
+ );
19
+ --_image--rounded--inner--border-color: var(--image--rounded--inner--border-color, light-dark(#ffffff, #121212));
20
+ --_image--rounded--inner--border-radius: var(
21
+ --image--rounded--inner--border-radius,
22
+ calc(var(--_image--rounded--outer--border-radius) - var(--_image--rounded--outer--border-width))
23
+ );
24
+ --_image--rounded--inner--border-width: var(--image--rounded--inner--border-width, 4px);
25
+ --_image--rounded--outer--border-color: var(
26
+ --image--rounded--outer--border-color,
27
+ linear-gradient(
28
+ light-dark(#144ab0, #5a8dec),
29
+ light-dark(#dfe9fb, #0c2d69)
30
+ )
31
+ );
32
+ --_image--rounded--outer--border-radius: var(--image--rounded--outer--border-radius, 2px);
33
+ --_image--rounded--outer--border-width: var(--image--rounded--outer--border-width, 2px);
34
+ --_image--rounded--stub--background: var(
35
+ --image--rounded--stub--background,
36
+ var(--sc-color--bg-images, light-dark(#d1d5db, #374151))
37
+ );
38
+ width: var(--_image--rounded--width);
39
+ height: var(--_image--rounded--height);
40
+ border-radius: var(--_image--rounded--outer--border-radius);
41
+ padding: var(--_image--rounded--outer--border-width);
42
+ background: var(--_image--rounded--outer--border-color);
43
+ overflow: hidden;
44
+ }
45
+ .rounded-img--stub {
46
+ background: var(--_image--rounded--stub--background);
47
+ }
48
+ .rounded-img--no-ring {
49
+ --_image--rounded--outer--border-width: 0;
50
+ --_image--rounded--inner--border-width: 0;
51
+ --_image--rounded--outer--border-color: transparent;
52
+ --_image--rounded--inner--border-color: transparent;
53
+ }
54
+ .rounded-img__placer {
55
+ width: 100%;
56
+ height: 100%;
57
+ border-radius: var(--_image--rounded--inner--border-radius);
58
+ padding: var(--_image--rounded--inner--border-width);
59
+ background: var(--_image--rounded--inner--border-color);
60
+ overflow: hidden;
61
+ --image--border-radius: var(--_image--rounded--image--border-radius);
62
+ }</style>
@@ -0,0 +1,11 @@
1
+ type Props = {
2
+ src: string | null | undefined;
3
+ alt?: string;
4
+ ring?: boolean;
5
+ on?: {
6
+ click: () => void;
7
+ };
8
+ };
9
+ declare const Cmp: import("svelte").Component<Props, {}, "">;
10
+ type Cmp = ReturnType<typeof Cmp>;
11
+ export default Cmp;
@@ -0,0 +1,20 @@
1
+ <script lang="ts">import { Icon } from '../icon';
2
+ import IconImage from '@fluentui/svg-icons/icons/image_20_regular.svg?raw';
3
+ </script>
4
+
5
+ <div class="image-stub">
6
+ <Icon src={IconImage} />
7
+ </div>
8
+
9
+ <style>.image-stub {
10
+ --_image-stub--color: var(--image-stub--color, var(--sc-color--bg-images, light-dark(#d1d5db, #374151)));
11
+ width: 100%;
12
+ height: 100%;
13
+ z-index: 2;
14
+ display: flex;
15
+ justify-content: center;
16
+ align-items: center;
17
+ color: var(--_image-stub--color);
18
+ border: 1px solid var(--_image-stub--color);
19
+ border-radius: 0.25rem;
20
+ }</style>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const Cmp: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type Cmp = InstanceType<typeof Cmp>;
18
+ export default Cmp;
@@ -0,0 +1,71 @@
1
+ <script lang="ts">import { Icon } from '../icon';
2
+ import { calculateImageState, ImageState } from './image-state';
3
+ import IconImageOff from '@fluentui/svg-icons/icons/image_off_20_regular.svg?raw';
4
+ let { src, alt = '', showStubOnError = false, on, stub } = $props();
5
+ let hasError = $state(false);
6
+ const imageState = $derived(calculateImageState(src, hasError, showStubOnError));
7
+ const onLoad = () => {
8
+ hasError = false;
9
+ on?.load(true);
10
+ };
11
+ const onLoadError = () => {
12
+ hasError = true;
13
+ on?.load(false);
14
+ };
15
+ </script>
16
+
17
+ <div class="image">
18
+ {#if !!src}
19
+ <img class="image__img" class:image__img--hidden={imageState !== ImageState.showImage} src={src} alt={alt || ''} onload={onLoad} onerror={onLoadError} />
20
+ {/if}
21
+
22
+ {#if imageState === ImageState.showError}
23
+ <div class="image__load-error">
24
+ <Icon src={IconImageOff} />
25
+ </div>
26
+ {/if}
27
+
28
+ {#if imageState === ImageState.showStub}
29
+ {#if stub}
30
+ {@render stub()}
31
+ {:else}
32
+ <div class="image__img image__img--stub"></div>
33
+ {/if}
34
+ {/if}
35
+ </div>
36
+
37
+ <style>.image {
38
+ --_image--background: var(--image--background, transparent);
39
+ --_image--border-radius: var(--image--border-radius, 0);
40
+ --_image--object-fit: var(--image--object-fit, cover);
41
+ --_image--stub--background: var(
42
+ --image--stub--background,
43
+ var(--sc-color--bg-images, light-dark(#d1d5db, #374151))
44
+ );
45
+ position: relative;
46
+ width: 100%;
47
+ height: 100%;
48
+ overflow: hidden;
49
+ border-radius: var(--_image--border-radius);
50
+ background: var(--_image--background);
51
+ }
52
+ .image__img {
53
+ width: 100%;
54
+ height: 100%;
55
+ z-index: 2;
56
+ object-fit: var(--_image--object-fit);
57
+ }
58
+ .image__img--hidden {
59
+ display: none;
60
+ }
61
+ .image__img--stub {
62
+ background: var(--_image--stub--background);
63
+ }
64
+ .image__load-error {
65
+ position: absolute;
66
+ top: 50%;
67
+ left: 50%;
68
+ transform: translate(-50%, -50%);
69
+ font-size: 1.2em;
70
+ text-align: center;
71
+ }</style>
@@ -0,0 +1,13 @@
1
+ import type { Snippet } from 'svelte';
2
+ type Props = {
3
+ src: string | null | undefined;
4
+ alt?: string;
5
+ showStubOnError?: boolean;
6
+ on?: {
7
+ load: (loadedSuccessfully: boolean) => void;
8
+ };
9
+ stub?: Snippet;
10
+ };
11
+ declare const Cmp: import("svelte").Component<Props, {}, "">;
12
+ type Cmp = ReturnType<typeof Cmp>;
13
+ export default Cmp;
@@ -0,0 +1,6 @@
1
+ export declare enum ImageState {
2
+ showImage = 0,
3
+ showError = 1,
4
+ showStub = 2
5
+ }
6
+ export declare const calculateImageState: (src: string | null | undefined, isError: boolean, showStubOnError: boolean) => ImageState;
@@ -0,0 +1,17 @@
1
+ export var ImageState;
2
+ (function (ImageState) {
3
+ ImageState[ImageState["showImage"] = 0] = "showImage";
4
+ ImageState[ImageState["showError"] = 1] = "showError";
5
+ ImageState[ImageState["showStub"] = 2] = "showStub";
6
+ })(ImageState || (ImageState = {}));
7
+ export const calculateImageState = (src, isError, showStubOnError) => {
8
+ if (isError && !showStubOnError) {
9
+ return ImageState.showError;
10
+ }
11
+ else if (!src || (isError && showStubOnError)) {
12
+ return ImageState.showStub;
13
+ }
14
+ else {
15
+ return ImageState.showImage;
16
+ }
17
+ };
@@ -0,0 +1,5 @@
1
+ export { default as Image } from './cmp.image.svelte';
2
+ export { default as ImageRound } from './cmp.image-round.svelte';
3
+ export { default as ImageRounded } from './cmp.image-rounded.svelte';
4
+ export { default as ImageStub } from './cmp.image-stub.svelte';
5
+ export { ImageState, calculateImageState } from './image-state';
@@ -0,0 +1,5 @@
1
+ export { default as Image } from './cmp.image.svelte';
2
+ export { default as ImageRound } from './cmp.image-round.svelte';
3
+ export { default as ImageRounded } from './cmp.image-rounded.svelte';
4
+ export { default as ImageStub } from './cmp.image-stub.svelte';
5
+ export { ImageState, calculateImageState } from './image-state';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/kit",
3
- "version": "0.0.1-1770808655497",
3
+ "version": "0.0.1-1770820176986",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,9 +9,10 @@
9
9
  "type": "module",
10
10
  "scripts": {
11
11
  "dev": "vite dev --port 3011 --host",
12
- "build": "svelte-package --tsconfig ./tsconfig.app.json && prettier --write --plugin prettier-plugin-svelte . && eslint --fix .",
12
+ "build": "svelte-package --tsconfig ./tsconfig.app.json && npm run build:css && prettier --write --plugin prettier-plugin-svelte . && eslint --fix .",
13
+ "build:css": "sass dist/styles/_normalize.scss dist/styles/normalize.css --no-source-map && sass dist/styles/_reset.scss dist/styles/reset.css --no-source-map",
13
14
  "publish:prod": "npm run build && npm publish --access public --tag latest",
14
- "version:dev": "node -e \"const fs=require('fs');const pkg=require('./package.json');const base=(pkg.version.includes('-')?pkg.version.split('-')[0]:pkg.version);pkg.version=base+'-'+Date.now();fs.writeFileSync('package.json',JSON.stringify(pkg,null,2)+'\\n');\"",
15
+ "version:dev": "node -e \"const p=require('./package.json');p.version=p.version.split('-')[0]+'-'+Date.now();require('fs').writeFileSync('package.json',JSON.stringify(p,null,2)+'\\n')\"",
15
16
  "publish:dev": "npm run build && npm run version:dev && npm publish --tag next && git checkout -- package.json",
16
17
  "pack": "npm run build && npm pack",
17
18
  "preview": "vite preview",
@@ -83,6 +84,14 @@
83
84
  "types": "./dist/ui/icon/index.d.ts",
84
85
  "svelte": "./dist/ui/icon/index.js"
85
86
  },
87
+ "./image": {
88
+ "types": "./dist/ui/image/index.d.ts",
89
+ "svelte": "./dist/ui/image/index.js"
90
+ },
91
+ "./core/media": {
92
+ "types": "./dist/core/media/index.d.ts",
93
+ "svelte": "./dist/core/media/index.js"
94
+ },
86
95
  "./styles/functions": {
87
96
  "sass": "./dist/styles/_functions.scss"
88
97
  },
@@ -98,6 +107,8 @@
98
107
  "./styles/base": {
99
108
  "sass": "./dist/styles/_index.scss"
100
109
  },
110
+ "./styles/normalize.css": "./dist/styles/normalize.css",
111
+ "./styles/reset.css": "./dist/styles/reset.css",
101
112
  "./styles/theme": {
102
113
  "sass": "./dist/styles/_theme.scss"
103
114
  }
@@ -111,7 +122,7 @@
111
122
  "mime": "^4.1.0",
112
123
  "nanoid": "^5.1.6",
113
124
  "rfdc": "^1.4.1",
114
- "svelte": "^5.49.2",
125
+ "svelte": "^5.50.0",
115
126
  "svelte-sonner": "^1.0.7",
116
127
  "yup": "^1.7.1"
117
128
  },