@adminforth/agent 3.1.8 → 3.1.10

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.
@@ -2,7 +2,7 @@
2
2
  <!-- in full screen the controls line up with the centered column of the conversation -->
3
3
  <div
4
4
  ref="headerRef"
5
- class="af-agent-header flex items-center gap-0.5 h-12 px-2 border-b border-lightNavbarBorder dark:border-darkNavbarBorder"
5
+ class="af-agent-header flex items-center gap-0.5 h-14 px-2 border-b border-lightNavbarBorder dark:border-darkNavbarBorder"
6
6
  :style="agentStore.isFullScreen ? { paddingInline: `max(0.5rem, calc((100% - ${agentStore.MAX_WIDTH}rem) / 2 + 0.5rem))` } : undefined"
7
7
  >
8
8
  <Button
@@ -181,7 +181,6 @@ onMounted(async () => {
181
181
  scheduleSpacerHeightUpdate();
182
182
  });
183
183
 
184
- await import('@incremark/theme/styles.css')
185
184
  await agentStore.fetchPlaceholderMessages()
186
185
  await refreshSpacerTracking();
187
186
  });
@@ -0,0 +1,29 @@
1
+ <template>
2
+ <div ref="el" class="af-md" />
3
+ </template>
4
+
5
+ <script setup lang="ts">
6
+ // the Vue binding of the framework-free markdown view
7
+ import { onBeforeUnmount, onMounted, ref, watch } from 'vue';
8
+ import { useI18n } from 'vue-i18n';
9
+ import { createMarkdownView, type MarkdownView } from '../markdown/renderMarkdown';
10
+
11
+ const props = defineProps<{
12
+ content: string;
13
+ // false while the message streams: the syntax it left open is closed for display
14
+ final: boolean;
15
+ }>();
16
+
17
+ const { t } = useI18n();
18
+ const el = ref<HTMLElement>();
19
+ let view: MarkdownView;
20
+
21
+ onMounted(() => {
22
+ view = createMarkdownView(el.value!, { copy: t('Copy'), copied: t('Copied') });
23
+ view.update(props.content, props.final);
24
+ });
25
+
26
+ watch(() => [props.content, props.final] as const, ([content, final]) => view.update(content, final));
27
+
28
+ onBeforeUnmount(() => view.destroy());
29
+ </script>
@@ -14,11 +14,12 @@
14
14
  />
15
15
  </button>
16
16
  <transition name="expand">
17
- <IncremarkContent
17
+ <MarkdownContent
18
18
  v-if="isExpanded"
19
19
  v-show="isExpanded"
20
20
  class="ml-6 mb-1 text-sm text-lightInputIconColor dark:text-darkInputIconColor"
21
21
  :content="reasoningText"
22
+ :final="!isStreaming"
22
23
  />
23
24
  </transition>
24
25
  </li>
@@ -38,7 +39,7 @@ const props = defineProps<{
38
39
  text?: string
39
40
  }>();
40
41
 
41
- const IncremarkContent = defineAsyncComponent(() => import('@incremark/vue').then(module => module.IncremarkContent))
42
+ const MarkdownContent = defineAsyncComponent(() => import('./MarkdownContent.vue'))
42
43
 
43
44
  const isExpanded = ref(true);
44
45
  const isStreaming = computed(() => props.state === 'streaming');
@@ -5,20 +5,17 @@
5
5
  :class="[
6
6
  hasVegaLite && 'w-full',
7
7
  props.role === 'user'
8
- ? 'self-end max-w-[82%] mr-4 px-3 py-2 rounded-xl rounded-br [&_.incremark-paragraph]:leading-5 bg-lightSecondaryDarken dark:bg-darkSecondaryLighten'
8
+ ? 'self-end max-w-[82%] mr-4 px-3 py-2 rounded-xl rounded-br [&_p]:leading-5 bg-lightSecondaryDarken dark:bg-darkSecondaryLighten'
9
9
  : 'self-start max-w-full px-4',
10
10
  props.editMode ? `w-full max-w-[calc(100%-2rem)] flex-col items-stretch py-3 border bg-lightInputBackground border-lightInputFocusBorder ring-[3px] ring-lightInputFocusRing
11
11
  dark:bg-darkInputBackground dark:border-darkInputFocusBorder dark:ring-darkInputFocusRing` : ''
