@akira-yylm/session-calendar 1.1.0 → 1.1.2

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 CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.2
4
+
5
+ - **空状态文案跟随分组规则**:按「最近」看时,某天没有会话显示「这一天没有进行对话」;按「首次」看仍然是「这一天没有创建会话」。日期格的无障碍标签同理(「有 N 个会话进行了对话」/「创建了 N 个会话」)。
6
+ - **工作区分组可折叠**:每个工作区的标题行变成可点的折叠条(左侧三角随开合旋转、`aria-expanded` 同步),折叠后只留标题和条数;折叠状态会记住(同一次运行内再打开日历仍保持)。
7
+ - 中英两套文案同步。
8
+
9
+ ## 1.1.1
10
+
11
+ - **修复:卡片头部的「‹」「›」「今天」「×」偶发点了没反应**。根因有两个:① 悬停高亮只靠 CSS `:hover`,快速划过时浏览器不一定会重绘;② 月份标题作为弹性项占掉了头部约 40% 宽度,那是一段完全不可点的宽区块,鼠标常落在上面。现在悬停改为**按指针实际位置判定**(文档级 `pointermove` + `elementFromPoint`,命中哪个控件就给哪个加 `.sc-hot`,幂等、不依赖 enter/leave 配对),并把月份标题移出控件行。
12
+ - 月份这一行的四个按钮(`‹` `›` `今天` `×`)改成和下面「首次/最近」完全同一套样式:同一个描边轨道(1px 边框 + 6px 圆角 + 5% 墨色底)、内部 2px 间距、按钮 6px 圆角无边框、悬停同为 9% 中性底。
13
+ - **头部重排**:月份标题单独一行居中;下面四个控件(`‹` `›` `今天` `×`)**等分整行**,每个约 76×36px,控件之间只剩 6px 缝,没有大段死区。
14
+ - **「首次 / 最近」切换器改为独立整行**:两格各约 160px 宽、26px 高,取代原来挤在头部右侧的小胶囊。
15
+ - 悬停反馈从宿主的中性色(深色主题下几乎看不见)改为**品牌蓝淡底**,一眼可见。
16
+ - 「今天」不再有 `disabled` 态(之前显示当前月且选中今天时它既无悬停也不响应点击)。
17
+ - 卡片去掉 `backdrop-filter`:它会提升为独立合成层,快速划过时背景变化可能错过那一帧。
18
+ - **选中的日期改用当天配色的底色**:不再是统一的 16% 蓝底,而是铺当天涉及的工作区颜色——单工作区是纯色,多工作区是以**格子中心为圆心**的**角度渐变**(每个工作区占一个扇区),透明度 **50%**(这个数值留作后续调整);没有会话的日子仍是蓝色淡底。选中格里的圆点加了一圈发丝描边,免得同色系底上糊成一片。
19
+ - **日期格彩色边框也改成角度渐变**:多工作区的边框原来是 135° 斜向渐变,现在同样以格子中心为圆心,每个工作区占一个扇区,和选中底色同一套方向。
20
+ - **「今天」的日期数字改用正文色**(深色主题下是白色、浅色主题下是墨色)并加粗,不再用品牌蓝——蓝字压在卡片底色上不好读;「今天」的标记改由日期下方一条品牌蓝下划线承担,有会话的格子也照样能看出来。
21
+ - **新增键盘方向键**:焦点在小窗里时,`←` `→` 选前一天/后一天,`↑` `↓` 选上一周/下一周;跨月会自动翻到对应月份,列表跟着更新。焦点在对话输入框里时不拦截方向键。
22
+
3
23
  ## 1.1.0
4
24
 
5
25
  - **日历圆点改为工作区颜色**:某天创建过会话时,日期下方按工作区各画一个 4px 圆点(颜色 = 下方分组的工作区色),同一天几个工作区就几个点;鼠标悬停可直接读到「工作区 · 条数」。
package/README.en.md CHANGED
@@ -16,11 +16,11 @@ Clicking a row opens that session, and the switch remembers your last choice.
16
16
  ## Usage
17
17
 
18
18
  1. Under **New session** / **Free session** sits **one `Session calendar` button** — transparent with a neutral hairline while closed, a 15% brand-blue wash plus a 45% hairline while open, spanning the row width; it becomes a 36px icon button in the collapsed rail.
19
- 2. Clicking it opens the calendar to the right of the sidebar, **vertically centred** in the window (about 360px wide, 38px day cells). Its height is fixed (up to 720px), so switching days scrolls only the list and never shifts the grid under your pointer; on a busy day the list scrolls with each group heading pinned.
20
- 3. **Switching rules**: in the card header, right of the month navigation, a small **First / Latest** segmented switch re-groups in place; the choice is remembered, and pressing the sidebar button again dismisses the card.
19
+ 2. Clicking it opens the calendar to the right of the sidebar, **vertically centred** in the window (about 360px wide, 38px day cells). Its first row is the month title; the second row is four evenly split buttons — `‹` `›` `Today` `×`. Its height is fixed (up to 720px), so switching days scrolls only the list and never shifts the grid under your pointer; on a busy day the list scrolls with each group heading pinned.
20
+ 3. **Switching rules**: under the month title sits a full-width **First / Latest** segmented switch (about 160px per segment); it re-groups in place, the choice is remembered, and pressing the sidebar button again dismisses the card.
21
21
  4. A day with sessions is framed in **the colours of the workspaces involved under the active rule** (solid for one, a gradient for several), with one dot per workspace below; hovering names them and their counts.
