@svadmin/ai-elements 0.7.4 → 0.9.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 +31 -4
- package/THIRD_PARTY_NOTICES.md +67 -6
- package/dist/ai-workspace-contract.d.ts +14 -0
- package/dist/ai-workspace-contract.js +14 -0
- package/dist/ai.css +2 -5
- package/dist/ai.theme.css +1 -0
- package/dist/class-properties.generated.d.ts +1 -0
- package/dist/class-properties.generated.js +2 -0
- package/dist/classnames.d.ts +8 -0
- package/dist/classnames.js +26 -0
- package/dist/components/Response.svelte +2 -2
- package/dist/components/Response.svelte.d.ts +1 -1
- package/dist/components/code/index.d.ts +9 -18
- package/dist/components/code/index.js +8 -11
- package/dist/components/code-block/highlight.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/utilities.css +3172 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/package.json +36 -11
- package/vendor/streamdown/AnimatedText.svelte +93 -0
- package/vendor/streamdown/AnimatedText.svelte.d.ts +6 -0
- package/vendor/streamdown/Block.svelte +96 -0
- package/vendor/streamdown/Block.svelte.d.ts +11 -0
- package/vendor/streamdown/Elements/Alert.svelte +69 -0
- package/vendor/streamdown/Elements/Alert.svelte.d.ts +10 -0
- package/vendor/streamdown/Elements/Citation.svelte +260 -0
- package/vendor/streamdown/Elements/Citation.svelte.d.ts +7 -0
- package/vendor/streamdown/Elements/Code.svelte +226 -0
- package/vendor/streamdown/Elements/Code.svelte.d.ts +9 -0
- package/vendor/streamdown/Elements/Element.svelte +574 -0
- package/vendor/streamdown/Elements/Element.svelte.d.ts +10 -0
- package/vendor/streamdown/Elements/FootnoteRef.svelte +30 -0
- package/vendor/streamdown/Elements/FootnoteRef.svelte.d.ts +7 -0
- package/vendor/streamdown/Elements/Footnotes.svelte +54 -0
- package/vendor/streamdown/Elements/Footnotes.svelte.d.ts +7 -0
- package/vendor/streamdown/Elements/Image.svelte +200 -0
- package/vendor/streamdown/Elements/Image.svelte.d.ts +10 -0
- package/vendor/streamdown/Elements/Link.svelte +220 -0
- package/vendor/streamdown/Elements/Link.svelte.d.ts +10 -0
- package/vendor/streamdown/Elements/LinkSafetyModal.svelte +121 -0
- package/vendor/streamdown/Elements/LinkSafetyModal.svelte.d.ts +4 -0
- package/vendor/streamdown/Elements/Math.svelte +100 -0
- package/vendor/streamdown/Elements/Math.svelte.d.ts +9 -0
- package/vendor/streamdown/Elements/Mermaid.svelte +455 -0
- package/vendor/streamdown/Elements/Mermaid.svelte.d.ts +9 -0
- package/vendor/streamdown/Elements/MermaidDownload.svelte +145 -0
- package/vendor/streamdown/Elements/MermaidDownload.svelte.d.ts +8 -0
- package/vendor/streamdown/Elements/Slot.svelte +23 -0
- package/vendor/streamdown/Elements/Slot.svelte.d.ts +10 -0
- package/vendor/streamdown/Elements/Table.svelte +195 -0
- package/vendor/streamdown/Elements/Table.svelte.d.ts +9 -0
- package/vendor/streamdown/Elements/TableDownload.svelte +221 -0
- package/vendor/streamdown/Elements/TableDownload.svelte.d.ts +8 -0
- package/vendor/streamdown/Elements/fallbacks/CodeFallback.svelte +41 -0
- package/vendor/streamdown/Elements/fallbacks/CodeFallback.svelte.d.ts +9 -0
- package/vendor/streamdown/Elements/fallbacks/MathFallback.svelte +35 -0
- package/vendor/streamdown/Elements/fallbacks/MathFallback.svelte.d.ts +8 -0
- package/vendor/streamdown/Elements/fallbacks/MermaidFallback.svelte +36 -0
- package/vendor/streamdown/Elements/fallbacks/MermaidFallback.svelte.d.ts +9 -0
- package/vendor/streamdown/Elements/fallbacks/index.d.ts +3 -0
- package/vendor/streamdown/Elements/fallbacks/index.js +3 -0
- package/vendor/streamdown/Elements/icons.d.ts +31 -0
- package/vendor/streamdown/Elements/icons.js +200 -0
- package/vendor/streamdown/Elements/index.d.ts +8 -0
- package/vendor/streamdown/Elements/index.js +8 -0
- package/vendor/streamdown/Elements/popover.svelte.d.ts +8 -0
- package/vendor/streamdown/Elements/popover.svelte.js +45 -0
- package/vendor/streamdown/Elements/stepperState.svelte.d.ts +36 -0
- package/vendor/streamdown/Elements/stepperState.svelte.js +92 -0
- package/vendor/streamdown/IconProvider.svelte +11 -0
- package/vendor/streamdown/IconProvider.svelte.d.ts +30 -0
- package/vendor/streamdown/LICENSE +202 -0
- package/vendor/streamdown/PluginProvider.svelte +11 -0
- package/vendor/streamdown/PluginProvider.svelte.d.ts +30 -0
- package/vendor/streamdown/README.svadmin.md +5 -0
- package/vendor/streamdown/Streamdown.svelte +447 -0
- package/vendor/streamdown/Streamdown.svelte.d.ts +25 -0
- package/vendor/streamdown/block/BlockTokens.svelte +45 -0
- package/vendor/streamdown/block/BlockTokens.svelte.d.ts +9 -0
- package/vendor/streamdown/block/html.d.ts +14 -0
- package/vendor/streamdown/block/html.js +27 -0
- package/vendor/streamdown/block/text.d.ts +10 -0
- package/vendor/streamdown/block/text.js +31 -0
- package/vendor/streamdown/context-key.d.ts +1 -0
- package/vendor/streamdown/context-key.js +1 -0
- package/vendor/streamdown/context.svelte.d.ts +24 -0
- package/vendor/streamdown/context.svelte.js +75 -0
- package/vendor/streamdown/contracts/plugins.d.ts +26 -0
- package/vendor/streamdown/contracts/plugins.js +1 -0
- package/vendor/streamdown/contracts/streamdown.d.ts +374 -0
- package/vendor/streamdown/contracts/streamdown.js +29 -0
- package/vendor/streamdown/detect-direction.d.ts +1 -0
- package/vendor/streamdown/detect-direction.js +1 -0
- package/vendor/streamdown/icon-context.d.ts +36 -0
- package/vendor/streamdown/icon-context.js +52 -0
- package/vendor/streamdown/incomplete-code.d.ts +6 -0
- package/vendor/streamdown/incomplete-code.js +23 -0
- package/vendor/streamdown/index.d.ts +22 -0
- package/vendor/streamdown/index.js +20 -0
- package/vendor/streamdown/markdown-parse-cache.d.ts +37 -0
- package/vendor/streamdown/markdown-parse-cache.js +109 -0
- package/vendor/streamdown/markdown.d.ts +21 -0
- package/vendor/streamdown/markdown.js +214 -0
- package/vendor/streamdown/marked/index.d.ts +44 -0
- package/vendor/streamdown/marked/index.js +228 -0
- package/vendor/streamdown/marked/marked-alert.d.ts +13 -0
- package/vendor/streamdown/marked/marked-alert.js +47 -0
- package/vendor/streamdown/marked/marked-align.d.ts +10 -0
- package/vendor/streamdown/marked/marked-align.js +45 -0
- package/vendor/streamdown/marked/marked-br.d.ts +6 -0
- package/vendor/streamdown/marked/marked-br.js +15 -0
- package/vendor/streamdown/marked/marked-citations.d.ts +8 -0
- package/vendor/streamdown/marked/marked-citations.js +53 -0
- package/vendor/streamdown/marked/marked-cjk.d.ts +2 -0
- package/vendor/streamdown/marked/marked-cjk.js +165 -0
- package/vendor/streamdown/marked/marked-dl.d.ts +23 -0
- package/vendor/streamdown/marked/marked-dl.js +44 -0
- package/vendor/streamdown/marked/marked-footnotes.d.ts +26 -0
- package/vendor/streamdown/marked/marked-footnotes.js +101 -0
- package/vendor/streamdown/marked/marked-hr.d.ts +6 -0
- package/vendor/streamdown/marked/marked-hr.js +18 -0
- package/vendor/streamdown/marked/marked-list.d.ts +31 -0
- package/vendor/streamdown/marked/marked-list.js +330 -0
- package/vendor/streamdown/marked/marked-math.d.ts +13 -0
- package/vendor/streamdown/marked/marked-math.js +129 -0
- package/vendor/streamdown/marked/marked-mdx.d.ts +12 -0
- package/vendor/streamdown/marked/marked-mdx.js +124 -0
- package/vendor/streamdown/marked/marked-subsup.d.ts +22 -0
- package/vendor/streamdown/marked/marked-subsup.js +40 -0
- package/vendor/streamdown/marked/marked-table.d.ts +80 -0
- package/vendor/streamdown/marked/marked-table.js +527 -0
- package/vendor/streamdown/plugin-context.d.ts +19 -0
- package/vendor/streamdown/plugin-context.js +40 -0
- package/vendor/streamdown/plugins/cjk-shared.d.ts +1 -0
- package/vendor/streamdown/plugins/cjk-shared.js +1 -0
- package/vendor/streamdown/plugins.d.ts +19 -0
- package/vendor/streamdown/plugins.js +107 -0
- package/vendor/streamdown/provenance.json +229 -0
- package/vendor/streamdown/remend.d.ts +2 -0
- package/vendor/streamdown/remend.js +1 -0
- package/vendor/streamdown/security/html.d.ts +19 -0
- package/vendor/streamdown/security/html.js +329 -0
- package/vendor/streamdown/security/preprocess-custom-tags.d.ts +1 -0
- package/vendor/streamdown/security/preprocess-custom-tags.js +20 -0
- package/vendor/streamdown/security/preprocess-literal-tag-content.d.ts +1 -0
- package/vendor/streamdown/security/preprocess-literal-tag-content.js +16 -0
- package/vendor/streamdown/security/types.d.ts +1 -0
- package/vendor/streamdown/security/types.js +1 -0
- package/vendor/streamdown/site/SiteHeader.svelte +94 -0
- package/vendor/streamdown/site/SiteHeader.svelte.d.ts +6 -0
- package/vendor/streamdown/site/home/HomeDemo.svelte +122 -0
- package/vendor/streamdown/site/home/HomeDemo.svelte.d.ts +3 -0
- package/vendor/streamdown/site/home/HomePage.svelte +293 -0
- package/vendor/streamdown/site/home/HomePage.svelte.d.ts +3 -0
- package/vendor/streamdown/site/home/content.d.ts +69 -0
- package/vendor/streamdown/site/home/content.js +144 -0
- package/vendor/streamdown/site/metadata.d.ts +4 -0
- package/vendor/streamdown/site/metadata.js +4 -0
- package/vendor/streamdown/site/navigation.d.ts +6 -0
- package/vendor/streamdown/site/navigation.js +22 -0
- package/vendor/streamdown/streamdown/config.d.ts +41 -0
- package/vendor/streamdown/streamdown/config.js +125 -0
- package/vendor/streamdown/streamdown/context.d.ts +12 -0
- package/vendor/streamdown/streamdown/context.js +2 -0
- package/vendor/streamdown/streamdown/incomplete-markdown.d.ts +5 -0
- package/vendor/streamdown/streamdown/incomplete-markdown.js +79 -0
- package/vendor/streamdown/streamdown/pipeline.d.ts +95 -0
- package/vendor/streamdown/streamdown/pipeline.js +138 -0
- package/vendor/streamdown/streamdown/runtime.d.ts +59 -0
- package/vendor/streamdown/streamdown/runtime.js +112 -0
- package/vendor/streamdown/streaming.d.ts +5 -0
- package/vendor/streamdown/streaming.js +5 -0
- package/vendor/streamdown/theme.d.ts +486 -0
- package/vendor/streamdown/theme.js +370 -0
- package/vendor/streamdown/translations.d.ts +43 -0
- package/vendor/streamdown/translations.js +54 -0
- package/vendor/streamdown/url-policy.d.ts +1 -0
- package/vendor/streamdown/url-policy.js +1 -0
- package/vendor/streamdown/utils/bind.d.ts +8 -0
- package/vendor/streamdown/utils/bind.js +26 -0
- package/vendor/streamdown/utils/bundledLanguages.d.ts +1 -0
- package/vendor/streamdown/utils/bundledLanguages.js +1 -0
- package/vendor/streamdown/utils/code-block.d.ts +8 -0
- package/vendor/streamdown/utils/code-block.js +38 -0
- package/vendor/streamdown/utils/copy.svelte.d.ts +7 -0
- package/vendor/streamdown/utils/copy.svelte.js +38 -0
- package/vendor/streamdown/utils/darkMode.svelte.d.ts +3 -0
- package/vendor/streamdown/utils/darkMode.svelte.js +49 -0
- package/vendor/streamdown/utils/detectDirection.d.ts +1 -0
- package/vendor/streamdown/utils/detectDirection.js +19 -0
- package/vendor/streamdown/utils/get.d.ts +1 -0
- package/vendor/streamdown/utils/get.js +25 -0
- package/vendor/streamdown/utils/hightlighter.svelte.d.ts +30 -0
- package/vendor/streamdown/utils/hightlighter.svelte.js +524 -0
- package/vendor/streamdown/utils/index.d.ts +3 -0
- package/vendor/streamdown/utils/index.js +3 -0
- package/vendor/streamdown/utils/mermaid.d.ts +13 -0
- package/vendor/streamdown/utils/mermaid.js +49 -0
- package/vendor/streamdown/utils/panzoom.svelte.d.ts +35 -0
- package/vendor/streamdown/utils/panzoom.svelte.js +556 -0
- package/vendor/streamdown/utils/parse-incomplete-markdown.d.ts +2 -0
- package/vendor/streamdown/utils/parse-incomplete-markdown.js +2 -0
- package/vendor/streamdown/utils/runtime-env.d.ts +1 -0
- package/vendor/streamdown/utils/runtime-env.js +13 -0
- package/vendor/streamdown/utils/save.d.ts +1 -0
- package/vendor/streamdown/utils/save.js +14 -0
- package/vendor/streamdown/utils/scroll-lock.d.ts +2 -0
- package/vendor/streamdown/utils/scroll-lock.js +35 -0
- package/vendor/streamdown/utils/table.d.ts +8 -0
- package/vendor/streamdown/utils/table.js +176 -0
- package/vendor/streamdown/utils/url.d.ts +22 -0
- package/vendor/streamdown/utils/url.js +98 -0
- package/vendor/streamdown/utils/useClickOutside.svelte.d.ts +8 -0
- package/vendor/streamdown/utils/useClickOutside.svelte.js +41 -0
- package/vendor/streamdown/utils/useKeyDown.svelte.d.ts +5 -0
- package/vendor/streamdown/utils/useKeyDown.svelte.js +23 -0
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/ai-elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Composable Svelte 5 AI interaction components for SVAdmin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
7
|
-
"./dist
|
|
7
|
+
"./dist/*.css",
|
|
8
|
+
"./vendor/**/*.css"
|
|
8
9
|
],
|
|
9
10
|
"files": [
|
|
10
11
|
"dist",
|
|
@@ -13,7 +14,8 @@
|
|
|
13
14
|
"!dist/**/*.test.*",
|
|
14
15
|
"!dist/**/*.test-*",
|
|
15
16
|
"!dist/**/*.spec.*",
|
|
16
|
-
"!dist/**/*.spec-*"
|
|
17
|
+
"!dist/**/*.spec-*",
|
|
18
|
+
"vendor"
|
|
17
19
|
],
|
|
18
20
|
"main": "dist/index.js",
|
|
19
21
|
"types": "dist/index.d.ts",
|
|
@@ -47,10 +49,14 @@
|
|
|
47
49
|
"./parity": {
|
|
48
50
|
"types": "./dist/parity-manifest.d.ts",
|
|
49
51
|
"default": "./dist/parity-manifest.js"
|
|
52
|
+
},
|
|
53
|
+
"./ai.theme.css": {
|
|
54
|
+
"style": "./dist/ai.theme.css",
|
|
55
|
+
"default": "./dist/ai.theme.css"
|
|
50
56
|
}
|
|
51
57
|
},
|
|
52
58
|
"peerDependencies": {
|
|
53
|
-
"@svadmin/core": "^0.
|
|
59
|
+
"@svadmin/core": "^0.54.0",
|
|
54
60
|
"@tanstack/svelte-query": "^6.1.48",
|
|
55
61
|
"svelte": "^5.56.10"
|
|
56
62
|
},
|
|
@@ -64,11 +70,29 @@
|
|
|
64
70
|
"@rive-app/webgl2": "^2.41.0",
|
|
65
71
|
"@sinclair/typebox": "^0.34.52",
|
|
66
72
|
"@xyflow/svelte": "^1.6.5",
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
73
|
+
"type-fest": "^4.41.0",
|
|
74
|
+
"clsx": "^2.1.1",
|
|
75
|
+
"@floating-ui/dom": "^1.7.4",
|
|
76
|
+
"@shikijs/langs": "^3.17.1",
|
|
77
|
+
"@shikijs/themes": "^3.17.1",
|
|
78
|
+
"esm-env": "^1.2.2",
|
|
79
|
+
"katex": "^0.16.22",
|
|
80
|
+
"marked": "^16.2.1",
|
|
81
|
+
"mermaid": "^11.11.0",
|
|
82
|
+
"rehype-harden": "^1.1.8",
|
|
83
|
+
"rehype-raw": "^7.0.0",
|
|
84
|
+
"rehype-sanitize": "^6.0.0",
|
|
85
|
+
"rehype-stringify": "^10.0.1",
|
|
86
|
+
"remark-cjk-friendly": "^2.0.1",
|
|
87
|
+
"remark-cjk-friendly-gfm-strikethrough": "^2.0.1",
|
|
88
|
+
"remark-gfm": "^4.0.1",
|
|
89
|
+
"remark-parse": "^11.0.0",
|
|
90
|
+
"remark-rehype": "^11.1.2",
|
|
91
|
+
"shiki": "^3.13.0",
|
|
92
|
+
"unified": "^11.0.5",
|
|
93
|
+
"unist-util-visit": "^5.1.0",
|
|
94
|
+
"@streamdown-svelte/plugin-core": "1.0.0",
|
|
95
|
+
"@streamdown-svelte/remend": "1.3.0"
|
|
72
96
|
},
|
|
73
97
|
"devDependencies": {
|
|
74
98
|
"@happy-dom/global-registrator": "^20.11.12",
|
|
@@ -81,10 +105,11 @@
|
|
|
81
105
|
"vitest": "^4.1.11"
|
|
82
106
|
},
|
|
83
107
|
"scripts": {
|
|
84
|
-
"build": "node ../../node_modules/@sveltejs/package/svelte-package.js -i src -o dist && bun scripts/clean-dist.ts",
|
|
108
|
+
"build": "node ../../scripts/check-native-style-sources.mjs ai-elements && node ../../scripts/build-native-classnames.mjs ai-elements && node ../../node_modules/@sveltejs/package/svelte-package.js -i src -o dist && bun scripts/clean-dist.ts",
|
|
85
109
|
"check": "svelte-check --tsgo-experimental-api --tsconfig ./tsconfig.json --threshold error",
|
|
86
110
|
"test": "vitest run --config ./vitest.config.ts && bun test scripts/clean-dist.test.ts scripts/audit-upstream-parity.test.ts",
|
|
87
|
-
"audit:upstream": "bun scripts/audit-upstream-parity.ts"
|
|
111
|
+
"audit:upstream": "bun scripts/audit-upstream-parity.ts",
|
|
112
|
+
"styles:migrated:check": "node ../../scripts/check-native-style-sources.mjs ai-elements"
|
|
88
113
|
},
|
|
89
114
|
"license": "MIT",
|
|
90
115
|
"publishConfig": {
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useStreamdown } from './context.svelte.js';
|
|
3
|
+
let { text }: { text: string } = $props();
|
|
4
|
+
|
|
5
|
+
const streamdown = useStreamdown();
|
|
6
|
+
const whitespaceOnlyPattern = /^\s+$/;
|
|
7
|
+
let previousRenderedLength = $state(0);
|
|
8
|
+
let committedText = $state('');
|
|
9
|
+
|
|
10
|
+
const tokenizeNewContent = (text: string) => {
|
|
11
|
+
if (!text) return [];
|
|
12
|
+
|
|
13
|
+
let splitRegex;
|
|
14
|
+
if (streamdown.animation.tokenize === 'word') {
|
|
15
|
+
splitRegex = /(\s+)/;
|
|
16
|
+
} else {
|
|
17
|
+
splitRegex = /(.)/;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return text.split(splitRegex).filter((token) => token.length > 0);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const tokens = $derived.by(() => {
|
|
24
|
+
let cursor = 0;
|
|
25
|
+
let newAnimatedTokenIndex = 0;
|
|
26
|
+
const stagger = streamdown.animation.stagger ?? 0;
|
|
27
|
+
|
|
28
|
+
return tokenizeNewContent(text).map((token) => {
|
|
29
|
+
const start = cursor;
|
|
30
|
+
cursor += token.length;
|
|
31
|
+
|
|
32
|
+
if (whitespaceOnlyPattern.test(token)) {
|
|
33
|
+
return {
|
|
34
|
+
content: token,
|
|
35
|
+
animated: false,
|
|
36
|
+
style: undefined
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const isAlreadyRendered = previousRenderedLength > 0 && start < previousRenderedLength;
|
|
41
|
+
const duration = isAlreadyRendered ? 0 : streamdown.animation.duration;
|
|
42
|
+
const delay = !isAlreadyRendered && stagger > 0 ? newAnimatedTokenIndex * stagger : 0;
|
|
43
|
+
|
|
44
|
+
if (!isAlreadyRendered) {
|
|
45
|
+
newAnimatedTokenIndex += 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
content: token,
|
|
50
|
+
animated: true,
|
|
51
|
+
style: `--sd-animation:sd-${streamdown.animation.type};
|
|
52
|
+
--sd-duration:${duration}ms;
|
|
53
|
+
--sd-easing:${streamdown.animation.timingFunction};
|
|
54
|
+
${delay > 0 ? `--sd-delay:${delay}ms;\n` : ''}animation-name: var(--sd-animation);
|
|
55
|
+
animation-duration: var(--sd-duration);
|
|
56
|
+
animation-timing-function: var(--sd-easing);
|
|
57
|
+
animation-delay: var(--sd-delay, 0ms);
|
|
58
|
+
animation-iteration-count: 1;
|
|
59
|
+
animation-fill-mode: forwards;
|
|
60
|
+
white-space: pre-wrap;
|
|
61
|
+
display: inline-block;
|
|
62
|
+
text-decoration: inherit;`
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
$effect(() => {
|
|
68
|
+
if (!(streamdown.animation.enabled && streamdown.isAnimating)) {
|
|
69
|
+
previousRenderedLength = 0;
|
|
70
|
+
committedText = '';
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (text !== committedText) {
|
|
75
|
+
previousRenderedLength = committedText.length;
|
|
76
|
+
committedText = text;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
{#if streamdown.animation.enabled}
|
|
82
|
+
{#each tokens as token}
|
|
83
|
+
{#if token.animated}
|
|
84
|
+
<span data-streamdown-animate="" style={token.style}>
|
|
85
|
+
{token.content}
|
|
86
|
+
</span>
|
|
87
|
+
{:else}
|
|
88
|
+
{token.content}
|
|
89
|
+
{/if}
|
|
90
|
+
{/each}
|
|
91
|
+
{:else}
|
|
92
|
+
{text}
|
|
93
|
+
{/if}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { setContext } from 'svelte';
|
|
3
|
+
import BlockTokens from './block/BlockTokens.svelte';
|
|
4
|
+
import { renderBlockHtml } from './block/html.js';
|
|
5
|
+
import { useStreamdown } from './context.svelte.js';
|
|
6
|
+
import { filterMarkdownTokens } from './markdown.js';
|
|
7
|
+
import { lex, type StreamdownToken } from './marked/index.js';
|
|
8
|
+
import { applyPluginMarkdownTransforms } from './plugins.js';
|
|
9
|
+
import { repairIncompleteMarkdown } from './streamdown/incomplete-markdown.js';
|
|
10
|
+
import { detectTextDirection } from './utils/detectDirection.js';
|
|
11
|
+
import { hasIncompleteCodeFence, STREAMDOWN_BLOCK_CONTEXT } from './incomplete-code.js';
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
block,
|
|
15
|
+
static: isStatic = false,
|
|
16
|
+
tokens: providedTokens,
|
|
17
|
+
parseIncompleteMarkdown: shouldParseIncompleteMarkdown = true,
|
|
18
|
+
isIncomplete = false
|
|
19
|
+
}: {
|
|
20
|
+
block: string;
|
|
21
|
+
static?: boolean;
|
|
22
|
+
tokens?: StreamdownToken[];
|
|
23
|
+
parseIncompleteMarkdown?: boolean;
|
|
24
|
+
isIncomplete?: boolean;
|
|
25
|
+
} = $props();
|
|
26
|
+
|
|
27
|
+
const streamdown = useStreamdown();
|
|
28
|
+
const repairedBlock = $derived.by(() => {
|
|
29
|
+
if (providedTokens) {
|
|
30
|
+
return block;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (isStatic || !shouldParseIncompleteMarkdown || streamdown.parseIncompleteMarkdown === false) {
|
|
34
|
+
return block;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return repairIncompleteMarkdown(block, streamdown.remend);
|
|
38
|
+
});
|
|
39
|
+
const markdown = $derived(applyPluginMarkdownTransforms(repairedBlock, streamdown.plugins));
|
|
40
|
+
const isIncompleteCodeFence = $derived(
|
|
41
|
+
streamdown.isAnimating && !isStatic && hasIncompleteCodeFence(block)
|
|
42
|
+
);
|
|
43
|
+
const tokens = $derived(
|
|
44
|
+
filterMarkdownTokens(providedTokens ?? lex(markdown, streamdown.extensions), {
|
|
45
|
+
allowedElements: streamdown.allowedElements,
|
|
46
|
+
allowElement: streamdown.allowElement,
|
|
47
|
+
disallowedElements: streamdown.disallowedElements,
|
|
48
|
+
skipHtml: streamdown.skipHtml,
|
|
49
|
+
unwrapDisallowed: streamdown.unwrapDisallowed
|
|
50
|
+
})
|
|
51
|
+
);
|
|
52
|
+
const securityHtmlBlock = $derived.by(() => {
|
|
53
|
+
return renderBlockHtml(markdown, {
|
|
54
|
+
allowedImagePrefixes: streamdown.allowedImagePrefixes,
|
|
55
|
+
allowedLinkPrefixes: streamdown.allowedLinkPrefixes,
|
|
56
|
+
allowedTags: streamdown.allowedTags,
|
|
57
|
+
defaultOrigin: streamdown.defaultOrigin,
|
|
58
|
+
renderHtml: streamdown.renderHtml,
|
|
59
|
+
skipHtml: streamdown.skipHtml,
|
|
60
|
+
urlTransform: streamdown.urlTransform
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const dir = $derived.by(() => {
|
|
65
|
+
if (!streamdown.dir) {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (streamdown.dir === 'auto') {
|
|
70
|
+
return detectTextDirection(markdown);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return streamdown.dir;
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
setContext(STREAMDOWN_BLOCK_CONTEXT, {
|
|
77
|
+
get isIncompleteCodeFence() {
|
|
78
|
+
return isIncompleteCodeFence;
|
|
79
|
+
},
|
|
80
|
+
get rawBlock() {
|
|
81
|
+
return block;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
{#if securityHtmlBlock !== null}
|
|
87
|
+
{@html securityHtmlBlock}
|
|
88
|
+
{:else}
|
|
89
|
+
{#if dir}
|
|
90
|
+
<div data-streamdown-dir={dir} {dir} style="display: contents;">
|
|
91
|
+
<BlockTokens {tokens} {isIncomplete} {isStatic} />
|
|
92
|
+
</div>
|
|
93
|
+
{:else}
|
|
94
|
+
<BlockTokens {tokens} {isIncomplete} {isStatic} />
|
|
95
|
+
{/if}
|
|
96
|
+
{/if}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type StreamdownToken } from './marked/index.js';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
block: string;
|
|
4
|
+
static?: boolean;
|
|
5
|
+
tokens?: StreamdownToken[];
|
|
6
|
+
parseIncompleteMarkdown?: boolean;
|
|
7
|
+
isIncomplete?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const Block: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
10
|
+
type Block = ReturnType<typeof Block>;
|
|
11
|
+
export default Block;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
const icons = {
|
|
3
|
+
note: `<circle cx="12" cy="12" r="10" /><path d="M12 16v-4" /><path d="M12 8h.01" />`,
|
|
4
|
+
caution: `<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>`,
|
|
5
|
+
important: `<path
|
|
6
|
+
d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"
|
|
7
|
+
/><path d="M7 11h10" /><path d="M7 15h6" /><path d="M7 7h8" />`,
|
|
8
|
+
tip: `<path
|
|
9
|
+
d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"
|
|
10
|
+
/><path d="M9 18h6" /><path d="M10 22h4" />`,
|
|
11
|
+
warning: `<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" /><path
|
|
12
|
+
d="M12 9v4"
|
|
13
|
+
/><path d="M12 17h.01" />`
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
import { useStreamdown } from '../context.svelte.js';
|
|
17
|
+
import { resolveIcon } from './icons.js';
|
|
18
|
+
import Slot from './Slot.svelte';
|
|
19
|
+
import type { AlertToken } from '../marked/index.js';
|
|
20
|
+
import type { Snippet } from 'svelte';
|
|
21
|
+
|
|
22
|
+
const streamdown = useStreamdown();
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
children,
|
|
26
|
+
token,
|
|
27
|
+
id
|
|
28
|
+
}: {
|
|
29
|
+
id: string;
|
|
30
|
+
children: Snippet;
|
|
31
|
+
token: AlertToken;
|
|
32
|
+
} = $props();
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<Slot
|
|
36
|
+
props={{
|
|
37
|
+
children,
|
|
38
|
+
token
|
|
39
|
+
}}
|
|
40
|
+
render={streamdown.snippets.alert}
|
|
41
|
+
>
|
|
42
|
+
<div
|
|
43
|
+
data-streamdown-alert={id}
|
|
44
|
+
style={streamdown.isMounted ? streamdown.animationBlockStyle : ''}
|
|
45
|
+
class={`${streamdown.theme.alert.base} ${streamdown.theme.alert[token.variant]}`}
|
|
46
|
+
>
|
|
47
|
+
<div data-alert-title class={streamdown.theme.alert.title}>
|
|
48
|
+
{@render resolveIcon(streamdown.icons, token.variant, icon)()}
|
|
49
|
+
{streamdown.translations?.alert?.[token.variant] || token.variant}
|
|
50
|
+
</div>
|
|
51
|
+
{@render children()}
|
|
52
|
+
</div>
|
|
53
|
+
</Slot>
|
|
54
|
+
|
|
55
|
+
{#snippet icon()}
|
|
56
|
+
<svg
|
|
57
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
58
|
+
width="24"
|
|
59
|
+
height="24"
|
|
60
|
+
viewBox="0 0 24 24"
|
|
61
|
+
fill="none"
|
|
62
|
+
stroke-width="2"
|
|
63
|
+
stroke-linecap="round"
|
|
64
|
+
stroke-linejoin="round"
|
|
65
|
+
class={streamdown.theme.alert.icon}
|
|
66
|
+
>
|
|
67
|
+
{@html icons[token.variant]}
|
|
68
|
+
</svg>
|
|
69
|
+
{/snippet}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AlertToken } from '../marked/index.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
id: string;
|
|
5
|
+
children: Snippet;
|
|
6
|
+
token: AlertToken;
|
|
7
|
+
};
|
|
8
|
+
declare const Alert: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
9
|
+
type Alert = ReturnType<typeof Alert>;
|
|
10
|
+
export default Alert;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useStreamdown } from '../context.svelte.js';
|
|
3
|
+
import Slot from './Slot.svelte';
|
|
4
|
+
import { useClickOutside } from '../utils/useClickOutside.svelte.js';
|
|
5
|
+
import { scale } from 'svelte/transition';
|
|
6
|
+
import Block from '../Block.svelte';
|
|
7
|
+
import { useKeyDown } from '../utils/useKeyDown.svelte.js';
|
|
8
|
+
import type { CitationToken } from '../marked/marked-citations.js';
|
|
9
|
+
import { StepperState } from './stepperState.svelte.js';
|
|
10
|
+
import { Popover } from './popover.svelte.js';
|
|
11
|
+
import { get } from '../utils/get.js';
|
|
12
|
+
import { chevronLeft, chevronRight, resolveIcon } from './icons.js';
|
|
13
|
+
|
|
14
|
+
const {
|
|
15
|
+
token
|
|
16
|
+
}: {
|
|
17
|
+
token: CitationToken;
|
|
18
|
+
} = $props();
|
|
19
|
+
const streamdown = useStreamdown();
|
|
20
|
+
const id = $props.id();
|
|
21
|
+
const popover = new Popover();
|
|
22
|
+
|
|
23
|
+
const citationWithSources = $derived.by(() => {
|
|
24
|
+
return token.keys.reduce((acc, key) => {
|
|
25
|
+
const source = get<Record<string, any>>(streamdown.sources, key);
|
|
26
|
+
const safeUrl = (url: string | null) => {
|
|
27
|
+
if (url == null) return null;
|
|
28
|
+
try {
|
|
29
|
+
return new URL(url);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
if (source) {
|
|
35
|
+
const url = safeUrl(source.url ?? source.href ?? source.link ?? source.source);
|
|
36
|
+
acc.push({
|
|
37
|
+
key,
|
|
38
|
+
title: source.title ?? source.name ?? source.author ?? null,
|
|
39
|
+
url,
|
|
40
|
+
host: url ? url.host.replace('www.', '') : null,
|
|
41
|
+
favicon: url ? `https://www.google.com/s2/favicons?domain=${url.hostname}&sz=128` : null,
|
|
42
|
+
content: source.content ?? source.text ?? source.summary ?? source.excerpt ?? null,
|
|
43
|
+
source
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return acc;
|
|
47
|
+
}, [] as CitationWithSource[]);
|
|
48
|
+
});
|
|
49
|
+
useKeyDown({
|
|
50
|
+
keys: ['Escape'],
|
|
51
|
+
get isActive() {
|
|
52
|
+
return popover.isOpen;
|
|
53
|
+
},
|
|
54
|
+
callback: () => {
|
|
55
|
+
popover.isOpen = false;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const clickOutside = useClickOutside({
|
|
59
|
+
get isActive() {
|
|
60
|
+
return popover.isOpen;
|
|
61
|
+
},
|
|
62
|
+
callback: () => {
|
|
63
|
+
popover.isOpen = false;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const stepper = new StepperState({
|
|
68
|
+
get items() {
|
|
69
|
+
return citationWithSources;
|
|
70
|
+
},
|
|
71
|
+
keyFramesOptions: { duration: 200, easing: 'ease-in-out', fill: 'forwards' }
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
type CitationWithSource = Record<string, any> & {
|
|
75
|
+
key: string;
|
|
76
|
+
title: string | null;
|
|
77
|
+
url: URL | null;
|
|
78
|
+
favicon: string | null;
|
|
79
|
+
content: string | null;
|
|
80
|
+
source: Record<string, any>;
|
|
81
|
+
};
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
{#if popover.isOpen}
|
|
85
|
+
<dialog
|
|
86
|
+
data-streamdown-citation-popover={id}
|
|
87
|
+
id={'citation-popover-' + id}
|
|
88
|
+
aria-modal="false"
|
|
89
|
+
transition:scale|global={{ start: 0.95, duration: 200 }}
|
|
90
|
+
{@attach clickOutside.attachment}
|
|
91
|
+
{@attach popover.popoverAttachment}
|
|
92
|
+
open
|
|
93
|
+
class={`${streamdown.theme.components.popover}`}
|
|
94
|
+
style:max-width="400px"
|
|
95
|
+
>
|
|
96
|
+
<Slot
|
|
97
|
+
props={{
|
|
98
|
+
token,
|
|
99
|
+
isOpen: popover.isOpen
|
|
100
|
+
}}
|
|
101
|
+
render={streamdown.snippets.inlineCitationPopover}
|
|
102
|
+
>
|
|
103
|
+
{#if streamdown.inlineCitationsMode === 'carousel'}
|
|
104
|
+
{@render carouselView()}
|
|
105
|
+
{:else}
|
|
106
|
+
{@render listView()}
|
|
107
|
+
{/if}
|
|
108
|
+
</Slot>
|
|
109
|
+
</dialog>
|
|
110
|
+
{/if}
|
|
111
|
+
|
|
112
|
+
{#snippet listView()}
|
|
113
|
+
<div class={streamdown.theme.inlineCitation.list.base}>
|
|
114
|
+
{#each citationWithSources as { favicon, key, source, title, url }}
|
|
115
|
+
<Slot render={streamdown.snippets.inlineCitationContent} props={{ source, key, token }}>
|
|
116
|
+
<a
|
|
117
|
+
class={streamdown.theme.inlineCitation.list.item}
|
|
118
|
+
href={url?.toString()}
|
|
119
|
+
target="_blank"
|
|
120
|
+
rel="noopener noreferrer"
|
|
121
|
+
>
|
|
122
|
+
{#if title}
|
|
123
|
+
<span class={streamdown.theme.inlineCitation.list.title}>{title}</span>
|
|
124
|
+
{/if}
|
|
125
|
+
{#if url}
|
|
126
|
+
<span class={streamdown.theme.inlineCitation.list.url}>
|
|
127
|
+
{#if favicon}
|
|
128
|
+
<img
|
|
129
|
+
src={favicon}
|
|
130
|
+
alt={title || url.host}
|
|
131
|
+
class={streamdown.theme.inlineCitation.list.favicon}
|
|
132
|
+
/>
|
|
133
|
+
{/if}
|
|
134
|
+
{url.host}{url.pathname === '/' ? '' : url.pathname}
|
|
135
|
+
</span>
|
|
136
|
+
{/if}
|
|
137
|
+
</a>
|
|
138
|
+
</Slot>
|
|
139
|
+
{/each}
|
|
140
|
+
</div>
|
|
141
|
+
{/snippet}
|
|
142
|
+
|
|
143
|
+
{#snippet carouselView()}
|
|
144
|
+
{#if citationWithSources.length > 1}
|
|
145
|
+
<div class={streamdown.theme.inlineCitation.carousel.header}>
|
|
146
|
+
<div class={streamdown.theme.inlineCitation.carousel.stepCounter}>
|
|
147
|
+
{stepper.activeStep + 1}
|
|
148
|
+
/ {citationWithSources.length}
|
|
149
|
+
</div>
|
|
150
|
+
<div class={streamdown.theme.inlineCitation.carousel.buttons}>
|
|
151
|
+
<button
|
|
152
|
+
disabled={!stepper.canGoPrevious}
|
|
153
|
+
class={streamdown.theme.components.button}
|
|
154
|
+
onclick={() => stepper.previous()}
|
|
155
|
+
>
|
|
156
|
+
{@render resolveIcon(streamdown.icons, 'chevronLeft', chevronLeft)()}
|
|
157
|
+
</button>
|
|
158
|
+
<button
|
|
159
|
+
disabled={!stepper.canGoNext}
|
|
160
|
+
class={streamdown.theme.components.button}
|
|
161
|
+
onclick={() => stepper.next()}
|
|
162
|
+
>
|
|
163
|
+
{@render resolveIcon(streamdown.icons, 'chevronRight', chevronRight)()}
|
|
164
|
+
</button>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
{/if}
|
|
168
|
+
<div
|
|
169
|
+
use:stepper.scroller
|
|
170
|
+
style:height={Number.isFinite(stepper.stepHeights[stepper.activeStep])
|
|
171
|
+
? `${stepper.stepHeights[stepper.activeStep]}px`
|
|
172
|
+
: 'auto'}
|
|
173
|
+
style:overflow="hidden"
|
|
174
|
+
style:position="relative"
|
|
175
|
+
style:transition-duration="200ms"
|
|
176
|
+
style:transition-timing-function="ease-in-out"
|
|
177
|
+
aria-label="Citations-${id}"
|
|
178
|
+
>
|
|
179
|
+
<div
|
|
180
|
+
bind:this={stepper.stepContainer}
|
|
181
|
+
style:display="grid"
|
|
182
|
+
style:transition-duration={`${200}ms`}
|
|
183
|
+
style:width="100%"
|
|
184
|
+
style:grid-template-columns="repeat({citationWithSources.length}, 100%)"
|
|
185
|
+
>
|
|
186
|
+
{#each citationWithSources as { favicon, key, source, title, url, content }, index}
|
|
187
|
+
<div
|
|
188
|
+
bind:offsetHeight={stepper.stepHeights[index]}
|
|
189
|
+
data-step={index}
|
|
190
|
+
tabindex={stepper.activeStep === index ? 0 : -1}
|
|
191
|
+
inert={stepper.activeStep !== index}
|
|
192
|
+
role="tabpanel"
|
|
193
|
+
style:height="fit-content"
|
|
194
|
+
style:width="100%"
|
|
195
|
+
style:flex-grow="1"
|
|
196
|
+
aria-label="Citation-${id}"
|
|
197
|
+
>
|
|
198
|
+
<Slot render={streamdown.snippets.inlineCitationContent} props={{ source, key, token }}>
|
|
199
|
+
{#if url || title}
|
|
200
|
+
<div class="mb-4">
|
|
201
|
+
{#if title}
|
|
202
|
+
<div class={streamdown.theme.inlineCitation.carousel.title}>
|
|
203
|
+
{title}
|
|
204
|
+
</div>
|
|
205
|
+
{/if}
|
|
206
|
+
{#if url}
|
|
207
|
+
<a
|
|
208
|
+
href={url.toString()}
|
|
209
|
+
target="_blank"
|
|
210
|
+
rel="noopener noreferrer"
|
|
211
|
+
class={streamdown.theme.inlineCitation.carousel.url}
|
|
212
|
+
>
|
|
213
|
+
{#if favicon}
|
|
214
|
+
<img
|
|
215
|
+
src={favicon}
|
|
216
|
+
alt={title || url.host}
|
|
217
|
+
class={streamdown.theme.inlineCitation.carousel.favicon}
|
|
218
|
+
/>
|
|
219
|
+
{/if}
|
|
220
|
+
<!-- Skip search params -->
|
|
221
|
+
{url.host}{url.pathname === '/' ? '' : url.pathname}
|
|
222
|
+
</a>
|
|
223
|
+
{/if}
|
|
224
|
+
</div>
|
|
225
|
+
{/if}
|
|
226
|
+
{#if content}
|
|
227
|
+
<Block block={content} />
|
|
228
|
+
{/if}
|
|
229
|
+
</Slot>
|
|
230
|
+
</div>
|
|
231
|
+
{/each}
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
{/snippet}
|
|
235
|
+
|
|
236
|
+
{#if citationWithSources.length > 0}
|
|
237
|
+
<button
|
|
238
|
+
data-streamdown-citation-preview={id}
|
|
239
|
+
style={streamdown.animationBlockStyle}
|
|
240
|
+
bind:this={popover.reference}
|
|
241
|
+
class={streamdown.theme.inlineCitation.preview}
|
|
242
|
+
onclick={() => (popover.isOpen = !popover.isOpen)}
|
|
243
|
+
aria-expanded={popover.isOpen}
|
|
244
|
+
aria-haspopup="dialog"
|
|
245
|
+
aria-controls={'citation-popover-' + id}
|
|
246
|
+
{@attach clickOutside.attachment}
|
|
247
|
+
>
|
|
248
|
+
<Slot
|
|
249
|
+
render={streamdown.snippets.inlineCitationPreview}
|
|
250
|
+
props={{
|
|
251
|
+
token
|
|
252
|
+
}}
|
|
253
|
+
>
|
|
254
|
+
{citationWithSources[0]?.url?.host ??
|
|
255
|
+
citationWithSources[0]?.title ??
|
|
256
|
+
citationWithSources[0]?.key}
|
|
257
|
+
{citationWithSources.length > 1 ? ` +${citationWithSources.length - 1}` : ''}
|
|
258
|
+
</Slot>
|
|
259
|
+
</button>
|
|
260
|
+
{/if}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CitationToken } from '../marked/marked-citations.js';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
token: CitationToken;
|
|
4
|
+
};
|
|
5
|
+
declare const Citation: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
+
type Citation = ReturnType<typeof Citation>;
|
|
7
|
+
export default Citation;
|