@akira-yylm/session-calendar 1.0.4 → 1.1.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.
package/client.js CHANGED
@@ -38,11 +38,127 @@ 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 = 320
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
- /** Card height kept clear below the trigger when the window allows it. */
45
- const CARD_RESERVE = 360
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
+ function dayRing(colors) {
141
+ if (colors.length === 0) return undefined
142
+ if (colors.length === 1) return colors[0]
143
+ const stops = colors.map((color, index) => color + ' '
144
+ + Math.round((index * 100) / (colors.length - 1)) + '%')
145
+ return 'linear-gradient(135deg, ' + stops.join(', ') + ')'
146
+ }
147
+
148
+ /** Distinct Workspace colour indexes a day needs dots for, in one row. */
149
+ const MAX_DAY_DOTS = 8
150
+ function dayColorIndexes(groups) {
151
+ const indexes = []
152
+ for (const group of groups) {
153
+ if (!indexes.includes(group.colorIndex)) indexes.push(group.colorIndex)
154
+ }
155
+ indexes.sort((left, right) => {
156
+ if (left < 0) return 1
157
+ if (right < 0) return -1
158
+ return left - right
159
+ })
160
+ return indexes.slice(0, MAX_DAY_DOTS)
161
+ }
46
162
 
47
163
  // ---------------------------------------------------------------------
48
164
  // Copy. Chinese is also the runtime fallback when a seat omits `t`.
