@urbicon-ui/blocks 6.35.0 → 6.36.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.
Files changed (99) hide show
  1. package/dist/components/Chat/Chat/Chat.svelte +53 -0
  2. package/dist/components/Chat/Chat/Chat.svelte.d.ts +4 -0
  3. package/dist/components/Chat/Chat/chat.variants.d.ts +20 -0
  4. package/dist/components/Chat/Chat/chat.variants.js +15 -0
  5. package/dist/components/Chat/Chat/index.d.ts +47 -0
  6. package/dist/components/Chat/Chat/index.js +2 -0
  7. package/dist/components/Chat/ChatMessage/ChatMessage.svelte +342 -0
  8. package/dist/components/Chat/ChatMessage/ChatMessage.svelte.d.ts +4 -0
  9. package/dist/components/Chat/ChatMessage/chat-message.variants.d.ts +138 -0
  10. package/dist/components/Chat/ChatMessage/chat-message.variants.js +118 -0
  11. package/dist/components/Chat/ChatMessage/index.d.ts +102 -0
  12. package/dist/components/Chat/ChatMessage/index.js +2 -0
  13. package/dist/components/Chat/ChatMessageList/ChatMessageList.svelte +301 -0
  14. package/dist/components/Chat/ChatMessageList/ChatMessageList.svelte.d.ts +6 -0
  15. package/dist/components/Chat/ChatMessageList/chat-message-list.variants.d.ts +23 -0
  16. package/dist/components/Chat/ChatMessageList/chat-message-list.variants.js +32 -0
  17. package/dist/components/Chat/ChatMessageList/chat-scroll.d.ts +45 -0
  18. package/dist/components/Chat/ChatMessageList/chat-scroll.js +52 -0
  19. package/dist/components/Chat/ChatMessageList/index.d.ts +93 -0
  20. package/dist/components/Chat/ChatMessageList/index.js +3 -0
  21. package/dist/components/Chat/CitationChip/CitationChip.svelte +107 -0
  22. package/dist/components/Chat/CitationChip/CitationChip.svelte.d.ts +4 -0
  23. package/dist/components/Chat/CitationChip/citation-chip.variants.d.ts +40 -0
  24. package/dist/components/Chat/CitationChip/citation-chip.variants.js +42 -0
  25. package/dist/components/Chat/CitationChip/index.d.ts +69 -0
  26. package/dist/components/Chat/CitationChip/index.js +2 -0
  27. package/dist/components/Chat/CodeBlock/CodeBlock.svelte +120 -0
  28. package/dist/components/Chat/CodeBlock/CodeBlock.svelte.d.ts +4 -0
  29. package/dist/components/Chat/CodeBlock/code-block.variants.d.ts +40 -0
  30. package/dist/components/Chat/CodeBlock/code-block.variants.js +51 -0
  31. package/dist/components/Chat/CodeBlock/index.d.ts +55 -0
  32. package/dist/components/Chat/CodeBlock/index.js +2 -0
  33. package/dist/components/Chat/PromptInput/PromptInput.svelte +432 -0
  34. package/dist/components/Chat/PromptInput/PromptInput.svelte.d.ts +4 -0
  35. package/dist/components/Chat/PromptInput/index.d.ts +165 -0
  36. package/dist/components/Chat/PromptInput/index.js +2 -0
  37. package/dist/components/Chat/PromptInput/prompt-input.variants.d.ts +90 -0
  38. package/dist/components/Chat/PromptInput/prompt-input.variants.js +102 -0
  39. package/dist/components/Chat/ReasoningDisclosure/ReasoningDisclosure.svelte +107 -0
  40. package/dist/components/Chat/ReasoningDisclosure/ReasoningDisclosure.svelte.d.ts +4 -0
  41. package/dist/components/Chat/ReasoningDisclosure/index.d.ts +85 -0
  42. package/dist/components/Chat/ReasoningDisclosure/index.js +2 -0
  43. package/dist/components/Chat/ReasoningDisclosure/reasoning-disclosure.variants.d.ts +20 -0
  44. package/dist/components/Chat/ReasoningDisclosure/reasoning-disclosure.variants.js +31 -0
  45. package/dist/components/Chat/StreamingMarkdown/MdBlock.svelte +99 -0
  46. package/dist/components/Chat/StreamingMarkdown/MdBlock.svelte.d.ts +9 -0
  47. package/dist/components/Chat/StreamingMarkdown/MdInline.svelte +82 -0
  48. package/dist/components/Chat/StreamingMarkdown/MdInline.svelte.d.ts +9 -0
  49. package/dist/components/Chat/StreamingMarkdown/StreamingMarkdown.svelte +118 -0
  50. package/dist/components/Chat/StreamingMarkdown/StreamingMarkdown.svelte.d.ts +4 -0
  51. package/dist/components/Chat/StreamingMarkdown/index.d.ts +86 -0
  52. package/dist/components/Chat/StreamingMarkdown/index.js +2 -0
  53. package/dist/components/Chat/StreamingMarkdown/md-context.d.ts +58 -0
  54. package/dist/components/Chat/StreamingMarkdown/md-context.js +1 -0
  55. package/dist/components/Chat/StreamingMarkdown/streaming-markdown.variants.d.ts +145 -0
  56. package/dist/components/Chat/StreamingMarkdown/streaming-markdown.variants.js +73 -0
  57. package/dist/components/Chat/ToolCallCard/ToolCallCard.svelte +174 -0
  58. package/dist/components/Chat/ToolCallCard/ToolCallCard.svelte.d.ts +4 -0
  59. package/dist/components/Chat/ToolCallCard/index.d.ts +84 -0
  60. package/dist/components/Chat/ToolCallCard/index.js +2 -0
  61. package/dist/components/Chat/ToolCallCard/tool-call-card.variants.d.ts +38 -0
  62. package/dist/components/Chat/ToolCallCard/tool-call-card.variants.js +38 -0
  63. package/dist/components/Chat/chat.types.d.ts +82 -0
  64. package/dist/components/Chat/chat.types.js +7 -0
  65. package/dist/components/Chat/index.d.ts +22 -0
  66. package/dist/components/Chat/index.js +14 -0
  67. package/dist/components/Chat/markdown/blocks.d.ts +54 -0
  68. package/dist/components/Chat/markdown/blocks.js +462 -0
  69. package/dist/components/Chat/markdown/inline.d.ts +31 -0
  70. package/dist/components/Chat/markdown/inline.js +446 -0
  71. package/dist/components/Chat/markdown/repair.d.ts +23 -0
  72. package/dist/components/Chat/markdown/repair.js +337 -0
  73. package/dist/components/Chat/markdown/streaming-harness.d.ts +23 -0
  74. package/dist/components/Chat/markdown/streaming-harness.js +62 -0
  75. package/dist/components/Chat/markdown/types.d.ts +139 -0
  76. package/dist/components/Chat/markdown/types.js +13 -0
  77. package/dist/components/Chat/markdown/url-policy.d.ts +33 -0
  78. package/dist/components/Chat/markdown/url-policy.js +109 -0
  79. package/dist/components/FileUpload/FileUpload.svelte +35 -123
  80. package/dist/components/FileUpload/FileUpload.svelte.d.ts +1 -1
  81. package/dist/components/FileUpload/index.d.ts +2 -28
  82. package/dist/components/index.d.ts +1 -0
  83. package/dist/components/index.js +1 -0
  84. package/dist/primitives/Collapsible/Collapsible.svelte +5 -0
  85. package/dist/primitives/SplitPane/SplitPane.svelte +293 -0
  86. package/dist/primitives/SplitPane/SplitPane.svelte.d.ts +4 -0
  87. package/dist/primitives/SplitPane/index.d.ts +88 -0
  88. package/dist/primitives/SplitPane/index.js +2 -0
  89. package/dist/primitives/SplitPane/split-pane.utils.d.ts +73 -0
  90. package/dist/primitives/SplitPane/split-pane.utils.js +94 -0
  91. package/dist/primitives/SplitPane/split-pane.variants.d.ts +40 -0
  92. package/dist/primitives/SplitPane/split-pane.variants.js +56 -0
  93. package/dist/primitives/index.d.ts +2 -0
  94. package/dist/primitives/index.js +1 -0
  95. package/dist/utils/file-intake.d.ts +78 -0
  96. package/dist/utils/file-intake.js +144 -0
  97. package/dist/utils/index.d.ts +1 -0
  98. package/dist/utils/index.js +1 -0
  99. package/package.json +3 -3
