@noy4/docserve 0.3.2 → 0.3.3
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/bin.mjs +2 -2
- package/dist/widget/index.js +11155 -0
- package/package.json +24 -3
- package/src/node/adapter.mjs +67 -0
- package/src/node/assets.mjs +36 -0
- package/src/node/dates.mjs +73 -0
- package/src/node/docs-info.mjs +39 -0
- package/src/node/files.mjs +43 -0
- package/src/node/gallery.mjs +33 -0
- package/src/node/inject.mjs +43 -0
- package/src/node/meta.mjs +137 -0
- package/src/node/routes.mjs +105 -0
- package/src/node/scan.mjs +87 -0
- package/src/node/serve-static.mjs +158 -0
- package/src/node/server.mjs +69 -0
- package/src/node/watch.mjs +119 -0
- package/src/plugins/copy/client.js +72 -0
- package/src/plugins/copy/copy.css +21 -0
- package/src/plugins/home/client.js +24 -0
- package/src/plugins/sidebar/client.js +105 -0
- package/src/plugins/sidebar/grouping.js +108 -0
- package/src/plugins/sidebar/icons.js +25 -0
- package/src/plugins/sidebar/model.ts +91 -0
- package/src/plugins/sidebar/resize-model.ts +47 -0
- package/src/plugins/sidebar/sidebar.css +663 -0
- package/src/plugins/sidebar/tree-model.ts +23 -0
- package/src/plugins/sidebar/tree.ts +69 -0
- package/src/plugins/sidebar/ui/PageList.tsx +153 -0
- package/src/plugins/sidebar/ui/RadioMenu.tsx +201 -0
- package/src/plugins/sidebar/ui/Sidebar.tsx +95 -0
- package/src/plugins/sidebar/ui/SidebarHeader.tsx +87 -0
- package/src/plugins/sidebar/ui/TreeList.tsx +121 -0
- package/src/plugins/sidebar/ui/preview-model.ts +134 -0
- package/src/plugins/sidebar/ui/useModel.ts +25 -0
- package/src/shared/types.d.ts +193 -0
- package/src/widget/commands.js +214 -0
- package/src/widget/docks.js +127 -0
- package/src/widget/host.js +187 -0
- package/src/widget/index.js +14 -0
- package/src/widget/lib/disposables.js +44 -0
- package/src/widget/lib/dom.js +106 -0
- package/src/widget/lib/events.js +65 -0
- package/src/widget/lib/persisted-signal.js +40 -0
- package/src/widget/lib/storage.js +70 -0
- package/src/widget/live.js +86 -0
- package/src/widget/pages.js +65 -0
- package/src/widget/palette.css +162 -0
- package/src/widget/palette.js +259 -0
- package/src/widget/placement.js +204 -0
- package/src/widget/plugins.js +39 -0
- package/src/widget/rpc.js +32 -0
- package/src/widget/styles.js +31 -0
- package/src/widget/ui.js +50 -0
- package/src/widget/widget.css +193 -0
- package/server/files.mjs +0 -261
- package/server/index.mjs +0 -198
- package/server/inject.html +0 -88
- package/server/inject.mjs +0 -28
- package/server/watch.mjs +0 -104
- /package/{server → src/node}/state.mjs +0 -0
- /package/{server → src/node}/websocket.mjs +0 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
// Placement: four viewport corners, drag the pill to move between them, and the
|
|
2
|
+
// choice is remembered across loads.
|
|
3
|
+
import { persisted } from "./lib/storage.js"
|
|
4
|
+
|
|
5
|
+
const STORAGE_KEY = "docserve:dock-corner"
|
|
6
|
+
/** Travel before a press counts as a drag, so clicks still click. */
|
|
7
|
+
const DRAG_THRESHOLD = 4
|
|
8
|
+
/** Gap from the viewport edge while dragging; the corner rest position is set in CSS. */
|
|
9
|
+
const DRAG_MARGIN = 8
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {object} DragState
|
|
13
|
+
* @property {number} id
|
|
14
|
+
* @property {number} x
|
|
15
|
+
* @property {number} y
|
|
16
|
+
* @property {number} left
|
|
17
|
+
* @property {number} top
|
|
18
|
+
* @property {number} width
|
|
19
|
+
* @property {number} height
|
|
20
|
+
* @property {boolean} moved
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {object} options
|
|
25
|
+
* @param {HTMLElement} options.host Shadow host; carries `data-corner`.
|
|
26
|
+
* @param {HTMLElement} options.handle The dock pill, used as the drag surface.
|
|
27
|
+
* @returns {{ corner: () => string, destroy: () => void }}
|
|
28
|
+
*/
|
|
29
|
+
export function createPlacement({ host, handle }) {
|
|
30
|
+
const saved = persisted(STORAGE_KEY, "br")
|
|
31
|
+
host.dataset.corner = saved.value
|
|
32
|
+
|
|
33
|
+
/** @type {DragState | null} */
|
|
34
|
+
let drag = null
|
|
35
|
+
// A drag that ends over a button must not also activate it.
|
|
36
|
+
let swallowClick = false
|
|
37
|
+
/** @type {ReturnType<typeof setTimeout> | null} */
|
|
38
|
+
let settleTimer = null
|
|
39
|
+
|
|
40
|
+
handle.addEventListener("pointerdown", onDown)
|
|
41
|
+
host.addEventListener("click", onClick, true)
|
|
42
|
+
window.addEventListener("blur", cancel)
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
corner() {
|
|
46
|
+
return host.dataset.corner ?? "br"
|
|
47
|
+
},
|
|
48
|
+
destroy,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @param {PointerEvent} event
|
|
53
|
+
*/
|
|
54
|
+
function onDown(event) {
|
|
55
|
+
if (drag || !event.isPrimary || event.button !== 0) return
|
|
56
|
+
swallowClick = false
|
|
57
|
+
if (settleTimer) settle()
|
|
58
|
+
|
|
59
|
+
const rect = host.getBoundingClientRect()
|
|
60
|
+
drag = {
|
|
61
|
+
id: event.pointerId,
|
|
62
|
+
x: event.clientX,
|
|
63
|
+
y: event.clientY,
|
|
64
|
+
left: rect.left,
|
|
65
|
+
top: rect.top,
|
|
66
|
+
width: rect.width,
|
|
67
|
+
height: rect.height,
|
|
68
|
+
moved: false,
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Track on the window instead of capturing the pointer: an active pointer
|
|
72
|
+
// capture retargets the click to the capture element, which would swallow
|
|
73
|
+
// every button press.
|
|
74
|
+
window.addEventListener("pointermove", onMove)
|
|
75
|
+
window.addEventListener("pointerup", onUp)
|
|
76
|
+
window.addEventListener("pointercancel", cancel)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @param {PointerEvent} event
|
|
81
|
+
*/
|
|
82
|
+
function onMove(event) {
|
|
83
|
+
if (!drag || event.pointerId !== drag.id) return
|
|
84
|
+
|
|
85
|
+
const dx = event.clientX - drag.x
|
|
86
|
+
const dy = event.clientY - drag.y
|
|
87
|
+
if (!drag.moved) {
|
|
88
|
+
if (Math.hypot(dx, dy) < DRAG_THRESHOLD) return
|
|
89
|
+
drag.moved = true
|
|
90
|
+
host.toggleAttribute("data-dragging", true)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Follow the pointer in px; corners are re-applied on release.
|
|
94
|
+
const maxLeft = Math.max(DRAG_MARGIN, window.innerWidth - drag.width - DRAG_MARGIN)
|
|
95
|
+
const maxTop = Math.max(DRAG_MARGIN, window.innerHeight - drag.height - DRAG_MARGIN)
|
|
96
|
+
host.style.left = `${clamp(drag.left + dx, DRAG_MARGIN, maxLeft)}px`
|
|
97
|
+
host.style.top = `${clamp(drag.top + dy, DRAG_MARGIN, maxTop)}px`
|
|
98
|
+
host.style.right = "auto"
|
|
99
|
+
host.style.bottom = "auto"
|
|
100
|
+
event.preventDefault()
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @param {PointerEvent} event
|
|
105
|
+
*/
|
|
106
|
+
function onUp(event) {
|
|
107
|
+
if (!drag || event.pointerId !== drag.id) return
|
|
108
|
+
const moved = drag.moved
|
|
109
|
+
const from = host.getBoundingClientRect()
|
|
110
|
+
finish()
|
|
111
|
+
if (!moved) return
|
|
112
|
+
swallowClick = true
|
|
113
|
+
|
|
114
|
+
// Snap to the corner nearest the drop point.
|
|
115
|
+
const vertical = from.top + from.height / 2 < window.innerHeight / 2 ? "t" : "b"
|
|
116
|
+
const horizontal = from.left + from.width / 2 < window.innerWidth / 2 ? "l" : "r"
|
|
117
|
+
snap(`${vertical}${horizontal}`, from)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Glide from the drop point to the corner. The resting rules switch the free
|
|
122
|
+
* axis to `auto`, which CSS cannot interpolate, so both ends are measured in
|
|
123
|
+
* px here and the travel is animated explicitly.
|
|
124
|
+
* @param {string} corner
|
|
125
|
+
* @param {DOMRect} from
|
|
126
|
+
*/
|
|
127
|
+
function snap(corner, from) {
|
|
128
|
+
host.style.transition = "none"
|
|
129
|
+
host.dataset.corner = corner
|
|
130
|
+
saved.value = corner
|
|
131
|
+
clearInline()
|
|
132
|
+
const to = host.getBoundingClientRect()
|
|
133
|
+
|
|
134
|
+
host.style.right = "auto"
|
|
135
|
+
host.style.bottom = "auto"
|
|
136
|
+
host.style.left = `${from.left}px`
|
|
137
|
+
host.style.top = `${from.top}px`
|
|
138
|
+
void host.offsetWidth // commit the start, so the change below animates
|
|
139
|
+
|
|
140
|
+
host.style.transition = ""
|
|
141
|
+
host.style.left = `${to.left}px`
|
|
142
|
+
host.style.top = `${to.top}px`
|
|
143
|
+
host.addEventListener("transitionend", settle, { once: true })
|
|
144
|
+
settleTimer = setTimeout(settle, 250)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Hand positioning back to the corner rules once the glide is over.
|
|
148
|
+
function settle() {
|
|
149
|
+
if (settleTimer) clearTimeout(settleTimer)
|
|
150
|
+
settleTimer = null
|
|
151
|
+
host.removeEventListener("transitionend", settle)
|
|
152
|
+
if (drag) return
|
|
153
|
+
host.style.removeProperty("transition")
|
|
154
|
+
clearInline()
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function cancel() {
|
|
158
|
+
if (!drag) return
|
|
159
|
+
const moved = drag.moved
|
|
160
|
+
finish()
|
|
161
|
+
if (moved) clearInline()
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function finish() {
|
|
165
|
+
if (!drag) return
|
|
166
|
+
window.removeEventListener("pointermove", onMove)
|
|
167
|
+
window.removeEventListener("pointerup", onUp)
|
|
168
|
+
window.removeEventListener("pointercancel", cancel)
|
|
169
|
+
drag = null
|
|
170
|
+
host.toggleAttribute("data-dragging", false)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function clearInline() {
|
|
174
|
+
for (const property of ["left", "top", "right", "bottom"]) host.style.removeProperty(property)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* @param {MouseEvent} event
|
|
179
|
+
*/
|
|
180
|
+
function onClick(event) {
|
|
181
|
+
if (!swallowClick) return
|
|
182
|
+
swallowClick = false
|
|
183
|
+
event.stopPropagation()
|
|
184
|
+
event.preventDefault()
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function destroy() {
|
|
188
|
+
cancel()
|
|
189
|
+
settle()
|
|
190
|
+
handle.removeEventListener("pointerdown", onDown)
|
|
191
|
+
host.removeEventListener("click", onClick, true)
|
|
192
|
+
window.removeEventListener("blur", cancel)
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* @param {number} value
|
|
198
|
+
* @param {number} min
|
|
199
|
+
* @param {number} max
|
|
200
|
+
* @returns {number}
|
|
201
|
+
*/
|
|
202
|
+
function clamp(value, min, max) {
|
|
203
|
+
return Math.min(Math.max(value, min), max)
|
|
204
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Plugin registry: run `setup` once per id and keep its cleanup.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {() => DocserveContext} getContext Resolved when a plugin is set up,
|
|
5
|
+
* so the registry can exist before the context is fully assembled.
|
|
6
|
+
* @returns {{ use: (plugin: DocservePlugin) => DocserveContext, dispose: () => void }}
|
|
7
|
+
*/
|
|
8
|
+
export function createPlugins(getContext) {
|
|
9
|
+
/** @type {Map<string, () => void>} */
|
|
10
|
+
const cleanups = new Map()
|
|
11
|
+
|
|
12
|
+
return { use, dispose }
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {DocservePlugin} plugin
|
|
16
|
+
* @returns {DocserveContext}
|
|
17
|
+
*/
|
|
18
|
+
function use(plugin) {
|
|
19
|
+
const ctx = getContext()
|
|
20
|
+
if (!plugin || typeof plugin.id !== "string" || !plugin.id) throw new TypeError("use expects a plugin with an id")
|
|
21
|
+
if (cleanups.has(plugin.id)) return ctx
|
|
22
|
+
|
|
23
|
+
const cleanup = plugin.setup?.(ctx)
|
|
24
|
+
cleanups.set(plugin.id, typeof cleanup === "function" ? cleanup : () => {})
|
|
25
|
+
return ctx
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Run every cleanup in reverse registration order. */
|
|
29
|
+
function dispose() {
|
|
30
|
+
for (const cleanup of [...cleanups.values()].reverse()) {
|
|
31
|
+
try {
|
|
32
|
+
cleanup()
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error("[docserve] plugin cleanup failed", error)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
cleanups.clear()
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// In-page method bus. `docserve:` is reserved for core methods; plugins use
|
|
2
|
+
// `plugin:<id>:<method>`.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @returns {RpcContext}
|
|
6
|
+
*/
|
|
7
|
+
export function createRpc() {
|
|
8
|
+
/** @type {Map<string, (...args: any[]) => any>} */
|
|
9
|
+
const methods = new Map()
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
register(name, handler) {
|
|
13
|
+
if (typeof name !== "string" || !name) throw new TypeError("rpc.register expects a method name")
|
|
14
|
+
if (typeof handler !== "function") throw new TypeError(`rpc.register(${name}) expects a function`)
|
|
15
|
+
if (methods.has(name)) throw new Error(`rpc method already registered: ${name}`)
|
|
16
|
+
methods.set(name, handler)
|
|
17
|
+
return () => {
|
|
18
|
+
if (methods.get(name) === handler) methods.delete(name)
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
has(name) {
|
|
23
|
+
return methods.has(name)
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
async call(name, ...args) {
|
|
27
|
+
const handler = methods.get(name)
|
|
28
|
+
if (!handler) throw new Error(`unknown rpc method: ${name}`)
|
|
29
|
+
return handler(...args)
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Widget stylesheets: waiting for them to load, and re-fetching them on change.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {HTMLLinkElement} link
|
|
5
|
+
* @returns {Promise<void>}
|
|
6
|
+
*/
|
|
7
|
+
export function settled(link) {
|
|
8
|
+
if (link.sheet) return Promise.resolve()
|
|
9
|
+
return new Promise((resolve) => {
|
|
10
|
+
link.addEventListener("load", () => resolve(), { once: true })
|
|
11
|
+
link.addEventListener("error", () => resolve(), { once: true })
|
|
12
|
+
})
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Re-fetch every same-origin stylesheet, page and shadow root alike, so edits
|
|
17
|
+
* apply without a reload.
|
|
18
|
+
* @param {ParentNode[]} scopes
|
|
19
|
+
*/
|
|
20
|
+
export function reloadStyles(scopes) {
|
|
21
|
+
const stamp = String(Date.now())
|
|
22
|
+
for (const scope of scopes) {
|
|
23
|
+
for (const link of scope.querySelectorAll('link[rel~="stylesheet"]')) {
|
|
24
|
+
if (!(link instanceof HTMLLinkElement)) continue
|
|
25
|
+
const url = new URL(link.href, location.href)
|
|
26
|
+
if (url.origin !== location.origin) continue
|
|
27
|
+
url.searchParams.set("__docserve_rev", stamp)
|
|
28
|
+
link.href = url.href
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
package/src/widget/ui.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// UI helpers handed to plugins: mount points, stylesheets, announcements.
|
|
2
|
+
import { el } from "./lib/dom.js"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {object} options
|
|
6
|
+
* @param {ShadowRoot} options.root
|
|
7
|
+
* @param {HTMLElement} options.status Live region for `announce`.
|
|
8
|
+
* @returns {UiContext}
|
|
9
|
+
*/
|
|
10
|
+
export function createUi({ root, status }) {
|
|
11
|
+
/** @type {Set<string>} */
|
|
12
|
+
const added = new Set()
|
|
13
|
+
|
|
14
|
+
style("/__docserve/widget/widget.css")
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
mountPoint,
|
|
18
|
+
style,
|
|
19
|
+
announce,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Layout-neutral host in the shadow root for plugin UIs.
|
|
24
|
+
* @returns {HTMLElement}
|
|
25
|
+
*/
|
|
26
|
+
function mountPoint() {
|
|
27
|
+
const element = el("div", { "data-docserve-mount": "" })
|
|
28
|
+
element.style.display = "contents"
|
|
29
|
+
root.append(element)
|
|
30
|
+
return element
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Add a stylesheet inside the shadow root once.
|
|
35
|
+
* @param {string} href
|
|
36
|
+
*/
|
|
37
|
+
function style(href) {
|
|
38
|
+
if (added.has(href)) return
|
|
39
|
+
added.add(href)
|
|
40
|
+
|
|
41
|
+
root.append(el("link", { rel: "stylesheet", href }))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @param {string} message
|
|
46
|
+
*/
|
|
47
|
+
function announce(message) {
|
|
48
|
+
status.textContent = message
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--docserve-inset-t: calc(16px + env(safe-area-inset-top));
|
|
3
|
+
--docserve-inset-r: calc(16px + env(safe-area-inset-right));
|
|
4
|
+
--docserve-inset-b: calc(16px + env(safe-area-inset-bottom));
|
|
5
|
+
--docserve-inset-l: calc(16px + env(safe-area-inset-left));
|
|
6
|
+
--docserve-dock-bg: rgba(255, 255, 255, 0.92);
|
|
7
|
+
--docserve-dock-border: rgba(15, 23, 42, 0.14);
|
|
8
|
+
--docserve-dock-text: #334155;
|
|
9
|
+
--docserve-dock-muted: #64748b;
|
|
10
|
+
--docserve-dock-hover: rgba(15, 23, 42, 0.07);
|
|
11
|
+
--docserve-dock-accent: #4f46e5;
|
|
12
|
+
--docserve-dock-accent-soft: rgba(79, 70, 229, 0.12);
|
|
13
|
+
--docserve-panel-bg: #ffffff;
|
|
14
|
+
--docserve-panel-border: rgba(15, 23, 42, 0.14);
|
|
15
|
+
--docserve-panel-text: #334155;
|
|
16
|
+
--docserve-panel-muted: #64748b;
|
|
17
|
+
position: fixed;
|
|
18
|
+
top: auto;
|
|
19
|
+
left: auto;
|
|
20
|
+
right: var(--docserve-inset-r);
|
|
21
|
+
bottom: var(--docserve-inset-b);
|
|
22
|
+
z-index: 2147483647;
|
|
23
|
+
transition: left 0.18s ease, right 0.18s ease, top 0.18s ease, bottom 0.18s ease;
|
|
24
|
+
color-scheme: light dark;
|
|
25
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
|
|
26
|
+
margin: 0;
|
|
27
|
+
padding: 0;
|
|
28
|
+
line-height: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Four corners: `data-corner` is persisted and rewritten by dragging. Left
|
|
32
|
+
corners follow the sidebar so the pill never sits under an open panel. */
|
|
33
|
+
:host([data-corner="bl"]) { right: auto; left: calc(var(--docserve-inset-l) + var(--docserve-panel-left, 0px)); }
|
|
34
|
+
:host([data-corner="tr"]) { bottom: auto; top: var(--docserve-inset-t); }
|
|
35
|
+
:host([data-corner="tl"]) {
|
|
36
|
+
right: auto;
|
|
37
|
+
bottom: auto;
|
|
38
|
+
left: calc(var(--docserve-inset-l) + var(--docserve-panel-left, 0px));
|
|
39
|
+
top: var(--docserve-inset-t);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:host([data-dragging]) { cursor: grabbing; user-select: none; transition: none; }
|
|
43
|
+
|
|
44
|
+
@media (prefers-color-scheme: dark) {
|
|
45
|
+
:host {
|
|
46
|
+
--docserve-dock-bg: rgba(21, 26, 35, 0.92);
|
|
47
|
+
--docserve-dock-border: rgba(148, 163, 184, 0.24);
|
|
48
|
+
--docserve-dock-text: #e2e8f0;
|
|
49
|
+
--docserve-dock-muted: #94a3b8;
|
|
50
|
+
--docserve-dock-hover: rgba(148, 163, 184, 0.14);
|
|
51
|
+
--docserve-dock-accent: #a5b4fc;
|
|
52
|
+
--docserve-dock-accent-soft: rgba(165, 180, 252, 0.16);
|
|
53
|
+
--docserve-panel-bg: #151a23;
|
|
54
|
+
--docserve-panel-border: rgba(148, 163, 184, 0.2);
|
|
55
|
+
--docserve-panel-text: #e2e8f0;
|
|
56
|
+
--docserve-panel-muted: #94a3b8;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
html[data-docserve-widget] body {
|
|
61
|
+
transition: padding-left 0.18s ease;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
html[data-docserve-panel-left] body {
|
|
65
|
+
padding-left: var(--docserve-panel-left) !important;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
html[data-docserve-palette] {
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.docserve-dock,
|
|
73
|
+
.docserve-dock *,
|
|
74
|
+
.docserve-panel,
|
|
75
|
+
.docserve-panel * {
|
|
76
|
+
box-sizing: border-box;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.docserve-dock {
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
gap: 2px;
|
|
83
|
+
padding: 3px;
|
|
84
|
+
border: 1px solid var(--docserve-dock-border);
|
|
85
|
+
border-radius: 10px;
|
|
86
|
+
background: var(--docserve-dock-bg);
|
|
87
|
+
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
|
|
88
|
+
backdrop-filter: blur(12px);
|
|
89
|
+
cursor: grab;
|
|
90
|
+
/* let the pill be dragged by touch instead of scrolling the page */
|
|
91
|
+
touch-action: none;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:host([data-dragging]) .docserve-dock {
|
|
95
|
+
cursor: grabbing;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.docserve-dock__button {
|
|
99
|
+
display: grid;
|
|
100
|
+
place-items: center;
|
|
101
|
+
width: 30px;
|
|
102
|
+
height: 30px;
|
|
103
|
+
padding: 0;
|
|
104
|
+
border: 0;
|
|
105
|
+
border-radius: 7px;
|
|
106
|
+
background: transparent;
|
|
107
|
+
color: var(--docserve-dock-muted);
|
|
108
|
+
font: inherit;
|
|
109
|
+
line-height: 0;
|
|
110
|
+
text-decoration: none;
|
|
111
|
+
cursor: pointer;
|
|
112
|
+
appearance: none;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.docserve-dock__button:hover {
|
|
116
|
+
background: var(--docserve-dock-hover);
|
|
117
|
+
color: var(--docserve-dock-text);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.docserve-dock__button:focus-visible {
|
|
121
|
+
outline: 2px solid var(--docserve-dock-accent);
|
|
122
|
+
outline-offset: 2px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.docserve-dock__button[aria-pressed="true"] {
|
|
126
|
+
background: var(--docserve-dock-accent-soft);
|
|
127
|
+
color: var(--docserve-dock-accent);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.docserve-dock__button svg {
|
|
131
|
+
width: 16px;
|
|
132
|
+
height: 16px;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.docserve-dock__divider {
|
|
136
|
+
width: 1px;
|
|
137
|
+
height: 18px;
|
|
138
|
+
margin: 0 2px;
|
|
139
|
+
background: var(--docserve-dock-border);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.docserve-dock__status {
|
|
143
|
+
position: absolute;
|
|
144
|
+
width: 1px;
|
|
145
|
+
height: 1px;
|
|
146
|
+
overflow: hidden;
|
|
147
|
+
clip: rect(0 0 0 0);
|
|
148
|
+
white-space: nowrap;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.docserve-panel {
|
|
152
|
+
position: fixed;
|
|
153
|
+
top: 0;
|
|
154
|
+
bottom: 0;
|
|
155
|
+
z-index: 1;
|
|
156
|
+
flex-direction: column;
|
|
157
|
+
overflow: hidden;
|
|
158
|
+
background: var(--docserve-panel-bg);
|
|
159
|
+
color: var(--docserve-panel-text);
|
|
160
|
+
font-size: 14px;
|
|
161
|
+
line-height: 1.5;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.docserve-panel:not([data-open]) {
|
|
165
|
+
display: none;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.docserve-panel[data-open] {
|
|
169
|
+
display: flex;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.docserve-panel[data-side="left"] {
|
|
173
|
+
left: 0;
|
|
174
|
+
border-right: 1px solid var(--docserve-panel-border);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.docserve-panel[data-side="right"] {
|
|
178
|
+
right: 0;
|
|
179
|
+
border-left: 1px solid var(--docserve-panel-border);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@media (pointer: coarse) {
|
|
183
|
+
.docserve-dock__button {
|
|
184
|
+
width: 38px;
|
|
185
|
+
height: 38px;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@media print {
|
|
190
|
+
:host {
|
|
191
|
+
display: none;
|
|
192
|
+
}
|
|
193
|
+
}
|