@@ -52,6 +168,9 @@ window.__ModuleLoader__.load({
52
168
  entry: '会话日历',
53
169
  panel: '会话日历',
54
170
  open: '打开会话日历',
171
+ 'mode.first': '首次',
172
+ 'mode.last': '最近',
173
+ 'mode.switch': '按第一次对话时间 / 按最近一次对话时间',
55
174
  close: '关闭会话日历',
56
175
  today: '今天',
57
176
  prevMonth: '上个月',
@@ -92,6 +211,9 @@ window.__ModuleLoader__.load({
92
211
  entry: 'Session calendar',
93
212
  panel: 'Session calendar',
94
213
  open: 'Open the session calendar',
214
+ 'mode.first': 'First',
215
+ 'mode.last': 'Latest',
216
+ 'mode.switch': 'Group by first prompt or by latest conversation',
95
217
  close: 'Close the session calendar',
96
218
  today: 'Today',
97
219
  prevMonth: 'Previous month',
@@ -147,6 +269,13 @@ window.__ModuleLoader__.load({
147
269
  // Shared open state between the sidebar row and the overlay entry.
148
270
  // ---------------------------------------------------------------------
149
271
 
272
+ /**
273
+ * Which end of a Session's span the sheet groups by. It outlives the sheet,
274
+ * so reopening it keeps the reader's last choice; the switch lives inside
275
+ * the card now, not on the sidebar row.
276
+ */
277
+ let lastMode = 'first'
278
+
150
279
  let shared = { open: false, anchor: null, trigger: null }
151
280
  const listeners = new Set()
152
281
 
@@ -335,14 +464,33 @@ window.__ModuleLoader__.load({
335
464
  /** Last accepted Host payload, so reopening paints instantly. */
336
465
  let payloadCache = null
337
466
 
338
- /** One parsed creation-time row, or null when the row is unusable. */
467
+ /** One parsed time row, or null when the row is unusable. */
339
468
  function readRow(row) {
340
469
  if (row === null || typeof row !== 'object') return null
341
470
  if (typeof row.id !== 'string' || row.id === '') return null
342
- if (typeof row.createdAt !== 'number' || !Number.isFinite(row.createdAt)) return null
471
+ if (!Number.isFinite(row.startedAt) && !Number.isFinite(row.createdAt)) return null
343
472
  return row
344
473
  }
345
474
 
475
+ /**
476
+ * The time this Session lands on under `mode`:
477
+ * - `first`: when its conversation began;
478
+ * - `last`: when it was last talked to.
479
+ *
480
+ * DSH already tracks the last human prompt: `SessionSummary.updatedAt` is
481
+ * the newer of the Session's creation and that prompt's time, and only a
482
+ * `user/message` ever advances it — opening a Session, or a command the UI
483
+ * runs while opening it, does not. Everything falls back to the Session
484
+ * object's creation time.
485
+ */
486
+ function anchorOf(row, mode, info) {
487
+ if (mode === 'last') {
488
+ if (info !== undefined && info !== null && Number.isFinite(info.updatedAt)) return info.updatedAt
489
+ if (Number.isFinite(row.lastConversationAt)) return row.lastConversationAt
490
+ }
491
+ return Number.isFinite(row.startedAt) ? row.startedAt : row.createdAt
492
+ }
493
+
346
494
  /** Fetch the Host's creation-time rows; refreshes on open and on retry. */
347
495
  function useCreated() {
348
496
  const [state, setState] = React.useState(() => payloadCache === null
@@ -392,7 +540,7 @@ window.__ModuleLoader__.load({
392
540
  * Bucket creation rows into calendar days, each day grouped by Workspace in
393
541
  * the sidebar's own order. Returns `Map<'YYYY-MM-DD', { count, groups }>`.
394
542
  */
395
- function indexDays(rows, sessionList, workspaceSnapshot, t) {
543
+ function indexDays(rows, sessionList, workspaceSnapshot, t, mode) {
396
544
  const sessions = (sessionList !== undefined && sessionList !== null && sessionList.byId) || {}
397
545
  const workspaces = (workspaceSnapshot !== undefined
398
546
  && workspaceSnapshot !== null
@@ -438,7 +586,13 @@ window.__ModuleLoader__.load({
438
586
  const groupOrder = workspace !== undefined
439
587
  ? (orderOf.get(workspace.workspaceId) === undefined ? 0 : orderOf.get(workspace.workspaceId))
440
588
  : workspaces.length + 1
441
- const day = dayKeyOf(new Date(row.createdAt))
589
+ // The colour follows the Workspace's place in the registry, so it is
590
+ // the same on every day; a directory that is not a Workspace has none.
591
+ const colorIndex = workspace !== undefined
592
+ ? (orderOf.get(workspace.workspaceId) === undefined ? -1 : orderOf.get(workspace.workspaceId))
593
+ : -1
594
+ const when = anchorOf(row, mode, info)
595
+ const day = dayKeyOf(new Date(when))
442
596
  let bucket = days.get(day)
443
597
  if (bucket === undefined) {
444
598
  bucket = { count: 0, groups: new Map() }
@@ -446,7 +600,7 @@ window.__ModuleLoader__.load({
446
600
  }
447
601
  let group = bucket.groups.get(groupKey)
448
602
  if (group === undefined) {
449
- group = { key: groupKey, title: groupTitle, order: groupOrder, items: [] }
603
+ group = { key: groupKey, title: groupTitle, order: groupOrder, colorIndex, items: [] }
450
604
  bucket.groups.set(groupKey, group)
451
605
  }
452
606
  const live = info !== undefined && info !== null && typeof info.title === 'string' ? info.title.trim() : ''
@@ -457,7 +611,7 @@ window.__ModuleLoader__.load({
457
611
  group.items.push({
458
612
  id: row.id,
459
613
  title: live !== '' ? live : stored !== '' ? stored : fallback !== '' ? fallback : t('untitled'),
460
- time: row.createdAt,
614
+ time: when,
461
615
  })
462
616
  bucket.count += 1
463
617
  }
@@ -491,9 +645,11 @@ window.__ModuleLoader__.load({
491
645
  }
492
646
  const element = buttonRef.current
493
647
  const rect = element === null || element === undefined
494
- ? { right: isWide ? 268 : 56, top: 120 }
648
+ ? { right: isWide ? 268 : 56 }
495
649
  : element.getBoundingClientRect()
496
- openWith({ right: rect.right, top: rect.top }, element)
650
+ // Only the horizontal anchor is needed: the card centres itself
651
+ // vertically in the frame.
652
+ openWith({ right: rect.right }, element)
497
653
  }
498
654
 
499
655
  return h(
@@ -542,27 +698,43 @@ window.__ModuleLoader__.load({
542
698
  const cardRef = React.useRef(null)
543
699
  // Captured before the shared sheet clears its trigger on close.
544
700
  const triggerRef = React.useRef(shared.trigger)
545
- const skipFocusReturn = React.useRef(false)
546
701
  const todayKey = dayKeyOf(new Date())
547
702
  const [month, setMonth] = React.useState(() => monthStartOf(new Date()))
548
703
  const [selected, setSelected] = React.useState(() => todayKey)
704
+ const [mode, setMode] = React.useState(lastMode)
705
+ const changeMode = (next) => {
706
+ lastMode = next
707
+ setMode(next)
708
+ }
549
709
 
550
710
  const days = React.useMemo(
551
- () => indexDays(created.rows, sessionList, workspaceSnapshot, t),
552
- [created.rows, sessionList, workspaceSnapshot, t],
711
+ () => indexDays(created.rows, sessionList, workspaceSnapshot, t, mode),
712
+ [created.rows, sessionList, workspaceSnapshot, t, mode],
553
713
  )
714
+ const workspaceCount = (workspaceSnapshot !== undefined
715
+ && workspaceSnapshot !== null
716
+ && Array.isArray(workspaceSnapshot.items))
717
+ ? workspaceSnapshot.items.length
718
+ : 0
719
+ const palette = React.useMemo(() => paletteFor(workspaceCount), [workspaceCount])
720
+ /** One Workspace's colour, or the quiet tertiary tone for an orphan group. */
721
+ const colorOf = (colorIndex) => (colorIndex >= 0 && palette[colorIndex] !== undefined
722
+ ? palette[colorIndex]
723
+ : 'var(--dsw-alias-label-tertiary)')
554
724
 
555
725
  const geometry = React.useMemo(() => {
556
726
  const viewportWidth = typeof window === 'undefined' ? 1440 : window.innerWidth
557
727
  const viewportHeight = typeof window === 'undefined' ? 900 : window.innerHeight
558
- const width = Math.max(240, Math.min(CARD_WIDTH, viewportWidth - 24))
728
+ const width = Math.max(260, Math.min(CARD_WIDTH, viewportWidth - 24))
729
+ // Horizontally the card hugs the sidebar's right edge; vertically the
730
+ // stylesheet centres it in the frame with auto margins, so it never
731
+ // hands off the bottom of a short window.
559
732
  const wantedLeft = anchor === null || anchor === undefined ? 268 : anchor.right + 10
560
733
  const left = Math.max(12, Math.min(wantedLeft, viewportWidth - width - 12))
561
- const wantedTop = anchor === null || anchor === undefined ? 96 : anchor.top
562
- // Keep room for the whole card; on a short window the card scrolls instead.
563
- const top = Math.max(12, Math.min(wantedTop, viewportHeight - CARD_RESERVE))
564
- const maxHeight = Math.max(220, Math.min(560, viewportHeight - top - 24))
565
- return { left, top, width, maxHeight }
734
+ // The height is fixed: switching to a day with more or fewer sessions
735
+ // must not resize the card, or the grid would slide under the pointer.
736
+ const height = Math.max(260, Math.min(720, viewportHeight - 24))
737
+ return { left, width, height }
566
738
  }, [anchor])
567
739
 
568
740
  React.useEffect(() => {
@@ -570,9 +742,8 @@ window.__ModuleLoader__.load({
570
742
  if (card !== null && card !== undefined && typeof card.focus === 'function') {
571
743
  card.focus({ preventScroll: true })
572
744
  }
573
- // Closing returns focus to the row, unless the click opened a Session.
745
+ // Closing returns focus to the sidebar row.
574
746
  return () => {
575
- if (skipFocusReturn.current) return
576
747
  const trigger = triggerRef.current
577
748
  if (trigger === null || trigger === undefined || trigger.isConnected !== true) return
578
749
  try {
@@ -630,9 +801,11 @@ window.__ModuleLoader__.load({
630
801
  setMonth(next)
631
802
  setSelected(firstDayWithSessions(next, days) || dayKeyOf(next))
632
803
  }
633
- const openAndClose = (sessionId) => {
634
- skipFocusReturn.current = true
635
- closeShared()
804
+ // Opening a session leaves the calendar where it is: the window is a
805
+ // browsing surface, so the reader can keep picking sessions from it.
806
+ // Dismissing stays on the explicit paths (the row again, a click
807
+ // outside, Escape, or a window resize).
808
+ const openFromList = (sessionId) => {
636
809
  if (typeof openSession === 'function') openSession(sessionId)
637
810
  }
638
811
 
@@ -655,13 +828,13 @@ window.__ModuleLoader__.load({
655
828
  id: 'session-calendar-card',
656
829
  className: 'sc-card',
657
830
  role: 'dialog',
658
- 'aria-label': t('panel'),
831
+ 'data-mode': mode,
832
+ 'aria-label': t('panel') + ' · ' + t('mode.' + mode),
659
833
  tabIndex: -1,
660
834
  style: {
661
835
  left: geometry.left + 'px',
662
- top: geometry.top + 'px',
663
836
  width: geometry.width + 'px',
664
- maxHeight: geometry.maxHeight + 'px',
837
+ height: geometry.height + 'px',
665
838
  },
666
839
  },
667
840
  h(
@@ -690,6 +863,22 @@ window.__ModuleLoader__.load({
690
863
  },
691
864
  h(ChevronGlyph, { direction: 'right' }),
692
865
  ),
866
+ h(
867
+ 'div',
868
+ { className: 'sc-mode', role: 'group', 'aria-label': t('mode.switch') },
869
+ ['first', 'last'].map((value) => h(
870
+ 'button',
871
+ {
872
+ key: value,
873
+ type: 'button',
874
+ className: 'sc-modeBtn',
875
+ 'aria-pressed': mode === value ? 'true' : 'false',
876
+ title: t('mode.switch'),
877
+ onClick: () => { changeMode(value) },
878
+ },
879
+ t('mode.' + value),
880
+ )),
881
+ ),
693
882
  h(
694
883
  'button',
695
884
  {
@@ -725,10 +914,14 @@ window.__ModuleLoader__.load({
725
914
  const key = dayKeyOf(date)
726
915
  const entry = days.get(key)
727
916
  const count = entry === undefined ? 0 : entry.count
917
+ const dotIndexes = entry === undefined ? [] : dayColorIndexes(entry.list)
918
+ const ring = dayRing(dotIndexes.map((index) => colorOf(index)))
728
919
  const classes = ['sc-cell']
729
920
  if (count > 0) classes.push('sc-cellFilled')
921
+ // Today and the picked day are independent marks, so a picked
922
+ // today keeps both.
923
+ if (key === todayKey) classes.push('sc-cellToday')
730
924
  if (key === selected) classes.push('sc-cellSelected')
731
- else if (key === todayKey) classes.push('sc-cellToday')
732
925
  return h(
733
926
  'button',
734
927
  {
@@ -743,10 +936,26 @@ window.__ModuleLoader__.load({
743
936
  count,
744
937
  })
745
938
  : undefined,
939
+ // The hover text names the Workspaces the coloured dots stand
940
+ // for, so the colour is readable before the day is opened.
941
+ title: entry === undefined
942
+ ? undefined
943
+ : entry.list.map((group) => group.title + ' · ' + group.items.length).join('\n'),
944
+ style: ring === undefined ? undefined : { '--sc-ring': ring },
746
945
  onClick: () => { setSelected(key) },
747
946
  },
748
947
  h('span', { className: 'sc-dayNum' }, String(date.getDate())),
749
- count > 0 ? h('span', { className: 'sc-dot' }) : null,
948
+ dotIndexes.length > 0
949
+ ? h(
950
+ 'span',
951
+ { className: 'sc-dots' },
952
+ dotIndexes.map((index) => h('span', {
953
+ key: index,
954
+ className: 'sc-dot',
955
+ style: { '--sc-dot': colorOf(index) },
956
+ })),
957
+ )
958
+ : null,
750
959
  )
751
960
  }),
752
961
  ),
@@ -779,14 +988,16 @@ window.__ModuleLoader__.load({
779
988
  'section',
780
989
  {
781
990
  key: group.key === '' ? '__none__' : group.key,
782
- // Each Workspace keeps one accent hue, so a coloured
783
- // hairline also tells the groups apart at a glance.
784
- className: 'sc-group sc-accent-' + (((group.order % 4) + 4) % 4),
991
+ // The Workspace's own colour drives the group glyph and
992
+ // the hairline around each of its rows, so the day list
993
+ // and the calendar dots speak one colour language.
994
+ className: 'sc-group',
995
+ style: { '--sc-accent': colorOf(group.colorIndex) },
785
996
  },
786
997
  h(
787
998
  'div',
788
999
  { className: 'sc-groupHead' },
789
- h(FolderGlyph, { size: 12 }),
1000
+ h(FolderGlyph, { size: 13 }),
790
1001
  h('span', { className: 'sc-groupTitle', title: group.title }, group.title),
791
1002
  h('span', { className: 'sc-groupCount' }, String(group.items.length)),
792
1003
  ),
@@ -797,7 +1008,7 @@ window.__ModuleLoader__.load({
797
1008
  type: 'button',
798
1009
  className: 'sc-row',
799
1010
  title: item.title,
800
- onClick: () => { openAndClose(item.id) },
1011
+ onClick: () => { openFromList(item.id) },
801
1012
  },
802
1013
  h('span', { className: 'sc-rowTitle' }, item.title),
803
1014
  h('span', { className: 'sc-rowTime' }, clockOf(item.time)),
@@ -822,7 +1033,9 @@ window.__ModuleLoader__.load({
822
1033
  share one colour. */
823
1034
  .sc-stack,
824
1035
  .sc-card {
825
- --sc-calendar-accent: var(--dsw-alias-state-business-primary);
1036
+ /* The brand blue from DSH's own mark, at the owner's explicit request
1037
+ for a brighter accent; it is one hue in both themes. */
1038
+ --sc-calendar-accent: #4D6BFE;
826
1039
  }
827
1040
  .sc-stack {
828
1041
  flex: 1 1 auto;
@@ -839,6 +1052,9 @@ window.__ModuleLoader__.load({
839
1052
  /* Unlike the two filled conversation buttons above it, this row is a
840
1053
  tool: outlined, unfilled, and accented with the calendar's own colour,
841
1054
  so its different purpose reads before its label does. */
1055
+ /* Closed, the entry keeps the hairline outline of a button but stays
1056
+ unfilled; open, it takes a light wash of the brand blue, so the colour
1057
+ means "this calendar is showing" rather than decorating the row. */
842
1058
  .sc-launch {
843
1059
  display: flex;
844
1060
  align-items: center;
@@ -850,10 +1066,9 @@ window.__ModuleLoader__.load({
850
1066
  margin: 0;
851
1067
  box-sizing: border-box;
852
1068
  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
1069
  border-radius: var(--dsw-radius-md, 10px);
855
1070
  background: transparent;
856
- color: var(--dsw-alias-label-secondary);
1071
+ color: var(--dsw-alias-label-primary);
857
1072
  font: inherit;
858
1073
  font-size: 14px;
859
1074
  font-weight: 500;
@@ -867,24 +1082,23 @@ window.__ModuleLoader__.load({
867
1082
  color: var(--sc-calendar-accent);
868
1083
  }
869
1084
  .sc-launch[aria-expanded='true'] {
870
- border-color: color-mix(in srgb, var(--sc-calendar-accent) 72%, transparent);
871
- background: color-mix(in srgb, var(--sc-calendar-accent) 12%, transparent);
872
- color: var(--dsw-alias-label-primary);
1085
+ border-color: color-mix(in srgb, var(--sc-calendar-accent) 45%, transparent);
1086
+ background: color-mix(in srgb, var(--sc-calendar-accent) 15%, transparent);
873
1087
  }
874
1088
  .sc-launch:focus-visible {
875
1089
  outline: 2px solid var(--dsw-focus-ring-color, var(--sc-calendar-accent));
876
1090
  outline-offset: 1px;
877
1091
  }
1092
+ @media (hover: hover) {
1093
+ .sc-launch:not([aria-expanded='true']):hover,
1094
+ .sc-launchRail:not([aria-expanded='true']):hover {
1095
+ background: var(--dsw-alias-interactive-bg-hover);
1096
+ }
1097
+ }
878
1098
  .sc-launchRail {
879
1099
  width: 36px;
880
1100
  height: 36px;
881
1101
  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
1102
  }
889
1103
  .sc-launchLabel {
890
1104
  overflow: hidden;
@@ -904,6 +1118,14 @@ window.__ModuleLoader__.load({
904
1118
 
905
1119
  .sc-card {
906
1120
  position: fixed;
1121
+ /* Vertical centring without a transform: auto margins split the free
1122
+ space, which keeps the backdrop blur sampling correctly. */
1123
+ top: 0;
1124
+ bottom: 0;
1125
+ height: min(720px, calc(100vh - 24px));
1126
+ max-height: calc(100vh - 24px);
1127
+ margin-top: auto;
1128
+ margin-bottom: auto;
907
1129
  z-index: 1;
908
1130
  display: flex;
909
1131
  flex-direction: column;
@@ -929,7 +1151,7 @@ window.__ModuleLoader__.load({
929
1151
  display: flex;
930
1152
  align-items: center;
931
1153
  gap: 2px;
932
- padding: 8px 8px 2px;
1154
+ padding: 10px 10px 4px;
933
1155
  }
934
1156
  .sc-monthLabel {
935
1157
  flex: 1 1 auto;
@@ -938,7 +1160,7 @@ window.__ModuleLoader__.load({
938
1160
  text-overflow: ellipsis;
939
1161
  white-space: nowrap;
940
1162
  text-align: center;
941
- font-size: 13px;
1163
+ font-size: 14px;
942
1164
  line-height: 1.6;
943
1165
  color: var(--dsw-alias-label-primary);
944
1166
  }
@@ -947,11 +1169,11 @@ window.__ModuleLoader__.load({
947
1169
  display: inline-flex;
948
1170
  align-items: center;
949
1171
  justify-content: center;
950
- width: 26px;
951
- height: 26px;
1172
+ width: 28px;
1173
+ height: 28px;
952
1174
  padding: 0;
953
1175
  border: 0;
954
- border-radius: 8px;
1176
+ border-radius: 9px;
955
1177
  background: transparent;
956
1178
  color: var(--dsw-alias-label-secondary);
957
1179
  cursor: pointer;
@@ -983,12 +1205,45 @@ window.__ModuleLoader__.load({
983
1205
  background: var(--dsw-alias-interactive-bg-hover);
984
1206
  }
985
1207
  }
1208
+ /* The grouping switch inside the card: two small segments. */
1209
+ .sc-mode {
1210
+ flex: none;
1211
+ display: flex;
1212
+ align-items: center;
1213
+ height: 24px;
1214
+ padding: 1px;
1215
+ box-sizing: border-box;
1216
+ border: 1px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));
1217
+ border-radius: 7px;
1218
+ background: color-mix(in srgb, var(--dsw-alias-label-primary) 5%, transparent);
1219
+ }
1220
+ .sc-modeBtn {
1221
+ height: 20px;
1222
+ padding: 0 7px;
1223
+ border: 0;
1224
+ border-radius: 5px;
1225
+ background: transparent;
1226
+ color: var(--dsw-alias-label-secondary);
1227
+ font: inherit;
1228
+ font-size: 11.5px;
1229
+ line-height: 20px;
1230
+ cursor: pointer;
1231
+ }
1232
+ .sc-modeBtn[aria-pressed='true'] {
1233
+ background: color-mix(in srgb, var(--sc-calendar-accent) 16%, transparent);
1234
+ color: var(--dsw-alias-label-primary);
1235
+ font-weight: 600;
1236
+ }
1237
+ .sc-modeBtn:focus-visible {
1238
+ outline: 2px solid var(--dsw-focus-ring-color, var(--sc-calendar-accent));
1239
+ outline-offset: -1px;
1240
+ }
986
1241
  .sc-today {
987
1242
  flex: none;
988
- height: 26px;
1243
+ height: 28px;
989
1244
  padding: 0 8px;
990
1245
  border: 0.5px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));
991
- border-radius: 8px;
1246
+ border-radius: 9px;
992
1247
  background: transparent;
993
1248
  color: var(--dsw-alias-label-secondary);
994
1249
  font: inherit;
@@ -1004,41 +1259,41 @@ window.__ModuleLoader__.load({
1004
1259
  display: grid;
1005
1260
  grid-template-columns: repeat(7, 1fr);
1006
1261
  gap: 2px;
1007
- margin-top: 2px;
1008
- padding: 0 8px;
1262
+ margin-top: 4px;
1263
+ padding: 0 10px;
1009
1264
  }
1010
1265
  .sc-weekday {
1011
1266
  display: flex;
1012
1267
  align-items: center;
1013
1268
  justify-content: center;
1014
- height: 22px;
1269
+ height: 24px;
1015
1270
  color: var(--dsw-alias-label-tertiary);
1016
- font-size: 11px;
1271
+ font-size: 12px;
1017
1272
  line-height: 1.6;
1018
1273
  }
1019
1274
  .sc-grid {
1020
1275
  flex: none;
1021
1276
  display: grid;
1022
1277
  grid-template-columns: repeat(7, 1fr);
1023
- gap: 2px;
1024
- padding: 0 8px 6px;
1278
+ gap: 3px;
1279
+ padding: 0 10px 8px;
1025
1280
  }
1026
1281
  .sc-cell {
1027
1282
  display: flex;
1028
1283
  flex-direction: column;
1029
1284
  align-items: center;
1030
1285
  justify-content: center;
1031
- gap: 1px;
1032
- height: 30px;
1286
+ gap: 2px;
1287
+ height: 38px;
1033
1288
  padding: 0;
1034
1289
  box-sizing: border-box;
1035
- border: 1px solid var(--dsw-alias-border-l3, rgba(0, 0, 0, 0.12));
1290
+ border: 1.5px solid var(--dsw-alias-border-l3, rgba(0, 0, 0, 0.12));
1036
1291
  border-color: color-mix(in srgb, var(--dsw-alias-label-secondary) 15%, transparent);
1037
- border-radius: 8px;
1292
+ border-radius: 10px;
1038
1293
  background: transparent;
1039
1294
  color: var(--dsw-alias-label-primary);
1040
1295
  font: inherit;
1041
- font-size: 13px;
1296
+ font-size: 14px;
1042
1297
  font-variant-numeric: tabular-nums;
1043
1298
  line-height: 1.6;
1044
1299
  cursor: pointer;
@@ -1048,35 +1303,68 @@ window.__ModuleLoader__.load({
1048
1303
  cursor: default;
1049
1304
  visibility: hidden;
1050
1305
  }
1051
- /* Every date keeps a neutral 1px frame; a day with sessions swaps it for
1052
- the calendar's accent colour, today strengthens it, and the picked day
1053
- takes the solid accent plus a tinted fill. */
1306
+ /* A day with sessions paints its frame in the Workspace colours: one
1307
+ solid colour, or a gradient through every Workspace that created
1308
+ sessions that day. The frame is a masked ring so the rounded corners
1309
+ survive, and the cell's own border steps aside for it. */
1310
+ .sc-cell {
1311
+ position: relative;
1312
+ }
1054
1313
  .sc-cellFilled {
1055
- border-color: color-mix(in srgb, var(--sc-calendar-accent) 34%, transparent);
1314
+ border-color: transparent;
1056
1315
  }
1057
- .sc-cellToday {
1316
+ .sc-cellFilled::before {
1317
+ content: '';
1318
+ position: absolute;
1319
+ inset: -1.5px;
1320
+ border-radius: inherit;
1321
+ padding: 1.5px;
1322
+ background: var(--sc-ring, var(--dsw-alias-border-l3));
1323
+ -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
1324
+ -webkit-mask-composite: xor;
1325
+ mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
1326
+ mask-composite: exclude;
1327
+ pointer-events: none;
1328
+ }
1329
+ .sc-cellToday:not(.sc-cellFilled) {
1058
1330
  border-color: color-mix(in srgb, var(--sc-calendar-accent) 62%, transparent);
1059
1331
  }
1060
- .sc-cellSelected,
1061
- .sc-cellSelected:hover {
1062
- border-color: var(--sc-calendar-accent);
1332
+ .sc-cellToday .sc-dayNum {
1333
+ color: var(--sc-calendar-accent);
1334
+ font-weight: 600;
1335
+ }
1336
+ .sc-cellSelected {
1063
1337
  background: color-mix(in srgb, var(--sc-calendar-accent) 16%, transparent);
1064
1338
  color: var(--dsw-alias-label-primary);
1065
1339
  font-weight: 600;
1066
1340
  }
1341
+ .sc-cellSelected:not(.sc-cellFilled) {
1342
+ border-color: var(--sc-calendar-accent);
1343
+ }
1067
1344
  .sc-dayNum {
1068
- line-height: 15px;
1345
+ line-height: 18px;
1346
+ }
1347
+ /* One dot per Workspace present that day; a row holds five, then wraps. */
1348
+ .sc-dots {
1349
+ display: flex;
1350
+ flex-wrap: wrap;
1351
+ align-items: center;
1352
+ justify-content: center;
1353
+ gap: 3px;
1354
+ max-width: 38px;
1355
+ max-height: 13px;
1356
+ overflow: hidden;
1069
1357
  }
1070
1358
  .sc-dot {
1071
- width: 4px;
1072
- height: 4px;
1359
+ width: 5px;
1360
+ height: 5px;
1073
1361
  border-radius: 50%;
1074
- background: var(--sc-calendar-accent);
1362
+ background: var(--sc-dot, var(--dsw-alias-label-tertiary));
1075
1363
  }
1076
1364
  .sc-divider {
1077
1365
  flex: none;
1078
1366
  height: 1px;
1079
- margin: 0 8px;
1367
+ margin: 0 10px;
1080
1368
  background: var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.06));
1081
1369
  }
1082
1370
  .sc-dayHead {
@@ -1085,10 +1373,10 @@ window.__ModuleLoader__.load({
1085
1373
  align-items: baseline;
1086
1374
  justify-content: space-between;
1087
1375
  gap: 8px;
1088
- padding: 8px 12px 2px;
1376
+ padding: 9px 14px 3px;
1089
1377
  }
1090
1378
  .sc-dayLabel {
1091
- font-size: 12px;
1379
+ font-size: 12.5px;
1092
1380
  font-weight: 600;
1093
1381
  overflow: hidden;
1094
1382
  text-overflow: ellipsis;
@@ -1096,16 +1384,19 @@ window.__ModuleLoader__.load({
1096
1384
  }
1097
1385
  .sc-dayCount {
1098
1386
  flex: none;
1099
- font-size: 11px;
1387
+ font-size: 11.5px;
1100
1388
  color: var(--dsw-alias-label-secondary);
1101
1389
  }
1102
1390
  .sc-list {
1103
1391
  flex: 1 1 auto;
1104
1392
  min-height: 0;
1393
+ display: flex;
1394
+ flex-direction: column;
1105
1395
  overflow-y: auto;
1106
- padding: 2px 6px 8px;
1396
+ padding: 3px 8px 10px;
1107
1397
  }
1108
1398
  .sc-group {
1399
+ flex: none;
1109
1400
  display: flex;
1110
1401
  flex-direction: column;
1111
1402
  gap: 3px;
@@ -1113,31 +1404,25 @@ window.__ModuleLoader__.load({
1113
1404
  .sc-group + .sc-group {
1114
1405
  margin-top: 8px;
1115
1406
  }
1116
- /* One accent hue per Workspace: it colours the group's glyph and the
1117
- hairline around each of its session rows. */
1118
- .sc-accent-0 {
1119
- --sc-accent: var(--dsw-alias-state-business-primary);
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
- }
1407
+ /* --sc-accent arrives inline from the Workspace palette: one colour per
1408
+ Workspace, used by the group glyph and its rows' hairlines. */
1409
+ /* The Workspace heading stays pinned while its own rows scroll past, so
1410
+ a busy day never loses track of which group you are reading. */
1130
1411
  .sc-groupHead {
1412
+ position: sticky;
1413
+ top: 0;
1414
+ z-index: 1;
1131
1415
  display: flex;
1132
1416
  align-items: center;
1133
1417
  gap: 5px;
1134
- padding: 6px 6px 2px;
1418
+ padding: 7px 7px 3px;
1135
1419
  color: var(--dsw-alias-label-secondary);
1136
- font-size: 11px;
1420
+ font-size: 12px;
1137
1421
  font-weight: 600;
1422
+ background: var(--dsw-specific-menu, var(--dsw-alias-bg-layer-1));
1138
1423
  }
1139
1424
  .sc-groupHead svg {
1140
- color: color-mix(in srgb, var(--sc-accent, currentColor) 78%, var(--dsw-alias-label-secondary));
1425
+ color: var(--sc-accent, currentColor);
1141
1426
  }
1142
1427
  .sc-groupTitle {
1143
1428
  overflow: hidden;
@@ -1152,17 +1437,17 @@ window.__ModuleLoader__.load({
1152
1437
  .sc-row {
1153
1438
  display: flex;
1154
1439
  align-items: center;
1155
- gap: 8px;
1440
+ gap: 9px;
1156
1441
  width: 100%;
1157
- padding: 5px 7px;
1442
+ padding: 4px 8px;
1158
1443
  box-sizing: border-box;
1159
1444
  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) 30%, transparent);
1161
- border-radius: 8px;
1162
- background: color-mix(in srgb, var(--sc-accent, currentColor) 4%, transparent);
1445
+ border-color: color-mix(in srgb, var(--sc-accent, currentColor) 42%, transparent);
1446
+ border-radius: 9px;
1447
+ background: color-mix(in srgb, var(--sc-accent, currentColor) 5%, transparent);
1163
1448
  color: var(--dsw-alias-label-primary);
1164
1449
  font: inherit;
1165
- font-size: 13px;
1450
+ font-size: 13.5px;
1166
1451
  text-align: left;
1167
1452
  cursor: pointer;
1168
1453
  }
@@ -1181,10 +1466,13 @@ window.__ModuleLoader__.load({
1181
1466
  }
1182
1467
  .sc-note {
1183
1468
  flex: none;
1184
- padding: 16px 14px 18px;
1469
+ /* Auto vertical margins centre the note in whatever space is left, so
1470
+ a fixed-height card never leaves it stranded at the top. */
1471
+ margin: auto 0;
1472
+ padding: 18px 16px 20px;
1185
1473
  text-align: center;
1186
1474
  color: var(--dsw-alias-label-secondary);
1187
- font-size: 12px;
1475
+ font-size: 12.5px;
1188
1476
  }
1189
1477
  .sc-note strong {
1190
1478
  display: block;
@@ -1194,7 +1482,7 @@ window.__ModuleLoader__.load({
1194
1482
  }
1195
1483
  .sc-retry {
1196
1484
  margin-top: 10px;
1197
- height: 26px;
1485
+ height: 28px;
1198
1486
  padding: 0 12px;
1199
1487
  border: 0.5px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));
1200
1488
  border-radius: 8px;
@@ -1207,7 +1495,14 @@ window.__ModuleLoader__.load({
1207
1495
 
1208
1496
  /* A window too short for the grid plus a list scrolls the whole card
1209
1497
  instead of squeezing the list out of existence. */
1210
- @media (max-height: 460px) {
1498
+ @media (max-height: 560px) {
1499
+ .sc-cell {
1500
+ height: 32px;
1501
+ }
1502
+ }
1503
+ /* Below this the fixed layout cannot fit at all, so the card itself
1504
+ becomes the scroller instead of clipping the grid. */
1505
+ @media (max-height: 420px) {
1211
1506
  .sc-card {
1212
1507
  overflow-y: auto;
1213
1508
  }
@@ -1215,8 +1510,8 @@ window.__ModuleLoader__.load({
1215
1510
  flex: 0 0 auto;
1216
1511
  overflow: visible;
1217
1512
  }
1218
- .sc-cell {
1219
- height: 26px;
1513
+ .sc-note {
1514
+ margin: 0;
1220
1515
  }
1221
1516
  }
1222
1517
  `
@@ -1239,9 +1534,12 @@ window.__ModuleLoader__.load({
1239
1534
  return () => { element.remove() }
1240
1535
  }, 'session-calendar: styles')
1241
1536
 
1242
- /** Open one Session and dismiss the card in the same navigation. */
1537
+ /**
1538
+ * Open one Session without dismissing the card: the calendar stays up so
1539
+ * the reader can keep picking from the same day. Dismissing remains the
1540
+ * explicit paths (the row, a click outside, Escape, a resize).
1541
+ */
1243
1542
  const openSession = (sessionId) => {
1244
- closeShared()
1245
1543
  try {
1246
1544
  ctx.uiWorkspace.openSession(sessionId)
1247
1545
  } catch (error) {