Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions docs/components/CodeExample.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import type { Component } from "vue";
import { shallowRef, ref, reactive, watch, onMounted, nextTick } from "vue";
import { shallowRef, ref, watch, onMounted } from "vue";
import IconMarko from "./IconMarko.vue";

const props = defineProps<{
Expand All @@ -15,12 +15,10 @@ const availableLangs = ["react", "vue", "solid", "native", "marko"];
const copyButtonRef = ref<HTMLButtonElement | null>(null);

const cmp = shallowRef<Component | false>(false);
const loadedLangs = reactive(new Set(["react"]));

watch(
exampleLang,
(newLang) => {
loadedLangs.add(newLang);
rawCode.value = codeCache.value[newLang] || "";
copyStatus.value = rawCode.value ? "Copy" : "Error";
},
Expand Down Expand Up @@ -195,19 +193,25 @@ async function copyCode() {
v-show="expanded"
class="editor border-l-4 border-r-4 border-slate-400 dark:border-slate-500"
>
<div v-if="loadedLangs.has('react')" v-show="exampleLang === 'react'">
<!--
All panes render during SSR/SSG and toggle with v-show. They are
server components: mounting them lazily on tab click requires a
runtime island request, which has no server to answer it on the
statically deployed site — tabs came back empty (#174).
-->
<div v-show="exampleLang === 'react'">
<CodeExampleReact :example="example" />
</div>
<div v-if="loadedLangs.has('vue')" v-show="exampleLang === 'vue'">
<div v-show="exampleLang === 'vue'">
<CodeExampleVue :example="example" />
</div>
<div v-if="loadedLangs.has('solid')" v-show="exampleLang === 'solid'">
<div v-show="exampleLang === 'solid'">
<CodeExampleSolid :example="example" />
</div>
<div v-if="loadedLangs.has('native')" v-show="exampleLang === 'native'">
<div v-show="exampleLang === 'native'">
<CodeExampleNative :example="example" />
</div>
<div v-if="loadedLangs.has('marko')" v-show="exampleLang === 'marko'">
<div v-show="exampleLang === 'marko'">
<CodeExampleMarko :example="example" />
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,17 +348,17 @@ export interface ParentConfig<T> {
/**
* Callback function for when a sort operation is performed.
*/
onSort?: SortEvent;
onSort?: SortEvent<T>;
/**
* Callback function for when a transfer operation is performed.
*/
onTransfer?: TransferEvent;
onTransfer?: TransferEvent<T>;
/**
* Fired when a drag is started, whether native drag or synthetic
*/
onDragstart?: DragstartEvent;
onDragstart?: DragstartEvent<T>;
/**
* Fired when a drag is ended, whether native drag or synthetic
*/
onDragend?: DragendEvent;
onDragend?: DragendEvent<T>;
}
Loading