@aleph-alpha/chat-kit 6.3.0 → 6.4.1

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 (73) hide show
  1. package/dist/{CkHistory.vue_vue_type_script_setup_true_lang-gV-lp0ZB.js → CkHistory.vue_vue_type_script_setup_true_lang-BvRIp3m6.js} +79 -16
  2. package/dist/adapters/responses-api.js +1 -1
  3. package/dist/chat-kit.css +81 -11
  4. package/dist/{code-palette-DAJUTnR-.js → code-palette-BWrZDi47.js} +156 -119
  5. package/dist/components/base/CkCodeEditor/CkCodeEditor.stories.d.ts +8 -1
  6. package/dist/components/base/CkCodeEditor/CkCodeEditor.stories.d.ts.map +1 -1
  7. package/dist/components/base/CkCodeEditor/CkCodeEditor.vue.d.ts +2 -0
  8. package/dist/components/base/CkCodeEditor/CkCodeEditor.vue.d.ts.map +1 -1
  9. package/dist/components/base/CkCodeEditor/badgeDecoration.d.ts +47 -0
  10. package/dist/components/base/CkCodeEditor/badgeDecoration.d.ts.map +1 -0
  11. package/dist/components/base/CkCodeEditor/createCodeMirror.d.ts +19 -1
  12. package/dist/components/base/CkCodeEditor/createCodeMirror.d.ts.map +1 -1
  13. package/dist/components/base/CkCodeEditor/types.d.ts +32 -0
  14. package/dist/components/base/CkCodeEditor/types.d.ts.map +1 -1
  15. package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.d.ts +7 -0
  16. package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.d.ts.map +1 -1
  17. package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue.d.ts +9 -0
  18. package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue.d.ts.map +1 -1
  19. package/dist/components/base/CkMarkdownRenderer/types.d.ts +13 -0
  20. package/dist/components/base/CkMarkdownRenderer/types.d.ts.map +1 -1
  21. package/dist/components/index.js +1 -1
  22. package/dist/composables/index.js +1 -1
  23. package/dist/createCodeMirror-BO-TWTzn.js +187 -0
  24. package/dist/{createCrepeEditor-Ci5FHHIV.js → createCrepeEditor-BGSlwmKn.js} +4 -4
  25. package/dist/handlers/index.js +2 -2
  26. package/dist/helpers/codemirror/theme.d.ts.map +1 -1
  27. package/dist/helpers/unified/remarkBreaks.d.ts +15 -0
  28. package/dist/helpers/unified/remarkBreaks.d.ts.map +1 -0
  29. package/dist/{index-w2yzH7vs.js → index--Yonjzfi.js} +3 -3
  30. package/dist/{index-CN8d3yl1.js → index-2YPxXIaf.js} +1 -1
  31. package/dist/{index-BoUJGvvQ.js → index-B4uqe-fL.js} +2 -2
  32. package/dist/{index-gYt3E3Cp.js → index-Bfo4U-Al.js} +2 -2
  33. package/dist/{index-BtY1uxn6.js → index-Bw39pbRL.js} +3 -3
  34. package/dist/{index-Dl24CCB3.js → index-CGEgwupi.js} +4 -4
  35. package/dist/{index-MfXW4ZyN.js → index-CZmdzLaU.js} +3 -3
  36. package/dist/{index-DgCcFC3N.js → index-CeaT_FBl.js} +3 -3
  37. package/dist/{index-BhvbqYsK.js → index-CefLTKmi.js} +2 -2
  38. package/dist/{index-CLdXUpL8.js → index-CfVHzirA.js} +5 -5
  39. package/dist/{index-BUCqcTPA.js → index-CrBanggA.js} +2 -2
  40. package/dist/{index-DufAP1JF.js → index-Cx5ThXzs.js} +3 -3
  41. package/dist/{index-CZFx44C7.js → index-D0DQjdsq.js} +2 -2
  42. package/dist/{index-DqGDenO9.js → index-DH9e_hqJ.js} +2 -2
  43. package/dist/{index-BvG6l44n.js → index-DTomeh-p.js} +3 -3
  44. package/dist/{index-ZHg2R9iD.js → index-DZGfsazg.js} +3 -3
  45. package/dist/{index-BLVAx_f8.js → index-DlLnTKv3.js} +2 -2
  46. package/dist/{index-Cxs6kPho.js → index-DqUiBDRo.js} +3 -3
  47. package/dist/{index-DhwsowEf.js → index-GDUM7K5V.js} +2 -2
  48. package/dist/{index-CB6xZVsf.js → index-Hro6EPZS.js} +2 -2
  49. package/dist/{index-D6ftdiLa.js → index-KgumaL1c.js} +1 -1
  50. package/dist/{index-CIF93PZF.js → index-TemHfU1M.js} +3 -3
  51. package/dist/{index-CYk7AB8M.js → index-g_Bs6dNr.js} +4 -4
  52. package/dist/{index-B2tew8uf.js → index-oO_X5wU0.js} +3 -3
  53. package/dist/{index-DxTzaHLr.js → index-ptbBQ53d.js} +4 -4
  54. package/dist/index.js +5 -5
  55. package/dist/{markdownToPlainText-BOtlQ_BY.js → markdownToPlainText-DN_G-I6g.js} +1 -1
  56. package/dist/{useChatKitLabels-CatQSpfL.js → useChatKitLabels-DxW0N5U-.js} +1 -1
  57. package/dist/{useMessageHandler-nnsort0-.js → useMessageHandler-Bkzrdgfj.js} +1 -1
  58. package/package.json +3 -3
  59. package/src/components/base/CkCodeEditor/CkCodeEditor.spec.ts +161 -1
  60. package/src/components/base/CkCodeEditor/CkCodeEditor.stories.ts +97 -1
  61. package/src/components/base/CkCodeEditor/CkCodeEditor.vue +135 -12
  62. package/src/components/base/CkCodeEditor/badgeDecoration.ts +173 -0
  63. package/src/components/base/CkCodeEditor/createCodeMirror.ts +54 -8
  64. package/src/components/base/CkCodeEditor/types.ts +38 -0
  65. package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.spec.ts +40 -0
  66. package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.ts +31 -0
  67. package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue +3 -0
  68. package/src/components/base/CkMarkdownRenderer/types.ts +13 -0
  69. package/src/components/base/CkMilkdownEditor/milkdown-theme.css +6 -3
  70. package/src/helpers/codemirror/code-palette.css +23 -3
  71. package/src/helpers/codemirror/theme.ts +44 -8
  72. package/src/helpers/unified/remarkBreaks.ts +32 -0
  73. package/dist/createCodeMirror-BkV6FEPn.js +0 -101
