kosui 0.1.2 → 0.4.0
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.
- package/README.md +34 -3
- package/dist/alert/alert.svelte +16 -157
- package/dist/alert/alert.svelte.d.ts +3 -26
- package/dist/alert/index.d.ts +1 -1
- package/dist/alert/index.js +1 -1
- package/dist/autocomplete/autocomplete.svelte +126 -12
- package/dist/autocomplete/autocomplete.svelte.d.ts +30 -6
- package/dist/autocomplete/index.d.ts +1 -5
- package/dist/autocomplete/index.js +1 -5
- package/dist/avatar/avatar.svelte +16 -10
- package/dist/badge/badge.svelte +31 -20
- package/dist/badge/badge.svelte.d.ts +8 -4
- package/dist/badge/index.d.ts +1 -1
- package/dist/base.d.ts +4 -8
- package/dist/base.js +14 -28
- package/dist/box/box.svelte +2 -14
- package/dist/box/box.svelte.d.ts +0 -2
- package/dist/breadcrumbs/breadcrumbs.svelte +38 -19
- package/dist/breadcrumbs/breadcrumbs.svelte.d.ts +6 -4
- package/dist/breadcrumbs/index.d.ts +1 -1
- package/dist/breadcrumbs/index.js +1 -1
- package/dist/button/button.svelte +96 -31
- package/dist/button/button.svelte.d.ts +11 -5
- package/dist/button/index.d.ts +1 -1
- package/dist/button/index.js +1 -1
- package/dist/chip/chip.svelte +62 -14
- package/dist/chip/chip.svelte.d.ts +2 -1
- package/dist/command/action.svelte.js +13 -18
- package/dist/command/command-palette.svelte +163 -0
- package/dist/command/command-palette.svelte.d.ts +11 -0
- package/dist/command/index.d.ts +1 -8
- package/dist/command/index.js +1 -8
- package/dist/common/divider.svelte +10 -5
- package/dist/common/divider.svelte.d.ts +3 -3
- package/dist/common/index.d.ts +0 -2
- package/dist/common/index.js +0 -2
- package/dist/dialog/dialog-provider.svelte +70 -0
- package/dist/dialog/dialog-provider.svelte.d.ts +7 -0
- package/dist/dialog/dialog.svelte +33 -35
- package/dist/dialog/dialog.svelte.d.ts +4 -8
- package/dist/dialog/dialogs.svelte.d.ts +49 -0
- package/dist/dialog/dialogs.svelte.js +73 -0
- package/dist/dialog/index.d.ts +2 -3
- package/dist/dialog/index.js +2 -3
- package/dist/fab/fab.svelte +30 -10
- package/dist/fab/fab.svelte.d.ts +3 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/input/field.d.ts +8 -0
- package/dist/input/field.js +7 -0
- package/dist/input/index.d.ts +2 -1
- package/dist/input/index.js +2 -1
- package/dist/input/input.svelte +21 -66
- package/dist/input/input.svelte.d.ts +6 -16
- package/dist/link/link.svelte +33 -42
- package/dist/link/link.svelte.d.ts +4 -3
- package/dist/markdown/index.d.ts +2 -25
- package/dist/markdown/index.js +0 -24
- package/dist/markdown/markdown-tokens.svelte +166 -6
- package/dist/markdown/markdown-tokens.svelte.d.ts +2 -0
- package/dist/markdown/markdown.svelte +62 -173
- package/dist/markdown/markdown.svelte.d.ts +7 -27
- package/dist/markdown/parse.d.ts +5 -0
- package/dist/markdown/parse.js +30 -0
- package/dist/markdown/types.d.ts +28 -0
- package/dist/markdown/types.js +1 -0
- package/dist/menu/index.d.ts +3 -6
- package/dist/menu/index.js +3 -6
- package/dist/menu/menu-actions.svelte +44 -38
- package/dist/menu/menu-context.d.ts +4 -0
- package/dist/menu/menu-context.js +2 -0
- package/dist/menu/menu-group.svelte +40 -0
- package/dist/menu/menu-group.svelte.d.ts +11 -0
- package/dist/menu/menu-item.svelte +31 -54
- package/dist/menu/menu-item.svelte.d.ts +7 -5
- package/dist/menu/menu.svelte +160 -15
- package/dist/menu/menu.svelte.d.ts +15 -4
- package/dist/merge-props.d.ts +1 -1
- package/dist/merge-props.js +10 -5
- package/dist/modal/modal.svelte +60 -83
- package/dist/modal/modal.svelte.d.ts +5 -4
- package/dist/popover/index.d.ts +1 -1
- package/dist/popover/index.js +1 -1
- package/dist/popover/popover.svelte +58 -111
- package/dist/popover/popover.svelte.d.ts +6 -8
- package/dist/progress/circular-progress.svelte +64 -30
- package/dist/progress/circular-progress.svelte.d.ts +7 -8
- package/dist/shortcut/index.d.ts +2 -2
- package/dist/shortcut/index.js +1 -1
- package/dist/shortcut/shortcut-hint.svelte +36 -0
- package/dist/shortcut/shortcut-hint.svelte.d.ts +9 -0
- package/dist/shortcut/shortcut.d.ts +19 -14
- package/dist/shortcut/shortcut.js +105 -52
- package/dist/skeleton/skeleton.svelte +13 -8
- package/dist/skeleton/skeleton.svelte.d.ts +2 -5
- package/dist/slider/index.d.ts +1 -8
- package/dist/slider/index.js +1 -8
- package/dist/slider/slider.svelte +180 -211
- package/dist/slider/slider.svelte.d.ts +11 -32
- package/dist/switch/index.d.ts +1 -2
- package/dist/switch/index.js +1 -2
- package/dist/switch/switch.svelte +36 -60
- package/dist/switch/switch.svelte.d.ts +6 -17
- package/dist/textarea/index.d.ts +1 -1
- package/dist/textarea/index.js +1 -1
- package/dist/textarea/textarea.svelte +23 -63
- package/dist/textarea/textarea.svelte.d.ts +8 -18
- package/dist/theme.css +191 -0
- package/dist/toggle/index.d.ts +0 -1
- package/dist/toggle/index.js +0 -1
- package/dist/toggle/toggle-button.svelte +72 -38
- package/dist/toggle/toggle-button.svelte.d.ts +4 -4
- package/dist/toggle/toggle-context.d.ts +10 -0
- package/dist/toggle/toggle-context.js +2 -0
- package/dist/toggle/toggle-group.svelte +41 -22
- package/dist/toggle/toggle-group.svelte.d.ts +7 -4
- package/dist/tooltip/tooltip.svelte +67 -26
- package/dist/tooltip/tooltip.svelte.d.ts +10 -4
- package/dist/utils.d.ts +9 -3
- package/dist/utils.js +10 -0
- package/package.json +21 -13
- package/dist/autocomplete/autocomplete-content.svelte +0 -47
- package/dist/autocomplete/autocomplete-content.svelte.d.ts +0 -10
- package/dist/autocomplete/autocomplete-context.svelte.d.ts +0 -12
- package/dist/autocomplete/autocomplete-context.svelte.js +0 -34
- package/dist/autocomplete/autocomplete-input.svelte +0 -36
- package/dist/autocomplete/autocomplete-input.svelte.d.ts +0 -5
- package/dist/autocomplete/autocomplete-item.svelte +0 -68
- package/dist/autocomplete/autocomplete-item.svelte.d.ts +0 -11
- package/dist/base.css +0 -71
- package/dist/bindable.svelte.d.ts +0 -7
- package/dist/bindable.svelte.js +0 -25
- package/dist/command/command-content.svelte +0 -15
- package/dist/command/command-content.svelte.d.ts +0 -8
- package/dist/command/command-context.svelte.d.ts +0 -5
- package/dist/command/command-context.svelte.js +0 -13
- package/dist/command/command-input.svelte +0 -44
- package/dist/command/command-input.svelte.d.ts +0 -7
- package/dist/command/command-item.svelte +0 -66
- package/dist/command/command-item.svelte.d.ts +0 -11
- package/dist/command/command-search.svelte +0 -28
- package/dist/command/command-search.svelte.d.ts +0 -5
- package/dist/command/command.svelte +0 -19
- package/dist/command/command.svelte.d.ts +0 -8
- package/dist/command/commander.svelte +0 -107
- package/dist/command/commander.svelte.d.ts +0 -9
- package/dist/common/header.svelte +0 -35
- package/dist/common/header.svelte.d.ts +0 -10
- package/dist/common/item-context.svelte.d.ts +0 -12
- package/dist/common/item-context.svelte.js +0 -77
- package/dist/dialog/dialog-button.svelte +0 -25
- package/dist/dialog/dialog-button.svelte.d.ts +0 -32
- package/dist/dialog/dialoguer-context.svelte.d.ts +0 -53
- package/dist/dialog/dialoguer-context.svelte.js +0 -85
- package/dist/dialog/dialoguer.svelte +0 -65
- package/dist/dialog/dialoguer.svelte.d.ts +0 -7
- package/dist/markdown/markdown-blockquote.svelte +0 -14
- package/dist/markdown/markdown-blockquote.svelte.d.ts +0 -7
- package/dist/markdown/markdown-br.svelte +0 -12
- package/dist/markdown/markdown-br.svelte.d.ts +0 -7
- package/dist/markdown/markdown-code.svelte +0 -14
- package/dist/markdown/markdown-code.svelte.d.ts +0 -7
- package/dist/markdown/markdown-codespan.svelte +0 -15
- package/dist/markdown/markdown-codespan.svelte.d.ts +0 -7
- package/dist/markdown/markdown-context.svelte.d.ts +0 -26
- package/dist/markdown/markdown-context.svelte.js +0 -30
- package/dist/markdown/markdown-def.svelte +0 -15
- package/dist/markdown/markdown-def.svelte.d.ts +0 -7
- package/dist/markdown/markdown-del.svelte +0 -14
- package/dist/markdown/markdown-del.svelte.d.ts +0 -7
- package/dist/markdown/markdown-em.svelte +0 -14
- package/dist/markdown/markdown-em.svelte.d.ts +0 -7
- package/dist/markdown/markdown-escape.svelte +0 -8
- package/dist/markdown/markdown-escape.svelte.d.ts +0 -5
- package/dist/markdown/markdown-heading.svelte +0 -16
- package/dist/markdown/markdown-heading.svelte.d.ts +0 -7
- package/dist/markdown/markdown-hr.svelte +0 -12
- package/dist/markdown/markdown-hr.svelte.d.ts +0 -7
- package/dist/markdown/markdown-html.svelte +0 -9
- package/dist/markdown/markdown-html.svelte.d.ts +0 -5
- package/dist/markdown/markdown-image.svelte +0 -12
- package/dist/markdown/markdown-image.svelte.d.ts +0 -7
- package/dist/markdown/markdown-link.svelte +0 -17
- package/dist/markdown/markdown-link.svelte.d.ts +0 -7
- package/dist/markdown/markdown-list-item.svelte +0 -14
- package/dist/markdown/markdown-list-item.svelte.d.ts +0 -7
- package/dist/markdown/markdown-list.svelte +0 -19
- package/dist/markdown/markdown-list.svelte.d.ts +0 -7
- package/dist/markdown/markdown-paragraph.svelte +0 -16
- package/dist/markdown/markdown-paragraph.svelte.d.ts +0 -7
- package/dist/markdown/markdown-space.svelte +0 -8
- package/dist/markdown/markdown-space.svelte.d.ts +0 -5
- package/dist/markdown/markdown-strong.svelte +0 -15
- package/dist/markdown/markdown-strong.svelte.d.ts +0 -7
- package/dist/markdown/markdown-table-cell.svelte +0 -16
- package/dist/markdown/markdown-table-cell.svelte.d.ts +0 -7
- package/dist/markdown/markdown-table.svelte +0 -36
- package/dist/markdown/markdown-table.svelte.d.ts +0 -7
- package/dist/markdown/markdown-text.svelte +0 -8
- package/dist/markdown/markdown-text.svelte.d.ts +0 -5
- package/dist/markdown/markdown-token.svelte +0 -25
- package/dist/markdown/markdown-token.svelte.d.ts +0 -7
- package/dist/menu/menu-content.svelte +0 -47
- package/dist/menu/menu-content.svelte.d.ts +0 -10
- package/dist/menu/menu-context.svelte.d.ts +0 -18
- package/dist/menu/menu-context.svelte.js +0 -118
- package/dist/menu/menu-trigger-button.svelte +0 -31
- package/dist/menu/menu-trigger-button.svelte.d.ts +0 -5
- package/dist/menu/menu-trigger.svelte +0 -42
- package/dist/menu/menu-trigger.svelte.d.ts +0 -10
- package/dist/ordered-html-elements.d.ts +0 -7
- package/dist/ordered-html-elements.js +0 -29
- package/dist/portal/index.d.ts +0 -2
- package/dist/portal/index.js +0 -2
- package/dist/portal/portal.svelte +0 -15
- package/dist/portal/portal.svelte.d.ts +0 -8
- package/dist/portal/proxy.svelte +0 -13
- package/dist/portal/proxy.svelte.d.ts +0 -7
- package/dist/shortcut/shortcut-badge.svelte +0 -41
- package/dist/shortcut/shortcut-badge.svelte.d.ts +0 -11
- package/dist/slider/slider-context.svelte.d.ts +0 -50
- package/dist/slider/slider-context.svelte.js +0 -198
- package/dist/slider/slider-handle-label-arrow.svelte +0 -18
- package/dist/slider/slider-handle-label-arrow.svelte.d.ts +0 -6
- package/dist/slider/slider-handle-label.svelte +0 -35
- package/dist/slider/slider-handle-label.svelte.d.ts +0 -6
- package/dist/slider/slider-handle.svelte +0 -54
- package/dist/slider/slider-handle.svelte.d.ts +0 -6
- package/dist/slider/slider-mark-dot.svelte +0 -25
- package/dist/slider/slider-mark-dot.svelte.d.ts +0 -6
- package/dist/slider/slider-mark-label.svelte +0 -37
- package/dist/slider/slider-mark-label.svelte.d.ts +0 -9
- package/dist/slider/slider-mark.svelte +0 -33
- package/dist/slider/slider-mark.svelte.d.ts +0 -9
- package/dist/switch/switch-thumb.svelte +0 -52
- package/dist/switch/switch-thumb.svelte.d.ts +0 -7
- package/dist/toggle/toggle-context.svelte.d.ts +0 -9
- package/dist/toggle/toggle-context.svelte.js +0 -32
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
DialoguerContext,
|
|
4
|
-
setDialoguerContext,
|
|
5
|
-
type DialoguerButtonProps,
|
|
6
|
-
} from "./index.js";
|
|
7
|
-
import { Input } from "../input/index.js";
|
|
8
|
-
import type { Snippet } from "svelte";
|
|
9
|
-
import DialogButton from "./dialog-button.svelte";
|
|
10
|
-
import Dialog from "./dialog.svelte";
|
|
11
|
-
|
|
12
|
-
const dialog = setDialoguerContext(new DialoguerContext());
|
|
13
|
-
|
|
14
|
-
type Props = {
|
|
15
|
-
children: Snippet;
|
|
16
|
-
};
|
|
17
|
-
let { children }: Props = $props();
|
|
18
|
-
|
|
19
|
-
let value: string = $derived(dialog.inputProps?.value ?? "");
|
|
20
|
-
|
|
21
|
-
function getValue(button: DialoguerButtonProps<unknown>) {
|
|
22
|
-
if (dialog.inputProps === undefined) {
|
|
23
|
-
return button.value;
|
|
24
|
-
}
|
|
25
|
-
if (button.value === "cancel") {
|
|
26
|
-
return undefined;
|
|
27
|
-
}
|
|
28
|
-
if (button.value === "accept") {
|
|
29
|
-
return value;
|
|
30
|
-
}
|
|
31
|
-
throw new Error("Invalid state");
|
|
32
|
-
}
|
|
33
|
-
</script>
|
|
34
|
-
|
|
35
|
-
<Dialog
|
|
36
|
-
bind:open={dialog.open}
|
|
37
|
-
icon={dialog.icon}
|
|
38
|
-
title={dialog.title}
|
|
39
|
-
onSelect={dialog.resolve}
|
|
40
|
-
>
|
|
41
|
-
{#if typeof dialog.message === "function"}
|
|
42
|
-
{@render dialog.message()}
|
|
43
|
-
{:else}
|
|
44
|
-
{dialog.message}
|
|
45
|
-
{/if}
|
|
46
|
-
|
|
47
|
-
{#if dialog.inputProps !== undefined}
|
|
48
|
-
<Input class="mt-2 w-full" bind:value autofocus {...dialog.inputProps} />
|
|
49
|
-
{/if}
|
|
50
|
-
|
|
51
|
-
{#snippet actions(props)}
|
|
52
|
-
{#each dialog.buttons as button (button)}
|
|
53
|
-
<DialogButton
|
|
54
|
-
variant={button.variant}
|
|
55
|
-
value={getValue(button)}
|
|
56
|
-
autofocus={button.default}
|
|
57
|
-
{...props}
|
|
58
|
-
>
|
|
59
|
-
{button.text}
|
|
60
|
-
</DialogButton>
|
|
61
|
-
{/each}
|
|
62
|
-
{/snippet}
|
|
63
|
-
</Dialog>
|
|
64
|
-
|
|
65
|
-
{@render children()}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
3
|
-
import type { Tokens } from "marked";
|
|
4
|
-
import type { HTMLQuoteAttributes } from "svelte/elements";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
children,
|
|
8
|
-
...restProps
|
|
9
|
-
}: MarkdownComponentProps<Tokens.Blockquote> & HTMLQuoteAttributes = $props();
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<blockquote {...restProps}>
|
|
13
|
-
{@render children()}
|
|
14
|
-
</blockquote>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
import type { HTMLQuoteAttributes } from "svelte/elements";
|
|
4
|
-
type $$ComponentProps = MarkdownComponentProps<Tokens.Blockquote> & HTMLQuoteAttributes;
|
|
5
|
-
declare const MarkdownBlockquote: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type MarkdownBlockquote = ReturnType<typeof MarkdownBlockquote>;
|
|
7
|
-
export default MarkdownBlockquote;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
3
|
-
import type { Tokens } from "marked";
|
|
4
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
...restProps
|
|
8
|
-
}: MarkdownComponentProps<Tokens.Br> & HTMLAttributes<HTMLBRElement> =
|
|
9
|
-
$props();
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<br {...restProps} />
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
-
type $$ComponentProps = MarkdownComponentProps<Tokens.Br> & HTMLAttributes<HTMLBRElement>;
|
|
5
|
-
declare const MarkdownBr: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type MarkdownBr = ReturnType<typeof MarkdownBr>;
|
|
7
|
-
export default MarkdownBr;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
3
|
-
import type { Tokens } from "marked";
|
|
4
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
token,
|
|
8
|
-
...restProps
|
|
9
|
-
}: MarkdownComponentProps<Tokens.Code> & HTMLAttributes<HTMLPreElement> =
|
|
10
|
-
$props();
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
|
14
|
-
<pre {...restProps}><code class={token.lang}>{@html token.text}</code></pre>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
-
type $$ComponentProps = MarkdownComponentProps<Tokens.Code> & HTMLAttributes<HTMLPreElement>;
|
|
5
|
-
declare const MarkdownCode: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type MarkdownCode = ReturnType<typeof MarkdownCode>;
|
|
7
|
-
export default MarkdownCode;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
3
|
-
import type { Tokens } from "marked";
|
|
4
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
token,
|
|
8
|
-
...restProps
|
|
9
|
-
}: MarkdownComponentProps<Tokens.Codespan> & HTMLAttributes<HTMLElement> =
|
|
10
|
-
$props();
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<code {...restProps}>
|
|
14
|
-
{token.raw.slice(1, token.raw.length - 1)}
|
|
15
|
-
</code>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
-
type $$ComponentProps = MarkdownComponentProps<Tokens.Codespan> & HTMLAttributes<HTMLElement>;
|
|
5
|
-
declare const MarkdownCodespan: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type MarkdownCodespan = ReturnType<typeof MarkdownCodespan>;
|
|
7
|
-
export default MarkdownCodespan;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { MarkedToken, Tokens } from "marked";
|
|
2
|
-
import { type Snippet } from "svelte";
|
|
3
|
-
type Token = {
|
|
4
|
-
[T in TokenType]: Extract<MarkedToken, {
|
|
5
|
-
type: T;
|
|
6
|
-
}>;
|
|
7
|
-
};
|
|
8
|
-
export type MarkdownComponentProps<T> = {
|
|
9
|
-
token: T;
|
|
10
|
-
children: Snippet;
|
|
11
|
-
};
|
|
12
|
-
export type TokenType = MarkedToken["type"];
|
|
13
|
-
type TokenRenderer<T> = Snippet<[MarkdownComponentProps<T>]>;
|
|
14
|
-
type Renderers = {
|
|
15
|
-
[T in TokenType]?: TokenRenderer<Token[T]>;
|
|
16
|
-
};
|
|
17
|
-
export declare class MarkdownContext {
|
|
18
|
-
#private;
|
|
19
|
-
constructor(renderers: Renderers, tableCellRenderer: TokenRenderer<Tokens.TableCell>);
|
|
20
|
-
get renderers(): Renderers;
|
|
21
|
-
get tableCellRenderer(): TokenRenderer<Tokens.TableCell>;
|
|
22
|
-
getRenderer<T extends TokenType>(type: T): TokenRenderer<Token[T]> | undefined;
|
|
23
|
-
}
|
|
24
|
-
export declare function setMarkdownContext(state: MarkdownContext): MarkdownContext;
|
|
25
|
-
export declare function getMarkdownContext(): MarkdownContext;
|
|
26
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { getContext, setContext } from "svelte";
|
|
2
|
-
export class MarkdownContext {
|
|
3
|
-
#renderers;
|
|
4
|
-
#tableCellRenderer;
|
|
5
|
-
constructor(renderers, tableCellRenderer) {
|
|
6
|
-
this.#renderers = renderers;
|
|
7
|
-
this.#tableCellRenderer = tableCellRenderer;
|
|
8
|
-
}
|
|
9
|
-
get renderers() {
|
|
10
|
-
return this.#renderers;
|
|
11
|
-
}
|
|
12
|
-
get tableCellRenderer() {
|
|
13
|
-
return this.#tableCellRenderer;
|
|
14
|
-
}
|
|
15
|
-
getRenderer(type) {
|
|
16
|
-
if (!this.#renderers[type]) {
|
|
17
|
-
console.warn("No renderer registered for", type);
|
|
18
|
-
}
|
|
19
|
-
return this.#renderers[type];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export function setMarkdownContext(state) {
|
|
23
|
-
return setContext(MarkdownContext, state);
|
|
24
|
-
}
|
|
25
|
-
export function getMarkdownContext() {
|
|
26
|
-
const ctx = getContext(MarkdownContext);
|
|
27
|
-
if (!ctx)
|
|
28
|
-
throw new Error("MarkdownContext is undefined");
|
|
29
|
-
return ctx;
|
|
30
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
3
|
-
import type { Tokens } from "marked";
|
|
4
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
children,
|
|
8
|
-
...restProps
|
|
9
|
-
}: MarkdownComponentProps<Tokens.Def> & HTMLAttributes<HTMLElement> =
|
|
10
|
-
$props();
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<dfn {...restProps}>
|
|
14
|
-
{@render children()}
|
|
15
|
-
</dfn>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
-
type $$ComponentProps = MarkdownComponentProps<Tokens.Def> & HTMLAttributes<HTMLElement>;
|
|
5
|
-
declare const MarkdownDef: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type MarkdownDef = ReturnType<typeof MarkdownDef>;
|
|
7
|
-
export default MarkdownDef;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
3
|
-
import type { Tokens } from "marked";
|
|
4
|
-
import type { HTMLDelAttributes } from "svelte/elements";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
children,
|
|
8
|
-
...restProps
|
|
9
|
-
}: MarkdownComponentProps<Tokens.Del> & HTMLDelAttributes = $props();
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<del {...restProps}>
|
|
13
|
-
{@render children()}
|
|
14
|
-
</del>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
import type { HTMLDelAttributes } from "svelte/elements";
|
|
4
|
-
type $$ComponentProps = MarkdownComponentProps<Tokens.Del> & HTMLDelAttributes;
|
|
5
|
-
declare const MarkdownDel: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type MarkdownDel = ReturnType<typeof MarkdownDel>;
|
|
7
|
-
export default MarkdownDel;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
3
|
-
import type { Tokens } from "marked";
|
|
4
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
children,
|
|
8
|
-
...restProps
|
|
9
|
-
}: MarkdownComponentProps<Tokens.Em> & HTMLAttributes<HTMLElement> = $props();
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<em {...restProps}>
|
|
13
|
-
{@render children()}
|
|
14
|
-
</em>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
-
type $$ComponentProps = MarkdownComponentProps<Tokens.Em> & HTMLAttributes<HTMLElement>;
|
|
5
|
-
declare const MarkdownEm: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type MarkdownEm = ReturnType<typeof MarkdownEm>;
|
|
7
|
-
export default MarkdownEm;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
declare const MarkdownEscape: import("svelte").Component<MarkdownComponentProps<Tokens.Escape>, {}, "">;
|
|
4
|
-
type MarkdownEscape = ReturnType<typeof MarkdownEscape>;
|
|
5
|
-
export default MarkdownEscape;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
3
|
-
import type { Tokens } from "marked";
|
|
4
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
token,
|
|
8
|
-
children,
|
|
9
|
-
...restProps
|
|
10
|
-
}: MarkdownComponentProps<Tokens.Heading> &
|
|
11
|
-
HTMLAttributes<HTMLHeadingElement> = $props();
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<svelte:element this={`h${token.depth}`} {...restProps}>
|
|
15
|
-
{@render children()}
|
|
16
|
-
</svelte:element>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
-
type $$ComponentProps = MarkdownComponentProps<Tokens.Heading> & HTMLAttributes<HTMLHeadingElement>;
|
|
5
|
-
declare const MarkdownHeading: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type MarkdownHeading = ReturnType<typeof MarkdownHeading>;
|
|
7
|
-
export default MarkdownHeading;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
3
|
-
import type { Tokens } from "marked";
|
|
4
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
...restProps
|
|
8
|
-
}: MarkdownComponentProps<Tokens.Hr> & HTMLAttributes<HTMLHRElement> =
|
|
9
|
-
$props();
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<hr {...restProps} />
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
-
type $$ComponentProps = MarkdownComponentProps<Tokens.Hr> & HTMLAttributes<HTMLHRElement>;
|
|
5
|
-
declare const MarkdownHr: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type MarkdownHr = ReturnType<typeof MarkdownHr>;
|
|
7
|
-
export default MarkdownHr;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
3
|
-
import type { Tokens } from "marked";
|
|
4
|
-
|
|
5
|
-
let { token }: MarkdownComponentProps<Tokens.HTML | Tokens.Tag> = $props();
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
|
9
|
-
{@html token.text}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
declare const MarkdownHtml: import("svelte").Component<MarkdownComponentProps<Tokens.HTML | Tokens.Tag>, {}, "">;
|
|
4
|
-
type MarkdownHtml = ReturnType<typeof MarkdownHtml>;
|
|
5
|
-
export default MarkdownHtml;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
3
|
-
import type { Tokens } from "marked";
|
|
4
|
-
import type { HTMLImgAttributes } from "svelte/elements";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
token,
|
|
8
|
-
...restProps
|
|
9
|
-
}: MarkdownComponentProps<Tokens.Image> & HTMLImgAttributes = $props();
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<img src={token.href} title={token.title} alt={token.text} {...restProps} />
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
import type { HTMLImgAttributes } from "svelte/elements";
|
|
4
|
-
type $$ComponentProps = MarkdownComponentProps<Tokens.Image> & HTMLImgAttributes;
|
|
5
|
-
declare const MarkdownImage: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type MarkdownImage = ReturnType<typeof MarkdownImage>;
|
|
7
|
-
export default MarkdownImage;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
3
|
-
import type { Tokens } from "marked";
|
|
4
|
-
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
token,
|
|
8
|
-
children,
|
|
9
|
-
...restProps
|
|
10
|
-
}: MarkdownComponentProps<Tokens.Link> & HTMLAnchorAttributes = $props();
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<!-- Maybe there's a better way to handle this. See https://github.com/sveltejs/eslint-plugin-svelte/issues/1314-->
|
|
14
|
-
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -->
|
|
15
|
-
<a href={token.href} title={token.title} {...restProps}>
|
|
16
|
-
{@render children()}
|
|
17
|
-
</a>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
4
|
-
type $$ComponentProps = MarkdownComponentProps<Tokens.Link> & HTMLAnchorAttributes;
|
|
5
|
-
declare const MarkdownLink: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type MarkdownLink = ReturnType<typeof MarkdownLink>;
|
|
7
|
-
export default MarkdownLink;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
3
|
-
import type { Tokens } from "marked";
|
|
4
|
-
import type { HTMLLiAttributes } from "svelte/elements";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
children,
|
|
8
|
-
...restProps
|
|
9
|
-
}: MarkdownComponentProps<Tokens.ListItem> & HTMLLiAttributes = $props();
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<li {...restProps}>
|
|
13
|
-
{@render children()}
|
|
14
|
-
</li>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
import type { HTMLLiAttributes } from "svelte/elements";
|
|
4
|
-
type $$ComponentProps = MarkdownComponentProps<Tokens.ListItem> & HTMLLiAttributes;
|
|
5
|
-
declare const MarkdownListItem: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type MarkdownListItem = ReturnType<typeof MarkdownListItem>;
|
|
7
|
-
export default MarkdownListItem;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
3
|
-
import type { Tokens } from "marked";
|
|
4
|
-
import type { HTMLOlAttributes } from "svelte/elements";
|
|
5
|
-
import MarkdownTokens from "./markdown-tokens.svelte";
|
|
6
|
-
|
|
7
|
-
let {
|
|
8
|
-
token,
|
|
9
|
-
...restProps
|
|
10
|
-
}: MarkdownComponentProps<Tokens.List> & HTMLOlAttributes = $props();
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<svelte:element
|
|
14
|
-
this={token.ordered ? "ol" : "ul"}
|
|
15
|
-
start={token.start || 1}
|
|
16
|
-
{...restProps}
|
|
17
|
-
>
|
|
18
|
-
<MarkdownTokens tokens={token.items} />
|
|
19
|
-
</svelte:element>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
import type { HTMLOlAttributes } from "svelte/elements";
|
|
4
|
-
type $$ComponentProps = MarkdownComponentProps<Tokens.List> & HTMLOlAttributes;
|
|
5
|
-
declare const MarkdownList: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type MarkdownList = ReturnType<typeof MarkdownList>;
|
|
7
|
-
export default MarkdownList;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
3
|
-
import type { Tokens } from "marked";
|
|
4
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
children,
|
|
8
|
-
token: _token,
|
|
9
|
-
...restProps
|
|
10
|
-
}: MarkdownComponentProps<Tokens.Paragraph> &
|
|
11
|
-
HTMLAttributes<HTMLParagraphElement> = $props();
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<p {...restProps}>
|
|
15
|
-
{@render children()}
|
|
16
|
-
</p>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
-
type $$ComponentProps = MarkdownComponentProps<Tokens.Paragraph> & HTMLAttributes<HTMLParagraphElement>;
|
|
5
|
-
declare const MarkdownParagraph: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type MarkdownParagraph = ReturnType<typeof MarkdownParagraph>;
|
|
7
|
-
export default MarkdownParagraph;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
declare const MarkdownSpace: import("svelte").Component<MarkdownComponentProps<Tokens.Space>, {}, "">;
|
|
4
|
-
type MarkdownSpace = ReturnType<typeof MarkdownSpace>;
|
|
5
|
-
export default MarkdownSpace;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
3
|
-
import type { Tokens } from "marked";
|
|
4
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
children,
|
|
8
|
-
...restProps
|
|
9
|
-
}: MarkdownComponentProps<Tokens.Strong> & HTMLAttributes<HTMLElement> =
|
|
10
|
-
$props();
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<strong {...restProps}>
|
|
14
|
-
{@render children()}
|
|
15
|
-
</strong>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
-
type $$ComponentProps = MarkdownComponentProps<Tokens.Strong> & HTMLAttributes<HTMLElement>;
|
|
5
|
-
declare const MarkdownStrong: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type MarkdownStrong = ReturnType<typeof MarkdownStrong>;
|
|
7
|
-
export default MarkdownStrong;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
3
|
-
import type { MarkedToken, Tokens } from "marked";
|
|
4
|
-
import type { HTMLTdAttributes, HTMLThAttributes } from "svelte/elements";
|
|
5
|
-
import MarkdownTokens from "./markdown-tokens.svelte";
|
|
6
|
-
|
|
7
|
-
let {
|
|
8
|
-
token,
|
|
9
|
-
...restProps
|
|
10
|
-
}: MarkdownComponentProps<Tokens.TableCell> &
|
|
11
|
-
(HTMLThAttributes | HTMLTdAttributes) = $props();
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<svelte:element this={token.header ? "th" : "td"} {...restProps}>
|
|
15
|
-
<MarkdownTokens tokens={token.tokens as MarkedToken[]} />
|
|
16
|
-
</svelte:element>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
import type { HTMLTdAttributes, HTMLThAttributes } from "svelte/elements";
|
|
4
|
-
type $$ComponentProps = MarkdownComponentProps<Tokens.TableCell> & (HTMLThAttributes | HTMLTdAttributes);
|
|
5
|
-
declare const MarkdownTableCell: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type MarkdownTableCell = ReturnType<typeof MarkdownTableCell>;
|
|
7
|
-
export default MarkdownTableCell;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
getMarkdownContext,
|
|
4
|
-
type MarkdownComponentProps,
|
|
5
|
-
} from "./index.js";
|
|
6
|
-
import type { Tokens } from "marked";
|
|
7
|
-
import type { HTMLTableAttributes } from "svelte/elements";
|
|
8
|
-
|
|
9
|
-
let {
|
|
10
|
-
token,
|
|
11
|
-
...restProps
|
|
12
|
-
}: MarkdownComponentProps<Tokens.Table> & HTMLTableAttributes = $props();
|
|
13
|
-
|
|
14
|
-
const ctx = getMarkdownContext();
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
{#snippet children()}{/snippet}
|
|
18
|
-
|
|
19
|
-
<table {...restProps}>
|
|
20
|
-
<thead>
|
|
21
|
-
<tr>
|
|
22
|
-
{#each token.header as item (item)}
|
|
23
|
-
{@render ctx.tableCellRenderer({ token: item, children })}
|
|
24
|
-
{/each}
|
|
25
|
-
</tr>
|
|
26
|
-
</thead>
|
|
27
|
-
<tbody>
|
|
28
|
-
{#each token.rows as row (row)}
|
|
29
|
-
<tr>
|
|
30
|
-
{#each row as cell (cell)}
|
|
31
|
-
{@render ctx.tableCellRenderer({ token: cell, children })}
|
|
32
|
-
{/each}
|
|
33
|
-
</tr>
|
|
34
|
-
{/each}
|
|
35
|
-
</tbody>
|
|
36
|
-
</table>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type MarkdownComponentProps } from "./index.js";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
import type { HTMLTableAttributes } from "svelte/elements";
|
|
4
|
-
type $$ComponentProps = MarkdownComponentProps<Tokens.Table> & HTMLTableAttributes;
|
|
5
|
-
declare const MarkdownTable: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type MarkdownTable = ReturnType<typeof MarkdownTable>;
|
|
7
|
-
export default MarkdownTable;
|