@axium/calendar 0.5.1 → 0.5.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,6 +137,7 @@ export declare const Calendar: z.ZodObject<{
137
137
  user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
138
138
  id: z.ZodUUID;
139
139
  name: z.ZodString;
140
+ username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
140
141
  email: z.ZodOptional<z.ZodEmail>;
141
142
  emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
142
143
  preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
@@ -180,6 +181,7 @@ declare const CalendarAPI: {
180
181
  user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
181
182
  id: z.ZodUUID;
182
183
  name: z.ZodString;
184
+ username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
183
185
  email: z.ZodOptional<z.ZodEmail>;
184
186
  emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
185
187
  preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
@@ -209,6 +211,7 @@ declare const CalendarAPI: {
209
211
  user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
210
212
  id: z.ZodUUID;
211
213
  name: z.ZodString;
214
+ username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
212
215
  email: z.ZodOptional<z.ZodEmail>;
213
216
  emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
214
217
  preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
@@ -240,6 +243,7 @@ declare const CalendarAPI: {
240
243
  user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
241
244
  id: z.ZodUUID;
242
245
  name: z.ZodString;
246
+ username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
243
247
  email: z.ZodOptional<z.ZodEmail>;
244
248
  emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
245
249
  preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
@@ -273,6 +277,7 @@ declare const CalendarAPI: {
273
277
  user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
274
278
  id: z.ZodUUID;
275
279
  name: z.ZodString;
280
+ username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
276
281
  email: z.ZodOptional<z.ZodEmail>;
277
282
  emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
278
283
  preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
@@ -302,6 +307,7 @@ declare const CalendarAPI: {
302
307
  user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
303
308
  id: z.ZodUUID;
304
309
  name: z.ZodString;
310
+ username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
305
311
  email: z.ZodOptional<z.ZodEmail>;
306
312
  emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
307
313
  preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
package/lib/Event.svelte CHANGED
@@ -32,8 +32,8 @@
32
32
 
33
33
  <Popover {id} onclick={e => e.stopPropagation()}>
34
34
  {#snippet toggle()}
35
- {@const start = event.start.getHours() * 60 + event.start.getMinutes()}
36
- {@const end = event.end.getHours() * 60 + event.end.getMinutes()}
35
+ {const start = $derived(event.start.getHours() * 60 + event.start.getMinutes()),
36
+ end = $derived(event.end.getHours() * 60 + event.end.getMinutes())}
37
37
  <div
38
38
  class="Event"
39
39
  style:top="{start / 14.4}%"
package/lib/Select.svelte CHANGED
@@ -38,11 +38,11 @@
38
38
  <div class="empty"></div>
39
39
  {/each}
40
40
  {#each { length: lastOfMonth.getDate() }, i}
41
- {@const day = i + 1}
42
- {@const year = view.getFullYear()}
43
- {@const month = view.getMonth()}
44
- {@const date = new Date(year, month, day)}
45
- {@const WofY = weekOfYear(date, true)}
41
+ {const day = $derived(i + 1),
42
+ year = $derived(view.getFullYear()),
43
+ month = $derived(view.getMonth()),
44
+ date = $derived(new Date(year, month, day)),
45
+ WofY = $derived(weekOfYear(date, true))}
46
46
  {#if date.getDay() == 0 && WofY != firstWeekOfMonth}
47
47
  <div class={['w-of-y', WofY == weekOfYear(today, true) && 'current']}>{WofY}</div>
48
48
  {/if}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/calendar",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "author": "James Prevett <axium@jamespre.dev>",
5
5
  "description": "Calendar for Axium",
6
6
  "funding": {
@@ -28,10 +28,10 @@
28
28
  new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), Math.round(now.getMinutes() / 30) * 30, 0, 0)
29
29
  );
30
30
 
31
- let start = new SvelteDate(data.filter.start);
32
- let end = new SvelteDate(data.filter.end);
33
- let calendars = $state(data.calendars);
34
- let events = $state<Event[]>([]);
31
+ let start = new SvelteDate(data.filter.start),
32
+ end = new SvelteDate(data.filter.end),
33
+ calendars = $state(data.calendars),
34
+ events = $state<Event[]>([]);
35
35
 
36
36
  $effect(() => {
37
37
  for (const cal of calendars) cal.color ||= encodeColor(colorHashHex(cal.name));
@@ -146,7 +146,7 @@
146
146
  </button>
147
147
  </div>
148
148
  {#each calendars.filter(cal => cal.userId == user.id) as cal (cal.id)}
149
- {@const edit = () => {
149
+ {const edit = () => {
150
150
  calEditId = cal.id;
151
151
  calInit = cal;
152
152
  document.querySelector<HTMLDialogElement>('#cal-init')!.showModal();
@@ -224,7 +224,7 @@
224
224
  <h4>{text('calendar.list_shared')}</h4>
225
225
  </div>
226
226
  {#each calendars.filter(cal => cal.userId != user.id) as cal (cal.id)}
227
- {@const { list, icon } = getCalPermissionsInfo(cal, user)}
227
+ {const { list, icon } = $derived(getCalPermissionsInfo(cal, user))}
228
228
  <dfn title={list}>
229
229
  <Icon i={icon} />
230
230
  </dfn>
@@ -263,14 +263,16 @@
263
263
  <span class="hour empty"></span>
264
264
  </div>
265
265
  {#if span == 'week'}
266
- {@const eventsForWeekDays = Object.groupBy(
267
- events.filter(
268
- e =>
269
- !hiddenCalIds.has(e.calId) &&
270
- e.start < new Date(weekDays[6].getFullYear(), weekDays[6].getMonth(), weekDays[6].getDate() + 1) &&
271
- e.end > weekDays[0]
272
- ),
273
- ev => ev.start.getDay()
266
+ {const eventsForWeekDays = $derived(
267
+ Object.groupBy(
268
+ events.filter(
269
+ e =>
270
+ !hiddenCalIds.has(e.calId) &&
271
+ e.start < new Date(weekDays[6].getFullYear(), weekDays[6].getMonth(), weekDays[6].getDate() + 1) &&
272
+ e.end > weekDays[0]
273
+ ),
274
+ ev => ev.start.getDay()
275
+ )
274
276
  )}
275
277
  <div class="cal-content week">
276
278
  {#each weekDays as day, i}
@@ -409,8 +411,7 @@
409
411
  id="eventInit.description"
410
412
  placeholder={text('event_init.description_placeholder')}
411
413
  bind:value={eventInit.description}
412
- {@attach dynamicRows()}
413
- ></textarea>
414
+ {@attach dynamicRows()}></textarea>
414
415
  </div>
415
416
  </FormDialog>
416
417
 
@@ -64,7 +64,7 @@
64
64
  bind:dialog
65
65
  id="recurrence-custom"
66
66
  submitText={text('RecurrenceDialog.confirm')}
67
- submit={async () => (eventInit.recurrence = buildRRule())}
67
+ submit={() => (eventInit.recurrence = buildRRule())}
68
68
  >
69
69
  {#snippet header()}
70
70
  <h3>{text('RecurrenceDialog.title')}</h3>
@@ -117,7 +117,7 @@
117
117
 
118
118
  <div class="end-section">
119
119
  <span class="subtle">{text('RecurrenceDialog.end.label')}</span>
120
- <label>
120
+ <label class="end-row">
121
121
  <input type="radio" bind:group={endType} value="never" />
122
122
  {text('RecurrenceDialog.end.never')}
123
123
  </label>
@@ -29,9 +29,10 @@
29
29
  value={recurrenceKind}
30
30
  onchange={e => {
31
31
  const { value } = e.currentTarget;
32
- if (value === 'custom')
32
+ if (value === 'custom') {
33
33
  e.currentTarget.value = recurrenceKind; // to prevent "Custom..." being shown when dialog cancelled
34
- else if (value in recurrences) eventInit.recurrence = recurrences[value as keyof typeof recurrences];
34
+ dialog?.showModal();
35
+ } else if (value in recurrences) eventInit.recurrence = recurrences[value as keyof typeof recurrences];
35
36
  }}
36
37
  >
37
38
  <option value="none">{text('event_init.recurrence.none')}</option>
@@ -50,7 +51,7 @@
50
51
  date: eventInit.start.toLocaleDateString('default', { month: 'long', day: 'numeric' }),
51
52
  })}
52
53
  </option>
53
- <option value="custom" onclick={() => dialog?.showModal()}>
54
+ <option value="custom">
54
55
  {text('event_init.recurrence.custom')}
55
56
  </option>
56
57
  </select>
@@ -70,7 +70,7 @@ div.attendees {
70
70
  }
71
71
  }
72
72
 
73
- :is(input, select, textarea):not(.recurrence-dialog *) {
73
+ :is(input, select, textarea):not(#recurrence-custom *) {
74
74
  width: 100%;
75
75
  }
76
76