diff --git a/docs/src/components/ComponentApi.svelte b/docs/src/components/ComponentApi.svelte index eec669ca..835d8576 100644 --- a/docs/src/components/ComponentApi.svelte +++ b/docs/src/components/ComponentApi.svelte @@ -7,6 +7,7 @@ typedefs: [], }; + import { onMount } from "svelte"; import { Button, OutboundLink, @@ -21,8 +22,17 @@ Tag, } from "carbon-components-svelte"; import InlineSnippet from "./InlineSnippet.svelte"; - import PreviewTypeScript from "./PreviewTypeScript.svelte"; import Code from "carbon-icons-svelte/lib/Code.svelte"; + + let AsyncPreviewTypeScript; + + onMount(async () => { + AsyncPreviewTypeScript = (await import("./PreviewTypeScript.svelte")) + .default; + }); + + $: console.log(AsyncPreviewTypeScript); + const mdn_api = "https://developer.mozilla.org/en-US/docs/Web/API/"; const typeMap = { string: "string", @@ -116,7 +126,8 @@ ? "break-word" : "normal"} > - - + {:else}
- +
{/if} @@ -157,7 +178,8 @@ /> {:else} - undefined {:else} - + {/if} @@ -195,7 +222,10 @@

Typedefs

{#if component.typedefs.length > 0} - t.ts).join(";\n\n")} /> + t.ts).join(";\n\n")} + /> {:else}

No typedefs.

{/if} @@ -230,9 +260,7 @@ Event name - - - + Event detail {#if hasDescription} Description {/if} @@ -245,7 +273,10 @@ on:{event.name}
- {full_code_prop}. {/if} {#if full_code} - - // Lazy load dependencies for performance. - const asyncFormat = Promise.all([ - import("prettier/standalone"), - import("prettier/parser-typescript"), - ]).then(([prettier, typescriptParser]) => prettier.format); - - const asyncHighlight = import("prismjs").then((module) => { - import("prismjs/components/prism-typescript"); - return module.highlight; - }); - - {#if type === "multi"}