22
- 5. `‹` / `›` page months (landing on that month's earliest day with sessions); **Today** returns.
23
- 6. Sessions are grouped in sidebar workspace order; the group glyph and every row's hairline use that workspace's colour, and each row shows title plus the time the active rule uses. The list header names the rule (by first prompt / by latest).
22
+ 5. `‹` / `›` page months (landing on that month's earliest day with sessions); **Today** returns. With focus inside the card the **arrow keys** work as well: `←` `→` for a day, `↑` `↓` for a week, following the month when needed.
23
+ 6. Sessions are grouped in sidebar workspace order, and each group heading folds its rows when clicked (the fold state is remembered); the group glyph and every row's hairline use that workspace's colour, and each row shows title plus the time the active rule uses. The list header names the rule (by first prompt / by latest).
24
24
  7. Click a row to open that session in the conversation area; **the calendar stays open**, so you can keep picking from the same day.
25
25
  8. Dismiss with the active button again, a click outside, `Esc`, or a window resize.
26
26
 
@@ -29,8 +29,8 @@ Clicking a row opens that session, and the switch remembers your last choice.
29
29
  The calendar dots, each day's frame, the group glyph, and each session row's hairline share **one colour per workspace**, so the month grid itself says which workspace created sessions on which day.
30
30
 
31
31
  - One workspace that day: the frame is that solid colour.
32
- - Several workspaces: the frame is a 135° gradient through their colours in workspace order.
33
- - **Today** is marked by an accent-coloured date number and **the picked day** by a tinted fill plus bolder type; neither overrides the data colour.
32
+ - Several workspaces: the frame is an angular gradient centred on the cell, one wedge per workspace in workspace order.
33
+ - **Today** is marked by a bolder date number in the primary text colour plus an accent underline (the blue number was hard to read on the card), and **the picked day** by a 50% wash of that day's own colour scheme (solid for one workspace, an angular run centred on the cell, one wedge per workspace, for several) plus bolder type; neither overrides the data colour.
34
34
 
35
35
  Eight base colours, in family order:
36
36
 
@@ -67,10 +67,10 @@ An npm install gains a **Versions** section in the plugin page, so upgrades are
67
67
  To bypass npm, or to pin an exact commit, install from the repository instead:
68
68
 
69
69
  ```sh
70
- github:Akira-yylm/dsh-session-calendar#v1.1.0
70
+ github:Akira-yylm/dsh-session-calendar#v1.1.1
71
71
  ```
72
72
 
73
- To let Plugin Manager treat the install as an **updatable** Git plugin, replace the tag with the full 40-char commit SHA (`git rev-parse v1.1.0`); a tag or branch also installs, but never follows updates.
73
+ To let Plugin Manager treat the install as an **updatable** Git plugin, replace the tag with the full 40-char commit SHA (`git rev-parse v1.1.1`); a tag or branch also installs, but never follows updates.
74
74
 
75
75
  > Git installs can be very slow from mainland China; prefer the npm method above.
76
76
 
package/README.md CHANGED
@@ -16,11 +16,11 @@
16
16
  ## 怎么用
17
17
 
18
18
  1. 左侧导航「新会话」「免费会话」下方是**一个「会话日历」按钮**:收起时背景透明但保留中性细描边、只有蓝色日历图标;打开后铺一层 15% 品牌蓝 + 45% 淡蓝描边(宽度与上面那行一致,折叠成细栏时变成 36px 图标按钮)。
19
- 2. 点它:小窗出现在左侧栏右边、并在窗口内**纵向居中**(约 360px 宽、日期格 38px 高)。高度固定(最多 720px),所以换日期时只有列表在滚动,月历格子不会跳动;会话很多时列表内部滚动,分组标题吸顶跟随。
20
- 3. **切换规则**:小窗顶部月份导航右边是一枚 **「首次|最近」** 分段开关,点它就地重排(窗口不动),选择会记住;再点侧栏那个按钮才收起。
19
+ 2. 点它:小窗出现在左侧栏右边、并在窗口内**纵向居中**(约 360px 宽、日期格 38px 高)。顶部第一行是月份标题,第二行是 `‹` `›` `今天` `×` 四个均分整行的按钮。高度固定(最多 720px),所以换日期时只有列表在滚动,月历格子不会跳动;会话很多时列表内部滚动,分组标题吸顶跟随。
20
+ 3. **切换规则**:月份标题下面有一整行 **「首次|最近」** 分段开关(每格约 160px 宽),点它就地重排(窗口不动),选择会记住;再点侧栏那个按钮才收起。
21
21
  4. 有会话的日期,**边框就是当天(按当前规则)涉及的工作区颜色**(只有一个工作区是纯色;多个工作区是一条渐变色边框),下面还按工作区各有一个圆点;鼠标悬停能看到「工作区 · 条数」。点日期即可查看当天会话。
22
- 5. `‹` `›` 翻月(会自动落到该月最早有会话的那一天),「今天」回到当天。
23
- 6. 下方按工作区顺序分组,每组标题是该工作区的名字,组图标和每行的描边也用它自己的颜色;每条显示会话标题和时间(左边是首次对话时间、右边是最近对话时间),当前是哪条规则看顶部那枚开关就行。
22
+ 5. `‹` `›` 翻月(会自动落到该月最早有会话的那一天),「今天」回到当天。焦点在小窗里时也可以用**键盘方向键**:`←` `→` 前后一天、`↑` `↓` 前后一周(跨月自动翻月)。
23
+ 6. 下方按工作区顺序分组,每组标题是该工作区的名字(**标题行可点击折叠/展开该组**,折叠状态会被记住),组图标和每行的描边也用它自己的颜色;每条显示会话标题和时间(左边是首次对话时间、右边是最近对话时间),当前是哪条规则看顶部那枚开关就行。
24
24
  7. 点某条会话即在右侧对话区打开它,**小窗保持打开**,可以接着点同一天的下一条。
25
25
  8. 关掉小窗:再点侧栏那个按钮、点小窗外面、按 `Esc`,或改变窗口大小。
26
26
 
@@ -29,8 +29,8 @@
29
29
  圆点、日期格边框、分组图标、以及每条会话行的描边用的是**同一套工作区颜色**,所以从月历上就能读出「哪天、哪个工作区创建过会话」。
30
30
 
31
31
  - 当天只有 1 个工作区:日期格是一圈纯色边框。
32
- - 当天有多个工作区:日期格边框取这几个工作区的颜色,按工作区顺序 0% → 100% 排成 135° 渐变。
33
- - 「今天」用蓝色日期数字标记,「选中」用蓝色底 + 加粗;两者都不会覆盖数据色边框。
32
+ - 当天有多个工作区:日期格边框取这几个工作区的颜色,以格子中心为圆心铺成角度渐变,每个工作区占一个扇区。
33
+ - 「今天」用**加粗的正文色日期 + 一条蓝色下划线**标记(不再用蓝字,深色主题下看不清),「选中」铺**当天的配色**(单工作区纯色、多工作区以格子中心为圆心的角度渐变,每个工作区一个扇区,透明度 50%)+ 加粗;两者都不会覆盖数据色边框。
34
34
 
35
35
  基础色阶 8 色(按色相排列):
36
36
 
@@ -67,10 +67,10 @@
67
67
  不想经过 npm、或者想锁死某个提交时,用 GitHub 地址:
68
68
 
69
69
  ```sh
70
- github:Akira-yylm/dsh-session-calendar#v1.1.0
70
+ github:Akira-yylm/dsh-session-calendar#v1.1.1
71
71
  ```
72
72
 
73
- 想让 Plugin Manager 把它识别为**可更新**的 Git 安装,把 tag 换成完整的 40 位 commit SHA(`git rev-parse v1.1.0` 可查);写 tag 或分支名也能装,但不会跟随更新。
73
+ 想让 Plugin Manager 把它识别为**可更新**的 Git 安装,把 tag 换成完整的 40 位 commit SHA(`git rev-parse v1.1.1` 可查);写 tag 或分支名也能装,但不会跟随更新。
74
74
 
75
75
  > 中国大陆网络下 Git 直装可能很慢,建议优先用上面的 npm 方式。
76
76
 
package/client.js CHANGED
@@ -137,12 +137,31 @@ window.__ModuleLoader__.load({
137
137
  * The paint for one day's frame: the single colour when only one Workspace
138
138
  * created sessions that day, otherwise a gradient stopping at each of them.
139
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
+
140
155
  function dayRing(colors) {
141
156
  if (colors.length === 0) return undefined
142
157
  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(', ') + ')'
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(', ') + ')'
146
165
  }
147
166
 
148
167
  /** Distinct Workspace colour indexes a day needs dots for, in one row. */
@@ -181,9 +200,13 @@ window.__ModuleLoader__.load({
181
200
  retry: '重试',
182
201
  untitled: '未命名会话',
183
202
  unknownWorkspace: '未归属工作区',
203
+ 'emptyDay.first': '这一天没有创建会话',
204
+ 'emptyDay.last': '这一天没有进行对话',
184
205
  emptyDay: '这一天没有创建会话',
185
206
  monthLabel: '{year}年{month}月',
186
207
  dayLabel: '{month}月{day}日 周{weekday}',
208
+ 'dayWithCount.first': '{month}月{day}日,创建了 {count} 个会话',
209
+ 'dayWithCount.last': '{month}月{day}日,有 {count} 个会话进行了对话',
187
210
  dayWithCount: '{month}月{day}日,创建了 {count} 个会话',
188
211
  dayCount: '共 {count} 个会话',
189
212
  'weekday.0': '日',
@@ -224,9 +247,13 @@ window.__ModuleLoader__.load({
224
247
  retry: 'Retry',
225
248
  untitled: 'Untitled session',
226
249
  unknownWorkspace: 'No workspace',
250
+ 'emptyDay.first': 'No sessions were created on this day',
251
+ 'emptyDay.last': 'No conversation took place on this day',
227
252
  emptyDay: 'No sessions were created on this day',
228
253
  monthLabel: '{monthName} {year}',
229
254
  dayLabel: '{weekday}, {monthName} {day}',
255
+ 'dayWithCount.first': '{count} sessions were created on {monthName} {day}',
256
+ 'dayWithCount.last': '{count} sessions had conversations on {monthName} {day}',
230
257
  dayWithCount: '{count} sessions were created on {monthName} {day}',
231
258
  dayCount: '{count} sessions',
232
259
  'weekday.0': 'Sun',
@@ -276,6 +303,10 @@ window.__ModuleLoader__.load({
276
303
  */
277
304
  let lastMode = 'first'
278
305
 
306
+ /** Workspace groups the reader folded shut, by group key. */
307
+ const collapsedGroups = new Set()
308
+
309
+
279
310
  let shared = { open: false, anchor: null, trigger: null }
280
311
  const listeners = new Set()
281
312
 
@@ -706,6 +737,15 @@ window.__ModuleLoader__.load({
706
737
  lastMode = next
707
738
  setMode(next)
708
739
  }
740
+ const [collapsed, setCollapsed] = React.useState(() => new Set(collapsedGroups))
741
+ const toggleGroup = (key) => {
742
+ const next = new Set(collapsed)
743
+ if (next.has(key)) next.delete(key)
744
+ else next.add(key)
745
+ collapsedGroups.clear()
746
+ for (const value of next) collapsedGroups.add(value)
747
+ setCollapsed(next)
748
+ }
709
749
 
710
750
  const days = React.useMemo(
711
751
  () => indexDays(created.rows, sessionList, workspaceSnapshot, t, mode),
@@ -754,6 +794,43 @@ window.__ModuleLoader__.load({
754
794
  }
755
795
  }, [])
756
796
 
797
+ /**
798
+ * Header hover, driven by the pointer's own position.
799
+ *
800
+ * A quick pass over these controls could end with a `:hover`
801
+ * recalculation one frame behind, so the highlight never showed. Asking
802
+ * the document what is really under the pointer on every move is
803
+ * idempotent: whichever control the pointer is over carries the class,
804
+ * and a missed enter/leave cannot leave it stuck.
805
+ */
806
+ React.useEffect(() => {
807
+ const card = cardRef.current
808
+ if (card === null || card === undefined) return
809
+ const selector = '.sc-navBtn, .sc-today, .sc-seg'
810
+ let current = null
811
+ const clear = () => {
812
+ if (current === null) return
813
+ current.classList.remove('sc-hot')
814
+ current = null
815
+ }
816
+ const onMove = (event) => {
817
+ const top = document.elementFromPoint(event.clientX, event.clientY)
818
+ const hit = top !== null && typeof top.closest === 'function' ? top.closest(selector) : null
819
+ const next = hit !== null && card.contains(hit) ? hit : null
820
+ if (next === current) return
821
+ clear()
822
+ if (next !== null) {
823
+ next.classList.add('sc-hot')
824
+ current = next
825
+ }
826
+ }
827
+ document.addEventListener('pointermove', onMove, true)
828
+ return () => {
829
+ document.removeEventListener('pointermove', onMove, true)
830
+ clear()
831
+ }
832
+ }, [])
833
+
757
834
  React.useEffect(() => {
758
835
  const onPointerDown = (event) => {
759
836
  const card = cardRef.current
@@ -784,6 +861,39 @@ window.__ModuleLoader__.load({
784
861
  }
785
862
  }, [])
786
863
 
864
+ /**
865
+ * Arrow keys walk the selection: left/right by a day, up/down by a week.
866
+ * When the new date falls outside the shown month the month follows, so
867
+ * the keyboard never gets stuck at a month boundary. Keys are only taken
868
+ * while focus sits inside the card, so the conversation's own editor keeps
869
+ * its arrow keys.
870
+ */
871
+ React.useEffect(() => {
872
+ const onArrow = (event) => {
873
+ if (event.defaultPrevented || event.metaKey || event.ctrlKey || event.altKey) return
874
+ const card = cardRef.current
875
+ if (card === null || card === undefined) return
876
+ const active = document.activeElement
877
+ const inCard = active !== null && (active === card || card.contains(active))
878
+ if (!inCard) return
879
+ if (active instanceof HTMLElement
880
+ && (active.tagName === 'INPUT' || active.tagName === 'TEXTAREA' || active.isContentEditable)) return
881
+ const step = event.key === 'ArrowLeft' ? -1
882
+ : event.key === 'ArrowRight' ? 1
883
+ : event.key === 'ArrowUp' ? -7
884
+ : event.key === 'ArrowDown' ? 7
885
+ : 0
886
+ if (step === 0) return
887
+ event.preventDefault()
888
+ const parts = selected.split('-')
889
+ const next = new Date(Number(parts[0]), Number(parts[1]) - 1, Number(parts[2]) + step)
890
+ setSelected(dayKeyOf(next))
891
+ if (!sameMonth(month, next)) setMonth(monthStartOf(next))
892
+ }
893
+ document.addEventListener('keydown', onArrow)
894
+ return () => { document.removeEventListener('keydown', onArrow) }
895
+ }, [selected, month])
896
+
787
897
  const cells = React.useMemo(() => buildGrid(month), [month])
788
898
  const bucket = days.get(selected)
789
899
  const groups = bucket === undefined ? [] : bucket.list
@@ -837,6 +947,7 @@ window.__ModuleLoader__.load({
837
947
  height: geometry.height + 'px',
838
948
  },
839
949
  },
950
+ h('div', { className: 'sc-title' }, monthLabel),
840
951
  h(
841
952
  'header',
842
953
  { className: 'sc-head' },
@@ -851,7 +962,6 @@ window.__ModuleLoader__.load({
851
962
  },
852
963
  h(ChevronGlyph, { direction: 'left' }),
853
964
  ),
854
- h('span', { className: 'sc-monthLabel' }, monthLabel),
855
965
  h(
856
966
  'button',
857
967
  {
@@ -863,28 +973,11 @@ window.__ModuleLoader__.load({
863
973
  },
864
974
  h(ChevronGlyph, { direction: 'right' }),
865
975
  ),
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
- ),
882
976
  h(
883
977
  'button',
884
978
  {
885
979
  type: 'button',
886
980
  className: 'sc-today',
887
- disabled: sameMonth(month, new Date()) && selected === todayKey,
888
981
  onClick: goToday,
889
982
  },
890
983
  t('today'),
@@ -901,6 +994,21 @@ window.__ModuleLoader__.load({
901
994
  h(CloseGlyph),
902
995
  ),
903
996
  ),
997
+ h(
998
+ 'div',
999
+ { className: 'sc-modes', role: 'group', 'aria-label': t('mode.switch') },
1000
+ ['first', 'last'].map((value) => h(
1001
+ 'button',
1002
+ {
1003
+ key: value,
1004
+ type: 'button',
1005
+ className: 'sc-seg',
1006
+ 'aria-pressed': mode === value ? 'true' : 'false',
1007
+ onClick: () => { changeMode(value) },
1008
+ },
1009
+ t('mode.' + value),
1010
+ )),
1011
+ ),
904
1012
  h(
905
1013
  'div',
906
1014
  { className: 'sc-weekRow' },
@@ -915,7 +1023,12 @@ window.__ModuleLoader__.load({
915
1023
  const entry = days.get(key)
916
1024
  const count = entry === undefined ? 0 : entry.count
917
1025
  const dotIndexes = entry === undefined ? [] : dayColorIndexes(entry.list)
918
- const ring = dayRing(dotIndexes.map((index) => colorOf(index)))
1026
+ const dayColors = dotIndexes.map((index) => colorOf(index))
1027
+ const ring = dayRing(dayColors)
1028
+ const fill = key === selected ? dayFill(dayColors) : undefined
1029
+ const style = {}
1030
+ if (ring !== undefined) style['--sc-ring'] = ring
1031
+ if (fill !== undefined) style.background = fill
919
1032
  const classes = ['sc-cell']
920
1033
  if (count > 0) classes.push('sc-cellFilled')
921
1034
  // Today and the picked day are independent marks, so a picked
@@ -930,7 +1043,7 @@ window.__ModuleLoader__.load({
930
1043
  className: classes.join(' '),
931
1044
  'aria-pressed': key === selected ? 'true' : 'false',
932
1045
  'aria-label': count > 0
933
- ? t('dayWithCount', {
1046
+ ? t('dayWithCount.' + mode, {
934
1047
  month: date.getMonth() + 1,
935
1048
  day: date.getDate(),
936
1049
  count,
@@ -941,7 +1054,7 @@ window.__ModuleLoader__.load({
941
1054
  title: entry === undefined
942
1055
  ? undefined
943
1056
  : entry.list.map((group) => group.title + ' · ' + group.items.length).join('\n'),
944
- style: ring === undefined ? undefined : { '--sc-ring': ring },
1057
+ style: Object.keys(style).length === 0 ? undefined : style,
945
1058
  onClick: () => { setSelected(key) },
946
1059
  },
947
1060
  h('span', { className: 'sc-dayNum' }, String(date.getDate())),
@@ -983,11 +1096,14 @@ window.__ModuleLoader__.load({
983
1096
  'div',
984
1097
  { className: 'sc-list' },
985
1098
  groups.length === 0
986
- ? h('div', { className: 'sc-note' }, h('span', null, t('emptyDay')))
987
- : groups.map((group) => h(
1099
+ ? h('div', { className: 'sc-note' }, h('span', null, t('emptyDay.' + mode)))
1100
+ : groups.map((group) => {
1101
+ const groupKey = group.key === '' ? '__none__' : group.key
1102
+ const folded = collapsed.has(groupKey)
1103
+ return h(
988
1104
  'section',
989
1105
  {
990
- key: group.key === '' ? '__none__' : group.key,
1106
+ key: groupKey,
991
1107
  // The Workspace's own colour drives the group glyph and
992
1108
  // the hairline around each of its rows, so the day list
993
1109
  // and the calendar dots speak one colour language.
@@ -995,25 +1111,39 @@ window.__ModuleLoader__.load({
995
1111
  style: { '--sc-accent': colorOf(group.colorIndex) },
996
1112
  },
997
1113
  h(
998
- 'div',
999
- { className: 'sc-groupHead' },
1000
- h(FolderGlyph, { size: 13 }),
1001
- h('span', { className: 'sc-groupTitle', title: group.title }, group.title),
1002
- h('span', { className: 'sc-groupCount' }, String(group.items.length)),
1003
- ),
1004
- group.items.map((item) => h(
1005
1114
  'button',
1006
1115
  {
1007
- key: item.id,
1008
1116
  type: 'button',
1009
- className: 'sc-row',
1010
- title: item.title,
1011
- onClick: () => { openFromList(item.id) },
1117
+ className: 'sc-groupHead',
1118
+ 'aria-expanded': folded ? 'false' : 'true',
1119
+ title: group.title,
1120
+ onClick: () => { toggleGroup(groupKey) },
1012
1121
  },
1013
- h('span', { className: 'sc-rowTitle' }, item.title),
1014
- h('span', { className: 'sc-rowTime' }, clockOf(item.time)),
1015
- )),
1016
- )),
1122
+ h(
1123
+ 'span',
1124
+ { className: folded ? 'sc-groupChevron sc-groupChevronFolded' : 'sc-groupChevron' },
1125
+ h(ChevronGlyph, { size: 12, direction: 'right' }),
1126
+ ),
1127
+ h(FolderGlyph, { size: 13 }),
1128
+ h('span', { className: 'sc-groupTitle' }, group.title),
1129
+ h('span', { className: 'sc-groupCount' }, String(group.items.length)),
1130
+ ),
1131
+ folded
1132
+ ? null
1133
+ : group.items.map((item) => h(
1134
+ 'button',
1135
+ {
1136
+ key: item.id,
1137
+ type: 'button',
1138
+ className: 'sc-row',
1139
+ title: item.title,
1140
+ onClick: () => { openFromList(item.id) },
1141
+ },
1142
+ h('span', { className: 'sc-rowTitle' }, item.title),
1143
+ h('span', { className: 'sc-rowTime' }, clockOf(item.time)),
1144
+ )),
1145
+ )
1146
+ }),
1017
1147
  ),
1018
1148
  ),
1019
1149
  )
@@ -1134,8 +1264,12 @@ window.__ModuleLoader__.load({
1134
1264
  box-sizing: border-box;
1135
1265
  border: 0;
1136
1266
  border-radius: 16px;
1267
+ /* No backdrop-filter here: it promotes the card to its own composited
1268
+ layer, and a quick hover's background change can then miss the frame
1269
+ that paints before the pointer leaves — the control looks inert when
1270
+ the pointer moves fast. The menu token is already 94% opaque, so the
1271
+ blur bought nothing visible. */
1137
1272
  background: var(--dsw-specific-menu, var(--dsw-alias-bg-overlay, var(--dsw-alias-bg-layer-1)));
1138
- backdrop-filter: var(--dsw-menu-backdrop-filter, none);
1139
1273
  --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);
1140
1274
  box-shadow: var(--dsw-elevation-prominent);
1141
1275
  --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);
@@ -1146,34 +1280,46 @@ window.__ModuleLoader__.load({
1146
1280
  overflow: hidden;
1147
1281
  outline: none;
1148
1282
  }
1149
- .sc-head {
1283
+ /* The month is a heading; the four controls below split the row evenly,
1284
+ so there is no dead stretch between them to miss. */
1285
+ .sc-title {
1150
1286
  flex: none;
1151
- display: flex;
1152
- align-items: center;
1153
- gap: 2px;
1154
- padding: 10px 10px 4px;
1155
- }
1156
- .sc-monthLabel {
1157
- flex: 1 1 auto;
1158
- min-width: 0;
1159
- overflow: hidden;
1160
- text-overflow: ellipsis;
1161
- white-space: nowrap;
1287
+ padding: 8px 10px 2px;
1162
1288
  text-align: center;
1163
1289
  font-size: 14px;
1164
- line-height: 1.6;
1290
+ font-weight: 600;
1291
+ line-height: 1.5;
1165
1292
  color: var(--dsw-alias-label-primary);
1293
+ overflow: hidden;
1294
+ text-overflow: ellipsis;
1295
+ white-space: nowrap;
1166
1296
  }
1167
- .sc-navBtn {
1297
+ /* The month row is dressed exactly like the rule switch below it: one
1298
+ outlined track holding two-pixel-apart segments. */
1299
+ .sc-head {
1168
1300
  flex: none;
1301
+ display: flex;
1302
+ align-items: stretch;
1303
+ gap: 2px;
1304
+ margin: 0 10px 4px;
1305
+ padding: 2px;
1306
+ min-height: 30px;
1307
+ box-sizing: border-box;
1308
+ border: 1px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));
1309
+ border-radius: 8px;
1310
+ background: color-mix(in srgb, var(--dsw-alias-label-primary) 5%, transparent);
1311
+ user-select: none;
1312
+ }
1313
+ .sc-navBtn {
1314
+ flex: 1 1 0;
1169
1315
  display: inline-flex;
1170
1316
  align-items: center;
1171
1317
  justify-content: center;
1172
- width: 28px;
1173
- height: 28px;
1318
+ height: auto;
1319
+ min-height: 26px;
1174
1320
  padding: 0;
1175
1321
  border: 0;
1176
- border-radius: 9px;
1322
+ border-radius: 6px;
1177
1323
  background: transparent;
1178
1324
  color: var(--dsw-alias-label-secondary);
1179
1325
  cursor: pointer;
@@ -1187,14 +1333,20 @@ window.__ModuleLoader__.load({
1187
1333
  outline-offset: -2px;
1188
1334
  }
1189
1335
  @media (hover: hover) {
1190
- .sc-navBtn:hover {
1191
- background: var(--dsw-alias-interactive-bg-hover);
1336
+ .sc-navBtn:hover,
1337
+ .sc-today:hover {
1338
+ background: color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent);
1192
1339
  color: var(--dsw-alias-label-primary);
1193
1340
  }
1194
- .sc-today:hover:not(:disabled) {
1341
+ /* Both segments react to the pointer: the resting one lifts, the
1342
+ pressed one deepens, so a click never reads as "nothing happened". */
1343
+ .sc-seg:not([aria-pressed='true']):hover {
1195
1344
  background: var(--dsw-alias-interactive-bg-hover);
1196
1345
  color: var(--dsw-alias-label-primary);
1197
1346
  }
1347
+ .sc-seg[aria-pressed='true']:hover {
1348
+ background: color-mix(in srgb, var(--sc-calendar-accent) 22%, transparent);
1349
+ }
1198
1350
  .sc-cell:hover {
1199
1351
  background: color-mix(in srgb, var(--sc-calendar-accent) 10%, transparent);
1200
1352
  }
@@ -1205,55 +1357,87 @@ window.__ModuleLoader__.load({
1205
1357
  background: var(--dsw-alias-interactive-bg-hover);
1206
1358
  }
1207
1359
  }
1208
- /* The grouping switch inside the card: two small segments. */
1209
- .sc-mode {
1360
+ /* Pointer-driven twins of the header hover rules: a class change is a
1361
+ guaranteed repaint, so the controls answer on every entry. */
1362
+ .sc-navBtn.sc-hot {
1363
+ background: var(--dsw-alias-interactive-bg-hover);
1364
+ color: var(--dsw-alias-label-primary);
1365
+ }
1366
+ .sc-today.sc-hot {
1367
+ background: var(--dsw-alias-interactive-bg-hover);
1368
+ color: var(--dsw-alias-label-primary);
1369
+ }
1370
+ /* The grouping switch gets its own full-width row: two big segments,
1371
+ impossible to miss with the pointer. */
1372
+ .sc-modes {
1210
1373
  flex: none;
1211
1374
  display: flex;
1212
- align-items: center;
1213
- height: 24px;
1214
- padding: 1px;
1375
+ gap: 2px;
1376
+ margin: 0 10px 6px;
1377
+ padding: 2px;
1215
1378
  box-sizing: border-box;
1216
1379
  border: 1px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));
1217
- border-radius: 7px;
1380
+ border-radius: 8px;
1218
1381
  background: color-mix(in srgb, var(--dsw-alias-label-primary) 5%, transparent);
1219
1382
  }
1220
- .sc-modeBtn {
1221
- height: 20px;
1222
- padding: 0 7px;
1383
+ .sc-seg {
1384
+ flex: 1 1 0;
1385
+ display: flex;
1386
+ align-items: center;
1387
+ justify-content: center;
1388
+ min-width: 0;
1389
+ height: 26px;
1390
+ padding: 0 8px;
1223
1391
  border: 0;
1224
- border-radius: 5px;
1392
+ border-radius: 6px;
1225
1393
  background: transparent;
1226
1394
  color: var(--dsw-alias-label-secondary);
1227
1395
  font: inherit;
1228
- font-size: 11.5px;
1229
- line-height: 20px;
1396
+ font-size: 12px;
1397
+ line-height: 1;
1230
1398
  cursor: pointer;
1231
1399
  }
1232
- .sc-modeBtn[aria-pressed='true'] {
1400
+ .sc-seg[aria-pressed='true'] {
1233
1401
  background: color-mix(in srgb, var(--sc-calendar-accent) 16%, transparent);
1234
1402
  color: var(--dsw-alias-label-primary);
1235
1403
  font-weight: 600;
1236
1404
  }
1237
- .sc-modeBtn:focus-visible {
1405
+ .sc-seg:active {
1406
+ background: color-mix(in srgb, var(--sc-calendar-accent) 26%, transparent);
1407
+ }
1408
+ .sc-seg:focus-visible {
1238
1409
  outline: 2px solid var(--dsw-focus-ring-color, var(--sc-calendar-accent));
1239
1410
  outline-offset: -1px;
1240
1411
  }
1412
+ .sc-navBtn.sc-hot,
1413
+ .sc-today.sc-hot {
1414
+ background: color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent);
1415
+ color: var(--dsw-alias-label-primary);
1416
+ }
1417
+ .sc-seg.sc-hot {
1418
+ background: color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent);
1419
+ color: var(--dsw-alias-label-primary);
1420
+ }
1421
+ .sc-seg[aria-pressed='true'].sc-hot {
1422
+ background: color-mix(in srgb, var(--sc-calendar-accent) 22%, transparent);
1423
+ }
1241
1424
  .sc-today {
1242
- flex: none;
1243
- height: 28px;
1425
+ flex: 1 1 0;
1426
+ display: flex;
1427
+ align-items: center;
1428
+ justify-content: center;
1429
+ height: auto;
1430
+ min-height: 26px;
1244
1431
  padding: 0 8px;
1245
- border: 0.5px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));
1246
- border-radius: 9px;
1432
+ border: 0;
1433
+ border-radius: 6px;
1247
1434
  background: transparent;
1248
1435
  color: var(--dsw-alias-label-secondary);
1249
1436
  font: inherit;
1250
1437
  font-size: 12px;
1438
+ line-height: 1;
1251
1439
  cursor: pointer;
1252
1440
  }
1253
- .sc-today:disabled {
1254
- opacity: 0.45;
1255
- cursor: default;
1256
- }
1257
1441
  .sc-weekRow {
1258
1442
  flex: none;
1259
1443
  display: grid;
@@ -1329,9 +1513,16 @@ window.__ModuleLoader__.load({
1329
1513
  .sc-cellToday:not(.sc-cellFilled) {
1330
1514
  border-color: color-mix(in srgb, var(--sc-calendar-accent) 62%, transparent);
1331
1515
  }
1516
+ /* Today's number stays plain text — white in the dark theme, ink in the
1517
+ light one — because the brand blue on the card was hard to read. The
1518
+ underline carries the "today" mark instead. */
1332
1519
  .sc-cellToday .sc-dayNum {
1333
- color: var(--sc-calendar-accent);
1334
- font-weight: 600;
1520
+ color: var(--dsw-alias-label-primary);
1521
+ font-weight: 700;
1522
+ text-decoration: underline;
1523
+ text-decoration-color: color-mix(in srgb, var(--sc-calendar-accent) 70%, transparent);
1524
+ text-decoration-thickness: 1.5px;
1525
+ text-underline-offset: 2px;
1335
1526
  }
1336
1527
  .sc-cellSelected {
1337
1528
  background: color-mix(in srgb, var(--sc-calendar-accent) 16%, transparent);
@@ -1408,6 +1599,7 @@ window.__ModuleLoader__.load({
1408
1599
  Workspace, used by the group glyph and its rows' hairlines. */
1409
1600
  /* The Workspace heading stays pinned while its own rows scroll past, so
1410
1601
  a busy day never loses track of which group you are reading. */
1602
+ /* The heading folds its group, like a workspace row in the sidebar. */
1411
1603
  .sc-groupHead {
1412
1604
  position: sticky;
1413
1605
  top: 0;
@@ -1415,11 +1607,34 @@ window.__ModuleLoader__.load({
1415
1607
  display: flex;
1416
1608
  align-items: center;
1417
1609
  gap: 5px;
1418
- padding: 7px 7px 3px;
1610
+ width: 100%;
1611
+ padding: 6px 7px 3px;
1612
+ border: 0;
1613
+ border-radius: 6px;
1614
+ background: var(--dsw-specific-menu, var(--dsw-alias-bg-layer-1));
1419
1615
  color: var(--dsw-alias-label-secondary);
1616
+ font: inherit;
1420
1617
  font-size: 12px;
1421
1618
  font-weight: 600;
1422
- background: var(--dsw-specific-menu, var(--dsw-alias-bg-layer-1));
1619
+ text-align: left;
1620
+ cursor: pointer;
1621
+ }
1622
+ .sc-groupHead:hover {
1623
+ color: var(--dsw-alias-label-primary);
1624
+ }
1625
+ .sc-groupHead:focus-visible {
1626
+ outline: 2px solid var(--dsw-focus-ring-color, var(--sc-calendar-accent));
1627
+ outline-offset: -2px;
1628
+ }
1629
+ .sc-groupChevron {
1630
+ flex: none;
1631
+ display: inline-flex;
1632
+ color: var(--dsw-alias-label-tertiary);
1633
+ transform: rotate(90deg);
1634
+ transition: transform 120ms ease;
1635
+ }
1636
+ .sc-groupChevronFolded {
1637
+ transform: rotate(0deg);
1423
1638
  }
1424
1639
  .sc-groupHead svg {
1425
1640
  color: var(--sc-accent, currentColor);
package/locale/en.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "Session calendar",
4
- "description": "Adds **one button, 'Session calendar'** (rounded, a faint brand-blue wash with the calendar mark) below the 'Free session' row; it opens a small calendar beside the sidebar with a **First / Latest switch** in its header — First files a session on the day its first conversation happened, Latest on the day you last messaged it, and the choice is remembered. A day lists its sessions grouped by their workspaces, and the day frames and dots take the workspace colours involved (a gradient when several). Clicking a row opens that session and leaves the calendar open. Entry: the 'Session calendar' button in the left sidebar; inside the calendar use ‹ › to page months, 'Today' to return, and × to close. Usage: click a date, read the day's sessions grouped in sidebar order (title plus the active rule's time), then click any row to open it; clicking outside or pressing Esc also dismisses. Turning the plugin off removes the button and the window and leaves DSH sessions, workspaces, and their order untouched. Data: reads only bounded slices of this machine's session logs (the session object's creation time and the first user message at the head); 'Latest' reuses DSH's own session summary `updatedAt`; titles and grouping come from the page's existing session and workspace data, nothing is uploaded, no session is written, and command or status records are excluded from ordering; days follow the browser's local time zone; subagent, blank, and archived sessions are hidden by the sidebar's rules; workspace colours are assigned in registry order from an eight-colour family; the button follows the New-session row's visibility."
4
+ "description": "Adds **one button, 'Session calendar'** (rounded, a faint brand-blue wash with the calendar mark) below the 'Free session' row; it opens a small calendar beside the sidebar with a full-width **First / Latest switch** under the month title — First files a session on the day its first conversation happened, Latest on the day you last messaged it, and the choice is remembered. A day lists its sessions grouped by their workspaces, and the day frames and dots take the workspace colours involved (a gradient when several). Clicking a row opens that session and leaves the calendar open. Entry: the 'Session calendar' button in the left sidebar; inside the calendar use ‹ › to page months, 'Today' to return, and × to close, and (with focus in the card) the arrow keys to move a day or a week. Usage: click a date, read the day's sessions grouped in sidebar order (title plus the active rule's time), then click any row to open it; clicking outside or pressing Esc also dismisses. Turning the plugin off removes the button and the window and leaves DSH sessions, workspaces, and their order untouched. Data: reads only bounded slices of this machine's session logs (the session object's creation time and the first user message at the head); 'Latest' reuses DSH's own session summary `updatedAt`; titles and grouping come from the page's existing session and workspace data, nothing is uploaded, no session is written, and command or status records are excluded from ordering; days follow the browser's local time zone; subagent, blank, and archived sessions are hidden by the sidebar's rules; workspace colours are assigned in registry order from an eight-colour family; the button follows the New-session row's visibility."
5
5
  }
6
6
  }
package/locale/zh.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "会话日历",
4
- "description": "在左侧导航「免费会话」下面增加**一个按钮「会话日历」**(圆角、品牌蓝淡底 + 日历图标),点开后在左侧栏右边弹出小窗日历:窗口顶部有「首次|最近」分段开关——首次 = 按会话第一次对话时间归日,最近 = 按你最近一次发消息的时间归日,开关的选择会记住。某一天的会话按各自所属的工作区分组列出,日期格边框与圆点是当天涉及的工作区颜色(多个工作区为渐变);点条目直接打开该会话且小窗保持打开。入口:左侧导航「会话日历」;小窗内用 ‹ › 翻月、「今天」回到当天,右上角 × 关闭。使用:点日期 → 下方按工作区顺序分组列出当天会话(标题 + 当前规则的时间)→ 点任意一条即打开;点小窗外面或按 Esc 也能收起。关闭插件后按钮与小窗消失,DSH 的会话、工作区和会话顺序都不受影响。数据:只读本机会话日志的有界切片(对象创建时间、开头第一条用户消息),「最近」直接用 DSH 会话摘要里的 `updatedAt`;标题与分组取自页面已有的会话/工作区数据,不上传、不改写任何会话;命令/状态类事件不计入排序;日期按浏览器本地时区划分;子代理会话、空白会话与已归档会话按左侧栏同样的规则隐藏;工作区颜色按注册表顺序从 8 色阶分配;入口跟随「新会话」那一行显隐。"
4
+ "description": "在左侧导航「免费会话」下面增加**一个按钮「会话日历」**(圆角、品牌蓝淡底 + 日历图标),点开后在左侧栏右边弹出小窗日历:月份标题下面有「首次|最近」分段开关(整行、每格约 160px 宽)——首次 = 按会话第一次对话时间归日,最近 = 按你最近一次发消息的时间归日,开关的选择会记住。某一天的会话按各自所属的工作区分组列出,日期格边框与圆点是当天涉及的工作区颜色(多个工作区为渐变);点条目直接打开该会话且小窗保持打开。入口:左侧导航「会话日历」;小窗内用 ‹ › 翻月、「今天」回到当天、右上角 × 关闭;焦点在日历里时可用方向键(← → 前后一天、↑ ↓ 前后一周)。使用:点日期 → 下方按工作区顺序分组列出当天会话(标题 + 当前规则的时间)→ 点任意一条即打开;点小窗外面或按 Esc 也能收起。关闭插件后按钮与小窗消失,DSH 的会话、工作区和会话顺序都不受影响。数据:只读本机会话日志的有界切片(对象创建时间、开头第一条用户消息),「最近」直接用 DSH 会话摘要里的 `updatedAt`;标题与分组取自页面已有的会话/工作区数据,不上传、不改写任何会话;命令/状态类事件不计入排序;日期按浏览器本地时区划分;子代理会话、空白会话与已归档会话按左侧栏同样的规则隐藏;工作区颜色按注册表顺序从 8 色阶分配;入口跟随「新会话」那一行显隐。"
5
5
  }
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akira-yylm/session-calendar",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "type": "module",
5
5
  "description": "Session calendar: a month calendar beside the sidebar listing every session created on the selected day, grouped by workspace.",
6
6
  "license": "MIT",