@coyalabs/bts-style 1.3.7 → 1.3.8
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/Base/BaseContainer.svelte +1 -1
- package/dist/Components/Button.svelte +12 -4
- package/dist/Components/Button.svelte.d.ts +2 -0
- package/dist/Components/ContextMenu.svelte +4 -2
- package/dist/Components/Dropdown.svelte +79 -30
- package/dist/Components/LinearList.svelte +104 -0
- package/dist/Components/LinearList.svelte.d.ts +146 -0
- package/dist/Components/Popup/AlertPopup.svelte +2 -1
- package/dist/Components/Popup/ConfirmPopup.svelte +2 -1
- package/dist/Components/Popup/Popup.svelte +50 -23
- package/dist/Components/Popup/PromptPopup.svelte +2 -1
- package/dist/Components/Popup/popupStore.d.ts +41 -0
- package/dist/Components/{popupStore.js → Popup/popupStore.js} +59 -32
- package/dist/Components/Toast/Toast.svelte +57 -0
- package/dist/Components/Toast/Toast.svelte.d.ts +26 -0
- package/dist/Components/Toast/toastStore.d.ts +35 -0
- package/dist/Components/Toast/toastStore.js +53 -0
- package/dist/Components/Tooltip.svelte +1 -1
- package/dist/Components/TreeDirectory.svelte +20 -1
- package/dist/Components/TreeDirectory.svelte.d.ts +2 -0
- package/dist/icons.d.ts +3 -0
- package/dist/icons.js +3 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/package.json +2 -2
- package/dist/Components/popupStore.d.ts +0 -31
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
*/
|
|
20
20
|
export let icon = null;
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* @type {boolean}
|
|
24
|
+
*/
|
|
25
|
+
export let correctTextOffset = false;
|
|
26
|
+
|
|
22
27
|
/**
|
|
23
28
|
* @type {string | null}
|
|
24
29
|
*/
|
|
@@ -81,9 +86,11 @@
|
|
|
81
86
|
</div>
|
|
82
87
|
{/if}
|
|
83
88
|
{#if $$slots.default}
|
|
84
|
-
<
|
|
85
|
-
<
|
|
86
|
-
|
|
89
|
+
<div style="transform: translateY({correctTextOffset ? '-2px' : '0px'})">
|
|
90
|
+
<BaseText variant="button">
|
|
91
|
+
<slot />
|
|
92
|
+
</BaseText>
|
|
93
|
+
</div>
|
|
87
94
|
{/if}
|
|
88
95
|
</div>
|
|
89
96
|
{/if}
|
|
@@ -103,13 +110,14 @@
|
|
|
103
110
|
display: block;
|
|
104
111
|
width: 100%;
|
|
105
112
|
user-select: none;
|
|
113
|
+
overflow: visible;
|
|
106
114
|
}
|
|
107
115
|
|
|
108
116
|
.button-content {
|
|
109
117
|
display: flex;
|
|
110
118
|
align-items: center;
|
|
111
119
|
justify-content: space-between;
|
|
112
|
-
gap:
|
|
120
|
+
gap: 25px;
|
|
113
121
|
}
|
|
114
122
|
|
|
115
123
|
.icon-text {
|
|
@@ -6,6 +6,7 @@ type Button = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
|
|
|
6
6
|
borderRadiusBottomLeft?: string | undefined;
|
|
7
7
|
borderRadiusBottomRight?: string | undefined;
|
|
8
8
|
icon?: string | null | undefined;
|
|
9
|
+
correctTextOffset?: boolean | undefined;
|
|
9
10
|
actionIcon?: string | null | undefined;
|
|
10
11
|
iconRotation?: number | undefined;
|
|
11
12
|
actionIconRotation?: number | undefined;
|
|
@@ -30,6 +31,7 @@ declare const Button: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWit
|
|
|
30
31
|
borderRadiusBottomLeft?: string | undefined;
|
|
31
32
|
borderRadiusBottomRight?: string | undefined;
|
|
32
33
|
icon?: string | null | undefined;
|
|
34
|
+
correctTextOffset?: boolean | undefined;
|
|
33
35
|
actionIcon?: string | null | undefined;
|
|
34
36
|
iconRotation?: number | undefined;
|
|
35
37
|
actionIconRotation?: number | undefined;
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
{#each categories as category, catIndex}
|
|
47
47
|
{#if category.label}
|
|
48
48
|
<div class="separator" class:not-first={catIndex > 0}>
|
|
49
|
-
<BaseText variant="
|
|
49
|
+
<BaseText textModifier="-3px" variant="button">{category.label}</BaseText>
|
|
50
50
|
</div>
|
|
51
51
|
{/if}
|
|
52
52
|
<div class="category-items">
|
|
@@ -73,8 +73,10 @@
|
|
|
73
73
|
|
|
74
74
|
.separator {
|
|
75
75
|
opacity: 0.6;
|
|
76
|
-
padding
|
|
76
|
+
padding: 0 1rem 0.5rem 1rem;
|
|
77
77
|
font-size: 0.85rem;
|
|
78
|
+
margin-top: 0.5rem;
|
|
79
|
+
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
.separator.not-first {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import { tick } from 'svelte';
|
|
2
3
|
import Button from './Button.svelte';
|
|
3
4
|
import ContextMenu from './ContextMenu.svelte';
|
|
4
5
|
import { icons } from '../icons';
|
|
5
|
-
import { slide } from 'svelte/transition';
|
|
6
6
|
import { VARIANT_FULL } from '../Base/variantTypes.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -66,24 +66,24 @@
|
|
|
66
66
|
|
|
67
67
|
let isOpen = false;
|
|
68
68
|
/**
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
* @type {HTMLDivElement}
|
|
70
|
+
*/
|
|
71
71
|
let dropdownRef;
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
* @type {
|
|
74
|
+
* @type {HTMLButtonElement}
|
|
75
75
|
*/
|
|
76
76
|
let buttonRef;
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
/**
|
|
79
79
|
* @type {{top: number, left: number, width: number}}
|
|
80
80
|
*/
|
|
81
81
|
let menuPosition = { top: 0, left: 0, width: 0 };
|
|
82
82
|
|
|
83
|
-
function
|
|
84
|
-
|
|
85
|
-
if (isOpen && buttonRef) {
|
|
83
|
+
function updateMenuPosition() {
|
|
84
|
+
if (buttonRef) {
|
|
86
85
|
const rect = buttonRef.getBoundingClientRect();
|
|
86
|
+
// getBoundingClientRect returns viewport coordinates which work directly with position:fixed
|
|
87
87
|
menuPosition = {
|
|
88
88
|
top: rect.bottom + 4,
|
|
89
89
|
left: rect.left,
|
|
@@ -92,6 +92,16 @@
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
async function toggleDropdown() {
|
|
96
|
+
if (!isOpen) {
|
|
97
|
+
isOpen = true;
|
|
98
|
+
await tick();
|
|
99
|
+
updateMenuPosition();
|
|
100
|
+
} else {
|
|
101
|
+
isOpen = false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
95
105
|
/**
|
|
96
106
|
* @param {any} optionValue
|
|
97
107
|
*/
|
|
@@ -101,12 +111,43 @@
|
|
|
101
111
|
onChange(optionValue);
|
|
102
112
|
}
|
|
103
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Svelte action to portal an element to body
|
|
116
|
+
* @param {HTMLElement} node
|
|
117
|
+
*/
|
|
118
|
+
function portal(node) {
|
|
119
|
+
document.body.appendChild(node);
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
destroy() {
|
|
123
|
+
if (node.parentNode) {
|
|
124
|
+
node.parentNode.removeChild(node);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
104
130
|
/**
|
|
105
131
|
* @param {MouseEvent} event
|
|
106
132
|
*/
|
|
107
133
|
function handleClickOutside(event) {
|
|
108
|
-
if (
|
|
109
|
-
|
|
134
|
+
if (!isOpen) return;
|
|
135
|
+
|
|
136
|
+
// Check if click is inside dropdown button
|
|
137
|
+
if (dropdownRef && event.target instanceof Node && dropdownRef.contains(event.target)) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
// Check if click is inside the menu (which is portaled to body)
|
|
141
|
+
const menu = document.querySelector('.dropdown-menu-portal');
|
|
142
|
+
if (menu && event.target instanceof Node && menu.contains(event.target)) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
isOpen = false;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function handleScroll() {
|
|
149
|
+
if (isOpen) {
|
|
150
|
+
updateMenuPosition();
|
|
110
151
|
}
|
|
111
152
|
}
|
|
112
153
|
|
|
@@ -114,10 +155,10 @@
|
|
|
114
155
|
$: displayLabel = selectedOption ? selectedOption.label : label;
|
|
115
156
|
</script>
|
|
116
157
|
|
|
117
|
-
<svelte:window on:click={handleClickOutside} />
|
|
158
|
+
<svelte:window on:click={handleClickOutside} on:scroll={handleScroll} />
|
|
118
159
|
|
|
119
160
|
<div class="dropdown-container" bind:this={dropdownRef} style="width: {width};">
|
|
120
|
-
<
|
|
161
|
+
<button class="dropdown-button" bind:this={buttonRef} on:click={toggleDropdown}>
|
|
121
162
|
<Button
|
|
122
163
|
{theme}
|
|
123
164
|
{icon}
|
|
@@ -128,31 +169,44 @@
|
|
|
128
169
|
{borderRadiusTopRight}
|
|
129
170
|
{borderRadiusBottomLeft}
|
|
130
171
|
{borderRadiusBottomRight}
|
|
131
|
-
on:click={toggleDropdown}
|
|
132
172
|
>
|
|
133
173
|
<span class="button-label">{displayLabel}</span>
|
|
134
174
|
</Button>
|
|
135
|
-
</
|
|
136
|
-
|
|
137
|
-
{#if isOpen}
|
|
138
|
-
<div
|
|
139
|
-
class="dropdown-menu"
|
|
140
|
-
transition:slide={{ duration: 150 }}
|
|
141
|
-
style="top: {menuPosition.top}px; left: {menuPosition.left}px; width: {menuPosition.width}px;"
|
|
142
|
-
>
|
|
143
|
-
<ContextMenu items={options} selectedValue={value} onSelect={selectOption} />
|
|
144
|
-
</div>
|
|
145
|
-
{/if}
|
|
175
|
+
</button>
|
|
146
176
|
</div>
|
|
147
177
|
|
|
178
|
+
{#if isOpen}
|
|
179
|
+
<div
|
|
180
|
+
class="dropdown-menu-portal"
|
|
181
|
+
use:portal
|
|
182
|
+
style="
|
|
183
|
+
position: fixed;
|
|
184
|
+
top: {menuPosition.top}px;
|
|
185
|
+
left: {menuPosition.left}px;
|
|
186
|
+
width: {menuPosition.width}px;
|
|
187
|
+
z-index: 10001;
|
|
188
|
+
"
|
|
189
|
+
>
|
|
190
|
+
<ContextMenu items={options} selectedValue={value} onSelect={selectOption} />
|
|
191
|
+
</div>
|
|
192
|
+
{/if}
|
|
193
|
+
|
|
148
194
|
<style>
|
|
149
195
|
.dropdown-container {
|
|
150
196
|
position: relative;
|
|
151
197
|
display: inline-block;
|
|
152
198
|
}
|
|
153
199
|
|
|
154
|
-
.dropdown-
|
|
200
|
+
.dropdown-button {
|
|
201
|
+
all: unset;
|
|
202
|
+
display: block;
|
|
155
203
|
width: 100%;
|
|
204
|
+
cursor: pointer;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.dropdown-button :global(button) {
|
|
208
|
+
width: 100%;
|
|
209
|
+
pointer-events: none;
|
|
156
210
|
}
|
|
157
211
|
|
|
158
212
|
.button-label {
|
|
@@ -161,9 +215,4 @@
|
|
|
161
215
|
text-overflow: ellipsis;
|
|
162
216
|
white-space: nowrap;
|
|
163
217
|
}
|
|
164
|
-
|
|
165
|
-
.dropdown-menu {
|
|
166
|
-
position: fixed;
|
|
167
|
-
z-index: 10000;
|
|
168
|
-
}
|
|
169
218
|
</style>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Button from './Button.svelte';
|
|
3
|
+
import IconButton from './IconButton.svelte';
|
|
4
|
+
import { icons } from '../icons.js';
|
|
5
|
+
import { createEventDispatcher } from 'svelte';
|
|
6
|
+
|
|
7
|
+
const dispatch = createEventDispatcher();
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {Object} CustomAction
|
|
11
|
+
* @property {string} label - Action label text
|
|
12
|
+
* @property {string} [actionIcon] - Optional action icon SVG
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {Object} ListItem
|
|
17
|
+
* @property {any} [data] - Custom data attached to item
|
|
18
|
+
* @property {CustomAction[]} [customActions] - Array of custom action buttons
|
|
19
|
+
* @property {boolean} [removeButton] - Show remove button
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/** @type {ListItem[]} */
|
|
23
|
+
export let items = [];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @param {number} index
|
|
27
|
+
* @param {string} actionLabel
|
|
28
|
+
*/
|
|
29
|
+
function handleAction(index, actionLabel) {
|
|
30
|
+
dispatch('action', { index, actionLabel, item: items[index] });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param {number} index
|
|
35
|
+
*/
|
|
36
|
+
function handleRemove(index) {
|
|
37
|
+
dispatch('remove', { index, item: items[index] });
|
|
38
|
+
}
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<div class="linear-list">
|
|
42
|
+
{#each items as item, index (index)}
|
|
43
|
+
<div class="list-item">
|
|
44
|
+
<div class="content">
|
|
45
|
+
<slot {item} {index} />
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div class="actions">
|
|
49
|
+
{#if item.customActions}
|
|
50
|
+
{#each item.customActions as action}
|
|
51
|
+
<Button
|
|
52
|
+
theme="secondary"
|
|
53
|
+
actionIcon={action.actionIcon}
|
|
54
|
+
on:click={() => handleAction(index, action.label)}
|
|
55
|
+
>
|
|
56
|
+
{action.label}
|
|
57
|
+
</Button>
|
|
58
|
+
{/each}
|
|
59
|
+
{/if}
|
|
60
|
+
|
|
61
|
+
{#if item.removeButton}
|
|
62
|
+
<IconButton
|
|
63
|
+
svg={icons.cross}
|
|
64
|
+
variant="toned"
|
|
65
|
+
on:click={() => handleRemove(index)}
|
|
66
|
+
/>
|
|
67
|
+
{/if}
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
{/each}
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<style>
|
|
74
|
+
.linear-list {
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
padding-left: 0.3rem;
|
|
78
|
+
padding-right: 0.3rem;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.list-item {
|
|
82
|
+
display: flex;
|
|
83
|
+
justify-content: space-between;
|
|
84
|
+
align-items: center;
|
|
85
|
+
padding: 10px 0;
|
|
86
|
+
border-bottom: 2px solid rgba(161, 143, 143, 0.24);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.list-item:last-child {
|
|
90
|
+
border-bottom: none;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.content {
|
|
94
|
+
flex: 1;
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.actions {
|
|
100
|
+
display: flex;
|
|
101
|
+
gap: 0.5rem;
|
|
102
|
+
align-items: center;
|
|
103
|
+
}
|
|
104
|
+
</style>
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
export default LinearList;
|
|
2
|
+
type LinearList = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
|
|
3
|
+
items?: ListItem[] | undefined;
|
|
4
|
+
}, {
|
|
5
|
+
default: {
|
|
6
|
+
item: ListItem;
|
|
7
|
+
index: any;
|
|
8
|
+
};
|
|
9
|
+
}>, {
|
|
10
|
+
action: CustomEvent<any>;
|
|
11
|
+
remove: CustomEvent<any>;
|
|
12
|
+
} & {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
}, {
|
|
15
|
+
default: {
|
|
16
|
+
item: ListItem;
|
|
17
|
+
index: any;
|
|
18
|
+
};
|
|
19
|
+
}> & {
|
|
20
|
+
$$bindings?: string | undefined;
|
|
21
|
+
};
|
|
22
|
+
declare const LinearList: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
23
|
+
items?: {
|
|
24
|
+
/**
|
|
25
|
+
* - Custom data attached to item
|
|
26
|
+
*/
|
|
27
|
+
data?: any;
|
|
28
|
+
/**
|
|
29
|
+
* - Array of custom action buttons
|
|
30
|
+
*/
|
|
31
|
+
customActions?: {
|
|
32
|
+
/**
|
|
33
|
+
* - Action label text
|
|
34
|
+
*/
|
|
35
|
+
label: string;
|
|
36
|
+
/**
|
|
37
|
+
* - Optional action icon SVG
|
|
38
|
+
*/
|
|
39
|
+
actionIcon?: string | undefined;
|
|
40
|
+
}[] | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* - Show remove button
|
|
43
|
+
*/
|
|
44
|
+
removeButton?: boolean | undefined;
|
|
45
|
+
}[] | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
default: {
|
|
48
|
+
item: {
|
|
49
|
+
/**
|
|
50
|
+
* - Custom data attached to item
|
|
51
|
+
*/
|
|
52
|
+
data?: any;
|
|
53
|
+
/**
|
|
54
|
+
* - Array of custom action buttons
|
|
55
|
+
*/
|
|
56
|
+
customActions?: {
|
|
57
|
+
/**
|
|
58
|
+
* - Action label text
|
|
59
|
+
*/
|
|
60
|
+
label: string;
|
|
61
|
+
/**
|
|
62
|
+
* - Optional action icon SVG
|
|
63
|
+
*/
|
|
64
|
+
actionIcon?: string | undefined;
|
|
65
|
+
}[] | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* - Show remove button
|
|
68
|
+
*/
|
|
69
|
+
removeButton?: boolean | undefined;
|
|
70
|
+
};
|
|
71
|
+
index: any;
|
|
72
|
+
};
|
|
73
|
+
}>, {
|
|
74
|
+
action: CustomEvent<any>;
|
|
75
|
+
remove: CustomEvent<any>;
|
|
76
|
+
} & {
|
|
77
|
+
[evt: string]: CustomEvent<any>;
|
|
78
|
+
}, {
|
|
79
|
+
default: {
|
|
80
|
+
item: {
|
|
81
|
+
/**
|
|
82
|
+
* - Custom data attached to item
|
|
83
|
+
*/
|
|
84
|
+
data?: any;
|
|
85
|
+
/**
|
|
86
|
+
* - Array of custom action buttons
|
|
87
|
+
*/
|
|
88
|
+
customActions?: {
|
|
89
|
+
/**
|
|
90
|
+
* - Action label text
|
|
91
|
+
*/
|
|
92
|
+
label: string;
|
|
93
|
+
/**
|
|
94
|
+
* - Optional action icon SVG
|
|
95
|
+
*/
|
|
96
|
+
actionIcon?: string | undefined;
|
|
97
|
+
}[] | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* - Show remove button
|
|
100
|
+
*/
|
|
101
|
+
removeButton?: boolean | undefined;
|
|
102
|
+
};
|
|
103
|
+
index: any;
|
|
104
|
+
};
|
|
105
|
+
}, {}, string>;
|
|
106
|
+
type ListItem = {
|
|
107
|
+
/**
|
|
108
|
+
* - Custom data attached to item
|
|
109
|
+
*/
|
|
110
|
+
data?: any;
|
|
111
|
+
/**
|
|
112
|
+
* - Array of custom action buttons
|
|
113
|
+
*/
|
|
114
|
+
customActions?: {
|
|
115
|
+
/**
|
|
116
|
+
* - Action label text
|
|
117
|
+
*/
|
|
118
|
+
label: string;
|
|
119
|
+
/**
|
|
120
|
+
* - Optional action icon SVG
|
|
121
|
+
*/
|
|
122
|
+
actionIcon?: string | undefined;
|
|
123
|
+
}[] | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* - Show remove button
|
|
126
|
+
*/
|
|
127
|
+
removeButton?: boolean | undefined;
|
|
128
|
+
};
|
|
129
|
+
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
130
|
+
default: any;
|
|
131
|
+
} ? Props extends Record<string, never> ? any : {
|
|
132
|
+
children?: any;
|
|
133
|
+
} : {});
|
|
134
|
+
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> {
|
|
135
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
136
|
+
$$bindings?: Bindings;
|
|
137
|
+
} & Exports;
|
|
138
|
+
(internal: unknown, props: Props & {
|
|
139
|
+
$$events?: Events;
|
|
140
|
+
$$slots?: Slots;
|
|
141
|
+
}): Exports & {
|
|
142
|
+
$set?: any;
|
|
143
|
+
$on?: any;
|
|
144
|
+
};
|
|
145
|
+
z_$$bindings?: Bindings;
|
|
146
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import Button from '../Button.svelte';
|
|
3
3
|
import { icons } from '../../icons.js';
|
|
4
|
-
import { popupStore } from '
|
|
4
|
+
import { popupStore } from './popupStore.js';
|
|
5
5
|
import { VARIANT_PRIMARY } from '../../Base/variantTypes.js';
|
|
6
6
|
|
|
7
7
|
/** @type {() => void} */
|
|
@@ -24,5 +24,6 @@
|
|
|
24
24
|
.buttons {
|
|
25
25
|
display: flex;
|
|
26
26
|
justify-content: flex-end;
|
|
27
|
+
overflow: visible;
|
|
27
28
|
}
|
|
28
29
|
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { icons } from '../../icons.js';
|
|
3
3
|
import Button from '../Button.svelte';
|
|
4
|
-
import { popupStore } from '
|
|
4
|
+
import { popupStore } from './popupStore.js';
|
|
5
5
|
import { VARIANT_PRIMARY, VARIANT_SECONDARY } from '../../Base/variantTypes.js';
|
|
6
6
|
|
|
7
7
|
/** @type {() => void} */
|
|
@@ -36,5 +36,6 @@
|
|
|
36
36
|
.buttons {
|
|
37
37
|
display: flex;
|
|
38
38
|
gap: 1rem;
|
|
39
|
+
overflow: visible;
|
|
39
40
|
}
|
|
40
41
|
</style>
|
|
@@ -1,36 +1,55 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { fade, fly } from 'svelte/transition';
|
|
3
3
|
import { backOut } from 'svelte/easing';
|
|
4
|
-
import { popupStore } from '
|
|
4
|
+
import { popupStore } from './popupStore.js';
|
|
5
5
|
import BaseContainer from '../../Base/BaseContainer.svelte';
|
|
6
6
|
import IconButton from '../IconButton.svelte';
|
|
7
7
|
import TextHeader from '../../Structure/TextHeader.svelte';
|
|
8
8
|
import { icons } from '../../icons.js';
|
|
9
9
|
import { VARIANT_FILLED } from '../../Base/variantTypes.js';
|
|
10
|
+
|
|
11
|
+
// Subscribe to the actual stack
|
|
12
|
+
/** @type {Array<{id: string, title: string, subtitle?: string, component: any, props: any}>} */
|
|
13
|
+
let popupStack = [];
|
|
14
|
+
popupStore.stack.subscribe((s) => {
|
|
15
|
+
popupStack = s;
|
|
16
|
+
});
|
|
10
17
|
</script>
|
|
11
18
|
|
|
12
|
-
{#if
|
|
13
|
-
<div class="overlay" transition:fade={{ duration:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
{#if popupStack.length > 0}
|
|
20
|
+
<div class="overlay" transition:fade={{ duration: 200 }} on:click={popupStore.close} role="presentation">
|
|
21
|
+
{#each popupStack as popup, index (popup.id)}
|
|
22
|
+
{@const isTop = index === popupStack.length - 1}
|
|
23
|
+
{@const depth = popupStack.length - 1 - index}
|
|
24
|
+
<div
|
|
25
|
+
class="dialog"
|
|
26
|
+
class:background={!isTop}
|
|
27
|
+
style="
|
|
28
|
+
--scale: {isTop ? 1 : Math.max(0.85, 1 - depth * 0.08)};
|
|
29
|
+
--brightness: {isTop ? 1 : Math.max(0.4, 1 - depth * 0.3)};
|
|
30
|
+
--y-offset: {isTop ? 0 : -depth * 20}px;
|
|
31
|
+
z-index: {index};
|
|
32
|
+
"
|
|
33
|
+
in:fly|global={{ y: 40, duration: 350, easing: backOut }}
|
|
34
|
+
out:fly|global={{ y: 20, duration: 200 }}
|
|
35
|
+
on:click|stopPropagation
|
|
36
|
+
on:keydown|stopPropagation
|
|
37
|
+
role="dialog"
|
|
38
|
+
tabindex="-1"
|
|
39
|
+
>
|
|
40
|
+
<BaseContainer padding="1.5rem" borderRadiusTopLeft="35px" borderRadiusTopRight="35px" borderRadiusBottomLeft="35px" borderRadiusBottomRight="35px" theme={VARIANT_FILLED}>
|
|
41
|
+
<header>
|
|
42
|
+
<TextHeader title={popup.title} subtitle={popup.subtitle || ''} />
|
|
43
|
+
<div class="close-btn">
|
|
44
|
+
<IconButton svg={icons.cross} size="20px" variant="toned" on:click={popupStore.close} />
|
|
45
|
+
</div>
|
|
46
|
+
</header>
|
|
47
|
+
<main>
|
|
48
|
+
<svelte:component this={popup.component} {...popup.props} />
|
|
49
|
+
</main>
|
|
50
|
+
</BaseContainer>
|
|
51
|
+
</div>
|
|
52
|
+
{/each}
|
|
34
53
|
</div>
|
|
35
54
|
{/if}
|
|
36
55
|
|
|
@@ -46,11 +65,19 @@
|
|
|
46
65
|
}
|
|
47
66
|
|
|
48
67
|
.dialog {
|
|
68
|
+
position: absolute;
|
|
49
69
|
width: min(90%, 600px);
|
|
50
70
|
max-height: 80vh;
|
|
51
71
|
zoom: 0.92;
|
|
52
72
|
display: flex;
|
|
53
73
|
flex-direction: column;
|
|
74
|
+
transform: scale(var(--scale)) translateY(var(--y-offset));
|
|
75
|
+
filter: brightness(var(--brightness));
|
|
76
|
+
transition: transform 0.3s ease, filter 0.3s ease;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.dialog.background {
|
|
80
|
+
pointer-events: none;
|
|
54
81
|
}
|
|
55
82
|
|
|
56
83
|
.dialog :global(.glow-base-container) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import InputBox from '../InputBox.svelte';
|
|
4
4
|
import BaseText from '../../Base/BaseText.svelte';
|
|
5
5
|
import { icons } from '../../icons.js';
|
|
6
|
-
import { popupStore } from '
|
|
6
|
+
import { popupStore } from './popupStore.js';
|
|
7
7
|
import { VARIANT_PRIMARY, VARIANT_SECONDARY } from '../../Base/variantTypes.js';
|
|
8
8
|
|
|
9
9
|
/** @type {(value: string) => void} */
|
|
@@ -58,5 +58,6 @@
|
|
|
58
58
|
.buttons {
|
|
59
59
|
display: flex;
|
|
60
60
|
gap: 1rem;
|
|
61
|
+
overflow: visible;
|
|
61
62
|
}
|
|
62
63
|
</style>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export namespace popupStore {
|
|
2
|
+
let subscribe: (this: void, run: import("svelte/store").Subscriber<{
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
title: string;
|
|
5
|
+
subtitle: string;
|
|
6
|
+
component: any;
|
|
7
|
+
props: any;
|
|
8
|
+
}>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
|
|
9
|
+
namespace stack {
|
|
10
|
+
let subscribe_1: (this: void, run: import("svelte/store").Subscriber<PopupState[]>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
|
|
11
|
+
export { subscribe_1 as subscribe };
|
|
12
|
+
}
|
|
13
|
+
function open(title: string, component: any, props?: {}, subtitle?: string): void;
|
|
14
|
+
function close(): void;
|
|
15
|
+
function closeAll(): void;
|
|
16
|
+
function confirm(title: string, message: string, options?: {
|
|
17
|
+
onConfirm?: (() => void) | undefined;
|
|
18
|
+
onCancel?: (() => void) | undefined;
|
|
19
|
+
confirmText?: string | undefined;
|
|
20
|
+
cancelText?: string | undefined;
|
|
21
|
+
}): void;
|
|
22
|
+
function alert(title: string, message: string, options?: {
|
|
23
|
+
onOk?: (() => void) | undefined;
|
|
24
|
+
okText?: string | undefined;
|
|
25
|
+
}): void;
|
|
26
|
+
function prompt(title: string, message: string, options?: {
|
|
27
|
+
onSubmit?: ((value: string) => void) | undefined;
|
|
28
|
+
onCancel?: (() => void) | undefined;
|
|
29
|
+
placeholder?: string | undefined;
|
|
30
|
+
submitText?: string | undefined;
|
|
31
|
+
cancelText?: string | undefined;
|
|
32
|
+
label?: string | undefined;
|
|
33
|
+
}): void;
|
|
34
|
+
}
|
|
35
|
+
export type PopupState = {
|
|
36
|
+
title: string;
|
|
37
|
+
subtitle?: string | undefined;
|
|
38
|
+
component: any;
|
|
39
|
+
props: any;
|
|
40
|
+
id: string;
|
|
41
|
+
};
|
|
@@ -1,37 +1,64 @@
|
|
|
1
|
-
import { writable } from 'svelte/store';
|
|
2
|
-
import ConfirmPopup from './
|
|
3
|
-
import AlertPopup from './
|
|
4
|
-
import PromptPopup from './
|
|
1
|
+
import { writable, derived } from 'svelte/store';
|
|
2
|
+
import ConfirmPopup from './ConfirmPopup.svelte';
|
|
3
|
+
import AlertPopup from './AlertPopup.svelte';
|
|
4
|
+
import PromptPopup from './PromptPopup.svelte';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Object} PopupState
|
|
8
|
+
* @property {string} title
|
|
9
|
+
* @property {string} [subtitle]
|
|
10
|
+
* @property {any} component
|
|
11
|
+
* @property {any} props
|
|
12
|
+
* @property {string} id
|
|
13
|
+
*/
|
|
5
14
|
|
|
6
15
|
function createPopupStore() {
|
|
7
|
-
/** @type {import('svelte/store').Writable<
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
/** @type {import('svelte/store').Writable<PopupState[]>} */
|
|
17
|
+
const stack = writable([]);
|
|
18
|
+
|
|
19
|
+
// Derived store for backwards compatibility - exposes top popup as the "current" state
|
|
20
|
+
const currentPopup = derived(stack, ($stack) => {
|
|
21
|
+
if ($stack.length === 0) {
|
|
22
|
+
return {
|
|
23
|
+
isOpen: false,
|
|
24
|
+
title: '',
|
|
25
|
+
subtitle: '',
|
|
26
|
+
component: /** @type {any} */ (null),
|
|
27
|
+
props: {}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const top = $stack[$stack.length - 1];
|
|
31
|
+
return {
|
|
32
|
+
isOpen: true,
|
|
33
|
+
title: top.title,
|
|
34
|
+
subtitle: top.subtitle || '',
|
|
35
|
+
component: top.component,
|
|
36
|
+
props: top.props
|
|
37
|
+
};
|
|
14
38
|
});
|
|
15
39
|
|
|
16
40
|
return {
|
|
17
|
-
subscribe,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
41
|
+
subscribe: currentPopup.subscribe,
|
|
42
|
+
|
|
43
|
+
// Expose the full stack for the Popup component
|
|
44
|
+
stack: { subscribe: stack.subscribe },
|
|
45
|
+
|
|
46
|
+
open: (/** @type {string} */ title, /** @type {any} */ component, props = {}, subtitle = '') => {
|
|
47
|
+
stack.update(s => [...s, {
|
|
48
|
+
id: crypto.randomUUID(),
|
|
21
49
|
title,
|
|
22
50
|
subtitle,
|
|
23
51
|
component,
|
|
24
52
|
props
|
|
25
|
-
});
|
|
53
|
+
}]);
|
|
26
54
|
},
|
|
55
|
+
|
|
27
56
|
close: () => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
props: {}
|
|
34
|
-
});
|
|
57
|
+
stack.update(s => s.slice(0, -1));
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
closeAll: () => {
|
|
61
|
+
stack.set([]);
|
|
35
62
|
},
|
|
36
63
|
|
|
37
64
|
/**
|
|
@@ -45,13 +72,13 @@ function createPopupStore() {
|
|
|
45
72
|
* @param {string} [options.cancelText]
|
|
46
73
|
*/
|
|
47
74
|
confirm: (title, message, options = {}) => {
|
|
48
|
-
|
|
49
|
-
|
|
75
|
+
stack.update(s => [...s, {
|
|
76
|
+
id: crypto.randomUUID(),
|
|
50
77
|
title,
|
|
51
78
|
subtitle: message,
|
|
52
79
|
component: ConfirmPopup,
|
|
53
80
|
props: options
|
|
54
|
-
});
|
|
81
|
+
}]);
|
|
55
82
|
},
|
|
56
83
|
|
|
57
84
|
/**
|
|
@@ -63,13 +90,13 @@ function createPopupStore() {
|
|
|
63
90
|
* @param {string} [options.okText]
|
|
64
91
|
*/
|
|
65
92
|
alert: (title, message, options = {}) => {
|
|
66
|
-
|
|
67
|
-
|
|
93
|
+
stack.update(s => [...s, {
|
|
94
|
+
id: crypto.randomUUID(),
|
|
68
95
|
title,
|
|
69
96
|
subtitle: message,
|
|
70
97
|
component: AlertPopup,
|
|
71
98
|
props: options
|
|
72
|
-
});
|
|
99
|
+
}]);
|
|
73
100
|
},
|
|
74
101
|
|
|
75
102
|
/**
|
|
@@ -85,13 +112,13 @@ function createPopupStore() {
|
|
|
85
112
|
* @param {string} [options.label]
|
|
86
113
|
*/
|
|
87
114
|
prompt: (title, message, options = {}) => {
|
|
88
|
-
|
|
89
|
-
|
|
115
|
+
stack.update(s => [...s, {
|
|
116
|
+
id: crypto.randomUUID(),
|
|
90
117
|
title,
|
|
91
118
|
subtitle: message,
|
|
92
119
|
component: PromptPopup,
|
|
93
120
|
props: options
|
|
94
|
-
});
|
|
121
|
+
}]);
|
|
95
122
|
}
|
|
96
123
|
};
|
|
97
124
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { fly } from 'svelte/transition';
|
|
3
|
+
import { toastStore } from './toastStore.js';
|
|
4
|
+
import Button from '../Button.svelte';
|
|
5
|
+
import { icons } from '../../icons.js';
|
|
6
|
+
import { VARIANT_SECONDARY } from '../../Base/variantTypes.js';
|
|
7
|
+
|
|
8
|
+
/** @type {Array<{id: string, message: string, duration?: number}>} */
|
|
9
|
+
let toasts = [];
|
|
10
|
+
|
|
11
|
+
toastStore.subscribe((t) => {
|
|
12
|
+
toasts = t;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {string} id
|
|
17
|
+
*/
|
|
18
|
+
function handleDismiss(id) {
|
|
19
|
+
toastStore.dismiss(id);
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<div class="toast-container">
|
|
24
|
+
{#each toasts as toast (toast.id)}
|
|
25
|
+
<div
|
|
26
|
+
class="toast"
|
|
27
|
+
in:fly={{ x: 300, duration: 300 }}
|
|
28
|
+
out:fly={{ x: 300, duration: 200 }}
|
|
29
|
+
>
|
|
30
|
+
<Button
|
|
31
|
+
theme={VARIANT_SECONDARY}
|
|
32
|
+
icon={icons.help}
|
|
33
|
+
actionIcon={icons.crossb}
|
|
34
|
+
on:click={() => handleDismiss(toast.id)}
|
|
35
|
+
>
|
|
36
|
+
{toast.message}
|
|
37
|
+
</Button>
|
|
38
|
+
</div>
|
|
39
|
+
{/each}
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<style>
|
|
43
|
+
.toast-container {
|
|
44
|
+
position: fixed;
|
|
45
|
+
bottom: 2rem;
|
|
46
|
+
right: 2rem;
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
gap: 0.75rem;
|
|
50
|
+
z-index: 10000;
|
|
51
|
+
pointer-events: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.toast {
|
|
55
|
+
pointer-events: auto;
|
|
56
|
+
}
|
|
57
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Toast;
|
|
2
|
+
type Toast = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Toast: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
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> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export namespace toastStore {
|
|
2
|
+
export { subscribe };
|
|
3
|
+
/**
|
|
4
|
+
* Show a toast notification
|
|
5
|
+
* @param {string} message - Toast message
|
|
6
|
+
* @param {number} [duration=4000] - Auto-dismiss duration in ms (0 = no auto-dismiss)
|
|
7
|
+
* @returns {string} Toast ID
|
|
8
|
+
*/
|
|
9
|
+
export function show(message: string, duration?: number): string;
|
|
10
|
+
/**
|
|
11
|
+
* Dismiss a specific toast
|
|
12
|
+
* @param {string} id - Toast ID to dismiss
|
|
13
|
+
*/
|
|
14
|
+
export function dismiss(id: string): void;
|
|
15
|
+
/**
|
|
16
|
+
* Dismiss all toasts
|
|
17
|
+
*/
|
|
18
|
+
export function dismissAll(): void;
|
|
19
|
+
}
|
|
20
|
+
export type Toast = {
|
|
21
|
+
/**
|
|
22
|
+
* - Unique toast identifier
|
|
23
|
+
*/
|
|
24
|
+
id: string;
|
|
25
|
+
/**
|
|
26
|
+
* - Toast message content
|
|
27
|
+
*/
|
|
28
|
+
message: string;
|
|
29
|
+
/**
|
|
30
|
+
* - Auto-dismiss duration in ms (0 = no auto-dismiss)
|
|
31
|
+
*/
|
|
32
|
+
duration?: number | undefined;
|
|
33
|
+
};
|
|
34
|
+
declare const subscribe: (this: void, run: import("svelte/store").Subscriber<Toast[]>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { writable } from 'svelte/store';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {Object} Toast
|
|
5
|
+
* @property {string} id - Unique toast identifier
|
|
6
|
+
* @property {string} message - Toast message content
|
|
7
|
+
* @property {number} [duration] - Auto-dismiss duration in ms (0 = no auto-dismiss)
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
function createToastStore() {
|
|
11
|
+
const { subscribe, update } = writable(/** @type {Toast[]} */ ([]));
|
|
12
|
+
|
|
13
|
+
let idCounter = 0;
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
subscribe,
|
|
17
|
+
/**
|
|
18
|
+
* Show a toast notification
|
|
19
|
+
* @param {string} message - Toast message
|
|
20
|
+
* @param {number} [duration=4000] - Auto-dismiss duration in ms (0 = no auto-dismiss)
|
|
21
|
+
* @returns {string} Toast ID
|
|
22
|
+
*/
|
|
23
|
+
show(message, duration = 4000) {
|
|
24
|
+
const id = `toast-${idCounter++}`;
|
|
25
|
+
const toast = { id, message, duration };
|
|
26
|
+
|
|
27
|
+
update(toasts => [...toasts, toast]);
|
|
28
|
+
|
|
29
|
+
if (duration > 0) {
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
this.dismiss(id);
|
|
32
|
+
}, duration);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return id;
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* Dismiss a specific toast
|
|
39
|
+
* @param {string} id - Toast ID to dismiss
|
|
40
|
+
*/
|
|
41
|
+
dismiss(id) {
|
|
42
|
+
update(toasts => toasts.filter(t => t.id !== id));
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* Dismiss all toasts
|
|
46
|
+
*/
|
|
47
|
+
dismissAll() {
|
|
48
|
+
update(() => []);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const toastStore = createToastStore();
|
|
@@ -69,6 +69,18 @@
|
|
|
69
69
|
dispatch('itemClick', { item, type: 'file' });
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Handle right-click on an item
|
|
74
|
+
* @param {MouseEvent} e
|
|
75
|
+
* @param {any} item
|
|
76
|
+
* @param {'file' | 'folder'} type
|
|
77
|
+
*/
|
|
78
|
+
function handleItemRightClick(e, item, type) {
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
e.stopPropagation();
|
|
81
|
+
dispatch('itemRightClick', { item, type, originalEvent: e });
|
|
82
|
+
}
|
|
83
|
+
|
|
72
84
|
/**
|
|
73
85
|
* Handle drag start on a file item
|
|
74
86
|
* @param {DragEvent} e
|
|
@@ -246,6 +258,7 @@
|
|
|
246
258
|
class="folder"
|
|
247
259
|
class:drag-over={isDragOver}
|
|
248
260
|
on:click={() => toggle(id, item)}
|
|
261
|
+
on:contextmenu={(e) => handleItemRightClick(e, item, 'folder')}
|
|
249
262
|
on:keydown={() => {}}
|
|
250
263
|
on:dragover={draggable ? (e) => handleDragOver(e, item) : undefined}
|
|
251
264
|
on:dragleave={draggable ? handleDragLeave : undefined}
|
|
@@ -258,6 +271,7 @@
|
|
|
258
271
|
icon={icons.folder}
|
|
259
272
|
actionIcon={icons.icon_expand}
|
|
260
273
|
actionIconSize="15px"
|
|
274
|
+
correctTextOffset={true}
|
|
261
275
|
actionIconRotation={open ? 0 : -90}
|
|
262
276
|
borderRadiusTopLeft={isNested ? '15px' : '25px'}
|
|
263
277
|
borderRadiusTopRight={isNested ? '15px' : '25px'}
|
|
@@ -284,6 +298,7 @@
|
|
|
284
298
|
{draggable}
|
|
285
299
|
currentPath={buildChildPath(item.name)}
|
|
286
300
|
on:itemClick
|
|
301
|
+
on:itemRightClick
|
|
287
302
|
on:itemDrop
|
|
288
303
|
on:dragStart
|
|
289
304
|
/>
|
|
@@ -297,6 +312,7 @@
|
|
|
297
312
|
draggable={draggable}
|
|
298
313
|
on:dragstart={draggable ? (e) => handleDragStart(e, item) : undefined}
|
|
299
314
|
on:click={() => handleItemClick(item)}
|
|
315
|
+
on:contextmenu={(e) => handleItemRightClick(e, item, 'file')}
|
|
300
316
|
on:keydown={() => {}}
|
|
301
317
|
role="button"
|
|
302
318
|
tabindex="0"
|
|
@@ -304,6 +320,7 @@
|
|
|
304
320
|
<Button
|
|
305
321
|
theme={item.variant || VARIANT_SECONDARY}
|
|
306
322
|
icon={itemIcon}
|
|
323
|
+
correctTextOffset={true}
|
|
307
324
|
actionIconSize="15px"
|
|
308
325
|
borderRadiusTopLeft={isNested ? '15px' : '25px'}
|
|
309
326
|
borderRadiusTopRight={isNested ? '15px' : '25px'}
|
|
@@ -341,9 +358,11 @@
|
|
|
341
358
|
opacity: 0.5;
|
|
342
359
|
}
|
|
343
360
|
:global(.suffix-icon) {
|
|
344
|
-
margin-left:
|
|
361
|
+
margin-left: 10px;
|
|
345
362
|
display: inline-flex;
|
|
346
363
|
align-items: center;
|
|
364
|
+
transform: translateY(2px);
|
|
365
|
+
transition: opacity 0.2s ease, transform 0.2s ease;
|
|
347
366
|
}
|
|
348
367
|
.file-item {
|
|
349
368
|
transition: opacity 0.15s ease;
|
|
@@ -20,6 +20,7 @@ type TreeDirectory = SvelteComponent<{
|
|
|
20
20
|
collapseAll?: (() => void) | undefined;
|
|
21
21
|
}, {
|
|
22
22
|
itemClick: CustomEvent<any>;
|
|
23
|
+
itemRightClick: CustomEvent<any>;
|
|
23
24
|
dragStart: CustomEvent<any>;
|
|
24
25
|
itemDrop: CustomEvent<any>;
|
|
25
26
|
} & {
|
|
@@ -53,6 +54,7 @@ declare const TreeDirectory: $$__sveltets_2_IsomorphicComponent<{
|
|
|
53
54
|
collapseAll?: (() => void) | undefined;
|
|
54
55
|
}, {
|
|
55
56
|
itemClick: CustomEvent<any>;
|
|
57
|
+
itemRightClick: CustomEvent<any>;
|
|
56
58
|
dragStart: CustomEvent<any>;
|
|
57
59
|
itemDrop: CustomEvent<any>;
|
|
58
60
|
} & {
|
package/dist/icons.d.ts
CHANGED
package/dist/icons.js
CHANGED
|
@@ -8,4 +8,7 @@ export const icons = {
|
|
|
8
8
|
check: '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.0909 7.54545C14.0909 3.9305 11.1604 1 7.54545 1C3.9305 1 1 3.9305 1 7.54545C1 11.1604 3.9305 14.0909 7.54545 14.0909C11.1604 14.0909 14.0909 11.1604 14.0909 7.54545Z" stroke-width="1.5"/><path d="M5.60596 8.05002L7.28552 9.00003L8.9999 6.09094" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',
|
|
9
9
|
help: '<svg width="14" height="18" viewBox="0 0 14 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7.12598 1C8.80364 1 10.2761 1.41608 11.3467 2.30859C12.441 3.22103 13 4.53608 13 6.07031C13 8.64914 11.1429 9.84464 10.0557 10.5439L10.0498 10.5479C9.59811 10.834 9.28616 11.0529 9.08203 11.2695C8.90303 11.4596 8.86426 11.5868 8.86426 11.7109V12.0938C8.86426 12.2909 8.80556 12.474 8.70703 12.6289C9.12558 13.0883 9.38867 13.687 9.38867 14.3574C9.38856 15.8568 8.05087 17 6.60156 17C5.13309 16.9998 3.81554 15.875 3.81543 14.3574C3.81543 13.7321 4.03654 13.1746 4.39648 12.7324C4.25235 12.5591 4.16504 12.3368 4.16504 12.0938V11.7109C4.16504 9.40212 5.70071 8.25591 6.67773 7.51758C7.09258 7.20371 7.37411 6.98167 7.56445 6.75684C7.72926 6.56215 7.7763 6.42236 7.77637 6.27148C7.77637 5.9518 7.68601 5.82933 7.63672 5.78223C7.58081 5.72894 7.42619 5.62896 7.04883 5.62891C6.69244 5.62891 6.4936 5.74276 6.37793 5.86816C6.25387 6.00289 6.12603 6.25977 6.12598 6.70898C6.12598 7.26127 5.67826 7.70898 5.12598 7.70898H2C1.44772 7.70898 1 7.26127 1 6.70898C1.00007 5.04942 1.6296 3.59897 2.75098 2.57031C3.86552 1.54796 5.40077 1.00005 7.12598 1Z" stroke-width="1.5" stroke-linejoin="round"/></svg>',
|
|
10
10
|
any_ai: '<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6.88735 4.12364C8.03771 0.625957 12.9862 0.625724 14.1366 4.12364C14.5667 5.43135 15.5924 6.45705 16.9001 6.88716L16.9167 6.89268L16.9319 6.89821L17.0299 6.93273L17.0423 6.93688L17.0555 6.94171C20.3467 8.17272 20.3465 12.8508 17.0555 14.0818L17.0251 14.0929L16.9277 14.1267L16.9132 14.1315L16.9001 14.1364C15.5925 14.5665 14.5667 15.5921 14.1366 16.8999C12.9862 20.3975 8.03863 20.3981 6.88804 16.9006L6.88735 16.8999C6.45723 15.5922 5.43157 14.5665 4.12383 14.1364L4.12314 14.1357C0.625653 12.9851 0.626209 8.03752 4.12383 6.88716C5.43159 6.45704 6.45725 5.43121 6.88735 4.12364ZM12.3115 10.161L12.2687 10.1472L12.2279 10.1313L12.143 10.0975L12.1023 10.0816L12.0622 10.0622C11.4966 9.79891 11.06 9.31206 10.8628 8.71224L10.512 7.64467L10.1612 8.71224C9.93579 9.39762 9.39782 9.9356 8.71243 10.161L7.64556 10.5111L8.71243 10.8626L8.83949 10.9081C9.42249 11.139 9.88476 11.6012 10.1156 12.1842L10.1612 12.3113L10.512 13.3775L10.8628 12.3113C11.06 11.7116 11.4966 11.2247 12.0622 10.9613L12.1016 10.9427L12.143 10.9261L12.2279 10.8923L12.2687 10.8764L12.3115 10.8626L13.3784 10.5111L12.3115 10.161Z" stroke-width="3"/></svg>',
|
|
11
|
+
active: '<svg width="13" height="15" viewBox="0 0 13 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 4.00724C1 1.59184 3.70874 0.166494 5.69922 1.53459L10.6387 4.93107C12.3726 6.12312 12.3726 8.68239 10.6387 9.87443L5.69922 13.2709C3.70874 14.639 1 13.2137 1 10.7983V4.00724Z" stroke-width="1.7"/></svg>',
|
|
12
|
+
pause: '<svg width="15" height="14" viewBox="0 0 15 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.8125 3.26984C5.8125 2.01624 4.73519 1 3.40625 1C2.07731 1 1 2.01624 1 3.26984V10.0794C1 11.333 2.07731 12.3492 3.40625 12.3492C4.73519 12.3492 5.8125 11.333 5.8125 10.0794V3.26984Z" stroke-width="1.7"/><path d="M13.25 3.26984C13.25 2.01624 12.1727 1 10.8438 1C9.51481 1 8.4375 2.01624 8.4375 3.26984V10.0794C8.4375 11.333 9.51481 12.3492 10.8438 12.3492C12.1727 12.3492 13.25 11.333 13.25 10.0794V3.26984Z" stroke-width="1.7"/></svg>',
|
|
13
|
+
total: '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.0909 7.54545C14.0909 3.9305 11.1604 1 7.54545 1C3.9305 1 1 3.9305 1 7.54545C1 11.1604 3.9305 14.0909 7.54545 14.0909C11.1604 14.0909 14.0909 11.1604 14.0909 7.54545Z" stroke-width="1.7"/></svg>',
|
|
11
14
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { default as BGChain } from "./Structure/BG/BGChain.svelte";
|
|
|
8
8
|
export { default as BGGears } from "./Structure/BG/BGGears.svelte";
|
|
9
9
|
export { default as Button } from "./Components/Button.svelte";
|
|
10
10
|
export { default as IconButton } from "./Components/IconButton.svelte";
|
|
11
|
+
export { default as LinearList } from "./Components/LinearList.svelte";
|
|
11
12
|
export { default as Separator } from "./Components/Separator.svelte";
|
|
12
13
|
export { default as TreeDirectory } from "./Components/TreeDirectory.svelte";
|
|
13
14
|
export { default as InputBox } from "./Components/InputBox.svelte";
|
|
@@ -17,7 +18,9 @@ export { default as TabBar } from "./Components/TabBar.svelte";
|
|
|
17
18
|
export { default as Dropdown } from "./Components/Dropdown.svelte";
|
|
18
19
|
export { default as ContextMenu } from "./Components/ContextMenu.svelte";
|
|
19
20
|
export { default as Popup } from "./Components/Popup/Popup.svelte";
|
|
20
|
-
export { popupStore } from "./Components/popupStore.js";
|
|
21
|
+
export { popupStore } from "./Components/Popup/popupStore.js";
|
|
22
|
+
export { default as Toast } from "./Components/Toast/Toast.svelte";
|
|
23
|
+
export { toastStore } from "./Components/Toast/toastStore.js";
|
|
21
24
|
export { default as SpecialAction } from "./Components/Special/SpecialAction.svelte";
|
|
22
25
|
export { default as SpecialParagraph } from "./Components/Special/SpecialParagraph.svelte";
|
|
23
26
|
export { default as ConfirmPopup } from "./Components/Popup/ConfirmPopup.svelte";
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export { default as BGGears } from "./Structure/BG/BGGears.svelte";
|
|
|
11
11
|
/* Components */
|
|
12
12
|
export { default as Button } from "./Components/Button.svelte";
|
|
13
13
|
export { default as IconButton } from "./Components/IconButton.svelte";
|
|
14
|
+
export { default as LinearList } from "./Components/LinearList.svelte";
|
|
14
15
|
export { default as Separator } from "./Components/Separator.svelte";
|
|
15
16
|
export { default as TreeDirectory } from "./Components/TreeDirectory.svelte";
|
|
16
17
|
export { default as InputBox } from "./Components/InputBox.svelte";
|
|
@@ -20,7 +21,9 @@ export { default as TabBar } from "./Components/TabBar.svelte";
|
|
|
20
21
|
export { default as Dropdown } from "./Components/Dropdown.svelte";
|
|
21
22
|
export { default as ContextMenu } from "./Components/ContextMenu.svelte";
|
|
22
23
|
export { default as Popup } from "./Components/Popup/Popup.svelte";
|
|
23
|
-
export { popupStore } from "./Components/popupStore.js";
|
|
24
|
+
export { popupStore } from "./Components/Popup/popupStore.js";
|
|
25
|
+
export { default as Toast } from "./Components/Toast/Toast.svelte";
|
|
26
|
+
export { toastStore } from "./Components/Toast/toastStore.js";
|
|
24
27
|
export { default as SpecialAction } from "./Components/Special/SpecialAction.svelte";
|
|
25
28
|
export { default as SpecialParagraph } from "./Components/Special/SpecialParagraph.svelte";
|
|
26
29
|
/* Popup Presets */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coyalabs/bts-style",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
4
4
|
"description": "BTS Theme Svelte component templates",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"!dist/**/*.spec.*"
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
|
-
"package": "svelte-kit sync && svelte-package -o dist",
|
|
22
|
+
"package": "svelte-kit sync && svelte-package -o dist && echo Copying package to node_modules... && xcopy /E /I /Y dist C:\\Users\\Alan\\Documents\\GitHub\\coya-api-backend\\subservice\\subservice_api\\cpaas_frontend\\node_modules\\@coyalabs\\bts-style\\dist && xcopy /E /I /Y public C:\\Users\\Alan\\Documents\\GitHub\\coya-api-backend\\subservice\\subservice_api\\cpaas_frontend\\node_modules\\@coyalabs\\bts-style\\public && copy /Y package.json C:\\Users\\Alan\\Documents\\GitHub\\coya-api-backend\\subservice\\subservice_api\\cpaas_frontend\\node_modules\\@coyalabs\\bts-style\\ && echo Copy complete!",
|
|
23
23
|
"prepublishOnly": "npm run package",
|
|
24
24
|
"release": "npm version patch && npm publish --access public"
|
|
25
25
|
},
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export namespace popupStore {
|
|
2
|
-
export { subscribe };
|
|
3
|
-
export function open(title: any, component: any, props?: {}, subtitle?: string): void;
|
|
4
|
-
export function close(): void;
|
|
5
|
-
export function confirm(title: string, message: string, options?: {
|
|
6
|
-
onConfirm?: (() => void) | undefined;
|
|
7
|
-
onCancel?: (() => void) | undefined;
|
|
8
|
-
confirmText?: string | undefined;
|
|
9
|
-
cancelText?: string | undefined;
|
|
10
|
-
}): void;
|
|
11
|
-
export function alert(title: string, message: string, options?: {
|
|
12
|
-
onOk?: (() => void) | undefined;
|
|
13
|
-
okText?: string | undefined;
|
|
14
|
-
}): void;
|
|
15
|
-
export function prompt(title: string, message: string, options?: {
|
|
16
|
-
onSubmit?: ((value: string) => void) | undefined;
|
|
17
|
-
onCancel?: (() => void) | undefined;
|
|
18
|
-
placeholder?: string | undefined;
|
|
19
|
-
submitText?: string | undefined;
|
|
20
|
-
cancelText?: string | undefined;
|
|
21
|
-
label?: string | undefined;
|
|
22
|
-
}): void;
|
|
23
|
-
}
|
|
24
|
-
declare const subscribe: (this: void, run: import("svelte/store").Subscriber<{
|
|
25
|
-
isOpen: boolean;
|
|
26
|
-
title: string;
|
|
27
|
-
subtitle?: string;
|
|
28
|
-
component: any;
|
|
29
|
-
props: any;
|
|
30
|
-
}>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
|
|
31
|
-
export {};
|