@axium/client 0.18.3 → 0.18.4
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/requests.js +11 -6
- package/lib/SidebarLayout.svelte +19 -4
- package/package.json +1 -1
- package/styles/list.css +14 -6
package/dist/requests.js
CHANGED
|
@@ -31,11 +31,6 @@ export async function fetchAPI(method, endpoint, data, ...params) {
|
|
|
31
31
|
catch (e) {
|
|
32
32
|
throw prettifyError(e);
|
|
33
33
|
}
|
|
34
|
-
if (method !== 'GET' && method !== 'HEAD')
|
|
35
|
-
options.body = JSON.stringify(data);
|
|
36
|
-
const search = method != 'GET' || typeof data != 'object' || data == null || !Object.keys(data).length
|
|
37
|
-
? ''
|
|
38
|
-
: '?' + new URLSearchParams(JSON.parse(JSON.stringify(data))).toString();
|
|
39
34
|
if (token)
|
|
40
35
|
options.headers.Authorization = 'Bearer ' + token;
|
|
41
36
|
if (userAgent)
|
|
@@ -51,7 +46,17 @@ export async function fetchAPI(method, endpoint, data, ...params) {
|
|
|
51
46
|
throw new Error(`Missing parameter "${part.slice(1)}"`);
|
|
52
47
|
parts.push(value);
|
|
53
48
|
}
|
|
54
|
-
|
|
49
|
+
let url = prefix + parts.join('/');
|
|
50
|
+
if (method !== 'GET' && method !== 'HEAD')
|
|
51
|
+
options.body = JSON.stringify(data);
|
|
52
|
+
if (method == 'GET' && typeof data == 'object' && data != null && Object.keys(data).length) {
|
|
53
|
+
const search = new URLSearchParams();
|
|
54
|
+
for (const [key, value] of Object.entries(data)) {
|
|
55
|
+
search.set(key, JSON.stringify(value));
|
|
56
|
+
}
|
|
57
|
+
url += '?' + search.toString();
|
|
58
|
+
}
|
|
59
|
+
const response = await fetch(url, options);
|
|
55
60
|
if (!response.headers.get('Content-Type')?.includes('application/json')) {
|
|
56
61
|
throw new Error(`Unexpected response type: ${response.headers.get('Content-Type')}`);
|
|
57
62
|
}
|
package/lib/SidebarLayout.svelte
CHANGED
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import Icon from './Icon.svelte';
|
|
3
|
-
import { capitalize } from 'utilium';
|
|
4
3
|
|
|
5
4
|
interface Tab {
|
|
6
5
|
href: string;
|
|
7
6
|
name: string;
|
|
8
7
|
icon: string;
|
|
9
8
|
active: boolean;
|
|
9
|
+
mobile?: false;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
interface MobileTab {
|
|
13
|
+
href: string;
|
|
14
|
+
icon: string;
|
|
15
|
+
active: boolean;
|
|
16
|
+
mobile: true;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let { children, tabs, bottom }: { children(): any; tabs: (Tab | MobileTab)[]; bottom?(): any } = $props();
|
|
13
20
|
</script>
|
|
14
21
|
|
|
15
22
|
<div class="sidebar-container">
|
|
16
23
|
<div class="sidebar">
|
|
17
|
-
{#each tabs as
|
|
18
|
-
<a {href} class={['item', 'icon-text', active && 'active'
|
|
24
|
+
{#each tabs as tab}
|
|
25
|
+
<a href={tab.href} class={['item', 'icon-text', tab.active && 'active', tab.mobile && 'mobile-only']}>
|
|
26
|
+
<Icon i={tab.icon} />
|
|
27
|
+
{#if !tab.mobile}<span class="sidebar-text">{tab.name}</span>{/if}
|
|
28
|
+
</a>
|
|
19
29
|
{/each}
|
|
20
30
|
|
|
21
31
|
{#if bottom}
|
|
@@ -105,5 +115,10 @@
|
|
|
105
115
|
|
|
106
116
|
.sidebar-bottom {
|
|
107
117
|
margin-top: auto;
|
|
118
|
+
margin-left: 1em;
|
|
119
|
+
|
|
120
|
+
@media (width < 700px) {
|
|
121
|
+
display: none;
|
|
122
|
+
}
|
|
108
123
|
}
|
|
109
124
|
</style>
|
package/package.json
CHANGED
package/styles/list.css
CHANGED
|
@@ -1,23 +1,30 @@
|
|
|
1
|
-
.list
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
div:has(> .list) {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
min-height: 0;
|
|
5
|
+
overflow-y: hidden;
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
> :where(button),
|
|
8
|
+
> .Popover > :where(button) {
|
|
9
|
+
align-self: flex-start;
|
|
7
10
|
}
|
|
8
11
|
}
|
|
9
12
|
|
|
10
13
|
.list {
|
|
11
14
|
display: flex;
|
|
12
15
|
flex-direction: column;
|
|
13
|
-
|
|
16
|
+
min-height: 0;
|
|
17
|
+
overflow-x: hidden;
|
|
18
|
+
overflow-y: scroll;
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
div.list-header {
|
|
17
22
|
font-weight: bold;
|
|
18
23
|
border-bottom: 1.5px solid var(--fg-accent);
|
|
19
24
|
position: sticky;
|
|
25
|
+
background-color: var(--bg-normal);
|
|
20
26
|
top: 0em;
|
|
27
|
+
z-index: 1;
|
|
21
28
|
|
|
22
29
|
@media (width < 700px) {
|
|
23
30
|
display: none !important;
|
|
@@ -36,6 +43,7 @@ div.list-header {
|
|
|
36
43
|
padding: 0.5em;
|
|
37
44
|
overflow: hidden;
|
|
38
45
|
text-wrap: nowrap;
|
|
46
|
+
flex: 0 0 auto;
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
.list-item:not(.list-header, :first-child) {
|