@preschen/gen-vis 0.3.0 → 0.5.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.
- package/README.md +241 -0
- package/dist/gen-vis.js +1127 -0
- package/package.json +31 -21
- package/schema.json +370 -0
- package/dist/index.js +0 -1
package/dist/gen-vis.js
ADDED
|
@@ -0,0 +1,1127 @@
|
|
|
1
|
+
(() => { const s = document.createElement("style"); s.textContent = ".hover[data-v-364032d4]{font-size:13px;position:absolute;top:0}.hover .title[data-v-364032d4]{text-align:center;border-bottom:2px solid #000;padding:1px 3px;font-weight:700}.hover[data-v-364032d4]{background-color:#fffc;top:40%}.hover[data-v-364032d4] table{border-collapse:collapse}.hover[data-v-364032d4] table tr.nearest{font-weight:700}.hover[data-v-364032d4] table tr td{text-align:left;padding:1px 5px}.hover[data-v-364032d4] table tr td.value,.hover[data-v-364032d4] table tr td.y{text-align:right}.hover[data-v-364032d4] table tr td:first-child{border-left:0}.hover[data-v-364032d4] table{margin-left:auto;margin-right:auto}.hover[data-v-364032d4]{pointer-events:none}.vis-inner[data-v-1f05a06e]{display:inline-block;position:relative}.vis-inner .debug[data-v-1f05a06e]{font-size:12px}.vis-inner[data-v-1f05a06e] svg g.axis-position-top g.tick line{transform:translateY(5px)}.vis-inner[data-v-1f05a06e] svg g.axis-position-right g.tick line{transform:translate(-4px)}.vis-inner[data-v-1f05a06e] svg g.axis-position-bottom g.tick line{transform:translateY(-4px)}.vis-inner[data-v-1f05a06e] svg g.axis-position-left g.tick line{transform:translate(5px)}.vis-inner[data-v-1f05a06e] svg g.tick text,.vis-inner[data-v-1f05a06e] svg .axis-title{font-size:13px}.vis-inner[data-v-1f05a06e] svg g.group[data-visible=false],.vis-inner[data-v-1f05a06e] svg path[data-visible=false]{opacity:.01}.vis-inner[data-v-1f05a06e] svg g.grid{stroke:#ccc;stroke-width:.75px}.vis-inner[data-v-1f05a06e] svg g.hoverMarker line{stroke-width:.75px;stroke:#aaa}svg[data-v-ce0e972e]{margin-right:5px;display:inline-block}.legend .title[data-v-1bc8d55f]{margin:3px;font-size:13px;font-weight:700;position:relative}.legend .entries>div[data-v-1bc8d55f]{cursor:pointer;margin:0 5px;display:inline-block}.legend .entries>div[data-visible=false][data-v-1bc8d55f]{opacity:.3}.legend .entries>div span[data-v-1bc8d55f]{font-size:13px;display:inline-block;position:relative;top:-4px}.legend .entries>div.bold[data-v-1bc8d55f]{font-weight:700}.formElement[data-v-b7f59ae7]{margin:6px 4px;font-size:13px}.formElement .title[data-v-b7f59ae7]{margin-right:5px;font-weight:700;display:inline-block}.formElement .entries[data-v-b7f59ae7]{display:inline-block}.formElement .entries>div[data-v-b7f59ae7]{margin-right:5px;display:inline-block}.formElement .entries>div input[data-v-b7f59ae7]{display:inline-block;position:relative;top:1px}.vis[data-v-f8fa11d2] text,.vis[data-v-f8fa11d2] span,.vis[data-v-f8fa11d2] div{font-family:var(--gen-vis-font-family,Century Gothic, sans-serif)}.vis-header .title[data-v-f8fa11d2]{font-size:22px;font-weight:700}.vis-header .subtitle[data-v-f8fa11d2]{margin-top:3px;font-size:13px}.vis-header[data-v-f8fa11d2]{margin-bottom:10px}.vis-footer span[data-v-f8fa11d2]{font-size:13px}.facet-title[data-v-f8fa11d2]{margin-top:8px;font-size:13px;font-weight:700}.vis-error[data-v-a9d47434]{color:#b00;font-size:13px}\n/*$vite$:1*/"; document.head.appendChild(s); })();
|
|
2
|
+
import { Fragment as e, createApp as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, markRaw as o, mergeProps as s, normalizeStyle as c, openBlock as l, reactive as u, renderList as d, resolveComponent as f, toDisplayString as p, toRaw as m } from "vue";
|
|
3
|
+
import * as h from "d3";
|
|
4
|
+
import g from "deepmerge";
|
|
5
|
+
//#region src/utils/data.js
|
|
6
|
+
var _ = (e) => typeof e == "string" ? (e = e.replace(/^/, ""), /^\s*\[/.test(e) ? JSON.parse(e) : h.csvParse(e)) : e, v = (e) => e == null || e === "", ee = {
|
|
7
|
+
numeric: (e) => {
|
|
8
|
+
let t = v(e) ? NaN : +e;
|
|
9
|
+
return isNaN(t) ? null : t;
|
|
10
|
+
},
|
|
11
|
+
date: (e) => {
|
|
12
|
+
let t = v(e) ? NaN : typeof e == "number" ? e : Date.parse(e);
|
|
13
|
+
return isNaN(t) ? null : t;
|
|
14
|
+
}
|
|
15
|
+
}, te = (e, t) => {
|
|
16
|
+
let n = Object.keys(t.mapping).map((e) => ({
|
|
17
|
+
name: e,
|
|
18
|
+
column: t.mapping[e].column,
|
|
19
|
+
convert: ee[t.mapping[e].type] ?? ((e) => e)
|
|
20
|
+
}));
|
|
21
|
+
return e.map((e) => {
|
|
22
|
+
let t = {};
|
|
23
|
+
return n.forEach((n) => {
|
|
24
|
+
t[n.name] = n.convert(e[n.column]);
|
|
25
|
+
}), t;
|
|
26
|
+
});
|
|
27
|
+
}, ne = (e, t) => {
|
|
28
|
+
e.values = [...new Set(t.map((t) => t[e.dim]))], (e.mapping.type == "numeric" || e.mapping.type == "date") && (e.values = e.values.filter((e) => e !== null).sort((e, t) => e - t), e.extent = e.mapping.stacked ? h.extent(t.map((t) => t[`${e.dim}:st:e`])) : h.extent(e.values));
|
|
29
|
+
}, re = (e, t, n = []) => {
|
|
30
|
+
b(e, [...n, t.h]).forEach((e) => {
|
|
31
|
+
let n = 0, r = 0;
|
|
32
|
+
e.entries.forEach((e) => {
|
|
33
|
+
let i = e[t.v];
|
|
34
|
+
i >= 0 ? (e[`${t.v}:st:s`] = n, n += i, e[`${t.v}:st:e`] = n) : (e[`${t.v}:st:s`] = r, r += i, e[`${t.v}:st:e`] = r);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}, y = (e, t) => {
|
|
38
|
+
e.forEach((e) => {
|
|
39
|
+
Object.values(t).forEach((t) => {
|
|
40
|
+
e[`${t.dim}:scaled`] = t.scale(e[t.dim]), e[`${t.dim}:scaled:min`] = t.scale(t.domain[0]), e[`${t.dim}:scaled:0`] = t.scale(0), e[`${t.dim}:scaled:max`] = t.scale(t.domain[1]), t.mapping.stacked && (e[`${t.dim}:st:e:scaled`] = t.scale(e[`${t.dim}:st:e`]), e[`${t.dim}:st:s:scaled`] = t.scale(e[`${t.dim}:st:s`]), e[`${t.dim}:st:h:scaled`] = e[`${t.dim}:st:s:scaled`] - e[`${t.dim}:st:e:scaled`]);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}, b = (e, t) => {
|
|
44
|
+
let n = /* @__PURE__ */ new Map();
|
|
45
|
+
return e.forEach((e) => {
|
|
46
|
+
let r = JSON.stringify(t.map((t) => e[t]));
|
|
47
|
+
n.has(r) || n.set(r, {
|
|
48
|
+
group: Object.fromEntries(t.map((t) => [t, e[t]])),
|
|
49
|
+
entries: []
|
|
50
|
+
}), n.get(r).entries.push(e);
|
|
51
|
+
}), [...n.values()];
|
|
52
|
+
}, x = (e, t) => t.length == 0 ? [...e] : e.filter((e) => t.reduce((t, n) => Array.isArray(n.key) ? t && n.key.includes(e[n.dim]) : typeof n.key == "function" ? t && n.key(e[n.dim]) : t && e[n.dim] == n.key, !0)), ie = (e, t, n) => t, S = (e) => g.all(e, { arrayMerge: ie }), C = (e, t) => e == t || JSON.stringify(e) == JSON.stringify(t), w = (e, t) => Object.fromEntries(Object.entries(e).map(([e, n], r) => [e, t(n, e)])), T = (e, t) => Array.isArray(e) ? e.map(t) : w(e, t), ae = (e, t, n, r) => e.map((e) => ({
|
|
53
|
+
group: Object.keys(e.group).map((t) => ({
|
|
54
|
+
dim: t,
|
|
55
|
+
key: e.group[t]
|
|
56
|
+
})),
|
|
57
|
+
props: t._fill(Object.assign({}, n, ...Object.keys(e.group).map((t) => r[t].props[e.group[t]]))),
|
|
58
|
+
values: e.entries
|
|
59
|
+
})), oe = (e, t, n = !0, r = !1) => {
|
|
60
|
+
if (e.value === void 0 || e.value === null || r) {
|
|
61
|
+
if (e.prop == "ref") {
|
|
62
|
+
let n = t[e.ref];
|
|
63
|
+
n !== void 0 && (e.value = n);
|
|
64
|
+
}
|
|
65
|
+
if (e.prop == "relative") {
|
|
66
|
+
let n = t[e.ref];
|
|
67
|
+
n !== void 0 && (e.value = e.ratio * n);
|
|
68
|
+
}
|
|
69
|
+
if (e.prop == "steps") {
|
|
70
|
+
let n = t[e.ref];
|
|
71
|
+
n !== void 0 && e.steps.forEach((t) => {
|
|
72
|
+
n > t.cut && (e.value = t.value);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return n ? e.value : e;
|
|
77
|
+
}, E = (e, t) => oe({ ...j(e) }, t, !0), D = (e, t, n = !0) => O(T(e, j), t, n), O = (e, t, n = !1) => T(e, (e) => oe({ ...e }, t, n)), k = (e) => e.prop !== void 0, A = (e) => Object.values(e).flatMap((e) => typeof e != "object" || !e ? [] : k(e) ? typeof e.ref == "string" ? [e.ref.split(":")[0]] : [] : A(e)), j = (e) => {
|
|
78
|
+
if (typeof e == "object" && !Array.isArray(e) && e !== null) return k(e) ? e : w(e, j);
|
|
79
|
+
if (typeof e == "string" && e.charAt() == "@") {
|
|
80
|
+
let t = e.substring(1);
|
|
81
|
+
return {
|
|
82
|
+
prop: "ref",
|
|
83
|
+
ref: t,
|
|
84
|
+
parts: t.split(":")
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
prop: "fixed",
|
|
89
|
+
value: e
|
|
90
|
+
};
|
|
91
|
+
}, M = (e) => {
|
|
92
|
+
if (e.props) {
|
|
93
|
+
let t = e.props;
|
|
94
|
+
e.props = Object.fromEntries(Object.keys(t.manual).map((e) => {
|
|
95
|
+
let n = Object.assign({}, t.common, t.manual[e]);
|
|
96
|
+
return n.name ??= e, n.visible ??= !0, [e, n];
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
return e.scale && (e.scale.type ??= "linear", e.scale.domain ??= [null, null], e.scale.domainAbs || (e.scale.domainRel ??= e.scale.domain.map((e, t) => e === null ? (t == 0 ? -1 : 1) * .02 : 0)), e.scale.domainAbs ??= [0, 0], Array.isArray(e.scale.range) || (e.scale.orientation == "horizontal" ? e.scale.range = [0, "@width"] : e.scale.orientation == "vertical" && (e.scale.range = ["@height", 0]))), e.axis && (e.axis.padding ??= 3), e.hover !== void 0 && e.axis !== void 0 && (e.hover.format ??= e.axis.format), e.legend && (e.legend.props === void 0 && (e.legend.props = {}), "name" in e.legend.props || (e.legend.props.name = "@name")), e.hover && (e.hover.props === void 0 && (e.hover.props = {}), "name" in e.hover.props || (e.hover.props.name = "@name")), e;
|
|
100
|
+
}, se = (e) => (Object.values(e.mapping).forEach(M), Array.isArray(e.plot) || (e.plot = [e.plot]), e.facets && Array.isArray(e.facets.dim) && (e.facets.dim = e.facets.dim[0]), e.plot.forEach((e, t) => {
|
|
101
|
+
e.categories ??= [], e.id ??= `plot-${t}`, e.highlightProps = Object.keys(e.props).filter((e) => e.startsWith("highlight-")).map((e) => e.substring(10));
|
|
102
|
+
}), e.plot.forEach((e) => {
|
|
103
|
+
e.props = w(e.props, j), e._fill = (t) => O(e.props, t);
|
|
104
|
+
}), e), N = (e, t) => {
|
|
105
|
+
let n = e.formElements ?? [], r = new Set(n.flatMap((e) => e.values.flatMap((e) => Object.keys(e.mapping ?? {}))));
|
|
106
|
+
if (r.size == 0) return !1;
|
|
107
|
+
let i = n.map((t) => t.values.find((n) => C(n.value, e.globals?.[t.ref]))).filter((e) => e && e.mapping);
|
|
108
|
+
return r.forEach((n) => {
|
|
109
|
+
let r = i.filter((e) => e.mapping[n]).map((e) => e.mapping[n]), a = M(S([t.mapping[n] ?? {}, ...r]));
|
|
110
|
+
e.mapping[n] && "props" in e.mapping[n] && (a.props = e.mapping[n].props), e.mapping[n] = a;
|
|
111
|
+
}), !0;
|
|
112
|
+
}, P = (e) => e.charAt(0).toUpperCase() + e.slice(1), F = {
|
|
113
|
+
de: {
|
|
114
|
+
number: {
|
|
115
|
+
decimal: ",",
|
|
116
|
+
thousands: ".",
|
|
117
|
+
grouping: [3],
|
|
118
|
+
currency: ["", " €"]
|
|
119
|
+
},
|
|
120
|
+
time: {
|
|
121
|
+
dateTime: "%A, der %e. %B %Y, %X",
|
|
122
|
+
date: "%d.%m.%Y",
|
|
123
|
+
time: "%H:%M:%S",
|
|
124
|
+
periods: ["AM", "PM"],
|
|
125
|
+
days: [
|
|
126
|
+
"Sonntag",
|
|
127
|
+
"Montag",
|
|
128
|
+
"Dienstag",
|
|
129
|
+
"Mittwoch",
|
|
130
|
+
"Donnerstag",
|
|
131
|
+
"Freitag",
|
|
132
|
+
"Samstag"
|
|
133
|
+
],
|
|
134
|
+
shortDays: [
|
|
135
|
+
"So",
|
|
136
|
+
"Mo",
|
|
137
|
+
"Di",
|
|
138
|
+
"Mi",
|
|
139
|
+
"Do",
|
|
140
|
+
"Fr",
|
|
141
|
+
"Sa"
|
|
142
|
+
],
|
|
143
|
+
months: [
|
|
144
|
+
"Januar",
|
|
145
|
+
"Februar",
|
|
146
|
+
"März",
|
|
147
|
+
"April",
|
|
148
|
+
"Mai",
|
|
149
|
+
"Juni",
|
|
150
|
+
"Juli",
|
|
151
|
+
"August",
|
|
152
|
+
"September",
|
|
153
|
+
"Oktober",
|
|
154
|
+
"November",
|
|
155
|
+
"Dezember"
|
|
156
|
+
],
|
|
157
|
+
shortMonths: [
|
|
158
|
+
"Jan",
|
|
159
|
+
"Feb",
|
|
160
|
+
"Mrz",
|
|
161
|
+
"Apr",
|
|
162
|
+
"Mai",
|
|
163
|
+
"Jun",
|
|
164
|
+
"Jul",
|
|
165
|
+
"Aug",
|
|
166
|
+
"Sep",
|
|
167
|
+
"Okt",
|
|
168
|
+
"Nov",
|
|
169
|
+
"Dez"
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
timeTicks: {
|
|
173
|
+
millisecond: ".%L",
|
|
174
|
+
second: ":%S",
|
|
175
|
+
minute: "%H:%M",
|
|
176
|
+
hour: "%H:%M",
|
|
177
|
+
day: "%a %d",
|
|
178
|
+
week: "%d. %b",
|
|
179
|
+
month: "%B",
|
|
180
|
+
year: "%Y"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
en: {
|
|
184
|
+
number: {
|
|
185
|
+
decimal: ".",
|
|
186
|
+
thousands: ",",
|
|
187
|
+
grouping: [3],
|
|
188
|
+
currency: ["$", ""]
|
|
189
|
+
},
|
|
190
|
+
time: {
|
|
191
|
+
dateTime: "%x, %X",
|
|
192
|
+
date: "%-m/%-d/%Y",
|
|
193
|
+
time: "%-I:%M:%S %p",
|
|
194
|
+
periods: ["AM", "PM"],
|
|
195
|
+
days: [
|
|
196
|
+
"Sunday",
|
|
197
|
+
"Monday",
|
|
198
|
+
"Tuesday",
|
|
199
|
+
"Wednesday",
|
|
200
|
+
"Thursday",
|
|
201
|
+
"Friday",
|
|
202
|
+
"Saturday"
|
|
203
|
+
],
|
|
204
|
+
shortDays: [
|
|
205
|
+
"Sun",
|
|
206
|
+
"Mon",
|
|
207
|
+
"Tue",
|
|
208
|
+
"Wed",
|
|
209
|
+
"Thu",
|
|
210
|
+
"Fri",
|
|
211
|
+
"Sat"
|
|
212
|
+
],
|
|
213
|
+
months: [
|
|
214
|
+
"January",
|
|
215
|
+
"February",
|
|
216
|
+
"March",
|
|
217
|
+
"April",
|
|
218
|
+
"May",
|
|
219
|
+
"June",
|
|
220
|
+
"July",
|
|
221
|
+
"August",
|
|
222
|
+
"September",
|
|
223
|
+
"October",
|
|
224
|
+
"November",
|
|
225
|
+
"December"
|
|
226
|
+
],
|
|
227
|
+
shortMonths: [
|
|
228
|
+
"Jan",
|
|
229
|
+
"Feb",
|
|
230
|
+
"Mar",
|
|
231
|
+
"Apr",
|
|
232
|
+
"May",
|
|
233
|
+
"Jun",
|
|
234
|
+
"Jul",
|
|
235
|
+
"Aug",
|
|
236
|
+
"Sep",
|
|
237
|
+
"Oct",
|
|
238
|
+
"Nov",
|
|
239
|
+
"Dec"
|
|
240
|
+
]
|
|
241
|
+
},
|
|
242
|
+
timeTicks: {
|
|
243
|
+
millisecond: ".%L",
|
|
244
|
+
second: ":%S",
|
|
245
|
+
minute: "%I:%M",
|
|
246
|
+
hour: "%I %p",
|
|
247
|
+
day: "%a %d",
|
|
248
|
+
week: "%b %d",
|
|
249
|
+
month: "%B",
|
|
250
|
+
year: "%Y"
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}, ce = Object.keys(F), I = {
|
|
254
|
+
time: [
|
|
255
|
+
h.timeSecond,
|
|
256
|
+
h.timeMinute,
|
|
257
|
+
h.timeHour,
|
|
258
|
+
h.timeDay,
|
|
259
|
+
h.timeWeek,
|
|
260
|
+
h.timeMonth,
|
|
261
|
+
h.timeYear
|
|
262
|
+
],
|
|
263
|
+
utc: [
|
|
264
|
+
h.utcSecond,
|
|
265
|
+
h.utcMinute,
|
|
266
|
+
h.utcHour,
|
|
267
|
+
h.utcDay,
|
|
268
|
+
h.utcWeek,
|
|
269
|
+
h.utcMonth,
|
|
270
|
+
h.utcYear
|
|
271
|
+
]
|
|
272
|
+
}, L = (e, t, n) => {
|
|
273
|
+
let r = Object.fromEntries(Object.entries(t).map(([t, n]) => [t, e(n)])), [i, a, o, s, c, l, u] = n;
|
|
274
|
+
return (e) => (i(e) < e ? r.millisecond : a(e) < e ? r.second : o(e) < e ? r.minute : s(e) < e ? r.hour : l(e) < e ? c(e) < e ? r.day : r.week : u(e) < e ? r.month : r.year)(e);
|
|
275
|
+
}, le = (e = "de") => {
|
|
276
|
+
let t = typeof e == "string" ? { base: e } : e, n = F[t.base ?? "de"];
|
|
277
|
+
if (!n) throw Error(`Unknown locale '${t.base}', expected one of ${ce.map((e) => `'${e}'`).join(", ")}`);
|
|
278
|
+
let r = h.formatLocale({
|
|
279
|
+
...n.number,
|
|
280
|
+
...t.number
|
|
281
|
+
}), i = h.timeFormatLocale({
|
|
282
|
+
...n.time,
|
|
283
|
+
...t.time
|
|
284
|
+
}), a = {
|
|
285
|
+
...n.timeTicks,
|
|
286
|
+
...t.timeTicks
|
|
287
|
+
};
|
|
288
|
+
return {
|
|
289
|
+
number: r,
|
|
290
|
+
time: i,
|
|
291
|
+
tickFormat(e, t, n = 10) {
|
|
292
|
+
if ([
|
|
293
|
+
"linear",
|
|
294
|
+
"pow",
|
|
295
|
+
"sqrt"
|
|
296
|
+
].includes(t)) {
|
|
297
|
+
let [t, i] = e.domain(), a = h.precisionFixed(h.tickStep(t, i, n));
|
|
298
|
+
return r.format(`,.${Number.isFinite(a) ? a : 0}f`);
|
|
299
|
+
}
|
|
300
|
+
return t == "time" ? L(i.format, a, I.time) : t == "utc" ? L(i.utcFormat, a, I.utc) : null;
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
}, R = [
|
|
304
|
+
"svg:path",
|
|
305
|
+
"svg:circle",
|
|
306
|
+
"svg:line",
|
|
307
|
+
"svg:rect",
|
|
308
|
+
"svg:text",
|
|
309
|
+
"base:area",
|
|
310
|
+
"bar",
|
|
311
|
+
"stackedBar"
|
|
312
|
+
], z = [
|
|
313
|
+
"numeric",
|
|
314
|
+
"date",
|
|
315
|
+
"categorical"
|
|
316
|
+
], B = ["horizontal", "vertical"], V = [
|
|
317
|
+
"top",
|
|
318
|
+
"bottom",
|
|
319
|
+
"left",
|
|
320
|
+
"right"
|
|
321
|
+
], H = [
|
|
322
|
+
"fixed",
|
|
323
|
+
"ref",
|
|
324
|
+
"relative",
|
|
325
|
+
"steps"
|
|
326
|
+
], U = (e) => e.map((e) => `'${e}'`).join(", "), W = (e, t, n) => {
|
|
327
|
+
if (typeof e != "object" || !e || Array.isArray(e)) return;
|
|
328
|
+
if ("prop" in e) {
|
|
329
|
+
H.includes(e.prop) ? e.prop != "fixed" && typeof e.ref != "string" && n(t, `a '${e.prop}' prop needs a 'ref'`) : n(t, `unknown prop '${e.prop}', expected one of ${U(H)}`);
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
let r = [
|
|
333
|
+
"ratio",
|
|
334
|
+
"steps",
|
|
335
|
+
"ref",
|
|
336
|
+
"mode"
|
|
337
|
+
].filter((t) => t in e);
|
|
338
|
+
if (r.length > 0) return n(t, `has ${U(r)} but no 'prop', so it is not evaluated`);
|
|
339
|
+
Object.entries(e).forEach(([e, r]) => W(r, `${t}.${e}`, n));
|
|
340
|
+
}, ue = (e) => {
|
|
341
|
+
let t = [], n = (e, n) => t.push(`${e}: ${n}`), r = e.mapping ?? {};
|
|
342
|
+
e.mapping || n("mapping", "missing"), Object.entries(r).forEach(([e, t]) => {
|
|
343
|
+
let r = `mapping.${e}`;
|
|
344
|
+
if (typeof t.column != "string" && n(r, "no 'column'"), t.type !== void 0 && !z.includes(t.type) && n(`${r}.type`, `unknown type '${t.type}', expected one of ${U(z)}`), t.props && !t.props.manual && n(`${r}.props`, "expected 'manual' (and optional 'common') entries"), t.scale) {
|
|
345
|
+
let e = t.scale.type ?? "linear", i = h[`scale${P(e)}`];
|
|
346
|
+
typeof i == "function" ? typeof i().ticks == "function" != ["numeric", "date"].includes(t.type) && n(`${r}.scale.type`, `a ${e} scale does not fit the type '${t.type}'`) : n(`${r}.scale.type`, `unknown d3 scale '${e}'`), t.scale.orientation !== void 0 && !B.includes(t.scale.orientation) && n(`${r}.scale.orientation`, `unknown orientation '${t.scale.orientation}', expected one of ${U(B)}`);
|
|
347
|
+
}
|
|
348
|
+
t.axis && (t.scale || n(`${r}.axis`, "an axis needs a 'scale'"), V.includes(t.axis.position) || n(`${r}.axis.position`, `unknown position '${t.axis.position}', expected one of ${U(V)}`), W(t.axis.ticks, `${r}.axis.ticks`, n));
|
|
349
|
+
});
|
|
350
|
+
let i = [].concat(e.plot ?? []);
|
|
351
|
+
if (i.length == 0 && n("plot", "missing"), i.forEach((e, t) => {
|
|
352
|
+
let i = `plot[${t}]`;
|
|
353
|
+
R.includes(e.type) || n(`${i}.type`, `unknown type '${e.type}', expected one of ${U(R)}`), (e.categories ?? []).filter((e) => !(e in r)).forEach((e) => n(`${i}.categories`, `unknown mapping '${e}'`)), W(e.props, `${i}.props`, n);
|
|
354
|
+
}), e.facets) {
|
|
355
|
+
let t = [].concat(e.facets.dim ?? []);
|
|
356
|
+
t.length != 1 && n("facets.dim", "expected the name of one mapping"), t.filter((e) => !(e in r)).forEach((e) => n("facets.dim", `unknown mapping '${e}'`));
|
|
357
|
+
}
|
|
358
|
+
return W(e.options?.height, "options.height", n), W(e.facets?.cols, "facets.cols", n), t;
|
|
359
|
+
}, G = (e, t = document.baseURI) => new URL(e, t).href, K = async (e) => {
|
|
360
|
+
try {
|
|
361
|
+
return await h.text(e);
|
|
362
|
+
} catch (t) {
|
|
363
|
+
throw Error(`Could not load '${e}': ${t.message}`);
|
|
364
|
+
}
|
|
365
|
+
}, q = (e, t) => {
|
|
366
|
+
try {
|
|
367
|
+
return JSON.parse(e);
|
|
368
|
+
} catch (e) {
|
|
369
|
+
throw Error(`Invalid JSON in definition ${t}: ${e.message}`);
|
|
370
|
+
}
|
|
371
|
+
}, de = async (e, t, n = K) => {
|
|
372
|
+
let r = [e], i = /* @__PURE__ */ new Set();
|
|
373
|
+
for (; e.parent;) {
|
|
374
|
+
if (t = G(e.parent, t), i.has(t)) throw Error(`Cyclic parent definition '${t}'`);
|
|
375
|
+
i.add(t), e = q(await n(t), `'${t}'`), r.unshift(e);
|
|
376
|
+
}
|
|
377
|
+
return S(r);
|
|
378
|
+
}, J = (e) => o(Array.from(m(e))), fe = async ({ def: e = null, defUrl: t = null, data: n = null }) => {
|
|
379
|
+
let r;
|
|
380
|
+
e === null ? (r = G(t), e = q(await K(r), `'${r}'`)) : typeof e == "string" && (e = q(e, "attribute"));
|
|
381
|
+
let i = await de(JSON.parse(JSON.stringify(e)), r);
|
|
382
|
+
ue(i).forEach((e) => console.warn(`gen-vis ${r ?? "inline definition"}: ${e}`));
|
|
383
|
+
let a = se(JSON.parse(JSON.stringify(i)));
|
|
384
|
+
if (N(a, i), n === null) {
|
|
385
|
+
if (!i.data) throw Error("No data given, neither in the definition nor as attribute.");
|
|
386
|
+
n = await K(G(i.data, r));
|
|
387
|
+
}
|
|
388
|
+
let s = J(_(n));
|
|
389
|
+
return {
|
|
390
|
+
defUrl: r ?? null,
|
|
391
|
+
defOrg: i,
|
|
392
|
+
locale: o(le(i.options?.locale)),
|
|
393
|
+
rows: s,
|
|
394
|
+
def: a,
|
|
395
|
+
data: J(te(s, a))
|
|
396
|
+
};
|
|
397
|
+
}, pe = class {
|
|
398
|
+
defUrl = null;
|
|
399
|
+
defOrg = null;
|
|
400
|
+
locale = null;
|
|
401
|
+
def = null;
|
|
402
|
+
rows = null;
|
|
403
|
+
data = null;
|
|
404
|
+
runs = 0;
|
|
405
|
+
get loaded() {
|
|
406
|
+
return this.def !== null && this.data !== null;
|
|
407
|
+
}
|
|
408
|
+
get axis() {
|
|
409
|
+
let e = {};
|
|
410
|
+
return this.mappingNamesWithKey("scale").forEach((t) => {
|
|
411
|
+
let n = this.mapping(t).scale.orientation;
|
|
412
|
+
n == "horizontal" && (e.h = t), n == "vertical" && (e.v = t);
|
|
413
|
+
}), e;
|
|
414
|
+
}
|
|
415
|
+
formatter(e) {
|
|
416
|
+
return e == "time" ? this.locale.time.format : e == "utc" ? this.locale.time.utcFormat : this.locale.number.format;
|
|
417
|
+
}
|
|
418
|
+
mapping(e) {
|
|
419
|
+
return this.def.mapping[e];
|
|
420
|
+
}
|
|
421
|
+
prop(e, t) {
|
|
422
|
+
return this.def.mapping[e].props[t];
|
|
423
|
+
}
|
|
424
|
+
mappingNamesWithKey(e) {
|
|
425
|
+
return Object.keys(this.def.mapping).filter((t) => e in this.def.mapping[t]);
|
|
426
|
+
}
|
|
427
|
+
async init(e) {
|
|
428
|
+
let t = ++this.runs;
|
|
429
|
+
this.def = this.data = null;
|
|
430
|
+
try {
|
|
431
|
+
let n = await fe(e);
|
|
432
|
+
t == this.runs && Object.assign(this, n);
|
|
433
|
+
} catch (e) {
|
|
434
|
+
if (t == this.runs) throw e;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
applyFormElements() {
|
|
438
|
+
N(this.def, this.defOrg) && (this.data = J(te(this.rows, this.def)));
|
|
439
|
+
}
|
|
440
|
+
}, me = () => u(new pe()), Y = (e, t) => {
|
|
441
|
+
let n = e.mapping.scale, r = h[`scale${P(n.type)}`]();
|
|
442
|
+
if (r.range(D(n.range, t)), e.extent) {
|
|
443
|
+
e.domain = [...n.domain], e.domainRel = [...n.domainRel ? n.domainRel : [0, 0]], e.domainAbs = n.domainAbs, e.domain[0] ??= e.extent[0], e.domain[1] ??= e.extent[1];
|
|
444
|
+
let t = e.domain[1] - e.domain[0];
|
|
445
|
+
e.domain[0] += t * e.domainRel[0], e.domain[1] += t * e.domainRel[1], e.domain[0] += e.domainAbs[0], e.domain[1] += e.domainAbs[1], r.invertCustom = (t) => e.values[h.bisectCenter(e.values, r.invert(t))];
|
|
446
|
+
} else e.domain = e.values, n.padding ??= .4, r.padding(n.padding), r.invertCustom = (e) => {
|
|
447
|
+
let t = Math.floor(e / r.step());
|
|
448
|
+
return r.domain()[Math.max(0, Math.min(t, r.domain().length - 1))];
|
|
449
|
+
};
|
|
450
|
+
r.domain(e.domain), e.scale = r;
|
|
451
|
+
}, X = function(e) {
|
|
452
|
+
let t = h.select(this);
|
|
453
|
+
Object.entries(e).forEach(([e, n], r) => {
|
|
454
|
+
if (n instanceof Object) {
|
|
455
|
+
if (!k(n)) return;
|
|
456
|
+
n = n.value;
|
|
457
|
+
}
|
|
458
|
+
if (e == "text") {
|
|
459
|
+
t.text(n);
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
t.attr(e, n);
|
|
463
|
+
});
|
|
464
|
+
}, he = function(e) {
|
|
465
|
+
let t = h.select(this);
|
|
466
|
+
e.group.forEach((e) => {
|
|
467
|
+
t.attr(`data-group-${e.dim}`, e.key);
|
|
468
|
+
}), e.group.forEach((e) => {
|
|
469
|
+
t.attr(`data-visible-${e.dim}`, e.visible);
|
|
470
|
+
}), t.attr("data-visible", e.group.reduce((e, t) => e && t.visible, !0));
|
|
471
|
+
}, ge = (e, t, n) => {
|
|
472
|
+
let r = t.categories.filter((e) => e in n).map((e) => ({
|
|
473
|
+
attr: `data-group-${e}`,
|
|
474
|
+
value: String(n[e])
|
|
475
|
+
}));
|
|
476
|
+
return r.length == 0 ? null : e.selectAll(`g.plotGroup.${t.id} [${r[0].attr}]`).filter(function() {
|
|
477
|
+
return r.every((e) => this.getAttribute(e.attr) === e.value);
|
|
478
|
+
});
|
|
479
|
+
}, Z = (e, t, n = null) => {
|
|
480
|
+
t.filter((e) => e.highlightProps.length > 0).forEach((t) => {
|
|
481
|
+
e.selectAll(`g.plotGroup.${t.id} .highlight`).classed("highlight", !1).each(function() {
|
|
482
|
+
let e = h.select(this);
|
|
483
|
+
t.highlightProps.forEach((t) => e.attr(t, e.attr(`default-${t}`)));
|
|
484
|
+
});
|
|
485
|
+
let r = n && ge(e, t, n);
|
|
486
|
+
r && r.classed("highlight", !0).raise().each(function() {
|
|
487
|
+
let e = h.select(this);
|
|
488
|
+
t.highlightProps.forEach((t) => {
|
|
489
|
+
e.attr(`default-${t}`, e.attr(t)).attr(t, e.attr(`highlight-${t}`));
|
|
490
|
+
});
|
|
491
|
+
});
|
|
492
|
+
});
|
|
493
|
+
}, Q = (e, t) => {
|
|
494
|
+
let n = e.__vccOpts || e;
|
|
495
|
+
for (let [e, r] of t) n[e] = r;
|
|
496
|
+
return n;
|
|
497
|
+
}, _e = {
|
|
498
|
+
props: [
|
|
499
|
+
"title",
|
|
500
|
+
"axis",
|
|
501
|
+
"side",
|
|
502
|
+
"data"
|
|
503
|
+
],
|
|
504
|
+
data: () => ({ space: 20 }),
|
|
505
|
+
computed: {
|
|
506
|
+
left() {
|
|
507
|
+
return this.side == "left" ? `${this.axis.h.value - this.space}px` : `${this.axis.h.value + this.space}px`;
|
|
508
|
+
},
|
|
509
|
+
transform() {
|
|
510
|
+
return this.side == "left" ? "translate(-100%, -50%)" : "translate(0, -50%)";
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
mounted() {
|
|
514
|
+
this.render();
|
|
515
|
+
},
|
|
516
|
+
watch: { data: "render" },
|
|
517
|
+
methods: { render() {
|
|
518
|
+
if (!this.$refs.entries || !this.data) return;
|
|
519
|
+
let e = [...this.data].sort((e, t) => t.entries[this.axis.v.col].value - e.entries[this.axis.v.col].value), t = h.select(this.$refs.entries).selectAll("tr.entry").data(e).join("tr").attr("class", "entry").classed("nearest", (e) => e.nearest);
|
|
520
|
+
t.selectAll("td").remove(), t.selectAll("td").data((e) => Object.entries(e.entries)).join("td").attr("class", (e) => e[0]).html((e) => typeof e[1] == "object" ? e[1].name : e[1]);
|
|
521
|
+
} }
|
|
522
|
+
}, ve = { class: "title" }, ye = {
|
|
523
|
+
class: "entries",
|
|
524
|
+
ref: "entries"
|
|
525
|
+
};
|
|
526
|
+
function be(e, t, n, o, s, u) {
|
|
527
|
+
return n.axis && n.axis.h ? (l(), i("div", {
|
|
528
|
+
key: 0,
|
|
529
|
+
class: "hover",
|
|
530
|
+
ref: "hover",
|
|
531
|
+
style: c({
|
|
532
|
+
left: u.left,
|
|
533
|
+
transform: u.transform
|
|
534
|
+
})
|
|
535
|
+
}, [a("div", ve, p(n.axis.h.name), 1), a("table", ye, null, 512)], 4)) : r("", !0);
|
|
536
|
+
}
|
|
537
|
+
var xe = /*#__PURE__*/ Q(_e, [["render", be], ["__scopeId", "data-v-364032d4"]]), Se = (...e) => e.every((e) => Number.isFinite(e)), Ce = {
|
|
538
|
+
props: [
|
|
539
|
+
"filter",
|
|
540
|
+
"shared",
|
|
541
|
+
"height",
|
|
542
|
+
"width",
|
|
543
|
+
"margins",
|
|
544
|
+
"data"
|
|
545
|
+
],
|
|
546
|
+
inject: ["store"],
|
|
547
|
+
data: () => ({
|
|
548
|
+
info: {},
|
|
549
|
+
debug: null,
|
|
550
|
+
def: null,
|
|
551
|
+
hover: { visible: !1 }
|
|
552
|
+
}),
|
|
553
|
+
computed: {
|
|
554
|
+
innerWidth() {
|
|
555
|
+
return this.width - (this.margins.left + this.margins.right);
|
|
556
|
+
},
|
|
557
|
+
innerHeight() {
|
|
558
|
+
return this.height - (this.margins.top + this.margins.bottom);
|
|
559
|
+
},
|
|
560
|
+
relativeBases() {
|
|
561
|
+
return {
|
|
562
|
+
width: this.width,
|
|
563
|
+
innerWidth: this.innerWidth,
|
|
564
|
+
height: this.height,
|
|
565
|
+
innerHeight: this.innerHeight
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
},
|
|
569
|
+
components: { Hover: xe },
|
|
570
|
+
created() {
|
|
571
|
+
this.def = this.store.def;
|
|
572
|
+
},
|
|
573
|
+
mounted() {
|
|
574
|
+
this.inner = h.select(this.$refs.inner), this.scales(), this.axis(), this.plot(), this.hoverInit();
|
|
575
|
+
},
|
|
576
|
+
unmounted() {
|
|
577
|
+
document.removeEventListener("pointerdown", this.hideOnPointerOutside);
|
|
578
|
+
},
|
|
579
|
+
methods: {
|
|
580
|
+
plot() {
|
|
581
|
+
this.def.plot.forEach((e) => {
|
|
582
|
+
let t = ae(b(this.data, e.categories), e, this.relativeBases, this.def.mapping), n = this.inner.append("g").classed("plotGroup", !0).classed(e.id, !0);
|
|
583
|
+
this[e.type](t, n);
|
|
584
|
+
});
|
|
585
|
+
},
|
|
586
|
+
_groupwise: function(e, t) {
|
|
587
|
+
return t.classed("paths", !0).selectAll("path").data(e).enter().append("path").each(function(e) {
|
|
588
|
+
X.call(this, e.props);
|
|
589
|
+
}).each(he);
|
|
590
|
+
},
|
|
591
|
+
_pointwise(e, t, n, r = (e) => e) {
|
|
592
|
+
return t.classed(n, !0).selectAll("g.group").data(e).enter().append("g").attr("class", "group").each(he).selectAll(n).data((e) => {
|
|
593
|
+
let t = A(e.props);
|
|
594
|
+
return e.values.filter((e) => t.every((t) => e[t] !== null)).map((t) => r(O(e.props, t)));
|
|
595
|
+
}).enter().append(n).each(X);
|
|
596
|
+
},
|
|
597
|
+
"svg:path": function(e, t) {
|
|
598
|
+
this._groupwise(e, t).attr("d", (e) => h.line().defined((e) => Se(e.x, e.y)).x((e) => e.x).y((e) => e.y)(e.values.map((t) => O(e.props.d, t, !0))));
|
|
599
|
+
},
|
|
600
|
+
"svg:circle": function(e, t) {
|
|
601
|
+
this._pointwise(e, t, "circle");
|
|
602
|
+
},
|
|
603
|
+
"svg:line": function(e, t) {
|
|
604
|
+
this._pointwise(e, t, "line");
|
|
605
|
+
},
|
|
606
|
+
"svg:rect": function(e, t) {
|
|
607
|
+
this._pointwise(e, t, "rect");
|
|
608
|
+
},
|
|
609
|
+
"svg:text": function(e, t) {
|
|
610
|
+
this._pointwise(e, t, "text");
|
|
611
|
+
},
|
|
612
|
+
"base:area": function(e, t) {
|
|
613
|
+
this._groupwise(e, t).attr("d", (e) => h.area().defined((e) => Se(e.x, e.y0, e.y1)).x((e) => e.x).y1((e) => e.y1).y0((e) => e.y0)(e.values.map((t) => O(e.props.d, t, !0))));
|
|
614
|
+
},
|
|
615
|
+
bar(e, t) {
|
|
616
|
+
let n = this;
|
|
617
|
+
this._pointwise(e, t, "rect", (e) => {
|
|
618
|
+
let t = e.height.parts[0], r = n.info[t].scale(0);
|
|
619
|
+
if (e.width === void 0) {
|
|
620
|
+
let t = e.cx.parts[0];
|
|
621
|
+
e.width = j(n.info[t].scale.step() * (1 - n.info[t].scale.padding()));
|
|
622
|
+
}
|
|
623
|
+
return e.x = j(e.cx.value - e.width.value / 2), delete e.cx, e.y = j(e.height.value), e.height = j(r - e.height.value), e;
|
|
624
|
+
});
|
|
625
|
+
},
|
|
626
|
+
stackedBar(e, t) {
|
|
627
|
+
e.forEach((e) => {
|
|
628
|
+
let t = e.props.x.ref, n = e.props.y.ref;
|
|
629
|
+
e.props.x = j(`@${t}:scaled`), e.props.y = j(`@${n}:st:e:scaled`), e.props.height = j(`@${n}:st:h:scaled`), e.props.transform = j(`translate(-${e.props.width.value / 2} 0)`);
|
|
630
|
+
}), this._pointwise(e, t, "rect", (e) => (e.height.value < 0 && (e.y.value += e.height.value, e.height.value = -e.height.value), e));
|
|
631
|
+
},
|
|
632
|
+
scales() {
|
|
633
|
+
let e = {};
|
|
634
|
+
this.store.mappingNamesWithKey("scale").filter((e) => !Object.keys(this.shared).includes(e)).forEach((t) => {
|
|
635
|
+
let n = {
|
|
636
|
+
dim: t,
|
|
637
|
+
mapping: this.store.mapping(t)
|
|
638
|
+
};
|
|
639
|
+
ne(n, this.data), Y(n, {
|
|
640
|
+
width: this.innerWidth,
|
|
641
|
+
height: this.innerHeight
|
|
642
|
+
}), e[t] = n;
|
|
643
|
+
}), y(this.data, e), this.info = {
|
|
644
|
+
...this.shared,
|
|
645
|
+
...e
|
|
646
|
+
};
|
|
647
|
+
},
|
|
648
|
+
axis() {
|
|
649
|
+
this.store.mappingNamesWithKey("axis").forEach((e) => {
|
|
650
|
+
let t = this.store.mapping(e), n = t.axis, r = this.info[e].scale, i = E(n.ticks, this.relativeBases), a = h[`axis${P(n.position)}`](r).tickSizeInner(9).tickSizeOuter(0).ticks(i).tickPadding(n.padding);
|
|
651
|
+
if (n.format) a.tickFormat(this.store.formatter(t.scale.type)(n.format));
|
|
652
|
+
else if (!n.values) {
|
|
653
|
+
let e = this.store.locale.tickFormat(r, t.scale.type, i);
|
|
654
|
+
e && a.tickFormat(e);
|
|
655
|
+
}
|
|
656
|
+
if (n.values && a.tickValues(n.values), n.grid) {
|
|
657
|
+
let e = n.values ?? (r.ticks ? r.ticks(i) : r.domain());
|
|
658
|
+
this.grid(r, e, ["left", "right"].includes(n.position));
|
|
659
|
+
}
|
|
660
|
+
let o = this.inner.append("g").attr("class", `axis-name-${e} axis-position-${n.position}`).call(a);
|
|
661
|
+
if (n.position == "bottom" && o.attr("transform", `translate(0, ${this.innerHeight})`), n.position == "right" && o.attr("transform", `translate(${this.innerWidth}, 0)`), n.rotate && o.selectAll("text").attr("text-anchor", n.rotate > 0 ? "end" : "start").attr("transform", `rotate(${-n.rotate})`), n.title) {
|
|
662
|
+
let e = this.inner.append("text").attr("class", "axis-title").attr("y", 0).attr("x", 0).attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(n.title.name);
|
|
663
|
+
n.position == "left" && e.attr("transform", `rotate(-90) translate(-${this.innerHeight / 2} -${n.title.offset})`), n.position == "right" && e.attr("transform", `rotate(90) translate(${this.innerHeight / 2} -${this.innerWidth + n.title.offset})`), n.position == "top" && e.attr("transform", `translate(${this.innerWidth / 2} -${n.title.offset})`), n.position == "bottom" && e.attr("transform", `translate(${this.innerWidth / 2} ${this.innerHeight + n.title.offset})`);
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
},
|
|
667
|
+
grid(e, t, n) {
|
|
668
|
+
let r = e.bandwidth ? e.bandwidth() / 2 : 0, i = this.inner.append("g").attr("class", "grid").selectAll("line").data(t).enter().append("line");
|
|
669
|
+
n ? i.attr("x1", 0).attr("x2", this.innerWidth).attr("y1", (t) => e(t) + r).attr("y2", (t) => e(t) + r) : i.attr("y1", 0).attr("y2", this.innerHeight).attr("x1", (t) => e(t) + r).attr("x2", (t) => e(t) + r);
|
|
670
|
+
},
|
|
671
|
+
hoverInit() {
|
|
672
|
+
let e = this, t = this.store.axis;
|
|
673
|
+
if (!t.h || !t.v) return;
|
|
674
|
+
let n = Object.fromEntries(Object.entries(t).map(([e, t]) => {
|
|
675
|
+
let n = this.def.mapping[t], r = n.hover?.format ?? n.axis?.format ?? (["time", "utc"].includes(n.scale.type) ? "%x" : "c");
|
|
676
|
+
return [e, {
|
|
677
|
+
axis: e,
|
|
678
|
+
name: t,
|
|
679
|
+
formatter: this.store.formatter(n.scale.type)(r)
|
|
680
|
+
}];
|
|
681
|
+
})), r = this.store.mappingNamesWithKey("hover").filter((e) => e != t.h && e != t.v && this.store.mapping(e).props), i = h.select(this.$refs.hoverMarker).select("line"), a = () => {
|
|
682
|
+
e.hover.visible = !1, Z(e.inner, e.def.plot);
|
|
683
|
+
};
|
|
684
|
+
this.hideOnPointerOutside = (t) => {
|
|
685
|
+
e.hover.visible && !e.$refs.svg.contains(t.target) && a();
|
|
686
|
+
}, document.addEventListener("pointerdown", this.hideOnPointerOutside), this.inner.append("rect").attr("class", "events").attr("width", this.innerWidth).attr("height", this.innerHeight).attr("opacity", 0).style("touch-action", "pan-y").on("pointerdown pointermove", function(t) {
|
|
687
|
+
e.hover.visible = !0;
|
|
688
|
+
let a = h.pointer(t), o = e.info[n.h.name], s = o.scale.invertCustom(a[0]);
|
|
689
|
+
if (s === void 0) return;
|
|
690
|
+
let c = o.scale(s);
|
|
691
|
+
i.attr("x1", c).attr("x2", c).attr("y1", 0).attr("y2", e.innerHeight);
|
|
692
|
+
let l = x(e.data, [{
|
|
693
|
+
dim: n.h.name,
|
|
694
|
+
key: s
|
|
695
|
+
}]).filter((e) => e[n.v.name] !== null).map((t) => {
|
|
696
|
+
let i = {
|
|
697
|
+
entries: {},
|
|
698
|
+
data: t,
|
|
699
|
+
nearest: !1
|
|
700
|
+
};
|
|
701
|
+
return r.forEach((n) => {
|
|
702
|
+
i.entries[n] = D(e.store.mapping(n).hover.props, e.store.prop(n, t[n]));
|
|
703
|
+
}), i.entries[n.v.name] = {
|
|
704
|
+
value: t[n.v.name],
|
|
705
|
+
name: n.v.formatter(t[n.v.name])
|
|
706
|
+
}, i;
|
|
707
|
+
}), u = e.info[n.v.name].scale.invert(a[1]), d = n.v.name, f;
|
|
708
|
+
f = e.store.mapping(d).stacked ? h.least(l, (e) => {
|
|
709
|
+
let [t, n] = h.extent([e.data[`${d}:st:s`], e.data[`${d}:st:e`]]);
|
|
710
|
+
return u < t ? t - u : u > n ? u - n : 0;
|
|
711
|
+
}) : h.least(l, (e) => Math.abs(e.data[d] - u)), f && (f.nearest = !0), Z(e.inner, e.def.plot, f?.data), e.hover.data = l, e.hover.axis = {
|
|
712
|
+
h: {
|
|
713
|
+
col: n.h.name,
|
|
714
|
+
value: c,
|
|
715
|
+
name: n.h.formatter(s)
|
|
716
|
+
},
|
|
717
|
+
v: {
|
|
718
|
+
col: n.v.name,
|
|
719
|
+
value: u
|
|
720
|
+
}
|
|
721
|
+
}, e.hover.side = c > e.innerWidth / 2 ? "left" : "right";
|
|
722
|
+
}).on("pointerleave", (e) => {
|
|
723
|
+
e.pointerType != "touch" && a();
|
|
724
|
+
}).on("pointercancel", a);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}, we = ["width", "height"], Te = ["transform"], Ee = ["visibility"], De = {
|
|
728
|
+
key: 0,
|
|
729
|
+
class: "debug"
|
|
730
|
+
};
|
|
731
|
+
function Oe(e, t, o, s, u, d) {
|
|
732
|
+
let m = f("hover");
|
|
733
|
+
return l(), i("div", {
|
|
734
|
+
style: c(`width: ${o.width}px;`),
|
|
735
|
+
class: "vis-inner"
|
|
736
|
+
}, [
|
|
737
|
+
(l(), i("svg", {
|
|
738
|
+
ref: "svg",
|
|
739
|
+
width: o.width,
|
|
740
|
+
height: o.height,
|
|
741
|
+
class: "facet"
|
|
742
|
+
}, [a("g", {
|
|
743
|
+
ref: "inner",
|
|
744
|
+
transform: `translate(${o.margins.left} ${o.margins.top})`
|
|
745
|
+
}, [a("g", {
|
|
746
|
+
visibility: e.hover.visible ? "visible" : "hidden",
|
|
747
|
+
class: "hoverMarker",
|
|
748
|
+
ref: "hoverMarker"
|
|
749
|
+
}, [...t[0] ||= [a("line", null, null, -1)]], 8, Ee)], 8, Te)], 8, we)),
|
|
750
|
+
a("div", { style: c(`transform: translate(${o.margins.left}px, ${o.margins.top + d.innerHeight / 2}px); position: absolute; top: 0; left: 0;`) }, [e.hover.visible ? (l(), n(m, {
|
|
751
|
+
key: 0,
|
|
752
|
+
data: e.hover.data,
|
|
753
|
+
side: e.hover.side,
|
|
754
|
+
axis: e.hover.axis
|
|
755
|
+
}, null, 8, [
|
|
756
|
+
"data",
|
|
757
|
+
"side",
|
|
758
|
+
"axis"
|
|
759
|
+
])) : r("", !0)], 4),
|
|
760
|
+
e.debug ? (l(), i("span", De, p(e.debug), 1)) : r("", !0)
|
|
761
|
+
], 4);
|
|
762
|
+
}
|
|
763
|
+
var ke = /*#__PURE__*/ Q(Ce, [["render", Oe], ["__scopeId", "data-v-1f05a06e"]]), Ae = {
|
|
764
|
+
props: ["info", "props"],
|
|
765
|
+
mounted() {
|
|
766
|
+
let e = h.select(this.$refs.legendSymbol);
|
|
767
|
+
this.info.elements.forEach((t) => {
|
|
768
|
+
let n = e.append(t.type);
|
|
769
|
+
X.call(n.node(), D(t.props, this.props));
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
}, je = ["width", "height"];
|
|
773
|
+
function Me(e, t, n, r, a, o) {
|
|
774
|
+
return l(), i("svg", {
|
|
775
|
+
width: n.info.size,
|
|
776
|
+
height: n.info.size,
|
|
777
|
+
ref: "legendSymbol"
|
|
778
|
+
}, null, 8, je);
|
|
779
|
+
}
|
|
780
|
+
//#endregion
|
|
781
|
+
//#region src/comp/Legend.vue
|
|
782
|
+
var Ne = {
|
|
783
|
+
props: ["legend"],
|
|
784
|
+
inject: ["store"],
|
|
785
|
+
data: () => ({
|
|
786
|
+
info: {},
|
|
787
|
+
entries: []
|
|
788
|
+
}),
|
|
789
|
+
components: { LegendSymbol: /* @__PURE__ */ Q(Ae, [["render", Me], ["__scopeId", "data-v-ce0e972e"]]) },
|
|
790
|
+
mounted() {
|
|
791
|
+
this.info = this.store.mapping(this.legend), this.entries = Object.keys(this.info.props).map((e) => ({
|
|
792
|
+
key: e,
|
|
793
|
+
props: this.info.props[e],
|
|
794
|
+
filled: D(this.info.legend.props, this.info.props[e])
|
|
795
|
+
}));
|
|
796
|
+
},
|
|
797
|
+
methods: { switched(e) {
|
|
798
|
+
e.props.visible = !e.props.visible, this.$emit("changeSelected", {
|
|
799
|
+
dim: this.legend,
|
|
800
|
+
key: e.key,
|
|
801
|
+
selected: e.props.visible
|
|
802
|
+
});
|
|
803
|
+
} }
|
|
804
|
+
}, Pe = ["data-dim"], Fe = { class: "title" }, Ie = { class: "entries" }, Le = [
|
|
805
|
+
"data-visible",
|
|
806
|
+
"data-key",
|
|
807
|
+
"onClick",
|
|
808
|
+
"onMouseenter"
|
|
809
|
+
], Re = ["innerHTML"];
|
|
810
|
+
function ze(t, o, c, u, m, h) {
|
|
811
|
+
let g = f("LegendSymbol");
|
|
812
|
+
return l(), i("div", {
|
|
813
|
+
class: "legend",
|
|
814
|
+
"data-dim": c.legend
|
|
815
|
+
}, [a("div", Fe, p(t.info.name), 1), a("div", Ie, [(l(!0), i(e, null, d(t.entries, (e) => (l(), i("div", s({
|
|
816
|
+
"data-visible": e.props.visible,
|
|
817
|
+
"data-key": e.key
|
|
818
|
+
}, { ref_for: !0 }, Object.assign({ ...e.filled }, { name: null }), {
|
|
819
|
+
onClick: (t) => h.switched(e),
|
|
820
|
+
onMouseenter: (n) => t.$emit("highlight", {
|
|
821
|
+
dim: this.legend,
|
|
822
|
+
key: e.key
|
|
823
|
+
}),
|
|
824
|
+
onMouseleave: o[0] ||= (e) => t.$emit("highlight", {})
|
|
825
|
+
}), [t.info.legend.symbol ? (l(), n(g, {
|
|
826
|
+
key: 0,
|
|
827
|
+
info: t.info.legend.symbol,
|
|
828
|
+
props: e.props
|
|
829
|
+
}, null, 8, ["info", "props"])) : r("", !0), a("span", { innerHTML: e.filled.name }, null, 8, Re)], 16, Le))), 256))])], 8, Pe);
|
|
830
|
+
}
|
|
831
|
+
var Be = /*#__PURE__*/ Q(Ne, [["render", ze], ["__scopeId", "data-v-1bc8d55f"]]), Ve = {
|
|
832
|
+
props: ["element", "globals"],
|
|
833
|
+
computed: { vg() {
|
|
834
|
+
return this.globals[this.element.ref];
|
|
835
|
+
} },
|
|
836
|
+
methods: {
|
|
837
|
+
switched(e) {
|
|
838
|
+
this.globals[this.element.ref] = e.value, this.$emit("changeSelected", {});
|
|
839
|
+
},
|
|
840
|
+
equal(e) {
|
|
841
|
+
return C(e, this.vg);
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
}, He = ["id"], Ue = { class: "title" }, We = {
|
|
845
|
+
key: 0,
|
|
846
|
+
class: "entries"
|
|
847
|
+
}, Ge = ["id", "onClick"], Ke = [
|
|
848
|
+
"name",
|
|
849
|
+
"value",
|
|
850
|
+
"checked"
|
|
851
|
+
], qe = ["for"];
|
|
852
|
+
function Je(t, n, o, s, c, u) {
|
|
853
|
+
return l(), i("div", {
|
|
854
|
+
class: "formElement",
|
|
855
|
+
id: `container-${o.element.id}`
|
|
856
|
+
}, [a("div", Ue, p(o.element.name) + ":", 1), o.element.type == "switch" ? (l(), i("div", We, [(l(!0), i(e, null, d(o.element.values, (e) => (l(), i("div", {
|
|
857
|
+
id: `container-${e.id}`,
|
|
858
|
+
onClick: (t) => u.switched(e)
|
|
859
|
+
}, [a("input", {
|
|
860
|
+
type: "radio",
|
|
861
|
+
name: o.element.id,
|
|
862
|
+
value: e.id,
|
|
863
|
+
checked: u.equal(e.value)
|
|
864
|
+
}, null, 8, Ke), a("label", { for: e.id }, p(e.name), 9, qe)], 8, Ge))), 256))])) : r("", !0)], 8, He);
|
|
865
|
+
}
|
|
866
|
+
//#endregion
|
|
867
|
+
//#region src/comp/Vis.vue
|
|
868
|
+
var Ye = {
|
|
869
|
+
inject: ["store"],
|
|
870
|
+
data: () => ({
|
|
871
|
+
initialized: !1,
|
|
872
|
+
options: {},
|
|
873
|
+
globals: {},
|
|
874
|
+
legends: [],
|
|
875
|
+
formElements: [],
|
|
876
|
+
filter: [],
|
|
877
|
+
data: [],
|
|
878
|
+
facets: {
|
|
879
|
+
shared: {},
|
|
880
|
+
entries: [],
|
|
881
|
+
height: 0,
|
|
882
|
+
width: 0,
|
|
883
|
+
margins: {
|
|
884
|
+
top: 0,
|
|
885
|
+
right: 0,
|
|
886
|
+
bottom: 0,
|
|
887
|
+
left: 0
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
}),
|
|
891
|
+
computed: {
|
|
892
|
+
innerWidth() {
|
|
893
|
+
return this.options.width - (this.options.margins.left + this.options.margins.right);
|
|
894
|
+
},
|
|
895
|
+
innerHeight() {
|
|
896
|
+
return this.options.height - (this.options.margins.top + this.options.margins.bottom);
|
|
897
|
+
}
|
|
898
|
+
},
|
|
899
|
+
components: {
|
|
900
|
+
Facet: ke,
|
|
901
|
+
LegendEntry: Be,
|
|
902
|
+
FormElement: /* @__PURE__ */ Q(Ve, [["render", Je], ["__scopeId", "data-v-b7f59ae7"]])
|
|
903
|
+
},
|
|
904
|
+
mounted() {
|
|
905
|
+
this.baseInit(), this.dataInit(), this.scales(), this.store.def.options.width || (this.resizeObserver = new ResizeObserver(() => {
|
|
906
|
+
clearTimeout(this.resizeTimeout), this.resizeTimeout = setTimeout(this.resized, 100);
|
|
907
|
+
}), this.resizeObserver.observe(this.$refs.vis));
|
|
908
|
+
},
|
|
909
|
+
unmounted() {
|
|
910
|
+
this.resizeObserver?.disconnect(), clearTimeout(this.resizeTimeout);
|
|
911
|
+
},
|
|
912
|
+
methods: {
|
|
913
|
+
baseInit() {
|
|
914
|
+
this.legends = this.store.mappingNamesWithKey("legend"), this.formElements = this.store.def.formElements, this.globals = this.store.def.globals, this.options = Object.assign({}, this.store.def.options), this.measure();
|
|
915
|
+
},
|
|
916
|
+
measure() {
|
|
917
|
+
let e = this.store.def.options;
|
|
918
|
+
this.options.width = e.width || this.$refs.vis.getBoundingClientRect().width, this.options.height = E(e.height, { totalWidth: this.options.width });
|
|
919
|
+
},
|
|
920
|
+
resized() {
|
|
921
|
+
let e = this.$refs.vis?.getBoundingClientRect().width;
|
|
922
|
+
e && e != this.options.width && (this.measure(), this.dataInit(), this.scales());
|
|
923
|
+
},
|
|
924
|
+
dataInit() {
|
|
925
|
+
let e = this.store.def, t = this.store.axis;
|
|
926
|
+
if (this.filter = this.store.mappingNamesWithKey("props").map((e) => ({
|
|
927
|
+
dim: e,
|
|
928
|
+
key: Object.keys(this.store.mapping(e).props).filter((t) => this.store.mapping(e).props[t].visible)
|
|
929
|
+
})), this.data = o(x(this.store.data, this.filter)), t.v && this.store.mapping(t.v).stacked && re(this.data, t, e.facets ? [e.facets.dim] : []), e.facets) {
|
|
930
|
+
this.facets.margins = this.options.margins, this.facets.height = this.options.height;
|
|
931
|
+
let t = E(e.facets.cols, { totalWidth: this.options.width });
|
|
932
|
+
this.facets.width = this.options.width / t;
|
|
933
|
+
let n = e.facets.dim, r = b(this.data, [n]);
|
|
934
|
+
this.facets.entries = r.filter((e) => Object.keys(this.store.mapping(n).props).includes(e.group[n])).map((e) => ({
|
|
935
|
+
filter: {
|
|
936
|
+
dim: e.group[n],
|
|
937
|
+
key: n,
|
|
938
|
+
name: this.store.mapping(n).props[e.group[n]].name
|
|
939
|
+
},
|
|
940
|
+
data: o(e.entries)
|
|
941
|
+
}));
|
|
942
|
+
}
|
|
943
|
+
},
|
|
944
|
+
scales() {
|
|
945
|
+
let e = this.store.def;
|
|
946
|
+
if (e.facets && e.facets.scales) {
|
|
947
|
+
let t = E(e.facets.scales, e.globals).map((e) => {
|
|
948
|
+
let t = {
|
|
949
|
+
dim: e,
|
|
950
|
+
mapping: this.store.mapping(e)
|
|
951
|
+
};
|
|
952
|
+
return ne(t, this.data), Y(t, {
|
|
953
|
+
width: this.facets.width - (this.facets.margins.left + this.facets.margins.right),
|
|
954
|
+
height: this.facets.height - (this.facets.margins.top + this.facets.margins.bottom)
|
|
955
|
+
}), t;
|
|
956
|
+
});
|
|
957
|
+
y(this.data, t), this.facets.shared = Object.fromEntries(t.map((e) => [e.dim, e]));
|
|
958
|
+
}
|
|
959
|
+
this.initialized = !0;
|
|
960
|
+
},
|
|
961
|
+
changeSelected(e) {
|
|
962
|
+
this.dataInit(), this.scales();
|
|
963
|
+
},
|
|
964
|
+
formChanged(e) {
|
|
965
|
+
this.store.applyFormElements(), this.changeSelected(e);
|
|
966
|
+
},
|
|
967
|
+
highlight(e) {
|
|
968
|
+
Z(h.select(this.$refs.vis), this.store.def.plot, { [e.dim]: e.key });
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
}, Xe = { class: "vis-header" }, Ze = { class: "title" }, Qe = { class: "subtitle" }, $e = {
|
|
972
|
+
ref: "form",
|
|
973
|
+
class: "vis-form-elements"
|
|
974
|
+
}, et = {
|
|
975
|
+
ref: "legends",
|
|
976
|
+
class: "vis-legends"
|
|
977
|
+
}, tt = {
|
|
978
|
+
key: 0,
|
|
979
|
+
class: "vis-body"
|
|
980
|
+
}, nt = { class: "vis-footer" }, rt = ["innerHTML"];
|
|
981
|
+
function it(t, o, s, u, m, h) {
|
|
982
|
+
let g = f("form-element"), _ = f("legend-entry"), v = f("facet");
|
|
983
|
+
return l(), i("div", {
|
|
984
|
+
class: "vis",
|
|
985
|
+
ref: "vis",
|
|
986
|
+
style: c({ "--gen-vis-font-family": t.options.fontFamily })
|
|
987
|
+
}, [
|
|
988
|
+
a("div", Xe, [a("div", Ze, p(t.options.title), 1), a("div", Qe, p(t.options.subtitle), 1)]),
|
|
989
|
+
a("div", $e, [(l(!0), i(e, null, d(t.formElements, (e) => (l(), n(g, {
|
|
990
|
+
element: e,
|
|
991
|
+
globals: t.globals,
|
|
992
|
+
onChangeSelected: h.formChanged
|
|
993
|
+
}, null, 8, [
|
|
994
|
+
"element",
|
|
995
|
+
"globals",
|
|
996
|
+
"onChangeSelected"
|
|
997
|
+
]))), 256))], 512),
|
|
998
|
+
a("div", et, [(l(!0), i(e, null, d(t.legends, (e) => (l(), n(_, {
|
|
999
|
+
legend: e,
|
|
1000
|
+
onChangeSelected: h.changeSelected,
|
|
1001
|
+
onHighlight: h.highlight
|
|
1002
|
+
}, null, 8, [
|
|
1003
|
+
"legend",
|
|
1004
|
+
"onChangeSelected",
|
|
1005
|
+
"onHighlight"
|
|
1006
|
+
]))), 256))], 512),
|
|
1007
|
+
t.initialized ? (l(), i("div", tt, [t.facets.entries.length > 0 ? (l(!0), i(e, { key: 0 }, d(t.facets.entries, (e) => (l(), i("div", { style: c(`width: ${t.facets.width}px; display: inline-block;`) }, [a("div", {
|
|
1008
|
+
class: "facet-title",
|
|
1009
|
+
style: c(`margin-left: ${t.facets.margins.left}px`)
|
|
1010
|
+
}, p(e.filter.name), 5), (l(), n(v, {
|
|
1011
|
+
key: e.data,
|
|
1012
|
+
data: e.data,
|
|
1013
|
+
shared: t.facets.shared,
|
|
1014
|
+
height: t.facets.height,
|
|
1015
|
+
width: t.facets.width,
|
|
1016
|
+
margins: t.facets.margins
|
|
1017
|
+
}, null, 8, [
|
|
1018
|
+
"data",
|
|
1019
|
+
"shared",
|
|
1020
|
+
"height",
|
|
1021
|
+
"width",
|
|
1022
|
+
"margins"
|
|
1023
|
+
]))], 4))), 256)) : (l(), n(v, {
|
|
1024
|
+
key: t.data,
|
|
1025
|
+
data: t.data,
|
|
1026
|
+
shared: {},
|
|
1027
|
+
height: t.options.height,
|
|
1028
|
+
width: t.options.width,
|
|
1029
|
+
margins: t.options.margins
|
|
1030
|
+
}, null, 8, [
|
|
1031
|
+
"data",
|
|
1032
|
+
"height",
|
|
1033
|
+
"width",
|
|
1034
|
+
"margins"
|
|
1035
|
+
]))])) : r("", !0),
|
|
1036
|
+
a("div", nt, [a("span", { innerHTML: t.options.footer }, null, 8, rt)])
|
|
1037
|
+
], 4);
|
|
1038
|
+
}
|
|
1039
|
+
//#endregion
|
|
1040
|
+
//#region src/comp/App.vue
|
|
1041
|
+
var at = {
|
|
1042
|
+
name: "GenVis",
|
|
1043
|
+
props: {
|
|
1044
|
+
debug: {
|
|
1045
|
+
type: Boolean,
|
|
1046
|
+
default: !1
|
|
1047
|
+
},
|
|
1048
|
+
defFile: {
|
|
1049
|
+
type: String,
|
|
1050
|
+
default: null
|
|
1051
|
+
},
|
|
1052
|
+
def: {
|
|
1053
|
+
type: [Object, String],
|
|
1054
|
+
default: null
|
|
1055
|
+
},
|
|
1056
|
+
data: {
|
|
1057
|
+
type: [Array, String],
|
|
1058
|
+
default: null
|
|
1059
|
+
}
|
|
1060
|
+
},
|
|
1061
|
+
data: () => ({
|
|
1062
|
+
store: me(),
|
|
1063
|
+
error: null
|
|
1064
|
+
}),
|
|
1065
|
+
provide() {
|
|
1066
|
+
return { store: this.store };
|
|
1067
|
+
},
|
|
1068
|
+
components: { VisBase: /* @__PURE__ */ Q(Ye, [["render", it], ["__scopeId", "data-v-f8fa11d2"]]) },
|
|
1069
|
+
watch: {
|
|
1070
|
+
def: "init",
|
|
1071
|
+
defFile: "init",
|
|
1072
|
+
data: "init"
|
|
1073
|
+
},
|
|
1074
|
+
mounted() {
|
|
1075
|
+
this.init();
|
|
1076
|
+
},
|
|
1077
|
+
errorCaptured(e) {
|
|
1078
|
+
return this.showError(e), !1;
|
|
1079
|
+
},
|
|
1080
|
+
methods: {
|
|
1081
|
+
async init() {
|
|
1082
|
+
if (this.error = null, this.def === null && this.defFile === null) return this.showError(/* @__PURE__ */ Error("No definition given."));
|
|
1083
|
+
try {
|
|
1084
|
+
await this.store.init({
|
|
1085
|
+
def: this.def,
|
|
1086
|
+
defUrl: this.defFile,
|
|
1087
|
+
data: this.data
|
|
1088
|
+
});
|
|
1089
|
+
} catch (e) {
|
|
1090
|
+
this.showError(e);
|
|
1091
|
+
}
|
|
1092
|
+
},
|
|
1093
|
+
showError(e) {
|
|
1094
|
+
console.error(e), this.error = e.message;
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
}, ot = { class: "vis-outer" }, st = {
|
|
1098
|
+
key: 0,
|
|
1099
|
+
class: "vis-error"
|
|
1100
|
+
}, ct = { key: 2 }, lt = { style: {
|
|
1101
|
+
height: "500px",
|
|
1102
|
+
overflow: "auto",
|
|
1103
|
+
"font-size": "11px"
|
|
1104
|
+
} }, ut = { style: {
|
|
1105
|
+
height: "500px",
|
|
1106
|
+
overflow: "auto",
|
|
1107
|
+
"font-size": "11px"
|
|
1108
|
+
} };
|
|
1109
|
+
function dt(e, t, o, s, c, u) {
|
|
1110
|
+
let d = f("vis-base");
|
|
1111
|
+
return l(), i("div", ot, [e.error ? (l(), i("div", st, p(e.error), 1)) : e.store.loaded ? (l(), n(d, { key: 1 })) : r("", !0), o.debug && e.store.def ? (l(), i("div", ct, [
|
|
1112
|
+
t[0] ||= a("h3", null, "prepared:", -1),
|
|
1113
|
+
a("pre", lt, p(JSON.stringify(e.store.def, null, 4)), 1),
|
|
1114
|
+
t[1] ||= a("h3", null, "org:", -1),
|
|
1115
|
+
a("pre", ut, p(JSON.stringify(e.store.defOrg, null, 4)), 1)
|
|
1116
|
+
])) : r("", !0)]);
|
|
1117
|
+
}
|
|
1118
|
+
var $ = /*#__PURE__*/ Q(at, [["render", dt], ["__scopeId", "data-v-a9d47434"]]), ft = { install(e) {
|
|
1119
|
+
e.component("GenVis", $);
|
|
1120
|
+
} }, pt = (e) => {
|
|
1121
|
+
let n = Object.fromEntries(e.getAttributeNames().filter((e) => e.startsWith("data-")).map((t) => [t.substring(5), e.getAttribute(t)]));
|
|
1122
|
+
return t($, n).mount(e);
|
|
1123
|
+
}, mt = (e) => {
|
|
1124
|
+
for (let t of document.getElementsByClassName(e)) t.classList.contains("gen-vis-attached") || (t.classList.add("gen-vis-attached"), pt(t));
|
|
1125
|
+
};
|
|
1126
|
+
//#endregion
|
|
1127
|
+
export { $ as GenVis, ft as default, mt as mountGenVisByClass, pt as mountGenVisElement };
|