@verbb/vitepress-theme 1.0.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/src/custom.css ADDED
@@ -0,0 +1,547 @@
1
+ @import "tailwindcss";
2
+ @plugin "@tailwindcss/typography";
3
+ @source "./**/*.{vue,ts}";
4
+
5
+ @theme inline {
6
+ --color-docs-primary: var(--docs-primary);
7
+ --color-docs-primary-strong: var(--docs-primary-strong);
8
+ --color-docs-primary-soft: var(--docs-primary-soft);
9
+ --color-docs-primary-soft-hover: var(--docs-primary-soft-hover);
10
+ --color-docs-primary-border: var(--docs-primary-border);
11
+ --color-docs-primary-border-strong: var(--docs-primary-border-strong);
12
+ }
13
+
14
+ :root {
15
+ --docs-primary: #0f766e;
16
+ --docs-primary-strong: color-mix(in oklab, var(--docs-primary) 82%, black);
17
+ --docs-primary-soft: color-mix(in oklab, var(--docs-primary) 12%, white);
18
+ --docs-primary-soft-hover: color-mix(in oklab, var(--docs-primary) 16%, white);
19
+ --docs-primary-border: color-mix(in oklab, var(--docs-primary) 18%, white);
20
+ --docs-primary-border-strong: color-mix(in oklab, var(--docs-primary) 28%, white);
21
+ --vp-c-bg: #ffffff;
22
+ --vp-c-bg-alt: #f8fafc;
23
+ --vp-c-bg-elv: #ffffff;
24
+ --vp-c-bg-soft: #f8fafc;
25
+ --vp-c-divider: #d7dfe9;
26
+ --vp-c-text-1: #0f172a;
27
+ --vp-c-text-2: #475569;
28
+ --vp-c-text-3: #94a3b8;
29
+ --vp-c-brand-1: var(--docs-primary);
30
+ --vp-c-neutral-inverse: #ffffff;
31
+ --vp-backdrop-bg-color: rgba(15, 23, 42, 0.45);
32
+ --vp-local-search-bg: var(--vp-c-bg);
33
+ --vp-local-search-result-bg: var(--vp-c-bg);
34
+ --vp-local-search-result-border: var(--vp-c-divider);
35
+ --vp-local-search-result-selected-bg: color-mix(in oklab, var(--docs-primary) 8%, white);
36
+ --vp-local-search-result-selected-border: var(--docs-primary);
37
+ --vp-local-search-highlight-bg: var(--docs-primary);
38
+ --vp-local-search-highlight-text: #ffffff;
39
+ }
40
+
41
+ .vp-doc {
42
+ max-width: none;
43
+ }
44
+
45
+ .vp-doc :where(h1, h2, h3, h4, h5, h6) {
46
+ scroll-margin-top: calc(var(--scroll-mt, 88px) + 0.75rem);
47
+ }
48
+
49
+ .vp-doc h1 {
50
+ @apply mb-2 text-2xl font-semibold tracking-tight text-gray-900 [overflow-wrap:anywhere] sm:text-3xl;
51
+ }
52
+
53
+ .vp-doc h1+p {
54
+ @apply mt-0;
55
+ }
56
+
57
+ .vp-doc h2 {
58
+ @apply mb-3 text-xl font-semibold sm:text-2xl;
59
+ }
60
+
61
+ .vp-doc h3 {
62
+ @apply text-lg font-semibold sm:text-xl;
63
+ }
64
+
65
+ .vp-doc h4 {
66
+ @apply text-base font-semibold sm:text-lg;
67
+ }
68
+
69
+ .vp-doc h5 {
70
+ @apply text-sm font-semibold sm:text-base;
71
+ }
72
+
73
+ .vp-doc :where(h2, h3, h4, h5, h6).docs-copyable-heading {
74
+ position: relative;
75
+ cursor: pointer;
76
+ }
77
+
78
+ .vp-doc :where(h2, h3, h4, h5, h6).docs-copyable-heading::before {
79
+ content: "";
80
+ position: absolute;
81
+ top: 0;
82
+ bottom: 0;
83
+ left: -1rem;
84
+ width: 1rem;
85
+ }
86
+
87
+ .vp-doc :where(h2, h3, h4, h5, h6).docs-copyable-heading {
88
+ position: relative;
89
+ cursor: default;
90
+ }
91
+
92
+ .vp-doc :where(h2, h3, h4, h5, h6).docs-copyable-heading>.anchor-heading__icon-wrap {
93
+ position: absolute;
94
+ top: 0;
95
+ bottom: 0;
96
+ left: 0;
97
+ display: flex;
98
+ align-items: center;
99
+ transform: translateX(-2rem);
100
+ z-index: 1;
101
+ }
102
+
103
+ .vp-doc :where(h2, h3, h4, h5, h6).docs-copyable-heading>.anchor-heading__icon-wrap>.header-anchor {
104
+ display: inline-flex;
105
+ align-items: center;
106
+ justify-content: center;
107
+ width: 1.5rem;
108
+ height: 1.5rem;
109
+ border-radius: 0.375rem;
110
+ border: 1px solid rgba(148, 163, 184, 0.32);
111
+ background: #ffffff;
112
+ box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
113
+ color: #94a3b8;
114
+ text-decoration: none;
115
+ opacity: 0;
116
+ transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
117
+ font-size: 0;
118
+ pointer-events: auto;
119
+ cursor: pointer;
120
+ }
121
+
122
+ .vp-doc :where(h2, h3, h4, h5, h6).docs-copyable-heading>.anchor-heading__icon-wrap>.header-anchor::after {
123
+ content: '';
124
+ position: absolute;
125
+ top: 0;
126
+ right: -0.5rem;
127
+ width: 0.5rem;
128
+ height: 100%;
129
+ }
130
+
131
+ .vp-doc :where(h2, h3, h4, h5, h6).docs-copyable-heading>.anchor-heading__content {
132
+ display: inline;
133
+ cursor: pointer;
134
+ }
135
+
136
+ .vp-doc :where(h2, h3, h4, h5, h6).docs-copyable-heading:hover .header-anchor,
137
+ .vp-doc :where(h2, h3, h4, h5, h6).docs-copyable-heading:focus-within .header-anchor,
138
+ .vp-doc :where(h2, h3, h4, h5, h6).docs-copyable-heading .header-anchor:hover,
139
+ .vp-doc :where(h2, h3, h4, h5, h6).docs-copyable-heading .header-anchor:focus-visible {
140
+ opacity: 1;
141
+ }
142
+
143
+ .vp-doc :where(h2, h3, h4, h5, h6).docs-copyable-heading:hover .header-anchor {
144
+ color: #64748b;
145
+ }
146
+
147
+ .vp-doc :where(h2, h3, h4, h5, h6).docs-copyable-heading .header-anchor:hover,
148
+ .vp-doc :where(h2, h3, h4, h5, h6).docs-copyable-heading .header-anchor:focus-visible {
149
+ color: #475569;
150
+ border-color: rgba(100, 116, 139, 0.48);
151
+ box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.12);
152
+ outline: 0;
153
+ }
154
+
155
+ .docs-heading-anchor__icon {
156
+ display: block;
157
+ width: 0.75rem;
158
+ height: 0.75rem;
159
+ color: currentColor;
160
+ }
161
+
162
+ .vp-doc :not(pre)>code {
163
+ overflow-wrap: break-word;
164
+ -webkit-box-decoration-break: clone;
165
+ box-decoration-break: clone;
166
+ word-break: break-word;
167
+ white-space: pre;
168
+ padding: 3px 5px;
169
+ margin: 0 1px;
170
+ font-size: 13px;
171
+ background-color: #f1f5fd;
172
+ border: 1px solid #d7dfe9;
173
+ border-radius: 3px;
174
+ }
175
+
176
+ .prose :where(code):not(:where([class~=not-prose], [class~=not-prose] *)) {
177
+ font-weight: 500;
178
+ font-size: 0.8em;
179
+ font-variant-ligatures: none;
180
+ }
181
+
182
+ .vp-doc.prose h1 > code,
183
+ .vp-doc.prose h2 > code,
184
+ .vp-doc.prose h3 > code,
185
+ .vp-doc.prose h4 > code,
186
+ .vp-doc.prose h5 > code,
187
+ .vp-doc.prose h6 > code {
188
+ font-size: 0.75em !important;
189
+ line-height: inherit !important;
190
+ }
191
+
192
+ .prose :where(code):not(:where([class~=not-prose], [class~=not-prose] *))::before,
193
+ .prose :where(code):not(:where([class~=not-prose], [class~=not-prose] *))::after {
194
+ content: none;
195
+ }
196
+
197
+ .vp-doc .custom-block {
198
+ @apply my-4 overflow-hidden rounded-lg border px-5 py-4;
199
+ }
200
+
201
+ .vp-doc .custom-block p {
202
+ @apply min-w-0 w-full text-sm;
203
+ }
204
+
205
+ .vp-doc .custom-block p code,
206
+ .vp-doc .custom-block p kbd,
207
+ .vp-doc .custom-block p a,
208
+ .vp-doc .custom-block p strong {
209
+ color: currentColor !important;
210
+ }
211
+
212
+ .vp-doc .custom-block p a {
213
+ border-color: currentColor;
214
+ }
215
+
216
+ .vp-doc .custom-block p kbd {
217
+ background: var(--background-light);
218
+ }
219
+
220
+ .vp-doc .custom-block>.custom-block-title {
221
+ display: none;
222
+ }
223
+
224
+ .vp-doc .custom-block> :nth-child(2) {
225
+ margin-top: 0;
226
+ }
227
+
228
+ .vp-doc .custom-block> :last-child {
229
+ margin-bottom: 0;
230
+ }
231
+
232
+ .vp-doc .custom-block.note {
233
+ @apply border-slate-300 bg-slate-50 text-slate-800;
234
+ }
235
+
236
+ .vp-doc .custom-block.tip {
237
+ @apply border-blue-200 bg-blue-50 text-blue-800;
238
+ }
239
+
240
+ .vp-doc .custom-block.warning {
241
+ @apply border-yellow-300 bg-yellow-50 text-yellow-800;
242
+ }
243
+
244
+ .vp-doc .custom-block.important {
245
+ @apply border-emerald-200 bg-emerald-50 text-emerald-800;
246
+ }
247
+
248
+ .vp-doc .custom-block.caution {
249
+ @apply border-red-200 bg-red-50 text-red-800;
250
+ }
251
+
252
+ .vp-doc div[class*='language-'],
253
+ .vp-doc .vp-code-group {
254
+ --code-block-inline-padding: 1rem;
255
+ --code-block-line-number-width: 1.25rem;
256
+ --code-block-line-number-gap: 0.75rem;
257
+ position: relative;
258
+ margin: 1.25rem 0 1.5rem;
259
+ overflow: hidden;
260
+ border: 1px solid #d7dfe9;
261
+ border-radius: 0.5rem;
262
+ background: #ffffff;
263
+ }
264
+
265
+ .vp-doc div[class*='language-'] pre,
266
+ .vp-doc div[class*='language-'] code {
267
+ direction: ltr;
268
+ text-align: left;
269
+ white-space: pre;
270
+ word-spacing: normal;
271
+ word-break: normal;
272
+ word-wrap: normal;
273
+ -moz-tab-size: 4;
274
+ -o-tab-size: 4;
275
+ tab-size: 4;
276
+ -webkit-hyphens: none;
277
+ hyphens: none;
278
+ }
279
+
280
+ .vp-doc div[class*='language-'] pre {
281
+ position: relative;
282
+ z-index: 1;
283
+ margin: 0;
284
+ padding: 1rem 0 1.125rem;
285
+ overflow-x: auto;
286
+ background: transparent;
287
+ }
288
+
289
+ .vp-doc div[class*='language-'] code {
290
+ display: block;
291
+ width: fit-content;
292
+ min-width: 100%;
293
+ padding: 0 var(--code-block-inline-padding);
294
+ color: #334155;
295
+ line-height: 1.7;
296
+ font-size: 14px;
297
+ white-space: normal;
298
+ }
299
+
300
+ .vp-doc div[class*='language-'] code span {
301
+ color: var(--shiki-light, inherit);
302
+ }
303
+
304
+ .vp-doc div[class*='language-'] code .line {
305
+ display: block;
306
+ width: 100%;
307
+ min-height: 1.7em;
308
+ white-space: pre;
309
+ }
310
+
311
+ /* Shiki wraps blank lines as <span class="line"><span></span></span>, so :empty never matches. */
312
+ .vp-doc div[class*='language-'] code .line:empty::before,
313
+ .vp-doc div[class*='language-'] code .line:has(> span:only-child:empty)::before {
314
+ content: '\00a0';
315
+ }
316
+
317
+ .vp-doc div[class*='language-'].line-numbers-mode code {
318
+ padding-left: calc(var(--code-block-inline-padding) + var(--code-block-line-number-width) + var(--code-block-line-number-gap));
319
+ }
320
+
321
+ .vp-doc div[class*='language-'].line-numbers-mode .line-numbers-wrapper {
322
+ position: absolute;
323
+ top: 1rem;
324
+ z-index: 2;
325
+ width: var(--code-block-line-number-width);
326
+ color: #94a3b8;
327
+ text-align: right;
328
+ font-size: 14px;
329
+ line-height: 1.7;
330
+ font-variant-numeric: tabular-nums;
331
+ user-select: none;
332
+ pointer-events: none;
333
+ }
334
+
335
+ .vp-doc div[class*='language-'].line-numbers-mode .line-numbers-wrapper .line-number {
336
+ display: block;
337
+ }
338
+
339
+ .vp-doc div[class*='language-'].line-numbers-mode .line-numbers-wrapper br {
340
+ display: none;
341
+ }
342
+
343
+ .vp-doc div[class*='language-'] .line.highlighted {
344
+ margin: 0 calc(var(--code-block-inline-padding) * -1);
345
+ padding-right: var(--code-block-inline-padding);
346
+ padding-left: var(--code-block-inline-padding);
347
+ width: calc(100% + (var(--code-block-inline-padding) * 2));
348
+ background: #f1f5f9;
349
+ }
350
+
351
+ .vp-doc div[class*='language-'].line-numbers-mode .line.highlighted {
352
+ padding-left: calc(var(--code-block-inline-padding) + var(--code-block-line-number-width) + var(--code-block-line-number-gap));
353
+ }
354
+
355
+ .vp-doc div[class*='language-'] .line.highlighted.warning {
356
+ background: #fefce8;
357
+ }
358
+
359
+ .vp-doc div[class*='language-'] .line.highlighted.error {
360
+ background: #fef2f2;
361
+ }
362
+
363
+ .vp-doc div[class*='language-'] .line.diff.add,
364
+ .vp-doc div[class*='language-'] .line.diff.remove {
365
+ margin: 0 calc(var(--code-block-inline-padding) * -1);
366
+ padding-right: var(--code-block-inline-padding);
367
+ padding-left: var(--code-block-inline-padding);
368
+ width: calc(100% + (var(--code-block-inline-padding) * 2));
369
+ }
370
+
371
+ .vp-doc div[class*='language-'].line-numbers-mode .line.diff.add,
372
+ .vp-doc div[class*='language-'].line-numbers-mode .line.diff.remove {
373
+ padding-left: calc(var(--code-block-inline-padding) + var(--code-block-line-number-width) + var(--code-block-line-number-gap));
374
+ }
375
+
376
+ .vp-doc div[class*='language-'] .line.diff.add {
377
+ background: #eefbf3;
378
+ }
379
+
380
+ .vp-doc div[class*='language-'] .line.diff.remove {
381
+ background: #fef2f2;
382
+ }
383
+
384
+ .vp-doc div[class*='language-']>span.lang {
385
+ display: none;
386
+ }
387
+
388
+ .vp-doc [class*='language-']>button.copy {
389
+ position: absolute;
390
+ top: 0.875rem;
391
+ right: 1rem;
392
+ z-index: 3;
393
+ display: inline-flex;
394
+ align-items: center;
395
+ justify-content: center;
396
+ width: 1.75rem;
397
+ height: 1.75rem;
398
+ padding: 0;
399
+ border: 0;
400
+ border-radius: 0;
401
+ background: transparent;
402
+ color: #94a3b8;
403
+ opacity: 1;
404
+ cursor: pointer;
405
+ transition: color 0.15s ease;
406
+ }
407
+
408
+ .docs-copy-button__icon {
409
+ width: 1rem;
410
+ height: 1rem;
411
+ color: currentColor;
412
+ transition: color 0.15s ease;
413
+ }
414
+
415
+ .docs-copy-button__icon--copied {
416
+ display: none;
417
+ }
418
+
419
+ .vp-doc [class*='language-']>button.copy:hover,
420
+ .vp-doc [class*='language-']>button.copy:focus,
421
+ .vp-doc [class*='language-']>button.copy.copied {
422
+ color: #64748b;
423
+ }
424
+
425
+ .vp-doc [class*='language-']>button.copy.copied {
426
+ color: #166534;
427
+ }
428
+
429
+ .vp-doc [class*='language-']>button.copy.copied .docs-copy-button__icon {
430
+ display: none;
431
+ }
432
+
433
+ .vp-doc [class*='language-']>button.copy.copied .docs-copy-button__icon--copied {
434
+ display: block;
435
+ }
436
+
437
+ .vp-code-group {
438
+ padding-top: 0;
439
+ }
440
+
441
+ .vp-code-group .tabs {
442
+ display: flex;
443
+ align-items: center;
444
+ gap: 0.25rem;
445
+ overflow-x: auto;
446
+ overflow-y: hidden;
447
+ border-bottom: 1px solid #d7dfe9;
448
+ padding: 0.5rem 0.625rem 0;
449
+ scrollbar-width: none;
450
+ -ms-overflow-style: none;
451
+ }
452
+
453
+ .vp-code-group .tabs::-webkit-scrollbar {
454
+ display: none;
455
+ }
456
+
457
+ .vp-code-group .tabs input {
458
+ position: fixed;
459
+ opacity: 0;
460
+ pointer-events: none;
461
+ }
462
+
463
+ .vp-code-group .tabs label {
464
+ position: relative;
465
+ display: inline-flex;
466
+ align-items: center;
467
+ padding: 0.375rem 0.5rem 0.5625rem;
468
+ font-size: 0.8125rem;
469
+ line-height: 1rem;
470
+ font-weight: 500;
471
+ color: #64748b;
472
+ white-space: nowrap;
473
+ cursor: pointer;
474
+ transition: color 0.15s ease;
475
+ }
476
+
477
+ .vp-code-group .tabs label::after {
478
+ content: "";
479
+ position: absolute;
480
+ right: 0.375rem;
481
+ bottom: -1px;
482
+ left: 0.375rem;
483
+ height: 2px;
484
+ border-radius: 9999px;
485
+ background: transparent;
486
+ transition: background-color 0.15s ease;
487
+ }
488
+
489
+ .vp-code-group .tabs label:hover {
490
+ color: #334155;
491
+ }
492
+
493
+ .vp-code-group .tabs input:checked+label {
494
+ color: var(--docs-primary);
495
+ }
496
+
497
+ .vp-code-group .tabs input:checked+label::after {
498
+ background-color: var(--docs-primary);
499
+ }
500
+
501
+ .vp-code-group div[class*='language-'],
502
+ .vp-block {
503
+ display: none;
504
+ margin: 0;
505
+ border: 0;
506
+ border-radius: 0;
507
+ box-shadow: none;
508
+ }
509
+
510
+ .vp-code-group div[class*='language-'].active,
511
+ .vp-block.active {
512
+ display: block;
513
+ }
514
+
515
+ .VPLocalSearchBox input,
516
+ .VPLocalSearchBox button {
517
+ font: inherit;
518
+ color: inherit;
519
+ border: 0;
520
+ outline: 0;
521
+ background: transparent;
522
+ box-shadow: none;
523
+ appearance: none;
524
+ -webkit-appearance: none;
525
+ }
526
+
527
+ .VPLocalSearchBox input:focus,
528
+ .VPLocalSearchBox button:focus {
529
+ outline: 0;
530
+ box-shadow: none;
531
+ }
532
+
533
+ .VPLocalSearchBox .search-input::-webkit-search-decoration,
534
+ .VPLocalSearchBox .search-input::-webkit-search-cancel-button,
535
+ .VPLocalSearchBox .search-input::-webkit-search-results-button,
536
+ .VPLocalSearchBox .search-input::-webkit-search-results-decoration {
537
+ -webkit-appearance: none;
538
+ appearance: none;
539
+ }
540
+
541
+ .VPLocalSearchBox .search-actions button,
542
+ .VPLocalSearchBox .back-button {
543
+ display: inline-flex;
544
+ align-items: center;
545
+ justify-content: center;
546
+ border-radius: 0.375rem;
547
+ }
package/src/env.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ declare module '*.vue' {
4
+ import type { DefineComponent } from 'vue';
5
+
6
+ const component: DefineComponent<object, object, unknown>;
7
+ export default component;
8
+ }
package/src/index.ts ADDED
@@ -0,0 +1,22 @@
1
+ import type { App } from 'vue';
2
+ import type { Theme } from 'vitepress';
3
+ import Layout from './Layout.vue';
4
+ import 'vitepress/dist/client/theme-default/styles/icons.css';
5
+ import './custom.css';
6
+
7
+ export type VerbbDocsThemeOptions = {
8
+ enhanceApp?: (ctx: { app: App }) => void | Promise<void>;
9
+ };
10
+
11
+ export function createVerbbDocsTheme(options: VerbbDocsThemeOptions = {}): Theme {
12
+ return {
13
+ Layout,
14
+ async enhanceApp(ctx) {
15
+ await options.enhanceApp?.(ctx);
16
+ },
17
+ };
18
+ }
19
+
20
+ export { default as Layout } from './Layout.vue';
21
+ export * from './sidebar';
22
+ export { openDocsSearch, registerDocsSearch, unregisterDocsSearch } from './search';
package/src/search.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { shallowRef } from 'vue';
2
+
3
+ const openHandler = shallowRef<null | (() => void)>(null);
4
+
5
+ export function registerDocsSearch(handler: () => void) {
6
+ openHandler.value = handler;
7
+ }
8
+
9
+ export function unregisterDocsSearch(handler: () => void) {
10
+ if (openHandler.value === handler) {
11
+ openHandler.value = null;
12
+ }
13
+ }
14
+
15
+ export function openDocsSearch() {
16
+ openHandler.value?.();
17
+ }