diff --git a/mdsvex.config.js b/mdsvex.config.js index 6f7d4528f..a3e24ab28 100644 --- a/mdsvex.config.js +++ b/mdsvex.config.js @@ -1,5 +1,6 @@ import { defineMDSveXConfig as defineConfig } from 'mdsvex'; import examples from 'mdsvexamples'; +import path from 'path'; const config = defineConfig({ extensions: ['.svelte.md', '.md', '.svx'], @@ -13,7 +14,7 @@ const config = defineConfig({ examples, { defaults: { - Wrapper: '$routes/_internal/components/Example.svelte', + Wrapper: path.resolve('./src/docs/components/Example.svelte'), }, }, ], @@ -21,7 +22,7 @@ const config = defineConfig({ rehypePlugins: [], layout: { - _: './src/routes/_internal/layout/page.svelte', + _: './src/docs/layout/page.svelte', }, }); diff --git a/plugins/sveld.js b/plugins/sveld.js index 771fd1d3c..27a44c69d 100644 --- a/plugins/sveld.js +++ b/plugins/sveld.js @@ -25,7 +25,7 @@ export default function sveld() { const componentFiles = await fs.readdir(path.resolve('./src/package/components')); - for (const fileName of componentFiles) { + for (const fileName of componentFiles.filter((name) => name.endsWith('.svelte'))) { const filePath = path.resolve('./src/package/components', fileName); const raw = (await fs.readFile(filePath)).toString(); output[fileName] = await parseRaw(raw, filePath); diff --git a/src/routes/_internal/assets/omorphia.svg b/src/docs/assets/omorphia.svg similarity index 100% rename from src/routes/_internal/assets/omorphia.svg rename to src/docs/assets/omorphia.svg diff --git a/src/routes/_internal/components/Example.svelte b/src/docs/components/Example.svelte similarity index 100% rename from src/routes/_internal/components/Example.svelte rename to src/docs/components/Example.svelte diff --git a/src/routes/_internal/components/Header.svelte b/src/docs/components/Header.svelte similarity index 78% rename from src/routes/_internal/components/Header.svelte rename to src/docs/components/Header.svelte index 3ddda7bc7..4406afed8 100644 --- a/src/routes/_internal/components/Header.svelte +++ b/src/docs/components/Header.svelte @@ -1,43 +1,42 @@
-
- \ No newline at end of file + diff --git a/src/routes/_internal/components/Sidebar.svelte b/src/docs/components/Sidebar.svelte similarity index 93% rename from src/routes/_internal/components/Sidebar.svelte rename to src/docs/components/Sidebar.svelte index 72a110125..91d41ef6f 100644 --- a/src/routes/_internal/components/Sidebar.svelte +++ b/src/docs/components/Sidebar.svelte @@ -3,12 +3,12 @@ import IconMenu from 'virtual:icons/lucide/menu'; - const components = Object.keys(import.meta.glob('../../components/**')) - .map((it) => it.replace('../../components/', '').replace('.md', '')) + const components = Object.keys(import.meta.glob('../../routes/components/**')) + .map((it) => it.replace('../../routes/components/', '').replace('.md', '')) .sort(); - const classes = Object.keys(import.meta.glob('../../classes/**')) - .map((it) => it.replace('../../classes/', '').replace('.md', '')) + const classes = Object.keys(import.meta.glob('../../routes/classes/**')) + .map((it) => it.replace('../../routes/classes/', '').replace('.md', '')) .sort(); let slideIn = false; diff --git a/src/docs/layout/page.svelte b/src/docs/layout/page.svelte new file mode 100644 index 000000000..f95146b1a --- /dev/null +++ b/src/docs/layout/page.svelte @@ -0,0 +1,147 @@ + + + + {title ? `${title} • Omorphia` : 'Omorphia'} + + + +{#if title}

{title}

{/if} + + + Edit this page on GitHub + + +{#if api} +
+ {#if api.props.length > 0} +

Properties

+ + + + + + + + + + + {#each api.props as prop} + + + + + + + {/each} + +
NameTypeDefaultDescription
{prop.name}{prop.type ?? ''}{prop.value ?? ''}{prop.constant ? '[Read only] ' : ''}{prop.description?.replace( + 'null', + '' + ) || ''}
+ {/if} + {#if api.events.length > 0} +

Events

+ + + + + + + + + + {#each api.events as event} + + + + + + {/each} + +
NameForwardedDescription
{event.name}{!!event.parent}{event.description?.replace('null', '') || ''}
+ {/if} + {#if api.slots.length > 0} +

Slots

+ + + + + + + + + {#each api.slots as slot} + + + + + {/each} + +
NameFallback
{slot.name}{slot.fallback ?? 'None'}
+ {/if} +
+{/if} + + diff --git a/src/routes/_internal/styles/gh-markdown.postcss b/src/docs/styles/gh-markdown.postcss similarity index 100% rename from src/routes/_internal/styles/gh-markdown.postcss rename to src/docs/styles/gh-markdown.postcss diff --git a/src/routes/_internal/styles/prism-one-dark.css b/src/docs/styles/prism-one-dark.css similarity index 100% rename from src/routes/_internal/styles/prism-one-dark.css rename to src/docs/styles/prism-one-dark.css diff --git a/src/global.d.ts b/src/global.d.ts index 73f8fc433..625ee69aa 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -1 +1,8 @@ /// + +declare module '$assets/images/*'; +declare module '$locales/*'; + +declare module '*.svg' { + export { SvelteComponentDev as default } from 'svelte/internal'; +} diff --git a/src/package/components/Avatar.svelte b/src/package/components/Avatar.svelte index 9c756465a..142f50050 100644 --- a/src/package/components/Avatar.svelte +++ b/src/package/components/Avatar.svelte @@ -1,58 +1,63 @@ {#if src} - + {:else} - + - + {/if} \ No newline at end of file + diff --git a/src/package/components/CheckboxVirtualList.svelte b/src/package/components/CheckboxVirtualList.svelte index ccb9f5d8a..57cad49d3 100644 --- a/src/package/components/CheckboxVirtualList.svelte +++ b/src/package/components/CheckboxVirtualList.svelte @@ -1,43 +1,43 @@ - -
+ +
{@const option = options[index]} - handleChange(e, option.value)}> - {#if option.icon} - + handleChange(e, option.value)} + > + {#if option.icon && typeof option.icon === 'string'} + {@html option.icon} + {:else if option.icon} + {/if} {option.label} diff --git a/src/package/components/TextInput.svelte b/src/package/components/TextInput.svelte index 945eb7be3..54b84d6a3 100644 --- a/src/package/components/TextInput.svelte +++ b/src/package/components/TextInput.svelte @@ -2,7 +2,7 @@ import type { SvelteComponent } from 'svelte'; export let placeholder = ''; - export let icon: SvelteComponent; + export let icon: SvelteComponent = undefined; export let value = ''; export let multiline = false; export let id: string = undefined; @@ -50,7 +50,7 @@ } input.has-icon { - padding-left: 40px; + padding-left: 40px; } } diff --git a/src/package/components/types.d.ts b/src/package/components/types.d.ts new file mode 100644 index 000000000..6a338a09c --- /dev/null +++ b/src/package/components/types.d.ts @@ -0,0 +1,8 @@ +import type { SvelteComponentDev } from 'svelte/internal'; + +export interface Option { + label: string; + /** The element that will be in the `value` array while the option is checked */ + value: string | number; + icon?: SvelteComponentDev | string; +} diff --git a/src/package/styles/classes/card.postcss b/src/package/styles/classes/card.postcss index 49f18ff07..be73a1bc1 100644 --- a/src/package/styles/classes/card.postcss +++ b/src/package/styles/classes/card.postcss @@ -6,7 +6,7 @@ position: relative; background-color: var(--color-raised-bg); - border-radius: var(--rounded); + border-radius: var(--rounded-lg); overflow: hidden; box-shadow: var(--shadow-raised), var(--shadow-inset); diff --git a/src/package/styles/themes/dark.postcss b/src/package/styles/themes/dark.postcss index 7bdd09ab2..5892f5baf 100644 --- a/src/package/styles/themes/dark.postcss +++ b/src/package/styles/themes/dark.postcss @@ -31,7 +31,7 @@ --color-bg-contrast: hsl(0, 0%, 100%); --color-raised-bg: hsl(220, 13%, 25%); --color-divider: hsl(220, 13%, 50%); - --color-button-bg: hsl(220, 5%, 32%); + --color-button-bg: hsl(222, 13%, 35%); /* Label colors */ --color-badge-gray-text: hsl(0, 2%, 69%); diff --git a/src/package/styles/variables/borders.postcss b/src/package/styles/variables/borders.postcss index 70c72480f..3d3a70162 100644 --- a/src/package/styles/variables/borders.postcss +++ b/src/package/styles/variables/borders.postcss @@ -7,7 +7,7 @@ /* Rounded radii */ --rounded-sm: 8px; --rounded: 10px; - --rounded-lg: 12px; + --rounded-lg: 14px; --rounded-max: 100px; --rounded-top: var(--rounded) var(--rounded) 0 0; --rounded-bottom: 0 0 var(--rounded) var(--rounded); diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index 29e5735c0..a29d75bc6 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -1,14 +1,14 @@
-
- +
+
@@ -60,4 +60,4 @@ } } } - \ No newline at end of file + diff --git a/src/routes/_internal/layout/page.svelte b/src/routes/_internal/layout/page.svelte deleted file mode 100644 index 1f0ca889e..000000000 --- a/src/routes/_internal/layout/page.svelte +++ /dev/null @@ -1,136 +0,0 @@ - - - - {title ? `${title} • Omorphia` : 'Omorphia'} - - - -{#if title}

{title}

{/if} - - - Edit this page on GitHub - - -{#if api} -
- {#if api.props.length > 0} -

Properties

- - - - - - - - - - - {#each api.props as prop} - - - - - - - {/each} - -
NameTypeDefaultDescription
{prop.name}{prop.type ?? ''}{prop.value ?? ''}{prop.constant ? '[Read only] ' : ''}{prop.description?.replace('null', '') || ''}
- {/if} - {#if api.events.length > 0} -

Events

- - - - - - - - - - {#each api.events as event} - - - - - - {/each} - -
NameForwardedDescription
{event.name}{!!event.parent}{event.description?.replace('null', '') || ''}
- {/if} - {#if api.slots.length > 0} -

Slots

- - - - - - - - - {#each api.slots as slot} - - - - - {/each} - -
NameFallback
{slot.name}{slot.fallback ?? 'None'}
- {/if} -
-{/if} - - - \ No newline at end of file diff --git a/src/routes/components/CheckboxList.md b/src/routes/components/CheckboxList.md index 8c069563c..5b861b9c7 100644 --- a/src/routes/components/CheckboxList.md +++ b/src/routes/components/CheckboxList.md @@ -26,6 +26,10 @@ icon: IconSquare, value: 'SQU', }, + { + label: 'Blank', + value: 'BLA', + }, ]} />