@aleph-alpha/chat-kit 6.3.0 → 6.4.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 (47) hide show
  1. package/dist/{CkHistory.vue_vue_type_script_setup_true_lang-gV-lp0ZB.js → CkHistory.vue_vue_type_script_setup_true_lang-B0WUzTHa.js} +11 -5
  2. package/dist/chat-kit.css +5 -5
  3. package/dist/{code-palette-DAJUTnR-.js → code-palette-DH_G7mZ5.js} +111 -110
  4. package/dist/components/base/CkCodeEditor/CkCodeEditor.stories.d.ts +6 -0
  5. package/dist/components/base/CkCodeEditor/CkCodeEditor.stories.d.ts.map +1 -1
  6. package/dist/components/base/CkCodeEditor/CkCodeEditor.vue.d.ts +1 -0
  7. package/dist/components/base/CkCodeEditor/CkCodeEditor.vue.d.ts.map +1 -1
  8. package/dist/components/base/CkCodeEditor/badgeDecoration.d.ts +47 -0
  9. package/dist/components/base/CkCodeEditor/badgeDecoration.d.ts.map +1 -0
  10. package/dist/components/base/CkCodeEditor/createCodeMirror.d.ts +4 -0
  11. package/dist/components/base/CkCodeEditor/createCodeMirror.d.ts.map +1 -1
  12. package/dist/components/base/CkCodeEditor/types.d.ts +20 -0
  13. package/dist/components/base/CkCodeEditor/types.d.ts.map +1 -1
  14. package/dist/components/index.js +1 -1
  15. package/dist/{createCodeMirror-BkV6FEPn.js → createCodeMirror-5iswYetS.js} +70 -2
  16. package/dist/{createCrepeEditor-Ci5FHHIV.js → createCrepeEditor-C-AQ1w_e.js} +2 -2
  17. package/dist/{index-Cxs6kPho.js → index-ABUMl7H3.js} +3 -3
  18. package/dist/{index-DufAP1JF.js → index-BlIc9r0r.js} +3 -3
  19. package/dist/{index-DxTzaHLr.js → index-BqWO6mvz.js} +4 -4
  20. package/dist/{index-DhwsowEf.js → index-CFGO7LRz.js} +2 -2
  21. package/dist/{index-D6ftdiLa.js → index-CG8e3146.js} +1 -1
  22. package/dist/{index-Dl24CCB3.js → index-CIF4qQzR.js} +4 -4
  23. package/dist/{index-DgCcFC3N.js → index-CR2kGrpY.js} +3 -3
  24. package/dist/{index-BoUJGvvQ.js → index-CWp_t8Wl.js} +2 -2
  25. package/dist/{index-BUCqcTPA.js → index-D0IZW-Up.js} +2 -2
  26. package/dist/{index-CYk7AB8M.js → index-DKwEe_Tu.js} +4 -4
  27. package/dist/{index-w2yzH7vs.js → index-DLjsqQHx.js} +3 -3
  28. package/dist/{index-DqGDenO9.js → index-DPgw0Cf_.js} +2 -2
  29. package/dist/{index-CB6xZVsf.js → index-Db5-PJG-.js} +2 -2
  30. package/dist/{index-MfXW4ZyN.js → index-Dbi75pKH.js} +3 -3
  31. package/dist/{index-BhvbqYsK.js → index-DfLCrnVq.js} +2 -2
  32. package/dist/{index-ZHg2R9iD.js → index-GpSpJ3ti.js} +3 -3
  33. package/dist/{index-CN8d3yl1.js → index-Mh3WUU-6.js} +1 -1
  34. package/dist/{index-BLVAx_f8.js → index-QAs789O5.js} +2 -2
  35. package/dist/{index-B2tew8uf.js → index-S4ylc8JK.js} +3 -3
  36. package/dist/{index-CIF93PZF.js → index-XZeturb3.js} +3 -3
  37. package/dist/{index-BtY1uxn6.js → index-g2X42srv.js} +3 -3
  38. package/dist/{index-gYt3E3Cp.js → index-hEJ_Bavx.js} +2 -2
  39. package/dist/{index-BvG6l44n.js → index-hbS5PDHj.js} +3 -3
  40. package/dist/index.js +1 -1
  41. package/package.json +3 -3
  42. package/src/components/base/CkCodeEditor/CkCodeEditor.spec.ts +61 -0
  43. package/src/components/base/CkCodeEditor/CkCodeEditor.stories.ts +94 -0
  44. package/src/components/base/CkCodeEditor/CkCodeEditor.vue +8 -2
  45. package/src/components/base/CkCodeEditor/badgeDecoration.ts +173 -0
  46. package/src/components/base/CkCodeEditor/createCodeMirror.ts +9 -0
  47. package/src/components/base/CkCodeEditor/types.ts +26 -0
