@arronqzy/blueprint-dsl 1.0.17 → 1.0.19
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.cjs +855 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +158 -1
- package/dist/index.d.ts +158 -1
- package/dist/index.js +831 -14
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -49,6 +49,7 @@ var ZH_CN = {
|
|
|
49
49
|
lifecycleSignalMissing: "\u751F\u547D\u5468\u671F\u4FE1\u53F7\u7F3A\u5931",
|
|
50
50
|
blueprintCycle: "\u84DD\u56FE\u5F15\u7528\u5B58\u5728\u6B7B\u5FAA\u73AF\uFF1A{path}",
|
|
51
51
|
debugMustStartFromLifecycle: "\u8C03\u8BD5\u4F1A\u8BDD\u53EA\u80FD\u4ECE\u751F\u547D\u5468\u671F\u8282\u70B9\u5F00\u59CB",
|
|
52
|
+
debugLifecycleDisabled: "\u8BE5\u751F\u547D\u5468\u671F\u8282\u70B9\u5DF2\u505C\u7528\uFF1B\u540C\u9636\u6BB5\u8BF7\u6539\u7528\u5DF2\u542F\u7528\u7684\u751F\u547D\u5468\u671F\u8282\u70B9",
|
|
52
53
|
nodeRemoved: "\u8282\u70B9\u5DF2\u4ECE\u84DD\u56FE\u4E2D\u79FB\u9664",
|
|
53
54
|
clockNeedsTrue: "\u65F6\u949F\u8282\u70B9\u9700\u8981\u6536\u5230\u771F\u4FE1\u53F7\u540E\u624D\u4F1A\u542F\u52A8",
|
|
54
55
|
blueprintNeedsTrue: "\u84DD\u56FE\u8282\u70B9\u9700\u8981\u6536\u5230\u771F\u4FE1\u53F7\u540E\u624D\u4F1A\u6267\u884C",
|
|
@@ -59,7 +60,9 @@ var ZH_CN = {
|
|
|
59
60
|
fetchNeedsTrue: "\u6570\u636E\u6E90\u8282\u70B9\u9700\u8981\u6536\u5230\u771F\u4FE1\u53F7\u540E\u624D\u4F1A\u53D1\u8D77\u8BF7\u6C42",
|
|
60
61
|
jsonNeedsTrue: "JSON \u8282\u70B9\u9700\u8981\u6536\u5230\u771F\u4FE1\u53F7\u540E\u624D\u4F1A\u89E3\u6790",
|
|
61
62
|
storageNeedsTrue: "\u5B58\u50A8\u8282\u70B9\u9700\u8981\u6536\u5230\u771F\u4FE1\u53F7\u540E\u624D\u4F1A\u8BFB\u5199\u7F13\u5B58",
|
|
62
|
-
andNeedsBothTrue: "\u5E76\u8FD0\u7B97\uFF1A\u4E24\u4E2A\u8F93\u5165\u987B\u5747\u4E3A\u771F\u4FE1\u53F7"
|
|
63
|
+
andNeedsBothTrue: "\u5E76\u8FD0\u7B97\uFF1A\u4E24\u4E2A\u8F93\u5165\u987B\u5747\u4E3A\u771F\u4FE1\u53F7",
|
|
64
|
+
branchNeedsTrue: "\u5206\u652F\u8282\u70B9\u9700\u8981\u6536\u5230\u771F\u4FE1\u53F7\u540E\u624D\u4F1A\u5224\u65AD\u6761\u4EF6",
|
|
65
|
+
branchExpressionError: "\u5206\u652F\u6761\u4EF6\u8868\u8FBE\u5F0F\u6C42\u503C\u5931\u8D25\uFF1A{reason}"
|
|
63
66
|
};
|
|
64
67
|
var EN_US = {
|
|
65
68
|
invalidJson: "Invalid JSON: {reason}",
|
|
@@ -109,6 +112,7 @@ var EN_US = {
|
|
|
109
112
|
lifecycleSignalMissing: "Lifecycle signal is missing",
|
|
110
113
|
blueprintCycle: "Blueprint references form a cycle: {path}",
|
|
111
114
|
debugMustStartFromLifecycle: "A debug session can only start from a lifecycle node",
|
|
115
|
+
debugLifecycleDisabled: "This lifecycle node is disabled; use the enabled node of the same phase instead",
|
|
112
116
|
nodeRemoved: "Node was removed from the blueprint",
|
|
113
117
|
clockNeedsTrue: "Clock node starts only after receiving a true signal",
|
|
114
118
|
blueprintNeedsTrue: "Blueprint node runs only after receiving a true signal",
|
|
@@ -119,7 +123,9 @@ var EN_US = {
|
|
|
119
123
|
fetchNeedsTrue: "Data source node sends the request only after receiving a true signal",
|
|
120
124
|
jsonNeedsTrue: "JSON node parses only after receiving a true signal",
|
|
121
125
|
storageNeedsTrue: "Storage node reads/writes only after receiving a true signal",
|
|
122
|
-
andNeedsBothTrue: "AND: both inputs must be true signals"
|
|
126
|
+
andNeedsBothTrue: "AND: both inputs must be true signals",
|
|
127
|
+
branchNeedsTrue: "Branch node evaluates only after receiving a true signal",
|
|
128
|
+
branchExpressionError: "Branch condition evaluation failed: {reason}"
|
|
123
129
|
};
|
|
124
130
|
var CATALOGS = {
|
|
125
131
|
"zh-CN": ZH_CN,
|
|
@@ -173,6 +179,108 @@ function createLifecycleSignal(phase) {
|
|
|
173
179
|
isoTime: new Date(timestamp).toISOString()
|
|
174
180
|
};
|
|
175
181
|
}
|
|
182
|
+
function resolveLifecyclePhase(node) {
|
|
183
|
+
const phase = node.lifecyclePhase;
|
|
184
|
+
if (phase && PAGE_LIFECYCLE_PHASES.includes(phase)) {
|
|
185
|
+
return phase;
|
|
186
|
+
}
|
|
187
|
+
return "mounted";
|
|
188
|
+
}
|
|
189
|
+
function isLifecycleGraphNode(node, lifecycleNodeType = "Lifecycle") {
|
|
190
|
+
return node.nodeType === lifecycleNodeType || node.role === "lifecycle";
|
|
191
|
+
}
|
|
192
|
+
function listLifecyclePeers(nodes, phase, lifecycleNodeType = "Lifecycle") {
|
|
193
|
+
return nodes.filter(
|
|
194
|
+
(node) => isLifecycleGraphNode(node, lifecycleNodeType) && resolveLifecyclePhase(node) === phase
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
function hasDuplicateLifecyclePhase(nodes, phase, lifecycleNodeType = "Lifecycle") {
|
|
198
|
+
return listLifecyclePeers(nodes, phase, lifecycleNodeType).length > 1;
|
|
199
|
+
}
|
|
200
|
+
function shouldEmitLifecycleNode(node, nodes, lifecycleNodeType = "Lifecycle") {
|
|
201
|
+
if (!isLifecycleGraphNode(node, lifecycleNodeType)) return false;
|
|
202
|
+
const peers = listLifecyclePeers(
|
|
203
|
+
nodes,
|
|
204
|
+
resolveLifecyclePhase(node),
|
|
205
|
+
lifecycleNodeType
|
|
206
|
+
);
|
|
207
|
+
if (peers.length <= 1) return true;
|
|
208
|
+
return node.lifecycleEnabled !== false;
|
|
209
|
+
}
|
|
210
|
+
function defaultLifecycleEnabledForNewNode(nodes, phase, lifecycleNodeType = "Lifecycle") {
|
|
211
|
+
return listLifecyclePeers(nodes, phase, lifecycleNodeType).length === 0;
|
|
212
|
+
}
|
|
213
|
+
function findEmittableLifecycleNodeId(nodes, preferredId, lifecycleNodeType = "Lifecycle") {
|
|
214
|
+
if (preferredId) {
|
|
215
|
+
const preferred = nodes.find((node) => node.id === preferredId);
|
|
216
|
+
if (preferred && shouldEmitLifecycleNode(preferred, nodes, lifecycleNodeType)) {
|
|
217
|
+
return preferredId;
|
|
218
|
+
}
|
|
219
|
+
if (preferred && isLifecycleGraphNode(preferred, lifecycleNodeType)) {
|
|
220
|
+
const peer = listLifecyclePeers(
|
|
221
|
+
nodes,
|
|
222
|
+
resolveLifecyclePhase(preferred),
|
|
223
|
+
lifecycleNodeType
|
|
224
|
+
).find(
|
|
225
|
+
(candidate) => shouldEmitLifecycleNode(candidate, nodes, lifecycleNodeType)
|
|
226
|
+
);
|
|
227
|
+
if (peer) return peer.id;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const first = nodes.find(
|
|
231
|
+
(node) => isLifecycleGraphNode(node, lifecycleNodeType) && shouldEmitLifecycleNode(node, nodes, lifecycleNodeType)
|
|
232
|
+
);
|
|
233
|
+
return first?.id ?? null;
|
|
234
|
+
}
|
|
235
|
+
function reconcileLifecycleEnabled(nodes, focusNodeId, enabled, lifecycleNodeType = "Lifecycle") {
|
|
236
|
+
if (focusNodeId && enabled === true) {
|
|
237
|
+
const focus = nodes.find((node) => node.id === focusNodeId);
|
|
238
|
+
if (!focus || !isLifecycleGraphNode(focus, lifecycleNodeType)) {
|
|
239
|
+
return [...nodes];
|
|
240
|
+
}
|
|
241
|
+
const phase = resolveLifecyclePhase(focus);
|
|
242
|
+
return nodes.map((node) => {
|
|
243
|
+
if (!isLifecycleGraphNode(node, lifecycleNodeType)) return node;
|
|
244
|
+
if (resolveLifecyclePhase(node) !== phase) return node;
|
|
245
|
+
if (node.id === focusNodeId) {
|
|
246
|
+
return node.lifecycleEnabled === true ? node : { ...node, lifecycleEnabled: true };
|
|
247
|
+
}
|
|
248
|
+
return node.lifecycleEnabled === false ? node : { ...node, lifecycleEnabled: false };
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
if (focusNodeId && enabled === false) {
|
|
252
|
+
return nodes.map(
|
|
253
|
+
(node) => node.id === focusNodeId ? node.lifecycleEnabled === false ? node : { ...node, lifecycleEnabled: false } : node
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
let next = [...nodes];
|
|
257
|
+
const phases = new Set(
|
|
258
|
+
nodes.filter((node) => isLifecycleGraphNode(node, lifecycleNodeType)).map((node) => resolveLifecyclePhase(node))
|
|
259
|
+
);
|
|
260
|
+
for (const phase of phases) {
|
|
261
|
+
const peers = listLifecyclePeers(next, phase, lifecycleNodeType);
|
|
262
|
+
if (peers.length <= 1) continue;
|
|
263
|
+
const enabledPeers = peers.filter((peer) => peer.lifecycleEnabled !== false);
|
|
264
|
+
if (enabledPeers.length === 0) {
|
|
265
|
+
next = next.map((node) => {
|
|
266
|
+
if (!isLifecycleGraphNode(node, lifecycleNodeType)) return node;
|
|
267
|
+
if (resolveLifecyclePhase(node) !== phase) return node;
|
|
268
|
+
return node.lifecycleEnabled === false ? node : { ...node, lifecycleEnabled: false };
|
|
269
|
+
});
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
const keepId = enabledPeers[0].id;
|
|
273
|
+
next = next.map((node) => {
|
|
274
|
+
if (!isLifecycleGraphNode(node, lifecycleNodeType)) return node;
|
|
275
|
+
if (resolveLifecyclePhase(node) !== phase) return node;
|
|
276
|
+
if (node.id === keepId) {
|
|
277
|
+
return node.lifecycleEnabled === true ? node : { ...node, lifecycleEnabled: true };
|
|
278
|
+
}
|
|
279
|
+
return node.lifecycleEnabled === false ? node : { ...node, lifecycleEnabled: false };
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
return next;
|
|
283
|
+
}
|
|
176
284
|
|
|
177
285
|
// src/node-signal.ts
|
|
178
286
|
function isTrueSignal(signal) {
|
|
@@ -893,6 +1001,16 @@ var SYSTEM_LOCATION_KEYS = [
|
|
|
893
1001
|
"replace",
|
|
894
1002
|
"toString"
|
|
895
1003
|
];
|
|
1004
|
+
var SYSTEM_TOOLS_KEYS = [
|
|
1005
|
+
"str",
|
|
1006
|
+
"int",
|
|
1007
|
+
"sum",
|
|
1008
|
+
"len",
|
|
1009
|
+
"pick",
|
|
1010
|
+
"replace",
|
|
1011
|
+
"replaceAll",
|
|
1012
|
+
"exclude"
|
|
1013
|
+
];
|
|
896
1014
|
function createLocationStub() {
|
|
897
1015
|
return {
|
|
898
1016
|
href: "",
|
|
@@ -915,12 +1033,152 @@ function createLocationStub() {
|
|
|
915
1033
|
}
|
|
916
1034
|
};
|
|
917
1035
|
}
|
|
1036
|
+
function flattenToolArgs(values) {
|
|
1037
|
+
const out = [];
|
|
1038
|
+
for (const value of values) {
|
|
1039
|
+
if (Array.isArray(value)) {
|
|
1040
|
+
out.push(...flattenToolArgs(value));
|
|
1041
|
+
} else {
|
|
1042
|
+
out.push(value);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
return out;
|
|
1046
|
+
}
|
|
1047
|
+
function toIndexList(values) {
|
|
1048
|
+
const out = [];
|
|
1049
|
+
for (const value of flattenToolArgs(values)) {
|
|
1050
|
+
const n = typeof value === "number" ? value : Number(value);
|
|
1051
|
+
if (Number.isInteger(n) && n >= 0) {
|
|
1052
|
+
out.push(n);
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
return out;
|
|
1056
|
+
}
|
|
1057
|
+
function valuesEqual(a, b) {
|
|
1058
|
+
return Object.is(a, b);
|
|
1059
|
+
}
|
|
1060
|
+
function replaceInArray(list, target, source, all) {
|
|
1061
|
+
if (all) {
|
|
1062
|
+
return list.map((item) => valuesEqual(item, target) ? source : item);
|
|
1063
|
+
}
|
|
1064
|
+
const out = list.slice();
|
|
1065
|
+
const idx = out.findIndex((item) => valuesEqual(item, target));
|
|
1066
|
+
if (idx >= 0) {
|
|
1067
|
+
out[idx] = source;
|
|
1068
|
+
}
|
|
1069
|
+
return out;
|
|
1070
|
+
}
|
|
1071
|
+
function replaceInString(text, target, source, all) {
|
|
1072
|
+
const from = target === void 0 || target === null ? "" : String(target);
|
|
1073
|
+
const to = source === void 0 || source === null ? "" : String(source);
|
|
1074
|
+
if (from.length === 0) {
|
|
1075
|
+
return text;
|
|
1076
|
+
}
|
|
1077
|
+
if (!all) {
|
|
1078
|
+
const at = text.indexOf(from);
|
|
1079
|
+
if (at < 0) return text;
|
|
1080
|
+
return text.slice(0, at) + to + text.slice(at + from.length);
|
|
1081
|
+
}
|
|
1082
|
+
return text.split(from).join(to);
|
|
1083
|
+
}
|
|
1084
|
+
function createSystemTools() {
|
|
1085
|
+
return {
|
|
1086
|
+
str(value) {
|
|
1087
|
+
if (value === void 0 || value === null) return "";
|
|
1088
|
+
if (typeof value === "string") return value;
|
|
1089
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
1090
|
+
return String(value);
|
|
1091
|
+
}
|
|
1092
|
+
if (esm_default.isDayjs(value)) {
|
|
1093
|
+
return value.toISOString();
|
|
1094
|
+
}
|
|
1095
|
+
try {
|
|
1096
|
+
return JSON.stringify(value);
|
|
1097
|
+
} catch {
|
|
1098
|
+
return String(value);
|
|
1099
|
+
}
|
|
1100
|
+
},
|
|
1101
|
+
int(value) {
|
|
1102
|
+
if (typeof value === "number") return value;
|
|
1103
|
+
if (typeof value === "bigint") return Number(value);
|
|
1104
|
+
if (typeof value === "boolean") return value ? 1 : 0;
|
|
1105
|
+
if (value === void 0 || value === null || value === "") return NaN;
|
|
1106
|
+
return Number(value);
|
|
1107
|
+
},
|
|
1108
|
+
sum(...values) {
|
|
1109
|
+
const flat = flattenToolArgs(values);
|
|
1110
|
+
if (flat.length === 0) return 0;
|
|
1111
|
+
const hasString = flat.some((item) => typeof item === "string");
|
|
1112
|
+
if (hasString) {
|
|
1113
|
+
let result = flat[0];
|
|
1114
|
+
for (let i = 1; i < flat.length; i += 1) {
|
|
1115
|
+
result = result + flat[i];
|
|
1116
|
+
}
|
|
1117
|
+
return result;
|
|
1118
|
+
}
|
|
1119
|
+
return flat.reduce((acc, item) => {
|
|
1120
|
+
const n = typeof item === "number" ? item : Number(item);
|
|
1121
|
+
return acc + (Number.isFinite(n) ? n : 0);
|
|
1122
|
+
}, 0);
|
|
1123
|
+
},
|
|
1124
|
+
len(value) {
|
|
1125
|
+
if (typeof value === "string") return value.length;
|
|
1126
|
+
if (Array.isArray(value)) return value.length;
|
|
1127
|
+
if (value === void 0 || value === null) return 0;
|
|
1128
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
1129
|
+
return String(value).length;
|
|
1130
|
+
}
|
|
1131
|
+
try {
|
|
1132
|
+
return JSON.stringify(value).length;
|
|
1133
|
+
} catch {
|
|
1134
|
+
return String(value).length;
|
|
1135
|
+
}
|
|
1136
|
+
},
|
|
1137
|
+
pick(value, ...indices) {
|
|
1138
|
+
const idxs = toIndexList(indices);
|
|
1139
|
+
if (Array.isArray(value)) {
|
|
1140
|
+
return idxs.filter((i) => i < value.length).map((i) => value[i]);
|
|
1141
|
+
}
|
|
1142
|
+
const text = typeof value === "string" ? value : value == null ? "" : String(value);
|
|
1143
|
+
return idxs.filter((i) => i < text.length).map((i) => text[i]).join("");
|
|
1144
|
+
},
|
|
1145
|
+
replace(value, target, source) {
|
|
1146
|
+
if (Array.isArray(value)) {
|
|
1147
|
+
return replaceInArray(value, target, source, false);
|
|
1148
|
+
}
|
|
1149
|
+
const text = typeof value === "string" ? value : value == null ? "" : String(value);
|
|
1150
|
+
return replaceInString(text, target, source, false);
|
|
1151
|
+
},
|
|
1152
|
+
replaceAll(value, target, source) {
|
|
1153
|
+
if (Array.isArray(value)) {
|
|
1154
|
+
return replaceInArray(value, target, source, true);
|
|
1155
|
+
}
|
|
1156
|
+
const text = typeof value === "string" ? value : value == null ? "" : String(value);
|
|
1157
|
+
return replaceInString(text, target, source, true);
|
|
1158
|
+
},
|
|
1159
|
+
exclude(value, ...indices) {
|
|
1160
|
+
const remove = new Set(toIndexList(indices));
|
|
1161
|
+
if (Array.isArray(value)) {
|
|
1162
|
+
return value.filter((_, i) => !remove.has(i));
|
|
1163
|
+
}
|
|
1164
|
+
const text = typeof value === "string" ? value : value == null ? "" : String(value);
|
|
1165
|
+
let out = "";
|
|
1166
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
1167
|
+
if (!remove.has(i)) {
|
|
1168
|
+
out += text[i];
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
return out;
|
|
1172
|
+
}
|
|
1173
|
+
};
|
|
1174
|
+
}
|
|
918
1175
|
function createSystemRoot() {
|
|
919
1176
|
const locationValue = typeof globalThis !== "undefined" && "location" in globalThis && globalThis.location ? globalThis.location : createLocationStub();
|
|
920
1177
|
return {
|
|
921
1178
|
time: esm_default(),
|
|
922
1179
|
math: Math,
|
|
923
|
-
location: locationValue
|
|
1180
|
+
location: locationValue,
|
|
1181
|
+
tools: createSystemTools()
|
|
924
1182
|
};
|
|
925
1183
|
}
|
|
926
1184
|
function getSystemAutocompleteTree() {
|
|
@@ -936,10 +1194,15 @@ function getSystemAutocompleteTree() {
|
|
|
936
1194
|
for (const name of SYSTEM_LOCATION_KEYS) {
|
|
937
1195
|
locationKeys[name] = /* @__PURE__ */ Object.create(null);
|
|
938
1196
|
}
|
|
1197
|
+
const toolsKeys = {};
|
|
1198
|
+
for (const name of SYSTEM_TOOLS_KEYS) {
|
|
1199
|
+
toolsKeys[name] = /* @__PURE__ */ Object.create(null);
|
|
1200
|
+
}
|
|
939
1201
|
return {
|
|
940
1202
|
time: timeMethods,
|
|
941
1203
|
math: mathKeys,
|
|
942
|
-
location: locationKeys
|
|
1204
|
+
location: locationKeys,
|
|
1205
|
+
tools: toolsKeys
|
|
943
1206
|
};
|
|
944
1207
|
}
|
|
945
1208
|
function isDayjsValue(value) {
|
|
@@ -1230,6 +1493,459 @@ async function executeFetch(config, options) {
|
|
|
1230
1493
|
}
|
|
1231
1494
|
}
|
|
1232
1495
|
|
|
1496
|
+
// src/template-docs.ts
|
|
1497
|
+
var zh = (zhCN, enUS) => ({
|
|
1498
|
+
"zh-CN": zhCN,
|
|
1499
|
+
"en-US": enUS
|
|
1500
|
+
});
|
|
1501
|
+
var TEMPLATE_DOC_LINK_RE = /\{(?:scope|system)[^}]*\}|\b(?:scope|system)\?\.[\w$]+(?:\?\.[\w$]+)*/g;
|
|
1502
|
+
var SYSTEM_SECTIONS = /* @__PURE__ */ new Set(["time", "math", "location", "tools"]);
|
|
1503
|
+
var SCOPE_FIELDS = /* @__PURE__ */ new Set(["value", "id", "name", "type"]);
|
|
1504
|
+
function docText(text, locale) {
|
|
1505
|
+
return locale === "en-US" ? text["en-US"] : text["zh-CN"];
|
|
1506
|
+
}
|
|
1507
|
+
function resolveTemplateDocTarget(token) {
|
|
1508
|
+
const inner = (token.startsWith("{") ? token.slice(1, -1) : token).trim();
|
|
1509
|
+
const root = inner.startsWith("system") ? "system" : "scope";
|
|
1510
|
+
const member = /^(?:system|scope)\?\.([A-Za-z_$][\w$]*)/.exec(inner)?.[1];
|
|
1511
|
+
if (root === "system") {
|
|
1512
|
+
return {
|
|
1513
|
+
root,
|
|
1514
|
+
sectionId: member && SYSTEM_SECTIONS.has(member) ? member : "overview"
|
|
1515
|
+
};
|
|
1516
|
+
}
|
|
1517
|
+
if (inner.includes("[...")) return { root, sectionId: "spread" };
|
|
1518
|
+
if (member && SCOPE_FIELDS.has(member)) return { root, sectionId: "fields" };
|
|
1519
|
+
if (member) return { root, sectionId: "multi" };
|
|
1520
|
+
return { root, sectionId: "overview" };
|
|
1521
|
+
}
|
|
1522
|
+
function splitTemplateDocLinks(text) {
|
|
1523
|
+
const pieces = [];
|
|
1524
|
+
let last = 0;
|
|
1525
|
+
for (const match of text.matchAll(TEMPLATE_DOC_LINK_RE)) {
|
|
1526
|
+
const index = match.index ?? 0;
|
|
1527
|
+
if (index > last) {
|
|
1528
|
+
pieces.push({ type: "text", text: text.slice(last, index) });
|
|
1529
|
+
}
|
|
1530
|
+
const token = match[0];
|
|
1531
|
+
const target = resolveTemplateDocTarget(token);
|
|
1532
|
+
pieces.push({ type: "link", text: token, ...target });
|
|
1533
|
+
last = index + token.length;
|
|
1534
|
+
}
|
|
1535
|
+
if (last < text.length) {
|
|
1536
|
+
pieces.push({ type: "text", text: text.slice(last) });
|
|
1537
|
+
}
|
|
1538
|
+
if (pieces.length === 0) pieces.push({ type: "text", text });
|
|
1539
|
+
return pieces;
|
|
1540
|
+
}
|
|
1541
|
+
var TEMPLATE_DOC_CHROME = {
|
|
1542
|
+
searchPlaceholder: zh("\u641C\u7D22\u540D\u79F0\u3001\u7528\u6CD5\u6216\u4F8B\u5B50", "Search name, usage, or examples"),
|
|
1543
|
+
empty: zh("\u6CA1\u6709\u5339\u914D\u7684\u8BF4\u660E", "No matching docs"),
|
|
1544
|
+
examples: zh("\u4F8B\u5B50", "Examples"),
|
|
1545
|
+
members: zh("\u6210\u5458", "Members"),
|
|
1546
|
+
current: zh("\u5F53\u524D", "Opened from"),
|
|
1547
|
+
pluginNote: zh(
|
|
1548
|
+
"\u8054\u60F3\u91CC\u8FD8\u4F1A\u51FA\u73B0 weekday\u3001isoWeek\u3001quarter\u3001fromNow\u3001calendar\u3001utc\u3001isLeapYear\u3001toArray\u3001toObject \u7B49\u540D\u5B57\u3002\u5F53\u524D\u6253\u5305\u7684\u662F dayjs \u6838\u5FC3\uFF0C\u6CA1\u6709\u6302\u8FD9\u4E9B\u63D2\u4EF6\uFF0C\u5199\u8FDB\u6A21\u677F\u4E0D\u4F1A\u751F\u6548\u3002",
|
|
1549
|
+
"Autocomplete may also list weekday, isoWeek, quarter, fromNow, calendar, utc, isLeapYear, toArray, and toObject. The bundled dayjs is core-only, so those plugin methods do nothing in templates."
|
|
1550
|
+
)
|
|
1551
|
+
};
|
|
1552
|
+
var TIME_MEMBERS = [
|
|
1553
|
+
{ name: "format", summary: zh("\u6309\u683C\u5F0F\u4E32\u8F93\u51FA\u6587\u672C\u3002\u5E38\u7528 YYYY-MM-DD HH:mm:ss\u3002", "Format as text. Common pattern: YYYY-MM-DD HH:mm:ss."), usage: "{system?.time?.format('YYYY-MM-DD HH:mm:ss')}" },
|
|
1554
|
+
{ name: "add", summary: zh("\u52A0\u4E0A\u4E00\u6BB5\u65F6\u95F4\u3002\u5355\u4F4D\uFF1Ayear\u3001month\u3001week\u3001day\u3001hour\u3001minute\u3001second\u3001millisecond\u3002", "Add a duration. Units: year, month, week, day, hour, minute, second, millisecond."), usage: "{system?.time?.add(1,'hour')}" },
|
|
1555
|
+
{ name: "subtract", summary: zh("\u51CF\u53BB\u4E00\u6BB5\u65F6\u95F4\uFF0C\u5355\u4F4D\u540C add\u3002", "Subtract a duration. Same units as add."), usage: "{system?.time?.subtract(7,'d')}" },
|
|
1556
|
+
{ name: "startOf", summary: zh("\u5BF9\u9F50\u5230\u8BE5\u5355\u4F4D\u7684\u8D77\u70B9\uFF0C\u5982\u5F53\u5929 00:00\u3001\u5F53\u6708 1 \u65E5\u3002", "Snap to the start of a unit, such as today 00:00 or the 1st of the month."), usage: "{system?.time?.startOf('day')}" },
|
|
1557
|
+
{ name: "endOf", summary: zh("\u5BF9\u9F50\u5230\u8BE5\u5355\u4F4D\u7684\u7EC8\u70B9\uFF0C\u5982\u5F53\u5929 23:59:59.999\u3002", "Snap to the end of a unit, such as today 23:59:59.999."), usage: "{system?.time?.endOf('month')}" },
|
|
1558
|
+
{ name: "valueOf", summary: zh("\u6BEB\u79D2\u65F6\u95F4\u6233\u3002", "Unix timestamp in milliseconds."), usage: "{system?.time?.valueOf()}" },
|
|
1559
|
+
{ name: "unix", summary: zh("\u79D2\u7EA7\u65F6\u95F4\u6233\u3002", "Unix timestamp in seconds."), usage: "{system?.time?.unix()}" },
|
|
1560
|
+
{ name: "diff", summary: zh("\u4E0E\u53E6\u4E00\u4E2A\u65F6\u95F4\u7684\u5DEE\u503C\u3002\u7B2C\u4E09\u53C2 true \u65F6\u4FDD\u7559\u5C0F\u6570\u3002", "Difference from another time. Pass true as the third argument for a float."), usage: "{system?.time?.diff(scope?.value,'hour',true)}" },
|
|
1561
|
+
{ name: "set", summary: zh("\u628A\u67D0\u4E2A\u5355\u4F4D\u8BBE\u6210\u6307\u5B9A\u6570\u5B57\uFF0C\u8FD4\u56DE\u65B0\u65F6\u95F4\u3002", "Set one unit to a number and return a new time."), usage: "{system?.time?.set('hour', 8)}" },
|
|
1562
|
+
{ name: "get", summary: zh("\u8BFB\u53D6\u67D0\u4E2A\u5355\u4F4D\u3002month \u4ECE 0 \u5F00\u59CB\u3002", "Read one unit. month is 0-based."), usage: "{system?.time?.get('year')}" },
|
|
1563
|
+
{ name: "year", summary: zh("\u5E74\u3002\u4E0D\u4F20\u53C2\u662F\u8BFB\u53D6\uFF0C\u4F20\u6570\u5B57\u662F\u8BBE\u7F6E\u3002", "Year. No argument reads it; a number sets it."), usage: "{system?.time?.year()}" },
|
|
1564
|
+
{ name: "month", summary: zh("\u6708\uFF0C0 \u662F\u4E00\u6708\u3002", "Month. 0 is January."), usage: "{system?.time?.month()}" },
|
|
1565
|
+
{ name: "date", summary: zh("\u65E5\uFF0C1\u201331\u3002", "Day of month, 1\u201331."), usage: "{system?.time?.date()}" },
|
|
1566
|
+
{ name: "day", summary: zh("\u661F\u671F\uFF0C0 \u662F\u5468\u65E5\u3002", "Day of week. 0 is Sunday."), usage: "{system?.time?.day()}" },
|
|
1567
|
+
{ name: "hour", summary: zh("\u65F6\uFF0C0\u201323\u3002", "Hour, 0\u201323."), usage: "{system?.time?.hour()}" },
|
|
1568
|
+
{ name: "minute", summary: zh("\u5206\u3002", "Minute."), usage: "{system?.time?.minute()}" },
|
|
1569
|
+
{ name: "second", summary: zh("\u79D2\u3002", "Second."), usage: "{system?.time?.second()}" },
|
|
1570
|
+
{ name: "millisecond", summary: zh("\u6BEB\u79D2\u3002", "Millisecond."), usage: "{system?.time?.millisecond()}" },
|
|
1571
|
+
{ name: "daysInMonth", summary: zh("\u8FD9\u4E2A\u6708\u6709\u591A\u5C11\u5929\u3002", "How many days are in this month."), usage: "{system?.time?.daysInMonth()}" },
|
|
1572
|
+
{ name: "toISOString", summary: zh("ISO 8601 \u5B57\u7B26\u4E32\u3002\u4E0D\u8C03\u7528\u65B9\u6CD5\u3001\u76F4\u63A5\u5199 {system?.time} \u65F6\uFF0C\u5D4C\u8FDB\u5B57\u7B26\u4E32\u4E5F\u4F1A\u53D8\u6210 ISO \u65F6\u95F4\u3002", "ISO 8601 string. A bare {system?.time} inside a string also becomes an ISO time."), usage: "{system?.time?.toISOString()}" },
|
|
1573
|
+
{ name: "toJSON", summary: zh("\u540C toISOString\uFF0C\u4FBF\u4E8E\u653E\u8FDB JSON\u3002", "Same as toISOString, suitable inside JSON."), usage: "{system?.time?.toJSON()}" },
|
|
1574
|
+
{ name: "toDate", summary: zh("\u53D8\u6210 JS Date\u3002\u7EE7\u7EED\u5D4C\u5728\u5B57\u7B26\u4E32\u91CC\u65F6\u4F1A\u53D8\u6210\u65E5\u671F\u6587\u672C\u3002", "Native JS Date. Inside a string it becomes date text."), usage: "{system?.time?.toDate()}" },
|
|
1575
|
+
{ name: "toString", summary: zh("UTC \u65E5\u671F\u5B57\u7B26\u4E32\u3002", "UTC date string."), usage: "{system?.time?.toString()}" },
|
|
1576
|
+
{ name: "utcOffset", summary: zh("\u5F53\u524D\u65F6\u533A\u76F8\u5BF9 UTC \u7684\u5206\u949F\u504F\u79FB\u3002", "Local timezone offset from UTC, in minutes."), usage: "{system?.time?.utcOffset()}" },
|
|
1577
|
+
{ name: "isBefore", summary: zh("\u662F\u5426\u65E9\u4E8E\u53E6\u4E00\u4E2A\u65F6\u95F4\u3002", "Whether this time is before another."), usage: "{system?.time?.isBefore(scope?.value)}" },
|
|
1578
|
+
{ name: "isAfter", summary: zh("\u662F\u5426\u665A\u4E8E\u53E6\u4E00\u4E2A\u65F6\u95F4\u3002", "Whether this time is after another."), usage: "{system?.time?.isAfter(scope?.value)}" },
|
|
1579
|
+
{ name: "isSame", summary: zh("\u662F\u5426\u540C\u4E00\u65F6\u523B\u3002\u7B2C\u4E8C\u53C2\u53EF\u6307\u5B9A\u6BD4\u8F83\u5230\u54EA\u4E00\u7EA7\uFF0C\u5982 'day'\u3002", "Whether two times match. The second argument can limit the unit, such as 'day'."), usage: "{system?.time?.isSame(scope?.value,'day')}" },
|
|
1580
|
+
{ name: "isValid", summary: zh("\u5F53\u524D\u65F6\u95F4\u5BF9\u8C61\u662F\u5426\u6709\u6548\u3002", "Whether this time is valid."), usage: "{system?.time?.isValid()}" },
|
|
1581
|
+
{ name: "clone", summary: zh("\u590D\u5236\u4E00\u4EFD\uFF0C\u907F\u514D\u540E\u7EED\u4FEE\u6539\u5F71\u54CD\u539F\u503C\u3002", "Copy so later changes do not affect the original."), usage: "{system?.time?.clone()}" },
|
|
1582
|
+
{ name: "locale", summary: zh("\u8BFB\u53D6\u6216\u5207\u6362 dayjs \u8BED\u8A00\u3002\u5F53\u524D\u53EA\u5185\u7F6E\u4E86 en\u3002", "Read or switch the dayjs locale. Only en is bundled."), usage: "{system?.time?.locale()}" }
|
|
1583
|
+
];
|
|
1584
|
+
var MATH_MEMBERS = [
|
|
1585
|
+
{ name: "E", summary: zh("\u81EA\u7136\u5BF9\u6570\u7684\u5E95\uFF0C\u7EA6 2.718\u3002", "Base of the natural logarithm, about 2.718."), usage: "{system?.math?.E}" },
|
|
1586
|
+
{ name: "LN10", summary: zh("10 \u7684\u81EA\u7136\u5BF9\u6570\u3002", "Natural log of 10."), usage: "{system?.math?.LN10}" },
|
|
1587
|
+
{ name: "LN2", summary: zh("2 \u7684\u81EA\u7136\u5BF9\u6570\u3002", "Natural log of 2."), usage: "{system?.math?.LN2}" },
|
|
1588
|
+
{ name: "LOG10E", summary: zh("\u4EE5 10 \u4E3A\u5E95\uFF0Ce \u7684\u5BF9\u6570\u3002", "Base-10 log of e."), usage: "{system?.math?.LOG10E}" },
|
|
1589
|
+
{ name: "LOG2E", summary: zh("\u4EE5 2 \u4E3A\u5E95\uFF0Ce \u7684\u5BF9\u6570\u3002", "Base-2 log of e."), usage: "{system?.math?.LOG2E}" },
|
|
1590
|
+
{ name: "PI", summary: zh("\u5706\u5468\u7387\u3002", "Pi."), usage: "{system?.math?.PI}" },
|
|
1591
|
+
{ name: "SQRT1_2", summary: zh("1/2 \u7684\u5E73\u65B9\u6839\uFF0C\u7EA6 0.707\u3002", "Square root of 1/2, about 0.707."), usage: "{system?.math?.SQRT1_2}" },
|
|
1592
|
+
{ name: "SQRT2", summary: zh("2 \u7684\u5E73\u65B9\u6839\uFF0C\u7EA6 1.414\u3002", "Square root of 2, about 1.414."), usage: "{system?.math?.SQRT2}" },
|
|
1593
|
+
{ name: "abs", summary: zh("\u7EDD\u5BF9\u503C\u3002", "Absolute value."), usage: "{system?.math?.abs(scope?.value||-3)}" },
|
|
1594
|
+
{ name: "acos", summary: zh("\u53CD\u4F59\u5F26\uFF0C\u7ED3\u679C\u662F\u5F27\u5EA6\u3002", "Arc cosine, in radians."), usage: "{system?.math?.acos(0.5)}" },
|
|
1595
|
+
{ name: "acosh", summary: zh("\u53CD\u53CC\u66F2\u4F59\u5F26\u3002", "Inverse hyperbolic cosine."), usage: "{system?.math?.acosh(2)}" },
|
|
1596
|
+
{ name: "asin", summary: zh("\u53CD\u6B63\u5F26\uFF0C\u7ED3\u679C\u662F\u5F27\u5EA6\u3002", "Arc sine, in radians."), usage: "{system?.math?.asin(0.5)}" },
|
|
1597
|
+
{ name: "asinh", summary: zh("\u53CD\u53CC\u66F2\u6B63\u5F26\u3002", "Inverse hyperbolic sine."), usage: "{system?.math?.asinh(1)}" },
|
|
1598
|
+
{ name: "atan", summary: zh("\u53CD\u6B63\u5207\uFF0C\u7ED3\u679C\u662F\u5F27\u5EA6\u3002", "Arc tangent, in radians."), usage: "{system?.math?.atan(1)}" },
|
|
1599
|
+
{ name: "atan2", summary: zh("\u7531 y\u3001x \u8BA1\u7B97\u65B9\u4F4D\u89D2\uFF08\u5F27\u5EA6\uFF09\u3002", "Angle from y and x, in radians."), usage: "{system?.math?.atan2(1, 1)}" },
|
|
1600
|
+
{ name: "atanh", summary: zh("\u53CD\u53CC\u66F2\u6B63\u5207\u3002", "Inverse hyperbolic tangent."), usage: "{system?.math?.atanh(0.5)}" },
|
|
1601
|
+
{ name: "cbrt", summary: zh("\u7ACB\u65B9\u6839\u3002", "Cube root."), usage: "{system?.math?.cbrt(8)}" },
|
|
1602
|
+
{ name: "ceil", summary: zh("\u5411\u4E0A\u53D6\u6574\u3002", "Round up."), usage: "{system?.math?.ceil(1.2)}" },
|
|
1603
|
+
{ name: "clz32", summary: zh("32 \u4F4D\u6574\u6570\u7684\u524D\u5BFC\u96F6\u4E2A\u6570\u3002", "Leading zero bits of a 32-bit integer."), usage: "{system?.math?.clz32(1)}" },
|
|
1604
|
+
{ name: "cos", summary: zh("\u4F59\u5F26\uFF0C\u53C2\u6570\u662F\u5F27\u5EA6\u3002", "Cosine. Argument is radians."), usage: "{system?.math?.cos(system?.math?.PI)}" },
|
|
1605
|
+
{ name: "cosh", summary: zh("\u53CC\u66F2\u4F59\u5F26\u3002", "Hyperbolic cosine."), usage: "{system?.math?.cosh(0)}" },
|
|
1606
|
+
{ name: "exp", summary: zh("e \u7684 x \u6B21\u65B9\u3002", "e raised to x."), usage: "{system?.math?.exp(1)}" },
|
|
1607
|
+
{ name: "expm1", summary: zh("e^x - 1\uFF0Cx \u63A5\u8FD1 0 \u65F6\u66F4\u7CBE\u786E\u3002", "e^x - 1, more accurate when x is near 0."), usage: "{system?.math?.expm1(1)}" },
|
|
1608
|
+
{ name: "floor", summary: zh("\u5411\u4E0B\u53D6\u6574\u3002", "Round down."), usage: "{system?.math?.floor(system?.math?.random()*100)}" },
|
|
1609
|
+
{ name: "fround", summary: zh("\u820D\u5165\u5230\u6700\u63A5\u8FD1\u7684 32 \u4F4D\u6D6E\u70B9\u6570\u3002", "Round to the nearest 32-bit float."), usage: "{system?.math?.fround(1.337)}" },
|
|
1610
|
+
{ name: "hypot", summary: zh("\u5404\u53C2\u6570\u5E73\u65B9\u548C\u7684\u5E73\u65B9\u6839\u3002", "Square root of the sum of squares."), usage: "{system?.math?.hypot(3, 4)}" },
|
|
1611
|
+
{ name: "imul", summary: zh("32 \u4F4D\u6574\u6570\u76F8\u4E58\u3002", "32-bit integer multiplication."), usage: "{system?.math?.imul(2, 4)}" },
|
|
1612
|
+
{ name: "log", summary: zh("\u81EA\u7136\u5BF9\u6570\u3002", "Natural logarithm."), usage: "{system?.math?.log(system?.math?.E)}" },
|
|
1613
|
+
{ name: "log10", summary: zh("\u4EE5 10 \u4E3A\u5E95\u7684\u5BF9\u6570\u3002", "Base-10 logarithm."), usage: "{system?.math?.log10(100)}" },
|
|
1614
|
+
{ name: "log1p", summary: zh("ln(1 + x)\uFF0Cx \u63A5\u8FD1 0 \u65F6\u66F4\u7CBE\u786E\u3002", "ln(1 + x), more accurate when x is near 0."), usage: "{system?.math?.log1p(1)}" },
|
|
1615
|
+
{ name: "log2", summary: zh("\u4EE5 2 \u4E3A\u5E95\u7684\u5BF9\u6570\u3002", "Base-2 logarithm."), usage: "{system?.math?.log2(8)}" },
|
|
1616
|
+
{ name: "max", summary: zh("\u53D6\u66F4\u5927\u7684\u6570\uFF0C\u53EF\u4F20\u591A\u4E2A\u3002", "The larger number. Accepts several arguments."), usage: "{system?.math?.max(scope?.value||0, 0)}" },
|
|
1617
|
+
{ name: "min", summary: zh("\u53D6\u66F4\u5C0F\u7684\u6570\uFF0C\u53EF\u4F20\u591A\u4E2A\u3002", "The smaller number. Accepts several arguments."), usage: "{system?.math?.min(scope?.value||0, 100)}" },
|
|
1618
|
+
{ name: "pow", summary: zh("x \u7684 y \u6B21\u65B9\u3002", "x raised to y."), usage: "{system?.math?.pow(2, 8)}" },
|
|
1619
|
+
{ name: "random", summary: zh("\u5927\u4E8E\u7B49\u4E8E 0\u3001\u5C0F\u4E8E 1 \u7684\u968F\u673A\u6570\u3002", "A random number, 0 inclusive and 1 exclusive."), usage: "{system?.math?.random()}" },
|
|
1620
|
+
{ name: "round", summary: zh("\u56DB\u820D\u4E94\u5165\u5230\u6574\u6570\u3002", "Round to the nearest integer."), usage: "{system?.math?.round(1.5)}" },
|
|
1621
|
+
{ name: "sign", summary: zh("\u6B63\u6570 1\uFF0C\u8D1F\u6570 -1\uFF0C\u96F6 0\u3002", "1, -1, or 0 according to the sign."), usage: "{system?.math?.sign(-4)}" },
|
|
1622
|
+
{ name: "sin", summary: zh("\u6B63\u5F26\uFF0C\u53C2\u6570\u662F\u5F27\u5EA6\u3002", "Sine. Argument is radians."), usage: "{system?.math?.sin(0)}" },
|
|
1623
|
+
{ name: "sinh", summary: zh("\u53CC\u66F2\u6B63\u5F26\u3002", "Hyperbolic sine."), usage: "{system?.math?.sinh(1)}" },
|
|
1624
|
+
{ name: "sqrt", summary: zh("\u5E73\u65B9\u6839\u3002", "Square root."), usage: "{system?.math?.sqrt(9)}" },
|
|
1625
|
+
{ name: "tan", summary: zh("\u6B63\u5207\uFF0C\u53C2\u6570\u662F\u5F27\u5EA6\u3002", "Tangent. Argument is radians."), usage: "{system?.math?.tan(0)}" },
|
|
1626
|
+
{ name: "tanh", summary: zh("\u53CC\u66F2\u6B63\u5207\u3002", "Hyperbolic tangent."), usage: "{system?.math?.tanh(1)}" },
|
|
1627
|
+
{ name: "trunc", summary: zh("\u53BB\u6389\u5C0F\u6570\uFF0C\u5411 0 \u53D6\u6574\u3002", "Drop the fraction toward 0."), usage: "{system?.math?.trunc(-1.9)}" }
|
|
1628
|
+
];
|
|
1629
|
+
var LOCATION_MEMBERS = [
|
|
1630
|
+
{ name: "href", summary: zh("\u5B8C\u6574\u5730\u5740\uFF0C\u542B\u534F\u8BAE\u3001\u8DEF\u5F84\u3001\u67E5\u8BE2\u548C\u54C8\u5E0C\u3002", "Full URL, including protocol, path, query, and hash."), usage: "{system?.location?.href}" },
|
|
1631
|
+
{ name: "origin", summary: zh("\u6E90\uFF1A\u534F\u8BAE + \u4E3B\u673A + \u7AEF\u53E3\u3002", "Origin: protocol, host, and port."), usage: "{system?.location?.origin}" },
|
|
1632
|
+
{ name: "protocol", summary: zh("\u534F\u8BAE\uFF0C\u5E26\u5192\u53F7\uFF0C\u5982 https:\u3002", "Protocol with a colon, such as https:."), usage: "{system?.location?.protocol}" },
|
|
1633
|
+
{ name: "host", summary: zh("\u4E3B\u673A\uFF0C\u5305\u542B\u7AEF\u53E3\uFF08\u9ED8\u8BA4\u7AEF\u53E3\u4F1A\u7701\u7565\uFF09\u3002", "Host, including a non-default port."), usage: "{system?.location?.host}" },
|
|
1634
|
+
{ name: "hostname", summary: zh("\u4E3B\u673A\u540D\uFF0C\u4E0D\u542B\u7AEF\u53E3\u3002", "Hostname, without the port."), usage: "{system?.location?.hostname}" },
|
|
1635
|
+
{ name: "port", summary: zh("\u7AEF\u53E3\u3002\u9ED8\u8BA4\u7AEF\u53E3\u65F6\u662F\u7A7A\u5B57\u7B26\u4E32\u3002", "Port. Empty when it is the default port."), usage: "{system?.location?.port}" },
|
|
1636
|
+
{ name: "pathname", summary: zh("\u8DEF\u5F84\uFF0C\u4EE5 / \u5F00\u5934\u3002", "Path, starting with /."), usage: "{system?.location?.pathname}" },
|
|
1637
|
+
{ name: "search", summary: zh("\u67E5\u8BE2\u4E32\uFF0C\u4EE5 ? \u5F00\u5934\uFF1B\u6CA1\u6709\u67E5\u8BE2\u65F6\u662F\u7A7A\u5B57\u7B26\u4E32\u3002", "Query string, starting with ?. Empty when there is no query."), usage: "{system?.location?.search}" },
|
|
1638
|
+
{ name: "hash", summary: zh("\u54C8\u5E0C\uFF0C\u4EE5 # \u5F00\u5934\uFF1B\u6CA1\u6709\u54C8\u5E0C\u65F6\u662F\u7A7A\u5B57\u7B26\u4E32\u3002", "Hash, starting with #. Empty when there is no hash."), usage: "{system?.location?.hash}" },
|
|
1639
|
+
{ name: "ancestorOrigins", summary: zh("\u9875\u9762\u88AB\u5D4C\u5165\u65F6\uFF0C\u7956\u5148\u9875\u9762\u7684\u6E90\u5217\u8868\u3002\u666E\u901A\u6253\u5F00\u65F6\u901A\u5E38\u4E3A\u7A7A\u3002", "Origins of ancestor pages when this page is embedded. Usually empty otherwise."), usage: "{system?.location?.ancestorOrigins}" },
|
|
1640
|
+
{ name: "toString", summary: zh("\u540C href\u3002", "Same as href."), usage: "{system?.location?.toString()}" },
|
|
1641
|
+
{ name: "assign", summary: zh("\u8DF3\u8F6C\u5230\u65B0\u5730\u5740\uFF0C\u5E76\u7559\u4E0B\u5386\u53F2\u8BB0\u5F55\u3002\u4F1A\u79BB\u5F00\u5F53\u524D\u9875\uFF0C\u6A21\u677F\u91CC\u4E00\u822C\u4E0D\u8981\u8C03\u7528\u3002", "Navigate and keep history. This leaves the page, so avoid it in templates."), usage: "{system?.location?.assign('https://example.com')}" },
|
|
1642
|
+
{ name: "replace", summary: zh("\u8DF3\u8F6C\u5230\u65B0\u5730\u5740\uFF0C\u5E76\u66FF\u6362\u5F53\u524D\u5386\u53F2\u3002\u4F1A\u79BB\u5F00\u5F53\u524D\u9875\uFF0C\u6A21\u677F\u91CC\u4E00\u822C\u4E0D\u8981\u8C03\u7528\u3002", "Navigate and replace the current history entry. This leaves the page."), usage: "{system?.location?.replace('https://example.com')}" },
|
|
1643
|
+
{ name: "reload", summary: zh("\u5237\u65B0\u5F53\u524D\u9875\u3002\u6A21\u677F\u91CC\u4E00\u822C\u4E0D\u8981\u8C03\u7528\u3002", "Reload the page. Avoid calling it from a template."), usage: "{system?.location?.reload()}" }
|
|
1644
|
+
];
|
|
1645
|
+
var TOOLS_MEMBERS = [
|
|
1646
|
+
{
|
|
1647
|
+
name: "str",
|
|
1648
|
+
summary: zh("\u8F6C\u6210\u5B57\u7B26\u4E32\u3002null/undefined \u53D8\u6210\u7A7A\u4E32\uFF1B\u5BF9\u8C61\u5C3D\u91CF JSON.stringify\u3002", "Convert to string. null/undefined become ''. Objects prefer JSON.stringify."),
|
|
1649
|
+
usage: "{system?.tools?.str(123)}"
|
|
1650
|
+
},
|
|
1651
|
+
{
|
|
1652
|
+
name: "int",
|
|
1653
|
+
summary: zh("\u8F6C\u6210\u6570\u5B57\uFF08Number\uFF09\u3002\u7A7A\u503C\u5F97\u5230 NaN\u3002", "Convert to a number (Number). Empty values become NaN."),
|
|
1654
|
+
usage: "{system?.tools?.int('42')}"
|
|
1655
|
+
},
|
|
1656
|
+
{
|
|
1657
|
+
name: "sum",
|
|
1658
|
+
summary: zh(
|
|
1659
|
+
"\u6C42\u548C\u6216\u62FC\u63A5\u3002\u53EF\u5199 sum(1,2,3) \u6216 sum([...scope?.arr])\uFF1B\u5D4C\u5957\u6570\u7EC4\u4F1A\u5C55\u5E73\u3002\u5168\u662F\u6570\u5B57\u5219\u6570\u503C\u76F8\u52A0\uFF1B\u53EA\u8981\u6709\u4E00\u9879\u662F\u5B57\u7B26\u4E32\uFF0C\u5C31\u6309 JS \u7684 + \u4ECE\u5DE6\u5230\u53F3\u62FC\u63A5\u6210\u5B57\u7B26\u4E32\u3002",
|
|
1660
|
+
"Sum or concatenate. Use sum(1,2,3) or sum([...scope?.arr]); nested arrays are flattened. All numbers \u2192 numeric sum; any string \u2192 JS + left-to-right string concat."
|
|
1661
|
+
),
|
|
1662
|
+
usage: "{system?.tools?.sum([...scope?.arr||[]])}"
|
|
1663
|
+
},
|
|
1664
|
+
{
|
|
1665
|
+
name: "len",
|
|
1666
|
+
summary: zh("\u5B57\u7B26\u4E32\u957F\u5EA6\uFF1B\u6570\u7EC4\u8FD4\u56DE length\uFF1B\u5176\u5B83\u503C\u5148\u8F6C\u6210\u5B57\u7B26\u4E32\u518D\u53D6\u957F\u5EA6\u3002\u53EF\u5D4C\u5957\uFF0C\u5982 len(str(123)) \u2192 3\u3002", "String length; arrays return length; other values are stringified first. Nesting works, e.g. len(str(123)) \u2192 3."),
|
|
1667
|
+
usage: "{system?.tools?.len(system?.tools?.str(123))}"
|
|
1668
|
+
},
|
|
1669
|
+
{
|
|
1670
|
+
name: "pick",
|
|
1671
|
+
summary: zh(
|
|
1672
|
+
"\u6309 0 \u57FA\u4E0B\u6807\u53D6\u51FA\u82E5\u5E72\u9879\u3002\u6570\u7EC4\u8FD4\u56DE\u65B0\u6570\u7EC4\uFF0C\u5B57\u7B26\u4E32\u8FD4\u56DE\u65B0\u5B57\u7B26\u4E32\u3002\u540E\u7EED\u4E0B\u6807\u53EF\u5199\u591A\u4E2A\uFF0C\u4E5F\u53EF\u5C55\u5F00 scope \u6570\u7EC4\uFF0C\u5982 pick(scope?.arr, [...scope?.idxs])\u3002",
|
|
1673
|
+
"Pick by 0-based indices. Arrays \u2192 new array; strings \u2192 new string. Extra indices can be listed or spread from scope, e.g. pick(scope?.arr, [...scope?.idxs])."
|
|
1674
|
+
),
|
|
1675
|
+
usage: "{system?.tools?.pick(scope?.arr,1,2)}"
|
|
1676
|
+
},
|
|
1677
|
+
{
|
|
1678
|
+
name: "replace",
|
|
1679
|
+
summary: zh(
|
|
1680
|
+
"\u53EA\u66FF\u6362\u7B2C\u4E00\u4E2A\u5339\u914D\u9879\u3002\u6570\u7EC4\u6309\u5143\u7D20\u503C\u66FF\u6362\uFF1B\u5B57\u7B26\u4E32\u6309\u5B50\u4E32\u66FF\u6362\u3002\u4F8B\u5982 replace([1,2,3,1],1,2) \u2192 [2,2,3,1]\u3002",
|
|
1681
|
+
"Replace the first match only. Arrays match by element value; strings match by substring. e.g. replace([1,2,3,1],1,2) \u2192 [2,2,3,1]."
|
|
1682
|
+
),
|
|
1683
|
+
usage: "{system?.tools?.replace(scope?.arr,scope?.target,scope?.source)}"
|
|
1684
|
+
},
|
|
1685
|
+
{
|
|
1686
|
+
name: "replaceAll",
|
|
1687
|
+
summary: zh(
|
|
1688
|
+
"\u66FF\u6362\u5168\u90E8\u5339\u914D\u9879\uFF0C\u89C4\u5219\u540C replace\u3002",
|
|
1689
|
+
"Replace every match. Same rules as replace."
|
|
1690
|
+
),
|
|
1691
|
+
usage: "{system?.tools?.replaceAll(scope?.arr,scope?.target,scope?.source)}"
|
|
1692
|
+
},
|
|
1693
|
+
{
|
|
1694
|
+
name: "exclude",
|
|
1695
|
+
summary: zh(
|
|
1696
|
+
"\u6309 0 \u57FA\u4E0B\u6807\u5220\u9664\u82E5\u5E72\u9879\uFF0C\u8FD4\u56DE\u65B0\u6570\u7EC4 / \u65B0\u5B57\u7B26\u4E32\u3002\u540E\u7EED\u4E0B\u6807\u652F\u6301\u5C55\u5F00\uFF0C\u5982 exclude(scope?.arr, [...scope?.idxs])\u3002",
|
|
1697
|
+
"Drop 0-based indices and return a new array/string. Extra indices can be spread, e.g. exclude(scope?.arr, [...scope?.idxs])."
|
|
1698
|
+
),
|
|
1699
|
+
usage: "{system?.tools?.exclude(scope?.arr,0,1)}"
|
|
1700
|
+
}
|
|
1701
|
+
];
|
|
1702
|
+
var TEMPLATE_DOC_BOOKS = {
|
|
1703
|
+
system: {
|
|
1704
|
+
root: "system",
|
|
1705
|
+
title: zh("\u7CFB\u7EDF\u53D8\u91CF system", "System variable system"),
|
|
1706
|
+
intro: zh(
|
|
1707
|
+
"system \u662F\u6A21\u677F\u91CC\u7684\u5DE5\u5177\u7BB1\uFF0C\u6BCF\u6B21\u6C42\u503C\u90FD\u4F1A\u91CD\u65B0\u53D6\u5F53\u524D\u65F6\u95F4\u548C\u5F53\u524D\u9875\u9762\u5730\u5740\u3002\u5B83\u548C scope \u53EF\u4EE5\u5199\u5728\u540C\u4E00\u4E2A\u8868\u8FBE\u5F0F\u91CC\u3002",
|
|
1708
|
+
"system is the template toolbox. Each evaluation reads the current time and the current page URL again. It can share an expression with scope."
|
|
1709
|
+
),
|
|
1710
|
+
sections: [
|
|
1711
|
+
{
|
|
1712
|
+
id: "overview",
|
|
1713
|
+
title: zh("\u662F\u4EC0\u4E48", "What it is"),
|
|
1714
|
+
body: zh(
|
|
1715
|
+
"\u5199\u5728\u82B1\u62EC\u53F7\u91CC\u624D\u4F1A\u6C42\u503C\uFF0C\u4F8B\u5982 {system?.time}\u3002\u56DB\u4E2A\u5165\u53E3\uFF1Atime \u662F\u5F53\u524D\u65F6\u95F4\uFF08dayjs\uFF09\uFF0Cmath \u662F JavaScript \u7684 Math\uFF0Clocation \u662F\u5F53\u524D\u9875\u7684\u5730\u5740\uFF0Ctools \u662F\u5E38\u7528\u8F6C\u6362\u5DE5\u5177\uFF08str / int / sum / len / pick / replace / replaceAll / exclude\uFF09\u3002\u975E\u6D4F\u89C8\u5668\u73AF\u5883\u91CC location \u662F\u7A7A\u7684\u5360\u4F4D\uFF0C\u4E0D\u4F1A\u629B\u9519\u3002\u51FD\u6570\u53EF\u4EE5\u4E92\u76F8\u5D4C\u5957\uFF0C\u4E5F\u53EF\u4EE5\u548C scope \u4E00\u8D77\u5199\u3002",
|
|
1716
|
+
"Values are computed only inside braces, for example {system?.time}. There are four entries: time is the current dayjs time, math is JavaScript Math, location is the current page URL, and tools covers helpers (str / int / sum / len / pick / replace / replaceAll / exclude). Outside a browser, location is an empty stub and does not throw. Functions can nest and mix with scope."
|
|
1717
|
+
),
|
|
1718
|
+
examples: [
|
|
1719
|
+
"{system?.time}",
|
|
1720
|
+
"{system?.math?.PI}",
|
|
1721
|
+
"{system?.location?.origin}",
|
|
1722
|
+
"{system?.tools?.len(system?.tools?.str(123))}"
|
|
1723
|
+
]
|
|
1724
|
+
},
|
|
1725
|
+
{
|
|
1726
|
+
id: "syntax",
|
|
1727
|
+
title: zh("\u600E\u4E48\u5199", "How to write it"),
|
|
1728
|
+
body: zh(
|
|
1729
|
+
"?. \u8868\u793A\u8FD9\u4E00\u622A\u6CA1\u6709\u503C\u5C31\u505C\u4E0B\u6765\uFF0C\u4E0D\u518D\u5F80\u4E0B\u53D6\u3002|| \u8868\u793A\u5DE6\u8FB9\u662F\u7A7A\u503C\u65F6\u6539\u7528\u53F3\u8FB9\uFF0C\u4F8B\u5982 scope?.value?.days||7\u3002\u62EC\u53F7\u53EF\u4EE5\u8C03\u7528\u65B9\u6CD5\u3002\u82B1\u62EC\u53F7\u91CC\u9762\u4E0D\u80FD\u518D\u5199 }\u3002\u653E\u8FDB\u666E\u901A\u5B57\u7B26\u4E32\u65F6\uFF0C\u7ED3\u679C\u4F1A\u53D8\u6210\u6587\u672C\uFF1Bdayjs \u4F1A\u53D8\u6210 ISO \u65F6\u95F4\u3002\u653E\u5728 JSON \u7684\u503C\u4F4D\u7F6E\uFF08\u5F15\u53F7\u5916\u9762\uFF09\u65F6\uFF0C\u6570\u5B57\u3001\u5BF9\u8C61\u3001\u6570\u7EC4\u4F1A\u6309 JSON \u63D2\u5165\u3002",
|
|
1730
|
+
"?. stops when a step is missing. || uses the right-hand value when the left is empty, for example scope?.value?.days||7. Parentheses call methods. A brace expression cannot contain another }. Inside a plain string the result becomes text, and a dayjs value becomes an ISO time. In a JSON value position, outside quotes, numbers, objects, and arrays are inserted as JSON."
|
|
1731
|
+
),
|
|
1732
|
+
examples: [
|
|
1733
|
+
"{system?.time?.format('YYYY-MM-DD')}",
|
|
1734
|
+
"{system?.time?.subtract(scope?.value?.days||7,'d')}",
|
|
1735
|
+
"{system?.math?.floor(system?.math?.random()*100)}",
|
|
1736
|
+
"{system?.time?.subtract(system?.math?.random(),'d')}"
|
|
1737
|
+
]
|
|
1738
|
+
},
|
|
1739
|
+
{
|
|
1740
|
+
id: "time",
|
|
1741
|
+
title: zh("time \u5F53\u524D\u65F6\u95F4", "time, the current time"),
|
|
1742
|
+
body: zh(
|
|
1743
|
+
"system?.time \u662F\u6C42\u503C\u8FD9\u4E00\u523B\u7684 dayjs \u5BF9\u8C61\u3002\u5355\u4F4D\u53EF\u4EE5\u7528\u5168\u79F0\uFF0C\u4E5F\u53EF\u4EE5\u7528\u7B80\u5199\uFF1Ayear/y\u3001month/M\u3001week/w\u3001day/d\u3001hour/h\u3001minute/m\u3001second/s\u3001millisecond/ms\u3002month \u4ECE 0 \u5F00\u59CB\u3002format \u91CC YYYY \u662F\u5E74\uFF0CMM \u662F\u6708\uFF0CDD \u662F\u65E5\uFF0CHH \u662F 24 \u5C0F\u65F6\uFF0Cmm \u662F\u5206\uFF0Css \u662F\u79D2\uFF0CSSS \u662F\u6BEB\u79D2\u3002",
|
|
1744
|
+
"system?.time is a dayjs object for the moment of evaluation. Units accept full names or short forms: year/y, month/M, week/w, day/d, hour/h, minute/m, second/s, millisecond/ms. month is 0-based. In format, YYYY is the year, MM the month, DD the day, HH the hour (24), mm the minute, ss the second, and SSS the millisecond."
|
|
1745
|
+
),
|
|
1746
|
+
examples: [
|
|
1747
|
+
"{system?.time}",
|
|
1748
|
+
"{system?.time?.format('YYYY-MM-DD HH:mm:ss')}",
|
|
1749
|
+
"{system?.time?.subtract(7,'d')?.format('YYYY-MM-DD')}",
|
|
1750
|
+
"{system?.time?.add(1,'hour')?.startOf('hour')}",
|
|
1751
|
+
"{system?.time?.startOf('day')?.valueOf()}"
|
|
1752
|
+
],
|
|
1753
|
+
members: TIME_MEMBERS
|
|
1754
|
+
},
|
|
1755
|
+
{
|
|
1756
|
+
id: "math",
|
|
1757
|
+
title: zh("math \u6570\u5B66", "math"),
|
|
1758
|
+
body: zh(
|
|
1759
|
+
"system?.math \u5C31\u662F JavaScript \u7684 Math\u3002\u5E38\u6570\u76F4\u63A5\u53D6\uFF0C\u51FD\u6570\u8981\u52A0\u62EC\u53F7\u3002\u4E09\u89D2\u51FD\u6570\u7684\u53C2\u6570\u662F\u5F27\u5EA6\uFF0C\u4E0D\u662F\u89D2\u5EA6\u3002",
|
|
1760
|
+
"system?.math is JavaScript Math. Read constants directly, and call functions with parentheses. Trig functions take radians, not degrees."
|
|
1761
|
+
),
|
|
1762
|
+
examples: [
|
|
1763
|
+
"{system?.math?.PI}",
|
|
1764
|
+
"{system?.math?.random()}",
|
|
1765
|
+
"{system?.math?.floor(1.8)}",
|
|
1766
|
+
"{system?.math?.max(scope?.value||0, 0)}",
|
|
1767
|
+
"{system?.math?.round(system?.math?.random()*10)}"
|
|
1768
|
+
],
|
|
1769
|
+
members: MATH_MEMBERS
|
|
1770
|
+
},
|
|
1771
|
+
{
|
|
1772
|
+
id: "location",
|
|
1773
|
+
title: zh("location \u5F53\u524D\u9875\u9762\u5730\u5740", "location, the page URL"),
|
|
1774
|
+
body: zh(
|
|
1775
|
+
"system?.location \u662F\u5F53\u524D\u9875\u7684 Location\u3002\u6A21\u677F\u91CC\u7528\u5B83\u6765\u62FC\u5730\u5740\u3001\u8BFB\u8DEF\u5F84\u548C\u67E5\u8BE2\u4E32\u3002assign\u3001replace\u3001reload \u4F1A\u8DF3\u8F6C\u6216\u5237\u65B0\u9875\u9762\uFF0C\u4E0D\u8981\u5199\u8FDB\u4F1A\u53CD\u590D\u6C42\u503C\u7684\u6A21\u677F\u3002",
|
|
1776
|
+
"system?.location is the current page Location. Use it to build URLs or read the path and query. assign, replace, and reload navigate or reload the page, so do not put them in a template that evaluates repeatedly."
|
|
1777
|
+
),
|
|
1778
|
+
examples: [
|
|
1779
|
+
"{system?.location?.origin}",
|
|
1780
|
+
"{system?.location?.pathname}",
|
|
1781
|
+
"{system?.location?.href}",
|
|
1782
|
+
"https://api.example.com{system?.location?.pathname}"
|
|
1783
|
+
],
|
|
1784
|
+
members: LOCATION_MEMBERS
|
|
1785
|
+
},
|
|
1786
|
+
{
|
|
1787
|
+
id: "tools",
|
|
1788
|
+
title: zh("tools \u5E38\u7528\u5DE5\u5177", "tools"),
|
|
1789
|
+
body: zh(
|
|
1790
|
+
"system?.tools \u63D0\u4F9B\u8F6C\u6362\u3001\u805A\u5408\u3001\u6309\u4F4D\u9009\u53D6\u4E0E\u66FF\u6362\u3002\u53EF\u5D4C\u5957\u8C03\u7528\u3002sum / pick / exclude \u7684\u540E\u7EED\u53C2\u6570\u90FD\u652F\u6301\u5C55\u5F00\u4E0A\u6E38\u6570\u7EC4\uFF0C\u5982 {system?.tools?.pick(scope?.arr,[...scope?.idxs||[]])}\u3002\u4E0B\u6807\u4E00\u5F8B\u4ECE 0 \u5F00\u59CB\u3002replace \u53EA\u6362\u7B2C\u4E00\u5904\uFF0CreplaceAll \u6362\u5168\u90E8\u3002",
|
|
1791
|
+
"system?.tools converts, aggregates, picks, and replaces. Nest freely. Trailing args of sum / pick / exclude can spread upstream arrays, e.g. {system?.tools?.pick(scope?.arr,[...scope?.idxs||[]])}. Indices are 0-based. replace changes the first match; replaceAll changes every match."
|
|
1792
|
+
),
|
|
1793
|
+
examples: [
|
|
1794
|
+
"{system?.tools?.str(123)}",
|
|
1795
|
+
"{system?.tools?.int('42')}",
|
|
1796
|
+
"{system?.tools?.sum(1,2,3)}",
|
|
1797
|
+
"{system?.tools?.sum([...scope?.arr||[]])}",
|
|
1798
|
+
"{system?.tools?.len(system?.tools?.str(123))}",
|
|
1799
|
+
"{system?.tools?.pick(scope?.arr,1,2)}",
|
|
1800
|
+
"{system?.tools?.pick(scope?.arr,[...scope?.idxs||[]])}",
|
|
1801
|
+
"{system?.tools?.replace(scope?.arr,scope?.target,scope?.source)}",
|
|
1802
|
+
"{system?.tools?.replaceAll(scope?.arr,scope?.target,scope?.source)}",
|
|
1803
|
+
"{system?.tools?.exclude(scope?.arr,0,1)}"
|
|
1804
|
+
],
|
|
1805
|
+
members: TOOLS_MEMBERS
|
|
1806
|
+
}
|
|
1807
|
+
]
|
|
1808
|
+
},
|
|
1809
|
+
scope: {
|
|
1810
|
+
root: "scope",
|
|
1811
|
+
title: zh("\u6D41\u7A0B\u6570\u636E scope", "Workflow data scope"),
|
|
1812
|
+
intro: zh(
|
|
1813
|
+
"scope \u662F\u84DD\u56FE\u91CC\u8282\u70B9\u4E4B\u95F4\u4F20\u9012\u7684\u4E1A\u52A1\u6570\u636E\u3002\u4E0A\u6E38\u8FD8\u6CA1\u8FDE\u4E0A\u6216\u8FD8\u6CA1\u8DD1\u8FC7\u65F6\uFF0C\u5BF9\u5E94\u5B57\u6BB5\u662F\u7A7A\u7684\uFF0C\u7528 ?. \u548C || \u53EF\u4EE5\u907F\u514D\u6574\u6BB5\u8868\u8FBE\u5F0F\u65AD\u6389\u3002",
|
|
1814
|
+
"scope is the business data passed between blueprint nodes. Before an upstream node is connected or has run, fields are empty. ?. and || keep the expression from breaking."
|
|
1815
|
+
),
|
|
1816
|
+
sections: [
|
|
1817
|
+
{
|
|
1818
|
+
id: "overview",
|
|
1819
|
+
title: zh("\u662F\u4EC0\u4E48", "What it is"),
|
|
1820
|
+
body: zh(
|
|
1821
|
+
"scope \u53EA\u5728\u82B1\u62EC\u53F7\u8868\u8FBE\u5F0F\u91CC\u751F\u6548\uFF0C\u4F8B\u5982 {scope?.value}\u3002\u5B83\u63CF\u8FF0\u7684\u662F\u8FD9\u6761\u8FDE\u7EBF\u4F20\u4E0B\u6765\u7684\u6570\u636E\uFF0C\u4E0D\u662F\u5168\u5C40\u53D8\u91CF\u3002\u53EF\u4EE5\u548C system \u5199\u5728\u4E00\u8D77\uFF0C\u7528\u7CFB\u7EDF\u65F6\u95F4\u3001\u6570\u5B66\u6216\u5730\u5740\u53BB\u52A0\u5DE5\u4E0A\u6E38\u6570\u636E\u3002",
|
|
1822
|
+
"scope works inside brace expressions, for example {scope?.value}. It is the data on this connection, not a global variable. Combine it with system when the upstream data needs the current time, math, or the page URL."
|
|
1823
|
+
),
|
|
1824
|
+
examples: ["{scope?.value}", "{scope?.name||''}", "{scope?.a||0}"]
|
|
1825
|
+
},
|
|
1826
|
+
{
|
|
1827
|
+
id: "fields",
|
|
1828
|
+
title: zh("\u5355\u8DEF\u4E0A\u6E38", "One upstream node"),
|
|
1829
|
+
body: zh(
|
|
1830
|
+
"\u53EA\u6709\u4E00\u6761\u4E0A\u6E38\u8FDE\u7EBF\u65F6\uFF0C\u6570\u636E\u76F4\u63A5\u6302\u5728 scope \u4E0A\u3002value \u662F\u4E0A\u6E38\u8F93\u51FA\uFF1Bid\u3001name\u3001type \u662F\u4E0A\u6E38\u8282\u70B9\u81EA\u5DF1\u7684\u4FE1\u606F\uFF0C\u8282\u70B9\u8FD8\u6CA1\u6267\u884C\u65F6\u8FD9\u4E09\u9879\u4E5F\u5DF2\u7ECF\u6709\u503C\u3002value \u5982\u679C\u662F\u5BF9\u8C61\uFF0C\u53EF\u4EE5\u7EE7\u7EED\u5F80\u4E0B\u53D6\uFF0C\u4F8B\u5982 token\u3001headers\u3002",
|
|
1831
|
+
"With a single upstream connection, data sits directly on scope. value is the upstream output. id, name, and type describe that node and are available before it runs. When value is an object, keep reading into it, for example token or headers."
|
|
1832
|
+
),
|
|
1833
|
+
examples: [
|
|
1834
|
+
"{scope?.value}",
|
|
1835
|
+
"{scope?.id}",
|
|
1836
|
+
"{scope?.name}",
|
|
1837
|
+
"{scope?.type}",
|
|
1838
|
+
"{scope?.value?.token}",
|
|
1839
|
+
"{scope?.value?.headers}",
|
|
1840
|
+
"Bearer {scope?.value?.token}"
|
|
1841
|
+
],
|
|
1842
|
+
members: [
|
|
1843
|
+
{ name: "value", summary: zh("\u4E0A\u6E38\u8282\u70B9\u7684\u8F93\u51FA\u3002\u5BF9\u8C61\u53EF\u4EE5\u7EE7\u7EED\u7528 ?. \u53D6\u5B57\u6BB5\u3002", "Output of the upstream node. Use ?. to read fields when it is an object."), usage: "{scope?.value}" },
|
|
1844
|
+
{ name: "id", summary: zh("\u4E0A\u6E38\u8282\u70B9 id\u3002", "Upstream node id."), usage: "{scope?.id}" },
|
|
1845
|
+
{ name: "name", summary: zh("\u4E0A\u6E38\u8282\u70B9\u540D\u79F0\u3002", "Upstream node name."), usage: "{scope?.name}" },
|
|
1846
|
+
{ name: "type", summary: zh("\u4E0A\u6E38\u8282\u70B9\u7C7B\u578B\u3002", "Upstream node type."), usage: "{scope?.type}" }
|
|
1847
|
+
]
|
|
1848
|
+
},
|
|
1849
|
+
{
|
|
1850
|
+
id: "multi",
|
|
1851
|
+
title: zh("\u591A\u8DEF\u4E0A\u6E38", "Several upstream nodes"),
|
|
1852
|
+
body: zh(
|
|
1853
|
+
"\u6709\u591A\u6761\u4E0A\u6E38\u8FDE\u7EBF\u65F6\uFF0C\u6309\u4E0A\u6E38\u8282\u70B9 id \u5206\u7EC4\uFF0C\u4E0D\u518D\u628A value \u76F4\u63A5\u653E\u5728 scope \u6839\u4E0A\u3002\u5148\u5199\u8282\u70B9 id\uFF0C\u518D\u53D6 value \u6216\u8282\u70B9\u4FE1\u606F\u3002",
|
|
1854
|
+
"With several upstream connections, values are grouped by upstream node id. value is no longer on the scope root. Write the node id first, then value or the node fields."
|
|
1855
|
+
),
|
|
1856
|
+
examples: [
|
|
1857
|
+
"{scope?.node_abc?.value}",
|
|
1858
|
+
"{scope?.node_abc?.name}",
|
|
1859
|
+
"{scope?.node_abc?.value?.id}"
|
|
1860
|
+
]
|
|
1861
|
+
},
|
|
1862
|
+
{
|
|
1863
|
+
id: "fallback",
|
|
1864
|
+
title: zh("\u7F3A\u7701\u548C\u5360\u4F4D", "Missing values"),
|
|
1865
|
+
body: zh(
|
|
1866
|
+
"?. \u5728\u4E2D\u95F4\u4EFB\u4F55\u4E00\u622A\u6CA1\u6709\u503C\u65F6\u505C\u6B62\uFF0C\u6574\u6BB5\u7ED3\u679C\u4E3A\u7A7A\u3002|| \u5728\u5DE6\u8FB9\u662F null\u3001undefined\u30010 \u6216\u7A7A\u5B57\u7B26\u4E32\u65F6\u91C7\u7528\u53F3\u8FB9\u3002\u6570\u5B57\u7F3A\u7701\u5E38\u7528 ||0\uFF0C\u6587\u672C\u7F3A\u7701\u5E38\u7528 ||''\u3002",
|
|
1867
|
+
"?. stops when any step is missing, and the whole result is empty. || uses the right side when the left is null, undefined, 0, or an empty string. ||0 is the usual number fallback, and ||'' is the usual text fallback."
|
|
1868
|
+
),
|
|
1869
|
+
examples: ["{scope?.a||0}", "{scope?.name||''}", "{scope?.value?.days||7}"]
|
|
1870
|
+
},
|
|
1871
|
+
{
|
|
1872
|
+
id: "nesting",
|
|
1873
|
+
title: zh("\u548C system \u4E00\u8D77\u7528", "Using it with system"),
|
|
1874
|
+
body: zh(
|
|
1875
|
+
"\u540C\u4E00\u4E2A\u82B1\u62EC\u53F7\u91CC\u53EF\u4EE5\u540C\u65F6\u51FA\u73B0 scope \u548C system\u3002scope \u63D0\u4F9B\u4E1A\u52A1\u6570\u5B57\u6216\u6587\u672C\uFF0Csystem \u63D0\u4F9B\u65F6\u95F4\u3001\u6570\u5B66\u548C\u5730\u5740\u3002",
|
|
1876
|
+
"scope and system can share one brace expression. scope supplies the business value, and system supplies time, math, and the page URL."
|
|
1877
|
+
),
|
|
1878
|
+
examples: [
|
|
1879
|
+
"{system?.time?.subtract(scope?.value?.days||7,'d')}",
|
|
1880
|
+
"{system?.math?.max(scope?.value||0, 0)}",
|
|
1881
|
+
"{system?.location?.origin}{scope?.value?.path}"
|
|
1882
|
+
]
|
|
1883
|
+
},
|
|
1884
|
+
{
|
|
1885
|
+
id: "spread",
|
|
1886
|
+
title: zh("\u6570\u7EC4\u5C55\u5F00", "Array spread"),
|
|
1887
|
+
body: zh(
|
|
1888
|
+
"[...{scope?.\u8DEF\u5F84}] \u7528\u6765\u5C55\u5F00\u6570\u7EC4\u3002\u5199\u5728\u666E\u901A\u6587\u672C\u91CC\u65F6\uFF0C\u5404\u9879\u7528\u9017\u53F7\u62FC\u6210\u4E00\u4E2A\u5B57\u7B26\u4E32\u3002\u5199\u5728\u56FE\u8868\u7C7B\u76EE\u8FD9\u7C7B\u6570\u7EC4\u5B57\u6BB5\u91CC\u65F6\uFF0C\u4F1A\u5C55\u5F00\u6210\u591A\u9879\uFF0C\u4F8B\u5982 3 \u6761\u6570\u636E\u53D8\u6210 3 \u4E2A\u7C7B\u76EE\u3002system \u4E0D\u80FD\u8FD9\u6837\u5C55\u5F00\u3002",
|
|
1889
|
+
"[...{scope?.path}] spreads an array. In plain text, items are joined with commas. In an array field such as chart categories, they become separate items, so 3 rows become 3 categories. system cannot be spread this way."
|
|
1890
|
+
),
|
|
1891
|
+
examples: ["[...{scope?.a?.b}]", "[...{scope?.data?.data?.statusName}]", "[...{scope?.labels}]"]
|
|
1892
|
+
},
|
|
1893
|
+
{
|
|
1894
|
+
id: "json",
|
|
1895
|
+
title: zh("\u5199\u8FDB JSON", "Inside JSON"),
|
|
1896
|
+
body: zh(
|
|
1897
|
+
'\u8BF7\u6C42\u5934\u3001\u8BF7\u6C42\u4F53\u3001JSON \u8282\u70B9\u90FD\u6309\u8FD9\u6BB5\u89C4\u5219\u5904\u7406\u3002\u6A21\u677F\u5728\u5F15\u53F7\u91CC\u9762\u65F6\uFF0C\u53EA\u66FF\u6362\u6210\u6587\u672C\u3002\u6A21\u677F\u5728\u503C\u7684\u4F4D\u7F6E\u3001\u5F15\u53F7\u5916\u9762\u65F6\uFF0C\u5BF9\u8C61\u548C\u6570\u7EC4\u4F1A\u53D8\u6210 JSON\u3002\u6574\u6BB5\u5B57\u6BB5\u4E5F\u53EF\u4EE5\u76F4\u63A5\u5199\u6210\u4E00\u4E2A scope \u8868\u8FBE\u5F0F\uFF0C\u7528\u4E0A\u6E38\u5BF9\u8C61\u5145\u5F53\u8BF7\u6C42\u5934\u6216\u8BF7\u6C42\u4F53\u3002\u82B1\u62EC\u53F7\u91CC\u7684\u5F15\u53F7\u8BF7\u7528\u82F1\u6587 "\u3002',
|
|
1898
|
+
'Headers, bodies, and JSON nodes follow this rule. A template inside quotes is replaced as text. A template in a value position, outside quotes, inserts objects and arrays as JSON. A whole field can also be one scope expression, so an upstream object becomes the headers or body. Use straight " quotes inside braces.'
|
|
1899
|
+
),
|
|
1900
|
+
examples: [
|
|
1901
|
+
'{"Authorization":"Bearer {scope?.value?.token}"}',
|
|
1902
|
+
'{"id":"{scope?.value?.id}"}',
|
|
1903
|
+
"{scope?.value?.headers}",
|
|
1904
|
+
'{"at":"{system?.time?.toISOString()}"}'
|
|
1905
|
+
]
|
|
1906
|
+
}
|
|
1907
|
+
]
|
|
1908
|
+
}
|
|
1909
|
+
};
|
|
1910
|
+
function sectionSearchText(section) {
|
|
1911
|
+
return [
|
|
1912
|
+
section.title["zh-CN"],
|
|
1913
|
+
section.title["en-US"],
|
|
1914
|
+
section.body["zh-CN"],
|
|
1915
|
+
section.body["en-US"],
|
|
1916
|
+
...section.examples ?? [],
|
|
1917
|
+
...(section.members ?? []).flatMap((member) => [
|
|
1918
|
+
member.name,
|
|
1919
|
+
member.summary["zh-CN"],
|
|
1920
|
+
member.summary["en-US"],
|
|
1921
|
+
member.usage ?? ""
|
|
1922
|
+
])
|
|
1923
|
+
].join("\n").toLowerCase();
|
|
1924
|
+
}
|
|
1925
|
+
var request = null;
|
|
1926
|
+
var nonce = 0;
|
|
1927
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
1928
|
+
function emitTemplateDoc() {
|
|
1929
|
+
listeners.forEach((listener) => listener());
|
|
1930
|
+
}
|
|
1931
|
+
function getTemplateDocRequest() {
|
|
1932
|
+
return request;
|
|
1933
|
+
}
|
|
1934
|
+
function subscribeTemplateDoc(listener) {
|
|
1935
|
+
listeners.add(listener);
|
|
1936
|
+
return () => listeners.delete(listener);
|
|
1937
|
+
}
|
|
1938
|
+
function openTemplateDoc(input) {
|
|
1939
|
+
nonce += 1;
|
|
1940
|
+
request = { ...input, nonce };
|
|
1941
|
+
emitTemplateDoc();
|
|
1942
|
+
}
|
|
1943
|
+
function closeTemplateDoc() {
|
|
1944
|
+
if (!request) return;
|
|
1945
|
+
request = null;
|
|
1946
|
+
emitTemplateDoc();
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1233
1949
|
// src/scope-autocomplete.ts
|
|
1234
1950
|
function getValueAtPath(root, path) {
|
|
1235
1951
|
let current = root;
|
|
@@ -2250,6 +2966,30 @@ function executeLogicConfig(config, input) {
|
|
|
2250
2966
|
return run(input);
|
|
2251
2967
|
}
|
|
2252
2968
|
|
|
2969
|
+
// src/branch-config.ts
|
|
2970
|
+
var DEFAULT_BRANCH_NODE_CONFIG = {
|
|
2971
|
+
expression: ""
|
|
2972
|
+
};
|
|
2973
|
+
function normalizeBranchConfig(config) {
|
|
2974
|
+
return {
|
|
2975
|
+
expression: typeof config?.expression === "string" ? config.expression : ""
|
|
2976
|
+
};
|
|
2977
|
+
}
|
|
2978
|
+
function evaluateBranchCondition(expression, scope) {
|
|
2979
|
+
const raw = expression ?? "";
|
|
2980
|
+
const trimmed = raw.trim();
|
|
2981
|
+
if (!trimmed) return false;
|
|
2982
|
+
let value;
|
|
2983
|
+
if (isWholeScopeExpression(trimmed)) {
|
|
2984
|
+
value = evaluateScopeExpression(trimmed.slice(1, -1), scope);
|
|
2985
|
+
} else if (hasScopeTemplate(raw)) {
|
|
2986
|
+
value = evaluateScopeTemplate(raw, scope);
|
|
2987
|
+
} else {
|
|
2988
|
+
value = evaluateScopeExpression(trimmed, scope);
|
|
2989
|
+
}
|
|
2990
|
+
return Boolean(value);
|
|
2991
|
+
}
|
|
2992
|
+
|
|
2253
2993
|
// src/clock-config.ts
|
|
2254
2994
|
var DEFAULT_CLOCK_NODE_CONFIG = {
|
|
2255
2995
|
intervalSeconds: 0,
|
|
@@ -2453,7 +3193,12 @@ function collectArmedViewEventNodeIds(nodes, edges, eventNodeType, lifecycleNode
|
|
|
2453
3193
|
const source = byId.get(edge.source);
|
|
2454
3194
|
if (!source || source.nodeType !== lifecycleNodeType) return false;
|
|
2455
3195
|
const phase = source.lifecyclePhase || "mounted";
|
|
2456
|
-
|
|
3196
|
+
if (!firedPhases.has(phase)) return false;
|
|
3197
|
+
const peers = nodes.filter(
|
|
3198
|
+
(candidate) => candidate.nodeType === lifecycleNodeType && (candidate.lifecyclePhase || "mounted") === phase
|
|
3199
|
+
);
|
|
3200
|
+
if (peers.length > 1 && source.lifecycleEnabled === false) return false;
|
|
3201
|
+
return true;
|
|
2457
3202
|
});
|
|
2458
3203
|
if (registered) armed.add(node.id);
|
|
2459
3204
|
}
|
|
@@ -2969,6 +3714,7 @@ var JSON_NODE_TYPE = "JsonNode";
|
|
|
2969
3714
|
var STORAGE_NODE_TYPE = "StorageNode";
|
|
2970
3715
|
var CLOCK_NODE_TYPE = "Clock";
|
|
2971
3716
|
var AND_NODE_TYPE = "AndLogic";
|
|
3717
|
+
var BRANCH_NODE_TYPE = "Branch";
|
|
2972
3718
|
var VIEW_NODE_TYPE = "ViewBind";
|
|
2973
3719
|
var EVENT_NODE_TYPE = "ViewEvent";
|
|
2974
3720
|
var blueprintNodeDefinition = {
|
|
@@ -3022,6 +3768,15 @@ var andLogicNodeDefinition = {
|
|
|
3022
3768
|
outputs: [{ name: "out", kind: "data" }],
|
|
3023
3769
|
behavior: { kind: "js", ref: "and-run" }
|
|
3024
3770
|
};
|
|
3771
|
+
var branchNodeDefinition = {
|
|
3772
|
+
type: BRANCH_NODE_TYPE,
|
|
3773
|
+
inputs: [{ name: "in", kind: "data" }],
|
|
3774
|
+
outputs: [
|
|
3775
|
+
{ name: "outTrue", kind: "data" },
|
|
3776
|
+
{ name: "outFalse", kind: "data" }
|
|
3777
|
+
],
|
|
3778
|
+
behavior: { kind: "js", ref: "branch-run" }
|
|
3779
|
+
};
|
|
3025
3780
|
var viewBindNodeDefinition = {
|
|
3026
3781
|
type: VIEW_NODE_TYPE,
|
|
3027
3782
|
inputs: [{ name: "in", kind: "data" }],
|
|
@@ -3043,6 +3798,7 @@ var nodeDefinitionRegistry = {
|
|
|
3043
3798
|
[STORAGE_NODE_TYPE]: storageNodeDefinition,
|
|
3044
3799
|
[CLOCK_NODE_TYPE]: clockNodeDefinition,
|
|
3045
3800
|
[AND_NODE_TYPE]: andLogicNodeDefinition,
|
|
3801
|
+
[BRANCH_NODE_TYPE]: branchNodeDefinition,
|
|
3046
3802
|
[VIEW_NODE_TYPE]: viewBindNodeDefinition,
|
|
3047
3803
|
[EVENT_NODE_TYPE]: viewEventNodeDefinition
|
|
3048
3804
|
};
|
|
@@ -3146,9 +3902,9 @@ function detectRuntimeBlueprintCycle(callStack, targetLibraryBlueprintId, resolv
|
|
|
3146
3902
|
|
|
3147
3903
|
// src/runtime/clock-active-registry.ts
|
|
3148
3904
|
var activeClockNodeIds = /* @__PURE__ */ new Set();
|
|
3149
|
-
var
|
|
3905
|
+
var listeners2 = /* @__PURE__ */ new Set();
|
|
3150
3906
|
function emit() {
|
|
3151
|
-
|
|
3907
|
+
listeners2.forEach((listener) => listener());
|
|
3152
3908
|
}
|
|
3153
3909
|
function markClockNodeActive(nodeId) {
|
|
3154
3910
|
if (activeClockNodeIds.has(nodeId)) return;
|
|
@@ -3166,8 +3922,8 @@ function getActiveClockNodeIds() {
|
|
|
3166
3922
|
return [...activeClockNodeIds];
|
|
3167
3923
|
}
|
|
3168
3924
|
function subscribeActiveClockNodes(listener) {
|
|
3169
|
-
|
|
3170
|
-
return () =>
|
|
3925
|
+
listeners2.add(listener);
|
|
3926
|
+
return () => listeners2.delete(listener);
|
|
3171
3927
|
}
|
|
3172
3928
|
|
|
3173
3929
|
// src/runtime/clock-scheduler.ts
|
|
@@ -3231,6 +3987,7 @@ var BlueprintGraphRunner = class _BlueprintGraphRunner {
|
|
|
3231
3987
|
this.registerLogicBehavior();
|
|
3232
3988
|
this.registerClockBehavior();
|
|
3233
3989
|
this.registerAndBehavior();
|
|
3990
|
+
this.registerBranchBehavior();
|
|
3234
3991
|
this.registerViewBindBehavior();
|
|
3235
3992
|
}
|
|
3236
3993
|
graph;
|
|
@@ -3317,7 +4074,7 @@ var BlueprintGraphRunner = class _BlueprintGraphRunner {
|
|
|
3317
4074
|
await this.ensureNoBlueprintCycle();
|
|
3318
4075
|
const signal = createLifecycleSignal(phase);
|
|
3319
4076
|
const targets = this.graph.nodes.filter(
|
|
3320
|
-
(node) => node.nodeType === LIFECYCLE_NODE_TYPE && node
|
|
4077
|
+
(node) => node.nodeType === LIFECYCLE_NODE_TYPE && resolveLifecyclePhase(node) === phase && shouldEmitLifecycleNode(node, this.graph.nodes, LIFECYCLE_NODE_TYPE)
|
|
3321
4078
|
);
|
|
3322
4079
|
for (const node of targets) {
|
|
3323
4080
|
await this.runFromNode(node.id, signal);
|
|
@@ -3330,7 +4087,7 @@ var BlueprintGraphRunner = class _BlueprintGraphRunner {
|
|
|
3330
4087
|
async emitBlueprintActivated(inputValue, parentScope) {
|
|
3331
4088
|
const signal = createLifecycleSignal("blueprintActivated");
|
|
3332
4089
|
const targets = this.graph.nodes.filter(
|
|
3333
|
-
(node) => node.nodeType === LIFECYCLE_NODE_TYPE && node
|
|
4090
|
+
(node) => node.nodeType === LIFECYCLE_NODE_TYPE && resolveLifecyclePhase(node) === "blueprintActivated" && shouldEmitLifecycleNode(node, this.graph.nodes, LIFECYCLE_NODE_TYPE)
|
|
3334
4091
|
);
|
|
3335
4092
|
for (const node of targets) {
|
|
3336
4093
|
await this.runFromNode(node.id, signal, parentScope, inputValue);
|
|
@@ -3537,6 +4294,9 @@ var BlueprintGraphRunner = class _BlueprintGraphRunner {
|
|
|
3537
4294
|
if (node.nodeType !== LIFECYCLE_NODE_TYPE) {
|
|
3538
4295
|
throw new Error(dslMessage("debugMustStartFromLifecycle"));
|
|
3539
4296
|
}
|
|
4297
|
+
if (!shouldEmitLifecycleNode(node, this.graph.nodes, LIFECYCLE_NODE_TYPE)) {
|
|
4298
|
+
throw new Error(dslMessage("debugLifecycleDisabled"));
|
|
4299
|
+
}
|
|
3540
4300
|
this.outputs.clear();
|
|
3541
4301
|
this.traceEntries = [];
|
|
3542
4302
|
this.debugQueue = [
|
|
@@ -3848,8 +4608,12 @@ var BlueprintGraphRunner = class _BlueprintGraphRunner {
|
|
|
3848
4608
|
return this.isFalseOutputNode(targetId);
|
|
3849
4609
|
}
|
|
3850
4610
|
isFalseOutputNode(nodeId) {
|
|
3851
|
-
const
|
|
3852
|
-
|
|
4611
|
+
const ports = this.outputs.get(nodeId);
|
|
4612
|
+
if (!ports || ports.size === 0) return false;
|
|
4613
|
+
for (const value of ports.values()) {
|
|
4614
|
+
if (isFalseSignal(value)) return true;
|
|
4615
|
+
}
|
|
4616
|
+
return false;
|
|
3853
4617
|
}
|
|
3854
4618
|
haltDebugQueueOnFalseOutput(nodeId) {
|
|
3855
4619
|
if (!this.debugQueue || this.graph.allowFalseSignalPropagation) return;
|
|
@@ -4167,6 +4931,59 @@ var BlueprintGraphRunner = class _BlueprintGraphRunner {
|
|
|
4167
4931
|
io.emitFlow("out");
|
|
4168
4932
|
});
|
|
4169
4933
|
}
|
|
4934
|
+
registerBranchBehavior() {
|
|
4935
|
+
const runner = this;
|
|
4936
|
+
this.behaviors.registerJS("branch-run", async ({ token, io }) => {
|
|
4937
|
+
const node = runner.requireNode(token.nodeId);
|
|
4938
|
+
try {
|
|
4939
|
+
const input = await io.getInput("in");
|
|
4940
|
+
if (isFalseSignal(input)) {
|
|
4941
|
+
io.setOutput("outFalse", input);
|
|
4942
|
+
io.emitFlow("outFalse");
|
|
4943
|
+
return;
|
|
4944
|
+
}
|
|
4945
|
+
if (!isTrueSignal(input)) {
|
|
4946
|
+
io.setOutput(
|
|
4947
|
+
"outFalse",
|
|
4948
|
+
createFalseSignal(dslMessage("branchNeedsTrue"))
|
|
4949
|
+
);
|
|
4950
|
+
io.emitFlow("outFalse");
|
|
4951
|
+
return;
|
|
4952
|
+
}
|
|
4953
|
+
const incomingScope = runner.buildFetchIncomingScope(
|
|
4954
|
+
token.nodeId,
|
|
4955
|
+
"in",
|
|
4956
|
+
input
|
|
4957
|
+
);
|
|
4958
|
+
const config = normalizeBranchConfig({
|
|
4959
|
+
...DEFAULT_BRANCH_NODE_CONFIG,
|
|
4960
|
+
...node.branchConfig
|
|
4961
|
+
});
|
|
4962
|
+
const matched = evaluateBranchCondition(
|
|
4963
|
+
config.expression,
|
|
4964
|
+
incomingScope
|
|
4965
|
+
);
|
|
4966
|
+
const passThrough = createTrueSignal(input.value);
|
|
4967
|
+
if (matched) {
|
|
4968
|
+
io.setOutput("outTrue", passThrough);
|
|
4969
|
+
io.emitFlow("outTrue");
|
|
4970
|
+
} else {
|
|
4971
|
+
io.setOutput("outFalse", passThrough);
|
|
4972
|
+
io.emitFlow("outFalse");
|
|
4973
|
+
}
|
|
4974
|
+
} catch (error) {
|
|
4975
|
+
io.setOutput(
|
|
4976
|
+
"outFalse",
|
|
4977
|
+
createFalseSignal(
|
|
4978
|
+
dslMessage("branchExpressionError", {
|
|
4979
|
+
reason: error instanceof Error ? error.message : String(error)
|
|
4980
|
+
})
|
|
4981
|
+
)
|
|
4982
|
+
);
|
|
4983
|
+
io.emitFlow("outFalse");
|
|
4984
|
+
}
|
|
4985
|
+
});
|
|
4986
|
+
}
|
|
4170
4987
|
registerViewBindBehavior() {
|
|
4171
4988
|
const runner = this;
|
|
4172
4989
|
this.behaviors.registerJS("view-bind-run", async ({ token, io }) => {
|
|
@@ -4365,10 +5182,12 @@ exports.API_COLLECTION_DOCUMENT_VERSION = API_COLLECTION_DOCUMENT_VERSION;
|
|
|
4365
5182
|
exports.BLUEPRINT_ACTIVATION_INPUT_KEY = BLUEPRINT_ACTIVATION_INPUT_KEY;
|
|
4366
5183
|
exports.BLUEPRINT_CALL_STACK_KEY = BLUEPRINT_CALL_STACK_KEY;
|
|
4367
5184
|
exports.BLUEPRINT_NODE_TYPE = BLUEPRINT_NODE_TYPE;
|
|
5185
|
+
exports.BRANCH_NODE_TYPE = BRANCH_NODE_TYPE;
|
|
4368
5186
|
exports.BehaviorRegistry = BehaviorRegistry;
|
|
4369
5187
|
exports.BlueprintCycleError = BlueprintCycleError;
|
|
4370
5188
|
exports.BlueprintGraphRunner = BlueprintGraphRunner;
|
|
4371
5189
|
exports.CLOCK_NODE_TYPE = CLOCK_NODE_TYPE;
|
|
5190
|
+
exports.DEFAULT_BRANCH_NODE_CONFIG = DEFAULT_BRANCH_NODE_CONFIG;
|
|
4372
5191
|
exports.DEFAULT_CLOCK_NODE_CONFIG = DEFAULT_CLOCK_NODE_CONFIG;
|
|
4373
5192
|
exports.DEFAULT_FETCH_REQUEST_CONFIG = DEFAULT_FETCH_REQUEST_CONFIG;
|
|
4374
5193
|
exports.DEFAULT_JSON_NODE_CONFIG = DEFAULT_JSON_NODE_CONFIG;
|
|
@@ -4396,6 +5215,9 @@ exports.STORAGE_NODE_TYPE = STORAGE_NODE_TYPE;
|
|
|
4396
5215
|
exports.SYSTEM_LOCATION_KEYS = SYSTEM_LOCATION_KEYS;
|
|
4397
5216
|
exports.SYSTEM_MATH_KEYS = SYSTEM_MATH_KEYS;
|
|
4398
5217
|
exports.SYSTEM_TIME_METHOD_NAMES = SYSTEM_TIME_METHOD_NAMES;
|
|
5218
|
+
exports.SYSTEM_TOOLS_KEYS = SYSTEM_TOOLS_KEYS;
|
|
5219
|
+
exports.TEMPLATE_DOC_BOOKS = TEMPLATE_DOC_BOOKS;
|
|
5220
|
+
exports.TEMPLATE_DOC_CHROME = TEMPLATE_DOC_CHROME;
|
|
4399
5221
|
exports.TEMPLATE_ROOT_NAMES = TEMPLATE_ROOT_NAMES;
|
|
4400
5222
|
exports.UI_EVENT_PAYLOAD_KEY = UI_EVENT_PAYLOAD_KEY;
|
|
4401
5223
|
exports.VIEW_EVENT_SIGNAL_KEY = VIEW_EVENT_SIGNAL_KEY;
|
|
@@ -4411,6 +5233,7 @@ exports.applyFetchConfigScope = applyFetchConfigScope;
|
|
|
4411
5233
|
exports.applyScopeAutocompleteSelection = applyScopeAutocompleteSelection;
|
|
4412
5234
|
exports.assertNoBlueprintReferenceCycle = assertNoBlueprintReferenceCycle;
|
|
4413
5235
|
exports.blueprintNodeDefinition = blueprintNodeDefinition;
|
|
5236
|
+
exports.branchNodeDefinition = branchNodeDefinition;
|
|
4414
5237
|
exports.buildApiCollectionEndpointUrl = buildApiCollectionEndpointUrl;
|
|
4415
5238
|
exports.buildApiCollectionSyncPatches = buildApiCollectionSyncPatches;
|
|
4416
5239
|
exports.buildClockSessionKey = buildClockSessionKey;
|
|
@@ -4421,6 +5244,7 @@ exports.buildIncomingNodeScope = buildIncomingNodeScope;
|
|
|
4421
5244
|
exports.buildScopeExpression = buildScopeExpression;
|
|
4422
5245
|
exports.clearClockSessionAbort = clearClockSessionAbort;
|
|
4423
5246
|
exports.clockNodeDefinition = clockNodeDefinition;
|
|
5247
|
+
exports.closeTemplateDoc = closeTemplateDoc;
|
|
4424
5248
|
exports.collectArmedViewEventBindings = collectArmedViewEventBindings;
|
|
4425
5249
|
exports.collectArmedViewEventNodeIds = collectArmedViewEventNodeIds;
|
|
4426
5250
|
exports.collectBlueprintLibraryRefs = collectBlueprintLibraryRefs;
|
|
@@ -4433,16 +5257,20 @@ exports.createFalseSignal = createFalseSignal;
|
|
|
4433
5257
|
exports.createIncomingNodeScopeEntry = createIncomingNodeScopeEntry;
|
|
4434
5258
|
exports.createLifecycleSignal = createLifecycleSignal;
|
|
4435
5259
|
exports.createSystemRoot = createSystemRoot;
|
|
5260
|
+
exports.createSystemTools = createSystemTools;
|
|
4436
5261
|
exports.createTraceEntryId = createTraceEntryId;
|
|
4437
5262
|
exports.createTrueSignal = createTrueSignal;
|
|
4438
5263
|
exports.createViewEventSignal = createViewEventSignal;
|
|
5264
|
+
exports.defaultLifecycleEnabledForNewNode = defaultLifecycleEnabledForNewNode;
|
|
4439
5265
|
exports.defaultLogicNodeDefinition = defaultLogicNodeDefinition;
|
|
4440
5266
|
exports.deserializeStorageValue = deserializeStorageValue;
|
|
4441
5267
|
exports.detectBlueprintReferenceCycle = detectBlueprintReferenceCycle;
|
|
4442
5268
|
exports.detectRuntimeBlueprintCycle = detectRuntimeBlueprintCycle;
|
|
5269
|
+
exports.docText = docText;
|
|
4443
5270
|
exports.downloadApiCollectionTemplate = downloadApiCollectionTemplate;
|
|
4444
5271
|
exports.draftFetchHeadersText = draftFetchHeadersText;
|
|
4445
5272
|
exports.dslMessage = dslMessage;
|
|
5273
|
+
exports.evaluateBranchCondition = evaluateBranchCondition;
|
|
4446
5274
|
exports.evaluateScopeExpression = evaluateScopeExpression;
|
|
4447
5275
|
exports.evaluateScopeTemplate = evaluateScopeTemplate;
|
|
4448
5276
|
exports.evaluateScopeTemplateInJson = evaluateScopeTemplateInJson;
|
|
@@ -4454,6 +5282,7 @@ exports.fetchConfigHasScopeTemplate = fetchConfigHasScopeTemplate;
|
|
|
4454
5282
|
exports.fetchNodeDefinition = fetchNodeDefinition;
|
|
4455
5283
|
exports.filterEndpointSuggestions = filterEndpointSuggestions;
|
|
4456
5284
|
exports.filterStorageKeySuggestions = filterStorageKeySuggestions;
|
|
5285
|
+
exports.findEmittableLifecycleNodeId = findEmittableLifecycleNodeId;
|
|
4457
5286
|
exports.findJsonSyntaxErrorOffset = findJsonSyntaxErrorOffset;
|
|
4458
5287
|
exports.findSuspectCharRanges = findSuspectCharRanges;
|
|
4459
5288
|
exports.formatBlueprintCycleMessage = formatBlueprintCycleMessage;
|
|
@@ -4469,6 +5298,8 @@ exports.getFetchHeadersValidationError = getFetchHeadersValidationError;
|
|
|
4469
5298
|
exports.getNodeDefinition = getNodeDefinition;
|
|
4470
5299
|
exports.getScopeAutocompleteSuggestions = getScopeAutocompleteSuggestions;
|
|
4471
5300
|
exports.getSystemAutocompleteTree = getSystemAutocompleteTree;
|
|
5301
|
+
exports.getTemplateDocRequest = getTemplateDocRequest;
|
|
5302
|
+
exports.hasDuplicateLifecyclePhase = hasDuplicateLifecyclePhase;
|
|
4472
5303
|
exports.hasScopeTemplate = hasScopeTemplate;
|
|
4473
5304
|
exports.hasTemplateExpression = hasTemplateExpression;
|
|
4474
5305
|
exports.isClockNodeActive = isClockNodeActive;
|
|
@@ -4476,6 +5307,7 @@ exports.isClockScheduleActive = isClockScheduleActive;
|
|
|
4476
5307
|
exports.isClockSessionAborted = isClockSessionAborted;
|
|
4477
5308
|
exports.isDayjsValue = isDayjsValue;
|
|
4478
5309
|
exports.isFalseSignal = isFalseSignal;
|
|
5310
|
+
exports.isLifecycleGraphNode = isLifecycleGraphNode;
|
|
4479
5311
|
exports.isStorageReadConfigured = isStorageReadConfigured;
|
|
4480
5312
|
exports.isStorageSetConfigured = isStorageSetConfigured;
|
|
4481
5313
|
exports.isTrueSignal = isTrueSignal;
|
|
@@ -4486,14 +5318,17 @@ exports.latestTraceOutputsByNode = latestTraceOutputsByNode;
|
|
|
4486
5318
|
exports.lifecycleNodeDefinition = lifecycleNodeDefinition;
|
|
4487
5319
|
exports.lintJsonString = lintJsonString;
|
|
4488
5320
|
exports.listBrowserStorageKeys = listBrowserStorageKeys;
|
|
5321
|
+
exports.listLifecyclePeers = listLifecyclePeers;
|
|
4489
5322
|
exports.looksLikeJsonText = looksLikeJsonText;
|
|
4490
5323
|
exports.nodeDefinitionRegistry = nodeDefinitionRegistry;
|
|
4491
5324
|
exports.normalizeApiCollectionUrlKey = normalizeApiCollectionUrlKey;
|
|
4492
5325
|
exports.normalizeAppNameSpace = normalizeAppNameSpace;
|
|
5326
|
+
exports.normalizeBranchConfig = normalizeBranchConfig;
|
|
4493
5327
|
exports.normalizeClockConfig = normalizeClockConfig;
|
|
4494
5328
|
exports.normalizeFetchRequestConfig = normalizeFetchRequestConfig;
|
|
4495
5329
|
exports.normalizeStorageConfig = normalizeStorageConfig;
|
|
4496
5330
|
exports.normalizeViewEventConfig = normalizeViewEventConfig;
|
|
5331
|
+
exports.openTemplateDoc = openTemplateDoc;
|
|
4497
5332
|
exports.parseApiCollectionJson = parseApiCollectionJson;
|
|
4498
5333
|
exports.parseFetchHeadersJson = parseFetchHeadersJson;
|
|
4499
5334
|
exports.parseJsonConfig = parseJsonConfig;
|
|
@@ -4501,6 +5336,7 @@ exports.parseJsonText = parseJsonText;
|
|
|
4501
5336
|
exports.parseScopeAutocomplete = parseScopeAutocomplete;
|
|
4502
5337
|
exports.parseSwaggerDocument = parseSwaggerDocument;
|
|
4503
5338
|
exports.preserveTemplateTokensInEncode = preserveTemplateTokensInEncode;
|
|
5339
|
+
exports.reconcileLifecycleEnabled = reconcileLifecycleEnabled;
|
|
4504
5340
|
exports.registerDefaultBehaviors = registerDefaultBehaviors;
|
|
4505
5341
|
exports.renderJsonWithErrorHighlights = renderJsonWithErrorHighlights;
|
|
4506
5342
|
exports.resolveBlueprintCallStack = resolveBlueprintCallStack;
|
|
@@ -4509,20 +5345,26 @@ exports.resolveFetchHeaders = resolveFetchHeaders;
|
|
|
4509
5345
|
exports.resolveFetchIncomingScope = resolveFetchIncomingScope;
|
|
4510
5346
|
exports.resolveFetchRequestUrl = resolveFetchRequestUrl;
|
|
4511
5347
|
exports.resolveFetchScopeAutocompleteRoot = resolveFetchScopeAutocompleteRoot;
|
|
5348
|
+
exports.resolveLifecyclePhase = resolveLifecyclePhase;
|
|
4512
5349
|
exports.resolveStorageKey = resolveStorageKey;
|
|
4513
5350
|
exports.resolveStorageWriteValue = resolveStorageWriteValue;
|
|
5351
|
+
exports.resolveTemplateDocTarget = resolveTemplateDocTarget;
|
|
4514
5352
|
exports.scheduleClockOutputs = scheduleClockOutputs;
|
|
5353
|
+
exports.sectionSearchText = sectionSearchText;
|
|
4515
5354
|
exports.serializeStorageValue = serializeStorageValue;
|
|
4516
5355
|
exports.serializeTraceValue = serializeTraceValue;
|
|
4517
5356
|
exports.setBlueprintDslLocale = setBlueprintDslLocale;
|
|
5357
|
+
exports.shouldEmitLifecycleNode = shouldEmitLifecycleNode;
|
|
4518
5358
|
exports.snapshotDomEvent = snapshotDomEvent;
|
|
4519
5359
|
exports.snapshotViewEventNode = snapshotViewEventNode;
|
|
5360
|
+
exports.splitTemplateDocLinks = splitTemplateDocLinks;
|
|
4520
5361
|
exports.startClockSchedule = startClockSchedule;
|
|
4521
5362
|
exports.stopAllClockSchedules = stopAllClockSchedules;
|
|
4522
5363
|
exports.stopClockSchedule = stopClockSchedule;
|
|
4523
5364
|
exports.storageNodeDefinition = storageNodeDefinition;
|
|
4524
5365
|
exports.stringifyScopeValue = stringifyScopeValue;
|
|
4525
5366
|
exports.subscribeActiveClockNodes = subscribeActiveClockNodes;
|
|
5367
|
+
exports.subscribeTemplateDoc = subscribeTemplateDoc;
|
|
4526
5368
|
exports.toApiCollectionSyncResult = toApiCollectionSyncResult;
|
|
4527
5369
|
exports.uniqueStorageKinds = uniqueStorageKinds;
|
|
4528
5370
|
exports.validateApiCollectionDocument = validateApiCollectionDocument;
|