@aleph-alpha/chat-kit 6.4.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 (71) hide show
  1. package/dist/{CkHistory.vue_vue_type_script_setup_true_lang-B0WUzTHa.js → CkHistory.vue_vue_type_script_setup_true_lang-BvRIp3m6.js} +71 -14
  2. package/dist/adapters/responses-api.js +1 -1
  3. package/dist/chat-kit.css +81 -11
  4. package/dist/{code-palette-DH_G7mZ5.js → code-palette-BWrZDi47.js} +71 -35
  5. package/dist/components/base/CkCodeEditor/CkCodeEditor.stories.d.ts +2 -1
  6. package/dist/components/base/CkCodeEditor/CkCodeEditor.stories.d.ts.map +1 -1
  7. package/dist/components/base/CkCodeEditor/CkCodeEditor.vue.d.ts +1 -0
  8. package/dist/components/base/CkCodeEditor/CkCodeEditor.vue.d.ts.map +1 -1
  9. package/dist/components/base/CkCodeEditor/badgeDecoration.d.ts +2 -2
  10. package/dist/components/base/CkCodeEditor/createCodeMirror.d.ts +15 -1
  11. package/dist/components/base/CkCodeEditor/createCodeMirror.d.ts.map +1 -1
  12. package/dist/components/base/CkCodeEditor/types.d.ts +12 -0
  13. package/dist/components/base/CkCodeEditor/types.d.ts.map +1 -1
  14. package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.d.ts +7 -0
  15. package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.d.ts.map +1 -1
  16. package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue.d.ts +9 -0
  17. package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue.d.ts.map +1 -1
  18. package/dist/components/base/CkMarkdownRenderer/types.d.ts +13 -0
  19. package/dist/components/base/CkMarkdownRenderer/types.d.ts.map +1 -1
  20. package/dist/components/index.js +1 -1
  21. package/dist/composables/index.js +1 -1
  22. package/dist/{createCodeMirror-5iswYetS.js → createCodeMirror-BO-TWTzn.js} +27 -9
  23. package/dist/{createCrepeEditor-C-AQ1w_e.js → createCrepeEditor-BGSlwmKn.js} +4 -4
  24. package/dist/handlers/index.js +2 -2
  25. package/dist/helpers/codemirror/theme.d.ts.map +1 -1
  26. package/dist/helpers/unified/remarkBreaks.d.ts +15 -0
  27. package/dist/helpers/unified/remarkBreaks.d.ts.map +1 -0
  28. package/dist/{index-DLjsqQHx.js → index--Yonjzfi.js} +3 -3
  29. package/dist/{index-Mh3WUU-6.js → index-2YPxXIaf.js} +1 -1
  30. package/dist/{index-CWp_t8Wl.js → index-B4uqe-fL.js} +2 -2
  31. package/dist/{index-hEJ_Bavx.js → index-Bfo4U-Al.js} +2 -2
  32. package/dist/{index-g2X42srv.js → index-Bw39pbRL.js} +3 -3
  33. package/dist/{index-CIF4qQzR.js → index-CGEgwupi.js} +4 -4
  34. package/dist/{index-Dbi75pKH.js → index-CZmdzLaU.js} +3 -3
  35. package/dist/{index-CR2kGrpY.js → index-CeaT_FBl.js} +3 -3
  36. package/dist/{index-DfLCrnVq.js → index-CefLTKmi.js} +2 -2
  37. package/dist/{index-CLdXUpL8.js → index-CfVHzirA.js} +5 -5
  38. package/dist/{index-D0IZW-Up.js → index-CrBanggA.js} +2 -2
  39. package/dist/{index-BlIc9r0r.js → index-Cx5ThXzs.js} +3 -3
  40. package/dist/{index-CZFx44C7.js → index-D0DQjdsq.js} +2 -2
  41. package/dist/{index-DPgw0Cf_.js → index-DH9e_hqJ.js} +2 -2
  42. package/dist/{index-hbS5PDHj.js → index-DTomeh-p.js} +3 -3
  43. package/dist/{index-GpSpJ3ti.js → index-DZGfsazg.js} +3 -3
  44. package/dist/{index-QAs789O5.js → index-DlLnTKv3.js} +2 -2
  45. package/dist/{index-ABUMl7H3.js → index-DqUiBDRo.js} +3 -3
  46. package/dist/{index-CFGO7LRz.js → index-GDUM7K5V.js} +2 -2
  47. package/dist/{index-Db5-PJG-.js → index-Hro6EPZS.js} +2 -2
  48. package/dist/{index-CG8e3146.js → index-KgumaL1c.js} +1 -1
  49. package/dist/{index-XZeturb3.js → index-TemHfU1M.js} +3 -3
  50. package/dist/{index-DKwEe_Tu.js → index-g_Bs6dNr.js} +4 -4
  51. package/dist/{index-S4ylc8JK.js → index-oO_X5wU0.js} +3 -3
  52. package/dist/{index-BqWO6mvz.js → index-ptbBQ53d.js} +4 -4
  53. package/dist/index.js +5 -5
  54. package/dist/{markdownToPlainText-BOtlQ_BY.js → markdownToPlainText-DN_G-I6g.js} +1 -1
  55. package/dist/{useChatKitLabels-CatQSpfL.js → useChatKitLabels-DxW0N5U-.js} +1 -1
  56. package/dist/{useMessageHandler-nnsort0-.js → useMessageHandler-Bkzrdgfj.js} +1 -1
  57. package/package.json +1 -1
  58. package/src/components/base/CkCodeEditor/CkCodeEditor.spec.ts +100 -1
  59. package/src/components/base/CkCodeEditor/CkCodeEditor.stories.ts +3 -1
  60. package/src/components/base/CkCodeEditor/CkCodeEditor.vue +127 -10
  61. package/src/components/base/CkCodeEditor/badgeDecoration.ts +2 -2
  62. package/src/components/base/CkCodeEditor/createCodeMirror.ts +45 -8
  63. package/src/components/base/CkCodeEditor/types.ts +12 -0
  64. package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.spec.ts +40 -0
  65. package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.ts +31 -0
  66. package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue +3 -0
  67. package/src/components/base/CkMarkdownRenderer/types.ts +13 -0
  68. package/src/components/base/CkMilkdownEditor/milkdown-theme.css +6 -3
  69. package/src/helpers/codemirror/code-palette.css +23 -3
  70. package/src/helpers/codemirror/theme.ts +44 -8
  71. package/src/helpers/unified/remarkBreaks.ts +32 -0
