@holistics/anfra-sdk 0.13.5 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/app.d.ts +4 -3
- package/dist/app.js +17 -7
- package/dist/{bootstrap-BbsNvZ8s.d.ts → bootstrap-MhTSkiA1.d.ts} +96 -3
- package/dist/build.d.ts +2 -0
- package/dist/chunk-A3LNZMT6.js +10 -0
- package/dist/chunk-CYZQ7ZTJ.js +237 -0
- package/dist/chunk-DITKCHFQ.js +166 -0
- package/dist/chunk-F6MRA7J4.js +65 -0
- package/dist/chunk-GBXK7F2V.js +431 -0
- package/dist/chunk-GOUDXWG4.js +750 -0
- package/dist/chunk-GV7SVWEK.js +84 -0
- package/dist/chunk-H52PO7MP.js +105 -0
- package/dist/chunk-HI3ZAXJK.js +8 -0
- package/dist/{chunk-KI5CAVAR.js → chunk-HRV45ULB.js} +477 -25
- package/dist/chunk-K633QHGO.js +51 -0
- package/dist/chunk-KFD6CHLI.js +38 -0
- package/dist/{chunk-OJ5WIKWE.js → chunk-Q46CZIEK.js} +1 -1
- package/dist/{chunk-ADWBOQW2.js → chunk-S6XLP6U4.js} +31 -1
- package/dist/{chunk-TQ7S5DRE.js → chunk-WI5VJ2Z6.js} +1 -1
- package/dist/common.d.ts +1 -1
- package/dist/common.js +14 -4
- package/dist/data-UCCW2VWH.js +233 -0
- package/dist/declaration-GVDOGQY6.js +218 -0
- package/dist/host.d.ts +42 -4
- package/dist/host.js +412 -9
- package/dist/menu-CdGVKc4_.d.ts +151 -0
- package/dist/overview-XXND2V5V.js +358 -0
- package/dist/plugin-BmIDirTx.d.ts +303 -0
- package/dist/plugins.d.ts +6 -8
- package/dist/plugins.js +98 -69
- package/dist/queries-2OHKMTPC.js +661 -0
- package/dist/structure-WRDUXHD4.js +256 -0
- package/dist/tab-HMQOITVM.js +932 -0
- package/dist/testing.js +4 -4
- package/package.json +1 -1
- package/dist/bridge-WC7GliCH.d.ts +0 -73
- package/dist/chunk-33B2D4U5.js +0 -6
- package/dist/plugin-056-SKwd.d.ts +0 -132
- /package/dist/{chunk-52LXBYQM.js → chunk-UUKXJSE4.js} +0 -0
|
@@ -0,0 +1,750 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LINEAGE_TAB,
|
|
3
|
+
plural
|
|
4
|
+
} from "./chunk-H52PO7MP.js";
|
|
5
|
+
|
|
6
|
+
// src/plugins/inspect/model/trust.ts
|
|
7
|
+
var TRUST_LEVELS = {
|
|
8
|
+
1: {
|
|
9
|
+
tone: "error",
|
|
10
|
+
name: "Unverified",
|
|
11
|
+
points: ["A query has no dataset, or there are no queries", "Numbers can't be traced to the semantic layer"]
|
|
12
|
+
},
|
|
13
|
+
2: {
|
|
14
|
+
tone: "warn",
|
|
15
|
+
name: "Verified, incomplete",
|
|
16
|
+
points: ["All queries use the semantic layer", "Some failed or haven't returned yet, so the app may be incomplete"]
|
|
17
|
+
},
|
|
18
|
+
3: {
|
|
19
|
+
tone: "ok",
|
|
20
|
+
name: "Semantic layer verified",
|
|
21
|
+
points: ["All queries use the semantic layer and succeeded", "Some fields are still ad hoc expressions"]
|
|
22
|
+
},
|
|
23
|
+
4: {
|
|
24
|
+
tone: "ok",
|
|
25
|
+
name: "Endorsed",
|
|
26
|
+
points: ["All queries use the semantic layer and succeeded", "Every field is an endorsed object from the semantic layer, none ad hoc"]
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var LEVELS = Object.keys(TRUST_LEVELS).map(Number);
|
|
30
|
+
var at = (level, text) => ({ level, tone: TRUST_LEVELS[level].tone, text });
|
|
31
|
+
var adhocCount = (query) => query.columns.filter((column) => column.adhoc).length;
|
|
32
|
+
var isEndorsed = (_query) => false;
|
|
33
|
+
function queryTrust(declaration, query) {
|
|
34
|
+
if (!declaration?.dataset) return at(1, "Not on the semantic layer: declares no dataset");
|
|
35
|
+
if (query.state === "error") return at(2, "On the semantic layer, but failed");
|
|
36
|
+
if (query.state !== "success") return at(2, "On the semantic layer, but hasn't returned yet");
|
|
37
|
+
if (isEndorsed(query)) return at(4, "Endorsed");
|
|
38
|
+
const adhoc = adhocCount(query);
|
|
39
|
+
return at(3, adhoc ? `Semantic layer verified \xB7 ${plural(adhoc, "ad hoc field")}` : "Semantic layer verified");
|
|
40
|
+
}
|
|
41
|
+
function appTrust(app) {
|
|
42
|
+
const queries = Object.entries(app.queries);
|
|
43
|
+
if (queries.length === 0) return at(1, "No queries found");
|
|
44
|
+
const levels = queries.map(([name, query]) => queryTrust(app.declaration.queries[name], query).level);
|
|
45
|
+
const level = Math.min(...levels);
|
|
46
|
+
const n = levels.filter((l) => l === level).length;
|
|
47
|
+
const total = queries.length;
|
|
48
|
+
if (level === 1) return at(1, `${n} of ${total} queries aren't on the semantic layer`);
|
|
49
|
+
if (level === 2) {
|
|
50
|
+
const failed = queries.filter(([, query]) => query.state === "error").length;
|
|
51
|
+
const waiting = n - failed;
|
|
52
|
+
const parts = [failed && `${failed} of ${total} queries failed`, waiting && `${waiting} of ${total} haven't returned yet`];
|
|
53
|
+
return at(2, parts.filter(Boolean).join(" \xB7 "));
|
|
54
|
+
}
|
|
55
|
+
if (level === 4) return at(4, "All queries are endorsed");
|
|
56
|
+
const adhoc = queries.filter(([, query]) => adhocCount(query) > 0).length;
|
|
57
|
+
return at(3, adhoc ? `All queries are semantic layer verified \xB7 ${adhoc} with ad hoc fields` : "All queries are semantic layer verified");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// src/plugins/inspect/model/highlight.ts
|
|
61
|
+
var words = (list) => new Set(list.split(" "));
|
|
62
|
+
var KEYWORDS = {
|
|
63
|
+
aql: words(
|
|
64
|
+
"explore dimensions measures sorts filters where having limit offset desc asc and or not in is null true false as with by order group"
|
|
65
|
+
),
|
|
66
|
+
sql: words(
|
|
67
|
+
"select from where group by order having limit offset join left right inner outer full cross on as and or not in is null like between case when then else end distinct union all with over partition asc desc true false cast count sum avg min max"
|
|
68
|
+
),
|
|
69
|
+
js: words("const let var true false null undefined")
|
|
70
|
+
};
|
|
71
|
+
var TOKEN = /(--[^\n]*|\/\/[^\n]*|\/\*[\s\S]*?\*\/)|('(?:[^'\\]|\\.|'')*'|"(?:[^"\\]|\\.)*"|`[^`]*`)|(\b\d+(?:\.\d+)?\b)|([A-Za-z_]\w*)(\s*\()?/g;
|
|
72
|
+
function tokenize(text, lang) {
|
|
73
|
+
const out = [];
|
|
74
|
+
let last = 0;
|
|
75
|
+
const plain = (to) => {
|
|
76
|
+
if (to > last) out.push({ text: text.slice(last, to) });
|
|
77
|
+
};
|
|
78
|
+
for (const m of text.matchAll(TOKEN)) {
|
|
79
|
+
const i = m.index;
|
|
80
|
+
let kind;
|
|
81
|
+
let length = m[0].length;
|
|
82
|
+
if (m[1]) kind = "com";
|
|
83
|
+
else if (m[2] && lang === "js" && m[2].startsWith("`")) {
|
|
84
|
+
plain(i);
|
|
85
|
+
out.push({ text: "`" }, ...tokenize(m[2].slice(1, -1), "aql"), { text: "`" });
|
|
86
|
+
last = i + length;
|
|
87
|
+
continue;
|
|
88
|
+
} else if (m[2]) kind = "str";
|
|
89
|
+
else if (m[3]) kind = "num";
|
|
90
|
+
else if (m[4] && m[5]) {
|
|
91
|
+
kind = "fn";
|
|
92
|
+
length = m[4].length;
|
|
93
|
+
} else if (m[4] && KEYWORDS[lang].has(m[4].toLowerCase())) kind = "kw";
|
|
94
|
+
if (!kind) continue;
|
|
95
|
+
plain(i);
|
|
96
|
+
out.push({ text: text.slice(i, i + length), kind });
|
|
97
|
+
last = i + length;
|
|
98
|
+
}
|
|
99
|
+
plain(text.length);
|
|
100
|
+
return out;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// src/plugins/inspect/view.ts
|
|
104
|
+
function h(doc, tag, attributes = {}, ...children) {
|
|
105
|
+
const element = doc.createElement(tag);
|
|
106
|
+
for (const [name, value] of Object.entries(attributes)) {
|
|
107
|
+
if (typeof value === "function") element.addEventListener(name.slice(2).toLowerCase(), value);
|
|
108
|
+
else if (value === true) element.setAttribute(name, "");
|
|
109
|
+
else if (value !== false && value !== void 0) element.setAttribute(name, String(value));
|
|
110
|
+
}
|
|
111
|
+
for (const child of children.flat(Infinity)) {
|
|
112
|
+
if (child === false || child === null || child === void 0) continue;
|
|
113
|
+
element.append(typeof child === "string" ? doc.createTextNode(child) : child);
|
|
114
|
+
}
|
|
115
|
+
return element;
|
|
116
|
+
}
|
|
117
|
+
function replace(doc, element, ...children) {
|
|
118
|
+
element.replaceChildren(...h(doc, "div", {}, ...children).childNodes);
|
|
119
|
+
}
|
|
120
|
+
var PATHS = {
|
|
121
|
+
close: "M6 6l12 12 M18 6L6 18",
|
|
122
|
+
copy: "M9 9h11v11H9z M5 15H4V4h11v1",
|
|
123
|
+
check: "M5 12l5 5 9-10",
|
|
124
|
+
table: "M4 5h16v14H4z M4 10h16 M4 15h16 M10 10v9",
|
|
125
|
+
download: "M12 4v11 M7 10l5 5 5-5 M5 20h14",
|
|
126
|
+
pick: "M4 4l7 16 2-7 7-2z",
|
|
127
|
+
chevron: "M9 6l6 6-6 6",
|
|
128
|
+
filter: "M4 6h16 M7 12h10 M10 18h4",
|
|
129
|
+
info: "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18z M12 11v6 M12 7.5v.5",
|
|
130
|
+
locate: "M12 3v4 M12 17v4 M3 12h4 M17 12h4 M12 8a4 4 0 1 0 0 8a4 4 0 1 0 0-8z",
|
|
131
|
+
query: "M5 6c0-1.7 3.1-3 7-3s7 1.3 7 3-3.1 3-7 3-7-1.3-7-3z M5 6v12c0 1.7 3.1 3 7 3s7-1.3 7-3V6 M5 12c0 1.7 3.1 3 7 3s7-1.3 7-3",
|
|
132
|
+
tree: "M5 4v16 M5 8h6 M5 16h6 M13 6h6v4h-6z M13 14h6v4h-6z",
|
|
133
|
+
search: "M11 4a7 7 0 1 0 0 14a7 7 0 1 0 0-14z M16 16l4 4",
|
|
134
|
+
// Lineage: a card per kind, and the canvas's tools.
|
|
135
|
+
lineage: "M9 18a3 3 0 1 0 6 0a3 3 0 1 0-6 0 M3 6a3 3 0 1 0 6 0a3 3 0 1 0-6 0 M15 6a3 3 0 1 0 6 0a3 3 0 1 0-6 0 M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9 M12 12v3",
|
|
136
|
+
control: "M4 6h9 M17 6h3 M15 4v4 M4 12h3 M11 12h9 M9 10v4 M4 18h11 M19 18h1 M17 16v4",
|
|
137
|
+
block: "M4 4h7v7H4z M13 4h7v7h-7z M4 13h7v7H4z M13 13h7v7h-7z",
|
|
138
|
+
metric: "M18 5H6l6 7-6 7h12",
|
|
139
|
+
dimension: "M3 17L17 3l4 4L7 21z M7 13l2 2 M10 10l2 2 M13 7l2 2",
|
|
140
|
+
dataset: "M4 8l8-4 8 4-8 4z M4 12l8 4 8-4 M4 16l8 4 8-4",
|
|
141
|
+
model: "M4 7l8-4 8 4v10l-8 4-8-4z M4 7l8 4 8-4 M12 11v10",
|
|
142
|
+
focus: "M4 8V4h4 M16 4h4v4 M20 16v4h-4 M8 20H4v-4 M12 9a3 3 0 1 0 0 6a3 3 0 1 0 0-6z",
|
|
143
|
+
expand: "M14 4h6v6 M10 20H4v-6 M20 4l-7 7 M4 20l7-7",
|
|
144
|
+
help: "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18z M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6v.6 M12 17v.5",
|
|
145
|
+
eye: "M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z M12 9a3 3 0 1 0 0 6a3 3 0 1 0 0-6z",
|
|
146
|
+
hidden: "M3 3l18 18 M10.6 5.1A10 10 0 0 1 12 5c6.5 0 10 7 10 7a17 17 0 0 1-3 3.9 M6.6 6.6A17 17 0 0 0 2 12s3.5 7 10 7a9.7 9.7 0 0 0 5.4-1.6 M9.9 9.9a3 3 0 0 0 4.2 4.2",
|
|
147
|
+
plus: "M12 5v14 M5 12h14",
|
|
148
|
+
minus: "M5 12h14",
|
|
149
|
+
fit: "M4 9V4h5 M15 4h5v5 M20 15v5h-5 M9 20H4v-5",
|
|
150
|
+
code: "M16 18l6-6-6-6 M8 6l-6 6 6 6"
|
|
151
|
+
};
|
|
152
|
+
function icon(doc, name) {
|
|
153
|
+
const svg = doc.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
154
|
+
for (const [key, value] of Object.entries({
|
|
155
|
+
class: "icon",
|
|
156
|
+
viewBox: "0 0 24 24",
|
|
157
|
+
width: "14",
|
|
158
|
+
height: "14",
|
|
159
|
+
fill: "none",
|
|
160
|
+
stroke: "currentColor",
|
|
161
|
+
"stroke-width": "1.8",
|
|
162
|
+
"stroke-linecap": "round",
|
|
163
|
+
"stroke-linejoin": "round",
|
|
164
|
+
"aria-hidden": "true"
|
|
165
|
+
})) svg.setAttribute(key, value);
|
|
166
|
+
const path = doc.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
167
|
+
path.setAttribute("d", PATHS[name]);
|
|
168
|
+
svg.append(path);
|
|
169
|
+
return svg;
|
|
170
|
+
}
|
|
171
|
+
var TYPE_PATHS = {
|
|
172
|
+
metric: "M17 5H7l6 7-6 7h10",
|
|
173
|
+
text: "M5 7V5h14v2 M12 5v14 M9 19h6",
|
|
174
|
+
number: "M5 9h14 M5 15h14 M10 4L8 20 M16 4l-2 16",
|
|
175
|
+
date: "M4 6h16v14H4z M4 10h16 M8 3v4 M16 3v4",
|
|
176
|
+
datetime: "M4 6h16v14H4z M4 10h16 M8 3v4 M16 3v4 M12 13v3h3",
|
|
177
|
+
truefalse: "M8 7h8a5 5 0 0 1 0 10H8A5 5 0 0 1 8 7z M8 10a2 2 0 1 0 0 4a2 2 0 1 0 0-4z",
|
|
178
|
+
bit: "M6 5v6 M12 5h4v6h-4z M6 13h4v6H6z M16 13v6",
|
|
179
|
+
json: "M9 4c-2 0-3 1-3 3v2c0 1.5-1 3-2 3 1 0 2 1.5 2 3v2c0 2 1 3 3 3 M15 4c2 0 3 1 3 3v2c0 1.5 1 3 2 3-1 0-2 1.5-2 3v2c0 2-1 3-3 3",
|
|
180
|
+
unknown: "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18z M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.7.3-1 .9-1 1.7 M12 17v.5"
|
|
181
|
+
};
|
|
182
|
+
function columnIcon(doc, column) {
|
|
183
|
+
const svg = icon(doc, "info");
|
|
184
|
+
svg.querySelector("path").setAttribute("d", column.isMeasure ? TYPE_PATHS.metric : TYPE_PATHS[column.semantic_type] ?? TYPE_PATHS.unknown);
|
|
185
|
+
svg.setAttribute("width", "12");
|
|
186
|
+
svg.setAttribute("height", "12");
|
|
187
|
+
return svg;
|
|
188
|
+
}
|
|
189
|
+
async function copyText(doc, text) {
|
|
190
|
+
try {
|
|
191
|
+
await doc.defaultView?.navigator.clipboard.writeText(text);
|
|
192
|
+
return true;
|
|
193
|
+
} catch {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function drawTab(root, context, draw, options = {}) {
|
|
198
|
+
const doc = context.document;
|
|
199
|
+
const body = h(doc, "div", { class: options.split ? "body split" : "body" });
|
|
200
|
+
root.append(h(doc, "style", {}, STYLES), h(doc, "div", { class: "pane" }, options.head, body));
|
|
201
|
+
const tooltip = tooltips(root);
|
|
202
|
+
const scrollers = () => [body, ...body.querySelectorAll(".detail, .scroll")];
|
|
203
|
+
const redraw = () => {
|
|
204
|
+
const scrolls = scrollers().map((element) => element.scrollTop);
|
|
205
|
+
const focused = root.activeElement?.closest?.("[data-key]")?.dataset.key;
|
|
206
|
+
const focusInBody = !!root.activeElement && body.contains(root.activeElement);
|
|
207
|
+
kept = new Set([...body.querySelectorAll("details[data-key]")].filter((d) => d.open).map((d) => d.dataset.key));
|
|
208
|
+
try {
|
|
209
|
+
replace(doc, body, draw());
|
|
210
|
+
} finally {
|
|
211
|
+
kept = void 0;
|
|
212
|
+
}
|
|
213
|
+
scrollers().forEach((element, index) => {
|
|
214
|
+
element.scrollTop = scrolls[index] ?? 0;
|
|
215
|
+
});
|
|
216
|
+
keepFlashes(body);
|
|
217
|
+
tooltip.redrawn();
|
|
218
|
+
if (focusInBody && focused !== void 0) {
|
|
219
|
+
[...body.querySelectorAll("[data-key]")].find((element) => element.dataset.key === focused)?.focus({ preventScroll: true });
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
redraw();
|
|
223
|
+
const stops = [context.panel.subscribe(redraw), ...(options.also ?? []).map((subscribe) => subscribe(redraw))];
|
|
224
|
+
return {
|
|
225
|
+
redraw,
|
|
226
|
+
dispose: () => {
|
|
227
|
+
stops.forEach((stop) => stop());
|
|
228
|
+
tooltip.dispose();
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
var kept;
|
|
233
|
+
function copyButton(doc, className, text, labels, attributes = {}) {
|
|
234
|
+
const button = h(doc, "button", { type: "button", class: className, ...attributes }, labels.idle);
|
|
235
|
+
button.addEventListener("click", async (event) => {
|
|
236
|
+
event.stopPropagation();
|
|
237
|
+
if (!await copyText(doc, text())) return;
|
|
238
|
+
replace(doc, button, labels.done);
|
|
239
|
+
setTimeout(() => replace(doc, button, labels.idle), 1500);
|
|
240
|
+
});
|
|
241
|
+
return button;
|
|
242
|
+
}
|
|
243
|
+
function copyIcon(doc, label, text, attributes = {}) {
|
|
244
|
+
return copyButton(doc, "row-action", text, { idle: icon(doc, "copy"), done: icon(doc, "check") }, { "data-tip": label, "aria-label": label, ...attributes });
|
|
245
|
+
}
|
|
246
|
+
function link(doc, label, onclick, attributes = {}) {
|
|
247
|
+
return h(doc, "button", {
|
|
248
|
+
type: "button",
|
|
249
|
+
class: "link",
|
|
250
|
+
...attributes,
|
|
251
|
+
onclick: (event) => {
|
|
252
|
+
event.stopPropagation();
|
|
253
|
+
onclick();
|
|
254
|
+
}
|
|
255
|
+
}, label);
|
|
256
|
+
}
|
|
257
|
+
function lineageButton(doc, panel, node) {
|
|
258
|
+
const button = h(doc, "button", {
|
|
259
|
+
type: "button",
|
|
260
|
+
class: "row-action",
|
|
261
|
+
"aria-label": "Show in Lineage",
|
|
262
|
+
"data-tip": node === void 0 ? void 0 : "Show in Lineage",
|
|
263
|
+
"data-testid": "show-in-lineage",
|
|
264
|
+
disabled: node === void 0,
|
|
265
|
+
onclick: (event) => {
|
|
266
|
+
event.preventDefault();
|
|
267
|
+
event.stopPropagation();
|
|
268
|
+
if (node !== void 0) panel.show(LINEAGE_TAB, node);
|
|
269
|
+
}
|
|
270
|
+
}, icon(doc, "lineage"));
|
|
271
|
+
return node === void 0 ? h(doc, "span", { class: "row-action-wrap", "data-tip": "Not on the page, so it can't be selected in Lineage" }, button) : button;
|
|
272
|
+
}
|
|
273
|
+
function collapsible(doc, key, summary, body, options = {}) {
|
|
274
|
+
const open = options.open || !!kept?.has(key);
|
|
275
|
+
const details = h(
|
|
276
|
+
doc,
|
|
277
|
+
"details",
|
|
278
|
+
{ class: `collapsible ${options.class ?? ""}`, "data-key": key, open },
|
|
279
|
+
h(doc, "summary", { "data-key": `${key}:summary` }, icon(doc, "chevron"), summary)
|
|
280
|
+
);
|
|
281
|
+
let drawn = false;
|
|
282
|
+
const fill = () => {
|
|
283
|
+
if (!details.open || drawn) return;
|
|
284
|
+
drawn = true;
|
|
285
|
+
details.append(h(doc, "div", { class: "collapsible-body" }, body()));
|
|
286
|
+
};
|
|
287
|
+
fill();
|
|
288
|
+
details.addEventListener("toggle", () => {
|
|
289
|
+
fill();
|
|
290
|
+
options.onToggle?.(details.open);
|
|
291
|
+
});
|
|
292
|
+
return details;
|
|
293
|
+
}
|
|
294
|
+
var tips = /* @__PURE__ */ new WeakMap();
|
|
295
|
+
function tip(element, content) {
|
|
296
|
+
tips.set(element, content);
|
|
297
|
+
return element;
|
|
298
|
+
}
|
|
299
|
+
function popover(doc, trigger, content, attributes = {}) {
|
|
300
|
+
const button = h(doc, "button", {
|
|
301
|
+
type: "button",
|
|
302
|
+
class: "pop-trigger",
|
|
303
|
+
...attributes,
|
|
304
|
+
onclick: (event) => {
|
|
305
|
+
event.stopPropagation();
|
|
306
|
+
controllers.get(button.getRootNode())?.toggle(button);
|
|
307
|
+
}
|
|
308
|
+
}, trigger);
|
|
309
|
+
return tip(button, content);
|
|
310
|
+
}
|
|
311
|
+
var TIP_DELAY = 300;
|
|
312
|
+
var TIP_WARM = 400;
|
|
313
|
+
var TIP_GAP = 4;
|
|
314
|
+
var TIP_MARGIN = 8;
|
|
315
|
+
var controllers = /* @__PURE__ */ new WeakMap();
|
|
316
|
+
function tooltips(root) {
|
|
317
|
+
const doc = root.ownerDocument;
|
|
318
|
+
const win = doc.defaultView;
|
|
319
|
+
const box = h(doc, "div", { class: "tooltip", role: "tooltip", id: "anfra-tooltip", popover: "manual", hidden: true });
|
|
320
|
+
root.append(box);
|
|
321
|
+
let anchor;
|
|
322
|
+
let pending;
|
|
323
|
+
let timer;
|
|
324
|
+
let hiddenAt = 0;
|
|
325
|
+
const target = (event) => event.composedPath().find((node) => node instanceof win.HTMLElement && (node.hasAttribute("data-tip") || tips.has(node)));
|
|
326
|
+
const place = () => {
|
|
327
|
+
if (!anchor) return;
|
|
328
|
+
const at2 = anchor.getBoundingClientRect();
|
|
329
|
+
const size = box.getBoundingClientRect();
|
|
330
|
+
const below = at2.bottom + TIP_GAP;
|
|
331
|
+
const above = at2.top - TIP_GAP - size.height;
|
|
332
|
+
const fitsBelow = below + size.height <= win.innerHeight - TIP_MARGIN;
|
|
333
|
+
const top = fitsBelow ? below : above >= TIP_MARGIN ? above : Math.max(TIP_MARGIN, win.innerHeight - TIP_MARGIN - size.height);
|
|
334
|
+
box.style.left = `${Math.max(TIP_MARGIN, Math.min(at2.left, win.innerWidth - TIP_MARGIN - size.width))}px`;
|
|
335
|
+
box.style.top = `${top}px`;
|
|
336
|
+
};
|
|
337
|
+
const show = (element) => {
|
|
338
|
+
clearTimeout(timer);
|
|
339
|
+
pending = void 0;
|
|
340
|
+
const rich = tips.get(element);
|
|
341
|
+
const text = element.dataset.tip;
|
|
342
|
+
if (!rich && !text) return;
|
|
343
|
+
anchor?.removeAttribute("aria-describedby");
|
|
344
|
+
anchor = element;
|
|
345
|
+
replace(doc, box, rich ? rich() : text);
|
|
346
|
+
box.classList.toggle("rich", !!rich);
|
|
347
|
+
box.hidden = false;
|
|
348
|
+
if (!box.matches(":popover-open")) box.showPopover?.();
|
|
349
|
+
element.setAttribute("aria-describedby", box.id);
|
|
350
|
+
place();
|
|
351
|
+
};
|
|
352
|
+
const hide = () => {
|
|
353
|
+
clearTimeout(timer);
|
|
354
|
+
pending = void 0;
|
|
355
|
+
if (!anchor) return;
|
|
356
|
+
anchor.removeAttribute("aria-describedby");
|
|
357
|
+
anchor = void 0;
|
|
358
|
+
box.hidden = true;
|
|
359
|
+
box.hidePopover?.();
|
|
360
|
+
hiddenAt = Date.now();
|
|
361
|
+
};
|
|
362
|
+
const later = (element) => {
|
|
363
|
+
clearTimeout(timer);
|
|
364
|
+
if (anchor || Date.now() - hiddenAt < TIP_WARM) {
|
|
365
|
+
show(element);
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
pending = element;
|
|
369
|
+
timer = setTimeout(() => show(element), TIP_DELAY);
|
|
370
|
+
};
|
|
371
|
+
const listeners = [
|
|
372
|
+
[root, "pointerover", (event) => {
|
|
373
|
+
const element = target(event);
|
|
374
|
+
if (element && element !== anchor && element !== pending) later(element);
|
|
375
|
+
}, false],
|
|
376
|
+
[root, "pointerout", (event) => {
|
|
377
|
+
const current = anchor ?? pending;
|
|
378
|
+
const next = event.relatedTarget;
|
|
379
|
+
if (current && !(next && current.contains(next))) hide();
|
|
380
|
+
}, false],
|
|
381
|
+
[root, "focusin", (event) => {
|
|
382
|
+
const element = target(event);
|
|
383
|
+
if (element?.matches(":focus-visible")) later(element);
|
|
384
|
+
}, false],
|
|
385
|
+
[root, "focusout", () => hide(), false],
|
|
386
|
+
[root, "pointerdown", () => hide(), true],
|
|
387
|
+
[root, "keydown", (event) => {
|
|
388
|
+
if (event.key === "Escape") hide();
|
|
389
|
+
}, false],
|
|
390
|
+
// A scroll inside the tab's shadow root doesn't reach the document, so both are listened to.
|
|
391
|
+
[root, "scroll", () => hide(), true],
|
|
392
|
+
[win, "scroll", () => hide(), true],
|
|
393
|
+
[win, "resize", () => hide(), false]
|
|
394
|
+
];
|
|
395
|
+
listeners.forEach(([on, name, listener, capture]) => on.addEventListener(name, listener, capture));
|
|
396
|
+
const controller = {
|
|
397
|
+
toggle: (element) => {
|
|
398
|
+
if (anchor === element) hide();
|
|
399
|
+
else show(element);
|
|
400
|
+
},
|
|
401
|
+
redrawn: () => {
|
|
402
|
+
if (!anchor || anchor.isConnected) return;
|
|
403
|
+
const key = anchor.dataset.key;
|
|
404
|
+
const next = key === void 0 ? void 0 : [...root.querySelectorAll("[data-key]")].find((element) => element.dataset.key === key);
|
|
405
|
+
if (next) show(next);
|
|
406
|
+
else hide();
|
|
407
|
+
},
|
|
408
|
+
dispose: () => {
|
|
409
|
+
hide();
|
|
410
|
+
listeners.forEach(([on, name, listener, capture]) => on.removeEventListener(name, listener, capture));
|
|
411
|
+
controllers.delete(root);
|
|
412
|
+
box.remove();
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
controllers.set(root, controller);
|
|
416
|
+
return controller;
|
|
417
|
+
}
|
|
418
|
+
function trustBars(doc, trust, size = "md") {
|
|
419
|
+
const [base, rise, width] = size === "sm" ? [4, 8, 3] : size === "lg" ? [20, 28, 12] : [12, 16, 8];
|
|
420
|
+
return h(doc, "span", { class: `bars ${size}`, "aria-hidden": "true" }, LEVELS.map((level) => h(doc, "span", {
|
|
421
|
+
class: level <= trust.level ? `bar fill-${trust.tone}` : "bar",
|
|
422
|
+
style: `height:${base + (level - 1) * rise / (LEVELS.length - 1)}px;width:${width}px`
|
|
423
|
+
})));
|
|
424
|
+
}
|
|
425
|
+
function trustIndicator(doc, trust) {
|
|
426
|
+
const label = `Level ${trust.level} \xB7 ${TRUST_LEVELS[trust.level].name}`;
|
|
427
|
+
return h(doc, "span", { class: "indicator trust", role: "img", "aria-label": `Trust level ${trust.level}`, "data-tip": label }, trustBars(doc, trust, "sm"));
|
|
428
|
+
}
|
|
429
|
+
function stateDot(doc, state) {
|
|
430
|
+
return h(doc, "span", { class: `dot ${state}`, role: "img", "aria-label": `State: ${state}`, "data-tip": state });
|
|
431
|
+
}
|
|
432
|
+
function filterIndicator(doc, active) {
|
|
433
|
+
if (active.length === 0) return h(doc, "span", { class: "indicator filters", "aria-hidden": "true" });
|
|
434
|
+
const lines = active.map((input) => {
|
|
435
|
+
const source = input.kind === "declared" ? "query" : input.self ? "itself" : input.source;
|
|
436
|
+
return `${input.field} \xB7 ${source}${input.value !== "\u2014" ? `
|
|
437
|
+
${input.value}` : ""}${input.pending ? `
|
|
438
|
+
pending: ${input.pending}` : ""}`;
|
|
439
|
+
});
|
|
440
|
+
return h(doc, "span", {
|
|
441
|
+
class: "indicator filters",
|
|
442
|
+
"data-tip": `${plural(active.length, "filter")} applied
|
|
443
|
+
${lines.join("\n")}`,
|
|
444
|
+
"aria-label": `${plural(active.length, "filter")} applied`
|
|
445
|
+
}, String(active.length), icon(doc, "filter"));
|
|
446
|
+
}
|
|
447
|
+
function highlighted(doc, code, lang) {
|
|
448
|
+
const tokens = lang ? tokenize(code, lang) : [{ text: code }];
|
|
449
|
+
return h(doc, "pre", { class: "code-text scroll" }, h(doc, "code", {}, tokens.map((token) => token.kind ? h(doc, "span", { class: `tok-${token.kind}` }, token.text) : token.text)));
|
|
450
|
+
}
|
|
451
|
+
function json(doc, value, indent, key) {
|
|
452
|
+
const data = value?.toJSON?.() ?? value;
|
|
453
|
+
if (typeof data === "string") return key === "aql" && data.includes("\n") ? aql(doc, data, `${indent} `) : h(doc, "span", { class: "tok-str" }, JSON.stringify(data));
|
|
454
|
+
if (typeof data === "number" || typeof data === "boolean" || data === null) {
|
|
455
|
+
return h(doc, "span", { class: typeof data === "number" ? "tok-num" : "tok-kw" }, JSON.stringify(data));
|
|
456
|
+
}
|
|
457
|
+
const inner = `${indent} `;
|
|
458
|
+
if (Array.isArray(data)) {
|
|
459
|
+
if (!data.length) return "[]";
|
|
460
|
+
return ["[\n", data.map((item, i) => [inner, json(doc, item === void 0 || typeof item === "function" ? null : item, inner, void 0), i < data.length - 1 ? ",\n" : "\n"]), `${indent}]`];
|
|
461
|
+
}
|
|
462
|
+
const entries = Object.entries(data).filter(([, item]) => item !== void 0 && typeof item !== "function");
|
|
463
|
+
if (!entries.length) return "{}";
|
|
464
|
+
return ["{\n", entries.map(([name, item], i) => [
|
|
465
|
+
inner,
|
|
466
|
+
h(doc, "span", { class: "tok-key" }, JSON.stringify(name)),
|
|
467
|
+
": ",
|
|
468
|
+
json(doc, item, inner, name),
|
|
469
|
+
i < entries.length - 1 ? ",\n" : "\n"
|
|
470
|
+
]), `${indent}}`];
|
|
471
|
+
}
|
|
472
|
+
function aql(doc, text, indent) {
|
|
473
|
+
const lines = text.split("\n");
|
|
474
|
+
const rest = lines.slice(1).filter((line) => line.trim());
|
|
475
|
+
const shared = rest.length ? Math.min(...rest.map((line) => line.length - line.trimStart().length)) : 0;
|
|
476
|
+
const escape = (part) => JSON.stringify(part).slice(1, -1);
|
|
477
|
+
return h(doc, "span", { class: "tok-str" }, '"', lines.map((line, i) => {
|
|
478
|
+
const cut = i === 0 ? 0 : Math.min(shared, line.length - line.trimStart().length);
|
|
479
|
+
return [
|
|
480
|
+
cut > 0 && h(doc, "span", { class: "json-dedent" }, escape(line.slice(0, cut))),
|
|
481
|
+
tokenize(line.slice(cut), "aql").map((token) => token.kind ? h(doc, "span", { class: `tok-${token.kind}` }, escape(token.text)) : escape(token.text)),
|
|
482
|
+
i < lines.length - 1 && [h(doc, "span", { class: "json-nl" }, "\\n"), h(doc, "span", { class: "json-br", "data-indent": indent })]
|
|
483
|
+
];
|
|
484
|
+
}), '"');
|
|
485
|
+
}
|
|
486
|
+
function jsonView(doc, value) {
|
|
487
|
+
return h(doc, "pre", { class: "code-text scroll" }, h(doc, "code", {}, json(doc, value, "", void 0)));
|
|
488
|
+
}
|
|
489
|
+
function codeBlock(doc, sources, tab, onTab = () => {
|
|
490
|
+
}) {
|
|
491
|
+
const tabs = Object.keys(sources);
|
|
492
|
+
let shown = sources[tab]?.code ? tab : tabs.find((t) => sources[t].code) ?? tab;
|
|
493
|
+
const block = h(doc, "div", { class: "code" });
|
|
494
|
+
const draw = () => {
|
|
495
|
+
const { label, code, lang, json: value, empty } = sources[shown];
|
|
496
|
+
const body = !code ? h(doc, "p", { class: "code-empty" }, empty) : value !== void 0 ? jsonView(doc, value) : highlighted(doc, code, lang);
|
|
497
|
+
const copy = code && copyIcon(doc, `Copy the ${label}`, () => code);
|
|
498
|
+
replace(
|
|
499
|
+
doc,
|
|
500
|
+
block,
|
|
501
|
+
tabs.length > 1 ? h(
|
|
502
|
+
doc,
|
|
503
|
+
"div",
|
|
504
|
+
{ class: "code-head", role: "tablist" },
|
|
505
|
+
tabs.map((t) => {
|
|
506
|
+
const button = h(doc, "button", {
|
|
507
|
+
type: "button",
|
|
508
|
+
role: "tab",
|
|
509
|
+
class: "code-tab",
|
|
510
|
+
"aria-selected": String(t === shown),
|
|
511
|
+
disabled: !sources[t].code,
|
|
512
|
+
onclick: () => {
|
|
513
|
+
shown = t;
|
|
514
|
+
onTab(t);
|
|
515
|
+
draw();
|
|
516
|
+
}
|
|
517
|
+
}, sources[t].label);
|
|
518
|
+
return sources[t].code ? button : h(doc, "span", { class: "code-tab-wrap", "data-tip": sources[t].empty }, button);
|
|
519
|
+
}),
|
|
520
|
+
h(doc, "span", { class: "spacer" }),
|
|
521
|
+
copy
|
|
522
|
+
) : copy && h(doc, "div", { class: "code-corner" }, copy),
|
|
523
|
+
body
|
|
524
|
+
);
|
|
525
|
+
};
|
|
526
|
+
draw();
|
|
527
|
+
return block;
|
|
528
|
+
}
|
|
529
|
+
function table(doc, columns, rows, attributes = {}) {
|
|
530
|
+
return h(
|
|
531
|
+
doc,
|
|
532
|
+
"div",
|
|
533
|
+
{ class: "table-wrap", ...attributes },
|
|
534
|
+
h(
|
|
535
|
+
doc,
|
|
536
|
+
"table",
|
|
537
|
+
{},
|
|
538
|
+
h(doc, "thead", {}, h(doc, "tr", {}, columns.map((column) => h(doc, "th", {}, column)))),
|
|
539
|
+
h(doc, "tbody", {}, rows.map((row) => h(doc, "tr", {}, row.map((cell) => h(doc, "td", {}, cellText(cell))))))
|
|
540
|
+
)
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
function cellText(value) {
|
|
544
|
+
if (value === null || value === void 0) return "";
|
|
545
|
+
if (value instanceof Date) return value.toISOString();
|
|
546
|
+
return typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
547
|
+
}
|
|
548
|
+
function fields(doc, pairs, attributes = {}) {
|
|
549
|
+
return h(doc, "dl", attributes, pairs.map((pair) => pair && [h(doc, "dt", {}, pair[0]), h(doc, "dd", {}, pair[1])]));
|
|
550
|
+
}
|
|
551
|
+
var note = (doc, text, attributes = {}) => h(doc, "p", { class: "note", ...attributes }, text);
|
|
552
|
+
var FLASH_MS = 1200;
|
|
553
|
+
var flashes = /* @__PURE__ */ new WeakMap();
|
|
554
|
+
function flash(element) {
|
|
555
|
+
element.scrollIntoView?.({ block: "nearest", behavior: "smooth" });
|
|
556
|
+
element.classList.remove("flash");
|
|
557
|
+
element.style.animationDelay = "";
|
|
558
|
+
void element.offsetWidth;
|
|
559
|
+
element.classList.add("flash");
|
|
560
|
+
const key = element.dataset.key;
|
|
561
|
+
const body = element.closest(".body");
|
|
562
|
+
if (key === void 0 || !body) return;
|
|
563
|
+
if (!flashes.has(body)) flashes.set(body, /* @__PURE__ */ new Map());
|
|
564
|
+
flashes.get(body).set(key, Date.now());
|
|
565
|
+
}
|
|
566
|
+
function keepFlashes(body) {
|
|
567
|
+
const now = Date.now();
|
|
568
|
+
const keys = flashes.get(body);
|
|
569
|
+
for (const [key, at2] of keys ?? []) {
|
|
570
|
+
if (now - at2 >= FLASH_MS) {
|
|
571
|
+
keys.delete(key);
|
|
572
|
+
continue;
|
|
573
|
+
}
|
|
574
|
+
const element = [...body.querySelectorAll("[data-key]")].find((candidate) => candidate.dataset.key === key);
|
|
575
|
+
if (!element) continue;
|
|
576
|
+
element.style.animationDelay = `-${now - at2}ms`;
|
|
577
|
+
element.classList.add("flash");
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
var STYLES = `
|
|
581
|
+
:host { display: block; height: 100%; color: var(--anfra-color-fg); background: var(--anfra-color-bg); font: 13px/1.45 var(--anfra-font); }
|
|
582
|
+
* { box-sizing: border-box; }
|
|
583
|
+
[hidden] { display: none !important; }
|
|
584
|
+
button { font: inherit; color: inherit; cursor: pointer; }
|
|
585
|
+
button:disabled { cursor: default; }
|
|
586
|
+
:focus-visible { outline: 2px solid var(--anfra-color-accent); outline-offset: 1px; }
|
|
587
|
+
.pane { height: 100%; display: flex; flex-direction: column; min-height: 0;
|
|
588
|
+
--hover: color-mix(in srgb, var(--anfra-color-fg) 7%, transparent);
|
|
589
|
+
--subtle: color-mix(in srgb, var(--anfra-color-fg) 4%, transparent);
|
|
590
|
+
--accent-bg: color-mix(in srgb, var(--anfra-color-accent) 14%, transparent);
|
|
591
|
+
--danger-bg: color-mix(in srgb, var(--anfra-color-danger) 14%, transparent);
|
|
592
|
+
--ok: light-dark(#059669, #34d399); --warn: light-dark(#d97706, #fbbf24); --run: light-dark(#0284c7, #38bdf8);
|
|
593
|
+
--warn-bg: color-mix(in srgb, var(--warn) 16%, transparent); --ok-bg: color-mix(in srgb, var(--ok) 16%, transparent); }
|
|
594
|
+
.body { flex: 1; min-height: 0; overflow: auto; padding: 4px 14px 16px; }
|
|
595
|
+
.body.split { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
|
|
596
|
+
.body.split > .scroll { flex: 1; min-height: 0; overflow: auto; padding: 4px 14px 16px; }
|
|
597
|
+
.note { color: var(--anfra-color-muted); margin: 12px 0; }
|
|
598
|
+
.muted { color: var(--anfra-color-muted); }
|
|
599
|
+
code, pre { font-family: var(--anfra-font-mono); }
|
|
600
|
+
h4 { margin: 16px 0 0; font-size: 13px; }
|
|
601
|
+
h5 { margin: 16px 0 6px; font-size: 13px; font-weight: 500; color: var(--anfra-color-fg); display: flex; align-items: center; gap: 6px; }
|
|
602
|
+
dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 0; }
|
|
603
|
+
dt { color: var(--anfra-color-muted); }
|
|
604
|
+
dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
|
|
605
|
+
.icon { flex: none; }
|
|
606
|
+
.card { margin-bottom: 8px; padding: 10px 12px; border-radius: 8px; background: var(--subtle); }
|
|
607
|
+
.card header { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
|
|
608
|
+
.flash { animation: flash 1.2s ease-out; }
|
|
609
|
+
@keyframes flash { from { box-shadow: inset 0 0 0 2px var(--anfra-color-accent); background: var(--accent-bg); } }
|
|
610
|
+
.pill { flex: none; padding: 1px 8px; border-radius: 999px; background: var(--hover); color: var(--anfra-color-muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
|
|
611
|
+
.pill.warn { background: var(--warn-bg); color: var(--warn); }
|
|
612
|
+
.pill.success, .pill.ok { background: var(--ok-bg); color: var(--ok); }
|
|
613
|
+
.pill.error { background: var(--danger-bg); color: var(--anfra-color-danger); }
|
|
614
|
+
.pill.accent { background: var(--accent-bg); color: var(--anfra-color-accent); }
|
|
615
|
+
.tone-ok { color: var(--ok); } .tone-warn { color: var(--warn); } .tone-error { color: var(--anfra-color-danger); }
|
|
616
|
+
code.wrap { overflow-wrap: anywhere; }
|
|
617
|
+
.error-text { margin: 6px 0 0; color: var(--anfra-color-danger); overflow-wrap: anywhere; }
|
|
618
|
+
.link { border: 0; border-radius: 4px; background: none; padding: 2px 6px; color: var(--anfra-color-accent); font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
|
|
619
|
+
.link:hover:not(:disabled) { background: var(--hover); }
|
|
620
|
+
.link:disabled { color: var(--anfra-color-muted); }
|
|
621
|
+
.toolbar { flex: none; display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--anfra-color-border); }
|
|
622
|
+
.tool { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--anfra-color-border); border-radius: 6px; background: none; padding: 3px 10px; font-size: 12px; }
|
|
623
|
+
.tool:hover:not(:disabled) { background: var(--hover); }
|
|
624
|
+
.tool[aria-pressed="true"] { border-color: var(--anfra-color-accent); color: var(--anfra-color-accent); background: var(--accent-bg); }
|
|
625
|
+
.search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1px solid var(--anfra-color-border); border-radius: 6px; color: var(--anfra-color-muted); }
|
|
626
|
+
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--anfra-color-fg); font: inherit; font-size: 12px; }
|
|
627
|
+
.segments { flex: none; display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--hover); }
|
|
628
|
+
.segments button { border: 0; border-radius: 6px; background: none; padding: 2px 8px; font-size: 12px; font-weight: 500; color: var(--anfra-color-muted); white-space: nowrap; }
|
|
629
|
+
.segments button:hover { color: var(--anfra-color-fg); }
|
|
630
|
+
/* The selected one is raised, in ink: violet is for links, selection and focus. */
|
|
631
|
+
.segments button[aria-pressed="true"] { background: var(--anfra-color-bg); color: var(--anfra-color-fg); box-shadow: 0 0 0 1px var(--anfra-color-border), 0 1px 2px rgb(0 0 0 / 0.08); }
|
|
632
|
+
.row-action { flex: none; display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--anfra-color-muted); }
|
|
633
|
+
.row-action:hover:not(:disabled) { background: var(--hover); color: var(--anfra-color-accent); }
|
|
634
|
+
.row-action:disabled { opacity: 0.4; cursor: default; }
|
|
635
|
+
.row-action-wrap { flex: none; display: inline-flex; }
|
|
636
|
+
.spacer { flex: 1; }
|
|
637
|
+
/* Collapsibles */
|
|
638
|
+
.collapsible > summary { list-style: none; display: flex; align-items: center; gap: 6px; padding: 4px 0; cursor: pointer; user-select: none; }
|
|
639
|
+
.collapsible > summary::-webkit-details-marker { display: none; }
|
|
640
|
+
.collapsible > summary > .icon { transition: transform 0.15s; color: var(--anfra-color-muted); }
|
|
641
|
+
.collapsible[open] > summary > .icon { transform: rotate(90deg); }
|
|
642
|
+
.collapsible-body { padding: 2px 0 8px 20px; min-width: 0; }
|
|
643
|
+
.section > summary { font-size: 13px; font-weight: 500; margin-top: 12px; }
|
|
644
|
+
.section > .collapsible-body { padding-left: 0; }
|
|
645
|
+
/* Rows that open, as tiles: the chevron at the end, the body inside the tile. A tile in a tile is on the panel's ground. */
|
|
646
|
+
.row { border-radius: 8px; background: var(--subtle); }
|
|
647
|
+
.row + .row { margin-top: 6px; }
|
|
648
|
+
.row > summary { min-height: 40px; padding: 6px 8px 6px 12px; border-radius: 8px; min-width: 0; }
|
|
649
|
+
.row > summary:hover { background: var(--hover); }
|
|
650
|
+
.row > summary > .icon { order: 99; margin-left: 4px; color: var(--anfra-color-muted); }
|
|
651
|
+
.row > summary .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
|
|
652
|
+
.row > .collapsible-body { padding: 2px 12px 12px; }
|
|
653
|
+
.row .row { background: var(--anfra-color-bg); box-shadow: inset 0 0 0 1px var(--anfra-color-border); }
|
|
654
|
+
.row.flash > summary, .card.flash, .row.flash { animation: flash 1.2s ease-out; }
|
|
655
|
+
.sub > summary { font-size: 13px; font-weight: 500; }
|
|
656
|
+
.sub > .collapsible-body { padding-left: 20px; }
|
|
657
|
+
.indicator { flex: none; display: inline-flex; align-items: center; justify-content: flex-end; gap: 3px; color: var(--anfra-color-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
|
|
658
|
+
.indicator.filters { width: 32px; }
|
|
659
|
+
.indicator.trust { width: 20px; height: 12px; align-items: flex-end; }
|
|
660
|
+
.bars { display: inline-flex; align-items: flex-end; gap: 2px; }
|
|
661
|
+
.bars.sm { gap: 1px; } .bars.lg { gap: 4px; }
|
|
662
|
+
.bar { display: inline-block; border-radius: 2px; background: color-mix(in srgb, var(--anfra-color-muted) 30%, transparent); }
|
|
663
|
+
.bar.fill-ok { background: var(--ok); } .bar.fill-warn { background: var(--warn); } .bar.fill-error { background: var(--anfra-color-danger); }
|
|
664
|
+
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--anfra-color-muted) 45%, transparent); }
|
|
665
|
+
.dot.success { background: var(--ok); } .dot.error { background: var(--anfra-color-danger); } .dot.ok { background: var(--ok); } .dot.aborted { background: var(--warn); }
|
|
666
|
+
.dot.executing, .dot.pending { background: var(--run); animation: pulse 1.2s ease-in-out infinite; }
|
|
667
|
+
@keyframes pulse { 50% { opacity: 0.35; } }
|
|
668
|
+
/* Popovers */
|
|
669
|
+
.pop-trigger { border: 0; background: none; padding: 0; display: inline-flex; align-items: center; gap: 4px; color: inherit; }
|
|
670
|
+
/* Plain tooltips are one line of text or a few, with their line breaks; rich ones lay out their own. */
|
|
671
|
+
.tooltip { position: fixed; inset: auto; margin: 0; z-index: 10; width: max-content; max-width: 280px; padding: 5px 8px; border: 1px solid var(--anfra-color-border); border-radius: 6px; background: var(--anfra-color-bg); color: var(--anfra-color-fg); box-shadow: 0 6px 20px rgb(0 0 0 / 0.15); font: 12px/1.45 var(--anfra-font); white-space: pre-line; overflow-wrap: anywhere; pointer-events: none; }
|
|
672
|
+
.tooltip.rich { max-width: 340px; padding: 8px 10px; white-space: normal; }
|
|
673
|
+
/* Code */
|
|
674
|
+
.code { margin-top: 6px; border: 1px solid var(--anfra-color-border); border-radius: 6px; overflow: hidden; position: relative; }
|
|
675
|
+
.code-head { display: flex; align-items: center; gap: 2px; padding: 0 4px; border-bottom: 1px solid var(--anfra-color-border); background: var(--subtle); }
|
|
676
|
+
.code-tab { border: 0; border-bottom: 2px solid transparent; background: none; padding: 5px 6px; font-size: 12px; color: var(--anfra-color-muted); }
|
|
677
|
+
.code-tab[aria-selected="true"] { color: var(--anfra-color-fg); border-bottom-color: var(--anfra-color-accent); }
|
|
678
|
+
.code-tab:disabled { opacity: 0.5; }
|
|
679
|
+
.code-tab-wrap { display: inline-flex; }
|
|
680
|
+
.code-corner { position: absolute; top: 2px; right: 2px; }
|
|
681
|
+
.code-text { margin: 0; max-height: 240px; overflow: auto; padding: 8px 10px; font-size: 12px; line-height: 1.5; background: var(--subtle); }
|
|
682
|
+
.code-empty { margin: 0; padding: 8px 10px; font-size: 12px; color: var(--anfra-color-muted); background: var(--subtle); }
|
|
683
|
+
.tok-kw { color: light-dark(#6d28d9, #c4b5fd); font-weight: 600; } .tok-str { color: light-dark(#047857, #6ee7b7); }
|
|
684
|
+
.tok-key { color: light-dark(#0f766e, #5eead4); }
|
|
685
|
+
/* An AQL string, shown across its lines: the text stays the JSON, escapes and all, so a copy of
|
|
686
|
+
it is too; the line breaks and the indent under its key are generated, which a copy leaves out. */
|
|
687
|
+
.json-nl { opacity: 0.45; }
|
|
688
|
+
.json-br::after { content: "\\A" attr(data-indent); white-space: pre; }
|
|
689
|
+
/* The indent every line of the AQL shares: kept in the text, so the copy is exact, but not shown. */
|
|
690
|
+
.json-dedent { font-size: 0; }
|
|
691
|
+
.tok-num { color: light-dark(#b45309, #fcd34d); } .tok-com { color: var(--anfra-color-muted); font-style: italic; } .tok-fn { color: light-dark(#1d4ed8, #93c5fd); }
|
|
692
|
+
/* Tables */
|
|
693
|
+
.table-wrap { overflow: auto; max-height: 320px; border: 1px solid var(--anfra-color-border); border-radius: 6px; }
|
|
694
|
+
table { border-collapse: collapse; font-size: 12px; width: max-content; min-width: 100%; }
|
|
695
|
+
th, td { padding: 3px 8px; text-align: left; border-bottom: 1px solid var(--anfra-color-border); white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
|
|
696
|
+
th { position: sticky; top: 0; background: var(--anfra-color-bg); font-weight: 500; z-index: 1; }
|
|
697
|
+
tbody tr:last-child td { border-bottom: 0; }
|
|
698
|
+
/* Structure */
|
|
699
|
+
.tree { list-style: none; margin: 0; padding: 0; }
|
|
700
|
+
.node { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; }
|
|
701
|
+
.node:hover { background: var(--hover); }
|
|
702
|
+
.twist .icon { transition: transform 0.15s; } .twist.open .icon { transform: rotate(90deg); }
|
|
703
|
+
.node .twist { width: 16px; height: 16px; } .twist-space { flex: none; width: 16px; }
|
|
704
|
+
.node.selected { background: var(--accent-bg); }
|
|
705
|
+
.name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
|
|
706
|
+
.node .label, .node .app { color: var(--anfra-color-muted); overflow: hidden; text-overflow: ellipsis; }
|
|
707
|
+
.node.problem .name { color: var(--anfra-color-danger); }
|
|
708
|
+
.kind { flex: none; padding: 0 6px; border-radius: 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
|
|
709
|
+
.kind.container { background: color-mix(in srgb, light-dark(#7c3aed, #a78bfa) 18%, transparent); color: light-dark(#7c3aed, #a78bfa); }
|
|
710
|
+
.kind.block { background: color-mix(in srgb, light-dark(#2563eb, #93c5fd) 18%, transparent); color: light-dark(#2563eb, #93c5fd); }
|
|
711
|
+
.kind.query { background: var(--ok-bg); color: var(--ok); }
|
|
712
|
+
.kind.control { background: var(--warn-bg); color: var(--warn); }
|
|
713
|
+
/* The actions keep their place and sit in the row's height, so showing them moves nothing. */
|
|
714
|
+
.actions { flex: none; display: flex; gap: 2px; margin: -4px 0 -4px auto; visibility: hidden; }
|
|
715
|
+
.node:hover .actions, .node.selected .actions, .node:focus-within .actions { visibility: visible; }
|
|
716
|
+
.detail { flex: none; max-height: 45%; overflow: auto; padding: 8px 14px 16px; border-top: 1px solid var(--anfra-color-border); }
|
|
717
|
+
.detail h5 { margin-top: 4px; }
|
|
718
|
+
.detail .card { margin-top: 16px; }
|
|
719
|
+
.detail-actions { display: flex; gap: 6px; margin-top: 8px; }
|
|
720
|
+
.status { margin: 8px 0 0; color: var(--anfra-color-muted); }
|
|
721
|
+
`;
|
|
722
|
+
|
|
723
|
+
export {
|
|
724
|
+
TRUST_LEVELS,
|
|
725
|
+
LEVELS,
|
|
726
|
+
queryTrust,
|
|
727
|
+
appTrust,
|
|
728
|
+
h,
|
|
729
|
+
replace,
|
|
730
|
+
icon,
|
|
731
|
+
columnIcon,
|
|
732
|
+
drawTab,
|
|
733
|
+
copyIcon,
|
|
734
|
+
link,
|
|
735
|
+
lineageButton,
|
|
736
|
+
collapsible,
|
|
737
|
+
popover,
|
|
738
|
+
tooltips,
|
|
739
|
+
trustBars,
|
|
740
|
+
trustIndicator,
|
|
741
|
+
stateDot,
|
|
742
|
+
filterIndicator,
|
|
743
|
+
jsonView,
|
|
744
|
+
codeBlock,
|
|
745
|
+
table,
|
|
746
|
+
fields,
|
|
747
|
+
note,
|
|
748
|
+
flash,
|
|
749
|
+
STYLES
|
|
750
|
+
};
|