@dashspec/renderer 0.1.41 → 0.1.42
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 +28 -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-M4WXE3FW.js → chunk-JCPQBIAL.js} +5 -3
- package/dist/{chunk-M4WXE3FW.js.map → chunk-JCPQBIAL.js.map} +1 -1
- package/dist/{chunk-YOCDUP7X.js → chunk-O4BYNRCA.js} +204 -526
- package/dist/chunk-O4BYNRCA.js.map +1 -0
- package/dist/{core-DE2SVeij.d.ts → core-B0gU-OwN.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 +353 -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 +12 -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 +2 -0
- 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) => {
|
|
@@ -1465,6 +1087,11 @@ var Modal = z8.object({
|
|
|
1465
1087
|
presentation: z8.enum(["modal", "drawer"]).default("modal"),
|
|
1466
1088
|
/** Bind open state instead of using openModal, e.g. "${state.heatModal.open}". */
|
|
1467
1089
|
open: Template.optional(),
|
|
1090
|
+
/** Arguments to reopen with when it has not been opened yet (a host drawer's rail or handle). */
|
|
1091
|
+
defaultArgs: z8.record(JsonValue).optional(),
|
|
1092
|
+
/** An expression: while false the modal can't be open, and a host drawer (`ui.Drawer`) isn't drawn (e.g. its rail
|
|
1093
|
+
* only on one view: "view == 'flow'"). Default always. */
|
|
1094
|
+
availableWhen: z8.string().optional(),
|
|
1468
1095
|
datasources: z8.record(Id, Datasource).optional(),
|
|
1469
1096
|
panels: z8.record(Id, Panel),
|
|
1470
1097
|
layout: z8.array(LayoutItem),
|
|
@@ -1599,11 +1226,11 @@ var refExpr = (r) => {
|
|
|
1599
1226
|
if (isObj(r) && typeof r.$var === "string") return pathExpr("context", r.$var);
|
|
1600
1227
|
return JSON.stringify(r);
|
|
1601
1228
|
};
|
|
1602
|
-
var
|
|
1229
|
+
var OPS2 = { eq: "==", neq: "!=", gt: ">", gte: ">=", lt: "<", lte: "<=" };
|
|
1603
1230
|
function conditionToExpr(c) {
|
|
1604
1231
|
if (!isObj(c)) return "true";
|
|
1605
1232
|
const op = c.op;
|
|
1606
|
-
if (Object.hasOwn(
|
|
1233
|
+
if (Object.hasOwn(OPS2, op)) return `${refExpr(c.left)} ${OPS2[op]} ${refExpr(c.right)}`;
|
|
1607
1234
|
if (op === "in" || op === "nin") return `${op === "nin" ? "!" : ""}has(${refExpr(c.right)}, ${refExpr(c.left)})`;
|
|
1608
1235
|
if (op === "empty") return `len(${refExpr(c.left)}) == 0`;
|
|
1609
1236
|
if (op === "notEmpty") return `len(${refExpr(c.left)}) > 0`;
|
|
@@ -1842,7 +1469,7 @@ function migrateDocument(input, widgets = []) {
|
|
|
1842
1469
|
import { z as z10 } from "zod";
|
|
1843
1470
|
|
|
1844
1471
|
// src/version.ts
|
|
1845
|
-
var RENDERER_VERSION = "0.1.
|
|
1472
|
+
var RENDERER_VERSION = "0.1.42";
|
|
1846
1473
|
var parse2 = (v) => {
|
|
1847
1474
|
const m = /^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:[-+].*)?$/.exec(v.trim());
|
|
1848
1475
|
return m ? [Number(m[1]), Number(m[2] ?? 0), Number(m[3] ?? 0)] : void 0;
|
|
@@ -2092,7 +1719,7 @@ function validateDocument(input, options = {}) {
|
|
|
2092
1719
|
"unknown-connection",
|
|
2093
1720
|
`Connection "${ds.connection}" is not in spec.connections or the host's connections`
|
|
2094
1721
|
);
|
|
2095
|
-
if (ds.connection === void 0 && typeof ds.path === "string" && connections.size !== 1)
|
|
1722
|
+
if (ds.connection === void 0 && ds.from === void 0 && typeof ds.path === "string" && connections.size !== 1)
|
|
2096
1723
|
err(
|
|
2097
1724
|
[...at, "connection"],
|
|
2098
1725
|
"missing-connection",
|
|
@@ -2598,138 +2225,202 @@ var contractChecks = (widgets) => widgets.map((w) => ({
|
|
|
2598
2225
|
var widgetChecks = (r) => contractChecks(r.all);
|
|
2599
2226
|
|
|
2600
2227
|
// src/widgets/schemas/Breakdown.ts
|
|
2601
|
-
import { z as z13 } from "zod";
|
|
2602
|
-
|
|
2603
|
-
// src/widgets/schemas/common.ts
|
|
2604
2228
|
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
2229
|
var BreakdownContract = {
|
|
2630
2230
|
kind: "Breakdown",
|
|
2631
2231
|
version: 1,
|
|
2632
|
-
schema:
|
|
2633
|
-
...
|
|
2232
|
+
schema: z12.object({
|
|
2233
|
+
...Common,
|
|
2634
2234
|
/** Fields for the label and value of each data row (default "label" / "value"). */
|
|
2635
|
-
label:
|
|
2636
|
-
value:
|
|
2235
|
+
label: z12.string().default("label"),
|
|
2236
|
+
value: z12.string().default("value"),
|
|
2637
2237
|
/**
|
|
2638
2238
|
* Fixed items instead of data rows: `{ label, value, tone? }`, where `value` can be a template, e.g.
|
|
2639
2239
|
* { "label": "Rejected", "value": "${datasources.q.data.overall.rejected}", "tone": "bad" }.
|
|
2640
2240
|
*/
|
|
2641
|
-
items:
|
|
2642
|
-
|
|
2643
|
-
label:
|
|
2644
|
-
value:
|
|
2645
|
-
tone:
|
|
2241
|
+
items: z12.array(
|
|
2242
|
+
z12.object({
|
|
2243
|
+
label: z12.string(),
|
|
2244
|
+
value: z12.union([z12.number(), z12.string()]),
|
|
2245
|
+
tone: z12.enum(["good", "warn", "bad", "info", "neutral"]).optional()
|
|
2646
2246
|
}).strict()
|
|
2647
2247
|
).optional(),
|
|
2648
|
-
mode:
|
|
2248
|
+
mode: z12.enum(["meters", "segmented", "donut"]).default("meters"),
|
|
2649
2249
|
/** Adds a remainder item up to `total`, e.g. "Unaccounted". */
|
|
2650
|
-
remainder:
|
|
2651
|
-
showPercent:
|
|
2250
|
+
remainder: z12.object({ label: z12.string(), total: z12.union([z12.number(), z12.string()]) }).strict().optional(),
|
|
2251
|
+
showPercent: z12.boolean().default(true),
|
|
2652
2252
|
format: Format.optional(),
|
|
2653
|
-
decimals:
|
|
2654
|
-
unit:
|
|
2655
|
-
limit:
|
|
2253
|
+
decimals: z12.number().int().min(0).max(6).optional(),
|
|
2254
|
+
unit: z12.string().optional(),
|
|
2255
|
+
limit: z12.number().int().min(1).optional()
|
|
2656
2256
|
}).strict()
|
|
2657
2257
|
};
|
|
2658
2258
|
|
|
2659
2259
|
// src/widgets/schemas/CardGrid.ts
|
|
2660
|
-
import { z as
|
|
2661
|
-
var FieldDef =
|
|
2662
|
-
key:
|
|
2663
|
-
label:
|
|
2260
|
+
import { z as z13 } from "zod";
|
|
2261
|
+
var FieldDef = z13.object({
|
|
2262
|
+
key: z13.string(),
|
|
2263
|
+
label: z13.string().optional(),
|
|
2664
2264
|
format: Format.optional(),
|
|
2665
|
-
decimals:
|
|
2666
|
-
unit:
|
|
2265
|
+
decimals: z13.number().int().optional(),
|
|
2266
|
+
unit: z13.string().optional()
|
|
2667
2267
|
}).strict();
|
|
2668
2268
|
var CardGridContract = {
|
|
2669
2269
|
kind: "CardGrid",
|
|
2670
2270
|
version: 1,
|
|
2671
|
-
schema:
|
|
2672
|
-
...
|
|
2673
|
-
cardTitle:
|
|
2674
|
-
status:
|
|
2271
|
+
schema: z13.object({
|
|
2272
|
+
...Common,
|
|
2273
|
+
cardTitle: z13.string(),
|
|
2274
|
+
status: z13.string().optional(),
|
|
2675
2275
|
statusMap: ToneMap.optional(),
|
|
2676
|
-
fields:
|
|
2677
|
-
progress:
|
|
2678
|
-
value:
|
|
2679
|
-
max:
|
|
2680
|
-
label:
|
|
2276
|
+
fields: z13.array(FieldDef).default([]),
|
|
2277
|
+
progress: z13.object({
|
|
2278
|
+
value: z13.string(),
|
|
2279
|
+
max: z13.union([z13.string(), z13.number()]).default(100),
|
|
2280
|
+
label: z13.string().optional()
|
|
2681
2281
|
}).strict().optional(),
|
|
2682
|
-
badge:
|
|
2683
|
-
minCardWidth:
|
|
2684
|
-
selectable:
|
|
2685
|
-
selected:
|
|
2686
|
-
rowKey:
|
|
2282
|
+
badge: z13.string().optional(),
|
|
2283
|
+
minCardWidth: z13.number().int().min(120).default(220),
|
|
2284
|
+
selectable: z13.boolean().default(false),
|
|
2285
|
+
selected: z13.unknown().optional(),
|
|
2286
|
+
rowKey: z13.string().optional()
|
|
2687
2287
|
}).strict()
|
|
2688
2288
|
};
|
|
2689
2289
|
|
|
2690
2290
|
// src/widgets/schemas/Container.ts
|
|
2691
|
-
import { z as
|
|
2291
|
+
import { z as z14 } from "zod";
|
|
2692
2292
|
var ContainerContract = {
|
|
2693
2293
|
kind: "Container",
|
|
2694
2294
|
version: 1,
|
|
2695
|
-
schema:
|
|
2696
|
-
...
|
|
2697
|
-
direction:
|
|
2698
|
-
wrap:
|
|
2699
|
-
gap:
|
|
2700
|
-
justify:
|
|
2701
|
-
align:
|
|
2295
|
+
schema: z14.object({
|
|
2296
|
+
...Common,
|
|
2297
|
+
direction: z14.enum(["row", "column"]).default("row"),
|
|
2298
|
+
wrap: z14.boolean().default(true),
|
|
2299
|
+
gap: z14.number().int().min(0).max(64).default(12),
|
|
2300
|
+
justify: z14.enum(["start", "center", "end", "between", "around", "evenly"]).default("start"),
|
|
2301
|
+
align: z14.enum(["start", "center", "end", "stretch"]).default("stretch"),
|
|
2702
2302
|
/** Children share the width equally (row) unless they set their own `style.flex`. */
|
|
2703
|
-
equal:
|
|
2303
|
+
equal: z14.boolean().default(true),
|
|
2704
2304
|
/** Smallest width of a child before the row wraps, in px. */
|
|
2705
|
-
childMinWidth:
|
|
2305
|
+
childMinWidth: z14.number().int().min(0).max(2e3).default(160),
|
|
2706
2306
|
/** Scroll when the children don't fit. */
|
|
2707
|
-
scroll:
|
|
2307
|
+
scroll: z14.boolean().default(false)
|
|
2708
2308
|
}).strict(),
|
|
2709
2309
|
slots: { items: { label: "Items" } }
|
|
2710
2310
|
};
|
|
2711
2311
|
|
|
2712
2312
|
// src/widgets/schemas/Content.ts
|
|
2713
|
-
import { z as
|
|
2313
|
+
import { z as z15 } from "zod";
|
|
2714
2314
|
var ContentContract = {
|
|
2715
2315
|
kind: "Content",
|
|
2716
2316
|
version: 1,
|
|
2717
2317
|
small: true,
|
|
2718
|
-
schema:
|
|
2318
|
+
schema: z15.object({ ...Common, markdown: z15.string().default(""), align: z15.enum(["left", "center", "right"]).optional() }).strict()
|
|
2719
2319
|
};
|
|
2720
2320
|
|
|
2721
2321
|
// src/widgets/schemas/Filter.ts
|
|
2722
|
-
import { z as
|
|
2322
|
+
import { z as z16 } from "zod";
|
|
2723
2323
|
var FilterContract = {
|
|
2724
2324
|
kind: "Filter",
|
|
2725
2325
|
version: 1,
|
|
2726
2326
|
small: true,
|
|
2727
|
-
schema:
|
|
2728
|
-
...
|
|
2327
|
+
schema: z16.object({
|
|
2328
|
+
...Common,
|
|
2729
2329
|
/** The filter's name in `spec.variables`. */
|
|
2730
|
-
variable:
|
|
2330
|
+
variable: z16.string().min(1),
|
|
2731
2331
|
/** Stretch the control to the panel's width. */
|
|
2732
|
-
fill:
|
|
2332
|
+
fill: z16.boolean().default(false)
|
|
2333
|
+
}).strict()
|
|
2334
|
+
};
|
|
2335
|
+
|
|
2336
|
+
// src/widgets/schemas/FlowMap.ts
|
|
2337
|
+
import { z as z17 } from "zod";
|
|
2338
|
+
var MarkerImage = z17.object({ src: z17.string(), dimmedSrc: z17.string().optional(), size: z17.number().positive().max(200).optional() }).strict();
|
|
2339
|
+
var Marker = z17.object({
|
|
2340
|
+
shape: z17.enum(["circle", "diamond", "square", "triangle"]).optional(),
|
|
2341
|
+
/** A theme colour ("status.good.solid", "action.primary") or a CSS colour. */
|
|
2342
|
+
color: z17.string().optional(),
|
|
2343
|
+
/** px */
|
|
2344
|
+
size: z17.number().positive().max(200).optional(),
|
|
2345
|
+
image: MarkerImage.optional(),
|
|
2346
|
+
/** The legend text for this kind; left out of the legend without one. */
|
|
2347
|
+
legend: z17.string().optional(),
|
|
2348
|
+
/** The value chip's look: "neutral" (grey), or a tone such as "good". */
|
|
2349
|
+
chipTone: z17.string().optional()
|
|
2350
|
+
}).strict();
|
|
2351
|
+
var FlowMapContract = {
|
|
2352
|
+
kind: "FlowMap",
|
|
2353
|
+
version: 1,
|
|
2354
|
+
/** Panels drawn in a card above a step while the pointer is on it; they read the step's row as `item`. */
|
|
2355
|
+
slots: { hover: { label: "Hover card", max: 8 } },
|
|
2356
|
+
schema: z17.object({
|
|
2357
|
+
...Common,
|
|
2358
|
+
/** Field holding each step's unique id. */
|
|
2359
|
+
id: z17.string().default("key"),
|
|
2360
|
+
/** Field or `${row…}` template: the step's name. */
|
|
2361
|
+
label: z17.string().default("label"),
|
|
2362
|
+
/** Field or template: the step's kind, matched against `markers`. */
|
|
2363
|
+
kind: z17.string().optional(),
|
|
2364
|
+
/**
|
|
2365
|
+
* More values per step, keyed by step id, e.g. "${datasources.flow.data.stages}" when the figures come apart from
|
|
2366
|
+
* the route. Each step's row gets its entry as `row.detail`.
|
|
2367
|
+
*/
|
|
2368
|
+
details: z17.union([z17.record(z17.unknown()), z17.string()]).optional(),
|
|
2369
|
+
/** Field: the feed row a step belongs to; the last group (or `layout.mainGroup`) continues as the main path. */
|
|
2370
|
+
group: z17.string().optional(),
|
|
2371
|
+
/** Field: the site a step is at; the track into a new site is dashed and tagged. */
|
|
2372
|
+
site: z17.string().optional(),
|
|
2373
|
+
/** Template for a site's tag (`${row…}` of its first step); default the site's value. */
|
|
2374
|
+
siteLabel: z17.string().optional(),
|
|
2375
|
+
/** Field or template: the figure in the chip under a step. */
|
|
2376
|
+
value: z17.string().optional(),
|
|
2377
|
+
/** Field or template: the unit after the figure. */
|
|
2378
|
+
unit: z17.string().optional(),
|
|
2379
|
+
/** Chip text when there is no figure. */
|
|
2380
|
+
emptyValue: z17.string().default("\u2013"),
|
|
2381
|
+
/** Expression over `row`: false greys the step (dashed marker, no chip, not clickable). */
|
|
2382
|
+
trackedWhen: z17.string().optional(),
|
|
2383
|
+
/** Expression over `row`: true draws the step's needs-attention ring. */
|
|
2384
|
+
attentionWhen: z17.string().optional(),
|
|
2385
|
+
/** The selected step's id (a template, e.g. "${modal.args.stage}"): highlighted. */
|
|
2386
|
+
selected: z17.string().optional(),
|
|
2387
|
+
/** While a step is selected, grey the others (default true). */
|
|
2388
|
+
dimOthers: z17.boolean().default(true),
|
|
2389
|
+
/** How each kind of step is drawn, by kind; `default` for steps of any other kind. */
|
|
2390
|
+
markers: z17.record(Marker).optional(),
|
|
2391
|
+
/** Needs attention: its colour, or images for the halo behind and the ring around (by kind). */
|
|
2392
|
+
attention: z17.object({
|
|
2393
|
+
color: z17.string().optional(),
|
|
2394
|
+
legend: z17.string().optional(),
|
|
2395
|
+
halo: MarkerImage.optional(),
|
|
2396
|
+
ring: z17.record(MarkerImage).optional()
|
|
2397
|
+
}).strict().optional(),
|
|
2398
|
+
/** The selected and hovered step: its colour, or images for the halo and ring. */
|
|
2399
|
+
selection: z17.object({ color: z17.string().optional(), halo: MarkerImage.optional(), ring: MarkerImage.optional() }).strict().optional(),
|
|
2400
|
+
/** The legend in the header, from `markers` and `attention` (default true). */
|
|
2401
|
+
legend: z17.boolean().default(true),
|
|
2402
|
+
/** Legend text for untracked steps, shown only when a step is untracked. */
|
|
2403
|
+
untrackedLegend: z17.string().optional(),
|
|
2404
|
+
/** Spacing of the map, px; the defaults draw a 1030 px wide canvas. */
|
|
2405
|
+
layout: z17.object({
|
|
2406
|
+
perRow: z17.number().int().min(1).max(20).optional(),
|
|
2407
|
+
colGap: z17.number().positive().optional(),
|
|
2408
|
+
left: z17.number().optional(),
|
|
2409
|
+
top: z17.number().optional(),
|
|
2410
|
+
feedGap: z17.number().positive().optional(),
|
|
2411
|
+
firstRowGap: z17.number().positive().optional(),
|
|
2412
|
+
rowGap: z17.number().positive().optional(),
|
|
2413
|
+
stub: z17.number().min(0).optional(),
|
|
2414
|
+
bendRight: z17.number().optional(),
|
|
2415
|
+
bendLeft: z17.number().optional(),
|
|
2416
|
+
width: z17.number().positive().optional(),
|
|
2417
|
+
bottom: z17.number().min(0).optional(),
|
|
2418
|
+
mainGroup: z17.string().optional(),
|
|
2419
|
+
mainStartsAt: z17.number().int().min(0).optional(),
|
|
2420
|
+
mergeRow: z17.number().int().min(0).optional()
|
|
2421
|
+
}).strict().optional(),
|
|
2422
|
+
/** Below this width the map scrolls sideways instead of shrinking, px (default 760). */
|
|
2423
|
+
minWidth: z17.number().min(0).default(760)
|
|
2733
2424
|
}).strict()
|
|
2734
2425
|
};
|
|
2735
2426
|
|
|
@@ -2739,7 +2430,7 @@ var ImageContract = {
|
|
|
2739
2430
|
kind: "Image",
|
|
2740
2431
|
version: 1,
|
|
2741
2432
|
schema: z18.object({
|
|
2742
|
-
...
|
|
2433
|
+
...Common,
|
|
2743
2434
|
src: z18.string().optional(),
|
|
2744
2435
|
srcField: z18.string().optional(),
|
|
2745
2436
|
alt: z18.string().default(""),
|
|
@@ -2749,7 +2440,7 @@ var ImageContract = {
|
|
|
2749
2440
|
|
|
2750
2441
|
// src/widgets/schemas/ImageMap.ts
|
|
2751
2442
|
import { z as z19 } from "zod";
|
|
2752
|
-
var
|
|
2443
|
+
var Marker2 = z19.object({
|
|
2753
2444
|
x: z19.number(),
|
|
2754
2445
|
y: z19.number(),
|
|
2755
2446
|
label: z19.string().optional(),
|
|
@@ -2760,12 +2451,12 @@ var ImageMapContract = {
|
|
|
2760
2451
|
kind: "ImageMap",
|
|
2761
2452
|
version: 1,
|
|
2762
2453
|
schema: z19.object({
|
|
2763
|
-
...
|
|
2454
|
+
...Common,
|
|
2764
2455
|
src: z19.string(),
|
|
2765
2456
|
alt: z19.string().default(""),
|
|
2766
2457
|
/** Static markers (x and y in % of the image), or field names to read markers from the data rows. */
|
|
2767
2458
|
markers: z19.union([
|
|
2768
|
-
z19.array(
|
|
2459
|
+
z19.array(Marker2),
|
|
2769
2460
|
z19.object({
|
|
2770
2461
|
x: z19.string(),
|
|
2771
2462
|
y: z19.string(),
|
|
@@ -2787,7 +2478,7 @@ var KpiContract = {
|
|
|
2787
2478
|
kind: "Kpi",
|
|
2788
2479
|
version: 1,
|
|
2789
2480
|
schema: z20.object({
|
|
2790
|
-
...
|
|
2481
|
+
...Common,
|
|
2791
2482
|
unit: z20.string().optional(),
|
|
2792
2483
|
/** "small" (default): the unit in small text after the number; "value": in the number's own type ("93.9%"). */
|
|
2793
2484
|
unitStyle: z20.enum(["small", "value"]).default("small"),
|
|
@@ -2834,7 +2525,7 @@ import { z as z21 } from "zod";
|
|
|
2834
2525
|
var SparklineContract = {
|
|
2835
2526
|
kind: "Sparkline",
|
|
2836
2527
|
version: 1,
|
|
2837
|
-
schema: z21.object({ ...
|
|
2528
|
+
schema: z21.object({ ...Common, x: z21.string().optional(), y: z21.string(), area: z21.boolean().default(true) }).strict()
|
|
2838
2529
|
};
|
|
2839
2530
|
|
|
2840
2531
|
// src/widgets/schemas/StageTracker.ts
|
|
@@ -2843,7 +2534,7 @@ var StageTrackerContract = {
|
|
|
2843
2534
|
kind: "StageTracker",
|
|
2844
2535
|
version: 1,
|
|
2845
2536
|
schema: z22.object({
|
|
2846
|
-
...
|
|
2537
|
+
...Common,
|
|
2847
2538
|
stages: z22.array(z22.string()).min(1),
|
|
2848
2539
|
/** Field with the current stage (name or index); default "stage". */
|
|
2849
2540
|
current: z22.string().default("stage")
|
|
@@ -2856,7 +2547,7 @@ var StateTimelineContract = {
|
|
|
2856
2547
|
kind: "StateTimeline",
|
|
2857
2548
|
version: 1,
|
|
2858
2549
|
schema: z23.object({
|
|
2859
|
-
...
|
|
2550
|
+
...Common,
|
|
2860
2551
|
time: z23.string().default("ts"),
|
|
2861
2552
|
value: z23.string().default("value"),
|
|
2862
2553
|
/** Raw value → state, e.g. { "RUN": "running" }. */
|
|
@@ -2878,7 +2569,7 @@ var StatusContract = {
|
|
|
2878
2569
|
version: 1,
|
|
2879
2570
|
small: true,
|
|
2880
2571
|
schema: z24.object({
|
|
2881
|
-
...
|
|
2572
|
+
...Common,
|
|
2882
2573
|
/** Field shown under the state, e.g. the running program. */
|
|
2883
2574
|
label: z24.string().optional(),
|
|
2884
2575
|
/** Field holding the state. */
|
|
@@ -2935,7 +2626,7 @@ var Column = z25.object({
|
|
|
2935
2626
|
}).strict();
|
|
2936
2627
|
var Agg = z25.enum(["sum", "avg", "min", "max", "count"]);
|
|
2937
2628
|
var schema = z25.object({
|
|
2938
|
-
...
|
|
2629
|
+
...Common,
|
|
2939
2630
|
columns: z25.array(Column).optional(),
|
|
2940
2631
|
/** Tallest the rows get, in px; past it they scroll. Default: the card's height. */
|
|
2941
2632
|
maxHeight: z25.number().int().min(60).optional(),
|
|
@@ -3020,7 +2711,7 @@ var TilesContract = {
|
|
|
3020
2711
|
kind: "Tiles",
|
|
3021
2712
|
version: 1,
|
|
3022
2713
|
schema: z26.object({
|
|
3023
|
-
...
|
|
2714
|
+
...Common,
|
|
3024
2715
|
/** Fixed tiles instead of data rows: objects whose fields `label`, `value`, `caption`… read; values can be templates. */
|
|
3025
2716
|
items: z26.array(z26.record(z26.unknown())).optional(),
|
|
3026
2717
|
label: z26.string(),
|
|
@@ -3188,7 +2879,7 @@ var ButtonContract = {
|
|
|
3188
2879
|
import { z as z28 } from "zod";
|
|
3189
2880
|
var Y = z28.union([z28.string(), z28.array(z28.string()).min(1)]);
|
|
3190
2881
|
var cartesianProps = {
|
|
3191
|
-
...
|
|
2882
|
+
...Common,
|
|
3192
2883
|
x: z28.string(),
|
|
3193
2884
|
y: Y.optional(),
|
|
3194
2885
|
seriesBy: z28.string().optional(),
|
|
@@ -3266,7 +2957,7 @@ var PieChartContract = {
|
|
|
3266
2957
|
kind: "PieChart",
|
|
3267
2958
|
version: 1,
|
|
3268
2959
|
schema: z28.object({
|
|
3269
|
-
...
|
|
2960
|
+
...Common,
|
|
3270
2961
|
label: z28.string(),
|
|
3271
2962
|
value: z28.string(),
|
|
3272
2963
|
donut: z28.boolean().default(false),
|
|
@@ -3279,7 +2970,7 @@ var ScatterContract = {
|
|
|
3279
2970
|
kind: "Scatter",
|
|
3280
2971
|
version: 1,
|
|
3281
2972
|
schema: z28.object({
|
|
3282
|
-
...
|
|
2973
|
+
...Common,
|
|
3283
2974
|
x: z28.string(),
|
|
3284
2975
|
y: z28.string(),
|
|
3285
2976
|
size: z28.string().optional(),
|
|
@@ -3293,7 +2984,7 @@ var GaugeContract = {
|
|
|
3293
2984
|
kind: "Gauge",
|
|
3294
2985
|
version: 1,
|
|
3295
2986
|
schema: z28.object({
|
|
3296
|
-
...
|
|
2987
|
+
...Common,
|
|
3297
2988
|
min: z28.number().default(0),
|
|
3298
2989
|
max: z28.number().default(100),
|
|
3299
2990
|
bands: z28.array(Band).optional(),
|
|
@@ -3307,7 +2998,7 @@ var MatrixChartContract = {
|
|
|
3307
2998
|
kind: "MatrixChart",
|
|
3308
2999
|
version: 1,
|
|
3309
3000
|
schema: z28.object({
|
|
3310
|
-
...
|
|
3001
|
+
...Common,
|
|
3311
3002
|
rows: z28.string(),
|
|
3312
3003
|
cols: z28.string(),
|
|
3313
3004
|
value: z28.string(),
|
|
@@ -3333,7 +3024,7 @@ var CardContract = {
|
|
|
3333
3024
|
version: 1,
|
|
3334
3025
|
slots: { body: { label: "Body" } },
|
|
3335
3026
|
schema: z29.object({
|
|
3336
|
-
...
|
|
3027
|
+
...Common,
|
|
3337
3028
|
direction: z29.enum(["column", "row"]).default("column"),
|
|
3338
3029
|
gap: GAP,
|
|
3339
3030
|
align: z29.enum(["stretch", "start", "center", "end"]).default("stretch")
|
|
@@ -3344,7 +3035,7 @@ var TabsContract = {
|
|
|
3344
3035
|
version: 1,
|
|
3345
3036
|
openSlots: true,
|
|
3346
3037
|
schema: z29.object({
|
|
3347
|
-
...
|
|
3038
|
+
...Common,
|
|
3348
3039
|
tabs: z29.array(z29.object({ key: z29.string().regex(/^[A-Za-z][\w-]*$/), label: z29.string() }).strict()).min(1).default([
|
|
3349
3040
|
{ key: "tab1", label: "Tab 1" },
|
|
3350
3041
|
{ key: "tab2", label: "Tab 2" }
|
|
@@ -3358,7 +3049,7 @@ var RepeaterContract = {
|
|
|
3358
3049
|
version: 1,
|
|
3359
3050
|
slots: { item: { label: "Each item" } },
|
|
3360
3051
|
schema: z29.object({
|
|
3361
|
-
...
|
|
3052
|
+
...Common,
|
|
3362
3053
|
layout: z29.enum(["grid", "list"]).default("grid"),
|
|
3363
3054
|
/** Grid: the narrowest an item gets before the row wraps, in px. */
|
|
3364
3055
|
minItemWidth: z29.number().int().min(60).max(1200).default(220),
|
|
@@ -3386,6 +3077,7 @@ var builtInWidgetContracts = [
|
|
|
3386
3077
|
StatusContract,
|
|
3387
3078
|
CardGridContract,
|
|
3388
3079
|
ImageMapContract,
|
|
3080
|
+
FlowMapContract,
|
|
3389
3081
|
SparklineContract,
|
|
3390
3082
|
ContentContract,
|
|
3391
3083
|
ImageContract,
|
|
@@ -3406,26 +3098,11 @@ var builtInWidgetContracts = [
|
|
|
3406
3098
|
var builtInWidgetChecks = contractChecks(builtInWidgetContracts);
|
|
3407
3099
|
|
|
3408
3100
|
export {
|
|
3409
|
-
ExpressionError,
|
|
3410
|
-
parse,
|
|
3411
|
-
compile,
|
|
3412
|
-
scope,
|
|
3413
|
-
evaluate,
|
|
3414
|
-
evaluateSafe,
|
|
3415
3101
|
translator,
|
|
3416
3102
|
parseDuration,
|
|
3417
3103
|
plantDayStart,
|
|
3418
3104
|
plantDate,
|
|
3419
3105
|
createHelpers,
|
|
3420
|
-
placeholders,
|
|
3421
|
-
stripStrings,
|
|
3422
|
-
expressionReferences,
|
|
3423
|
-
templateReferences,
|
|
3424
|
-
collectReferences,
|
|
3425
|
-
interpolate,
|
|
3426
|
-
resolve,
|
|
3427
|
-
interpolateUrl,
|
|
3428
|
-
resolveRequest,
|
|
3429
3106
|
DataError,
|
|
3430
3107
|
mergeConnections,
|
|
3431
3108
|
resolveBaseUrl,
|
|
@@ -3495,6 +3172,7 @@ export {
|
|
|
3495
3172
|
ContainerContract,
|
|
3496
3173
|
ContentContract,
|
|
3497
3174
|
FilterContract,
|
|
3175
|
+
FlowMapContract,
|
|
3498
3176
|
ImageContract,
|
|
3499
3177
|
ImageMapContract,
|
|
3500
3178
|
KpiContract,
|
|
@@ -3524,4 +3202,4 @@ export {
|
|
|
3524
3202
|
RepeaterContract,
|
|
3525
3203
|
builtInWidgetChecks
|
|
3526
3204
|
};
|
|
3527
|
-
//# sourceMappingURL=chunk-
|
|
3205
|
+
//# sourceMappingURL=chunk-O4BYNRCA.js.map
|