starlight-theme-celestia 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 (68) hide show
  1. package/lib/aside.css +13 -0
  2. package/lib/badge.css +23 -0
  3. package/lib/card.css +42 -0
  4. package/lib/fonts.css +4 -0
  5. package/lib/layer.css +31 -0
  6. package/lib/markdown.css +71 -0
  7. package/lib/shiki.css +79 -0
  8. package/lib/styles.css +6 -0
  9. package/lib/tailwind.build.css +2 -0
  10. package/lib/tailwind.css +29 -0
  11. package/lib/tailwind.gen.css +1197 -0
  12. package/lib/theme.css +94 -0
  13. package/package.json +56 -0
  14. package/src/astro.d.ts +6 -0
  15. package/src/components/Code.astro +12 -0
  16. package/src/components/CodeCopy.astro +39 -0
  17. package/src/components/CodeFile.astro +64 -0
  18. package/src/components/CodePackageManagers.astro +55 -0
  19. package/src/components/CodeTabItem.astro +13 -0
  20. package/src/components/CodeTabs.astro +67 -0
  21. package/src/components/Head.astro +7 -0
  22. package/src/components/Header.astro +91 -0
  23. package/src/components/Hero.astro +169 -0
  24. package/src/components/LanguageSelect.astro +5 -0
  25. package/src/components/LinkButton.astro +47 -0
  26. package/src/components/LinkButtonIcon.astro +22 -0
  27. package/src/components/LinkCard.astro +32 -0
  28. package/src/components/MarkdownContent.astro +22 -0
  29. package/src/components/MobileMenuFooter.astro +11 -0
  30. package/src/components/MobileMenuToggle.astro +23 -0
  31. package/src/components/MobileTableOfContents.astro +26 -0
  32. package/src/components/PageFrame.astro +50 -0
  33. package/src/components/Pagination.astro +34 -0
  34. package/src/components/PaginationLink.astro +30 -0
  35. package/src/components/Search.astro +645 -0
  36. package/src/components/SiteTitle.astro +47 -0
  37. package/src/components/SiteTitleVersioned.astro +62 -0
  38. package/src/components/SocialIcons.astro +31 -0
  39. package/src/components/ThemeProvider.astro +102 -0
  40. package/src/components/ThemeSelect.astro +188 -0
  41. package/src/components/TwoColumnContent.astro +44 -0
  42. package/src/components/VersionSelect.astro +261 -0
  43. package/src/components/get-i18n-text.ts +39 -0
  44. package/src/components/index.ts +7 -0
  45. package/src/components/mobile-menu-toggle.ts +49 -0
  46. package/src/components/rehype-code-tabs.ts +52 -0
  47. package/src/constants.ts +7 -0
  48. package/src/content.config.ts +16 -0
  49. package/src/content.d.ts +22 -0
  50. package/src/icons/lucide-arrow-left.svg +1 -0
  51. package/src/icons/lucide-arrow-right.svg +1 -0
  52. package/src/icons/lucide-check.svg +1 -0
  53. package/src/icons/lucide-chevron-left.svg +1 -0
  54. package/src/icons/lucide-chevron-right.svg +1 -0
  55. package/src/icons/lucide-clipboard.svg +1 -0
  56. package/src/icons/lucide-menu.svg +1 -0
  57. package/src/icons/lucide-search.svg +1 -0
  58. package/src/icons/lucide-x.svg +1 -0
  59. package/src/icons/tabler-moon-filled.svg +1 -0
  60. package/src/icons/tabler-sun-high-filled.svg +1 -0
  61. package/src/index.ts +112 -0
  62. package/src/shiki-config.ts +49 -0
  63. package/src/shiki-meta-title.ts +6 -0
  64. package/src/shiki-transformer-container.ts +85 -0
  65. package/src/types.d.ts +2 -0
  66. package/src/user-options.ts +37 -0
  67. package/src/virtual-internal.d.ts +44 -0
  68. package/src/virtual-user-config.ts +44 -0
