@nymphjs/tilmeld-setup 1.0.0-beta.80 → 1.0.0-beta.82
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/CHANGELOG.md +10 -0
- package/README.md +1 -1
- package/app/index.ts +3 -1
- package/app/src/App.svelte +43 -36
- package/app/src/routes/GroupEdit.svelte +222 -208
- package/app/src/routes/Groups.svelte +32 -30
- package/app/src/routes/Intro.svelte +4 -0
- package/app/src/routes/NotFound.svelte +4 -0
- package/app/src/routes/UserEdit.svelte +368 -338
- package/app/src/routes/Users.svelte +32 -30
- package/dist/app/index.css +105 -0
- package/dist/app/index.d.ts +1 -0
- package/dist/app/index.js +35147 -61478
- package/dist/app/smui.css +1 -1
- package/dist/app/src/nymph.d.ts +6 -0
- package/dist/index.js +13 -17
- package/dist/index.js.map +1 -1
- package/jest.config.js +11 -2
- package/package.json +52 -51
- package/rollup.config.mjs +8 -4
- package/src/index.ts +5 -1
- package/src/type/locutus.d.ts +3 -0
- package/static/index.html +3 -0
- package/test.mjs +2 -5
- package/tsconfig.json +11 -1
- package/tsconfig.server.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.0.0-beta.82](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.81...v1.0.0-beta.82) (2024-12-15)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- migrate to es modules, upgrade all packages, migrate to Svelte 5 ([3f2b9e5](https://github.com/sciactive/nymphjs/commit/3f2b9e517b39934eddce66601d7fc747fbf3f9e6))
|
|
11
|
+
|
|
12
|
+
# [1.0.0-beta.81](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.80...v1.0.0-beta.81) (2024-09-28)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @nymphjs/tilmeld-setup
|
|
15
|
+
|
|
6
16
|
# [1.0.0-beta.80](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.79...v1.0.0-beta.80) (2024-09-28)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @nymphjs/tilmeld-setup
|
package/README.md
CHANGED
package/app/index.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { mount } from 'svelte';
|
|
1
2
|
import App from './src/App.svelte';
|
|
2
3
|
|
|
3
4
|
document.addEventListener('DOMContentLoaded', () => {
|
|
4
|
-
const app =
|
|
5
|
+
const app = mount(App, {
|
|
5
6
|
target: document.getElementById('app') as HTMLElement,
|
|
7
|
+
props: {},
|
|
6
8
|
});
|
|
7
9
|
|
|
8
10
|
// Helps with admin and debugging.
|
package/app/src/App.svelte
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<svelte:window
|
|
1
|
+
<svelte:window onresize={setMiniWindow} />
|
|
2
2
|
|
|
3
3
|
<TopAppBar variant="static" class="tilmeld-top-app-bar">
|
|
4
4
|
<Row>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
{#if miniWindow}
|
|
7
7
|
<IconButton
|
|
8
8
|
class="material-icons"
|
|
9
|
-
|
|
9
|
+
onclick={() => (drawerOpen = !drawerOpen)}>menu</IconButton
|
|
10
10
|
>
|
|
11
11
|
{/if}
|
|
12
12
|
<Title style={miniWindow ? 'padding-left: 0;' : ''}>
|
|
@@ -37,17 +37,17 @@
|
|
|
37
37
|
<div>
|
|
38
38
|
<IconButton
|
|
39
39
|
title="Account"
|
|
40
|
-
|
|
40
|
+
onclick={() => $user != null && accountMenu.setOpen(true)}
|
|
41
41
|
>
|
|
42
42
|
<Icon tag="img" src={userAvatar} />
|
|
43
43
|
</IconButton>
|
|
44
44
|
<Menu bind:this={accountMenu} anchorCorner="BOTTOM_LEFT">
|
|
45
45
|
<List>
|
|
46
|
-
<Item
|
|
46
|
+
<Item onSMUIAction={() => (accountOpen = true)}>
|
|
47
47
|
<Text>Account Details</Text>
|
|
48
48
|
</Item>
|
|
49
49
|
<Separator />
|
|
50
|
-
<Item
|
|
50
|
+
<Item onSMUIAction={() => $user?.$logout()}>
|
|
51
51
|
<Text>Logout</Text>
|
|
52
52
|
</Item>
|
|
53
53
|
</List>
|
|
@@ -89,12 +89,12 @@
|
|
|
89
89
|
</Item>
|
|
90
90
|
{/if}
|
|
91
91
|
{/each}
|
|
92
|
-
{:else if user == null}
|
|
93
|
-
<Item tag="span"
|
|
92
|
+
{:else if $user == null}
|
|
93
|
+
<Item tag="span" onclick={() => (drawerOpen = false)} activated>
|
|
94
94
|
<Text class="mdc-theme--on-secondary">Login</Text>
|
|
95
95
|
</Item>
|
|
96
96
|
{:else}
|
|
97
|
-
<Item tag="span"
|
|
97
|
+
<Item tag="span" onclick={() => (drawerOpen = false)} activated>
|
|
98
98
|
<Text class="mdc-theme--on-secondary">Forbidden</Text>
|
|
99
99
|
</Item>
|
|
100
100
|
{/if}
|
|
@@ -108,12 +108,12 @@
|
|
|
108
108
|
<AppContent class="tilmeld-app-content">
|
|
109
109
|
<main class="tilmeld-main-content" bind:this={mainContent}>
|
|
110
110
|
{#if tilmeldAdmin}
|
|
111
|
-
{#if clientConfig}
|
|
112
|
-
<
|
|
111
|
+
{#if $clientConfig}
|
|
112
|
+
<CurrentRoute {router} {params} {clientConfig} {user} />
|
|
113
113
|
{:else}
|
|
114
114
|
Loading...
|
|
115
115
|
{/if}
|
|
116
|
-
{:else if user === null}
|
|
116
|
+
{:else if $user === null}
|
|
117
117
|
<section style="display: flex; justify-content: center;">
|
|
118
118
|
<Login
|
|
119
119
|
{User}
|
|
@@ -121,19 +121,21 @@
|
|
|
121
121
|
showExistingUserToggle={allowRegistration}
|
|
122
122
|
/>
|
|
123
123
|
</section>
|
|
124
|
-
{:else if user === undefined}
|
|
124
|
+
{:else if $user === undefined}
|
|
125
125
|
Loading...
|
|
126
126
|
{:else}
|
|
127
127
|
<section>You don't have permission to access this app.</section>
|
|
128
128
|
{/if}
|
|
129
|
-
<Account bind:open={accountOpen} {User} {clientConfig} />
|
|
129
|
+
<Account bind:open={accountOpen} {User} {user} {clientConfig} />
|
|
130
130
|
</main>
|
|
131
131
|
</AppContent>
|
|
132
132
|
</div>
|
|
133
133
|
|
|
134
134
|
<script lang="ts">
|
|
135
|
-
import type {
|
|
135
|
+
import type { Component } from 'svelte';
|
|
136
136
|
import { onMount } from 'svelte';
|
|
137
|
+
import type { Writable } from 'svelte/store';
|
|
138
|
+
import { writable } from 'svelte/store';
|
|
137
139
|
import Navigo from 'navigo';
|
|
138
140
|
import type {
|
|
139
141
|
User as UserClass,
|
|
@@ -161,26 +163,31 @@
|
|
|
161
163
|
const allowRegistration = (window as any).allowRegistration;
|
|
162
164
|
|
|
163
165
|
let mainContent: HTMLElement;
|
|
164
|
-
let miniWindow = false;
|
|
165
|
-
let drawerOpen = false;
|
|
166
|
+
let miniWindow = $state(false);
|
|
167
|
+
let drawerOpen = $state(false);
|
|
166
168
|
let accountMenu: any;
|
|
167
|
-
let clientConfig: ClientConfig;
|
|
168
|
-
let user: (UserClass & CurrentUserData) | null | undefined =
|
|
169
|
-
|
|
170
|
-
let
|
|
171
|
-
let
|
|
169
|
+
let clientConfig: Writable<ClientConfig | undefined> = writable();
|
|
170
|
+
let user: Writable<(UserClass & CurrentUserData) | null | undefined> =
|
|
171
|
+
writable();
|
|
172
|
+
let userAvatar: string = $state(DEFAULT_AVATAR);
|
|
173
|
+
let tilmeldAdmin: boolean | undefined = $state();
|
|
174
|
+
let accountOpen = $state(false);
|
|
172
175
|
|
|
173
|
-
|
|
174
|
-
user
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
$effect(() => {
|
|
177
|
+
if ($user) {
|
|
178
|
+
$user
|
|
179
|
+
.$gatekeeper('tilmeld/admin')
|
|
180
|
+
.then((value) => (tilmeldAdmin = value));
|
|
181
|
+
$user.$getAvatar().then((value) => (userAvatar = value));
|
|
182
|
+
} else {
|
|
183
|
+
tilmeldAdmin = undefined;
|
|
184
|
+
userAvatar = DEFAULT_AVATAR;
|
|
185
|
+
}
|
|
186
|
+
});
|
|
180
187
|
|
|
181
188
|
const router = new Navigo('/', { hash: true });
|
|
182
|
-
let CurrentRoute:
|
|
183
|
-
let params: any = {};
|
|
189
|
+
let CurrentRoute: Component<any> = $state(Intro);
|
|
190
|
+
let params: any = $state({});
|
|
184
191
|
|
|
185
192
|
router.hooks({
|
|
186
193
|
before(done, match) {
|
|
@@ -235,7 +242,7 @@
|
|
|
235
242
|
}
|
|
236
243
|
});
|
|
237
244
|
|
|
238
|
-
let currentMatch = router.getCurrentLocation();
|
|
245
|
+
let currentMatch = $state(router.getCurrentLocation());
|
|
239
246
|
router.resolve();
|
|
240
247
|
|
|
241
248
|
const sections: (
|
|
@@ -244,7 +251,7 @@
|
|
|
244
251
|
indent: number;
|
|
245
252
|
href?: string;
|
|
246
253
|
absolute?: boolean;
|
|
247
|
-
component?:
|
|
254
|
+
component?: ReturnType<Component<any>>;
|
|
248
255
|
}
|
|
249
256
|
| { name: string; separator: true }
|
|
250
257
|
)[] = [
|
|
@@ -271,10 +278,10 @@
|
|
|
271
278
|
];
|
|
272
279
|
|
|
273
280
|
const onLogin = (currentUser: UserClass & CurrentUserData) => {
|
|
274
|
-
user = currentUser;
|
|
281
|
+
$user = currentUser;
|
|
275
282
|
};
|
|
276
283
|
const onLogout = () => {
|
|
277
|
-
user = null;
|
|
284
|
+
$user = null;
|
|
278
285
|
};
|
|
279
286
|
|
|
280
287
|
onMount(setMiniWindow);
|
|
@@ -282,9 +289,9 @@
|
|
|
282
289
|
User.on('login', onLogin);
|
|
283
290
|
User.on('logout', onLogout);
|
|
284
291
|
|
|
285
|
-
clientConfig = await User.getClientConfig();
|
|
292
|
+
$clientConfig = await User.getClientConfig();
|
|
286
293
|
|
|
287
|
-
user = await User.current();
|
|
294
|
+
$user = await User.current();
|
|
288
295
|
});
|
|
289
296
|
|
|
290
297
|
function setMiniWindow() {
|