@nymphjs/tilmeld-setup 1.0.0-beta.7 → 1.0.0-beta.70

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 CHANGED
@@ -3,6 +3,292 @@
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.70](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.69...v1.0.0-beta.70) (2024-09-20)
7
+
8
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
9
+
10
+ # [1.0.0-beta.69](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.68...v1.0.0-beta.69) (2024-09-19)
11
+
12
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
13
+
14
+ # [1.0.0-beta.68](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.67...v1.0.0-beta.68) (2024-09-19)
15
+
16
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
17
+
18
+ # [1.0.0-beta.67](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.66...v1.0.0-beta.67) (2024-09-03)
19
+
20
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
21
+
22
+ # [1.0.0-beta.66](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.65...v1.0.0-beta.66) (2024-08-06)
23
+
24
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
25
+
26
+ # [1.0.0-beta.65](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.64...v1.0.0-beta.65) (2024-08-05)
27
+
28
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
29
+
30
+ # [1.0.0-beta.64](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.63...v1.0.0-beta.64) (2024-08-04)
31
+
32
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
33
+
34
+ # [1.0.0-beta.63](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.62...v1.0.0-beta.63) (2024-06-18)
35
+
36
+ ### Bug Fixes
37
+
38
+ - undo ts compilation to module change ([84be6d4](https://github.com/sciactive/nymphjs/commit/84be6d434be29f8afd53907d15be2eb77d1736ce))
39
+
40
+ ### Features
41
+
42
+ - export data iterator ([b86aa19](https://github.com/sciactive/nymphjs/commit/b86aa19fc77d744b5a683046dfb697fc4746df5c))
43
+
44
+ # [1.0.0-beta.62](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.61...v1.0.0-beta.62) (2024-06-15)
45
+
46
+ ### Bug Fixes
47
+
48
+ - assign generated and default groups to users created through admin app ([7ea0baa](https://github.com/sciactive/nymphjs/commit/7ea0baaf3a2c1285a63ee95ec153f38c169af6b6))
49
+
50
+ # [1.0.0-beta.61](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.60...v1.0.0-beta.61) (2024-06-14)
51
+
52
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
53
+
54
+ # [1.0.0-beta.60](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.59...v1.0.0-beta.60) (2024-06-14)
55
+
56
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
57
+
58
+ # [1.0.0-beta.59](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.58...v1.0.0-beta.59) (2024-06-14)
59
+
60
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
61
+
62
+ # [1.0.0-beta.58](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.57...v1.0.0-beta.58) (2024-06-12)
63
+
64
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
65
+
66
+ # [1.0.0-beta.57](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.56...v1.0.0-beta.57) (2024-06-12)
67
+
68
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
69
+
70
+ # [1.0.0-beta.56](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.55...v1.0.0-beta.56) (2024-06-11)
71
+
72
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
73
+
74
+ # [1.0.0-beta.55](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.54...v1.0.0-beta.55) (2024-05-26)
75
+
76
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
77
+
78
+ # [1.0.0-beta.54](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.53...v1.0.0-beta.54) (2024-05-26)
79
+
80
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
81
+
82
+ # [1.0.0-beta.53](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.52...v1.0.0-beta.53) (2024-05-26)
83
+
84
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
85
+
86
+ # [1.0.0-beta.52](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.51...v1.0.0-beta.52) (2024-05-25)
87
+
88
+ ### Bug Fixes
89
+
90
+ - support setup app and users and groups when userFields is limited ([20e25a2](https://github.com/sciactive/nymphjs/commit/20e25a2bcc35f96b3146fd9d973e34083a85f854))
91
+
92
+ # [1.0.0-beta.51](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.50...v1.0.0-beta.51) (2024-04-12)
93
+
94
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
95
+
96
+ # [1.0.0-beta.50](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.49...v1.0.0-beta.50) (2024-04-08)
97
+
98
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
99
+
100
+ # [1.0.0-beta.49](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.48...v1.0.0-beta.49) (2024-03-04)
101
+
102
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
103
+
104
+ # [1.0.0-beta.48](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.47...v1.0.0-beta.48) (2023-11-10)
105
+
106
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
107
+
108
+ # [1.0.0-beta.47](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.46...v1.0.0-beta.47) (2023-11-10)
109
+
110
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
111
+
112
+ # [1.0.0-beta.46](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.45...v1.0.0-beta.46) (2023-08-29)
113
+
114
+ ### Features
115
+
116
+ - enable tilmeld admins to remove totp secret from users ([18455b3](https://github.com/sciactive/nymphjs/commit/18455b3edbbfa1188f8cf317438bbfa028ba8f47))
117
+
118
+ # [1.0.0-beta.45](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.44...v1.0.0-beta.45) (2023-07-17)
119
+
120
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
121
+
122
+ # [1.0.0-beta.44](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.43...v1.0.0-beta.44) (2023-07-13)
123
+
124
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
125
+
126
+ # [1.0.0-beta.43](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.42...v1.0.0-beta.43) (2023-07-12)
127
+
128
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
129
+
130
+ # [1.0.0-beta.42](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.41...v1.0.0-beta.42) (2023-07-12)
131
+
132
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
133
+
134
+ # [1.0.0-beta.41](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.40...v1.0.0-beta.41) (2023-07-12)
135
+
136
+ ### Features
137
+
138
+ - remove synchronous database queries ([b579fb2](https://github.com/sciactive/nymphjs/commit/b579fb2eacd96cdd1b386a62c5c00cdbb2438f6e))
139
+ - rewrite server side async api to match client side api ([9c537a8](https://github.com/sciactive/nymphjs/commit/9c537a8be49e9b989af0822a4c2236e8c2d20f87))
140
+
141
+ # [1.0.0-beta.40](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.39...v1.0.0-beta.40) (2023-07-10)
142
+
143
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
144
+
145
+ # [1.0.0-beta.39](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.38...v1.0.0-beta.39) (2023-07-09)
146
+
147
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
148
+
149
+ # [1.0.0-beta.38](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.37...v1.0.0-beta.38) (2023-07-09)
150
+
151
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
152
+
153
+ # [1.0.0-beta.37](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.36...v1.0.0-beta.37) (2023-07-09)
154
+
155
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
156
+
157
+ # [1.0.0-beta.36](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.35...v1.0.0-beta.36) (2023-07-09)
158
+
159
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
160
+
161
+ # [1.0.0-beta.35](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.34...v1.0.0-beta.35) (2023-06-14)
162
+
163
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
164
+
165
+ # [1.0.0-beta.34](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.33...v1.0.0-beta.34) (2023-05-13)
166
+
167
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
168
+
169
+ # [1.0.0-beta.33](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.32...v1.0.0-beta.33) (2023-05-13)
170
+
171
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
172
+
173
+ # [1.0.0-beta.32](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.31...v1.0.0-beta.32) (2023-05-13)
174
+
175
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
176
+
177
+ # [1.0.0-beta.31](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.30...v1.0.0-beta.31) (2023-05-12)
178
+
179
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
180
+
181
+ # [1.0.0-beta.30](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.29...v1.0.0-beta.30) (2023-05-12)
182
+
183
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
184
+
185
+ # [1.0.0-beta.29](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.28...v1.0.0-beta.29) (2023-05-08)
186
+
187
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
188
+
189
+ # [1.0.0-beta.28](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.27...v1.0.0-beta.28) (2023-05-05)
190
+
191
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
192
+
193
+ # [1.0.0-beta.27](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.26...v1.0.0-beta.27) (2023-05-04)
194
+
195
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
196
+
197
+ # [1.0.0-beta.26](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.25...v1.0.0-beta.26) (2023-05-04)
198
+
199
+ ### Features
200
+
201
+ - update packages and migrate to mysql2 ([72ad611](https://github.com/sciactive/nymphjs/commit/72ad611bd2bf7bf85c3ba8a3486503d9b50c49d6))
202
+
203
+ # [1.0.0-beta.25](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.24...v1.0.0-beta.25) (2023-05-04)
204
+
205
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
206
+
207
+ # [1.0.0-beta.24](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.23...v1.0.0-beta.24) (2023-05-02)
208
+
209
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
210
+
211
+ # [1.0.0-beta.23](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.22...v1.0.0-beta.23) (2023-05-02)
212
+
213
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
214
+
215
+ # [1.0.0-beta.22](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.21...v1.0.0-beta.22) (2023-05-01)
216
+
217
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
218
+
219
+ # [1.0.0-beta.21](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.20...v1.0.0-beta.21) (2023-05-01)
220
+
221
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
222
+
223
+ # [1.0.0-beta.20](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.19...v1.0.0-beta.20) (2023-04-30)
224
+
225
+ ### Features
226
+
227
+ - let the user revoke all current auth tokens ([63af3b9](https://github.com/sciactive/nymphjs/commit/63af3b9a31c6c221ab40c2c8a69231675f4634a2))
228
+
229
+ # [1.0.0-beta.19](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.18...v1.0.0-beta.19) (2023-04-29)
230
+
231
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
232
+
233
+ # [1.0.0-beta.18](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.17...v1.0.0-beta.18) (2023-04-27)
234
+
235
+ ### Bug Fixes
236
+
237
+ - small type issues ([b91579c](https://github.com/sciactive/nymphjs/commit/b91579c9c1e96500d903332648f5a93c9a7e7d9b))
238
+
239
+ ### Features
240
+
241
+ - add enforceTilmeld function ([130faf1](https://github.com/sciactive/nymphjs/commit/130faf151dcdfbfacd6814833868907dca037d24))
242
+ - add the ability to switch to a user without their password ([ca4466a](https://github.com/sciactive/nymphjs/commit/ca4466af1704d68905ac087350a8cf151c1072d9))
243
+
244
+ # [1.0.0-beta.17](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.16...v1.0.0-beta.17) (2023-04-24)
245
+
246
+ ### Features
247
+
248
+ - add spa router to user admin app ([25bb344](https://github.com/sciactive/nymphjs/commit/25bb344f4d358eeb2254df98782f1cba229b5f50))
249
+
250
+ # [1.0.0-beta.16](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.15...v1.0.0-beta.16) (2023-03-31)
251
+
252
+ ### Features
253
+
254
+ - add ability to tell tilmeld to log in a specific user during authentication ([922e145](https://github.com/sciactive/nymphjs/commit/922e1452adae44bed2aa9655be16e19796acb39b))
255
+
256
+ # [1.0.0-beta.15](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.14...v1.0.0-beta.15) (2023-03-23)
257
+
258
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
259
+
260
+ # [1.0.0-beta.14](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.13...v1.0.0-beta.14) (2023-03-17)
261
+
262
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
263
+
264
+ # [1.0.0-beta.13](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.12...v1.0.0-beta.13) (2023-03-16)
265
+
266
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
267
+
268
+ # [1.0.0-beta.12](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.11...v1.0.0-beta.12) (2023-03-04)
269
+
270
+ ### Bug Fixes
271
+
272
+ - make sure all default exports are also named exports ([06da9a6](https://github.com/sciactive/nymphjs/commit/06da9a61d444860f70b7f5b95b824547d9880500))
273
+
274
+ # [1.0.0-beta.11](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.10...v1.0.0-beta.11) (2023-02-27)
275
+
276
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
277
+
278
+ # [1.0.0-beta.10](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.9...v1.0.0-beta.10) (2023-01-19)
279
+
280
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
281
+
282
+ # [1.0.0-beta.9](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.8...v1.0.0-beta.9) (2023-01-09)
283
+
284
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
285
+
286
+ # [1.0.0-beta.8](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.7...v1.0.0-beta.8) (2023-01-09)
287
+
288
+ ### Features
289
+
290
+ - make entities in nymph client instance specific too ([1029f06](https://github.com/sciactive/nymphjs/commit/1029f061a1ad193e4a8a2dab0186b9a4b517f646))
291
+
6
292
  # [1.0.0-beta.7](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.6...v1.0.0-beta.7) (2023-01-05)
7
293
 
8
294
  **Note:** Version bump only for package @nymphjs/tilmeld-setup
package/README.md CHANGED
@@ -45,7 +45,7 @@ const nymph = new Nymph(
45
45
  verifyChangeRedirect: 'http://localhost',
46
46
  cancelChangeRedirect: 'http://localhost',
47
47
  jwtSecret: 'shhhhh',
48
- })
48
+ }),
49
49
  );
50
50
 
51
51
  // Create your Express app.
@@ -53,15 +53,16 @@ const app = express();
53
53
 
54
54
  // Use the REST server.
55
55
  app.use('/rest', createServer(nymph));
56
- // Use the Tilmeld Setup App, passing in the Nymph Client Config.
56
+
57
+ // Create Tilmeld setup app.
57
58
  app.use(
58
59
  '/user',
59
60
  setup(
60
61
  {
61
62
  restUrl: 'http://localhost/rest',
62
63
  },
63
- nymph
64
- )
64
+ nymph,
65
+ ),
65
66
  );
66
67
 
67
68
  // Do anything else you need to do...
package/app/index.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  import App from './src/App.svelte';
2
2
 
3
- const app = new App({ target: document.getElementById('app') as HTMLElement });
3
+ document.addEventListener('DOMContentLoaded', () => {
4
+ const app = new App({
5
+ target: document.getElementById('app') as HTMLElement,
6
+ });
4
7
 
5
- // Helps with admin and debugging.
6
- (window as any).app = app;
8
+ // Helps with admin and debugging.
9
+ (window as any).app = app;
10
+ });
@@ -1,4 +1,5 @@
1
1
  <svelte:window on:resize={setMiniWindow} />
2
+
2
3
  <TopAppBar variant="static" class="tilmeld-top-app-bar">
3
4
  <Row>
4
5
  <Section>
@@ -19,7 +20,7 @@
19
20
  rel="noreferrer"
20
21
  title="Nymph/Tilmeld on GitHub"
21
22
  >
22
- <Icon component={Svg} viewBox="0 0 24 24">
23
+ <Icon tag="svg" viewBox="0 0 24 24">
23
24
  <path fill="currentColor" d={mdiGithub} />
24
25
  </Icon>
25
26
  </IconButton>
@@ -29,20 +30,10 @@
29
30
  rel="noreferrer"
30
31
  title="SciActive on Mastodon"
31
32
  >
32
- <Icon component={Svg} viewBox="0 0 24 24">
33
+ <Icon tag="svg" viewBox="0 0 24 24">
33
34
  <path fill="currentColor" d={mdiMastodon} />
34
35
  </Icon>
35
36
  </IconButton>
36
- <IconButton
37
- href="https://twitter.com/SciActive"
38
- target="_blank"
39
- rel="noreferrer"
40
- title="SciActive on Twitter"
41
- >
42
- <Icon component={Svg} viewBox="0 0 24 24">
43
- <path fill="currentColor" d={mdiTwitter} />
44
- </Icon>
45
- </IconButton>
46
37
  <div>
47
38
  <IconButton
48
39
  title="Account"
@@ -74,7 +65,7 @@
74
65
  : 'hide-initial-small'}"
75
66
  >
76
67
  <Content>
77
- <List>
68
+ <List tag="div">
78
69
  {#if tilmeldAdmin}
79
70
  {#each sections as section (section.name)}
80
71
  {#if 'separator' in section}
@@ -82,13 +73,14 @@
82
73
  {:else}
83
74
  <Item
84
75
  bind:this={section.component}
85
- nonInteractive={!('route' in section)}
86
- on:click={() => {
87
- if ('route' in section) {
88
- active = section.route ?? Intro;
89
- }
90
- }}
91
- activated={active === section.route}
76
+ tag="a"
77
+ nonInteractive={!('href' in section)}
78
+ href={'href' in section ? `#${section.href}` : undefined}
79
+ activated={section.absolute
80
+ ? `${currentMatch.route.path}/` === section.href
81
+ : `${currentMatch.route.path}/`.startsWith(
82
+ section.href ?? '!',
83
+ )}
92
84
  style={section.indent
93
85
  ? 'margin-left: ' + section.indent * 25 + 'px;'
94
86
  : ''}
@@ -98,11 +90,11 @@
98
90
  {/if}
99
91
  {/each}
100
92
  {:else if user == null}
101
- <Item on:click={() => (drawerOpen = false)} activated>
93
+ <Item tag="span" on:click={() => (drawerOpen = false)} activated>
102
94
  <Text class="mdc-theme--on-secondary">Login</Text>
103
95
  </Item>
104
96
  {:else}
105
- <Item on:click={() => (drawerOpen = false)} activated>
97
+ <Item tag="span" on:click={() => (drawerOpen = false)} activated>
106
98
  <Text class="mdc-theme--on-secondary">Forbidden</Text>
107
99
  </Item>
108
100
  {/if}
@@ -117,14 +109,20 @@
117
109
  <main class="tilmeld-main-content" bind:this={mainContent}>
118
110
  {#if tilmeldAdmin}
119
111
  {#if clientConfig}
120
- <svelte:component this={active} />
112
+ <svelte:component this={CurrentRoute} {router} {params} />
121
113
  {:else}
122
114
  Loading...
123
115
  {/if}
124
- {:else if user == null}
116
+ {:else if user === null}
125
117
  <section style="display: flex; justify-content: center;">
126
- <Login {User} {clientConfig} />
118
+ <Login
119
+ {User}
120
+ {clientConfig}
121
+ showExistingUserToggle={allowRegistration}
122
+ />
127
123
  </section>
124
+ {:else if user === undefined}
125
+ Loading...
128
126
  {:else}
129
127
  <section>You don't have permission to access this app.</section>
130
128
  {/if}
@@ -134,41 +132,44 @@
134
132
  </div>
135
133
 
136
134
  <script lang="ts">
137
- import { onMount, SvelteComponent } from 'svelte';
138
- import type { ClientConfig, CurrentUserData } from '@nymphjs/tilmeld-client';
139
- import { User } from '@nymphjs/tilmeld-client';
135
+ import type { ComponentType, SvelteComponent } from 'svelte';
136
+ import { onMount } from 'svelte';
137
+ import Navigo from 'navigo';
138
+ import type {
139
+ User as UserClass,
140
+ ClientConfig,
141
+ CurrentUserData,
142
+ } from '@nymphjs/tilmeld-client';
140
143
  import { Login, Account } from '@nymphjs/tilmeld-components';
141
- import { mdiGithub, mdiMastodon, mdiTwitter } from '@mdi/js';
144
+ import { mdiGithub, mdiMastodon } from '@mdi/js';
142
145
  import TopAppBar, { Row, Section, Title } from '@smui/top-app-bar';
143
146
  import Drawer, { Content, Scrim, AppContent } from '@smui/drawer';
144
147
  import IconButton from '@smui/icon-button';
145
148
  import List, { Item, Text, Separator } from '@smui/list';
146
149
  import Menu from '@smui/menu';
147
- import { Icon, Svg } from '@smui/common';
150
+ import { Icon } from '@smui/common';
148
151
 
149
- import Intro from './Intro.svelte';
150
- import Users from './Users.svelte';
151
- import Groups from './Groups.svelte';
152
- import type { SvelteComponentDev } from 'svelte/internal';
152
+ import { User } from './nymph';
153
+ import Intro from './routes/Intro.svelte';
154
+ import Users from './routes/Users.svelte';
155
+ import UserEdit from './routes/UserEdit.svelte';
156
+ import Groups from './routes/Groups.svelte';
157
+ import GroupEdit from './routes/GroupEdit.svelte';
158
+ import NotFound from './routes/NotFound.svelte';
153
159
 
154
160
  const DEFAULT_AVATAR = 'https://secure.gravatar.com/avatar/?d=mm&s=40';
161
+ const allowRegistration = (window as any).allowRegistration;
155
162
 
156
163
  let mainContent: HTMLElement;
157
164
  let miniWindow = false;
158
165
  let drawerOpen = false;
159
166
  let accountMenu: any;
160
- let active: typeof SvelteComponentDev = Intro;
161
167
  let clientConfig: ClientConfig;
162
- let user: (User & CurrentUserData) | undefined = undefined;
168
+ let user: (UserClass & CurrentUserData) | null | undefined = undefined;
163
169
  let userAvatar: string = DEFAULT_AVATAR;
164
170
  let tilmeldAdmin: boolean | undefined = undefined;
165
171
  let accountOpen = false;
166
172
 
167
- $: if (active && mainContent) {
168
- drawerOpen = false;
169
- mainContent.scrollTop = 0;
170
- }
171
-
172
173
  $: if (user) {
173
174
  user.$gatekeeper('tilmeld/admin').then((value) => (tilmeldAdmin = value));
174
175
  user.$getAvatar().then((value) => (userAvatar = value));
@@ -177,18 +178,80 @@
177
178
  userAvatar = DEFAULT_AVATAR;
178
179
  }
179
180
 
181
+ const router = new Navigo('/', { hash: true });
182
+ let CurrentRoute: ComponentType<SvelteComponent> = Intro;
183
+ let params: any = {};
184
+
185
+ router.hooks({
186
+ before(done, match) {
187
+ if (mainContent) {
188
+ drawerOpen = false;
189
+ mainContent.scrollTop = 0;
190
+ }
191
+
192
+ currentMatch = match;
193
+
194
+ done();
195
+ },
196
+ });
197
+
198
+ router.on({
199
+ '/': () => {
200
+ CurrentRoute = Intro;
201
+ params = {};
202
+ },
203
+ '/users/edit/:guid': ({ data }: any) => {
204
+ CurrentRoute = UserEdit;
205
+ params = data;
206
+ },
207
+ '/users/': () => {
208
+ CurrentRoute = Users;
209
+ params = {};
210
+ },
211
+ '/users/:query?': ({ data }: any) => {
212
+ CurrentRoute = Users;
213
+ params = data;
214
+ },
215
+ '/groups/edit/:guid': ({ data }: any) => {
216
+ CurrentRoute = GroupEdit;
217
+ params = data;
218
+ },
219
+ '/groups/': () => {
220
+ CurrentRoute = Groups;
221
+ params = {};
222
+ },
223
+ '/groups/:query?': ({ data }: any) => {
224
+ CurrentRoute = Groups;
225
+ params = data;
226
+ },
227
+ });
228
+
229
+ router.notFound(({ hashString }: any) => {
230
+ if (hashString === '') {
231
+ router.navigate('/', { historyAPIMethod: 'replaceState' });
232
+ } else {
233
+ CurrentRoute = NotFound;
234
+ params = {};
235
+ }
236
+ });
237
+
238
+ let currentMatch = router.getCurrentLocation();
239
+ router.resolve();
240
+
180
241
  const sections: (
181
242
  | {
182
243
  name: string;
183
244
  indent: number;
184
- route?: typeof SvelteComponentDev;
245
+ href?: string;
246
+ absolute?: boolean;
185
247
  component?: SvelteComponent;
186
248
  }
187
249
  | { name: string; separator: true }
188
250
  )[] = [
189
251
  {
190
252
  name: 'Introduction',
191
- route: Intro,
253
+ href: '/',
254
+ absolute: true,
192
255
  indent: 0,
193
256
  },
194
257
  {
@@ -197,31 +260,31 @@
197
260
  },
198
261
  {
199
262
  name: 'Users',
200
- route: Users,
263
+ href: 'users/',
201
264
  indent: 0,
202
265
  },
203
266
  {
204
267
  name: 'Groups',
205
- route: Groups,
268
+ href: 'groups/',
206
269
  indent: 0,
207
270
  },
208
271
  ];
209
272
 
210
- const onLogin = (currentUser: User & CurrentUserData) => {
273
+ const onLogin = (currentUser: UserClass & CurrentUserData) => {
211
274
  user = currentUser;
212
275
  };
213
276
  const onLogout = () => {
214
- user = undefined;
277
+ user = null;
215
278
  };
216
279
 
217
280
  onMount(setMiniWindow);
218
281
  onMount(async () => {
219
282
  User.on('login', onLogin);
220
283
  User.on('logout', onLogout);
221
- user = (await User.current()) ?? undefined;
222
- });
223
- onMount(async () => {
284
+
224
285
  clientConfig = await User.getClientConfig();
286
+
287
+ user = await User.current();
225
288
  });
226
289
 
227
290
  function setMiniWindow() {
@@ -1,17 +1,21 @@
1
1
  import type { NymphOptions } from '@nymphjs/client';
2
2
  import { Entity, Nymph } from '@nymphjs/client';
3
- import { User, Group } from '@nymphjs/tilmeld-client';
3
+ import {
4
+ User as UserClass,
5
+ Group as GroupClass,
6
+ } from '@nymphjs/tilmeld-client';
4
7
 
5
8
  const nymph = new Nymph(
6
- (window as unknown as { nymphOptions: NymphOptions }).nymphOptions
9
+ (window as unknown as { nymphOptions: NymphOptions }).nymphOptions,
7
10
  );
8
- nymph.addEntityClass(User);
9
- nymph.addEntityClass(Group);
10
-
11
- export default nymph;
11
+ const User = nymph.addEntityClass(UserClass);
12
+ const Group = nymph.addEntityClass(GroupClass);
13
+ User.init(nymph);
12
14
 
13
15
  // Helps with admin and debugging.
14
16
  (window as any).Entity = Entity;
15
17
  (window as any).User = User;
16
18
  (window as any).Group = Group;
17
19
  (window as any).nymph = nymph;
20
+
21
+ export { nymph, User, Group };