@akira-yylm/session-calendar 1.0.4 → 1.1.1
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/CHANGELOG.md +34 -0
- package/README.en.md +48 -14
- package/README.md +48 -14
- package/client.js +587 -135
- package/index.js +99 -13
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -38,11 +38,146 @@ window.__ModuleLoader__.load({
|
|
|
38
38
|
/** Same-origin Host route that reports Session creation times. */
|
|
39
39
|
const CREATED_PATH = '/dsh-session-calendar/created.json'
|
|
40
40
|
/** Preferred card width in CSS pixels; narrow windows shrink it. */
|
|
41
|
-
const CARD_WIDTH =
|
|
41
|
+
const CARD_WIDTH = 360
|
|
42
42
|
/** Grid rows are fixed at six weeks so the card height never jumps. */
|
|
43
43
|
const GRID_WEEKS = 6
|
|
44
|
-
/**
|
|
45
|
-
|
|
44
|
+
/**
|
|
45
|
+
* The eight accent colours chosen for Workspaces, in family order:
|
|
46
|
+
* coral → orange → peach → cream → green → teal → blue.
|
|
47
|
+
*/
|
|
48
|
+
const PALETTE = ['#FC757B', '#F97F5F', '#FAA26F', '#FDCD94', '#FEE199', '#B0D6A9', '#65BDBA', '#3C9BC9']
|
|
49
|
+
|
|
50
|
+
// ---------------------------------------------------------------------
|
|
51
|
+
// Workspace colours.
|
|
52
|
+
//
|
|
53
|
+
// A Workspace keeps one colour so the dots on the calendar and the rows of
|
|
54
|
+
// the day list agree. Which of the eight it gets depends on how many
|
|
55
|
+
// Workspaces exist, so that N Workspaces are spread as far apart as the
|
|
56
|
+
// family allows:
|
|
57
|
+
//
|
|
58
|
+
// - 8 divides N (1, 2, 4, 8): step through the eight, e.g. four
|
|
59
|
+
// Workspaces take colours 1, 3, 5, 7.
|
|
60
|
+
// - otherwise the family is resampled at the smallest size that holds a
|
|
61
|
+
// whole number of picks (three Workspaces need nine stops), and the picks
|
|
62
|
+
// include both ends, e.g. 1, 5, 9 — the last one is the blue end.
|
|
63
|
+
// ---------------------------------------------------------------------
|
|
64
|
+
|
|
65
|
+
/** Parse `#RRGGBB` into `[r, g, b]`; invalid input falls back to black. */
|
|
66
|
+
function toRgb(hex) {
|
|
67
|
+
const value = String(hex).replace('#', '')
|
|
68
|
+
if (value.length !== 6) return [0, 0, 0]
|
|
69
|
+
const red = Number.parseInt(value.slice(0, 2), 16)
|
|
70
|
+
const green = Number.parseInt(value.slice(2, 4), 16)
|
|
71
|
+
const blue = Number.parseInt(value.slice(4, 6), 16)
|
|
72
|
+
if (!Number.isFinite(red) || !Number.isFinite(green) || !Number.isFinite(blue)) return [0, 0, 0]
|
|
73
|
+
return [red, green, blue]
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Format `[r, g, b]` as `#RRGGBB`, matching the uppercase palette. */
|
|
77
|
+
function toHex(rgb) {
|
|
78
|
+
return '#' + rgb
|
|
79
|
+
.map((channel) => {
|
|
80
|
+
const clamped = Math.max(0, Math.min(255, Math.round(channel)))
|
|
81
|
+
return clamped.toString(16).padStart(2, '0').toUpperCase()
|
|
82
|
+
})
|
|
83
|
+
.join('')
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Sample the family curve at `size` evenly spaced stops. The curve runs
|
|
88
|
+
* through {@link PALETTE}, so `size === PALETTE.length` returns the eight
|
|
89
|
+
* chosen colours unchanged and any other size is the same family resampled.
|
|
90
|
+
*/
|
|
91
|
+
function familyStops(size) {
|
|
92
|
+
const last = PALETTE.length - 1
|
|
93
|
+
const stops = []
|
|
94
|
+
for (let index = 0; index < size; index += 1) {
|
|
95
|
+
const position = size <= 1 ? 0 : (index / (size - 1)) * last
|
|
96
|
+
const lower = Math.min(Math.floor(position), last - 1)
|
|
97
|
+
const fraction = position - lower
|
|
98
|
+
const from = toRgb(PALETTE[lower])
|
|
99
|
+
const to = toRgb(PALETTE[lower + 1])
|
|
100
|
+
stops.push(toHex([
|
|
101
|
+
from[0] + (to[0] - from[0]) * fraction,
|
|
102
|
+
from[1] + (to[1] - from[1]) * fraction,
|
|
103
|
+
from[2] + (to[2] - from[2]) * fraction,
|
|
104
|
+
]))
|
|
105
|
+
}
|
|
106
|
+
return stops
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** The colours for `count` Workspaces, in Workspace order. */
|
|
110
|
+
function workspacePalette(count) {
|
|
111
|
+
if (count <= 0) return []
|
|
112
|
+
if (count <= PALETTE.length && PALETTE.length % count === 0) {
|
|
113
|
+
const step = PALETTE.length / count
|
|
114
|
+
const picked = []
|
|
115
|
+
for (let index = 0; index < count; index += 1) picked.push(PALETTE[index * step])
|
|
116
|
+
return picked
|
|
117
|
+
}
|
|
118
|
+
let size = PALETTE.length
|
|
119
|
+
while (size % count !== 0) size += 1
|
|
120
|
+
const stops = familyStops(size)
|
|
121
|
+
const picked = []
|
|
122
|
+
for (let index = 0; index < count; index += 1) {
|
|
123
|
+
const position = count === 1 ? 0 : (index * (size - 1)) / (count - 1)
|
|
124
|
+
picked.push(stops[Math.round(position)])
|
|
125
|
+
}
|
|
126
|
+
return picked
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Memoised `workspacePalette`, because it runs on every render. */
|
|
130
|
+
const paletteCache = new Map()
|
|
131
|
+
function paletteFor(count) {
|
|
132
|
+
if (!paletteCache.has(count)) paletteCache.set(count, workspacePalette(count))
|
|
133
|
+
return paletteCache.get(count)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The paint for one day's frame: the single colour when only one Workspace
|
|
138
|
+
* created sessions that day, otherwise a gradient stopping at each of them.
|
|
139
|
+
*/
|
|
140
|
+
/**
|
|
141
|
+
* The picked day is filled with the same colours its frame uses — a solid
|
|
142
|
+
* wash for one Workspace, an angular run around the cell's centre through
|
|
143
|
+
* all of them when the day touches several — at this alpha.
|
|
144
|
+
*/
|
|
145
|
+
function dayFill(colors) {
|
|
146
|
+
if (colors.length === 0) return undefined
|
|
147
|
+
const wash = (color) => 'color-mix(in srgb, ' + color + ' 50%, transparent)'
|
|
148
|
+
if (colors.length === 1) return wash(colors[0])
|
|
149
|
+
const step = 360 / colors.length
|
|
150
|
+
const stops = colors.map((color, index) => wash(color) + ' ' + Math.round(index * step) + 'deg')
|
|
151
|
+
stops.push(wash(colors[0]) + ' 360deg')
|
|
152
|
+
return 'conic-gradient(from 0deg at 50% 50%, ' + stops.join(', ') + ')'
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function dayRing(colors) {
|
|
156
|
+
if (colors.length === 0) return undefined
|
|
157
|
+
if (colors.length === 1) return colors[0]
|
|
158
|
+
// A thin frame sits at one radius, so a radial run would show a single
|
|
159
|
+
// colour there. Centring an angular gradient on the same point gives each
|
|
160
|
+
// Workspace its own wedge around the cell instead.
|
|
161
|
+
const step = 360 / colors.length
|
|
162
|
+
const stops = colors.map((color, index) => color + ' ' + Math.round(index * step) + 'deg')
|
|
163
|
+
stops.push(colors[0] + ' 360deg')
|
|
164
|
+
return 'conic-gradient(from 0deg at 50% 50%, ' + stops.join(', ') + ')'
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** Distinct Workspace colour indexes a day needs dots for, in one row. */
|
|
168
|
+
const MAX_DAY_DOTS = 8
|
|
169
|
+
function dayColorIndexes(groups) {
|
|
170
|
+
const indexes = []
|
|
171
|
+
for (const group of groups) {
|
|
172
|
+
if (!indexes.includes(group.colorIndex)) indexes.push(group.colorIndex)
|
|
173
|
+
}
|
|
174
|
+
indexes.sort((left, right) => {
|
|
175
|
+
if (left < 0) return 1
|
|
176
|
+
if (right < 0) return -1
|
|
177
|
+
return left - right
|
|
178
|
+
})
|
|
179
|
+
return indexes.slice(0, MAX_DAY_DOTS)
|
|
180
|
+
}
|
|
46
181
|
|
|
47
182
|
// ---------------------------------------------------------------------
|
|
48
183
|
// Copy. Chinese is also the runtime fallback when a seat omits `t`.
|
|
@@ -52,6 +187,9 @@ window.__ModuleLoader__.load({
|
|
|
52
187
|
entry: '会话日历',
|
|
53
188
|
panel: '会话日历',
|
|
54
189
|
open: '打开会话日历',
|
|
190
|
+
'mode.first': '首次',
|
|
191
|
+
'mode.last': '最近',
|
|
192
|
+
'mode.switch': '按第一次对话时间 / 按最近一次对话时间',
|
|
55
193
|
close: '关闭会话日历',
|
|
56
194
|
today: '今天',
|
|
57
195
|
prevMonth: '上个月',
|
|
@@ -92,6 +230,9 @@ window.__ModuleLoader__.load({
|
|
|
92
230
|
entry: 'Session calendar',
|
|
93
231
|
panel: 'Session calendar',
|
|
94
232
|
open: 'Open the session calendar',
|
|
233
|
+
'mode.first': 'First',
|
|
234
|
+
'mode.last': 'Latest',
|
|
235
|
+
'mode.switch': 'Group by first prompt or by latest conversation',
|
|
95
236
|
close: 'Close the session calendar',
|
|
96
237
|
today: 'Today',
|
|
97
238
|
prevMonth: 'Previous month',
|
|
@@ -147,6 +288,14 @@ window.__ModuleLoader__.load({
|
|
|
147
288
|
// Shared open state between the sidebar row and the overlay entry.
|
|
148
289
|
// ---------------------------------------------------------------------
|
|
149
290
|
|
|
291
|
+
/**
|
|
292
|
+
* Which end of a Session's span the sheet groups by. It outlives the sheet,
|
|
293
|
+
* so reopening it keeps the reader's last choice; the switch lives inside
|
|
294
|
+
* the card now, not on the sidebar row.
|
|
295
|
+
*/
|
|
296
|
+
let lastMode = 'first'
|
|
297
|
+
|
|
298
|
+
|
|
150
299
|
let shared = { open: false, anchor: null, trigger: null }
|
|
151
300
|
const listeners = new Set()
|
|
152
301
|
|
|
@@ -335,14 +484,33 @@ window.__ModuleLoader__.load({
|
|
|
335
484
|
/** Last accepted Host payload, so reopening paints instantly. */
|
|
336
485
|
let payloadCache = null
|
|
337
486
|
|
|
338
|
-
/** One parsed
|
|
487
|
+
/** One parsed time row, or null when the row is unusable. */
|
|
339
488
|
function readRow(row) {
|
|
340
489
|
if (row === null || typeof row !== 'object') return null
|
|
341
490
|
if (typeof row.id !== 'string' || row.id === '') return null
|
|
342
|
-
if (
|
|
491
|
+
if (!Number.isFinite(row.startedAt) && !Number.isFinite(row.createdAt)) return null
|
|
343
492
|
return row
|
|
344
493
|
}
|
|
345
494
|
|
|
495
|
+
/**
|
|
496
|
+
* The time this Session lands on under `mode`:
|
|
497
|
+
* - `first`: when its conversation began;
|
|
498
|
+
* - `last`: when it was last talked to.
|
|
499
|
+
*
|
|
500
|
+
* DSH already tracks the last human prompt: `SessionSummary.updatedAt` is
|
|
501
|
+
* the newer of the Session's creation and that prompt's time, and only a
|
|
502
|
+
* `user/message` ever advances it — opening a Session, or a command the UI
|
|
503
|
+
* runs while opening it, does not. Everything falls back to the Session
|
|
504
|
+
* object's creation time.
|
|
505
|
+
*/
|
|
506
|
+
function anchorOf(row, mode, info) {
|
|
507
|
+
if (mode === 'last') {
|
|
508
|
+
if (info !== undefined && info !== null && Number.isFinite(info.updatedAt)) return info.updatedAt
|
|
509
|
+
if (Number.isFinite(row.lastConversationAt)) return row.lastConversationAt
|
|
510
|
+
}
|
|
511
|
+
return Number.isFinite(row.startedAt) ? row.startedAt : row.createdAt
|
|
512
|
+
}
|
|
513
|
+
|
|
346
514
|
/** Fetch the Host's creation-time rows; refreshes on open and on retry. */
|
|
347
515
|
function useCreated() {
|
|
348
516
|
const [state, setState] = React.useState(() => payloadCache === null
|
|
@@ -392,7 +560,7 @@ window.__ModuleLoader__.load({
|
|
|
392
560
|
* Bucket creation rows into calendar days, each day grouped by Workspace in
|
|
393
561
|
* the sidebar's own order. Returns `Map<'YYYY-MM-DD', { count, groups }>`.
|
|
394
562
|
*/
|
|
395
|
-
function indexDays(rows, sessionList, workspaceSnapshot, t) {
|
|
563
|
+
function indexDays(rows, sessionList, workspaceSnapshot, t, mode) {
|
|
396
564
|
const sessions = (sessionList !== undefined && sessionList !== null && sessionList.byId) || {}
|
|
397
565
|
const workspaces = (workspaceSnapshot !== undefined
|
|
398
566
|
&& workspaceSnapshot !== null
|
|
@@ -438,7 +606,13 @@ window.__ModuleLoader__.load({
|
|
|
438
606
|
const groupOrder = workspace !== undefined
|
|
439
607
|
? (orderOf.get(workspace.workspaceId) === undefined ? 0 : orderOf.get(workspace.workspaceId))
|
|
440
608
|
: workspaces.length + 1
|
|
441
|
-
|
|
609
|
+
// The colour follows the Workspace's place in the registry, so it is
|
|
610
|
+
// the same on every day; a directory that is not a Workspace has none.
|
|
611
|
+
const colorIndex = workspace !== undefined
|
|
612
|
+
? (orderOf.get(workspace.workspaceId) === undefined ? -1 : orderOf.get(workspace.workspaceId))
|
|
613
|
+
: -1
|
|
614
|
+
const when = anchorOf(row, mode, info)
|
|
615
|
+
const day = dayKeyOf(new Date(when))
|
|
442
616
|
let bucket = days.get(day)
|
|
443
617
|
if (bucket === undefined) {
|
|
444
618
|
bucket = { count: 0, groups: new Map() }
|
|
@@ -446,7 +620,7 @@ window.__ModuleLoader__.load({
|
|
|
446
620
|
}
|
|
447
621
|
let group = bucket.groups.get(groupKey)
|
|
448
622
|
if (group === undefined) {
|
|
449
|
-
group = { key: groupKey, title: groupTitle, order: groupOrder, items: [] }
|
|
623
|
+
group = { key: groupKey, title: groupTitle, order: groupOrder, colorIndex, items: [] }
|
|
450
624
|
bucket.groups.set(groupKey, group)
|
|
451
625
|
}
|
|
452
626
|
const live = info !== undefined && info !== null && typeof info.title === 'string' ? info.title.trim() : ''
|
|
@@ -457,7 +631,7 @@ window.__ModuleLoader__.load({
|
|
|
457
631
|
group.items.push({
|
|
458
632
|
id: row.id,
|
|
459
633
|
title: live !== '' ? live : stored !== '' ? stored : fallback !== '' ? fallback : t('untitled'),
|
|
460
|
-
time:
|
|
634
|
+
time: when,
|
|
461
635
|
})
|
|
462
636
|
bucket.count += 1
|
|
463
637
|
}
|
|
@@ -491,9 +665,11 @@ window.__ModuleLoader__.load({
|
|
|
491
665
|
}
|
|
492
666
|
const element = buttonRef.current
|
|
493
667
|
const rect = element === null || element === undefined
|
|
494
|
-
? { right: isWide ? 268 : 56
|
|
668
|
+
? { right: isWide ? 268 : 56 }
|
|
495
669
|
: element.getBoundingClientRect()
|
|
496
|
-
|
|
670
|
+
// Only the horizontal anchor is needed: the card centres itself
|
|
671
|
+
// vertically in the frame.
|
|
672
|
+
openWith({ right: rect.right }, element)
|
|
497
673
|
}
|
|
498
674
|
|
|
499
675
|
return h(
|
|
@@ -542,27 +718,43 @@ window.__ModuleLoader__.load({
|
|
|
542
718
|
const cardRef = React.useRef(null)
|
|
543
719
|
// Captured before the shared sheet clears its trigger on close.
|
|
544
720
|
const triggerRef = React.useRef(shared.trigger)
|
|
545
|
-
const skipFocusReturn = React.useRef(false)
|
|
546
721
|
const todayKey = dayKeyOf(new Date())
|
|
547
722
|
const [month, setMonth] = React.useState(() => monthStartOf(new Date()))
|
|
548
723
|
const [selected, setSelected] = React.useState(() => todayKey)
|
|
724
|
+
const [mode, setMode] = React.useState(lastMode)
|
|
725
|
+
const changeMode = (next) => {
|
|
726
|
+
lastMode = next
|
|
727
|
+
setMode(next)
|
|
728
|
+
}
|
|
549
729
|
|
|
550
730
|
const days = React.useMemo(
|
|
551
|
-
() => indexDays(created.rows, sessionList, workspaceSnapshot, t),
|
|
552
|
-
[created.rows, sessionList, workspaceSnapshot, t],
|
|
731
|
+
() => indexDays(created.rows, sessionList, workspaceSnapshot, t, mode),
|
|
732
|
+
[created.rows, sessionList, workspaceSnapshot, t, mode],
|
|
553
733
|
)
|
|
734
|
+
const workspaceCount = (workspaceSnapshot !== undefined
|
|
735
|
+
&& workspaceSnapshot !== null
|
|
736
|
+
&& Array.isArray(workspaceSnapshot.items))
|
|
737
|
+
? workspaceSnapshot.items.length
|
|
738
|
+
: 0
|
|
739
|
+
const palette = React.useMemo(() => paletteFor(workspaceCount), [workspaceCount])
|
|
740
|
+
/** One Workspace's colour, or the quiet tertiary tone for an orphan group. */
|
|
741
|
+
const colorOf = (colorIndex) => (colorIndex >= 0 && palette[colorIndex] !== undefined
|
|
742
|
+
? palette[colorIndex]
|
|
743
|
+
: 'var(--dsw-alias-label-tertiary)')
|
|
554
744
|
|
|
555
745
|
const geometry = React.useMemo(() => {
|
|
556
746
|
const viewportWidth = typeof window === 'undefined' ? 1440 : window.innerWidth
|
|
557
747
|
const viewportHeight = typeof window === 'undefined' ? 900 : window.innerHeight
|
|
558
|
-
const width = Math.max(
|
|
748
|
+
const width = Math.max(260, Math.min(CARD_WIDTH, viewportWidth - 24))
|
|
749
|
+
// Horizontally the card hugs the sidebar's right edge; vertically the
|
|
750
|
+
// stylesheet centres it in the frame with auto margins, so it never
|
|
751
|
+
// hands off the bottom of a short window.
|
|
559
752
|
const wantedLeft = anchor === null || anchor === undefined ? 268 : anchor.right + 10
|
|
560
753
|
const left = Math.max(12, Math.min(wantedLeft, viewportWidth - width - 12))
|
|
561
|
-
|
|
562
|
-
//
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
return { left, top, width, maxHeight }
|
|
754
|
+
// The height is fixed: switching to a day with more or fewer sessions
|
|
755
|
+
// must not resize the card, or the grid would slide under the pointer.
|
|
756
|
+
const height = Math.max(260, Math.min(720, viewportHeight - 24))
|
|
757
|
+
return { left, width, height }
|
|
566
758
|
}, [anchor])
|
|
567
759
|
|
|
568
760
|
React.useEffect(() => {
|
|
@@ -570,9 +762,8 @@ window.__ModuleLoader__.load({
|
|
|
570
762
|
if (card !== null && card !== undefined && typeof card.focus === 'function') {
|
|
571
763
|
card.focus({ preventScroll: true })
|
|
572
764
|
}
|
|
573
|
-
// Closing returns focus to the row
|
|
765
|
+
// Closing returns focus to the sidebar row.
|
|
574
766
|
return () => {
|
|
575
|
-
if (skipFocusReturn.current) return
|
|
576
767
|
const trigger = triggerRef.current
|
|
577
768
|
if (trigger === null || trigger === undefined || trigger.isConnected !== true) return
|
|
578
769
|
try {
|
|
@@ -583,6 +774,43 @@ window.__ModuleLoader__.load({
|
|
|
583
774
|
}
|
|
584
775
|
}, [])
|
|
585
776
|
|
|
777
|
+
/**
|
|
778
|
+
* Header hover, driven by the pointer's own position.
|
|
779
|
+
*
|
|
780
|
+
* A quick pass over these controls could end with a `:hover`
|
|
781
|
+
* recalculation one frame behind, so the highlight never showed. Asking
|
|
782
|
+
* the document what is really under the pointer on every move is
|
|
783
|
+
* idempotent: whichever control the pointer is over carries the class,
|
|
784
|
+
* and a missed enter/leave cannot leave it stuck.
|
|
785
|
+
*/
|
|
786
|
+
React.useEffect(() => {
|
|
787
|
+
const card = cardRef.current
|
|
788
|
+
if (card === null || card === undefined) return
|
|
789
|
+
const selector = '.sc-navBtn, .sc-today, .sc-seg'
|
|
790
|
+
let current = null
|
|
791
|
+
const clear = () => {
|
|
792
|
+
if (current === null) return
|
|
793
|
+
current.classList.remove('sc-hot')
|
|
794
|
+
current = null
|
|
795
|
+
}
|
|
796
|
+
const onMove = (event) => {
|
|
797
|
+
const top = document.elementFromPoint(event.clientX, event.clientY)
|
|
798
|
+
const hit = top !== null && typeof top.closest === 'function' ? top.closest(selector) : null
|
|
799
|
+
const next = hit !== null && card.contains(hit) ? hit : null
|
|
800
|
+
if (next === current) return
|
|
801
|
+
clear()
|
|
802
|
+
if (next !== null) {
|
|
803
|
+
next.classList.add('sc-hot')
|
|
804
|
+
current = next
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
document.addEventListener('pointermove', onMove, true)
|
|
808
|
+
return () => {
|
|
809
|
+
document.removeEventListener('pointermove', onMove, true)
|
|
810
|
+
clear()
|
|
811
|
+
}
|
|
812
|
+
}, [])
|
|
813
|
+
|
|
586
814
|
React.useEffect(() => {
|
|
587
815
|
const onPointerDown = (event) => {
|
|
588
816
|
const card = cardRef.current
|
|
@@ -613,6 +841,39 @@ window.__ModuleLoader__.load({
|
|
|
613
841
|
}
|
|
614
842
|
}, [])
|
|
615
843
|
|
|
844
|
+
/**
|
|
845
|
+
* Arrow keys walk the selection: left/right by a day, up/down by a week.
|
|
846
|
+
* When the new date falls outside the shown month the month follows, so
|
|
847
|
+
* the keyboard never gets stuck at a month boundary. Keys are only taken
|
|
848
|
+
* while focus sits inside the card, so the conversation's own editor keeps
|
|
849
|
+
* its arrow keys.
|
|
850
|
+
*/
|
|
851
|
+
React.useEffect(() => {
|
|
852
|
+
const onArrow = (event) => {
|
|
853
|
+
if (event.defaultPrevented || event.metaKey || event.ctrlKey || event.altKey) return
|
|
854
|
+
const card = cardRef.current
|
|
855
|
+
if (card === null || card === undefined) return
|
|
856
|
+
const active = document.activeElement
|
|
857
|
+
const inCard = active !== null && (active === card || card.contains(active))
|
|
858
|
+
if (!inCard) return
|
|
859
|
+
if (active instanceof HTMLElement
|
|
860
|
+
&& (active.tagName === 'INPUT' || active.tagName === 'TEXTAREA' || active.isContentEditable)) return
|
|
861
|
+
const step = event.key === 'ArrowLeft' ? -1
|
|
862
|
+
: event.key === 'ArrowRight' ? 1
|
|
863
|
+
: event.key === 'ArrowUp' ? -7
|
|
864
|
+
: event.key === 'ArrowDown' ? 7
|
|
865
|
+
: 0
|
|
866
|
+
if (step === 0) return
|
|
867
|
+
event.preventDefault()
|
|
868
|
+
const parts = selected.split('-')
|
|
869
|
+
const next = new Date(Number(parts[0]), Number(parts[1]) - 1, Number(parts[2]) + step)
|
|
870
|
+
setSelected(dayKeyOf(next))
|
|
871
|
+
if (!sameMonth(month, next)) setMonth(monthStartOf(next))
|
|
872
|
+
}
|
|
873
|
+
document.addEventListener('keydown', onArrow)
|
|
874
|
+
return () => { document.removeEventListener('keydown', onArrow) }
|
|
875
|
+
}, [selected, month])
|
|
876
|
+
|
|
616
877
|
const cells = React.useMemo(() => buildGrid(month), [month])
|
|
617
878
|
const bucket = days.get(selected)
|
|
618
879
|
const groups = bucket === undefined ? [] : bucket.list
|
|
@@ -630,9 +891,11 @@ window.__ModuleLoader__.load({
|
|
|
630
891
|
setMonth(next)
|
|
631
892
|
setSelected(firstDayWithSessions(next, days) || dayKeyOf(next))
|
|
632
893
|
}
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
894
|
+
// Opening a session leaves the calendar where it is: the window is a
|
|
895
|
+
// browsing surface, so the reader can keep picking sessions from it.
|
|
896
|
+
// Dismissing stays on the explicit paths (the row again, a click
|
|
897
|
+
// outside, Escape, or a window resize).
|
|
898
|
+
const openFromList = (sessionId) => {
|
|
636
899
|
if (typeof openSession === 'function') openSession(sessionId)
|
|
637
900
|
}
|
|
638
901
|
|
|
@@ -655,15 +918,16 @@ window.__ModuleLoader__.load({
|
|
|
655
918
|
id: 'session-calendar-card',
|
|
656
919
|
className: 'sc-card',
|
|
657
920
|
role: 'dialog',
|
|
658
|
-
'
|
|
921
|
+
'data-mode': mode,
|
|
922
|
+
'aria-label': t('panel') + ' · ' + t('mode.' + mode),
|
|
659
923
|
tabIndex: -1,
|
|
660
924
|
style: {
|
|
661
925
|
left: geometry.left + 'px',
|
|
662
|
-
top: geometry.top + 'px',
|
|
663
926
|
width: geometry.width + 'px',
|
|
664
|
-
|
|
927
|
+
height: geometry.height + 'px',
|
|
665
928
|
},
|
|
666
929
|
},
|
|
930
|
+
h('div', { className: 'sc-title' }, monthLabel),
|
|
667
931
|
h(
|
|
668
932
|
'header',
|
|
669
933
|
{ className: 'sc-head' },
|
|
@@ -678,7 +942,6 @@ window.__ModuleLoader__.load({
|
|
|
678
942
|
},
|
|
679
943
|
h(ChevronGlyph, { direction: 'left' }),
|
|
680
944
|
),
|
|
681
|
-
h('span', { className: 'sc-monthLabel' }, monthLabel),
|
|
682
945
|
h(
|
|
683
946
|
'button',
|
|
684
947
|
{
|
|
@@ -695,7 +958,6 @@ window.__ModuleLoader__.load({
|
|
|
695
958
|
{
|
|
696
959
|
type: 'button',
|
|
697
960
|
className: 'sc-today',
|
|
698
|
-
disabled: sameMonth(month, new Date()) && selected === todayKey,
|
|
699
961
|
onClick: goToday,
|
|
700
962
|
},
|
|
701
963
|
t('today'),
|
|
@@ -712,6 +974,21 @@ window.__ModuleLoader__.load({
|
|
|
712
974
|
h(CloseGlyph),
|
|
713
975
|
),
|
|
714
976
|
),
|
|
977
|
+
h(
|
|
978
|
+
'div',
|
|
979
|
+
{ className: 'sc-modes', role: 'group', 'aria-label': t('mode.switch') },
|
|
980
|
+
['first', 'last'].map((value) => h(
|
|
981
|
+
'button',
|
|
982
|
+
{
|
|
983
|
+
key: value,
|
|
984
|
+
type: 'button',
|
|
985
|
+
className: 'sc-seg',
|
|
986
|
+
'aria-pressed': mode === value ? 'true' : 'false',
|
|
987
|
+
onClick: () => { changeMode(value) },
|
|
988
|
+
},
|
|
989
|
+
t('mode.' + value),
|
|
990
|
+
)),
|
|
991
|
+
),
|
|
715
992
|
h(
|
|
716
993
|
'div',
|
|
717
994
|
{ className: 'sc-weekRow' },
|
|
@@ -725,10 +1002,19 @@ window.__ModuleLoader__.load({
|
|
|
725
1002
|
const key = dayKeyOf(date)
|
|
726
1003
|
const entry = days.get(key)
|
|
727
1004
|
const count = entry === undefined ? 0 : entry.count
|
|
1005
|
+
const dotIndexes = entry === undefined ? [] : dayColorIndexes(entry.list)
|
|
1006
|
+
const dayColors = dotIndexes.map((index) => colorOf(index))
|
|
1007
|
+
const ring = dayRing(dayColors)
|
|
1008
|
+
const fill = key === selected ? dayFill(dayColors) : undefined
|
|
1009
|
+
const style = {}
|
|
1010
|
+
if (ring !== undefined) style['--sc-ring'] = ring
|
|
1011
|
+
if (fill !== undefined) style.background = fill
|
|
728
1012
|
const classes = ['sc-cell']
|
|
729
1013
|
if (count > 0) classes.push('sc-cellFilled')
|
|
1014
|
+
// Today and the picked day are independent marks, so a picked
|
|
1015
|
+
// today keeps both.
|
|
1016
|
+
if (key === todayKey) classes.push('sc-cellToday')
|
|
730
1017
|
if (key === selected) classes.push('sc-cellSelected')
|
|
731
|
-
else if (key === todayKey) classes.push('sc-cellToday')
|
|
732
1018
|
return h(
|
|
733
1019
|
'button',
|
|
734
1020
|
{
|
|
@@ -743,10 +1029,26 @@ window.__ModuleLoader__.load({
|
|
|
743
1029
|
count,
|
|
744
1030
|
})
|
|
745
1031
|
: undefined,
|
|
1032
|
+
// The hover text names the Workspaces the coloured dots stand
|
|
1033
|
+
// for, so the colour is readable before the day is opened.
|
|
1034
|
+
title: entry === undefined
|
|
1035
|
+
? undefined
|
|
1036
|
+
: entry.list.map((group) => group.title + ' · ' + group.items.length).join('\n'),
|
|
1037
|
+
style: Object.keys(style).length === 0 ? undefined : style,
|
|
746
1038
|
onClick: () => { setSelected(key) },
|
|
747
1039
|
},
|
|
748
1040
|
h('span', { className: 'sc-dayNum' }, String(date.getDate())),
|
|
749
|
-
|
|
1041
|
+
dotIndexes.length > 0
|
|
1042
|
+
? h(
|
|
1043
|
+
'span',
|
|
1044
|
+
{ className: 'sc-dots' },
|
|
1045
|
+
dotIndexes.map((index) => h('span', {
|
|
1046
|
+
key: index,
|
|
1047
|
+
className: 'sc-dot',
|
|
1048
|
+
style: { '--sc-dot': colorOf(index) },
|
|
1049
|
+
})),
|
|
1050
|
+
)
|
|
1051
|
+
: null,
|
|
750
1052
|
)
|
|
751
1053
|
}),
|
|
752
1054
|
),
|
|
@@ -779,14 +1081,16 @@ window.__ModuleLoader__.load({
|
|
|
779
1081
|
'section',
|
|
780
1082
|
{
|
|
781
1083
|
key: group.key === '' ? '__none__' : group.key,
|
|
782
|
-
//
|
|
783
|
-
// hairline
|
|
784
|
-
|
|
1084
|
+
// The Workspace's own colour drives the group glyph and
|
|
1085
|
+
// the hairline around each of its rows, so the day list
|
|
1086
|
+
// and the calendar dots speak one colour language.
|
|
1087
|
+
className: 'sc-group',
|
|
1088
|
+
style: { '--sc-accent': colorOf(group.colorIndex) },
|
|
785
1089
|
},
|
|
786
1090
|
h(
|
|
787
1091
|
'div',
|
|
788
1092
|
{ className: 'sc-groupHead' },
|
|
789
|
-
h(FolderGlyph, { size:
|
|
1093
|
+
h(FolderGlyph, { size: 13 }),
|
|
790
1094
|
h('span', { className: 'sc-groupTitle', title: group.title }, group.title),
|
|
791
1095
|
h('span', { className: 'sc-groupCount' }, String(group.items.length)),
|
|
792
1096
|
),
|
|
@@ -797,7 +1101,7 @@ window.__ModuleLoader__.load({
|
|
|
797
1101
|
type: 'button',
|
|
798
1102
|
className: 'sc-row',
|
|
799
1103
|
title: item.title,
|
|
800
|
-
onClick: () => {
|
|
1104
|
+
onClick: () => { openFromList(item.id) },
|
|
801
1105
|
},
|
|
802
1106
|
h('span', { className: 'sc-rowTitle' }, item.title),
|
|
803
1107
|
h('span', { className: 'sc-rowTime' }, clockOf(item.time)),
|
|
@@ -822,7 +1126,9 @@ window.__ModuleLoader__.load({
|
|
|
822
1126
|
share one colour. */
|
|
823
1127
|
.sc-stack,
|
|
824
1128
|
.sc-card {
|
|
825
|
-
|
|
1129
|
+
/* The brand blue from DSH's own mark, at the owner's explicit request
|
|
1130
|
+
for a brighter accent; it is one hue in both themes. */
|
|
1131
|
+
--sc-calendar-accent: #4D6BFE;
|
|
826
1132
|
}
|
|
827
1133
|
.sc-stack {
|
|
828
1134
|
flex: 1 1 auto;
|
|
@@ -839,6 +1145,9 @@ window.__ModuleLoader__.load({
|
|
|
839
1145
|
/* Unlike the two filled conversation buttons above it, this row is a
|
|
840
1146
|
tool: outlined, unfilled, and accented with the calendar's own colour,
|
|
841
1147
|
so its different purpose reads before its label does. */
|
|
1148
|
+
/* Closed, the entry keeps the hairline outline of a button but stays
|
|
1149
|
+
unfilled; open, it takes a light wash of the brand blue, so the colour
|
|
1150
|
+
means "this calendar is showing" rather than decorating the row. */
|
|
842
1151
|
.sc-launch {
|
|
843
1152
|
display: flex;
|
|
844
1153
|
align-items: center;
|
|
@@ -850,10 +1159,9 @@ window.__ModuleLoader__.load({
|
|
|
850
1159
|
margin: 0;
|
|
851
1160
|
box-sizing: border-box;
|
|
852
1161
|
border: 1px solid var(--dsw-alias-border-l3, rgba(0, 0, 0, 0.12));
|
|
853
|
-
border-color: color-mix(in srgb, var(--sc-calendar-accent) 38%, transparent);
|
|
854
1162
|
border-radius: var(--dsw-radius-md, 10px);
|
|
855
1163
|
background: transparent;
|
|
856
|
-
color: var(--dsw-alias-label-
|
|
1164
|
+
color: var(--dsw-alias-label-primary);
|
|
857
1165
|
font: inherit;
|
|
858
1166
|
font-size: 14px;
|
|
859
1167
|
font-weight: 500;
|
|
@@ -867,24 +1175,23 @@ window.__ModuleLoader__.load({
|
|
|
867
1175
|
color: var(--sc-calendar-accent);
|
|
868
1176
|
}
|
|
869
1177
|
.sc-launch[aria-expanded='true'] {
|
|
870
|
-
border-color: color-mix(in srgb, var(--sc-calendar-accent)
|
|
871
|
-
background: color-mix(in srgb, var(--sc-calendar-accent)
|
|
872
|
-
color: var(--dsw-alias-label-primary);
|
|
1178
|
+
border-color: color-mix(in srgb, var(--sc-calendar-accent) 45%, transparent);
|
|
1179
|
+
background: color-mix(in srgb, var(--sc-calendar-accent) 15%, transparent);
|
|
873
1180
|
}
|
|
874
1181
|
.sc-launch:focus-visible {
|
|
875
1182
|
outline: 2px solid var(--dsw-focus-ring-color, var(--sc-calendar-accent));
|
|
876
1183
|
outline-offset: 1px;
|
|
877
1184
|
}
|
|
1185
|
+
@media (hover: hover) {
|
|
1186
|
+
.sc-launch:not([aria-expanded='true']):hover,
|
|
1187
|
+
.sc-launchRail:not([aria-expanded='true']):hover {
|
|
1188
|
+
background: var(--dsw-alias-interactive-bg-hover);
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
878
1191
|
.sc-launchRail {
|
|
879
1192
|
width: 36px;
|
|
880
1193
|
height: 36px;
|
|
881
1194
|
padding: 0;
|
|
882
|
-
border-color: color-mix(in srgb, var(--sc-calendar-accent) 28%, transparent);
|
|
883
|
-
background: transparent;
|
|
884
|
-
}
|
|
885
|
-
.sc-launchRail[aria-expanded='true'] {
|
|
886
|
-
border-color: color-mix(in srgb, var(--sc-calendar-accent) 72%, transparent);
|
|
887
|
-
background: color-mix(in srgb, var(--sc-calendar-accent) 12%, transparent);
|
|
888
1195
|
}
|
|
889
1196
|
.sc-launchLabel {
|
|
890
1197
|
overflow: hidden;
|
|
@@ -904,6 +1211,14 @@ window.__ModuleLoader__.load({
|
|
|
904
1211
|
|
|
905
1212
|
.sc-card {
|
|
906
1213
|
position: fixed;
|
|
1214
|
+
/* Vertical centring without a transform: auto margins split the free
|
|
1215
|
+
space, which keeps the backdrop blur sampling correctly. */
|
|
1216
|
+
top: 0;
|
|
1217
|
+
bottom: 0;
|
|
1218
|
+
height: min(720px, calc(100vh - 24px));
|
|
1219
|
+
max-height: calc(100vh - 24px);
|
|
1220
|
+
margin-top: auto;
|
|
1221
|
+
margin-bottom: auto;
|
|
907
1222
|
z-index: 1;
|
|
908
1223
|
display: flex;
|
|
909
1224
|
flex-direction: column;
|
|
@@ -912,8 +1227,12 @@ window.__ModuleLoader__.load({
|
|
|
912
1227
|
box-sizing: border-box;
|
|
913
1228
|
border: 0;
|
|
914
1229
|
border-radius: 16px;
|
|
1230
|
+
/* No backdrop-filter here: it promotes the card to its own composited
|
|
1231
|
+
layer, and a quick hover's background change can then miss the frame
|
|
1232
|
+
that paints before the pointer leaves — the control looks inert when
|
|
1233
|
+
the pointer moves fast. The menu token is already 94% opaque, so the
|
|
1234
|
+
blur bought nothing visible. */
|
|
915
1235
|
background: var(--dsw-specific-menu, var(--dsw-alias-bg-overlay, var(--dsw-alias-bg-layer-1)));
|
|
916
|
-
backdrop-filter: var(--dsw-menu-backdrop-filter, none);
|
|
917
1236
|
--dsw-elevation-stroke-color: var(--dsw-alias-border-l1);
|
|
918
1237
|
box-shadow: var(--dsw-elevation-prominent);
|
|
919
1238
|
--dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);
|
|
@@ -924,34 +1243,46 @@ window.__ModuleLoader__.load({
|
|
|
924
1243
|
overflow: hidden;
|
|
925
1244
|
outline: none;
|
|
926
1245
|
}
|
|
927
|
-
|
|
1246
|
+
/* The month is a heading; the four controls below split the row evenly,
|
|
1247
|
+
so there is no dead stretch between them to miss. */
|
|
1248
|
+
.sc-title {
|
|
928
1249
|
flex: none;
|
|
929
|
-
|
|
930
|
-
align
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
flex: 1 1 auto;
|
|
936
|
-
min-width: 0;
|
|
1250
|
+
padding: 8px 10px 2px;
|
|
1251
|
+
text-align: center;
|
|
1252
|
+
font-size: 14px;
|
|
1253
|
+
font-weight: 600;
|
|
1254
|
+
line-height: 1.5;
|
|
1255
|
+
color: var(--dsw-alias-label-primary);
|
|
937
1256
|
overflow: hidden;
|
|
938
1257
|
text-overflow: ellipsis;
|
|
939
1258
|
white-space: nowrap;
|
|
940
|
-
text-align: center;
|
|
941
|
-
font-size: 13px;
|
|
942
|
-
line-height: 1.6;
|
|
943
|
-
color: var(--dsw-alias-label-primary);
|
|
944
1259
|
}
|
|
945
|
-
|
|
1260
|
+
/* The month row is dressed exactly like the rule switch below it: one
|
|
1261
|
+
outlined track holding two-pixel-apart segments. */
|
|
1262
|
+
.sc-head {
|
|
946
1263
|
flex: none;
|
|
1264
|
+
display: flex;
|
|
1265
|
+
align-items: stretch;
|
|
1266
|
+
gap: 2px;
|
|
1267
|
+
margin: 0 10px 4px;
|
|
1268
|
+
padding: 2px;
|
|
1269
|
+
min-height: 30px;
|
|
1270
|
+
box-sizing: border-box;
|
|
1271
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));
|
|
1272
|
+
border-radius: 8px;
|
|
1273
|
+
background: color-mix(in srgb, var(--dsw-alias-label-primary) 5%, transparent);
|
|
1274
|
+
user-select: none;
|
|
1275
|
+
}
|
|
1276
|
+
.sc-navBtn {
|
|
1277
|
+
flex: 1 1 0;
|
|
947
1278
|
display: inline-flex;
|
|
948
1279
|
align-items: center;
|
|
949
1280
|
justify-content: center;
|
|
950
|
-
|
|
951
|
-
height: 26px;
|
|
1281
|
+
height: auto;
|
|
1282
|
+
min-height: 26px;
|
|
952
1283
|
padding: 0;
|
|
953
1284
|
border: 0;
|
|
954
|
-
border-radius:
|
|
1285
|
+
border-radius: 6px;
|
|
955
1286
|
background: transparent;
|
|
956
1287
|
color: var(--dsw-alias-label-secondary);
|
|
957
1288
|
cursor: pointer;
|
|
@@ -965,14 +1296,20 @@ window.__ModuleLoader__.load({
|
|
|
965
1296
|
outline-offset: -2px;
|
|
966
1297
|
}
|
|
967
1298
|
@media (hover: hover) {
|
|
968
|
-
.sc-navBtn:hover
|
|
969
|
-
|
|
1299
|
+
.sc-navBtn:hover,
|
|
1300
|
+
.sc-today:hover {
|
|
1301
|
+
background: color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent);
|
|
970
1302
|
color: var(--dsw-alias-label-primary);
|
|
971
1303
|
}
|
|
972
|
-
|
|
1304
|
+
/* Both segments react to the pointer: the resting one lifts, the
|
|
1305
|
+
pressed one deepens, so a click never reads as "nothing happened". */
|
|
1306
|
+
.sc-seg:not([aria-pressed='true']):hover {
|
|
973
1307
|
background: var(--dsw-alias-interactive-bg-hover);
|
|
974
1308
|
color: var(--dsw-alias-label-primary);
|
|
975
1309
|
}
|
|
1310
|
+
.sc-seg[aria-pressed='true']:hover {
|
|
1311
|
+
background: color-mix(in srgb, var(--sc-calendar-accent) 22%, transparent);
|
|
1312
|
+
}
|
|
976
1313
|
.sc-cell:hover {
|
|
977
1314
|
background: color-mix(in srgb, var(--sc-calendar-accent) 10%, transparent);
|
|
978
1315
|
}
|
|
@@ -983,62 +1320,127 @@ window.__ModuleLoader__.load({
|
|
|
983
1320
|
background: var(--dsw-alias-interactive-bg-hover);
|
|
984
1321
|
}
|
|
985
1322
|
}
|
|
986
|
-
|
|
1323
|
+
/* Pointer-driven twins of the header hover rules: a class change is a
|
|
1324
|
+
guaranteed repaint, so the controls answer on every entry. */
|
|
1325
|
+
.sc-navBtn.sc-hot {
|
|
1326
|
+
background: var(--dsw-alias-interactive-bg-hover);
|
|
1327
|
+
color: var(--dsw-alias-label-primary);
|
|
1328
|
+
}
|
|
1329
|
+
.sc-today.sc-hot {
|
|
1330
|
+
background: var(--dsw-alias-interactive-bg-hover);
|
|
1331
|
+
color: var(--dsw-alias-label-primary);
|
|
1332
|
+
}
|
|
1333
|
+
/* The grouping switch gets its own full-width row: two big segments,
|
|
1334
|
+
impossible to miss with the pointer. */
|
|
1335
|
+
.sc-modes {
|
|
987
1336
|
flex: none;
|
|
1337
|
+
display: flex;
|
|
1338
|
+
gap: 2px;
|
|
1339
|
+
margin: 0 10px 6px;
|
|
1340
|
+
padding: 2px;
|
|
1341
|
+
box-sizing: border-box;
|
|
1342
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));
|
|
1343
|
+
border-radius: 8px;
|
|
1344
|
+
background: color-mix(in srgb, var(--dsw-alias-label-primary) 5%, transparent);
|
|
1345
|
+
}
|
|
1346
|
+
.sc-seg {
|
|
1347
|
+
flex: 1 1 0;
|
|
1348
|
+
display: flex;
|
|
1349
|
+
align-items: center;
|
|
1350
|
+
justify-content: center;
|
|
1351
|
+
min-width: 0;
|
|
988
1352
|
height: 26px;
|
|
989
1353
|
padding: 0 8px;
|
|
990
|
-
border: 0
|
|
991
|
-
border-radius:
|
|
1354
|
+
border: 0;
|
|
1355
|
+
border-radius: 6px;
|
|
992
1356
|
background: transparent;
|
|
993
1357
|
color: var(--dsw-alias-label-secondary);
|
|
994
1358
|
font: inherit;
|
|
995
1359
|
font-size: 12px;
|
|
1360
|
+
line-height: 1;
|
|
996
1361
|
cursor: pointer;
|
|
997
1362
|
}
|
|
998
|
-
.sc-
|
|
999
|
-
|
|
1000
|
-
|
|
1363
|
+
.sc-seg[aria-pressed='true'] {
|
|
1364
|
+
background: color-mix(in srgb, var(--sc-calendar-accent) 16%, transparent);
|
|
1365
|
+
color: var(--dsw-alias-label-primary);
|
|
1366
|
+
font-weight: 600;
|
|
1367
|
+
}
|
|
1368
|
+
.sc-seg:active {
|
|
1369
|
+
background: color-mix(in srgb, var(--sc-calendar-accent) 26%, transparent);
|
|
1370
|
+
}
|
|
1371
|
+
.sc-seg:focus-visible {
|
|
1372
|
+
outline: 2px solid var(--dsw-focus-ring-color, var(--sc-calendar-accent));
|
|
1373
|
+
outline-offset: -1px;
|
|
1374
|
+
}
|
|
1375
|
+
.sc-navBtn.sc-hot,
|
|
1376
|
+
.sc-today.sc-hot {
|
|
1377
|
+
background: color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent);
|
|
1378
|
+
color: var(--dsw-alias-label-primary);
|
|
1379
|
+
}
|
|
1380
|
+
.sc-seg.sc-hot {
|
|
1381
|
+
background: color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent);
|
|
1382
|
+
color: var(--dsw-alias-label-primary);
|
|
1383
|
+
}
|
|
1384
|
+
.sc-seg[aria-pressed='true'].sc-hot {
|
|
1385
|
+
background: color-mix(in srgb, var(--sc-calendar-accent) 22%, transparent);
|
|
1386
|
+
}
|
|
1387
|
+
.sc-today {
|
|
1388
|
+
flex: 1 1 0;
|
|
1389
|
+
display: flex;
|
|
1390
|
+
align-items: center;
|
|
1391
|
+
justify-content: center;
|
|
1392
|
+
height: auto;
|
|
1393
|
+
min-height: 26px;
|
|
1394
|
+
padding: 0 8px;
|
|
1395
|
+
border: 0;
|
|
1396
|
+
border-radius: 6px;
|
|
1397
|
+
background: transparent;
|
|
1398
|
+
color: var(--dsw-alias-label-secondary);
|
|
1399
|
+
font: inherit;
|
|
1400
|
+
font-size: 12px;
|
|
1401
|
+
line-height: 1;
|
|
1402
|
+
cursor: pointer;
|
|
1001
1403
|
}
|
|
1002
1404
|
.sc-weekRow {
|
|
1003
1405
|
flex: none;
|
|
1004
1406
|
display: grid;
|
|
1005
1407
|
grid-template-columns: repeat(7, 1fr);
|
|
1006
1408
|
gap: 2px;
|
|
1007
|
-
margin-top:
|
|
1008
|
-
padding: 0
|
|
1409
|
+
margin-top: 4px;
|
|
1410
|
+
padding: 0 10px;
|
|
1009
1411
|
}
|
|
1010
1412
|
.sc-weekday {
|
|
1011
1413
|
display: flex;
|
|
1012
1414
|
align-items: center;
|
|
1013
1415
|
justify-content: center;
|
|
1014
|
-
height:
|
|
1416
|
+
height: 24px;
|
|
1015
1417
|
color: var(--dsw-alias-label-tertiary);
|
|
1016
|
-
font-size:
|
|
1418
|
+
font-size: 12px;
|
|
1017
1419
|
line-height: 1.6;
|
|
1018
1420
|
}
|
|
1019
1421
|
.sc-grid {
|
|
1020
1422
|
flex: none;
|
|
1021
1423
|
display: grid;
|
|
1022
1424
|
grid-template-columns: repeat(7, 1fr);
|
|
1023
|
-
gap:
|
|
1024
|
-
padding: 0 8px
|
|
1425
|
+
gap: 3px;
|
|
1426
|
+
padding: 0 10px 8px;
|
|
1025
1427
|
}
|
|
1026
1428
|
.sc-cell {
|
|
1027
1429
|
display: flex;
|
|
1028
1430
|
flex-direction: column;
|
|
1029
1431
|
align-items: center;
|
|
1030
1432
|
justify-content: center;
|
|
1031
|
-
gap:
|
|
1032
|
-
height:
|
|
1433
|
+
gap: 2px;
|
|
1434
|
+
height: 38px;
|
|
1033
1435
|
padding: 0;
|
|
1034
1436
|
box-sizing: border-box;
|
|
1035
|
-
border:
|
|
1437
|
+
border: 1.5px solid var(--dsw-alias-border-l3, rgba(0, 0, 0, 0.12));
|
|
1036
1438
|
border-color: color-mix(in srgb, var(--dsw-alias-label-secondary) 15%, transparent);
|
|
1037
|
-
border-radius:
|
|
1439
|
+
border-radius: 10px;
|
|
1038
1440
|
background: transparent;
|
|
1039
1441
|
color: var(--dsw-alias-label-primary);
|
|
1040
1442
|
font: inherit;
|
|
1041
|
-
font-size:
|
|
1443
|
+
font-size: 14px;
|
|
1042
1444
|
font-variant-numeric: tabular-nums;
|
|
1043
1445
|
line-height: 1.6;
|
|
1044
1446
|
cursor: pointer;
|
|
@@ -1048,35 +1450,75 @@ window.__ModuleLoader__.load({
|
|
|
1048
1450
|
cursor: default;
|
|
1049
1451
|
visibility: hidden;
|
|
1050
1452
|
}
|
|
1051
|
-
/*
|
|
1052
|
-
|
|
1053
|
-
|
|
1453
|
+
/* A day with sessions paints its frame in the Workspace colours: one
|
|
1454
|
+
solid colour, or a gradient through every Workspace that created
|
|
1455
|
+
sessions that day. The frame is a masked ring so the rounded corners
|
|
1456
|
+
survive, and the cell's own border steps aside for it. */
|
|
1457
|
+
.sc-cell {
|
|
1458
|
+
position: relative;
|
|
1459
|
+
}
|
|
1054
1460
|
.sc-cellFilled {
|
|
1055
|
-
border-color:
|
|
1461
|
+
border-color: transparent;
|
|
1462
|
+
}
|
|
1463
|
+
.sc-cellFilled::before {
|
|
1464
|
+
content: '';
|
|
1465
|
+
position: absolute;
|
|
1466
|
+
inset: -1.5px;
|
|
1467
|
+
border-radius: inherit;
|
|
1468
|
+
padding: 1.5px;
|
|
1469
|
+
background: var(--sc-ring, var(--dsw-alias-border-l3));
|
|
1470
|
+
-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
|
|
1471
|
+
-webkit-mask-composite: xor;
|
|
1472
|
+
mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
|
|
1473
|
+
mask-composite: exclude;
|
|
1474
|
+
pointer-events: none;
|
|
1056
1475
|
}
|
|
1057
|
-
.sc-cellToday {
|
|
1476
|
+
.sc-cellToday:not(.sc-cellFilled) {
|
|
1058
1477
|
border-color: color-mix(in srgb, var(--sc-calendar-accent) 62%, transparent);
|
|
1059
1478
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1479
|
+
/* Today's number stays plain text — white in the dark theme, ink in the
|
|
1480
|
+
light one — because the brand blue on the card was hard to read. The
|
|
1481
|
+
underline carries the "today" mark instead. */
|
|
1482
|
+
.sc-cellToday .sc-dayNum {
|
|
1483
|
+
color: var(--dsw-alias-label-primary);
|
|
1484
|
+
font-weight: 700;
|
|
1485
|
+
text-decoration: underline;
|
|
1486
|
+
text-decoration-color: color-mix(in srgb, var(--sc-calendar-accent) 70%, transparent);
|
|
1487
|
+
text-decoration-thickness: 1.5px;
|
|
1488
|
+
text-underline-offset: 2px;
|
|
1489
|
+
}
|
|
1490
|
+
.sc-cellSelected {
|
|
1063
1491
|
background: color-mix(in srgb, var(--sc-calendar-accent) 16%, transparent);
|
|
1064
1492
|
color: var(--dsw-alias-label-primary);
|
|
1065
1493
|
font-weight: 600;
|
|
1066
1494
|
}
|
|
1495
|
+
.sc-cellSelected:not(.sc-cellFilled) {
|
|
1496
|
+
border-color: var(--sc-calendar-accent);
|
|
1497
|
+
}
|
|
1067
1498
|
.sc-dayNum {
|
|
1068
|
-
line-height:
|
|
1499
|
+
line-height: 18px;
|
|
1500
|
+
}
|
|
1501
|
+
/* One dot per Workspace present that day; a row holds five, then wraps. */
|
|
1502
|
+
.sc-dots {
|
|
1503
|
+
display: flex;
|
|
1504
|
+
flex-wrap: wrap;
|
|
1505
|
+
align-items: center;
|
|
1506
|
+
justify-content: center;
|
|
1507
|
+
gap: 3px;
|
|
1508
|
+
max-width: 38px;
|
|
1509
|
+
max-height: 13px;
|
|
1510
|
+
overflow: hidden;
|
|
1069
1511
|
}
|
|
1070
1512
|
.sc-dot {
|
|
1071
|
-
width:
|
|
1072
|
-
height:
|
|
1513
|
+
width: 5px;
|
|
1514
|
+
height: 5px;
|
|
1073
1515
|
border-radius: 50%;
|
|
1074
|
-
background: var(--sc-
|
|
1516
|
+
background: var(--sc-dot, var(--dsw-alias-label-tertiary));
|
|
1075
1517
|
}
|
|
1076
1518
|
.sc-divider {
|
|
1077
1519
|
flex: none;
|
|
1078
1520
|
height: 1px;
|
|
1079
|
-
margin: 0
|
|
1521
|
+
margin: 0 10px;
|
|
1080
1522
|
background: var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.06));
|
|
1081
1523
|
}
|
|
1082
1524
|
.sc-dayHead {
|
|
@@ -1085,10 +1527,10 @@ window.__ModuleLoader__.load({
|
|
|
1085
1527
|
align-items: baseline;
|
|
1086
1528
|
justify-content: space-between;
|
|
1087
1529
|
gap: 8px;
|
|
1088
|
-
padding:
|
|
1530
|
+
padding: 9px 14px 3px;
|
|
1089
1531
|
}
|
|
1090
1532
|
.sc-dayLabel {
|
|
1091
|
-
font-size:
|
|
1533
|
+
font-size: 12.5px;
|
|
1092
1534
|
font-weight: 600;
|
|
1093
1535
|
overflow: hidden;
|
|
1094
1536
|
text-overflow: ellipsis;
|
|
@@ -1096,16 +1538,19 @@ window.__ModuleLoader__.load({
|
|
|
1096
1538
|
}
|
|
1097
1539
|
.sc-dayCount {
|
|
1098
1540
|
flex: none;
|
|
1099
|
-
font-size:
|
|
1541
|
+
font-size: 11.5px;
|
|
1100
1542
|
color: var(--dsw-alias-label-secondary);
|
|
1101
1543
|
}
|
|
1102
1544
|
.sc-list {
|
|
1103
1545
|
flex: 1 1 auto;
|
|
1104
1546
|
min-height: 0;
|
|
1547
|
+
display: flex;
|
|
1548
|
+
flex-direction: column;
|
|
1105
1549
|
overflow-y: auto;
|
|
1106
|
-
padding:
|
|
1550
|
+
padding: 3px 8px 10px;
|
|
1107
1551
|
}
|
|
1108
1552
|
.sc-group {
|
|
1553
|
+
flex: none;
|
|
1109
1554
|
display: flex;
|
|
1110
1555
|
flex-direction: column;
|
|
1111
1556
|
gap: 3px;
|
|
@@ -1113,31 +1558,25 @@ window.__ModuleLoader__.load({
|
|
|
1113
1558
|
.sc-group + .sc-group {
|
|
1114
1559
|
margin-top: 8px;
|
|
1115
1560
|
}
|
|
1116
|
-
/*
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
}
|
|
1121
|
-
.sc-accent-1 {
|
|
1122
|
-
--sc-accent: var(--dsw-alias-state-success-primary);
|
|
1123
|
-
}
|
|
1124
|
-
.sc-accent-2 {
|
|
1125
|
-
--sc-accent: var(--dsw-alias-state-warn-primary);
|
|
1126
|
-
}
|
|
1127
|
-
.sc-accent-3 {
|
|
1128
|
-
--sc-accent: var(--dsw-alias-state-error-primary);
|
|
1129
|
-
}
|
|
1561
|
+
/* --sc-accent arrives inline from the Workspace palette: one colour per
|
|
1562
|
+
Workspace, used by the group glyph and its rows' hairlines. */
|
|
1563
|
+
/* The Workspace heading stays pinned while its own rows scroll past, so
|
|
1564
|
+
a busy day never loses track of which group you are reading. */
|
|
1130
1565
|
.sc-groupHead {
|
|
1566
|
+
position: sticky;
|
|
1567
|
+
top: 0;
|
|
1568
|
+
z-index: 1;
|
|
1131
1569
|
display: flex;
|
|
1132
1570
|
align-items: center;
|
|
1133
1571
|
gap: 5px;
|
|
1134
|
-
padding:
|
|
1572
|
+
padding: 7px 7px 3px;
|
|
1135
1573
|
color: var(--dsw-alias-label-secondary);
|
|
1136
|
-
font-size:
|
|
1574
|
+
font-size: 12px;
|
|
1137
1575
|
font-weight: 600;
|
|
1576
|
+
background: var(--dsw-specific-menu, var(--dsw-alias-bg-layer-1));
|
|
1138
1577
|
}
|
|
1139
1578
|
.sc-groupHead svg {
|
|
1140
|
-
color:
|
|
1579
|
+
color: var(--sc-accent, currentColor);
|
|
1141
1580
|
}
|
|
1142
1581
|
.sc-groupTitle {
|
|
1143
1582
|
overflow: hidden;
|
|
@@ -1152,17 +1591,17 @@ window.__ModuleLoader__.load({
|
|
|
1152
1591
|
.sc-row {
|
|
1153
1592
|
display: flex;
|
|
1154
1593
|
align-items: center;
|
|
1155
|
-
gap:
|
|
1594
|
+
gap: 9px;
|
|
1156
1595
|
width: 100%;
|
|
1157
|
-
padding:
|
|
1596
|
+
padding: 4px 8px;
|
|
1158
1597
|
box-sizing: border-box;
|
|
1159
1598
|
border: 1px solid var(--dsw-alias-border-l3, rgba(0, 0, 0, 0.12));
|
|
1160
|
-
border-color: color-mix(in srgb, var(--sc-accent, currentColor)
|
|
1161
|
-
border-radius:
|
|
1162
|
-
background: color-mix(in srgb, var(--sc-accent, currentColor)
|
|
1599
|
+
border-color: color-mix(in srgb, var(--sc-accent, currentColor) 42%, transparent);
|
|
1600
|
+
border-radius: 9px;
|
|
1601
|
+
background: color-mix(in srgb, var(--sc-accent, currentColor) 5%, transparent);
|
|
1163
1602
|
color: var(--dsw-alias-label-primary);
|
|
1164
1603
|
font: inherit;
|
|
1165
|
-
font-size:
|
|
1604
|
+
font-size: 13.5px;
|
|
1166
1605
|
text-align: left;
|
|
1167
1606
|
cursor: pointer;
|
|
1168
1607
|
}
|
|
@@ -1181,10 +1620,13 @@ window.__ModuleLoader__.load({
|
|
|
1181
1620
|
}
|
|
1182
1621
|
.sc-note {
|
|
1183
1622
|
flex: none;
|
|
1184
|
-
|
|
1623
|
+
/* Auto vertical margins centre the note in whatever space is left, so
|
|
1624
|
+
a fixed-height card never leaves it stranded at the top. */
|
|
1625
|
+
margin: auto 0;
|
|
1626
|
+
padding: 18px 16px 20px;
|
|
1185
1627
|
text-align: center;
|
|
1186
1628
|
color: var(--dsw-alias-label-secondary);
|
|
1187
|
-
font-size:
|
|
1629
|
+
font-size: 12.5px;
|
|
1188
1630
|
}
|
|
1189
1631
|
.sc-note strong {
|
|
1190
1632
|
display: block;
|
|
@@ -1194,7 +1636,7 @@ window.__ModuleLoader__.load({
|
|
|
1194
1636
|
}
|
|
1195
1637
|
.sc-retry {
|
|
1196
1638
|
margin-top: 10px;
|
|
1197
|
-
height:
|
|
1639
|
+
height: 28px;
|
|
1198
1640
|
padding: 0 12px;
|
|
1199
1641
|
border: 0.5px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));
|
|
1200
1642
|
border-radius: 8px;
|
|
@@ -1207,7 +1649,14 @@ window.__ModuleLoader__.load({
|
|
|
1207
1649
|
|
|
1208
1650
|
/* A window too short for the grid plus a list scrolls the whole card
|
|
1209
1651
|
instead of squeezing the list out of existence. */
|
|
1210
|
-
@media (max-height:
|
|
1652
|
+
@media (max-height: 560px) {
|
|
1653
|
+
.sc-cell {
|
|
1654
|
+
height: 32px;
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
/* Below this the fixed layout cannot fit at all, so the card itself
|
|
1658
|
+
becomes the scroller instead of clipping the grid. */
|
|
1659
|
+
@media (max-height: 420px) {
|
|
1211
1660
|
.sc-card {
|
|
1212
1661
|
overflow-y: auto;
|
|
1213
1662
|
}
|
|
@@ -1215,8 +1664,8 @@ window.__ModuleLoader__.load({
|
|
|
1215
1664
|
flex: 0 0 auto;
|
|
1216
1665
|
overflow: visible;
|
|
1217
1666
|
}
|
|
1218
|
-
.sc-
|
|
1219
|
-
|
|
1667
|
+
.sc-note {
|
|
1668
|
+
margin: 0;
|
|
1220
1669
|
}
|
|
1221
1670
|
}
|
|
1222
1671
|
`
|
|
@@ -1239,9 +1688,12 @@ window.__ModuleLoader__.load({
|
|
|
1239
1688
|
return () => { element.remove() }
|
|
1240
1689
|
}, 'session-calendar: styles')
|
|
1241
1690
|
|
|
1242
|
-
/**
|
|
1691
|
+
/**
|
|
1692
|
+
* Open one Session without dismissing the card: the calendar stays up so
|
|
1693
|
+
* the reader can keep picking from the same day. Dismissing remains the
|
|
1694
|
+
* explicit paths (the row, a click outside, Escape, a resize).
|
|
1695
|
+
*/
|
|
1243
1696
|
const openSession = (sessionId) => {
|
|
1244
|
-
closeShared()
|
|
1245
1697
|
try {
|
|
1246
1698
|
ctx.uiWorkspace.openSession(sessionId)
|
|
1247
1699
|
} catch (error) {
|