@constela/core 0.12.0 → 0.12.2
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/README.md +20 -1
- package/dist/index.d.ts +39 -2
- package/dist/index.js +127 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,9 +40,27 @@ All fields except `version`, `state`, `actions`, and `view` are optional.
|
|
|
40
40
|
}
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
### Cookie Expression for Initial Value
|
|
44
|
+
|
|
45
|
+
String state can use a cookie expression to read initial value from cookies (SSR/SSG-safe):
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"theme": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"initial": { "expr": "cookie", "key": "theme", "default": "dark" }
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
- `key`: Cookie name to read
|
|
57
|
+
- `default`: Fallback value when cookie is not set
|
|
58
|
+
- Works in both SSR and client-side rendering
|
|
59
|
+
- Useful for theme persistence, user preferences, etc.
|
|
60
|
+
|
|
43
61
|
## Expression Types
|
|
44
62
|
|
|
45
|
-
|
|
63
|
+
15 expression types for constrained computation:
|
|
46
64
|
|
|
47
65
|
| Type | JSON Example | Description |
|
|
48
66
|
|------|-------------|-------------|
|
|
@@ -60,6 +78,7 @@ All fields except `version`, `state`, `actions`, and `view` are optional.
|
|
|
60
78
|
| `ref` | `{ "expr": "ref", "name": "inputEl" }` | DOM element ref |
|
|
61
79
|
| `style` | `{ "expr": "style", "name": "button", "variants": {...} }` | Style reference |
|
|
62
80
|
| `concat` | `{ "expr": "concat", "items": [...] }` | String concatenation |
|
|
81
|
+
| `cookie` | `{ "expr": "cookie", "key": "theme", "default": "dark" }` | Cookie value (SSR-safe) |
|
|
63
82
|
|
|
64
83
|
**Binary Operators:** `+`, `-`, `*`, `/`, `==`, `!=`, `<`, `<=`, `>`, `>=`, `&&`, `||`
|
|
65
84
|
|
package/dist/index.d.ts
CHANGED
|
@@ -395,7 +395,16 @@ interface FocusStep {
|
|
|
395
395
|
onSuccess?: ActionStep[];
|
|
396
396
|
onError?: ActionStep[];
|
|
397
397
|
}
|
|
398
|
-
|
|
398
|
+
/**
|
|
399
|
+
* If step - conditional action execution
|
|
400
|
+
*/
|
|
401
|
+
interface IfStep {
|
|
402
|
+
do: 'if';
|
|
403
|
+
condition: Expression;
|
|
404
|
+
then: ActionStep[];
|
|
405
|
+
else?: ActionStep[];
|
|
406
|
+
}
|
|
407
|
+
type ActionStep = SetStep | UpdateStep | SetPathStep | FetchStep | StorageStep | ClipboardStep | NavigateStep | ImportStep | CallStep | SubscribeStep | DisposeStep | DomStep | SendStep | CloseStep | DelayStep | IntervalStep | ClearTimerStep | FocusStep | IfStep;
|
|
399
408
|
type LocalActionStep = SetStep | UpdateStep | SetPathStep;
|
|
400
409
|
/**
|
|
401
410
|
* Event handler options for special events like intersect
|
|
@@ -1567,6 +1576,8 @@ declare const astSchema: {
|
|
|
1567
1576
|
readonly $ref: "#/$defs/ClearTimerStep";
|
|
1568
1577
|
}, {
|
|
1569
1578
|
readonly $ref: "#/$defs/FocusStep";
|
|
1579
|
+
}, {
|
|
1580
|
+
readonly $ref: "#/$defs/IfStep";
|
|
1570
1581
|
}];
|
|
1571
1582
|
};
|
|
1572
1583
|
readonly SetStep: {
|
|
@@ -1736,6 +1747,32 @@ declare const astSchema: {
|
|
|
1736
1747
|
};
|
|
1737
1748
|
};
|
|
1738
1749
|
};
|
|
1750
|
+
readonly IfStep: {
|
|
1751
|
+
readonly type: "object";
|
|
1752
|
+
readonly required: readonly ["do", "condition", "then"];
|
|
1753
|
+
readonly additionalProperties: false;
|
|
1754
|
+
readonly properties: {
|
|
1755
|
+
readonly do: {
|
|
1756
|
+
readonly type: "string";
|
|
1757
|
+
readonly const: "if";
|
|
1758
|
+
};
|
|
1759
|
+
readonly condition: {
|
|
1760
|
+
readonly $ref: "#/$defs/Expression";
|
|
1761
|
+
};
|
|
1762
|
+
readonly then: {
|
|
1763
|
+
readonly type: "array";
|
|
1764
|
+
readonly items: {
|
|
1765
|
+
readonly $ref: "#/$defs/ActionStep";
|
|
1766
|
+
};
|
|
1767
|
+
};
|
|
1768
|
+
readonly else: {
|
|
1769
|
+
readonly type: "array";
|
|
1770
|
+
readonly items: {
|
|
1771
|
+
readonly $ref: "#/$defs/ActionStep";
|
|
1772
|
+
};
|
|
1773
|
+
};
|
|
1774
|
+
};
|
|
1775
|
+
};
|
|
1739
1776
|
readonly EventHandler: {
|
|
1740
1777
|
readonly type: "object";
|
|
1741
1778
|
readonly required: readonly ["event", "action"];
|
|
@@ -2024,4 +2061,4 @@ declare const astSchema: {
|
|
|
2024
2061
|
};
|
|
2025
2062
|
};
|
|
2026
2063
|
|
|
2027
|
-
export { type ActionDefinition, type ActionStep, BINARY_OPERATORS, type BinExpr, type BinaryOperator, type BooleanField, CLIPBOARD_OPERATIONS, type CallStep, type ClearTimerStep, type ClipboardOperation, type ClipboardStep, type CloseStep, type CodeNode, type ComponentDef, type ComponentNode, type ComponentsRef, type CompoundVariant, type ConcatExpr, type CondExpr, type ConstelaAst, ConstelaError, type ConstelaProgram, type CookieInitialExpr, DATA_SOURCE_TYPES, DATA_TRANSFORMS, type DataExpr, type DataSource, type DataSourceType, type DataTransform, type DelayStep, type DisposeStep, type DomStep, type EachNode, type ElementNode, type ErrorCode, type ErrorOptions, type EventHandler, type EventHandlerOptions, type Expression, FOCUS_OPERATIONS, type FetchStep, type FocusOperation, type FocusStep, type GetExpr, HTTP_METHODS, type HttpMethod, type IfNode, type ImportExpr, type ImportStep, type IntervalStep, type LayoutProgram, type LifecycleHooks, type ListField, type LitExpr, type LocalActionDefinition, type LocalActionStep, type MarkdownNode, NAVIGATE_TARGETS, type NavigateStep, type NavigateTarget, type NotExpr, type NumberField, type ObjectField, PARAM_TYPES, type ParamDef, type ParamExpr, type ParamType, type PortalNode, type Program, type RefExpr, type RouteDefinition, type RouteExpr, STORAGE_OPERATIONS, STORAGE_TYPES, type SendStep, type SetPathStep, type SetStep, type SlotNode, type StateExpr, type StateField, type StaticPathsDefinition, type StorageOperation, type StorageStep, type StorageType, type StringField, type StyleExpr, type StylePreset, type SubscribeStep, type TextNode, UPDATE_OPERATIONS, type UpdateOperation, type UpdateStep, VALIDITY_PROPERTIES, type ValidationFailure, type ValidationResult, type ValidationSuccess, type ValidityExpr, type ValidityProperty, type VarExpr, type ViewNode, astSchema, createClipboardWriteMissingValueError, createComponentCycleError, createComponentNotFoundError, createComponentPropMissingError, createComponentPropTypeError, createCondElseRequiredError, createDataNotDefinedError, createDuplicateActionError, createDuplicateDefaultSlotError, createDuplicateSlotNameError, createImportsNotDefinedError, createInvalidClipboardOperationError, createInvalidDataSourceError, createInvalidNavigateTargetError, createInvalidSlotNameError, createInvalidStorageOperationError, createInvalidStorageTypeError, createLayoutMissingSlotError, createLayoutNotFoundError, createLocalActionInvalidStepError, createOperationInvalidForTypeError, createOperationMissingFieldError, createOperationUnknownError, createRouteNotDefinedError, createSchemaError, createSlotInLoopError, createStorageSetMissingValueError, createUndefinedActionError, createUndefinedDataError, createUndefinedDataSourceError, createUndefinedImportError, createUndefinedLocalStateError, createUndefinedParamError, createUndefinedRefError, createUndefinedRouteParamError, createUndefinedStateError, createUndefinedStyleError, createUndefinedVarError, createUndefinedVariantError, createUnsupportedVersionError, findSimilarNames, isActionStep, isBinExpr, isBooleanField, isCallStep, isClipboardStep, isCodeNode, isComponentNode, isConcatExpr, isCondExpr, isConstelaError, isCookieInitialExpr, isDataExpr, isDataSource, isDisposeStep, isEachNode, isElementNode, isEventHandler, isExpression, isFetchStep, isFocusStep, isGetExpr, isIfNode, isImportExpr, isImportStep, isLayoutProgram, isLifecycleHooks, isListField, isLitExpr, isLocalActionDefinition, isLocalActionStep, isMarkdownNode, isNamedSlotNode, isNavigateStep, isNotExpr, isNumberField, isObjectField, isParamExpr, isPortalNode, isRefExpr, isRouteDefinition, isRouteExpr, isSetPathStep, isSetStep, isSlotNode, isStateExpr, isStateField, isStaticPathsDefinition, isStorageStep, isStringField, isStyleExpr, isSubscribeStep, isTextNode, isUpdateStep, isValidityExpr, isVarExpr, isViewNode, validateAst };
|
|
2064
|
+
export { type ActionDefinition, type ActionStep, BINARY_OPERATORS, type BinExpr, type BinaryOperator, type BooleanField, CLIPBOARD_OPERATIONS, type CallStep, type ClearTimerStep, type ClipboardOperation, type ClipboardStep, type CloseStep, type CodeNode, type ComponentDef, type ComponentNode, type ComponentsRef, type CompoundVariant, type ConcatExpr, type CondExpr, type ConstelaAst, ConstelaError, type ConstelaProgram, type CookieInitialExpr, DATA_SOURCE_TYPES, DATA_TRANSFORMS, type DataExpr, type DataSource, type DataSourceType, type DataTransform, type DelayStep, type DisposeStep, type DomStep, type EachNode, type ElementNode, type ErrorCode, type ErrorOptions, type EventHandler, type EventHandlerOptions, type Expression, FOCUS_OPERATIONS, type FetchStep, type FocusOperation, type FocusStep, type GetExpr, HTTP_METHODS, type HttpMethod, type IfNode, type IfStep, type ImportExpr, type ImportStep, type IntervalStep, type LayoutProgram, type LifecycleHooks, type ListField, type LitExpr, type LocalActionDefinition, type LocalActionStep, type MarkdownNode, NAVIGATE_TARGETS, type NavigateStep, type NavigateTarget, type NotExpr, type NumberField, type ObjectField, PARAM_TYPES, type ParamDef, type ParamExpr, type ParamType, type PortalNode, type Program, type RefExpr, type RouteDefinition, type RouteExpr, STORAGE_OPERATIONS, STORAGE_TYPES, type SendStep, type SetPathStep, type SetStep, type SlotNode, type StateExpr, type StateField, type StaticPathsDefinition, type StorageOperation, type StorageStep, type StorageType, type StringField, type StyleExpr, type StylePreset, type SubscribeStep, type TextNode, UPDATE_OPERATIONS, type UpdateOperation, type UpdateStep, VALIDITY_PROPERTIES, type ValidationFailure, type ValidationResult, type ValidationSuccess, type ValidityExpr, type ValidityProperty, type VarExpr, type ViewNode, astSchema, createClipboardWriteMissingValueError, createComponentCycleError, createComponentNotFoundError, createComponentPropMissingError, createComponentPropTypeError, createCondElseRequiredError, createDataNotDefinedError, createDuplicateActionError, createDuplicateDefaultSlotError, createDuplicateSlotNameError, createImportsNotDefinedError, createInvalidClipboardOperationError, createInvalidDataSourceError, createInvalidNavigateTargetError, createInvalidSlotNameError, createInvalidStorageOperationError, createInvalidStorageTypeError, createLayoutMissingSlotError, createLayoutNotFoundError, createLocalActionInvalidStepError, createOperationInvalidForTypeError, createOperationMissingFieldError, createOperationUnknownError, createRouteNotDefinedError, createSchemaError, createSlotInLoopError, createStorageSetMissingValueError, createUndefinedActionError, createUndefinedDataError, createUndefinedDataSourceError, createUndefinedImportError, createUndefinedLocalStateError, createUndefinedParamError, createUndefinedRefError, createUndefinedRouteParamError, createUndefinedStateError, createUndefinedStyleError, createUndefinedVarError, createUndefinedVariantError, createUnsupportedVersionError, findSimilarNames, isActionStep, isBinExpr, isBooleanField, isCallStep, isClipboardStep, isCodeNode, isComponentNode, isConcatExpr, isCondExpr, isConstelaError, isCookieInitialExpr, isDataExpr, isDataSource, isDisposeStep, isEachNode, isElementNode, isEventHandler, isExpression, isFetchStep, isFocusStep, isGetExpr, isIfNode, isImportExpr, isImportStep, isLayoutProgram, isLifecycleHooks, isListField, isLitExpr, isLocalActionDefinition, isLocalActionStep, isMarkdownNode, isNamedSlotNode, isNavigateStep, isNotExpr, isNumberField, isObjectField, isParamExpr, isPortalNode, isRefExpr, isRouteDefinition, isRouteExpr, isSetPathStep, isSetStep, isSlotNode, isStateExpr, isStateField, isStaticPathsDefinition, isStorageStep, isStringField, isStyleExpr, isSubscribeStep, isTextNode, isUpdateStep, isValidityExpr, isVarExpr, isViewNode, validateAst };
|
package/dist/index.js
CHANGED
|
@@ -839,10 +839,10 @@ function findSimilarNames(target, candidates, maxDistance = 2) {
|
|
|
839
839
|
function isObject2(value) {
|
|
840
840
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
841
841
|
}
|
|
842
|
-
var VALID_VIEW_KINDS = ["element", "text", "if", "each", "component", "slot", "markdown", "code"];
|
|
843
|
-
var VALID_EXPR_TYPES = ["lit", "state", "var", "bin", "not", "param", "cond", "get", "style"];
|
|
842
|
+
var VALID_VIEW_KINDS = ["element", "text", "if", "each", "component", "slot", "markdown", "code", "portal"];
|
|
843
|
+
var VALID_EXPR_TYPES = ["lit", "state", "var", "bin", "not", "param", "cond", "get", "style", "validity", "index"];
|
|
844
844
|
var VALID_PARAM_TYPES = ["string", "number", "boolean", "json"];
|
|
845
|
-
var VALID_ACTION_TYPES = ["set", "update", "fetch"];
|
|
845
|
+
var VALID_ACTION_TYPES = ["set", "update", "fetch", "delay", "interval", "clearTimer", "focus", "if"];
|
|
846
846
|
var VALID_STATE_TYPES = ["number", "string", "list", "boolean", "object"];
|
|
847
847
|
var VALID_BIN_OPS = BINARY_OPERATORS;
|
|
848
848
|
var VALID_UPDATE_OPS = UPDATE_OPERATIONS;
|
|
@@ -856,7 +856,7 @@ function validateViewNode(node, path) {
|
|
|
856
856
|
return { path: path + "/kind", message: "kind is required" };
|
|
857
857
|
}
|
|
858
858
|
if (!VALID_VIEW_KINDS.includes(kind)) {
|
|
859
|
-
return { path: path + "/kind", message: "must be one of: element, text, if, each, component, slot, markdown, code" };
|
|
859
|
+
return { path: path + "/kind", message: "must be one of: element, text, if, each, component, slot, markdown, code, portal" };
|
|
860
860
|
}
|
|
861
861
|
switch (kind) {
|
|
862
862
|
case "element":
|
|
@@ -955,6 +955,17 @@ function validateViewNode(node, path) {
|
|
|
955
955
|
if (langError) return langError;
|
|
956
956
|
return validateExpression(node["content"], path + "/content");
|
|
957
957
|
}
|
|
958
|
+
case "portal":
|
|
959
|
+
if (typeof node["target"] !== "string") {
|
|
960
|
+
return { path: path + "/target", message: "target is required" };
|
|
961
|
+
}
|
|
962
|
+
if (Array.isArray(node["children"])) {
|
|
963
|
+
for (let i = 0; i < node["children"].length; i++) {
|
|
964
|
+
const error = validateViewNode(node["children"][i], path + "/children/" + i);
|
|
965
|
+
if (error) return error;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
break;
|
|
958
969
|
}
|
|
959
970
|
return null;
|
|
960
971
|
}
|
|
@@ -967,7 +978,7 @@ function validateExpression(expr, path) {
|
|
|
967
978
|
return { path: path + "/expr", message: "expr is required" };
|
|
968
979
|
}
|
|
969
980
|
if (!VALID_EXPR_TYPES.includes(exprType)) {
|
|
970
|
-
return { path: path + "/expr", message: "must be one of: lit, state, var, bin, not, param, cond, get, style" };
|
|
981
|
+
return { path: path + "/expr", message: "must be one of: lit, state, var, bin, not, param, cond, get, style, validity, index" };
|
|
971
982
|
}
|
|
972
983
|
switch (exprType) {
|
|
973
984
|
case "lit":
|
|
@@ -1055,6 +1066,25 @@ function validateExpression(expr, path) {
|
|
|
1055
1066
|
}
|
|
1056
1067
|
}
|
|
1057
1068
|
break;
|
|
1069
|
+
case "validity":
|
|
1070
|
+
if (typeof expr["ref"] !== "string") {
|
|
1071
|
+
return { path: path + "/ref", message: "ref is required" };
|
|
1072
|
+
}
|
|
1073
|
+
break;
|
|
1074
|
+
case "index":
|
|
1075
|
+
if (!("base" in expr)) {
|
|
1076
|
+
return { path: path + "/base", message: "base is required" };
|
|
1077
|
+
}
|
|
1078
|
+
if (!("key" in expr)) {
|
|
1079
|
+
return { path: path + "/key", message: "key is required" };
|
|
1080
|
+
}
|
|
1081
|
+
{
|
|
1082
|
+
const baseError = validateExpression(expr["base"], path + "/base");
|
|
1083
|
+
if (baseError) return baseError;
|
|
1084
|
+
const keyError = validateExpression(expr["key"], path + "/key");
|
|
1085
|
+
if (keyError) return keyError;
|
|
1086
|
+
}
|
|
1087
|
+
break;
|
|
1058
1088
|
}
|
|
1059
1089
|
return null;
|
|
1060
1090
|
}
|
|
@@ -1067,7 +1097,7 @@ function validateActionStep(step, path) {
|
|
|
1067
1097
|
return { path: path + "/do", message: "do is required" };
|
|
1068
1098
|
}
|
|
1069
1099
|
if (!VALID_ACTION_TYPES.includes(doType)) {
|
|
1070
|
-
return { path: path + "/do", message: "must be one of: set, update, fetch" };
|
|
1100
|
+
return { path: path + "/do", message: "must be one of: set, update, fetch, delay, interval, clearTimer, focus, if" };
|
|
1071
1101
|
}
|
|
1072
1102
|
switch (doType) {
|
|
1073
1103
|
case "set":
|
|
@@ -1110,6 +1140,78 @@ function validateActionStep(step, path) {
|
|
|
1110
1140
|
if (bodyError) return bodyError;
|
|
1111
1141
|
}
|
|
1112
1142
|
break;
|
|
1143
|
+
case "delay":
|
|
1144
|
+
if (!("ms" in step)) {
|
|
1145
|
+
return { path: path + "/ms", message: "ms is required" };
|
|
1146
|
+
}
|
|
1147
|
+
if (!("then" in step)) {
|
|
1148
|
+
return { path: path + "/then", message: "then is required" };
|
|
1149
|
+
}
|
|
1150
|
+
{
|
|
1151
|
+
const msError = validateExpression(step["ms"], path + "/ms");
|
|
1152
|
+
if (msError) return msError;
|
|
1153
|
+
if (!Array.isArray(step["then"])) {
|
|
1154
|
+
return { path: path + "/then", message: "then must be an array" };
|
|
1155
|
+
}
|
|
1156
|
+
for (let i = 0; i < step["then"].length; i++) {
|
|
1157
|
+
const thenError = validateActionStep(step["then"][i], path + "/then/" + i);
|
|
1158
|
+
if (thenError) return thenError;
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
break;
|
|
1162
|
+
case "interval":
|
|
1163
|
+
if (!("ms" in step)) {
|
|
1164
|
+
return { path: path + "/ms", message: "ms is required" };
|
|
1165
|
+
}
|
|
1166
|
+
if (typeof step["action"] !== "string") {
|
|
1167
|
+
return { path: path + "/action", message: "action is required" };
|
|
1168
|
+
}
|
|
1169
|
+
{
|
|
1170
|
+
const msError = validateExpression(step["ms"], path + "/ms");
|
|
1171
|
+
if (msError) return msError;
|
|
1172
|
+
}
|
|
1173
|
+
break;
|
|
1174
|
+
case "clearTimer":
|
|
1175
|
+
if (!("target" in step)) {
|
|
1176
|
+
return { path: path + "/target", message: "target is required" };
|
|
1177
|
+
}
|
|
1178
|
+
return validateExpression(step["target"], path + "/target");
|
|
1179
|
+
case "focus":
|
|
1180
|
+
if (!("target" in step)) {
|
|
1181
|
+
return { path: path + "/target", message: "target is required" };
|
|
1182
|
+
}
|
|
1183
|
+
if (typeof step["operation"] !== "string") {
|
|
1184
|
+
return { path: path + "/operation", message: "operation is required" };
|
|
1185
|
+
}
|
|
1186
|
+
return validateExpression(step["target"], path + "/target");
|
|
1187
|
+
case "if":
|
|
1188
|
+
if (!("condition" in step)) {
|
|
1189
|
+
return { path: path + "/condition", message: "condition is required" };
|
|
1190
|
+
}
|
|
1191
|
+
if (!("then" in step)) {
|
|
1192
|
+
return { path: path + "/then", message: "then is required" };
|
|
1193
|
+
}
|
|
1194
|
+
{
|
|
1195
|
+
const condError = validateExpression(step["condition"], path + "/condition");
|
|
1196
|
+
if (condError) return condError;
|
|
1197
|
+
if (!Array.isArray(step["then"])) {
|
|
1198
|
+
return { path: path + "/then", message: "then must be an array" };
|
|
1199
|
+
}
|
|
1200
|
+
for (let i = 0; i < step["then"].length; i++) {
|
|
1201
|
+
const thenError = validateActionStep(step["then"][i], path + "/then/" + i);
|
|
1202
|
+
if (thenError) return thenError;
|
|
1203
|
+
}
|
|
1204
|
+
if ("else" in step) {
|
|
1205
|
+
if (!Array.isArray(step["else"])) {
|
|
1206
|
+
return { path: path + "/else", message: "else must be an array" };
|
|
1207
|
+
}
|
|
1208
|
+
for (let i = 0; i < step["else"].length; i++) {
|
|
1209
|
+
const elseError = validateActionStep(step["else"][i], path + "/else/" + i);
|
|
1210
|
+
if (elseError) return elseError;
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
break;
|
|
1113
1215
|
}
|
|
1114
1216
|
return null;
|
|
1115
1217
|
}
|
|
@@ -1764,7 +1866,8 @@ var astSchema = {
|
|
|
1764
1866
|
{ $ref: "#/$defs/DelayStep" },
|
|
1765
1867
|
{ $ref: "#/$defs/IntervalStep" },
|
|
1766
1868
|
{ $ref: "#/$defs/ClearTimerStep" },
|
|
1767
|
-
{ $ref: "#/$defs/FocusStep" }
|
|
1869
|
+
{ $ref: "#/$defs/FocusStep" },
|
|
1870
|
+
{ $ref: "#/$defs/IfStep" }
|
|
1768
1871
|
]
|
|
1769
1872
|
},
|
|
1770
1873
|
SetStep: {
|
|
@@ -1871,6 +1974,23 @@ var astSchema = {
|
|
|
1871
1974
|
}
|
|
1872
1975
|
}
|
|
1873
1976
|
},
|
|
1977
|
+
IfStep: {
|
|
1978
|
+
type: "object",
|
|
1979
|
+
required: ["do", "condition", "then"],
|
|
1980
|
+
additionalProperties: false,
|
|
1981
|
+
properties: {
|
|
1982
|
+
do: { type: "string", const: "if" },
|
|
1983
|
+
condition: { $ref: "#/$defs/Expression" },
|
|
1984
|
+
then: {
|
|
1985
|
+
type: "array",
|
|
1986
|
+
items: { $ref: "#/$defs/ActionStep" }
|
|
1987
|
+
},
|
|
1988
|
+
else: {
|
|
1989
|
+
type: "array",
|
|
1990
|
+
items: { $ref: "#/$defs/ActionStep" }
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
},
|
|
1874
1994
|
// ==================== Event Handler ====================
|
|
1875
1995
|
EventHandler: {
|
|
1876
1996
|
type: "object",
|