@dashspec/renderer 0.1.41 → 0.1.43
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/CHANGELOG.md +35 -0
- package/README.md +1 -1
- package/dist/FlowMapView-BSTKU7D4.js +458 -0
- package/dist/FlowMapView-BSTKU7D4.js.map +1 -0
- package/dist/chunk-5LRFKK4I.js +118 -0
- package/dist/chunk-5LRFKK4I.js.map +1 -0
- package/dist/{chunk-NLKXHTLO.js → chunk-D4GFCPCL.js} +6 -33
- package/dist/chunk-D4GFCPCL.js.map +1 -0
- package/dist/chunk-E4CT25TF.js +440 -0
- package/dist/chunk-E4CT25TF.js.map +1 -0
- package/dist/chunk-HUBYJ34E.js +38 -0
- package/dist/chunk-HUBYJ34E.js.map +1 -0
- package/dist/{chunk-YOCDUP7X.js → chunk-IBSZQEYY.js} +207 -527
- package/dist/chunk-IBSZQEYY.js.map +1 -0
- package/dist/{chunk-M4WXE3FW.js → chunk-JCPQBIAL.js} +5 -3
- package/dist/{chunk-M4WXE3FW.js.map → chunk-JCPQBIAL.js.map} +1 -1
- package/dist/{core-DE2SVeij.d.ts → core-DJ1ABh7P.d.ts} +34 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +18 -16
- package/dist/index.d.ts +33 -4
- package/dist/index.js +354 -290
- package/dist/index.js.map +1 -1
- package/dist/sandbox-RCDZ7SDZ.js +11 -0
- package/dist/sandbox.js +3 -2
- package/dist/schema.json +15 -0
- package/docs/README.md +1 -1
- package/docs/api.md +1 -1
- package/docs/data.md +8 -0
- package/docs/design-systems.md +21 -0
- package/docs/getting-started.md +1 -1
- package/docs/json-format.md +3 -1
- package/docs/widgets.md +2 -1
- package/package.json +1 -1
- package/dist/chunk-NLKXHTLO.js.map +0 -1
- package/dist/chunk-YOCDUP7X.js.map +0 -1
- package/dist/sandbox-WEMG76LE.js +0 -10
- /package/dist/{sandbox-WEMG76LE.js.map → sandbox-RCDZ7SDZ.js.map} +0 -0
|
@@ -1,318 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"==",
|
|
11
|
-
"!=",
|
|
12
|
-
"<=",
|
|
13
|
-
">=",
|
|
14
|
-
"&&",
|
|
15
|
-
"||",
|
|
16
|
-
"+",
|
|
17
|
-
"-",
|
|
18
|
-
"*",
|
|
19
|
-
"/",
|
|
20
|
-
"%",
|
|
21
|
-
"<",
|
|
22
|
-
">",
|
|
23
|
-
"!",
|
|
24
|
-
"?",
|
|
25
|
-
":",
|
|
26
|
-
".",
|
|
27
|
-
",",
|
|
28
|
-
"(",
|
|
29
|
-
")",
|
|
30
|
-
"[",
|
|
31
|
-
"]",
|
|
32
|
-
"{",
|
|
33
|
-
"}"
|
|
34
|
-
];
|
|
35
|
-
function tokenize(src) {
|
|
36
|
-
const out = [];
|
|
37
|
-
let i = 0;
|
|
38
|
-
while (i < src.length) {
|
|
39
|
-
const c = src[i];
|
|
40
|
-
if (/\s/.test(c)) {
|
|
41
|
-
i++;
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
if (/[0-9]/.test(c) || c === "." && /[0-9]/.test(src[i + 1] ?? "")) {
|
|
45
|
-
const m = /^(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?/.exec(src.slice(i));
|
|
46
|
-
out.push({ k: "num", v: m?.[0] ?? c, at: i });
|
|
47
|
-
i += m?.[0].length ?? 1;
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
if (c === "'" || c === '"') {
|
|
51
|
-
let j = i + 1;
|
|
52
|
-
let s = "";
|
|
53
|
-
while (j < src.length && src[j] !== c) {
|
|
54
|
-
if (src[j] === "\\") {
|
|
55
|
-
const n = src[j + 1];
|
|
56
|
-
s += n === "n" ? "\n" : n === "t" ? " " : n ?? "";
|
|
57
|
-
j += 2;
|
|
58
|
-
} else s += src[j++];
|
|
59
|
-
}
|
|
60
|
-
if (j >= src.length) throw new ExpressionError(`Unclosed string at ${i}`);
|
|
61
|
-
out.push({ k: "str", v: s, at: i });
|
|
62
|
-
i = j + 1;
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
if (/[A-Za-z_$]/.test(c)) {
|
|
66
|
-
const m = /^[A-Za-z_$][\w$]*/.exec(src.slice(i));
|
|
67
|
-
out.push({ k: "name", v: m[0], at: i });
|
|
68
|
-
i += m[0].length;
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
const op = OPS.find((o) => src.startsWith(o, i) && !(o === "?." && /\d/.test(src[i + 2] ?? "")));
|
|
72
|
-
if (!op) throw new ExpressionError(`Unexpected "${c}" at ${i}`);
|
|
73
|
-
out.push({ k: "op", v: op, at: i });
|
|
74
|
-
i += op.length;
|
|
75
|
-
}
|
|
76
|
-
out.push({ k: "end", v: "", at: src.length });
|
|
77
|
-
return out;
|
|
78
|
-
}
|
|
79
|
-
var BINARY = {
|
|
80
|
-
"??": 1,
|
|
81
|
-
"||": 2,
|
|
82
|
-
"&&": 3,
|
|
83
|
-
"==": 4,
|
|
84
|
-
"!=": 4,
|
|
85
|
-
"===": 4,
|
|
86
|
-
"!==": 4,
|
|
87
|
-
"<": 5,
|
|
88
|
-
"<=": 5,
|
|
89
|
-
">": 5,
|
|
90
|
-
">=": 5,
|
|
91
|
-
"+": 6,
|
|
92
|
-
"-": 6,
|
|
93
|
-
"*": 7,
|
|
94
|
-
"/": 7,
|
|
95
|
-
"%": 7
|
|
96
|
-
};
|
|
97
|
-
function parse(src) {
|
|
98
|
-
const toks = tokenize(src);
|
|
99
|
-
let p = 0;
|
|
100
|
-
const peek = () => toks[p];
|
|
101
|
-
const next = () => toks[p++];
|
|
102
|
-
const isOp = (v) => peek().k === "op" && peek().v === v;
|
|
103
|
-
const expect = (v) => {
|
|
104
|
-
if (!isOp(v)) throw new ExpressionError(`Expected "${v}" at ${peek().at}`);
|
|
105
|
-
p++;
|
|
106
|
-
};
|
|
107
|
-
const expression = () => conditional();
|
|
108
|
-
const conditional = () => {
|
|
109
|
-
const test = binary(0);
|
|
110
|
-
if (!isOp("?")) return test;
|
|
111
|
-
p++;
|
|
112
|
-
const yes = expression();
|
|
113
|
-
expect(":");
|
|
114
|
-
return { t: "cond", test, yes, no: expression() };
|
|
115
|
-
};
|
|
116
|
-
const binary = (min) => {
|
|
117
|
-
let left = unary();
|
|
118
|
-
for (; ; ) {
|
|
119
|
-
const t = peek();
|
|
120
|
-
const prec = t.k === "op" ? BINARY[t.v] : void 0;
|
|
121
|
-
if (prec === void 0 || prec <= min) return left;
|
|
122
|
-
p++;
|
|
123
|
-
left = { t: "binary", op: t.v, left, right: binary(prec) };
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
const unary = () => {
|
|
127
|
-
if (isOp("!") || isOp("-") || isOp("+")) return { t: "unary", op: next().v, arg: unary() };
|
|
128
|
-
return postfix(primary());
|
|
129
|
-
};
|
|
130
|
-
const postfix = (start) => {
|
|
131
|
-
let node2 = start;
|
|
132
|
-
let optionalCall = false;
|
|
133
|
-
for (; ; ) {
|
|
134
|
-
if (isOp(".") || isOp("?.")) {
|
|
135
|
-
const optional = next().v === "?.";
|
|
136
|
-
if (optional && isOp("[")) {
|
|
137
|
-
p++;
|
|
138
|
-
node2 = { t: "member", obj: node2, prop: expression(), optional };
|
|
139
|
-
expect("]");
|
|
140
|
-
continue;
|
|
141
|
-
}
|
|
142
|
-
if (optional && isOp("(")) {
|
|
143
|
-
optionalCall = true;
|
|
144
|
-
continue;
|
|
145
|
-
}
|
|
146
|
-
const name = next();
|
|
147
|
-
if (name.k !== "name") throw new ExpressionError(`Expected a property name at ${name.at}`);
|
|
148
|
-
node2 = { t: "member", obj: node2, prop: { t: "lit", v: name.v }, optional };
|
|
149
|
-
} else if (isOp("[")) {
|
|
150
|
-
p++;
|
|
151
|
-
node2 = { t: "member", obj: node2, prop: expression(), optional: false };
|
|
152
|
-
expect("]");
|
|
153
|
-
} else if (isOp("(")) {
|
|
154
|
-
p++;
|
|
155
|
-
const args = [];
|
|
156
|
-
while (!isOp(")")) {
|
|
157
|
-
args.push(expression());
|
|
158
|
-
if (!isOp(")")) expect(",");
|
|
159
|
-
}
|
|
160
|
-
p++;
|
|
161
|
-
node2 = { t: "call", callee: node2, args, ...optionalCall ? { optional: true } : {} };
|
|
162
|
-
optionalCall = false;
|
|
163
|
-
} else return node2;
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
const primary = () => {
|
|
167
|
-
const t = next();
|
|
168
|
-
if (t.k === "num") return { t: "lit", v: Number(t.v) };
|
|
169
|
-
if (t.k === "str") return { t: "lit", v: t.v };
|
|
170
|
-
if (t.k === "name") {
|
|
171
|
-
if (t.v === "true") return { t: "lit", v: true };
|
|
172
|
-
if (t.v === "false") return { t: "lit", v: false };
|
|
173
|
-
if (t.v === "null") return { t: "lit", v: null };
|
|
174
|
-
if (t.v === "undefined") return { t: "lit", v: void 0 };
|
|
175
|
-
return { t: "name", name: t.v };
|
|
176
|
-
}
|
|
177
|
-
if (t.k === "op" && t.v === "(") {
|
|
178
|
-
const e = expression();
|
|
179
|
-
expect(")");
|
|
180
|
-
return e;
|
|
181
|
-
}
|
|
182
|
-
if (t.k === "op" && t.v === "[") {
|
|
183
|
-
const items = [];
|
|
184
|
-
while (!isOp("]")) {
|
|
185
|
-
items.push(expression());
|
|
186
|
-
if (!isOp("]")) expect(",");
|
|
187
|
-
}
|
|
188
|
-
p++;
|
|
189
|
-
return { t: "array", items };
|
|
190
|
-
}
|
|
191
|
-
if (t.k === "op" && t.v === "{") {
|
|
192
|
-
const entries2 = [];
|
|
193
|
-
while (!isOp("}")) {
|
|
194
|
-
const key = next();
|
|
195
|
-
if (key.k !== "name" && key.k !== "str") throw new ExpressionError(`Expected a key at ${key.at}`);
|
|
196
|
-
expect(":");
|
|
197
|
-
entries2.push([key.v, expression()]);
|
|
198
|
-
if (!isOp("}")) expect(",");
|
|
199
|
-
}
|
|
200
|
-
p++;
|
|
201
|
-
return { t: "object", entries: entries2 };
|
|
202
|
-
}
|
|
203
|
-
throw new ExpressionError(t.k === "end" ? "Unexpected end of expression" : `Unexpected "${t.v}" at ${t.at}`);
|
|
204
|
-
};
|
|
205
|
-
const node = expression();
|
|
206
|
-
if (peek().k !== "end") throw new ExpressionError(`Unexpected "${peek().v}" at ${peek().at}`);
|
|
207
|
-
return node;
|
|
208
|
-
}
|
|
209
|
-
var cache = /* @__PURE__ */ new Map();
|
|
210
|
-
function compile(src) {
|
|
211
|
-
let n = cache.get(src);
|
|
212
|
-
if (!n) {
|
|
213
|
-
n = parse(src);
|
|
214
|
-
if (cache.size > 5e3) cache.clear();
|
|
215
|
-
cache.set(src, n);
|
|
216
|
-
}
|
|
217
|
-
return n;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// src/core/expr/evaluate.ts
|
|
221
|
-
var scope = (...layers) => ({
|
|
222
|
-
layers: layers.filter((l) => l !== void 0)
|
|
223
|
-
});
|
|
224
|
-
var BLOCKED = /* @__PURE__ */ new Set([
|
|
225
|
-
"__proto__",
|
|
226
|
-
"prototype",
|
|
227
|
-
"constructor",
|
|
228
|
-
"__defineGetter__",
|
|
229
|
-
"__defineSetter__",
|
|
230
|
-
"__lookupGetter__"
|
|
231
|
-
]);
|
|
232
|
-
function lookup(s, name) {
|
|
233
|
-
for (const l of s.layers) if (Object.hasOwn(l, name)) return l[name];
|
|
234
|
-
return void 0;
|
|
235
|
-
}
|
|
236
|
-
function member(obj, key) {
|
|
237
|
-
if (obj === null || obj === void 0) return void 0;
|
|
238
|
-
const k = typeof key === "number" ? key : String(key);
|
|
239
|
-
if (typeof k === "string" && BLOCKED.has(k)) throw new ExpressionError(`"${k}" is not allowed`);
|
|
240
|
-
if (typeof obj === "string") return k === "length" ? obj.length : typeof k === "number" ? obj[k] : void 0;
|
|
241
|
-
if (Array.isArray(obj)) return k === "length" ? obj.length : Object.hasOwn(obj, k) ? obj[k] : void 0;
|
|
242
|
-
if (typeof obj === "object") return Object.hasOwn(obj, k) ? obj[k] : void 0;
|
|
243
|
-
return void 0;
|
|
244
|
-
}
|
|
245
|
-
var looseEq = (a, b) => a === b || a == null && b == null;
|
|
246
|
-
function evalNode(n, s) {
|
|
247
|
-
switch (n.t) {
|
|
248
|
-
case "lit":
|
|
249
|
-
return n.v;
|
|
250
|
-
case "name":
|
|
251
|
-
return lookup(s, n.name);
|
|
252
|
-
case "member":
|
|
253
|
-
return member(evalNode(n.obj, s), evalNode(n.prop, s));
|
|
254
|
-
case "call": {
|
|
255
|
-
const fn = evalNode(n.callee, s);
|
|
256
|
-
if (n.optional && (fn === null || fn === void 0)) return void 0;
|
|
257
|
-
if (typeof fn !== "function") throw new ExpressionError("Only helper functions can be called");
|
|
258
|
-
return fn(...n.args.map((a) => evalNode(a, s)));
|
|
259
|
-
}
|
|
260
|
-
case "unary": {
|
|
261
|
-
const v = evalNode(n.arg, s);
|
|
262
|
-
return n.op === "!" ? !v : n.op === "-" ? -v : +v;
|
|
263
|
-
}
|
|
264
|
-
case "cond":
|
|
265
|
-
return evalNode(n.test, s) ? evalNode(n.yes, s) : evalNode(n.no, s);
|
|
266
|
-
case "array":
|
|
267
|
-
return n.items.map((i) => evalNode(i, s));
|
|
268
|
-
case "object":
|
|
269
|
-
return Object.fromEntries(n.entries.map(([k, v]) => [k, evalNode(v, s)]));
|
|
270
|
-
case "binary": {
|
|
271
|
-
if (n.op === "&&") return evalNode(n.left, s) && evalNode(n.right, s);
|
|
272
|
-
if (n.op === "||") return evalNode(n.left, s) || evalNode(n.right, s);
|
|
273
|
-
if (n.op === "??") return evalNode(n.left, s) ?? evalNode(n.right, s);
|
|
274
|
-
const a = evalNode(n.left, s);
|
|
275
|
-
const b = evalNode(n.right, s);
|
|
276
|
-
switch (n.op) {
|
|
277
|
-
case "==":
|
|
278
|
-
case "===":
|
|
279
|
-
return looseEq(a, b);
|
|
280
|
-
case "!=":
|
|
281
|
-
case "!==":
|
|
282
|
-
return !looseEq(a, b);
|
|
283
|
-
case "<":
|
|
284
|
-
return a < b;
|
|
285
|
-
case "<=":
|
|
286
|
-
return a <= b;
|
|
287
|
-
case ">":
|
|
288
|
-
return a > b;
|
|
289
|
-
case ">=":
|
|
290
|
-
return a >= b;
|
|
291
|
-
case "+":
|
|
292
|
-
return a + b;
|
|
293
|
-
case "-":
|
|
294
|
-
return a - b;
|
|
295
|
-
case "*":
|
|
296
|
-
return a * b;
|
|
297
|
-
case "/":
|
|
298
|
-
return a / b;
|
|
299
|
-
case "%":
|
|
300
|
-
return a % b;
|
|
301
|
-
}
|
|
302
|
-
throw new ExpressionError(`Unknown operator ${n.op}`);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
function evaluate(expr, s) {
|
|
307
|
-
return evalNode(compile(expr), s);
|
|
308
|
-
}
|
|
309
|
-
function evaluateSafe(expr, s, fallback) {
|
|
310
|
-
try {
|
|
311
|
-
return evaluate(expr, s);
|
|
312
|
-
} catch {
|
|
313
|
-
return fallback;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
Chips,
|
|
3
|
+
Common,
|
|
4
|
+
Format,
|
|
5
|
+
ToneMap,
|
|
6
|
+
collectReferences,
|
|
7
|
+
evaluate,
|
|
8
|
+
expressionReferences
|
|
9
|
+
} from "./chunk-E4CT25TF.js";
|
|
316
10
|
|
|
317
11
|
// src/core/expr/translate.ts
|
|
318
12
|
function pick(translations, locale) {
|
|
@@ -487,83 +181,6 @@ function pickDateOptions(o) {
|
|
|
487
181
|
return out;
|
|
488
182
|
}
|
|
489
183
|
|
|
490
|
-
// src/core/expr/references.ts
|
|
491
|
-
var ROOTS = ["datasources", "panels", "filters", "state", "modal", "context", "event", "drill", "panel"];
|
|
492
|
-
var REF = new RegExp(`(?<![\\w.$])(${ROOTS.join("|")})\\.([A-Za-z_][\\w-]*)`, "g");
|
|
493
|
-
function placeholders(template) {
|
|
494
|
-
const out = [];
|
|
495
|
-
let i = template.indexOf("${");
|
|
496
|
-
while (i !== -1) {
|
|
497
|
-
let depth = 1;
|
|
498
|
-
let j = i + 2;
|
|
499
|
-
let quote = null;
|
|
500
|
-
for (; j < template.length && depth > 0; j++) {
|
|
501
|
-
const c = template[j];
|
|
502
|
-
if (quote) {
|
|
503
|
-
if (c === "\\") j++;
|
|
504
|
-
else if (c === quote) quote = null;
|
|
505
|
-
} else if (c === "'" || c === '"' || c === "`") quote = c;
|
|
506
|
-
else if (c === "{") depth++;
|
|
507
|
-
else if (c === "}") depth--;
|
|
508
|
-
}
|
|
509
|
-
if (depth !== 0) break;
|
|
510
|
-
out.push(template.slice(i + 2, j - 1));
|
|
511
|
-
i = template.indexOf("${", j);
|
|
512
|
-
}
|
|
513
|
-
return out;
|
|
514
|
-
}
|
|
515
|
-
var stripStrings = (expr) => expr.replace(/'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|`(?:\\.|[^`\\])*`/g, "''");
|
|
516
|
-
function expressionReferences(expr) {
|
|
517
|
-
const out = [];
|
|
518
|
-
for (const m of stripStrings(expr).matchAll(REF)) out.push({ root: m[1], name: m[2] });
|
|
519
|
-
return out;
|
|
520
|
-
}
|
|
521
|
-
function templateReferences(template) {
|
|
522
|
-
return placeholders(template).flatMap(expressionReferences);
|
|
523
|
-
}
|
|
524
|
-
function collectReferences(value, out = []) {
|
|
525
|
-
if (typeof value === "string") out.push(...templateReferences(value));
|
|
526
|
-
else if (Array.isArray(value)) for (const v of value) collectReferences(v, out);
|
|
527
|
-
else if (value && typeof value === "object") for (const v of Object.values(value)) collectReferences(v, out);
|
|
528
|
-
return out;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
// src/core/expr/template.ts
|
|
532
|
-
var WHOLE = /^\$\{[\s\S]*\}$/;
|
|
533
|
-
function interpolate(template, s, encode) {
|
|
534
|
-
if (!template.includes("${")) return template;
|
|
535
|
-
const bodies = placeholders(template);
|
|
536
|
-
if (bodies.length === 1 && WHOLE.test(template.trim()) && template.trim() === `\${${bodies[0]}}`)
|
|
537
|
-
return evaluate(bodies[0], s);
|
|
538
|
-
let out = "";
|
|
539
|
-
let i = 0;
|
|
540
|
-
for (const body of bodies) {
|
|
541
|
-
const at = template.indexOf(`\${${body}}`, i);
|
|
542
|
-
out += template.slice(i, at);
|
|
543
|
-
const v = evaluate(body, s);
|
|
544
|
-
const text = v === null || v === void 0 ? "" : typeof v === "object" ? JSON.stringify(v) : String(v);
|
|
545
|
-
out += encode ? encode(text) : text;
|
|
546
|
-
i = at + body.length + 3;
|
|
547
|
-
}
|
|
548
|
-
return out + template.slice(i);
|
|
549
|
-
}
|
|
550
|
-
function resolve(value, s) {
|
|
551
|
-
if (typeof value === "string") return interpolate(value, s);
|
|
552
|
-
if (Array.isArray(value)) return value.map((v) => resolve(v, s));
|
|
553
|
-
if (value && typeof value === "object")
|
|
554
|
-
return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, resolve(v, s)]));
|
|
555
|
-
return value;
|
|
556
|
-
}
|
|
557
|
-
function interpolateUrl(template, s) {
|
|
558
|
-
return interpolate(template, s, encodeURIComponent);
|
|
559
|
-
}
|
|
560
|
-
function resolveRequest(request, s) {
|
|
561
|
-
const out = {};
|
|
562
|
-
for (const [k, v] of Object.entries(request))
|
|
563
|
-
out[k] = (k === "url" || k === "path") && typeof v === "string" ? interpolateUrl(v, s) : resolve(v, s);
|
|
564
|
-
return out;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
184
|
// src/core/http/index.ts
|
|
568
185
|
var DataError = class extends Error {
|
|
569
186
|
constructor(code, message, status, datasource) {
|
|
@@ -948,13 +565,13 @@ function readingUnknownTags(report, parse3) {
|
|
|
948
565
|
function dispatch(key, schemas, pick2) {
|
|
949
566
|
const schema2 = z.record(z.unknown()).superRefine((v, ctx) => {
|
|
950
567
|
const tag = pick2 ? pick2(v) : typeof v[key] === "string" ? v[key] : void 0;
|
|
951
|
-
const
|
|
952
|
-
if (!
|
|
953
|
-
if (!
|
|
568
|
+
const member = tag !== void 0 ? schemas[tag] : void 0;
|
|
569
|
+
if (!member && tag !== void 0 && NAMESPACED.test(tag)) return;
|
|
570
|
+
if (!member && tag !== void 0 && onUnknownTag) {
|
|
954
571
|
onUnknownTag([...ctx.path, key], key, tag, Object.keys(schemas));
|
|
955
572
|
return;
|
|
956
573
|
}
|
|
957
|
-
if (!
|
|
574
|
+
if (!member) {
|
|
958
575
|
ctx.addIssue({
|
|
959
576
|
code: z.ZodIssueCode.custom,
|
|
960
577
|
path: [key],
|
|
@@ -962,7 +579,7 @@ function dispatch(key, schemas, pick2) {
|
|
|
962
579
|
});
|
|
963
580
|
return;
|
|
964
581
|
}
|
|
965
|
-
const r =
|
|
582
|
+
const r = member.safeParse(v);
|
|
966
583
|
if (!r.success) for (const issue of r.error.issues) ctx.addIssue(issue);
|
|
967
584
|
});
|
|
968
585
|
schema2._def[DISPATCH] = { key, schemas };
|
|
@@ -1131,7 +748,7 @@ var Connection = z3.object({
|
|
|
1131
748
|
import { z as z4 } from "zod";
|
|
1132
749
|
var OneOrMany = z4.union([z4.string().min(1), z4.array(z4.string().min(1)).min(1)]);
|
|
1133
750
|
var AGGREGATES = ["sum", "avg", "count", "min", "max", "first", "last"];
|
|
1134
|
-
var
|
|
751
|
+
var OPS = ["filter", "map", "groupBy", "pivot", "sort", "limit", "pick", "fn", ...AGGREGATES];
|
|
1135
752
|
var steps = {
|
|
1136
753
|
filter: z4.object({ filter: Expression }).strict(),
|
|
1137
754
|
map: z4.object({
|
|
@@ -1161,9 +778,9 @@ var steps = {
|
|
|
1161
778
|
var TransformStep = dispatch("op", steps, (v) => {
|
|
1162
779
|
const keys = Object.keys(v);
|
|
1163
780
|
if (keys.some((k) => k === "groupBy" || AGGREGATES.includes(k))) return "aggregate";
|
|
1164
|
-
return keys.find((k) =>
|
|
781
|
+
return keys.find((k) => OPS.includes(k)) ?? keys.find((k) => !k.startsWith("x-") && k !== "description");
|
|
1165
782
|
});
|
|
1166
|
-
var
|
|
783
|
+
var Common2 = {
|
|
1167
784
|
description: z4.string().optional(),
|
|
1168
785
|
load: z4.enum(["onLoad", "lazy", "manual"]).optional(),
|
|
1169
786
|
/**
|
|
@@ -1198,7 +815,7 @@ var targetMsg = { message: 'Give exactly one of "url" or "path"', path: ["path"]
|
|
|
1198
815
|
var types = {
|
|
1199
816
|
http: z4.object({
|
|
1200
817
|
type: z4.literal("http"),
|
|
1201
|
-
...
|
|
818
|
+
...Common2,
|
|
1202
819
|
...Request,
|
|
1203
820
|
method: HttpMethod.default("GET"),
|
|
1204
821
|
body: JsonValue.optional(),
|
|
@@ -1215,7 +832,7 @@ var types = {
|
|
|
1215
832
|
}).strict().refine(oneTarget, targetMsg),
|
|
1216
833
|
graphql: z4.object({
|
|
1217
834
|
type: z4.literal("graphql"),
|
|
1218
|
-
...
|
|
835
|
+
...Common2,
|
|
1219
836
|
...Request,
|
|
1220
837
|
query: z4.string().min(1),
|
|
1221
838
|
variables: z4.record(JsonValue).optional(),
|
|
@@ -1223,7 +840,7 @@ var types = {
|
|
|
1223
840
|
}).strict().refine(oneTarget, targetMsg),
|
|
1224
841
|
sse: z4.object({
|
|
1225
842
|
type: z4.literal("sse"),
|
|
1226
|
-
...
|
|
843
|
+
...Common2,
|
|
1227
844
|
...Request,
|
|
1228
845
|
event: z4.string().optional(),
|
|
1229
846
|
merge: z4.enum(["replace", "append"]).default("replace"),
|
|
@@ -1236,7 +853,7 @@ var types = {
|
|
|
1236
853
|
}).strict().refine(oneTarget, targetMsg),
|
|
1237
854
|
websocket: z4.object({
|
|
1238
855
|
type: z4.literal("websocket"),
|
|
1239
|
-
...
|
|
856
|
+
...Common2,
|
|
1240
857
|
...Request,
|
|
1241
858
|
send: JsonValue.optional(),
|
|
1242
859
|
merge: z4.enum(["replace", "append"]).default("replace"),
|
|
@@ -1247,9 +864,14 @@ var types = {
|
|
|
1247
864
|
*/
|
|
1248
865
|
reconnect: z4.union([z4.boolean(), z4.object({ maxDelay: Duration.optional() }).strict()]).optional()
|
|
1249
866
|
}).strict().refine(oneTarget, targetMsg),
|
|
1250
|
-
static: z4.object({ type: z4.literal("static"), ...
|
|
1251
|
-
host: z4.object({ type: z4.literal("host"), ...
|
|
1252
|
-
derived: z4.object({
|
|
867
|
+
static: z4.object({ type: z4.literal("static"), ...Common2, data: JsonValue }).strict(),
|
|
868
|
+
host: z4.object({ type: z4.literal("host"), ...Common2, key: z4.string().min(1) }).strict(),
|
|
869
|
+
derived: z4.object({
|
|
870
|
+
...Common2,
|
|
871
|
+
from: Id,
|
|
872
|
+
/** A part of the upstream result, before `transform`: a dot path, templates allowed ("stages.${modal.args.key}"). */
|
|
873
|
+
path: z4.string().optional()
|
|
874
|
+
}).strict()
|
|
1253
875
|
};
|
|
1254
876
|
var BUILT_IN_DATASOURCE_TYPES = ["http", "graphql", "sse", "websocket", "static", "host"];
|
|
1255
877
|
var Datasource = dispatch("type", { ...types, custom: z4.record(z4.unknown()) }, (v) => {
|
|
@@ -1358,7 +980,9 @@ var kinds = {
|
|
|
1358
980
|
default: DateRangeValue.optional(),
|
|
1359
981
|
min: Template.optional(),
|
|
1360
982
|
max: Template.optional(),
|
|
1361
|
-
maxDays: z6.number().int().min(1).optional()
|
|
983
|
+
maxDays: z6.number().int().min(1).optional(),
|
|
984
|
+
/** The calendar picks one date (from = to) instead of a range; the presets stay. */
|
|
985
|
+
single: z6.boolean().optional()
|
|
1362
986
|
}).strict(),
|
|
1363
987
|
Date: z6.object({
|
|
1364
988
|
...base,
|
|
@@ -1465,6 +1089,11 @@ var Modal = z8.object({
|
|
|
1465
1089
|
presentation: z8.enum(["modal", "drawer"]).default("modal"),
|
|
1466
1090
|
/** Bind open state instead of using openModal, e.g. "${state.heatModal.open}". */
|
|
1467
1091
|
open: Template.optional(),
|
|
1092
|
+
/** Arguments to reopen with when it has not been opened yet (a host drawer's rail or handle). */
|
|
1093
|
+
defaultArgs: z8.record(JsonValue).optional(),
|
|
1094
|
+
/** An expression: while false the modal can't be open, and a host drawer (`ui.Drawer`) isn't drawn (e.g. its rail
|
|
1095
|
+
* only on one view: "view == 'flow'"). Default always. */
|
|
1096
|
+
availableWhen: z8.string().optional(),
|
|
1468
1097
|
datasources: z8.record(Id, Datasource).optional(),
|
|
1469
1098
|
panels: z8.record(Id, Panel),
|
|
1470
1099
|
layout: z8.array(LayoutItem),
|
|
@@ -1599,11 +1228,11 @@ var refExpr = (r) => {
|
|
|
1599
1228
|
if (isObj(r) && typeof r.$var === "string") return pathExpr("context", r.$var);
|
|
1600
1229
|
return JSON.stringify(r);
|
|
1601
1230
|
};
|
|
1602
|
-
var
|
|
1231
|
+
var OPS2 = { eq: "==", neq: "!=", gt: ">", gte: ">=", lt: "<", lte: "<=" };
|
|
1603
1232
|
function conditionToExpr(c) {
|
|
1604
1233
|
if (!isObj(c)) return "true";
|
|
1605
1234
|
const op = c.op;
|
|
1606
|
-
if (Object.hasOwn(
|
|
1235
|
+
if (Object.hasOwn(OPS2, op)) return `${refExpr(c.left)} ${OPS2[op]} ${refExpr(c.right)}`;
|
|
1607
1236
|
if (op === "in" || op === "nin") return `${op === "nin" ? "!" : ""}has(${refExpr(c.right)}, ${refExpr(c.left)})`;
|
|
1608
1237
|
if (op === "empty") return `len(${refExpr(c.left)}) == 0`;
|
|
1609
1238
|
if (op === "notEmpty") return `len(${refExpr(c.left)}) > 0`;
|
|
@@ -1842,7 +1471,7 @@ function migrateDocument(input, widgets = []) {
|
|
|
1842
1471
|
import { z as z10 } from "zod";
|
|
1843
1472
|
|
|
1844
1473
|
// src/version.ts
|
|
1845
|
-
var RENDERER_VERSION = "0.1.
|
|
1474
|
+
var RENDERER_VERSION = "0.1.43";
|
|
1846
1475
|
var parse2 = (v) => {
|
|
1847
1476
|
const m = /^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:[-+].*)?$/.exec(v.trim());
|
|
1848
1477
|
return m ? [Number(m[1]), Number(m[2] ?? 0), Number(m[3] ?? 0)] : void 0;
|
|
@@ -2092,7 +1721,7 @@ function validateDocument(input, options = {}) {
|
|
|
2092
1721
|
"unknown-connection",
|
|
2093
1722
|
`Connection "${ds.connection}" is not in spec.connections or the host's connections`
|
|
2094
1723
|
);
|
|
2095
|
-
if (ds.connection === void 0 && typeof ds.path === "string" && connections.size !== 1)
|
|
1724
|
+
if (ds.connection === void 0 && ds.from === void 0 && typeof ds.path === "string" && connections.size !== 1)
|
|
2096
1725
|
err(
|
|
2097
1726
|
[...at, "connection"],
|
|
2098
1727
|
"missing-connection",
|
|
@@ -2598,138 +2227,202 @@ var contractChecks = (widgets) => widgets.map((w) => ({
|
|
|
2598
2227
|
var widgetChecks = (r) => contractChecks(r.all);
|
|
2599
2228
|
|
|
2600
2229
|
// src/widgets/schemas/Breakdown.ts
|
|
2601
|
-
import { z as z13 } from "zod";
|
|
2602
|
-
|
|
2603
|
-
// src/widgets/schemas/common.ts
|
|
2604
2230
|
import { z as z12 } from "zod";
|
|
2605
|
-
var Format = z12.enum(["number", "compact", "percent", "duration", "date", "datetime", "time", "text"]);
|
|
2606
|
-
var Tone = z12.enum(["good", "warn", "bad", "neutral", "info"]);
|
|
2607
|
-
var ToneMap = z12.record(Tone);
|
|
2608
|
-
var Common2 = {
|
|
2609
|
-
title: z12.string().optional(),
|
|
2610
|
-
subtitle: z12.string().optional(),
|
|
2611
|
-
/** Plain-language help behind the ⓘ next to the title. */
|
|
2612
|
-
info: z12.string().optional(),
|
|
2613
|
-
/** Short text on the right of the card header, e.g. "Total: ${datasources.x.data.total} heats". */
|
|
2614
|
-
meta: z12.string().optional(),
|
|
2615
|
-
/** Shows "● Live, updated just now" from the datasource's last update (amber when a refresh failed). */
|
|
2616
|
-
live: z12.boolean().optional(),
|
|
2617
|
-
/** Text of the live badge instead of "Live, updated …": `{time}` is the last update as HH:MM, `{ago}` as "2 min ago". */
|
|
2618
|
-
liveText: z12.string().optional(),
|
|
2619
|
-
data: z12.unknown().optional(),
|
|
2620
|
-
/** Anything the underlying library supports, merged last. */
|
|
2621
|
-
options: z12.record(z12.unknown()).optional(),
|
|
2622
|
-
/** Hover group for cross-panel highlight. */
|
|
2623
|
-
highlight: z12.string().optional()
|
|
2624
|
-
};
|
|
2625
|
-
var Chip = z12.object({ text: z12.string(), tone: z12.string().optional(), when: z12.string().optional() }).strict();
|
|
2626
|
-
var Chips = z12.array(Chip);
|
|
2627
|
-
|
|
2628
|
-
// src/widgets/schemas/Breakdown.ts
|
|
2629
2231
|
var BreakdownContract = {
|
|
2630
2232
|
kind: "Breakdown",
|
|
2631
2233
|
version: 1,
|
|
2632
|
-
schema:
|
|
2633
|
-
...
|
|
2234
|
+
schema: z12.object({
|
|
2235
|
+
...Common,
|
|
2634
2236
|
/** Fields for the label and value of each data row (default "label" / "value"). */
|
|
2635
|
-
label:
|
|
2636
|
-
value:
|
|
2237
|
+
label: z12.string().default("label"),
|
|
2238
|
+
value: z12.string().default("value"),
|
|
2637
2239
|
/**
|
|
2638
2240
|
* Fixed items instead of data rows: `{ label, value, tone? }`, where `value` can be a template, e.g.
|
|
2639
2241
|
* { "label": "Rejected", "value": "${datasources.q.data.overall.rejected}", "tone": "bad" }.
|
|
2640
2242
|
*/
|
|
2641
|
-
items:
|
|
2642
|
-
|
|
2643
|
-
label:
|
|
2644
|
-
value:
|
|
2645
|
-
tone:
|
|
2243
|
+
items: z12.array(
|
|
2244
|
+
z12.object({
|
|
2245
|
+
label: z12.string(),
|
|
2246
|
+
value: z12.union([z12.number(), z12.string()]),
|
|
2247
|
+
tone: z12.enum(["good", "warn", "bad", "info", "neutral"]).optional()
|
|
2646
2248
|
}).strict()
|
|
2647
2249
|
).optional(),
|
|
2648
|
-
mode:
|
|
2250
|
+
mode: z12.enum(["meters", "segmented", "donut"]).default("meters"),
|
|
2649
2251
|
/** Adds a remainder item up to `total`, e.g. "Unaccounted". */
|
|
2650
|
-
remainder:
|
|
2651
|
-
showPercent:
|
|
2252
|
+
remainder: z12.object({ label: z12.string(), total: z12.union([z12.number(), z12.string()]) }).strict().optional(),
|
|
2253
|
+
showPercent: z12.boolean().default(true),
|
|
2652
2254
|
format: Format.optional(),
|
|
2653
|
-
decimals:
|
|
2654
|
-
unit:
|
|
2655
|
-
limit:
|
|
2255
|
+
decimals: z12.number().int().min(0).max(6).optional(),
|
|
2256
|
+
unit: z12.string().optional(),
|
|
2257
|
+
limit: z12.number().int().min(1).optional()
|
|
2656
2258
|
}).strict()
|
|
2657
2259
|
};
|
|
2658
2260
|
|
|
2659
2261
|
// src/widgets/schemas/CardGrid.ts
|
|
2660
|
-
import { z as
|
|
2661
|
-
var FieldDef =
|
|
2662
|
-
key:
|
|
2663
|
-
label:
|
|
2262
|
+
import { z as z13 } from "zod";
|
|
2263
|
+
var FieldDef = z13.object({
|
|
2264
|
+
key: z13.string(),
|
|
2265
|
+
label: z13.string().optional(),
|
|
2664
2266
|
format: Format.optional(),
|
|
2665
|
-
decimals:
|
|
2666
|
-
unit:
|
|
2267
|
+
decimals: z13.number().int().optional(),
|
|
2268
|
+
unit: z13.string().optional()
|
|
2667
2269
|
}).strict();
|
|
2668
2270
|
var CardGridContract = {
|
|
2669
2271
|
kind: "CardGrid",
|
|
2670
2272
|
version: 1,
|
|
2671
|
-
schema:
|
|
2672
|
-
...
|
|
2673
|
-
cardTitle:
|
|
2674
|
-
status:
|
|
2273
|
+
schema: z13.object({
|
|
2274
|
+
...Common,
|
|
2275
|
+
cardTitle: z13.string(),
|
|
2276
|
+
status: z13.string().optional(),
|
|
2675
2277
|
statusMap: ToneMap.optional(),
|
|
2676
|
-
fields:
|
|
2677
|
-
progress:
|
|
2678
|
-
value:
|
|
2679
|
-
max:
|
|
2680
|
-
label:
|
|
2278
|
+
fields: z13.array(FieldDef).default([]),
|
|
2279
|
+
progress: z13.object({
|
|
2280
|
+
value: z13.string(),
|
|
2281
|
+
max: z13.union([z13.string(), z13.number()]).default(100),
|
|
2282
|
+
label: z13.string().optional()
|
|
2681
2283
|
}).strict().optional(),
|
|
2682
|
-
badge:
|
|
2683
|
-
minCardWidth:
|
|
2684
|
-
selectable:
|
|
2685
|
-
selected:
|
|
2686
|
-
rowKey:
|
|
2284
|
+
badge: z13.string().optional(),
|
|
2285
|
+
minCardWidth: z13.number().int().min(120).default(220),
|
|
2286
|
+
selectable: z13.boolean().default(false),
|
|
2287
|
+
selected: z13.unknown().optional(),
|
|
2288
|
+
rowKey: z13.string().optional()
|
|
2687
2289
|
}).strict()
|
|
2688
2290
|
};
|
|
2689
2291
|
|
|
2690
2292
|
// src/widgets/schemas/Container.ts
|
|
2691
|
-
import { z as
|
|
2293
|
+
import { z as z14 } from "zod";
|
|
2692
2294
|
var ContainerContract = {
|
|
2693
2295
|
kind: "Container",
|
|
2694
2296
|
version: 1,
|
|
2695
|
-
schema:
|
|
2696
|
-
...
|
|
2697
|
-
direction:
|
|
2698
|
-
wrap:
|
|
2699
|
-
gap:
|
|
2700
|
-
justify:
|
|
2701
|
-
align:
|
|
2297
|
+
schema: z14.object({
|
|
2298
|
+
...Common,
|
|
2299
|
+
direction: z14.enum(["row", "column"]).default("row"),
|
|
2300
|
+
wrap: z14.boolean().default(true),
|
|
2301
|
+
gap: z14.number().int().min(0).max(64).default(12),
|
|
2302
|
+
justify: z14.enum(["start", "center", "end", "between", "around", "evenly"]).default("start"),
|
|
2303
|
+
align: z14.enum(["start", "center", "end", "stretch"]).default("stretch"),
|
|
2702
2304
|
/** Children share the width equally (row) unless they set their own `style.flex`. */
|
|
2703
|
-
equal:
|
|
2305
|
+
equal: z14.boolean().default(true),
|
|
2704
2306
|
/** Smallest width of a child before the row wraps, in px. */
|
|
2705
|
-
childMinWidth:
|
|
2307
|
+
childMinWidth: z14.number().int().min(0).max(2e3).default(160),
|
|
2706
2308
|
/** Scroll when the children don't fit. */
|
|
2707
|
-
scroll:
|
|
2309
|
+
scroll: z14.boolean().default(false)
|
|
2708
2310
|
}).strict(),
|
|
2709
2311
|
slots: { items: { label: "Items" } }
|
|
2710
2312
|
};
|
|
2711
2313
|
|
|
2712
2314
|
// src/widgets/schemas/Content.ts
|
|
2713
|
-
import { z as
|
|
2315
|
+
import { z as z15 } from "zod";
|
|
2714
2316
|
var ContentContract = {
|
|
2715
2317
|
kind: "Content",
|
|
2716
2318
|
version: 1,
|
|
2717
2319
|
small: true,
|
|
2718
|
-
schema:
|
|
2320
|
+
schema: z15.object({ ...Common, markdown: z15.string().default(""), align: z15.enum(["left", "center", "right"]).optional() }).strict()
|
|
2719
2321
|
};
|
|
2720
2322
|
|
|
2721
2323
|
// src/widgets/schemas/Filter.ts
|
|
2722
|
-
import { z as
|
|
2324
|
+
import { z as z16 } from "zod";
|
|
2723
2325
|
var FilterContract = {
|
|
2724
2326
|
kind: "Filter",
|
|
2725
2327
|
version: 1,
|
|
2726
2328
|
small: true,
|
|
2727
|
-
schema:
|
|
2728
|
-
...
|
|
2329
|
+
schema: z16.object({
|
|
2330
|
+
...Common,
|
|
2729
2331
|
/** The filter's name in `spec.variables`. */
|
|
2730
|
-
variable:
|
|
2332
|
+
variable: z16.string().min(1),
|
|
2731
2333
|
/** Stretch the control to the panel's width. */
|
|
2732
|
-
fill:
|
|
2334
|
+
fill: z16.boolean().default(false)
|
|
2335
|
+
}).strict()
|
|
2336
|
+
};
|
|
2337
|
+
|
|
2338
|
+
// src/widgets/schemas/FlowMap.ts
|
|
2339
|
+
import { z as z17 } from "zod";
|
|
2340
|
+
var MarkerImage = z17.object({ src: z17.string(), dimmedSrc: z17.string().optional(), size: z17.number().positive().max(200).optional() }).strict();
|
|
2341
|
+
var Marker = z17.object({
|
|
2342
|
+
shape: z17.enum(["circle", "diamond", "square", "triangle"]).optional(),
|
|
2343
|
+
/** A theme colour ("status.good.solid", "action.primary") or a CSS colour. */
|
|
2344
|
+
color: z17.string().optional(),
|
|
2345
|
+
/** px */
|
|
2346
|
+
size: z17.number().positive().max(200).optional(),
|
|
2347
|
+
image: MarkerImage.optional(),
|
|
2348
|
+
/** The legend text for this kind; left out of the legend without one. */
|
|
2349
|
+
legend: z17.string().optional(),
|
|
2350
|
+
/** The value chip's look: "neutral" (grey), or a tone such as "good". */
|
|
2351
|
+
chipTone: z17.string().optional()
|
|
2352
|
+
}).strict();
|
|
2353
|
+
var FlowMapContract = {
|
|
2354
|
+
kind: "FlowMap",
|
|
2355
|
+
version: 1,
|
|
2356
|
+
/** Panels drawn in a card above a step while the pointer is on it; they read the step's row as `item`. */
|
|
2357
|
+
slots: { hover: { label: "Hover card", max: 8 } },
|
|
2358
|
+
schema: z17.object({
|
|
2359
|
+
...Common,
|
|
2360
|
+
/** Field holding each step's unique id. */
|
|
2361
|
+
id: z17.string().default("key"),
|
|
2362
|
+
/** Field or `${row…}` template: the step's name. */
|
|
2363
|
+
label: z17.string().default("label"),
|
|
2364
|
+
/** Field or template: the step's kind, matched against `markers`. */
|
|
2365
|
+
kind: z17.string().optional(),
|
|
2366
|
+
/**
|
|
2367
|
+
* More values per step, keyed by step id, e.g. "${datasources.flow.data.stages}" when the figures come apart from
|
|
2368
|
+
* the route. Each step's row gets its entry as `row.detail`.
|
|
2369
|
+
*/
|
|
2370
|
+
details: z17.union([z17.record(z17.unknown()), z17.string()]).optional(),
|
|
2371
|
+
/** Field: the feed row a step belongs to; the last group (or `layout.mainGroup`) continues as the main path. */
|
|
2372
|
+
group: z17.string().optional(),
|
|
2373
|
+
/** Field: the site a step is at; the track into a new site is dashed and tagged. */
|
|
2374
|
+
site: z17.string().optional(),
|
|
2375
|
+
/** Template for a site's tag (`${row…}` of its first step); default the site's value. */
|
|
2376
|
+
siteLabel: z17.string().optional(),
|
|
2377
|
+
/** Field or template: the figure in the chip under a step. */
|
|
2378
|
+
value: z17.string().optional(),
|
|
2379
|
+
/** Field or template: the unit after the figure. */
|
|
2380
|
+
unit: z17.string().optional(),
|
|
2381
|
+
/** Chip text when there is no figure. */
|
|
2382
|
+
emptyValue: z17.string().default("\u2013"),
|
|
2383
|
+
/** Expression over `row`: false greys the step (dashed marker, no chip, not clickable). */
|
|
2384
|
+
trackedWhen: z17.string().optional(),
|
|
2385
|
+
/** Expression over `row`: true draws the step's needs-attention ring. */
|
|
2386
|
+
attentionWhen: z17.string().optional(),
|
|
2387
|
+
/** The selected step's id (a template, e.g. "${modal.args.stage}"): highlighted. */
|
|
2388
|
+
selected: z17.string().optional(),
|
|
2389
|
+
/** While a step is selected, grey the others (default true). */
|
|
2390
|
+
dimOthers: z17.boolean().default(true),
|
|
2391
|
+
/** How each kind of step is drawn, by kind; `default` for steps of any other kind. */
|
|
2392
|
+
markers: z17.record(Marker).optional(),
|
|
2393
|
+
/** Needs attention: its colour, or images for the halo behind and the ring around (by kind). */
|
|
2394
|
+
attention: z17.object({
|
|
2395
|
+
color: z17.string().optional(),
|
|
2396
|
+
legend: z17.string().optional(),
|
|
2397
|
+
halo: MarkerImage.optional(),
|
|
2398
|
+
ring: z17.record(MarkerImage).optional()
|
|
2399
|
+
}).strict().optional(),
|
|
2400
|
+
/** The selected and hovered step: its colour, or images for the halo and ring. */
|
|
2401
|
+
selection: z17.object({ color: z17.string().optional(), halo: MarkerImage.optional(), ring: MarkerImage.optional() }).strict().optional(),
|
|
2402
|
+
/** The legend in the header, from `markers` and `attention` (default true). */
|
|
2403
|
+
legend: z17.boolean().default(true),
|
|
2404
|
+
/** Legend text for untracked steps, shown only when a step is untracked. */
|
|
2405
|
+
untrackedLegend: z17.string().optional(),
|
|
2406
|
+
/** Spacing of the map, px; the defaults draw a 1030 px wide canvas. */
|
|
2407
|
+
layout: z17.object({
|
|
2408
|
+
perRow: z17.number().int().min(1).max(20).optional(),
|
|
2409
|
+
colGap: z17.number().positive().optional(),
|
|
2410
|
+
left: z17.number().optional(),
|
|
2411
|
+
top: z17.number().optional(),
|
|
2412
|
+
feedGap: z17.number().positive().optional(),
|
|
2413
|
+
firstRowGap: z17.number().positive().optional(),
|
|
2414
|
+
rowGap: z17.number().positive().optional(),
|
|
2415
|
+
stub: z17.number().min(0).optional(),
|
|
2416
|
+
bendRight: z17.number().optional(),
|
|
2417
|
+
bendLeft: z17.number().optional(),
|
|
2418
|
+
width: z17.number().positive().optional(),
|
|
2419
|
+
bottom: z17.number().min(0).optional(),
|
|
2420
|
+
mainGroup: z17.string().optional(),
|
|
2421
|
+
mainStartsAt: z17.number().int().min(0).optional(),
|
|
2422
|
+
mergeRow: z17.number().int().min(0).optional()
|
|
2423
|
+
}).strict().optional(),
|
|
2424
|
+
/** Below this width the map scrolls sideways instead of shrinking, px (default 760). */
|
|
2425
|
+
minWidth: z17.number().min(0).default(760)
|
|
2733
2426
|
}).strict()
|
|
2734
2427
|
};
|
|
2735
2428
|
|
|
@@ -2739,7 +2432,7 @@ var ImageContract = {
|
|
|
2739
2432
|
kind: "Image",
|
|
2740
2433
|
version: 1,
|
|
2741
2434
|
schema: z18.object({
|
|
2742
|
-
...
|
|
2435
|
+
...Common,
|
|
2743
2436
|
src: z18.string().optional(),
|
|
2744
2437
|
srcField: z18.string().optional(),
|
|
2745
2438
|
alt: z18.string().default(""),
|
|
@@ -2749,7 +2442,7 @@ var ImageContract = {
|
|
|
2749
2442
|
|
|
2750
2443
|
// src/widgets/schemas/ImageMap.ts
|
|
2751
2444
|
import { z as z19 } from "zod";
|
|
2752
|
-
var
|
|
2445
|
+
var Marker2 = z19.object({
|
|
2753
2446
|
x: z19.number(),
|
|
2754
2447
|
y: z19.number(),
|
|
2755
2448
|
label: z19.string().optional(),
|
|
@@ -2760,12 +2453,12 @@ var ImageMapContract = {
|
|
|
2760
2453
|
kind: "ImageMap",
|
|
2761
2454
|
version: 1,
|
|
2762
2455
|
schema: z19.object({
|
|
2763
|
-
...
|
|
2456
|
+
...Common,
|
|
2764
2457
|
src: z19.string(),
|
|
2765
2458
|
alt: z19.string().default(""),
|
|
2766
2459
|
/** Static markers (x and y in % of the image), or field names to read markers from the data rows. */
|
|
2767
2460
|
markers: z19.union([
|
|
2768
|
-
z19.array(
|
|
2461
|
+
z19.array(Marker2),
|
|
2769
2462
|
z19.object({
|
|
2770
2463
|
x: z19.string(),
|
|
2771
2464
|
y: z19.string(),
|
|
@@ -2787,7 +2480,7 @@ var KpiContract = {
|
|
|
2787
2480
|
kind: "Kpi",
|
|
2788
2481
|
version: 1,
|
|
2789
2482
|
schema: z20.object({
|
|
2790
|
-
...
|
|
2483
|
+
...Common,
|
|
2791
2484
|
unit: z20.string().optional(),
|
|
2792
2485
|
/** "small" (default): the unit in small text after the number; "value": in the number's own type ("93.9%"). */
|
|
2793
2486
|
unitStyle: z20.enum(["small", "value"]).default("small"),
|
|
@@ -2834,7 +2527,7 @@ import { z as z21 } from "zod";
|
|
|
2834
2527
|
var SparklineContract = {
|
|
2835
2528
|
kind: "Sparkline",
|
|
2836
2529
|
version: 1,
|
|
2837
|
-
schema: z21.object({ ...
|
|
2530
|
+
schema: z21.object({ ...Common, x: z21.string().optional(), y: z21.string(), area: z21.boolean().default(true) }).strict()
|
|
2838
2531
|
};
|
|
2839
2532
|
|
|
2840
2533
|
// src/widgets/schemas/StageTracker.ts
|
|
@@ -2843,7 +2536,7 @@ var StageTrackerContract = {
|
|
|
2843
2536
|
kind: "StageTracker",
|
|
2844
2537
|
version: 1,
|
|
2845
2538
|
schema: z22.object({
|
|
2846
|
-
...
|
|
2539
|
+
...Common,
|
|
2847
2540
|
stages: z22.array(z22.string()).min(1),
|
|
2848
2541
|
/** Field with the current stage (name or index); default "stage". */
|
|
2849
2542
|
current: z22.string().default("stage")
|
|
@@ -2856,7 +2549,7 @@ var StateTimelineContract = {
|
|
|
2856
2549
|
kind: "StateTimeline",
|
|
2857
2550
|
version: 1,
|
|
2858
2551
|
schema: z23.object({
|
|
2859
|
-
...
|
|
2552
|
+
...Common,
|
|
2860
2553
|
time: z23.string().default("ts"),
|
|
2861
2554
|
value: z23.string().default("value"),
|
|
2862
2555
|
/** Raw value → state, e.g. { "RUN": "running" }. */
|
|
@@ -2878,7 +2571,7 @@ var StatusContract = {
|
|
|
2878
2571
|
version: 1,
|
|
2879
2572
|
small: true,
|
|
2880
2573
|
schema: z24.object({
|
|
2881
|
-
...
|
|
2574
|
+
...Common,
|
|
2882
2575
|
/** Field shown under the state, e.g. the running program. */
|
|
2883
2576
|
label: z24.string().optional(),
|
|
2884
2577
|
/** Field holding the state. */
|
|
@@ -2935,7 +2628,7 @@ var Column = z25.object({
|
|
|
2935
2628
|
}).strict();
|
|
2936
2629
|
var Agg = z25.enum(["sum", "avg", "min", "max", "count"]);
|
|
2937
2630
|
var schema = z25.object({
|
|
2938
|
-
...
|
|
2631
|
+
...Common,
|
|
2939
2632
|
columns: z25.array(Column).optional(),
|
|
2940
2633
|
/** Tallest the rows get, in px; past it they scroll. Default: the card's height. */
|
|
2941
2634
|
maxHeight: z25.number().int().min(60).optional(),
|
|
@@ -3020,7 +2713,7 @@ var TilesContract = {
|
|
|
3020
2713
|
kind: "Tiles",
|
|
3021
2714
|
version: 1,
|
|
3022
2715
|
schema: z26.object({
|
|
3023
|
-
...
|
|
2716
|
+
...Common,
|
|
3024
2717
|
/** Fixed tiles instead of data rows: objects whose fields `label`, `value`, `caption`… read; values can be templates. */
|
|
3025
2718
|
items: z26.array(z26.record(z26.unknown())).optional(),
|
|
3026
2719
|
label: z26.string(),
|
|
@@ -3188,7 +2881,7 @@ var ButtonContract = {
|
|
|
3188
2881
|
import { z as z28 } from "zod";
|
|
3189
2882
|
var Y = z28.union([z28.string(), z28.array(z28.string()).min(1)]);
|
|
3190
2883
|
var cartesianProps = {
|
|
3191
|
-
...
|
|
2884
|
+
...Common,
|
|
3192
2885
|
x: z28.string(),
|
|
3193
2886
|
y: Y.optional(),
|
|
3194
2887
|
seriesBy: z28.string().optional(),
|
|
@@ -3266,7 +2959,7 @@ var PieChartContract = {
|
|
|
3266
2959
|
kind: "PieChart",
|
|
3267
2960
|
version: 1,
|
|
3268
2961
|
schema: z28.object({
|
|
3269
|
-
...
|
|
2962
|
+
...Common,
|
|
3270
2963
|
label: z28.string(),
|
|
3271
2964
|
value: z28.string(),
|
|
3272
2965
|
donut: z28.boolean().default(false),
|
|
@@ -3279,7 +2972,7 @@ var ScatterContract = {
|
|
|
3279
2972
|
kind: "Scatter",
|
|
3280
2973
|
version: 1,
|
|
3281
2974
|
schema: z28.object({
|
|
3282
|
-
...
|
|
2975
|
+
...Common,
|
|
3283
2976
|
x: z28.string(),
|
|
3284
2977
|
y: z28.string(),
|
|
3285
2978
|
size: z28.string().optional(),
|
|
@@ -3293,7 +2986,7 @@ var GaugeContract = {
|
|
|
3293
2986
|
kind: "Gauge",
|
|
3294
2987
|
version: 1,
|
|
3295
2988
|
schema: z28.object({
|
|
3296
|
-
...
|
|
2989
|
+
...Common,
|
|
3297
2990
|
min: z28.number().default(0),
|
|
3298
2991
|
max: z28.number().default(100),
|
|
3299
2992
|
bands: z28.array(Band).optional(),
|
|
@@ -3307,7 +3000,7 @@ var MatrixChartContract = {
|
|
|
3307
3000
|
kind: "MatrixChart",
|
|
3308
3001
|
version: 1,
|
|
3309
3002
|
schema: z28.object({
|
|
3310
|
-
...
|
|
3003
|
+
...Common,
|
|
3311
3004
|
rows: z28.string(),
|
|
3312
3005
|
cols: z28.string(),
|
|
3313
3006
|
value: z28.string(),
|
|
@@ -3333,7 +3026,7 @@ var CardContract = {
|
|
|
3333
3026
|
version: 1,
|
|
3334
3027
|
slots: { body: { label: "Body" } },
|
|
3335
3028
|
schema: z29.object({
|
|
3336
|
-
...
|
|
3029
|
+
...Common,
|
|
3337
3030
|
direction: z29.enum(["column", "row"]).default("column"),
|
|
3338
3031
|
gap: GAP,
|
|
3339
3032
|
align: z29.enum(["stretch", "start", "center", "end"]).default("stretch")
|
|
@@ -3344,7 +3037,7 @@ var TabsContract = {
|
|
|
3344
3037
|
version: 1,
|
|
3345
3038
|
openSlots: true,
|
|
3346
3039
|
schema: z29.object({
|
|
3347
|
-
...
|
|
3040
|
+
...Common,
|
|
3348
3041
|
tabs: z29.array(z29.object({ key: z29.string().regex(/^[A-Za-z][\w-]*$/), label: z29.string() }).strict()).min(1).default([
|
|
3349
3042
|
{ key: "tab1", label: "Tab 1" },
|
|
3350
3043
|
{ key: "tab2", label: "Tab 2" }
|
|
@@ -3358,7 +3051,7 @@ var RepeaterContract = {
|
|
|
3358
3051
|
version: 1,
|
|
3359
3052
|
slots: { item: { label: "Each item" } },
|
|
3360
3053
|
schema: z29.object({
|
|
3361
|
-
...
|
|
3054
|
+
...Common,
|
|
3362
3055
|
layout: z29.enum(["grid", "list"]).default("grid"),
|
|
3363
3056
|
/** Grid: the narrowest an item gets before the row wraps, in px. */
|
|
3364
3057
|
minItemWidth: z29.number().int().min(60).max(1200).default(220),
|
|
@@ -3386,6 +3079,7 @@ var builtInWidgetContracts = [
|
|
|
3386
3079
|
StatusContract,
|
|
3387
3080
|
CardGridContract,
|
|
3388
3081
|
ImageMapContract,
|
|
3082
|
+
FlowMapContract,
|
|
3389
3083
|
SparklineContract,
|
|
3390
3084
|
ContentContract,
|
|
3391
3085
|
ImageContract,
|
|
@@ -3406,26 +3100,11 @@ var builtInWidgetContracts = [
|
|
|
3406
3100
|
var builtInWidgetChecks = contractChecks(builtInWidgetContracts);
|
|
3407
3101
|
|
|
3408
3102
|
export {
|
|
3409
|
-
ExpressionError,
|
|
3410
|
-
parse,
|
|
3411
|
-
compile,
|
|
3412
|
-
scope,
|
|
3413
|
-
evaluate,
|
|
3414
|
-
evaluateSafe,
|
|
3415
3103
|
translator,
|
|
3416
3104
|
parseDuration,
|
|
3417
3105
|
plantDayStart,
|
|
3418
3106
|
plantDate,
|
|
3419
3107
|
createHelpers,
|
|
3420
|
-
placeholders,
|
|
3421
|
-
stripStrings,
|
|
3422
|
-
expressionReferences,
|
|
3423
|
-
templateReferences,
|
|
3424
|
-
collectReferences,
|
|
3425
|
-
interpolate,
|
|
3426
|
-
resolve,
|
|
3427
|
-
interpolateUrl,
|
|
3428
|
-
resolveRequest,
|
|
3429
3108
|
DataError,
|
|
3430
3109
|
mergeConnections,
|
|
3431
3110
|
resolveBaseUrl,
|
|
@@ -3495,6 +3174,7 @@ export {
|
|
|
3495
3174
|
ContainerContract,
|
|
3496
3175
|
ContentContract,
|
|
3497
3176
|
FilterContract,
|
|
3177
|
+
FlowMapContract,
|
|
3498
3178
|
ImageContract,
|
|
3499
3179
|
ImageMapContract,
|
|
3500
3180
|
KpiContract,
|
|
@@ -3524,4 +3204,4 @@ export {
|
|
|
3524
3204
|
RepeaterContract,
|
|
3525
3205
|
builtInWidgetChecks
|
|
3526
3206
|
};
|
|
3527
|
-
//# sourceMappingURL=chunk-
|
|
3207
|
+
//# sourceMappingURL=chunk-IBSZQEYY.js.map
|