@@ -1,4 +1,4 @@
1
- import { _, a, b, c, C, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, D } from "../CkHistory.vue_vue_type_script_setup_true_lang-gV-lp0ZB.js";
1
+ import { _, a, b, c, C, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, D } from "../CkHistory.vue_vue_type_script_setup_true_lang-B0WUzTHa.js";
2
2
  export {
3
3
  _ as CkAgentMessage,
4
4
  a as CkAgentMessageHeader,
@@ -1,4 +1,67 @@
1
- import { E as EditorView, a as EditorState, C as Compartment, l as lineNumbers, b as languages, c as ckCodeMirrorTheme, h as history, d as drawSelection, e as highlightSpecialChars, f as highlightActiveLine, g as bracketMatching, i as indentOnInput, j as indentUnit, k as keymap, m as defaultKeymap, n as historyKeymap, o as indentWithTab, p as placeholder } from "./code-palette-DAJUTnR-.js";
1
+ import { J as MatchDecorator, D as Decoration, V as ViewPlugin, E as EditorView, W as WidgetType, K as EditorState, O as Compartment, Q as lineNumbers, U as languages, X as ckCodeMirrorTheme, Y as history, Z as drawSelection, _ as highlightSpecialChars, $ as highlightActiveLine, a0 as bracketMatching, a1 as indentOnInput, k as indentUnit, m as keymap, a2 as defaultKeymap, a3 as historyKeymap, a4 as indentWithTab, a5 as placeholder } from "./code-palette-DH_G7mZ5.js";
2
+ import { p as purify } from "./katex.min-md74IFlY.js";
3
+ const DEFAULT_BADGE_CLASS = "ck-code-badge inline-flex w-fit shrink-0 select-none items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-md border border-border-surface-default bg-background-button-secondary-button text-content-on-surface-primary px-2 py-0.5 label-12-regular align-middle";
4
+ class BadgeWidget extends WidgetType {
5
+ constructor(content) {
6
+ super();
7
+ this.content = content;
8
+ }
9
+ // Decorations are rebuilt on every document and viewport change. Without a
10
+ // real comparison here every pill would be torn down and recreated on each
11
+ // keystroke, which flickers and drops any focus inside the widget.
12
+ eq(other) {
13
+ return other.content.label === this.content.label && other.content.icon === this.content.icon && other.content.title === this.content.title && other.content.class === this.content.class;
14
+ }
15
+ toDOM() {
16
+ const el = document.createElement("span");
17
+ el.className = this.content.class ?? DEFAULT_BADGE_CLASS;
18
+ if (this.content.title) el.title = this.content.title;
19
+ if (this.content.icon) {
20
+ const icon = document.createElement("span");
21
+ icon.className = "ck-code-badge__icon inline-flex shrink-0";
22
+ icon.innerHTML = purify.sanitize(this.content.icon, {
23
+ USE_PROFILES: { svg: true, svgFilters: true }
24
+ });
25
+ el.append(icon);
26
+ }
27
+ el.append(document.createTextNode(this.content.label));
28
+ return el;
29
+ }
30
+ /** The pill is decorative; let the editor handle every event over it. */
31
+ ignoreEvent() {
32
+ return false;
33
+ }
34
+ }
35
+ function toGlobal(pattern) {
36
+ const flags = pattern.flags.includes("g") ? pattern.flags : `${pattern.flags}g`;
37
+ return new RegExp(pattern.source, flags);
38
+ }
39
+ function badgeExtension(rule) {
40
+ const matcher = new MatchDecorator({
41
+ regexp: toGlobal(rule.pattern),
42
+ decoration: (match) => {
43
+ const content = rule.render(match);
44
+ return content ? Decoration.replace({ widget: new BadgeWidget(content) }) : null;
45
+ }
46
+ });
47
+ return ViewPlugin.fromClass(
48
+ class {
49
+ badges;
50
+ constructor(view) {
51
+ this.badges = matcher.createDeco(view);
52
+ }
53
+ update(update) {
54
+ this.badges = matcher.updateDeco(update, this.badges);
55
+ }
56
+ },
57
+ {
58
+ decorations: (plugin) => plugin.badges,
59
+ provide: (plugin) => EditorView.atomicRanges.of(
60
+ (view) => view.plugin(plugin)?.badges ?? Decoration.none
61
+ )
62
+ }
63
+ );
64
+ }
2
65
  const PLAIN_ALIASES = /* @__PURE__ */ new Set(["text", "txt", "plain", "plaintext", ""]);
3
66
  async function resolveLanguage(language) {
4
67
  const id = language.trim().toLowerCase();
@@ -50,6 +113,7 @@ async function createCodeMirror(options) {
50
113
  const readonlySlot = new Compartment();
51
114
  const lineNumbersSlot = new Compartment();
52
115
  const wrappingSlot = new Compartment();
116
+ const badgeSlot = new Compartment();
53
117
  const support = await resolveLanguage(options.language);
54
118
  const view = new EditorView({
55
119
  parent: options.parent,
@@ -60,7 +124,8 @@ async function createCodeMirror(options) {
60
124
  languageSlot.of(support ? [support] : []),
61
125
  readonlySlot.of(readonlyState(options.readonly)),
62
126
  lineNumbersSlot.of(options.showLineNumbers ? lineNumbers() : []),
63
- wrappingSlot.of(options.lineWrapping ? EditorView.lineWrapping : [])
127
+ wrappingSlot.of(options.lineWrapping ? EditorView.lineWrapping : []),
128
+ badgeSlot.of(options.badge ? badgeExtension(options.badge) : [])
64
129
  ]
65
130
  })
66
131
  });
@@ -91,6 +156,9 @@ async function createCodeMirror(options) {
91
156
  setLineWrapping: (wrap) => {
92
157
  reconfigure(wrappingSlot, wrap ? EditorView.lineWrapping : []);
93
158
  },
159
+ setBadge: (rule) => {
160
+ reconfigure(badgeSlot, rule ? badgeExtension(rule) : []);
161
+ },
94
162
  focus: () => view.focus(),
95
163
  destroy: () => view.destroy()
96
164
  };
@@ -6,10 +6,10 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
6
6
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
7
7
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
8
8
  var _marks, _hasText, _maybeMerge, _matchTarget, _runNode, _closeNodeAndPush, _addNodeAndPush, _a, _b, _openMarks, _matchTarget2, _runProseNode, _runProseMark, _orderMarks, _closeEndedMarks, _runNode2, _maybeMergeChildren, _createMarkdownNode, _moveSpaces, _closeNodeAndPush2, _addNodeAndPush2, _openMark, _closeMark, _c;
9
- import { ah as syntaxHighlighting, E as EditorView$1, ai as HighlightStyle, v as tags, aj as keyName, ak as base, C as Compartment, a as EditorState$1, d as drawSelection, k as keymap$4, S as StateEffect, al as getPanel, x as EditorSelection, am as getDialog, an as showDialog, V as ViewPlugin, G as Decoration$1, H as StateField, ao as showPanel, P as Prec, D as codePointAt, I as codePointSize, N as Facet, O as combineConfig, Z as CharCategory, ap as RangeSetBuilder, Q as fromCodePoint, aq as crelt, ar as runScopeHandlers, as as findClusterBreak, at as activateHover, au as hoverTooltip, W as WidgetType$1, l as lineNumbers, av as highlightActiveLineGutter, e as highlightSpecialChars, h as history$2, aw as foldGutter, ax as dropCursor, i as indentOnInput, ay as defaultHighlightStyle, g as bracketMatching, az as rectangularSelection, aA as crosshairCursor, f as highlightActiveLine, m as defaultKeymap, n as historyKeymap$1, aB as foldKeymap, b as languages, o as indentWithTab, c as ckCodeMirrorTheme } from "./code-palette-DAJUTnR-.js";
9
+ import { ai as syntaxHighlighting, E as EditorView$1, aj as HighlightStyle, t as tags, ak as keyName, al as base, O as Compartment, K as EditorState$1, Z as drawSelection, m as keymap$4, S as StateEffect, am as getPanel, d as EditorSelection, an as getDialog, ao as showDialog, V as ViewPlugin, D as Decoration$1, l as StateField, ap as showPanel, P as Prec, j as codePointAt, n as codePointSize, F as Facet, u as combineConfig, C as CharCategory, aq as RangeSetBuilder, v as fromCodePoint, ar as crelt, as as runScopeHandlers, at as findClusterBreak, au as activateHover, av as hoverTooltip, W as WidgetType$1, Q as lineNumbers, aw as highlightActiveLineGutter, _ as highlightSpecialChars, Y as history$2, ax as foldGutter, ay as dropCursor, a1 as indentOnInput, az as defaultHighlightStyle, a0 as bracketMatching, aA as rectangularSelection, aB as crosshairCursor, $ as highlightActiveLine, a2 as defaultKeymap, a3 as historyKeymap$1, aC as foldKeymap, U as languages, a4 as indentWithTab, X as ckCodeMirrorTheme } from "./code-palette-DH_G7mZ5.js";
10
10
  import { p as purify } from "./katex.min-md74IFlY.js";
11
11
  import { h, defineComponent, ref, Fragment as Fragment$1, createApp, watchEffect, watch, computed, onMounted, onUnmounted, shallowRef, nextTick } from "vue";
12
- import { a as closeBrackets, b as autocompletion, d as closeBracketsKeymap, e as completionKeymap } from "./index-D6ftdiLa.js";
12
+ import { a as closeBrackets, b as autocompletion, d as closeBracketsKeymap, e as completionKeymap } from "./index-CG8e3146.js";
13
13
  import { h as formatCodeAsIndented, i as formatHeadingAsSetext, j as decodeString, k as encodeCharacterReference, p as patternInScope, n as handle, u as unified, r as remarkParse, v as visit, S as SKIP, d as visitParents, a as remarkGfm } from "./index-CLdXUpL8.js";
14
14
  import { z as zwitch, c as remarkMath, d as defaultChatKitLabels } from "./useChatKitLabels-CatQSpfL.js";
15
15
  const own = {}.hasOwnProperty;
@@ -1,6 +1,6 @@
1
- import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from "./index-CN8d3yl1.js";
2
- import { u as styleTags, v as tags, q as LanguageSupport, L as LRLanguage, t as foldNodeProp, A as foldInside, r as indentNodeProp, s as continuedIndent } from "./code-palette-DAJUTnR-.js";
3
- import { defineCSSCompletionSource } from "./index-BhvbqYsK.js";
1
+ import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from "./index-Mh3WUU-6.js";
2
+ import { s as styleTags, t as tags, a as LanguageSupport, L as LRLanguage, f as foldNodeProp, g as foldInside, i as indentNodeProp, c as continuedIndent } from "./code-palette-DH_G7mZ5.js";
3
+ import { defineCSSCompletionSource } from "./index-DfLCrnVq.js";
4
4
  const indent = 168, dedent = 169, descendantOp = 170, InterpolationEnd = 1, InterpolationContinue = 2, Unit = 3, callee = 171, identifier = 172, VariableName = 4, queryIdentifier = 173, InterpolationStart = 5, newline = 174, blankLineStart = 175, eof = 176, whitespace = 177, LineComment = 6, Comment = 7, IndentedMixin = 8, IndentedInclude = 9, Dialect_indented = 0;
5
5
  const space = [
6
6
  9,
@@ -1,6 +1,6 @@
1
- import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup, C as ContextTracker } from "./index-CN8d3yl1.js";
2
- import { u as styleTags, v as tags, E as EditorView, w as syntaxTree, x as EditorSelection, q as LanguageSupport, L as LRLanguage, r as indentNodeProp, a5 as flatIndent, s as continuedIndent, z as delimitedIndent, t as foldNodeProp, A as foldInside, ag as sublanguageProp, ab as defineLanguageFacet, a6 as NodeWeakMap, a4 as IterMode } from "./code-palette-DAJUTnR-.js";
3
- import { i as ifNotIn, c as completeFromList, s as snippetCompletion } from "./index-D6ftdiLa.js";
1
+ import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup, C as ContextTracker } from "./index-Mh3WUU-6.js";
2
+ import { s as styleTags, t as tags, E as EditorView, b as syntaxTree, d as EditorSelection, a as LanguageSupport, L as LRLanguage, i as indentNodeProp, a6 as flatIndent, c as continuedIndent, e as delimitedIndent, f as foldNodeProp, g as foldInside, ah as sublanguageProp, ac as defineLanguageFacet, a7 as NodeWeakMap, I as IterMode } from "./code-palette-DH_G7mZ5.js";
3
+ import { i as ifNotIn, c as completeFromList, s as snippetCompletion } from "./index-CG8e3146.js";
4
4
  const noSemi = 316, noSemiType = 317, incdec = 1, incdecPrefix = 2, questionDot = 3, JSXStartTag = 4, insertSemi = 318, spaces = 320, newline = 321, LineComment = 5, BlockComment = 6, Dialect_jsx = 0;