@@ -1,6 +1,7 @@
1
1
  import { defineComponent, openBlock, createBlock, unref, createElementBlock, createElementVNode, normalizeClass, renderSlot, createCommentVNode, mergeProps, withCtx, ref, watch, onScopeDispose, computed, useTemplateRef, createVNode, toDisplayString, resolveDynamicComponent, onBeforeUnmount, useSlots, onMounted, nextTick, onUnmounted, Fragment, renderList, normalizeStyle, Transition, createStaticVNode, Teleport, withModifiers, toValue, h, toRefs, useId, createTextVNode, useAttrs, onUpdated, createSlots, normalizeProps, guardReactiveProps, Comment, Text } from "vue";
2
- import { UiIcon, UiButton, UiFileType, UiTooltip, UiPopover, UiPopoverTrigger, UiPopoverContent, formatFileSize, UiDialog, UiDialogContent, UiDialogDescription, UiFieldLabel, UiToggleGroup, UiToggleGroupItem, UiField, UiTextarea, UiFileItem, UiProgress, Primitive, UiFloatActions, UiFloatActionItems, UiCodeBlock, UiAvatar, UiAvatarImage, UiSpinner, UiAvatarFallback, UiSidebarPopoverMenu, UiSidebarPopoverMenuItem } from "@aleph-alpha/ui-library";
3
- import { u as useChatKitLabels, d as defaultChatKitLabels, r as remarkCitations, b as useMarkdownParser } from "./useChatKitLabels-CatQSpfL.js";
2
+ import { UiIcon, UiButton, UiFileType, UiTooltip, UiPopover, UiPopoverTrigger, UiPopoverContent, formatFileSize, UiDialog, UiDialogContent, UiDialogDescription, UiFieldLabel, UiToggleGroup, UiToggleGroupItem, UiField, UiTextarea, UiFileItem, UiProgress, Primitive, UiFloatActions, UiFloatActionItems, UiFadeMask, UiCodeBlock, UiAvatar, UiAvatarImage, UiSpinner, UiAvatarFallback, UiSidebarPopoverMenu, UiSidebarPopoverMenuItem } from "@aleph-alpha/ui-library";
3
+ import { u as useChatKitLabels, d as defaultChatKitLabels, r as remarkCitations, b as useMarkdownParser } from "./useChatKitLabels-DxW0N5U-.js";
4
+ import { f as findAndReplace } from "./index-CfVHzirA.js";
4
5
  const MINUTE = 60;
