@axium/calendar 0.4.1 → 0.4.3

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/common.d.ts CHANGED
@@ -137,7 +137,6 @@ export declare const Calendar: z.ZodObject<{
137
137
  name: z.ZodString;
138
138
  email: z.ZodOptional<z.ZodEmail>;
139
139
  emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
140
- image: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
141
140
  preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
142
141
  debug: z.ZodDefault<z.ZodBoolean>;
143
142
  }, z.core.$strip>>>;
@@ -179,7 +178,6 @@ declare const CalendarAPI: {
179
178
  name: z.ZodString;
180
179
  email: z.ZodOptional<z.ZodEmail>;
181
180
  emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
182
- image: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
183
181
  preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
184
182
  debug: z.ZodDefault<z.ZodBoolean>;
185
183
  }, z.core.$strip>>>;
@@ -208,7 +206,6 @@ declare const CalendarAPI: {
208
206
  name: z.ZodString;
209
207
  email: z.ZodOptional<z.ZodEmail>;
210
208
  emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
211
- image: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
212
209
  preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
213
210
  debug: z.ZodDefault<z.ZodBoolean>;
214
211
  }, z.core.$strip>>>;
@@ -239,7 +236,6 @@ declare const CalendarAPI: {
239
236
  name: z.ZodString;
240
237
  email: z.ZodOptional<z.ZodEmail>;
241
238
  emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
242
- image: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
243
239
  preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
244
240
  debug: z.ZodDefault<z.ZodBoolean>;
245
241
  }, z.core.$strip>>>;
@@ -271,7 +267,6 @@ declare const CalendarAPI: {
271
267
  name: z.ZodString;
272
268
  email: z.ZodOptional<z.ZodEmail>;
273
269
  emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
274
- image: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
275
270
  preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
276
271
  debug: z.ZodDefault<z.ZodBoolean>;
277
272
  }, z.core.$strip>>>;
@@ -300,7 +295,6 @@ declare const CalendarAPI: {
300
295
  name: z.ZodString;
301
296
  email: z.ZodOptional<z.ZodEmail>;
302
297
  emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
303
- image: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
304
298
  preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
305
299
  debug: z.ZodDefault<z.ZodBoolean>;
306
300
  }, z.core.$strip>>>;
package/locales/en.json CHANGED
@@ -35,6 +35,9 @@
35
35
  "yearly": "Every year on {date}"
36
36
  },
37
37
  "submit_edit": "Update",
38
- "title_placeholder": "Add title"
38
+ "title_placeholder": "Add title",
39
+ "discovery_placeholder": "Add attendees",
40
+ "discovery_invalid": "Can't determine attendee \"{target}\"",
41
+ "discovery_unsupported": "Specifying attendees without an email is not supported yet"
39
42
  }
40
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/calendar",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "author": "James Prevett <axium@jamespre.dev>",
5
5
  "description": "Calendar for Axium",
6
6
  "funding": {
@@ -36,8 +36,8 @@
36
36
  "build": "tsc"
37
37
  },
38
38
  "peerDependencies": {
39
- "@axium/client": ">=0.17.0",
40
- "@axium/core": ">=0.20.0",
39
+ "@axium/client": ">=0.23.0",
40
+ "@axium/core": ">=0.23.0",
41
41
  "@axium/server": ">=0.36.0",
42
42
  "@sveltejs/kit": "^2.27.3",
43
43
  "utilium": "^2.7.0"
@@ -16,7 +16,8 @@
16
16
  import * as Cal from '@axium/calendar/components';
17
17
  import { fetchAPI, text } from '@axium/client';
18
18
  import { contextMenu, dynamicRows } from '@axium/client/attachments';
19
- import { AccessControlDialog, ColorPicker, FormDialog, Icon, Popover, UserDiscovery } from '@axium/client/components';
19
+ import { AccessControlDialog, ColorPicker, Discovery, discovery, FormDialog, Icon, Popover } from '@axium/client/components';
20
+ import { toast } from '@axium/client/toast';
20
21
  import { colorHashHex, encodeColor } from '@axium/core/color';
21
22
  import { rrulestr } from 'rrule';
22
23
  import { useSwipe } from 'svelte-gestures';
@@ -182,7 +183,7 @@
182
183
  <span>{text('generic.delete')}</span>
183
184
  </div>
184
185
  </Popover>
185
- <AccessControlDialog editable itemType="calendars" item={cal} bind:dialog={dialogs['share:' + cal.id]} />
186
+ <AccessControlDialog itemType="calendars" item={cal} bind:dialog={dialogs['share:' + cal.id]} {user} />
186
187
  <FormDialog
187
188
  bind:dialog={dialogs['delete:' + cal.id]}
188
189
  submitText={text('generic.delete')}
@@ -370,17 +371,18 @@
370
371
  <div class="attendees-container">
371
372
  <label for="eventInit.attendee"><Icon i="user-group" /></label>
372
373
  <div class="attendees">
373
- <UserDiscovery
374
- noRoles
375
- allowExact
376
- onSelect={target => {
377
- const { data: userId } = z.uuid().safeParse(target);
378
- const { data: email } = z.email().safeParse(target);
379
- if (!userId && !email) throw 'Can not determine attendee: ' + target;
380
- if (!email) throw 'Specifying attendees without an email is not supported yet';
374
+ <Discovery
375
+ onSelect={result => {
376
+ const { id: userId, email } =
377
+ result.type == 'user' ? result.user : { id: null, email: z.email().safeParse(result.target).data };
378
+ if (!userId && !email) return toast('error', text('event_init.discovery_invalid', result));
379
+ if (!email) return toast('info', text('event_init.discovery_unsupported'));
380
+
381
381
  // @todo supports roles and also contacts
382
382
  eventInit.attendees.push({ userId, email });
383
383
  }}
384
+ sources={[discovery.user, discovery.exact]}
385
+ placeholder={text('event_init.discovery_placeholder')}
384
386
  />
385
387
  {#each eventInit.attendees as attendee (attendee.email)}
386
388
  <div class="attendee">{attendee.email}</div>