@holistics/anfra-sdk 0.15.1 → 0.17.0

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.
Files changed (38) hide show
  1. package/README.md +2 -1
  2. package/dist/ambient.d.ts +2 -1
  3. package/dist/api.d.ts +11 -5
  4. package/dist/api.js +40 -30
  5. package/dist/app.d.ts +5 -5
  6. package/dist/app.js +22 -12
  7. package/dist/{bootstrap-hLhpijIb.d.ts → bootstrap-q1J7GUxa.d.ts} +55 -18
  8. package/dist/build.d.ts +2 -2
  9. package/dist/chunk-32566ZNE.js +1278 -0
  10. package/dist/{chunk-S6XLP6U4.js → chunk-3ZWUCECU.js} +45 -20
  11. package/dist/{chunk-YB7VYY72.js → chunk-6GBHCW5E.js} +102 -30
  12. package/dist/{chunk-KFD6CHLI.js → chunk-ACKFOANJ.js} +2 -0
  13. package/dist/{chunk-CYZQ7ZTJ.js → chunk-C26OVN2S.js} +6 -1
  14. package/dist/{chunk-PYAVAIAX.js → chunk-EL7CAVZ3.js} +1 -1
  15. package/dist/{chunk-GIHCQT6L.js → chunk-J5BTCP6T.js} +1 -1
  16. package/dist/chunk-SWNVCTT6.js +161 -0
  17. package/dist/common.d.ts +3 -3
  18. package/dist/common.js +19 -9
  19. package/dist/{data-BGX3V42T.js → data-TDUQTG3P.js} +8 -6
  20. package/dist/{declaration-ZL5B676C.js → declaration-RJFU4ZLJ.js} +2 -2
  21. package/dist/errors-IhdhKO-6.d.ts +119 -0
  22. package/dist/host.d.ts +2 -2
  23. package/dist/host.js +17 -17
  24. package/dist/{menu-BFLb7dVq.d.ts → menu-CRAFaQ8s.d.ts} +21 -5
  25. package/dist/{overview-L4KLGZNP.js → overview-RV2IV6PJ.js} +23 -23
  26. package/dist/{plugin-B7SpJLBm.d.ts → plugin-BdLabbah.d.ts} +2 -2
  27. package/dist/plugins.d.ts +11 -2
  28. package/dist/plugins.js +38 -21
  29. package/dist/{queries-QFN4DI25.js → queries-5TTPOB7R.js} +32 -30
  30. package/dist/{structure-Z2QK5MGH.js → structure-MTLCRTJ4.js} +11 -9
  31. package/dist/{tab-LSITVMKV.js → tab-XL2HS5W4.js} +20 -18
  32. package/dist/testing.d.ts +1 -1
  33. package/dist/testing.js +4 -4
  34. package/dist/{types-CKytl8ds.d.ts → types-C_i7V0DA.d.ts} +46 -14
  35. package/package.json +2 -1
  36. package/dist/chunk-F6B3EGFV.js +0 -750
  37. package/dist/chunk-KCTLO3CO.js +0 -41
  38. package/dist/errors-CKvqVaqU.d.ts +0 -30
