@axium/calendar 0.5.1 → 0.5.4

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,10 +137,12 @@ 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
- email: z.ZodOptional<z.ZodEmail>;
140
+ username: z.ZodString;
141
+ email: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodEmail>>>;
141
142
  emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
142
143
  preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
143
144
  debug: z.ZodDefault<z.ZodBoolean>;
145
+ theme: z.ZodDefault<z.ZodLiteral<"default" | "light" | "forest" | "midnight" | "beach" | "cherry" | "volcano">>;
144
146
  }, z.core.$strip>>>;
145
147
  roles: z.ZodArray<z.ZodString>;
146
148
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -180,10 +182,12 @@ declare const CalendarAPI: {
180
182
  user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
181
183
  id: z.ZodUUID;
182
184
  name: z.ZodString;
183
- email: z.ZodOptional<z.ZodEmail>;
185
+ username: z.ZodString;
186
+ email: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodEmail>>>;
184
187
  emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
185
188
  preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
186
189
  debug: z.ZodDefault<z.ZodBoolean>;
190
+ theme: z.ZodDefault<z.ZodLiteral<"default" | "light" | "forest" | "midnight" | "beach" | "cherry" | "volcano">>;
187
191
  }, z.core.$strip>>>;
188
192
  roles: z.ZodArray<z.ZodString>;
189
193
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -209,10 +213,12 @@ declare const CalendarAPI: {
209
213
  user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
210
214
  id: z.ZodUUID;
211
215
  name: z.ZodString;
212
- email: z.ZodOptional<z.ZodEmail>;
216
+ username: z.ZodString;
217
+ email: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodEmail>>>;
213
218
  emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
214
219
  preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
215
220
  debug: z.ZodDefault<z.ZodBoolean>;
221
+ theme: z.ZodDefault<z.ZodLiteral<"default" | "light" | "forest" | "midnight" | "beach" | "cherry" | "volcano">>;
216
222
  }, z.core.$strip>>>;
217
223
  roles: z.ZodArray<z.ZodString>;
218
224
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -240,10 +246,12 @@ declare const CalendarAPI: {
240
246
  user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
241
247
  id: z.ZodUUID;
242
248
  name: z.ZodString;
243
- email: z.ZodOptional<z.ZodEmail>;
249
+ username: z.ZodString;
250
+ email: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodEmail>>>;
244
251
  emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
245
252
  preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
246
253
  debug: z.ZodDefault<z.ZodBoolean>;
254
+ theme: z.ZodDefault<z.ZodLiteral<"default" | "light" | "forest" | "midnight" | "beach" | "cherry" | "volcano">>;
247
255
  }, z.core.$strip>>>;
248
256
  roles: z.ZodArray<z.ZodString>;
249
257
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -273,10 +281,12 @@ declare const CalendarAPI: {
273
281
  user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
274
282
  id: z.ZodUUID;
275
283
  name: z.ZodString;
276
- email: z.ZodOptional<z.ZodEmail>;
284
+ username: z.ZodString;
285
+ email: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodEmail>>>;
277
286
  emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
278
287
  preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
279
288
  debug: z.ZodDefault<z.ZodBoolean>;
289
+ theme: z.ZodDefault<z.ZodLiteral<"default" | "light" | "forest" | "midnight" | "beach" | "cherry" | "volcano">>;
280
290
  }, z.core.$strip>>>;
281
291
  roles: z.ZodArray<z.ZodString>;
282
292
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -302,10 +312,12 @@ declare const CalendarAPI: {
302
312
  user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
303
313
  id: z.ZodUUID;
304
314
  name: z.ZodString;
305
- email: z.ZodOptional<z.ZodEmail>;
315
+ username: z.ZodString;
316
+ email: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodEmail>>>;
306
317
  emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
307
318
  preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
308
319
  debug: z.ZodDefault<z.ZodBoolean>;
320
+ theme: z.ZodDefault<z.ZodLiteral<"default" | "light" | "forest" | "midnight" | "beach" | "cherry" | "volcano">>;
309
321
  }, z.core.$strip>>>;
310
322
  roles: z.ZodArray<z.ZodString>;
311
323
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
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/lib/tsconfig.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "moduleResolution": "Bundler",
8
8
  "types": ["@sveltejs/kit"]
9
9
  },
10
- "include": ["**/*.svelte", "**/*.ts"],
10
+ "include": ["**/*.svelte", "**/*.ts", "../src/.*.ts", "../../client/dist/.*.ts"],
11
11
  "exclude": [],
12
12
  "references": [{ "path": ".." }]
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/calendar",
3
- "version": "0.5.1",
3
+ "version": "0.5.4",
4
4
  "author": "James Prevett <axium@jamespre.dev>",
5
5
  "description": "Calendar for Axium",
6
6
  "funding": {
@@ -38,8 +38,8 @@
38
38
  "build": "tsc"
39
39
  },
40
40
  "peerDependencies": {
41
- "@axium/client": ">=0.23.0",
42
- "@axium/core": ">=0.23.0",
41
+ "@axium/client": ">=0.37.0",
42
+ "@axium/core": ">=0.39.0",
43
43
  "@axium/server": ">=0.47.0",
44
44
  "@sveltejs/kit": "^2.27.3",
45
45
  "kysely": "^0.29.0",
@@ -51,11 +51,12 @@
51
51
  "zod": "^4.0.5"
52
52
  },
53
53
  "axium": {
54
+ "locales": "locales",
54
55
  "server": {
55
56
  "routes": "routes",
56
57
  "hooks": "./dist/server/hooks.js",
57
58
  "db": "./db.json",
58
- "web_client_hooks": "./dist/client/web_hook.js"
59
+ "web_client_hooks": "./dist/common.js"
59
60
  },
60
61
  "apps": [
61
62
  {
@@ -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
 
@@ -7,6 +7,6 @@
7
7
  "target": "esnext",
8
8
  "rootDir": ".."
9
9
  },
10
- "include": ["**/*", "../lib/*"],
10
+ "include": ["**/*", "../lib/*", "../src/.*.ts", "../../client/dist/.*.ts"],
11
11
  "references": [{ "path": ".." }]
12
12
  }
@@ -1,8 +0,0 @@
1
- import en from '../../locales/en.json';
2
- import '../common.js';
3
- type en = typeof en;
4
- declare module '@axium/client/locales' {
5
- interface Locale extends en {
6
- }
7
- }
8
- export {};
@@ -1,4 +0,0 @@
1
- import { extendLocale } from '@axium/client';
2
- import en from '../../locales/en.json' with { type: 'json' };
3
- import '../common.js';
4
- extendLocale('en', en);