@operato/event-view 10.10.2 → 10.15.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 (38) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/coverage/lcov-report/index.html +66 -21
  3. package/coverage/lcov.info +6394 -3195
  4. package/dist/src/calendar-monthly-styles.js +242 -12
  5. package/dist/src/calendar-monthly-styles.js.map +1 -1
  6. package/dist/src/calendar-monthly.d.ts +8 -1
  7. package/dist/src/calendar-monthly.js +90 -17
  8. package/dist/src/calendar-monthly.js.map +1 -1
  9. package/dist/src/calendar-weekly-styles.js +136 -13
  10. package/dist/src/calendar-weekly-styles.js.map +1 -1
  11. package/dist/src/calendar-weekly.d.ts +8 -1
  12. package/dist/src/calendar-weekly.js +92 -12
  13. package/dist/src/calendar-weekly.js.map +1 -1
  14. package/dist/src/day-overflow.d.ts +42 -0
  15. package/dist/src/day-overflow.js +71 -0
  16. package/dist/src/day-overflow.js.map +1 -0
  17. package/dist/src/index.d.ts +1 -0
  18. package/dist/src/index.js +1 -0
  19. package/dist/src/index.js.map +1 -1
  20. package/dist/src/ox-event-view.d.ts +3 -0
  21. package/dist/src/ox-event-view.js +33 -2
  22. package/dist/src/ox-event-view.js.map +1 -1
  23. package/dist/src/types.d.ts +66 -1
  24. package/dist/src/types.js +64 -1
  25. package/dist/src/types.js.map +1 -1
  26. package/dist/test/calendar-layout.test.js +102 -0
  27. package/dist/test/calendar-layout.test.js.map +1 -1
  28. package/dist/test/day-overflow.test.d.ts +1 -0
  29. package/dist/test/day-overflow.test.js +81 -0
  30. package/dist/test/day-overflow.test.js.map +1 -0
  31. package/dist/test/day-state.test.d.ts +1 -0
  32. package/dist/test/day-state.test.js +115 -0
  33. package/dist/test/day-state.test.js.map +1 -0
  34. package/dist/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +4 -3
  36. package/test/calendar-layout.test.ts +130 -0
  37. package/test/day-overflow.test.ts +103 -0
  38. package/test/day-state.test.ts +139 -0
@@ -4,23 +4,66 @@ export const CalendarMonthlyStyles = css `
4
4
  display: flex;
5
5
  flex-direction: column;
6
6
 
7
- --md-text-button-container-height: 24px;
7
+ /*
8
+ One row of controls, one height. The text button was pinned to 24px while the icon
9
+ buttons beside it are 40, so the middle of the three sat in a different band.
10
+ */
11
+ --md-text-button-container-height: 32px;
12
+ --md-icon-button-icon-size: 20px;
13
+ --md-icon-button-state-layer-height: 32px;
14
+ --md-icon-button-state-layer-width: 32px;
8
15
  }
9
16
 
10
17
  [head] {
11
18
  display: flex;
12
19
  align-items: center;
20
+ /*
21
+ The view switch sat flush against the next button — measured 0px between them.
22
+
23
+ The space goes on the switch, not on the row: a flex gap also opens a gap between the
24
+ title and the nav, and those two extra pixels each made the header 8px wider than the
25
+ grid under it, which put a horizontal scrollbar on the whole calendar. [확인함] 2026-09-11
26
+ */
13
27
  }
14
28
 
15
29
  [this-month] {
16
30
  /* Was the x-large keyword, which is a browser step, not a step of this theme. */
17
31
  font-size: var(--md-sys-typescale-headline-small-size, 1.5rem);
32
+ /*
33
+ The month used to be wrapped in <b>. Formatting the whole title through Intl dropped
34
+ that tag and left 24px at weight 400 — large, but with nothing to say it is the title.
35
+ */
36
+ font-weight: var(--md-sys-typescale-headline-small-weight, 640);
37
+ /*
38
+ The header must never be what makes the calendar scroll sideways. A flex item's floor is
39
+ its content, so without this the title pushes the nav out and the grid follows — the same
40
+ rule the day cells needed.
41
+ */
42
+ min-width: 0;
43
+ overflow: hidden;
44
+ text-overflow: ellipsis;
45
+ white-space: nowrap;
18
46
  }
19
47
 
20
48
  [nav] {
21
49
  margin-left: auto;
22
50
  }
23
51
 
52
+ /*
53
+ Room for what the buttons actually occupy.
54
+
55
+ An md-icon-button paints a 48px touch target around its 32px box, so the rightmost control
56
+ reaches 8px past its own edge. With that control flush to the header's right edge the
57
+ header measured 8px wider than the grid under it, and the whole calendar grew a horizontal
58
+ scrollbar. [확인함] 2026-09-11 — button right 898, its inner target 906, header client 860.
59
+
60
+ The inset makes room instead of shrinking the target: a smaller target is a worse button,
61
+ and the last control here is slotted by the host, whose size this component cannot know.
62
+ */
63
+ [head] {
64
+ padding-right: var(--calendar-head-inset, 8px);
65
+ }
66
+
24
67
  ::slotted(*) {
25
68
  color: var(--md-sys-color-secondary);
26
69
  }
@@ -35,6 +78,23 @@ export const CalendarMonthlyStyles = css `
35
78
  padding: 0;
36
79
  margin: var(--calendar-monthly-ol-margin, 9px 0);
