dsh-plan-steps 0.1.3 → 0.1.4
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 +31 -0
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -15,6 +15,26 @@ window.__ModuleLoader__.load({
|
|
|
15
15
|
radius: 'var(--dsw-radius-lg, 12px)',
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Glass themes (dsh-catppuccin and siblings) expose their look as body
|
|
20
|
+
* variables and mark the document with `data-dsh-glass`; they only blur the
|
|
21
|
+
* surfaces listed in their own seam table, which does not know this panel.
|
|
22
|
+
* Reading the same variables keeps the panel visually identical without
|
|
23
|
+
* patching the theme.
|
|
24
|
+
* @returns extra styles for the panel root, empty when no glass theme is on.
|
|
25
|
+
*/
|
|
26
|
+
function glassSurface() {
|
|
27
|
+
if (typeof document === 'undefined' || !document.documentElement.hasAttribute('data-dsh-glass')) return {}
|
|
28
|
+
const blur = 'blur(var(--dsh-glass-blur, 14px))'
|
|
29
|
+
return {
|
|
30
|
+
background: 'var(--dsh-glass-card, var(--dsw-specific-menu, transparent))',
|
|
31
|
+
border: '1px solid var(--dsh-glass-rim-soft, transparent)',
|
|
32
|
+
backdropFilter: blur,
|
|
33
|
+
WebkitBackdropFilter: blur,
|
|
34
|
+
borderRadius: '14px',
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
18
38
|
// Material Symbols (google/material-design-icons, Apache-2.0), inlined as
|
|
19
39
|
// path data so the panel renders offline.
|
|
20
40
|
const ICONS = {
|
|
@@ -109,6 +129,16 @@ window.__ModuleLoader__.load({
|
|
|
109
129
|
// inside the content as a zero-width marker and is stripped here.
|
|
110
130
|
const todos = (useProjection('todos') ?? []).map(readItem)
|
|
111
131
|
const [open, setOpen] = React.useState(false)
|
|
132
|
+
// A glass theme can be switched on while the panel is mounted.
|
|
133
|
+
const [glass, setGlass] = React.useState(() => glassSurface())
|
|
134
|
+
React.useEffect(() => {
|
|
135
|
+
const observer = new MutationObserver(() => setGlass(glassSurface()))
|
|
136
|
+
observer.observe(document.documentElement, {
|
|
137
|
+
attributes: true,
|
|
138
|
+
attributeFilter: ['data-dsh-glass', 'data-dsh-glass-float'],
|
|
139
|
+
})
|
|
140
|
+
return () => observer.disconnect()
|
|
141
|
+
}, [])
|
|
112
142
|
if (todos.length === 0) return null
|
|
113
143
|
const { done, total, index, current } = positionOf(todos)
|
|
114
144
|
const label = '计划 · 第 ' + String(index) + ' / ' + String(total) + ' 步'
|
|
@@ -127,6 +157,7 @@ window.__ModuleLoader__.load({
|
|
|
127
157
|
color: TOKENS.title,
|
|
128
158
|
fontSize: '13px',
|
|
129
159
|
overflow: 'hidden',
|
|
160
|
+
...glass,
|
|
130
161
|
},
|
|
131
162
|
},
|
|
132
163
|
h(
|