@@ -0,0 +1,1278 @@
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
+ // ../design/icons.js
104
+ var ICONS = {
105
+ "folder": "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",
106
+ "folder-open": "M6 14l1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
107
+ "app": "M4 3h5a1 1 0 0 1 1 1v7a1 1 0 0 1 -1 1h-5a1 1 0 0 1 -1 -1v-7a1 1 0 0 1 1 -1ZM15 3h5a1 1 0 0 1 1 1v3a1 1 0 0 1 -1 1h-5a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1ZM15 12h5a1 1 0 0 1 1 1v7a1 1 0 0 1 -1 1h-5a1 1 0 0 1 -1 -1v-7a1 1 0 0 1 1 -1ZM4 16h5a1 1 0 0 1 1 1v3a1 1 0 0 1 -1 1h-5a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1Z",
108
+ "database": "M3 5a9 3 0 1 0 18 0a9 3 0 1 0 -18 0M3 5V19A9 3 0 0 0 21 19V5M3 12A9 3 0 0 0 21 12",
109
+ "dataset": "M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83zM2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",
110
+ "model": "M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16ZM3.3 7l8.7 5 8.7-5M12 22V12",
111
+ "metric": "M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",
112
+ "dimension": "M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0ZM14.5 12.5l2-2M11.5 9.5l2-2M8.5 6.5l2-2M17.5 15.5l2-2",
113
+ "block": "M4 3h5a1 1 0 0 1 1 1v5a1 1 0 0 1 -1 1h-5a1 1 0 0 1 -1 -1v-5a1 1 0 0 1 1 -1ZM15 3h5a1 1 0 0 1 1 1v5a1 1 0 0 1 -1 1h-5a1 1 0 0 1 -1 -1v-5a1 1 0 0 1 1 -1ZM15 14h5a1 1 0 0 1 1 1v5a1 1 0 0 1 -1 1h-5a1 1 0 0 1 -1 -1v-5a1 1 0 0 1 1 -1ZM4 14h5a1 1 0 0 1 1 1v5a1 1 0 0 1 -1 1h-5a1 1 0 0 1 -1 -1v-5a1 1 0 0 1 1 -1Z",
114
+ "control": "M10 5H3M12 19H3M14 3v4M16 17v4M21 12h-9M21 19h-5M21 5h-7M8 10v4M8 12H3",
115
+ "query": "M3 5a9 3 0 1 0 18 0a9 3 0 1 0 -18 0M3 5V19A9 3 0 0 0 21 19V5M3 12A9 3 0 0 0 21 12",
116
+ "search": "M21 21l-4.34-4.34M3 11a8 8 0 1 0 16 0a8 8 0 1 0 -16 0",
117
+ "reload": "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8M21 3v5h-5M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16M8 16H3v5",
118
+ "update": "M5 12l7-7 7 7M12 19V5",
119
+ "copy": "M10 8h10a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2ZM4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",
120
+ "check": "M20 6 9 17l-5-5",
121
+ "download": "M12 15V3M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5",
122
+ "close": "M18 6 6 18M6 6l12 12",
123
+ "plus": "M5 12h14M12 5v14",
124
+ "minus": "M5 12h14",
125
+ "filter": "M2 5h20M6 12h12M9 19h6",
126
+ "pick": "M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0M22 12L18 12M6 12L2 12M12 6L12 2M12 22L12 18",
127
+ "locate": "M2 12L5 12M19 12L22 12M12 2L12 5M12 19L12 22M5 12a7 7 0 1 0 14 0a7 7 0 1 0 -14 0M9 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",
128
+ "inspect": "M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2ZM15 3v18",
129
+ "focus": "M9 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0M3 7V5a2 2 0 0 1 2-2h2M17 3h2a2 2 0 0 1 2 2v2M21 17v2a2 2 0 0 1-2 2h-2M7 21H5a2 2 0 0 1-2-2v-2",
130
+ "expand": "M15 3h6v6M21 3l-7 7M3 21l7-7M9 21H3v-6",
131
+ "fit": "M3 7V5a2 2 0 0 1 2-2h2M17 3h2a2 2 0 0 1 2 2v2M21 17v2a2 2 0 0 1-2 2h-2M7 21H5a2 2 0 0 1-2-2v-2",
132
+ "eye": "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0M9 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",
133
+ "hidden": "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49M14.084 14.158a3 3 0 0 1-4.242-4.242M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143M2 2l20 20",
134
+ "chevron": "M9 18l6-6-6-6",
135
+ "sidebar": "M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2ZM9 3v18",
136
+ "more": "M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M18 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M4 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",
137
+ "overflow": "M6 17l5-5-5-5M13 17l5-5-5-5",
138
+ "command": "M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",
139
+ "sun": "M8 12a4 4 0 1 0 8 0a4 4 0 1 0 -8 0M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41",
140
+ "moon": "M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",
141
+ "alert": "M21.73 18l-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3M12 9v4M12 17h.01",
142
+ "info": "M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0M12 16v-4M12 8h.01",
143
+ "help": "M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3M12 17h.01",
144
+ "overview": "M4 3h5a1 1 0 0 1 1 1v7a1 1 0 0 1 -1 1h-5a1 1 0 0 1 -1 -1v-7a1 1 0 0 1 1 -1ZM15 3h5a1 1 0 0 1 1 1v3a1 1 0 0 1 -1 1h-5a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1ZM15 12h5a1 1 0 0 1 1 1v7a1 1 0 0 1 -1 1h-5a1 1 0 0 1 -1 -1v-7a1 1 0 0 1 1 -1ZM4 16h5a1 1 0 0 1 1 1v3a1 1 0 0 1 -1 1h-5a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1Z",
145
+ "table": "M12 3v18M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2ZM3 9h18M3 15h18",
146
+ "sheet": "M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2ZM3 9L21 9M3 15L21 15M9 9L9 21M15 9L15 21",
147
+ "lineage": "M9 18a3 3 0 1 0 6 0a3 3 0 1 0 -6 0M3 6a3 3 0 1 0 6 0a3 3 0 1 0 -6 0M15 6a3 3 0 1 0 6 0a3 3 0 1 0 -6 0M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9M12 12v3",
148
+ "tree": "M8 5h13M13 12h8M13 19h8M3 10a2 2 0 0 0 2 2h3M3 5v12a2 2 0 0 0 2 2h3",
149
+ "code": "M16 18l6-6-6-6M8 6l-6 6 6 6",
150
+ "type-text": "M12 4v16M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2M9 20h6",
151
+ "type-number": "M4 9L20 9M4 15L20 15M10 3L8 21M16 3L14 21",
152
+ "type-date": "M8 2v3M16 2v3M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2ZM3 9h18",
153
+ "type-datetime": "M16 14v2.2l1.6 1M16 2v3M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338M3 9h5.859M8 2v3M10 16a6 6 0 1 0 12 0a6 6 0 1 0 -12 0",
154
+ "type-truefalse": "M6 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0M9 5h6a7 7 0 0 1 7 7v0a7 7 0 0 1 -7 7h-6a7 7 0 0 1 -7 -7v0a7 7 0 0 1 7 -7Z",
155
+ "type-bit": "M16 14h0a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h0a2 2 0 0 1 -2 -2v-2a2 2 0 0 1 2 -2ZM8 4h0a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h0a2 2 0 0 1 -2 -2v-2a2 2 0 0 1 2 -2ZM6 20h4M14 10h4M6 14h2v6M14 4h2v6",
156
+ "type-json": "M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",
157
+ "type-unknown": "M10.1 2.182a10 10 0 0 1 3.8 0M13.9 21.818a10 10 0 0 1-3.8 0M17.609 3.721a10 10 0 0 1 2.69 2.7M2.182 13.9a10 10 0 0 1 0-3.8M20.279 17.609a10 10 0 0 1-2.7 2.69M21.818 10.1a10 10 0 0 1 0 3.8M3.721 6.391a10 10 0 0 1 2.7-2.69M6.391 20.279a10 10 0 0 1-2.69-2.7"
158
+ };
159
+
160
+ // anfra-sdk-raw:/home/runner/work/anfra/anfra/web/design/components.css?raw
161
+ var components_default = `/*
162
+ * The class layer: anfra's components as plain CSS, for framework-free UI that has no Vue or React
163
+ * to draw shadcn with: the SDK's plugin panel, DOM in shadow roots. A Vue app (appserve, anfra
164
+ * Cloud) uses the shadcn-vue components instead. Each class draws what anfra Cloud's shadcn
165
+ * component of the same name draws, variant for variant, on the Tier 2 tokens alone, so a token
166
+ * change reaches both. Variants and sizes are data attributes:
167
+ *
168
+ * <button class="a-button" data-variant="outline" data-size="sm">Save</button>
169
+ *
170
+ * A page that uses it wears tokens.css and type.css too (index.css has all three). A shadow root
171
+ * gets the tokens from its page, or from a host that sets them on it (the SDK does, from its theme).
172
+ * Hover applies only where there is one, as Tailwind's hover: does.
173
+ */
174
+
175
+ /* Button: shadcn's Button. Variants default (filled), outline, secondary, ghost, destructive, link;
176
+ sizes xs, sm, default, lg, and icon-xs, icon-sm, icon, icon-lg (square). */
177
+ .a-button {
178
+ box-sizing: border-box;
179
+ display: inline-flex;
180
+ flex-shrink: 0;
181
+ align-items: center;
182
+ justify-content: center;
183
+ gap: 6px;
184
+ height: 32px;
185
+ padding: 0 10px;
186
+ border: 1px solid transparent;
187
+ border-radius: var(--anfra-radius-lg);
188
+ background-clip: padding-box;
189
+ background-color: var(--anfra-color-background-highlight-default);
190
+ color: var(--anfra-color-text-on-fill);
191
+ font: var(--anfra-type-label);
192
+ white-space: nowrap;
193
+ text-decoration: none;
194
+ cursor: pointer;
195
+ user-select: none;
196
+ outline: none;
197
+ transition: background-color 160ms var(--anfra-ease-out), border-color 160ms var(--anfra-ease-out),
198
+ color 160ms var(--anfra-ease-out), scale 160ms var(--anfra-ease-out);
199
+ }
200
+ .a-button svg { flex-shrink: 0; width: 16px; height: 16px; pointer-events: none; }
201
+ .a-button:active:not([aria-haspopup]) { scale: 0.97; transition-duration: 90ms; }
202
+ .a-button:is(:disabled, [aria-disabled="true"]) {
203
+ pointer-events: none;
204
+ border-color: var(--anfra-color-border-disabled);
205
+ background-color: var(--anfra-color-background-disabled);
206
+ color: var(--anfra-color-text-disabled);
207
+ }
208
+ .a-button[aria-invalid="true"] { border-color: var(--anfra-color-border-danger-strong); }
209
+ .a-button:active { background-color: var(--anfra-color-background-highlight-active); }
210
+ @media (hover: hover) {
211
+ .a-button:hover { background-color: var(--anfra-color-background-highlight-hover); }
212
+ }
213
+
214
+ .a-button[data-variant="outline"] {
215
+ border-color: var(--anfra-color-border-strong);
216
+ background-color: var(--anfra-color-background-default);
217
+ color: var(--anfra-color-text-default);
218
+ }
219
+ @media (hover: hover) {
220
+ .a-button[data-variant="outline"]:hover { border-color: var(--anfra-color-border-hover); background-color: var(--anfra-color-background-default); }
221
+ }
222
+ .a-button[data-variant="outline"]:is(:active, [aria-expanded="true"], [aria-pressed="true"]) { background-color: var(--anfra-color-background-active); }
223
+
224
+ .a-button[data-variant="secondary"] {
225
+ background-color: var(--anfra-color-background-fill-default);
226
+ color: var(--anfra-color-text-default);
227
+ }
228
+ @media (hover: hover) {
229
+ .a-button[data-variant="secondary"]:hover { background-color: var(--anfra-color-background-fill-hover); }
230
+ }
231
+ .a-button[data-variant="secondary"]:is(:active, [aria-expanded="true"]) { background-color: var(--anfra-color-background-active); }
232
+
233
+ .a-button[data-variant="ghost"] { background-color: transparent; color: var(--anfra-color-text-weak); }
234
+ @media (hover: hover) {
235
+ .a-button[data-variant="ghost"]:hover { background-color: var(--anfra-color-background-hover); color: var(--anfra-color-text-default); }
236
+ }
237
+ .a-button[data-variant="ghost"]:active { background-color: var(--anfra-color-background-active); }
238
+ .a-button[data-variant="ghost"]:is([aria-expanded="true"], [aria-pressed="true"]) {
239
+ background-color: var(--anfra-color-background-active);
240
+ color: var(--anfra-color-text-default);
241
+ }
242
+ .a-button[data-variant="ghost"]:is(:disabled, [aria-disabled="true"]) { border-color: transparent; background-color: transparent; }
243
+
244
+ .a-button[data-variant="destructive"] {
245
+ background-color: var(--anfra-color-background-danger-default);
246
+ color: var(--anfra-color-text-on-fill);
247
+ }
248
+ @media (hover: hover) {
249
+ .a-button[data-variant="destructive"]:hover { background-color: var(--anfra-color-background-danger-hover); }
250
+ }
251
+ .a-button[data-variant="destructive"]:active { background-color: var(--anfra-color-background-danger-hover); }
252
+
253
+ .a-button[data-variant="link"] { background-color: transparent; color: var(--anfra-color-text-link-default); text-underline-offset: 4px; }
254
+ @media (hover: hover) {
255
+ .a-button[data-variant="link"]:hover { background-color: transparent; color: var(--anfra-color-text-link-hover); text-decoration: underline; }
256
+ }
257
+ .a-button[data-variant="link"]:active { background-color: transparent; }
258
+ .a-button[data-variant="link"]:is(:disabled, [aria-disabled="true"]) { border-color: transparent; background-color: transparent; }
259
+
260
+ .a-button[data-size="xs"] { gap: 4px; height: 24px; padding: 0 8px; font: var(--anfra-type-caption); font-weight: 500; }
261
+ .a-button[data-size="xs"] svg { width: 12px; height: 12px; }
262
+ .a-button[data-size="sm"] { gap: 4px; height: 28px; padding: 0 10px; font: var(--anfra-type-caption); font-weight: 500; }
263
+ .a-button[data-size="sm"] svg { width: 14px; height: 14px; }
264
+ .a-button[data-size="lg"] { height: 36px; }
265
+ .a-button:is([data-size="icon"], [data-size="icon-xs"], [data-size="icon-sm"], [data-size="icon-lg"]) { padding: 0; }
266
+ .a-button[data-size="icon"] { width: 32px; }
267
+ .a-button[data-size="icon-xs"] { width: 24px; height: 24px; }
268
+ .a-button[data-size="icon-xs"] svg { width: 12px; height: 12px; }
269
+ .a-button[data-size="icon-sm"] { width: 28px; height: 28px; }
270
+ .a-button[data-size="icon-lg"] { width: 36px; height: 36px; }
271
+ /* Under 32px, lg would read as a pill: small controls take md. */
272
+ .a-button:is([data-size="xs"], [data-size="sm"], [data-size="icon-xs"], [data-size="icon-sm"]) { border-radius: var(--anfra-radius-md); }
273
+
274
+ /* Input: shadcn's Input, edged as an outline button is. Focus shows on its own border, violet and
275
+ doubled, never an outline. A field with an icon is a label.a-input around the icon and a bare input. */
276
+ .a-input {
277
+ box-sizing: border-box;
278
+ width: 100%;
279
+ min-width: 0;
280
+ height: 32px;
281
+ padding: 4px 10px;
282
+ border: 1px solid var(--anfra-color-border-strong); /* the outline button's edge; darker on hover */
283
+ border-radius: var(--anfra-radius-lg);
284
+ background: transparent;
285
+ color: var(--anfra-color-text-default);
286
+ font: var(--anfra-type-body);
287
+ outline: none;
288
+ transition: border-color 160ms var(--anfra-ease-out);
289
+ }
290
+ .a-input::placeholder { color: var(--anfra-color-text-placeholder); }
291
+ @media (hover: hover) {
292
+ .a-input:hover { border-color: var(--anfra-color-border-hover); }
293
+ }
294
+ .a-input:is([readonly], :has(input[readonly])) { border-color: var(--anfra-color-border-strong); background: var(--anfra-color-background-secondary-default); }
295
+ .a-input:is(:disabled, :has(input:disabled)) {
296
+ cursor: not-allowed;
297
+ border-color: var(--anfra-color-border-disabled);
298
+ background: var(--anfra-color-background-disabled);
299
+ color: var(--anfra-color-text-disabled);
300
+ }
301
+ .a-input:is(:focus-visible, :has(:focus-visible)) {
302
+ border-color: var(--anfra-color-border-highlight-strong);
303
+ box-shadow: inset 0 0 0 1px var(--anfra-color-border-highlight-strong);
304
+ }
305
+ .a-input[aria-invalid="true"],
306
+ .a-input[aria-invalid="true"]:focus-visible {
307
+ border-color: var(--anfra-color-border-danger-strong);
308
+ }
309
+ .a-input[aria-invalid="true"]:focus-visible { box-shadow: inset 0 0 0 1px var(--anfra-color-border-danger-strong); }
310
+
311
+ /* Badge: shadcn's Badge, a label in a pill. Variants default (filled), secondary, outline,
312
+ destructive, warning, success. */
313
+ .a-badge {
314
+ display: inline-flex;
315
+ flex-shrink: 0;
316
+ align-items: center;
317
+ justify-content: center;
318
+ gap: 4px;
319
+ width: fit-content;
320
+ height: 20px;
321
+ padding: 2px 8px;
322
+ overflow: hidden;
323
+ border: 1px solid transparent;
324
+ border-radius: var(--anfra-radius-pill);
325
+ background: var(--anfra-color-background-highlight-default);
326
+ color: var(--anfra-color-text-on-fill);
327
+ font: var(--anfra-type-caption);
328
+ font-weight: 500;
329
+ white-space: nowrap;
330
+ box-sizing: border-box;
331
+ }
332
+ .a-badge svg { width: 12px; height: 12px; pointer-events: none; }
333
+ /* A badge holding one icon or glyph is square, as wide as it is tall, so its padding is even. */
334
+ .a-badge[data-size="icon"] { width: 20px; padding: 0; }
335
+ .a-badge[data-variant="secondary"] {
336
+ border-color: var(--anfra-color-border-default);
337
+ background: var(--anfra-color-background-info-secondary-default);
338
+ color: var(--anfra-color-text-info-default);
339
+ }
340
+ .a-badge[data-variant="outline"] { border-color: var(--anfra-color-border-strong); background: transparent; color: var(--anfra-color-text-default); }
341
+ .a-badge[data-variant="destructive"] {
342
+ border-color: var(--anfra-color-border-danger-default);
343
+ background: var(--anfra-color-background-danger-secondary-default);
344
+ color: var(--anfra-color-text-danger-default);
345
+ }
346
+ .a-badge[data-variant="warning"] {
347
+ border-color: var(--anfra-color-border-warning-default);
348
+ background: var(--anfra-color-background-warning-secondary-default);
349
+ color: var(--anfra-color-text-warning-default);
350
+ }
351
+ .a-badge[data-variant="success"] {
352
+ border-color: var(--anfra-color-border-success-default);
353
+ background: var(--anfra-color-background-success-secondary-default);
354
+ color: var(--anfra-color-text-success-default);
355
+ }
356
+
357
+ /* Status pill: Cloud's StatusPill, a state as a dot and a label. Tones neutral (the default),
358
+ highlight, success, warning, danger; the label always says it, never the colour alone. */
359
+ .a-pill {
360
+ display: inline-flex;
361
+ flex-shrink: 0;
362
+ align-items: center;
363
+ gap: 6px;
364
+ width: fit-content;
365
+ height: 20px;
366
+ padding: 0 8px;
367
+ border-radius: var(--anfra-radius-pill);
368
+ background: var(--anfra-color-background-active);
369
+ color: var(--anfra-color-text-weak);
370
+ font: var(--anfra-type-caption);
371
+ font-weight: 500;
372
+ white-space: nowrap;
373
+ }
374
+ .a-pill::before { content: ""; flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
375
+ .a-pill[data-tone="highlight"] { background: var(--anfra-color-background-highlight-secondary-default); color: var(--anfra-color-text-highlight-default); }
376
+ .a-pill[data-tone="success"] { background: var(--anfra-color-background-success-secondary-default); color: var(--anfra-color-text-success-default); }
377
+ .a-pill[data-tone="warning"] { background: var(--anfra-color-background-warning-secondary-default); color: var(--anfra-color-text-warning-default); }
378
+ .a-pill[data-tone="danger"] { background: var(--anfra-color-background-danger-secondary-default); color: var(--anfra-color-text-danger-default); }
379
+
380
+ /* Tabs: shadcn's TabsList and TabsTrigger. A segmented list by default; data-variant="line" for an
381
+ underline. The open tab is aria-selected="true", or aria-pressed="true" in a group of toggles (a filter). */
382
+ .a-tabs {
383
+ display: inline-flex;
384
+ align-items: center;
385
+ justify-content: center;
386
+ width: fit-content;
387
+ height: 32px;
388
+ padding: 3px;
389
+ border-radius: var(--anfra-radius-lg);
390
+ background: var(--anfra-color-background-fill-default); /* a tint of its ground, so it reads on the panel and in a well */
391
+ color: var(--anfra-color-text-weak);
392
+ box-sizing: border-box;
393
+ }
394
+ /* Small: a 24px list for a toggle in a dense row, its track 2px. */
395
+ .a-tabs[data-size="sm"] {
396
+ height: 24px;
397
+ padding: 2px;
398
+ border-radius: var(--anfra-radius-md); /* under 32px, a control takes md */
399
+ }
400
+ .a-tabs[data-size="sm"] .a-tab {
401
+ padding: 0 6px;
402
+ border-radius: calc(var(--anfra-radius-md) - 2px); /* nested in the list: its radius less its padding */
403
+ font: var(--anfra-type-caption);
404
+ font-weight: 500;
405
+ }
406
+ .a-tab {
407
+ position: relative;
408
+ box-sizing: border-box;
409
+ display: inline-flex;
410
+ flex: 1;
411
+ align-items: center;
412
+ justify-content: center;
413
+ gap: 6px;
414
+ height: 100%; /* shadcn's is 1px short, which leaves the track 3.5px above and below and 3px at the sides */
415
+ padding: 2px 6px;
416
+ border: 1px solid transparent;
417
+ border-radius: calc(var(--anfra-radius-lg) - 3px); /* nested in the list: its radius less its padding */
418
+ background: transparent;
419
+ color: var(--anfra-color-text-weak);
420
+ font: var(--anfra-type-label);
421
+ white-space: nowrap;
422
+ cursor: pointer;
423
+ }
424
+ .a-tab svg { flex-shrink: 0; width: 16px; height: 16px; pointer-events: none; }
425
+ @media (hover: hover) {
426
+ .a-tab:hover { color: var(--anfra-color-text-default); }
427
+ }
428
+ .a-tab:is(:disabled, [aria-disabled="true"]) { pointer-events: none; color: var(--anfra-color-text-disabled); }
429
+ .a-tab:is([aria-selected="true"], [aria-pressed="true"]) {
430
+ background: var(--anfra-color-background-fill-selected);
431
+ color: var(--anfra-color-text-default);
432
+ box-shadow: var(--anfra-e1);
433
+ }
434
+ .a-tabs[data-variant="line"] { border-radius: 0; background: transparent; }
435
+ .a-tabs[data-variant="line"] .a-tab:is([aria-selected="true"], [aria-pressed="true"]) { background: transparent; box-shadow: none; }
436
+ .a-tabs[data-variant="line"] .a-tab::after {
437
+ content: "";
438
+ position: absolute;
439
+ inset: auto 0 -5px;
440
+ height: 2px;
441
+ background: var(--anfra-color-background-inverted-default);
442
+ opacity: 0;
443
+ }
444
+ .a-tabs[data-variant="line"] .a-tab:is([aria-selected="true"], [aria-pressed="true"])::after { opacity: 1; }
445
+
446
+ /* Menu: shadcn's DropdownMenuContent and its parts. An item is highlighted on hover, on focus, or
447
+ with data-highlighted (a menu that moves a highlight by keyboard). */
448
+ .a-menu {
449
+ box-sizing: border-box;
450
+ min-width: 128px;
451
+ padding: 4px;
452
+ overflow: hidden auto;
453
+ border-radius: var(--anfra-radius-xl);
454
+ background: var(--anfra-color-background-raised-default);
455
+ color: var(--anfra-color-text-default);
456
+ box-shadow: var(--anfra-e2); /* its edge is e2's ring, not a border */
457
+ }
458
+ .a-menu-item {
459
+ position: relative;
460
+ display: flex;
461
+ align-items: center;
462
+ gap: 6px;
463
+ width: 100%;
464
+ padding: 4px 6px;
465
+ border: 0;
466
+ border-radius: calc(var(--anfra-radius-xl) - 4px); /* nested in the menu: its radius less its padding */
467
+ background: transparent;
468
+ color: inherit;
469
+ font: var(--anfra-type-body);
470
+ text-align: left;
471
+ cursor: default;
472
+ user-select: none;
473
+ outline: none;
474
+ box-sizing: border-box;
475
+ }
476
+ .a-menu-item svg { flex-shrink: 0; width: 16px; height: 16px; pointer-events: none; }
477
+ .a-menu-item:is(:focus-visible, [data-highlighted]) { background: var(--anfra-color-background-hover); color: var(--anfra-color-text-default); }
478
+ @media (hover: hover) {
479
+ .a-menu-item:hover { background: var(--anfra-color-background-hover); color: var(--anfra-color-text-default); }
480
+ }
481
+ .a-menu-item:is(:disabled, [aria-disabled="true"]) { pointer-events: none; color: var(--anfra-color-text-disabled); }
482
+ .a-menu-item:is(:disabled, [aria-disabled="true"]) svg { color: var(--anfra-color-icon-disabled); }
483
+ .a-menu-item[data-variant="destructive"],
484
+ .a-menu-item[data-variant="destructive"] svg { color: var(--anfra-color-text-danger-default); }
485
+ .a-menu-item[data-variant="destructive"]:is(:focus-visible, [data-highlighted]) { background: var(--anfra-color-background-danger-secondary-default); }
486
+ @media (hover: hover) {
487
+ .a-menu-item[data-variant="destructive"]:hover { background: var(--anfra-color-background-danger-secondary-default); }
488
+ }
489
+ .a-menu-label { padding: 4px 6px; color: var(--anfra-color-text-placeholder); font: var(--anfra-type-caption); font-weight: 500; }
490
+ .a-menu-separator { height: 1px; margin: 4px -4px; border: 0; background: var(--anfra-color-border-default); }
491
+ .a-menu-shortcut { margin-left: auto; color: var(--anfra-color-text-placeholder); font: var(--anfra-type-caption); letter-spacing: 0.1em; }
492
+
493
+ /* Tooltip: shadcn's TooltipContent, inverted. */
494
+ .a-tooltip {
495
+ box-sizing: border-box;
496
+ display: inline-flex;
497
+ align-items: center;
498
+ gap: 6px;
499
+ width: fit-content;
500
+ max-width: 320px;
501
+ padding: 6px 12px;
502
+ border-radius: var(--anfra-radius-md);
503
+ background: var(--anfra-color-background-inverted-default);
504
+ color: var(--anfra-color-text-inverted-default);
505
+ font: var(--anfra-type-caption);
506
+ }
507
+
508
+ /* Kbd: a key, as a menu's shortcut or a field's hint shows it. */
509
+ .a-kbd {
510
+ display: inline-flex;
511
+ align-items: center;
512
+ justify-content: center;
513
+ min-width: 20px;
514
+ height: 20px;
515
+ padding: 0 4px;
516
+ border-radius: var(--anfra-radius-md);
517
+ background: var(--anfra-color-background-active);
518
+ color: var(--anfra-color-text-weak);
519
+ font: var(--anfra-type-caption);
520
+ font-weight: 500;
521
+ box-sizing: border-box;
522
+ pointer-events: none;
523
+ user-select: none;
524
+ }
525
+ /* KbdGroup: a combination, one Kbd per key. */
526
+ .a-kbd-group { display: inline-flex; flex: none; align-items: center; gap: 4px; }
527
+
528
+ /* Sidebar: shadcn's SidebarGroupLabel, SidebarMenuButton (.a-nav-item), SidebarMenuSub (.a-tree) and
529
+ SidebarMenuSubButton (.a-tree-row). The current page is aria-current="page" (or data-active): a
530
+ raised chip with a hairline, and a violet icon. */
531
+ .a-nav-label {
532
+ display: flex;
533
+ flex-shrink: 0;
534
+ align-items: center;
535
+ height: 32px;
536
+ padding: 0 8px;
537
+ border-radius: var(--anfra-radius-md);
538
+ color: var(--anfra-color-text-placeholder);
539
+ font: var(--anfra-type-caption);
540
+ font-weight: 500;
541
+ }
542
+ .a-nav-item,
543
+ .a-tree-row {
544
+ box-sizing: border-box;
545
+ display: flex;
546
+ align-items: center;
547
+ gap: 8px;
548
+ width: 100%;
549
+ min-width: 0;
550
+ overflow: hidden;
551
+ border: 0;
552
+ border-radius: var(--anfra-radius-md);
553
+ background: transparent;
554
+ color: var(--anfra-color-text-weak);
555
+ font: var(--anfra-type-body);
556
+ text-align: left;
557
+ text-decoration: none;
558
+ cursor: pointer;
559
+ }
560
+ .a-nav-item { height: 32px; padding: 8px; }
561
+ .a-nav-item[data-size="sm"] { height: 28px; font: var(--anfra-type-caption); }
562
+ .a-tree-row { height: 28px; padding: 0 8px; }
563
+ .a-nav-item > :last-child,
564
+ .a-tree-row > :last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
565
+ .a-nav-item svg,
566
+ .a-tree-row svg { flex-shrink: 0; width: 16px; height: 16px; color: var(--anfra-color-icon-weak); }
567
+ @media (hover: hover) {
568
+ .a-nav-item:hover,
569
+ .a-tree-row:hover { background: var(--anfra-color-background-hover); color: var(--anfra-color-text-default); }
570
+ }
571
+ .a-nav-item:active,
572
+ .a-tree-row:active { background: var(--anfra-color-background-active); color: var(--anfra-color-text-default); }
573
+ .a-nav-item:is(:disabled, [aria-disabled="true"]),
574
+ .a-tree-row:is(:disabled, [aria-disabled="true"]) { pointer-events: none; color: var(--anfra-color-text-disabled); }
575
+ .a-nav-item:is([aria-current="page"], [data-active]),
576
+ .a-tree-row:is([aria-current="page"], [data-active]) {
577
+ background: var(--anfra-color-background-current-default);
578
+ color: var(--anfra-color-text-default);
579
+ box-shadow: inset 0 0 0 1px var(--anfra-color-border-weak);
580
+ }
581
+ .a-nav-item:is([aria-current="page"], [data-active]) { font-weight: 500; }
582
+ .a-nav-item:is([aria-current="page"], [data-active]) svg,
583
+ .a-tree-row:is([aria-current="page"], [data-active]) svg { color: var(--anfra-color-icon-highlight-default); }
584
+ .a-tree {
585
+ display: flex;
586
+ flex-direction: column;
587
+ gap: 4px;
588
+ min-width: 0;
589
+ margin: 0 14px;
590
+ padding: 2px 10px;
591
+ border-left: 1px solid var(--anfra-color-border-default);
592
+ translate: 1px 0;
593
+ }
594
+ .a-tree .a-tree-row { translate: -1px 0; }
595
+
596
+ /* Focus: one 2px violet outline, offset 3px, on every control here but a field and a menu item. */
597
+ :is(.a-button, .a-tab, .a-nav-item, .a-tree-row):focus-visible {
598
+ outline: 2px solid var(--anfra-color-focus-ring-default);
599
+ outline-offset: 3px;
600
+ }
601
+ `;
602
+
603
+ // src/plugins/inspect/components.ts
604
+ var FALLBACKS = {
605
+ "--anfra-color-background-default": "var(--anfra-color-bg)",
606
+ "--anfra-color-background-raised-default": "var(--anfra-color-bg)",
607
+ "--anfra-color-background-current-default": "var(--anfra-color-bg)",
608
+ "--anfra-color-background-secondary-default": "var(--anfra-color-bg-sunken)",
609
+ "--anfra-color-background-hover": "var(--anfra-color-hover)",
610
+ "--anfra-color-background-active": "var(--anfra-color-active)",
611
+ "--anfra-color-background-fill-default": "color-mix(in oklch, var(--anfra-color-fg) 5%, transparent)",
612
+ "--anfra-color-background-fill-hover": "color-mix(in oklch, var(--anfra-color-fg) 9%, transparent)",
613
+ "--anfra-color-background-fill-selected": "var(--anfra-color-bg)",
614
+ "--anfra-color-background-disabled": "var(--anfra-color-hover)",
615
+ "--anfra-color-background-highlight-default": "var(--anfra-color-accent)",
616
+ "--anfra-color-background-highlight-hover": "color-mix(in oklch, var(--anfra-color-accent) 88%, var(--anfra-color-fg))",
617
+ "--anfra-color-background-highlight-active": "color-mix(in oklch, var(--anfra-color-accent) 76%, var(--anfra-color-fg))",
618
+ "--anfra-color-background-highlight-secondary-default": "var(--anfra-color-selected)",
619
+ "--anfra-color-background-info-secondary-default": "var(--anfra-color-hover)",
620
+ "--anfra-color-background-danger-default": "var(--anfra-color-danger)",
621
+ "--anfra-color-background-danger-hover": "color-mix(in oklch, var(--anfra-color-danger) 88%, var(--anfra-color-fg))",
622
+ "--anfra-color-background-danger-secondary-default": "color-mix(in srgb, var(--anfra-color-danger) 14%, transparent)",
623
+ "--anfra-color-background-warning-secondary-default": "color-mix(in srgb, var(--anfra-color-warning) 16%, transparent)",
624
+ "--anfra-color-background-success-secondary-default": "color-mix(in srgb, var(--anfra-color-success) 16%, transparent)",
625
+ "--anfra-color-background-inverted-default": "var(--anfra-color-fg)",
626
+ "--anfra-color-text-default": "var(--anfra-color-fg)",
627
+ "--anfra-color-text-weak": "var(--anfra-color-fg-weak)",
628
+ "--anfra-color-text-placeholder": "var(--anfra-color-muted)",
629
+ "--anfra-color-text-disabled": "color-mix(in srgb, var(--anfra-color-muted) 60%, transparent)",
630
+ "--anfra-color-text-highlight-default": "var(--anfra-color-accent)",
631
+ "--anfra-color-text-link-default": "var(--anfra-color-accent)",
632
+ "--anfra-color-text-link-hover": "var(--anfra-color-accent)",
633
+ "--anfra-color-text-on-fill": "var(--anfra-color-bg)",
634
+ "--anfra-color-text-inverted-default": "var(--anfra-color-bg)",
635
+ "--anfra-color-text-info-default": "var(--anfra-color-fg-weak)",
636
+ "--anfra-color-text-danger-default": "var(--anfra-color-danger)",
637
+ "--anfra-color-text-warning-default": "var(--anfra-color-warning)",
638
+ "--anfra-color-text-success-default": "var(--anfra-color-success)",
639
+ "--anfra-color-border-default": "var(--anfra-color-border)",
640
+ "--anfra-color-border-weak": "var(--anfra-color-border)",
641
+ "--anfra-color-border-hover": "var(--anfra-color-muted)",
642
+ "--anfra-color-border-disabled": "var(--anfra-color-border)",
643
+ "--anfra-color-border-highlight-strong": "var(--anfra-color-accent)",
644
+ "--anfra-color-border-danger-default": "var(--anfra-color-danger)",
645
+ "--anfra-color-border-danger-strong": "var(--anfra-color-danger)",
646
+ "--anfra-color-border-warning-default": "var(--anfra-color-warning)",
647
+ "--anfra-color-border-success-default": "var(--anfra-color-success)",
648
+ "--anfra-color-focus-ring-default": "var(--anfra-color-accent)",
649
+ "--anfra-color-icon-weak": "var(--anfra-color-muted)",
650
+ "--anfra-color-icon-disabled": "var(--anfra-color-muted)",
651
+ "--anfra-color-icon-highlight-default": "var(--anfra-color-accent)",
652
+ "--anfra-e1": "0 0 0 1px var(--anfra-color-border), 0 1px 2px oklch(0 0 0 / 0.06)",
653
+ "--anfra-e2": "0 0 0 1px var(--anfra-color-border), 0 12px 32px -12px oklch(0 0 0 / 0.3)",
654
+ "--anfra-ease-out": "cubic-bezier(0.22, 1, 0.36, 1)",
655
+ "--anfra-radius-md": "6px",
656
+ "--anfra-radius-lg": "var(--anfra-radius)",
657
+ "--anfra-radius-xl": "14px",
658
+ "--anfra-radius-pill": "9999px",
659
+ "--anfra-type-body": "400 0.875rem/1.25rem var(--anfra-font)",
660
+ "--anfra-type-label": "500 0.875rem/1.25rem var(--anfra-font)",
661
+ "--anfra-type-caption": "400 0.75rem/1rem var(--anfra-font)"
662
+ };
663
+ var COMPONENT_STYLES = components_default.replace(/var\((--anfra-[\w-]+)\)/g, (whole, name) => FALLBACKS[name] ? `var(${name}, ${FALLBACKS[name]})` : whole);
664
+
665
+ // src/plugins/inspect/view.ts
666
+ function h(doc, tag, attributes = {}, ...children) {
667
+ const element = doc.createElement(tag);
668
+ for (const [name, value] of Object.entries(attributes)) {
669
+ if (typeof value === "function") element.addEventListener(name.slice(2).toLowerCase(), value);
670
+ else if (value === true) element.setAttribute(name, "");
671
+ else if (value !== false && value !== void 0) element.setAttribute(name, String(value));
672
+ }
673
+ for (const child of children.flat(Infinity)) {
674
+ if (child === false || child === null || child === void 0) continue;
675
+ element.append(typeof child === "string" ? doc.createTextNode(child) : child);
676
+ }
677
+ return element;
678
+ }
679
+ function replace(doc, element, ...children) {
680
+ element.replaceChildren(...h(doc, "div", {}, ...children).childNodes);
681
+ }
682
+ function icon(doc, name, size = 14) {
683
+ const svg = doc.createElementNS("http://www.w3.org/2000/svg", "svg");
684
+ for (const [key, value] of Object.entries({
685
+ class: "icon",
686
+ viewBox: "0 0 24 24",
687
+ width: String(size),
688
+ height: String(size),
689
+ fill: "none",
690
+ stroke: "currentColor",
691
+ "stroke-width": "2",
692
+ "stroke-linecap": "round",
693
+ "stroke-linejoin": "round",
694
+ "aria-hidden": "true"
695
+ })) svg.setAttribute(key, value);
696
+ const path = doc.createElementNS("http://www.w3.org/2000/svg", "path");
697
+ path.setAttribute("d", ICONS[name]);
698
+ svg.append(path);
699
+ return svg;
700
+ }
701
+ function columnIcon(doc, column) {
702
+ const type = `type-${column.semantic_type}`;
703
+ return icon(doc, column.isMeasure ? "metric" : type in ICONS ? type : "type-unknown", 12);
704
+ }
705
+ var CONTROLS = {
706
+ "row-action": ["ghost", "icon-xs"],
707
+ tool: ["outline", "xs"],
708
+ link: ["link", "xs"]
709
+ };
710
+ function control(kind, extra = "") {
711
+ const [variant, size] = CONTROLS[kind];
712
+ return { class: `a-button ${kind} ${extra}`.trim(), "data-variant": variant, "data-size": size };
713
+ }
714
+ var BADGES = { neutral: "secondary", warn: "warning", error: "destructive", ok: "success" };
715
+ function badge(tone = "neutral", extra = "") {
716
+ return { class: `a-badge pill ${tone === "neutral" ? "" : tone} ${extra}`.replace(/\s+/g, " ").trim(), "data-variant": BADGES[tone] };
717
+ }
718
+ async function copyText(doc, text) {
719
+ try {
720
+ await doc.defaultView?.navigator.clipboard.writeText(text);
721
+ return true;
722
+ } catch {
723
+ return false;
724
+ }
725
+ }
726
+ function drawTab(root, context, draw, options = {}) {
727
+ const doc = context.document;
728
+ const body = h(doc, "div", { class: options.split ? "body split" : "body" });
729
+ root.append(h(doc, "style", {}, STYLES), h(doc, "div", { class: "pane" }, options.head, body));
730
+ const tooltip = tooltips(root);
731
+ const scrollers = () => [body, ...body.querySelectorAll(".detail, .scroll")];
732
+ const redraw = () => {
733
+ const scrolls = scrollers().map((element) => element.scrollTop);
734
+ const focused = root.activeElement?.closest?.("[data-key]")?.dataset.key;
735
+ const focusInBody = !!root.activeElement && body.contains(root.activeElement);
736
+ kept = new Set([...body.querySelectorAll("details[data-key]")].filter((d) => d.open).map((d) => d.dataset.key));
737
+ try {
738
+ replace(doc, body, draw());
739
+ } finally {
740
+ kept = void 0;
741
+ }
742
+ scrollers().forEach((element, index) => {
743
+ element.scrollTop = scrolls[index] ?? 0;
744
+ });
745
+ keepFlashes(body);
746
+ tooltip.redrawn();
747
+ if (focusInBody && focused !== void 0) {
748
+ [...body.querySelectorAll("[data-key]")].find((element) => element.dataset.key === focused)?.focus({ preventScroll: true });
749
+ }
750
+ };
751
+ redraw();
752
+ const stops = [context.panel.subscribe(redraw), ...(options.also ?? []).map((subscribe) => subscribe(redraw))];
753
+ return {
754
+ redraw,
755
+ dispose: () => {
756
+ stops.forEach((stop) => stop());
757
+ tooltip.dispose();
758
+ }
759
+ };
760
+ }
761
+ var kept;
762
+ function copyButton(doc, className, text, labels, attributes = {}) {
763
+ const button = h(doc, "button", { type: "button", class: className, ...attributes }, labels.idle);
764
+ button.addEventListener("click", async (event) => {
765
+ event.stopPropagation();
766
+ if (!await copyText(doc, text())) return;
767
+ replace(doc, button, labels.done);
768
+ setTimeout(() => replace(doc, button, labels.idle), 1500);
769
+ });
770
+ return button;
771
+ }
772
+ function copyIcon(doc, label, text, attributes = {}) {
773
+ const { class: className, ...rest } = control("row-action");
774
+ return copyButton(doc, String(className), text, { idle: icon(doc, "copy"), done: icon(doc, "check") }, { ...rest, "data-tip": label, "aria-label": label, ...attributes });
775
+ }
776
+ function link(doc, label, onclick, attributes = {}) {
777
+ return h(doc, "button", {
778
+ type: "button",
779
+ ...control("link"),
780
+ ...attributes,
781
+ onclick: (event) => {
782
+ event.stopPropagation();
783
+ onclick();
784
+ }
785
+ }, label);
786
+ }
787
+ function lineageButton(doc, panel, node) {
788
+ const button = h(doc, "button", {
789
+ type: "button",
790
+ ...control("row-action"),
791
+ "aria-label": "Show in Lineage",
792
+ "data-tip": node === void 0 ? void 0 : "Show in Lineage",
793
+ "data-testid": "show-in-lineage",
794
+ disabled: node === void 0,
795
+ onclick: (event) => {
796
+ event.preventDefault();
797
+ event.stopPropagation();
798
+ if (node !== void 0) panel.show(LINEAGE_TAB, node);
799
+ }
800
+ }, icon(doc, "lineage"));
801
+ 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;
802
+ }
803
+ function collapsible(doc, key, summary, body, options = {}) {
804
+ const open = options.open || !!kept?.has(key);
805
+ const details = h(
806
+ doc,
807
+ "details",
808
+ { class: `collapsible ${options.class ?? ""}`, "data-key": key, open },
809
+ h(doc, "summary", { "data-key": `${key}:summary` }, icon(doc, "chevron"), summary)
810
+ );
811
+ let drawn = false;
812
+ const fill = () => {
813
+ if (!details.open || drawn) return;
814
+ drawn = true;
815
+ details.append(h(doc, "div", { class: "collapsible-body" }, body()));
816
+ };
817
+ fill();
818
+ details.addEventListener("toggle", () => {
819
+ fill();
820
+ options.onToggle?.(details.open);
821
+ });
822
+ return details;
823
+ }
824
+ var tips = /* @__PURE__ */ new WeakMap();
825
+ function tip(element, content) {
826
+ tips.set(element, content);
827
+ return element;
828
+ }
829
+ function popover(doc, trigger, content, attributes = {}) {
830
+ const button = h(doc, "button", {
831
+ type: "button",
832
+ class: "pop-trigger",
833
+ ...attributes,
834
+ onclick: (event) => {
835
+ event.stopPropagation();
836
+ controllers.get(button.getRootNode())?.toggle(button);
837
+ }
838
+ }, trigger);
839
+ return tip(button, content);
840
+ }
841
+ var TIP_DELAY = 300;
842
+ var TIP_WARM = 400;
843
+ var TIP_GAP = 4;
844
+ var TIP_MARGIN = 8;
845
+ var controllers = /* @__PURE__ */ new WeakMap();
846
+ function tooltips(root) {
847
+ const doc = root.ownerDocument;
848
+ const win = doc.defaultView;
849
+ const box = h(doc, "div", { class: "tooltip", role: "tooltip", id: "anfra-tooltip", popover: "manual", hidden: true });
850
+ root.append(box);
851
+ let anchor;
852
+ let pending;
853
+ let timer;
854
+ let hiddenAt = 0;
855
+ const target = (event) => event.composedPath().find((node) => node instanceof win.HTMLElement && (node.hasAttribute("data-tip") || tips.has(node)));
856
+ const place = () => {
857
+ if (!anchor) return;
858
+ const at2 = anchor.getBoundingClientRect();
859
+ const size = box.getBoundingClientRect();
860
+ const below = at2.bottom + TIP_GAP;
861
+ const above = at2.top - TIP_GAP - size.height;
862
+ const fitsBelow = below + size.height <= win.innerHeight - TIP_MARGIN;
863
+ const top = fitsBelow ? below : above >= TIP_MARGIN ? above : Math.max(TIP_MARGIN, win.innerHeight - TIP_MARGIN - size.height);
864
+ box.style.left = `${Math.max(TIP_MARGIN, Math.min(at2.left, win.innerWidth - TIP_MARGIN - size.width))}px`;
865
+ box.style.top = `${top}px`;
866
+ };
867
+ const show = (element) => {
868
+ clearTimeout(timer);
869
+ pending = void 0;
870
+ const rich = tips.get(element);
871
+ const text = element.dataset.tip;
872
+ if (!rich && !text) return;
873
+ anchor?.removeAttribute("aria-describedby");
874
+ anchor = element;
875
+ replace(doc, box, rich ? rich() : text);
876
+ box.classList.toggle("rich", !!rich);
877
+ box.classList.toggle("a-tooltip", !rich);
878
+ box.hidden = false;
879
+ if (!box.matches(":popover-open")) box.showPopover?.();
880
+ element.setAttribute("aria-describedby", box.id);
881
+ place();
882
+ };
883
+ const hide = () => {
884
+ clearTimeout(timer);
885
+ pending = void 0;
886
+ if (!anchor) return;
887
+ anchor.removeAttribute("aria-describedby");
888
+ anchor = void 0;
889
+ box.hidden = true;
890
+ box.hidePopover?.();
891
+ hiddenAt = Date.now();
892
+ };
893
+ const later = (element) => {
894
+ clearTimeout(timer);
895
+ if (anchor || Date.now() - hiddenAt < TIP_WARM) {
896
+ show(element);
897
+ return;
898
+ }
899
+ pending = element;
900
+ timer = setTimeout(() => show(element), TIP_DELAY);
901
+ };
902
+ const listeners = [
903
+ [root, "pointerover", (event) => {
904
+ const element = target(event);
905
+ if (element && element !== anchor && element !== pending) later(element);
906
+ }, false],
907
+ [root, "pointerout", (event) => {
908
+ const current = anchor ?? pending;
909
+ const next = event.relatedTarget;
910
+ if (current && !(next && current.contains(next))) hide();
911
+ }, false],
912
+ [root, "focusin", (event) => {
913
+ const element = target(event);
914
+ if (element?.matches(":focus-visible")) later(element);
915
+ }, false],
916
+ [root, "focusout", () => hide(), false],
917
+ [root, "pointerdown", () => hide(), true],
918
+ [root, "keydown", (event) => {
919
+ if (event.key === "Escape") hide();
920
+ }, false],
921
+ // A scroll inside the tab's shadow root doesn't reach the document, so both are listened to.
922
+ [root, "scroll", () => hide(), true],
923
+ [win, "scroll", () => hide(), true],
924
+ [win, "resize", () => hide(), false]
925
+ ];
926
+ listeners.forEach(([on, name, listener, capture]) => on.addEventListener(name, listener, capture));
927
+ const controller = {
928
+ toggle: (element) => {
929
+ if (anchor === element) hide();
930
+ else show(element);
931
+ },
932
+ redrawn: () => {
933
+ if (!anchor || anchor.isConnected) return;
934
+ const key = anchor.dataset.key;
935
+ const next = key === void 0 ? void 0 : [...root.querySelectorAll("[data-key]")].find((element) => element.dataset.key === key);
936
+ if (next) show(next);
937
+ else hide();
938
+ },
939
+ dispose: () => {
940
+ hide();
941
+ listeners.forEach(([on, name, listener, capture]) => on.removeEventListener(name, listener, capture));
942
+ controllers.delete(root);
943
+ box.remove();
944
+ }
945
+ };
946
+ controllers.set(root, controller);
947
+ return controller;
948
+ }
949
+ function trustBars(doc, trust, size = "md") {
950
+ const [base, rise, width] = size === "sm" ? [4, 8, 3] : size === "lg" ? [20, 28, 12] : [12, 16, 8];
951
+ return h(doc, "span", { class: `bars ${size}`, "aria-hidden": "true" }, LEVELS.map((level) => h(doc, "span", {
952
+ class: level <= trust.level ? `bar fill-${trust.tone}` : "bar",
953
+ style: `height:${base + (level - 1) * rise / (LEVELS.length - 1)}px;width:${width}px`
954
+ })));
955
+ }
956
+ function trustIndicator(doc, trust) {
957
+ const label = `Level ${trust.level} \xB7 ${TRUST_LEVELS[trust.level].name}`;
958
+ return h(doc, "span", { class: "indicator trust", role: "img", "aria-label": `Trust level ${trust.level}`, "data-tip": label }, trustBars(doc, trust, "sm"));
959
+ }
960
+ function stateDot(doc, state) {
961
+ return h(doc, "span", { class: `dot ${state}`, role: "img", "aria-label": `State: ${state}`, "data-tip": state });
962
+ }
963
+ function filterIndicator(doc, active) {
964
+ if (active.length === 0) return h(doc, "span", { class: "indicator filters", "aria-hidden": "true" });
965
+ const lines = active.map((input) => {
966
+ const source = input.kind === "declared" ? "query" : input.self ? "itself" : input.source;
967
+ return `${input.field} \xB7 ${source}${input.value !== "\u2014" ? `
968
+ ${input.value}` : ""}${input.pending ? `
969
+ pending: ${input.pending}` : ""}`;
970
+ });
971
+ return h(doc, "span", {
972
+ class: "indicator filters",
973
+ "data-tip": `${plural(active.length, "filter")} applied
974
+ ${lines.join("\n")}`,
975
+ "aria-label": `${plural(active.length, "filter")} applied`
976
+ }, String(active.length), icon(doc, "filter"));
977
+ }
978
+ function highlighted(doc, code, lang) {
979
+ const tokens = lang ? tokenize(code, lang) : [{ text: code }];
980
+ 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)));
981
+ }
982
+ function json(doc, value, indent, key) {
983
+ const data = value?.toJSON?.() ?? value;
984
+ if (typeof data === "string") return key === "aql" && data.includes("\n") ? aql(doc, data, `${indent} `) : h(doc, "span", { class: "tok-str" }, JSON.stringify(data));
985
+ if (typeof data === "number" || typeof data === "boolean" || data === null) {
986
+ return h(doc, "span", { class: typeof data === "number" ? "tok-num" : "tok-kw" }, JSON.stringify(data));
987
+ }
988
+ const inner = `${indent} `;
989
+ if (Array.isArray(data)) {
990
+ if (!data.length) return "[]";
991
+ 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}]`];
992
+ }
993
+ const entries = Object.entries(data).filter(([, item]) => item !== void 0 && typeof item !== "function");
994
+ if (!entries.length) return "{}";
995
+ return ["{\n", entries.map(([name, item], i) => [
996
+ inner,
997
+ h(doc, "span", { class: "tok-key" }, JSON.stringify(name)),
998
+ ": ",
999
+ json(doc, item, inner, name),
1000
+ i < entries.length - 1 ? ",\n" : "\n"
1001
+ ]), `${indent}}`];
1002
+ }
1003
+ function aql(doc, text, indent) {
1004
+ const lines = text.split("\n");
1005
+ const rest = lines.slice(1).filter((line) => line.trim());
1006
+ const shared = rest.length ? Math.min(...rest.map((line) => line.length - line.trimStart().length)) : 0;
1007
+ const escape = (part) => JSON.stringify(part).slice(1, -1);
1008
+ return h(doc, "span", { class: "tok-str" }, '"', lines.map((line, i) => {
1009
+ const cut = i === 0 ? 0 : Math.min(shared, line.length - line.trimStart().length);
1010
+ return [
1011
+ cut > 0 && h(doc, "span", { class: "json-dedent" }, escape(line.slice(0, cut))),
1012
+ tokenize(line.slice(cut), "aql").map((token) => token.kind ? h(doc, "span", { class: `tok-${token.kind}` }, escape(token.text)) : escape(token.text)),
1013
+ i < lines.length - 1 && [h(doc, "span", { class: "json-nl" }, "\\n"), h(doc, "span", { class: "json-br", "data-indent": indent })]
1014
+ ];
1015
+ }), '"');
1016
+ }
1017
+ function jsonView(doc, value) {
1018
+ return h(doc, "pre", { class: "code-text scroll" }, h(doc, "code", {}, json(doc, value, "", void 0)));
1019
+ }
1020
+ function codeBlock(doc, sources, tab, onTab = () => {
1021
+ }) {
1022
+ const tabs = Object.keys(sources);
1023
+ let shown = sources[tab]?.code ? tab : tabs.find((t) => sources[t].code) ?? tab;
1024
+ const block = h(doc, "div", { class: "code" });
1025
+ const draw = () => {
1026
+ const { label, code, lang, json: value, empty } = sources[shown];
1027
+ const body = !code ? h(doc, "p", { class: "code-empty" }, empty) : value !== void 0 ? jsonView(doc, value) : highlighted(doc, code, lang);
1028
+ const copy = code && copyIcon(doc, `Copy the ${label}`, () => code);
1029
+ replace(
1030
+ doc,
1031
+ block,
1032
+ tabs.length > 1 ? h(
1033
+ doc,
1034
+ "div",
1035
+ { class: "code-head", role: "tablist" },
1036
+ tabs.map((t) => {
1037
+ const button = h(doc, "button", {
1038
+ type: "button",
1039
+ role: "tab",
1040
+ class: "code-tab",
1041
+ "aria-selected": String(t === shown),
1042
+ disabled: !sources[t].code,
1043
+ onclick: () => {
1044
+ shown = t;
1045
+ onTab(t);
1046
+ draw();
1047
+ }
1048
+ }, sources[t].label);
1049
+ return sources[t].code ? button : h(doc, "span", { class: "code-tab-wrap", "data-tip": sources[t].empty }, button);
1050
+ }),
1051
+ h(doc, "span", { class: "spacer" }),
1052
+ copy
1053
+ ) : copy && h(doc, "div", { class: "code-corner" }, copy),
1054
+ body
1055
+ );
1056
+ };
1057
+ draw();
1058
+ return block;
1059
+ }
1060
+ function table(doc, columns, rows, attributes = {}) {
1061
+ return h(
1062
+ doc,
1063
+ "div",
1064
+ { class: "table-wrap", ...attributes },
1065
+ h(
1066
+ doc,
1067
+ "table",
1068
+ {},
1069
+ h(doc, "thead", {}, h(doc, "tr", {}, columns.map((column) => h(doc, "th", {}, column)))),
1070
+ h(doc, "tbody", {}, rows.map((row) => h(doc, "tr", {}, row.map((cell) => h(doc, "td", {}, cellText(cell))))))
1071
+ )
1072
+ );
1073
+ }
1074
+ function cellText(value) {
1075
+ if (value === null || value === void 0) return "";
1076
+ if (value instanceof Date) return value.toISOString();
1077
+ return typeof value === "object" ? JSON.stringify(value) : String(value);
1078
+ }
1079
+ function fields(doc, pairs, attributes = {}) {
1080
+ return h(doc, "dl", attributes, pairs.map((pair) => pair && [h(doc, "dt", {}, pair[0]), h(doc, "dd", {}, pair[1])]));
1081
+ }
1082
+ var note = (doc, text, attributes = {}) => h(doc, "p", { class: "note", ...attributes }, text);
1083
+ var FLASH_MS = 1200;
1084
+ var flashes = /* @__PURE__ */ new WeakMap();
1085
+ function flash(element) {
1086
+ element.scrollIntoView?.({ block: "nearest", behavior: "smooth" });
1087
+ element.classList.remove("flash");
1088
+ element.style.animationDelay = "";
1089
+ void element.offsetWidth;
1090
+ element.classList.add("flash");
1091
+ const key = element.dataset.key;
1092
+ const body = element.closest(".body");
1093
+ if (key === void 0 || !body) return;
1094
+ if (!flashes.has(body)) flashes.set(body, /* @__PURE__ */ new Map());
1095
+ flashes.get(body).set(key, Date.now());
1096
+ }
1097
+ function keepFlashes(body) {
1098
+ const now = Date.now();
1099
+ const keys = flashes.get(body);
1100
+ for (const [key, at2] of keys ?? []) {
1101
+ if (now - at2 >= FLASH_MS) {
1102
+ keys.delete(key);
1103
+ continue;
1104
+ }
1105
+ const element = [...body.querySelectorAll("[data-key]")].find((candidate) => candidate.dataset.key === key);
1106
+ if (!element) continue;
1107
+ element.style.animationDelay = `-${now - at2}ms`;
1108
+ element.classList.add("flash");
1109
+ }
1110
+ }
1111
+ var STYLES = `${COMPONENT_STYLES}
1112
+ :host { display: block; height: 100%; color: var(--anfra-color-fg); background: var(--anfra-color-bg); font: 13px/1.45 var(--anfra-font); }
1113
+ * { box-sizing: border-box; }
1114
+ [hidden] { display: none !important; }
1115
+ button { font: inherit; color: inherit; cursor: pointer; }
1116
+ button:disabled { cursor: default; }
1117
+ :focus-visible { outline: 2px solid var(--anfra-color-accent); outline-offset: 1px; }
1118
+ /* The tabs' own colours, on the host: the tooltip sits beside the pane, not in it, and reads them too. */
1119
+ :host {
1120
+ --hover: var(--anfra-color-hover);
1121
+ --subtle: var(--anfra-color-bg-sunken);
1122
+ --accent-bg: var(--anfra-color-selected);
1123
+ --danger-bg: color-mix(in srgb, var(--anfra-color-danger) 14%, transparent);
1124
+ --ok: var(--anfra-color-success); --warn: var(--anfra-color-warning); --run: light-dark(oklch(0.588 0.139 242), oklch(0.754 0.139 232.7));
1125
+ --warn-bg: color-mix(in srgb, var(--warn) 16%, transparent); --ok-bg: color-mix(in srgb, var(--ok) 16%, transparent); }
1126
+ .pane { height: 100%; display: flex; flex-direction: column; min-height: 0; }
1127
+ .body { flex: 1; min-height: 0; overflow: auto; padding: 4px 14px 16px; }
1128
+ .body.split { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
1129
+ .body.split > .scroll { flex: 1; min-height: 0; overflow: auto; padding: 4px 14px 16px; }
1130
+ .note { color: var(--anfra-color-muted); margin: 12px 0; }
1131
+ .muted { color: var(--anfra-color-muted); }
1132
+ code, pre { font-family: var(--anfra-font-mono); }
1133
+ h4 { margin: 16px 0 0; font-size: 13px; }
1134
+ h5 { margin: 16px 0 6px; font-size: 13px; font-weight: 500; color: var(--anfra-color-fg); display: flex; align-items: center; gap: 6px; }
1135
+ dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 0; }
1136
+ dt { color: var(--anfra-color-muted); }
1137
+ dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
1138
+ .icon { flex: none; }
1139
+ .card { margin-bottom: 8px; padding: 10px 12px; border-radius: 8px; background: var(--subtle); }
1140
+ .card header { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
1141
+ .flash { animation: flash 1.2s ease-out; }
1142
+ @keyframes flash { from { box-shadow: inset 0 0 0 2px var(--anfra-color-accent); background: var(--accent-bg); } }
1143
+ .tone-ok { color: var(--ok); } .tone-warn { color: var(--warn); } .tone-error { color: var(--anfra-color-danger); }
1144
+ code.wrap { overflow-wrap: anywhere; }
1145
+ .error-text { margin: 6px 0 0; color: var(--anfra-color-danger); overflow-wrap: anywhere; }
1146
+ /* A cross-link sits in a line of text: the class layer's link Button, at the text's height. */
1147
+ /* A cross-link can hold long text (a changed value, a name): it wraps, as plain text does. */
1148
+ .a-button.link { height: auto; padding: 0; white-space: normal; overflow-wrap: anywhere; text-align: left; }
1149
+ .toolbar { flex: none; display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--anfra-color-border); }
1150
+ /* A search box: the class layer's Input around its icon and field, at a toolbar's height. */
1151
+ .search { flex: 1; display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: var(--anfra-radius-md); color: var(--anfra-color-muted); }
1152
+ .search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--anfra-color-fg); font: inherit; font-size: 12px; }
1153
+ .search input::placeholder { color: var(--anfra-color-muted); }
1154
+ /* A filter's choices: the class layer's Tabs, at a toolbar's height. Under 32px, a control takes md. */
1155
+ .segments.a-tabs { flex: none; }
1156
+ .segments.a-tabs:not([data-size]) { height: 28px; border-radius: var(--anfra-radius-md); }
1157
+ .segments.a-tabs:not([data-size]) .a-tab { border-radius: calc(var(--anfra-radius-md) - 3px); }
1158
+ .segments .a-tab { padding: 0 8px; font-size: 12px; line-height: 16px; font-weight: 500; }
1159
+ .row-action-wrap { flex: none; display: inline-flex; }
1160
+ .spacer { flex: 1; }
1161
+ /* Collapsibles */
1162
+ .collapsible > summary { list-style: none; display: flex; align-items: center; gap: 6px; padding: 4px 0; cursor: pointer; user-select: none; }
1163
+ .collapsible > summary::-webkit-details-marker { display: none; }
1164
+ .collapsible > summary > .icon { transition: transform 0.15s; color: var(--anfra-color-muted); }
1165
+ .collapsible[open] > summary > .icon { transform: rotate(90deg); }
1166
+ .collapsible-body { padding: 2px 0 8px 20px; min-width: 0; }
1167
+ .section > summary { font-size: 13px; font-weight: 500; margin-top: 12px; }
1168
+ .section > .collapsible-body { padding-left: 0; }
1169
+ /* 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. */
1170
+ .row { border-radius: 8px; background: var(--subtle); }
1171
+ .row + .row { margin-top: 6px; }
1172
+ .row > summary { min-height: 40px; padding: 6px 8px 6px 12px; border-radius: 8px; min-width: 0; }
1173
+ .row > summary:hover { background: var(--hover); }
1174
+ .row > summary > .icon { order: 99; margin-left: 4px; color: var(--anfra-color-muted); }
1175
+ .row > summary .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
1176
+ .row > .collapsible-body { padding: 2px 12px 12px; }
1177
+ .row .row { background: var(--anfra-color-bg); box-shadow: inset 0 0 0 1px var(--anfra-color-border); }
1178
+ .row.flash > summary, .card.flash, .row.flash { animation: flash 1.2s ease-out; }
1179
+ .sub > summary { font-size: 13px; font-weight: 500; }
1180
+ .sub > .collapsible-body { padding-left: 20px; }
1181
+ .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; }
1182
+ .indicator.filters { width: 32px; }
1183
+ .indicator.trust { width: 20px; height: 12px; align-items: flex-end; }
1184
+ .bars { display: inline-flex; align-items: flex-end; gap: 2px; }
1185
+ .bars.sm { gap: 1px; } .bars.lg { gap: 4px; }
1186
+ .bar { display: inline-block; border-radius: 2px; background: color-mix(in srgb, var(--anfra-color-muted) 30%, transparent); }
1187
+ .bar.fill-ok { background: var(--ok); } .bar.fill-warn { background: var(--warn); } .bar.fill-error { background: var(--anfra-color-danger); }
1188
+ .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--anfra-color-muted) 45%, transparent); }
1189
+ .dot.success { background: var(--ok); } .dot.error { background: var(--anfra-color-danger); } .dot.ok { background: var(--ok); } .dot.aborted { background: var(--warn); }
1190
+ .dot.executing, .dot.pending { background: var(--run); animation: pulse 1.2s ease-in-out infinite; }
1191
+ @keyframes pulse { 50% { opacity: 0.35; } }
1192
+ /* Popovers */
1193
+ .pop-trigger:not(.a-button, .a-badge) { border: 0; background: none; padding: 0; display: inline-flex; align-items: center; gap: 4px; color: inherit; }
1194
+ /* Plain tooltips are one line of text or a few, with their line breaks (.a-tooltip); rich ones lay out their own, on a raised card. */
1195
+ .tooltip { position: fixed; inset: auto; margin: 0; z-index: 10; border: 0; white-space: pre-line; overflow-wrap: anywhere; pointer-events: none; }
1196
+ .tooltip.rich { width: max-content; max-width: 340px; padding: 8px 10px; border-radius: 10px; background: var(--anfra-color-bg); color: var(--anfra-color-fg); box-shadow: 0 0 0 1px var(--anfra-color-border), 0 12px 32px -12px oklch(0 0 0 / 0.3); font: 12px/1.45 var(--anfra-font); white-space: normal; }
1197
+ /* Code */
1198
+ .code { margin-top: 6px; border: 1px solid var(--anfra-color-border); border-radius: 6px; overflow: hidden; position: relative; }
1199
+ .code-head { display: flex; align-items: center; gap: 2px; padding: 0 4px; border-bottom: 1px solid var(--anfra-color-border); background: var(--subtle); }
1200
+ .code-tab { border: 0; border-bottom: 2px solid transparent; background: none; padding: 6px; font-size: 12px; font-weight: 500; color: var(--anfra-color-fg-weak); }
1201
+ .code-tab:hover:not(:disabled) { color: var(--anfra-color-fg); }
1202
+ /* As the class layer's line Tabs: the open one underlined in ink. */
1203
+ .code-tab[aria-selected="true"] { color: var(--anfra-color-fg); border-bottom-color: var(--anfra-color-fg); }
1204
+ .code-tab:disabled { color: var(--anfra-color-muted); opacity: 0.6; }
1205
+ .code-tab-wrap { display: inline-flex; }
1206
+ .code-corner { position: absolute; top: 2px; right: 2px; }
1207
+ .code-text { margin: 0; max-height: 240px; overflow: auto; padding: 8px 10px; font-size: 12px; line-height: 1.5; background: var(--subtle); }
1208
+ .code-empty { margin: 0; padding: 8px 10px; font-size: 12px; color: var(--anfra-color-muted); background: var(--subtle); }
1209
+ .tok-kw { color: light-dark(oklch(0.491 0.241 292.6), oklch(0.811 0.101 293.6)); font-weight: 600; } .tok-str { color: light-dark(oklch(0.508 0.105 165.6), oklch(0.845 0.13 165)); }
1210
+ .tok-key { color: light-dark(oklch(0.511 0.086 186.4), oklch(0.855 0.125 181.1)); }
1211
+ /* An AQL string, shown across its lines: the text stays the JSON, escapes and all, so a copy of
1212
+ it is too; the line breaks and the indent under its key are generated, which a copy leaves out. */
1213
+ .json-nl { opacity: 0.45; }
1214
+ .json-br::after { content: "\\A" attr(data-indent); white-space: pre; }
1215
+ /* The indent every line of the AQL shares: kept in the text, so the copy is exact, but not shown. */
1216
+ .json-dedent { font-size: 0; }
1217
+ .tok-num { color: light-dark(oklch(0.555 0.146 49), oklch(0.879 0.153 91.6)); } .tok-com { color: var(--anfra-color-muted); font-style: italic; } .tok-fn { color: light-dark(oklch(0.488 0.217 264.4), oklch(0.809 0.096 251.8)); }
1218
+ /* Tables */
1219
+ .table-wrap { overflow: auto; max-height: 320px; border: 1px solid var(--anfra-color-border); border-radius: 6px; }
1220
+ table { border-collapse: collapse; font-size: 12px; width: max-content; min-width: 100%; }
1221
+ 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; }
1222
+ th { position: sticky; top: 0; background: var(--anfra-color-bg); font-weight: 500; z-index: 1; }
1223
+ tbody tr:last-child td { border-bottom: 0; }
1224
+ /* Structure */
1225
+ .tree { list-style: none; margin: 0; padding: 0; }
1226
+ .node { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; }
1227
+ .node:hover { background: var(--hover); }
1228
+ .twist .icon { transition: transform 0.15s; } .twist.open .icon { transform: rotate(90deg); }
1229
+ .node .twist { width: 16px; height: 16px; } .twist-space { flex: none; width: 16px; }
1230
+ .node.selected { background: var(--accent-bg); }
1231
+ .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
1232
+ .node .label, .node .app { color: var(--anfra-color-muted); overflow: hidden; text-overflow: ellipsis; }
1233
+ .node.problem .name { color: var(--anfra-color-danger); }
1234
+ .kind { flex: none; padding: 0 6px; border-radius: 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
1235
+ .kind.container { background: color-mix(in srgb, light-dark(oklch(0.541 0.247 293), oklch(0.709 0.159 293.5)) 18%, transparent); color: light-dark(oklch(0.541 0.247 293), oklch(0.709 0.159 293.5)); }
1236
+ .kind.block { background: color-mix(in srgb, light-dark(oklch(0.546 0.215 262.9), oklch(0.809 0.096 251.8)) 18%, transparent); color: light-dark(oklch(0.546 0.215 262.9), oklch(0.809 0.096 251.8)); }
1237
+ .kind.query { background: var(--ok-bg); color: var(--ok); }
1238
+ .kind.control { background: var(--warn-bg); color: var(--warn); }
1239
+ /* The actions keep their place and sit in the row's height, so showing them moves nothing. */
1240
+ .actions { flex: none; display: flex; gap: 2px; margin: -4px 0 -4px auto; visibility: hidden; }
1241
+ .node:hover .actions, .node.selected .actions, .node:focus-within .actions { visibility: visible; }
1242
+ .detail { flex: none; max-height: 45%; overflow: auto; padding: 8px 14px 16px; border-top: 1px solid var(--anfra-color-border); }
1243
+ .detail h5 { margin-top: 4px; }
1244
+ .detail .card { margin-top: 16px; }
1245
+ .detail-actions { display: flex; gap: 6px; margin-top: 8px; }
1246
+ .status { margin: 8px 0 0; color: var(--anfra-color-muted); }
1247
+ `;
1248
+
1249
+ export {
1250
+ TRUST_LEVELS,
1251
+ LEVELS,
1252
+ queryTrust,
1253
+ appTrust,
1254
+ h,
1255
+ replace,
1256
+ icon,
1257
+ columnIcon,
1258
+ control,
1259
+ badge,
1260
+ drawTab,
1261
+ copyIcon,
1262
+ link,
1263
+ lineageButton,
1264
+ collapsible,
1265
+ popover,
1266
+ tooltips,
1267
+ trustBars,
1268
+ trustIndicator,
1269
+ stateDot,
1270
+ filterIndicator,
1271
+ jsonView,
1272
+ codeBlock,
1273
+ table,
1274
+ fields,
1275
+ note,
1276
+ flash,
1277
+ STYLES
1278
+ };