12
12
  ]"
13
13
  >
14
- <IncremarkContent
15
- class="text-wrap break-words w-full max-w-full"
14
+ <MarkdownContent
15
+ class="w-full max-w-full text-lightListTableText dark:text-darkListTableText"
16
16
  v-if="content && !props.editMode"
17
- :key="renderNonce"
18
17
  :content="content"
19
- :is-finished="isFinished"
20
- :components="incremarkComponents"
21
- :incremark-options="incremarkOptions"
18
+ :final="isFinished"
22
19
  />
23
20
  <template v-if="props.editMode">
24
21
  <textarea
@@ -38,7 +35,7 @@
38
35
 
39
36
  <script setup lang="ts">
40
37
 
41
- import { computed, defineAsyncComponent, onMounted, ref, watch } from 'vue';
38
+ import { computed, defineAsyncComponent, ref, watch } from 'vue';
42
39
  import { useRouter } from 'vue-router';
43
40
  import { useAgentStore } from '../composables/useAgentStore';
44
41
  import { useCoreStore } from '@/stores/core';
@@ -54,8 +51,7 @@
54
51
 
55
52
  const emit = defineEmits(['toggle-thoughts']);
56
53
 
57
- const IncremarkContent = defineAsyncComponent(() => import('@incremark/vue').then(module => module.IncremarkContent))
58
- const ShikiCodeBlock = defineAsyncComponent(() => import('../incremark_code_renderers/IncremarkShikiCodeBlock.vue'))
54
+ const MarkdownContent = defineAsyncComponent(() => import('./MarkdownContent.vue'))
59
55
 
60
56
  const agentStore = useAgentStore();
61
57
  const coreStore = useCoreStore();
@@ -66,29 +62,9 @@
66
62
  const content = computed(() => props.message)
67
63
  const isFinished = computed(() => props.state === 'done')
68
64
 
69
- const renderNonce = ref(0);
70
- watch(content, (newContent, oldContent) => {
71
- if (isFinished.value && newContent !== oldContent) {
72
- renderNonce.value++;
73
- }
74
- });
75
65
  const hasVegaLite = computed(() => props.message?.includes('```vega-lite'))
76
66
  const isStateStreaming = computed(() => props.state === 'streaming')
77
67
 
