@sendbird/actionbook-core 0.10.8 → 0.10.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -2
- package/dist/index.js +26 -14
- package/dist/index.js.map +1 -1
- package/dist/{types-BQ95zx4j.d.ts → types-Bu4_nY3M.d.ts} +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +78 -35
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -19,7 +19,7 @@ type LinkMark = {
|
|
|
19
19
|
readonly title?: string;
|
|
20
20
|
};
|
|
21
21
|
type Mark = BoldMark | ItalicMark | UnderlineMark | StrikethroughMark | CodeMark | LinkMark;
|
|
22
|
-
declare const RESOURCE_TAG_TYPES: readonly ["tool", "manual", "agent_message_template", "handoff", "time_diff", "time_difference"];
|
|
22
|
+
declare const RESOURCE_TAG_TYPES: readonly ["tool", "manual", "agent_message_template", "handoff", "end_call", "time_diff", "time_difference"];
|
|
23
23
|
type ResourceTagType = (typeof RESOURCE_TAG_TYPES)[number];
|
|
24
24
|
type TextNode = {
|
|
25
25
|
readonly type: 'text';
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Plugin, Command, EditorState, PluginKey } from 'prosemirror-state';
|
|
|
3
3
|
import { InputRule } from 'prosemirror-inputrules';
|
|
4
4
|
import { EditorView, Decoration, NodeView } from 'prosemirror-view';
|
|
5
5
|
import React$1, { ReactElement, RefCallback } from 'react';
|
|
6
|
-
import { D as DocumentNode, A as AstNode, t as LlmCompletionEndpoint, I as InlineNode, B as BlockNode, v as JSONContent } from '../types-
|
|
6
|
+
import { D as DocumentNode, A as AstNode, t as LlmCompletionEndpoint, I as InlineNode, B as BlockNode, v as JSONContent } from '../types-Bu4_nY3M.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* ProseMirror Schema for Actionbook documents.
|
package/dist/ui/index.js
CHANGED
|
@@ -1251,7 +1251,7 @@ import { EditorView } from "prosemirror-view";
|
|
|
1251
1251
|
import { Node as PMNode } from "prosemirror-model";
|
|
1252
1252
|
|
|
1253
1253
|
// src/ast/types.ts
|
|
1254
|
-
var RESOURCE_TAG_TYPES = ["tool", "manual", "agent_message_template", "handoff", "time_diff", "time_difference"];
|
|
1254
|
+
var RESOURCE_TAG_TYPES = ["tool", "manual", "agent_message_template", "handoff", "end_call", "time_diff", "time_difference"];
|
|
1255
1255
|
|
|
1256
1256
|
// src/compat/prosemirror.ts
|
|
1257
1257
|
var MAX_DEPTH = 128;
|
|
@@ -1994,7 +1994,7 @@ function listItemWithTaskListItem(node, parent, state, info) {
|
|
|
1994
1994
|
|
|
1995
1995
|
// src/markdown/plugins/resourceTag.ts
|
|
1996
1996
|
var RESOURCE_TAG_RE = /\{\{([^:}]+):([^:}]*):([^}]+)\}\}/g;
|
|
1997
|
-
var VALID_TYPES = /* @__PURE__ */ new Set(["tool", "manual", "agent_message_template", "handoff", "end_call", "time_diff"]);
|
|
1997
|
+
var VALID_TYPES = /* @__PURE__ */ new Set(["tool", "manual", "agent_message_template", "handoff", "end_call", "time_diff", "time_difference"]);
|
|
1998
1998
|
function splitTextWithResourceTags(text2) {
|
|
1999
1999
|
const results = [];
|
|
2000
2000
|
let lastIndex = 0;
|
|
@@ -2081,7 +2081,8 @@ function convertInline(node, marks = [], depth = 0) {
|
|
|
2081
2081
|
case "text":
|
|
2082
2082
|
return [marks.length > 0 ? { type: "text", text: node.value, marks } : { type: "text", text: node.value }];
|
|
2083
2083
|
case "strong": {
|
|
2084
|
-
const
|
|
2084
|
+
const alreadyBold = marks.some((m) => m.type === "bold");
|
|
2085
|
+
const childMarks = [...marks, { type: alreadyBold ? "italic" : "bold" }];
|
|
2085
2086
|
return node.children.flatMap((child) => convertInline(child, childMarks, depth + 1));
|
|
2086
2087
|
}
|
|
2087
2088
|
case "emphasis": {
|
|
@@ -2477,6 +2478,12 @@ function serializeToMarkdown(doc2) {
|
|
|
2477
2478
|
text: textHandler,
|
|
2478
2479
|
link: linkHandler,
|
|
2479
2480
|
listItem: listItemHandler,
|
|
2481
|
+
emphasis: ((node, _parent, state, info) => {
|
|
2482
|
+
const exit2 = state.enter("emphasis");
|
|
2483
|
+
const value = state.containerPhrasing(node, { ...info, before: "_", after: "_" });
|
|
2484
|
+
exit2();
|
|
2485
|
+
return `__${value}__`;
|
|
2486
|
+
}),
|
|
2480
2487
|
...resourceTagToMarkdown().handlers,
|
|
2481
2488
|
...jumpPointToMarkdown().handlers
|
|
2482
2489
|
},
|
|
@@ -3067,6 +3074,8 @@ var ORDERED_LIST_RE = /^(\d+)\.\s$/;
|
|
|
3067
3074
|
var JUMP_POINT_RE2 = /\^([\p{L}\p{N}_-]+)\^$/u;
|
|
3068
3075
|
var BOLD_RE = /(?:^|[^*])\*\*([^*]+)\*\*$/;
|
|
3069
3076
|
var ITALIC_RE = /(?:^|[^_])__([^_]+)__$/;
|
|
3077
|
+
var BOLD_ITALIC_RE1 = /(?:^|[^_])__\*\*([^*]+)\*\*__$/;
|
|
3078
|
+
var BOLD_ITALIC_RE2 = /(?:^|[^*])\*\*__([^_]+)__\*\*$/;
|
|
3070
3079
|
var STRIKE_RE = /(?:^|[^~])~~([^~]+)~~$/;
|
|
3071
3080
|
var CODE_RE = /(?:^|[^`])`([^`]+)`$/;
|
|
3072
3081
|
function findParentList(state, pos) {
|
|
@@ -3165,7 +3174,26 @@ function handleListInputRule(state, start, end, listType, attrs) {
|
|
|
3165
3174
|
tr.setSelection(TextSelection.near(tr.doc.resolve(tr.mapping.map(start))));
|
|
3166
3175
|
return tr;
|
|
3167
3176
|
}
|
|
3168
|
-
function
|
|
3177
|
+
function dualMarkInputRule(pattern, markTypes, outerMarkerLen, innerMarkerLen) {
|
|
3178
|
+
const totalMarkerLen = (outerMarkerLen + innerMarkerLen) * 2;
|
|
3179
|
+
return new InputRule(pattern, (state, match, start, end) => {
|
|
3180
|
+
const slashState = slashCommandKey.getState(state);
|
|
3181
|
+
if (slashState?.active) return null;
|
|
3182
|
+
const textContent2 = match[1];
|
|
3183
|
+
const fullMatch = match[0];
|
|
3184
|
+
const markedLength = totalMarkerLen + textContent2.length;
|
|
3185
|
+
const prefixLen = fullMatch.length - markedLength;
|
|
3186
|
+
const deleteFrom = start + prefixLen;
|
|
3187
|
+
const tr = state.tr;
|
|
3188
|
+
tr.delete(deleteFrom, end);
|
|
3189
|
+
const marks = markTypes.map((m) => m.create());
|
|
3190
|
+
const textNode = state.schema.text(textContent2, marks);
|
|
3191
|
+
tr.insert(deleteFrom, textNode);
|
|
3192
|
+
for (const m of markTypes) tr.removeStoredMark(m);
|
|
3193
|
+
return tr;
|
|
3194
|
+
});
|
|
3195
|
+
}
|
|
3196
|
+
function markInputRule(pattern, markType, markerLen, skipPrefix) {
|
|
3169
3197
|
return new InputRule(pattern, (state, match, start, end) => {
|
|
3170
3198
|
const slashState = slashCommandKey.getState(state);
|
|
3171
3199
|
if (slashState?.active) return null;
|
|
@@ -3174,6 +3202,10 @@ function markInputRule(pattern, markType, markerLen) {
|
|
|
3174
3202
|
const markedLength = markerLen * 2 + textContent2.length;
|
|
3175
3203
|
const prefixLen = fullMatch.length - markedLength;
|
|
3176
3204
|
const deleteFrom = start + prefixLen;
|
|
3205
|
+
if (skipPrefix && deleteFrom >= skipPrefix.length) {
|
|
3206
|
+
const before = state.doc.textBetween(deleteFrom - skipPrefix.length, deleteFrom);
|
|
3207
|
+
if (before === skipPrefix) return null;
|
|
3208
|
+
}
|
|
3177
3209
|
const tr = state.tr;
|
|
3178
3210
|
tr.delete(deleteFrom, end);
|
|
3179
3211
|
const textNode = state.schema.text(textContent2, [markType.create()]);
|
|
@@ -3297,8 +3329,10 @@ function createInputRulesPlugin() {
|
|
|
3297
3329
|
return tr;
|
|
3298
3330
|
})
|
|
3299
3331
|
);
|
|
3300
|
-
rules.push(
|
|
3301
|
-
rules.push(
|
|
3332
|
+
rules.push(dualMarkInputRule(BOLD_ITALIC_RE1, [actionbookSchema.marks.bold, actionbookSchema.marks.italic], 2, 2));
|
|
3333
|
+
rules.push(dualMarkInputRule(BOLD_ITALIC_RE2, [actionbookSchema.marks.bold, actionbookSchema.marks.italic], 2, 2));
|
|
3334
|
+
rules.push(markInputRule(BOLD_RE, actionbookSchema.marks.bold, 2, "__"));
|
|
3335
|
+
rules.push(markInputRule(ITALIC_RE, actionbookSchema.marks.italic, 2, "**"));
|
|
3302
3336
|
rules.push(markInputRule(STRIKE_RE, actionbookSchema.marks.strikethrough, 2));
|
|
3303
3337
|
rules.push(markInputRule(CODE_RE, actionbookSchema.marks.code, 1));
|
|
3304
3338
|
return rules;
|
|
@@ -5329,7 +5363,7 @@ function parseFragment(markdown) {
|
|
|
5329
5363
|
}
|
|
5330
5364
|
|
|
5331
5365
|
// src/jinja/scanner.ts
|
|
5332
|
-
var JINJA_PATTERN = /\{%\s*(if|elif|else|endif)\s*(
|
|
5366
|
+
var JINJA_PATTERN = /\{%\s*(if|elif|else|endif)\s*(.*?)\s*%\}/g;
|
|
5333
5367
|
function scanJinjaBlocks(text2) {
|
|
5334
5368
|
const blocks = [];
|
|
5335
5369
|
JINJA_PATTERN.lastIndex = 0;
|
|
@@ -5530,7 +5564,7 @@ function tokenize(input) {
|
|
|
5530
5564
|
tokens.push({ type: "STRING", value: str });
|
|
5531
5565
|
continue;
|
|
5532
5566
|
}
|
|
5533
|
-
if (/[0-9]/.test(input[i]) || input[i] === "-" && i + 1 < input.length && /[0-9]/.test(input[i + 1]) && (tokens.length === 0 || ["AND", "OR", "NOT", "EQ", "NEQ", "LT", "GT", "LTE", "GTE", "LPAREN", "IN", "IS"].includes(tokens[tokens.length - 1].type))) {
|
|
5567
|
+
if (/[0-9]/.test(input[i]) || input[i] === "-" && i + 1 < input.length && /[0-9]/.test(input[i + 1]) && (tokens.length === 0 || ["AND", "OR", "NOT", "EQ", "NEQ", "LT", "GT", "LTE", "GTE", "LPAREN", "IN", "IS", "COMMA"].includes(tokens[tokens.length - 1].type))) {
|
|
5534
5568
|
let num = "";
|
|
5535
5569
|
if (input[i] === "-") {
|
|
5536
5570
|
num = "-";
|
|
@@ -5833,7 +5867,7 @@ var END_ACTION_TEXTS = /* @__PURE__ */ new Set([
|
|
|
5833
5867
|
function isEndActionTag(tagType, resourceId, text2) {
|
|
5834
5868
|
return tagType === "handoff" || END_ACTION_RESOURCE_IDS.has(resourceId) || END_ACTION_TEXTS.has(text2.toLowerCase());
|
|
5835
5869
|
}
|
|
5836
|
-
function extractInlineItems(content, blockIndex) {
|
|
5870
|
+
function extractInlineItems(content, blockIndex, listItemPath = []) {
|
|
5837
5871
|
const items = [];
|
|
5838
5872
|
for (const node of content) {
|
|
5839
5873
|
if (node.type === "jumpPoint") {
|
|
@@ -5850,22 +5884,26 @@ function extractInlineItems(content, blockIndex) {
|
|
|
5850
5884
|
label: endAction ? `End ${node.text}` : node.text,
|
|
5851
5885
|
blockIndex,
|
|
5852
5886
|
children: [],
|
|
5853
|
-
meta: {
|
|
5887
|
+
meta: {
|
|
5888
|
+
tagType: node.tagType,
|
|
5889
|
+
resourceId: node.resourceId,
|
|
5890
|
+
...listItemPath.length > 0 && { listItemPath: [...listItemPath] }
|
|
5891
|
+
}
|
|
5854
5892
|
});
|
|
5855
5893
|
}
|
|
5856
5894
|
}
|
|
5857
5895
|
return items;
|
|
5858
5896
|
}
|
|
5859
|
-
function extractBlockItems(blocks, startIndex, depth) {
|
|
5897
|
+
function extractBlockItems(blocks, startIndex, depth, listItemPath = [], fixedBlockIndex) {
|
|
5860
5898
|
if (depth > MAX_DEPTH6) return [];
|
|
5861
5899
|
const items = [];
|
|
5862
5900
|
for (let i = 0; i < blocks.length; i++) {
|
|
5863
5901
|
const block = blocks[i];
|
|
5864
|
-
const blockIndex = startIndex + i;
|
|
5902
|
+
const blockIndex = fixedBlockIndex ?? startIndex + i;
|
|
5865
5903
|
switch (block.type) {
|
|
5866
5904
|
case "heading": {
|
|
5867
5905
|
const label = textContent(block) || `Heading ${block.level}`;
|
|
5868
|
-
const inlineItems = extractInlineItems(block.content, blockIndex);
|
|
5906
|
+
const inlineItems = extractInlineItems(block.content, blockIndex, listItemPath);
|
|
5869
5907
|
items.push({
|
|
5870
5908
|
type: "heading",
|
|
5871
5909
|
label,
|
|
@@ -5876,7 +5914,7 @@ function extractBlockItems(blocks, startIndex, depth) {
|
|
|
5876
5914
|
break;
|
|
5877
5915
|
}
|
|
5878
5916
|
case "paragraph": {
|
|
5879
|
-
const inlineItems = extractInlineItems(block.content, blockIndex);
|
|
5917
|
+
const inlineItems = extractInlineItems(block.content, blockIndex, listItemPath);
|
|
5880
5918
|
items.push(...inlineItems);
|
|
5881
5919
|
break;
|
|
5882
5920
|
}
|
|
@@ -5912,14 +5950,15 @@ function extractBlockItems(blocks, startIndex, depth) {
|
|
|
5912
5950
|
}
|
|
5913
5951
|
case "bulletList":
|
|
5914
5952
|
case "orderedList": {
|
|
5915
|
-
for (
|
|
5916
|
-
const
|
|
5953
|
+
for (let liIdx = 0; liIdx < block.content.length; liIdx++) {
|
|
5954
|
+
const li = block.content[liIdx];
|
|
5955
|
+
const childItems = extractBlockItems(li.content, blockIndex, depth + 1, [...listItemPath, liIdx], blockIndex);
|
|
5917
5956
|
items.push(...childItems);
|
|
5918
5957
|
}
|
|
5919
5958
|
break;
|
|
5920
5959
|
}
|
|
5921
5960
|
case "blockquote": {
|
|
5922
|
-
const childItems = extractBlockItems(block.content, blockIndex, depth + 1);
|
|
5961
|
+
const childItems = extractBlockItems(block.content, blockIndex, depth + 1, listItemPath, blockIndex);
|
|
5923
5962
|
items.push(...childItems);
|
|
5924
5963
|
break;
|
|
5925
5964
|
}
|
|
@@ -6061,6 +6100,10 @@ function createPlugin() {
|
|
|
6061
6100
|
shiftHeld = false;
|
|
6062
6101
|
return false;
|
|
6063
6102
|
},
|
|
6103
|
+
blur() {
|
|
6104
|
+
shiftHeld = false;
|
|
6105
|
+
return false;
|
|
6106
|
+
},
|
|
6064
6107
|
paste(view, event) {
|
|
6065
6108
|
if (shiftHeld) return false;
|
|
6066
6109
|
const clipboardData = event.clipboardData;
|
|
@@ -7442,7 +7485,7 @@ function JinjaBranchHeader({
|
|
|
7442
7485
|
onSelect: onDelete
|
|
7443
7486
|
});
|
|
7444
7487
|
}
|
|
7445
|
-
const canOpenFooterMenu = editable && isLastBranch && branchType !== "else";
|
|
7488
|
+
const canOpenFooterMenu = editable && isLastBranch && branchType !== "else" && !hasElseBranch;
|
|
7446
7489
|
const isMenuOpen = (source) => menuSource === source && menuItems.length > 0;
|
|
7447
7490
|
const [conditionTouched, setConditionTouched] = useState3(false);
|
|
7448
7491
|
const conditionError = (() => {
|
|
@@ -7873,23 +7916,18 @@ function createLinkClickPlugin() {
|
|
|
7873
7916
|
if (target.tagName !== "A") return false;
|
|
7874
7917
|
const href = target.getAttribute("href");
|
|
7875
7918
|
if (!href) return false;
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
if (el) {
|
|
7881
|
-
el.scrollIntoView({ block: "end" });
|
|
7882
|
-
el.focus();
|
|
7883
|
-
if (el.parentElement) {
|
|
7884
|
-
el.parentElement.style.outline = "2px solid #6213cc";
|
|
7885
|
-
setTimeout(() => {
|
|
7886
|
-
el.parentElement.style.outline = "none";
|
|
7887
|
-
}, 500);
|
|
7888
|
-
}
|
|
7889
|
-
}
|
|
7919
|
+
event.preventDefault();
|
|
7920
|
+
if (href.startsWith("#")) return true;
|
|
7921
|
+
if (href.startsWith("mailto:") || href.startsWith("tel:")) {
|
|
7922
|
+
window.location.href = href;
|
|
7890
7923
|
return true;
|
|
7891
7924
|
}
|
|
7892
|
-
|
|
7925
|
+
if (href.startsWith("www.")) {
|
|
7926
|
+
window.open(`https://${href}`, "_blank", "noopener,noreferrer");
|
|
7927
|
+
return true;
|
|
7928
|
+
}
|
|
7929
|
+
window.open(href, "_blank", "noopener,noreferrer");
|
|
7930
|
+
return true;
|
|
7893
7931
|
}
|
|
7894
7932
|
}
|
|
7895
7933
|
}
|
|
@@ -8529,7 +8567,12 @@ var DragHandleController = class {
|
|
|
8529
8567
|
this.dropIndicator.className = "ab-drop-indicator";
|
|
8530
8568
|
this.dropIndicator.style.display = "none";
|
|
8531
8569
|
parent.appendChild(this.dropIndicator);
|
|
8532
|
-
|
|
8570
|
+
const newScrollContainer = this.findScrollContainer(this.view.dom);
|
|
8571
|
+
if (newScrollContainer !== this.scrollContainer) {
|
|
8572
|
+
this.scrollContainer.removeEventListener("scroll", this.onScroll);
|
|
8573
|
+
this.scrollContainer = newScrollContainer;
|
|
8574
|
+
this.scrollContainer.addEventListener("scroll", this.onScroll, { passive: true });
|
|
8575
|
+
}
|
|
8533
8576
|
this.tickAutoScroll();
|
|
8534
8577
|
}
|
|
8535
8578
|
addGlobalDragListeners(pointerId) {
|
|
@@ -9945,7 +9988,7 @@ function SelectionToolbar({ view, state, selectionRect }) {
|
|
|
9945
9988
|
TBtn,
|
|
9946
9989
|
{
|
|
9947
9990
|
active: isStrike,
|
|
9948
|
-
title: "Strikethrough (Cmd+Shift+
|
|
9991
|
+
title: "Strikethrough (Cmd+Shift+S)",
|
|
9949
9992
|
onMouseDown: () => run(toggleMark2(strikethrough2)),
|
|
9950
9993
|
style: { textDecoration: "line-through" },
|
|
9951
9994
|
children: "S"
|