docus 1.0.7 → 3.0.0-beta.2

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 (127) hide show
  1. package/README.md +9 -22
  2. package/app/router.options.ts +18 -0
  3. package/assets/css/fonts.css +84 -0
  4. package/assets/css/main.css +11 -0
  5. package/assets/css/tailwind.css +282 -0
  6. package/components/app/Container.vue +25 -0
  7. package/components/app/Footer.vue +40 -0
  8. package/components/app/Navbar.vue +26 -0
  9. package/components/app/NavbarLogo.vue +33 -0
  10. package/components/app/Page.vue +7 -0
  11. package/components/app/PoweredByDocus.vue +11 -0
  12. package/components/content/Alert.vue +124 -0
  13. package/components/content/BlockHero.vue +54 -0
  14. package/components/content/ButtonLink.vue +45 -0
  15. package/components/content/Card.vue +46 -0
  16. package/components/content/CardGrid.vue +23 -0
  17. package/components/content/CodeBlock.vue +47 -0
  18. package/components/content/CodeGroup.vue +135 -0
  19. package/components/content/CopyButton.vue +49 -0
  20. package/components/content/List.vue +5 -0
  21. package/components/content/NeedContribution.vue +23 -0
  22. package/components/content/ReadMore.vue +25 -0
  23. package/components/content/Sandbox.vue +102 -0
  24. package/components/content/TabsHeader.vue +44 -0
  25. package/components/content/Terminal.vue +64 -0
  26. package/components/content/VideoPlayer.vue +115 -0
  27. package/components/docs/DocsAside.vue +21 -0
  28. package/components/docs/DocsAsideTree.vue +102 -0
  29. package/components/docs/DocsHero.vue +39 -0
  30. package/components/docs/DocsPage.vue +22 -0
  31. package/components/docs/DocsPageContent.vue +31 -0
  32. package/components/docs/DocsToc.vue +74 -0
  33. package/components/globals/Icon.vue +24 -0
  34. package/components/globals/Logo.vue +3 -0
  35. package/components/globals/NuxtImg.vue +45 -0
  36. package/components/globals/SocialIcons.vue +45 -0
  37. package/components/globals/ThemeSelect.vue +35 -0
  38. package/components/icons/IconAlgolia.vue +8 -0
  39. package/components/icons/IconArrowLeft.vue +10 -0
  40. package/components/icons/IconArrowRight.vue +10 -0
  41. package/components/icons/IconBadgeCheck.vue +14 -0
  42. package/components/icons/IconCheck.vue +10 -0
  43. package/components/icons/IconCheckCircle.vue +10 -0
  44. package/components/icons/IconChevronRight.vue +12 -0
  45. package/components/icons/IconClipboardCheck.vue +14 -0
  46. package/components/icons/IconClipboardCopy.vue +14 -0
  47. package/components/icons/IconCodeSandbox.vue +8 -0
  48. package/components/icons/IconCopy.vue +17 -0
  49. package/components/icons/IconDots.vue +10 -0
  50. package/components/icons/IconEdit.vue +18 -0
  51. package/components/icons/IconExclamationCircle.vue +12 -0
  52. package/components/icons/IconExclamationTriangle.vue +10 -0
  53. package/components/icons/IconExternalLink.vue +12 -0
  54. package/components/icons/IconGit.vue +7 -0
  55. package/components/icons/IconGitHub.vue +10 -0
  56. package/components/icons/IconHeart.vue +9 -0
  57. package/components/icons/IconInformationCircle.vue +10 -0
  58. package/components/icons/IconLighthouse.vue +83 -0
  59. package/components/icons/IconLine.vue +10 -0
  60. package/components/icons/IconMarkdown.vue +13 -0
  61. package/components/icons/IconMenu.vue +12 -0
  62. package/components/icons/IconMenuAlt.vue +10 -0
  63. package/components/icons/IconMinus.vue +10 -0
  64. package/components/icons/IconMoon.vue +10 -0
  65. package/components/icons/IconNuxt.vue +14 -0
  66. package/components/icons/IconNuxtContent.vue +20 -0
  67. package/components/icons/IconNuxtLabs.vue +21 -0
  68. package/components/icons/IconPlus.vue +10 -0
  69. package/components/icons/IconPuzzle.vue +8 -0
  70. package/components/icons/IconSSG.vue +7 -0
  71. package/components/icons/IconSearch.vue +12 -0
  72. package/components/icons/IconSun.vue +10 -0
  73. package/components/icons/IconTocBack.vue +21 -0
  74. package/components/icons/IconTocCurrent.vue +21 -0
  75. package/components/icons/IconTocNext.vue +8 -0
  76. package/components/icons/IconTranslate.vue +14 -0
  77. package/components/icons/IconTwitter.vue +8 -0
  78. package/components/icons/IconVite.vue +30 -0
  79. package/components/icons/IconVue.vue +6 -0
  80. package/components/icons/IconVueTelescope.vue +11 -0
  81. package/components/icons/IconWindi.vue +17 -0
  82. package/components/icons/IconX.vue +12 -0
  83. package/components/icons/IconXCircle.vue +10 -0
  84. package/components/icons/IconZap.vue +8 -0
  85. package/components/prose/ProseA.vue +66 -0
  86. package/components/prose/ProseBlockquote.vue +21 -0
  87. package/components/prose/ProseCode.vue +68 -0
  88. package/components/prose/ProseCodeInline.vue +38 -0
  89. package/components/prose/ProseEm.vue +11 -0
  90. package/components/prose/ProseH1.vue +22 -0
  91. package/components/prose/ProseH2.vue +22 -0
  92. package/components/prose/ProseH3.vue +24 -0
  93. package/components/prose/ProseH4.vue +24 -0
  94. package/components/prose/ProseHr.vue +13 -0
  95. package/components/prose/ProseImg.vue +30 -0
  96. package/components/prose/ProseLi.vue +31 -0
  97. package/components/prose/ProseOl.vue +16 -0
  98. package/components/prose/ProseP.vue +14 -0
  99. package/components/prose/ProseStrong.vue +14 -0
  100. package/components/prose/ProseTable.vue +13 -0
  101. package/components/prose/ProseTbody.vue +5 -0
  102. package/components/prose/ProseTd.vue +11 -0
  103. package/components/prose/ProseTh.vue +11 -0
  104. package/components/prose/ProseThead.vue +11 -0
  105. package/components/prose/ProseTr.vue +11 -0
  106. package/components/prose/ProseUl.vue +15 -0
  107. package/composables/useContent.ts +156 -0
  108. package/composables/useMenu.ts +22 -0
  109. package/composables/useScrollToHeading.ts +35 -0
  110. package/composables/useScrollspy.ts +46 -0
  111. package/composables/useTheme.ts +12 -0
  112. package/layouts/default.vue +29 -0
  113. package/layouts/page.vue +11 -0
  114. package/nuxt.config.ts +151 -0
  115. package/package.json +45 -63
  116. package/pages/[...slug].vue +26 -0
  117. package/public/android-chrome-192x192.png +0 -0
  118. package/public/android-chrome-512x512.png +0 -0
  119. package/public/apple-touch-icon.png +0 -0
  120. package/public/favicon-16x16.png +0 -0
  121. package/public/favicon-32x32.png +0 -0
  122. package/public/favicon.ico +0 -0
  123. package/public/site.webmanifest +1 -0
  124. package/dist/create-docus/create-docus.js +0 -7
  125. package/dist/create-docus/helpers.js +0 -244
  126. package/dist/create-docus/index.js +0 -87
  127. package/dist/index.js +0 -10
