starlight-telescope 0.0.1

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.
@@ -0,0 +1,662 @@
1
+ /* Telescope Search Modal Styles - Starlight Native */
2
+ /* Using BEM naming convention: telescope__element--modifier */
3
+
4
+ /* Map to Starlight's design tokens for automatic theme adaptation */
5
+ :root {
6
+ /* Backgrounds - use Starlight's nav/bg colors */
7
+ --telescope-overlay-bg: var(--sl-color-backdrop-overlay, rgba(1, 4, 9, 0.8));
8
+ --telescope-modal-bg: var(--sl-color-bg-nav, #161b22);
9
+ --telescope-modal-bg-alt: var(--sl-color-bg, #0d1117);
10
+
11
+ /* Accent - inherits site's configured accent color */
12
+ --telescope-accent: var(--sl-color-accent, #0969da);
13
+ --telescope-accent-low: var(--sl-color-accent-low, rgba(9, 105, 218, 0.2));
14
+ --telescope-accent-high: var(--sl-color-accent-high, #58a6ff);
15
+
16
+ /* Text - uses Starlight's text hierarchy */
17
+ --telescope-text-primary: var(--sl-color-white, #e6edf3);
18
+ --telescope-text-secondary: var(--sl-color-gray-3, #7d8590);
19
+
20
+ /* Borders - uses Starlight's hairline colors */
21
+ --telescope-border: var(--sl-color-hairline-light, #30363d);
22
+ --telescope-border-active: var(--sl-color-gray-5, #21262d);
23
+
24
+ /* Feature colors - use Starlight semantic colors */
25
+ --telescope-pin-color: var(--sl-color-purple, #8250df);
26
+ --telescope-tag-color: var(--sl-color-green, #3fb950);
27
+
28
+ /* Hover/selected states with transparency */
29
+ --telescope-accent-hover: color-mix(in srgb, var(--telescope-accent) 10%, transparent);
30
+ --telescope-accent-selected: color-mix(in srgb, var(--telescope-accent) 18%, transparent);
31
+ }
32
+
33
+ /* Light mode overrides - explicit light colors */
34
+ :root[data-theme='light'] {
35
+ /* Light backgrounds */
36
+ --telescope-overlay-bg: rgba(175, 184, 193, 0.5);
37
+ --telescope-modal-bg: #ffffff;
38
+ --telescope-modal-bg-alt: #f6f8fa;
39
+
40
+ /* Dark text for light backgrounds */
41
+ --telescope-text-primary: #1f2328;
42
+ --telescope-text-secondary: #57606a;
43
+
44
+ /* Borders */
45
+ --telescope-border: #d0d7de;
46
+ --telescope-border-active: #afb8c1;
47
+
48
+ /* Accent colors - darker for light mode readability */
49
+ --telescope-accent: #0969da;
50
+ --telescope-accent-high: #0550ae;
51
+ --telescope-accent-low: #ddf4ff;
52
+ --telescope-accent-hover: rgba(9, 105, 218, 0.1);
53
+ --telescope-accent-selected: rgba(9, 105, 218, 0.15);
54
+
55
+ /* Feature colors - darker variants */
56
+ --telescope-pin-color: #8250df;
57
+ --telescope-tag-color: #1a7f37;
58
+ }
59
+
60
+ /* Trigger Button */
61
+ .telescope__trigger-btn {
62
+ display: flex;
63
+ align-items: center;
64
+ gap: 0.5rem;
65
+ padding: 0.5rem;
66
+ background: none;
67
+ border: none;
68
+ color: var(--telescope-text-secondary);
69
+ cursor: pointer;
70
+ border-radius: 0.5rem;
71
+ }
72
+
73
+ .telescope__trigger-btn:hover {
74
+ color: var(--telescope-accent);
75
+ background: var(--telescope-accent-hover);
76
+ }
77
+
78
+ .telescope__trigger-btn:focus-visible {
79
+ outline: 2px solid var(--telescope-accent);
80
+ outline-offset: 2px;
81
+ }
82
+
83
+ .telescope__shortcut {
84
+ display: none;
85
+ align-items: center;
86
+ gap: 0.125rem;
87
+ margin-inline-start: 0.5rem;
88
+ }
89
+
90
+ .telescope__shortcut kbd {
91
+ font-family: var(--__sl-font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
92
+ font-size: var(--sl-text-xs, 0.8125rem);
93
+ background-color: var(--telescope-border-active);
94
+ border: 1px solid var(--telescope-border);
95
+ border-radius: 0.25rem;
96
+ padding: 0.125rem 0.375rem;
97
+ color: var(--telescope-text-secondary);
98
+ }
99
+
100
+ @media (min-width: 50rem) {
101
+ .telescope__shortcut.sl-hidden.md\:sl-flex {
102
+ display: flex;
103
+ }
104
+ }
105
+
106
+ /* Animations */
107
+ @keyframes telescopeFadeIn {
108
+ from { opacity: 0; }
109
+ to { opacity: 1; }
110
+ }
111
+
112
+ @keyframes telescopeSlideIn {
113
+ from {
114
+ transform: translateY(-8px);
115
+ opacity: 0;
116
+ }
117
+ to {
118
+ transform: translateY(0);
119
+ opacity: 1;
120
+ }
121
+ }
122
+
123
+ @keyframes telescopeSpin {
124
+ to { transform: rotate(360deg); }
125
+ }
126
+
127
+ /* Dialog Element (Block) */
128
+ .telescope {
129
+ border: none;
130
+ padding: 0;
131
+ background: transparent;
132
+ max-width: 100vw;
133
+ max-height: 100vh;
134
+ width: 100%;
135
+ height: 100%;
136
+ position: fixed;
137
+ justify-content: center;
138
+ align-items: flex-start;
139
+ padding-top: 10vh;
140
+ margin: 0;
141
+ }
142
+
143
+ .telescope[open] {
144
+ display: flex;
145
+ }
146
+
147
+ .telescope::backdrop {
148
+ background-color: var(--telescope-overlay-bg);
149
+ backdrop-filter: blur(8px);
150
+ -webkit-backdrop-filter: blur(8px);
151
+ }
152
+
153
+ /* Motion preferences */
154
+ @media (prefers-reduced-motion: no-preference) {
155
+ .telescope[open] {
156
+ animation: telescopeFadeIn 0.2s ease-out;
157
+ }
158
+
159
+ .telescope[open]::backdrop {
160
+ animation: telescopeFadeIn 0.2s ease-out;
161
+ }
162
+
163
+ .telescope[open] .telescope__modal {
164
+ animation: telescopeSlideIn 0.2s ease-out;
165
+ }
166
+
167
+ .telescope__trigger-btn,
168
+ .telescope__result-item,
169
+ .telescope__close-button,
170
+ .telescope__tab,
171
+ .telescope__search-input,
172
+ .telescope__pin-button,
173
+ .telescope__clear-btn {
174
+ transition: all 0.15s ease;
175
+ }
176
+
177
+ .telescope__spinner {
178
+ animation: telescopeSpin 0.8s linear infinite;
179
+ }
180
+ }
181
+
182
+ @media (prefers-reduced-motion: reduce) {
183
+ .telescope[open],
184
+ .telescope[open]::backdrop,
185
+ .telescope[open] .telescope__modal,
186
+ .telescope__trigger-btn,
187
+ .telescope__result-item,
188
+ .telescope__close-button,
189
+ .telescope__tab,
190
+ .telescope__search-input,
191
+ .telescope__pin-button,
192
+ .telescope__clear-btn {
193
+ animation: none;
194
+ transition: none;
195
+ }
196
+
197
+ .telescope__spinner {
198
+ animation: none;
199
+ }
200
+ }
201
+
202
+ /* Main Modal */
203
+ .telescope__modal {
204
+ font-family: var(--__sl-font, system-ui, sans-serif);
205
+ width: 640px;
206
+ max-width: 95%;
207
+ max-height: 80vh;
208
+ background-color: var(--telescope-modal-bg);
209
+ border-radius: 12px;
210
+ border: 1px solid var(--telescope-border);
211
+ box-shadow: var(--sl-shadow-lg, 0 25px 50px -12px rgba(0, 0, 0, 0.5));
212
+ overflow: hidden;
213
+ display: flex;
214
+ flex-direction: column;
215
+ position: relative;
216
+ }
217
+
218
+ /* Close Button */
219
+ .telescope__close-button {
220
+ position: absolute;
221
+ top: 10px;
222
+ right: 10px;
223
+ width: 32px;
224
+ height: 32px;
225
+ border-radius: 6px;
226
+ background: none;
227
+ border: none;
228
+ color: var(--telescope-text-secondary);
229
+ cursor: pointer;
230
+ display: flex;
231
+ align-items: center;
232
+ justify-content: center;
233
+ z-index: 100;
234
+ padding: 0;
235
+ }
236
+
237
+ .telescope__close-button svg {
238
+ width: 18px;
239
+ height: 18px;
240
+ stroke: currentColor;
241
+ stroke-width: 2;
242
+ fill: none;
243
+ }
244
+
245
+ .telescope__close-button:hover {
246
+ background-color: var(--telescope-border-active);
247
+ color: var(--sl-color-red, #f85149);
248
+ }
249
+
250
+ .telescope__close-button:focus-visible {
251
+ outline: 2px solid var(--telescope-accent);
252
+ outline-offset: 2px;
253
+ }
254
+
255
+ /* Tabs */
256
+ .telescope__tabs {
257
+ display: flex;
258
+ border-bottom: 1px solid var(--telescope-border);
259
+ background-color: var(--telescope-modal-bg-alt);
260
+ padding: 0 12px;
261
+ }
262
+
263
+ .telescope__tab {
264
+ padding: 12px 16px;
265
+ border: none;
266
+ background: none;
267
+ cursor: pointer;
268
+ font-family: var(--__sl-font, system-ui, sans-serif);
269
+ font-size: var(--sl-text-sm, 0.875rem);
270
+ font-weight: 500;
271
+ color: var(--telescope-text-secondary);
272
+ position: relative;
273
+ border-radius: 6px 6px 0 0;
274
+ margin: 4px 2px 0;
275
+ }
276
+
277
+ .telescope__tab:hover {
278
+ color: var(--telescope-accent);
279
+ background-color: var(--telescope-accent-hover);
280
+ }
281
+
282
+ .telescope__tab:focus-visible {
283
+ outline: 2px solid var(--telescope-accent);
284
+ outline-offset: -2px;
285
+ }
286
+
287
+ .telescope__tab--active {
288
+ color: var(--telescope-accent);
289
+ background-color: var(--telescope-modal-bg);
290
+ border-bottom: 2px solid var(--telescope-accent);
291
+ margin-bottom: -1px;
292
+ }
293
+
294
+ /* Search Input */
295
+ .telescope__search-header {
296
+ background-color: var(--telescope-modal-bg);
297
+ }
298
+
299
+ .telescope__search-input {
300
+ width: 100%;
301
+ padding: 16px 20px;
302
+ border: none;
303
+ border-radius: 0;
304
+ font-family: var(--__sl-font, system-ui, sans-serif);
305
+ font-size: var(--sl-text-lg, 1.125rem);
306
+ font-weight: 400;
307
+ background-color: var(--telescope-modal-bg);
308
+ color: var(--telescope-text-primary);
309
+ outline: none;
310
+ margin: 0;
311
+ display: block;
312
+ line-height: 1.4;
313
+ border-bottom: 1px solid var(--telescope-border);
314
+ }
315
+
316
+ .telescope__search-input::placeholder {
317
+ color: var(--telescope-text-secondary);
318
+ }
319
+
320
+ .telescope__search-input:focus {
321
+ border-bottom-color: var(--telescope-accent);
322
+ box-shadow: 0 1px 0 var(--telescope-accent);
323
+ }
324
+
325
+ /* Results Container */
326
+ .telescope__results {
327
+ list-style: none;
328
+ margin: 0;
329
+ padding: 6px 0;
330
+ max-height: 55vh;
331
+ overflow-y: auto;
332
+ background-color: var(--telescope-modal-bg);
333
+ }
334
+
335
+ /* Result Items */
336
+ .telescope__result-item {
337
+ display: flex;
338
+ padding: 10px 16px;
339
+ cursor: pointer;
340
+ border-left: 3px solid transparent;
341
+ align-items: center;
342
+ justify-content: space-between;
343
+ position: relative;
344
+ }
345
+
346
+ /* Disable pointer events until mouse moves (prevents false hover on modal open) */
347
+ .telescope--pointer-disabled .telescope__result-item {
348
+ pointer-events: none;
349
+ }
350
+
351
+ .telescope__result-item:hover {
352
+ background-color: var(--telescope-accent-hover);
353
+ border-left-color: color-mix(in srgb, var(--telescope-accent) 40%, transparent);
354
+ }
355
+
356
+ .telescope__result-item--selected {
357
+ background-color: var(--telescope-accent-selected);
358
+ border-left-color: var(--telescope-accent);
359
+ }
360
+
361
+ .telescope__result-item:focus-visible {
362
+ outline: 2px solid var(--telescope-accent);
363
+ outline-offset: -2px;
364
+ }
365
+
366
+ .telescope__result-content-row {
367
+ flex: 1;
368
+ display: flex;
369
+ align-items: center;
370
+ gap: 12px;
371
+ overflow: hidden;
372
+ min-width: 0;
373
+ }
374
+
375
+ .telescope__result-title {
376
+ font-weight: 600;
377
+ color: var(--telescope-accent-high);
378
+ font-size: var(--sl-text-sm, 0.875rem);
379
+ line-height: 1.3;
380
+ flex: 0 0 auto;
381
+ max-width: 40%;
382
+ white-space: nowrap;
383
+ overflow: hidden;
384
+ text-overflow: ellipsis;
385
+ }
386
+
387
+ .telescope__result-description {
388
+ font-size: var(--sl-text-sm, 0.875rem);
389
+ color: var(--telescope-text-primary);
390
+ flex: 1;
391
+ line-height: 1.3;
392
+ white-space: nowrap;
393
+ overflow: hidden;
394
+ text-overflow: ellipsis;
395
+ opacity: 0.75;
396
+ }
397
+
398
+ .telescope__result-tags {
399
+ display: flex;
400
+ flex-wrap: wrap;
401
+ gap: 4px;
402
+ margin-left: 8px;
403
+ }
404
+
405
+ .telescope__tag {
406
+ background-color: var(--telescope-border-active);
407
+ border-radius: 10px;
408
+ padding: 2px 8px;
409
+ font-size: var(--sl-text-2xs, 0.75rem);
410
+ color: var(--telescope-tag-color);
411
+ line-height: 1.4;
412
+ font-weight: 500;
413
+ }
414
+
415
+ /* Pin Button */
416
+ .telescope__pin-button {
417
+ background: none;
418
+ border: none;
419
+ color: var(--telescope-text-secondary);
420
+ cursor: pointer;
421
+ width: 26px;
422
+ height: 26px;
423
+ padding: 0;
424
+ display: flex;
425
+ align-items: center;
426
+ justify-content: center;
427
+ flex-shrink: 0;
428
+ margin-left: 8px;
429
+ border-radius: 4px;
430
+ opacity: 0.5;
431
+ }
432
+
433
+ .telescope__result-item:hover .telescope__pin-button,
434
+ .telescope__result-item--selected .telescope__pin-button {
435
+ opacity: 1;
436
+ }
437
+
438
+ .telescope__pin-button:hover {
439
+ color: var(--telescope-pin-color);
440
+ background-color: color-mix(in srgb, var(--telescope-pin-color) 15%, transparent);
441
+ }
442
+
443
+ .telescope__pin-button:focus-visible {
444
+ outline: 2px solid var(--telescope-accent);
445
+ outline-offset: 2px;
446
+ }
447
+
448
+ .telescope__pin-button--pinned {
449
+ color: var(--telescope-pin-color);
450
+ background-color: color-mix(in srgb, var(--telescope-pin-color) 20%, transparent);
451
+ opacity: 1;
452
+ }
453
+
454
+ .telescope__pin-button svg {
455
+ width: 14px;
456
+ height: 14px;
457
+ fill: currentColor;
458
+ }
459
+
460
+ /* Section Separators */
461
+ .telescope__section-separator {
462
+ display: flex;
463
+ justify-content: space-between;
464
+ align-items: center;
465
+ padding: 10px 16px 6px;
466
+ font-size: var(--sl-text-2xs, 0.75rem);
467
+ font-weight: 600;
468
+ color: var(--telescope-text-secondary);
469
+ background-color: var(--telescope-modal-bg-alt);
470
+ border-top: 1px solid var(--telescope-border);
471
+ text-transform: uppercase;
472
+ letter-spacing: 0.05em;
473
+ }
474
+
475
+ /* No Results */
476
+ .telescope__no-results {
477
+ padding: 32px 16px;
478
+ text-align: center;
479
+ color: var(--telescope-text-secondary);
480
+ font-size: var(--sl-text-sm, 0.875rem);
481
+ }
482
+
483
+ /* More Results Indicator */
484
+ .telescope__more-results {
485
+ padding: 12px 16px;
486
+ text-align: center;
487
+ color: var(--telescope-text-secondary);
488
+ font-size: var(--sl-text-xs, 0.8125rem);
489
+ font-style: italic;
490
+ background-color: var(--telescope-modal-bg-alt);
491
+ border-top: 1px solid var(--telescope-border);
492
+ }
493
+
494
+ /* Footer */
495
+ .telescope__footer {
496
+ padding: 10px 16px;
497
+ border-top: 1px solid var(--telescope-border);
498
+ background-color: var(--telescope-modal-bg-alt);
499
+ }
500
+
501
+ .telescope__shortcuts {
502
+ display: flex;
503
+ justify-content: center;
504
+ gap: 16px;
505
+ font-size: var(--sl-text-xs, 0.8125rem);
506
+ color: var(--telescope-text-secondary);
507
+ }
508
+
509
+ .telescope__shortcuts span {
510
+ display: flex;
511
+ align-items: center;
512
+ gap: 4px;
513
+ }
514
+
515
+ /* Keyboard styling */
516
+ .telescope__modal kbd {
517
+ font-family: var(--__sl-font-mono, ui-monospace, monospace);
518
+ font-size: var(--sl-text-2xs, 0.75rem);
519
+ background-color: var(--telescope-border-active);
520
+ border: 1px solid var(--telescope-border);
521
+ border-radius: 4px;
522
+ box-shadow: 0 1px 0 var(--telescope-modal-bg-alt);
523
+ color: var(--telescope-text-primary);
524
+ display: inline-block;
525
+ line-height: 1.2;
526
+ padding: 2px 5px;
527
+ margin: 0 1px;
528
+ }
529
+
530
+ /* Sections */
531
+ .telescope__section {
532
+ display: none;
533
+ flex: 1;
534
+ overflow-y: auto;
535
+ background-color: var(--telescope-modal-bg);
536
+ scrollbar-width: thin;
537
+ scrollbar-color: var(--telescope-border) var(--telescope-modal-bg);
538
+ }
539
+
540
+ .telescope__section--active {
541
+ display: block;
542
+ }
543
+
544
+ /* Custom Scrollbars */
545
+ .telescope__results::-webkit-scrollbar,
546
+ .telescope__section::-webkit-scrollbar {
547
+ width: 6px;
548
+ }
549
+
550
+ .telescope__results::-webkit-scrollbar-track,
551
+ .telescope__section::-webkit-scrollbar-track {
552
+ background: var(--telescope-modal-bg);
553
+ }
554
+
555
+ .telescope__results::-webkit-scrollbar-thumb,
556
+ .telescope__section::-webkit-scrollbar-thumb {
557
+ background: var(--telescope-border);
558
+ border-radius: 3px;
559
+ }
560
+
561
+ .telescope__results::-webkit-scrollbar-thumb:hover,
562
+ .telescope__section::-webkit-scrollbar-thumb:hover {
563
+ background: var(--telescope-text-secondary);
564
+ }
565
+
566
+ /* Screen reader only */
567
+ .sr-only {
568
+ position: absolute;
569
+ width: 1px;
570
+ height: 1px;
571
+ padding: 0;
572
+ margin: -1px;
573
+ overflow: hidden;
574
+ clip: rect(0, 0, 0, 0);
575
+ white-space: nowrap;
576
+ border: 0;
577
+ }
578
+
579
+ /* Loading Indicator */
580
+ .telescope__loading {
581
+ display: flex;
582
+ align-items: center;
583
+ justify-content: center;
584
+ gap: 0.75rem;
585
+ padding: 2.5rem;
586
+ color: var(--telescope-text-secondary);
587
+ font-size: var(--sl-text-sm, 0.875rem);
588
+ }
589
+
590
+ .telescope__spinner {
591
+ width: 18px;
592
+ height: 18px;
593
+ border: 2px solid var(--telescope-border);
594
+ border-top-color: var(--telescope-accent);
595
+ border-radius: 50%;
596
+ }
597
+
598
+ /* Search Result Highlighting */
599
+ .telescope__highlight {
600
+ background-color: rgba(250, 204, 21, 0.4);
601
+ color: var(--telescope-text-primary);
602
+ border-radius: 2px;
603
+ padding: 0 2px;
604
+ }
605
+
606
+ /* Clear Button */
607
+ .telescope__clear-btn {
608
+ background: transparent;
609
+ border: none;
610
+ color: var(--telescope-text-secondary);
611
+ font-size: var(--sl-text-2xs, 0.75rem);
612
+ font-weight: 500;
613
+ cursor: pointer;
614
+ padding: 6px 10px;
615
+ min-height: 32px;
616
+ border-radius: 4px;
617
+ text-transform: none;
618
+ letter-spacing: normal;
619
+ }
620
+
621
+ .telescope__clear-btn:hover {
622
+ color: var(--telescope-accent);
623
+ background: var(--telescope-accent-hover);
624
+ }
625
+
626
+ .telescope__clear-btn:focus-visible {
627
+ outline: 2px solid var(--telescope-accent);
628
+ outline-offset: 2px;
629
+ }
630
+
631
+ /* Responsive Design */
632
+ @media (max-width: 50rem) {
633
+ .telescope {
634
+ padding-top: 5vh;
635
+ }
636
+
637
+ .telescope__modal {
638
+ width: 100%;
639
+ max-width: 100%;
640
+ max-height: 90vh;
641
+ border-radius: 10px;
642
+ }
643
+
644
+ .telescope__search-input {
645
+ font-size: 16px; /* Prevent iOS zoom */
646
+ padding: 14px 16px;
647
+ }
648
+
649
+ .telescope__result-content-row {
650
+ gap: 10px;
651
+ }
652
+
653
+ .telescope__result-title {
654
+ max-width: 45%;
655
+ }
656
+
657
+ .telescope__shortcuts {
658
+ gap: 10px;
659
+ flex-wrap: wrap;
660
+ justify-content: center;
661
+ }
662
+ }