@@ -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-C-AQ1w_e.js");
2748
+ const { createCrepeEditor } = await import("./createCrepeEditor-BGSlwmKn.js");
2737
2749
  if (destroyed) return;
2738
2750
  const initialMarkdown = props.modelValue;
2739
2751
  lastKnownMarkdown = initialMarkdown;
@@ -2814,6 +2826,7 @@ const _hoisted_2 = {
2814
2826
  class: "bg-background-surface-muted-subtle flex h-9 items-center justify-between px-3"
2815
2827
  };
2816
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,6 +2843,7 @@ 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 },
2834
2848
  badge: { default: void 0 },
2835
2849
  writeToClipboard: { type: Function, default: void 0 }
@@ -2851,6 +2865,40 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2851
2865
  const copyLabel = computed(
2852
2866
  () => isCopied.value ? labels.value.codeEditorCopied ?? "Copied" : labels.value.codeEditorCopy ?? "Copy code"
2853
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
+ }
2854
2902
  let editor;
2855
2903
  let destroyed = false;
2856
2904
  let lastKnownCode = props.modelValue;
@@ -2863,7 +2911,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2863
2911
  onMounted(async () => {
2864
2912
  const parent = hostRef.value;
2865
2913
  if (!parent) return;
2866
- const { createCodeMirror } = await import("./createCodeMirror-5iswYetS.js");
2914
+ const { createCodeMirror } = await import("./createCodeMirror-BO-TWTzn.js");
2867
2915
  if (destroyed) return;
2868
2916
  const initialCode = props.modelValue;
2869
2917
  lastKnownCode = initialCode;
@@ -2878,8 +2926,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2878
2926
  lineWrapping: props.lineWrapping,
2879
2927
  badge: props.badge,
2880
2928
  onChange: handleChange,
2881
- onFocus: () => emit("focus"),
2882
- onBlur: () => emit("blur")
2929
+ onFocus: () => emit("focus")
2883
2930
  });