37
80
  border-top: var(--calendar-monthly-ol-top-border, 3px solid var(--md-sys-color-outline, #999));
81
+ /*
82
+ The grid closes itself into one box.
83
+
84
+ Its four sides were already drawn - the rule above for the top, each cell's own right and
85
+ bottom, and the left on every seventh - but the corners stayed square, so a host that put
86
+ a rounded box around the calendar ended up with a round line and a square line meeting at
87
+ the same corner. On the plant page the two were 1px apart down the sides and 9px apart at
88
+ the bottom: a doubled line on the left and right, a gap only at the bottom.
89
+
90
+ [확인함] 2026-09-11 outer l69 r931 b956 · grid l70 r930 b947
91
+
92
+ Clipping here rounds the corner cells' own surfaces with it, which is what makes this one
93
+ box rather than a square grid wearing a rounded frame. A host then needs no frame of its
94
+ own - and should not add one, because a second frame is what produced the doubled line.
95
+ */
96
+ border-radius: var(--calendar-monthly-radius, var(--ui-r-small, 6px));
97
+ overflow: hidden;
38
98
  }
39
99
 
40
100
  /*
@@ -68,47 +128,217 @@ export const CalendarMonthlyStyles = css `
68
128
 
69
129
  li[day-of-week] {
70
130
  opacity: 1;
71
- background-color: var(--calendar-current-week-background-color, var(--md-sys-color-surface-variant));
72
- color: var(--calendar-current-week-color, var(--md-sys-color-on-surface));
131
+ background-color: var(--calendar-current-week-background-color, var(--md-sys-color-surface));
132
+ /*
133
+ A column header, not content. It was the same 16px and the same ink as the date numbers
134
+ under it, so only the grey band told them apart.
135
+ */
136
+ color: var(--calendar-current-week-color, var(--md-sys-color-on-surface-variant));
137
+ font-size: var(--md-sys-typescale-label-large-size, 0.8125rem);
138
+ font-weight: 500;
139
+ letter-spacing: 0.02em;
73
140
  padding: var(--calendar-monthly-label-padding);
141
+ /*
142
+ Centred, and it stays centred.
143
+
144
+ I moved this to the left to sit over the date numbers, reading
145
+ --calendar-monthly-label-align as this row's alignment. That token is the date label's,
146
+ not this one's, and the reasoning behind the move was wrong anyway: a calendar cell is a
147
+ surface, not a value, and the date is a marker in its corner. This row names the whole
148
+ column, so it belongs over the column's middle - which is also what every calendar the
149
+ reader already uses does.
150
+ */
74
151
  text-align: center;
75
152
  }
76
153
 
154
+ /*
155
+ Three surfaces, three defaults.
156
+
157
+ All three of these rules used to fall back to surface-variant, so a host that set no tokens
158
+ got the month it is reading, the months either side, and the weekday band in one colour -
159
+ the exact flattening the theme was later written to undo, still sitting in the defaults where
160
+ the next host would meet it. They now default to the same ladder the theme sets: the days you
161
+ are reading are the brightest, the band is a step down, the neighbouring months a step under
162
+ that. Caught by a test running without a theme. [확인함] 2026-09-11
163
+ */
77
164
  li[current-month] {
78
- background-color: var(--calendar-current-month-background-color, var(--md-sys-color-surface-variant));
165
+ background-color: var(--calendar-current-month-background-color, var(--md-sys-color-surface-container-lowest));
79
166
  color: var(--calendar-current-month-color, var(--md-sys-color-on-surface-variant));
80
167
  opacity: 1;
81
168
  }
82
169
 
