@sveltia/ui 0.2.0 → 0.2.1
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/package/components/composite/calendar.svelte +239 -0
- package/package/components/composite/calendar.svelte.d.ts +27 -0
- package/package/components/composite/checkbox-group.svelte +43 -0
- package/package/components/composite/checkbox-group.svelte.d.ts +34 -0
- package/package/components/composite/combobox.svelte +210 -0
- package/package/components/composite/combobox.svelte.d.ts +47 -0
- package/package/components/composite/disclosure.svelte +60 -0
- package/package/components/composite/disclosure.svelte.d.ts +35 -0
- package/package/components/composite/grid.svelte +24 -0
- package/package/components/composite/grid.svelte.d.ts +31 -0
- package/package/components/composite/listbox.svelte +63 -0
- package/package/components/composite/listbox.svelte.d.ts +52 -0
- package/package/components/composite/menu-item-group.svelte +31 -0
- package/package/components/composite/menu-item-group.svelte.d.ts +33 -0
- package/package/components/composite/menu.svelte +44 -0
- package/package/components/composite/menu.svelte.d.ts +41 -0
- package/package/components/composite/radio-button-group.svelte +45 -0
- package/package/components/composite/radio-button-group.svelte.d.ts +36 -0
- package/package/components/composite/select-button-group.svelte +71 -0
- package/package/components/composite/select-button-group.svelte.d.ts +44 -0
- package/package/components/composite/select.svelte +34 -0
- package/package/components/composite/select.svelte.d.ts +38 -0
- package/package/components/composite/tab-list.svelte +76 -0
- package/package/components/composite/tab-list.svelte.d.ts +55 -0
- package/package/components/core/button.svelte +216 -0
- package/package/components/core/button.svelte.d.ts +109 -0
- package/package/components/core/checkbox.svelte +114 -0
- package/package/components/core/checkbox.svelte.d.ts +45 -0
- package/package/components/core/dialog.svelte +288 -0
- package/package/components/core/dialog.svelte.d.ts +73 -0
- package/package/components/core/drawer.svelte +338 -0
- package/package/components/core/drawer.svelte.d.ts +59 -0
- package/package/components/core/grid-cell.svelte +14 -0
- package/package/components/core/grid-cell.svelte.d.ts +29 -0
- package/package/components/core/group.svelte +31 -0
- package/package/components/core/group.svelte.d.ts +33 -0
- package/package/components/core/icon.svelte +21 -0
- package/package/components/core/icon.svelte.d.ts +27 -0
- package/package/components/core/menu-button.svelte +57 -0
- package/package/components/core/menu-button.svelte.d.ts +46 -0
- package/package/components/core/menu-item-checkbox.svelte +24 -0
- package/package/components/core/menu-item-checkbox.svelte.d.ts +34 -0
- package/package/components/core/menu-item-radio.svelte +19 -0
- package/package/components/core/menu-item-radio.svelte.d.ts +34 -0
- package/package/components/core/menu-item.svelte +113 -0
- package/package/components/core/menu-item.svelte.d.ts +44 -0
- package/package/components/core/number-input.svelte +112 -0
- package/package/components/core/number-input.svelte.d.ts +42 -0
- package/package/components/core/option.svelte +65 -0
- package/package/components/core/option.svelte.d.ts +60 -0
- package/package/components/core/password-input.svelte +81 -0
- package/package/components/core/password-input.svelte.d.ts +36 -0
- package/package/components/core/radio-button.svelte +93 -0
- package/package/components/core/radio-button.svelte.d.ts +37 -0
- package/package/components/core/row-group.svelte +14 -0
- package/package/components/core/row-group.svelte.d.ts +29 -0
- package/package/components/core/row.svelte +14 -0
- package/package/components/core/row.svelte.d.ts +33 -0
- package/package/components/core/search-bar.svelte +91 -0
- package/package/components/core/search-bar.svelte.d.ts +49 -0
- package/package/components/core/select-button.svelte +31 -0
- package/package/components/core/select-button.svelte.d.ts +52 -0
- package/package/components/core/separator.svelte +28 -0
- package/package/components/core/separator.svelte.d.ts +26 -0
- package/package/components/core/slider.svelte +271 -0
- package/package/components/core/slider.svelte.d.ts +51 -0
- package/package/components/core/spacer.svelte +22 -0
- package/package/components/core/spacer.svelte.d.ts +25 -0
- package/package/components/core/switch.svelte +86 -0
- package/package/components/core/switch.svelte.d.ts +37 -0
- package/package/components/core/tab-panel.svelte +23 -0
- package/package/components/core/tab-panel.svelte.d.ts +33 -0
- package/package/components/core/tab.svelte +22 -0
- package/package/components/core/tab.svelte.d.ts +45 -0
- package/package/components/core/text-area.svelte +90 -0
- package/package/components/core/text-area.svelte.d.ts +57 -0
- package/package/components/core/text-input.svelte +146 -0
- package/package/components/core/text-input.svelte.d.ts +71 -0
- package/package/components/core/toolbar.svelte +74 -0
- package/package/components/core/toolbar.svelte.d.ts +35 -0
- package/package/components/editor/markdown.svelte +78 -0
- package/package/components/editor/markdown.svelte.d.ts +25 -0
- package/package/components/helpers/group.d.ts +37 -0
- package/package/components/helpers/group.js +246 -0
- package/package/components/helpers/popup.d.ts +31 -0
- package/package/components/helpers/popup.js +165 -0
- package/package/components/helpers/util.d.ts +1 -0
- package/package/components/helpers/util.js +8 -0
- package/package/components/util/app-shell.svelte +354 -0
- package/package/components/util/app-shell.svelte.d.ts +38 -0
- package/package/components/util/misc.d.ts +2 -0
- package/package/components/util/misc.js +22 -0
- package/package/components/util/popup.svelte +155 -0
- package/package/components/util/popup.svelte.d.ts +53 -0
- package/package/components/util/portal.svelte +34 -0
- package/package/components/util/portal.svelte.d.ts +28 -0
- package/package/index.d.ts +43 -0
- package/package/index.js +66 -0
- package/package/locales/en.d.ts +42 -0
- package/package/locales/en.js +41 -0
- package/package/locales/ja.d.ts +42 -0
- package/package/locales/ja.js +41 -0
- package/package/styles/core.scss +134 -0
- package/package/styles/variables.scss +184 -0
- package/package/typedef.d.ts +0 -0
- package/package/typedef.js +0 -0
- package/package.json +2 -3
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
Provide an application’s shell that makes the web app more like a native app. It also handles the
|
|
4
|
+
dark/light mode switching. This component has to be placed directly under `<body>` (or
|
|
5
|
+
`<div style="display:contents">` in a SvelteKit app).
|
|
6
|
+
-->
|
|
7
|
+
<script>
|
|
8
|
+
import { onMount } from 'svelte';
|
|
9
|
+
|
|
10
|
+
onMount(() => {
|
|
11
|
+
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
12
|
+
const { dataset } = document.documentElement;
|
|
13
|
+
|
|
14
|
+
const applyTheme = () => {
|
|
15
|
+
if (dataset.autoTheming !== 'false') {
|
|
16
|
+
dataset.theme = mediaQuery.matches ? 'dark' : 'light';
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
applyTheme();
|
|
21
|
+
|
|
22
|
+
mediaQuery.onchange = () => {
|
|
23
|
+
applyTheme();
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<div
|
|
29
|
+
class="sui app-shell"
|
|
30
|
+
on:dragover|preventDefault
|
|
31
|
+
on:drop|preventDefault
|
|
32
|
+
on:contextmenu={(event) => {
|
|
33
|
+
// Disable the native context menu
|
|
34
|
+
if (!event.target?.matches('input[type="text"], textarea')) {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
}
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
<slot />
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<style global>@import url("https://fonts.googleapis.com/css2?family=Merriweather+Sans:ital,wght@0,300;0,600;1,300&family=Noto+Sans+Mono&display=swap");
|
|
43
|
+
@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=block");
|
|
44
|
+
:global(:root[data-theme=light]) {
|
|
45
|
+
--foreground-color-1-hsl: var(--base-hue) 5% 0%;
|
|
46
|
+
--foreground-color-2-hsl: var(--base-hue) 5% 20%;
|
|
47
|
+
--foreground-color-3-hsl: var(--base-hue) 5% 40%;
|
|
48
|
+
--foreground-color-4-hsl: var(--base-hue) 5% 60%;
|
|
49
|
+
--border-color-1-hsl: var(--base-hue) 5% 75%;
|
|
50
|
+
--border-color-2-hsl: var(--base-hue) 5% 80%;
|
|
51
|
+
--background-color-1-hsl: var(--base-hue) 5% 100%;
|
|
52
|
+
--background-color-2-hsl: var(--base-hue) 5% 98%;
|
|
53
|
+
--background-color-3-hsl: var(--base-hue) 5% 94%;
|
|
54
|
+
--background-color-4-hsl: var(--base-hue) 5% 90%;
|
|
55
|
+
--background-color-5-hsl: var(--base-hue) 5% 86%;
|
|
56
|
+
--shadow-color: var(--base-hue) 10% 0%;
|
|
57
|
+
--primary-accent-color: hsl(var(--base-hue) 80% 45%);
|
|
58
|
+
--primary-accent-color-lighter: hsl(var(--base-hue) 80% 40%);
|
|
59
|
+
--primary-accent-color-darker: hsl(var(--base-hue) 80% 50%);
|
|
60
|
+
--primary-accent-color-foreground: hsl(var(--base-hue) 10% 100%);
|
|
61
|
+
--danger-color-hue: 0;
|
|
62
|
+
--warning-color-hue: 40;
|
|
63
|
+
--success-color-hue: 100;
|
|
64
|
+
--info-color-hue: 220;
|
|
65
|
+
--alert-foreground-color-saturation: 88%;
|
|
66
|
+
--alert-foreground-color-lightness: 28%;
|
|
67
|
+
--alert-background-color-saturation: 68%;
|
|
68
|
+
--alert-background-color-lightness: 88%;
|
|
69
|
+
--alert-border-color-saturation: 48%;
|
|
70
|
+
--alert-border-color-lightness: 68%;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
:global(:root[data-theme=dark]) {
|
|
74
|
+
--foreground-color-1-hsl: var(--base-hue) 10% 100%;
|
|
75
|
+
--foreground-color-2-hsl: var(--base-hue) 10% 80%;
|
|
76
|
+
--foreground-color-3-hsl: var(--base-hue) 10% 60%;
|
|
77
|
+
--foreground-color-4-hsl: var(--base-hue) 10% 40%;
|
|
78
|
+
--border-color-1-hsl: var(--base-hue) 10% 25%;
|
|
79
|
+
--border-color-2-hsl: var(--base-hue) 10% 20%;
|
|
80
|
+
--background-color-1-hsl: var(--base-hue) 10% 10%;
|
|
81
|
+
--background-color-2-hsl: var(--base-hue) 10% 12%;
|
|
82
|
+
--background-color-3-hsl: var(--base-hue) 10% 16%;
|
|
83
|
+
--background-color-4-hsl: var(--base-hue) 10% 20%;
|
|
84
|
+
--background-color-5-hsl: var(--base-hue) 10% 24%;
|
|
85
|
+
--shadow-color: var(--base-hue) 10% 0%;
|
|
86
|
+
--primary-accent-color: hsl(var(--base-hue) 100% 45%);
|
|
87
|
+
--primary-accent-color-lighter: hsl(var(--base-hue) 100% 55%);
|
|
88
|
+
--primary-accent-color-darker: hsl(var(--base-hue) 100% 35%);
|
|
89
|
+
--primary-accent-color-foreground: hsl(var(--base-hue) 10% 100%);
|
|
90
|
+
--danger-color-hue: 0;
|
|
91
|
+
--warning-color-hue: 40;
|
|
92
|
+
--success-color-hue: 100;
|
|
93
|
+
--info-color-hue: 220;
|
|
94
|
+
--alert-foreground-color-saturation: 48%;
|
|
95
|
+
--alert-foreground-color-lightness: 68%;
|
|
96
|
+
--alert-background-color-saturation: 88%;
|
|
97
|
+
--alert-background-color-lightness: 8%;
|
|
98
|
+
--alert-border-color-saturation: 38%;
|
|
99
|
+
--alert-border-color-lightness: 18%;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
:global(:root) {
|
|
103
|
+
--base-hue: 210;
|
|
104
|
+
--highlight-foreground-color: hsl(var(--foreground-color-1-hsl));
|
|
105
|
+
--primary-foreground-color: hsl(var(--foreground-color-2-hsl));
|
|
106
|
+
--secondary-foreground-color: hsl(var(--foreground-color-3-hsl));
|
|
107
|
+
--tertiary-foreground-color: hsl(var(--foreground-color-3-hsl));
|
|
108
|
+
--disabled-foreground-color: hsl(var(--foreground-color-4-hsl));
|
|
109
|
+
--danger-foreground-color: hsl(
|
|
110
|
+
var(--danger-color-hue) var(--alert-foreground-color-saturation)
|
|
111
|
+
var(--alert-foreground-color-lightness)
|
|
112
|
+
);
|
|
113
|
+
--warning-foreground-color: hsl(
|
|
114
|
+
var(--warning-color-hue) var(--alert-foreground-color-saturation)
|
|
115
|
+
var(--alert-foreground-color-lightness)
|
|
116
|
+
);
|
|
117
|
+
--success-foreground-color: hsl(
|
|
118
|
+
var(--success-color-hue) var(--alert-foreground-color-saturation)
|
|
119
|
+
var(--alert-foreground-color-lightness)
|
|
120
|
+
);
|
|
121
|
+
--info-foreground-color: hsl(
|
|
122
|
+
var(--info-color-hue) var(--alert-foreground-color-saturation)
|
|
123
|
+
var(--alert-foreground-color-lightness)
|
|
124
|
+
);
|
|
125
|
+
--highlight-background-color: hsl(var(--background-color-5-hsl));
|
|
126
|
+
--content-background-color: hsl(var(--background-color-1-hsl));
|
|
127
|
+
--primary-background-color: hsl(var(--background-color-2-hsl));
|
|
128
|
+
--primary-background-color-translucent: hsl(var(--background-color-2-hsl) / 80%);
|
|
129
|
+
--secondary-background-color: hsl(var(--background-color-3-hsl));
|
|
130
|
+
--secondary-background-color-translucent: hsl(var(--background-color-3-hsl) / 80%);
|
|
131
|
+
--tertiary-background-color: hsl(var(--background-color-4-hsl));
|
|
132
|
+
--tertiary-background-color-translucent: hsl(var(--background-color-4-hsl) / 80%);
|
|
133
|
+
--control-background-color: hsl(var(--background-color-1-hsl));
|
|
134
|
+
--disabled-background-color: hsl(var(--background-color-4-hsl));
|
|
135
|
+
--danger-background-color: hsl(
|
|
136
|
+
var(--danger-color-hue) var(--alert-background-color-saturation)
|
|
137
|
+
var(--alert-background-color-lightness)
|
|
138
|
+
);
|
|
139
|
+
--warning-background-color: hsl(
|
|
140
|
+
var(--warning-color-hue) var(--alert-background-color-saturation)
|
|
141
|
+
var(--alert-background-color-lightness)
|
|
142
|
+
);
|
|
143
|
+
--success-background-color: hsl(
|
|
144
|
+
var(--success-color-hue) var(--alert-background-color-saturation)
|
|
145
|
+
var(--alert-background-color-lightness)
|
|
146
|
+
);
|
|
147
|
+
--info-background-color: hsl(
|
|
148
|
+
var(--info-color-hue) var(--alert-background-color-saturation)
|
|
149
|
+
var(--alert-background-color-lightness)
|
|
150
|
+
);
|
|
151
|
+
--primary-border-color: hsl(var(--border-color-1-hsl));
|
|
152
|
+
--secondary-border-color: hsl(var(--border-color-2-hsl));
|
|
153
|
+
--control-border-color: hsl(var(--border-color-2-hsl));
|
|
154
|
+
--danger-border-color: hsl(
|
|
155
|
+
var(--danger-color-hue) var(--alert-border-color-saturation) var(--alert-border-color-lightness)
|
|
156
|
+
);
|
|
157
|
+
--warning-border-color: hsl(
|
|
158
|
+
var(--warning-color-hue) var(--alert-border-color-saturation)
|
|
159
|
+
var(--alert-border-color-lightness)
|
|
160
|
+
);
|
|
161
|
+
--success-border-color: hsl(
|
|
162
|
+
var(--success-color-hue) var(--alert-border-color-saturation)
|
|
163
|
+
var(--alert-border-color-lightness)
|
|
164
|
+
);
|
|
165
|
+
--info-border-color: hsl(
|
|
166
|
+
var(--info-color-hue) var(--alert-border-color-saturation) var(--alert-border-color-lightness)
|
|
167
|
+
);
|
|
168
|
+
--popup-shadow-color: hsl(var(--shadow-color) / 40%);
|
|
169
|
+
--popup-backdrop-color: hsl(var(--shadow-color) / 40%);
|
|
170
|
+
--font-family--default: "Merriweather Sans", sans-serif;
|
|
171
|
+
--font-size--xxx-large: 24px;
|
|
172
|
+
--font-size--xx-large: 20px;
|
|
173
|
+
--font-size--x-large: 18px;
|
|
174
|
+
--font-size--large: 16px;
|
|
175
|
+
--font-size--default: 14px;
|
|
176
|
+
--font-size--small: 12px;
|
|
177
|
+
--font-size--x-small: 10px;
|
|
178
|
+
--font-weight--normal: 300;
|
|
179
|
+
--font-weight--bold: 600;
|
|
180
|
+
--font-family--monospace: "Noto Sans Mono", monospace;
|
|
181
|
+
--font-size--monospace: 13px;
|
|
182
|
+
--control--small--border-width: 1px;
|
|
183
|
+
--control--small--border-radius: 2px;
|
|
184
|
+
--control--small--height: 24px;
|
|
185
|
+
--control--medium--border-width: 1px;
|
|
186
|
+
--control--medium--border-radius: 4px;
|
|
187
|
+
--control--medium--height: 32px;
|
|
188
|
+
--control--large--border-width: 1px;
|
|
189
|
+
--control--large--border-radius: 8px;
|
|
190
|
+
--control--large--height: 40px;
|
|
191
|
+
--button--small--border-radius: var(--control--small--border-radius);
|
|
192
|
+
--button--small--height: var(--control--small--height);
|
|
193
|
+
--button--medium--border-radius: var(--control--medium--border-radius);
|
|
194
|
+
--button--medium--height: var(--control--medium--height);
|
|
195
|
+
--button--large--border-radius: var(--control--large--border-radius);
|
|
196
|
+
--button--large--height: var(--control--large--height);
|
|
197
|
+
--option--small--border-radius: var(--control--small--border-radius);
|
|
198
|
+
--option--small--height: var(--control--small--height);
|
|
199
|
+
--option--medium--border-radius: var(--control--medium--border-radius);
|
|
200
|
+
--option--medium--height: var(--control--medium--height);
|
|
201
|
+
--option--large--border-radius: var(--control--large--border-radius);
|
|
202
|
+
--option--large--height: var(--control--large--height);
|
|
203
|
+
--input--small--border-radius: var(--control--small--border-radius);
|
|
204
|
+
--input--small--height: var(--control--small--height);
|
|
205
|
+
--input--medium--border-radius: var(--control--medium--border-radius);
|
|
206
|
+
--input--medium--height: var(--control--medium--height);
|
|
207
|
+
--input--large--border-radius: var(--control--large--border-radius);
|
|
208
|
+
--input--large--height: var(--control--large--height);
|
|
209
|
+
--tab--small--height: var(--control--small--height);
|
|
210
|
+
--tab--medium--height: var(--control--medium--height);
|
|
211
|
+
--tab--large--height: var(--control--large--height);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
:global(.material-symbols-outlined) {
|
|
215
|
+
font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 24;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
:global(*) {
|
|
219
|
+
scroll-behavior: smooth;
|
|
220
|
+
box-sizing: border-box;
|
|
221
|
+
border-width: 0;
|
|
222
|
+
border-style: solid;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
:global(:focus) {
|
|
226
|
+
z-index: 1;
|
|
227
|
+
outline-width: 0;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
:global(:focus-visible) {
|
|
231
|
+
outline-offset: -2px;
|
|
232
|
+
outline-width: 2px !important;
|
|
233
|
+
outline-style: solid;
|
|
234
|
+
outline-color: hsl(var(--hue), 100%, 50%, 25%);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
:global(h1),
|
|
238
|
+
:global(h2),
|
|
239
|
+
:global(h3),
|
|
240
|
+
:global(h4),
|
|
241
|
+
:global(h5),
|
|
242
|
+
:global(h6) {
|
|
243
|
+
margin: 0;
|
|
244
|
+
font-weight: var(--font-weight--bold);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
:global(strong) {
|
|
248
|
+
font-weight: var(--font-weight--bold);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
:global(a) {
|
|
252
|
+
color: var(--primary-accent-color-lighter);
|
|
253
|
+
text-decoration: none;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
:global(img),
|
|
257
|
+
:global(svg),
|
|
258
|
+
:global(iframe) {
|
|
259
|
+
vertical-align: top;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
:global(button),
|
|
263
|
+
:global(input),
|
|
264
|
+
:global(textarea),
|
|
265
|
+
:global(select),
|
|
266
|
+
:global(option) {
|
|
267
|
+
font-family: inherit;
|
|
268
|
+
font-size: inherit;
|
|
269
|
+
color: inherit;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
:global(p),
|
|
273
|
+
:global(li) {
|
|
274
|
+
line-height: 1.75;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
:global([role=grid]) {
|
|
278
|
+
display: table;
|
|
279
|
+
width: 100%;
|
|
280
|
+
}
|
|
281
|
+
:global([role=grid]) :global(.colgroup) {
|
|
282
|
+
display: table-column-group;
|
|
283
|
+
}
|
|
284
|
+
:global([role=grid]) :global(.colgroup) :global(.col) {
|
|
285
|
+
display: table-column;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
:global(code),
|
|
289
|
+
:global(pre) {
|
|
290
|
+
font-family: var(--font-family--monospace);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
:global(pre) {
|
|
294
|
+
line-height: 1.5;
|
|
295
|
+
-webkit-user-select: text;
|
|
296
|
+
user-select: text;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
:global(dialog) {
|
|
300
|
+
position: fixed;
|
|
301
|
+
inset: 0;
|
|
302
|
+
outline: 0;
|
|
303
|
+
margin: 0;
|
|
304
|
+
border: 0;
|
|
305
|
+
padding: 0;
|
|
306
|
+
width: 100%;
|
|
307
|
+
max-width: 100%;
|
|
308
|
+
height: 100%;
|
|
309
|
+
max-height: 100%;
|
|
310
|
+
color: inherit;
|
|
311
|
+
background: transparent;
|
|
312
|
+
-webkit-user-select: none;
|
|
313
|
+
user-select: none;
|
|
314
|
+
touch-action: none;
|
|
315
|
+
cursor: default;
|
|
316
|
+
}
|
|
317
|
+
:global(dialog::backdrop) {
|
|
318
|
+
background: transparent;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
:global(.thead[role=rowgroup]) {
|
|
322
|
+
display: table-header-group;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
:global(.tbody[role=rowgroup]) {
|
|
326
|
+
display: table-row-group;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
:global([role=row]) {
|
|
330
|
+
display: table-row;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
:global([role=columnheader]),
|
|
334
|
+
:global([role=gridcell]) {
|
|
335
|
+
display: table-cell;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
:global(.app-shell) {
|
|
339
|
+
position: fixed;
|
|
340
|
+
inset: 0;
|
|
341
|
+
overflow: hidden;
|
|
342
|
+
width: 100%;
|
|
343
|
+
height: 100%;
|
|
344
|
+
color: var(--primary-foreground-color);
|
|
345
|
+
background-color: var(--primary-background-color);
|
|
346
|
+
font-family: var(--font-family--default);
|
|
347
|
+
font-size: var(--font-size--default);
|
|
348
|
+
font-weight: var(--font-weight--normal);
|
|
349
|
+
-webkit-user-select: none;
|
|
350
|
+
user-select: none;
|
|
351
|
+
touch-action: none;
|
|
352
|
+
overflow-anchor: none;
|
|
353
|
+
cursor: default;
|
|
354
|
+
}</style>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} AppShellProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} AppShellEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} AppShellSlots */
|
|
4
|
+
/**
|
|
5
|
+
* Provide an application’s shell that makes the web app more like a native app. It also handles the
|
|
6
|
+
* dark/light mode switching. This component has to be placed directly under `<body>` (or
|
|
7
|
+
* `<div style="display:contents">` in a SvelteKit app).
|
|
8
|
+
*/
|
|
9
|
+
export default class AppShell extends SvelteComponentTyped<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
dragover: DragEvent;
|
|
13
|
+
drop: DragEvent;
|
|
14
|
+
} & {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {
|
|
17
|
+
default: {};
|
|
18
|
+
}> {
|
|
19
|
+
}
|
|
20
|
+
export type AppShellProps = typeof __propDef.props;
|
|
21
|
+
export type AppShellEvents = typeof __propDef.events;
|
|
22
|
+
export type AppShellSlots = typeof __propDef.slots;
|
|
23
|
+
import { SvelteComponentTyped } from "svelte";
|
|
24
|
+
declare const __propDef: {
|
|
25
|
+
props: {
|
|
26
|
+
[x: string]: never;
|
|
27
|
+
};
|
|
28
|
+
events: {
|
|
29
|
+
dragover: DragEvent;
|
|
30
|
+
drop: DragEvent;
|
|
31
|
+
} & {
|
|
32
|
+
[evt: string]: CustomEvent<any>;
|
|
33
|
+
};
|
|
34
|
+
slots: {
|
|
35
|
+
default: {};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if the given input is a simple object.
|
|
3
|
+
*
|
|
4
|
+
* @param {*} input Input, probably an object.
|
|
5
|
+
* @returns {boolean} Result.
|
|
6
|
+
*/
|
|
7
|
+
export const isObject = (input) =>
|
|
8
|
+
input !== null && typeof input === 'object' && !Array.isArray(input);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Return a simple `Promise` to resolve in the given time, making it easier to wait for a bit in the
|
|
12
|
+
* code, particularly while making sequential HTTP requests.
|
|
13
|
+
*
|
|
14
|
+
* @param {number} [ms] Milliseconds to wait.
|
|
15
|
+
* @returns {Promise} Nothing.
|
|
16
|
+
*/
|
|
17
|
+
export const sleep = (ms = 1000) =>
|
|
18
|
+
new Promise((resolve) => {
|
|
19
|
+
window.setTimeout(() => {
|
|
20
|
+
resolve();
|
|
21
|
+
}, ms);
|
|
22
|
+
});
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
Generic popup helper.
|
|
4
|
+
-->
|
|
5
|
+
<svelte:options accessors={true} />
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import { onMount } from 'svelte';
|
|
9
|
+
import { writable } from 'svelte/store';
|
|
10
|
+
import { activatePopup } from '../helpers/popup';
|
|
11
|
+
|
|
12
|
+
/** @type {(HTMLElement|undefined)} */
|
|
13
|
+
export let anchor = undefined;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Reference to the popup element.
|
|
17
|
+
* @type {(HTMLElement|undefined)}
|
|
18
|
+
*/
|
|
19
|
+
export let dialog = undefined;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Reference to the content element.
|
|
23
|
+
* @type {(HTMLElement|undefined)}
|
|
24
|
+
*/
|
|
25
|
+
export let content = undefined;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Where to show the dropdown menu.
|
|
29
|
+
* @type {PopupPosition}
|
|
30
|
+
*/
|
|
31
|
+
export let position = 'bottom-left';
|
|
32
|
+
|
|
33
|
+
export let open = writable(false);
|
|
34
|
+
|
|
35
|
+
let showDialog = false;
|
|
36
|
+
let showContent = false;
|
|
37
|
+
let contentType;
|
|
38
|
+
|
|
39
|
+
let style = writable({
|
|
40
|
+
inset: undefined,
|
|
41
|
+
zIndex: undefined,
|
|
42
|
+
width: undefined,
|
|
43
|
+
height: undefined,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
$: {
|
|
47
|
+
if (anchor && dialog) {
|
|
48
|
+
({ open, style } = activatePopup(anchor, dialog, position));
|
|
49
|
+
contentType = anchor.getAttribute('aria-haspopup');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const openDialog = () => {
|
|
54
|
+
(document.querySelector('.sui.app-shell') || document.body).appendChild(dialog);
|
|
55
|
+
showContent = true;
|
|
56
|
+
dialog.showModal();
|
|
57
|
+
|
|
58
|
+
window.requestAnimationFrame(() => {
|
|
59
|
+
showDialog = true;
|
|
60
|
+
|
|
61
|
+
window.requestAnimationFrame(() => {
|
|
62
|
+
(dialog.querySelector('[tabindex]') || dialog).focus();
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const closeDialog = async () => {
|
|
68
|
+
showDialog = false;
|
|
69
|
+
|
|
70
|
+
await new Promise((resolve) => {
|
|
71
|
+
content.addEventListener('transitionend', () => resolve(), { once: true });
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
showContent = false;
|
|
75
|
+
dialog?.close();
|
|
76
|
+
dialog?.remove();
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const toggleDialog = () => {
|
|
80
|
+
if (dialog) {
|
|
81
|
+
if ($open) {
|
|
82
|
+
openDialog();
|
|
83
|
+
} else {
|
|
84
|
+
closeDialog();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// Call the function only when the `$open` prop is changed
|
|
90
|
+
$: toggleDialog($open);
|
|
91
|
+
|
|
92
|
+
onMount(() => {
|
|
93
|
+
dialog.remove();
|
|
94
|
+
|
|
95
|
+
// onUnmount
|
|
96
|
+
return () => {
|
|
97
|
+
dialog?.close();
|
|
98
|
+
dialog?.remove();
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<dialog class="sui popup" bind:this={dialog} class:open={showDialog} {...$$restProps}>
|
|
104
|
+
<div
|
|
105
|
+
bind:this={content}
|
|
106
|
+
class="content {contentType}"
|
|
107
|
+
style:inset={$style.inset}
|
|
108
|
+
style:z-index={$style.zIndex}
|
|
109
|
+
style:min-width={$style.width}
|
|
110
|
+
style:max-height={$style.height}
|
|
111
|
+
>
|
|
112
|
+
{#if showContent}
|
|
113
|
+
<slot />
|
|
114
|
+
{/if}
|
|
115
|
+
</div>
|
|
116
|
+
</dialog>
|
|
117
|
+
|
|
118
|
+
<style>.popup.open .content {
|
|
119
|
+
opacity: 1;
|
|
120
|
+
transform: translateY(2px);
|
|
121
|
+
transition-duration: 100ms;
|
|
122
|
+
}
|
|
123
|
+
.popup:not(.open) {
|
|
124
|
+
pointer-events: none;
|
|
125
|
+
}
|
|
126
|
+
.popup:not(.open) .content {
|
|
127
|
+
opacity: 0;
|
|
128
|
+
transform: translateY(-8px);
|
|
129
|
+
pointer-events: none;
|
|
130
|
+
transition-duration: 200ms;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.content {
|
|
134
|
+
position: fixed;
|
|
135
|
+
overflow-y: auto;
|
|
136
|
+
outline-width: 0 !important;
|
|
137
|
+
color: var(--primary-foreground-color);
|
|
138
|
+
background-color: var(--secondary-background-color-translucent);
|
|
139
|
+
backdrop-filter: blur(16px);
|
|
140
|
+
box-shadow: 0 8px 16px var(--popup-shadow-color);
|
|
141
|
+
will-change: opacity, transform;
|
|
142
|
+
transition-property: opacity, transform;
|
|
143
|
+
}
|
|
144
|
+
.content.listbox, .content.menu {
|
|
145
|
+
border-width: 1px;
|
|
146
|
+
border-style: solid;
|
|
147
|
+
border-color: var(--secondary-border-color);
|
|
148
|
+
border-radius: 4px;
|
|
149
|
+
}
|
|
150
|
+
.content.listbox :global(.sui.listbox),
|
|
151
|
+
.content.listbox :global(.sui.menu), .content.menu :global(.sui.listbox),
|
|
152
|
+
.content.menu :global(.sui.menu) {
|
|
153
|
+
border-width: 0;
|
|
154
|
+
border-radius: 0;
|
|
155
|
+
}</style>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} PopupProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} PopupEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} PopupSlots */
|
|
4
|
+
/** Generic popup helper. */
|
|
5
|
+
export default class Popup extends SvelteComponentTyped<{
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
dialog?: HTMLElement;
|
|
8
|
+
position?: any;
|
|
9
|
+
anchor?: HTMLElement;
|
|
10
|
+
content?: HTMLElement;
|
|
11
|
+
open?: import("svelte/store").Writable<boolean>;
|
|
12
|
+
}, {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
}, {
|
|
15
|
+
default: {};
|
|
16
|
+
}> {
|
|
17
|
+
/**accessor*/
|
|
18
|
+
set anchor(arg: HTMLElement);
|
|
19
|
+
get anchor(): HTMLElement;
|
|
20
|
+
/**accessor*/
|
|
21
|
+
set dialog(arg: HTMLElement);
|
|
22
|
+
get dialog(): HTMLElement;
|
|
23
|
+
/**accessor*/
|
|
24
|
+
set content(arg: HTMLElement);
|
|
25
|
+
get content(): HTMLElement;
|
|
26
|
+
/**accessor*/
|
|
27
|
+
set position(arg: any);
|
|
28
|
+
get position(): any;
|
|
29
|
+
/**accessor*/
|
|
30
|
+
set open(arg: import("svelte/store").Writable<boolean>);
|
|
31
|
+
get open(): import("svelte/store").Writable<boolean>;
|
|
32
|
+
}
|
|
33
|
+
export type PopupProps = typeof __propDef.props;
|
|
34
|
+
export type PopupEvents = typeof __propDef.events;
|
|
35
|
+
export type PopupSlots = typeof __propDef.slots;
|
|
36
|
+
import { SvelteComponentTyped } from "svelte";
|
|
37
|
+
declare const __propDef: {
|
|
38
|
+
props: {
|
|
39
|
+
[x: string]: any;
|
|
40
|
+
dialog?: (HTMLElement | undefined);
|
|
41
|
+
position?: any;
|
|
42
|
+
anchor?: (HTMLElement | undefined);
|
|
43
|
+
content?: (HTMLElement | undefined);
|
|
44
|
+
open?: import("svelte/store").Writable<boolean>;
|
|
45
|
+
};
|
|
46
|
+
events: {
|
|
47
|
+
[evt: string]: CustomEvent<any>;
|
|
48
|
+
};
|
|
49
|
+
slots: {
|
|
50
|
+
default: {};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
@see https://github.com/sveltejs/svelte/issues/3088
|
|
4
|
+
-->
|
|
5
|
+
<script>
|
|
6
|
+
import { onDestroy, onMount } from 'svelte';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* CSS class name on the button.
|
|
10
|
+
* @type {String}
|
|
11
|
+
*/
|
|
12
|
+
let className = '';
|
|
13
|
+
|
|
14
|
+
export { className as class };
|
|
15
|
+
|
|
16
|
+
/** @type {HTMLElement} */
|
|
17
|
+
let ref;
|
|
18
|
+
|
|
19
|
+
onMount(() => {
|
|
20
|
+
document.body.appendChild(ref);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
onDestroy(() => {
|
|
24
|
+
ref.remove();
|
|
25
|
+
});
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<div class="sui portal {className}" bind:this={ref}>
|
|
29
|
+
<slot />
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<style>.portal {
|
|
33
|
+
display: contents;
|
|
34
|
+
}</style>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} PortalProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} PortalEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} PortalSlots */
|
|
4
|
+
/** @see https://github.com/sveltejs/svelte/issues/3088 */
|
|
5
|
+
export default class Portal extends SvelteComponentTyped<{
|
|
6
|
+
class?: string;
|
|
7
|
+
}, {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
}, {
|
|
10
|
+
default: {};
|
|
11
|
+
}> {
|
|
12
|
+
}
|
|
13
|
+
export type PortalProps = typeof __propDef.props;
|
|
14
|
+
export type PortalEvents = typeof __propDef.events;
|
|
15
|
+
export type PortalSlots = typeof __propDef.slots;
|
|
16
|
+
import { SvelteComponentTyped } from "svelte";
|
|
17
|
+
declare const __propDef: {
|
|
18
|
+
props: {
|
|
19
|
+
class?: string;
|
|
20
|
+
};
|
|
21
|
+
events: {
|
|
22
|
+
[evt: string]: CustomEvent<any>;
|
|
23
|
+
};
|
|
24
|
+
slots: {
|
|
25
|
+
default: {};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export {};
|