@@ -0,0 +1,90 @@
1
+ import { type SlotNames, type VariantProps } from '../../../utils/variants.js';
2
+ export declare const promptInputVariants: ((props?: {
3
+ size?: "sm" | "md" | undefined;
4
+ } | undefined) => {
5
+ root: (props?: ({
6
+ size?: "sm" | "md" | undefined;
7
+ } & {
8
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
9
+ }) | undefined) => string;
10
+ attachmentsStrip: (props?: ({
11
+ size?: "sm" | "md" | undefined;
12
+ } & {
13
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
14
+ }) | undefined) => string;
15
+ attachmentChip: (props?: ({
16
+ size?: "sm" | "md" | undefined;
17
+ } & {
18
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
19
+ }) | undefined) => string;
20
+ attachmentThumb: (props?: ({
21
+ size?: "sm" | "md" | undefined;
22
+ } & {
23
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
24
+ }) | undefined) => string;
25
+ attachmentName: (props?: ({
26
+ size?: "sm" | "md" | undefined;
27
+ } & {
28
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
29
+ }) | undefined) => string;
30
+ attachmentSize: (props?: ({
31
+ size?: "sm" | "md" | undefined;
32
+ } & {
33
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
34
+ }) | undefined) => string;
35
+ attachmentRemove: (props?: ({
36
+ size?: "sm" | "md" | undefined;
37
+ } & {
38
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
39
+ }) | undefined) => string;
40
+ textarea: (props?: ({
41
+ size?: "sm" | "md" | undefined;
42
+ } & {
43
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
44
+ }) | undefined) => string;
45
+ actions: (props?: ({
46
+ size?: "sm" | "md" | undefined;
47
+ } & {
48
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
49
+ }) | undefined) => string;
50
+ leading: (props?: ({
51
+ size?: "sm" | "md" | undefined;
52
+ } & {
53
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
54
+ }) | undefined) => string;
55
+ trailing: (props?: ({
56
+ size?: "sm" | "md" | undefined;
57
+ } & {
58
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
59
+ }) | undefined) => string;
60
+ attachButton: (props?: ({
61
+ size?: "sm" | "md" | undefined;
62
+ } & {
63
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
64
+ }) | undefined) => string;
65
+ sendButton: (props?: ({
66
+ size?: "sm" | "md" | undefined;
67
+ } & {
68
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
69
+ }) | undefined) => string;
70
+ stopButton: (props?: ({
71
+ size?: "sm" | "md" | undefined;
72
+ } & {
73
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
74
+ }) | undefined) => string;
75
+ error: (props?: ({
76
+ size?: "sm" | "md" | undefined;
77
+ } & {
78
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
79
+ }) | undefined) => string;
80
+ hint: (props?: ({
81
+ size?: "sm" | "md" | undefined;
82
+ } & {
83
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
84
+ }) | undefined) => string;
85
+ }) & {
86
+ readonly config: import("../../../utils/variants.js").TVConfig;
87
+ };
88
+ export type PromptInputVariants = VariantProps<typeof promptInputVariants>;
89
+ /** Slot names derived from the tv() config — single source of truth for slotClasses. */
90
+ export type PromptInputSlots = SlotNames<typeof promptInputVariants>;
@@ -0,0 +1,102 @@
1
+ import { tv } from '../../../utils/variants.js';
2
+ export const promptInputVariants = tv({
3
+ slots: {
4
+ // Single bordered composer surface. The focus ring lives on the container
5
+ // (focus-within) so the whole composer reads as one field even though the
6
+ // textarea inside is chromeless — the family's "one input" look.
7
+ root: [
8
+ 'relative flex flex-col w-full box-border',
9
+ 'bg-surface-base border border-border-default rounded-contain',
10
+ 'transition-[border-color,box-shadow] duration-[var(--blocks-duration-fast)] ease-out',
11
+ 'focus-within:border-primary focus-within:ring-2 focus-within:ring-primary focus-within:ring-offset-0',
12
+ // A file is being dragged over the composer.
13
+ 'data-[dragging=true]:border-primary data-[dragging=true]:ring-2 data-[dragging=true]:ring-primary'
14
+ ],
15
+ // Chip strip above the textarea. Wraps; scrolls vertically if it grows past
16
+ // a couple of rows so the composer never explodes in height.
17
+ attachmentsStrip: ['flex flex-wrap gap-1.5', 'px-2.5 pt-2.5', 'max-h-32 overflow-y-auto'],
18
+ attachmentChip: [
19
+ 'inline-flex items-center gap-1.5 max-w-full min-w-0',
20
+ 'py-1 pl-1 pr-1.5',
21
+ 'bg-surface-elevated border border-border-subtle rounded-modify'
22
+ ],
23
+ // Fixed box that holds either the image preview or the file icon.
24
+ attachmentThumb: [
25
+ 'inline-flex items-center justify-center shrink-0',
26
+ 'size-7 rounded-modify overflow-hidden',
27
+ 'bg-surface-interactive text-text-tertiary',
28
+ '[&>img]:size-full [&>img]:object-cover'
29
+ ],
30
+ attachmentName: ['truncate text-xs text-text-primary min-w-0'],
31
+ attachmentSize: ['shrink-0 text-2xs text-text-tertiary tabular-nums'],
32
+ attachmentRemove: [
33
+ 'inline-flex items-center justify-center shrink-0',
34
+ 'size-5 rounded-modify',
35
+ 'text-text-tertiary cursor-pointer',
36
+ 'transition-[color,background-color] duration-[var(--blocks-duration-fast)] ease-out',
37
+ 'hover:bg-surface-hover hover:text-text-primary',
38
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary'
39
+ ],
40
+ // Chromeless auto-growing textarea — the composer surface owns the border.
41
+ textarea: [
42
+ 'w-full resize-none bg-transparent',
43
+ 'text-text-primary placeholder:text-text-tertiary',
44
+ 'border-0 outline-none focus:outline-none focus-visible:outline-none',
45
+ 'disabled:cursor-not-allowed disabled:opacity-60'
46
+ ],
47
+ // Bottom bar: leading zone (attach) | spacer | trailing zone (send/stop).
48
+ actions: ['flex items-center justify-between gap-2 px-2 pb-2'],
49
+ leading: ['flex items-center gap-1 min-w-0'],
50
+ trailing: ['flex items-center gap-1 shrink-0'],
51
+ // Icon-only affordance buttons.
52
+ attachButton: [
53
+ 'inline-flex items-center justify-center shrink-0',
54
+ 'rounded-modify text-text-secondary cursor-pointer',
55
+ 'transition-[color,background-color] duration-[var(--blocks-duration-fast)] ease-out',
56
+ 'hover:bg-surface-hover hover:text-text-primary',
57
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary',
58
+ 'disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent'
59
+ ],
60
+ sendButton: [
61
+ 'inline-flex items-center justify-center shrink-0',
62
+ 'rounded-modify cursor-pointer',
63
+ 'bg-primary text-text-on-primary',
64
+ 'transition-[color,background-color,opacity] duration-[var(--blocks-duration-fast)] ease-out',
65
+ 'hover:bg-primary-hover active:bg-primary-active',
66
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2',
67
+ 'disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-primary'
68
+ ],
69
+ stopButton: [
70
+ 'inline-flex items-center justify-center shrink-0',
71
+ 'rounded-modify cursor-pointer',
72
+ 'bg-neutral text-text-on-primary',
73
+ 'transition-[color,background-color] duration-[var(--blocks-duration-fast)] ease-out',
74
+ 'hover:bg-neutral-hover active:bg-neutral-active',
75
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2'
76
+ ],
77
+ // Compact inline validation line (first rejection). role=status is set in
78
+ // the component; the empty state renders no box.
79
+ error: ['px-3 pb-2 text-xs text-danger'],
80
+ // Helper line under the composer (e.g. "Enter to send").
81
+ hint: ['px-3 pb-2 text-xs text-text-tertiary']
82
+ },
83
+ variants: {
84
+ size: {
85
+ sm: {
86
+ textarea: 'px-2.5 pt-2.5 text-sm leading-5',
87
+ attachButton: 'size-7',
88
+ sendButton: 'size-7',
89
+ stopButton: 'size-7'
90
+ },
91
+ md: {
92
+ textarea: 'px-3 pt-3 text-sm leading-6',
93
+ attachButton: 'size-8',
94
+ sendButton: 'size-8',
95
+ stopButton: 'size-8'
96
+ }
97
+ }
98
+ },
99
+ defaultVariants: {
100
+ size: 'md'
101
+ }
102
+ });
@@ -0,0 +1,107 @@
1
+ <script lang="ts">
2
+ import { Collapsible } from '../../../primitives';
3
+ import { getBlocksConfig, resolveSlotClasses } from '../../../provider';
4
+ import { resolveIcon } from '../../../icons';
5
+ import ChevronDownIconDefault from '../../../icons/ChevronDownIcon.svelte';
6
+ import StreamingMarkdown from '../StreamingMarkdown/StreamingMarkdown.svelte';
7
+ import { reasoningDisclosureVariants } from './reasoning-disclosure.variants';
8
+ import type { ReasoningDisclosureProps } from './index';
9
+
10
+ const ChevronDownIcon = resolveIcon('chevronDown', ChevronDownIconDefault);
11
+
12
+ let {
13
+ reasoning,
14
+ streaming = false,
15
+ open = $bindable(),
16
+ defaultOpen = false,
17
+ onOpenChange,
18
+ urlPolicy,
19
+ thinkingLabel = 'Thinking',
20
+ reasoningLabel = 'Reasoning',
21
+ formatDuration = (s: number) => `Thought for ${s}s`,
22
+ class: className,
23
+ unstyled: unstyledProp = false,
24
+ slotClasses: slotClassesProp = {},
25
+ preset,
26
+ ...restProps
27
+ }: ReasoningDisclosureProps = $props();
28
+
29
+ const blocksConfig = getBlocksConfig();
30
+ const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
31
+
32
+ // Forward arbitrary root attributes onto the underlying Collapsible without
33
+ // re-deriving its (very wide) props union: spreading the typed rest makes
34
+ // svelte-check reconcile HTMLAttributes' nullable `title` against
35
+ // Collapsible's narrowed one and blows the union-complexity budget (same
36
+ // workaround as ToolCallCard).
37
+ const rootProps = $derived(restProps as Record<string, unknown>);
38
+
39
+ const styles = $derived(reasoningDisclosureVariants());
40
+ const slotClasses = $derived(
41
+ resolveSlotClasses(blocksConfig, 'ReasoningDisclosure', preset, {}, slotClassesProp)
42
+ );
43
+
44
+ // Header label: streaming → thinking; settled with a duration → "Thought for
45
+ // Xs" (whole seconds); settled without one → the neutral reasoning label.
46
+ const stateLabel = $derived.by(() => {
47
+ if (streaming) return thinkingLabel;
48
+ if (reasoning.durationMs != null) {
49
+ return formatDuration(Math.round(reasoning.durationMs / 1000));
50
+ }
51
+ return reasoningLabel;
52
+ });
53
+
54
+ // The pulse lives here (not in the tv() config) so the dead-token guard never
55
+ // flags it; `motion-reduce:animate-none` respects prefers-reduced-motion.
56
+ const pulse = $derived(streaming ? 'animate-pulse motion-reduce:animate-none' : '');
57
+ </script>
58
+
59
+ <Collapsible
60
+ variant="default"
61
+ size="sm"
62
+ bind:open
63
+ {defaultOpen}
64
+ {onOpenChange}
65
+ class={className}
66
+ {...rootProps}
67
+ >
68
+ {#snippet trigger({ open: isOpen, toggle, disabled, triggerId, contentId })}
69
+ <button
70
+ id={triggerId}
71
+ type="button"
72
+ class={unstyled
73
+ ? (slotClasses?.trigger ?? '')
74
+ : styles.trigger({ class: slotClasses?.trigger })}
75
+ aria-expanded={isOpen}
76
+ aria-controls={contentId}
77
+ {disabled}
78
+ onclick={toggle}
79
+ >
80
+ <span
81
+ class={unstyled
82
+ ? [slotClasses?.label, pulse].filter(Boolean).join(' ')
83
+ : styles.label({ class: [slotClasses?.label, pulse] })}
84
+ >
85
+ {stateLabel}
86
+ </span>
87
+ <ChevronDownIcon
88
+ class={unstyled
89
+ ? [slotClasses?.chevron, isOpen ? 'rotate-180' : ''].filter(Boolean).join(' ')
90
+ : styles.chevron({ class: [slotClasses?.chevron, isOpen ? 'rotate-180' : ''] })}
91
+ />
92
+ </button>
93
+ {/snippet}
94
+ <div
95
+ class={unstyled
96
+ ? (slotClasses?.content ?? '')
97
+ : styles.content({ class: slotClasses?.content })}
98
+ >
99
+ <StreamingMarkdown
100
+ content={reasoning.text}
101
+ {streaming}
102
+ {urlPolicy}
103
+ size="sm"
104
+ slotClasses={{ base: 'text-inherit' }}
105
+ />
106
+ </div>
107
+ </Collapsible>
@@ -0,0 +1,4 @@
1
+ import type { ReasoningDisclosureProps } from './index.js';
2
+ declare const ReasoningDisclosure: import("svelte").Component<ReasoningDisclosureProps, {}, "open">;
3
+ type ReasoningDisclosure = ReturnType<typeof ReasoningDisclosure>;
4
+ export default ReasoningDisclosure;
@@ -0,0 +1,85 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import type { ChatReasoningPart } from '../chat.types.js';
3
+ import type { MarkdownUrlPolicy } from '../markdown/types.js';
4
+ import type { ReasoningDisclosureSlots } from './reasoning-disclosure.variants.js';
5
+ /**
6
+ * @description Default renderer for `reasoning` parts in ChatMessage. Wraps a
7
+ * model's thinking trace in a collapsed, muted disclosure: the header shows a
8
+ * state label ("Thinking" while streaming, "Thought for Xs" once settled with a
9
+ * duration, otherwise "Reasoning"), the body renders the reasoning text through
10
+ * StreamingMarkdown in a damped tertiary tone. Stays collapsed by default —
11
+ * including while streaming — so a growing reasoning trace never steals the
12
+ * answer's space; the caller drives the `streaming` flag (the part carries no
13
+ * status).
14
+ * @tag ai
15
+ * @related ChatMessage
16
+ * @related ToolCallCard
17
+ * @related StreamingMarkdown
18
+ * @stability experimental
19
+ *
20
+ * @example
21
+ * ```svelte
22
+ * <ReasoningDisclosure
23
+ * reasoning={{ type: 'reasoning', text: model.reasoning, durationMs: 2400 }}
24
+ * streaming={message.status === 'streaming'}
25
+ * />
26
+ * ```
27
+ */
28
+ export interface ReasoningDisclosureProps extends Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'children'> {
29
+ /** The reasoning part to render (`{ type: 'reasoning'; text; durationMs? }`). Required. */
30
+ reasoning: ChatReasoningPart;
31
+ /**
32
+ * The reasoning trace is currently growing. Drives the "Thinking" label and
33
+ * its pulse; supplied by the caller (the part itself carries no status).
34
+ * @default false
35
+ */
36
+ streaming?: boolean;
37
+ /**
38
+ * Whether the disclosure is expanded. Supports `bind:open`. Passing `open`
39
+ * without `bind:` requires mirroring every `onOpenChange` back into your state.
40
+ */
41
+ open?: boolean;
42
+ /**
43
+ * Initial expanded state for uncontrolled usage. Reasoning stays collapsed by
44
+ * default, even while streaming.
45
+ * @default false
46
+ */
47
+ defaultOpen?: boolean;
48
+ /** Fires once per trigger-driven open transition, after the state is applied. */
49
+ onOpenChange?: (open: boolean) => void;
50
+ /**
51
+ * URL policy passed through to the inner StreamingMarkdown for any links in
52
+ * the reasoning text (same strict default — untrusted model output).
53
+ */
54
+ urlPolicy?: MarkdownUrlPolicy;
55
+ /**
56
+ * Header label while `streaming`.
57
+ * @default 'Thinking'
58
+ */
59
+ thinkingLabel?: string;
60
+ /**
61
+ * Header label once settled without a `durationMs`.
62
+ * @default 'Reasoning'
63
+ */
64
+ reasoningLabel?: string;
65
+ /**
66
+ * Header label once settled with a `durationMs`, receiving whole seconds
67
+ * (`Math.round(durationMs / 1000)`).
68
+ * @default (s) => `Thought for ${s}s`
69
+ */
70
+ formatDuration?: (seconds: number) => string;
71
+ /** Extra classes merged onto the root (the underlying Collapsible base). */
72
+ class?: string;
73
+ /** Strip ReasoningDisclosure's own tv() classes (trigger/label/chevron/content); the collapse mechanics stay. */
74
+ unstyled?: boolean;
75
+ /** Per-slot class overrides. Slots: `trigger` (header button), `label` (state label), `chevron`, `content` (markdown wrapper). */
76
+ slotClasses?: Partial<Record<ReasoningDisclosureSlots, string>>;
77
+ /**
78
+ * Apply a named preset registered via `<BlocksProvider presets={{ ReasoningDisclosure: {...} }}>`.
79
+ * Prefer this over `class` overrides when the requested look falls outside the
80
+ * semantic intent palette.
81
+ */
82
+ preset?: string;
83
+ }
84
+ export { default as ReasoningDisclosure } from './ReasoningDisclosure.svelte';
85
+ export { type ReasoningDisclosureSlots, type ReasoningDisclosureVariants, reasoningDisclosureVariants } from './reasoning-disclosure.variants.js';
@@ -0,0 +1,2 @@
1
+ export { default as ReasoningDisclosure } from './ReasoningDisclosure.svelte';
2
+ export { reasoningDisclosureVariants } from './reasoning-disclosure.variants.js';
@@ -0,0 +1,20 @@
1
+ import { type SlotNames, type VariantProps } from '../../../utils/variants.js';
2
+ export declare const reasoningDisclosureVariants: ((props?: {} | undefined) => {
3
+ trigger: (props?: ({} & {
4
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
5
+ }) | undefined) => string;
6
+ label: (props?: ({} & {
7
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
8
+ }) | undefined) => string;
9
+ chevron: (props?: ({} & {
10
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
11
+ }) | undefined) => string;
12
+ content: (props?: ({} & {
13
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
14
+ }) | undefined) => string;
15
+ }) & {
16
+ readonly config: import("../../../utils/variants.js").TVConfig;
17
+ };
18
+ export type ReasoningDisclosureVariants = VariantProps<typeof reasoningDisclosureVariants>;
19
+ /** Slot names derived from the tv() config — single source of truth for slotClasses. */
20
+ export type ReasoningDisclosureSlots = SlotNames<typeof reasoningDisclosureVariants>;
@@ -0,0 +1,31 @@
1
+ import { tv } from '../../../utils/variants.js';
2
+ export const reasoningDisclosureVariants = tv({
3
+ slots: {
4
+ // The whole header row is the toggle. Muted (secondary) tone — reasoning is
5
+ // meta-content, subordinate to the answer. `size="sm"` rhythm, matching the
6
+ // Collapsible small size the disclosure sits on.
7
+ trigger: [
8
+ 'flex w-full items-center justify-between gap-2 text-left',
9
+ 'cursor-pointer py-2 text-sm font-medium text-text-secondary',
10
+ 'transition-[color] duration-[var(--blocks-duration-fast)]',
11
+ 'hover:text-primary',
12
+ 'focus-visible:rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50',
13
+ 'disabled:cursor-not-allowed disabled:opacity-50'
14
+ ],
15
+ // State label ("Thinking" / "Reasoning" / "Thought for Xs"). The streaming
16
+ // pulse is toggled in the component (animate-pulse motion-reduce:animate-none)
17
+ // so it stays off the dead-token guard.
18
+ label: 'min-w-0 truncate',
19
+ // Chevron shares the collapse motion tokens so the spin stays in sync with
20
+ // the panel; rotate-180 is applied in the component when open.
21
+ chevron: [
22
+ 'h-4 w-4 shrink-0 text-text-tertiary',
23
+ 'transition-transform duration-[var(--blocks-collapse-duration)] ease-[var(--blocks-collapse-easing)]',
24
+ 'motion-reduce:duration-[1ms]'
25
+ ],
26
+ // Wrapper around StreamingMarkdown. `text-text-tertiary` is the damped
27
+ // reasoning tone; the markdown body inherits it (its base color override is
28
+ // `text-inherit`), while link/blockquote slots keep their own intents.
29
+ content: 'text-text-tertiary'
30
+ }
31
+ });
@@ -0,0 +1,99 @@
1
+ <!-- Block-node dispatcher for StreamingMarkdown. Internal — not exported. -->
2
+ <script lang="ts">
3
+ import CodeBlock from '../CodeBlock/CodeBlock.svelte';
4
+ import type { BlockNode } from '../markdown/types';
5
+ import type { MdRenderContext } from './md-context';
6
+ import MdBlockSelf from './MdBlock.svelte';
7
+ import MdInline from './MdInline.svelte';
8
+
9
+ let { block, ctx }: { block: BlockNode; ctx: MdRenderContext } = $props();
10
+
11
+ const headingTag = $derived(
12
+ block.kind === 'heading' ? `h${Math.min(6, block.level - 1 + ctx.headingLevelStart)}` : 'h2'
13
+ );
14
+
15
+ function alignClass(align: 'left' | 'center' | 'right' | null): string {
16
+ if (align === 'center') return 'text-center';
17
+ if (align === 'right') return 'text-end';
18
+ return 'text-start';
19
+ }
20
+ </script>
21
+
22
+ {#if block.kind === 'paragraph'}
23
+ <p class={ctx.classes.paragraph}><MdInline nodes={block.children} {ctx} /></p>
24
+ {:else if block.kind === 'heading'}
25
+ <svelte:element this={headingTag} class={ctx.classes[`heading${block.level}`]}
26
+ ><MdInline nodes={block.children} {ctx} /></svelte:element
27
+ >
28
+ {:else if block.kind === 'code-block'}
29
+ {#if ctx.renderers?.codeBlock}
30
+ {@render ctx.renderers.codeBlock({ code: block.code, lang: block.lang, open: block.open })}
31
+ {:else}
32
+ <CodeBlock class={ctx.classes.codeBlock} code={block.code} lang={block.lang} />
33
+ {/if}
34
+ {:else if block.kind === 'list'}
35
+ <svelte:element
36
+ this={block.ordered ? 'ol' : 'ul'}
37
+ start={block.ordered ? block.start : undefined}
38
+ class={block.ordered ? ctx.classes.listOrdered : ctx.classes.listUnordered}
39
+ >
40
+ {#each block.items as item, i (i)}
41
+ <li class={item.checked === undefined ? ctx.classes.listItem : ctx.classes.taskItem}>
42
+ {#if item.checked !== undefined}
43
+ <input type="checkbox" checked={item.checked} disabled class={ctx.classes.taskCheckbox} />
44
+ <div class="min-w-0 flex-1">
45
+ {#each item.children as child, c (c)}
46
+ <MdBlockSelf block={child} {ctx} />
47
+ {/each}
48
+ </div>
49
+ {:else}
50
+ {#each item.children as child, c (c)}
51
+ <MdBlockSelf block={child} {ctx} />
52
+ {/each}
53
+ {/if}
54
+ </li>
55
+ {/each}
56
+ </svelte:element>
57
+ {:else if block.kind === 'blockquote'}
58
+ <blockquote class={ctx.classes.blockquote}>
59
+ {#each block.children as child, c (c)}
60
+ <MdBlockSelf block={child} {ctx} />
61
+ {/each}
62
+ </blockquote>
63
+ {:else if block.kind === 'table'}
64
+ <!-- Focusable scroll container (axe: scrollable-region-focusable) -->
65
+ <!-- svelte-ignore a11y_no_noninteractive_tabindex -->
66
+ <div
67
+ class={ctx.classes.tableWrapper}
68
+ role="region"
69
+ aria-label={ctx.tableRegionLabel}
70
+ tabindex="0"
71
+ >
72
+ <table class={ctx.classes.table}>
73
+ <thead>
74
+ <tr class={ctx.classes.tableRow}>
75
+ {#each block.header as cell, col (col)}
76
+ <th
77
+ scope="col"
78
+ class={[ctx.classes.tableHeadCell, alignClass(block.align[col] ?? null)]}
79
+ ><MdInline nodes={cell} {ctx} /></th
80
+ >
81
+ {/each}
82
+ </tr>
83
+ </thead>
84
+ <tbody>
85
+ {#each block.rows as row, r (r)}
86
+ <tr class={ctx.classes.tableRow}>
87
+ {#each row as cell, col (col)}
88
+ <td class={[ctx.classes.tableCell, alignClass(block.align[col] ?? null)]}
89
+ ><MdInline nodes={cell} {ctx} /></td
90
+ >
91
+ {/each}
92
+ </tr>
93
+ {/each}
94
+ </tbody>
95
+ </table>
96
+ </div>
97
+ {:else if block.kind === 'hr'}
98
+ <hr class={ctx.classes.hr} />
99
+ {/if}
@@ -0,0 +1,9 @@
1
+ import type { BlockNode } from '../markdown/types.js';
2
+ import type { MdRenderContext } from './md-context.js';
3
+ type $$ComponentProps = {
4
+ block: BlockNode;
5
+ ctx: MdRenderContext;
6
+ };
7
+ declare const MdBlock: import("svelte").Component<$$ComponentProps, {}, "">;
8
+ type MdBlock = ReturnType<typeof MdBlock>;
9
+ export default MdBlock;