@inkbar/theme 0.0.0-stage → 0.2.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.
Files changed (4) hide show
  1. package/LICENSE +68 -0
  2. package/README.md +88 -2
  3. package/package.json +33 -3
  4. package/theme.css +724 -0
package/LICENSE ADDED
@@ -0,0 +1,68 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Redactr Platforms Ltd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ Third-party notices
26
+
27
+ theme.css draws the zoom select's chevron with the ChevronDown icon from Lucide
28
+ (https://lucide.dev), under the ISC licence:
29
+
30
+ ISC License
31
+
32
+ Copyright (c) 2026 Lucide Icons and Contributors
33
+
34
+ Permission to use, copy, modify, and/or distribute this software for any
35
+ purpose with or without fee is hereby granted, provided that the above
36
+ copyright notice and this permission notice appear in all copies.
37
+
38
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
39
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
40
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
41
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
42
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
43
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
44
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
45
+
46
+ ChevronDown is derived from the Feather project, under the MIT licence:
47
+
48
+ The MIT License (MIT) (for the icons listed above)
49
+
50
+ Copyright (c) 2013-present Cole Bemis
51
+
52
+ Permission is hereby granted, free of charge, to any person obtaining a copy
53
+ of this software and associated documentation files (the "Software"), to deal
54
+ in the Software without restriction, including without limitation the rights
55
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
56
+ copies of the Software, and to permit persons to whom the Software is
57
+ furnished to do so, subject to the following conditions:
58
+
59
+ The above copyright notice and this permission notice shall be included in all
60
+ copies or substantial portions of the Software.
61
+
62
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
63
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
64
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
65
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
66
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
67
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
68
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,89 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/inkbar/inkbar/main/.github/assets/inkbar-mark-on-dark.svg">
4
+ <img src="https://raw.githubusercontent.com/inkbar/inkbar/main/.github/assets/inkbar-mark-on-light.svg" alt="Inkbar" width="72" height="72">
5
+ </picture>
6
+ </p>
2
7
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
8
+ <h1 align="center">@inkbar/theme</h1>
9
+
10
+ <p align="center">
11
+ The default look for Inkbar: one stylesheet, no JavaScript.
12
+ </p>
13
+
14
+ <p align="center">
15
+ <a href="https://inkbar.dev">Website</a> ·
16
+ <a href="https://inkbar.dev/docs/">Docs</a> ·
17
+ <a href="https://sandbox.inkbar.dev">Sandbox</a> ·
18
+ <a href="https://github.com/inkbar/inkbar">GitHub</a>
19
+ </p>
20
+
21
+ ---
22
+
23
+ `@inkbar/theme` styles the viewer, toolbar controls, note threads and suggestion cards from `@inkbar/vue`, `@inkbar/react`, `@inkbar/svelte` and `createViewer` in `@inkbar/core`. Import it and ship, or override any part of it with your own CSS. If your app already defines shadcn tokens, the theme picks up your colours and radius.
24
+
25
+ ## Install
26
+
27
+ ```sh
28
+ pnpm add @inkbar/theme
29
+ ```
30
+
31
+ Import the stylesheet once in your app:
32
+
33
+ ```ts
34
+ import '@inkbar/theme/theme.css'
35
+ ```
36
+
37
+ Every rule sits in `@layer inkbar` and inside `:where()`, so each selector has zero specificity. Your unlayered CSS overrides it without `!important`.
38
+
39
+ ## Layer order
40
+
41
+ Cascade layers win by order, whatever the specificity. The browser orders layers by first appearance, so if your stylesheet declares its own layers before this file loads, `inkbar` comes later and beats them. Declare `inkbar` first, at the top of your main stylesheet:
42
+
43
+ ```css
44
+ @layer inkbar, utilities;
45
+ ```
46
+
47
+ Put `inkbar` ahead of your own layer names, and your utility classes override the theme.
48
+
49
+ ## Tokens
50
+
51
+ The stylesheet is compatible with shadcn token names. It reads `--background`, `--foreground`, `--muted`, `--muted-foreground`, `--border`, `--primary`, `--primary-foreground`, `--ring` and `--radius` when your page defines them, and uses its own values when it does not. Dark values apply under `prefers-color-scheme: dark` or inside a `.dark` ancestor. Add `.light` to the root or an ancestor to keep the light values, including inside a `.dark` ancestor.
52
+
53
+ Colour tokens must hold complete CSS colour values. Tokens written as bare HSL channels (`--muted: 210 40% 96%`) do not work. Write the full colour instead:
54
+
55
+ ```css
56
+ --muted: hsl(210 40% 96%);
57
+ ```
58
+
59
+ ## Annotation colours
60
+
61
+ Set these variables on `[data-ink-root]` to change the default colour for new annotations:
62
+
63
+ | Variable | Used for |
64
+ | -------------------------------------------------------------------------- | ----------------------------------- |
65
+ | `--ink-highlight`, `--ink-underline`, `--ink-strikeout`, `--ink-squiggly` | Text markup |
66
+ | `--ink-note`, `--ink-free-text` | Notes and text boxes |
67
+ | `--ink-shape`, `--ink-ink` | Shapes and freehand drawing |
68
+ | `--ink-redact`, `--ink-redact-fill` | Redaction outline and fill |
69
+ | `--ink-suggestion-low`, `--ink-suggestion-medium`, `--ink-suggestion-high` | Suggested redactions, by confidence |
70
+
71
+ Inkbar reads a colour when you create the annotation and stores it on the annotation, because the colour goes into the PDF. Changing a variable later affects new annotations only.
72
+
73
+ ## Layout
74
+
75
+ The root and viewport fill their parent as a column, and the scroll area takes the remaining height. Give the parent a height and the document scrolls inside it.
76
+
77
+ The theme gives a toolbar a background and padding and styles the controls in it. You decide where the toolbar sits, how to group its controls and what separates it from the document. Set `--ink-control-size` on a toolbar to change the height of its buttons, fields and zoom select (default `2.25rem`), and `--ink-icon-size` to change the size of their icons (default `1.125rem`).
78
+
79
+ ```css
80
+ .my-page-bar {
81
+ --ink-control-size: 2rem;
82
+ --ink-icon-size: 1rem;
83
+ border-top: 1px solid var(--border);
84
+ }
85
+ ```
86
+
87
+ ## Licence
88
+
89
+ [MIT](https://github.com/inkbar/inkbar/blob/main/LICENSE). From the team behind [Redactr](https://redactr.io).
package/package.json CHANGED
@@ -1,6 +1,36 @@
1
1
  {
2
2
  "name": "@inkbar/theme",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "description": "Default stylesheet for Inkbar. Zero specificity, so your CSS wins.",
5
+ "license": "MIT",
6
+ "homepage": "https://inkbar.dev",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/inkbar/inkbar.git",
10
+ "directory": "packages/theme"
11
+ },
12
+ "bugs": "https://github.com/inkbar/inkbar/issues",
13
+ "type": "module",
14
+ "sideEffects": [
15
+ "*.css"
16
+ ],
17
+ "files": [
18
+ "theme.css",
19
+ "README.md"
20
+ ],
21
+ "exports": {
22
+ "./theme.css": "./theme.css",
23
+ "./package.json": "./package.json"
24
+ },
25
+ "devDependencies": {
26
+ "postcss": "^8.5.0",
27
+ "postcss-selector-parser": "^7.1.0",
28
+ "vitest": "^5.0.4"
29
+ },
30
+ "scripts": {
31
+ "build": "echo skip",
32
+ "typecheck": "tsc --noEmit -p tsconfig.json",
33
+ "lint": "eslint . && prettier --check theme.css",
34
+ "test": "vitest run"
35
+ }
6
36
  }
package/theme.css ADDED
@@ -0,0 +1,724 @@
1
+ /*
2
+ * Inkbar default theme.
3
+ *
4
+ * Every rule sits in @layer inkbar and every selector is wrapped in :where(), so any rule of
5
+ * yours wins without !important. Interface colours read shadcn token names (--background,
6
+ * --foreground, --muted, --border, --primary, --radius) and fall back to Inkbar's own values
7
+ * when the page does not define them.
8
+ *
9
+ * Annotation colours (--ink-highlight and the rest) are read once, when an annotation is
10
+ * created, and stored on it, because they are written into the PDF. Changing them restyles
11
+ * new annotations only.
12
+ */
13
+ @layer inkbar {
14
+ /* Tokens. Popovers are portalled out of the root, so they carry the tokens too. */
15
+ :where(
16
+ [data-ink-root],
17
+ [data-ink-note-popover],
18
+ [data-ink-suggestion-card],
19
+ [data-ink-select-content]
20
+ ) {
21
+ --ink-highlight: #f2c230;
22
+ --ink-underline: #2b5a9e;
23
+ --ink-strikeout: #c0392b;
24
+ --ink-squiggly: #1f7a4d;
25
+ --ink-note: #f2c230;
26
+ --ink-free-text: #151820;
27
+ --ink-shape: #c0392b;
28
+ --ink-ink: #151820;
29
+ --ink-redact: #c0392b;
30
+ --ink-redact-fill: #000000;
31
+ --ink-suggestion-low: #d4a017;
32
+ --ink-suggestion-medium: #e67e22;
33
+ --ink-suggestion-high: #c0392b;
34
+
35
+ --ink-bg: var(--muted, #f1f2f5);
36
+ --ink-fg: var(--foreground, #151820);
37
+ --ink-muted-fg: var(--muted-foreground, #5a6170);
38
+ --ink-surface: var(--background, #ffffff);
39
+ --ink-border: var(--border, #dce0e7);
40
+ --ink-accent: var(--primary, #151820);
41
+ --ink-accent-fg: var(--primary-foreground, #ffffff);
42
+ --ink-ring: var(--ring, #2b5a9e);
43
+ --ink-radius: var(--radius, 0.5rem);
44
+ --ink-page-shadow: 0 1px 3px rgb(0 0 0 / 0.2);
45
+ --ink-text-selection: color-mix(in srgb, AccentColor, transparent 50%);
46
+
47
+ color: var(--ink-fg);
48
+ }
49
+
50
+ @media (prefers-color-scheme: dark) {
51
+ :where(
52
+ [data-ink-root]:not(.light, .light *),
53
+ [data-ink-note-popover]:not(.light *),
54
+ [data-ink-suggestion-card]:not(.light *),
55
+ [data-ink-select-content]:not(.light *)
56
+ ) {
57
+ --ink-bg: var(--muted, #0f1217);
58
+ --ink-fg: var(--foreground, #e6e9ef);
59
+ --ink-muted-fg: var(--muted-foreground, #9aa1ae);
60
+ --ink-surface: var(--background, #161a21);
61
+ --ink-border: var(--border, #2a303b);
62
+ --ink-accent: var(--primary, #e6e9ef);
63
+ --ink-accent-fg: var(--primary-foreground, #151820);
64
+ --ink-ring: var(--ring, #7aa5e6);
65
+ --ink-page-shadow: 0 1px 3px rgb(0 0 0 / 0.6);
66
+ }
67
+ }
68
+
69
+ /* A .light element inside a .dark one keeps the light values. */
70
+ :where(
71
+ .dark [data-ink-root]:not(.light, .dark .light *),
72
+ [data-ink-root].dark,
73
+ .dark [data-ink-note-popover]:not(.dark .light *),
74
+ .dark [data-ink-suggestion-card]:not(.dark .light *),
75
+ .dark [data-ink-select-content]:not(.dark .light *)
76
+ ) {
77
+ --ink-bg: var(--muted, #0f1217);
78
+ --ink-fg: var(--foreground, #e6e9ef);
79
+ --ink-muted-fg: var(--muted-foreground, #9aa1ae);
80
+ --ink-surface: var(--background, #161a21);
81
+ --ink-border: var(--border, #2a303b);
82
+ --ink-accent: var(--primary, #e6e9ef);
83
+ --ink-accent-fg: var(--primary-foreground, #151820);
84
+ --ink-ring: var(--ring, #7aa5e6);
85
+ --ink-page-shadow: 0 1px 3px rgb(0 0 0 / 0.6);
86
+ }
87
+
88
+ /* Layout: root and viewport fill their parent; the scroll area takes the space left over. */
89
+ :where([data-ink-root]) {
90
+ display: flex;
91
+ flex-direction: column;
92
+ height: 100%;
93
+ min-height: 0;
94
+ }
95
+
96
+ :where([data-ink-viewport-root]) {
97
+ position: relative;
98
+ display: flex;
99
+ flex-direction: column;
100
+ flex: 1 1 auto;
101
+ height: 100%;
102
+ min-height: 0;
103
+ }
104
+
105
+ :where(.ink-scroll) {
106
+ flex: 1 1 auto;
107
+ min-height: 0;
108
+ background: var(--ink-bg);
109
+ outline-offset: -2px;
110
+ }
111
+
112
+ :where(.ink-scroll:focus-visible) {
113
+ outline: 2px solid var(--ink-ring);
114
+ }
115
+
116
+ :where(.ink-page) {
117
+ background: #ffffff;
118
+ box-shadow: var(--ink-page-shadow);
119
+ }
120
+
121
+ /* Loading, error and empty states cover the scroll area. */
122
+ :where(.ink-status) {
123
+ position: absolute;
124
+ inset: 0;
125
+ z-index: 1;
126
+ display: grid;
127
+ place-content: center;
128
+ gap: 0.25rem;
129
+ padding: 1rem;
130
+ text-align: center;
131
+ background: var(--ink-bg);
132
+ }
133
+
134
+ :where(.ink-error-title) {
135
+ margin: 0;
136
+ font-weight: 600;
137
+ }
138
+
139
+ :where(.ink-error-code) {
140
+ margin-right: 0.5rem;
141
+ font-family: ui-monospace, monospace;
142
+ font-size: 0.8rem;
143
+ color: var(--ink-muted-fg);
144
+ }
145
+
146
+ /* A page that failed to render: covers that page only. */
147
+ :where(.ink-page-error) {
148
+ position: absolute;
149
+ inset: 0;
150
+ z-index: 2;
151
+ display: grid;
152
+ place-content: center;
153
+ gap: 0.25rem;
154
+ padding: 1rem;
155
+ text-align: center;
156
+ color: var(--ink-fg);
157
+ background: var(--ink-surface);
158
+ }
159
+
160
+ :where(.ink-page-error p) {
161
+ margin: 0;
162
+ }
163
+
164
+ /*
165
+ * Text layer: the .textLayer rules from pdfjs-dist 6.4.299 web/pdf_viewer.css, renamed to
166
+ * .ink-text-layer. PDF.js sizes the layer from --total-scale-factor (set on the page) and
167
+ * --scale-round-x/y, writes --font-height, --scale-x and --rotate on each span and
168
+ * data-main-rotation on the layer. These rules turn those into the final layout.
169
+ */
170
+ :where(.ink-text-layer) {
171
+ --scale-round-x: 1px;
172
+ --scale-round-y: 1px;
173
+ --min-font-size: 1;
174
+ --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size));
175
+ --min-font-size-inv: calc(1 / var(--min-font-size));
176
+
177
+ color-scheme: only light;
178
+ overflow: clip;
179
+ opacity: 1;
180
+ text-align: initial;
181
+ line-height: 1;
182
+ letter-spacing: normal;
183
+ word-spacing: normal;
184
+ text-size-adjust: none;
185
+ forced-color-adjust: none;
186
+ transform-origin: 0 0;
187
+ caret-color: CanvasText;
188
+ z-index: 0;
189
+ }
190
+
191
+ :where(.ink-text-layer span, .ink-text-layer br) {
192
+ color: transparent;
193
+ position: absolute;
194
+ white-space: pre;
195
+ cursor: text;
196
+ transform-origin: 0% 0%;
197
+ user-select: text;
198
+ }
199
+
200
+ :where(
201
+ .ink-text-layer > :not(.markedContent),
202
+ .ink-text-layer .markedContent span:not(.markedContent)
203
+ ) {
204
+ --font-height: 0;
205
+ --scale-x: 1;
206
+ --rotate: 0deg;
207
+
208
+ z-index: 1;
209
+ font-size: calc(var(--text-scale-factor) * var(--font-height));
210
+ transform: rotate(var(--rotate)) scaleX(var(--scale-x))
211
+ scale(var(--min-font-size-inv));
212
+ }
213
+
214
+ :where(.ink-text-layer .markedContent) {
215
+ display: contents;
216
+ }
217
+
218
+ :where(.ink-text-layer span[role='img']) {
219
+ user-select: none;
220
+ cursor: default;
221
+ }
222
+
223
+ :where(.ink-text-layer[data-main-rotation='90']) {
224
+ transform: rotate(90deg) translateY(-100%);
225
+ }
226
+
227
+ :where(.ink-text-layer[data-main-rotation='180']) {
228
+ transform: rotate(180deg) translate(-100%, -100%);
229
+ }
230
+
231
+ :where(.ink-text-layer[data-main-rotation='270']) {
232
+ transform: rotate(270deg) translateX(-100%);
233
+ }
234
+
235
+ :where(.ink-text-layer span)::selection {
236
+ background: var(--ink-text-selection, rgb(0 0 255 / 0.25));
237
+ color: transparent;
238
+ }
239
+
240
+ :where(.ink-text-layer br)::selection {
241
+ background: transparent;
242
+ }
243
+
244
+ /* Tools: the active tool's cursor is set on the root; text spans follow it unless text is the target. */
245
+ :where(
246
+ [data-ink-tool='redact-area'] .ink-text-layer span,
247
+ [data-ink-tool='note'] .ink-text-layer span
248
+ ) {
249
+ cursor: inherit;
250
+ }
251
+
252
+ :where(.ink-draft, .ink-marquee) {
253
+ border: 1px dashed var(--ink-accent);
254
+ background: color-mix(in srgb, var(--ink-accent) 10%, transparent);
255
+ }
256
+
257
+ :where(.ink-draft[data-ink-draft='redact']) {
258
+ border-color: var(--ink-redact);
259
+ background: color-mix(in srgb, var(--ink-redact) 15%, transparent);
260
+ }
261
+
262
+ /* Resize handles on a selected area mark, text box or shape: shown with the select tool only. */
263
+ :where(.ink-handle) {
264
+ box-sizing: border-box;
265
+ border: 1px solid var(--ink-accent);
266
+ border-radius: 1px;
267
+ background: var(--ink-surface);
268
+ }
269
+
270
+ :where([data-ink-tool]:not([data-ink-tool='select']) .ink-handle) {
271
+ display: none;
272
+ }
273
+
274
+ :where(.ink-handle[data-handle='nw'], .ink-handle[data-handle='se']) {
275
+ cursor: nwse-resize;
276
+ }
277
+
278
+ :where(.ink-handle[data-handle='ne'], .ink-handle[data-handle='sw']) {
279
+ cursor: nesw-resize;
280
+ }
281
+
282
+ /* Annotations */
283
+ :where(.ink-overlay) {
284
+ z-index: 1;
285
+ }
286
+
287
+ :where(.ink-annotation) {
288
+ border-radius: 2px;
289
+ outline: 1px solid transparent;
290
+ outline-offset: 1px;
291
+ }
292
+
293
+ :where(.ink-annotation:not([data-custom]) > svg) {
294
+ position: absolute;
295
+ left: 0;
296
+ top: 0;
297
+ }
298
+
299
+ :where(
300
+ [data-ink-tool='select'] .ink-annotation,
301
+ [data-ink-tool='view'] .ink-annotation
302
+ ) {
303
+ cursor: pointer;
304
+ }
305
+
306
+ :where(.ink-annotation[data-state='hover']) {
307
+ outline-color: color-mix(in srgb, var(--ink-ring) 50%, transparent);
308
+ }
309
+
310
+ :where(.ink-annotation[data-state='selected'], .ink-annotation:focus-visible) {
311
+ outline: 2px solid var(--ink-ring);
312
+ }
313
+
314
+ /* Locked annotations can be selected but not moved or deleted. */
315
+ :where(.ink-annotation[data-locked]) {
316
+ cursor: default;
317
+ }
318
+
319
+ :where(.ink-annotation[data-locked][data-state='selected']) {
320
+ outline-style: dotted;
321
+ }
322
+
323
+ :where(.ink-annotation[data-origin='suggested'] .ink-annotation-shape > *) {
324
+ stroke-dasharray: 4 3;
325
+ }
326
+
327
+ :where(.ink-note-icon) {
328
+ position: absolute;
329
+ left: 0;
330
+ top: 0;
331
+ display: block;
332
+ width: 20px;
333
+ height: 20px;
334
+ border-radius: 3px 3px 3px 0;
335
+ background: var(--ink-note);
336
+ box-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
337
+ pointer-events: none;
338
+ }
339
+
340
+ :where(.ink-free-text) {
341
+ width: 100%;
342
+ height: 100%;
343
+ overflow: hidden;
344
+ font-family: var(--ink-font-family, Helvetica), Helvetica, Arial, sans-serif;
345
+ font-size: var(--ink-font-size);
346
+ line-height: 1.2;
347
+ color: var(--ink-text-color, var(--ink-free-text));
348
+ opacity: var(--ink-opacity, 1);
349
+ overflow-wrap: break-word;
350
+ white-space: pre-wrap;
351
+ }
352
+
353
+ :where(.ink-free-text[data-align='left']) {
354
+ text-align: left;
355
+ }
356
+
357
+ :where(.ink-free-text[data-align='center']) {
358
+ text-align: center;
359
+ }
360
+
361
+ :where(.ink-free-text[data-align='right']) {
362
+ text-align: right;
363
+ }
364
+
365
+ /*
366
+ * Toolbar. The theme styles the bar's surface and the controls in it; where a bar sits, how
367
+ * its controls are grouped and what separates it from the document are up to the app.
368
+ * --ink-control-size sets the height of buttons, fields and the zoom select, and
369
+ * --ink-icon-size the size of their icons.
370
+ */
371
+ :where(.ink-toolbar) {
372
+ display: flex;
373
+ flex-wrap: wrap;
374
+ align-items: center;
375
+ gap: 0.25rem;
376
+ padding: 0.375rem 0.5rem;
377
+ background: var(--ink-surface);
378
+ color: var(--ink-fg);
379
+ }
380
+
381
+ :where(.ink-toolbar button) {
382
+ display: inline-flex;
383
+ align-items: center;
384
+ justify-content: center;
385
+ min-width: var(--ink-control-size, 2.25rem);
386
+ height: var(--ink-control-size, 2.25rem);
387
+ padding: 0 0.5rem;
388
+ border: 1px solid transparent;
389
+ border-radius: calc(var(--ink-radius) - 2px);
390
+ background: transparent;
391
+ color: inherit;
392
+ font: inherit;
393
+ cursor: pointer;
394
+ }
395
+
396
+ /* The controls' icons. --ink-icon-size sets their size; it defaults to 1.125rem. */
397
+ :where(.ink-icon) {
398
+ flex: none;
399
+ width: var(--ink-icon-size, 1.125rem);
400
+ height: var(--ink-icon-size, 1.125rem);
401
+ }
402
+
403
+ :where(.ink-select-icon .ink-icon, .ink-select-indicator .ink-icon) {
404
+ width: 1rem;
405
+ height: 1rem;
406
+ }
407
+
408
+ :where(.ink-toolbar-separator) {
409
+ align-self: stretch;
410
+ width: 1px;
411
+ margin: 0.25rem 0.25rem;
412
+ background: var(--ink-border);
413
+ }
414
+
415
+ :where(.ink-toolbar button:hover) {
416
+ background: color-mix(in srgb, var(--ink-fg) 8%, transparent);
417
+ }
418
+
419
+ :where(.ink-toolbar button[data-state='on']) {
420
+ background: var(--ink-accent);
421
+ color: var(--ink-accent-fg);
422
+ }
423
+
424
+ :where(.ink-toolbar button:disabled) {
425
+ opacity: 0.5;
426
+ cursor: default;
427
+ }
428
+
429
+ :where(.ink-toolbar input) {
430
+ box-sizing: border-box;
431
+ height: var(--ink-control-size, 2.25rem);
432
+ padding: 0 0.5rem;
433
+ border: 1px solid var(--ink-border);
434
+ border-radius: calc(var(--ink-radius) - 2px);
435
+ background: var(--ink-surface);
436
+ color: inherit;
437
+ font: inherit;
438
+ }
439
+
440
+ :where(.ink-page-input) {
441
+ width: 3.5rem;
442
+ text-align: center;
443
+ font-variant-numeric: tabular-nums;
444
+ appearance: textfield;
445
+ }
446
+
447
+ :where(.ink-page-input)::-webkit-inner-spin-button,
448
+ :where(.ink-page-input)::-webkit-outer-spin-button {
449
+ margin: 0;
450
+ appearance: none;
451
+ }
452
+
453
+ :where(.ink-page-count) {
454
+ padding: 0 0.25rem;
455
+ color: var(--ink-muted-fg);
456
+ font-size: 0.875rem;
457
+ font-variant-numeric: tabular-nums;
458
+ white-space: nowrap;
459
+ }
460
+
461
+ /*
462
+ * Zoom select. The bindings render a button trigger (`.ink-select-trigger`) and a portalled
463
+ * listbox; createViewer renders a native select. Both take the same box and chevron.
464
+ */
465
+ :where(.ink-toolbar .ink-zoom-select) {
466
+ box-sizing: border-box;
467
+ display: inline-flex;
468
+ align-items: center;
469
+ justify-content: space-between;
470
+ gap: 0.5rem;
471
+ width: 7.5rem;
472
+ height: var(--ink-control-size, 2.25rem);
473
+ padding: 0 0.5rem 0 0.75rem;
474
+ border: 1px solid var(--ink-border);
475
+ border-radius: calc(var(--ink-radius) - 2px);
476
+ background: var(--ink-surface);
477
+ color: inherit;
478
+ font: inherit;
479
+ font-size: 0.875rem;
480
+ font-variant-numeric: tabular-nums;
481
+ text-align: left;
482
+ white-space: nowrap;
483
+ cursor: pointer;
484
+ }
485
+
486
+ :where(.ink-toolbar .ink-zoom-select:hover) {
487
+ background: color-mix(in srgb, var(--ink-fg) 4%, var(--ink-surface));
488
+ }
489
+
490
+ :where(.ink-toolbar .ink-zoom-select:disabled) {
491
+ opacity: 0.5;
492
+ cursor: default;
493
+ }
494
+
495
+ /* The native select draws the same chevron as the trigger's icon: Lucide's ChevronDown; see LICENSE. */
496
+ :where(.ink-toolbar select.ink-zoom-select) {
497
+ padding-right: 2rem;
498
+ appearance: none;
499
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235a6170' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
500
+ background-position: right 0.5rem center;
501
+ background-repeat: no-repeat;
502
+ background-size: 1rem;
503
+ }
504
+
505
+ :where(.ink-select-value) {
506
+ overflow: hidden;
507
+ text-overflow: ellipsis;
508
+ }
509
+
510
+ :where(.ink-select-icon) {
511
+ display: inline-flex;
512
+ flex: none;
513
+ color: var(--ink-muted-fg);
514
+ }
515
+
516
+ :where(.ink-select-content) {
517
+ box-sizing: border-box;
518
+ z-index: 50;
519
+ min-width: var(
520
+ --radix-select-trigger-width,
521
+ var(--reka-select-trigger-width, var(--bits-select-anchor-width, 7.5rem))
522
+ );
523
+ max-height: min(
524
+ 20rem,
525
+ var(
526
+ --radix-select-content-available-height,
527
+ var(
528
+ --reka-select-content-available-height,
529
+ var(--bits-select-content-available-height, 20rem)
530
+ )
531
+ )
532
+ );
533
+ overflow-y: auto;
534
+ padding: 0.25rem;
535
+ border: 1px solid var(--ink-border);
536
+ border-radius: var(--ink-radius);
537
+ background: var(--ink-surface);
538
+ color: var(--ink-fg);
539
+ box-shadow: 0 8px 24px rgb(0 0 0 / 0.15);
540
+ font-size: 0.875rem;
541
+ font-variant-numeric: tabular-nums;
542
+ }
543
+
544
+ :where(.ink-select-separator) {
545
+ height: 1px;
546
+ margin: 0.25rem -0.25rem;
547
+ background: var(--ink-border);
548
+ }
549
+
550
+ :where(.ink-select-item) {
551
+ position: relative;
552
+ display: flex;
553
+ align-items: center;
554
+ padding: 0.375rem 2rem 0.375rem 0.5rem;
555
+ border-radius: calc(var(--ink-radius) - 4px);
556
+ outline: none;
557
+ cursor: default;
558
+ user-select: none;
559
+ }
560
+
561
+ :where(.ink-select-item[data-highlighted]) {
562
+ background: color-mix(in srgb, var(--ink-fg) 8%, transparent);
563
+ }
564
+
565
+ :where(.ink-select-item[data-disabled]) {
566
+ opacity: 0.5;
567
+ }
568
+
569
+ :where(.ink-select-indicator) {
570
+ position: absolute;
571
+ right: 0.5rem;
572
+ display: inline-flex;
573
+ }
574
+
575
+ /* Note threads and suggestion cards */
576
+ :where(.ink-note-popover, .ink-suggestion-card) {
577
+ z-index: 50;
578
+ width: 20rem;
579
+ max-width: calc(100vw - 1rem);
580
+ padding: 0.75rem;
581
+ border: 1px solid var(--ink-border);
582
+ border-radius: var(--ink-radius);
583
+ background: var(--ink-surface);
584
+ color: var(--ink-fg);
585
+ box-shadow: 0 8px 24px rgb(0 0 0 / 0.15);
586
+ font-size: 0.875rem;
587
+ }
588
+
589
+ :where(.ink-thread) {
590
+ display: grid;
591
+ gap: 0.5rem;
592
+ max-height: 16rem;
593
+ margin: 0 0 0.5rem;
594
+ padding: 0;
595
+ overflow: auto;
596
+ list-style: none;
597
+ }
598
+
599
+ :where(.ink-thread-item[data-reply]) {
600
+ margin-left: 0.75rem;
601
+ padding-left: 0.5rem;
602
+ border-left: 2px solid var(--ink-border);
603
+ }
604
+
605
+ :where(.ink-thread-author) {
606
+ font-weight: 600;
607
+ }
608
+
609
+ :where(.ink-thread-time) {
610
+ margin-left: 0.5rem;
611
+ color: var(--ink-muted-fg);
612
+ font-size: 0.75rem;
613
+ }
614
+
615
+ :where(.ink-thread-text) {
616
+ margin: 0.125rem 0 0;
617
+ white-space: pre-wrap;
618
+ }
619
+
620
+ :where(.ink-thread-reply textarea) {
621
+ box-sizing: border-box;
622
+ width: 100%;
623
+ padding: 0.375rem;
624
+ border: 1px solid var(--ink-border);
625
+ border-radius: calc(var(--ink-radius) - 2px);
626
+ background: var(--ink-surface);
627
+ color: inherit;
628
+ font: inherit;
629
+ resize: vertical;
630
+ }
631
+
632
+ :where(.ink-thread-actions, .ink-suggestion-actions) {
633
+ display: flex;
634
+ gap: 0.375rem;
635
+ margin-top: 0.5rem;
636
+ }
637
+
638
+ :where(.ink-thread-actions button, .ink-suggestion-actions button) {
639
+ padding: 0.375rem 0.75rem;
640
+ border: 1px solid var(--ink-border);
641
+ border-radius: calc(var(--ink-radius) - 2px);
642
+ background: var(--ink-surface);
643
+ color: inherit;
644
+ font: inherit;
645
+ cursor: pointer;
646
+ }
647
+
648
+ :where(
649
+ .ink-thread-actions button[type='submit'],
650
+ .ink-suggestion-actions button:first-child
651
+ ) {
652
+ border-color: var(--ink-accent);
653
+ background: var(--ink-accent);
654
+ color: var(--ink-accent-fg);
655
+ }
656
+
657
+ :where(.ink-select-item:focus-visible) {
658
+ outline: none;
659
+ }
660
+
661
+ :where(.ink-thread-actions button:disabled) {
662
+ opacity: 0.5;
663
+ cursor: default;
664
+ }
665
+
666
+ :where(
667
+ .ink-toolbar button:focus-visible,
668
+ .ink-toolbar select:focus-visible,
669
+ .ink-select-trigger:focus-visible,
670
+ .ink-toolbar input:focus-visible,
671
+ .ink-thread-actions button:focus-visible,
672
+ .ink-suggestion-actions button:focus-visible,
673
+ .ink-thread-reply textarea:focus-visible
674
+ ) {
675
+ outline: 2px solid var(--ink-ring);
676
+ outline-offset: 2px;
677
+ }
678
+
679
+ :where(.ink-suggestion-reason, .ink-suggestion-explanation) {
680
+ margin: 0;
681
+ }
682
+
683
+ :where(.ink-suggestion-explanation) {
684
+ margin-top: 0.25rem;
685
+ color: var(--ink-muted-fg);
686
+ }
687
+
688
+ /* The label text keeps the body colour for contrast; the confidence colour is a swatch. */
689
+ :where(.ink-suggestion-confidence) {
690
+ display: inline-flex;
691
+ align-items: center;
692
+ gap: 0.375rem;
693
+ margin-left: 0.5rem;
694
+ color: var(--ink-fg);
695
+ font-size: 0.75rem;
696
+ text-transform: capitalize;
697
+ }
698
+
699
+ :where(.ink-suggestion-confidence)::before {
700
+ content: '';
701
+ width: 0.5rem;
702
+ height: 0.5rem;
703
+ border-radius: 50%;
704
+ background: currentColor;
705
+ }
706
+
707
+ :where(.ink-suggestion-confidence[data-confidence='low'])::before {
708
+ background: var(--ink-suggestion-low);
709
+ }
710
+
711
+ :where(.ink-suggestion-confidence[data-confidence='medium'])::before {
712
+ background: var(--ink-suggestion-medium);
713
+ }
714
+
715
+ :where(.ink-suggestion-confidence[data-confidence='high'])::before {
716
+ background: var(--ink-suggestion-high);
717
+ }
718
+
719
+ @media (prefers-reduced-motion: no-preference) {
720
+ :where(.ink-annotation) {
721
+ transition: outline-color 120ms ease;
722
+ }
723
+ }
724
+ }