@@ -0,0 +1,54 @@
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>
@@ -0,0 +1,45 @@
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-md 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>
@@ -0,0 +1,46 @@
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>
@@ -0,0 +1,23 @@
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>
@@ -0,0 +1,47 @@
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>
@@ -0,0 +1,135 @@
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
+ .prose {
95
+ li {
96
+ .code-group {
97
+ @apply my-4;
98
+ }
99
+ }
100
+ }
101
+
102
+ html.dark {
103
+ .code-group-content {
104
+ .preview-canvas {
105
+ @apply p-4 my-0 overflow-x-auto leading-normal bg-gray-900 rounded-lg rounded-tl-none rounded-tr-none z-0;
106
+ }
107
+ }
108
+ }
109
+ </style>
110
+
111
+ <style scoped lang="postcss">
112
+ .code-group {
113
+ :deep(.prose-code) {
114
+ @apply mt-0 rounded-tl-none rounded-tr-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>
@@ -0,0 +1,49 @@
1
+ <script setup lang="ts">
2
+ import Clipboard from 'clipboard'
3
+ import { onMounted, ref } from '#imports'
4
+
5
+ const copy = ref()
6
+ const state = ref('init')
7
+
8
+ onMounted(() => {
9
+ const copyCode = new Clipboard(copy.value, {
10
+ target(trigger) {
11
+ return trigger.previousElementSibling
12
+ },
13
+ })
14
+
15
+ copyCode.on('success', (event) => {
16
+ event.clearSelection()
17
+ state.value = 'copied'
18
+ window.setTimeout(() => {
19
+ state.value = 'init'
20
+ }, 1000)
21
+ })
22
+ })
23
+ </script>
24
+
25
+ <template>
26
+ <button
27
+ ref="copy"
28
+ class="
29
+ copy
30
+ focus:outline-none
31
+ absolute
32
+ right-1
33
+ bottom-1
34
+ px-2
35
+ py-2
36
+ m-1
37
+ text-gray-400
38
+ bg-gray-900
39
+ text-xs
40
+ leading-none
41
+ rounded-lg
42
+ font-mono
43
+ font-semibold
44
+ "
45
+ >
46
+ <Icon v-if="state === 'copied'" name="fa-check" class="w-4 h-4" />
47
+ <Icon v-else name="fa-copy" class="w-4 h-4" />
48
+ </button>
49
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div>
3
+ <slot />
4
+ </div>
5
+ </template>
@@ -0,0 +1,23 @@
1
+ <script setup lang="ts">
2
+ defineProps({
3
+ to: {
4
+ type: String,
5
+ required: true,
6
+ default: '/community/contribution#documentation-guide',
7
+ },
8
+ icon: {
9
+ type: String,
10
+ required: true,
11
+ default: '🚧',
12
+ },
13
+ })
14
+ </script>
15
+
16
+ <template>
17
+ <Alert type="warning" :icon="icon">
18
+ Documentation for this section is not yet complete. You can
19
+ <NuxtLink :to="to">
20
+ contribute to the documentation.
21
+ </NuxtLink>
22
+ </Alert>
23
+ </template>
@@ -0,0 +1,25 @@
1
+ <script setup lang="ts">
2
+ import { splitByCase, upperFirst } from 'scule'
3
+ import { computed } from '#imports'
4
+
5
+ const props = defineProps({
6
+ link: {
7
+ type: String,
8
+ required: true,
9
+ },
10
+ title: {
11
+ type: String,
12
+ required: false,
13
+ default: '',
14
+ },
15
+ })
16
+
17
+ // Guess title from link!
18
+ const computedTitle = computed(() => (props.title || props.link).split('/').filter(Boolean).map(part => splitByCase(part).map(p => upperFirst(p)).join(' ')).join(' > '))
19
+ </script>
20
+
21
+ <template>
22
+ <Alert icon="👉">
23
+ Read more in <NuxtLink :to="link" v-html="computedTitle" />.
24
+ </Alert>
25
+ </template>
@@ -0,0 +1,102 @@
1
+ <script setup lang="ts">
2
+ import { computed, onMounted, ref, useColorMode } from '#imports'
3
+
4
+ const props = defineProps({
5
+ src: {
6
+ type: String,
7
+ default: '',
8
+ },
9
+ repo: {
10
+ type: String,
11
+ default: '',
12
+ },
13
+ branch: {
14
+ type: String,
15
+ default: '',
16
+ },
17
+ dir: {
18
+ type: String,
19
+ default: '',
20
+ },
21
+ file: {
22
+ type: String,
23
+ default: 'app.vue',
24
+ },
25
+ })
26
+
27
+ const colorMode = useColorMode()
28
+
29
+ const providers = {
30
+ CodeSandBox: () => `https://codesandbox.io/embed/github/${props.repo}/tree/${props.branch}/${props.dir}?hidenavigation=1&theme=${colorMode.value}`,
31
+ StackBlitz: () => `https://stackblitz.com/github/${props.repo}/tree/${props.branch}/${props.dir}?embed=1&file=${props.file}&theme=${colorMode.value}`,
32
+ }
33
+
34
+ const providersTabs = Object.keys(providers).map(p => ({ label: p }))
35
+ const activeTabIndex = ref(-1)
36
+ const tabs = ref()
37
+ const url = ref('')
38
+ const provider = ref('')
39
+
40
+ const changeProvider = (value) => {
41
+ provider.value = value
42
+ url.value = props.src || providers[provider.value]()
43
+ localStorage.setItem('docus_sandbox', value)
44
+ }
45
+
46
+ const sandBoxUrl = computed(() => url.value?.replace('?embed=1&', '?').replace('/embed/', '/s/'))
47
+
48
+ const updateTab = (i: number) => {
49
+ activeTabIndex.value = i
50
+ changeProvider(providersTabs[i].label)
51
+ }
52
+
53
+ onMounted(() => {
54
+ // TODO: if Safari, use CodeSandBox by default: const defaultSandbox = ...
55
+ provider.value = window.localStorage.getItem('docus_sandbox') || 'CodeSandBox'
56
+
57
+ url.value = props.src || providers[provider.value]()
58
+
59
+ // Set active tab
60
+ activeTabIndex.value = Object.keys(providers).indexOf(provider.value)
61
+
62
+ setTimeout(() => tabs.value.updateTabs(activeTabIndex.value), 100)
63
+ })
64
+ </script>
65
+
66
+ <template>
67
+ <div class="w-full min-h-[500px] mx-auto mb-6 overflow-hidden text-3xl rounded-md sandbox mt-4">
68
+ <TabsHeader
69
+ v-if="!src"
70
+ ref="tabs"
71
+ :active-tab-index="activeTabIndex"
72
+ :tabs="providersTabs"
73
+ @update:active-tab-index="updateTab"
74
+ >
75
+ <template #footer>
76
+ <div class="absolute top-1/2 transform -translate-y-1/2 right-0 px-2">
77
+ <Link class="flex items-center text-gray-500 dark:text-gray-400" :to="sandBoxUrl" blank>
78
+ <IconExternalLink class="h-5 w-5" />
79
+ </Link>
80
+ </div>
81
+ </template>
82
+ </TabsHeader>
83
+
84
+ <iframe
85
+ v-if="url"
86
+ :src="url"
87
+ title="Sandbox editor"
88
+ sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
89
+ class="w-full h-full min-h-[700px] overflow-hidden bg-gray-100 dark:bg-gray-800"
90
+ />
91
+
92
+ <span v-else class="text-white flex-1">Loading Sandbox...</span>
93
+ </div>
94
+ </template>
95
+
96
+ <style lang="postcss" scoped>
97
+ .sandbox,
98
+ .sandbox iframe {
99
+ @apply w-full rounded-md rounded-tl-none rounded-tr-none overflow-hidden h-64;
100
+ height: 700px;
101
+ }
102
+ </style>
@@ -0,0 +1,44 @@
1
+ <script setup lang="ts">
2
+ import type { PropType } from 'vue'
3
+
4
+ defineProps({
5
+ tabs: {
6
+ type: Array as PropType<{ label: string }[]>,
7
+ required: true,
8
+ },
9
+ activeTabIndex: {
10
+ type: Number,
11
+ required: true,
12
+ },
13
+ })
14
+
15
+ defineEmits(['update:activeTabIndex'])
16
+ </script>
17
+
18
+ <template>
19
+ <div class="relative text-white rounded-t-lg bg-gray-200 dark:bg-gray-700">
20
+ <div v-if="tabs" class="relative z-0 px-2">
21
+ <button
22
+ v-for="({ label }, i) in tabs"
23
+ ref="tabs"
24
+ :key="`${i}${label}`"
25
+ class="relative px-3 py-1.5 xs:py-3 my-1.5 xs:my-0 text-sm font-mono font-medium tracking-tight focus:outline-none font-bold"
26
+ :class="[activeTabIndex === i ? 'active text-gray-800 dark:text-white' : 'text-gray-600 dark:text-gray-400']"
27
+ @click="$emit('update:activeTabIndex', i)"
28
+ >
29
+ {{ label }}
30
+ </button>
31
+ <span ref="highlight-underline" class="absolute -z-[1] highlight-underline h-full xs:py-1.5">
32
+ <span class="flex w-full h-full bg-gray-300 dark:bg-gray-600 rounded-md" />
33
+ </span>
34
+ </div>
35
+ </div>
36
+ </template>
37
+
38
+ <style scoped>
39
+ .highlight-underline {
40
+ /* bottom: -2px; */
41
+ /* height: 2px; */
42
+ transition: left 150ms, top 150ms, width 150ms, height 150ms;
43
+ }
44
+ </style>
@@ -0,0 +1,64 @@
1
+ <script setup lang="ts">
2
+ import Clipboard from 'clipboard'
3
+ import { nextTick, onMounted, ref } from '#imports'
4
+
5
+ const props = defineProps({
6
+ snippet: {
7
+ type: String,
8
+ required: true,
9
+ },
10
+ })
11
+
12
+ const copyInstall = ref()
13
+ const copied = ref(false)
14
+
15
+ const setupCopyInstall = () => {
16
+ if (!copyInstall.value)
17
+ return nextTick(setupCopyInstall)
18
+
19
+ const instance = new Clipboard(copyInstall.value)
20
+
21
+ instance.on('success', () => {
22
+ copied.value = true
23
+
24
+ setTimeout(() => {
25
+ copied.value = false
26
+ }, 1000)
27
+ })
28
+ }
29
+
30
+ onMounted(() => setupCopyInstall())
31
+
32
+ </script>
33
+
34
+ <template>
35
+ <div
36
+ ref="copyInstall"
37
+ :data-clipboard-text="snippet"
38
+ class="relative flex flex-col w-full h-64 overflow-hidden text-gray-600 bg-gray-800 rounded-lg cursor-pointer group"
39
+ >
40
+ <div v-if="copied" class="absolute top-0 left-0 z-10 flex items-center justify-center w-full h-full">
41
+ <div class="absolute top-0 left-0 w-full h-full bg-gray-900 opacity-75" />
42
+ <div class="z-10 text-lg font-medium text-gray-100">
43
+ Copied!
44
+ </div>
45
+ </div>
46
+ <div class="relative flex items-center w-full h-12 border-b border-gray-700">
47
+ <div class="flex ml-4">
48
+ <div class="w-3 h-3 bg-red-400 rounded-full" />
49
+ <div class="w-3 h-3 ml-2 bg-yellow-400 rounded-full" />
50
+ <div class="w-3 h-3 ml-2 bg-green-400 rounded-full" />
51
+ </div>
52
+ <div class="absolute top-0 left-0 flex items-center justify-center w-full h-full">
53
+ Bash
54
+ </div>
55
+ </div>
56
+ <div class="flex flex-1 p-4 font-mono">
57
+ <span class="inline-block mr-2 font-bold select-none">$</span>
58
+ <span class="inline-block text-gray-200">{{ snippet }}</span>
59
+ </div>
60
+ <div class="py-2 text-center transition-opacity opacity-0 group-hover:opacity-100">
61
+ Click to copy
62
+ </div>
63
+ </div>
64
+ </template>