2884
2931
  if (destroyed) {
2885
2932
  handle.destroy();
@@ -2887,6 +2934,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2887
2934
  }
2888
2935
  editor = handle;
2889
2936
  if (props.modelValue !== initialCode) handle.setCode(props.modelValue);
2937
+ watchScrolling(handle.view.scrollDOM, handle.view.contentDOM);
2890
2938
  isReady.value = true;
2891
2939
  if (props.autofocus) handle.focus();
2892
2940
  });
@@ -2896,6 +2944,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2896
2944
  if (next === lastKnownCode) return;
2897
2945
  lastKnownCode = next;
2898
2946
  editor?.setCode(next);
2947
+ void nextTick(syncScrollFades);
2899
2948
  }
2900
2949
  );
2901
2950
  watch(
@@ -2920,6 +2969,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2920
2969
  onBeforeUnmount(() => {
2921
2970
  destroyed = true;
2922
2971
  clearTimeout(copyTimer);
2972
+ scrollTarget?.removeEventListener("scroll", syncScrollFades);
2973
+ scrollObserver?.disconnect();
2974
+ scrollTarget = void 0;
2923
2975
  editor?.destroy();
2924
2976
  editor = void 0;
2925
2977
  });
@@ -2955,7 +3007,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2955
3007
  ref_key: "rootRef",
2956
3008
  ref: rootRef,
2957
3009
  class: normalizeClass([
2958
- "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",
2959
3011
  isReady.value && "ck-code-editor--ready",
2960
3012
  isLocked.value && "ck-code-editor--readonly",
2961
3013
  __props.disabled && "ck-code-editor--disabled"
@@ -2981,17 +3033,22 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2981
3033
  _: 1
2982
3034
  }, 8, ["aria-label"])) : createCommentVNode("", true)
2983
3035
  ])) : createCommentVNode("", true),
2984
- createElementVNode("div", {
2985
- ref_key: "hostRef",
2986
- ref: hostRef,
2987
- class: "ck-code-editor__host",
2988
- style: normalizeStyle(__props.maxHeight ? { "--ck-code-max-height": __props.maxHeight } : void 0)
2989
- }, 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))
2990
3047
  ], 42, _hoisted_1$1);
2991
3048
  };
2992
3049
  }
2993
3050
  });