5
6
  const HOUR = 60 * MINUTE;
6
7
  const DAY = 24 * HOUR;
@@ -1160,6 +1161,15 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
1160
1161
  }
1161
1162
  });
1162
1163
  const CkFeedbackButton = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-c4c638c3"]]);
1164
+ const SOFT_BREAK_RE = /\r?\n/g;
1165
+ const remarkBreaks = () => {
1166
+ return (tree) => {
1167
+ findAndReplace(tree, [
1168
+ SOFT_BREAK_RE,
1169
+ () => ({ type: "break" })
1170
+ ]);
1171
+ };
1172
+ };
1163
1173
  function useCitationRendering(citations, onOpenSource) {
1164
1174
  const sourcesByIndex = computed(
1165
1175
  () => new Map(
@@ -1251,6 +1261,7 @@ const _sfc_main$i = defineComponent({
1251
1261
  default: () => ({})
1252
1262
  },
1253
1263
  plugins: { type: Array, default: void 0 },
1264
+ breaks: { type: Boolean, default: false },
1254
1265
  citations: {
1255
1266
  type: Array,
1256
1267
  default: void 0
@@ -1271,6 +1282,7 @@ const _sfc_main$i = defineComponent({
1271
1282
  );
1272
1283
  const effectivePlugins = computed(() => [
1273
1284
  ...props.plugins ?? [],
1285
+ ...props.breaks ? [remarkBreaks] : [],
1274
1286
  ...citationPlugins.value
1275
1287
  ]);
1276
1288
  const { html } = useMarkdownParser(content, effectivePlugins);
@@ -2733,7 +2745,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2733
2745
  onMounted(async () => {
2734
2746
  const root = rootRef.value;
2735
2747
  if (!root) return;
2736
- const { createCrepeEditor } = await import("./createCrepeEditor-Ci5FHHIV.js");
2748
+ const { createCrepeEditor } = await import("./createCrepeEditor-BGSlwmKn.js");
2737
2749
  if (destroyed) return;
2738
2750
  const initialMarkdown = props.modelValue;
2739
2751
  lastKnownMarkdown = initialMarkdown;
@@ -2811,9 +2823,10 @@ const CkMilkdownEditor = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId",
2811
2823
  const _hoisted_1$1 = ["aria-disabled"];
2812
2824
  const _hoisted_2 = {
2813
2825
  key: 0,
2814
- class: "border-border-surface-default bg-background-surface-muted flex items-center justify-between border-b px-4 py-2"
2826
+ class: "bg-background-surface-muted-subtle flex h-9 items-center justify-between px-3"
2815
2827
  };
2816
- const _hoisted_3 = { class: "text-content-on-surface-secondary font-mono text-sm" };
2828
+ const _hoisted_3 = { class: "text-content-on-surface-secondary label-12-regular" };
2829
+ const FADE_HEIGHT = "53px";
2817
2830
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2818
2831
  ...{ name: "CkCodeEditor" },
2819
2832
  __name: "CkCodeEditor",
@@ -2830,7 +2843,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2830
2843
  showLineNumbers: { type: Boolean, default: true },
2831
2844
  lineWrapping: { type: Boolean, default: false },
2832
2845
  maxHeight: { default: void 0 },
2846
+ scrollFade: { type: Boolean, default: true },
2833
2847
  autofocus: { type: Boolean, default: false },
2848
+ badge: { default: void 0 },
2834
2849
  writeToClipboard: { type: Function, default: void 0 }
2835
2850
  },
2836
2851
  emits: ["update:modelValue", "focus", "blur", "copy"],
@@ -2850,6 +2865,40 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2850
2865
  const copyLabel = computed(
2851
2866
  () => isCopied.value ? labels.value.codeEditorCopied ?? "Copied" : labels.value.codeEditorCopy ?? "Copy code"
2852
2867
  );
2868
+ const canScrollUp = ref(false);
2869
+ const canScrollDown = ref(false);
2870
+ let scrollTarget;
2871
+ let scrollObserver;
2872
+ function edgeToFade(up, down) {
2873
+ if (up && down) return "both";
2874
+ return up ? "top" : "bottom";
2875
+ }
2876
+ const fadeProps = computed(() => {
2877
+ if (!props.scrollFade) return {};
2878
+ const up = canScrollUp.value;
2879
+ const down = canScrollDown.value;
2880
+ return {
2881
+ position: edgeToFade(up, down),
2882
+ background: "secondary",
2883
+ style: { "--ui-fade-mask-height": up || down ? FADE_HEIGHT : "0px" }
2884
+ };
2885
+ });
2886
+ function syncScrollFades() {
2887
+ if (!scrollTarget) return;
2888
+ const { scrollTop, scrollHeight, clientHeight } = scrollTarget;
2889
+ canScrollUp.value = scrollTop > 1;
2890
+ canScrollDown.value = scrollTop + clientHeight < scrollHeight - 1;
2891
+ }
2892
+ function watchScrolling(scroller, content) {
2893
+ scrollTarget = scroller;
2894
+ scroller.addEventListener("scroll", syncScrollFades, { passive: true });
2895
+ if (typeof ResizeObserver !== "undefined") {
2896
+ scrollObserver = new ResizeObserver(syncScrollFades);
2897
+ scrollObserver.observe(scroller);
2898
+ scrollObserver.observe(content);
2899
+ }
2900
+ syncScrollFades();
2901
+ }
2853
2902
  let editor;
2854
2903
  let destroyed = false;
2855
2904
  let lastKnownCode = props.modelValue;
@@ -2862,7 +2911,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2862
2911
  onMounted(async () => {
2863
2912
  const parent = hostRef.value;
2864
2913
  if (!parent) return;
2865
- const { createCodeMirror } = await import("./createCodeMirror-BkV6FEPn.js");
2914
+ const { createCodeMirror } = await import("./createCodeMirror-BO-TWTzn.js");
2866
2915
  if (destroyed) return;
2867
2916
  const initialCode = props.modelValue;
2868
2917
  lastKnownCode = initialCode;
@@ -2875,9 +2924,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2875
2924
  readonly: isLocked.value,
2876
2925
  showLineNumbers: props.showLineNumbers,
2877
2926
  lineWrapping: props.lineWrapping,
2927
+ badge: props.badge,
2878
2928
  onChange: handleChange,
2879
- onFocus: () => emit("focus"),
2880
- onBlur: () => emit("blur")
2929
+ onFocus: () => emit("focus")
2881
2930
  });
2882
2931
  if (destroyed) {
2883
2932
  handle.destroy();
@@ -2885,6 +2934,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2885
2934
  }
2886
2935
  editor = handle;
2887
2936
  if (props.modelValue !== initialCode) handle.setCode(props.modelValue);
2937
+ watchScrolling(handle.view.scrollDOM, handle.view.contentDOM);
2888
2938
  isReady.value = true;
2889
2939
  if (props.autofocus) handle.focus();
2890
2940
  });
@@ -2894,6 +2944,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2894
2944
  if (next === lastKnownCode) return;
2895
2945
  lastKnownCode = next;
2896
2946
  editor?.setCode(next);
2947
+ void nextTick(syncScrollFades);
2897
2948
  }
2898
2949
  );
2899
2950
  watch(
@@ -2911,9 +2962,16 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2911
2962
  () => props.lineWrapping,
2912
2963
  (wrap) => editor?.setLineWrapping(wrap)
2913
2964
  );
2965
+ watch(
2966
+ () => props.badge,
2967
+ (rule) => editor?.setBadge(rule)
2968
+ );
2914
2969
  onBeforeUnmount(() => {
2915
2970
  destroyed = true;
2916
2971
  clearTimeout(copyTimer);
2972
+ scrollTarget?.removeEventListener("scroll", syncScrollFades);
2973
+ scrollObserver?.disconnect();
2974
+ scrollTarget = void 0;
2917
2975
  editor?.destroy();
2918
2976
  editor = void 0;
2919
2977
  });
@@ -2949,7 +3007,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2949
3007
  ref_key: "rootRef",
2950
3008
  ref: rootRef,
2951
3009
  class: normalizeClass([
2952
- "ck-code-editor ck-code-surface border-border-surface-default min-w-0 overflow-hidden rounded-lg border",
3010
+ "ck-code-editor ck-code-surface border-border-surface-default bg-background-input-default min-w-0 overflow-hidden rounded-xl border",
2953
3011
  isReady.value && "ck-code-editor--ready",
2954
3012
  isLocked.value && "ck-code-editor--readonly",
2955
3013
  __props.disabled && "ck-code-editor--disabled"
@@ -2975,17 +3033,22 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2975
3033
  _: 1
2976
3034
  }, 8, ["aria-label"])) : createCommentVNode("", true)
2977
3035
  ])) : createCommentVNode("", true),
