@aleph-alpha/chat-kit 6.2.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.
- package/dist/{CkHistory.vue_vue_type_script_setup_true_lang-DPCpIxWc.js → CkHistory.vue_vue_type_script_setup_true_lang-B0WUzTHa.js} +351 -164
- package/dist/chat-kit.css +111 -28
- package/dist/code-palette-DH_G7mZ5.js +21599 -0
- package/dist/components/base/CkCodeEditor/CkCodeEditor.stories.d.ts +49 -0
- package/dist/components/base/CkCodeEditor/CkCodeEditor.stories.d.ts.map +1 -0
- package/dist/components/base/CkCodeEditor/CkCodeEditor.vue.d.ts +40 -0
- package/dist/components/base/CkCodeEditor/CkCodeEditor.vue.d.ts.map +1 -0
- package/dist/components/base/CkCodeEditor/badgeDecoration.d.ts +47 -0
- package/dist/components/base/CkCodeEditor/badgeDecoration.d.ts.map +1 -0
- package/dist/components/base/CkCodeEditor/createCodeMirror.d.ts +48 -0
- package/dist/components/base/CkCodeEditor/createCodeMirror.d.ts.map +1 -0
- package/dist/components/base/CkCodeEditor/index.d.ts +3 -0
- package/dist/components/base/CkCodeEditor/index.d.ts.map +1 -0
- package/dist/components/base/CkCodeEditor/types.d.ts +149 -0
- package/dist/components/base/CkCodeEditor/types.d.ts.map +1 -0
- package/dist/components/base/CkMilkdownEditor/CkMilkdownEditor.stories.d.ts +6 -0
- package/dist/components/base/CkMilkdownEditor/CkMilkdownEditor.stories.d.ts.map +1 -1
- package/dist/components/base/CkMilkdownEditor/CkMilkdownEditor.vue.d.ts +1 -0
- package/dist/components/base/CkMilkdownEditor/CkMilkdownEditor.vue.d.ts.map +1 -1
- package/dist/components/base/CkMilkdownEditor/createCrepeEditor.d.ts +1 -0
- package/dist/components/base/CkMilkdownEditor/createCrepeEditor.d.ts.map +1 -1
- package/dist/components/base/CkMilkdownEditor/types.d.ts +8 -0
- package/dist/components/base/CkMilkdownEditor/types.d.ts.map +1 -1
- package/dist/components/base/index.d.ts +2 -0
- package/dist/components/base/index.d.ts.map +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +27 -26
- package/dist/createCodeMirror-5iswYetS.js +169 -0
- package/dist/{createCrepeEditor-C9seqnzm.js → createCrepeEditor-C-AQ1w_e.js} +1433 -24739
- package/dist/handlers/index.js +1 -1
- package/dist/handlers/useChatKitLabels.d.ts +6 -0
- package/dist/handlers/useChatKitLabels.d.ts.map +1 -1
- package/dist/{components/base/CkMilkdownEditor/codeMirrorTheme.d.ts → helpers/codemirror/theme.d.ts} +1 -1
- package/dist/helpers/codemirror/theme.d.ts.map +1 -0
- package/dist/{index-DO8xk00f.js → index-ABUMl7H3.js} +3 -3
- package/dist/{index-DfvAv_Y2.js → index-BlIc9r0r.js} +3 -2
- package/dist/{index-VbqLf82s.js → index-BqWO6mvz.js} +4 -4
- package/dist/{index-Bxg0Q_mk.js → index-CFGO7LRz.js} +2 -2
- package/dist/index-CG8e3146.js +1825 -0
- package/dist/{index-C90_LSx6.js → index-CIF4qQzR.js} +4 -4
- package/dist/{index-DXTRMb09.js → index-CR2kGrpY.js} +3 -3
- package/dist/{index-B0nlcqqF.js → index-CWp_t8Wl.js} +2 -2
- package/dist/{index-CHtY7ztn.js → index-D0IZW-Up.js} +2 -2
- package/dist/{index-By7WdPbk.js → index-DKwEe_Tu.js} +4 -4
- package/dist/{index-DINJn4Mn.js → index-DLjsqQHx.js} +3 -3
- package/dist/{index-eZunhxNH.js → index-DPgw0Cf_.js} +2 -2
- package/dist/{index-D85elIIr.js → index-Db5-PJG-.js} +2 -2
- package/dist/{index-CFdcEeXx.js → index-Dbi75pKH.js} +3 -2
- package/dist/{index-8mYiDHFC.js → index-DfLCrnVq.js} +2 -2
- package/dist/{index-6PiPEjJd.js → index-GpSpJ3ti.js} +3 -2
- package/dist/{index-reQfKGuJ.js → index-Mh3WUU-6.js} +1 -1
- package/dist/{index-DLZcs4H8.js → index-QAs789O5.js} +2 -2
- package/dist/{index-DzpUblMx.js → index-S4ylc8JK.js} +3 -3
- package/dist/{index-DbVRgXxM.js → index-XZeturb3.js} +3 -3
- package/dist/{index-U4LYutvz.js → index-g2X42srv.js} +3 -2
- package/dist/{index-DNxEOsDD.js → index-hEJ_Bavx.js} +2 -2
- package/dist/{index-C5UC1wP7.js → index-hbS5PDHj.js} +3 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -28
- package/dist/{useChatKitLabels-Bz58tas9.js → useChatKitLabels-CatQSpfL.js} +2 -0
- package/package.json +4 -2
- package/src/components/base/CkCodeEditor/CkCodeEditor.spec.ts +284 -0
- package/src/components/base/CkCodeEditor/CkCodeEditor.stories.ts +405 -0
- package/src/components/base/CkCodeEditor/CkCodeEditor.vue +244 -0
- package/src/components/base/CkCodeEditor/badgeDecoration.ts +173 -0
- package/src/components/base/CkCodeEditor/createCodeMirror.ts +197 -0
- package/src/components/base/CkCodeEditor/index.ts +2 -0
- package/src/components/base/CkCodeEditor/types.ts +154 -0
- package/src/components/base/CkMilkdownEditor/CkMilkdownEditor.spec.ts +13 -0
- package/src/components/base/CkMilkdownEditor/CkMilkdownEditor.stories.ts +34 -0
- package/src/components/base/CkMilkdownEditor/CkMilkdownEditor.vue +3 -1
- package/src/components/base/CkMilkdownEditor/createCrepeEditor.ts +2 -1
- package/src/components/base/CkMilkdownEditor/milkdown-theme.css +39 -26
- package/src/components/base/CkMilkdownEditor/types.ts +8 -0
- package/src/components/base/index.ts +6 -0
- package/src/components/index.ts +4 -0
- package/src/handlers/useChatKitLabels.ts +6 -0
- package/src/helpers/codemirror/code-palette.css +49 -0
- package/src/{components/base/CkMilkdownEditor/codeMirrorTheme.ts → helpers/codemirror/theme.ts} +23 -12
- package/src/index.ts +4 -0
- package/dist/components/base/CkMilkdownEditor/codeMirrorTheme.d.ts.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { L as LRLanguage, a as LanguageSupport, p as parseMixed, s as styleTags, t as tags } from "./
|
|
2
|
-
import { html } from "./index-
|
|
3
|
-
import { javascriptLanguage } from "./index-
|
|
4
|
-
import { L as LRParser, a as LocalTokenGroup } from "./index-
|
|
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-
|
|
2
|
-
import { s as styleTags, t as tags, a as LanguageSupport, p as parseMixed, L as LRLanguage, i as indentNodeProp, c as continuedIndent,
|
|
3
|
-
import { html } from "./index-
|
|
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-
|
|
2
|
-
import { s as styleTags, t as tags, a as LanguageSupport, L as LRLanguage, i as indentNodeProp,
|
|
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-
|
|
2
|
-
import { s as styleTags, t as tags, E as EditorView,
|
|
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, a as LanguageSupport, p as parseMixed, s as styleTags, t as tags } from "./
|
|
2
|
-
import { html } from "./index-
|
|
3
|
-
import { javascriptLanguage } from "./index-
|
|
4
|
-
import { L as LRParser, E as ExternalTokenizer } from "./index-
|
|
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,
|
|
2
|
-
import { html } from "./index-
|
|
3
|
-
import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup } from "./index-
|
|
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-
|
|
2
|
-
import { s as styleTags, t as tags, a as LanguageSupport, p as parseMixed, L as LRLanguage, i as indentNodeProp,
|
|
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-
|
|
2
|
-
import { s as styleTags, t as tags, a as LanguageSupport, L as LRLanguage, i as indentNodeProp, c as continuedIndent, f as foldNodeProp,
|
|
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,5 +1,6 @@
|
|
|
1
|
-
import { L as LRParser, E as ExternalTokenizer, C as ContextTracker } from "./index-
|
|
2
|
-
import { s as styleTags, t as tags, b as
|
|
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";
|
|
3
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;
|
|
4
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;
|
|
5
6
|
const bracketed = /* @__PURE__ */ new Set([
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup } from "./index-
|
|
2
|
-
import { s as styleTags, t as tags$1, a as LanguageSupport, L as LRLanguage, i as indentNodeProp, c as continuedIndent, f as foldNodeProp,
|
|
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,5 +1,6 @@
|
|
|
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
|
|
2
|
-
import { E as ExternalTokenizer, L as LRParser } from "./index-
|
|
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";
|
|
3
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;
|
|
4
5
|
function isAlpha(ch) {
|
|
5
6
|
return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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 { a as LanguageSupport, L as LRLanguage, i as indentNodeProp,
|
|
2
|
-
import { L as LRParser } from "./index-
|
|
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,
|
|
2
|
-
import { html } from "./index-
|
|
3
|
-
import { L as LRParser, E as ExternalTokenizer } from "./index-
|
|
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 { a as LanguageSupport, L as LRLanguage, i as indentNodeProp, c as continuedIndent, f as foldNodeProp,
|
|
2
|
-
import { defineCSSCompletionSource } from "./index-
|
|
3
|
-
import { L as LRParser, E as ExternalTokenizer } from "./index-
|
|
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,5 +1,6 @@
|
|
|
1
|
-
import { L as LRParser, E as ExternalTokenizer, a as LocalTokenGroup, C as ContextTracker } from "./index-
|
|
2
|
-
import { s as styleTags, t as tags, a as LanguageSupport,
|
|
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";
|
|
3
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;
|
|
4
5
|
const newline = 10, carriageReturn = 13, space = 32, tab = 9, slash = 47, closeParen = 41, closeBrace = 125;
|
|
5
6
|
const semicolon = new ExternalTokenizer((input, stack) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LRParser } from "./index-
|
|
2
|
-
import { s as styleTags, t as tags, a as LanguageSupport, L as LRLanguage, i as indentNodeProp,
|
|
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,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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";
|
|
3
4
|
class CompositeBlock {
|
|
4
5
|
static create(type, value, from, parentHash, end) {
|
|
5
6
|
let hash = parentHash + (parentHash << 8) + type + (value << 4) | 0;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export { useChat, useConversationSessions, useConversations, } from './composabl
|
|
|
6
6
|
export type { ChatActions, ChatState, ConversationSession, CreateConversationInput, MessageHandler, MutationOptions, UseChatReturn, UseConversationSessionsReturn, UseConversationsOptions, UseConversationsReturn, } from './composables';
|
|
7
7
|
export { SdkError, createDocumentUploadProvider, defaultDocumentUploadConfig, defaultEndpoints, useDocumentUploadWithDefaultConfig, } from './composables/fileUpload';
|
|
8
8
|
export type { DocumentUploadConfig, DocumentUploadProvider, FileEntry, FileStatus, } from './composables/fileUpload';
|
|
9
|
-
export { CkAgentMessage, CkAgentMessageHeader, CkHeaderActivityButton, CkCitation, CkCitationLabel, CkCitationCard, CkConversation, CkConversationLayout, CkCopyMessageButton, CkDropZoneOverlay, CkFeedbackButton, CkFeedbackDialog, CkFileItemsList, CkHistory, CkHistoryItem, CkHistoryWrapper, CkMarkdownRenderer, CkMessageButton, CkModelSelector, CkPromptSendButton, CkPromptMenuButton, CkPromptStopButton, CkPromptInput, CkPromptInputDisclaimer, CkRegenerateMessageButton, CkSendIcon, CkStopIcon, CkUserMessage, CkEditableUserMessage, CkMilkdownEditor, } from './components';
|
|
10
|
-
export type { CkAgentMessageHeaderProps, CkHeaderActivityButtonProps, CkHeaderActivityButtonEmits, CkCitationProps, CkCitationEmits, CkCitationSource, CkCitationLabelProps, CkCitationCardProps, CkCitationCardEmits, CkConversationLayoutProps, CkConversationProps, CkDropZoneOverlayProps, CkDropZoneOverlayEmits, CkDropZoneRejection, CkDropZoneRejectionReason, CkFeedbackButtonProps, CkFeedbackDialogEmits, CkFeedbackDialogProps, CkFeedbackDialogSubmitPayload, CkFeedbackReason, CkFeedbackSentiment, CkFeedbackValue, CkFileEntry, CkFileItemsListEmits, CkFileItemsListProps, CkHistoryEmits, CkHistoryItemEmits, CkHistoryItemProps, CkHistoryProps, CkHistoryWrapperProps, CkMarkdownElementClasses, CkMarkdownRendererProps, CkMarkdownRendererEmits, CkModelOption, CkModelSelectorProps, CkModelSelectorEmits, CkPromptMenuButtonProps, CkUserMessageProps, CkEditableUserMessageProps, CkEditableUserMessageEmits, CkMilkdownEditorEmits, CkMilkdownEditorExposed, CkMilkdownEditorProps, } from './components';
|
|
9
|
+
export { CkAgentMessage, CkAgentMessageHeader, CkHeaderActivityButton, CkCitation, CkCitationLabel, CkCitationCard, CkConversation, CkConversationLayout, CkCopyMessageButton, CkDropZoneOverlay, CkFeedbackButton, CkFeedbackDialog, CkFileItemsList, CkHistory, CkHistoryItem, CkHistoryWrapper, CkMarkdownRenderer, CkMessageButton, CkModelSelector, CkPromptSendButton, CkPromptMenuButton, CkPromptStopButton, CkPromptInput, CkPromptInputDisclaimer, CkRegenerateMessageButton, CkSendIcon, CkStopIcon, CkUserMessage, CkEditableUserMessage, CkMilkdownEditor, CkCodeEditor, } from './components';
|
|
10
|
+
export type { CkAgentMessageHeaderProps, CkHeaderActivityButtonProps, CkHeaderActivityButtonEmits, CkCitationProps, CkCitationEmits, CkCitationSource, CkCitationLabelProps, CkCitationCardProps, CkCitationCardEmits, CkConversationLayoutProps, CkConversationProps, CkDropZoneOverlayProps, CkDropZoneOverlayEmits, CkDropZoneRejection, CkDropZoneRejectionReason, CkFeedbackButtonProps, CkFeedbackDialogEmits, CkFeedbackDialogProps, CkFeedbackDialogSubmitPayload, CkFeedbackReason, CkFeedbackSentiment, CkFeedbackValue, CkFileEntry, CkFileItemsListEmits, CkFileItemsListProps, CkHistoryEmits, CkHistoryItemEmits, CkHistoryItemProps, CkHistoryProps, CkHistoryWrapperProps, CkMarkdownElementClasses, CkMarkdownRendererProps, CkMarkdownRendererEmits, CkModelOption, CkModelSelectorProps, CkModelSelectorEmits, CkPromptMenuButtonProps, CkUserMessageProps, CkEditableUserMessageProps, CkEditableUserMessageEmits, CkMilkdownEditorEmits, CkMilkdownEditorExposed, CkMilkdownEditorProps, CkCodeEditorEmits, CkCodeEditorExposed, CkCodeEditorProps, } from './components';
|
|
11
11
|
export { formatRelativeTime, markdownToPlainText } from './helpers';
|
|
12
12
|
export type { ActiveComparison, BaseMessage, ComparisonLane, Conversation, ConversationTree, MessageContent, MessageContentStatus, MessageMetadata, MessageReasoningContent, MessageRole, MessageStatus, MessageTextContent, MessageToolContent, TreeMessage, } from './types';
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,iBAAiB,CAAC;AAGzB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AASpB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EACL,OAAO,EACP,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,aAAa,EACb,6BAA6B,EAC7B,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,QAAQ,EACR,4BAA4B,EAC5B,2BAA2B,EAC3B,gBAAgB,EAChB,kCAAkC,GACnC,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,oBAAoB,EACpB,sBAAsB,EACtB,SAAS,EACT,UAAU,GACX,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,sBAAsB,EACtB,UAAU,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,uBAAuB,EACvB,yBAAyB,EACzB,UAAU,EACV,UAAU,EACV,aAAa,EACb,qBAAqB,EACrB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,iBAAiB,CAAC;AAGzB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AASpB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EACL,OAAO,EACP,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,aAAa,EACb,6BAA6B,EAC7B,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,QAAQ,EACR,4BAA4B,EAC5B,2BAA2B,EAC3B,gBAAgB,EAChB,kCAAkC,GACnC,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,oBAAoB,EACpB,sBAAsB,EACtB,SAAS,EACT,UAAU,GACX,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,sBAAsB,EACtB,UAAU,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,uBAAuB,EACvB,yBAAyB,EACzB,UAAU,EACV,UAAU,EACV,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,YAAY,GACb,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,yBAAyB,EACzB,2BAA2B,EAC3B,2BAA2B,EAC3B,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,6BAA6B,EAC7B,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,0BAA0B,EAC1B,0BAA0B,EAC1B,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGpE,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACvB,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,GACZ,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { u } from "./useMessageHandler-nnsort0-.js";
|
|
2
|
-
import { C, d, p, u as u2, b } from "./useChatKitLabels-
|
|
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 } from "./CkHistory.vue_vue_type_script_setup_true_lang-
|
|
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,
|
|
@@ -10,37 +10,38 @@ export {
|
|
|
10
10
|
b3 as CkCitation,
|
|
11
11
|
c2 as CkCitationCard,
|
|
12
12
|
C2 as CkCitationLabel,
|
|
13
|
-
d3 as
|
|
14
|
-
e2 as
|
|
15
|
-
f2 as
|
|
16
|
-
g as
|
|
17
|
-
h as
|
|
18
|
-
i as
|
|
19
|
-
j as
|
|
20
|
-
k as
|
|
21
|
-
l as
|
|
22
|
-
m as
|
|
23
|
-
n as
|
|
24
|
-
o as
|
|
25
|
-
p2 as
|
|
26
|
-
q as
|
|
27
|
-
r as
|
|
28
|
-
s as
|
|
29
|
-
t as
|
|
30
|
-
u4 as
|
|
31
|
-
v as
|
|
32
|
-
w as
|
|
33
|
-
x as
|
|
34
|
-
y as
|
|
35
|
-
z as
|
|
36
|
-
A as
|
|
37
|
-
B as
|
|
13
|
+
d3 as CkCodeEditor,
|
|
14
|
+
e2 as CkConversation,
|
|
15
|
+
f2 as CkConversationLayout,
|
|
16
|
+
g as CkCopyMessageButton,
|
|
17
|
+
h as CkDropZoneOverlay,
|
|
18
|
+
i as CkEditableUserMessage,
|
|
19
|
+
j as CkFeedbackButton,
|
|
20
|
+
k as CkFeedbackDialog,
|
|
21
|
+
l as CkFileItemsList,
|
|
22
|
+
m as CkHeaderActivityButton,
|
|
23
|
+
n as CkHistory,
|
|
24
|
+
o as CkHistoryItem,
|
|
25
|
+
p2 as CkHistoryWrapper,
|
|
26
|
+
q as CkMarkdownRenderer,
|
|
27
|
+
r as CkMessageButton,
|
|
28
|
+
s as CkMilkdownEditor,
|
|
29
|
+
t as CkModelSelector,
|
|
30
|
+
u4 as CkPromptInput,
|
|
31
|
+
v as CkPromptInputDisclaimer,
|
|
32
|
+
w as CkPromptMenuButton,
|
|
33
|
+
x as CkPromptSendButton,
|
|
34
|
+
y as CkPromptStopButton,
|
|
35
|
+
z as CkRegenerateMessageButton,
|
|
36
|
+
A as CkSendIcon,
|
|
37
|
+
B as CkStopIcon,
|
|
38
|
+
D as CkUserMessage,
|
|
38
39
|
S as SdkError,
|
|
39
40
|
c as createDocumentUploadProvider,
|
|
40
41
|
d as defaultChatKitLabels,
|
|
41
42
|
d2 as defaultDocumentUploadConfig,
|
|
42
43
|
f as defaultEndpoints,
|
|
43
|
-
|
|
44
|
+
E as formatRelativeTime,
|
|
44
45
|
m2 as markdownToPlainText,
|
|
45
46
|
p as provideChatKitLabels,
|
|
46
47
|
u3 as useChat,
|
|
@@ -19171,6 +19171,8 @@ const defaultChatKitLabels = {
|
|
|
19171
19171
|
historyItemEditAction: "Edit",
|
|
19172
19172
|
historyItemDeleteAction: "Delete",
|
|
19173
19173
|
historyShowAll: "Show all",
|
|
19174
|
+
codeEditorCopy: "Copy code",
|
|
19175
|
+
codeEditorCopied: "Copied",
|
|
19174
19176
|
markdownEditorBold: "Bold",
|
|
19175
19177
|
markdownEditorItalic: "Italic",
|
|
19176
19178
|
markdownEditorStrikethrough: "Strikethrough",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aleph-alpha/chat-kit",
|
|
3
|
-
"version": "6.
|
|
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",
|
|
@@ -68,7 +68,9 @@
|
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@aleph-alpha/ui-library": "^6.0.0",
|
|
71
|
+
"@codemirror/commands": "^6.11.1",
|
|
71
72
|
"@codemirror/language": "^6.11.0",
|
|
73
|
+
"@codemirror/language-data": "^6.5.2",
|
|
72
74
|
"@codemirror/state": "^6.5.0",
|
|
73
75
|
"@codemirror/view": "^6.38.0",
|
|
74
76
|
"@lezer/highlight": "^1.2.0",
|
|
@@ -113,8 +115,8 @@
|
|
|
113
115
|
"vue": "^3.5.27",
|
|
114
116
|
"vue-tsc": "^3.2.4",
|
|
115
117
|
"wait-on": "9.0.3",
|
|
116
|
-
"@aleph-alpha/prettier-config-frontend": "2.1.1",
|
|
117
118
|
"@aleph-alpha/eslint-config-frontend": "0.7.1",
|
|
119
|
+
"@aleph-alpha/prettier-config-frontend": "2.1.1",
|
|
118
120
|
"@aleph-alpha/tsconfig-frontend": "0.7.3"
|
|
119
121
|
},
|
|
120
122
|
"scripts": {
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/vue';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import CkCodeEditor from './CkCodeEditor.vue';
|
|
4
|
+
import { resolveLanguage } from './createCodeMirror';
|
|
5
|
+
import { matchBadgeRanges } from './badgeDecoration';
|
|
6
|
+
|
|
7
|
+
// CodeMirror measures its own layout on construction; jsdom has none of the
|
|
8
|
+
// geometry APIs it calls. The stubs stay in this spec rather than the global
|
|
9
|
+
// setup so every other spec keeps an unmodified jsdom.
|
|
10
|
+
const EMPTY_RECT = {
|
|
11
|
+
x: 0,
|
|
12
|
+
y: 0,
|
|
13
|
+
top: 0,
|
|
14
|
+
left: 0,
|
|
15
|
+
right: 0,
|
|
16
|
+
bottom: 0,
|
|
17
|
+
width: 0,
|
|
18
|
+
height: 0,
|
|
19
|
+
toJSON: () => ({}),
|
|
20
|
+
} as DOMRect;
|
|
21
|
+
|
|
22
|
+
beforeAll(() => {
|
|
23
|
+
Range.prototype.getBoundingClientRect = () => EMPTY_RECT;
|
|
24
|
+
Range.prototype.getClientRects = () =>
|
|
25
|
+
({
|
|
26
|
+
length: 0,
|
|
27
|
+
item: () => null,
|
|
28
|
+
*[Symbol.iterator]() {
|
|
29
|
+
// no rects
|
|
30
|
+
},
|
|
31
|
+
}) as unknown as DOMRectList;
|
|
32
|
+
Element.prototype.scrollIntoView ??= () => undefined;
|
|
33
|
+
document.elementFromPoint ??= () => null;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
async function renderEditor(
|
|
37
|
+
props: InstanceType<typeof CkCodeEditor>['$props'] = {},
|
|
38
|
+
) {
|
|
39
|
+
const utils = render(CkCodeEditor, { props });
|
|
40
|
+
// The editor loads lazily, so wait for the ready flag rather than the shell.
|
|
41
|
+
await waitFor(() =>
|
|
42
|
+
expect(
|
|
43
|
+
utils.container.querySelector('.ck-code-editor--ready .cm-editor'),
|
|
44
|
+
).toBeInTheDocument(),
|
|
45
|
+
);
|
|
46
|
+
return utils;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
describe('CkCodeEditor', () => {
|
|
50
|
+
it('renders the initial code', async () => {
|
|
51
|
+
const { container } = await renderEditor({
|
|
52
|
+
modelValue: 'const answer = 42;',
|
|
53
|
+
language: 'javascript',
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
expect(container.querySelector('.cm-content')?.textContent).toContain(
|
|
57
|
+
'const answer = 42;',
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('emits the new document when the user types', async () => {
|
|
62
|
+
const { emitted } = await renderEditor({ modelValue: '' });
|
|
63
|
+
|
|
64
|
+
const content = document.querySelector('.cm-content') as HTMLElement;
|
|
65
|
+
await userEvent.click(content);
|
|
66
|
+
await userEvent.type(content, 'hi');
|
|
67
|
+
|
|
68
|
+
await waitFor(() => expect(emitted()['update:modelValue']).toBeTruthy());
|
|
69
|
+
const updates = emitted()['update:modelValue'] as string[][];
|
|
70
|
+
expect(updates.at(-1)?.[0]).toBe('hi');
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('applies an external modelValue change without echoing it back', async () => {
|
|
74
|
+
const { container, rerender, emitted } = await renderEditor({
|
|
75
|
+
modelValue: 'one',
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
await rerender({ modelValue: 'two' });
|
|
79
|
+
|
|
80
|
+
await waitFor(() =>
|
|
81
|
+
expect(container.querySelector('.cm-content')?.textContent).toContain(
|
|
82
|
+
'two',
|
|
83
|
+
),
|
|
84
|
+
);
|
|
85
|
+
const updates = (emitted()['update:modelValue'] ?? []) as string[][];
|
|
86
|
+
expect(updates.map(([value]) => value)).not.toContain('two');
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('drops contenteditable when readonly, and restores it', async () => {
|
|
90
|
+
const { container, rerender } = await renderEditor({
|
|
91
|
+
modelValue: 'x',
|
|
92
|
+
readonly: true,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const content = () => container.querySelector('.cm-content');
|
|
96
|
+
expect(content()?.getAttribute('contenteditable')).toBe('false');
|
|
97
|
+
|
|
98
|
+
await rerender({ modelValue: 'x', readonly: false });
|
|
99
|
+
await waitFor(() =>
|
|
100
|
+
expect(content()?.getAttribute('contenteditable')).toBe('true'),
|
|
101
|
+
);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('marks the root disabled and locks editing with `disabled`', async () => {
|
|
105
|
+
const { container } = await renderEditor({
|
|
106
|
+
modelValue: 'x',
|
|
107
|
+
disabled: true,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
expect(
|
|
111
|
+
container.querySelector('.ck-code-editor')?.getAttribute('aria-disabled'),
|
|
112
|
+
).toBe('true');
|
|
113
|
+
expect(
|
|
114
|
+
container.querySelector('.cm-content')?.getAttribute('contenteditable'),
|
|
115
|
+
).toBe('false');
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it('names the editable region for assistive tech', async () => {
|
|
119
|
+
const { container } = await renderEditor({
|
|
120
|
+
modelValue: 'x',
|
|
121
|
+
ariaLabel: 'Snippet',
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
const textbox = container.querySelector('[role="textbox"]');
|
|
125
|
+
expect(textbox).toBe(container.querySelector('.cm-content'));
|
|
126
|
+
expect(textbox?.getAttribute('aria-label')).toBe('Snippet');
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('shows the filename in the header when there is one', async () => {
|
|
130
|
+
await renderEditor({
|
|
131
|
+
modelValue: 'x',
|
|
132
|
+
language: 'python',
|
|
133
|
+
filename: 'main.py',
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
expect(screen.getByText('main.py')).toBeInTheDocument();
|
|
137
|
+
expect(screen.queryByText('python')).not.toBeInTheDocument();
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it('falls back to the language, and labels plain text with nothing', async () => {
|
|
141
|
+
const withLanguage = await renderEditor({
|
|
142
|
+
modelValue: 'x',
|
|
143
|
+
language: 'python',
|
|
144
|
+
});
|
|
145
|
+
expect(screen.getByText('python')).toBeInTheDocument();
|
|
146
|
+
withLanguage.unmount();
|
|
147
|
+
|
|
148
|
+
// `text` is the "no language" value, which UiCodeBlock also leaves blank.
|
|
149
|
+
await renderEditor({ modelValue: 'x', language: 'text' });
|
|
150
|
+
expect(screen.queryByText('text')).not.toBeInTheDocument();
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('copies the current code through the injected writer', async () => {
|
|
154
|
+
const writeToClipboard = vi.fn().mockResolvedValue(undefined);
|
|
155
|
+
const { emitted } = await renderEditor({
|
|
156
|
+
modelValue: 'copy me',
|
|
157
|
+
writeToClipboard,
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
await userEvent.click(screen.getByRole('button', { name: 'Copy code' }));
|
|
161
|
+
|
|
162
|
+
expect(writeToClipboard).toHaveBeenCalledWith('copy me');
|
|
163
|
+
await waitFor(() => expect(emitted().copy).toEqual([[{ success: true }]]));
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it('reports a failed copy rather than throwing', async () => {
|
|
167
|
+
const writeToClipboard = vi.fn().mockRejectedValue(new Error('denied'));
|
|
168
|
+
const { emitted } = await renderEditor({
|
|
169
|
+
modelValue: 'x',
|
|
170
|
+
writeToClipboard,
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
await userEvent.click(screen.getByRole('button', { name: 'Copy code' }));
|
|
174
|
+
|
|
175
|
+
await waitFor(() => expect(emitted().copy).toEqual([[{ success: false }]]));
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it('hides the header when asked', async () => {
|
|
179
|
+
const { container } = await renderEditor({
|
|
180
|
+
modelValue: 'x',
|
|
181
|
+
language: 'python',
|
|
182
|
+
showHeader: false,
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
expect(container.querySelector('button')).toBeNull();
|
|
186
|
+
expect(screen.queryByText('python')).not.toBeInTheDocument();
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it('toggles the line-number gutter', async () => {
|
|
190
|
+
const { container, rerender } = await renderEditor({
|
|
191
|
+
modelValue: 'a\nb',
|
|
192
|
+
showLineNumbers: true,
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
expect(container.querySelector('.cm-lineNumbers')).toBeInTheDocument();
|
|
196
|
+
|
|
197
|
+
await rerender({ modelValue: 'a\nb', showLineNumbers: false });
|
|
198
|
+
await waitFor(() =>
|
|
199
|
+
expect(container.querySelector('.cm-lineNumbers')).toBeNull(),
|
|
200
|
+
);
|
|
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
|
+
|
|
236
|
+
it('does not throw when unmounted before or after the editor is created', async () => {
|
|
237
|
+
const early = render(CkCodeEditor, { props: { modelValue: 'x' } });
|
|
238
|
+
expect(() => early.unmount()).not.toThrow();
|
|
239
|
+
|
|
240
|
+
const late = await renderEditor({ modelValue: 'y' });
|
|
241
|
+
expect(() => late.unmount()).not.toThrow();
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
describe('resolveLanguage', () => {
|
|
246
|
+
it('resolves by name, alias and extension, ignoring case', async () => {
|
|
247
|
+
await expect(resolveLanguage('TypeScript')).resolves.toBeTruthy();
|
|
248
|
+
await expect(resolveLanguage('ts')).resolves.toBeTruthy();
|
|
249
|
+
await expect(resolveLanguage('py')).resolves.toBeTruthy();
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
it('returns null for plain text and unknown languages', async () => {
|
|
253
|
+
await expect(resolveLanguage('text')).resolves.toBeNull();
|
|
254
|
+
await expect(resolveLanguage('')).resolves.toBeNull();
|
|
255
|
+
await expect(resolveLanguage('not-a-language')).resolves.toBeNull();
|
|
256
|
+
});
|
|
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
|
+
});
|