78
- const incremarkComponents = {
79
- code: ShikiCodeBlock,
80
- };
81
- const incremarkOptions = {
82
- gfm: true,
83
- math: { tex: true },
84
- containers: true,
85
- htmlTree: true,
86
- };
87
-
88
- onMounted(async () => {
89
- void import('katex/dist/katex.min.css')
90
- })
91
-
92
68
  watch(isStateStreaming, (newValue: boolean) => {
93
69
  if (!newValue) {
94
70
  isThoughtsExpanded.value = false;
@@ -151,96 +127,3 @@
151
127
  }
152
128
 
153
129
  </script>
154
-
155
- <style lang="scss">
156
- // the incremark theme ships its own fonts and palette, point them to the design tokens
157
- .incremark {
158
- --incremark-typography-font-family-base: theme('fontFamily.sans');
159
- --incremark-typography-font-family-mono: theme('fontFamily.mono');
160
- --incremark-color-text-primary: theme('colors.lightListTableText');
161
- --incremark-color-text-secondary: theme('colors.lightInputIconColor');
162
- --incremark-color-text-tertiary: theme('colors.lightInputPlaceholderText');
163
- --incremark-color-border-default: theme('colors.lightCardBorder');
164
- --incremark-color-border-strong: theme('colors.lightCardBorder');
165
- --incremark-color-border-subtle: theme('colors.lightCardBorder');
166
- --incremark-color-background-base: theme('colors.lightCardBackground');
167
- --incremark-color-background-elevated: theme('colors.lightCardBackgroundHover');
168
- --incremark-color-code-inline-background: theme('colors.lightSecondaryDarken');
169
- --incremark-color-code-inline-text: theme('colors.lightInputText');
170
- --incremark-color-brand-primary: theme('colors.lightPrimary');
171
- --incremark-color-interactive-link: theme('colors.lightPrimary');
172
- --incremark-color-interactive-link-hover: theme('colors.lightPrimary');
173
- --incremark-color-interactive-link-visited: theme('colors.lightPrimary');
174
- }
175
-
176
- .dark .incremark {
177
- --incremark-color-text-primary: theme('colors.darkListTableText');
178
- --incremark-color-text-secondary: theme('colors.darkInputIconColor');
179
- --incremark-color-text-tertiary: theme('colors.darkInputPlaceholderText');
180
- --incremark-color-border-default: theme('colors.darkCardBorder');
181
- --incremark-color-border-strong: theme('colors.darkCardBorder');
182
- --incremark-color-border-subtle: theme('colors.darkCardBorder');
183
- --incremark-color-background-base: theme('colors.darkCardBackground');
184
- --incremark-color-background-elevated: theme('colors.darkCardBackgroundHover');
185
- --incremark-color-code-inline-background: theme('colors.darkSecondaryLighten');
186
- --incremark-color-code-inline-text: theme('colors.darkInputText');
187
- --incremark-color-brand-primary: theme('colors.darkPrimary');
188
- --incremark-color-interactive-link: theme('colors.darkPrimary');
189
- --incremark-color-interactive-link-hover: theme('colors.darkPrimary');
190
- --incremark-color-interactive-link-visited: theme('colors.darkPrimary');
191
- }
192
-
193
- .incremark a.incremark-link,
194
- .incremark a.incremark-link:visited {
195
- @apply text-lightPrimary dark:text-darkPrimary;
196
- display: inline-block;
197
- text-decoration: underline;
198
- text-underline-offset: 4px;
199
- text-decoration-style: dotted;
200
- word-break: break-all;
201
- }
202
-
203
- .incremark a.incremark-link:hover {
204
- text-decoration-style: solid;
205
- }
206
-
207
- a.incremark-link::after {
208
- content: "";
209
- display: inline-block;
210
- width: 16px;
211
- height: 16px;
212
- vertical-align: middle;
213
- rotate: -45deg;
214
- background-color: currentColor;
215
- mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M13 12H2m12 0l-4 4m4-4l-4-4'/%3E%3C/svg%3E") no-repeat center;
216
- mask-size: contain;
217
- }
218
-
219
- .incremark-table a.incremark-link {
220
- word-break: break-word;
221
- }
222
-
223
- // scoped under .incremark: the incremark theme is imported lazily and would win an equal selector
224
- .incremark .incremark-list {
225
- list-style: disc;
226
- margin: 0 0 8px;
227
- padding-left: 18px;
228
- }
229
-
230
- .incremark .incremark-list-item {
231
- margin: 2px 0;
232
- }
233
-
234
- .incremark .incremark-paragraph {
235
- margin: 0 0 8px;
236
- }
237
-
238
- .incremark .incremark-list-item > .incremark-paragraph {
239
- margin: 0;
240
- }
241
-
242
- // the gap between messages comes from the conversation, not from the last block of a message
243
- .incremark > .incremark-block:last-child > :last-child {
244
- margin-bottom: 0;
245
- }
246
- </style>
@@ -0,0 +1,176 @@
1
+ import {
2
+ createBundledHighlighter,
3
+ type HighlighterGeneric,
4
+ type LanguageInput,
5
+ type ThemeInput
6
+ } from 'shiki/core';
7
+ import { createOnigurumaEngine } from 'shiki/engine/oniguruma';
8
+
9
+ const TOP_SHIKI_LANGS = [
10
+ 'typescript',
11
+ 'javascript',
12
+ 'python',
13
+ 'html',
14
+ 'css',
15
+ 'sql',
16
+ 'shellscript',
17
+ 'json',
18
+ 'yaml',
19
+ 'markdown',
20
+ 'java',
21
+ 'csharp',
22
+ 'cpp',
23
+ 'c',
24
+ 'php',
25
+ 'go',
26
+ 'rust',
27
+ 'powershell',
28
+ 'kotlin',
29
+ 'lua',
30
+ 'swift',
31
+ 'ruby',
32
+ 'dart',
33
+ 'scala',
34
+ 'perl',
35
+ 'r',
36
+ 'tsx',
37
+ 'jsx',
38
+ 'dockerfile',
39
+ 'vue'
40
+ ] as const;
41
+
42
+ export type SupportedShikiLanguage = (typeof TOP_SHIKI_LANGS)[number];
43
+ type SupportedShikiTheme = 'github-dark' | 'github-light';
44
+
45
+ // one highlight carries both themes: the light colors inline, the dark ones as --shiki-dark, markdown.css switches them
46
+ const SHIKI_THEMES = {
47
+ light: 'github-light',
48
+ dark: 'github-dark'
49
+ } as const satisfies Record<string, SupportedShikiTheme>;
50
+ const SUPPORTED_SHIKI_LANG_SET = new Set<string>(TOP_SHIKI_LANGS);
51
+ const LANGUAGE_ALIASES = {
52
+ bash: 'shellscript',
53
+ 'c#': 'csharp',
54
+ cjs: 'javascript',
55
+ 'c++': 'cpp',
56
+ cs: 'csharp',
57
+ docker: 'dockerfile',
58
+ golang: 'go',
59
+ html: 'html',
60
+ js: 'javascript',
61
+ jsx: 'jsx',
62
+ kt: 'kotlin',
63
+ kts: 'kotlin',
64
+ md: 'markdown',
65
+ mjs: 'javascript',
66
+ ps: 'powershell',
67
+ ps1: 'powershell',
68
+ py: 'python',
69
+ rb: 'ruby',
70
+ sh: 'shellscript',
71
+ shell: 'shellscript',
72
+ ts: 'typescript',
73
+ tsx: 'tsx',
74
+ yml: 'yaml',
75
+ zsh: 'shellscript'
76
+ } as const satisfies Record<string, SupportedShikiLanguage>;
77
+
78
+ const SHIKI_THEME_LOADERS = {
79
+ 'github-dark': () => import('@shikijs/themes/github-dark'),
80
+ 'github-light': () => import('@shikijs/themes/github-light')
81
+ } as const satisfies Record<SupportedShikiTheme, ThemeInput>;
82
+
83
+ const SHIKI_LANGUAGE_LOADERS = {
84
+ typescript: () => import('@shikijs/langs/typescript'),
85
+ javascript: () => import('@shikijs/langs/javascript'),
86
+ python: () => import('@shikijs/langs/python'),
87
+ html: () => import('@shikijs/langs/html'),
88
+ css: () => import('@shikijs/langs/css'),
89
+ sql: () => import('@shikijs/langs/sql'),
90
+ shellscript: () => import('@shikijs/langs/shellscript'),
91
+ json: () => import('@shikijs/langs/json'),
92
+ yaml: () => import('@shikijs/langs/yaml'),
93
+ markdown: () => import('@shikijs/langs/markdown'),
94
+ java: () => import('@shikijs/langs/java'),
95
+ csharp: () => import('@shikijs/langs/csharp'),
96
+ cpp: () => import('@shikijs/langs/cpp'),
97
+ c: () => import('@shikijs/langs/c'),
98
+ php: () => import('@shikijs/langs/php'),
99
+ go: () => import('@shikijs/langs/go'),
100
+ rust: () => import('@shikijs/langs/rust'),
101
+ powershell: () => import('@shikijs/langs/powershell'),
102
+ kotlin: () => import('@shikijs/langs/kotlin'),
103
+ lua: () => import('@shikijs/langs/lua'),
104
+ swift: () => import('@shikijs/langs/swift'),
105
+ ruby: () => import('@shikijs/langs/ruby'),
106
+ dart: () => import('@shikijs/langs/dart'),
107
+ scala: () => import('@shikijs/langs/scala'),
108
+ perl: () => import('@shikijs/langs/perl'),
109
+ r: () => import('@shikijs/langs/r'),
110
+ tsx: () => import('@shikijs/langs/tsx'),
111
+ jsx: () => import('@shikijs/langs/jsx'),
112
+ dockerfile: () => import('@shikijs/langs/dockerfile'),
113
+ vue: () => import('@shikijs/langs/vue')
114
+ } as const satisfies Record<SupportedShikiLanguage, LanguageInput>;
115
+
116
+ const createShikiHighlighter = createBundledHighlighter({
117
+ themes: SHIKI_THEME_LOADERS,
118
+ langs: SHIKI_LANGUAGE_LOADERS,
119
+ engine: () => createOnigurumaEngine(() => import('shiki/wasm'))
120
+ });
121
+
122
+ const MAX_HIGHLIGHT_CACHE_ENTRIES = 200;
123
+ const highlightedHtmlCache = new Map<string, string>();
124
+ const loadedLanguages = new Set<SupportedShikiLanguage>();
125
+ const languageLoads = new Map<SupportedShikiLanguage, Promise<void>>();
126
+
127
+ let highlighter: HighlighterGeneric<SupportedShikiLanguage, SupportedShikiTheme> | null = null;
128
+ let highlighterLoad: Promise<void> | null = null;
129
+
130
+ // the shiki language of a fence info string, null for a language the agent does not highlight
131
+ export function shikiLanguage(language: string): SupportedShikiLanguage | null {
132
+ const normalized = language.trim().toLowerCase();
133
+ const aliased = LANGUAGE_ALIASES[normalized as keyof typeof LANGUAGE_ALIASES] ?? normalized;
134
+ return SUPPORTED_SHIKI_LANG_SET.has(aliased) ? aliased as SupportedShikiLanguage : null;
135
+ }
136
+
137
+ // highlighting itself is synchronous, only the highlighter and the grammars load once; until they have, it returns null
138
+ // and calls onReady when they are, so a streamed block is highlighted on every chunk without waiting
139
+ export function highlightCode(code: string, language: SupportedShikiLanguage, onReady: () => void): string | null {
140
+ if (!highlighter || !loadedLanguages.has(language)) {
141
+ loadLanguage(language).then(onReady, (error) => console.error('Failed to load the code highlighter', error));
142
+ return null;
143
+ }
144
+
145
+ const cacheKey = `${language}\u0000${code}`;
146
+ const cachedHtml = highlightedHtmlCache.get(cacheKey);
147
+ if (cachedHtml !== undefined) {
148
+ return cachedHtml;
149
+ }
150
+
151
+ const html = highlighter.codeToHtml(code, { lang: language, themes: SHIKI_THEMES });
152
+ setHighlightedHtmlCache(cacheKey, html);
153
+ return html;
154
+ }
155
+
156
+ async function loadLanguage(language: SupportedShikiLanguage): Promise<void> {
157
+ highlighterLoad ??= createShikiHighlighter({ themes: Object.values(SHIKI_THEMES), langs: [] }).then((created) => {
158
+ highlighter = created;
159
+ });
160
+ await highlighterLoad;
161
+
162
+ if (!languageLoads.has(language)) {
163
+ languageLoads.set(language, highlighter!.loadLanguage(language).then(() => {
164
+ loadedLanguages.add(language);
165
+ }));
166
+ }
167
+ await languageLoads.get(language);
168
+ }
169
+
170
+ function setHighlightedHtmlCache(cacheKey: string, highlightedHtml: string): void {
171
+ highlightedHtmlCache.set(cacheKey, highlightedHtml);
172
+
173
+ if (highlightedHtmlCache.size > MAX_HIGHLIGHT_CACHE_ENTRIES) {
174
+ highlightedHtmlCache.delete(highlightedHtmlCache.keys().next().value!);
175
+ }
176
+ }
@@ -0,0 +1,263 @@
1
+ /* markdown of the chat; the text color comes from the container, a reasoning block is muted */
2
+ .af-md {
3
+ line-height: 1.6;
4
+ overflow-wrap: break-word;
5
+ }
6
+
7
+ .af-md > :first-child {
8
+ margin-top: 0;
9
+ }
10
+
11
+ .af-md > :last-child {
12
+ margin-bottom: 0;
13
+ }
14
+
15
+ .af-md p,
16
+ .af-md ul,
17
+ .af-md ol,
18
+ .af-md blockquote,
19
+ .af-md table,
20
+ .af-md img {
21
+ margin: 0 0 8px;
22
+ }
23
+
24
+ .af-md h1,
25
+ .af-md h2,
26
+ .af-md h3,
27
+ .af-md h4,
28
+ .af-md h5,
29
+ .af-md h6 {
30
+ margin: 16px 0 8px;
31
+ font-weight: 600;
32
+ line-height: 1.3;
33
+ }
34
+
35
+ .af-md h1 { font-size: 1.4em; }
36
+ .af-md h2 { font-size: 1.25em; }
37
+ .af-md h3 { font-size: 1.1em; }
38
+ .af-md h4,
39
+ .af-md h5,
40
+ .af-md h6 { font-size: 1em; }
41
+
42
+ .af-md ul {
43
+ list-style: disc;
44
+ padding-left: 18px;
45
+ }
46
+
47
+ .af-md ol {
48
+ list-style: decimal;
49
+ padding-left: 22px;
50
+ }
51
+
52
+ .af-md li {
53
+ margin: 2px 0;
54
+ }
55
+
56
+ .af-md li > p,
57
+ .af-md li > ul,
58
+ .af-md li > ol {
59
+ margin: 0;
60
+ }
61
+
62
+ .af-md li:has(> input[type="checkbox"]) {
63
+ list-style: none;
64
+ margin-left: -18px;
65
+ }
66
+
67
+ .af-md li > input[type="checkbox"] {
68
+ margin: 0 6px 2px 0;
69
+ vertical-align: middle;
70
+ accent-color: theme('colors.lightPrimary');
71
+ }
72
+
73
+ .af-md a {
74
+ @apply text-lightPrimary dark:text-darkPrimary;
75
+ text-decoration: underline;
76
+ text-underline-offset: 4px;
77
+ text-decoration-style: dotted;
78
+ word-break: break-word;
79
+ }
80
+
81
+ .af-md a:hover {
82
+ text-decoration-style: solid;
83
+ }
84
+
85
+ .af-md a::after {
86
+ content: "";
87
+ display: inline-block;
88
+ width: 16px;
89
+ height: 16px;
90
+ vertical-align: middle;
91
+ rotate: -45deg;
92
+ background-color: currentColor;
93
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M13 12H2m12 0l-4 4m4-4l-4-4'/%3E%3C/svg%3E") no-repeat center;
94
+ mask-size: contain;
95
+ }
96
+
97
+ .af-md :not(pre) > code {
98
+ @apply rounded bg-lightSecondaryDarken text-lightInputText dark:bg-darkSecondaryLighten dark:text-darkInputText;
99
+ padding: 1px 4px;
100
+ font-family: theme('fontFamily.mono');
101
+ font-size: 0.9em;
102
+ }
103
+
104
+ .af-md blockquote {
105
+ @apply border-l-[3px] border-lightCardBorder text-lightInputIconColor dark:border-darkCardBorder dark:text-darkInputIconColor;
106
+ padding: 2px 0 2px 12px;
107
+ }
108
+
109
+ .af-md hr {
110
+ @apply border-lightCardBorder dark:border-darkCardBorder;
111
+ margin: 12px 0;
112
+ }
113
+
114
+ /* a wide table scrolls inside the message, not the whole chat */
115
+ .af-md table {
116
+ display: block;
117
+ width: max-content;
118
+ max-width: 100%;
119
+ overflow-x: auto;
120
+ border-collapse: collapse;
121
+ }
122
+
123
+ .af-md th,
124
+ .af-md td {
125
+ @apply border border-lightCardBorder dark:border-darkCardBorder;
126
+ padding: 6px 10px;
127
+ text-align: left;
128
+ }
129
+
130
+ .af-md th {
131
+ @apply bg-lightCardBackgroundHover dark:bg-darkCardBackgroundHover;
132
+ font-weight: 600;
133
+ }
134
+
135
+ .af-md th[align="center"],
136
+ .af-md td[align="center"] { text-align: center; }
137
+
138
+ .af-md th[align="right"],
139
+ .af-md td[align="right"] { text-align: right; }
140
+
141
+ .af-md img {
142
+ max-width: 100%;
143
+ height: auto;
144
+ border-radius: 6px;
145
+ }
146
+
147
+ .af-md-math-block {
148
+ margin: 0 0 8px;
149
+ overflow-x: auto;
150
+ overflow-y: hidden;
151
+ }
152
+
153
+ .af-md-math-block .katex-display {
154
+ margin: 0;
155
+ }
156
+
157
+ /* code blocks */
158
+ .af-md-code {
159
+ @apply border border-lightCardBorder bg-lightCardBackground dark:border-darkCardBorder dark:bg-darkCardBackground;
160
+ width: 100%;
161
+ margin: 0 0 8px;
162
+ border-radius: 8px;
163
+ overflow: hidden;
164
+ }
165
+
166
+ .af-md-code-toolbar {
167
+ @apply border-b border-lightCardBorder bg-lightCardBackgroundHover dark:border-darkCardBorder dark:bg-darkCardBackgroundHover;
168
+ display: flex;
169
+ align-items: center;
170
+ justify-content: space-between;
171
+ gap: 12px;
172
+ padding: 4px 4px 4px 12px;
173
+ }
174
+
175
+ .af-md-code-language {
176
+ @apply text-xs font-medium text-lightInputIconColor dark:text-darkInputIconColor;
177
+ }
178
+
179
+ .af-md-code-copy {
180
+ @apply h-6 rounded-default px-2 text-xs font-medium transition-colors text-lightInputIconColor dark:text-darkInputIconColor;
181
+ }
182
+
183
+ .af-md-code-copy:hover {
184
+ @apply bg-lightSecondaryDarken text-lightInputText dark:bg-darkSecondaryLighten dark:text-darkInputText;
185
+ }
186
+
187
+ .af-md-code-copy:focus-visible {
188
+ @apply outline-none ring-[3px] ring-lightFocusRing dark:ring-darkFocusRing;
189
+ }
190
+
191
+ .af-md-code-copy[data-copied] {
192
+ @apply text-lightSuccess dark:text-darkSuccess;
193
+ }
194
+
195
+ .af-md-code-body {
196
+ overflow-x: auto;
197
+ }
198
+
199
+ .af-md-code-body pre {
200
+ margin: 0;
201
+ padding: 12px;
202
+ overflow-x: auto;
203
+ background: transparent !important;
204
+ font-size: 13px;
205
+ line-height: 1.65;
206
+ }
207
+
208
+ .af-md-code-body code {
209
+ display: block;
210
+ font-family: theme('fontFamily.mono');
211
+ white-space: pre;
212
+ }
213
+
214
+ .af-md-code-body .line {
215
+ min-height: 1.65em;
216
+ }
217
+
218
+ /* shiki writes the light colors inline and the dark ones as --shiki-dark */
219
+ .dark .af-md-code-body .shiki,
220
+ .dark .af-md-code-body .shiki span {
221
+ color: var(--shiki-dark) !important;
222
+ }
223
+
224
+ /* charts; vegaLiteConfig reads the --chart-* tokens when it renders */
225
+ .af-md-vega {
226
+ width: 100%;
227
+ margin: 0 0 8px;
228
+ --chart-text: theme('colors.lightInputText');
229
+ --chart-muted: theme('colors.lightInputIconColor');
230
+ --chart-grid: theme('colors.lightCardBorder');
231
+ --chart-baseline: theme('colors.lightInputBorder');
232
+ --chart-surface: theme('colors.lightCardBackground');
233
+ }
234
+
235
+ .dark .af-md-vega {
236
+ --chart-text: theme('colors.darkInputText');
237
+ --chart-muted: theme('colors.darkInputIconColor');
238
+ --chart-grid: theme('colors.darkCardBorder');
239
+ --chart-baseline: theme('colors.darkInputBorder');
240
+ --chart-surface: theme('colors.darkCardBackground');
241
+ }
242
+
243
+ .af-md-vega .vega-embed {
244
+ width: 100%;
245
+ }
246
+
247
+ /* vega-tooltip appends its element to the body, so the "af" tooltip theme is global */
248
+ #vg-tooltip-element.af-theme {
249
+ @apply rounded-default border-0 px-2 py-1.5 text-xs bg-lightDropdownOptionsBackground text-lightInputText shadow-popover dark:bg-darkDropdownOptionsBackground dark:text-darkInputText dark:shadow-darkPopover;
250
+ font-family: inherit;
251
+ }
252
+
253
+ #vg-tooltip-element.af-theme h2 {
254
+ @apply mb-1 text-xs font-semibold;
255
+ }
256
+
257
+ #vg-tooltip-element.af-theme td.key {
258
+ @apply pr-2 text-lightInputIconColor dark:text-darkInputIconColor;
259
+ }
260
+
261
+ #vg-tooltip-element.af-theme td.value {
262
+ @apply font-medium tabular-nums;
263
+ }