@fieldia/calendar 0.0.0-stage → 0.23.0

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.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +125 -2
  3. package/package.json +37 -3
  4. package/src/index.d.mts +3 -0
  5. package/src/index.d.ts +3 -0
  6. package/src/index.js +6 -0
  7. package/src/index.js.map +1 -0
  8. package/src/index.mjs +2 -0
  9. package/src/index.mjs.map +1 -0
  10. package/src/lib/calendar-core.d.mts +83 -0
  11. package/src/lib/calendar-core.d.ts +83 -0
  12. package/src/lib/calendar-core.js +18 -0
  13. package/src/lib/calendar-core.js.map +1 -0
  14. package/src/lib/calendar-core.mjs +13 -0
  15. package/src/lib/calendar-core.mjs.map +1 -0
  16. package/src/lib/calendar-view.d.mts +11 -0
  17. package/src/lib/calendar-view.d.ts +11 -0
  18. package/src/lib/calendar-view.js +829 -0
  19. package/src/lib/calendar-view.js.map +1 -0
  20. package/src/lib/calendar-view.mjs +826 -0
  21. package/src/lib/calendar-view.mjs.map +1 -0
  22. package/src/lib/dates.d.mts +43 -0
  23. package/src/lib/dates.d.ts +43 -0
  24. package/src/lib/dates.js +100 -0
  25. package/src/lib/dates.js.map +1 -0
  26. package/src/lib/dates.mjs +80 -0
  27. package/src/lib/dates.mjs.map +1 -0
  28. package/src/lib/events.d.mts +58 -0
  29. package/src/lib/events.d.ts +58 -0
  30. package/src/lib/events.js +136 -0
  31. package/src/lib/events.js.map +1 -0
  32. package/src/lib/events.mjs +125 -0
  33. package/src/lib/events.mjs.map +1 -0
  34. package/src/lib/gestures.d.mts +11 -0
  35. package/src/lib/gestures.d.ts +11 -0
  36. package/src/lib/gestures.js +215 -0
  37. package/src/lib/gestures.js.map +1 -0
  38. package/src/lib/gestures.mjs +210 -0
  39. package/src/lib/gestures.mjs.map +1 -0
  40. package/src/lib/keys.d.mts +5 -0
  41. package/src/lib/keys.d.ts +5 -0
  42. package/src/lib/keys.js +151 -0
  43. package/src/lib/keys.js.map +1 -0
  44. package/src/lib/keys.mjs +146 -0
  45. package/src/lib/keys.mjs.map +1 -0
  46. package/src/lib/labels.d.mts +65 -0
  47. package/src/lib/labels.d.ts +65 -0
  48. package/src/lib/labels.js +193 -0
  49. package/src/lib/labels.js.map +1 -0
  50. package/src/lib/labels.mjs +188 -0
  51. package/src/lib/labels.mjs.map +1 -0
  52. package/src/lib/list-view.d.mts +11 -0
  53. package/src/lib/list-view.d.ts +11 -0
  54. package/src/lib/list-view.js +54 -0
  55. package/src/lib/list-view.js.map +1 -0
  56. package/src/lib/list-view.mjs +51 -0
  57. package/src/lib/list-view.mjs.map +1 -0
  58. package/src/lib/move-to.d.mts +15 -0
  59. package/src/lib/move-to.d.ts +15 -0
  60. package/src/lib/move-to.js +122 -0
  61. package/src/lib/move-to.js.map +1 -0
  62. package/src/lib/move-to.mjs +118 -0
  63. package/src/lib/move-to.mjs.map +1 -0
  64. package/src/lib/settings.d.mts +11 -0
  65. package/src/lib/settings.d.ts +11 -0
  66. package/src/lib/settings.js +3 -0
  67. package/src/lib/settings.js.map +1 -0
  68. package/src/lib/settings.mjs +2 -0
  69. package/src/lib/settings.mjs.map +1 -0
  70. package/src/lib/styles.d.mts +9 -0
  71. package/src/lib/styles.d.ts +9 -0
  72. package/src/lib/styles.js +165 -0
  73. package/src/lib/styles.js.map +1 -0
  74. package/src/lib/styles.mjs +161 -0
  75. package/src/lib/styles.mjs.map +1 -0
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.placeUnder = placeUnder;
4
+ exports.moveTo = moveTo;
5
+ const dates_1 = require("./dates");
6
+ const events_1 = require("./events");
7
+ const labels_1 = require("./labels");
8
+ /** How far Move to… reaches, in years either side of the record's own day: a year typed short (26) or long (2062) is caught. */
9
+ const YEARS = 10;
10
+ /** A small box of the calendar's own (Move to…, a crowded slot's list) put under what opened it, kept inside the calendar. */
11
+ function placeUnder(cal, box, under) {
12
+ cal.element.append(box);
13
+ const room = cal.element.getBoundingClientRect();
14
+ const mark = under.getBoundingClientRect();
15
+ box.style.top = `${Math.max(0, mark.bottom - room.top + 4)}px`;
16
+ box.style.insetInlineStart = `${Math.max(8, Math.min(cal.rtl() ? room.right - mark.right : mark.left - room.left, room.width - 328))}px`;
17
+ box.scrollIntoView?.({ block: 'nearest' });
18
+ }
19
+ /**
20
+ * "Move to…", the keyboard's way to move a record and a phone's: a small
21
+ * dialog under the record with its day, its time and its person, kept inside
22
+ * the calendar. Move writes it as a drag does, with Undo; Escape, Cancel or a
23
+ * press outside closes it, the focus back on the record. A day that is no
24
+ * day, or one more than ten years from the record's, is refused in words.
25
+ */
26
+ function moveTo(cal) {
27
+ let box = null;
28
+ const outside = (e) => {
29
+ if (box && !box.contains(e.target))
30
+ close();
31
+ };
32
+ function close(back) {
33
+ box?.remove();
34
+ box = null;
35
+ cal.doc.removeEventListener('pointerdown', outside, true);
36
+ back?.focus();
37
+ }
38
+ function open(event, block) {
39
+ close();
40
+ const { body, labels, make, page, spec } = cal;
41
+ /** The record again, as it was: its block, or the one drawn in its place, else wherever the record is now. */
42
+ const again = () => (block.isConnected ? block : (body.querySelector(`[data-focus="${block.dataset['focus']}"]`) ?? cal.place(event.id, event.start)));
43
+ const heading = make('h3', { class: 'fd-cal-move-title', id: `${cal.id}-move` }, (0, labels_1.fill)(labels.moveTitle, { name: event.title }));
44
+ // The days it may go to, which a browser's own picker keeps to as well.
45
+ const [first, last] = [-YEARS, YEARS].map((by) => {
46
+ const d = new Date(event.start);
47
+ d.setFullYear(d.getFullYear() + by);
48
+ return d;
49
+ });
50
+ const day = make('input', { type: 'date', class: 'fd-input', min: (0, dates_1.dayKey)(first), max: (0, dates_1.dayKey)(last) });
51
+ day.value = (0, dates_1.dayKey)(event.start);
52
+ const at = make('input', { type: 'time', class: 'fd-input', step: String(cal.slot * 60) });
53
+ at.value = `${String(event.start.getHours()).padStart(2, '0')}:${String(event.start.getMinutes()).padStart(2, '0')}`;
54
+ const who = make('select', { class: 'fd-input fd-select' });
55
+ const people = cal.state.resources.filter((r) => !!r);
56
+ for (const person of people)
57
+ who.append(make('option', { value: person.key }, person.label));
58
+ who.value = event.resource ?? '';
59
+ const moveButton = make('button', { type: 'button', class: 'fd-button fd-button-primary' }, labels.move);
60
+ const cancel = make('button', { type: 'button', class: 'fd-button' }, labels.cancel);
61
+ const problem = make('p', { class: 'fd-cal-move-problem', id: `${cal.id}-move-problem`, role: 'alert' });
62
+ const rows = [heading, make('label', {}, labels.moveDay, day)];
63
+ if (!event.allDay)
64
+ rows.push(make('label', {}, labels.moveTime, at));
65
+ if (spec.resource && people.length)
66
+ rows.push(make('label', {}, page.fields[spec.resource]?.label ?? '', who));
67
+ rows.push(problem, make('div', { class: 'fd-cal-move-actions' }, cancel, moveButton));
68
+ const opened = make('div', { class: 'fd-cal-move', role: 'dialog', 'aria-labelledby': heading.id }, ...rows);
69
+ box = opened;
70
+ placeUnder(cal, opened, block);
71
+ day.focus();
72
+ /** Said what is wrong, under the box it is wrong in, and the keys back in that box. */
73
+ const refuse = (input, words) => {
74
+ for (const one of [day, at]) {
75
+ one.removeAttribute('aria-invalid');
76
+ one.removeAttribute('aria-describedby');
77
+ }
78
+ problem.textContent = words;
79
+ input.setAttribute('aria-invalid', 'true');
80
+ input.setAttribute('aria-describedby', problem.id);
81
+ input.focus();
82
+ };
83
+ const apply = () => {
84
+ const when = (0, dates_1.readDay)(day.value);
85
+ const shortDay = (d) => (0, dates_1.format)(cal.locale, { day: 'numeric', month: 'short', year: 'numeric' }).format(d);
86
+ if (!when || when < new Date(first.getFullYear(), first.getMonth(), first.getDate()) || when > last)
87
+ return refuse(day, (0, labels_1.fill)(labels.badDay, { from: shortDay(first), to: shortDay(last) }));
88
+ const time = /^(\d\d):(\d\d)/.exec(at.value);
89
+ if (!event.allDay && !time)
90
+ return refuse(at, labels.badTime);
91
+ const start = time && !event.allDay ? (0, dates_1.atMinutes)(when, Number(time[1]) * 60 + Number(time[2])) : when;
92
+ const person = people.find((p) => p.key === who.value);
93
+ const values = (0, events_1.moved)(event, start, spec, page, person ?? undefined);
94
+ close();
95
+ if (!Object.keys(values).length)
96
+ return again().focus();
97
+ void cal.commit(event, values, (0, labels_1.fill)(labels.moved, { name: event.title, when: (0, events_1.whereTo)(event, start, cal.locale) })).then((saved) => {
98
+ // Where the record now is (its new day, when shown), or the bar's step toward that day; as it was, when refused.
99
+ // Unless the person has gone on somewhere else meanwhile.
100
+ const active = cal.doc.activeElement;
101
+ if (!active || active === cal.doc.body)
102
+ (saved ? cal.place(event.id, start) : again()).focus();
103
+ });
104
+ };
105
+ moveButton.addEventListener('click', apply);
106
+ cancel.addEventListener('click', () => close(again()));
107
+ opened.addEventListener('keydown', (k) => {
108
+ if (k.key === 'Escape') {
109
+ k.preventDefault();
110
+ k.stopPropagation();
111
+ close(again());
112
+ }
113
+ else if (k.key === 'Enter' && k.target.tagName === 'INPUT') {
114
+ k.preventDefault();
115
+ apply();
116
+ }
117
+ });
118
+ cal.doc.addEventListener('pointerdown', outside, true);
119
+ }
120
+ return { open, close };
121
+ }
122
+ //# sourceMappingURL=move-to.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-to.js","sourceRoot":"","sources":["../../../../../libs/calendar/src/lib/move-to.ts"],"names":[],"mappings":";;AASA,gCAOC;AASD,wBAyFC;AAjHD,mCAA6D;AAC7D,qCAA8D;AAC9D,qCAAgC;AAEhC,gIAAgI;AAChI,MAAM,KAAK,GAAG,EAAE,CAAC;AAEjB,8HAA8H;AAC9H,SAAgB,UAAU,CAAC,GAAiB,EAAE,GAAgB,EAAE,KAAkB;IAChF,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACxB,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;IACjD,MAAM,IAAI,GAAG,KAAK,CAAC,qBAAqB,EAAE,CAAC;IAC3C,GAAG,CAAC,K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AK,CAAC,CAAC;QAC5C,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACvD,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;YACvC,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;gBACvB,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,CAAC,CAAC,eAAe,EAAE,CAAC;gBACpB,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;YACjB,CAAC;iBAAM,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,IAAK,CAAC,CAAC,MAAsB,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;gBAC9E,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,KAAK,EAAE,CAAC;YACV,CAAC;QACH,CAAC,CAAC,CAAC;QACH,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACzB,CAAC"}
@@ -0,0 +1,118 @@
1
+ import { atMinutes, dayKey, format, readDay } from './dates.mjs';
2
+ import { moved, whereTo } from './events.mjs';
3
+ import { fill } from './labels.mjs';
4
+ /** How far Move to… reaches, in years either side of the record's own day: a year typed short (26) or long (2062) is caught. */
5
+ const YEARS = 10;
6
+ /** A small box of the calendar's own (Move to…, a crowded slot's list) put under what opened it, kept inside the calendar. */
7
+ export function placeUnder(cal, box, under) {
8
+ cal.element.append(box);
9
+ const room = cal.element.getBoundingClientRect();
10
+ const mark = under.getBoundingClientRect();
11
+ box.style.top = `${Math.max(0, mark.bottom - room.top + 4)}px`;
12
+ box.style.insetInlineStart = `${Math.max(8, Math.min(cal.rtl() ? room.right - mark.right : mark.left - room.left, room.width - 328))}px`;
13
+ box.scrollIntoView?.({ block: 'nearest' });
14
+ }
15
+ /**
16
+ * "Move to…", the keyboard's way to move a record and a phone's: a small
17
+ * dialog under the record with its day, its time and its person, kept inside
18
+ * the calendar. Move writes it as a drag does, with Undo; Escape, Cancel or a
19
+ * press outside closes it, the focus back on the record. A day that is no
20
+ * day, or one more than ten years from the record's, is refused in words.
21
+ */
22
+ export function moveTo(cal) {
23
+ let box = null;
24
+ const outside = (e) => {
25
+ if (box && !box.contains(e.target))
26
+ close();
27
+ };
28
+ function close(back) {
29
+ box?.remove();
30
+ box = null;
31
+ cal.doc.removeEventListener('pointerdown', outside, true);
32
+ back?.focus();
33
+ }
34
+ function open(event, block) {
35
+ close();
36
+ const { body, labels, make, page, spec } = cal;
37
+ /** The record again, as it was: its block, or the one drawn in its place, else wherever the record is now. */
38
+ const again = () => (block.isConnected ? block : (body.querySelector(`[data-focus="${block.dataset['focus']}"]`) ?? cal.place(event.id, event.start)));
39
+ const heading = make('h3', { class: 'fd-cal-move-title', id: `${cal.id}-move` }, fill(labels.moveTitle, { name: event.title }));
40
+ // The days it may go to, which a browser's own picker keeps to as well.
41
+ const [first, last] = [-YEARS, YEARS].map((by) => {
42
+ const d = new Date(event.start);
43
+ d.setFullYear(d.getFullYear() + by);
44
+ return d;
45
+ });
46
+ const day = make('input', { type: 'date', class: 'fd-input', min: dayKey(first), max: dayKey(last) });
47
+ day.value = dayKey(event.start);
48
+ const at = make('input', { type: 'time', class: 'fd-input', step: String(cal.slot * 60) });
49
+ at.value = `${String(event.start.getHours()).padStart(2, '0')}:${String(event.start.getMinutes()).padStart(2, '0')}`;
50
+ const who = make('select', { class: 'fd-input fd-select' });
51
+ const people = cal.state.resources.filter((r) => !!r);
52
+ for (const person of people)
53
+ who.append(make('option', { value: person.key }, person.label));
54
+ who.value = event.resource ?? '';
55
+ const moveButton = make('button', { type: 'button', class: 'fd-button fd-button-primary' }, labels.move);
56
+ const cancel = make('button', { type: 'button', class: 'fd-button' }, labels.cancel);
57
+ const problem = make('p', { class: 'fd-cal-move-problem', id: `${cal.id}-move-problem`, role: 'alert' });
58
+ const rows = [heading, make('label', {}, labels.moveDay, day)];
59
+ if (!event.allDay)
60
+ rows.push(make('label', {}, labels.moveTime, at));
61
+ if (spec.resource && people.length)
62
+ rows.push(make('label', {}, page.fields[spec.resource]?.label ?? '', who));
63
+ rows.push(problem, make('div', { class: 'fd-cal-move-actions' }, cancel, moveButton));
64
+ const opened = make('div', { class: 'fd-cal-move', role: 'dialog', 'aria-labelledby': heading.id }, ...rows);
65
+ box = opened;
66
+ placeUnder(cal, opened, block);
67
+ day.focus();
68
+ /** Said what is wrong, under the box it is wrong in, and the keys back in that box. */
69
+ const refuse = (input, words) => {
70
+ for (const one of [day, at]) {
71
+ one.removeAttribute('aria-invalid');
72
+ one.removeAttribute('aria-describedby');
73
+ }
74
+ problem.textContent = words;
75
+ input.setAttribute('aria-invalid', 'true');
76
+ input.setAttribute('aria-describedby', problem.id);
77
+ input.focus();
78
+ };
79
+ const apply = () => {
80
+ const when = readDay(day.value);
81
+ const shortDay = (d) => format(cal.locale, { day: 'numeric', month: 'short', year: 'numeric' }).format(d);
82
+ if (!when || when < new Date(first.getFullYear(), first.getMonth(), first.getDate()) || when > last)
83
+ return refuse(day, fill(labels.badDay, { from: shortDay(first), to: shortDay(last) }));
84
+ const time = /^(\d\d):(\d\d)/.exec(at.value);
85
+ if (!event.allDay && !time)
86
+ return refuse(at, labels.badTime);
87
+ const start = time && !event.allDay ? atMinutes(when, Number(time[1]) * 60 + Number(time[2])) : when;
88
+ const person = people.find((p) => p.key === who.value);
89
+ const values = moved(event, start, spec, page, person ?? undefined);
90
+ close();
91
+ if (!Object.keys(values).length)
92
+ return again().focus();
93
+ void cal.commit(event, values, fill(labels.moved, { name: event.title, when: whereTo(event, start, cal.locale) })).then((saved) => {
94
+ // Where the record now is (its new day, when shown), or the bar's step toward that day; as it was, when refused.
95
+ // Unless the person has gone on somewhere else meanwhile.
96
+ const active = cal.doc.activeElement;
97
+ if (!active || active === cal.doc.body)
98
+ (saved ? cal.place(event.id, start) : again()).focus();
99
+ });
100
+ };
101
+ moveButton.addEventListener('click', apply);
102
+ cancel.addEventListener('click', () => close(again()));
103
+ opened.addEventListener('keydown', (k) => {
104
+ if (k.key === 'Escape') {
105
+ k.preventDefault();
106
+ k.stopPropagation();
107
+ close(again());
108
+ }
109
+ else if (k.key === 'Enter' && k.target.tagName === 'INPUT') {
110
+ k.preventDefault();
111
+ apply();
112
+ }
113
+ });
114
+ cal.doc.addEventListener('pointerdown', outside, true);
115
+ }
116
+ return { open, close };
117
+ }
118
+ //# sourceMappingURL=move-to.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-to.mjs","sourceRoot":"","sources":["../../../../../libs/calendar/src/lib/move-to.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,OAAO,EAAsB,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,gIAAgI;AAChI,MAAM,KAAK,GAAG,EAAE,CAAC;AAEjB,8HAA8H;AAC9H,MAAM,UAAU,UAAU,CAAC,GAAiB,EAAE,GAAgB,EAAE,KAAkB;IAChF,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACxB,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;IACjD,MAAM,IAAI,GAAG,KAAK,CAAC,qBAAqB,EAAE,CAAC;IAC3C,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC;IAC/D,GAAG,CAAC,KAAK,CAAC,gBAAgB,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAA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nB,CAAC,CAAC,eAAe,EAAE,CAAC;gBACpB,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;YACjB,CAAC;iBAAM,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,IAAK,CAAC,CAAC,MAAsB,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;gBAC9E,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,KAAK,EAAE,CAAC;YACV,CAAC;QACH,CAAC,CAAC,CAAC;QACH,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACzB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Locale } from '@fieldia/core';
2
+ import type { CalendarLabels } from './labels.mjs';
3
+ /** How an app's calendars behave, for `calendarListViews`. */
4
+ export interface CalendarSettings {
5
+ /** Words over the calendar's own, by language: `{ ar: { today: 'النهارده' } }`. */
6
+ labels?: Partial<Record<Locale, Partial<CalendarLabels>>>;
7
+ /** The moment it is now: the clock unless given, as a demo or a test pinned to a day gives it. */
8
+ now?: () => Date;
9
+ /** How many records a span asks for at most: 500 unless said. Past it, the calendar says how many it leaves out. */
10
+ limit?: number;
11
+ }
@@ -0,0 +1,11 @@
1
+ import type { Locale } from '@fieldia/core';
2
+ import type { CalendarLabels } from './labels';
3
+ /** How an app's calendars behave, for `calendarListViews`. */
4
+ export interface CalendarSettings {
5
+ /** Words over the calendar's own, by language: `{ ar: { today: 'النهارده' } }`. */
6
+ labels?: Partial<Record<Locale, Partial<CalendarLabels>>>;
7
+ /** The moment it is now: the clock unless given, as a demo or a test pinned to a day gives it. */
8
+ now?: () => Date;
9
+ /** How many records a span asks for at most: 500 unless said. Past it, the calendar says how many it leaves out. */
10
+ limit?: number;
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../../../libs/calendar/src/lib/settings.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=settings.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.mjs","sourceRoot":"","sources":["../../../../../libs/calendar/src/lib/settings.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * A list's calendar in Fieldia's tokens, so a theme, a host's own tokens and
3
+ * the dark scheme reach it: each record a tint of the surface with a bar in
4
+ * its colour, which reads on a light page and a dark one alike. Logical
5
+ * sides throughout, so right to left needs nothing of its own but the arrows.
6
+ */
7
+ export declare const CALENDAR_CSS = "\n.fd-cal { position: relative; display: grid; gap: 10px; min-width: 0; color: var(--fd-text); container: fd-cal / inline-size; --fd-cal-hour: 48px; }\n.fd-cal-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }\n.fd-cal-nav { display: inline-flex; gap: 4px; align-items: center; }\n.fd-cal .fd-button { min-height: 32px; }\n.fd-cal-step { min-width: 32px; padding-inline: 6px; display: inline-grid; place-items: center; }\n.fd-cal-step svg { width: 16px; height: 16px; }\n.fd-cal-step:dir(rtl) svg { transform: scaleX(-1); }\n.fd-cal-title { margin: 0; flex: 1 1 12em; min-width: 0; font-size: 1.05rem; font-weight: 600; }\n.fd-cal-ranges { display: inline-flex; border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius); overflow: hidden; }\n.fd-cal-ranges .fd-button { border: 0; border-radius: 0; padding-inline: 10px; }\n.fd-cal-ranges .fd-button + .fd-button { border-inline-start: 1px solid var(--fd-border); }\n.fd-cal-ranges .fd-button[aria-pressed=\"true\"] { background: var(--fd-accent-soft); color: var(--fd-accent); font-weight: 600; }\n.fd-cal-said:not(:empty), .fd-cal-alert:not(:empty) { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 6px 10px; border-radius: var(--fd-control-radius); font-size: 13.5px; }\n.fd-cal-said:not(:empty) { background: var(--fd-info-soft); color: var(--fd-text); }\n.fd-cal-alert:not(:empty) { background: var(--fd-error-soft); color: var(--fd-text); }\n.fd-cal-said .fd-button { min-height: 28px; }\n.fd-cal-note { margin: 0; color: var(--fd-muted); font-size: 13px; }\n.fd-cal-body { min-width: 0; border: 1px solid var(--fd-border); border-radius: var(--fd-radius); background: var(--fd-surface); overflow: hidden; }\n.fd-cal-body[aria-busy=\"true\"] { cursor: progress; }\n.fd-cal-failed { margin: 0; padding: 24px; text-align: center; }\n.fd-cal-empty { margin: 0; padding: 32px 16px; text-align: center; color: var(--fd-muted); }\n\n/* The day and the week: the hours down the side, a column for each day or each person. */\n.fd-cal-scroll { overflow-x: auto; }\n.fd-cal-grid { display: grid; grid-template-columns: 52px repeat(var(--fd-cal-cols), minmax(var(--fd-cal-min, 0px), 1fr)); min-width: min-content; }\n.fd-cal-corner, .fd-cal-head { box-sizing: border-box; padding: 6px 4px; border-bottom: 1px solid var(--fd-border); font-size: 12px; color: var(--fd-muted); text-align: center; min-width: 0; }\n.fd-cal-head { border-inline-start: 1px solid var(--fd-border); overflow-wrap: anywhere; }\n.fd-cal-head-day { display: inline-grid; justify-items: center; gap: 2px; border: 0; background: none; color: inherit; font: inherit; padding: 2px 6px; border-radius: var(--fd-control-radius); cursor: pointer; }\n.fd-cal-head-day:hover { background: var(--fd-accent-soft); }\n.fd-cal-head-day:focus-visible, .fd-cal-daynum:focus-visible, .fd-cal-more:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 1px; }\n.fd-cal-head-num { font-size: 18px; line-height: 28px; min-width: 28px; border-radius: 999px; color: var(--fd-text); }\n.fd-cal-head[aria-current=\"date\"] .fd-cal-head-num { background: var(--fd-accent); color: var(--fd-accent-text); }\n.fd-cal-head-who { font-size: 13px; font-weight: 600; color: var(--fd-text); }\n.fd-cal-corner { font-size: 11px; display: grid; align-items: end; justify-items: end; padding-inline-end: 6px; }\n.fd-cal-allday { box-sizing: border-box; display: grid; align-content: start; gap: 2px; padding: 2px; min-height: 30px; min-width: 0; border-inline-start: 1px solid var(--fd-border); border-bottom: 1px solid var(--fd-border); }\n.fd-cal-allday[data-alone] { min-height: 240px; }\n.fd-cal-hours { position: relative; height: calc(var(--fd-cal-span) * var(--fd-cal-hour)); }\n.fd-cal-hour { position: absolute; inset-inline-end: 6px; transform: translateY(-50%); font-size: 11px; color: var(--fd-muted); font-variant-numeric: tabular-nums; }\n.fd-cal-hour:first-child { transform: none; }\n.fd-cal-col {\n position: relative; min-width: 0; border-inline-start: 1px solid var(--fd-border); height: calc(var(--fd-cal-span) * var(--fd-cal-hour));\n background-image: repeating-linear-gradient(to bottom, var(--fd-border) 0 1px, transparent 1px calc(var(--fd-cal-hour) / 2), color-mix(in srgb, var(--fd-border) 50%, transparent) calc(var(--fd-cal-hour) / 2) calc(var(--fd-cal-hour) / 2 + 1px), transparent calc(var(--fd-cal-hour) / 2 + 1px) var(--fd-cal-hour));\n}\n.fd-cal-col[data-today] { background-color: color-mix(in srgb, var(--fd-accent) 4%, transparent); }\n.fd-cal-slot { box-sizing: border-box; height: calc(var(--fd-cal-hour) * var(--fd-cal-slot) / 60); }\n.fd-cal[data-creates] .fd-cal-slot, .fd-cal[data-creates] .fd-cal-allday, .fd-cal[data-creates] .fd-cal-day { cursor: cell; }\n.fd-cal-slot:focus { outline: none; }\n.fd-cal-slot:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: -2px; background: var(--fd-accent-soft); }\n.fd-cal-picking { position: absolute; inset-inline: 2px; z-index: 2; box-sizing: border-box; border: 1px dashed var(--fd-accent); border-radius: 4px; background: var(--fd-accent-soft); pointer-events: none; }\n/* Under the records, so a record's words are never struck through. */\n.fd-cal-now { position: absolute; inset-inline: 0; z-index: 0; height: 2px; margin-top: -1px; background: var(--fd-error); pointer-events: none; }\n.fd-cal-now::before { content: \"\"; position: absolute; inset-inline-start: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--fd-error); }\n\n/* A record: a tint of the surface, a bar in its colour. */\n.fd-cal-event {\n --fd-cal-c: var(--fd-accent);\n box-sizing: border-box; min-width: 0; overflow: hidden; padding: 2px 6px; border-radius: 4px; font-size: 12.5px; line-height: 1.3;\n background: color-mix(in srgb, var(--fd-cal-c) 16%, var(--fd-surface)); color: var(--fd-text); border-inline-start: 3px solid var(--fd-cal-c);\n cursor: default; user-select: none; -webkit-user-select: none;\n}\n.fd-cal-event[data-opens], .fd-cal-event[data-moves] { cursor: pointer; }\n.fd-cal-event:hover, .fd-cal-event.fd-cal-hot { background: color-mix(in srgb, var(--fd-cal-c) 26%, var(--fd-surface)); }\n.fd-cal-event:focus { outline: none; }\n.fd-cal-event:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 1px; z-index: 3; }\n.fd-cal-col > .fd-cal-event { position: absolute; z-index: 1; box-shadow: 0 0 0 1px var(--fd-surface); line-height: 16px; container: fd-cal-ev / inline-size; }\n/* Its words in the whole lines its height holds (--fd-cal-lines, by linesIn): none cut through. */\n.fd-cal-col > .fd-cal-event > .fd-cal-event-text { display: block; max-height: calc(var(--fd-cal-lines, 1) * 16px); overflow: hidden; text-overflow: ellipsis; }\n/* Each word whole, a long one cut with \"\u2026\"; too narrow for its time, the name alone (the hours say when). */\n.fd-cal-col .fd-cal-event-title { overflow-wrap: normal; }\n.fd-cal-col .fd-cal-event-who { overflow: hidden; text-overflow: ellipsis; }\n@container fd-cal-ev (max-width: 56px) { .fd-cal-col .fd-cal-event-time, .fd-cal-col .fd-cal-event-who { display: none; } }\n.fd-cal-event[data-moving] { opacity: 0.9; z-index: 6; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22); pointer-events: none; }\n.fd-cal-event[aria-busy=\"true\"] { opacity: 0.75; }\n.fd-cal-event-time { font-variant-numeric: tabular-nums; }\n.fd-cal-event-title { font-weight: 600; overflow-wrap: anywhere; text-align: match-parent; }\n.fd-cal-event-who { display: block; opacity: 0.85; }\n/* 24 pixels at least, so a finger or a pointer can hit each (WCAG 2.5.8). */\n.fd-cal-allday > .fd-cal-event, .fd-cal-day > .fd-cal-event { position: relative; min-height: 24px; box-sizing: border-box; line-height: 20px; white-space: nowrap; padding-inline-end: 24px; }\n.fd-cal-col > .fd-cal-event[data-short] .fd-cal-event-who { display: none; }\n/* One line (a short record, a month's day, all day): the name cut with \"\u2026\" at its own end, so a Latin one right to left\n keeps its start; whole when pointed at, and to a screen reader. */\n.fd-cal-col > .fd-cal-event[data-short] > .fd-cal-event-text, .fd-cal-allday .fd-cal-event-text, .fd-cal-day .fd-cal-event-text { display: flex; gap: 0.3em; white-space: nowrap; }\n:is(.fd-cal-col > .fd-cal-event[data-short], .fd-cal-allday > .fd-cal-event, .fd-cal-day > .fd-cal-event) .fd-cal-event-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }\n.fd-cal-resize { position: absolute; inset-inline: 0; bottom: 0; height: 8px; cursor: ns-resize; touch-action: none; }\n.fd-cal-event-menu {\n position: absolute; top: 0; inset-inline-end: 0; z-index: 2; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 4px;\n display: none; place-items: center; background: var(--fd-surface); color: var(--fd-text); font: 700 14px/1 system-ui, sans-serif; cursor: pointer;\n}\n.fd-cal-event:hover > .fd-cal-event-menu, .fd-cal-event:focus-within > .fd-cal-event-menu, .fd-cal-event:focus > .fd-cal-event-menu { display: grid; }\n@media (hover: none) { .fd-cal-event-menu { display: grid; } }\n\n/* The month: whole weeks, each day its records, and how many more. */\n.fd-cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }\n.fd-cal-weekday { padding: 6px 4px; border-bottom: 1px solid var(--fd-border); font-size: 12px; color: var(--fd-muted); text-align: center; }\n.fd-cal-weekday + .fd-cal-weekday, .fd-cal-day:not(:nth-child(7n + 1)) { border-inline-start: 1px solid var(--fd-border); }\n.fd-cal-day { box-sizing: border-box; min-width: 0; min-height: 104px; padding: 3px; display: grid; align-content: start; gap: 2px; border-bottom: 1px solid var(--fd-border); }\n.fd-cal-day[data-out] { background: color-mix(in srgb, var(--fd-text) 3%, var(--fd-surface)); }\n.fd-cal-daynum { justify-self: start; min-width: 26px; height: 26px; padding: 0 6px; border: 0; border-radius: 999px; background: none; color: var(--fd-text); font: inherit; font-size: 12.5px; cursor: pointer; }\n.fd-cal-day[data-out] .fd-cal-daynum { color: var(--fd-muted); }\n.fd-cal-day[aria-current=\"date\"] .fd-cal-daynum { background: var(--fd-accent); color: var(--fd-accent-text); font-weight: 600; }\n.fd-cal-more { justify-self: start; min-height: 24px; padding: 0 6px; border: 0; background: none; color: var(--fd-accent); font: inherit; font-size: 12px; cursor: pointer; }\n/* A crowded slot's \"+N more\", in the last lane over the records it holds. */\n.fd-cal-col > .fd-cal-more {\n position: absolute; z-index: 1; box-sizing: border-box; display: block; padding: 3px 2px; line-height: 14px; text-align: center; overflow: hidden;\n border-radius: 4px; border: 1px dashed color-mix(in srgb, var(--fd-accent) 55%, transparent); background: var(--fd-accent-soft); font-weight: 600;\n}\n.fd-cal-col > .fd-cal-more:hover { background: color-mix(in srgb, var(--fd-accent) 22%, var(--fd-surface)); }\n.fd-cal-day > .fd-cal-event .fd-cal-event-who { display: none; }\n\n/* The agenda: each day that has something, its records in order. */\n.fd-cal-agenda-day { display: grid; grid-template-columns: minmax(8em, 11em) minmax(0, 1fr); border-bottom: 1px solid var(--fd-border); }\n.fd-cal-agenda-day:last-child { border-bottom: 0; }\n.fd-cal-agenda-head { margin: 0; padding: 10px 12px; font-size: 13px; font-weight: 600; }\n.fd-cal-agenda-day[aria-current=\"date\"] .fd-cal-agenda-head { color: var(--fd-accent); }\n.fd-cal-agenda-list { list-style: none; margin: 0; padding: 6px 8px; display: grid; gap: 4px; min-width: 0; }\n.fd-cal-agenda-list .fd-cal-event { position: relative; padding: 0; font-size: 13.5px; }\n.fd-cal-event-open { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; padding-block: 8px; padding-inline: 10px 48px; border-radius: inherit; }\n.fd-cal-event[data-opens] .fd-cal-event-open { cursor: pointer; }\n.fd-cal-event-open:focus { outline: none; }\n.fd-cal-event-open:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 1px; }\n.fd-cal-agenda-list .fd-cal-event-who { grid-column: 2; }\n.fd-cal-agenda-list .fd-cal-event-menu { display: grid; top: 50%; transform: translateY(-50%); inset-inline-end: 6px; width: 36px; height: 36px; }\n.fd-cal-agenda-list .fd-cal-event-menu:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 1px; }\n@container fd-cal (max-width: 520px) {\n .fd-cal-agenda-day { grid-template-columns: minmax(0, 1fr); }\n .fd-cal-agenda-head { padding-bottom: 0; }\n .fd-cal-title { flex-basis: 100%; order: -1; }\n}\n\n/* \"Move to\u2026\": its day, its time, its person; and a crowded slot's list, in the same kind of box. */\n.fd-cal-move, .fd-cal-crowd {\n position: absolute; z-index: 30; box-sizing: border-box; width: min(320px, calc(100% - 16px)); padding: 14px; display: grid; gap: 10px;\n background: var(--fd-surface); color: var(--fd-text); border: 1px solid var(--fd-border); border-radius: max(var(--fd-radius), 6px); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);\n}\n.fd-cal-move-title { margin: 0; font-size: 14px; font-weight: 600; }\n.fd-cal-move label { display: grid; gap: 4px; font-size: 13px; }\n.fd-cal-move-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }\n.fd-cal-move-problem { margin: 0; color: var(--fd-error); font-size: 13px; }\n.fd-cal-move-problem:empty { display: none; }\n.fd-cal-move .fd-input[aria-invalid=\"true\"] { border-color: var(--fd-error); }\n.fd-cal-crowd { padding: 10px; gap: 6px; }\n.fd-cal-crowd-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-inline-start: 4px; }\n.fd-cal-crowd .fd-cal-agenda-list { padding: 0; max-height: min(60vh, 360px); overflow-y: auto; }\n";
8
+ /** The calendar's stylesheet, once per document, before the page's own so an app's rule wins. */
9
+ export declare function installCalendarStyles(doc: Document): void;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * A list's calendar in Fieldia's tokens, so a theme, a host's own tokens and
3
+ * the dark scheme reach it: each record a tint of the surface with a bar in
4
+ * its colour, which reads on a light page and a dark one alike. Logical
5
+ * sides throughout, so right to left needs nothing of its own but the arrows.
6
+ */
7
+ export declare const CALENDAR_CSS = "\n.fd-cal { position: relative; display: grid; gap: 10px; min-width: 0; color: var(--fd-text); container: fd-cal / inline-size; --fd-cal-hour: 48px; }\n.fd-cal-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }\n.fd-cal-nav { display: inline-flex; gap: 4px; align-items: center; }\n.fd-cal .fd-button { min-height: 32px; }\n.fd-cal-step { min-width: 32px; padding-inline: 6px; display: inline-grid; place-items: center; }\n.fd-cal-step svg { width: 16px; height: 16px; }\n.fd-cal-step:dir(rtl) svg { transform: scaleX(-1); }\n.fd-cal-title { margin: 0; flex: 1 1 12em; min-width: 0; font-size: 1.05rem; font-weight: 600; }\n.fd-cal-ranges { display: inline-flex; border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius); overflow: hidden; }\n.fd-cal-ranges .fd-button { border: 0; border-radius: 0; padding-inline: 10px; }\n.fd-cal-ranges .fd-button + .fd-button { border-inline-start: 1px solid var(--fd-border); }\n.fd-cal-ranges .fd-button[aria-pressed=\"true\"] { background: var(--fd-accent-soft); color: var(--fd-accent); font-weight: 600; }\n.fd-cal-said:not(:empty), .fd-cal-alert:not(:empty) { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 6px 10px; border-radius: var(--fd-control-radius); font-size: 13.5px; }\n.fd-cal-said:not(:empty) { background: var(--fd-info-soft); color: var(--fd-text); }\n.fd-cal-alert:not(:empty) { background: var(--fd-error-soft); color: var(--fd-text); }\n.fd-cal-said .fd-button { min-height: 28px; }\n.fd-cal-note { margin: 0; color: var(--fd-muted); font-size: 13px; }\n.fd-cal-body { min-width: 0; border: 1px solid var(--fd-border); border-radius: var(--fd-radius); background: var(--fd-surface); overflow: hidden; }\n.fd-cal-body[aria-busy=\"true\"] { cursor: progress; }\n.fd-cal-failed { margin: 0; padding: 24px; text-align: center; }\n.fd-cal-empty { margin: 0; padding: 32px 16px; text-align: center; color: var(--fd-muted); }\n\n/* The day and the week: the hours down the side, a column for each day or each person. */\n.fd-cal-scroll { overflow-x: auto; }\n.fd-cal-grid { display: grid; grid-template-columns: 52px repeat(var(--fd-cal-cols), minmax(var(--fd-cal-min, 0px), 1fr)); min-width: min-content; }\n.fd-cal-corner, .fd-cal-head { box-sizing: border-box; padding: 6px 4px; border-bottom: 1px solid var(--fd-border); font-size: 12px; color: var(--fd-muted); text-align: center; min-width: 0; }\n.fd-cal-head { border-inline-start: 1px solid var(--fd-border); overflow-wrap: anywhere; }\n.fd-cal-head-day { display: inline-grid; justify-items: center; gap: 2px; border: 0; background: none; color: inherit; font: inherit; padding: 2px 6px; border-radius: var(--fd-control-radius); cursor: pointer; }\n.fd-cal-head-day:hover { background: var(--fd-accent-soft); }\n.fd-cal-head-day:focus-visible, .fd-cal-daynum:focus-visible, .fd-cal-more:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 1px; }\n.fd-cal-head-num { font-size: 18px; line-height: 28px; min-width: 28px; border-radius: 999px; color: var(--fd-text); }\n.fd-cal-head[aria-current=\"date\"] .fd-cal-head-num { background: var(--fd-accent); color: var(--fd-accent-text); }\n.fd-cal-head-who { font-size: 13px; font-weight: 600; color: var(--fd-text); }\n.fd-cal-corner { font-size: 11px; display: grid; align-items: end; justify-items: end; padding-inline-end: 6px; }\n.fd-cal-allday { box-sizing: border-box; display: grid; align-content: start; gap: 2px; padding: 2px; min-height: 30px; min-width: 0; border-inline-start: 1px solid var(--fd-border); border-bottom: 1px solid var(--fd-border); }\n.fd-cal-allday[data-alone] { min-height: 240px; }\n.fd-cal-hours { position: relative; height: calc(var(--fd-cal-span) * var(--fd-cal-hour)); }\n.fd-cal-hour { position: absolute; inset-inline-end: 6px; transform: translateY(-50%); font-size: 11px; color: var(--fd-muted); font-variant-numeric: tabular-nums; }\n.fd-cal-hour:first-child { transform: none; }\n.fd-cal-col {\n position: relative; min-width: 0; border-inline-start: 1px solid var(--fd-border); height: calc(var(--fd-cal-span) * var(--fd-cal-hour));\n background-image: repeating-linear-gradient(to bottom, var(--fd-border) 0 1px, transparent 1px calc(var(--fd-cal-hour) / 2), color-mix(in srgb, var(--fd-border) 50%, transparent) calc(var(--fd-cal-hour) / 2) calc(var(--fd-cal-hour) / 2 + 1px), transparent calc(var(--fd-cal-hour) / 2 + 1px) var(--fd-cal-hour));\n}\n.fd-cal-col[data-today] { background-color: color-mix(in srgb, var(--fd-accent) 4%, transparent); }\n.fd-cal-slot { box-sizing: border-box; height: calc(var(--fd-cal-hour) * var(--fd-cal-slot) / 60); }\n.fd-cal[data-creates] .fd-cal-slot, .fd-cal[data-creates] .fd-cal-allday, .fd-cal[data-creates] .fd-cal-day { cursor: cell; }\n.fd-cal-slot:focus { outline: none; }\n.fd-cal-slot:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: -2px; background: var(--fd-accent-soft); }\n.fd-cal-picking { position: absolute; inset-inline: 2px; z-index: 2; box-sizing: border-box; border: 1px dashed var(--fd-accent); border-radius: 4px; background: var(--fd-accent-soft); pointer-events: none; }\n/* Under the records, so a record's words are never struck through. */\n.fd-cal-now { position: absolute; inset-inline: 0; z-index: 0; height: 2px; margin-top: -1px; background: var(--fd-error); pointer-events: none; }\n.fd-cal-now::before { content: \"\"; position: absolute; inset-inline-start: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--fd-error); }\n\n/* A record: a tint of the surface, a bar in its colour. */\n.fd-cal-event {\n --fd-cal-c: var(--fd-accent);\n box-sizing: border-box; min-width: 0; overflow: hidden; padding: 2px 6px; border-radius: 4px; font-size: 12.5px; line-height: 1.3;\n background: color-mix(in srgb, var(--fd-cal-c) 16%, var(--fd-surface)); color: var(--fd-text); border-inline-start: 3px solid var(--fd-cal-c);\n cursor: default; user-select: none; -webkit-user-select: none;\n}\n.fd-cal-event[data-opens], .fd-cal-event[data-moves] { cursor: pointer; }\n.fd-cal-event:hover, .fd-cal-event.fd-cal-hot { background: color-mix(in srgb, var(--fd-cal-c) 26%, var(--fd-surface)); }\n.fd-cal-event:focus { outline: none; }\n.fd-cal-event:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 1px; z-index: 3; }\n.fd-cal-col > .fd-cal-event { position: absolute; z-index: 1; box-shadow: 0 0 0 1px var(--fd-surface); line-height: 16px; container: fd-cal-ev / inline-size; }\n/* Its words in the whole lines its height holds (--fd-cal-lines, by linesIn): none cut through. */\n.fd-cal-col > .fd-cal-event > .fd-cal-event-text { display: block; max-height: calc(var(--fd-cal-lines, 1) * 16px); overflow: hidden; text-overflow: ellipsis; }\n/* Each word whole, a long one cut with \"\u2026\"; too narrow for its time, the name alone (the hours say when). */\n.fd-cal-col .fd-cal-event-title { overflow-wrap: normal; }\n.fd-cal-col .fd-cal-event-who { overflow: hidden; text-overflow: ellipsis; }\n@container fd-cal-ev (max-width: 56px) { .fd-cal-col .fd-cal-event-time, .fd-cal-col .fd-cal-event-who { display: none; } }\n.fd-cal-event[data-moving] { opacity: 0.9; z-index: 6; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22); pointer-events: none; }\n.fd-cal-event[aria-busy=\"true\"] { opacity: 0.75; }\n.fd-cal-event-time { font-variant-numeric: tabular-nums; }\n.fd-cal-event-title { font-weight: 600; overflow-wrap: anywhere; text-align: match-parent; }\n.fd-cal-event-who { display: block; opacity: 0.85; }\n/* 24 pixels at least, so a finger or a pointer can hit each (WCAG 2.5.8). */\n.fd-cal-allday > .fd-cal-event, .fd-cal-day > .fd-cal-event { position: relative; min-height: 24px; box-sizing: border-box; line-height: 20px; white-space: nowrap; padding-inline-end: 24px; }\n.fd-cal-col > .fd-cal-event[data-short] .fd-cal-event-who { display: none; }\n/* One line (a short record, a month's day, all day): the name cut with \"\u2026\" at its own end, so a Latin one right to left\n keeps its start; whole when pointed at, and to a screen reader. */\n.fd-cal-col > .fd-cal-event[data-short] > .fd-cal-event-text, .fd-cal-allday .fd-cal-event-text, .fd-cal-day .fd-cal-event-text { display: flex; gap: 0.3em; white-space: nowrap; }\n:is(.fd-cal-col > .fd-cal-event[data-short], .fd-cal-allday > .fd-cal-event, .fd-cal-day > .fd-cal-event) .fd-cal-event-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }\n.fd-cal-resize { position: absolute; inset-inline: 0; bottom: 0; height: 8px; cursor: ns-resize; touch-action: none; }\n.fd-cal-event-menu {\n position: absolute; top: 0; inset-inline-end: 0; z-index: 2; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 4px;\n display: none; place-items: center; background: var(--fd-surface); color: var(--fd-text); font: 700 14px/1 system-ui, sans-serif; cursor: pointer;\n}\n.fd-cal-event:hover > .fd-cal-event-menu, .fd-cal-event:focus-within > .fd-cal-event-menu, .fd-cal-event:focus > .fd-cal-event-menu { display: grid; }\n@media (hover: none) { .fd-cal-event-menu { display: grid; } }\n\n/* The month: whole weeks, each day its records, and how many more. */\n.fd-cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }\n.fd-cal-weekday { padding: 6px 4px; border-bottom: 1px solid var(--fd-border); font-size: 12px; color: var(--fd-muted); text-align: center; }\n.fd-cal-weekday + .fd-cal-weekday, .fd-cal-day:not(:nth-child(7n + 1)) { border-inline-start: 1px solid var(--fd-border); }\n.fd-cal-day { box-sizing: border-box; min-width: 0; min-height: 104px; padding: 3px; display: grid; align-content: start; gap: 2px; border-bottom: 1px solid var(--fd-border); }\n.fd-cal-day[data-out] { background: color-mix(in srgb, var(--fd-text) 3%, var(--fd-surface)); }\n.fd-cal-daynum { justify-self: start; min-width: 26px; height: 26px; padding: 0 6px; border: 0; border-radius: 999px; background: none; color: var(--fd-text); font: inherit; font-size: 12.5px; cursor: pointer; }\n.fd-cal-day[data-out] .fd-cal-daynum { color: var(--fd-muted); }\n.fd-cal-day[aria-current=\"date\"] .fd-cal-daynum { background: var(--fd-accent); color: var(--fd-accent-text); font-weight: 600; }\n.fd-cal-more { justify-self: start; min-height: 24px; padding: 0 6px; border: 0; background: none; color: var(--fd-accent); font: inherit; font-size: 12px; cursor: pointer; }\n/* A crowded slot's \"+N more\", in the last lane over the records it holds. */\n.fd-cal-col > .fd-cal-more {\n position: absolute; z-index: 1; box-sizing: border-box; display: block; padding: 3px 2px; line-height: 14px; text-align: center; overflow: hidden;\n border-radius: 4px; border: 1px dashed color-mix(in srgb, var(--fd-accent) 55%, transparent); background: var(--fd-accent-soft); font-weight: 600;\n}\n.fd-cal-col > .fd-cal-more:hover { background: color-mix(in srgb, var(--fd-accent) 22%, var(--fd-surface)); }\n.fd-cal-day > .fd-cal-event .fd-cal-event-who { display: none; }\n\n/* The agenda: each day that has something, its records in order. */\n.fd-cal-agenda-day { display: grid; grid-template-columns: minmax(8em, 11em) minmax(0, 1fr); border-bottom: 1px solid var(--fd-border); }\n.fd-cal-agenda-day:last-child { border-bottom: 0; }\n.fd-cal-agenda-head { margin: 0; padding: 10px 12px; font-size: 13px; font-weight: 600; }\n.fd-cal-agenda-day[aria-current=\"date\"] .fd-cal-agenda-head { color: var(--fd-accent); }\n.fd-cal-agenda-list { list-style: none; margin: 0; padding: 6px 8px; display: grid; gap: 4px; min-width: 0; }\n.fd-cal-agenda-list .fd-cal-event { position: relative; padding: 0; font-size: 13.5px; }\n.fd-cal-event-open { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; padding-block: 8px; padding-inline: 10px 48px; border-radius: inherit; }\n.fd-cal-event[data-opens] .fd-cal-event-open { cursor: pointer; }\n.fd-cal-event-open:focus { outline: none; }\n.fd-cal-event-open:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 1px; }\n.fd-cal-agenda-list .fd-cal-event-who { grid-column: 2; }\n.fd-cal-agenda-list .fd-cal-event-menu { display: grid; top: 50%; transform: translateY(-50%); inset-inline-end: 6px; width: 36px; height: 36px; }\n.fd-cal-agenda-list .fd-cal-event-menu:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 1px; }\n@container fd-cal (max-width: 520px) {\n .fd-cal-agenda-day { grid-template-columns: minmax(0, 1fr); }\n .fd-cal-agenda-head { padding-bottom: 0; }\n .fd-cal-title { flex-basis: 100%; order: -1; }\n}\n\n/* \"Move to\u2026\": its day, its time, its person; and a crowded slot's list, in the same kind of box. */\n.fd-cal-move, .fd-cal-crowd {\n position: absolute; z-index: 30; box-sizing: border-box; width: min(320px, calc(100% - 16px)); padding: 14px; display: grid; gap: 10px;\n background: var(--fd-surface); color: var(--fd-text); border: 1px solid var(--fd-border); border-radius: max(var(--fd-radius), 6px); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);\n}\n.fd-cal-move-title { margin: 0; font-size: 14px; font-weight: 600; }\n.fd-cal-move label { display: grid; gap: 4px; font-size: 13px; }\n.fd-cal-move-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }\n.fd-cal-move-problem { margin: 0; color: var(--fd-error); font-size: 13px; }\n.fd-cal-move-problem:empty { display: none; }\n.fd-cal-move .fd-input[aria-invalid=\"true\"] { border-color: var(--fd-error); }\n.fd-cal-crowd { padding: 10px; gap: 6px; }\n.fd-cal-crowd-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-inline-start: 4px; }\n.fd-cal-crowd .fd-cal-agenda-list { padding: 0; max-height: min(60vh, 360px); overflow-y: auto; }\n";
8
+ /** The calendar's stylesheet, once per document, before the page's own so an app's rule wins. */
9
+ export declare function installCalendarStyles(doc: Document): void;
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CALENDAR_CSS = void 0;
4
+ exports.installCalendarStyles = installCalendarStyles;
5
+ /**
6
+ * A list's calendar in Fieldia's tokens, so a theme, a host's own tokens and
7
+ * the dark scheme reach it: each record a tint of the surface with a bar in
8
+ * its colour, which reads on a light page and a dark one alike. Logical
9
+ * sides throughout, so right to left needs nothing of its own but the arrows.
10
+ */
11
+ exports.CALENDAR_CSS = `
12
+ .fd-cal { position: relative; display: grid; gap: 10px; min-width: 0; color: var(--fd-text); container: fd-cal / inline-size; --fd-cal-hour: 48px; }
13
+ .fd-cal-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
14
+ .fd-cal-nav { display: inline-flex; gap: 4px; align-items: center; }
15
+ .fd-cal .fd-button { min-height: 32px; }
16
+ .fd-cal-step { min-width: 32px; padding-inline: 6px; display: inline-grid; place-items: center; }
17
+ .fd-cal-step svg { width: 16px; height: 16px; }
18
+ .fd-cal-step:dir(rtl) svg { transform: scaleX(-1); }
19
+ .fd-cal-title { margin: 0; flex: 1 1 12em; min-width: 0; font-size: 1.05rem; font-weight: 600; }
20
+ .fd-cal-ranges { display: inline-flex; border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius); overflow: hidden; }
21
+ .fd-cal-ranges .fd-button { border: 0; border-radius: 0; padding-inline: 10px; }
22
+ .fd-cal-ranges .fd-button + .fd-button { border-inline-start: 1px solid var(--fd-border); }
23
+ .fd-cal-ranges .fd-button[aria-pressed="true"] { background: var(--fd-accent-soft); color: var(--fd-accent); font-weight: 600; }
24
+ .fd-cal-said:not(:empty), .fd-cal-alert:not(:empty) { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 6px 10px; border-radius: var(--fd-control-radius); font-size: 13.5px; }
25
+ .fd-cal-said:not(:empty) { background: var(--fd-info-soft); color: var(--fd-text); }
26
+ .fd-cal-alert:not(:empty) { background: var(--fd-error-soft); color: var(--fd-text); }
27
+ .fd-cal-said .fd-button { min-height: 28px; }
28
+ .fd-cal-note { margin: 0; color: var(--fd-muted); font-size: 13px; }
29
+ .fd-cal-body { min-width: 0; border: 1px solid var(--fd-border); border-radius: var(--fd-radius); background: var(--fd-surface); overflow: hidden; }
30
+ .fd-cal-body[aria-busy="true"] { cursor: progress; }
31
+ .fd-cal-failed { margin: 0; padding: 24px; text-align: center; }
32
+ .fd-cal-empty { margin: 0; padding: 32px 16px; text-align: center; color: var(--fd-muted); }
33
+
34
+ /* The day and the week: the hours down the side, a column for each day or each person. */
35
+ .fd-cal-scroll { overflow-x: auto; }
36
+ .fd-cal-grid { display: grid; grid-template-columns: 52px repeat(var(--fd-cal-cols), minmax(var(--fd-cal-min, 0px), 1fr)); min-width: min-content; }
37
+ .fd-cal-corner, .fd-cal-head { box-sizing: border-box; padding: 6px 4px; border-bottom: 1px solid var(--fd-border); font-size: 12px; color: var(--fd-muted); text-align: center; min-width: 0; }
38
+ .fd-cal-head { border-inline-start: 1px solid var(--fd-border); overflow-wrap: anywhere; }
39
+ .fd-cal-head-day { display: inline-grid; justify-items: center; gap: 2px; border: 0; background: none; color: inherit; font: inherit; padding: 2px 6px; border-radius: var(--fd-control-radius); cursor: pointer; }
40
+ .fd-cal-head-day:hover { background: var(--fd-accent-soft); }
41
+ .fd-cal-head-day:focus-visible, .fd-cal-daynum:focus-visible, .fd-cal-more:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 1px; }
42
+ .fd-cal-head-num { font-size: 18px; line-height: 28px; min-width: 28px; border-radius: 999px; color: var(--fd-text); }
43
+ .fd-cal-head[aria-current="date"] .fd-cal-head-num { background: var(--fd-accent); color: var(--fd-accent-text); }
44
+ .fd-cal-head-who { font-size: 13px; font-weight: 600; color: var(--fd-text); }
45
+ .fd-cal-corner { font-size: 11px; display: grid; align-items: end; justify-items: end; padding-inline-end: 6px; }
46
+ .fd-cal-allday { box-sizing: border-box; display: grid; align-content: start; gap: 2px; padding: 2px; min-height: 30px; min-width: 0; border-inline-start: 1px solid var(--fd-border); border-bottom: 1px solid var(--fd-border); }
47
+ .fd-cal-allday[data-alone] { min-height: 240px; }
48
+ .fd-cal-hours { position: relative; height: calc(var(--fd-cal-span) * var(--fd-cal-hour)); }
49
+ .fd-cal-hour { position: absolute; inset-inline-end: 6px; transform: translateY(-50%); font-size: 11px; color: var(--fd-muted); font-variant-numeric: tabular-nums; }
50
+ .fd-cal-hour:first-child { transform: none; }
51
+ .fd-cal-col {
52
+ position: relative; min-width: 0; border-inline-start: 1px solid var(--fd-border); height: calc(var(--fd-cal-span) * var(--fd-cal-hour));
53
+ background-image: repeating-linear-gradient(to bottom, var(--fd-border) 0 1px, transparent 1px calc(var(--fd-cal-hour) / 2), color-mix(in srgb, var(--fd-border) 50%, transparent) calc(var(--fd-cal-hour) / 2) calc(var(--fd-cal-hour) / 2 + 1px), transparent calc(var(--fd-cal-hour) / 2 + 1px) var(--fd-cal-hour));
54
+ }
55
+ .fd-cal-col[data-today] { background-color: color-mix(in srgb, var(--fd-accent) 4%, transparent); }
56
+ .fd-cal-slot { box-sizing: border-box; height: calc(var(--fd-cal-hour) * var(--fd-cal-slot) / 60); }
57
+ .fd-cal[data-creates] .fd-cal-slot, .fd-cal[data-creates] .fd-cal-allday, .fd-cal[data-creates] .fd-cal-day { cursor: cell; }
58
+ .fd-cal-slot:focus { outline: none; }
59
+ .fd-cal-slot:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: -2px; background: var(--fd-accent-soft); }
60
+ .fd-cal-picking { position: absolute; inset-inline: 2px; z-index: 2; box-sizing: border-box; border: 1px dashed var(--fd-accent); border-radius: 4px; background: var(--fd-accent-soft); pointer-events: none; }
61
+ /* Under the records, so a record's words are never struck through. */
62
+ .fd-cal-now { position: absolute; inset-inline: 0; z-index: 0; height: 2px; margin-top: -1px; background: var(--fd-error); pointer-events: none; }
63
+ .fd-cal-now::before { content: ""; position: absolute; inset-inline-start: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--fd-error); }
64
+
65
+ /* A record: a tint of the surface, a bar in its colour. */
66
+ .fd-cal-event {
67
+ --fd-cal-c: var(--fd-accent);
68
+ box-sizing: border-box; min-width: 0; overflow: hidden; padding: 2px 6px; border-radius: 4px; font-size: 12.5px; line-height: 1.3;
69
+ background: color-mix(in srgb, var(--fd-cal-c) 16%, var(--fd-surface)); color: var(--fd-text); border-inline-start: 3px solid var(--fd-cal-c);
70
+ cursor: default; user-select: none; -webkit-user-select: none;
71
+ }
72
+ .fd-cal-event[data-opens], .fd-cal-event[data-moves] { cursor: pointer; }
73
+ .fd-cal-event:hover, .fd-cal-event.fd-cal-hot { background: color-mix(in srgb, var(--fd-cal-c) 26%, var(--fd-surface)); }
74
+ .fd-cal-event:focus { outline: none; }
75
+ .fd-cal-event:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 1px; z-index: 3; }
76
+ .fd-cal-col > .fd-cal-event { position: absolute; z-index: 1; box-shadow: 0 0 0 1px var(--fd-surface); line-height: 16px; container: fd-cal-ev / inline-size; }
77
+ /* Its words in the whole lines its height holds (--fd-cal-lines, by linesIn): none cut through. */
78
+ .fd-cal-col > .fd-cal-event > .fd-cal-event-text { display: block; max-height: calc(var(--fd-cal-lines, 1) * 16px); overflow: hidden; text-overflow: ellipsis; }
79
+ /* Each word whole, a long one cut with "…"; too narrow for its time, the name alone (the hours say when). */
80
+ .fd-cal-col .fd-cal-event-title { overflow-wrap: normal; }
81
+ .fd-cal-col .fd-cal-event-who { overflow: hidden; text-overflow: ellipsis; }
82
+ @container fd-cal-ev (max-width: 56px) { .fd-cal-col .fd-cal-event-time, .fd-cal-col .fd-cal-event-who { display: none; } }
83
+ .fd-cal-event[data-moving] { opacity: 0.9; z-index: 6; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22); pointer-events: none; }
84
+ .fd-cal-event[aria-busy="true"] { opacity: 0.75; }
85
+ .fd-cal-event-time { font-variant-numeric: tabular-nums; }
86
+ .fd-cal-event-title { font-weight: 600; overflow-wrap: anywhere; text-align: match-parent; }
87
+ .fd-cal-event-who { display: block; opacity: 0.85; }
88
+ /* 24 pixels at least, so a finger or a pointer can hit each (WCAG 2.5.8). */
89
+ .fd-cal-allday > .fd-cal-event, .fd-cal-day > .fd-cal-event { position: relative; min-height: 24px; box-sizing: border-box; line-height: 20px; white-space: nowrap; padding-inline-end: 24px; }
90
+ .fd-cal-col > .fd-cal-event[data-short] .fd-cal-event-who { display: none; }
91
+ /* One line (a short record, a month's day, all day): the name cut with "…" at its own end, so a Latin one right to left
92
+ keeps its start; whole when pointed at, and to a screen reader. */
93
+ .fd-cal-col > .fd-cal-event[data-short] > .fd-cal-event-text, .fd-cal-allday .fd-cal-event-text, .fd-cal-day .fd-cal-event-text { display: flex; gap: 0.3em; white-space: nowrap; }
94
+ :is(.fd-cal-col > .fd-cal-event[data-short], .fd-cal-allday > .fd-cal-event, .fd-cal-day > .fd-cal-event) .fd-cal-event-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
95
+ .fd-cal-resize { position: absolute; inset-inline: 0; bottom: 0; height: 8px; cursor: ns-resize; touch-action: none; }
96
+ .fd-cal-event-menu {
97
+ position: absolute; top: 0; inset-inline-end: 0; z-index: 2; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 4px;
98
+ display: none; place-items: center; background: var(--fd-surface); color: var(--fd-text); font: 700 14px/1 system-ui, sans-serif; cursor: pointer;
99
+ }
100
+ .fd-cal-event:hover > .fd-cal-event-menu, .fd-cal-event:focus-within > .fd-cal-event-menu, .fd-cal-event:focus > .fd-cal-event-menu { display: grid; }
101
+ @media (hover: none) { .fd-cal-event-menu { display: grid; } }
102
+
103
+ /* The month: whole weeks, each day its records, and how many more. */
104
+ .fd-cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
105
+ .fd-cal-weekday { padding: 6px 4px; border-bottom: 1px solid var(--fd-border); font-size: 12px; color: var(--fd-muted); text-align: center; }
106
+ .fd-cal-weekday + .fd-cal-weekday, .fd-cal-day:not(:nth-child(7n + 1)) { border-inline-start: 1px solid var(--fd-border); }
107
+ .fd-cal-day { box-sizing: border-box; min-width: 0; min-height: 104px; padding: 3px; display: grid; align-content: start; gap: 2px; border-bottom: 1px solid var(--fd-border); }
108
+ .fd-cal-day[data-out] { background: color-mix(in srgb, var(--fd-text) 3%, var(--fd-surface)); }
109
+ .fd-cal-daynum { justify-self: start; min-width: 26px; height: 26px; padding: 0 6px; border: 0; border-radius: 999px; background: none; color: var(--fd-text); font: inherit; font-size: 12.5px; cursor: pointer; }
110
+ .fd-cal-day[data-out] .fd-cal-daynum { color: var(--fd-muted); }
111
+ .fd-cal-day[aria-current="date"] .fd-cal-daynum { background: var(--fd-accent); color: var(--fd-accent-text); font-weight: 600; }
112
+ .fd-cal-more { justify-self: start; min-height: 24px; padding: 0 6px; border: 0; background: none; color: var(--fd-accent); font: inherit; font-size: 12px; cursor: pointer; }
113
+ /* A crowded slot's "+N more", in the last lane over the records it holds. */
114
+ .fd-cal-col > .fd-cal-more {
115
+ position: absolute; z-index: 1; box-sizing: border-box; display: block; padding: 3px 2px; line-height: 14px; text-align: center; overflow: hidden;
116
+ border-radius: 4px; border: 1px dashed color-mix(in srgb, var(--fd-accent) 55%, transparent); background: var(--fd-accent-soft); font-weight: 600;
117
+ }
118
+ .fd-cal-col > .fd-cal-more:hover { background: color-mix(in srgb, var(--fd-accent) 22%, var(--fd-surface)); }
119
+ .fd-cal-day > .fd-cal-event .fd-cal-event-who { display: none; }
120
+
121
+ /* The agenda: each day that has something, its records in order. */
122
+ .fd-cal-agenda-day { display: grid; grid-template-columns: minmax(8em, 11em) minmax(0, 1fr); border-bottom: 1px solid var(--fd-border); }
123
+ .fd-cal-agenda-day:last-child { border-bottom: 0; }
124
+ .fd-cal-agenda-head { margin: 0; padding: 10px 12px; font-size: 13px; font-weight: 600; }
125
+ .fd-cal-agenda-day[aria-current="date"] .fd-cal-agenda-head { color: var(--fd-accent); }
126
+ .fd-cal-agenda-list { list-style: none; margin: 0; padding: 6px 8px; display: grid; gap: 4px; min-width: 0; }
127
+ .fd-cal-agenda-list .fd-cal-event { position: relative; padding: 0; font-size: 13.5px; }
128
+ .fd-cal-event-open { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; padding-block: 8px; padding-inline: 10px 48px; border-radius: inherit; }
129
+ .fd-cal-event[data-opens] .fd-cal-event-open { cursor: pointer; }
130
+ .fd-cal-event-open:focus { outline: none; }
131
+ .fd-cal-event-open:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 1px; }
132
+ .fd-cal-agenda-list .fd-cal-event-who { grid-column: 2; }
133
+ .fd-cal-agenda-list .fd-cal-event-menu { display: grid; top: 50%; transform: translateY(-50%); inset-inline-end: 6px; width: 36px; height: 36px; }
134
+ .fd-cal-agenda-list .fd-cal-event-menu:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 1px; }
135
+ @container fd-cal (max-width: 520px) {
136
+ .fd-cal-agenda-day { grid-template-columns: minmax(0, 1fr); }
137
+ .fd-cal-agenda-head { padding-bottom: 0; }
138
+ .fd-cal-title { flex-basis: 100%; order: -1; }
139
+ }
140
+
141
+ /* "Move to…": its day, its time, its person; and a crowded slot's list, in the same kind of box. */
142
+ .fd-cal-move, .fd-cal-crowd {
143
+ position: absolute; z-index: 30; box-sizing: border-box; width: min(320px, calc(100% - 16px)); padding: 14px; display: grid; gap: 10px;
144
+ background: var(--fd-surface); color: var(--fd-text); border: 1px solid var(--fd-border); border-radius: max(var(--fd-radius), 6px); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
145
+ }
146
+ .fd-cal-move-title { margin: 0; font-size: 14px; font-weight: 600; }
147
+ .fd-cal-move label { display: grid; gap: 4px; font-size: 13px; }
148
+ .fd-cal-move-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
149
+ .fd-cal-move-problem { margin: 0; color: var(--fd-error); font-size: 13px; }
150
+ .fd-cal-move-problem:empty { display: none; }
151
+ .fd-cal-move .fd-input[aria-invalid="true"] { border-color: var(--fd-error); }
152
+ .fd-cal-crowd { padding: 10px; gap: 6px; }
153
+ .fd-cal-crowd-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-inline-start: 4px; }
154
+ .fd-cal-crowd .fd-cal-agenda-list { padding: 0; max-height: min(60vh, 360px); overflow-y: auto; }
155
+ `;
156
+ /** The calendar's stylesheet, once per document, before the page's own so an app's rule wins. */
157
+ function installCalendarStyles(doc) {
158
+ if (doc.getElementById('fieldia-calendar-styles'))
159
+ return;
160
+ const style = doc.createElement('style');
161
+ style.id = 'fieldia-calendar-styles';
162
+ style.textContent = exports.CALENDAR_CSS;
163
+ doc.head.prepend(style);
164
+ }
165
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../libs/calendar/src/lib/styles.ts"],"names":[],"mappings":";;;AAyJA,sDAMC;AA/JD;;;;;GAKG;AACU,QAAA,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgJ3B,CAAC;AAEF,iGAAiG;AACjG,SAAgB,qBAAqB,CAAC,GAAa;IACjD,IAAI,GAAG,CAAC,cAAc,CAAC,yBAAyB,CAAC;QAAE,OAAO;IAC1D,MAAM,KAAK,GAAG,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACzC,KAAK,CAAC,EAAE,GAAG,yBAAyB,CAAC;IACrC,KAAK,CAAC,WAAW,GAAG,oBAAY,CAAC;IACjC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC"}