@streamscloud/kit 0.1.10 → 0.1.12-1772032209109
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/index.d.ts +1 -1
- package/dist/core/toastr/toastr.scss +38 -0
- package/dist/core/toastr/toastr.svelte.d.ts +1 -1
- package/dist/core/toastr/toastr.svelte.js +13 -6
- package/dist/core/toastr/types.d.ts +2 -0
- package/dist/ui/cropper/image-editor-dialog/cmp.image-editor-dialog.svelte +9 -8
- package/dist/ui/cropper/image-editor-dialog/index.d.ts +4 -4
- package/dist/ui/cropper/image-editor-dialog/index.js +3 -3
- package/dist/ui/cropper/image-editor-dialog/types.d.ts +12 -12
- package/dist/ui/cropper/img-cropper/cmp.img-cropper.svelte +28 -38
- package/dist/ui/cropper/img-cropper/cmp.img-cropper.svelte.d.ts +8 -10
- package/dist/ui/cropper/img-cropper/img-cropper-base-worker.svelte.d.ts +40 -0
- package/dist/ui/cropper/img-cropper/img-cropper-base-worker.svelte.js +175 -0
- package/dist/ui/cropper/img-cropper/img-cropper-contain-worker.svelte.d.ts +5 -38
- package/dist/ui/cropper/img-cropper/img-cropper-contain-worker.svelte.js +29 -149
- package/dist/ui/cropper/img-cropper/img-cropper-cover-worker.svelte.d.ts +5 -38
- package/dist/ui/cropper/img-cropper/img-cropper-cover-worker.svelte.js +37 -135
- package/dist/ui/cropper/img-cropper/img-cropper-utils.d.ts +11 -1
- package/dist/ui/cropper/img-cropper/img-cropper-utils.js +30 -0
- package/dist/ui/cropper/img-cropper/img-cropper-worker.svelte.d.ts +17 -14
- package/dist/ui/cropper/img-cropper/img-cropper.svelte.d.ts +13 -31
- package/dist/ui/cropper/img-cropper/img-cropper.svelte.js +29 -28
- package/dist/ui/cropper/img-cropper/index.d.ts +1 -1
- package/dist/ui/dialog/cmp.dialog-container.svelte +12 -12
- package/dist/ui/dialog/dialog-data.d.ts +2 -0
- package/dist/ui/dialog/dialog-mount.d.ts +1 -1
- package/dist/ui/dialog/dialog-mount.js +2 -2
- package/dist/ui/dialog/dialogs.svelte.d.ts +3 -0
- package/dist/ui/dialog/dialogs.svelte.js +21 -2
- package/dist/ui/dialog/index.d.ts +1 -1
- package/dist/ui/dialog/index.js +1 -1
- package/dist/ui/dialog/types.svelte.d.ts +3 -14
- package/dist/ui/dialog/types.svelte.js +3 -18
- package/dist/ui/form-group/cmp.form-group-label.svelte +25 -0
- package/dist/ui/form-group/cmp.form-group-label.svelte.d.ts +8 -0
- package/dist/ui/form-group/cmp.form-group-note.svelte +16 -0
- package/dist/ui/form-group/cmp.form-group-note.svelte.d.ts +7 -0
- package/dist/ui/form-group/cmp.form-group.svelte +16 -0
- package/dist/ui/form-group/cmp.form-group.svelte.d.ts +8 -0
- package/dist/ui/form-group/index.d.ts +3 -0
- package/dist/ui/form-group/index.js +3 -0
- package/dist/ui/html-block/cmp.html-block.svelte +112 -0
- package/dist/ui/html-block/cmp.html-block.svelte.d.ts +7 -0
- package/dist/ui/html-block/index.d.ts +1 -0
- package/dist/ui/html-block/index.js +1 -0
- package/dist/ui/media-viewer-dialog/cmp.media-viewer-dialog.svelte +50 -0
- package/dist/ui/media-viewer-dialog/cmp.media-viewer-dialog.svelte.d.ts +9 -0
- package/dist/ui/media-viewer-dialog/index.d.ts +13 -0
- package/dist/ui/media-viewer-dialog/index.js +17 -0
- package/dist/ui/media-viewer-dialog/media-viewer-item.svelte +61 -0
- package/dist/ui/media-viewer-dialog/media-viewer-item.svelte.d.ts +7 -0
- package/dist/ui/media-viewer-dialog/types.d.ts +13 -0
- package/dist/ui/media-viewer-dialog/types.js +1 -0
- package/dist/ui/player/carousel/cmp.carousel.svelte +2 -2
- package/dist/ui/player/carousel/cmp.carousel.svelte.d.ts +1 -1
- package/dist/ui/video/cmp.video.svelte +16 -7
- package/package.json +14 -1
|
@@ -2,20 +2,19 @@ import { FileWithBlobDataHelper } from '../../../core/files';
|
|
|
2
2
|
import { ColorHelper, Utils } from '../../../core/utils';
|
|
3
3
|
import { ImgCropperContainWorker } from './img-cropper-contain-worker.svelte';
|
|
4
4
|
import { ImgCropperCoverWorker } from './img-cropper-cover-worker.svelte';
|
|
5
|
+
import { detectMimeFromUrl } from './img-cropper-utils';
|
|
5
6
|
export class ImgCropper {
|
|
6
7
|
loading = $state(false);
|
|
7
8
|
ready = $state(false);
|
|
8
9
|
fillColor = $state('');
|
|
9
|
-
aspectRatio = $state(null);
|
|
10
10
|
mode;
|
|
11
|
-
corsMode;
|
|
12
11
|
ratioOptions;
|
|
13
12
|
showImageShadow;
|
|
14
13
|
_worker = $state.raw(null);
|
|
15
14
|
_originalSrc = null;
|
|
15
|
+
_defaultGeometry;
|
|
16
16
|
constructor(options) {
|
|
17
17
|
this.mode = options.mode;
|
|
18
|
-
this.corsMode = options.corsMode ?? 'native';
|
|
19
18
|
this.fillColor = options.fillColor ?? '';
|
|
20
19
|
this.showImageShadow = options.showImageShadow ?? true;
|
|
21
20
|
const toOption = (r) => {
|
|
@@ -26,23 +25,14 @@ export class ImgCropper {
|
|
|
26
25
|
return ldd ? { label: `${ldd.dividend}:${ldd.divisor}`, value: r } : { label: String(r), value: r };
|
|
27
26
|
};
|
|
28
27
|
const toRatioOptions = (items) => (items.length >= 2 ? items : null);
|
|
28
|
+
let initialRatio;
|
|
29
29
|
if (options.aspectRatio === undefined || typeof options.aspectRatio === 'number') {
|
|
30
|
-
|
|
30
|
+
initialRatio = options.aspectRatio ?? null;
|
|
31
31
|
this.ratioOptions = null;
|
|
32
32
|
}
|
|
33
|
-
else if (options.mode === 'cover') {
|
|
34
|
-
const dynamic = options.aspectRatio;
|
|
35
|
-
this.aspectRatio = dynamic.initial;
|
|
36
|
-
const supported = [...dynamic.supported];
|
|
37
|
-
if (!supported.includes(dynamic.initial)) {
|
|
38
|
-
supported.unshift(dynamic.initial);
|
|
39
|
-
}
|
|
40
|
-
this.ratioOptions = toRatioOptions(supported.map(toOption));
|
|
41
|
-
}
|
|
42
33
|
else {
|
|
43
34
|
const dynamic = options.aspectRatio;
|
|
44
|
-
|
|
45
|
-
this.aspectRatio = initialRatio;
|
|
35
|
+
initialRatio = dynamic.initial ?? (dynamic.allowFreeCrop ? null : (dynamic.supported[0] ?? null));
|
|
46
36
|
const supported = [...dynamic.supported];
|
|
47
37
|
if (initialRatio !== null && !supported.includes(initialRatio)) {
|
|
48
38
|
supported.unshift(initialRatio);
|
|
@@ -52,6 +42,7 @@ export class ImgCropper {
|
|
|
52
42
|
}
|
|
53
43
|
this.ratioOptions = toRatioOptions(supported.map(toOption));
|
|
54
44
|
}
|
|
45
|
+
this._defaultGeometry = { aspectRatio: initialRatio, width: 0, height: 0 };
|
|
55
46
|
}
|
|
56
47
|
get showFillColor() {
|
|
57
48
|
return this.mode === 'contain';
|
|
@@ -59,14 +50,11 @@ export class ImgCropper {
|
|
|
59
50
|
get isTransparentFill() {
|
|
60
51
|
return ColorHelper.isTransparent(this.fillColor);
|
|
61
52
|
}
|
|
62
|
-
get
|
|
63
|
-
return this.
|
|
53
|
+
get canvasGeometry() {
|
|
54
|
+
return this._worker?.canvasGeometry ?? this._defaultGeometry;
|
|
64
55
|
}
|
|
65
|
-
get
|
|
66
|
-
return this.
|
|
67
|
-
}
|
|
68
|
-
get naturalHeight() {
|
|
69
|
-
return this._worker?.naturalHeight ?? 0;
|
|
56
|
+
get aspectRatio() {
|
|
57
|
+
return this.canvasGeometry.aspectRatio;
|
|
70
58
|
}
|
|
71
59
|
get cropBoxVisible() {
|
|
72
60
|
return this._worker?.cropBoxVisible ?? false;
|
|
@@ -79,17 +67,24 @@ export class ImgCropper {
|
|
|
79
67
|
this.loading = true;
|
|
80
68
|
try {
|
|
81
69
|
let resolvedSrc = params.src;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
70
|
+
let sourceMime = null;
|
|
71
|
+
const file = await FileWithBlobDataHelper.fromUrl(params.src);
|
|
72
|
+
if (file) {
|
|
73
|
+
resolvedSrc = file.blobUrl;
|
|
74
|
+
sourceMime = file.type || null;
|
|
85
75
|
this._originalSrc = resolvedSrc;
|
|
86
76
|
}
|
|
77
|
+
if (!sourceMime) {
|
|
78
|
+
sourceMime = detectMimeFromUrl(params.src);
|
|
79
|
+
}
|
|
87
80
|
const workerParams = {
|
|
88
81
|
originalSrc: resolvedSrc,
|
|
82
|
+
sourceMime,
|
|
89
83
|
image: params.cropperImage,
|
|
90
84
|
selection: params.cropperSelection,
|
|
91
85
|
canvas: params.cropperCanvas,
|
|
92
|
-
selectHandle: params.selectHandle
|
|
86
|
+
selectHandle: params.selectHandle,
|
|
87
|
+
aspectRatio: this._defaultGeometry.aspectRatio
|
|
93
88
|
};
|
|
94
89
|
this._worker = this.mode === 'cover' ? new ImgCropperCoverWorker(workerParams) : new ImgCropperContainWorker(workerParams);
|
|
95
90
|
await this._worker.ready();
|
|
@@ -121,7 +116,10 @@ export class ImgCropper {
|
|
|
121
116
|
await this._worker?.reset();
|
|
122
117
|
};
|
|
123
118
|
changeAspectRatio = async (ratio) => {
|
|
124
|
-
this.
|
|
119
|
+
if (this._worker) {
|
|
120
|
+
this._worker.canvasGeometry = { ...this._worker.canvasGeometry, aspectRatio: ratio };
|
|
121
|
+
}
|
|
122
|
+
this._defaultGeometry = { ...this._defaultGeometry, aspectRatio: ratio };
|
|
125
123
|
await this.reset();
|
|
126
124
|
};
|
|
127
125
|
crop = async () => {
|
|
@@ -130,7 +128,7 @@ export class ImgCropper {
|
|
|
130
128
|
}
|
|
131
129
|
this.loading = true;
|
|
132
130
|
try {
|
|
133
|
-
return await this._worker.crop({ fillColor: this.fillColor
|
|
131
|
+
return await this._worker.crop({ fillColor: this.fillColor });
|
|
134
132
|
}
|
|
135
133
|
finally {
|
|
136
134
|
this.loading = false;
|
|
@@ -157,4 +155,7 @@ export class ImgCropper {
|
|
|
157
155
|
enableMoveMode = () => {
|
|
158
156
|
this._worker?.clearSelection();
|
|
159
157
|
};
|
|
158
|
+
refit = () => {
|
|
159
|
+
void this._worker?.refit();
|
|
160
|
+
};
|
|
160
161
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as ImgCropperControls } from './cmp.img-cropper-controls.svelte';
|
|
2
2
|
export { default as ImgCropperToolbar } from './cmp.img-cropper-toolbar.svelte';
|
|
3
3
|
export { default as ImgCropperView } from './cmp.img-cropper.svelte';
|
|
4
|
-
export { type
|
|
4
|
+
export { type CanvasGeometry, type CropperMode, type DragMode, ImgCropper, type ImgCropperDynamicAspectRatio, type ImgCropperOptions, type ImgCropperRatioOption, type ImgCropperSaveResult } from './img-cropper.svelte';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" generics="TResult = void, TCancelResult = void, TData = void">import { Dialogs } from './dialogs.svelte';
|
|
2
|
-
import {
|
|
2
|
+
import { DIALOG_SIZES } from './types.svelte';
|
|
3
3
|
import { untrack } from 'svelte';
|
|
4
4
|
let { dialog } = $props();
|
|
5
5
|
let dialogElement = $state();
|
|
@@ -57,7 +57,7 @@ $effect(() => {
|
|
|
57
57
|
});
|
|
58
58
|
const size = $derived(dialog.controller.containerSettings.size);
|
|
59
59
|
const position = $derived(dialog.controller.containerSettings.position);
|
|
60
|
-
const isCustomWidth = $derived(!
|
|
60
|
+
const isCustomWidth = $derived(!DIALOG_SIZES.includes(size));
|
|
61
61
|
const customWidth = $derived(isCustomWidth ? size : null);
|
|
62
62
|
</script>
|
|
63
63
|
|
|
@@ -65,16 +65,16 @@ const customWidth = $derived(isCustomWidth ? size : null);
|
|
|
65
65
|
bind:this={dialogElement}
|
|
66
66
|
class="dialog-container"
|
|
67
67
|
class:dialog-container--inactive={!isActive}
|
|
68
|
-
class:dialog-container--size-small={size ===
|
|
69
|
-
class:dialog-container--size-medium={size ===
|
|
70
|
-
class:dialog-container--size-default={size ===
|
|
71
|
-
class:dialog-container--size-large={size ===
|
|
72
|
-
class:dialog-container--size-fullhd={size ===
|
|
73
|
-
class:dialog-container--size-auto={size ===
|
|
74
|
-
class:dialog-container--position-center={position ===
|
|
75
|
-
class:dialog-container--position-center-top={position ===
|
|
76
|
-
class:dialog-container--position-full-screen={position ===
|
|
77
|
-
class:dialog-container--position-full-height={position ===
|
|
68
|
+
class:dialog-container--size-small={size === 'small'}
|
|
69
|
+
class:dialog-container--size-medium={size === 'medium'}
|
|
70
|
+
class:dialog-container--size-default={size === 'default'}
|
|
71
|
+
class:dialog-container--size-large={size === 'large'}
|
|
72
|
+
class:dialog-container--size-fullhd={size === 'fullhd'}
|
|
73
|
+
class:dialog-container--size-auto={size === 'auto'}
|
|
74
|
+
class:dialog-container--position-center={position === 'center'}
|
|
75
|
+
class:dialog-container--position-center-top={position === 'center-top'}
|
|
76
|
+
class:dialog-container--position-full-screen={position === 'full-screen'}
|
|
77
|
+
class:dialog-container--position-full-height={position === 'full-height'}
|
|
78
78
|
onkeydown={handleKeydown}
|
|
79
79
|
oncancel={handleCancel}
|
|
80
80
|
onclick={handleBackdropClick}
|
|
@@ -23,5 +23,7 @@ export type DialogInit<TData = void, TResult = void, TCancelResult = void> = {
|
|
|
23
23
|
data?: TData;
|
|
24
24
|
explicitSettings?: Partial<DialogSettings>;
|
|
25
25
|
containerSettings?: Partial<DialogContainerSettings>;
|
|
26
|
+
/** Mount target for the dialog element. Useful for shadow DOM isolation. Defaults to `document.body`. */
|
|
27
|
+
host?: ParentNode;
|
|
26
28
|
};
|
|
27
29
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { AnyDialogData } from './dialog-data';
|
|
2
|
-
export declare const mountDialog: (dialog: AnyDialogData) => void;
|
|
2
|
+
export declare const mountDialog: (dialog: AnyDialogData, host?: ParentNode) => void;
|
|
3
3
|
export declare const unmountDialog: (dialog: AnyDialogData) => void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { default as DialogContainer } from './cmp.dialog-container.svelte';
|
|
2
2
|
import { mount, unmount } from 'svelte';
|
|
3
|
-
export const mountDialog = (dialog) => {
|
|
3
|
+
export const mountDialog = (dialog, host) => {
|
|
4
4
|
const hostElement = document.createElement('div');
|
|
5
5
|
hostElement.setAttribute('data-dialog-host', String(dialog.id));
|
|
6
|
-
document.body.appendChild(hostElement);
|
|
6
|
+
(host ?? document.body).appendChild(hostElement);
|
|
7
7
|
const component = mount(DialogContainer, {
|
|
8
8
|
target: hostElement,
|
|
9
9
|
props: { dialog }
|
|
@@ -3,11 +3,14 @@ import { type DialogResult } from './types.svelte';
|
|
|
3
3
|
export declare class DialogsContainer {
|
|
4
4
|
private _dialogs;
|
|
5
5
|
private _mountModule;
|
|
6
|
+
private _savedOverflow;
|
|
6
7
|
get all(): ReadonlyArray<AnyDialogData>;
|
|
7
8
|
get active(): AnyDialogData | null;
|
|
8
9
|
get count(): number;
|
|
9
10
|
open: <TData = void, TResult = void, TCancelResult = void>(init: DialogInit<TData, TResult, TCancelResult>, id?: number) => Promise<DialogResult<TResult, TCancelResult>>;
|
|
10
11
|
close: (id: number) => void;
|
|
11
12
|
closeAll: () => void;
|
|
13
|
+
private lockBodyScroll;
|
|
14
|
+
private unlockBodyScroll;
|
|
12
15
|
}
|
|
13
16
|
export declare const Dialogs: DialogsContainer;
|
|
@@ -5,6 +5,7 @@ import {} from './types.svelte';
|
|
|
5
5
|
export class DialogsContainer {
|
|
6
6
|
_dialogs = $state.raw([]);
|
|
7
7
|
_mountModule = null;
|
|
8
|
+
_savedOverflow = null;
|
|
8
9
|
get all() {
|
|
9
10
|
return this._dialogs;
|
|
10
11
|
}
|
|
@@ -18,7 +19,7 @@ export class DialogsContainer {
|
|
|
18
19
|
if (!this._mountModule) {
|
|
19
20
|
this._mountModule = await import('./dialog-mount');
|
|
20
21
|
}
|
|
21
|
-
const { view, data, explicitSettings, containerSettings } = init;
|
|
22
|
+
const { view, data, explicitSettings, containerSettings, host } = init;
|
|
22
23
|
const controller = new DialogController({
|
|
23
24
|
id,
|
|
24
25
|
onClose: () => {
|
|
@@ -26,6 +27,9 @@ export class DialogsContainer {
|
|
|
26
27
|
if (dialog) {
|
|
27
28
|
this._mountModule?.unmountDialog(dialog);
|
|
28
29
|
this._dialogs = this._dialogs.filter((d) => d.id !== id);
|
|
30
|
+
if (this._dialogs.length === 0) {
|
|
31
|
+
this.unlockBodyScroll();
|
|
32
|
+
}
|
|
29
33
|
}
|
|
30
34
|
},
|
|
31
35
|
settings: explicitSettings,
|
|
@@ -38,7 +42,8 @@ export class DialogsContainer {
|
|
|
38
42
|
controller
|
|
39
43
|
};
|
|
40
44
|
this._dialogs = [...this._dialogs, newDialog];
|
|
41
|
-
this.
|
|
45
|
+
this.lockBodyScroll();
|
|
46
|
+
this._mountModule.mountDialog(newDialog, host);
|
|
42
47
|
return controller.openedPromise;
|
|
43
48
|
};
|
|
44
49
|
close = (id) => {
|
|
@@ -53,6 +58,20 @@ export class DialogsContainer {
|
|
|
53
58
|
dialog.controller.cancel();
|
|
54
59
|
}
|
|
55
60
|
};
|
|
61
|
+
lockBodyScroll = () => {
|
|
62
|
+
if (this._savedOverflow !== null) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
this._savedOverflow = document.body.style.overflow;
|
|
66
|
+
document.body.style.overflow = 'hidden';
|
|
67
|
+
};
|
|
68
|
+
unlockBodyScroll = () => {
|
|
69
|
+
if (this._savedOverflow === null) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
document.body.style.overflow = this._savedOverflow;
|
|
73
|
+
this._savedOverflow = null;
|
|
74
|
+
};
|
|
56
75
|
}
|
|
57
76
|
const createDialogsSingleton = () => {
|
|
58
77
|
if (!isBrowser()) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Dialogs } from './dialogs.svelte';
|
|
2
2
|
export { DialogController } from './dialog-controller';
|
|
3
|
-
export {
|
|
3
|
+
export { DIALOG_SIZES, type DialogPosition, type DialogResult, type DialogSize } from './types.svelte';
|
|
4
4
|
export { default as Dialog } from './cmp.dialog.svelte';
|
|
5
5
|
export { default as DialogButton } from './cmp.dialog-button.svelte';
|
|
6
6
|
export { default as DialogCancelButton } from './cmp.dialog-cancel-button.svelte';
|
package/dist/ui/dialog/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Dialogs } from './dialogs.svelte';
|
|
2
2
|
export { DialogController } from './dialog-controller';
|
|
3
|
-
export {
|
|
3
|
+
export { DIALOG_SIZES } from './types.svelte';
|
|
4
4
|
export { default as Dialog } from './cmp.dialog.svelte';
|
|
5
5
|
export { default as DialogButton } from './cmp.dialog-button.svelte';
|
|
6
6
|
export { default as DialogCancelButton } from './cmp.dialog-cancel-button.svelte';
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Default = "default",
|
|
5
|
-
Large = "large",
|
|
6
|
-
FullHD = "fullhd",
|
|
7
|
-
Auto = "auto"
|
|
8
|
-
}
|
|
9
|
-
export declare enum DialogPosition {
|
|
10
|
-
Center = "center",
|
|
11
|
-
CenterTop = "center-top",
|
|
12
|
-
FullScreen = "full-screen",
|
|
13
|
-
FullHeight = "full-height"
|
|
14
|
-
}
|
|
1
|
+
export type DialogSize = 'small' | 'medium' | 'default' | 'large' | 'fullhd' | 'auto';
|
|
2
|
+
export type DialogPosition = 'center' | 'center-top' | 'full-screen' | 'full-height';
|
|
3
|
+
export declare const DIALOG_SIZES: readonly DialogSize[];
|
|
15
4
|
export declare class DialogSettings {
|
|
16
5
|
closeOnClickOutside: boolean;
|
|
17
6
|
closeOnEsc: boolean;
|
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
export
|
|
2
|
-
(function (DialogSize) {
|
|
3
|
-
DialogSize["Small"] = "small";
|
|
4
|
-
DialogSize["Medium"] = "medium";
|
|
5
|
-
DialogSize["Default"] = "default";
|
|
6
|
-
DialogSize["Large"] = "large";
|
|
7
|
-
DialogSize["FullHD"] = "fullhd";
|
|
8
|
-
DialogSize["Auto"] = "auto";
|
|
9
|
-
})(DialogSize || (DialogSize = {}));
|
|
10
|
-
export var DialogPosition;
|
|
11
|
-
(function (DialogPosition) {
|
|
12
|
-
DialogPosition["Center"] = "center";
|
|
13
|
-
DialogPosition["CenterTop"] = "center-top";
|
|
14
|
-
DialogPosition["FullScreen"] = "full-screen";
|
|
15
|
-
DialogPosition["FullHeight"] = "full-height";
|
|
16
|
-
})(DialogPosition || (DialogPosition = {}));
|
|
1
|
+
export const DIALOG_SIZES = ['small', 'medium', 'default', 'large', 'fullhd', 'auto'];
|
|
17
2
|
export class DialogSettings {
|
|
18
3
|
closeOnClickOutside = $state(false);
|
|
19
4
|
closeOnEsc = $state(false);
|
|
20
5
|
nonCancelable = $state(false);
|
|
21
6
|
}
|
|
22
7
|
export class DialogContainerSettings {
|
|
23
|
-
size = $state(
|
|
24
|
-
position = $state(
|
|
8
|
+
size = $state('default');
|
|
9
|
+
position = $state('center-top');
|
|
25
10
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">let { withTooltip = false, children } = $props();
|
|
2
|
+
export {};
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<div class="form-group-label" class:form-group-label--with-tooltip={withTooltip}>
|
|
6
|
+
{@render children()}
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<style>.form-group-label {
|
|
10
|
+
--_form-group--label--font-size: var(--sc-kit--form-group--label--font-size, 0.875rem);
|
|
11
|
+
--_form-group--label--font-weight: var(--sc-kit--form-group--label--font-weight, 400);
|
|
12
|
+
--_form-group--label--color: var(--sc-kit--form-group--label--color);
|
|
13
|
+
--_form-group--label--margin-bottom: var(--sc-kit--form-group--label--margin-bottom, 0.5rem);
|
|
14
|
+
font-size: var(--_form-group--label--font-size);
|
|
15
|
+
padding: 0;
|
|
16
|
+
margin-bottom: var(--_form-group--label--margin-bottom);
|
|
17
|
+
font-weight: var(--_form-group--label--font-weight);
|
|
18
|
+
display: block;
|
|
19
|
+
color: var(--_form-group--label--color);
|
|
20
|
+
}
|
|
21
|
+
.form-group-label--with-tooltip {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
gap: 0.25rem;
|
|
25
|
+
}</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">let { children } = $props();
|
|
2
|
+
export {};
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<div class="form-group-note">
|
|
6
|
+
{@render children()}
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<style>.form-group-note {
|
|
10
|
+
--_form-group--note--font-size: var(--sc-kit--form-group--note--font-size, 0.875rem);
|
|
11
|
+
--_form-group--note--font-weight: var(--sc-kit--form-group--note--font-weight, 300);
|
|
12
|
+
margin-top: 0.5rem;
|
|
13
|
+
color: #9ca3af;
|
|
14
|
+
font-size: var(--_form-group--note--font-size);
|
|
15
|
+
font-weight: var(--_form-group--note--font-weight);
|
|
16
|
+
}</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">let { noMargin = false, children } = $props();
|
|
2
|
+
export {};
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<div class="form-group" class:form-group--no-margin={noMargin}>
|
|
6
|
+
{@render children()}
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<style>.form-group {
|
|
10
|
+
--_form-group--margin-bottom: var(--sc-kit--form-group--margin-bottom, 1.25rem);
|
|
11
|
+
display: block;
|
|
12
|
+
margin-bottom: var(--_form-group--margin-bottom);
|
|
13
|
+
}
|
|
14
|
+
.form-group--no-margin {
|
|
15
|
+
margin-bottom: 0;
|
|
16
|
+
}</style>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<script lang="ts">let { children } = $props();
|
|
2
|
+
export {};
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<div class="html-block">
|
|
6
|
+
{@render children()}
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<style>.html-block {
|
|
10
|
+
display: contents;
|
|
11
|
+
word-break: break-word;
|
|
12
|
+
font-size: 0.875em;
|
|
13
|
+
line-height: 1.4;
|
|
14
|
+
font-weight: normal;
|
|
15
|
+
color: light-dark(#2e2e2e, #ffffff);
|
|
16
|
+
}
|
|
17
|
+
.html-block :global(h1) {
|
|
18
|
+
font-size: 1.5em;
|
|
19
|
+
line-height: 1.4;
|
|
20
|
+
font-weight: 600;
|
|
21
|
+
color: light-dark(#2e2e2e, #ffffff);
|
|
22
|
+
}
|
|
23
|
+
.html-block :global(h2) {
|
|
24
|
+
font-size: 1.375em;
|
|
25
|
+
line-height: 1.4;
|
|
26
|
+
font-weight: 600;
|
|
27
|
+
color: light-dark(#2e2e2e, #ffffff);
|
|
28
|
+
}
|
|
29
|
+
.html-block :global(h3) {
|
|
30
|
+
font-size: 1.25em;
|
|
31
|
+
line-height: 1.4;
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
color: light-dark(#2e2e2e, #ffffff);
|
|
34
|
+
}
|
|
35
|
+
.html-block :global(h4) {
|
|
36
|
+
font-size: 1.125em;
|
|
37
|
+
line-height: 1.4;
|
|
38
|
+
font-weight: 500;
|
|
39
|
+
color: light-dark(#2e2e2e, #ffffff);
|
|
40
|
+
}
|
|
41
|
+
.html-block :global(h5) {
|
|
42
|
+
font-size: 1.0625em;
|
|
43
|
+
line-height: 1.4;
|
|
44
|
+
font-weight: 500;
|
|
45
|
+
color: light-dark(#2e2e2e, #ffffff);
|
|
46
|
+
}
|
|
47
|
+
.html-block :global(h6) {
|
|
48
|
+
font-size: 1em;
|
|
49
|
+
line-height: 1.4;
|
|
50
|
+
font-weight: 500;
|
|
51
|
+
color: light-dark(#2e2e2e, #ffffff);
|
|
52
|
+
}
|
|
53
|
+
.html-block :global(a) {
|
|
54
|
+
font-size: 1em;
|
|
55
|
+
line-height: 1.4;
|
|
56
|
+
font-weight: normal;
|
|
57
|
+
color: light-dark(#2e2e2e, #ffffff);
|
|
58
|
+
color: light-dark(#144ab0, #5a8dec);
|
|
59
|
+
}
|
|
60
|
+
.html-block :global(pre) {
|
|
61
|
+
font-family: monospace;
|
|
62
|
+
white-space: pre-wrap;
|
|
63
|
+
margin: 1em 0;
|
|
64
|
+
font-size: 1em;
|
|
65
|
+
line-height: 1;
|
|
66
|
+
font-weight: normal;
|
|
67
|
+
color: light-dark(#2e2e2e, #ffffff);
|
|
68
|
+
}
|
|
69
|
+
.html-block :global(ul) :global(> li),
|
|
70
|
+
.html-block :global(ol) :global(> li) {
|
|
71
|
+
list-style: inherit;
|
|
72
|
+
margin-left: 1em;
|
|
73
|
+
position: relative;
|
|
74
|
+
font-size: 1em;
|
|
75
|
+
line-height: 1.4;
|
|
76
|
+
font-weight: normal;
|
|
77
|
+
color: light-dark(#2e2e2e, #ffffff);
|
|
78
|
+
}
|
|
79
|
+
.html-block :global(ol) {
|
|
80
|
+
list-style-type: decimal;
|
|
81
|
+
}
|
|
82
|
+
.html-block :global(ol) :global(> li > ol) {
|
|
83
|
+
list-style-type: lower-alpha;
|
|
84
|
+
}
|
|
85
|
+
.html-block :global(table) {
|
|
86
|
+
max-width: 100%;
|
|
87
|
+
}
|
|
88
|
+
.html-block :global(table),
|
|
89
|
+
.html-block :global(tbody),
|
|
90
|
+
.html-block :global(thead),
|
|
91
|
+
.html-block :global(tr),
|
|
92
|
+
.html-block :global(th),
|
|
93
|
+
.html-block :global(td) {
|
|
94
|
+
border-width: initial;
|
|
95
|
+
border-style: inherit;
|
|
96
|
+
border-color: inherit;
|
|
97
|
+
}
|
|
98
|
+
.html-block :global(ul:not([style*='list-style-type'])),
|
|
99
|
+
.html-block :global(ul:not([style*='list-style-type']) > li > ul:not([style*='list-style-type'])) {
|
|
100
|
+
list-style-type: none;
|
|
101
|
+
}
|
|
102
|
+
.html-block :global(ul:not([style*='list-style-type']) > li:before),
|
|
103
|
+
.html-block :global(ul:not([style*='list-style-type']) > li > ul:not([style*='list-style-type']) > li:before) {
|
|
104
|
+
content: "-";
|
|
105
|
+
text-indent: -1em;
|
|
106
|
+
position: absolute;
|
|
107
|
+
font-weight: bold;
|
|
108
|
+
}
|
|
109
|
+
.html-block :global(ul[style*='list-style-type'] > li:before),
|
|
110
|
+
.html-block :global(ul > li > ul[style*='list-style-type'] > li:before) {
|
|
111
|
+
content: none;
|
|
112
|
+
}</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as HtmlBlock } from './cmp.html-block.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as HtmlBlock } from './cmp.html-block.svelte';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script lang="ts">import { DialogCloseButton } from '../dialog';
|
|
2
|
+
import { Carousel } from '../player/carousel';
|
|
3
|
+
import { default as MediaViewerItem } from './media-viewer-item.svelte';
|
|
4
|
+
import { untrack } from 'svelte';
|
|
5
|
+
const { controller, data } = $props();
|
|
6
|
+
$effect(() => untrack(() => {
|
|
7
|
+
controller.updateSettings({ closeOnEsc: true, closeOnClickOutside: true });
|
|
8
|
+
controller.updateContainerSettings({ position: 'full-screen' });
|
|
9
|
+
}));
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<div class="media-viewer-dialog" style:--media-viewer-dialog--background--opacity={data.backgroundOpacity}>
|
|
13
|
+
<div class="media-viewer-dialog__close">
|
|
14
|
+
<DialogCloseButton controller={controller} />
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<div class="media-viewer-dialog__content">
|
|
18
|
+
{#if data.items.length === 1}
|
|
19
|
+
<MediaViewerItem item={data.items[0]} />
|
|
20
|
+
{:else}
|
|
21
|
+
<Carousel items={data.items} initialIndex={data.index} mode="arrows-with-counts" on={{ indexChanged: () => {} }}>
|
|
22
|
+
{#snippet children(item)}
|
|
23
|
+
<MediaViewerItem item={item} />
|
|
24
|
+
{/snippet}
|
|
25
|
+
</Carousel>
|
|
26
|
+
{/if}
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<style>.media-viewer-dialog {
|
|
31
|
+
--_media-viewer-dialog--background--opacity: var(--media-viewer-dialog--background--opacity, 0.6);
|
|
32
|
+
--sc-kit--dialog-close-button--color: #ffffff;
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
width: 100%;
|
|
36
|
+
height: 100%;
|
|
37
|
+
background: rgba(0, 0, 0, var(--_media-viewer-dialog--background--opacity));
|
|
38
|
+
position: relative;
|
|
39
|
+
padding: 0.625rem;
|
|
40
|
+
}
|
|
41
|
+
.media-viewer-dialog__close {
|
|
42
|
+
position: absolute;
|
|
43
|
+
top: 0.75rem;
|
|
44
|
+
right: 0.75rem;
|
|
45
|
+
z-index: 10;
|
|
46
|
+
}
|
|
47
|
+
.media-viewer-dialog__content {
|
|
48
|
+
flex: 1;
|
|
49
|
+
min-height: 0;
|
|
50
|
+
}</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type DialogController } from '../dialog';
|
|
2
|
+
import type { MediaViewerData } from './types';
|
|
3
|
+
type Props = {
|
|
4
|
+
controller: DialogController;
|
|
5
|
+
data: MediaViewerData;
|
|
6
|
+
};
|
|
7
|
+
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type Cmp = ReturnType<typeof Cmp>;
|
|
9
|
+
export default Cmp;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type DialogResult } from '../dialog';
|
|
2
|
+
import type { MediaViewerData } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Opens a full-screen media viewer dialog for images and videos.
|
|
5
|
+
* Single item renders directly; multiple items display in a carousel with arrow navigation.
|
|
6
|
+
*
|
|
7
|
+
* ### Options
|
|
8
|
+
* - `items` — array of media items to display
|
|
9
|
+
* - `index` — zero-based index of the initially visible item
|
|
10
|
+
* - `backgroundOpacity` — backdrop opacity (default `0.6`)
|
|
11
|
+
*/
|
|
12
|
+
export declare const openMediaViewer: (data: MediaViewerData) => Promise<DialogResult<void>>;
|
|
13
|
+
export type { MediaViewerData, MediaViewerItem, MediaViewerItemType } from './types';
|