2994
- const CkCodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-c1539a6f"]]);
3051
+ const CkCodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-75f52b7e"]]);
2995
3052
  const _hoisted_1 = {
2996
3053
  key: 1,
2997
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-c1539a6f] .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-c1539a6f] .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-c1539a6f] .cm-activeLine,
185
- .ck-code-editor--readonly .ck-code-editor__host[data-v-c1539a6f] .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-c1539a6f] {
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
 
@@ -19273,7 +19273,7 @@ function legacy(parser) {
19273
19273
  return new LanguageSupport(StreamLanguage.define(parser));
19274
19274
  }
19275
19275
  function sql(dialectName) {
19276
- return import("./index-GpSpJ3ti.js").then((m) => m.sql({ dialect: m[dialectName] }));
19276
+ return import("./index-DZGfsazg.js").then((m) => m.sql({ dialect: m[dialectName] }));
19277
19277
  }
19278
19278
  const languages = [
19279
19279
  // New-style language modes
@@ -19281,7 +19281,7 @@ const languages = [
19281
19281
  name: "C",
19282
19282
  extensions: ["c", "h", "ino"],
19283
19283
  load() {
19284
- return import("./index-CWp_t8Wl.js").then((m) => m.cpp());
19284
+ return import("./index-B4uqe-fL.js").then((m) => m.cpp());
19285
19285
  }
19286
19286
  }),
19287
19287
  /* @__PURE__ */ LanguageDescription.of({
@@ -19289,7 +19289,7 @@ const languages = [
19289
19289
  alias: ["cpp"],
19290
19290
  extensions: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"],
19291
19291
  load() {
19292
- return import("./index-CWp_t8Wl.js").then((m) => m.cpp());
19292
+ return import("./index-B4uqe-fL.js").then((m) => m.cpp());
19293
19293
  }
19294
19294
  }),
19295
19295
  /* @__PURE__ */ LanguageDescription.of({
@@ -19304,14 +19304,14 @@ const languages = [
19304
19304
  name: "CSS",
19305
19305
  extensions: ["css"],
19306
19306
  load() {
19307
- return import("./index-DfLCrnVq.js").then((m) => m.css());
19307
+ return import("./index-CefLTKmi.js").then((m) => m.css());
19308
19308
  }
19309
19309
  }),
19310
19310
  /* @__PURE__ */ LanguageDescription.of({
19311
19311
  name: "Go",
19312
19312
  extensions: ["go"],
19313
19313
  load() {
19314
- return import("./index-g2X42srv.js").then((m) => m.go());
19314
+ return import("./index-Bw39pbRL.js").then((m) => m.go());
19315
19315
  }
19316
19316
  }),
19317
19317
  /* @__PURE__ */ LanguageDescription.of({
@@ -19319,14 +19319,14 @@ const languages = [
19319
19319
  alias: ["xhtml"],
19320
19320
  extensions: ["html", "htm", "handlebars", "hbs"],
19321
19321
  load() {
19322
- return import("./index-BqWO6mvz.js").then((m) => m.html());
19322
+ return import("./index-ptbBQ53d.js").then((m) => m.html());
19323
19323
  }
19324
19324
  }),
19325
19325
  /* @__PURE__ */ LanguageDescription.of({
19326
19326
  name: "Java",
19327
19327
  extensions: ["java"],
19328
19328
  load() {
19329
- return import("./index-hEJ_Bavx.js").then((m) => m.java());
19329
+ return import("./index-Bfo4U-Al.js").then((m) => m.java());
19330
19330
  }
19331
19331
  }),
19332
19332
  /* @__PURE__ */ LanguageDescription.of({
@@ -19334,14 +19334,14 @@ const languages = [
19334
19334
  alias: ["ecmascript", "js", "node"],
19335
19335
  extensions: ["js", "mjs", "cjs"],
19336
19336
  load() {
19337
- return import("./index-BlIc9r0r.js").then((m) => m.javascript());
19337
+ return import("./index-Cx5ThXzs.js").then((m) => m.javascript());
19338
19338
  }
19339
19339
  }),
19340
19340
  /* @__PURE__ */ LanguageDescription.of({
19341
19341
  name: "Jinja",
19342
19342
  extensions: ["j2", "jinja", "jinja2"],
19343
19343
  load() {
19344
- return import("./index-DLjsqQHx.js").then((m) => m.jinja());
19344
+ return import("./index--Yonjzfi.js").then((m) => m.jinja());
19345
19345
  }
19346
19346
  }),
19347
19347
  /* @__PURE__ */ LanguageDescription.of({
@@ -19349,28 +19349,28 @@ const languages = [
19349
19349
  alias: ["json5"],
19350
19350
  extensions: ["json", "map"],
19351
19351
  load() {
19352
- return import("./index-Db5-PJG-.js").then((m) => m.json());
19352
+ return import("./index-Hro6EPZS.js").then((m) => m.json());
19353
19353
  }
19354
19354
  }),
19355
19355
  /* @__PURE__ */ LanguageDescription.of({
19356
19356
  name: "JSX",
19357
19357
  extensions: ["jsx"],
19358
19358
  load() {
19359
- return import("./index-BlIc9r0r.js").then((m) => m.javascript({ jsx: true }));
19359
+ return import("./index-Cx5ThXzs.js").then((m) => m.javascript({ jsx: true }));
19360
19360
  }
19361
19361
  }),
19362
19362
  /* @__PURE__ */ LanguageDescription.of({
19363
19363
  name: "LESS",
19364
19364
  extensions: ["less"],
19365
19365
  load() {
19366
- return import("./index-XZeturb3.js").then((m) => m.less());
19366
+ return import("./index-TemHfU1M.js").then((m) => m.less());
19367
19367
  }
19368
19368
  }),
19369
19369
  /* @__PURE__ */ LanguageDescription.of({
19370
19370
  name: "Liquid",
19371
19371
  extensions: ["liquid"],
19372
19372
  load() {
19373
- return import("./index-S4ylc8JK.js").then((m) => m.liquid());
19373
+ return import("./index-oO_X5wU0.js").then((m) => m.liquid());
19374
19374
  }
19375
19375
  }),
19376
19376
  /* @__PURE__ */ LanguageDescription.of({
@@ -19383,7 +19383,7 @@ const languages = [
19383
19383
  name: "Markdown",
19384
19384
  extensions: ["md", "markdown", "mkd"],
19385
19385
  load() {
19386
- return import("./index-hbS5PDHj.js").then((m) => m.markdown());
19386
+ return import("./index-DTomeh-p.js").then((m) => m.markdown());
19387
19387
  }
19388
19388
  }),
19389
19389
  /* @__PURE__ */ LanguageDescription.of({
@@ -19402,7 +19402,7 @@ const languages = [
19402
19402
  name: "PHP",
19403
19403
  extensions: ["php", "php3", "php4", "php5", "php7", "phtml"],
19404
19404
  load() {
19405
- return import("./index-CR2kGrpY.js").then((m) => m.php());
19405
+ return import("./index-CeaT_FBl.js").then((m) => m.php());
19406
19406
  }
19407
19407
  }),
19408
19408
  /* @__PURE__ */ LanguageDescription.of({
@@ -19423,28 +19423,28 @@ const languages = [
19423
19423
  extensions: ["BUILD", "bzl", "py", "pyw"],
19424
19424
  filename: /^(BUCK|BUILD)$/,
19425
19425
  load() {
19426
- return import("./index-Dbi75pKH.js").then((m) => m.python());
19426
+ return import("./index-CZmdzLaU.js").then((m) => m.python());
19427
19427
  }
19428
19428
  }),
19429
19429
  /* @__PURE__ */ LanguageDescription.of({
19430
19430
  name: "Rust",
19431
19431
  extensions: ["rs"],
19432
19432
  load() {
19433
- return import("./index-CFGO7LRz.js").then((m) => m.rust());
19433
+ return import("./index-GDUM7K5V.js").then((m) => m.rust());
19434
19434
  }
19435
19435
  }),
19436
19436
  /* @__PURE__ */ LanguageDescription.of({
19437
19437
  name: "Sass",
19438
19438
  extensions: ["sass"],
19439
19439
  load() {
19440
- return import("./index-ABUMl7H3.js").then((m) => m.sass({ indented: true }));
19440
+ return import("./index-DqUiBDRo.js").then((m) => m.sass({ indented: true }));
19441
19441
  }
19442
19442
  }),
19443
19443
  /* @__PURE__ */ LanguageDescription.of({
19444
19444
  name: "SCSS",
19445
19445
  extensions: ["scss"],
19446
19446
  load() {
19447
- return import("./index-ABUMl7H3.js").then((m) => m.sass());
19447
+ return import("./index-DqUiBDRo.js").then((m) => m.sass());
19448
19448
  }
19449
19449
  }),
19450
19450
  /* @__PURE__ */ LanguageDescription.of({
@@ -19464,7 +19464,7 @@ const languages = [
19464
19464
  name: "TSX",
19465
19465
  extensions: ["tsx"],
19466
19466
  load() {
19467
- return import("./index-BlIc9r0r.js").then((m) => m.javascript({ jsx: true, typescript: true }));
19467
+ return import("./index-Cx5ThXzs.js").then((m) => m.javascript({ jsx: true, typescript: true }));
19468
19468
  }
19469
19469
  }),
19470
19470
  /* @__PURE__ */ LanguageDescription.of({
@@ -19472,14 +19472,14 @@ const languages = [
19472
19472
  alias: ["ts"],
19473
19473
  extensions: ["ts", "mts", "cts"],
19474
19474
  load() {
19475
- return import("./index-BlIc9r0r.js").then((m) => m.javascript({ typescript: true }));
19475
+ return import("./index-Cx5ThXzs.js").then((m) => m.javascript({ typescript: true }));
19476
19476
  }
19477
19477
  }),
19478
19478
  /* @__PURE__ */ LanguageDescription.of({
19479
19479
  name: "WebAssembly",
19480
19480
  extensions: ["wat", "wast"],
19481
19481
  load() {
19482
- return import("./index-QAs789O5.js").then((m) => m.wast());
19482
+ return import("./index-DlLnTKv3.js").then((m) => m.wast());
19483
19483
  }
19484
19484
  }),
19485
19485
  /* @__PURE__ */ LanguageDescription.of({
@@ -19487,7 +19487,7 @@ const languages = [
19487
19487
  alias: ["rss", "wsdl", "xsd"],
19488
19488
  extensions: ["xml", "xsl", "xsd", "svg"],
19489
19489
  load() {
19490
- return import("./index-D0IZW-Up.js").then((m) => m.xml());
19490
+ return import("./index-CrBanggA.js").then((m) => m.xml());
19491
19491
  }
19492
19492
  }),
19493
19493
  /* @__PURE__ */ LanguageDescription.of({
@@ -19495,7 +19495,7 @@ const languages = [
19495
19495
  alias: ["yml"],
19496
19496
  extensions: ["yaml", "yml"],
19497
19497
  load() {
19498
- return import("./index-DPgw0Cf_.js").then((m) => m.yaml());
19498
+ return import("./index-DH9e_hqJ.js").then((m) => m.yaml());
19499
19499
  }
19500
19500
  }),
19501
19501
  // Legacy modes ported from CodeMirror 5
@@ -20284,13 +20284,13 @@ const languages = [
20284
20284
  name: "Vue",
20285
20285
  extensions: ["vue"],
20286
20286
  load() {
20287
- return import("./index-CIF4qQzR.js").then((m) => m.vue());
20287
+ return import("./index-CGEgwupi.js").then((m) => m.vue());
20288
20288
  }
20289
20289
  }),
20290
20290
  /* @__PURE__ */ LanguageDescription.of({
20291
20291
  name: "Angular Template",
20292
20292
  load() {
20293
- return import("./index-DKwEe_Tu.js").then((m) => m.angular());
20293
+ return import("./index-g_Bs6dNr.js").then((m) => m.angular());
20294
20294
  }
20295
20295
  })
20296
20296
  ];
@@ -21398,12 +21398,22 @@ const ckHighlightStyle = HighlightStyle.define([
21398
21398
  tags.definitionKeyword,
21399
21399
  tags.moduleKeyword,
21400
21400
  tags.operatorKeyword,
21401
- tags.operator
21401
+ tags.operator,
21402
+ // CSS units (`px`, `rem`) are `keyword.other.unit` to a TextMate grammar.
21403
+ tags.unit
21402
21404
  ],
21403
21405
  color: cssVar("keyword")
21404
21406
  },
21405
21407
  {
21406
- tag: [tags.string, tags.special(tags.string), tags.regexp, tags.escape, tags.character],
21408
+ tag: [
21409
+ tags.string,
21410
+ tags.special(tags.string),
21411
+ tags.regexp,
21412
+ tags.escape,
21413
+ tags.character,
21414
+ // `class="card"` — the quoted value is a string, not a constant.
21415
+ tags.attributeValue
21416
+ ],
21407
21417
  color: cssVar("string")
21408
21418
  },
21409
21419
  {
@@ -21419,7 +21429,8 @@ const ckHighlightStyle = HighlightStyle.define([
21419
21429
  tags.definition(tags.typeName),
21420
21430
  tags.className,
21421
21431
  tags.namespace,
21422
- tags.self
21432
+ // `entity.other.attribute-name`, which GitHub colours like any entity.
21433
+ tags.attributeName
21423
21434
  ],
21424
21435
  color: cssVar("function")
21425
21436
  },
@@ -21436,19 +21447,35 @@ const ckHighlightStyle = HighlightStyle.define([
21436
21447
  tags.typeName,
21437
21448
  tags.standard(tags.typeName),
21438
21449
  tags.propertyName,
21439
- tags.attributeName,
21440
- tags.attributeValue
21450
+ // `this` / `self` are `variable.language`, which GitHub paints blue.
21451
+ tags.self,
21452
+ // CSS colour literals (`#ff0066`), `constant.other.color-*`.
21453
+ tags.color,
21454
+ // Bare identifiers a grammar cannot classify further — SQL column and
21455
+ // table names, for one. Every more specific name tag has its own rule
21456
+ // above, so this only catches what would otherwise be unstyled.
21457
+ tags.name
21441
21458
  ],
21442
21459
  color: cssVar("constant")
21443
21460
  },
21444
21461
  // A declared property name, which UiCodeBlock renders in the text token.
21445
21462
  { tag: tags.definition(tags.propertyName), color: cssVar("property") },
21446
- { tag: [tags.tagName, tags.angleBracket], color: cssVar("tag") },
21463
+ { tag: tags.tagName, color: cssVar("tag") },
21464
+ // Markdown blockquotes are `markup.quote`, the same green as a tag name.
21465
+ { tag: tags.quote, color: cssVar("tag") },
21447
21466
  {
21448
- tag: [tags.variableName, tags.punctuation, tags.bracket, tags.separator],
21467
+ tag: [
21468
+ tags.variableName,
21469
+ tags.punctuation,
21470
+ tags.bracket,
21471
+ tags.separator,
21472
+ // `<`, `>` and `</` are plain text in the GitHub themes; only the tag
21473
+ // name inside them is green.
21474
+ tags.angleBracket
21475
+ ],
21449
21476
  color: cssVar("foreground")
21450
21477
  },
21451
- { tag: tags.heading, fontWeight: "bold" },
21478
+ { tag: tags.heading, color: cssVar("constant"), fontWeight: "bold" },
21452
21479
  { tag: tags.strong, fontWeight: "bold" },
21453
21480
  { tag: tags.emphasis, fontStyle: "italic" },
21454
21481
  { tag: tags.link, textDecoration: "underline" },
@@ -21478,7 +21505,16 @@ const ckCodeMirrorTheme = [
21478
21505
  ".cm-gutters": {
21479
21506
  backgroundColor: "transparent",
21480
21507
  borderRight: "none",
21481
- color: cssVar("comment")
21508
+ color: cssVar("line-number")
21509
+ },
21510
+ // `UiCodeBlock` draws its numbers as a 2rem right-aligned column inside the
21511
+ // block's 1rem padding, with a 1rem gap before the code. CodeMirror puts
21512
+ // the gutter outside `.cm-content`, so the same geometry is expressed as
21513
+ // padding on the number cell.
21514
+ ".cm-lineNumbers .cm-gutterElement": {
21515
+ minWidth: "4rem",
21516
+ padding: "0 1rem",
21517
+ textAlign: "right"
21482
21518
  },
21483
21519
  ".cm-activeLineGutter": {
21484
21520
  backgroundColor: "transparent"
@@ -31,7 +31,8 @@ export declare const Readonly: Story;
31
31
  export declare const WithoutHeader: Story;
32
32
  /**
33
33
  * `maxHeight` caps the scrollable area and `lineWrapping` folds long lines
34
- * instead of scrolling sideways.
34
+ * instead of scrolling sideways. Scroll it: the code fades at whichever edge
35
+ * has more of the document beyond it, and neither edge fades once you reach it.
35
36
  */
36
37
  export declare const ScrollingAndWrapping: Story;
37
38
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"CkCodeEditor.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCodeEditor/CkCodeEditor.stories.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,YAAY,MAAM,oBAAoB,CAAC;AA6B9C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CA+CnC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAgKnC;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KAWrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,KAW1B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,KAevB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,KAOtB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,KAO3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAsBlC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,KAgBxB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAwBhC,CAAC"}
1
+ {"version":3,"file":"CkCodeEditor.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCodeEditor/CkCodeEditor.stories.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,YAAY,MAAM,oBAAoB,CAAC;AA6B9C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAgDnC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAgKnC;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KAWrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,KAW1B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,KAevB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,KAOtB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,KAO3B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAsBlC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,KAgBxB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAwBhC,CAAC"}
@@ -33,6 +33,7 @@ declare const __VLS_export: import("vue").DefineComponent<CkCodeEditorProps, {
33
33
  showCopyButton: boolean;
34
34
  lineWrapping: boolean;
35
35
  maxHeight: string;
36
+ scrollFade: boolean;
36
37
  badge: import("./badgeDecoration").CkCodeEditorBadgeRule;
37
38
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
38
39
  declare const _default: typeof __VLS_export;