docus 3.0.0-beta.8 → 3.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.
Files changed (155) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +31 -9
  3. package/app/app/app.config.ts +33 -0
  4. package/app/app/app.vue +54 -0
  5. package/app/app/assets/css/main.css +5 -0
  6. package/app/app/components/IconMenuToggle.vue +81 -0
  7. package/app/app/components/OgImage/OgImageDocs.vue +76 -0
  8. package/app/app/components/OgImage/OgImageLanding.vue +73 -0
  9. package/app/app/components/app/AppFooter.vue +40 -0
  10. package/app/app/components/app/AppHeader.vue +57 -0
  11. package/app/app/components/app/AppHeaderBody.vue +13 -0
  12. package/{theme/components/globals/Logo.vue → app/app/components/app/AppHeaderCTA.vue} +1 -1
  13. package/app/app/components/app/AppHeaderCenter.vue +6 -0
  14. package/app/app/components/app/AppHeaderLogo.vue +16 -0
  15. package/app/app/components/docs/DocsAsideLeftTop.vue +3 -0
  16. package/app/app/components/docs/DocsAsideRightBottom.vue +17 -0
  17. package/app/app/components/docs/DocsPageHeaderLinks.vue +91 -0
  18. package/app/app/error.vue +42 -0
  19. package/app/app/layouts/docs.vue +25 -0
  20. package/app/app/pages/[...slug].vue +111 -0
  21. package/app/app/pages/index.vue +37 -0
  22. package/app/content.config.ts +31 -0
  23. package/app/nuxt.config.ts +41 -0
  24. package/app/nuxt.schema.ts +255 -0
  25. package/app/server/routes/raw/[...slug].md.get.ts +24 -0
  26. package/dist/main.mjs +242 -0
  27. package/package.json +66 -39
  28. package/theme/app/router.options.ts +0 -18
  29. package/theme/assets/css/fonts.css +0 -84
  30. package/theme/assets/css/main.css +0 -104
  31. package/theme/components/app/Container.vue +0 -25
  32. package/theme/components/app/Footer.vue +0 -40
  33. package/theme/components/app/MobileNav.vue +0 -85
  34. package/theme/components/app/Navbar.vue +0 -37
  35. package/theme/components/app/NavbarLogo.vue +0 -33
  36. package/theme/components/app/Page.vue +0 -7
  37. package/theme/components/app/PoweredByDocus.vue +0 -11
  38. package/theme/components/content/Alert.vue +0 -124
  39. package/theme/components/content/BlockHero.vue +0 -54
  40. package/theme/components/content/ButtonLink.vue +0 -45
  41. package/theme/components/content/Card.vue +0 -46
  42. package/theme/components/content/CardGrid.vue +0 -23
  43. package/theme/components/content/CodeBlock.vue +0 -47
  44. package/theme/components/content/CodeGroup.vue +0 -135
  45. package/theme/components/content/CopyButton.vue +0 -49
  46. package/theme/components/content/List.vue +0 -5
  47. package/theme/components/content/NeedContribution.vue +0 -23
  48. package/theme/components/content/ReadMore.vue +0 -25
  49. package/theme/components/content/Sandbox.vue +0 -102
  50. package/theme/components/content/TabsHeader.vue +0 -44
  51. package/theme/components/content/Terminal.vue +0 -64
  52. package/theme/components/content/VideoPlayer.vue +0 -115
  53. package/theme/components/dev/Debug.vue +0 -66
  54. package/theme/components/docs/DocsAside.vue +0 -21
  55. package/theme/components/docs/DocsAsideTree.vue +0 -104
  56. package/theme/components/docs/DocsHero.vue +0 -39
  57. package/theme/components/docs/DocsPage.vue +0 -21
  58. package/theme/components/docs/DocsPageContent.vue +0 -32
  59. package/theme/components/docs/DocsToc.vue +0 -77
  60. package/theme/components/globals/Icon.vue +0 -24
  61. package/theme/components/globals/NuxtImg.vue +0 -45
  62. package/theme/components/globals/SocialIcons.vue +0 -45
  63. package/theme/components/globals/ThemeSelect.vue +0 -35
  64. package/theme/components/icons/IconAlgolia.vue +0 -8
  65. package/theme/components/icons/IconArrowLeft.vue +0 -10
  66. package/theme/components/icons/IconArrowRight.vue +0 -10
  67. package/theme/components/icons/IconBadgeCheck.vue +0 -14
  68. package/theme/components/icons/IconCheck.vue +0 -10
  69. package/theme/components/icons/IconCheckCircle.vue +0 -10
  70. package/theme/components/icons/IconChevronRight.vue +0 -12
  71. package/theme/components/icons/IconClipboardCheck.vue +0 -14
  72. package/theme/components/icons/IconClipboardCopy.vue +0 -14
  73. package/theme/components/icons/IconCodeSandbox.vue +0 -8
  74. package/theme/components/icons/IconCopy.vue +0 -17
  75. package/theme/components/icons/IconDots.vue +0 -10
  76. package/theme/components/icons/IconEdit.vue +0 -18
  77. package/theme/components/icons/IconExclamationCircle.vue +0 -12
  78. package/theme/components/icons/IconExclamationTriangle.vue +0 -10
  79. package/theme/components/icons/IconExternalLink.vue +0 -12
  80. package/theme/components/icons/IconGit.vue +0 -7
  81. package/theme/components/icons/IconGitHub.vue +0 -10
  82. package/theme/components/icons/IconHeart.vue +0 -9
  83. package/theme/components/icons/IconInformationCircle.vue +0 -10
  84. package/theme/components/icons/IconLighthouse.vue +0 -83
  85. package/theme/components/icons/IconLine.vue +0 -10
  86. package/theme/components/icons/IconMarkdown.vue +0 -13
  87. package/theme/components/icons/IconMenu.vue +0 -12
  88. package/theme/components/icons/IconMenuAlt.vue +0 -10
  89. package/theme/components/icons/IconMinus.vue +0 -10
  90. package/theme/components/icons/IconMoon.vue +0 -10
  91. package/theme/components/icons/IconNuxt.vue +0 -14
  92. package/theme/components/icons/IconNuxtContent.vue +0 -20
  93. package/theme/components/icons/IconNuxtLabs.vue +0 -21
  94. package/theme/components/icons/IconPlus.vue +0 -10
  95. package/theme/components/icons/IconPuzzle.vue +0 -8
  96. package/theme/components/icons/IconSSG.vue +0 -7
  97. package/theme/components/icons/IconSearch.vue +0 -12
  98. package/theme/components/icons/IconSun.vue +0 -10
  99. package/theme/components/icons/IconTailwind.vue +0 -3
  100. package/theme/components/icons/IconTocBack.vue +0 -21
  101. package/theme/components/icons/IconTocCurrent.vue +0 -21
  102. package/theme/components/icons/IconTocNext.vue +0 -8
  103. package/theme/components/icons/IconTranslate.vue +0 -14
  104. package/theme/components/icons/IconTwitter.vue +0 -8
  105. package/theme/components/icons/IconVite.vue +0 -30
  106. package/theme/components/icons/IconVue.vue +0 -6
  107. package/theme/components/icons/IconVueTelescope.vue +0 -11
  108. package/theme/components/icons/IconWindi.vue +0 -17
  109. package/theme/components/icons/IconX.vue +0 -12
  110. package/theme/components/icons/IconXCircle.vue +0 -10
  111. package/theme/components/icons/IconZap.vue +0 -8
  112. package/theme/components/prose/ProseA.vue +0 -66
  113. package/theme/components/prose/ProseBlockquote.vue +0 -21
  114. package/theme/components/prose/ProseCode.vue +0 -67
  115. package/theme/components/prose/ProseCodeInline.vue +0 -38
  116. package/theme/components/prose/ProseEm.vue +0 -11
  117. package/theme/components/prose/ProseH1.vue +0 -22
  118. package/theme/components/prose/ProseH2.vue +0 -22
  119. package/theme/components/prose/ProseH3.vue +0 -24
  120. package/theme/components/prose/ProseH4.vue +0 -24
  121. package/theme/components/prose/ProseHr.vue +0 -13
  122. package/theme/components/prose/ProseImg.vue +0 -30
  123. package/theme/components/prose/ProseLi.vue +0 -31
  124. package/theme/components/prose/ProseOl.vue +0 -16
  125. package/theme/components/prose/ProseP.vue +0 -14
  126. package/theme/components/prose/ProseStrong.vue +0 -14
  127. package/theme/components/prose/ProseTable.vue +0 -13
  128. package/theme/components/prose/ProseTbody.vue +0 -5
  129. package/theme/components/prose/ProseTd.vue +0 -11
  130. package/theme/components/prose/ProseTh.vue +0 -11
  131. package/theme/components/prose/ProseThead.vue +0 -11
  132. package/theme/components/prose/ProseTr.vue +0 -11
  133. package/theme/components/prose/ProseUl.vue +0 -15
  134. package/theme/composables/useDocus.ts +0 -43
  135. package/theme/composables/useMenu.ts +0 -7
  136. package/theme/composables/useScrollToHeading.ts +0 -35
  137. package/theme/composables/useScrollspy.ts +0 -46
  138. package/theme/composables/useUserAgent.ts +0 -7
  139. package/theme/composables/utils.ts +0 -4
  140. package/theme/layouts/default.vue +0 -29
  141. package/theme/layouts/page.vue +0 -19
  142. package/theme/middleware/components.ts +0 -26
  143. package/theme/middleware/navigation.global.ts +0 -12
  144. package/theme/middleware/page.ts +0 -8
  145. package/theme/middleware/theme.global.ts +0 -12
  146. package/theme/nuxt.config.ts +0 -171
  147. package/theme/pages/[...slug].vue +0 -64
  148. package/theme/plugins/menu.ts +0 -67
  149. package/theme/plugins/user-agent.ts +0 -27
  150. package/theme/utils/components.ts +0 -25
  151. package/theme/utils/navigation.ts +0 -49
  152. package/theme/utils/plugin.ts +0 -21
  153. package/theme/utils/queries.ts +0 -68
  154. package/theme/utils/state.ts +0 -32
  155. package/theme/utils/theme.ts +0 -66
