calendar-components 0.0.0 → 0.7.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/LICENSE +21 -0
- package/README.md +540 -2
- package/dist/agenda/index.d.ts +273 -0
- package/dist/agenda/index.js +18 -0
- package/dist/agenda/index.js.map +1 -0
- package/dist/chunk-E6WBQCX3.js +192 -0
- package/dist/chunk-E6WBQCX3.js.map +1 -0
- package/dist/chunk-IZC5ZZ5H.js +493 -0
- package/dist/chunk-IZC5ZZ5H.js.map +1 -0
- package/dist/chunk-X27ZSAPJ.js +271 -0
- package/dist/chunk-X27ZSAPJ.js.map +1 -0
- package/dist/chunk-X6ZOEKT4.js +1475 -0
- package/dist/chunk-X6ZOEKT4.js.map +1 -0
- package/dist/date-grid/index.d.ts +456 -0
- package/dist/date-grid/index.js +33 -0
- package/dist/date-grid/index.js.map +1 -0
- package/dist/index.d.ts +149 -0
- package/dist/index.js +254 -0
- package/dist/index.js.map +1 -0
- package/dist/time-grid/index.d.ts +773 -0
- package/dist/time-grid/index.js +41 -0
- package/dist/time-grid/index.js.map +1 -0
- package/dist/types-BxqOsLkh.d.ts +30 -0
- package/package.json +94 -3
- package/src/styles/apple-ios.css +817 -0
- package/src/styles/apple-macos.css +388 -0
- package/src/styles/apple.css +12 -0
- package/src/styles/base.css +256 -0
- package/src/styles/google.css +416 -0
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Apple Calendar: an event is a wash of its colour with a bar of it down the
|
|
3
|
+
* leading edge and its words in a darker cut; picked, it is the colour itself
|
|
4
|
+
* with white words. Corners are barely rounded. Today's date is a filled
|
|
5
|
+
* circle, and a red line with a dot marks the time.
|
|
6
|
+
*/
|
|
7
|
+
/*
|
|
8
|
+
* Measured from Calendar on macOS (the app's own window, week and day views, at 2x):
|
|
9
|
+
*
|
|
10
|
+
* hours an hour is 37pt (set `hourHeight={37}`); lines #e5e5e5, and
|
|
11
|
+
* #f8f8f8 outside the working day (give the grid `workHours`);
|
|
12
|
+
* the weekend's columns #f5f5f5; a 1pt line between days, none
|
|
13
|
+
* before the first
|
|
14
|
+
* gutter 60pt. An hour is its number at 14pt #595959, then 3.5pt, then a
|
|
15
|
+
* 9pt "AM" in #aeaeb2, ending 6pt short of the gutter's edge and
|
|
16
|
+
* centred on its line; "Noon" is 11pt semibold
|
|
17
|
+
* header a day's name and date at 16pt, #272727 (the weekend's #808080),
|
|
18
|
+
* centred, its baseline 10pt over a 1pt rule
|
|
19
|
+
* all-day 22pt, then a 3pt rule in #d9d9d9; "all-day" at 11pt medium
|
|
20
|
+
* #808080, ending 3.5pt short of the gutter's edge
|
|
21
|
+
* event from its day's line to 1pt short of the next, 2pt under its
|
|
22
|
+
* time and down to its end, with 3pt corners; its bar 2.5pt
|
|
23
|
+
* wide, 3pt in; its name 12pt semibold, 9pt in and 6.5pt down
|
|
24
|
+
* to its letters, with what is under it at 12pt, 15.5pt lower
|
|
25
|
+
* all-day an event is a capsule 20pt tall, 1pt under the header's rule,
|
|
26
|
+
* ending 1.5pt short of the next day's line; its name 12pt semibold
|
|
27
|
+
*/
|
|
28
|
+
.calendar-apple {
|
|
29
|
+
/* These are the app's own light colours: the system's (Canvas, form controls) stay light with them. */
|
|
30
|
+
color-scheme: light;
|
|
31
|
+
--calendar-font: 13px / 16px -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif;
|
|
32
|
+
--calendar-gutter: 60px;
|
|
33
|
+
/* A tenth of black: #e5e5e5 on white, and a shade darker over the weekend's grey, as Calendar's are. */
|
|
34
|
+
--calendar-line: rgb(0 0 0 / 0.1);
|
|
35
|
+
--calendar-muted: #808080;
|
|
36
|
+
--calendar-today: #ff3b30;
|
|
37
|
+
--calendar-color: #82fc66;
|
|
38
|
+
}
|
|
39
|
+
.calendar-apple [data-slot="time-grid-hour"] {
|
|
40
|
+
transform: translateY(calc(-50% + 1px));
|
|
41
|
+
padding-inline-end: 5px;
|
|
42
|
+
font-size: 14px;
|
|
43
|
+
line-height: 17px;
|
|
44
|
+
color: #595959;
|
|
45
|
+
}
|
|
46
|
+
.calendar-apple [data-slot="time-grid-hour"] .calendar-period {
|
|
47
|
+
margin-inline-start: 2.5px;
|
|
48
|
+
font-size: 9px;
|
|
49
|
+
font-weight: 500;
|
|
50
|
+
color: #aeaeb2;
|
|
51
|
+
}
|
|
52
|
+
.calendar-apple [data-slot="time-grid-hour"][data-noon] {
|
|
53
|
+
font-size: 11px;
|
|
54
|
+
font-weight: 600;
|
|
55
|
+
}
|
|
56
|
+
.calendar-apple [data-slot="time-grid-line"][data-off-hours] {
|
|
57
|
+
border-top-color: rgb(0 0 0 / 0.028);
|
|
58
|
+
}
|
|
59
|
+
/* Room over the first hour for half its label (`--calendar-lead`): each day's shading and its line run up through it. */
|
|
60
|
+
.calendar-apple [data-slot="time-grid-hours"],
|
|
61
|
+
.calendar-apple [data-slot="time-grid-column"] {
|
|
62
|
+
margin-top: var(--calendar-lead, 13px);
|
|
63
|
+
}
|
|
64
|
+
.calendar-apple [data-slot="time-grid-column"]::before {
|
|
65
|
+
content: "";
|
|
66
|
+
position: absolute;
|
|
67
|
+
bottom: 100%;
|
|
68
|
+
inset-inline: -1px 0;
|
|
69
|
+
height: var(--calendar-lead, 13px);
|
|
70
|
+
box-sizing: border-box;
|
|
71
|
+
border-inline-start: 1px solid var(--calendar-line);
|
|
72
|
+
background: inherit;
|
|
73
|
+
}
|
|
74
|
+
.calendar-apple [data-slot="time-grid-hours"] + [data-slot="time-grid-column"]::before {
|
|
75
|
+
inset-inline-start: 0;
|
|
76
|
+
border-inline-start: 0;
|
|
77
|
+
}
|
|
78
|
+
.calendar-apple [data-slot="time-grid-hours"] + [data-slot="time-grid-column"],
|
|
79
|
+
.calendar-apple .calendar-all-day-label + [data-slot="time-grid-all-day"] {
|
|
80
|
+
border-inline-start: 0;
|
|
81
|
+
}
|
|
82
|
+
.calendar-apple [data-slot="time-grid-event"] {
|
|
83
|
+
/* The space round an event is a clear border: 2pt over it and 1pt after. It starts at its day's line and ends on its end time. */
|
|
84
|
+
border-style: solid;
|
|
85
|
+
border-color: transparent;
|
|
86
|
+
border-width: 0;
|
|
87
|
+
border-block-start-width: 2px;
|
|
88
|
+
border-inline-end-width: 1px;
|
|
89
|
+
/* 3pt corners on what is seen: each outer radius is 3pt more than the clear border beside it. */
|
|
90
|
+
border-start-start-radius: 3px 5px;
|
|
91
|
+
border-start-end-radius: 4px 5px;
|
|
92
|
+
border-end-end-radius: 4px 3px;
|
|
93
|
+
border-end-start-radius: 3px;
|
|
94
|
+
padding-block: 3px 2px;
|
|
95
|
+
padding-inline: 8px 6px;
|
|
96
|
+
color: color-mix(in srgb, var(--calendar-color) 75%, black);
|
|
97
|
+
background-color: color-mix(in srgb, var(--calendar-color) 24%, var(--calendar-surface));
|
|
98
|
+
}
|
|
99
|
+
.calendar-apple [data-slot="time-grid-event"]::before {
|
|
100
|
+
content: "";
|
|
101
|
+
position: absolute;
|
|
102
|
+
inset-block: 3.5px 3px;
|
|
103
|
+
inset-inline-start: 3px;
|
|
104
|
+
width: 2.5px;
|
|
105
|
+
border-radius: 1.25px;
|
|
106
|
+
background: var(--calendar-color);
|
|
107
|
+
}
|
|
108
|
+
.calendar-apple [data-slot="time-grid-event"] > [data-slot="time-grid-event-content"] > :first-child {
|
|
109
|
+
font-size: 12px;
|
|
110
|
+
line-height: 15px;
|
|
111
|
+
font-weight: 600;
|
|
112
|
+
color: color-mix(in srgb, var(--calendar-color) 50%, black);
|
|
113
|
+
}
|
|
114
|
+
.calendar-apple [data-slot="time-grid-event"] > [data-slot="time-grid-event-content"] > :not(:first-child) {
|
|
115
|
+
font-size: 12px;
|
|
116
|
+
line-height: 16px;
|
|
117
|
+
}
|
|
118
|
+
/* Its times, under its name: a 9pt clock, 5pt, then the times with a small day period. */
|
|
119
|
+
.calendar-apple [data-slot="time-grid-event"] .calendar-times {
|
|
120
|
+
white-space: nowrap;
|
|
121
|
+
}
|
|
122
|
+
.calendar-apple [data-slot="time-grid-event"] .calendar-times svg {
|
|
123
|
+
display: inline-block;
|
|
124
|
+
margin-inline: 2px 5px;
|
|
125
|
+
vertical-align: -0.5px;
|
|
126
|
+
}
|
|
127
|
+
.calendar-apple [data-slot="time-grid-event"] .calendar-period {
|
|
128
|
+
font-size: 10px;
|
|
129
|
+
font-weight: 600;
|
|
130
|
+
}
|
|
131
|
+
.calendar-apple [data-slot="time-grid-event"][data-selected] {
|
|
132
|
+
color: white;
|
|
133
|
+
background-color: color-mix(in srgb, var(--calendar-color) 92%, white);
|
|
134
|
+
}
|
|
135
|
+
.calendar-apple [data-slot="time-grid-event"][data-selected] > [data-slot="time-grid-event-content"] > :first-child {
|
|
136
|
+
color: white;
|
|
137
|
+
}
|
|
138
|
+
.calendar-apple [data-slot="time-grid-event"][data-selected]::before {
|
|
139
|
+
display: none;
|
|
140
|
+
}
|
|
141
|
+
.calendar-apple [data-slot="time-grid-day-header"] {
|
|
142
|
+
padding: 7px 0 5px;
|
|
143
|
+
border-inline-start: 0;
|
|
144
|
+
border-bottom: 1px solid var(--calendar-line);
|
|
145
|
+
font-size: 16px;
|
|
146
|
+
line-height: 20px;
|
|
147
|
+
color: #272727;
|
|
148
|
+
}
|
|
149
|
+
/* The rule under the header runs under the gutter too: give the cell before the day headers `calendar-corner`. */
|
|
150
|
+
.calendar-apple .calendar-corner {
|
|
151
|
+
border-bottom: 1px solid var(--calendar-line);
|
|
152
|
+
}
|
|
153
|
+
.calendar-apple [data-slot="time-grid-day-header"] .calendar-day-number {
|
|
154
|
+
font-weight: 400;
|
|
155
|
+
}
|
|
156
|
+
.calendar-apple [data-slot="time-grid-day-header"][data-weekend] {
|
|
157
|
+
color: var(--calendar-muted);
|
|
158
|
+
}
|
|
159
|
+
.calendar-apple [data-slot="time-grid-day-header"][data-today] .calendar-day-number {
|
|
160
|
+
display: inline-grid;
|
|
161
|
+
place-items: center;
|
|
162
|
+
min-width: 26px;
|
|
163
|
+
height: 26px;
|
|
164
|
+
margin-block: -3px;
|
|
165
|
+
border-radius: 999px;
|
|
166
|
+
color: white;
|
|
167
|
+
background: var(--calendar-today);
|
|
168
|
+
}
|
|
169
|
+
.calendar-apple [data-slot="time-grid-now"] {
|
|
170
|
+
height: 1px;
|
|
171
|
+
background: var(--calendar-today);
|
|
172
|
+
}
|
|
173
|
+
.calendar-apple [data-slot="time-grid-now"]::before {
|
|
174
|
+
content: "";
|
|
175
|
+
position: absolute;
|
|
176
|
+
inset-inline-start: -4px;
|
|
177
|
+
top: -3.5px;
|
|
178
|
+
width: 8px;
|
|
179
|
+
height: 8px;
|
|
180
|
+
border-radius: 50%;
|
|
181
|
+
background: var(--calendar-today);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* The weekend's columns sit a shade back, and its dates are dimmer. */
|
|
185
|
+
.calendar-apple [data-slot="time-grid-column"][data-weekend],
|
|
186
|
+
.calendar-apple [data-slot="time-grid-all-day"][data-weekend] {
|
|
187
|
+
background: #f9f9f9;
|
|
188
|
+
}
|
|
189
|
+
.calendar-apple [data-slot="time-grid-all-day"] {
|
|
190
|
+
min-height: 22px;
|
|
191
|
+
box-sizing: content-box;
|
|
192
|
+
padding: 0;
|
|
193
|
+
border-bottom: 3px solid #d9d9d9;
|
|
194
|
+
}
|
|
195
|
+
.calendar-apple .calendar-all-day-label {
|
|
196
|
+
padding: 0;
|
|
197
|
+
padding-inline-end: 3px;
|
|
198
|
+
font-size: 11px;
|
|
199
|
+
line-height: 21px;
|
|
200
|
+
font-weight: 500;
|
|
201
|
+
border-bottom: 3px solid #d9d9d9;
|
|
202
|
+
}
|
|
203
|
+
/* A page's title over the grid: the month heavy and the year light, as "January 2025"; under it, in the day view, the weekday. */
|
|
204
|
+
.calendar-apple .calendar-title {
|
|
205
|
+
margin: 0;
|
|
206
|
+
font-size: 32px;
|
|
207
|
+
line-height: 38px;
|
|
208
|
+
font-weight: 400;
|
|
209
|
+
letter-spacing: -0.01em;
|
|
210
|
+
color: #272727;
|
|
211
|
+
}
|
|
212
|
+
.calendar-apple .calendar-title-month {
|
|
213
|
+
font-weight: 700;
|
|
214
|
+
}
|
|
215
|
+
.calendar-apple .calendar-subtitle {
|
|
216
|
+
margin: 0;
|
|
217
|
+
font-size: 20px;
|
|
218
|
+
line-height: 26px;
|
|
219
|
+
font-weight: 400;
|
|
220
|
+
color: #272727;
|
|
221
|
+
}
|
|
222
|
+
/* A capsule 20pt tall in its 22pt row, from its day's line to 1.5pt short of the next. */
|
|
223
|
+
.calendar-apple [data-slot="time-grid-all-day-event"] {
|
|
224
|
+
box-sizing: border-box;
|
|
225
|
+
height: 20px;
|
|
226
|
+
margin-block: 1px;
|
|
227
|
+
margin-inline-end: 1.5px;
|
|
228
|
+
border-radius: 10px;
|
|
229
|
+
padding: 0 8px;
|
|
230
|
+
font-size: 12px;
|
|
231
|
+
line-height: 20px;
|
|
232
|
+
font-weight: 600;
|
|
233
|
+
color: color-mix(in oklab, var(--calendar-color) 72%, CanvasText);
|
|
234
|
+
background-color: color-mix(in oklab, var(--calendar-color) 18%, var(--calendar-surface));
|
|
235
|
+
}
|
|
236
|
+
.calendar-apple [data-slot="time-grid-all-day-event"][data-selected] {
|
|
237
|
+
color: white;
|
|
238
|
+
background-color: var(--calendar-color);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/*
|
|
242
|
+
* A month: add `calendar-month`. Put the date in `.calendar-date` and the day's events in the cell's
|
|
243
|
+
* `details`: `.calendar-chip` for an all-day event and `.calendar-timed` (its name, then its time) for
|
|
244
|
+
* a timed one. Measured from Calendar on macOS, the app's own window at 2x:
|
|
245
|
+
*
|
|
246
|
+
* weekdays 16pt, set to the far edge 9.5pt in, over a 1pt rule in #c8c8ca, 36pt down
|
|
247
|
+
* a day starts on a 1pt #e5e5e5 line and ends on one under it; a weekend's is #f9f9f9. Its date is
|
|
248
|
+
* 16pt, 11pt in from the far edge, its numerals 9.5pt down; another month's is #b6b6b6;
|
|
249
|
+
* today's is white in a 26pt disc of red
|
|
250
|
+
* events start 31pt down, 1pt apart. All-day: a 16pt capsule from 1.5pt in to 1pt short of the next
|
|
251
|
+
* line, its name 12pt medium. Timed: a 3pt bar 12pt tall, 3.5pt in, then its name 12pt, 13pt in
|
|
252
|
+
*
|
|
253
|
+
* A week is as tall as the window allows (76pt in the window measured): set `--calendar-week`.
|
|
254
|
+
*/
|
|
255
|
+
.calendar-apple.calendar-month {
|
|
256
|
+
--calendar-week: 76px;
|
|
257
|
+
}
|
|
258
|
+
.calendar-apple.calendar-month [data-slot="date-grid-grid"] {
|
|
259
|
+
width: 100%;
|
|
260
|
+
border-collapse: separate;
|
|
261
|
+
border-spacing: 0;
|
|
262
|
+
table-layout: fixed;
|
|
263
|
+
}
|
|
264
|
+
.calendar-apple.calendar-month [data-slot="date-grid-header-cell"] {
|
|
265
|
+
height: 36px;
|
|
266
|
+
padding: 0;
|
|
267
|
+
padding-inline-end: 9.5px;
|
|
268
|
+
box-sizing: border-box;
|
|
269
|
+
border-bottom: 1px solid #c8c8ca;
|
|
270
|
+
text-align: end;
|
|
271
|
+
font-size: 16px;
|
|
272
|
+
/* With its rule, 36pt. */
|
|
273
|
+
line-height: 35px;
|
|
274
|
+
font-weight: 400;
|
|
275
|
+
color: #272727;
|
|
276
|
+
}
|
|
277
|
+
.calendar-apple.calendar-month [data-slot="date-grid-header-cell"][data-weekend] {
|
|
278
|
+
color: var(--calendar-muted);
|
|
279
|
+
}
|
|
280
|
+
.calendar-apple.calendar-month [data-slot="date-grid-cell-wrapper"] {
|
|
281
|
+
height: var(--calendar-week);
|
|
282
|
+
padding: 0;
|
|
283
|
+
vertical-align: top;
|
|
284
|
+
text-align: start;
|
|
285
|
+
border-inline-start: 1px solid var(--calendar-line);
|
|
286
|
+
border-bottom: 1px solid var(--calendar-line);
|
|
287
|
+
}
|
|
288
|
+
.calendar-apple.calendar-month [data-slot="date-grid-cell-wrapper"]:first-child {
|
|
289
|
+
border-inline-start: 0;
|
|
290
|
+
}
|
|
291
|
+
.calendar-apple.calendar-month [data-slot="date-grid-cell-wrapper"]:has([data-weekend]) {
|
|
292
|
+
background: #f9f9f9;
|
|
293
|
+
}
|
|
294
|
+
.calendar-apple.calendar-month [data-slot="date-grid-cell"] {
|
|
295
|
+
display: flex;
|
|
296
|
+
justify-content: flex-end;
|
|
297
|
+
height: 30px;
|
|
298
|
+
padding: 4.5px 11px 0;
|
|
299
|
+
box-sizing: border-box;
|
|
300
|
+
font-size: 16px;
|
|
301
|
+
line-height: 20px;
|
|
302
|
+
color: #272727;
|
|
303
|
+
outline: none;
|
|
304
|
+
cursor: default;
|
|
305
|
+
}
|
|
306
|
+
.calendar-apple.calendar-month [data-slot="date-grid-cell"][data-weekend] {
|
|
307
|
+
color: var(--calendar-muted);
|
|
308
|
+
}
|
|
309
|
+
.calendar-apple.calendar-month [data-slot="date-grid-cell"][data-outside-month] {
|
|
310
|
+
color: #b6b6b6;
|
|
311
|
+
}
|
|
312
|
+
/* A month's first day says which month it is: give its `.calendar-date` a `data-month` ("Nov"). */
|
|
313
|
+
.calendar-apple.calendar-month .calendar-date[data-month]::before {
|
|
314
|
+
content: attr(data-month) " ";
|
|
315
|
+
}
|
|
316
|
+
.calendar-apple.calendar-month [data-slot="date-grid-cell"][data-today] .calendar-date {
|
|
317
|
+
display: inline-grid;
|
|
318
|
+
place-items: center;
|
|
319
|
+
min-width: 26px;
|
|
320
|
+
height: 26px;
|
|
321
|
+
margin: -3px -5px;
|
|
322
|
+
border-radius: 999px;
|
|
323
|
+
color: white;
|
|
324
|
+
background: var(--calendar-today);
|
|
325
|
+
}
|
|
326
|
+
.calendar-apple.calendar-month [data-slot="date-grid-cell"][data-focus-visible] .calendar-date {
|
|
327
|
+
outline: 2px solid Highlight;
|
|
328
|
+
outline-offset: 2px;
|
|
329
|
+
border-radius: 6px;
|
|
330
|
+
}
|
|
331
|
+
.calendar-apple.calendar-month [data-slot="date-grid-cell-details"] {
|
|
332
|
+
display: flex;
|
|
333
|
+
flex-direction: column;
|
|
334
|
+
gap: 1px;
|
|
335
|
+
min-width: 0;
|
|
336
|
+
padding-inline: 1.5px 1px;
|
|
337
|
+
}
|
|
338
|
+
.calendar-apple.calendar-month .calendar-chip,
|
|
339
|
+
.calendar-apple.calendar-month .calendar-timed {
|
|
340
|
+
display: flex;
|
|
341
|
+
align-items: center;
|
|
342
|
+
height: 16px;
|
|
343
|
+
box-sizing: border-box;
|
|
344
|
+
font-size: 12px;
|
|
345
|
+
line-height: 16px;
|
|
346
|
+
white-space: nowrap;
|
|
347
|
+
overflow: hidden;
|
|
348
|
+
}
|
|
349
|
+
.calendar-apple.calendar-month .calendar-chip {
|
|
350
|
+
padding-inline: 7px;
|
|
351
|
+
border-radius: 8px;
|
|
352
|
+
font-weight: 500;
|
|
353
|
+
color: color-mix(in oklab, var(--calendar-color) 45%, black);
|
|
354
|
+
background-color: color-mix(in oklab, var(--calendar-color) 26%, var(--calendar-surface));
|
|
355
|
+
}
|
|
356
|
+
.calendar-apple.calendar-month .calendar-timed {
|
|
357
|
+
padding-inline-start: 2px;
|
|
358
|
+
color: #1a1a1a;
|
|
359
|
+
}
|
|
360
|
+
.calendar-apple.calendar-month .calendar-timed::before {
|
|
361
|
+
content: "";
|
|
362
|
+
flex: none;
|
|
363
|
+
width: 3px;
|
|
364
|
+
height: 12px;
|
|
365
|
+
margin-inline-end: 6.5px;
|
|
366
|
+
border-radius: 1.5px;
|
|
367
|
+
background: var(--calendar-color);
|
|
368
|
+
}
|
|
369
|
+
.calendar-apple.calendar-month .calendar-timed > :first-child {
|
|
370
|
+
overflow: hidden;
|
|
371
|
+
text-overflow: ellipsis;
|
|
372
|
+
}
|
|
373
|
+
/* Its time follows at the far edge where the day is wide enough to hold both: from 150pt, as in Calendar. */
|
|
374
|
+
.calendar-apple.calendar-month [data-slot="date-grid-cell-wrapper"] {
|
|
375
|
+
container-type: inline-size;
|
|
376
|
+
}
|
|
377
|
+
.calendar-apple.calendar-month .calendar-timed > :last-child:not(:first-child) {
|
|
378
|
+
display: none;
|
|
379
|
+
flex: none;
|
|
380
|
+
margin-inline: auto 4px;
|
|
381
|
+
padding-inline-start: 6px;
|
|
382
|
+
color: var(--calendar-muted);
|
|
383
|
+
}
|
|
384
|
+
@container (width >= 150px) {
|
|
385
|
+
.calendar-apple.calendar-month .calendar-timed > :last-child:not(:first-child) {
|
|
386
|
+
display: block;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
@import "./base.css";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Apple Calendar, as Apple draws it for the width it is given: Calendar on
|
|
5
|
+
* macOS in a window, Calendar on iOS on a phone. One class, `.calendar-apple`.
|
|
6
|
+
* Each half was measured from its own app and neither sees the other's rules.
|
|
7
|
+
*
|
|
8
|
+
* An hour is 37pt on macOS and 53pt on iOS, and that is a prop, not a style:
|
|
9
|
+
* give `hourHeight` by the same query (`matchMedia("(width < 640px)")`).
|
|
10
|
+
*/
|
|
11
|
+
@import "./apple-macos.css" (width >= 640px);
|
|
12
|
+
@import "./apple-ios.css" (width < 640px);
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Every rule here is written :where(.calendar), which weighs nothing: a
|
|
3
|
+
* theme's rule always wins over it, whichever stylesheet loads last.
|
|
4
|
+
*
|
|
5
|
+
* What every theme shares: the grid's layout, and nothing of how it looks.
|
|
6
|
+
* A theme sets the variables and adds its own touches.
|
|
7
|
+
*
|
|
8
|
+
* Mark the grid `.calendar` and lay it out with `.calendar-week` (the hours,
|
|
9
|
+
* then a column per day). An event takes its colour from `--calendar-color`.
|
|
10
|
+
*
|
|
11
|
+
* What a theme dresses inside a part, it finds by a class you give it, never
|
|
12
|
+
* by which element it is:
|
|
13
|
+
*
|
|
14
|
+
* .calendar-period the "AM" of an hour or a time, set apart from its number
|
|
15
|
+
* .calendar-day-number the date in a day's heading
|
|
16
|
+
* .calendar-corner the cell before the day headings
|
|
17
|
+
* .calendar-all-day-label
|
|
18
|
+
* .calendar-date, .calendar-dot, .calendar-bar, .calendar-chip, .calendar-timed a month's day and what it holds
|
|
19
|
+
*
|
|
20
|
+
* An event's first child is its name, and what follows are its other lines.
|
|
21
|
+
*/
|
|
22
|
+
:where(.calendar) {
|
|
23
|
+
--calendar-gutter: 3.25rem;
|
|
24
|
+
--calendar-line: color-mix(in oklab, currentColor 12%, transparent);
|
|
25
|
+
--calendar-muted: color-mix(in oklab, currentColor 60%, transparent);
|
|
26
|
+
--calendar-surface: Canvas;
|
|
27
|
+
--calendar-color: #0b93f6;
|
|
28
|
+
font: var(--calendar-font, 13px / 1.25 system-ui, sans-serif);
|
|
29
|
+
color: CanvasText;
|
|
30
|
+
background: var(--calendar-surface);
|
|
31
|
+
}
|
|
32
|
+
.calendar-week {
|
|
33
|
+
display: grid;
|
|
34
|
+
grid-template-columns: var(--calendar-gutter) repeat(var(--time-grid-days, 7), minmax(var(--calendar-column, 0px), 1fr));
|
|
35
|
+
}
|
|
36
|
+
/*
|
|
37
|
+
* The days' names and the all-day row stay put while the hours scroll under them, whatever scrolls them:
|
|
38
|
+
* the grid, a panel it is in, or the page. The grid measures the names for the row under them.
|
|
39
|
+
*/
|
|
40
|
+
.calendar-week {
|
|
41
|
+
--time-grid-scroll-inset: var(--time-grid-head-height, 0px);
|
|
42
|
+
}
|
|
43
|
+
.calendar-week > :is([data-slot="time-grid-day-header"], .calendar-corner, [data-slot="time-grid-all-day"], .calendar-all-day-label) {
|
|
44
|
+
position: sticky;
|
|
45
|
+
inset-block-start: 0;
|
|
46
|
+
z-index: 3;
|
|
47
|
+
background: var(--calendar-surface);
|
|
48
|
+
}
|
|
49
|
+
.calendar-week > :is([data-slot="time-grid-all-day"], .calendar-all-day-label) {
|
|
50
|
+
inset-block-start: var(--time-grid-day-header-height, 0px);
|
|
51
|
+
}
|
|
52
|
+
/*
|
|
53
|
+
* On a phone a week is not squeezed into the screen: three days fill it at a size to read and to touch, and
|
|
54
|
+
* the rest are a swipe away. The hours stay put while the days go under them. Set `--calendar-column` to
|
|
55
|
+
* have a day another width.
|
|
56
|
+
*/
|
|
57
|
+
@media (width < 640px) {
|
|
58
|
+
.calendar-week {
|
|
59
|
+
--calendar-column: calc((100vw - var(--calendar-gutter)) / 3);
|
|
60
|
+
overflow-x: auto;
|
|
61
|
+
overscroll-behavior-x: contain;
|
|
62
|
+
scroll-snap-type: x proximity;
|
|
63
|
+
scroll-padding-inline-start: var(--calendar-gutter);
|
|
64
|
+
}
|
|
65
|
+
.calendar-week > [data-slot="time-grid-hours"],
|
|
66
|
+
.calendar-week > .calendar-corner,
|
|
67
|
+
.calendar-week > .calendar-all-day-label {
|
|
68
|
+
/* The hours part places itself by this (its hours are placed against it either way). */
|
|
69
|
+
--time-grid-hours-position: sticky;
|
|
70
|
+
position: sticky;
|
|
71
|
+
inset-inline-start: 0;
|
|
72
|
+
z-index: 4;
|
|
73
|
+
background: var(--calendar-surface);
|
|
74
|
+
}
|
|
75
|
+
/* The corner is over both: the hours go under it one way, the days' names the other. */
|
|
76
|
+
.calendar-week > .calendar-corner,
|
|
77
|
+
.calendar-week > .calendar-all-day-label {
|
|
78
|
+
z-index: 5;
|
|
79
|
+
}
|
|
80
|
+
.calendar-week > [data-slot="time-grid-day-header"],
|
|
81
|
+
.calendar-week > [data-slot="time-grid-column"] {
|
|
82
|
+
scroll-snap-align: start;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/*
|
|
86
|
+
* Scrolling as the grid's `scrollSnap` and `scrollLock` ask. A scroll rests on a day's start, on an hour's
|
|
87
|
+
* line, or on both; `--time-grid-snap-inset` is how far under the top an hour's line rests, for the half
|
|
88
|
+
* of its label that is over it (or for names that stay put over the days).
|
|
89
|
+
*/
|
|
90
|
+
[data-slot="time-grid"][data-scroll-snap="days"] {
|
|
91
|
+
scroll-snap-type: x mandatory;
|
|
92
|
+
}
|
|
93
|
+
[data-slot="time-grid"][data-scroll-snap="hours"] {
|
|
94
|
+
scroll-snap-type: y mandatory;
|
|
95
|
+
}
|
|
96
|
+
[data-slot="time-grid"][data-scroll-snap="both"] {
|
|
97
|
+
scroll-snap-type: both mandatory;
|
|
98
|
+
}
|
|
99
|
+
[data-slot="time-grid"][data-scroll-snap] {
|
|
100
|
+
scroll-padding-block-start: var(--time-grid-snap-inset, 0.75rem);
|
|
101
|
+
}
|
|
102
|
+
[data-slot="time-grid"][data-scroll-snap] :is([data-slot="time-grid-day-header"], [data-slot="time-grid-column"]) {
|
|
103
|
+
scroll-snap-align: none start;
|
|
104
|
+
}
|
|
105
|
+
[data-slot="time-grid"][data-scroll-snap="hours"] :is([data-slot="time-grid-day-header"], [data-slot="time-grid-column"]) {
|
|
106
|
+
scroll-snap-align: none;
|
|
107
|
+
}
|
|
108
|
+
[data-slot="time-grid"]:is([data-scroll-snap="hours"], [data-scroll-snap="both"]) [data-slot="time-grid-line"] {
|
|
109
|
+
scroll-snap-align: start none;
|
|
110
|
+
}
|
|
111
|
+
/* A touch scrolls the hours and nothing else; the grid moves the days itself, under a finger going sideways. */
|
|
112
|
+
[data-slot="time-grid"][data-scroll-lock] {
|
|
113
|
+
touch-action: pan-y;
|
|
114
|
+
}
|
|
115
|
+
[data-slot="time-grid"][data-scroll-axis="x"] {
|
|
116
|
+
scroll-snap-type: none;
|
|
117
|
+
}
|
|
118
|
+
:where(.calendar) [data-slot="time-grid-hour"] {
|
|
119
|
+
transform: translateY(-50%);
|
|
120
|
+
padding-inline-end: 0.5rem;
|
|
121
|
+
text-align: end;
|
|
122
|
+
white-space: nowrap;
|
|
123
|
+
color: var(--calendar-muted);
|
|
124
|
+
font-size: 0.8125em;
|
|
125
|
+
}
|
|
126
|
+
:where(.calendar) [data-slot="time-grid-column"] {
|
|
127
|
+
border-inline-start: 1px solid var(--calendar-line);
|
|
128
|
+
}
|
|
129
|
+
:where(.calendar) [data-slot="time-grid-line"] {
|
|
130
|
+
border-top: 1px solid var(--calendar-line);
|
|
131
|
+
}
|
|
132
|
+
:where(.calendar) [data-slot="time-grid-day-header"] {
|
|
133
|
+
text-align: center;
|
|
134
|
+
padding-block: 0.375rem;
|
|
135
|
+
border-inline-start: 1px solid var(--calendar-line);
|
|
136
|
+
}
|
|
137
|
+
:where(.calendar) [data-slot="time-grid-event"] {
|
|
138
|
+
box-sizing: border-box;
|
|
139
|
+
/* Clipped, not scrollable: nothing (find in page, a focused link) can bring what does not fit into view. */
|
|
140
|
+
overflow: clip;
|
|
141
|
+
margin: 0;
|
|
142
|
+
border: 1px solid transparent;
|
|
143
|
+
background-clip: padding-box;
|
|
144
|
+
font: inherit;
|
|
145
|
+
text-align: start;
|
|
146
|
+
cursor: default;
|
|
147
|
+
}
|
|
148
|
+
/* An event is a row of the grid's list, and what it shows is in the row's one cell. */
|
|
149
|
+
:where(.calendar) [data-slot="time-grid-event-content"] {
|
|
150
|
+
/*
|
|
151
|
+
* A column that wraps: a line with no room left under the others goes to
|
|
152
|
+
* a second column, which is out of sight. So an event shows whole lines
|
|
153
|
+
* or none of one, never half, as Apple's and Google's do.
|
|
154
|
+
*/
|
|
155
|
+
display: flex;
|
|
156
|
+
flex-flow: column wrap;
|
|
157
|
+
align-content: flex-start;
|
|
158
|
+
/* Far enough that the second column starts beyond the event's own padding. */
|
|
159
|
+
column-gap: 4rem;
|
|
160
|
+
height: 100%;
|
|
161
|
+
}
|
|
162
|
+
:where(.calendar) [data-slot="time-grid-all-day-event"] > [data-slot="time-grid-event-content"] {
|
|
163
|
+
display: block;
|
|
164
|
+
height: auto;
|
|
165
|
+
overflow: hidden;
|
|
166
|
+
text-overflow: ellipsis;
|
|
167
|
+
}
|
|
168
|
+
:where(.calendar) [data-slot="time-grid-event"] > [data-slot="time-grid-event-content"] > * {
|
|
169
|
+
flex: none;
|
|
170
|
+
box-sizing: border-box;
|
|
171
|
+
width: 100%;
|
|
172
|
+
min-width: 0;
|
|
173
|
+
overflow: hidden;
|
|
174
|
+
white-space: nowrap;
|
|
175
|
+
text-overflow: ellipsis;
|
|
176
|
+
}
|
|
177
|
+
/* The name is always there: one line, so what is under it has room, and up to two in a tall event. */
|
|
178
|
+
:where(.calendar) [data-slot="time-grid-event"] > [data-slot="time-grid-event-content"] > :first-child {
|
|
179
|
+
font-weight: 600;
|
|
180
|
+
}
|
|
181
|
+
:where(.calendar) [data-slot="time-grid-event"][data-tall] > [data-slot="time-grid-event-content"] > :first-child {
|
|
182
|
+
display: -webkit-box;
|
|
183
|
+
-webkit-box-orient: vertical;
|
|
184
|
+
-webkit-line-clamp: 2;
|
|
185
|
+
white-space: normal;
|
|
186
|
+
}
|
|
187
|
+
/* The handle is laid over the event's foot, not among its lines. */
|
|
188
|
+
:where(.calendar) [data-slot="time-grid-event"] > [data-slot="time-grid-event-content"] > [data-slot="time-grid-event-resize-handle"] {
|
|
189
|
+
width: auto;
|
|
190
|
+
}
|
|
191
|
+
/*
|
|
192
|
+
* The ring is React Aria's to show (`data-focus-visible`: the keyboard's focus, not a pointer's). Left to the
|
|
193
|
+
* browser, Safari on iOS rings an event a finger has just dropped, since it is focused by script.
|
|
194
|
+
*/
|
|
195
|
+
:where(.calendar) [data-slot="time-grid-event"],
|
|
196
|
+
:where(.calendar) [data-slot="time-grid-all-day-event"] {
|
|
197
|
+
outline: none;
|
|
198
|
+
}
|
|
199
|
+
/* Where a dragged event was, while it is dragged: the same event, faded. */
|
|
200
|
+
:where(.calendar) [data-slot="time-grid-event"][data-origin] {
|
|
201
|
+
opacity: 0.45;
|
|
202
|
+
}
|
|
203
|
+
/* The time a drag has an event at, among the hours: a theme shows it. */
|
|
204
|
+
:where(.calendar) [data-slot="time-grid-drag-time"] {
|
|
205
|
+
display: none;
|
|
206
|
+
}
|
|
207
|
+
:where(.calendar) [data-slot="time-grid-event"][data-focus-visible] {
|
|
208
|
+
outline: 2px solid Highlight;
|
|
209
|
+
outline-offset: 1px;
|
|
210
|
+
z-index: 1;
|
|
211
|
+
}
|
|
212
|
+
:where(.calendar) [data-slot="time-grid-now"] {
|
|
213
|
+
pointer-events: none;
|
|
214
|
+
z-index: 2;
|
|
215
|
+
}
|
|
216
|
+
:where(.calendar)[data-editable] [data-slot="time-grid-event"] {
|
|
217
|
+
cursor: grab;
|
|
218
|
+
/* A finger on an event can still scroll the calendar: held still a moment, the event is picked up instead. */
|
|
219
|
+
touch-action: pan-x pan-y;
|
|
220
|
+
-webkit-touch-callout: none;
|
|
221
|
+
-webkit-user-select: none;
|
|
222
|
+
user-select: none;
|
|
223
|
+
}
|
|
224
|
+
:where(.calendar) [data-slot="time-grid-event"][data-dragging] {
|
|
225
|
+
cursor: grabbing;
|
|
226
|
+
opacity: 0.9;
|
|
227
|
+
box-shadow: 0 6px 18px rgb(0 0 0 / 0.18);
|
|
228
|
+
}
|
|
229
|
+
:where(.calendar) [data-slot="time-grid-event-resize-handle"] {
|
|
230
|
+
height: 8px;
|
|
231
|
+
}
|
|
232
|
+
:where(.calendar) [data-slot="time-grid-all-day"] {
|
|
233
|
+
min-height: 1.5rem;
|
|
234
|
+
padding: 1px;
|
|
235
|
+
border-inline-start: 1px solid var(--calendar-line);
|
|
236
|
+
border-bottom: 1px solid var(--calendar-line);
|
|
237
|
+
}
|
|
238
|
+
:where(.calendar) [data-slot="time-grid-all-day-event"] {
|
|
239
|
+
overflow: hidden;
|
|
240
|
+
white-space: nowrap;
|
|
241
|
+
text-overflow: ellipsis;
|
|
242
|
+
font-weight: 600;
|
|
243
|
+
cursor: default;
|
|
244
|
+
}
|
|
245
|
+
:where(.calendar) [data-slot="time-grid-all-day-event"][data-focus-visible] {
|
|
246
|
+
outline: 2px solid Highlight;
|
|
247
|
+
outline-offset: 1px;
|
|
248
|
+
}
|
|
249
|
+
:where(.calendar) .calendar-all-day-label {
|
|
250
|
+
padding: 0.3rem 0 0;
|
|
251
|
+
padding-inline-end: 0.5rem;
|
|
252
|
+
text-align: end;
|
|
253
|
+
font-size: 0.8125em;
|
|
254
|
+
color: var(--calendar-muted);
|
|
255
|
+
border-bottom: 1px solid var(--calendar-line);
|
|
256
|
+
}
|