@inkbar/theme 0.1.1 → 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 +47 -0
  2. package/README.md +11 -1
  3. package/package.json +1 -1
  4. package/theme.css +171 -22
package/LICENSE CHANGED
@@ -19,3 +19,50 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
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
@@ -20,7 +20,7 @@
20
20
 
21
21
  ---
22
22
 
23
- `@inkbar/theme` styles the viewer, toolbar, 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.
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
24
 
25
25
  ## Install
26
26
 
@@ -74,6 +74,16 @@ Inkbar reads a colour when you create the annotation and stores it on the annota
74
74
 
75
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
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
+
77
87
  ## Licence
78
88
 
79
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,6 @@
1
1
  {
2
2
  "name": "@inkbar/theme",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Default stylesheet for Inkbar. Zero specificity, so your CSS wins.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://inkbar.dev",
package/theme.css CHANGED
@@ -12,7 +12,12 @@
12
12
  */
13
13
  @layer inkbar {
14
14
  /* Tokens. Popovers are portalled out of the root, so they carry the tokens too. */
15
- :where([data-ink-root], [data-ink-note-popover], [data-ink-suggestion-card]) {
15
+ :where(
16
+ [data-ink-root],
17
+ [data-ink-note-popover],
18
+ [data-ink-suggestion-card],
19
+ [data-ink-select-content]
20
+ ) {
16
21
  --ink-highlight: #f2c230;
17
22
  --ink-underline: #2b5a9e;
18
23
  --ink-strikeout: #c0392b;
@@ -46,7 +51,8 @@
46
51
  :where(
47
52
  [data-ink-root]:not(.light, .light *),
48
53
  [data-ink-note-popover]:not(.light *),
49
- [data-ink-suggestion-card]:not(.light *)
54
+ [data-ink-suggestion-card]:not(.light *),
55
+ [data-ink-select-content]:not(.light *)
50
56
  ) {
51
57
  --ink-bg: var(--muted, #0f1217);
52
58
  --ink-fg: var(--foreground, #e6e9ef);
@@ -65,7 +71,8 @@
65
71
  .dark [data-ink-root]:not(.light, .dark .light *),
66
72
  [data-ink-root].dark,
67
73
  .dark [data-ink-note-popover]:not(.dark .light *),
68
- .dark [data-ink-suggestion-card]:not(.dark .light *)
74
+ .dark [data-ink-suggestion-card]:not(.dark .light *),
75
+ .dark [data-ink-select-content]:not(.dark .light *)
69
76
  ) {
70
77
  --ink-bg: var(--muted, #0f1217);
71
78
  --ink-fg: var(--foreground, #e6e9ef);
@@ -355,35 +362,28 @@
355
362
  text-align: right;
356
363
  }
357
364
 
358
- /* Toolbar */
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
+ */
359
371
  :where(.ink-toolbar) {
360
372
  display: flex;
361
373
  flex-wrap: wrap;
362
374
  align-items: center;
363
- gap: 0.5rem;
375
+ gap: 0.25rem;
364
376
  padding: 0.375rem 0.5rem;
365
377
  background: var(--ink-surface);
366
378
  color: var(--ink-fg);
367
- border-bottom: 1px solid var(--ink-border);
368
- }
369
-
370
- :where(.ink-toolbar-group) {
371
- display: flex;
372
- align-items: center;
373
- gap: 0.125rem;
374
- }
375
-
376
- :where(.ink-toolbar-group + .ink-toolbar-group) {
377
- padding-left: 0.5rem;
378
- border-left: 1px solid var(--ink-border);
379
379
  }
380
380
 
381
381
  :where(.ink-toolbar button) {
382
382
  display: inline-flex;
383
383
  align-items: center;
384
384
  justify-content: center;
385
- min-width: 2.25rem;
386
- height: 2.25rem;
385
+ min-width: var(--ink-control-size, 2.25rem);
386
+ height: var(--ink-control-size, 2.25rem);
387
387
  padding: 0 0.5rem;
388
388
  border: 1px solid transparent;
389
389
  border-radius: calc(var(--ink-radius) - 2px);
@@ -393,6 +393,25 @@
393
393
  cursor: pointer;
394
394
  }
395
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
+
396
415
  :where(.ink-toolbar button:hover) {
397
416
  background: color-mix(in srgb, var(--ink-fg) 8%, transparent);
398
417
  }
@@ -407,8 +426,9 @@
407
426
  cursor: default;
408
427
  }
409
428
 
410
- :where(.ink-toolbar select, .ink-toolbar input) {
411
- height: 2.25rem;
429
+ :where(.ink-toolbar input) {
430
+ box-sizing: border-box;
431
+ height: var(--ink-control-size, 2.25rem);
412
432
  padding: 0 0.5rem;
413
433
  border: 1px solid var(--ink-border);
414
434
  border-radius: calc(var(--ink-radius) - 2px);
@@ -418,14 +438,138 @@
418
438
  }
419
439
 
420
440
  :where(.ink-page-input) {
421
- width: 4rem;
441
+ width: 3.5rem;
422
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;
423
451
  }
424
452
 
425
453
  :where(.ink-page-count) {
426
454
  padding: 0 0.25rem;
427
455
  color: var(--ink-muted-fg);
428
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;
429
573
  }
430
574
 
431
575
  /* Note threads and suggestion cards */
@@ -510,6 +654,10 @@
510
654
  color: var(--ink-accent-fg);
511
655
  }
512
656
 
657
+ :where(.ink-select-item:focus-visible) {
658
+ outline: none;
659
+ }
660
+
513
661
  :where(.ink-thread-actions button:disabled) {
514
662
  opacity: 0.5;
515
663
  cursor: default;
@@ -518,6 +666,7 @@
518
666
  :where(
519
667
  .ink-toolbar button:focus-visible,
520
668
  .ink-toolbar select:focus-visible,
669
+ .ink-select-trigger:focus-visible,
521
670
  .ink-toolbar input:focus-visible,
522
671
  .ink-thread-actions button:focus-visible,
523
672
  .ink-suggestion-actions button:focus-visible,