@@ -0,0 +1,47 @@
1
+ ---
2
+ import type { StarlightIcon } from '@astrojs/starlight/types'
3
+ import type { HTMLAttributes } from 'astro/types'
4
+ import LinkButtonIcon from './LinkButtonIcon.astro'
5
+
6
+ interface Props extends Omit<HTMLAttributes<'a'>, 'href'> {
7
+ href: string | URL
8
+ icon?: StarlightIcon | undefined
9
+ iconPlacement?: 'start' | 'end' | undefined
10
+ variant?: 'primary' | 'secondary' | 'minimal'
11
+ }
12
+
13
+ const {
14
+ class: className,
15
+ icon,
16
+ iconPlacement = 'end',
17
+ variant = 'primary',
18
+ ...attrs
19
+ } = Astro.props
20
+ ---
21
+
22
+ <span
23
+ class:list={[
24
+ 'not-content',
25
+ 'inline-flex items-center justify-center align-middle',
26
+ ]}
27
+ >
28
+ <a
29
+ class:list={[
30
+ 'not-content',
31
+ 'group me-2 mt-2 mb-2 inline-flex items-center justify-between gap-2 rounded-xl border border-solid border-transparent px-6 py-3 font-medium no-underline transition active:scale-97',
32
+ variant === 'primary'
33
+ ? 'bg-black text-white shadow-sm hover:bg-gray-800 hover:shadow-md dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-gray-300'
34
+ : undefined,
35
+ variant === 'secondary'
36
+ ? 'border-(--sl-color-gray-5) bg-white text-gray-700 shadow-sm hover:bg-gray-50 hover:shadow-md dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700'
37
+ : undefined,
38
+ variant === 'minimal' ? 'text-gray-700 dark:text-gray-200' : undefined,
39
+ className,
40
+ ]}
41
+ {...attrs}
42
+ >
43
+ {icon && iconPlacement === 'start' && <LinkButtonIcon icon={icon} />}
44
+ <slot />
45
+ {icon && iconPlacement === 'end' && <LinkButtonIcon icon={icon} />}
46
+ </a>
47
+ </span>
@@ -0,0 +1,22 @@
1
+ ---
2
+ import { Icon } from '@astrojs/starlight/components'
3
+ import type { StarlightIcon } from '@astrojs/starlight/types'
4
+ import ArrowRightIcon from '../icons/lucide-arrow-right.svg'
5
+ import ArrowLeftIcon from '../icons/lucide-arrow-left.svg'
6
+
7
+ interface Props {
8
+ icon: StarlightIcon
9
+ }
10
+
11
+ const { icon } = Astro.props
12
+ ---
13
+
14
+ {
15
+ icon === 'right-arrow' ? (
16
+ <ArrowRightIcon class="block size-5 transition group-hover:translate-x-1" />
17
+ ) : icon === 'left-arrow' ? (
18
+ <ArrowLeftIcon class="block size-5 transition group-hover:-translate-x-1" />
19
+ ) : (
20
+ <Icon name={icon} size="1.25rem" />
21
+ )
22
+ }
@@ -0,0 +1,32 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types'
3
+ import ArrowRightIcon from '../icons/lucide-arrow-right.svg'
4
+
5
+ interface Props extends Omit<HTMLAttributes<'a'>, 'title'> {
6
+ title: string
7
+ description?: string
8
+ }
9
+
10
+ const { title, description, class: className, ...attributes } = Astro.props
11
+ ---
12
+
13
+ <div
14
+ class:list={[
15
+ 'not-content',
16
+ 'group relative flex flex-col gap-2 rounded-xl border border-solid border-(--sl-color-gray-5) bg-white px-5 py-4 text-gray-700 shadow-sm transition hover:bg-gray-50 hover:shadow-md active:scale-99 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700',
17
+ className,
18
+ ]}
19
+ >
20
+ <a
21
+ class:list={[
22
+ 'inline-flex items-center justify-between text-lg font-semibold text-gray-700 no-underline dark:text-gray-200',
23
+ /* a11y fix for https://github.com/withastro/starlight/issues/487 */
24
+ "before:absolute before:inset-0 before:content-['']",
25
+ ]}
26
+ {...attributes}
27
+ >
28
+ <span set:html={title} />
29
+ <ArrowRightIcon class="ml-2 size-5 transition group-hover:translate-x-1" />
30
+ </a>
31
+ {description && <span set:html={description} />}
32
+ </div>
@@ -0,0 +1,22 @@
1
+ ---
2
+ import Default from '@astrojs/starlight/components/MarkdownContent.astro'
3
+ import CodeCopy from './CodeCopy.astro'
4
+ ---
5
+
6
+ <Default>
7
+ <slot />
8
+ </Default>
9
+
10
+ <style is:global>
11
+ @layer celestia {
12
+ :root .sl-markdown-content dd:not(:where(.not-content *)) {
13
+ padding-inline-start: 2rem;
14
+ }
15
+ }
16
+ </style>
17
+
18
+ <CodeCopy />
19
+ <script>
20
+ import { register } from 'shiki-twoslash-renderer/elements'
21
+ register()
22
+ </script>
@@ -0,0 +1,11 @@
1
+ ---
2
+ import LanguageSelect from 'virtual:starlight/components/LanguageSelect'
3
+ import SocialIcons from 'virtual:starlight/components/SocialIcons'
4
+ import ThemeSelect from 'virtual:starlight/components/ThemeSelect'
5
+ ---
6
+
7
+ <div class="flex items-center justify-end gap-2 py-4 print:hidden">
8
+ <SocialIcons />
9
+ <LanguageSelect />
10
+ <ThemeSelect />
11
+ </div>
@@ -0,0 +1,23 @@
1
+ ---
2
+ import MenuIcon from '../icons/lucide-menu.svg'
3
+ import XIcon from '../icons/lucide-x.svg'
4
+ ---
5
+
6
+ <celestia-mobile-menu-toggle
7
+ class="flex size-8 rounded-md p-2 text-(--sl-color-text) transition hover:bg-gray-400/30 focus-visible:outline-offset-1 active:scale-90 print:hidden"
8
+ aria-label={Astro.locals.t('menuButton.accessibleLabel')}
9
+ aria-controls="starlight__sidebar"
10
+ >
11
+ <div
12
+ class="transition-transform [body[data-mobile-menu-expanded]_&]:rotate-90"
13
+ >
14
+ <MenuIcon class="block [body[data-mobile-menu-expanded]_&]:hidden" />
15
+ <XIcon class="hidden [body[data-mobile-menu-expanded]_&]:block" />
16
+ </div>
17
+ </celestia-mobile-menu-toggle>
18
+
19
+ <script>
20
+ import { register } from './mobile-menu-toggle'
21
+
22
+ register()
23
+ </script>
@@ -0,0 +1,26 @@
1
+ ---
2
+ import Default from '@astrojs/starlight/components/MobileTableOfContents.astro'
3
+
4
+ const { toc } = Astro.locals.starlightRoute
5
+ ---
6
+
7
+ {
8
+ toc && (
9
+ <div class="[&_nav]:backdrop-blur [&_summary]:border-b-(--sl-color-hairline)">
10
+ <Default />
11
+ </div>
12
+ )
13
+ }
14
+
15
+ <script>
16
+ // Guard against duplicate 'starlight-toc' custom element registration.
17
+ // Starlight registers it from both the desktop and mobile TOC components,
18
+ // which throws on the second call. Only guard this specific element name.
19
+ const originalDefine = customElements.define.bind(customElements);
20
+ customElements.define = function(name: string, constructor: CustomElementConstructor, options?: ElementDefinitionOptions) {
21
+ if (name === 'starlight-toc' && customElements.get(name)) {
22
+ return;
23
+ }
24
+ originalDefine(name, constructor, options);
25
+ };
26
+ </script>
@@ -0,0 +1,50 @@
1
+ ---
2
+ const { hasSidebar } = Astro.locals.starlightRoute
3
+ ---
4
+
5
+ <div class="flex min-h-screen flex-col">
6
+ <header
7
+ class="fixed inset-0 z-(--sl-z-index-navbar) box-border h-(--sl-nav-height) w-full border-0 border-b border-solid border-(--sl-color-hairline) bg-(--sl-color-bg-nav) px-(--sl-nav-pad-x) py-(--sl-nav-pad-y) backdrop-blur"
8
+ >
9
+ <slot name="header" />
10
+ </header>
11
+ {
12
+ hasSidebar && (
13
+ <nav
14
+ class="sidebar print:hidden"
15
+ aria-label={Astro.locals.t('sidebarNav.accessibleLabel')}
16
+ id="celestia-sidebar-nav"
17
+ >
18
+ <div
19
+ id="starlight__sidebar"
20
+ class:list={[
21
+ 'celestia-scroll-container',
22
+
23
+ 'invisible md:visible [body[data-mobile-menu-expanded]_&]:max-md:visible',
24
+
25
+ 'fixed top-(--sl-nav-height) bottom-0 left-0 z-(--sl-z-index-menu) overflow-y-auto border-0 border-solid bg-(--sl-color-black) max-md:w-full md:w-(--sl-sidebar-width)',
26
+ ]}
27
+ >
28
+ <div
29
+ class:list={[
30
+ 'sidebar-content',
31
+ 'flex h-full min-h-max flex-col px-(--sl-sidebar-pad-x) py-4',
32
+ ]}
33
+ >
34
+ <slot name="sidebar" />
35
+ </div>
36
+ </div>
37
+ </nav>
38
+ )
39
+ }
40
+ <div class="main-frame"><slot /></div>
41
+ </div>
42
+
43
+ <style>
44
+ @layer celestia {
45
+ .main-frame {
46
+ padding-top: calc(var(--sl-nav-height) + var(--sl-mobile-toc-height));
47
+ padding-inline-start: var(--sl-content-inline-start);
48
+ }
49
+ }
50
+ </style>
@@ -0,0 +1,34 @@
1
+ ---
2
+ import PaginationLink from './PaginationLink.astro'
3
+
4
+ const { dir, pagination } = Astro.locals.starlightRoute
5
+ const { prev, next } = pagination
6
+ const isRtl = dir === 'rtl'
7
+ ---
8
+
9
+ <div
10
+ class="flex min-w-full flex-row items-stretch justify-between gap-2 px-1 pt-0 pb-6 print:hidden"
11
+ dir={dir}
12
+ >
13
+ {
14
+ prev && (
15
+ <PaginationLink
16
+ label={prev.label}
17
+ href={prev.href}
18
+ rel="prev"
19
+ side={isRtl ? 'right' : 'left'}
20
+ />
21
+ )
22
+ }
23
+ <div class="flex-1"></div>
24
+ {
25
+ next && (
26
+ <PaginationLink
27
+ label={next.label}
28
+ href={next.href}
29
+ rel="next"
30
+ side={isRtl ? 'left' : 'right'}
31
+ />
32
+ )
33
+ }
34
+ </div>
@@ -0,0 +1,30 @@
1
+ ---
2
+ import ChevronRightIcon from '../icons/lucide-chevron-right.svg'
3
+ import ChevronLeftIcon from '../icons/lucide-chevron-left.svg'
4
+
5
+ interface Props {
6
+ label: string
7
+ href: string
8
+ rel: 'next' | 'prev'
9
+ side: 'left' | 'right'
10
+ }
11
+
12
+ const { label, href, rel, side } = Astro.props
13
+ ---
14
+
15
+ <a
16
+ href={href}
17
+ rel={rel}
18
+ data-side={side}
19
+ class="group m-0 flex items-center justify-end gap-2 rounded-xl p-2 font-medium text-(--sl-color-gray-2) no-underline transition hover:text-(--sl-color-white) md:text-lg [[rel='next']]:flex-row [[rel='prev']]:flex-row-reverse"
20
+ >
21
+ <span>{label}</span>
22
+
23
+ {
24
+ side === 'right' ? (
25
+ <ChevronRightIcon class="block min-h-5 min-w-5 transition group-hover:translate-x-1" />
26
+ ) : (
27
+ <ChevronLeftIcon class="block min-h-5 min-w-5 transition group-hover:-translate-x-1" />
28
+ )
29
+ }
30
+ </a>