@sveltia/ui 0.1.4 → 0.2.0
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.json +23 -12
- package/package/components/composite/calendar.svelte +0 -240
- package/package/components/composite/calendar.svelte.d.ts +0 -20
- package/package/components/composite/checkbox-group.svelte +0 -43
- package/package/components/composite/checkbox-group.svelte.d.ts +0 -24
- package/package/components/composite/combobox.svelte +0 -197
- package/package/components/composite/combobox.svelte.d.ts +0 -32
- package/package/components/composite/disclosure.svelte +0 -60
- package/package/components/composite/disclosure.svelte.d.ts +0 -26
- package/package/components/composite/grid.svelte +0 -24
- package/package/components/composite/grid.svelte.d.ts +0 -22
- package/package/components/composite/listbox.svelte +0 -63
- package/package/components/composite/listbox.svelte.d.ts +0 -39
- package/package/components/composite/menu-item-group.svelte +0 -31
- package/package/components/composite/menu-item-group.svelte.d.ts +0 -23
- package/package/components/composite/menu.svelte +0 -44
- package/package/components/composite/menu.svelte.d.ts +0 -32
- package/package/components/composite/radio-button-group.svelte +0 -45
- package/package/components/composite/radio-button-group.svelte.d.ts +0 -27
- package/package/components/composite/select-button-group.svelte +0 -70
- package/package/components/composite/select-button-group.svelte.d.ts +0 -31
- package/package/components/composite/select.svelte +0 -34
- package/package/components/composite/select.svelte.d.ts +0 -26
- package/package/components/composite/tab-list.svelte +0 -76
- package/package/components/composite/tab-list.svelte.d.ts +0 -42
- package/package/components/core/button.svelte +0 -205
- package/package/components/core/button.svelte.d.ts +0 -78
- package/package/components/core/checkbox.svelte +0 -107
- package/package/components/core/checkbox.svelte.d.ts +0 -30
- package/package/components/core/dialog.svelte +0 -274
- package/package/components/core/dialog.svelte.d.ts +0 -45
- package/package/components/core/grid-cell.svelte +0 -14
- package/package/components/core/grid-cell.svelte.d.ts +0 -21
- package/package/components/core/group.svelte +0 -31
- package/package/components/core/group.svelte.d.ts +0 -23
- package/package/components/core/icon.svelte +0 -21
- package/package/components/core/icon.svelte.d.ts +0 -20
- package/package/components/core/menu-button.svelte +0 -57
- package/package/components/core/menu-button.svelte.d.ts +0 -30
- package/package/components/core/menu-item-checkbox.svelte +0 -24
- package/package/components/core/menu-item-checkbox.svelte.d.ts +0 -24
- package/package/components/core/menu-item-radio.svelte +0 -19
- package/package/components/core/menu-item-radio.svelte.d.ts +0 -24
- package/package/components/core/menu-item.svelte +0 -113
- package/package/components/core/menu-item.svelte.d.ts +0 -29
- package/package/components/core/number-input.svelte +0 -112
- package/package/components/core/number-input.svelte.d.ts +0 -28
- package/package/components/core/option.svelte +0 -59
- package/package/components/core/option.svelte.d.ts +0 -35
- package/package/components/core/password-input.svelte +0 -81
- package/package/components/core/password-input.svelte.d.ts +0 -25
- package/package/components/core/radio-button.svelte +0 -93
- package/package/components/core/radio-button.svelte.d.ts +0 -27
- package/package/components/core/row-group.svelte +0 -14
- package/package/components/core/row-group.svelte.d.ts +0 -21
- package/package/components/core/row.svelte +0 -14
- package/package/components/core/row.svelte.d.ts +0 -23
- package/package/components/core/search-bar.svelte +0 -90
- package/package/components/core/search-bar.svelte.d.ts +0 -35
- package/package/components/core/select-button.svelte +0 -31
- package/package/components/core/select-button.svelte.d.ts +0 -35
- package/package/components/core/separator.svelte +0 -28
- package/package/components/core/separator.svelte.d.ts +0 -20
- package/package/components/core/slider.svelte +0 -270
- package/package/components/core/slider.svelte.d.ts +0 -35
- package/package/components/core/spacer.svelte +0 -22
- package/package/components/core/spacer.svelte.d.ts +0 -19
- package/package/components/core/switch.svelte +0 -80
- package/package/components/core/switch.svelte.d.ts +0 -27
- package/package/components/core/tab-panel.svelte +0 -23
- package/package/components/core/tab-panel.svelte.d.ts +0 -25
- package/package/components/core/tab.svelte +0 -22
- package/package/components/core/tab.svelte.d.ts +0 -31
- package/package/components/core/text-area.svelte +0 -90
- package/package/components/core/text-area.svelte.d.ts +0 -43
- package/package/components/core/text-input.svelte +0 -145
- package/package/components/core/text-input.svelte.d.ts +0 -53
- package/package/components/core/toolbar.svelte +0 -74
- package/package/components/core/toolbar.svelte.d.ts +0 -26
- package/package/components/editor/markdown.svelte +0 -78
- package/package/components/editor/markdown.svelte.d.ts +0 -19
- package/package/components/helpers/group.d.ts +0 -37
- package/package/components/helpers/group.js +0 -246
- package/package/components/helpers/popup.d.ts +0 -26
- package/package/components/helpers/popup.js +0 -146
- package/package/components/helpers/util.d.ts +0 -1
- package/package/components/helpers/util.js +0 -8
- package/package/components/util/app-shell.svelte +0 -284
- package/package/components/util/app-shell.svelte.d.ts +0 -28
- package/package/components/util/misc.d.ts +0 -2
- package/package/components/util/misc.js +0 -22
- package/package/components/util/popup.svelte +0 -131
- package/package/components/util/popup.svelte.d.ts +0 -37
- package/package/components/util/portal.svelte +0 -34
- package/package/components/util/portal.svelte.d.ts +0 -21
- package/package/index.d.ts +0 -41
- package/package/index.js +0 -66
- package/package/locales/en.d.ts +0 -42
- package/package/locales/en.js +0 -41
- package/package/locales/ja.d.ts +0 -42
- package/package/locales/ja.js +0 -41
- package/package/styles/core.scss +0 -134
- package/package/styles/variables.scss +0 -114
- package/package/typedef.d.ts +0 -0
- package/package/typedef.js +0 -0
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
/* eslint-disable no-nested-ternary */
|
|
3
|
-
|
|
4
|
-
import { get, writable } from 'svelte/store';
|
|
5
|
-
import { getRandomId } from './util';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @typedef {('top-left'|'top-right'|'right-top'|'right-bottom'|'bottom-left'|'bottom-right'|'left-top'|'left-bottom')} PopupPosition
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
class Popup {
|
|
12
|
-
open = writable(false);
|
|
13
|
-
|
|
14
|
-
style = writable({ inset: undefined, zIndex: undefined, width: undefined, height: undefined });
|
|
15
|
-
|
|
16
|
-
observer = new IntersectionObserver((entries) => {
|
|
17
|
-
entries.forEach(({ intersectionRect, rootBounds }) => {
|
|
18
|
-
if (!intersectionRect || !rootBounds) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const contentHeight = this.popupElement.querySelector('.content').scrollHeight;
|
|
23
|
-
const bottomMargin = rootBounds.height - intersectionRect.bottom - 8;
|
|
24
|
-
let { position } = this;
|
|
25
|
-
|
|
26
|
-
// @todo Handle more overflow cases
|
|
27
|
-
if (contentHeight > bottomMargin) {
|
|
28
|
-
if (position.startsWith('bottom-')) {
|
|
29
|
-
position = position.replace('bottom-', 'top-');
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const top = position.startsWith('bottom-')
|
|
34
|
-
? `${Math.round(intersectionRect.bottom)}px`
|
|
35
|
-
: position.endsWith('-top')
|
|
36
|
-
? `${Math.round(intersectionRect.top)}px`
|
|
37
|
-
: 'auto';
|
|
38
|
-
|
|
39
|
-
const right = position.startsWith('left-')
|
|
40
|
-
? `${Math.round(rootBounds.width - intersectionRect.left)}px`
|
|
41
|
-
: position.endsWith('-right')
|
|
42
|
-
? `${Math.round(rootBounds.width - intersectionRect.right)}px`
|
|
43
|
-
: 'auto';
|
|
44
|
-
|
|
45
|
-
const bottom = position.startsWith('top-')
|
|
46
|
-
? `${Math.round(rootBounds.height - intersectionRect.top)}px`
|
|
47
|
-
: position.endsWith('-bottom')
|
|
48
|
-
? `${Math.round(rootBounds.height - intersectionRect.bottom)}px`
|
|
49
|
-
: 'auto';
|
|
50
|
-
|
|
51
|
-
const left = position.startsWith('right-')
|
|
52
|
-
? `${Math.round(intersectionRect.right)}px`
|
|
53
|
-
: position.endsWith('-left')
|
|
54
|
-
? `${Math.round(intersectionRect.left)}px`
|
|
55
|
-
: 'auto';
|
|
56
|
-
|
|
57
|
-
const anchorPopup = this.anchorElement.closest('.popup');
|
|
58
|
-
|
|
59
|
-
const style = {
|
|
60
|
-
inset: [top, right, bottom, left].join(' '),
|
|
61
|
-
zIndex: anchorPopup ? Number(anchorPopup.style.zIndex) + 1 : 1000,
|
|
62
|
-
width: `${Math.round(intersectionRect.width)}px`,
|
|
63
|
-
height: `${Math.round(Math.max(bottomMargin, contentHeight))}px`,
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
if (JSON.stringify(style) !== JSON.stringify(get(this.style))) {
|
|
67
|
-
this.style.set(style);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
*
|
|
74
|
-
* @param {HTMLElement} anchorElement
|
|
75
|
-
* @param {HTMLElement} popupElement
|
|
76
|
-
* @param {PopupPosition} position
|
|
77
|
-
*/
|
|
78
|
-
constructor(anchorElement, popupElement, position) {
|
|
79
|
-
this.anchorElement = anchorElement;
|
|
80
|
-
this.popupElement = popupElement; // = backdrop
|
|
81
|
-
this.position = position;
|
|
82
|
-
this.id = getRandomId('popup');
|
|
83
|
-
|
|
84
|
-
this.anchorElement.setAttribute('aria-controls', this.id);
|
|
85
|
-
this.popupElement.setAttribute('id', this.id);
|
|
86
|
-
|
|
87
|
-
this.anchorElement.addEventListener('click', () => {
|
|
88
|
-
if (!this.anchorElement.matches('[aria-disabled="true"]')) {
|
|
89
|
-
this.open.set(!get(this.open));
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
this.popupElement.addEventListener('click', (event) => {
|
|
94
|
-
if (get(this.open) && event.target !== this.anchorElement) {
|
|
95
|
-
this.open.set(false);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
[this.anchorElement, this.popupElement].forEach((element) => {
|
|
100
|
-
element.addEventListener('keydown', (event) => {
|
|
101
|
-
const { key, ctrlKey, metaKey, shiftKey, altKey } = event;
|
|
102
|
-
|
|
103
|
-
if (
|
|
104
|
-
get(this.open) &&
|
|
105
|
-
['Escape'].includes(key) &&
|
|
106
|
-
!ctrlKey &&
|
|
107
|
-
!metaKey &&
|
|
108
|
-
!shiftKey &&
|
|
109
|
-
!altKey
|
|
110
|
-
) {
|
|
111
|
-
this.open.set(false);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
this.open.subscribe((open) => {
|
|
117
|
-
if (open) {
|
|
118
|
-
this.checkPosition();
|
|
119
|
-
} else if (this.anchorElement.getAttribute('aria-expanded') === 'true') {
|
|
120
|
-
this.anchorElement.focus();
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
this.anchorElement.setAttribute('aria-expanded', open);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Continue checking the position in case the window or parent element resizes.
|
|
129
|
-
*/
|
|
130
|
-
checkPosition() {
|
|
131
|
-
this.observer.observe(this.anchorElement);
|
|
132
|
-
|
|
133
|
-
window.requestAnimationFrame(() => {
|
|
134
|
-
this.observer.unobserve(this.anchorElement);
|
|
135
|
-
|
|
136
|
-
if (get(this.open)) {
|
|
137
|
-
this.checkPosition();
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
*
|
|
145
|
-
*/
|
|
146
|
-
export const activatePopup = (...args) => new Popup(...args);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function getRandomId(prefix?: string, length?: number): string;
|
|
@@ -1,284 +0,0 @@
|
|
|
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) {
|
|
45
|
-
--hue: 210;
|
|
46
|
-
--highlight-foreground-color: hsl(var(--foreground-color-1-hsl));
|
|
47
|
-
--primary-foreground-color: hsl(var(--foreground-color-2-hsl));
|
|
48
|
-
--secondary-foreground-color: hsl(var(--foreground-color-3-hsl));
|
|
49
|
-
--ternary-foreground-color: hsl(var(--foreground-color-3-hsl));
|
|
50
|
-
--disabled-foreground-color: hsl(var(--foreground-color-4-hsl));
|
|
51
|
-
--danger-foreground-color: hsl(var(--danger-color));
|
|
52
|
-
--highlight-background-color: hsl(var(--background-color-5-hsl));
|
|
53
|
-
--content-background-color: hsl(var(--background-color-1-hsl));
|
|
54
|
-
--primary-background-color: hsl(var(--background-color-2-hsl));
|
|
55
|
-
--secondary-background-color: hsl(var(--background-color-3-hsl));
|
|
56
|
-
--secondary-background-color-translucent: hsl(var(--background-color-3-hsl) / 88%);
|
|
57
|
-
--ternary-background-color: hsl(var(--background-color-4-hsl));
|
|
58
|
-
--control-background-color: hsl(var(--background-color-1-hsl));
|
|
59
|
-
--disabled-background-color: hsl(var(--background-color-4-hsl));
|
|
60
|
-
--danger-background-color: hsl(var(--danger-color));
|
|
61
|
-
--primary-border-color: hsl(var(--border-color-1-hsl));
|
|
62
|
-
--secondary-border-color: hsl(var(--border-color-2-hsl));
|
|
63
|
-
--control-border-color: hsl(var(--border-color-2-hsl));
|
|
64
|
-
--popup-shadow-color: hsl(var(--shadow-color) / 40%);
|
|
65
|
-
--popup-backdrop-color: hsl(var(--shadow-color) / 40%);
|
|
66
|
-
--default-font-family: "Merriweather Sans", sans-serif;
|
|
67
|
-
--default-font-size: 13px;
|
|
68
|
-
--default-font-weight-regular: 300;
|
|
69
|
-
--default-font-weight-bold: 600;
|
|
70
|
-
--monospace-font-family: "Noto Sans Mono", monospace;
|
|
71
|
-
--monospace-font-size: 13px;
|
|
72
|
-
--control--small--border-width: 1px;
|
|
73
|
-
--control--small--border-radius: 2px;
|
|
74
|
-
--control--small--height: 24px;
|
|
75
|
-
--control--medium--border-width: 1px;
|
|
76
|
-
--control--medium--border-radius: 4px;
|
|
77
|
-
--control--medium--height: 32px;
|
|
78
|
-
--control--large--border-width: 1px;
|
|
79
|
-
--control--large--border-radius: 8px;
|
|
80
|
-
--control--large--height: 40px;
|
|
81
|
-
--button--small--border-radius: var(--control--small--border-radius);
|
|
82
|
-
--button--small--height: var(--control--small--height);
|
|
83
|
-
--button--medium--border-radius: var(--control--medium--border-radius);
|
|
84
|
-
--button--medium--height: var(--control--medium--height);
|
|
85
|
-
--button--large--border-radius: var(--control--large--border-radius);
|
|
86
|
-
--button--large--height: var(--control--large--height);
|
|
87
|
-
--option--small--border-radius: var(--control--small--border-radius);
|
|
88
|
-
--option--small--height: var(--control--small--height);
|
|
89
|
-
--option--medium--border-radius: var(--control--medium--border-radius);
|
|
90
|
-
--option--medium--height: var(--control--medium--height);
|
|
91
|
-
--option--large--border-radius: var(--control--large--border-radius);
|
|
92
|
-
--option--large--height: var(--control--large--height);
|
|
93
|
-
--input--small--border-radius: var(--control--small--border-radius);
|
|
94
|
-
--input--small--height: var(--control--small--height);
|
|
95
|
-
--input--medium--border-radius: var(--control--medium--border-radius);
|
|
96
|
-
--input--medium--height: var(--control--medium--height);
|
|
97
|
-
--input--large--border-radius: var(--control--large--border-radius);
|
|
98
|
-
--input--large--height: var(--control--large--height);
|
|
99
|
-
--tab--small--height: var(--control--small--height);
|
|
100
|
-
--tab--medium--height: var(--control--medium--height);
|
|
101
|
-
--tab--large--height: var(--control--large--height);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
:global(:root[data-theme=light]) {
|
|
105
|
-
--foreground-color-1-hsl: var(--hue) 5% 0%;
|
|
106
|
-
--foreground-color-2-hsl: var(--hue) 5% 20%;
|
|
107
|
-
--foreground-color-3-hsl: var(--hue) 5% 40%;
|
|
108
|
-
--foreground-color-4-hsl: var(--hue) 5% 60%;
|
|
109
|
-
--border-color-1-hsl: var(--hue) 5% 75%;
|
|
110
|
-
--border-color-2-hsl: var(--hue) 5% 80%;
|
|
111
|
-
--background-color-1-hsl: var(--hue) 5% 100%;
|
|
112
|
-
--background-color-2-hsl: var(--hue) 5% 98%;
|
|
113
|
-
--background-color-3-hsl: var(--hue) 5% 96%;
|
|
114
|
-
--background-color-4-hsl: var(--hue) 5% 94%;
|
|
115
|
-
--background-color-5-hsl: var(--hue) 5% 90%;
|
|
116
|
-
--shadow-color: var(--hue) 10% 0%;
|
|
117
|
-
--primary-accent-color: hsl(var(--hue) 80% 45%);
|
|
118
|
-
--primary-accent-color-lighter: hsl(var(--hue) 80% 40%);
|
|
119
|
-
--primary-accent-color-darker: hsl(var(--hue) 80% 50%);
|
|
120
|
-
--primary-accent-color-foreground: hsl(var(--hue) 10% 100%);
|
|
121
|
-
--danger-color: 0 68% 42%;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
:global(:root[data-theme=dark]) {
|
|
125
|
-
--foreground-color-1-hsl: var(--hue) 10% 100%;
|
|
126
|
-
--foreground-color-2-hsl: var(--hue) 10% 80%;
|
|
127
|
-
--foreground-color-3-hsl: var(--hue) 10% 60%;
|
|
128
|
-
--foreground-color-4-hsl: var(--hue) 10% 40%;
|
|
129
|
-
--border-color-1-hsl: var(--hue) 10% 25%;
|
|
130
|
-
--border-color-2-hsl: var(--hue) 10% 20%;
|
|
131
|
-
--background-color-1-hsl: var(--hue) 10% 8%;
|
|
132
|
-
--background-color-2-hsl: var(--hue) 10% 10%;
|
|
133
|
-
--background-color-3-hsl: var(--hue) 10% 12%;
|
|
134
|
-
--background-color-4-hsl: var(--hue) 10% 14%;
|
|
135
|
-
--background-color-5-hsl: var(--hue) 10% 18%;
|
|
136
|
-
--shadow-color: var(--hue) 10% 0%;
|
|
137
|
-
--primary-accent-color: hsl(var(--hue) 100% 45%);
|
|
138
|
-
--primary-accent-color-lighter: hsl(var(--hue) 100% 50%);
|
|
139
|
-
--primary-accent-color-darker: hsl(var(--hue) 100% 40%);
|
|
140
|
-
--primary-accent-color-foreground: hsl(var(--hue) 10% 100%);
|
|
141
|
-
--danger-color: 0 68% 42%;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
:global(.material-symbols-outlined) {
|
|
145
|
-
font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 24;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
:global(*) {
|
|
149
|
-
scroll-behavior: smooth;
|
|
150
|
-
box-sizing: border-box;
|
|
151
|
-
border-width: 0;
|
|
152
|
-
border-style: solid;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
:global(:focus) {
|
|
156
|
-
z-index: 1;
|
|
157
|
-
outline-width: 0;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
:global(:focus-visible) {
|
|
161
|
-
outline-offset: -2px;
|
|
162
|
-
outline-width: 2px !important;
|
|
163
|
-
outline-style: solid;
|
|
164
|
-
outline-color: hsl(var(--hue), 100%, 50%, 25%);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
:global(h1),
|
|
168
|
-
:global(h2),
|
|
169
|
-
:global(h3),
|
|
170
|
-
:global(h4),
|
|
171
|
-
:global(h5),
|
|
172
|
-
:global(h6) {
|
|
173
|
-
margin: 0;
|
|
174
|
-
font-weight: var(--default-font-weight-bold);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
:global(strong) {
|
|
178
|
-
font-weight: var(--default-font-weight-bold);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
:global(a) {
|
|
182
|
-
color: var(--primary-accent-color-lighter);
|
|
183
|
-
text-decoration: none;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
:global(img),
|
|
187
|
-
:global(svg),
|
|
188
|
-
:global(iframe) {
|
|
189
|
-
vertical-align: top;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
:global(button),
|
|
193
|
-
:global(input),
|
|
194
|
-
:global(textarea),
|
|
195
|
-
:global(select),
|
|
196
|
-
:global(option) {
|
|
197
|
-
font-family: inherit;
|
|
198
|
-
font-size: inherit;
|
|
199
|
-
color: inherit;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
:global(p),
|
|
203
|
-
:global(li) {
|
|
204
|
-
line-height: 1.75;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
:global([role=grid]) {
|
|
208
|
-
display: table;
|
|
209
|
-
width: 100%;
|
|
210
|
-
}
|
|
211
|
-
:global([role=grid]) :global(.colgroup) {
|
|
212
|
-
display: table-column-group;
|
|
213
|
-
}
|
|
214
|
-
:global([role=grid]) :global(.colgroup) :global(.col) {
|
|
215
|
-
display: table-column;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
:global(code),
|
|
219
|
-
:global(pre) {
|
|
220
|
-
font-family: var(--monospace-font-family);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
:global(pre) {
|
|
224
|
-
line-height: 1.5;
|
|
225
|
-
-webkit-user-select: text;
|
|
226
|
-
user-select: text;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
:global(dialog) {
|
|
230
|
-
position: fixed;
|
|
231
|
-
inset: 0;
|
|
232
|
-
outline: 0;
|
|
233
|
-
margin: 0;
|
|
234
|
-
border: 0;
|
|
235
|
-
padding: 0;
|
|
236
|
-
width: 100%;
|
|
237
|
-
max-width: 100%;
|
|
238
|
-
height: 100%;
|
|
239
|
-
max-height: 100%;
|
|
240
|
-
color: inherit;
|
|
241
|
-
background: transparent;
|
|
242
|
-
-webkit-user-select: none;
|
|
243
|
-
user-select: none;
|
|
244
|
-
touch-action: none;
|
|
245
|
-
cursor: default;
|
|
246
|
-
}
|
|
247
|
-
:global(dialog::backdrop) {
|
|
248
|
-
background: transparent;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
:global(.thead[role=rowgroup]) {
|
|
252
|
-
display: table-header-group;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
:global(.tbody[role=rowgroup]) {
|
|
256
|
-
display: table-row-group;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
:global([role=row]) {
|
|
260
|
-
display: table-row;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
:global([role=columnheader]),
|
|
264
|
-
:global([role=gridcell]) {
|
|
265
|
-
display: table-cell;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
:global(.app-shell) {
|
|
269
|
-
position: fixed;
|
|
270
|
-
inset: 0;
|
|
271
|
-
overflow: hidden;
|
|
272
|
-
width: 100%;
|
|
273
|
-
height: 100%;
|
|
274
|
-
color: var(--primary-foreground-color);
|
|
275
|
-
background-color: var(--primary-background-color);
|
|
276
|
-
font-family: var(--default-font-family);
|
|
277
|
-
font-size: var(--default-font-size);
|
|
278
|
-
font-weight: var(--default-font-weight-regular);
|
|
279
|
-
-webkit-user-select: none;
|
|
280
|
-
user-select: none;
|
|
281
|
-
touch-action: none;
|
|
282
|
-
overflow-anchor: none;
|
|
283
|
-
cursor: default;
|
|
284
|
-
}</style>
|
|
@@ -1,28 +0,0 @@
|
|
|
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 {
|
|
10
|
-
}
|
|
11
|
-
export type AppShellProps = typeof __propDef.props;
|
|
12
|
-
export type AppShellEvents = typeof __propDef.events;
|
|
13
|
-
export type AppShellSlots = typeof __propDef.slots;
|
|
14
|
-
declare const __propDef: {
|
|
15
|
-
props: {
|
|
16
|
-
[x: string]: never;
|
|
17
|
-
};
|
|
18
|
-
events: {
|
|
19
|
-
dragover: DragEvent;
|
|
20
|
-
drop: DragEvent;
|
|
21
|
-
} & {
|
|
22
|
-
[evt: string]: CustomEvent<any>;
|
|
23
|
-
};
|
|
24
|
-
slots: {
|
|
25
|
-
default: {};
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,131 +0,0 @@
|
|
|
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
|
-
* Where to show the dropdown menu.
|
|
23
|
-
* @type {PopupPosition}
|
|
24
|
-
*/
|
|
25
|
-
export let position = 'bottom-left';
|
|
26
|
-
|
|
27
|
-
export let open = writable(false);
|
|
28
|
-
|
|
29
|
-
let showDialog = false;
|
|
30
|
-
let showContent = false;
|
|
31
|
-
let closeDialogTimer = 0;
|
|
32
|
-
|
|
33
|
-
let style = writable({
|
|
34
|
-
inset: undefined,
|
|
35
|
-
zIndex: undefined,
|
|
36
|
-
width: undefined,
|
|
37
|
-
height: undefined,
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
$: {
|
|
41
|
-
if (anchor && dialog) {
|
|
42
|
-
({ open, style } = activatePopup(anchor, dialog, position));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const openDialog = () => {
|
|
47
|
-
window.clearTimeout(closeDialogTimer);
|
|
48
|
-
(document.querySelector('.sui.app-shell') || document.body).appendChild(dialog);
|
|
49
|
-
showContent = true;
|
|
50
|
-
dialog.showModal();
|
|
51
|
-
|
|
52
|
-
window.requestAnimationFrame(() => {
|
|
53
|
-
showDialog = true;
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const closeDialog = () => {
|
|
58
|
-
showDialog = false;
|
|
59
|
-
|
|
60
|
-
closeDialogTimer = window.setTimeout(() => {
|
|
61
|
-
showContent = false;
|
|
62
|
-
dialog?.close();
|
|
63
|
-
dialog?.remove();
|
|
64
|
-
}, 500);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
$: {
|
|
68
|
-
if (dialog) {
|
|
69
|
-
if ($open) {
|
|
70
|
-
openDialog();
|
|
71
|
-
} else {
|
|
72
|
-
closeDialog();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
onMount(() => {
|
|
78
|
-
dialog.remove();
|
|
79
|
-
|
|
80
|
-
// onUnmount
|
|
81
|
-
return () => {
|
|
82
|
-
dialog?.close();
|
|
83
|
-
dialog?.remove();
|
|
84
|
-
};
|
|
85
|
-
});
|
|
86
|
-
</script>
|
|
87
|
-
|
|
88
|
-
<dialog class="sui popup" bind:this={dialog} class:open={showDialog} {...$$restProps}>
|
|
89
|
-
<!-- Prevent the first item in the slot, e.g. a menu item, from being focused by adding `tabindex`
|
|
90
|
-
to the container -->
|
|
91
|
-
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
|
92
|
-
<div
|
|
93
|
-
tabindex="0"
|
|
94
|
-
class="content"
|
|
95
|
-
style:inset={$style.inset}
|
|
96
|
-
style:z-index={$style.zIndex}
|
|
97
|
-
style:min-width={$style.width}
|
|
98
|
-
style:max-height={$style.height}
|
|
99
|
-
>
|
|
100
|
-
{#if showContent}
|
|
101
|
-
<slot />
|
|
102
|
-
{/if}
|
|
103
|
-
</div>
|
|
104
|
-
</dialog>
|
|
105
|
-
|
|
106
|
-
<style>.popup.open .content {
|
|
107
|
-
opacity: 1;
|
|
108
|
-
transform: translateY(2px);
|
|
109
|
-
transition-duration: 100ms;
|
|
110
|
-
}
|
|
111
|
-
.popup:not(.open) {
|
|
112
|
-
pointer-events: none;
|
|
113
|
-
}
|
|
114
|
-
.popup:not(.open) .content {
|
|
115
|
-
opacity: 0;
|
|
116
|
-
transform: translateY(-8px);
|
|
117
|
-
pointer-events: none;
|
|
118
|
-
transition-duration: 200ms;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.content {
|
|
122
|
-
position: fixed;
|
|
123
|
-
overflow-y: auto;
|
|
124
|
-
outline-width: 0 !important;
|
|
125
|
-
color: var(--primary-foreground-color);
|
|
126
|
-
background-color: var(--secondary-background-color-translucent);
|
|
127
|
-
backdrop-filter: blur(16px);
|
|
128
|
-
box-shadow: 0 8px 16px var(--popup-shadow-color);
|
|
129
|
-
will-change: opacity, transform;
|
|
130
|
-
transition-property: opacity, transform;
|
|
131
|
-
}</style>
|
|
@@ -1,37 +0,0 @@
|
|
|
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 {
|
|
6
|
-
/**accessor*/
|
|
7
|
-
set anchor(arg: any);
|
|
8
|
-
get anchor(): any;
|
|
9
|
-
/**accessor*/
|
|
10
|
-
set dialog(arg: any);
|
|
11
|
-
get dialog(): any;
|
|
12
|
-
/**accessor*/
|
|
13
|
-
set position(arg: any);
|
|
14
|
-
get position(): any;
|
|
15
|
-
/**accessor*/
|
|
16
|
-
set open(arg: any);
|
|
17
|
-
get open(): any;
|
|
18
|
-
}
|
|
19
|
-
export type PopupProps = typeof __propDef.props;
|
|
20
|
-
export type PopupEvents = typeof __propDef.events;
|
|
21
|
-
export type PopupSlots = typeof __propDef.slots;
|
|
22
|
-
declare const __propDef: {
|
|
23
|
-
props: {
|
|
24
|
-
[x: string]: any;
|
|
25
|
-
dialog?: (HTMLElement | undefined);
|
|
26
|
-
position?: any;
|
|
27
|
-
anchor?: (HTMLElement | undefined);
|
|
28
|
-
open?: any;
|
|
29
|
-
};
|
|
30
|
-
events: {
|
|
31
|
-
[evt: string]: CustomEvent<any>;
|
|
32
|
-
};
|
|
33
|
-
slots: {
|
|
34
|
-
default: {};
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
export {};
|
|
@@ -1,34 +0,0 @@
|
|
|
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>
|