5
5
  const space = [
6
6
  9,
@@ -1,7 +1,7 @@
1
- import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from "./index-CN8d3yl1.js";
2
- import { y as parseMixed, u as styleTags, v as tags, E as EditorView, w as syntaxTree, x as EditorSelection, q as LanguageSupport, L as LRLanguage, r as indentNodeProp, t as foldNodeProp, af as bracketMatchingHandle } from "./code-palette-DAJUTnR-.js";
3
- import { cssLanguage, css } from "./index-BhvbqYsK.js";
4
- import { typescriptLanguage, jsxLanguage, tsxLanguage, javascriptLanguage, javascript } from "./index-DufAP1JF.js";
1
+ import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from "./index-Mh3WUU-6.js";
2
+ import { p as parseMixed, s as styleTags, t as tags, E as EditorView, b as syntaxTree, d as EditorSelection, a as LanguageSupport, L as LRLanguage, i as indentNodeProp, f as foldNodeProp, ag as bracketMatchingHandle } from "./code-palette-DH_G7mZ5.js";
3
+ import { cssLanguage, css } from "./index-DfLCrnVq.js";
4
+ import { typescriptLanguage, jsxLanguage, tsxLanguage, javascriptLanguage, javascript } from "./index-BlIc9r0r.js";
5
5
  const scriptText = 55, StartCloseScriptTag = 1, styleText = 56, StartCloseStyleTag = 2, textareaText = 57, StartCloseTextareaTag = 3, EndTag = 4, SelfClosingEndTag = 5, StartTag = 6, StartScriptTag = 7, StartStyleTag = 8, StartTextareaTag = 9, StartSelfClosingTag = 10, StartCloseTag = 11, NoMatchStartCloseTag = 12, MismatchedStartCloseTag = 13, missingCloseTag = 58, IncompleteTag = 14, IncompleteCloseTag = 15, commentContent$1 = 59, Element = 21, TagName = 23, Attribute = 24, AttributeName = 25, AttributeValue = 27, UnquotedAttributeValue = 28, ScriptText = 29, StyleText = 32, TextareaText = 35, OpenTag = 37, CloseTag = 38, Dialect_noMatch = 0, Dialect_selfClosing = 1;
6
6
  const selfClosers$1 = {
7
7
  area: true,
@@ -1,5 +1,5 @@
1
- import { L as LRParser, E as ExternalTokenizer } from "./index-CN8d3yl1.js";
2
- import { u as styleTags, v as tags, q as LanguageSupport, L as LRLanguage, r as indentNodeProp, s as continuedIndent, t as foldNodeProp, A as foldInside } from "./code-palette-DAJUTnR-.js";
1
+ import { L as LRParser, E as ExternalTokenizer } from "./index-Mh3WUU-6.js";
2
+ import { s as styleTags, t as tags, a as LanguageSupport, L as LRLanguage, i as indentNodeProp, c as continuedIndent, f as foldNodeProp, g as foldInside } from "./code-palette-DH_G7mZ5.js";
3
3
  const closureParamDelim = 1, tpOpen = 2, tpClose = 3, RawString = 4, Float = 5;
4
4
  const _b = 98, _e = 101, _f = 102, _r = 114, _E = 69, Zero = 48, Dot = 46, Plus = 43, Minus = 45, Hash = 35, Quote = 34, Pipe = 124, LessThan = 60, GreaterThan = 62;
5
5
  function isNum(ch) {
@@ -1,4 +1,4 @@
1
- import { w as syntaxTree, T as Transaction, B as Text, S as StateEffect, D as codePointAt, x as EditorSelection, j as indentUnit, F as Annotation, G as Decoration, H as StateField, E as EditorView, P as Prec, k as keymap, I as codePointSize, R as RangeSet, J as showTooltip, V as ViewPlugin, K as logException, M as getTooltip, N as Facet, O as combineConfig, Q as fromCodePoint, U as MapMode, W as WidgetType, X as RangeValue, Y as Direction, Z as CharCategory } from "./code-palette-DAJUTnR-.js";
1
+ import { b as syntaxTree, T as Transaction, h as Text, S as StateEffect, j as codePointAt, d as EditorSelection, k as indentUnit, A as Annotation, D as Decoration, l as StateField, E as EditorView, P as Prec, m as keymap, n as codePointSize, R as RangeSet, o as showTooltip, V as ViewPlugin, q as logException, r as getTooltip, F as Facet, u as combineConfig, v as fromCodePoint, M as MapMode, W as WidgetType, w as RangeValue, x as Direction, C as CharCategory } from "./code-palette-DH_G7mZ5.js";
2
2
  class CompletionContext {
3
3
  /**
4
4
  Create a new completion context. (Mostly useful for testing
@@ -1,7 +1,7 @@
1
- import { L as LRLanguage, q as LanguageSupport, y as parseMixed, u as styleTags, v as tags } from "./code-palette-DAJUTnR-.js";
2
- import { html } from "./index-DxTzaHLr.js";
3
- import { javascriptLanguage } from "./index-DufAP1JF.js";
4
- import { L as LRParser, a as LocalTokenGroup } from "./index-CN8d3yl1.js";
1
+ import { L as LRLanguage, a as LanguageSupport, p as parseMixed, s as styleTags, t as tags } from "./code-palette-DH_G7mZ5.js";
2
+ import { html } from "./index-BqWO6mvz.js";
3
+ import { javascriptLanguage } from "./index-BlIc9r0r.js";
4
+ import { L as LRParser, a as LocalTokenGroup } from "./index-Mh3WUU-6.js";
5
5
  const parser = /* @__PURE__ */ LRParser.deserialize({
6
6
  version: 14,
7
7
  states: "%pOVOWOOObQPOOOpOSO'#C_OOOO'#Cp'#CpQVOWOOQxQPOOO!TQQOOQ!YQPOOOOOO,58y,58yO!_OSO,58yOOOO-E6n-E6nO!dQQO'#CqQ{QPOOO!iQPOOQ{QPOOO!qQPOOOOOO1G.e1G.eOOQO,59],59]OOQO-E6o-E6oO!yOpO'#CiO#RO`O'#CiQOQPOOO#ZO#tO'#CmO#fO!bO'#CmOOQO,59T,59TO#qOpO,59TO#vO`O,59TOOOO'#Cr'#CrO#{O#tO,59XOOQO,59X,59XOOOO'#Cs'#CsO$WO!bO,59XOOQO1G.o1G.oOOOO-E6p-E6pOOQO1G.s1G.sOOOO-E6q-E6q",
@@ -1,6 +1,6 @@
1
- import { L as LRParser, E as ExternalTokenizer } from "./index-CN8d3yl1.js";
2
- import { u as styleTags, v as tags, q as LanguageSupport, y as parseMixed, L as LRLanguage, r as indentNodeProp, s as continuedIndent, z as delimitedIndent, t as foldNodeProp, A as foldInside } from "./code-palette-DAJUTnR-.js";
3
- import { html } from "./index-DxTzaHLr.js";
1
+ import { L as LRParser, E as ExternalTokenizer } from "./index-Mh3WUU-6.js";
2
+ import { s as styleTags, t as tags, a as LanguageSupport, p as parseMixed, L as LRLanguage, i as indentNodeProp, c as continuedIndent, e as delimitedIndent, f as foldNodeProp, g as foldInside } from "./code-palette-DH_G7mZ5.js";
3
+ import { html } from "./index-BqWO6mvz.js";
4
4
  const castOpen = 1, HeredocString = 2, interpolatedStringContent = 276, EscapeSequence = 3, afterInterpolation = 277, automaticSemicolon = 278, eof = 279, abstract = 4, and = 5, array = 6, as = 7, Boolean = 8, _break = 9, _case = 10, _catch = 11, clone = 12, _const = 13, _continue = 14, _default = 15, declare = 16, _do = 17, echo = 18, _else = 19, elseif = 20, enddeclare = 21, endfor = 22, endforeach = 23, endif = 24, endswitch = 25, endwhile = 26, _enum = 27, _extends = 28, final = 29, _finally = 30, fn = 31, _for = 32, foreach = 33, from = 34, _function = 35, global = 36, goto = 37, _if = 38, _implements = 39, include = 40, include_once = 41, _instanceof = 42, insteadof = 43, _interface = 44, list = 45, match = 46, namespace = 47, _new = 48, _null = 49, or = 50, print = 51, readonly = 52, _require = 53, require_once = 54, _return = 55, _switch = 56, _throw = 57, trait = 58, _try = 59, unset = 60, use = 61, _var = 62, Visibility = 63, _while = 64, xor = 65, _yield = 66;
5
5
  const keywordMap = {
6
6
  abstract,
@@ -1,5 +1,5 @@
1
- import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup } from "./index-CN8d3yl1.js";
2
- import { u as styleTags, v as tags, q as LanguageSupport, L as LRLanguage, r as indentNodeProp, a5 as flatIndent, s as continuedIndent, z as delimitedIndent, t as foldNodeProp, A as foldInside } from "./code-palette-DAJUTnR-.js";
1
+ import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup } from "./index-Mh3WUU-6.js";
2
+ import { s as styleTags, t as tags, a as LanguageSupport, L as LRLanguage, i as indentNodeProp, a6 as flatIndent, c as continuedIndent, e as delimitedIndent, f as foldNodeProp, g as foldInside } from "./code-palette-DH_G7mZ5.js";
3
3
  const RawString = 1, templateArgsEndFallback = 2, MacroName = 3;
4
4
  const R = 82, L = 76, u = 117, U = 85, a = 97, z = 122, A = 65, Z = 90, Underscore = 95, Zero = 48, Quote = 34, ParenL = 40, ParenR = 41, Space = 32, GreaterThan = 62;
5
5
  const rawString = new ExternalTokenizer((input) => {
@@ -1,5 +1,5 @@
1
- import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from "./index-CN8d3yl1.js";
2
- import { u as styleTags, v as tags, E as EditorView, w as syntaxTree, x as EditorSelection, q as LanguageSupport, L as LRLanguage, r as indentNodeProp, t as foldNodeProp, af as bracketMatchingHandle } from "./code-palette-DAJUTnR-.js";
1
+ import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from "./index-Mh3WUU-6.js";
2
+ import { s as styleTags, t as tags, E as EditorView, b as syntaxTree, d as EditorSelection, a as LanguageSupport, L as LRLanguage, i as indentNodeProp, f as foldNodeProp, ag as bracketMatchingHandle } from "./code-palette-DH_G7mZ5.js";
3
3
  const StartTag = 1, StartCloseTag = 2, MissingCloseTag = 3, mismatchedStartCloseTag = 4, incompleteStartCloseTag = 5, commentContent$1 = 36, piContent$1 = 37, cdataContent$1 = 38, Element$1 = 11, OpenTag = 13;
4
4
  function nameChar(ch) {
5
5
  return ch == 45 || ch == 46 || ch == 58 || ch >= 65 && ch <= 90 || ch == 95 || ch >= 97 && ch <= 122 || ch >= 161;
@@ -1,7 +1,7 @@
1
- import { L as LRLanguage, q as LanguageSupport, y as parseMixed, u as styleTags, v as tags } from "./code-palette-DAJUTnR-.js";
2
- import { html } from "./index-DxTzaHLr.js";
3
- import { javascriptLanguage } from "./index-DufAP1JF.js";
4
- import { L as LRParser, E as ExternalTokenizer } from "./index-CN8d3yl1.js";
1
+ import { L as LRLanguage, a as LanguageSupport, p as parseMixed, s as styleTags, t as tags } from "./code-palette-DH_G7mZ5.js";
2
+ import { html } from "./index-BqWO6mvz.js";
3
+ import { javascriptLanguage } from "./index-BlIc9r0r.js";
4
+ import { L as LRParser, E as ExternalTokenizer } from "./index-Mh3WUU-6.js";
5
5
  const Text = 1, attributeContentSingle = 33, attributeContentDouble = 34, scriptAttributeContentSingle = 35, scriptAttributeContentDouble = 36;
6
6
  const text = /* @__PURE__ */ new ExternalTokenizer((input) => {
7
7
  let start = input.pos;
@@ -1,6 +1,6 @@
1
- import { E as EditorView, x as EditorSelection, q as LanguageSupport, y as parseMixed, w as syntaxTree, L as LRLanguage, u as styleTags, v as tags, r as indentNodeProp, z as delimitedIndent, t as foldNodeProp } from "./code-palette-DAJUTnR-.js";
2
- import { html } from "./index-DxTzaHLr.js";
3
- import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup } from "./index-CN8d3yl1.js";
1
+ import { E as EditorView, d as EditorSelection, a as LanguageSupport, p as parseMixed, b as syntaxTree, L as LRLanguage, s as styleTags, t as tags, i as indentNodeProp, e as delimitedIndent, f as foldNodeProp } from "./code-palette-DH_G7mZ5.js";
2
+ import { html } from "./index-BqWO6mvz.js";
3
+ import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup } from "./index-Mh3WUU-6.js";
4
4
  const interpolationStart = 1, commentTagStart = 2, tagStart = 3, text = 155, endrawTagStart = 4, rawText = 156;
5
5
  function wordChar(code) {
6
6
  return code >= 65 && code <= 90 || code >= 97 && code <= 122;
@@ -1,5 +1,5 @@
1
- import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from "./index-CN8d3yl1.js";
2
- import { u as styleTags, v as tags, q as LanguageSupport, y as parseMixed, L as LRLanguage, r as indentNodeProp, z as delimitedIndent, t as foldNodeProp, A as foldInside } from "./code-palette-DAJUTnR-.js";
1
+ import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from "./index-Mh3WUU-6.js";
2
+ import { s as styleTags, t as tags, a as LanguageSupport, p as parseMixed, L as LRLanguage, i as indentNodeProp, e as delimitedIndent, f as foldNodeProp, g as foldInside } from "./code-palette-DH_G7mZ5.js";
3
3
  const blockEnd = 63, eof = 64, DirectiveEnd = 1, DocEnd = 2, sequenceStartMark = 3, sequenceContinueMark = 4, explicitMapStartMark = 5, explicitMapContinueMark = 6, flowMapMark = 7, mapStartMark = 65, mapContinueMark = 66, Literal = 8, QuotedLiteral = 9, Anchor = 10, Alias = 11, Tag = 12, BlockLiteralContent = 13, BracketL = 19, FlowSequence = 20, Colon = 29, BraceL = 33, FlowMapping = 34, BlockLiteralHeader = 47;
4
4
  const type_Top = 0, type_Seq = 1, type_Map = 2, type_Flow = 3, type_Lit = 4;
5
5
  class Context {
@@ -1,5 +1,5 @@
1
- import { L as LRParser } from "./index-CN8d3yl1.js";
2
- import { u as styleTags, v as tags, q as LanguageSupport, L as LRLanguage, r as indentNodeProp, s as continuedIndent, t as foldNodeProp, A as foldInside } from "./code-palette-DAJUTnR-.js";
1
+ import { L as LRParser } from "./index-Mh3WUU-6.js";
2
+ import { s as styleTags, t as tags, a as LanguageSupport, L as LRLanguage, i as indentNodeProp, c as continuedIndent, f as foldNodeProp, g as foldInside } from "./code-palette-DH_G7mZ5.js";
3
3
  const jsonHighlighting = styleTags({
4
4
  String: tags.string,
5
5
  Number: tags.number,
@@ -1,6 +1,6 @@
1
- import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from "./index-CN8d3yl1.js";
2
- import { u as styleTags, v as tags, w as syntaxTree, q as LanguageSupport, L as LRLanguage, r as indentNodeProp, z as delimitedIndent, t as foldNodeProp, A as foldInside, a6 as NodeWeakMap, a4 as IterMode } from "./code-palette-DAJUTnR-.js";
3
- import { i as ifNotIn, c as completeFromList, s as snippetCompletion } from "./index-D6ftdiLa.js";
1
+ import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from "./index-Mh3WUU-6.js";
2
+ import { s as styleTags, t as tags, b as syntaxTree, a as LanguageSupport, L as LRLanguage, i as indentNodeProp, e as delimitedIndent, f as foldNodeProp, g as foldInside, a7 as NodeWeakMap, I as IterMode } from "./code-palette-DH_G7mZ5.js";
3
+ import { i as ifNotIn, c as completeFromList, s as snippetCompletion } from "./index-CG8e3146.js";
4
4
  const printKeyword = 1, indent = 194, dedent = 195, newline$1 = 196, blankLineStart = 197, newlineBracketed = 198, eof = 199, stringContent = 200, Escape = 2, replacementStart = 3, stringEnd = 201, ParenL = 24, ParenthesizedExpression = 25, TupleExpression = 49, ComprehensionExpression = 50, BracketL = 55, ArrayExpression = 56, ArrayComprehensionExpression = 57, BraceL = 59, DictionaryExpression = 60, DictionaryComprehensionExpression = 61, SetExpression = 62, SetComprehensionExpression = 63, ArgList = 65, subscript = 238, String$1 = 71, stringStart = 241, stringStartD = 242, stringStartL = 243, stringStartLD = 244, stringStartR = 245, stringStartRD = 246, stringStartRL = 247, stringStartRLD = 248, FormatString = 72, stringStartF = 249, stringStartFD = 250, stringStartFL = 251, stringStartFLD = 252, stringStartFR = 253, stringStartFRD = 254, stringStartFRL = 255, stringStartFRLD = 256, FormatReplacement = 73, nestedFormatReplacement = 77, importList = 263, TypeParamList = 112, ParamList = 130, SequencePattern = 151, MappingPattern = 152, PatternArgList = 155;
5
5
  const newline = 10, carriageReturn = 13, space = 32, tab = 9, hash = 35, parenOpen = 40, dot = 46, braceOpen = 123, braceClose = 125, singleQuote = 39, doubleQuote = 34, backslash = 92, letter_o = 111, letter_x = 120, letter_N = 78, letter_u = 117, letter_U = 85;
6
6
  const bracketed = /* @__PURE__ */ new Set([
@@ -1,5 +1,5 @@
1
- import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup } from "./index-CN8d3yl1.js";
2
- import { u as styleTags, v as tags$1, q as LanguageSupport, L as LRLanguage, r as indentNodeProp, s as continuedIndent, t as foldNodeProp, A as foldInside, w as syntaxTree, a6 as NodeWeakMap, a4 as IterMode } from "./code-palette-DAJUTnR-.js";
1
+ import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup } from "./index-Mh3WUU-6.js";
2
+ import { s as styleTags, t as tags$1, a as LanguageSupport, L as LRLanguage, i as indentNodeProp, c as continuedIndent, f as foldNodeProp, g as foldInside, b as syntaxTree, a7 as NodeWeakMap, I as IterMode } from "./code-palette-DH_G7mZ5.js";
3
3
  const descendantOp = 148, Unit = 1, identifier$1 = 149, callee = 150, VariableName = 2, queryIdentifier = 151, queryVariableName = 3, QueryCallee = 4;
4
4
  const space = [
5
5
  9,
@@ -1,6 +1,6 @@
1
- import { L as LRLanguage, q as LanguageSupport, r as indentNodeProp, s as continuedIndent, t as foldNodeProp, u as styleTags, v as tags, w as syntaxTree } from "./code-palette-DAJUTnR-.js";
2
- import { E as ExternalTokenizer, L as LRParser } from "./index-CN8d3yl1.js";
3
- import { i as ifNotIn, c as completeFromList } from "./index-D6ftdiLa.js";
1
+ import { L as LRLanguage, a as LanguageSupport, i as indentNodeProp, c as continuedIndent, f as foldNodeProp, s as styleTags, t as tags, b as syntaxTree } from "./code-palette-DH_G7mZ5.js";
2
+ import { E as ExternalTokenizer, L as LRParser } from "./index-Mh3WUU-6.js";
3
+ import { i as ifNotIn, c as completeFromList } from "./index-CG8e3146.js";
4
4
  const whitespace = 36, LineComment = 1, BlockComment = 2, String$1 = 3, Number = 4, Bool = 5, Null = 6, ParenL = 7, ParenR = 8, BraceL = 9, BraceR = 10, BracketL = 11, BracketR = 12, Semi = 13, Dot = 14, Operator = 15, Punctuation = 16, SpecialVar = 17, Identifier = 18, QuotedIdentifier = 19, Keyword = 20, Type = 21, Bits = 22, Bytes = 23, Builtin = 24;
5
5
  function isAlpha(ch) {
6
6
  return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57;
@@ -1,4 +1,4 @@
1
- import { _ as Parser, $ as NodeSet, a0 as NodeType, a1 as DefaultBufferLength, a2 as NodeProp, a3 as Tree, a4 as IterMode } from "./code-palette-DAJUTnR-.js";
1
+ import { y as Parser, N as NodeSet, z as NodeType, B as DefaultBufferLength, G as NodeProp, H as Tree, I as IterMode } from "./code-palette-DH_G7mZ5.js";
2
2
  class Stack {
3
3
  /**
4
4
  @internal
@@ -1,5 +1,5 @@
1
- import { q as LanguageSupport, L as LRLanguage, r as indentNodeProp, z as delimitedIndent, t as foldNodeProp, A as foldInside, u as styleTags, v as tags } from "./code-palette-DAJUTnR-.js";
2
- import { L as LRParser } from "./index-CN8d3yl1.js";
1
+ import { a as LanguageSupport, L as LRLanguage, i as indentNodeProp, e as delimitedIndent, f as foldNodeProp, g as foldInside, s as styleTags, t as tags } from "./code-palette-DH_G7mZ5.js";
2
+ import { L as LRParser } from "./index-Mh3WUU-6.js";
3
3
  const spec_Keyword = { __proto__: null, anyref: 34, dataref: 34, eqref: 34, externref: 34, i31ref: 34, funcref: 34, i8: 34, i16: 34, i32: 34, i64: 34, f32: 34, f64: 34 };
4
4
  const parser = /* @__PURE__ */ LRParser.deserialize({
5
5
  version: 14,
@@ -1,6 +1,6 @@
1
- import { E as EditorView, x as EditorSelection, q as LanguageSupport, y as parseMixed, w as syntaxTree, L as LRLanguage, u as styleTags, v as tags, r as indentNodeProp, z as delimitedIndent, t as foldNodeProp } from "./code-palette-DAJUTnR-.js";
2
- import { html } from "./index-DxTzaHLr.js";
3
- import { L as LRParser, E as ExternalTokenizer } from "./index-CN8d3yl1.js";
1
+ import { E as EditorView, d as EditorSelection, a as LanguageSupport, p as parseMixed, b as syntaxTree, L as LRLanguage, s as styleTags, t as tags, i as indentNodeProp, e as delimitedIndent, f as foldNodeProp } from "./code-palette-DH_G7mZ5.js";
2
+ import { html } from "./index-BqWO6mvz.js";
3
+ import { L as LRParser, E as ExternalTokenizer } from "./index-Mh3WUU-6.js";
4
4
  const interpolationStart = 1, tagStart = 2, endTagStart = 3, text = 180, endrawTagStart = 4, rawText = 181, endcommentTagStart = 5, commentText = 182, InlineComment = 6;
5
5
  function wordChar(code) {
6
6
  return code >= 65 && code <= 90 || code >= 97 && code <= 122;
@@ -1,6 +1,6 @@
1
- import { q as LanguageSupport, L as LRLanguage, r as indentNodeProp, s as continuedIndent, t as foldNodeProp, A as foldInside, u as styleTags, v as tags } from "./code-palette-DAJUTnR-.js";
2
- import { defineCSSCompletionSource } from "./index-BhvbqYsK.js";
3
- import { L as LRParser, E as ExternalTokenizer } from "./index-CN8d3yl1.js";
1
+ import { a as LanguageSupport, L as LRLanguage, i as indentNodeProp, c as continuedIndent, f as foldNodeProp, g as foldInside, s as styleTags, t as tags } from "./code-palette-DH_G7mZ5.js";
2
+ import { defineCSSCompletionSource } from "./index-DfLCrnVq.js";
3
+ import { L as LRParser, E as ExternalTokenizer } from "./index-Mh3WUU-6.js";
4
4
  const descendantOp = 110, Unit = 1, openArgList = 2;
5
5
  const space = [
6
6
  9,
@@ -1,6 +1,6 @@
1
- import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup, C as ContextTracker } from "./index-CN8d3yl1.js";
2
- import { u as styleTags, v as tags, q as LanguageSupport, L as LRLanguage, r as indentNodeProp, a5 as flatIndent, s as continuedIndent, z as delimitedIndent, t as foldNodeProp, A as foldInside, w as syntaxTree, a6 as NodeWeakMap, a4 as IterMode } from "./code-palette-DAJUTnR-.js";
3
- import { i as ifNotIn, c as completeFromList, s as snippetCompletion } from "./index-D6ftdiLa.js";
1
+ import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup, C as ContextTracker } from "./index-Mh3WUU-6.js";
2
+ import { s as styleTags, t as tags, a as LanguageSupport, L as LRLanguage, i as indentNodeProp, a6 as flatIndent, c as continuedIndent, e as delimitedIndent, f as foldNodeProp, g as foldInside, b as syntaxTree, a7 as NodeWeakMap, I as IterMode } from "./code-palette-DH_G7mZ5.js";
3
+ import { i as ifNotIn, c as completeFromList, s as snippetCompletion } from "./index-CG8e3146.js";
4
4
  const insertedSemi = 177, space$1 = 179, identifier = 184, String = 12, closeParen$1 = 13, Number = 17, Rune = 20, closeBrace$1 = 25, closeBracket = 53, IncDecOp = 95, _return = 142, _break = 144, _continue = 145, fallthrough = 148;
5
5
  const newline = 10, carriageReturn = 13, space = 32, tab = 9, slash = 47, closeParen = 41, closeBrace = 125;
6
6
  const semicolon = new ExternalTokenizer((input, stack) => {
@@ -1,5 +1,5 @@
1
- import { L as LRParser } from "./index-CN8d3yl1.js";
2
- import { u as styleTags, v as tags, q as LanguageSupport, L as LRLanguage, r as indentNodeProp, a5 as flatIndent, s as continuedIndent, z as delimitedIndent, t as foldNodeProp, A as foldInside } from "./code-palette-DAJUTnR-.js";
1
+ import { L as LRParser } from "./index-Mh3WUU-6.js";
2
+ import { s as styleTags, t as tags, a as LanguageSupport, L as LRLanguage, i as indentNodeProp, a6 as flatIndent, c as continuedIndent, e as delimitedIndent, f as foldNodeProp, g as foldInside } from "./code-palette-DH_G7mZ5.js";
3
3
  const javaHighlighting = styleTags({
4
4
  null: tags.null,
5
5
  instanceof: tags.operatorKeyword,
@@ -1,6 +1,6 @@
1
- import { _ as Parser, a0 as NodeType, a2 as NodeProp, a7 as Tag, $ as NodeSet, u as styleTags, a3 as Tree, y as parseMixed, v as tags, w as syntaxTree, x as EditorSelection, a8 as countColumn, q as LanguageSupport, P as Prec, k as keymap, E as EditorView, a9 as Language, j as indentUnit, aa as foldService, ab as defineLanguageFacet, a as EditorState, t as foldNodeProp, r as indentNodeProp, ac as languageDataProp, ad as LanguageDescription, ae as ParseContext } from "./code-palette-DAJUTnR-.js";
2
- import { C as CompletionContext } from "./index-D6ftdiLa.js";
3
- import { html, htmlCompletionSource } from "./index-DxTzaHLr.js";
1
+ import { y as Parser, z as NodeType, G as NodeProp, a8 as Tag, N as NodeSet, s as styleTags, H as Tree, p as parseMixed, t as tags, b as syntaxTree, d as EditorSelection, a9 as countColumn, a as LanguageSupport, P as Prec, m as keymap, E as EditorView, aa as Language, k as indentUnit, ab as foldService, ac as defineLanguageFacet, K as EditorState, f as foldNodeProp, i as indentNodeProp, ad as languageDataProp, ae as LanguageDescription, af as ParseContext } from "./code-palette-DH_G7mZ5.js";
2
+ import { C as CompletionContext } from "./index-CG8e3146.js";
3
+ import { html, htmlCompletionSource } from "./index-BqWO6mvz.js";
4
4
  class CompositeBlock {
5
5
  static create(type, value, from, parentHash, end) {
6
6
  let hash = parentHash + (parentHash << 8) + type + (value << 4) | 0;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { u } from "./useMessageHandler-nnsort0-.js";
2
2
  import { C, d, p, u as u2, b } from "./useChatKitLabels-CatQSpfL.js";
3
3
  import { S, c, d as d2, f, u as u3, a, b as b2, e } from "./index-CZFx44C7.js";
4
- import { _, a as a2, b as b3, c as c2, C as C2, d as d3, e as e2, f as f2, g, h, i, j, k, l, m, n, o, p as p2, q, r, s, t, u as u4, v, w, x, y, z, A, B, D, E } from "./CkHistory.vue_vue_type_script_setup_true_lang-gV-lp0ZB.js";
4
+ import { _, a as a2, b as b3, c as c2, C as C2, d as d3, e as e2, f as f2, g, h, i, j, k, l, m, n, o, p as p2, q, r, s, t, u as u4, v, w, x, y, z, A, B, D, E } from "./CkHistory.vue_vue_type_script_setup_true_lang-B0WUzTHa.js";
5
5
  import { m as m2 } from "./markdownToPlainText-BOtlQ_BY.js";
6
6
  export {
7
7
  C as CHAT_KIT_LABELS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aleph-alpha/chat-kit",
3
- "version": "6.3.0",
3
+ "version": "6.4.0",
4
4
  "description": "Chat kit package for building chat interfaces with Vue",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -115,9 +115,9 @@
115
115
  "vue": "^3.5.27",
116
116
  "vue-tsc": "^3.2.4",
117
117
  "wait-on": "9.0.3",
118
+ "@aleph-alpha/eslint-config-frontend": "0.7.1",
118
119
  "@aleph-alpha/prettier-config-frontend": "2.1.1",
119
- "@aleph-alpha/tsconfig-frontend": "0.7.3",
120
- "@aleph-alpha/eslint-config-frontend": "0.7.1"
120
+ "@aleph-alpha/tsconfig-frontend": "0.7.3"
121
121
  },
122
122
  "scripts": {
123
123
  "build": "vite build && vue-tsc --project tsconfig.build.json --declaration --emitDeclarationOnly --outDir dist",
@@ -2,6 +2,7 @@ import { render, screen, waitFor } from '@testing-library/vue';
2
2
  import userEvent from '@testing-library/user-event';
3
3
  import CkCodeEditor from './CkCodeEditor.vue';
4
4
  import { resolveLanguage } from './createCodeMirror';
5
+ import { matchBadgeRanges } from './badgeDecoration';
5
6
 
6
7
  // CodeMirror measures its own layout on construction; jsdom has none of the
7
8
  // geometry APIs it calls. The stubs stay in this spec rather than the global
@@ -199,6 +200,39 @@ describe('CkCodeEditor', () => {
199
200
  );
200
201
  });
201
202
 
203
+ it('draws matched references as pills while the document keeps the text', async () => {
204
+ const { container } = await renderEditor({
205
+ modelValue: 'use @collection:alpha here',
206
+ badge: {
207
+ pattern: /@collection:([\w-]+)/g,
208
+ render: (m: RegExpExecArray) => ({ label: m[1] as string }),
209
+ },
210
+ });
211
+
212
+ const pill = container.querySelector('.ck-code-badge');
213
+ expect(pill?.textContent).toBe('alpha');
214
+ // The raw reference is what a consumer reads back, not the label.
215
+ expect(container.querySelector('.cm-content')?.textContent).not.toContain(
216
+ '@collection:alpha',
217
+ );
218
+ });
219
+
220
+ it('leaves a match alone when the rule returns null', async () => {
221
+ const { container } = await renderEditor({
222
+ modelValue: '@collection:alpha and @collection:skip',
223
+ badge: {
224
+ pattern: /@collection:([\w-]+)/g,
225
+ render: (m: RegExpExecArray) =>
226
+ m[1] === 'skip' ? null : { label: m[1] as string },
227
+ },
228
+ });
229
+
230
+ const pills = [...container.querySelectorAll('.ck-code-badge')].map(
231
+ (e) => e.textContent,
232
+ );
233
+ expect(pills).toEqual(['alpha']);
234
+ });
235
+
202
236
  it('does not throw when unmounted before or after the editor is created', async () => {
203
237
  const early = render(CkCodeEditor, { props: { modelValue: 'x' } });
204
238
  expect(() => early.unmount()).not.toThrow();
@@ -221,3 +255,30 @@ describe('resolveLanguage', () => {
221
255
  await expect(resolveLanguage('not-a-language')).resolves.toBeNull();
222
256
  });
223
257
  });
258
+
259
+ describe('matchBadgeRanges', () => {
260
+ const rule = {
261
+ pattern: /@collection:([\w-]+)/g,
262
+ render: (m: RegExpExecArray) => ({ label: m[1] as string }),
263
+ };
264
+
265
+ it('finds every occurrence, with or without the global flag', () => {
266
+ const text = '@collection:a then @collection:b';
267
+ expect(matchBadgeRanges(rule, text)).toHaveLength(2);
268
+ expect(
269
+ matchBadgeRanges({ ...rule, pattern: /@collection:([\w-]+)/ }, text),
270
+ ).toHaveLength(2);
271
+ });
272
+
273
+ it('spans exactly the matched text', () => {
274
+ const [range] = matchBadgeRanges(rule, 'x @collection:a y');
275
+ expect(range?.from).toBe(2);
276
+ expect(range?.to).toBe('x @collection:a'.length);
277
+ });
278
+
279
+ it('skips matches the rule declines', () => {
280
+ expect(
281
+ matchBadgeRanges({ ...rule, render: () => null }, '@collection:a'),
282
+ ).toHaveLength(0);
283
+ });
284
+ });