@bigmistqke/workpad 0.0.0-stage → 0.18.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/LICENSE +21 -0
- package/README.md +781 -2
- package/bin/workpad.ts +1509 -0
- package/dist/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/taggedTemplateLiteral.js +5 -0
- package/dist/bin/workpad.js +1190 -0
- package/dist/client/runtime.js +1194 -0
- package/dist/define.js +27 -0
- package/dist/plugins/alert/README.md +18 -0
- package/dist/plugins/alert/index.js +40 -0
- package/dist/plugins/alert/public/style.css +40 -0
- package/dist/plugins/ansi/README.md +36 -0
- package/dist/plugins/ansi/index.js +63 -0
- package/dist/plugins/ansi/public/style.css +28 -0
- package/dist/plugins/badge/README.md +32 -0
- package/dist/plugins/badge/index.js +28 -0
- package/dist/plugins/badge/public/style.css +30 -0
- package/dist/plugins/chat/README.md +81 -0
- package/dist/plugins/chat/index.js +96 -0
- package/dist/plugins/chat/public/client.js +3 -0
- package/dist/plugins/chat/public/style.css +143 -0
- package/dist/plugins/claude/README.md +116 -0
- package/dist/plugins/claude/channel.js +130 -0
- package/dist/plugins/claude/doctor.js +316 -0
- package/dist/plugins/claude/index.js +199 -0
- package/dist/plugins/claude/session.js +68 -0
- package/dist/plugins/code/README.md +54 -0
- package/dist/plugins/code/diff.js +75 -0
- package/dist/plugins/code/index.js +105 -0
- package/dist/plugins/code/public/client.js +1 -0
- package/dist/plugins/code/public/style.css +99 -0
- package/dist/plugins/comments/README.md +30 -0
- package/dist/plugins/comments/index.js +39 -0
- package/dist/plugins/comments/public/client.js +24 -0
- package/dist/plugins/comments/public/style.css +224 -0
- package/dist/plugins/details/README.md +24 -0
- package/dist/plugins/details/index.js +28 -0
- package/dist/plugins/details/public/style.css +7 -0
- package/dist/plugins/draft/README.md +14 -0
- package/dist/plugins/draft/index.js +27 -0
- package/dist/plugins/draft/public/style.css +21 -0
- package/dist/plugins/forge/README.md +22 -0
- package/dist/plugins/forge/index.js +83 -0
- package/dist/plugins/form/README.md +126 -0
- package/dist/plugins/form/index.js +179 -0
- package/dist/plugins/form/public/style.css +172 -0
- package/dist/plugins/grid/README.md +45 -0
- package/dist/plugins/grid/index.js +35 -0
- package/dist/plugins/grid/public/style.css +98 -0
- package/dist/plugins/iframe/README.md +18 -0
- package/dist/plugins/iframe/index.js +49 -0
- package/dist/plugins/iframe/public/style.css +28 -0
- package/dist/plugins/index.js +44 -0
- package/dist/plugins/lightbox/README.md +24 -0
- package/dist/plugins/lightbox/index.js +20 -0
- package/dist/plugins/lightbox/public/client.js +4 -0
- package/dist/plugins/lightbox/public/style.css +66 -0
- package/dist/plugins/mermaid/README.md +21 -0
- package/dist/plugins/mermaid/index.js +42 -0
- package/dist/plugins/mermaid/public/style.css +21 -0
- package/dist/plugins/opencode/README.md +48 -0
- package/dist/plugins/opencode/channel.js +92 -0
- package/dist/plugins/opencode/index.js +64 -0
- package/dist/plugins/opencode/shim.js +150 -0
- package/dist/plugins/quiet/README.md +26 -0
- package/dist/plugins/quiet/index.js +23 -0
- package/dist/plugins/tabs/README.md +44 -0
- package/dist/plugins/tabs/index.js +75 -0
- package/dist/plugins/tabs/public/client.js +1 -0
- package/dist/plugins/tabs/public/style.css +98 -0
- package/dist/plugins/terminal/README.md +63 -0
- package/dist/plugins/terminal/host.js +338 -0
- package/dist/plugins/terminal/index.js +170 -0
- package/dist/plugins/terminal/modes.js +32 -0
- package/dist/plugins/terminal/public/client.js +41 -0
- package/dist/plugins/terminal/public/style.css +511 -0
- package/dist/plugins/terminal/server.js +256 -0
- package/dist/plugins/terminal/sizes.js +58 -0
- package/dist/plugins/timeline/README.md +48 -0
- package/dist/plugins/timeline/index.js +83 -0
- package/dist/plugins/timeline/public/style.css +138 -0
- package/dist/plugins/toc/README.md +40 -0
- package/dist/plugins/toc/index.js +29 -0
- package/dist/plugins/toc/public/client.js +1 -0
- package/dist/plugins/toc/public/style.css +117 -0
- package/dist/plugins/window/README.md +51 -0
- package/dist/plugins/window/index.js +91 -0
- package/dist/solid/index.js +41 -0
- package/dist/src/agents.js +81 -0
- package/dist/src/anchors.js +52 -0
- package/dist/src/api.js +282 -0
- package/dist/src/archive.js +49 -0
- package/dist/src/auth.js +67 -0
- package/dist/src/build.js +159 -0
- package/dist/src/client/page/base.css +1762 -0
- package/dist/src/client/page/main.js +2098 -0
- package/dist/src/config.js +76 -0
- package/dist/src/document.js +93 -0
- package/dist/src/entries.js +264 -0
- package/dist/src/events.js +322 -0
- package/dist/src/files.js +47 -0
- package/dist/src/formstate.js +65 -0
- package/dist/src/help.js +211 -0
- package/dist/src/html.js +34 -0
- package/dist/src/hub.js +341 -0
- package/dist/src/icons.js +6 -0
- package/dist/src/listen.js +132 -0
- package/dist/src/listeners.js +64 -0
- package/dist/src/load.js +81 -0
- package/dist/src/loader.js +179 -0
- package/dist/src/migrate.js +314 -0
- package/dist/src/package.js +52 -0
- package/dist/src/pages/blocks.js +67 -0
- package/dist/src/pages/board.js +59 -0
- package/dist/src/pages/index.js +27 -0
- package/dist/src/pages/markdown.js +863 -0
- package/dist/src/pages/render.js +665 -0
- package/dist/src/pages/window.js +29 -0
- package/dist/src/plugins.js +283 -0
- package/dist/src/public.js +24 -0
- package/dist/src/rename.js +130 -0
- package/dist/src/running.js +146 -0
- package/dist/src/serve.js +188 -0
- package/dist/src/server.js +1105 -0
- package/dist/src/site.js +179 -0
- package/dist/src/state.js +155 -0
- package/dist/src/status.js +323 -0
- package/dist/src/thread.js +68 -0
- package/dist/src/watchdog.js +38 -0
- package/dist/src/ws.js +128 -0
- package/package.json +154 -4
- package/plugins/README.md +304 -0
- package/plugins/alert/README.md +18 -0
- package/plugins/alert/index.ts +50 -0
- package/plugins/alert/public/style.css +40 -0
- package/plugins/ansi/README.md +36 -0
- package/plugins/ansi/index.ts +95 -0
- package/plugins/ansi/public/style.css +28 -0
- package/plugins/badge/README.md +32 -0
- package/plugins/badge/index.ts +36 -0
- package/plugins/badge/public/style.css +30 -0
- package/plugins/chat/README.md +81 -0
- package/plugins/chat/autosize.ts +139 -0
- package/plugins/chat/client.tsx +187 -0
- package/plugins/chat/index.ts +146 -0
- package/plugins/chat/public/style.css +143 -0
- package/plugins/claude/README.md +116 -0
- package/plugins/claude/channel.ts +136 -0
- package/plugins/claude/doctor.ts +274 -0
- package/plugins/claude/index.ts +248 -0
- package/plugins/claude/session.ts +70 -0
- package/plugins/code/README.md +54 -0
- package/plugins/code/client.ts +73 -0
- package/plugins/code/diff.ts +96 -0
- package/plugins/code/index.ts +136 -0
- package/plugins/code/public/style.css +99 -0
- package/plugins/comments/README.md +30 -0
- package/plugins/comments/client.ts +723 -0
- package/plugins/comments/index.ts +48 -0
- package/plugins/comments/public/style.css +224 -0
- package/plugins/details/README.md +24 -0
- package/plugins/details/index.ts +30 -0
- package/plugins/details/public/style.css +7 -0
- package/plugins/draft/README.md +14 -0
- package/plugins/draft/index.ts +23 -0
- package/plugins/draft/public/style.css +21 -0
- package/plugins/forge/README.md +22 -0
- package/plugins/forge/index.ts +84 -0
- package/plugins/form/README.md +126 -0
- package/plugins/form/index.ts +199 -0
- package/plugins/form/public/style.css +172 -0
- package/plugins/grid/README.md +45 -0
- package/plugins/grid/index.ts +41 -0
- package/plugins/grid/public/style.css +98 -0
- package/plugins/iframe/README.md +18 -0
- package/plugins/iframe/index.ts +53 -0
- package/plugins/iframe/public/style.css +28 -0
- package/plugins/index.ts +49 -0
- package/plugins/lightbox/README.md +24 -0
- package/plugins/lightbox/client.ts +109 -0
- package/plugins/lightbox/index.ts +25 -0
- package/plugins/lightbox/public/style.css +66 -0
- package/plugins/mermaid/README.md +21 -0
- package/plugins/mermaid/index.ts +46 -0
- package/plugins/mermaid/public/style.css +21 -0
- package/plugins/opencode/README.md +48 -0
- package/plugins/opencode/channel.ts +112 -0
- package/plugins/opencode/index.ts +91 -0
- package/plugins/opencode/shim.ts +166 -0
- package/plugins/quiet/README.md +26 -0
- package/plugins/quiet/index.ts +28 -0
- package/plugins/tabs/README.md +44 -0
- package/plugins/tabs/client.ts +96 -0
- package/plugins/tabs/index.ts +103 -0
- package/plugins/tabs/public/style.css +98 -0
- package/plugins/terminal/README.md +63 -0
- package/plugins/terminal/client.ts +391 -0
- package/plugins/terminal/host.ts +434 -0
- package/plugins/terminal/index.ts +199 -0
- package/plugins/terminal/modes.ts +30 -0
- package/plugins/terminal/public/style.css +225 -0
- package/plugins/terminal/server.ts +266 -0
- package/plugins/terminal/sizes.ts +72 -0
- package/plugins/timeline/README.md +48 -0
- package/plugins/timeline/index.ts +82 -0
- package/plugins/timeline/public/style.css +138 -0
- package/plugins/toc/README.md +40 -0
- package/plugins/toc/client.ts +236 -0
- package/plugins/toc/index.ts +55 -0
- package/plugins/toc/public/style.css +117 -0
- package/plugins/window/README.md +51 -0
- package/plugins/window/index.ts +92 -0
- package/skills/workpad/SKILL.md +588 -0
- package/solid/index.tsx +80 -0
- package/src/agents.ts +133 -0
- package/src/anchors.ts +85 -0
- package/src/api.ts +444 -0
- package/src/archive.ts +75 -0
- package/src/auth.ts +99 -0
- package/src/build.ts +213 -0
- package/src/client/base.ts +19 -0
- package/src/client/forms.ts +420 -0
- package/src/client/markdown.ts +147 -0
- package/src/client/page/base.css +1762 -0
- package/src/client/page/board.ts +137 -0
- package/src/client/page/elsewhere.ts +153 -0
- package/src/client/page/fresh.ts +343 -0
- package/src/client/page/heading-link.ts +32 -0
- package/src/client/page/live.ts +134 -0
- package/src/client/page/main.ts +398 -0
- package/src/client/page/orphans.ts +64 -0
- package/src/client/page/place.ts +260 -0
- package/src/client/page/sort.ts +49 -0
- package/src/client/page/sticky.ts +58 -0
- package/src/client/page/theme.ts +36 -0
- package/src/client/page/view.ts +9 -0
- package/src/client/page/waiting.ts +278 -0
- package/src/client/page/window.ts +40 -0
- package/src/client/reactive.ts +19 -0
- package/src/client/read.ts +111 -0
- package/src/client/runtime.ts +499 -0
- package/src/client/scroll.ts +90 -0
- package/src/client/toast.ts +99 -0
- package/src/config.ts +111 -0
- package/src/define.ts +997 -0
- package/src/document.ts +191 -0
- package/src/entries.ts +352 -0
- package/src/events.ts +463 -0
- package/src/files.ts +74 -0
- package/src/formstate.ts +72 -0
- package/src/help.ts +238 -0
- package/src/html.ts +44 -0
- package/src/hub.ts +426 -0
- package/src/icons.ts +18 -0
- package/src/listen.ts +171 -0
- package/src/listeners.ts +89 -0
- package/src/load.ts +113 -0
- package/src/loader.ts +227 -0
- package/src/migrate.ts +352 -0
- package/src/package.ts +62 -0
- package/src/pages/blocks.ts +106 -0
- package/src/pages/board.ts +89 -0
- package/src/pages/index.ts +79 -0
- package/src/pages/markdown.ts +976 -0
- package/src/pages/render.ts +748 -0
- package/src/pages/window.ts +69 -0
- package/src/plugins.ts +319 -0
- package/src/public.ts +39 -0
- package/src/rename.ts +147 -0
- package/src/running.ts +171 -0
- package/src/serve.ts +221 -0
- package/src/server.ts +1385 -0
- package/src/site.ts +170 -0
- package/src/state.ts +327 -0
- package/src/status.ts +466 -0
- package/src/thread.ts +98 -0
- package/src/watchdog.ts +53 -0
- package/src/ws.ts +155 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import { definePlugin, type Plugin } from '@bigmistqke/workpad'
|
|
3
|
+
// Syntax highlighting for code blocks, on the server with Shiki: the page gets plain HTML, no script.
|
|
4
|
+
//
|
|
5
|
+
// Built in; for options, replace it in the config: plugins: [code({ themes: { light, dark } })].
|
|
6
|
+
//
|
|
7
|
+
// Its block takes `fence: 'any'`, so it renders every fence no other block claims by name, and the
|
|
8
|
+
// code view of repository files.
|
|
9
|
+
//
|
|
10
|
+
// Every token carries both a light and a dark colour as CSS variables (--shiki-light,
|
|
11
|
+
// --shiki-dark); style.css picks one per theme, so highlighting follows the theme toggle without
|
|
12
|
+
// re-rendering. The block's background stays the page's own code background.
|
|
13
|
+
//
|
|
14
|
+
// A `diff` fence is shown for reading (see diff.ts): its header lines go, except the file's name;
|
|
15
|
+
// a hunk's start is a `⋯` where lines are skipped; each line says what it is (`data-diff`: add, del,
|
|
16
|
+
// context, hunk, file), its number (`data-n`, drawn in a gutter by style.css, so it is never part
|
|
17
|
+
// of the text) and where it is (`data-wp-at="file:line"`), which comments on the line record.
|
|
18
|
+
// shiki loads the first time a page has code, not with the plugin: the command line loads the
|
|
19
|
+
// built-in plugins too, for their declarations
|
|
20
|
+
import type * as Shiki from 'shiki'
|
|
21
|
+
import type { BundledTheme, Highlighter } from 'shiki'
|
|
22
|
+
import type { FenceContext } from '@bigmistqke/workpad'
|
|
23
|
+
import { diffLines } from './diff.ts'
|
|
24
|
+
import { builtinPublic } from '../../src/package.ts'
|
|
25
|
+
|
|
26
|
+
export interface Options {
|
|
27
|
+
/** Shiki theme names for each page theme (default: GitHub light and dark) */
|
|
28
|
+
themes?: { light: BundledTheme; dark: BundledTheme }
|
|
29
|
+
/** per theme, colours to swap: { 'github-light': { '#e36209': '#0f766e' } } */
|
|
30
|
+
colorReplacements?: Record<string, Record<string, string>>
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const DEFAULT_THEMES = { light: 'github-light', dark: 'github-dark' } as const
|
|
34
|
+
|
|
35
|
+
// the default palette has no orange or brown: the GitHub themes' oranges become a teal
|
|
36
|
+
const DEFAULT_REPLACEMENTS = {
|
|
37
|
+
'github-light': { '#e36209': '#0f766e', '#b08800': '#0f766e' },
|
|
38
|
+
'github-dark': { '#ffab70': '#5eead4', '#c24e00': '#2dd4bf' },
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface Shared {
|
|
42
|
+
highlighter: Promise<Highlighter>
|
|
43
|
+
/** the languages loaded into it */
|
|
44
|
+
loaded: Set<string>
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* One highlighter per set of themes for the whole process. The server imports this module afresh
|
|
49
|
+
* each time the config changes, so what is kept here must outlive the module: a highlighter holds
|
|
50
|
+
* WebAssembly memory that is never freed, and one per reload ran out of it after a few days.
|
|
51
|
+
*/
|
|
52
|
+
function shared(shiki: typeof Shiki, themes: BundledTheme[]): Shared {
|
|
53
|
+
const all: Map<string, Shared> = ((globalThis as any)[Symbol.for('workpad.code.highlighters')] ??= new Map())
|
|
54
|
+
const key = themes.join('\0')
|
|
55
|
+
let one = all.get(key)
|
|
56
|
+
if (!one) all.set(key, (one = { highlighter: shiki.createHighlighter({ themes, langs: [] }), loaded: new Set() }))
|
|
57
|
+
return one
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export default function code(options: Options = {}): Plugin {
|
|
61
|
+
const themes = options.themes ?? DEFAULT_THEMES
|
|
62
|
+
const colorReplacements = options.colorReplacements ?? (options.themes ? {} : DEFAULT_REPLACEMENTS)
|
|
63
|
+
// loaded the first time a page has code, not with the plugin: the command line loads plugins too
|
|
64
|
+
let shiki: typeof Shiki | undefined
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Highlight `code` as `lang`; an unknown or missing language renders as plain text. A long line
|
|
68
|
+
* scrolls the block sideways; with `wrap` it wraps at the block's edge.
|
|
69
|
+
*/
|
|
70
|
+
async function highlight(code: string, lang: string | null, wrap = false) {
|
|
71
|
+
shiki ??= await import('shiki')
|
|
72
|
+
const { highlighter, loaded } = shared(shiki, Object.values(themes))
|
|
73
|
+
const h = await highlighter
|
|
74
|
+
let language = String(lang ?? '').toLowerCase()
|
|
75
|
+
if (language in shiki.bundledLanguages) {
|
|
76
|
+
if (!loaded.has(language)) {
|
|
77
|
+
await h.loadLanguage(language as keyof typeof shiki.bundledLanguages)
|
|
78
|
+
loaded.add(language)
|
|
79
|
+
}
|
|
80
|
+
} else language = 'text'
|
|
81
|
+
const diff = language === 'diff' ? diffLines(code) : null
|
|
82
|
+
const transformers: Shiki.ShikiTransformer[] = []
|
|
83
|
+
// a fence that says {wrap}: its long lines wrap (style.css)
|
|
84
|
+
if (wrap)
|
|
85
|
+
transformers.push({
|
|
86
|
+
pre(node) {
|
|
87
|
+
node.properties['data-wrap'] = ''
|
|
88
|
+
},
|
|
89
|
+
})
|
|
90
|
+
if (diff)
|
|
91
|
+
transformers.push({
|
|
92
|
+
line(node, n) {
|
|
93
|
+
const info = diff[n - 1]
|
|
94
|
+
if (!info) return
|
|
95
|
+
node.properties['data-diff'] = info.kind
|
|
96
|
+
if (info.n != null) node.properties['data-n'] = String(info.n)
|
|
97
|
+
if (info.at) node.properties['data-wp-at'] = info.at
|
|
98
|
+
// a file's headers read as its name; a hunk's header as nothing but the gutter's `⋯`
|
|
99
|
+
if (info.label != null) node.children = [{ type: 'text', value: info.label }]
|
|
100
|
+
},
|
|
101
|
+
// the headers nobody reads go, with the line break after each
|
|
102
|
+
code(node) {
|
|
103
|
+
node.children = node.children.filter((child, i, all) => {
|
|
104
|
+
const isMeta = (c: typeof child | undefined) =>
|
|
105
|
+
c?.type === 'element' && c.properties['data-diff'] === 'meta'
|
|
106
|
+
return !isMeta(child) && !(child.type === 'text' && isMeta(all[i - 1]))
|
|
107
|
+
})
|
|
108
|
+
},
|
|
109
|
+
})
|
|
110
|
+
return h.codeToHtml(code, {
|
|
111
|
+
lang: language,
|
|
112
|
+
themes,
|
|
113
|
+
defaultColor: false,
|
|
114
|
+
colorReplacements,
|
|
115
|
+
transformers,
|
|
116
|
+
})
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return definePlugin({
|
|
120
|
+
name: 'code',
|
|
121
|
+
public: builtinPublic('code'),
|
|
122
|
+
// measures whether each code block overflows, so its scrollbar is chosen in advance (client.ts:
|
|
123
|
+
// a WebKit layout bug)
|
|
124
|
+
setup: () => ({ client: 'client.js' }),
|
|
125
|
+
blocks: {
|
|
126
|
+
code: {
|
|
127
|
+
menu: { group: 'show', summary: 'code, highlighted: any fence no other block claims; diff for a change' },
|
|
128
|
+
// every code fence no other block claims by name, and the code view of repository files
|
|
129
|
+
fence: 'any',
|
|
130
|
+
html: ctx => highlight((ctx as FenceContext).text, (ctx as FenceContext).lang, 'wrap' in ctx.attrs),
|
|
131
|
+
style: 'style.css',
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
docs: () => fs.readFileSync(new URL('./README.md', import.meta.url), 'utf8'),
|
|
135
|
+
})
|
|
136
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/* Code blocks highlighted by Shiki: tokens carry both colours; pick the one for the current theme.
|
|
2
|
+
The block keeps the page's own code background. */
|
|
3
|
+
pre.shiki {
|
|
4
|
+
background: var(--code-bg);
|
|
5
|
+
}
|
|
6
|
+
.shiki span {
|
|
7
|
+
color: var(--shiki-light);
|
|
8
|
+
font-style: var(--shiki-light-font-style);
|
|
9
|
+
font-weight: var(--shiki-light-font-weight);
|
|
10
|
+
text-decoration: var(--shiki-light-text-decoration);
|
|
11
|
+
}
|
|
12
|
+
@media (prefers-color-scheme: dark) {
|
|
13
|
+
:root:not([data-theme='light']) .shiki span {
|
|
14
|
+
color: var(--shiki-dark);
|
|
15
|
+
font-style: var(--shiki-dark-font-style);
|
|
16
|
+
font-weight: var(--shiki-dark-font-weight);
|
|
17
|
+
text-decoration: var(--shiki-dark-text-decoration);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
:root[data-theme='dark'] .shiki span {
|
|
21
|
+
color: var(--shiki-dark);
|
|
22
|
+
font-style: var(--shiki-dark-font-style);
|
|
23
|
+
font-weight: var(--shiki-dark-font-weight);
|
|
24
|
+
text-decoration: var(--shiki-dark-text-decoration);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* a long line scrolls the block sideways, wherever it is; a fence that says {wrap} wraps it. The
|
|
28
|
+
code inside the block scrolls, not the block: WebKit sizes a block that scrolls sideways without
|
|
29
|
+
its scrollbar, so the bar ate into its height (a vertical scrollbar came with it) */
|
|
30
|
+
pre.shiki {
|
|
31
|
+
white-space: pre;
|
|
32
|
+
overflow-wrap: normal;
|
|
33
|
+
overflow: visible;
|
|
34
|
+
}
|
|
35
|
+
pre.shiki > code {
|
|
36
|
+
display: block;
|
|
37
|
+
overflow-x: auto;
|
|
38
|
+
overflow-y: hidden;
|
|
39
|
+
}
|
|
40
|
+
/* the scrollbar chosen in advance, from measured overflow (client.ts): WebKit lays out an `auto`
|
|
41
|
+
scrollbar under a flex or grid ancestor after the ancestors, which keep the height they had
|
|
42
|
+
without it (https://github.com/block/buzz-app/pull/1677,
|
|
43
|
+
https://bugs.webkit.org/show_bug.cgi?id=51148) */
|
|
44
|
+
pre.shiki > code[data-overflow='true'] {
|
|
45
|
+
overflow-x: scroll;
|
|
46
|
+
}
|
|
47
|
+
pre.shiki > code[data-overflow='false'] {
|
|
48
|
+
overflow-x: hidden;
|
|
49
|
+
}
|
|
50
|
+
pre.shiki[data-wrap] {
|
|
51
|
+
white-space: pre-wrap;
|
|
52
|
+
overflow-wrap: anywhere;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* a diff: one row per line, as wide as the longest (a grid leaves out the line breaks between them,
|
|
56
|
+
which stay in the text), tinted by what it is, with its number in a gutter */
|
|
57
|
+
.shiki code:has(> .line[data-diff]) {
|
|
58
|
+
display: grid;
|
|
59
|
+
grid-template-columns: minmax(max-content, 1fr);
|
|
60
|
+
}
|
|
61
|
+
.shiki .line[data-diff='add'] {
|
|
62
|
+
background: color-mix(in srgb, #16a34a var(--tint-soft), transparent);
|
|
63
|
+
}
|
|
64
|
+
.shiki .line[data-diff='del'] {
|
|
65
|
+
background: color-mix(in srgb, #dc2626 var(--tint-soft), transparent);
|
|
66
|
+
}
|
|
67
|
+
.shiki .line[data-diff]::before {
|
|
68
|
+
content: attr(data-n);
|
|
69
|
+
display: inline-block;
|
|
70
|
+
width: 4ch;
|
|
71
|
+
margin-right: 1.5ch;
|
|
72
|
+
text-align: right;
|
|
73
|
+
color: var(--muted, #696e76);
|
|
74
|
+
opacity: 0.7;
|
|
75
|
+
user-select: none;
|
|
76
|
+
}
|
|
77
|
+
:root .shiki .line[data-diff='hunk'] {
|
|
78
|
+
color: var(--muted, #696e76);
|
|
79
|
+
line-height: 1.2;
|
|
80
|
+
margin: var(--space-2xs) 0;
|
|
81
|
+
}
|
|
82
|
+
.shiki .line[data-diff='hunk']::before {
|
|
83
|
+
content: '⋯';
|
|
84
|
+
text-align: center;
|
|
85
|
+
}
|
|
86
|
+
.shiki .line[data-diff='file'] {
|
|
87
|
+
font-weight: var(--weight-strong);
|
|
88
|
+
margin-bottom: var(--space-md);
|
|
89
|
+
}
|
|
90
|
+
.shiki .line[data-diff='file']::before {
|
|
91
|
+
content: none;
|
|
92
|
+
}
|
|
93
|
+
.shiki .line[data-diff='file'] + .line[data-diff='hunk'] {
|
|
94
|
+
margin-top: 0;
|
|
95
|
+
}
|
|
96
|
+
/* a diff that wraps: its rows fill the block, and a long one wraps inside its row */
|
|
97
|
+
pre.shiki[data-wrap] code:has(> .line[data-diff]) {
|
|
98
|
+
grid-template-columns: minmax(0, 1fr);
|
|
99
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
## Comments
|
|
2
|
+
|
|
3
|
+
The reader can select text on any page and comment on it, or comment on
|
|
4
|
+
whole lines of a code block (a "+" beside each line; dragging it takes
|
|
5
|
+
several). Each comment comes to you as an event on the page, like a form
|
|
6
|
+
answer:
|
|
7
|
+
|
|
8
|
+
```json
|
|
9
|
+
{"id":"…","page":"plan","type":"comments:new","data":{"quote":"the selected text","before":"…","after":"…","block":3,"text":"their comment"}}
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
On lines that say where they are from, `data.at` says it too: in a
|
|
13
|
+
`diff` fence, `"src/a.ts:12"` (a line of the new file), `"src/a.ts (old):9"`
|
|
14
|
+
(a removed line), or `"src/a.ts:12 – src/a.ts:15"` for several. Any block
|
|
15
|
+
can say where its parts are from with a `data-wp-at` attribute.
|
|
16
|
+
|
|
17
|
+
Replies to a thread come as `comments:reply` (`data.replyTo` is the comment's
|
|
18
|
+
id), and `comments:resolve` when the reader closed it. A thread stays on the
|
|
19
|
+
page until the reader closes it. Answer a comment the way it asks:
|
|
20
|
+
|
|
21
|
+
- **It asks for a change:** edit the page. The thread stays, so say what you
|
|
22
|
+
changed in a reply if it is not obvious.
|
|
23
|
+
- **It asks a question:** reply in the thread:
|
|
24
|
+
`workpad append --page <file> --type comments:reply --data '{"replyTo":"<comment id>","text":"…"}'`
|
|
25
|
+
|
|
26
|
+
Your replies show as the agent's, and your own `listen` skips what you
|
|
27
|
+
append, so you don't hear your own replies. Comments and replies are
|
|
28
|
+
markdown: code in backticks or fences, lists, links, `#12`, a
|
|
29
|
+
```mermaid diagram; raw HTML and directives (`:::…`, `:button`) show as
|
|
30
|
+
written.
|