@@ -1,85 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, useDocus, useMenu, useUserAgent, watch } from '#imports'
3
-
4
- const { navigation } = useDocus()
5
-
6
- const tree = computed(() => {
7
- return navigation.value.filter(
8
- (item) => {
9
- if (item.slug === '/' || item.slug === '/templates')
10
- return false
11
- return true
12
- },
13
- )
14
- })
15
-
16
- const { scrollBarGap, visible, open, close, toggle } = useMenu()
17
-
18
- const { isDesktopSafari, isDesktopFirefox } = useUserAgent()
19
-
20
- const buttonStyles = 'w-12 h-8 focus:outline-none bg-warmgray-50 hover:bg-warmgray-100 dark:bg-warmgray-800 rounded-xl'
21
-
22
- watch(visible, v => (v ? open() : close()))
23
-
24
- // Necessary because of body lock layout shift
25
- const buttonBodyLockHack = computed(
26
- () => `top: 1rem; right: calc(1.5rem + ${isDesktopSafari.value || isDesktopFirefox.value ? scrollBarGap.value : 0}px);`,
27
- )
28
-
29
- const surfaceBodyLockHack = computed(
30
- () => `top: 0.5rem; right: calc(1rem + ${isDesktopSafari.value || isDesktopFirefox.value ? scrollBarGap.value : 0}px); bottom: 0.5rem; max-height: calc(100vh- 2rem); min-width: calc(320px - 2rem);`,
31
- )
32
- </script>
33
-
34
- <template>
35
- <div class="relative">
36
- <button :class="[buttonStyles]" class="z-10 relative" @click="toggle">
37
- <IconDots class="w-6 h-6 icon-base h-full mx-auto" />
38
- </button>
39
-
40
- <ClientOnly>
41
- <teleport to="body">
42
- <!-- Scrim overlay -->
43
- <div
44
- :class="[visible ? 'opacity-100 pointer-events-auto' : 'opacity-0 pointer-events-none']"
45
- class="xl:hidden fixed top-0 left-0 z-10 w-full h-full bg-warmgray-100 bg-opacity-50 dark:bg-warmgray-800 dark:bg-opacity-50 backdrop-blur transition"
46
- @click="toggle"
47
- />
48
-
49
- <!-- clone AppHeader button, due to stacking context limitations -->
50
- <button
51
- :style="buttonBodyLockHack"
52
- :class="[
53
- buttonStyles,
54
- visible
55
- ? 'opacity-100 pointer-events-auto'
56
- : `opacity-0 transition ${
57
- isDesktopSafari || isDesktopFirefox ? 'duration-0' : 'duration-400'
58
- } pointer-events-none`
59
- ]"
60
- class="xl:hidden z-30 fixed"
61
- @click="toggle"
62
- >
63
- <IconLine class="w-6 h-6 icon-base h-full mx-auto" />
64
- </button>
65
-
66
- <!-- Nav menu surface -->
67
- <div
68
- :style="surfaceBodyLockHack"
69
- :class="[visible ? 'opacity-100 scale-100 pointer-events-auto' : 'opacity-0 scale-95 pointer-events-none']"
70
- class="fixed z-20 w-[calc(100%-3rem)] md:w-auto min-w-full md:min-w-[calc(320px-2rem)] transform origin-top-right transition-transform ease-out"
71
- >
72
- <div
73
- class="lg:hidden pl-8 pr-0 overflow-y-auto mb-2 surface pb-6 pt-12 rounded-2xl shadow-xl border-2 surface-border max-h-full"
74
- >
75
- <DocsAsideTree :tree="tree" />
76
-
77
- <div class="flex items-center justify-end px-6">
78
- <ThemeSelect class="block" />
79
- </div>
80
- </div>
81
- </div>
82
- </teleport>
83
- </ClientOnly>
84
- </div>
85
- </template>
@@ -1,37 +0,0 @@
1
- <script setup lang="ts">
2
- import { onMounted, onUnmounted, ref } from '#imports'
3
-
4
- const onTop = ref(true)
5
-
6
- function setOnTop(): void {
7
- if (window.pageYOffset <= 0)
8
- onTop.value = true
9
- else onTop.value = false
10
- }
11
-
12
- onMounted(() => {
13
- setOnTop()
14
- document.addEventListener('scroll', setOnTop)
15
- })
16
-
17
- onUnmounted(() => document.removeEventListener('scroll', setOnTop))
18
- </script>
19
-
20
- <template>
21
- <header class="sticky w-full top-0 surface surface-blurry border-b border-gray-200 dark:border-gray-800 border-opacity-50 h-header surface surface-blurry z-10">
22
- <Container class="grid grid-cols-12 items-center h-full">
23
- <div class="col-span-6 lg:col-span-3">
24
- <NavbarLogo />
25
- </div>
26
-
27
- <div class="hidden lg:block lg:col-span-6">
28
- <!-- <HeaderNavigation /> -->
29
- </div>
30
-
31
- <div class="col-span-6 lg:col-span-3 flex justify-end">
32
- <MobileNav class="flex lg:hidden" />
33
- <ThemeSelect class="hidden lg:block" />
34
- </div>
35
- </Container>
36
- </header>
37
- </template>
@@ -1,33 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, useDocus } from '#imports'
3
-
4
- const { theme } = useDocus()
5
- const hasLogo = computed(() => theme.value?.header?.logo)
6
- const hasTitle = computed(() => theme.value?.header?.title)
7
- </script>
8
-
9
- <template>
10
- <NuxtLink to="/" :aria-label="theme.header.title">
11
- <!-- Only title -->
12
- <span v-if="!hasLogo && hasTitle">
13
- {{ theme.header.title }}
14
- </span>
15
-
16
- <!-- Title and Logo -->
17
- <template v-else-if="hasLogo && hasTitle">
18
- <Logo />
19
-
20
- <span>
21
- {{ theme.header.title }}
22
- </span>
23
- </template>
24
-
25
- <!-- Only Logo -->
26
- <Logo v-else-if="hasLogo" class="w-12 h-12" />
27
-
28
- <!-- Placeholder -->
29
- <template v-else>
30
- <IconDots class="w-12 h-12" />
31
- </template>
32
- </NuxtLink>
33
- </template>
@@ -1,7 +0,0 @@
1
- <template>
2
- <main class="relative flex-1 pb-4 sm:pb-6 lg:py-8">
3
- <Container padded>
4
- <slot />
5
- </Container>
6
- </main>
7
- </template>
@@ -1,11 +0,0 @@
1
- <template>
2
- <div class="p-3 text-center border-t border-gray-200 border-dashed dark:border-gray-800 dark:bg-gray-900">
3
- <a
4
- href="https://docus.dev"
5
- target="_blank"
6
- class="text-xs text-gray-400 hover:text-gray-600 dark:text-gray-600 group dark:hover:text-gray-400"
7
- >
8
- Powered by <strong class="font-bold">Docus</strong>
9
- </a>
10
- </div>
11
- </template>
@@ -1,124 +0,0 @@
1
- <script setup lang="ts">
2
- defineProps({
3
- /**
4
- * @values info, success, warning, danger
5
- */
6
- type: {
7
- type: String,
8
- default: 'info',
9
- validator(value: string) {
10
- return ['info', 'success', 'warning', 'danger'].includes(value)
11
- },
12
- },
13
- })
14
- </script>
15
-
16
- <template>
17
- <div
18
- class="px-4 py-3 mt-4 mb-4 rounded-xl alert text-sm leading-relaxed"
19
- :class="[type]"
20
- >
21
- <div class="flex items-start">
22
- <div class="flex-grow alert-content">
23
- <Markdown unwrap="p" />
24
- </div>
25
- </div>
26
- </div>
27
- </template>
28
-
29
- <style lang="postcss" scoped>
30
- .alert {
31
- &.success {
32
- @apply bg-green-50 dark:bg-green-800 dark:bg-opacity-25 text-green-600 dark:text-green-200 border border-green-100 dark:border-green-900;
33
-
34
- :deep() {
35
- code {
36
- @apply bg-green-100 dark:bg-green-900 dark:bg-opacity-50 shadow-none text-current border-green-200 dark:border-green-800;
37
- }
38
- a:hover {
39
- code {
40
- @apply border-green-400 dark:border-green-700;
41
- }
42
- }
43
- }
44
- }
45
-
46
- &.info {
47
- @apply bg-blue-50 dark:bg-blue-800 dark:bg-opacity-25 text-blue-600 dark:text-blue-200 border border-blue-100 dark:border-blue-900;
48
-
49
- :deep() {
50
- code {
51
- @apply bg-blue-100 dark:bg-blue-900 dark:bg-opacity-50 shadow-none text-current border-blue-200 dark:border-blue-800;
52
- }
53
- a:hover {
54
- code {
55
- @apply border-blue-400 dark:border-blue-700;
56
- }
57
- }
58
- }
59
- }
60
-
61
- &.warning {
62
- @apply bg-yellow-50 dark:bg-yellow-800 dark:bg-opacity-25 text-yellow-600 dark:text-yellow-100 border border-yellow-100 dark:border-yellow-900;
63
-
64
- :deep() {
65
- code {
66
- @apply bg-yellow-100 dark:bg-yellow-900 dark:bg-opacity-50 shadow-none text-current border-yellow-200 dark:border-yellow-800;
67
- }
68
- a:hover {
69
- code {
70
- @apply border-yellow-400 dark:border-yellow-700;
71
- }
72
- }
73
- }
74
- }
75
-
76
- &.danger {
77
- @apply bg-red-50 dark:bg-red-800 dark:bg-opacity-25 text-red-600 dark:text-red-100 border border-red-100 dark:border-red-900;
78
-
79
- :deep() {
80
- code {
81
- @apply bg-red-100 dark:bg-red-900 dark:bg-opacity-50 shadow-none text-current border-red-200 dark:border-red-800;
82
- }
83
- a:hover {
84
- code {
85
- @apply border-red-400 dark:border-red-700;
86
- }
87
- }
88
- }
89
- }
90
-
91
- :deep() {
92
- strong {
93
- @apply font-semibold text-current;
94
- }
95
-
96
- a {
97
- @apply underline border-none font-semibold text-current;
98
- code {
99
- @apply border border-transparent border-dashed;
100
- }
101
- }
102
-
103
- .prose-code {
104
- @apply my-4;
105
-
106
- code {
107
- @apply bg-gray-50 dark:bg-gray-900;
108
- }
109
- }
110
- }
111
- }
112
-
113
- .alert :deep(p) {
114
- @apply m-0 !important;
115
- }
116
-
117
- .dark .alert {
118
- :deep() {
119
- a {
120
- @apply text-current;
121
- }
122
- }
123
- }
124
- </style>
@@ -1,54 +0,0 @@
1
- <script setup lang="ts">
2
- defineProps({
3
- cta: {
4
- type: Array,
5
- default: () => ['Get started', '/get-started'],
6
- },
7
- secondary: {
8
- type: Array,
9
- default: () => ['Open on GitHub', 'https://github.com'],
10
- },
11
- snippet: {
12
- type: [String, Boolean],
13
- default: () => false,
14
- },
15
- })
16
- </script>
17
-
18
- <template>
19
- <section class="py-12 lg:py-24">
20
- <Container class="flex flex-col lg:flex-row my-8 md:my-16">
21
- <div class="flex flex-col items-center pr-0 lg:items-start lg:pr-8 lg:w-2/3">
22
- <h2
23
- class="mb-4 text-4xl xs:text-5xl font-semibold sm:leading-none tracking-tighter text-center text-gray-900 lg:text-left dark:text-gray-100 sm:text-6xl lg:text-7xl sm:mb-8"
24
- >
25
- <Markdown use="title" unwrap="p" />
26
- </h2>
27
- <p
28
- class="mb-8 text-lg text-center text-gray-700 font-medium tracking-tight lg:text-left sm:text-xl xl:text-xl leading-base sm:mb-12 dark:text-gray-300"
29
- >
30
- <Markdown use="description" unwrap="p" />
31
- </p>
32
-
33
- <div class="flex flex-col sm:flex-row items-center space-y-4 sm:space-y-0 sm:space-x-4 lg:space-x-6 mb-8">
34
- <ButtonLink v-if="cta" class="mx-auto md:mx-0" bold size="large" :href="cta[1]">
35
- {{ cta[0] }}
36
- </ButtonLink>
37
-
38
- <a
39
- v-if="secondary"
40
- :href="secondary[1]"
41
- class="py-px mt-px font-medium text-primary-500 border-b-1 border-transparent dark:text-primary-400 hover:border-primary-500 dark:hover:border-primary-400"
42
- >
43
- {{ secondary[0] }}
44
- </a>
45
- </div>
46
- </div>
47
- <div v-if="snippet" class="w-full mx-auto lg:w-1/3 sm:w-580px">
48
- <div class="md:pl-2 md:mx">
49
- <Terminal :snippet="snippet" />
50
- </div>
51
- </div>
52
- </Container>
53
- </section>
54
- </template>
@@ -1,45 +0,0 @@
1
- <script setup lang="ts">
2
- import { hasProtocol } from 'ufo'
3
- import { computed } from '#imports'
4
-
5
- const props = defineProps({
6
- href: {
7
- type: String,
8
- default: '',
9
- },
10
- size: {
11
- type: String,
12
- default: 'medium',
13
- },
14
- bold: {
15
- type: Boolean,
16
- default: false,
17
- },
18
- })
19
-
20
- const isExternal = computed(
21
- () => hasProtocol(props.href, true),
22
- )
23
- </script>
24
-
25
- <template>
26
- <NuxtLink class="button-link" :class="[size, bold ? 'font-semibold' : 'font-medium']" :to="href">
27
- <Markdown :use="$slots.default" unwrap="p ul li" />
28
-
29
- <IconExternalLink v-if="isExternal" class="w-4 h-4 ml-2" />
30
- </NuxtLink>
31
- </template>
32
-
33
- <style lang="postcss" scoped>
34
- a.button-link {
35
- @apply inline-flex items-center flex-none rounded-lg px-3 py-1.5 text-sm leading-4 text-white transition-colors duration-200 border border-transparent bg-primary-500 hover:bg-primary-600 focus:ring-2 focus:ring-offset-2 focus:ring-offset-white dark:focus:ring-offset-gray-900 focus:ring-primary-600 focus:outline-none;
36
-
37
- &.medium {
38
- @apply px-4 py-2 text-base leading-4;
39
- }
40
-
41
- &.large {
42
- @apply px-6 py-2.5 text-lg leading-6;
43
- }
44
- }
45
- </style>
@@ -1,46 +0,0 @@
1
- <script setup lang="ts">
2
- defineProps({
3
- title: {
4
- type: String,
5
- required: true,
6
- },
7
- description: {
8
- type: String,
9
- default: '',
10
- },
11
- icon: {
12
- type: String,
13
- default: '',
14
- },
15
- iconClass: {
16
- type: String,
17
- default: '',
18
- },
19
- })
20
-
21
- const isImage = (icon: string) => String(icon).includes('.')
22
- </script>
23
-
24
- <template>
25
- <div class="flex">
26
- <div class="relative w-full p-6 bg-gray-200 rounded-lg dark:bg-gray-800 dark:bg-opacity-50">
27
- <img v-if="isImage(icon)" :src="icon" class="inline-block w-16 h-16 mb-3">
28
- <component :is="icon" v-else class="inline-block w-16 h-16 mb-3 text-6xl" />
29
-
30
- <slot />
31
-
32
- <div class="text-lg">
33
- <h3 class="mb-2 font-semibold tracking-tight inline mr-1">
34
- {{ title }}
35
- </h3>
36
- <div class="inline font-medium text-primary">
37
- <slot name="description">
38
- <p v-if="description" class="inline font-medium tracking-tight">
39
- {{ description }}
40
- </p>
41
- </slot>
42
- </div>
43
- </div>
44
- </div>
45
- </div>
46
- </template>
@@ -1,23 +0,0 @@
1
- <script setup lang="ts">
2
- defineProps({
3
- title: {
4
- type: String,
5
- default: 'Features',
6
- },
7
- })
8
- </script>
9
-
10
- <template>
11
- <section class="py-12 lg:py-24 bg-gray-50 dark:bg-gray-800 dark:bg-opacity-25">
12
- <Container>
13
- <h2 class="mb-8 text-3xl font-semibold tracking-tight text-gray-900 sm:text-4xl dark:text-gray-100">
14
- <slot name="title" />
15
- </h2>
16
- <div
17
- class="grid gap-4 font-semibold text-left text-gray-900 dark:text-gray-100 sm:grid-cols-2 lg:grid-cols-3 2xl:gap-8"
18
- >
19
- <slot />
20
- </div>
21
- </Container>
22
- </section>
23
- </template>
@@ -1,47 +0,0 @@
1
- <script setup lang="ts">
2
- defineProps({
3
- /**
4
- * Label to display for the tab
5
- */
6
- label: {
7
- type: String,
8
- required: true,
9
- },
10
- /**
11
- * Select which tab should be active
12
- */
13
- active: {
14
- type: Boolean,
15
- default: false,
16
- },
17
- /**
18
- * Preiew block are bordered and have small padding.
19
- */
20
- preview: {
21
- type: Boolean,
22
- default: false,
23
- },
24
- })
25
- </script>
26
-
27
- <template>
28
- <div
29
- class="code-block"
30
- :class="{
31
- active: active,
32
- 'p-4 border-2 border-t-0 border-gray-100 dark:border-gray-800 rounded-b-lg': preview
33
- }"
34
- >
35
- <slot />
36
- </div>
37
- </template>
38
-
39
- <style scoped>
40
- .code-block {
41
- display: none;
42
- }
43
-
44
- .code-block.active {
45
- display: block;
46
- }
47
- </style>
@@ -1,135 +0,0 @@
1
- <script lang="ts">
2
- import TabsHeader from './TabsHeader.vue'
3
- import { defineComponent } from '#imports'
4
-
5
- const isTag = (slot: any, tag: string) => {
6
- return slot.type && slot.type.tag && slot.type.tag === tag
7
- }
8
-
9
- export default defineComponent({
10
- data() {
11
- return {
12
- activeTabIndex: 0,
13
- /**
14
- * A simple number that increases on every changes
15
- */
16
- counter: 0,
17
- }
18
- },
19
- render() {
20
- const slots = this.$slots.default()
21
- const tabs = slots
22
- .filter(
23
- slot =>
24
- isTag(slot, 'code-block')
25
- || isTag(slot, 'code'),
26
- )
27
- .map((slot, index) => {
28
- return {
29
- label: slot?.props?.filename || slot?.props?.label || `${index}`,
30
- active: slot?.props?.active || false,
31
- component: slot,
32
- }
33
- })
34
-
35
- return h(
36
- 'div',
37
- {
38
- class: {
39
- 'code-group': true,
40
- 'first-tab': this.activeTabIndex === 0,
41
- },
42
- },
43
- [
44
- h(
45
- TabsHeader,
46
- {
47
- 'ref': 'tabs-header',
48
- 'activeTabIndex': this.activeTabIndex,
49
- tabs,
50
- 'onUpdate:activeTabIndex': $event => (this.activeTabIndex = $event),
51
- },
52
- ),
53
- h(
54
- 'div',
55
- {
56
- class: 'code-group-content',
57
- text: this.activeTabIndex,
58
- },
59
- // Map slots to content children
60
- slots.map(
61
- (slot, index) => h(
62
- 'div',
63
- {
64
- // Current slot is displayed, others are hidden
65
- style: { display: index === this.activeTabIndex ? 'block' : 'none' },
66
- class: {
67
- '': !isTag(slot, 'code'),
68
- },
69
- },
70
- // Display direct children if not a ```code``` block
71
- [
72
- isTag(slot, 'code')
73
- ? slot
74
- : h(
75
- 'div',
76
- {
77
- class: {
78
- 'preview-canvas': true,
79
- },
80
- },
81
- [slot.children.default()],
82
- ),
83
- ],
84
- ),
85
- ),
86
- ),
87
- ],
88
- )
89
- },
90
- })
91
- </script>
92
-
93
- <style lang="postcss">
94
- li {
95
- .code-group {
96
- @apply my-4;
97
- }
98
- }
99
-
100
- html.dark {
101
- .code-group-content {
102
- .preview-canvas {
103
- @apply p-4 my-0 overflow-x-auto leading-normal bg-gray-900 rounded-bl-lg rounded-br-lg rounded-tl-none rounded-tr-none z-0;
104
- }
105
- }
106
- }
107
- </style>
108
-
109
- <style scoped lang="postcss">
110
- .code-group {
111
- @apply rounded-lg overflow-hidden border-2 surface-border;
112
-
113
- :deep(.prose-code) {
114
- @apply mt-0 mb-0 rounded-none !important;
115
- }
116
-
117
- :deep(pre) {
118
- @apply mt-0 !important;
119
- }
120
-
121
- :deep(.filename) {
122
- @apply hidden;
123
- }
124
- }
125
-
126
- .code-group-content {
127
- .preview-canvas {
128
- @apply p-4 my-0 overflow-x-auto leading-normal bg-gray-100 dark:bg-gray-800 rounded-bl-lg rounded-br-lg z-0;
129
-
130
- & > * {
131
- @apply my-0;
132
- }
133
- }
134
- }
135
- </style>