@nymphjs/tilmeld-setup 1.0.0-beta.121 → 1.0.0-beta.123

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.
@@ -7,7 +7,8 @@
7
7
  {:else}
8
8
  <div class="solo-search-container solo-container">
9
9
  <Fab
10
- href="#/groups/edit/+"
10
+ href="/groups/edit/+"
11
+ use={[link]}
11
12
  color="primary"
12
13
  mini
13
14
  class="solo-fab"
@@ -74,27 +75,30 @@
74
75
  {#if !$clientConfig.emailUsernames}
75
76
  <Cell
76
77
  ><a
77
- href="#/groups/edit/{encodeURIComponent(
78
+ href="/groups/edit/{encodeURIComponent(
78
79
  curEntity.guid || '',
79
- )}">{curEntity.groupname}</a
80
+ )}"
81
+ use:link>{curEntity.groupname}</a
80
82
  ></Cell
81
83
  >
82
84
  {/if}
83
85
  {#if $clientConfig.userFields.includes('name')}
84
86
  <Cell
85
87
  ><a
86
- href="#/groups/edit/{encodeURIComponent(
88
+ href="/groups/edit/{encodeURIComponent(
87
89
  curEntity.guid || '',
88
- )}">{curEntity.name}</a
90
+ )}"
91
+ use:link>{curEntity.name}</a
89
92
  ></Cell
90
93
  >
91
94
  {/if}
92
95
  {#if $clientConfig.userFields.includes('email')}
93
96
  <Cell
94
97
  ><a
95
- href="#/groups/edit/{encodeURIComponent(
98
+ href="/groups/edit/{encodeURIComponent(
96
99
  curEntity.guid || '',
97
- )}">{curEntity.email}</a
100
+ )}"
101
+ use:link>{curEntity.email}</a
98
102
  ></Cell
99
103
  >
100
104
  {/if}
@@ -119,7 +123,8 @@
119
123
 
120
124
  <script lang="ts">
121
125
  import type { Writable } from 'svelte/store';
122
- import type Navigo from 'navigo';
126
+ import { getContext } from 'svelte';
127
+ import { link, push } from 'svelte-spa-router';
123
128
  import queryParser from '@nymphjs/query-parser';
124
129
  import type {
125
130
  AdminGroupData,
@@ -138,23 +143,20 @@
138
143
  import Fab from '@smui/fab';
139
144
  import { Icon } from '@smui/common';
140
145
 
141
- import { nymph, Group, User } from '../nymph';
146
+ import { nymph, Group, User } from '../nymph.js';
142
147
 
143
- let {
144
- router,
145
- params,
146
- clientConfig,
147
- user,
148
- }: {
149
- router: Navigo;
150
- params: { query?: string };
151
- clientConfig: Writable<ClientConfig | undefined>;
152
- user: Writable<(UserClass & CurrentUserData) | null | undefined>;
153
- } = $props();
148
+ let { params }: { params: { query?: string } } = $props();
154
149
 
155
- let entitySearch = $state(params.query ?? '');
150
+ let entitySearch = $derived(params.query ?? '');
156
151
  let failureMessage: string | undefined = $state();
157
152
 
153
+ const clientConfig =
154
+ getContext<Writable<ClientConfig | undefined>>('clientConfigStore');
155
+ const user =
156
+ getContext<Writable<(UserClass & CurrentUserData) | null | undefined>>(
157
+ 'userStore',
158
+ );
159
+
158
160
  $effect(() => {
159
161
  if (params) {
160
162
  handleSearchParam();
@@ -192,7 +194,7 @@
192
194
  let entitiesSearching = $state(false);
193
195
  let entities: (GroupClass & AdminGroupData)[] | undefined = $state();
194
196
  async function searchEntities() {
195
- router.navigate(`/groups/${encodeURIComponent(entitySearch)}`);
197
+ push(`/groups/${encodeURIComponent(entitySearch)}`);
196
198
  }
197
199
  function entitySearchKeyDown(event: CustomEvent | KeyboardEvent) {
198
200
  event = event as KeyboardEvent;
@@ -6,10 +6,7 @@
6
6
  </section>
7
7
  {:else}
8
8
  <div style="display: flex; align-items: center; padding: 12px;">
9
- <IconButton
10
- title="Back"
11
- onclick={() => router.navigate('', { historyAPIMethod: 'back' })}
12
- >
9
+ <IconButton title="Back" onclick={() => pop()}>
13
10
  <Icon tag="svg" viewBox="0 0 24 24">
14
11
  <path fill="currentColor" d={mdiArrowLeft} />
15
12
  </Icon>
@@ -191,7 +188,9 @@
191
188
  {#if !$entity.group}
192
189
  No primary group
193
190
  {:else}
194
- <a href="#/groups/edit/{encodeURIComponent($entity.group.guid || '')}"
191
+ <a
192
+ href="/groups/edit/{encodeURIComponent($entity.group.guid || '')}"
193
+ use:link
195
194
  >{$clientConfig.userFields.includes('name')
196
195
  ? $entity.group.name + ' (' + $entity.group.groupname + ')'
197
196
  : $entity.group.groupname}</a
@@ -308,27 +307,30 @@
308
307
  {#if !$clientConfig.emailUsernames}
309
308
  <Cell
310
309
  ><a
311
- href="#/groups/edit/{encodeURIComponent(
310
+ href="/groups/edit/{encodeURIComponent(
312
311
  curEntity.guid || '',
313
- )}">{curEntity.groupname}</a
312
+ )}"
313
+ use:link>{curEntity.groupname}</a
314
314
  ></Cell
315
315
  >
316
316
  {/if}
317
317
  {#if $clientConfig.userFields.includes('name')}
318
318
  <Cell
319
319
  ><a
320
- href="#/groups/edit/{encodeURIComponent(
320
+ href="/groups/edit/{encodeURIComponent(
321
321
  curEntity.guid || '',
322
- )}">{curEntity.name}</a
322
+ )}"
323
+ use:link>{curEntity.name}</a
323
324
  ></Cell