2978
- createElementVNode("div", {
2979
- ref_key: "hostRef",
2980
- ref: hostRef,
2981
- class: "ck-code-editor__host",
2982
- style: normalizeStyle(__props.maxHeight ? { "--ck-code-max-height": __props.maxHeight } : void 0)
2983
- }, null, 4)
3036
+ (openBlock(), createBlock(resolveDynamicComponent(__props.scrollFade ? unref(UiFadeMask) : "div"), mergeProps(fadeProps.value, { class: "ck-code-editor__body min-w-0" }), {
3037
+ default: withCtx(() => [
3038
+ createElementVNode("div", {
3039
+ ref_key: "hostRef",
3040
+ ref: hostRef,
3041
+ class: "ck-code-editor__host",
3042
+ style: normalizeStyle(__props.maxHeight ? { "--ck-code-max-height": __props.maxHeight } : void 0)
3043
+ }, null, 4)
3044
+ ]),
3045
+ _: 1
3046
+ }, 16))
2984
3047
  ], 42, _hoisted_1$1);
2985
3048
  };
2986
3049
  }
2987
3050
  });
2988
- const CkCodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-567251c3"]]);
3051
+ const CkCodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-75f52b7e"]]);
2989
3052
  const _hoisted_1 = {
2990
3053
  key: 1,
2991
3054
  class: "flex size-8 shrink-0 items-center justify-center rounded-2xl bg-background-surface-muted-subtle"
@@ -1,4 +1,4 @@
1
- import { g as generateId } from "../markdownToPlainText-BOtlQ_BY.js";
1
+ import { g as generateId } from "../markdownToPlainText-DN_G-I6g.js";
2
2
  function extractMessageText(parts) {
3
3
  let text = "";
4
4
  for (const part of parts) {
package/dist/chat-kit.css CHANGED
@@ -170,22 +170,69 @@
170
170
  pointer-events: none;
171
171
  }
172
172
 
173
+ /* The body follows the design-system field rather than `UiCodeBlock`: body
174
+ * text in the primary content colour on the input surface, with muted mono
175
+ * line numbers. Only the syntax colours stay shared with `UiCodeBlock` (see
176
+ * `helpers/codemirror/code-palette.css`). The overrides live here, not in
177
+ * `theme.ts`, because `CkMilkdownEditor`'s code blocks use that theme too and
178
+ * must keep matching the rendered block. */
179
+ .ck-code-editor[data-v-75f52b7e] {
180
+ --ck-cm-bg: transparent;
181
+ --ck-cm-foreground: oklch(var(--content-on-surface-primary));
182
+ --ck-cm-line-number: oklch(var(--content-on-surface-muted));
183
+ }
184
+
173
185
  /* The editor fills the panel; `:deep` is needed because CodeMirror builds its
174
186
  * own DOM, which scoped styles do not reach. */
175
- .ck-code-editor__host[data-v-567251c3] .cm-editor {
187
+ .ck-code-editor__host[data-v-75f52b7e] .cm-editor {
176
188
  background: var(--ck-cm-bg);
177
189
  color: var(--ck-cm-foreground);
178
190
  }
179
- .ck-code-editor__host[data-v-567251c3] .cm-scroller {
191
+
192
+ /* Same declarations as the `body-14-regular` typography utility. */
193
+ .ck-code-editor__host[data-v-75f52b7e] .cm-scroller {
180
194
  max-height: var(--ck-code-max-height, none);
195
+ font-family: Saans, sans-serif;
196
+ font-size: 0.875rem;
197
+ font-weight: 400;
198
+ line-height: 1.25rem;
199
+ }
200
+
201
+ /* 12px below the header, 16px above the bottom edge, and a 20px right inset,
202
+ * as in the design. */
203
+ .ck-code-editor__host[data-v-75f52b7e] .cm-content {
204
+ padding: 0.75rem 1.25rem 1rem 1rem;
205
+ }
206
+
207
+ /* The number column already carries the 1rem left inset, so the code must not
208
+ * pay for it a second time. The sibling selector only matches while the gutter
209
+ * is mounted, which is exactly when `showLineNumbers` is on. */
210
+ .ck-code-editor__host[data-v-75f52b7e] .cm-gutters ~ .cm-content {
211
+ padding-left: 0;
212
+ }
213
+
214
+ /* Numbers stay monospaced so the column does not jitter as digits change; the
215
+ * 12px right padding is the gap before the code. */
216
+ .ck-code-editor__host[data-v-75f52b7e] .cm-lineNumbers .cm-gutterElement {
217
+ min-width: 0;
218
+ padding: 0 0.75rem 0 1rem;
219
+ /* `CODE_FONT_FAMILY` from `theme.ts`, repeated because importing it here
220
+ * would pull CodeMirror out of its lazy chunk. */
221
+ font-family:
222
+ ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono',
223
+ monospace;
224
+ font-weight: 500;
225
+ }
226
+ .ck-code-editor__host[data-v-75f52b7e] .cm-placeholder {
227
+ color: oklch(var(--content-on-surface-muted));
181
228
  }
182
229
 
183
230
  /* Nothing is being edited, so the active-line band would only be noise. */
184
- .ck-code-editor--readonly .ck-code-editor__host[data-v-567251c3] .cm-activeLine,
185
- .ck-code-editor--readonly .ck-code-editor__host[data-v-567251c3] .cm-activeLineGutter {
231
+ .ck-code-editor--readonly .ck-code-editor__host[data-v-75f52b7e] .cm-activeLine,
232
+ .ck-code-editor--readonly .ck-code-editor__host[data-v-75f52b7e] .cm-activeLineGutter {
186
233
  background: transparent;
187
234
  }
188
- .ck-code-editor--disabled[data-v-567251c3] {
235
+ .ck-code-editor--disabled[data-v-75f52b7e] {
189
236
  opacity: 0.6;
190
237
  cursor: not-allowed;
191
238
  pointer-events: none;
@@ -207,11 +254,23 @@
207
254
  * Exact parity is not achievable for every token: Shiki classifies with
208
255
  * TextMate grammars and CodeMirror with Lezer, and the two disagree at the
209
256
  * edges. The mapping in `theme.ts` targets the classes that actually occur in
210
- * everyday code.
257
+ * everyday code. Where one Lezer tag covers cases the GitHub themes colour
258
+ * differently, the mapping follows the more common one, which leaves a few
259
+ * known gaps: YAML keys and plain scalars both arrive as tags that mean
260
+ * something else in JavaScript, so they stay unhighlighted; `typeName` is blue
261
+ * here because that is right for TypeScript's primitives, though Rust and Go
262
+ * would want purple and red; and a fenced code block inside a Markdown
263
+ * document is not highlighted in its own language the way Shiki's embedded
264
+ * grammars do it.
211
265
  */
212
266
 
213
267
  .ck-code-surface {
214
- --ck-cm-bg: #ffffff;
268
+ /* Held as bare oklch components, not a hex, because that is the form both
269
+ * `oklch()` and `UiFadeMask`'s surface variable need in order to fade the
270
+ * colour out to zero alpha. `--ck-cm-bg` is derived from it so there is one
271
+ * source of truth. */
272
+ --ck-cm-bg-components: 100% 0 89.88;
273
+ --ck-cm-bg: oklch(var(--ck-cm-bg-components));
215
274
  --ck-cm-foreground: #24292e;
216
275
  --ck-cm-keyword: #d73a49;
217
276
  --ck-cm-string: #032f62;
@@ -226,10 +285,18 @@
226
285
  --ck-cm-tag: #22863a;
227
286
  --ck-cm-error: #b31d28;
228
287
  --ck-cm-selection: oklch(var(--background-accent-soft));
288
+ /* Line numbers. `UiCodeBlock` draws its gutter as the code foreground at
289
+ * 40% opacity rather than as a colour of its own, so this is derived from
290
+ * `--ck-cm-foreground` and needs no dark-mode counterpart. */
291
+ --ck-cm-line-number: color-mix(
292
+ in oklab,
293
+ var(--ck-cm-foreground) 40%,
294
+ transparent
295
+ );
229
296
  }
230
297
 
231
298
  html.dark .ck-code-surface {
232
- --ck-cm-bg: #24292e;
299
+ --ck-cm-bg-components: 27.81% 0.0117 248.25;
233
300
  --ck-cm-foreground: #e1e4e8;
234
301
  --ck-cm-keyword: #f97583;
235
302
  --ck-cm-string: #9ecbff;
@@ -1372,9 +1439,12 @@ img.ProseMirror-separator {
1372
1439
  .milkdown-code-block
1373
1440
  .cm-lineNumbers
1374
1441
  .cm-gutterElement {
1375
- min-width: 2.25rem;
1376
- padding: 0 0.75rem 0 1rem;
1377
- color: oklch(var(--content-on-surface-muted));
1442
+ /* Geometry and colour come from `theme.ts`, which matches `UiCodeBlock`'s
1443
+ * gutter; this rule only exists because Crepe's own code-block styles would
1444
+ * otherwise win on specificity. */
1445
+ min-width: 4rem;
1446
+ padding: 0 1rem;
1447
+ color: var(--ck-cm-line-number);
1378
1448
  text-align: right;
1379
1449
  }
1380
1450