@streamscloud/kit 0.0.1-1770364570820 → 0.0.1-1770761136792
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/continuation-token.d.ts +1 -0
- package/dist/core/continuation-token.js +4 -1
- package/dist/styles/_colors.scss +126 -0
- package/dist/styles/_form-group.scss +37 -0
- package/dist/styles/_functions.scss +37 -0
- package/dist/styles/_index.scss +6 -0
- package/dist/styles/_mixins.scss +128 -0
- package/dist/styles/_normalize.scss +257 -0
- package/dist/styles/_reset.scss +194 -0
- package/dist/styles/_responsive.scss +70 -0
- package/dist/styles/_row.scss +81 -0
- package/dist/styles/_theme.scss +68 -0
- package/dist/ui/button/cmp.button.svelte +10 -0
- package/dist/ui/button/cmp.button.svelte.d.ts +16 -0
- package/dist/ui/button/cmp.options-button.svelte +202 -0
- package/dist/ui/button/cmp.options-button.svelte.d.ts +21 -0
- package/dist/ui/button/index.d.ts +3 -0
- package/dist/ui/button/index.js +2 -0
- package/dist/ui/button/resources/button-base.svelte +81 -0
- package/dist/ui/button/resources/button-base.svelte.d.ts +13 -0
- package/dist/ui/button/resources/button-theme.svelte +233 -0
- package/dist/ui/button/resources/button-theme.svelte.d.ts +10 -0
- package/dist/ui/button/resources/types.d.ts +2 -0
- package/dist/ui/button/resources/types.js +1 -0
- package/dist/ui/dialog/cmp.dialog-button.svelte +13 -0
- package/dist/ui/dialog/cmp.dialog-button.svelte.d.ts +15 -0
- package/dist/ui/dialog/cmp.dialog-cancel-button.svelte +13 -0
- package/dist/ui/dialog/cmp.dialog-cancel-button.svelte.d.ts +11 -0
- package/dist/ui/dialog/cmp.dialog-close-button.svelte +17 -0
- package/dist/ui/dialog/cmp.dialog-close-button.svelte.d.ts +27 -0
- package/dist/ui/dialog/cmp.dialog-container.svelte +183 -0
- package/dist/ui/dialog/cmp.dialog-container.svelte.d.ts +27 -0
- package/dist/ui/dialog/cmp.dialog.svelte +113 -0
- package/dist/ui/dialog/cmp.dialog.svelte.d.ts +35 -0
- package/dist/ui/dialog/dialog-controller.d.ts +22 -0
- package/dist/ui/dialog/dialog-controller.js +45 -0
- package/dist/ui/dialog/dialog-data.d.ts +27 -0
- package/dist/ui/dialog/dialog-data.js +1 -0
- package/dist/ui/dialog/dialog-mount.d.ts +3 -0
- package/dist/ui/dialog/dialog-mount.js +19 -0
- package/dist/ui/dialog/dialogs.svelte.d.ts +13 -0
- package/dist/ui/dialog/dialogs.svelte.js +67 -0
- package/dist/ui/dialog/index.d.ts +8 -0
- package/dist/ui/dialog/index.js +7 -0
- package/dist/ui/dialog/types.svelte.d.ts +30 -0
- package/dist/ui/dialog/types.svelte.js +25 -0
- package/dist/ui/icon/cmp.icon.svelte +76 -0
- package/dist/ui/icon/cmp.icon.svelte.d.ts +8 -0
- package/dist/ui/icon/index.d.ts +2 -0
- package/dist/ui/icon/index.js +1 -0
- package/dist/ui/icon/types.d.ts +1 -0
- package/dist/ui/icon/types.js +1 -0
- package/package.json +42 -7
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DialogData } from './dialog-data';
|
|
2
|
+
declare function $$render<TResult = void, TCancelResult = void, TData = void>(): {
|
|
3
|
+
props: {
|
|
4
|
+
dialog: DialogData<TResult, TCancelResult, TData>;
|
|
5
|
+
};
|
|
6
|
+
exports: {};
|
|
7
|
+
bindings: "";
|
|
8
|
+
slots: {};
|
|
9
|
+
events: {};
|
|
10
|
+
};
|
|
11
|
+
declare class __sveltets_Render<TResult = void, TCancelResult = void, TData = void> {
|
|
12
|
+
props(): ReturnType<typeof $$render<TResult, TCancelResult, TData>>['props'];
|
|
13
|
+
events(): ReturnType<typeof $$render<TResult, TCancelResult, TData>>['events'];
|
|
14
|
+
slots(): ReturnType<typeof $$render<TResult, TCancelResult, TData>>['slots'];
|
|
15
|
+
bindings(): "";
|
|
16
|
+
exports(): {};
|
|
17
|
+
}
|
|
18
|
+
interface $$IsomorphicComponent {
|
|
19
|
+
new <TResult = void, TCancelResult = void, TData = void>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TResult, TCancelResult, TData>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TResult, TCancelResult, TData>['props']>, ReturnType<__sveltets_Render<TResult, TCancelResult, TData>['events']>, ReturnType<__sveltets_Render<TResult, TCancelResult, TData>['slots']>> & {
|
|
20
|
+
$$bindings?: ReturnType<__sveltets_Render<TResult, TCancelResult, TData>['bindings']>;
|
|
21
|
+
} & ReturnType<__sveltets_Render<TResult, TCancelResult, TData>['exports']>;
|
|
22
|
+
<TResult = void, TCancelResult = void, TData = void>(internal: unknown, props: ReturnType<__sveltets_Render<TResult, TCancelResult, TData>['props']> & {}): ReturnType<__sveltets_Render<TResult, TCancelResult, TData>['exports']>;
|
|
23
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any, any, any>['bindings']>;
|
|
24
|
+
}
|
|
25
|
+
declare const Cmp: $$IsomorphicComponent;
|
|
26
|
+
type Cmp<TResult = void, TCancelResult = void, TData = void> = InstanceType<typeof Cmp<TResult, TCancelResult, TData>>;
|
|
27
|
+
export default Cmp;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<script lang="ts" generics="TResult = void, TCancelResult = void">import { default as DialogCloseButton } from './cmp.dialog-close-button.svelte';
|
|
2
|
+
let { controller, hideCloseButton = false, title, body, footer, headerSection, bodySection, footerSection } = $props();
|
|
3
|
+
const showCloseButton = $derived(!hideCloseButton && !controller.settings.nonCancelable);
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<div class="dialog">
|
|
7
|
+
{#if headerSection}
|
|
8
|
+
{@render headerSection()}
|
|
9
|
+
{:else if title || showCloseButton}
|
|
10
|
+
<div class="dialog__header">
|
|
11
|
+
{#if title}
|
|
12
|
+
<div class="dialog__title">
|
|
13
|
+
{@render title()}
|
|
14
|
+
</div>
|
|
15
|
+
{/if}
|
|
16
|
+
{#if showCloseButton}
|
|
17
|
+
<DialogCloseButton controller={controller} />
|
|
18
|
+
{/if}
|
|
19
|
+
</div>
|
|
20
|
+
{/if}
|
|
21
|
+
|
|
22
|
+
{#if bodySection}
|
|
23
|
+
{@render bodySection()}
|
|
24
|
+
{:else if body}
|
|
25
|
+
<div class="dialog__body">
|
|
26
|
+
{@render body()}
|
|
27
|
+
</div>
|
|
28
|
+
{/if}
|
|
29
|
+
|
|
30
|
+
{#if footerSection}
|
|
31
|
+
{@render footerSection()}
|
|
32
|
+
{:else if footer}
|
|
33
|
+
<div class="dialog__footer">
|
|
34
|
+
{@render footer()}
|
|
35
|
+
</div>
|
|
36
|
+
{/if}
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<style>.dialog {
|
|
40
|
+
--_dialog--background: var(--dialog--background, light-dark(#fff, #000));
|
|
41
|
+
--_dialog--border-color: var(--dialog--border-color, light-dark(#f2f2f3, #1e1e1e));
|
|
42
|
+
--_dialog--border-radius: var(--dialog--border-radius, 0.5rem);
|
|
43
|
+
--_dialog--color: var(--dialog--color, light-dark(#000, #fff));
|
|
44
|
+
--_dialog--shadow-color: var(--dialog--shadow-color, light-dark(#2f2b431a, #ffffff1a));
|
|
45
|
+
--_dialog--height: var(--dialog--height, auto);
|
|
46
|
+
--_dialog--max-height: var(--dialog--max-height, none);
|
|
47
|
+
--_dialog--min-height: var(--dialog--min-height, auto);
|
|
48
|
+
--_dialog--padding-block: var(--dialog--padding-block, 1.25rem);
|
|
49
|
+
--_dialog--padding-inline: var(--dialog--padding-inline, 1.5rem);
|
|
50
|
+
--_dialog--body--padding-block: var(--dialog--body--padding-block, var(--_dialog--padding-block));
|
|
51
|
+
--_dialog--body--padding-inline: var(--dialog--body--padding-inline, var(--_dialog--padding-inline));
|
|
52
|
+
--_dialog--header--padding-block: var(--dialog--header--padding-block, var(--_dialog--padding-block));
|
|
53
|
+
--_dialog--header--padding-inline: var(--dialog--header--padding-inline, var(--_dialog--padding-inline));
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
height: var(--_dialog--height);
|
|
57
|
+
min-height: var(--_dialog--min-height);
|
|
58
|
+
max-height: var(--_dialog--max-height);
|
|
59
|
+
background: var(--_dialog--background);
|
|
60
|
+
color: var(--_dialog--color);
|
|
61
|
+
border-radius: var(--_dialog--border-radius);
|
|
62
|
+
box-shadow: 0 4px 24px var(--_dialog--shadow-color);
|
|
63
|
+
}
|
|
64
|
+
.dialog__header {
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-shrink: 0;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: space-between;
|
|
69
|
+
gap: 1rem;
|
|
70
|
+
padding: var(--_dialog--header--padding-block) var(--_dialog--header--padding-inline);
|
|
71
|
+
border-bottom: 1px solid var(--_dialog--border-color);
|
|
72
|
+
}
|
|
73
|
+
.dialog__title {
|
|
74
|
+
flex: 1;
|
|
75
|
+
font-size: 1.125rem;
|
|
76
|
+
font-weight: 600;
|
|
77
|
+
line-height: 1.4;
|
|
78
|
+
}
|
|
79
|
+
.dialog__body {
|
|
80
|
+
flex: 1;
|
|
81
|
+
min-height: 0;
|
|
82
|
+
overflow-y: auto;
|
|
83
|
+
padding: var(--_dialog--body--padding-block) var(--_dialog--body--padding-inline);
|
|
84
|
+
--_cross-browser-scrollbar--thumb-color: var(--scrollbar--thumb-color, #7d7d7d);
|
|
85
|
+
--_cross-browser-scrollbar--track-color: var(--scrollbar--track-color, transparent);
|
|
86
|
+
}
|
|
87
|
+
.dialog__body::-webkit-scrollbar {
|
|
88
|
+
width: 6px;
|
|
89
|
+
height: 6px;
|
|
90
|
+
}
|
|
91
|
+
.dialog__body::-webkit-scrollbar-track {
|
|
92
|
+
background: var(--_cross-browser-scrollbar--track-color);
|
|
93
|
+
border-radius: 100vw;
|
|
94
|
+
}
|
|
95
|
+
.dialog__body::-webkit-scrollbar-thumb {
|
|
96
|
+
background: var(--_cross-browser-scrollbar--thumb-color);
|
|
97
|
+
border-radius: 100vw;
|
|
98
|
+
}
|
|
99
|
+
@supports (scrollbar-color: transparent transparent) {
|
|
100
|
+
.dialog__body {
|
|
101
|
+
scrollbar-color: var(--_cross-browser-scrollbar--thumb-color) var(--_cross-browser-scrollbar--track-color);
|
|
102
|
+
scrollbar-width: thin;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
.dialog__footer {
|
|
106
|
+
display: flex;
|
|
107
|
+
flex-shrink: 0;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: flex-end;
|
|
110
|
+
gap: 0.75rem;
|
|
111
|
+
padding: var(--_dialog--padding-block) var(--_dialog--padding-inline);
|
|
112
|
+
border-top: 1px solid var(--_dialog--border-color);
|
|
113
|
+
}</style>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { DialogController } from './dialog-controller';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
declare function $$render<TResult = void, TCancelResult = void>(): {
|
|
4
|
+
props: {
|
|
5
|
+
controller: DialogController<TResult, TCancelResult>;
|
|
6
|
+
hideCloseButton?: boolean;
|
|
7
|
+
title?: Snippet;
|
|
8
|
+
body?: Snippet;
|
|
9
|
+
footer?: Snippet;
|
|
10
|
+
headerSection?: Snippet;
|
|
11
|
+
bodySection?: Snippet;
|
|
12
|
+
footerSection?: Snippet;
|
|
13
|
+
};
|
|
14
|
+
exports: {};
|
|
15
|
+
bindings: "";
|
|
16
|
+
slots: {};
|
|
17
|
+
events: {};
|
|
18
|
+
};
|
|
19
|
+
declare class __sveltets_Render<TResult = void, TCancelResult = void> {
|
|
20
|
+
props(): ReturnType<typeof $$render<TResult, TCancelResult>>['props'];
|
|
21
|
+
events(): ReturnType<typeof $$render<TResult, TCancelResult>>['events'];
|
|
22
|
+
slots(): ReturnType<typeof $$render<TResult, TCancelResult>>['slots'];
|
|
23
|
+
bindings(): "";
|
|
24
|
+
exports(): {};
|
|
25
|
+
}
|
|
26
|
+
interface $$IsomorphicComponent {
|
|
27
|
+
new <TResult = void, TCancelResult = void>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TResult, TCancelResult>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TResult, TCancelResult>['props']>, ReturnType<__sveltets_Render<TResult, TCancelResult>['events']>, ReturnType<__sveltets_Render<TResult, TCancelResult>['slots']>> & {
|
|
28
|
+
$$bindings?: ReturnType<__sveltets_Render<TResult, TCancelResult>['bindings']>;
|
|
29
|
+
} & ReturnType<__sveltets_Render<TResult, TCancelResult>['exports']>;
|
|
30
|
+
<TResult = void, TCancelResult = void>(internal: unknown, props: ReturnType<__sveltets_Render<TResult, TCancelResult>['props']> & {}): ReturnType<__sveltets_Render<TResult, TCancelResult>['exports']>;
|
|
31
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any, any>['bindings']>;
|
|
32
|
+
}
|
|
33
|
+
declare const Cmp: $$IsomorphicComponent;
|
|
34
|
+
type Cmp<TResult = void, TCancelResult = void> = InstanceType<typeof Cmp<TResult, TCancelResult>>;
|
|
35
|
+
export default Cmp;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DialogContainerSettings, DialogSettings, type DialogResult } from './types.svelte';
|
|
2
|
+
export declare class DialogController<TResult = void, TCancelResult = void> {
|
|
3
|
+
readonly dialogId: number;
|
|
4
|
+
settings: DialogSettings;
|
|
5
|
+
containerSettings: DialogContainerSettings;
|
|
6
|
+
private _onClose;
|
|
7
|
+
private _explicitSettings?;
|
|
8
|
+
private _explicitContainerSettings?;
|
|
9
|
+
private _closeDeferred;
|
|
10
|
+
private _isClosed;
|
|
11
|
+
constructor(init: {
|
|
12
|
+
id: number;
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
settings?: Partial<DialogSettings>;
|
|
15
|
+
containerSettings?: Partial<DialogContainerSettings>;
|
|
16
|
+
});
|
|
17
|
+
get openedPromise(): Promise<DialogResult<TResult, TCancelResult>>;
|
|
18
|
+
ok: (result: TResult) => void;
|
|
19
|
+
cancel: (result?: TCancelResult) => void;
|
|
20
|
+
updateSettings: (dialogSettings: Partial<DialogSettings>) => void;
|
|
21
|
+
updateContainerSettings: (settings: Partial<DialogContainerSettings>) => void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Deferred } from '../../core/deferred';
|
|
2
|
+
import { DialogContainerSettings, DialogSettings } from './types.svelte';
|
|
3
|
+
export class DialogController {
|
|
4
|
+
dialogId;
|
|
5
|
+
settings;
|
|
6
|
+
containerSettings;
|
|
7
|
+
_onClose;
|
|
8
|
+
_explicitSettings;
|
|
9
|
+
_explicitContainerSettings;
|
|
10
|
+
_closeDeferred = new Deferred();
|
|
11
|
+
_isClosed = false;
|
|
12
|
+
constructor(init) {
|
|
13
|
+
this.dialogId = init.id;
|
|
14
|
+
this._onClose = init.onClose;
|
|
15
|
+
this._explicitSettings = init.settings;
|
|
16
|
+
this._explicitContainerSettings = init.containerSettings;
|
|
17
|
+
this.settings = Object.assign(new DialogSettings(), init.settings);
|
|
18
|
+
this.containerSettings = Object.assign(new DialogContainerSettings(), init.containerSettings);
|
|
19
|
+
}
|
|
20
|
+
get openedPromise() {
|
|
21
|
+
return this._closeDeferred.promise;
|
|
22
|
+
}
|
|
23
|
+
ok = (result) => {
|
|
24
|
+
if (this._isClosed) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
this._isClosed = true;
|
|
28
|
+
this._closeDeferred.resolve({ wasCanceled: false, value: result });
|
|
29
|
+
this._onClose();
|
|
30
|
+
};
|
|
31
|
+
cancel = (result) => {
|
|
32
|
+
if (this._isClosed || this.settings.nonCancelable) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
this._isClosed = true;
|
|
36
|
+
this._closeDeferred.resolve({ wasCanceled: true, cancelValue: result });
|
|
37
|
+
this._onClose();
|
|
38
|
+
};
|
|
39
|
+
updateSettings = (dialogSettings) => {
|
|
40
|
+
Object.assign(this.settings, dialogSettings, this._explicitSettings);
|
|
41
|
+
};
|
|
42
|
+
updateContainerSettings = (settings) => {
|
|
43
|
+
Object.assign(this.containerSettings, settings, this._explicitContainerSettings);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DialogController } from './dialog-controller';
|
|
2
|
+
import type { DialogContainerSettings, DialogSettings } from './types.svelte';
|
|
3
|
+
import type { Component } from 'svelte';
|
|
4
|
+
export type AnyDialogData = DialogData<any, any, any>;
|
|
5
|
+
export type DialogData<TResult = void, TCancelResult = void, TData = void> = {
|
|
6
|
+
id: number;
|
|
7
|
+
view: DialogViewComponentType<TData, TResult, TCancelResult>;
|
|
8
|
+
data?: TData;
|
|
9
|
+
controller: DialogController<TResult, TCancelResult>;
|
|
10
|
+
hostElement?: HTMLElement;
|
|
11
|
+
component?: object;
|
|
12
|
+
};
|
|
13
|
+
type DialogViewWithData<TData, TResult, TCancelResult> = Component<{
|
|
14
|
+
data: TData;
|
|
15
|
+
controller: DialogController<TResult, TCancelResult>;
|
|
16
|
+
}>;
|
|
17
|
+
type DialogViewWithoutData<TResult, TCancelResult> = Component<{
|
|
18
|
+
controller: DialogController<TResult, TCancelResult>;
|
|
19
|
+
}>;
|
|
20
|
+
export type DialogViewComponentType<TData = void, TResult = void, TCancelResult = void> = TData extends void ? DialogViewWithoutData<TResult, TCancelResult> : DialogViewWithData<TData, TResult, TCancelResult>;
|
|
21
|
+
export type DialogInit<TData = void, TResult = void, TCancelResult = void> = {
|
|
22
|
+
view: DialogViewComponentType<TData, TResult, TCancelResult>;
|
|
23
|
+
data?: TData;
|
|
24
|
+
explicitSettings?: Partial<DialogSettings>;
|
|
25
|
+
containerSettings?: Partial<DialogContainerSettings>;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as DialogContainer } from './cmp.dialog-container.svelte';
|
|
2
|
+
import { mount, unmount } from 'svelte';
|
|
3
|
+
export const mountDialog = (dialog) => {
|
|
4
|
+
const hostElement = document.createElement('div');
|
|
5
|
+
hostElement.setAttribute('data-dialog-host', String(dialog.id));
|
|
6
|
+
document.body.appendChild(hostElement);
|
|
7
|
+
const component = mount(DialogContainer, {
|
|
8
|
+
target: hostElement,
|
|
9
|
+
props: { dialog }
|
|
10
|
+
});
|
|
11
|
+
dialog.hostElement = hostElement;
|
|
12
|
+
dialog.component = component;
|
|
13
|
+
};
|
|
14
|
+
export const unmountDialog = (dialog) => {
|
|
15
|
+
if (dialog.hostElement && dialog.component) {
|
|
16
|
+
unmount(dialog.component);
|
|
17
|
+
dialog.hostElement.remove();
|
|
18
|
+
}
|
|
19
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type AnyDialogData, type DialogInit } from './dialog-data';
|
|
2
|
+
import { type DialogResult } from './types.svelte';
|
|
3
|
+
export declare class DialogsContainer {
|
|
4
|
+
private _dialogs;
|
|
5
|
+
private _mountModule;
|
|
6
|
+
get all(): ReadonlyArray<AnyDialogData>;
|
|
7
|
+
get active(): AnyDialogData | null;
|
|
8
|
+
get count(): number;
|
|
9
|
+
open: <TData = void, TResult = void, TCancelResult = void>(init: DialogInit<TData, TResult, TCancelResult>, id?: number) => Promise<DialogResult<TResult, TCancelResult>>;
|
|
10
|
+
close: (id: number) => void;
|
|
11
|
+
closeAll: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const Dialogs: DialogsContainer;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { isBrowser } from '../../core/utils/browser';
|
|
2
|
+
import { DialogController } from './dialog-controller';
|
|
3
|
+
import {} from './dialog-data';
|
|
4
|
+
import {} from './types.svelte';
|
|
5
|
+
export class DialogsContainer {
|
|
6
|
+
_dialogs = $state.raw([]);
|
|
7
|
+
_mountModule = null;
|
|
8
|
+
get all() {
|
|
9
|
+
return this._dialogs;
|
|
10
|
+
}
|
|
11
|
+
get active() {
|
|
12
|
+
return this._dialogs.length > 0 ? this._dialogs[this._dialogs.length - 1] : null;
|
|
13
|
+
}
|
|
14
|
+
get count() {
|
|
15
|
+
return this._dialogs.length;
|
|
16
|
+
}
|
|
17
|
+
open = async (init, id = Math.random()) => {
|
|
18
|
+
if (!this._mountModule) {
|
|
19
|
+
this._mountModule = await import('./dialog-mount');
|
|
20
|
+
}
|
|
21
|
+
const { view, data, explicitSettings, containerSettings } = init;
|
|
22
|
+
const controller = new DialogController({
|
|
23
|
+
id,
|
|
24
|
+
onClose: () => {
|
|
25
|
+
const dialog = this._dialogs.find((d) => d.id === id);
|
|
26
|
+
if (dialog) {
|
|
27
|
+
this._mountModule?.unmountDialog(dialog);
|
|
28
|
+
this._dialogs = this._dialogs.filter((d) => d.id !== id);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
settings: explicitSettings,
|
|
32
|
+
containerSettings
|
|
33
|
+
});
|
|
34
|
+
const newDialog = {
|
|
35
|
+
id,
|
|
36
|
+
view,
|
|
37
|
+
data,
|
|
38
|
+
controller
|
|
39
|
+
};
|
|
40
|
+
this._dialogs = [...this._dialogs, newDialog];
|
|
41
|
+
this._mountModule.mountDialog(newDialog);
|
|
42
|
+
return controller.openedPromise;
|
|
43
|
+
};
|
|
44
|
+
close = (id) => {
|
|
45
|
+
const dialog = this._dialogs.find((d) => d.id === id);
|
|
46
|
+
if (dialog) {
|
|
47
|
+
dialog.controller.cancel();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
closeAll = () => {
|
|
51
|
+
const dialogsCopy = [...this._dialogs].reverse();
|
|
52
|
+
for (const dialog of dialogsCopy) {
|
|
53
|
+
dialog.controller.cancel();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const createDialogsSingleton = () => {
|
|
58
|
+
if (!isBrowser()) {
|
|
59
|
+
return new DialogsContainer();
|
|
60
|
+
}
|
|
61
|
+
// Use Vite's HMR data to preserve instance across hot reloads
|
|
62
|
+
if (import.meta.hot) {
|
|
63
|
+
return (import.meta.hot.data.dialogs ??= new DialogsContainer());
|
|
64
|
+
}
|
|
65
|
+
return new DialogsContainer();
|
|
66
|
+
};
|
|
67
|
+
export const Dialogs = createDialogsSingleton();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Dialogs } from './dialogs.svelte';
|
|
2
|
+
export { DialogController } from './dialog-controller';
|
|
3
|
+
export { DialogSize, DialogPosition, type DialogResult } from './types.svelte';
|
|
4
|
+
export { default as Dialog } from './cmp.dialog.svelte';
|
|
5
|
+
export { default as DialogButton } from './cmp.dialog-button.svelte';
|
|
6
|
+
export { default as DialogCancelButton } from './cmp.dialog-cancel-button.svelte';
|
|
7
|
+
export { default as DialogCloseButton } from './cmp.dialog-close-button.svelte';
|
|
8
|
+
export type { ButtonVariant } from '../button/resources/types';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Dialogs } from './dialogs.svelte';
|
|
2
|
+
export { DialogController } from './dialog-controller';
|
|
3
|
+
export { DialogSize, DialogPosition } from './types.svelte';
|
|
4
|
+
export { default as Dialog } from './cmp.dialog.svelte';
|
|
5
|
+
export { default as DialogButton } from './cmp.dialog-button.svelte';
|
|
6
|
+
export { default as DialogCancelButton } from './cmp.dialog-cancel-button.svelte';
|
|
7
|
+
export { default as DialogCloseButton } from './cmp.dialog-close-button.svelte';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare enum DialogSize {
|
|
2
|
+
Small = "small",
|
|
3
|
+
Medium = "medium",
|
|
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
|
+
}
|
|
15
|
+
export declare class DialogSettings {
|
|
16
|
+
closeOnClickOutside: boolean;
|
|
17
|
+
closeOnEsc: boolean;
|
|
18
|
+
nonCancelable: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare class DialogContainerSettings {
|
|
21
|
+
size: DialogSize | string;
|
|
22
|
+
position: DialogPosition;
|
|
23
|
+
}
|
|
24
|
+
export type DialogResult<TResult, TCancelResult = void> = {
|
|
25
|
+
wasCanceled: false;
|
|
26
|
+
value: TResult;
|
|
27
|
+
} | {
|
|
28
|
+
wasCanceled: true;
|
|
29
|
+
cancelValue?: TCancelResult;
|
|
30
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export var DialogSize;
|
|
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 = {}));
|
|
17
|
+
export class DialogSettings {
|
|
18
|
+
closeOnClickOutside = $state(false);
|
|
19
|
+
closeOnEsc = $state(false);
|
|
20
|
+
nonCancelable = $state(false);
|
|
21
|
+
}
|
|
22
|
+
export class DialogContainerSettings {
|
|
23
|
+
size = $state(DialogSize.Default);
|
|
24
|
+
position = $state(DialogPosition.CenterTop);
|
|
25
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script lang="ts">import { HtmlHelper } from '../../core/utils/html-helper';
|
|
2
|
+
let { src, color = null } = $props();
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
{#if src?.startsWith('<svg')}
|
|
6
|
+
<div
|
|
7
|
+
class="icon"
|
|
8
|
+
class:icon--white={color === 'white'}
|
|
9
|
+
class:icon--text={color === 'text'}
|
|
10
|
+
class:icon--gray={color === 'gray'}
|
|
11
|
+
class:icon--green={color === 'green'}
|
|
12
|
+
class:icon--red={color === 'red'}
|
|
13
|
+
class:icon--orange={color === 'orange'}
|
|
14
|
+
class:icon--blue={color === 'blue'}>
|
|
15
|
+
{@html HtmlHelper.sanitizeSvg(src)}
|
|
16
|
+
</div>
|
|
17
|
+
{:else}
|
|
18
|
+
<i class="invalid-svg">Invalid SVG</i>
|
|
19
|
+
{/if}
|
|
20
|
+
|
|
21
|
+
<style>.icon {
|
|
22
|
+
--_icon--color: var(--icon--color);
|
|
23
|
+
--_icon--color-blue: var(--icon--color-blue, light-dark(#3b82f6, #60a5fa));
|
|
24
|
+
--_icon--color-gray: var(--icon--color-gray, #737373);
|
|
25
|
+
--_icon--color-green: var(--icon--color-green, #22c55e);
|
|
26
|
+
--_icon--color-orange: var(--icon--color-orange, #f97316);
|
|
27
|
+
--_icon--color-red: var(--icon--color-red, #ef4444);
|
|
28
|
+
--_icon--color-text: var(--icon--color-text, light-dark(#1f2937, #fff));
|
|
29
|
+
--_icon--color-white: var(--icon--color-white, #fff);
|
|
30
|
+
--_icon--filter: var(--icon--filter, none);
|
|
31
|
+
--_icon--size: var(--icon--size, 1.25rem);
|
|
32
|
+
--_icon--stroke-width: var(--icon--stroke-width, 0);
|
|
33
|
+
display: contents;
|
|
34
|
+
}
|
|
35
|
+
.icon--white {
|
|
36
|
+
--_icon--color: var(--_icon--color-white);
|
|
37
|
+
}
|
|
38
|
+
.icon--text {
|
|
39
|
+
--_icon--color: var(--_icon--color-text);
|
|
40
|
+
}
|
|
41
|
+
.icon--gray {
|
|
42
|
+
--_icon--color: var(--_icon--color-gray);
|
|
43
|
+
}
|
|
44
|
+
.icon--green {
|
|
45
|
+
--_icon--color: var(--_icon--color-green);
|
|
46
|
+
}
|
|
47
|
+
.icon--red {
|
|
48
|
+
--_icon--color: var(--_icon--color-red);
|
|
49
|
+
}
|
|
50
|
+
.icon--orange {
|
|
51
|
+
--_icon--color: var(--_icon--color-orange);
|
|
52
|
+
}
|
|
53
|
+
.icon--blue {
|
|
54
|
+
--_icon--color: var(--_icon--color-blue);
|
|
55
|
+
}
|
|
56
|
+
.icon :global(svg) {
|
|
57
|
+
display: inline-block;
|
|
58
|
+
color: inherit;
|
|
59
|
+
fill: var(--_icon--color, currentColor);
|
|
60
|
+
filter: var(--_icon--filter);
|
|
61
|
+
height: var(--_icon--size);
|
|
62
|
+
min-height: var(--_icon--size);
|
|
63
|
+
max-height: var(--_icon--size);
|
|
64
|
+
width: var(--_icon--size);
|
|
65
|
+
min-width: var(--_icon--size);
|
|
66
|
+
max-width: var(--_icon--size);
|
|
67
|
+
}
|
|
68
|
+
.icon :global(path) {
|
|
69
|
+
stroke: var(--_icon--color);
|
|
70
|
+
stroke-width: var(--_icon--stroke-width);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.invalid-svg {
|
|
74
|
+
font-size: 1em;
|
|
75
|
+
color: red;
|
|
76
|
+
}</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Icon } from './cmp.icon.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type IconColor = 'white' | 'blue' | 'green' | 'gray' | 'orange' | 'red' | 'text';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
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-1770761136792",
|
|
4
4
|
"author": "StreamsCloud",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -70,27 +70,62 @@
|
|
|
70
70
|
"./core/toastr": {
|
|
71
71
|
"types": "./dist/core/toastr/index.d.ts",
|
|
72
72
|
"svelte": "./dist/core/toastr/index.js"
|
|
73
|
+
},
|
|
74
|
+
"./dialog": {
|
|
75
|
+
"types": "./dist/ui/dialog/index.d.ts",
|
|
76
|
+
"svelte": "./dist/ui/dialog/index.js"
|
|
77
|
+
},
|
|
78
|
+
"./button": {
|
|
79
|
+
"types": "./dist/ui/button/index.d.ts",
|
|
80
|
+
"svelte": "./dist/ui/button/index.js"
|
|
81
|
+
},
|
|
82
|
+
"./icon": {
|
|
83
|
+
"types": "./dist/ui/icon/index.d.ts",
|
|
84
|
+
"svelte": "./dist/ui/icon/index.js"
|
|
85
|
+
},
|
|
86
|
+
"./styles/functions": {
|
|
87
|
+
"sass": "./dist/styles/_functions.scss"
|
|
88
|
+
},
|
|
89
|
+
"./styles/mixins": {
|
|
90
|
+
"sass": "./dist/styles/_mixins.scss"
|
|
91
|
+
},
|
|
92
|
+
"./styles/colors": {
|
|
93
|
+
"sass": "./dist/styles/_colors.scss"
|
|
94
|
+
},
|
|
95
|
+
"./styles/responsive": {
|
|
96
|
+
"sass": "./dist/styles/_responsive.scss"
|
|
97
|
+
},
|
|
98
|
+
"./styles/base": {
|
|
99
|
+
"sass": "./dist/styles/_index.scss"
|
|
100
|
+
},
|
|
101
|
+
"./styles/theme": {
|
|
102
|
+
"sass": "./dist/styles/_theme.scss"
|
|
73
103
|
}
|
|
74
104
|
},
|
|
75
105
|
"peerDependencies": {
|
|
76
|
-
"@
|
|
77
|
-
"
|
|
78
|
-
"
|
|
106
|
+
"@fluentui/svg-icons": "^1.1.318",
|
|
107
|
+
"@popperjs/core": "^2.11.8",
|
|
108
|
+
"@urql/core": "^5.2.0",
|
|
109
|
+
"dequal": "^2.0.0",
|
|
110
|
+
"dompurify": "^3.3.0",
|
|
79
111
|
"mime": "^4.1.0",
|
|
80
112
|
"nanoid": "^5.1.6",
|
|
81
113
|
"rfdc": "^1.4.1",
|
|
82
|
-
"svelte": "^5.
|
|
114
|
+
"svelte": "^5.49.2",
|
|
83
115
|
"svelte-sonner": "^1.0.7",
|
|
84
116
|
"yup": "^1.7.1"
|
|
85
117
|
},
|
|
86
118
|
"devDependencies": {
|
|
87
|
-
"@urql/core": "^6.0.1",
|
|
88
119
|
"@eslint/compat": "^2.0.2",
|
|
89
120
|
"@eslint/js": "^9.39.2",
|
|
121
|
+
"@fluentui/svg-icons": "^1.1.318",
|
|
122
|
+
"@popperjs/core": "^2.11.8",
|
|
90
123
|
"@sveltejs/package": "^2.5.7",
|
|
91
124
|
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
92
125
|
"@tsconfig/svelte": "^5.0.7",
|
|
93
126
|
"@types/dompurify": "^3.0.5",
|
|
127
|
+
"@types/node": "^25.2.2",
|
|
128
|
+
"@urql/core": "^6.0.1",
|
|
94
129
|
"autoprefixer": "^10.4.24",
|
|
95
130
|
"dequal": "^2.0.3",
|
|
96
131
|
"dompurify": "^3.3.1",
|
|
@@ -114,8 +149,8 @@
|
|
|
114
149
|
"sass": "^1.97.3",
|
|
115
150
|
"svelte": "^5.49.2",
|
|
116
151
|
"svelte-check": "^4.3.6",
|
|
117
|
-
"svelte-sonner": "^1.0.7",
|
|
118
152
|
"svelte-preprocess": "^6.0.3",
|
|
153
|
+
"svelte-sonner": "^1.0.7",
|
|
119
154
|
"typescript": "^5.9.3",
|
|
120
155
|
"typescript-eslint": "^8.54.0",
|
|
121
156
|
"vite": "^7.3.1",
|