324
325
  >
325
326
  {/if}
326
327
  {#if $clientConfig.userFields.includes('email')}
327
328
  <Cell
328
329
  ><a
329
- href="#/groups/edit/{encodeURIComponent(
330
+ href="/groups/edit/{encodeURIComponent(
330
331
  curEntity.guid || '',
331
- )}">{curEntity.email}</a
332
+ )}"
333
+ use:link>{curEntity.email}</a
332
334
  ></Cell
333
335
  >
334
336
  {/if}
@@ -763,7 +765,8 @@
763
765
  import { onMount } from 'svelte';
764
766
  import type { Writable } from 'svelte/store';
765
767
  import { writable } from 'svelte/store';
766
- import type Navigo from 'navigo';
768
+ import { getContext } from 'svelte';
769
+ import { link, pop, replace } from 'svelte-spa-router';
767
770
  import type {
768
771
  AdminGroupData,
769
772
  AdminUserData,
@@ -798,19 +801,9 @@
798
801
  import Dialog, { Title, Content, Actions } from '@smui/dialog';
799
802
  import { Icon, Label } from '@smui/common';
800
803
 
801
- import { User, Group } from '../nymph';
804
+ import { User, Group } from '../nymph.js';
802
805
 
803
- let {
804
- router,
805
- params,
806
- clientConfig,
807
- user,
808
- }: {
809
- router: Navigo;
810
- params: { guid: string };
811
- clientConfig: Writable<ClientConfig | undefined>;
812
- user: Writable<(UserClass & CurrentUserData) | null | undefined>;
813
- } = $props();
806
+ let { params }: { params: { guid: string } } = $props();
814
807
 
815
808
  let entity: Writable<UserClass & AdminUserData> = writable(
816
809
  User.factorySync(),
@@ -838,6 +831,13 @@
838
831
  let success: boolean | undefined = $state();
839
832
  let loading = $state(true);
840
833
 
834
+ const clientConfig =
835
+ getContext<Writable<ClientConfig | undefined>>('clientConfigStore');
836
+ const user =
837
+ getContext<Writable<(UserClass & CurrentUserData) | null | undefined>>(
838
+ 'userStore',
839
+ );
840
+
841
841
  $effect(() => {
842
842
  if (params) {
843
843
  handleGuidParam();
@@ -1138,22 +1138,16 @@
1138
1138
  failureMessage = undefined;
1139
1139
  const newEntity = $entity.guid == null;
1140
1140
  try {
1141
- if (await $entity.$save()) {
1142
- await readyEntity();
1143
- success = true;
1144
- passwordVerify = '';
1145
- if (newEntity) {
1146
- router.navigate(
1147
- `/users/edit/${encodeURIComponent($entity.guid || '')}`,
1148
- { historyAPIMethod: 'replaceState' },
1149
- );
1150
- }
1151
- setTimeout(() => {
1152
- success = undefined;
1153
- }, 1000);
1154
- } else {
1155
- failureMessage = 'Error saving user.';
1141
+ await $entity.$save();
1142
+ await readyEntity();
1143
+ success = true;
1144
+ passwordVerify = '';
1145
+ if (newEntity) {
1146
+ replace(`/users/edit/${encodeURIComponent($entity.guid || '')}`);
1156
1147
  }
1148
+ setTimeout(() => {
1149
+ success = undefined;
1150
+ }, 1000);
1157
1151
  } catch (e: any) {
1158
1152
  console.log('error:', e);
1159
1153
  failureMessage = e?.message;
@@ -1166,11 +1160,8 @@
1166
1160
  if (confirm('Are you sure you want to delete this?')) {
1167
1161
  saving = true;
1168
1162
  try {
1169
- if (await $entity.$delete()) {
1170
- router.navigate('', { historyAPIMethod: 'back' });
1171
- } else {
1172
- failureMessage = 'An error occurred.';
1173
- }
1163
+ await $entity.$delete();
1164
+ pop();
1174
1165
  } catch (e: any) {
1175
1166
  failureMessage = e?.message;
1176
1167
  }
@@ -7,7 +7,8 @@
7
7
  {:else}
8
8
  <div class="solo-search-container solo-container">
9
9
  <Fab
10
- href="#/users/edit/+"
10
+ href="/users/edit/+"
11
+ use={[link]}
11
12
  color="primary"
12
13
  mini
13
14
  class="solo-fab"
@@ -74,27 +75,30 @@
74
75
  {#if !$clientConfig.emailUsernames}
75
76
  <Cell
76
77
  ><a
77
- href="#/users/edit/{encodeURIComponent(
78
+ href="/users/edit/{encodeURIComponent(
78
79
  curEntity.guid || '',
79
- )}">{curEntity.username}</a
80
+ )}"
81
+ use:link>{curEntity.username}</a
80
82
  ></Cell
81
83
  >
82
84
  {/if}
83
85
  {#if $clientConfig.userFields.includes('name')}
84
86
  <Cell
85
87
  ><a
86
- href="#/users/edit/{encodeURIComponent(
88
+ href="/users/edit/{encodeURIComponent(
87
89
  curEntity.guid || '',
88
- )}">{curEntity.name}</a
90
+ )}"
91
+ use:link>{curEntity.name}</a
89
92
  ></Cell
90
93
  >
91
94
  {/if}
92
95
  {#if $clientConfig.userFields.includes('email')}
93
96
  <Cell
94
97
  ><a
95
- href="#/users/edit/{encodeURIComponent(
98
+ href="/users/edit/{encodeURIComponent(
96
99
  curEntity.guid || '',
97
- )}">{curEntity.email}</a
100
+ )}"
101
+ use:link>{curEntity.email}</a
98
102
  ></Cell
