diff --git a/.eslintignore b/.eslintignore index 3897265..8cd0692 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,13 +1,7 @@ .DS_Store node_modules +pnpm-lock.yaml /build /.svelte-kit /package -.env -.env.* -!.env.example - -# Ignore files for PNPM, NPM and YARN -pnpm-lock.yaml -package-lock.json -yarn.lock +/src/routes/docs/guide diff --git a/scripts/generate-guide.ts b/scripts/generate-guide.ts index e40fc77..939b59b 100644 --- a/scripts/generate-guide.ts +++ b/scripts/generate-guide.ts @@ -214,6 +214,17 @@ const componentDocs = { }; // Extracts all component data +type Component = { + name: string; + displayName: string; + props: string[]; + slots: string[]; + specs: any; + variantProps: Record; + example: string | undefined; + tip: string | undefined; +}; + async function extractComponentData() { const componentFiles = await glob("src/lib/**/*.svelte", { ignore: ["**/+*.svelte", "**/forms/_picker/**"], @@ -232,7 +243,7 @@ async function extractComponentData() { } } - const componentData = []; + const componentData: Component[] = []; for (const file of componentFiles) { const content = readFileSync(file, "utf-8"); @@ -452,7 +463,7 @@ for (const [category, items] of Object.entries(components)) { if (example) { sveltePage += `\n

Examples

- `; + `; } if (tip) { diff --git a/src/lib/nav/NavDrawerButton.svelte b/src/lib/nav/NavDrawerButton.svelte index b072379..eafac33 100644 --- a/src/lib/nav/NavDrawerButton.svelte +++ b/src/lib/nav/NavDrawerButton.svelte @@ -56,7 +56,7 @@ -webkit-print-color-adjust: exact; } @media screen and (forced-colors: active) { - .destination.selected { + .destination:disabled { background-color: selecteditem; } } diff --git a/src/routes/docs/Snippet.svelte b/src/routes/docs/Snippet.svelte index 77acca8..f23a9c6 100644 --- a/src/routes/docs/Snippet.svelte +++ b/src/routes/docs/Snippet.svelte @@ -3,13 +3,12 @@ import Icon from "$lib/misc/_icon.svelte"; import iconCopy from "@ktibow/iconset-material-symbols/content-copy-outline"; import Highlight from "svelte-highlight"; - import type { LanguageType } from "svelte-highlight/languages"; import javascript from "svelte-highlight/languages/javascript"; import css from "svelte-highlight/languages/css"; import xml from "svelte-highlight/languages/xml"; export let code: string; - export let name: string | undefined; + export let name: string | undefined = undefined; export let lang: string; let snackbar: (data: SnackbarIn) => void; diff --git a/src/routes/docs/guide/+page.svelte b/src/routes/docs/guide/+page.svelte index 935030d..a556e39 100644 --- a/src/routes/docs/guide/+page.svelte +++ b/src/routes/docs/guide/+page.svelte @@ -37,9 +37,9 @@
  • default
  • Examples

    - alert("Hello world!")}> + alert("Hello world!")}> Click me -`} lang="xml" /> +${"<"}/Button>`} lang="xml" />

    ButtonLink

    @@ -68,12 +68,12 @@
  • default
  • Examples

    - - - Tab A - - Tab B -`} lang="xml" /> + + ${"<"}input type="radio" name="group" id="tab-a" checked /> + ${"<"}SegmentedButtonItem input="tab-a">Tab A${"<"}/SegmentedButtonItem> + ${"<"}input type="radio" name="group" id="tab-b" /> + ${"<"}SegmentedButtonItem input="tab-b">Tab B${"<"}/SegmentedButtonItem> +${"<"}/SegmentedButtonContainer>`} lang="xml" />

    SegmentedButtonItem

    @@ -102,7 +102,7 @@
  • text: string | undefined
  • Examples

    - default

    Examples

    - Hello -Click me`} lang="xml" /> + Hello${"<"}/Card> +${"<"}CardClickable type="elevated">Click me${"<"}/CardClickable>`} lang="xml" />

    CardClickable

    @@ -174,13 +174,13 @@
  • buttons
  • Examples

    - + Delete these items? - - - - -`} lang="xml" /> + ${"<"}svelte:fragment slot="buttons"> + ${"<"}Button type="text" on:click={() => (open = false)}>Cancel${"<"}/Button> + ${"<"}Button type="tonal" on:click={() => (open = false)}>Delete${"<"}/Button> + ${"<"}/svelte:fragment> +${"<"}/Dialog>`} lang="xml" />

    Snackbar

    @@ -190,15 +190,15 @@
  • extraOptions: ComponentProps<SnackbarItem>
  • Examples

    - + let snackbar: (data: SnackbarIn) => void; - - -`} lang="xml" /> +})}>Show${"<"}/Button> +${"<"}Snackbar bind:show={snackbar} />`} lang="xml" />

    Tips

    Set the CSS variable `--m3-util-bottom-offset` to a size to move all snackbars upwards.

    @@ -291,10 +291,10 @@ let snackbar: (data: SnackbarIn) => void;
  • default
  • Examples

    - - Undo - Redo -`} lang="xml" /> + + ${"<"}MenuItem icon={iconUndo}>Undo${"<"}/MenuItem> + ${"<"}MenuItem icon={iconRedo} disabled>Redo${"<"}/MenuItem> +${"<"}/Menu>`} lang="xml" />

    MenuItem

    @@ -399,7 +399,7 @@ let snackbar: (data: SnackbarIn) => void;
  • disabled: boolean
  • Examples

    - `} lang="xml" /> + `} lang="xml" />

    Slider

    @@ -416,8 +416,8 @@ let snackbar: (data: SnackbarIn) => void;
  • format: (n: number)
  • Examples

    - -`} lang="xml" /> + +${"<"}SliderTicks step={1} max={6} bind:value />`} lang="xml" />

    Textfields

    @@ -444,7 +444,7 @@ let snackbar: (data: SnackbarIn) => void;
  • value: string
  • Examples

    - void;
  • items: {
  • Examples

    - `} lang="xml" /> @@ -679,7 +679,7 @@ let snackbar: (data: SnackbarIn) => void;
  • extraOptions: HTMLInputAttributes
  • Examples

    - `} lang="xml" /> + `} lang="xml" />

    Tips

    This component is like DatePickerDocked but it has a field and it's easier to use