starlight-telescope 0.0.1 → 0.1.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/package.json +3 -3
- package/src/libs/modal.ts +43 -43
- package/src/styles/telescope.css +662 -662
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-present, frostybee
|
|
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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starlight-telescope",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Quickly navigate to any page in your Starlight docs with fuzzy search and keyboard-first navigation.",
|
|
6
6
|
"author": "frostybee",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"navigation",
|
|
51
51
|
"withastro",
|
|
52
52
|
"command-palette"
|
|
53
|
-
]
|
|
54
|
-
}
|
|
53
|
+
]
|
|
54
|
+
}
|
package/src/libs/modal.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
export function getModalHTML(): string {
|
|
2
|
-
return `
|
|
3
|
-
<dialog id="telescope-dialog" class="telescope" aria-label="Site search">
|
|
4
|
-
<div class="telescope__modal">
|
|
5
|
-
<button class="telescope__close-button" id="telescope-close-button" aria-label="Close">
|
|
6
|
-
<svg aria-hidden="true" viewBox="0 0 24 24"><path d="M18 6L6 18M6 6l12 12" stroke-linecap="round"/></svg>
|
|
7
|
-
</button>
|
|
8
|
-
<div class="telescope__tabs" role="tablist">
|
|
9
|
-
<button class="telescope__tab telescope__tab--active" data-tab="search" role="tab" aria-selected="true" id="tab-search">Search</button>
|
|
10
|
-
<button class="telescope__tab" data-tab="recent" role="tab" aria-selected="false" id="tab-recent">Recent</button>
|
|
11
|
-
</div>
|
|
12
|
-
<div class="telescope__search-header">
|
|
13
|
-
<input id="telescope-search-input" class="telescope__search-input" type="text"
|
|
14
|
-
role="combobox"
|
|
15
|
-
aria-expanded="true"
|
|
16
|
-
aria-autocomplete="list"
|
|
17
|
-
aria-haspopup="listbox"
|
|
18
|
-
aria-controls="telescope-results"
|
|
19
|
-
aria-activedescendant=""
|
|
20
|
-
placeholder="Search pages..." autocomplete="off" spellcheck="false">
|
|
21
|
-
</div>
|
|
22
|
-
<div id="telescope-search-section" class="telescope__section telescope__section--active" role="tabpanel" aria-labelledby="tab-search">
|
|
23
|
-
<div id="telescope-loading" class="telescope__loading">
|
|
24
|
-
<div class="telescope__spinner"></div>
|
|
25
|
-
<span>Loading pages...</span>
|
|
26
|
-
</div>
|
|
27
|
-
<ul id="telescope-results" class="telescope__results" role="listbox" aria-label="Search results"></ul>
|
|
28
|
-
</div>
|
|
29
|
-
<div id="telescope-recent-section" class="telescope__section" role="tabpanel" aria-labelledby="tab-recent">
|
|
30
|
-
<ul id="telescope-recent-results" class="telescope__results" role="listbox" aria-label="Recent pages"></ul>
|
|
31
|
-
</div>
|
|
32
|
-
<div id="telescope-live-region" class="sr-only" aria-live="polite" aria-atomic="true"></div>
|
|
33
|
-
<div class="telescope__footer">
|
|
34
|
-
<div class="telescope__shortcuts">
|
|
35
|
-
<span><kbd>↑</kbd><kbd>↓</kbd> navigate</span>
|
|
36
|
-
<span><kbd>↵</kbd> select</span>
|
|
37
|
-
<span><kbd>Space</kbd> pin</span>
|
|
38
|
-
<span><kbd>Esc</kbd> close</span>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
</dialog>`;
|
|
43
|
-
}
|
|
1
|
+
export function getModalHTML(): string {
|
|
2
|
+
return `
|
|
3
|
+
<dialog id="telescope-dialog" class="telescope" aria-label="Site search">
|
|
4
|
+
<div class="telescope__modal">
|
|
5
|
+
<button class="telescope__close-button" id="telescope-close-button" aria-label="Close">
|
|
6
|
+
<svg aria-hidden="true" viewBox="0 0 24 24"><path d="M18 6L6 18M6 6l12 12" stroke-linecap="round"/></svg>
|
|
7
|
+
</button>
|
|
8
|
+
<div class="telescope__tabs" role="tablist">
|
|
9
|
+
<button class="telescope__tab telescope__tab--active" data-tab="search" role="tab" aria-selected="true" id="tab-search">Search</button>
|
|
10
|
+
<button class="telescope__tab" data-tab="recent" role="tab" aria-selected="false" id="tab-recent">Recent</button>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="telescope__search-header">
|
|
13
|
+
<input id="telescope-search-input" class="telescope__search-input" type="text"
|
|
14
|
+
role="combobox"
|
|
15
|
+
aria-expanded="true"
|
|
16
|
+
aria-autocomplete="list"
|
|
17
|
+
aria-haspopup="listbox"
|
|
18
|
+
aria-controls="telescope-results"
|
|
19
|
+
aria-activedescendant=""
|
|
20
|
+
placeholder="Search pages..." autocomplete="off" spellcheck="false">
|
|
21
|
+
</div>
|
|
22
|
+
<div id="telescope-search-section" class="telescope__section telescope__section--active" role="tabpanel" aria-labelledby="tab-search">
|
|
23
|
+
<div id="telescope-loading" class="telescope__loading">
|
|
24
|
+
<div class="telescope__spinner"></div>
|
|
25
|
+
<span>Loading pages...</span>
|
|
26
|
+
</div>
|
|
27
|
+
<ul id="telescope-results" class="telescope__results" role="listbox" aria-label="Search results"></ul>
|
|
28
|
+
</div>
|
|
29
|
+
<div id="telescope-recent-section" class="telescope__section" role="tabpanel" aria-labelledby="tab-recent">
|
|
30
|
+
<ul id="telescope-recent-results" class="telescope__results" role="listbox" aria-label="Recent pages"></ul>
|
|
31
|
+
</div>
|
|
32
|
+
<div id="telescope-live-region" class="sr-only" aria-live="polite" aria-atomic="true"></div>
|
|
33
|
+
<div class="telescope__footer">
|
|
34
|
+
<div class="telescope__shortcuts">
|
|
35
|
+
<span><kbd>↑</kbd><kbd>↓</kbd> navigate</span>
|
|
36
|
+
<span><kbd>↵</kbd> select</span>
|
|
37
|
+
<span><kbd>Space</kbd> pin</span>
|
|
38
|
+
<span><kbd>Esc</kbd> close</span>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</dialog>`;
|
|
43
|
+
}
|