99
103
  >
100
104
  {/if}
@@ -119,7 +123,8 @@
119
123
 
120
124
  <script lang="ts">
121
125
  import type { Writable } from 'svelte/store';
122
- import type Navigo from 'navigo';
126
+ import { getContext } from 'svelte';
127
+ import { link, push } from 'svelte-spa-router';
123
128
  import queryParser from '@nymphjs/query-parser';
124
129
  import type {
125
130
  AdminUserData,
@@ -138,23 +143,20 @@
138
143
  import Fab from '@smui/fab';
139
144
  import { Icon } from '@smui/common';
140
145
 
141
- import { nymph, User, Group } from '../nymph';
146
+ import { nymph, User, Group } from '../nymph.js';
142
147
 
143
- let {
144
- router,
145
- params,
146
- clientConfig,
147
- user,
148
- }: {
149
- router: Navigo;
150
- params: { query?: string };
151
- clientConfig: Writable<ClientConfig | undefined>;
152
- user: Writable<(UserClass & CurrentUserData) | null | undefined>;
153
- } = $props();
148
+ let { params }: { params: { query?: string } } = $props();
154
149
 
155
- let entitySearch = $state(params.query ?? '');
150
+ let entitySearch = $derived(params.query ?? '');
156
151
  let failureMessage: string | undefined = $state();
157
152
 
153
+ const clientConfig =
154
+ getContext<Writable<ClientConfig | undefined>>('clientConfigStore');
155
+ const user =
156
+ getContext<Writable<(UserClass & CurrentUserData) | null | undefined>>(
157
+ 'userStore',
158
+ );
159
+
158
160
  $effect(() => {
159
161
  if (params) {
160
162
  handleSearchParam();
@@ -192,7 +194,7 @@
192
194
  let entitiesSearching = $state(false);
193
195
  let entities: (UserClass & AdminUserData)[] | undefined = $state();
194
196
  async function searchEntities() {
195
- router.navigate(`/users/${encodeURIComponent(entitySearch)}`);
197
+ push(`/users/${encodeURIComponent(entitySearch)}`);
196
198
  }
197
199
  function entitySearchKeyDown(event: CustomEvent | KeyboardEvent) {
198
200
  event = event as KeyboardEvent;