83
- li[selected] {
170
+ /*
171
+ The month either side, dimmed by a colour rather than by opacity.
172
+
173
+ opacity fades everything in the cell, marks included, so a holiday on the 31st of last month
174
+ came out as washed pink — the mark still had to be read, only the date was meant to recede.
175
+ A surface and an ink say the same thing and leave the marks alone.
176
+ */
177
+ li[date]:not([current-month]) {
178
+ background-color: var(--calendar-other-month-background-color, var(--md-sys-color-surface-variant));
179
+ color: var(--calendar-other-month-color, var(--md-sys-color-on-surface-variant));
180
+ }
181
+
182
+ /*
183
+ What the host says is true of the day itself — a non-working day, a shutdown, a cut-off.
184
+
185
+ The colour arrives on the element as --day-state-color, set by the host through the provider,
186
+ because this component does not know what the word means. See DayState in types.ts.
187
+
188
+ ── Four rules claim this one property, so their weights are matched on purpose ────────────
189
+ li[current-month] (0,1,1)
190
+ li[date]:not([current-month]) (0,2,1) :not() lends its argument's weight
191
+ li[date][day-state] (0,2,1) ← two attributes to reach the same weight
192
+ li[date][selected] (0,2,1)
193
+
194
+ Written as li[day-state] it was (0,1,1) and lost to the :not() rule, so a host could mark a
195
+ day outside the current month and nothing happened - caught by the week view's test, where
196
+ every event cell is behind such a rule and the mark vanished entirely.
197
+
198
+ With the weights level, order decides, and the order is the intent: a day you have selected
199
+ looks selected even if it is a holiday; a holiday you have not touched looks like a holiday.
200
+ */
201
+ li[date][day-state] {
202
+ background-color: var(--day-state-color);
203
+ }
204
+
205
+ li[date][selected] {
84
206
  background-color: var(--calendar-monthly-selected-background-color, var(--md-sys-color-tertiary-container));
85
207
  color: var(--calendar-monthly-selected-color, var(--md-sys-color-on-tertiary-container));
86
208
  }
87
209
 
210
+ /*
211
+ Today is a property of the day, so it is drawn on the day - not only inside it.
212
+
213
+ It was a pill on the date number and nothing else. That reads once you are already looking
214
+ at the number, and the number is a small thing in a large field:
215
+
216
+ [확인함] 2026-09-11 badge 39x21 = 812px² · cell 123x137 = 16,829px²
217
+ 4.8% of its own cell, 0.13% of the grid
218
+
219
+ So the cell carries it now, in two channels that cost nothing structurally.
220
+
221
+ ── Why a gradient and not a background-color ──────────────────────────────────
222
+ background-color on this element is already spoken for, several times over: the month you
223
+ are reading claims it, the months either side claim it, a drag selection claims it, and a
224
+ host marking non-working days will want it next. A background-image paints ON TOP of the
225
+ colour, so today layers over whichever of those applies instead of competing for the slot.
226
+ A day can be today and outside the month and selected all at once.
227
+
228
+ ── Why an inset shadow and not a border ──────────────────────────────────────
229
+ This grid's frame is assembled from each cell's own border (0 1px 1px 0, plus a left on
230
+ every seventh). Giving one cell a wider border moves its row by a pixel and the column with
231
+ it. An inset shadow is painted, not laid out, and it stays inside the clip the ol applies.
232
+
233
+ ── The values ────────────────────────────────────────────────────────────────
234
+ 10% was measured against the neighbouring cell in four theme/mode combinations: dE00 4.4
235
+ and 5.4 on the plant palette, 4.1 and 6.3 on the shell one. 6% sat near 2.5, which is close
236
+ to not being noticed; 12% started to read as a selection rather than a position. The ring
237
+ against the grid's own rule measures 9.85 light and 6.42 dark.
238
+ */
239
+ li[today] {
240
+ background-image: linear-gradient(
241
+ var(--calendar-today-wash, color-mix(in srgb, var(--md-sys-color-primary, #262e38) 10%, transparent)),
242
+ var(--calendar-today-wash, color-mix(in srgb, var(--md-sys-color-primary, #262e38) 10%, transparent))
243
+ );
244
+ /*
245
+ An outline set inward, not an inset shadow flush to the edge.
246
+
247
+ Flush, the ring landed on the cell's own 1px rule and read as a crop mark - two lines in the
248
+ same place, with the corner of a square ring meeting the rounded corner of the grid. The
249
+ offset lifts it off that rule and gives it its own edge to be.
250
+
251
+ And at full primary it was the loudest thing on the screen, louder than the month title,
252
+ which is wrong for a marker that only says where you are. At 72% it is still plainly a line
253
+ and no longer shouting:
254
+
255
+ [확인함] 2026-09-11 against the cell 5.55 light · 5.84 dark
256
+ against the grid's own rule 3.98 · 3.77
257
+
258
+ 3.98 matters as much as 5.55: past 3:1 it reads as a different line rather than a thicker
259
+ one. Kept as a translucent mix rather than a computed colour so it still works over whatever
260
+ surface the day has - another month, a holiday, a selection.
261
+
262
+ outline rather than box-shadow because only outline takes an offset. Nothing here is
263
+ focusable today; if a cell ever is, its focus ring needs a different channel.
264
+ */
265
+ outline: var(--calendar-today-ring-width, 2px) solid
266
+ var(--calendar-today-ring-color, color-mix(in srgb, var(--md-sys-color-primary, #262e38) 72%, transparent));
267
+ outline-offset: var(--calendar-today-ring-inset, -3px);
268
+ }
269
+
88
270
  li[date] {
89
271
  min-height: var(--calendar-monthly-date-min-height, 120px);
272
+ max-height: var(--calendar-monthly-date-max-height, none);
273
+ /*
274
+ The clip belongs on the box that carries the ceiling.
275
+
276
+ It was on the row container inside instead, and that box has no height of its own - it grows
277
+ to fit its rows, so overflow:hidden there had nothing to clip against and the rows simply
278
+ spilled past the capped cell. Caught by the test: the cell held its 160px and the component
279
+ reported nothing cut, because by its own measurement nothing was.
280
+ */
281
+ overflow: hidden;
90
282
  }
91
283
 
92
284
  span[date-label] {
93
285
  display: block;
94
286
  margin: var(--calendar-monthly-date-label-margin);
95
287
  text-align: var(--calendar-monthly-label-align, left);
288
+ /*
289
+ The date is the cell's name, not its content — and its size was never chosen.
290
+
291
+ With nothing set here it inherited the page's body size and came out 16px at weight 400:
292
+ bigger than the weekday band heading its column (13px/500) and bigger than everything in
293
+ the cell it names. The week view had already been given 13px/500 for the same date, so
294
+ switching views changed the size of the same number. [확인함] 2026-09-11
295
+
296
+ One step above the band, two above the events, and the weight carries it instead of the
297
+ size:
298
+
299
+ title 24 / 640
300
+ date 14 / 500 ← here
301
+ band 13 / 500
302
+ events 12 / 400
303
+ */
304
+ font-size: var(--md-sys-typescale-title-small-size, 0.875rem);
305
+ font-weight: 500;
96
306
  }
97
307
 
308
+ /*
309
+ The date, emphasised - not a filled pill.
310
+
311
+ It was a solid lozenge in primary with reversed text. That made two maximum-contrast marks in
312
+ one cell once the cell itself took the ring, and this theme's primary is near-black, so in
313
+ light mode the lozenge read as an ink blot rather than an accent. It also made today's label
314
+ 39px wide where every other day's is 114px, so the number's left edge moved on one day of the
315
+ month - and in the week view it wrapped the weekday too, at 61px.
316
+
317
+ Weight carries it, and only weight. Tinting it as well pointed the emphasis two ways: primary
318
+ is a step away from the body ink, so a bolder today number came out measurably paler than
319
+ every ordinary day beside it — dE00 7.2 dark, 5.7 light, against cell contrast 9.94 where its
320
+ neighbours had 12.97. The ring is the accent-coloured thing; the number is a number.
321
+
322
+ The colour token stays, defaulting to the ink the cell already gives, for a host whose accent
323
+ is far enough from its body ink for a tint to add something.
324
+ */
98
325
  li[today] > span[date-label] {
99
- display: inline-block;
100
- background-color: var(--calendar-monthly-date-label-background-color, var(--md-sys-color-error, #cc3300));
101
- padding: var(--calendar-monthly-date-label-padding);
102
- border-radius: var(--calendar-monthly-date-label-border-radius, 999em);
103
- color: var(--calendar-monthly-date-label-color, var(--md-sys-color-on-error, #fff));
104
- min-width: 16px;
105
- text-align: center;
326
+ font-weight: 700;
327
+ color: var(--calendar-monthly-date-label-color, inherit);
106
328
  }
107
329
 
108
330
  [date] div {
109
331
  display: block;
110
332
  /* Was the small keyword. */
111
333
  font-size: var(--md-sys-typescale-body-small-size, 0.75rem);
334
+ /*
335
+ Events ran into the cell's own borders — measured 0px on the left and 1px on the right,
336
+ while the date number above them sat 4px in. One cell, two left edges, and the titles
337
+ touching the rules on both sides.
338
+
339
+ The inset reads the date label's own margin, so the two lines stay together.
340
+ */
341
+ padding-inline: var(--calendar-monthly-date-label-margin, 4px);
112
342
  }
113
343
 
114
344
  [event] {
@@ -1 +1 @@
1
- {"version":3,"file":"calendar-monthly-styles.js","sourceRoot":"","sources":["../../src/calendar-monthly-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4HvC,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport const CalendarMonthlyStyles = css`\n :host {\n display: flex;\n flex-direction: column;\n\n --md-text-button-container-height: 24px;\n }\n\n [head] {\n display: flex;\n align-items: center;\n }\n\n [this-month] {\n /* Was the x-large keyword, which is a browser step, not a step of this theme. */\n font-size: var(--md-sys-typescale-headline-small-size, 1.5rem);\n }\n\n [nav] {\n margin-left: auto;\n }\n\n ::slotted(*) {\n color: var(--md-sys-color-secondary);\n }\n\n ol {\n flex: 1;\n\n display: grid;\n grid-template-columns: repeat(7, 1fr);\n grid-template-rows: max-content;\n\n padding: 0;\n margin: var(--calendar-monthly-ol-margin, 9px 0);\n border-top: var(--calendar-monthly-ol-top-border, 3px solid var(--md-sys-color-outline, #999));\n }\n\n /*\n * The seven tracks are 1fr, and 1fr's minimum is min-content — so a cell whose chip is\n * white-space: nowrap pushes its own track wide and squeezes the rest.\n *\n * Measured at 700px with one long title: li widths came out\n * [58, 58, 353, 58, 58, 58, 58] without min-width: 0\n * [100 × 7] with it\n *\n * The host page had already asked for text-overflow: ellipsis on that chip, and it never\n * ran: the track grew instead of the text being clipped. [확인함] 2026-09-07\n */\n li {\n position: relative;\n min-width: 0;\n\n min-height: 10%;\n list-style: none;\n border: var(--calendar-monthly-border, 1px solid var(--md-sys-color-outline-variant, rgba(0, 0, 0, 0.1)));\n border-width: var(--calendar-monthly-border-width, 0 1px 1px 0px);\n opacity: var(--calendar-monthly-opacity);\n\n user-select: none;\n touch-action: none;\n }\n\n li:nth-child(7n + 1) {\n border-left-width: 1px;\n }\n\n li[day-of-week] {\n opacity: 1;\n background-color: var(--calendar-current-week-background-color, var(--md-sys-color-surface-variant));\n color: var(--calendar-current-week-color, var(--md-sys-color-on-surface));\n padding: var(--calendar-monthly-label-padding);\n text-align: center;\n }\n\n li[current-month] {\n background-color: var(--calendar-current-month-background-color, var(--md-sys-color-surface-variant));\n color: var(--calendar-current-month-color, var(--md-sys-color-on-surface-variant));\n opacity: 1;\n }\n\n li[selected] {\n background-color: var(--calendar-monthly-selected-background-color, var(--md-sys-color-tertiary-container));\n color: var(--calendar-monthly-selected-color, var(--md-sys-color-on-tertiary-container));\n }\n\n li[date] {\n min-height: var(--calendar-monthly-date-min-height, 120px);\n }\n\n span[date-label] {\n display: block;\n margin: var(--calendar-monthly-date-label-margin);\n text-align: var(--calendar-monthly-label-align, left);\n }\n\n li[today] > span[date-label] {\n display: inline-block;\n background-color: var(--calendar-monthly-date-label-background-color, var(--md-sys-color-error, #cc3300));\n padding: var(--calendar-monthly-date-label-padding);\n border-radius: var(--calendar-monthly-date-label-border-radius, 999em);\n color: var(--calendar-monthly-date-label-color, var(--md-sys-color-on-error, #fff));\n min-width: 16px;\n text-align: center;\n }\n\n [date] div {\n display: block;\n /* Was the small keyword. */\n font-size: var(--md-sys-typescale-body-small-size, 0.75rem);\n }\n\n [event] {\n display: block;\n background-color: var(--calendar-monthly-background-color);\n color: var(--calendar-monthly-color);\n border: var(--calendar-monthly-event-border);\n border-width: var(--calendar-monthly-event-border-width);\n margin: var(--calendar-monthly-event-margin, 0 0 4px 0);\n padding: var(--calendar-monthly-event-padding, 2px 4px 2px 4px);\n\n user-select: all;\n touch-action: all;\n }\n`\n"]}
1
+ {"version":3,"file":"calendar-monthly-styles.js","sourceRoot":"","sources":["../../src/calendar-monthly-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkWvC,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport const CalendarMonthlyStyles = css`\n :host {\n display: flex;\n flex-direction: column;\n\n /*\n One row of controls, one height. The text button was pinned to 24px while the icon\n buttons beside it are 40, so the middle of the three sat in a different band.\n */\n --md-text-button-container-height: 32px;\n --md-icon-button-icon-size: 20px;\n --md-icon-button-state-layer-height: 32px;\n --md-icon-button-state-layer-width: 32px;\n }\n\n [head] {\n display: flex;\n align-items: center;\n /*\n The view switch sat flush against the next button — measured 0px between them.\n\n The space goes on the switch, not on the row: a flex gap also opens a gap between the\n title and the nav, and those two extra pixels each made the header 8px wider than the\n grid under it, which put a horizontal scrollbar on the whole calendar. [확인함] 2026-09-11\n */\n }\n\n [this-month] {\n /* Was the x-large keyword, which is a browser step, not a step of this theme. */\n font-size: var(--md-sys-typescale-headline-small-size, 1.5rem);\n /*\n The month used to be wrapped in <b>. Formatting the whole title through Intl dropped\n that tag and left 24px at weight 400 — large, but with nothing to say it is the title.\n */\n font-weight: var(--md-sys-typescale-headline-small-weight, 640);\n /*\n The header must never be what makes the calendar scroll sideways. A flex item's floor is\n its content, so without this the title pushes the nav out and the grid follows — the same\n rule the day cells needed.\n */\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n [nav] {\n margin-left: auto;\n }\n\n /*\n Room for what the buttons actually occupy.\n\n An md-icon-button paints a 48px touch target around its 32px box, so the rightmost control\n reaches 8px past its own edge. With that control flush to the header's right edge the\n header measured 8px wider than the grid under it, and the whole calendar grew a horizontal\n scrollbar. [확인함] 2026-09-11 — button right 898, its inner target 906, header client 860.\n\n The inset makes room instead of shrinking the target: a smaller target is a worse button,\n and the last control here is slotted by the host, whose size this component cannot know.\n */\n [head] {\n padding-right: var(--calendar-head-inset, 8px);\n }\n\n ::slotted(*) {\n color: var(--md-sys-color-secondary);\n }\n\n ol {\n flex: 1;\n\n display: grid;\n grid-template-columns: repeat(7, 1fr);\n grid-template-rows: max-content;\n\n padding: 0;\n margin: var(--calendar-monthly-ol-margin, 9px 0);\n border-top: var(--calendar-monthly-ol-top-border, 3px solid var(--md-sys-color-outline, #999));\n /*\n The grid closes itself into one box.\n\n Its four sides were already drawn - the rule above for the top, each cell's own right and\n bottom, and the left on every seventh - but the corners stayed square, so a host that put\n a rounded box around the calendar ended up with a round line and a square line meeting at\n the same corner. On the plant page the two were 1px apart down the sides and 9px apart at\n the bottom: a doubled line on the left and right, a gap only at the bottom.\n\n [확인함] 2026-09-11 outer l69 r931 b956 · grid l70 r930 b947\n\n Clipping here rounds the corner cells' own surfaces with it, which is what makes this one\n box rather than a square grid wearing a rounded frame. A host then needs no frame of its\n own - and should not add one, because a second frame is what produced the doubled line.\n */\n border-radius: var(--calendar-monthly-radius, var(--ui-r-small, 6px));\n overflow: hidden;\n }\n\n /*\n * The seven tracks are 1fr, and 1fr's minimum is min-content — so a cell whose chip is\n * white-space: nowrap pushes its own track wide and squeezes the rest.\n *\n * Measured at 700px with one long title: li widths came out\n * [58, 58, 353, 58, 58, 58, 58] without min-width: 0\n * [100 × 7] with it\n *\n * The host page had already asked for text-overflow: ellipsis on that chip, and it never\n * ran: the track grew instead of the text being clipped. [확인함] 2026-09-07\n */\n li {\n position: relative;\n min-width: 0;\n\n min-height: 10%;\n list-style: none;\n border: var(--calendar-monthly-border, 1px solid var(--md-sys-color-outline-variant, rgba(0, 0, 0, 0.1)));\n border-width: var(--calendar-monthly-border-width, 0 1px 1px 0px);\n opacity: var(--calendar-monthly-opacity);\n\n user-select: none;\n touch-action: none;\n }\n\n li:nth-child(7n + 1) {\n border-left-width: 1px;\n }\n\n li[day-of-week] {\n opacity: 1;\n background-color: var(--calendar-current-week-background-color, var(--md-sys-color-surface));\n /*\n A column header, not content. It was the same 16px and the same ink as the date numbers\n under it, so only the grey band told them apart.\n */\n color: var(--calendar-current-week-color, var(--md-sys-color-on-surface-variant));\n font-size: var(--md-sys-typescale-label-large-size, 0.8125rem);\n font-weight: 500;\n letter-spacing: 0.02em;\n padding: var(--calendar-monthly-label-padding);\n /*\n Centred, and it stays centred.\n\n I moved this to the left to sit over the date numbers, reading\n --calendar-monthly-label-align as this row's alignment. That token is the date label's,\n not this one's, and the reasoning behind the move was wrong anyway: a calendar cell is a\n surface, not a value, and the date is a marker in its corner. This row names the whole\n column, so it belongs over the column's middle - which is also what every calendar the\n reader already uses does.\n */\n text-align: center;\n }\n\n /*\n Three surfaces, three defaults.\n\n All three of these rules used to fall back to surface-variant, so a host that set no tokens\n got the month it is reading, the months either side, and the weekday band in one colour -\n the exact flattening the theme was later written to undo, still sitting in the defaults where\n the next host would meet it. They now default to the same ladder the theme sets: the days you\n are reading are the brightest, the band is a step down, the neighbouring months a step under\n that. Caught by a test running without a theme. [확인함] 2026-09-11\n */\n li[current-month] {\n background-color: var(--calendar-current-month-background-color, var(--md-sys-color-surface-container-lowest));\n color: var(--calendar-current-month-color, var(--md-sys-color-on-surface-variant));\n opacity: 1;\n }\n\n /*\n The month either side, dimmed by a colour rather than by opacity.\n \n opacity fades everything in the cell, marks included, so a holiday on the 31st of last month\n came out as washed pink — the mark still had to be read, only the date was meant to recede.\n A surface and an ink say the same thing and leave the marks alone.\n */\n li[date]:not([current-month]) {\n background-color: var(--calendar-other-month-background-color, var(--md-sys-color-surface-variant));\n color: var(--calendar-other-month-color, var(--md-sys-color-on-surface-variant));\n }\n\n /*\n What the host says is true of the day itself — a non-working day, a shutdown, a cut-off.\n\n The colour arrives on the element as --day-state-color, set by the host through the provider,\n because this component does not know what the word means. See DayState in types.ts.\n\n ── Four rules claim this one property, so their weights are matched on purpose ────────────\n li[current-month] (0,1,1)\n li[date]:not([current-month]) (0,2,1) :not() lends its argument's weight\n li[date][day-state] (0,2,1) ← two attributes to reach the same weight\n li[date][selected] (0,2,1)\n\n Written as li[day-state] it was (0,1,1) and lost to the :not() rule, so a host could mark a\n day outside the current month and nothing happened - caught by the week view's test, where\n every event cell is behind such a rule and the mark vanished entirely.\n\n With the weights level, order decides, and the order is the intent: a day you have selected\n looks selected even if it is a holiday; a holiday you have not touched looks like a holiday.\n */\n li[date][day-state] {\n background-color: var(--day-state-color);\n }\n\n li[date][selected] {\n background-color: var(--calendar-monthly-selected-background-color, var(--md-sys-color-tertiary-container));\n color: var(--calendar-monthly-selected-color, var(--md-sys-color-on-tertiary-container));\n }\n\n /*\n Today is a property of the day, so it is drawn on the day - not only inside it.\n\n It was a pill on the date number and nothing else. That reads once you are already looking\n at the number, and the number is a small thing in a large field:\n\n [확인함] 2026-09-11 badge 39x21 = 812px² · cell 123x137 = 16,829px²\n 4.8% of its own cell, 0.13% of the grid\n\n So the cell carries it now, in two channels that cost nothing structurally.\n\n ── Why a gradient and not a background-color ──────────────────────────────────\n background-color on this element is already spoken for, several times over: the month you\n are reading claims it, the months either side claim it, a drag selection claims it, and a\n host marking non-working days will want it next. A background-image paints ON TOP of the\n colour, so today layers over whichever of those applies instead of competing for the slot.\n A day can be today and outside the month and selected all at once.\n\n ── Why an inset shadow and not a border ──────────────────────────────────────\n This grid's frame is assembled from each cell's own border (0 1px 1px 0, plus a left on\n every seventh). Giving one cell a wider border moves its row by a pixel and the column with\n it. An inset shadow is painted, not laid out, and it stays inside the clip the ol applies.\n\n ── The values ────────────────────────────────────────────────────────────────\n 10% was measured against the neighbouring cell in four theme/mode combinations: dE00 4.4\n and 5.4 on the plant palette, 4.1 and 6.3 on the shell one. 6% sat near 2.5, which is close\n to not being noticed; 12% started to read as a selection rather than a position. The ring\n against the grid's own rule measures 9.85 light and 6.42 dark.\n */\n li[today] {\n background-image: linear-gradient(\n var(--calendar-today-wash, color-mix(in srgb, var(--md-sys-color-primary, #262e38) 10%, transparent)),\n var(--calendar-today-wash, color-mix(in srgb, var(--md-sys-color-primary, #262e38) 10%, transparent))\n );\n /*\n An outline set inward, not an inset shadow flush to the edge.\n\n Flush, the ring landed on the cell's own 1px rule and read as a crop mark - two lines in the\n same place, with the corner of a square ring meeting the rounded corner of the grid. The\n offset lifts it off that rule and gives it its own edge to be.\n\n And at full primary it was the loudest thing on the screen, louder than the month title,\n which is wrong for a marker that only says where you are. At 72% it is still plainly a line\n and no longer shouting:\n\n [확인함] 2026-09-11 against the cell 5.55 light · 5.84 dark\n against the grid's own rule 3.98 · 3.77\n\n 3.98 matters as much as 5.55: past 3:1 it reads as a different line rather than a thicker\n one. Kept as a translucent mix rather than a computed colour so it still works over whatever\n surface the day has - another month, a holiday, a selection.\n\n outline rather than box-shadow because only outline takes an offset. Nothing here is\n focusable today; if a cell ever is, its focus ring needs a different channel.\n */\n outline: var(--calendar-today-ring-width, 2px) solid\n var(--calendar-today-ring-color, color-mix(in srgb, var(--md-sys-color-primary, #262e38) 72%, transparent));\n outline-offset: var(--calendar-today-ring-inset, -3px);\n }\n\n li[date] {\n min-height: var(--calendar-monthly-date-min-height, 120px);\n max-height: var(--calendar-monthly-date-max-height, none);\n /*\n The clip belongs on the box that carries the ceiling.\n\n It was on the row container inside instead, and that box has no height of its own - it grows\n to fit its rows, so overflow:hidden there had nothing to clip against and the rows simply\n spilled past the capped cell. Caught by the test: the cell held its 160px and the component\n reported nothing cut, because by its own measurement nothing was.\n */\n overflow: hidden;\n }\n\n span[date-label] {\n display: block;\n margin: var(--calendar-monthly-date-label-margin);\n text-align: var(--calendar-monthly-label-align, left);\n /*\n The date is the cell's name, not its content — and its size was never chosen.\n\n With nothing set here it inherited the page's body size and came out 16px at weight 400:\n bigger than the weekday band heading its column (13px/500) and bigger than everything in\n the cell it names. The week view had already been given 13px/500 for the same date, so\n switching views changed the size of the same number. [확인함] 2026-09-11\n\n One step above the band, two above the events, and the weight carries it instead of the\n size:\n\n title 24 / 640\n date 14 / 500 ← here\n band 13 / 500\n events 12 / 400\n */\n font-size: var(--md-sys-typescale-title-small-size, 0.875rem);\n font-weight: 500;\n }\n\n /*\n The date, emphasised - not a filled pill.\n\n It was a solid lozenge in primary with reversed text. That made two maximum-contrast marks in\n one cell once the cell itself took the ring, and this theme's primary is near-black, so in\n light mode the lozenge read as an ink blot rather than an accent. It also made today's label\n 39px wide where every other day's is 114px, so the number's left edge moved on one day of the\n month - and in the week view it wrapped the weekday too, at 61px.\n\n Weight carries it, and only weight. Tinting it as well pointed the emphasis two ways: primary\n is a step away from the body ink, so a bolder today number came out measurably paler than\n every ordinary day beside it — dE00 7.2 dark, 5.7 light, against cell contrast 9.94 where its\n neighbours had 12.97. The ring is the accent-coloured thing; the number is a number.\n\n The colour token stays, defaulting to the ink the cell already gives, for a host whose accent\n is far enough from its body ink for a tint to add something.\n */\n li[today] > span[date-label] {\n font-weight: 700;\n color: var(--calendar-monthly-date-label-color, inherit);\n }\n\n [date] div {\n display: block;\n /* Was the small keyword. */\n font-size: var(--md-sys-typescale-body-small-size, 0.75rem);\n /*\n Events ran into the cell's own borders — measured 0px on the left and 1px on the right,\n while the date number above them sat 4px in. One cell, two left edges, and the titles\n touching the rules on both sides.\n\n The inset reads the date label's own margin, so the two lines stay together.\n */\n padding-inline: var(--calendar-monthly-date-label-margin, 4px);\n }\n\n [event] {\n display: block;\n background-color: var(--calendar-monthly-background-color);\n color: var(--calendar-monthly-color);\n border: var(--calendar-monthly-event-border);\n border-width: var(--calendar-monthly-event-border-width);\n margin: var(--calendar-monthly-event-margin, 0 0 4px 0);\n padding: var(--calendar-monthly-event-padding, 2px 4px 2px 4px);\n\n user-select: all;\n touch-action: all;\n }\n`\n"]}
@@ -1,7 +1,9 @@
1
1
  import '@material/web/button/text-button.js';
2
+ import '@material/web/iconbutton/icon-button.js';
3
+ import '@material/web/icon/icon.js';
2
4
  import { Dayjs } from 'dayjs/esm/index.js';
3
5
  import { LitElement, PropertyValues } from 'lit';
4
- import { BizEvent, CALENDAR, EventProvider } from './types.js';
6
+ import { BizEvent, CALENDAR, DayState, EventProvider } from './types.js';
5
7
  export declare class CalendarMonthly extends LitElement {
6
8
  static styles: import("lit").CSSResult[];
7
9
  eventProvider?: EventProvider;
@@ -9,8 +11,13 @@ export declare class CalendarMonthly extends LitElement {
9
11
  month: number;
10
12
  calendar?: CALENDAR;
11
13
  eventMap?: Map<Date, BizEvent[]>;
14
+ /** What is true of the days themselves, if the host answers for them. See {@link DayState}. */
15
+ dayStateMap?: Map<Date, DayState>;
12
16
  selections?: [Date, Date] | [];
13
17
  pointerDownDate?: Date | null;
18
+ /** Last reported overflow, so the host is not told the same thing after every render. */
19
+ private lastOverflow;
20
+ private tooltip;
14
21
  render(): import("lit-html").TemplateResult<1>;
15
22
  updated(changes: PropertyValues<this>): Promise<void>;
16
23
  handlePointerDown(event: PointerEvent): void;
@@ -1,41 +1,83 @@
1
1
  import { __decorate } from "tslib";
2
2
  import '@material/web/button/text-button.js';
3
+ import '@material/web/iconbutton/icon-button.js';
4
+ import '@material/web/icon/icon.js';
3
5
  import dayjs from 'dayjs/esm/index.js';
4
6
  import { html, LitElement } from 'lit';
5
7
  import { customElement, property, state } from 'lit/decorators.js';
8
+ import { ifDefined } from 'lit/directives/if-defined.js';
9
+ import { TooltipReactiveController } from '@operato/utils';
6
10
  import { CalendarMonthlyStyles } from './calendar-monthly-styles.js';
7
- import { WEEKDAYS, isToday } from './types.js';
11
+ import { reportDayOverflow } from './day-overflow.js';
12
+ import { isToday, dayLabel, monthTitle, nextMonthLabel, previousMonthLabel, todayLabel, weekdayNames } from './types.js';
8
13
  let CalendarMonthly = class CalendarMonthly extends LitElement {
9
14
  constructor() {
10
15
  super(...arguments);
11
16
  this.year = dayjs().year();
12
17
  this.month = dayjs().month();
18
+ /** Last reported overflow, so the host is not told the same thing after every render. */
19
+ this.lastOverflow = '';
20
+ /*
21
+ * Event titles are drawn on one nowrap line and cut with an ellipsis, so the full name only
22
+ * exists in a tooltip. Hosts were reaching for the browser's own `title`, which waits about a
23
+ * second and cannot be styled — measured on the plant calendar.
24
+ *
25
+ * data-grist already runs this controller on its header and its cells. It waits 450ms so a
26
+ * pointer crossing the grid does not trail tooltips behind it, then drops the wait once one
27
+ * is up, and it only fires on elements that actually overflow — which is exactly the set of
28
+ * titles worth expanding.
29
+ *
30
+ * Hosts mark the rows they want expanded with data-reactive-tooltip. The listener sits on
31
+ * this shadow root, where the host's own event templates are rendered.
32
+ */
33
+ this.tooltip = new TooltipReactiveController(this, {
34
+ /*
35
+ * Read the attribute's value, not the row's text.
36
+ *
37
+ * The controller treats the attribute as a marker and otherwise repeats what is already on
38
+ * screen, which for a cut title is at least the whole title. But a host writes the line it
39
+ * wants read - the plant calendar puts the kind, the order and where it runs in there - and
40
+ * without this that sentence was thrown away. [확인함] 2026-09-11
41
+ */
42
+ content: element => element.getAttribute('data-reactive-tooltip') || element.textContent?.trim() || ''
43
+ });
13
44
  }
14
45
  static { this.styles = [CalendarMonthlyStyles]; }
15
46
  render() {
16
47
  return html `
17
48
  <div head>
18
- <div this-month><b>${dayjs(new Date(this.year, this.month)).format('MMMM')}</b> ${this.year}</div>
49
+ <div this-month>${monthTitle(this.year, this.month)}</div>
19
50
 
20
51
  <div nav>
21
- <md-text-button
52
+ <!--
53
+ Chevrons, not the "<" and ">" characters that were here. Those are text: they take
54
+ the text colour and weight, sit on the text baseline, and a screen reader says
55
+ "less than". An icon button is also a target, which the bare glyph was not.
56
+ -->
57
+ <md-icon-button
58
+ aria-label=${previousMonthLabel()}
59
+ title=${previousMonthLabel()}
22
60
  @click=${() => {
23
61
  this.moveTo(dayjs(new Date(this.year, this.month, 1)).subtract(1, 'month'));
24
62
  }}
25
- ><</md-text-button
26
63
  >
64
+ <md-icon>chevron_left</md-icon>
65
+ </md-icon-button>
27
66
  <md-text-button
28
67
  @click=${() => {
29
68
  this.moveTo(dayjs(new Date(dayjs().year(), dayjs().month(), 1)));
30
69
  }}
31
- >Today</md-text-button
70
+ >${todayLabel()}</md-text-button
32
71
  >
33
- <md-text-button
72
+ <md-icon-button
73
+ aria-label=${nextMonthLabel()}
74
+ title=${nextMonthLabel()}
34
75
  @click=${() => {
35
76
  this.moveTo(dayjs(new Date(this.year, this.month, 1)).add(1, 'month'));
36
77
  }}
37
- >></md-text-button
38
78
  >
79
+ <md-icon>chevron_right</md-icon>
80
+ </md-icon-button>
39
81
  </div>
40
82
 
41
83
  <slot></slot>
@@ -46,14 +88,23 @@ let CalendarMonthly = class CalendarMonthly extends LitElement {
46
88
  @pointermove=${this.handlePointerMove}
47
89
  @pointerup=${this.handlePointerUp}
48
90
  >
49
- ${WEEKDAYS.map(date => html ` <li day-of-week>${date}</li> `)}
91
+ ${weekdayNames().map(name => html ` <li day-of-week>${name}</li> `)}
50
92
  ${this.calendar?.map(date => {
51
93
  const [from, to] = this.selections || [];
52
94
  const { date: thisDate } = date;
53
95
  const selected = from && to && thisDate >= from && thisDate <= to;
96
+ const dayState = this.dayStateMap?.get(thisDate);
54
97
  return html `
55
- <li ?today=${date.today} ?current-month=${date.thisMonth} ?selected=${selected} .date=${thisDate} date>
56
- <span date-label>${date.label}</span>
98
+ <li
99
+ ?today=${date.today}
100
+ ?current-month=${date.thisMonth}
101
+ ?selected=${selected}
102
+ day-state=${ifDefined(dayState?.name)}
103
+ style=${ifDefined(dayState && `--day-state-color:${dayState.color}`)}
104
+ .date=${thisDate}
105
+ date
106
+ >
107
+ <span date-label>${dayLabel(date.date, !!date.withMonth)}</span>
57
108
  <div>
58
109
  ${(this.eventMap?.get(date?.date) || []).map(({ title, color, template }) => template ? template : html `<span event .style="border-color: ${color};">${title}</span>`)}
59
110
  </div>
@@ -71,9 +122,25 @@ let CalendarMonthly = class CalendarMonthly extends LitElement {
71
122
  ...currentMonth,
72
123
  ...this.createDaysForNextMonth(this.year, this.month, currentMonth)
73
124
  ];
74
- this.eventMap = await this.eventProvider?.fetchEventsForCalendar(calendar);
125
+ /*
126
+ * Both questions go out together. A host that keeps the day's events and the day's own
127
+ * state in one place answers both from one round trip, and the two always describe the
128
+ * same grid - asking them apart would let a month change land between them.
129
+ */
130
+ const [eventMap, dayStateMap] = await Promise.all([
131
+ this.eventProvider?.fetchEventsForCalendar(calendar),
132
+ this.eventProvider?.fetchDayStatesForCalendar?.(calendar)
133
+ ]);
134
+ this.eventMap = eventMap;
135
+ this.dayStateMap = dayStateMap;
75
136
  this.calendar = calendar;
76
137
  }
138
+ /*
139
+ * After the rows are laid out, not before. A cap only bites once the browser has placed the
140
+ * children, so this has to run on every render - the grid also reflows when the host swaps
141
+ * its templates or the window changes width.
142
+ */
143
+ this.lastOverflow = reportDayOverflow(this, this.shadowRoot, this.lastOverflow);
77
144
  }
78
145
  handlePointerDown(event) {
79
146
  const target = event.target;
@@ -135,10 +202,11 @@ let CalendarMonthly = class CalendarMonthly extends LitElement {
135
202
  createDaysForCurrentMonth(year, month) {
136
203
  return [...Array(dayjs(new Date(year, month, 1)).daysInMonth())].map((day, index) => {
137
204
  const date = new Date(year, month, index + 1);
138
- const label = index == 0 ? dayjs(date).format('MMM D') : dayjs(date).format('D');
205
+ const withMonth = index == 0;
139
206
  return {
140
207
  date,
141
- label,
208
+ label: dayLabel(date, withMonth),
209
+ withMonth,
142
210
  thisMonth: true,
143
211
  today: isToday(date)
144
212
  };
@@ -152,10 +220,11 @@ let CalendarMonthly = class CalendarMonthly extends LitElement {
152
220
  .date();
153
221
  return [...Array(visibleNumberOfDaysFromPreviousMonth)].map((day, index) => {
154
222
  const date = new Date(previousMonth.year(), previousMonth.month(), previousMonthLastMondayDayOfMonth + index);
155
- const label = index == 0 ? dayjs(date).format('MMM D') : dayjs(date).format('D');
223
+ const withMonth = index == 0;
156
224
  return {
157
225
  date,
158
- label,
226
+ label: dayLabel(date, withMonth),
227
+ withMonth,
159
228
  thisMonth: false,
160
229
  today: isToday(date)
161
230
  };
@@ -166,10 +235,11 @@ let CalendarMonthly = class CalendarMonthly extends LitElement {
166
235
  const visibleNumberOfDaysFromNextMonth = 6 - dayjs(new Date(year, month, currentMonth.length)).weekday();
167
236
  return [...Array(visibleNumberOfDaysFromNextMonth)].map((day, index) => {
168
237
  const date = new Date(nextMonth.year(), nextMonth.month(), index + 1);
169
- const label = index == 0 ? dayjs(date).format('MMM D') : dayjs(date).format('D');
238
+ const withMonth = index == 0;
170
239
  return {
171
240
  date,
172
- label,
241
+ label: dayLabel(date, withMonth),
242
+ withMonth,
173
243
  thisMonth: false,
174
244
  today: isToday(date)
175
245
  };
@@ -191,6 +261,9 @@ __decorate([
191
261
  __decorate([
192
262
  state()
193
263
  ], CalendarMonthly.prototype, "eventMap", void 0);
264
+ __decorate([
265
+ state()
266
+ ], CalendarMonthly.prototype, "dayStateMap", void 0);
194
267
  __decorate([
195
268
  state()
196
269
  ], CalendarMonthly.prototype, "selections", void 0);