@sendbird/actionbook-core 0.10.12 → 0.10.14
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.js +74 -61
- package/dist/index.js.map +1 -1
- package/dist/ui/index.js +30 -12
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
package/dist/ui/index.js
CHANGED
|
@@ -3501,10 +3501,14 @@ function createEmptyDocGuardPlugin() {
|
|
|
3501
3501
|
return new Plugin2({
|
|
3502
3502
|
appendTransaction(_, __, newState) {
|
|
3503
3503
|
const { doc: doc2 } = newState;
|
|
3504
|
+
if (doc2.childCount === 0) {
|
|
3505
|
+
return newState.tr.insert(0, paragraph.create());
|
|
3506
|
+
}
|
|
3504
3507
|
if (doc2.childCount !== 1) return null;
|
|
3505
3508
|
const only = doc2.child(0);
|
|
3506
3509
|
if (only.type === paragraph) return null;
|
|
3507
3510
|
if (only.content.size !== 0) return null;
|
|
3511
|
+
if (only.type === heading) return null;
|
|
3508
3512
|
return newState.tr.setNodeMarkup(0, paragraph);
|
|
3509
3513
|
}
|
|
3510
3514
|
});
|
|
@@ -4786,6 +4790,20 @@ function analyzeJinjaBlocks(doc2) {
|
|
|
4786
4790
|
}
|
|
4787
4791
|
|
|
4788
4792
|
// src/jinja/evaluator.ts
|
|
4793
|
+
var ERROR_MESSAGES = {
|
|
4794
|
+
UNTERMINATED_STRING: "Unfinished statement.",
|
|
4795
|
+
EMPTY_EXPRESSION: "Empty expression.",
|
|
4796
|
+
INVALID_EXPRESSION: "Invalid expression.",
|
|
4797
|
+
unexpectedChar: (char) => `Invalid character. ${char}`,
|
|
4798
|
+
expectedToken: (expected, got) => `Expected ${expected}, got ${got}`,
|
|
4799
|
+
unexpectedToken: (value) => `Invalid text at the end of the statement. ${value}`,
|
|
4800
|
+
unexpectedTokenInPrimary: (type, value) => {
|
|
4801
|
+
if (type === "RPAREN") {
|
|
4802
|
+
return "Missing closing parenthesis.";
|
|
4803
|
+
}
|
|
4804
|
+
return `Missing value.`;
|
|
4805
|
+
}
|
|
4806
|
+
};
|
|
4789
4807
|
var KEYWORDS2 = {
|
|
4790
4808
|
and: "AND",
|
|
4791
4809
|
or: "OR",
|
|
@@ -4820,7 +4838,7 @@ function tokenize(input) {
|
|
|
4820
4838
|
i++;
|
|
4821
4839
|
}
|
|
4822
4840
|
}
|
|
4823
|
-
if (i >= input.length) return { tokens: [], error:
|
|
4841
|
+
if (i >= input.length) return { tokens: [], error: ERROR_MESSAGES.UNTERMINATED_STRING };
|
|
4824
4842
|
i++;
|
|
4825
4843
|
tokens.push({ type: "STRING", value: str });
|
|
4826
4844
|
continue;
|
|
@@ -4908,7 +4926,7 @@ function tokenize(input) {
|
|
|
4908
4926
|
i++;
|
|
4909
4927
|
continue;
|
|
4910
4928
|
}
|
|
4911
|
-
return { tokens: [], error:
|
|
4929
|
+
return { tokens: [], error: ERROR_MESSAGES.unexpectedChar(input[i]) };
|
|
4912
4930
|
}
|
|
4913
4931
|
tokens.push({ type: "EOF", value: "" });
|
|
4914
4932
|
return { tokens };
|
|
@@ -4932,7 +4950,7 @@ var Parser = class {
|
|
|
4932
4950
|
expect(type) {
|
|
4933
4951
|
const t = this.peek();
|
|
4934
4952
|
if (t.type !== type) {
|
|
4935
|
-
throw new Error(
|
|
4953
|
+
throw new Error(ERROR_MESSAGES.expectedToken(type, t.type));
|
|
4936
4954
|
}
|
|
4937
4955
|
return this.advance();
|
|
4938
4956
|
}
|
|
@@ -4946,7 +4964,7 @@ var Parser = class {
|
|
|
4946
4964
|
evaluate() {
|
|
4947
4965
|
const result = this.orExpr();
|
|
4948
4966
|
if (this.peek().type !== "EOF") {
|
|
4949
|
-
throw new Error(
|
|
4967
|
+
throw new Error(ERROR_MESSAGES.unexpectedToken(this.peek().value));
|
|
4950
4968
|
}
|
|
4951
4969
|
return result;
|
|
4952
4970
|
}
|
|
@@ -5058,7 +5076,7 @@ var Parser = class {
|
|
|
5058
5076
|
return val;
|
|
5059
5077
|
}
|
|
5060
5078
|
default:
|
|
5061
|
-
throw new Error(
|
|
5079
|
+
throw new Error(ERROR_MESSAGES.unexpectedTokenInPrimary(t.type, t.value));
|
|
5062
5080
|
}
|
|
5063
5081
|
}
|
|
5064
5082
|
resolveVariable(name) {
|
|
@@ -5104,13 +5122,13 @@ function validateCondition(condition) {
|
|
|
5104
5122
|
if (trimmed === "") return { valid: true };
|
|
5105
5123
|
const { tokens, error: tokenError } = tokenize(trimmed);
|
|
5106
5124
|
if (tokenError) return { valid: false, error: tokenError };
|
|
5107
|
-
if (tokens.length === 0) return { valid: false, error:
|
|
5125
|
+
if (tokens.length === 0) return { valid: false, error: ERROR_MESSAGES.EMPTY_EXPRESSION };
|
|
5108
5126
|
try {
|
|
5109
5127
|
const parser = new Parser(tokens, /* @__PURE__ */ new Map());
|
|
5110
5128
|
parser.evaluate();
|
|
5111
5129
|
return { valid: true };
|
|
5112
5130
|
} catch (e) {
|
|
5113
|
-
const msg = e instanceof Error ? e.message :
|
|
5131
|
+
const msg = e instanceof Error ? e.message : ERROR_MESSAGES.INVALID_EXPRESSION;
|
|
5114
5132
|
return { valid: false, error: msg };
|
|
5115
5133
|
}
|
|
5116
5134
|
}
|
|
@@ -6731,11 +6749,11 @@ function JinjaBranchHeader({
|
|
|
6731
6749
|
}, [menuSource]);
|
|
6732
6750
|
const menuItems = [];
|
|
6733
6751
|
if (editable) {
|
|
6752
|
+
menuItems.push({
|
|
6753
|
+
label: "Else if",
|
|
6754
|
+
onSelect: () => onAddBranch("elif")
|
|
6755
|
+
});
|
|
6734
6756
|
if (!hasElseBranch) {
|
|
6735
|
-
menuItems.push({
|
|
6736
|
-
label: "Else if",
|
|
6737
|
-
onSelect: () => onAddBranch("elif")
|
|
6738
|
-
});
|
|
6739
6757
|
menuItems.push({
|
|
6740
6758
|
label: "Else",
|
|
6741
6759
|
onSelect: () => onAddBranch("else")
|
|
@@ -6746,7 +6764,7 @@ function JinjaBranchHeader({
|
|
|
6746
6764
|
onSelect: onDelete
|
|
6747
6765
|
});
|
|
6748
6766
|
}
|
|
6749
|
-
const canOpenFooterMenu = editable && isLastBranch && branchType !== "else"
|
|
6767
|
+
const canOpenFooterMenu = editable && isLastBranch && branchType !== "else";
|
|
6750
6768
|
const isMenuOpen = (source) => menuSource === source && menuItems.length > 0;
|
|
6751
6769
|
const [conditionTouched, setConditionTouched] = useState3(false);
|
|
6752
6770
|
const conditionError = (() => {
|